Ocean
TestAVFoundation.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_TEST_TESTMEDIA_TEST_AV_FOUNDATION_H
9 #define META_OCEAN_TEST_TESTMEDIA_TEST_AV_FOUNDATION_H
10 
12 
14 
15 namespace Ocean
16 {
17 
18 namespace Test
19 {
20 
21 namespace TestMedia
22 {
23 
24 /**
25  * This class implements a test for the AVFoundation media library.
26  * @ingroup testmedia
27  */
28 class OCEAN_TEST_MEDIA_EXPORT TestAVFoundation
29 {
30  public:
31 
32  /**
33  * Invokes all tests that are defined.
34  * @param testDuration The number of seconds for each test
35  * @return True, if succeeded
36  */
37  static bool test(const double testDuration);
38 
39  /**
40  * Tests the pixel buffer accessor for generic pixel formats.
41  * @param testDuration The number of seconds for each test
42  * @return True, if succeeded
43  */
44  static bool testPixelBufferAccessorGenericPixelFormats(const double testDuration);
45 
46  /**
47  * Tests the pixel buffer accessor for non-generic pixel formats.
48  * @param testDuration The number of seconds for each test
49  * @return True, if succeeded
50  */
51  static bool testPixelBufferAccessorNonGenericPixelFormats(const double testDuration);
52 
53  protected:
54 
55  /**
56  * Fills a CVPixelBuffer object with random image data.
57  * @param pixelBuffer The pixel buffer to which the random data will be written, must be valid
58  * @param expectedPlanes The number of expected planes of the pixel buffer, with range [1, infinity)
59  * @param randomGenerator The random generator to be used
60  * @param memoryCopy The resulting copy of the random memory which has been set, memory block for each plane of the pixel buffer
61  * @param heights The resulting heights of each individual memory block
62  * @param strideBytes The resulting number of bytes per row for each individual memory block
63  * @return True, if succeeded
64  */
65  static bool writeRandomDataToPixelBuffer(void* pixelBuffer, size_t expectedPlanes, RandomGenerator& randomGenerator, std::vector<std::vector<uint8_t>>& memoryCopy, Indices32& heights, Indices32& strideBytes);
66 };
67 
68 }
69 
70 }
71 
72 }
73 
74 #endif // META_OCEAN_TEST_TESTMEDIA_TEST_AV_FOUNDATION_H
This class implements a generator for random numbers.
Definition: RandomGenerator.h:42
This class implements a test for the AVFoundation media library.
Definition: TestAVFoundation.h:29
static bool testPixelBufferAccessorGenericPixelFormats(const double testDuration)
Tests the pixel buffer accessor for generic pixel formats.
static bool testPixelBufferAccessorNonGenericPixelFormats(const double testDuration)
Tests the pixel buffer accessor for non-generic pixel formats.
static bool writeRandomDataToPixelBuffer(void *pixelBuffer, size_t expectedPlanes, RandomGenerator &randomGenerator, std::vector< std::vector< uint8_t >> &memoryCopy, Indices32 &heights, Indices32 &strideBytes)
Fills a CVPixelBuffer object with random image data.
static bool test(const double testDuration)
Invokes all tests that are defined.
std::vector< Index32 > Indices32
Definition of a vector holding 32 bit index values.
Definition: Base.h:96
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15