diff --git a/src/gstducatividdec.c b/src/gstducatividdec.c
index 953d94a0284868fbe55be9b3f18bd0851b847217..53bc94cfd7a17325e36856478692b5eb7bb4baba 100644 (file)
--- a/src/gstducatividdec.c
+++ b/src/gstducatividdec.c
/* GstDucatiVidDec vmethod default implementations */
/* GstDucatiVidDec vmethod default implementations */
+static gboolean
+gst_ducati_viddec_parse_caps (GstDucatiVidDec * self, GstStructure * s)
+{
+ const GValue *codec_data;
+
+ if (gst_structure_get_int (s, "width", &self->width) &&
+ gst_structure_get_int (s, "height", &self->height)) {
+
+ const GValue *codec_data = gst_structure_get_value (s, "codec_data");
+
+ if (codec_data) {
+ GstBuffer *buffer = gst_value_get_buffer (codec_data);
+ GST_DEBUG_OBJECT (self, "codec_data: %" GST_PTR_FORMAT, buffer);
+ self->codec_data = gst_buffer_ref (buffer);
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static gboolean
gst_ducati_viddec_allocate_params (GstDucatiVidDec * self, gint params_sz,
gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
static gboolean
gst_ducati_viddec_allocate_params (GstDucatiVidDec * self, gint params_sz,
gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
self->params->maxFrameRate = 30000;
self->params->maxBitRate = 10000000;
self->params->maxFrameRate = 30000;
self->params->maxBitRate = 10000000;
- //vc1:
- //self->params->maxBitRate = 45000000;
//vc6/vc7/rv??
self->params->dataEndianness = XDM_BYTE;
self->params->forceChromaFormat = XDM_YUV_420SP;
self->params->operatingMode = IVIDEO_DECODE_ONLY;
//vc6/vc7/rv??
self->params->dataEndianness = XDM_BYTE;
self->params->forceChromaFormat = XDM_YUV_420SP;
self->params->operatingMode = IVIDEO_DECODE_ONLY;
- //vc1:
- //self->params->displayDelay = IVIDDEC3_DISPLAY_DELAY_1;
-
self->params->displayBufsMode = IVIDDEC3_DISPLAYBUFS_EMBEDDED;
self->params->inputDataMode = IVIDEO_ENTIREFRAME;
self->params->outputDataMode = IVIDEO_ENTIREFRAME;
self->params->displayBufsMode = IVIDDEC3_DISPLAYBUFS_EMBEDDED;
self->params->inputDataMode = IVIDEO_ENTIREFRAME;
self->params->outputDataMode = IVIDEO_ENTIREFRAME;
self->outArgs->size = outargs_sz;
}
self->outArgs->size = outargs_sz;
}
-static inline void
-push_input (GstDucatiVidDec * self, GstBuffer * buf)
-{
- gint sz = GST_BUFFER_SIZE (buf);
- GST_DEBUG_OBJECT (self, "push: %d bytes)", sz);
- memcpy (self->input + self->in_size, GST_BUFFER_DATA (buf), sz);
- self->in_size += sz;
-}
-
static GstBuffer *
gst_ducati_viddec_push_input (GstDucatiVidDec * self, GstBuffer * buf)
{
static GstBuffer *
gst_ducati_viddec_push_input (GstDucatiVidDec * self, GstBuffer * buf)
{
- gint sz;
-
- if (self->first_in_buffer && self->codec_data) {
- push_input (self, self->codec_data);
+ 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));
}
/* just copy entire buffer */
}
/* just copy entire buffer */
- push_input (self, buf);
+ push_input (self, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
gst_buffer_unref (buf);
return NULL;
gst_buffer_unref (buf);
return NULL;
{
gboolean ret = TRUE;
GstDucatiVidDec *self = GST_DUCATIVIDDEC (gst_pad_get_parent (pad));
{
gboolean ret = TRUE;
GstDucatiVidDec *self = GST_DUCATIVIDDEC (gst_pad_get_parent (pad));
+ GstDucatiVidDecClass *klass = GST_DUCATIVIDDEC_GET_CLASS (self);
GstStructure *s;
g_return_val_if_fail (caps, FALSE);
GstStructure *s;
g_return_val_if_fail (caps, FALSE);
s = gst_caps_get_structure (caps, 0);
if (pad == self->sinkpad) {
s = gst_caps_get_structure (caps, 0);
if (pad == self->sinkpad) {
- gint width, height, frn, frd;
+ gint frn = 0, frd = 1;
GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps);
GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps);
- if (gst_structure_get_int (s, "width", &width) &&
- gst_structure_get_int (s, "height", &height) &&
- gst_structure_get_fraction (s, "framerate", &frn, &frd)) {
- const GValue *codec_data;
+ if (klass->parse_caps (self, s)) {
GstCaps *outcaps;
GstCaps *outcaps;
- /* ok, these caps seem sane.. grab the required values and construct
- * appropriate output caps
- */
- self->width = width;
- self->height = height;
- self->stride = 4096; /* TODO: don't hardcode */
+ gst_structure_get_fraction (s, "framerate", &frn, &frd);
- codec_data = gst_structure_get_value (s, "codec_data");
- if (codec_data) {
- GstBuffer *buffer = gst_value_get_buffer (codec_data);
- GST_DEBUG_OBJECT (self, "codec_data: %" GST_PTR_FORMAT, buffer);
- self->codec_data = gst_buffer_ref (buffer);
- }
+ self->stride = 4096; /* TODO: don't hardcode */
/* update output/padded sizes:
*/
/* update output/padded sizes:
*/
- GST_DUCATIVIDDEC_GET_CLASS (self)->update_buffer_size (self);
+ klass->update_buffer_size (self);
self->outsize =
GST_ROUND_UP_2 (self->stride * self->padded_height * 3) / 2;
self->outsize =
GST_ROUND_UP_2 (self->stride * self->padded_height * 3) / 2;
/* TODO: if we had our own buffer class, we could allocate our own
* output buffer from TILER...
*/
/* TODO: if we had our own buffer class, we could allocate our own
* output buffer from TILER...
*/
- GST_WARNING_OBJECT (self, "ret=%d", ret);
GST_WARNING_OBJECT (self, "TODO: allocate output TILER buffer");
return ret;
}
GST_WARNING_OBJECT (self, "TODO: allocate output TILER buffer");
return ret;
}
gobject_class->finalize = gst_ducati_viddec_finalize;
gstelement_class->change_state = gst_ducati_viddec_change_state;
gobject_class->finalize = gst_ducati_viddec_finalize;
gstelement_class->change_state = gst_ducati_viddec_change_state;
+ klass->parse_caps =
+ GST_DEBUG_FUNCPTR (gst_ducati_viddec_parse_caps);
klass->allocate_params =
GST_DEBUG_FUNCPTR (gst_ducati_viddec_allocate_params);
klass->push_input =
klass->allocate_params =
GST_DEBUG_FUNCPTR (gst_ducati_viddec_allocate_params);
klass->push_input =