summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6393b62615..9735d455d9 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2657,8 +2657,18 @@ void av_close_input_file(AVFormatContext *s)
avio_close(pb);
}
+#if FF_API_NEW_STREAM
AVStream *av_new_stream(AVFormatContext *s, int id)
{
+ AVStream *st = avformat_new_stream(s, NULL);
+ if (st)
+ st->id = id;
+ return st;
+}
+#endif
+
+AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
+{
AVStream *st;
int i;
AVStream **streams;
@@ -2678,13 +2688,12 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
return NULL;
}
- st->codec = avcodec_alloc_context3(NULL);
+ st->codec = avcodec_alloc_context3(c);
if (s->iformat) {
/* no default bitrate if decoding */
st->codec->bit_rate = 0;
}
st->index = s->nb_streams;
- st->id = id;
st->start_time = AV_NOPTS_VALUE;
st->duration = AV_NOPTS_VALUE;
/* we set the current DTS to 0 so that formats without any timestamps