DRAFT - Remote control&management support

Currently, GSmartMix is able to manage applications using GStreamer. Most of the time, it means that the state of the pipeline could be changed, and the properties of the elements could be updated (ex: the volume element). Thus, the "best effort" attempt to be transparent for the audio application has some limitations:

  • the UI is not updated correctly (the "play button", the "volume slider"...)
  • unexpected behavior of the pipeline (unreleased audio sink/pipeline, incorrect state)
  • unknown sound class, priority, icon?... (what sound are you playing?)
  • volume element difficult to get automatically (in this case, GSmartMix adds its own volume element)

General recommendation

Please note that the instructions proposed bellow are useful, even if you don't like the GSmartMix concept (what??): the application will be more robust. Any future framework that will control a pipeline remotely should work properly then.

  1. listen to state changes from the bus & update UI (button, icons, ...)

    •     bus = gst_element_get_bus (pipeline);
          gst_bus_add_signal_watch (bus);
      
          g_signal_connect (bus, "message::state-changed", G_CALLBACK (cb_state), data);
      This event might change the state of a toggle-button, or change the appearance of a "play/pause" button. Side note: A point raised actually, is that there should be one more state or piece of information that gstreamer do not provide by default when an element is in the "ready" state: does this mean that there is something to play, or not? This would be useful to "disable" the "play" order somehow.
      • By the way, it's good to listen to "message::eos" and "message::error" too.
  2. listen to property changes from the volume element (notify events) & update UI (slider position)

    •     g_signal_connect (gst_volume_element, "notify::volume", G_CALLBACK (cb_volume_changed), data);
      • And then update the slider position accordingly.
  3. declare the sound class played using gconfaudiosink (profile) or/and declare it with gstreamer sink element (see below)
    •    g_object_set (audiosink, "profile", GCONF_PROFILE_CHAT, NULL);

Specific instructions

This list is GSmartMix/GStreamer centric. It might become a "standard" one day, who knows?

  1. declare the volume element. Note: a volume element is inserted in front of the sink if not found automatically or specified
  2. declare the sound class played (a string) Note: a class is assigned by the manager if not specified by the application
    • By looking up the real sink in the gconfaudiosink Bin and setting the class name/volume element/window associated:
         GstIterator *it;  
         gboolean done;
         GstElement *gsink;
      
         it = gst_bin_iterate_sinks (GST_BIN (gconf_audiosink));
         done = FALSE;
         while (!done) {
           switch (gst_iterator_next (it, &gsink)) {
             case GST_ITERATOR_OK:
               // marco TODO FIX beurk class-type case
               g_object_set (gsink, "class-name", "Movie", NULL); 
               g_object_set (gsink, "volume-element", volume_element, NULL);
               g_object_set (gsink, "window-xid", window_xid, NULL);
               gst_object_unref (gsink);
               done = TRUE;  
               break;
             case GST_ITERATOR_RESYNC:
               gst_iterator_resync (it);
               break;
             case GST_ITERATOR_ERROR:
               done = TRUE;
               break;
             case GST_ITERATOR_DONE:
               done = TRUE;
               break;
           }
         }
         gst_iterator_free (it);

Outreach/SummerOfCode/2006/GSmartMix/Support (last edited 2013-12-03 23:47:01 by WilliamJonMcCann)