Revision: 201015
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 12:40:58 +0300
changeset 17 880d946921e4
parent 15 50d5061ee01e
child 19 69c8bb60738b
Revision: 201015 Kit: 201018
camcordermmfplugin/filecomposer/Inc/CamC3GPDataSinkImp.h
camcordermmfplugin/filecomposer/Src/CamC3GPDataSinkImp.cpp
camcordermmfplugin/mediarecorder/Inc/CCMRVideoRecorder.h
camcordermmfplugin/mediarecorder/Src/CCMRAudioInput.cpp
camcordermmfplugin/mediarecorder/Src/CCMRMDFVideoRecorder.cpp
configmanagers/imagingconfigmanager/conf/imagingconfigmanager.confml
--- a/camcordermmfplugin/filecomposer/Inc/CamC3GPDataSinkImp.h	Fri Apr 16 15:08:44 2010 +0300
+++ b/camcordermmfplugin/filecomposer/Inc/CamC3GPDataSinkImp.h	Mon May 03 12:40:58 2010 +0300
@@ -235,6 +235,30 @@
         * @return None
         */
         void ConvertNALEncapsulationToNALSizes( CCMRMediaBuffer* aBuffer );
+        
+        /**
+        * Compose UDTA (User Data) to video file
+        * @since 5.2
+        * @param None
+        * @return None
+        */
+        void ComposeUDTAL();
+        
+        /**
+        * Convert 32bit unsigned value to little endian format into buffer
+        * @since 5.2
+        * @param None
+        * @return None
+        */
+        void LittleEndianPut32(TUint8 *aPtr, TUint32 aVal);
+
+        /**
+        * Convert 16bit unsigned value to little endian format into buffer
+        * @since 5.2
+        * @param None
+        * @return None
+        */
+        void LittleEndianPut16(TUint8 *aPtr, TUint16 aVal);
 
     private:
 
--- a/camcordermmfplugin/filecomposer/Src/CamC3GPDataSinkImp.cpp	Fri Apr 16 15:08:44 2010 +0300
+++ b/camcordermmfplugin/filecomposer/Src/CamC3GPDataSinkImp.cpp	Mon May 03 12:40:58 2010 +0300
@@ -740,6 +740,15 @@
         PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Setting async file remover handler FAILED")));
         }
 
+    if ((iFileCodecType & MP4_TYPE_MPEG4_VIDEO)    ||
+        (iFileCodecType & MP4_TYPE_AVC_PROFILE_BASELINE) ||
+        (iFileCodecType & MP4_TYPE_AVC_PROFILE_MAIN) ||
+        (iFileCodecType & MP4_TYPE_AVC_PROFILE_HIGH))
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Composing UDTA atom")));
+        ComposeUDTAL();
+        }
+
     PRINT((_L("CCamC3GPDataSinkImp::OpenFileL exit")));
     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMC3GPDATASINKIMP_OPENFILEL, "e_CCamC3GPDataSinkImp::OpenFileL 0" );
     }
@@ -2225,6 +2234,73 @@
     }
 
 // -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::ComposeUDTA
+//
+// Compose UDTA (User Data) to video file
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::ComposeUDTAL()
+    {
+    mp4_u32 udtaBufferSize = 10240;
+    HBufC8* udtaBuffer = HBufC8::NewL(udtaBufferSize);
+    TUint8* buf = CONST_CAST(TUint8*, udtaBuffer->Ptr());
+    CleanupStack::PushL(udtaBuffer);
+    udtaBuffer->Des().FillZ(udtaBuffer->Des().MaxLength());
+
+    mp4_u32  i = 0;
+    
+    // Compose free atom 
+    // BoxHeader.Size      Unsigned int(32)  size of free atom
+    LittleEndianPut32(buf+i, (mp4_u32)udtaBufferSize-i);
+    i += 4;
+    // BoxHeader.Type      Unsigned int(32)    'free'
+    LittleEndianPut32(buf+i, (mp4_u32)0x66726565); //'free' indentifier for free atom
+    
+    
+    MP4Err error;
+    mp4_u8 udtalocation = MP4_UDTA_MOOV; // store UDTA to moov e.g. movie structure instead of individual track.
+    error = MP4ComposeSetUserDataAtom(iMP4Handle, udtalocation, (mp4_u8 *)udtaBuffer->Des().Ptr(), udtaBufferSize);
+    
+    if ( error )
+        {
+        PRINT((_L("CCamC3GPDataSinkImp::MP4ComposeSetUserDataAtom error=%d"), error));
+        User::Leave(KErrGeneral);    
+        }
+
+    CleanupStack::PopAndDestroy(udtaBuffer);
+    }
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::LittleEndianPut32
+//
+// Convert 32bit unsigned value to little endian format into buffer
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::LittleEndianPut32(TUint8 *aPtr, TUint32 aVal)
+    {
+    mp4_u32 result;
+    ((mp4_u8 *)&result)[0] = ((mp4_u8 *)&aVal)[3];
+    ((mp4_u8 *)&result)[1] = ((mp4_u8 *)&aVal)[2];
+    ((mp4_u8 *)&result)[2] = ((mp4_u8 *)&aVal)[1];
+    ((mp4_u8 *)&result)[3] = ((mp4_u8 *)&aVal)[0];
+    memcpy(aPtr, &result, 4);
+    }
+
+// -----------------------------------------------------------------------------
+// CCamC3GPDataSinkImp::LittleEndianPut16
+//
+// Convert 16bit unsigned value to little endian format into buffer
+// -----------------------------------------------------------------------------
+//
+void CCamC3GPDataSinkImp::LittleEndianPut16(TUint8 *aPtr, TUint16 aVal)
+    {
+    mp4_u16 result;
+    ((mp4_u8 *)&result)[0] = ((mp4_u8 *)&aVal)[1];
+    ((mp4_u8 *)&result)[1] = ((mp4_u8 *)&aVal)[0];
+    memcpy(aPtr, &result, 2);
+    }
+
+// -----------------------------------------------------------------------------
 // CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName
 // -----------------------------------------------------------------------------
 //
