aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/nuv.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-11-27 16:41:11 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-11-28 11:18:50 -0500
commit838ed296df913dde55a573ccfae5b0a4ef934cfa (patch)
treefc0ae795e74aa1003c83f0518ccb08ecb3885bcf /libavformat/nuv.c
parentc74f81786d434dfaf9b3dff06aa96bfd23d0127b (diff)
downloadffmpeg-838ed296df913dde55a573ccfae5b0a4ef934cfa.tar.gz
nuv: use the stream indices generated by avformat_new_stream()
Diffstat (limited to 'libavformat/nuv.c')
-rw-r--r--libavformat/nuv.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 7d6802dcc3..50309b5e96 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -152,7 +152,6 @@ static int nuv_header(AVFormatContext *s)
char id_string[12];
double aspect, fps;
int is_mythtv, width, height, v_packs, a_packs;
- int stream_nr = 0;
AVStream *vst = NULL, *ast = NULL;
avio_read(pb, id_string, 12);
@@ -178,10 +177,11 @@ static int nuv_header(AVFormatContext *s)
avio_rl32(pb); // keyframe distance (?)
if (v_packs) {
- ctx->v_id = stream_nr++;
- vst = avformat_new_stream(s, NULL);
+ vst = avformat_new_stream(s, NULL);
if (!vst)
return AVERROR(ENOMEM);
+ ctx->v_id = vst->index;
+
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = AV_CODEC_ID_NUV;
vst->codec->width = width;
@@ -198,10 +198,11 @@ static int nuv_header(AVFormatContext *s)
ctx->v_id = -1;
if (a_packs) {
- ctx->a_id = stream_nr++;
- ast = avformat_new_stream(s, NULL);
+ ast = avformat_new_stream(s, NULL);
if (!ast)
return AVERROR(ENOMEM);
+ ctx->a_id = ast->index;
+
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
ast->codec->channels = 2;