aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-03-19 20:37:10 +0200
committerMartin Storsjö <martin@martin.st>2012-03-20 10:53:47 +0200
commit4fa57d524f16524e9735f99b387167149dbf5a7b (patch)
tree4ef1afda4d72d8c44e45c52cc845e06011e4f607
parent0d0b81f941a2d5011bec754ba48e84a479306661 (diff)
downloadffmpeg-4fa57d524f16524e9735f99b387167149dbf5a7b.tar.gz
libavformat: Set the default for the max_delay option to -1
Make the muxers/demuxers that use the field handle the default -1 in the same way as 0. This allows distinguishing an intentionally set 0 from the default value where the user hasn't set it. Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/mpegenc.c2
-rw-r--r--libavformat/mpegtsenc.c3
-rw-r--r--libavformat/options_table.h2
-rw-r--r--libavformat/rtpenc.c2
-rw-r--r--libavformat/rtsp.c6
5 files changed, 13 insertions, 2 deletions
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 852b3f13c9..bda8d8324b 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -318,6 +318,8 @@ static int mpeg_mux_init(AVFormatContext *ctx)
s->packet_size = ctx->packet_size;
} else
s->packet_size = 2048;
+ if (ctx->max_delay < 0) /* Not set by the caller */
+ ctx->max_delay = 0;
s->vcd_padding_bytes_written = 0;
s->vcd_padding_bitrate=0;
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 493ae2eb6f..a594ca257f 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -460,6 +460,9 @@ static int mpegts_write_header(AVFormatContext *s)
const char *provider_name;
int *pids;
+ if (s->max_delay < 0) /* Not set by the caller */
+ s->max_delay = 0;
+
// round up to a whole number of TS packets
ts->pes_payload_size = (ts->pes_payload_size + 14 + 183) / 184 * 184 - 14;
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 7aee448c0f..683596c206 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -41,7 +41,7 @@ static const AVOption options[]={
{"rtbufsize", "max memory used for buffering real-time frames", OFFSET(max_picture_buffer), AV_OPT_TYPE_INT, {.dbl = 3041280 }, 0, INT_MAX, D}, /* defaults to 1s of 15fps 352x288 YUYV422 video */
{"fdebug", "print specific debug info", OFFSET(debug), AV_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, INT_MAX, E|D, "fdebug"},
{"ts", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_FDEBUG_TS }, INT_MIN, INT_MAX, E|D, "fdebug"},
-{"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E|D},
+{"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), AV_OPT_TYPE_INT, {.dbl = -1 }, -1, INT_MAX, E|D},
{"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX-1, D},
/* this is a crutch for avconv, since it cannot deal with identically named options in different contexts.
* to be removed when avconv is fixed */
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 6a1be499e2..78121ed3c5 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -126,7 +126,7 @@ static int rtp_write_header(AVFormatContext *s1)
s->max_payload_size = s1->packet_size - 12;
s->max_frames_per_packet = 0;
- if (s1->max_delay) {
+ if (s1->max_delay > 0) {
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
int frame_size = av_get_audio_frame_duration(st->codec, 0);
if (!frame_size)
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 56deed3b3a..7afd106cfb 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1426,6 +1426,9 @@ int ff_rtsp_connect(AVFormatContext *s)
if (!ff_network_init())
return AVERROR(EIO);
+ if (s->max_delay < 0) /* Not set by the caller */
+ s->max_delay = 0;
+
rt->control_transport = RTSP_MODE_PLAIN;
if (rt->lower_transport_mask & (1 << RTSP_LOWER_TRANSPORT_HTTP)) {
rt->lower_transport_mask = 1 << RTSP_LOWER_TRANSPORT_TCP;
@@ -1866,6 +1869,9 @@ static int sdp_read_header(AVFormatContext *s)
if (!ff_network_init())
return AVERROR(EIO);
+ if (s->max_delay < 0) /* Not set by the caller */
+ s->max_delay = 0;
+
/* read the whole sdp file */
/* XXX: better loading */
content = av_malloc(SDP_MAX_SIZE);