On Fri, 11 Jan 2013 23:27:59 +0200, Rémi Denis-Courmont <[email protected]> wrote:
> ---
>  libavcodec/vdpau.c          |   49 ++++++++++++++++++++++++++++++
>  libavcodec/vdpau.h          |   69 
> +++++++++++++++++++++++++++++++++++++++----
>  libavcodec/vdpau_internal.h |   15 ++++++++++
>  3 files changed, 127 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
> index 6daf494..9aaa79c 100644
> --- a/libavcodec/vdpau.c
> +++ b/libavcodec/vdpau.c
> @@ -38,6 +38,55 @@
>   * @{
>   */
>  
> +int ff_vdpau_common_start_frame(AVCodecContext *avctx,
> +                                av_unused const uint8_t *buffer,
> +                                av_unused uint32_t size)
> +{
> +    struct vdpau_context *hwctx = avctx->hwaccel_context;
> +
> +    hwctx->bitstream_buffers_used = 0;
> +    return 0;
> +}
> +
> +int ff_vdpau_common_end_frame(AVCodecContext *avctx)
> +{
> +    MpegEncContext * const s = avctx->priv_data;
> +    struct vdpau_context *hwctx = avctx->hwaccel_context;
> +
> +    if (hwctx->bitstream_buffers_used) {
> +        VdpVideoSurface surf = 
> ff_vdpau_get_surface_id(s->current_picture_ptr);
> +
> +        hwctx->render(hwctx->decoder, surf, (void *)&hwctx->info,
> +                      hwctx->bitstream_buffers_used, 
> hwctx->bitstream_buffers);
> +
> +        ff_draw_horiz_band(s, 0, s->avctx->height);
> +        hwctx->bitstream_buffers_used = 0;
> +    }
> +    return 0;
> +}
> +
> +int ff_vdpau_add_buffer(AVCodecContext *avctx,
> +                        const uint8_t *buf, uint32_t size)
> +{
> +    struct vdpau_context *hwctx = avctx->hwaccel_context;
> +    VdpBitstreamBuffer *buffers = hwctx->bitstream_buffers;
> +
> +    buffers = av_fast_realloc(buffers, &hwctx->bitstream_buffers_allocated,
> +                              (hwctx->bitstream_buffers_used + 1) * 
> sizeof(*buffers));
> +    if (!buffers)
> +        return AVERROR(ENOMEM);
> +
> +    hwctx->bitstream_buffers = buffers;
> +    buffers += hwctx->bitstream_buffers_used++;
> +
> +    buffers->struct_version  = VDP_BITSTREAM_BUFFER_VERSION;
> +    buffers->bitstream       = buf;
> +    buffers->bitstream_bytes = size;
> +    return 0;
> +}
> +
> +/* Obsolete non-hwaccel VDPAU support below... */
> +
>  void ff_vdpau_h264_set_reference_frames(MpegEncContext *s)
>  {
>      H264Context *h = s->avctx->priv_data;
> diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h
> index 241ff19..c609b89 100644
> --- a/libavcodec/vdpau.h
> +++ b/libavcodec/vdpau.h
> @@ -52,6 +52,68 @@
>  #include <vdpau/vdpau.h>
>  #include <vdpau/vdpau_x11.h>
>  
> +union VdpPictureInfo {
> +    VdpPictureInfoH264        h264;
> +    VdpPictureInfoMPEG1Or2    mpeg;
> +    VdpPictureInfoVC1          vc1;
> +    VdpPictureInfoMPEG4Part2 mpeg4;
> +};
> +
> +/**
> + * This structure is used to share data between the libavcodec library and
> + * the client video application.
> + * This shall be zero-allocated and available as
                    ^^^^^^^^^^^^^^
by whom? lavc? please mention that in the doxy.

> + * AVCodecContext.hwaccel_context. All user members can be set once
> + * during initialization or through each AVCodecContext.get_buffer()
> + * function call. In any case, they must be valid prior to calling
> + * decoding functions.
> + */
> +typedef struct vdpau_context {

The convention used in the rest of libav is that the struct name is the same as
the typedeffed name.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to