Commit 83774c3e authored by D Scott Phillips's avatar D Scott Phillips Committed by Josep Torra

msdk: Add H.264 decoder

The decoder only supports system memory output presently.

https://bugzilla.gnome.org/show_bug.cgi?id=774587
parent 23a3a2c5
plugin_LTLIBRARIES = libgstmsdk.la
libgstmsdk_la_SOURCES = \
gstmsdkh264dec.c \
gstmsdkh264enc.c \
gstmsdkh265enc.c \
gstmsdkmpeg2enc.c \
gstmsdkvp8enc.c \
gstmsdkdec.c \
gstmsdkenc.c \
gstmsdk.c
......@@ -13,10 +15,12 @@ nodist_EXTRA_libgstmsdk_la_SOURCES = not_present.cxx
noinst_HEADERS = \
msdk.h \
gstmsdkh264dec.h \
gstmsdkh264enc.h \
gstmsdkh265enc.h \
gstmsdkmpeg2enc.h \
gstmsdkvp8enc.h \
gstmsdkdec.h \
gstmsdkenc.h
libgstmsdk_la_CFLAGS = \
......
......@@ -35,12 +35,15 @@
#include <gst/gst.h>
#include "gstmsdkh264dec.h"
#include "gstmsdkh264enc.h"
#include "gstmsdkh265enc.h"
#include "gstmsdkmpeg2enc.h"
#include "gstmsdkvp8enc.h"
GST_DEBUG_CATEGORY (gst_msdkdec_debug);
GST_DEBUG_CATEGORY (gst_msdkenc_debug);
GST_DEBUG_CATEGORY (gst_msdkh264dec_debug);
GST_DEBUG_CATEGORY (gst_msdkh264enc_debug);
GST_DEBUG_CATEGORY (gst_msdkh265enc_debug);
GST_DEBUG_CATEGORY (gst_msdkmpeg2enc_debug);
......@@ -51,7 +54,10 @@ plugin_init (GstPlugin * plugin)
{
gboolean ret;
GST_DEBUG_CATEGORY_INIT (gst_msdkdec_debug, "msdkdec", 0, "msdkdec");
GST_DEBUG_CATEGORY_INIT (gst_msdkenc_debug, "msdkenc", 0, "msdkenc");
GST_DEBUG_CATEGORY_INIT (gst_msdkh264dec_debug, "msdkh264dec", 0,
"msdkh264dec");
GST_DEBUG_CATEGORY_INIT (gst_msdkh264enc_debug, "msdkh264enc", 0,
"msdkh264enc");
GST_DEBUG_CATEGORY_INIT (gst_msdkh265enc_debug, "msdkh265enc", 0,
......@@ -64,6 +70,9 @@ plugin_init (GstPlugin * plugin)
if (!msdk_is_available ())
return FALSE;
ret = gst_element_register (plugin, "msdkh264dec", GST_RANK_NONE,
GST_TYPE_MSDKH264DEC);
ret = gst_element_register (plugin, "msdkh264enc", GST_RANK_NONE,
GST_TYPE_MSDKH264ENC);
......
This diff is collapsed.
/* 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_MSDKDEC_H__
#define __GST_MSDKDEC_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include "msdk.h"
G_BEGIN_DECLS
#define GST_TYPE_MSDKDEC \
(gst_msdkdec_get_type())
#define GST_MSDKDEC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSDKDEC,GstMsdkDec))
#define GST_MSDKDEC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MSDKDEC,GstMsdkDecClass))
#define GST_MSDKDEC_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_MSDKDEC,GstMsdkDecClass))
#define GST_IS_MSDKDEC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSDKDEC))
#define GST_IS_MSDKDEC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKDEC))
typedef struct _GstMsdkDec GstMsdkDec;
typedef struct _GstMsdkDecClass GstMsdkDecClass;
typedef struct _MsdkDecTask MsdkDecTask;
struct _GstMsdkDec
{
GstVideoDecoder element;
/* input description */
GstVideoCodecState *input_state;
GstVideoInfo output_info;
GstBufferPool *pool;
GstVideoInfo pool_info;
/* MFX context */
MsdkContext *context;
mfxVideoParam param;
GPtrArray *extra_params;
GArray *surfaces;
GArray *tasks;
guint next_task;
/* element properties */
gboolean hardware;
guint async_depth;
};
struct _GstMsdkDecClass
{
GstVideoDecoderClass parent_class;
gboolean (*configure) (GstMsdkDec * decoder);
};
struct _MsdkDecTask
{
mfxFrameSurface1 *surface;
mfxSyncPoint sync_point;
};
GType gst_msdkdec_get_type (void);
G_END_DECLS
#endif /* __GST_MSDKDEC_H__ */
/* 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 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 "gstmsdkh264dec.h"
GST_DEBUG_CATEGORY_EXTERN (gst_msdkh264dec_debug);
#define GST_CAT_DEFAULT gst_msdkh264dec_debug
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-h264, "
"framerate = (fraction) [0/1, MAX], "
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
"stream-format = (string) byte-stream , alignment = (string) au , "
"profile = (string) { high, main, baseline, constrained-baseline }")
);
#define gst_msdkh264dec_parent_class parent_class
G_DEFINE_TYPE (GstMsdkH264Dec, gst_msdkh264dec, GST_TYPE_MSDKDEC);
static gboolean
gst_msdkh264dec_configure (GstMsdkDec * decoder)
{
decoder->param.mfx.CodecId = MFX_CODEC_AVC;
return TRUE;
}
static void
gst_msdkh264dec_class_init (GstMsdkH264DecClass * 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_msdkh264dec_configure);
gst_element_class_set_static_metadata (element_class,
"Intel MSDK H264 decoder",
"Codec/Decoder/Video",
"H264 video decoder based on Intel Media SDK",
"Scott D Phillips <scott.d.phillips@intel.com>");
gst_element_class_add_static_pad_template (element_class, &sink_factory);
}
static void
gst_msdkh264dec_init (GstMsdkH264Dec * thiz)
{
}
/* 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 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_MSDKH264DEC_H__
#define __GST_MSDKH264DEC_H__
#include "gstmsdkdec.h"
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;
struct _GstMsdkH264Dec
{
GstMsdkDec base;
};
struct _GstMsdkH264DecClass
{
GstMsdkDecClass parent_class;
};
GType gst_msdkh264dec_get_type (void);
G_END_DECLS
#endif /* __GST_MSDKH264DEC_H__ */
msdk_sources = [
'gstmsdk.c',
'gstmsdkdec.c',
'gstmsdkenc.c',
'gstmsdkh264dec.c',
'gstmsdkh264enc.c',
'gstmsdkh265enc.c',
'gstmsdkmpeg2enc.c',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment