[FFmpeg-devel] [PATCH] ffprobe: add support to audio frame information printing

Stefano Sabatini stefasab at gmail.com
Thu Jan 12 17:38:26 CET 2012


On date Thursday 2012-01-12 10:49:19 +0100, Stefano Sabatini encoded:
> On date Thursday 2012-01-12 03:43:09 +0100, Clément Bœsch encoded:
> > On Wed, Jan 11, 2012 at 12:43:13PM +0100, Stefano Sabatini wrote:
> > [...]
> > > > >  static void show_packets(WriterContext *w, AVFormatContext *fmt_ctx)
> > > > >  {
> > > > > -    AVPacket pkt;
> > > > > +    AVPacket pkt, pkt1;
> > > > >      AVFrame frame;
> > > > > -    int i = 0;
> > > > > +    int i = 0, ret, got_frame;
> > > > >  
> > > > >      av_init_packet(&pkt);
> > > > >  
> > > > >      while (!av_read_frame(fmt_ctx, &pkt)) {
> > > > >          if (do_show_packets)
> > > > >              show_packet(w, fmt_ctx, &pkt, i++);
> > > > > -        if (do_show_frames &&
> > > > > -            get_video_frame(fmt_ctx, &frame, &pkt)) {
> > > > > -            show_frame(w, &frame, fmt_ctx->streams[pkt.stream_index]);
> > > > > +        if (do_show_frames) {
> > > > > +            pkt1 = pkt;
> > > > > +            while (1) {
> > > > > +                ret = get_decoded_frame(fmt_ctx, &frame, &got_frame, &pkt1);
> > > > > +                if (ret < 0 || !got_frame)
> > > > > +                    break;
> > > > 
> > > 
> > > > I'm not sure, but I think the API needs you to deal with the special case
> > > > of ret < 0. See 220481e1d6582277ae4c02b05f87251a8670e6cc for instance. I
> > > > can look for a sample to confirm this if you need one.
> > > 
> > > Should not be necessary since the packet is just dropped in case ret <
> > > 0, and no more processing is done with it, but testing with a sample
> > > can't hurt.
> > > 
> > 
> > Confirmed with a sample here, it's OK.
> 
> Updated, crash with MP3 files should be fixed now.

Pushed.
-- 
FFmpeg = Fundamentalist and Frightening Mythic Perennial Exuberant Gadget


More information about the ffmpeg-devel mailing list