mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 02:40:00 +01:00
Finish Frame grabber after return on failed initialization
This commit is contained in:
@@ -178,7 +178,6 @@ std::string Loopback::init(GstCaps *caps)
|
|||||||
return std::string("Invalid caps");
|
return std::string("Invalid caps");
|
||||||
|
|
||||||
if (!Loopback::systemLoopbackInitialized()){
|
if (!Loopback::systemLoopbackInitialized()){
|
||||||
finished_ = true;
|
|
||||||
return std::string("Loopback system shall be initialized first.");
|
return std::string("Loopback system shall be initialized first.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +190,6 @@ std::string Loopback::init(GstCaps *caps)
|
|||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
std::string msg = std::string("Loopback : Could not construct pipeline ") + description + "\n" + std::string(error->message);
|
std::string msg = std::string("Loopback : Could not construct pipeline ") + description + "\n" + std::string(error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
finished_ = true;
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,14 +235,12 @@ std::string Loopback::init(GstCaps *caps)
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
finished_ = true;
|
|
||||||
return std::string("Loopback : Could not configure source.");
|
return std::string("Loopback : Could not configure source.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// start recording
|
// start recording
|
||||||
GstStateChangeReturn ret = gst_element_set_state (pipeline_, GST_STATE_PLAYING);
|
GstStateChangeReturn ret = gst_element_set_state (pipeline_, GST_STATE_PLAYING);
|
||||||
if (ret == GST_STATE_CHANGE_FAILURE) {
|
if (ret == GST_STATE_CHANGE_FAILURE) {
|
||||||
finished_ = true;
|
|
||||||
return std::string("Loopback : Could not open ") + Loopback::system_loopback_name;
|
return std::string("Loopback : Could not open ") + Loopback::system_loopback_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ std::string PNGRecorder::init(GstCaps *caps)
|
|||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
std::string msg = std::string("PNG Capture Could not construct pipeline ") + description + "\n" + std::string(error->message);
|
std::string msg = std::string("PNG Capture Could not construct pipeline ") + description + "\n" + std::string(error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
finished_ = true;
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,14 +101,12 @@ std::string PNGRecorder::init(GstCaps *caps)
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
finished_ = true;
|
|
||||||
return std::string("PNG Capture : Failed to configure frame grabber.");
|
return std::string("PNG Capture : Failed to configure frame grabber.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// start pipeline
|
// start pipeline
|
||||||
GstStateChangeReturn ret = gst_element_set_state (pipeline_, GST_STATE_PLAYING);
|
GstStateChangeReturn ret = gst_element_set_state (pipeline_, GST_STATE_PLAYING);
|
||||||
if (ret == GST_STATE_CHANGE_FAILURE) {
|
if (ret == GST_STATE_CHANGE_FAILURE) {
|
||||||
finished_ = true;
|
|
||||||
return std::string("PNG Capture : Failed to start frame grabber.");
|
return std::string("PNG Capture : Failed to start frame grabber.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +341,6 @@ std::string VideoRecorder::init(GstCaps *caps)
|
|||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
std::string msg = std::string("Video Recording : Could not construct pipeline ") + description + "\n" + std::string(error->message);
|
std::string msg = std::string("Video Recording : Could not construct pipeline ") + description + "\n" + std::string(error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
finished_ = true;
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,14 +391,12 @@ std::string VideoRecorder::init(GstCaps *caps)
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
finished_ = true;
|
|
||||||
return std::string("Video Recording : Failed to configure frame grabber.");
|
return std::string("Video Recording : Failed to configure frame grabber.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// start recording
|
// start recording
|
||||||
GstStateChangeReturn ret = gst_element_set_state (pipeline_, GST_STATE_PLAYING);
|
GstStateChangeReturn ret = gst_element_set_state (pipeline_, GST_STATE_PLAYING);
|
||||||
if (ret == GST_STATE_CHANGE_FAILURE) {
|
if (ret == GST_STATE_CHANGE_FAILURE) {
|
||||||
finished_ = true;
|
|
||||||
return std::string("Video Recording : Failed to start frame grabber.");
|
return std::string("Video Recording : Failed to start frame grabber.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -322,7 +322,6 @@ std::string VideoStreamer::init(GstCaps *caps)
|
|||||||
if ( gst_structure_has_field (capstruct, "height"))
|
if ( gst_structure_has_field (capstruct, "height"))
|
||||||
gst_structure_get_int (capstruct, "height", &h);
|
gst_structure_get_int (capstruct, "height", &h);
|
||||||
if ( config_.width != w || config_.height != h) {
|
if ( config_.width != w || config_.height != h) {
|
||||||
finished_ = true;
|
|
||||||
return std::string("Video Streamer cannot start: given frames (") + std::to_string(w) + " x " + std::to_string(h) +
|
return std::string("Video Streamer cannot start: given frames (") + std::to_string(w) + " x " + std::to_string(h) +
|
||||||
") are incompatible with stream (" + std::to_string(config_.width) + " x " + std::to_string(config_.height) + ")";
|
") are incompatible with stream (" + std::to_string(config_.width) + " x " + std::to_string(config_.height) + ")";
|
||||||
}
|
}
|
||||||
@@ -341,7 +340,6 @@ std::string VideoStreamer::init(GstCaps *caps)
|
|||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
std::string msg = std::string("Video Streamer : Could not construct pipeline ") + description + "\n" + std::string(error->message);
|
std::string msg = std::string("Video Streamer : Could not construct pipeline ") + description + "\n" + std::string(error->message);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
finished_ = true;
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,14 +395,12 @@ std::string VideoStreamer::init(GstCaps *caps)
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
finished_ = true;
|
|
||||||
return std::string("Video Streamer : Failed to configure frame grabber.");
|
return std::string("Video Streamer : Failed to configure frame grabber.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// start recording
|
// start recording
|
||||||
GstStateChangeReturn ret = gst_element_set_state (pipeline_, GST_STATE_PLAYING);
|
GstStateChangeReturn ret = gst_element_set_state (pipeline_, GST_STATE_PLAYING);
|
||||||
if (ret == GST_STATE_CHANGE_FAILURE) {
|
if (ret == GST_STATE_CHANGE_FAILURE) {
|
||||||
finished_ = true;
|
|
||||||
return std::string("Video Streamer : Failed to start frame grabber.");
|
return std::string("Video Streamer : Failed to start frame grabber.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user