custom_video_enc.c
6.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/*****************************************************************************
* Filename:
* ---------
* custom_video_enc.c
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* This file provides interfaces for accessing customized video parameters.
* It shall not normally be modified.
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifdef __VIDEO_ARCHI_V2__
/* __MPEG4_ENC_SUPPORT__ is a global option. */
/* __ATV_RECORD_SUPPORT__ is a global option. */
/* __AVI_ENC_SUPPORT__ is a global option??? */
/* __VIDEO_VT_SUPPORT__ is a local option. */
#include "drv_features_video.h" // for __VIDEO_VT_SUPPORT__
#include "drv_comm.h" // for drv_trace1(), drv_trace8()
#include "kal_release.h"
#include "custom_video_enc_setting.h"
#include "custom_video_enc_mpeg4.h"
#include "custom_video_enc_h264.h"
#include "custom_video_enc_mjpeg.h"
#include "custom_video_enc_matv.h"
#include "custom_video_enc_vt.h"
#include "custom_video_enc.h"
#include "vcodec_v2_trc.h"
/*****************************************************************************
*
*****************************************************************************/
static CUSTOM_VENC_MGR_T _rCustomVideoEncMgr;
/*****************************************************************************
*
*****************************************************************************/
CUSTOM_VENC_ERROR_T CustomVenc_Ctrl(CUSTOM_VENC_OP_T eOp,
void *pvInput, kal_uint32 u4InputSize, void *pvOutput, kal_uint32 u4OutputSize)
{
CUSTOM_VENC_ERROR_T eError;
kal_uint32 *pu4Input, *pu4Output;
if (eOp == CUSTOM_VENC_OP_SET_USER)
{
CUSTOM_VENC_USER_T *pvUser;
PFN_CUSTOM_VENC_CTRL pfnCustomVencCtrl = NULL;
if (!(sizeof(CUSTOM_VENC_USER_T) == u4InputSize)) { ASSERT(0); }
pvUser = (CUSTOM_VENC_USER_T*)pvInput;
if (!(pvUser != NULL)) { ASSERT(0); }
switch (*pvUser)
{
#ifdef __MPEG4_ENC_SUPPORT__
case CUSTOM_VENC_USER_REC_MPEG4:
eError = CustomVenc_GetMpeg4CtrlFunction(&pfnCustomVencCtrl);
if (!(eError == CUSTOM_VENC_ERROR_NONE)) { ASSERT(0); }
_rCustomVideoEncMgr.eCurrentUser = CUSTOM_VENC_USER_REC_MPEG4;
break;
#endif // __MPEG4_ENC_SUPPORT__
#ifdef __ATV_RECORD_SUPPORT__
case CUSTOM_VENC_USER_MATV_MPEG4_NTSC:
eError = CustomVenc_GetMatvCtrlFunction(&pfnCustomVencCtrl);
if (!(eError == CUSTOM_VENC_ERROR_NONE)) { ASSERT(0); }
_rCustomVideoEncMgr.eCurrentUser = CUSTOM_VENC_USER_MATV_MPEG4_NTSC;
break;
case CUSTOM_VENC_USER_MATV_MPEG4_PAL:
eError = CustomVenc_GetMatvCtrlFunction(&pfnCustomVencCtrl);
if (!(eError == CUSTOM_VENC_ERROR_NONE)) { ASSERT(0); }
_rCustomVideoEncMgr.eCurrentUser = CUSTOM_VENC_USER_MATV_MPEG4_PAL;
break;
case CUSTOM_VENC_USER_MATV_MJPEG_NTSC:
eError = CustomVenc_GetMatvMjpegCtrlFunction(&pfnCustomVencCtrl);
if (!(eError == CUSTOM_VENC_ERROR_NONE)) { ASSERT(0); }
_rCustomVideoEncMgr.eCurrentUser = CUSTOM_VENC_USER_MATV_MJPEG_NTSC;
break;
case CUSTOM_VENC_USER_MATV_MJPEG_PAL:
eError = CustomVenc_GetMatvMjpegCtrlFunction(&pfnCustomVencCtrl);
if (!(eError == CUSTOM_VENC_ERROR_NONE)) { ASSERT(0); }
_rCustomVideoEncMgr.eCurrentUser = CUSTOM_VENC_USER_MATV_MJPEG_PAL;
break;
#endif // __ATV_RECORD_SUPPORT__
#ifdef __AVI_ENC_SUPPORT__
case CUSTOM_VENC_USER_REC_MJPEG:
eError = CustomVenc_GetMjpegCtrlFunction(&pfnCustomVencCtrl);
if (!(eError == CUSTOM_VENC_ERROR_NONE)) { ASSERT(0); }
_rCustomVideoEncMgr.eCurrentUser = CUSTOM_VENC_USER_REC_MJPEG;
break;
#endif // __AVI_ENC_SUPPORT__
#ifdef __VIDEO_VT_SUPPORT__
case CUSTOM_VENC_USER_VT_MPEG4:
eError = CustomVenc_GetVtCtrlFunction(&pfnCustomVencCtrl);
if (!(eError == CUSTOM_VENC_ERROR_NONE)) { ASSERT(0); }
_rCustomVideoEncMgr.eCurrentUser = CUSTOM_VENC_USER_VT_MPEG4;
break;
#endif // __VIDEO_VT_SUPPORT__
#ifdef __H264_ENC_SUPPORT__
case CUSTOM_VENC_USER_REC_H264:
eError = CustomVenc_GetH264CtrlFunction(&pfnCustomVencCtrl);
if (!(eError == CUSTOM_VENC_ERROR_NONE)) { ASSERT(0); }
_rCustomVideoEncMgr.eCurrentUser = CUSTOM_VENC_USER_REC_H264;
break;
#endif // __H264_ENC_SUPPORT__
default:
ASSERT(0);
break;
}
_rCustomVideoEncMgr.pfnCustomVencCtrl = pfnCustomVencCtrl;
}
if (!(_rCustomVideoEncMgr.pfnCustomVencCtrl != NULL)) { ASSERT(0); }
drv_trace2(TRACE_GROUP_10, CUSTOM_VENC_TABLE_CTRL_BEGIN, (kal_uint32)(_rCustomVideoEncMgr.eCurrentUser), (kal_uint32)eOp);
eError = _rCustomVideoEncMgr.pfnCustomVencCtrl(eOp, pvInput, u4InputSize, pvOutput, u4OutputSize);
pu4Input = (kal_uint32*)pvInput;
pu4Output = (kal_uint32*)pvOutput;
drv_trace8(TRACE_GROUP_10, CUSTOM_VENC_TABLE_CTRL_END, (kal_uint32)eOp, (kal_uint32)pvInput, ((pu4Input == NULL) ? 0 : *pu4Input), u4InputSize, (kal_uint32)pvOutput, ((pu4Output == NULL) ? 0 : *pu4Output), u4OutputSize, __LINE__);
return eError;
}
CUSTOM_VENC_ERROR_T CustomVenc_Ctrl_Get_NumOf_Recorder_Users(CUSTOM_VENC_USER_T **UserTable, kal_uint32 *u4NumUser)
{
if (!(sizeof(_rVideoEncRecUserSupport) != 0)) { ASSERT(0); }
if (!(sizeof(_rVideoEncRecUserSupport[0]) != 0)) { ASSERT(0); }
*u4NumUser = (kal_uint32)((sizeof(_rVideoEncRecUserSupport) / sizeof(_rVideoEncRecUserSupport[0])) - 1);
if (!(*u4NumUser != 0)) { ASSERT(0); }
*UserTable = (CUSTOM_VENC_USER_T *)&(_rVideoEncRecUserSupport[1]);
return CUSTOM_VENC_ERROR_NONE;
}
#endif // __VIDEO_ARCHI_V2__