summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2013-03-18 16:30:40 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2013-03-18 16:34:51 +0100
commitd9d46263c67ac6f5068ca909d8d696326e6eef67 (patch)
tree6c1acc6f35a45dfbcfc4eb1ca9dbb57b750904c0
parent0f5e6e967bcaf83af8fde0b51327295666192634 (diff)
downloadgst-omx-d9d46263c67ac6f5068ca909d8d696326e6eef67.tar.gz
omx: Add MJPEG decoder support
-rw-r--r--omx/Makefile.am2
-rw-r--r--omx/gstomx.c5
-rw-r--r--omx/gstomxmjpegdec.c97
-rw-r--r--omx/gstomxmjpegdec.h60
4 files changed, 162 insertions, 2 deletions
diff --git a/omx/Makefile.am b/omx/Makefile.am
index adbc9ab..2e16f7c 100644
--- a/omx/Makefile.am
+++ b/omx/Makefile.am
@@ -10,6 +10,7 @@ libgstomx_la_SOURCES = \
gstomxvideodec.c \
gstomxvideoenc.c \
gstomxaudioenc.c \
+ gstomxmjpegdec.c \
gstomxmpeg4videodec.c \
gstomxmpeg2dec.c \
gstomxh264dec.c \
@@ -26,6 +27,7 @@ noinst_HEADERS = \
gstomxvideodec.h \
gstomxvideoenc.h \
gstomxaudioenc.h \
+ gstomxmjpegdec.h \
gstomxmpeg2dec.h \
gstomxmpeg4videodec.h \
gstomxh264dec.h \
diff --git a/omx/gstomx.c b/omx/gstomx.c
index d440214..61618b5 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -28,6 +28,7 @@
#include <string.h>
#include "gstomx.h"
+#include "gstomxmjpegdec.h"
#include "gstomxmpeg2dec.h"
#include "gstomxmpeg4videodec.h"
#include "gstomxh264dec.h"
@@ -2326,9 +2327,9 @@ static const GGetTypeFunction types[] = {
gst_omx_h264_dec_get_type, gst_omx_h263_dec_get_type,
gst_omx_wmv_dec_get_type, gst_omx_mpeg4_video_enc_get_type,
gst_omx_h264_enc_get_type, gst_omx_h263_enc_get_type,
- gst_omx_aac_enc_get_type
+ gst_omx_aac_enc_get_type, gst_omx_mjpeg_dec_get_type,
#ifdef HAVE_VP8
- , gst_omx_vp8_dec_get_type
+ , gst_omx_vp8_dec_get_type
#endif
};
diff --git a/omx/gstomxmjpegdec.c b/omx/gstomxmjpegdec.c
new file mode 100644
index 0000000..402e51b
--- /dev/null
+++ b/omx/gstomxmjpegdec.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2013, Collabora Ltd.
+ * Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "gstomxmjpegdec.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_omx_mjpeg_dec_debug_category);
+#define GST_CAT_DEFAULT gst_omx_mjpeg_dec_debug_category
+
+/* prototypes */
+static gboolean gst_omx_mjpeg_dec_is_format_change (GstOMXVideoDec * dec,
+ GstOMXPort * port, GstVideoCodecState * state);
+static gboolean gst_omx_mjpeg_dec_set_format (GstOMXVideoDec * dec,
+ GstOMXPort * port, GstVideoCodecState * state);
+
+enum
+{
+ PROP_0
+};
+
+/* class initialization */
+
+#define DEBUG_INIT \
+ GST_DEBUG_CATEGORY_INIT (gst_omx_mjpeg_dec_debug_category, "omxmjpegdec", 0, \
+ "debug category for gst-omx video decoder base class");
+
+G_DEFINE_TYPE_WITH_CODE (GstOMXMJPEGDec, gst_omx_mjpeg_dec,
+ GST_TYPE_OMX_VIDEO_DEC, DEBUG_INIT);
+
+static void
+gst_omx_mjpeg_dec_class_init (GstOMXMJPEGDecClass * klass)
+{
+ GstOMXVideoDecClass *videodec_class = GST_OMX_VIDEO_DEC_CLASS (klass);
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+ videodec_class->is_format_change =
+ GST_DEBUG_FUNCPTR (gst_omx_mjpeg_dec_is_format_change);
+ videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_mjpeg_dec_set_format);
+
+ videodec_class->cdata.default_sink_template_caps = "image/jpeg";
+
+ gst_element_class_set_static_metadata (element_class,
+ "OpenMAX MJPEG Video Decoder",
+ "Codec/Decoder/Video",
+ "Decode MJPEG video streams",
+ "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
+
+ gst_omx_set_default_role (&videodec_class->cdata, "video_decoder.mjpeg");
+}
+
+static void
+gst_omx_mjpeg_dec_init (GstOMXMJPEGDec * self)
+{
+}
+
+static gboolean
+gst_omx_mjpeg_dec_is_format_change (GstOMXVideoDec * dec,
+ GstOMXPort * port, GstVideoCodecState * state)
+{
+ return FALSE;
+}
+
+static gboolean
+gst_omx_mjpeg_dec_set_format (GstOMXVideoDec * dec, GstOMXPort * port,
+ GstVideoCodecState * state)
+{
+ gboolean ret;
+ OMX_PARAM_PORTDEFINITIONTYPE port_def;
+
+ gst_omx_port_get_port_definition (port, &port_def);
+ port_def.format.video.eCompressionFormat = OMX_VIDEO_CodingMJPEG;
+ ret = gst_omx_port_update_port_definition (port, &port_def) == OMX_ErrorNone;
+
+ return ret;
+}
diff --git a/omx/gstomxmjpegdec.h b/omx/gstomxmjpegdec.h
new file mode 100644
index 0000000..8802c8d
--- /dev/null
+++ b/omx/gstomxmjpegdec.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2011, Hewlett-Packard Development Company, L.P.
+ * Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>, Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __GST_OMX_MJPEG_DEC_H__
+#define __GST_OMX_MJPEG_DEC_H__
+
+#include <gst/gst.h>
+#include "gstomxvideodec.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_OMX_MJPEG_DEC \
+ (gst_omx_mjpeg_dec_get_type())
+#define GST_OMX_MJPEG_DEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_MJPEG_DEC,GstOMXMJPEGDec))
+#define GST_OMX_MJPEG_DEC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_MJPEG_DEC,GstOMXMJPEGDecClass))
+#define GST_OMX_MJPEG_DEC_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_MJPEG_DEC,GstOMXMJPEGDecClass))
+#define GST_IS_OMX_MJPEG_DEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_MJPEG_DEC))
+#define GST_IS_OMX_MJPEG_DEC_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_MJPEG_DEC))
+
+typedef struct _GstOMXMJPEGDec GstOMXMJPEGDec;
+typedef struct _GstOMXMJPEGDecClass GstOMXMJPEGDecClass;
+
+struct _GstOMXMJPEGDec
+{
+ GstOMXVideoDec parent;
+};
+
+struct _GstOMXMJPEGDecClass
+{
+ GstOMXVideoDecClass parent_class;
+};
+
+GType gst_omx_mjpeg_dec_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_OMX_MJPEG_DEC_H__ */
+