msdk: Add VC1 decoder (simple and main profiles)

Adding Simple and Main profiles decode support.

Currently msdkvc1dec is not capable to handle the codec_data,
only instream headers are supported. Also msdk vc1 decoder
expecting instream with Sequence header as per SMPTE 421M Annex L.

Most of the decdoebin/playbin pipeline won't work with the above
constraints
because vc1parse is still not an autoplug element.

Only way to make mskdvc1dec work is by connecting a vc1parse
as an upstream element.

https://bugzilla.gnome.org/show_bug.cgi?id=792589
This commit is contained in:
Sreerenj Balachandran 2018-02-13 14:40:54 -09:00
parent b622d21d6a
commit 760e6e54a7
5 changed files with 189 additions and 1 deletions

View file

@ -16,6 +16,7 @@ libgstmsdk_la_SOURCES = \
gstmsdkmpeg2enc.c \
gstmsdkvp8dec.c \
gstmsdkvp8enc.c \
gstmsdkvc1dec.c \
gstmsdkdec.c \
gstmsdkenc.c \
gstmsdk.c
@ -40,6 +41,7 @@ noinst_HEADERS = \
gstmsdkmpeg2enc.h \
gstmsdkvp8dec.h \
gstmsdkvp8enc.h \
gstmsdkvc1dec.h \
gstmsdkdec.h \
gstmsdkenc.h

View file

@ -45,6 +45,7 @@
#include "gstmsdkmpeg2enc.h"
#include "gstmsdkvp8dec.h"
#include "gstmsdkvp8enc.h"
#include "gstmsdkvc1dec.h"
GST_DEBUG_CATEGORY (gst_msdkdec_debug);
GST_DEBUG_CATEGORY (gst_msdkenc_debug);
@ -58,6 +59,7 @@ GST_DEBUG_CATEGORY (gst_msdkmpeg2enc_debug);
GST_DEBUG_CATEGORY (gst_msdkmpeg2dec_debug);
GST_DEBUG_CATEGORY (gst_msdkvp8dec_debug);
GST_DEBUG_CATEGORY (gst_msdkvp8enc_debug);
GST_DEBUG_CATEGORY (gst_msdkvc1dec_debug);
static gboolean
plugin_init (GstPlugin * plugin)
@ -84,7 +86,7 @@ plugin_init (GstPlugin * plugin)
"msdkmpeg2dec");
GST_DEBUG_CATEGORY_INIT (gst_msdkvp8dec_debug, "msdkvp8dec", 0, "msdkvp8dec");
GST_DEBUG_CATEGORY_INIT (gst_msdkvp8enc_debug, "msdkvp8enc", 0, "msdkvp8enc");
GST_DEBUG_CATEGORY_INIT (gst_msdkvc1dec_debug, "msdkvc1dec", 0, "msdkvc1dec");
if (!msdk_is_available ())
return FALSE;
@ -119,6 +121,9 @@ plugin_init (GstPlugin * plugin)
ret = gst_element_register (plugin, "msdkvp8enc", GST_RANK_NONE,
GST_TYPE_MSDKVP8ENC);
ret = gst_element_register (plugin, "msdkvc1dec", GST_RANK_NONE,
GST_TYPE_MSDKVC1DEC);
return ret;
}

111
sys/msdk/gstmsdkvc1dec.c Normal file
View file

@ -0,0 +1,111 @@
/* GStreamer Intel MSDK plugin
* Copyright (c) 2018, Intel Corporation
* All rights reserved.
*
* Sreerenj Balachandran <sreerenj.balachandran@intel.com>
*
* 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 NEGLIGDECE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "gstmsdkvc1dec.h"
GST_DEBUG_CATEGORY_EXTERN (gst_msdkvc1dec_debug);
#define GST_CAT_DEFAULT gst_msdkvc1dec_debug
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}")
);
#define gst_msdkvc1dec_parent_class parent_class
G_DEFINE_TYPE (GstMsdkVC1Dec, gst_msdkvc1dec, GST_TYPE_MSDKDEC);
static gboolean
gst_msdkvc1dec_configure (GstMsdkDec * decoder)
{
GstCaps *caps;
GstStructure *structure;
const gchar *profile_str;
caps = decoder->input_state->caps;
if (!caps)
return FALSE;
structure = gst_caps_get_structure (caps, 0);
if (!structure)
return FALSE;
profile_str = gst_structure_get_string (structure, "profile");
decoder->param.mfx.CodecId = MFX_CODEC_VC1;
if (!strcmp (profile_str, "simple"))
decoder->param.mfx.CodecProfile = MFX_PROFILE_VC1_SIMPLE;
else if (!strcmp (profile_str, "main"))
decoder->param.mfx.CodecProfile = MFX_PROFILE_VC1_MAIN;
else
return FALSE;
return TRUE;
}
static void
gst_msdkvc1dec_class_init (GstMsdkVC1DecClass * klass)
{
GstElementClass *element_class;
GstMsdkDecClass *decoder_class;
element_class = GST_ELEMENT_CLASS (klass);
decoder_class = GST_MSDKDEC_CLASS (klass);
decoder_class->configure = GST_DEBUG_FUNCPTR (gst_msdkvc1dec_configure);
gst_element_class_set_static_metadata (element_class,
"Intel MSDK VC1 decoder",
"Codec/Decoder/Video",
"VC1/WMV video decoder based on Intel Media SDK",
"Sreerenj Balachandran <sreerenj.balachandran@intel.com>");
gst_element_class_add_static_pad_template (element_class, &sink_factory);
}
static void
gst_msdkvc1dec_init (GstMsdkVC1Dec * thiz)
{
}

69
sys/msdk/gstmsdkvc1dec.h Normal file
View file

@ -0,0 +1,69 @@
/* GStreamer Intel MSDK plugin
* Copyright (c) 2018, Intel Corporation
* All rights reserved.
*
* Author: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
*
* 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 NEGLIGDECE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __GST_MSDKVC1DEC_H__
#define __GST_MSDKVC1DEC_H__
#include "gstmsdkdec.h"
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;
struct _GstMsdkVC1Dec
{
GstMsdkDec base;
};
struct _GstMsdkVC1DecClass
{
GstMsdkDecClass parent_class;
};
GType gst_msdkvc1dec_get_type (void);
G_END_DECLS
#endif /* __GST_MSDKVC1DEC_H__ */

View file

@ -17,6 +17,7 @@ msdk_sources = [
'gstmsdkmpeg2enc.c',
'gstmsdkvp8dec.c',
'gstmsdkvp8enc.c',
'gstmsdkvc1dec.c',
'msdk.c',
]