mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
videoio(gstreamer): port changes from 14834
This commit is contained in:
parent
1d2ef6b2a1
commit
2b2633c11f
@ -43,7 +43,8 @@ LONG_TESTS_DEBUG_VALGRIND = [
|
||||
('tracking', 'UKF.br_mean_squared_error', 5228.27),
|
||||
('tracking', '*DistanceAndOverlap*/1', 1000.0), # dudek
|
||||
('tracking', '*DistanceAndOverlap*/2', 1000.0), # faceocc2
|
||||
('videoio', 'Videoio_Video.ffmpeg_writebig', 1000),
|
||||
('videoio', 'videoio/videoio_ffmpeg.write_big*', 1000),
|
||||
('videoio', 'videoio_ffmpeg.parallel', 1000),
|
||||
('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_BoostDesc_LBGM.regression', 1124.51),
|
||||
('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_VGG120.regression', 2198.1),
|
||||
('xfeatures2d', 'Features2d_RotationInvariance_Descriptor_VGG48.regression', 1958.52),
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -73,4 +73,22 @@ Param test_data[] = {
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(videoio, videoio_gstreamer, testing::ValuesIn(test_data));
|
||||
|
||||
TEST(Videoio_GStreamer, unsupported_pipeline)
|
||||
{
|
||||
VideoCaptureAPIs apiPref = CAP_GSTREAMER;
|
||||
if (!isBackendAvailable(apiPref, cv::videoio_registry::getStreamBackends()))
|
||||
throw SkipTestException(cv::String("Backend is not available/disabled: ") + cv::videoio_registry::getBackendName(apiPref));
|
||||
|
||||
// could not link videoconvert0 to matroskamux0, matroskamux0 can't handle caps video/x-raw, format=(string)RGBA
|
||||
std::string pipeline = "appsrc ! videoconvert ! video/x-raw, format=(string)RGBA ! matroskamux ! filesink location=test.mkv";
|
||||
Size frame_size(640, 480);
|
||||
|
||||
VideoWriter writer;
|
||||
EXPECT_NO_THROW(writer.open(pipeline, apiPref, 0/*fourcc*/, 30/*fps*/, frame_size, true));
|
||||
EXPECT_FALSE(writer.isOpened());
|
||||
// no frames
|
||||
EXPECT_NO_THROW(writer.release());
|
||||
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -227,8 +227,8 @@ public:
|
||||
|
||||
struct Ext_Fourcc_PSNR
|
||||
{
|
||||
string ext;
|
||||
string fourcc;
|
||||
const char* ext;
|
||||
const char* fourcc;
|
||||
float PSNR;
|
||||
VideoCaptureAPIs api;
|
||||
};
|
||||
@ -345,18 +345,6 @@ INSTANTIATE_TEST_CASE_P(videoio, videoio_bunny,
|
||||
testing::ValuesIn(backend_params)));
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
inline Ext_Fourcc_PSNR makeParam(const char * ext, const char * fourcc, float psnr, VideoCaptureAPIs apipref)
|
||||
{
|
||||
Ext_Fourcc_PSNR res;
|
||||
res.ext = ext;
|
||||
res.fourcc = fourcc;
|
||||
res.PSNR = psnr;
|
||||
res.api = apipref;
|
||||
return res;
|
||||
}
|
||||
|
||||
inline static std::ostream &operator<<(std::ostream &out, const Ext_Fourcc_PSNR &p)
|
||||
{
|
||||
out << "FOURCC(" << p.fourcc << "), ." << p.ext << ", " << p.api << ", " << p.PSNR << "dB"; return out;
|
||||
@ -366,41 +354,41 @@ static Ext_Fourcc_PSNR synthetic_params[] = {
|
||||
|
||||
#ifdef HAVE_MSMF
|
||||
#if !defined(_M_ARM)
|
||||
makeParam("wmv", "WMV1", 30.f, CAP_MSMF),
|
||||
makeParam("wmv", "WMV2", 30.f, CAP_MSMF),
|
||||
{"wmv", "WMV1", 30.f, CAP_MSMF},
|
||||
{"wmv", "WMV2", 30.f, CAP_MSMF},
|
||||
#endif
|
||||
makeParam("wmv", "WMV3", 30.f, CAP_MSMF),
|
||||
makeParam("wmv", "WVC1", 30.f, CAP_MSMF),
|
||||
makeParam("mov", "H264", 30.f, CAP_MSMF),
|
||||
{"wmv", "WMV3", 30.f, CAP_MSMF},
|
||||
{"wmv", "WVC1", 30.f, CAP_MSMF},
|
||||
{"mov", "H264", 30.f, CAP_MSMF},
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AVFOUNDATION
|
||||
makeParam("mov", "H264", 30.f, CAP_AVFOUNDATION),
|
||||
makeParam("mov", "MJPG", 30.f, CAP_AVFOUNDATION),
|
||||
makeParam("mp4", "H264", 30.f, CAP_AVFOUNDATION),
|
||||
makeParam("mp4", "MJPG", 30.f, CAP_AVFOUNDATION),
|
||||
makeParam("m4v", "H264", 30.f, CAP_AVFOUNDATION),
|
||||
makeParam("m4v", "MJPG", 30.f, CAP_AVFOUNDATION),
|
||||
{"mov", "H264", 30.f, CAP_AVFOUNDATION},
|
||||
{"mov", "MJPG", 30.f, CAP_AVFOUNDATION},
|
||||
{"mp4", "H264", 30.f, CAP_AVFOUNDATION},
|
||||
{"mp4", "MJPG", 30.f, CAP_AVFOUNDATION},
|
||||
{"m4v", "H264", 30.f, CAP_AVFOUNDATION},
|
||||
{"m4v", "MJPG", 30.f, CAP_AVFOUNDATION},
|
||||
#endif
|
||||
|
||||
makeParam("avi", "XVID", 30.f, CAP_FFMPEG),
|
||||
makeParam("avi", "MPEG", 30.f, CAP_FFMPEG),
|
||||
makeParam("avi", "IYUV", 30.f, CAP_FFMPEG),
|
||||
makeParam("avi", "MJPG", 30.f, CAP_FFMPEG),
|
||||
{"avi", "XVID", 30.f, CAP_FFMPEG},
|
||||
{"avi", "MPEG", 30.f, CAP_FFMPEG},
|
||||
{"avi", "IYUV", 30.f, CAP_FFMPEG},
|
||||
{"avi", "MJPG", 30.f, CAP_FFMPEG},
|
||||
|
||||
makeParam("mkv", "XVID", 30.f, CAP_FFMPEG),
|
||||
makeParam("mkv", "MPEG", 30.f, CAP_FFMPEG),
|
||||
makeParam("mkv", "MJPG", 30.f, CAP_FFMPEG),
|
||||
{"mkv", "XVID", 30.f, CAP_FFMPEG},
|
||||
{"mkv", "MPEG", 30.f, CAP_FFMPEG},
|
||||
{"mkv", "MJPG", 30.f, CAP_FFMPEG},
|
||||
|
||||
makeParam("avi", "MPEG", 30.f, CAP_GSTREAMER),
|
||||
makeParam("avi", "MJPG", 30.f, CAP_GSTREAMER),
|
||||
makeParam("avi", "H264", 30.f, CAP_GSTREAMER),
|
||||
{"avi", "MPEG", 30.f, CAP_GSTREAMER},
|
||||
{"avi", "MJPG", 30.f, CAP_GSTREAMER},
|
||||
{"avi", "H264", 30.f, CAP_GSTREAMER},
|
||||
|
||||
makeParam("mkv", "MPEG", 30.f, CAP_GSTREAMER),
|
||||
makeParam("mkv", "MJPG", 30.f, CAP_GSTREAMER),
|
||||
makeParam("mkv", "H264", 30.f, CAP_GSTREAMER),
|
||||
{"mkv", "MPEG", 30.f, CAP_GSTREAMER},
|
||||
{"mkv", "MJPG", 30.f, CAP_GSTREAMER},
|
||||
{"mkv", "H264", 30.f, CAP_GSTREAMER},
|
||||
|
||||
makeParam("avi", "MJPG", 30.f, CAP_OPENCV_MJPEG),
|
||||
{"avi", "MJPG", 30.f, CAP_OPENCV_MJPEG},
|
||||
};
|
||||
|
||||
|
||||
@ -416,6 +404,89 @@ INSTANTIATE_TEST_CASE_P(videoio, videoio_synthetic,
|
||||
testing::ValuesIn(all_sizes),
|
||||
testing::ValuesIn(synthetic_params)));
|
||||
|
||||
struct Ext_Fourcc_API
|
||||
{
|
||||
const char* ext;
|
||||
const char* fourcc;
|
||||
VideoCaptureAPIs api;
|
||||
};
|
||||
|
||||
inline static std::ostream &operator<<(std::ostream &out, const Ext_Fourcc_API &p)
|
||||
{
|
||||
out << "(FOURCC(" << p.fourcc << "), \"" << p.ext << "\", " << p.api << ")"; return out;
|
||||
}
|
||||
|
||||
|
||||
class Videoio_Writer : public Videoio_Test_Base, public testing::TestWithParam<Ext_Fourcc_API>
|
||||
{
|
||||
protected:
|
||||
Size frame_size;
|
||||
int fourcc;
|
||||
double fps;
|
||||
public:
|
||||
Videoio_Writer()
|
||||
{
|
||||
frame_size = Size(640, 480);
|
||||
const Ext_Fourcc_API p = GetParam();
|
||||
ext = p.ext;
|
||||
fourcc = fourccFromString(p.fourcc);
|
||||
if (ext.size() == 3)
|
||||
video_file = cv::tempfile((fourccToString(fourcc) + "." + ext).c_str());
|
||||
else
|
||||
video_file = ext;
|
||||
fps = 25.;
|
||||
apiPref = p.api;
|
||||
}
|
||||
void SetUp()
|
||||
{
|
||||
}
|
||||
void TearDown()
|
||||
{
|
||||
if (ext.size() == 3)
|
||||
(void)remove(video_file.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(Videoio_Writer, write_nothing)
|
||||
{
|
||||
if (!cv::videoio_registry::hasBackend(apiPref))
|
||||
throw SkipTestException(cv::String("Backend is not available/disabled: ") + cv::videoio_registry::getBackendName(apiPref));
|
||||
|
||||
VideoWriter writer;
|
||||
EXPECT_NO_THROW(writer.open(video_file, apiPref, fourcc, fps, frame_size, true));
|
||||
ASSERT_TRUE(writer.isOpened());
|
||||
#if 0 // no frames
|
||||
cv::Mat m(frame_size, CV_8UC3, Scalar::all(127));
|
||||
writer << m;
|
||||
#endif
|
||||
EXPECT_NO_THROW(writer.release());
|
||||
}
|
||||
|
||||
static vector<Ext_Fourcc_API> generate_Ext_Fourcc_API()
|
||||
{
|
||||
const size_t N = sizeof(synthetic_params)/sizeof(synthetic_params[0]);
|
||||
vector<Ext_Fourcc_API> result; result.reserve(N);
|
||||
for (size_t i = 0; i < N; i++)
|
||||
{
|
||||
const Ext_Fourcc_PSNR& src = synthetic_params[i];
|
||||
Ext_Fourcc_API e = { src.ext, src.fourcc, src.api };
|
||||
result.push_back(e);
|
||||
}
|
||||
|
||||
{
|
||||
Ext_Fourcc_API e = { "appsrc ! videoconvert ! video/x-raw, format=(string)NV12 ! filesink location=test.nv12", "\0\0\0\0", CAP_GSTREAMER };
|
||||
result.push_back(e);
|
||||
}
|
||||
{
|
||||
Ext_Fourcc_API e = { "appsrc ! videoconvert ! video/x-raw, format=(string)I420 ! matroskamux ! filesink location=test.mkv", "\0\0\0\0", CAP_GSTREAMER };
|
||||
result.push_back(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(videoio, Videoio_Writer, testing::ValuesIn(generate_Ext_Fourcc_API()));
|
||||
|
||||
|
||||
TEST(Videoio, exceptions)
|
||||
{
|
||||
VideoCapture cap;
|
||||
|
@ -218,6 +218,14 @@
|
||||
fun:__itt_*create*
|
||||
}
|
||||
|
||||
{
|
||||
OpenCV-gtk_init
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:gtk_init
|
||||
fun:cvInitSystem
|
||||
}
|
||||
|
||||
{
|
||||
OpenCV-FFmpeg-swsscale
|
||||
Memcheck:Addr16
|
||||
@ -227,6 +235,35 @@
|
||||
fun:cvWriteFrame_FFMPEG
|
||||
}
|
||||
|
||||
{
|
||||
OpenCV-GStreamer-gst_init
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:gst_init
|
||||
}
|
||||
|
||||
{
|
||||
OpenCV-GStreamer-gst_deinit
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:gst_deinit
|
||||
}
|
||||
|
||||
{
|
||||
OpenCV-GStreamer-gst_init_check
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:gst_init_check
|
||||
}
|
||||
|
||||
{
|
||||
OpenCV-GStreamer-gst_parse_launch_full-reachable
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
...
|
||||
fun:gst_parse_launch_full
|
||||
}
|
||||
|
||||
{
|
||||
OpenCV-OpenEXR-ThreadPool
|
||||
Memcheck:Leak
|
||||
|
@ -18,6 +18,15 @@
|
||||
fun:_ZN7testing8internal11CmpHelperLEIddEENS_15AssertionResultEPKcS4_RKT_RKT0_
|
||||
}
|
||||
|
||||
{
|
||||
GTest-RegisterTests
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:RegisterTests
|
||||
...
|
||||
fun:_ZN7testing14InitGoogleTestEPiPPc
|
||||
}
|
||||
|
||||
{
|
||||
OpenCL
|
||||
Memcheck:Cond
|
||||
@ -55,10 +64,10 @@
|
||||
}
|
||||
|
||||
{
|
||||
glib
|
||||
GTK-css
|
||||
Memcheck:Leak
|
||||
fun:*alloc
|
||||
obj:*/libglib*
|
||||
...
|
||||
fun:gtk_css_provider*
|
||||
}
|
||||
|
||||
{
|
||||
@ -120,3 +129,89 @@
|
||||
...
|
||||
fun:cvWriteFrame_FFMPEG
|
||||
}
|
||||
|
||||
{
|
||||
GStreamer-orc_program_compile_full
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
...
|
||||
fun:orc_program_compile_full
|
||||
...
|
||||
fun:clone
|
||||
}
|
||||
|
||||
{
|
||||
GStreamer-orc_program_new_from_static_bytecode
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
...
|
||||
fun:orc_program_new_from_static_bytecode
|
||||
...
|
||||
fun:clone
|
||||
}
|
||||
|
||||
{
|
||||
GStreamer-matroska-other
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:gst*
|
||||
obj:*gstmatroska*
|
||||
...
|
||||
obj:*glib*
|
||||
fun:start_thread
|
||||
fun:clone
|
||||
}
|
||||
|
||||
{
|
||||
GStreamer-matroska-gst_riff_create_video_caps
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:gst_riff_create_video_caps
|
||||
obj:*gstmatroska*
|
||||
...
|
||||
fun:clone
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
GStreamer-tls
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: possible
|
||||
fun:calloc
|
||||
fun:allocate_dtv
|
||||
fun:_dl_allocate_tls
|
||||
}
|
||||
|
||||
{
|
||||
GStreamer-registry
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:gst_update_registry
|
||||
}
|
||||
|
||||
{
|
||||
GStreamer-plugin_load
|
||||
Memcheck:Leak
|
||||
...
|
||||
fun:gst_plugin_load_by_name
|
||||
}
|
||||
|
||||
{
|
||||
GStreamer-separate-threads
|
||||
Memcheck:Leak
|
||||
...
|
||||
obj:*/libglib*
|
||||
fun:start_thread
|
||||
fun:clone
|
||||
}
|
||||
|
||||
{
|
||||
clone-unknown-leak
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: definite
|
||||
fun:_Znwm
|
||||
obj:*
|
||||
obj:*
|
||||
fun:start_thread
|
||||
fun:clone
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user