738 if (error != MP4_OK) |
738 if (error != MP4_OK) |
739 { |
739 { |
740 PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Setting async file remover handler FAILED"))); |
740 PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Setting async file remover handler FAILED"))); |
741 } |
741 } |
742 |
742 |
|
743 if ((iFileCodecType & MP4_TYPE_MPEG4_VIDEO) || |
|
744 (iFileCodecType & MP4_TYPE_AVC_PROFILE_BASELINE) || |
|
745 (iFileCodecType & MP4_TYPE_AVC_PROFILE_MAIN) || |
|
746 (iFileCodecType & MP4_TYPE_AVC_PROFILE_HIGH)) |
|
747 { |
|
748 PRINT((_L("CCamC3GPDataSinkImp::OpenFileL Composing UDTA atom"))); |
|
749 ComposeUDTAL(); |
|
750 } |
|
751 |
743 PRINT((_L("CCamC3GPDataSinkImp::OpenFileL exit"))); |
752 PRINT((_L("CCamC3GPDataSinkImp::OpenFileL exit"))); |
744 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMC3GPDATASINKIMP_OPENFILEL, "e_CCamC3GPDataSinkImp::OpenFileL 0" ); |
753 OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMC3GPDATASINKIMP_OPENFILEL, "e_CCamC3GPDataSinkImp::OpenFileL 0" ); |
745 } |
754 } |
746 |
755 |
747 |
756 |
2223 PRINT((_L("CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes() new video buffer size: %d "), iVideoBufferFrameSize )); |
2232 PRINT((_L("CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes() new video buffer size: %d "), iVideoBufferFrameSize )); |
2224 PRINT((_L("CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes out"))); |
2233 PRINT((_L("CCamC3GPDataSinkImp::ConvertNALEncapsulationToNALSizes out"))); |
2225 } |
2234 } |
2226 |
2235 |
2227 // ----------------------------------------------------------------------------- |
2236 // ----------------------------------------------------------------------------- |
|
2237 // CCamC3GPDataSinkImp::ComposeUDTA |
|
2238 // |
|
2239 // Compose UDTA (User Data) to video file |
|
2240 // ----------------------------------------------------------------------------- |
|
2241 // |
|
2242 void CCamC3GPDataSinkImp::ComposeUDTAL() |
|
2243 { |
|
2244 mp4_u32 udtaBufferSize = 10240; |
|
2245 HBufC8* udtaBuffer = HBufC8::NewL(udtaBufferSize); |
|
2246 TUint8* buf = CONST_CAST(TUint8*, udtaBuffer->Ptr()); |
|
2247 CleanupStack::PushL(udtaBuffer); |
|
2248 udtaBuffer->Des().FillZ(udtaBuffer->Des().MaxLength()); |
|
2249 |
|
2250 mp4_u32 i = 0; |
|
2251 |
|
2252 // Compose free atom |
|
2253 // BoxHeader.Size Unsigned int(32) size of free atom |
|
2254 LittleEndianPut32(buf+i, (mp4_u32)udtaBufferSize-i); |
|
2255 i += 4; |
|
2256 // BoxHeader.Type Unsigned int(32) 'free' |
|
2257 LittleEndianPut32(buf+i, (mp4_u32)0x66726565); //'free' indentifier for free atom |
|
2258 |
|
2259 |
|
2260 MP4Err error; |
|
2261 mp4_u8 udtalocation = MP4_UDTA_MOOV; // store UDTA to moov e.g. movie structure instead of individual track. |
|
2262 error = MP4ComposeSetUserDataAtom(iMP4Handle, udtalocation, (mp4_u8 *)udtaBuffer->Des().Ptr(), udtaBufferSize); |
|
2263 |
|
2264 if ( error ) |
|
2265 { |
|
2266 PRINT((_L("CCamC3GPDataSinkImp::MP4ComposeSetUserDataAtom error=%d"), error)); |
|
2267 User::Leave(KErrGeneral); |
|
2268 } |
|
2269 |
|
2270 CleanupStack::PopAndDestroy(udtaBuffer); |
|
2271 } |
|
2272 |
|
2273 // ----------------------------------------------------------------------------- |
|
2274 // CCamC3GPDataSinkImp::LittleEndianPut32 |
|
2275 // |
|
2276 // Convert 32bit unsigned value to little endian format into buffer |
|
2277 // ----------------------------------------------------------------------------- |
|
2278 // |
|
2279 void CCamC3GPDataSinkImp::LittleEndianPut32(TUint8 *aPtr, TUint32 aVal) |
|
2280 { |
|
2281 mp4_u32 result; |
|
2282 ((mp4_u8 *)&result)[0] = ((mp4_u8 *)&aVal)[3]; |
|
2283 ((mp4_u8 *)&result)[1] = ((mp4_u8 *)&aVal)[2]; |
|
2284 ((mp4_u8 *)&result)[2] = ((mp4_u8 *)&aVal)[1]; |
|
2285 ((mp4_u8 *)&result)[3] = ((mp4_u8 *)&aVal)[0]; |
|
2286 memcpy(aPtr, &result, 4); |
|
2287 } |
|
2288 |
|
2289 // ----------------------------------------------------------------------------- |
|
2290 // CCamC3GPDataSinkImp::LittleEndianPut16 |
|
2291 // |
|
2292 // Convert 16bit unsigned value to little endian format into buffer |
|
2293 // ----------------------------------------------------------------------------- |
|
2294 // |
|
2295 void CCamC3GPDataSinkImp::LittleEndianPut16(TUint8 *aPtr, TUint16 aVal) |
|
2296 { |
|
2297 mp4_u16 result; |
|
2298 ((mp4_u8 *)&result)[0] = ((mp4_u8 *)&aVal)[1]; |
|
2299 ((mp4_u8 *)&result)[1] = ((mp4_u8 *)&aVal)[0]; |
|
2300 memcpy(aPtr, &result, 2); |
|
2301 } |
|
2302 |
|
2303 // ----------------------------------------------------------------------------- |
2228 // CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName |
2304 // CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName |
2229 // ----------------------------------------------------------------------------- |
2305 // ----------------------------------------------------------------------------- |
2230 // |
2306 // |
2231 void CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName( MP4FileName tempFileName ) |
2307 void CCamC3GPDataSinkImp::M3GPMP4LibDeleteTempFileName( MP4FileName tempFileName ) |
2232 { |
2308 { |