[gst-devel] how to let the flag "resend-latest" work in output-selector ?

chen rui rui.chen at tieto.com
Wed Dec 29 08:18:05 CET 2010


Hi all,

I modify the example in 
gst-plugins-bad/tests/icles/output-selector-test.c and create new 
pieline like this:
                                                    filesink
                                                 /
  videotestsrc -- output-selector
                                                 \
                                                    autovideosink

I think if i set "resend-latest" flag to TRUE, when i play my file, it 
will fluency. But it does not, the same as resend-latest = FALSE. So how 
to use let the flag work?


here is my test base on output-selector-test.c
--- test.c    2010-12-29 14:39:27.875179000 +0800
+++ ../gst-plugins-bad/tests/icles/output-selector-test.c    2010-12-23 
13:52:09.355683000 +0800
@@ -75,7 +75,7 @@
  gint
  main (gint argc, gchar * argv[])
  {
-  GstElement *pipeline, *src, *toverlay, *osel, *sink1, *sink2, *c1, 
*c2, *c0, *jpegenc, *avi, *filesink;
+  GstElement *pipeline, *src, *toverlay, *osel, *sink1, *sink2, *c1, 
*c2, *c0;
    GstPad *sinkpad;
    GstBus *bus;

@@ -93,30 +93,28 @@
    c2 = gst_element_factory_make ("ffmpegcolorspace", NULL);
    sink1 = gst_element_factory_make ("autovideosink", "sink1");
    sink2 = gst_element_factory_make ("autovideosink", "sink2");
-  avi = gst_element_factory_make ("avimux", NULL);
-  filesink = gst_element_factory_make ("filesink", NULL);
-  jpegenc = gst_element_factory_make ("jpegenc", NULL);

    if (!pipeline || !src || !c0 || !toverlay || !osel || !c1 || !c2 || 
!sink1 ||
-      !sink2 || !avi || !filesink || !jpegenc ) {
+      !sink2) {
      g_print ("missing element\n");
      return -1;
    }

    /* add them to bin */
    gst_bin_add_many (GST_BIN (pipeline), src, c0, toverlay, osel, c1, 
sink1, c2,
-          jpegenc, avi, filesink, NULL);
+      sink2, NULL);

    /* set properties */
    g_object_set (G_OBJECT (src), "is-live", TRUE, NULL);
    g_object_set (G_OBJECT (src), "do-timestamp", TRUE, NULL);
    g_object_set (G_OBJECT (src), "num-buffers", NUM_VIDEO_BUFFERS, NULL);
    g_object_set (G_OBJECT (osel), "resend-latest",  TRUE, NULL);
-  g_object_set (G_OBJECT (filesink), "location", "test.avi", NULL);

    /* handle deferred properties */
    g_signal_connect (G_OBJECT (sink1), "element-added",
        G_CALLBACK (on_bin_element_added), NULL);
+  g_signal_connect (G_OBJECT (sink2), "element-added",
+      G_CALLBACK (on_bin_element_added), NULL);

    /* link src ! timeoverlay ! osel */
    if (!gst_element_link_many (src, c0, toverlay, osel, NULL)) {
@@ -147,7 +145,7 @@
    }
    gst_object_unref (sinkpad);

-  if (!gst_element_link_many (c2, jpegenc, avi, filesink, NULL)) {
+  if (!gst_element_link (c2, sink2)) {
      g_print ("linking output 2 failed\n");
      return -1;
    }


B.R

Chen Rui




More information about the gstreamer-devel mailing list