Showing the changes to test/api/cpp_interface_test.cpp (1 of 85 files). Show all
Unified · Split
| @@ -2,16 +2,16 @@ · 1 unmodified line | ||
| 2 | 2 | #include "codec_api.h" |
| 3 | 3 | #include <stddef.h> |
| 4 | 4 | |
| 5 | −static void CheckFunctionOrder(int expect, int actual, const char* name) { | |
| 6 | − EXPECT_EQ(expect, actual) << "Wrong function order: " << name; | |
| 5 | +static void CheckFunctionOrder (int expect, int actual, const char* name) { | |
| 6 | + EXPECT_EQ (expect, actual) << "Wrong function order: " << name; | |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | −typedef void(*CheckFunc)(int, int, const char*); | |
| 10 | −extern "C" void CheckEncoderInterface(ISVCEncoder* p, CheckFunc); | |
| 11 | −extern "C" void CheckDecoderInterface(ISVCDecoder* p, CheckFunc); | |
| 12 | −extern "C" size_t GetBoolSize(void); | |
| 13 | −extern "C" size_t GetBoolOffset(void); | |
| 14 | −extern "C" size_t GetBoolStructSize(void); | |
| 9 | +typedef void (*CheckFunc) (int, int, const char*); | |
| 10 | +extern "C" void CheckEncoderInterface (ISVCEncoder* p, CheckFunc); | |
| 11 | +extern "C" void CheckDecoderInterface (ISVCDecoder* p, CheckFunc); | |
| 12 | +extern "C" size_t GetBoolSize (void); | |
| 13 | +extern "C" size_t GetBoolOffset (void); | |
| 14 | +extern "C" size_t GetBoolStructSize (void); | |
| 15 | 15 | |
| 16 | 16 | // Store the 'this' pointer to verify 'this' is received as expected from C code. |
| 17 | 17 | static void* gThis; |
| @@ -22,98 +22,98 @@ static void* gThis; · 4 unmodified lines | ||
| 22 | 22 | */ |
| 23 | 23 | struct SVCEncoderImpl : public ISVCEncoder { |
| 24 | 24 | virtual ~SVCEncoderImpl() {} |
| 25 | − virtual int EXTAPI Initialize(const SEncParamBase* pParam) { | |
| 26 | − EXPECT_TRUE(gThis == this); | |
| 25 | + virtual int EXTAPI Initialize (const SEncParamBase* pParam) { | |
| 26 | + EXPECT_TRUE (gThis == this); | |
| 27 | 27 | return 1; |
| 28 | 28 | } |
| 29 | − virtual int EXTAPI InitializeExt(const SEncParamExt* pParam) { | |
| 30 | − EXPECT_TRUE(gThis == this); | |
| 29 | + virtual int EXTAPI InitializeExt (const SEncParamExt* pParam) { | |
| 30 | + EXPECT_TRUE (gThis == this); | |
| 31 | 31 | return 2; |
| 32 | 32 | } |
| 33 | − virtual int EXTAPI GetDefaultParams(SEncParamExt* pParam) { | |
| 34 | − EXPECT_TRUE(gThis == this); | |
| 33 | + virtual int EXTAPI GetDefaultParams (SEncParamExt* pParam) { | |
| 34 | + EXPECT_TRUE (gThis == this); | |
| 35 | 35 | return 3; |
| 36 | 36 | } |
| 37 | 37 | virtual int EXTAPI Uninitialize() { |
| 38 | − EXPECT_TRUE(gThis == this); | |
| 38 | + EXPECT_TRUE (gThis == this); | |
| 39 | 39 | return 4; |
| 40 | 40 | } |
| 41 | − virtual int EXTAPI EncodeFrame(const SSourcePicture* kpSrcPic, | |
| 42 | − SFrameBSInfo* pBsInfo) { | |
| 43 | − EXPECT_TRUE(gThis == this); | |
| 41 | + virtual int EXTAPI EncodeFrame (const SSourcePicture* kpSrcPic, | |
| 42 | + SFrameBSInfo* pBsInfo) { | |
| 43 | + EXPECT_TRUE (gThis == this); | |
| 44 | 44 | return 5; |
| 45 | 45 | } |
| 46 | − virtual int EXTAPI EncodeParameterSets(SFrameBSInfo* pBsInfo) { | |
| 47 | − EXPECT_TRUE(gThis == this); | |
| 46 | + virtual int EXTAPI EncodeParameterSets (SFrameBSInfo* pBsInfo) { | |
| 47 | + EXPECT_TRUE (gThis == this); | |
| 48 | 48 | return 6; |
| 49 | 49 | } |
| 50 | − virtual int EXTAPI PauseFrame(const SSourcePicture* kpSrcPic, | |
| 51 | − SFrameBSInfo* pBsInfo) { | |
| 52 | − EXPECT_TRUE(gThis == this); | |
| 50 | + virtual int EXTAPI PauseFrame (const SSourcePicture* kpSrcPic, | |
| 51 | + SFrameBSInfo* pBsInfo) { | |
| 52 | + EXPECT_TRUE (gThis == this); | |
| 53 | 53 | return 7; |
| 54 | 54 | } |
| 55 | − virtual int EXTAPI ForceIntraFrame(bool bIDR) { | |
| 56 | − EXPECT_TRUE(gThis == this); | |
| 55 | + virtual int EXTAPI ForceIntraFrame (bool bIDR) { | |
| 56 | + EXPECT_TRUE (gThis == this); | |
| 57 | 57 | return 8; |
| 58 | 58 | } |
| 59 | − virtual int EXTAPI SetOption(ENCODER_OPTION eOptionId, void* pOption) { | |
| 60 | − EXPECT_TRUE(gThis == this); | |
| 59 | + virtual int EXTAPI SetOption (ENCODER_OPTION eOptionId, void* pOption) { | |
| 60 | + EXPECT_TRUE (gThis == this); | |
| 61 | 61 | return 9; |
| 62 | 62 | } |
| 63 | − virtual int EXTAPI GetOption(ENCODER_OPTION eOptionId, void* pOption) { | |
| 64 | − EXPECT_TRUE(gThis == this); | |
| 63 | + virtual int EXTAPI GetOption (ENCODER_OPTION eOptionId, void* pOption) { | |
| 64 | + EXPECT_TRUE (gThis == this); | |
| 65 | 65 | return 10; |
| 66 | 66 | } |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | 69 | struct SVCDecoderImpl : public ISVCDecoder { |
| 70 | 70 | virtual ~SVCDecoderImpl() {} |
| 71 | − virtual long EXTAPI Initialize(const SDecodingParam* pParam) { | |
| 72 | − EXPECT_TRUE(gThis == this); | |
| 71 | + virtual long EXTAPI Initialize (const SDecodingParam* pParam) { | |
| 72 | + EXPECT_TRUE (gThis == this); | |
| 73 | 73 | return 1; |
| 74 | 74 | } |
| 75 | 75 | virtual long EXTAPI Uninitialize() { |
| 76 | − EXPECT_TRUE(gThis == this); | |
| 76 | + EXPECT_TRUE (gThis == this); | |
| 77 | 77 | return 2; |
| 78 | 78 | } |
| 79 | − virtual DECODING_STATE EXTAPI DecodeFrame(const unsigned char* pSrc, | |
| 79 | + virtual DECODING_STATE EXTAPI DecodeFrame (const unsigned char* pSrc, | |
| 80 | 80 | const int iSrcLen, unsigned char** ppDst, int* pStride, |
| 81 | 81 | int& iWidth, int& iHeight) { |
| 82 | − EXPECT_TRUE(gThis == this); | |
| 83 | − return static_cast<DECODING_STATE>(3); | |
| 82 | + EXPECT_TRUE (gThis == this); | |
| 83 | + return static_cast<DECODING_STATE> (3); | |
| 84 | 84 | } |
| 85 | − virtual DECODING_STATE EXTAPI DecodeFrame2(const unsigned char* pSrc, | |
| 85 | + virtual DECODING_STATE EXTAPI DecodeFrame2 (const unsigned char* pSrc, | |
| 86 | 86 | const int iSrcLen, unsigned char** ppDst, SBufferInfo* pDstInfo) { |
| 87 | − EXPECT_TRUE(gThis == this); | |
| 88 | − return static_cast<DECODING_STATE>(4); | |
| 87 | + EXPECT_TRUE (gThis == this); | |
| 88 | + return static_cast<DECODING_STATE> (4); | |
| 89 | 89 | } |
| 90 | − virtual DECODING_STATE EXTAPI DecodeFrameEx(const unsigned char* pSrc, | |
| 90 | + virtual DECODING_STATE EXTAPI DecodeFrameEx (const unsigned char* pSrc, | |
| 91 | 91 | const int iSrcLen, unsigned char* pDst, int iDstStride, |
| 92 | 92 | int& iDstLen, int& iWidth, int& iHeight, int& iColorFormat) { |
| 93 | − EXPECT_TRUE(gThis == this); | |
| 94 | − return static_cast<DECODING_STATE>(5); | |
| 93 | + EXPECT_TRUE (gThis == this); | |
| 94 | + return static_cast<DECODING_STATE> (5); | |
| 95 | 95 | } |
| 96 | 96 | virtual long EXTAPI SetOption (DECODER_OPTION eOptionId, void* pOption) { |
| 97 | − EXPECT_TRUE(gThis == this); | |
| 97 | + EXPECT_TRUE (gThis == this); | |
| 98 | 98 | return 6; |
| 99 | 99 | } |
| 100 | 100 | virtual long EXTAPI GetOption (DECODER_OPTION eOptionId, void* pOption) { |
| 101 | − EXPECT_TRUE(gThis == this); | |
| 101 | + EXPECT_TRUE (gThis == this); | |
| 102 | 102 | return 7; |
| 103 | 103 | } |
| 104 | 104 | }; |
| 105 | 105 | |
| 106 | −TEST(ISVCEncoderTest, CheckFunctionOrder) { | |
| 106 | +TEST (ISVCEncoderTest, CheckFunctionOrder) { | |
| 107 | 107 | SVCEncoderImpl* p = new SVCEncoderImpl; |
| 108 | 108 | gThis = p; |
| 109 | − CheckEncoderInterface(p, CheckFunctionOrder); | |
| 109 | + CheckEncoderInterface (p, CheckFunctionOrder); | |
| 110 | 110 | delete p; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | −TEST(ISVCDecoderTest, CheckFunctionOrder) { | |
| 113 | +TEST (ISVCDecoderTest, CheckFunctionOrder) { | |
| 114 | 114 | SVCDecoderImpl* p = new SVCDecoderImpl; |
| 115 | 115 | gThis = p; |
| 116 | − CheckDecoderInterface(p, CheckFunctionOrder); | |
| 116 | + CheckDecoderInterface (p, CheckFunctionOrder); | |
| 117 | 117 | delete p; |
| 118 | 118 | } |
| 119 | 119 | |
| @@ -122,8 +122,8 @@ struct bool_test_struct { · 2 unmodified lines | ||
| 122 | 122 | bool b; |
| 123 | 123 | }; |
| 124 | 124 | |
| 125 | −TEST(ISVCDecoderEncoderTest, CheckCAbi) { | |
| 126 | − EXPECT_EQ(sizeof(bool), GetBoolSize()) << "Wrong size of bool type"; | |
| 127 | − EXPECT_EQ(offsetof(bool_test_struct, b), GetBoolOffset()) << "Wrong alignment of bool in a struct"; | |
| 128 | − EXPECT_EQ(sizeof(bool_test_struct), GetBoolStructSize()) << "Wrong size of struct with a bool"; | |
| 125 | +TEST (ISVCDecoderEncoderTest, CheckCAbi) { | |
| 126 | + EXPECT_EQ (sizeof (bool), GetBoolSize()) << "Wrong size of bool type"; | |
| 127 | + EXPECT_EQ (offsetof (bool_test_struct, b), GetBoolOffset()) << "Wrong alignment of bool in a struct"; | |
| 128 | + EXPECT_EQ (sizeof (bool_test_struct), GetBoolStructSize()) << "Wrong size of struct with a bool"; | |
| 129 | 129 | } |