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.
Unified · Split
| @@ -3016,7 +3016,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV · 3015 unmodified lines | ||
| 3016 | 3016 | static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) |
| 3017 | 3017 | { |
| 3018 | 3018 | 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); | |
| 3020 | 3020 | int idx = oc->nb_streams - 1, ret = 0; |
| 3021 | 3021 | int64_t max_frames = INT64_MAX; |
| 3022 | 3022 | char *bsf = NULL, *next, *codec_tag = NULL; |
| @@ -3030,6 +3030,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e · 7 unmodified lines | ||
| 3030 | 3030 | exit_program(1); |
| 3031 | 3031 | } |
| 3032 | 3032 | |
| 3033 | + if (oc->nb_streams - 1 < o->nb_streamid_map) | |
| 3034 | + st->id = o->streamid_map[oc->nb_streams - 1]; | |
| 3035 | + | |
| 3033 | 3036 | output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, |
| 3034 | 3037 | nb_output_streams + 1); |
| 3035 | 3038 | ost = &output_streams[nb_output_streams - 1]; |
| @@ -198,12 +198,13 @@ static int fourxm_read_header(AVFormatContext *s, · 197 unmodified lines | ||
| 198 | 198 | i += 8 + size; |
| 199 | 199 | |
| 200 | 200 | /* allocate a new AVStream */ |
| 201 | − st = av_new_stream(s, current_track); | |
| 201 | + st = avformat_new_stream(s, NULL); | |
| 202 | 202 | if (!st){ |
| 203 | 203 | ret= AVERROR(ENOMEM); |
| 204 | 204 | goto fail; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | + st->id = current_track; | |
| 207 | 208 | av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate); |
| 208 | 209 | |
| 209 | 210 | fourxm->tracks[current_track].stream_index = st->index; |
| @@ -505,11 +505,12 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) · 504 unmodified lines | ||
| 505 | 505 | snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth); |
| 506 | 506 | /* Create new AVStreams for each stream in this variant */ |
| 507 | 507 | 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); | |
| 509 | 509 | if (!st) { |
| 510 | 510 | ret = AVERROR(ENOMEM); |
| 511 | 511 | goto fail; |
| 512 | 512 | } |
| 513 | + st->id = i; | |
| 513 | 514 | avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); |
| 514 | 515 | if (v->bandwidth) |
| 515 | 516 | av_dict_set(&st->metadata, "variant_bitrate", bitrate_str, |
| @@ -426,10 +426,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 425 unmodified lines | ||
| 426 | 426 | break; |
| 427 | 427 | }else{ |
| 428 | 428 | stream_index++; |
| 429 | − st = av_new_stream(s, stream_index); | |
| 429 | + st = avformat_new_stream(s, NULL); | |
| 430 | 430 | if (!st) |
| 431 | 431 | goto fail; |
| 432 | 432 | |
| 433 | + st->id = stream_index; | |
| 433 | 434 | ast = av_mallocz(sizeof(AVIStream)); |
| 434 | 435 | if (!ast) |
| 435 | 436 | goto fail; |
| @@ -84,7 +84,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) · 83 unmodified lines | ||
| 84 | 84 | if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK) |
| 85 | 85 | continue; |
| 86 | 86 | |
| 87 | − st = av_new_stream(s, id); | |
| 87 | + st = avformat_new_stream(s, NULL); | |
| 88 | + st->id = id; | |
| 88 | 89 | st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 89 | 90 | |
| 90 | 91 | st->codec->block_align = wvfmt.nBlockAlign; |
| @@ -110,7 +111,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) · 19 unmodified lines | ||
| 110 | 111 | if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK) |
| 111 | 112 | continue; |
| 112 | 113 | |
| 113 | − st = av_new_stream(s, id); | |
| 114 | + st = avformat_new_stream(s, NULL); | |
| 115 | + st->id = id; | |
| 114 | 116 | st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 115 | 117 | st->r_frame_rate.num = stream->info.dwRate; |
| 116 | 118 | st->r_frame_rate.den = stream->info.dwScale; |
| @@ -179,7 +179,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) · 178 unmodified lines | ||
| 179 | 179 | |
| 180 | 180 | case AVS_VIDEO: |
| 181 | 181 | if (!avs->st_video) { |
| 182 | − avs->st_video = av_new_stream(s, AVS_VIDEO); | |
| 182 | + avs->st_video = avformat_new_stream(s, NULL); | |
| 183 | 183 | if (avs->st_video == NULL) |
| 184 | 184 | return AVERROR(ENOMEM); |
| 185 | 185 | 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 | ||
| 196 | 196 | |
| 197 | 197 | case AVS_AUDIO: |
| 198 | 198 | if (!avs->st_audio) { |
| 199 | − avs->st_audio = av_new_stream(s, AVS_AUDIO); | |
| 199 | + avs->st_audio = avformat_new_stream(s, NULL); | |
| 200 | 200 | if (avs->st_audio == NULL) |
| 201 | 201 | return AVERROR(ENOMEM); |
| 202 | 202 | avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| @@ -130,7 +130,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 129 unmodified lines | ||
| 130 | 130 | avio_skip(pb, 4 * bink->num_audio_tracks); |
| 131 | 131 | |
| 132 | 132 | for (i = 0; i < bink->num_audio_tracks; i++) { |
| 133 | − ast = av_new_stream(s, 1); | |
| 133 | + ast = avformat_new_stream(s, NULL); | |
| 134 | 134 | if (!ast) |
| 135 | 135 | return AVERROR(ENOMEM); |
| 136 | 136 | ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| @@ -117,7 +117,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 116 unmodified lines | ||
| 117 | 117 | datasize = avio_rl16(pb); |
| 118 | 118 | if (datasize > 42) { |
| 119 | 119 | if (!c93->audio) { |
| 120 | − c93->audio = av_new_stream(s, 1); | |
| 120 | + c93->audio = avformat_new_stream(s, NULL); | |
| 121 | 121 | if (!c93->audio) |
| 122 | 122 | return AVERROR(ENOMEM); |
| 123 | 123 | c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| @@ -145,7 +145,7 @@ static int flic_read_header(AVFormatContext *s, · 144 unmodified lines | ||
| 145 | 145 | */ |
| 146 | 146 | if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) { |
| 147 | 147 | /* 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); | |
| 149 | 149 | if (!ast) |
| 150 | 150 | return AVERROR(ENOMEM); |
| 151 | 151 | |
| @@ -354,9 +354,10 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) { · 353 unmodified lines | ||
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | 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); | |
| 358 | 358 | if (!st) |
| 359 | 359 | return NULL; |
| 360 | + st->id = is_audio; | |
| 360 | 361 | st->codec->codec_type = is_audio ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_VIDEO; |
| 361 | 362 | av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ |
| 362 | 363 | return st; |
| @@ -81,9 +81,10 @@ static int get_sindex(AVFormatContext *s, int id, int format) { · 80 unmodified lines | ||
| 81 | 81 | i = ff_find_stream_index(s, id); |
| 82 | 82 | if (i >= 0) |
| 83 | 83 | return i; |
| 84 | − st = av_new_stream(s, id); | |
| 84 | + st = avformat_new_stream(s, NULL); | |
| 85 | 85 | if (!st) |
| 86 | 86 | return AVERROR(ENOMEM); |
| 87 | + st->id = id; | |
| 87 | 88 | switch (format) { |
| 88 | 89 | case 3: |
| 89 | 90 | case 4: |
| @@ -166,7 +166,7 @@ static int roq_read_packet(AVFormatContext *s, · 165 unmodified lines | ||
| 166 | 166 | case RoQ_SOUND_MONO: |
| 167 | 167 | case RoQ_SOUND_STEREO: |
| 168 | 168 | if (roq->audio_stream_index == -1) { |
| 169 | − AVStream *st = av_new_stream(s, 1); | |
| 169 | + AVStream *st = avformat_new_stream(s, NULL); | |
| 170 | 170 | if (!st) |
| 171 | 171 | return AVERROR(ENOMEM); |
| 172 | 172 | av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE); |
| @@ -70,7 +70,7 @@ static int read_header(AVFormatContext *s, · 69 unmodified lines | ||
| 70 | 70 | avio_skip(pb, 80); |
| 71 | 71 | |
| 72 | 72 | ast = avformat_new_stream(s, NULL); |
| 73 | − vst = av_new_stream(s, 1); | |
| 73 | + vst = avformat_new_stream(s, NULL); | |
| 74 | 74 | if (!ast || !vst) |
| 75 | 75 | return AVERROR(ENOMEM); |
| 76 | 76 | |
| @@ -213,7 +213,7 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { · 212 unmodified lines | ||
| 213 | 213 | priv->s = s; |
| 214 | 214 | |
| 215 | 215 | 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); | |
| 217 | 217 | int j; |
| 218 | 218 | |
| 219 | 219 | for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8); |
| @@ -67,7 +67,7 @@ static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) { · 66 unmodified lines | ||
| 67 | 67 | st->need_parsing = AVSTREAM_PARSE_HEADERS; |
| 68 | 68 | av_set_pts_info(st, 64, 1001, 30000); |
| 69 | 69 | |
| 70 | − if (!(st = av_new_stream(s, 1))) | |
| 70 | + if (!(st = avformat_new_stream(s, NULL))) | |
| 71 | 71 | return AVERROR(ENOMEM); |
| 72 | 72 | st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 73 | 73 | st->codec->codec_id = CODEC_ID_MP2; |
| @@ -243,7 +243,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 242 unmodified lines | ||
| 243 | 243 | av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n"); |
| 244 | 244 | |
| 245 | 245 | if ((lxf->channels = (disk_params >> 2) & 0xF)) { |
| 246 | − if (!(st = av_new_stream(s, 1))) | |
| 246 | + if (!(st = avformat_new_stream(s, NULL))) | |
| 247 | 247 | return AVERROR(ENOMEM); |
| 248 | 248 | |
| 249 | 249 | st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| @@ -1793,8 +1793,9 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 1792 unmodified lines | ||
| 1793 | 1793 | MOVStreamContext *sc; |
| 1794 | 1794 | int ret; |
| 1795 | 1795 | |
| 1796 | − st = av_new_stream(c->fc, c->fc->nb_streams); | |
| 1796 | + st = avformat_new_stream(c->fc, NULL); | |
| 1797 | 1797 | if (!st) return AVERROR(ENOMEM); |
| 1798 | + st->id = c->fc->nb_streams; | |
| 1798 | 1799 | sc = av_mallocz(sizeof(MOVStreamContext)); |
| 1799 | 1800 | if (!sc) return AVERROR(ENOMEM); |
| 1800 | 1801 | |
| @@ -532,9 +532,10 @@ static int mpegps_read_packet(AVFormatContext *s, · 531 unmodified lines | ||
| 532 | 532 | goto redo; |
| 533 | 533 | } |
| 534 | 534 | /* no stream found: add a new stream */ |
| 535 | − st = av_new_stream(s, startcode); | |
| 535 | + st = avformat_new_stream(s, NULL); | |
| 536 | 536 | if (!st) |
| 537 | 537 | goto skip; |
| 538 | + st->id = startcode; | |
| 538 | 539 | st->codec->codec_type = type; |
| 539 | 540 | st->codec->codec_id = codec_id; |
| 540 | 541 | if (codec_id != CODEC_ID_PCM_S16BE) |
| @@ -598,12 +598,13 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes, · 597 unmodified lines | ||
| 598 | 598 | return AVERROR(ENOMEM); |
| 599 | 599 | memcpy(sub_pes, pes, sizeof(*sub_pes)); |
| 600 | 600 | |
| 601 | − sub_st = av_new_stream(pes->stream, pes->pid); | |
| 601 | + sub_st = avformat_new_stream(pes->stream, NULL); | |
| 602 | 602 | if (!sub_st) { |
| 603 | 603 | av_free(sub_pes); |
| 604 | 604 | return AVERROR(ENOMEM); |
| 605 | 605 | } |
| 606 | 606 | |
| 607 | + sub_st->id = pes->pid; | |
| 607 | 608 | av_set_pts_info(sub_st, 33, 1, 90000); |
| 608 | 609 | sub_st->priv_data = sub_pes; |
| 609 | 610 | sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| @@ -700,9 +701,10 @@ static int mpegts_push_data(MpegTSFilter *filter, · 90 unmodified lines | ||
| 700 | 701 | |
| 701 | 702 | /* stream not present in PMT */ |
| 702 | 703 | if (!pes->st) { |
| 703 | − pes->st = av_new_stream(ts->stream, pes->pid); | |
| 704 | + pes->st = avformat_new_stream(ts->stream, NULL); | |
| 704 | 705 | if (!pes->st) |
| 705 | 706 | return AVERROR(ENOMEM); |
| 707 | + pes->st->id = pes->pid; | |
| 706 | 708 | mpegts_set_stream_info(pes->st, pes, 0, 0); |
| 707 | 709 | } |
| 708 | 710 | |
| @@ -1090,14 +1092,18 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len · 381 unmodified lines | ||
| 1090 | 1092 | /* now create ffmpeg stream */ |
| 1091 | 1093 | if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) { |
| 1092 | 1094 | 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 | + } | |
| 1095 | 1099 | st = pes->st; |
| 1096 | 1100 | } else { |
| 1097 | 1101 | if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably |
| 1098 | 1102 | 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 | + } | |
| 1101 | 1107 | } |
| 1102 | 1108 | |
| 1103 | 1109 | if (!st) |
| @@ -32,8 +32,6 @@ · 31 unmodified lines | ||
| 32 | 32 | #define MTV_HEADER_SIZE 512 |
| 33 | 33 | #define MTV_AUDIO_PADDING_SIZE 12 |
| 34 | 34 | #define AUDIO_SAMPLING_RATE 44100 |
| 35 | −#define VIDEO_SID 0 | |
| 36 | −#define AUDIO_SID 1 | |
| 37 | 35 | |
| 38 | 36 | typedef struct MTVDemuxContext { |
| 39 | 37 | |
| @@ -118,7 +116,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 78 unmodified lines | ||
| 118 | 116 | |
| 119 | 117 | // video - raw rgb565 |
| 120 | 118 | |
| 121 | − st = av_new_stream(s, VIDEO_SID); | |
| 119 | + st = avformat_new_stream(s, NULL); | |
| 122 | 120 | if(!st) |
| 123 | 121 | return AVERROR(ENOMEM); |
| 124 | 122 | |
| @@ -134,7 +132,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 9 unmodified lines | ||
| 134 | 132 | |
| 135 | 133 | // audio - mp3 |
| 136 | 134 | |
| 137 | − st = av_new_stream(s, AUDIO_SID); | |
| 135 | + st = avformat_new_stream(s, NULL); | |
| 138 | 136 | if(!st) |
| 139 | 137 | return AVERROR(ENOMEM); |
| 140 | 138 | |
| @@ -171,7 +169,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) · 30 unmodified lines | ||
| 171 | 169 | return ret; |
| 172 | 170 | |
| 173 | 171 | pkt->pos -= MTV_AUDIO_PADDING_SIZE; |
| 174 | − pkt->stream_index = AUDIO_SID; | |
| 172 | + pkt->stream_index = 1; | |
| 175 | 173 | |
| 176 | 174 | }else |
| 177 | 175 | { |
| @@ -190,7 +188,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) · 12 unmodified lines | ||
| 190 | 188 | for(i=0;i<mtv->img_segment_size/2;i++) |
| 191 | 189 | *((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i)); |
| 192 | 190 | #endif |
| 193 | − pkt->stream_index = VIDEO_SID; | |
| 191 | + pkt->stream_index = 0; | |
| 194 | 192 | } |
| 195 | 193 | |
| 196 | 194 | return ret; |
| @@ -746,11 +746,12 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) · 745 unmodified lines | ||
| 746 | 746 | if (!source_track) |
| 747 | 747 | continue; |
| 748 | 748 | |
| 749 | − st = av_new_stream(mxf->fc, source_track->track_id); | |
| 749 | + st = avformat_new_stream(mxf->fc, NULL); | |
| 750 | 750 | if (!st) { |
| 751 | 751 | av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n"); |
| 752 | 752 | return -1; |
| 753 | 753 | } |
| 754 | + st->id = source_track->track_id; | |
| 754 | 755 | st->priv_data = source_track; |
| 755 | 756 | st->duration = component->duration; |
| 756 | 757 | if (st->duration == -1) |
| @@ -24,8 +24,6 @@ · 23 unmodified lines | ||
| 24 | 24 | #include "avformat.h" |
| 25 | 25 | #include "avio.h" |
| 26 | 26 | |
| 27 | −#define VIDEO_STREAM_INDEX 0 | |
| 28 | −#define AUDIO_STREAM_INDEX 1 | |
| 29 | 27 | #define DEFAULT_PACKET_SIZE 1024 |
| 30 | 28 | #define OVERREAD_SIZE 3 |
| 31 | 29 | |
| @@ -44,14 +42,14 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap) · 12 unmodified lines | ||
| 44 | 42 | MXGContext *mxg = s->priv_data; |
| 45 | 43 | |
| 46 | 44 | /* 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); | |
| 48 | 46 | if (!video_st) |
| 49 | 47 | return AVERROR(ENOMEM); |
| 50 | 48 | video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 51 | 49 | video_st->codec->codec_id = CODEC_ID_MXPEG; |
| 52 | 50 | av_set_pts_info(video_st, 64, 1, 1000000); |
| 53 | 51 | |
| 54 | − audio_st = av_new_stream(s, AUDIO_STREAM_INDEX); | |
| 52 | + audio_st = avformat_new_stream(s, NULL); | |
| 55 | 53 | if (!audio_st) |
| 56 | 54 | return AVERROR(ENOMEM); |
| 57 | 55 | audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| @@ -166,7 +164,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) · 108 unmodified lines | ||
| 166 | 164 | } |
| 167 | 165 | |
| 168 | 166 | pkt->pts = pkt->dts = mxg->dts; |
| 169 | − pkt->stream_index = VIDEO_STREAM_INDEX; | |
| 167 | + pkt->stream_index = 0; | |
| 170 | 168 | pkt->destruct = NULL; |
| 171 | 169 | pkt->size = mxg->buffer_ptr - mxg->soi_ptr; |
| 172 | 170 | pkt->data = mxg->soi_ptr; |
| @@ -204,7 +202,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) · 31 unmodified lines | ||
| 204 | 202 | if (marker == APP13 && size >= 16) { /* audio data */ |
| 205 | 203 | /* time (GMT) of first sample in usec since 1970, little-endian */ |
| 206 | 204 | pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8); |
| 207 | − pkt->stream_index = AUDIO_STREAM_INDEX; | |
| 205 | + pkt->stream_index = 1; | |
| 208 | 206 | pkt->destruct = NULL; |
| 209 | 207 | pkt->size = size - 14; |
| 210 | 208 | pkt->data = startmarker_ptr + 16; |
| @@ -437,10 +437,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) · 436 unmodified lines | ||
| 437 | 437 | nsv->vheight = vwidth; |
| 438 | 438 | if (vtag != T_NONE) { |
| 439 | 439 | int i; |
| 440 | − st = av_new_stream(s, NSV_ST_VIDEO); | |
| 440 | + st = avformat_new_stream(s, NULL); | |
| 441 | 441 | if (!st) |
| 442 | 442 | goto fail; |
| 443 | 443 | |
| 444 | + st->id = NSV_ST_VIDEO; | |
| 444 | 445 | nst = av_mallocz(sizeof(NSVStream)); |
| 445 | 446 | if (!nst) |
| 446 | 447 | goto fail; |
| @@ -468,10 +469,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) · 21 unmodified lines | ||
| 468 | 469 | } |
| 469 | 470 | if (atag != T_NONE) { |
| 470 | 471 | #ifndef DISABLE_AUDIO |
| 471 | − st = av_new_stream(s, NSV_ST_AUDIO); | |
| 472 | + st = avformat_new_stream(s, NULL); | |
| 472 | 473 | if (!st) |
| 473 | 474 | goto fail; |
| 474 | 475 | |
| 476 | + st->id = NSV_ST_AUDIO; | |
| 475 | 477 | nst = av_mallocz(sizeof(NSVStream)); |
| 476 | 478 | if (!nst) |
| 477 | 479 | goto fail; |
| @@ -288,7 +288,7 @@ static int decode_main_header(NUTContext *nut){ · 287 unmodified lines | ||
| 288 | 288 | |
| 289 | 289 | nut->stream = av_mallocz(sizeof(StreamContext)*stream_count); |
| 290 | 290 | for(i=0; i<stream_count; i++){ |
| 291 | − av_new_stream(s, i); | |
| 291 | + avformat_new_stream(s, NULL); | |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | return 0; |
| @@ -153,7 +153,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { · 152 unmodified lines | ||
| 153 | 153 | |
| 154 | 154 | if (v_packs) { |
| 155 | 155 | ctx->v_id = stream_nr++; |
| 156 | − vst = av_new_stream(s, ctx->v_id); | |
| 156 | + vst = avformat_new_stream(s, NULL); | |
| 157 | 157 | if (!vst) |
| 158 | 158 | return AVERROR(ENOMEM); |
| 159 | 159 | vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| @@ -169,7 +169,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { · 9 unmodified lines | ||
| 169 | 169 | |
| 170 | 170 | if (a_packs) { |
| 171 | 171 | ctx->a_id = stream_nr++; |
| 172 | − ast = av_new_stream(s, ctx->a_id); | |
| 172 | + ast = avformat_new_stream(s, NULL); | |
| 173 | 173 | if (!ast) |
| 174 | 174 | return AVERROR(ENOMEM); |
| 175 | 175 | ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| @@ -172,10 +172,11 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream) · 171 unmodified lines | ||
| 172 | 172 | os->header = -1; |
| 173 | 173 | |
| 174 | 174 | if (new_avstream) { |
| 175 | − st = av_new_stream(s, idx); | |
| 175 | + st = avformat_new_stream(s, NULL); | |
| 176 | 176 | if (!st) |
| 177 | 177 | return AVERROR(ENOMEM); |
| 178 | 178 | |
| 179 | + st->id = idx; | |
| 179 | 180 | av_set_pts_info(st, 64, 1, 1000000); |
| 180 | 181 | } |
| 181 | 182 | |
| @@ -51,7 +51,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) { · 50 unmodified lines | ||
| 51 | 51 | av_set_pts_info(st, 32, 1, 90000); |
| 52 | 52 | av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME); |
| 53 | 53 | |
| 54 | − if (!(st = av_new_stream(s, 1))) | |
| 54 | + if (!(st = avformat_new_stream(s, NULL))) | |
| 55 | 55 | return AVERROR(ENOMEM); |
| 56 | 56 | st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 57 | 57 | st->codec->codec_id = CODEC_ID_MP2; |
| @@ -89,7 +89,7 @@ static int r3d_read_red1(AVFormatContext *s) · 88 unmodified lines | ||
| 89 | 89 | tmp = avio_r8(s->pb); // audio channels |
| 90 | 90 | av_dlog(s, "audio channels %d\n", tmp); |
| 91 | 91 | if (tmp > 0) { |
| 92 | − AVStream *ast = av_new_stream(s, 1); | |
| 92 | + AVStream *ast = avformat_new_stream(s, NULL); | |
| 93 | 93 | if (!ast) |
| 94 | 94 | return AVERROR(ENOMEM); |
| 95 | 95 | ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| @@ -459,8 +459,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st) · 458 unmodified lines | ||
| 459 | 459 | { |
| 460 | 460 | AVStream *st; |
| 461 | 461 | |
| 462 | − if (!(st = av_new_stream(s, orig_st->id))) | |
| 462 | + if (!(st = avformat_new_stream(s, NULL))) | |
| 463 | 463 | return NULL; |
| 464 | + st->id = orig_st->id; | |
| 464 | 465 | st->codec->codec_type = orig_st->codec->codec_type; |
| 465 | 466 | st->first_dts = orig_st->first_dts; |
| 466 | 467 | |
| @@ -357,9 +357,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, · 356 unmodified lines | ||
| 357 | 357 | if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) { |
| 358 | 358 | /* no corresponding stream */ |
| 359 | 359 | } else { |
| 360 | − st = av_new_stream(s, rt->nb_rtsp_streams - 1); | |
| 360 | + st = avformat_new_stream(s, NULL); | |
| 361 | 361 | if (!st) |
| 362 | 362 | return; |
| 363 | + st->id = rt->nb_rtsp_streams - 1; | |
| 363 | 364 | rtsp_st->stream_index = st->index; |
| 364 | 365 | st->codec->codec_type = codec_type; |
| 365 | 366 | if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) { |
| @@ -163,11 +163,12 @@ static int sap_read_header(AVFormatContext *s, · 162 unmodified lines | ||
| 163 | 163 | if (sap->sdp_ctx->ctx_flags & AVFMTCTX_NOHEADER) |
| 164 | 164 | s->ctx_flags |= AVFMTCTX_NOHEADER; |
| 165 | 165 | 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); | |
| 167 | 167 | if (!st) { |
| 168 | 168 | ret = AVERROR(ENOMEM); |
| 169 | 169 | goto fail; |
| 170 | 170 | } |
| 171 | + st->id = i; | |
| 171 | 172 | avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec); |
| 172 | 173 | st->time_base = sap->sdp_ctx->streams[i]->time_base; |
| 173 | 174 | } |
| @@ -211,11 +212,12 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt) · 37 unmodified lines | ||
| 211 | 212 | if (s->ctx_flags & AVFMTCTX_NOHEADER) { |
| 212 | 213 | while (sap->sdp_ctx->nb_streams > s->nb_streams) { |
| 213 | 214 | int i = s->nb_streams; |
| 214 | − AVStream *st = av_new_stream(s, i); | |
| 215 | + AVStream *st = avformat_new_stream(s, NULL); | |
| 215 | 216 | if (!st) { |
| 216 | 217 | av_free_packet(pkt); |
| 217 | 218 | return AVERROR(ENOMEM); |
| 218 | 219 | } |
| 220 | + st->id = i; | |
| 219 | 221 | avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec); |
| 220 | 222 | st->time_base = sap->sdp_ctx->streams[i]->time_base; |
| 221 | 223 | } |
| @@ -106,9 +106,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 105 unmodified lines | ||
| 106 | 106 | avio_rl16(pb); |
| 107 | 107 | avio_r8(pb); |
| 108 | 108 | /* Check for FLV1 */ |
| 109 | − vst = av_new_stream(s, ch_id); | |
| 109 | + vst = avformat_new_stream(s, NULL); | |
| 110 | 110 | if (!vst) |
| 111 | 111 | return -1; |
| 112 | + vst->id = ch_id; | |
| 112 | 113 | vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 113 | 114 | vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb)); |
| 114 | 115 | 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 | ||
| 127 | 128 | avio_r8(pb); |
| 128 | 129 | v = avio_r8(pb); |
| 129 | 130 | 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); | |
| 131 | 132 | if (!ast) |
| 132 | 133 | return -1; |
| 134 | + ast->id = -1; /* -1 to avoid clash with video stream ch_id */ | |
| 133 | 135 | ast->codec->channels = 1 + (v&1); |
| 134 | 136 | ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 135 | 137 | 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 | ||
| 177 | 179 | break; |
| 178 | 180 | } |
| 179 | 181 | 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); | |
| 181 | 183 | if (!vst) |
| 182 | 184 | return -1; |
| 185 | + vst->id = -2; /* -2 to avoid clash with video stream and audio stream */ | |
| 183 | 186 | vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 184 | 187 | vst->codec->codec_id = CODEC_ID_MJPEG; |
| 185 | 188 | av_set_pts_info(vst, 64, 256, swf->frame_rate); |
| @@ -626,9 +626,10 @@ static AVStream * new_stream(AVFormatContext *s, AVStream *st, int sid, int code · 625 unmodified lines | ||
| 626 | 626 | WtvStream *wst = av_mallocz(sizeof(WtvStream)); |
| 627 | 627 | if (!wst) |
| 628 | 628 | return NULL; |
| 629 | − st = av_new_stream(s, sid); | |
| 629 | + st = avformat_new_stream(s, NULL); | |
| 630 | 630 | if (!st) |
| 631 | 631 | return NULL; |
| 632 | + st->id = sid; | |
| 632 | 633 | st->priv_data = wst; |
| 633 | 634 | } |
| 634 | 635 | st->codec->codec_type = codec_type; |
| @@ -211,7 +211,7 @@ static int xmv_read_header(AVFormatContext *s, · 210 unmodified lines | ||
| 211 | 211 | av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream " |
| 212 | 212 | "(0x%04X)\n", track->flags); |
| 213 | 213 | |
| 214 | − ast = av_new_stream(s, audio_track); | |
| 214 | + ast = avformat_new_stream(s, NULL); | |
| 215 | 215 | if (!ast) |
| 216 | 216 | return AVERROR(ENOMEM); |
| 217 | 217 | |
| @@ -57,7 +57,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) · 56 unmodified lines | ||
| 57 | 57 | int frame_rate, ret; |
| 58 | 58 | |
| 59 | 59 | audio_stream = avformat_new_stream(s, NULL); |
| 60 | − video_stream = av_new_stream(s, 1); | |
| 60 | + video_stream = avformat_new_stream(s, NULL); | |
| 61 | 61 | |
| 62 | 62 | // Extra data that will be passed to the decoder |
| 63 | 63 | video_stream->codec->extradata_size = 8; |