Cleanup gst_element_get_state

This commit is contained in:
Bruno Herbelin
2021-12-31 13:12:12 +01:00
parent 033d41863a
commit 0e9984827a

View File

@@ -470,14 +470,13 @@ void MediaPlayer::close()
if (pipeline_ != nullptr) { if (pipeline_ != nullptr) {
// force flush // force flush
GstState state;
gst_element_send_event(pipeline_, gst_event_new_seek (1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, gst_element_send_event(pipeline_, gst_event_new_seek (1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
GST_SEEK_TYPE_NONE, 0, GST_SEEK_TYPE_NONE, 0) ); GST_SEEK_TYPE_NONE, 0, GST_SEEK_TYPE_NONE, 0) );
gst_element_get_state (pipeline_, &state, NULL, GST_CLOCK_TIME_NONE); gst_element_get_state (pipeline_, NULL, NULL, GST_CLOCK_TIME_NONE);
// end pipeline // end pipeline
gst_element_set_state (pipeline_, GST_STATE_NULL); gst_element_set_state (pipeline_, GST_STATE_NULL);
gst_element_get_state (pipeline_, &state, NULL, GST_CLOCK_TIME_NONE); gst_element_get_state (pipeline_, NULL, NULL, GST_CLOCK_TIME_NONE);
gst_object_unref (pipeline_); gst_object_unref (pipeline_);
pipeline_ = nullptr; pipeline_ = nullptr;
@@ -992,8 +991,7 @@ void MediaPlayer::update()
// if already seeking (asynch) // if already seeking (asynch)
if (seeking_) { if (seeking_) {
// request status update to pipeline (re-sync gst thread) // request status update to pipeline (re-sync gst thread)
GstState state; gst_element_get_state (pipeline_, NULL, NULL, GST_CLOCK_TIME_NONE);
gst_element_get_state (pipeline_, &state, NULL, GST_CLOCK_TIME_NONE);
// seek should be resolved next frame // seek should be resolved next frame
seeking_ = false; seeking_ = false;
// do NOT do another seek yet // do NOT do another seek yet
@@ -1094,8 +1092,7 @@ void MediaPlayer::execute_seek_command(GstClockTime target, bool force)
// Force update // Force update
if (force) { if (force) {
GstState state; gst_element_get_state (pipeline_, NULL, NULL, GST_CLOCK_TIME_NONE);
gst_element_get_state (pipeline_, &state, NULL, GST_CLOCK_TIME_NONE);
force_update_ = true; force_update_ = true;
} }