[gst-devel] problem with the property stream-info of playbin
Julien Chaix
jchaix at awox.com
Mon Jul 26 17:20:30 CEST 2010
Hi,
I have a problem when i try to get the stream-info from the element
playbin. I use the function g_object_get (G_OBJECT (playbin),
"stream-info",&streaminfo, NULL); when the state changed from ready to
paused.But the result then is just a glist with only one element (type).
This is a piece of my code in my bus function
*************************************************************************
case GST_MESSAGE_STATE_CHANGED:
{
GstState old, newState, pending;
GList *theStreaminfo;
gst_message_parse_state_changed(message, &old,
&newState, &pending);
gPlayerState = newState;
if(old == GST_STATE_READY && newState ==
GST_STATE_PAUSED)
{
if(playbin !=NULL)
{
GList *streaminfo = NULL;
g_object_get (G_OBJECT (playbin),
"stream-info",&streaminfo, NULL);
if(streaminfo != NULL)
{
theStreaminfo=(GList *)theGinfoList;
g_list_foreach( streaminfo,
print_Streaminfo, NULL);
printf("length of glist
\n",g_list_length (streaminfo));
}
}
}
****************************************************************************
And this is the function that I call for each glist
****************************************************************************
static void print_Streaminfo(const gpointer list, gpointer unused)
{
printf("print_Streaminfo \n");
gint streamtype;
GstCaps *gcaps;
gchar codec,decoder;
g_object_get(G_OBJECT(list), "type", &streamtype, NULL);
if(streamtype !=NULL)
{
//get the caps
g_object_get(G_OBJECT(list), "caps", &gcaps, NULL);
if(gcaps !=NULL){
printf("caps :%s \n",gst_caps_to_string(gcaps));
}
else
printf("caps is NULL \n");
//get the codec
g_object_get(G_OBJECT(list), "codec", &codec, NULL);
if(codec !=NULL)
printf("codec :%s \n", codec);
else
printf("codec is NULL \n");
//get the decoder
g_object_get(G_OBJECT(list), "decoder", &decoder, NULL);
if(decoder !=NULL)
printf("decoder :%s \n",&decoder);
else
printf("decoder is NULL \n");
}
}
****************************************************************************
I am sorry for my bad English but please help me
More information about the gstreamer-devel
mailing list