SF_OMX_Core.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2021 StarFive Technology Co., Ltd.
  4. */
  5. #ifndef OMX__CORE
  6. #define OMX__CORE
  7. #include "OMX_Types.h"
  8. #include "OMX_Core.h"
  9. #include "OMX_Component.h"
  10. #include "OMX_VideoExt.h"
  11. #include <sys/time.h>
  12. #include <stdarg.h>
  13. #include <dlfcn.h>
  14. #include <string.h>
  15. #define ENABLE_DEBUG
  16. #ifdef ENABLE_DEBUG
  17. enum
  18. {
  19. SF_LOG_ERR = 0,
  20. SF_LOG_WARN,
  21. SF_LOG_PERF,
  22. SF_LOG_INFO,
  23. SF_LOG_DEBUG,
  24. SF_LOG_ALL,
  25. };
  26. void SF_LogMsg(int level, const char *function, int line, const char *format, ...);
  27. void SF_LogMsgAppend(int level, const char *format, ...);
  28. #define LOG(level, ...) SF_LogMsg(level, __FUNCTION__, __LINE__, __VA_ARGS__);
  29. #define LOG_APPEND(level, ...) SF_LogMsgAppend(level, __VA_ARGS__);
  30. #define FunctionIn() SF_LogMsg(SF_LOG_DEBUG, __FUNCTION__, __LINE__, "FUN IN\r\n");
  31. #define FunctionOut() SF_LogMsg(SF_LOG_DEBUG, __FUNCTION__, __LINE__, "FUN OUT\r\n");
  32. #else
  33. #define FunctionIn()
  34. #define FunctionOut()
  35. #endif
  36. #define VPU_OUTPUT_BUF_NUMBER 10
  37. #define VPU_INPUT_BUF_NUMBER 5
  38. typedef struct _SF_OMX_COMPONENT
  39. {
  40. OMX_STRING componentName;
  41. OMX_STRING libName;
  42. OMX_COMPONENTTYPE *pOMXComponent;
  43. OMX_ERRORTYPE (*SF_OMX_ComponentConstructor)(struct _SF_OMX_COMPONENT *hComponent);
  44. OMX_ERRORTYPE (*SF_OMX_ComponentClear)(struct _SF_OMX_COMPONENT *hComponent);
  45. OMX_PTR soHandle;
  46. // SF_COMPONENT_FUNCTIONS *functions;
  47. OMX_PTR componentImpl;
  48. // OMX_PTR functions;
  49. // Component *hSFComponentExecoder;
  50. // Component *hSFComponentFeeder;
  51. // Component *hSFComponentRender;
  52. // void *testConfig;
  53. // CNMComponentConfig *config;
  54. // void *lsnCtx;
  55. // Uint16 *pusBitCode;
  56. // CodStd bitFormat;
  57. // OMX_VIDEO_PARAM_AVCTYPE AVCComponent[2];
  58. // OMX_VIDEO_PARAM_HEVCTYPE HEVCComponent[2];
  59. OMX_CALLBACKTYPE *callbacks;
  60. OMX_PTR pAppData;
  61. OMX_PARAM_PORTDEFINITIONTYPE portDefinition[2];
  62. OMX_BUFFERHEADERTYPE *pBufferArray[64];
  63. OMX_STRING fwPath;
  64. OMX_STRING componentRule;
  65. OMX_STATETYPE nextState;
  66. OMX_BOOL memory_optimization;
  67. } SF_OMX_COMPONENT;
  68. typedef struct _SF_PORT_PRIVATE
  69. {
  70. OMX_U32 nPortnumber;
  71. } SF_PORT_PRIVATE;
  72. #define PRINT_STUCT(a, b) \
  73. do \
  74. { \
  75. printf("size = %d\r\n", sizeof(b)); \
  76. for (int i = 0; i < sizeof(b); i += sizeof(void *)) \
  77. { \
  78. for (int j = 0; j < sizeof(void *); j++) \
  79. { \
  80. printf("%02X ", *((char *)a + i + j)); \
  81. } \
  82. for (int j = 0; j < sizeof(void *); j++) \
  83. { \
  84. printf("%c", *((char *)a + i + j)); \
  85. } \
  86. printf("\r\n"); \
  87. } \
  88. } while (0)
  89. #ifdef __cplusplus
  90. extern "C"
  91. {
  92. #endif
  93. int GetNumberOfComponent();
  94. #ifdef __cplusplus
  95. }
  96. #endif
  97. #endif