• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "codec_api.h"
2 #include <stddef.h>
3 
4 // Cast to this function type to ignore other parameters.
5 typedef int (*Func) (const void*);
6 #define CALL(p, m) (((Func)((*p)->m))(p))
7 // Check if the function return an expected number.
8 #define CHECK(n, p, m) check(n, CALL(p, m), #m)
9 
10 typedef void (*CheckFunc) (int, int, const char*);
11 
CheckEncoderInterface(ISVCEncoder * p,CheckFunc check)12 void CheckEncoderInterface (ISVCEncoder* p, CheckFunc check) {
13   CHECK (1, p, Initialize);
14   CHECK (2, p, InitializeExt);
15   CHECK (3, p, GetDefaultParams);
16   CHECK (4, p, Uninitialize);
17   CHECK (5, p, EncodeFrame);
18   CHECK (6, p, EncodeParameterSets);
19   CHECK (7, p, ForceIntraFrame);
20   CHECK (8, p, SetOption);
21   CHECK (9, p, GetOption);
22 }
23 
CheckDecoderInterface(ISVCDecoder * p,CheckFunc check)24 void CheckDecoderInterface (ISVCDecoder* p, CheckFunc check) {
25   CHECK (1, p, Initialize);
26   CHECK (2, p, Uninitialize);
27   CHECK (3, p, DecodeFrame);
28   CHECK (4, p, DecodeFrameNoDelay);
29   CHECK (5, p, DecodeFrame2);
30   CHECK (6, p, DecodeFrameEx);
31   CHECK (7, p, DecodeParser);
32   CHECK (8, p, SetOption);
33   CHECK (9, p, GetOption);
34   CHECK (10, p, FlushFrame);
35 }
36 
37 struct bool_test_struct {
38   char c;
39   bool b;
40 };
41 
GetBoolSize(void)42 size_t GetBoolSize (void) {
43   return sizeof (bool);
44 }
45 
GetBoolOffset(void)46 size_t GetBoolOffset (void) {
47   return offsetof (struct bool_test_struct, b);
48 }
49 
GetBoolStructSize(void)50 size_t GetBoolStructSize (void) {
51   return sizeof (struct bool_test_struct);
52 }
53