--- a/camcordermmfplugin/mediarecorder/Inc/CCMRVideoRecorder.h	Fri Apr 16 15:08:44 2010 +0300
+++ b/camcordermmfplugin/mediarecorder/Inc/CCMRVideoRecorder.h	Mon May 03 12:40:58 2010 +0300
@@ -601,7 +601,7 @@
         CCMRReturnAO* iBufferReturnAO;
         
         // time between random access points
-        TInt iMinRandomAccessPeriodInSeconds;
+        TReal iMinRandomAccessPeriodInSeconds;
 
         // ETrue if we are using HW accelerated video encoder => affects e.g. on default settings such as framerate
         TBool iVideoCodecHWAccelerated;
--- a/camcordermmfplugin/mediarecorder/Src/CCMRAudioInput.cpp	Fri Apr 16 15:08:44 2010 +0300
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAudioInput.cpp	Mon May 03 12:40:58 2010 +0300
@@ -45,6 +45,10 @@
 #define PRINT(x)
 #endif
 
+// Unused parameter macro
+#define UNUSED(x) (void)x;
+
+
 #include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "CCMRAudioInputTraces.h"
@@ -970,6 +974,7 @@
 //
 void CCMRAudioInput::ToneFinished(TInt aError)
     {
+    UNUSED(aError);
     PRINT((_L("CCMRAudioInput::ToneFinished(), error:%d"), aError));
     }
 
@@ -990,6 +995,7 @@
 //
 void CCMRAudioInput::PlayError(TInt aError)
     {
+    UNUSED(aError);
     PRINT((_L("CCMRAudioInput::PlayError(), error:%d"), aError));
     }
 
@@ -1029,6 +1035,7 @@
 //
 void CCMRAudioInput::ConvertError(TInt aError)
     {
+    UNUSED(aError);
     PRINT((_L("CCMRAudioInput::ConvertError(), error:%d"), aError));
     }
 
--- a/camcordermmfplugin/mediarecorder/Src/CCMRMDFVideoRecorder.cpp	Fri Apr 16 15:08:44 2010 +0300
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRMDFVideoRecorder.cpp	Mon May 03 12:40:58 2010 +0300
@@ -903,10 +903,12 @@
         iDevVideoRec->SetOutputFormatL(iPreProcessorHWDeviceId, preproOutputFormat);
     }
 
-    PRINT((_L("CCMRVideoRecorder::SetupEncoderL() MinRandomAccess= %d"), iMinRandomAccessPeriodInSeconds ));
+    PRINT((_L("CCMRVideoRecorder::SetupEncoderL() MinRandomAccess= %f"), iMinRandomAccessPeriodInSeconds ));
     if ( iConfig && iConfig->IsICMConfigDataAvailable() )
         {
-        iMinRandomAccessPeriodInSeconds = iConfig->VideoQualitySettings().iRandomAccessRate;
+        iMinRandomAccessPeriodInSeconds = TReal(1)/ iConfig->VideoQualitySettings().iRandomAccessRate;
+        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Set to iConfig iMinRandomAccessPeriodInSeconds= %f"), iMinRandomAccessPeriodInSeconds ));        
+        iDevVideoRec->SetMinRandomAccessRate( iConfig->VideoQualitySettings().iRandomAccessRate );
         }
     else
         {
@@ -914,19 +916,13 @@
 	        {
 	        iMinRandomAccessPeriodInSeconds = KCMRMinRandomAccessPeriodHighRes;
 	        }
-        }
-    PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Set to MinRandomAccess= %d"), iMinRandomAccessPeriodInSeconds ));
-
-    // Set random access in fps
-    if ( iMinRandomAccessPeriodInSeconds > 0 )
-        {
+        else 
+            {
+            iMinRandomAccessPeriodInSeconds = KCMRMinRandomAccessPeriod;
+            }
+        PRINT((_L("CCMRVideoRecorder::SetupEncoderL() Set to MinRandomAccess= %f"), iMinRandomAccessPeriodInSeconds ));        
         iDevVideoRec->SetMinRandomAccessRate( TReal(1) / TReal(iMinRandomAccessPeriodInSeconds) );
         }
-    else
-        {
-        // there is no concept of disabling random access in MSL, hence use the default
-        iDevVideoRec->SetMinRandomAccessRate( TReal(1) / TReal(KCMRMinRandomAccessPeriod) );
-        }
 
     CleanupStack::PopAndDestroy( comprFormat );
 
@@ -4099,7 +4095,7 @@
 // -----------------------------------------------------------------------------
 //
 CCMRVideoRecorder::CCMRReturnAO::CCMRReturnAO(CCMRVideoRecorder* aHost) :
-        CActive(EPriorityNormal),
+        CActive(CActive::EPriorityStandard),
         iVideoOutputBufferReturnQue(_FOFF(TVideoOutputBuffer,iLink)),
         iVideoOutputBufferReturnQueIter(iVideoOutputBufferReturnQue),
         iHost(aHost)
Binary file configmanagers/imagingconfigmanager/conf/imagingconfigmanager.confml has changed