History

lavf: replace av_new_stream->avformat_new_stream part II.

Manual replacements are done in this commit. In many cases, the id is some constant made up number (e.g. 0 for video and 1 for audio), which is then not used in the demuxer for anything. Those ids are removed.

Anton Khirnov committed 15 years ago

Commit 84ad31f1 parent 3b3bbdd35 files · +83 −57Browse files

Unified · Split

35 files
  1. avconv.c +4 −1
  2. libavformat/4xm.c +2 −1
  3. libavformat/applehttp.c +2 −1
  4. libavformat/avidec.c +2 −1
  5. libavformat/avisynth.c +4 −2
  6. libavformat/avs.c +2 −2
  7. libavformat/bink.c +1 −1
  8. libavformat/c93.c +1 −1
  9. libavformat/flic.c +1 −1
  10. libavformat/flvdec.c +2 −1
  11. libavformat/gxf.c +2 −1
  12. libavformat/idroqdec.c +1 −1
  13. libavformat/jvdec.c +1 −1
  14. libavformat/libnut.c +1 −1
  15. libavformat/lmlm4.c +1 −1
  16. libavformat/lxfdec.c +1 −1
  17. libavformat/mov.c +2 −1
  18. libavformat/mpeg.c +2 −1
  19. libavformat/mpegts.c +12 −6
  20. libavformat/mtv.c +4 −6
  21. libavformat/mxfdec.c +2 −1
  22. libavformat/mxg.c +4 −6
  23. libavformat/nsvdec.c +4 −2
  24. libavformat/nutdec.c +1 −1
  25. libavformat/nuv.c +2 −2
  26. libavformat/oggdec.c +2 −1
  27. libavformat/pva.c +1 −1
  28. libavformat/r3d.c +1 −1
  29. libavformat/rdt.c +2 −1
  30. libavformat/rtsp.c +2 −1
  31. libavformat/sapdec.c +4 −2
  32. libavformat/swfdec.c +6 −3
  33. libavformat/wtv.c +2 −1
  34. libavformat/xmv.c +1 −1
  35. libavformat/yop.c +1 −1
