test_video_io.cpp 17.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
/*M///////////////////////////////////////////////////////////////////////////////////////
//
//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
//  By downloading, copying, installing or using the software you agree to this license.
//  If you do not agree to this license, do not download, install,
//  copy or use the software.
//
//
//                           License Agreement
//                For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//   * Redistribution's of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//
//   * Redistribution's in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//
//   * The name of the copyright holders may not be used to endorse or promote products
//     derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

#include "test_precomp.hpp"
44
#include "opencv2/videoio/videoio_c.h"
45

A
Alexander Alekhin 已提交
46 47
namespace opencv_test
{
48

49
class Videoio_Test_Base
50
{
A
Andrey Kamaev 已提交
51
protected:
52 53
    string ext;
    string video_file;
54
    VideoCaptureAPIs apiPref;
55 56 57
protected:
    Videoio_Test_Base() {}
    virtual ~Videoio_Test_Base() {}
58
    virtual void writeVideo() {}
59 60 61
    virtual void checkFrameContent(Mat &, int) {}
    virtual void checkFrameCount(int &) {}
    void checkFrameRead(int idx, VideoCapture & cap)
A
Andrey Kamaev 已提交
62
    {
63
        //int frameID = (int)cap.get(CAP_PROP_POS_FRAMES);
64 65
        Mat img;
        ASSERT_NO_THROW(cap >> img);
66 67
        //std::cout << "idx=" << idx << " img=" << img.size() << " frameID=" << frameID << std::endl;
        ASSERT_FALSE(img.empty()) << "idx=" << idx;
68
        checkFrameContent(img, idx);
A
Andrey Kamaev 已提交
69
    }
70
    void checkFrameSeek(int idx, VideoCapture & cap)
A
Andrey Kamaev 已提交
71
    {
72 73
        bool canSeek = false;
        ASSERT_NO_THROW(canSeek = cap.set(CAP_PROP_POS_FRAMES, idx));
74 75 76 77 78 79
        if (!canSeek)
        {
            std::cout << "Seek to frame '" << idx << "' is not supported. SKIP." << std::endl;
            return;
        }
        EXPECT_EQ(idx, (int)cap.get(CAP_PROP_POS_FRAMES));
80 81 82 83 84
        checkFrameRead(idx, cap);
    }
public:
    void doTest()
    {
85
        if (!videoio_registry::hasBackend(apiPref))
86
            throw SkipTestException(cv::String("Backend is not available/disabled: ") + cv::videoio_registry::getBackendName(apiPref));
87
        writeVideo();
88 89
        VideoCapture cap;
        ASSERT_NO_THROW(cap.open(video_file, apiPref));
90 91
        if (!cap.isOpened())
        {
92
            std::cout << "SKIP test: backend " << apiPref << " can't open the video: " << video_file << std::endl;
93 94
            return;
        }
95 96
        int n_frames = -1;
        EXPECT_NO_THROW(n_frames = (int)cap.get(CAP_PROP_FRAME_COUNT));
97 98 99 100 101 102 103 104 105 106
        if (n_frames > 0)
        {
            ASSERT_GT(n_frames, 0);
            checkFrameCount(n_frames);
        }
        else
        {
            std::cout << "CAP_PROP_FRAME_COUNT is not supported by backend. Assume 50 frames." << std::endl;
            n_frames = 50;
        }
A
Andrey Kamaev 已提交
107 108

        {
109
            SCOPED_TRACE("consecutive read");
110 111 112 113 114 115 116
            if (apiPref == CAP_GSTREAMER)
            {
                // This workaround is for GStreamer 1.3.1.1 and older.
                // Old Gstreamer has a bug which handles the total duration 1 frame shorter
                // Old Gstreamer are used in Ubuntu 14.04, so the following code could be removed after it's EOL
                n_frames--;
            }
117 118 119 120
            for (int k = 0; k < n_frames; ++k)
            {
                checkFrameRead(k, cap);
            }
A
Andrey Kamaev 已提交
121
        }
122 123
        bool canSeek = false;
        EXPECT_NO_THROW(canSeek = cap.set(CAP_PROP_POS_FRAMES, 0));
124
        if (!canSeek)
A
Andrey Kamaev 已提交
125
        {
126 127
            std::cout << "Seek to frame '0' is not supported. SKIP all 'seek' tests." << std::endl;
            return;
A
Andrey Kamaev 已提交
128 129
        }

130
        if (ext != "wmv" && ext != "h264" && ext != "h265")
A
Andrey Kamaev 已提交
131
        {
132
            SCOPED_TRACE("progressive seek");
133 134 135
            bool res = false;
            EXPECT_NO_THROW(res = cap.set(CAP_PROP_POS_FRAMES, 0));
            ASSERT_TRUE(res);
136
            for (int k = 0; k < n_frames; k += 20)
137 138 139
            {
                checkFrameSeek(k, cap);
            }
A
Andrey Kamaev 已提交
140
        }
141

142
        if (ext != "mpg" && ext != "wmv" && ext != "h264" && ext != "h265")
143 144
        {
            SCOPED_TRACE("random seek");
145 146 147
            bool res = false;
            EXPECT_NO_THROW(res = cap.set(CAP_PROP_POS_FRAMES, 0));
            ASSERT_TRUE(res);
148 149 150 151 152
            for (int k = 0; k < 10; ++k)
            {
                checkFrameSeek(cvtest::TS::ptr()->get_rng().uniform(0, n_frames), cap);
            }
        }
A
Andrey Kamaev 已提交
153
    }
154
};
A
Andrey Kamaev 已提交
155

156
//==================================================================================================
157
typedef tuple<string, VideoCaptureAPIs> Backend_Type_Params;
V
Vadim Pisarevsky 已提交
158

159
class videoio_bunny : public Videoio_Test_Base, public testing::TestWithParam<Backend_Type_Params>
160
{
161
    BunnyParameters bunny_param;
162
public:
163
    videoio_bunny()
A
Andrey Kamaev 已提交
164
    {
A
Alexander Nesterov 已提交
165 166
        ext = get<0>(GetParam());
        apiPref = get<1>(GetParam());
167
        video_file = BunnyParameters::getFilename(String(".") + ext);
A
Andrey Kamaev 已提交
168
    }
169
    void doFrameCountTest()
A
Andrey Kamaev 已提交
170
    {
171
        if (!videoio_registry::hasBackend(apiPref))
172
            throw SkipTestException(cv::String("Backend is not available/disabled: ") + cv::videoio_registry::getBackendName(apiPref));
173 174
        VideoCapture cap;
        EXPECT_NO_THROW(cap.open(video_file, apiPref));
175 176
        if (!cap.isOpened())
        {
177
            std::cout << "SKIP test: backend " << apiPref << " can't open the video: " << video_file << std::endl;
178 179
            return;
        }
180

181 182 183 184 185
        Size actual;
        EXPECT_NO_THROW(actual = Size((int)cap.get(CAP_PROP_FRAME_WIDTH),
                                      (int)cap.get(CAP_PROP_FRAME_HEIGHT)));
        EXPECT_EQ(bunny_param.getWidth(), actual.width);
        EXPECT_EQ(bunny_param.getHeight(), actual.height);
186

187 188
        double fps_prop = 0;
        EXPECT_NO_THROW(fps_prop = cap.get(CAP_PROP_FPS));
189
        if (fps_prop > 0)
190
            EXPECT_NEAR(fps_prop, bunny_param.getFps(), 1);
191 192
        else
            std::cout << "FPS is not available. SKIP check." << std::endl;
193

A
Alexander Nesterov 已提交
194
        int count_prop = 0;
195
        EXPECT_NO_THROW(count_prop = (int)cap.get(CAP_PROP_FRAME_COUNT));
196 197 198
        // mpg file reports 5.08 sec * 24 fps => property returns 122 frames
        // but actual number of frames returned is 125
        if (ext != "mpg")
A
Andrey Kamaev 已提交
199
        {
200
            if (count_prop > 0)
201
            {
202
                EXPECT_EQ(bunny_param.getCount(), count_prop);
203
            }
A
Andrey Kamaev 已提交
204 205
        }

206 207 208 209
        int count_actual = 0;
        while (cap.isOpened())
        {
            Mat frame;
210
            EXPECT_NO_THROW(cap >> frame);
211 212
            if (frame.empty())
                break;
213 214
            EXPECT_EQ(bunny_param.getWidth(), frame.cols);
            EXPECT_EQ(bunny_param.getHeight(), frame.rows);
215 216
            count_actual += 1;
        }
217
        if (count_prop > 0)
218
        {
219
            EXPECT_NEAR(bunny_param.getCount(), count_actual, 1);
220
        }
221 222
        else
            std::cout << "Frames counter is not available. Actual frames: " << count_actual << ". SKIP check." << std::endl;
A
Andrey Kamaev 已提交
223
    }
224
};
A
Andrey Kamaev 已提交
225

226 227 228 229
//==================================================================================================

struct Ext_Fourcc_PSNR
{
230 231
    const char* ext;
    const char* fourcc;
232
    float PSNR;
233
    VideoCaptureAPIs api;
234
};
235
typedef tuple<Size, Ext_Fourcc_PSNR> Size_Ext_Fourcc_PSNR;
A
Andrey Kamaev 已提交
236

237
class videoio_synthetic : public Videoio_Test_Base, public testing::TestWithParam<Size_Ext_Fourcc_PSNR>
238 239 240 241 242 243 244
{
    Size frame_size;
    int fourcc;
    float PSNR_GT;
    int frame_count;
    double fps;
public:
245
    videoio_synthetic()
A
Andrey Kamaev 已提交
246
    {
247
        frame_size = get<0>(GetParam());
248 249 250 251
        const Ext_Fourcc_PSNR p = get<1>(GetParam());
        ext = p.ext;
        fourcc = fourccFromString(p.fourcc);
        PSNR_GT = p.PSNR;
252 253 254
        video_file = cv::tempfile((fourccToString(fourcc) + "." + ext).c_str());
        frame_count = 100;
        fps = 25.;
255
        apiPref = p.api;
A
Andrey Kamaev 已提交
256
    }
257 258 259 260 261
    void TearDown()
    {
        remove(video_file.c_str());
    }
    virtual void writeVideo()
A
Andrey Kamaev 已提交
262
    {
263
        Mat img(frame_size, CV_8UC3);
264 265
        VideoWriter writer;
        EXPECT_NO_THROW(writer.open(video_file, apiPref, fourcc, fps, frame_size, true));
266 267
        ASSERT_TRUE(writer.isOpened());
        for(int i = 0; i < frame_count; ++i )
A
Andrey Kamaev 已提交
268
        {
269
            generateFrame(i, frame_count, img);
270
            EXPECT_NO_THROW(writer << img);
A
Andrey Kamaev 已提交
271
        }
272
        EXPECT_NO_THROW(writer.release());
A
Andrey Kamaev 已提交
273
    }
274
    virtual void checkFrameContent(Mat & img, int idx)
V
Vadim Pisarevsky 已提交
275
    {
276 277 278 279
        Mat imgGT(frame_size, CV_8UC3);
        generateFrame(idx, frame_count, imgGT);
        double psnr = cvtest::PSNR(img, imgGT);
        ASSERT_GT(psnr, PSNR_GT) << "frame " << idx;
V
Vadim Pisarevsky 已提交
280
    }
281
    virtual void checkFrameCount(int &actual)
V
Vadim Pisarevsky 已提交
282
    {
283 284 285 286 287 288 289 290 291 292 293
        Range expected_frame_count = Range(frame_count, frame_count);

        // Hack! Newer FFmpeg versions in this combination produce a file
        // whose reported duration is one frame longer than needed, and so
        // the calculated frame count is also off by one. Ideally, we'd want
        // to fix both writing (to produce the correct duration) and reading
        // (to correctly report frame count for such files), but I don't know
        // how to do either, so this is a workaround for now.
        if (fourcc == VideoWriter::fourcc('M', 'P', 'E', 'G') && ext == "mkv")
            expected_frame_count.end += 1;

294 295 296 297
        // Workaround for some gstreamer pipelines
        if (apiPref == CAP_GSTREAMER)
            expected_frame_count.start -= 1;

298 299
        ASSERT_LE(expected_frame_count.start, actual);
        ASSERT_GE(expected_frame_count.end, actual);
A
Alexander Reshetnikov 已提交
300

301
        actual = expected_frame_count.start; // adjust actual frame boundary to possible minimum
A
Alexander Reshetnikov 已提交
302
    }
303
};
A
Alexander Reshetnikov 已提交
304

305
//==================================================================================================
306

307
static const VideoCaptureAPIs backend_params[] = {
308 309 310
#ifdef HAVE_AVFOUNDATION
   CAP_AVFOUNDATION,
#endif
A
Alexander Nesterov 已提交
311 312 313 314 315 316 317

#ifdef HAVE_MSMF
    CAP_MSMF,
#endif

    CAP_GSTREAMER,
    CAP_FFMPEG,
318 319 320 321 322

#ifdef HAVE_XINE
    CAP_XINE,
#endif

A
Alexander Nesterov 已提交
323 324 325
    CAP_OPENCV_MJPEG
    // CAP_INTEL_MFX
};
326

327
static const string bunny_params[] = {
A
Alexander Nesterov 已提交
328
    string("wmv"),
329 330 331
    string("mov"),
    string("mp4"),
    string("mpg"),
A
Alexander Nesterov 已提交
332
    string("avi"),
333 334
    string("h264"),
    string("h265"),
335 336
    string("mjpg.avi")
};
337

338
TEST_P(videoio_bunny, read_position) { doTest(); }
A
Alexander Smorkalov 已提交
339

340
TEST_P(videoio_bunny, frame_count) { doFrameCountTest(); }
A
Alexander Reshetnikov 已提交
341

342
INSTANTIATE_TEST_CASE_P(videoio, videoio_bunny,
A
Alexander Nesterov 已提交
343 344 345
                          testing::Combine(
                              testing::ValuesIn(bunny_params),
                              testing::ValuesIn(backend_params)));
A
Alexander Reshetnikov 已提交
346 347


348 349 350 351 352 353
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;
}

static Ext_Fourcc_PSNR synthetic_params[] = {
A
Alexander Reshetnikov 已提交
354

355
#ifdef HAVE_MSMF
A
Alexander Nesterov 已提交
356
#if !defined(_M_ARM)
357 358
    {"wmv", "WMV1", 30.f, CAP_MSMF},
    {"wmv", "WMV2", 30.f, CAP_MSMF},
A
Alexander Nesterov 已提交
359
#endif
360 361 362
    {"wmv", "WMV3", 30.f, CAP_MSMF},
    {"wmv", "WVC1", 30.f, CAP_MSMF},
    {"mov", "H264", 30.f, CAP_MSMF},
A
Alexander Nesterov 已提交
363
#endif
364

365
#ifdef HAVE_AVFOUNDATION
366 367 368 369 370 371
   {"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},
372
#endif
A
Alexander Nesterov 已提交
373

374 375 376 377
    {"avi", "XVID", 30.f, CAP_FFMPEG},
    {"avi", "MPEG", 30.f, CAP_FFMPEG},
    {"avi", "IYUV", 30.f, CAP_FFMPEG},
    {"avi", "MJPG", 30.f, CAP_FFMPEG},
A
Alexander Nesterov 已提交
378

379 380 381
    {"mkv", "XVID", 30.f, CAP_FFMPEG},
    {"mkv", "MPEG", 30.f, CAP_FFMPEG},
    {"mkv", "MJPG", 30.f, CAP_FFMPEG},
V
Vadim Pisarevsky 已提交
382

383 384 385
    {"avi", "MPEG", 30.f, CAP_GSTREAMER},
    {"avi", "MJPG", 30.f, CAP_GSTREAMER},
    {"avi", "H264", 30.f, CAP_GSTREAMER},
386

387 388 389
    {"mkv", "MPEG", 30.f, CAP_GSTREAMER},
    {"mkv", "MJPG", 30.f, CAP_GSTREAMER},
    {"mkv", "H264", 30.f, CAP_GSTREAMER},
390

391
    {"avi", "MJPG", 30.f, CAP_OPENCV_MJPEG},
392 393
};

A
Alexander Nesterov 已提交
394

395 396 397 398 399
Size all_sizes[] = {
    Size(640, 480),
    Size(976, 768)
};

400
TEST_P(videoio_synthetic, write_read_position) { doTest(); }
401

402
INSTANTIATE_TEST_CASE_P(videoio, videoio_synthetic,
403 404 405
                        testing::Combine(
                            testing::ValuesIn(all_sizes),
                            testing::ValuesIn(synthetic_params)));
A
Alexander Alekhin 已提交
406

407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489
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()));


490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
TEST(Videoio, exceptions)
{
    VideoCapture cap;

    Mat mat;

    EXPECT_FALSE(cap.grab());
    EXPECT_FALSE(cap.retrieve(mat));
    EXPECT_FALSE(cap.set(CAP_PROP_POS_FRAMES, 1));
    EXPECT_FALSE(cap.open("this_does_not_exist.avi", CAP_OPENCV_MJPEG));

    cap.setExceptionMode(true);

    EXPECT_THROW(cap.grab(), Exception);
    EXPECT_THROW(cap.retrieve(mat), Exception);
    EXPECT_THROW(cap.set(CAP_PROP_POS_FRAMES, 1), Exception);
    EXPECT_THROW(cap.open("this_does_not_exist.avi", CAP_OPENCV_MJPEG), Exception);
}

509

510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
typedef Videoio_Writer Videoio_Writer_bad_fourcc;

TEST_P(Videoio_Writer_bad_fourcc, nocrash)
{
    if (!isBackendAvailable(apiPref, cv::videoio_registry::getStreamBackends()))
        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_FALSE(writer.isOpened());
    EXPECT_NO_THROW(writer.release());
}

static vector<Ext_Fourcc_API> generate_Ext_Fourcc_API_nocrash()
{
    static const Ext_Fourcc_API params[] = {
#ifdef HAVE_MSMF_DISABLED  // MSMF opens writer stream
    {"wmv", "aaaa", CAP_MSMF},
    {"mov", "aaaa", CAP_MSMF},
#endif

#ifdef HAVE_QUICKTIME
    {"mov", "aaaa", CAP_QT},
    {"avi", "aaaa", CAP_QT},
    {"mkv", "aaaa", CAP_QT},
#endif

#ifdef HAVE_AVFOUNDATION
   {"mov", "aaaa", CAP_AVFOUNDATION},
   {"mp4", "aaaa", CAP_AVFOUNDATION},
   {"m4v", "aaaa", CAP_AVFOUNDATION},
#endif

#ifdef HAVE_FFMPEG
    {"avi", "aaaa", CAP_FFMPEG},
    {"mkv", "aaaa", CAP_FFMPEG},
#endif

#ifdef HAVE_GSTREAMER
    {"avi", "aaaa", CAP_GSTREAMER},
    {"mkv", "aaaa", CAP_GSTREAMER},
#endif
    {"avi", "aaaa", CAP_OPENCV_MJPEG},
};

    const size_t N = sizeof(params)/sizeof(params[0]);
    vector<Ext_Fourcc_API> result; result.reserve(N);
    for (size_t i = 0; i < N; i++)
    {
        const Ext_Fourcc_API& src = params[i];
        Ext_Fourcc_API e = { src.ext, src.fourcc, src.api };
        result.push_back(e);
    }
    return result;
}

INSTANTIATE_TEST_CASE_P(videoio, Videoio_Writer_bad_fourcc, testing::ValuesIn(generate_Ext_Fourcc_API_nocrash()));

A
Alexander Alekhin 已提交
568
} // namespace