[gst-devel] Python: Trying to list all streams

Rasmus Z Iversen rasmus.z.iversen at gmail.com
Sun Jul 25 04:23:56 CEST 2010


Hello, i am writing a small python script where i need to loop through a  
list of audio streams from gstreamer (just like gnome-volume-control under  
applications). I have tried to look through the source code of gnome-media  
and gnome-volume-control to see how they do it, but i just really can't  
see how i am supposed to do it in python.

As far as i can see they get the list of streams from here  
control->priv->all_streams, where control is a GvcMixerControl object,  
which i really don't know how gets into the picture, and i figured maybe  
someone here would know, or at least be able to point me in the right  
direction.

This is the C code which i have found which concerns my question:




--- gvc-mixer-dialog.c --


streams = gvc_mixer_control_get_streams (self->priv->mixer_control);
for (l = streams; l != NULL; l = l->next) {
         stream = l->data;
         add_stream (self, stream);
}
g_slist_free (streams);

cards = gvc_mixer_control_get_cards (self->priv->mixer_control);
for (l = cards; l != NULL; l = l->next) {
         card = l->data;
         add_card (self, card);
}
g_slist_free (cards);

--- gvc-mixer-control.c ---

GSList *
gvc_mixer_control_get_streams (GvcMixerControl *control)
{
         GSList *retval;

         g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL);

         retval = NULL;
         g_hash_table_foreach (control->priv->all_streams,
                               listify_hash_values_hfunc,
                               &retval);
         return g_slist_sort (retval, (GCompareFunc) gvc_stream_collate);
}

--- gvc-mixer-control.c ---

GSList *
gvc_mixer_control_get_sinks (GvcMixerControl *control)
{
         GSList *retval;

         g_return_val_if_fail (GVC_IS_MIXER_CONTROL (control), NULL);

         retval = NULL;
         g_hash_table_foreach (control->priv->sinks,
                               listify_hash_values_hfunc,
                               &retval);
         return g_slist_sort (retval, (GCompareFunc) gvc_stream_collate);
}

---




More information about the gstreamer-devel mailing list