summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@collabora.com>2011-11-21 11:05:06 +0100
committerEdward Hervey <edward@collabora.com>2011-11-21 11:12:31 +0100
commit92dbbd1e336fe47a4cc831292ccb89fd59f85bbd (patch)
tree55917fad07a29c5a028a8b77a313b177a8491709
parent49d5eb5ed735fa2b4d743db395813cec09a22858 (diff)
Initial port to 0.11
Still need to fix bufferpool and ducati GstMeta
-rw-r--r--configure.ac18
-rw-r--r--src/Makefile.am7
-rw-r--r--src/gstducati.c51
-rw-r--r--src/gstducatibufferpool.c53
-rw-r--r--src/gstducatibufferpool.h28
-rw-r--r--src/gstducatih264dec.c26
-rw-r--r--src/gstducatih264enc.c36
-rw-r--r--src/gstducatimpeg2dec.c69
-rw-r--r--src/gstducatimpeg4dec.c39
-rw-r--r--src/gstducatimpeg4enc.c37
-rw-r--r--src/gstducatirvdec.c53
-rw-r--r--src/gstducativc1dec.c116
-rw-r--r--src/gstducatividdec.c190
-rw-r--r--src/gstducatividenc.c11
-rw-r--r--src/gstducativp6dec.c38
-rw-r--r--src/gstducativp7dec.c40
16 files changed, 422 insertions, 390 deletions
diff --git a/configure.ac b/configure.ac
index 09f78eb..b284563 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,11 +2,11 @@ dnl required version of autoconf
AC_PREREQ([2.53])
dnl TODO: fill in your package name and package version here
-AC_INIT([gst-ducati],[0.10.0])
+AC_INIT([gst-ducati],[0.11.0])
dnl required versions of gstreamer and plugins-base
-GST_MAJORMINOR=0.10
-GST_REQUIRED=0.10.30
+GST_MAJORMINOR=0.11
+GST_REQUIRED=0.11.0
AC_CONFIG_SRCDIR([src/gstducati.c])
AC_CONFIG_HEADERS([config.h])
@@ -82,10 +82,10 @@ PKG_CHECK_MODULES(LIBDCE, [libdce >= 1.0.0])
dnl Check for the required version of GStreamer core (and gst-plugins-base)
dnl This will export GST_CFLAGS and GST_LIBS variables for use in Makefile.am
PKG_CHECK_MODULES(GST, [
- gstreamer-0.10 >= $GST_REQUIRED
- gstreamer-base-0.10 >= $GST_REQUIRED
- gstreamer-plugins-base-0.10 >= $GST_REQUIRED
- gstreamer-plugins-bad-0.10
+ gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED
+ gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED
+ gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQUIRED
+ gstreamer-plugins-bad-$GST_MAJORMINOR
], [
AC_SUBST(GST_CFLAGS)
AC_SUBST(GST_LIBS)
@@ -93,8 +93,8 @@ PKG_CHECK_MODULES(GST, [
AC_MSG_ERROR([
You need to install or upgrade the GStreamer development
packages on your system. On debian-based systems these are
- libgstreamer0.10-dev and libgstreamer-plugins-base0.10-dev.
- on RPM-based systems gstreamer0.10-devel, libgstreamer0.10-devel
+ libgstreamer$GST_MAJORMINOR-dev and libgstreamer-plugins-base$GST_MAJORMINOR-dev.
+ on RPM-based systems gstreamer$GST_MAJORMINOR-devel, libgstreamer$GST_MAJORMINOR-devel
or similar. The minimum version required is $GST_REQUIRED.
])
])
diff --git a/src/Makefile.am b/src/Makefile.am
index 2e70207..ab60933 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,12 +27,13 @@ libgstducati_la_SOURCES = \
gstducatih264dec.c \
gstducatividdec.c \
gstducatibufferpool.c \
- gstducatih264enc.c \
- gstducatimpeg4enc.c \
- gstducatividenc.c \
gstducati.c \
$(noinst_HEADERS)
+# gstducatih264enc.c
+# gstducatimpeg4enc.c
+# gstducatividenc.c
+
# compiler and linker flags used to compile this plugin, set in configure.ac
libgstducati_la_CFLAGS = $(GST_CFLAGS) $(MEMMGR_CFLAGS) $(LIBDCE_CFLAGS) -DGST_USE_UNSTABLE_API
libgstducati_la_LIBADD = $(GST_LIBS) $(MEMMGR_LIBS) $(LIBDCE_LIBS) -lgstvideo-0.10 -lgstbasevideo-0.10
diff --git a/src/gstducati.c b/src/gstducati.c
index ae3e800..a6274d0 100644
--- a/src/gstducati.c
+++ b/src/gstducati.c
@@ -42,15 +42,24 @@ plugin_init (GstPlugin * plugin)
/* TODO .. find some way to reasonably detect if the corresponding
* codecs are actually available..
*/
- return gst_element_register (plugin, "ducatih264dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIH264DEC) &&
- gst_element_register (plugin, "ducatimpeg4dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIMPEG4DEC) &&
- gst_element_register (plugin, "ducatimpeg2dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIMPEG2DEC) &&
- gst_element_register (plugin, "ducativc1dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVC1DEC) &&
- gst_element_register (plugin, "ducativp6dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVP6DEC) &&
- gst_element_register (plugin, "ducativp7dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVP7DEC) &&
- gst_element_register (plugin, "ducatirvdec", GST_RANK_PRIMARY, GST_TYPE_DUCATIRVDEC) &&
- gst_element_register (plugin, "ducatih264enc", GST_RANK_PRIMARY, GST_TYPE_DUCATIH264ENC) &&
- gst_element_register (plugin, "ducatimpeg4enc", GST_RANK_PRIMARY, GST_TYPE_DUCATIMPEG4ENC);
+ return gst_element_register (plugin, "ducatih264dec", GST_RANK_PRIMARY,
+ GST_TYPE_DUCATIH264DEC)
+ && gst_element_register (plugin, "ducatimpeg4dec", GST_RANK_PRIMARY,
+ GST_TYPE_DUCATIMPEG4DEC)
+ && gst_element_register (plugin, "ducatimpeg2dec", GST_RANK_PRIMARY,
+ GST_TYPE_DUCATIMPEG2DEC)
+ && gst_element_register (plugin, "ducativc1dec", GST_RANK_PRIMARY,
+ GST_TYPE_DUCATIVC1DEC)
+ && gst_element_register (plugin, "ducativp6dec", GST_RANK_PRIMARY,
+ GST_TYPE_DUCATIVP6DEC)
+ && gst_element_register (plugin, "ducativp7dec", GST_RANK_PRIMARY,
+ GST_TYPE_DUCATIVP7DEC)
+ && gst_element_register (plugin, "ducatirvdec", GST_RANK_PRIMARY,
+ GST_TYPE_DUCATIRVDEC)
+ && gst_element_register (plugin, "ducatih264enc", GST_RANK_PRIMARY,
+ GST_TYPE_DUCATIH264ENC)
+ && gst_element_register (plugin, "ducatimpeg4enc", GST_RANK_PRIMARY,
+ GST_TYPE_DUCATIMPEG4ENC);
}
void *
@@ -72,15 +81,13 @@ gst_ducati_alloc_2d (gint width, gint height, guint * sz)
.width = width,
.height = ALIGN2 (height, 1),
}},
- .stride = 4096
- }, {
+ .stride = 4096}, {
.pixelFormat = PIXEL_FMT_16BIT,
.dim = {.area = {
.width = width,
.height = ALIGN2 (height, 1) / 2,
}},
- .stride = 4096
- }
+ .stride = 4096}
};
if (sz) {
*sz = (4096 * ALIGN2 (height, 1) * 3) / 2;
@@ -94,13 +101,13 @@ gst_ducati_get_mem_type (SSPtr paddr)
XDAS_Int16 type = -1;
if ((0x60000000 <= paddr) && (paddr < 0x68000000))
- type = XDM_MEMTYPE_TILED8;
+ type = XDM_MEMTYPE_TILED8;
else if ((0x68000000 <= paddr) && (paddr < 0x70000000))
- type = XDM_MEMTYPE_TILED16;
+ type = XDM_MEMTYPE_TILED16;
else if ((0x70000000 <= paddr) && (paddr < 0x78000000))
- type = XDM_MEMTYPE_TILED32;
+ type = XDM_MEMTYPE_TILED32;
else if ((0x78000000 <= paddr) && (paddr < 0x80000000))
- type = XDM_MEMTYPE_TILEDPAGE;
+ type = XDM_MEMTYPE_TILEDPAGE;
return type;
}
@@ -114,14 +121,8 @@ gst_ducati_get_mem_type (SSPtr paddr)
# define PACKAGE "ducati"
#endif
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"ducati",
"Hardware accellerated codecs for OMAP4",
- plugin_init,
- VERSION,
- "LGPL",
- "GStreamer",
- "http://gstreamer.net/"
-)
+ plugin_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")
diff --git a/src/gstducatibufferpool.c b/src/gstducatibufferpool.c
index 6e7d6b8..fc5c379 100644
--- a/src/gstducatibufferpool.c
+++ b/src/gstducatibufferpool.c
@@ -68,7 +68,7 @@ gst_ducati_buffer_finalize (GstDucatiBuffer * self)
GST_LOG_OBJECT (pool->element, "finalizing buffer %p", self);
- GST_DUCATI_BUFFERPOOL_LOCK (pool);
+ GST_DUCATI_BUFFER_POOL_LOCK (pool);
if (pool->running) {
resuscitated = TRUE;
@@ -81,7 +81,7 @@ gst_ducati_buffer_finalize (GstDucatiBuffer * self)
} else {
GST_LOG_OBJECT (pool->element, "the pool is shutting down");
}
- GST_DUCATI_BUFFERPOOL_UNLOCK (pool);
+ GST_DUCATI_BUFFER_POOL_UNLOCK (pool);
if (!resuscitated) {
GST_LOG_OBJECT (pool->element,
@@ -90,8 +90,8 @@ gst_ducati_buffer_finalize (GstDucatiBuffer * self)
MemMgr_Free ((void *) GST_BUFFER_DATA (self));
GST_BUFFER_DATA (self) = NULL;
gst_mini_object_unref (GST_MINI_OBJECT (pool));
- GST_MINI_OBJECT_CLASS (buffer_parent_class)->
- finalize (GST_MINI_OBJECT (self));
+ GST_MINI_OBJECT_CLASS (buffer_parent_class)->finalize (GST_MINI_OBJECT
+ (self));
}
}
@@ -103,7 +103,7 @@ gst_ducati_buffer_class_init (gpointer g_class, gpointer class_data)
buffer_parent_class = g_type_class_peek_parent (g_class);
mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
- GST_DEBUG_FUNCPTR (gst_ducati_buffer_finalize);
+ GST_DEBUG_FUNCPTR (gst_ducati_buffer_finalize);
}
GType
@@ -127,11 +127,13 @@ gst_ducati_buffer_get_type (void)
* GstDucatiBufferPool
*/
-static GstMiniObjectClass *bufferpool_parent_class = NULL;
+#define gst_ducati_buffer_pool_parent_class parent_class
+G_DEFINE_TYPE (GstDucatiBufferPool, gst_ducati_buffer_pool,
+ GST_TYPE_BUFFER_POOL);
/** create new bufferpool */
GstDucatiBufferPool *
-gst_ducati_bufferpool_new (GstElement * element, GstCaps * caps, guint size)
+gst_ducati_buffer_pool_new (GstElement * element, GstCaps * caps, guint size)
{
GstDucatiBufferPool *self = (GstDucatiBufferPool *)
gst_mini_object_new (GST_TYPE_DUCATIBUFFERPOOL);
@@ -158,13 +160,13 @@ gst_ducati_bufferpool_new (GstElement * element, GstCaps * caps, guint size)
/** destroy existing bufferpool */
void
-gst_ducati_bufferpool_destroy (GstDucatiBufferPool * self)
+gst_ducati_buffer_pool_destroy (GstDucatiBufferPool * self)
{
g_return_if_fail (self);
- GST_DUCATI_BUFFERPOOL_LOCK (self);
+ GST_DUCATI_BUFFER_POOL_LOCK (self);
self->running = FALSE;
- GST_DUCATI_BUFFERPOOL_UNLOCK (self);
+ GST_DUCATI_BUFFER_POOL_UNLOCK (self);
GST_DEBUG_OBJECT (self->element, "destroy pool");
@@ -180,13 +182,13 @@ gst_ducati_bufferpool_destroy (GstDucatiBufferPool * self)
/** get buffer from bufferpool, allocate new buffer if needed */
GstDucatiBuffer *
-gst_ducati_bufferpool_get (GstDucatiBufferPool * self, GstBuffer * orig)
+gst_ducati_buffer_pool_get (GstDucatiBufferPool * self, GstBuffer * orig)
{
GstDucatiBuffer *buf = NULL;
g_return_val_if_fail (self, NULL);
- GST_DUCATI_BUFFERPOOL_LOCK (self);
+ GST_DUCATI_BUFFER_POOL_LOCK (self);
if (self->running) {
/* re-use a buffer off the freelist if any are available
*/
@@ -198,7 +200,7 @@ gst_ducati_bufferpool_get (GstDucatiBufferPool * self, GstBuffer * orig)
}
buf->orig = orig;
}
- GST_DUCATI_BUFFERPOOL_UNLOCK (self);
+ GST_DUCATI_BUFFER_POOL_UNLOCK (self);
if (buf && orig) {
GST_BUFFER_TIMESTAMP (buf) = GST_BUFFER_TIMESTAMP (orig);
@@ -209,36 +211,41 @@ gst_ducati_bufferpool_get (GstDucatiBufferPool * self, GstBuffer * orig)
}
static void
-gst_ducati_bufferpool_finalize (GstDucatiBufferPool * self)
+gst_ducati_buffer_pool_finalize (GstDucatiBufferPool * self)
{
g_mutex_free (self->lock);
if (self->caps)
gst_caps_unref (self->caps);
gst_object_unref (self->element);
- GST_MINI_OBJECT_CLASS (bufferpool_parent_class)->
- finalize (GST_MINI_OBJECT (self));
+ GST_MINI_OBJECT_CLASS (bufferpool_parent_class)->finalize (GST_MINI_OBJECT
+ (self));
}
static void
-gst_ducati_bufferpool_class_init (gpointer g_class, gpointer class_data)
+gst_ducati_buffer_pool_class_init (gpointer g_class, gpointer class_data)
{
- GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
+ GObjectClass *gobject_class = (GObjectClass *) klass;
+ GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass;
- bufferpool_parent_class = g_type_class_peek_parent (g_class);
+ gobject_class->finalize = gst_ducati_buffer_pool_finalize;
- mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
- GST_DEBUG_FUNCPTR (gst_ducati_bufferpool_finalize);
+#if 0
+ gstbufferpool_class->get_options = ducati_buffer_pool_get_options;
+ gstbufferpool_class->set_config = ducati_buffer_pool_set_config;
+ gstbufferpool_class->alloc_buffer = ducati_buffer_pool_alloc;
+ gstbufferpool_class->free_buffer = ducati_buffer_pool_free;
+#endif
}
GType
-gst_ducati_bufferpool_get_type (void)
+gst_ducati_buffer_pool_get_type (void)
{
static GType type;
if (G_UNLIKELY (type == 0)) {
static const GTypeInfo info = {
.class_size = sizeof (GstMiniObjectClass),
- .class_init = gst_ducati_bufferpool_class_init,
+ .class_init = gst_ducati_buffer_pool_class_init,
.instance_size = sizeof (GstDucatiBufferPool),
};
type = g_type_register_static (GST_TYPE_MINI_OBJECT,
diff --git a/src/gstducatibufferpool.h b/src/gstducatibufferpool.h
index c38f49a..3d0875b 100644
--- a/src/gstducatibufferpool.h
+++ b/src/gstducatibufferpool.h
@@ -24,22 +24,25 @@
G_BEGIN_DECLS
+
GType gst_ducati_buffer_get_type (void);
#define GST_TYPE_DUCATIBUFFER (gst_ducati_buffer_get_type())
#define GST_IS_DUCATIBUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DUCATIBUFFER))
#define GST_DUCATIBUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DUCATIBUFFER, GstDucatiBuffer))
-GType gst_ducati_bufferpool_get_type (void);
-#define GST_TYPE_DUCATIBUFFERPOOL (gst_ducati_bufferpool_get_type())
-#define GST_IS_DUCATIBUFFERPOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DUCATIBUFFERPOOL))
-#define GST_DUCATIBUFFERPOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DUCATIBUFFERPOOL, GstDucatiBufferPool))
+GType gst_ducati_buffer_pool_get_type (void);
+#define GST_TYPE_DUCATI_BUFFER_POOL (gst_ducati_buffer_pool_get_type())
+#define GST_IS_DUCATI_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DUCATI_BUFFER_POOL))
+#define GST_DUCATI_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DUCATI_BUFFER_POOL, GstDucatiBufferPool))
+#define GST_DUCATI_BUFFER_POOL_CAST(obj) ((GstXvImageBufferPool*)(obj))
typedef struct _GstDucatiBufferPool GstDucatiBufferPool;
+typedef struct _GstDucatiBufferPoolClass GstDucatiBufferPoolClass;
typedef struct _GstDucatiBuffer GstDucatiBuffer;
struct _GstDucatiBufferPool
{
- GstMiniObject parent;
+ GstBufferPool bufferpool;
/* output (padded) size including any codec padding: */
gint padded_width, padded_height;
@@ -52,12 +55,17 @@ struct _GstDucatiBufferPool
guint size;
};
-GstDucatiBufferPool * gst_ducati_bufferpool_new (GstElement * element, GstCaps * caps, guint size);
-void gst_ducati_bufferpool_destroy (GstDucatiBufferPool * pool);
-GstDucatiBuffer * gst_ducati_bufferpool_get (GstDucatiBufferPool * self, GstBuffer * orig);
+struct _GstDucatiBufferPoolClass
+{
+ GstBufferPoolClass parent_class;
+};
+
+GstDucatiBufferPool * gst_ducati_buffer_pool_new (GstElement * element, GstCaps * caps, guint size);
+void gst_ducati_buffer_pool_destroy (GstDucatiBufferPool * pool);
+GstDucatiBuffer * gst_ducati_buffer_pool_get (GstDucatiBufferPool * self, GstBuffer * orig);
-#define GST_DUCATI_BUFFERPOOL_LOCK(self) g_mutex_lock ((self)->lock)
-#define GST_DUCATI_BUFFERPOOL_UNLOCK(self) g_mutex_unlock ((self)->lock)
+#define GST_DUCATI_BUFFER_POOL_LOCK(self) g_mutex_lock ((self)->lock)
+#define GST_DUCATI_BUFFER_POOL_UNLOCK(self) g_mutex_unlock ((self)->lock)
struct _GstDucatiBuffer {
GstBuffer parent;
diff --git a/src/gstducatih264dec.c b/src/gstducatih264dec.c
index a4c6870..beeaf9c 100644
--- a/src/gstducatih264dec.c
+++ b/src/gstducatih264dec.c
@@ -41,18 +41,16 @@
#define PADY 24
-GST_BOILERPLATE (GstDucatiH264Dec, gst_ducati_h264dec, GstDucatiVidDec,
- GST_TYPE_DUCATIVIDDEC);
+#define gst_ducati_h264dec_parent_class parent_class
+G_DEFINE_TYPE (GstDucatiH264Dec, gst_ducati_h264dec, GST_TYPE_DUCATIVIDDEC);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-h264, "
- "stream-format = byte-stream, " /* only byte-stream */
+ GST_STATIC_CAPS ("video/x-h264, " "stream-format = byte-stream, " /* only byte-stream */
"align = au, " /* only entire frames */
"width = (int)[ 16, 2048 ], "
- "height = (int)[ 16, 2048 ], "
- "framerate = (fraction)[ 0, max ];")
+ "height = (int)[ 16, 2048 ], " "framerate = (fraction)[ 0, max ];")
);
/* GstDucatiVidDec vmethod implementations */
@@ -73,7 +71,8 @@ static gboolean
gst_ducati_h264dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
{
- gboolean ret = parent_class->allocate_params (self,
+ gboolean ret =
+ GST_DUCATIVIDDEC_GET_CLASS (parent_class)->allocate_params (self,
sizeof (IH264VDEC_Params), sizeof (IH264VDEC_DynamicParams),
sizeof (IH264VDEC_Status), sizeof (IH264VDEC_InArgs),
sizeof (IH264VDEC_OutArgs));
@@ -94,9 +93,10 @@ gst_ducati_h264dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
/* GObject vmethod implementations */
static void
-gst_ducati_h264dec_base_init (gpointer gclass)
+gst_ducati_h264dec_class_init (GstDucatiH264DecClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
gst_element_class_set_details_simple (element_class,
"DucatiH264Dec",
@@ -106,12 +106,7 @@ gst_ducati_h264dec_base_init (gpointer gclass)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
-}
-static void
-gst_ducati_h264dec_class_init (GstDucatiH264DecClass * klass)
-{
- GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
bclass->codec_name = "ivahd_h264dec";
bclass->update_buffer_size =
GST_DEBUG_FUNCPTR (gst_ducati_h264dec_update_buffer_size);
@@ -120,7 +115,6 @@ gst_ducati_h264dec_class_init (GstDucatiH264DecClass * klass)
}
static void
-gst_ducati_h264dec_init (GstDucatiH264Dec * self,
- GstDucatiH264DecClass * gclass)
+gst_ducati_h264dec_init (GstDucatiH264Dec * self)
{
}
diff --git a/src/gstducatih264enc.c b/src/gstducatih264enc.c
index 1b2e32e..91407a2 100644
--- a/src/gstducatih264enc.c
+++ b/src/gstducatih264enc.c
@@ -67,7 +67,7 @@ static GstStaticPadTemplate gst_ducati_h264enc_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("NV12"))
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("NV12"))
);
static GstStaticPadTemplate gst_ducati_h264enc_src_template =
@@ -77,8 +77,9 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS ("video/x-h264")
);
-GST_BOILERPLATE (GstDucatiH264Enc, gst_ducati_h264enc, GstDucatiVidEnc,
- GST_TYPE_DUCATIVIDENC);
+
+#define gst_ducati_h264enc_parent_class parent_class
+G_DEFINE_TYPE (GstDucatiH264Enc, gst_ducati_h264enc, GST_TYPE_DUCATIVIDENC);
/* the values for the following enums are taken from the codec */
@@ -168,10 +169,18 @@ gst_ducati_h264enc_level_get_type (void)
}
static void
-gst_ducati_h264enc_base_init (gpointer g_class)
+gst_ducati_h264enc_class_init (GstDucatiH264EncClass * klass)
{
+ GObjectClass *gobject_class;
+ GstElementClass *element_class;
+ GstDucatiVidEncClass *videnc_class;
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+ gobject_class = G_OBJECT_CLASS (klass);
+ element_class = GST_ELEMENT_CLASS (klass);
+ videnc_class = GST_DUCATIVIDENC_CLASS (klass);
+
+ gobject_class->set_property = gst_ducati_h264enc_set_property;
+ gobject_class->get_property = gst_ducati_h264enc_get_property;
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_ducati_h264enc_src_template));
@@ -183,20 +192,7 @@ gst_ducati_h264enc_base_init (gpointer g_class)
"Encode raw video into H264 stream",
"Alessandro Decina <alessandro.decina@collabora.com>");
- GST_DUCATIVIDENC_CLASS (element_class)->codec_name = "ivahd_h264enc";
-}
-
-static void
-gst_ducati_h264enc_class_init (GstDucatiH264EncClass * klass)
-{
- GObjectClass *gobject_class;
- GstDucatiVidEncClass *videnc_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- videnc_class = GST_DUCATIVIDENC_CLASS (klass);
-
- gobject_class->set_property = gst_ducati_h264enc_set_property;
- gobject_class->get_property = gst_ducati_h264enc_get_property;
+ videnc_class->codec_name = "ivahd_h264enc";
videnc_class->allocate_params = gst_ducati_h264enc_allocate_params;
videnc_class->configure = gst_ducati_h264enc_configure;
@@ -211,7 +207,7 @@ gst_ducati_h264enc_class_init (GstDucatiH264EncClass * klass)
}
static void
-gst_ducati_h264enc_init (GstDucatiH264Enc * self, GstDucatiH264EncClass * klass)
+gst_ducati_h264enc_init (GstDucatiH264Enc * self)
{
GST_DEBUG ("gst_ducati_h264enc_init");
diff --git a/src/gstducatimpeg2dec.c b/src/gstducatimpeg2dec.c
index 5010456..74dee8c 100644
--- a/src/gstducatimpeg2dec.c
+++ b/src/gstducatimpeg2dec.c
@@ -36,18 +36,16 @@
#include "gstducatimpeg2dec.h"
-GST_BOILERPLATE (GstDucatiMpeg2Dec, gst_ducati_mpeg2dec, GstDucatiVidDec,
- GST_TYPE_DUCATIVIDDEC);
+#define gst_ducati_mpeg2dec_parent_class parent_class
+G_DEFINE_TYPE (GstDucatiMpeg2Dec, gst_ducati_mpeg2dec, GST_TYPE_DUCATIVIDDEC);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/mpeg, "
- "mpegversion = (int)[ 1, 2 ], " // XXX check on MPEG-1..
+ GST_STATIC_CAPS ("video/mpeg, " "mpegversion = (int)[ 1, 2 ], " // XXX check on MPEG-1..
"systemstream = (boolean)false, "
"width = (int)[ 64, 2048 ], "
- "height = (int)[ 64, 2048 ], "
- "framerate = (fraction)[ 0, max ];")
+ "height = (int)[ 64, 2048 ], " "framerate = (fraction)[ 0, max ];")
);
/* GstDucatiVidDec vmethod implementations */
@@ -68,7 +66,8 @@ static gboolean
gst_ducati_mpeg2dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
{
- gboolean ret = parent_class->allocate_params (self,
+ gboolean ret =
+ GST_DUCATIVIDDEC_GET_CLASS (parent_class)->allocate_params (self,
sizeof (IVIDDEC3_Params), sizeof (IVIDDEC3_DynamicParams),
sizeof (IVIDDEC3_Status), sizeof (IVIDDEC3_InArgs),
sizeof (IVIDDEC3_OutArgs));
@@ -79,28 +78,53 @@ gst_ducati_mpeg2dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
return ret;
}
+static gboolean
+compare_buffers (GstBuffer * a, GstBuffer * b)
+{
+ gsize sza, szb;
+ gpointer adata, bdata;
+ gboolean ret;
+
+ if (!a || !b)
+ return FALSE;
+ if (gst_buffer_get_size (a) != gst_buffer_get_size (b))
+ return FALSE;
+
+ adata = gst_buffer_map (a, &sza, NULL, GST_MAP_READ);
+ bdata = gst_buffer_map (b, &szb, NULL, GST_MAP_READ);
+ ret = !memcmp (adata, bdata, sza);
+ gst_buffer_unmap (a, adata, sza);
+ gst_buffer_unmap (b, bdata, szb);
+
+ return ret;
+}
+
static GstBuffer *
gst_ducati_mpeg2dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
{
GstDucatiMpeg2Dec *self = GST_DUCATIMPEG2DEC (vdec);
- guint sz = GST_BUFFER_SIZE (buf);
- guint8 *data = GST_BUFFER_DATA (buf);
/* skip codec_data, which is same as first buffer from mpegvideoparse (and
* appears to be periodically resent) and instead prepend to next frame..
*/
- if (vdec->codec_data && (sz == GST_BUFFER_SIZE (vdec->codec_data)) &&
- !memcmp (data, GST_BUFFER_DATA (vdec->codec_data), sz)) {
+ if (compare_buffers (vdec->codec_data, buf)) {
GST_DEBUG_OBJECT (self, "skipping codec_data buffer");
self->prepend_codec_data = TRUE;
} else {
+ gpointer data;
+ gsize sz;
+
if (self->prepend_codec_data) {
+ data = gst_buffer_map (vdec->codec_data, &sz, NULL, GST_MAP_READ);
GST_DEBUG_OBJECT (self, "prepending codec_data buffer");
- push_input (vdec, GST_BUFFER_DATA (vdec->codec_data),
- GST_BUFFER_SIZE (vdec->codec_data));
+
+ push_input (vdec, data, sz);
+ gst_buffer_unmap (vdec->codec_data, data, sz);
self->prepend_codec_data = FALSE;
}
+ data = gst_buffer_map (buf, &sz, NULL, GST_MAP_READ);
push_input (vdec, data, sz);
+ gst_buffer_unmap (buf, data, sz);
}
gst_buffer_unref (buf);
@@ -111,35 +135,28 @@ gst_ducati_mpeg2dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
/* GObject vmethod implementations */
static void
-gst_ducati_mpeg2dec_base_init (gpointer gclass)
+gst_ducati_mpeg2dec_class_init (GstDucatiMpeg2DecClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
gst_element_class_set_details_simple (element_class,
"DucatiMpeg2Dec",
"Codec/Decoder/Video",
- "Decodes video in MPEG-2 format with ducati",
- "Rob Clark <rob@ti.com>");
+ "Decodes video in MPEG-2 format with ducati", "Rob Clark <rob@ti.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
-}
-static void
-gst_ducati_mpeg2dec_class_init (GstDucatiMpeg2DecClass * klass)
-{
- GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
bclass->codec_name = "ivahd_mpeg2vdec";
bclass->update_buffer_size =
GST_DEBUG_FUNCPTR (gst_ducati_mpeg2dec_update_buffer_size);
bclass->allocate_params =
GST_DEBUG_FUNCPTR (gst_ducati_mpeg2dec_allocate_params);
- bclass->push_input =
- GST_DEBUG_FUNCPTR (gst_ducati_mpeg2dec_push_input);
+ bclass->push_input = GST_DEBUG_FUNCPTR (gst_ducati_mpeg2dec_push_input);
}
static void
-gst_ducati_mpeg2dec_init (GstDucatiMpeg2Dec * self,
- GstDucatiMpeg2DecClass * gclass)
+gst_ducati_mpeg2dec_init (GstDucatiMpeg2Dec * self)
{
}
diff --git a/src/gstducatimpeg4dec.c b/src/gstducatimpeg4dec.c
index 99ea1e3..99abd88 100644
--- a/src/gstducatimpeg4dec.c
+++ b/src/gstducatimpeg4dec.c
@@ -41,8 +41,8 @@
#define PADY 32
-GST_BOILERPLATE (GstDucatiMpeg4Dec, gst_ducati_mpeg4dec, GstDucatiVidDec,
- GST_TYPE_DUCATIVIDDEC);
+#define gst_ducati_mpeg4dec_parent_class parent_class
+G_DEFINE_TYPE (GstDucatiMpeg4Dec, gst_ducati_mpeg4dec, GST_TYPE_DUCATIVIDDEC);
#define MPEG4DEC_SINKCAPS_COMMON \
"width = (int)[ 16, 2048 ], " \
@@ -52,19 +52,11 @@ GST_BOILERPLATE (GstDucatiMpeg4Dec, gst_ducati_mpeg4dec, GstDucatiVidDec,
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- "video/mpeg, "
- "mpegversion = (int)4, "
- "systemstream = (boolean)false, "
- MPEG4DEC_SINKCAPS_COMMON ";"
- "video/x-divx, "
- "divxversion = (int)[4, 5], " /* TODO check this */
- MPEG4DEC_SINKCAPS_COMMON ";"
+ GST_STATIC_CAPS ("video/mpeg, " "mpegversion = (int)4, " "systemstream = (boolean)false, " MPEG4DEC_SINKCAPS_COMMON ";" "video/x-divx, " "divxversion = (int)[4, 5], " /* TODO check this */
+ MPEG4DEC_SINKCAPS_COMMON ";"
"video/x-xvid, "
- MPEG4DEC_SINKCAPS_COMMON ";"
- "video/x-3ivx, "
- MPEG4DEC_SINKCAPS_COMMON ";"
- )
+ MPEG4DEC_SINKCAPS_COMMON ";"
+ "video/x-3ivx, " MPEG4DEC_SINKCAPS_COMMON ";")
);
/* GstDucatiVidDec vmethod implementations */
@@ -85,7 +77,8 @@ static gboolean
gst_ducati_mpeg4dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
{
- gboolean ret = parent_class->allocate_params (self,
+ gboolean ret =
+ GST_DUCATIVIDDEC_GET_CLASS (parent_class)->allocate_params (self,
sizeof (VIDDEC3_Params), sizeof (VIDDEC3_DynamicParams),
sizeof (VIDDEC3_Status), sizeof (VIDDEC3_InArgs),
sizeof (VIDDEC3_OutArgs));
@@ -101,24 +94,19 @@ gst_ducati_mpeg4dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
/* GObject vmethod implementations */
static void
-gst_ducati_mpeg4dec_base_init (gpointer gclass)
+gst_ducati_mpeg4dec_class_init (GstDucatiMpeg4DecClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
gst_element_class_set_details_simple (element_class,
"DucatiMpeg4Dec",
"Codec/Decoder/Video",
- "Decodes video in MPEG-4 format with ducati",
- "Rob Clark <rob@ti.com>");
+ "Decodes video in MPEG-4 format with ducati", "Rob Clark <rob@ti.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
-}
-static void
-gst_ducati_mpeg4dec_class_init (GstDucatiMpeg4DecClass * klass)
-{
- GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
bclass->codec_name = "ivahd_mpeg4dec";
bclass->update_buffer_size =
GST_DEBUG_FUNCPTR (gst_ducati_mpeg4dec_update_buffer_size);
@@ -127,7 +115,6 @@ gst_ducati_mpeg4dec_class_init (GstDucatiMpeg4DecClass * klass)
}
static void
-gst_ducati_mpeg4dec_init (GstDucatiMpeg4Dec * self,
- GstDucatiMpeg4DecClass * gclass)
+gst_ducati_mpeg4dec_init (GstDucatiMpeg4Dec * self)
{
}
diff --git a/src/gstducatimpeg4enc.c b/src/gstducatimpeg4enc.c
index 7dc7ced..5a65656 100644
--- a/src/gstducatimpeg4enc.c
+++ b/src/gstducatimpeg4enc.c
@@ -67,7 +67,7 @@ static GstStaticPadTemplate gst_ducati_mpeg4enc_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("NV12"))
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("NV12"))
);
static GstStaticPadTemplate gst_ducati_mpeg4enc_src_template =
@@ -77,8 +77,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS ("video/mpeg, mpegversion=4, systemstream=false")
);
-GST_BOILERPLATE (GstDucatiMPEG4Enc, gst_ducati_mpeg4enc, GstDucatiVidEnc,
- GST_TYPE_DUCATIVIDENC);
+#define gst_ducati_mpeg4enc_parent_class parent_class
+G_DEFINE_TYPE (GstDucatiMPEG4Enc, gst_ducati_mpeg4enc, GST_TYPE_DUCATIVIDENC);
/* the values for the following enums are taken from the codec */
@@ -142,10 +142,18 @@ gst_ducati_mpeg4enc_level_get_type (void)
}
static void
-gst_ducati_mpeg4enc_base_init (gpointer g_class)
+gst_ducati_mpeg4enc_class_init (GstDucatiMPEG4EncClass * klass)
{
+ GObjectClass *gobject_class;
+ GstElementClass *element_class;
+ GstDucatiVidEncClass *videnc_class;
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+ gobject_class = G_OBJECT_CLASS (klass);
+ element_class = GST_ELEMENT_CLASS (klass);
+ videnc_class = GST_DUCATIVIDENC_CLASS (klass);
+
+ gobject_class->set_property = gst_ducati_mpeg4enc_set_property;
+ gobject_class->get_property = gst_ducati_mpeg4enc_get_property;
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_ducati_mpeg4enc_src_template));
@@ -157,21 +165,7 @@ gst_ducati_mpeg4enc_base_init (gpointer g_class)
"Encode raw video into MPEG4 stream",
"Alessandro Decina <alessandro.decina@collabora.com>");
- GST_DUCATIVIDENC_CLASS (element_class)->codec_name = "ivahd_mpeg4enc";
-}
-
-static void
-gst_ducati_mpeg4enc_class_init (GstDucatiMPEG4EncClass * klass)
-{
- GObjectClass *gobject_class;
- GstDucatiVidEncClass *videnc_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- videnc_class = GST_DUCATIVIDENC_CLASS (klass);
-
- gobject_class->set_property = gst_ducati_mpeg4enc_set_property;
- gobject_class->get_property = gst_ducati_mpeg4enc_get_property;
-
+ videnc_class->codec_name = "ivahd_mpeg4enc";
videnc_class->allocate_params = gst_ducati_mpeg4enc_allocate_params;
videnc_class->configure = gst_ducati_mpeg4enc_configure;
@@ -186,8 +180,7 @@ gst_ducati_mpeg4enc_class_init (GstDucatiMPEG4EncClass * klass)
}
static void
-gst_ducati_mpeg4enc_init (GstDucatiMPEG4Enc * self,
- GstDucatiMPEG4EncClass * klass)
+gst_ducati_mpeg4enc_init (GstDucatiMPEG4Enc * self)
{
GST_DEBUG ("gst_ducati_mpeg4enc_init");
diff --git a/src/gstducatirvdec.c b/src/gstducatirvdec.c
index f1b650e..a2195da 100644
--- a/src/gstducatirvdec.c
+++ b/src/gstducatirvdec.c
@@ -41,8 +41,8 @@
#define PADY 32
-GST_BOILERPLATE (GstDucatiRVDec, gst_ducati_rvdec, GstDucatiVidDec,
- GST_TYPE_DUCATIVIDDEC);
+#define gst_ducati_rvdec_parent_class parent_class
+G_DEFINE_TYPE (GstDucatiRVDec, gst_ducati_rvdec, GST_TYPE_DUCATIVIDDEC);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
@@ -51,8 +51,7 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
"systemstream = (boolean)false, "
"rmversion = (int){ 3, 4 }, "
"width = (int)[ 16, 2048 ], "
- "height = (int)[ 16, 2048 ], "
- "framerate = (fraction)[ 0, max ];")
+ "height = (int)[ 16, 2048 ], " "framerate = (fraction)[ 0, max ];")
);
/* GstDucatiVidDec vmethod implementations */
@@ -62,7 +61,7 @@ gst_ducati_rvdec_parse_caps (GstDucatiVidDec * vdec, GstStructure * s)
{
GstDucatiRVDec *self = GST_DUCATIRVDEC (vdec);
- if (parent_class->parse_caps (vdec, s)) {
+ if (GST_DUCATIVIDDEC_GET_CLASS (parent_class)->parse_caps (vdec, s)) {
gboolean ret = gst_structure_get_int (s, "rmversion", &self->rmversion);
if (ret) {
IrealVDEC_Params *params = (IrealVDEC_Params *) vdec->params;
@@ -98,13 +97,14 @@ static gboolean
gst_ducati_rvdec_allocate_params (GstDucatiVidDec * vdec, gint params_sz,
gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
{
- gboolean ret = parent_class->allocate_params (vdec,
+ gboolean ret =
+ GST_DUCATIVIDDEC_GET_CLASS (parent_class)->allocate_params (vdec,
sizeof (IrealVDEC_Params), sizeof (IrealVDEC_DynamicParams),
sizeof (IrealVDEC_Status), sizeof (IrealVDEC_InArgs),
sizeof (IrealVDEC_OutArgs));
if (ret) {
- /*IrealVDEC_Params *params = (IrealVDEC_Params *) vdec->params;*/
+ /*IrealVDEC_Params *params = (IrealVDEC_Params *) vdec->params; */
vdec->params->displayDelay = IVIDDEC3_DISPLAY_DELAY_1;
vdec->dynParams->newFrameFlag = FALSE;
vdec->dynParams->lateAcquireArg = -1;
@@ -119,15 +119,14 @@ static GstBuffer *
gst_ducati_rvdec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
{
GstDucatiRVDec *self = GST_DUCATIRVDEC (vdec);
- guint8 *data;
+ guint8 *origdata, *data;
guint8 val[4];
- gint i, sz, slice_count;
+ gint i, slice_count;
+ gsize origsz, sz;
/* *** on first buffer, build up the stream header for the codec *** */
if (G_UNLIKELY (vdec->first_in_buffer) && vdec->codec_data) {
-
- sz = GST_BUFFER_SIZE (vdec->codec_data);
- data = GST_BUFFER_DATA (vdec->codec_data);
+ data = gst_buffer_map (vdec->codec_data, &sz, NULL, GST_MAP_READ);
/* header size, 4 bytes, big-endian */
GST_WRITE_UINT32_BE (val, sz + 26);
@@ -135,9 +134,9 @@ gst_ducati_rvdec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
/* stream type */
if (self->rmversion == 3) {
- push_input (vdec, (guint8 *)"VIDORV30", 8);
+ push_input (vdec, (guint8 *) "VIDORV30", 8);
} else if (self->rmversion == 4) {
- push_input (vdec, (guint8 *)"VIDORV40", 8);
+ push_input (vdec, (guint8 *) "VIDORV40", 8);
}
/* horiz x vert resolution */
@@ -160,10 +159,12 @@ gst_ducati_rvdec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
/* and rest of stream header is the codec_data */
push_input (vdec, data, sz);
+ gst_buffer_unmap (vdec->codec_data, data, sz);
}
- data = GST_BUFFER_DATA (buf);
- sz = GST_BUFFER_SIZE (buf);
+ origdata = data = gst_buffer_map (buf, &sz, NULL, GST_MAP_READ);
+ origsz = sz;
+
slice_count = (*data++) + 1;
/* payload size, excluding fixed header and slice header */
@@ -212,6 +213,7 @@ gst_ducati_rvdec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
/* copy the payload (rest of buffer) */
push_input (vdec, data, sz);
+ gst_buffer_unmap (buf, origdata, origsz);
gst_buffer_unref (buf);
return NULL;
@@ -220,9 +222,10 @@ gst_ducati_rvdec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
/* GObject vmethod implementations */
static void
-gst_ducati_rvdec_base_init (gpointer gclass)
+gst_ducati_rvdec_class_init (GstDucatiRVDecClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
+ GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_set_details_simple (element_class,
"DucatiRVDec",
@@ -232,25 +235,17 @@ gst_ducati_rvdec_base_init (gpointer gclass)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
-}
-static void
-gst_ducati_rvdec_class_init (GstDucatiRVDecClass * klass)
-{
- GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
bclass->codec_name = "ivahd_realvdec";
- bclass->parse_caps =
- GST_DEBUG_FUNCPTR (gst_ducati_rvdec_parse_caps);
+ bclass->parse_caps = GST_DEBUG_FUNCPTR (gst_ducati_rvdec_parse_caps);
bclass->update_buffer_size =
GST_DEBUG_FUNCPTR (gst_ducati_rvdec_update_buffer_size);
bclass->allocate_params =
GST_DEBUG_FUNCPTR (gst_ducati_rvdec_allocate_params);
- bclass->push_input =
- GST_DEBUG_FUNCPTR (gst_ducati_rvdec_push_input);
+ bclass->push_input = GST_DEBUG_FUNCPTR (gst_ducati_rvdec_push_input);
}
static void
-gst_ducati_rvdec_init (GstDucatiRVDec * self,
- GstDucatiRVDecClass * gclass)
+gst_ducati_rvdec_init (GstDucatiRVDec * self)
{
}
diff --git a/src/gstducativc1dec.c b/src/gstducativc1dec.c
index c23c6b0..f25cc31 100644
--- a/src/gstducativc1dec.c
+++ b/src/gstducativc1dec.c
@@ -40,19 +40,17 @@
#define PADX 32
#define PADY 40
-
-GST_BOILERPLATE (GstDucatiVC1Dec, gst_ducati_vc1dec, GstDucatiVidDec,
- GST_TYPE_DUCATIVIDDEC);
+#define gst_ducati_vc1dec_parent_class parent_class
+G_DEFINE_TYPE (GstDucatiVC1Dec, gst_ducati_vc1dec, GST_TYPE_DUCATIVIDDEC);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-wmv, "
"wmvversion = (int)[ 2, 3 ], "
- "format = (fourcc){ WVC1, WMV3, WMV2, WMV1 }, "
+ "format = (string){ WVC1, WMV3, WMV2, WMV1 }, "
"width = (int)[ 16, 2048 ], "
- "height = (int)[ 16, 2048 ], "
- "framerate = (fraction)[ 0, max ];")
+ "height = (int)[ 16, 2048 ], " "framerate = (fraction)[ 0, max ];")
);
/* GstDucatiVidDec vmethod implementations */
@@ -61,35 +59,31 @@ static gboolean
gst_ducati_vc1dec_parse_caps (GstDucatiVidDec * vdec, GstStructure * s)
{
GstDucatiVC1Dec *self = GST_DUCATIVC1DEC (vdec);
-
- if (parent_class->parse_caps (vdec, s)) {
- guint32 format;
- gboolean ret = gst_structure_get_fourcc (s, "format", &format);
- if (ret) {
- switch (format) {
- case GST_MAKE_FOURCC ('W', 'V', 'C', '1'):
- self->level = 4;
- break;
- case GST_MAKE_FOURCC ('W', 'M', 'V', '3'):
- self->level = 3;
- break;
- case GST_MAKE_FOURCC ('W', 'M', 'V', '2'):
- self->level = 2;
- break;
- case GST_MAKE_FOURCC ('W', 'M', 'V', '1'):
- self->level = 1;
- break;
- default:
- ret = FALSE;
- break;
- }
+ gboolean ret = FALSE;
+
+ if (GST_DUCATIVIDDEC_GET_CLASS (parent_class)->parse_caps (vdec, s)) {
+ const gchar *format;
+
+ format = gst_structure_get_string (s, "format");
+
+ if (format) {
+ ret = TRUE;
+ if (g_str_equal (format, "WVC1"))
+ self->level = 4;
+ else if (g_str_equal (format, "WMV3"))
+ self->level = 3;
+ else if (g_str_equal (format, "WMV2"))
+ self->level = 2;
+ else if (g_str_equal (format, "WMV1"))
+ self->level = 1;
+ else
+ ret = FALSE;
}
- return ret;
}
GST_INFO_OBJECT (vdec, "level %d", self->level);
- return FALSE;
+ return ret;
}
static void
@@ -108,7 +102,8 @@ static gboolean
gst_ducati_vc1dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
{
- gboolean ret = parent_class->allocate_params (self,
+ gboolean ret =
+ GST_DUCATIVIDDEC_GET_CLASS (parent_class)->allocate_params (self,
sizeof (IVC1VDEC_Params), sizeof (IVC1VDEC_DynamicParams),
sizeof (IVC1VDEC_Status), sizeof (IVC1VDEC_InArgs),
sizeof (IVC1VDEC_OutArgs));
@@ -123,7 +118,7 @@ gst_ducati_vc1dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
params->frameLayerDataPresentFlag = FALSE;
/* enable concealment */
- params->ErrorConcealmentON = 1;
+ params->ErrorConcealmentON = 1;
/* codec wants lateAcquireArg = -1 */
self->dynParams->lateAcquireArg = -1;
@@ -138,6 +133,8 @@ gst_ducati_vc1dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
GstDucatiVC1Dec *self = GST_DUCATIVC1DEC (vdec);
IVC1VDEC_Params *params = (IVC1VDEC_Params *) vdec->params;
guint32 val;
+ guint8 *data;
+ guint sz;
/* need a base ts for frame layer timestamps */
if (self->first_ts == GST_CLOCK_TIME_NONE)
@@ -148,8 +145,9 @@ gst_ducati_vc1dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
/* for VC-1 Advanced Profile, strip off first byte, and
* send rest of codec_data unmodified;
*/
- push_input (vdec, GST_BUFFER_DATA (vdec->codec_data) + 1,
- GST_BUFFER_SIZE (vdec->codec_data) - 1);
+ data = gst_buffer_map (vdec->codec_data, &sz, NULL, GST_MAP_READ);
+ push_input (vdec, data + 1, sz - 1);
+ gst_buffer_unmap (vdec->codec_data, data, sz);
} else {
/* for VC-1 Simple and Main Profile, build the Table 265 Sequence
* Layer Data Structure header (refer to VC-1 spec, Annex L):
@@ -162,7 +160,10 @@ gst_ducati_vc1dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
val = 0x00000004;
push_input (vdec, (guint8 *) & val, 4);
- val = GST_READ_UINT32_LE (GST_BUFFER_DATA (vdec->codec_data));
+ data = gst_buffer_map (vdec->codec_data, &sz, NULL, GST_MAP_READ);
+ val = GST_READ_UINT32_LE (data);
+ gst_buffer_unmap (vdec->codec_data, data, sz);
+
/* FIXME: i have NO idea why asfdemux gives me something I need to patch... */
val |= 0x01 << 24;
push_input (vdec, (guint8 *) & val, 4);
@@ -172,7 +173,8 @@ gst_ducati_vc1dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
push_input (vdec, (guint8 *) & val, 4);
val = vdec->width;
push_input (vdec, (guint8 *) & val, 4);
- GST_INFO_OBJECT (vdec, "seq hdr resolution: %dx%d", vdec->width, vdec->height);
+ GST_INFO_OBJECT (vdec, "seq hdr resolution: %dx%d",
+ vdec->width, vdec->height);
val = 0x0000000c;
push_input (vdec, (guint8 *) & val, 4);
@@ -190,9 +192,11 @@ gst_ducati_vc1dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
static guint8 sc[] = { 0x00, 0x00, 0x01, 0x0d }; /* start code */
push_input (vdec, sc, sizeof (sc));
}
-
+
+ data = gst_buffer_map (buf, &sz, NULL, GST_MAP_READ);
+
if (params->frameLayerDataPresentFlag) {
- val = GST_BUFFER_SIZE (buf);
+ val = sz;
if (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT))
val |= 0x80 << 24;
else
@@ -202,7 +206,8 @@ gst_ducati_vc1dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
push_input (vdec, (guint8 *) & val, 4);
}
- push_input (vdec, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+ push_input (vdec, data, sz);
+ gst_buffer_unmap (buf, data, sz);
gst_buffer_unref (buf);
return NULL;
@@ -211,8 +216,7 @@ gst_ducati_vc1dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
/* GstElement vmethod implementations */
static GstStateChangeReturn
-gst_ducati_vc1dec_change_state (GstElement * element,
- GstStateChange transition)
+gst_ducati_vc1dec_change_state (GstElement * element, GstStateChange transition)
{
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
GstDucatiVC1Dec *self = GST_DUCATIVC1DEC (element);
@@ -243,20 +247,6 @@ leave:
/* GObject vmethod implementations */
-static void
-gst_ducati_vc1dec_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- gst_element_class_set_details_simple (element_class,
- "DucatiVC1Dec",
- "Codec/Decoder/Video",
- "Decodes video in WMV/VC-1 format with ducati",
- "Rob Clark <rob@ti.com>");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory));
-}
static void
gst_ducati_vc1dec_class_init (GstDucatiVC1DecClass * klass)
@@ -264,23 +254,27 @@ gst_ducati_vc1dec_class_init (GstDucatiVC1DecClass * klass)
GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
+ gst_element_class_set_details_simple (gstelement_class,
+ "DucatiVC1Dec",
+ "Codec/Decoder/Video",
+ "Decodes video in WMV/VC-1 format with ducati", "Rob Clark <rob@ti.com>");
+
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sink_factory));
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_ducati_vc1dec_change_state);
bclass->codec_name = "ivahd_vc1vdec";
- bclass->parse_caps =
- GST_DEBUG_FUNCPTR (gst_ducati_vc1dec_parse_caps);
+ bclass->parse_caps = GST_DEBUG_FUNCPTR (gst_ducati_vc1dec_parse_caps);
bclass->update_buffer_size =
GST_DEBUG_FUNCPTR (gst_ducati_vc1dec_update_buffer_size);
bclass->allocate_params =
GST_DEBUG_FUNCPTR (gst_ducati_vc1dec_allocate_params);
- bclass->push_input =
- GST_DEBUG_FUNCPTR (gst_ducati_vc1dec_push_input);
+ bclass->push_input = GST_DEBUG_FUNCPTR (gst_ducati_vc1dec_push_input);
}
static void
-gst_ducati_vc1dec_init (GstDucatiVC1Dec * self,
- GstDucatiVC1DecClass * gclass)
+gst_ducati_vc1dec_init (GstDucatiVC1Dec * self)
{
GstDucatiVidDec *vdec = GST_DUCATIVIDDEC (self);
diff --git a/src/gstducatividdec.c b/src/gstducatividdec.c
index e5b125a..79370e8 100644
--- a/src/gstducatividdec.c
+++ b/src/gstducatividdec.c
@@ -23,13 +23,46 @@
#include "gstducatividdec.h"
-GST_BOILERPLATE (GstDucatiVidDec, gst_ducati_viddec, GstElement,
- GST_TYPE_ELEMENT);
+/* No, we can't use G_DEFINE_TYPE since _init() needs the proper class */
+/* NOTE (Edward): Do not use G_DEFINE_* because we need to have
+ * a GClassInitFunc called with the target class (which the macros
+ * don't handle). */
+static void gst_ducati_viddec_class_init (GstDucatiVidDecClass * klass);
+static void gst_ducati_viddec_init (GstDucatiVidDec * dec,
+ GstDucatiVidDecClass * klass);
+
+static GstElementClass *parent_class = NULL;
+
+GType
+gst_ducati_viddec_get_type (void)
+{
+ static volatile gsize ducati_viddec_type = 0;
+
+ if (g_once_init_enter (&ducati_viddec_type)) {
+ GType _type;
+ static const GTypeInfo ducati_viddec_info = {
+ sizeof (GstDucatiVidDecClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gst_ducati_viddec_class_init,
+ NULL,
+ NULL,
+ sizeof (GstDucatiVidDec),
+ 0,
+ (GInstanceInitFunc) gst_ducati_viddec_init,
+ };
+
+ _type = g_type_register_static (GST_TYPE_ELEMENT,
+ "GstDucatiVidDec", &ducati_viddec_info, G_TYPE_FLAG_ABSTRACT);
+ g_once_init_leave (&ducati_viddec_type, _type);
+ }
+ return ducati_viddec_type;
+}
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV_STRIDED ("NV12", "[ 0, max ]"))
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("NV12"))
);
enum
@@ -113,7 +146,7 @@ static void
codec_delete (GstDucatiVidDec * self)
{
if (self->pool) {
- gst_ducati_bufferpool_destroy (self->pool);
+ gst_ducati_buffer_pool_destroy (self->pool);
self->pool = NULL;
}
@@ -185,10 +218,10 @@ codec_bufferpool_get (GstDucatiVidDec * self, GstBuffer * buf)
size = gst_video_format_get_size (GST_VIDEO_FORMAT_NV12,
self->padded_width, self->padded_height);
GST_DEBUG_OBJECT (self, "creating bufferpool");
- self->pool = gst_ducati_bufferpool_new (GST_ELEMENT (self),
+ self->pool = gst_ducati_buffer_pool_new (GST_ELEMENT (self),
GST_PAD_CAPS (self->srcpad), size);
}
- return GST_BUFFER (gst_ducati_bufferpool_get (self->pool, buf));
+ return GST_BUFFER (gst_ducati_buffer_pool_get (self->pool, buf));
}
static XDAS_Int32
@@ -198,14 +231,19 @@ codec_prepare_outbuf (GstDucatiVidDec * self, GstBuffer * buf)
guint8 *y_vaddr, *uv_vaddr;
SSPtr y_paddr, uv_paddr;
+ /* FIXME (0.11) : We can avoid a lot of this by using GstMeta */
+
+ /* Virtual addresses */
y_vaddr = GST_BUFFER_DATA (buf);
uv_vaddr = y_vaddr + self->stride * self->padded_height;
+ /* Physical addresses */
y_paddr = TilerMem_VirtToPhys (y_vaddr);
uv_paddr = TilerMem_VirtToPhys (uv_vaddr);
y_type = gst_ducati_get_mem_type (y_paddr);
uv_type = gst_ducati_get_mem_type (uv_paddr);
+
/* FIXME: workaround for the vc1 codec expecting _RAW when it's actually
* _TILEDPAGE... should be removed once the codec is fixed */
if (y_type == XDM_MEMTYPE_TILEDPAGE && self->pageMemType != y_type)
@@ -223,6 +261,7 @@ codec_prepare_outbuf (GstDucatiVidDec * self, GstBuffer * buf)
self->outBufs->numBufs = 2;
self->outBufs->descs[0].memType = y_type;
self->outBufs->descs[1].memType = uv_type;
+
if (y_type == XDM_MEMTYPE_RAW || y_type == XDM_MEMTYPE_TILEDPAGE) {
self->outBufs->descs[0].bufSize.bytes =
self->stride * self->padded_height;
@@ -316,11 +355,13 @@ codec_process (GstDucatiVidDec * self, gboolean send, gboolean flush)
GST_DEBUG_OBJECT (self, "setting crop to %d, %d, %d, %d",
r->topLeft.x, r->topLeft.y, r->bottomRight.x, r->bottomRight.y);
+#if 0
+ /* FIXME (0.11) Use crop metadata */
gst_pad_push_event (self->srcpad,
gst_event_new_crop (r->topLeft.y, r->topLeft.x,
r->bottomRight.x - r->topLeft.x,
r->bottomRight.y - r->topLeft.y));
-
+#endif
self->first_out_buffer = FALSE;
}
@@ -502,13 +543,19 @@ gst_ducati_viddec_allocate_params (GstDucatiVidDec * self, gint params_sz,
static GstBuffer *
gst_ducati_viddec_push_input (GstDucatiVidDec * self, GstBuffer * buf)
{
+ gpointer data;
+ gsize sz;
+
if (G_UNLIKELY (self->first_in_buffer) && self->codec_data) {
- push_input (self, GST_BUFFER_DATA (self->codec_data),
- GST_BUFFER_SIZE (self->codec_data));
+ data = gst_buffer_map (self->codec_data, &sz, NULL, GST_MAP_READ);
+ push_input (self, data, sz);
+ gst_buffer_unmap (self->codec_data, data, sz);
}
/* just copy entire buffer */
- push_input (self, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+ data = gst_buffer_map (buf, &sz, NULL, GST_MAP_READ);
+ push_input (self, data, sz);
+ gst_buffer_unmap (buf, data, sz);
gst_buffer_unref (buf);
return NULL;
@@ -517,15 +564,11 @@ gst_ducati_viddec_push_input (GstDucatiVidDec * self, GstBuffer * buf)
/* GstElement vmethod implementations */
static gboolean
-gst_ducati_viddec_sink_setcaps (GstPad * pad, GstCaps * caps)
+gst_ducati_viddec_set_caps (GstDucatiVidDec * self, GstCaps * caps)
{
gboolean ret = TRUE;
- GstDucatiVidDec *self = GST_DUCATIVIDDEC (gst_pad_get_parent (pad));
GstDucatiVidDecClass *klass = GST_DUCATIVIDDEC_GET_CLASS (self);
GstStructure *s;
- GstCaps *outcaps = NULL;
- GstStructure *out_s;
- gboolean interlaced = FALSE;
gint frn = 0, frd = 1;
gint par_width, par_height;
gboolean par_present;
@@ -537,72 +580,65 @@ gst_ducati_viddec_sink_setcaps (GstPad * pad, GstCaps * caps)
goto out;
}
- /* update output/padded sizes */
- klass->update_buffer_size (self);
-
GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps);
- gst_structure_get_fraction (s, "framerate", &frn, &frd);
- gst_structure_get_boolean (s, "interlaced", &interlaced);
- par_present = gst_structure_get_fraction (s, "pixel-aspect-ratio",
- &par_width, &par_height);
+ if (klass->parse_caps (self, s)) {
+ GstCaps *outcaps;
+ gboolean interlaced = FALSE;
- outcaps = gst_pad_get_allowed_caps (self->srcpad);
- if (outcaps) {
- outcaps = gst_caps_make_writable (outcaps);
- gst_caps_truncate (outcaps);
- } else {
- outcaps = gst_caps_new_simple ("video/x-raw-yuv-strided",
- "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('N', 'V', '1', '2'), NULL);
- }
-
- out_s = gst_caps_get_structure (outcaps, 0);
- gst_structure_set (out_s,
- "width", G_TYPE_INT, self->padded_width,
- "height", G_TYPE_INT, self->padded_height,
- "framerate", GST_TYPE_FRACTION, frn, frd, NULL);
- if (par_present)
- gst_structure_set (out_s, "pixel-aspect-ratio", GST_TYPE_FRACTION,
- par_width, par_height, NULL);
-
- if (interlaced)
- gst_structure_set (out_s, "interlaced", G_TYPE_BOOLEAN, TRUE, NULL);
-
- if (!strcmp (gst_structure_get_name (out_s), "video/x-raw-yuv-strided")) {
- if (!gst_structure_get_int (out_s, "rowstride", &self->stride)) {
- self->stride = 4096;
- gst_structure_set (out_s, "rowstride", G_TYPE_INT, self->stride, NULL);
- }
- } else {
- self->stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_NV12,
- 0, self->padded_width);
- }
+ gst_structure_get_fraction (s, "framerate", &frn, &frd);
+ gst_structure_get_boolean (s, "interlaced", &interlaced);
+ par_present = gst_structure_get_fraction (s, "pixel-aspect-ratio",
+ &par_width, &par_height);
- self->outsize = gst_video_format_get_size (GST_VIDEO_FORMAT_NV12,
- self->stride, self->padded_height);
+ /* update output/padded sizes:
+ */
+ klass->update_buffer_size (self);
- GST_INFO_OBJECT (self, "outsize %d stride %d outcaps: %" GST_PTR_FORMAT,
- self->outsize, self->stride, outcaps);
+ self->stride = self->padded_width;
+ self->outsize = GST_ROUND_UP_2 (self->stride * self->padded_height * 3) / 2;
- ret = gst_pad_set_caps (self->srcpad, outcaps);
+ outcaps = gst_caps_new_simple ("video/x-raw-yuv",
+ "format", G_TYPE_STRING, "NV12",
+ "width", G_TYPE_INT, self->padded_width,
+ "height", G_TYPE_INT, self->padded_height,
+ "framerate", GST_TYPE_FRACTION, frn, frd, NULL);
-out:
- if (outcaps)
+ if (interlaced) {
+ gst_caps_set_simple (outcaps, "interlaced", G_TYPE_BOOLEAN, TRUE, NULL);
+ }
+ if (par_present)
+ gst_caps_set_simple (outcaps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
+ par_width, par_height, NULL);
+
+ GST_DEBUG_OBJECT (self, "outcaps: %" GST_PTR_FORMAT, outcaps);
+
+ ret = gst_pad_set_caps (self->srcpad, outcaps);
gst_caps_unref (outcaps);
- gst_object_unref (self);
- return ret;
+ if (!ret) {
+ GST_WARNING_OBJECT (self, "failed to set caps");
+ return FALSE;
+ }
+ } else {
+ GST_WARNING_OBJECT (self, "missing required fields");
+ return FALSE;
+ }
+
+ return gst_pad_set_caps (self->sinkpad, caps);
}
static gboolean
-gst_ducati_viddec_query (GstPad * pad, GstQuery * query)
+gst_ducati_viddec_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = TRUE, forward = TRUE;
- GstDucatiVidDec *self = GST_DUCATIVIDDEC (GST_OBJECT_PARENT (pad));
+ GstDucatiVidDec *self = GST_DUCATIVIDDEC (parent);
GST_DEBUG_OBJECT (self, "query: %" GST_PTR_FORMAT, query);
switch (GST_QUERY_TYPE (query)) {
+#if 0
+ /* FIXME (0.11) Handled by GST_QUERY_ALLOCATION */
case GST_QUERY_BUFFERS:
GST_DEBUG_OBJECT (self, "min buffers: %d", self->min_buffers);
gst_query_set_buffers_count (query, self->min_buffers);
@@ -613,20 +649,21 @@ gst_ducati_viddec_query (GstPad * pad, GstQuery * query)
self->padded_width, self->padded_height);
forward = FALSE;
break;
+#endif
default:
break;
}
if (forward)
- res = gst_pad_query_default (pad, query);
+ res = gst_pad_query_default (pad, parent, query);
return res;
}
static GstFlowReturn
-gst_ducati_viddec_chain (GstPad * pad, GstBuffer * buf)
+gst_ducati_viddec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
- GstDucatiVidDec *self = GST_DUCATIVIDDEC (GST_OBJECT_PARENT (pad));
+ GstDucatiVidDec *self = GST_DUCATIVIDDEC (parent);
GstFlowReturn ret;
Int32 err;
GstBuffer *outbuf = NULL;
@@ -636,13 +673,17 @@ gst_ducati_viddec_chain (GstPad * pad, GstBuffer * buf)
GST_ERROR_OBJECT (self, "no engine");
return GST_FLOW_ERROR;
}
-
+#if 0
/* do this before creating codec to ensure reverse caps negotiation
* happens first:
*/
allocate_buffer:
ret = gst_pad_alloc_buffer (self->srcpad, 0, self->outsize,
GST_PAD_CAPS (self->srcpad), &outbuf);
+#else
+ /* FIXME (0.11) Use ALLOCATION QUERY */
+ ret = GST_FLOW_ERROR;
+#endif
if (ret != GST_FLOW_OK) {
GST_DEBUG_OBJECT (self, "alloc_buffer failed %s", gst_flow_get_name (ret));
return ret;
@@ -726,15 +767,24 @@ allocate_buffer:
}
static gboolean
-gst_ducati_viddec_event (GstPad * pad, GstEvent * event)
+gst_ducati_viddec_event (GstPad * pad, GstObject * parent, GstEvent * event)
{
- GstDucatiVidDec *self = GST_DUCATIVIDDEC (GST_OBJECT_PARENT (pad));
+ GstDucatiVidDec *self = GST_DUCATIVIDDEC (parent);
gboolean ret = TRUE;
gboolean eos = FALSE;
GST_INFO_OBJECT (self, "begin: event=%s", GST_EVENT_TYPE_NAME (event));
switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ ret = gst_ducati_viddec_set_caps (self, caps);
+ gst_event_unref (event);
+ }
+ break;
case GST_EVENT_EOS:
eos = TRUE;
/* fall-through */
@@ -902,8 +952,6 @@ gst_ducati_viddec_init (GstDucatiVidDec * self, GstDucatiVidDecClass * klass)
self->sinkpad =
gst_pad_new_from_template (gst_element_class_get_pad_template
(gstelement_class, "sink"), "sink");
- gst_pad_set_setcaps_function (self->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ducati_viddec_sink_setcaps));
gst_pad_set_chain_function (self->sinkpad,
GST_DEBUG_FUNCPTR (gst_ducati_viddec_chain));
gst_pad_set_event_function (self->sinkpad,
diff --git a/src/gstducatividenc.c b/src/gstducatividenc.c
index 84c0897..0adc9e2 100644
--- a/src/gstducatividenc.c
+++ b/src/gstducatividenc.c
@@ -229,14 +229,14 @@ gst_ducati_videnc_get_property (GObject * object, guint prop_id,
static gboolean
gst_ducati_videnc_configure (GstDucatiVidEnc * self)
-{
+{
int err;
int i;
int max_out_size = 0;
const GstVideoState *state;
state = gst_base_video_encoder_get_state (GST_BASE_VIDEO_ENCODER (self));
-
+
if (!GST_DUCATIVIDENC_GET_CLASS (self)->configure (self))
return FALSE;
@@ -251,7 +251,7 @@ gst_ducati_videnc_configure (GstDucatiVidEnc * self)
return FALSE;
}
}
-
+
err = VIDENC2_control (self->codec,
XDM_SETPARAMS, self->dynParams, self->status);
if (err) {
@@ -370,8 +370,9 @@ gst_ducati_videnc_allocate_params (GstDucatiVidEnc * self)
}
static gboolean
-gst_ducati_videnc_allocate_params_default (GstDucatiVidEnc * self, gint params_sz,
- gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
+gst_ducati_videnc_allocate_params_default (GstDucatiVidEnc * self,
+ gint params_sz, gint dynparams_sz, gint status_sz, gint inargs_sz,
+ gint outargs_sz)
{
self->params = dce_alloc (params_sz);
memset (self->params, 0, params_sz);
diff --git a/src/gstducativp6dec.c b/src/gstducativp6dec.c
index d2bcc36..e2af463 100644
--- a/src/gstducativp6dec.c
+++ b/src/gstducativp6dec.c
@@ -40,17 +40,15 @@
#define PADX 48
#define PADY 48
-
-GST_BOILERPLATE (GstDucatiVP6Dec, gst_ducati_vp6dec, GstDucatiVidDec,
- GST_TYPE_DUCATIVIDDEC);
+#define gst_ducati_vp6dec_parent_class parent_class
+G_DEFINE_TYPE (GstDucatiVP6Dec, gst_ducati_vp6dec, GST_TYPE_DUCATIVIDDEC);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-vp6, "
"width = (int)[ 16, 2048 ], "
- "height = (int)[ 16, 2048 ], "
- "framerate = (fraction)[ 0, max ];")
+ "height = (int)[ 16, 2048 ], " "framerate = (fraction)[ 0, max ];")
);
/* GstDucatiVidDec vmethod implementations */
@@ -71,7 +69,8 @@ static gboolean
gst_ducati_vp6dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
{
- gboolean ret = parent_class->allocate_params (self,
+ gboolean ret =
+ GST_DUCATIVIDDEC_GET_CLASS (parent_class)->allocate_params (self,
sizeof (Ivp6VDEC_Params), sizeof (Ivp6VDEC_DynamicParams),
sizeof (Ivp6VDEC_Status), sizeof (Ivp6VDEC_InArgs),
sizeof (Ivp6VDEC_OutArgs));
@@ -94,6 +93,7 @@ gst_ducati_vp6dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
static GstBuffer *
gst_ducati_vp6dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
{
+ gpointer data;
guint32 sz;
if (G_UNLIKELY (vdec->first_in_buffer) && vdec->codec_data) {
@@ -101,10 +101,11 @@ gst_ducati_vp6dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
}
/* current codec version requires size prepended on input buffer: */
- sz = GST_BUFFER_SIZE (buf);
- push_input (vdec, (guint8 *)&sz, 4);
+ data = gst_buffer_map (buf, &sz, NULL, GST_MAP_READ);
+ push_input (vdec, (guint8 *) & sz, 4);
- push_input (vdec, GST_BUFFER_DATA (buf), sz);
+ push_input (vdec, data, sz);
+ gst_buffer_unmap (buf, data, sz);
gst_buffer_unref (buf);
return NULL;
@@ -114,35 +115,28 @@ gst_ducati_vp6dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
/* GObject vmethod implementations */
static void
-gst_ducati_vp6dec_base_init (gpointer gclass)
+gst_ducati_vp6dec_class_init (GstDucatiVP6DecClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
gst_element_class_set_details_simple (element_class,
"DucatiVP6Dec",
"Codec/Decoder/Video",
- "Decodes video in On2 VP6 format with ducati",
- "Rob Clark <rob@ti.com>");
+ "Decodes video in On2 VP6 format with ducati", "Rob Clark <rob@ti.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
-}
-static void
-gst_ducati_vp6dec_class_init (GstDucatiVP6DecClass * klass)
-{
- GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
bclass->codec_name = "ivahd_vp6dec";
bclass->update_buffer_size =
GST_DEBUG_FUNCPTR (gst_ducati_vp6dec_update_buffer_size);
bclass->allocate_params =
GST_DEBUG_FUNCPTR (gst_ducati_vp6dec_allocate_params);
- bclass->push_input =
- GST_DEBUG_FUNCPTR (gst_ducati_vp6dec_push_input);
+ bclass->push_input = GST_DEBUG_FUNCPTR (gst_ducati_vp6dec_push_input);
}
static void
-gst_ducati_vp6dec_init (GstDucatiVP6Dec * self,
- GstDucatiVP6DecClass * gclass)
+gst_ducati_vp6dec_init (GstDucatiVP6Dec * self)
{
}
diff --git a/src/gstducativp7dec.c b/src/gstducativp7dec.c
index 6e53303..e3638fd 100644
--- a/src/gstducativp7dec.c
+++ b/src/gstducativp7dec.c
@@ -41,16 +41,15 @@
#define PADY 48
-GST_BOILERPLATE (GstDucatiVP7Dec, gst_ducati_vp7dec, GstDucatiVidDec,
- GST_TYPE_DUCATIVIDDEC);
+#define gst_ducati_vp7dec_parent_class parent_class
+G_DEFINE_TYPE (GstDucatiVP7Dec, gst_ducati_vp7dec, GST_TYPE_DUCATIVIDDEC);
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-vp7, "
"width = (int)[ 16, 2048 ], "
- "height = (int)[ 16, 2048 ], "
- "framerate = (fraction)[ 0, max ];")
+ "height = (int)[ 16, 2048 ], " "framerate = (fraction)[ 0, max ];")
);
/* GstDucatiVidDec vmethod implementations */
@@ -71,7 +70,8 @@ static gboolean
gst_ducati_vp7dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
{
- gboolean ret = parent_class->allocate_params (self,
+ gboolean ret =
+ GST_DUCATIVIDDEC_GET_CLASS (parent_class)->allocate_params (self,
sizeof (Ivp7VDEC_Params), sizeof (Ivp7VDEC_DynamicParams),
sizeof (Ivp7VDEC_Status), sizeof (Ivp7VDEC_InArgs),
sizeof (Ivp7VDEC_OutArgs));
@@ -94,17 +94,20 @@ gst_ducati_vp7dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
static GstBuffer *
gst_ducati_vp7dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
{
- guint32 sz;
+ gpointer data;
+ guint sz;
if (G_UNLIKELY (vdec->first_in_buffer) && vdec->codec_data) {
// XXX none of the vp7 clips I've seen have codec_data..
}
+ data = gst_buffer_map (buf, &sz, NULL, GST_MAP_READ);
+
/* current codec version requires size prepended on input buffer: */
- sz = GST_BUFFER_SIZE (buf);
- push_input (vdec, (guint8 *)&sz, 4);
+ push_input (vdec, (guint8 *) & sz, 4);
- push_input (vdec, GST_BUFFER_DATA (buf), sz);
+ push_input (vdec, data, sz);
+ gst_buffer_unmap (buf, data, sz);
gst_buffer_unref (buf);
return NULL;
@@ -114,35 +117,28 @@ gst_ducati_vp7dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf)
/* GObject vmethod implementations */
static void
-gst_ducati_vp7dec_base_init (gpointer gclass)
+gst_ducati_vp7dec_class_init (GstDucatiVP7DecClass * klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
gst_element_class_set_details_simple (element_class,
"DucatiVP7Dec",
"Codec/Decoder/Video",
- "Decodes video in On2 VP7 format with ducati",
- "Rob Clark <rob@ti.com>");
+ "Decodes video in On2 VP7 format with ducati", "Rob Clark <rob@ti.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
-}
-static void
-gst_ducati_vp7dec_class_init (GstDucatiVP7DecClass * klass)
-{
- GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
bclass->codec_name = "ivahd_vp7dec";
bclass->update_buffer_size =
GST_DEBUG_FUNCPTR (gst_ducati_vp7dec_update_buffer_size);
bclass->allocate_params =
GST_DEBUG_FUNCPTR (gst_ducati_vp7dec_allocate_params);
- bclass->push_input =
- GST_DEBUG_FUNCPTR (gst_ducati_vp7dec_push_input);
+ bclass->push_input = GST_DEBUG_FUNCPTR (gst_ducati_vp7dec_push_input);
}
static void
-gst_ducati_vp7dec_init (GstDucatiVP7Dec * self,
- GstDucatiVP7DecClass * gclass)
+gst_ducati_vp7dec_init (GstDucatiVP7Dec * self)
{
}