aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-04-09 03:09:49 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-04-09 03:17:07 +0200
commitd4d09329eef30787da699c7a397b00f6f96940bc (patch)
tree3605d4e30063b924254a373e270026bca6436f11
parenta61bc91d42945e6ccefef4867ef32d2073f8f8c7 (diff)
parent0c68c804196400de3c40c8849124b292ed62b99c (diff)
downloadffmpeg-d4d09329eef30787da699c7a397b00f6f96940bc.tar.gz
Merge remote branch 'qatar/master'
* qatar/master: lavf: bump minor and add an APIChanges entry for avformat cleanup lavf: get rid of ffm-specific stuff in avformat.h Not pulled: avio: deprecate av_protocol_next(). avio: add a function for iterating though protocol names. lavf: rename a parameter of av_sdp_create from buff->buf lavf: rename avf_sdp_create to av_sdp_create. lavf: make av_guess_image2_codec internal avio: make URLProtocol internal. avio: make URLContext internal. lavf: mark av_pkt_dump(_log) for remove on $next+1 bump. lavf: use designated initializers for all protocols applehttp: don't use deprecated url_ functions. avio: move two ff_udp_* functions from avio_internal to url.h asfdec: remove a forgotten declaration of nonexistent function avio: deprecate the typedef for URLInterruptCB Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--doc/APIchanges5
-rw-r--r--ffmpeg.c4
-rw-r--r--ffserver.c3
-rw-r--r--libavformat/applehttp.c16
-rw-r--r--libavformat/applehttpproto.c12
-rw-r--r--libavformat/asfdec.c2
-rw-r--r--libavformat/avformat.h24
-rw-r--r--libavformat/avio.c14
-rw-r--r--libavformat/avio.h29
-rw-r--r--libavformat/avio_internal.h5
-rw-r--r--libavformat/concat.c11
-rw-r--r--libavformat/ffm.h5
-rw-r--r--libavformat/file.c21
-rw-r--r--libavformat/gopher.c11
-rw-r--r--libavformat/http.c16
-rw-r--r--libavformat/http.h2
-rw-r--r--libavformat/img2.c8
-rw-r--r--libavformat/internal.h2
-rw-r--r--libavformat/librtmp.c91
-rw-r--r--libavformat/mms.h2
-rw-r--r--libavformat/mmst.c10
-rw-r--r--libavformat/rtmppkt.h1
-rw-r--r--libavformat/rtmpproto.c11
-rw-r--r--libavformat/rtpdec.h1
-rw-r--r--libavformat/rtpenc_chain.h1
-rw-r--r--libavformat/rtpproto.c11
-rw-r--r--libavformat/rtspenc.c2
-rw-r--r--libavformat/sapenc.c2
-rw-r--r--libavformat/sdp.c19
-rw-r--r--libavformat/tcp.c11
-rw-r--r--libavformat/udp.c11
-rw-r--r--libavformat/url.h34
-rw-r--r--libavformat/utils.c8
-rw-r--r--libavformat/version.h9
34 files changed, 249 insertions, 165 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index 2f4b28cd32..22d08d4453 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -12,6 +12,11 @@ libavutil: 2009-03-08
API changes, most recent first:
+2011-04-08 - lavf 52.106.0 - avformat.h
+ Minor avformat.h cleanup:
+ a9bf9d8 deprecate av_guess_image2_codec
+ c3675df rename avf_sdp_create->av_sdp_create
+
2011-04-03 - lavf 52.105.0 - avio.h
Large-scale renaming/deprecating of AVIOContext-related functions:
724f6a0 deprecate url_fdopen
diff --git a/ffmpeg.c b/ffmpeg.c
index 40e5e67ee4..3e611e6334 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -47,6 +47,8 @@
#include "libavutil/libm.h"
#include "libavformat/os_support.h"
+#include "libavformat/ffm.h" // not public API
+
#if CONFIG_AVFILTER
# include "libavfilter/avfilter.h"
# include "libavfilter/avfiltergraph.h"
@@ -1881,7 +1883,7 @@ static void print_sdp(AVFormatContext **avc, int n)
{
char sdp[2048];
- avf_sdp_create(avc, n, sdp, sizeof(sdp));
+ av_sdp_create(avc, n, sdp, sizeof(sdp));
printf("SDP:\n%s\n", sdp);
fflush(stdout);
}
diff --git a/ffserver.c b/ffserver.c
index 6e429799ae..a047e7338b 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -29,6 +29,7 @@
#include <strings.h>
#include <stdlib.h>
#include "libavformat/avformat.h"
+#include "libavformat/ffm.h"
#include "libavformat/network.h"
#include "libavformat/os_support.h"
#include "libavformat/rtpdec.h"
@@ -2957,7 +2958,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
avc->streams[i]->codec = stream->streams[i]->codec;
}
*pbuffer = av_mallocz(2048);
- avf_sdp_create(&avc, 1, *pbuffer, 2048);
+ av_sdp_create(&avc, 1, *pbuffer, 2048);
sdp_done:
#if !FF_API_MAX_STREAMS
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c
index 44a27a510e..7592dc3cc3 100644
--- a/libavformat/applehttp.c
+++ b/libavformat/applehttp.c
@@ -113,7 +113,7 @@ static void free_variant_list(AppleHTTPContext *c)
av_free_packet(&var->pkt);
av_free(var->pb.buffer);
if (var->input)
- url_close(var->input);
+ ffurl_close(var->input);
if (var->ctx) {
var->ctx->pb = NULL;
av_close_input_file(var->ctx);
@@ -291,18 +291,18 @@ reload:
goto reload;
}
- ret = url_open(&v->input,
- v->segments[v->cur_seq_no - v->start_seq_no]->url,
- AVIO_RDONLY);
+ ret = ffurl_open(&v->input,
+ v->segments[v->cur_seq_no - v->start_seq_no]->url,
+ AVIO_RDONLY);
if (ret < 0)
return ret;
}
- ret = url_read(v->input, buf, buf_size);
+ ret = ffurl_read(v->input, buf, buf_size);
if (ret > 0)
return ret;
if (ret < 0 && ret != AVERROR_EOF)
return ret;
- url_close(v->input);
+ ffurl_close(v->input);
v->input = NULL;
v->cur_seq_no++;
@@ -435,7 +435,7 @@ static int recheck_discard_flags(AVFormatContext *s, int first)
av_log(s, AV_LOG_INFO, "Now receiving variant %d\n", i);
} else if (first && !v->cur_needed && v->needed) {
if (v->input)
- url_close(v->input);
+ ffurl_close(v->input);
v->input = NULL;
v->needed = 0;
changed = 1;
@@ -517,7 +517,7 @@ static int applehttp_read_seek(AVFormatContext *s, int stream_index,
struct variant *var = c->variants[i];
int64_t pos = 0;
if (var->input) {
- url_close(var->input);
+ ffurl_close(var->input);
var->input = NULL;
}
av_free_packet(&var->pkt);
diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c
index 850292af2d..4871cccd71 100644
--- a/libavformat/applehttpproto.c
+++ b/libavformat/applehttpproto.c
@@ -298,11 +298,9 @@ static int applehttp_close(URLContext *h)
}
URLProtocol ff_applehttp_protocol = {
- "applehttp",
- applehttp_open,
- applehttp_read,
- NULL, /* write */
- NULL, /* seek */
- applehttp_close,
- .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
+ .name = "applehttp",
+ .url_open = applehttp_open,
+ .url_read = applehttp_read,
+ .url_close = applehttp_close,
+ .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
};
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index d3fdf034b2..9724c84992 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -31,8 +31,6 @@
#include "asfcrypt.h"
#include "avlanguage.h"
-void ff_mms_set_stream_selection(URLContext *h, AVFormatContext *format);
-
typedef struct {
int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID
ASFStream streams[128]; ///< it's max number and it's not that big
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 59e899d76c..3d4b0242a1 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -907,7 +907,9 @@ AVInputFormat *av_iformat_next(AVInputFormat *f);
*/
AVOutputFormat *av_oformat_next(AVOutputFormat *f);
-enum CodecID av_guess_image2_codec(const char *filename);
+#if FF_API_GUESS_IMG2_CODEC
+attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename);
+#endif
/* XXX: Use automatic init with either ELF sections or C file parser */
/* modules. */
@@ -986,7 +988,6 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size);
*/
void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st);
-attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
/**
* Send a nice dump of a packet to the log.
@@ -1002,7 +1003,10 @@ attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
AVStream *st);
+#if FF_API_PKT_DUMP
+attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt,
+#endif
int dump_payload);
/**
@@ -1521,12 +1525,6 @@ int64_t parse_date(const char *datestr, int duration);
*/
int64_t av_gettime(void);
-/* ffm-specific for ffserver */
-#define FFM_PACKET_SIZE 4096
-int64_t ffm_read_write_index(int fd);
-int ffm_write_write_index(int fd, int64_t pos);
-void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size);
-
#if FF_API_FIND_INFO_TAG
/**
* @deprecated use av_find_info_tag in libavutil instead.
@@ -1566,12 +1564,16 @@ int av_filename_number_test(const char *filename);
* all the contexts in the array (an AVCodecContext per RTP stream)
* must contain only one AVStream.
* @param n_files number of AVCodecContexts contained in ac
- * @param buff buffer where the SDP will be stored (must be allocated by
- * the caller)
+ * @param buf buffer where the SDP will be stored (must be allocated by
+ * the caller)
* @param size the size of the buffer
* @return 0 if OK, AVERROR_xxx on error
*/
-int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size);
+int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size);
+
+#if FF_API_SDP_CREATE
+attribute_deprecated int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size);
+#endif
/**
* Return a positive value if the given filename has one of the given
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 7b066e3c08..934fa213e9 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -49,7 +49,7 @@ static const AVClass urlcontext_class =
static int default_interrupt_cb(void);
URLProtocol *first_protocol = NULL;
-URLInterruptCB *url_interrupt_cb = default_interrupt_cb;
+int (*url_interrupt_cb)(void) = default_interrupt_cb;
URLProtocol *av_protocol_next(URLProtocol *p)
{
@@ -57,6 +57,16 @@ URLProtocol *av_protocol_next(URLProtocol *p)
else return first_protocol;
}
+const char *avio_enum_protocols(void **opaque, int output)
+{
+ URLProtocol **p = opaque;
+ *p = *p ? (*p)->next : first_protocol;
+ if (!*p) return NULL;
+ if ((output && (*p)->url_write) || (!output && (*p)->url_read))
+ return (*p)->name;
+ return avio_enum_protocols(opaque, output);
+}
+
int ffurl_register_protocol(URLProtocol *protocol, int size)
{
URLProtocol **p;
@@ -389,7 +399,7 @@ static int default_interrupt_cb(void)
return 0;
}
-void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb)
+void avio_set_interrupt_cb(int (*interrupt_cb)(void))
{
if (!interrupt_cb)
interrupt_cb = default_interrupt_cb;
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 03b6f6f5ec..b9dd6494f9 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;
@@ -90,11 +91,9 @@ typedef struct URLPollEntry {
* silently ignored.
*/
#define URL_FLAG_NONBLOCK 4
-#endif
typedef int URLInterruptCB(void);
-#if FF_API_OLD_AVIO
/**
* @defgroup old_url_funcs Old url_* functions
* @deprecated use the buffered API based on AVIOContext instead
@@ -117,7 +116,7 @@ attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_siz
attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
int64_t timestamp, int flags);
-attribute_deprecated void url_set_interrupt_cb(URLInterruptCB *interrupt_cb);
+attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void));
#endif
/**
@@ -132,7 +131,7 @@ int url_exist(const char *url);
* in this case by the interrupted function. 'NULL' means no interrupt
* callback is given.
*/
-void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb);
+void avio_set_interrupt_cb(int (*interrupt_cb)(void));
#if FF_API_OLD_AVIO
/* not implemented */
@@ -140,8 +139,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 +160,7 @@ typedef struct URLProtocol {
const AVClass *priv_data_class;
int flags;
} URLProtocol;
+#endif
#if FF_API_REGISTER_PROTOCOL
extern URLProtocol *first_protocol;
@@ -596,4 +599,18 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
int udp_get_file_handle(URLContext *h);
#endif
+/**
+ * Iterate through names of available protocols.
+ * @note it is recommanded to use av_protocol_next() instead of this
+ *
+ * @param opaque A private pointer representing current protocol.
+ * It must be a pointer to NULL on first iteration and will
+ * be updated by successive calls to avio_enum_protocols.
+ * @param output If set to 1, iterate over output protocols,
+ * otherwise over input protocols.
+ *
+ * @return A static string containing the name of current protocol or NULL
+ */
+const char *avio_enum_protocols(void **opaque, int output);
+
#endif /* AVFORMAT_AVIO_H */
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 0c4bd6950d..71a6846ef8 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,
@@ -92,10 +93,6 @@ int ffio_read_pause(AVIOContext *h, int pause);
int64_t ffio_read_seek (AVIOContext *h, int stream_index,
int64_t timestamp, int flags);
-/* udp.c */
-int ff_udp_set_remote_url(URLContext *h, const char *uri);
-int ff_udp_get_local_port(URLContext *h);
-
void ffio_init_checksum(AVIOContext *s,
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
unsigned long checksum);
diff --git a/libavformat/concat.c b/libavformat/concat.c
index c066826bb8..ba1b6a544a 100644
--- a/libavformat/concat.c
+++ b/libavformat/concat.c
@@ -190,10 +190,9 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence)
}
URLProtocol ff_concat_protocol = {
- "concat",
- concat_open,
- concat_read,
- NULL,
- concat_seek,
- concat_close,
+ .name = "concat",
+ .url_open = concat_open,
+ .url_read = concat_read,
+ .url_seek = concat_seek,
+ .url_close = concat_close,
};
diff --git a/libavformat/ffm.h b/libavformat/ffm.h
index 05d6eb1053..04f19cc88e 100644
--- a/libavformat/ffm.h
+++ b/libavformat/ffm.h
@@ -28,6 +28,7 @@
/* The FFM file is made of blocks of fixed size */
#define FFM_HEADER_SIZE 14
+#define FFM_PACKET_SIZE 4096
#define PACKET_ID 0x666d
/* each packet contains frames (which can span several packets */
@@ -55,4 +56,8 @@ typedef struct FFMContext {
uint8_t packet[FFM_PACKET_SIZE];
} FFMContext;
+int64_t ffm_read_write_index(int fd);
+int ffm_write_write_index(int fd, int64_t pos);
+void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size);
+
#endif /* AVFORMAT_FFM_H */
diff --git a/libavformat/file.c b/libavformat/file.c
index b8c7c4c9d4..64f8782c97 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -29,6 +29,7 @@
#include <sys/stat.h>
#include <stdlib.h>
#include "os_support.h"
+#include "url.h"
/* standard file protocol */
@@ -95,12 +96,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 +132,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,
};
diff --git a/libavformat/gopher.c b/libavformat/gopher.c
index 6f80c1bc84..3ab7357e56 100644
--- a/libavformat/gopher.c
+++ b/libavformat/gopher.c
@@ -121,10 +121,9 @@ static int gopher_read(URLContext *h, uint8_t *buf, int size)
URLProtocol ff_gopher_protocol = {
- "gopher",
- gopher_open,
- gopher_read,
- gopher_write,
- NULL, /*seek*/
- gopher_close,
+ .name = "gopher",
+ .url_open = gopher_open,
+ .url_read = gopher_read,
+ .url_write = gopher_write,
+ .url_close = gopher_close,
};
diff --git a/libavformat/http.c b/libavformat/http.c
index 51e84850f2..086a19ff81 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -505,13 +505,13 @@ http_get_file_handle(URLContext *h)
}
URLProtocol ff_http_protocol = {
- "http",
- http_open,
- http_read,
- http_write,
- http_seek,
- http_close,
+ .name = "http",
+ .url_open = http_open,
+ .url_read = http_read,
+ .url_write = http_write,
+ .url_seek = http_seek,
+ .url_close = http_close,
.url_get_file_handle = http_get_file_handle,
- .priv_data_size = sizeof(HTTPContext),
- .priv_data_class = &httpcontext_class,
+ .priv_data_size = sizeof(HTTPContext),
+ .priv_data_class = &httpcontext_class,
};
diff --git a/libavformat/http.h b/libavformat/http.h
index cd003bba8e..d01a004e9f 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/img2.c b/libavformat/img2.c
index 4e55c22ccc..56c4b3b567 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -24,6 +24,7 @@
#include "libavutil/avstring.h"
#include "avformat.h"
#include "avio_internal.h"
+#include "internal.h"
#include <strings.h>
typedef struct {
@@ -185,9 +186,16 @@ static int read_probe(AVProbeData *p)
return 0;
}
+enum CodecID ff_guess_image2_codec(const char *filename)
+{
+ return av_str2id(img_tags, filename);
+}
+
+#if FF_API_GUESS_IMG2_CODEC
enum CodecID av_guess_image2_codec(const char *filename){
return av_str2id(img_tags, filename);
}
+#endif
static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
{
diff --git a/libavformat/internal.h b/libavformat/internal.h
index d5bfc33187..20a52a6958 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -250,4 +250,6 @@ void ff_reduce_index(AVFormatContext *s, int stream_index);
void ff_make_absolute_url(char *buf, int size, const char *base,
const char *rel);
+enum CodecID ff_guess_image2_codec(const char *filename);
+
#endif /* AVFORMAT_INTERNAL_H */
diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c
index 352d58fd4b..4ada91887f 100644
--- a/libavformat/librtmp.c
+++ b/libavformat/librtmp.c
@@ -25,6 +25,7 @@
*/
#include "avformat.h"
+#include "url.h"
#include <librtmp/rtmp.h>
#include <librtmp/log.h>
@@ -158,66 +159,56 @@ static int rtmp_get_file_handle(URLContext *s)
}
URLProtocol ff_rtmp_protocol = {
- "rtmp",
- rtmp_open,
- rtmp_read,
- rtmp_write,
- NULL, /* seek */
- rtmp_close,
- NULL, /* next */
- rtmp_read_pause,
- rtmp_read_seek,
- rtmp_get_file_handle
+ .name = "rtmp",
+ .url_open = rtmp_open,
+ .url_read = rtmp_read,
+ .url_write = rtmp_write,
+ .url_close = rtmp_close,
+ .url_read_pause = rtmp_read_pause,
+ .url_read_seek = rtmp_read_seek,
+ .url_get_file_handle = rtmp_get_file_handle
};
URLProtocol ff_rtmpt_protocol = {
- "rtmpt",
- rtmp_open,
- rtmp_read,
- rtmp_write,
- NULL, /* seek */
- rtmp_close,
- NULL, /* next */
- rtmp_read_pause,
- rtmp_read_seek,
- rtmp_get_file_handle
+ .name = "rtmpt",
+ .url_open = rtmp_open,
+ .url_read = rtmp_read,
+ .url_write = rtmp_write,
+ .url_close = rtmp_close,
+ .url_read_pause = rtmp_read_pause,
+ .url_read_seek = rtmp_read_seek,
+ .url_get_file_handle = rtmp_get_file_handle
};
URLProtocol ff_rtmpe_protocol = {
- "rtmpe",
- rtmp_open,
- rtmp_read,
- rtmp_write,
- NULL, /* seek */
- rtmp_close,
- NULL, /* next */
- rtmp_read_pause,
- rtmp_read_seek,
- rtmp_get_file_handle
+ .name = "rtmpe",
+ .url_open = rtmp_open,
+ .url_read = rtmp_read,
+ .url_write = rtmp_write,
+ .url_close = rtmp_close,
+ .url_read_pause = rtmp_read_pause,
+ .url_read_seek = rtmp_read_seek,
+ .url_get_file_handle = rtmp_get_file_handle
};
URLProtocol ff_rtmpte_protocol = {
- "rtmpte",
- rtmp_open,
- rtmp_read,
- rtmp_write,
- NULL, /* seek */
- rtmp_close,
- NULL, /* next */
- rtmp_read_pause,
- rtmp_read_seek,
- rtmp_get_file_handle
+ .name = "rtmpte",
+ .url_open = rtmp_open,
+ .url_read = rtmp_read,
+ .url_write = rtmp_write,
+ .url_close = rtmp_close,
+ .url_read_pause = rtmp_read_pause,
+ .url_read_seek = rtmp_read_seek,
+ .url_get_file_handle = rtmp_get_file_handle
};
URLProtocol ff_rtmps_protocol = {
- "rtmps",
- rtmp_open,
- rtmp_read,
- rtmp_write,
- NULL, /* seek */
- rtmp_close,
- NULL, /* next */
- rtmp_read_pause,
- rtmp_read_seek,
- rtmp_get_file_handle
+ .name = "rtmps",
+ .url_open = rtmp_open,
+ .url_read = rtmp_read,
+ .url_write = rtmp_write,
+ .url_close = rtmp_close,
+ .url_read_pause = rtmp_read_pause,
+ .url_read_seek = rtmp_read_seek,
+ .url_get_file_handle = rtmp_get_file_handle
};
diff --git a/libavformat/mms.h b/libavformat/mms.h
index 31d71b4e24..788851e24f 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/mmst.c b/libavformat/mmst.c
index 55a41e6a9c..775ab7ea7f 100644
--- a/libavformat/mmst.c
+++ b/libavformat/mmst.c
@@ -623,10 +623,8 @@ static int mms_read(URLContext *h, uint8_t *buf, int size)
}
URLProtocol ff_mmst_protocol = {
- "mmst",
- mms_open,
- mms_read,
- NULL, // write
- NULL, // seek
- mms_close,
+ .name = "mmst",
+ .url_open = mms_open,
+ .url_read = mms_read,
+ .url_close = mms_close,
};
diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h
index 431095d399..4c28cd351e 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/rtmpproto.c b/libavformat/rtmpproto.c
index 73bb4d2f69..94361ca80d 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -991,10 +991,9 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size)
}
URLProtocol ff_rtmp_protocol = {
- "rtmp",
- rtmp_open,
- rtmp_read,
- rtmp_write,
- NULL, /* seek */
- rtmp_close,
+ .name = "rtmp",
+ .url_open = rtmp_open,
+ .url_read = rtmp_read,
+ .url_write = rtmp_write,
+ .url_close = rtmp_close,
};
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index a27f743023..8148a7d1e8 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 9e19b64d67..8e6b80aa3f 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/rtpproto.c b/libavformat/rtpproto.c
index 3e582c1937..d620cf9264 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -355,11 +355,10 @@ int rtp_get_rtcp_file_handle(URLContext *h) {
}
URLProtocol ff_rtp_protocol = {
- "rtp",
- rtp_open,
- rtp_read,
- rtp_write,
- NULL, /* seek */
- rtp_close,
+ .name = "rtp",
+ .url_open = rtp_open,
+ .url_read = rtp_read,
+ .url_write = rtp_write,
+ .url_close = rtp_close,
.url_get_file_handle = rtp_get_file_handle,
};
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index 865697fb95..1cbcb49750 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -66,7 +66,7 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
ff_url_join(sdp_ctx.filename, sizeof(sdp_ctx.filename),
"rtsp", NULL, addr, -1, NULL);
ctx_array[0] = &sdp_ctx;
- if (avf_sdp_create(ctx_array, 1, sdp, SDP_MAX_SIZE)) {
+ if (av_sdp_create(ctx_array, 1, sdp, SDP_MAX_SIZE)) {
av_free(sdp);
return AVERROR_INVALIDDATA;
}
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
index e538bbb4a2..4ca14ad964 100644
--- a/libavformat/sapenc.c
+++ b/libavformat/sapenc.c
@@ -208,7 +208,7 @@ static int sap_write_header(AVFormatContext *s)
av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos);
pos += strlen(&sap->ann[pos]) + 1;
- if (avf_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
+ if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
sap->ann_size - pos)) {
ret = AVERROR_INVALIDDATA;
goto fail;
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 2a8821815a..923c57fbcd 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -474,14 +474,14 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
sdp_write_media_attributes(buff, size, c, payload_type);
}
-int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
+int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
{
AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0);
struct sdp_session_level s;
int i, j, port, ttl, is_multicast;
char dst[32], dst_type[5];
- memset(buff, 0, size);
+ memset(buf, 0, size);
memset(&s, 0, sizeof(struct sdp_session_level));
s.user = "-";
s.src_addr = "127.0.0.1"; /* FIXME: Properly set this */
@@ -506,7 +506,7 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
}
}
}
- sdp_write_header(buff, size, &s);
+ sdp_write_header(buf, size, &s);
dst[0] = 0;
for (i = 0; i < n_files; i++) {
@@ -518,11 +518,11 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
ttl = 0;
}
for (j = 0; j < ac[i]->nb_streams; j++) {
- ff_sdp_write_media(buff, size,
+ ff_sdp_write_media(buf, size,
ac[i]->streams[j]->codec, dst[0] ? dst : NULL,
dst_type, (port > 0) ? port + j * 2 : 0, ttl);
if (port <= 0) {
- av_strlcatf(buff, size,
+ av_strlcatf(buf, size,
"a=control:streamid=%d\r\n", i + j);
}
}
@@ -531,7 +531,7 @@ int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
return 0;
}
#else
-int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
+int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
{
return AVERROR(ENOSYS);
}
@@ -540,3 +540,10 @@ void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *des
{
}
#endif
+
+#if FF_API_SDP_CREATE
+int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
+{
+ return av_sdp_create(ac, n_files, buff, size);
+}
+#endif
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index f0d1c4556f..57be430c23 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -202,11 +202,10 @@ static int tcp_get_file_handle(URLContext *h)
}
URLProtocol ff_tcp_protocol = {
- "tcp",
- tcp_open,
- tcp_read,
- tcp_write,
- NULL, /* seek */
- tcp_close,
+ .name = "tcp",
+ .url_open = tcp_open,
+ .url_read = tcp_read,
+ .url_write = tcp_write,
+ .url_close = tcp_close,
.url_get_file_handle = tcp_get_file_handle,
};
diff --git a/libavformat/udp.c b/libavformat/udp.c
index fd0640fd88..6f22277e23 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -489,11 +489,10 @@ static int udp_close(URLContext *h)
}
URLProtocol ff_udp_protocol = {
- "udp",
- udp_open,
- udp_read,
- udp_write,
- NULL, /* seek */
- udp_close,
+ .name = "udp",
+ .url_open = udp_open,
+ .url_read = udp_read,
+ .url_write = udp_write,
+ .url_close = udp_close,
.url_get_file_handle = udp_get_file_handle,
};
diff --git a/libavformat/url.h b/libavformat/url.h
index 9f97db594f..3f96f73763 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -31,7 +31,35 @@
#if !FF_API_OLD_AVIO
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
-extern URLInterruptCB *url_interrupt_cb;
+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;
+
+typedef struct URLProtocol {
+ 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);
+ struct URLProtocol *next;
+ 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 priv_data_size;
+ const AVClass *priv_data_class;
+ int flags;
+} URLProtocol;
#endif
/**
@@ -140,4 +168,8 @@ int ffurl_get_file_handle(URLContext *h);
*/
int ffurl_register_protocol(URLProtocol *protocol, int size);
+/* udp.c */
+int ff_udp_set_remote_url(URLContext *h, const char *uri);
+int ff_udp_get_local_port(URLContext *h);
+
#endif //AVFORMAT_URL_H
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d9aa6f1173..835408bc32 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -219,7 +219,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
#if CONFIG_IMAGE2_MUXER
if (!short_name && filename &&
av_filename_number_test(filename) &&
- av_guess_image2_codec(filename) != CODEC_ID_NONE) {
+ ff_guess_image2_codec(filename) != CODEC_ID_NONE) {
return av_guess_format("image2", NULL, NULL);
}
#endif
@@ -272,7 +272,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
#if CONFIG_IMAGE2_MUXER
if(!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")){
- codec_id= av_guess_image2_codec(filename);
+ codec_id= ff_guess_image2_codec(filename);
}
#endif
if(codec_id == CODEC_ID_NONE)
@@ -3574,22 +3574,26 @@ static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int
av_hex_dump(f, pkt->data, pkt->size);
}
+#if FF_API_PKT_DUMP
void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload)
{
AVRational tb = { 1, AV_TIME_BASE };
pkt_dump_internal(NULL, f, 0, pkt, dump_payload, tb);
}
+#endif
void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st)
{
pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
}
+#if FF_API_PKT_DUMP
void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload)
{
AVRational tb = { 1, AV_TIME_BASE };
pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, tb);
}
+#endif
void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
AVStream *st)
diff --git a/libavformat/version.h b/libavformat/version.h
index 4c31bc2ae1..dad6161607 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -104,5 +104,14 @@
#ifndef FF_API_FIND_INFO_TAG
#define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
+#ifndef FF_API_PKT_DUMP
+#define FF_API_PKT_DUMP (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_GUESS_IMG2_CODEC
+#define FF_API_GUESS_IMG2_CODEC (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_SDP_CREATE
+#define FF_API_SDP_CREATE (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
#endif //AVFORMAT_VERSION_H