<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Hi Thiago,<br>
<br>
Yes, I did notice this problem and I have corrected the same.
Presently, I am creating two different pipelines (with different
elements) in it. I try to pause stream1 and this works. But I cannot
play the second stream for some reason. <br>
<br>
I have attached the code along with this email. Actually, this time
around, on pausing the first stream and playing the second stream I get
an error like "Cannot play stream 16", and this I see, comes from
Freescale codec plugin. <br>
<br>
Any clue as to why this is happening ? <br>
<br>
regards<br>
Rajesh Marathe.<br>
<br>
<br>
On 10/22/2009 05:52 PM, <a class="moz-txt-link-abbreviated" href="mailto:thiagossantos@gmail.com">thiagossantos@gmail.com</a> wrote:
<blockquote
 cite="mid:de4879e80910220522i4a1d7045j174c7bd7d95a90a5@mail.gmail.com"
 type="cite"><br>
  <br>
  <div class="gmail_quote">On Tue, Oct 20, 2009 at 9:21 AM, Rajesh
Marathe <span dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:rmarathe@i-rode.com">rmarathe@i-rode.com</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
    <br>
I am new to gstreamer and started working on it very recently. While I<br>
am studying, I wrote a program to play two streams alternately using<br>
gstreamer. Details below:<br>
    <br>
Development environment:<br>
-------------------------------------<br>
    <br>
LTIB and iMX27ADS board. Host PC has Redhat EL5.0.<br>
    <br>
Problem description:<br>
-----------------------------<br>
    <br>
I have two MP4 files. My intention is to play the first file for a few<br>
seconds and pause the same and play the second file fully. After getting<br>
End-of-Steam message for second file, resume and complete the first<br>
file. My program looks like this:<br>
    <br>
int<br>
main (int &nbsp; argc,<br>
&nbsp; &nbsp; &nbsp; char *argv[])<br>
{<br>
&nbsp; GMainLoop *loop;<br>
&nbsp; GstStateChangeReturn retval;<br>
    <br>
    <br>
&nbsp; /* Initialisation */<br>
&nbsp; gst_init (&amp;argc, &amp;argv);<br>
    <br>
&nbsp; loop = g_main_loop_new (NULL, FALSE);<br>
    <br>
&nbsp; /* Create gstreamer elements */<br>
&nbsp; masterpipe = GstCreatePipelineMaster ("master-player", argv[1]);<br>
&nbsp; slavepipe = GstCreatePipelineSlave ("slave-player", argv[2]);<br>
    <br>
&nbsp; retval = gst_element_set_state (slavepipe, GST_STATE_PAUSED);<br>
    <br>
&nbsp; retval = gst_element_set_state (masterpipe, GST_STATE_PLAYING);<br>
    <br>
&nbsp; g_timeout_add (4000, (GSourceFunc) cb_print_position, masterpipe);<br>
&nbsp; g_main_loop_run (loop);<br>
...<br>
...<br>
}<br>
    <br>
static GstElement * GstCreatePipelineMaster (char *name, char *file)<br>
{<br>
    <br>
&nbsp; &nbsp; &nbsp; &nbsp; GstElement *pipeline;<br>
    <br>
&nbsp; /* Create gstreamer elements */<br>
&nbsp; pipeline &nbsp; &nbsp; &nbsp;= gst_pipeline_new (name);<br>
&nbsp; source &nbsp; &nbsp; &nbsp; &nbsp;= gst_element_factory_make ("filesrc","file-source");<br>
&nbsp; demuxer &nbsp; &nbsp; &nbsp; = gst_element_factory_make<br>
("mfw_mp4demuxer","avi-demuxer");<br>
&nbsp; decvd &nbsp; &nbsp; &nbsp; &nbsp; = gst_element_factory_make ("mfw_vpudecoder",<br>
"video-decoder");<br>
&nbsp; decad &nbsp; &nbsp; &nbsp; &nbsp; = gst_element_factory_make ("mad", "mp3-decoder");<br>
&nbsp; vdsink &nbsp; &nbsp; &nbsp; &nbsp;= gst_element_factory_make ("mfw_v4lsink",<br>
"video-sink");<br>
&nbsp; vdqueue &nbsp; &nbsp; &nbsp; = gst_element_factory_make ("queue",<br>
"video-queue");<br>
&nbsp; adqueue &nbsp; &nbsp; &nbsp; = gst_element_factory_make ("queue",<br>
"audio-queue");<br>
&nbsp; adsink &nbsp; &nbsp; &nbsp; &nbsp;= gst_element_factory_make ("fakesink",<br>
"audio-sink");<br>
    <br>
&nbsp; g_object_set (decvd, "codec-type", "std_mpeg4", NULL);<br>
&nbsp; if (!pipeline || !source || !demuxer || !decvd || !decad || !vdsink<br>
|| !vdqueue || !adqueue || !adsink) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; return NULL;<br>
&nbsp; }<br>
    <br>
