[FFmpeg-devel] [PATCH] libavfilter-soc: make ffplay.c:request_input_frame() check for got_frame

Stefano Sabatini stefano.sabatini-lala
Sun Dec 28 17:22:24 CET 2008


On date Thursday 2008-12-25 11:45:26 +0100, Stefano Sabatini encoded:
> Hi,
> 
> get_video_frame() returns 0 if it didn't get any frame, 1 otherwise,
> and input_get_frame() is *requested* to get a frame, patch add a
> check for this.
> 
> Problem discovered when playing MPlayer sample
> MPEG2/res_change_ffmpeg_aspect.ts.
> 
> I'm not sure this is the better way to do it from the intrface point of
> view, maybe a get_video_frame() like this:
> 
> static int get_video_frame(VideoState *is, AVFrame *frame, uint64_t *pts, AVPacket *pkt, int *got_frame)
> 
> would be nicer/more consistent with the rest of libav*, opinions?
> 
> Regards.
> -- 
> FFmpeg = Free and Furious Mysterious Problematic Elastic Gadget

> Index: libavfilter-soc/ffmpeg/ffplay.c
> ===================================================================
> --- libavfilter-soc.orig/ffmpeg/ffplay.c	2008-12-25 11:35:57.000000000 +0100
> +++ libavfilter-soc/ffmpeg/ffplay.c	2008-12-25 11:36:57.000000000 +0100
> @@ -1472,9 +1472,11 @@
>      AVFilterPicRef *picref;
>      uint64_t pts = 0;
>      AVPacket pkt;
> +    int res = 0;
>  
> -    if(get_video_frame(priv->is, priv->frame, &pts, &pkt) < 0)
> -        return -1;
> +    while ((res = get_video_frame(priv->is, priv->frame, &pts, &pkt)) <= 0)
> +        if (res < 0)
> +            return -1;
>  
>      /* FIXME: until I figure out how to hook everything up to the codec
>       * right, we're just copying the entire frame. */

And in attachment another possibility, for which I have a slight
preference, please say which you prefer if any is acceptable.

Regards.
-- 
FFmpeg = Fast and Fostering Martial Power Enhancing God
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check-for-got-frame.patch
Type: text/x-diff
Size: 1697 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081228/43f25181/attachment.patch>



More information about the ffmpeg-devel mailing list