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 44 45 46 47 48 49 50 51 52
|
#include "codec_api.h"
#include <stddef.h>
// Cast to this function type to ignore other parameters.
typedef int (*Func) (const void*);
#define CALL(p, m) (((Func)((*p)->m))(p))
// Check if the function return an expected number.
#define CHECK(n, p, m) check(n, CALL(p, m), #m)
typedef void (*CheckFunc) (int, int, const char*);
void CheckEncoderInterface (ISVCEncoder* p, CheckFunc check) {
CHECK (1, p, Initialize);
CHECK (2, p, InitializeExt);
CHECK (3, p, GetDefaultParams);
CHECK (4, p, Uninitialize);
CHECK (5, p, EncodeFrame);
CHECK (6, p, EncodeParameterSets);
CHECK (7, p, ForceIntraFrame);
CHECK (8, p, SetOption);
CHECK (9, p, GetOption);
}
void CheckDecoderInterface (ISVCDecoder* p, CheckFunc check) {
CHECK (1, p, Initialize);
CHECK (2, p, Uninitialize);
CHECK (3, p, DecodeFrame);
CHECK (4, p, DecodeFrameNoDelay);
CHECK (5, p, DecodeFrame2);
CHECK (6, p, DecodeFrameEx);
CHECK (7, p, DecodeParser);
CHECK (8, p, SetOption);
CHECK (9, p, GetOption);
CHECK (10, p, FlushFrame);
}
struct bool_test_struct {
char c;
bool b;
};
size_t GetBoolSize (void) {
return sizeof (bool);
}
size_t GetBoolOffset (void) {
return offsetof (struct bool_test_struct, b);
}
size_t GetBoolStructSize (void) {
return sizeof (struct bool_test_struct);
}
|