2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
22 /* First, include the header file for the plugin, to bring in the
23 * object definition and other useful things.
27 #define NTSC_HEIGHT 480
28 #define NTSC_BUFFER 120000
29 #define PAL_HEIGHT 576
30 #define PAL_BUFFER 144000
32 /* The ElementDetails structure gives a human-readable description
33 * of the plugin, as well as author and version data.
35 static GstElementDetails dvdec_details = {
36 "DV (smpte314) decoder plugin",
38 "Uses libdv to decode DV video (libdv.sourceforge.net)",
40 "Erik Walthinsen <omega@cse.ogi.edu>\n"
41 "Wim Taymans <wim.taymans@tvd.be>",
46 /* These are the signals that this element can fire. They are zero-
47 * based because the numbers themselves are private to the object.
48 * LAST_SIGNAL is used for initialization of the signal array.
56 /* Arguments are identified the same way, but cannot be zero, so you
57 * must leave the ARG_0 entry in as a placeholder.
64 /* The PadFactory structures describe what pads the element has or
65 * can have. They can be quite complex, but for this dvdec plugin
66 * they are rather simple.
68 GST_PAD_TEMPLATE_FACTORY (sink_temp,
75 "format", GST_PROPS_LIST (
76 GST_PROPS_STRING ("PAL"),
77 GST_PROPS_STRING ("NTSC")
83 GST_PAD_TEMPLATE_FACTORY (video_src_temp,
90 "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')),
91 "width", GST_PROPS_INT (720),
92 "height", GST_PROPS_INT_RANGE (NTSC_HEIGHT, PAL_HEIGHT)
97 "format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('R','G','B',' ')),
98 "bpp", GST_PROPS_INT(24),
99 "depth", GST_PROPS_INT(24),
100 "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
101 "red_mask", GST_PROPS_INT(0x0000ff),
102 "green_mask", GST_PROPS_INT(0x00ff00),
103 "blue_mask", GST_PROPS_INT(0xff0000),
104 "width", GST_PROPS_INT (720),
105 "height", GST_PROPS_INT_RANGE (NTSC_HEIGHT, PAL_HEIGHT)
110 "format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('R','G','B',' ')),
111 "bpp", GST_PROPS_INT(32),
112 "depth", GST_PROPS_INT(32),
113 "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
114 "red_mask", GST_PROPS_INT(0x00ff0000),
115 "green_mask", GST_PROPS_INT(0x0000ff00),
116 "blue_mask", GST_PROPS_INT(0x000000ff),
117 "width", GST_PROPS_INT (720),
118 "height", GST_PROPS_INT_RANGE (NTSC_HEIGHT, PAL_HEIGHT)
122 GST_PAD_TEMPLATE_FACTORY ( audio_src_temp,
129 "format", GST_PROPS_STRING ("int"),
130 "law", GST_PROPS_INT (0),
131 "depth", GST_PROPS_INT (16),
132 "width", GST_PROPS_INT (16),
133 "signed", GST_PROPS_BOOLEAN (TRUE),
134 "channels", GST_PROPS_INT (2),
135 "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN)
141 dv_type_find (GstBuffer *buf, gpointer private)
143 gulong head = GULONG_FROM_BE(*((gulong *)GST_BUFFER_DATA(buf)));
146 /* check for DIF and DV flag */
147 if ((head & 0xffffff00) == 0x1f070000 && !(GST_BUFFER_DATA(buf)[4] & 0x01)) {
150 if ((head & 0x000000ff) & 0x80)
155 new = GST_CAPS_NEW ("dv_type_find",
157 "format", GST_PROPS_STRING (format)
163 static GstTypeDefinition dv_definition = {
164 "dv_video/dv", "video/dv", ".dv", dv_type_find
167 /* A number of functon prototypes are given so we can refer to them later. */
168 static void gst_dvdec_class_init (GstDVDecClass *klass);
169 static void gst_dvdec_init (GstDVDec *dvdec);
171 static gboolean gst_dvdec_src_query (GstPad *pad, GstPadQueryType type,
172 GstFormat *format, gint64 *value);
173 static gboolean gst_dvdec_sink_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
174 GstFormat *dest_format, gint64 *dest_value);
175 static gboolean gst_dvdec_src_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
176 GstFormat *dest_format, gint64 *dest_value);
178 static gboolean gst_dvdec_handle_src_event (GstPad *pad, GstEvent *event);
180 static void gst_dvdec_loop (GstElement *element);
182 static GstElementStateReturn
183 gst_dvdec_change_state (GstElement *element);
185 static void gst_dvdec_set_property (GObject *object, guint prop_id,
186 const GValue *value, GParamSpec *pspec);
187 static void gst_dvdec_get_property (GObject *object, guint prop_id,
188 GValue *value, GParamSpec *pspec);
190 /* The parent class pointer needs to be kept around for some object
193 static GstElementClass *parent_class = NULL;
195 /* This array holds the ids of the signals registered for this object.
196 * The array indexes are based on the enum up above.
198 /*static guint gst_dvdec_signals[LAST_SIGNAL] = { 0 }; */
200 /* This function is used to register and subsequently return the type
201 * identifier for this object class. On first invocation, it will
202 * register the type, providing the name of the class, struct sizes,
203 * and pointers to the various functions that define the class.
206 gst_dvdec_get_type (void)
208 static GType dvdec_type = 0;
211 static const GTypeInfo dvdec_info = {
212 sizeof (GstDVDecClass),
215 (GClassInitFunc) gst_dvdec_class_init,
220 (GInstanceInitFunc) gst_dvdec_init,
222 dvdec_type = g_type_register_static (GST_TYPE_ELEMENT, "GstDVDec", &dvdec_info, 0);
227 /* In order to create an instance of an object, the class must be
228 * initialized by this function. GObject will take care of running
229 * it, based on the pointer to the function provided above.
232 gst_dvdec_class_init (GstDVDecClass *klass)
234 /* Class pointers are needed to supply pointers to the private
235 * implementations of parent class methods.
237 GObjectClass *gobject_class;
238 GstElementClass *gstelement_class;
240 /* Since the dvdec class contains the parent classes, you can simply
241 * cast the pointer to get access to the parent classes.
243 gobject_class = (GObjectClass*) klass;
244 gstelement_class = (GstElementClass*) klass;
246 /* The parent class is needed for class method overrides. */
247 parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
249 gobject_class->set_property = gst_dvdec_set_property;
250 gobject_class->get_property = gst_dvdec_get_property;
252 gstelement_class->change_state = gst_dvdec_change_state;
254 /* table initialization, only do once */
258 /* This function is responsible for initializing a specific instance of
262 gst_dvdec_init(GstDVDec *dvdec)
266 dvdec->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_temp), "sink");
267 gst_element_add_pad (GST_ELEMENT (dvdec), dvdec->sinkpad);
268 gst_pad_set_query_function (dvdec->sinkpad, NULL);
269 gst_pad_set_convert_function (dvdec->sinkpad, gst_dvdec_sink_convert);
271 dvdec->videosrcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (video_src_temp), "video");
272 gst_element_add_pad (GST_ELEMENT (dvdec), dvdec->videosrcpad);
273 gst_pad_set_query_function (dvdec->videosrcpad, gst_dvdec_src_query);
274 gst_pad_set_event_function (dvdec->videosrcpad, gst_dvdec_handle_src_event);
275 gst_pad_set_convert_function (dvdec->videosrcpad, gst_dvdec_src_convert);
277 dvdec->audiosrcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET(audio_src_temp), "audio");
278 gst_element_add_pad(GST_ELEMENT(dvdec),dvdec->audiosrcpad);
279 gst_pad_set_query_function (dvdec->audiosrcpad, gst_dvdec_src_query);
280 gst_pad_set_event_function (dvdec->audiosrcpad, gst_dvdec_handle_src_event);
281 gst_pad_set_convert_function (dvdec->audiosrcpad, gst_dvdec_src_convert);
283 gst_element_set_loop_function (GST_ELEMENT (dvdec), gst_dvdec_loop);
285 dvdec->decoder = dv_decoder_new (0, 0, 0);
286 dvdec->decoder->quality = DV_QUALITY_BEST;
289 dvdec->next_ts = 0LL;
290 dvdec->need_discont = FALSE;
291 dvdec->framerate = 0;
294 for (i = 0; i <4; i++) {
295 dvdec->audio_buffers[i] = (gint16 *)g_malloc (DV_AUDIO_MAX_SAMPLES * sizeof (gint16));
300 gst_dvdec_src_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
301 GstFormat *dest_format, gint64 *dest_value)
307 dvdec = GST_DVDEC (gst_pad_get_parent (pad));
309 if (dvdec->length == 0)
312 switch (src_format) {
313 case GST_FORMAT_BYTES:
314 switch (*dest_format) {
315 case GST_FORMAT_DEFAULT:
316 *dest_format = GST_FORMAT_TIME;
317 case GST_FORMAT_TIME:
322 case GST_FORMAT_TIME:
323 switch (*dest_format) {
324 case GST_FORMAT_DEFAULT:
325 *dest_format = GST_FORMAT_BYTES;
326 case GST_FORMAT_BYTES:
327 if (pad == dvdec->videosrcpad)
328 scale = 720 * dvdec->height * dvdec->bpp;
329 else if (pad == dvdec->audiosrcpad)
330 scale = dvdec->decoder->audio->num_channels * 2;
332 case GST_FORMAT_UNITS:
333 if (pad == dvdec->videosrcpad)
334 *dest_value = src_value * dvdec->framerate * scale / GST_SECOND;
335 else if (pad == dvdec->audiosrcpad)
336 *dest_value = src_value * dvdec->decoder->audio->frequency * scale / GST_SECOND;
349 gst_dvdec_sink_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
350 GstFormat *dest_format, gint64 *dest_value)
355 dvdec = GST_DVDEC (gst_pad_get_parent (pad));
357 if (dvdec->length == 0)
360 switch (src_format) {
361 case GST_FORMAT_BYTES:
362 switch (*dest_format) {
363 case GST_FORMAT_DEFAULT:
364 *dest_format = GST_FORMAT_TIME;
365 case GST_FORMAT_TIME:
366 *dest_value = src_value * GST_SECOND / (dvdec->length * dvdec->framerate);
372 case GST_FORMAT_TIME:
373 switch (*dest_format) {
374 case GST_FORMAT_DEFAULT:
375 *dest_format = GST_FORMAT_BYTES;
376 case GST_FORMAT_BYTES:
379 /* calculate the frame */
380 frame = src_value * dvdec->framerate / GST_SECOND;
381 /* calculate the offset */
382 *dest_value = frame * dvdec->length;
396 gst_dvdec_src_query (GstPad *pad, GstPadQueryType type,
397 GstFormat *format, gint64 *value)
402 dvdec = GST_DVDEC (gst_pad_get_parent (pad));
405 case GST_PAD_QUERY_TOTAL:
407 case GST_FORMAT_DEFAULT:
408 *format = GST_FORMAT_TIME;
412 GstFormat tmp_format;
414 len = gst_bytestream_length (dvdec->bs);
415 tmp_format = GST_FORMAT_TIME;
416 if (len == -1 || !gst_pad_convert (dvdec->sinkpad, GST_FORMAT_BYTES, len, &tmp_format, value)) {
419 if (!gst_pad_convert (pad, GST_FORMAT_TIME, *value, format, value)) {
426 case GST_PAD_QUERY_POSITION:
428 case GST_FORMAT_DEFAULT:
429 *format = GST_FORMAT_TIME;
431 res = gst_pad_convert (pad, GST_FORMAT_TIME, dvdec->next_ts, format, value);
443 gst_dvdec_handle_sink_event (GstDVDec *dvdec)
449 gst_bytestream_get_status (dvdec->bs, &remaining, &event);
451 type = event? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
455 gst_pad_event_default (dvdec->sinkpad, event);
457 case GST_EVENT_FLUSH:
459 case GST_EVENT_DISCONTINUOUS:
462 gboolean found = FALSE;
465 format = GST_FORMAT_TIME;
466 /* try to get a timestamp from the discont formats */
467 for (i = 0; i < GST_EVENT_DISCONT_OFFSET_LEN(event); i++) {
468 if (gst_pad_convert (dvdec->sinkpad, GST_EVENT_DISCONT_OFFSET(event,i).format, GST_EVENT_DISCONT_OFFSET(event,i).value,
469 &format, &dvdec->next_ts))
477 dvdec->next_ts = 0LL;
479 dvdec->need_discont = TRUE;
483 g_warning ("unhandled event %d\n", type);
486 gst_event_free (event);
491 gst_dvdec_handle_src_event (GstPad *pad, GstEvent *event)
496 dvdec = GST_DVDEC (gst_pad_get_parent (pad));
498 switch (GST_EVENT_TYPE (event)) {
504 /* first bring the format to time */
505 format = GST_FORMAT_TIME;
506 if (!gst_pad_convert (pad, GST_EVENT_SEEK_FORMAT (event), GST_EVENT_SEEK_OFFSET (event),
507 &format, &position)) {
508 /* could not convert seek format to byte offset */
512 /* then try to figure out the byteoffset for this time */
513 format = GST_FORMAT_BYTES;
514 if (!gst_pad_convert (dvdec->sinkpad, GST_FORMAT_TIME, position,
515 &format, &position)) {
516 /* could not convert seek format to byte offset */
521 if (!gst_bytestream_seek (dvdec->bs, position, GST_SEEK_METHOD_SET)) {
534 gst_dvdec_loop (GstElement *element)
537 GstBuffer *buf, *outbuf;
540 guint32 length, got_bytes;
544 dvdec = GST_DVDEC (element);
546 /* first read enough bytes to parse the header */
547 got_bytes = gst_bytestream_peek_bytes (dvdec->bs, &inframe, header_size);
548 if (got_bytes < header_size) {
549 gst_dvdec_handle_sink_event (dvdec);
552 dv_parse_header (dvdec->decoder, inframe);
553 /* after parsing the header we know the size of the data */
554 dvdec->PAL = dv_system_50_fields (dvdec->decoder);
556 dvdec->framerate = (dvdec->PAL ? 25 : 30);
557 dvdec->height = height = (dvdec->PAL ? PAL_HEIGHT : NTSC_HEIGHT);
558 length = (dvdec->PAL ? PAL_BUFFER : NTSC_BUFFER);
560 if (length != dvdec->length) {
561 dvdec->length = length;
562 gst_bytestream_size_hint (dvdec->bs, length);
565 /* then read the read data */
566 got_bytes = gst_bytestream_read (dvdec->bs, &buf, length);
567 if (got_bytes < length) {
568 gst_dvdec_handle_sink_event (dvdec);
572 /* if we did not negotiate yet, do it now */
573 if (!GST_PAD_CAPS (dvdec->videosrcpad)) {
577 /* we what we are allowed to do */
578 allowed = gst_pad_get_allowed_caps (dvdec->videosrcpad);
580 /* try to fix our height */
581 trylist = gst_caps_intersect (allowed,
585 "height", GST_PROPS_INT (height)
588 /* prepare for looping */
589 trylist = gst_caps_normalize (trylist);
592 GstCaps *to_try = gst_caps_copy_1 (trylist);
594 /* try each format */
595 if (gst_pad_try_set_caps (dvdec->videosrcpad, to_try)) {
598 /* it worked, try to find what it was again */
599 gst_caps_get_fourcc_int (to_try, "format", &fourcc);
601 if (fourcc == GST_STR_FOURCC ("RGB ")) {
604 gst_caps_get_int (to_try, "bpp", &bpp);
606 dvdec->space = e_dv_color_rgb;
610 dvdec->space = e_dv_color_bgr0;
615 dvdec->space = e_dv_color_yuv;
620 trylist = trylist->next;
622 /* oops list exhausted an nothing was found... */
624 gst_element_error (element, "could not negotiate");
629 format = GST_FORMAT_TIME;
630 gst_pad_query (dvdec->videosrcpad, GST_PAD_QUERY_POSITION, &format, &ts);
632 if (GST_PAD_IS_CONNECTED (dvdec->audiosrcpad)) {
636 dv_decode_full_audio (dvdec->decoder, GST_BUFFER_DATA (buf), dvdec->audio_buffers);
638 /* if we did not negotiate yet, do it now */
639 if (!GST_PAD_CAPS (dvdec->audiosrcpad)) {
640 gst_pad_try_set_caps (dvdec->audiosrcpad,
644 "format", GST_PROPS_STRING ("int"),
645 "rate", GST_PROPS_INT (dvdec->decoder->audio->frequency),
646 "law", GST_PROPS_INT (0),
647 "depth", GST_PROPS_INT (16),
648 "width", GST_PROPS_INT (16),
649 "signed", GST_PROPS_BOOLEAN (TRUE),
650 "channels", GST_PROPS_INT (dvdec->decoder->audio->num_channels),
651 "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN)
655 outbuf = gst_buffer_new ();
656 GST_BUFFER_SIZE (outbuf) = dvdec->decoder->audio->samples_this_frame * sizeof (gint16) * dvdec->decoder->audio->num_channels;
657 GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
659 a_ptr = (gint16 *) GST_BUFFER_DATA (outbuf);
661 for (i = 0; i < dvdec->decoder->audio->samples_this_frame; i++) {
662 for (j = 0; j < dvdec->decoder->audio->num_channels; j++) {
663 *(a_ptr++) = dvdec->audio_buffers[j][i];
666 GST_BUFFER_TIMESTAMP (outbuf) = ts;
668 if (dvdec->need_discont) {
671 discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, ts, NULL);
672 gst_pad_push (dvdec->audiosrcpad, GST_BUFFER (discont));
675 gst_pad_push (dvdec->audiosrcpad, outbuf);
678 if (GST_PAD_IS_CONNECTED (dvdec->videosrcpad)) {
680 guint8 *outframe_ptrs[3];
681 gint outframe_pitches[3];
683 /* try to grab a pool */
685 dvdec->pool = gst_pad_get_bufferpool (dvdec->videosrcpad);
689 /* try to get a buffer from the pool if we have one */
691 outbuf = gst_buffer_new_from_pool (dvdec->pool, 0, 0);
693 /* no buffer from pool, allocate one ourselves */
695 outbuf = gst_buffer_new ();
697 GST_BUFFER_SIZE (outbuf) = (720 * height) * dvdec->bpp;
698 GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
701 outframe = GST_BUFFER_DATA (outbuf);
703 outframe_ptrs[0] = outframe;
704 outframe_pitches[0] = 720 * dvdec->bpp;
706 /* the rest only matters for YUY2 */
707 if (dvdec->bpp < 3) {
708 outframe_ptrs[1] = outframe_ptrs[0] + 720 * height;
709 outframe_ptrs[2] = outframe_ptrs[1] + 360 * height;
711 outframe_pitches[1] = height / 2;
712 outframe_pitches[2] = outframe_pitches[1];
715 dv_decode_full_frame (dvdec->decoder, GST_BUFFER_DATA (buf),
716 dvdec->space, outframe_ptrs, outframe_pitches);
718 GST_BUFFER_TIMESTAMP (outbuf) = ts;
720 if (dvdec->need_discont) {
723 discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, ts, NULL);
724 gst_pad_push (dvdec->videosrcpad, GST_BUFFER (discont));
727 gst_pad_push (dvdec->videosrcpad, outbuf);
730 /* FIXME this is inaccurate for NTSC */
731 dvdec->next_ts += GST_SECOND / dvdec->framerate;
733 if (dvdec->need_discont) {
734 dvdec->need_discont = FALSE;
737 gst_buffer_unref (buf);
740 static GstElementStateReturn
741 gst_dvdec_change_state (GstElement *element)
743 GstDVDec *dvdec = GST_DVDEC (element);
745 switch (GST_STATE_TRANSITION (element)) {
746 case GST_STATE_NULL_TO_READY:
748 case GST_STATE_READY_TO_PAUSED:
749 dvdec->bs = gst_bytestream_new (dvdec->sinkpad);
751 case GST_STATE_PAUSED_TO_PLAYING:
753 case GST_STATE_PLAYING_TO_PAUSED:
756 case GST_STATE_PAUSED_TO_READY:
757 gst_bytestream_destroy (dvdec->bs);
759 case GST_STATE_READY_TO_NULL:
765 parent_class->change_state (element);
767 return GST_STATE_SUCCESS;
770 /* Arguments are part of the Gtk+ object system, and these functions
771 * enable the element to respond to various arguments.
774 gst_dvdec_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
778 /* It's not null if we got it, but it might not be ours */
779 g_return_if_fail(GST_IS_DVDEC(object));
781 /* Get a pointer of the right type. */
782 dvdec = GST_DVDEC(object);
784 /* Check the argument id to see which argument we're setting. */
791 /* The set function is simply the inverse of the get fuction. */
793 gst_dvdec_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
797 /* It's not null if we got it, but it might not be ours */
798 g_return_if_fail(GST_IS_DVDEC(object));
799 dvdec = GST_DVDEC(object);
803 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
808 /* This is the entry into the plugin itself. When the plugin loads,
809 * this function is called to register everything that the plugin provides.
812 plugin_init (GModule *module, GstPlugin *plugin)
814 GstElementFactory *factory;
815 GstTypeFactory *type;
817 if (!gst_library_load ("gstbytestream")) {
818 gst_info("dvdec: could not load support library: 'gstbytestream'\n");
822 /* We need to create an ElementFactory for each element we provide.
823 * This consists of the name of the element, the GType identifier,
824 * and a pointer to the details structure at the top of the file.
826 factory = gst_element_factory_new("dvdec", GST_TYPE_DVDEC, &dvdec_details);
827 g_return_val_if_fail(factory != NULL, FALSE);
829 gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY);
830 /* The pad templates can be easily generated from the factories above,
831 * and then added to the list of padtemplates for the elementfactory.
832 * Note that the generated padtemplates are stored in static global
833 * variables, for the gst_dvdec_init function to use later on.
835 gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET(sink_temp));
836 gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET(video_src_temp));
837 gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET(audio_src_temp));
839 /* The very last thing is to register the elementfactory with the plugin. */
840 gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
842 type = gst_type_factory_new (&dv_definition);
843 gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
848 GstPluginDesc plugin_desc = {