[FFmpeg-devel] [PATCH 4/4] lavd/xv: preliminary support of uncoded frame.

Michael Niedermayer michaelni at gmx.at
Wed Jan 8 20:34:54 CET 2014


On Wed, Jan 01, 2014 at 01:27:08PM +0100, Nicolas George wrote:
> 
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>  libavdevice/xv.c |   27 +++++++++++++++++++++------
>  1 file changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/libavdevice/xv.c b/libavdevice/xv.c
> index a4b44c8..6378d66 100644
> --- a/libavdevice/xv.c
> +++ b/libavdevice/xv.c
> @@ -197,23 +197,19 @@ static int xv_write_header(AVFormatContext *s)
>      return ret;
>  }
>  
> -static int xv_write_packet(AVFormatContext *s, AVPacket *pkt)
> +static int write_picture(AVFormatContext *s, AVPicture *pict)
>  {
>      XVContext *xv = s->priv_data;
>      XvImage *img = xv->yuv_image;
>      XWindowAttributes window_attrs;
> -    AVPicture pict;
> -    AVCodecContext *ctx = s->streams[0]->codec;
>      uint8_t *data[3] = {
>          img->data + img->offsets[0],
>          img->data + img->offsets[1],
>          img->data + img->offsets[2]
>      };
>  
> -    avpicture_fill(&pict, pkt->data, ctx->pix_fmt, ctx->width, ctx->height);
> -    av_image_copy(data, img->pitches, (const uint8_t **)pict.data, pict.linesize,
> +    av_image_copy(data, img->pitches, (const uint8_t **)pict->data, pict->linesize,
>                    xv->image_format, img->width, img->height);
> -
>      XGetWindowAttributes(xv->display, xv->window, &window_attrs);
>      if (XvShmPutImage(xv->display, xv->xv_port, xv->window, xv->gc,
>                        xv->yuv_image, 0, 0, xv->image_width, xv->image_height, 0, 0,

> @@ -224,6 +220,24 @@ static int xv_write_packet(AVFormatContext *s, AVPacket *pkt)
>      return 0;
>  }
>  
> +static int xv_write_packet(AVFormatContext *s, AVPacket *pkt)
> +{
> +    AVPicture pict;
> +    AVCodecContext *ctx = s->streams[0]->codec;
> +
> +    avpicture_fill(&pict, pkt->data, ctx->pix_fmt, ctx->width, ctx->height);
> +    return write_picture(s, &pict);
> +}
> +
> +static int xv_write_frame(AVFormatContext *s, int stream_index, AVFrame *frame,
> +                          unsigned flags)
> +{
> +    /* xv_write_header() should have accepted only supported formats */
> +    if ((flags & AV_WRITE_UNCODED_FRAME_QUERY))
> +        return 0;
> +    return write_picture(s, (AVPicture *)frame);
> +}

it should not be needed to implement both

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140108/79e22c23/attachment.asc>


More information about the ffmpeg-devel mailing list