aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/segment.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-29 00:30:35 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-29 00:30:35 +0100
commit0e6aa0fef565fdb625673c60276e90c2ea091e8e (patch)
treef0b08a7f4b465aaa0d9144e9b837b18294db3df6 /libavformat/segment.c
parentf929abd0c3643b28a9552512d698cf61ad4d08fa (diff)
parentbbeb29133b55b7256d18f5aaab8b5c8e919a173a (diff)
downloadffmpeg-0e6aa0fef565fdb625673c60276e90c2ea091e8e.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: adpcm: Clip step_index values read from the bitstream at the beginning of each frame. oma: don't read beyond end of leaf_table. doxygen: Remove documentation for non-existing parameters; misc small fixes. Indeo3: fix crashes on corrupt bitstreams. msmpeg4: Replace forward declaration by proper #include. segment: implement wrap around avf: reorder AVStream and AVFormatContext aacdec: Remove erroneous reference to global gain from the out of bounds scalefactor error message. Conflicts: libavcodec/indeo3.c libavformat/avformat.h libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/segment.c')
-rw-r--r--libavformat/segment.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/segment.c b/libavformat/segment.c
index c75dd9c216..1af412ad53 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -39,6 +39,7 @@ typedef struct {
char *list; /**< Set by a private option. */
float time; /**< Set by a private option. */
int size; /**< Set by a private option. */
+ int wrap; /**< Set by a private option. */
int64_t offset_time;
int64_t recording_time;
int has_video;
@@ -51,6 +52,9 @@ static int segment_start(AVFormatContext *s)
AVFormatContext *oc = c->avf;
int err = 0;
+ if (c->wrap)
+ c->number %= c->wrap;
+
if (av_get_frame_filename(oc->filename, sizeof(oc->filename),
s->filename, c->number++) < 0)
return AVERROR(EINVAL);
@@ -211,7 +215,6 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
if ((ret = avio_open2(&seg->pb, seg->list, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL)) < 0)
goto fail;
-
}
}
}
@@ -250,6 +253,7 @@ static const AVOption options[] = {
{ "segment_time", "segment length in seconds", OFFSET(time), AV_OPT_TYPE_FLOAT, {.dbl = 2}, 0, FLT_MAX, E },
{ "segment_list", "output the segment list", OFFSET(list), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E },
{ "segment_list_size", "maximum number of playlist entries", OFFSET(size), AV_OPT_TYPE_INT, {.dbl = 5}, 0, INT_MAX, E },
+ { "segment_wrap", "number after which the index wraps", OFFSET(wrap), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, E },
{ NULL },
};