From f35ff97f2e572a6b02180b248f929541962ffdd3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 8 Apr 2011 07:41:47 +0200 Subject: lavf: use designated initializers for all protocols This is more readable and makes it easier to reorder URLProtocol members. --- libavformat/file.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'libavformat/file.c') diff --git a/libavformat/file.c b/libavformat/file.c index 729061a4e5..3293a5369b 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -95,12 +95,12 @@ static int file_close(URLContext *h) } URLProtocol ff_file_protocol = { - "file", - file_open, - file_read, - file_write, - file_seek, - file_close, + .name = "file", + .url_open = file_open, + .url_read = file_read, + .url_write = file_write, + .url_seek = file_seek, + .url_close = file_close, .url_get_file_handle = file_get_handle, }; @@ -131,10 +131,10 @@ static int pipe_open(URLContext *h, const char *filename, int flags) } URLProtocol ff_pipe_protocol = { - "pipe", - pipe_open, - file_read, - file_write, + .name = "pipe", + .url_open = pipe_open, + .url_read = file_read, + .url_write = file_write, .url_get_file_handle = file_get_handle, }; -- cgit v1.2.3 From c486dade95ba529151391a7879538c9d4787752b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 7 Apr 2011 20:25:52 +0200 Subject: avio: make URLContext internal. --- libavformat/avio.h | 3 ++- libavformat/avio_internal.h | 1 + libavformat/file.c | 1 + libavformat/http.h | 2 +- libavformat/librtmp.c | 1 + libavformat/mms.h | 2 +- libavformat/rtmppkt.h | 1 + libavformat/rtpdec.h | 1 + libavformat/rtpenc_chain.h | 1 + libavformat/url.h | 11 +++++++++++ 10 files changed, 21 insertions(+), 3 deletions(-) (limited to 'libavformat/file.c') diff --git a/libavformat/avio.h b/libavformat/avio.h index 701f3fe66c..a97d6308ac 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -37,12 +37,14 @@ /* unbuffered I/O */ +#if FF_API_OLD_AVIO /** * URL Context. * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. * sizeof(URLContext) must not be used outside libav*. + * @deprecated This struct will be made private */ typedef struct URLContext { #if FF_API_URL_CLASS @@ -57,7 +59,6 @@ typedef struct URLContext { int is_connected; } URLContext; -#if FF_API_OLD_AVIO typedef struct URLPollEntry { URLContext *handle; int events; diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 2879ee1ed1..721a3c4602 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -21,6 +21,7 @@ #define AVFORMAT_AVIO_INTERNAL_H #include "avio.h" +#include "url.h" int ffio_init_context(AVIOContext *s, unsigned char *buffer, diff --git a/libavformat/file.c b/libavformat/file.c index 3293a5369b..31067ede69 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -29,6 +29,7 @@ #include #include #include "os_support.h" +#include "url.h" /* standard file protocol */ diff --git a/libavformat/http.h b/libavformat/http.h index 97f54cc71a..c5ff5e134c 100644 --- a/libavformat/http.h +++ b/libavformat/http.h @@ -22,7 +22,7 @@ #ifndef AVFORMAT_HTTP_H #define AVFORMAT_HTTP_H -#include "avio.h" +#include "url.h" /** * Set custom HTTP headers. diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c index 5770e59e7a..db5cc9858b 100644 --- a/libavformat/librtmp.c +++ b/libavformat/librtmp.c @@ -25,6 +25,7 @@ */ #include "avformat.h" +#include "url.h" #include #include diff --git a/libavformat/mms.h b/libavformat/mms.h index e85d59a24f..12e9ef0962 100644 --- a/libavformat/mms.h +++ b/libavformat/mms.h @@ -21,7 +21,7 @@ #ifndef AVFORMAT_MMS_H #define AVFORMAT_MMS_H -#include "avformat.h" +#include "url.h" typedef struct { int id; diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h index 8ad29240bc..bb3475811e 100644 --- a/libavformat/rtmppkt.h +++ b/libavformat/rtmppkt.h @@ -23,6 +23,7 @@ #define AVFORMAT_RTMPPKT_H #include "avformat.h" +#include "url.h" /** maximum possible number of different RTMP channels */ #define RTMP_CHANNELS 65599 diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index 1d4a9b6337..da53efc1f4 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "avformat.h" #include "rtp.h" +#include "url.h" typedef struct PayloadContext PayloadContext; typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler; diff --git a/libavformat/rtpenc_chain.h b/libavformat/rtpenc_chain.h index 678b49e27b..6bdddcfe99 100644 --- a/libavformat/rtpenc_chain.h +++ b/libavformat/rtpenc_chain.h @@ -23,6 +23,7 @@ #define AVFORMAT_RTPENC_CHAIN_H #include "avformat.h" +#include "url.h" AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, URLContext *handle, int packet_size); diff --git a/libavformat/url.h b/libavformat/url.h index b8ea6ad2eb..b6c110dfe9 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -32,6 +32,17 @@ #define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ extern int (*url_interrupt_cb)(void); + +typedef struct URLContext { + const AVClass *av_class; /**< information for av_log(). Set by url_open(). */ + struct URLProtocol *prot; + void *priv_data; + char *filename; /**< specified URL */ + int flags; + int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */ + int is_streamed; /**< true if streamed (no seek possible), default = false */ + int is_connected; +} URLContext; #endif /** -- cgit v1.2.3