playsink: do not abort if a property is not found.
[platform/upstream/gstreamer.git] / gst / playback / gstplaysinkconvertbin.c
1 /* GStreamer
2  * Copyright (C) <2011> Sebastian Dröge <sebastian.droege@collabora.co.uk>
3  * Copyright (C) <2011> Vincent Penquerch <vincent.penquerch@collabora.co.uk>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
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  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24
25 #include "gstplaysinkconvertbin.h"
26
27 #include <gst/pbutils/pbutils.h>
28 #include <gst/gst-i18n-plugin.h>
29 #include "gst/glib-compat-private.h"
30
31 GST_DEBUG_CATEGORY_STATIC (gst_play_sink_convert_bin_debug);
32 #define GST_CAT_DEFAULT gst_play_sink_convert_bin_debug
33
34 #define parent_class gst_play_sink_convert_bin_parent_class
35
36 static gboolean gst_play_sink_convert_bin_sink_setcaps (GstPlaySinkConvertBin *
37     self, GstCaps * caps);
38
39 G_DEFINE_TYPE (GstPlaySinkConvertBin, gst_play_sink_convert_bin, GST_TYPE_BIN);
40
41 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
42     GST_PAD_SRC,
43     GST_PAD_ALWAYS,
44     GST_STATIC_CAPS_ANY);
45
46 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
47     GST_PAD_SINK,
48     GST_PAD_ALWAYS,
49     GST_STATIC_CAPS_ANY);
50
51 static gboolean
52 is_raw_caps (GstCaps * caps, gboolean audio)
53 {
54   gint i, n;
55   GstStructure *s;
56   const gchar *name;
57   const gchar *prefix = audio ? "audio/x-raw" : "video/x-raw";
58
59   n = gst_caps_get_size (caps);
60   for (i = 0; i < n; i++) {
61     s = gst_caps_get_structure (caps, i);
62     name = gst_structure_get_name (s);
63     if (!g_str_equal (name, prefix))
64       return FALSE;
65   }
66
67   return TRUE;
68 }
69
70 static void
71 gst_play_sink_convert_bin_post_missing_element_message (GstPlaySinkConvertBin *
72     self, const gchar * name)
73 {
74   GstMessage *msg;
75
76   msg = gst_missing_element_message_new (GST_ELEMENT_CAST (self), name);
77   gst_element_post_message (GST_ELEMENT_CAST (self), msg);
78 }
79
80 static void
81 distribute_running_time (GstElement * element, const GstSegment * segment)
82 {
83   GstEvent *event;
84   GstPad *pad;
85
86   pad = gst_element_get_static_pad (element, "sink");
87
88   gst_pad_send_event (pad, gst_event_new_flush_start ());
89   gst_pad_send_event (pad, gst_event_new_flush_stop (FALSE));
90
91   if (segment->format != GST_FORMAT_UNDEFINED) {
92     event = gst_event_new_segment (segment);
93     gst_pad_send_event (pad, event);
94   }
95
96   gst_object_unref (pad);
97 }
98
99 void
100 gst_play_sink_convert_bin_add_conversion_element (GstPlaySinkConvertBin * self,
101     GstElement * el)
102 {
103   self->conversion_elements = g_list_append (self->conversion_elements, el);
104   gst_bin_add (GST_BIN (self), gst_object_ref (el));
105 }
106
107 GstElement *
108 gst_play_sink_convert_bin_add_conversion_element_factory (GstPlaySinkConvertBin
109     * self, const char *factory, const char *name)
110 {
111   GstElement *el;
112
113   el = gst_element_factory_make (factory, name);
114   if (el == NULL) {
115     gst_play_sink_convert_bin_post_missing_element_message (self, factory);
116     GST_ELEMENT_WARNING (self, CORE, MISSING_PLUGIN,
117         (_("Missing element '%s' - check your GStreamer installation."),
118             factory),
119         (self->audio ? "audio rendering might fail" :
120             "video rendering might fail"));
121   } else {
122     gst_play_sink_convert_bin_add_conversion_element (self, el);
123   }
124   return el;
125 }
126
127 void
128 gst_play_sink_convert_bin_add_identity (GstPlaySinkConvertBin * self)
129 {
130   if (self->identity)
131     return;
132
133   self->identity = gst_element_factory_make ("identity", "identity");
134   if (self->identity == NULL) {
135     gst_play_sink_convert_bin_post_missing_element_message (self, "identity");
136     GST_ELEMENT_WARNING (self, CORE, MISSING_PLUGIN,
137         (_("Missing element '%s' - check your GStreamer installation."),
138             "identity"), (self->audio ?
139             "audio rendering might fail" : "video rendering might fail")
140
141         );
142   } else {
143     g_object_set (self->identity, "silent", TRUE, "signal-handoffs", FALSE,
144         NULL);
145     gst_bin_add (GST_BIN_CAST (self), self->identity);
146   }
147 }
148
149 static void
150 gst_play_sink_convert_bin_set_targets (GstPlaySinkConvertBin * self,
151     gboolean passthrough)
152 {
153   GstPad *pad;
154   GstElement *head, *tail;
155
156   GST_DEBUG_OBJECT (self, "Setting pad targets with passthrough %d",
157       passthrough);
158   if (self->conversion_elements == NULL || passthrough) {
159     GST_DEBUG_OBJECT (self, "no conversion elements, using identity (%p) as "
160         "head/tail", self->identity);
161     if (!passthrough) {
162       GST_WARNING_OBJECT (self,
163           "Doing passthrough as no converter elements were added");
164     }
165     head = tail = self->identity;
166   } else {
167     head = GST_ELEMENT (g_list_first (self->conversion_elements)->data);
168     tail = GST_ELEMENT (g_list_last (self->conversion_elements)->data);
169     GST_DEBUG_OBJECT (self, "conversion elements in use, picking "
170         "head:%s and tail:%s", GST_OBJECT_NAME (head), GST_OBJECT_NAME (tail));
171   }
172
173   g_return_if_fail (head != NULL);
174   g_return_if_fail (tail != NULL);
175
176   pad = gst_element_get_static_pad (head, "sink");
177   GST_DEBUG_OBJECT (self, "Ghosting bin sink pad to %" GST_PTR_FORMAT, pad);
178   gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->sinkpad), pad);
179   gst_object_unref (pad);
180
181   pad = gst_element_get_static_pad (tail, "src");
182   GST_DEBUG_OBJECT (self, "Ghosting bin src pad to %" GST_PTR_FORMAT, pad);
183   gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad), pad);
184   gst_object_unref (pad);
185 }
186
187 static void
188 gst_play_sink_convert_bin_remove_element (GstElement * element,
189     GstPlaySinkConvertBin * self)
190 {
191   gst_element_set_state (element, GST_STATE_NULL);
192   gst_object_unref (element);
193   gst_bin_remove (GST_BIN_CAST (self), element);
194 }
195
196 static void
197 gst_play_sink_convert_bin_on_element_added (GstElement * element,
198     GstPlaySinkConvertBin * self)
199 {
200   gst_element_sync_state_with_parent (element);
201   distribute_running_time (element, &self->segment);
202 }
203
204 static GstPadProbeReturn
205 pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
206 {
207   GstPlaySinkConvertBin *self = user_data;
208   GstPad *peer;
209   GstCaps *caps;
210   gboolean raw;
211
212   GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
213   GST_DEBUG_OBJECT (self, "Pad blocked");
214
215   /* There must be a peer at this point */
216   peer = gst_pad_get_peer (self->sinkpad);
217   caps = gst_pad_get_current_caps (peer);
218   if (!caps)
219     caps = gst_pad_query_caps (peer, NULL);
220   gst_object_unref (peer);
221
222   raw = is_raw_caps (caps, self->audio);
223   GST_DEBUG_OBJECT (self, "Caps %" GST_PTR_FORMAT " are raw: %d", caps, raw);
224   gst_caps_unref (caps);
225
226   if (raw == self->raw)
227     goto unblock;
228   self->raw = raw;
229
230   gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->sinkpad), NULL);
231   gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad), NULL);
232
233   if (raw) {
234     GST_DEBUG_OBJECT (self, "Switching to raw conversion pipeline");
235
236     if (self->conversion_elements)
237       g_list_foreach (self->conversion_elements,
238           (GFunc) gst_play_sink_convert_bin_on_element_added, self);
239   } else {
240
241     GST_DEBUG_OBJECT (self, "Switch to passthrough pipeline");
242
243     gst_play_sink_convert_bin_on_element_added (self->identity, self);
244   }
245
246   gst_play_sink_convert_bin_set_targets (self, !raw);
247
248 unblock:
249   self->sink_proxypad_block_id = 0;
250   GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
251
252   return GST_PAD_PROBE_REMOVE;
253 }
254
255 static gboolean
256 gst_play_sink_convert_bin_sink_event (GstPad * pad, GstObject * parent,
257     GstEvent * event)
258 {
259   GstPlaySinkConvertBin *self = GST_PLAY_SINK_CONVERT_BIN (parent);
260   gboolean ret;
261
262   switch (GST_EVENT_TYPE (event)) {
263     case GST_EVENT_CAPS:
264     {
265       GstCaps *caps;
266
267       gst_event_parse_caps (event, &caps);
268       ret = gst_play_sink_convert_bin_sink_setcaps (self, caps);
269       break;
270     }
271     default:
272       break;
273   }
274
275   ret = gst_proxy_pad_event_default (pad, parent, gst_event_ref (event));
276
277   if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
278     GstSegment seg;
279
280     GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
281     gst_event_copy_segment (event, &seg);
282
283     GST_DEBUG_OBJECT (self, "Segment before %" GST_SEGMENT_FORMAT,
284         &self->segment);
285     self->segment = seg;
286     GST_DEBUG_OBJECT (self, "Segment after %" GST_SEGMENT_FORMAT,
287         &self->segment);
288     GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
289   } else if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
290     GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
291     GST_DEBUG_OBJECT (self, "Resetting segment");
292     gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
293     GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
294   }
295
296   gst_event_unref (event);
297
298   return ret;
299 }
300
301 static void
302 block_proxypad (GstPlaySinkConvertBin * self)
303 {
304   if (self->sink_proxypad_block_id == 0) {
305     self->sink_proxypad_block_id =
306         gst_pad_add_probe (self->sink_proxypad,
307         GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM, pad_blocked_cb, self, NULL);
308   }
309 }
310
311 static void
312 unblock_proxypad (GstPlaySinkConvertBin * self)
313 {
314   if (self->sink_proxypad_block_id != 0) {
315     gst_pad_remove_probe (self->sink_proxypad, self->sink_proxypad_block_id);
316     self->sink_proxypad_block_id = 0;
317   }
318 }
319
320 static gboolean
321 gst_play_sink_convert_bin_sink_setcaps (GstPlaySinkConvertBin * self,
322     GstCaps * caps)
323 {
324   GstStructure *s;
325   const gchar *name;
326   gboolean reconfigure = FALSE;
327   gboolean raw;
328
329   GST_DEBUG_OBJECT (self, "setcaps");
330   GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
331   s = gst_caps_get_structure (caps, 0);
332   name = gst_structure_get_name (s);
333
334   if (self->audio) {
335     raw = g_str_equal (name, "audio/x-raw");
336   } else {
337     raw = g_str_equal (name, "video/x-raw");
338   }
339
340   GST_DEBUG_OBJECT (self, "raw %d, self->raw %d, blocked %d",
341       raw, self->raw, gst_pad_is_blocked (self->sink_proxypad));
342
343   if (raw) {
344     if (!gst_pad_is_blocked (self->sink_proxypad)) {
345       GstPad *target = gst_ghost_pad_get_target (GST_GHOST_PAD (self->sinkpad));
346
347       if (!self->raw || (target && !gst_pad_query_accept_caps (target, caps))) {
348         if (!self->raw)
349           GST_DEBUG_OBJECT (self, "Changing caps from non-raw to raw");
350         else
351           GST_DEBUG_OBJECT (self, "Changing caps in an incompatible way");
352
353         reconfigure = TRUE;
354         block_proxypad (self);
355       }
356
357       if (target)
358         gst_object_unref (target);
359     }
360   } else {
361     if (self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
362       GST_DEBUG_OBJECT (self, "Changing caps from raw to non-raw");
363       reconfigure = TRUE;
364       block_proxypad (self);
365     }
366   }
367
368   /* Otherwise the setcaps below fails */
369   if (reconfigure) {
370     gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->sinkpad), NULL);
371     gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad), NULL);
372   }
373
374   GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
375
376   GST_DEBUG_OBJECT (self, "Setting sink caps %" GST_PTR_FORMAT, caps);
377
378   return TRUE;
379 }
380
381 static GstCaps *
382 gst_play_sink_convert_bin_getcaps (GstPad * pad, GstCaps * filter)
383 {
384   GstPlaySinkConvertBin *self =
385       GST_PLAY_SINK_CONVERT_BIN (gst_pad_get_parent (pad));
386   GstCaps *ret;
387   GstPad *otherpad, *peer;
388
389   GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
390   if (pad == self->srcpad) {
391     otherpad = self->sinkpad;
392   } else if (pad == self->sinkpad) {
393     otherpad = self->srcpad;
394   } else {
395     GST_ERROR_OBJECT (pad, "Not one of our pads");
396     otherpad = NULL;
397   }
398
399   if (otherpad) {
400     peer = gst_pad_get_peer (otherpad);
401     if (peer) {
402       GstCaps *peer_caps = gst_pad_query_caps (peer, filter);
403       gst_object_unref (peer);
404       if (self->converter_caps && is_raw_caps (peer_caps, self->audio)) {
405         ret = gst_caps_merge (peer_caps, gst_caps_ref (self->converter_caps));
406       } else {
407         ret = peer_caps;
408       }
409     } else {
410       ret = gst_caps_ref (self->converter_caps);
411     }
412   } else {
413     ret = gst_caps_new_any ();
414   }
415   GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
416
417   gst_object_unref (self);
418
419   GST_DEBUG_OBJECT (pad, "Returning caps %" GST_PTR_FORMAT, ret);
420
421   return ret;
422 }
423
424 static gboolean
425 gst_play_sink_convert_bin_acceptcaps (GstPad * pad, GstCaps * caps)
426 {
427   GstCaps *allowed_caps;
428   gboolean ret;
429
430   allowed_caps = gst_pad_query_caps (pad, NULL);
431   /* FIXME 0.11: Should be a subset check now */
432   ret = gst_caps_can_intersect (caps, allowed_caps);
433   gst_caps_unref (allowed_caps);
434
435   return ret;
436 }
437
438 static gboolean
439 gst_play_sink_convert_bin_query (GstPad * pad, GstObject * parent,
440     GstQuery * query)
441 {
442   gboolean res = FALSE;
443
444   switch (GST_QUERY_TYPE (query)) {
445     case GST_QUERY_ACCEPT_CAPS:
446     {
447       GstCaps *caps;
448
449       gst_query_parse_accept_caps (query, &caps);
450       gst_query_set_accept_caps_result (query,
451           gst_play_sink_convert_bin_acceptcaps (pad, caps));
452       res = TRUE;
453       break;
454     }
455     case GST_QUERY_CAPS:
456     {
457       GstCaps *filter, *caps;
458
459       gst_query_parse_caps (query, &filter);
460       caps = gst_play_sink_convert_bin_getcaps (pad, filter);
461       gst_query_set_caps_result (query, caps);
462       gst_caps_unref (caps);
463       res = TRUE;
464       break;
465     }
466     default:
467       res = gst_proxy_pad_query_default (pad, parent, query);
468       break;
469   }
470   return res;
471 }
472
473 void
474 gst_play_sink_convert_bin_remove_elements (GstPlaySinkConvertBin * self)
475 {
476   if (self->conversion_elements) {
477     g_list_foreach (self->conversion_elements,
478         (GFunc) gst_play_sink_convert_bin_remove_element, self);
479     g_list_free (self->conversion_elements);
480     self->conversion_elements = NULL;
481   }
482   if (self->converter_caps) {
483     gst_caps_unref (self->converter_caps);
484     self->converter_caps = NULL;
485   }
486 }
487
488 static void
489 gst_play_sink_convert_bin_dispose (GObject * object)
490 {
491   GstPlaySinkConvertBin *self = GST_PLAY_SINK_CONVERT_BIN_CAST (object);
492
493   gst_play_sink_convert_bin_remove_elements (self);
494
495   G_OBJECT_CLASS (parent_class)->dispose (object);
496 }
497
498 static void
499 gst_play_sink_convert_bin_finalize (GObject * object)
500 {
501   GstPlaySinkConvertBin *self = GST_PLAY_SINK_CONVERT_BIN_CAST (object);
502
503   gst_object_unref (self->sink_proxypad);
504   g_mutex_free (self->lock);
505
506   G_OBJECT_CLASS (parent_class)->finalize (object);
507 }
508
509 void
510 gst_play_sink_convert_bin_cache_converter_caps (GstPlaySinkConvertBin * self)
511 {
512   GstElement *head;
513   GstPad *pad;
514
515   if (self->converter_caps) {
516     gst_caps_unref (self->converter_caps);
517     self->converter_caps = NULL;
518   }
519
520   if (!self->conversion_elements) {
521     GST_WARNING_OBJECT (self, "No conversion elements");
522     return;
523   }
524
525   head = GST_ELEMENT (g_list_first (self->conversion_elements)->data);
526   pad = gst_element_get_static_pad (head, "sink");
527   if (!pad) {
528     GST_WARNING_OBJECT (self, "No sink pad found");
529     return;
530   }
531
532   self->converter_caps = gst_pad_query_caps (pad, NULL);
533   GST_INFO_OBJECT (self, "Converter caps: %" GST_PTR_FORMAT,
534       self->converter_caps);
535
536   gst_object_unref (pad);
537 }
538
539 static GstStateChangeReturn
540 gst_play_sink_convert_bin_change_state (GstElement * element,
541     GstStateChange transition)
542 {
543   GstStateChangeReturn ret;
544   GstPlaySinkConvertBin *self = GST_PLAY_SINK_CONVERT_BIN_CAST (element);
545
546   switch (transition) {
547     case GST_STATE_CHANGE_PAUSED_TO_READY:
548       GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
549       unblock_proxypad (self);
550       GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
551       break;
552     case GST_STATE_CHANGE_READY_TO_PAUSED:
553       GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
554       gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
555       gst_play_sink_convert_bin_set_targets (self, TRUE);
556       self->raw = FALSE;
557       GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
558       break;
559     default:
560       break;
561   }
562
563   ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
564   if (ret == GST_STATE_CHANGE_FAILURE)
565     return ret;
566
567   switch (transition) {
568     case GST_STATE_CHANGE_PAUSED_TO_READY:
569       GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
570       gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
571       gst_play_sink_convert_bin_set_targets (self, TRUE);
572       self->raw = FALSE;
573       GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
574       break;
575     case GST_STATE_CHANGE_READY_TO_PAUSED:
576       GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
577       unblock_proxypad (self);
578       GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
579       break;
580     default:
581       break;
582   }
583
584   return ret;
585 }
586
587 static void
588 gst_play_sink_convert_bin_class_init (GstPlaySinkConvertBinClass * klass)
589 {
590   GObjectClass *gobject_class;
591   GstElementClass *gstelement_class;
592
593   GST_DEBUG_CATEGORY_INIT (gst_play_sink_convert_bin_debug,
594       "playsinkconvertbin", 0, "play bin");
595
596   gobject_class = (GObjectClass *) klass;
597   gstelement_class = (GstElementClass *) klass;
598
599   gobject_class->dispose = gst_play_sink_convert_bin_dispose;
600   gobject_class->finalize = gst_play_sink_convert_bin_finalize;
601
602   gst_element_class_add_pad_template (gstelement_class,
603       gst_static_pad_template_get (&srctemplate));
604   gst_element_class_add_pad_template (gstelement_class,
605       gst_static_pad_template_get (&sinktemplate));
606   gst_element_class_set_static_metadata (gstelement_class,
607       "Player Sink Converter Bin", "Bin/Converter",
608       "Convenience bin for audio/video conversion",
609       "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
610
611   gstelement_class->change_state =
612       GST_DEBUG_FUNCPTR (gst_play_sink_convert_bin_change_state);
613 }
614
615 static void
616 gst_play_sink_convert_bin_init (GstPlaySinkConvertBin * self)
617 {
618   GstPadTemplate *templ;
619
620   self->lock = g_mutex_new ();
621   gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
622
623   templ = gst_static_pad_template_get (&sinktemplate);
624   self->sinkpad = gst_ghost_pad_new_no_target_from_template ("sink", templ);
625   gst_pad_set_event_function (self->sinkpad,
626       GST_DEBUG_FUNCPTR (gst_play_sink_convert_bin_sink_event));
627   gst_pad_set_query_function (self->sinkpad,
628       GST_DEBUG_FUNCPTR (gst_play_sink_convert_bin_query));
629
630   self->sink_proxypad =
631       GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (self->sinkpad)));
632
633   gst_element_add_pad (GST_ELEMENT_CAST (self), self->sinkpad);
634   gst_object_unref (templ);
635
636   templ = gst_static_pad_template_get (&srctemplate);
637   self->srcpad = gst_ghost_pad_new_no_target_from_template ("src", templ);
638   gst_pad_set_query_function (self->srcpad,
639       GST_DEBUG_FUNCPTR (gst_play_sink_convert_bin_query));
640   gst_element_add_pad (GST_ELEMENT_CAST (self), self->srcpad);
641   gst_object_unref (templ);
642
643   gst_play_sink_convert_bin_add_identity (self);
644 }