This post was updated on .
For testing whether fakesrc is working correctly in my arm board, I needed to test some of its properties. To start with, I took the common test application found in web for fakesrc. [ Below] . I expected it to show black and white images. On execution, nothing was displayed. No errors as well. The print <<< ------------ In cb_handoff >>>> also didnt come. Is there something I missed.?
Thanks for your time. #include <string.h> /* for memset () */ #include <gst/gst.h> static void cb_handoff (GstElement *fakesrc, GstBuffer *buffer, GstPad *pad, gpointer user_data) { static gboolean white = FALSE; printf("\n ------------ In cb_handoff \n"); /* this makes the image black/white */ memset (GST_BUFFER_DATA (buffer), white ? 0xff : 0x0, GST_BUFFER_SIZE (buffer)); white = !white; } gint main (gint argc, gchar *argv[]) { GstElement *pipeline, *fakesrc, *flt, *conv, *videosink; GMainLoop *loop; /* init GStreamer */ gst_init (&argc, &argv); loop = g_main_loop_new (NULL, FALSE); /* setup pipeline */ pipeline = gst_pipeline_new ("pipeline"); fakesrc = gst_element_factory_make ("fakesrc", "source"); flt = gst_element_factory_make ("capsfilter", "flt"); conv = gst_element_factory_make ("ffmpegcolorspace", "conv"); videosink = gst_element_factory_make ("xvimagesink", "videosink"); /* setup */ g_object_set (G_OBJECT (flt), "caps", gst_caps_new_simple ("video/x-raw-rgb", "width", G_TYPE_INT, 384, "height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 1, 1, "bpp", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL), NULL); gst_bin_add_many (GST_BIN (pipeline), fakesrc, flt, conv, videosink, NULL); gst_element_link_many (fakesrc, flt, conv, videosink, NULL); /* setup fake source */ g_object_set (G_OBJECT (fakesrc), "signal-handoffs", TRUE, "sizemax", 384 * 288 * 2, "sizetype", 2, NULL); g_signal_connect (fakesrc, "handoff", G_CALLBACK (cb_handoff), NULL); /* play */ gst_element_set_state (pipeline, GST_STATE_PLAYING); g_main_loop_run (loop); /* clean up */ gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (GST_OBJECT (pipeline)); return 0; } |
Why don't you try making the same pipeline with gst-launch command and
see if it works? You can enable debugs and see whats going wrong. It'll be quite fast to test too. HTH, -mandeep On Wed, Nov 28, 2012 at 4:41 PM, deepthips <[hidden email]> wrote: > For testing whether fakesrc is working correctly in my arm board, I needed to > test some of its properties. To start with, I took the common test > application found in web for fakesrc. [ Below] . But I expected it to show > black and white images. Nothing came. The print <<< ------------ In > cb_handoff >>>> also didnt come. Is there something I missed.? > Thanks for your time. > > > > > > #include <string.h> /* for memset () */ > #include <gst/gst.h> > > static void > cb_handoff (GstElement *fakesrc, > GstBuffer *buffer, > GstPad *pad, > gpointer user_data) > { > static gboolean white = FALSE; > printf("\n ------------ In cb_handoff \n"); > > /* this makes the image black/white */ > memset (GST_BUFFER_DATA (buffer), white ? 0xff : 0x0, > GST_BUFFER_SIZE (buffer)); > white = !white; > } > > gint > main (gint argc, > gchar *argv[]) > { > GstElement *pipeline, *fakesrc, *flt, *conv, *videosink; > GMainLoop *loop; > > /* init GStreamer */ > gst_init (&argc, &argv); > loop = g_main_loop_new (NULL, FALSE); > > /* setup pipeline */ > pipeline = gst_pipeline_new ("pipeline"); > fakesrc = gst_element_factory_make ("fakesrc", "source"); > flt = gst_element_factory_make ("capsfilter", "flt"); > conv = gst_element_factory_make ("ffmpegcolorspace", "conv"); > videosink = gst_element_factory_make ("xvimagesink", "videosink"); > > /* setup */ > g_object_set (G_OBJECT (flt), "caps", > gst_caps_new_simple ("video/x-raw-rgb", > "width", G_TYPE_INT, 384, > "height", G_TYPE_INT, 288, > "framerate", GST_TYPE_FRACTION, 1, 1, > "bpp", G_TYPE_INT, 16, > "depth", G_TYPE_INT, 16, > "endianness", G_TYPE_INT, G_BYTE_ORDER, > NULL), NULL); > gst_bin_add_many (GST_BIN (pipeline), fakesrc, flt, conv, videosink, > NULL); > gst_element_link_many (fakesrc, flt, conv, videosink, NULL); > > /* setup fake source */ > g_object_set (G_OBJECT (fakesrc), > "signal-handoffs", TRUE, > "sizemax", 384 * 288 * 2, > "sizetype", 2, NULL); > g_signal_connect (fakesrc, "handoff", G_CALLBACK (cb_handoff), NULL); > > /* play */ > gst_element_set_state (pipeline, GST_STATE_PLAYING); > g_main_loop_run (loop); > > /* clean up */ > gst_element_set_state (pipeline, GST_STATE_NULL); > gst_object_unref (GST_OBJECT (pipeline)); > > return 0; > } > > > > > > > -- > View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Fakesrc-not-working-as-exected-tp4657100.html > Sent from the GStreamer-devel mailing list archive at Nabble.com. > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Thanks.. I checked with gst-launch and found that actually my "xvimagesink" is having problems. Since I dont want to debug that issue, I proceeded with plugins which I know are working in my board. So I tried to play an ac3 file using fakesrc. Normally this will work filesrc -> ac3parse -> myaudiosink . So I tried the same here with fakesrc. myaudiosink is proprietary plugin with audio decoder + sink. But no audio was heard and it didnt give any error as well. I couldnt try with gst-launch coz I dont know how to set the data to buffer from command line. Any help on this.?
#include <string.h> /* for memset () */ #include <gst/gst.h> guint8 *data = NULL; static void cb_handoff (GstElement *fakesrc, GstBuffer *buffer, GstPad *pad, gpointer user_data) { /* Clip start and end */ data = (guint8 *) g_malloc (3000); GST_BUFFER_SIZE (buffer) = 3000; GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer) = data; FILE* fp = fopen("backup.ac3","rb"); if(fp == NULL) { printf( " File is not opened \n"); return; } fread(data,3000,1,fp); fclose(fp); } gint main (gint argc, gchar *argv[]) { GstElement *pipeline, *fakesrc, *parse, *audiosink; GMainLoop *loop; /* init GStreamer */ gst_init (&argc, &argv); loop = g_main_loop_new (NULL, FALSE); /* setup pipeline */ pipeline = gst_pipeline_new ("pipeline"); fakesrc = gst_element_factory_make ("fakesrc", "source"); parse = gst_element_factory_make ("ac3parse", "parser"); audiosink = gst_element_factory_make ("myaudiosink", "audiosink"); /* setup */ gst_bin_add_many (GST_BIN (pipeline), fakesrc, parse, audiosink, NULL); gst_element_link_many (fakesrc, parse, audiosink, NULL); /* setup fake source */ g_object_set (G_OBJECT (fakesrc), "signal-handoffs", TRUE, "sizemax", 16000, "sizetype", 2, NULL); g_signal_connect (fakesrc, "handoff", G_CALLBACK (cb_handoff), NULL); /* play */ gst_element_set_state (pipeline, GST_STATE_PLAYING); g_main_loop_run (loop); /* clean up */ gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (GST_OBJECT (pipeline)); return 0; } |
On Wed, 2012-11-28 at 05:00 -0800, deepthips wrote:
> Thanks.. I checked with gst-launch and found that actually my "xvimagesink" > is having problems. Since I dont want to debug that issue, I proceeded with > plugins which I know are working in my board. So I tried to play an ac3 file > using fakesrc. Normally this will work filesrc -> ac3parse -> myaudiosink . > So I tried the same here with fakesrc. myaudiosink is proprietary plugin > with audio decoder + sink. But no audio was heard and it didnt give any > error as well. I couldnt try with gst-launch coz I dont know how to set the > data to buffer from command line. Any help on this. xvimagesink might not be able to handle video/x-raw-rgb, but only video/x-raw-yuv. Why use fakesrc instead of just: filesrc location=backup.ac3 ! ac3parse ! youraudiosink (I assume youraudiosink accepts coded AC-3 frames?) or videotetsrc ! xvimagesink Cheers -Tim > #include <string.h> /* for memset () */ > #include <gst/gst.h> > > guint8 *data = NULL; > > static void > cb_handoff (GstElement *fakesrc, > GstBuffer *buffer, > GstPad *pad, > gpointer user_data) > { > /* Clip start and end */ > > data = (guint8 *) g_malloc (3000); > GST_BUFFER_SIZE (buffer) = 3000; > GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer) = data; > > FILE* fp = fopen("backup.ac3","rb"); > if(fp == NULL) > { > printf( " File is not opened \n"); > return; > } > fread(data,3000,1,fp); > > fclose(fp); > > } > > > gint > main (gint argc, > gchar *argv[]) > { > GstElement *pipeline, *fakesrc, *parse, *audiosink; > GMainLoop *loop; > > /* init GStreamer */ > gst_init (&argc, &argv); > loop = g_main_loop_new (NULL, FALSE); > > /* setup pipeline */ > pipeline = gst_pipeline_new ("pipeline"); > fakesrc = gst_element_factory_make ("fakesrc", "source"); > parse = gst_element_factory_make ("ac3parse", "parser"); > audiosink = gst_element_factory_make ("myaudiosink", "audiosink"); > > /* setup */ > gst_bin_add_many (GST_BIN (pipeline), fakesrc, parse, audiosink, NULL); > gst_element_link_many (fakesrc, parse, audiosink, NULL); > > /* setup fake source */ > g_object_set (G_OBJECT (fakesrc), > "signal-handoffs", TRUE, > "sizemax", 16000, > "sizetype", 2, NULL); > g_signal_connect (fakesrc, "handoff", G_CALLBACK (cb_handoff), NULL); > > /* play */ > gst_element_set_state (pipeline, GST_STATE_PLAYING); > g_main_loop_run (loop); > > /* clean up */ > gst_element_set_state (pipeline, GST_STATE_NULL); > gst_object_unref (GST_OBJECT (pipeline)); > > return 0; > } > > > > > -- > View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Fakesrc-not-working-as-exected-tp4657100p4657102.html > Sent from the GStreamer-devel mailing list archive at Nabble.com. > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Wednesday, November 28, 2012, Tim-Philipp Müller wrote: On Wed, 2012-11-28 at 05:00 -0800, deepthips wrote: Is your audio sink configured properly to send output to the correct output port and in the correct format, eh is the sink's output in PCM format etc. check its properties thru gst-inspect
> error as well. I couldnt try with gst-launch coz I dont know how to set the You can try putting a queue element in-between and see. HTH, -mandeep
_______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |