[gst-devel] Change File Locations for Container Formats that Have Headers

Wesley J. Miller WMiller at sdr.com
Fri Jul 9 17:48:16 CEST 2010

Here is what i have gathered is supposed to happen to accomplish changing filesink output file locations in a running pipeline.

The pipeline ends with "...!  queue2 name="q1"  ! matroksamux  name-mux ! filesink name="fsink" "
                                           I build mine using gst_parse_launch()

  -  The pipeline is in GST_STATE_PLAYING.
  -  The g_main_loop is running.
  -  The first location output file is being filled with data.
  -  There is a callback for bus messages.

When it comes time to swap output files:   (for me this is in a timer callbak)
  -  block the src pad of q1

           q1_srcpad =   gst_element_get_static_pad( q1, "src" );
           rc = gst_pad_set_blocked_async( q1_srcpad, true, Q1Blocked, NULL );

in the callback Q1Blocked()
  -  send an EOS to mux
  -  This should pass down to fsink and cause t he mux to write its headers/trailers

          rc = gst_element_send_event( mux, gst_event_new_eos() );

in the bus messages callback handler, bus_call():
  -  detect we got the EOS
  -  set mux and fsink to GST_STATE_NULL
  -  change the location
  -  unblock the q1 src pad

          case GST_MESSAGE_EOS:
             rc = gst_element_set_state( mux,  GST_STATE_NULL );
             rc = gst_element_set_state( sink, GST_STATE_NULL );
             g_object_set( G_OBJECT( sink ), "location", newOutFileName, NULL );
             gst_pad_set_blocked_async( that->q1src, false, Q1UnBlocked, NULL );

in Q1UnBlocked() callback handler:
  -  return mux and fsink to GST_SATE_PLAYING

         rc = gst_element_set_state( mux,   GST_STATE_PLAYING );
         rc = gst_element_set_state( fsink,  GST_STATE_PLAYING );

And that's where I run into a brick wall.  The rc from setting fsink to GST_STATE_PLAYING is 2,  GST_STATE_CHANGE_ASYNC.

Why does filesink not return to playing?  Does setting it to STATE_NULL mean that it disconnects from the mux?  The mux src pad is an always pad and so is the filesink sink pad.  Is the mux unlinked from the queue?

Many thanks,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20100709/520d8ccb/attachment.htm>

More information about the gstreamer-devel mailing list