Lines Matching refs:pC
61 M4VSS3GPP_InternalEditContext *pC );
63 M4VSS3GPP_intCreateMP3OutputFile( M4VSS3GPP_InternalEditContext *pC,
66 M4VSS3GPP_InternalEditContext *pC );
68 M4VSS3GPP_intComputeOutputVideoAndAudioDsi( M4VSS3GPP_InternalEditContext *pC,
71 M4VSS3GPP_InternalEditContext *pC );
117 M4VSS3GPP_InternalEditContext *pC;
137 pC = (M4VSS3GPP_InternalEditContext
140 *pContext = pC;
142 memset((void *)pC, 0,sizeof(M4VSS3GPP_InternalEditContext));
144 if( M4OSA_NULL == pC )
154 pC->uiClipNumber = 0;
155 pC->pClipList = M4OSA_NULL;
156 pC->pTransitionList = M4OSA_NULL;
157 pC->pEffectsList = M4OSA_NULL;
158 pC->pActiveEffectsList = M4OSA_NULL;
159 pC->pActiveEffectsList1 = M4OSA_NULL;
160 pC->bClip1ActiveFramingEffect = M4OSA_FALSE;
161 pC->bClip2ActiveFramingEffect = M4OSA_FALSE;
162 pC->uiCurrentClip = 0;
163 pC->pC1 = M4OSA_NULL;
164 pC->pC2 = M4OSA_NULL;
165 pC->yuv1[0].pac_data = pC->yuv1[1].pac_data = pC->
167 pC->yuv2[0].pac_data = pC->yuv2[1].pac_data = pC->
169 pC->yuv3[0].pac_data = pC->yuv3[1].pac_data = pC->
171 pC->yuv4[0].pac_data = pC->yuv4[1].pac_data = pC->
173 pC->bClip1AtBeginCut = M4OSA_FALSE;
174 pC->iClip1ActiveEffect = 0;
175 pC->iClip2ActiveEffect = 0;
176 pC->bTransitionEffect = M4OSA_FALSE;
177 pC->bSupportSilence = M4OSA_FALSE;
180 * Init PC->ewc members */
182 pC->ewc.dInputVidCts = 0.0;
183 pC->ewc.dOutputVidCts = 0.0;
184 pC->ewc.dATo = 0.0;
185 pC->ewc.iOutputDuration = 0;
186 pC->ewc.VideoStreamType = M4SYS_kVideoUnknown;
187 pC->ewc.uiVideoBitrate = 0;
188 pC->ewc.uiVideoWidth = 0;
189 pC->ewc.uiVideoHeight = 0;
190 pC->ewc.uiVideoTimeScale = 0;
191 pC->ewc.bVideoDataPartitioning = M4OSA_FALSE;
192 pC->ewc.pVideoOutputDsi = M4OSA_NULL;
193 pC->ewc.uiVideoOutputDsiSize = 0;
194 pC->ewc.AudioStreamType = M4SYS_kAudioUnknown;
195 pC->ewc.uiNbChannels = 1;
196 pC->ewc.uiAudioBitrate = 0;
197 pC->ewc.uiSamplingFrequency = 0;
198 pC->ewc.pAudioOutputDsi = M4OSA_NULL;
199 pC->ewc.uiAudioOutputDsiSize = 0;
200 pC->ewc.pAudioEncCtxt = M4OSA_NULL;
201 pC->ewc.pAudioEncDSI.infoSize = 0;
202 pC->ewc.pAudioEncDSI.pInfo = M4OSA_NULL;
203 pC->ewc.uiSilencePcmSize = 0;
204 pC->ewc.pSilenceFrameData = M4OSA_NULL;
205 pC->ewc.uiSilenceFrameSize = 0;
206 pC->ewc.iSilenceFrameDuration = 0;
207 pC->ewc.scale_audio = 0.0;
208 pC->ewc.pEncContext = M4OSA_NULL;
209 pC->ewc.pDummyAuBuffer = M4OSA_NULL;
210 pC->ewc.iMpeg4GovOffset = 0;
211 pC->ewc.VppError = 0;
212 pC->ewc.encoderState = M4VSS3GPP_kNoEncoder;
213 pC->ewc.p3gpWriterContext = M4OSA_NULL;
214 pC->ewc.uiVideoMaxAuSize = 0;
215 pC->ewc.uiAudioMaxAuSize = 0;
218 pC->pOsaFileReadPtr = pFileReadPtrFct;
219 pC->pOsaFileWritPtr = pFileWritePtrFct;
224 err = M4VSS3GPP_clearInterfaceTables(&pC->ShellAPI);
229 err = M4VSS3GPP_subscribeMediaAndCodec(&pC->ShellAPI);
234 pC->State = M4VSS3GPP_kEditState_CREATED;
235 pC->Vstate = M4VSS3GPP_kEditVideoState_READ_WRITE;
236 pC->Astate = M4VSS3GPP_kEditAudioState_READ_WRITE;
238 pC->m_bClipExternalHasStarted = M4OSA_FALSE;
240 pC->bIsMMS = M4OSA_FALSE;
242 pC->iInOutTimeOffset = 0;
243 pC->bEncodeTillEoF = M4OSA_FALSE;
244 pC->nbActiveEffects = 0;
245 pC->nbActiveEffects1 = 0;
246 pC->bIssecondClip = M4OSA_FALSE;
247 pC->m_air_context = M4OSA_NULL;
484 M4VSS3GPP_InternalEditContext *pC =
511 if( ( pC->State != M4VSS3GPP_kEditState_CREATED)
512 && (pC->State != M4VSS3GPP_kEditState_CLOSED) )
516 pC->State);
522 M4VSS3GPP_intFreeSettingsList(pC);
526 pC->uiClipNumber = pSettings->uiClipNumber;
530 pC->pClipList =
532 * pC->uiClipNumber, M4VSS3GPP, (M4OSA_Char *)"pC->pClipList");
534 if( M4OSA_NULL == pC->pClipList )
537 "M4VSS3GPP_editOpen: unable to allocate pC->Settings.pClipList,\
544 M4VSS3GPP_editDuplicateClipSettings(&(pC->pClipList[i]),
554 pC->nbEffects = pSettings->nbEffects;
555 pC->pEffectsList = (M4VSS3GPP_EffectSettings
556 *)M4OSA_32bitAlignedMalloc(sizeof(M4VSS3GPP_EffectSettings) * pC->nbEffects,
557 M4VSS3GPP, (M4OSA_Char *)"pC->pEffectsList");
559 if( M4OSA_NULL == pC->pEffectsList )
562 "M4VSS3GPP_editOpen: unable to allocate pC->pEffectsList, returning M4ERR_ALLOC");
566 for ( i = 0; i < pC->nbEffects; i++ )
568 memcpy((void *) &(pC->pEffectsList[i]),
575 pC->pActiveEffectsList =
576 (M4OSA_UInt8 *)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_UInt8) * pC->nbEffects,
577 M4VSS3GPP, (M4OSA_Char *)"pC->pActiveEffectsList");
579 if( M4OSA_NULL == pC->pActiveEffectsList )
582 "M4VSS3GPP_editOpen: unable to allocate pC->pActiveEffectsList,\
588 pC->pActiveEffectsList1 =
589 (M4OSA_UInt8 *)M4OSA_32bitAlignedMalloc(sizeof(M4OSA_UInt8) * pC->nbEffects,
590 M4VSS3GPP, (M4OSA_Char *)"pC->pActiveEffectsList");
591 if (M4OSA_NULL == pC->pActiveEffectsList1)
593 M4OSA_TRACE1_0("M4VSS3GPP_editOpen: unable to allocate pC->pActiveEffectsList, \
601 pC->nbEffects = 0;
602 pC->nbActiveEffects = 0;
603 pC->nbActiveEffects1 = 0;
604 pC->pEffectsList = M4OSA_NULL;
605 pC->pActiveEffectsList = M4OSA_NULL;
606 pC->pActiveEffectsList1 = M4OSA_NULL;
607 pC->bClip1ActiveFramingEffect = M4OSA_FALSE;
608 pC->bClip2ActiveFramingEffect = M4OSA_FALSE;
613 for ( i = 0; i < pC->uiClipNumber; i++ )
615 if( M4OSA_FALSE == pC->pClipList[i].ClipProperties.bAnalysed )
618 err = M4VSS3GPP_editAnalyseClip(pC->pClipList[i].pFile,
619 pC->pClipList[i].FileType, &pC->pClipList[i].ClipProperties,
620 pC->pOsaFileReadPtr);
634 for ( i = 0; i < pC->uiClipNumber; i++ )
636 if (pC->pClipList[i].FileType !=M4VIDEOEDITING_kFileType_ARGB8888) {
640 &pC->pClipList[i].ClipProperties);
656 if(pC->pClipList[i].FileType != M4VIDEOEDITING_kFileType_ARGB8888) {
659 &pC->pClipList[pSettings->uiMasterClip].ClipProperties,
660 &pC->pClipList[i].ClipProperties);
671 pC->pClipList[i].ClipProperties.bAudioIsCompatibleWithMasterClip =
680 for ( i = 0; i < pC->uiClipNumber; i++ )
682 if( M4OSA_FALSE == pC->pClipList[i].ClipProperties.bAudioIsEditable )
686 for ( uiFx = 0; uiFx < pC->nbEffects; uiFx++ )
688 pC->pEffectsList[uiFx].AudioEffectType
692 if( ( i < (pC->uiClipNumber - 1))
694 && (M4OSA_FALSE == pC->pClipList[pSettings->
706 pC->pTransitionList = (M4VSS3GPP_TransitionSettings
708 * (pC->uiClipNumber), M4VSS3GPP, (M4OSA_Char *)"pC->pTransitionList");
710 if( M4OSA_NULL == pC->pTransitionList )
713 "M4VSS3GPP_editOpen: unable to allocate pC->Settings.pTransitionList,\
721 memcpy((void *) &(pC->pTransitionList[i]),
727 pC->pTransitionList[pC->uiClipNumber - 1].uiTransitionDuration = 0;
728 pC->pTransitionList[pC->uiClipNumber
730 pC->pTransitionList[pC->uiClipNumber
737 if (pC->pClipList[i].FileType !=M4VIDEOEDITING_kFileType_ARGB8888) {
738 err = M4VSS3GPP_intClipSettingsSanityCheck(&pC->pClipList[i]);
752 if (pC->pTransitionList[i].uiTransitionDuration != 0) {
753 if (pC->pClipList[i].FileType == M4VIDEOEDITING_kFileType_ARGB8888) {
754 pC->pClipList[i].uiBeginCutTime = 0;
755 pC->pClipList[i].uiEndCutTime =
756 pC->pTransitionList[i].uiTransitionDuration;
759 if (pC->pClipList[i+1].FileType == M4VIDEOEDITING_kFileType_ARGB8888) {
760 pC->pClipList[i+1].uiBeginCutTime = 0;
761 pC->pClipList[i+1].uiEndCutTime =
762 pC->pTransitionList[i].uiTransitionDuration;
766 if (pC->pClipList[i].FileType == M4VIDEOEDITING_kFileType_ARGB8888) {
767 pC->pClipList[i].uiEndCutTime =
768 pC->pClipList[i].uiEndCutTime - pC->pClipList[i].uiBeginCutTime;
769 pC->pClipList[i].uiBeginCutTime = 0;
772 if (pC->pClipList[i+1].FileType == M4VIDEOEDITING_kFileType_ARGB8888) {
773 pC->pClipList[i+1].uiEndCutTime =
774 pC->pClipList[i+1].uiEndCutTime - pC->pClipList[i+1].uiBeginCutTime;
775 pC->pClipList[i+1].uiBeginCutTime = 0;
783 if( 0 == pC->pClipList[i].uiEndCutTime )
785 uiC1duration = pC->pClipList[i].ClipProperties.uiClipVideoDuration;
790 uiC1duration = pC->pClipList[i].uiEndCutTime;
794 uiC1duration -= pC->pClipList[i].uiBeginCutTime;
797 if( pC->pTransitionList[i].uiTransitionDuration > uiC1duration )
799 pC->pTransitionList[i].uiTransitionDuration = uiC1duration - 1;
802 if( 0 == pC->pClipList[i + 1].uiEndCutTime )
805 pC->pClipList[i + 1].ClipProperties.uiClipVideoDuration;
810 uiC2duration = pC->pClipList[i + 1].uiEndCutTime;
814 uiC2duration -= pC->pClipList[i + 1].uiBeginCutTime;
817 if( pC->pTransitionList[i].uiTransitionDuration > uiC2duration )
819 pC->pTransitionList[i].uiTransitionDuration = uiC2duration - 1;
825 M4VSS3GPP_intTransitionSettingsSanityCheck(&pC->pTransitionList[i]);
844 if( ( pC->pTransitionList[i - 1].uiTransitionDuration
845 + pC->pTransitionList[i].uiTransitionDuration) >= uiC1duration )
858 for ( i = 0; i < pC->uiClipNumber; i++ )
862 if( 0 == pC->pClipList[i].uiEndCutTime )
864 pC
865 pC->
873 pC->ewc.iOutputDuration +=
874 pC->pClipList[i].uiEndCutTime; /**< Add end cut */
877 pC->ewc.iOutputDuration -=
878 pC->pClipList[i].uiBeginCutTime; /**< Remove begin cut */
882 pC->ewc.iOutputDuration -= pC->pTransitionList[i].uiTransitionDuration;
888 switch(pC->xVSS.outputVideoSize) {
890 pC->ewc.uiVideoWidth = 128;
891 pC->ewc.uiVideoHeight = 96;
894 pC->ewc.uiVideoWidth = 160;
895 pC->ewc.uiVideoHeight = 120;
898 pC->ewc.uiVideoWidth = 176;
899 pC->ewc.uiVideoHeight = 144;
902 pC->ewc.uiVideoWidth = 320;
903 pC->ewc.uiVideoHeight = 240;
906 pC->ewc.uiVideoWidth = 352;
907 pC->ewc.uiVideoHeight = 288;
910 pC->ewc.uiVideoWidth = 640;
911 pC->ewc.uiVideoHeight = 480;
915 pC->ewc.uiVideoWidth = 800;
916 pC->ewc.uiVideoHeight = 480;
919 pC->ewc.uiVideoWidth = 720;
920 pC->ewc.uiVideoHeight = 480;
925 pC->ewc.uiVideoWidth = 640;
926 pC->ewc.uiVideoHeight = 360;
930 pC->ewc.uiVideoWidth = M4ENCODER_854_480_Width;
931 pC->ewc.uiVideoHeight = 480;
935 pC->ewc.uiVideoWidth = 1280;
936 pC->ewc.uiVideoHeight = 720;
939 pC->ewc.uiVideoWidth = M4ENCODER_1080_720_Width;
941 pC->ewc.uiVideoHeight = 720;
944 pC->ewc.uiVideoWidth = 960;
945 pC->ewc.uiVideoHeight = 720;
948 pC->ewc.uiVideoWidth = 1920;
949 pC->ewc.uiVideoHeight = 1088; // need to be multiples of 16
955 pC->ewc.uiVideoWidth = 176;
956 pC->ewc.uiVideoHeight = 144;
957 pC->xVSS.outputVideoSize = M4VIDEOEDITING_kQCIF;
961 pC->ewc.uiVideoTimeScale = 30;
962 pC->ewc.bVideoDataPartitioning = 0;
964 pC->ewc.outputVideoProfile = pC->xVSS.outputVideoProfile;
965 pC->ewc.outputVideoLevel = pC->xVSS.outputVideoLevel;
967 switch(pC->xVSS.outputVideoFormat) {
969 pC->ewc.VideoStreamType = M4SYS_kH263;
972 pC->ewc.VideoStreamType = M4SYS_kMPEG_4;
975 pC->ewc.VideoStreamType = M4SYS_kH264;
978 pC->ewc.VideoStreamType = M4SYS_kVideoUnknown;
984 pC->ewc.uiNbChannels =
985 pC->pClipList[pSettings->uiMasterClip].ClipProperties.uiNbChannels;
986 pC->ewc.uiAudioBitrate =
987 pC->pClipList[pSettings->uiMasterClip].ClipProperties.uiAudioBitrate;
988 pC->ewc.uiSamplingFrequency = pC->pClipList[pSettings->
990 pC->ewc.uiSilencePcmSize =
991 pC->pClipList[pSettings->uiMasterClip].ClipProperties.uiDecodedPcmSize;
992 pC->ewc.scale_audio = pC->ewc.uiSamplingFrequency / 1000.0;
994 switch( pC->pClipList[pSettings->uiMasterClip].ClipProperties.AudioStreamType )
997 pC->ewc.AudioStreamType = M4SYS_kAMR;
998 pC->ewc.pSilenceFrameData =
1000 pC->ewc.uiSilenceFrameSize =
1002 pC->ewc.iSilenceFrameDuration =
1004 pC->bSupportSilence = M4OSA_TRUE;
1010 pC->ewc.AudioStreamType = M4SYS_kAAC;
1012 if( pC->ewc.uiNbChannels == 1 )
1014 pC->ewc.pSilenceFrameData =
1016 pC->ewc.uiSilenceFrameSize = M4VSS3GPP_AAC_AU_SILENCE_MONO_SIZE;
1017 pC->bSupportSilence = M4OSA_TRUE;
1021 pC->ewc.pSilenceFrameData =
1023 pC->ewc.uiSilenceFrameSize =
1025 pC->bSupportSilence = M4OSA_TRUE;
1027 pC->ewc.iSilenceFrameDuration =
1032 pC->ewc.AudioStreamType = M4SYS_kMP3;
1033 pC->ewc.pSilenceFrameData = M4OSA_NULL;
1034 pC->ewc.uiSilenceFrameSize = 0;
1035 pC->ewc.iSilenceFrameDuration = 0;
1037 pC->ewc.scale_audio = 1.0;
1041 pC->ewc.AudioStreamType = M4SYS_kEVRC;
1042 pC->ewc.pSilenceFrameData = M4OSA_NULL;
1043 pC->ewc.uiSilenceFrameSize = 0;
1044 pC->ewc.iSilenceFrameDuration = 160; /* EVRC frames are 20 ms at 8000 Hz
1049 pC->ewc.AudioStreamType = M4SYS_kAudioUnknown;
1053 for (i=0; i<pC->uiClipNumber; i++) {
1054 if (pC->pClipList[i].bTranscodingRequired == M4OSA_FALSE) {
1058 if ((pC->pClipList[i].ClipProperties.VideoStreamType !=
1059 pC->xVSS.outputVideoFormat)||
1060 (pC->pClipList[i].ClipProperties.uiVideoWidth !=
1061 pC->ewc.uiVideoWidth) ||
1062 (pC->pClipList[i].ClipProperties.uiVideoHeight !=
1063 pC->ewc.uiVideoHeight) ||
1064 (pC->pClipList[i].ClipProperties.VideoStreamType ==
1066 (pC->pClipList[i].ClipProperties.VideoStreamType ==
1068 pC->pClipList[i].ClipProperties.uiVideoTimeScale !=
1069 pC->ewc.uiVideoTimeScale)) {
1070 pC->pClipList[i].bTranscodingRequired = M4OSA_TRUE;
1076 pC->pClipList[i].bTranscodingRequired = M4OSA_FALSE;
1081 if( M4VIDEOEDITING_kMP3 == pC->
1089 if( 0 == pC->ewc.iOutputDuration )
1091 pC->ewc.iOutputDuration = 1;
1096 pC->uiCurrentClip = 0;
1099 pC->ewc.dInputVidCts = 0.0;
1100 pC->ewc.dOutputVidCts = 0.0;
1101 pC->ewc.dATo = 0.0;
1103 err = M4VSS3GPP_intSwitchToNextClip(pC);
1119 err = M4VSS3GPP_intComputeOutputVideoAndAudioDsi(pC,
1135 pC->dOutputFrameDuration = 1000.0 / 5.0;
1139 pC->dOutputFrameDuration = 1000.0 / 7.5;
1143 pC->dOutputFrameDuration = 1000.0 / 10.0;
1147 pC->dOutputFrameDuration = 1000.0 / 12.5;
1151 pC->dOutputFrameDuration = 1000.0 / 15.0;
1155 pC->dOutputFrameDuration = 1000.0 / 20.0;
1159 pC->dOutputFrameDuration = 1000.0 / 25.0;
1163 pC->dOutputFrameDuration = 1000.0 / 30.0;
1174 if( M4SYS_kMPEG_4 == pC->ewc.VideoStreamType )
1187 uiAlpha = (M4OSA_UInt32)(( pC->dOutputFrameDuration
1188 * pC->ewc.uiVideoTimeScale) / 1000.0 + 0.5);
1192 pC->dOutputFrameDuration =
1193 ( uiAlpha * 1000.0) / pC->ewc.uiVideoTimeScale;
1196 else if( M4SYS_kH263 == pC->ewc.VideoStreamType )
1218 err = M4VSS3GPP_intCreateMP3OutputFile(pC, pSettings->pOutputFile);
1235 err = pC->pC1->ShellAPI.m_pReader->m_pFctGetOption(
1236 pC->pC1->pReaderContext, M4READER_kOptionID_Mp3Id3v2Tag,
1249 err = pC->pOsaFileWritPtr->writeData(pC->ewc.p3gpWriterContext,
1274 pC->ewc.uiVideoBitrate = pSettings->xVSS.outputVideoBitrate;
1278 if( pC->bIsMMS == M4OSA_TRUE )
1280 err = M4VSS3GPP_intCreate3GPPOutputFile(&pC->ewc, &pC->ShellAPI,
1281 pC->pOsaFileWritPtr, pSettings->pOutputFile,
1282 pC->pOsaFileReadPtr, pSettings->pTemporaryFile,
1287 err = M4VSS3GPP_intCreate3GPPOutputFile(&pC->ewc, &pC->ShellAPI,
1288 pC->pOsaFileWritPtr, pSettings->pOutputFile,
1289 pC->pOsaFileReadPtr, pSettings->pTemporaryFile, 0);
1315 if( M4SYS_kMP3 == pC->ewc.AudioStreamType )
1319 pC->State = M4VSS3GPP_kEditState_MP3_JUMP;
1325 pC
1332 pC->Vstate = M4VSS3GPP_kEditVideoState_READ_WRITE;
1333 pC->Astate = M4VSS3GPP_kEditAudioState_READ_WRITE;
1359 M4VSS3GPP_InternalEditContext *pC =
1375 switch( pC->State )
1378 err = M4VSS3GPP_intEditStepVideo(pC);
1382 err = M4VSS3GPP_intEditStepAudio(pC);
1386 err = M4VSS3GPP_intEditStepMP3(pC);
1390 err = M4VSS3GPP_intEditJumpMP3(pC);
1404 ( (M4OSA_UInt32)(pC->ewc.dATo * 100)) / pC->ewc.iOutputDuration;
1406 uiProgressVideo = ((M4OSA_UInt32)(pC->ewc.dInputVidCts * 100)) / pC->ewc.iOutputDuration;
1410 if( ( pC->ewc.AudioStreamType != M4SYS_kAudioUnknown)
1411 && (pC->ewc.VideoStreamType != M4SYS_kVideoUnknown) )
1444 M4VSS3GPP_InternalEditContext *pC =
1462 if( M4VSS3GPP_kEditState_CLOSED == pC->State )
1466 pC->State);
1472 err = M4VSS3GPP_intDestroyVideoEncoder(pC);
1485 if( M4SYS_kMP3 == pC->ewc.AudioStreamType )
1489 if( M4OSA_NULL != pC->ewc.p3gpWriterContext )
1491 err = pC->pOsaFileWritPtr->closeWrite(pC->ewc.p3gpWriterContext);
1492 pC->ewc.p3gpWriterContext = M4OSA_NULL;
1499 if( M4OSA_NULL != pC->ewc.p3gpWriterContext )
1502 lastCTS = pC->ewc.iOutputDuration;
1504 err = pC->ShellAPI.pWriterGlobalFcts->pFctSetOption(
1505 pC->ewc.p3gpWriterContext,
1515 err = pC->ShellAPI.pWriterGlobalFcts->pFctCloseWrite(
1516 pC->ewc.p3gpWriterContext);
1530 pC->ewc.p3gpWriterContext = M4OSA_NULL;
1536 if( M4OSA_NULL != pC->ewc.pVideoOutputDsi )
1538 free(pC->ewc.pVideoOutputDsi);
1539 pC->ewc.pVideoOutputDsi = M4OSA_NULL;
1544 if( M4OSA_NULL != pC->ewc.pAudioOutputDsi )
1546 free(pC->ewc.pAudioOutputDsi);
1547 pC->ewc.pAudioOutputDsi = M4OSA_NULL;
1552 if( M4OSA_NULL != pC->pC1 )
1554 err = M4VSS3GPP_intClipCleanUp(pC->pC1);
1568 pC->pC1 = M4OSA_NULL;
1573 if( M4OSA_NULL != pC->pC2 )
1575 err = M4VSS3GPP_intClipCleanUp(pC->pC2);
1589 pC->pC2 = M4OSA_NULL;
1594 if( M4OSA_NULL != pC->yuv1[0].pac_data )
1596 free(pC->yuv1[0].pac_data);
1597 pC->yuv1[0].pac_data = M4OSA_NULL;
1600 if( M4OSA_NULL != pC->yuv1[1].pac_data )
1602 free(pC->yuv1[1].pac_data);
1603 pC->yuv1[1].pac_data = M4OSA_NULL;
1606 if( M4OSA_NULL != pC->yuv1[2].pac_data )
1608 free(pC->yuv1[2].pac_data);
1609 pC->yuv1[2].pac_data = M4OSA_NULL;
1612 if( M4OSA_NULL != pC->yuv2[0].pac_data )
1614 free(pC->yuv2[0].pac_data);
1615 pC->yuv2[0].pac_data = M4OSA_NULL;
1618 if( M4OSA_NULL != pC->yuv2[1].pac_data )
1620 free(pC->yuv2[1].pac_data);
1621 pC->yuv2[1].pac_data = M4OSA_NULL;
1624 if( M4OSA_NULL != pC->yuv2[2].pac_data )
1626 free(pC->yuv2[2].pac_data);
1627 pC->yuv2[2].pac_data = M4OSA_NULL;
1631 if( M4OSA_NULL != pC->yuv3[0].pac_data )
1633 free(pC->yuv3[0].pac_data);
1634 pC->yuv3[0].pac_data = M4OSA_NULL;
1637 if( M4OSA_NULL != pC->yuv3[1].pac_data )
1639 free(pC->yuv3[1].pac_data);
1640 pC->yuv3[1].pac_data = M4OSA_NULL;
1643 if( M4OSA_NULL != pC->yuv3[2].pac_data )
1645 free(pC->yuv3[2].pac_data);
1646 pC->yuv3[2].pac_data = M4OSA_NULL;
1650 if( M4OSA_NULL != pC->yuv4[0].pac_data )
1652 free(pC->yuv4[0].pac_data);
1653 pC->yuv4[0].pac_data = M4OSA_NULL;
1656 if( M4OSA_NULL != pC->yuv4[1].pac_data )
1658 free(pC->yuv4[1].pac_data);
1659 pC->yuv4[1].pac_data = M4OSA_NULL;
1662 if( M4OSA_NULL != pC->yuv4[2].pac_data )
1664 free(pC->yuv4[2].pac_data);
1665 pC->yuv4[2].pac_data = M4OSA_NULL;
1670 if( pC->pEffectsList != M4OSA_NULL )
1672 free(pC->pEffectsList);
1673 pC->pEffectsList = M4OSA_NULL;
1678 if( pC->pActiveEffectsList != M4OSA_NULL )
1680 free(pC->pActiveEffectsList);
1681 pC->pActiveEffectsList = M4OSA_NULL;
1685 if(pC->pActiveEffectsList1 != M4OSA_NULL)
1687 free(pC->pActiveEffectsList1);
1688 pC->pActiveEffectsList1 = M4OSA_NULL;
1690 if(pC->m_air_context != M4OSA_NULL) {
1691 free(pC->m_air_context);
1692 pC->m_air_context = M4OSA_NULL;
1696 pC->State = M4VSS3GPP_kEditState_CLOSED;
1717 M4VSS3GPP_InternalEditContext *pC =
1736 if( M4VSS3GPP_kEditState_CLOSED != pC->State )
1739 err = M4VSS3GPP_editClose(pC);
1751 if( M4OSA_NULL != pC->ewc.pDummyAuBuffer )
1753 free(pC->ewc.pDummyAuBuffer);
1754 pC->ewc.pDummyAuBuffer = M4OSA_NULL;
1759 if( M4OSA_NULL != pC->ewc.pAudioEncCtxt )
1761 err = pC->ShellAPI.pAudioEncoderGlobalFcts->pFctClose(
1762 pC->ewc.pAudioEncCtxt);
1772 err = pC->ShellAPI.pAudioEncoderGlobalFcts->pFctCleanUp(
1773 pC->ewc.pAudioEncCtxt);
1783 pC->ewc.pAudioEncCtxt = M4OSA_NULL;
1788 M4VSS3GPP_unRegisterAllWriters(&pC->ShellAPI);
1789 M4VSS3GPP_unRegisterAllEncoders(&pC->ShellAPI);
1790 M4VSS3GPP_unRegisterAllReaders(&pC->ShellAPI);
1791 M4VSS3GPP_unRegisterAllDecoders(&pC->ShellAPI);
1795 M4VSS3GPP_intFreeSettingsList(pC);
1799 free(pC);
1800 pC = M4OSA_NULL;
2168 * @param pC (IN/OUT) Internal edit context
2172 M4VSS3GPP_InternalEditContext *pC )
2178 if( M4OSA_NULL != pC->pClipList )
2180 for ( i = 0; i < pC->uiClipNumber; i++ )
2182 M4VSS3GPP_editFreeClipSettings(&(pC->pClipList[i]));
2185 free(pC->pClipList);
2186 pC->pClipList = M4OSA_NULL;
2191 if( M4OSA_NULL != pC->pTransitionList )
2193 free(pC->pTransitionList);
2194 pC->pTransitionList = M4OSA_NULL;
2201 * @param pC (IN/OUT) Internal edit context
2205 M4VSS3GPP_intCreateMP3OutputFile( M4VSS3GPP_InternalEditContext *pC,
2211 pC->pOsaFileWritPtr->openWrite(&pC->ewc.p3gpWriterContext, pOutputFile,
2229 * @param pC (IN/OUT) Internal edit context
2602 * @param pC (IN/OUT) Internal edit context
2606 M4VSS3GPP_intComputeOutputVideoAndAudioDsi( M4VSS3GPP_InternalEditContext *pC,
2626 if( M4SYS_kH263 == pC->ewc.VideoStreamType )
2630 pC->ewc.uiVideoOutputDsiSize = 7;
2631 pC->ewc.pVideoOutputDsi =
2632 (M4OSA_MemAddr8)M4OSA_32bitAlignedMalloc(pC->ewc.uiVideoOutputDsiSize,
2633 M4VSS3GPP, (M4OSA_Char *)"pC->ewc.pVideoOutputDsi (H263)");
2635 if( M4OSA_NULL == pC->ewc.pVideoOutputDsi )
2647 pC->ewc.pVideoOutputDsi[0] = 'P';
2648 pC->ewc.pVideoOutputDsi[1] = 'H';
2649 pC->ewc.pVideoOutputDsi[2] = 'L';
2650 pC->ewc.pVideoOutputDsi[3] = 'P';
2654 pC->ewc.pVideoOutputDsi[4] = 0;
2658 pC->ewc.pVideoOutputDsi[5] = pC->xVSS.outputVideoLevel;
2662 pC->ewc.pVideoOutputDsi[6] = pC->xVSS.outputVideoProfile;
2667 else if( M4SYS_kMPEG_4 == pC->ewc.VideoStreamType ||
2668 M4SYS_kH264 == pC->ewc.VideoStreamType) {
2677 if( M4OSA_NULL == pC->ewc.pEncContext )
2680 "M4VSS3GPP_intComputeOutputVideoAndAudioDsi: pC->ewc.pEncContext is NULL");
2681 err = M4VSS3GPP_intCreateVideoEncoder(pC);
2692 if( M4OSA_NULL != pC->ewc.pEncContext )
2694 err = pC->ShellAPI.pVideoEncoderGlobalFcts->pFctGetOption(
2695 pC->ewc.pEncContext, M4ENCODER_kOptionID_EncoderHeader,
2716 pC->ewc.pVideoOutputDsi =
2718 (M4OSA_Char *)"pC->ewc.pVideoOutputDsi (H264)");
2720 if( M4OSA_NULL == pC->ewc.pVideoOutputDsi )
2727 pC->ewc.uiVideoOutputDsiSize = (M4OSA_UInt16)encHeader->Size;
2728 memcpy((void *)pC->ewc.pVideoOutputDsi, (void *)encHeader->pBuf,
2732 err = M4VSS3GPP_intDestroyVideoEncoder(pC);
2746 pC->ewc.pEncContext is NULL, cannot get the DSI");
2754 if( M4SYS_kAudioUnknown != pC->ewc.AudioStreamType )
2759 pStreamForDsi = &(pC->pC1->pAudioStream->m_basicProperties);
2765 err = M4VSS3GPP_intClipInit(&pClip, pC->pOsaFileReadPtr);
2781 err = M4VSS3GPP_intClipOpen(pClip, &pC->pClipList[uiMasterClip],
2799 pC->ewc.pAudioOutputDsi = (M4OSA_MemAddr8)M4OSA_32bitAlignedMalloc(
2801 M4VSS3GPP, (M4OSA_Char *)"pC->ewc.pAudioOutputDsi");
2803 if( M4OSA_NULL == pC->ewc.pAudioOutputDsi )
2810 pC->ewc.uiAudioOutputDsiSize =
2812 memcpy((void *)pC->ewc.pAudioOutputDsi,
2814 pC->ewc.uiAudioOutputDsiSize);
2844 * @param pC (IN/OUT) Internal edit context
2848 M4VSS3GPP_InternalEditContext *pC )
2852 if( M4OSA_NULL != pC->pC1 )
2854 if (M4OSA_NULL != pC->pC1->m_pPreResizeFrame) {
2855 if (M4OSA_NULL != pC->pC1->m_pPreResizeFrame[0].pac_data) {
2856 free(pC->pC1->m_pPreResizeFrame[0].pac_data);
2857 pC->pC1->m_pPreResizeFrame[0].pac_data = M4OSA_NULL;
2859 if (M4OSA_NULL != pC->pC1->m_pPreResizeFrame[1].pac_data) {
2860 free(pC->pC1->m_pPreResizeFrame[1].pac_data);
2861 pC->pC1->m_pPreResizeFrame[1].pac_data = M4OSA_NULL;
2863 if (M4OSA_NULL != pC->pC1->m_pPreResizeFrame[2].pac_data) {
2864 free(pC->pC1->m_pPreResizeFrame[2].pac_data);
2865 pC->pC1->m_pPreResizeFrame[2].pac_data = M4OSA_NULL;
2867 free(pC->pC1->m_pPreResizeFrame);
2868 pC->pC1->m_pPreResizeFrame = M4OSA_NULL;
2872 err = M4VSS3GPP_intClipCleanUp(pC->pC1);
2884 pC->uiCurrentClip++;
2889 if( pC->uiCurrentClip >= pC->uiClipNumber )
2891 pC->pC1 = M4OSA_NULL;
2892 pC->State = M4VSS3GPP_kEditState_FINISHED;
2902 if( M4OSA_NULL != pC->pC2 )
2904 pC->pC1 = pC->pC2;
2905 if(M4OSA_NULL != pC->pC2->m_pPreResizeFrame) {
2906 pC->pC1->m_pPreResizeFrame = pC->pC2->m_pPreResizeFrame;
2908 pC->pC2 = M4OSA_NULL;
2909 pC->bClip1ActiveFramingEffect = pC->bClip2ActiveFramingEffect;
2910 pC->bClip2ActiveFramingEffect = M4OSA_FALSE;
2916 err = M4VSS3GPP_intOpenClip(pC, &pC->pC1,
2917 &pC->pClipList[pC->uiCurrentClip]);
2937 pC->pC1->iVoffset += (M4OSA_UInt32)pC->ewc.dInputVidCts;
2940 pC->pC1->iAoffset +=
2941 (M4OSA_UInt32)(pC->ewc.dATo * pC->ewc.scale_audio + 0.5);
2950 if( ( pC->pC1->iAoffset
2951 - (M4OSA_Int32)(pC->pC1->iVoffset *pC->pC1->scale_audio + 0.5))
2952 > pC->ewc.iSilenceFrameDuration )
2956 err = M4VSS3GPP_intClipReadNextAudioFrame(pC->pC1);
2968 pC->pC1->iAoffset -= pC->ewc.iSilenceFrameDuration;
2974 if( M4SYS_kMP3 == pC->ewc.AudioStreamType )
2978 pC->State = M4VSS3GPP_kEditState_MP3_JUMP;
2984 pC->State = M4VSS3GPP_kEditState_VIDEO;
2986 if( pC->Vstate != M4VSS3GPP_kEditVideoState_TRANSITION )
2989 pC->Vstate = M4VSS3GPP_kEditVideoState_READ_WRITE;
2993 pC->m_bClipExternalHasStarted = M4OSA_FALSE;
2994 pC->bEncodeTillEoF = M4OSA_FALSE;
3008 * @param pC (IN/OUT) Internal edit context
3011 M4OSA_ERR M4VSS3GPP_intReachedEndOfVideo( M4VSS3GPP_InternalEditContext *pC )
3017 if( M4SYS_kAudioUnknown != pC->ewc.AudioStreamType )
3019 pC->State = M4VSS3GPP_kEditState_AUDIO;
3025 err = M4VSS3GPP_intSwitchToNextClip(pC);
3046 * @param pC (IN/OUT) Internal edit context
3049 M4OSA_ERR M4VSS3GPP_intReachedEndOfAudio( M4VSS3GPP_InternalEditContext *pC )
3055 err = M4VSS3GPP_intSwitchToNextClip(pC);
3067 if( M4SYS_kVideoUnknown != pC->ewc.VideoStreamType )
3069 pC->State = M4VSS3GPP_kEditState_VIDEO;
3082 * @param pC (IN/OUT) Internal edit context
3085 M4OSA_ERR M4VSS3GPP_intOpenClip( M4VSS3GPP_InternalEditContext *pC,
3098 err = M4VSS3GPP_intClipInit(hClip, pC->pOsaFileReadPtr);
3139 pClip->uiSilencePcmSize = pC->ewc.uiSilencePcmSize;
3140 pClip->pSilenceFrameData = pC->ewc.pSilenceFrameData;
3141 pClip->uiSilenceFrameSize = pC->ewc.uiSilenceFrameSize;
3142 pClip->iSilenceFrameDuration = pC->ewc.iSilenceFrameDuration;
3143 pClip->scale_audio = pC->ewc.scale_audio;
3165 if( M4SYS_kVideoUnknown != pC->ewc.VideoStreamType )
3188 if( M4SYS_kAudioUnknown != pC->ewc.AudioStreamType )
3222 if( M4SYS_kVideoUnknown != pC->ewc.VideoStreamType )
3259 if (((M4OSA_UInt32)pC->ewc.uiVideoWidth !=
3261 ((M4OSA_UInt32)pC->ewc.uiVideoHeight !=
3356 if( ( M4SYS_kAudioUnknown != pC->ewc.AudioStreamType)
3387 * @param pC (IN/OUT) Internal edit context
3391 M4VSS3GPP_InternalEditContext *pC )
3408 for ( i = 0; i < pC->uiClipNumber; i++ )
3410 pCS_1 = &pC->pClipList[i];
3420 pCS_0 = &pC->pClipList[i - 1];
3421 pT0 = &pC->pTransitionList[i - 1];
3436 if( i < pC->uiClipNumber - 1 )
3438 pCS_2 = &pC->pClipList[i + 1];
3439 pT2 = &pC->pTransitionList[i];
3473 pC->ewc.uiVideoBitrate = ( total_bitsum / total_duration) * 1000;