videoio: dump exception's messages in plugins

pull/19618/head
Alexander Alekhin 4 years ago
parent 9d89edff2f
commit 831d48d971
  1. 63
      modules/videoio/src/cap_ffmpeg.cpp
  2. 50
      modules/videoio/src/cap_gstreamer.cpp
  3. 50
      modules/videoio/src/cap_mfx_plugin.cpp
  4. 40
      modules/videoio/src/cap_msmf.cpp

@ -258,8 +258,13 @@ CvResult CV_API_CALL cv_capture_open(const char* filename, int camera_index, CV_
return CV_ERROR_OK;
}
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "FFmpeg: Exception is raised: " << e.what());
}
catch (...)
{
CV_LOG_WARNING(NULL, "FFmpeg: Unknown C++ exception is raised");
}
if (cap)
delete cap;
@ -290,8 +295,13 @@ CvResult CV_API_CALL cv_capture_open_with_params(
return CV_ERROR_OK;
}
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "FFmpeg: Exception is raised: " << e.what());
}
catch (...)
{
CV_LOG_WARNING(NULL, "FFmpeg: Unknown C++ exception is raised");
}
if (cap)
delete cap;
@ -322,8 +332,14 @@ CvResult CV_API_CALL cv_capture_get_prop(CvPluginCapture handle, int prop, CV_OU
*val = instance->getProperty(prop);
return CV_ERROR_OK;
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "FFmpeg: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "FFmpeg: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -338,8 +354,14 @@ CvResult CV_API_CALL cv_capture_set_prop(CvPluginCapture handle, int prop, doubl
CvCapture_FFMPEG_proxy* instance = (CvCapture_FFMPEG_proxy*)handle;
return instance->setProperty(prop, val) ? CV_ERROR_OK : CV_ERROR_FAIL;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "FFmpeg: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "FFmpeg: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -354,8 +376,14 @@ CvResult CV_API_CALL cv_capture_grab(CvPluginCapture handle)
CvCapture_FFMPEG_proxy* instance = (CvCapture_FFMPEG_proxy*)handle;
return instance->grabFrame() ? CV_ERROR_OK : CV_ERROR_FAIL;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "FFmpeg: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "FFmpeg: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -375,8 +403,14 @@ CvResult CV_API_CALL cv_capture_retrieve(CvPluginCapture handle, int stream_idx,
return callback(stream_idx, img.data, img.step, img.cols, img.rows, img.channels(), userdata);
return CV_ERROR_FAIL;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "FFmpeg: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "FFmpeg: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -395,8 +429,14 @@ CvResult CV_API_CALL cv_capture_retrieve(CvPluginCapture handle, int stream_idx,
return callback(stream_idx, img.data, img.step, img.cols, img.rows, img.type(), userdata);
return CV_ERROR_FAIL;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "FFmpeg: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "FFmpeg: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -417,8 +457,13 @@ CvResult CV_API_CALL cv_writer_open(const char* filename, int fourcc, double fps
return CV_ERROR_OK;
}
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "FFmpeg: Exception is raised: " << e.what());
}
catch (...)
{
CV_LOG_WARNING(NULL, "FFmpeg: Unknown C++ exception is raised");
}
if (wrt)
delete wrt;
@ -459,8 +504,14 @@ CvResult CV_API_CALL cv_writer_write(CvPluginWriter handle, const unsigned char
instance->write(img);
return CV_ERROR_OK;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "FFmpeg: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "FFmpeg: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}

@ -1878,8 +1878,13 @@ CvResult CV_API_CALL cv_capture_open(const char* filename, int camera_index, CV_
return CV_ERROR_OK;
}
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "GStreamer: Exception is raised: " << e.what());
}
catch (...)
{
CV_LOG_WARNING(NULL, "GStreamer: Unknown C++ exception is raised");
}
if (cap)
delete cap;
@ -1910,8 +1915,14 @@ CvResult CV_API_CALL cv_capture_get_prop(CvPluginCapture handle, int prop, CV_OU
*val = instance->getProperty(prop);
return CV_ERROR_OK;
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "GStreamer: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "GStreamer: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -1926,8 +1937,14 @@ CvResult CV_API_CALL cv_capture_set_prop(CvPluginCapture handle, int prop, doubl
GStreamerCapture* instance = (GStreamerCapture*)handle;
return instance->setProperty(prop, val) ? CV_ERROR_OK : CV_ERROR_FAIL;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "GStreamer: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "GStreamer: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -1942,8 +1959,14 @@ CvResult CV_API_CALL cv_capture_grab(CvPluginCapture handle)
GStreamerCapture* instance = (GStreamerCapture*)handle;
return instance->grabFrame() ? CV_ERROR_OK : CV_ERROR_FAIL;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "GStreamer: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "GStreamer: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -1962,8 +1985,14 @@ CvResult CV_API_CALL cv_capture_retrieve(CvPluginCapture handle, int stream_idx,
return callback(stream_idx, img.data, img.step, img.cols, img.rows, img.type(), userdata);
return CV_ERROR_FAIL;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "GStreamer: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "GStreamer: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -2008,8 +2037,13 @@ CvResult CV_API_CALL cv_writer_open_with_params(
return CV_ERROR_OK;
}
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "GStreamer: Exception is raised: " << e.what());
}
catch (...)
{
CV_LOG_WARNING(NULL, "GStreamer: Unknown C++ exception is raised");
}
if (wrt)
delete wrt;
@ -2060,8 +2094,14 @@ CvResult CV_API_CALL cv_writer_write(CvPluginWriter handle, const unsigned char
cvSetData(&img, const_cast<unsigned char*>(data), step);
return instance->writeFrame(&img) ? CV_ERROR_OK : CV_ERROR_FAIL;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "GStreamer: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "GStreamer: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}

@ -37,8 +37,13 @@ CvResult CV_API_CALL cv_capture_open(const char* filename, int, CV_OUT CvPluginC
}
}
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MFX: Exception is raised: " << e.what());
}
catch (...)
{
CV_LOG_WARNING(NULL, "MFX: Unknown C++ exception is raised");
}
if (cap)
delete cap;
@ -69,8 +74,14 @@ CvResult CV_API_CALL cv_capture_get_prop(CvPluginCapture handle, int prop, CV_OU
*val = instance->getProperty(prop);
return CV_ERROR_OK;
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MFX: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "MFX: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -85,8 +96,14 @@ CvResult CV_API_CALL cv_capture_set_prop(CvPluginCapture handle, int prop, doubl
VideoCapture_IntelMFX* instance = (VideoCapture_IntelMFX*)handle;
return instance->setProperty(prop, val) ? CV_ERROR_OK : CV_ERROR_FAIL;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MFX: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "MFX: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -101,8 +118,14 @@ CvResult CV_API_CALL cv_capture_grab(CvPluginCapture handle)
VideoCapture_IntelMFX* instance = (VideoCapture_IntelMFX*)handle;
return instance->grabFrame() ? CV_ERROR_OK : CV_ERROR_FAIL;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MFX: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "MFX: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -120,8 +143,14 @@ CvResult CV_API_CALL cv_capture_retrieve(CvPluginCapture handle, int stream_idx,
return callback(stream_idx, img.data, (int)img.step, img.cols, img.rows, img.channels(), userdata);
return CV_ERROR_FAIL;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MFX: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "MFX: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -140,8 +169,13 @@ CvResult CV_API_CALL cv_writer_open(const char* filename, int fourcc, double fps
return CV_ERROR_OK;
}
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MFX: Exception is raised: " << e.what());
}
catch (...)
{
CV_LOG_WARNING(NULL, "MFX: Unknown C++ exception is raised");
}
if (wrt)
delete wrt;
@ -182,8 +216,14 @@ CvResult CV_API_CALL cv_writer_write(CvPluginWriter handle, const unsigned char
instance->write(img);
return CV_ERROR_OK;
}
catch(...)
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MFX: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "MFX: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}

