[FFmpeg-devel] [PATCH 2/4] Replace remaining av_new_stream() with avformat_new_stream().

Clément Bœsch ubitux at gmail.com
Sat Nov 5 15:05:19 CET 2011


On Sat, Nov 05, 2011 at 02:03:52PM +0100, Michael Niedermayer wrote:
> On Sat, Nov 05, 2011 at 01:30:50PM +0100, Clément Bœsch wrote:
> > ---
> >  doc/examples/muxing.c     |    3 ++-
> >  libavdevice/dshow.c       |    3 ++-
> >  libavdevice/lavfi.c       |    3 ++-
> >  libavdevice/openal-dec.c  |    2 +-
> >  libavformat/act.c         |    2 +-
> >  libavformat/bintext.c     |    2 +-
> >  libavformat/g723_1.c      |    2 +-
> >  libavformat/libmodplug.c  |    4 ++--
> >  libavformat/loasdec.c     |    2 +-
> >  libavformat/microdvddec.c |    2 +-
> >  libavformat/pmpdec.c      |    5 +++--
> >  libavformat/wav.c         |    3 ++-
> >  12 files changed, 19 insertions(+), 14 deletions(-)
> > 
> > diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
> > index 0cdc895..1a78b86 100644
> > --- a/doc/examples/muxing.c
> > +++ b/doc/examples/muxing.c
> > @@ -64,7 +64,8 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
> >      AVCodecContext *c;
> >      AVStream *st;
> >  
> > -    st = av_new_stream(oc, 1);
> > +    st = avformat_new_stream(oc, NULL);
> > +    st->id = 1;
> >      if (!st) {
> >          fprintf(stderr, "Could not alloc stream\n");
> 
> the if(!st) should be before the st->anything
> 

Oups, fixed locally.

> 
> [...]
> > @@ -231,7 +231,7 @@ static int modplug_read_header(AVFormatContext *s, AVFormatParameters *ap)
> >      modplug->ts_per_packet = 1000*AUDIO_PKT_SIZE / (4*44100.);
> >  
> >      if (modplug->video_stream) {
> > -        AVStream *vst = av_new_stream(s, 1);
> > +        AVStream *vst = avformat_new_stream(s, NULL);
> >          if (!vst)
> >              return AVERROR(ENOMEM);
> >          av_set_pts_info(vst, 64, 1, 1000);
> 
> this looses a id=1
> 

It's fine anyway, nb_streams is incremented after the first
avformat_new_stream (creating the audio stream) and used to defined the id
in that second call.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111105/630f39c1/attachment.asc>


More information about the ffmpeg-devel mailing list