From 585a273532261a1349a04be5f569e1e8f215d49c Mon Sep 17 00:00:00 2001 From: gb Date: Mon, 3 May 2010 16:54:23 +0000 Subject: [PATCH] Use gst_vaapi_decoder_ffmpeg_new_from_caps(). --- tests/test-decode.c | 17 ++++++++++++++++- tests/test-decode.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/test-decode.c b/tests/test-decode.c index 0fea750..c5f7f91 100644 --- a/tests/test-decode.c +++ b/tests/test-decode.c @@ -79,6 +79,7 @@ main(int argc, char *argv[]) GstVaapiWindow *window; GstVaapiDecoder *decoder; GstCaps *decoder_caps; + GstStructure *structure; GstVaapiDecoderStatus status; const CodecDefs *codec; GstVaapiSurfaceProxy *proxy; @@ -111,7 +112,20 @@ main(int argc, char *argv[]) g_error("could not create window"); codec->get_video_info(&info); - decoder = gst_vaapi_decoder_ffmpeg_new(display, gst_vaapi_profile_get_codec(info.profile), NULL); + decoder_caps = gst_vaapi_profile_get_caps(info.profile); + if (!decoder_caps) + g_error("could not create decoder caps"); + + structure = gst_caps_get_structure(decoder_caps, 0); + if (info.width > 0 && info.height > 0) + gst_structure_set( + structure, + "width", G_TYPE_INT, info.width, + "height", G_TYPE_INT, info.height, + NULL + ); + + decoder = gst_vaapi_decoder_ffmpeg_new_from_caps(display, decoder_caps); if (!decoder) g_error("could not create FFmpeg decoder"); @@ -136,6 +150,7 @@ main(int argc, char *argv[]) pause(); g_object_unref(proxy); + gst_caps_unref(decoder_caps); g_object_unref(decoder); g_object_unref(window); g_object_unref(display); diff --git a/tests/test-decode.h b/tests/test-decode.h index 0ef55cc..6d9aa2b 100644 --- a/tests/test-decode.h +++ b/tests/test-decode.h @@ -21,6 +21,7 @@ #ifndef TEST_DECODE_H #define TEST_DECODE_H +#include #include typedef struct _VideoDecodeInfo VideoDecodeInfo; -- 2.7.4