[FFmpeg-devel] [PATCH] ffprobe: add support to audio frame information printing
Clément Bœsch
ubitux at gmail.com
Thu Jan 12 03:43:09 CET 2012
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.
Note: a -only:[av] option would be nice to filter only audio or video
frames.
--
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/20120112/bc2747b5/attachment.asc>
More information about the ffmpeg-devel
mailing list