diff options
author | Alessandro Decina <alessandro.decina@collabora.co.uk> | 2011-09-29 19:11:06 +0200 |
---|---|---|
committer | Alessandro Decina <alessandro.decina@collabora.co.uk> | 2011-09-29 19:11:06 +0200 |
commit | 02e37cf3c1aaf9d6f75a9dd971334795c4660c15 (patch) | |
tree | 7c14d636848e4e000df8f1cd182c34efc3af58f0 | |
parent | 0dad91742b68a7c80090cfc8a7a181fb703684d7 (diff) |
viddec: use 1d buffers
Expect and allocate 1d buffers. Support for 2d buffers will be added again at
some point in the near future.
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/gstducatibufferpool.c | 9 | ||||
-rw-r--r-- | src/gstducatibufferpool.h | 3 | ||||
-rw-r--r-- | src/gstducatividdec.c | 15 |
4 files changed, 16 insertions, 13 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 6fecedf..14de718 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,6 +29,6 @@ libgstducati_la_SOURCES = \ # compiler and linker flags used to compile this plugin, set in configure.ac libgstducati_la_CFLAGS = $(GST_CFLAGS) $(MEMMGR_CFLAGS) $(LIBDCE_CFLAGS) -libgstducati_la_LIBADD = $(GST_LIBS) $(MEMMGR_LIBS) $(LIBDCE_LIBS) +libgstducati_la_LIBADD = $(GST_LIBS) $(MEMMGR_LIBS) $(LIBDCE_LIBS) -lgstvideo-0.10 libgstducati_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(GST_ALL_LDFLAGS) --no-undefined libgstducati_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/src/gstducatibufferpool.c b/src/gstducatibufferpool.c index 4d9ea27..88480c1 100644 --- a/src/gstducatibufferpool.c +++ b/src/gstducatibufferpool.c @@ -44,16 +44,14 @@ gst_ducati_buffer_new (GstDucatiBufferPool * pool) { GstDucatiBuffer *self = (GstDucatiBuffer *) gst_mini_object_new (GST_TYPE_DUCATIBUFFER); - guint sz; GST_LOG_OBJECT (pool->element, "creating buffer %p in pool %p", self, pool); self->pool = (GstDucatiBufferPool *) gst_mini_object_ref (GST_MINI_OBJECT (pool)); - GST_BUFFER_DATA (self) = - gst_ducati_alloc_2d (pool->padded_width, pool->padded_height, &sz); - GST_BUFFER_SIZE (self) = sz; + GST_BUFFER_DATA (self) = gst_ducati_alloc_1d (pool->size); + GST_BUFFER_SIZE (self) = pool->size; gst_buffer_set_caps (GST_BUFFER (self), pool->caps); @@ -131,7 +129,7 @@ static GstMiniObjectClass *bufferpool_parent_class = NULL; /** create new bufferpool */ GstDucatiBufferPool * -gst_ducati_bufferpool_new (GstElement * element, GstCaps * caps) +gst_ducati_bufferpool_new (GstElement * element, GstCaps * caps, guint size) { GstDucatiBufferPool *self = (GstDucatiBufferPool *) gst_mini_object_new (GST_TYPE_DUCATIBUFFERPOOL); @@ -140,6 +138,7 @@ gst_ducati_bufferpool_new (GstElement * element, GstCaps * caps) self->element = gst_object_ref (element); gst_structure_get_int (s, "width", &self->padded_width); gst_structure_get_int (s, "height", &self->padded_height); + self->size = size; self->caps = gst_caps_ref (caps); self->freelist = NULL; self->lock = g_mutex_new (); diff --git a/src/gstducatibufferpool.h b/src/gstducatibufferpool.h index cbf48e9..a8588c8 100644 --- a/src/gstducatibufferpool.h +++ b/src/gstducatibufferpool.h @@ -43,6 +43,7 @@ struct _GstDucatiBufferPool /* output (padded) size including any codec padding: */ gint padded_width, padded_height; + guint size; GstCaps *caps; GMutex *lock; @@ -51,7 +52,7 @@ struct _GstDucatiBufferPool GstDucatiBuffer *freelist; /* list of available buffers */ }; -GstDucatiBufferPool * gst_ducati_bufferpool_new (GstElement * element, GstCaps * caps); +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); diff --git a/src/gstducatividdec.c b/src/gstducatividdec.c index 2c43740..46adc67 100644 --- a/src/gstducatividdec.c +++ b/src/gstducatividdec.c @@ -29,7 +29,7 @@ GST_BOILERPLATE (GstDucatiVidDec, gst_ducati_viddec, GstElement, 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_YUV ("NV12")) ); enum @@ -177,9 +177,13 @@ static inline GstBuffer * codec_bufferpool_get (GstDucatiVidDec * self, GstBuffer * buf) { if (G_UNLIKELY (!self->pool)) { + guint size; + + 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), - GST_PAD_CAPS (self->srcpad)); + GST_PAD_CAPS (self->srcpad), size); } return GST_BUFFER (gst_ducati_bufferpool_get (self->pool, buf)); } @@ -200,7 +204,7 @@ codec_prepare_outbuf (GstDucatiVidDec * self, GstBuffer * buf) y_type = gst_ducati_get_mem_type (y_paddr); uv_type = gst_ducati_get_mem_type (uv_paddr); - if ((y_type < 0) || (uv_type < 0)) { + if (y_type < 0) { GST_DEBUG_OBJECT (self, "non TILER buffer, fallback to bufferpool"); return codec_prepare_outbuf (self, codec_bufferpool_get (self, buf)); } @@ -518,7 +522,6 @@ gst_ducati_viddec_set_caps (GstPad * pad, GstCaps * caps) gst_structure_get_fraction (s, "framerate", &frn, &frd); - self->stride = 4096; /* TODO: don't hardcode */ gst_structure_get_boolean (s, "interlaced", &interlaced); @@ -526,11 +529,11 @@ gst_ducati_viddec_set_caps (GstPad * pad, GstCaps * caps) */ klass->update_buffer_size (self); + self->stride = self->padded_width; self->outsize = GST_ROUND_UP_2 (self->stride * self->padded_height * 3) / 2; - outcaps = gst_caps_new_simple ("video/x-raw-yuv-strided", - "rowstride", G_TYPE_INT, self->stride, + outcaps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('N','V','1','2'), "width", G_TYPE_INT, self->padded_width, "height", G_TYPE_INT, self->padded_height, |