summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-26 22:37:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-26 22:37:37 +0200
commit53ce9905134e042516ddd7a4476dc668c0b094c4 (patch)
tree05e80abb4ef8b78c7c93bc920b32fb34ac268cc7 /libavformat
parenta48b890392aa22033f182421ba9e3f3b3256461d (diff)
parent154486f9adc621e620dacd76d78c30a02cc1dcd3 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: opt: Add av_opt_set_bin() avconv: Display the error returned by avformat_write_header rtpenc_chain: Return an error code instead of just a plain pointer rtpenc_chain: Free the URLContext on failure rtpenc: Expose the ssrc as an avoption avprobe: display the codec profile in show_stream() avprobe: fix function prototype cosmetics: Fix indentation avprobe: changelog entry avprobe: update documentation avprobe: provide JSON output avprobe: output proper INI format avprobe: improve formatting rtmp: fix url parsing fate: document TARGET_EXEC and its usage Conflicts: doc/APIchanges doc/fate.texi doc/ffprobe.texi ffprobe.c libavformat/version.h libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/movenchint.c6
-rw-r--r--libavformat/rtmpproto.c3
-rw-r--r--libavformat/rtpenc.c4
-rw-r--r--libavformat/rtpenc_chain.c33
-rw-r--r--libavformat/rtpenc_chain.h4
-rw-r--r--libavformat/rtsp.c8
-rw-r--r--libavformat/sapenc.c8
-rw-r--r--libavformat/version.h2
8 files changed, 43 insertions, 25 deletions
diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c
index 1ee59877d2..9c4ddeb372 100644
--- a/libavformat/movenchint.c
+++ b/libavformat/movenchint.c
@@ -43,9 +43,9 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
track->enc->codec_type = AVMEDIA_TYPE_DATA;
track->enc->codec_tag = track->tag;
- track->rtp_ctx = ff_rtp_chain_mux_open(s, src_st, NULL,
- RTP_MAX_PACKET_SIZE);
- if (!track->rtp_ctx)
+ ret = ff_rtp_chain_mux_open(&track->rtp_ctx, s, src_st, NULL,
+ RTP_MAX_PACKET_SIZE);
+ if (ret < 0)
goto fail;
/* Copy the RTP AVStream timebase back to the hint AVStream */
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 0f643e6c8a..a9e39a50bb 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -1037,9 +1037,10 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
fname = next;
rt->app[0] = '\0';
} else {
+ // make sure we do not mismatch a playpath for an application instance
char *c = strchr(p + 1, ':');
fname = strchr(p + 1, '/');
- if (!fname || c < fname) {
+ if (!fname || (c && c < fname)) {
fname = p + 1;
av_strlcpy(rt->app, path + 1, p - path);
} else {
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index c2736b1728..57d025a364 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -33,6 +33,7 @@
static const AVOption options[] = {
FF_RTP_FLAG_OPTS(RTPMuxContext, flags)
{ "payload_type", "Specify RTP payload type", offsetof(RTPMuxContext, payload_type), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, 127, AV_OPT_FLAG_ENCODING_PARAM },
+ { "ssrc", "Stream identifier", offsetof(RTPMuxContext, ssrc), AV_OPT_TYPE_INT, { 0 }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL },
};
@@ -101,7 +102,8 @@ static int rtp_write_header(AVFormatContext *s1)
s->base_timestamp = av_get_random_seed();
s->timestamp = s->base_timestamp;
s->cur_timestamp = 0;
- s->ssrc = av_get_random_seed();
+ if (!s->ssrc)
+ s->ssrc = av_get_random_seed();
s->first_packet = 1;
s->first_rtcp_ntp_time = ff_ntp_time();
if (s1->start_time_realtime)
diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c
index e4edfc28e1..c0f9530ac8 100644
--- a/libavformat/rtpenc_chain.c
+++ b/libavformat/rtpenc_chain.c
@@ -25,27 +25,31 @@
#include "avio_internal.h"
#include "libavutil/opt.h"
-AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
- URLContext *handle, int packet_size)
+int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s,
+ AVStream *st, URLContext *handle, int packet_size)
{
- AVFormatContext *rtpctx;
+ AVFormatContext *rtpctx = NULL;
int ret;
AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
uint8_t *rtpflags;
AVDictionary *opts = NULL;
- if (!rtp_format)
- return NULL;
+ if (!rtp_format) {
+ ret = AVERROR(ENOSYS);
+ goto fail;
+ }
/* Allocate an AVFormatContext for each output stream */
rtpctx = avformat_alloc_context();
- if (!rtpctx)
- return NULL;
+ if (!rtpctx) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
rtpctx->oformat = rtp_format;
if (!avformat_new_stream(rtpctx, NULL)) {
- av_free(rtpctx);
- return NULL;
+ ret = AVERROR(ENOMEM);
+ goto fail;
}
/* Pass the interrupt callback on */
rtpctx->interrupt_callback = s->interrupt_callback;
@@ -79,8 +83,15 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
av_free(ptr);
}
avformat_free_context(rtpctx);
- return NULL;
+ return ret;
}
- return rtpctx;
+ *out = rtpctx;
+ return 0;
+
+fail:
+ av_free(rtpctx);
+ if (handle)
+ ffurl_close(handle);
+ return ret;
}
diff --git a/libavformat/rtpenc_chain.h b/libavformat/rtpenc_chain.h
index 8e6b80aa3f..1ba3617188 100644
--- a/libavformat/rtpenc_chain.h
+++ b/libavformat/rtpenc_chain.h
@@ -25,7 +25,7 @@
#include "avformat.h"
#include "url.h"
-AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
- URLContext *handle, int packet_size);
+int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s,
+ AVStream *st, URLContext *handle, int packet_size);
#endif /* AVFORMAT_RTPENC_CHAIN_H */
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 504b9f850d..e3b6e1df5f 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -606,11 +606,13 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
s->ctx_flags |= AVFMTCTX_NOHEADER;
if (s->oformat && CONFIG_RTSP_MUXER) {
- rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st,
- rtsp_st->rtp_handle,
- RTSP_TCP_MAX_PACKET_SIZE);
+ int ret = ff_rtp_chain_mux_open(&rtsp_st->transport_priv, s, st,
+ rtsp_st->rtp_handle,
+ RTSP_TCP_MAX_PACKET_SIZE);
/* Ownership of rtp_handle is passed to the rtp mux context */
rtsp_st->rtp_handle = NULL;
+ if (ret < 0)
+ return ret;
} else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC)
rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
rtsp_st->dynamic_protocol_context,
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
index 609dab4b40..c1923f31c6 100644
--- a/libavformat/sapenc.c
+++ b/libavformat/sapenc.c
@@ -150,8 +150,10 @@ static int sap_write_header(AVFormatContext *s)
ret = AVERROR(EIO);
goto fail;
}
- s->streams[i]->priv_data = contexts[i] =
- ff_rtp_chain_mux_open(s, s->streams[i], fd, 0);
+ ret = ff_rtp_chain_mux_open(&contexts[i], s, s->streams[i], fd, 0);
+ if (ret < 0)
+ goto fail;
+ s->streams[i]->priv_data = contexts[i];
av_strlcpy(contexts[i]->filename, url, sizeof(contexts[i]->filename));
}
@@ -209,7 +211,7 @@ static int sap_write_header(AVFormatContext *s)
pos += strlen(&sap->ann[pos]) + 1;
if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
- sap->ann_size - pos)) {
+ sap->ann_size - pos)) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
diff --git a/libavformat/version.h b/libavformat/version.h
index 1158fdf212..7042990579 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MINOR 6
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \