2014-02-12 07:52:35 +01:00
|
|
|
#include "codec_api.h"
|
2014-02-12 21:28:35 +01:00
|
|
|
#include <stddef.h>
|
2014-02-12 07:52:35 +01:00
|
|
|
|
|
|
|
// Cast to this function type to ignore other parameters.
|
|
|
|
typedef int (*Func)(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);
|
2014-02-18 11:29:43 +01:00
|
|
|
CHECK(2, p, InitializeExt);
|
2014-02-12 07:52:35 +01:00
|
|
|
CHECK(3, p, Uninitialize);
|
|
|
|
CHECK(4, p, EncodeFrame);
|
2014-02-20 03:33:07 +01:00
|
|
|
CHECK(5, p, EncodeParameterSets);
|
|
|
|
CHECK(6, p, PauseFrame);
|
|
|
|
CHECK(7, p, ForceIntraFrame);
|
|
|
|
CHECK(8, p, SetOption);
|
|
|
|
CHECK(9, p, GetOption);
|
2014-02-12 07:52:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CheckDecoderInterface(ISVCDecoder* p, CheckFunc check) {
|
|
|
|
CHECK(1, p, Initialize);
|
|
|
|
CHECK(2, p, Uninitialize);
|
|
|
|
CHECK(3, p, DecodeFrame);
|
|
|
|
CHECK(4, p, DecodeFrame2);
|
|
|
|
CHECK(5, p, DecodeFrameEx);
|
|
|
|
CHECK(6, p, SetOption);
|
|
|
|
CHECK(7, p, GetOption);
|
|
|
|
}
|
2014-02-12 21:28:35 +01:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|