mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-22 10:23:47 +00:00
mfc: Port to GStreamer 1.0
This commit is contained in:
parent
01da756491
commit
902e72874a
3 changed files with 28 additions and 29 deletions
|
@ -16,7 +16,7 @@ libgstmfc_la_CFLAGS = \
|
||||||
-I$(srcdir)
|
-I$(srcdir)
|
||||||
libgstmfc_la_LIBADD = \
|
libgstmfc_la_LIBADD = \
|
||||||
$(GST_PLUGINS_BASE_LIBS) \
|
$(GST_PLUGINS_BASE_LIBS) \
|
||||||
-lgstvideo-@GST_MAJORMINOR@ \
|
-lgstvideo-@GST_API_VERSION@ \
|
||||||
$(GST_BASE_LIBS) \
|
$(GST_BASE_LIBS) \
|
||||||
$(GST_LIBS)
|
$(GST_LIBS)
|
||||||
libgstmfc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
libgstmfc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
|
|
|
@ -38,6 +38,6 @@ plugin_init (GstPlugin * plugin)
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
GST_VERSION_MINOR,
|
GST_VERSION_MINOR,
|
||||||
"mfc",
|
mfc,
|
||||||
"Samsung Exynos MFC plugin",
|
"Samsung Exynos MFC plugin",
|
||||||
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|
||||||
|
|
|
@ -52,37 +52,33 @@ static GstStaticPadTemplate gst_mfc_dec_src_template =
|
||||||
GST_STATIC_PAD_TEMPLATE ("src",
|
GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("NV12"))
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("NV12"))
|
||||||
);
|
);
|
||||||
|
|
||||||
GST_BOILERPLATE (GstMFCDec, gst_mfc_dec, GstVideoDecoder,
|
#define parent_class gst_mfc_dec_parent_class
|
||||||
GST_TYPE_VIDEO_DECODER);
|
G_DEFINE_TYPE (GstMFCDec, gst_mfc_dec, GST_TYPE_VIDEO_DECODER);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_mfc_dec_base_init (gpointer g_class)
|
gst_mfc_dec_class_init (GstMFCDecClass * klass)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = (GstElementClass *) g_class;
|
GstElementClass *element_class;
|
||||||
|
GstVideoDecoderClass *video_decoder_class;
|
||||||
|
|
||||||
|
element_class = (GstElementClass *) klass;
|
||||||
|
video_decoder_class = (GstVideoDecoderClass *) klass;
|
||||||
|
|
||||||
|
mfc_dec_init_debug ();
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
gst_element_class_add_pad_template (element_class,
|
||||||
gst_static_pad_template_get (&gst_mfc_dec_src_template));
|
gst_static_pad_template_get (&gst_mfc_dec_src_template));
|
||||||
gst_element_class_add_pad_template (element_class,
|
gst_element_class_add_pad_template (element_class,
|
||||||
gst_static_pad_template_get (&gst_mfc_dec_sink_template));
|
gst_static_pad_template_get (&gst_mfc_dec_sink_template));
|
||||||
|
|
||||||
gst_element_class_set_details_simple (element_class,
|
gst_element_class_set_static_metadata (element_class,
|
||||||
"Samsung Exynos MFC decoder",
|
"Samsung Exynos MFC decoder",
|
||||||
"Codec/Decoder/Video",
|
"Codec/Decoder/Video",
|
||||||
"Decode video streams via Samsung Exynos",
|
"Decode video streams via Samsung Exynos",
|
||||||
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
|
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_mfc_dec_class_init (GstMFCDecClass * klass)
|
|
||||||
{
|
|
||||||
GstVideoDecoderClass *video_decoder_class;
|
|
||||||
|
|
||||||
video_decoder_class = (GstVideoDecoderClass *) klass;
|
|
||||||
|
|
||||||
mfc_dec_init_debug ();
|
|
||||||
|
|
||||||
video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_mfc_dec_start);
|
video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_mfc_dec_start);
|
||||||
video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_mfc_dec_stop);
|
video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_mfc_dec_stop);
|
||||||
|
@ -97,7 +93,7 @@ gst_mfc_dec_class_init (GstMFCDecClass * klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_mfc_dec_init (GstMFCDec * self, GstMFCDecClass * klass)
|
gst_mfc_dec_init (GstMFCDec * self)
|
||||||
{
|
{
|
||||||
GstVideoDecoder *decoder = (GstVideoDecoder *) self;
|
GstVideoDecoder *decoder = (GstVideoDecoder *) self;
|
||||||
|
|
||||||
|
@ -192,8 +188,7 @@ gst_mfc_dec_queue_input (GstMFCDec * self, GstBuffer * inbuf)
|
||||||
struct mfc_buffer *mfc_inbuf = NULL;
|
struct mfc_buffer *mfc_inbuf = NULL;
|
||||||
guint8 *mfc_inbuf_data;
|
guint8 *mfc_inbuf_data;
|
||||||
gint mfc_inbuf_size;
|
gint mfc_inbuf_size;
|
||||||
const guint8 *inbuf_data;
|
GstMapInfo map;
|
||||||
gsize inbuf_size;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "Dequeueing input");
|
GST_DEBUG_OBJECT (self, "Dequeueing input");
|
||||||
|
|
||||||
|
@ -210,8 +205,7 @@ gst_mfc_dec_queue_input (GstMFCDec * self, GstBuffer * inbuf)
|
||||||
g_assert (mfc_inbuf != NULL);
|
g_assert (mfc_inbuf != NULL);
|
||||||
|
|
||||||
if (inbuf) {
|
if (inbuf) {
|
||||||
inbuf_data = GST_BUFFER_DATA (inbuf);
|
gst_buffer_map (inbuf, &map, GST_MAP_READ);
|
||||||
inbuf_size = GST_BUFFER_SIZE (inbuf);
|
|
||||||
|
|
||||||
mfc_inbuf_data = mfc_buffer_get_input_data (mfc_inbuf);
|
mfc_inbuf_data = mfc_buffer_get_input_data (mfc_inbuf);
|
||||||
g_assert (mfc_inbuf_data != NULL);
|
g_assert (mfc_inbuf_data != NULL);
|
||||||
|
@ -220,11 +214,13 @@ gst_mfc_dec_queue_input (GstMFCDec * self, GstBuffer * inbuf)
|
||||||
GST_DEBUG_OBJECT (self, "Have input buffer %p with size %d", mfc_inbuf_data,
|
GST_DEBUG_OBJECT (self, "Have input buffer %p with size %d", mfc_inbuf_data,
|
||||||
mfc_inbuf_size);
|
mfc_inbuf_size);
|
||||||
|
|
||||||
if (mfc_inbuf_size < inbuf_size)
|
if (mfc_inbuf_size < map.size)
|
||||||
goto too_small_inbuf;
|
goto too_small_inbuf;
|
||||||
|
|
||||||
memcpy (mfc_inbuf_data, inbuf_data, inbuf_size);
|
memcpy (mfc_inbuf_data, map.data, map.size);
|
||||||
mfc_buffer_set_input_size (mfc_inbuf, inbuf_size);
|
mfc_buffer_set_input_size (mfc_inbuf, map.size);
|
||||||
|
|
||||||
|
gst_buffer_unmap (inbuf, &map);
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (self, "Passing EOS input buffer");
|
GST_DEBUG_OBJECT (self, "Passing EOS input buffer");
|
||||||
|
|
||||||
|
@ -249,8 +245,9 @@ dequeue_error:
|
||||||
too_small_inbuf:
|
too_small_inbuf:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (self, STREAM, FORMAT, ("Too large input frames"),
|
GST_ELEMENT_ERROR (self, STREAM, FORMAT, ("Too large input frames"),
|
||||||
("Maximum size %d, got %d", mfc_inbuf_size, inbuf_size));
|
("Maximum size %d, got %d", mfc_inbuf_size, map.size));
|
||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
|
gst_buffer_unmap (inbuf, &map);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,14 +360,16 @@ gst_mfc_dec_dequeue_output (GstMFCDec * self)
|
||||||
|
|
||||||
}
|
}
|
||||||
ret =
|
ret =
|
||||||
gst_video_decoder_alloc_output_frame (GST_VIDEO_DECODER (self), frame);
|
gst_video_decoder_allocate_output_frame (GST_VIDEO_DECODER (self),
|
||||||
|
frame);
|
||||||
|
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
goto alloc_error;
|
goto alloc_error;
|
||||||
|
|
||||||
outbuf = frame->output_buffer;
|
outbuf = frame->output_buffer;
|
||||||
} else {
|
} else {
|
||||||
outbuf = gst_video_decoder_alloc_output_buffer (GST_VIDEO_DECODER (self));
|
outbuf =
|
||||||
|
gst_video_decoder_allocate_output_buffer (GST_VIDEO_DECODER (self));
|
||||||
|
|
||||||
if (!outbuf) {
|
if (!outbuf) {
|
||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
|
|
Loading…
Reference in a new issue