---
libavformat/allformats.c | 2 +-
libavformat/applehttpproto.c | 2 +-
libavformat/avio.c | 26 +++++++++++++-------------
libavformat/avio.h | 6 +++++-
libavformat/concat.c | 2 +-
libavformat/file.c | 4 ++--
libavformat/gopher.c | 2 +-
libavformat/http.c | 2 +-
libavformat/librtmp.c | 10 +++++-----
libavformat/md5proto.c | 2 +-
libavformat/mmsh.c | 2 +-
libavformat/mmst.c | 2 +-
libavformat/rtmpproto.c | 2 +-
libavformat/rtpproto.c | 2 +-
libavformat/tcp.c | 2 +-
libavformat/udp.c | 2 +-
libavformat/url.h | 28 ++++++++++++++++++++++++----
17 files changed, 61 insertions(+), 37 deletions(-)
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 9398d34..652a8e8 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -34,7 +34,7 @@
#define REGISTER_MUXDEMUX(X,x) REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x)
#define REGISTER_PROTOCOL(X,x) { \
- extern URLProtocol ff_##x##_protocol; \
+ extern FFURLProtocol ff_##x##_protocol; \
if(CONFIG_##X##_PROTOCOL) ffurl_register_protocol(&ff_##x##_protocol,
sizeof(ff_##x##_protocol)); }
void av_register_all(void)
diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c
index dad34e4..254e064 100644
--- a/libavformat/applehttpproto.c
+++ b/libavformat/applehttpproto.c
@@ -297,7 +297,7 @@ static int applehttp_close(FFURLContext *h)
return 0;
}
-URLProtocol ff_applehttp_protocol = {
+FFURLProtocol ff_applehttp_protocol = {
"applehttp",
applehttp_open,
applehttp_read,
diff --git a/libavformat/avio.c b/libavformat/avio.c
index b1a31f1..b5320c8 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -48,11 +48,11 @@ static const AVClass urlcontext_class =
static int default_interrupt_cb(void);
-URLProtocol *first_protocol = NULL;
+FFURLProtocol *first_protocol = NULL;
int (*url_interrupt_cb)(void) = default_interrupt_cb;
#if FF_API_OLD_AVIO
-URLProtocol *av_protocol_next(URLProtocol *p)
+FFURLProtocol *av_protocol_next(FFURLProtocol *p)
{
if(p) return p->next;
else return first_protocol;
@@ -61,7 +61,7 @@ URLProtocol *av_protocol_next(URLProtocol *p)
const char *avio_enum_protocols(void **opaque, int output)
{
- URLProtocol **p = opaque;
+ FFURLProtocol **p = opaque;
*p = *p ? (*p)->next : first_protocol;
if (!*p) return NULL;
if ((output && (*p)->url_write) || (!output && (*p)->url_read))
@@ -69,11 +69,11 @@ const char *avio_enum_protocols(void **opaque, int output)
return avio_enum_protocols(opaque, output);
}
-int ffurl_register_protocol(URLProtocol *protocol, int size)
+int ffurl_register_protocol(FFURLProtocol *protocol, int size)
{
- URLProtocol **p;
- if (size < sizeof(URLProtocol)) {
- URLProtocol* temp = av_mallocz(sizeof(URLProtocol));
+ FFURLProtocol **p;
+ if (size < sizeof(FFURLProtocol)) {
+ FFURLProtocol* temp = av_mallocz(sizeof(FFURLProtocol));
memcpy(temp, protocol, size);
protocol = temp;
}
@@ -93,21 +93,21 @@ struct URLProtocol_compat {
int (*url_write)(FFURLContext *h, unsigned char *buf, int size);
int64_t (*url_seek)(FFURLContext *h, int64_t pos, int whence);
int (*url_close)(FFURLContext *h);
- struct URLProtocol *next;
+ struct FFURLProtocol *next;
};
-int av_register_protocol(URLProtocol *protocol)
+int av_register_protocol(FFURLProtocol *protocol)
{
return ffurl_register_protocol(protocol, sizeof(struct
URLProtocol_compat));
}
-int register_protocol(URLProtocol *protocol)
+int register_protocol(FFURLProtocol *protocol)
{
return ffurl_register_protocol(protocol, sizeof(struct
URLProtocol_compat));
}
#endif
-static int url_alloc_for_protocol (FFURLContext **puc, struct URLProtocol *up,
+static int url_alloc_for_protocol (FFURLContext **puc, FFURLProtocol *up,
const char *filename, int flags)
{
FFURLContext *uc;
@@ -232,7 +232,7 @@ void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)
{
avio_set_interrupt_cb(interrupt_cb);
}
-int av_register_protocol2(URLProtocol *protocol, int size)
+int av_register_protocol2(FFURLProtocol *protocol, int size)
{
return ffurl_register_protocol(protocol, size);
}
@@ -249,7 +249,7 @@ int url_exist(const char *filename)
int ffurl_alloc(FFURLContext **puc, const char *filename, int flags)
{
- URLProtocol *up;
+ FFURLProtocol *up;
char proto_str[128], proto_nested[128], *ptr;
size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 0a82f95..18e3edd 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -140,8 +140,11 @@ attribute_deprecated int url_poll(URLPollEntry
*poll_table, int n, int timeout);
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the
first part of a nested protocol scheme */
-#endif
+/**
+ * @deprecated This struct is to be made private. Use the higher-level
+ * AVIOContext-based API instead.
+ */
typedef struct URLProtocol {
const char *name;
int (*url_open)(URLContext *h, const char *url, int flags);
@@ -158,6 +161,7 @@ typedef struct URLProtocol {
const AVClass *priv_data_class;
int flags;
} URLProtocol;
+#endif
#if FF_API_REGISTER_PROTOCOL
extern URLProtocol *first_protocol;
diff --git a/libavformat/concat.c b/libavformat/concat.c
index 4ef065a..5f1f3e8 100644
--- a/libavformat/concat.c
+++ b/libavformat/concat.c
@@ -189,7 +189,7 @@ static int64_t concat_seek(FFURLContext *h, int64_t pos,
int whence)
return result;
}
-URLProtocol ff_concat_protocol = {
+FFURLProtocol ff_concat_protocol = {
"concat",
concat_open,
concat_read,
diff --git a/libavformat/file.c b/libavformat/file.c
index f9e2e72..0ac0cb6 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -95,7 +95,7 @@ static int file_close(FFURLContext *h)
return close(fd);
}
-URLProtocol ff_file_protocol = {
+FFURLProtocol ff_file_protocol = {
"file",
file_open,
file_read,
@@ -131,7 +131,7 @@ static int pipe_open(FFURLContext *h, const char *filename,
int flags)
return 0;
}
-URLProtocol ff_pipe_protocol = {
+FFURLProtocol ff_pipe_protocol = {
"pipe",
pipe_open,
file_read,
diff --git a/libavformat/gopher.c b/libavformat/gopher.c
index ba9df30..f743216 100644
--- a/libavformat/gopher.c
+++ b/libavformat/gopher.c
@@ -120,7 +120,7 @@ static int gopher_read(FFURLContext *h, uint8_t *buf, int
size)
}
-URLProtocol ff_gopher_protocol = {
+FFURLProtocol ff_gopher_protocol = {
"gopher",
gopher_open,
gopher_read,
diff --git a/libavformat/http.c b/libavformat/http.c
index 48031c0..d8dc0cc 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -504,7 +504,7 @@ http_get_file_handle(FFURLContext *h)
return ffurl_get_file_handle(s->hd);
}
-URLProtocol ff_http_protocol = {
+FFURLProtocol ff_http_protocol = {
"http",
http_open,
http_read,
diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c
index db3b837..3b4fb20 100644
--- a/libavformat/librtmp.c
+++ b/libavformat/librtmp.c
@@ -158,7 +158,7 @@ static int rtmp_get_file_handle(FFURLContext *s)
return RTMP_Socket(r);
}
-URLProtocol ff_rtmp_protocol = {
+FFURLProtocol ff_rtmp_protocol = {
"rtmp",
rtmp_open,
rtmp_read,
@@ -171,7 +171,7 @@ URLProtocol ff_rtmp_protocol = {
rtmp_get_file_handle
};
-URLProtocol ff_rtmpt_protocol = {
+FFURLProtocol ff_rtmpt_protocol = {
"rtmpt",
rtmp_open,
rtmp_read,
@@ -184,7 +184,7 @@ URLProtocol ff_rtmpt_protocol = {
rtmp_get_file_handle
};
-URLProtocol ff_rtmpe_protocol = {
+FFURLProtocol ff_rtmpe_protocol = {
"rtmpe",
rtmp_open,
rtmp_read,
@@ -197,7 +197,7 @@ URLProtocol ff_rtmpe_protocol = {
rtmp_get_file_handle
};
-URLProtocol ff_rtmpte_protocol = {
+FFURLProtocol ff_rtmpte_protocol = {
"rtmpte",
rtmp_open,
rtmp_read,
@@ -210,7 +210,7 @@ URLProtocol ff_rtmpte_protocol = {
rtmp_get_file_handle
};
-URLProtocol ff_rtmps_protocol = {
+FFURLProtocol ff_rtmps_protocol = {
"rtmps",
rtmp_open,
rtmp_read,
diff --git a/libavformat/md5proto.c b/libavformat/md5proto.c
index 3a72901..b808d7b 100644
--- a/libavformat/md5proto.c
+++ b/libavformat/md5proto.c
@@ -83,7 +83,7 @@ static int md5_get_handle(FFURLContext *h)
return (intptr_t)h->priv_data;
}
-URLProtocol ff_md5_protocol = {
+FFURLProtocol ff_md5_protocol = {
.name = "md5",
.url_open = md5_open,
.url_write = md5_write,
diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c
index 63ae839..0e25fa7 100644
--- a/libavformat/mmsh.c
+++ b/libavformat/mmsh.c
@@ -360,7 +360,7 @@ static int mmsh_read(FFURLContext *h, uint8_t *buf, int
size)
return res;
}
-URLProtocol ff_mmsh_protocol = {
+FFURLProtocol ff_mmsh_protocol = {
.name = "mmsh",
.url_open = mmsh_open,
.url_read = mmsh_read,
diff --git a/libavformat/mmst.c b/libavformat/mmst.c
index 61247ed..f37122d 100644
--- a/libavformat/mmst.c
+++ b/libavformat/mmst.c
@@ -622,7 +622,7 @@ static int mms_read(FFURLContext *h, uint8_t *buf, int size)
return result;
}
-URLProtocol ff_mmst_protocol = {
+FFURLProtocol ff_mmst_protocol = {
"mmst",
mms_open,
mms_read,
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index de77514..74bbb0a 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -990,7 +990,7 @@ static int rtmp_write(FFURLContext *s, const uint8_t *buf,
int size)
return size;
}
-URLProtocol ff_rtmp_protocol = {
+FFURLProtocol ff_rtmp_protocol = {
"rtmp",
rtmp_open,
rtmp_read,
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 6976c08..26b90e2 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -354,7 +354,7 @@ int rtp_get_rtcp_file_handle(FFURLContext *h) {
return s->rtcp_fd;
}
-URLProtocol ff_rtp_protocol = {
+FFURLProtocol ff_rtp_protocol = {
"rtp",
rtp_open,
rtp_read,
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index b6365d0..1e2782d 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -194,7 +194,7 @@ static int tcp_get_file_handle(FFURLContext *h)
return s->fd;
}
-URLProtocol ff_tcp_protocol = {
+FFURLProtocol ff_tcp_protocol = {
"tcp",
tcp_open,
tcp_read,
diff --git a/libavformat/udp.c b/libavformat/udp.c
index cf23c93..e5cc036 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -488,7 +488,7 @@ static int udp_close(FFURLContext *h)
return 0;
}
-URLProtocol ff_udp_protocol = {
+FFURLProtocol ff_udp_protocol = {
"udp",
udp_open,
udp_read,
diff --git a/libavformat/url.h b/libavformat/url.h
index f84c5ce..d893ecb 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -35,7 +35,7 @@ extern int (*url_interrupt_cb)(void);
typedef struct FFURLContext {
const AVClass *av_class; /**< information for av_log(). Set by
url_open(). */
- struct URLProtocol *prot;
+ struct FFURLProtocol *prot;
void *priv_data;
char *filename; /**< specified URL */
int flags;
@@ -43,8 +43,28 @@ typedef struct FFURLContext {
int is_streamed; /**< true if streamed (no seek possible),
default = false */
int is_connected;
} FFURLContext;
+
+typedef struct FFURLProtocol {
+ const AVClass *priv_data_class;
+ int priv_data_size;
+ const char *name;
+
+ int (*url_open) (URLContext *h, const char *url, int flags);
+ int (*url_read) (URLContext *h, unsigned char *buf, int size);
+ int (*url_write)(URLContext *h, const unsigned char *buf, int size);
+ int64_t (*url_seek) (URLContext *h, int64_t pos, int whence);
+ int (*url_close)(URLContext *h);
+
+ int (*url_read_pause)(URLContext *h, int pause);
+ int64_t (*url_read_seek) (URLContext *h, int stream_index,
+ int64_t timestamp, int flags);
+ int (*url_get_file_handle)(URLContext *h);
+ int flags;
+ struct FFURLProtocol *next;
+} FFURLProtocol;
#else
typedef URLContext FFURLContext;
+typedef URLProtocol FFURLProtocol;
#endif
/**
@@ -147,11 +167,11 @@ int64_t ffurl_size(FFURLContext *h);
int ffurl_get_file_handle(FFURLContext *h);
/**
- * Register the URLProtocol protocol.
+ * Register the FFURLProtocol protocol.
*
- * @param size the size of the URLProtocol struct referenced
+ * @param size the size of the FFURLProtocol struct referenced
*/
-int ffurl_register_protocol(URLProtocol *protocol, int size);
+int ffurl_register_protocol(FFURLProtocol *protocol, int size);
/* udp.c */
int ff_udp_set_remote_url(FFURLContext *h, const char *uri);
--
1.7.4.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel