mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
msdkdec: Enable dynamic capability support
Enable dynamic capability support for msdkav1dec, msdkh264dec, msdkh265dec, msdkmjpegdec, msdkmpeg2dec, msdkvc1dec, msdkvp8dec, msdkvp9dec. The gstmsdkdec elements can create the sink caps and src caps dynamically for different platforms. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4177>
This commit is contained in:
parent
aa59d9828f
commit
bfbde5ce22
19 changed files with 683 additions and 365 deletions
|
@ -156,46 +156,48 @@ _register_encoder (GstPlugin * plugin,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_register_decoder (GstPlugin * plugin, guint codec_id)
|
||||
_register_decoder (GstPlugin * plugin,
|
||||
GstMsdkContext * context, guint codec_id,
|
||||
GstCaps * sink_caps, GstCaps * src_caps)
|
||||
{
|
||||
gboolean ret = TRUE;
|
||||
|
||||
switch (codec_id) {
|
||||
case MFX_CODEC_AVC:
|
||||
ret = gst_element_register (plugin, "msdkh264dec", GST_RANK_NONE,
|
||||
GST_TYPE_MSDKH264DEC);
|
||||
ret = gst_msdkh264dec_register (plugin,
|
||||
context, sink_caps, src_caps, GST_RANK_NONE);
|
||||
break;
|
||||
case MFX_CODEC_HEVC:
|
||||
ret = gst_element_register (plugin, "msdkh265dec", GST_RANK_NONE,
|
||||
GST_TYPE_MSDKH265DEC);
|
||||
ret = gst_msdkh265dec_register (plugin,
|
||||
context, sink_caps, src_caps, GST_RANK_NONE);
|
||||
break;
|
||||
case MFX_CODEC_MPEG2:
|
||||
ret = gst_element_register (plugin, "msdkmpeg2dec", GST_RANK_NONE,
|
||||
GST_TYPE_MSDKMPEG2DEC);
|
||||
ret = gst_msdkmpeg2dec_register (plugin,
|
||||
context, sink_caps, src_caps, GST_RANK_NONE);
|
||||
break;
|
||||
case MFX_CODEC_VP8:
|
||||
ret = gst_element_register (plugin, "msdkvp8dec", GST_RANK_NONE,
|
||||
GST_TYPE_MSDKVP8DEC);
|
||||
ret = gst_msdkvp8dec_register (plugin,
|
||||
context, sink_caps, src_caps, GST_RANK_NONE);
|
||||
break;
|
||||
#ifdef USE_MSDK_VP9_DEC
|
||||
case MFX_CODEC_VP9:
|
||||
ret = gst_element_register (plugin, "msdkvp9dec", GST_RANK_NONE,
|
||||
GST_TYPE_MSDKVP9DEC);
|
||||
ret = gst_msdkvp9dec_register (plugin,
|
||||
context, sink_caps, src_caps, GST_RANK_NONE);
|
||||
break;
|
||||
#endif
|
||||
#ifdef USE_MSDK_AV1_DEC
|
||||
case MFX_CODEC_AV1:
|
||||
ret = gst_element_register (plugin, "msdkav1dec", GST_RANK_NONE,
|
||||
GST_TYPE_MSDKAV1DEC);
|
||||
ret = gst_msdkav1dec_register (plugin,
|
||||
context, sink_caps, src_caps, GST_RANK_NONE);
|
||||
break;
|
||||
#endif
|
||||
case MFX_CODEC_JPEG:
|
||||
ret = gst_element_register (plugin, "msdkmjpegdec", GST_RANK_NONE,
|
||||
GST_TYPE_MSDKMJPEGDEC);
|
||||
ret = gst_msdkmjpegdec_register (plugin,
|
||||
context, sink_caps, src_caps, GST_RANK_NONE);
|
||||
break;
|
||||
case MFX_CODEC_VC1:
|
||||
ret = gst_element_register (plugin, "msdkvc1dec", GST_RANK_NONE,
|
||||
GST_TYPE_MSDKVC1DEC);
|
||||
ret = gst_msdkvc1dec_register (plugin,
|
||||
context, sink_caps, src_caps, GST_RANK_NONE);
|
||||
break;
|
||||
default:
|
||||
ret = FALSE;
|
||||
|
@ -238,11 +240,26 @@ static void
|
|||
_register_decoders (GstPlugin * plugin,
|
||||
GstMsdkContext * context, mfxDecoderDescription * dec_desc)
|
||||
{
|
||||
GstCaps *sink_caps = NULL;
|
||||
GstCaps *src_caps = NULL;
|
||||
|
||||
for (guint c = 0; c < dec_desc->NumCodecs; c++) {
|
||||
if (!_register_decoder (plugin, dec_desc->Codecs[c].CodecID)) {
|
||||
if (!gst_msdkcaps_dec_create_caps (context, dec_desc,
|
||||
dec_desc->Codecs[c].CodecID, &sink_caps, &src_caps)) {
|
||||
GST_WARNING ("Failed to create caps for %" GST_FOURCC_FORMAT " DEC",
|
||||
GST_FOURCC_ARGS (dec_desc->Codecs[c].CodecID));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_register_decoder (plugin,
|
||||
context, dec_desc->Codecs[c].CodecID, sink_caps, src_caps)) {
|
||||
GST_WARNING ("Failed to register %" GST_FOURCC_FORMAT " DEC",
|
||||
GST_FOURCC_ARGS (dec_desc->Codecs[c].CodecID));
|
||||
continue;
|
||||
}
|
||||
|
||||
gst_caps_unref (sink_caps);
|
||||
gst_caps_unref (src_caps);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,11 +329,26 @@ _register_encoders (GstPlugin * plugin, GstMsdkContext * context)
|
|||
static void
|
||||
_register_decoders (GstPlugin * plugin, GstMsdkContext * context)
|
||||
{
|
||||
GstCaps *sink_caps = NULL;
|
||||
GstCaps *src_caps = NULL;
|
||||
|
||||
for (guint c = 0; c < G_N_ELEMENTS (dec_codecs); c++) {
|
||||
if (!_register_decoder (plugin, dec_codecs[c])) {
|
||||
if (!gst_msdkcaps_dec_create_caps (context,
|
||||
NULL, dec_codecs[c], &sink_caps, &src_caps)) {
|
||||
GST_WARNING ("Failed to create caps for %" GST_FOURCC_FORMAT " DEC",
|
||||
GST_FOURCC_ARGS (dec_codecs[c]));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_register_decoder (plugin, context,
|
||||
dec_codecs[c], sink_caps, src_caps)) {
|
||||
GST_WARNING ("Failed to register %" GST_FOURCC_FORMAT " DEC",
|
||||
GST_FOURCC_ARGS (dec_codecs[c]));
|
||||
continue;
|
||||
}
|
||||
|
||||
gst_caps_unref (sink_caps);
|
||||
gst_caps_unref (src_caps);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,38 +54,27 @@
|
|||
GST_DEBUG_CATEGORY_EXTERN (gst_msdkav1dec_debug);
|
||||
#define GST_CAT_DEFAULT gst_msdkav1dec_debug
|
||||
|
||||
#define COMMON_FORMAT "{ NV12, P010_10LE, VUYA, Y410 }"
|
||||
#define GST_MSDKAV1DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_FROM_INSTANCE (obj), GstMsdkAV1Dec))
|
||||
#define GST_MSDKAV1DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FROM_CLASS (klass), GstMsdkAV1DecClass))
|
||||
#define GST_IS_MSDKAV1DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_FROM_INSTANCE (obj)))
|
||||
#define GST_IS_MSDKAV1DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FROM_CLASS (klass)))
|
||||
|
||||
#ifndef _WIN32
|
||||
#define VA_SRC_CAPS_STR \
|
||||
";" GST_MSDK_CAPS_MAKE_WITH_VA_FEATURE ("{ NV12 }")
|
||||
#else
|
||||
#define D3D11_SRC_CAPS_STR \
|
||||
";" GST_MSDK_CAPS_MAKE_WITH_D3D11_FEATURE ("{ NV12 }")
|
||||
#endif
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *doc_src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE ("{ NV12, P010_10LE }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:DMABuf",
|
||||
"{ NV12, P010_10LE }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory", "{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:D3D11Memory", "{ NV12 }");
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-av1")
|
||||
);
|
||||
static const gchar *doc_sink_caps_str = "video/x-av1";
|
||||
|
||||
#ifndef _WIN32
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR (COMMON_FORMAT, COMMON_FORMAT)
|
||||
VA_SRC_CAPS_STR));
|
||||
#else
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR (COMMON_FORMAT, COMMON_FORMAT)
|
||||
D3D11_SRC_CAPS_STR));
|
||||
#endif
|
||||
|
||||
#define gst_msdkav1dec_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstMsdkAV1Dec, gst_msdkav1dec, GST_TYPE_MSDKDEC);
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_msdkav1dec_configure (GstMsdkDec * decoder)
|
||||
|
@ -118,10 +107,13 @@ gst_msdkav1dec_preinit_decoder (GstMsdkDec * decoder)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_msdkav1dec_class_init (GstMsdkAV1DecClass * klass)
|
||||
gst_msdkav1dec_class_init (gpointer klass, gpointer data)
|
||||
{
|
||||
GstElementClass *element_class;
|
||||
GstMsdkDecClass *decoder_class;
|
||||
MsdkDecCData *cdata = data;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
decoder_class = GST_MSDKDEC_CLASS (klass);
|
||||
|
@ -136,11 +128,56 @@ gst_msdkav1dec_class_init (GstMsdkAV1DecClass * klass)
|
|||
"AV1 video decoder based on " MFX_API_SDK,
|
||||
"Haihao Xiang <haihao.xiang@intel.com>");
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||
gst_msdkcaps_pad_template_init (element_class,
|
||||
cdata->sink_caps, cdata->src_caps, doc_sink_caps_str, doc_src_caps_str);
|
||||
|
||||
gst_caps_unref (cdata->sink_caps);
|
||||
gst_caps_unref (cdata->src_caps);
|
||||
g_free (cdata);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_msdkav1dec_init (GstMsdkAV1Dec * thiz)
|
||||
gst_msdkav1dec_init (GTypeInstance * instance, gpointer g_class)
|
||||
{
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_msdkav1dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank)
|
||||
{
|
||||
GType type;
|
||||
MsdkDecCData *cdata;
|
||||
gchar *type_name, *feature_name;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GTypeInfo type_info = {
|
||||
.class_size = sizeof (GstMsdkAV1DecClass),
|
||||
.class_init = gst_msdkav1dec_class_init,
|
||||
.instance_size = sizeof (GstMsdkAV1Dec),
|
||||
.instance_init = gst_msdkav1dec_init
|
||||
};
|
||||
|
||||
cdata = g_new (MsdkDecCData, 1);
|
||||
cdata->sink_caps = gst_caps_ref (sink_caps);
|
||||
cdata->src_caps = gst_caps_ref (src_caps);
|
||||
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->sink_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->src_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstMsdkAV1Dec");
|
||||
feature_name = g_strdup ("msdkav1dec");
|
||||
|
||||
type = g_type_register_static (GST_TYPE_MSDKDEC, type_name, &type_info, 0);
|
||||
if (type)
|
||||
ret = gst_element_register (plugin, feature_name, rank, type);
|
||||
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -36,17 +36,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MSDKAV1DEC \
|
||||
(gst_msdkav1dec_get_type())
|
||||
#define GST_MSDKAV1DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSDKAV1DEC,GstMsdkAV1Dec))
|
||||
#define GST_MSDKAV1DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MSDKAV1DEC,GstMsdkAV1DecClass))
|
||||
#define GST_IS_MSDKAV1DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSDKAV1DEC))
|
||||
#define GST_IS_MSDKAV1DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKAV1DEC))
|
||||
|
||||
typedef struct _GstMsdkAV1Dec GstMsdkAV1Dec;
|
||||
typedef struct _GstMsdkAV1DecClass GstMsdkAV1DecClass;
|
||||
|
||||
|
@ -60,7 +49,10 @@ struct _GstMsdkAV1DecClass
|
|||
GstMsdkDecClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_msdkav1dec_get_type (void);
|
||||
gboolean
|
||||
gst_msdkav1dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -48,12 +48,6 @@
|
|||
GST_DEBUG_CATEGORY_EXTERN (gst_msdkdec_debug);
|
||||
#define GST_CAT_DEFAULT gst_msdkdec_debug
|
||||
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR ("NV12", "NV12"))
|
||||
);
|
||||
|
||||
#define PROP_HARDWARE_DEFAULT TRUE
|
||||
#define PROP_ASYNC_DEPTH_DEFAULT 1
|
||||
|
||||
|
@ -2245,8 +2239,6 @@ gst_msdkdec_class_init (GstMsdkDecClass * klass)
|
|||
"Depth of asynchronous pipeline",
|
||||
1, 20, PROP_ASYNC_DEPTH_DEFAULT,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -61,6 +61,7 @@ G_BEGIN_DECLS
|
|||
typedef struct _GstMsdkDec GstMsdkDec;
|
||||
typedef struct _GstMsdkDecClass GstMsdkDecClass;
|
||||
typedef struct _MsdkDecTask MsdkDecTask;
|
||||
typedef struct _MsdkDecCData MsdkDecCData;
|
||||
|
||||
struct _GstMsdkDec
|
||||
{
|
||||
|
@ -134,6 +135,12 @@ struct _GstMsdkDecClass
|
|||
gboolean (*postinit_decoder) (GstMsdkDec * decoder);
|
||||
};
|
||||
|
||||
struct _MsdkDecCData
|
||||
{
|
||||
GstCaps *sink_caps;
|
||||
GstCaps *src_caps;
|
||||
};
|
||||
|
||||
GType gst_msdkdec_get_type (void);
|
||||
|
||||
void
|
||||
|
|
|
@ -54,41 +54,26 @@
|
|||
GST_DEBUG_CATEGORY_EXTERN (gst_msdkh264dec_debug);
|
||||
#define GST_CAT_DEFAULT gst_msdkh264dec_debug
|
||||
|
||||
#define COMMON_FORMAT "{ NV12, BGRA, BGRx }"
|
||||
#define GST_MSDKH264DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_FROM_INSTANCE (obj), GstMsdkH264Dec))
|
||||
#define GST_MSDKH264DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FROM_CLASS (klass), GstMsdkH264DecClass))
|
||||
#define GST_IS_MSDKH264DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_FROM_INSTANCE (obj)))
|
||||
#define GST_IS_MSDKH264DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FROM_CLASS (klass)))
|
||||
|
||||
#ifndef _WIN32
|
||||
#define VA_SRC_CAPS_STR \
|
||||
"; " GST_MSDK_CAPS_MAKE_WITH_VA_FEATURE ("{ NV12 }")
|
||||
#else
|
||||
#define D3D11_SRC_CAPS_STR \
|
||||
";" GST_MSDK_CAPS_MAKE_WITH_D3D11_FEATURE ("{ NV12 }")
|
||||
#endif
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *doc_src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE ("{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:DMABuf", "{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory", "{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:D3D11Memory", "{ NV12 }");
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-h264, "
|
||||
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
|
||||
"stream-format = (string) byte-stream , alignment = (string) au , "
|
||||
"profile = (string) { high, progressive-high, constrained-high, main, baseline, constrained-baseline }")
|
||||
);
|
||||
static const gchar *doc_sink_caps_str = "video/x-h264";
|
||||
|
||||
#ifndef _WIN32
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR (COMMON_FORMAT, COMMON_FORMAT)
|
||||
VA_SRC_CAPS_STR));
|
||||
#else
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR (COMMON_FORMAT, COMMON_FORMAT)
|
||||
D3D11_SRC_CAPS_STR));
|
||||
#endif
|
||||
|
||||
#define gst_msdkh264dec_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstMsdkH264Dec, gst_msdkh264dec, GST_TYPE_MSDKDEC);
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_msdkh264dec_configure (GstMsdkDec * decoder)
|
||||
|
@ -177,11 +162,14 @@ gst_msdkdec_h264_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_msdkh264dec_class_init (GstMsdkH264DecClass * klass)
|
||||
gst_msdkh264dec_class_init (gpointer klass, gpointer data)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstMsdkDecClass *decoder_class;
|
||||
MsdkDecCData *cdata = data;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
@ -204,12 +192,62 @@ gst_msdkh264dec_class_init (GstMsdkH264DecClass * klass)
|
|||
gst_msdkdec_prop_install_error_report_property (gobject_class);
|
||||
#endif
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||
gst_msdkcaps_pad_template_init (element_class,
|
||||
cdata->sink_caps, cdata->src_caps, doc_sink_caps_str, doc_src_caps_str);
|
||||
|
||||
gst_caps_unref (cdata->sink_caps);
|
||||
gst_caps_unref (cdata->src_caps);
|
||||
g_free (cdata);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_msdkh264dec_init (GstMsdkH264Dec * thiz)
|
||||
gst_msdkh264dec_init (GTypeInstance * instance, gpointer g_class)
|
||||
{
|
||||
GstMsdkH264Dec *thiz = GST_MSDKH264DEC (instance);
|
||||
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_msdkh264dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank)
|
||||
{
|
||||
GType type;
|
||||
MsdkDecCData *cdata;
|
||||
gchar *type_name, *feature_name;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GTypeInfo type_info = {
|
||||
.class_size = sizeof (GstMsdkH264DecClass),
|
||||
.class_init = gst_msdkh264dec_class_init,
|
||||
.instance_size = sizeof (GstMsdkH264Dec),
|
||||
.instance_init = gst_msdkh264dec_init
|
||||
};
|
||||
|
||||
cdata = g_new (MsdkDecCData, 1);
|
||||
cdata->sink_caps = gst_caps_copy (sink_caps);
|
||||
cdata->src_caps = gst_caps_ref (src_caps);
|
||||
|
||||
gst_caps_set_simple (cdata->sink_caps,
|
||||
"alignment", G_TYPE_STRING, "au",
|
||||
"stream-format", G_TYPE_STRING, "byte-stream", NULL);
|
||||
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->sink_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->src_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstMsdkH264Dec");
|
||||
feature_name = g_strdup ("msdkh264dec");
|
||||
|
||||
type = g_type_register_static (GST_TYPE_MSDKDEC, type_name, &type_info, 0);
|
||||
if (type)
|
||||
ret = gst_element_register (plugin, feature_name, rank, type);
|
||||
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -36,17 +36,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MSDKH264DEC \
|
||||
(gst_msdkh264dec_get_type())
|
||||
#define GST_MSDKH264DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSDKH264DEC,GstMsdkH264Dec))
|
||||
#define GST_MSDKH264DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MSDKH264DEC,GstMsdkH264DecClass))
|
||||
#define GST_IS_MSDKH264DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSDKH264DEC))
|
||||
#define GST_IS_MSDKH264DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKH264DEC))
|
||||
|
||||
typedef struct _GstMsdkH264Dec GstMsdkH264Dec;
|
||||
typedef struct _GstMsdkH264DecClass GstMsdkH264DecClass;
|
||||
|
||||
|
@ -61,7 +50,10 @@ struct _GstMsdkH264DecClass
|
|||
GstMsdkDecClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_msdkh264dec_get_type (void);
|
||||
gboolean
|
||||
gst_msdkh264dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -54,42 +54,32 @@
|
|||
GST_DEBUG_CATEGORY_EXTERN (gst_msdkh265dec_debug);
|
||||
#define GST_CAT_DEFAULT gst_msdkh265dec_debug
|
||||
|
||||
#define COMMON_FORMAT \
|
||||
"{ NV12, P010_10LE, YUY2, Y210, VUYA, Y410, P012_LE, Y212_LE, Y412_LE, BGRA, BGRx }"
|
||||
#define GST_TYPE_MSDKH265DEC \
|
||||
(gst_msdkh265dec_get_type())
|
||||
#define GST_MSDKH265DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_FROM_INSTANCE (obj), GstMsdkH265Dec))
|
||||
#define GST_MSDKH265DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FROM_CLASS (klass), GstMsdkH265DecClass))
|
||||
#define GST_IS_MSDKH265DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_FROM_INSTANCE (obj)))
|
||||
#define GST_IS_MSDKH265DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FROM_CLASS (klass)))
|
||||
|
||||
#ifndef _WIN32
|
||||
#define VA_SRC_CAPS_STR \
|
||||
"; " GST_MSDK_CAPS_MAKE_WITH_VA_FEATURE ("{ NV12 }")
|
||||
#else
|
||||
#define D3D11_SRC_CAPS_STR \
|
||||
";" GST_MSDK_CAPS_MAKE_WITH_D3D11_FEATURE ("{ NV12 }")
|
||||
#endif
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *doc_src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE (
|
||||
"{ NV12, P010_10LE, YUY2, VUYA, Y210, Y410, P012_LE, Y212_LE, "
|
||||
"Y412_LE }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:DMABuf",
|
||||
"{ NV12, P010_10LE, YUY2, VUYA, Y210, Y410, P012_LE, Y212_LE, "
|
||||
"Y412_LE }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory", "{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:D3D11Memory", "{ NV12 }");
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* TODO: update both sink and src dynamically */
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-h265, "
|
||||
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
|
||||
"stream-format = (string) byte-stream , alignment = (string) au ")
|
||||
);
|
||||
static const gchar *doc_sink_caps_str = "video/x-h265";
|
||||
|
||||
#ifndef _WIN32
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR (COMMON_FORMAT, COMMON_FORMAT)
|
||||
VA_SRC_CAPS_STR));
|
||||
#else
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR (COMMON_FORMAT, COMMON_FORMAT)
|
||||
D3D11_SRC_CAPS_STR));
|
||||
#endif
|
||||
|
||||
#define gst_msdkh265dec_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstMsdkH265Dec, gst_msdkh265dec, GST_TYPE_MSDKDEC);
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_msdkh265dec_configure (GstMsdkDec * decoder)
|
||||
|
@ -190,11 +180,14 @@ gst_msdkdec_h265_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_msdkh265dec_class_init (GstMsdkH265DecClass * klass)
|
||||
gst_msdkh265dec_class_init (gpointer klass, gpointer data)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstMsdkDecClass *decoder_class;
|
||||
MsdkDecCData *cdata = data;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
@ -217,12 +210,62 @@ gst_msdkh265dec_class_init (GstMsdkH265DecClass * klass)
|
|||
gst_msdkdec_prop_install_error_report_property (gobject_class);
|
||||
#endif
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||
gst_msdkcaps_pad_template_init (element_class,
|
||||
cdata->sink_caps, cdata->src_caps, doc_sink_caps_str, doc_src_caps_str);
|
||||
|
||||
gst_caps_unref (cdata->sink_caps);
|
||||
gst_caps_unref (cdata->src_caps);
|
||||
g_free (cdata);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_msdkh265dec_init (GstMsdkH265Dec * thiz)
|
||||
gst_msdkh265dec_init (GTypeInstance * instance, gpointer g_class)
|
||||
{
|
||||
GstMsdkH265Dec *thiz = GST_MSDKH265DEC (instance);
|
||||
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_msdkh265dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank)
|
||||
{
|
||||
GType type;
|
||||
MsdkDecCData *cdata;
|
||||
gchar *type_name, *feature_name;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GTypeInfo type_info = {
|
||||
.class_size = sizeof (GstMsdkH265DecClass),
|
||||
.class_init = gst_msdkh265dec_class_init,
|
||||
.instance_size = sizeof (GstMsdkH265Dec),
|
||||
.instance_init = gst_msdkh265dec_init
|
||||
};
|
||||
|
||||
cdata = g_new (MsdkDecCData, 1);
|
||||
cdata->sink_caps = gst_caps_copy (sink_caps);
|
||||
cdata->src_caps = gst_caps_ref (src_caps);
|
||||
|
||||
gst_caps_set_simple (cdata->sink_caps,
|
||||
"stream-format", G_TYPE_STRING, "byte-stream",
|
||||
"alignment", G_TYPE_STRING, "au", NULL);
|
||||
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->sink_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->src_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstMsdkH265Dec");
|
||||
feature_name = g_strdup ("msdkh265dec");
|
||||
|
||||
type = g_type_register_static (GST_TYPE_MSDKDEC, type_name, &type_info, 0);
|
||||
if (type)
|
||||
ret = gst_element_register (plugin, feature_name, rank, type);
|
||||
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -36,17 +36,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MSDKH265DEC \
|
||||
(gst_msdkh265dec_get_type())
|
||||
#define GST_MSDKH265DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSDKH265DEC,GstMsdkH265Dec))
|
||||
#define GST_MSDKH265DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MSDKH265DEC,GstMsdkH265DecClass))
|
||||
#define GST_IS_MSDKH265DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSDKH265DEC))
|
||||
#define GST_IS_MSDKH265DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKH265DEC))
|
||||
|
||||
typedef struct _GstMsdkH265Dec GstMsdkH265Dec;
|
||||
typedef struct _GstMsdkH265DecClass GstMsdkH265DecClass;
|
||||
|
||||
|
@ -61,7 +50,10 @@ struct _GstMsdkH265DecClass
|
|||
GstMsdkDecClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_msdkh265dec_get_type (void);
|
||||
gboolean
|
||||
gst_msdkh265dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -59,37 +59,27 @@
|
|||
GST_DEBUG_CATEGORY_EXTERN (gst_msdkmjpegdec_debug);
|
||||
#define GST_CAT_DEFAULT gst_msdkmjpegdec_debug
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("image/jpeg, "
|
||||
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], parsed = true ")
|
||||
);
|
||||
#define GST_MSDKMJPEGDEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_FROM_INSTANCE (obj), GstMsdkMJPEGDec))
|
||||
#define GST_MSDKMJPEGDEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FROM_CLASS (klass), GstMsdkMJPEGDecClass))
|
||||
#define GST_IS_MSDKMJPEGDEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_FROM_INSTANCE (obj)))
|
||||
#define GST_IS_MSDKMJPEGDEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FROM_CLASS (klass)))
|
||||
|
||||
#ifndef _WIN32
|
||||
#define VA_SRC_CAPS_STR \
|
||||
"; " GST_MSDK_CAPS_MAKE_WITH_VA_FEATURE ("{ NV12 }")
|
||||
#else
|
||||
#define D3D11_SRC_CAPS_STR \
|
||||
"; " GST_MSDK_CAPS_MAKE_WITH_D3D11_FEATURE ("{ NV12 }")
|
||||
#endif
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *doc_src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE ("{ NV12, YUY2, BGRA }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:DMABuf",
|
||||
"{ NV12, YUY2, BGRA }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory", "{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:D3D11Memory", "{ NV12 }");
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#ifndef _WIN32
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR ("{ NV12, YUY2 }", "{ NV12, YUY2 }")
|
||||
VA_SRC_CAPS_STR));
|
||||
#else
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR ("{ NV12, YUY2 }", "{ NV12, YUY2 }")
|
||||
D3D11_SRC_CAPS_STR));
|
||||
#endif
|
||||
static const gchar *doc_sink_caps_str = "image/jpeg";
|
||||
|
||||
#define gst_msdkmjpegdec_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstMsdkMJPEGDec, gst_msdkmjpegdec, GST_TYPE_MSDKDEC);
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_msdkmjpegdec_configure (GstMsdkDec * decoder)
|
||||
|
@ -192,11 +182,14 @@ gst_msdkdec_mjpeg_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_msdkmjpegdec_class_init (GstMsdkMJPEGDecClass * klass)
|
||||
gst_msdkmjpegdec_class_init (gpointer klass, gpointer data)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstMsdkDecClass *decoder_class;
|
||||
MsdkDecCData *cdata = data;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
@ -219,11 +212,58 @@ gst_msdkmjpegdec_class_init (GstMsdkMJPEGDecClass * klass)
|
|||
gst_msdkdec_prop_install_error_report_property (gobject_class);
|
||||
#endif
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||
gst_msdkcaps_pad_template_init (element_class,
|
||||
cdata->sink_caps, cdata->src_caps, doc_sink_caps_str, doc_src_caps_str);
|
||||
|
||||
gst_caps_unref (cdata->sink_caps);
|
||||
gst_caps_unref (cdata->src_caps);
|
||||
g_free (cdata);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_msdkmjpegdec_init (GstMsdkMJPEGDec * thiz)
|
||||
gst_msdkmjpegdec_init (GTypeInstance * instance, gpointer g_class)
|
||||
{
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_msdkmjpegdec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank)
|
||||
{
|
||||
GType type;
|
||||
MsdkDecCData *cdata;
|
||||
gchar *type_name, *feature_name;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GTypeInfo type_info = {
|
||||
.class_size = sizeof (GstMsdkMJPEGDecClass),
|
||||
.class_init = gst_msdkmjpegdec_class_init,
|
||||
.instance_size = sizeof (GstMsdkMJPEGDec),
|
||||
.instance_init = gst_msdkmjpegdec_init
|
||||
};
|
||||
|
||||
cdata = g_new (MsdkDecCData, 1);
|
||||
cdata->sink_caps = gst_caps_copy (sink_caps);
|
||||
cdata->src_caps = gst_caps_ref (src_caps);
|
||||
|
||||
gst_caps_set_simple (cdata->sink_caps, "parsed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->sink_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->src_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstMsdkMJPEGDec");
|
||||
feature_name = g_strdup ("msdkmjpegdec");
|
||||
|
||||
type = g_type_register_static (GST_TYPE_MSDKDEC, type_name, &type_info, 0);
|
||||
if (type)
|
||||
ret = gst_element_register (plugin, feature_name, rank, type);
|
||||
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -36,17 +36,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MSDKMJPEGDEC \
|
||||
(gst_msdkmjpegdec_get_type())
|
||||
#define GST_MSDKMJPEGDEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSDKMJPEGDEC,GstMsdkMJPEGDec))
|
||||
#define GST_MSDKMJPEGDEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MSDKMJPEGDEC,GstMsdkMJPEGDecClass))
|
||||
#define GST_IS_MSDKMJPEGDEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSDKMJPEGDEC))
|
||||
#define GST_IS_MSDKMJPEGDEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKMJPEGDEC))
|
||||
|
||||
typedef struct _GstMsdkMJPEGDec GstMsdkMJPEGDec;
|
||||
typedef struct _GstMsdkMJPEGDecClass GstMsdkMJPEGDecClass;
|
||||
|
||||
|
@ -60,7 +49,10 @@ struct _GstMsdkMJPEGDecClass
|
|||
GstMsdkDecClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_msdkmjpegdec_get_type (void);
|
||||
gboolean
|
||||
gst_msdkmjpegdec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -57,29 +57,26 @@
|
|||
GST_DEBUG_CATEGORY_EXTERN (gst_msdkmpeg2dec_debug);
|
||||
#define GST_CAT_DEFAULT gst_msdkmpeg2dec_debug
|
||||
|
||||
#ifndef _WIN32
|
||||
#define VA_SRC_CAPS_STR \
|
||||
"; " GST_MSDK_CAPS_MAKE_WITH_VA_FEATURE ("{ NV12 }")
|
||||
#else
|
||||
#define VA_SRC_CAPS_STR ""
|
||||
#endif
|
||||
#define GST_MSDKMPEG2DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_FROM_INSTANCE (obj), GstMsdkMPEG2Dec))
|
||||
#define GST_MSDKMPEG2DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FROM_CLASS (klass), GstMsdkMPEG2DecClass))
|
||||
#define GST_IS_MSDKMPEG2DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_FROM_INSTANCE (obj)))
|
||||
#define GST_IS_MSDKMPEG2DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FROM_CLASS (klass)))
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/mpeg, "
|
||||
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
|
||||
"mpegversion = (int) 2, " "systemstream = (boolean) false")
|
||||
);
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *doc_src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE ("{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:DMABuf", "{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory", "{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:D3D11Memory", "{ NV12 }");
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR ("{ NV12 }", "{ NV12 }")
|
||||
VA_SRC_CAPS_STR));
|
||||
static const gchar *doc_sink_caps_str = "video/mpeg";
|
||||
|
||||
#define gst_msdkmpeg2dec_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstMsdkMPEG2Dec, gst_msdkmpeg2dec, GST_TYPE_MSDKDEC);
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_msdkmpeg2dec_configure (GstMsdkDec * decoder)
|
||||
|
@ -140,11 +137,14 @@ gst_msdkdec_mpeg2_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_msdkmpeg2dec_class_init (GstMsdkMPEG2DecClass * klass)
|
||||
gst_msdkmpeg2dec_class_init (gpointer klass, gpointer data)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstMsdkDecClass *decoder_class;
|
||||
MsdkDecCData *cdata = data;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
@ -163,12 +163,62 @@ gst_msdkmpeg2dec_class_init (GstMsdkMPEG2DecClass * klass)
|
|||
|
||||
gst_msdkdec_prop_install_output_oder_property (gobject_class);
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||
gst_msdkcaps_pad_template_init (element_class,
|
||||
cdata->sink_caps, cdata->src_caps, doc_sink_caps_str, doc_src_caps_str);
|
||||
|
||||
gst_caps_unref (cdata->sink_caps);
|
||||
gst_caps_unref (cdata->src_caps);
|
||||
g_free (cdata);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_msdkmpeg2dec_init (GstMsdkMPEG2Dec * thiz)
|
||||
gst_msdkmpeg2dec_init (GTypeInstance * instance, gpointer g_class)
|
||||
{
|
||||
GstMsdkMPEG2Dec *thiz = GST_MSDKMPEG2DEC (instance);
|
||||
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_msdkmpeg2dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank)
|
||||
{
|
||||
GType type;
|
||||
MsdkDecCData *cdata;
|
||||
gchar *type_name, *feature_name;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GTypeInfo type_info = {
|
||||
.class_size = sizeof (GstMsdkMPEG2DecClass),
|
||||
.class_init = gst_msdkmpeg2dec_class_init,
|
||||
.instance_size = sizeof (GstMsdkMPEG2Dec),
|
||||
.instance_init = gst_msdkmpeg2dec_init
|
||||
};
|
||||
|
||||
cdata = g_new (MsdkDecCData, 1);
|
||||
cdata->sink_caps = gst_caps_copy (sink_caps);
|
||||
cdata->src_caps = gst_caps_ref (src_caps);
|
||||
|
||||
gst_caps_set_simple (cdata->sink_caps,
|
||||
"mpegversion", G_TYPE_INT, 2,
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->sink_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->src_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstMsdkMPEG2Dec");
|
||||
feature_name = g_strdup ("msdkmpeg2dec");
|
||||
|
||||
type = g_type_register_static (GST_TYPE_MSDKDEC, type_name, &type_info, 0);
|
||||
if (type)
|
||||
ret = gst_element_register (plugin, feature_name, rank, type);
|
||||
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -38,17 +38,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MSDKMPEG2DEC \
|
||||
(gst_msdkmpeg2dec_get_type())
|
||||
#define GST_MSDKMPEG2DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSDKMPEG2DEC,GstMsdkMPEG2Dec))
|
||||
#define GST_MSDKMPEG2DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MSDKMPEG2DEC,GstMsdkMPEG2DecClass))
|
||||
#define GST_IS_MSDKMPEG2DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSDKMPEG2DEC))
|
||||
#define GST_IS_MSDKMPEG2DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKMPEG2DEC))
|
||||
|
||||
typedef struct _GstMsdkMPEG2Dec GstMsdkMPEG2Dec;
|
||||
typedef struct _GstMsdkMPEG2DecClass GstMsdkMPEG2DecClass;
|
||||
|
||||
|
@ -63,7 +52,10 @@ struct _GstMsdkMPEG2DecClass
|
|||
GstMsdkDecClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_msdkmpeg2dec_get_type (void);
|
||||
gboolean
|
||||
gst_msdkmpeg2dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -56,41 +56,25 @@
|
|||
GST_DEBUG_CATEGORY_EXTERN (gst_msdkvc1dec_debug);
|
||||
#define GST_CAT_DEFAULT gst_msdkvc1dec_debug
|
||||
|
||||
#ifndef _WIN32
|
||||
#define VA_SRC_CAPS_STR \
|
||||
"; " GST_MSDK_CAPS_MAKE_WITH_VA_FEATURE ("{ NV12 }")
|
||||
#else
|
||||
#define VA_SRC_CAPS_STR ""
|
||||
#endif
|
||||
#define GST_MSDKVC1DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_FROM_INSTANCE (obj), GstMsdkVC1Dec))
|
||||
#define GST_MSDKVC1DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FROM_CLASS (klass), GstMsdkVC1DecClass))
|
||||
#define GST_IS_MSDKVC1DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_FROM_INSTANCE (obj)))
|
||||
#define GST_IS_MSDKVC1DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FROM_CLASS (klass)))
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-wmv, "
|
||||
"framerate = (fraction) [0/1, MAX], "
|
||||
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
|
||||
"wmvversion= (int) 3, "
|
||||
"format= (string) WMV3, "
|
||||
"header-format= (string) none, "
|
||||
"stream-format= (string) sequence-layer-frame-layer, "
|
||||
"profile = (string) {simple, main}" ";"
|
||||
"video/x-wmv, "
|
||||
"framerate = (fraction) [0/1, MAX], "
|
||||
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
|
||||
"wmvversion= (int) 3, "
|
||||
"format= (string) WVC1, "
|
||||
"header-format= (string) asf, "
|
||||
"stream-format= (string) bdu, " "profile = (string) advanced" ";")
|
||||
);
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *doc_src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE ("{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:DMABuf", "{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory", "{ NV12 }");
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR ("{ NV12 }", "{ NV12 }")
|
||||
VA_SRC_CAPS_STR));
|
||||
static const gchar *doc_sink_caps_str = "video/x-wmv";
|
||||
|
||||
#define gst_msdkvc1dec_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstMsdkVC1Dec, gst_msdkvc1dec, GST_TYPE_MSDKDEC);
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_msdkvc1dec_configure (GstMsdkDec * decoder)
|
||||
|
@ -196,11 +180,14 @@ gst_msdkvc1dec_preinit_decoder (GstMsdkDec * decoder)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_msdkvc1dec_class_init (GstMsdkVC1DecClass * klass)
|
||||
gst_msdkvc1dec_class_init (gpointer klass, gpointer data)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstMsdkDecClass *decoder_class;
|
||||
MsdkDecCData *cdata = data;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
@ -221,13 +208,64 @@ gst_msdkvc1dec_class_init (GstMsdkVC1DecClass * klass)
|
|||
|
||||
gst_msdkdec_prop_install_output_oder_property (gobject_class);
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||
gst_msdkcaps_pad_template_init (element_class,
|
||||
cdata->sink_caps, cdata->src_caps, doc_sink_caps_str, doc_src_caps_str);
|
||||
|
||||
gst_caps_unref (cdata->sink_caps);
|
||||
gst_caps_unref (cdata->src_caps);
|
||||
g_free (cdata);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gst_msdkvc1dec_init (GstMsdkVC1Dec * thiz)
|
||||
gst_msdkvc1dec_init (GTypeInstance * instance, gpointer g_class)
|
||||
{
|
||||
GstMsdkVC1Dec *thiz = GST_MSDKVC1DEC (instance);
|
||||
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_msdkvc1dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank)
|
||||
{
|
||||
GType type;
|
||||
MsdkDecCData *cdata;
|
||||
gchar *type_name, *feature_name;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GTypeInfo type_info = {
|
||||
.class_size = sizeof (GstMsdkVC1DecClass),
|
||||
.class_init = gst_msdkvc1dec_class_init,
|
||||
.instance_size = sizeof (GstMsdkVC1Dec),
|
||||
.instance_init = gst_msdkvc1dec_init
|
||||
};
|
||||
|
||||
cdata = g_new (MsdkDecCData, 1);
|
||||
cdata->sink_caps = gst_caps_ref (sink_caps);
|
||||
#ifndef _WIN32
|
||||
cdata->src_caps = gst_caps_ref (src_caps);
|
||||
#else
|
||||
cdata->src_caps = gst_caps_copy (src_caps);
|
||||
gst_msdkcaps_remove_structure (cdata->src_caps, "memory:D3D11Memory");
|
||||
#endif
|
||||
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->sink_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->src_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstMsdkVC1Dec");
|
||||
feature_name = g_strdup ("msdkvc1dec");
|
||||
|
||||
type = g_type_register_static (GST_TYPE_MSDKDEC, type_name, &type_info, 0);
|
||||
if (type)
|
||||
ret = gst_element_register (plugin, feature_name, rank, type);
|
||||
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -38,17 +38,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MSDKVC1DEC \
|
||||
(gst_msdkvc1dec_get_type())
|
||||
#define GST_MSDKVC1DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSDKVC1DEC,GstMsdkVC1Dec))
|
||||
#define GST_MSDKVC1DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MSDKVC1DEC,GstMsdkVC1DecClass))
|
||||
#define GST_IS_MSDKVC1DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSDKVC1DEC))
|
||||
#define GST_IS_MSDKVC1DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKVC1DEC))
|
||||
|
||||
typedef struct _GstMsdkVC1Dec GstMsdkVC1Dec;
|
||||
typedef struct _GstMsdkVC1DecClass GstMsdkVC1DecClass;
|
||||
|
||||
|
@ -63,7 +52,10 @@ struct _GstMsdkVC1DecClass
|
|||
GstMsdkDecClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_msdkvc1dec_get_type (void);
|
||||
gboolean
|
||||
gst_msdkvc1dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -57,14 +57,25 @@
|
|||
GST_DEBUG_CATEGORY_EXTERN (gst_msdkvp8dec_debug);
|
||||
#define GST_CAT_DEFAULT gst_msdkvp8dec_debug
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-vp8")
|
||||
);
|
||||
#define GST_MSDKVP8DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_FROM_INSTANCE (obj), GstMsdkVP8Dec))
|
||||
#define GST_MSDKVP8DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FROM_CLASS (klass), GstMsdkVP8DecClass))
|
||||
#define GST_IS_MSDKVP8DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_FROM_INSTANCE (obj)))
|
||||
#define GST_IS_MSDKVP8DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FROM_CLASS (klass)))
|
||||
|
||||
#define gst_msdkvp8dec_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstMsdkVP8Dec, gst_msdkvp8dec, GST_TYPE_MSDKDEC);
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *doc_src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE ("{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:DMABuf", "{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory", "{ NV12 }");
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static const gchar *doc_sink_caps_str = "video/x-vp8";
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_msdkvp8dec_configure (GstMsdkDec * decoder)
|
||||
|
@ -168,11 +179,14 @@ gst_msdkvp8dec_postinit_decoder (GstMsdkDec * decoder)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_msdkvp8dec_class_init (GstMsdkVP8DecClass * klass)
|
||||
gst_msdkvp8dec_class_init (gpointer klass, gpointer data)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstMsdkDecClass *decoder_class;
|
||||
MsdkDecCData *cdata = data;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
@ -195,11 +209,64 @@ gst_msdkvp8dec_class_init (GstMsdkVP8DecClass * klass)
|
|||
|
||||
gst_msdkdec_prop_install_output_oder_property (gobject_class);
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||
gst_msdkcaps_pad_template_init (element_class,
|
||||
cdata->sink_caps, cdata->src_caps, doc_sink_caps_str, doc_src_caps_str);
|
||||
|
||||
gst_caps_unref (cdata->sink_caps);
|
||||
gst_caps_unref (cdata->src_caps);
|
||||
g_free (cdata);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_msdkvp8dec_init (GstMsdkVP8Dec * thiz)
|
||||
gst_msdkvp8dec_init (GTypeInstance * instance, gpointer g_class)
|
||||
{
|
||||
GstMsdkVP8Dec *thiz = GST_MSDKVP8DEC (instance);
|
||||
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_msdkvp8dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank)
|
||||
{
|
||||
GType type;
|
||||
MsdkDecCData *cdata;
|
||||
gchar *type_name, *feature_name;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GTypeInfo type_info = {
|
||||
.class_size = sizeof (GstMsdkVP8DecClass),
|
||||
.class_init = gst_msdkvp8dec_class_init,
|
||||
.instance_size = sizeof (GstMsdkVP8Dec),
|
||||
.instance_init = gst_msdkvp8dec_init
|
||||
};
|
||||
|
||||
cdata = g_new (MsdkDecCData, 1);
|
||||
cdata->sink_caps = gst_caps_ref (sink_caps);
|
||||
cdata->src_caps = gst_caps_copy (src_caps);
|
||||
#ifndef _WIN32
|
||||
cdata->src_caps = gst_caps_ref (src_caps);
|
||||
#else
|
||||
cdata->src_caps = gst_caps_copy (src_caps);
|
||||
gst_msdkcaps_remove_structure (cdata->src_caps, "memory:D3D11Memory");
|
||||
#endif
|
||||
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->sink_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->src_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstMsdkVP8Dec");
|
||||
feature_name = g_strdup ("msdkvp8dec");
|
||||
|
||||
type = g_type_register_static (GST_TYPE_MSDKDEC, type_name, &type_info, 0);
|
||||
if (type)
|
||||
ret = gst_element_register (plugin, feature_name, rank, type);
|
||||
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -37,17 +37,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MSDKVP8DEC \
|
||||
(gst_msdkvp8dec_get_type())
|
||||
#define GST_MSDKVP8DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSDKVP8DEC,GstMsdkVP8Dec))
|
||||
#define GST_MSDKVP8DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MSDKVP8DEC,GstMsdkVP8DecClass))
|
||||
#define GST_IS_MSDKVP8DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSDKVP8DEC))
|
||||
#define GST_IS_MSDKVP8DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKVP8DEC))
|
||||
|
||||
typedef struct _GstMsdkVP8Dec GstMsdkVP8Dec;
|
||||
typedef struct _GstMsdkVP8DecClass GstMsdkVP8DecClass;
|
||||
|
||||
|
@ -62,7 +51,10 @@ struct _GstMsdkVP8DecClass
|
|||
GstMsdkDecClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_msdkvp8dec_get_type (void);
|
||||
gboolean
|
||||
gst_msdkvp8dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -56,39 +56,28 @@
|
|||
GST_DEBUG_CATEGORY_EXTERN (gst_msdkvp9dec_debug);
|
||||
#define GST_CAT_DEFAULT gst_msdkvp9dec_debug
|
||||
|
||||
#define COMMON_FORMAT "{ NV12, P010_10LE, VUYA, Y410, P012_LE, Y412_LE }"
|
||||
#define SUPPORTED_VA_FORMAT "{ NV12 }"
|
||||
#define GST_MSDKVP9DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_FROM_INSTANCE (obj), GstMsdkVP9Dec))
|
||||
#define GST_MSDKVP9DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FROM_CLASS (klass), GstMsdkVP9DecClass))
|
||||
#define GST_IS_MSDKVP9DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_FROM_INSTANCE (obj)))
|
||||
#define GST_IS_MSDKVP9DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FROM_CLASS (klass)))
|
||||
|
||||
#ifndef _WIN32
|
||||
#define VA_SRC_CAPS_STR \
|
||||
"; " GST_MSDK_CAPS_MAKE_WITH_VA_FEATURE (SUPPORTED_VA_FORMAT)
|
||||
#else
|
||||
#define D3D11_SRC_CAPS_STR \
|
||||
"; " GST_MSDK_CAPS_MAKE_WITH_D3D11_FEATURE ("{ NV12 }")
|
||||
#endif
|
||||
/* *INDENT-OFF* */
|
||||
static const gchar *doc_src_caps_str =
|
||||
GST_VIDEO_CAPS_MAKE (
|
||||
"{ NV12, P010_10LE, VUYA, Y410, P012_LE, Y412_LE }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:DMABuf",
|
||||
"{ NV12, P010_10LE, VUYA, Y410, P012_LE, Y412_LE }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:VAMemory", "{ NV12 }") " ;"
|
||||
GST_VIDEO_CAPS_MAKE_WITH_FEATURES ("memory:D3D11Memory", "{ NV12 }");
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-vp9")
|
||||
);
|
||||
static const gchar *doc_sink_caps_str = "video/x-vp9";
|
||||
|
||||
#ifndef _WIN32
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR (COMMON_FORMAT, COMMON_FORMAT)
|
||||
VA_SRC_CAPS_STR));
|
||||
#else
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_MSDK_CAPS_STR (COMMON_FORMAT, COMMON_FORMAT)
|
||||
D3D11_SRC_CAPS_STR));
|
||||
#endif
|
||||
|
||||
#define gst_msdkvp9dec_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstMsdkVP9Dec, gst_msdkvp9dec, GST_TYPE_MSDKDEC);
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_msdkvp9dec_configure (GstMsdkDec * decoder)
|
||||
|
@ -181,11 +170,14 @@ gst_msdkvp9dec_preinit_decoder (GstMsdkDec * decoder)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_msdkvp9dec_class_init (GstMsdkVP9DecClass * klass)
|
||||
gst_msdkvp9dec_class_init (gpointer klass, gpointer data)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
GstMsdkDecClass *decoder_class;
|
||||
MsdkDecCData *cdata = data;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
@ -206,12 +198,58 @@ gst_msdkvp9dec_class_init (GstMsdkVP9DecClass * klass)
|
|||
|
||||
gst_msdkdec_prop_install_output_oder_property (gobject_class);
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||
gst_msdkcaps_pad_template_init (element_class,
|
||||
cdata->sink_caps, cdata->src_caps, doc_sink_caps_str, doc_src_caps_str);
|
||||
|
||||
gst_caps_unref (cdata->sink_caps);
|
||||
gst_caps_unref (cdata->src_caps);
|
||||
g_free (cdata);;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_msdkvp9dec_init (GstMsdkVP9Dec * thiz)
|
||||
gst_msdkvp9dec_init (GTypeInstance * instance, gpointer g_class)
|
||||
{
|
||||
GstMsdkVP9Dec *thiz = GST_MSDKVP9DEC (instance);
|
||||
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_msdkvp9dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank)
|
||||
{
|
||||
GType type;
|
||||
MsdkDecCData *cdata;
|
||||
gchar *type_name, *feature_name;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GTypeInfo type_info = {
|
||||
.class_size = sizeof (GstMsdkVP9DecClass),
|
||||
.class_init = gst_msdkvp9dec_class_init,
|
||||
.instance_size = sizeof (GstMsdkVP9Dec),
|
||||
.instance_init = gst_msdkvp9dec_init
|
||||
};
|
||||
|
||||
cdata = g_new (MsdkDecCData, 1);
|
||||
cdata->sink_caps = gst_caps_ref (sink_caps);
|
||||
cdata->src_caps = gst_caps_ref (src_caps);
|
||||
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->sink_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
GST_MINI_OBJECT_FLAG_SET (cdata->src_caps,
|
||||
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
|
||||
|
||||
type_info.class_data = cdata;
|
||||
|
||||
type_name = g_strdup ("GstMsdkVP9Dec");
|
||||
feature_name = g_strdup ("msdkvp9dec");
|
||||
|
||||
type = g_type_register_static (GST_TYPE_MSDKDEC, type_name, &type_info, 0);
|
||||
if (type)
|
||||
ret = gst_element_register (plugin, feature_name, rank, type);
|
||||
|
||||
g_free (type_name);
|
||||
g_free (feature_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -39,17 +39,6 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MSDKVP9DEC \
|
||||
(gst_msdkvp9dec_get_type())
|
||||
#define GST_MSDKVP9DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSDKVP9DEC,GstMsdkVP9Dec))
|
||||
#define GST_MSDKVP9DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MSDKVP9DEC,GstMsdkVP9DecClass))
|
||||
#define GST_IS_MSDKVP9DEC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSDKVP9DEC))
|
||||
#define GST_IS_MSDKVP9DEC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKVP9DEC))
|
||||
|
||||
typedef struct _GstMsdkVP9Dec GstMsdkVP9Dec;
|
||||
typedef struct _GstMsdkVP9DecClass GstMsdkVP9DecClass;
|
||||
|
||||
|
@ -64,7 +53,10 @@ struct _GstMsdkVP9DecClass
|
|||
GstMsdkDecClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_msdkvp9dec_get_type (void);
|
||||
gboolean
|
||||
gst_msdkvp9dec_register (GstPlugin * plugin,
|
||||
GstMsdkContext * context, GstCaps * sink_caps,
|
||||
GstCaps * src_caps, guint rank);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
Loading…
Reference in a new issue