summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/va/context.c
diff options
context:
space:
mode:
authorChristian König <[email protected]>2014-09-18 11:57:46 -0400
committerLeo Liu <[email protected]>2014-10-01 13:21:36 -0400
commit7913c8943a1d1dd1b3f77f34bb4b0108a10a1d20 (patch)
treee925a4235edcab230eb1056aa9138ae743f913cd /src/gallium/state_trackers/va/context.c
parent1be55158381f509d420e42f40018ec95fe329f5b (diff)
st/va: implement Picture functions for mpeg2 h264 and vc1
This patch implements codec for mpeg2 h264 and vc1, populates codec parameters and pass them to HW driver. Signed-off-by: Christian König <[email protected]> Signed-off-by: Leo Liu <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/va/context.c')
-rw-r--r--src/gallium/state_trackers/va/context.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c
index b50429484db..1819ec56289 100644
--- a/src/gallium/state_trackers/va/context.c
+++ b/src/gallium/state_trackers/va/context.c
@@ -31,6 +31,7 @@
#include "util/u_memory.h"
#include "util/u_handle_table.h"
+#include "util/u_video.h"
#include "vl/vl_winsys.h"
#include "va_private.h"
@@ -172,6 +173,21 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width,
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
+ if (u_reduce_video_profile(context->decoder->profile) ==
+ PIPE_VIDEO_FORMAT_MPEG4_AVC) {
+ context->desc.h264.pps = CALLOC_STRUCT(pipe_h264_pps);
+ if (!context->desc.h264.pps) {
+ FREE(context);
+ return VA_STATUS_ERROR_ALLOCATION_FAILED;
+ }
+ context->desc.h264.pps->sps = CALLOC_STRUCT(pipe_h264_sps);
+ if (!context->desc.h264.pps->sps) {
+ FREE(context->desc.h264.pps);
+ FREE(context);
+ return VA_STATUS_ERROR_ALLOCATION_FAILED;
+ }
+ }
+
context->desc.base.profile = config_id;
*context_id = handle_table_add(drv->htab, context);
@@ -189,6 +205,11 @@ vlVaDestroyContext(VADriverContextP ctx, VAContextID context_id)
drv = VL_VA_DRIVER(ctx);
context = handle_table_get(drv->htab, context_id);
+ if (u_reduce_video_profile(context->decoder->profile) ==
+ PIPE_VIDEO_FORMAT_MPEG4_AVC) {
+ FREE(context->desc.h264.pps->sps);
+ FREE(context->desc.h264.pps);
+ }
context->decoder->destroy(context->decoder);
FREE(context);