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