1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// RegisterCodec.h 2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef __REGISTERCODEC_H 4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define __REGISTERCODEC_H 5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../Common/MethodId.h" 7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 8baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef void * (*CreateCodecP)(); 9baa3858d3f5d128a5c8466b700098109edcad5f2repo syncstruct CCodecInfo 10baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CreateCodecP CreateDecoder; 12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CreateCodecP CreateEncoder; 13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMethodId Id; 14baa3858d3f5d128a5c8466b700098109edcad5f2repo sync const wchar_t *Name; 15baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt32 NumInStreams; 16baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool IsFilter; 17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}; 18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 19baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid RegisterCodec(const CCodecInfo *codecInfo); 20baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 21baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define REGISTER_CODEC_NAME(x) CRegisterCodec ## x 22baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 23baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define REGISTER_CODEC(x) struct REGISTER_CODEC_NAME(x) { \ 24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync REGISTER_CODEC_NAME(x)() { RegisterCodec(&g_CodecInfo); }}; \ 25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync static REGISTER_CODEC_NAME(x) g_RegisterCodec; 26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 27baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define REGISTER_CODECS_NAME(x) CRegisterCodecs ## x 28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define REGISTER_CODECS(x) struct REGISTER_CODECS_NAME(x) { \ 29baa3858d3f5d128a5c8466b700098109edcad5f2repo sync REGISTER_CODECS_NAME(x)() { for (int i = 0; i < sizeof(g_CodecsInfo) / sizeof(g_CodecsInfo[0]); i++) \ 30baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RegisterCodec(&g_CodecsInfo[i]); }}; \ 31baa3858d3f5d128a5c8466b700098109edcad5f2repo sync static REGISTER_CODECS_NAME(x) g_RegisterCodecs; 32baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif 34