gst-launch works but application does not

art vanderhoff gstream at ccc2.com
Fri Feb 3 19:23:37 PST 2012


Hello,

Can you please give me some advice on why the below launch pipeline works
but the application does not.

In the application the first filesrc starts to play but the output file does
not rcv anything. the decoder callback indicates the pad is set so input
looks ok.

Thanks
Art.


gst-launch-0.10 version 0.10.35
GStreamer 0.10.35
Debian squeeze amd64
---------------
gst-launch \
-v filesrc location=/home/fifo/mpegpipe1.yuv ! \
decodebin2 ! \
ffmpegcolorspace ! \
videoscale ! \
capsfilter 
caps="video/x-raw-yuv,format=(fourcc)I420,width=384,height=216,framerate=(fraction)25/1" 
! \
filesink  location=/home/fifo/mpegpipe2.yuv
------------


------------
#include <gst/gst.h>
#include <glib.h>

static void
on_pad_added (GstElement *element,
              GstPad     *pad,
              gpointer    data)
{
  GstPad *sinkpad;
  GstElement *decoder = (GstElement *) data;

 g_print ("Dynamic pad created, linking out/in \n");

 sinkpad = gst_element_get_static_pad (decoder, "sink");

  gst_pad_link (pad, sinkpad);

  gst_object_unref (sinkpad);
}

int
main (int   argc,
      char *argv[])
{
  GMainLoop *loop;
  gboolean link_ok;

  GstElement *pipeline, *source, *decoder, *ffcs, *vidsc, *capsfout, *sink;
  GstBus *bus;
  GstCaps *filtercaps;


  /* Initialisation */
  gst_init (&argc, &argv);

  loop = g_main_loop_new (NULL, FALSE);

  /* Create gstreamer elements */
  pipeline = gst_pipeline_new ("video-player");
  source   = gst_element_factory_make ("filesrc",       	"source");
  decoder  = gst_element_factory_make ("decodebin2",    	"decoder");
  ffcs     = gst_element_factory_make ("ffmpegcolorspace", 	"ffcs");
  vidsc    = gst_element_factory_make ("videoscale", 		"vidsc");
  capsfout = gst_element_factory_make ("capsfilter", 		"capsfout");
  sink     = gst_element_factory_make ("filesink", 			"sink");

  if (!pipeline || !source || !decoder || !ffcs || !vidsc || !capsfout ||
!sink) {
    g_printerr ("One element could not be created. Exiting.\n");
    return -1;
  }


  g_object_set (G_OBJECT (source), "location", argv[1], NULL);
  g_object_set (G_OBJECT (sink), "location", argv[2], NULL);

  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));

  gst_bin_add_many (GST_BIN (pipeline),
                    source, decoder, ffcs, vidsc, capsfout, sink, NULL);

  gst_element_link_many ( source, decoder, ffcs, vidsc, capsfout, sink, 
NULL);

  g_signal_connect (decoder, "pad-added", G_CALLBACK (on_pad_added),
decoder);

 filtercaps = gst_caps_new_simple("video/x-raw-yuv",
	      	  	  	  "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2',
'0'),
	       	  	  	  "width", G_TYPE_INT, 384,
		    	      "height", G_TYPE_INT, 216,
		    	      "framerate", GST_TYPE_FRACTION, 25, 1,
		    	      NULL);

  g_object_set (G_OBJECT (capsfout), "caps", filtercaps, NULL);
        gst_caps_unref (filtercaps);


  /* Set the pipeline to "playing" state*/
  g_print ("Now playing: %s\n", argv[1]);
  gst_element_set_state (pipeline, GST_STATE_PLAYING);


  /* Iterate */
  g_print ("Running...\n");
  g_main_loop_run (loop);


  /* Out of the main loop, clean up nicely */
  g_print ("Returned, stopping playback\n");
  gst_element_set_state (pipeline, GST_STATE_NULL);

  g_print ("Deleting pipeline\n");
  gst_object_unref (GST_OBJECT (pipeline));

  return 0;
}

------------------
compiled with 
gcc -Wall helloWorld.c -o helloWorld $(pkg-config --cflags --libs
gstreamer-0.10)



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/gst-launch-works-but-application-does-not-tp4356468p4356468.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list