Queries on how to stop and restart GstSplitMuxSink

Howling wong watertreader at hotmail.com
Tue Apr 5 08:12:25 UTC 2022


Hi

I have some queries as with regards to how to stop the GstSplitMuxSink


  1.  Stopping it. I have split the files to be saved (each of 5 mins). The result is ok for the video files fulfilling the 5 mins interval but the last video (which is less than 5 mins) has size of 0 bytes. Nothing is being saved to it.

           I read up the forum to find that I would need to send eos event to the splitmuxsink when I want to stop it.                        Somehow or rather I could not get it right. Would like some pointers on how to stop (any additional stuff needs to            be done

          My source code(or pseudo code) below

         GstPadProbeReturn
         eos_cb(GstPad *pad, GstPadProbeInfo * info, gpointer user_data)
        {
               // blocking codes
               while(GST_EVENT_TYPE (GST_PAD_PROBE_INFO_DATA (info)) != GST_EVENT_EOS)
                         sleep(1);
               g_print("thread live: pad received eos \n");

               return GST_PAD_PROBE_REMOVE;
         }

        int main()
        {

         /*******************   do something   ************************/

         case RECORD_STOP:
                   GstPad* splitMuxPad = gst_element_get_static_pad(records->fsink, "video");
                  if (!splitMuxPad && !(records->fsink))
                  {
                            g_critical(" Could not obtain the splitmux and records->fsink sinkpad!!\n"); // <---- fails here!
                           exit(-1);
                   }

                  gst_pad_add_probe(splitMuxPad,
                                                      (GstPadProbeType)(GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM),
                                                      eos_cb,
                                                       NULL,
                                                      NULL);

                    // should i send eos event to splitmuxsink or the pad?
                     gst_pad_send_event(splitMuxPad, gst_event_new_eos());

                     gst_object_unref(splitMuxPad);

                   /****
                          Proceed on detaching other parts of the record bin
                   *****/

             }

       2. To start another cycle of recording and stop recording. The "working" method seem to be to destroy or unreference the Splitmuxsink and recreate splitmuxsink upon starting the recording. Is this true? Find it rather strange.

Thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220405/f41daba6/attachment.htm>


More information about the gstreamer-devel mailing list