After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 325984 - [playbin] cannot handle sources that produce raw audio/video
[playbin] cannot handle sources that produce raw audio/video
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 0.10.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-01-06 14:12 UTC by Tim-Philipp Müller
Modified: 2006-01-13 17:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Tim-Philipp Müller 2006-01-06 14:12:08 UTC
Playbin currently doesn't handle sources that produce raw audio/video correctly at the moment.

This is required e.g. for Audio CD playback using cdparanoiasrc.


My local patch currently looks like this, but needs cleaning up/review:

Index: gstplaybasebin.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst/playback/gstplaybasebin.c,v
retrieving revision 1.94
diff -u -p -r1.94 gstplaybasebin.c
--- gstplaybasebin.c	15 Dec 2005 09:48:19 -0000	1.94
+++ gstplaybasebin.c	6 Jan 2006 14:08:31 -0000
@@ -1255,12 +1266,71 @@ setup_source (GstPlayBaseBin * play_base
 #endif
   }
 
+#if 1
   /* now see if the source element emits raw audio/video all by itself,
    * if so, we can create streams for the pads and be done with it.
    * Also check that is has source pads, if not, we assume it will
    * do everything itself.
    */
   {
+    GstIterator *pads_iter;
+    gboolean done = FALSE;
+    gboolean no_out, is_raw = FALSE;
+
+    pads_iter = gst_element_iterate_pads (play_base_bin->source);
+    while (!done) {
+      gpointer data;
+
+      switch (gst_iterator_next (pads_iter, &data)) {
+        case GST_ITERATOR_DONE:
+          done = TRUE;
+        case GST_ITERATOR_ERROR:
+        case GST_ITERATOR_RESYNC:
+          break;
+        case GST_ITERATOR_OK:
+        {
+          GstCaps *caps;
+          GstPad *pad = GST_PAD (data);
+          guint i, num_raw = 0;
+
+          if (GST_PAD_IS_SINK (pad))
+            break;
+
+          no_out = FALSE;
+
+          caps = gst_pad_get_caps (pad);
+          if (caps == NULL || gst_caps_is_empty (caps) ||
+              gst_caps_get_size (caps) == 0) {
+            if (caps)
+              gst_caps_unref (caps);
+            break;
+          }
+
+          for (i = 0; i < gst_caps_get_size (caps); ++i) {
+            GstStructure *s;
+            const gchar *mime_type;
+
+            s = gst_caps_get_structure (caps, i);
+            mime_type = gst_structure_get_name (s);
+
+            if (g_str_has_prefix (mime_type, "audio/x-raw") ||
+                g_str_has_prefix (mime_type, "video/x-raw")) {
+              ++num_raw;
+            }
+          }
+
+          if (num_raw == gst_caps_get_size (caps)) {
+            new_decoded_pad (play_base_bin->source, pad, FALSE /*g_list_next (pads) == NULL*/,
+              play_base_bin);
+            is_raw = TRUE;
+            return TRUE; /////// fixme: added shortcut, remove again / ///
+          }
+
+          break;
+        }
+      }
+    }
+
 #if 0
     const GList *pads;
     gboolean is_raw = FALSE, no_out = TRUE;
@@ -1312,6 +1382,7 @@ setup_source (GstPlayBaseBin * play_base
     }
 #endif
   }
+#endif
 
   /* now create the decoder element */
   if (!(play_base_bin->decoder =
Comment 1 Tim-Philipp Müller 2006-01-13 17:20:42 UTC
Should be fixed in CVS:

2006-01-13  Tim-Philipp Müller  <tim at centricular dot net>

        * gst/playback/gstplaybasebin.c: (setup_source):
          Fix playback for sources that emit raw audio or
          raw video streams (e.g.: cd audio sources) (#325984).

The case we don't handle yet is sources where the source pad advertises both raw audio/video and encoded formats (e.g. v4lsrc), but we can handle those when the issue comes up IMHO.