History

astyle all

huili2 committed 12 years ago

Commit dc3fae41 parent 101265385 files · +4906 −4701Browse files

Showing the changes to test/api/cpp_interface_test.cpp (1 of 85 files). Show all

Unified · Split

test/api/cpp_interface_test.cpp+51−51
@@ -2,16 +2,16 @@ · 1 unmodified line
22 #include "codec_api.h"
33 #include <stddef.h>
44
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;
77 }
88
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);
1515
1616 // Store the 'this' pointer to verify 'this' is received as expected from C code.
1717 static void* gThis;
@@ -22,98 +22,98 @@ static void* gThis; · 4 unmodified lines
2222 */
2323 struct SVCEncoderImpl : public ISVCEncoder {
2424 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);
2727 return 1;
2828 }
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);
3131 return 2;
3232 }
33− virtual int EXTAPI GetDefaultParams(SEncParamExt* pParam) {
34− EXPECT_TRUE(gThis == this);
33+ virtual int EXTAPI GetDefaultParams (SEncParamExt* pParam) {
34+ EXPECT_TRUE (gThis == this);
3535 return 3;
3636 }
3737 virtual int EXTAPI Uninitialize() {
38− EXPECT_TRUE(gThis == this);
38+ EXPECT_TRUE (gThis == this);
3939 return 4;
4040 }
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);
4444 return 5;
4545 }
46− virtual int EXTAPI EncodeParameterSets(SFrameBSInfo* pBsInfo) {
47− EXPECT_TRUE(gThis == this);
46+ virtual int EXTAPI EncodeParameterSets (SFrameBSInfo* pBsInfo) {
47+ EXPECT_TRUE (gThis == this);
4848 return 6;
4949 }
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);
5353 return 7;
5454 }
55− virtual int EXTAPI ForceIntraFrame(bool bIDR) {
56− EXPECT_TRUE(gThis == this);
55+ virtual int EXTAPI ForceIntraFrame (bool bIDR) {
56+ EXPECT_TRUE (gThis == this);
5757 return 8;
5858 }
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);
6161 return 9;
6262 }
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);
6565 return 10;
6666 }
6767 };
6868
6969 struct SVCDecoderImpl : public ISVCDecoder {
7070 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);
7373 return 1;
7474 }
7575 virtual long EXTAPI Uninitialize() {
76− EXPECT_TRUE(gThis == this);
76+ EXPECT_TRUE (gThis == this);
7777 return 2;
7878 }
79− virtual DECODING_STATE EXTAPI DecodeFrame(const unsigned char* pSrc,
79+ virtual DECODING_STATE EXTAPI DecodeFrame (const unsigned char* pSrc,
8080 const int iSrcLen, unsigned char** ppDst, int* pStride,
8181 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);
8484 }
85− virtual DECODING_STATE EXTAPI DecodeFrame2(const unsigned char* pSrc,
85+ virtual DECODING_STATE EXTAPI DecodeFrame2 (const unsigned char* pSrc,
8686 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);
8989 }
90− virtual DECODING_STATE EXTAPI DecodeFrameEx(const unsigned char* pSrc,
90+ virtual DECODING_STATE EXTAPI DecodeFrameEx (const unsigned char* pSrc,
9191 const int iSrcLen, unsigned char* pDst, int iDstStride,
9292 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);
9595 }
9696 virtual long EXTAPI SetOption (DECODER_OPTION eOptionId, void* pOption) {
97− EXPECT_TRUE(gThis == this);
97+ EXPECT_TRUE (gThis == this);
9898 return 6;
9999 }
100100 virtual long EXTAPI GetOption (DECODER_OPTION eOptionId, void* pOption) {
101− EXPECT_TRUE(gThis == this);
101+ EXPECT_TRUE (gThis == this);
102102 return 7;
103103 }
104104 };
105105
106−TEST(ISVCEncoderTest, CheckFunctionOrder) {
106+TEST (ISVCEncoderTest, CheckFunctionOrder) {
107107 SVCEncoderImpl* p = new SVCEncoderImpl;
108108 gThis = p;
109− CheckEncoderInterface(p, CheckFunctionOrder);
109+ CheckEncoderInterface (p, CheckFunctionOrder);
110110 delete p;
111111 }
112112
113−TEST(ISVCDecoderTest, CheckFunctionOrder) {
113+TEST (ISVCDecoderTest, CheckFunctionOrder) {
114114 SVCDecoderImpl* p = new SVCDecoderImpl;
115115 gThis = p;
116− CheckDecoderInterface(p, CheckFunctionOrder);
116+ CheckDecoderInterface (p, CheckFunctionOrder);
117117 delete p;
118118 }
119119
@@ -122,8 +122,8 @@ struct bool_test_struct { · 2 unmodified lines
122122 bool b;
123123 };
124124
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";
129129 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t