1 /*
2 * GStreamer
3 * Copyright (c) 2010, Texas Instruments Incorporated
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation
8 * version 2.1 of the License.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
20 #ifdef HAVE_CONFIG_H
21 # include <config.h>
22 #endif
24 #include <gst/gst.h>
25 #include <gst/video/video.h>
27 #include "gstducatividdec.h"
29 GST_BOILERPLATE (GstDucatiVidDec, gst_ducati_viddec, GstElement,
30 GST_TYPE_ELEMENT);
32 static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
33 GST_PAD_SRC,
34 GST_PAD_ALWAYS,
35 GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV_STRIDED ("NV12", "[ 0, max ]"))
36 );
38 /* helper functions */
40 static void
41 engine_close (GstDucatiVidDec * self)
42 {
43 if (self->engine) {
44 Engine_close (self->engine);
45 self->engine = NULL;
46 }
48 if (self->params) {
49 dce_free (self->params);
50 self->params = NULL;
51 }
53 if (self->dynParams) {
54 dce_free (self->dynParams);
55 self->dynParams = NULL;
56 }
58 if (self->status) {
59 dce_free (self->status);
60 self->status = NULL;
61 }
63 if (self->inBufs) {
64 dce_free (self->inBufs);
65 self->inBufs = NULL;
66 }
68 if (self->outBufs) {
69 dce_free (self->outBufs);
70 self->outBufs = NULL;
71 }
73 if (self->inArgs) {
74 dce_free (self->inArgs);
75 self->inArgs = NULL;
76 }
78 if (self->outArgs) {
79 dce_free (self->outArgs);
80 self->outArgs = NULL;
81 }
82 }
84 static gboolean
85 engine_open (GstDucatiVidDec * self)
86 {
87 gboolean ret;
89 if (G_UNLIKELY (self->engine)) {
90 return TRUE;
91 }
93 GST_DEBUG_OBJECT (self, "opening engine");
95 self->engine = Engine_open ("ivahd_vidsvr", NULL, NULL);
96 if (G_UNLIKELY (!self->engine)) {
97 GST_ERROR_OBJECT (self, "could not create engine");
98 return FALSE;
99 }
101 ret = GST_DUCATIVIDDEC_GET_CLASS (self)->allocate_params (self,
102 sizeof (IVIDDEC3_Params), sizeof (IVIDDEC3_DynamicParams),
103 sizeof (IVIDDEC3_Status), sizeof (IVIDDEC3_InArgs),
104 sizeof (IVIDDEC3_OutArgs));
106 return ret;
107 }
109 static void
110 codec_delete (GstDucatiVidDec * self)
111 {
112 if (self->codec) {
113 VIDDEC3_delete(self->codec);
114 self->codec = NULL;
115 }
117 if (self->input) {
118 MemMgr_Free (self->input);
119 self->input = NULL;
120 }
121 }
123 static gboolean
124 codec_create (GstDucatiVidDec * self)
125 {
126 gint err;
127 const gchar *codec_name;
129 codec_delete (self);
131 if (G_UNLIKELY (!self->engine)) {
132 GST_ERROR_OBJECT (self, "no engine");
133 return FALSE;
134 }
136 /* these need to be set before VIDDEC3_create */
137 self->params->maxWidth = (self->width + 15) & ~0xf; /* round up to MB */
138 self->params->maxHeight = (self->height + 15) & ~0xf; /* round up to MB */
140 codec_name = GST_DUCATIVIDDEC_GET_CLASS (self)->codec_name;
142 /* create codec: */
143 GST_DEBUG_OBJECT (self, "creating codec: %s", codec_name);
144 self->codec = VIDDEC3_create (self->engine, (char *)codec_name, self->params);
146 if (!self->codec) {
147 return FALSE;
148 }
150 err = VIDDEC3_control (self->codec, XDM_SETPARAMS, self->dynParams, self->status);
151 if (err) {
152 GST_ERROR_OBJECT (self, "failed XDM_SETPARAMS");
153 return FALSE;
154 }
156 #if 0
157 /* not entirely sure why we need to call this here.. just copying omx.. */
158 err = VIDDEC3_control(self->codec, XDM_GETBUFINFO, self->dynParams, self->status);
159 if (err) {
160 GST_ERROR_OBJECT (self, "failed XDM_GETBUFINFO");
161 return FALSE;
162 }
163 #endif
165 self->first_in_buffer = TRUE;
166 self->first_out_buffer = TRUE;
168 /* allocate input buffer and initialize inBufs: */
169 self->inBufs->numBufs = 1;
170 self->input = gst_ducati_alloc_1d (self->width * self->height);
171 self->inBufs->descs[0].buf = (XDAS_Int8 *) TilerMem_VirtToPhys (self->input);
172 self->inBufs->descs[0].memType = XDM_MEMTYPE_RAW;
174 return TRUE;
175 }
177 static XDAS_Int32
178 codec_prepare_outbuf (GstDucatiVidDec * self, GstBuffer * buf)
179 {
180 XDAS_Int16 y_type, uv_type;
181 guint8 *y_vaddr, *uv_vaddr;
182 SSPtr y_paddr, uv_paddr;
184 y_vaddr = GST_BUFFER_DATA (buf);
185 uv_vaddr = y_vaddr + self->stride * self->padded_height;
187 y_paddr = TilerMem_VirtToPhys (y_vaddr);
188 uv_paddr = TilerMem_VirtToPhys (uv_vaddr);
190 y_type = gst_ducati_get_mem_type (y_paddr);
191 uv_type = gst_ducati_get_mem_type (uv_paddr);
193 if ((y_type < 0) || (uv_type < 0)) {
194 return 0;
195 }
197 if (!self->outBufs->numBufs) {
198 /* initialize output buffer type */
199 self->outBufs->numBufs = 2;
200 self->outBufs->descs[0].memType = y_type;
201 self->outBufs->descs[0].bufSize.tileMem.width = self->padded_width;
202 self->outBufs->descs[0].bufSize.tileMem.height = self->padded_height;
203 self->outBufs->descs[1].memType = uv_type;
204 /* note that UV interleaved width is same a Y: */
205 self->outBufs->descs[1].bufSize.tileMem.width = self->padded_width;
206 self->outBufs->descs[1].bufSize.tileMem.height = self->padded_height / 2;
207 } else {
208 /* verify output buffer type matches what we've already given
209 * to the codec
210 */
211 // TODO
212 }
214 self->outBufs->descs[0].buf = (XDAS_Int8 *) y_paddr;
215 self->outBufs->descs[1].buf = (XDAS_Int8 *) uv_paddr;
217 return (XDAS_Int32) buf; // XXX use lookup table
218 }
220 static GstBuffer *
221 codec_get_outbuf (GstDucatiVidDec * self, XDAS_Int32 id)
222 {
223 GstBuffer *buf = (GstBuffer *) id; // XXX use lookup table
224 if (buf) {
225 gst_buffer_ref (buf);
226 }
227 return buf;
228 }
230 static void
231 codec_unlock_outbuf (GstDucatiVidDec * self, XDAS_Int32 id)
232 {
233 GstBuffer *buf = (GstBuffer *) id; // XXX use lookup table
234 if (buf) {
235 gst_buffer_unref (buf);
236 }
237 }
239 static gint
240 codec_process (GstDucatiVidDec * self, gboolean send)
241 {
242 gint err;
243 GstClockTime t;
244 GstBuffer *outbuf = NULL;
245 gint i;
247 t = gst_util_get_timestamp ();
248 err = VIDDEC3_process (self->codec,
249 self->inBufs, self->outBufs, self->inArgs, self->outArgs);
250 GST_INFO_OBJECT (self, "%10dns", (gint) (gst_util_get_timestamp () - t));
251 if (err) {
252 return err;
253 }
255 for (i = 0; self->outArgs->outputID[i]; i++) {
256 if (G_UNLIKELY (self->first_out_buffer) && send) {
257 /* send region of interest to sink on first buffer: */
258 XDM_Rect *r = &(self->outArgs->displayBufs.bufDesc[0].activeFrameRegion);
260 gst_pad_push_event (self->srcpad,
261 gst_event_new_crop (r->topLeft.y, r->topLeft.x,
262 r->bottomRight.x - r->topLeft.x,
263 r->bottomRight.y - r->topLeft.y));
265 self->first_out_buffer = FALSE;
266 }
268 outbuf = codec_get_outbuf (self, self->outArgs->outputID[i]);
269 if (send) {
270 gst_pad_push (self->srcpad, outbuf);
271 } else {
272 gst_buffer_unref (outbuf);
273 }
274 }
276 for (i = 0; self->outArgs->freeBufID[i]; i++) {
277 codec_unlock_outbuf (self, self->outArgs->freeBufID[i]);
278 }
280 return err;
281 }
283 /** call control(FLUSH), and then process() to pop out all buffers */
284 static gboolean
285 codec_flush (GstDucatiVidDec * self, gboolean eos)
286 {
287 gint err;
289 GST_DEBUG_OBJECT (self, "flush: eos=%d", eos);
291 if (G_UNLIKELY (self->first_in_buffer)) {
292 return TRUE;
293 }
295 if (G_UNLIKELY (!self->codec)) {
296 GST_WARNING_OBJECT (self, "no codec");
297 return TRUE;
298 }
300 err = VIDDEC3_control (self->codec, XDM_FLUSH,
301 self->dynParams, self->status);
302 if (err) {
303 GST_ERROR_OBJECT (self, "failed XDM_FLUSH");
304 return FALSE;
305 }
307 do {
308 err = codec_process (self, eos);
309 } while (err != XDM_EFAIL);
311 self->first_in_buffer = TRUE;
313 GST_DEBUG_OBJECT (self, "done");
315 return TRUE;
316 }
318 /* GstDucatiVidDec vmethod default implementations */
320 static gboolean
321 gst_ducati_viddec_parse_caps (GstDucatiVidDec * self, GstStructure * s)
322 {
323 const GValue *codec_data;
325 if (gst_structure_get_int (s, "width", &self->width) &&
326 gst_structure_get_int (s, "height", &self->height)) {
328 const GValue *codec_data = gst_structure_get_value (s, "codec_data");
330 if (codec_data) {
331 GstBuffer *buffer = gst_value_get_buffer (codec_data);
332 GST_DEBUG_OBJECT (self, "codec_data: %" GST_PTR_FORMAT, buffer);
333 self->codec_data = gst_buffer_ref (buffer);
334 }
336 return TRUE;
337 }
339 return FALSE;
340 }
342 static gboolean
343 gst_ducati_viddec_allocate_params (GstDucatiVidDec * self, gint params_sz,
344 gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
345 {
347 /* allocate params: */
348 self->params = dce_alloc (params_sz);
349 if (G_UNLIKELY (!self->params)) {
350 return FALSE;
351 }
352 self->params->size = params_sz;
353 self->params->maxFrameRate = 30000;
354 self->params->maxBitRate = 10000000;
356 //rv??
358 self->params->dataEndianness = XDM_BYTE;
359 self->params->forceChromaFormat = XDM_YUV_420SP;
360 self->params->operatingMode = IVIDEO_DECODE_ONLY;
362 self->params->displayBufsMode = IVIDDEC3_DISPLAYBUFS_EMBEDDED;
363 self->params->inputDataMode = IVIDEO_ENTIREFRAME;
364 self->params->outputDataMode = IVIDEO_ENTIREFRAME;
365 self->params->numInputDataUnits = 0;
366 self->params->numOutputDataUnits = 0;
368 self->params->metadataType[0] = IVIDEO_METADATAPLANE_NONE;
369 self->params->metadataType[1] = IVIDEO_METADATAPLANE_NONE;
370 self->params->metadataType[2] = IVIDEO_METADATAPLANE_NONE;
371 self->params->errorInfoMode = IVIDEO_ERRORINFO_OFF;
373 /* allocate dynParams: */
374 self->dynParams = dce_alloc (dynparams_sz);
375 if (G_UNLIKELY (!self->dynParams)) {
376 return FALSE;
377 }
378 self->dynParams->size = dynparams_sz;
379 self->dynParams->decodeHeader = XDM_DECODE_AU;
380 self->dynParams->displayWidth = 0;
381 self->dynParams->frameSkipMode = IVIDEO_NO_SKIP;
382 self->dynParams->newFrameFlag = XDAS_TRUE;
384 /* allocate status: */
385 self->status = dce_alloc (status_sz);
386 if (G_UNLIKELY (!self->status)) {
387 return FALSE;
388 }
389 self->status->size = status_sz;
391 /* allocate inBufs/outBufs: */
392 self->inBufs = dce_alloc (sizeof (XDM2_BufDesc));
393 self->outBufs = dce_alloc (sizeof (XDM2_BufDesc));
394 if (G_UNLIKELY (!self->inBufs) || G_UNLIKELY (!self->outBufs)) {
395 return FALSE;
396 }
398 /* allocate inArgs/outArgs: */
399 self->inArgs = dce_alloc (inargs_sz);
400 self->outArgs = dce_alloc (outargs_sz);
401 if (G_UNLIKELY (!self->inArgs) || G_UNLIKELY (!self->outArgs)) {
402 return FALSE;
403 }
404 self->inArgs->size = inargs_sz;
405 self->outArgs->size = outargs_sz;
406 }
408 static GstBuffer *
409 gst_ducati_viddec_push_input (GstDucatiVidDec * self, GstBuffer * buf)
410 {
411 if (G_UNLIKELY (self->first_in_buffer) && self->codec_data) {
412 push_input (self, GST_BUFFER_DATA (self->codec_data),
413 GST_BUFFER_SIZE (self->codec_data));
414 }
416 /* just copy entire buffer */
417 push_input (self, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
418 gst_buffer_unref (buf);
420 return NULL;
421 }
423 /* GstElement vmethod implementations */
425 static gboolean
426 gst_ducati_viddec_set_caps (GstPad * pad, GstCaps * caps)
427 {
428 gboolean ret = TRUE;
429 GstDucatiVidDec *self = GST_DUCATIVIDDEC (gst_pad_get_parent (pad));
430 GstDucatiVidDecClass *klass = GST_DUCATIVIDDEC_GET_CLASS (self);
431 GstStructure *s;
433 g_return_val_if_fail (caps, FALSE);
434 g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
436 s = gst_caps_get_structure (caps, 0);
438 if (pad == self->sinkpad) {
439 gint frn = 0, frd = 1;
440 GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps);
442 if (klass->parse_caps (self, s)) {
443 GstCaps *outcaps;
445 gst_structure_get_fraction (s, "framerate", &frn, &frd);
447 self->stride = 4096; /* TODO: don't hardcode */
449 /* update output/padded sizes:
450 */
451 klass->update_buffer_size (self);
453 self->outsize =
454 GST_ROUND_UP_2 (self->stride * self->padded_height * 3) / 2;
456 outcaps = gst_caps_new_simple ("video/x-raw-yuv-strided",
457 "rowstride", G_TYPE_INT, self->stride,
458 "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('N','V','1','2'),
459 "width", G_TYPE_INT, self->padded_width,
460 "height", G_TYPE_INT, self->padded_height,
461 "framerate", GST_TYPE_FRACTION, frn, frd,
462 NULL);
464 GST_DEBUG_OBJECT (self, "outcaps: %" GST_PTR_FORMAT, outcaps);
466 ret = gst_pad_set_caps (self->srcpad, outcaps);
467 gst_caps_unref (outcaps);
469 if (!ret) {
470 GST_WARNING_OBJECT (self, "failed to set caps");
471 return FALSE;
472 }
473 } else {
474 GST_WARNING_OBJECT (self, "missing required fields");
475 return FALSE;
476 }
477 } else {
478 GST_INFO_OBJECT (self, "setcaps (src): %" GST_PTR_FORMAT, caps);
479 // XXX check to make sure caps are ok.. keep track if we
480 // XXX need to handle unstrided buffers..
481 GST_WARNING_OBJECT (self, "TODO");
482 }
484 gst_object_unref (self);
486 return gst_pad_set_caps (pad, caps);
487 }
489 static gboolean
490 gst_ducati_viddec_query (GstPad * pad, GstQuery * query)
491 {
492 GstDucatiVidDec *self = GST_DUCATIVIDDEC (GST_OBJECT_PARENT (pad));
494 switch (GST_QUERY_TYPE (query)) {
495 case GST_QUERY_BUFFERS:
496 GST_DEBUG_OBJECT (self, "min buffers: %d", self->min_buffers);
497 gst_query_set_buffers_count (query, self->min_buffers);
499 GST_DEBUG_OBJECT (self, "min dimensions: %dx%d",
500 self->padded_width, self->padded_height);
501 gst_query_set_buffers_dimensions (query,
502 self->padded_width, self->padded_height);
503 return TRUE;
504 default:
505 return FALSE;
506 }
507 }
509 static GstFlowReturn
510 gst_ducati_viddec_chain (GstPad * pad, GstBuffer * buf)
511 {
512 GstDucatiVidDec *self = GST_DUCATIVIDDEC (GST_OBJECT_PARENT (pad));
513 GstFlowReturn ret;
514 Int32 err;
515 GstBuffer *outbuf = NULL;
517 if (G_UNLIKELY (!self->engine)) {
518 GST_ERROR_OBJECT (self, "no engine");
519 return GST_FLOW_ERROR;
520 }
522 /* do this before creating codec to ensure reverse caps negotiation
523 * happens first:
524 */
525 ret = gst_pad_alloc_buffer_and_set_caps (self->srcpad, 0, self->outsize,
526 GST_PAD_CAPS (self->srcpad), &outbuf);
528 if (ret != GST_FLOW_OK) {
529 /* TODO: if we had our own buffer class, we could allocate our own
530 * output buffer from TILER...
531 */
532 GST_WARNING_OBJECT (self, "TODO: allocate output TILER buffer");
533 return ret;
534 }
536 if (G_UNLIKELY (!self->codec)) {
537 if (!codec_create (self)) {
538 GST_ERROR_OBJECT (self, "could not create codec");
539 return GST_FLOW_ERROR;
540 }
541 }
543 GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
544 GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
546 /* pass new output buffer as to the decoder to decode into: */
547 self->inArgs->inputID = codec_prepare_outbuf (self, outbuf);
548 if (!self->inArgs->inputID) {
549 GST_ERROR_OBJECT (self, "could not prepare output buffer");
550 return GST_FLOW_ERROR;
551 }
553 self->in_size = 0;
554 buf = GST_DUCATIVIDDEC_GET_CLASS (self)->push_input (self, buf);
555 self->inArgs->numBytes = self->in_size;
556 self->inBufs->descs[0].bufSize.bytes = self->in_size;
558 if (buf) {
559 // XXX
560 GST_WARNING_OBJECT (self, "TODO.. can't push more than one.. need loop");
561 gst_buffer_unref (buf);
562 buf = NULL;
563 }
565 err = codec_process (self, TRUE);
566 if (err) {
567 GST_ERROR_OBJECT (self, "process returned error: %d %08x",
568 err, self->outArgs->extendedError);
569 return GST_FLOW_ERROR;
570 }
572 self->first_in_buffer = FALSE;
574 if (self->outArgs->outBufsInUseFlag) {
575 GST_WARNING_OBJECT (self, "TODO... outBufsInUseFlag"); // XXX
576 }
578 return GST_FLOW_OK;
579 }
581 static gboolean
582 gst_ducati_viddec_event (GstPad * pad, GstEvent * event)
583 {
584 GstDucatiVidDec *self = GST_DUCATIVIDDEC (GST_OBJECT_PARENT (pad));
585 gboolean ret = TRUE;
586 gboolean eos = FALSE;
588 GST_INFO_OBJECT (self, "begin: event=%s", GST_EVENT_TYPE_NAME (event));
590 switch (GST_EVENT_TYPE (event)) {
591 case GST_EVENT_EOS:
592 eos = TRUE;
593 /* fall-through */
594 case GST_EVENT_FLUSH_STOP:
595 if (!codec_flush (self, eos)) {
596 GST_ERROR_OBJECT (self, "could not flush");
597 return FALSE;
598 }
599 /* fall-through */
600 default:
601 ret = gst_pad_push_event (self->srcpad, event);
602 break;
603 }
605 GST_LOG_OBJECT (self, "end");
607 return ret;
608 }
610 static GstStateChangeReturn
611 gst_ducati_viddec_change_state (GstElement * element,
612 GstStateChange transition)
613 {
614 GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
615 GstDucatiVidDec *self = GST_DUCATIVIDDEC (element);
617 GST_INFO_OBJECT (self, "begin: changing state %s -> %s",
618 gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
619 gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
621 switch (transition) {
622 case GST_STATE_CHANGE_NULL_TO_READY:
623 if (!engine_open (self)) {
624 GST_ERROR_OBJECT (self, "could not open");
625 return GST_STATE_CHANGE_FAILURE;
626 }
627 break;
628 default:
629 break;
630 }
632 ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
634 if (ret == GST_STATE_CHANGE_FAILURE)
635 goto leave;
637 switch (transition) {
638 case GST_STATE_CHANGE_READY_TO_NULL:
639 codec_delete (self);
640 engine_close (self);
641 break;
642 default:
643 break;
644 }
646 leave:
647 GST_LOG_OBJECT (self, "end");
649 return ret;
650 }
652 /* GObject vmethod implementations */
654 static void
655 gst_ducati_viddec_finalize (GObject * obj)
656 {
657 GstDucatiVidDec *self = GST_DUCATIVIDDEC (obj);
659 codec_delete (self);
660 engine_close (self);
662 if (self->codec_data) {
663 gst_buffer_unref (self->codec_data);
664 self->codec_data = NULL;
665 }
667 G_OBJECT_CLASS (parent_class)->finalize (obj);
668 }
670 static void
671 gst_ducati_viddec_base_init (gpointer gclass)
672 {
673 GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
675 gst_element_class_add_pad_template (element_class,
676 gst_static_pad_template_get (&src_factory));
677 }
679 static void
680 gst_ducati_viddec_class_init (GstDucatiVidDecClass * klass)
681 {
682 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
683 GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
685 gobject_class->finalize = gst_ducati_viddec_finalize;
686 gstelement_class->change_state = gst_ducati_viddec_change_state;
688 klass->parse_caps =
689 GST_DEBUG_FUNCPTR (gst_ducati_viddec_parse_caps);
690 klass->allocate_params =
691 GST_DEBUG_FUNCPTR (gst_ducati_viddec_allocate_params);
692 klass->push_input =
693 GST_DEBUG_FUNCPTR (gst_ducati_viddec_push_input);
694 }
696 static void
697 gst_ducati_viddec_init (GstDucatiVidDec * self, GstDucatiVidDecClass * klass)
698 {
699 GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
701 self->sinkpad = gst_pad_new_from_template (
702 gst_element_class_get_pad_template (gstelement_class, "sink"), "sink");
703 gst_pad_set_setcaps_function (self->sinkpad,
704 GST_DEBUG_FUNCPTR (gst_ducati_viddec_set_caps));
705 gst_pad_set_chain_function (self->sinkpad,
706 GST_DEBUG_FUNCPTR (gst_ducati_viddec_chain));
707 gst_pad_set_event_function (self->sinkpad,
708 GST_DEBUG_FUNCPTR (gst_ducati_viddec_event));
710 self->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
711 gst_pad_set_setcaps_function (self->srcpad,
712 GST_DEBUG_FUNCPTR (gst_ducati_viddec_set_caps));
713 gst_pad_set_query_function (self->srcpad,
714 GST_DEBUG_FUNCPTR (gst_ducati_viddec_query));
716 gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
717 gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
718 }