diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-10-20 02:23:36 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-10-20 02:34:51 +0200 |
commit | d0492578c805cfd41673aa2cdadf52efde40e307 (patch) | |
tree | 14fa2c0efa9f3a2c16d946cad36bc10edf0b39f6 /libavformat | |
parent | 9ef714328c9527f67be193a120821048b1fe86b5 (diff) | |
parent | 8096fdf0b6886305ea1a8cb2c869ab2732cd8e11 (diff) | |
download | ffmpeg-d0492578c805cfd41673aa2cdadf52efde40e307.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
presets: rename presets directory
lavc: make avcodec_get_context_defaults3 "officially" public
lavf: replace av_new_stream->avformat_new_stream part II.
lavf,lavd: replace av_new_stream->avformat_new_stream part I.
lavf: add avformat_new_stream as a replacement for av_new_stream.
Use correct scaling table for bwd-pred MVs in second B-field
Ut Video decoder
Makefile: change presets extension to .avpreset
lavfi: add rgbtestsrc source, ported from MPlayer libmpcodecs
lavfi: add testsrc source
AVOptions: add documentation.
presets: update libx264 ffpresets
Conflicts:
Changelog
doc/APIchanges
doc/ffmpeg.texi
ffpresets/libx264-ipod320.ffpreset
ffpresets/libx264-ipod640.ffpreset
ffserver.c
libavcodec/avcodec.h
libavcodec/options.c
libavcodec/version.h
libavdevice/libdc1394.c
libavfilter/avfilter.h
libavfilter/vsrc_testsrc.c
libavformat/flvdec.c
libavformat/riff.c
libavformat/version.h
libavformat/wtv.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
112 files changed, 234 insertions, 178 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c index b95eac71bd..3bb8bbdbdc 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -141,7 +141,7 @@ static int fourxm_read_header(AVFormatContext *s, fourxm->height = AV_RL32(&header[i + 40]); /* allocate a new AVStream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st){ ret= AVERROR(ENOMEM); goto fail; @@ -199,12 +199,13 @@ static int fourxm_read_header(AVFormatContext *s, i += 8 + size; /* allocate a new AVStream */ - st = av_new_stream(s, current_track); + st = avformat_new_stream(s, NULL); if (!st){ ret= AVERROR(ENOMEM); goto fail; } + st->id = current_track; av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate); fourxm->tracks[current_track].stream_index = st->index; diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c index c3a5029260..7df11bf95c 100644 --- a/libavformat/aacdec.c +++ b/libavformat/aacdec.c @@ -66,7 +66,7 @@ static int adts_aac_read_header(AVFormatContext *s, { AVStream *st; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/aea.c b/libavformat/aea.c index 42889b9b90..9fac6c8de6 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -57,7 +57,7 @@ static int aea_read_probe(AVProbeData *p) static int aea_read_header(AVFormatContext *s, AVFormatParameters *ap) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 7586344430..eee9a1c483 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -198,7 +198,7 @@ static int aiff_read_header(AVFormatContext *s, filesize -= 4; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/amr.c b/libavformat/amr.c index 373e454519..8c3b1416c8 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -84,7 +84,7 @@ static int amr_read_header(AVFormatContext *s, avio_read(pb, header, 6); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) { return AVERROR(ENOMEM); diff --git a/libavformat/anm.c b/libavformat/anm.c index 09e7dc7217..99864f6b54 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -97,7 +97,7 @@ static int read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; /* video stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; diff --git a/libavformat/apc.c b/libavformat/apc.c index 19de7f5c30..5d7bb6f31c 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -39,7 +39,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rl32(pb); /* _APC */ avio_rl32(pb); /* 1.20 */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/ape.c b/libavformat/ape.c index cfac93381c..93c22af6a2 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -313,7 +313,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) ape->compressiontype); /* now we are ready: build format streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index eccef6a303..432bf4ebcc 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -505,11 +505,12 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth); /* Create new AVStreams for each stream in this variant */ for (j = 0; j < v->ctx->nb_streams; j++) { - AVStream *st = av_new_stream(s, i); + AVStream *st = avformat_new_stream(s, NULL); if (!st) { ret = AVERROR(ENOMEM); goto fail; } + st->id = i; avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); if (v->bandwidth) av_dict_set(&st->metadata, "variant_bitrate", bitrate_str, diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 2054a32065..e2acd13470 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -224,7 +224,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) pos1 = avio_tell(pb); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ diff --git a/libavformat/assdec.c b/libavformat/assdec.c index e2cebf8875..4f1126cc0e 100644 --- a/libavformat/assdec.c +++ b/libavformat/assdec.c @@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) uint8_t *p, **dst[2]={0}; int pos[2]={0}; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; av_set_pts_info(st, 64, 1, 100); diff --git a/libavformat/au.c b/libavformat/au.c index 477bcdb67f..af00e6d4ff 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -156,7 +156,7 @@ static int au_read_header(AVFormatContext *s, } /* now we are ready: build format streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 9d17869d79..441f85d503 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1402,6 +1402,7 @@ void av_close_input_file(AVFormatContext *s); */ void avformat_free_context(AVFormatContext *s); +#if FF_API_NEW_STREAM /** * Add a new stream to a media file. * @@ -1412,7 +1413,27 @@ void avformat_free_context(AVFormatContext *s); * @param s media file handle * @param id file-format-dependent stream ID */ +attribute_deprecated AVStream *av_new_stream(AVFormatContext *s, int id); +#endif + +/** + * Add a new stream to a media file. + * + * When demuxing, it is called by the demuxer in read_header(). If the + * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also + * be called in read_packet(). + * + * When muxing, should be called by the user before avformat_write_header(). + * + * @param c If non-NULL, the AVCodecContext corresponding to the new stream + * will be initialized to use this codec. This is needed for e.g. codec-specific + * defaults to be set, so codec should be provided if it is known. + * + * @return newly created stream or NULL on error. + */ +AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c); + AVProgram *av_new_program(AVFormatContext *s, int id); /** diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 345d0921d9..2895d89896 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -454,10 +454,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) break; }else{ stream_index++; - st = av_new_stream(s, stream_index); + st = avformat_new_stream(s, NULL); if (!st) goto fail; + st->id = stream_index; ast = av_mallocz(sizeof(AVIStream)); if (!ast) goto fail; diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 32e6d1e7d2..3e7dd46924 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -84,7 +84,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK) continue; - st = av_new_stream(s, id); + st = avformat_new_stream(s, NULL); + st->id = id; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->block_align = wvfmt.nBlockAlign; @@ -110,7 +111,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK) continue; - st = av_new_stream(s, id); + st = avformat_new_stream(s, NULL); + st->id = id; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->r_frame_rate.num = stream->info.dwRate; st->r_frame_rate.den = stream->info.dwScale; diff --git a/libavformat/avs.c b/libavformat/avs.c index ad5ac05988..492cb0b0c6 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -179,7 +179,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) case AVS_VIDEO: if (!avs->st_video) { - avs->st_video = av_new_stream(s, AVS_VIDEO); + avs->st_video = avformat_new_stream(s, NULL); if (avs->st_video == NULL) return AVERROR(ENOMEM); avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO; @@ -196,7 +196,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) case AVS_AUDIO: if (!avs->st_audio) { - avs->st_audio = av_new_stream(s, AVS_AUDIO); + avs->st_audio = avformat_new_stream(s, NULL); if (avs->st_audio == NULL) return AVERROR(ENOMEM); avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 73d0035d34..384ac0144d 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -70,7 +70,7 @@ static int vid_read_header(AVFormatContext *s, avio_skip(pb, 5); vid->nframes = avio_rl16(pb); - stream = av_new_stream(s, 0); + stream = avformat_new_stream(s, NULL); if (!stream) return AVERROR(ENOMEM); av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps @@ -83,7 +83,7 @@ static int vid_read_header(AVFormatContext *s, avio_rl16(pb); // done with video codec, set up audio codec - stream = av_new_stream(s, 0); + stream = avformat_new_stream(s, NULL); if (!stream) return AVERROR(ENOMEM); stream->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 05ace473d0..c6371049c6 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -55,12 +55,12 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) int fps, chunk_header; /* Initialize the video codec... */ - vstream = av_new_stream(s, 0); + vstream = avformat_new_stream(s, NULL); if (!vstream) return AVERROR(ENOMEM); /* Initialize the audio codec... */ - astream = av_new_stream(s, 0); + astream = avformat_new_stream(s, NULL); if (!astream) return AVERROR(ENOMEM); diff --git a/libavformat/bink.c b/libavformat/bink.c index 3cd82ac42f..844498e6f8 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -78,7 +78,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) uint16_t flags; int keyframe; - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); @@ -130,7 +130,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) avio_skip(pb, 4 * bink->num_audio_tracks); for (i = 0; i < bink->num_audio_tracks; i++) { - ast = av_new_stream(s, 1); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/c93.c b/libavformat/c93.c index adfa876e9a..0f4be89545 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -79,7 +79,7 @@ static int read_header(AVFormatContext *s, /* Audio streams are added if audio packets are found */ s->ctx_flags |= AVFMTCTX_NOHEADER; - video = av_new_stream(s, 0); + video = avformat_new_stream(s, NULL); if (!video) return AVERROR(ENOMEM); @@ -117,7 +117,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) datasize = avio_rl16(pb); if (datasize > 42) { if (!c93->audio) { - c93->audio = av_new_stream(s, 1); + c93->audio = avformat_new_stream(s, NULL); if (!c93->audio) return AVERROR(ENOMEM); c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index a1d2ff7988..2b747ce8c4 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -61,7 +61,7 @@ static int read_desc_chunk(AVFormatContext *s) int flags; /* new audio stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/cdg.c b/libavformat/cdg.c index 1453b63b1d..75f1fb24c9 100644 --- a/libavformat/cdg.c +++ b/libavformat/cdg.c @@ -28,7 +28,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *vst; int ret; - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); diff --git a/libavformat/daud.c b/libavformat/daud.c index 34262e010c..aa70800085 100644 --- a/libavformat/daud.c +++ b/libavformat/daud.c @@ -21,7 +21,7 @@ #include "avformat.h" static int daud_header(AVFormatContext *s, AVFormatParameters *ap) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/dfa.c b/libavformat/dfa.c index 12ede0426d..a109a2d2b7 100644 --- a/libavformat/dfa.c +++ b/libavformat/dfa.c @@ -45,7 +45,7 @@ static int dfa_read_header(AVFormatContext *s, avio_skip(pb, 2); // unused frames = avio_rl16(pb); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c index d11e285113..09e80e944f 100644 --- a/libavformat/dsicin.c +++ b/libavformat/dsicin.c @@ -107,7 +107,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) cin->audio_buffer_size = 0; /* initialize the video decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -120,7 +120,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->height = hdr->video_frame_height; /* initialize the audio decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/dv.c b/libavformat/dv.c index f495e1ec6e..f0f007aa53 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -211,7 +211,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame) /* Dynamic handling of the audio streams in DV */ for (i = 0; i < ach; i++) { if (!c->ast[i]) { - c->ast[i] = av_new_stream(c->fctx, 0); + c->ast[i] = avformat_new_stream(c->fctx, NULL); if (!c->ast[i]) break; av_set_pts_info(c->ast[i], 64, 1, 30000); @@ -278,7 +278,7 @@ DVDemuxContext* dv_init_demux(AVFormatContext *s) if (!c) return NULL; - c->vst = av_new_stream(s, 0); + c->vst = avformat_new_stream(s, NULL); if (!c->vst) { av_free(c); return NULL; diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 930ac6f44b..65a61159bc 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -87,7 +87,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) h = avio_rb16(pb); c->has_sound = 0; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; @@ -100,7 +100,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_skip(pb, 16); fsize = avio_rl32(pb); - ast = av_new_stream(s, 0); + ast = avformat_new_stream(s, NULL); if (!ast) return -1; ret = ff_get_wav_header(pb, ast->codec, fsize); diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c index 01acaca35d..adf48c6a19 100644 --- a/libavformat/eacdata.c +++ b/libavformat/eacdata.c @@ -66,7 +66,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) sample_rate = avio_rb16(pb); avio_skip(pb, (avio_r8(pb) & 0x20) ? 15 : 11); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index f561319a2b..0508a06cc4 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -408,7 +408,7 @@ static int ea_read_header(AVFormatContext *s, if (ea->video_codec) { /* initialize the video decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); ea->video_stream_index = st->index; @@ -437,7 +437,7 @@ static int ea_read_header(AVFormatContext *s, } /* initialize the audio decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, ea->sample_rate); diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 5fa2de3dfb..b8cf119cb3 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -295,7 +295,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) for(i=0;i<nb_streams;i++) { char rc_eq_buf[128]; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) goto fail; diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c index 4da9dfdaa6..da4dc04056 100644 --- a/libavformat/ffmetadec.c +++ b/libavformat/ffmetadec.c @@ -132,7 +132,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) get_line(s->pb, line, sizeof(line)); if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return -1; diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index a99dcbad3e..8aa8ee0dee 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -49,7 +49,7 @@ static int read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; } - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index 73308f45f6..7540d33e32 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -31,7 +31,7 @@ static int flac_read_header(AVFormatContext *s, int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0; uint8_t header[4]; uint8_t *buffer=NULL; - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/flic.c b/libavformat/flic.c index bcef1fd663..f4c1a1b9fa 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -105,7 +105,7 @@ static int flic_read_header(AVFormatContext *s, speed = FLIC_DEFAULT_SPEED; /* initialize the decoder streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); flic->video_stream_index = st->index; @@ -145,7 +145,7 @@ static int flic_read_header(AVFormatContext *s, */ if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) { /* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */ - ast = av_new_stream(s, 1); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 00a455a7a8..9791a1924d 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -347,9 +347,10 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) { } static AVStream *create_stream(AVFormatContext *s, int stream_type){ - AVStream *st = av_new_stream(s, stream_type); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return NULL; + st->id = stream_type; switch(stream_type) { case FLV_STREAM_TYPE_VIDEO: st->codec->codec_type = AVMEDIA_TYPE_VIDEO; break; case FLV_STREAM_TYPE_AUDIO: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; break; diff --git a/libavformat/gxf.c b/libavformat/gxf.c index 898dce7eb5..df99310150 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -81,9 +81,10 @@ static int get_sindex(AVFormatContext *s, int id, int format) { i = ff_find_stream_index(s, id); if (i >= 0) return i; - st = av_new_stream(s, id); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); + st->id = id; switch (format) { case 3: case 4: diff --git a/libavformat/idcin.c b/libavformat/idcin.c index 4a972c9aa8..9d28043572 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -153,7 +153,7 @@ static int idcin_read_header(AVFormatContext *s, bytes_per_sample = avio_rl32(pb); channels = avio_rl32(pb); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, IDCIN_FPS); @@ -174,7 +174,7 @@ static int idcin_read_header(AVFormatContext *s, /* if sample rate is 0, assume no audio */ if (sample_rate) { idcin->audio_present = 1; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, IDCIN_FPS); diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 5cc32d2b47..63ba5917a5 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -84,7 +84,7 @@ static int roq_read_header(AVFormatContext *s, roq->audio_frame_count = 0; roq->audio_stream_index = -1; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 63, 1, framerate); @@ -166,7 +166,7 @@ static int roq_read_packet(AVFormatContext *s, case RoQ_SOUND_MONO: case RoQ_SOUND_STEREO: if (roq->audio_stream_index == -1) { - AVStream *st = av_new_stream(s, 1); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE); diff --git a/libavformat/iff.c b/libavformat/iff.c index ebc4798feb..2283ed505a 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -135,7 +135,7 @@ static int iff_read_header(AVFormatContext *s, unsigned transparency = 0; unsigned masking = 0; // no mask - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/img2.c b/libavformat/img2.c index 1e6fb966c6..7b89a9c980 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -220,7 +220,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) s1->ctx_flags |= AVFMTCTX_NOHEADER; - st = av_new_stream(s1, 0); + st = avformat_new_stream(s1, NULL); if (!st) { return AVERROR(ENOMEM); } diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index c5df1f6623..562b19a29c 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -559,7 +559,7 @@ static int ipmovie_read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; /* initialize the stream decoders */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 63, 1, 1000000); @@ -572,7 +572,7 @@ static int ipmovie_read_header(AVFormatContext *s, st->codec->bits_per_coded_sample = ipmovie->video_bpp; if (ipmovie->audio_type) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate); diff --git a/libavformat/iss.c b/libavformat/iss.c index 9a034c6f7f..4b6314d5b9 100644 --- a/libavformat/iss.c +++ b/libavformat/iss.c @@ -88,7 +88,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap) iss->sample_start_pos = avio_tell(pb); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/iv8.c b/libavformat/iv8.c index 1f3dfe2f82..03593982bf 100644 --- a/libavformat/iv8.c +++ b/libavformat/iv8.c @@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c index 58455d02be..cc7687e4da 100644 --- a/libavformat/ivfdec.c +++ b/libavformat/ivfdec.c @@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rl16(s->pb); // version avio_rl16(s->pb); // header size - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index 42aae6f57a..7e1a6ce7b4 100644 --- a/libavformat/jvdec.c +++ b/libavformat/jvdec.c @@ -69,8 +69,8 @@ static int read_header(AVFormatContext *s, avio_skip(pb, 80); - ast = av_new_stream(s, 0); - vst = av_new_stream(s, 1); + ast = avformat_new_stream(s, NULL); + vst = avformat_new_stream(s, NULL); if (!ast || !vst) return AVERROR(ENOMEM); diff --git a/libavformat/libnut.c b/libavformat/libnut.c index 4ed9bb9a17..7628abdfb8 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -213,7 +213,7 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { priv->s = s; for (i = 0; s[i].type != -1 && i < 2; i++) { - AVStream * st = av_new_stream(avf, i); + AVStream * st = avformat_new_stream(avf, NULL); int j; for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8); diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index b965d606ca..96007aa472 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -60,14 +60,14 @@ static int lmlm4_probe(AVProbeData * pd) { static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; - if (!(st = av_new_stream(s, 0))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_MPEG4; st->need_parsing = AVSTREAM_PARSE_HEADERS; av_set_pts_info(st, 64, 1001, 30000); - if (!(st = av_new_stream(s, 1))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_MP2; diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index 0907cb71c0..855e625284 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -217,7 +217,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE) return ret < 0 ? ret : AVERROR_EOF; - if (!(st = av_new_stream(s, 0))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->duration = AV_RL32(&header_data[32]); @@ -243,7 +243,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n"); if ((lxf->channels = (disk_params >> 2) & 0xF)) { - if (!(st = av_new_stream(s, 1))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 8faa3cc167..207c749b82 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1444,7 +1444,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) } } - st = track->stream = av_new_stream(s, 0); + st = track->stream = avformat_new_stream(s, NULL); if (st == NULL) return AVERROR(ENOMEM); @@ -1639,7 +1639,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) attachements[j].bin.data && attachements[j].bin.size > 0)) { av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n"); } else { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (st == NULL) break; av_dict_set(&st->metadata, "filename",attachements[j].filename, 0); diff --git a/libavformat/mm.c b/libavformat/mm.c index 2cca7c965a..3ad47418fc 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -105,7 +105,7 @@ static int read_header(AVFormatContext *s, avio_skip(pb, length - 10); /* unknown data */ /* video stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; @@ -117,7 +117,7 @@ static int read_header(AVFormatContext *s, /* audio stream */ if (length == MM_HEADER_LEN_AV) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 0f64b998da..956f567203 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -241,7 +241,7 @@ static int mmf_read_header(AVFormatContext *s, } mmf->data_size = size; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/mov.c b/libavformat/mov.c index e9f4162e40..fb6003319a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1843,8 +1843,9 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOVStreamContext *sc; int ret; - st = av_new_stream(c->fc, c->fc->nb_streams); + st = avformat_new_stream(c->fc, NULL); if (!st) return AVERROR(ENOMEM); + st->id = c->fc->nb_streams; sc = av_mallocz(sizeof(MOVStreamContext)); if (!sc) return AVERROR(ENOMEM); diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index 7fe7df2609..1210087b70 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -137,7 +137,7 @@ static int mp3_read_header(AVFormatContext *s, AVStream *st; int64_t off; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 8027241b89..f377e1f990 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -84,7 +84,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) c->curbits = 8; c->frames_noted = 0; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 6f722d98f3..22e2adcb1c 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -222,7 +222,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) c->samples = ffio_read_varlen(pb); ffio_read_varlen(pb); //silence samples at the beginning - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 8a79eca14d..5b72c93c2c 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -537,9 +537,10 @@ static int mpegps_read_packet(AVFormatContext *s, goto redo; } /* no stream found: add a new stream */ - st = av_new_stream(s, startcode); + st = avformat_new_stream(s, NULL); if (!st) goto skip; + st->id = startcode; st->codec->codec_type = type; st->codec->codec_id = codec_id; st->request_probe = request_probe; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index ea4c535e24..65cae042be 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -620,12 +620,13 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes, return AVERROR(ENOMEM); memcpy(sub_pes, pes, sizeof(*sub_pes)); - sub_st = av_new_stream(pes->stream, pes->pid); + sub_st = avformat_new_stream(pes->stream, NULL); if (!sub_st) { av_free(sub_pes); return AVERROR(ENOMEM); } + sub_st->id = pes->pid; av_set_pts_info(sub_st, 33, 1, 90000); sub_st->priv_data = sub_pes; sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -726,9 +727,10 @@ static int mpegts_push_data(MpegTSFilter *filter, /* stream not present in PMT */ if (!pes->st) { - pes->st = av_new_stream(ts->stream, pes->pid); + pes->st = avformat_new_stream(ts->stream, NULL); if (!pes->st) return AVERROR(ENOMEM); + pes->st->id = pes->pid; mpegts_set_stream_info(pes->st, pes, 0, 0); } @@ -1120,14 +1122,18 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len /* now create ffmpeg stream */ if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) { pes = ts->pids[pid]->u.pes_filter.opaque; - if (!pes->st) - pes->st = av_new_stream(pes->stream, pes->pid); + if (!pes->st) { + pes->st = avformat_new_stream(pes->stream, NULL); + st->id = pes->pid; + } st = pes->st; } else { if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably pes = add_pes_stream(ts, pid, pcr_pid); - if (pes) - st = av_new_stream(pes->stream, pes->pid); + if (pes) { + st = avformat_new_stream(pes->stream, NULL); + st->id = pes->pid; + } } if (!st) @@ -1594,7 +1600,7 @@ static int mpegts_read_header(AVFormatContext *s, /* only read packets */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) goto fail; av_set_pts_info(st, 60, 1, 27000000); diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c index a08938a9df..b394b8779b 100644 --- a/libavformat/msnwc_tcp.c +++ b/libavformat/msnwc_tcp.c @@ -75,7 +75,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) AVCodecContext *codec; AVStream *st; - st = av_new_stream(ctx, 0); + st = avformat_new_stream(ctx, NULL); if(!st) return AVERROR(ENOMEM); diff --git a/libavformat/mtv.c b/libavformat/mtv.c index 2fa48cc705..966e9bb8b0 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -32,8 +32,6 @@ #define MTV_HEADER_SIZE 512 #define MTV_AUDIO_PADDING_SIZE 12 #define AUDIO_SAMPLING_RATE 44100 -#define VIDEO_SID 0 -#define AUDIO_SID 1 typedef struct MTVDemuxContext { @@ -118,7 +116,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) // video - raw rgb565 - st = av_new_stream(s, VIDEO_SID); + st = avformat_new_stream(s, NULL); if(!st) return AVERROR(ENOMEM); @@ -134,7 +132,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) // audio - mp3 - st = av_new_stream(s, AUDIO_SID); + st = avformat_new_stream(s, NULL); if(!st) return AVERROR(ENOMEM); @@ -171,7 +169,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; pkt->pos -= MTV_AUDIO_PADDING_SIZE; - pkt->stream_index = AUDIO_SID; + pkt->stream_index = 1; }else { @@ -190,7 +188,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) for(i=0;i<mtv->img_segment_size/2;i++) *((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i)); #endif - pkt->stream_index = VIDEO_SID; + pkt->stream_index = 0; } return ret; diff --git a/libavformat/mvi.c b/libavformat/mvi.c index 846af8d911..8586d10e07 100644 --- a/libavformat/mvi.c +++ b/libavformat/mvi.c @@ -42,11 +42,11 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *ast, *vst; unsigned int version, frames_count, msecs_per_frame, player_version; - ast = av_new_stream(s, 0); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 5967df08c6..e1fec3dbbb 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -852,11 +852,12 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) if (!source_track) continue; - st = av_new_stream(mxf->fc, source_track->track_id); + st = avformat_new_stream(mxf->fc, NULL); if (!st) { av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n"); return -1; } + st->id = source_track->track_id; st->priv_data = source_track; st->duration = component->duration; if (st->duration == -1) diff --git a/libavformat/mxg.c b/libavformat/mxg.c index e884311bad..04991b3530 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -24,8 +24,6 @@ #include "avformat.h" #include "avio.h" -#define VIDEO_STREAM_INDEX 0 -#define AUDIO_STREAM_INDEX 1 #define DEFAULT_PACKET_SIZE 1024 #define OVERREAD_SIZE 3 @@ -44,14 +42,14 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap) MXGContext *mxg = s->priv_data; /* video parameters will be extracted from the compressed bitstream */ - video_st = av_new_stream(s, VIDEO_STREAM_INDEX); + video_st = avformat_new_stream(s, NULL); if (!video_st) return AVERROR(ENOMEM); video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO; video_st->codec->codec_id = CODEC_ID_MXPEG; av_set_pts_info(video_st, 64, 1, 1000000); - audio_st = av_new_stream(s, AUDIO_STREAM_INDEX); + audio_st = avformat_new_stream(s, NULL); if (!audio_st) return AVERROR(ENOMEM); audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -166,7 +164,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) } pkt->pts = pkt->dts = mxg->dts; - pkt->stream_index = VIDEO_STREAM_INDEX; + pkt->stream_index = 0; pkt->destruct = NULL; pkt->size = mxg->buffer_ptr - mxg->soi_ptr; pkt->data = mxg->soi_ptr; @@ -204,7 +202,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) if (marker == APP13 && size >= 16) { /* audio data */ /* time (GMT) of first sample in usec since 1970, little-endian */ pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8); - pkt->stream_index = AUDIO_STREAM_INDEX; + pkt->stream_index = 1; pkt->destruct = NULL; pkt->size = size - 14; pkt->data = startmarker_ptr + 16; diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c index e04a6aae31..3430035f3f 100644 --- a/libavformat/ncdec.c +++ b/libavformat/ncdec.c @@ -45,7 +45,7 @@ static int nc_probe(AVProbeData *probe_packet) static int nc_read_header(AVFormatContext *s, AVFormatParameters *ap) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index b3bb31fd22..5de7512f99 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -438,10 +438,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) nsv->vheight = vwidth; if (vtag != T_NONE) { int i; - st = av_new_stream(s, NSV_ST_VIDEO); + st = avformat_new_stream(s, NULL); if (!st) goto fail; + st->id = NSV_ST_VIDEO; nst = av_mallocz(sizeof(NSVStream)); if (!nst) goto fail; @@ -469,10 +470,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) } if (atag != T_NONE) { #ifndef DISABLE_AUDIO - st = av_new_stream(s, NSV_ST_AUDIO); + st = avformat_new_stream(s, NULL); if (!st) goto fail; + st->id = NSV_ST_AUDIO; nst = av_mallocz(sizeof(NSVStream)); if (!nst) goto fail; diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index a9a992aae9..c48f503fbd 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -288,7 +288,7 @@ static int decode_main_header(NUTContext *nut){ nut->stream = av_mallocz(sizeof(StreamContext)*stream_count); for(i=0; i<stream_count; i++){ - av_new_stream(s, i); + avformat_new_stream(s, NULL); } return 0; diff --git a/libavformat/nuv.c b/libavformat/nuv.c index 2444a508c8..caf85b0ef8 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -153,7 +153,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { if (v_packs) { ctx->v_id = stream_nr++; - vst = av_new_stream(s, ctx->v_id); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; @@ -169,7 +169,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { if (a_packs) { ctx->a_id = stream_nr++; - ast = av_new_stream(s, ctx->a_id); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 62dab851fc..8e7653c6b8 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -171,10 +171,11 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream) os->header = -1; if (new_avstream) { - st = av_new_stream(s, idx); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); + st->id = idx; av_set_pts_info(st, 64, 1, 1000000); } diff --git a/libavformat/oma.c b/libavformat/oma.c index 09fa2ca985..eeb920553a 100644 --- a/libavformat/oma.c +++ b/libavformat/oma.c @@ -307,7 +307,7 @@ static int oma_read_header(AVFormatContext *s, codec_params = AV_RB24(&buf[33]); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index 398e44e128..675a4b11df 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -196,7 +196,7 @@ static int str_read_packet(AVFormatContext *s, if(str->channels[channel].video_stream_index < 0){ /* allocate a new AVStream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 64, 1, 15); @@ -244,7 +244,7 @@ static int str_read_packet(AVFormatContext *s, if(str->channels[channel].audio_stream_index < 0){ int fmt = sector[0x13]; /* allocate a new AVStream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/pva.c b/libavformat/pva.c index 1aad6db29d..7e8fa8eb73 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -56,7 +56,7 @@ static int pva_probe(AVProbeData * pd) { static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; - if (!(st = av_new_stream(s, 0))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_MPEG2VIDEO; @@ -64,7 +64,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) { av_set_pts_info(st, 32, 1, 90000); av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME); - if (!(st = av_new_stream(s, 1))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_MP2; diff --git a/libavformat/qcp.c b/libavformat/qcp.c index 4cff63c0ca..c88c39b25d 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -84,7 +84,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVIOContext *pb = s->pb; QCPContext *c = s->priv_data; - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); uint8_t buf[16]; int i, nb_rates; diff --git a/libavformat/r3d.c b/libavformat/r3d.c index d84fd2cc1d..75fc4a4c96 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -52,7 +52,7 @@ static int read_atom(AVFormatContext *s, Atom *atom) static int r3d_read_red1(AVFormatContext *s) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); char filename[258]; int tmp; int av_unused tmp2; @@ -89,7 +89,7 @@ static int r3d_read_red1(AVFormatContext *s) tmp = avio_r8(s->pb); // audio channels av_dlog(s, "audio channels %d\n", tmp); if (tmp > 0) { - AVStream *ast = av_new_stream(s, 1); + AVStream *ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 7726f02708..37e9b0c8f1 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -33,7 +33,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *st; enum CodecID id; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -122,7 +122,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) int ff_raw_audio_read_header(AVFormatContext *s, AVFormatParameters *ap) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -144,7 +144,7 @@ int ff_raw_video_read_header(AVFormatContext *s, int ret = 0; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) { ret = AVERROR(ENOMEM); goto fail; diff --git a/libavformat/rdt.c b/libavformat/rdt.c index bbdb899578..74f9c55fba 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -459,8 +459,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st) { AVStream *st; - if (!(st = av_new_stream(s, orig_st->id))) + if (!(st = avformat_new_stream(s, NULL))) return NULL; + st->id = orig_st->id; st->codec->codec_type = orig_st->codec->codec_type; st->first_dts = orig_st->first_dts; diff --git a/libavformat/riff.c b/libavformat/riff.c index 98f0824cea..7492df7c0b 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -281,10 +281,10 @@ const AVCodecTag ff_codec_bmp_tags[] = { { CODEC_ID_G2M, MKTAG('G', '2', 'M', '3') }, { CODEC_ID_G2M, MKTAG('G', '2', 'M', '4') }, { CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'F') }, + { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'A') }, + { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'G') }, { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '0') }, { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '2') }, - { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'G') }, - { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'A') }, { CODEC_ID_NONE, 0 } }; diff --git a/libavformat/rl2.c b/libavformat/rl2.c index b9f38be390..743250a922 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -110,7 +110,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, def_sound_size = avio_rl16(pb); /** setup video stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if(!st) return AVERROR(ENOMEM); @@ -140,7 +140,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, pts_num = def_sound_size; pts_den = rate; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 131345cdc4..b73b51aaf8 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -397,7 +397,7 @@ static int rm_read_header_old(AVFormatContext *s) AVStream *st; rm->old_format = 1; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; st->priv_data = ff_rm_alloc_rmstream(); @@ -463,7 +463,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) rm_read_metadata(s, 1); break; case MKTAG('M', 'D', 'P', 'R'): - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->id = avio_rb16(pb); diff --git a/libavformat/rpl.c b/libavformat/rpl.c index 009a67f31a..b8214e3604 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -139,7 +139,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) av_dict_set(&s->metadata, "author" , line, 0); // video headers - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; @@ -181,7 +181,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) // samples, though. This code will ignore additional tracks. audio_format = read_line_and_int(pb, &error); // audio format ID if (audio_format) { - ast = av_new_stream(s, 0); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c index a34be80c9d..14adc04b4b 100644 --- a/libavformat/rsodec.c +++ b/libavformat/rsodec.c @@ -54,7 +54,7 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap) } /* now we are ready: build format streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index df7b9957b0..f4590faa08 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -43,7 +43,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, return NULL; rtpctx->oformat = rtp_format; - if (!av_new_stream(rtpctx, 0)) { + if (!avformat_new_stream(rtpctx, NULL)) { av_free(rtpctx); return NULL; } diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index cc47f92e69..11533968eb 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -357,9 +357,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) { /* no corresponding stream */ } else { - st = av_new_stream(s, rt->nb_rtsp_streams - 1); + st = avformat_new_stream(s, NULL); if (!st) return; + st->id = rt->nb_rtsp_streams - 1; rtsp_st->stream_index = st->index; st->codec->codec_type = codec_type; if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) { diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index 5351e9883d..68e3c5c095 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -163,11 +163,12 @@ static int sap_read_header(AVFormatContext *s, if (sap->sdp_ctx->ctx_flags & AVFMTCTX_NOHEADER) s->ctx_flags |= AVFMTCTX_NOHEADER; for (i = 0; i < sap->sdp_ctx->nb_streams; i++) { - AVStream *st = av_new_stream(s, i); + AVStream *st = avformat_new_stream(s, NULL); if (!st) { ret = AVERROR(ENOMEM); goto fail; } + st->id = i; avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec); st->time_base = sap->sdp_ctx->streams[i]->time_base; } @@ -211,11 +212,12 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt) if (s->ctx_flags & AVFMTCTX_NOHEADER) { while (sap->sdp_ctx->nb_streams > s->nb_streams) { int i = s->nb_streams; - AVStream *st = av_new_stream(s, i); + AVStream *st = avformat_new_stream(s, NULL); if (!st) { av_free_packet(pkt); return AVERROR(ENOMEM); } + st->id = i; avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec); st->time_base = sap->sdp_ctx->streams[i]->time_base; } diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 15234c70d6..1ae105eb77 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -134,7 +134,7 @@ static int film_read_header(AVFormatContext *s, /* initialize the decoder streams */ if (film->video_type) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); film->video_stream_index = st->index; @@ -146,7 +146,7 @@ static int film_read_header(AVFormatContext *s, } if (film->audio_type) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); film->audio_stream_index = st->index; diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index 3b9a9a163d..e1367c29ae 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -104,7 +104,7 @@ static int vmd_read_header(AVFormatContext *s, else vmd->is_indeo3 = 0; /* start up the decoders */ - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); av_set_pts_info(vst, 33, 1, 10); @@ -125,7 +125,7 @@ static int vmd_read_header(AVFormatContext *s, /* if sample rate is 0, assume no audio */ vmd->sample_rate = AV_RL16(&vmd->vmd_header[804]); if (vmd->sample_rate) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); vmd->audio_stream_index = st->index; diff --git a/libavformat/siff.c b/libavformat/siff.c index d39655f648..77cbc66804 100644 --- a/libavformat/siff.c +++ b/libavformat/siff.c @@ -71,7 +71,7 @@ static int siff_probe(AVProbeData *p) static int create_audio_stream(AVFormatContext *s, SIFFContext *c) { AVStream *ast; - ast = av_new_stream(s, 0); + ast = avformat_new_stream(s, NULL); if (!ast) return -1; ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -115,7 +115,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) avio_skip(pb, 16); //zeroes - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; diff --git a/libavformat/smacker.c b/libavformat/smacker.c index c2239b2845..3ffb65eee0 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -154,7 +154,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) } /* init video codec */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; smk->videoindex = st->index; @@ -177,7 +177,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) for(i = 0; i < 7; i++) { smk->indexes[i] = -1; if (smk->rates[i]) { - ast[i] = av_new_stream(s, 0); + ast[i] = avformat_new_stream(s, NULL); smk->indexes[i] = ast[i]->index; ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO; if (smk->aflags[i] & SMK_AUD_BINKAUD) { diff --git a/libavformat/sol.c b/libavformat/sol.c index 1389128fa6..cd5b2d75a4 100644 --- a/libavformat/sol.c +++ b/libavformat/sol.c @@ -110,7 +110,7 @@ static int sol_read_header(AVFormatContext *s, else id = 0; /* now we are ready: build format streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index af8cfef1ba..dac4bedfb3 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -51,7 +51,7 @@ static int sox_read_header(AVFormatContext *s, double sample_rate, sample_rate_frac; AVStream *st; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index 64960ffbdd..13ec2f0ebf 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -205,7 +205,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) if (!s->nb_streams) { /* first packet, create a stream */ - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) { av_free_packet(pkt); return AVERROR(ENOMEM); diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index 0a94a7f518..2828cc7af3 100644 --- a/libavformat/srtdec.c +++ b/libavformat/srtdec.c @@ -42,7 +42,7 @@ static int srt_probe(AVProbeData *p) static int srt_read_header(AVFormatContext *s, AVFormatParameters *ap) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return -1; av_set_pts_info(st, 64, 1, 1000); diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index e6f659b8d0..175e40ee19 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -106,9 +106,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) avio_rl16(pb); avio_r8(pb); /* Check for FLV1 */ - vst = av_new_stream(s, ch_id); + vst = avformat_new_stream(s, NULL); if (!vst) return -1; + vst->id = ch_id; vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb)); av_set_pts_info(vst, 16, 256, swf->frame_rate); @@ -127,9 +128,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) avio_r8(pb); v = avio_r8(pb); swf->samples_per_frame = avio_rl16(pb); - ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */ + ast = avformat_new_stream(s, NULL); if (!ast) return -1; + ast->id = -1; /* -1 to avoid clash with video stream ch_id */ ast->codec->channels = 1 + (v&1); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; 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) break; } if (i == s->nb_streams) { - vst = av_new_stream(s, -2); /* -2 to avoid clash with video stream and audio stream */ + vst = avformat_new_stream(s, NULL); if (!vst) return -1; + vst->id = -2; /* -2 to avoid clash with video stream and audio stream */ vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_MJPEG; av_set_pts_info(vst, 64, 256, swf->frame_rate); diff --git a/libavformat/thp.c b/libavformat/thp.c index 17054df78c..e2aba3bc32 100644 --- a/libavformat/thp.c +++ b/libavformat/thp.c @@ -94,7 +94,7 @@ static int thp_read_header(AVFormatContext *s, break; /* Video component. */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -117,7 +117,7 @@ static int thp_read_header(AVFormatContext *s, break; /* Audio component. */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c index d8bdf2a97c..dfed70ceae 100644 --- a/libavformat/tiertexseq.c +++ b/libavformat/tiertexseq.c @@ -206,7 +206,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) seq->audio_buffer_full = 0; /* initialize the video decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -219,7 +219,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->height = SEQ_FRAME_H; /* initialize the audio decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/tmv.c b/libavformat/tmv.c index 3fce1e8bf0..03d6e08f0e 100644 --- a/libavformat/tmv.c +++ b/libavformat/tmv.c @@ -73,10 +73,10 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) if (avio_rl32(pb) != TMV_TAG) return -1; - if (!(vst = av_new_stream(s, 0))) + if (!(vst = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); - if (!(ast = av_new_stream(s, 0))) + if (!(ast = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); ast->codec->sample_rate = avio_rl16(pb); diff --git a/libavformat/tta.c b/libavformat/tta.c index 23e54b2fda..ca2d36b44f 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -77,7 +77,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/tty.c b/libavformat/tty.c index 913ec457da..5c9fee7908 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -76,7 +76,7 @@ static int read_header(AVFormatContext *avctx, { TtyDemuxContext *s = avctx->priv_data; int width = 0, height = 0, ret = 0; - AVStream *st = av_new_stream(avctx, 0); + AVStream *st = avformat_new_stream(avctx, NULL); AVRational framerate; if (!st) { diff --git a/libavformat/txd.c b/libavformat/txd.c index 6928216791..5d9f969270 100644 --- a/libavformat/txd.c +++ b/libavformat/txd.c @@ -40,7 +40,7 @@ static int txd_probe(AVProbeData * pd) { static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; diff --git a/libavformat/utils.c b/libavformat/utils.c index d1fdef29c3..f00b1cb9c7 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2762,8 +2762,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; @@ -2783,13 +2793,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 diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index 5742155a25..ed72119188 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -54,7 +54,7 @@ static int vc1t_read_header(AVFormatContext *s, return -1; /* init video codec */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; diff --git a/libavformat/version.h b/libavformat/version.h index 1f36544b70..333a3a0125 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,8 +24,8 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 53 -#define LIBAVFORMAT_VERSION_MINOR 16 -#define LIBAVFORMAT_VERSION_MICRO 1 +#define LIBAVFORMAT_VERSION_MINOR 17 +#define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ @@ -98,5 +98,8 @@ #ifndef FF_API_RTSP_URL_OPTIONS #define FF_API_RTSP_URL_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 54) #endif +#ifndef FF_API_NEW_STREAM +#define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif /* AVFORMAT_VERSION_H */ diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index fed7c6d6e3..6ee8d33964 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -52,7 +52,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(ENOSYS); } avio_skip(pb, header_size); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/vqf.c b/libavformat/vqf.c index 1be5931ad9..1530128f4a 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -64,7 +64,7 @@ static void add_metadata(AVFormatContext *s, const char *tag, static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) { VqfContext *c = s->priv_data; - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); int chunk_tag; int rate_flag = -1; int header_size; diff --git a/libavformat/wav.c b/libavformat/wav.c index bd8c847e85..b690cc1a8f 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -280,7 +280,7 @@ static int wav_parse_fmt_tag(AVFormatContext *s, int64_t size, AVStream **st) int ret; /* parse fmt header */ - *st = av_new_stream(s, 0); + *st = avformat_new_stream(s, NULL); if (!*st) return AVERROR(ENOMEM); @@ -726,7 +726,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 8bba572f4e..9190a1a035 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -163,7 +163,7 @@ static int wc3_read_header(AVFormatContext *s, } while (fourcc_tag != BRCH_TAG); /* initialize the decoder streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); @@ -174,7 +174,7 @@ static int wc3_read_header(AVFormatContext *s, st->codec->width = wc3->width; st->codec->height = wc3->height; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); diff --git a/libavformat/westwood.c b/libavformat/westwood.c index 6b5fd51141..95aba13354 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -144,7 +144,7 @@ static int wsaud_read_header(AVFormatContext *s, wsaud->audio_bits = (((header[10] & 0x2) >> 1) + 1) * 8; /* initialize the audio decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, wsaud->audio_samplerate); @@ -221,7 +221,7 @@ static int wsvqa_read_header(AVFormatContext *s, unsigned int chunk_size; /* initialize the video decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, VQA_FRAMERATE); @@ -247,7 +247,7 @@ static int wsvqa_read_header(AVFormatContext *s, /* initialize the audio decoder stream for VQA v1 or nonzero samplerate */ if (AV_RL16(&header[24]) || (AV_RL16(&header[0]) == 1 && AV_RL16(&header[2]) == 1)) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, VQA_FRAMERATE); diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index af0b711a0a..88587c4b52 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -414,7 +414,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) if (!filesize) goto done; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) goto done; av_dict_set(&st->metadata, "title", description, 0); @@ -562,9 +562,10 @@ static AVStream * new_stream(AVFormatContext *s, AVStream *st, int sid, int code WtvStream *wst = av_mallocz(sizeof(WtvStream)); if (!wst) return NULL; - st = av_new_stream(s, sid); + st = avformat_new_stream(s, NULL); if (!st) return NULL; + st->id = sid; st->priv_data = wst; } st->codec->codec_type = codec_type; diff --git a/libavformat/wv.c b/libavformat/wv.c index e995e51bb9..72c8df0f24 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -220,7 +220,7 @@ static int wv_read_header(AVFormatContext *s, } /* now we are ready: build format streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/xa.c b/libavformat/xa.c index de94447622..dd7811dd91 100644 --- a/libavformat/xa.c +++ b/libavformat/xa.c @@ -70,7 +70,7 @@ static int xa_read_header(AVFormatContext *s, AVStream *st; /*Set up the XA Audio Decoder*/ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/xmv.c b/libavformat/xmv.c index 9c17a14fa1..aeafcb6904 100644 --- a/libavformat/xmv.c +++ b/libavformat/xmv.c @@ -147,7 +147,7 @@ static int xmv_read_header(AVFormatContext *s, /* Video track */ - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); @@ -202,7 +202,7 @@ static int xmv_read_header(AVFormatContext *s, av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream " "(0x%04X)\n", packet->flags); - ast = av_new_stream(s, audio_track); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); diff --git a/libavformat/xwma.c b/libavformat/xwma.c index 9e100b1b0b..94208abc47 100644 --- a/libavformat/xwma.c +++ b/libavformat/xwma.c @@ -69,7 +69,7 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap) if (tag != MKTAG('f', 'm', 't', ' ')) return -1; size = avio_rl32(pb); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/yop.c b/libavformat/yop.c index 9e548f0d66..8cadf125a2 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -56,8 +56,8 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) int frame_rate, ret; - audio_stream = av_new_stream(s, 0); - video_stream = av_new_stream(s, 1); + audio_stream = avformat_new_stream(s, NULL); + video_stream = avformat_new_stream(s, NULL); // Extra data that will be passed to the decoder video_stream->codec->extradata_size = 8; diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index a7f55b414a..97d2261a93 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -333,7 +333,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap) aspectd = 1; } - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if(!st) return AVERROR(ENOMEM); st->codec->width = width; |