first of all, you should used gst-launch in CMD to try if the pipeline woks or not<div>if so, I guess there 's something problem with decoder</div><div>As I counter this kind of situation like freezing, There must have been wrong with decoder, check it </div>
<div><div><br><div class="gmail_quote">On Mon, Aug 29, 2011 at 8:16 PM, akshat <span dir="ltr"><<a href="mailto:akshatdewan@gmail.com">akshatdewan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<br>
I am using gstreamerSDK(v0.10.6) on windowsXP. I am trying to play an .avi<br>
file but it stops playing the content within few seconds and does not play<br>
the file completely.<br>
I appreciate your help.<br>
<br>
Thanks<br>
Akshat<br>
<br>
code<br>
___________________________<br>
#include "stdafx.h"<br>
#include <windows.h><br>
#include <iostream><br>
#include &lt;gstreamer-0.10/gst/gst.h&gt;<br>
#include &lt;glib-2.0/glib.h&gt;<br>
#include "EmoStateDLL.h"<br>
#include "edk.h"<br>
#include "edkErrorCode.h"<br>
#include <time.h><br>
#include <fstream><br>
#include <map><br>
<br>
#pragma comment(lib, "edk.lib")<br>
using namespace std;<br>
<br>
<br>
static gboolean<br>
bus_call (GstBus *bus,<br>
GstMessage *msg,<br>
gpointer data)<br>
{<br>
GMainLoop *loop = (GMainLoop *)data;<br>
<br>
switch (GST_MESSAGE_TYPE (msg)) {<br>
case GST_MESSAGE_EOS:<br>
g_print ("End-of-stream\n");<br>
g_main_loop_quit (loop);<br>
break;<br>
case GST_MESSAGE_ERROR: {<br>
gchar *debug = NULL;<br>
GError *err = NULL;<br>
<br>
gst_message_parse_error (msg, &err, &debug);<br>
<br>
g_print ("Error: %s\n", err->message);<br>
g_error_free (err);<br>
<br>
if (debug) {<br>
g_print ("Debug details: %s\n", debug);<br>
g_free (debug);<br>
}<br>
<br>
g_main_loop_quit (loop);<br>
break;<br>
}<br>
default:<br>
break;<br>
}<br>
<br>
return TRUE;<br>
}<br>
<br>
static GstElement *pipeline,*filesrc, *avidemux, *hicon, *decodera,<br>
*audioconvert, *asink,<br>
*queuea, *queuev, *decoderv, *csc, *vscale, *vsink;<br>
<br>
static void on_decpad_added(GstElement *element, GstPad *pad )<br>
{<br>
g_debug ("Signal: decoder pad-added");<br>
GstCaps *caps;<br>
GstStructure *str;<br>
<br>
caps = gst_pad_get_caps (pad);<br>
g_assert (caps != NULL);<br>
str = gst_caps_get_structure (caps, 0);<br>
g_assert (str != NULL);<br>
<br>
g_debug ("Linking video pad to queue_vd");<br>
// Link it actually<br>
GstPad *targetsink = gst_element_get_pad (element == decodera ? queuea :<br>
queuev, "sink");<br>
g_assert (targetsink != NULL);<br>
gst_pad_link (pad, targetsink);<br>
<br>
gst_object_unref (targetsink);<br>
gst_caps_unref (caps);<br>
}<br>
<br>
static void on_pad_added (GstElement *element, GstPad *pad)<br>
{<br>
g_debug ("Signal: demux pad-added");<br>
GstCaps *caps;<br>
GstStructure *str;<br>
<br>
caps = gst_pad_get_caps (pad);<br>
g_assert (caps != NULL);<br>
str = gst_caps_get_structure (caps, 0);<br>
g_assert (str != NULL);<br>
<br>
const gchar *c = gst_structure_get_name(str);<br>
if (g_strrstr (c, "video") || g_strrstr (c, "image")) {<br>
g_debug ("Linking video pad to dec_vd");<br>
// Link it actually<br>
GstPad *targetsink = gst_element_get_pad (decoderv, "sink");<br>
g_assert (targetsink != NULL);<br>
gst_pad_link (pad, targetsink);<br>
gst_object_unref (targetsink);<br>
}<br>
<br>
if (g_strrstr (c, "audio")) {<br>
g_debug ("Linking audio pad to dec_ad");<br>
// Link it actually<br>
GstPad *targetsink = gst_element_get_pad (decodera, "sink");<br>
g_assert (targetsink != NULL);<br>
gst_pad_link (pad, targetsink);<br>
gst_object_unref (targetsink);<br>
}<br>
<br>
gst_caps_unref (caps);<br>
}<br>
<br>
void g_ass(gboolean b)<br>
{<br>
/* if(!b)g_debug("Error");<br>
else g_debug("OK");*/<br>
}<br>
<br>
gint<br>
main (gint argc,<br>
gchar *argv[])<br>
{<br>
GstStateChangeReturn ret;<br>
GMainLoop *loop;<br>
GstBus *bus;<br>
<br>
/* initialization */<br>
gst_init (&argc, &argv);<br>
loop = g_main_loop_new (NULL, FALSE);<br>
<br>
/*<br>
* command line:<br>
* gst-launch filesrc location=/home/neddens/r0013001.avi ! avidemux<br>
name=demux demux.audio_00 ! decodebin ! queue ! audioconvert !<br>
audioresample ! autoaudiosink demux.video_00 ! decodebin ! queue !<br>
ffmpegcolorspace ! videoscale ! autovideosink<br>
*<br>
*/<br>
<br>
<br>
/* create elements */<br>
pipeline = gst_pipeline_new ("pipeline0");<br>
<br>
/* watch for messages on the pipeline's bus (note that this will only<br>
* work like this when a GLib main loop is running) */<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>
filesrc = gst_element_factory_make ("filesrc", "filesource");<br>
avidemux = gst_element_factory_make ("avidemux", "dmux");<br>
decodera = gst_element_factory_make ("decodebin2", "decoder0");<br>
decoderv = gst_element_factory_make ("decodebin2", "decoder1");<br>
vscale = gst_element_factory_make ("videoscale", "Scaler");<br>
<br>
/* putting an audioconvert element here to convert the output of the<br>
* decoder into a format that my_filter can handle (we are assuming it<br>
* will handle any sample rate here though) */<br>
audioconvert = gst_element_factory_make ("audioconvert", "audioconvert1");<br>
queuea = gst_element_factory_make ("queue", "queue0");<br>
queuev = gst_element_factory_make ("queue", "queue1");<br>
<br>
/* there should always be audioconvert and audioresample elements before<br>
* the audio sink, since the capabilities of the audio sink usually vary<br>
* depending on the environment (output used, sound card, driver etc.) */<br>
//audioresample = gst_element_factory_make ("audioresample",<br>
"audioresample0");<br>
csc = gst_element_factory_make ("ffmpegcolorspace", "ffmpegcsp0");<br>
vsink = gst_element_factory_make ("autovideosink", "Video Renderer");<br>
asink = gst_element_factory_make ("autoaudiosink", "AudioSink");<br>
<br>
<br>
<br>
g_object_set (G_OBJECT (filesrc), "location", "3.avi", NULL);<br>
<br>
gst_bin_add_many (GST_BIN (pipeline), filesrc, avidemux, decodera,<br>
audioconvert, asink,csc,vscale,<br>
queuev, queuea, decoderv, vsink, NULL);<br>
<br>
<br>
g_ass(gst_element_link (filesrc, avidemux));<br>
g_ass(gst_element_link (queuev, csc));<br>
g_ass(gst_element_link (csc, vscale));<br>
g_ass(gst_element_link (vscale, vsink));<br>
<br>
g_ass(gst_element_link (queuea, audioconvert));<br>
g_ass(gst_element_link (audioconvert, asink));<br>
// g_ass(gst_element_link (audioresample, asink));<br>
<br>
g_signal_connect (avidemux, "pad-added", G_CALLBACK (on_pad_added), NULL);<br>
//gst_element_set_state (decodera, GST_STATE_PLAYING);<br>
//gst_element_set_state (decoderv, GST_STATE_PLAYING);<br>
g_signal_connect (decodera, "new-decoded-pad", G_CALLBACK<br>
(on_decpad_added), decodera);<br>
g_signal_connect (decoderv, "new-decoded-pad", G_CALLBACK<br>
(on_decpad_added), decoderv);<br>
<br>
/* run */<br>
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);<br>
if (ret == GST_STATE_CHANGE_FAILURE) {<br>
GstMessage *msg;<br>
<br>
g_print ("Failed to start up pipeline!\n");<br>
<br>
/* check if there is an error message with details on the bus */<br>
msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);<br>
if (msg) {<br>
GError *err = NULL;<br>
<br>
gst_message_parse_error (msg, &err, NULL);<br>
g_print ("ERROR: %s\n", err->message);<br>
g_error_free (err);<br>
gst_message_unref (msg);<br>
}<br>
return -1;<br>
}<br>
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(pipeline),<br>
GST_DEBUG_GRAPH_SHOW_ALL, "hi");<br>
g_main_loop_run (loop);<br>
<br>
/* clean up */<br>
gst_element_set_state (pipeline, GST_STATE_NULL);<br>
gst_object_unref (pipeline);<br>
<br>
return 0;<br>
}<br>
___________code end_________<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/gstreamer-stops-playing-the-media-content-tp3776067p3776067.html" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/gstreamer-stops-playing-the-media-content-tp3776067p3776067.html</a><br>
Sent from the GStreamer-devel mailing list archive at Nabble.com.<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</font></blockquote></div><br></div></div>