Commit 409d4ff3 authored by wangfei's avatar wangfei Committed by Víctor Manuel Jáquez Leal

msdkdec: move output-order out of decode bass class.

Since output-order is a deprecated attribute, move it out of decode
bass class and configure it in each sub decoder class who need it.

https://bugzilla.gnome.org/show_bug.cgi?id=796853
parent eaa1bd93
Pipeline #9543 passed with stages
in 4 minutes and 27 seconds
......@@ -22,7 +22,8 @@ libgstmsdk_la_SOURCES = \
gstmsdkvpp.c \
gstmsdk.c \
msdk-enums.c \
gstmsdkvpputil.c
gstmsdkvpputil.c \
gstmsdkdecproputil.c
# Causes linking libgstmsdk.la with CXXLINK, required by libmfx
nodist_EXTRA_libgstmsdk_la_SOURCES = not_present.cxx
......@@ -50,7 +51,8 @@ noinst_HEADERS = \
gstmsdkdec.h \
gstmsdkenc.h \
gstmsdkvpp.h \
gstmsdkvpputil.h
gstmsdkvpputil.h \
gstmsdkdecproputil.h
# Conditional build for vp9 decoder
libgstmsdk_vp9dec_source_c = gstmsdkvp9dec.c
......
......@@ -40,7 +40,6 @@
#include "gstmsdkvideomemory.h"
#include "gstmsdksystemmemory.h"
#include "gstmsdkcontextutil.h"
#include "msdk-enums.h"
GST_DEBUG_CATEGORY_EXTERN (gst_msdkdec_debug);
#define GST_CAT_DEFAULT gst_msdkdec_debug
......@@ -57,17 +56,8 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
"{ NV12 }") ";")
);
enum
{
PROP_0,
PROP_HARDWARE,
PROP_ASYNC_DEPTH,
PROP_OUTPUT_ORDER,
};
#define PROP_HARDWARE_DEFAULT TRUE
#define PROP_ASYNC_DEPTH_DEFAULT 1
#define PROP_OUTPUT_ORDER_DEFAULT GST_MSDKDEC_OUTPUT_ORDER_DISPLAY
#define IS_ALIGNED(i, n) (((i) & ((n)-1)) == 0)
......@@ -305,10 +295,6 @@ gst_msdkdec_init_decoder (GstMsdkDec * thiz)
thiz->use_video_memory ? "video" : "system");
thiz->param.AsyncDepth = thiz->async_depth;
/* This is a deprecated attribute in msdk-2017 version, but some
* customers still using this for low-latency streaming of non-b-frame
* encoded streams */
thiz->param.mfx.DecodedOrder = thiz->output_order;
/* We expect msdk to fill the width and height values */
g_return_val_if_fail (thiz->param.mfx.FrameInfo.Width
......@@ -1344,15 +1330,12 @@ gst_msdkdec_set_property (GObject * object, guint prop_id, const GValue * value,
goto wrong_state;
switch (prop_id) {
case PROP_HARDWARE:
case GST_MSDKDEC_PROP_HARDWARE:
thiz->hardware = g_value_get_boolean (value);
break;
case PROP_ASYNC_DEPTH:
case GST_MSDKDEC_PROP_ASYNC_DEPTH:
thiz->async_depth = g_value_get_uint (value);
break;
case PROP_OUTPUT_ORDER:
thiz->output_order = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -1376,15 +1359,12 @@ gst_msdkdec_get_property (GObject * object, guint prop_id, GValue * value,
GST_OBJECT_LOCK (thiz);
switch (prop_id) {
case PROP_HARDWARE:
case GST_MSDKDEC_PROP_HARDWARE:
g_value_set_boolean (value, thiz->hardware);
break;
case PROP_ASYNC_DEPTH:
case GST_MSDKDEC_PROP_ASYNC_DEPTH:
g_value_set_uint (value, thiz->async_depth);
break;
case PROP_OUTPUT_ORDER:
g_value_set_enum (value, thiz->output_order);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -1429,23 +1409,16 @@ gst_msdkdec_class_init (GstMsdkDecClass * klass)
decoder_class->flush = GST_DEBUG_FUNCPTR (gst_msdkdec_flush);
decoder_class->drain = GST_DEBUG_FUNCPTR (gst_msdkdec_drain);
g_object_class_install_property (gobject_class, PROP_HARDWARE,
g_object_class_install_property (gobject_class, GST_MSDKDEC_PROP_HARDWARE,
g_param_spec_boolean ("hardware", "Hardware", "Enable hardware decoders",
PROP_HARDWARE_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_ASYNC_DEPTH,
g_object_class_install_property (gobject_class, GST_MSDKDEC_PROP_ASYNC_DEPTH,
g_param_spec_uint ("async-depth", "Async Depth",
"Depth of asynchronous pipeline",
1, 20, PROP_ASYNC_DEPTH_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_OUTPUT_ORDER,
g_param_spec_enum ("output-order", "DecodedFramesOutputOrder",
"Decoded frames output order",
gst_msdkdec_output_order_get_type (),
PROP_OUTPUT_ORDER_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_static_pad_template (element_class, &src_factory);
}
......@@ -1457,7 +1430,6 @@ gst_msdkdec_init (GstMsdkDec * thiz)
thiz->tasks = g_array_new (FALSE, TRUE, sizeof (MsdkDecTask));
thiz->hardware = PROP_HARDWARE_DEFAULT;
thiz->async_depth = PROP_ASYNC_DEPTH_DEFAULT;
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
thiz->is_packetized = TRUE;
thiz->do_renego = TRUE;
thiz->do_realloc = TRUE;
......
......@@ -36,6 +36,8 @@
#include <gst/video/video.h>
#include "msdk.h"
#include "gstmsdkcontext.h"
#include "msdk-enums.h"
#include "gstmsdkdecproputil.h"
G_BEGIN_DECLS
......@@ -98,7 +100,6 @@ struct _GstMsdkDec
/* element properties */
gboolean hardware;
guint async_depth;
guint output_order;
};
struct _GstMsdkDecClass
......
/* GStreamer Intel MSDK plugin
* Copyright (c) 2016, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "gstmsdkdecproputil.h"
void
gst_msdkdec_prop_install_output_oder_property (GObjectClass * gobject_class)
{
g_object_class_install_property (gobject_class, GST_MSDKDEC_PROP_OUTPUT_ORDER,
g_param_spec_enum ("output-order", "DecodedFramesOutputOrder",
"Decoded frames output order",
gst_msdkdec_output_order_get_type (),
PROP_OUTPUT_ORDER_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
gboolean
gst_msdkdec_prop_check_state (GstState state, GParamSpec * pspec)
{
if ((state != GST_STATE_READY && state != GST_STATE_NULL) &&
!(pspec->flags & GST_PARAM_MUTABLE_PLAYING)) {
return FALSE;
}
return TRUE;
}
/* GStreamer Intel MSDK plugin
* Copyright (c) 2016, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GST_MSDKDECPROPUTIL_H
#define GST_MSDKDECPROPUTIL_H
#include "msdk-enums.h"
G_BEGIN_DECLS
#define PROP_OUTPUT_ORDER_DEFAULT GST_MSDKDEC_OUTPUT_ORDER_DISPLAY
enum
{
GST_MSDKDEC_PROP_0,
GST_MSDKDEC_PROP_HARDWARE,
GST_MSDKDEC_PROP_ASYNC_DEPTH,
GST_MSDKDEC_PROP_OUTPUT_ORDER,
};
void
gst_msdkdec_prop_install_output_oder_property(GObjectClass * gobject_class);
gboolean
gst_msdkdec_prop_check_state(GstState state, GParamSpec * pspec);
G_END_DECLS
#endif /* GST_MSDKDECPROPUTIL_H */
......@@ -53,19 +53,76 @@ G_DEFINE_TYPE (GstMsdkH264Dec, gst_msdkh264dec, GST_TYPE_MSDKDEC);
static gboolean
gst_msdkh264dec_configure (GstMsdkDec * decoder)
{
GstMsdkH264Dec *h264dec = GST_MSDKH264DEC (decoder);
decoder->param.mfx.CodecId = MFX_CODEC_AVC;
/* This is a deprecated attribute in msdk-2017 version, but some
* customers still using this for low-latency streaming of non-b-frame
* encoded streams */
decoder->param.mfx.DecodedOrder = h264dec->output_order;
return TRUE;
}
static void
gst_msdkdec_h264_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMsdkH264Dec *thiz = GST_MSDKH264DEC (object);
GstState state;
GST_OBJECT_LOCK (thiz);
state = GST_STATE (thiz);
if (!gst_msdkdec_prop_check_state (state, pspec)) {
GST_WARNING_OBJECT (thiz, "setting property in wrong state");
GST_OBJECT_UNLOCK (thiz);
return;
}
switch (prop_id) {
case GST_MSDKDEC_PROP_OUTPUT_ORDER:
thiz->output_order = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (thiz);
return;
}
static void
gst_msdkdec_h264_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMsdkH264Dec *thiz = GST_MSDKH264DEC (object);
GST_OBJECT_LOCK (thiz);
switch (prop_id) {
case GST_MSDKDEC_PROP_OUTPUT_ORDER:
g_value_set_enum (value, thiz->output_order);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (thiz);
}
static void
gst_msdkh264dec_class_init (GstMsdkH264DecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstMsdkDecClass *decoder_class;
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
decoder_class = GST_MSDKDEC_CLASS (klass);
gobject_class->set_property = gst_msdkdec_h264_set_property;
gobject_class->get_property = gst_msdkdec_h264_get_property;
decoder_class->configure = GST_DEBUG_FUNCPTR (gst_msdkh264dec_configure);
gst_element_class_set_static_metadata (element_class,
......@@ -74,10 +131,13 @@ gst_msdkh264dec_class_init (GstMsdkH264DecClass * klass)
"H264 video decoder based on Intel Media SDK",
"Scott D Phillips <scott.d.phillips@intel.com>");
gst_msdkdec_prop_install_output_oder_property (gobject_class);
gst_element_class_add_static_pad_template (element_class, &sink_factory);
}
static void
gst_msdkh264dec_init (GstMsdkH264Dec * thiz)
{
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
}
......@@ -53,6 +53,7 @@ typedef struct _GstMsdkH264DecClass GstMsdkH264DecClass;
struct _GstMsdkH264Dec
{
GstMsdkDec base;
guint output_order;
};
struct _GstMsdkH264DecClass
......
......@@ -83,18 +83,73 @@ gst_msdkh265dec_configure (GstMsdkDec * decoder)
decoder->param.mfx.CodecId = MFX_CODEC_HEVC;
decoder->param.mfx.CodecProfile = MFX_PROFILE_HEVC_MAIN;
/* This is a deprecated attribute in msdk-2017 version, but some
* customers still using this for low-latency streaming of non-b-frame
* encoded streams */
decoder->param.mfx.DecodedOrder = h265dec->output_order;
return TRUE;
}
static void
gst_msdkdec_h265_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMsdkH265Dec *thiz = GST_MSDKH265DEC (object);
GstState state;
GST_OBJECT_LOCK (thiz);
state = GST_STATE (thiz);
if (!gst_msdkdec_prop_check_state (state, pspec)) {
GST_WARNING_OBJECT (thiz, "setting property in wrong state");
GST_OBJECT_UNLOCK (thiz);
return;
}
switch (prop_id) {
case GST_MSDKDEC_PROP_OUTPUT_ORDER:
thiz->output_order = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (thiz);
return;
}
static void
gst_msdkdec_h265_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMsdkH265Dec *thiz = GST_MSDKH265DEC (object);
GST_OBJECT_LOCK (thiz);
switch (prop_id) {
case GST_MSDKDEC_PROP_OUTPUT_ORDER:
g_value_set_enum (value, thiz->output_order);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (thiz);
}
static void
gst_msdkh265dec_class_init (GstMsdkH265DecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstMsdkDecClass *decoder_class;
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
decoder_class = GST_MSDKDEC_CLASS (klass);
gobject_class->set_property = gst_msdkdec_h265_set_property;
gobject_class->get_property = gst_msdkdec_h265_get_property;
decoder_class->configure = GST_DEBUG_FUNCPTR (gst_msdkh265dec_configure);
gst_element_class_set_static_metadata (element_class,
......@@ -103,10 +158,13 @@ gst_msdkh265dec_class_init (GstMsdkH265DecClass * klass)
"H265 video decoder based on Intel Media SDK",
"Scott D Phillips <scott.d.phillips@intel.com>");
gst_msdkdec_prop_install_output_oder_property (gobject_class);
gst_element_class_add_static_pad_template (element_class, &sink_factory);
}
static void
gst_msdkh265dec_init (GstMsdkH265Dec * thiz)
{
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
}
......@@ -53,6 +53,7 @@ typedef struct _GstMsdkH265DecClass GstMsdkH265DecClass;
struct _GstMsdkH265Dec
{
GstMsdkDec base;
guint output_order;
};
struct _GstMsdkH265DecClass
......
......@@ -55,19 +55,75 @@ G_DEFINE_TYPE (GstMsdkMPEG2Dec, gst_msdkmpeg2dec, GST_TYPE_MSDKDEC);
static gboolean
gst_msdkmpeg2dec_configure (GstMsdkDec * decoder)
{
GstMsdkMPEG2Dec *mpeg2dec = GST_MSDKMPEG2DEC (decoder);
decoder->param.mfx.CodecId = MFX_CODEC_MPEG2;
/* This is a deprecated attribute in msdk-2017 version, but some
* customers still using this for low-latency streaming of non-b-frame
* encoded streams */
decoder->param.mfx.DecodedOrder = mpeg2dec->output_order;
return TRUE;
}
static void
gst_msdkdec_mpeg2_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMsdkMPEG2Dec *thiz = GST_MSDKMPEG2DEC (object);
GstState state;
GST_OBJECT_LOCK (thiz);
state = GST_STATE (thiz);
if (!gst_msdkdec_prop_check_state (state, pspec)) {
GST_WARNING_OBJECT (thiz, "setting property in wrong state");
GST_OBJECT_UNLOCK (thiz);
return;
}
switch (prop_id) {
case GST_MSDKDEC_PROP_OUTPUT_ORDER:
thiz->output_order = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (thiz);
return;
}
static void
gst_msdkdec_mpeg2_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMsdkMPEG2Dec *thiz = GST_MSDKMPEG2DEC (object);
GST_OBJECT_LOCK (thiz);
switch (prop_id) {
case GST_MSDKDEC_PROP_OUTPUT_ORDER:
g_value_set_enum (value, thiz->output_order);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (thiz);
}
static void
gst_msdkmpeg2dec_class_init (GstMsdkMPEG2DecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstMsdkDecClass *decoder_class;
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
decoder_class = GST_MSDKDEC_CLASS (klass);
gobject_class->set_property = gst_msdkdec_mpeg2_set_property;
gobject_class->get_property = gst_msdkdec_mpeg2_get_property;
decoder_class->configure = GST_DEBUG_FUNCPTR (gst_msdkmpeg2dec_configure);
gst_element_class_set_static_metadata (element_class,
......@@ -76,10 +132,13 @@ gst_msdkmpeg2dec_class_init (GstMsdkMPEG2DecClass * klass)
"MPEG2 video decoder based on Intel Media SDK",
"Sreerenj Balachandran <sreerenj.balachandran@intel.com>");
gst_msdkdec_prop_install_output_oder_property (gobject_class);
gst_element_class_add_static_pad_template (element_class, &sink_factory);
}
static void
gst_msdkmpeg2dec_init (GstMsdkMPEG2Dec * thiz)
{
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
}
......@@ -55,6 +55,7 @@ typedef struct _GstMsdkMPEG2DecClass GstMsdkMPEG2DecClass;
struct _GstMsdkMPEG2Dec
{
GstMsdkDec base;
guint output_order;
};
struct _GstMsdkMPEG2DecClass
......
......@@ -68,6 +68,7 @@ G_DEFINE_TYPE (GstMsdkVC1Dec, gst_msdkvc1dec, GST_TYPE_MSDKDEC);
static gboolean
gst_msdkvc1dec_configure (GstMsdkDec * decoder)
{
GstMsdkVC1Dec *vc1dec = GST_MSDKVC1DEC (decoder);
GstBuffer *buffer;
GstCaps *caps;
GstStructure *structure;
......@@ -104,18 +105,74 @@ gst_msdkvc1dec_configure (GstMsdkDec * decoder)
decoder->is_packetized = FALSE;
}
/* This is a deprecated attribute in msdk-2017 version, but some
* customers still using this for low-latency streaming of non-b-frame
* encoded streams */
decoder->param.mfx.DecodedOrder = vc1dec->output_order;
return TRUE;
return TRUE;
}
static void
gst_msdkdec_vc1_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMsdkVC1Dec *thiz = GST_MSDKVC1DEC (object);
GstState state;
GST_OBJECT_LOCK (thiz);
state = GST_STATE (thiz);
if (!gst_msdkdec_prop_check_state (state, pspec)) {
GST_WARNING_OBJECT (thiz, "setting property in wrong state");
GST_OBJECT_UNLOCK (thiz);
return;
}
switch (prop_id) {
case GST_MSDKDEC_PROP_OUTPUT_ORDER:
thiz->output_order = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (thiz);
return;
}
static void
gst_msdkdec_vc1_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMsdkVC1Dec *thiz = GST_MSDKVC1DEC (object);
GST_OBJECT_LOCK (thiz);
switch (prop_id) {
case GST_MSDKDEC_PROP_OUTPUT_ORDER:
g_value_set_enum (value, thiz->output_order);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (thiz);
}
static void
gst_msdkvc1dec_class_init (GstMsdkVC1DecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstMsdkDecClass *decoder_class;
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
decoder_class = GST_MSDKDEC_CLASS (klass);
gobject_class->set_property = gst_msdkdec_vc1_set_property;
gobject_class->get_property = gst_msdkdec_vc1_get_property;
decoder_class->configure = GST_DEBUG_FUNCPTR (gst_msdkvc1dec_configure);
gst_element_class_set_static_metadata (element_class,
......@@ -124,10 +181,13 @@ gst_msdkvc1dec_class_init (GstMsdkVC1DecClass * klass)
"VC1/WMV video decoder based on Intel Media SDK",
"Sreerenj Balachandran <sreerenj.balachandran@intel.com>");
gst_msdkdec_prop_install_output_oder_property (gobject_class);
gst_element_class_add_static_pad_template (element_class, &sink_factory);
}
static void
gst_msdkvc1dec_init (GstMsdkVC1Dec * thiz)
{
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
}
......@@ -55,6 +55,7 @@ typedef struct _GstMsdkVC1DecClass GstMsdkVC1DecClass;
struct _GstMsdkVC1Dec
{
GstMsdkDec base;
guint output_order;
};
struct _GstMsdkVC1DecClass
......
......@@ -85,18 +85,72 @@ gst_msdkvp8dec_configure (GstMsdkDec * decoder)
decoder->param.mfx.FrameInfo.Height =
GST_ROUND_UP_16 (decoder->param.mfx.FrameInfo.CropH);
/* This is a deprecated attribute in msdk-2017 version, but some
* customers still using this for low-latency streaming of non-b-frame
* encoded streams */
decoder->param.mfx.DecodedOrder = vp8dec->output_order;
return TRUE;
}
static void
gst_msdkdec_vp8_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMsdkVP8Dec *thiz = GST_MSDKVP8DEC (object);
GstState state;
GST_OBJECT_LOCK (thiz);
state = GST_STATE (thiz);
if (!gst_msdkdec_prop_check_state (state, pspec)) {
GST_WARNING_OBJECT (thiz, "setting property in wrong state");
GST_OBJECT_UNLOCK (thiz);
return;
}
switch (prop_id) {
case GST_MSDKDEC_PROP_OUTPUT_ORDER:
thiz->output_order = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (thiz);
return;
}
static void
gst_msdkdec_vp8_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMsdkVP8Dec *thiz = GST_MSDKVP8DEC (object);
GST_OBJECT_LOCK (thiz);
switch (prop_id) {
case GST_MSDKDEC_PROP_OUTPUT_ORDER:
g_value_set_enum (value, thiz->output_order);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
GST_OBJECT_UNLOCK (thiz);
}
static void
gst_msdkvp8dec_class_init (GstMsdkVP8DecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstMsdkDecClass *decoder_class;
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
decoder_class = GST_MSDKDEC_CLASS (klass);
gobject_class->set_property = gst_msdkdec_vp8_set_property;
gobject_class->get_property = gst_msdkdec_vp8_get_property;
decoder_class->configure = GST_DEBUG_FUNCPTR (gst_msdkvp8dec_configure);
gst_element_class_set_static_metadata (element_class,
......@@ -105,10 +159,13 @@ gst_msdkvp8dec_class_init (GstMsdkVP8DecClass * klass)
"VP8 video decoder based on Intel Media SDK",
"Hyunjun Ko <zzoon@igalia.com>");
gst_msdkdec_prop_install_output_oder_property (gobject_class);
gst_element_class_add_static_pad_template (element_class, &sink_factory);
}
static void
gst_msdkvp8dec_init (GstMsdkVP8Dec * thiz)
{
thiz->output_order = PROP_OUTPUT_ORDER_DEFAULT;
}
......@@ -54,6 +54,7 @@ typedef struct _GstMsdkVP8DecClass GstMsdkVP8DecClass;
struct _GstMsdkVP8Dec
{
GstMsdkDec base;
guint output_order;
};