<br />hi,<br />i think you should try with fluendo mpegts demuxer.<br />you can download it from fluendo site free of cost.<br /><br /><br />cheers!<br />digitaldsp<br /><br /><br /><br /> --- On Tue 09/25, sangita pithadia < sangitapithadia@gmail.com > wrote:<br /><blockquote style="border-left: 2px solid orange; padding-left: 7px; margin-left: 7px;"><b>From: </b>sangita pithadia [mailto: sangitapithadia@gmail.com]<br /><b>To: </b>gstreamer-devel@lists.sourceforge.net<br /><b>Date: </b>Tue, 25 Sep 2007 12:18:19 +0000<br /><b>Subject: </b>[gst-devel] gstreamer problem<br /><br />Hi,<br /><br />I m trying to play MPEG TS using gstreamer pipeline. <br />This is the pipeline which i have used to playback the file. It works fine.<br /><br /><br /><br /><br /><br /><br /><pre>gst-launch -v filesrc location=/root/GStremerDir/gstreamer-0.10.13/ed24p_00.ts ! ffdemux_mpegts ! ffdec_mpeg2video ! queue ! videoscale ! ffmpegcolorspace ! xvimagesink </pre><br />Same thing i tried to
do using the code but it doesnt play.<br />my code is like..<br /><br /><br /><br /><br /><br /><br /><pre><span style="color: rgb(0, 128, 0);">#include<stdio.h /></span><br /><span style="color: rgb(0, 128, 0);">#define SOURCE "filesrc"</span><br /><span style="color: rgb(0, 128, 0);">#define VSINK "xvimagesink"</span><br /><span style="color: rgb(0, 128, 0);">#define ASINK "alsasink"</span><br /><span style="color: rgb(0, 128, 0);">#include <stdlib.h /></span><br /><span style="color: rgb(0, 128, 0);">#include <glib.h /></span><br /><span style="color: rgb(128, 128, 128);"><i>//#include <gtk /></i></span><br /><span style="color: rgb(0, 128, 0);">#include <gst /></span><br /><span style="color: rgb(0, 128, 0);">#include <string.h /></span><br /><br /><span style="color: rgb(128, 0, 0);">const</span> gchar * location = <span style="color: rgb(221, 0, 0);">"file:///root/GStremerDir/ed24p_00.ts"</span>;<br /><span style="color: rgb(128,
0, 0);">static</span> GList *seekable_pads = NULL;<br /><span style="color: rgb(128, 0, 0);">static</span> GList *rate_pads = NULL;<br /><span style="color: rgb(128, 0, 0);">static</span> GstElement *pipeline;<br /><span style="color: rgb(128, 0, 0);">static</span> GList *seekable_elements = NULL;<br /><b>typedef</b> <b>struct</b><br />{<br />        <span style="color: rgb(128, 0, 0);">const</span> gchar *padname;<br />        GstPad *target;<br />        GstElement *bin;<br />}<br />dyn_link;<br /><br /><span style="color: rgb(128, 0, 0);">static</span> gboolean<br />bus_call (GstBus *bus,<br />         GstMessage *msg,<br />         gpointer data)<br />{<br /> GMainLoop *loop = (GMainLoop *) data;<br /><br /> <b>switch</b> (GST_MESSAGE_TYPE (msg)) {<br /> <b>case</b> GST_MESSAGE_EOS:<br /> g_print (<span style="color: rgb(221, 0, 0);">"End-of-stream</span><span style="color: rgb(255, 0, 255);">\n</span><span style="color: rgb(221, 0, 0);">"</span>);<br /> g_main_loop_quit
(loop);<br /> <b>break</b>;<br /> <b>case</b> GST_MESSAGE_ERROR: {<br /> gchar *debug;<br /> GError *err;<br /><br /> gst_message_parse_error (msg, &err, &debug);<br /> g_free (debug);<br /><br /> g_print (<span style="color: rgb(221, 0, 0);">"Error: %s</span><span style="color: rgb(255, 0, 255);">\n</span><span style="color: rgb(221, 0, 0);">"</span>, err->message);<br /> g_error_free (err);<br /><br /> g_main_loop_quit (loop);<br /> <b>break</b>;<br /> }<br /> <b>default</b>:<br /> <b>break</b>;<br /> }<br />}<br /><br /><span style="color: rgb(128, 0, 0);">static</span> GstElement *<br />gst_element_factory_make_or_warn (gchar * type, gchar * name)<br />{<br />        GstElement *element = gst_element_factory_make (type, name);<br />        <br />        <b>if</b> (!element) {<br />        g_warning (<span style="color: rgb(221, 0, 0);">"Failed to create element %s of type %s"</span>, name, type);<br />        }<br />        
<br />        <b>return</b> element;<br />}<br /><span style="color: rgb(128, 0, 0);">static</span> <span style="color: rgb(128, 0, 0);">void</span> dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)<br />{<br />        gchar *padname;<br />        dyn_link *connect = (dyn_link *) data;<br />        <br />        padname = gst_pad_get_name (newpad);<br />        <br />        <b>if</b> (connect->padname == NULL || !strcmp (padname, connect->padname)) {<br />        <b>if</b> (connect->bin)<br />        gst_bin_add (GST_BIN (pipeline), connect->bin);<br />        gst_pad_link (newpad, connect->target);<br />        <br />        seekable_pads = g_list_prepend (seekable_pads, newpad);<br />        rate_pads = g_list_prepend (rate_pads, newpad);<br />        }<br />        g_free (padname);<br />}<br /><br /><span style="color: rgb(128, 0, 0);">static</span> <span style="color: rgb(128, 0, 0);">void</span> setup_dynamic_link (GstElement * element, <span style="color: rgb(128, 0, 0);">const</span> gchar * padname,<br /> GstPad * target,
GstElement * bin)<br />{<br />        dyn_link *connect;<br />        <br />        connect = g_new0 (dyn_link, <span style="color: rgb(0, 0, 255);">1</span>);<br />        connect->padname = g_strdup (padname);<br />        connect->target = target;<br />        connect->bin = bin;<br />        <br />        g_signal_connect (G_OBJECT (element), <span style="color: rgb(221, 0, 0);">"pad-added"</span>, G_CALLBACK (dynamic_link),<br />        connect);<br />}<br /><span style="color: rgb(128, 0, 0);">int</span> main(<span style="color: rgb(128, 0, 0);">int</span> argc,<span style="color: rgb(128, 0, 0);">char</span> *argv[])<br />{<br />        <span style="color: rgb(128, 0, 0);">static</span> GstElement *bin;        <br />        GstBus *bus;<br />        GMainLoop *loop;<br />        GstElement *pipeline, *audio_bin, *video_bin;<br />        GstElement *src, *demux, *a_decoder, *v_decoder, *v_filter;<br />        GstElement *audiosink, *videosink;<br />        GstElement *a_queue, *v_queue, *v_scale;<br />        GstPad *seekable;<br />        GstPad *pad;<br />        <br />        gst_init
(&argc, &argv);<br />        loop = g_main_loop_new (NULL, FALSE);<br />        <b>if</b> (argc != <span style="color: rgb(0, 0, 255);">2</span>) <br />        {<br />                 g_print (<span style="color: rgb(221, 0, 0);">"Usage: %s <avi /></span><span style="color: rgb(255, 0, 255);">\n</span><span style="color: rgb(221, 0, 0);">"</span>, argv[<span style="color: rgb(0, 0, 255);"><br />0</span>]);<br />                 <b>return</b> -<span style="color: rgb(0, 0, 255);">1</span>;<br />         }<br /><br />        pipeline = gst_pipeline_new (<span style="color: rgb(221, 0, 0);">"app"</span>);<br />        <br />        src = gst_element_factory_make_or_warn (SOURCE, <span style="color: rgb(221, 0, 0);">"src"</span>);<br />        g_object_set (G_OBJECT (src), <span style="color: rgb(221, 0, 0);">"location"</span>, argv[<span style="color: rgb(0, 0, 255);">1</span>], NULL);<br />        <br />        <span style="color: rgb(128, 128, 128);"><i>//demux = gst_element_factory_make_or_warn ("mpegdemux",
"demux");</i></span><br />        demux = gst_element_factory_make_or_warn (<span style="color: rgb(221, 0, 0);">"ffdemux_mpegts"</span>, <span style="color: rgb(221, 0, 0);">"demux"</span>);<br />        <br />        gst_bin_add (GST_BIN (pipeline), src);<br />        gst_bin_add (GST_BIN (pipeline), demux);<br />        gst_element_link (src, demux);<br />        <br />        audio_bin = gst_bin_new (<span style="color: rgb(221, 0, 0);">"a_decoder_bin"</span>);<br />        a_decoder = gst_element_factory_make_or_warn (<span style="color: rgb(221, 0, 0);">"mad"</span>, <span style="color: rgb(221, 0, 0);">"a_dec"</span>);<br />        a_queue = gst_element_factory_make_or_warn (<span style="color: rgb(221, 0, 0);">"queue"</span>, <span style="color: rgb(221, 0, 0);">"a_queue"</span>);<br />        audiosink = gst_element_factory_make_or_warn (ASINK, <span style="color: rgb(221, 0, 0);">"a_sink"</span>);<br />        gst_bin_add (GST_BIN (audio_bin),
a_decoder);<br />        gst_bin_add (GST_BIN (audio_bin), a_queue);<br />        gst_bin_add (GST_BIN (audio_bin), audiosink);<br />        <br />        gst_element_link (a_decoder, a_queue);<br />        gst_element_link (a_queue, audiosink);<br />        <br />        gst_bin_add (GST_BIN (pipeline), audio_bin);<br />        <br />        pad = gst_element_get_pad (a_decoder, <span style="color: rgb(221, 0, 0);">"sink"</span>);<br />        gst_element_add_pad (audio_bin, gst_ghost_pad_new (<span style="color: rgb(221, 0, 0);">"sink"</span>, pad));<br />        gst_object_unref (pad);<br />        <br />        setup_dynamic_link (demux, <span style="color: rgb(221, 0, 0);">"audio_c0"</span>, gst_element_get_pad (audio_bin,<br />                <span style="color: rgb(221, 0, 0);">"sink"</span>), NULL);<br />        <br />        video_bin = gst_bin_new (<span style="color: rgb(221, 0, 0);">"v_decoder_bin"</span>);<br />        v_decoder = gst_element_factory_make_or_warn (<span style="color: rgb(221, 0, 0);">"mpeg2dec"</span>, <span
style="color: rgb(221, 0, 0);">"v_dec"</span>);<br />        v_queue = gst_element_factory_make_or_warn (<span style="color: rgb(221, 0, 0);">"queue"</span>, <span style="color: rgb(221, 0, 0);">"v_queue"</span>);<br />        v_scale = gst_element_factory_make_or_warn (<span style="color: rgb(221, 0, 0);">"videoscale"</span>, <span style="color: rgb(221, 0, 0);">"v_scale"</span>);<br />        v_filter = gst_element_factory_make_or_warn (<span style="color: rgb(221, 0, 0);">"ffmpegcolorspace"</span>, <span style="color: rgb(221, 0, 0);">"v_filter"</span>);<br />        videosink = gst_element_factory_make_or_warn (VSINK, <span style="color: rgb(221, 0, 0);">"v_sink"</span>);<br />        <br />        gst_bin_add (GST_BIN (video_bin), v_decoder);<br />        gst_bin_add (GST_BIN (video_bin), v_queue);<br />        gst_bin_add (GST_BIN (video_bin), v_scale);<br />        gst_bin_add (GST_BIN (video_bin), v_filter);<br />        gst_bin_add (GST_BIN (video_bin),
videosink);<br />        <br />        gst_element_link (v_decoder, v_queue);<br />        gst_element_link (v_queue, v_scale);<br />        gst_element_link (v_scale, v_filter);<br />        gst_element_link (v_filter, videosink);<br />        <br />        gst_bin_add (GST_BIN (pipeline), video_bin);<br />        <br />        pad = gst_element_get_pad (v_decoder, <span style="color: rgb(221, 0, 0);">"sink"</span>);<br />        gst_element_add_pad (video_bin, gst_ghost_pad_new (<span style="color: rgb(221, 0, 0);">"sink"</span>, pad));<br />        gst_object_unref (pad);<br />        <br />        setup_dynamic_link (demux, <span style="color: rgb(221, 0, 0);">"video_e0"</span>, gst_element_get_pad (video_bin,<br />                <span style="color: rgb(221, 0, 0);">"sink"</span>), NULL);<br />        <br />        /*seekable = gst_element_get_pad (v_filter, <span style="color: rgb(221, 0, 0);">"src"</span>);<br />        seekable_pads = g_list_prepend (seekable_pads, seekable);<br />        rate_pads = g_list_prepend (rate_pads, seekable);<br />        
rate_pads =<br />        g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, <span style="color: rgb(221, 0, 0);">"sink"</span>));*/<br /><br />        bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br />         gst_bus_add_watch (bus, bus_call, loop);<br />          <br />        gst_element_set_state (pipeline, GST_STATE_PLAYING);<br />        <span style="color: rgb(128, 128, 128);"><i>/* now run */</i></span><br />        g_main_loop_run (loop);<br /><br />        gst_element_set_state (pipeline, GST_STATE_NULL);<br />         gst_object_unref (GST_OBJECT (pipeline));<br />        gst_object_unref (bus);<br />         exit (<span style="color: rgb(0, 0, 255);">0</span>);<br />}<br /><br /><span style="color: rgb(0, 128, 0);"></span></pre>Can anyone tell me what can be the cause of this.<br /><br />Thanks in advance.<br /><p>-------------------------------------------------------------------------<br />This SF.net email is sponsored by: Microsoft<br />Defy all challenges. Microsoft(R) Visual Studio 2005.<br
/>http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________<br />gstreamer-devel mailing list<br />gstreamer-devel@lists.sourceforge.net<br />https://lists.sourceforge.net/lists/listinfo/gstreamer-devel<br /></p></blockquote><p><hr><font size=2 face=geneva><b>Join Excite! - <a href=http://www.excite.com target=_blank>http://www.excite.com</a></b><br>The most personalized portal on the Web!</font>