Controlled shutdown of live sources in applications
应用中直播流的停止控制Applications that record from a live source may want to stop recording in a controlled way, so that the recording is stopped, but the data already in the pipeline is processed to the end (remember that many live sources would go on recording forever otherwise). For that to happen the application needs to make the source stop recording and send an EOS event down the pipeline. The application would then wait for an EOS message posted on the pipeline's bus to know when all data has been processed and the pipeline can safely be stopped.
Since GStreamer 0.10.16 an application may send an EOS event to a source element to make it perform the EOS logic (send EOS event downstream or post a GST_MESSAGE_SEGMENT_DONE on the bus). This can typically be donewith the gst_element_send_event()
function on the element or its parent bin.
After the EOS has been sent to the element, the application should wait for an EOS message to be posted on the pipeline's bus. Once this EOS message isreceived, it may safely shut down the entire pipeline.