&nbsp; /* Set up the pipeline */<br>
    <br>
&nbsp; /* we set the input filename to the source element */<br>
&nbsp; g_object_set (G_OBJECT (source), "location", file, NULL);<br>
    <br>
    <br>
&nbsp; /* we add all elements into the pipeline */<br>
&nbsp; /* file-source | ogg-demuxer | vorbis-decoder | converter |<br>
alsa-output */<br>
&nbsp; gst_bin_add_many (GST_BIN (pipeline),<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; source, demuxer, decvd, decad,/* adqueue,<br>
vdqueue,*/ vdsink, adsink, &nbsp;NULL);<br>
    <br>
&nbsp; /* we link the elements together */<br>
&nbsp; /* file-source -&gt; ogg-demuxer ~&gt; vorbis-decoder -&gt; converter
-&gt;<br>
alsa-output */<br>
&nbsp; gst_element_link (source, demuxer);<br>
&nbsp; gst_element_link (decvd, vdsink);<br>
&nbsp;// gst_element_link (vdqueue, vdsink);<br>
&nbsp;// gst_element_link (decad, adqueue);<br>
&nbsp;// gst_element_link (adqueue, adsink);<br>
&nbsp; gst_element_link (decad, adsink);<br>
    <br>
&nbsp; g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added),
NULL);<br>
    <br>
&nbsp; &nbsp; &nbsp; &nbsp; return pipeline;<br>
}<br>
    <br>
static GstElement * GstCreatePipelineSlave (char *name, char *file)<br>
{<br>
    <br>
&nbsp; &nbsp; &nbsp; &nbsp; GstElement *pipeline;<br>
    <br>
&nbsp; /* Create gstreamer elements */<br>
&nbsp; pipeline &nbsp; &nbsp; &nbsp;= gst_pipeline_new (name);<br>
    <br>
&nbsp; /* Set up the pipeline */<br>
    <br>
&nbsp; /* we set the input filename to the source element */<br>
&nbsp; g_object_set (G_OBJECT (source), "location", file, NULL);<br>
    <br>
    <br>
&nbsp; /* we add all elements into the pipeline */<br>
&nbsp; /* file-source | ogg-demuxer | vorbis-decoder | converter |<br>
alsa-output */<br>
&nbsp; gst_bin_add_many (GST_BIN (pipeline),<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; source, demuxer, decvd, decad,/* adqueue,<br>
vdqueue,*/ vdsink, adsink, &nbsp;NULL);<br>
    <br>
&nbsp; &nbsp; &nbsp; &nbsp; return pipeline;<br>
    <br>
}<br>
    <br>
    <br>
Please note above, that I am creating two pipelines Master and slave and<br>
adding same elements to the master adn slave 'bin's. Is this okay to do
?<br>
  </blockquote>
  <div>&nbsp;</div>
  <div>The elements can only have a single parent bin, it can't be
inside two bins at the same time.&nbsp;</div>
  <div>You would probably notice the problem by checking the result of
gst_bin_add*</div>
  <div><br>
  </div>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
I do see the master playing and after few seconds the timer function is<br>
called in which I move the master to 'PAUSE' state and slave to<br>
'PLAYING'. But the slave media does not play at all??<br>
    <br>
Can anybody let me know what is wrong above ?<br>
    <br>
regards,<br>
Rajesh Marathe.<br>
    <br>
------------------------------------------------------------------------------<br>
Come build with us! The BlackBerry(R) Developer Conference in SF, CA<br>
is the only developer event you need to attend this year. Jumpstart your<br>
developing skills, take BlackBerry mobile applications to market and
stay<br>
ahead of the curve. Join us from November 9 - 12, 2009. Register now!<br>
    <a moz-do-not-send="true" href="http://p.sf.net/sfu/devconference"
 target="_blank">http://p.sf.net/sfu/devconference</a><br>
_______________________________________________<br>
Gstreamer-embedded mailing list<br>
    <a moz-do-not-send="true"
 href="mailto:Gstreamer-embedded@lists.sourceforge.net">Gstreamer-embedded@lists.sourceforge.net</a><br>
    <a moz-do-not-send="true"
 href="https://lists.sourceforge.net/lists/listinfo/gstreamer-embedded"
 target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-embedded</a><br>
  </blockquote>
  </div>
  <br>
  <br clear="all">
  <br>
-- <br>
Thiago Sousa Santos<br>
</blockquote>
<br>
</body>
</html>