53bc94cfd7a17325e36856478692b5eb7bb4baba
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 //XXX this crashes ducati:
114 //VIDDEC3_delete(self->codec);
115 self->codec = NULL;
116 }
118 if (self->input) {
119 MemMgr_Free (self->input);
120 self->input = NULL;
121 }
122 }
124 static gboolean
125 codec_create (GstDucatiVidDec * self)
126 {
127 gint err;
128 const gchar *codec_name;
130 codec_delete (self);
132 if (G_UNLIKELY (!self->engine)) {
133 GST_ERROR_OBJECT (self, "no engine");
134 return FALSE;
135 }
137 /* these need to be set before VIDDEC3_create */
138 self->params->maxWidth = (self->width + 15) & ~0xf; /* round up to MB */
139 self->params->maxHeight = (self->height + 15) & ~0xf; /* round up to MB */
141 codec_name = GST_DUCATIVIDDEC_GET_CLASS (self)->codec_name;
143 /* create codec: */
144 GST_DEBUG_OBJECT (self, "creating codec: %s", codec_name);
145 self->codec = VIDDEC3_create (self->engine, (char *)codec_name, self->params);
147 if (!self->codec) {
148 return FALSE;
149 }
151 err = VIDDEC3_control (self->codec, XDM_SETPARAMS, self->dynParams, self->status);
152 if (err) {
153 GST_ERROR_OBJECT (self, "failed XDM_SETPARAMS");
154 return FALSE;
155 }
157 #if 0
158 /* not entirely sure why we need to call this here.. just copying omx.. */
159 err = VIDDEC3_control(self->codec, XDM_GETBUFINFO, self->dynParams, self->status);
160 if (err) {
161 GST_ERROR_OBJECT (self, "failed XDM_GETBUFINFO");
162 return FALSE;
163 }
164 #endif
166 self->first_in_buffer = TRUE;
167 self->first_out_buffer = TRUE;
169 /* allocate input buffer and initialize inBufs: */
170 self->inBufs->numBufs = 1;
171 self->input = gst_ducati_alloc_1d (self->width * self->height);
172 self->inBufs->descs[0].buf = (XDAS_Int8 *) TilerMem_VirtToPhys (self->input);
173 self->inBufs->descs[0].memType = XDM_MEMTYPE_RAW;
175 return TRUE;
176 }
178 static XDAS_Int32
179 codec_prepare_outbuf (GstDucatiVidDec * self, GstBuffer * buf)
180 {
181 XDAS_Int16 y_type, uv_type;
182 guint8 *y_vaddr, *uv_vaddr;
183 SSPtr y_paddr, uv_paddr;
185 y_vaddr = GST_BUFFER_DATA (buf);
186 uv_vaddr = y_vaddr + self->stride * self->padded_height;
188 y_paddr = TilerMem_VirtToPhys (y_vaddr);
189 uv_paddr = TilerMem_VirtToPhys (uv_vaddr);
191 y_type = gst_ducati_get_mem_type (y_paddr);
192 uv_type = gst_ducati_get_mem_type (uv_paddr);
194 if ((y_type < 0) || (uv_type < 0)) {
195 return 0;
196 }
198 if (!self->outBufs->numBufs) {
199 /* initialize output buffer type */
200 self->outBufs->numBufs = 2;
201 self->outBufs->descs[0].memType = y_type;
202 self->outBufs->descs[0].bufSize.tileMem.width = self->padded_width;
203 self->outBufs->descs[0].bufSize.tileMem.height = self->padded_height;
204 self->outBufs->descs[1].memType = uv_type;
205 /* note that UV interleaved width is same a Y: */
206 self->outBufs->descs[1].bufSize.tileMem.width = self->padded_width;
207 self->outBufs->descs[1].bufSize.tileMem.height = self->padded_height / 2;
208 } else {
209 /* verify output buffer type matches what we've already given
210 * to the codec
211 */
212 // TODO
213 }
215 self->outBufs->descs[0].buf = (XDAS_Int8 *) y_paddr;
216 self->outBufs->descs[1].buf = (XDAS_Int8 *) uv_paddr;
218 return (XDAS_Int32) buf; // XXX use lookup table
219 }
221 static GstBuffer *
222 codec_get_outbuf (GstDucatiVidDec * self, XDAS_Int32 id)
223 {
224 GstBuffer *buf = (GstBuffer *) id; // XXX use lookup table
225 if (buf) {
226 gst_buffer_ref (buf);
227 }
228 return buf;
229 }
231 static void
232 codec_unlock_outbuf (GstDucatiVidDec * self, XDAS_Int32 id)
233 {
234 GstBuffer *buf = (GstBuffer *) id; // XXX use lookup table
235 if (buf) {
236 gst_buffer_unref (buf);
237 }
238 }
240 static gint
241 codec_process (GstDucatiVidDec * self, gboolean send)
242 {
243 gint err;
244 GstClockTime t;
245 GstBuffer *outbuf = NULL;
246 gint i;
248 t = gst_util_get_timestamp ();
249 err = VIDDEC3_process (self->codec,
250 self->inBufs, self->outBufs, self->inArgs, self->outArgs);
251 GST_INFO_OBJECT (self, "%10dns", (gint) (gst_util_get_timestamp () - t));
252 if (err) {
253 return err;
254 }
256 for (i = 0; self->outArgs->outputID[i]; i++) {
257 if (G_UNLIKELY (self->first_out_buffer) && send) {
258 /* send region of interest to sink on first buffer: */
259 XDM_Rect *r = &(self->outArgs->displayBufs.bufDesc[0].activeFrameRegion);
261 gst_pad_push_event (self->srcpad,
262 gst_event_new_crop (r->topLeft.y, r->topLeft.x,
263 r->bottomRight.x - r->topLeft.x,
264 r->bottomRight.y - r->topLeft.y));
266 self->first_out_buffer = FALSE;
267 }
269 outbuf = codec_get_outbuf (self, self->outArgs->outputID[i]);
270 if (send) {
271 gst_pad_push (self->srcpad, outbuf);
272 } else {
273 gst_buffer_unref (outbuf);
274 }
275 }
277 for (i = 0; self->outArgs->freeBufID[i]; i++) {
278 codec_unlock_outbuf (self, self->outArgs->freeBufID[i]);
279 }
281 return err;
282 }
284 /** call control(FLUSH), and then process() to pop out all buffers */
285 static gboolean
286 codec_flush (GstDucatiVidDec * self, gboolean eos)
287 {
288 gint err;
290 GST_DEBUG_OBJECT (self, "flush: eos=%d", eos);
292 if (G_UNLIKELY (self->first_in_buffer)) {
293 return TRUE;
294 }
296 if (G_UNLIKELY (!self->codec)) {
297 GST_WARNING_OBJECT (self, "no codec");
298 return TRUE;
299 }
301 err = VIDDEC3_control (self->codec, XDM_FLUSH,
302 self->dynParams, self->status);
303 if (err) {
304 GST_ERROR_OBJECT (self, "failed XDM_FLUSH");
305 return FALSE;
306 }
308 do {
309 err = codec_process (self, eos);
310 } while (err != XDM_EFAIL);
312 self->first_in_buffer = TRUE;
314 GST_DEBUG_OBJECT (self, "done");
316 return TRUE;
317 }
319 /* GstDucatiVidDec vmethod default implementations */
321 static gboolean
322 gst_ducati_viddec_parse_caps (GstDucatiVidDec * self, GstStructure * s)
323 {
324 const GValue *codec_data;
326 if (gst_structure_get_int (s, "width", &self->width) &&
327 gst_structure_get_int (s, "height", &self->height)) {
329 const GValue *codec_data = gst_structure_get_value (s, "codec_data");
331 if (codec_data) {
332 GstBuffer *buffer = gst_value_get_buffer (codec_data);
333 GST_DEBUG_OBJECT (self, "codec_data: %" GST_PTR_FORMAT, buffer);
334 self->codec_data = gst_buffer_ref (buffer);
335 }
337 return TRUE;
338 }
340 return FALSE;
341 }
343 static gboolean
344 gst_ducati_viddec_allocate_params (GstDucatiVidDec * self, gint params_sz,
345 gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
346 {
348 /* allocate params: */
349 self->params = dce_alloc (params_sz);
350 if (G_UNLIKELY (!self->params)) {
351 return FALSE;
352 }
353 self->params->size = params_sz;
354 self->params->maxFrameRate = 30000;
355 self->params->maxBitRate = 10000000;
357 //vc6/vc7/rv??
359 self->params->dataEndianness = XDM_BYTE;
360 self->params->forceChromaFormat = XDM_YUV_420SP;
361 self->params->operatingMode = IVIDEO_DECODE_ONLY;
363 self->params->displayBufsMode = IVIDDEC3_DISPLAYBUFS_EMBEDDED;
364 self->params->inputDataMode = IVIDEO_ENTIREFRAME;
365 self->params->outputDataMode = IVIDEO_ENTIREFRAME;
366 self->params->numInputDataUnits = 0;
367 self->params->numOutputDataUnits = 0;
369 //vp6, vp7:
370 //self->params->numInputDataUnits = 1;
371 //self->params->numOutputDataUnits = 1;
373 self->params->metadataType[0] = IVIDEO_METADATAPLANE_NONE;
374 self->params->metadataType[1] = IVIDEO_METADATAPLANE_NONE;
375 self->params->metadataType[2] = IVIDEO_METADATAPLANE_NONE;
376 self->params->errorInfoMode = IVIDEO_ERRORINFO_OFF;
378 /* allocate dynParams: */
379 self->dynParams = dce_alloc (dynparams_sz);
380 if (G_UNLIKELY (!self->dynParams)) {
381 return FALSE;
382 }
383 self->dynParams->size = dynparams_sz;
384 self->dynParams->decodeHeader = XDM_DECODE_AU;
385 self->dynParams->displayWidth = 0;
386 self->dynParams->frameSkipMode = IVIDEO_NO_SKIP;
387 self->dynParams->newFrameFlag = XDAS_TRUE;
389 /* allocate status: */
390 self->status = dce_alloc (status_sz);
391 if (G_UNLIKELY (!self->status)) {
392 return FALSE;
393 }
394 self->status->size = status_sz;
396 /* allocate inBufs/outBufs: */
397 self->inBufs = dce_alloc (sizeof (XDM2_BufDesc));
398 self->outBufs = dce_alloc (sizeof (XDM2_BufDesc));
399 if (G_UNLIKELY (!self->inBufs) || G_UNLIKELY (!self->outBufs)) {
400 return FALSE;
401 }
403 /* allocate inArgs/outArgs: */
404 self->inArgs = dce_alloc (inargs_sz);
405 self->outArgs = dce_alloc (outargs_sz);
406 if (G_UNLIKELY (!self->inArgs) || G_UNLIKELY (!self->outArgs)) {
407 return FALSE;
408 }
409 self->inArgs->size = inargs_sz;
410 self->outArgs->size = outargs_sz;
411 }
413 static GstBuffer *
414 gst_ducati_viddec_push_input (GstDucatiVidDec * self, GstBuffer * buf)
415 {
416 if (G_UNLIKELY (self->first_in_buffer) && self->codec_data) {
417 push_input (self, GST_BUFFER_DATA (self->codec_data),
418 GST_BUFFER_SIZE (self->codec_data));
419 }
421 /* just copy entire buffer */
422 push_input (self, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
423 gst_buffer_unref (buf);
425 return NULL;
426 }
428 /* GstElement vmethod implementations */
430 static gboolean
431 gst_ducati_viddec_set_caps (GstPad * pad, GstCaps * caps)
432 {
433 gboolean ret = TRUE;
434 GstDucatiVidDec *self = GST_DUCATIVIDDEC (gst_pad_get_parent (pad));
435 GstDucatiVidDecClass *klass = GST_DUCATIVIDDEC_GET_CLASS (self);
436 GstStructure *s;
438 g_return_val_if_fail (caps, FALSE);
439 g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
441 s = gst_caps_get_structure (caps, 0);
443 if (pad == self->sinkpad) {
444 gint frn = 0, frd = 1;
445 GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps);
447 if (klass->parse_caps (self, s)) {
448 GstCaps *outcaps;
450 gst_structure_get_fraction (s, "framerate", &frn, &frd);
452 self->stride = 4096; /* TODO: don't hardcode */
454 /* update output/padded sizes:
455 */
456 klass->update_buffer_size (self);
458 self->outsize =
459 GST_ROUND_UP_2 (self->stride * self->padded_height * 3) / 2;
461 outcaps = gst_caps_new_simple ("video/x-raw-yuv-strided",
462 "rowstride", G_TYPE_INT, self->stride,
463 "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('N','V','1','2'),
464 "width", G_TYPE_INT, self->padded_width,
465 "height", G_TYPE_INT, self->padded_height,
466 "framerate", GST_TYPE_FRACTION, frn, frd,
467 NULL);
469 GST_DEBUG_OBJECT (self, "outcaps: %" GST_PTR_FORMAT, outcaps);
471 ret = gst_pad_set_caps (self->srcpad, outcaps);
472 gst_caps_unref (outcaps);
474 if (!ret) {
475 GST_WARNING_OBJECT (self, "failed to set caps");
476 return FALSE;
477 }
478 } else {
479 GST_WARNING_OBJECT (self, "missing required fields");
480 return FALSE;
481 }
482 } else {
483 GST_INFO_OBJECT (self, "setcaps (src): %" GST_PTR_FORMAT, caps);
484 // XXX check to make sure caps are ok.. keep track if we
485 // XXX need to handle unstrided buffers..
486 GST_WARNING_OBJECT (self, "TODO");
487 }
489 gst_object_unref (self);
491 return gst_pad_set_caps (pad, caps);
492 }
494 static gboolean
495 gst_ducati_viddec_query (GstPad * pad, GstQuery * query)
496 {
497 GstDucatiVidDec *self = GST_DUCATIVIDDEC (GST_OBJECT_PARENT (pad));
499 switch (GST_QUERY_TYPE (query)) {
500 case GST_QUERY_BUFFERS:
501 GST_DEBUG_OBJECT (self, "min buffers: %d", self->min_buffers);
502 gst_query_set_buffers_count (query, self->min_buffers);
504 GST_DEBUG_OBJECT (self, "min dimensions: %dx%d",
505 self->padded_width, self->padded_height);
506 gst_query_set_buffers_dimensions (query,
507 self->padded_width, self->padded_height);
508 return TRUE;
509 default:
510 return FALSE;
511 }
512 }
514 static GstFlowReturn
515 gst_ducati_viddec_chain (GstPad * pad, GstBuffer * buf)
516 {
517 GstDucatiVidDec *self = GST_DUCATIVIDDEC (GST_OBJECT_PARENT (pad));
518 GstFlowReturn ret;
519 Int32 err;
520 GstBuffer *outbuf = NULL;
522 if (G_UNLIKELY (!self->engine)) {
523 GST_ERROR_OBJECT (self, "no engine");
524 return GST_FLOW_ERROR;
525 }
527 /* do this before creating codec to ensure reverse caps negotiation
528 * happens first:
529 */
530 ret = gst_pad_alloc_buffer_and_set_caps (self->srcpad, 0, self->outsize,
531 GST_PAD_CAPS (self->srcpad), &outbuf);
533 if (ret != GST_FLOW_OK) {
534 /* TODO: if we had our own buffer class, we could allocate our own
535 * output buffer from TILER...
536 */
537 GST_WARNING_OBJECT (self, "TODO: allocate output TILER buffer");
538 return ret;
539 }
541 if (G_UNLIKELY (!self->codec)) {
542 if (!codec_create (self)) {
543 GST_ERROR_OBJECT (self, "could not create codec");
544 return GST_FLOW_ERROR;
545 }
546 }
548 GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
549 GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
551 /* pass new output buffer as to the decoder to decode into: */
552 self->inArgs->inputID = codec_prepare_outbuf (self, outbuf);
553 if (!self->inArgs->inputID) {
554 GST_ERROR_OBJECT (self, "could not prepare output buffer");
555 return GST_FLOW_ERROR;
556 }
558 self->in_size = 0;
559 buf = GST_DUCATIVIDDEC_GET_CLASS (self)->push_input (self, buf);
560 self->inArgs->numBytes = self->in_size;
561 self->inBufs->descs[0].bufSize.bytes = self->in_size;
563 if (buf) {
564 // XXX
565 GST_WARNING_OBJECT (self, "TODO.. can't push more than one.. need loop");
566 gst_buffer_unref (buf);
567 buf = NULL;
568 }
570 err = codec_process (self, TRUE);
571 if (err) {
572 GST_ERROR_OBJECT (self, "process returned error: %d %08x",
573 err, self->outArgs->extendedError);
574 return GST_FLOW_ERROR;
575 }
577 self->first_in_buffer = FALSE;
579 if (self->outArgs->outBufsInUseFlag) {
580 GST_WARNING_OBJECT (self, "TODO... outBufsInUseFlag"); // XXX
581 }
583 return GST_FLOW_OK;
584 }
586 static gboolean
587 gst_ducati_viddec_event (GstPad * pad, GstEvent * event)
588 {
589 GstDucatiVidDec *self = GST_DUCATIVIDDEC (GST_OBJECT_PARENT (pad));
590 gboolean ret = TRUE;
591 gboolean eos = FALSE;
593 GST_INFO_OBJECT (self, "begin: event=%s", GST_EVENT_TYPE_NAME (event));
595 switch (GST_EVENT_TYPE (event)) {
596 case GST_EVENT_EOS:
597 eos = TRUE;
598 /* fall-through */
599 case GST_EVENT_FLUSH_STOP:
600 if (!codec_flush (self, eos)) {
601 GST_ERROR_OBJECT (self, "could not flush");
602 return FALSE;
603 }
604 /* fall-through */
605 default:
606 ret = gst_pad_push_event (self->srcpad, event);
607 break;
608 }
610 GST_LOG_OBJECT (self, "end");
612 return ret;
613 }
615 static GstStateChangeReturn
616 gst_ducati_viddec_change_state (GstElement * element,
617 GstStateChange transition)
618 {
619 GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
620 GstDucatiVidDec *self = GST_DUCATIVIDDEC (element);
622 GST_INFO_OBJECT (self, "begin: changing state %s -> %s",
623 gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
624 gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
626 switch (transition) {
627 case GST_STATE_CHANGE_NULL_TO_READY:
628 if (!engine_open (self)) {
629 GST_ERROR_OBJECT (self, "could not open");
630 return GST_STATE_CHANGE_FAILURE;
631 }
632 break;
633 default:
634 break;
635 }
637 ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
639 if (ret == GST_STATE_CHANGE_FAILURE)
640 goto leave;
642 switch (transition) {
643 case GST_STATE_CHANGE_READY_TO_NULL:
644 codec_delete (self);
645 engine_close (self);
646 break;
647 default:
648 break;
649 }
651 leave:
652 GST_LOG_OBJECT (self, "end");
654 return ret;
655 }
657 /* GObject vmethod implementations */
659 static void
660 gst_ducati_viddec_finalize (GObject * obj)
661 {
662 GstDucatiVidDec *self = GST_DUCATIVIDDEC (obj);
664 codec_delete (self);
665 engine_close (self);
667 if (self->codec_data) {
668 gst_buffer_unref (self->codec_data);
669 self->codec_data = NULL;
670 }
672 G_OBJECT_CLASS (parent_class)->finalize (obj);
673 }
675 static void
676 gst_ducati_viddec_base_init (gpointer gclass)
677 {
678 GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
680 gst_element_class_add_pad_template (element_class,
681 gst_static_pad_template_get (&src_factory));
682 }
684 static void
685 gst_ducati_viddec_class_init (GstDucatiVidDecClass * klass)
686 {
687 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
688 GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
690 gobject_class->finalize = gst_ducati_viddec_finalize;
691 gstelement_class->change_state = gst_ducati_viddec_change_state;
693 klass->parse_caps =
694 GST_DEBUG_FUNCPTR (gst_ducati_viddec_parse_caps);
695 klass->allocate_params =
696 GST_DEBUG_FUNCPTR (gst_ducati_viddec_allocate_params);
697 klass->push_input =
698 GST_DEBUG_FUNCPTR (gst_ducati_viddec_push_input);
699 }
701 static void
702 gst_ducati_viddec_init (GstDucatiVidDec * self, GstDucatiVidDecClass * klass)
703 {
704 GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
706 self->sinkpad = gst_pad_new_from_template (
707 gst_element_class_get_pad_template (gstelement_class, "sink"), "sink");
708 gst_pad_set_setcaps_function (self->sinkpad,
709 GST_DEBUG_FUNCPTR (gst_ducati_viddec_set_caps));
710 gst_pad_set_chain_function (self->sinkpad,
711 GST_DEBUG_FUNCPTR (gst_ducati_viddec_chain));
712 gst_pad_set_event_function (self->sinkpad,
713 GST_DEBUG_FUNCPTR (gst_ducati_viddec_event));
715 self->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
716 gst_pad_set_setcaps_function (self->srcpad,
717 GST_DEBUG_FUNCPTR (gst_ducati_viddec_set_caps));
718 gst_pad_set_query_function (self->srcpad,
719 GST_DEBUG_FUNCPTR (gst_ducati_viddec_query));
721 gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
722 gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
723 }