Dynamically updating filesink location at run-time, on the fly

shakir shakirali2244 at yahoo.com
Tue Feb 21 21:53:16 UTC 2017


Hello Edward, 

I am trying the key-unit-event approach on my multifilesink branch of tee
element, however the files are not playable. I was wondering if you can
split files on user input. Broadly I am trying to have the recording
functionality parallel to playback

here is the snippet

------------------------------------------------------------------------------------------------------------------------
/* Create the elements */
   source = gst_element_factory_make ("udpsrc", "source");
   tee = gst_element_factory_make("tee", "t");
   mux  = gst_element_factory_make("matroskamux", "mux");
   dpl = gst_element_factory_make("rtph264depay", "dpl");
   parser = gst_element_factory_make("h264parse", "parser");
   valve = gst_element_factory_make("valve", "valve");

   //g_object_get (G_OBJECT (source), "port", &port, NULL);


     sink = gst_element_factory_make ("udpsink", "sink");
     sink2 = gst_element_factory_make ("multifilesink", "sink2");

      //g_object_get (G_OBJECT (sink), "port", &port2, NULL);
      //g_object_get (G_OBJECT (sink), "host", &host, NULL);
      if (!pipeline || !source || !sink) {
         if(!pipeline){
            GST_ERROR ("pipeline could be created.\n");
         }
         if(!source){
             GST_ERROR ("source could be created.\n");
          }
         if(!sink){
              GST_ERROR ("sink could be created.\n");
           }
           return;
        }

      /* Build the pipeline */
      gst_bin_add_many (GST_BIN (pipeline), source, dpl, parser, mux, tee,
valve, sink2, sink, NULL);
        if (gst_element_link (source, tee) != TRUE) {
            GST_ERROR ("source, tee could not be linked.\n");
            gst_object_unref (pipeline);
            return;
        }
        if (gst_element_link (tee, valve) != TRUE) {
            GST_ERROR ("source, tee could not be linked.\n");
            gst_object_unref (pipeline);
            return;
        }
        if (gst_element_link (tee, sink) != TRUE) {
            GST_ERROR ("tee, sink could not be linked.\n");
            gst_object_unref (pipeline);
            return;
        }
        if (gst_element_link (valve, dpl) != TRUE) {
            GST_ERROR ("tee, dpl could not be linked.\n");
            gst_object_unref (pipeline);
            return;
        }
        if (gst_element_link (dpl, parser) != TRUE) {
            GST_ERROR ("dpl, parser could not be linked.\n");
            gst_object_unref (pipeline);
            return;
        }
        if (gst_element_link (parser, mux) != TRUE) {
            GST_ERROR ("parser, mux sink could not be linked.\n");
            gst_object_unref (pipeline);
            return;
        }
        if (gst_element_link (mux, sink2) != TRUE) {
            GST_ERROR ("mux, sink2 could not be linked.\n");
            gst_object_unref (pipeline);
            return;
        }
        GST_ERROR ("Elements GOT LINKED.\n");
        g_object_set (valve, "drop", 0, NULL);
        g_object_set (source,"port", 4999,"caps", filtercaps, NULL);
        g_object_set (sink2, "location", pathto, "next-file", 3, 
"max-files" , 100, NULL);
.
.
.
static void gst_native_stop_recording (JNIEnv* env, jobject thiz) {

GstEvent* event = gst_video_event_new_downstream_force_key_unit
(GST_CLOCK_TIME_NONE,GST_CLOCK_TIME_NONE,GST_CLOCK_TIME_NONE, TRUE,
event_num);
  gst_event_ref(event);
  event_num++;
 gboolean tmp = gst_element_send_event(mux, event);

 if(tmp == TRUE){
    GST_DEBUG("WORKED");
    }
 else{
    GST_DEBUG("FAILED");
 }
  gst_event_unref(event);
}
.
.
.
------------------------------------------------------------------------------------------------------------------



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Dynamically-updating-filesink-location-at-run-time-on-the-fly-tp4660569p4681980.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list