@ -1712,8 +1712,13 @@ CvResult CV_API_CALL cv_capture_open(const char* filename, int camera_index, CV_
return CV_ERROR_OK;
}
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MSMF: Exception is raised: " << e.what());
}
catch (...)
{
CV_LOG_WARNING(NULL, "MSMF: Unknown C++ exception is raised");
}
if (cap)
delete cap;
@ -1744,8 +1749,14 @@ CvResult CV_API_CALL cv_capture_get_prop(CvPluginCapture handle, int prop, CV_OU
*val = instance->getProperty(prop);
return CV_ERROR_OK;
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MSMF: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "MSMF: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -1760,8 +1771,14 @@ CvResult CV_API_CALL cv_capture_set_prop(CvPluginCapture handle, int prop, doubl
CaptureT* instance = (CaptureT*)handle;
return instance->setProperty(prop, val) ? CV_ERROR_OK : CV_ERROR_FAIL;
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MSMF: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "MSMF: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -1776,8 +1793,14 @@ CvResult CV_API_CALL cv_capture_grab(CvPluginCapture handle)
CaptureT* instance = (CaptureT*)handle;
return instance->grabFrame() ? CV_ERROR_OK : CV_ERROR_FAIL;
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MSMF: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "MSMF: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -1795,8 +1818,14 @@ CvResult CV_API_CALL cv_capture_retrieve(CvPluginCapture handle, int stream_idx,
return callback(stream_idx, img.data, (int)img.step, img.cols, img.rows, img.channels(), userdata);
return CV_ERROR_FAIL;
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MSMF: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "MSMF: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}
@ -1815,8 +1844,13 @@ CvResult CV_API_CALL cv_writer_open(const char* filename, int fourcc, double fps
return CV_ERROR_OK;
}
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MSMF: Exception is raised: " << e.what());
}
catch (...)
{
CV_LOG_WARNING(NULL, "MSMF: Unknown C++ exception is raised");
}
if (wrt)
delete wrt;
@ -1859,8 +1893,14 @@ CvResult CV_API_CALL cv_writer_write(CvPluginWriter handle, const unsigned char*
instance->write(img);
return CV_ERROR_OK;
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MSMF: Exception is raised: " << e.what());
return CV_ERROR_FAIL;
}
catch (...)
{
CV_LOG_WARNING(NULL, "MSMF: Unknown C++ exception is raised");
return CV_ERROR_FAIL;
}
}

Loading…
Cancel
Save