From 34145ecdad8d6d3b14dc88dafd71b689c68de36c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Fri, 8 Jul 2011 20:53:39 +0200 Subject: [PATCH] vdpau: add implementation of VdpDecoderGetParameters --- src/gallium/state_trackers/vdpau/decode.c | 12 ++++++++++ .../state_trackers/vdpau/vdpau_private.h | 22 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index 4d01fe6a68e..0696278ac3e 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -145,6 +145,18 @@ vlVdpDecoderGetParameters(VdpDecoder decoder, uint32_t *width, uint32_t *height) { + vlVdpDecoder *vldecoder; + + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] decoder get parameters called\n"); + + vldecoder = (vlVdpDecoder *)vlGetDataHTAB(decoder); + if (!vldecoder) + return VDP_STATUS_INVALID_HANDLE; + + *profile = PipeToProfile(vldecoder->decoder->profile); + *width = vldecoder->decoder->width; + *height = vldecoder->decoder->height; + return VDP_STATUS_OK; } diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index 8a97c99bda9..8cf9ca1f4e5 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -171,6 +171,28 @@ ProfileToPipe(VdpDecoderProfile vdpau_profile) } } +static inline VdpDecoderProfile +PipeToProfile(enum pipe_video_profile p_profile) +{ + switch (p_profile) { + case PIPE_VIDEO_PROFILE_MPEG1: + return VDP_DECODER_PROFILE_MPEG1; + case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE: + return VDP_DECODER_PROFILE_MPEG2_SIMPLE; + case PIPE_VIDEO_PROFILE_MPEG2_MAIN: + return VDP_DECODER_PROFILE_MPEG2_MAIN; + case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE: + return VDP_DECODER_PROFILE_H264_BASELINE; + case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN: /* Not defined in p_format.h */ + return VDP_DECODER_PROFILE_H264_MAIN; + case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH: + return VDP_DECODER_PROFILE_H264_HIGH; + default: + assert(0); + return -1; + } +} + typedef struct { Display *display; -- 2.30.2