Prefer GOOM over other visuals.
authorXavi Artigas <xartigas@fluendo.com>
Tue, 26 Jun 2012 11:25:16 +0000 (13:25 +0200)
committerXavi Artigas <xartigas@fluendo.com>
Tue, 26 Jun 2012 11:25:16 +0000 (13:25 +0200)
Radio station that does not use chained-ogg files.

gst-sdk/tutorials/playback-tutorial-6.c

index 59e1405..31a3a42 100644 (file)
@@ -2,7 +2,7 @@
   
 /* playbin2 flags */
 typedef enum {
-  GST_PLAY_FLAG_VIS           = (1 << 3) /* Enable rendering of visualisations when there is no video stream. */
+  GST_PLAY_FLAG_VIS           = (1 << 3) /* Enable rendering of visualizations when there is no video stream. */
 } GstPlayFlags;
   
 /* Return TRUE if this is a Visualization element */
@@ -23,7 +23,7 @@ int main(int argc, char *argv[]) {
   GstBus *bus;
   GstMessage *msg;
   GList *list, *walk;
-  GstElementFactory *factory = NULL;
+  GstElementFactory *selected_factory = NULL;
   guint flags;
   
   /* Initialize GStreamer */
@@ -36,27 +36,32 @@ int main(int argc, char *argv[]) {
   g_print("Available visualization plugins:\n");
   for (walk = list; walk != NULL; walk = g_list_next (walk)) {
     const gchar *name;
+    GstElementFactory *factory;
     
     factory = GST_ELEMENT_FACTORY (walk->data);
     name = gst_element_factory_get_longname (factory);
-    
     g_print("  %s\n", name);
+    
+    if (selected_factory == NULL || g_str_has_prefix (name, "GOOM")) {
+      selected_factory = factory;
+    }
   }
   
   /* Don't use the factory if it's still empty */
   /* e.g. no visualization plugins found */
-  if (!factory) {
+  if (!selected_factory) {
     g_print ("No visualization plugins found!\n");
     return -1;
   }
   
-  /* We now have factory pointing to the last Visualization plugin found */
-  vis_plugin = gst_element_factory_create (factory, NULL);
+  /* We have now selected a factory for the visualization element */
+  g_print ("Selected '%s'\n", gst_element_factory_get_longname (selected_factory));
+  vis_plugin = gst_element_factory_create (selected_factory, NULL);
   if (!vis_plugin)
     return -1;
   
   /* Build the pipeline */
-  pipeline = gst_parse_launch ("playbin2 uri=http://radio.goha.ru:8000/grindfm.ogg", NULL);
+  pipeline = gst_parse_launch ("playbin2 uri=http://radio.hbr1.com:19800/ambient.ogg", NULL);
   
   /* Set the visualization flag */
   g_object_get (pipeline, "flags", &flags, NULL);