<div class="gmail_quote"><div class="gmail_quote">Hi All,<br><div class="gmail_quote"><div class="gmail_quote"><br>     I am very new to gstreamer and started working only 2 days back. I am trying to create a sample source plugin with 2 source pads. (My large idea is to include a demux also in the source plugin and at that point in time one pad will push audio and the other will push video. But as of now both pads are of type &quot;ANY&quot;). To test my plugin, I am trying to connect it to two filesinks (i.e each source pad is connected to the sink pad of a filesink). So the pipeline has 3 plugins. My test source  and 2 filesinks. After creating the pipeline, I call gst_element_set_state with GST_STATE_PLAYING. After this initially all 3 of the plugins and pipeline move to READY state (I get bus_call callback with state changed confirmation). Then my source plugin changes to PAUSED state and then the entire app hangs. I have attached the sample app code I am working on. Please tell me what I am doing wrong here.<br>



<br>Thanks in advance<br>KK<br>
<br>#include &lt;gst/gst.h&gt;<br><br>#include &lt;glib.h&gt;<br><br>GstElement *mypipeline = NULL;<br>static int ccount = 0;<br><br>static gboolean bus_call (GstBus     *bus,<br>                          GstMessage *msg,<br>
                          gpointer    data)<br>{<br>      g_print(&quot;Got one bus call:%d\n&quot;, GST_MESSAGE_TYPE(msg));<br>          GMainLoop *loop = (GMainLoop *) data;<br>            switch (GST_MESSAGE_TYPE (msg))<br>
            {<br>                case GST_MESSAGE_EOS:<br>                      g_print (&quot;End of stream\n&quot;);<br>                      g_main_loop_quit (loop);<br>                      break;<br><br>                case GST_MESSAGE_ERROR:<br>
                      {<br>                            gchar *debug;<br>                            GError *error;<br>                            gst_message_parse_error (msg, &amp;error, &amp;debug);<br>                            g_free (debug);<br>
                            g_printerr (&quot;Error: %s\n&quot;, error-&gt;message);<br>                            g_error_free (error);<br>                            g_main_loop_quit (loop);<br>                            break;<br>
                      }<br><br>        case GST_MESSAGE_STATE_CHANGED:<br>              {<br>            ccount++;<br>            printf(&quot;State change:%d\n&quot;, ccount);<br>            printf(&quot;Element:%s\n&quot;, msg-&gt;src-&gt;name);<br>
            break;<br>              }<br>                default:<br>                   break;<br>            }<br>            return TRUE;<br>}<br><br><br>int main(int argc, char* argv[])<br>{<br>    GMainLoop* loop = NULL;<br>
    GstElement *pipeline, *source, *fsink1, *fsink2;<br>    GstBus *bus;<br><br>    gst_init(&amp;argc, &amp;argv);<br><br>    loop = g_main_loop_new (NULL, FALSE);<br><br>    pipeline = gst_pipeline_new(&quot;TstPipeLine&quot;);<br>
<br>    if(!pipeline)<br>    {<br>        g_print(&quot;Could not create pipeline\n&quot;);<br>        return -1;<br>    }<br><br>    source = gst_element_factory_make(&quot;tstsrc&quot;, &quot;tstsrcplug&quot;);<br>    if(!source)<br>
    {<br>        g_print(&quot;Did not get ur source\n&quot;);<br>        return -1;<br>    }<br><br>    fsink1 = gst_element_factory_make (&quot;filesink&quot;,&quot;asink&quot;);<br>    fsink2 = gst_element_factory_make (&quot;filesink&quot;,&quot;vsink&quot;);<br>
    if((!fsink1) || (!fsink2))<br>    {<br>        g_print(&quot;Could not create at least one sink\n&quot;);<br>        return -1;<br>    }<br><br>    g_object_set(G_OBJECT (fsink1), &quot;location&quot;, &quot;afile.dmp&quot;, NULL);<br>
    g_object_set(G_OBJECT (fsink2), &quot;location&quot;, &quot;vfile.dmp&quot;, NULL);<br><br>    bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br>        gst_bus_add_watch (bus, bus_call, loop);<br>        gst_object_unref (bus);<br>
<br>    gst_bin_add_many (GST_BIN (pipeline),source, fsink1, fsink2, NULL);<br>    <br>    gboolean bret = gst_element_link_pads(source, &quot;asrc&quot;, fsink1, &quot;sink&quot;);<br>    printf(&quot;Bool ret = %d\n&quot;, bret);<br>
    bret = gst_element_link_pads(source, &quot;vsrc&quot;, fsink2, &quot;sink&quot;);<br>    printf(&quot;Bool ret = %d\n&quot;, bret);<br><br>    GstStateChangeReturn myretval = 0;<br>    g_print(&quot;Now playing\n&quot;);<br>
    myretval = gst_element_set_state(pipeline, GST_STATE_PLAYING);<br><br>    printf(&quot;State of source:%d \n&quot;, GST_STATE(source));<br>    printf(&quot;State of asink:%d \n&quot;, GST_STATE(fsink1));<br>    printf(&quot;State of vsink:%d \n&quot;, GST_STATE(fsink2));<br>
    printf(&quot;Retval%d\n&quot;, myretval);<br><br>    g_print (&quot;Running...\n&quot;);<br>        g_main_loop_run (loop);<br>    return 0;<br>}<br><br><a href="mailto:gstreamer-devel@lists.sourceforge.net" target="_blank"></a></div>
<br>
</div><br>
</div><br>
</div><br>