Browse code

Replace remaining av_new_stream() with avformat_new_stream().

Clément Bœsch authored on 2011/11/05 21:11:18
Showing 12 changed files
... ...
@@ -64,11 +64,12 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
64 64
     AVCodecContext *c;
65 65
     AVStream *st;
66 66
 
67
-    st = av_new_stream(oc, 1);
67
+    st = avformat_new_stream(oc, NULL);
68 68
     if (!st) {
69 69
         fprintf(stderr, "Could not alloc stream\n");
70 70
         exit(1);
71 71
     }
72
+    st->id = 1;
72 73
 
73 74
     c = st->codec;
74 75
     c->codec_id = codec_id;
... ...
@@ -659,11 +659,12 @@ dshow_add_device(AVFormatContext *avctx, AVFormatParameters *ap,
659 659
     AVStream *st;
660 660
     int ret = AVERROR(EIO);
661 661
 
662
-    st = av_new_stream(avctx, devtype);
662
+    st = avformat_new_stream(avctx, NULL);
663 663
     if (!st) {
664 664
         ret = AVERROR(ENOMEM);
665 665
         goto error;
666 666
     }
667
+    st->id = devtype;
667 668
 
668 669
     ctx->capture_filter[devtype]->stream_index = st->index;
669 670
 
... ...
@@ -161,8 +161,9 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx,
161 161
     /* for each open output create a corresponding stream */
162 162
     for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
163 163
         AVStream *st;
164
-        if (!(st = av_new_stream(avctx, i)))
164
+        if (!(st = avformat_new_stream(avctx, NULL)))
165 165
             FAIL(AVERROR(ENOMEM));
166
+        st->id = i;
166 167
     }
167 168
 
168 169
     /* create a sink for each output and connect them to the graph */
... ...
@@ -145,7 +145,7 @@ static int read_header(AVFormatContext *ctx, AVFormatParameters *ap)
145 145
     if (error = al_get_error(ad->device, &error_msg)) goto fail;
146 146
 
147 147
     /* Create stream */
148
-    if (!(st = av_new_stream(ctx, 0))) {
148
+    if (!(st = avformat_new_stream(ctx, NULL))) {
149 149
         error = AVERROR(ENOMEM);
150 150
         goto fail;
151 151
     }
... ...
@@ -69,7 +69,7 @@ static int read_header(AVFormatContext *s,
69 69
 
70 70
     int min,sec,msec;
71 71
 
72
-    st=av_new_stream(s, 0);
72
+    st = avformat_new_stream(s, NULL);
73 73
     if (!st)
74 74
         return AVERROR(ENOMEM);
75 75
 
... ...
@@ -102,7 +102,7 @@ static AVStream * init_stream(AVFormatContext *s,
102 102
                               AVFormatParameters *ap)
103 103
 {
104 104
     BinDemuxContext *bin = s->priv_data;
105
-    AVStream *st = av_new_stream(s, 0);
105
+    AVStream *st = avformat_new_stream(s, NULL);
106 106
     if (!st)
107 107
         return NULL;
108 108
     st->codec->codec_tag   = 0;
... ...
@@ -32,7 +32,7 @@ static int g723_1_init(AVFormatContext *s, AVFormatParameters *ap)
32 32
 {
33 33
     AVStream *st;
34 34
 
35
-    st = av_new_stream(s, 0);
35
+    st = avformat_new_stream(s, NULL);
36 36
     if (!st)
37 37
         return AVERROR(ENOMEM);
38 38
 
... ...
@@ -217,7 +217,7 @@ static int modplug_read_header(AVFormatContext *s, AVFormatParameters *ap)
217 217
     if (!modplug->f)
218 218
         return AVERROR_INVALIDDATA;
219 219
 
220
-    st = av_new_stream(s, 0);
220
+    st = avformat_new_stream(s, NULL);
221 221
     if (!st)
222 222
         return AVERROR(ENOMEM);
223 223
     av_set_pts_info(st, 64, 1, 1000);
... ...
@@ -231,7 +231,7 @@ static int modplug_read_header(AVFormatContext *s, AVFormatParameters *ap)
231 231
     modplug->ts_per_packet = 1000*AUDIO_PKT_SIZE / (4*44100.);
232 232
 
233 233
     if (modplug->video_stream) {
234
-        AVStream *vst = av_new_stream(s, 1);
234
+        AVStream *vst = avformat_new_stream(s, NULL);
235 235
         if (!vst)
236 236
             return AVERROR(ENOMEM);
237 237
         av_set_pts_info(vst, 64, 1, 1000);
... ...
@@ -63,7 +63,7 @@ static int loas_read_header(AVFormatContext *s,
63 63
 {
64 64
     AVStream *st;
65 65
 
66
-    st = av_new_stream(s, 0);
66
+    st = avformat_new_stream(s, NULL);
67 67
     if (!st)
68 68
         return AVERROR(ENOMEM);
69 69
 
... ...
@@ -54,7 +54,7 @@ static int microdvd_read_header(AVFormatContext *s, AVFormatParameters *ap)
54 54
 {
55 55
     AVRational pts_info = (AVRational){ 2997, 125 };  /* default: 23.976 fps */
56 56
     MicroDVDContext *microdvd = s->priv_data;
57
-    AVStream *st = av_new_stream(s, 0);
57
+    AVStream *st = avformat_new_stream(s, NULL);
58 58
     int i, frame;
59 59
     double fps;
60 60
     char c;
... ...
@@ -47,7 +47,7 @@ static int pmp_header(AVFormatContext *s, AVFormatParameters *ap) {
47 47
     int srate, channels;
48 48
     int i;
49 49
     uint64_t pos;
50
-    AVStream *vst = av_new_stream(s, 0);
50
+    AVStream *vst = avformat_new_stream(s, NULL);
51 51
     if (!vst)
52 52
         return AVERROR(ENOMEM);
53 53
     vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
... ...
@@ -90,9 +90,10 @@ static int pmp_header(AVFormatContext *s, AVFormatParameters *ap) {
90 90
     srate = avio_rl32(pb);
91 91
     channels = avio_rl32(pb) + 1;
92 92
     for (i = 1; i < pmp->num_streams; i++) {
93
-        AVStream *ast = av_new_stream(s, i);
93
+        AVStream *ast = avformat_new_stream(s, NULL);
94 94
         if (!ast)
95 95
             return AVERROR(ENOMEM);
96
+        ast->id = i;
96 97
         ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
97 98
         ast->codec->codec_id = audio_codec_id;
98 99
         ast->codec->channels = channels;
... ...
@@ -485,10 +485,11 @@ static int wav_read_header(AVFormatContext *s,
485 485
                 goto break_loop;
486 486
             }
487 487
             av_log(s, AV_LOG_DEBUG, "Found SMV data\n");
488
-            vst = av_new_stream(s, 1);
488
+            vst = avformat_new_stream(s, NULL);
489 489
             if (!vst)
490 490
                 return AVERROR(ENOMEM);
491 491
             avio_r8(pb);
492
+            vst->id = 1;
492 493
             vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
493 494
             vst->codec->codec_id = CODEC_ID_MJPEG;
494 495
             vst->codec->width  = avio_rl24(pb);