[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-devel
Subject:    [gst-devel] Problem running a test app
From:       Syed Ahmed <towkmail () yahoo ! com>
Date:       2007-07-13 14:59:29
Message-ID: 166023.38794.qm () web44908 ! mail ! sp1 ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi All,

        I am new to GST and I am trying to run a multithreaded program to run \
multiple gst players. I am using a filesink to store the buffers. I am trying with 2 \
thread initially. The problem is when I connect a pad creator function (new_pad) to \
link to new pad, the function gets called from one single thread irrespective of two \
threads being initiated. This behaviour is not always as I can see the pad creation \
function in two different functions also. Can anyone tell me why is this behaviour? \
The other problem is that the first file from the first thread contains the output \
data and the other one does not in either case of the new_pad function being run in \
same or unique thread. Can anyone suggest what is happening here. Let me know if you \
need any further information.

<code>

#include <gst/gst.h>
#include <stdio.h>
#include <pthread.h>
#define GSTCOREELEMENTS_LIB \
"/gst_core/release/export/i686/lib/gstreamer-0.10/libgstcoreelements.so" #define \
GSTWAVPARSER_LIB    "/gst_core/release/export/i686/lib/gstreamer-0.10/libgstwavparse.so"
 #define MEDIAFILE "a.wav"
#define NUM_THREADS     2
pthread_mutex_t count_mutex;
int i =0;
static void
new_pad (GstElement *element,
         GstPad     *pad,
         gpointer    data)
{
  GstPad *sinkpad;
  g_print("%p :  New Pad Thread Id \n\n", pthread_self());
  
  /* We can now link this pad with the audio decoder */
  g_print ("Dynamic pad created, linking parser/sink\n");
  sinkpad = gst_element_get_pad ( GST_ELEMENT(data), "sink");
  gst_pad_link (pad, sinkpad);
  gst_object_unref (sinkpad);
}

static void load_plugin_libs(void)
{
    if( NULL == gst_plugin_load_file(GSTCOREELEMENTS_LIB, NULL) )
    {
        printf("Failed to load %s\n",GSTCOREELEMENTS_LIB);
        exit (1);
    }
    if( NULL == gst_plugin_load_file(GSTWAVPARSER_LIB, NULL) )
    {
        printf("Failed to load %s\n",GSTWAVPARSER_LIB);
        exit (1);
    }
}
static gboolean
bus_call (GstBus     *bus,
   GstMessage *msg,
   gpointer    data)
{
  GMainLoop *loop = data;
  switch (GST_MESSAGE_TYPE (msg)) {
    case GST_MESSAGE_EOS:
      g_print ( __FILE__ " - End-of-stream\n");
      g_main_loop_quit (loop);
      break;
    case GST_MESSAGE_ERROR: {
      gchar *debug;
      GError *err;
      gst_message_parse_error (msg, &err, &debug);
      g_free (debug);
      g_print (  __FILE__ " - Error: %s\n", err->message);
      g_error_free (err);
      g_main_loop_quit (loop);
      break;
    }
    default:
      break;
  }
  return TRUE;
}

int
mainloop (void *threadarg)
{
    GMainLoop *loop;
    GstBus *bus;
 
 int argc = 0;
 char *argv[] = {0};
    GstElement *pipeline, *source, *parser, *sink ;
 
    int randomnumber, rnum ;
 char tmpfile[50] ;
 g_print("Thread number is %d\n\n", (int)threadarg);
    g_print("%p :  is the Thread Id \n\n",pthread_self());
    /* initialize GStreamer */
    gst_init (&argc, &argv);
    loop = g_main_loop_new (NULL, FALSE);
    /* Load Plugin libraries */
    load_plugin_libs();
    /* create a pipeline */
    pipeline = gst_pipeline_new ("my-player");
    if (!pipeline) {
        g_print ( __FILE__ " - Pipeline could not be created\n");
        return -1;
    }
    /* create a element for the PSS source element */
    source   = gst_element_factory_make ("filesrc", "File Source");
    if (!source) {
        g_print ( __FILE__ " - File source could not be created\n");
        return -1;
    }
    g_object_set (G_OBJECT (source), "location", MEDIAFILE, NULL);
    parser   = gst_element_factory_make ("wavparse", "Wav Parser");
 if (!parser) {
        g_print ( __FILE__ " - AU Parser could not be created\n");
        return -1;
    }
    sink   = gst_element_factory_make ("filesink", "Fake Sink");
 if (!sink) {
        g_print ( __FILE__ " - Fake sink could not be created\n");
        return -1;
    }
    randomnumber = rand();
 rnum = Randomizenumber(randomnumber, 0,100);
 {
        sprintf(tmpfile, "%s%d","temp",rnum);
  g_print("%p : %s is the string \n\n",pthread_self(),tmpfile); 
 }
    g_object_set (G_OBJECT (sink), "location", tmpfile, NULL);
    /* Add means for communication */
    bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
    gst_bus_add_watch (bus, bus_call, loop);
    gst_object_unref (bus);
    /* put the source element into the bin */
    gst_bin_add (GST_BIN (pipeline), source); 
    /* put the sink element into the bin */
    gst_bin_add (GST_BIN (pipeline), parser); 
    /* put the sink element into the bin */
    gst_bin_add (GST_BIN (pipeline), sink); 
 /* Link the elements */
 gst_element_link (source, parser);
    
 /* Handle new padded signal */ 
    g_signal_connect (parser, "pad-added", G_CALLBACK (new_pad), sink);
    /* Now set to playing and iterate. */
    g_print (  __FILE__ " - Setting to PLAYING\n");
    gst_element_set_state (pipeline, GST_STATE_PLAYING);
    g_print ( __FILE__ " - Running\n");
 
    g_main_loop_run (loop);
    /* clean up nicely */
    g_print (  __FILE__ " - Returned, stopping playback\n");
    gst_element_set_state (pipeline, GST_STATE_NULL);
 
 g_print ( __FILE__ " - Deleting pipeline\n");
    gst_object_unref (GST_OBJECT (pipeline));
    return 0;
}
int main(int argc, char *argv[])
{
  pthread_t threads[NUM_THREADS];
  int *taskids[NUM_THREADS], i,j;
  int rc, t, sum;
  g_print("%p: Main Thread ID\n",pthread_self());
  for(t=0;t<NUM_THREADS;t++) {
  printf("Creating thread %d\n", t);
  rc = pthread_create(&threads[t], NULL, mainloop, (void *)t);
  if (rc) {
    printf("ERROR; return code from pthread_create() is %d\n", rc);
    exit(-1);
    }
 /*for (i = 0; i < 1000 ; i++)
 {
  for (j = 0; j < 65533 ;j++ )
  {
   printf("");
  }
 }*/
  }
  while(1);
  return 0;
}

=================================
The output is of the following format
=================================

> ./app 
0xb7e11a80: Main Thread ID
Creating thread 0
Creating thread 1
Thread number is 0
0xb7e10bb0 :  is the Thread Id 
Thread number is 1
0xb740fbb0 :  is the Thread Id 
0xb740fbb0 : temp82 is the string 
app.c - Setting to PLAYING
0xb7e10bb0 : temp86 is the string 
app.c - Setting to PLAYING
app.c - Running
=========================================
This Id and the Id below is same
=========================================
0xb6593bb0 :  New Pad Thread Id 
Dynamic pad created, linking parser/sink
app.c - End-of-stream
app.c - Returned, stopping playback
=========================================
The above Id and this Id is same
=========================================
0xb6593bb0 :  New Pad Thread Id 
Dynamic pad created, linking parser/sink
app.c - Running
app.c - End-of-stream
app.c - Returned, stopping playback
app.c - Deleting pipeline
app.c - Deleting pipeline
> ./app 
0xb7e11a80: Main Thread ID
Creating thread 0
Creating thread 1
Thread number is 0
0xb7e10bb0 :  is the Thread Id 
Thread number is 1
0xb740fbb0 :  is the Thread Id 
0xb7e10bb0 : temp82 is the string 
app.c - Setting to PLAYING
0xb740fbb0 : temp86 is the string 
app.c - Setting to PLAYING
app.c - Running
0xb6593bb0 :  New Pad Thread Id 
Dynamic pad created, linking parser/sink
app.c - End-of-stream
app.c - Returned, stopping playback
app.c - Running
0xb6593bb0 :  New Pad Thread Id 
Dynamic pad created, linking parser/sink
app.c - End-of-stream
app.c - Returned, stopping playback
app.c - Deleting pipeline
app.c - Deleting pipeline
> ./app 
0xb7e11a80: Main Thread ID
Creating thread 0
Creating thread 1
Thread number is 1
0xb740fbb0 :  is the Thread Id 
Thread number is 0
0xb7e10bb0 :  is the Thread Id 
0xb7e10bb0 : temp82 is the string 
app.c - Setting to PLAYING
0xb740fbb0 : temp86 is the string 
app.c - Setting to PLAYING
app.c - Running
0xb6593bb0 :  New Pad Thread Id 
app.c - Running
Dynamic pad created, linking parser/sink
0xb578abb0 :  New Pad Thread Id 
Dynamic pad created, linking parser/sink
app.c - End-of-stream
app.c - Returned, stopping playback
app.c - End-of-stream
app.c - Returned, stopping playback
app.c - Deleting pipeline
app.c - Deleting pipeline

</code>

Thank you for your patience.

Regards,
Sid


      ____________________________________________________________________________________
 Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel and lay \
it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


[Attachment #5 (text/html)]

<html><head><style type="text/css"><!-- DIV {margin:0px;} \
--></style></head><body><div style="font-family:times new roman, new york, times, \
serif;font-size:12pt"><DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new \
york, times, serif">Hi All,</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">&nbsp;</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: \
times new roman, new york, times, serif">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; I am \
new to GST and I am trying to run a multithreaded program to run multiple gst \
players. I am using a filesink to&nbsp;store the buffers. I am trying with 2 thread \
initially. The problem is when I connect a pad creator function (new_pad) to link to \
new pad, the function gets called&nbsp;from one single thread irrespective of two \
threads being initiated. This behaviour is not always as I can see the pad creation \
function in two different functions also. Can anyone tell me why is this \
behaviour?</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, \
times, serif">The other problem is&nbsp;that the first file from the first \
thread&nbsp;contains the output&nbsp;data and the other one does not in either case \
of the new_pad function being run in same or unique thread. Can anyone suggest what \
is happening here.</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, \
new york, times, serif">Let me know if you need any further information.</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new \
york, times, serif">&lt;code&gt;</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: \
times new roman, new york, times, serif">&nbsp;</DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">#include \
&lt;gst/gst.h&gt;<BR>#include &lt;stdio.h&gt;<BR>#include &lt;pthread.h&gt;</DIV> \
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">#define GSTCOREELEMENTS_LIB \
"/gst_core/release/export/i686/lib/gstreamer-0.10/libgstcoreelements.so"<BR>#define \
GSTWAVPARSER_LIB&nbsp;&nbsp;&nbsp; \
"/gst_core/release/export/i686/lib/gstreamer-0.10/libgstwavparse.so"<BR>#define \
MEDIAFILE "a.wav"<BR>#define NUM_THREADS&nbsp;&nbsp;&nbsp;&nbsp; 2</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">pthread_mutex_t count_mutex;<BR>int i =0;</DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">static void<BR>new_pad \
(GstElement *element,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
GstPad&nbsp;&nbsp;&nbsp;&nbsp; \
*pad,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpointer&nbsp;&nbsp;&nbsp; \
data)<BR>{<BR>&nbsp; GstPad *sinkpad;</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: \
times new roman, new york, times, serif">&nbsp; g_print("%p :&nbsp; New Pad Thread Id \
\n\n", pthread_self());<BR>&nbsp; <BR>&nbsp; /* We can now link this pad with the \
audio decoder */<BR>&nbsp; g_print ("Dynamic pad created, linking \
parser/sink\n");</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new \
york, times, serif">&nbsp; sinkpad = gst_element_get_pad ( GST_ELEMENT(data), \
"sink");<BR>&nbsp; gst_pad_link (pad, sinkpad);</DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">&nbsp; gst_object_unref \
(sinkpad);<BR>}</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new \
york, times, serif"><BR>static void load_plugin_libs(void)<BR>{<BR>&nbsp;&nbsp;&nbsp; \
if( NULL == gst_plugin_load_file(GSTCOREELEMENTS_LIB, NULL) )<BR>&nbsp;&nbsp;&nbsp; \
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Failed to load \
%s\n",GSTCOREELEMENTS_LIB);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit \
(1);<BR>&nbsp;&nbsp;&nbsp; }</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times \
new roman, new york, times, serif">&nbsp;&nbsp;&nbsp; if( NULL == \
gst_plugin_load_file(GSTWAVPARSER_LIB, NULL) )<BR>&nbsp;&nbsp;&nbsp; \
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Failed to load \
%s\n",GSTWAVPARSER_LIB);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit \
(1);<BR>&nbsp;&nbsp;&nbsp; }</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times \
new roman, new york, times, serif">}</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: \
times new roman, new york, times, serif">static gboolean<BR>bus_call \
(GstBus&nbsp;&nbsp;&nbsp;&nbsp; *bus,<BR>&nbsp;&nbsp; GstMessage \
*msg,<BR>&nbsp;&nbsp; gpointer&nbsp;&nbsp;&nbsp; data)<BR>{<BR>&nbsp; GMainLoop *loop \
= data;</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, \
times, serif">&nbsp; switch (GST_MESSAGE_TYPE (msg)) {<BR>&nbsp;&nbsp;&nbsp; case \
GST_MESSAGE_EOS:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ( __FILE__ " - \
End-of-stream\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_main_loop_quit \
(loop);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp; case \
GST_MESSAGE_ERROR: {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gchar \
*debug;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GError *err;</DIV> <DIV style="FONT-SIZE: \
12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gst_message_parse_error (msg, &amp;err, \
&amp;debug);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_free (debug);</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print (&nbsp; __FILE__ " - Error: %s\n", \
err-&gt;message);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_error_free (err);</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_main_loop_quit \
(loop);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp; \
}<BR>&nbsp;&nbsp;&nbsp; default:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp; \
}</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp; return TRUE;<BR>}</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times \
new roman, new york, times, serif"><BR>int<BR>mainloop (void \
*threadarg)<BR>{<BR>&nbsp;&nbsp;&nbsp; GMainLoop *loop;<BR>&nbsp;&nbsp;&nbsp; GstBus \
*bus;<BR>&nbsp;<BR>&nbsp;int argc = 0;<BR>&nbsp;char *argv[] = {0};</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;&nbsp;&nbsp; GstElement *pipeline, *source, *parser, *sink \
;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; int randomnumber, rnum ;<BR>&nbsp;char tmpfile[50] \
;</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;g_print("Thread number is %d\n\n", \
(int)threadarg);<BR>&nbsp;&nbsp;&nbsp; g_print("%p :&nbsp; is the Thread Id \
\n\n",pthread_self());</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">&nbsp;&nbsp;&nbsp; /* initialize GStreamer \
*/<BR>&nbsp;&nbsp;&nbsp; gst_init (&amp;argc, &amp;argv);</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;&nbsp;&nbsp; loop = g_main_loop_new (NULL, FALSE);</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;&nbsp;&nbsp; /* Load Plugin libraries */<BR>&nbsp;&nbsp;&nbsp; \
load_plugin_libs();</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, \
new york, times, serif">&nbsp;&nbsp;&nbsp; /* create a pipeline \
*/<BR>&nbsp;&nbsp;&nbsp; pipeline = gst_pipeline_new ("my-player");</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;&nbsp;&nbsp; if (!pipeline) \
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ( __FILE__ " - Pipeline could \
not be created\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
-1;<BR>&nbsp;&nbsp;&nbsp; }</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">&nbsp;&nbsp;&nbsp; /* create a element for the PSS \
source element */<BR>&nbsp;&nbsp;&nbsp; source&nbsp;&nbsp; = gst_element_factory_make \
("filesrc", "File Source");</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">&nbsp;&nbsp;&nbsp; if (!source) \
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ( __FILE__ " - File source \
could not be created\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
-1;<BR>&nbsp;&nbsp;&nbsp; }</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">&nbsp;&nbsp;&nbsp; g_object_set (G_OBJECT (source), \
"location", MEDIAFILE, NULL);</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times \
new roman, new york, times, serif">&nbsp;&nbsp;&nbsp; parser&nbsp;&nbsp; = \
gst_element_factory_make ("wavparse", "Wav Parser");</DIV> <DIV style="FONT-SIZE: \
12pt; FONT-FAMILY: times new roman, new york, times, serif">&nbsp;if (!parser) \
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ( __FILE__ " - AU Parser \
could not be created\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
-1;<BR>&nbsp;&nbsp;&nbsp; }</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">&nbsp;&nbsp;&nbsp; sink&nbsp;&nbsp; = \
gst_element_factory_make ("filesink", "Fake Sink");</DIV> <DIV style="FONT-SIZE: \
12pt; FONT-FAMILY: times new roman, new york, times, serif">&nbsp;if (!sink) \
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ( __FILE__ " - Fake sink \
could not be created\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
-1;<BR>&nbsp;&nbsp;&nbsp; }</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">&nbsp;&nbsp;&nbsp; randomnumber = \
rand();<BR>&nbsp;rnum = Randomizenumber(randomnumber, \
0,100);<BR>&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sprintf(tmpfile, \
"%s%d","temp",rnum);<BR>&nbsp;&nbsp;g_print("%p : %s is the string \
\n\n",pthread_self(),tmpfile);&nbsp;<BR>&nbsp;}</DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">&nbsp;&nbsp;&nbsp; g_object_set \
(G_OBJECT (sink), "location", tmpfile, NULL);</DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">&nbsp;&nbsp;&nbsp; /* Add means \
for communication */<BR>&nbsp;&nbsp;&nbsp; bus = gst_pipeline_get_bus (GST_PIPELINE \
(pipeline));<BR>&nbsp;&nbsp;&nbsp; gst_bus_add_watch (bus, bus_call, \
loop);<BR>&nbsp;&nbsp;&nbsp; gst_object_unref (bus);</DIV> <DIV style="FONT-SIZE: \
12pt; FONT-FAMILY: times new roman, new york, times, serif">&nbsp;&nbsp;&nbsp; /* put \
the source element into the bin */<BR>&nbsp;&nbsp;&nbsp; gst_bin_add (GST_BIN \
(pipeline), source); </DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">&nbsp;&nbsp;&nbsp; /* put the sink element into the \
bin */<BR>&nbsp;&nbsp;&nbsp; gst_bin_add (GST_BIN (pipeline), parser); </DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;&nbsp;&nbsp; /* put the sink element into the bin \
*/<BR>&nbsp;&nbsp;&nbsp; gst_bin_add (GST_BIN (pipeline), sink); </DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;/* Link the elements */<BR>&nbsp;gst_element_link (source, \
parser);<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;/* Handle new padded signal */ \
<BR>&nbsp;&nbsp;&nbsp; g_signal_connect (parser, "pad-added", G_CALLBACK (new_pad), \
sink);</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, \
times, serif">&nbsp;&nbsp;&nbsp; /* Now set to playing and iterate. \
*/<BR>&nbsp;&nbsp;&nbsp; g_print (&nbsp; __FILE__ " - Setting to \
PLAYING\n");<BR>&nbsp;&nbsp;&nbsp; gst_element_set_state (pipeline, \
GST_STATE_PLAYING);</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, \
new york, times, serif">&nbsp;&nbsp;&nbsp; g_print ( __FILE__ " - \
Running\n");<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; g_main_loop_run (loop);</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;&nbsp;&nbsp; /* clean up nicely */<BR>&nbsp;&nbsp;&nbsp; g_print (&nbsp; \
__FILE__ " - Returned, stopping playback\n");</DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">&nbsp;&nbsp;&nbsp; \
gst_element_set_state (pipeline, GST_STATE_NULL);<BR>&nbsp;<BR>&nbsp;g_print ( \
__FILE__ " - Deleting pipeline\n");<BR>&nbsp;&nbsp;&nbsp; gst_object_unref \
(GST_OBJECT (pipeline));</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">&nbsp;&nbsp;&nbsp; return 0;<BR>}</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">int \
main(int argc, char *argv[])<BR>{</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: \
times new roman, new york, times, serif">&nbsp; pthread_t \
threads[NUM_THREADS];<BR>&nbsp; int *taskids[NUM_THREADS], i,j;<BR>&nbsp; int rc, t, \
sum;</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, \
times, serif">&nbsp; g_print("%p: Main Thread ID\n",pthread_self());</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">&nbsp; \
for(t=0;t&lt;NUM_THREADS;t++) {</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times \
new roman, new york, times, serif">&nbsp; printf("Creating thread %d\n", t);</DIV> \
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp; rc = pthread_create(&amp;threads[t], NULL, mainloop, (void *)t);</DIV> \
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp; if (rc) {<BR>&nbsp;&nbsp;&nbsp; printf("ERROR; return code from \
pthread_create() is %d\n", rc);<BR>&nbsp;&nbsp;&nbsp; exit(-1);<BR>&nbsp;&nbsp;&nbsp; \
}<BR>&nbsp;/*for (i = 0; i &lt; 1000 ; i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;for (j = 0; j \
&lt; 65533 ;j++ )<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;printf("");<BR>&nbsp;&nbsp;}<BR>&nbsp;}*/<BR>&nbsp; \
}</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp; while(1);</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">&nbsp; return 0;<BR>}</DIV> <DIV style="FONT-SIZE: \
12pt; FONT-FAMILY: times new roman, new york, times, serif">&nbsp;</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">=================================</DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">The output is of the following \
format</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, \
times, serif">=================================</DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">&nbsp;</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">&gt; \
./app <BR>0xb7e11a80: Main Thread ID<BR>Creating thread 0<BR>Creating thread \
1<BR>Thread number is 0</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">0xb7e10bb0 :&nbsp; is the Thread Id </DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Thread \
number is 1</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new \
york, times, serif">0xb740fbb0 :&nbsp; is the Thread Id </DIV> <DIV style="FONT-SIZE: \
12pt; FONT-FAMILY: times new roman, new york, times, serif">0xb740fbb0 : temp82 is \
the string </DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new \
york, times, serif">app.c - Setting to PLAYING<BR>0xb7e10bb0 : temp86 is the string \
</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">app.c - Setting to PLAYING<BR>app.c - \
Running<BR>=========================================<BR>This Id and the Id below is \
same<BR>=========================================<BR>0xb6593bb0 :&nbsp; New Pad \
Thread Id </DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, \
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">Dynamic pad created, linking parser/sink<BR>app.c - Running<BR>app.c - \
End-of-stream<BR>app.c - Returned, stopping playback<BR>app.c - Deleting \
pipeline<BR>app.c - Deleting pipeline</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: \
times new roman, new york, times, serif">&gt; ./app <BR>0xb7e11a80: Main Thread \
ID<BR>Creating thread 0<BR>Creating thread 1<BR>Thread number is 0</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">0xb7e10bb0 :&nbsp; is the Thread Id </DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">Thread number is 1</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">0xb740fbb0 :&nbsp; is the Thread Id </DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">0xb7e10bb0 : temp82 is the \
string </DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, \
times, serif">app.c - Setting to PLAYING<BR>0xb740fbb0 : temp86 is the string </DIV> \
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">app.c - Setting to PLAYING<BR>app.c - Running<BR>0xb6593bb0 :&nbsp; New Pad \
Thread Id </DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, \
times, serif">Dynamic pad created, linking parser/sink<BR>app.c - \
End-of-stream<BR>app.c - Returned, stopping playback<BR>app.c - Running<BR>0xb6593bb0 \
:&nbsp; New Pad Thread Id </DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new \
roman, new york, times, serif">Dynamic pad created, linking parser/sink<BR>app.c - \
End-of-stream<BR>app.c - Returned, stopping playback<BR>app.c - Deleting \
pipeline<BR>app.c - Deleting pipeline</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: \
times new roman, new york, times, serif">&gt; ./app <BR>0xb7e11a80: Main Thread \
ID<BR>Creating thread 0<BR>Creating thread 1<BR>Thread number is 1</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">0xb740fbb0 :&nbsp; is the Thread Id </DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">Thread number is 0</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">0xb7e10bb0 :&nbsp; is the Thread Id </DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">0xb7e10bb0 : temp82 is the \
string </DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, \
times, serif">app.c - Setting to PLAYING<BR>0xb740fbb0 : temp86 is the string </DIV> \
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">app.c - Setting to PLAYING<BR>app.c - Running<BR>0xb6593bb0 :&nbsp; New Pad \
Thread Id </DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, \
times, serif">app.c - Running<BR>Dynamic pad created, linking \
parser/sink<BR>0xb578abb0 :&nbsp; New Pad Thread Id </DIV> <DIV style="FONT-SIZE: \
12pt; FONT-FAMILY: times new roman, new york, times, serif">Dynamic pad created, \
linking parser/sink<BR>app.c - End-of-stream<BR>app.c - Returned, stopping \
playback<BR>app.c - End-of-stream<BR>app.c - Returned, stopping playback<BR>app.c - \
Deleting pipeline<BR>app.c - Deleting pipeline</DIV> <DIV style="FONT-SIZE: 12pt; \
FONT-FAMILY: times new roman, new york, times, serif">&nbsp;</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&lt;/code&gt;</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, \
new york, times, serif">&nbsp;</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times \
new roman, new york, times, serif">Thank you for your patience.</DIV> <DIV \
style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, \
serif">&nbsp;</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new \
york, times, serif">Regards,</DIV> <DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times \
new roman, new york, times, serif">Sid</DIV></div><br>  <hr size=1>Be a better \
Globetrotter. <a href="http://us.rd.yahoo.com/evt=48254/*http://answers.yahoo.com/dir/ \
_ylc=X3oDMTI5MGx2aThyBF9TAzIxMTU1MDAzNTIEX3MDMzk2NTQ1MTAzBHNlYwNCQUJwaWxsYXJfTklfMzYwBHNsawNQcm9kdWN0X3F1ZXN0aW9uX3BhZ2U-?link=list&sid=396545469">Get \
better travel answers </a>from someone who knows.<br>Yahoo! Answers - Check it out.

</body></html>



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic