Use gst_vaapi_decoder_ffmpeg_new_from_caps().
authorgb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969>
Mon, 3 May 2010 16:54:23 +0000 (16:54 +0000)
committerGwenole Beauchesne <gbeauchesne@splitted-desktop.com>
Mon, 20 Sep 2010 10:55:43 +0000 (12:55 +0200)
tests/test-decode.c
tests/test-decode.h

index 0fea750..c5f7f91 100644 (file)
@@ -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);
index 0ef55cc..6d9aa2b 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef TEST_DECODE_H
 #define TEST_DECODE_H
 
+#include <gst/vaapi/gstvaapidisplay.h>
 #include <gst/vaapi/gstvaapiprofile.h>
 
 typedef struct _VideoDecodeInfo VideoDecodeInfo;