1
2 #include "base/modules/c/include/WrapperIHaasVideoCodec.h"
3 #include "base/include/IHaasVideoCodec.h"
4 #include "ulog/ulog.h"
5 #include "base/modules/core/include/HaasErrno.h"
6
7 #define LOG_TAG "WRAPPER_VIDEOCODEC"
8
VideoCodecCreateInstance(VideoCodecType_t type)9 void* VideoCodecCreateInstance(VideoCodecType_t type)
10 {
11 LOGD(LOG_TAG, "entern %s;\n", __func__);
12 #if 0
13 IHaasVideoCodec* mIHaasVideoCodec = IHaasVideoCodecInstance(type);
14 if (mIHaasVideoCodec == NULL)
15 {
16 LOGD(LOG_TAG, "IHaasInstance failed %s;\n", __func__);
17 return NULL;
18 }
19 return (void*)mIHaasVideoCodec;
20 #else
21 return NULL;
22 #endif
23 }
24
VideoCodecDestoryInstance(void * instance)25 void VideoCodecDestoryInstance(void* instance)
26 {
27 LOGD(LOG_TAG, "entern %s;\n", __func__);
28 #if 0
29 IHaasVideoCodec* mIHaasVideoCodec = (IHaasVideoCodec*)instance;
30 if (mIHaasVideoCodec == NULL)
31 {
32 LOGD(LOG_TAG, "mIHaasVideoCodec is NULL %s;\n", __func__);
33 return;
34 }
35 delete mIHaasVideoCodec;
36 #endif
37 }
38
VideoCodecOpen(void * instance)39 int VideoCodecOpen(void* instance)
40 {
41 LOGD(LOG_TAG, "entern %s;\n", __func__);
42 #if 0
43 IHaasVideoCodec* mIHaasVideoCodec = (IHaasVideoCodec*)instance;
44 if (mIHaasVideoCodec == NULL)
45 {
46 LOGD(LOG_TAG, "mIHaasVideoCodec is NULL %s;\n", __func__);
47 return -1;
48 }
49 int ret = mIHaasVideoCodec->Open();
50 return ret;
51 #else
52 return 0;
53 #endif
54 }
55
VideoCodecClose(void * instance)56 int VideoCodecClose(void* instance)
57 {
58 LOGD(LOG_TAG, "entern %s;\n", __func__);
59 #if 0
60 IHaasVideoCodec* mIHaasVideoCodec = (IHaasVideoCodec*)instance;
61 if (mIHaasVideoCodec == NULL)
62 {
63 LOGD(LOG_TAG, "mIHaasVideoCodec is NULL %s;\n", __func__);
64 return -1;
65 }
66 int ret = mIHaasVideoCodec->Close();
67 return ret;
68 #else
69 return 0;
70 #endif
71 }
72
VideoCodecDecodeConfig(void * instance,DecodeConfig_t * config)73 int VideoCodecDecodeConfig(void* instance, DecodeConfig_t* config)
74 {
75 LOGD(LOG_TAG, "entern %s;\n", __func__);
76 #if 0
77 IHaasVideoCodec* mIHaasVideoCodec = (IHaasVideoCodec*)instance;
78 if (mIHaasVideoCodec == NULL)
79 {
80 LOGD(LOG_TAG, "mIHaasVideoCodec is NULL %s;\n", __func__);
81 return -1;
82 }
83 int ret = mIHaasVideoCodec->DecodeConfig(config);
84 return ret;
85 #else
86 return 0;
87 #endif
88 }
89
VideoCodecStartDecode(void * instance)90 int VideoCodecStartDecode(void* instance)
91 {
92 LOGD(LOG_TAG, "entern %s;\n", __func__);
93 #if 0
94 IHaasVideoCodec* mIHaasVideoCodec = (IHaasVideoCodec*)instance;
95 if (mIHaasVideoCodec == NULL)
96 {
97 LOGD(LOG_TAG, "mIHaasVideoCodec is NULL %s;\n", __func__);
98 return -1;
99 }
100 int ret = mIHaasVideoCodec->StartDecode();
101 return ret;
102 #else
103 return 0;
104 #endif
105 }
106
VideoCodecStopDecode(void * instance)107 int VideoCodecStopDecode(void* instance)
108 {
109 LOGD(LOG_TAG, "entern %s;\n", __func__);
110 #if 0
111 IHaasVideoCodec* mIHaasVideoCodec = (IHaasVideoCodec*)instance;
112 if (mIHaasVideoCodec == NULL)
113 {
114 LOGD(LOG_TAG, "mIHaasVideoCodec is NULL %s;\n", __func__);
115 return -1;
116 }
117 int ret = mIHaasVideoCodec->StopDecode();
118 return ret;
119 #else
120 return 0;
121 #endif
122 }
123
VideoCodecGetDecodeImageData(void * instance,void * pkt,ImageBuffer_t ** image)124 int VideoCodecGetDecodeImageData(void* instance, void *pkt, ImageBuffer_t** image)
125 {
126 LOGD(LOG_TAG, "entern %s;\n", __func__);
127 #if 0
128 IHaasVideoCodec* mIHaasVideoCodec = (IHaasVideoCodec*)instance;
129 if (mIHaasVideoCodec == NULL)
130 {
131 LOGD(LOG_TAG, "mIHaasVideoCodec is NULL %s;\n", __func__);
132 return -1;
133 }
134 int ret = mIHaasVideoCodec->GetDecodeImageData(pkt, image);
135 return ret;
136 #else
137 return 0;
138 #endif
139 }
140
VideoCodecEncodeConfig(void * instance,EncodeConfig_t * config)141 int VideoCodecEncodeConfig(void* instance, EncodeConfig_t* config)
142 {
143 LOGD(LOG_TAG, "entern %s;\n", __func__);
144 #if 0
145 IHaasVideoCodec* mIHaasVideoCodec = (IHaasVideoCodec*)instance;
146 if (mIHaasVideoCodec == NULL)
147 {
148 LOGD(LOG_TAG, "mIHaasVideoCodec is NULL %s;\n", __func__);
149 return -1;
150 }
151 int ret = mIHaasVideoCodec->EncodeConfig(config);
152 return ret;
153 #else
154 return 0;
155 #endif
156 }
157
VideoCodecStartEncode(void * instance)158 int VideoCodecStartEncode(void* instance)
159 {
160 LOGD(LOG_TAG, "entern %s;\n", __func__);
161 #if 0
162 IHaasVideoCodec* mIHaasVideoCodec = (IHaasVideoCodec*)instance;
163 if (mIHaasVideoCodec == NULL)
164 {
165 LOGD(LOG_TAG, "mIHaasVideoCodec is NULL %s;\n", __func__);
166 return -1;
167 }
168 int ret = mIHaasVideoCodec->StartEncode();
169 return ret;
170 #else
171 return 0;
172 #endif
173 }
174
VideoCodecStopEncode(void * instance)175 int VideoCodecStopEncode(void* instance)
176 {
177 LOGD(LOG_TAG, "entern %s;\n", __func__);
178 #if 0
179 IHaasVideoCodec* mIHaasVideoCodec = (IHaasVideoCodec*)instance;
180 if (mIHaasVideoCodec == NULL)
181 {
182 LOGD(LOG_TAG, "mIHaasVideoCodec is NULL %s;\n", __func__);
183 return -1;
184 }
185 int ret = mIHaasVideoCodec->StopEncode();
186 return ret;
187 #else
188 return 0;
189 #endif
190 }
191
VideoCodecGetEncodePacketData(void * instance,VideoPacket_t ** data)192 int VideoCodecGetEncodePacketData(void* instance, VideoPacket_t **data)
193 {
194 LOGD(LOG_TAG, "entern %s;\n", __func__);
195 #if 0
196 IHaasVideoCodec* mIHaasVideoCodec = (IHaasVideoCodec*)instance;
197 if (mIHaasVideoCodec == NULL)
198 {
199 LOGD(LOG_TAG, "mIHaasVideoCodec is NULL %s;\n", __func__);
200 return -1;
201 }
202 int ret = mIHaasVideoCodec->GetEncodePacketData(data);
203 return ret;
204 #else
205 return 0;
206 #endif
207 }
208
209