From: Sanjay, A. V <add...@in...> - 2003-06-26 15:16:24
|
Hello, I am trying to write a mp3 player. I am using gstream for the first = time. I have written this code snipet. Any help in understanding, the = reason, why it is behaving , like this, will be very helpful. GstElement *thread; gboolean can_quit =3D FALSE; char URI[500]; void eos (GstElement *src, gpointer data) { GstThread *thread =3D GST_THREAD (data); g_print ("have eos, quitting\n"); /* stop the bin */ gst_element_set_state (GST_ELEMENT (thread), GST_STATE_NULL); while (!can_quit) /* waste cycles */ ; //gst_main_quit (); } void UPnPAVTransport_Play(void* upnptoken,unsigned int InstanceID,char* = Speed) { =09 GstElement *filesrc, *mad, *osssink; GstElementState state; =20 printf("Invoke: UPnPAVTransport_Play(%u,%s);\r\n",InstanceID,Speed); printf("yahoo!!!!\n"); =20 =20 =20 filesrc =3D gst_element_factory_make("httpsrc", "httpsrc"); g_assert(filesrc); g_object_set(G_OBJECT(filesrc), "location", URI, NULL); g_signal_connect (G_OBJECT (filesrc), "eos", G_CALLBACK (eos), thread); mad =3D gst_element_factory_make("mad", "mad"); g_assert(mad); osssink =3D gst_element_factory_make("osssink", "osssink"); g_assert(osssink); gst_bin_add_many (GST_BIN (thread), filesrc, mad, osssink, NULL); gst_element_link_many (filesrc, mad, osssink, NULL); gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING); g_print ("thread is playing\n"); state =3D gst_element_get_state(GST_ELEMENT (thread)); printf(" in play, state is %d\n", state); =20 ( This printf returns the state as GST_STATE_NULL, i.e 1 and not = GST_STATE_PLAYING, why is this???, the function eos has not been called = yet). can_quit =3D TRUE; //gst_main (); //gst_pipeline_destroy (thread); =20 =20 printf("yahooagain\n"); =09 UPnPResponse_AVTransport_Play(upnptoken); } Thanks Sanjay |