[gst-devel] code problem.
Sanjay, Addicam V
addicam.v.sanjay at intel.com
Thu Jun 26 08:17:08 CEST 2003
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 = FALSE;
char URI[500];
void
eos (GstElement *src, gpointer data)
{
GstThread *thread = 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)
{
GstElement *filesrc, *mad, *osssink;
GstElementState state;
printf("Invoke: UPnPAVTransport_Play(%u,%s);\r\n",InstanceID,Speed);
printf("yahoo!!!!\n");
filesrc = 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 = gst_element_factory_make("mad", "mad");
g_assert(mad);
osssink = 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 = gst_element_get_state(GST_ELEMENT (thread));
printf(" in play, state is %d\n", state);
( 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 = TRUE;
//gst_main ();
//gst_pipeline_destroy (thread);
printf("yahooagain\n");
UPnPResponse_AVTransport_Play(upnptoken);
}
Thanks
Sanjay
More information about the gstreamer-devel
mailing list