avconv.c+4−1
@@ -3016,7 +3016,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV · 3015 unmodified lines
30163016 static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
30173017 {
30183018 OutputStream *ost;
3019− AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0);
3019+ AVStream *st = avformat_new_stream(oc, NULL);
30203020 int idx = oc->nb_streams - 1, ret = 0;
30213021 int64_t max_frames = INT64_MAX;
30223022 char *bsf = NULL, *next, *codec_tag = NULL;
@@ -3030,6 +3030,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e · 7 unmodified lines
30303030 exit_program(1);
30313031 }
30323032
3033+ if (oc->nb_streams - 1 < o->nb_streamid_map)
3034+ st->id = o->streamid_map[oc->nb_streams - 1];
3035+
30333036 output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
30343037 nb_output_streams + 1);
30353038 ost = &output_streams[nb_output_streams - 1];
libavformat/4xm.c+2−1
@@ -198,12 +198,13 @@ static int fourxm_read_header(AVFormatContext *s, · 197 unmodified lines
198198 i += 8 + size;
199199
200200 /* allocate a new AVStream */
201− st = av_new_stream(s, current_track);
201+ st = avformat_new_stream(s, NULL);
202202 if (!st){
203203 ret= AVERROR(ENOMEM);
204204 goto fail;
205205 }
206206
207+ st->id = current_track;
207208 av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate);
208209
209210 fourxm->tracks[current_track].stream_index = st->index;
libavformat/applehttp.c+2−1
@@ -505,11 +505,12 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) · 504 unmodified lines
505505 snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth);
506506 /* Create new AVStreams for each stream in this variant */
507507 for (j = 0; j < v->ctx->nb_streams; j++) {
508− AVStream *st = av_new_stream(s, i);
508+ AVStream *st = avformat_new_stream(s, NULL);
509509 if (!st) {
510510 ret = AVERROR(ENOMEM);
511511 goto fail;
512512 }
513+ st->id = i;
513514 avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);
514515 if (v->bandwidth)
515516 av_dict_set(&st->metadata, "variant_bitrate", bitrate_str,
libavformat/avidec.c+2−1
@@ -426,10 +426,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 425 unmodified lines
426426 break;
427427 }else{
428428 stream_index++;
429− st = av_new_stream(s, stream_index);
429+ st = avformat_new_stream(s, NULL);
430430 if (!st)
431431 goto fail;
432432
433+ st->id = stream_index;
433434 ast = av_mallocz(sizeof(AVIStream));
434435 if (!ast)
435436 goto fail;
libavformat/avisynth.c+4−2
@@ -84,7 +84,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) · 83 unmodified lines
8484 if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK)
8585 continue;
8686
87− st = av_new_stream(s, id);
87+ st = avformat_new_stream(s, NULL);
88+ st->id = id;
8889 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
8990
9091 st->codec->block_align = wvfmt.nBlockAlign;
@@ -110,7 +111,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) · 19 unmodified lines
110111 if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK)
111112 continue;
112113
113− st = av_new_stream(s, id);
114+ st = avformat_new_stream(s, NULL);
115+ st->id = id;
114116 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
115117 st->r_frame_rate.num = stream->info.dwRate;
116118 st->r_frame_rate.den = stream->info.dwScale;
libavformat/avs.c+2−2
@@ -179,7 +179,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) · 178 unmodified lines
179179
180180 case AVS_VIDEO:
181181 if (!avs->st_video) {
182− avs->st_video = av_new_stream(s, AVS_VIDEO);
182+ avs->st_video = avformat_new_stream(s, NULL);
183183 if (avs->st_video == NULL)
184184 return AVERROR(ENOMEM);
185185 avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -196,7 +196,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) · 10 unmodified lines
196196
197197 case AVS_AUDIO:
198198 if (!avs->st_audio) {
199− avs->st_audio = av_new_stream(s, AVS_AUDIO);
199+ avs->st_audio = avformat_new_stream(s, NULL);
200200 if (avs->st_audio == NULL)
201201 return AVERROR(ENOMEM);
202202 avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/bink.c+1−1
@@ -130,7 +130,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 129 unmodified lines
130130 avio_skip(pb, 4 * bink->num_audio_tracks);
131131
132132 for (i = 0; i < bink->num_audio_tracks; i++) {
133− ast = av_new_stream(s, 1);
133+ ast = avformat_new_stream(s, NULL);
134134 if (!ast)
135135 return AVERROR(ENOMEM);
136136 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/c93.c+1−1
@@ -117,7 +117,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 116 unmodified lines
117117 datasize = avio_rl16(pb);
118118 if (datasize > 42) {
119119 if (!c93->audio) {
120− c93->audio = av_new_stream(s, 1);
120+ c93->audio = avformat_new_stream(s, NULL);
121121 if (!c93->audio)
122122 return AVERROR(ENOMEM);
123123 c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/flic.c+1−1
@@ -145,7 +145,7 @@ static int flic_read_header(AVFormatContext *s, · 144 unmodified lines
145145 */
146146 if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) {
147147 /* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */
148− ast = av_new_stream(s, 1);
148+ ast = avformat_new_stream(s, NULL);
149149 if (!ast)
150150 return AVERROR(ENOMEM);
151151
libavformat/flvdec.c+2−1
@@ -354,9 +354,10 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) { · 353 unmodified lines
354354 }
355355
356356 static AVStream *create_stream(AVFormatContext *s, int is_audio){
357− AVStream *st = av_new_stream(s, is_audio);
357+ AVStream *st = avformat_new_stream(s, NULL);
358358 if (!st)
359359 return NULL;
360+ st->id = is_audio;
360361 st->codec->codec_type = is_audio ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_VIDEO;
361362 av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
362363 return st;
libavformat/gxf.c+2−1
@@ -81,9 +81,10 @@ static int get_sindex(AVFormatContext *s, int id, int format) { · 80 unmodified lines
8181 i = ff_find_stream_index(s, id);
8282 if (i >= 0)
8383 return i;
84− st = av_new_stream(s, id);
84+ st = avformat_new_stream(s, NULL);
8585 if (!st)
8686 return AVERROR(ENOMEM);
87+ st->id = id;
8788 switch (format) {
8889 case 3:
8990 case 4:
libavformat/idroqdec.c+1−1
@@ -166,7 +166,7 @@ static int roq_read_packet(AVFormatContext *s, · 165 unmodified lines
166166 case RoQ_SOUND_MONO:
167167 case RoQ_SOUND_STEREO:
168168 if (roq->audio_stream_index == -1) {
169− AVStream *st = av_new_stream(s, 1);
169+ AVStream *st = avformat_new_stream(s, NULL);
170170 if (!st)
171171 return AVERROR(ENOMEM);
172172 av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE);
libavformat/jvdec.c+1−1
@@ -70,7 +70,7 @@ static int read_header(AVFormatContext *s, · 69 unmodified lines
7070 avio_skip(pb, 80);
7171
7272 ast = avformat_new_stream(s, NULL);
73− vst = av_new_stream(s, 1);
73+ vst = avformat_new_stream(s, NULL);
7474 if (!ast || !vst)
7575 return AVERROR(ENOMEM);
7676
libavformat/libnut.c+1−1
@@ -213,7 +213,7 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { · 212 unmodified lines
213213 priv->s = s;
214214
215215 for (i = 0; s[i].type != -1 && i < 2; i++) {
216− AVStream * st = av_new_stream(avf, i);
216+ AVStream * st = avformat_new_stream(avf, NULL);
217217 int j;
218218
219219 for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8);
libavformat/lmlm4.c+1−1
@@ -67,7 +67,7 @@ static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) { · 66 unmodified lines
6767 st->need_parsing = AVSTREAM_PARSE_HEADERS;
6868 av_set_pts_info(st, 64, 1001, 30000);
6969
70− if (!(st = av_new_stream(s, 1)))
70+ if (!(st = avformat_new_stream(s, NULL)))
7171 return AVERROR(ENOMEM);
7272 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
7373 st->codec->codec_id = CODEC_ID_MP2;
libavformat/lxfdec.c+1−1
@@ -243,7 +243,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 242 unmodified lines
243243 av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n");
244244
245245 if ((lxf->channels = (disk_params >> 2) & 0xF)) {
246− if (!(st = av_new_stream(s, 1)))
246+ if (!(st = avformat_new_stream(s, NULL)))
247247 return AVERROR(ENOMEM);
248248
249249 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/mov.c+2−1
@@ -1793,8 +1793,9 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 1792 unmodified lines
17931793 MOVStreamContext *sc;
17941794 int ret;
17951795
1796− st = av_new_stream(c->fc, c->fc->nb_streams);
1796+ st = avformat_new_stream(c->fc, NULL);
17971797 if (!st) return AVERROR(ENOMEM);
1798+ st->id = c->fc->nb_streams;
17981799 sc = av_mallocz(sizeof(MOVStreamContext));
17991800 if (!sc) return AVERROR(ENOMEM);
18001801
libavformat/mpeg.c+2−1
@@ -532,9 +532,10 @@ static int mpegps_read_packet(AVFormatContext *s, · 531 unmodified lines
532532 goto redo;
533533 }
534534 /* no stream found: add a new stream */
535− st = av_new_stream(s, startcode);
535+ st = avformat_new_stream(s, NULL);
536536 if (!st)
537537 goto skip;
538+ st->id = startcode;
538539 st->codec->codec_type = type;
539540 st->codec->codec_id = codec_id;
540541 if (codec_id != CODEC_ID_PCM_S16BE)
libavformat/mpegts.c+12−6
@@ -598,12 +598,13 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes, · 597 unmodified lines
598598 return AVERROR(ENOMEM);
599599 memcpy(sub_pes, pes, sizeof(*sub_pes));
600600
601− sub_st = av_new_stream(pes->stream, pes->pid);
601+ sub_st = avformat_new_stream(pes->stream, NULL);
602602 if (!sub_st) {
603603 av_free(sub_pes);
604604 return AVERROR(ENOMEM);
605605 }
606606
607+ sub_st->id = pes->pid;
607608 av_set_pts_info(sub_st, 33, 1, 90000);
608609 sub_st->priv_data = sub_pes;
609610 sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -700,9 +701,10 @@ static int mpegts_push_data(MpegTSFilter *filter, · 90 unmodified lines
700701
701702 /* stream not present in PMT */
702703 if (!pes->st) {
703− pes->st = av_new_stream(ts->stream, pes->pid);
704+ pes->st = avformat_new_stream(ts->stream, NULL);
704705 if (!pes->st)
705706 return AVERROR(ENOMEM);
707+ pes->st->id = pes->pid;
706708 mpegts_set_stream_info(pes->st, pes, 0, 0);
707709 }
708710
@@ -1090,14 +1092,18 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len · 381 unmodified lines
10901092 /* now create ffmpeg stream */
10911093 if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) {
10921094 pes = ts->pids[pid]->u.pes_filter.opaque;
1093− if (!pes->st)
1094− pes->st = av_new_stream(pes->stream, pes->pid);
1095+ if (!pes->st) {
1096+ pes->st = avformat_new_stream(pes->stream, NULL);
1097+ st->id = pes->pid;
1098+ }
10951099 st = pes->st;
10961100 } else {
10971101 if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably
10981102 pes = add_pes_stream(ts, pid, pcr_pid);
1099− if (pes)
1100− st = av_new_stream(pes->stream, pes->pid);
1103+ if (pes) {
1104+ st = avformat_new_stream(pes->stream, NULL);
1105+ st->id = pes->pid;
1106+ }
11011107 }
11021108
11031109 if (!st)
libavformat/mtv.c+4−6
@@ -32,8 +32,6 @@ · 31 unmodified lines
3232 #define MTV_HEADER_SIZE 512
3333 #define MTV_AUDIO_PADDING_SIZE 12
3434 #define AUDIO_SAMPLING_RATE 44100
35−#define VIDEO_SID 0
36−#define AUDIO_SID 1
3735
3836 typedef struct MTVDemuxContext {
3937
@@ -118,7 +116,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 78 unmodified lines
118116
119117 // video - raw rgb565
120118
121− st = av_new_stream(s, VIDEO_SID);
119+ st = avformat_new_stream(s, NULL);
122120 if(!st)
123121 return AVERROR(ENOMEM);
124122
@@ -134,7 +132,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 9 unmodified lines
134132
135133 // audio - mp3
136134
137− st = av_new_stream(s, AUDIO_SID);
135+ st = avformat_new_stream(s, NULL);
138136 if(!st)
139137 return AVERROR(ENOMEM);
140138
@@ -171,7 +169,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) · 30 unmodified lines
171169 return ret;
172170
173171 pkt->pos -= MTV_AUDIO_PADDING_SIZE;
174− pkt->stream_index = AUDIO_SID;
172+ pkt->stream_index = 1;
175173
176174 }else
177175 {
@@ -190,7 +188,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) · 12 unmodified lines
190188 for(i=0;i<mtv->img_segment_size/2;i++)
191189 *((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i));
192190 #endif
193− pkt->stream_index = VIDEO_SID;
191+ pkt->stream_index = 0;
194192 }
195193
196194 return ret;
libavformat/mxfdec.c+2−1
@@ -746,11 +746,12 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) · 745 unmodified lines
746746 if (!source_track)
747747 continue;
748748
749− st = av_new_stream(mxf->fc, source_track->track_id);
749+ st = avformat_new_stream(mxf->fc, NULL);
750750 if (!st) {
751751 av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n");
752752 return -1;
753753 }
754+ st->id = source_track->track_id;
754755 st->priv_data = source_track;
755756 st->duration = component->duration;
756757 if (st->duration == -1)
libavformat/mxg.c+4−6
@@ -24,8 +24,6 @@ · 23 unmodified lines
2424 #include "avformat.h"
2525 #include "avio.h"
2626
27−#define VIDEO_STREAM_INDEX 0
28−#define AUDIO_STREAM_INDEX 1
2927 #define DEFAULT_PACKET_SIZE 1024
3028 #define OVERREAD_SIZE 3
3129
@@ -44,14 +42,14 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap) · 12 unmodified lines
4442 MXGContext *mxg = s->priv_data;
4543
4644 /* video parameters will be extracted from the compressed bitstream */
47− video_st = av_new_stream(s, VIDEO_STREAM_INDEX);
45+ video_st = avformat_new_stream(s, NULL);
4846 if (!video_st)
4947 return AVERROR(ENOMEM);
5048 video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
5149 video_st->codec->codec_id = CODEC_ID_MXPEG;
5250 av_set_pts_info(video_st, 64, 1, 1000000);
5351
54− audio_st = av_new_stream(s, AUDIO_STREAM_INDEX);
52+ audio_st = avformat_new_stream(s, NULL);
5553 if (!audio_st)
5654 return AVERROR(ENOMEM);
5755 audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -166,7 +164,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) · 108 unmodified lines
166164 }
167165
168166 pkt->pts = pkt->dts = mxg->dts;
169− pkt->stream_index = VIDEO_STREAM_INDEX;
167+ pkt->stream_index = 0;
170168 pkt->destruct = NULL;
171169 pkt->size = mxg->buffer_ptr - mxg->soi_ptr;
172170 pkt->data = mxg->soi_ptr;
@@ -204,7 +202,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) · 31 unmodified lines
204202 if (marker == APP13 && size >= 16) { /* audio data */
205203 /* time (GMT) of first sample in usec since 1970, little-endian */
206204 pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8);
207− pkt->stream_index = AUDIO_STREAM_INDEX;
205+ pkt->stream_index = 1;
208206 pkt->destruct = NULL;
209207 pkt->size = size - 14;
210208 pkt->data = startmarker_ptr + 16;
libavformat/nsvdec.c+4−2
@@ -437,10 +437,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) · 436 unmodified lines
437437 nsv->vheight = vwidth;
438438 if (vtag != T_NONE) {
439439 int i;
440− st = av_new_stream(s, NSV_ST_VIDEO);
440+ st = avformat_new_stream(s, NULL);
441441 if (!st)
442442 goto fail;
443443
444+ st->id = NSV_ST_VIDEO;
444445 nst = av_mallocz(sizeof(NSVStream));
445446 if (!nst)
446447 goto fail;
@@ -468,10 +469,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) · 21 unmodified lines
468469 }
469470 if (atag != T_NONE) {
470471 #ifndef DISABLE_AUDIO
471− st = av_new_stream(s, NSV_ST_AUDIO);
472+ st = avformat_new_stream(s, NULL);
472473 if (!st)
473474 goto fail;
474475
476+ st->id = NSV_ST_AUDIO;
475477 nst = av_mallocz(sizeof(NSVStream));
476478 if (!nst)
477479 goto fail;
libavformat/nutdec.c+1−1
@@ -288,7 +288,7 @@ static int decode_main_header(NUTContext *nut){ · 287 unmodified lines
288288
289289 nut->stream = av_mallocz(sizeof(StreamContext)*stream_count);
290290 for(i=0; i<stream_count; i++){
291− av_new_stream(s, i);
291+ avformat_new_stream(s, NULL);
292292 }
293293
294294 return 0;
libavformat/nuv.c+2−2
@@ -153,7 +153,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { · 152 unmodified lines
153153
154154 if (v_packs) {
155155 ctx->v_id = stream_nr++;
156− vst = av_new_stream(s, ctx->v_id);
156+ vst = avformat_new_stream(s, NULL);
157157 if (!vst)
158158 return AVERROR(ENOMEM);
159159 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -169,7 +169,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { · 9 unmodified lines
169169
170170 if (a_packs) {
171171 ctx->a_id = stream_nr++;
172− ast = av_new_stream(s, ctx->a_id);
172+ ast = avformat_new_stream(s, NULL);
173173 if (!ast)
174174 return AVERROR(ENOMEM);
175175 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/oggdec.c+2−1
@@ -172,10 +172,11 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream) · 171 unmodified lines
172172 os->header = -1;
173173
174174 if (new_avstream) {
175− st = av_new_stream(s, idx);
175+ st = avformat_new_stream(s, NULL);
176176 if (!st)
177177 return AVERROR(ENOMEM);
178178
179+ st->id = idx;
179180 av_set_pts_info(st, 64, 1, 1000000);
180181 }
181182
libavformat/pva.c+1−1
@@ -51,7 +51,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) { · 50 unmodified lines
5151 av_set_pts_info(st, 32, 1, 90000);
5252 av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME);
5353
54− if (!(st = av_new_stream(s, 1)))
54+ if (!(st = avformat_new_stream(s, NULL)))
5555 return AVERROR(ENOMEM);
5656 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
5757 st->codec->codec_id = CODEC_ID_MP2;
libavformat/r3d.c+1−1
@@ -89,7 +89,7 @@ static int r3d_read_red1(AVFormatContext *s) · 88 unmodified lines
8989 tmp = avio_r8(s->pb); // audio channels
9090 av_dlog(s, "audio channels %d\n", tmp);
9191 if (tmp > 0) {
92− AVStream *ast = av_new_stream(s, 1);
92+ AVStream *ast = avformat_new_stream(s, NULL);
9393 if (!ast)
9494 return AVERROR(ENOMEM);
9595 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
libavformat/rdt.c+2−1
@@ -459,8 +459,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st) · 458 unmodified lines
459459 {
460460 AVStream *st;
461461
462− if (!(st = av_new_stream(s, orig_st->id)))
462+ if (!(st = avformat_new_stream(s, NULL)))
463463 return NULL;
464+ st->id = orig_st->id;
464465 st->codec->codec_type = orig_st->codec->codec_type;
465466 st->first_dts = orig_st->first_dts;
466467
libavformat/rtsp.c+2−1
@@ -357,9 +357,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, · 356 unmodified lines
357357 if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) {
358358 /* no corresponding stream */
359359 } else {
360− st = av_new_stream(s, rt->nb_rtsp_streams - 1);
360+ st = avformat_new_stream(s, NULL);
361361 if (!st)
362362 return;
363+ st->id = rt->nb_rtsp_streams - 1;
363364 rtsp_st->stream_index = st->index;
364365 st->codec->codec_type = codec_type;
365366 if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) {
libavformat/sapdec.c+4−2
@@ -163,11 +163,12 @@ static int sap_read_header(AVFormatContext *s, · 162 unmodified lines
163163 if (sap->sdp_ctx->ctx_flags & AVFMTCTX_NOHEADER)
164164 s->ctx_flags |= AVFMTCTX_NOHEADER;
165165 for (i = 0; i < sap->sdp_ctx->nb_streams; i++) {
166− AVStream *st = av_new_stream(s, i);
166+ AVStream *st = avformat_new_stream(s, NULL);
167167 if (!st) {
168168 ret = AVERROR(ENOMEM);
169169 goto fail;
170170 }
171+ st->id = i;
171172 avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);
172173 st->time_base = sap->sdp_ctx->streams[i]->time_base;
173174 }
@@ -211,11 +212,12 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt) · 37 unmodified lines
211212 if (s->ctx_flags & AVFMTCTX_NOHEADER) {
212213 while (sap->sdp_ctx->nb_streams > s->nb_streams) {
213214 int i = s->nb_streams;
214− AVStream *st = av_new_stream(s, i);
215+ AVStream *st = avformat_new_stream(s, NULL);
215216 if (!st) {
216217 av_free_packet(pkt);
217218 return AVERROR(ENOMEM);
218219 }
220+ st->id = i;
219221 avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec);
220222 st->time_base = sap->sdp_ctx->streams[i]->time_base;
221223 }
libavformat/swfdec.c+6−3
@@ -106,9 +106,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 105 unmodified lines
106106 avio_rl16(pb);
107107 avio_r8(pb);
108108 /* Check for FLV1 */
109− vst = av_new_stream(s, ch_id);
109+ vst = avformat_new_stream(s, NULL);
110110 if (!vst)
111111 return -1;
112+ vst->id = ch_id;
112113 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
113114 vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb));
114115 av_set_pts_info(vst, 16, 256, swf->frame_rate);
@@ -127,9 +128,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 12 unmodified lines
127128 avio_r8(pb);
128129 v = avio_r8(pb);
129130 swf->samples_per_frame = avio_rl16(pb);
130− ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */
131+ ast = avformat_new_stream(s, NULL);
131132 if (!ast)
132133 return -1;
134+ ast->id = -1; /* -1 to avoid clash with video stream ch_id */
133135 ast->codec->channels = 1 + (v&1);
134136 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
135137 ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, (v>>4) & 15);
@@ -177,9 +179,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 41 unmodified lines
177179 break;
178180 }
179181 if (i == s->nb_streams) {
180− vst = av_new_stream(s, -2); /* -2 to avoid clash with video stream and audio stream */
182+ vst = avformat_new_stream(s, NULL);
181183 if (!vst)
182184 return -1;
185+ vst->id = -2; /* -2 to avoid clash with video stream and audio stream */
183186 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
184187 vst->codec->codec_id = CODEC_ID_MJPEG;
185188 av_set_pts_info(vst, 64, 256, swf->frame_rate);
libavformat/wtv.c+2−1
@@ -626,9 +626,10 @@ static AVStream * new_stream(AVFormatContext *s, AVStream *st, int sid, int code · 625 unmodified lines
626626 WtvStream *wst = av_mallocz(sizeof(WtvStream));
627627 if (!wst)
628628 return NULL;
629− st = av_new_stream(s, sid);
629+ st = avformat_new_stream(s, NULL);
630630 if (!st)
631631 return NULL;
632+ st->id = sid;
632633 st->priv_data = wst;
633634 }
634635 st->codec->codec_type = codec_type;
libavformat/xmv.c+1−1
@@ -211,7 +211,7 @@ static int xmv_read_header(AVFormatContext *s, · 210 unmodified lines
211211 av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream "
212212 "(0x%04X)\n", track->flags);
213213
214− ast = av_new_stream(s, audio_track);
214+ ast = avformat_new_stream(s, NULL);
215215 if (!ast)
216216 return AVERROR(ENOMEM);
217217
libavformat/yop.c+1−1
@@ -57,7 +57,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) · 56 unmodified lines
5757 int frame_rate, ret;
5858
5959 audio_stream = avformat_new_stream(s, NULL);
60− video_stream = av_new_stream(s, 1);
60+ video_stream = avformat_new_stream(s, NULL);
6161
6262 // Extra data that will be passed to the decoder
6363 video_stream->codec->extradata_size = 8;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t