• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 #include "oscl_base.h"
19 #include "oscl_mem.h"
20 
21 #include "pvt_common.h"
22 #include "pvt_params.h"
23 
24 
25 /* CPVMediaParam */
CPVMediaParam(PVCodecType_t aCodecType)26 OSCL_EXPORT_REF CPVMediaParam::CPVMediaParam(PVCodecType_t aCodecType)
27         : iCodecType(aCodecType)
28 {
29 }
30 
~CPVMediaParam()31 OSCL_EXPORT_REF CPVMediaParam::~CPVMediaParam()
32 {
33 
34 }
35 
GetCodecType()36 OSCL_EXPORT_REF PVCodecType_t CPVMediaParam::GetCodecType()
37 {
38     return iCodecType;
39 }
40 
41 
42 
43 /* CPVAudioParam */
Copy()44 OSCL_EXPORT_REF CPVParam* CPVAudioParam::Copy()
45 {
46     return new CPVAudioParam(GetCodecType());
47 }
48 
GetMediaType()49 OSCL_EXPORT_REF PV2WayMediaType CPVAudioParam::GetMediaType()
50 {
51     return PV_AUDIO;
52 }
53 
CPVAudioParam(PVCodecType_t aCodecType)54 CPVAudioParam::CPVAudioParam(PVCodecType_t aCodecType) : CPVMediaParam(aCodecType)
55 {
56 }
57 
58 /* CPVVideoParam */
~CPVVideoParam()59 OSCL_EXPORT_REF CPVVideoParam::~CPVVideoParam()
60 {
61 }
62 
GetMediaType()63 OSCL_EXPORT_REF PV2WayMediaType CPVVideoParam::GetMediaType()
64 {
65     return PV_VIDEO;
66 }
67 
Copy()68 OSCL_EXPORT_REF CPVParam* CPVVideoParam::Copy()
69 {
70     return new CPVVideoParam(iWidth, iHeight, GetCodecType());
71 }
72 
GetWidth()73 OSCL_EXPORT_REF uint16 CPVVideoParam::GetWidth()
74 {
75     return iWidth;
76 }
77 
GetHeight()78 OSCL_EXPORT_REF uint16 CPVVideoParam::GetHeight()
79 {
80     return iHeight;
81 }
82 
CPVVideoParam(uint16 aWidth,uint16 aHeight,PVCodecType_t aCodecType)83 CPVVideoParam::CPVVideoParam(uint16 aWidth, uint16 aHeight, PVCodecType_t aCodecType)
84         : CPVMediaParam(aCodecType), iWidth(aWidth), iHeight(aHeight)
85 {
86 }
87 
88 
CPVM4vVideoParam(uint16 w,uint16 h,uint16 sz,uint8 * cfg)89 OSCL_EXPORT_REF CPVM4vVideoParam::CPVM4vVideoParam(uint16 w, uint16 h, uint16 sz, uint8 *cfg)
90         : CPVVideoParam(w, h, PV_VID_TYPE_MPEG4), iSz(sz), iCfg(NULL)
91 {
92     if (iSz)
93     {
94         iCfg = (uint8 *)OSCL_DEFAULT_MALLOC(iSz);
95         oscl_memcpy(iCfg, cfg, iSz);
96     }
97 }
98 
~CPVM4vVideoParam()99 OSCL_EXPORT_REF CPVM4vVideoParam::~CPVM4vVideoParam()
100 {
101     if (iCfg)
102     {
103         OSCL_DEFAULT_FREE(iCfg);
104         iCfg = NULL;
105     }
106 }
107 
GetDecoderConfigSize()108 OSCL_EXPORT_REF uint16 CPVM4vVideoParam::GetDecoderConfigSize()
109 {
110     return iSz;
111 }
112 
GetDecoderConfig()113 OSCL_EXPORT_REF uint8 *CPVM4vVideoParam::GetDecoderConfig()
114 {
115     return iCfg;
116 }
117 
Set(uint16 config_sz,uint8 * cfg)118 OSCL_EXPORT_REF OsclAny CPVM4vVideoParam::Set(uint16 config_sz, uint8* cfg)
119 {
120     iSz = config_sz;
121     if (iCfg)
122     {
123         OSCL_DEFAULT_FREE(iCfg);
124         iCfg = NULL;
125     }
126 
127     if (iSz)
128     {
129         iCfg = (uint8 *)OSCL_DEFAULT_MALLOC(iSz);
130         oscl_memcpy(iCfg, cfg, iSz);
131     }
132 }
133 
Copy()134 OSCL_EXPORT_REF CPVParam* CPVM4vVideoParam::Copy()
135 {
136     return new CPVM4vVideoParam(GetWidth(), GetHeight(), iSz, iCfg);
137 }
138 
139 /* CPVAMRAudioParam */
CPVAMRAudioParam()140 OSCL_EXPORT_REF CPVAMRAudioParam::CPVAMRAudioParam() : CPVAudioParam(PV_AUD_TYPE_GSM)
141 {
142 }
143 
~CPVAMRAudioParam()144 OSCL_EXPORT_REF CPVAMRAudioParam::~CPVAMRAudioParam()
145 {
146 }
147 
148 /* CPVG723AudioParam */
CPVG723AudioParam()149 OSCL_EXPORT_REF CPVG723AudioParam::CPVG723AudioParam() : CPVAudioParam(PV_AUD_TYPE_G723)
150 {
151 }
152 
~CPVG723AudioParam()153 OSCL_EXPORT_REF CPVG723AudioParam::~CPVG723AudioParam()
154 {
155 
156 }
157 
158 /* CPVH263VideoParam */
CPVH263VideoParam(uint16 w,uint16 h)159 OSCL_EXPORT_REF CPVH263VideoParam::CPVH263VideoParam(uint16 w, uint16 h) : CPVVideoParam(w, h, PV_VID_TYPE_H263)
160 {
161 }
162 
~CPVH263VideoParam()163 OSCL_EXPORT_REF CPVH263VideoParam::~CPVH263VideoParam()
164 {
165 
166 }
167 
168 
169 
170 /* CPVTrackInfo */
operator ==(CPVTrackInfo & a,CPVTrackInfo & b)171 OSCL_EXPORT_REF bool operator==(CPVTrackInfo &a, CPVTrackInfo &b)
172 {
173     return ((a.GetDirection() == b.GetDirection()) && (a.GetChannelId() == b.GetChannelId()));
174 }
175 
176 /* CPVUserInputDtmf */
CPVUserInputDtmf(uint8 input,bool update,uint16 duration)177 OSCL_EXPORT_REF CPVUserInputDtmf::CPVUserInputDtmf(uint8 input, bool update, uint16 duration)
178 {
179     iInput = input;
180     iIsUpdate = update;
181     iDuration = duration;
182 }
183 
GetType()184 OSCL_EXPORT_REF TPVUserInputType CPVUserInputDtmf::GetType()
185 {
186     return EDtmf;
187 }
188 
GetInput()189 OSCL_EXPORT_REF uint8 CPVUserInputDtmf::GetInput()
190 {
191     return iInput;
192 }
193 
IsUpdate()194 OSCL_EXPORT_REF bool CPVUserInputDtmf::IsUpdate()
195 {
196     return iIsUpdate;
197 }
198 
GetDuration()199 OSCL_EXPORT_REF uint16 CPVUserInputDtmf::GetDuration()
200 {
201     return iDuration;
202 }
Copy()203 OSCL_EXPORT_REF CPVUserInput* CPVUserInputDtmf::Copy()
204 {
205     return new CPVUserInputDtmf(iInput, iIsUpdate, iDuration);
206 }
207 
208 /* CPVUserInputAlphanumeric */
CPVUserInputAlphanumeric(uint8 * input,uint16 len)209 OSCL_EXPORT_REF CPVUserInputAlphanumeric::CPVUserInputAlphanumeric(uint8* input, uint16 len): iInput(NULL), iLength(len)
210 {
211     if ((len > 0) && (input != NULL))
212     {
213         iInput = (uint8*) OSCL_DEFAULT_MALLOC(len);
214         oscl_memcpy(iInput, input, len);
215     }
216 }
217 
~CPVUserInputAlphanumeric()218 OSCL_EXPORT_REF CPVUserInputAlphanumeric::~CPVUserInputAlphanumeric()
219 {
220     if (iInput)
221     {
222         OSCL_DEFAULT_FREE(iInput);
223     }
224 }
225 
GetType()226 OSCL_EXPORT_REF TPVUserInputType CPVUserInputAlphanumeric::GetType()
227 {
228     return EAlphanumeric ;
229 }
230 
GetInput()231 OSCL_EXPORT_REF uint8* CPVUserInputAlphanumeric::GetInput()
232 {
233     return iInput;
234 }
235 
GetLength()236 OSCL_EXPORT_REF uint16 CPVUserInputAlphanumeric::GetLength()
237 {
238     return iLength;
239 }
Copy()240 OSCL_EXPORT_REF CPVUserInput* CPVUserInputAlphanumeric::Copy()
241 {
242     return new CPVUserInputAlphanumeric(iInput, iLength);
243 }
244 
245 /* TPVH245VendorObjectIdentifier */
TPVH245VendorObjectIdentifier(uint8 * vendor,uint16 vendorLength)246 OSCL_EXPORT_REF TPVH245VendorObjectIdentifier::TPVH245VendorObjectIdentifier(uint8* vendor, uint16 vendorLength)
247         : iVendor(NULL), iVendorLength(vendorLength)
248 {
249     iVendor = (uint8*)OSCL_DEFAULT_MALLOC(iVendorLength);
250     oscl_memcpy(iVendor, vendor, iVendorLength);
251 }
252 
~TPVH245VendorObjectIdentifier()253 OSCL_EXPORT_REF TPVH245VendorObjectIdentifier::~TPVH245VendorObjectIdentifier()
254 {
255     if (iVendor)
256     {
257         OSCL_DEFAULT_FREE(iVendor);
258     }
259 }
260 
GetVendorType()261 OSCL_EXPORT_REF TPVH245VendorType TPVH245VendorObjectIdentifier::GetVendorType()
262 {
263     return EObjectIdentifier;
264 }
265 
GetVendor(uint16 * length)266 OSCL_EXPORT_REF uint8* TPVH245VendorObjectIdentifier::GetVendor(uint16* length)
267 {
268     *length = iVendorLength;
269     return iVendor;
270 }
271 
Copy()272 OSCL_EXPORT_REF TPVH245Vendor* TPVH245VendorObjectIdentifier::Copy()
273 {
274     return OSCL_NEW(TPVH245VendorObjectIdentifier, (iVendor, iVendorLength));
275 }
276 
277 
278 /* TPVVendorH221NonStandard */
TPVVendorH221NonStandard(uint8 t35countryCode,uint8 t35extension,uint32 manufacturerCode)279 OSCL_EXPORT_REF TPVVendorH221NonStandard::TPVVendorH221NonStandard(uint8 t35countryCode, uint8 t35extension, uint32 manufacturerCode):
280         iT35CountryCode(t35countryCode), iT35Extension(t35extension), iManufacturerCode(manufacturerCode)
281 {
282 }
283 
~TPVVendorH221NonStandard()284 OSCL_EXPORT_REF TPVVendorH221NonStandard::~TPVVendorH221NonStandard()
285 {
286 }
287 
GetVendorType()288 OSCL_EXPORT_REF TPVH245VendorType TPVVendorH221NonStandard::GetVendorType()
289 {
290     return EH221NonStandard;
291 }
292 
Copy()293 OSCL_EXPORT_REF TPVH245Vendor* TPVVendorH221NonStandard::Copy()
294 {
295     return OSCL_NEW(TPVVendorH221NonStandard, (iT35CountryCode, iT35Extension, iManufacturerCode));
296 }
297 
GetT35CountryCode()298 OSCL_EXPORT_REF uint8 TPVVendorH221NonStandard::GetT35CountryCode()
299 {
300     return iT35CountryCode;
301 }
302 
GetT35Extension()303 OSCL_EXPORT_REF uint8 TPVVendorH221NonStandard::GetT35Extension()
304 {
305     return iT35Extension;
306 }
307 
GetManufacturerCode()308 OSCL_EXPORT_REF uint32 TPVVendorH221NonStandard::GetManufacturerCode()
309 {
310     return iManufacturerCode;
311 }
312 
313 /* TPVVendorIdentification */
TPVVendorIdentification()314 OSCL_EXPORT_REF TPVVendorIdentification::TPVVendorIdentification() : iVendor(NULL), iProductNumber(NULL), iProductNumberLen(0),
315         iVersionNumber(NULL), iVersionNumberLen(0)
316 {
317 }
318 
TPVVendorIdentification(TPVH245Vendor * vendor,uint8 * pn,uint16 pn_len,uint8 * vn,uint16 vn_len)319 OSCL_EXPORT_REF TPVVendorIdentification::TPVVendorIdentification(TPVH245Vendor* vendor,
320         uint8* pn, uint16 pn_len,
321         uint8* vn, uint16 vn_len)
322 {
323     if (vendor)
324     {
325         iVendor = vendor->Copy();
326     }
327     if (pn_len)
328     {
329         iProductNumber = (uint8*)OSCL_DEFAULT_MALLOC(pn_len);
330         oscl_memcpy(iProductNumber, pn, pn_len);
331         iProductNumberLen = pn_len;
332     }
333     if (vn_len)
334     {
335         iVersionNumber = (uint8*)OSCL_DEFAULT_MALLOC(vn_len);
336         oscl_memcpy(iVersionNumber, vn, vn_len);
337         iVersionNumberLen = vn_len;
338     }
339 }
340 
~TPVVendorIdentification()341 OSCL_EXPORT_REF TPVVendorIdentification::~TPVVendorIdentification()
342 {
343     if (iVendor)
344     {
345         OSCL_DELETE(iVendor);
346     }
347     if (iProductNumber)
348     {
349         OSCL_DEFAULT_FREE(iProductNumber);
350     }
351     if (iVersionNumber)
352     {
353         OSCL_DEFAULT_FREE(iVersionNumber);
354     }
355 }
356 
357 
358 /* CPvtDiagnosticIndication */
CPvtDiagnosticIndication(TPVTerminalEvent aEvent,int aParam1,int aParam2,int aParam3)359 OSCL_EXPORT_REF CPvtDiagnosticIndication::CPvtDiagnosticIndication(TPVTerminalEvent aEvent, int aParam1, int aParam2, int aParam3)
360         : iEvent(aEvent), iParam1(aParam1), iParam2(aParam2), iParam3(aParam3)
361 {
362 }
363 
~CPvtDiagnosticIndication()364 OSCL_EXPORT_REF CPvtDiagnosticIndication::~CPvtDiagnosticIndication()
365 {
366 }
367 
368 /* CPVGenericMuxParam */
CPVGenericMuxParam(TPVMuxType aMuxType)369 OSCL_EXPORT_REF CPVGenericMuxParam::CPVGenericMuxParam(TPVMuxType aMuxType):
370         discard_corrupt_video(PARAM_DEFAULT),
371         max_discard_video_sdu_size(0),
372         err_rate_threshold_to_req_I_frame(0),
373         audio_err_rate_update_interval(0),
374         audio_encode_frame_delay(0),
375         audio_decode_frame_delay(0),
376         iMuxType(aMuxType)
377 {
378 }
379 
GetMuxType()380 OSCL_EXPORT_REF TPVMuxType CPVGenericMuxParam::GetMuxType()
381 {
382     return iMuxType;
383 }
384 
Copy()385 OSCL_EXPORT_REF CPVParam* CPVGenericMuxParam::Copy()
386 {
387     CPVGenericMuxParam* ret = new CPVGenericMuxParam(iMuxType);
388     ret->discard_corrupt_video = discard_corrupt_video;
389     ret->max_discard_video_sdu_size = max_discard_video_sdu_size;
390     ret->err_rate_threshold_to_req_I_frame = err_rate_threshold_to_req_I_frame;
391     ret->audio_err_rate_update_interval = audio_err_rate_update_interval;
392     ret->audio_encode_frame_delay = audio_encode_frame_delay;
393     ret->audio_decode_frame_delay = audio_decode_frame_delay;
394     return ret;
395 }
396 
Copy(CPVGenericMuxParam * param)397 OSCL_EXPORT_REF OsclAny CPVGenericMuxParam::Copy(CPVGenericMuxParam* param)
398 {
399     param->discard_corrupt_video = discard_corrupt_video;
400     param->max_discard_video_sdu_size = max_discard_video_sdu_size;
401     param->err_rate_threshold_to_req_I_frame = err_rate_threshold_to_req_I_frame;
402     param->audio_err_rate_update_interval = audio_err_rate_update_interval;
403     param->audio_encode_frame_delay = audio_encode_frame_delay;
404     param->audio_decode_frame_delay = audio_decode_frame_delay;
405     return;
406 }
407 
408 
409 /* CPVH223MuxParam */
CPVH223MuxParam()410 OSCL_EXPORT_REF CPVH223MuxParam::CPVH223MuxParam() : CPVGenericMuxParam(MUX_H223),
411         iBitrate(PVT_NOT_SET),
412         iLevel(H223_LEVEL_UNKNOWN),
413         iMaxAl1SduSize(PVT_NOT_SET),
414         iMaxAl2SduSize(PVT_NOT_SET),
415         iMaxAl3SduSize(PVT_NOT_SET),
416         iMaxAl1SduSizeR(PVT_NOT_SET),
417         iMaxAl2SduSizeR(PVT_NOT_SET),
418         iMaxAl3SduSizeR(PVT_NOT_SET),
419         iParseOnResyncMarkers(false),
420         iOutgoingPduType(H223_PDU_COMBINED),
421         iMaxPduSize(0),
422         iIdleSyncType(H223_IDLE_SYNC_NONE),
423         iIdleSyncByte(0x00)
424 {
425 }
426 
~CPVH223MuxParam()427 OSCL_EXPORT_REF CPVH223MuxParam::~CPVH223MuxParam()
428 {
429 }
430 
Copy()431 OSCL_EXPORT_REF CPVParam* CPVH223MuxParam::Copy()
432 {
433     CPVH223MuxParam* ret = new CPVH223MuxParam();
434     CPVGenericMuxParam::Copy(ret);
435     ret->iBitrate = iBitrate;
436     ret->iLevel = iLevel;
437     ret->iMaxAl1SduSize = iMaxAl1SduSize;
438     ret->iMaxAl2SduSize = iMaxAl2SduSize;
439     ret->iMaxAl3SduSize = iMaxAl3SduSize;
440     ret->iMaxAl1SduSizeR = iMaxAl1SduSizeR;
441     ret->iMaxAl2SduSizeR = iMaxAl2SduSizeR;
442     ret->iMaxAl3SduSizeR = iMaxAl3SduSizeR;
443     ret->iParseOnResyncMarkers = iParseOnResyncMarkers;
444     ret->iOutgoingPduType = iOutgoingPduType;
445     ret->iMaxPduSize = iMaxPduSize;
446     ret->iIdleSyncType = iIdleSyncType;
447     ret->iIdleSyncByte = iIdleSyncByte;
448     return ret;
449 }
450 
451 /* CPVH245Param */
CPVH245Param()452 OSCL_EXPORT_REF CPVH245Param::CPVH245Param()
453 {
454 }
455 
Copy()456 OSCL_EXPORT_REF CPVParam* CPVH245Param::Copy()
457 {
458     CPVH245Param* ret = new CPVH245Param();
459     return ret;
460 }
461 
462 /* CPVSrpParam */
CPVSrpParam()463 OSCL_EXPORT_REF CPVSrpParam::CPVSrpParam()
464 {
465 
466 }
467 
Copy()468 OSCL_EXPORT_REF CPVParam* CPVSrpParam::Copy()
469 {
470     CPVSrpParam* ret = new CPVSrpParam();
471     return ret;
472 }
473 
474 /* CPVTerminalParam */
CPVTerminalParam(CPVGenericMuxParam * muxParam)475 OSCL_EXPORT_REF CPVTerminalParam::CPVTerminalParam(CPVGenericMuxParam* muxParam): iMuxParam(NULL)
476 {
477     if (muxParam)
478     {
479         iMuxParam = (CPVGenericMuxParam*)muxParam->Copy();
480     }
481 }
482 
CPVTerminalParam(CPVTerminalParam & that)483 OSCL_EXPORT_REF CPVTerminalParam::CPVTerminalParam(CPVTerminalParam& that): CPVParam(that), iMuxParam(NULL)
484 {
485     if (that.iMuxParam)
486     {
487         iMuxParam = (CPVGenericMuxParam*)that.iMuxParam->Copy();
488     }
489 }
490 
491 
~CPVTerminalParam()492 CPVTerminalParam::~CPVTerminalParam()
493 {
494     if (iMuxParam)
495     {
496         delete iMuxParam;
497     }
498 }
499 
500 
SetMuxParam(CPVGenericMuxParam * muxParam)501 OSCL_EXPORT_REF OsclAny CPVTerminalParam::SetMuxParam(CPVGenericMuxParam* muxParam)
502 {
503     if (iMuxParam)
504     {
505         delete iMuxParam;
506     }
507     iMuxParam = (CPVGenericMuxParam*)muxParam->Copy();
508 }
509 
GetMuxParam()510 OSCL_EXPORT_REF CPVGenericMuxParam* CPVTerminalParam::GetMuxParam()
511 {
512     return iMuxParam;
513 }
514 
515 /* CPVH324MParam */
CPVH324MParam(CPVH223MuxParam * h223param)516 OSCL_EXPORT_REF CPVH324MParam::CPVH324MParam(CPVH223MuxParam* h223param) : CPVTerminalParam(h223param), iH245Param(NULL), iSrpParam(NULL)
517 {
518     iAllowAl1Video = false;
519     iAllowAl2Video = true;
520     iAllowAl3Video = true;
521     iUseAl1Video = true;
522     iUseAl2Video = true;
523     iUseAl3Video = true;
524     iVideoLayer = PVT_AL_UNKNOWN;
525     iMasterSlave = PVT_MSD_INDETERMINATE;
526     iForceVideoLayerIfMaster = PVT_AL_UNKNOWN;
527     iForceVideoLayerIfSlave = PVT_AL_UNKNOWN;
528     iSpecifyReceiveAndTransmitCapability = false;
529     iSendRme = false;
530     iSkipMsd = false;
531     iRequestMaxMuxPduSize = 0;
532 }
533 
CPVH324MParam(const CPVH324MParam & that)534 OSCL_EXPORT_REF CPVH324MParam::CPVH324MParam(const CPVH324MParam& that) : CPVTerminalParam((CPVTerminalParam&)that)
535 {
536     iAllowAl1Video = that.iAllowAl1Video;
537     iAllowAl2Video = that.iAllowAl2Video;
538     iAllowAl3Video = that.iAllowAl3Video;
539     iUseAl1Video = that.iUseAl1Video;
540     iUseAl2Video = that.iUseAl2Video;
541     iUseAl3Video = that.iUseAl3Video;
542     iVideoLayer = that.iVideoLayer;
543     iMasterSlave = that.iMasterSlave;
544     iForceVideoLayerIfMaster = that.iForceVideoLayerIfMaster;
545     iForceVideoLayerIfSlave = that.iForceVideoLayerIfSlave;
546     iSpecifyReceiveAndTransmitCapability = that.iSpecifyReceiveAndTransmitCapability;
547     iSendRme = that.iSendRme;
548     iSkipMsd = that.iSkipMsd;
549     iRequestMaxMuxPduSize = that.iRequestMaxMuxPduSize;
550     iH245Param = NULL;
551     if (that.iH245Param)
552         iH245Param = (CPVH245Param*)that.iH245Param->Copy();
553     iSrpParam = NULL;
554     if (that.iSrpParam)
555         iSrpParam = (CPVSrpParam*)that.iSrpParam->Copy();
556 }
557 
~CPVH324MParam()558 OSCL_EXPORT_REF CPVH324MParam::~CPVH324MParam()
559 {
560 
561 }
562 
GetTerminalType()563 OSCL_EXPORT_REF TPVTerminalType CPVH324MParam::GetTerminalType()
564 {
565     return PV_324M;
566 }
567 
Copy()568 OSCL_EXPORT_REF CPVParam* CPVH324MParam::Copy()
569 {
570     return new CPVH324MParam(*this);
571 }
572 
SetH223Param(CPVH223MuxParam * h223Param)573 OSCL_EXPORT_REF OsclAny CPVH324MParam::SetH223Param(CPVH223MuxParam* h223Param)
574 {
575     SetMuxParam(h223Param);
576 }
577 
GetH223Param()578 OSCL_EXPORT_REF CPVH223MuxParam* CPVH324MParam::GetH223Param()
579 {
580     return (CPVH223MuxParam*)GetMuxParam();
581 }
582 
SetSRPParam(CPVSrpParam * srpParam)583 OSCL_EXPORT_REF OsclAny CPVH324MParam::SetSRPParam(CPVSrpParam* srpParam)
584 {
585     iSrpParam = (CPVSrpParam*)srpParam->Copy();
586 }
587 
SetH245Param(CPVH245Param * h245Param)588 OSCL_EXPORT_REF OsclAny CPVH324MParam::SetH245Param(CPVH245Param* h245Param)
589 {
590     iH245Param = (CPVH245Param*)h245Param->Copy();
591 }
592 
TPVVideoEncoderParam()593 OSCL_EXPORT_REF TPVVideoEncoderParam::TPVVideoEncoderParam():
594         video_bitrate(KPVDefaultVideoBitRate),
595         codec(PV_VID_TYPE_MPEG4),
596         video_frame_rate(KPVDefaultFrameRate),
597         air(0),
598         intra_refresh(1),
599         data_partitioning(1),
600         advanced(0),
601         use_gov(0),
602         rvlc(0),
603         use_resync(480),
604         use_hec(0),
605         use_gobsync(0),
606         vos(0),
607         ref_frame_rate(15),
608         orig_frameskip(1),
609         chosen_frame_skip(3),
610         qp(10),
611         qpi(10),
612         cam_low_light_mode(1),
613         cam_saturation_level(55),
614         cam_contrast_level(90),
615         cam_edge_enhance(85),
616         cam_brightness(100),
617         deblocking_filter(0),
618         prefilter(0),
619         prefilter_coeff1(0),
620         prefilter_coeff2(0),
621         prefilter_coeff3(0),
622         buffer_backlog(-55000),
623         qp_max(31),
624         qp_min(1),
625         qp_delta_frame(30),
626         qp_delta_slice(30),
627         iframe_interval(KPVDefaultIFrameInterval),
628         iframe_request_interval(KPVDefaultIFrameRequestInterval)
629 {};
630 
631 
PVCodecTypeToPVMFFormatType(PVCodecType_t aCodecType)632 OSCL_EXPORT_REF PVMFFormatType PVCodecTypeToPVMFFormatType(PVCodecType_t aCodecType)
633 {
634     PVMFFormatType aFormatType = PVMF_MIME_FORMAT_UNKNOWN;
635     switch (aCodecType)
636     {
637         case PV_AUD_TYPE_G723:
638             aFormatType = PVMF_MIME_G723;
639             break;
640         case PV_AUD_TYPE_GSM:
641             aFormatType = PVMF_MIME_AMR_IF2;
642             break;
643         case PV_VID_TYPE_H263:
644             aFormatType = PVMF_MIME_H2632000;
645             break;
646         case PV_VID_TYPE_MPEG4:
647             aFormatType = PVMF_MIME_M4V;
648             break;
649         default:
650             break;
651     }
652     return aFormatType;
653 }
654 
PVMFFormatTypeToPVCodecType(PVMFFormatType aFormatType)655 OSCL_EXPORT_REF PVCodecType_t PVMFFormatTypeToPVCodecType(PVMFFormatType aFormatType)
656 {
657     PVCodecType_t aCodecType = PV_CODEC_TYPE_NONE;
658 
659     if (aFormatType == PVMF_MIME_G723)
660     {
661         aCodecType = PV_AUD_TYPE_G723;
662     }
663     else if (aFormatType == PVMF_MIME_AMR_IF2)
664     {
665         aCodecType = PV_AUD_TYPE_GSM;
666     }
667     else if ((aFormatType == PVMF_MIME_H2632000) || (aFormatType == PVMF_MIME_H2631998))
668     {
669         aCodecType = PV_VID_TYPE_H263;
670     }
671     else if (aFormatType == PVMF_MIME_M4V)
672     {
673         aCodecType = PV_VID_TYPE_MPEG4;
674     }
675     else if (aFormatType == PVMF_MIME_USERINPUT_BASIC_STRING)
676     {
677         aCodecType = PV_UI_BASIC_STRING;
678     }
679     else if (aFormatType == PVMF_MIME_USERINPUT_IA5_STRING)
680     {
681         aCodecType = PV_UI_IA5_STRING;
682     }
683     else if (aFormatType == PVMF_MIME_USERINPUT_GENERAL_STRING)
684     {
685         aCodecType = PV_UI_GENERAL_STRING;
686     }
687     else if (aFormatType == PVMF_MIME_USERINPUT_DTMF)
688     {
689         aCodecType = PV_UI_DTMF;
690     }
691 
692     return aCodecType;
693 }
694 
PVMFFormatTypeToPVMediaType(PVMFFormatType aFormatType)695 OSCL_EXPORT_REF PV2WayMediaType PVMFFormatTypeToPVMediaType(PVMFFormatType aFormatType)
696 {
697     PV2WayMediaType aMediaType = PV_MEDIA_NONE;
698     if (aFormatType.isAudio())
699     {
700         aMediaType = PV_AUDIO;
701     }
702     if (aFormatType.isVideo())
703     {
704         aMediaType = PV_VIDEO;
705     }
706     if (aFormatType.isUserInput())
707     {
708         aMediaType = PV_USER_INPUT;
709     }
710     return aMediaType;
711 }
712 
713 
IndexForAdaptationLayer(TPVAdaptationLayer al)714 OSCL_EXPORT_REF int IndexForAdaptationLayer(TPVAdaptationLayer al)
715 {
716     int ret = -1;
717     switch (al)
718     {
719         case PVT_AL1:
720             ret = 2;
721             break;
722         case PVT_AL2:
723             ret = 3;
724             break;
725         case PVT_AL3:
726             ret = 5;
727             break;
728         default:
729             break;
730     }
731     return ret;
732 }
733 
AdaptationLayerForIndex(int al_index)734 OSCL_EXPORT_REF TPVAdaptationLayer AdaptationLayerForIndex(int al_index)
735 {
736     TPVAdaptationLayer ret = PVT_AL1;
737     switch (al_index)
738     {
739         case 1:
740         case 2:
741             ret = PVT_AL1;
742             break;
743         case 3:
744         case 4:
745             ret = PVT_AL2;
746             break;
747         case 5:
748             ret = PVT_AL3;
749             break;
750     }
751     return ret;
752 }
753 
EplForAdaptationLayer(TPVAdaptationLayer al)754 OSCL_EXPORT_REF ErrorProtectionLevel_t EplForAdaptationLayer(TPVAdaptationLayer al)
755 {
756     ErrorProtectionLevel_t epl = E_EP_LOW;
757     switch (al)
758     {
759         case PVT_AL1:
760             epl = E_EP_LOW;
761             break;
762         case PVT_AL2:
763             epl = E_EP_MEDIUM;
764             break;
765         case PVT_AL3:
766             epl = E_EP_HIGH;
767             break;
768         default:
769             break;
770     }
771     return epl;
772 }
773 
GetMediaType(PVCodecType_t codec)774 OSCL_EXPORT_REF PV2WayMediaType GetMediaType(PVCodecType_t codec)
775 {
776     PV2WayMediaType media_type = PV_MEDIA_NONE;
777     switch (codec)
778     {
779         case PV_AUD_TYPE_G723:
780         case PV_AUD_TYPE_GSM:
781             media_type = PV_AUDIO;
782             break;
783         case PV_VID_TYPE_H263:
784         case PV_VID_TYPE_MPEG4:
785             media_type = PV_VIDEO;
786             break;
787         case PV_UI_BASIC_STRING:
788         case PV_UI_IA5_STRING:
789         case PV_UI_GENERAL_STRING:
790         case PV_UI_DTMF:
791             media_type = PV_USER_INPUT;
792             break;
793         default:
794             break;
795     }
796     return media_type;
797 }
798 
H324ChannelParameters(TPVDirection dir,PVMFFormatType mediaType,unsigned bandwidth)799 OSCL_EXPORT_REF H324ChannelParameters::H324ChannelParameters(TPVDirection dir, PVMFFormatType mediaType, unsigned bandwidth)
800         : iCodecs(NULL)
801 {
802     OSCL_UNUSED_ARG(mediaType);
803     iBandwidth = bandwidth;
804     iCodecs = new Oscl_Vector<FormatCapabilityInfo, OsclMemAllocator>();
805     FormatCapabilityInfo codec_info;
806     codec_info.dir = dir;
807 }
808 
H324ChannelParameters(const H324ChannelParameters & that)809 OSCL_EXPORT_REF H324ChannelParameters::H324ChannelParameters(const H324ChannelParameters& that)
810         : iCodecs(NULL)
811 {
812     iBandwidth = that.iBandwidth;
813 
814     if (that.iCodecs)
815     {
816         iCodecs = new Oscl_Vector<FormatCapabilityInfo, OsclMemAllocator>(*that.iCodecs);
817     }
818 }
819 
~H324ChannelParameters()820 OSCL_EXPORT_REF H324ChannelParameters::~H324ChannelParameters()
821 {
822     if (iCodecs)
823         OSCL_DELETE(iCodecs);
824 }
825 
GetMediaType()826 OSCL_EXPORT_REF PV2WayMediaType H324ChannelParameters::GetMediaType()
827 {
828     if (iCodecs == NULL)
829     {
830         return PV_MEDIA_NONE;
831     }
832     return PVMFFormatTypeToPVMediaType((*iCodecs)[0].format);
833 }
834 
GetBandwidth()835 OSCL_EXPORT_REF unsigned H324ChannelParameters::GetBandwidth()
836 {
837     return iBandwidth;
838 }
839 
SetCodecs(Oscl_Vector<FormatCapabilityInfo,OsclMemAllocator> & codecs)840 OSCL_EXPORT_REF void H324ChannelParameters::SetCodecs(Oscl_Vector<FormatCapabilityInfo, OsclMemAllocator>& codecs)
841 {
842     if (iCodecs)
843     {
844         OSCL_DELETE(iCodecs);
845         iCodecs = NULL;
846     }
847     if (!codecs.size())
848         return;
849 
850     iCodecs = new Oscl_Vector<FormatCapabilityInfo, OsclMemAllocator>(codecs);
851 }
852 
GetCodecs()853 OSCL_EXPORT_REF Oscl_Vector<FormatCapabilityInfo, OsclMemAllocator>* H324ChannelParameters::GetCodecs()
854 {
855     return iCodecs;
856 }
857 
CodecCapabilityInfo()858 OSCL_EXPORT_REF CodecCapabilityInfo::CodecCapabilityInfo()
859         : codec(PV_CODEC_TYPE_NONE),
860         dir(PV_DIRECTION_NONE),
861         max_bitrate(0),
862         min_sample_size(0),
863         max_sample_size(0)
864 {
865 }
866 
Copy()867 OSCL_EXPORT_REF CodecCapabilityInfo* CodecCapabilityInfo::Copy()
868 {
869     CodecCapabilityInfo* ret = new CodecCapabilityInfo();
870     ret->codec = codec;
871     ret->dir = dir;
872     ret->max_bitrate = max_bitrate;
873     return ret;
874 }
875 
VideoCodecCapabilityInfo()876 OSCL_EXPORT_REF VideoCodecCapabilityInfo::VideoCodecCapabilityInfo()
877         : codec_specific_info(NULL),
878         codec_specific_info_len(0)
879 {
880 }
881 
Copy()882 OSCL_EXPORT_REF CodecCapabilityInfo* VideoCodecCapabilityInfo::Copy()
883 {
884     VideoCodecCapabilityInfo* ret = new VideoCodecCapabilityInfo();
885     ret->codec = codec;
886     ret->dir = dir;
887     ret->max_bitrate = max_bitrate;
888     ret->resolutions = resolutions;
889     ret->codec_specific_info_len = codec_specific_info_len;
890     ret->codec_specific_info = (uint8*)OSCL_DEFAULT_MALLOC(codec_specific_info_len);
891     oscl_memcpy(ret->codec_specific_info, codec_specific_info, codec_specific_info_len);
892     return ret;
893 }
894 
GetFormatsString(TPVDirection aDir,PV2WayMediaType aMediaType)895 OSCL_EXPORT_REF const char* GetFormatsString(TPVDirection aDir, PV2WayMediaType aMediaType)
896 {
897     switch (aDir)
898     {
899         case OUTGOING:
900             switch (aMediaType)
901             {
902                 case PV_AUDIO:
903                     return PV_H324_AUDIO_INPUT_FORMATS;
904                 case PV_VIDEO:
905                     return PV_H324_VIDEO_INPUT_FORMATS;
906                 case PV_MULTIPLEXED:
907                     return PV_H324_MUX_INPUT_FORMATS;
908                 default:
909                     break;
910             }
911             break;
912         case INCOMING:
913             switch (aMediaType)
914             {
915                 case PV_AUDIO:
916                     return PV_H324_AUDIO_OUTPUT_FORMATS;
917                 case PV_VIDEO:
918                     return PV_H324_VIDEO_OUTPUT_FORMATS;
919                 case PV_MULTIPLEXED:
920                     return PV_H324_MUX_OUTPUT_FORMATS;
921                 default:
922                     break;
923             }
924             break;
925         default:
926             break;
927     }
928     return NULL;
929 }
930 
GetFormatsValtypeString(TPVDirection aDir,PV2WayMediaType aMediaType)931 OSCL_EXPORT_REF const char* GetFormatsValtypeString(TPVDirection aDir, PV2WayMediaType aMediaType)
932 {
933     switch (aDir)
934     {
935         case OUTGOING:
936             switch (aMediaType)
937             {
938                 case PV_AUDIO:
939                     return PV_H324_AUDIO_INPUT_FORMATS_VALTYPE;
940                 case PV_VIDEO:
941                     return PV_H324_VIDEO_INPUT_FORMATS_VALTYPE;
942                 case PV_MULTIPLEXED:
943                     return PV_H324_MUX_INPUT_FORMATS_VALTYPE;
944                 default:
945                     break;
946             }
947             break;
948         case INCOMING:
949             switch (aMediaType)
950             {
951                 case PV_AUDIO:
952                     return PV_H324_AUDIO_OUTPUT_FORMATS_VALTYPE;
953                 case PV_VIDEO:
954                     return PV_H324_VIDEO_OUTPUT_FORMATS_VALTYPE;
955                 case PV_MULTIPLEXED:
956                     return PV_H324_MUX_OUTPUT_FORMATS_VALTYPE;
957                 default:
958                     break;
959             }
960             break;
961         default:
962             break;
963     }
964     return NULL;
965 }
966 
GetSampleSize(PVMFFormatType aFormatType,uint32 * aMin,uint32 * aMax)967 OSCL_EXPORT_REF void GetSampleSize(PVMFFormatType aFormatType, uint32* aMin, uint32* aMax)
968 {
969     *aMin = *aMax = 0;
970     if (aFormatType == PVMF_MIME_G723)
971     {
972         *aMin = 20;
973         *aMax = 24;
974     }
975     else if (aFormatType == PVMF_MIME_AMR_IF2)
976     {
977         *aMin = 13;
978         *aMax = 31;
979     }
980 }
981 
982 
CodecRequiresFsi(PVCodecType_t codec)983 OSCL_EXPORT_REF bool CodecRequiresFsi(PVCodecType_t codec)
984 {
985     bool ret = false;
986     switch (codec)
987     {
988         case PV_VID_TYPE_MPEG4:
989             ret = true;
990             break;
991         default:
992             break;
993     }
994     return ret;
995 }
996 
997 
998