[gst-devel] code problem.

Benjamin Otte in7y118 at public.uni-hamburg.de
Thu Jun 26 12:56:16 CEST 2003


Do you have created the thread element?
I can't find the
  thread = gst_element_factory_make("thread", "thread");
anywhere.

Benjamin


On Thu, 26 Jun 2003, Sanjay, Addicam V wrote:

>
> 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
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU Hosting Partner.
> Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
> INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>





More information about the gstreamer-devel mailing list