[gst-devel] Avi decoder

StyveA styve.attia at gmail.com
Thu Feb 3 14:19:14 CET 2011


I really don't understand where is my error...
I've launch this line : 

gst-launch filesrc location=test.avi ! avidemux name=demux   demux.video_00 
! decodebin ! ffmpegcolorspace ! videoscale ! autovideosink

and my video works fine..

But when I do this : 
//-----------------------------CODE--------------
int main (int argc, char *argv[])
{
   GstElement *pipe,*src, *dec,*ffm,*scale, *sink;
   GstMessage *msg;
   gst_init (&argc, &argv);
 
      loop = g_main_loop_new (NULL, FALSE);
   if (argc < 2)
       g_error ("Usage: %s <path to file>", argv[0]);
   
   pipe = gst_pipeline_new ("pipeline");
   src = gst_element_factory_make ("filesrc", "src");
   gst_bin_add (GST_BIN (pipe), src);
   g_object_set (src, "location", argv[1], NULL); //essayer avec dec au lieu
de src
   dec = gst_element_factory_make ("decodebin", "decoder");
   gst_bin_add (GST_BIN (pipe), dec);
   ffm = gst_element_factory_make ("ffmpegcolorspace", NULL);
   gst_bin_add (GST_BIN (pipe), ffm);
   scale = gst_element_factory_make ("videoscale", NULL);
   gst_bin_add (GST_BIN (pipe), scale);
   sink = gst_element_factory_make ("autovideosink", "sink");
   gst_bin_add (GST_BIN (pipe), sink);
   g_signal_connect (dec, "pad-added", G_CALLBACK (on_new_pad), sink);
   
  gst_element_link_many (src,dec,ffm,scale,sink, NULL);
 
if(!pipe || !dec || !sink || !src || !scale || !ffm)
   g_print ("error...\n"); 
 
   gst_element_set_state (pipe, GST_STATE_PLAYING);
 
   g_print ("Running...\n");
   g_timeout_add (5000, get_me_out, NULL);
   g_main_loop_run (loop);
/* Out of the main loop, clean up nicely */
   g_print ("Returned, stopping playback\n");
   gst_element_set_state (pipe, GST_STATE_NULL);
   g_print ("Deleting pipeline\n");
   gst_object_unref (GST_OBJECT (pipe));
 
 
   return 0;
 
}
//-----------------------------END---------------

I have nothing that shows up ! Just the "running..." message, but no video.. 
I really don't get it..
-- 
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Avi-decoder-tp3248462p3258064.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list