Commit 8d523f9a authored by Andrew Voznytsa's avatar Andrew Voznytsa

Remove not needed parse element for file recording

parent 07e26df1
......@@ -911,12 +911,11 @@ VideoReceiver::startRecording(const QString &videoFile)
_sink = new Sink();
_sink->teepad = gst_element_get_request_pad(_tee, "src_%u");
_sink->queue = gst_element_factory_make("queue", nullptr);
_sink->parse = gst_element_factory_make(_parserName, nullptr);
_sink->mux = gst_element_factory_make(kVideoMuxes[muxIdx], nullptr);
_sink->filesink = gst_element_factory_make("filesink", nullptr);
_sink->removing = false;
if(!_sink->teepad || !_sink->queue || !_sink->mux || !_sink->filesink || !_sink->parse) {
if(!_sink->teepad || !_sink->queue || !_sink->mux || !_sink->filesink) {
qCritical() << "VideoReceiver::startRecording() failed to make _sink elements";
return;
}
......@@ -937,15 +936,13 @@ VideoReceiver::startRecording(const QString &videoFile)
qCDebug(VideoReceiverLog) << "New video file:" << _videoFile;
gst_object_ref(_sink->queue);
gst_object_ref(_sink->parse);
gst_object_ref(_sink->mux);
gst_object_ref(_sink->filesink);
gst_bin_add_many(GST_BIN(_pipeline), _sink->queue, _sink->parse, _sink->mux, nullptr);
gst_element_link_many(_sink->queue, _sink->parse, _sink->mux, nullptr);
gst_bin_add_many(GST_BIN(_pipeline), _sink->queue, _sink->mux, nullptr);
gst_element_link_many(_sink->queue, _sink->mux, nullptr);
gst_element_sync_state_with_parent(_sink->queue);
gst_element_sync_state_with_parent(_sink->parse);
gst_element_sync_state_with_parent(_sink->mux);
// Install a probe on the recording branch to drop buffers until we hit our first keyframe
......@@ -999,7 +996,6 @@ void
VideoReceiver::_shutdownRecordingBranch()
{
gst_bin_remove(GST_BIN(_pipelineStopRec), _sink->queue);
gst_bin_remove(GST_BIN(_pipelineStopRec), _sink->parse);
gst_bin_remove(GST_BIN(_pipelineStopRec), _sink->mux);
gst_bin_remove(GST_BIN(_pipelineStopRec), _sink->filesink);
......@@ -1008,12 +1004,10 @@ VideoReceiver::_shutdownRecordingBranch()
_pipelineStopRec = nullptr;
gst_element_set_state(_sink->filesink, GST_STATE_NULL);
gst_element_set_state(_sink->parse, GST_STATE_NULL);
gst_element_set_state(_sink->mux, GST_STATE_NULL);
gst_element_set_state(_sink->queue, GST_STATE_NULL);
gst_object_unref(_sink->queue);
gst_object_unref(_sink->parse);
gst_object_unref(_sink->mux);
gst_object_unref(_sink->filesink);
......@@ -1038,7 +1032,7 @@ VideoReceiver::_detachRecordingBranch(GstPadProbeInfo* info)
Q_UNUSED(info)
// Also unlinks and unrefs
gst_bin_remove_many(GST_BIN(_pipeline), _sink->queue, _sink->parse, _sink->mux, _sink->filesink, nullptr);
gst_bin_remove_many(GST_BIN(_pipeline), _sink->queue, _sink->mux, _sink->filesink, nullptr);
// Give tee its pad back
gst_element_release_request_pad(_tee, _sink->teepad);
......@@ -1048,8 +1042,8 @@ VideoReceiver::_detachRecordingBranch(GstPadProbeInfo* info)
_pipelineStopRec = gst_pipeline_new("pipeStopRec");
// Put our elements from the recording branch into the temporary pipeline
gst_bin_add_many(GST_BIN(_pipelineStopRec), _sink->queue, _sink->parse, _sink->mux, _sink->filesink, nullptr);
gst_element_link_many(_sink->queue, _sink->parse, _sink->mux, _sink->filesink, nullptr);
gst_bin_add_many(GST_BIN(_pipelineStopRec), _sink->queue, _sink->mux, _sink->filesink, nullptr);
gst_element_link_many(_sink->queue, _sink->mux, _sink->filesink, nullptr);
// Add handler for EOS event
GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(_pipelineStopRec));
......
......@@ -103,7 +103,6 @@ protected:
GstElement* queue;
GstElement* mux;
GstElement* filesink;
GstElement* parse;
gboolean removing;
} Sink;
......@@ -153,7 +152,5 @@ protected:
bool _videoRunning;
bool _showFullScreen;
VideoSettings* _videoSettings;
const char* _depayName;
const char* _parserName;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment