mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
Use gst_vaapi_decoder_ffmpeg_new_from_caps().
This commit is contained in:
parent
3ed5655535
commit
585a273532
2 changed files with 17 additions and 1 deletions
|
@ -79,6 +79,7 @@ main(int argc, char *argv[])
|
||||||
GstVaapiWindow *window;
|
GstVaapiWindow *window;
|
||||||
GstVaapiDecoder *decoder;
|
GstVaapiDecoder *decoder;
|
||||||
GstCaps *decoder_caps;
|
GstCaps *decoder_caps;
|
||||||
|
GstStructure *structure;
|
||||||
GstVaapiDecoderStatus status;
|
GstVaapiDecoderStatus status;
|
||||||
const CodecDefs *codec;
|
const CodecDefs *codec;
|
||||||
GstVaapiSurfaceProxy *proxy;
|
GstVaapiSurfaceProxy *proxy;
|
||||||
|
@ -111,7 +112,20 @@ main(int argc, char *argv[])
|
||||||
g_error("could not create window");
|
g_error("could not create window");
|
||||||
|
|
||||||
codec->get_video_info(&info);
|
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)
|
if (!decoder)
|
||||||
g_error("could not create FFmpeg decoder");
|
g_error("could not create FFmpeg decoder");
|
||||||
|
|
||||||
|
@ -136,6 +150,7 @@ main(int argc, char *argv[])
|
||||||
pause();
|
pause();
|
||||||
|
|
||||||
g_object_unref(proxy);
|
g_object_unref(proxy);
|
||||||
|
gst_caps_unref(decoder_caps);
|
||||||
g_object_unref(decoder);
|
g_object_unref(decoder);
|
||||||
g_object_unref(window);
|
g_object_unref(window);
|
||||||
g_object_unref(display);
|
g_object_unref(display);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#ifndef TEST_DECODE_H
|
#ifndef TEST_DECODE_H
|
||||||
#define TEST_DECODE_H
|
#define TEST_DECODE_H
|
||||||
|
|
||||||
|
#include <gst/vaapi/gstvaapidisplay.h>
|
||||||
#include <gst/vaapi/gstvaapiprofile.h>
|
#include <gst/vaapi/gstvaapiprofile.h>
|
||||||
|
|
||||||
typedef struct _VideoDecodeInfo VideoDecodeInfo;
|
typedef struct _VideoDecodeInfo VideoDecodeInfo;
|
||||||
|
|
Loading…
Reference in a new issue