Problems trying to play 2 streams simultaneously

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi Thiago,

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.

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.

Any clue as to why this is happening ?

regards
Rajesh Marathe.


On 10/22/2009 05:52 PM, thiagossantos at gmail.com wrote:
>
>
> On Tue, Oct 20, 2009 at 9:21 AM, Rajesh Marathe <rmarathe at i-rode.com 
> <mailto:rmarathe at i-rode.com>> wrote:
>
>     Hi,
>
>     I am new to gstreamer and started working on it very recently. While I
>     am studying, I wrote a program to play two streams alternately using
>     gstreamer. Details below:
>
>     Development environment:
>     -------------------------------------
>
>     LTIB and iMX27ADS board. Host PC has Redhat EL5.0.
>
>     Problem description:
>     -----------------------------
>
>     I have two MP4 files. My intention is to play the first file for a few
>     seconds and pause the same and play the second file fully. After
>     getting
>     End-of-Steam message for second file, resume and complete the first
>     file. My program looks like this:
>
>     int
>     main (int   argc,
>           char *argv[])
>     {
>       GMainLoop *loop;
>       GstStateChangeReturn retval;
>
>
>       /* Initialisation */
>       gst_init (&argc, &argv);
>
>       loop = g_main_loop_new (NULL, FALSE);
>
>       /* Create gstreamer elements */
>       masterpipe = GstCreatePipelineMaster ("master-player", argv[1]);
>       slavepipe = GstCreatePipelineSlave ("slave-player", argv[2]);
>
>       retval = gst_element_set_state (slavepipe, GST_STATE_PAUSED);
>
>       retval = gst_element_set_state (masterpipe, GST_STATE_PLAYING);
>
>       g_timeout_add (4000, (GSourceFunc) cb_print_position, masterpipe);
>       g_main_loop_run (loop);
>     ...
>     ...
>     }
>
>     static GstElement * GstCreatePipelineMaster (char *name, char *file)
>     {
>
>             GstElement *pipeline;
>
>       /* Create gstreamer elements */
>       pipeline      = gst_pipeline_new (name);
>       source        = gst_element_factory_make ("filesrc","file-source");
>       demuxer       = gst_element_factory_make
>     ("mfw_mp4demuxer","avi-demuxer");
>       decvd         = gst_element_factory_make ("mfw_vpudecoder",
>     "video-decoder");
>       decad         = gst_element_factory_make ("mad", "mp3-decoder");
>       vdsink        = gst_element_factory_make ("mfw_v4lsink",
>     "video-sink");
>       vdqueue       = gst_element_factory_make ("queue",
>     "video-queue");
>       adqueue       = gst_element_factory_make ("queue",
>     "audio-queue");
>       adsink        = gst_element_factory_make ("fakesink",
>     "audio-sink");
>
>       g_object_set (decvd, "codec-type", "std_mpeg4", NULL);
>       if (!pipeline || !source || !demuxer || !decvd || !decad || !vdsink
>     || !vdqueue || !adqueue || !adsink) {
>             return NULL;
>       }
>
>       /* Set up the pipeline */
>
>       /* we set the input filename to the source element */
>       g_object_set (G_OBJECT (source), "location", file, NULL);
>
>
>       /* we add all elements into the pipeline */
>       /* file-source | ogg-demuxer | vorbis-decoder | converter |
>     alsa-output */
>       gst_bin_add_many (GST_BIN (pipeline),
>                         source, demuxer, decvd, decad,/* adqueue,
>     vdqueue,*/ vdsink, adsink,  NULL);
>
>       /* we link the elements together */
>       /* file-source -> ogg-demuxer ~> vorbis-decoder -> converter ->
>     alsa-output */
>       gst_element_link (source, demuxer);
>       gst_element_link (decvd, vdsink);
>      // gst_element_link (vdqueue, vdsink);
>      // gst_element_link (decad, adqueue);
>      // gst_element_link (adqueue, adsink);
>       gst_element_link (decad, adsink);
>
>       g_signal_connect (demuxer, "pad-added", G_CALLBACK
>     (on_pad_added), NULL);
>
>             return pipeline;
>     }
>
>     static GstElement * GstCreatePipelineSlave (char *name, char *file)
>     {
>
>             GstElement *pipeline;
>
>       /* Create gstreamer elements */
>       pipeline      = gst_pipeline_new (name);
>
>       /* Set up the pipeline */
>
>       /* we set the input filename to the source element */
>       g_object_set (G_OBJECT (source), "location", file, NULL);
>
>
>       /* we add all elements into the pipeline */
>       /* file-source | ogg-demuxer | vorbis-decoder | converter |
>     alsa-output */
>       gst_bin_add_many (GST_BIN (pipeline),
>                         source, demuxer, decvd, decad,/* adqueue,
>     vdqueue,*/ vdsink, adsink,  NULL);
>
>             return pipeline;
>
>     }
>
>
>     Please note above, that I am creating two pipelines Master and
>     slave and
>     adding same elements to the master adn slave 'bin's. Is this okay
>     to do ?
>
> The elements can only have a single parent bin, it can't be inside two 
> bins at the same time.
> You would probably notice the problem by checking the result of 
> gst_bin_add*
>
>
>     I do see the master playing and after few seconds the timer
>     function is
>     called in which I move the master to 'PAUSE' state and slave to
>     'PLAYING'. But the slave media does not play at all??
>
>     Can anybody let me know what is wrong above ?
>
>     regards,
>     Rajesh Marathe.
>
>     ------------------------------------------------------------------------------
>     Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>     is the only developer event you need to attend this year.
>     Jumpstart your
>     developing skills, take BlackBerry mobile applications to market
>     and stay
>     ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>     http://p.sf.net/sfu/devconference
>     _______________________________________________
>     Gstreamer-embedded mailing list
>     Gstreamer-embedded at lists.sourceforge.net
>     <mailto:Gstreamer-embedded at lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/gstreamer-embedded
>
>
>
>
> -- 
> Thiago Sousa Santos

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-embedded/attachments/20091023/24d1ee34/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: playmultiplethreads.c
Type: text/x-csrc
Size: 12758 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-embedded/attachments/20091023/24d1ee34/attachment.c>


[Index of Archives]     [Linux Embedded]     [Linux ARM Kernel]     [Linux for ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux Media]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux