Committing the Video Editor package under the Eclipse Public License default PDK_3.0.0 PDK_3.0.1 PDK_3.0.2 PDK_3.0.3 PDK_3.0.g PDK_3.0.h PDK_3.0.i
authorMikael Laine <mikael.laine@ixonos.com>
Fri, 29 Jan 2010 14:08:33 +0200
changeset 0 951a5db380a0
child 3 e0b5df5c0969
Committing the Video Editor package under the Eclipse Public License
group/bld.inf
layers.sysdef.xml
package_definition.xml
sysdef_1_4_0.dtd
videditor/ManualVideoEditor/data/ManualVideoEditor.rss
videditor/ManualVideoEditor/data/ManualVideoEditor_caption.rss
videditor/ManualVideoEditor/data/ManualVideoEditor_reg.rss
videditor/ManualVideoEditor/data/help/VideoEditorHelp.cshlp.txt
videditor/ManualVideoEditor/data/help/VideoEditorHelp.hlp
videditor/ManualVideoEditor/data/help/VideoEditorHelp.rtf
videditor/ManualVideoEditor/data/help/custom.xml
videditor/ManualVideoEditor/data/icons.mk
videditor/ManualVideoEditor/data/icons_aif_scalable.mk
videditor/ManualVideoEditor/data/qgn_graf_ve_symbol_audio.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_symbol_cut_audio.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade01.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade02.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade03.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade04.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade05.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade06.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade07.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade08.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade1.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade2.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade3.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade4.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade5.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade6.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade7.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade8.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack01.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack02.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack03.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack04.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack05.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack06.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack07.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack08.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack09.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack10.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack11.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack12.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack13.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite01.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite02.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite03.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite04.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite05.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite06.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite07.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite08.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite09.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite10.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite11.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite12.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite13.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack1.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack2.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack3.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack4.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack5.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack6.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack7.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack8.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite1.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite2.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite3.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite4.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite5.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite6.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite7.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite8.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack1.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack2.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack3.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack4.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack5.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack6.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack7.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack8.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite1.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite2.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite3.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite4.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite5.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite6.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite7.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite8.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop1.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop2.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop3.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop4.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop5.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop6.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop7.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop8.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop9.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft1.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft2.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft3.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft4.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft5.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft6.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft7.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight1.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight2.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight3.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight4.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight5.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight6.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight7.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo1.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo2.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo3.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo4.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo5.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo6.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo7.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo8.svg
videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo9.svg
videditor/ManualVideoEditor/data/qgn_menu_ve_cxt.svg
videditor/ManualVideoEditor/data/qgn_prop_ve_bw.svg
videditor/ManualVideoEditor/data/qgn_prop_ve_colour.svg
videditor/ManualVideoEditor/data/qgn_prop_ve_file_audio.svg
videditor/ManualVideoEditor/data/qgn_prop_ve_file_video.svg
videditor/ManualVideoEditor/data/qgn_prop_ve_muted.svg
videditor/ManualVideoEditor/data/qgn_prop_ve_rec.svg
videditor/ManualVideoEditor/data/qgn_prop_ve_slow.svg
videditor/ManualVideoEditor/group/ManualVideoEditorUi.mmp
videditor/ManualVideoEditor/group/bld.inf
videditor/ManualVideoEditor/inc/FileNameSettingItem.h
videditor/ManualVideoEditor/inc/ManualVideoEditor.hrh
videditor/ManualVideoEditor/inc/SampleArrayHandler.h
videditor/ManualVideoEditor/inc/StoryboardItems.h
videditor/ManualVideoEditor/inc/TransitionInfo.h
videditor/ManualVideoEditor/inc/VeiApp.h
videditor/ManualVideoEditor/inc/VeiAppUi.h
videditor/ManualVideoEditor/inc/VeiCutAudioContainer.h
videditor/ManualVideoEditor/inc/VeiCutAudioView.h
videditor/ManualVideoEditor/inc/VeiCutVideoContainer.h
videditor/ManualVideoEditor/inc/VeiCutVideoContainer.inl
videditor/ManualVideoEditor/inc/VeiCutVideoView.h
videditor/ManualVideoEditor/inc/VeiCutVideoView.inl
videditor/ManualVideoEditor/inc/VeiDocument.h
videditor/ManualVideoEditor/inc/VeiEditVideoContainer.h
videditor/ManualVideoEditor/inc/VeiEditVideoContainer.inl
videditor/ManualVideoEditor/inc/VeiEditVideoView.h
videditor/ManualVideoEditor/inc/VeiEditVideoView.inl
videditor/ManualVideoEditor/inc/VeiIconBox.h
videditor/ManualVideoEditor/inc/VeiPopup.h
videditor/ManualVideoEditor/inc/VeiSettingItemList.h
videditor/ManualVideoEditor/inc/VeiSettingsContainer.h
videditor/ManualVideoEditor/inc/VeiSettingsView.h
videditor/ManualVideoEditor/inc/VeiTrimForMmsContainer.h
videditor/ManualVideoEditor/inc/VeiTrimForMmsView.h
videditor/ManualVideoEditor/inc/VideoEditorHelp.hlp.hrh
videditor/ManualVideoEditor/rom/ManualVideoEditor.iby
videditor/ManualVideoEditor/rom/ManualVideoEditor_resource.iby
videditor/ManualVideoEditor/src/FileNameSettingItem.cpp
videditor/ManualVideoEditor/src/SampleArrayHandler.cpp
videditor/ManualVideoEditor/src/StoryboardItems.cpp
videditor/ManualVideoEditor/src/TransitionInfo.cpp
videditor/ManualVideoEditor/src/VeiApp.cpp
videditor/ManualVideoEditor/src/VeiAppUi.cpp
videditor/ManualVideoEditor/src/VeiCutAudioContainer.cpp
videditor/ManualVideoEditor/src/VeiCutAudioView.cpp
videditor/ManualVideoEditor/src/VeiCutVideoContainer.cpp
videditor/ManualVideoEditor/src/VeiCutVideoView.cpp
videditor/ManualVideoEditor/src/VeiDocument.cpp
videditor/ManualVideoEditor/src/VeiEditVideoContainer.cpp
videditor/ManualVideoEditor/src/VeiEditVideoView.cpp
videditor/ManualVideoEditor/src/VeiIconBox.cpp
videditor/ManualVideoEditor/src/VeiPopup.cpp
videditor/ManualVideoEditor/src/VeiSettingItemList.cpp
videditor/ManualVideoEditor/src/VeiSettingsContainer.cpp
videditor/ManualVideoEditor/src/VeiSettingsView.cpp
videditor/ManualVideoEditor/src/VeiTrimForMmsContainer.cpp
videditor/ManualVideoEditor/src/VeiTrimForMmsView.cpp
videditor/SimpleCutVideo/data/VedSimpleCutVideo.rss
videditor/SimpleCutVideo/data/VedSimpleCutVideo_caption.rss
videditor/SimpleCutVideo/data/VedSimpleCutVideo_reg.rss
videditor/SimpleCutVideo/data/qgn_menu_ve_cxt.svg
videditor/SimpleCutVideo/group/VedSimpleCutVideo.mmp
videditor/SimpleCutVideo/group/bld.inf
videditor/SimpleCutVideo/help/data/xhtml.zip
videditor/SimpleCutVideo/help/group/bld.inf
videditor/SimpleCutVideo/help/inc/vided.hlp.hrh
videditor/SimpleCutVideo/help/rom/simplecutvideohelps_variant.iby
videditor/SimpleCutVideo/inc/VedSimpleCutVideo.hrh
videditor/SimpleCutVideo/inc/VeiSimpleCutVideoApp.h
videditor/SimpleCutVideo/inc/VeiSimpleCutVideoAppUi.h
videditor/SimpleCutVideo/inc/VeiSimpleCutVideoContainer.h
videditor/SimpleCutVideo/inc/VeiSimpleCutVideoContainer.inl
videditor/SimpleCutVideo/inc/VeiSimpleCutVideoDocument.h
videditor/SimpleCutVideo/inc/VeiSimpleCutVideoView.h
videditor/SimpleCutVideo/inc/VeiSimpleCutVideoView.inl
videditor/SimpleCutVideo/inc/VideoEditorHelp.hlp.hrh
videditor/SimpleCutVideo/inc/VideoEditorTest.h
videditor/SimpleCutVideo/inc/mveinavipanecontrolobserver.h
videditor/SimpleCutVideo/inc/veicutvideocontainer.inl
videditor/SimpleCutVideo/inc/veinavipanecontrol.h
videditor/SimpleCutVideo/rom/SimpleCutVideo.iby
videditor/SimpleCutVideo/rom/SimpleCutVideo_resource.iby
videditor/SimpleCutVideo/src/VeiSimpleCutVideoApp.cpp
videditor/SimpleCutVideo/src/VeiSimpleCutVideoAppUi.cpp
videditor/SimpleCutVideo/src/VeiSimpleCutVideoContainer.cpp
videditor/SimpleCutVideo/src/VeiSimpleCutVideoDocument.cpp
videditor/SimpleCutVideo/src/VeiSimpleCutVideoView.cpp
videditor/SimpleCutVideo/src/veinavipanecontrol.cpp
videditor/SimpleVideoEditor/BWINS/SimpleVideoEditor.DEF
videditor/SimpleVideoEditor/EABI/SimpleVideoEditor.DEF
videditor/SimpleVideoEditor/data/SimpleVideoEditor.rss
videditor/SimpleVideoEditor/group/SimpleVideoEditor.mmp
videditor/SimpleVideoEditor/group/bld.inf
videditor/SimpleVideoEditor/inc/CMultiLineQueryDialog.h
videditor/SimpleVideoEditor/inc/DummyControl.h
videditor/SimpleVideoEditor/inc/SimpleVideoEditor.h
videditor/SimpleVideoEditor/inc/SimpleVideoEditorExitObserver.h
videditor/SimpleVideoEditor/inc/SimpleVideoEditorImpl.h
videditor/SimpleVideoEditor/rom/SimpleVideoEditor.iby
videditor/SimpleVideoEditor/rom/SimpleVideoEditorResources.iby
videditor/SimpleVideoEditor/src/CMultiLineQueryDialog.cpp
videditor/SimpleVideoEditor/src/DummyControl.cpp
videditor/SimpleVideoEditor/src/SimpleVideoEditor.cpp
videditor/SimpleVideoEditor/src/SimpleVideoEditorImpl.cpp
videditor/TrimForMms/data/TrimForMms.rss
videditor/TrimForMms/data/TrimForMms_reg.rss
videditor/TrimForMms/group/TrimForMms.mmp
videditor/TrimForMms/group/bld.inf
videditor/TrimForMms/inc/TrimForMms.hrh
videditor/TrimForMms/inc/TrimForMms.pan
videditor/TrimForMms/inc/TrimForMmsApplication.h
videditor/TrimForMms/inc/TrimForMmsAppui.h
videditor/TrimForMms/inc/TrimForMmsAppview.h
videditor/TrimForMms/inc/TrimForMmsDocument.h
videditor/TrimForMms/inc/VeiTrimForMmsContainer.h
videditor/TrimForMms/inc/VeiTrimForMmsView.h
videditor/TrimForMms/src/TrimForMms.cpp
videditor/TrimForMms/src/TrimForMmsApplication.cpp
videditor/TrimForMms/src/TrimForMmsAppui.cpp
videditor/TrimForMms/src/TrimForMmsDocument.cpp
videditor/TrimForMms/src/VeiTrimForMmsContainer.cpp
videditor/TrimForMms/src/VeiTrimForMmsView.cpp
videditor/VideoEditorCommon/BWINS/VideoEditorCommon.DEF
videditor/VideoEditorCommon/EABI/VideoEditorCommon.DEF
videditor/VideoEditorCommon/data/VideoEditorCommon.rss
videditor/VideoEditorCommon/group/VideoEditorCommon.mmp
videditor/VideoEditorCommon/group/bld.inf
videditor/VideoEditorCommon/inc/ManualVideoEditor.loc
videditor/VideoEditorCommon/inc/VeiAddQueue.h
videditor/VideoEditorCommon/inc/VeiDisplayLighter.h
videditor/VideoEditorCommon/inc/VeiFrameTaker.h
videditor/VideoEditorCommon/inc/VeiImageClipGenerator.h
videditor/VideoEditorCommon/inc/VeiImageConverter.h
videditor/VideoEditorCommon/inc/VeiMGFetchVerifier.h
videditor/VideoEditorCommon/inc/VeiRemConTarget.h
videditor/VideoEditorCommon/inc/VeiSettings.h
videditor/VideoEditorCommon/inc/VeiTempMaker.h
videditor/VideoEditorCommon/inc/VeiTitleClipGenerator.h
videditor/VideoEditorCommon/inc/VeiVideoEditorSettings.h
videditor/VideoEditorCommon/inc/VideoEditorCommon.h
videditor/VideoEditorCommon/inc/VideoEditorCommon.hrh
videditor/VideoEditorCommon/inc/VideoEditorDebugUtils.h
videditor/VideoEditorCommon/inc/VideoEditorInternalCRKeys.h
videditor/VideoEditorCommon/inc/VideoEditorUtils.h
videditor/VideoEditorCommon/inc/logfile.h
videditor/VideoEditorCommon/inc/logfile.pan
videditor/VideoEditorCommon/rom/VideoEditorCommon.iby
videditor/VideoEditorCommon/rom/VideoEditorCommon_resource.iby
videditor/VideoEditorCommon/src/VeiAddQueue.cpp
videditor/VideoEditorCommon/src/VeiDisplayLighter.cpp
videditor/VideoEditorCommon/src/VeiFrameTaker.cpp
videditor/VideoEditorCommon/src/VeiImageClipGenerator.cpp
videditor/VideoEditorCommon/src/VeiImageConverter.cpp
videditor/VideoEditorCommon/src/VeiMGFetchVerifier.cpp
videditor/VideoEditorCommon/src/VeiRemConTarget.cpp
videditor/VideoEditorCommon/src/VeiSettings.cpp
videditor/VideoEditorCommon/src/VeiTempMaker.cpp
videditor/VideoEditorCommon/src/VeiTitleClipGenerator.cpp
videditor/VideoEditorCommon/src/VeiVideoEditorSettings.cpp
videditor/VideoEditorCommon/src/VideoEditorUtils.cpp
videditor/VideoEditorCommon/src/logfile.cpp
videditor/VideoEditorUiComponents/BWINS/VideoEditorUiComponents.DEF
videditor/VideoEditorUiComponents/EABI/VideoEditorUiComponents.DEF
videditor/VideoEditorUiComponents/data/VideoEditorUiComponents.rss
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00000.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00001.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00002.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00003.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00004.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00005.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00006.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00007.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00008.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00009.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00010.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00011.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00012.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00013.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00014.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00015.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00016.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00017.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00018.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00019.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00020.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00021.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00022.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_00023.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00000.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00001.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00002.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00003.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00004.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00005.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00006.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00007.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00008.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00009.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00010.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00011.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00012.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00013.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00014.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00015.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00016.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00017.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00018.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00019.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00020.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00021.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00022.bmp
videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00023.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_00000.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_00001.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_00002.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_00003.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_00004.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_00005.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_00006.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_00007.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00000.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00001.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00002.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00003.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00004.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00005.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00006.bmp
videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00007.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00000.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00001.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00002.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00003.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00004.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00005.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00006.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00007.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00008.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00009.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00010.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00011.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00012.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00013.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00014.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00015.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00016.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00017.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00018.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00019.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00020.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00021.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00022.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00023.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00024.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00025.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00026.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00027.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00028.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00029.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00030.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00031.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00032.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_00033.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00000.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00001.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00002.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00003.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00004.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00005.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00006.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00007.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00008.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00009.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00010.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00011.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00012.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00013.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00014.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00015.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00016.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00017.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00018.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00019.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00020.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00021.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00022.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00023.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00000.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00001.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00002.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00003.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00004.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00005.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00006.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00007.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00008.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00009.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00010.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00011.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00012.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00013.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00014.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00015.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00016.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00017.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00018.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00019.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00020.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00021.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00022.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00023.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00000_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00001_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00002_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00003_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00004_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00005_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00006_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00007_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00008_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00009_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00010_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00011_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00012_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00013_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00014_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00015_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00016_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00017_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00018_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00019_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00020_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00021_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00022_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00023_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00024_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00025_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00026_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00027_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00028_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00029_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00030_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00031_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00032_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00033_1.bmp
videditor/VideoEditorUiComponents/data/bitmap/mix_audio_background.bmp
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_hslider.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_hslider_v1.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_hslider_v2.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_hslider_v3.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_hslider_v4.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_htab.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vslider.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vslider_v1.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vslider_v2.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vslider_v3.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vslider_v4.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vtab.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_end_left.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_end_left_selected.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_end_middle.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_end_right.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_end_right_selected.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_middle.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_middle_selected.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_arrow.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_novideo.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion1.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion2.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion3.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion4.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion5.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion6.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion7.svg
videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion8.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_vded_end.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_vded_playhead.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_vded_scissors.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_vded_start.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_vded_timeline_selected.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_mmc.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_mmc_non.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_mms_non.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_mms_ok.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_phone.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_phone_non.svg
videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_videolength.svg
videditor/VideoEditorUiComponents/data/svg/qgn_prop_ve_pause.svg
videditor/VideoEditorUiComponents/group/VideoEditorUiComponents.mmp
videditor/VideoEditorUiComponents/group/bld.inf
videditor/VideoEditorUiComponents/group/iconlist.txt
videditor/VideoEditorUiComponents/inc/ExtProgressAnimationControl.h
videditor/VideoEditorUiComponents/inc/ExtProgressContainer.h
videditor/VideoEditorUiComponents/inc/ExtProgressDialog.h
videditor/VideoEditorUiComponents/inc/VeiCutterBar.h
videditor/VideoEditorUiComponents/inc/VeiEditVideoLabelNavi.h
videditor/VideoEditorUiComponents/inc/VeiErrorUi.h
videditor/VideoEditorUiComponents/inc/VeiSlider.h
videditor/VideoEditorUiComponents/inc/VeiSlider.pan
videditor/VideoEditorUiComponents/inc/VeiTextDisplay.h
videditor/VideoEditorUiComponents/inc/VeiTimeLabelNavi.h
videditor/VideoEditorUiComponents/inc/VeiVideoDisplay.h
videditor/VideoEditorUiComponents/inc/mtimelabelnaviobserver.h
videditor/VideoEditorUiComponents/rom/VideoEditorUiComponents.iby
videditor/VideoEditorUiComponents/rom/VideoEditorUiComponents_resource.iby
videditor/VideoEditorUiComponents/src/ExtProgressAnimationControl.cpp
videditor/VideoEditorUiComponents/src/ExtProgressContainer.cpp
videditor/VideoEditorUiComponents/src/ExtProgressDialog.cpp
videditor/VideoEditorUiComponents/src/VeiCutterBar.cpp
videditor/VideoEditorUiComponents/src/VeiEditVideoLabelNavi.cpp
videditor/VideoEditorUiComponents/src/VeiErrorUi.cpp
videditor/VideoEditorUiComponents/src/VeiSlider.cpp
videditor/VideoEditorUiComponents/src/VeiTextDisplay.cpp
videditor/VideoEditorUiComponents/src/VeiTimeLabelNavi.cpp
videditor/VideoEditorUiComponents/src/VeiVideoDisplay.cpp
videditor/VideoProvider/group/VideoProvider.mmp
videditor/VideoProvider/group/bld.inf
videditor/VideoProvider/inc/VideoProvider.h
videditor/VideoProvider/inc/VideoProvider.rh
videditor/VideoProvider/inc/VideoProviderUids.hrh
videditor/VideoProvider/rom/VideoProvider.iby
videditor/VideoProvider/rom/VideoProvider_resource.iby
videditor/VideoProvider/src/VideoProvider.cpp
videditor/VideoProvider/src/VideoProvider.rss
videditor/VideoProvider/src/VideoProviderInternal.rss
videditor/data/VideoEditor.pkg
videditor/data/VideoEditorStub.sis
videditor/data/VideoEditor_stub.pkg
videditor/data/VideoEditor_stub.sis
videditor/data/buildsis.bat
videditor/group/bld.inf
videditor/group/buildconfig.hrh
videditor/loc/SimpleVideoEditor.loc
videoeditor_plat/group/bld.inf
videoeditor_plat/video_editor_engine_api/group/bld.inf
videoeditor_plat/video_editor_engine_api/inc/VedAudioClipInfo.h
videoeditor_plat/video_editor_engine_api/inc/VedCommon.h
videoeditor_plat/video_editor_engine_api/inc/VedCommon.inl
videoeditor_plat/video_editor_engine_api/inc/VedMovie.h
videoeditor_plat/video_editor_engine_api/inc/VedVideoClipGenerator.h
videoeditor_plat/video_editor_engine_api/inc/VedVideoClipInfo.h
videoeditor_plat/video_editor_engine_api/video_editor_engine_api.metaxml
videoeditorengine/audioeditorengine/bwins/aedengineu.def
videoeditorengine/audioeditorengine/codecs/AAC/inc/AudParams.h
videoeditorengine/audioeditorengine/codecs/AAC/inc/ProcAACFrameHandler.h
videoeditorengine/audioeditorengine/codecs/AAC/inc/ProcADTSInFileHandler.h
videoeditorengine/audioeditorengine/codecs/AAC/src/ProcAACFrameHandler.cpp
videoeditorengine/audioeditorengine/codecs/AAC/src/ProcADTSInFileHandler.cpp
videoeditorengine/audioeditorengine/codecs/AMR/inc/ProcAMRFrameHandler.h
videoeditorengine/audioeditorengine/codecs/AMR/inc/ProcAMRInFileHandler.h
videoeditorengine/audioeditorengine/codecs/AMR/src/ProcAMRFrameHandler.cpp
videoeditorengine/audioeditorengine/codecs/AMR/src/ProcAMRInFileHandler.cpp
videoeditorengine/audioeditorengine/codecs/AWB/inc/AWBConstants.h
videoeditorengine/audioeditorengine/codecs/AWB/inc/ProcAWBFrameHandler.h
videoeditorengine/audioeditorengine/codecs/AWB/inc/ProcAWBInFileHandler.h
videoeditorengine/audioeditorengine/codecs/AWB/inc/mime_io.h
videoeditorengine/audioeditorengine/codecs/AWB/inc/q_gain2.h
videoeditorengine/audioeditorengine/codecs/AWB/src/ProcAWBFrameHandler.cpp
videoeditorengine/audioeditorengine/codecs/AWB/src/ProcAWBInFileHandler.cpp
videoeditorengine/audioeditorengine/codecs/MP4/inc/ProcMP4InFileHandler.h
videoeditorengine/audioeditorengine/codecs/MP4/inc/mp4aud.h
videoeditorengine/audioeditorengine/codecs/MP4/src/ProcMP4InFileHandler.cpp
videoeditorengine/audioeditorengine/codecs/MP4/src/mp4aud.cpp
videoeditorengine/audioeditorengine/codecs/WAV/inc/ProcWAVFrameHandler.h
videoeditorengine/audioeditorengine/codecs/WAV/inc/ProcWAVInFileHandler.h
videoeditorengine/audioeditorengine/codecs/WAV/src/ProcWAVFrameHandler.cpp
videoeditorengine/audioeditorengine/codecs/WAV/src/ProcWAVInFileHandler.cpp
videoeditorengine/audioeditorengine/codecs/mp3/inc/ProcMP3FrameHandler.h
videoeditorengine/audioeditorengine/codecs/mp3/inc/ProcMP3InFileHandler.h
videoeditorengine/audioeditorengine/codecs/mp3/src/ProcMP3FrameHandler.cpp
videoeditorengine/audioeditorengine/codecs/mp3/src/ProcMP3InFileHandler.cpp
videoeditorengine/audioeditorengine/eabi/aedengineu.def
videoeditorengine/audioeditorengine/group/AedEngine.mmp
videoeditorengine/audioeditorengine/group/AedEngineLib.mmp
videoeditorengine/audioeditorengine/group/bld.inf
videoeditorengine/audioeditorengine/inc/AudClip.h
videoeditorengine/audioeditorengine/inc/AudClipInfo.h
videoeditorengine/audioeditorengine/inc/AudCommon.h
videoeditorengine/audioeditorengine/inc/AudObservers.h
videoeditorengine/audioeditorengine/inc/AudPanic.h
videoeditorengine/audioeditorengine/inc/AudProcessor.h
videoeditorengine/audioeditorengine/inc/AudProcessorImpl.h
videoeditorengine/audioeditorengine/inc/AudSong.h
videoeditorengine/audioeditorengine/inc/ProcClipInfoAO.h
videoeditorengine/audioeditorengine/inc/ProcConstants.h
videoeditorengine/audioeditorengine/inc/ProcDecoder.h
videoeditorengine/audioeditorengine/inc/ProcEncoder.h
videoeditorengine/audioeditorengine/inc/ProcFrameHandler.h
videoeditorengine/audioeditorengine/inc/ProcInFileHandler.h
videoeditorengine/audioeditorengine/inc/ProcOutFileHandler.h
videoeditorengine/audioeditorengine/inc/ProcProcessAO.h
videoeditorengine/audioeditorengine/inc/ProcTimeEstimateAO.h
videoeditorengine/audioeditorengine/inc/ProcTools.h
videoeditorengine/audioeditorengine/inc/ProcVisProcessor.h
videoeditorengine/audioeditorengine/inc/ProcVisualizationAO.h
videoeditorengine/audioeditorengine/inc/RateConverter.h
videoeditorengine/audioeditorengine/inc/aedproctimeestimate.h
videoeditorengine/audioeditorengine/inc/audconstants.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_clip.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_common_defs.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_data_types.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_rate_conversion_input_driven_int16.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_rate_conversion_output_driven_int16.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_rate_conversion_quality.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_44_to_48_int16.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_44_to_48_tables_economy.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_44_to_48_tables_premium.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_44_to_48_tables_standard.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_filter_int16.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_filter_three_to_one_int16.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_filter_two_to_one_int16.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_one_to_three_int16.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_one_to_three_tables_standard.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_one_to_two_int16.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_one_to_two_tables_standard.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_three_to_one_int16.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_three_to_one_tables_standard.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_two_to_one_int16.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_two_to_one_tables_standard.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_two_to_three_int16.h
videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_two_to_three_tables_standard.h
videoeditorengine/audioeditorengine/resampler/src/resampler_rate_conversion_input_driven_int16.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_rate_conversion_output_driven_int16.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_44_to_48_int16.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_44_to_48_int16.inl
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_44_to_48_tables_economy.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_44_to_48_tables_premium.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_44_to_48_tables_standard.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_three_int16.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_three_int16.inl
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_three_tables_standard.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_two_int16.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_two_int16.inl
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_two_tables_standard.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_three_to_one_int16.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_three_to_one_tables_standard.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_two_to_one_int16.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_two_to_one_tables_standard.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_two_to_three_int16.cpp
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_two_to_three_int16.inl
videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_two_to_three_tables_standard.cpp
videoeditorengine/audioeditorengine/src/Aud.cpp
videoeditorengine/audioeditorengine/src/AudClip.cpp
videoeditorengine/audioeditorengine/src/AudClipInfo.cpp
videoeditorengine/audioeditorengine/src/AudPanic.cpp
videoeditorengine/audioeditorengine/src/AudProcessor.cpp
videoeditorengine/audioeditorengine/src/AudProcessorImpl.cpp
videoeditorengine/audioeditorengine/src/AudSong.cpp
videoeditorengine/audioeditorengine/src/ProcClipInfoAO.cpp
videoeditorengine/audioeditorengine/src/ProcDecoder.cpp
videoeditorengine/audioeditorengine/src/ProcEncoder.cpp
videoeditorengine/audioeditorengine/src/ProcFrameHandler.cpp
videoeditorengine/audioeditorengine/src/ProcInFileHandler.cpp
videoeditorengine/audioeditorengine/src/ProcProcessAO.cpp
videoeditorengine/audioeditorengine/src/ProcTimeEstimateAO.cpp
videoeditorengine/audioeditorengine/src/ProcTools.cpp
videoeditorengine/audioeditorengine/src/ProcVisProcessor.cpp
videoeditorengine/audioeditorengine/src/ProcVisualizationAO.cpp
videoeditorengine/audioeditorengine/src/RateConverter.cpp
videoeditorengine/audioeditorengine/util/inc/Logfile.h
videoeditorengine/audioeditorengine/util/inc/LogfilePanics.h
videoeditorengine/audioeditorengine/util/src/Logfile.cpp
videoeditorengine/avcedit/bwins/vedavceditu.def
videoeditorengine/avcedit/eabi/vedavceditu.def
videoeditorengine/avcedit/group/bld.inf
videoeditorengine/avcedit/group/vedavcedit.mmp
videoeditorengine/avcedit/inc/avcdapi.h
videoeditorengine/avcedit/inc/biblin.h
videoeditorengine/avcedit/inc/bitbuffer.h
videoeditorengine/avcedit/inc/clipbuf.h
videoeditorengine/avcedit/inc/dpb.h
videoeditorengine/avcedit/inc/framebuffer.h
videoeditorengine/avcedit/inc/globals.h
videoeditorengine/avcedit/inc/invtransform.h
videoeditorengine/avcedit/inc/macroblock.h
videoeditorengine/avcedit/inc/motcomp.h
videoeditorengine/avcedit/inc/nrctyp32.h
videoeditorengine/avcedit/inc/parameterset.h
videoeditorengine/avcedit/inc/sequence.h
videoeditorengine/avcedit/inc/slice.h
videoeditorengine/avcedit/inc/vedavcedit.h
videoeditorengine/avcedit/inc/vedavceditimp.h
videoeditorengine/avcedit/inc/vld.h
videoeditorengine/avcedit/src/bitbuffer.cpp
videoeditorengine/avcedit/src/dpb.cpp
videoeditorengine/avcedit/src/framebuffer.cpp
videoeditorengine/avcedit/src/invtransform.cpp
videoeditorengine/avcedit/src/macroblock.cpp
videoeditorengine/avcedit/src/motcomp.cpp
videoeditorengine/avcedit/src/parameterset.cpp
videoeditorengine/avcedit/src/sequence.cpp
videoeditorengine/avcedit/src/slice.cpp
videoeditorengine/avcedit/src/vedavcedit.cpp
videoeditorengine/avcedit/src/vedavceditimp.cpp
videoeditorengine/avcedit/src/vld.cpp
videoeditorengine/cenrep/keys_videoeditorengine.xls
videoeditorengine/conf/videoeditorengine.confml
videoeditorengine/conf/videoeditorengine_10204C07.crml
videoeditorengine/data/VideoEditorEngine.pkg
videoeditorengine/data/VideoEditorEngineStub.sis
videoeditorengine/data/VideoEditorEngine_stub.SIS
videoeditorengine/data/VideoEditorEngine_stub.pkg
videoeditorengine/data/buildsis.bat
videoeditorengine/group/bld.inf
videoeditorengine/h263decoder/bwins/vedh263du.def
videoeditorengine/h263decoder/eabi/vedh263du.def
videoeditorengine/h263decoder/group/bld.inf
videoeditorengine/h263decoder/group/vedh263d.mmp
videoeditorengine/h263decoder/group/vedh263dLib.mmp
videoeditorengine/h263decoder/inc/Common.h
videoeditorengine/h263decoder/inc/MPEG4Transcoder.h
videoeditorengine/h263decoder/inc/VedVolReader.h
videoeditorengine/h263decoder/inc/biblin.h
videoeditorengine/h263decoder/inc/blkfunc.h
videoeditorengine/h263decoder/inc/block.h
videoeditorengine/h263decoder/inc/core.h
videoeditorengine/h263decoder/inc/debug.h
videoeditorengine/h263decoder/inc/decblock.h
videoeditorengine/h263decoder/inc/decgob.h
videoeditorengine/h263decoder/inc/decmb.h
videoeditorengine/h263decoder/inc/decmbdct.h
videoeditorengine/h263decoder/inc/decmbs.h
videoeditorengine/h263decoder/inc/decpich.h
videoeditorengine/h263decoder/inc/decvp_mpeg.h
videoeditorengine/h263decoder/inc/dlist.h
videoeditorengine/h263decoder/inc/epoclib.h
videoeditorengine/h263decoder/inc/errcodes.h
videoeditorengine/h263decoder/inc/h263dapi.h
videoeditorengine/h263decoder/inc/h263dconfig.h
videoeditorengine/h263decoder/inc/h263dext.h
videoeditorengine/h263decoder/inc/h263dmai.h
videoeditorengine/h263decoder/inc/h263dntc.h
videoeditorengine/h263decoder/inc/idct.h
videoeditorengine/h263decoder/inc/list.h
videoeditorengine/h263decoder/inc/mpegcons.h
videoeditorengine/h263decoder/inc/renapi.h
videoeditorengine/h263decoder/inc/rendri.h
videoeditorengine/h263decoder/inc/stckheap.h
videoeditorengine/h263decoder/inc/sync.h
videoeditorengine/h263decoder/inc/vdc263.h
videoeditorengine/h263decoder/inc/vdcaic.h
videoeditorengine/h263decoder/inc/vdcmvc.h
videoeditorengine/h263decoder/inc/vde.h
videoeditorengine/h263decoder/inc/vdefrt.h
videoeditorengine/h263decoder/inc/vdeimb.h
videoeditorengine/h263decoder/inc/vdeims.h
videoeditorengine/h263decoder/inc/vdemain.h
videoeditorengine/h263decoder/inc/vdeti.h
videoeditorengine/h263decoder/inc/vdxint.h
videoeditorengine/h263decoder/inc/vedh263dimp.h
videoeditorengine/h263decoder/inc/viddemux.h
videoeditorengine/h263decoder/inc/zigzag.h
videoeditorengine/h263decoder/src/MPEG4Transcoder.cpp
videoeditorengine/h263decoder/src/VedVolReader.cpp
videoeditorengine/h263decoder/src/biblin.cpp
videoeditorengine/h263decoder/src/blcllcpy.cpp
videoeditorengine/h263decoder/src/block.cpp
videoeditorengine/h263decoder/src/bma.cpp
videoeditorengine/h263decoder/src/core.cpp
videoeditorengine/h263decoder/src/core_mpeg.cpp
videoeditorengine/h263decoder/src/decblock.cpp
videoeditorengine/h263decoder/src/decgob.cpp
videoeditorengine/h263decoder/src/decmb.cpp
videoeditorengine/h263decoder/src/decmbdct.cpp
videoeditorengine/h263decoder/src/decmbdct_mpeg.cpp
videoeditorengine/h263decoder/src/decmbs.cpp
videoeditorengine/h263decoder/src/decmbs_dp_mpeg.cpp
videoeditorengine/h263decoder/src/decpich.cpp
videoeditorengine/h263decoder/src/decpich_mpeg.cpp
videoeditorengine/h263decoder/src/decvp_mpeg.cpp
videoeditorengine/h263decoder/src/dlist.cpp
videoeditorengine/h263decoder/src/epoclib.cpp
videoeditorengine/h263decoder/src/h263dntc.cpp
videoeditorengine/h263decoder/src/idctiforepoc.cpp
videoeditorengine/h263decoder/src/list.cpp
videoeditorengine/h263decoder/src/rendri.cpp
videoeditorengine/h263decoder/src/sync.cpp
videoeditorengine/h263decoder/src/sync_mpeg.cpp
videoeditorengine/h263decoder/src/vdcaic.cpp
videoeditorengine/h263decoder/src/vdcmvc.cpp
videoeditorengine/h263decoder/src/vdefrt.cpp
videoeditorengine/h263decoder/src/vdeimb.cpp
videoeditorengine/h263decoder/src/vdeims.cpp
videoeditorengine/h263decoder/src/vdemain.cpp
videoeditorengine/h263decoder/src/vdeti.cpp
videoeditorengine/h263decoder/src/vdeti_mpeg.cpp
videoeditorengine/h263decoder/src/vedh263dimp.cpp
videoeditorengine/h263decoder/src/viddemux.cpp
videoeditorengine/h263decoder/src/viddemux_mpeg.cpp
videoeditorengine/h263decoder/src/vlb.cpp
videoeditorengine/mp3aacManipLib/AACGain/inc/AACConstants.h
videoeditorengine/mp3aacManipLib/AACGain/inc/aac_tool.h
videoeditorengine/mp3aacManipLib/AACGain/inc/aacaud.h
videoeditorengine/mp3aacManipLib/AACGain/inc/aacdef.h
videoeditorengine/mp3aacManipLib/AACGain/inc/chandefs.h
videoeditorengine/mp3aacManipLib/AACGain/inc/dec_const.h
videoeditorengine/mp3aacManipLib/AACGain/inc/dec_huf.h
videoeditorengine/mp3aacManipLib/AACGain/inc/env_extr.h
videoeditorengine/mp3aacManipLib/AACGain/inc/sbr_bitmux.h
videoeditorengine/mp3aacManipLib/AACGain/inc/sbr_codec.h
videoeditorengine/mp3aacManipLib/AACGain/inc/sbr_rom.h
videoeditorengine/mp3aacManipLib/AACGain/inc/tool.h
videoeditorengine/mp3aacManipLib/AACGain/inc/tool2.h
videoeditorengine/mp3aacManipLib/AACGain/src/Tool.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/aacaud.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/aacdef.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/chandefs.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/coupling.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/dec_huftables.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/huffdec1.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/huffdec2.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/huffdec3.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/nok_bits2.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/sbr_bitmux.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/sbr_codec.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/sbr_demux.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/sbr_freq_sca.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/sbr_rom.cpp
videoeditorengine/mp3aacManipLib/AACGain/src/sfbdata.cpp
videoeditorengine/mp3aacManipLib/MP3Gain/inc/mp3tables.h
videoeditorengine/mp3aacManipLib/MP3Gain/inc/mp3tool.h
videoeditorengine/mp3aacManipLib/MP3Gain/inc/mpaud.h
videoeditorengine/mp3aacManipLib/MP3Gain/inc/mpheader.h
videoeditorengine/mp3aacManipLib/MP3Gain/inc/mpif.h
videoeditorengine/mp3aacManipLib/MP3Gain/inc/param.h
videoeditorengine/mp3aacManipLib/MP3Gain/src/l3huffman.cpp
videoeditorengine/mp3aacManipLib/MP3Gain/src/l3sfb.cpp
videoeditorengine/mp3aacManipLib/MP3Gain/src/layer3.cpp
videoeditorengine/mp3aacManipLib/MP3Gain/src/mpaud.cpp
videoeditorengine/mp3aacManipLib/MP3Gain/src/mpif.cpp
videoeditorengine/mp3aacManipLib/bwins/aedmp3aaclibu.def
videoeditorengine/mp3aacManipLib/eabi/aedmp3aaclibu.def
videoeditorengine/mp3aacManipLib/group/aedmp3aacLib.mmp
videoeditorengine/mp3aacManipLib/group/aedmp3aacLibLib.mmp
videoeditorengine/mp3aacManipLib/group/bld.inf
videoeditorengine/mp3aacManipLib/inc/AACAPI.h
videoeditorengine/mp3aacManipLib/inc/Mp3API.h
videoeditorengine/mp3aacManipLib/inc/Mp3MixAPI.h
videoeditorengine/mp3aacManipLib/inc/ProcConstants.h
videoeditorengine/mp3aacManipLib/inc/auddef.h
videoeditorengine/mp3aacManipLib/inc/defines.h
videoeditorengine/mp3aacManipLib/inc/mp3def.h
videoeditorengine/mp3aacManipLib/inc/mstream.h
videoeditorengine/mp3aacManipLib/inc/nok_bits.h
videoeditorengine/mp3aacManipLib/src/AudPanic.cpp
videoeditorengine/mp3aacManipLib/src/Mp3API.cpp
videoeditorengine/mp3aacManipLib/src/mp3aacManip.cpp
videoeditorengine/mp3aacManipLib/src/mstream.cpp
videoeditorengine/rom/VideoEditorEngine.iby
videoeditorengine/vedengine/GenManip/inc/DCColorManagement.h
videoeditorengine/vedengine/GenManip/inc/DCDefines.h
videoeditorengine/vedengine/GenManip/inc/DCDigitalZoom.h
videoeditorengine/vedengine/GenManip/inc/DCDithering.h
videoeditorengine/vedengine/GenManip/inc/DCIetd.h
videoeditorengine/vedengine/GenManip/inc/DCInit.h
videoeditorengine/vedengine/GenManip/inc/DCSharpening.h
videoeditorengine/vedengine/GenManip/inc/DisplayChain.h
videoeditorengine/vedengine/GenManip/src/DCColorManagement.cpp
videoeditorengine/vedengine/GenManip/src/DCDigitalZoom.cpp
videoeditorengine/vedengine/GenManip/src/DCDithering.cpp
videoeditorengine/vedengine/GenManip/src/DCIetd.cpp
videoeditorengine/vedengine/GenManip/src/DCSharpening.cpp
videoeditorengine/vedengine/GenManip/src/DisplayChain.cpp
videoeditorengine/vedengine/bwins/VedEngineu.def
videoeditorengine/vedengine/cenrep/videoeditorengine_cenrep_keys.xls
videoeditorengine/vedengine/eabi/VedEngineu.def
videoeditorengine/vedengine/group/VedEngine.mmp
videoeditorengine/vedengine/group/VedEngineLib.mmp
videoeditorengine/vedengine/group/bld.inf
videoeditorengine/vedengine/inc/VedAudioClipInfoImp.h
videoeditorengine/vedengine/inc/VedMovieImp.h
videoeditorengine/vedengine/inc/VedVideoClip.h
videoeditorengine/vedengine/inc/VedVideoClipInfoGeneratedImp.h
videoeditorengine/vedengine/inc/VedVideoClipInfoImp.h
videoeditorengine/vedengine/inc/vedaudiosettings.h
videoeditorengine/vedengine/inc/vedcodecchecker.h
videoeditorengine/vedengine/inc/vedproctimeestimate.h
videoeditorengine/vedengine/inc/vedqualitysettingsapi.h
videoeditorengine/vedengine/inc/vedqualitysettingsapi.inl
videoeditorengine/vedengine/inc/vedqualitysettingsvariation.h
videoeditorengine/vedengine/inc/vedvideoconversion.h
videoeditorengine/vedengine/inc/vedvideoconversionimp.h
videoeditorengine/vedengine/inc/vedvideosettings.h
videoeditorengine/vedengine/src/VedAudioClipInfoImp.cpp
videoeditorengine/vedengine/src/VedMovieImp.cpp
videoeditorengine/vedengine/src/VedVideoClip.cpp
videoeditorengine/vedengine/src/VedVideoClipGenerator.cpp
videoeditorengine/vedengine/src/VedVideoClipInfoGeneratedImp.cpp
videoeditorengine/vedengine/src/VedVideoClipInfoImp.cpp
videoeditorengine/vedengine/src/vedcodecchecker.cpp
videoeditorengine/vedengine/src/vedqualitysettingsapi.cpp
videoeditorengine/vedengine/src/vedvideoconversionimp.cpp
videoeditorengine/vedengine/videoprocessor/inc/Composer.h
videoeditorengine/vedengine/videoprocessor/inc/MDFWrapper.h
videoeditorengine/vedengine/videoprocessor/inc/Parser.h
videoeditorengine/vedengine/videoprocessor/inc/SizeEstimate.h
videoeditorengine/vedengine/videoprocessor/inc/VedRgb2YuvConverter.h
videoeditorengine/vedengine/videoprocessor/inc/VideoEncoder.h
videoeditorengine/vedengine/videoprocessor/inc/VideoProcessorAudioData.h
videoeditorengine/vedengine/videoprocessor/inc/Yuv2rgb16.h
videoeditorengine/vedengine/videoprocessor/inc/activequeue.h
videoeditorengine/vedengine/videoprocessor/inc/audioprocessor.h
videoeditorengine/vedengine/videoprocessor/inc/brightnesscontrast.h
videoeditorengine/vedengine/videoprocessor/inc/dataprocessor.h
videoeditorengine/vedengine/videoprocessor/inc/decoder.h
videoeditorengine/vedengine/videoprocessor/inc/demultiplexer.h
videoeditorengine/vedengine/videoprocessor/inc/epoclib.h
videoeditorengine/vedengine/videoprocessor/inc/gettime.h
videoeditorengine/vedengine/videoprocessor/inc/movieprocessor.h
videoeditorengine/vedengine/videoprocessor/inc/movieprocessorimpl.h
videoeditorengine/vedengine/videoprocessor/inc/mp4composer.h
videoeditorengine/vedengine/videoprocessor/inc/mp4demux.h
videoeditorengine/vedengine/videoprocessor/inc/mp4parser.h
videoeditorengine/vedengine/videoprocessor/inc/mpeg4timer.h
videoeditorengine/vedengine/videoprocessor/inc/nrctyp32.h
videoeditorengine/vedengine/videoprocessor/inc/statusmonitor.h
videoeditorengine/vedengine/videoprocessor/inc/thdwrap.h
videoeditorengine/vedengine/videoprocessor/inc/videodecoder.h
videoeditorengine/vedengine/videoprocessor/inc/videoprocessor.h
videoeditorengine/vedengine/videoprocessor/inc/yuv2rgb12.h
videoeditorengine/vedengine/videoprocessor/inc/yuv2rgb24.h
videoeditorengine/vedengine/videoprocessor/inc/yuvconverter.h
videoeditorengine/vedengine/videoprocessor/src/SizeEstimate.cpp
videoeditorengine/vedengine/videoprocessor/src/VedRgb2YuvConverter.cpp
videoeditorengine/vedengine/videoprocessor/src/VideoEncoderMDF.cpp
videoeditorengine/vedengine/videoprocessor/src/Yuv2rgb16.cpp
videoeditorengine/vedengine/videoprocessor/src/activequeue.cpp
videoeditorengine/vedengine/videoprocessor/src/audioprocessor.cpp
videoeditorengine/vedengine/videoprocessor/src/dataprocessor.cpp
videoeditorengine/vedengine/videoprocessor/src/epoclib.cpp
videoeditorengine/vedengine/videoprocessor/src/movieprocessor.cpp
videoeditorengine/vedengine/videoprocessor/src/movieprocessorimpl.cpp
videoeditorengine/vedengine/videoprocessor/src/mp4composer.cpp
videoeditorengine/vedengine/videoprocessor/src/mp4demux.cpp
videoeditorengine/vedengine/videoprocessor/src/mp4parser.cpp
videoeditorengine/vedengine/videoprocessor/src/mpeg4timer.cpp
videoeditorengine/vedengine/videoprocessor/src/statusmonitor.cpp
videoeditorengine/vedengine/videoprocessor/src/videoprocessor.cpp
videoeditorengine/vedengine/videoprocessor/src/yuv2rgb12.cpp
videoeditorengine/vedengine/videoprocessor/src/yuv2rgb24.cpp
videoeditorengine/vedtranscoder/bwins/vedtranscoderu.def
videoeditorengine/vedtranscoder/eabi/vedtranscoderu.def
videoeditorengine/vedtranscoder/group/bld.inf
videoeditorengine/vedtranscoder/group/vedtranscoder.mmp
videoeditorengine/vedtranscoder/inc/CVEDSPPreprocessingCIM.h
videoeditorengine/vedtranscoder/inc/buffermanagementci.h
videoeditorengine/vedtranscoder/inc/ctrcommon.h
videoeditorengine/vedtranscoder/inc/ctrdevvideoclientobserver.h
videoeditorengine/vedtranscoder/inc/ctrhwsettings.h
videoeditorengine/vedtranscoder/inc/ctrprivatecrkeys.h
videoeditorengine/vedtranscoder/inc/ctrscaler.h
videoeditorengine/vedtranscoder/inc/ctrsettings.h
videoeditorengine/vedtranscoder/inc/ctrtranscoder.h
videoeditorengine/vedtranscoder/inc/ctrtranscoderimp.h
videoeditorengine/vedtranscoder/inc/ctrtranscoderobserver.h
videoeditorengine/vedtranscoder/inc/ctrvideodecoderclient.h
videoeditorengine/vedtranscoder/inc/ctrvideoencoderclient.h
videoeditorengine/vedtranscoder/inc/ctrvideopicturesink.h
videoeditorengine/vedtranscoder/src/Ctrscaler.cpp
videoeditorengine/vedtranscoder/src/Ctrtranscoder.cpp
videoeditorengine/vedtranscoder/src/Ctrtranscoderimp.cpp
videoeditorengine/vedtranscoder/src/Ctrvideodecoderclient.cpp
videoeditorengine/vedtranscoder/src/Ctrvideoencoderclient.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+ 
+#include <platform_paths.hrh>
+ 
+#include "../videoeditor_plat/group/bld.inf"
+#include "../videditor/group/bld.inf" 
+#include "../videoeditorengine/group/bld.inf"
+ 
+PRJ_EXPORTS
+ 
+//../inc_sdk/foo.h              MW_LAYER_PUBLIC_EXPORT_PATH(foo.h)
+//../inc_domain/foo.h              MW_LAYER_PLATFORM_EXPORT_PATH(foo.h)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "sf/app/videoeditor" >
+]>
+
+<SystemDefinition name="videoeditor" schema="1.4.0">
+  <systemModel>
+    <layer name="app_layer">
+      <module name="videoeditor">
+        <unit unitID="imm.videoeditor" mrp="" bldFile="&layer_real_source_path;/group" name="videoeditor" />
+      </module>
+    </layer>
+    
+     <layer name="api_test_layer">
+      <module name="videoeditor_api_tests">
+      	<unit unitID="imm.videoeditorengine_api" mrp="" bldFile="sf/app/videoeditor/videoeditorengine/tsrc/public/basic/group"  name="videoeditorengine_api" />
+      </module>
+    </layer>
+    
+    <layer name="unit_test_layer">
+      <module name="videoeditor_unit_tests">
+      </module>
+    </layer>
+    
+  </systemModel>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0">
+  <package id="videoeditor" name="Video Editor Apps" levels="engine ui">
+    <collection id="videditor" name="Video Editor" level="ui">
+      <component id="videoeditorcommon" filter="s60" name="Video Editor Common" introduced="^2" deprecated="^3">
+        <unit bldFile="videditor/videoeditorcommon/group"/>
+      </component>
+      <component id="videoeditoruicomponents" filter="s60" name="Video Editor UI Components" introduced="^2" deprecated="^3">
+        <unit bldFile="videditor/videoeditoruicomponents/group"/>
+      </component>
+      <component id="simplevideoeditor" filter="s60" name="Simple Video Editor" introduced="^2" deprecated="^3">
+        <unit bldFile="videditor/simplevideoeditor/group"/>
+      </component>
+      <component id="simplecutvideo" filter="s60" name="Simple Cut Video" introduced="^2" deprecated="^3">
+        <unit bldFile="videditor/simplecutvideo/group"/>
+      </component>
+      <component id="videoprovider" filter="s60" name="Video Provider" introduced="^2" deprecated="^3">
+        <unit bldFile="videditor/videoprovider/group"/>
+      </component>
+      <component id="manualvideoeditor" filter="s60" name="Manual Video Editor" introduced="^2" deprecated="^3">
+        <unit bldFile="videditor/manualvideoeditor/group"/>
+      </component>
+      <component id="trimformms" filter="s60" name="Trim For MMS" introduced="^2" deprecated="^3">
+		<!-- why is this commented out? Is this not built? -->
+        <!-- <unit bldFile="videditor/trimformms/group"/> -->
+      </component>
+      <component id="videditor_build" filter="s60" name="Video Editor Build" introduced="^2" deprecated="^3">
+		<!-- can the exports be distributed to the other components? Or should this be collapsed into one component?-->
+        <unit bldFile="videditor/group"/>
+      </component>
+    </collection>
+    <collection id="videoeditorengine" name="Video Editor Engine" level="engine">
+      <component id="audioeditorengine" filter="s60" name="Audio Editor Engine" introduced="^2" deprecated="^3">
+        <unit bldFile="videoeditorengine/audioeditorengine/group"/>
+      </component>
+      <component id="avcedit" filter="s60" name="AVC Editing" introduced="^2" deprecated="^3">
+        <unit bldFile="videoeditorengine/avcedit/group"/>
+      </component>
+      <component id="h263decoder" filter="s60" name="H.263 Decoder" introduced="^2" deprecated="^3">
+        <unit bldFile="videoeditorengine/h263decoder/group"/>
+      </component>
+      <component id="mp3aacmaniplib" filter="s60" name="MP3 and AAC Manipulation Library" introduced="^2" deprecated="^3">
+        <unit bldFile="videoeditorengine/mp3aacmaniplib/group"/>
+      </component>
+      <component id="vedtranscoder" filter="s60" name="Video Editor Transcoder" introduced="^2" deprecated="^3">
+        <unit bldFile="videoeditorengine/vedtranscoder/group"/>
+      </component>
+      <component id="vedengine" filter="s60" name="Video Editor Engine" introduced="^2" deprecated="^3">
+        <unit bldFile="videoeditorengine/vedengine/group"/>
+      </component>
+      <component id="videoeditorengine_build" filter="s60" name="Video Editor Engine Build" introduced="^2" deprecated="^3">
+		<!-- can the exports be distributed to the other components? Or should this be collapsed into one component?-->
+        <unit bldFile="videoeditorengine/group"/>
+      </component>
+    </collection>
+    <collection id="videoeditor_info" name="Video Editor Apps Info" level="ui">
+      <component id="videoeditor_plat" filter="s60" name="Video Editor Apps Platform Interfaces" class="api" introduced="^2" deprecated="^3">
+        <unit bldFile="videoeditor_plat/group"/>
+      </component>
+    </collection>
+  </package>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,86 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED
+  span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+  name CDATA #REQUIRED
+  level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+  unitID ID #REQUIRED
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  bldFile CDATA #REQUIRED
+  priority CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+  name CDATA #REQUIRED
+  version CDATA #REQUIRED
+  late (Y|N) #IMPLIED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+  name ID #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+  name ID #REQUIRED
+  abldTarget CDATA #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+  name ID #REQUIRED
+  abldOption CDATA #REQUIRED
+  description CDATA #REQUIRED
+  enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+  command CDATA #REQUIRED
+  targetList IDREFS #IMPLIED
+  unitParallel (Y | N | y | n) #REQUIRED
+  targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+  name CDATA #REQUIRED
+  cwd CDATA #REQUIRED
+  command CDATA #REQUIRED>  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/ManualVideoEditor.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,2744 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+//  RESOURCE IDENTIFIER
+NAME    MVED // 4 letter ID
+
+//  INCLUDES
+
+#include <eikon.rh>
+#include "manualvideoeditor.hrh"
+#include "manualvideoeditor.loc"
+#include <manualvideoeditor.mbg>
+#include <videoeditoruicomponents.mbg>
+
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <e32keys.h>			// Key codes
+#include <CommonDialogs.rh>		// avkon.loc is NOT included in this file if
+#include <avkon.loc>			
+#include <CommonDialogs.hrh>
+#include <appinfo.rh>
+#include <data_caging_paths_strings.hrh>
+#include <AvkonIcons.hrh>
+#if defined(__WINS__)
+#define vei_bitmap_file "\\epoc32\\release\\"$(PLATFORM)"\\"$(CFG)"\\Z\\"APP_BITMAP_DIR"\\manualvideoeditor.mif"
+#define vei_uic_bitmap_file "\\epoc32\\release\\"$(PLATFORM)"\\"$(CFG)"\\Z\\"APP_BITMAP_DIR"\\videoeditoruicomponents.mif"
+#else
+#define vei_bitmap_file ""APP_BITMAP_DIR"\\manualvideoeditor.mif"
+#define vei_uic_bitmap_file ""APP_BITMAP_DIR"\\videoeditoruicomponents.mif"
+#endif
+
+
+//  RESOURCE DEFINITIONS 
+
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf="mveditor"; }
+
+RESOURCE EIK_APP_INFO
+    {
+	cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT;	   
+    }
+
+RESOURCE LOCALISABLE_APP_INFO r_vei_localisable_app_info
+	{
+	short_caption=qtn_app_short_caption_string;
+	caption_and_icon =
+	CAPTION_AND_ICON_INFO
+		{
+		caption=qtn_app_caption_string;
+		number_of_icons=1;
+		icon_file=APP_BITMAP_DIR"\\ManualVideoEditor_aif.mif";
+		};
+	}
+//----------------------------------------------------
+//   
+//    r_vei_editvideo_titlescreen_text_query
+//    data query for the title screen text
+//
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_vei_editvideo_titlescreen_text_query
+	{
+	flags=EGeneralQueryFlags; 
+	buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+	items =
+		{
+		DLG_LINE
+			{
+			type = EAknCtQuery;
+			id = EVeiTitleScreenTextQuery;
+			control = AVKON_DATA_QUERY
+				{
+				layout = EDataLayout;
+				label = qtn_vei_textinserting_for_title_screen;
+
+				control = 
+					EDWIN
+						{
+						width = 50;
+						lines = 5;
+						maxlength = 50;
+						};
+				};
+			}
+		};
+	}
+
+
+//----------------------------------------------------
+//   
+//    r_vei_hotkeys
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE HOTKEYS r_vei_hotkeys
+    {
+    control=
+        {
+        HOTKEY { command=EAknCmdExit; key='e'; }
+        };
+    }
+
+//=====================================================
+//
+//		*****		AVKON VIEWS		*****
+//
+//
+//=====================================================
+
+//----------------------------------------------------
+//   
+//    r_vei_settings_view
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_vei_settings_view
+    {
+    hotkeys=r_vei_hotkeys;
+    menubar=r_vei_menubar_settings_view;  
+    cba=R_AVKON_SOFTKEYS_SELECTION_LIST;    
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_vei_edit_video_view
+    {
+    hotkeys=r_vei_hotkeys;
+    menubar=r_vei_menubar_edit_video_view;  
+    cba=R_AVKON_SOFTKEYS_SELECTION_LIST;    
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_cut_video
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_vei_cut_video_view
+    {
+    hotkeys=r_vei_hotkeys;
+    menubar=r_vei_menubar_cut_video_view;  
+    cba=R_AVKON_SOFTKEYS_SELECTION_LIST;    
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_cut_audio
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_vei_cut_audio_view
+    {
+    hotkeys=r_vei_hotkeys;
+    menubar=r_vei_menubar_cut_video_view;  
+    cba=R_AVKON_SOFTKEYS_SELECTION_LIST;    
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_trim_for_mms_view
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_vei_trim_for_mms_view
+    {
+    hotkeys=r_vei_hotkeys;
+    menubar=r_vei_menubar_trim_for_mms_view;  
+    cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;    
+    }
+
+//=====================================================
+//
+//		*****		MENU BARS		*****
+//
+//
+//=====================================================
+
+
+//----------------------------------------------------
+//   
+//    r_vei_menubar_trim_for_mms_view
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_vei_menubar_trim_for_mms_view
+	{
+    titles=
+        {
+        MENU_TITLE 
+			{ 
+			menu_pane=r_vei_menu_pane_trim_for_mms_view; 
+			txt=""; 
+			}
+        };
+	}
+
+//-----------------------------------------------------
+//				
+//    r_vei_menubar_settings_view
+//    ?description
+//
+//----------------------------------------------------
+//
+
+RESOURCE MENU_BAR r_vei_menubar_settings_view
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_vei_settings_view_menu; }
+        };
+    }
+
+
+//-----------------------------------------------------
+//				
+//    r_vei_menubar_edit_video_view
+//    ?description
+//
+//----------------------------------------------------
+//
+
+RESOURCE MENU_BAR r_vei_menubar_edit_video_view
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_vei_edit_video_view_menu; }
+        };
+    }
+
+//-----------------------------------------------------
+//				
+//    r_vei_menubar_cut_video_view
+//    ?description
+//
+//----------------------------------------------------
+//
+
+RESOURCE MENU_BAR r_vei_menubar_cut_video_view
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_vei_cut_video_view_menu; }
+        };
+    }
+
+//-----------------------------------------------------
+//				
+//    r_vei_preview						
+//    ?description
+//
+//----------------------------------------------------
+//
+
+RESOURCE MENU_BAR r_vei_preview_bar  
+    {
+    titles=
+        {
+		MENU_TITLE { menu_pane=r_vei_preview_menu; }
+        };
+    }
+
+
+//=====================================================
+//
+//		*****		MENU PANES		*****
+//
+//
+//=====================================================
+
+//----------------------------------------------------
+//   
+//    r_vei_menu_pane_trim_for_mms_view
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_menu_pane_trim_for_mms_view
+    {
+    items=
+        {
+		MENU_ITEM { command=EVeiCmdSendViaMms;			txt=qtn_vei_menu_send_via_mms; },
+		MENU_ITEM { command=EVeiCmdPreview;				txt=qtn_vei_menu_preview; },
+//		MENU_ITEM { command=EVeiCmdVideoLength;			txt=qtn_vei_menu_video_length; },
+		MENU_ITEM { command=EVeiCmdTrimForMmsViewHelp;	txt=qtn_clipb_litxt_help; }
+        };
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_edit_video_menu
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_edit_video_menu
+    {
+    items=
+        {
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoCutting;	 txt=qtn_vei_edit_video_cmd_edit_video_cutting; },	
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoMove;	     txt=qtn_vei_list_query_select_video_move; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoColorEffect;txt=qtn_vei_list_query_select_video_color_effect; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoSlowMotion; txt=qtn_vei_list_query_select_video_slow_motion; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoMute;       txt=qtn_vei_list_query_select_video_mute; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoUnmute;     txt=qtn_vei_list_query_select_video_unmute; },
+		MENU_ITEM { command=EVeiCmdEditVideoAdjustVolume;            txt = qtn_vei_edit_video_cmd_edit_adj_vol; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoRemove;     txt=qtn_vei_list_query_select_video_remove; },
+		MENU_ITEM { command=EVeiCmdEditVideoDuplicate;				 txt=qtn_vei_list_query_select_video_duplicate; }
+		};
+	}
+
+//----------------------------------------------------
+//   
+//    r_vei_settings_view_menu
+//    ?description
+//
+//----------------------------------------------------
+//
+
+RESOURCE MENU_PANE r_vei_settings_view_menu
+    {
+    items=
+        {
+        MENU_ITEM { command=EVeiCmdSettingsViewChange;	txt=qtn_options_change; },
+        MENU_ITEM { command=EVeiCmdSettingsViewHelp;		txt=qtn_options_help; }
+        };
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_menu
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_menu
+    {
+    items=
+        {
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideo;				txt = qtn_vei_edit_video_cmd_edit_video; cascade=r_vei_edit_video_view_edit_video_submenu; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditAudio;				txt = qtn_vei_edit_video_cmd_edit_audio; cascade=r_vei_edit_video_view_edit_audio_submenu; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditStartTransition;	txt = qtn_vei_edit_video_cmd_edit_tran; cascade=r_vei_edit_video_view_edit_start_transition_submenu; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditText;				txt = qtn_ved_menu_editt; cascade = r_vei_edit_video_view_edit_text_submenu; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditImage;				txt = qtn_ved_menu_editi; cascade = r_vei_edit_video_view_edit_image_submenu; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditMiddleTransition;	txt = qtn_vei_edit_video_cmd_edit_tran; cascade=r_vei_edit_video_view_edit_middle_transition_submenu; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditEndTransition;		txt = qtn_vei_edit_video_cmd_edit_tran; cascade=r_vei_edit_video_view_edit_end_transition_submenu; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewInsert;					txt = qtn_vei_edit_video_cmd_insert; cascade=r_vei_edit_video_view_insert; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewMovie;					txt = qtn_ved_menu_movie; cascade = r_vei_edit_video_view_movie_submenu; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewSettings;				txt = qtn_options_settings; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewHelp;					txt = qtn_options_help; },
+		MENU_ITEM { command=EEikCmdExit;								txt = qtn_options_exit; }
+        };
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_audio_mixing_menu
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_audio_mixing_menu
+    {
+    items=
+        {
+ 		MENU_ITEM { command=EVeiCmdEditVideoViewPreview;		txt = qtn_vei_edit_video_cmd_preview; cascade=r_vei_edit_video_view_movie_preview;},
+ 		MENU_ITEM { command=EVeiCmdEditVideoMixAudioCancel;		txt = text_softkey_cancel; }
+	    };
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_movie_submenu
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_movie_submenu
+    {
+    items=
+        {
+ 		MENU_ITEM { command=EVeiCmdEditVideoViewPreview;		txt = qtn_vei_edit_video_cmd_preview; cascade=r_vei_edit_video_view_movie_preview;},
+		MENU_ITEM { command=EVeiCmdEditVideoViewTrimForMms;		txt = qtn_ved_smenu_movie_mms; },
+ 		MENU_ITEM { command=EVeiCmdEditVideoViewSaveTo;			txt = qtn_vei_edit_video_cmd_save_to; },
+ 		MENU_ITEM { command=EVeiCmdEditVideoMixAudio;			txt = qtn_vei_edit_video_cmd_audio_mix; }
+	    };
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_movie_preview
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_movie_preview
+	{
+    items=
+        {
+		MENU_ITEM { command=EVeiCmdEditVideoViewPreviewLarge;	txt = qtn_ved_smenu_movie_lpreview; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewPreviewSmall;	txt = qtn_ved_smenu_movie_spreview; }
+		};
+	}
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_insert
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_insert
+    {
+    items=
+        {
+        MENU_ITEM { command=EVeiCmdEditVideoViewInsertVideo;		txt = qtn_vei_edit_video_cmd_insert_video; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewInsertImage;		txt = qtn_ved_smenu_insert_image;},
+		MENU_ITEM { command=EVeiCmdEditVideoViewInsertText;			txt = qtn_ved_smenu_insert_text;},    
+        MENU_ITEM { command=EVeiCmdEditVideoViewInsertAudio;		txt = qtn_vei_edit_video_cmd_insert_audio; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewInsertNewAudio;		txt = qtn_vei_edit_video_cmd_insert_new_audio; }
+        };
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_edit_text_submenu
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_edit_text_submenu
+{
+	items=
+		{
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditTextMove;				txt = qtn_ved_smenu_editt_move; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditTextRemove;				txt = qtn_ved_smenu_editt_remove; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditTextChangeDuration;		txt = qtn_ved_smenu_editt_dur; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditTextChangeText;			txt = qtn_ved_smenu_editt_text; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditTextSetTextColor;		txt = qtn_ved_smenu_editt_color; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditTextSetBackGround;		txt = qtn_ved_smenu_editt_bg; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditTextStyle;				txt = qtn_ved_smenu_editt_style; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditTextAddColorEffect;		txt = qtn_ved_smenu_editt_color_effect; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditTextDuplicate;			txt = qtn_ved_smenu_editt_duplicate; }
+		};
+}
+
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_edit_image_submenu
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_edit_image_submenu
+{
+	items=
+		{
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditImageMove;				txt = qtn_ved_smenu_editi_move; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditImageRemove;			txt = qtn_ved_smenu_editi_remove; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditImageChangeDuration;	txt = qtn_ved_smenu_editt_dur; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditImageBackGround;		txt = qtn_ved_smenu_editi_bg; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditImageAddColorEffect;	txt = qtn_ved_smenu_editi_color_effect; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditImageDuplicate;			txt = qtn_ved_smenu_editi_duplicate; }	
+		};
+}
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_edit_video_submenu
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_edit_video_submenu
+    {
+    items=
+        {
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoCutting;	 txt=qtn_vei_edit_video_cmd_edit_video_cutting; },	
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoMove;	     txt=qtn_vei_edit_video_cmd_edit_video_move; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoColorEffect;txt=qtn_vei_edit_video_cmd_edit_video_color_effect; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoSlowMotion; txt=qtn_vei_edit_video_cmd_edit_video_slow_motion; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoMute;       txt=qtn_vei_edit_video_cmd_edit_video_mute; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoUnmute;     txt=qtn_vei_edit_video_cmd_edit_video_unmute; },
+		MENU_ITEM { command=EVeiCmdEditVideoAdjustVolume;            txt=qtn_vei_edit_video_cmd_edit_adj_vol; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoRemove;     txt=qtn_vei_edit_video_cmd_edit_video_remove; },
+		MENU_ITEM { command=EVeiCmdEditVideoDuplicate;				 txt=qtn_vei_edit_video_cmd_edit_duplicate; }
+		};
+	}
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_edit_audio_submenu		//Options
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_edit_audio_submenu
+    {
+    items=
+        {
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditVideoCutting;	txt = qtn_vei_edit_video_cmd_edit_video_cutting; },	
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditAudioMove;		txt = qtn_vei_edit_video_cmd_edit_audio_move; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditAudioSetDuration;	txt = qtn_ved_smenu_editt_dur; },
+		MENU_ITEM { command=EVeiCmdEditVideoAdjustVolume;			txt = qtn_vei_edit_video_cmd_edit_adj_vol; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewEditAudioRemove;	txt = qtn_vei_edit_video_cmd_edit_audio_remove; },
+		MENU_ITEM { command=EVeiCmdEditVideoDuplicate;				txt = qtn_vei_edit_video_cmd_edit_duplicate; }
+        };
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_edit_start_transition_submenu		
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_edit_start_transition_submenu
+    {
+    items=
+        {
+        MENU_ITEM { command=EVeiCmdEditVideoViewTransitionFadeFromBlack; txt=qtn_vei_edit_video_cmd_edit_tran_fade_from_black; },
+        MENU_ITEM { command=EVeiCmdEditVideoViewTransitionFadeFromWhite; txt=qtn_vei_edit_video_cmd_edit_tran_fade_from_white; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewTransitionNone;			 txt=qtn_vei_edit_video_cmd_edit_tran_no_tran; }
+		};
+	}
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_edit_middle_transition_submenu		
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_edit_middle_transition_submenu
+    {
+    items=
+        {
+        MENU_ITEM { command=EVeiCmdEditVideoViewTransitionCrossfade;		txt=qtn_ved_smenu_editt_cf; },
+        MENU_ITEM { command=EVeiCmdEditVideoViewTransitionWipeFromTop;		txt=qtn_ved_smenu_editt_wipet; },
+        MENU_ITEM { command=EVeiCmdEditVideoViewTransitionWipeFromBottom;	txt=qtn_ved_smenu_editt_wipeb; },
+        MENU_ITEM { command=EVeiCmdEditVideoViewTransitionWipeFromLeft;		txt=qtn_ved_smenu_editt_wipel; },
+        MENU_ITEM { command=EVeiCmdEditVideoViewTransitionWipeFromRight;	txt=qtn_ved_smenu_editt_wiper; },
+        MENU_ITEM { command=EVeiCmdEditVideoViewTransitionDipToBlack;		txt=qtn_vei_edit_video_cmd_edit_tran_dip_to_black; },
+        MENU_ITEM { command=EVeiCmdEditVideoViewTransitionDipToWhite;		txt=qtn_vei_edit_video_cmd_edit_tran_dip_to_white; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewTransitionNone;				txt=qtn_vei_edit_video_cmd_edit_tran_no_tran; }
+		};
+	}
+
+//----------------------------------------------------
+//   
+//    r_vei_edit_video_view_edit_end_transition_submenu		
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_edit_video_view_edit_end_transition_submenu
+    {
+    items=
+        {
+        MENU_ITEM { command=EVeiCmdEditVideoViewTransitionFadeToBlack;	txt=qtn_vei_edit_video_cmd_edit_tran_fade_to_black; },
+        MENU_ITEM { command=EVeiCmdEditVideoViewTransitionFadeToWhite;	txt=qtn_vei_edit_video_cmd_edit_tran_fade_to_white; },
+		MENU_ITEM { command=EVeiCmdEditVideoViewTransitionNone;			txt=qtn_vei_edit_video_cmd_edit_tran_no_tran; }
+		};
+	}
+
+//----------------------------------------------------
+//   
+//    r_vei_preview_menu
+//    ?description
+//
+//----------------------------------------------------
+//		 
+RESOURCE MENU_PANE r_vei_preview_menu
+    {
+    items=
+        {
+	  MENU_ITEM { command=EVeiCmdCutVideoViewPlay; txt=qtn_vei_cmd_play; },
+	  MENU_ITEM { command=EVeiCmdPlayViewStop; txt=text_softkey_stop; },
+	  MENU_ITEM { command=EVeiCmdCutVideoTakeSnapshot; txt = qtn_vei_cmd_take_snapshot; }
+		};
+     }
+
+//----------------------------------------------------
+//   
+//    r_vei_cut_video_menu
+//    ?description
+//
+//----------------------------------------------------
+//
+
+RESOURCE MENU_PANE r_vei_cut_video_view_menu
+    {
+    items=
+        {
+		MENU_ITEM { command=EVeiCmdCutVideoViewPlay;		txt=qtn_vei_cut_video_cmd_play; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewContinue;	txt=qtn_vei_cut_video_cmd_continue; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewPlayMarked;	txt=qtn_vei_cut_video_cmd_play_marked; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewMarkIn;		txt=qtn_vei_cut_video_cmd_mark_in; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewMarkOut;		txt=qtn_vei_cut_video_cmd_mark_out; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewClearMarks;	txt=qtn_vei_cut_video_cmd_clear_marks; cascade = r_vei_cut_video_view_menu_clear_marks; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewStop;		txt=text_softkey_stop; },
+		MENU_ITEM { command=EVeiCmdCutVideoTakeSnapshot;	txt = qtn_vei_cmd_take_snapshot; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewHelp;		txt=qtn_options_help; }
+        };
+    }
+//----------------------------------------------------
+//   
+//    r_vei_videos_view_menu_mark
+//    Videos view mark submenu.
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_cut_video_view_menu_clear_marks
+    {
+    items=
+        {
+        MENU_ITEM { command=EVeiCmdCutVideoViewClearMarksIn;	txt=qtn_vei_cut_video_cmd_clear_marks_in; },
+        MENU_ITEM { command=EVeiCmdCutVideoViewClearMarksOut;	txt=qtn_vei_cut_video_cmd_clear_marks_out; },
+        MENU_ITEM { command=EVeiCmdCutVideoViewClearMarksInOut; txt=qtn_vei_cut_video_cmd_clear_marks_in_out; }
+		};
+	}
+
+
+//=====================================================
+//
+//		*****		POPUPS		*****
+//
+//
+//=====================================================
+
+//
+// Start transtion
+//
+RESOURCE ARRAY r_vei_start_transition_list_box_array
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_fade_from_black;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_fade_from_white;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_no_tran;
+			}
+		};
+	}
+
+//
+// Middle transtion
+//
+RESOURCE ARRAY r_vei_middle_transition_list_box_array
+	{
+	items =
+		{
+		LBUF
+			{
+
+			txt = qtn_vei_list_query_select_tran_wipe_top;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_wipe_bottom;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_wipe_left;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_wipe_right;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_crossfade;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_dip_to_black;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_dip_to_white;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_no_tran;
+			}
+		};
+	}
+
+//
+// End transtion
+//
+RESOURCE ARRAY r_vei_end_transition_list_box_array
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_fade_to_black;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_fade_to_white;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_tran_no_tran;
+			}
+		};
+	}
+
+
+//
+// Insert audio
+//
+RESOURCE ARRAY r_vei_insert_audio_list_box_array
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_vei_list_query_insert_sound_type_sound;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_insert_sound_type_new_audio;
+					
+			}
+		};
+	}
+
+//
+// Insert stuff to video track
+//  
+RESOURCE ARRAY r_vei_insert_stuff_list_box_array
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_ved_menu_insert_video;
+			},
+		LBUF
+			{
+			txt = qtn_ved_menu_insert_image;
+			},
+		LBUF
+			{
+			txt = qtn_ved_menu_insert_text;
+			}
+		};
+	}
+
+//
+// Edit video
+//
+
+RESOURCE ARRAY r_vei_edit_video_list_box_array
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_vei_edit_video_cmd_edit_video_cutting;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_video_move;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_video_color_effect;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_video_slow_motion;
+			},
+		LBUF
+			{ 
+			txt = qtn_vei_list_query_select_video_mute; 
+			},		
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_video_unmute;
+			},
+		LBUF
+			{
+			txt = qtn_vei_edit_video_cmd_edit_adj_vol;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_video_remove;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_video_duplicate;
+			}
+		};
+	}
+
+//
+// Edit text style
+//
+
+RESOURCE ARRAY r_vei_insert_text_list_box_array
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_ved_menu_insert_text_t;
+			},
+		LBUF
+			{
+			txt = qtn_ved_menu_insert_text_tf;
+			},
+		LBUF
+			{
+			txt = qtn_ved_menu_insert_text_subt;
+			},
+		LBUF
+			{
+			txt = qtn_ved_menu_insert_text_subtf;
+			},
+		LBUF
+			{
+			txt = qtn_ved_menu_insert_text_credit;
+			}
+		};
+	}
+
+//
+//	EDIT TEXT - Selectionkey menu, PopUpList  
+//
+
+RESOURCE ARRAY r_vei_edit_text_list_box_array
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_ved_smenu_editt_move;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editt_remove;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editt_dur;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editt_text;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editt_color;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editt_bg;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editt_color_effect;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editt_style;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editt_duplicate;
+			}
+		};
+	}
+
+//
+//	EDIT IMAGE - Selectionkey menu, PopUpList  
+//
+
+RESOURCE ARRAY r_vei_edit_image_list_box_array
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_ved_smenu_editi_move;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editi_remove;
+			},
+		LBUF
+			{
+			txt = qtn_ved_menu_editt_dur;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editi_bg;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editi_color_effect;
+			},
+		LBUF
+			{
+			txt = qtn_ved_smenu_editi_duplicate;
+			}
+		};
+	}
+
+//
+//	EDIT AUDIO - Selectionkey menu, PopUpList 
+//
+
+RESOURCE ARRAY r_vei_edit_audio_list_box_array
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_video_cut;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_video_move;
+			},
+		LBUF
+			{
+			txt = qtn_ved_menu_editt_dur;
+			},
+		LBUF
+			{
+			txt = qtn_vei_edit_video_cmd_edit_adj_vol;
+			},
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_video_remove;
+			},		
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_video_duplicate;
+			}
+		};
+	}
+
+//----------------------------------------------------
+//   
+//    r_vei_titlescreen_background_listbox_array
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_vei_titlescreen_background_listbox_array
+	{
+	items = 
+		{
+		LBUF
+			{
+			txt = qtn_ved_menu_editt_select_bg_image;
+			},
+		LBUF
+			{
+			txt = qtn_ved_menu_editt_select_bg_color;
+			}
+		};
+	}
+
+//----------------------------------------------------
+//   
+//    r_vei_effect_list_box_array
+//    ?description
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_vei_effect_list_box_array
+	{
+	items = 
+		{
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_effect_black_white;
+			},
+		LBUF
+			{
+			txt = qtn_ved_menu_editt_select_bg_color;
+			},	
+		LBUF
+			{
+			txt = qtn_vei_list_query_select_effect_no_effect;
+			}
+		};
+	}
+
+//----------------------------------------------------
+//   
+//		*****		VIEW TITLES		******
+//			
+//
+//----------------------------------------------------
+//
+RESOURCE TITLE_PANE r_vei_edit_video_view_title_name
+    {
+    txt = qtn_vei_edit_video_title_edit_video;
+    }
+
+RESOURCE TITLE_PANE r_vei_preview_view_title_name
+    {
+    txt = qtn_vei_edit_preview_title_preview;
+    }
+
+RESOURCE TITLE_PANE r_vei_cutvideo_view_title_name
+    {
+    txt = qtn_vei_cut_video_title_cut_video;
+    }
+
+RESOURCE TITLE_PANE r_vei_settings_view_title_name
+    {
+    txt = qtn_vei_settings_title_settings;
+    }
+
+RESOURCE TITLE_PANE r_vei_trim_for_mms_view_title_name
+    {
+    txt = qtn_vei_trim_mms_title;
+    }
+
+RESOURCE TITLE_PANE r_vei_cutaudio_view_title_name
+    {
+		txt = qtn_vei_cut_audio_title;
+    }
+RESOURCE TITLE_PANE r_vei_adjust_volume_view_title_name
+    {
+    txt = qtn_vei_edit_video_cmd_edit_adj_vol;
+    }    
+RESOURCE TITLE_PANE r_vei_audio_mix_view_title_name
+    {
+    txt = qtn_vei_edit_video_cmd_audio_mix;
+    }    
+
+    
+
+//=====================================================
+//
+//		*****		RESOURCE DIALOGS		*****
+//
+//
+//=====================================================
+
+//----------------------------------------------------
+//
+//    r_vei_wait_dialog
+//    
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_wait_dialog
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control= AVKON_NOTE 
+                { 
+                layout = EWaitLayout;
+                singular_label = qtn_gen_note_inserting;
+                imagefile = AVKON_ICON_FILE;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_vei_wait_dialog_processing
+//    
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_wait_dialog_processing
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control= AVKON_NOTE 
+                { 
+                layout = EWaitLayout;
+                singular_label = qtn_ved_processing_for_mms;
+                imagefile = AVKON_ICON_FILE;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_vei_wait_dialog_inserting_video
+//    
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_wait_dialog_inserting_video
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control= AVKON_NOTE 
+                { 
+                layout = EWaitLayout;
+                singular_label = qtn_ved_inserting_video;
+                imagefile = AVKON_ICON_FILE;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+//----------------------------------------------------
+//
+//    r_vei_wait_dialog_inserting_image
+//    
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_wait_dialog_inserting_image
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control= AVKON_NOTE 
+                { 
+                layout = EWaitLayout;
+                singular_label = qtn_ved_inserting_image;
+                imagefile = AVKON_ICON_FILE;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_videoeditor_confirmation_query
+//    Confirmation query
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_confirmation_query
+	{
+	flags=EGeneralQueryFlags;
+	buttons=R_AVKON_SOFTKEYS_YES_NO;
+   	 items=
+		{
+		DLG_LINE
+			{
+			type=EAknCtQuery;
+			id=EGeneralQuery;
+			control= AVKON_CONFIRMATION_QUERY 
+				{ 
+					layout = EConfirmationLayout;
+				};
+			}
+		};
+	}
+
+//----------------------------------------------------
+//
+//    r_vei_confirmation_query_cancel_textinsert
+//    Confirmation query
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_confirmation_query_cancel_textinsert
+	{
+	flags=EGeneralQueryFlags;
+	buttons=R_AVKON_SOFTKEYS_OK_EMPTY;
+   	 items=
+		{
+		DLG_LINE
+			{
+			type=EAknCtQuery;
+			id=EGeneralQuery;
+			control= AVKON_CONFIRMATION_QUERY 
+				{ 
+					layout = EConfirmationLayout;
+				};
+			}
+		};
+	}
+
+//----------------------------------------------------
+//
+//    r_videoeditor_progress_note
+//    Progress note
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_progress_note_with_cancel
+	{
+	flags = EAknProgressNoteFlags;
+	buttons = R_AVKON_SOFTKEYS_CANCEL;
+	items =
+		{
+		DLG_LINE
+			{
+			type = EAknCtNote;
+			id = EGeneralNote;
+			control = AVKON_NOTE
+				{
+				layout = EProgressLayout;
+//				singular_label = qtn_vei_progress_note_processing;
+				imagefile = AVKON_ICON_FILE;
+				imageid = EMbmAvkonQgn_note_progress;
+				imagemask = EMbmAvkonQgn_note_progress_mask;
+				};
+			}
+		};
+	}	
+//----------------------------------------------------
+//
+//    r_videoeditor_progress_note
+//    Progress note
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_progress_note
+	{
+	flags = EAknProgressNoteFlags;
+	buttons = R_AVKON_SOFTKEYS_EMPTY;
+	items =
+		{
+		DLG_LINE
+			{
+			type = EAknCtNote;
+			id = EGeneralNote;
+			control = AVKON_NOTE
+				{
+				layout = EProgressLayout;
+				singular_label = qtn_vei_progress_note_processing;
+				imagefile = AVKON_ICON_FILE;
+				imageid = EMbmAvkonQgn_note_progress;
+				imagemask = EMbmAvkonQgn_note_progress_mask;
+				};
+			}
+		};
+	}	
+
+/** P L A Y V I E W */
+
+//----------------------------------------------------
+//   
+//    r_vei_softkeys_pause_stop
+//    CBA for pause and back softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_preview_pause_back
+    {
+    buttons =
+		{
+		CBA_BUTTON 
+				{
+				id = EVeiCmdPlayViewPause; 
+				txt = text_softkey_pause;
+				},
+		CBA_BUTTON 
+				{
+				id = EAknSoftkeyBack;	
+				txt = text_softkey_back;
+				}
+		};
+    }
+
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_play_stop
+//    CBA for play and stop softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_continue_stop //7
+    {
+    buttons =
+		{
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewContinue; 
+				txt = qtn_vei_record;
+				},
+		CBA_BUTTON 
+				{
+				id=EVeiCmdCutVideoViewStop;
+				txt = text_softkey_stop;
+				}
+		};
+    }
+
+RESOURCE VOLUME r_vei_volume_control
+	{
+	flags = ENaviPaneVolumeControl;
+	value = 5;
+	}
+
+//----------------------------------------------------
+//   
+//    r_vei_softkeys_pause_stop
+//    CBA for pause and stop softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_pause_stop
+    {
+    buttons =
+		{
+		CBA_BUTTON 
+				{
+				id = EVeiCmdPlayViewPause; 
+				txt = text_softkey_pause;
+				},
+		CBA_BUTTON 
+				{
+				id=EVeiCmdPlayViewStop;
+				txt = text_softkey_stop;
+				}
+		};
+    }
+
+RESOURCE CBA r_vei_softkeys_record_cancel
+    {
+    buttons =
+		{
+		CBA_BUTTON 
+				{
+				id = EVeiCmdEditVideoViewRecord; 
+				txt = qtn_vei_record;
+				},
+		CBA_BUTTON 
+				{
+				id=EVeiCmdEditVideoViewRecordCancel;
+				txt = text_softkey_cancel;
+				}
+		};
+    }
+
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_options_done
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_options_done  //3
+    {
+    buttons =
+		{
+		CBA_BUTTON
+				{
+				id = EAknSoftkeyOptions;
+				txt = text_softkey_option;
+				},
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewDone;
+				txt = text_softkey_done;
+				}
+		};
+    }
+
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_empty_out
+//    CBA for options/out softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_empty_out  //6
+    {
+    buttons =
+		{
+		CBA_BUTTON
+				{
+				id=EVeiCmdCutVideoViewStop; 
+				txt = text_softkey_stop;
+				},
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewMarkOut;
+				//txt = qtn_vei_cut_video_cmd_mark_out; 
+				txt = qtn_vei_mark_out;
+				}
+		};
+    }
+
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_in_out
+//    CBA for in out softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_in_out //5
+    {
+    buttons =
+		{
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewMarkIn; 
+				//txt = qtn_vei_cut_video_cmd_mark_in;
+				txt = qtn_vei_mark_in;
+				},
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewMarkOut;
+				//txt = qtn_vei_cut_video_cmd_mark_out; 
+				txt = qtn_vei_mark_out;
+				}
+		};
+    }
+
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_in_empty
+//    CBA for options/out softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_in_empty  //4
+    {
+    buttons =
+		{
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewMarkIn;
+				//txt = qtn_vei_cut_video_cmd_mark_in; 
+				txt = qtn_vei_mark_in;
+				},
+		CBA_BUTTON
+				{
+				id=EVeiCmdCutVideoViewStop; 
+				txt = text_softkey_stop;
+				}
+		};
+    }
+//----------------------------------------------------
+//   
+//    r_vei_softkeys_preview_play_back
+//    CBA for play/back softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_preview_play_back
+    {
+    buttons =
+		{
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewPlay;
+				txt = qtn_vei_cmd_play; 
+				},
+		CBA_BUTTON
+				{
+				id = EAknSoftkeyBack;
+				txt = text_softkey_back;
+				}
+		};
+    }
+
+
+
+//----------------------------------------------------------------------------
+//
+//    r_vei_setting_item_list
+//    Settings item list for application settings.
+//
+//----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_ITEM_LIST r_vei_setting_item_list
+    {
+    flags = EAknSettingPageNoOrdinalDisplayed;	// Numbers not shown on left.
+    title = qtn_vei_settings_title_settings;
+    items =     
+        {
+        AVKON_SETTING_ITEM
+            {
+            identifier = EVeiVideoNameSettingItem;
+            name = qtn_vei_settings_label1_default_movie_name;
+            setting_page_resource = r_vei_settings_view_video_page;
+            },
+		AVKON_SETTING_ITEM
+			{
+			identifier = EVeiSnapshotNameSettingItem;
+			setting_page_resource = r_vei_settings_view_snapshot_page;	
+			name = qtn_vei_settings_label2_default_snapshot_name;
+			},
+		AVKON_SETTING_ITEM
+			{
+			identifier = EVeiSaveQualitySettingItem;
+			name = qtn_vei_setting_item_save_quality;
+			setting_page_resource = r_vei_setting_page_save_quality;
+			associated_resource = r_vei_save_quality_popup_setting_texts;
+			},
+		AVKON_SETTING_ITEM
+			{
+			identifier = EVeiMemoryInUseSettingItem;
+			name = qtn_vei_settings_label3_memory_in_use;
+			}
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_vei_settings_view_video_page
+//    Page for setting the default video name.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_vei_settings_view_video_page
+    {
+    label = qtn_vei_settings_label1_default_movie_name;
+    type = EEikCtEdwin;
+    editor_resource_id = r_vei_text_editor;
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_vei_settings_view_snapshot_page
+//    Page for setting the default snapshot name.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_vei_settings_view_snapshot_page
+	{
+	label = qtn_vei_settings_label2_default_snapshot_name;
+	type = EEikCtEdwin;
+	editor_resource_id = r_vei_text_editor;
+	}
+
+//-----------------------------------------------------------------------------
+//
+//    r_vei_text_editor
+//    General text editor for setting pages.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE EDWIN r_vei_text_editor
+    {
+    maxlength = 126;
+    }
+
+//----------------------------------------------------
+//	 
+//	  r_vei_setting_page_save_quality
+//	  
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_vei_setting_page_save_quality
+	{ 
+	label= qtn_vei_setting_item_save_quality;
+	type = EAknCtPopupSettingList;
+	editor_resource_id = r_vei_editor_save_quality;
+	}
+
+//----------------------------------------------------
+//	 
+//	  r_settingslist_hints_popup_setting_list
+//	  popup setting list for the hint item of the
+//	  setting list
+//
+//----------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_vei_editor_save_quality
+	{
+	}
+
+//----------------------------------------------------
+//	 
+//	  r_settingslist_hints_popup_setting_texts
+//	  popped up and non-popped up texts for the hint 
+//	  item of the setting list
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_vei_save_quality_popup_setting_texts
+	{
+	setting_texts_resource = r_vei_save_quality_texts;
+	popped_up_texts_resource = r_vei_save_quality_popup_texts;
+	}
+
+//----------------------------------------------------
+//	 
+//	  r_vei_save_quality_texts
+//	  non-popped up texts for the hint 
+//	  item of the setting list
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_vei_save_quality_texts
+	{
+	items =
+		{
+		AVKON_ENUMERATED_TEXT 
+			{ 
+			value = 0; 
+			text = qtn_vei_save_quality_auto; 
+			},
+		AVKON_ENUMERATED_TEXT 
+			{ 
+			value = 1; 
+			text = qtn_vei_save_quality_mms; 
+			},
+		AVKON_ENUMERATED_TEXT 
+			{ 
+			value = 2; 
+			text = qtn_vei_save_quality_medium; 
+			},
+		AVKON_ENUMERATED_TEXT 
+			{ 
+			value = 3; 
+			text = qtn_vei_save_quality_best; 
+			}
+			
+		};
+	}
+
+//----------------------------------------------------
+//	 
+//	  r_vei_save_quality_popup_texts
+//	  popped up texts for the hint 
+//	  item of the setting list
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_vei_save_quality_popup_texts
+	{
+	items =
+		{
+		LBUF 
+			{ 
+			txt = qtn_vei_save_quality_auto; 
+			},
+		LBUF 
+			{ 
+			txt = qtn_vei_save_quality_mms; 
+			},
+		LBUF 
+			{ 
+			txt = qtn_vei_save_quality_medium; 
+			},
+		LBUF 
+			{ 
+			txt = qtn_vei_save_quality_best; 
+			}
+		};
+	}
+
+
+
+//-----------------------------------------------------------------------------
+//
+//    r_ved_left_right_silent_skey_list
+//    Key sound definition, disables the long and repeat key press sounds for
+//    the left and righ navi-keys.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SKEY_LIST r_ved_left_right_silent_skey_list
+	{
+	list =
+		{
+		AVKON_SKEY_INFO 
+			{ 
+			key = EStdKeyRightArrow; 
+			sid = EAvkonSIDNoSound; 
+			type = ESKeyTypeLong;
+			},	
+		AVKON_SKEY_INFO 
+			{ 
+			key = EStdKeyRightArrow;
+			sid = EAvkonSIDNoSound;
+			type = ESKeyTypeRepeat; 
+			},
+		AVKON_SKEY_INFO 
+			{ 
+			key = EStdKeyLeftArrow;
+			sid = EAvkonSIDNoSound;
+			type =ESKeyTypeLong;
+			},
+		AVKON_SKEY_INFO 
+			{ 
+			key = EStdKeyLeftArrow;
+			sid = EAvkonSIDNoSound;
+			type =ESKeyTypeRepeat;
+			}
+		};
+	}
+
+
+
+
+RESOURCE AVKON_LIST_QUERY r_vei_titlescreen_background_list_query
+	{
+	items = 
+		{
+		AVKON_LIST_QUERY_DLG_LINE
+			{
+			control = AVKON_LIST_QUERY_CONTROL
+				{
+				listtype = EAknCtSinglePopupMenuListBox;
+				heading = qtn_ved_smenu_editt_select_heading_background;
+				listbox = AVKON_LIST_QUERY_LIST
+					{
+					array_id = r_vei_titlescreen_background_listbox_array;
+					};
+				};
+			}
+		};
+	}
+
+// ============================== ANIMATION ===================================
+RESOURCE BMPANIM_DATA r_vei_crossfade_animation
+	{
+	frameinterval = 50;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_vei_crossfade_animation_array;
+	}
+
+RESOURCE ARRAY r_vei_crossfade_animation_array
+	{	
+	items =
+		{
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade01;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade01_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 100;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade02;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade02_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 100;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade03;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade03_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 100;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade04;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade04_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 100;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade05;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade05_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 100;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade06;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade06_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 100;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade07;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade07_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade08;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_crossfade08_mask;
+			}
+		};
+	}
+
+RESOURCE BMPANIM_DATA r_vei_fade_to_black_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_vei_fade_to_black_animation_array;
+	}
+
+RESOURCE ARRAY r_vei_fade_to_black_animation_array
+	{	
+	items =
+		{
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack1;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack1_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack2;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack2_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack3;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack3_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack4;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack4_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack5;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack5_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack6;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack6_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack7;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack7_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack8;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetoblack8_mask;
+			}
+		};
+	}
+
+RESOURCE BMPANIM_DATA r_vei_fade_from_black_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_vei_fade_from_black_animation_array;
+	}
+
+RESOURCE ARRAY r_vei_fade_from_black_animation_array
+	{	
+	items =
+		{
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack1;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack1_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack2;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack2_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack3;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack3_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack4;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack4_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack5;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack5_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack6;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack6_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack7;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack7_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack8;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromblack8_mask;
+			}
+		};
+	}
+
+RESOURCE BMPANIM_DATA r_vei_fade_from_white_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_vei_fade_from_white_animation_array;
+	}
+
+RESOURCE ARRAY r_vei_fade_from_white_animation_array
+	{	
+	items =
+		{
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite1;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite1_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite2;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite2_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite3;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite3_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite4;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite4_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite5;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite5_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite6;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite6_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite7;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite7_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite8;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadefromwhite8_mask;
+			}
+		};
+	}
+
+
+RESOURCE BMPANIM_DATA r_vei_fade_to_white_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_vei_fade_to_white_animation_array;
+	}
+
+RESOURCE ARRAY r_vei_fade_to_white_animation_array
+	{	
+	items =
+		{
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite1;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite1_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite2;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite2_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite3;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite3_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite4;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite4_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite5;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite5_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite6;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite6_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite7;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite7_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite8;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_fadetowhite8_mask;
+			}
+		};
+	}
+
+RESOURCE BMPANIM_DATA r_vei_wipe_left_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_vei_wipe_left_animation_array;
+	}
+
+RESOURCE ARRAY r_vei_wipe_left_animation_array
+	{	
+	items =
+		{
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft1;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft1_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft2;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft2_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft3;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft3_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft4;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft4_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft5;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft5_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft6;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft6_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft7;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipeleft7_mask;
+			}
+		};
+	}
+
+
+RESOURCE BMPANIM_DATA r_vei_wipe_right_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_vei_wipe_right_animation_array;
+	}
+
+RESOURCE ARRAY r_vei_wipe_right_animation_array
+	{	
+	items =
+		{
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight1;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight1_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight2;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight2_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight3;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight3_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight4;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight4_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight5;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight5_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight6;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight6_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight7;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wiperight7_mask;
+			}
+		};
+	}
+
+RESOURCE BMPANIM_DATA r_vei_wipe_bottom_to_top_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_vei_wipe_bottom_to_top_animation_array;
+	}
+
+RESOURCE ARRAY r_vei_wipe_bottom_to_top_animation_array
+	{	
+	items =
+		{
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop1;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop1_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop2;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop2_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop3;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop3_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop4;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop4_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop5;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop5_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop6;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop6_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop7;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop7_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop8;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop8_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop9;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipebototop9_mask;
+			}
+		};
+	}
+
+
+RESOURCE BMPANIM_DATA r_vei_wipe_top_to_bottom_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_vei_wipe_top_to_bottom_animation_array;
+	}
+
+RESOURCE ARRAY r_vei_wipe_top_to_bottom_animation_array
+	{	
+	items =
+		{
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo1;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo1_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo2;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo2_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo3;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo3_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo4;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo4_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo5;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo5_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo6;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo6_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo7;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo7_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo8;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo8_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo9;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_wipetoptobo9_mask;
+			}
+		};
+	}
+
+RESOURCE BMPANIM_DATA r_vei_dip_to_black_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_vei_dip_to_black_animation_array;
+	}
+
+RESOURCE ARRAY r_vei_dip_to_black_animation_array
+	{	
+	items =
+		{
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack01;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack01_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack02;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack02_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack03;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack03_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack04;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack04_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack05;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack05_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack06;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack06_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack07;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack07_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack08;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack08_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack09;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack09_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack10;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack10_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack11;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack11_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack12;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack12_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack13;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptoblack13_mask;
+			}
+		};
+	}
+
+RESOURCE BMPANIM_DATA r_vei_dip_to_white_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_vei_dip_to_white_animation_array;
+	}
+
+RESOURCE ARRAY r_vei_dip_to_white_animation_array
+	{	
+	items =
+		{
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite01;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite01_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite02;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite02_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite03;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite03_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite04;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite04_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite05;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite05_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite06;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite06_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite07;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite07_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite08;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite08_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite09;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite09_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite10;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite10_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite11;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite11_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite12;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite12_mask;
+			},
+		BMPANIM_FRAME
+			{
+			time = 500;
+			bmpid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite13;
+			maskid = EMbmManualvideoeditorQgn_graf_ve_trans_diptowhite13_mask;
+			}
+		};
+	}
+// ============================== NOTE STRINGS ================================
+
+//-----------------------------------------------------------------------------
+//   
+//    r_ved_mmc_not_inserted
+//    Information note text, shown when memory card is not accessible.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ved_mmc_not_inserted
+    {
+    buf = qtn_ved_mmc_not_inserted;
+    }
+
+
+//-----------------------------------------------------------------------------
+//   
+//    r_vei_illegal_filename
+//    Warning note text, used when user has entered illegal file name, for
+//    example in Settings view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_vei_illegal_filename
+    {
+    buf = qtn_fldr_illegal_characters;
+    }
+
+
+//-----------------------------------------------------------------------------
+//   
+//    r_vei_unsuitable_filename
+//    Warning note text, used when user has entered illegal file name, for
+//    example in Settings view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_vei_unsuitable_filename
+    {
+    buf = qtn_fldr_bad_file_name;
+    }
+
+
+//-----------------------------------------------------------------------------
+//   
+//    r_ved_mmc_not_inserted
+//    Progress note text, used when the movie is processed for MMS composer.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ved_processing_for_mms
+    {
+    buf = qtn_ved_processing_for_mms;
+    }
+
+
+// ============================ MAIN PANE STRINGS =============================
+
+//-----------------------------------------------------------------------------
+//   
+//    r_ved_thumbnail_start_text
+//    Main pane text above the thumbnail which shows the starting point for MMS 
+//    trimming. Used in 'Trim for MMS' view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ved_thumbnail_start_text
+    {
+    buf = qtn_ved_trim_start;
+    }
+
+
+//-----------------------------------------------------------------------------
+//   
+//    r_ved_thumbnail_end_text
+//    Main pane text above the thumbnail which shows the ending point for MMS 
+//    trimming. Used in 'Trim for MMS' view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_ved_thumbnail_end_text
+    {
+    buf = qtn_ved_trim_end;
+    }
+
+
+// Time navi pane string (formats the shown time)
+RESOURCE TBUF64  r_vei_navi_time									{ buf = qtn_time_prog_total_min_sec; }
+RESOURCE TBUF256 r_vei_error_note									{ buf= qtn_err_eikon_general; }
+
+RESOURCE TBUF256 r_vei_move_video_navilabel							{ buf = qtn_vei_navilabel_move_video; }
+RESOURCE TBUF64  r_vei_move_audio_navilabel							{ buf = qtn_vei_navilabel_move_audio; }
+RESOURCE TBUF256 r_vei_confirm_exit_save							{ buf = qtn_vei_confirmation_note_quit_save; }
+RESOURCE TBUF256 r_vei_confirm_overwrite							{ buf = qtn_fldr_overwrite_query; }
+
+//
+// TRANSITION
+//
+RESOURCE TBUF64 r_vei_start_transition_effect_name_none				{ buf = qtn_vei_edit_video_main_tran_no; }
+RESOURCE TBUF64 r_vei_start_transition_effect_name_fade_from_black	{ buf = qtn_vei_edit_video_main_tran_fade_from_black; }
+RESOURCE TBUF64 r_vei_start_transition_effect_name_fade_from_white	{ buf = qtn_vei_edit_video_main_tran_fade_from_white; }
+RESOURCE TBUF64 r_vei_middle_transition_effect_name_none			{ buf = qtn_vei_edit_video_main_tran_no; }
+RESOURCE TBUF64 r_vei_middle_transition_effect_name_dip_to_black	{ buf = qtn_vei_edit_video_main_tran_dip_to_black; }
+RESOURCE TBUF64 r_vei_middle_transition_effect_name_dip_to_white	{ buf = qtn_vei_edit_video_main_tran_dip_to_white; }
+RESOURCE TBUF64 r_vei_middle_transition_effect_name_crossfade		{ buf = qtn_vei_edit_video_main_tran_crossfade; }
+RESOURCE TBUF128 r_vei_middle_transition_effect_name_wipe_left		{ buf = qtn_vei_edit_video_main_tran_wipe_left; }
+RESOURCE TBUF128 r_vei_middle_transition_effect_name_wipe_right		{ buf = qtn_vei_edit_video_main_tran_wipe_right; }
+RESOURCE TBUF64 r_vei_middle_transition_effect_name_wipe_top		{ buf = qtn_vei_edit_video_main_tran_wipe_top; }
+RESOURCE TBUF64 r_vei_middle_transition_effect_name_wipe_bottom		{ buf = qtn_vei_edit_video_main_tran_wipe_bottom; }
+RESOURCE TBUF64 r_vei_end_transition_effect_name_none				{ buf = qtn_vei_edit_video_main_tran_no; }
+RESOURCE TBUF64 r_vei_end_transition_effect_name_fade_to_black		{ buf = qtn_vei_edit_video_main_tran_fade_to_black; }
+RESOURCE TBUF64 r_vei_end_transition_effect_name_fade_to_white		{ buf = qtn_vei_edit_video_main_tran_fade_to_white; }
+
+//
+// NOTE
+//
+RESOURCE TBUF128 r_vei_note_video_saved								{ buf = qtn_vei_edit_video_note_saved; }
+RESOURCE TBUF128 r_vei_note_snapshot_saved							{ buf = qtn_vei_note_snapshot_saved; }
+RESOURCE TBUF128 r_vei_note_snapshot_taken_to_images					{ buf = qtn_vei_note_snapshot_taken_to_images; }
+RESOURCE TBUF	r_vei_note_confirmation_query_cancel_textinsert			{ buf = qtn_vei_confirm_note_cancel_textinsert; }
+
+// 
+// PROGRESS NOTE
+//
+RESOURCE TBUF64 r_vei_progress_note_saving							{ buf = qtn_gen_note_saving; }
+RESOURCE TBUF64 r_vei_progress_note_cut								{ buf = qtn_vei_progress_note_preparing_to_cut; }
+RESOURCE TBUF128 r_vei_progress_note_color_effect					{ buf = qtn_vei_progress_note_applying_color_effect; }
+RESOURCE TBUF64 r_vei_progress_note_cutting_video					{ buf = qtn_vei_progress_note_cutting_video; }
+RESOURCE TBUF128 r_vei_progress_note_saving_image					{ buf = qtn_ved_saving_snapshot; }      
+RESOURCE TBUF128 r_vei_progress_note_inserting_audio					{ buf = qtn_ved_inserting_audio; } 
+RESOURCE TBUF	r_vei_progress_note_inserting_media					{ buf = qtn_ved_inserting_mult_media; }
+
+RESOURCE TBUF128 r_vei_video_failed									{ buf = qtn_vei_video_failed; }
+RESOURCE TBUF64 r_vei_progress_note_send							{ buf = qtn_vei_progress_note_preparing_to_send; }
+RESOURCE TBUF64 r_vei_remove_clip_query								{ buf = qtn_query_common_conf_remove; }
+
+RESOURCE TBUF r_vei_popup_select_effect_title						{ buf = qtn_vei_list_query_select_effect; }
+
+RESOURCE TBUF128 r_vei_navi_pane_duration							{ buf = qtn_vei_navi_change_audio_duration; }
+RESOURCE TBUF256 r_vei_recording_failed								{ buf = qtn_vei_recording_failed; }
+
+RESOURCE TBUF128 r_vei_not_enough_space								{ buf = qtn_memlo_not_enough_memory; }
+RESOURCE TBUF128 r_vei_memory_running_out							{ buf = qtn_memlo_memory_running_out; } 
+RESOURCE TBUF128 r_vei_progress_note_processing						{ buf = qtn_ved_processing_movie; }
+
+
+//
+//	Main pane - Text descriptive name
+//
+RESOURCE TBUF256 r_vei_edit_view_title_name				{ buf = qtn_vei_edit_video_main_text_t; }
+RESOURCE TBUF256 r_vei_edit_view_title_fading_name		{ buf = qtn_vei_edit_video_main_text_tf; }
+RESOURCE TBUF256 r_vei_edit_view_subtitle_name			{ buf = qtn_vei_edit_video_main_text_subt; }
+RESOURCE TBUF256 r_vei_edit_view_subtitle_fading_name	{ buf = qtn_vei_edit_video_main_text_subtf; }
+RESOURCE TBUF256 r_vei_edit_view_credits_name			{ buf = qtn_vei_edit_video_main_text_credit; }
+
+RESOURCE TBUF128 r_vei_edit_view_no_video				{ buf = qtn_ved_edit_video_no_video; }
+RESOURCE TBUF128 r_vei_edit_view_no_audio				{ buf = qtn_ved_edit_video_no_audio; }
+RESOURCE TBUF64  r_vei_query_file_name					{ buf = qtn_vei_data_query_set_file_name; }
+
+//
+// POPUP Titles
+//
+RESOURCE TBUF	r_vei_popup_edit_image_title			{ buf = qtn_ved_menu_title_edit_image; }
+RESOURCE TBUF	r_vei_popup_edit_text_title				{ buf = qtn_ved_menu_title_edit_text; }
+RESOURCE TBUF	r_vei_popup_edit_video_title			{ buf = qtn_ved_menu_title_edit_video; }
+RESOURCE TBUF	r_vei_popup_edit_audio_title			{ buf = qtn_ved_menu_title_edit_audio; }
+RESOURCE TBUF	r_vei_popup_insert_audio_title			{ buf = qtn_vei_list_query_insert_sound_type; }
+RESOURCE TBUF	r_vei_popup_insert_stuff_title			{ buf = qtn_ved_menu_title_insert_video; }
+RESOURCE TBUF	r_vei_popup_select_text_style_title		{ buf = qtn_ved_smenu_heading_editt; }
+RESOURCE TBUF64 r_vei_transtion_popup_title				{ buf = qtn_vei_list_query_select_tran_title; }
+
+// 
+//	ERRORNOTES
+// 
+RESOURCE TBUF	r_vei_errornote_audio_inserting_failed	{ buf = qtn_ved_audio_insert_failed; }
+RESOURCE TBUF	r_vei_errornote_image_inserting_failed	{ buf = qtn_ved_image_insert_failed; }
+RESOURCE TBUF	r_vei_edit_view_new_audio				{ buf = qtn_vei_edit_video_main_new_audio; }
+
+RESOURCE TBUF	r_vei_warning_note_inserting_failed		{ buf = qtn_ved_inserting_failed_continue; }
+
+// SETTINGS
+RESOURCE TBUF128 r_vei_settings_view_settings_item_value			{ buf = qtn_vei_settings_value1_movie; }
+RESOURCE TBUF128 r_vei_settings_view_settings_item2_value			{ buf = qtn_vei_settings_value2_snapshot; }
+
+
+// Layouts
+/*
+//-----------------------------------------------------------------------------
+//   
+//    r_ved_start_text_pane_portrait
+//    Layout for 'Start:' text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_TEXT r_ved_start_text_pane_portrait
+    {
+	font = EAknLogicalFontPrimaryFont;
+	C = 215;
+	l = 4;
+	r = 178;
+	B = 21;
+	W = 170;
+	J = ELayoutAlignLeft;    
+    }
+
+//-----------------------------------------------------------------------------
+//   
+//    r_ved_end_text_pane_portrait
+//    Layout for 'End:' text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_TEXT r_ved_end_text_pane_portrait
+    {
+	font = EAknLogicalFontPrimaryFont;
+	C = 215;
+	l = 178;
+	r = 4;
+	B = 21;
+	W = 170;
+	J = ELayoutAlignLeft;    
+    }
+
+
+RESOURCE AVKON_LAYOUT_RECT r_ved_clip_thumbnail_start_pane_portrait
+	{
+	C = ELayoutEmpty;
+	l = 4;
+	t = 31;
+	r = ELayoutEmpty;
+	b = ELayoutEmpty;
+	W = 170;
+	H = 139;
+	}
+
+RESOURCE AVKON_LAYOUT_RECT r_ved_clip_thumbnail_end_pane_portrait
+    {
+    C = ELayoutEmpty;
+    l = 178;
+    t = 31;
+    r = 4;
+    b = 115;
+    W = 170;
+    H = 139;
+    }
+
+RESOURCE AVKON_LAYOUT_RECT r_ved_trim_timeline_pane_g1_portrait
+    {
+    C = 215;
+    l = 4;
+    t = 220;
+    r = ELayoutEmpty;
+    b = ELayoutEmpty;
+    W = 24;
+    H = 24;
+    }
+
+RESOURCE AVKON_LAYOUT_RECT r_ved_trim_timeline_pane_portrait
+    {
+    C = ELayoutEmpty;
+    l = 38;
+    t = 215;
+    r = ELayoutEmpty;
+    b = ELayoutEmpty;
+    W = 306;
+    H = 34;
+    }
+*/
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/ManualVideoEditor_caption.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "manualvideoeditor.loc"
+#include <apcaptionfile.rh>
+
+RESOURCE CAPTION_DATA
+{
+    caption=qtn_app_caption_string;
+    shortcaption=qtn_app_short_caption_string;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/ManualVideoEditor_reg.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#include <appinfo.rh>
+#include <Manualvideoeditor.rsg>
+#include <data_caging_paths_strings.hrh>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x10208A29
+
+RESOURCE APP_REGISTRATION_INFO
+	{
+	app_file="ManualVideoEditor";
+	localisable_resource_file = APP_RESOURCE_DIR"\\manualvideoeditor";	
+	localisable_resource_id = R_VEI_LOCALISABLE_APP_INFO;	
+	hidden = KAppIsHidden;
+	embeddability = KAppEmbeddable;
+	launch = KAppLaunchInForeground;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/help/VideoEditorHelp.cshlp.txt	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,41 @@
+
+/*
+* ============================================================================
+*  Name        : VideoEditorHelp.cshlp.txt
+*  Part of     : Video Editor / ?Module_name
+*  Description : ?Description
+*  Version     : %version: 2 % << Don't touch! Updated by Synergy at check-out.
+*
+*  Copyright © 2007 Nokia.  All rights reserved.
+*  This material, including documentation and any related computer
+*  programs, is protected by copyright controlled by Nokia.  All
+*  rights are reserved.  Copying, including reproducing, storing,
+*  adapting or translating, any or all of this material requires the
+*  prior written consent of Nokia.  This material also contains
+*  confidential information which may not be disclosed to others
+*  without the prior written consent of Nokia.
+* ============================================================================
+* Template version: 4.1
+*/
+
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml:stylesheet href="/epoc32/tools/cshlpcmp/xsl/CSHproj.xsl" title="CS-Help project" type="text/xsl"?>
+<!DOCTYPE cshproj SYSTEM "/epoc32/tools/cshlpcmp/dtd/cshproj.dtd">
+
+<cshproj>
+  <helpfileUID>0x101FFA9C</helpfileUID>
+  <directories>
+    <input></input>
+    <output></output>
+    <graphics></graphics>
+    <working></working>
+  </directories>
+  <files>
+    <source>
+      <file>VideoEditorHelp.rtf</file>
+    </source>
+    <destination>VideoEditorHelp.hlp</destination>
+	<customization>custom.xml</customization>
+  </files>
+</cshproj>
+
Binary file videditor/ManualVideoEditor/data/help/VideoEditorHelp.hlp has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/help/VideoEditorHelp.rtf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,151 @@
+{\rtf1\ansi\ansicpg1252\uc1\deff1\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
+{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial{\*\falt Arial};}{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}
+{\f6\froman\fcharset0\fprq2{\*\panose 02020603040505020304}Tms Rmn{\*\falt Times New Roman};}{\f10\fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}{\f40\fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana;}
+{\f48\froman\fcharset2\fprq2{\*\panose 05030102010509060703}Webdings;}{\f58\fswiss\fcharset0\fprq2{\*\panose 020b0506020202030204}Arial Narrow;}{\f174\froman\fcharset238\fprq2 Times New Roman CE;}{\f175\froman\fcharset204\fprq2 Times New Roman Cyr;}
+{\f177\froman\fcharset161\fprq2 Times New Roman Greek;}{\f178\froman\fcharset162\fprq2 Times New Roman Tur;}{\f179\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f180\froman\fcharset178\fprq2 Times New Roman (Arabic);}
+{\f181\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f182\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f184\fswiss\fcharset238\fprq2 Arial CE{\*\falt Arial};}{\f185\fswiss\fcharset204\fprq2 Arial Cyr{\*\falt Arial};}
+{\f187\fswiss\fcharset161\fprq2 Arial Greek{\*\falt Arial};}{\f188\fswiss\fcharset162\fprq2 Arial Tur{\*\falt Arial};}{\f189\fswiss\fcharset177\fprq2 Arial (Hebrew){\*\falt Arial};}{\f190\fswiss\fcharset178\fprq2 Arial (Arabic){\*\falt Arial};}
+{\f191\fswiss\fcharset186\fprq2 Arial Baltic{\*\falt Arial};}{\f192\fswiss\fcharset163\fprq2 Arial (Vietnamese){\*\falt Arial};}{\f194\fmodern\fcharset238\fprq1 Courier New CE;}{\f195\fmodern\fcharset204\fprq1 Courier New Cyr;}
+{\f197\fmodern\fcharset161\fprq1 Courier New Greek;}{\f198\fmodern\fcharset162\fprq1 Courier New Tur;}{\f199\fmodern\fcharset177\fprq1 Courier New (Hebrew);}{\f200\fmodern\fcharset178\fprq1 Courier New (Arabic);}
+{\f201\fmodern\fcharset186\fprq1 Courier New Baltic;}{\f202\fmodern\fcharset163\fprq1 Courier New (Vietnamese);}{\f574\fswiss\fcharset238\fprq2 Verdana CE;}{\f575\fswiss\fcharset204\fprq2 Verdana Cyr;}{\f577\fswiss\fcharset161\fprq2 Verdana Greek;}
+{\f578\fswiss\fcharset162\fprq2 Verdana Tur;}{\f581\fswiss\fcharset186\fprq2 Verdana Baltic;}{\f582\fswiss\fcharset163\fprq2 Verdana (Vietnamese);}{\f754\fswiss\fcharset238\fprq2 Arial Narrow CE;}{\f755\fswiss\fcharset204\fprq2 Arial Narrow Cyr;}
+{\f757\fswiss\fcharset161\fprq2 Arial Narrow Greek;}{\f758\fswiss\fcharset162\fprq2 Arial Narrow Tur;}{\f761\fswiss\fcharset186\fprq2 Arial Narrow Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
+\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;
+\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \snext0 Normal;}{
+\s1\ql \li0\ri0\sb360\sa240\keepn\widctlpar\nooverflow\faroman\outlinelevel0\rin0\lin0\itap0 \b\f1\fs32\lang2057\langfe1033\kerning28\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext0 heading 1;}{\s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt
+\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072\nooverflow\faroman\outlinelevel1\rin0\lin0\rtlgutter\itap0 \b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext0 heading 2;}{
+\s3\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \tqr\tx9072\nooverflow\faroman\outlinelevel2\rin0\lin0\rtlgutter\itap0 \b\f1\fs28\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext0 heading 3;}{
+\s4\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw15\brsp20 \tqr\tx9072\nooverflow\faroman\outlinelevel3\rin0\lin0\rtlgutter\itap0 \b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext0 heading 4;}{
+\s5\ql \li0\ri0\sa120\keepn\widctlpar\nooverflow\faroman\outlinelevel4\rin0\lin0\itap0 \b\f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext0 heading 5;}{
+\s6\ql \li0\ri0\sb240\sa60\widctlpar\nooverflow\faroman\outlinelevel5\rin0\lin0\itap0 \i\f1\fs22\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext0 heading 6;}{
+\s7\ql \li0\ri0\sb240\sa60\widctlpar\nooverflow\faroman\outlinelevel6\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext0 heading 7;}{
+\s8\ql \li0\ri0\sb240\sa60\widctlpar\nooverflow\faroman\outlinelevel7\rin0\lin0\itap0 \i\f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext0 heading 8;}{
+\s9\ql \li0\ri0\sb240\sa60\widctlpar\nooverflow\faroman\outlinelevel8\rin0\lin0\itap0 \i\f1\fs18\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext0 heading 9;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv 
+\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\s15\ql \fi-284\li284\ri0\sa120\widctlpar\tx284{\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0
+\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin284\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext15 List Bullet;}{
+\s16\ql \li284\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin284\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext16 List Continue;}{\s17\ql \fi-284\li284\ri0\sa120\widctlpar{\*\pn \pnlvlbody\ilvl11\ls2047\pnrnot0
+\pndec\pnstart1\pnindent283\pnhang {\pntxta .}}\nooverflow\faroman\ls2047\ilvl11\rin0\lin284\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext17 List Number;}{\*\cs18 \additive \super \sbasedon10 \ssemihidden 
+endnote reference;}{\s19\ql \fi-284\li568\ri0\sa120\widctlpar{\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin568\itap0 
+\f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext19 List Bullet 2;}{\s20\ql \li0\ri0\sb360\sa240\keepn\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \b\f1\fs32\cf9\lang2057\langfe1033\kerning28\cgrid\langnp2057\langfenp1033 
+\sbasedon0 \snext20 Category UID;}{\*\cs21 \additive \b\f2\fs20 \sbasedon10 Key Name;}{\s22\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\cf13\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext22 Synonyms;}{
+\s23\ql \fi-284\li284\ri0\sa120\widctlpar\tx284{\*\pn \pnlvlbody\ilvl0\ls2047\pnrnot0\pndec\pnf6 }\nooverflow\faroman\ls2047\rin0\lin284\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon17 \snext23 List Manual;}{
+\s24\ql \fi-284\li568\ri0\sa120\widctlpar{\*\pn \pnlvlbody\ilvl11\ls2047\pnrnot0\pndec\pnstart1\pnindent283\pnhang {\pntxta .}}\nooverflow\faroman\ls2047\ilvl11\rin0\lin568\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 
+\sbasedon0 \snext24 List Number 2;}{\s25\ql \li566\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin566\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext25 List Continue 2;}{
+\s26\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\cf11\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext26 Definition Term;}{\s27\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 
+\f1\fs20\cf11\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon26 \snext27 Definition Definition;}{\s28\ql \fi-283\li283\ri0\sa120\widctlpar{\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0\pnf10\pnstart1\pnindent283\pnhang {\pntxtb F}}
+\nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext28 Tip;}{\s29\ql \fi-283\li283\ri0\sa120\widctlpar{\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0\pnf10\pnstart1\pnindent283\pnhang 
+{\pntxtb ?}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon28 \snext29 Note;}{\s30\ql \fi-283\li283\ri0\sa120\widctlpar{\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb ~}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon29 \snext30 Important;}{\s31\ql \fi-284\li568\ri0\sa120\widctlpar\tx284{\*\pn 
+\pnlvlbody\ilvl0\ls2047\pnrnot0\pndec\pnf6 }\nooverflow\faroman\ls2047\rin0\lin568\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon24 \snext31 List Manual 2;}{\s32\ql \li0\ri0\sa120\widctlpar
+\tqc\tx4153\tqr\tx8306\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext32 footer;}{\s33\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 
+\i\f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext33 Comment;}{\*\cs34 \additive \b\f1\fs20 \sbasedon10 App Text;}{\*\cs35 \additive \scaps\f58\fs20\cf13 \sbasedon10 Graphic Link;}{\s36\ql \fi-283\li283\ri0\sa120\widctlpar
+\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0\pnf48\pnstart1\pnindent283\pnhang {\pntxtb \'a2}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext36 
+Context;}{\s37\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0\pnf48\pnstart1\pnindent283\pnhang {\pntxtb i}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 
+\f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext37 Index;}{\*\cs38 \additive \i\f1\fs20\ulnone\cf0\nosupersub \sbasedon10 Context Comment;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\listtable
+{\list\listtemplateid-1008425822\listsimple{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\fi-360\li643\jclisttab\tx643\lin643 }{\listname ;}\listid-129}
+{\list\listtemplateid1404049864\listsimple{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li643\jclisttab\tx643\lin643 }{\listname 
+;}\listid-125}{\list\listtemplateid-1401655024\listsimple{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\fi-360\li360\jclisttab\tx360\lin360 }{\listname 
+;}\listid-120}{\list\listtemplateid-1370049202\listsimple{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-360\li360\jclisttab\tx360\lin360 }
+{\listname ;}\listid-119}{\list\listtemplateid-1236236044\listsimple{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat0\levelspace0\levelindent0{\leveltext\'01*;}{\levelnumbers;}}{\listname ;}\listid-2}}{\*\listoverridetable
+{\listoverride\listid-119\listoverridecount0\ls1}{\listoverride\listid-120\listoverridecount0\ls2}{\listoverride\listid-125\listoverridecount0\ls3}{\listoverride\listid-129\listoverridecount0\ls4}{\listoverride\listid-119\listoverridecount0\ls5}
+{\listoverride\listid-120\listoverridecount0\ls6}{\listoverride\listid-125\listoverridecount0\ls7}{\listoverride\listid-129\listoverridecount0\ls8}{\listoverride\listid-119\listoverridecount0\ls9}{\listoverride\listid-120\listoverridecount0\ls10}
+{\listoverride\listid-125\listoverridecount0\ls11}{\listoverride\listid-129\listoverridecount0\ls12}{\listoverride\listid-119\listoverridecount0\ls13}{\listoverride\listid-120\listoverridecount0\ls14}{\listoverride\listid-125\listoverridecount0\ls15}
+{\listoverride\listid-129\listoverridecount0\ls16}{\listoverride\listid-119\listoverridecount0\ls17}{\listoverride\listid-120\listoverridecount0\ls18}{\listoverride\listid-125\listoverridecount0\ls19}{\listoverride\listid-129\listoverridecount0\ls20}
+{\listoverride\listid-119\listoverridecount0\ls21}{\listoverride\listid-120\listoverridecount0\ls22}{\listoverride\listid-125\listoverridecount0\ls23}{\listoverride\listid-129\listoverridecount0\ls24}{\listoverride\listid-2\listoverridecount1{\lfolevel
+\listoverrideformat{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelold\levelspace0\levelindent283{\leveltext\'01\u-3934 ?;}{\levelnumbers;}\f48\fbias0 \fi-283\li283\lin283 }}\ls25}{\listoverride\listid-2
+\listoverridecount1{\lfolevel\listoverrideformat{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelold\levelspace0\levelindent283{\leveltext\'01\u-3991 ?;}{\levelnumbers;}\f48\fbias0 \fi-283\li283\lin283 }}\ls26}
+{\listoverride\listid-2\listoverridecount1{\lfolevel\listoverrideformat{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelold\levelspace0\levelindent283{\leveltext\'01\u-3970 ?;}{\levelnumbers;}\f48\fbias0 
+\fi-283\li283\lin283 }}\ls27}{\listoverride\listid-2\listoverridecount1{\lfolevel\listoverrideformat{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelold\levelspace0\levelindent283{\leveltext
+\'01\u-4026 ?;}{\levelnumbers;}\f10\fbias0 \fi-283\li283\lin283 }}\ls28}{\listoverride\listid-2\listoverridecount1{\lfolevel\listoverrideformat{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelold\levelspace0
+\levelindent283{\leveltext\'01\u-4033 ?;}{\levelnumbers;}\f10\fbias0 \fi-283\li283\lin283 }}\ls29}{\listoverride\listid-2\listoverridecount1{\lfolevel\listoverrideformat{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1
+\levelold\levelspace0\levelindent283{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\fbias0 \fi-283\li283\lin283 }}\ls30}}{\*\rsidtbl \rsid4339534\rsid4791705\rsid4999843\rsid5054838\rsid6100133\rsid6823436\rsid8657082\rsid9900545\rsid10618944\rsid11021345
+\rsid11672662\rsid12463523}{\*\generator Microsoft Word 11.0.6359;}{\info{\title Author: }{\author Mikko Nieminen}{\operator Mikko Nieminen}{\creatim\yr2004\mo12\dy22\hr13\min54}{\revtim\yr2005\mo2\dy23\hr9\min9}{\version11}{\edmins74}{\nofpages2}
+{\nofwords170}{\nofchars970}{\*\company Dell Computer Corporation}{\nofcharsws1138}{\vern24703}}\paperw11907\paperh16840\margl567\margr7371\margt567\margb567 
+\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\formshade\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow1\dgvshow0
+\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\bdrrlswsix\nolnhtadjtbl\oldas\viewnobound1\nojkernpunct\rsidroot4339534 \fet0{\*\template G:\\epoc32\\cshlpcmp_template\\cshelp2000.dot}{\*\ftnsep \pard\plain 
+\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid4791705 \chftnsep 
+\par }}{\*\ftnsepc \pard\plain \ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid4791705 \chftnsepc 
+\par }}{\*\aftnsep \pard\plain \ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid4791705 \chftnsep 
+\par }}{\*\aftnsepc \pard\plain \ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid4791705 \chftnsepc 
+\par }}\sectd \psz9\sbknone\linex0\endnhere\sectdefaultcl\sftnbj {\footer \pard\plain \qc \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\field{\*\fldinst {\insrsid4339534  PAGE }
+}{\fldrslt {\lang1024\langfe1024\noproof\insrsid10618944 2}}}{\insrsid4339534 
+\par }}{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}
+{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8
+\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain \s33\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 
+\i\f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid4339534 Author: }{\insrsid4999843 Mikko.Nieminen@geracap.fi}{\insrsid4339534 
+\par Date: }{\insrsid4791705 22.}{\insrsid6823436 02.2005}{\insrsid4339534 
+\par Version: }{\insrsid6823436 1.1}{\insrsid4339534 
+\par }{\insrsid4999843 Description: This help source file is intended only for testing the Video Editor context/view sensitive helps.
+\par }\pard\plain \s1\ql \li0\ri0\sb360\sa240\keepn\widctlpar\nooverflow\faroman\outlinelevel0\rin0\lin0\itap0 \b\f1\fs32\lang2057\langfe1033\kerning28\cgrid\langnp2057\langfenp1033 {\insrsid4791705 Video editor}{\insrsid4339534 
+\par }\pard\plain \s20\ql \li0\ri0\sb360\sa240\keepn\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \b\f1\fs32\cf9\lang2057\langfe1033\kerning28\cgrid\langnp2057\langfenp1033 {\insrsid4791705\charrsid4791705 0x101FFA9C}{\insrsid4339534\charrsid4791705 
+\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072\nooverflow\faroman\outlinelevel1\rin0\lin0\rtlgutter\itap0 \b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {
+\insrsid4791705 Trim for MMS}{\insrsid4339534 
+\par {\pntext\pard\plain\s36 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid12463523 \loch\af48\dbch\af0\hich\f48 \'a2\tab}}\pard\plain \s36\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls25\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb \'a2}}\nooverflow\faroman\ls25\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid12463523 VedHlpTrimForMmsView}{\insrsid4339534 
+\par {\pntext\pard\plain\s37 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid12463523 \loch\af48\dbch\af0\hich\f48 \'69\tab}}\pard\plain \s37\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls26\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb i}}\nooverflow\faroman\ls26\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid12463523 Trimming videos}{\insrsid4339534 
+\par }\pard\plain \ql \li0\ri0\sa120\widctlpar{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid11021345 This topic is }{\insrsid9900545 for}{\insrsid11021345  }{
+\b\insrsid11021345 Trim for MMS}{\insrsid11021345  view.}{\insrsid4339534\charrsid11021345 
+\par {\pntext\pard\plain\s15 \f3\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid11021345\charrsid8657082 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard\plain \s15\ql \fi-284\li284\ri0\sa120\widctlpar\tx284{\*\pn \pnlvlbody\ilvl0\ls30\pnrnot0
+\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}\nooverflow\faroman\ls30\rin0\lin284\itap0\pararsid12463523 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid11021345\charrsid8657082 
+"Aina ku m\'e4 hypp\'e4\'e4n ja p\'e4\'e4sen siihen hyppyrin nokalle, niin mulle tulee sellanen "bon voyage" -tunne, siis ett\'e4 m\'e4 oon kokenu t\'e4n joskus aikasemminkin."}{\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid11021345  }{
+\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid8657082 -}{\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid11021345 M. Nyk\'e4nen}{\lang1035\langfe1033\langnp1035\insrsid4791705\charrsid9900545 
+\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\outlinelevel1\rin0\lin0\rtlgutter\itap0\pararsid9900545 
+\b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid9900545 Settings
+\par {\pntext\pard\plain\s36 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid9900545 \loch\af48\dbch\af0\hich\f48 \'a2\tab}}\pard\plain \s36\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls25\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb \'a2}}\nooverflow\faroman\ls25\rin0\lin283\itap0\pararsid9900545 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid9900545 VedHlpSettingsView
+\par {\pntext\pard\plain\s37 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid9900545 \loch\af48\dbch\af0\hich\f48 \'69\tab}}\pard\plain \s37\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls26\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb i}}\nooverflow\faroman\ls26\rin0\lin283\itap0\pararsid9900545 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid9900545 Settings
+\par }\pard\plain \ql \li0\ri0\sa120\widctlpar{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\rin0\lin0\itap0\pararsid9900545 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid9900545 This topic is for }{\b\insrsid9900545 
+Settings}{\insrsid9900545  view.}{\insrsid9900545\charrsid11021345 
+\par {\pntext\pard\plain\s15 \f3\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid9900545\charrsid9900545 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard\plain \s15\ql \fi-284\li284\ri0\sa120\widctlpar\tx284{\*\pn \pnlvlbody\ilvl0\ls30\pnrnot0
+\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}\nooverflow\faroman\ls30\rin0\lin284\itap0\pararsid9900545 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid9900545\charrsid9900545 
+"Kaikki on allright ainakin minulla. En tied\'e4, onko muilla."}{\lang1035\langfe1033\langnp1035\insrsid9900545\charrsid9900545  }{\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid9900545 -M. Nyk\'e4nen}{
+\lang1035\langfe1033\langnp1035\insrsid9900545\charrsid9900545 
+\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\outlinelevel1\rin0\lin0\rtlgutter\itap0\pararsid5054838 
+\b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid5054838 Edit video
+\par {\pntext\pard\plain\s36 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid5054838 \loch\af48\dbch\af0\hich\f48 \'a2\tab}}\pard\plain \s36\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls25\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb \'a2}}\nooverflow\faroman\ls25\rin0\lin283\itap0\pararsid5054838 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid5054838 VedHlpEditVideoView
+\par {\pntext\pard\plain\s37 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid5054838 \loch\af48\dbch\af0\hich\f48 \'69\tab}}\pard\plain \s37\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls26\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb i}}\nooverflow\faroman\ls26\rin0\lin283\itap0\pararsid5054838 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid5054838 Editing videos
+\par }\pard\plain \ql \li0\ri0\sa120\widctlpar{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\rin0\lin0\itap0\pararsid5054838 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid5054838 This topic is for }{\b\insrsid5054838 
+Edit video}{\insrsid5054838  view.}{\insrsid5054838\charrsid11021345 
+\par {\pntext\pard\plain\s15 \f3\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid5054838\charrsid5054838 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard\plain \s15\ql \fi-284\li284\ri0\sa120\widctlpar\tx284{\*\pn \pnlvlbody\ilvl0\ls30\pnrnot0
+\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}\nooverflow\faroman\ls30\rin0\lin284\itap0\pararsid5054838 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid5054838\charrsid5054838 
+"Jokainen ts\'e4\'e4nssi on mahdollisuus!"}{\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid5054838  -M. Nyk\'e4nen}{\lang1035\langfe1033\langnp1035\insrsid5054838\charrsid9900545 
+\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\outlinelevel1\rin0\lin0\rtlgutter\itap0\pararsid5054838 
+\b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid5054838 Cut video
+\par {\pntext\pard\plain\s36 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid5054838 \loch\af48\dbch\af0\hich\f48 \'a2\tab}}\pard\plain \s36\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls25\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb \'a2}}\nooverflow\faroman\ls25\rin0\lin283\itap0\pararsid5054838 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid5054838 VedHlpCutVideoView
+\par {\pntext\pard\plain\s37 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid5054838 \loch\af48\dbch\af0\hich\f48 \'69\tab}}\pard\plain \s37\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls26\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb i}}\nooverflow\faroman\ls26\rin0\lin283\itap0\pararsid5054838 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid5054838 Cutting videos
+\par }\pard\plain \ql \li0\ri0\sa120\widctlpar{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\rin0\lin0\itap0\pararsid5054838 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid5054838 This topic is for }{\b\insrsid5054838 
+Cut video}{\insrsid5054838  view.}{\insrsid5054838\charrsid11021345 
+\par {\pntext\pard\plain\s15 \f3\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid5054838\charrsid5054838 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard\plain \s15\ql \fi-284\li284\ri0\sa120\widctlpar\tx284{\*\pn \pnlvlbody\ilvl0\ls30\pnrnot0
+\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}\nooverflow\faroman\ls30\rin0\lin284\itap0\pararsid5054838 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid5054838\charrsid5054838 
+"Se on ihan fifty-sixty miten k\'e4y."}{\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid5054838  -M. Nyk\'e4nen}{\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid5054838\charrsid5054838 
+\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\outlinelevel1\rin0\lin0\rtlgutter\itap0\pararsid6100133 
+\b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid6100133 Cut audio
+\par {\pntext\pard\plain\s36 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid6100133 \loch\af48\dbch\af0\hich\f48 \'a2\tab}}\pard\plain \s36\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls25\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb \'a2}}\nooverflow\faroman\ls25\rin0\lin283\itap0\pararsid6100133 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid6100133 VedHlpCutAudioView
+\par {\pntext\pard\plain\s37 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid6100133 \loch\af48\dbch\af0\hich\f48 \'69\tab}}\pard\plain \s37\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls26\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb i}}\nooverflow\faroman\ls26\rin0\lin283\itap0\pararsid6100133 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid6100133 Cutting audio clips
+\par }\pard\plain \ql \li0\ri0\sa120\widctlpar{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\rin0\lin0\itap0\pararsid6100133 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid6100133 This topic is for }{\b\insrsid6100133 
+Cut audio}{\insrsid6100133  view.}{\insrsid6100133\charrsid11021345 
+\par {\pntext\pard\plain\s15 \f3\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid6100133\charrsid6100133 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard\plain \s15\ql \fi-284\li284\ri0\sa120\widctlpar\tx284{\*\pn \pnlvlbody\ilvl0\ls30\pnrnot0
+\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}\nooverflow\faroman\ls30\rin0\lin284\itap0\pararsid6100133 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid6100133\charrsid6100133 
+"Rakkaus on kuin lankaker\'e4 - se alkaa ja loppuu."}{\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid6100133  -M. Nyk\'e4nen
+\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\outlinelevel1\rin0\lin0\rtlgutter\itap0\pararsid10618944 
+\b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid10618944 Preview movies
+\par {\pntext\pard\plain\s36 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid10618944\charrsid10618944 \loch\af48\dbch\af0\hich\f48 \'a2\tab}}\pard\plain \s36\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls25\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb \'a2}}\nooverflow\faroman\ls25\rin0\lin283\itap0\pararsid10618944 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid10618944\charrsid10618944 VedHlpPreviewView}{\insrsid10618944 
+\par {\pntext\pard\plain\s37 \f48\fs20\lang2057\langfe1033\langnp2057\insrsid10618944 \loch\af48\dbch\af0\hich\f48 \'69\tab}}\pard\plain \s37\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlbody\ilvl0\ls26\pnrnot0
+\pnf48\pnstart1\pnindent283\pnhang {\pntxtb i}}\nooverflow\faroman\ls26\rin0\lin283\itap0\pararsid10618944 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid10618944 Previewing movie
+\par }\pard\plain \ql \li0\ri0\sa120\widctlpar{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\rin0\lin0\itap0\pararsid10618944 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\insrsid10618944 This topic is for }{\b\insrsid10618944 
+Preview}{\insrsid10618944  view.}{\insrsid10618944\charrsid11021345 
+\par {\pntext\pard\plain\s15 \f3\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid10618944\charrsid6100133 \loch\af3\dbch\af0\hich\f3 \'b7\tab}}\pard\plain \s15\ql \fi-284\li284\ri0\sa120\widctlpar\tx284{\*\pn \pnlvlbody\ilvl0\ls30\pnrnot0
+\pnf3\pnstart1\pnindent283\pnhang {\pntxtb \'b7}}\nooverflow\faroman\ls30\rin0\lin284\itap0\pararsid10618944 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid10618944\charrsid6100133 
+"Rakkaus on kuin lankaker\'e4 - se alkaa ja loppuu."}{\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid10618944  -M. Nyk\'e4nen}{\f40\fs15\cf1\lang1035\langfe1033\langnp1035\insrsid10618944\charrsid5054838 
+\par }\pard \s15\ql \li0\ri0\sa120\widctlpar\tx284\nooverflow\faroman\rin0\lin0\itap0\pararsid9900545 {\lang1035\langfe1033\langnp1035\insrsid9900545\charrsid11021345 
+\par }}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/help/custom.xml	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE cshcust SYSTEM "/cshlpcmp/dtd/CSHcust.dtd">
+<?xml:stylesheet href="/cshlpcmp/xsl/cshcust.xsl" title="CS-Help customization" type="text/xsl"?>
+<cshcust>
+<parastyle name="body" font="sansserif" size="10"/>
+
+<body style="body"/>
+
+</cshcust>
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/icons.mk	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,162 @@
+#
+# Copyright (c) 2010 Ixonos Plc.
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - Initial contribution
+#
+# Contributors:
+# Ixonos Plc
+#
+# Description:
+#
+
+ifeq (WINSCW,$(findstring WINSCW, $(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=$(EPOCROOT)epoc32\data\Z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+HEADERDIR=$(EPOCROOT)epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\ManualVideoEditor.mif
+HEADERFILENAME=$(HEADERDIR)\ManualVideoEditor.mbg
+
+do_nothing:
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+ 
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+	qgn_graf_ve_symbol_audio.svg \
+	qgn_prop_ve_file_video.svg \
+	qgn_prop_ve_file_audio.svg \
+	qgn_prop_ve_slow.svg \
+	qgn_prop_ve_bw.svg \
+	qgn_prop_ve_colour.svg \
+	qgn_prop_ve_muted.svg \
+	qgn_graf_ve_symbol_cut_audio.svg \
+	qgn_prop_ve_rec.svg \
+	qgn_graf_ve_trans_diptoblack01.svg \
+	qgn_graf_ve_trans_diptoblack02.svg \
+	qgn_graf_ve_trans_diptoblack03.svg \
+	qgn_graf_ve_trans_diptoblack04.svg \
+	qgn_graf_ve_trans_diptoblack05.svg \
+	qgn_graf_ve_trans_diptoblack06.svg \
+	qgn_graf_ve_trans_diptoblack07.svg \
+	qgn_graf_ve_trans_diptoblack08.svg \
+	qgn_graf_ve_trans_diptoblack09.svg \
+	qgn_graf_ve_trans_diptoblack10.svg \
+	qgn_graf_ve_trans_diptoblack11.svg \
+	qgn_graf_ve_trans_diptoblack12.svg \
+	qgn_graf_ve_trans_diptoblack13.svg \
+	qgn_graf_ve_trans_diptowhite01.svg \
+	qgn_graf_ve_trans_diptowhite02.svg \
+	qgn_graf_ve_trans_diptowhite03.svg \
+	qgn_graf_ve_trans_diptowhite04.svg \
+	qgn_graf_ve_trans_diptowhite05.svg \
+	qgn_graf_ve_trans_diptowhite06.svg \
+	qgn_graf_ve_trans_diptowhite07.svg \
+	qgn_graf_ve_trans_diptowhite08.svg \
+	qgn_graf_ve_trans_diptowhite09.svg \
+	qgn_graf_ve_trans_diptowhite10.svg \
+	qgn_graf_ve_trans_diptowhite11.svg \
+	qgn_graf_ve_trans_diptowhite12.svg \
+	qgn_graf_ve_trans_diptowhite13.svg \
+	qgn_graf_ve_trans_crossfade01.svg \
+	qgn_graf_ve_trans_crossfade02.svg \
+	qgn_graf_ve_trans_crossfade03.svg \
+	qgn_graf_ve_trans_crossfade04.svg \
+	qgn_graf_ve_trans_crossfade05.svg \
+	qgn_graf_ve_trans_crossfade06.svg \
+	qgn_graf_ve_trans_crossfade07.svg \
+	qgn_graf_ve_trans_crossfade08.svg \
+	qgn_graf_ve_trans_fadetoblack1.svg \
+	qgn_graf_ve_trans_fadetoblack2.svg \
+	qgn_graf_ve_trans_fadetoblack3.svg \
+	qgn_graf_ve_trans_fadetoblack4.svg \
+	qgn_graf_ve_trans_fadetoblack5.svg \
+	qgn_graf_ve_trans_fadetoblack6.svg \
+	qgn_graf_ve_trans_fadetoblack7.svg \
+	qgn_graf_ve_trans_fadetoblack8.svg \
+	qgn_graf_ve_trans_fadetowhite1.svg \
+	qgn_graf_ve_trans_fadetowhite2.svg \
+	qgn_graf_ve_trans_fadetowhite3.svg \
+	qgn_graf_ve_trans_fadetowhite4.svg \
+	qgn_graf_ve_trans_fadetowhite5.svg \
+	qgn_graf_ve_trans_fadetowhite6.svg \
+	qgn_graf_ve_trans_fadetowhite7.svg \
+	qgn_graf_ve_trans_fadetowhite8.svg \
+	qgn_graf_ve_trans_fadefromblack1.svg \
+	qgn_graf_ve_trans_fadefromblack2.svg \
+	qgn_graf_ve_trans_fadefromblack3.svg \
+	qgn_graf_ve_trans_fadefromblack4.svg \
+	qgn_graf_ve_trans_fadefromblack5.svg \
+	qgn_graf_ve_trans_fadefromblack6.svg \
+	qgn_graf_ve_trans_fadefromblack7.svg \
+	qgn_graf_ve_trans_fadefromblack8.svg \
+	qgn_graf_ve_trans_fadefromwhite1.svg \
+	qgn_graf_ve_trans_fadefromwhite2.svg \
+	qgn_graf_ve_trans_fadefromwhite3.svg \
+	qgn_graf_ve_trans_fadefromwhite4.svg \
+	qgn_graf_ve_trans_fadefromwhite5.svg \
+	qgn_graf_ve_trans_fadefromwhite6.svg \
+	qgn_graf_ve_trans_fadefromwhite7.svg \
+	qgn_graf_ve_trans_fadefromwhite8.svg \
+	qgn_graf_ve_trans_wipeleft1.svg \
+	qgn_graf_ve_trans_wipeleft2.svg \
+	qgn_graf_ve_trans_wipeleft3.svg \
+	qgn_graf_ve_trans_wipeleft4.svg \
+	qgn_graf_ve_trans_wipeleft5.svg \
+	qgn_graf_ve_trans_wipeleft6.svg \
+	qgn_graf_ve_trans_wipeleft7.svg \
+	qgn_graf_ve_trans_wiperight1.svg \
+	qgn_graf_ve_trans_wiperight2.svg \
+	qgn_graf_ve_trans_wiperight3.svg \
+	qgn_graf_ve_trans_wiperight4.svg \
+	qgn_graf_ve_trans_wiperight5.svg \
+	qgn_graf_ve_trans_wiperight6.svg \
+	qgn_graf_ve_trans_wiperight7.svg \
+	qgn_graf_ve_trans_wipebototop1.svg \
+	qgn_graf_ve_trans_wipebototop2.svg \
+	qgn_graf_ve_trans_wipebototop3.svg \
+	qgn_graf_ve_trans_wipebototop4.svg \
+	qgn_graf_ve_trans_wipebototop5.svg \
+	qgn_graf_ve_trans_wipebototop6.svg \
+	qgn_graf_ve_trans_wipebototop7.svg \
+	qgn_graf_ve_trans_wipebototop8.svg \
+	qgn_graf_ve_trans_wipebototop9.svg \
+	qgn_graf_ve_trans_wipetoptobo1.svg \
+	qgn_graf_ve_trans_wipetoptobo2.svg \
+	qgn_graf_ve_trans_wipetoptobo3.svg \
+	qgn_graf_ve_trans_wipetoptobo4.svg \
+	qgn_graf_ve_trans_wipetoptobo5.svg \
+	qgn_graf_ve_trans_wipetoptobo6.svg \
+	qgn_graf_ve_trans_wipetoptobo7.svg \
+	qgn_graf_ve_trans_wipetoptobo8.svg \
+	qgn_graf_ve_trans_wipetoptobo9.svg
+
+FREEZE  : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/icons_aif_scalable.mk	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,56 @@
+#
+# Copyright (c) 2010 Ixonos Plc.
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - Initial contribution
+#
+# Contributors:
+# Ixonos Plc
+#
+# Description:
+#
+
+ifeq (WINSCW,$(findstring WINSCW, $(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=$(EPOCROOT)epoc32\data\Z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+HEADERDIR=$(EPOCROOT)epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\ManualVideoEditor_aif.MIF
+HEADERFILENAME=$(HEADERDIR)\ManualVideoEditor_aif.MBG
+
+do_nothing:
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+ 
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+	/c8,8 qgn_menu_ve_cxt.svg
+
+FREEZE  : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_symbol_audio.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="189" height="155" viewBox="0 0 189 155">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="189" height="155"/>
+<g>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M129.94,122.946c-1.182,0.508-3.667,1.622-4.375,1.944        c-1.157,0.533-1.128,1.672,0.764,2.252c0.714,0.219,33.477,9.563,35.126,10.053c1.649,0.488,3.242,0.122,3.963-0.487        c0.729-0.607,2.615-1.99,3.576-2.965c0.883-0.899-0.239-1.886-1.445-2.213c-1.208-0.329-32.775-8.372-34.15-8.756        C132.026,122.395,131.121,122.443,129.94,122.946z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.056,123.3c-0.985,0.419-3.063,1.354-3.756,1.669        c-1.093,0.494-0.962,1.48,0.673,1.98c2.076,0.632,32.963,9.405,34.564,9.88c1.567,0.467,3.054,0.107,3.686-0.425        c0.686-0.573,2.339-1.714,3.076-2.551c0.883-0.74-0.138-1.771-1.335-2.097c-2.461-0.677-32.449-8.288-33.642-8.617        C131.994,122.772,131.162,122.829,130.056,123.3z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.168,123.652c-0.785,0.339-2.456,1.09-3.131,1.396        c-1.031,0.456-0.8,1.286,0.576,1.705c3.442,1.05,32.453,9.252,34.004,9.713c1.491,0.441,2.866,0.09,3.413-0.366        c0.483-0.403,1.927-1.383,2.573-2.134c0.808-0.684-0.042-1.66-1.222-1.98c-3.712-1.024-32.128-8.201-33.134-8.48        C131.967,123.151,131.205,123.212,130.168,123.652z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.285,124.003c-0.592,0.253-1.848,0.824-2.511,1.122        c-0.969,0.419-0.637,1.092,0.479,1.435c4.808,1.462,31.945,9.094,33.448,9.543c1.411,0.419,2.68,0.074,3.141-0.305        c0.357-0.305,1.494-1.238,2.071-1.724c0.73-0.62,0.058-1.546-1.113-1.863c-4.964-1.376-31.806-8.11-32.632-8.339        C131.933,123.533,131.241,123.593,130.285,124.003z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.4,124.358c-0.394,0.167-1.244,0.553-1.891,0.849        c-0.912,0.381-0.473,0.896,0.383,1.159c6.174,1.877,31.436,8.938,32.89,9.371c1.331,0.396,2.491,0.057,2.861-0.243        c0.242-0.201,1.126-0.93,1.576-1.307c0.654-0.565,0.156-1.43-1.001-1.75c-6.218-1.724-31.489-8.022-32.126-8.198        C131.904,123.909,131.283,123.979,130.4,124.358z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.514,124.71c-0.194,0.085-0.636,0.288-1.27,0.57        c-0.847,0.348-0.311,0.708,0.288,0.891c7.54,2.29,30.927,8.787,32.334,9.203c1.249,0.369,2.302,0.042,2.586-0.186        c0.118-0.1,0.751-0.618,1.072-0.894c0.579-0.503,0.256-1.315-0.891-1.631c-7.469-2.073-31.165-7.935-31.619-8.063        C131.875,124.289,131.322,124.365,130.514,124.71z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.63,125.062c0,0-0.032,0.022-0.65,0.296c-0.785,0.313-0.144,0.517,0.195,0.618        c8.907,2.707,30.414,8.631,31.773,9.032c1.169,0.348,2.114,0.027,2.312-0.124c-0.004,0.003,0.374-0.307,0.573-0.476        c0.5-0.449,0.355-1.205-0.78-1.519c-8.724-2.418-30.845-7.847-31.116-7.921C131.844,124.667,131.363,124.746,130.63,125.062z"/>
+</g>
+<g>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M93.688,83.333c-0.915,0.354-2.837,1.131-3.384,1.355        c-0.895,0.371-0.873,1.165,0.591,1.569c0.552,0.153,25.896,6.667,27.171,7.008c1.275,0.341,2.508,0.085,3.067-0.34        c0.562-0.423,2.021-1.387,2.766-2.066c0.682-0.627-0.186-1.314-1.118-1.542c-0.935-0.23-25.353-5.837-26.417-6.104        C95.302,82.949,94.602,82.982,93.688,83.333z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M93.778,83.58c-0.762,0.292-2.37,0.943-2.905,1.163        c-0.845,0.345-0.745,1.032,0.521,1.381c1.606,0.44,25.499,6.557,26.737,6.887c1.212,0.326,2.362,0.076,2.853-0.295        c0.529-0.4,1.808-1.195,2.378-1.779c0.683-0.516-0.107-1.234-1.033-1.461c-1.903-0.472-25.101-5.777-26.023-6.008        C95.277,83.211,94.634,83.25,93.778,83.58z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M93.865,83.825c-0.607,0.236-1.899,0.76-2.422,0.974        c-0.797,0.317-0.619,0.896,0.445,1.188c2.662,0.731,25.104,6.449,26.304,6.771c1.154,0.309,2.217,0.063,2.641-0.255        c0.374-0.281,1.49-0.964,1.99-1.487c0.624-0.477-0.033-1.158-0.945-1.381c-2.871-0.714-24.853-5.717-25.63-5.912        C95.256,83.476,94.667,83.518,93.865,83.825z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M93.955,84.07c-0.458,0.177-1.43,0.574-1.942,0.782c-0.75,0.292-0.492,0.761,0.371,1        c3.719,1.019,24.71,6.339,25.874,6.652c1.091,0.292,2.072,0.052,2.43-0.213c0.277-0.212,1.155-0.863,1.602-1.201        c0.564-0.433,0.044-1.077-0.862-1.299c-3.84-0.959-24.603-5.654-25.242-5.813C95.23,83.742,94.695,83.784,93.955,84.07z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M94.044,84.317c-0.304,0.116-0.962,0.386-1.462,0.592        c-0.705,0.266-0.366,0.624,0.296,0.808c4.776,1.309,24.317,6.231,25.442,6.533c1.029,0.275,1.927,0.039,2.213-0.17        c0.188-0.14,0.871-0.648,1.219-0.91c0.506-0.396,0.121-0.997-0.773-1.221c-4.811-1.201-24.359-5.593-24.852-5.715        C95.208,84.004,94.727,84.053,94.044,84.317z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M94.133,84.562c-0.15,0.06-0.492,0.201-0.982,0.398        c-0.655,0.242-0.24,0.493,0.223,0.621c5.832,1.596,23.924,6.125,25.012,6.415c0.966,0.258,1.78,0.029,2-0.129        c0.091-0.069,0.581-0.432,0.83-0.623c0.448-0.351,0.198-0.917-0.689-1.137c-5.777-1.445-24.107-5.531-24.459-5.621        C95.186,84.268,94.758,84.322,94.133,84.562z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M94.222,84.808c0,0-0.024,0.016-0.502,0.205c-0.607,0.219-0.111,0.36,0.151,0.432        c6.89,1.887,23.527,6.017,24.578,6.297c0.904,0.242,1.635,0.019,1.788-0.087c-0.003,0.002,0.29-0.214,0.444-0.332        c0.387-0.313,0.275-0.84-0.604-1.058c-6.748-1.687-23.86-5.47-24.069-5.522C95.161,84.533,94.789,84.587,94.222,84.808z"/>
+</g>
+<g>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.418,61.469c-0.604,0.22-1.874,0.703-2.235,0.842        c-0.591,0.231-0.577,0.724,0.391,0.975c0.364,0.095,17.103,4.142,17.945,4.354c0.842,0.211,1.657,0.053,2.025-0.211        c0.371-0.263,1.335-0.861,1.827-1.284c0.45-0.39-0.123-0.816-0.739-0.958c-0.617-0.143-16.744-3.626-17.447-3.792        C131.483,61.23,131.021,61.251,130.418,61.469z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.477,61.623c-0.503,0.182-1.565,0.586-1.918,0.723        c-0.558,0.214-0.492,0.641,0.344,0.858c1.061,0.273,16.841,4.073,17.658,4.278c0.801,0.203,1.561,0.048,1.884-0.183        c0.349-0.249,1.194-0.743,1.571-1.105c0.451-0.32-0.071-0.767-0.683-0.908c-1.256-0.293-16.577-3.589-17.187-3.732        C131.467,61.394,131.042,61.418,130.477,61.623z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.535,61.775c-0.401,0.147-1.254,0.472-1.6,0.604        c-0.527,0.198-0.409,0.557,0.294,0.739c1.758,0.455,16.58,4.006,17.373,4.206c0.762,0.191,1.464,0.039,1.744-0.159        c0.248-0.174,0.984-0.599,1.315-0.924c0.412-0.296-0.022-0.719-0.625-0.858c-1.896-0.443-16.414-3.551-16.928-3.672        C131.454,61.558,131.063,61.584,130.535,61.775z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.594,61.927c-0.302,0.11-0.944,0.356-1.283,0.486        c-0.495,0.181-0.325,0.472,0.245,0.621c2.457,0.632,16.32,3.938,17.088,4.132c0.721,0.181,1.369,0.032,1.605-0.132        c0.183-0.132,0.763-0.536,1.058-0.746c0.373-0.269,0.029-0.669-0.569-0.807c-2.536-0.596-16.249-3.513-16.671-3.611        C131.436,61.724,131.083,61.75,130.594,61.927z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.653,62.081c-0.201,0.072-0.636,0.24-0.966,0.368        c-0.466,0.165-0.241,0.388,0.196,0.502c3.154,0.813,16.06,3.871,16.803,4.059c0.68,0.171,1.272,0.024,1.462-0.106        c0.124-0.086,0.575-0.403,0.805-0.565c0.334-0.246,0.08-0.62-0.51-0.759c-3.178-0.746-16.088-3.474-16.414-3.55        C131.421,61.887,131.104,61.917,130.653,62.081z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.711,62.233c-0.099,0.037-0.325,0.125-0.648,0.248        c-0.433,0.15-0.159,0.307,0.147,0.386c3.852,0.991,15.8,3.805,16.52,3.985c0.638,0.16,1.175,0.018,1.321-0.08        c0.06-0.043,0.384-0.269,0.548-0.387c0.296-0.218,0.13-0.57-0.456-0.706c-3.815-0.898-15.921-3.436-16.153-3.492        C131.406,62.05,131.124,62.083,130.711,62.233z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.77,62.386c0,0-0.016,0.01-0.332,0.127c-0.401,0.136-0.073,0.224,0.1,0.268        c4.551,1.172,15.538,3.738,16.232,3.912c0.597,0.15,1.08,0.011,1.181-0.054c-0.002,0.001,0.191-0.133,0.293-0.207        c0.256-0.194,0.182-0.521-0.399-0.657c-4.457-1.047-15.758-3.398-15.896-3.431C131.39,62.215,131.145,62.249,130.77,62.386z"/>
+</g>
+<g>
+<g>
+<radialGradient id="XMLID_7_" cx="140.8096" cy="119.4595" r="17.2607" fx="140.8096" fy="119.4595" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1234" style="stop-color:#EB1C16"/>
+<stop offset="0.3262" style="stop-color:#CF1A12"/>
+<stop offset="0.5876" style="stop-color:#A2160A"/>
+<stop offset="0.8427" style="stop-color:#701102"/>
+<stop offset="1" style="stop-color:#701102"/>
+</radialGradient>
+<path fill="url(#XMLID_7_)" d="M159.947,123.411c-1.944,5.667-10.056,8.015-18.127,5.242         c-8.071-2.768-13.034-9.608-11.086-15.271c1.943-5.666,10.061-8.01,18.127-5.241         C156.927,110.908,161.887,117.75,159.947,123.411z"/>
+</g>
+<g>
+<linearGradient id="XMLID_8_" gradientUnits="userSpaceOnUse" x1="159.0508" y1="53.0015" x2="159.0508" y2="116.4981">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1665" style="stop-color:#F11D17"/>
+<stop offset="0.3414" style="stop-color:#E41B15"/>
+<stop offset="0.5229" style="stop-color:#CE1912"/>
+<stop offset="0.709" style="stop-color:#AF170C"/>
+<stop offset="0.8966" style="stop-color:#891306"/>
+<stop offset="1" style="stop-color:#701102"/>
+</linearGradient>
+<path fill="url(#XMLID_8_)" d="M166.603,87.757l-8.464-10.47l0.447,45.117c0,0-1.445-2.67-2.894-4.565         c-1.449-1.897-4.236-3.785-4.236-3.785l0.112-59.27c0,0,0-1.782,0.89-1.782c1.496,0,6.683,9.58,8.688,13.369         c2.004,3.786,4.68,8.246,5.238,10.917C166.79,79.253,166.603,87.757,166.603,87.757z"/>
+</g>
+<path fill="#741103" d="M159.914,79.482l-1.775-2.195l0.415,41.715l1.706,1.175c0,0-0.332-12.256-0.332-20.494        C159.927,91.579,159.914,79.873,159.914,79.482z M167.945,76.261c-0.326-1.638-4.459-9.56-6.574-13.346        c-2.118-3.786-5.343-10.137-6.126-10.137c-0.676,0-2.297,0.194-2.721,0.24c1.561,0.229,6.645,9.609,8.623,13.353        c2.004,3.786,4.68,8.246,5.238,10.917c0.377,1.813,0.246,9.162,0.223,10.308l1.516-0.233        C168.123,87.362,168.238,77.744,167.945,76.261z"/>
+</g>
+<g>
+<g>
+<radialGradient id="XMLID_9_" cx="101.7148" cy="80.0161" r="12.5844" fx="101.7148" fy="80.0161" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1234" style="stop-color:#EB1C16"/>
+<stop offset="0.3262" style="stop-color:#CF1A12"/>
+<stop offset="0.5876" style="stop-color:#A2160A"/>
+<stop offset="0.8427" style="stop-color:#701102"/>
+<stop offset="1" style="stop-color:#701102"/>
+</radialGradient>
+<path fill="url(#XMLID_9_)" d="M115.667,82.896c-1.417,4.132-7.332,5.844-13.216,3.822         c-5.885-2.018-9.502-7.005-8.083-11.134c1.417-4.131,7.335-5.839,13.216-3.821C113.466,73.781,117.083,78.769,115.667,82.896         z"/>
+</g>
+<g>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="115.0146" y1="31.5625" x2="115.0146" y2="77.857">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1665" style="stop-color:#F11D17"/>
+<stop offset="0.3414" style="stop-color:#E41B15"/>
+<stop offset="0.5229" style="stop-color:#CE1912"/>
+<stop offset="0.709" style="stop-color:#AF170C"/>
+<stop offset="0.8966" style="stop-color:#891306"/>
+<stop offset="1" style="stop-color:#701102"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M120.521,56.902l-6.171-7.633l0.326,32.894c0,0-1.053-1.947-2.11-3.329         c-1.056-1.383-3.088-2.76-3.088-2.76l0.082-43.212c0,0,0-1.299,0.648-1.299c1.091,0,4.873,6.985,6.334,9.747         c1.461,2.76,3.412,6.011,3.819,7.959C120.657,50.702,120.521,56.902,120.521,56.902z"/>
+</g>
+<path fill="#741103" d="M115.644,50.869l-1.294-1.6l0.303,30.414l1.244,0.856c0,0-0.242-8.936-0.242-14.941        C115.653,59.688,115.644,51.154,115.644,50.869z M121.499,48.521c-0.238-1.194-3.251-6.97-4.793-9.73        c-1.544-2.76-3.895-7.391-4.466-7.391c-0.493,0-1.675,0.141-1.984,0.175c1.138,0.167,4.845,7.005,6.287,9.735        c1.461,2.76,3.412,6.011,3.819,7.959c0.275,1.322,0.18,6.68,0.163,7.515l1.105-0.17        C121.628,56.614,121.712,49.602,121.499,48.521z"/>
+</g>
+<g>
+<g>
+<radialGradient id="XMLID_11_" cx="135.9526" cy="59.2505" r="9.277" fx="135.9526" fy="59.2505" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1234" style="stop-color:#EB1C16"/>
+<stop offset="0.3262" style="stop-color:#CF1A12"/>
+<stop offset="0.5876" style="stop-color:#A2160A"/>
+<stop offset="0.8427" style="stop-color:#701102"/>
+<stop offset="1" style="stop-color:#701102"/>
+</radialGradient>
+<path fill="url(#XMLID_11_)" d="M146.238,61.374c-1.044,3.046-5.404,4.308-9.742,2.817c-4.338-1.487-7.005-5.164-5.958-8.207         c1.045-3.045,5.407-4.305,9.743-2.816C144.616,54.654,147.281,58.332,146.238,61.374z"/>
+</g>
+<g>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="145.7568" y1="23.5327" x2="145.7568" y2="57.6583">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1665" style="stop-color:#F11D17"/>
+<stop offset="0.3414" style="stop-color:#E41B15"/>
+<stop offset="0.5229" style="stop-color:#CE1912"/>
+<stop offset="0.709" style="stop-color:#AF170C"/>
+<stop offset="0.8966" style="stop-color:#891306"/>
+<stop offset="1" style="stop-color:#701102"/>
+</linearGradient>
+<path fill="url(#XMLID_12_)" d="M149.816,42.212l-4.549-5.627l0.241,24.248c0,0-0.777-1.435-1.556-2.453         c-0.779-1.021-2.276-2.034-2.276-2.034l0.06-31.854c0,0,0-0.958,0.478-0.958c0.804,0,3.592,5.149,4.669,7.185         c1.077,2.035,2.515,4.432,2.815,5.867C149.916,37.642,149.816,42.212,149.816,42.212z"/>
+</g>
+<path fill="#741103" d="M146.221,37.765l-0.954-1.18l0.223,22.419l0.917,0.632c0,0-0.178-6.587-0.178-11.015        C146.228,44.266,146.221,37.975,146.221,37.765z M150.537,36.033c-0.175-0.88-2.397-5.138-3.534-7.173        c-1.138-2.035-2.871-5.448-3.292-5.448c-0.363,0-1.235,0.104-1.462,0.129c0.838,0.123,3.571,5.165,4.634,7.177        c1.077,2.035,2.515,4.432,2.815,5.867c0.203,0.974,0.132,4.923,0.12,5.54L150.632,42        C150.632,42,150.694,36.831,150.537,36.033z"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_symbol_cut_audio.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="189" height="155" viewBox="0 0 189 155">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="189" height="155"/>
+<g>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M129.94,122.946c-1.183,0.508-3.667,1.622-4.375,1.944        c-1.157,0.533-1.128,1.672,0.765,2.252c0.713,0.219,33.477,9.563,35.125,10.053c1.649,0.488,3.242,0.122,3.964-0.487        c0.729-0.607,2.615-1.99,3.576-2.965c0.883-0.899-0.239-1.886-1.445-2.213c-1.208-0.329-32.774-8.372-34.15-8.756        C132.026,122.395,131.121,122.443,129.94,122.946z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.056,123.3c-0.985,0.419-3.064,1.354-3.756,1.669        c-1.094,0.494-0.963,1.48,0.672,1.98c2.076,0.632,32.964,9.405,34.564,9.88c1.567,0.467,3.055,0.107,3.687-0.425        c0.686-0.573,2.339-1.714,3.076-2.551c0.883-0.74-0.138-1.771-1.335-2.097c-2.461-0.677-32.449-8.288-33.642-8.617        C131.994,122.772,131.162,122.829,130.056,123.3z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.168,123.652c-0.784,0.339-2.456,1.09-3.131,1.396        c-1.03,0.456-0.8,1.286,0.575,1.705c3.442,1.05,32.453,9.252,34.005,9.713c1.491,0.441,2.866,0.09,3.413-0.366        c0.483-0.403,1.927-1.383,2.573-2.134c0.808-0.684-0.042-1.66-1.222-1.98c-3.712-1.024-32.129-8.201-33.134-8.48        C131.966,123.151,131.205,123.212,130.168,123.652z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.285,124.003c-0.592,0.253-1.848,0.824-2.511,1.122        c-0.969,0.419-0.637,1.092,0.479,1.435c4.808,1.462,31.944,9.094,33.448,9.543c1.411,0.419,2.68,0.074,3.141-0.305        c0.357-0.305,1.494-1.238,2.071-1.724c0.73-0.62,0.058-1.546-1.113-1.863c-4.964-1.376-31.806-8.11-32.632-8.339        C131.933,123.533,131.242,123.593,130.285,124.003z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.4,124.358c-0.393,0.167-1.244,0.553-1.891,0.849        c-0.911,0.381-0.473,0.896,0.384,1.159c6.175,1.877,31.436,8.938,32.89,9.371c1.331,0.396,2.491,0.057,2.861-0.243        c0.242-0.201,1.126-0.93,1.576-1.307c0.654-0.565,0.156-1.43-1.001-1.75c-6.218-1.724-31.489-8.022-32.126-8.198        C131.904,123.909,131.283,123.979,130.4,124.358z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.514,124.71c-0.194,0.085-0.636,0.288-1.27,0.57        c-0.847,0.348-0.312,0.708,0.288,0.891c7.539,2.29,30.927,8.787,32.334,9.203c1.249,0.369,2.302,0.042,2.586-0.186        c0.118-0.1,0.751-0.618,1.072-0.894c0.579-0.503,0.256-1.315-0.891-1.631c-7.469-2.073-31.165-7.935-31.619-8.063        C131.875,124.289,131.322,124.365,130.514,124.71z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.63,125.062c0,0-0.031,0.022-0.65,0.296c-0.784,0.313-0.144,0.517,0.195,0.618        c8.907,2.707,30.414,8.631,31.773,9.032c1.169,0.348,2.114,0.027,2.312-0.124c-0.004,0.003,0.374-0.307,0.573-0.476        c0.5-0.449,0.355-1.205-0.78-1.519c-8.724-2.418-30.845-7.847-31.116-7.921C131.843,124.667,131.363,124.746,130.63,125.062z"/>
+</g>
+<g>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M93.688,83.333c-0.915,0.354-2.837,1.131-3.384,1.355        c-0.895,0.371-0.873,1.165,0.591,1.569c0.552,0.153,25.895,6.667,27.171,7.008c1.275,0.341,2.509,0.085,3.067-0.34        c0.562-0.423,2.021-1.387,2.766-2.066c0.682-0.627-0.186-1.314-1.119-1.542c-0.934-0.23-25.353-5.837-26.416-6.104        C95.302,82.949,94.602,82.982,93.688,83.333z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M93.778,83.58c-0.762,0.292-2.37,0.943-2.905,1.163        c-0.845,0.345-0.745,1.032,0.521,1.381c1.606,0.44,25.499,6.557,26.737,6.887c1.212,0.326,2.362,0.076,2.853-0.295        c0.528-0.4,1.808-1.195,2.378-1.779c0.684-0.516-0.106-1.234-1.033-1.461c-1.902-0.472-25.1-5.777-26.022-6.008        C95.277,83.211,94.634,83.25,93.778,83.58z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M93.865,83.825c-0.607,0.236-1.899,0.76-2.422,0.974        c-0.797,0.317-0.619,0.896,0.445,1.188c2.662,0.731,25.104,6.449,26.304,6.771c1.153,0.309,2.217,0.063,2.641-0.255        c0.374-0.281,1.49-0.964,1.99-1.487c0.624-0.477-0.033-1.158-0.945-1.381c-2.871-0.714-24.854-5.717-25.631-5.912        C95.256,83.476,94.667,83.518,93.865,83.825z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M93.955,84.07c-0.458,0.177-1.43,0.574-1.942,0.782c-0.75,0.292-0.492,0.761,0.371,1        c3.72,1.019,24.71,6.339,25.874,6.652c1.091,0.292,2.072,0.052,2.43-0.213c0.277-0.212,1.155-0.863,1.602-1.201        c0.564-0.433,0.045-1.077-0.861-1.299c-3.84-0.959-24.604-5.654-25.242-5.813C95.23,83.742,94.695,83.784,93.955,84.07z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M94.044,84.317c-0.304,0.116-0.962,0.386-1.462,0.592        c-0.705,0.266-0.366,0.624,0.296,0.808c4.776,1.309,24.316,6.231,25.442,6.533c1.029,0.275,1.927,0.039,2.213-0.17        c0.188-0.14,0.871-0.648,1.219-0.91c0.507-0.396,0.121-0.997-0.772-1.221c-4.812-1.201-24.359-5.593-24.853-5.715        C95.208,84.004,94.727,84.053,94.044,84.317z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M94.133,84.562c-0.15,0.06-0.492,0.201-0.982,0.398        c-0.655,0.242-0.24,0.493,0.223,0.621c5.832,1.596,23.923,6.125,25.012,6.415c0.966,0.258,1.78,0.029,2.001-0.129        c0.091-0.069,0.58-0.432,0.829-0.623c0.448-0.351,0.198-0.917-0.689-1.137c-5.777-1.445-24.107-5.531-24.459-5.621        C95.185,84.268,94.757,84.322,94.133,84.562z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M94.222,84.808c0,0-0.024,0.016-0.502,0.205c-0.607,0.219-0.111,0.36,0.151,0.432        c6.891,1.887,23.527,6.017,24.578,6.297c0.904,0.242,1.635,0.019,1.787-0.087c-0.002,0.002,0.29-0.214,0.445-0.332        c0.387-0.313,0.275-0.84-0.605-1.058c-6.748-1.687-23.859-5.47-24.068-5.522C95.162,84.533,94.789,84.587,94.222,84.808z"/>
+</g>
+<g>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.417,61.469c-0.604,0.22-1.873,0.703-2.234,0.842        c-0.592,0.231-0.577,0.724,0.391,0.975c0.363,0.095,17.102,4.142,17.945,4.354c0.842,0.211,1.656,0.053,2.025-0.211        c0.371-0.263,1.334-0.861,1.826-1.284c0.45-0.39-0.123-0.816-0.738-0.958c-0.617-0.143-16.744-3.626-17.447-3.792        C131.483,61.23,131.021,61.251,130.417,61.469z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.476,61.623c-0.502,0.182-1.564,0.586-1.918,0.723        c-0.559,0.214-0.492,0.641,0.344,0.858c1.061,0.273,16.841,4.073,17.658,4.278c0.801,0.203,1.561,0.048,1.885-0.183        c0.349-0.249,1.193-0.743,1.57-1.105c0.451-0.32-0.07-0.767-0.683-0.908c-1.257-0.293-16.577-3.589-17.187-3.732        C131.466,61.394,131.042,61.418,130.476,61.623z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.535,61.775c-0.4,0.147-1.254,0.472-1.6,0.604        c-0.527,0.198-0.408,0.557,0.294,0.739c1.759,0.455,16.58,4.006,17.372,4.206c0.762,0.191,1.465,0.039,1.744-0.159        c0.248-0.174,0.984-0.599,1.314-0.924c0.412-0.296-0.021-0.719-0.624-0.858c-1.896-0.443-16.414-3.551-16.928-3.672        C131.454,61.558,131.064,61.584,130.535,61.775z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.593,61.927c-0.302,0.11-0.943,0.356-1.282,0.486        c-0.495,0.181-0.325,0.472,0.245,0.621c2.456,0.632,16.319,3.938,17.088,4.132c0.721,0.181,1.368,0.032,1.605-0.132        c0.183-0.132,0.763-0.536,1.058-0.746c0.372-0.269,0.028-0.669-0.569-0.807c-2.536-0.596-16.249-3.513-16.671-3.611        C131.436,61.724,131.083,61.75,130.593,61.927z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.653,62.081c-0.2,0.072-0.636,0.24-0.966,0.368        c-0.466,0.165-0.241,0.388,0.195,0.502c3.154,0.813,16.061,3.871,16.804,4.059c0.68,0.171,1.272,0.024,1.462-0.106        c0.124-0.086,0.574-0.403,0.805-0.565c0.334-0.246,0.08-0.62-0.51-0.759c-3.178-0.746-16.089-3.474-16.414-3.55        C131.421,61.887,131.104,61.917,130.653,62.081z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.71,62.233c-0.099,0.037-0.324,0.125-0.648,0.248        c-0.432,0.15-0.158,0.307,0.147,0.386c3.852,0.991,15.8,3.805,16.52,3.985c0.638,0.16,1.175,0.018,1.321-0.08        c0.06-0.043,0.383-0.269,0.547-0.387c0.297-0.218,0.131-0.57-0.455-0.706c-3.815-0.898-15.921-3.436-16.153-3.492        C131.406,62.05,131.125,62.083,130.71,62.233z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M130.77,62.386c0,0-0.016,0.01-0.331,0.127c-0.401,0.136-0.074,0.224,0.1,0.268        c4.551,1.172,15.537,3.738,16.232,3.912c0.597,0.15,1.08,0.011,1.18-0.054c-0.002,0.001,0.191-0.133,0.294-0.207        c0.256-0.194,0.183-0.521-0.399-0.657c-4.457-1.047-15.758-3.398-15.896-3.431C131.39,62.215,131.144,62.249,130.77,62.386z"/>
+</g>
+<g>
+<g>
+<radialGradient id="XMLID_10_" cx="140.8101" cy="119.4595" r="17.2607" fx="140.8101" fy="119.4595" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1234" style="stop-color:#EB1C16"/>
+<stop offset="0.3262" style="stop-color:#CF1A12"/>
+<stop offset="0.5876" style="stop-color:#A2160A"/>
+<stop offset="0.8427" style="stop-color:#701102"/>
+<stop offset="1" style="stop-color:#701102"/>
+</radialGradient>
+<path fill="url(#XMLID_10_)" d="M159.947,123.411c-1.943,5.667-10.057,8.015-18.127,5.242         c-8.071-2.768-13.033-9.608-11.086-15.271c1.943-5.666,10.061-8.01,18.127-5.241         C156.927,110.908,161.887,117.75,159.947,123.411z"/>
+</g>
+<g>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="159.0513" y1="53.0015" x2="159.0513" y2="116.4981">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1665" style="stop-color:#F11D17"/>
+<stop offset="0.3414" style="stop-color:#E41B15"/>
+<stop offset="0.5229" style="stop-color:#CE1912"/>
+<stop offset="0.709" style="stop-color:#AF170C"/>
+<stop offset="0.8966" style="stop-color:#891306"/>
+<stop offset="1" style="stop-color:#701102"/>
+</linearGradient>
+<path fill="url(#XMLID_11_)" d="M166.603,87.757l-8.465-10.47l0.447,45.117c0,0-1.444-2.67-2.894-4.565         c-1.448-1.897-4.235-3.785-4.235-3.785l0.111-59.27c0,0,0-1.782,0.891-1.782c1.495,0,6.682,9.58,8.688,13.369         c2.004,3.786,4.68,8.246,5.238,10.917C166.79,79.253,166.603,87.757,166.603,87.757z"/>
+</g>
+<path fill="#741103" d="M159.914,79.482l-1.775-2.195l0.415,41.715l1.706,1.175c0,0-0.332-12.256-0.332-20.494        C159.927,91.579,159.914,79.873,159.914,79.482z M167.945,76.261c-0.326-1.638-4.459-9.56-6.574-13.346        c-2.118-3.786-5.343-10.137-6.126-10.137c-0.676,0-2.298,0.194-2.722,0.24c1.561,0.229,6.646,9.609,8.623,13.353        c2.004,3.786,4.68,8.246,5.238,10.917c0.377,1.812,0.246,9.162,0.223,10.308l1.516-0.233        C168.123,87.362,168.238,77.744,167.945,76.261z"/>
+</g>
+<g>
+<g>
+<radialGradient id="XMLID_12_" cx="101.7144" cy="80.0161" r="12.5847" fx="101.7144" fy="80.0161" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1234" style="stop-color:#EB1C16"/>
+<stop offset="0.3262" style="stop-color:#CF1A12"/>
+<stop offset="0.5876" style="stop-color:#A2160A"/>
+<stop offset="0.8427" style="stop-color:#701102"/>
+<stop offset="1" style="stop-color:#701102"/>
+</radialGradient>
+<path fill="url(#XMLID_12_)" d="M115.667,82.896c-1.417,4.132-7.332,5.844-13.216,3.822         c-5.885-2.018-9.502-7.005-8.083-11.134c1.417-4.131,7.336-5.839,13.217-3.821S117.083,78.769,115.667,82.896z"/>
+</g>
+<g>
+<linearGradient id="XMLID_13_" gradientUnits="userSpaceOnUse" x1="115.0151" y1="31.5625" x2="115.0151" y2="77.857">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1665" style="stop-color:#F11D17"/>
+<stop offset="0.3414" style="stop-color:#E41B15"/>
+<stop offset="0.5229" style="stop-color:#CE1912"/>
+<stop offset="0.709" style="stop-color:#AF170C"/>
+<stop offset="0.8966" style="stop-color:#891306"/>
+<stop offset="1" style="stop-color:#701102"/>
+</linearGradient>
+<path fill="url(#XMLID_13_)" d="M120.521,56.902l-6.172-7.633l0.326,32.894c0,0-1.053-1.947-2.109-3.329         c-1.057-1.383-3.089-2.76-3.089-2.76l0.082-43.212c0,0,0-1.299,0.648-1.299c1.091,0,4.872,6.985,6.335,9.747         c1.461,2.76,3.411,6.011,3.818,7.959C120.657,50.702,120.521,56.902,120.521,56.902z"/>
+</g>
+<path fill="#741103" d="M115.644,50.869l-1.295-1.6l0.303,30.414l1.244,0.856c0,0-0.242-8.936-0.242-14.941        C115.654,59.688,115.644,51.154,115.644,50.869z M121.5,48.521c-0.238-1.194-3.252-6.97-4.794-9.73        c-1.544-2.76-3.896-7.391-4.466-7.391c-0.493,0-1.676,0.141-1.984,0.175c1.138,0.167,4.845,7.005,6.287,9.735        c1.461,2.76,3.411,6.011,3.818,7.959c0.275,1.322,0.18,6.68,0.162,7.515l1.105-0.17        C121.628,56.614,121.712,49.602,121.5,48.521z"/>
+</g>
+<g>
+<g>
+<radialGradient id="XMLID_14_" cx="135.9517" cy="59.2505" r="9.277" fx="135.9517" fy="59.2505" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1234" style="stop-color:#EB1C16"/>
+<stop offset="0.3262" style="stop-color:#CF1A12"/>
+<stop offset="0.5876" style="stop-color:#A2160A"/>
+<stop offset="0.8427" style="stop-color:#701102"/>
+<stop offset="1" style="stop-color:#701102"/>
+</radialGradient>
+<path fill="url(#XMLID_14_)" d="M146.238,61.374c-1.044,3.046-5.404,4.308-9.742,2.817c-4.338-1.487-7.004-5.164-5.958-8.207         c1.045-3.045,5.407-4.305,9.743-2.816C144.616,54.654,147.281,58.332,146.238,61.374z"/>
+</g>
+<g>
+<linearGradient id="XMLID_15_" gradientUnits="userSpaceOnUse" x1="145.7573" y1="23.5327" x2="145.7573" y2="57.6583">
+<stop offset="0" style="stop-color:#F51D18"/>
+<stop offset="0.0056" style="stop-color:#F51D18"/>
+<stop offset="0.1665" style="stop-color:#F11D17"/>
+<stop offset="0.3414" style="stop-color:#E41B15"/>
+<stop offset="0.5229" style="stop-color:#CE1912"/>
+<stop offset="0.709" style="stop-color:#AF170C"/>
+<stop offset="0.8966" style="stop-color:#891306"/>
+<stop offset="1" style="stop-color:#701102"/>
+</linearGradient>
+<path fill="url(#XMLID_15_)" d="M149.816,42.212l-4.549-5.627l0.24,24.248c0,0-0.777-1.435-1.556-2.453         c-0.778-1.021-2.276-2.034-2.276-2.034l0.061-31.854c0,0,0-0.958,0.478-0.958c0.804,0,3.592,5.149,4.669,7.185         c1.078,2.035,2.516,4.432,2.816,5.867C149.916,37.642,149.816,42.212,149.816,42.212z"/>
+</g>
+<path fill="#741103" d="M146.22,37.765l-0.953-1.18l0.223,22.419l0.916,0.632c0,0-0.178-6.587-0.178-11.015        C146.228,44.266,146.22,37.975,146.22,37.765z M150.537,36.033c-0.175-0.88-2.396-5.138-3.533-7.173        c-1.139-2.035-2.871-5.448-3.292-5.448c-0.363,0-1.235,0.104-1.462,0.129c0.838,0.123,3.57,5.165,4.633,7.177        c1.078,2.035,2.516,4.432,2.816,5.867c0.202,0.974,0.132,4.923,0.119,5.54L150.632,42        C150.632,42,150.695,36.831,150.537,36.033z"/>
+</g>
+<g>
+<polygon fill="#443C27" points="45.957,117.133 52.822,112.556 56.411,116.458 50.169,120.826 "/>
+<path fill="#2D1F11" d="M67.749,111.777c-0.588,3.17-2.496,4.784-3.849,5.408        c-1.764,0.814-5.113,1.024-7.593-1.456c-2.263-2.262-2.393-4.889-2.393-4.889s-0.006-7.611,6.657-7.49        C66.292,103.455,68.269,108.967,67.749,111.777"/>
+<path fill="#211E18" d="M66.396,131.748c0.234,2.261,0.103,5.306-3.017,7.281        c-1.912,1.211-4.562,0.796-6.136-0.936c-3.121-3.433-1.873-8.114-1.873-8.114s-14.354-12.274-21.011-15.187        c-5.391-2.357-19.14-9.258-19.14-9.258s2.601-3.433,8.634-1.455c6.033,1.976,20.179,9.569,24.132,13.521        c4.006,4.007,5.983,5.277,8.217,7.697c1.248,1.353-0.104-0.624,4.681,0.208C63.224,125.914,66.084,128.731,66.396,131.748"/>
+<path fill="#443C27" d="M44.449,117.601c-0.728,0.208-27.876,5.409-28.708,5.513        c-1.263,0.158,1.873,2.913,5.825,3.225c5.736,0.453,11.763-0.537,19.867-2.704C50.378,121.242,44.449,117.601,44.449,117.601z        "/>
+<linearGradient id="XMLID_16_" gradientUnits="userSpaceOnUse" x1="15.8726" y1="122.439" x2="46.791" y2="122.439">
+<stop offset="0" style="stop-color:#E3B83A"/>
+<stop offset="0.1974" style="stop-color:#DEA826"/>
+<stop offset="0.4652" style="stop-color:#D89812"/>
+<stop offset="0.7333" style="stop-color:#D58E06"/>
+<stop offset="1" style="stop-color:#D48B02"/>
+</linearGradient>
+<path fill="url(#XMLID_16_)" d="M44.865,118.017c-0.728,0.208-27.876,5.408-28.708,5.513        c-1.264,0.158,1.872,2.913,5.825,3.225c5.736,0.453,11.763-0.537,19.867-2.704C50.793,121.659,44.865,118.017,44.865,118.017z        "/>
+<linearGradient id="XMLID_17_" gradientUnits="userSpaceOnUse" x1="52.4092" y1="108.146" x2="62.8141" y2="118.551">
+<stop offset="0" style="stop-color:#C6833A"/>
+<stop offset="1" style="stop-color:#D48B02"/>
+</linearGradient>
+<path fill="url(#XMLID_17_)" d="M66.917,112.088c-0.104,3.433-2.081,4.369-3.329,5.201        c-0.712,0.475-4.681,1.976-7.905-1.248l0.312,0.416l-5.617,3.849l-3.849-3.744l6.865-4.577l-0.104-0.833        c0,0-0.526-7.401,6.137-7.28C65.148,103.976,67.001,109.282,66.917,112.088"/>
+<path fill="#FFFFFF" d="M64.523,111.048c0,2.585-2.345,5.131-4.784,4.368        c-1.665-0.52-4.057-2.095-4.057-4.68s1.917-4.681,4.473-4.681C62.712,106.056,64.523,108.463,64.523,111.048z"/>
+<path fill="#443C27" d="M64.523,110.679c-1.144,6.818-6.761,5.778-8.529,2.554        c-2.313-4.218,1.183-7.281,3.797-7.281S64.956,108.104,64.523,110.679z"/>
+<linearGradient id="XMLID_18_" gradientUnits="userSpaceOnUse" x1="20.8228" y1="99.0298" x2="62.0994" y2="140.3065">
+<stop offset="0" style="stop-color:#E3B83A"/>
+<stop offset="1" style="stop-color:#D45B02"/>
+</linearGradient>
+<path fill="url(#XMLID_18_)" d="M65.148,131.748c0.625,2.185,0.806,5.602-2.185,7.49        c-1.976,1.248-6.157,1.475-8.633-1.248c-3.12-3.434-1.873-8.114-1.873-8.114s-13.834-12.586-20.491-15.499        c-5.391-2.357-17.579-8.842-17.579-8.842s1.664-2.911,7.697-0.936c6.033,1.977,20.491,9.674,24.444,13.627        c3.953,3.952,7.021,6.188,8.01,7.176c0.473,0.473,0.96,1.283,1.768,1.041c1.04-0.312,2.08-0.521,3.849,0        C61.86,126.945,64.374,129.038,65.148,131.748"/>
+<path fill="#FFFFFF" d="M64.731,110.112c0.573,2.521-1.599,5.649-4.264,5.098        c-3.017-0.625-3.849-3.121-4.057-4.058c-0.47-2.115,0.273-4.717,2.704-5.096C62.443,105.535,64.212,107.824,64.731,110.112z"/>
+<path fill="#443C27" d="M63.016,133.893c0,2.703-1.339,4.408-3.901,4.408c-2.562,0-4.837-2.557-4.837-5.26        c0-2.704,1.214-4.362,3.775-4.362C60.615,128.679,63.016,131.19,63.016,133.893z"/>
+<path fill="#FFFFFF" d="M63.068,133.314c0.208,3.01-1.457,4.051-3.745,3.739        c-2.35-0.321-3.9-2.511-3.9-4.941c0-2.43,0.838-3.485,3.156-3.485C60.896,128.626,62.9,130.889,63.068,133.314z"/>
+<circle fill="#443C27" cx="44.552" cy="120.202" r="1.56"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade01.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110" height="91" viewBox="0 0 110 91">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect x="1" y="1" fill="#FFFFFF" width="108" height="89"/>
+<path d="M109,0H0v91h110V0H109z M108,2c0,1.933,0,85.067,0,87c-1.944,0-104.056,0-106,0        C2,87.067,2,3.933,2,2C3.945,2,106.056,2,108,2z"/>
+</g>
+<path fill="url(#XMLID_2_)" d="M58.554,68.762v-2.664l5.318-1.334l-2.506-9.104H46.583l-2.564,9.104       l5.43,1.334v2.664H35.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H58.554z M60.219,51.662       l-6.162-22.116l-6.271,22.116H60.219z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="37.873" y1="36.5396" x2="72.4854" y2="71.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade02.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110" height="91" viewBox="0 0 110 91">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect x="1" y="1" fill="#FFFFFF" width="108" height="89"/>
+<path d="M109,0H0v91h110V0H109z M108,2c0,1.933,0,85.067,0,87c-1.944,0-104.056,0-106,0        C2,87.067,2,3.933,2,2C3.945,2,106.056,2,108,2z"/>
+</g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="37.873" y1="36.5396" x2="72.4854" y2="71.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.9" stroke-opacity="0.9" fill="url(#XMLID_3_)" d="M58.554,68.762v-2.664l5.318-1.334l-2.506-9.104H46.583       l-2.564,9.104l5.43,1.334v2.664H35.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H58.554z        M60.219,51.662l-6.162-22.116l-6.271,22.116H60.219z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="33.4365" y1="27.6641" x2="69.3222" y2="63.5497">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.15" stroke-opacity="0.15" fill="url(#XMLID_4_)" d="M55.949,68.72h-17.13v-2.659l4.987-1.332V26.271l-4.987-1.331       v-2.66h18.069c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C64.835,67.632,61.027,68.72,55.949,68.72z        M50.345,42.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V42.674z M50.345,64.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V64.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade03.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110.001" height="91" viewBox="0 0 110.001 91">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect x="1" y="1" fill="#FFFFFF" width="108.001" height="89"/>
+<path d="M109.001,0H0v91h110.001V0H109.001z M108.001,2c0,1.933,0,85.067,0,87C106.057,89,3.945,89,2,89        C2,87.067,2,3.933,2,2C3.945,2,106.057,2,108.001,2z"/>
+</g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="37.873" y1="36.5396" x2="72.4854" y2="71.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.75" stroke-opacity="0.75" fill="url(#XMLID_3_)" d="M58.554,68.762v-2.664l5.318-1.334l-2.506-9.104H46.583       l-2.564,9.104l5.43,1.334v2.664H35.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.426,42.524l3.906,1.334v2.664H58.554z        M60.22,51.662l-6.163-22.116l-6.271,22.116H60.22z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="33.436" y1="27.6641" x2="69.3217" y2="63.5497">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.3" stroke-opacity="0.3" fill="url(#XMLID_4_)" d="M55.948,68.72H38.819v-2.659l4.987-1.332V26.271l-4.987-1.331       v-2.66h18.069c4.285,0,7.498,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.377,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C64.835,67.632,61.026,68.72,55.948,68.72z        M50.345,42.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.502-1.942h-5.519V42.674z M50.345,64.729h5.466c3.059,0,5.295-0.717,6.709-2.157       c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.343V64.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade04.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110" height="91" viewBox="0 0 110 91">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect x="1" y="1" fill="#FFFFFF" width="108" height="89"/>
+<path d="M109,0H0v91h110V0H109z M108,2c0,1.933,0,85.067,0,87c-1.944,0-104.056,0-106,0        C2,87.067,2,3.933,2,2C3.945,2,106.056,2,108,2z"/>
+</g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="37.873" y1="36.5396" x2="72.4854" y2="71.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.6" stroke-opacity="0.6" fill="url(#XMLID_3_)" d="M58.554,68.762v-2.664l5.318-1.334l-2.506-9.104H46.583       l-2.564,9.104l5.43,1.334v2.664H35.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H58.554z        M60.219,51.662l-6.162-22.116l-6.271,22.116H60.219z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="33.4365" y1="27.6641" x2="69.3222" y2="63.5497">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_4_)" d="M55.949,68.72h-17.13v-2.659l4.987-1.332V26.271l-4.987-1.331       v-2.66h18.069c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C64.835,67.632,61.027,68.72,55.949,68.72z        M50.345,42.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V42.674z M50.345,64.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V64.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade05.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110" height="91" viewBox="0 0 110 91">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect x="1" y="1" fill="#FFFFFF" width="108" height="89"/>
+<path d="M109,0H0v91h110V0H109z M108,2c0,1.933,0,85.067,0,87c-1.944,0-104.055,0-106,0        C2,87.067,2,3.933,2,2C3.945,2,106.056,2,108,2z"/>
+</g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="37.8721" y1="36.5391" x2="72.4844" y2="71.1514">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_3_)" d="M58.554,68.762v-2.664l5.318-1.334l-2.506-9.104H46.583       l-2.564,9.104l5.43,1.334v2.664H35.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H58.554z        M60.219,51.662l-6.162-22.116l-6.271,22.116H60.219z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="33.4355" y1="27.6636" x2="69.3219" y2="63.5499">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.6" stroke-opacity="0.6" fill="url(#XMLID_4_)" d="M55.948,68.72h-17.13v-2.659l4.987-1.332V26.271l-4.987-1.331       v-2.66h18.069c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C64.835,67.632,61.026,68.72,55.948,68.72z        M50.345,42.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V42.674z M50.345,64.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V64.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade06.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110" height="91" viewBox="0 0 110 91">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect x="1" y="1" fill="#FFFFFF" width="108" height="89"/>
+<path d="M109,0H0v91h110V0H109z M108,2c0,1.933,0,85.067,0,87c-1.944,0-104.055,0-106,0        C2,87.067,2,3.933,2,2C3.945,2,106.056,2,108,2z"/>
+</g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="37.8726" y1="36.5396" x2="72.4849" y2="71.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.3" stroke-opacity="0.3" fill="url(#XMLID_3_)" d="M58.554,68.762v-2.664l5.318-1.334l-2.506-9.104H46.583       l-2.564,9.104l5.43,1.334v2.664H35.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H58.554z        M60.219,51.662l-6.162-22.116l-6.271,22.116H60.219z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="33.4355" y1="27.6636" x2="69.3219" y2="63.5499">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.75" stroke-opacity="0.75" fill="url(#XMLID_4_)" d="M55.948,68.72h-17.13v-2.659l4.987-1.332V26.271l-4.987-1.331       v-2.66h18.069c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C64.835,67.632,61.026,68.72,55.948,68.72z        M50.345,42.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V42.674z M50.345,64.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V64.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade07.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110" height="91" viewBox="0 0 110 91">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect x="1" y="1" fill="#FFFFFF" width="108" height="89"/>
+<path d="M109,0H0v91h110V0H109z M108,2c0,1.933,0,85.067,0,87c-1.944,0-104.055,0-106,0        C2,87.067,2,3.933,2,2C3.945,2,106.056,2,108,2z"/>
+</g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="37.8721" y1="36.5391" x2="72.4844" y2="71.1514">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.15" stroke-opacity="0.15" fill="url(#XMLID_3_)" d="M58.554,68.762v-2.664l5.318-1.334l-2.506-9.104H46.583       l-2.564,9.104l5.43,1.334v2.664H35.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H58.554z        M60.219,51.662l-6.162-22.116l-6.271,22.116H60.219z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="33.4355" y1="27.6636" x2="69.3219" y2="63.5499">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.9" stroke-opacity="0.9" fill="url(#XMLID_4_)" d="M55.948,68.72h-17.13v-2.659l4.987-1.332V26.271l-4.987-1.331       v-2.66h18.069c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C64.835,67.632,61.026,68.72,55.948,68.72z        M50.345,42.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V42.674z M50.345,64.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V64.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade08.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110.001" height="91" viewBox="0 0 110.001 91">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect x="1" y="1" fill="#FFFFFF" width="108.001" height="89"/>
+<path d="M109.001,0H0v91h110.001V0H109.001z M108.001,2c0,1.933,0,85.067,0,87C106.057,89,3.945,89,2,89        C2,87.067,2,3.933,2,2C3.945,2,106.057,2,108.001,2z"/>
+</g>
+<path fill="url(#XMLID_2_)" d="M55.949,68.72h-17.13v-2.659l4.987-1.332V26.271l-4.987-1.331v-2.66h18.069       c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C64.836,67.632,61.027,68.72,55.949,68.72z        M50.346,42.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V42.674z M50.346,64.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V64.729z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="33.4365" y1="27.6636" x2="69.3229" y2="63.5499">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583l-2.564,9.104       l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H57.554z M59.219,50.662       l-6.162-22.116l-6.271,22.116H59.219z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5396" x2="71.4854" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5396" x2="71.4854" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.9" stroke-opacity="0.9" fill="url(#XMLID_3_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H57.554z        M59.219,50.662l-6.162-22.116l-6.271,22.116H59.219z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="32.4365" y1="26.6641" x2="68.3222" y2="62.5497">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.15" stroke-opacity="0.15" fill="url(#XMLID_4_)" d="M54.949,67.72h-17.13v-2.659l4.987-1.332V25.271l-4.987-1.331       v-2.66h18.069c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C63.835,66.632,60.027,67.72,54.949,67.72z        M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V63.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5396" x2="71.4854" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.75" stroke-opacity="0.75" fill="url(#XMLID_3_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.426,42.524l3.906,1.334v2.664H57.554z        M59.22,50.662l-6.163-22.116l-6.271,22.116H59.22z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="32.436" y1="26.6641" x2="68.3217" y2="62.5497">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.3" stroke-opacity="0.3" fill="url(#XMLID_4_)" d="M54.948,67.72H37.819v-2.659l4.987-1.332V25.271l-4.987-1.331       v-2.66h18.069c4.285,0,7.498,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.377,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C63.835,66.632,60.026,67.72,54.948,67.72z        M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.502-1.942h-5.519V41.674z M49.345,63.729h5.466c3.059,0,5.295-0.717,6.709-2.157       c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.343V63.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5396" x2="71.4854" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.6" stroke-opacity="0.6" fill="url(#XMLID_3_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H57.554z        M59.219,50.662l-6.162-22.116l-6.271,22.116H59.219z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="32.4365" y1="26.6641" x2="68.3222" y2="62.5497">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_4_)" d="M54.949,67.72h-17.13v-2.659l4.987-1.332V25.271l-4.987-1.331       v-2.66h18.069c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C63.835,66.632,60.027,67.72,54.949,67.72z        M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V63.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade5.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="36.8721" y1="35.5391" x2="71.4844" y2="70.1514">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_3_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H57.554z        M59.219,50.662l-6.162-22.116l-6.271,22.116H59.219z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="32.4355" y1="26.6636" x2="68.3219" y2="62.5499">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.6" stroke-opacity="0.6" fill="url(#XMLID_4_)" d="M54.948,67.72h-17.13v-2.659l4.987-1.332V25.271l-4.987-1.331       v-2.66h18.069c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C63.835,66.632,60.026,67.72,54.948,67.72z        M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V63.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade6.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5396" x2="71.4849" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.3" stroke-opacity="0.3" fill="url(#XMLID_3_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H57.554z        M59.219,50.662l-6.162-22.116l-6.271,22.116H59.219z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="32.4355" y1="26.6636" x2="68.3219" y2="62.5499">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.75" stroke-opacity="0.75" fill="url(#XMLID_4_)" d="M54.948,67.72h-17.13v-2.659l4.987-1.332V25.271l-4.987-1.331       v-2.66h18.069c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C63.835,66.632,60.026,67.72,54.948,67.72z        M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V63.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade7.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="36.8721" y1="35.5391" x2="71.4844" y2="70.1514">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.15" stroke-opacity="0.15" fill="url(#XMLID_3_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.425,42.524l3.907,1.334v2.664H57.554z        M59.219,50.662l-6.162-22.116l-6.271,22.116H59.219z"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="32.4355" y1="26.6636" x2="68.3219" y2="62.5499">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill-opacity="0.9" stroke-opacity="0.9" fill="url(#XMLID_4_)" d="M54.948,67.72h-17.13v-2.659l4.987-1.332V25.271l-4.987-1.331       v-2.66h18.069c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C63.835,66.632,60.026,67.72,54.948,67.72z        M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V63.729z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_crossfade8.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill="url(#XMLID_2_)" d="M54.949,67.72h-17.13v-2.659l4.987-1.332V25.271l-4.987-1.331v-2.66h18.069       c4.284,0,7.497,0.942,9.639,2.826c2.143,1.885,3.215,4.701,3.215,8.448c0,5.33-2.378,8.909-7.133,10.741       c5.717,1.307,8.572,5.098,8.572,11.373c0,4.351-1.27,7.613-3.809,9.787C63.836,66.632,60.027,67.72,54.949,67.72z        M49.346,41.674h4.703c2.717,0,4.756-0.719,6.115-2.157c1.357-1.439,2.039-3.597,2.039-6.476c0-2.591-0.613-4.532-1.836-5.827       s-3.057-1.942-5.503-1.942h-5.519V41.674z M49.346,63.729h5.467c3.059,0,5.295-0.717,6.709-2.157       c1.413-1.438,2.122-3.75,2.122-6.936c0-2.979-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.251-6.705-2.251h-5.344V63.729z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.4365" y1="26.6636" x2="68.3229" y2="62.5499">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack01.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105        l5.43,1.334v2.664H34.125v-2.664l3.889-1.334l13.157-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662        l-6.163-22.117l-6.27,22.117H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8721" y1="35.5386" x2="71.4851" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack02.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<path fill-opacity="0.9" stroke-opacity="0.9" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583       l-2.564,9.105l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.526h6.37l12.425,42.526l3.907,1.334v2.664H57.554z        M59.219,50.663l-6.162-22.117l-6.27,22.117H59.219z"/>
+<rect fill-opacity="0.15" stroke-opacity="0.15" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5391" x2="71.4856" y2="70.1521">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack03.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill-opacity="0.75" stroke-opacity="0.75" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583       l-2.564,9.105l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.526h6.37l12.426,42.526l3.906,1.334v2.664H57.554z        M59.22,50.663l-6.163-22.117l-6.27,22.117H59.22z"/>
+<rect fill-opacity="0.3" stroke-opacity="0.3" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5391" x2="71.4856" y2="70.1521">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack04.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill-opacity="0.6" stroke-opacity="0.6" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.105H45.584        l-2.564,9.105l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.526h6.37l12.425,42.526l3.907,1.334v2.664H57.555z         M59.22,50.663l-6.162-22.117l-6.271,22.117H59.22z"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5391" x2="71.4861" y2="70.1521">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack05.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.105H45.584        l-2.564,9.105l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.526h6.37l12.425,42.526l3.907,1.334v2.664H57.555z         M59.22,50.663l-6.162-22.117l-6.271,22.117H59.22z"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5391" x2="71.4865" y2="70.1521">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack06.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill-opacity="0.3" stroke-opacity="0.3" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.105H45.584        l-2.564,9.105l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.526h6.37l12.425,42.526l3.907,1.334v2.664H57.555z         M59.22,50.663l-6.162-22.117l-6.271,22.117H59.22z"/>
+<rect fill-opacity="0.75" stroke-opacity="0.75" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5391" x2="71.4861" y2="70.1521">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack07.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect width="108" height="89"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack08.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.002" height="89" viewBox="0 0 108.002 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.002" height="89"/>
+<g fill-opacity="0.3" stroke-opacity="0.3">
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="31.7598" y1="26.5991" x2="67.6454" y2="62.4848">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M54.271,67.655H37.143v-2.66l4.986-1.332V25.206l-4.986-1.331v-2.659h18.068        c4.285,0,7.498,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.377,8.91-7.133,10.742        c5.717,1.305,8.572,5.097,8.572,11.373c0,4.35-1.27,7.613-3.809,9.787C63.158,66.567,59.35,67.655,54.271,67.655z         M48.668,41.608h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.438,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.608z M48.668,63.663h5.467c3.059,0,5.295-0.717,6.709-2.156        c1.414-1.438,2.123-3.75,2.123-6.936c0-2.98-0.75-5.221-2.25-6.721c-1.498-1.5-3.732-2.252-6.705-2.252h-5.344V63.663z"/>
+</g>
+<g fill-opacity="0.75" stroke-opacity="0.75">
+<rect width="108.002" height="89"/>
+<g display="none">
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5396" x2="71.4861" y2="70.1526">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path display="inline" fill="url(#XMLID_4_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.105H45.584         l-2.564,9.105l5.43,1.334v2.664H34.125v-2.664l3.891-1.334l13.156-42.525h6.371l12.426,42.525l3.906,1.334v2.664H57.555z          M59.221,50.663l-6.164-22.117l-6.27,22.117H59.221z"/>
+</g>
+<rect fill="none" width="108.002" height="89"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack09.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<path fill="url(#XMLID_2_)" d="M54.272,67.654H37.141v-2.66l4.988-1.332V25.206l-4.988-1.331v-2.659h18.07       c4.283,0,7.496,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.379,8.91-7.133,10.742       c5.717,1.305,8.572,5.097,8.572,11.373c0,4.35-1.27,7.613-3.809,9.787C63.159,66.566,59.35,67.654,54.272,67.654z        M48.668,41.608h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.438,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.504-1.941h-5.518V41.608z M48.668,63.662h5.467c3.059,0,5.295-0.717,6.709-2.156       c1.412-1.438,2.121-3.75,2.121-6.936c0-2.98-0.748-5.221-2.248-6.721c-1.498-1.5-3.732-2.252-6.705-2.252h-5.344V63.662z"/>
+<g fill-opacity="0.45" stroke-opacity="0.45">
+<rect x="0.001" fill-opacity="0.75" stroke-opacity="0.75" width="107.999" height="89"/>
+<path display="none" fill-opacity="0.75" stroke-opacity="0.75" d="M57.553,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105        l5.432,1.334v2.664H34.125v-2.664l3.891-1.334l13.156-42.526h6.369l12.426,42.526l3.906,1.334v2.664H57.553z M59.219,50.662        l-6.162-22.117l-6.27,22.117H59.219z"/>
+<rect x="0.001" fill-opacity="0.3" stroke-opacity="0.3" width="107.999" height="89"/>
+</g>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.7593" y1="26.5986" x2="67.6456" y2="62.485">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack10.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<g fill-opacity="0.3" stroke-opacity="0.3">
+<path fill="url(#XMLID_2_)" d="M54.271,67.655h-17.13v-2.66l4.987-1.332V25.206l-4.987-1.331v-2.659h18.07        c4.283,0,7.496,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.379,8.91-7.133,10.742        c5.717,1.305,8.572,5.097,8.572,11.373c0,4.35-1.27,7.613-3.809,9.787C63.159,66.567,59.35,67.655,54.271,67.655z         M48.668,41.608h4.703c2.717,0,4.756-0.719,6.116-2.158c1.357-1.438,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.503-1.941h-5.519V41.608z M48.668,63.663h5.467c3.059,0,5.295-0.717,6.709-2.156        c1.412-1.438,2.121-3.75,2.121-6.936c0-2.98-0.748-5.221-2.248-6.721c-1.498-1.5-3.732-2.252-6.706-2.252h-5.344V63.663z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.7598" y1="26.5991" x2="67.6454" y2="62.4848">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+<rect fill-opacity="0.6" stroke-opacity="0.6" width="108" height="89"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack11.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<g>
+<g>
+<rect y="0" fill="#FFFFFF" width="108" height="89"/>
+</g>
+<g fill-opacity="0.75" stroke-opacity="0.75">
+<path fill="url(#XMLID_2_)" d="M54.27,67.655H37.141v-2.66l4.986-1.332V25.206l-4.986-1.331v-2.659h18.068          c4.285,0,7.498,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.377,8.91-7.133,10.742          c5.717,1.305,8.572,5.098,8.572,11.373c0,4.35-1.27,7.613-3.809,9.787C63.157,66.567,59.348,67.655,54.27,67.655z           M48.667,41.608h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.438,2.039-3.596,2.039-6.475          c0-2.59-0.613-4.531-1.836-5.828c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.608z M48.667,63.663h5.467          c3.059,0,5.295-0.717,6.709-2.156c1.414-1.438,2.123-3.75,2.123-6.936c0-2.98-0.75-5.221-2.25-6.721          c-1.498-1.5-3.732-2.252-6.705-2.252h-5.344V63.663z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.7588" y1="26.5996" x2="67.6438" y2="62.4846">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+<rect fill-opacity="0.3" stroke-opacity="0.3" width="108" height="89"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack12.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<g fill-opacity="0.9" stroke-opacity="0.9">
+<path fill="url(#XMLID_2_)" d="M54.271,67.654H37.141v-2.658l4.988-1.332V25.207l-4.988-1.331v-2.659h18.07        c4.283,0,7.496,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.379,8.911-7.133,10.743        c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.158,66.566,59.35,67.654,54.271,67.654z         M48.668,41.609h4.703c2.717,0,4.756-0.719,6.115-2.159c1.357-1.438,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.504-1.941h-5.518V41.609z M48.668,63.664h5.467c3.059,0,5.295-0.717,6.709-2.158        c1.412-1.438,2.121-3.75,2.121-6.936c0-2.979-0.748-5.221-2.248-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.664z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.7583" y1="26.5991" x2="67.6447" y2="62.4855">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+<rect fill-opacity="0.15" stroke-opacity="0.15" width="108" height="89"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptoblack13.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M54.271,67.654h-17.13v-2.66l4.987-1.332V25.206l-4.987-1.331v-2.659H55.21        c4.284,0,7.497,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.378,8.91-7.133,10.742        c5.717,1.305,8.572,5.097,8.572,11.373c0,4.35-1.27,7.613-3.809,9.787C63.158,66.566,59.349,67.654,54.271,67.654z         M48.667,41.608h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.438,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.503-1.941h-5.519V41.608z M48.667,63.662h5.467c3.059,0,5.295-0.717,6.709-2.156        c1.413-1.438,2.122-3.75,2.122-6.936c0-2.98-0.749-5.221-2.249-6.721c-1.498-1.5-3.732-2.252-6.705-2.252h-5.344V63.662z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.7588" y1="26.5986" x2="67.6451" y2="62.485">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite01.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect width="108.001" height="89"/>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105       l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.663       l-6.163-22.117l-6.27,22.117H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5396" x2="71.4854" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite02.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<rect fill-opacity="0.9" stroke-opacity="0.9" width="108" height="89"/>
+<path fill-opacity="0.9" stroke-opacity="0.9" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583       l-2.564,9.105l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.371l12.424,42.525l3.908,1.334v2.664H57.555z        M59.219,50.663l-6.162-22.117l-6.27,22.117H59.219z"/>
+<rect fill-opacity="0.15" stroke-opacity="0.15" fill="#FFFFFF" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5391" x2="71.4856" y2="70.1521">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite03.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<rect fill-opacity="0.75" stroke-opacity="0.75" width="108" height="89"/>
+<path fill-opacity="0.75" stroke-opacity="0.75" fill="url(#XMLID_2_)" d="M57.553,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583       l-2.564,9.105l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.369l12.426,42.525l3.906,1.334v2.664H57.553z        M59.219,50.663l-6.162-22.117l-6.27,22.117H59.219z"/>
+<rect fill-opacity="0.3" stroke-opacity="0.3" fill="#FFFFFF" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5396" x2="71.4849" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite04.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" width="108.001" height="89"/>
+<path fill-opacity="0.6" stroke-opacity="0.6" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583       l-2.564,9.105l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z        M59.22,50.663l-6.163-22.117l-6.27,22.117H59.22z"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" fill="#FFFFFF" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5396" x2="71.4849" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite05.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" width="108.001" height="89"/>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.584       l-2.564,9.105l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z        M59.22,50.663l-6.163-22.117l-6.271,22.117H59.22z"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" fill="#FFFFFF" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5396" x2="71.4859" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite06.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" width="108.001" height="89"/>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.584       l-2.564,9.105l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z        M59.22,50.663l-6.163-22.117l-6.271,22.117H59.22z"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" fill="#FFFFFF" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5396" x2="71.4859" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite07.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite08.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.002" height="89" viewBox="0 0 108.002 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.002" height="89"/>
+<rect fill-opacity="0.3" stroke-opacity="0.3" width="108.002" height="89"/>
+<path fill-opacity="0.3" stroke-opacity="0.3" fill="url(#XMLID_2_)" d="M54.271,67.655H37.143v-2.66l4.986-1.332V25.206l-4.986-1.331       v-2.659h18.068c4.285,0,7.498,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.377,8.91-7.133,10.742       c5.717,1.305,8.572,5.097,8.572,11.373c0,4.35-1.27,7.613-3.809,9.787C63.158,66.567,59.35,67.655,54.271,67.655z        M48.668,41.608h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.438,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.608z M48.668,63.663h5.467c3.059,0,5.295-0.717,6.709-2.156       c1.414-1.438,2.123-3.75,2.123-6.936c0-2.98-0.75-5.221-2.25-6.721c-1.498-1.5-3.732-2.252-6.705-2.252h-5.344V63.663z"/>
+<rect fill-opacity="0.75" stroke-opacity="0.75" fill="#FFFFFF" width="108.002" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.7598" y1="26.5991" x2="67.6454" y2="62.4848">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite09.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" width="108" height="89"/>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_2_)" d="M54.271,67.655H37.141v-2.66l4.988-1.332V25.206l-4.988-1.331       v-2.659h18.07c4.283,0,7.496,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.379,8.91-7.133,10.742       c5.717,1.305,8.572,5.097,8.572,11.373c0,4.35-1.27,7.613-3.809,9.787C63.158,66.567,59.35,67.655,54.271,67.655z        M48.668,41.608h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.438,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.504-1.941h-5.518V41.608z M48.668,63.663h5.467c3.059,0,5.295-0.717,6.709-2.156       c1.412-1.438,2.121-3.75,2.121-6.936c0-2.98-0.748-5.221-2.248-6.721c-1.498-1.5-3.732-2.252-6.705-2.252h-5.344V63.663z"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" fill="#FFFFFF" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.7588" y1="26.5991" x2="67.6451" y2="62.4855">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite10.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" width="108" height="89"/>
+<path fill-opacity="0.6" stroke-opacity="0.6" fill="url(#XMLID_2_)" d="M54.271,67.655H37.141v-2.66l4.988-1.332V25.206l-4.988-1.331       v-2.659h18.07c4.283,0,7.496,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.379,8.91-7.133,10.742       c5.717,1.305,8.572,5.097,8.572,11.373c0,4.35-1.27,7.613-3.809,9.787C63.158,66.567,59.35,67.655,54.271,67.655z        M48.668,41.608h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.438,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.504-1.941h-5.518V41.608z M48.668,63.663h5.467c3.059,0,5.295-0.717,6.709-2.156       c1.412-1.438,2.121-3.75,2.121-6.936c0-2.98-0.748-5.221-2.248-6.721c-1.498-1.5-3.732-2.252-6.705-2.252h-5.344V63.663z"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" fill="#FFFFFF" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.7583" y1="26.5986" x2="67.6447" y2="62.485">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite11.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<rect fill-opacity="0.75" stroke-opacity="0.75" width="108" height="89"/>
+<path fill-opacity="0.75" stroke-opacity="0.75" fill="url(#XMLID_2_)" d="M54.27,67.655H37.141v-2.66l4.986-1.332V25.207l-4.986-1.331       v-2.659h18.068c4.285,0,7.498,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.377,8.91-7.133,10.742       c5.717,1.305,8.572,5.098,8.572,11.373c0,4.35-1.27,7.613-3.809,9.787C63.156,66.567,59.348,67.655,54.27,67.655z        M48.666,41.609h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.438,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.609z M48.666,63.663h5.467c3.059,0,5.295-0.717,6.709-2.156       c1.414-1.438,2.123-3.75,2.123-6.936c0-2.98-0.75-5.221-2.25-6.721c-1.498-1.5-3.732-2.252-6.705-2.252h-5.344V63.663z"/>
+<rect fill-opacity="0.3" stroke-opacity="0.3" fill="#FFFFFF" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.7578" y1="26.5996" x2="67.6435" y2="62.4853">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite12.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.002" height="89" viewBox="0 0 108.002 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.002" height="89"/>
+<rect fill-opacity="0.9" stroke-opacity="0.9" width="108.002" height="89"/>
+<path fill-opacity="0.9" stroke-opacity="0.9" fill="url(#XMLID_2_)" d="M54.271,67.655H37.143v-2.658l4.988-1.332V25.207l-4.988-1.331       v-2.659h18.068c4.283,0,7.496,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.379,8.911-7.133,10.743       c5.717,1.305,8.572,5.096,8.572,11.372c0,4.352-1.27,7.613-3.809,9.787C63.158,66.567,59.35,67.655,54.271,67.655z        M48.668,41.609h4.703c2.717,0,4.756-0.719,6.115-2.159c1.357-1.438,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.504-1.941h-5.518V41.609z M48.668,63.665h5.467c3.059,0,5.295-0.717,6.709-2.158       c1.412-1.438,2.121-3.75,2.121-6.936c0-2.979-0.748-5.221-2.248-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.665z"/>
+<rect fill-opacity="0.15" stroke-opacity="0.15" fill="#FFFFFF" width="108.002" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.7603" y1="26.6001" x2="67.6452" y2="62.4851">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_diptowhite13.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.002" height="89" viewBox="0 0 108.002 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect width="108.002" height="89"/>
+<path fill="url(#XMLID_2_)" d="M54.271,67.655H37.143v-2.66l4.986-1.332V25.206l-4.986-1.331v-2.659h18.068       c4.285,0,7.498,0.941,9.639,2.825c2.143,1.886,3.215,4.7,3.215,8.448c0,5.33-2.377,8.91-7.133,10.742       c5.717,1.305,8.572,5.097,8.572,11.373c0,4.35-1.27,7.613-3.809,9.787C63.158,66.567,59.35,67.655,54.271,67.655z        M48.668,41.608h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.438,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.608z M48.668,63.663h5.467c3.059,0,5.295-0.717,6.709-2.156       c1.414-1.438,2.123-3.75,2.123-6.936c0-2.98-0.75-5.221-2.25-6.721c-1.498-1.5-3.732-2.252-6.705-2.252h-5.344V63.663z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="31.7598" y1="26.5991" x2="67.6454" y2="62.4848">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect width="108" height="89"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.9" stroke-opacity="0.9" width="108.001" height="89"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill-opacity="0.3" stroke-opacity="0.3" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.104H45.584        l-2.564,9.104l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.555z         M59.22,50.662l-6.162-22.116l-6.271,22.116H59.22z"/>
+<rect fill-opacity="0.75" stroke-opacity="0.75" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5386" x2="71.4861" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.104H45.584        l-2.564,9.104l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.555z         M59.22,50.662l-6.162-22.116l-6.271,22.116H59.22z"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5391" x2="71.4859" y2="70.1514">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack5.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<path fill-opacity="0.6" stroke-opacity="0.6" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583        l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.554z         M59.219,50.662l-6.162-22.116l-6.27,22.116H59.219z"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4856" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack6.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill-opacity="0.75" stroke-opacity="0.75" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583        l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z         M59.22,50.662l-6.163-22.116l-6.27,22.116H59.22z"/>
+<rect fill-opacity="0.3" stroke-opacity="0.3" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack7.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<path fill-opacity="0.9" stroke-opacity="0.9" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583        l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.554z         M59.219,50.662l-6.162-22.116l-6.27,22.116H59.219z"/>
+<rect fill-opacity="0.15" stroke-opacity="0.15" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4856" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromblack8.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583l-2.564,9.104        l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.426,42.524l3.906,1.334v2.664H57.554z M59.22,50.662        l-6.163-22.116l-6.27,22.116H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5396" x2="71.4849" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<rect fill="#FFFFFF" width="108" height="89"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.15" stroke-opacity="0.15" width="108.001" height="89"/>
+<path fill-opacity="0.15" stroke-opacity="0.15" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.105H45.584       l-2.564,9.105l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.555z        M59.22,50.662l-6.162-22.117l-6.271,22.117H59.22z"/>
+<rect fill-opacity="0.9" stroke-opacity="0.9" fill="#FFFFFF" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5391" x2="71.4859" y2="70.1514">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.3" stroke-opacity="0.3" width="108.001" height="89"/>
+<path fill-opacity="0.3" stroke-opacity="0.3" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.104H45.584       l-2.564,9.104l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.555z        M59.22,50.662l-6.162-22.116l-6.271,22.116H59.22z"/>
+<rect fill-opacity="0.75" stroke-opacity="0.75" fill="#FFFFFF" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5391" x2="71.4865" y2="70.1521">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" width="108.001" height="89"/>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.104H45.584       l-2.564,9.104l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.555z        M59.22,50.662l-6.162-22.116l-6.271,22.116H59.22z"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" fill="#FFFFFF" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5391" x2="71.4859" y2="70.1514">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite5.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" width="108" height="89"/>
+<path fill-opacity="0.6" stroke-opacity="0.6" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.554z        M59.219,50.662l-6.162-22.116l-6.27,22.116H59.219z"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" fill="#FFFFFF" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4856" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite6.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.75" stroke-opacity="0.75" width="108.001" height="89"/>
+<path fill-opacity="0.75" stroke-opacity="0.75" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z        M59.22,50.662l-6.163-22.116l-6.27,22.116H59.22z"/>
+<rect fill-opacity="0.3" stroke-opacity="0.3" fill="#FFFFFF" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite7.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<rect fill-opacity="0.9" stroke-opacity="0.9" width="108" height="89"/>
+<path fill-opacity="0.9" stroke-opacity="0.9" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.554z        M59.219,50.662l-6.162-22.116l-6.27,22.116H59.219z"/>
+<rect fill-opacity="0.15" stroke-opacity="0.15" fill="#FFFFFF" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4856" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadefromwhite8.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect width="108.001" height="89"/>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583l-2.564,9.104       l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.426,42.524l3.906,1.334v2.664H57.554z M59.22,50.662       l-6.163-22.116l-6.27,22.116H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5396" x2="71.4849" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583l-2.564,9.104         l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.426,42.524l3.906,1.334v2.664H57.554z M59.22,50.662         l-6.163-22.116l-6.27,22.116H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5396" x2="71.4849" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<path fill-opacity="0.9" stroke-opacity="0.9" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583        l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.554z         M59.219,50.662l-6.162-22.116l-6.27,22.116H59.219z"/>
+<rect fill-opacity="0.15" stroke-opacity="0.15" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4856" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill-opacity="0.75" stroke-opacity="0.75" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583        l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z         M59.22,50.662l-6.163-22.116l-6.27,22.116H59.22z"/>
+<rect fill-opacity="0.3" stroke-opacity="0.3" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<path fill-opacity="0.6" stroke-opacity="0.6" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583        l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.554z         M59.219,50.662l-6.162-22.116l-6.27,22.116H59.219z"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4856" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack5.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.104H45.584        l-2.564,9.104l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.555z         M59.22,50.662l-6.162-22.116l-6.271,22.116H59.22z"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5391" x2="71.4859" y2="70.1514">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack6.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill-opacity="0.3" stroke-opacity="0.3" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.104H45.584        l-2.564,9.104l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.555z         M59.22,50.662l-6.162-22.116l-6.271,22.116H59.22z"/>
+<rect fill-opacity="0.75" stroke-opacity="0.75" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5386" x2="71.4861" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack7.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.9" stroke-opacity="0.9" width="108.001" height="89"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetoblack8.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect width="108" height="89"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect width="108.001" height="89"/>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583l-2.564,9.104       l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.524h6.37l12.426,42.524l3.906,1.334v2.664H57.554z M59.22,50.662       l-6.163-22.116l-6.27,22.116H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5396" x2="71.4849" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<rect fill-opacity="0.9" stroke-opacity="0.9" width="108" height="89"/>
+<path fill-opacity="0.9" stroke-opacity="0.9" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.554z        M59.219,50.662l-6.162-22.116l-6.27,22.116H59.219z"/>
+<rect fill-opacity="0.15" stroke-opacity="0.15" fill="#FFFFFF" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4856" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.75" stroke-opacity="0.75" width="108.001" height="89"/>
+<path fill-opacity="0.75" stroke-opacity="0.75" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z        M59.22,50.662l-6.163-22.116l-6.27,22.116H59.22z"/>
+<rect fill-opacity="0.3" stroke-opacity="0.3" fill="#FFFFFF" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" width="108" height="89"/>
+<path fill-opacity="0.6" stroke-opacity="0.6" fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.104H45.583       l-2.564,9.104l5.43,1.334v2.664H34.125v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.554z        M59.219,50.662l-6.162-22.116l-6.27,22.116H59.219z"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" fill="#FFFFFF" width="108" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4856" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite5.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.45" stroke-opacity="0.45" width="108.001" height="89"/>
+<path fill-opacity="0.45" stroke-opacity="0.45" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.104H45.584       l-2.564,9.104l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.555z        M59.22,50.662l-6.162-22.116l-6.271,22.116H59.22z"/>
+<rect fill-opacity="0.6" stroke-opacity="0.6" fill="#FFFFFF" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5391" x2="71.4859" y2="70.1514">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite6.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.3" stroke-opacity="0.3" width="108.001" height="89"/>
+<path fill-opacity="0.3" stroke-opacity="0.3" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.104H45.584       l-2.564,9.104l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.555z        M59.22,50.662l-6.162-22.116l-6.271,22.116H59.22z"/>
+<rect fill-opacity="0.75" stroke-opacity="0.75" fill="#FFFFFF" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5386" x2="71.4861" y2="70.1516">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite7.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect fill-opacity="0.15" stroke-opacity="0.15" width="108.001" height="89"/>
+<path fill-opacity="0.15" stroke-opacity="0.15" fill="url(#XMLID_2_)" d="M57.555,67.762v-2.664l5.318-1.334l-2.506-9.105H45.584       l-2.564,9.105l5.43,1.334v2.664H34.126v-2.664l3.89-1.334l13.157-42.525h6.37l12.425,42.525l3.907,1.334v2.664H57.555z        M59.22,50.662l-6.162-22.117l-6.271,22.117H59.22z"/>
+<rect fill-opacity="0.9" stroke-opacity="0.9" fill="#FFFFFF" width="108.001" height="89"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5391" x2="71.4865" y2="70.1521">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_fadetowhite8.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="89" viewBox="0 0 108 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108" height="89"/>
+<rect fill="#FFFFFF" width="108" height="89"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105         l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.369l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662         l-6.162-22.117l-6.271,22.117H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect y="78.667" width="108.001" height="10.333"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105        l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.369l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662        l-6.162-22.117l-6.271,22.117H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect y="68" width="108.001" height="21"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105        l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.369l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662        l-6.162-22.117l-6.271,22.117H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect y="56.25" width="108.001" height="32.75"/>
+<g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6646" x2="68.3218" y2="62.5488">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M54.948,67.719H37.819v-2.658l4.986-1.332V25.271l-4.986-1.332v-2.658h18.068        c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742        c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.026,67.719,54.948,67.719z         M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158        c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+</g>
+<rect fill="#FFFFFF" width="108.001" height="56.25"/>
+<g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="41.3208" y1="31.0903" x2="67.1357" y2="56.9053">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M40.355,56.198l10.817-34.96h6.369l10.234,35.026l-6.948,0.074l-0.462-1.681        H45.583l-0.431,1.529 M59.22,50.662l-6.162-22.117l-6.271,22.117H59.22z"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop5.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect y="44" width="108.001" height="45"/>
+<g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6646" x2="68.3218" y2="62.5488">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M54.948,67.719H37.819v-2.658l4.986-1.332V25.271l-4.986-1.332v-2.658h18.068        c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742        c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.026,67.719,54.948,67.719z         M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158        c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+</g>
+<rect fill="#FFFFFF" width="108.001" height="44"/>
+<g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="45.2661" y1="27.145" x2="63.171" y2="45.0499">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0709" style="stop-color:#C5E5EB"/>
+<stop offset="0.1552" style="stop-color:#B7E0EC"/>
+<stop offset="0.2463" style="stop-color:#9FD6EF"/>
+<stop offset="0.3423" style="stop-color:#7DC9F3"/>
+<stop offset="0.4421" style="stop-color:#52B9F8"/>
+<stop offset="0.5437" style="stop-color:#1EA5FE"/>
+<stop offset="0.5618" style="stop-color:#14A1FF"/>
+<stop offset="0.6236" style="stop-color:#16A2FF"/>
+<stop offset="0.8202" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M44.084,44.146l7.088-22.908h6.369l6.612,22.828l-6.741,0.237l-4.355-15.758        l-4.395,15.521"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop6.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect y="32.5" width="108.001" height="56.5"/>
+<g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="32.437" y1="26.6641" x2="68.322" y2="62.549">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M54.948,67.719H37.819v-2.658l4.986-1.332V25.271l-4.986-1.332v-2.658h18.068        c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742        c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.026,67.719,54.948,67.719z         M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158        c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+</g>
+<rect fill="#FFFFFF" width="108.001" height="32.5"/>
+<g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="45.2661" y1="27.1455" x2="55.7284" y2="37.6078">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.1248" style="stop-color:#C5E5EB"/>
+<stop offset="0.2733" style="stop-color:#B7E0EC"/>
+<stop offset="0.4338" style="stop-color:#9FD6EF"/>
+<stop offset="0.6029" style="stop-color:#7DC9F3"/>
+<stop offset="0.7787" style="stop-color:#52B9F8"/>
+<stop offset="0.9575" style="stop-color:#1EA5FE"/>
+<stop offset="0.9831" style="stop-color:#16A2FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M47.688,32.497l0.054-0.174l3.43-11.085h6.369l3.14,10.837l0.13,0.448        l-6.658-0.014l-0.047-0.17l-1.049-3.795l-1.063,3.758l-0.063,0.222L47.688,32.497z M44.084,44.146"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop7.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect y="21" width="108.001" height="68"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M54.948,67.719H37.819v-2.658l4.986-1.332V25.271l-4.986-1.332v-2.658h18.068        c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742        c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.026,67.719,54.948,67.719z         M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158        c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6646" x2="68.3218" y2="62.5488">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop8.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect y="10.833" width="108.001" height="78.167"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M54.948,67.719H37.819v-2.658l4.986-1.332V25.271l-4.986-1.332v-2.658h18.068        c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742        c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.026,67.719,54.948,67.719z         M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158        c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6646" x2="68.3218" y2="62.5488">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipebototop9.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect width="108.001" height="89"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M54.948,67.719H37.819v-2.658l4.986-1.332V25.271l-4.986-1.332v-2.658h18.068        c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742        c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.026,67.719,54.948,67.719z         M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158        c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6646" x2="68.3218" y2="62.5488">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill="url(#XMLID_2_)" d="M57.554,67.761v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105       l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662       l-6.163-22.117l-6.271,22.117H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5386" x2="71.4854" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect width="18.75" height="89"/>
+<path fill="url(#XMLID_2_)" d="M57.554,67.761v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105        l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.37l12.425,42.525l3.906,1.334v2.664H57.554z M59.22,50.662        l-6.162-22.117l-6.271,22.117H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5391" x2="71.4852" y2="70.1507">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="88.999"/>
+<rect width="31" height="89"/>
+<path fill="url(#XMLID_2_)" d="M57.554,67.761v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105        l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.524h6.37l12.426,42.524l3.906,1.334v2.664H57.554z M59.22,50.661        l-6.163-22.116l-6.271,22.116H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5381" x2="71.4854" y2="70.1504">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.002" height="89" viewBox="0 0 108.002 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.002" height="88.999"/>
+<g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5381" x2="71.4859" y2="70.1504">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M57.555,67.761v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105        l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.524h6.37l12.426,42.524l3.906,1.334v2.664H57.555z M59.221,50.661        l-6.163-22.116l-6.271,22.116H59.221z"/>
+</g>
+<polygon points="54,21.074 54,89 0,89 0,0 54,0 "/>
+<g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="30.2559" y1="28.8457" x2="61.6372" y2="60.227">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M54.145,67.718H37.819V65.06l4.986-1.332V25.271l-4.986-1.332v-2.658H54         M53.895,25.271h-4.55v16.402h4.704 M54.02,45.693l-4.675-0.03v18.064l4.716-0.034"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft5.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect y="0.002" fill="#FFFFFF" width="108.001" height="88.998"/>
+<rect width="74" height="89"/>
+<path fill="url(#XMLID_2_)" d="M54.949,67.719H37.819v-2.658l4.986-1.332V25.273l-4.986-1.332v-2.658h18.069        c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742        c5.717,1.305,8.572,5.094,8.572,11.369c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.027,67.719,54.949,67.719z         M49.345,41.676h4.704c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.676z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158        c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.438" y1="26.666" x2="68.3216" y2="62.5496">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft6.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect width="89.001" height="89"/>
+<path fill="url(#XMLID_2_)" d="M54.949,67.719H37.819v-2.658l4.986-1.332V25.271l-4.986-1.332v-2.658h18.069       c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.743       c5.717,1.305,8.572,5.095,8.572,11.37c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.027,67.719,54.949,67.719z        M49.345,41.674h4.704c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158       c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.438" y1="26.6641" x2="68.3223" y2="62.5484">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipeleft7.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect width="108.001" height="89"/>
+<path fill="url(#XMLID_2_)" d="M54.949,67.718H37.819V65.06l4.986-1.332V25.271l-4.986-1.332v-2.658h18.069       c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.743       c5.717,1.305,8.572,5.095,8.572,11.37c0,4.352-1.27,7.613-3.809,9.787C63.835,66.63,60.027,67.718,54.949,67.718z        M49.345,41.674h4.704c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.728h5.467c3.059,0,5.295-0.717,6.709-2.158       c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.728z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.438" y1="26.6641" x2="68.3223" y2="62.5484">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect width="108.001" height="89"/>
+<path fill="url(#XMLID_2_)" d="M57.554,67.761v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105       l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662       l-6.163-22.117l-6.271,22.117H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5386" x2="71.4854" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect y="0" fill="#FFFFFF" width="108.001" height="89"/>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6646" x2="68.3218" y2="62.5488">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M54.949,67.719H37.819v-2.658l4.986-1.332V25.272l-4.986-1.332v-2.658h18.069       c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.743       c5.717,1.305,8.572,5.095,8.572,11.37c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.027,67.719,54.949,67.719z        M49.345,41.674h4.704c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158       c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+<rect width="89.001" height="89"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="36.8735" y1="35.5396" x2="71.4859" y2="70.1519">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105       l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662       l-6.163-22.117l-6.271,22.117H59.22z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="32.437" y1="26.6636" x2="68.322" y2="62.5486">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M54.949,67.718H37.819V65.06l4.986-1.332V25.271l-4.986-1.332v-2.658h18.069       c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742       c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.63,60.027,67.718,54.949,67.718z        M49.345,41.674h4.704c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.728h5.467c3.059,0,5.295-0.717,6.709-2.158       c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.728z"/>
+<rect width="74" height="89"/>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5386" x2="71.4854" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M57.554,67.761v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105       l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.37l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662       l-6.163-22.117l-6.271,22.117H59.22z"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect y="0" fill="#FFFFFF" width="108.001" height="88.999"/>
+<g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="36.873" y1="35.5386" x2="71.4854" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M57.554,67.761v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105        l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.524h6.37l12.426,42.524l3.906,1.334v2.664H57.554z M59.22,50.662        l-6.163-22.116l-6.271,22.116H59.22z"/>
+</g>
+<polygon points="54,21.074 54,89 0,89 0,0 54,0 "/>
+<g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="30.2559" y1="28.8462" x2="61.6365" y2="60.2268">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M54.144,67.718H37.819V65.06l4.986-1.332V25.272l-4.986-1.332v-2.658H54         M53.894,25.272h-4.549v16.402h4.704 M54.02,45.694l-4.675-0.03v18.064l4.716-0.034"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight5.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect y="0" width="31" height="88.999"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M54.949,67.719H37.819v-2.658l4.986-1.332V25.271l-4.986-1.332v-2.658h18.069        c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.331-2.377,8.911-7.133,10.743        c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.027,67.719,54.949,67.719z         M49.345,41.674h4.704c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158        c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6641" x2="68.3225" y2="62.549">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight6.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<path fill="url(#XMLID_2_)" d="M54.949,67.718H37.819V65.06l4.986-1.332V25.271l-4.986-1.332v-2.658h18.069       c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742       c5.717,1.305,8.572,5.095,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.63,60.027,67.718,54.949,67.718z        M49.345,41.674h4.704c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828       c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.728h5.467c3.059,0,5.295-0.717,6.709-2.158       c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.728z"/>
+<rect y="0" width="18.75" height="88.999"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6641" x2="68.3225" y2="62.549">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wiperight7.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M54.949,67.718H37.819V65.06l4.986-1.332V25.271l-4.986-1.332v-2.658h18.069        c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742        c5.717,1.305,8.572,5.095,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.63,60.027,67.718,54.949,67.718z         M49.345,41.674h4.704c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828        c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.728h5.467c3.059,0,5.295-0.717,6.709-2.158        c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.728z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6641" x2="68.3218" y2="62.5484">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105         l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.369l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662         l-6.162-22.117l-6.271,22.117H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect width="108.001" height="10.75"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105         l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.369l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662         l-6.162-22.117l-6.271,22.117H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect width="108.001" height="21"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105         l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.369l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662         l-6.162-22.117l-6.271,22.117H59.22z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105        l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.369l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662        l-6.162-22.117l-6.271,22.117H59.22z"/>
+</g>
+<rect width="108.001" height="32.5"/>
+<g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="42.4932" y1="16.6089" x2="63.5904" y2="37.7061">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0842" style="stop-color:#C5E5EB"/>
+<stop offset="0.1843" style="stop-color:#B7E0EC"/>
+<stop offset="0.2925" style="stop-color:#9FD6EF"/>
+<stop offset="0.4065" style="stop-color:#7DC9F3"/>
+<stop offset="0.5251" style="stop-color:#52B9F8"/>
+<stop offset="0.6457" style="stop-color:#1EA5FE"/>
+<stop offset="0.6629" style="stop-color:#16A2FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M62.193,32.534c-0.075-2.338-0.686-4.11-1.827-5.321        c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52v7.273l-6.539-0.063v-7.211l-4.986-1.332v-2.658h18.068        c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449L62.193,32.534z"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo5.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105        l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.369l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662        l-6.162-22.117l-6.271,22.117H59.22z"/>
+</g>
+<rect width="108.001" height="44"/>
+<g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="39.6494" y1="19.4526" x2="64.0515" y2="43.8547">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0869" style="stop-color:#C5E5EB"/>
+<stop offset="0.1901" style="stop-color:#B7E0EC"/>
+<stop offset="0.3018" style="stop-color:#9FD6EF"/>
+<stop offset="0.4194" style="stop-color:#7DCAF3"/>
+<stop offset="0.5416" style="stop-color:#52B9F8"/>
+<stop offset="0.666" style="stop-color:#1EA5FE"/>
+<stop offset="0.6685" style="stop-color:#1DA5FE"/>
+<stop offset="0.8876" style="stop-color:#16A2FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M42.806,43.858V25.271l-4.986-1.332v-2.658h18.068        c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742        c0.82,0.188,1.582,0.426,2.285,0.715L42.806,43.858z M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.158        c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo6.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<g>
+<linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="36.8726" y1="35.5386" x2="71.4849" y2="70.1509">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_3_)" d="M57.554,67.762v-2.664l5.318-1.334l-2.506-9.105H45.583l-2.564,9.105        l5.43,1.334v2.664H34.126v-2.664l3.889-1.334l13.158-42.525h6.369l12.426,42.525l3.906,1.334v2.664H57.554z M59.22,50.662        l-6.162-22.117l-6.271,22.117H59.22z"/>
+</g>
+<rect width="108.001" height="56.25"/>
+<g>
+<linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="36.5869" y1="22.5151" x2="70.2152" y2="56.1435">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+<path fill="url(#XMLID_4_)" d="M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.158        c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z         M63.576,56.251c0.045-0.511,0.067-1.05,0.067-1.616c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25        h-5.344v10.443h-6.539V25.271l-4.986-1.332v-2.658h18.068c4.285,0,7.498,0.941,9.639,2.824        c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742c5.717,1.305,8.572,5.096,8.572,11.371        c0,0.54-0.02,1.063-0.059,1.568L63.576,56.251z"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo7.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect width="108.001" height="67.75"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M54.948,67.719H37.819v-2.658l4.986-1.332V25.271l-4.986-1.332v-2.658         h18.068c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742         c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.026,67.719,54.948,67.719z          M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828         c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158         c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6646" x2="68.3218" y2="62.5488">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo8.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect fill="#FFFFFF" width="108.001" height="89"/>
+<rect width="108.001" height="78.75"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M54.948,67.719H37.819v-2.658l4.986-1.332V25.271l-4.986-1.332v-2.658         h18.068c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742         c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.026,67.719,54.948,67.719z          M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828         c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158         c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6646" x2="68.3218" y2="62.5488">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_graf_ve_trans_wipetoptobo9.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108.001" height="89" viewBox="0 0 108.001 89">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<g>
+<rect width="108.001" height="89"/>
+<g>
+<path fill="url(#XMLID_2_)" d="M54.948,67.719H37.819v-2.658l4.986-1.332V25.271l-4.986-1.332v-2.658         h18.068c4.285,0,7.498,0.941,9.639,2.824c2.143,1.887,3.215,4.701,3.215,8.449c0,5.33-2.377,8.91-7.133,10.742         c5.717,1.305,8.572,5.096,8.572,11.371c0,4.352-1.27,7.613-3.809,9.787C63.835,66.631,60.026,67.719,54.948,67.719z          M49.345,41.674h4.703c2.717,0,4.756-0.719,6.115-2.158c1.357-1.439,2.039-3.596,2.039-6.475c0-2.59-0.613-4.531-1.836-5.828         c-1.223-1.295-3.057-1.941-5.502-1.941h-5.52V41.674z M49.345,63.729h5.467c3.059,0,5.295-0.717,6.709-2.158         c1.414-1.438,2.123-3.75,2.123-6.936c0-2.979-0.75-5.221-2.25-6.721c-1.498-1.498-3.732-2.25-6.705-2.25h-5.344V63.729z"/>
+<defs>
+<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="32.4375" y1="26.6646" x2="68.3218" y2="62.5488">
+<stop offset="0" style="stop-color:#CAE7EA"/>
+<stop offset="0.0549" style="stop-color:#C5E5EB"/>
+<stop offset="0.1203" style="stop-color:#B7E0EC"/>
+<stop offset="0.1909" style="stop-color:#9FD6EF"/>
+<stop offset="0.2653" style="stop-color:#7DC9F3"/>
+<stop offset="0.3426" style="stop-color:#52B9F8"/>
+<stop offset="0.4213" style="stop-color:#1EA5FE"/>
+<stop offset="0.4326" style="stop-color:#16A2FF"/>
+<stop offset="0.6124" style="stop-color:#0099FF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</linearGradient>
+</defs>
+</g>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_menu_ve_cxt.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="88" height="88" viewBox="0 0 88 88">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="none" width="88" height="88"/>
+<g>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M14.226,63.871c-1.643,0.616-5.108,1.973-6.092,2.365        c-1.611,0.645-1.572,2.035,1.065,2.742c0.994,0.261,49.768,13.211,52.065,13.809c2.299,0.595,4.518,0.147,5.523-0.593        c1.014-0.74,3.643-2.421,4.979-3.607c1.232-1.093-0.33-2.292-2.01-2.689c-1.682-0.401-48.792-11.771-50.708-12.236        C17.132,63.201,15.874,63.253,14.226,63.871z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M14.385,64.303c-1.366,0.509-4.264,1.644-5.228,2.03        c-1.522,0.6-1.34,1.798,0.938,2.408c2.89,0.769,49.056,13.025,51.285,13.601c2.186,0.568,4.256,0.133,5.145-0.514        c0.945-0.701,3.254-2.087,4.275-3.105c1.227-0.901-0.193-2.154-1.859-2.549c-3.424-0.827-48.34-11.667-50.001-12.07        C17.088,63.661,15.928,63.724,14.385,64.303z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M14.548,64.726c-1.098,0.413-3.421,1.326-4.364,1.704        c-1.437,0.55-1.112,1.563,0.802,2.073c4.796,1.274,48.349,12.834,50.509,13.396c2.076,0.538,3.99,0.112,4.754-0.444        c0.676-0.49,2.68-1.681,3.586-2.595c1.123-0.834-0.057-2.021-1.705-2.41c-5.17-1.249-47.892-11.559-49.294-11.896        C17.051,64.116,15.983,64.193,14.548,64.726z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M14.708,65.155c-0.822,0.31-2.577,1-3.501,1.366c-1.35,0.51-0.883,1.329,0.672,1.743        c6.694,1.779,47.635,12.649,49.731,13.192c1.963,0.509,3.732,0.091,4.375-0.371c0.5-0.369,2.08-1.507,2.885-2.098        c1.016-0.753,0.078-1.878-1.549-2.265c-6.916-1.674-47.449-11.45-48.595-11.729C17.005,64.579,16.04,64.661,14.708,65.155z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M14.867,65.583c-0.546,0.209-1.731,0.678-2.632,1.033        c-1.269,0.465-0.66,1.092,0.534,1.415c8.6,2.28,46.928,12.456,48.956,12.982c1.852,0.48,3.471,0.072,3.986-0.297        c0.334-0.246,1.564-1.131,2.191-1.588c0.908-0.689,0.219-1.74-1.393-2.13c-8.666-2.095-47.002-11.343-47.894-11.56        C16.964,65.04,16.096,65.128,14.867,65.583z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M15.028,66.017c-0.274,0.1-0.89,0.351-1.769,0.692        c-1.181,0.423-0.431,0.858,0.403,1.084c10.501,2.788,46.216,12.272,48.173,12.776c1.746,0.452,3.213,0.056,3.607-0.223        c0.162-0.122,1.045-0.752,1.49-1.083c0.807-0.616,0.357-1.604-1.238-1.988c-10.402-2.522-46.55-11.236-47.185-11.391        C16.922,65.499,16.152,65.592,15.028,66.017z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M15.19,66.442c0,0-0.046,0.026-0.908,0.361c-1.093,0.379-0.202,0.628,0.271,0.752        c12.406,3.296,45.508,12.086,47.401,12.572c1.633,0.425,2.945,0.03,3.219-0.151c-0.002,0.003,0.523-0.373,0.797-0.579        c0.697-0.548,0.494-1.467-1.084-1.849C52.731,74.606,18.78,66.421,18.402,66.331C16.879,65.964,16.21,66.062,15.19,66.442z"/>
+</g>
+<g>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="41.8213" y1="19.2471" x2="51.3221" y2="56.611">
+<stop offset="0" style="stop-color:#222221"/>
+<stop offset="0.0284" style="stop-color:#4C4C4C"/>
+<stop offset="0.0535" style="stop-color:#6B6B6B"/>
+<stop offset="0.0674" style="stop-color:#777777"/>
+<stop offset="0.1348" style="stop-color:#BFBFC0"/>
+<stop offset="0.1742" style="stop-color:#FFFFFF"/>
+<stop offset="0.2584" style="stop-color:#FFFFFF"/>
+<stop offset="0.2921" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M69.997,25.755c0.066-1.852-0.063-3.643-0.688-4.602c-0.9-1.38-2.43-2.107-3.805-2.429        c-1.371-0.322-15.725-1.919-21.967-2.428c-6.237-0.514-16.409-1.091-19.034-1.279c-2.618-0.191-4.93,0-6.676,0.126        c-1.118,0.085-2.869,0.555-3.988,0.885c0,0-0.002,0-0.004,0c0.742-0.104,1.262,0.037,1.262,0.037s10.323,0.501,20.451,1.398        c10.132,0.9,23.185,2.696,23.185,2.696s3.236,0.196,4.381,2.191c0.887,1.547,0.875,5.29,0.875,5.29s0.297,14.466,0,24.042        c-0.289,9.575-0.973,21.949-0.973,21.949s-0.059,3.259-1.754,4.19c0.021-0.011,0.037-0.024,0.057-0.035        c0.742-0.376,2.699-1.366,3.748-1.982c1.311-0.764,2.934-1.852,3.369-2.939c0.441-1.091,1.438-18.664,1.561-28.446        C70.124,34.64,69.934,27.61,69.997,25.755z"/>
+</g>
+<g>
+<path fill="#FFFFFF" d="M15.097,16.065c0,0,10.323,0.501,20.451,1.398c10.132,0.9,23.185,2.696,23.185,2.696        s3.162,0.155,4.381,2.191c0.887,1.485,0.875,5.29,0.875,5.29s0.297,14.466,0,24.042c-0.289,9.575-0.973,21.949-0.973,21.949        s-0.049,3.28-1.754,4.19c-2.244,1.201-5.537,0.282-5.537,0.282s-14.036-2.979-21.245-4.77        c-7.209-1.798-18.897-5.091-18.897-5.091s-2.63-0.498-3.604-2.093c-0.883-1.446-1.035-4.226-1.035-4.226        s-0.488-14.531-0.524-21.713c-0.03-7.186-0.096-20.154-0.096-20.154s0.105-1.86,1.363-2.994        C13.34,15.569,15.097,16.065,15.097,16.065z"/>
+</g>
+<g>
+<radialGradient id="XMLID_8_" cx="21.8848" cy="21.8428" r="57.3996" fx="21.8848" fy="21.8428" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.0056" style="stop-color:#FFFFFF"/>
+<stop offset="0.249" style="stop-color:#F8F8F8"/>
+<stop offset="0.6016" style="stop-color:#E5E5E5"/>
+<stop offset="1" style="stop-color:#C7C7C7"/>
+</radialGradient>
+<path fill="url(#XMLID_8_)" d="M22.177,40.313L22.152,19.29c0,0,7.686,0.32,13.324,0.8c5.626,0.479,15.477,1.584,15.477,1.584        L49.36,73.37c0,0-7.999-1.6-14.757-3.271c-6.761-1.674-11.439-3.074-11.439-3.074L22.177,40.313z"/>
+</g>
+<g>
+<polyline fill="#3C3C3C" points="14.508,40.698 14.508,46.235 18.779,46.948 18.779,46.005 15.819,45.414 15.819,40.867 "/>
+<polyline fill="#3C3C3C" points="18.597,35.139 15.42,34.716 15.42,30.192 14.373,30.103 14.373,35.637 18.592,35.972 "/>
+<polygon fill="#3C3C3C" points="18.145,24.12 15.373,23.923 15.27,18.873 13.979,18.885 14.102,24.263 18.145,24.639 "/>
+<path fill="#3C3C3C" d="M48.815,43.634c-1.197,0.205-7.779-1.031-10.306-1.419c-2.597-0.4-14.341-2.052-15.191-2.601        c-0.848-0.549-0.748-1.399-0.748-1.399V19.323l-2.948-0.199l-1.25,0.349l0.013,0.049l-0.239-0.017l3.449,0.241v18.612        c0,0,0.24,0.96,0.723,1.362c0.479,0.402,0.964,0.804,0.964,0.804l24.064,3.771c0,0,0.965,0.077,1.365-0.482"/>
+<polyline fill="#3C3C3C" points="19.117,56.536 16.071,55.955 16.071,51.53 14.891,51.378 14.891,56.915 19.109,57.64 "/>
+<polygon points="53.049,21.924 50.954,21.674 49.112,22.069 51.678,22.391 51.678,27.928 57.211,28.648 57.211,27.914         53.049,27.419 "/>
+<polyline points="51.846,34.148 51.831,39.915 57.032,40.748 57.077,39.737 52.95,39.166 52.95,34.245 "/>
+<polyline points="51.834,46.424 51.834,52.127 57.034,53.124 57.04,52.277 52.852,51.51 52.852,46.588 "/>
+<polyline points="57.04,62.878 52.801,62.007 52.801,57.29 51.834,57.135 51.834,62.838 57.034,63.834 "/>
+<polyline points="52.965,69.241 52.786,75.061 53.792,74.233 53.901,69.368 "/>
+<path d="M60.745,23.821c-0.496-0.848-2.045-1.297-2.045-1.297l-1.352,0.199l0.008,0.067c0.395,0.011,1.572,0.178,2.422,1.688        c1.051,1.845,0.885,3.369,0.885,3.369l-0.564,42.761c0,0-0.074,2.936-1.209,3.945c0.498-0.175,0.979-0.631,1.123-0.745        c0.5-0.4,0.732-2.558,0.834-3.759c0.1-1.198,0.852-37.681,0.852-37.681s0.049-2.55,0.049-4.05        C61.747,26.822,61.249,24.673,60.745,23.821z"/>
+<path fill="#3C3C3C" d="M23.038,48.868c-0.483,0.318-0.883,1.281-0.883,1.281v17.41l0.006-0.004l0.98-0.526l0.002-16.943        c0,0-0.029-0.932,0.123-1.333C23.188,48.785,23.111,48.819,23.038,48.868z"/>
+<polyline fill="#3C3C3C" points="15.336,61.544 15.336,66.035 15.319,66.044 16.422,65.653 16.438,61.798 "/>
+</g>
+<g>
+<g>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="11.6455" y1="47.2861" x2="60.6724" y2="47.2861">
+<stop offset="0" style="stop-color:#B0B0AF"/>
+<stop offset="0.0115" style="stop-color:#A9A9A8"/>
+<stop offset="0.0713" style="stop-color:#8A8A89"/>
+<stop offset="0.1389" style="stop-color:#6E6E6E"/>
+<stop offset="0.2154" style="stop-color:#585858"/>
+<stop offset="0.3046" style="stop-color:#474747"/>
+<stop offset="0.4151" style="stop-color:#3C3C3C"/>
+<stop offset="0.57" style="stop-color:#353535"/>
+<stop offset="1" style="stop-color:#333333"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M59.778,24.479c-1.041-1.846-2.566-1.688-2.566-1.688v5.857l-5.533-0.721         v-5.537l-2.566-0.321v20.22c0,0,0,0.961-0.402,1.524c-0.4,0.56-1.365,0.482-1.365,0.482L23.28,40.524         c0,0-0.484-0.401-0.964-0.804c-0.482-0.402-0.723-1.362-0.723-1.362V19.746l-3.449-0.241v5.134l-4.043-0.376l-0.13-5.241         c0,0-1.285,0.725-1.686,1.285c-0.398,0.56-0.641,1.925-0.641,1.925l0.964,37.146c0,0,0.16,1.442,0.16,2.002         c0,0.562,0.161,1.69,0.563,2.89c0.399,1.203,2.004,1.766,2.004,1.766v-4.491l4.094,0.961v4.414l2.726,0.641v-17.41         c0,0,0.399-0.963,0.883-1.281c0.48-0.32,1.125-0.162,1.125-0.162l23.425,4.254c0,0,0.959,0.496,1.438,1.06         c0.482,0.559,0.262,2.03,0.262,2.03l0.01,18.318l3.488,0.684l0.176-5.808l3.871,0.517l-0.125,5.79         c0,0,1.201-0.478,2.057-0.935c1.205-0.644,1.334-4.008,1.334-4.008l0.564-42.761C60.663,27.848,60.829,26.323,59.778,24.479z          M14.373,30.103l4.271,0.365l-0.052,5.504l-4.219-0.335V30.103z M14.508,40.698l4.271,0.552v5.698l-4.271-0.713V40.698z          M19.109,57.64l-4.219-0.725v-5.537l4.261,0.552L19.109,57.64z M51.848,34.148l5.217,0.457l-0.033,6.143l-5.201-0.833         L51.848,34.148z M57.034,63.834l-5.199-0.996v-5.703l5.232,0.829L57.034,63.834z M57.034,53.124l-5.199-0.997v-5.703         l5.232,0.828L57.034,53.124z"/>
+</g>
+</g>
+<polygon fill="#211E18" points="58.274,53.018 65.979,47.879 70.004,52.259 63.002,57.162 "/>
+<path fill="#392216" d="M67.071,45.823c0,0-0.008-8.405,7.471-8.405c6.832,0,8.641,6.304,8.057,9.454       c-0.658,3.56-2.801,5.372-4.32,6.071c-1.979,0.914,5.205-7.446-1.195-12.724C72.092,36.105,67.071,45.823,67.071,45.823z"/>
+<path fill="#392216" d="M72.559,40.337c-3.193,1.926-4.166,4.271-4.166,7.398c0,3.56,5.361,5.731,7.902,4.523       c2.867-1.364,3.232-3.062,1.928-2.188c-1.186,0.788-2.625,0.996-4.906-0.395C67.497,46.129,72.559,40.337,72.559,40.337z"/>
+<path fill="#392216" d="M69.848,65.334c0,0-1.414,2.846-0.758,5.516c1.045,4.249,4.596,4.685,7.311,4.552       c1.496-0.071,0.482,2.364-2.275,2.191c-2.758-0.178-6.217-2.498-7.049-3.81c-0.832-1.313-0.219-4.729,0.352-5.999       C67.997,66.516,69.848,65.334,69.848,65.334z"/>
+<path fill="#392216" d="M23.782,39.869c0,0,2.917-3.852,9.688-1.634c6.771,2.217,22.645,10.739,27.081,15.175       c4.498,4.496,6.52,6.116,9.221,8.637c0.439,0.409,0.533,0.461,0.658,0.717c0,0,0.611-0.438,2.494-0.744       c4.127-0.671,7.779,3.979,8.309,7.218c0.5,3.063-0.035,6.002-3.539,8.221c-2.145,1.357,2.838-7.905-0.654-11.017       c-5.254-4.685-8.199,0.861-8.199,0.861S52.731,53.527,45.26,50.259C39.21,47.611,23.782,39.869,23.782,39.869z"/>
+<path fill="#443C27" d="M56.45,53.41c-0.818,0.234-31.283,6.07-32.219,6.186       c-1.417,0.18,2.104,3.271,6.538,3.621c6.438,0.507,13.201-0.604,22.296-3.036C63.102,57.495,56.45,53.41,56.45,53.41z"/>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="24.3804" y1="58.8408" x2="59.0796" y2="58.8408">
+<stop offset="0" style="stop-color:#E3B83A"/>
+<stop offset="0.1974" style="stop-color:#DEA826"/>
+<stop offset="0.4652" style="stop-color:#D89812"/>
+<stop offset="0.7333" style="stop-color:#D58E06"/>
+<stop offset="1" style="stop-color:#D48B02"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M56.918,53.877c-0.816,0.234-31.287,6.069-32.219,6.186       c-1.418,0.179,2.1,3.27,6.537,3.62c6.438,0.509,13.201-0.603,22.295-3.035C63.571,57.963,56.918,53.877,56.918,53.877z"/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="65.3833" y1="42.7988" x2="77.0609" y2="54.4764">
+<stop offset="0" style="stop-color:#C6833A"/>
+<stop offset="1" style="stop-color:#D48B02"/>
+</linearGradient>
+<path fill="url(#XMLID_11_)" d="M69.409,52.128l-6.307,4.318l-4.318-4.202l7.705-5.137l-0.117-0.935       c0,0-0.59-8.307,6.887-8.172c6.42,0.117,8.5,6.072,8.406,9.223c-0.117,3.853-2.334,4.904-3.734,5.836       c-0.766,0.511-4.871,2.075-8.396-0.956C69.375,51.966,69.409,52.128,69.409,52.128z M73.959,40.629       c-2.826-0.489-4.902,2.177-4.902,5.077c0,2.901,2.451,4.67,4.318,5.254c2.738,0.854,5.785-2.01,5.604-4.903       C78.803,43.255,76.995,41.154,73.959,40.629z"/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="30.2354" y1="32.5767" x2="76.4562" y2="78.7976">
+<stop offset="0" style="stop-color:#E3BD3A"/>
+<stop offset="0.2015" style="stop-color:#E2B938"/>
+<stop offset="0.404" style="stop-color:#E1AD31"/>
+<stop offset="0.6071" style="stop-color:#DD9925"/>
+<stop offset="0.8093" style="stop-color:#D97D15"/>
+<stop offset="1" style="stop-color:#D45B02"/>
+</linearGradient>
+<path fill="url(#XMLID_12_)" d="M22.89,40.001c0,0,2.086-3.487,8.856-1.27       c6.77,2.218,22.995,10.857,27.432,15.293c4.434,4.435,9.457,8.947,9.674,9.308c0,0,2.511-1.231,5.166-0.307       c7.787,2.712,7.162,11.587,3.604,14.579c-2.006,1.687-6.91,1.654-9.689-1.4c-3.502-3.854-2.1-8.58-2.1-8.58       S51.196,54.169,43.726,50.901C37.676,48.254,22.89,40.001,22.89,40.001z M72.18,65.478c-2.602,0-4.189,1.962-4.363,4.306       c-0.234,3.152,1.053,6.068,4.787,6.536c2.572,0.32,5.531-1.218,4.828-5.59C77,68.037,74.782,65.478,72.18,65.478z"/>
+<circle cx="56.565" cy="56.328" r="1.75"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_prop_ve_bw.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="28" height="28" viewBox="0 0 28 28"
+	 overflow="visible" enable-background="new 0 0 28 28" xml:space="preserve">
+<g>
+	<g>
+		<rect x="0.246" fill="#666666" width="9.248" height="28"/>
+		<rect x="9.503" fill="#B2B2B2" width="9.248" height="28"/>
+		<rect x="18.74" width="9.246" height="28"/>
+	</g>
+	<g>
+		<g>
+			<path d="M0,0.02v27.953h28V0.02H0z M26.664,26.639H1.335V1.354h25.329V26.639z"/>
+		</g>
+	</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_prop_ve_colour.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="28" height="28" viewBox="0 0 28 28"
+	 overflow="visible" enable-background="new 0 0 28 28" xml:space="preserve">
+<g>
+	<rect x="0.246" fill="#FF0000" width="9.248" height="28"/>
+	<rect x="9.503" fill="#00FF00" width="9.248" height="28"/>
+	<rect x="18.741" fill="#2800FF" width="9.245" height="28"/>
+</g>
+<g>
+	<g>
+		<path d="M0,0.021v27.953h28V0.021H0z M26.664,26.639H1.336V1.354h25.328V26.639z"/>
+	</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_prop_ve_file_audio.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="24" height="24" viewBox="0 0 24 24"
+	 overflow="visible" enable-background="new 0 0 24 24" xml:space="preserve">
+<rect fill="none" width="24" height="24"/>
+<path fill="#FFFFFF" stroke="#FFFFFF" stroke-width="2.5" d="M18.878,15.053L18.872,3.348H6.923L6.911,15.849
+	c-0.694-0.137-1.536-0.045-2.361,0.312c-1.631,0.703-2.567,2.167-2.09,3.27c0.477,1.1,2.183,1.423,3.813,0.72
+	c1.474-0.637,2.37-1.893,2.179-2.94V8.241h8.886v5.514c-0.691-0.133-1.528-0.038-2.345,0.316c-1.631,0.703-2.565,2.166-2.091,3.269
+	c0.477,1.1,2.183,1.423,3.813,0.72C18.222,17.409,19.119,16.114,18.878,15.053z M8.452,7.031V5.509h8.886v1.522H8.452z"/>
+<path d="M18.878,15.053L18.872,3.348H6.923L6.911,15.849c-0.694-0.137-1.536-0.045-2.361,0.312c-1.631,0.703-2.567,2.167-2.09,3.27
+	c0.477,1.1,2.183,1.423,3.813,0.72c1.474-0.637,2.37-1.893,2.179-2.94V8.241h8.886v5.514c-0.691-0.133-1.528-0.038-2.345,0.316
+	c-1.631,0.703-2.565,2.166-2.091,3.269c0.477,1.1,2.183,1.423,3.813,0.72C18.222,17.409,19.119,16.114,18.878,15.053z M8.452,7.031
+	V5.509h8.886v1.522H8.452z"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_prop_ve_file_video.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="23.999" height="24" viewBox="0 0 23.999 24"
+	 overflow="visible" enable-background="new 0 0 23.999 24" xml:space="preserve">
+<rect x="0" fill="none" width="23.999" height="24"/>
+<path fill="#FFFFFF" stroke="#FFFFFF" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" d="M17.419,2.976v6.307
+	H7.528V2.976H4.543v17.716h2.985v-0.727h9.892v0.727h2.977V2.976H17.419z M7.528,17.588v-6.235h9.892v6.235H7.528z"/>
+<path d="M17.419,2.976v6.307H7.528V2.976H4.543v17.716h2.985v-0.727h9.892v0.727h2.977V2.976H17.419z M7.528,17.588v-6.235h9.892
+	v6.235H7.528z"/>
+<rect x="5.376" y="4.523" fill="#FFFFFF" width="1.339" height="1.502"/>
+<rect x="5.376" y="7.71" fill="#FFFFFF" width="1.339" height="1.502"/>
+<rect x="5.376" y="10.899" fill="#FFFFFF" width="1.339" height="1.499"/>
+<rect x="5.376" y="14.083" fill="#FFFFFF" width="1.339" height="1.505"/>
+<rect x="5.376" y="17.271" fill="#FFFFFF" width="1.339" height="1.502"/>
+<rect x="18.282" y="4.523" fill="#FFFFFF" width="1.345" height="1.502"/>
+<rect x="18.282" y="7.71" fill="#FFFFFF" width="1.345" height="1.502"/>
+<rect x="18.282" y="10.899" fill="#FFFFFF" width="1.345" height="1.499"/>
+<rect x="18.282" y="14.083" fill="#FFFFFF" width="1.345" height="1.505"/>
+<rect x="18.282" y="17.271" fill="#FFFFFF" width="1.345" height="1.502"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_prop_ve_muted.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="28" height="28" viewBox="0 0 28 28"
+	 overflow="visible" enable-background="new 0 0 28 28" xml:space="preserve">
+<rect fill="none" width="28" height="28"/>
+<path fill="#FFFFFF" stroke="#FFFFFF" stroke-width="0.917" d="M14.004,2.613c-6.282,0-11.392,5.105-11.392,11.382
+	c0,6.281,5.11,11.39,11.392,11.39c6.275,0,11.381-5.109,11.381-11.39C25.385,7.719,20.279,2.613,14.004,2.613L14.004,2.613z
+	 M3.147,13.996c0-5.993,4.862-10.848,10.857-10.848c5.99,0,10.847,4.855,10.847,10.848l0,0l0,0c0,5.994-4.856,10.854-10.847,10.854
+	C8.009,24.85,3.147,19.989,3.147,13.996L3.147,13.996L3.147,13.996z M14.004,5.393c-1.979,0-3.792,0.672-5.246,1.792l0.378,0.378
+	l0,0L9.14,7.565l0,0l11.293,11.29l0,0l0.004,0.004l0,0l0.379,0.378c0.108-0.142,0.213-0.286,0.312-0.434l0,0
+	c0.002-0.002,0.003-0.004,0.005-0.007l0,0c0.929-1.372,1.475-3.022,1.475-4.801C22.607,9.241,18.756,5.393,14.004,5.393
+	L14.004,5.393z M9.583,7.252c1.319-0.869,2.836-1.326,4.42-1.326c4.448,0,8.069,3.62,8.069,8.069c0,1.583-0.457,3.099-1.326,4.416
+	L9.583,7.252L9.583,7.252z M7.364,8.519c-1.231,1.488-1.967,3.395-1.967,5.477c0,4.748,3.857,8.6,8.607,8.6
+	c1.884,0,3.629-0.605,5.048-1.635l0,0c0.001-0.001,0.002-0.002,0.003-0.003l0,0c0.145-0.104,0.286-0.214,0.423-0.327L7.364,8.519
+	L7.364,8.519z M14.004,22.062c-4.451,0-8.073-3.62-8.073-8.066c0-1.676,0.525-3.312,1.485-4.667l11.252,11.249
+	C17.312,21.537,15.677,22.062,14.004,22.062L14.004,22.062z"/>
+<path fill="#FFFFFF" d="M22.391,14.012c0,4.626-3.768,8.382-8.414,8.382c-4.647,0-8.417-3.756-8.417-8.382
+	c0-4.63,3.769-8.381,8.417-8.381C18.623,5.63,22.391,9.382,22.391,14.012z"/>
+<g>
+	<polygon stroke="#000000" stroke-width="1.0254" stroke-linejoin="round" points="14.129,19.639 14.129,8.358 8.711,12.742 
+		6.997,12.742 6.997,14.957 8.711,14.957 	"/>
+	<path fill="none" stroke="#000000" stroke-width="1.1396" stroke-linecap="round" stroke-linejoin="round" d="M16.752,10.916
+		c1.084,0.598,1.82,1.754,1.82,3.079c0,1.333-0.744,2.492-1.837,3.087"/>
+	<path fill="none" stroke="#000000" stroke-width="1.1396" stroke-linecap="round" stroke-linejoin="round" d="M17.84,8.647
+		C19.724,9.686,21,11.691,21,13.993c0,1.887-0.861,3.574-2.209,4.692"/>
+</g>
+<path stroke="#FFFFFF" stroke-width="0.917" d="M2.881,13.996c0,6.133,4.99,11.122,11.124,11.122
+	c6.127,0,11.113-4.988,11.113-11.122c0-6.129-4.986-11.116-11.113-11.116C7.87,2.88,2.881,7.867,2.881,13.996z M5.664,13.996
+	c0-1.835,0.626-3.614,1.737-5.062c0.428,0.428,11.233,11.23,11.662,11.658c-1.449,1.11-3.227,1.736-5.058,1.736
+	C9.406,22.328,5.664,18.59,5.664,13.996z M14.005,5.659c4.596,0,8.336,3.739,8.336,8.336c0,1.741-0.576,3.382-1.588,4.801
+	C20.28,18.324,9.672,7.718,9.199,7.246C10.621,6.234,12.263,5.659,14.005,5.659z"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_prop_ve_rec.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="28" height="28" viewBox="-6.001 -6 28 28"
+	 overflow="visible" enable-background="new -6.001 -6 28 28" xml:space="preserve">
+<rect x="-6.001" y="-6" fill="none" width="28" height="28"/>
+<path fill="#FF0000" stroke="#FFFFFF" stroke-width="1.7501" d="M17.722,7.76c0,5.37-4.348,9.729-9.729,9.729
+	c-5.375,0-9.733-4.356-9.733-9.729c0-5.382,4.358-9.733,9.733-9.733C13.372-1.972,17.722,2.378,17.722,7.76z"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/data/qgn_prop_ve_slow.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="27.999" height="28" viewBox="0 0 27.999 28"
+	 overflow="visible" enable-background="new 0 0 27.999 28" xml:space="preserve">
+<rect x="0" fill="none" width="27.999" height="28"/>
+<path fill="#FFFFFF" stroke="#FFFFFF" stroke-width="1.9263" d="M25.441,7.446c-0.481,0-0.87,0.416-0.87,0.929
+	c0,0.083,0.024,0.156,0.043,0.232l-1.483,2.217c-0.366-0.188-0.772-0.302-1.205-0.302c-0.386,0-0.754,0.083-1.089,0.233
+	l-1.439-2.152c0.018-0.075,0.043-0.148,0.043-0.229c0-0.513-0.39-0.929-0.869-0.929c-0.481,0-0.87,0.416-0.87,0.929
+	c0,0.514,0.389,0.929,0.87,0.929c0.152,0,0.288-0.053,0.412-0.127l1.056,2.139c-0.556,0.546-0.909,1.321-0.909,2.19
+	c0,0.468,0.11,0.905,0.29,1.298c-1.494-0.477-5.134-1.447-6.041,0.129c0,0,0.048,0.571-2.866,1.128
+	c-1.886,0.36-1.775,0.868-2.961,1.236c-1.056,0.327-2.309,0.451-3.354,0.411c-0.923-0.035-1.595-0.411-1.595-0.411
+	s0.822,1.838,1.705,2.757c0.883,0.922,1.736,1.347,3.521,1.468c1.466,0.098,2.474-0.469,5.004-0.527
+	c2.404-0.058,4.288,0.881,6.379-0.47c1.938-1.253,2.698-3.327,3.433-4.129c0.009-0.01,0.016-0.02,0.024-0.028
+	c1.182-0.35,2.053-1.492,2.053-2.862c0-0.813-0.306-1.548-0.799-2.086l1.104-2.243c0.125,0.074,0.261,0.126,0.414,0.126
+	c0.479,0,0.868-0.416,0.868-0.929C26.309,7.862,25.92,7.446,25.441,7.446z"/>
+<path d="M25.441,7.446c-0.481,0-0.87,0.416-0.87,0.929c0,0.083,0.024,0.156,0.043,0.232l-1.483,2.217
+	c-0.366-0.188-0.772-0.302-1.205-0.302c-0.386,0-0.754,0.083-1.089,0.233l-1.439-2.152c0.018-0.075,0.043-0.148,0.043-0.229
+	c0-0.513-0.39-0.929-0.869-0.929c-0.481,0-0.87,0.416-0.87,0.929c0,0.514,0.389,0.929,0.87,0.929c0.152,0,0.288-0.053,0.412-0.127
+	l1.056,2.139c-0.556,0.546-0.909,1.321-0.909,2.19c0,0.468,0.11,0.905,0.29,1.298c-1.494-0.477-5.134-1.447-6.041,0.129
+	c0,0,0.048,0.571-2.866,1.128c-1.886,0.36-1.775,0.868-2.961,1.236c-1.056,0.327-2.309,0.451-3.354,0.411
+	c-0.923-0.035-1.595-0.411-1.595-0.411s0.822,1.838,1.705,2.757c0.883,0.922,1.736,1.347,3.521,1.468
+	c1.466,0.098,2.474-0.469,5.004-0.527c2.404-0.058,4.288,0.881,6.379-0.47c1.938-1.253,2.698-3.327,3.433-4.129
+	c0.009-0.01,0.016-0.02,0.024-0.028c1.182-0.35,2.053-1.492,2.053-2.862c0-0.813-0.306-1.548-0.799-2.086l1.104-2.243
+	c0.125,0.074,0.261,0.126,0.414,0.126c0.479,0,0.868-0.416,0.868-0.929C26.309,7.862,25.92,7.446,25.441,7.446z"/>
+<path stroke="#FFFFFF" stroke-width="1.3673" stroke-linecap="round" d="M9.064,14.172c0,0,0.109-0.924,1.049-0.804
+	c0.94,0.118,1.326,0.981,1.03,1.855c-0.295,0.874-1.908,1.576-2.96,0.323c-1.047-1.251-0.032-3.69,1.692-3.962
+	c1.645-0.262,4.354,1.304,3.079,4.761c-1.272,3.437-6.619,2.989-8.05-1.012C3.287,10.804,9.022,4.111,15.409,8.16
+	c2.151,1.361,3.704,4.399,3.418,7.09c0,0-2.588,2.671-5.529-0.062"/>
+<g>
+	<path stroke="#FFFFFF" stroke-width="0.6381" stroke-linecap="round" d="M9.064,14.172c0,0,0.109-0.924,1.049-0.804
+		c0.94,0.118,1.326,0.981,1.03,1.855c-0.295,0.874-1.908,1.576-2.96,0.323c-1.047-1.251-0.032-3.69,1.692-3.962
+		c1.645-0.262,4.354,1.304,3.079,4.761c-1.272,3.437-6.619,2.989-8.05-1.012C3.287,10.804,9.022,4.111,15.409,8.16
+		c2.151,1.361,3.704,4.399,3.418,7.09c0,0-2.588,2.671-5.529-0.062"/>
+	<path fill="#FFFFFF" d="M18.081,11.816c0,0-1.388,1.815-3.576,0.875c-1.278-0.549-1.806,0.522-1.806,0.522l-0.312-0.773
+		c0,0,1.079-0.61,2.578-0.755c1.503-0.149,2.238-0.384,2.395-1.102C17.513,9.867,18.754,11.488,18.081,11.816z"/>
+	<path fill="#FFFFFF" d="M14.095,7.419c0,0-0.741,2.503-2.012,2.82c-1.27,0.32-0.849,1.612-0.849,1.612l-0.425-0.254
+		c0,0-0.019-1.353,0.89-2.297c0.91-0.943,1.244-1.686,0.861-2.209C12.175,6.568,14.325,6.838,14.095,7.419z"/>
+	<path fill="#FFFFFF" d="M7.772,8.163c0.382,0.706,0.523,0.996,1.317,3.229c0.213,0.601-0.23,0.63-0.23,0.63
+		S7.594,9.568,6.879,9.303C6.163,9.035,7.772,8.163,7.772,8.163z"/>
+	<path fill="#FFFFFF" d="M4.823,12.114c0,0,0.877,0.322,1.458,0.497c0.58,0.179,1.446,1.083,1.446,1.083s-2.319-0.707-2.946-0.253
+		C4.152,13.89,4.823,12.114,4.823,12.114z"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/group/ManualVideoEditorUi.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+#include <data_caging_paths.hrh>
+#include "../../Group/buildconfig.hrh"
+
+#if defined( __DEBUG_ON__ )
+MACRO           DEBUG_ON
+#endif
+#if defined( __DEBUG_ON_ALWAYS__ )
+MACRO           DEBUG_ON_ALWAYS
+#endif
+#if defined(__DEBUG_ON__) || defined(__DEBUG_ON_ALWAYS__)
+LIBRARY         flogger.lib
+#endif
+
+#if defined (__GET_PAUSE_THUMBNAIL__)
+MACRO           GET_PAUSE_THUMBNAIL
+#endif
+
+TARGET  ManualVideoEditor.exe
+TARGETTYPE  exe
+UID    0x100039CE 0x10208A29
+CAPABILITY CAP_APPLICATION MultiMediaDD
+SECUREID         0x10208A29
+VENDORID        VID_DEFAULT
+
+EPOCSTACKSIZE 0x8000
+EPOCHEAPSIZE 0x100000 0x1600000
+
+SOURCEPATH ../src
+SOURCE  VeiApp.cpp 
+SOURCE  VeiAppUi.cpp
+SOURCE  VeiDocument.cpp
+SOURCE  VeiEditVideoContainer.cpp
+SOURCE  VeiEditVideoView.cpp
+SOURCE  VeiSettingsView.cpp
+SOURCE  VeiSettingsContainer.cpp
+SOURCE  VeiCutVideoView.cpp
+SOURCE  VeiCutVideoContainer.cpp
+SOURCE  VeiCutAudioView.cpp
+SOURCE  VeiCutAudioContainer.cpp
+SOURCE  VeiSettingItemList.cpp
+SOURCE  FileNameSettingItem.cpp
+SOURCE	VeiTrimForMmsView.cpp
+SOURCE	VeiTrimForMmsContainer.cpp
+SOURCE  VeiIconBox.cpp
+SOURCE  VeiPopup.cpp
+SOURCE  SampleArrayHandler.cpp
+SOURCE  StoryboardItems.cpp
+SOURCE  TransitionInfo.cpp
+
+START RESOURCE ../data/ManualVideoEditor.rss
+HEADER 
+TARGETPATH APP_RESOURCE_DIR 
+LANG	sc
+END
+
+START RESOURCE ../data/Manualvideoeditor_reg.rss
+DEPENDS manualvideoeditor.rsg
+TARGETPATH /private/10003a3f/apps
+END
+
+
+USERINCLUDE .
+USERINCLUDE ../inc
+USERINCLUDE ../../VideoEditorCommon/inc
+USERINCLUDE ../../VideoEditorUiComponents/inc
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE   . 
+SYSTEMINCLUDE	/epoc32/include/ECom
+SYSTEMINCLUDE   /epoc32/include/mda/client
+SYSTEMINCLUDE   /epoc32/include/mmf/server
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+
+LIBRARY aknicon.lib
+LIBRARY AknLayout2.lib
+LIBRARY aknlayout2adaptation.lib
+LIBRARY aknlayout2scalable.lib
+LIBRARY aknskins.lib
+LIBRARY apgrfx.lib
+LIBRARY apparc.lib 
+LIBRARY avkon.lib 
+LIBRARY bafl.lib
+LIBRARY bitgdi.lib
+LIBRARY BitmapTransforms.lib
+LIBRARY bmpanim.lib
+LIBRARY cdlengine.lib
+LIBRARY charconv.lib
+LIBRARY CommonDialogs.lib
+LIBRARY commonengine.lib		//StringLoader
+LIBRARY commonui.lib		//Globalerror
+LIBRARY cone.lib 
+LIBRARY efsrv.lib 
+LIBRARY egul.lib 
+LIBRARY eikcoctl.lib 
+LIBRARY eikcore.lib 
+LIBRARY eikctl.lib
+LIBRARY estor.lib			//FOR settings view rreadstream
+LIBRARY euser.lib 
+LIBRARY fbscli.lib 
+LIBRARY gdi.lib
+LIBRARY hlplch.lib
+LIBRARY ImageConversion.lib	 //image conversion
+LIBRARY MediaClientAudio.lib
+LIBRARY MGFetch.lib
+LIBRARY mmfserverbaseclasses.lib		// Wav to AMR conversion
+LIBRARY PlatformEnv.lib		//volume settings, pathinfos
+LIBRARY SendUi.lib
+LIBRARY servicehandler.lib
+LIBRARY sysutil.lib
+LIBRARY VedEngine.lib
+LIBRARY VideoEditorCommon.lib
+LIBRARY VideoEditorUiComponents.lib
+LIBRARY ws32.lib
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Build information file for Build Manual Video Editor.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../../Group/buildconfig.hrh"
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+// Exported headers
+PRJ_EXPORTS
+../rom/ManualVideoEditor.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(ManualVideoEditor.iby)
+../rom/ManualVideoEditor_resource.iby  LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(ManualVideoEditor_resource.iby)
+
+// ROM build files
+PRJ_MMPFILES
+gnumakefile ../data/icons.mk
+gnumakefile ../data/icons_aif_scalable.mk
+../group/ManualVideoEditorUI.mmp
+
+PRJ_TESTMMPFILES
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/FileNameSettingItem.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __FILENAMESETTINGITEM_H__
+#define __FILENAMESETTINGITEM_H__
+
+//  INCLUDES
+#include <aknsettingitemlist.h>
+
+// CONSTANTS
+_LIT( KCharColon, ":" ); // Illegal character for filename.
+const TText KCharDot = '.'; // Dot character.
+
+// CLASS DECLARATION
+
+/**
+ * Custom setting item for filename. Filename validity is checked.
+ */
+class CFileNameSettingItem: public CAknTextSettingItem
+{
+public:
+    // Constructor and destructor
+
+    /**
+     * Constructor. 
+     *
+     * @param aIdentifier Resource identifier for this setting item.
+     * @param aText Setting text.
+     * @param aIllegalFilenameTextResourceID Resource identifier for 
+     *        warning note text.
+     * @param aUnsuitableFilenameTextResourceID Resource identifier for
+     *        warning note text.
+     */
+    CFileNameSettingItem( TInt aIdentifier, 
+                          TDes& aText, 
+                          TInt aIllegalFilenameTextResourceID, 
+                          TInt aUnsuitableFilenameTextResourceID );
+
+    /**
+     * Destructor.
+     */
+    ~CFileNameSettingItem();
+
+public:
+    // Functions from base classes
+
+    /**
+     * From <code>MAknSettingPageObserver</code>, handles events reported
+     * by the setting page.
+     *
+     * @param aSettingPage Notified setting page.
+     * @param aEventType Occured event type.
+     */
+    void HandleSettingPageEventL( CAknSettingPage* aSettingPage,
+                                 TAknSettingPageEvent aEventType );
+
+    /**
+     * From <code>CAknTextSettingItem</code>, this launches the setting
+     * page for text editing.
+     *
+     * @param aCalledFromMenu Ignored in this and under laying
+     *        <code>CAknTextSettingItem</code> class.
+     */
+    void EditItemL( TBool aCalledFromMenu );
+
+private:
+    // Data
+
+    /**
+     * The text in editor before editing is started.
+     */
+    HBufC* iTextBeforeEditing;
+
+    /**
+     * Indicates whether ok is pressed and the file name is incorrect.
+     */
+    TBool iInvalidFilenameOked;
+
+    /**
+     * Resource identifier for illegal file name string.
+     */
+    TInt iIllegalFilenameTextResourceID;
+
+    /**
+     * Resource identifier for unsuitable file name string.
+     */
+    TInt iUnsuitableFilenameTextResourceID;
+
+};
+#endif // __FILENAMESETTINGITEM_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/ManualVideoEditor.hrh	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef MANUALVIDEOEDITOR_HRH
+#define MANUALVIDEOEDITOR_HRH
+
+enum TVeijoCommandIds
+    {
+    EVeiCmdHelp = 1,
+/* Cut video */
+    EVeiCmdCutVideoViewPlay,
+    EVeiCmdCutVideoViewPlayMarked,
+    EVeiCmdCutVideoViewClearMarks,
+    EVeiCmdCutVideoViewClearMarksIn,
+    EVeiCmdCutVideoViewClearMarksOut,
+    EVeiCmdCutVideoViewClearMarksInOut,
+    EVeiCmdCutVideoViewHelp,
+    EVeiCmdCutVideoViewBack,
+    EVeiCmdCutVideoViewDone, // 10
+    EVeiCmdCutVideoViewMarkIn,
+    EVeiCmdCutVideoViewMarkOut,
+    EVeiCmdCutVideoViewContinue,
+    EVeiCmdCutVideoViewStop,
+    EVeiCmdCutVideoVolumeDown,
+    EVeiCmdCutVideoVolumeUp,
+    EVeiCmdCutVideoTakeSnapshot,
+    EVeiCmdPlayPreview,
+    EVeiCmdSettingsViewBack,
+    EVeiCmdPlayViewPause, // 20
+    EVeiCmdPlayViewStop,
+    EVeiCmdEditVideoViewPreview,
+    EVeiCmdEditVideoViewTrimForMms,
+    EVeiCmdEditVideoViewPreviewLarge,
+    EVeiCmdEditVideoViewPreviewSmall,
+    EVeiCmdEditVideoViewMovie,
+    EVeiCmdEditVideoViewInsert,
+    EVeiCmdEditVideoViewSettings,
+    EVeiCmdEditVideoViewInsertVideo,
+    EVeiCmdEditVideoViewInsertAudio, // 30
+    EVeiCmdEditVideoViewInsertImage,
+    EVeiCmdEditVideoViewInsertText,	
+/* Insert Title*/
+    EVeiCmdEditVideoViewInsertTextTitle,
+    EVeiCmdEditVideoViewInsertTextTitleFading,
+    EVeiCmdEditVideoViewInsertTextSubTitle,
+    EVeiCmdEditVideoViewInsertTextSubTitleFading,
+    EVeiCmdEditVideoViewInsertTextCredits,
+    EVeiCmdEditVideoViewInsertTitleScreen,	
+/* Edit Text */
+    EVeiCmdEditVideoViewEditText,
+    EVeiCmdEditVideoViewEditTextMove, // 40
+    EVeiCmdEditVideoViewEditTextRemove,
+    EVeiCmdEditVideoViewEditTextChangeDuration,
+    EVeiCmdEditVideoViewEditTextChangeText,
+    EVeiCmdEditVideoViewEditTextSetTextColor,
+    EVeiCmdEditVideoViewEditTextSetBackGround,
+    EVeiCmdEditVideoViewEditTextStyle,
+    EVeiCmdEditVideoViewEditTextAddColorEffect,
+    EVeiCmdEditVideoViewEditTextDuplicate,
+    EVeiCmdEditVideoViewEditTextStyleTitle,
+    EVeiCmdEditVideoViewEditTextStyleTitleFading, // 50
+    EVeiCmdEditVideoViewEditTextStyleSubTitle,
+    EVeiCmdEditVideoViewEditTextStyleSubTitleFading,
+    EVeiCmdEditVideoViewEditTextStyleCredit,
+/* Edit Image*/
+    EVeiCmdEditVideoViewEditImage,
+    EVeiCmdEditVideoViewEditImageMove,
+    EVeiCmdEditVideoViewEditImageRemove,
+    EVeiCmdEditVideoViewEditImageChangeDuration,
+    EVeiCmdEditVideoViewEditImageBackGround,
+    EVeiCmdEditVideoViewEditImageAddColorEffect,	
+    EVeiCmdEditVideoViewEditImageDuplicate,	// 60	
+    EVeiTitleScreenTextQuery,
+    EVeiCmdEditVideoViewInsertNewAudio,
+    EVeiCmdEditVideoViewRecord,
+    EVeiCmdEditVideoViewRecordCancel,
+    EVeiCmdEditVideoViewRecordStop,
+    EVeiCmdEditVideoViewRecordPause,
+    EVeiCmdEditVideoViewContinue,
+/* Edit Video */
+    EVeiCmdEditVideoViewEditVideo,
+    EVeiCmdEditVideoViewEditVideoMove,
+    EVeiCmdEditVideoViewEditVideoCutting, // 70
+    EVeiCmdEditVideoViewEditVideoColorEffect,
+    EVeiCmdEditVideoViewEditVideoSlowMotion,
+    EVeiCmdEditVideoViewEditVideoMute,
+    EVeiCmdEditVideoViewEditVideoUnmute,
+    EVeiCmdEditVideoViewEditVideoRemove,
+    EVeiCmdAddVideoClipMem,
+    EVeiCmdSendMovie,
+    EVeiCmdEditVideoDuplicate,
+/* Edit Audio */
+    EVeiCmdEditVideoViewEditAudio,
+    EVeiCmdEditVideoViewEditAudioMove, // 80
+    EVeiCmdEditVideoViewEditAudioDuration,
+    EVeiCmdEditVideoViewEditAudioRemove,
+    EVeiCmdEditVideoViewEditAudioSetDuration,
+/* Transition */
+    EVeiCmdEditVideoViewEditStartTransition,
+    EVeiCmdEditVideoViewEditMiddleTransition,
+    EVeiCmdEditVideoViewEditEndTransition,
+    EVeiCmdEditVideoViewTransitionNone,
+    EVeiCmdEditVideoViewTransitionFadeFromBlack,
+    EVeiCmdEditVideoViewTransitionFadeFromWhite,
+    EVeiCmdEditVideoViewTransitionDipToBlack, // 90
+    EVeiCmdEditVideoViewTransitionDipToWhite,
+    EVeiCmdEditVideoViewTransitionFadeToBlack,
+    EVeiCmdEditVideoViewTransitionFadeToWhite,
+    EVeiCmdEditVideoViewTransitionWipeFromLeft,
+    EVeiCmdEditVideoViewTransitionWipeFromRight,
+    EVeiCmdEditVideoViewTransitionWipeFromTop,
+    EVeiCmdEditVideoViewTransitionWipeFromBottom,
+    EVeiCmdEditVideoViewTransitionCrossfade,
+    EVeiCmdEditVideoViewTransitionKeyUp,
+    EVeiCmdEditVideoViewTransitionKeyDown, // 100
+    EVeiCmdEditVideoViewSaveTo,
+    EVeiCmdEditVideoMixAudio,
+    EVeiCmdEditVideoMixAudioCancel,
+    EVeiCmdEditVideoAdjustVolume,
+    EVeiCmdEditVideoViewHelp,
+    EVeiCmdEditVideoViewSend,
+    EVeiCmdEditVideoViewContainerShowMenu,
+    EVeiCmdCutAudioViewHelp,
+/* Settings View */
+    EVeiCmdSettingsViewChange,
+    EVeiCmdSettingsViewHelp, // 110
+/* Trim for MMS view */
+    EVeiCmdSendViaMms,
+    EVeiCmdPreview,
+    EVeiCmdTrimForMmsViewHelp
+    };
+
+
+ // Video Editor view IDs.
+enum TVeiViewIds
+    {
+    EVeiCutVideoView,
+    EVeiEditVideoView,
+    EVeiSettingsView,
+    EVeiTrimForMmsView,
+    EVeiCutAudioView
+    };
+ 
+ // Setting items
+ enum TVeiSettingItems
+    {
+    EVeiVideoNameSettingItem,
+    EVeiSnapshotNameSettingItem,
+    EVeiMemoryInUseSettingItem,
+    EVeiSaveQualitySettingItem
+    };
+
+#endif      
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/SampleArrayHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEISAMPLE_ARRAY_HANDLER_H
+#define VEISAMPLE_ARRAY_HANDLER_H
+
+#include <e32base.h>
+/**
+ * CSampleArrayHandler container control class.
+ *  
+ * Container for CVeiCutAudioView.
+ */
+class CSampleArrayHandler: public CBase
+{
+public:
+    /**
+     * Creates a CStoryboardContainer object, which will draw itself to aRect.
+     *
+     * @param aRect Frame rectangle for container.
+     * @param aMovie  movie being edited
+     *
+     * @return a pointer to the created instance of CStoryboardContainer
+     */
+    static CSampleArrayHandler* NewL();
+
+    /**  
+     * Creates a CStoryboardContainer object, which will draw itself to aRect.
+     * Leaves the created object in the cleanup stack.
+     *
+     * @param aRect Frame rectangle for container.
+     * @param aMovie  movie being edited
+     *
+     * @return a pointer to the created instance of CStoryboardContainer
+     */
+    static CSampleArrayHandler* NewLC();
+
+    /**
+     * Default constructor.
+     *
+     * @param aRect  Frame rectangle for container.
+     * @param aView  pointer to the view.
+     */
+    void ConstructL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CSampleArrayHandler();
+
+public:
+
+    void SetVisualizationArray( TInt8* aVisualization, TInt aResolution );
+
+    TInt8 Sample( const TInt aIndex )const;
+    void ScaleAudioVisualization( const TInt8& aHeight );
+    TInt Size()const;
+    TInt CurrentPoint()const;
+    void SetCurrentPoint( const TTimeIntervalMicroSeconds& aTime );
+    void SetCutInPoint( const TTimeIntervalMicroSeconds& aCutInTime );
+    void SetCutOutPoint( const TTimeIntervalMicroSeconds& aCutOutTime );
+    TBool SampleCutted( const TInt aIndex )const;
+
+private:
+
+    /**
+     * Constructor.
+     *
+     * @param -
+     */
+    CSampleArrayHandler();
+
+private:
+    //data
+
+    TInt8* iVisualization;
+    TInt iVisualizationSize;
+    TInt8 iMaxSample;
+    TInt8 iMaxSampleInCurrentScale;
+    TReal iScaleFactor;
+
+    TTimeIntervalMicroSeconds iCurrentTime;
+    TTimeIntervalMicroSeconds iCutInTime;
+    TTimeIntervalMicroSeconds iCutOutTime;
+
+    TInt iCurrentIndex;
+    TInt iCutInSampleIndex;
+    TInt iCutOutSampleIndex;
+
+    TInt iMarkOutCounter;
+    TInt iMarkInCounter;
+
+    TInt iPreviousScreenMode;
+    TInt iCurrentScreenMode;
+
+    TTimeIntervalMicroSeconds iMarkedInTime;
+    TTimeIntervalMicroSeconds iMarkedOutTime;
+};
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/StoryboardItems.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef STORYBOARDITEMS_H
+#define STORYBOARDITEMS_H
+
+#include <e32std.h>
+
+class CFbsBitmap;
+
+
+/**
+ * Storyboard video item
+ */
+class CStoryboardVideoItem: public CBase
+{
+public:
+    static CStoryboardVideoItem* NewL( const CFbsBitmap& aStartIcon, 
+                                       const CFbsBitmap& aStartIconMask,
+                                       const TDesC& aFilename,
+                                       TBool aIsFile,
+                                       const TDesC& aAlbum = KNullDesC );
+
+    static CStoryboardVideoItem* NewLC( const CFbsBitmap& aStartIcon, 
+                                        const CFbsBitmap& aStartIconMask,
+                                        const TDesC& aFilename,
+                                        TBool aIsFile,
+                                        const TDesC& aAlbum = KNullDesC );
+
+    virtual ~CStoryboardVideoItem();
+    void InsertLastFrameL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask );
+    void InsertFirstFrameL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask );
+    void InsertTimelineFrameL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask );
+
+    CStoryboardVideoItem();
+private:
+
+    void ConstructL( const CFbsBitmap& aStartIcon, 
+                     const CFbsBitmap& aStartIconMask,
+                     const TDesC& aFilename,
+                     TBool aIsFile,
+                     const TDesC& aAlbum );
+
+
+
+public:
+    CFbsBitmap* iIconBitmap;
+    CFbsBitmap* iIconMask;
+
+    CFbsBitmap* iLastFrameBitmap;
+    CFbsBitmap* iLastFrameMask;
+
+    CFbsBitmap* iTimelineBitmap;
+    CFbsBitmap* iTimelineMask;
+
+    TSize iIconSize;
+    HBufC* iFilename;
+    HBufC* iAlbumName;
+    TBool iIsFile;
+    TTime iDateModified;
+};
+
+/**
+ * Storyboard audio item.
+ */
+class CStoryboardAudioItem: public CBase
+{
+public:
+    static CStoryboardAudioItem* NewLC( TBool aRecordedAudio, 
+                                        const TDesC& aFilename );
+    virtual ~CStoryboardAudioItem();
+
+private:
+    CStoryboardAudioItem( TBool aRecordedAudio );
+    void ConstructL( const TDesC& aFilename );
+
+public:
+    TBool iRecordedAudio;
+    HBufC* iFilename;
+};
+
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/TransitionInfo.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef TRANSITIONINFO_H
+#define TRANSITIONINFO_H
+
+#include <e32std.h>
+#include <VedVideoClipInfo.h>
+
+
+/**
+ * Transition info.	
+ */
+class CTransitionInfo: public CBase
+{
+public:
+    /* Constructors & Destructor. */
+    static CTransitionInfo* NewL();
+    static CTransitionInfo* NewLC();
+    virtual ~CTransitionInfo();
+
+    /* 
+     * Methods for querying transition icons and names. The icons and
+     * names are NOT to be deleted by the caller.
+     */
+    HBufC* StartTransitionName( TVedStartTransitionEffect aEffect );
+    HBufC* MiddleTransitionName( TVedMiddleTransitionEffect aEffect );
+    HBufC* EndTransitionName( TVedEndTransitionEffect aEffect );
+
+private:
+    /* Private constructors. */
+    void ConstructL();
+    CTransitionInfo();
+
+private:
+    /* Data. */
+    RPointerArray < HBufC > iStartTransitionNameArray;
+    RPointerArray < HBufC > iMiddleTransitionNameArray;
+    RPointerArray < HBufC > iEndTransitionNameArray;
+};
+
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiApp.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef VEDAPP_H
+#define VEDAPP_H
+
+// INCLUDES
+// System includes
+#include <aknapp.h>
+
+// CLASS DECLARATION
+
+/**
+ * CVeiApp application class.
+ * Provides factory to create concrete document object.
+ */
+class CVeiApp: public CAknApplication
+{
+
+public:
+private:
+    // Functions from base classes
+
+    /**
+     * From CApaApplication, creates CVeiDocument document object.
+     * @return A pointer to the created document object.
+     */
+    CApaDocument* CreateDocumentL();
+
+    /**
+     * From CApaApplication, returns application's UID (KUidveijo).
+     * @return The value of KUidveijo.
+     */
+    TUid AppDllUid()const;
+
+    CDictionaryStore* OpenIniFileLC( RFs& aFs )const;
+
+};
+
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiAppUi.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef VEDAPPUI_H
+#define VEDAPPUI_H
+
+// INCLUDES
+// System includes
+#include <eikapp.h>
+#include <eikdoc.h>
+#include <e32std.h>
+#include <coeccntx.h>
+#include <aknviewappui.h>
+#include <akntabgrp.h>
+#include <aknnavide.h>
+#include <MMGXFileNotificationObserver.h>
+// User includes
+#include "VeiSettingsView.h"
+#include "VideoEditorDebugUtils.h"
+
+// FORWARD DECLARATIONS
+class CVeiSettingsView;
+class CVeiEditVideoView;
+class CVeiCutVideoView;
+class CVeiSettingsView;
+class CVeiCutAudioView;
+class CVeiTrimForMmsView;
+class CSendUi;
+class CEikAppUi;
+class CMGXFileNotificationHandler;
+
+/**
+ * Application UI class.
+ * Provides support for the following features:
+ * - EIKON control architecture
+ * - view architecture
+ * - status pane
+ * 
+ */
+class CVeiAppUi: public CAknViewAppUi,
+                 public MMGXFileNotificationObserver
+{
+public:
+    // // Constructors and destructor
+
+    /**
+     * Default constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Destructor.
+     */
+    ~CVeiAppUi();
+
+public:
+    // New functions
+    inline TInt GetVolumeLevel() { return iVolume; };
+		
+    inline void SetVolumeLevel( TInt aVolume ) { iVolume=aVolume; };
+
+    void InsertVideoClipToMovieL( TBool aDoOpen, const TDesC& aFilename );
+
+    CVeiAppUi();
+
+    /**	HandleError
+     *
+     *   @CAknAppUi
+     */
+    virtual TErrorHandlerResponse HandleError( TInt aError,
+                                               const SExtendedError& aExtErr,
+                                               TDes& aErrorText,
+                                               TDes& aContextText );
+
+    /**
+     * Reads application settings data from ini-file. 
+     *
+     * @param aSettings Settings data where values are read.
+     */
+    void ReadSettingsL( TVeiSettings& aSettings )const;
+
+    /**
+     * Writes application settings data to ini-file.
+     *
+     * @param aSettings Settings data where values are written.
+     */
+    void WriteSettingsL( const TVeiSettings& aSettings )const;
+
+    inline TBool AppIsOnTheWayToDestruction() { return iOnTheWayToDestruction; };
+
+private:
+    /**
+     * From CEikAppUi, takes care of command handling.
+     * @param aCommand command to be handled
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * From CEikAppUi, handles key events.
+     * @param aKeyEvent Event to handled.
+     * @param aType Type of the key event. 
+     * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). 
+     */
+    virtual TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CAknAppUiBase.   
+     * Calls CAknViewAppUi::HandleScreenDeviceChangedL().
+     */
+    virtual void HandleScreenDeviceChangedL();
+
+    /**
+     * From @c CEikAppUi. Handles a change to the application's resources which
+     * are shared across the environment. This function calls 
+     * @param aType The type of resources that have changed. 
+     */
+    virtual void HandleResourceChangeL( TInt aType );
+
+    /** 
+     * From CAknAppUi, HandleForegroundEventL( TBool aForeground )
+     * @param aForeground
+     */
+    virtual void HandleForegroundEventL( TBool aForeground );
+
+    // From MMGXFileNotificationObserver
+    virtual void HandleFileNotificationEventL();
+
+private:
+    //Data
+
+    CVeiEditVideoView* iEditVideoView;
+
+    CVeiSettingsView* iSettingsView;
+
+    CVeiCutVideoView* iCutVideoView;
+
+    CVeiCutAudioView* iCutAudioView;
+
+    CMGXFileNotificationHandler* iFileNotificationHandler;
+
+    /**
+     * Trim for MMS view.
+     */
+    CVeiTrimForMmsView* iTrimForMmsView;
+
+    /**
+     * Common volume setting.
+     */
+    TInt iVolume;
+
+    /**
+     * Send UI, MMS/Infrared/BT
+     */
+    CSendUi* iSendAppUi;
+
+    TProcessPriority iOriginalProcessPriority;
+    TBool iProcessPriorityAltered;
+
+    TBool iOnTheWayToDestruction;
+};
+
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiCutAudioContainer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,541 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEICUTAUDIOCONTAINER_H
+#define VEICUTAUDIOCONTAINER_H
+
+#include <coecntrl.h>
+#include <aknprogressdialog.h> 
+#include <VideoPlayer.h>
+#include <VedCommon.h>
+#include <VedMovie.h>
+#include <MdaAudioSamplePlayer.h>
+#include <VedAudioClipInfo.h>
+
+#include "VeiRemConTarget.h"
+
+class CVeiCutAudioView;
+class CVeiCutterBar;
+class CAknsBasicBackgroundControlContext;
+class CVeiErrorUI;
+class CVeiTextDisplay;
+class CSampleArrayHandler;
+
+
+const TInt KMinCutAudioVolumeLevel = 1;
+const TInt KMaxCutAudioVolumeLevel = 10;
+
+/**
+ * CVeiCutAudioContainer container control class.
+ *  
+ * Container for CVeiCutAudioView.
+ */
+class CVeiCutAudioContainer: public CCoeControl, 
+                             public MCoeControlObserver,
+                             public MMdaAudioPlayerCallback,
+                             public MVedAudioClipVisualizationObserver, 
+                             public MProgressDialogCallback,
+                             public MVeiMediakeyObserver
+{
+public:
+    /**
+     * Edit state.
+     */
+    enum TCutAudioState
+    {
+        EStateInitializing = 1,
+        EStateOpening,
+        EStateStoppedInitial,
+        EStateStopped,
+        EStatePlaying,
+        EStatePlayingMenuOpen,
+        EStatePaused,
+        EStateTerminating
+    };
+
+    enum TMarkState
+    {
+        ENoMark = 0,
+        EMarked			
+    };
+    
+    
+			
+    /**
+     * Start or end mark.
+     */
+    enum TCutMark
+    {
+        ENoMarks,
+        EStartMark,
+        EEndMark
+    };
+			
+
+        
+public:
+    /**
+     * Creates a CStoryboardContainer object, which will draw itself to aRect.
+     *
+     * @param aRect Frame rectangle for container.
+     * @param aMovie  movie being edited
+     *
+     * @return a pointer to the created instance of CStoryboardContainer
+     */
+    static CVeiCutAudioContainer* NewL( const TRect& aRect, 
+                                        CVeiCutAudioView& aView, 
+                                        CVeiErrorUI& aErrorUI );
+
+    /**  
+     * Creates a CStoryboardContainer object, which will draw itself to aRect.
+     * Leaves the created object in the cleanup stack.
+     *
+     * @param aRect Frame rectangle for container.
+     * @param aMovie  movie being edited
+     *
+     * @return a pointer to the created instance of CStoryboardContainer
+     */
+    static CVeiCutAudioContainer* NewLC( const TRect& aRect, 
+                                         CVeiCutAudioView& aView, 
+                                         CVeiErrorUI& aErrorUI );
+
+    /**
+     * Default constructor.
+     *
+     * @param aRect  Frame rectangle for container.
+     * @param aView  pointer to the view.
+     */
+    void ConstructL( const TRect& aRect, 
+                     CVeiCutAudioView& aView, 
+                     CVeiErrorUI& aErrorUI );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVeiCutAudioContainer();
+
+public:
+    void OpenAudioFileL( const TDesC& aFileName );
+
+    /**
+     * ###Missin' description###
+     *
+     * @param aState
+     */
+    void SetStateL( CVeiCutAudioContainer::TCutAudioState aState );
+    /**
+     * Starts playing.
+     *
+     * @param aStartTime
+     */
+    void PlayL( const TTimeIntervalMicroSeconds& aStartTime = TTimeIntervalMicroSeconds( 0 ) );
+
+    /**
+     * Stops playing.
+     */
+    void StopL();
+
+    /**
+     * Pauses playing.
+     */
+    void PauseL();
+
+    /**
+     * Closes the stream.
+     */
+    void CloseStreamL();
+
+    /**
+     * Returns the playback position.
+     *
+     * @return  playback position
+     */
+    const TTimeIntervalMicroSeconds& PlaybackPositionL();
+
+    /**
+     * Marks the in point.
+     */
+    void MarkedInL();
+
+    /**
+     * Marks the out point.
+     */
+    void MarkedOutL();
+
+    /**
+     * Change volume level. Changes current volume level by given amount.
+     *
+     * @param aVolumeChange		volume change
+     */
+    void SetVolumeL( TInt aVolumeChange );
+
+    /**
+     * Sets cut in time to cut video bar.
+     *
+     * @param aTime	Cut in time
+     */
+    void SetInTimeL( const TTimeIntervalMicroSeconds& aTime );
+
+    /**
+     * Sets cut out time to cut video bar.
+     *
+     * @param aTime	Cut out time
+     */
+    void SetOutTimeL( const TTimeIntervalMicroSeconds& aTime );
+
+    /**
+     * Sets duration to cut video bar.
+     *
+     * @param aTime	duration
+     */
+    void SetDuration( const TTimeIntervalMicroSeconds& aDuration );
+
+public:
+    /**
+     * Update function that is called by the static callback method.
+     */
+    void DoUpdate();
+
+    /**
+     * From CCoeControl, OfferKeyEventL.
+     *
+     * @param aKeyEvent  key event
+     * @param aType  event code
+     */
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+    /**
+     * Returns total length of the video clip.
+     *
+     * @return  total length
+     */
+    const TTimeIntervalMicroSeconds& TotalLength();
+
+    /**
+     * Returns the player state.
+     *
+     * @return  player state
+     */
+    inline TCutAudioState State() { return iState; };
+    /**
+     * Returns current volume level.
+     *
+     * @return	volume level
+     */
+    inline TInt Volume() const { return iInternalVolume; };
+
+    /**
+     * Returns minimum volume level.
+     *
+     * @return	min volume level
+     */
+    inline TInt MinVolume() const { return 1; };
+
+    /**
+     * Returns maximum volume level.
+     *
+     * @return	max volume level
+     */
+    inline TInt MaxVolume()const { return iMaxVolume; };
+
+    /**
+     * Returns the visualization resolution.
+     *
+     * @return	The visualization resolution, i.e. the size of the sample array
+     */
+    TInt VisualizationResolution()const;
+
+    /**
+     * Prepares the control for termination; stops audio playback
+     * and sets the state to EStateTerminating.
+     * 
+     */
+    void PrepareForTerminationL();
+
+public:
+    virtual void NotifyAudioClipVisualizationStarted( const CVedAudioClipInfo& aInfo );
+
+    virtual void NotifyAudioClipVisualizationProgressed( const CVedAudioClipInfo& aInfo, 
+                                                         TInt aPercentage );
+    virtual void NotifyAudioClipVisualizationCompleted( const CVedAudioClipInfo& aInfo, 
+                                                        TInt aError, 
+                                                        TInt8* aVisualization,
+                                                        TInt aResolution);
+
+private:
+    /**
+     * Callback function for the timer.
+     *
+     * @param aThis  self pointer
+     *
+     * @return  dummy value
+     */
+    static TInt DoAudioBarUpdate( TAny* aThis );
+
+    /** 
+     * From MMdaAudioPlayerCallback
+     */
+    virtual void MapcInitComplete( TInt aError,
+                                   const TTimeIntervalMicroSeconds& aDuration );
+
+    virtual void MapcPlayComplete( TInt aError );
+
+    /**
+     * Time increment.
+     *
+     * @param aKeyCount number a key events
+     * @return time 
+     */
+    TInt TimeIncrement( TInt aKeyCount )const;
+
+    /**
+     * Constructor.
+     *
+     * @param aView	instance of cut audio view
+     * @param aErrorUI instance of CVeiErrorUI
+     */
+    CVeiCutAudioContainer( const TRect& aRect, 
+                           CVeiCutAudioView& aView, 
+                           CVeiErrorUI& aErrorUI );
+
+
+    /**
+     * Continue playing
+     */
+    void ResumeL();
+
+    /**
+     * Gets intra frame bitmap from video clip.
+     *
+     * @param aTime	intra frame time.
+     */
+    void GetThumbAtL( TTimeIntervalMicroSeconds aTime );
+
+    /**
+     * From CoeControl, MopSupplyObject.
+     *
+     * @param aId  
+     */
+    virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
+    /**
+     * From CoeControl, SizeChanged.
+     */
+    void SizeChanged();
+
+    /**
+     * From CoeControl, CountComponentControls.
+     * 
+     * @return  number of component controls in this control
+     */
+    TInt CountComponentControls()const;
+
+    /**
+     * From CCoeControl, ComponentControl.
+     *
+     * @param aIndex  index of the control to return
+     */
+    CCoeControl* ComponentControl( TInt aIndex )const;
+
+    /**
+     * From CCoeControl,Draw.
+     *
+     * @param aRect  region of the control to be redrawn
+     */
+    void Draw( const TRect& aRect )const;
+
+    /**
+     * From CCoeControl, gets the control's help context. Associates the
+     * control with a particular Help file and topic in a context sensitive
+     * application.
+     *
+     * @param aContext Control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext )const;
+
+    /**
+     * From CCoeControl, HandleControlEventL
+     */
+    void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
+
+    /**
+    * HandlePointerEventL
+    * Handles pen inputs
+    *
+    * @param aPointerEvent  pointer event
+    */
+    void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+
+    /**
+    * Handles progress bar touch events
+    * @param aPBRect Current progress bar rectangle 
+    * @param aPressedPoint The x coordinate value that was pressed
+    * 			inside the progress bar
+    * @param aDragMarks ETrue if the user drags start or end marks.
+    *					EFalse otherwise
+    */
+    void HandleProgressBarTouchL( TRect aPBRect, TInt aPressedPoint, TBool aDragMarks, CVeiCutAudioContainer::TCutMark aCutMark = ENoMarks );
+
+
+
+    /**
+     * Update function that is called when visualization must be changed.
+     */
+    void UpdateVisualizationL();
+
+    /**
+     * Get the visualization data from the engine
+     */
+    void GetVisualizationL();
+
+    /**
+     * From MProgressDialogCallback
+     */
+    void DialogDismissedL( TInt aButtonId );
+
+    /** Callback function */
+    static TInt AsyncBack( TAny* aThis );
+
+    /**
+     * Propagate command to view's HandleCommandL
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * Draw the visualization, including background and indicators etc.
+     * to a bitmap, which can be blitted to the screen.
+     */
+    void DrawToBufBitmapL();
+
+    /**
+     * Start a progress note dialog
+     */
+    void LaunchProgressNoteL();
+
+    /**	HandleVolumeUpL 
+     *
+     *   @see MVeiMediakeyObserver
+     */
+    virtual void HandleVolumeUpL();
+
+    /**	HandleVolumeDownL 
+     *
+     *   @see MVeiMediakeyObserver
+     */
+    virtual void HandleVolumeDownL();
+
+private:
+    //data
+    /** cut video view */
+    CVeiCutAudioView& iView;
+
+    /** Error UI */
+    CVeiErrorUI& iErrorUI;
+
+    /** Current state. */
+    TCutAudioState iState;
+
+    /** Previous state. */
+    TCutAudioState iPrevState;
+
+    /** cut audio bar. */
+    CVeiCutterBar* iCutAudioBar;
+
+    /** Last position. */
+    TTimeIntervalMicroSeconds iLastPosition;
+
+    /** Video clip duration */
+    TTimeIntervalMicroSeconds iDuration;
+
+    /**
+     * Control context that provides a layout background with a 
+     * background bitmap and its layout rectangle.
+     */
+    CAknsBasicBackgroundControlContext* iBgContext;
+
+    /** Videoplayerutility volume */
+    TInt iInternalVolume;
+
+    /** Max volume */
+    TInt iMaxVolume;
+
+    /** Key repeat count in seek function. */
+    TInt iKeyRepeatCount;
+
+    /** Seek thumbnail position in video clip. */
+    TTimeIntervalMicroSeconds iSeekPos;
+
+    /** Seek - flag. */
+    TBool iSeeking;
+
+    /** Frame ready - flag */
+    TBool iFrameReady;
+
+    /** Last keycode, used in OfferKeyEventL(); */
+    TUint iLastKeyCode;
+
+    CFbsBitmap* iPauseBitmap;
+    CFbsBitmap* iPauseBitmapMask;
+
+    ///	Double buffer bitmap
+    CFbsBitmap* iBufBitmap;
+
+    CPeriodic* iVideoBarTimer;
+    CMdaAudioPlayerUtility* iAudioSamplePlayer;
+    TRect iCutTimeDisplayRect;
+    CVeiTextDisplay* iCutTimeDisplay;
+    TRect iIconDisplayRect;
+
+    CSampleArrayHandler* iSampleArrayHandler;
+
+    TInt iMarkOutCounter;
+    TInt iMarkInCounter;
+
+    TInt iPreviousScreenMode;
+    TInt iCurrentScreenMode;
+
+    TMarkState iMarkInState;
+    TMarkState iMarkOutState;
+
+    TTimeIntervalMicroSeconds iMarkedInTime;
+    TTimeIntervalMicroSeconds iMarkedOutTime;
+
+    /** Progress note. */
+    CAknProgressDialog* iProgressNote;
+
+    /** Callback utility */
+    CAsyncCallBack* iCallBack;
+
+    /** Remote connection API used to handle the volume keys. */
+    CVeiRemConTarget* iRemConTarget;
+    
+    /** ETrue if user is dragging the start or end mark with a pen,
+    	EFalse otherwise */
+    TBool iIsMarkDrag;
+
+    /** ETrue if the pen is in start or end mark area when it goes down,
+    	EFalse otherwise */		
+    TBool iIsMarkTapped;
+
+    /** Indicates which mark the user has tapped */						
+    TCutMark iTappedMark;    
+};
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiCutAudioView.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,361 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEICUTAUDIOVIEW_H
+#define VEICUTAUDIOVIEW_H
+
+
+#include <aknview.h>
+#include <VedMovie.h>
+#include <VedCommon.h>
+#include <utility.h>
+
+#include "VeiCutAudioContainer.h" 
+
+
+class CVeiCutAudioContainer;
+class CAknTitlePane;
+class CAknNavigationDecorator;
+class CAknNavigationControlContainer;
+class CPeriodic;
+class CMdaAudioRecorderUtility;
+class CMdaAudioType;
+class TMdaClipLocation;
+class CVeiErrorUI;
+
+/**
+ *  CVeiCutAudioView view class.
+ * 
+ */
+class CVeiCutAudioView: public CAknView
+{
+public:
+    // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CVeiCutAudioView* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CVeiCutAudioView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVeiCutAudioView();
+
+protected:
+
+    /** 
+     * From CAknView, HandleForegroundEventL( TBool aForeground )
+     *
+     * @param aForeground
+     */
+    virtual void HandleForegroundEventL( TBool aForeground );
+
+private:
+    // From CAknView
+
+    /**
+     * From CAknView, DynInitMenuPaneL.
+     *
+     * @param aResourceId  resource id
+     * @param aMenuPane  menu pane
+     */
+    void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+public:
+    /**
+     * From CAknView, Id.
+     *
+     * @return view id.
+     */
+    TUid Id()const;
+
+
+    CVeiCutAudioView();
+
+    /**
+     * Default constructor.
+     */
+    void ConstructL();
+
+    /**
+     * From CAknView, HandleCommandL(TInt aCommand);
+     *
+     * @param aCommand
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * Draws the time label navi.
+     */
+    void DrawTimeNaviL();
+
+    /**
+     * Clears the in and/or out points.
+     *
+     * @param aClearIn  whether to clear the in point
+     * @param aClearOut  whether to clear the out point
+     */
+    void ClearInOutL( TBool aClearIn, TBool aClearOut );
+
+    /**
+     * Sets the movie and index
+     *
+     * @param aVideoClip	movie name
+     * @param aIndex		index of the video clip in movie
+     */
+    void SetVideoClipAndIndex( CVedMovie& aVideoClip, TInt aIndex );
+
+    /**
+     * Sets the volume
+     *
+     * @param aVolume	Volume level.
+     */
+    void SetVolume( TInt aVolume );
+
+    /**
+     * Returns the cut out time.
+     *
+     * @return cut out time
+     */
+    TUint OutPointTime();
+
+    /**
+     * Returns the  cut in time.
+     *
+     * @return  cut in time
+     */
+    TUint InPointTime();
+
+    /**
+     * Changes the CBA (command button array) according to the edit
+     * state.
+     *
+     * @param aState  current state
+     */
+    void UpdateCBAL( TInt aState );
+
+    /**
+     * Updates the time label navi. This method is called by the
+     * static callback function.
+     */
+    void UpdateTimeL();
+
+    /**
+     * Starts the navi pane update, that is, the periodic timer.	
+     */
+    void StartNaviPaneUpdateL();
+
+    /**
+     * Stops the navi pane update.
+     */
+    void StopNaviPaneUpdateL();
+
+    /**
+     * Adjusts the volume up.
+     */
+    void VolumeUpL();
+
+    /**
+     * Adjusts the volume down.
+     */
+    void VolumeDownL();
+
+    /**
+     * Mutes the volume.
+     */
+    void VolumeMuteL();
+
+    /**
+     * Static callback function for hiding the volume indicator.
+     *
+     * @param aPtr  self pointer
+     *
+     * @return dummy value
+     */
+    static TInt HideVolumeCallbackL( TAny* aPtr );
+
+    /**
+     * Hides the volume indicator.
+     */
+    void HideVolume();
+
+    /**
+     * Gets visualization values.
+     */
+    void GetAudioVisualizationL();
+
+    /**
+     * Cancels visualization process.
+     */
+    void CancelVisualizationL();
+
+    /** Possible mark states */
+    enum TMarkState
+    {
+        EMarkStateIn,
+        EMarkStateOut,
+        EMarkStateInOut
+    };
+    
+    /**
+     *  
+     */
+    void HandleStatusPaneSizeChange();
+
+    /** Callback function */
+    static TInt AsyncOpenAudioFile( TAny* aThis );
+
+    /** 
+     * Handles a change to the control's resources.
+     */
+    void HandleResourceChange( TInt aType );
+
+    /**
+    * Moves the start or end mark when user drags them.
+    * 
+    * @param aPosition	position where the mark is moved to
+    * @param aMarkType  EStartMark or EEndMark
+    * @return -
+    */               
+    void MoveStartOrEndMarkL( TTimeIntervalMicroSeconds aPosition, CVeiCutAudioContainer::TCutMark aMarkType );
+		
+private:
+    /**
+     * Starts playing the clip. If the clip is paused, resumes 
+     * playing.
+     */
+    void PlayPreviewL();
+
+    /**
+     * Pauses the playback.
+     */
+    void PausePreviewL();
+
+    /**
+     * Plays the marked section of the clip.
+     */
+    void PlayMarkedL();
+
+    /**
+     * Marks the in point to the current point.
+     */
+    void MarkInL();
+
+    /**
+     * Marks the out point to the current point.
+     */
+    void MarkOutL();
+
+    /**
+     * Creates the time label navi. 
+     *
+     * @return  time label navi 
+     */
+    CAknNavigationDecorator* CreateTimeLabelNaviL();
+
+    /**
+     * Static callback function for the periodical timer that updates
+     * the time navi.
+     *
+     * @param aPtr  self pointer
+     *
+     * @return dummy value
+     */
+    static TInt UpdateTimeCallbackL( TAny* aPtr );
+
+    /**
+     * start processing the input file
+     */
+    void OpenAudioFileL();
+
+private:
+
+    /**
+     * From AknView, DoActivateL.
+     * 
+     * @param aPrevViewId  previous view id
+     * @param aCustomMessageId  custom message id
+     * @param aCustomMessage  custom message
+     */
+    void DoActivateL( const TVwsViewId& aPrevViewId, TUid aCustomMessageId,
+                     const TDesC8& aCustomMessage );
+
+    /**
+     * From AknView, DoDeactivate
+     */
+    void DoDeactivate();
+
+private:
+    // Data
+    /* cut video container	*/
+    CVeiCutAudioContainer* iContainer;
+
+    /* index of the video clip in the movie	*/
+    TUint iIndex;
+
+    /* movie */
+    CVedMovie* iMovie;
+
+    /** Time updater. */
+    CPeriodic* iTimeUpdater;
+
+    /** Pointer to the navi pane. */
+    CAknNavigationControlContainer* iNaviPane;
+
+    /** Time navi. */
+    CAknNavigationDecorator* iTimeNavi;
+
+    /** Volume hiding timer. */
+    CPeriodic* iVolumeHider;
+
+    /** Volume navi decorator. */
+    CAknNavigationDecorator* iVolumeNavi;
+
+    /** Popup menu state flag */
+    TBool iPopupMenuOpened;
+
+    /** Audio muted flag */
+    TBool iAudioMuted;
+
+    /** play marked flag */
+    TBool iPlayMarked;
+
+    /** current mark state */
+    TMarkState iMarkState;
+
+    /** Error number */
+    TInt iErrorNmb;
+
+    TTimeIntervalMicroSeconds iOriginalCutInTime;
+    /** Error UI */
+    CVeiErrorUI* iErrorUI;
+
+    /** Callback utility */
+    CAsyncCallBack* iCallBack;
+};
+
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiCutVideoContainer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,527 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef VEICUTVIDEOCONTAINER_H
+#define VEICUTVIDEOCONTAINER_H
+
+#include <coecntrl.h>
+#include <VideoPlayer.h>
+#include <VedCommon.h>
+#include <VedMovie.h>
+#include <aknprogressdialog.h> 
+
+#include "VeiVideoDisplay.h"
+#include "VeiImageConverter.h"
+#include "VeiRemConTarget.h"
+
+class CVeiCutVideoView;
+class CVeiCutterBar;
+class CAknsBasicBackgroundControlContext;
+class CVeiErrorUI;
+class CVeiVideoDisplay;
+class CVeiTextDisplay;
+
+const TInt KMinCutVideoVolumeLevel = 1;
+const TInt KVeiCutBarHeight = 20;
+const TInt KProgressbarFinalValue = 50;
+_LIT( KEncoderType, "JPEG" ); // encoder type for image conversion	
+
+/**
+ * CVeiCutVideoContainer container control class.
+ *  
+ * Container for CVeiCutVideoView.
+ */
+class CVeiCutVideoContainer: public CCoeControl,
+                             public MCoeControlObserver,
+                             public MVedVideoClipFrameObserver,
+                             public MVedVideoClipInfoObserver, 
+                             public MConverterController, 
+                             public MProgressDialogCallback,
+                             public MVeiVideoDisplayObserver,
+                             public MVeiMediakeyObserver
+{
+public:
+    /**
+     * Edit state.
+     */
+    enum TCutVideoState
+    {
+        EStateInitializing = 1,
+        EStateOpening,
+        EStateStoppedInitial,
+        EStateStopped,
+        EStatePlaying,
+        EStatePlayingMenuOpen,
+        EStatePaused,
+        EStateGettingFrame,
+        EStateBuffering,
+        EStateTerminating
+    };
+    
+			
+    /**
+     * Start or end mark.
+     */
+    enum TCutMark
+    {
+        ENoMark,
+        EStartMark,
+        EEndMark
+    };
+			
+
+    
+public:
+
+    /**
+     * Creates a CVeiCutVideoContainer object, which will draw itself to aRect.
+     *
+     * @param aRect Frame rectangle for container.
+     * @param aView 
+     *
+     * @return a pointer to the created instance of CStoryboardContainer
+     */
+    static CVeiCutVideoContainer* NewL( const TRect& aRect, 
+                                        CVeiCutVideoView& aView, 
+                                        CVeiErrorUI& aErrorUI );
+
+    /**  
+     * Creates a CVeiCutVideoContainer object, which will draw itself to aRect.
+     * Leaves the created object in the cleanup stack.
+     *
+     * @param aRect Frame rectangle for container.
+     * @param aMovie  movie being edited
+     *
+     * @return a pointer to the created instance of CStoryboardContainer
+     */
+    static CVeiCutVideoContainer* NewLC( const TRect& aRect, 
+                                         CVeiCutVideoView& aView, 
+                                         CVeiErrorUI& aErrorUI );
+
+    /**
+     * Default constructor.
+     *
+     * @param aRect  Frame rectangle for container.
+     * @param aView  pointer to the view.
+     */
+    void ConstructL( const TRect& aRect, 
+                     CVeiCutVideoView& aView, 
+                     CVeiErrorUI& aErrorUI );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVeiCutVideoContainer();
+
+public:
+    /**
+     * Takes one thumbnail bitmap from given file.
+     *
+     * @param aFilename	name of video clip file
+     */
+    void GetThumbL( const TDesC& aFilename );
+
+    /**
+     * ###Missin' description###
+     *
+     * @param aState
+     */
+    void SetStateL( CVeiCutVideoContainer::TCutVideoState aState, 
+                    TBool aUpdateCBA = ETrue);
+    /**
+     * Starts playing.
+     *
+     * @param aStartTime
+     */
+    void PlayL( const TDesC& aFilename );
+    void PlayMarkedL( const TDesC& aFilename, 
+                      const TTimeIntervalMicroSeconds& aStartTime, 
+                      const TTimeIntervalMicroSeconds& aEndTime );
+    /**
+     * Stops playing.
+     */
+    void StopL();
+
+    /**
+     * Pauses playing.
+     */
+    void PauseL( TBool aUpdateCBA = ETrue );
+
+    /**
+     * Closes the stream.
+     */
+    void CloseStreamL();
+
+    /**
+     * Returns the playback position.
+     *
+     * @return  playback position
+     */
+    TTimeIntervalMicroSeconds PlaybackPositionL();
+
+    /**
+     * Marks the in point.
+     */
+    void MarkedInL();
+
+    /**
+     * Marks the out point.
+     */
+    void MarkedOutL();
+
+    /**
+     * Sets cut in time to cut video bar.
+     *
+     * @param aTime	Cut ín time
+     */
+    void SetInTime( const TTimeIntervalMicroSeconds& aTime );
+
+    /**
+     * Sets cut out time to cut video bar.
+     *
+     * @param aTime	Cut out time
+     */
+    void SetOutTime( const TTimeIntervalMicroSeconds& aTime );
+
+    /**
+     * Takes the snapshot from current frame
+     */
+    void TakeSnapshotL();
+
+    void MuteL();
+public:
+
+    /**
+     * Update function that is called by the static callback method.
+     */
+    void DoUpdate();
+
+    // from MVeiVideoDisplayObserver
+    virtual void NotifyVideoDisplayEvent( const TPlayerEvent aEvent, 
+                                          const TInt& aInfo = 0 );
+
+    virtual void NotifyVideoClipFrameCompleted( CVedVideoClipInfo& aInfo, 
+                                                TInt aError, 
+                                                CFbsBitmap* aFrame);
+    /**
+     * Called to notify that video clip info is ready
+     * for reading.
+     *
+     * Possible error codes:
+     *	- <code>KErrNotFound</code> if there is no file with the specified name
+     *    in the specified directory (but the directory exists)
+     *	- <code>KErrPathNotFound</code> if the specified directory
+     *    does not exist
+     *	- <code>KErrUnknown</code> if the specified file is of unknown format
+     *
+     * @param aInfo   video clip info
+     * @param aError  <code>KErrNone</code> if info is ready
+     *                for reading; one of the system wide
+     *                error codes if reading file failed
+     */
+    virtual void NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo, 
+                                           TInt aError );
+
+    /**
+     * From CCoeControl, OfferKeyEventL.
+     *
+     * @param aKeyEvent  key event
+     * @param aType  event code
+     */
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+    /**
+     * From MProgressDialogCallback, DialogDismissedL.
+     *
+     * @param aButtonId  button id
+     */
+    virtual void DialogDismissedL( TInt aButtonId );
+
+    /**
+     * Opens a video clip file and initializes videoplayerutility.
+     *
+     * @param aFilename  file to open
+     */
+    void OpenFileL( const TDesC& aFilename /*, TBool aStartPlaying = EFalse */ );
+
+    /**
+     * Prepares the control for termination; stops video playback
+     * and sets the state to EStateTerminating.
+     * 
+     */
+    void PrepareForTerminationL();
+
+    // From MConverterController
+    void NotifyCompletion( TInt aErr );
+
+private:
+    /**
+     * Callback function for the timer.
+     *
+     * @param aThis  self pointer
+     *
+     * @return  dummy value
+     */
+    static TInt DoAudioBarUpdate( TAny* aThis );
+
+    /**
+     * Time increment.
+     *
+     * @param aKeyCount number a key events
+     * @return time 
+     */
+    TInt TimeIncrement( TInt aKeyCount )const;
+
+    /**
+     * Constructor.
+     *
+     * @param aView	instance of cut video view
+     * @param aErrorUI instance of CVeiErrorUI
+     */
+    CVeiCutVideoContainer( const TRect& aRect, 
+                           CVeiCutVideoView& aView, 
+                           CVeiErrorUI& aErrorUI );
+
+    /**
+     * Gets intra frame bitmap from video clip.
+     *
+     * @param aTime	intra frame time.
+     */
+    void GetThumbAtL( const TTimeIntervalMicroSeconds& aTime );
+
+    /**
+     * From CoeControl, MopSupplyObject.
+     *
+     * @param aId  
+     */
+    virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
+    /**
+     * From CoeControl, SizeChanged.
+     */
+    void SizeChanged();
+
+    /**
+     * From CoeControl, CountComponentControls.
+     * 
+     * @return  number of component controls in this control
+     */
+    TInt CountComponentControls()const;
+
+    /**
+     * From CCoeControl, ComponentControl.
+     *
+     * @param aIndex  index of the control to return
+     */
+    CCoeControl* ComponentControl( TInt aIndex )const;
+
+    /**
+     * From CCoeControl,Draw.
+     *
+     * @param aRect  region of the control to be redrawn
+     */
+    void Draw( const TRect& aRect )const;
+
+    /**
+     * From CCoeControl, gets the control's help context. Associates the
+     * control with a particular Help file and topic in a context sensitive
+     * application.
+     *
+     * @param aContext Control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext )const;
+
+    /**
+     * From CCoeControl, HandleControlEventL
+     */
+    void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
+
+    /**
+    * HandlePointerEventL
+    * Handles pen inputs
+    *
+    * @param aPointerEvent  pointer event
+    */
+    void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+
+    /**
+    * Handles progress bar touch events
+    * @param aPBRect Current progress bar rectangle 
+    * @param aPressedPoint The x coordinate value that was pressed
+    * 			inside the progress bar
+    * @param aDragMarks ETrue if the user drags start or end marks.
+    *					EFalse otherwise
+    */
+    void HandleProgressBarTouchL( TRect aPBRect, TInt aPressedPoint, TBool aDragMarks, CVeiCutVideoContainer::TCutMark aCutMark = ENoMark );
+
+    /*
+     * Indicates ProgressNote. 
+     *
+     */
+    void ShowProgressNoteL();
+
+    /**
+     * Shows information note with given message.
+     * 
+     * @param aMessage message to show.
+     */
+    void ShowInformationNoteL( const TDesC& aMessage )const;
+
+    /**
+     * The entity of ProgressCallBackL() function
+     * @return 0 when work is done, otherwise return 1.
+     */
+    TInt UpdateProgressNoteL();
+
+    /**
+     * Saves snapshot.
+     */
+    void SaveSnapshotL();
+
+    /**
+     * Cancels saving of the snapshot.
+     */
+    void CancelSnapshotSave();
+
+    void StopProgressDialog();
+
+    void ShowGlobalErrorNote( const TInt aErr );
+
+    /**	HandleVolumeUpL 
+     *
+     *   @see MVeiMediakeyObserver
+     */
+    virtual void HandleVolumeUpL();
+
+    /**	HandleVolumeDownL 
+     *
+     *   @see MVeiMediakeyObserver
+     */
+    virtual void HandleVolumeDownL();
+
+    /** Callback function */
+    static TInt AsyncTakeSnapshot( TAny* aThis );
+    /** Callback function */
+    static TInt AsyncSaveSnapshot( TAny* aThis );
+
+private:
+    //data
+    /** cut video view */
+    CVeiCutVideoView& iView;
+
+    /** Error UI */
+    CVeiErrorUI& iErrorUI;
+
+    /** Video clip info*/
+    CVedVideoClipInfo* iVideoClipInfo;
+
+    /** Current state. */
+    TCutVideoState iState;
+
+    /** Previous state. */
+    TCutVideoState iPreviousState;
+
+    /** Previous state. */
+    TCutVideoState iPrevState;
+
+    /** cut video bar. */
+    CVeiCutterBar* iCutVideoBar;
+
+    /** Last position. */
+    TTimeIntervalMicroSeconds iLastPosition;
+
+    /** Video clip duration */
+    TTimeIntervalMicroSeconds iDuration;
+
+    /**
+     * Control context that provides a layout background with a 
+     * background bitmap and its layout rectangle.
+     */
+    CAknsBasicBackgroundControlContext* iBgContext;
+
+    TInt iInternalVolume;
+
+    /** Key repeat count in seek function. */
+    TInt iKeyRepeatCount;
+
+    /** Seek thumbnail position in video clip. */
+    TTimeIntervalMicroSeconds iSeekPos;
+
+    /** Seek - flag. */
+    TBool iSeeking;
+
+    /** Frame ready - flag */
+    TBool iFrameReady;
+
+    /** Last keycode, used in OfferKeyEventL(); */
+    TUint iLastKeyCode;
+
+    /** The actuall calls to ICL are done from this image converter. */
+    CVeiImageConverter* iConverter;
+
+    //** Whether we need to take snapshot. */
+    TBool iTakeSnapshot;
+
+    /** Progress dialog */
+    CAknProgressDialog* iProgressDialog;
+
+    /** Progress info for the progress dialog. */
+    CEikProgressInfo* iProgressInfo;
+
+    HBufC* iSaveToFileName;
+    TSize iFrameSize;
+    CPeriodic* iVideoBarTimer;
+    CVeiVideoDisplay* iVideoDisplay;
+    TRect iDisplayRect;
+    TRect iCutTimeDisplayRect;
+    CVeiTextDisplay* iCutTimeDisplay;
+    TBool iPlayOrPlayMarked;
+
+    TRect iIconDisplayRect;
+
+    CFbsBitmap* iPauseBitmap;
+    CFbsBitmap* iPauseBitmapMask;
+
+    /** Callback utilities */
+    CAsyncCallBack* iCallBackSaveSnapshot;
+    CAsyncCallBack* iCallBackTakeSnapshot;
+
+    /** Remote connection API used to handle the volume keys. */
+    CVeiRemConTarget* iRemConTarget;
+
+    TBool iTakeSnapshotWaiting;
+
+    /** ETrue if user is dragging the start or end mark with a pen,
+    	EFalse otherwise */
+    TBool iIsMarkDrag;
+
+    /** ETrue if the pen is in start or end mark area when it goes down,
+    	EFalse otherwise */		
+    TBool iIsMarkTapped;
+
+    /** Indicates which mark the user has tapped */						
+    TCutMark iTappedMark;
+
+
+#include "veicutvideocontainer.inl"
+
+};
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiCutVideoContainer.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEICUTVIDEOCONTAINER_INL__
+#define __VEICUTVIDEOCONTAINER_INL__
+
+public:
+		/**
+		 * Returns total length of the video clip.
+		 *
+		 * @return  total length
+		 */
+		inline TTimeIntervalMicroSeconds TotalLength() { return iDuration; };
+
+		/**
+		 * Returns the player state.
+		 *
+		 * @return  player state
+		 */
+		inline TCutVideoState State() { return iState; };
+		/**
+		 * Returns current volume level.
+		 *
+		 * @return	volume level
+		 */
+		inline TInt Volume() const { return iInternalVolume; };
+
+		/**
+		 * Returns minimum volume level.
+		 *
+		 * @return	min volume level
+		 */
+		inline TInt MinVolume() const { return KMinCutVideoVolumeLevel; };
+
+		/**
+		 * Returns maximum volume level.
+		 *
+		 * @return	max volume level
+		 */
+		inline TInt MaxVolume() const { return KMaxVolumeLevel; };
+		/**
+		 * Change volume level. Changes current volume level to given level.
+		 *
+		 * @param aVolumeLevel		new volume level 
+		 */
+		inline void SetVolume( TInt aVolumeLevel ) { iInternalVolume = aVolumeLevel; };
+	
+#endif  // __VEICUTVIDEOCONTAINER
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiCutVideoView.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,431 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEICUTVIDEOVIEW_H
+#define VEICUTVIDEOVIEW_H
+
+
+#include <aknview.h>
+#include <VedMovie.h>
+#include <VedCommon.h>
+#include <aknprogressdialog.h> 
+#include <utility.h>
+#include <caknmemoryselectiondialog.h> 
+
+#include "VeiCutVideoContainer.h" 
+
+
+class CVeiCutVideoContainer;
+class CAknTitlePane;
+class CAknNavigationDecorator;
+class CAknNavigationControlContainer;
+class CPeriodic;
+class CVeiErrorUI;
+class CAknMemorySelectionDialog;
+
+/**
+ *  CVeiCutVideoView view class.
+ * 
+ */
+class CVeiCutVideoView: public CAknView, 
+                        public MVedMovieObserver,
+                        public MVedMovieProcessingObserver, 
+                        public MProgressDialogCallback 
+{
+public:
+
+    /**
+     * Default constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVeiCutVideoView();
+
+protected:
+
+    /** 
+     * From CAknView, HandleForegroundEventL( TBool aForeground )
+     *
+     * @param aForeground
+     */
+    virtual void HandleForegroundEventL( TBool aForeground );
+
+private:
+
+    /**
+     * From CAknView, DynInitMenuPaneL.
+     *
+     * @param aResourceId  resource id
+     * @param aMenuPane  menu pane
+     */
+    void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+    /** 
+     * From MVedMovieProcessingObserver
+     */
+    virtual void NotifyMovieProcessingStartedL( CVedMovie& aMovie );
+    virtual void NotifyMovieProcessingProgressed( CVedMovie& aMovie, 
+                                                  TInt aPercentage );
+    virtual void NotifyMovieProcessingCompleted( CVedMovie& aMovie, 
+                                                 TInt aError );
+
+    /**
+     * From MVedMovieObserver
+     */
+    virtual void NotifyVideoClipAdded( CVedMovie& aMovie, TInt aIndex );
+    
+    virtual void NotifyVideoClipAddingFailed( CVedMovie& aMovie, TInt aError );
+    
+    virtual void NotifyVideoClipRemoved( CVedMovie& aMovie, TInt aIndex );
+    
+    virtual void NotifyVideoClipIndicesChanged( CVedMovie& aMovie, 
+                                                TInt aOldIndex, 
+                                                TInt aNewIndex );
+                                                
+    virtual void NotifyVideoClipTimingsChanged( CVedMovie& aMovie,
+                                                TInt aIndex );
+                                                
+    virtual void NotifyVideoClipColorEffectChanged( CVedMovie& aMovie,
+                                                    TInt aIndex );
+                                                    
+    virtual void NotifyVideoClipAudioSettingsChanged( CVedMovie& aMovie,
+                                                      TInt aIndex );
+                                                      
+    virtual void NotifyStartTransitionEffectChanged( CVedMovie& aMovie );      
+    
+    virtual void NotifyMiddleTransitionEffectChanged( CVedMovie& aMovie, 
+                                                      TInt aIndex );
+                                                      
+    virtual void NotifyEndTransitionEffectChanged( CVedMovie& aMovie );
+    
+    virtual void NotifyAudioClipAdded( CVedMovie& aMovie, TInt aIndex );
+    
+    virtual void NotifyAudioClipAddingFailed( CVedMovie& aMovie, TInt aError );
+    
+    virtual void NotifyAudioClipRemoved( CVedMovie& aMovie, TInt aIndex );
+    
+    virtual void NotifyAudioClipIndicesChanged( CVedMovie& aMovie, 
+                                                TInt aOldIndex, 
+                                                TInt aNewIndex );
+                                                
+    virtual void NotifyAudioClipTimingsChanged( CVedMovie& aMovie,
+                                                TInt aIndex );
+                                                
+    virtual void NotifyMovieReseted( CVedMovie& aMovie );
+
+    virtual void NotifyVideoClipGeneratorSettingsChanged( CVedMovie& aMovie,
+                                                          TInt aIndex );
+
+    virtual void NotifyVideoClipDescriptiveNameChanged( CVedMovie& aMovie, 
+                                                        TInt aIndex );
+                                                        
+    virtual void NotifyMovieQualityChanged( CVedMovie& aMovie );				
+
+    virtual void NotifyMovieOutputParametersChanged( CVedMovie& aMovie );
+    
+    virtual void NotifyAudioClipDynamicLevelMarkInserted( CVedMovie& aMovie, 
+                                                          TInt aClipIndex, 
+                                                          TInt aMarkIndex );
+                                                     
+    virtual void NotifyAudioClipDynamicLevelMarkRemoved( CVedMovie& aMovie, 
+                                                         TInt aClipIndex,
+                                                         TInt aMarkIndex );
+                                                    
+    virtual void NotifyVideoClipDynamicLevelMarkInserted( CVedMovie& aMovie, 
+                                                          TInt aClipIndex,
+                                                          TInt aMarkIndex );
+                                                     
+    virtual void NotifyVideoClipDynamicLevelMarkRemoved( CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex);
+
+    /**
+     * From MProgressDialogCallback
+     */
+    void DialogDismissedL( TInt aButtonId );
+
+
+public:
+    /**
+     * 
+     * 
+     * @return VeiCutVideoView Uid
+     */
+    TUid Id()const;
+
+    /**
+     * Starts temporary clip processing.
+     */
+    void GenerateEffectedClipL();
+
+    /**
+     * From CAknView, HandleCommandL(TInt aCommand);
+     *
+     * @param aCommand
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * Draws the time label navi.
+     */
+    void DrawTimeNaviL();
+
+    /**
+     * Clears the in and/or out points.
+     *
+     * @param aClearIn  whether to clear the in point
+     * @param aClearOut  whether to clear the out point
+     */
+    void ClearInOutL( TBool aClearIn, TBool aClearOut );
+
+    /**
+     * Sets the movie and index
+     *
+     * @param aVideoClip	movie name
+     * @param aIndex		index of the video clip in movie
+     */
+    void SetVideoClipAndIndex( CVedMovie& aVideoClip, TInt aIndex );
+
+    /**
+     * Returns the cut out time.
+     *
+     * @return cut out time
+     */
+    TUint OutPointTime();
+
+    /**
+     * Returns the  cut in time.
+     *
+     * @return  cut in time
+     */
+    TUint InPointTime();
+
+    /**
+     * Changes the CBA (command button array) according to the edit
+     * state.
+     *
+     * @param aState  current state
+     */
+    void UpdateCBAL( TInt aState );
+
+    /**
+     * Updates the time label navi. This method is called by the
+     * static callback function.
+     */
+    void UpdateTimeL();
+
+    /**
+     * Starts the navi pane update, that is, the periodic timer.	
+     */
+    void StartNaviPaneUpdateL();
+
+    /**
+     * Stops the navi pane update.
+     */
+    void StopNaviPaneUpdateL();
+
+    /**
+     * 
+     */
+    void ShowVolumeLabelL( TInt aVolume );
+
+    /**
+     * Mutes the volume.
+     */
+    void VolumeMuteL();
+
+    /**
+     * Static callback function for hiding the volume indicator.
+     *
+     * @param aPtr  self pointer
+     *
+     * @return dummy value
+     */
+    static TInt HideVolumeCallbackL( TAny* aPtr );
+
+    /**
+     * Hides the volume indicator.
+     */
+    void HideVolume();
+
+    /** Possible mark states */
+    enum TMarkState
+    {
+        EMarkStateIn,
+        EMarkStateOut,
+        EMarkStateInOut
+    };
+
+    void HandleStatusPaneSizeChange();
+
+    /**
+     * No description.
+     *
+     * 
+     * @return No description.
+     */
+    TBool IsEnoughFreeSpaceToSaveL(); // const;
+    TTimeIntervalMicroSeconds GetVideoClipCutInTime();
+    TTimeIntervalMicroSeconds GetVideoClipCutOutTime();
+
+    /** 
+     * Handles a change to the control's resources.
+     */
+    void HandleResourceChange( TInt aType );
+    
+
+    /**
+    * Moves the start or end mark when user drags them.
+    * 
+    * @param aPosition	position where the mark is moved to
+    * @param aMarkType  EStartMark or EEndMark
+    * @return -
+    */               
+    void MoveStartOrEndMarkL( TTimeIntervalMicroSeconds aPosition, CVeiCutVideoContainer::TCutMark aMarkType );
+		
+    
+
+private:
+    /**
+     * Starts playing the clip. If the clip is paused, resumes 
+     * playing.
+     */
+    void PlayPreviewL();
+
+    /**
+     * Pauses the playback.
+     */
+    void PausePreviewL();
+
+    /**
+     * Plays the marked section of the clip.
+     */
+    void PlayMarkedL();
+
+    /**
+     * Marks the in point to the current point.
+     */
+    void MarkInL();
+
+    /**
+     * Marks the out point to the current point.
+     */
+    void MarkOutL();
+
+    /**
+     * Creates the time label navi. 
+     *
+     * @return  time label navi 
+     */
+    CAknNavigationDecorator* CreateTimeLabelNaviL();
+
+    /**
+     * Static callback function for the periodical timer that updates
+     * the time navi.
+     *
+     * @param aPtr  self pointer
+     *
+     * @return dummy value
+     */
+    static TInt UpdateTimeCallbackL( TAny* aPtr );
+
+private:
+
+    /**
+     * From AknView, DoActivateL.
+     * 
+     * @param aPrevViewId  previous view id
+     * @param aCustomMessageId  custom message id
+     * @param aCustomMessage  custom message
+     */
+    void DoActivateL( const TVwsViewId& aPrevViewId, TUid aCustomMessageId,
+                     const TDesC8& aCustomMessage );
+
+    /**
+     * From AknView, DoDeactivate
+     */
+    void DoDeactivate();
+
+private:
+    // Data
+    /* cut video container	*/
+    CVeiCutVideoContainer* iContainer;
+
+    /* index of the video clip in the movie	*/
+    TUint iIndex;
+
+    /* name of the temp file. possibly effected*/
+    HBufC* iProcessedTempFile;
+
+    /* movie */
+    CVedMovie* iMovie;
+
+    /* temp movie. used to create effected clip */
+    CVedMovie* iTempMovie;
+
+    /** Time updater. */
+    CPeriodic* iTimeUpdater;
+
+    /** Pointer to the navi pane. */
+    CAknNavigationControlContainer* iNaviPane;
+
+    /** Time navi. */
+    CAknNavigationDecorator* iTimeNavi;
+
+    /** Progress note. */
+    CAknProgressDialog* iProgressNote;
+
+    /** Progress info for the progress note. */
+    CEikProgressInfo* iProgressInfo;
+
+    /** Volume hiding timer. */
+    CPeriodic* iVolumeHider;
+
+    /** Volume navi decorator. */
+    CAknNavigationDecorator* iVolumeNavi;
+
+    /** Popup menu state flag */
+    TBool iPopupMenuOpened;
+
+    /** Audio muted flag */
+    TBool iAudioMuted;
+
+    /** current mark state */
+    TMarkState iMarkState;
+
+    /** Error number */
+    TInt iErrorNmb;
+
+    /** Error UI */
+    CVeiErrorUI* iErrorUI;
+
+    CAknMemorySelectionDialog::TMemory iMemoryInUse;
+
+    TVeiSettings iMovieSaveSettings;
+
+
+#include "veicutvideoview.inl"
+};
+
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiCutVideoView.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEIEDITVIDEOCONTAINER_INL__
+#define __VEIEDITVIDEOCONTAINER_INL__
+
+public:
+
+
+		inline HBufC* TempFilename() { return iProcessedTempFile; };
+
+#endif   //__VEIEDITVIDEOCONTAINER_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiDocument.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEDDOCUMENT_H
+#define VEDDOCUMENT_H
+
+// INCLUDES
+#include <genericparamconsumer.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CEikAppUi;
+
+// CLASS DECLARATION
+
+/**
+ *  CVeiDocument application class.
+ */
+class CVeiDocument: public CAiwGenericParamConsumer
+{
+public:
+    // Constructors and destructor
+    /**
+     * Two-phased constructor.
+     */
+    static CVeiDocument* NewL( CEikApplication& aApp );
+
+    //CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs);
+    //void OpenFileL(TBool aDoOpen , RFile& aFile);
+    void OpenFileL( CFileStore* & aFileStore, RFile& aFile );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVeiDocument();
+    //		virtual void RestoreL(const CStreamStore& aStore, const CStreamDictionary& aStreamDic);
+
+private:
+
+    /**
+     * Default constructor.
+     */
+    CVeiDocument( CEikApplication& aApp );
+    void ConstructL();
+
+private:
+
+    /**
+     * From CEikDocument, create CVeiAppUi "App UI" object.
+     */
+    CEikAppUi* CreateAppUiL();
+};
+
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiEditVideoContainer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,837 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEDEDITVIDEOCONTAINER_H
+#define VEDEDITVIDEOCONTAINER_H
+
+#include <coecntrl.h>
+#include <eiksbobs.h> 
+#include <VedMovie.h>
+#include <VedVideoClipInfo.h>
+#include <aknprogressdialog.h> 
+#include <aknutils.h>
+#include <aknlayoutdef.h> 
+
+#include "veivideodisplay.h"
+#include "veiframetaker.h"
+#include "veicutterbar.h"
+#include "VeiDisplayLighter.h"
+#include "VeiImageClipGenerator.h"
+#include "VeiTitleClipGenerator.h"
+#include "VeiImageConverter.h"
+#include "VeiRemConTarget.h"
+#include "VideoEditorCommon.h"
+
+const TInt KMaxZoomFactorX = 4;
+const TInt KMaxZoomFactorY = 2;
+
+const TInt KVolumeSliderMin = -10;
+const TInt KVolumeSliderMax = 10;
+const TInt KVolumeSliderStep = 1;
+
+class CVedMovie;
+class CVeiEditVideoView;
+class CAknProgressDialog;
+class CEikProgressInfo;
+class CAknsBasicBackgroundControlContext;
+class CVeiVideoDisplay;
+class CVeiTextDisplay;
+class CVeiCutterBar;
+class CPeriodic;
+class CVeiIconBox;
+class CAknNavigationDecorator;
+class CVeiSlider;
+class CStoryboardVideoItem;
+class CStoryboardAudioItem;
+class CTransitionInfo;
+
+using namespace VideoEditor;
+
+
+/**
+ *  CVeiEditVideoContainer  container control class.
+ *  
+ */
+class CVeiEditVideoContainer: public CCoeControl, 
+                              public MCoeControlObserver,
+                              public MVedMovieObserver,
+                              public MVedVideoClipFrameObserver, 
+                              public MVedVideoClipInfoObserver, 
+                              public MProgressDialogCallback,
+                              public MConverterController,
+                              public MVeiVideoDisplayObserver,
+                              public MVeiFrameTakerObserver,
+                              public MVeiMediakeyObserver
+
+
+{
+public:
+
+    /**
+     * Creates a CVeiEditVideoContainer object, which will draw 
+     * itself to aRect.
+     *
+     * @param aRect Frame rectangle for container.
+     * @param aMovie  movie being edited
+     * @param aView	owner
+     *
+     * @return a pointer to the created instance of CVeiEditVideoContainer
+     */
+    static CVeiEditVideoContainer* NewL( const TRect& aRect,
+                                         CVedMovie& aMovie, 
+                                         CVeiEditVideoView& aView );
+
+    /**  
+     * Creates a CVeiEditVideoContainer object, which will draw
+     * itself to aRect.
+     * Leaves the created object in the cleanup stack.
+     *
+     * @param aRect Frame rectangle for container.
+     * @param aMovie  movie being edited
+     * @param aView	owner
+     *
+     * @return a pointer to the created instance of CVeiEditVideoContainer
+     */
+    static CVeiEditVideoContainer* NewLC( const TRect& aRect, 
+                                          CVedMovie& aMovie, 
+                                          CVeiEditVideoView& aView );
+
+    /**
+     * Constructor.
+     *
+     * @param aMovie instance of CVedMovie
+     * @param aView instance of Edit Video View
+     */
+    CVeiEditVideoContainer( CVedMovie& aMovie, CVeiEditVideoView& aView );
+
+    /**
+     * Default constructor.
+     * @param aRect Frame rectangle for container.
+     */
+    void ConstructL( const TRect& aRect );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVeiEditVideoContainer();
+
+    /**
+     * Enumeration for selection mode
+     */
+    enum TSelectionMode
+    {
+        EModeNavigation = 0,
+        EModeMove,
+        EModeDuration,
+        EModeRecordingSetStart,
+        EModeRecording,
+        EModeRecordingPaused,
+        EModeSlowMotion,
+        EModePreview,
+        EModeMixingAudio,
+        EModeAdjustVolume
+    };
+
+    /**
+     * Enumeration for preview state
+     */
+    enum TPreviewState
+    {
+        EStateInitializing = 0,
+        EStateOpening,
+        EStateStopped,
+        EStatePlaying,
+        EStatePaused,
+        EStateClosed,
+        EStateBuffering,
+        EStateGettingFrame,
+        EStateTerminating
+    };
+
+    TBool CurrentClipIsFile();
+
+    /**
+     * Sets cursor position to aCurrentIndex. If cursor is on audio track,
+     * audio index is set and if in video track, video cursor is set.
+     *
+     * @param aCurrentIndex	Cursor position
+     */
+    void SetCurrentIndex( TInt aCurrentIndex );
+
+    /**
+     * Returns the current index.
+     *
+     * @return  current index
+     */
+    TInt CurrentIndex()const;
+
+    /** 
+     * Updates thumbnail in video array.
+     *
+     * @aIndex Index in video array
+     */
+    void UpdateThumbnailL( TInt aIndex );
+
+    /**
+     * Sets the selected status.
+     * 
+     * @param aSelected  status
+     */
+    void SetSelectionMode( TSelectionMode aSelectionMode );
+
+    /**
+     * Control iInfoDisplay's arrows visibility .
+     */
+    void ArrowsControl()const;
+
+    /**
+     * Returns the current index and decrements index.
+     *
+     * @return  current index
+     */
+    TUint GetAndDecrementCurrentIndex();
+
+    void SetCursorLocation( TCursorLocation aCursorLocation );
+
+    void PlayVideoFileL( const TDesC& aFilename, const TBool& aFullScreen );
+
+    void PauseVideoL();
+
+    /**
+     * Starts playing video		 
+     */
+    void PlayVideo( const TDesC& aFilename, TBool& aFullScreen );
+
+    void StopVideo( TBool aCloseStream );
+
+    /**
+     * Set starting value of slow motion.
+     *
+     * @param aSlowMotionStartValue slow motion value 
+     */
+    void SetSlowMotionStartValueL( TInt aSlowMotionStartValue );
+
+    void SetRecordedAudioDuration( const TTimeIntervalMicroSeconds& aDuration );
+    void DrawTrackBoxes()const;
+
+public:
+
+    /**
+     * Update function that is called by the static callback method.
+     */
+    void DoUpdate();
+    /**
+     *
+     */
+    void SetFinishedStatus( TBool aStatus );
+    /**
+     *
+     */
+    void TakeSnapshotL();
+
+    /**
+     * Saves snapshot.
+     */
+    void SaveSnapshotL();
+    /**
+     * Gets intra frame bitmap from video clip.
+     *
+     * @param aTime	intra frame time.
+     */
+    void GetThumbAtL( const TTimeIntervalMicroSeconds& aTime );
+
+    /**
+     *
+     */
+    TTimeIntervalMicroSeconds TotalLength();
+
+    /**
+     * Returns the playback position.
+     * @return  playback position
+     */
+    TTimeIntervalMicroSeconds PlaybackPositionL();
+
+
+    /**
+     *	Sets hole screen to black
+     *
+     *
+     */
+    void SetBlackScreen( TBool aBlack );
+
+
+    /**
+     * Returns snapshots size by bytes.
+     *
+     *
+     */
+    TInt SnapshotSize();
+
+    /**
+     * Returns audio mixing ratio between original and imported track.
+     * Used in EModeMixAudio
+     *
+     */
+    TInt AudioMixingRatio()const;
+
+    /**
+     * Returns clip volume, used in EModeAdjustVolume
+     *
+     */
+    TInt Volume()const;
+
+    /**
+     * Prepares the control for termination; stops video playback
+     * and set the state to EStateTerminating.
+     * 
+     */
+    void PrepareForTerminationL();
+
+private:
+
+    /**
+     * Callback function for the timer.
+     *
+     * @param aThis  self pointer
+     *
+     * @return  dummy value 42
+     */
+    static TInt Update( TAny* aThis );
+
+    void StartZooming();
+
+    void ShowMiddleAnimationL( TVedMiddleTransitionEffect aMiddleEffect );
+    
+    void ShowEndAnimationL( TVedEndTransitionEffect aEndEffect );
+    
+    void ShowStartAnimationL( TVedStartTransitionEffect aStartEffect );
+    
+    void SetColourToningIcons( TInt aIndex );
+    
+     /**
+    * Handles video item timeline touch events
+    * @param aPointerEvent pointer event
+    */
+    void HandleVideoTimelineTouchL( TPointerEvent aPointerEvent );
+
+     /**
+    * Handles volume slider touch events
+    * @param aPointerEvent pointer event
+    */
+    void HandleVolumeSliderTouchL( TPointerEvent aPointerEvent );
+
+    /**
+     * Calculates the rects for the video items in the timeline
+     * and adds them to iVideoItemRectArray
+     */
+    void CalculateVideoClipRects();   
+    
+    /**
+     * Goes through the table iVideoItemRectArray and 
+     * finds the clip that the user has clicked.
+     * @param aPressedPointX The x coordinate value that was pressed
+     * 			             inside the timeline
+     * @return index of the clip that the user has clicked or -1 if 
+     *         the click was in the empty part of the timeline
+     */    
+    TInt FindClickedClip( TInt aPressedPointX );
+    
+private:
+
+    /**
+     * Gets album from aFilename. If file belongs to album, album name is
+     * returned in aAlbumName, otherwise KNullDesc.
+     */
+    void GetAlbumL( const TDesC& aFilename, TDes& aAlbumName )const;
+
+    /**
+     * Starts active object which takes thumbnails from videoclip. 
+     * When completed -> NotifyFramesCompleted(...)
+     */
+    void StartFrameTakerL( TInt aIndex );
+
+    /**
+     *
+     */
+    void ConvertBW( CFbsBitmap& aBitmap )const;
+
+    /**
+     *
+     */
+    void ConvertToning( CFbsBitmap& aBitmap )const;
+
+
+    /**
+     * Gets an object whose type is encapsulated by the specified TTypeUid 
+     * object.
+     *
+     * @param aId Encapsulates the Uid that identifies the type of object
+     * required.
+     *
+     * @return
+     */
+    virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
+
+    virtual void NotifyFramesCompleted( CFbsBitmap* aFirstFrame,
+                                        CFbsBitmap* aLastFrame,
+                                        CFbsBitmap* aTimelineFrame, 
+                                        TInt aError );
+
+
+    virtual void NotifyVideoDisplayEvent( const TPlayerEvent aEvent, 
+                                          const TInt& aInfo = 0 );
+    /**
+    * From MVedVideoClipInfoObserver
+    */
+    virtual void NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo,
+                                           TInt aError );
+    void NotifyCompletion( TInt aErr );
+
+    /**
+    * From MVedMovieObserver
+    */
+    virtual void NotifyVideoClipAdded( CVedMovie& aMovie, TInt aIndex );
+    
+    virtual void NotifyVideoClipAddingFailed( CVedMovie& aMovie, TInt aError );
+                                              
+    virtual void NotifyVideoClipRemoved( CVedMovie& aMovie, TInt aIndex );
+    
+    virtual void NotifyVideoClipIndicesChanged( CVedMovie& aMovie, 
+                                                TInt aOldIndex, 
+                                                TInt aNewIndex );
+                                                
+    virtual void NotifyVideoClipTimingsChanged( CVedMovie& aMovie,
+                                                TInt aIndex );
+                                                
+    virtual void NotifyVideoClipColorEffectChanged( CVedMovie& aMovie,
+                                                    TInt aIndex );
+                                                    
+    virtual void NotifyVideoClipAudioSettingsChanged( CVedMovie& aMovie,
+                                                      TInt aIndex );
+                                                      
+    virtual void NotifyStartTransitionEffectChanged( CVedMovie& aMovie );
+    
+    virtual void NotifyMiddleTransitionEffectChanged( CVedMovie& aMovie, 
+                                                      TInt aIndex );
+                                                      
+    virtual void NotifyEndTransitionEffectChanged( CVedMovie& aMovie );
+    
+    virtual void NotifyAudioClipAdded( CVedMovie& aMovie, 
+                                       TInt aIndex );
+                                       
+    virtual void NotifyAudioClipAddingFailed( CVedMovie& aMovie, 
+                                              TInt aError );
+                                              
+    virtual void NotifyAudioClipRemoved( CVedMovie& aMovie, 
+                                         TInt aIndex );
+                                         
+    virtual void NotifyAudioClipIndicesChanged( CVedMovie& aMovie, 
+                                                TInt aOldIndex, 
+                                                TInt aNewIndex );
+                                                
+    virtual void NotifyAudioClipTimingsChanged( CVedMovie& aMovie,
+                                                TInt aIndex );
+                                                
+    virtual void NotifyMovieReseted( CVedMovie& aMovie );
+
+    virtual void NotifyVideoClipFrameCompleted( CVedVideoClipInfo& aInfo, 
+                                                TInt aError,
+                                                CFbsBitmap* aFrame );
+
+    virtual void NotifyVideoClipGeneratorSettingsChanged( CVedMovie& aMovie,
+                                                          TInt aIndex );
+
+    virtual void NotifyVideoClipDescriptiveNameChanged( CVedMovie& aMovie, 
+                                                        TInt aIndex );
+
+    virtual void NotifyMovieQualityChanged( CVedMovie& aMovie );
+
+    virtual void NotifyMovieOutputParametersChanged( CVedMovie& aMovie );
+
+    virtual void NotifyAudioClipDynamicLevelMarkInserted( CVedMovie& aMovie, 
+                                                          TInt aClipIndex,
+                                                          TInt aMarkIndex );
+
+    virtual void NotifyAudioClipDynamicLevelMarkRemoved( CVedMovie& aMovie, 
+                                                         TInt aClipIndex,
+                                                         TInt aMarkIndex );
+
+    virtual void NotifyVideoClipDynamicLevelMarkInserted( CVedMovie& aMovie, 
+                                                          TInt aClipIndex,
+                                                          TInt aMarkIndex );
+
+    virtual void NotifyVideoClipDynamicLevelMarkRemoved( CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex );
+
+    virtual void DialogDismissedL( TInt aButtonId );
+
+    /**
+     * Moves selected audio clip right. Only for OfferKeyEventL use.
+     *
+     * @return EKeyWasConsumed if key event was processed and 
+     * EKeyWasNotConsumed if it was not.
+     */
+    TKeyResponse MoveAudioRight();
+
+    /**
+     * Moves selected audio clip left. Only for OfferKeyEventL use.
+     *
+     * @return EKeyWasConsumed if key event was processed and 
+     * EKeyWasNotConsumed if it was not.
+     */
+    TKeyResponse MoveAudioLeft();
+
+
+    /**
+     * Time increment.
+     *
+     * @return Time in milliseconds
+     */
+    TInt TimeIncrement( TInt aKeyCount )const;
+
+    /*
+     * From CoeControl,SizeChanged.
+     */
+    void SizeChanged();
+
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+    /**
+     * From CoeControl,CountComponentControls.
+     */
+    TInt CountComponentControls()const;
+
+    /**
+     * From CCoeControl,ComponentControl.
+     */
+    CCoeControl* ComponentControl( TInt aIndex )const;
+
+    /**
+     * From CCoeControl,Draw.
+     */
+    void Draw( const TRect& aRect )const;
+
+    /**
+     * From CCoeControl. Handles a change to the control's resources.  
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );
+
+    /**
+     * From CCoeControl, gets the control's help context. Associates the
+     * control with a particular Help file and topic in a context sensitive
+     * application.
+     *
+     * @param aContext Control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext )const;
+
+    /**
+     * Draws play head when previewing video
+     */
+    void DrawPlayHead() /*const*/;
+
+    /**
+     * From MCoeControlObserver, called when there is a control event
+     * to handle.
+     *
+     * @param aControl  control originating the event
+     * @param aEventType  event type
+     */
+    void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
+
+    /**
+    * From CCoeControl
+    *
+    * @param aPointerEvent  pointer event
+    */
+    void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+
+    /**
+     * Callback function for the  playhead timer.
+     * @param aThis  self pointer
+     * @return  dummy value 42
+     */
+    static TInt UpdatePosition( TAny* aThis );
+
+    /**
+     * Update function that is called by the static 
+     * callback method - UpdatePosition.
+     */
+    void DoUpdatePosition();
+
+    /**
+     * Returns the boolean is audioclip cutted.
+     *
+     * @return  TBool
+     */
+    TBool IsAudioClipCutted();
+
+    TKeyResponse HandleScrollBarL( const TKeyEvent& aKeyEvent,
+                                   TEventCode aType );
+
+    void CreateScrollBarL( const TRect& aRect );
+
+    /**
+     * Cancels saving of the snapshot.
+     */
+    void CancelSnapshotSave();
+
+    /**
+     * Starts progress dialog
+     *
+     * @param aDialogResId resource id of the dialog
+     * @param aTextResId text of dialog
+     */
+    void StartProgressDialogL( const TInt aDialogResId, const TInt aTextResId );
+
+    void SetPreviewState( const TPreviewState aNewState );
+
+    /**	HandleVolumeUpL 
+     *
+     *   @see MVeiMediakeyObserver
+     */
+    virtual void HandleVolumeUpL();
+
+    /**	HandleVolumeDownL 
+     *
+     *   @see MVeiMediakeyObserver
+     */
+    virtual void HandleVolumeDownL();
+
+    /** Callback function */
+    static TInt AsyncTakeSnapshot( TAny* aThis );
+
+private:
+    CVeiDisplayLighter* iScreenLight;
+    /** View eg.owner*/
+    CVeiEditVideoView& iView;
+
+    /** Movie being edited. */
+    CVedMovie& iMovie;
+
+    /** Currently processed thumbnail index. */
+    TInt iCurrentlyProcessedIndex;
+
+    /** Video cursor position. */
+    TInt iVideoCursorPos;
+
+    /** Audio cursor position. */
+    TInt iAudioCursorPos;
+
+    /** No thumbnail icon. */
+    CFbsBitmap* iNoThumbnailIcon;
+    CFbsBitmap* iNoThumbnailIconMask;
+
+    /** Audio icon. */
+    CFbsBitmap* iAudioIcon;
+
+    /** Audio mixing icon. */
+    CFbsBitmap* iAudioMixingIcon;
+
+    CFbsBitmap* iAudioTrackIcon;
+    CFbsBitmap* iAudioTrackIconMask;
+    /** Video track icon. */
+    CFbsBitmap* iVideoTrackIcon;
+    CFbsBitmap* iVideoTrackIconMask;
+
+    /** Array of video items. */
+    RPointerArray < CStoryboardVideoItem > iVideoItemArray;
+
+    /** Array of audio items. */
+    RPointerArray < CStoryboardAudioItem > iAudioItemArray;
+
+    /** Array of video item rects. */
+    RArray < TRect > iVideoItemRectArray;
+
+    /** The index of the clip that the user has clicked. */
+    TInt iClickedClip;
+    
+    /** The part of the timeline that doesn't include video clips.
+        If there are no video clips, the rect is the same as the
+        whole timeline (=iVideoBarBox) */    
+    TRect iEmptyVideoTimeLineRect;
+
+    /** Cursor location. */
+    TCursorLocation iCursorLocation;
+
+    /** Selection mode. */
+    TSelectionMode iSelectionMode;
+
+    /** Transition info. */
+    CTransitionInfo* iTransitionInfo;
+
+    /** Previous cursor location. */
+    TCursorLocation iPrevCursorLocation;
+
+    /** Key repeat count. Incremented in OfferKeyEventL() */
+    TInt iKeyRepeatCount;
+
+    TSize iTransitionMarkerSize;
+    TRect iVideoBarBox;
+    TRect iAudioBarBox;
+    TPoint iAudioBarIconPos;
+    TRect iAudioTrackBox;
+    TPoint iVideoBarIconPos;
+    TRect iVideoTrackBox;
+    TRect iBarArea;
+    TRect iTextArea;
+    TInt iTextBaseline;
+    TRect iIconArea;
+    TRect iIconTopEmptyArea;
+    TRect iIconBottomEmptyArea;
+    TInt iIconTextBaseline;
+    TPoint iHorizontalSliderPoint;
+    TSize iHorizontalSliderSize;
+    TPoint iVerticalSliderPoint;
+    TSize iVerticalSliderSize;
+
+    CAknProgressDialog* iProgressDialog;
+    //CEikProgressInfo*	iProgressInfo;
+
+    /** Background context. Skin stuff. */
+    CAknsBasicBackgroundControlContext* iBgContext;
+
+    TTimeIntervalMicroSeconds iRecordedAudioStartTime;
+    TTimeIntervalMicroSeconds iRecordedAudioDuration;
+
+    TBool iRecordedAudio;
+
+    TInt iZoomFactorX;
+    TInt iZoomFactorY;
+    CPeriodic* iZoomTimer;
+
+    CVeiVideoDisplay* iVideoDisplay;
+
+    CVeiVideoDisplay* iTransitionDisplayLeft; // left hand side
+    CVeiVideoDisplay* iTransitionDisplayRight; // right hand side
+    TRect iTransitionDisplayLeftBox;
+    TRect iTransitionDisplayRightBox;
+
+    CVeiTextDisplay* iInfoDisplay;
+    CVeiTextDisplay* iArrowsDisplay;
+
+    TRect iVideoDisplayBox;
+    TRect iVideoDisplayBoxOnTransition;
+    TRect iInfoDisplayBox;
+    TRect iSlowMotionBox;
+    TRect iTransitionArrowsBox;
+
+    CVeiCutterBar* iDummyCutBar;
+    CVeiCutterBar* iDummyCutBarLeft;
+
+    /* Iconbox */
+    CVeiIconBox* iEffectSymbols;
+    TRect iEffectSymbolBox;
+
+    TRect iDummyCutBarBox;
+    TRect iDummyCutBarBoxOnTransition;
+
+    CFbsBitmap* iGradientBitmap;
+
+    TBool iFinished;
+    TBool iTakeSnapshot;
+    HBufC* iSaveToFileName;
+
+    /** Seek thumbnail position in video clip. */
+    TTimeIntervalMicroSeconds iSeekPos;
+
+    /** Seek - flag. */
+    TBool iSeeking;
+
+    /** Last keycode, used in OfferKeyEventL(); */
+    TUint iLastKeyCode;
+
+    /** Last position. */
+    TTimeIntervalMicroSeconds iLastPosition;
+
+
+    /** Periodic timer used for playhead update . */
+    CPeriodic* iPeriodic;
+    /** Current point. This is where the horizontal bar is drawn. */
+    TUint iCurrentPoint;
+    CVeiImageConverter* iConverter;
+
+    TInt iSlowMotionValue;
+
+    //** Preview flag. */
+    TBool iFullScreenSelected;
+
+    CVeiFrameTaker* iFrameTaker;
+
+    //** GetFrame-flag for seeking functionality. */
+    TBool iSeekingFrame;
+
+    HBufC* iTempFileName;
+
+    CVedVideoClipInfo* iTempVideoInfo;
+
+    /** Current preview state. */
+    TPreviewState iPreviewState;
+    /** Previous preview state. */
+    TPreviewState iPreviousPreviewState;
+
+    TInt iCurrentPointX;
+    TBool iCloseStream;
+    TBool iFrameReady;
+    TBool iBackKeyPressed;
+    /** Previous cursor location for preview. */
+    TCursorLocation iCursorPreviousLocation;
+
+    /** Flag indicating to draw the screen black. */
+    TBool iBlackScreen;
+
+    /** Horizontal slider component. */
+    CVeiSlider* iHorizontalSlider;
+    /** Vertical slider component. */
+    CVeiSlider* iVerticalSlider;
+
+    /** Flag telling whether video file must be reopened in preview. */
+    TBool iMustBeReopened;
+
+    /** Pause indicator. */
+    TRect iPauseIconBox;
+    CFbsBitmap* iPauseBitmap;
+    CFbsBitmap* iPauseBitmapMask;
+
+    /** Remote connection API used to handle the volume keys. */
+    CVeiRemConTarget* iRemConTarget;
+
+    TBool iTakeSnapshotWaiting;
+
+    /** Callback utility */
+    CAsyncCallBack* iCallBack;
+
+    /** ETrue if user is dragging a video clip with touch,
+    	EFalse otherwise */
+    TBool iIsVideoDrag;
+
+    /** ETrue if the pen goes down inside a timeline video clip
+    	EFalse otherwise */		
+    TBool iIsVideoTapped;
+    
+    /** The position where the user is dragging the clip into */    
+    TInt iNewClipPosition;
+
+#include "veieditvideocontainer.inl"
+};
+
+#endif 
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiEditVideoContainer.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEIEDITVIDEOCONTAINER_INL__
+#define __VEIEDITVIDEOCONTAINER_INL__
+
+public:
+  		inline TSelectionMode SelectionMode() { return iSelectionMode; };
+
+		inline void SetVideoCursorPosition( TUint aPosition ) { iVideoCursorPos = aPosition; };
+
+		inline TCursorLocation CursorLocation() { return iCursorLocation; };
+
+		inline TTimeIntervalMicroSeconds RecordedAudioStartTime() const { return iRecordedAudioStartTime; };
+
+		inline TTimeIntervalMicroSeconds RecordedAudioDuration() const { return iRecordedAudioDuration; };
+
+		inline void SetRecordedAudioStartTime( TTimeIntervalMicroSeconds aStartTime )
+			{
+			iRecordedAudioStartTime = aStartTime;
+			}
+
+		inline TPreviewState PreviewState() { return iPreviewState; };
+
+		inline void SetRecordedAudio( TBool aRecordedAudio )
+			{
+			iRecordedAudio = aRecordedAudio;
+			}
+
+		/**
+		* Return value of slow motion in container.
+		*
+		* @return TInt
+		*/
+		inline TInt SlowMotionValue() { return iSlowMotionValue; };
+
+#endif //__VEIEDITVIDEOCONTAINER_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiEditVideoView.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1070 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+#ifndef VEDEDITVIDEOVIEW_H
+#define VEDEDITVIDEOVIEW_H
+
+//  INCLUDES
+#include <aknview.h>
+#include <maknfilefilter.h> 
+#include <aknprogressdialog.h> 
+#include <VedMovie.h>
+#include <utility.h>
+#include <caknmemoryselectiondialog.h> 
+#include "VeiAddQueue.h"
+#include "VeiTitleClipGenerator.h"
+#include "VeiImageClipGenerator.h"
+#include "VeiPopup.h"
+
+#include "veisettingsview.h"
+
+#include <AknQueryDialog.h> 
+
+//  CONSTANTS
+const TUid KView4Id = {4};
+const TInt KMinVolume = 1;
+const TInt KMaxVolume = 10;
+
+//  FORWARD DECLARATIONS
+class CVeiEditVideoContainer;
+class CVeiCutVideoView;
+class CVeiCutAudioView;
+class CAknNaviLabel;
+class CVeiEditVideoLabelNavi;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class MGFetch;
+class CAknProgressDialog;
+class CSendUi;
+class CVedMovie;
+class CMdaAudioConvertUtility;
+class MAknsDataContext;
+class CMdaAudioRecorderUtility;
+class CVeiErrorUI;
+class CVeiTempMaker;
+class CAknMemorySelectionDialog;
+class CAknWaitDialog;
+
+class CVeiAddQueue;
+
+class CVeiTextDisplay;
+class CVeiPopup;
+
+
+
+//  CLASS DECLARATION
+
+/**
+ *  CVeiEditVideoView view class.
+ */
+class CVeiEditVideoView: public CAknView, 
+                         public MProgressDialogCallback, 
+                         public MVedMovieObserver, 
+                         public MVedMovieProcessingObserver,
+                         public MVedAudioClipInfoObserver, 
+                         public MMdaObjectStateChangeObserver,
+                         public MVeiImageClipGeneratorObserver,
+                         public MVeiTitleClipGeneratorObserver,
+                         public MVeiQueueObserver
+
+{
+
+public:
+    //Constructors and destructor
+
+    /**
+     * Static factory constructor.
+     *
+     * @param aCutView Instance of cut video view.
+     * @param aCutAudioView No description.
+     * @param aSendAppUi No description.
+     * @return Created <code>CVeiEditVideoView</code> instance.
+     */
+    static CVeiEditVideoView* NewL( CVeiCutVideoView& aCutView, 
+                                    CVeiCutAudioView& aCutAudioView, 
+                                    CSendUi& aSendAppUi );
+
+    /**
+     * Static factory constructor. Leaves the created object in the
+     * cleanup stack.
+     *
+     * @param aCutView Instance of cut video view.
+     * @param aCutAudioView No description.
+     * @param aSendAppUi No description.
+     * @return Created <code>CVeiEditVideoView</code> instance.
+     */
+    static CVeiEditVideoView* NewLC( CVeiCutVideoView& aCutView,
+                                     CVeiCutAudioView& aCutAudioView, 
+                                     CSendUi& aSendAppUi );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVeiEditVideoView();
+
+    TUid Id()const;
+
+public:
+    // New functions
+
+    void CancelWaitDialog( TInt aError = 0 );
+    /**
+     * Inserts video clip to movie
+     *
+     * @param aFilename Video clip to insert.
+     * @param aStartNow No description.
+     * @return <code>KErrNone</code> if process was started,
+     *		   <code>KErrNotReady</code> if movie was not ready.
+     */
+    TInt AddClipL( const TDesC& aFilename, TBool aStartNow );
+
+    /**
+     * Shows error note with given message.
+     * 
+     * @param aResourceId No description.
+     * @param aError No description.
+     */
+    void ShowErrorNote( const TInt aResourceId, TInt aError = 0 )const;
+
+    /**
+     * Shows global error note for given error.
+     * There are empirically tested error codes for which platform shows something
+     * For other ones platform does not show anything and for them default string is showed.
+     * These error codes must be individually tested for every phone model.
+     *
+     * @param aError standard error code
+     */
+    void ShowGlobalErrorNote( TInt aError = 0 )const;
+
+    /**
+     * Returns audio duration of the movie.
+     * 
+     * @return  movie audio duration in microseconds
+     */
+    TTimeIntervalMicroSeconds OriginalAudioDuration()const;
+
+    /**
+     * Inserts next video clip to movie from videoclip array.
+     */
+    void AddNext();
+
+    /**
+     * Processing wait modes
+     */
+    enum TWaitMode
+    {
+        ENotWaiting = 0x6300,  // 25344
+        EProcessingMovieSave,
+        EProcessingMovieSaveThenQuit,
+        EOpeningAudioInfo,
+        EConvertingAudio,
+        EProcessingMovieForCutting,
+        EProcessingMoviePreview,
+        EProcessingMovieSend,
+        EProcessingError,
+        ECuttingAudio,
+        EDuplicating,
+        EProcessingMovieTrimMms,
+        ESlowMotion,
+        EProcessingAudioError
+    };
+
+    /**
+     * Editor states
+     */
+    enum TEditorState
+    {
+        EPreview = 0x6500,  // 25856
+        EQuickPreview,
+        EEdit,
+        EBufferingVideo,
+        EMixAudio,
+        EAdjustVolume
+    };
+
+    void SetEditorState( TEditorState aState );
+
+    void UpdateMediaGalleryL();
+
+    TRect ClientOrApplicationRect( TBool aFullScreenSelected )const;
+
+    /**
+     * Stores App UI orientation.
+     *
+     * @return No description.
+     */
+    void StoreOrientation();
+
+    /**
+     * Restores the previously stored App UI orientation.
+     *
+     * @return No description.
+     */
+    void RestoreOrientation();
+
+    /** 
+     * Handles a change to the control's resources.
+     */
+    void HandleResourceChange( TInt aType );
+
+public:
+    // Functions from base classes
+
+    /**
+     * From <code>MProgressDialogCallback</code>, callback method gets
+     * called when a dialog is dismissed.
+     *
+     * @param aButtonId  Button id.
+     */
+    virtual void DialogDismissedL( TInt aButtonId );
+
+    /**
+     * From <code>MEikMenuObserver</code>, dynamically initialises a menu
+     * pane. The Uikon framework calls this function, if it is implemented
+     * in a menu’s observer, immediately before the menu pane is activated.
+     *
+     * @param aResourceId Resource ID identifying the menu pane to
+     *        initialise.
+     * @param aMenuPane The in-memory representation of the menu pane.
+     */
+    void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+    /**
+     * From <code>CAknView</code>, no description.
+     *
+     * @param aCommand No description.
+     */
+    void HandleCommandL( TInt aCommand );
+
+
+    /**
+     * No description.
+     */
+    void InsertNewAudio();
+
+    /**
+     * No description.
+     */
+    void SetFullScreenSelected( TBool aFullScreenSelected );
+
+    /**
+     * Starts navipane update.
+     */
+    void StartNaviPaneUpdateL();
+
+    /**
+     * Stops the navi pane update.
+     */
+    void StopNaviPaneUpdateL();
+
+    /**
+     * No description.
+     */
+    void ShowVolumeLabelL( TInt aVolume );
+
+    /**
+     * No description.
+     */
+    void DoUpdateEditNaviLabelL()const;
+    virtual void HandleScreenDeviceChangedL();
+
+    /**
+     * No description.
+     *
+     * 
+     * @return No description.
+     */
+    TBool IsEnoughFreeSpaceToSaveL( TInt aBytesToAdd = 0 )const;
+
+    void SetCbaL( TEditorState aState );
+
+protected:
+    // New functions
+
+    /**
+     * Callback function to be called when the 
+     * <code>iAudioRecordPeriodic</code> is scheduled after a timer event.
+     * 
+     * @param aThis Pointer to this class.
+     * @return Always one (1); indicates that this callback function
+     *         should be called again. 
+     */
+    static TInt UpdateAudioRecording( TAny* aThis );
+
+    static TInt UpdateNaviPreviewing( TAny* aThis );
+
+    /**
+     * No description.
+     */
+    void DoUpdateAudioRecording();
+
+    /**
+     * No description.
+     *
+     * 
+     * @return No description.
+     */
+    TBool IsEnoughFreeSpaceToSave2L( TInt aBytesToAdd = 0 )const;
+
+    /**
+     * Renames generated <code>iTempfile</code> and opens 
+     * <code>CSendUi</code>.
+     */
+    void SendMovieL();
+
+    /**
+     * If needed, creates temporary video clip for CVeiPreviewView and 
+     * activates PreviewView.
+     */
+    void StartTempFileProcessingL();
+
+    /**
+     * Shows information note with given message.
+     * 
+     * @param aMessage Message to show.
+     */
+    void ShowInformationNoteL( const TDesC& aMessage )const;
+
+    /** 
+     * Updates EditLabel
+     */
+    void UpdateEditNaviLabel()const;
+
+    /**
+     * Removes selected clip(audio or video) from the movie.
+     * Confirmation note is shown.
+     */
+    void RemoveCurrentClipL();
+
+    /**
+     * Creates editlabel.
+     *
+     * @return No description.
+     */
+    CAknNavigationDecorator* CreateEditNaviLabelL();
+
+    /**
+     * Creates editlabel.
+     *
+     * @return No description.
+     */
+    CAknNavigationDecorator* CreatePreviewNaviLabelL();
+
+
+    /**
+     * Creates movelabel.
+     *
+     * @return No description.
+     */
+    CAknNavigationDecorator* CreateMoveNaviLabelL();
+
+    /**
+     * Save movie to file.
+     *
+     * @param aQuitAfterSaving	after saving move to VideosView
+     * @return <code>ETrue if quit after saving,
+     *         <code>EFalse</code> otherwise.
+     */
+    TBool SaveL( TWaitMode aQuitAfterSaving );
+
+    /**
+     *  Checks the memory card availability, if MMC is selected as save
+     *  store in application settings. An information note is shown in
+     *  following situations:
+     *  - MMC not inserted
+     *  - MMC corrupted (unformatted)
+     *  [- MMC is read-only (not implemented)]
+     *  
+     *  If note is popped up, this function waits until it's dismissed.
+     */
+    void CheckMemoryCardAvailabilityL();
+
+    static TInt HideVolumeCallbackL( TAny* aPtr );
+
+    /**
+     * Hides the volume indicator.
+     */
+    void HideVolume();
+
+protected:
+    // Functions from base classes
+
+    /**
+     * From <code>CAknView</code>, activates this view.
+     * 
+     * @param aPrevViewId Previous view id.
+     * @param aCustomMessageId Custom message id.
+     * @param aCustomMessage Custom message.
+     */
+    void DoActivateL( const TVwsViewId& aPrevViewId, TUid aCustomMessageId,
+                     const TDesC8& aCustomMessage );
+
+    /**
+     * From <code>CAknView</code>, deactivates this view.
+     */
+    void DoDeactivate();
+
+    /**
+     * From <code>CAknView</code>, HandleForegroundEventL( TBool aForeground ).
+     *
+     * @param aForeground No description.
+     */
+    virtual void HandleForegroundEventL( TBool aForeground );
+
+    virtual void NotifyQueueProcessingStarted( 
+                        MVeiQueueObserver::TProcessing aMode = 
+                        MVeiQueueObserver::ENotProcessing );
+
+    virtual void NotifyQueueEmpty( TInt aInserted, TInt aFailed );
+
+    virtual void NotifyQueueProcessingProgressed( TInt aProcessedCount, 
+                                                  TInt aPercentage );
+
+    virtual TBool NotifyQueueClipFailed( const TDesC& aFilename, TInt aError );
+
+    /**
+     * From <code>MMdaObjectStateChangeObserver</code>, no description.
+     *
+     * @param aObject No description.
+     * @param aPreviousState No description.
+     * @param aCurrentState No description.
+     * @param aErrorCode No description.
+     */
+    virtual void MoscoStateChangeEvent( CBase* aObject, 
+                                        TInt aPreviousState,
+                                        TInt aCurrentState, 
+                                        TInt aErrorCode );
+
+    /**
+     * From <code>MVedAudioClipInfoObserver</code>, no description.
+     *
+     * @param aInfo No description.
+     * @param aError No description.
+     */
+    virtual void NotifyAudioClipInfoReady( CVedAudioClipInfo& aInfo,
+                                           TInt aError );
+
+    /**
+     * From <code>MVedMovieProcessingObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     */
+    virtual void NotifyMovieProcessingStartedL( CVedMovie& aMovie );
+
+    /**
+     * From <code>MVedMovieProcessingObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aPercentage No description.
+     */
+    virtual void NotifyMovieProcessingProgressed( CVedMovie& aMovie, 
+                                                  TInt aPercentage );
+
+    /**
+     * From <code>MVedMovieProcessingObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aError No description.
+     */
+    virtual void NotifyMovieProcessingCompleted( CVedMovie& aMovie,
+                                                 TInt aError );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aIndex No description.
+     */
+    virtual void NotifyVideoClipAdded( CVedMovie& aMovie, TInt aIndex );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aError No description.
+     */
+    virtual void NotifyVideoClipAddingFailed( CVedMovie& aMovie,
+                                              TInt aError );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aIndex No description.
+     */
+    virtual void NotifyVideoClipRemoved( CVedMovie& aMovie, TInt aIndex );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aOldIndex No description.
+     * @param aNewIndex No description.
+     */
+    virtual void NotifyVideoClipIndicesChanged( CVedMovie& aMovie,
+                                                TInt aOldIndex, 
+                                                TInt aNewIndex );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aIndex No description.
+     */
+    virtual void NotifyVideoClipTimingsChanged( CVedMovie& aMovie,
+                                                TInt aIndex );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aIndex No description.
+     */
+    virtual void NotifyVideoClipColorEffectChanged( CVedMovie& aMovie,
+                                                    TInt aIndex );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     */
+    virtual void NotifyStartTransitionEffectChanged( CVedMovie& aMovie );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aIndex No description.
+     */
+    virtual void NotifyMiddleTransitionEffectChanged( CVedMovie& aMovie,
+                                                      TInt aIndex );
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     */
+    virtual void NotifyEndTransitionEffectChanged( CVedMovie& aMovie );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aIndex No description.
+     */
+    virtual void NotifyAudioClipAdded( CVedMovie& aMovie, TInt aIndex );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aError No description.
+     */
+    virtual void NotifyAudioClipAddingFailed( CVedMovie& aMovie,
+                                              TInt aError );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aIndex No description.
+     */
+    virtual void NotifyAudioClipRemoved( CVedMovie& aMovie, TInt aIndex );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aOldIndex No description.
+     * @param aNewIndex No description.
+     */
+    virtual void NotifyAudioClipIndicesChanged( CVedMovie& aMovie, 
+                                                TInt aOldIndex, 
+                                                TInt aNewIndex );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     * @param aIndex No description.
+     */
+    virtual void NotifyAudioClipTimingsChanged( CVedMovie& aMovie,
+                                                TInt aIndex );
+
+    /**
+     * From <code>MVedMovieObserver</code>, no description.
+     *
+     * @param aMovie No description.
+     */
+    virtual void NotifyMovieReseted( CVedMovie& aMovie );
+    
+    /**
+     * Called to notify that the audio settings of a video clip have changed. 
+     *
+     * @param aMovie  movie
+     * @param aClip   changed video clip
+     */
+    virtual void NotifyVideoClipAudioSettingsChanged( CVedMovie& aMovie,
+                                                      TInt aIndex );
+
+    /**
+     * Called to notify that some generator-specific settings of 
+     * a generated video clip have changed.
+     *
+     * @param aMovie  movie
+     * @param aClip   changed video clip
+     */
+    virtual void NotifyVideoClipGeneratorSettingsChanged( CVedMovie& aMovie,
+                                                          TInt aIndex );
+
+    /**
+     * Called to notify that the descriptive name of a clip has changed. 
+     *
+     * @param aMovie  movie
+     * @param aIndex  changed video clip index
+     */
+    virtual void NotifyVideoClipDescriptiveNameChanged( CVedMovie& aMovie, 
+                                                        TInt aIndex );
+   
+    /**
+     * Called to notify that the quality setting of the movie has been
+     * changed.
+     *
+     * @param aMovie  movie
+     */
+    virtual void NotifyMovieQualityChanged( CVedMovie& aMovie );
+
+    /**
+     * Called to notify that the output parameters have been changed
+     *
+     * @param aMovie  movie
+     */
+    virtual void NotifyMovieOutputParametersChanged( CVedMovie& aMovie );
+
+    /**
+     * Called to notify that a dynamic level mark has been inserted 
+     * to an audio clip.
+     *
+     * @param aMovie       movie
+     * @param aClipIndex   audio clip index
+     * @param aMarkIndex   index of the inserted level mark
+     */
+    virtual void NotifyAudioClipDynamicLevelMarkInserted( CVedMovie& aMovie, 
+                                                          TInt aClipIndex, 
+                                                          TInt aMarkIndex );
+
+    /**
+     * Called to notify that a dynamic level mark has been inserted 
+     * to an audio clip.
+     *
+     * @param aMovie       movie
+     * @param aClipIndex   audio clip index
+     * @param aMarkIndex   index of the inserted level mark
+     */
+    virtual void NotifyAudioClipDynamicLevelMarkRemoved( CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex );
+
+    /**
+     * Called to notify that a dynamic level mark has been inserted 
+     * to an audio clip.
+     *
+     * @param aMovie       movie
+     * @param aClipIndex   audio clip index
+     * @param aMarkIndex   index of the inserted level mark
+     */
+    virtual void NotifyVideoClipDynamicLevelMarkInserted( CVedMovie& aMovie, 
+                                                          TInt aClipIndex, 
+                                                          TInt aMarkIndex );
+
+    /**
+     * Called to notify that a dynamic level mark has been inserted 
+     * to an audio clip.
+     *
+     * @param aMovie       movie
+     * @param aClipIndex   audio clip index
+     * @param aMarkIndex   index of the inserted level mark
+     */
+    virtual void NotifyVideoClipDynamicLevelMarkRemoved( CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex );    
+
+
+    /**
+     * From MVedImageClipGeneratorObserver
+     */
+    virtual void NotifyImageClipGeneratorInitializationComplete(
+    	                                    CVeiImageClipGenerator& aGenerator,
+    	                                    TInt aError );
+
+    virtual void NotifyTitleClipBackgroundImageLoadComplete(
+                                            CVeiTitleClipGenerator& aGenerator,
+                                            TInt aError);
+
+
+private:
+
+    void UpdateInsertingProgressNoteL( TInt aProcessed );
+    
+    /**
+     * C++ default constructor.
+     *
+     * @param aCutView	instance of cut video view
+     * @param aVideoList instance of videolist
+     */
+    CVeiEditVideoView( CVeiCutVideoView& aCutView, 
+                       CVeiCutAudioView& aCutAudioView,
+			           CSendUi& aSendAppUi );
+
+
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+
+    void ShowAndHandleSendMenuCommandsL();
+
+    void BrowseStartTransition( TBool aUpOrDown );
+
+    /**
+     * Check is videoclip mms compatible.
+     *
+     * @param 
+     */
+    void MmsSendCompatibleCheck();
+
+
+    /**
+     * this function decides whether audio mixing can be made		 
+     */
+    TBool MixingConditionsOk()const;
+
+    /**
+     * this function fades either the videos' audio level or the imported sounds' audio level in the movie
+     *		  
+     */
+    void MixAudio();
+
+
+    /**
+     * this function removes dynamic level marks from all the video and audio clip(s) in the movie		 
+     *		  
+     */
+    //void RemoveAudioMixingLevelMarks();
+
+    /**
+     * this function removes dynamic level marks from the individual video clip(s) in the movie
+     * @param aIndex       index of video clip where marks are to be removed from
+     * if aIndex is empty or has negative value, marks are removed from every video clip currently in the movie
+     *		  
+     */
+    //void RemoveVideoClipVolumeLevelMarks(TInt aIndex = -1);
+
+    /**
+     * this function removes video dynamic level marks from the individual audio clip(s) in the movie
+     * @param aIndex       index of audio clip where marks are to be removed from
+     * if aIndex is empty or has negative value, marks are removed from every audio clip currently in the movie
+     *		  
+     */
+    //void RemoveAudioClipVolumeLevelMarks(TInt aIndex = -1);
+
+    /**
+     * this function adjusts volume of the video's audio or the imported audio
+     *		  
+     */
+    void AdjustVolumeL();
+
+    /** Callback function */
+    static TInt AsyncBackSend( TAny* aThis );
+    /** Callback function */
+    static TInt AsyncBackSaveThenExitL( TAny* aThis );
+
+    /**
+     * This function is called to tell whether the movie's state has changed so that new temporary movie 
+     * file have to be processed. The file is needed in previewing for example. 
+     * The processing starts when the temporary movie file is next time needed.
+     * @param aUpdateNeeded tells whether new temporary movie file is needed 		 
+     */
+    void SetNewTempFileNeeded( const TBool aUpdateNeeded );
+
+    /*
+    There is an GetDurationEstimateL() method in CVedMovie that 
+    estimates end cutpoint with given target size and start cutpoint for current movie.
+    This method gives end cutpoint time in movie's time scale. 
+
+    If end cutpoint is not in the first clip but in some subsequent clip things are not straightforward.
+    The clip accomodatint the end cutpoint must be localized as well as the exact timepoint in clip's
+    time scale.
+
+    If clips have been edited (e.g. marks set) before call to GetDurationEstimateL(), things get
+    more complicated.
+
+    If slow motion is applied to clips things get even more complicated.
+
+    There is no resrictions of usage presented in the documentation of CVedMovie::GetDurationEstimateL() (vedmovie.h) 
+
+     */
+    TBool FitsToMmsL();
+
+
+private:
+    // Data
+
+    /**
+     * Cut video view.
+     */
+    CVeiCutVideoView& iCutView;
+
+    /**
+     * Cut audio view.
+     */
+    CVeiCutAudioView& iCutAudioView;
+
+    /**
+     * No description.
+     */
+    CSendUi& iSendAppUi;
+
+    /**
+     * No description.
+     */
+    CVedAudioClipInfo* iAudioClipInfo;
+
+    /**
+     * No description.
+     */
+    CAknNavigationControlContainer* iNaviPane;
+
+    /**
+     * Edit label.
+     */
+    CAknNavigationDecorator* iEditLabel;
+
+    /**
+     * Preview label.
+     */
+    CAknNavigationDecorator* iPreviewLabel;
+
+    /** 
+     * Move label.
+     */
+    CAknNavigationDecorator* iMoveLabel;
+
+    /**
+     * Progress info for the progress dialog.
+     */
+    //CEikProgressInfo*       iProgressInfo;
+
+    /**
+     * Progress dialog.
+     */
+    CAknProgressDialog* iProgressNote;
+
+    /**
+     * Original audio clip index.
+     */
+    TInt iOriginalAudioClipIndex;
+
+    /**
+     * Original video clip index.
+     */
+    TInt iOriginalVideoClipIndex;
+
+    /**
+     * Original audio clip starting point.
+     */
+    TTimeIntervalMicroSeconds iOriginalAudioStartPoint;
+
+    /**
+     *Original audio clip duration.
+     */
+    TTimeIntervalMicroSeconds iOriginalAudioDuration;
+
+    /**
+     * Original video clip cut in time.
+     */
+    TTimeIntervalMicroSeconds iOriginalCutInTime;
+    TTimeIntervalMicroSeconds iOriginalCutOutTime;
+
+    /**
+     * Original audio clip cut in time.
+     */
+    TTimeIntervalMicroSeconds iOriginalAudioCutInTime;
+    TTimeIntervalMicroSeconds iOriginalAudioCutOutTime;
+
+    TTimeIntervalMicroSeconds iOriginalVideoStartPoint;
+
+    TTimeIntervalMicroSeconds iOriginalVideoCutInTime;
+
+    TTimeIntervalMicroSeconds iOriginalVideoCutOutTime;
+
+    /**
+     * No description.
+     */
+    TInt iCutVideoIndex;
+
+    /**
+     * No description.
+     */
+    TInt iCutAudioIndex;
+
+    /**
+     * No description.
+     */
+    TUid iGivenSendCommand;
+
+    /**
+     * Temporary file name for storing preview clip.
+     */
+    HBufC* iTempFile;
+
+    /**
+     * Temporary file name for storing preview clip. 
+     */
+    HBufC* iTempRecordedAudio;
+
+    /**
+     * Wait mode; are we waiting for progress or wait note? 
+     */
+    TWaitMode iWaitMode;
+
+    /**
+     * No description.
+     */
+    TBool iMovieSavedFlag;
+
+    /**
+     * For indicating the first movie clip adding. 
+     */
+    TBool iMovieFirstAddFlag;
+
+    /**
+     * No description.
+     */
+    TBool iUpdateTemp;
+
+    /**
+     * No description.
+     */
+    TBool iConverting;
+
+    /**
+     * No description.
+     */
+    CMdaAudioRecorderUtility* iRecorder;
+
+    /**
+     * No description.
+     */
+    CPeriodic* iAudioRecordPeriodic;
+
+    CPeriodic* iPreviewUpdatePeriodic;
+
+    /** Volume navi decorator. */
+    CAknNavigationDecorator* iVolumeNavi;
+
+    /**
+     * No description.
+     */
+    TTimeIntervalMicroSeconds iRecordedAudioMaxDuration;
+
+    /**
+     * No description.
+     */
+    CVeiErrorUI* iErrorUI;
+
+    /**
+     * No description.
+     */
+    TInt iErrorNmb;
+
+    /**
+     * No description.
+     */
+    HBufC* iSaveToFileName;
+
+    /**
+     * No description.
+     */
+    TBool iSendKey;
+
+    /**
+     * No description.
+     */
+    CVeiTempMaker* iTempMaker;
+
+    TEditorState iEditorState;
+
+    CAknWaitDialog* iWaitDialog;
+
+    CVedVideoClipGenerator* iGenerator;
+
+    CVeiAddQueue* iMediaQueue;
+
+    TBool iFullScreenSelected;
+
+    /** Volume hiding timer. */
+    CPeriodic* iVolumeHider;
+
+
+    /**
+     * Indicates whether or not the memory card accessibility is checked.
+     * Usually accessibility is checked only once.
+     */
+    TBool iMemoryCardChecked;
+
+    CVeiPopup* iPopup;
+
+    /**
+     * No description.
+     */
+    CVedMovie* iMovie;
+
+    /**
+     * No description.
+     */
+    CVeiEditVideoContainer* iContainer;
+
+    TInt iOriginalVideoSpeed;
+
+    TVeiSettings iMovieSaveSettings;
+    CAknMemorySelectionDialog::TMemory iMemoryInUse;
+
+
+    CVedMovie::TVedMovieQuality iBackupSaveQuality;
+
+    TBool iChangedFromMMCToPhoneMemory;
+
+    TInt iPercentProcessed;
+
+    /**
+     * Store the original orientation when forcing to portrait
+     */
+    CAknAppUiBase::TAppUiOrientation iOriginalOrientation;
+
+    /** Callback utility */
+    CAsyncCallBack* iCallBack;
+
+#include "veieditvideoview.inl"
+};
+
+#endif // VEDEDITVIDEOVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiEditVideoView.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEIEDITVIDEOVIEW_INL__
+#define __VEIEDITVIDEOVIEW_INL__
+
+public:
+		/**
+		* Set temporary filename to aFilename
+		*
+		* @param aFilename
+		*/
+		inline void TempFilename( HBufC& aFilename ) const { aFilename = *iTempFile; };
+
+		inline void SetSendKey( TBool aState ) { iSendKey = aState; };
+
+		inline void SetConfirmExit()
+			{
+			iUpdateTemp = ETrue;
+			iMovieSavedFlag = EFalse;
+			};
+
+		inline TEditorState EditorState() { return iEditorState; };
+
+		/**
+		 * No description.
+		 *
+		 * @return No description.
+		 */
+		inline TWaitMode WaitMode() { return iWaitMode; };
+
+		inline void SetWaitMode( TWaitMode aMode ) { iWaitMode = aMode; }
+
+		inline CVeiPopup* Popup() { return iPopup; }
+
+		inline CVedMovie* Movie() { return iMovie; }
+
+		inline CVeiEditVideoContainer* Container() { return iContainer; }
+
+#endif //__VEIEDITVIDEOVIEW_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiIconBox.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+
+#ifndef VEIICONBOX_H
+#define VEIICONBOX_H
+
+#include <coecntrl.h>
+#include <aknutils.h>
+
+#include <aknview.h>
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+
+
+/**
+ * VeiDummyCutBar control class.
+ */
+class CVeiIconBox: public CCoeControl /*, public MVideoPlayerUtilityObserver*/
+{
+public:
+    /**
+     * Destructor.
+     */
+    virtual ~CVeiIconBox();
+
+    /** 
+     * Static factory method.
+     * 
+     * @return  the created VeiDummyCutBar object
+     */
+    static CVeiIconBox* NewL( const TRect& aRect, const CCoeControl* aParent );
+
+    /** 
+     * Static factory method. Leaves the created object in the cleanup
+     * stack.
+     *
+     * @return  the created CVeiCutAudioBar object
+     */
+    static CVeiIconBox* NewLC( const TRect& aRect, const CCoeControl* aParent );
+
+public:
+    void SetVolumeMuteIconVisibility( TBool aVisible );
+    void SetSlowMotionIconVisibility( TBool aVisible );
+    void SetBlackAndWhiteIconVisibility( TBool aVisible );
+    void SetColourIconVisibility( TBool aVisible );
+    void SetRecAudioIconVisibility( TBool aVisible );
+    void SetPauseAudioIconVisibility( TBool aVisible );
+
+
+    /**
+     * Screen mode change 
+     *
+     */
+    void SetLandscapeScreenOrientation( TBool aLandscapeScreenOrientation );
+
+private:
+    /**
+     * Default constructor.
+     *
+     */
+    void ConstructL( const TRect& aRect, const CCoeControl* aParent );
+
+    /**
+     * From CCoeControl,Draw.
+     *
+     * @param aRect  rectangle to draw
+     */
+    void Draw( const TRect& aRect )const;
+    void SizeChanged();
+
+
+private:
+    // data
+
+    CFbsBitmap* iVolumeMute;
+    CFbsBitmap* iVolumeMuteMask;
+    CFbsBitmap* iSlowMotion;
+    CFbsBitmap* iSlowMotionMask;
+    CFbsBitmap* iBlackAndWhite;
+    CFbsBitmap* iBlackAndWhiteMask;
+    CFbsBitmap* iColour;
+    CFbsBitmap* iColourMask;
+    CFbsBitmap* iRecAudio;
+    CFbsBitmap* iRecAudioMask;
+    CFbsBitmap* iPauseAudio;
+    CFbsBitmap* iPauseAudioMask;
+
+    TBool iVolumeMuteIconVisible;
+    TBool iSlowMotionIconVisible;
+    TBool iBlackAndWhiteIconVisible;
+    TBool iColourIconVisible;
+    TBool iRecAudioIconVisibile;
+    TBool iPauseAudioIconVisibile;
+    TBool iLandscapeScreenOrientation;
+
+
+};
+#endif 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiPopup.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#ifndef VEIPOPUP_H
+#define VEIPOPUP_H
+
+//  INCLUDES
+//#include <aknview.h>
+
+//#include <utility.h>
+
+const TInt KAmountOfMenuItems = 9;
+
+class CVeiEditVideoView;
+
+//  CLASS DECLARATION
+
+/**
+ *  CVeiPopup view class.
+ */
+class CVeiPopup: public CBase 
+
+{
+public:
+    //Constructors and destructor
+
+    /**
+     * Static factory constructor.
+     *
+     * @param aView Instance of  video view.
+     * @return Created <code>CVeiPopup</code> instance.
+     */
+
+    static CVeiPopup* NewL( CVeiEditVideoView& aView );
+
+
+    /**
+     * Static factory constructor. Leaves the created object in the
+     * cleanup stack.
+     *
+     * @param aView Instance of video view.
+     * @return Created <code>CVeiPopup</code> instance.
+     */
+
+    static CVeiPopup* NewLC( CVeiEditVideoView& aView );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVeiPopup();
+
+
+public:
+    // New functions
+
+    /**
+     * Opens insert audio popup list.
+     */
+    void ShowInsertAudioPopupList();
+
+    /**
+     * Opens video/image/text popup list.
+     */
+    void ShowInsertStuffPopupList();
+
+    /**
+     * Opens insert text popup list.
+     */
+    void ShowInsertTextPopupList();
+
+    /**
+     * Opens edit video popup list.
+     */
+    void ShowEditVideoPopupList();
+
+    /**
+     * Opens edit text popup list.
+     */
+    void ShowEditTextPopupList();
+
+    /**
+     * Opens edit image popup list.
+     */
+    void ShowEditImagePopupList();
+
+    /**
+     * Opens edit text style popup list where text style can be selescted.
+     */
+    void ShowEditTextStylePopUpList();
+
+    /**
+     * Opens edit audio popup list.
+     */
+    void ShowEditAudioPopupList();
+
+    /**
+     * Executes a popup list menu where end transition can be selected.
+     */
+    void ShowEndTransitionPopupListL();
+
+    /**
+     * Executes a popup list menu where middle transition can be selected.
+     */
+    void ShowMiddleTransitionPopupListL();
+
+    /**
+     * Executes a popup list menu where start transition can be selected.
+     */
+    void ShowStartTransitionPopupListL();
+
+    /**
+     * Opens effect selection popup list.
+     */
+    void ShowEffectSelectionPopupListL();
+
+    /**
+     * Shows the color selector dialog.
+     */
+    TBool ShowColorSelectorL( TRgb& aColor )const;
+
+    /**
+     * Shows the background selection dialog.
+     */
+    TInt ShowTitleScreenBackgroundSelectionPopupL( TBool& aImageSelected )const;
+
+    /**
+     * Opens insert text popup list.
+     */
+    void ShowTitleScreenStyleSelectionPopupL();
+
+
+protected:
+    // New functions
+
+    /**
+     * Shows a popup list with given parameters.
+     *
+     * @param aSoftkeysResourceId Softkeys id.
+     * @param aPopupTitleResourceId Title for popup.
+     * @param aArrayResourceId Array for items.
+     * @param aTablesize Index of removed item (from array).
+     * @param aDynPopup is popup dynamic or not.
+     * @return Returns the index of selected item.
+     */
+    TInt ExecutePopupListL( TInt aSoftkeysResourceId, 
+                            TInt aPopupTitleResourceId,
+                            TInt aArrayResourceId,
+                            TInt aTablesize,
+                            TBool aDynPopup ) const;
+private:
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    CVeiPopup( CVeiEditVideoView& aView );
+
+
+private:
+    // Data
+    CVeiEditVideoView& iView;
+    TInt RemoveArrayIndex[KAmountOfMenuItems];
+
+};
+
+#endif // VEIPOPUP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiSettingItemList.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef VEISETTINGITEMLIST_H
+#define VEISETTINGSITEMLIST_H
+
+// INCLUDES
+#include <aknsettingitemlist.h> 
+#include "VeiSettings.h"
+
+//  CLASS DECLARATION
+
+/**
+ * Setting item list for setting items.
+ */
+class CVeiSettingItemList: public CAknSettingItemList
+{
+public:
+    // Constructor and destructor
+
+    /**
+     * C++ default constructor for constructing this object.
+     *
+     * @param aSettings Reference to settings data class.
+     */
+    CVeiSettingItemList( TVeiSettings& aSettings );
+
+    /**
+     * Destroys the object and releases all memory objects.
+     */
+    ~CVeiSettingItemList();
+
+public:
+    // New functions
+
+    /**
+     * This launches the setting page for the highlighted item by calling
+     * <code>EditItemL</code> on it.
+     */
+    void ChangeFocusedItemL();
+
+public:
+    // Functions from base classes
+
+    /**
+     * From <code>CAknSettingItemList</code>, this launches the setting
+     * page for the current item by calling <code>EditItemL</code> on it.
+     * Corresponding value is also saved by calling it's 
+     * <code>StoreL</code> function.
+     *
+     * @param aIndex Current item's (Visible) index in the list.
+     * @param aCalledFromMenu In this case, passed directly to the base
+     *                        class.
+     */
+    void EditItemL( TInt aIndex, TBool aCalledFromMenu );
+
+protected:
+    // Functions from base classes
+
+    /**
+     * From <code>CAknSettingItemList</code>, framework method to create
+     * a setting item based upon the user id <code>aSettingId</code>. 
+     * Implementation decides what type to contruct.
+     *
+     * @param aSettingId ID to use to determine the type of the setting item.
+     * @return A constructed (not 2nd-stage constructed) setting item.
+     */
+    CAknSettingItem* CreateSettingItemL( TInt aSettingId );
+
+    /**
+     * From <code>CCoeControl</code>, responds to size changes to sets the
+     * size and position of the contents of this control.Resizes the
+     * setting list accordingly.
+     */
+    void SizeChanged();
+
+private:
+    // Data
+
+    /**
+     * Application settings data.
+     */
+    TVeiSettings& iSettings;
+
+};
+
+#endif // VEISETTINGSITEMLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiSettingsContainer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef VEISETTINGSCONTAINER_H
+#define VEISETTINGSCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+
+// CLASS DECLARATION
+class CVeiSettingItemList;
+class TVeiSettings;
+
+/**
+ * CVeiSettingsContainer container control class.
+ */
+class CVeiSettingsContainer: public CCoeControl
+{
+public:
+    // Constructors and destructor
+
+    /**
+     * Default constructor.
+     *
+     * @param aRect Frame rectangle for container.
+     * @param aSettings Reference to application settings.
+     */
+    void ConstructL( const TRect& aRect, TVeiSettings& aSettings );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVeiSettingsContainer();
+
+public:
+    // New functions
+
+    /**
+     * This launches the setting page for the highlighted item by calling
+     * <code>EditItemL</code> on it. The responsibility is handled to
+     * <code>CVeiSettingItemList</code>.
+     */
+    void ChangeFocusedItemL();
+
+private:
+    // From CCoeControl
+
+    /**
+     * From <code>CCoeControl</code>, gets the specified component of 
+     * a compound control.
+     *
+     * @param aIndex The index of the control to get.
+     * @return The component control with an index of <code>aIndex</code>.
+     */
+    CCoeControl* ComponentControl( TInt aIndex )const;
+
+    /**
+     * From <code>CCoeControl</code>, gets the number of controls contained
+     * in a compound control. 
+     *
+     * @return The number of component controls contained by this control.
+     */
+    TInt CountComponentControls()const;
+
+    /**
+     * From <code>CCoeControl</code>, gets the control's help context. 
+     * Associates this control with a particular Help file and topic in
+     * a context sensitive application. Sets public data members of
+     * <code>aContext</code> to the required Help file UID (iMajor) and
+     * context descriptor (iContext).
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext )const;
+
+    /**
+     * From <code>CoeControl</code>, handles key events by passing them to
+     * <code>CVeiSettingItemList</code>.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event: <code>EEventKey</code>,
+     *              <code>EEventKeyUp</code> or <code>EEventKeyDown</code>.
+     * @return Indicates whether or not the key event was used by this
+     *         control.
+     */
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+    void HandleResourceChange( TInt aType );
+
+    void SizeChanged();
+
+private:
+    // Data
+
+    /**
+     * Setting item list for handling all the setting items.
+     */
+    CVeiSettingItemList* iSettingItemList;
+
+};
+
+#endif // VEISETTINGSCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiSettingsView.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEISETTINGSVIEW_H
+#define VEISETTINGSVIEW_H
+
+// INCLUDES
+// System includes
+#include <aknview.h>        // CAknView
+// User includes
+#include "VeiSettings.h"    // TVeiSettings
+
+// FORWARD DECLARATIONS
+class CVeiSettingsContainer;
+
+// CLASS DECLARATION
+
+/**
+ * CVeiSettingsView view class.
+ */
+class CVeiSettingsView: public CAknView
+{
+public:
+    // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CVeiSettingsView* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CVeiSettingsView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CVeiSettingsView();
+
+public:
+    // From CAknView
+
+    /**
+     * 
+     */
+    TUid Id()const;
+
+    /**
+     * 
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     *  
+     */
+    void HandleClientRectChange();
+
+private:
+    // From CAknView
+
+    /**
+     * From AknView
+     */
+    void DoActivateL( const TVwsViewId& aPrevViewId, TUid aCustomMessageId,
+                     const TDesC8& aCustomMessage );
+
+    /**
+     * From AknView
+     */
+    void DoDeactivate();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CVeiSettingsView();
+
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+private:
+    // Data
+
+    /** 
+     * Container. 
+     */
+    CVeiSettingsContainer* iContainer;
+
+    /**
+     * 
+     */
+    TVeiSettings iSettings;
+
+    /**
+     * Store the original orientation when forcing to portrait
+     */
+    //CAknAppUiBase::TAppUiOrientation iOriginalOrientation;
+};
+
+#endif 
+
+// End of Files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiTrimForMmsContainer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,395 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#ifndef VEITRIMFORMMSCONTAINER_H
+#define VEITRIMFORMMSCONTAINER_H
+
+// INCLUDES
+// System includes
+#include <AknUtils.h>   // TAknLayoutText
+#include <coecntrl.h>
+#include <AknProgressDialog.h> 
+#include <VedMovie.h>
+#include <VedVideoClipInfo.h>
+// User includes
+#include "VeiVideoDisplay.h"
+#include "VeiFrameTaker.h"
+#include "VeiTrimForMmsView.h"
+#include "VeiDisplayLighter.h"
+
+// FORWARD DECLARATIONS
+class CVeiCutterBar;
+class CVeiTrimForMmsView;
+class CVeiTrimForMmsView;
+class CAknsBasicBackgroundControlContext;
+class CAknProgressDialog;
+//class CEikProgressInfo;
+
+// CLASS DECLARATION
+
+/**
+ *
+ */
+class CVeiTrimForMmsContainer: public CCoeControl,
+                               public MVedMovieObserver,
+                               public MVeiVideoDisplayObserver,
+                               public MVeiFrameTakerObserver,
+                               public MProgressDialogCallback
+{
+public:
+
+    static CVeiTrimForMmsContainer* NewL( const TRect& aRect,
+                                          CVedMovie& aMovie,
+                                          CVeiTrimForMmsView& aView );
+
+    static CVeiTrimForMmsContainer* NewLC( const TRect& aRect,
+                                           CVedMovie& aMovie,
+                                           CVeiTrimForMmsView& aView );
+
+    ~CVeiTrimForMmsContainer();
+
+public:
+    // New functions
+
+    const TTimeIntervalMicroSeconds& CutInTime()const;
+
+    const TTimeIntervalMicroSeconds& CutOutTime()const;
+
+    void SetMaxMmsSize( TInt aMaxSizeInBytes );
+
+    /**
+     * Start full screen preview. Calls CVeiVideoDisplay. 
+     *
+     * @param aFilename filename.
+     * @param aRect full screen size.
+     */
+    void PlayL( const TDesC& aFilename, const TRect& aRect );
+
+    /**
+     *	Stop preview. Stops CVeiVideoDisplay
+     *
+     * @param aCloseStream 
+     */
+    void Stop( TBool aCloseStream );
+
+    /**
+     *
+     */
+    void PauseL();
+
+    /**
+     * Return the video display state of CVeiTrimForMmsContainer. 
+     *
+     * @param 
+     */
+    TInt PreviewState()const;
+
+    void StartFrameTakerL( TInt aIndex );
+
+private:
+    // From CCoeControl
+
+    virtual void DialogDismissedL( TInt aButtonId );
+
+    CCoeControl* ComponentControl( TInt aIndex )const;
+
+    TInt CountComponentControls()const;
+
+    /**
+     * Gets the control's help context. Associates the control with a 
+     * particular Help file and topic in a context sensitive application.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext )const;
+
+    void Draw( const TRect& aRect )const;
+
+    void SizeChanged();
+
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                 TEventCode aType );
+
+private:
+    // From MVeiVideoDisplayObserver
+    
+    virtual void NotifyVideoDisplayEvent( const TPlayerEvent aEvent, 
+                                          const TInt& aInfo = 0 );
+
+    virtual void NotifyFramesCompleted( CFbsBitmap* aFirstFrame, 
+                                        CFbsBitmap* aLastFrame,
+                                        CFbsBitmap* /*aTimelineFrame*/, 
+                                        TInt aError );
+
+
+    /**
+     * Gets an object whose type is encapsulated by the specified TTypeUid 
+     * object.
+     *
+     * @param aId Encapsulates the Uid that identifies the type of object
+     * required.
+     *
+     * @return
+     */
+    virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
+protected:
+    // From MVedMovieObserver
+
+    virtual void NotifyVideoClipAdded( CVedMovie& aMovie, TInt aIndex );
+
+    virtual void NotifyVideoClipAddingFailed( CVedMovie& aMovie, TInt aError );
+
+    virtual void NotifyVideoClipRemoved( CVedMovie& aMovie, TInt aIndex );
+	
+    virtual void NotifyVideoClipIndicesChanged( CVedMovie& aMovie, 
+                                                TInt aOldIndex, 
+                                                TInt aNewIndex );
+
+    virtual void NotifyVideoClipTimingsChanged( CVedMovie& aMovie,
+                                                TInt aIndex );
+
+    virtual void NotifyVideoClipColorEffectChanged( CVedMovie& aMovie,
+                                                    TInt aIndex );
+
+    virtual void NotifyVideoClipAudioSettingsChanged( CVedMovie& aMovie,
+                                                      TInt aIndex );
+
+    virtual void NotifyVideoClipGeneratorSettingsChanged( CVedMovie& aMovie,
+                                                          TInt aIndex );
+
+    virtual void NotifyVideoClipDescriptiveNameChanged( CVedMovie& aMovie,
+                                                        TInt aIndex );
+
+    virtual void NotifyStartTransitionEffectChanged( CVedMovie& aMovie );
+
+    virtual void NotifyMiddleTransitionEffectChanged( CVedMovie& aMovie, 
+                                                      TInt aIndex );
+
+    virtual void NotifyEndTransitionEffectChanged( CVedMovie& aMovie );
+
+    virtual void NotifyAudioClipAdded( CVedMovie& aMovie, TInt aIndex );
+
+    virtual void NotifyAudioClipAddingFailed( CVedMovie& aMovie, TInt aError );
+
+    virtual void NotifyAudioClipRemoved( CVedMovie& aMovie, TInt aIndex );
+
+    virtual void NotifyAudioClipIndicesChanged( CVedMovie& aMovie, 
+                                                TInt aOldIndex, 
+                                                TInt aNewIndex );
+
+    virtual void NotifyAudioClipTimingsChanged( CVedMovie& aMovie,
+                                                TInt aIndex );
+
+    virtual void NotifyMovieQualityChanged( CVedMovie& aMovie );
+
+    virtual void NotifyMovieReseted( CVedMovie& aMovie );
+
+    virtual void NotifyMovieOutputParametersChanged( CVedMovie& aMovie );
+
+    virtual void NotifyAudioClipDynamicLevelMarkInserted( CVedMovie& aMovie, 
+                                                          TInt aClipIndex, 
+                                                          TInt aMarkIndex );
+
+    virtual void NotifyAudioClipDynamicLevelMarkRemoved( CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex );
+
+    virtual void NotifyVideoClipDynamicLevelMarkInserted( CVedMovie& aMovie, 
+                                                          TInt aClipIndex, 
+                                                          TInt aMarkIndex );
+
+    virtual void NotifyVideoClipDynamicLevelMarkRemoved( CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex );  
+
+private:
+    // New functions
+    TInt TimeIncrement( TInt aKeyCount )const;
+
+private:
+    // Constructors
+
+    CVeiTrimForMmsContainer( CVedMovie& aMovie, CVeiTrimForMmsView& aView );
+
+    void ConstructL( const TRect& aRect );
+
+private:
+
+    /**
+     * Controls
+     */
+    enum TTrimForMmsControls
+    {
+        ECutFrame,
+        EVideoDisplayStart,
+        EVideoDisplayEnd,
+        EVideoPreview,
+        ENumberOfControls   // This is always the last one!
+    };
+
+public:
+
+    /**
+     * Preview states
+     */
+    enum TPreviewState
+    {
+        EIdle = 0,
+        ELoading,
+        EPreview,
+        EPlaying,
+        EStop,
+        EStopAndExit,
+        EOpeningFile,
+        EPause
+    };
+
+private:
+    // Data
+
+    /**
+     * Whether or not the last key pressed was left or right navi-key.
+     */
+    TBool iLastKeyLeftOrRight;
+
+    /**
+     *
+     */
+    TInt iVideoDisplayStartIndex;
+
+    /**
+     *
+     */
+    TInt iVideoDisplayEndIndex;
+
+    /**
+     *
+     */
+    TRect iVideoDisplayEndRect;
+
+    /**
+     * Text layout for main pane's end text.
+     */
+    TAknLayoutText iLayoutTextEnd;
+
+    /**
+     * Text layout for main pane's start text.
+     */
+    TAknLayoutText iLayoutTextStart;
+
+    /**
+     * Layout for start thumbnail.
+     */
+    TAknLayoutRect iLayoutRectStart;
+
+    /**
+     * Layout for end thumbnail.
+     */
+    TAknLayoutRect iLayoutRectEnd;
+
+    /**
+     * Layout for trim timeline icon.
+     */
+    TAknLayoutRect iLayoutRectIcon;
+
+    /**
+     * Layout for cut frame.
+     */
+    TAknLayoutRect iLayoutRectCutFrame;
+
+    /**
+     * Text shown above the end thumbnail.
+     */
+    HBufC* iEndText;
+
+    /**
+     * Text shown above the start thumbnail.
+     */
+    HBufC* iStartText;
+
+    /**
+     *
+     */
+    CVeiCutterBar* iCutterBar;
+    /**
+     *
+     */
+    CVedMovie& iMovie;
+
+    /**
+     *
+     */
+    CVeiVideoDisplay* iVideoDisplayStart;
+
+    /**
+     *
+     */
+    CVeiVideoDisplay* iVideoDisplayEnd;
+
+    CVeiVideoDisplay* iVideoDisplay;
+
+    TPreviewState iPreviewState;
+
+    TRect iPreviewRect;
+
+    CVeiFrameTaker* iFrameTaker;
+
+    /*
+     * Updated by NotifyVideoClipAdded( CVedMovie& aMovie, TInt aIndex ) 
+     */
+    TInt iClipIndex;
+
+    CVeiTrimForMmsView& iView;
+
+
+    TRect iStartTextBox;
+    TRect iEndTextBox;
+    TRect iVideoDisplayStartRect;
+    TRect iTimelineRect;
+    TRect iCutIconRect;
+    TRect iAdjustRect;
+
+    TPoint iCutIconPoint;
+    TSize iCutIconSize;
+
+    TTimeIntervalMicroSeconds iSeekPos;
+    TTimeIntervalMicroSeconds iSeekEndPos;
+    TTimeIntervalMicroSeconds iDuration;
+    TInt iKeyRepeatCount;
+    /** Background context. Skin stuff. */
+    CAknsBasicBackgroundControlContext* iBgContext;
+
+    CVeiDisplayLighter* iScreenLight;
+    TInt iMaxMmsSize;
+    TBool iBlack;
+
+
+    TBool iSeekEvent;
+    /**
+     * Progress dialog.
+     */
+    CAknProgressDialog* iProgressNote;
+
+    /** Progress info for the progress note. */
+    CEikProgressInfo* iProgressInfo;
+    TBool iKeyEnable;
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VeiTrimForMmsView.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,355 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+#ifndef VEITRIMFORMMSVIEW_H
+#define VEITRIMFORMMSVIEW_H
+
+// INCLUDES
+// System includes
+#include <aknview.h>    // CAknView
+#include <CAknMemorySelectionDialog.h> 
+#include <VedMovie.h>   // CVedmovie
+// User includes
+#include "VeiSettings.h"
+
+// FORWARD DECLARATIONS
+class CAknNavigationDecorator;
+class CAknProgressDialog;
+class CVeiErrorUI;
+class CSendUi;
+class CVeiTrimForMmsContainer;
+class CVedMovie;
+class CMessageData;
+class CEikProgressInfo;
+class CVeiTempMaker;
+
+
+
+// CLASS DECLARATION
+
+/**
+ *
+ */
+class CVeiTrimForMmsView: public CAknView,
+                          public MVedMovieObserver,
+                          public MVedMovieProcessingObserver
+						  
+{
+public:
+    // Constructors and destructor
+
+    static CVeiTrimForMmsView* NewL( CSendUi& aSendAppUi );
+
+    static CVeiTrimForMmsView* NewLC( CSendUi& aSendAppUi );
+
+    virtual ~CVeiTrimForMmsView();
+
+    /**
+     * Preview states
+     */
+    enum TPreviewState
+    {
+        EIdle = 0,
+        ELoading,
+        EPreview,
+        EPlaying,
+        EStop,
+        EStopAndExit,
+        EOpeningFile,
+        EPause
+    };
+
+public:
+    void UpdateNaviPaneL( const TInt& aSizeInBytes,
+                          const TTimeIntervalMicroSeconds& aTime );
+
+    void UpdateNaviPaneSize();
+
+    /**
+     * Trim states
+     */
+    enum TTrimState
+    {
+        ESeek = 0,			
+        EFullPreview
+    };
+
+    void SetTrimStateL( TTrimState aState );
+
+    /**
+     * From <code>MProgressDialogCallback</code>, callback method gets
+     * called when a dialog is dismissed.
+     *
+     * @param aButtonId  Button id.
+     */
+    virtual void DialogDismissedL( TInt aButtonId );
+    void ProcessNeeded( TBool aProcessNeed );
+
+    /**
+     * Shows global error note for given error.
+     * 
+     * @param aError No description.
+     */
+    void ShowGlobalErrorNoteL( TInt aError = 0 )const;
+
+    /** 
+     * Handles a change to the control's resources.
+     */
+    void HandleResourceChange( TInt aType );
+
+private:
+    // From CAknView
+
+    TUid Id()const;
+
+    void HandleCommandL( TInt aCommand );
+
+    void DoActivateL( const TVwsViewId& aPrevViewId,
+                      TUid aCustomMessageId,
+                      const TDesC8& aCustomMessage );
+
+    void DoDeactivate();
+
+    void HandleStatusPaneSizeChange();
+
+    void ReadSettingsL( TVeiSettings& aSettings )const;
+
+protected:
+    // From MVedMovieObserver
+
+    virtual void NotifyVideoClipAdded( CVedMovie& aMovie, TInt aIndex );
+
+    virtual void NotifyVideoClipAddingFailed( CVedMovie& aMovie, TInt aError );
+
+    virtual void NotifyVideoClipRemoved( CVedMovie& aMovie, TInt aIndex );
+
+    virtual void NotifyVideoClipIndicesChanged( CVedMovie& aMovie, 
+                                                TInt aOldIndex, 
+                                                TInt aNewIndex );
+
+    virtual void NotifyVideoClipTimingsChanged( CVedMovie& aMovie,
+                                                TInt aIndex );
+
+    virtual void NotifyVideoClipColorEffectChanged( CVedMovie& aMovie,
+                                                    TInt aIndex );
+
+    virtual void NotifyVideoClipAudioSettingsChanged( CVedMovie& aMovie,
+                                                      TInt aIndex );
+                                                      
+    virtual void NotifyVideoClipGeneratorSettingsChanged( CVedMovie& aMovie,
+                                                          TInt aIndex );
+
+    virtual void NotifyVideoClipDescriptiveNameChanged( CVedMovie& aMovie,
+                                                        TInt aIndex );
+
+    virtual void NotifyStartTransitionEffectChanged( CVedMovie& aMovie );
+
+    virtual void NotifyMiddleTransitionEffectChanged( CVedMovie& aMovie, 
+                                                      TInt aIndex );
+
+    virtual void NotifyEndTransitionEffectChanged( CVedMovie& aMovie );
+
+    virtual void NotifyAudioClipAdded( CVedMovie& aMovie, TInt aIndex );
+
+    virtual void NotifyAudioClipAddingFailed( CVedMovie& aMovie, TInt aError );
+
+    virtual void NotifyAudioClipRemoved( CVedMovie& aMovie, TInt aIndex );
+
+    virtual void NotifyAudioClipIndicesChanged( CVedMovie& aMovie, 
+                                                TInt aOldIndex,
+                                                TInt aNewIndex );
+
+    virtual void NotifyAudioClipTimingsChanged( CVedMovie& aMovie,
+                                                TInt aIndex );
+
+    virtual void NotifyMovieQualityChanged( CVedMovie& aMovie );
+
+    virtual void NotifyMovieReseted( CVedMovie& aMovie );
+
+    virtual void NotifyMovieOutputParametersChanged( CVedMovie& aMovie );
+
+    virtual void NotifyAudioClipDynamicLevelMarkInserted( CVedMovie& aMovie, 
+                                                          TInt aClipIndex, 
+                                                          TInt aMarkIndex );
+
+    virtual void NotifyAudioClipDynamicLevelMarkRemoved( CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex );
+
+    virtual void NotifyVideoClipDynamicLevelMarkInserted( CVedMovie& aMovie, 
+                                                          TInt aClipIndex, 
+                                                          TInt aMarkIndex );
+
+    virtual void NotifyVideoClipDynamicLevelMarkRemoved( CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex );  
+
+protected:
+    // From MVedMovieProcessingObserver
+
+    /**
+     * Called to notify that a new movie processing operation has been started. 
+     *
+     * @param aMovie  movie
+     */
+    void NotifyMovieProcessingStartedL( CVedMovie& aMovie );
+
+    /**
+     * Called to inform about the current progress of the movie processing operation.
+     *
+     * @param aMovie       movie
+     * @param aPercentage  percentage of the operation completed, must be 
+     *                     in range 0..100
+     */
+    void NotifyMovieProcessingProgressed( CVedMovie& aMovie, TInt aPercentage );
+
+    /**
+     * Called to notify that the movie processing operation has been completed. 
+     * 
+     * @param aMovie  movie
+     * @param aError  error code why the operation was completed. 
+     *                <code>KErrNone</code> if the operation was completed 
+     *                successfully.
+     */
+    void NotifyMovieProcessingCompleted( CVedMovie& aMovie, TInt aError );
+
+private:
+    // New functions
+
+    void CmdSoftkeyCancelL();
+
+    /**
+     * 
+     */
+    void CmdSoftkeyOkL();
+
+
+    /**
+     * Send via multimedia command handling.
+     */
+    void CmdSendViaMultimediaL();
+
+    void CmdSoftkeyBackL();
+
+    void PushKeySoundL( const TInt aResourceId )const;
+
+    void PopKeySound()const;
+
+    /**
+     * Sets the text for title pane.
+     */
+    void SetTitlePaneTextL()const;
+
+    void CreateNaviPaneL();
+
+    void SetNaviPaneDurationLabelL( const TTimeIntervalMicroSeconds& aTime );
+
+    void SetNaviPaneSizeLabelL( const TInt& aSizeInBytes );
+
+    /**
+     * Start full screen preview.
+     */
+    void PlayPreviewL();
+
+private:
+    // Constructors
+
+    CVeiTrimForMmsView( CSendUi& aSendAppUi );
+
+    void ConstructL();
+
+private:
+    // Data
+
+    /** 
+     * Cut in time in microseconds (clip timebase) for trimmed video.
+     */
+    TTimeIntervalMicroSeconds iCutInTime;
+
+    /** 
+     * Cut out time in microseconds (clip timebase) for trimmed video.
+     */
+    TTimeIntervalMicroSeconds iCutOutTime;
+
+    /**
+     * Progress note for saving the trimmed video
+     */
+    CAknProgressDialog* iProgressNote;
+
+    /**
+     * Progress info for the progress dialog.
+     */
+    CEikProgressInfo* iProgressInfo;
+
+    /**
+     * Container
+     */
+    CVeiTrimForMmsContainer* iContainer;
+
+    /**
+     * Navigation pane decorator
+     */
+    CAknNavigationDecorator* iNaviDecorator;
+
+    /**
+     *
+     */
+    CSendUi& iSendAppUi;
+
+    /**
+     *
+     */
+    CVedMovie* iVedMovie;
+
+    /**
+     * Previous view which activated this view.
+     */
+    TVwsViewId iPreviousViewId;
+
+    /**
+     * Utility class to display error notes by applications. 
+     */
+    CVeiErrorUI* iErrorUi;
+
+    /**
+     * No description.
+     */
+    CVeiTempMaker* iTempMaker;
+
+    /**
+     * Temporary file name for storing preview/send clip.
+     */
+    HBufC* iTempFile;
+
+
+    TTrimState iTrimState;
+
+    TVeiSettings iMovieSaveSettings;
+
+    /*
+     * Indecates if process needed.
+     */
+    TBool iProcessNeeded;
+
+
+
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/inc/VideoEditorHelp.hlp.hrh	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc 
+*
+* Description:  
+* This file contains all the Video Editor contextual help 
+* identifiers for the CSHelp system (implemented in 
+* HlpLauncher).
+*
+*/
+
+
+
+#ifndef __VIDEOEDITORHELP_HLP_HRH__
+#define __VIDEOEDITORHELP_HLP_HRH__
+
+// CONSTANTS
+_LIT(KVED_HLP_EDIT_VIDEO_VIEW,"VED_HLP_EDIT_VIDEO_VIEW"); //Video editing view
+_LIT(KVED_HLP_SETTINGS_VIEW,"VED_HLP_SETTINGS_VIEW"); //Settings view
+_LIT(KVED_HLP_PREVIEW_VIEW,"VED_HLP_PREVIEW_VIEW"); //Play view
+_LIT(KVED_HLP_CUT_VIDEO_VIEW,"VIE_HLP_CUT"); //Cut video view
+_LIT(KVED_HLP_CUT_AUDIO_VIEW,"VED_HLP_CUT_AUDIO_VIEW"); //Cut audio view
+_LIT(KVED_HLP_TRIM_FOR_MMS_VIEW,"VED_HLP_TRIM_FOR_MMS_VIEW"); //Trim video clip for MMS view
+
+#endif  // __VIDEOEDITORHELP_HLP_HRH__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/rom/ManualVideoEditor.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifdef RD_S60_MANUAL_VIDEO_EDITOR
+
+#ifndef __MANUALVIDEOEDITOR_IBY__
+#define __MANUALVIDEOEDITOR_IBY__
+
+
+#include <data_caging_paths_for_iby.hrh>
+
+// UI
+S60_APP_EXE(ManualVideoEditor)
+S60_APP_AIF_RSC(ManualVideoEditor)
+S60_APP_BITMAP(ManualVideoEditor)
+S60_APP_AIF_ICONS(ManualVideoEditor)
+#endif	// __MANUALVIDEOEDITOR_IBY__
+
+#endif  //  RD_S60_MANUAL_VIDEO_EDITOR
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/rom/ManualVideoEditor_resource.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifdef RD_S60_MANUAL_VIDEO_EDITOR
+
+#ifndef __MANUALVIDEOEDITORRESOURCES_IBY__
+#define __MANUALVIDEOEDITORRESOURCES_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+S60_APP_RESOURCE(ManualVideoEditor)
+S60_APP_CAPTION(ManualVideoEditor)
+
+#endif	// __MANUALVIDEOEDITORRESOURCES_IBY__
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/FileNameSettingItem.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+ 
+
+// INCLUDE FILES
+#include "FileNameSettingItem.h"
+#include <aknnotewrappers.h>
+#include <stringloader.h>
+
+
+CFileNameSettingItem::CFileNameSettingItem( TInt aIdentifier, TDes& aText,
+										   TInt aIllegalFilenameTextResourceID,
+										   TInt aUnsuitableFilenameTextResourceID )
+    :CAknTextSettingItem( aIdentifier, aText ),
+    iIllegalFilenameTextResourceID(aIllegalFilenameTextResourceID), 
+    iUnsuitableFilenameTextResourceID(aUnsuitableFilenameTextResourceID)
+    {
+    }
+
+CFileNameSettingItem::~CFileNameSettingItem()
+    {
+    if ( iTextBeforeEditing )
+        {
+        delete iTextBeforeEditing;
+        }
+    }
+
+void CFileNameSettingItem::EditItemL( TBool aCalledFromMenu )
+    {
+    if ( !iInvalidFilenameOked )
+        {
+        // Delete old buffer if allocated
+        if ( iTextBeforeEditing )
+            {
+            delete iTextBeforeEditing;
+            iTextBeforeEditing = NULL;
+            }
+        // Save the value before editing it
+        iTextBeforeEditing = HBufC::NewL( SettingTextL().Length());
+        iTextBeforeEditing->Des().Copy( SettingTextL());
+        }
+    CAknTextSettingItem::EditItemL( aCalledFromMenu );
+    }
+
+void CFileNameSettingItem::HandleSettingPageEventL( 
+                                CAknSettingPage* aSettingPage, 
+                                TAknSettingPageEvent aEventType ) 
+    {
+
+    switch ( aEventType )
+        {
+        /**
+         * Cancel event.
+         */
+        case EEventSettingCancelled:
+                {
+                if ( iInvalidFilenameOked )
+                    {
+                    iInvalidFilenameOked = EFalse; // Reset invalid filename flag
+
+                    TPtr internalText = InternalTextPtr();
+                    internalText.Delete( 0, internalText.Length());
+                    internalText.Append( *iTextBeforeEditing );
+                    StoreL();
+                    LoadL();
+                    }
+                break;
+                }
+            /**
+             * Change event.
+             */
+        case EEventSettingChanged:
+            break;
+            /**
+             * Ok event.
+             */
+        case EEventSettingOked:
+                {
+                RFs fileSystem;
+
+                CleanupClosePushL( fileSystem );
+                User::LeaveIfError( fileSystem.Connect());
+
+                TText illegalCharacter;
+
+                if ( !fileSystem.IsValidName( SettingTextL(), illegalCharacter ) )
+                    {
+                    iInvalidFilenameOked = ETrue;
+
+                    HBufC* noteText;
+
+                    // If dot keyed
+                    if ( illegalCharacter == KCharDot )
+                        {
+                        noteText = StringLoader::LoadLC( iUnsuitableFilenameTextResourceID );
+                        }
+                    else
+                        {
+                        noteText = StringLoader::LoadLC( iIllegalFilenameTextResourceID );
+                        }
+
+                    CAknWarningNote* note = new( ELeave )CAknWarningNote( ETrue );
+
+                    note->ExecuteLD( *noteText );
+                    CleanupStack::PopAndDestroy( noteText );
+
+                    EditItemL( EFalse ); // Start editing the text again.
+                    }
+                else if ( SettingTextL().Find( KCharColon ) == 1 )
+                    {
+                    iInvalidFilenameOked = ETrue;
+
+                    // Load note text from resources.
+                    HBufC* noteText = StringLoader::LoadLC( iIllegalFilenameTextResourceID );
+                        
+
+                    CAknWarningNote* note = new( ELeave )CAknWarningNote( ETrue );
+                    note->ExecuteLD( *noteText );
+
+                    CleanupStack::PopAndDestroy( noteText ); // Pop and destroy.
+
+                    EditItemL( EFalse ); // Start editing the text again.
+                    }
+                else
+                    {
+                    // Do nothing.
+                    }
+
+                CleanupStack::PopAndDestroy( &fileSystem ); 
+                break;
+                }
+        }
+    // Super class handles events.
+    CAknTextSettingItem::HandleSettingPageEventL( aSettingPage, aEventType );
+
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/SampleArrayHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+// INCLUDE FILES
+// System includes
+// User includes
+#include <e32math.h> 
+
+#include "SampleArrayHandler.h"
+#include "VideoEditorCommon.h"      // Video Editor UID
+
+#include "VideoEditorDebugUtils.h"
+
+// ================= MEMBER FUNCTIONS =======================
+CSampleArrayHandler* CSampleArrayHandler::NewL()
+    {
+    CSampleArrayHandler* self = CSampleArrayHandler::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CSampleArrayHandler* CSampleArrayHandler::NewLC()
+    {
+    CSampleArrayHandler* self = new( ELeave )CSampleArrayHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+void CSampleArrayHandler::ConstructL()
+    {
+    }
+
+CSampleArrayHandler::CSampleArrayHandler()
+    {
+    }
+
+
+CSampleArrayHandler::~CSampleArrayHandler()
+    {
+    delete [] iVisualization;
+    }
+
+void CSampleArrayHandler::SetVisualizationArray(TInt8* aVisualization, TInt aResolution)
+    {
+    LOG( KVideoEditorLogFile, "CSampleArrayHandler::SetVisualizationArray, In" );
+    iVisualization = aVisualization;
+    iVisualizationSize = aResolution;
+
+    // for testing
+    /*	for (TInt i = 0; i < iVisualizationSize; i++)
+    {
+    if (i == 127)	
+    iVisualization[i] = i - 127;
+    else
+    iVisualization[i] = i;				
+    }
+     */
+    TInt8 temp = 0; // help variable used in finding the biggest current sample value
+    for ( TInt i = 0; i < iVisualizationSize; i++ )
+        {
+        if ( iVisualization[i] > temp )
+            {
+            temp = iVisualization[i];
+            }
+        //LOGFMT2(KVideoEditorLogFile, "CSampleArrayHandler::SetVisualizationArray, SAMPLE[%d]:%d", i, iVisualization[i]);
+        }
+    iMaxSample = temp;
+
+    iScaleFactor = 1.0; // TReal
+    LOG( KVideoEditorLogFile, "CSampleArrayHandler::SetVisualizationArray, Out" );
+    }
+
+void CSampleArrayHandler::ScaleAudioVisualization( const TInt8& aNewMaxValue )
+    {
+    if ( iVisualization && ( aNewMaxValue != iMaxSampleInCurrentScale ))
+        {
+        iMaxSampleInCurrentScale = aNewMaxValue;
+        if ( !Math::IsZero(( TReal64 )iMaxSampleInCurrentScale ))
+            {
+            iScaleFactor = ( TReal64 )iMaxSampleInCurrentScale / ( TReal64 )iMaxSample; 
+
+            }
+
+        /*
+        //for testing
+        if (1 > coeff)
+        {				
+        for (TInt i = 0; i < iVisualizationSize; i++)
+        {
+        LOGFMT(KVideoEditorLogFile, "before scaling:%d", iVisualization[i]);				
+        iVisualization[i] *= coeff;		
+        LOGFMT(KVideoEditorLogFile, "after scaling:%d", iVisualization[i]);
+        }					
+        }*/
+        }
+    }
+
+TInt8 CSampleArrayHandler::Sample( const TInt aIndex )const
+    {
+    // must be scaled down in order to fit into screen			
+    if ( iScaleFactor < 1 )
+        {
+        return (( iVisualization[aIndex]* 1000 )*( iScaleFactor* 1000 )) / 1000000;
+                
+        }
+    else
+        {
+        return iVisualization[aIndex];
+        }
+    }
+
+TInt CSampleArrayHandler::Size()const
+    {
+    return iVisualizationSize;
+    }
+
+TInt CSampleArrayHandler::CurrentPoint()const
+    {
+    return iCurrentIndex;
+    }
+
+void CSampleArrayHandler::SetCurrentPoint(const TTimeIntervalMicroSeconds& aCurrentTime)
+    {
+    iCurrentTime = aCurrentTime;
+    iCurrentIndex = ( iCurrentTime.Int64() / 1000 ) / KAudioSampleInterval;
+    }
+
+void CSampleArrayHandler::SetCutInPoint(const TTimeIntervalMicroSeconds& aCutInTime)
+    {
+    iCutInTime = aCutInTime;
+    iCutInSampleIndex = ( iCutInTime.Int64() / 1000 ) / KAudioSampleInterval;
+    }
+
+void CSampleArrayHandler::SetCutOutPoint(const TTimeIntervalMicroSeconds& aCutOutTime)
+    {
+    iCutOutTime = aCutOutTime;
+    iCutOutSampleIndex = ( iCutOutTime.Int64() / 1000 ) / KAudioSampleInterval;
+    }
+
+TBool CSampleArrayHandler::SampleCutted( const TInt aIndex )const
+    {
+    return ( iCutInSampleIndex < aIndex ) && ( aIndex < iCutOutSampleIndex );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/StoryboardItems.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+
+// System includes
+#include <fbs.h>
+
+// User includes
+#include "StoryboardItems.h"
+
+// local constants
+const TInt KNoThumbnailFrameWidth = 8;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+/* **********************************************************************
+ * CStoryboardVideoItem
+ * **********************************************************************/
+CStoryboardVideoItem* CStoryboardVideoItem::NewL( const CFbsBitmap& aStartIcon, 
+                                                  const CFbsBitmap& aStartIconMask, 
+                                                  const TDesC& aFilename,
+                                                  TBool aIsFile,
+                                                  const TDesC& aAlbum )
+    {
+    CStoryboardVideoItem* self = CStoryboardVideoItem::NewLC( aStartIcon,
+        aStartIconMask, aFilename, aIsFile, aAlbum );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CStoryboardVideoItem* CStoryboardVideoItem::NewLC( const CFbsBitmap& aStartIcon, 
+                                                   const CFbsBitmap& aStartIconMask, 
+                                                   const TDesC& aFilename, 
+                                                   TBool aIsFile,
+                                                   const TDesC& aAlbum )
+    {
+    CStoryboardVideoItem* self = new( ELeave )CStoryboardVideoItem();
+    CleanupStack::PushL( self );
+    self->ConstructL( aStartIcon, aStartIconMask, aFilename, aIsFile, aAlbum );
+    return self;
+    }
+
+CStoryboardVideoItem::~CStoryboardVideoItem()
+    {
+    if ( iFilename )
+        {
+        delete iFilename;
+        }
+
+    if ( iAlbumName )
+        {
+        delete iAlbumName;
+        }
+
+    delete iIconBitmap;
+    delete iIconMask;
+
+    delete iLastFrameBitmap;
+    delete iLastFrameMask;
+
+    delete iTimelineBitmap;
+    delete iTimelineMask;
+    }
+
+CStoryboardVideoItem::CStoryboardVideoItem()
+    {
+    }
+
+void CStoryboardVideoItem::InsertLastFrameL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask )
+    {
+    delete iLastFrameBitmap;
+    iLastFrameBitmap = NULL;
+    delete iLastFrameMask;
+    iLastFrameMask = NULL;
+
+    CFbsBitmap* icon = new( ELeave )CFbsBitmap;
+    icon->Duplicate( aBitmap.Handle());
+    CFbsBitmap* mask = new( ELeave )CFbsBitmap;
+    mask->Duplicate( aMask.Handle());
+
+    iLastFrameBitmap = icon;
+    iLastFrameMask = mask;
+    }
+
+void CStoryboardVideoItem::InsertFirstFrameL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask )
+    {
+    delete iIconBitmap;
+    iIconBitmap = NULL;
+    delete iIconMask;
+    iIconMask = NULL;
+
+    CFbsBitmap* icon = new( ELeave )CFbsBitmap;
+    icon->Duplicate( aBitmap.Handle());
+    CFbsBitmap* mask = new( ELeave )CFbsBitmap;
+    mask->Duplicate( aMask.Handle());
+
+    iIconBitmap = icon;
+    iIconMask = mask;
+    }
+
+void CStoryboardVideoItem::InsertTimelineFrameL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask )
+    {
+    delete iTimelineBitmap;
+    iTimelineBitmap = NULL;
+    delete iTimelineMask;
+    iTimelineMask = NULL;
+
+    CFbsBitmap* icon = new( ELeave )CFbsBitmap;
+    icon->Duplicate( aBitmap.Handle());
+    CFbsBitmap* mask = new( ELeave )CFbsBitmap;
+    mask->Duplicate( aMask.Handle());
+
+    iTimelineBitmap = icon;
+    iTimelineMask = mask;
+    }
+
+void CStoryboardVideoItem::ConstructL( const CFbsBitmap& aStartIcon, 
+                                       const CFbsBitmap& aStartIconMask, 
+                                       const TDesC& aFilename,
+                                       TBool aIsFile,
+                                       const TDesC& aAlbum )
+    {
+    CFbsBitmap* icon = new( ELeave )CFbsBitmap;
+    icon->Duplicate( aStartIcon.Handle());
+    CFbsBitmap* mask = new( ELeave )CFbsBitmap;
+    mask->Duplicate( aStartIconMask.Handle());
+
+    TSize thumbResolution;
+	thumbResolution.iWidth = ( aStartIcon.SizeInPixels() ).iWidth-KNoThumbnailFrameWidth;
+	thumbResolution.iHeight = ( aStartIcon.SizeInPixels() ).iHeight-KNoThumbnailFrameWidth;
+
+    iIconSize = thumbResolution;
+    iIconBitmap = icon;
+    iIconMask = mask;
+
+    iFilename = HBufC::NewL( aFilename.Length());
+    *iFilename = aFilename;
+
+    iAlbumName = HBufC::NewL( aAlbum.Length());
+    *iAlbumName = aAlbum;
+
+    iDateModified.HomeTime();
+    iIsFile = aIsFile;
+    }
+
+/* **********************************************************************
+ * CStoryboardAudioItem
+ * **********************************************************************/
+
+CStoryboardAudioItem* CStoryboardAudioItem::NewLC( TBool aRecordedAudio, 
+                                                   const TDesC& aFilename )
+    {
+    CStoryboardAudioItem* self = new( ELeave )CStoryboardAudioItem(
+                                     aRecordedAudio );
+    CleanupStack::PushL( self );
+    self->ConstructL( aFilename );
+    return self;
+    }
+
+
+CStoryboardAudioItem::~CStoryboardAudioItem()
+    {
+    delete iFilename;
+    }
+
+
+CStoryboardAudioItem::CStoryboardAudioItem(TBool aRecordedAudio)
+                                            : iRecordedAudio(aRecordedAudio)
+    {
+    }
+
+void CStoryboardAudioItem::ConstructL( const TDesC& aFilename )
+    {
+    iFilename = HBufC::NewL( aFilename.Length());
+    *iFilename = aFilename;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/TransitionInfo.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+
+// System includes
+#include <manualvideoeditor.rsg>
+#include <stringloader.h>
+#include <eikenv.h>
+
+// User includes
+#include "TransitionInfo.h"
+#include "VideoEditorDebugUtils.h"
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+/* **********************************************************************
+ * CTransitionInfo
+ * **********************************************************************/
+
+
+CTransitionInfo* CTransitionInfo::NewL()
+    {
+    CTransitionInfo* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CTransitionInfo* CTransitionInfo::NewLC()
+    {
+    CTransitionInfo* self = new( ELeave )CTransitionInfo;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+CTransitionInfo::CTransitionInfo()
+    {
+    }
+
+void CTransitionInfo::ConstructL()
+    {
+    LOG( KVideoEditorLogFile, "CTransitionInfo::ConstructL: in" );
+
+    HBufC* buf;
+    CEikonEnv* eikonEnv = CEikonEnv::Static();
+
+    /* Load start transition effect names. */
+    buf = StringLoader::LoadLC( R_VEI_START_TRANSITION_EFFECT_NAME_NONE, eikonEnv );
+    User::LeaveIfError( iStartTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+    buf = StringLoader::LoadLC( R_VEI_START_TRANSITION_EFFECT_NAME_FADE_FROM_BLACK, eikonEnv );
+    User::LeaveIfError( iStartTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+    buf = StringLoader::LoadLC( R_VEI_START_TRANSITION_EFFECT_NAME_FADE_FROM_WHITE, eikonEnv );
+    User::LeaveIfError( iStartTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+
+    /* Load middle transition effect names. */
+    buf = StringLoader::LoadLC( R_VEI_MIDDLE_TRANSITION_EFFECT_NAME_NONE, eikonEnv );
+    User::LeaveIfError( iMiddleTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+    buf = StringLoader::LoadLC( R_VEI_MIDDLE_TRANSITION_EFFECT_NAME_DIP_TO_BLACK, eikonEnv );
+    User::LeaveIfError( iMiddleTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+    buf = StringLoader::LoadLC( R_VEI_MIDDLE_TRANSITION_EFFECT_NAME_DIP_TO_WHITE, eikonEnv );
+    User::LeaveIfError( iMiddleTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+    buf = StringLoader::LoadLC( R_VEI_MIDDLE_TRANSITION_EFFECT_NAME_CROSSFADE, eikonEnv );
+    User::LeaveIfError( iMiddleTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+    buf = StringLoader::LoadLC( R_VEI_MIDDLE_TRANSITION_EFFECT_NAME_WIPE_LEFT, eikonEnv );
+    User::LeaveIfError( iMiddleTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+    buf = StringLoader::LoadLC( R_VEI_MIDDLE_TRANSITION_EFFECT_NAME_WIPE_RIGHT, eikonEnv );
+    User::LeaveIfError( iMiddleTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+    buf = StringLoader::LoadLC( R_VEI_MIDDLE_TRANSITION_EFFECT_NAME_WIPE_TOP, eikonEnv );
+    User::LeaveIfError( iMiddleTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+    buf = StringLoader::LoadLC( R_VEI_MIDDLE_TRANSITION_EFFECT_NAME_WIPE_BOTTOM, eikonEnv );
+    User::LeaveIfError( iMiddleTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+
+
+    /* Load end transition effect names. */
+    buf = StringLoader::LoadLC( R_VEI_END_TRANSITION_EFFECT_NAME_NONE, eikonEnv );
+    User::LeaveIfError( iEndTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+    buf = StringLoader::LoadLC( R_VEI_END_TRANSITION_EFFECT_NAME_FADE_TO_BLACK, eikonEnv );
+    User::LeaveIfError( iEndTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+    buf = StringLoader::LoadLC( R_VEI_END_TRANSITION_EFFECT_NAME_FADE_TO_WHITE, eikonEnv );
+    User::LeaveIfError( iEndTransitionNameArray.Append( buf ));
+    CleanupStack::Pop( buf );
+
+    LOG( KVideoEditorLogFile, "CTransitionInfo::ConstructL: out" );
+    }
+
+CTransitionInfo::~CTransitionInfo()
+    {
+    iStartTransitionNameArray.ResetAndDestroy();
+    iMiddleTransitionNameArray.ResetAndDestroy();
+    iEndTransitionNameArray.ResetAndDestroy();
+    }
+
+HBufC* CTransitionInfo::StartTransitionName( TVedStartTransitionEffect aEffect )
+    {
+    return iStartTransitionNameArray[aEffect - ( TInt )EVedStartTransitionEffectNone];
+    }
+
+HBufC* CTransitionInfo::MiddleTransitionName( TVedMiddleTransitionEffect aEffect )
+    {
+    return iMiddleTransitionNameArray[aEffect - ( TInt )EVedMiddleTransitionEffectNone];
+    }
+
+HBufC* CTransitionInfo::EndTransitionName( TVedEndTransitionEffect aEffect )
+    {
+    return iEndTransitionNameArray[aEffect - ( TInt )EVedEndTransitionEffectNone];
+    }
+    
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiApp.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <eikstart.h>
+// User includes
+#include "VeiApp.h"
+#include "VeiDocument.h"
+#include "VideoEditorCommon.h"  // Application UID
+#include "VideoEditorDebugUtils.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+//
+// ---------------------------------------------------------
+// NewApplication() 
+// Constructs CVeiApp
+// Returns: created application object
+// ---------------------------------------------------------
+//
+EXPORT_C CApaApplication* NewApplication()
+    {
+    return new CVeiApp;
+    }
+
+GLDEF_C TInt E32Main()
+    {
+    return EikStart::RunApplication( NewApplication );
+    }
+
+// ---------------------------------------------------------
+// CVeiApp::AppDllUid()
+// Returns application UID
+// ---------------------------------------------------------
+//
+TUid CVeiApp::AppDllUid()const
+    {
+    return KUidVideoEditor;
+    }
+
+
+// ---------------------------------------------------------
+// CVeiApp::CreateDocumentL()
+// Creates CVeiDocument object
+// ---------------------------------------------------------
+//
+CApaDocument* CVeiApp::CreateDocumentL()
+    {
+    LOG_RESET( KVideoEditorLogFile );
+    return CVeiDocument::NewL( *this );
+    }
+
+// --------------------------------------------------------- 
+// CVeiApp::OpenIniFileLC( RFs& aFs ) 
+// Enables INI file creation 
+// Returns: 
+// --------------------------------------------------------- 
+// 
+CDictionaryStore* CVeiApp::OpenIniFileLC( RFs& aFs )const
+    {
+    //Opens the application’s ini file if it exists. If an ini
+    //file does not exist for this application, or if it is corrupt,
+    //this function creates a new ini file and opens that.
+    //ini files are located on KIniFileDrive (by default, c:),
+    //in the same directory as the application DLL.
+
+    return CEikApplication::OpenIniFileLC( aFs );
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiAppUi.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+// INCLUDE FILES
+// System includes
+#include <avkon.hrh>
+#include <eikmenup.h>
+#include <eikenv.h>
+#include <hlplch.h>     // HlpLauncher
+#include <manualvideoeditor.rsg>
+#include <sendui.h>     // CSendAppUi 
+#include <stringloader.h>
+#include <bautils.h>
+#include <apparc.h>
+
+// User includes
+#include "manualvideoeditor.hrh"
+#include "VeiAppUi.h"
+#include "VeiEditVideoView.h"
+#include "VeiSettingsView.h"
+#include "VeiCutVideoView.h"
+#include "VeiCutAudioView.h"
+#include "VeiTrimForMmsView.h"
+#include "VeiTempMaker.h"
+#include "VideoEditorCommon.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ----------------------------------------------------------
+// CVeiAppUi::ConstructL()
+// ?implementation_description
+// ----------------------------------------------------------
+//
+void CVeiAppUi::ConstructL()
+    {
+    LOG( KVideoEditorLogFile, "CVeiAppUi::ConstructL In" );
+
+   	BaseConstructL( EAppOrientationAutomatic | EAknEnableSkin );
+
+    CVeiTempMaker* maker = CVeiTempMaker::NewL();
+    maker->EmptyTempFolder();
+    delete maker;
+
+    iSendAppUi = CSendUi::NewL();
+    /*
+     *	Cut video view and Cut audio view are references to edit video view and
+     *	ownerships must be transfered(AddViewL(...)) to CAknViewAppUi(this) 
+     *	AFTER references are taken to edit video view. Otherwise exit is not clean.
+     */
+
+    // Cut Video view
+    iCutVideoView = new( ELeave )CVeiCutVideoView;
+    iCutVideoView->ConstructL();
+
+    // Cut Audio view
+    iCutAudioView = CVeiCutAudioView::NewL();
+
+    // Edit Video view
+    iEditVideoView = CVeiEditVideoView::NewL( *iCutVideoView, * iCutAudioView, * iSendAppUi );
+        
+    AddViewL( iEditVideoView ); // transfer ownership to CAknViewAppUi
+    LOG( KVideoEditorLogFile, "CVeiAppUi::ConstructL EditVideoView OK" );
+
+    AddViewL( iCutAudioView );
+    LOG( KVideoEditorLogFile, "CVeiAppUi::ConstructL CutAudioView OK" );
+
+    AddViewL( iCutVideoView ); // transfer ownership to CAknViewAppUi
+    LOG( KVideoEditorLogFile, "CVeiAppUi::ConstructL CutVideoView OK" );
+
+    //Trim for MMS view
+    iTrimForMmsView = CVeiTrimForMmsView::NewL( *iSendAppUi );
+    AddViewL( iTrimForMmsView ); // Transfer ownership to CAknViewAppUi
+    LOG( KVideoEditorLogFile, "CVeiAppUi::ConstructL TrimForMmsView OK" );
+
+    //Settings view
+    iSettingsView = CVeiSettingsView::NewL();
+    AddViewL( iSettingsView ); // Transfer ownership to CAknViewAppUi
+    LOG( KVideoEditorLogFile, "CVeiAppUi::ConstructL SettingsView OK" );
+
+    iVolume =  - 1; // Volume not set
+
+    iCoeEnv->RootWin().EnableScreenChangeEvents();
+
+    SetDefaultViewL( *iEditVideoView );
+
+    LOG( KVideoEditorLogFile, "CVeiAppUi::ConstructL Out" );
+    }
+
+// ----------------------------------------------------
+// CVeiAppUi::~CVeiAppUi()
+// Destructor
+// Frees reserved resources
+// ----------------------------------------------------
+//
+CVeiAppUi::~CVeiAppUi()
+    {
+    LOG( KVideoEditorLogFile, "CVeiAppUi::~CVeiAppUi: In" );
+   
+    delete iSendAppUi;
+
+    LOG( KVideoEditorLogFile, "CVeiAppUi::~CVeiAppUi: Out" );
+    }
+
+//=============================================================================
+CVeiAppUi::CVeiAppUi()
+    {
+    }
+
+//=============================================================================
+void CVeiAppUi::InsertVideoClipToMovieL( TBool aDoOpen, const TDesC& aFilename )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiAppUi::InsertVideoClipTomovieL (%S)", &aFilename );
+           
+
+    if ( iEditVideoView )
+        {
+        iEditVideoView->AddClipL( aFilename, aDoOpen );
+        }
+    }
+
+// ----------------------------------------------------
+// CVeiAppUi::HandleKeyEventL(
+//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
+// ?implementation_description
+// ----------------------------------------------------
+//
+TKeyResponse CVeiAppUi::HandleKeyEventL( const TKeyEvent&  /*aKeyEvent*/,
+                                         TEventCode /*aType*/ )
+    {
+    return EKeyWasNotConsumed;
+    }
+
+
+// ----------------------------------------------------
+// CVeiAppUi::HandleCommandL(TInt aCommand)
+// ?implementation_description
+// ----------------------------------------------------
+//
+void CVeiAppUi::HandleCommandL( TInt aCommand )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiAppUi::HandleCommandL( %d ): In", aCommand );
+           
+    switch ( aCommand )
+        {
+        //
+        // Context Sensitive Help launching for:
+        //  -'Settings' view
+        //  -'Trim for MMS' view
+        //  -'Edit video' view
+        //  -'Cut video' view
+        //  -'Cut audio' view
+        //
+        case EAknCmdHelp:
+        case EVeiCmdSettingsViewHelp:
+        case EVeiCmdTrimForMmsViewHelp:
+        case EVeiCmdEditVideoViewHelp:
+        case EVeiCmdCutVideoViewHelp:
+                {
+                // Get the current context
+                CArrayFix < TCoeHelpContext > * context = AppHelpContextL();
+
+                // Launch the help application with current context topic
+                HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
+                    context );
+                break;
+                }
+        case EAknSoftkeyBack:
+        case EEikCmdExit:
+        case EAknSoftkeyExit:
+        case EAknCmdExit:
+                {
+                iOnTheWayToDestruction = ETrue;
+
+                CVeiTempMaker* maker = CVeiTempMaker::NewL();
+                maker->EmptyTempFolder();
+                delete maker;
+
+                iEditVideoView->HandleCommandL( EAknSoftkeyOk );
+                Exit();
+                break;
+                }
+        default:
+            break;
+        }
+    LOG( KVideoEditorLogFile, "CVeiAppUi::HandleCommandL: Out" );
+    }
+
+//=============================================================================
+void CVeiAppUi::ReadSettingsL( TVeiSettings& aSettings )const
+    {
+    LOG( KVideoEditorLogFile, "CVeiAppUi::ReadSettingsL: in" );
+    CDictionaryStore* store = Application()->OpenIniFileLC( iCoeEnv->FsSession() );
+        
+
+    TBool storePresent = store->IsPresentL( KUidVideoEditor );  // UID has an associated stream?
+
+    if ( storePresent )
+        {
+        RDictionaryReadStream readStream;
+        readStream.OpenLC( *store, KUidVideoEditor );
+
+        readStream >> aSettings; // Internalize data to TVeiSettings.
+
+        CleanupStack::PopAndDestroy( &readStream );
+        }
+    else
+        {
+        /* Read the default filenames from resources */
+        HBufC* videoName = iEikonEnv->AllocReadResourceLC( R_VEI_SETTINGS_VIEW_SETTINGS_ITEM_VALUE );
+
+        const CFont* myFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+
+        aSettings.DefaultVideoName() = AknTextUtils::ChooseScalableText( videoName->Des(), * myFont, 400 );
+        CleanupStack::PopAndDestroy( videoName );
+
+        HBufC* snapshotName = iEikonEnv->AllocReadResourceLC( R_VEI_SETTINGS_VIEW_SETTINGS_ITEM2_VALUE );
+            
+        aSettings.DefaultSnapshotName() = AknTextUtils::ChooseScalableText( snapshotName->Des(), * myFont, 400 );
+        CleanupStack::PopAndDestroy( snapshotName );
+
+        /* Memory card is used as a default target */
+        aSettings.MemoryInUse() = CAknMemorySelectionDialog::EMemoryCard;
+
+        /* Set save quality to "Auto" by default. */
+        aSettings.SaveQuality() = TVeiSettings::EAuto;
+
+        RDictionaryWriteStream writeStream;
+        writeStream.AssignLC( *store, KUidVideoEditor );
+
+        writeStream << aSettings;
+
+        writeStream.CommitL();
+
+        store->CommitL();
+
+        CleanupStack::PopAndDestroy( &writeStream ); 
+        }
+    CleanupStack::PopAndDestroy( store );
+    LOG( KVideoEditorLogFile, "CVeiAppUi::ReadSettingsL: out" );
+    }
+
+//=============================================================================
+void CVeiAppUi::WriteSettingsL( const TVeiSettings& aSettings )const
+    {
+    LOG( KVideoEditorLogFile, "CVeiAppUi::WriteSettingsL: in" );
+    CDictionaryStore* store = Application()->OpenIniFileLC( iCoeEnv->FsSession() );
+
+    RDictionaryWriteStream writeStream;
+    writeStream.AssignLC( *store, KUidVideoEditor );
+    writeStream << aSettings;
+    writeStream.CommitL();
+
+    store->CommitL();
+
+    CleanupStack::PopAndDestroy( &writeStream );
+    CleanupStack::PopAndDestroy( &store );    
+    LOG( KVideoEditorLogFile, "CVeiAppUi::WriteSettingsL: out" );
+    }
+
+//=============================================================================
+void CVeiAppUi::HandleScreenDeviceChangedL()
+    {
+    LOG( KVideoEditorLogFile, "CVeiAppUi::HandleScreenDeviceChangedL: In" );
+    CAknViewAppUi::HandleScreenDeviceChangedL();
+    if ( iEditVideoView )
+        {
+        iEditVideoView->HandleScreenDeviceChangedL();
+        }
+    LOG( KVideoEditorLogFile, "CVeiAppUi::HandleScreenDeviceChangedL: Out" );
+    }
+
+//=============================================================================
+void CVeiAppUi::HandleResourceChangeL( TInt aType )
+    {
+    LOG( KVideoEditorLogFile, "CVeiAppUi::HandleResourceChangeL: In" );
+    CAknAppUi::HandleResourceChangeL( aType );
+    if ( iEditVideoView )
+        {
+        iEditVideoView->HandleResourceChange( aType );
+        }
+    if ( iCutVideoView )
+        {
+        iCutVideoView->HandleResourceChange( aType );
+        }
+    if ( iCutAudioView )
+        {
+        iCutAudioView->HandleResourceChange( aType );
+        }
+    if ( iTrimForMmsView )
+        {
+        iTrimForMmsView->HandleResourceChange( aType );
+        }
+    LOG( KVideoEditorLogFile, "CVeiAppUi::HandleResourceChangeL: Out" );
+    }
+
+//=============================================================================
+void CVeiAppUi::HandleFileNotificationEventL()
+    {
+    LOG( KVideoEditorLogFile, "CVeiAppUi::HandleFileNotificationEventL: In" );
+    if ( iEditVideoView )
+        {
+        if ( iEditVideoView->WaitMode() == CVeiEditVideoView ::EProcessingMovieSaveThenQuit )
+            {
+            HandleCommandL( EAknCmdExit );
+            }
+        }
+    LOG( KVideoEditorLogFile, "CVeiAppUi::HandleFileNotificationEventL: Out" );
+    }
+
+//=============================================================================
+void CVeiAppUi::HandleForegroundEventL( TBool aForeground )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiAppUi::HandleForegroundEventL: In: %d", aForeground );
+    CAknViewAppUi::HandleForegroundEventL( aForeground );
+    if ( !aForeground )
+        {
+        // Set the priority to low. This is needed to handle the situations 
+        // where the engine is performing heavy processing while the application 
+        // is in background.
+        RProcess myProcess;
+        iOriginalProcessPriority = myProcess.Priority();
+        LOGFMT3( KVideoEditorLogFile, 
+                "CVeiAppUi::HandleForegroundEventL: changing priority of process %Ld from %d to %d", myProcess.Id().Id(), iOriginalProcessPriority, EPriorityLow );
+        myProcess.SetPriority( EPriorityLow );
+        iProcessPriorityAltered = ETrue;
+        }
+    else if ( iProcessPriorityAltered )
+        {
+        // Return to normal priority.
+        RProcess myProcess;
+        TProcessPriority priority = myProcess.Priority();
+        if ( priority < iOriginalProcessPriority )
+            {
+            myProcess.SetPriority( iOriginalProcessPriority );
+            }
+        iProcessPriorityAltered = EFalse;
+        LOGFMT2( KVideoEditorLogFile, 
+                "CVeiAppUi::HandleForegroundEventL: process %Ld back to normal priority %d", myProcess.Id().Id(), priority );
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiAppUi::HandleForegroundEventL: Out" );
+    }
+
+//=============================================================================
+TErrorHandlerResponse CVeiAppUi::HandleError ( TInt aError,
+                                               const SExtendedError & aExtErr,
+                                               TDes & aErrorText,
+                                               TDes & aContextText )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiAppUi::HandleError: %d", aError );
+
+    // Let the framework handle errors
+	return CAknViewAppUi::HandleError ( aError, aExtErr, aErrorText, aContextText );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiCutAudioContainer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1296 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+// System includes
+#include <manualvideoeditor.rsg>
+#include <videoeditoruicomponents.mbg>
+#include <eikbtgpc.h>
+#include <coemain.h>
+#include <eikenv.h>
+#include <aknsbasicbackgroundcontrolcontext.h> 
+#include <aknsdrawutils.h> 
+#include <aknsdatacontext.h> 
+#include <stringloader.h>
+#include <aknnotewrappers.h> 
+#include <MdaAudioSamplePlayer.h>
+#include <eikprogi.h>
+#include <audiopreference.h>
+#include <aknlayoutscalable_avkon.cdl.h>
+#include <aknlayoutscalable_apps.cdl.h>
+// User includes
+#include "manualvideoeditor.hrh"
+#include "VeiAppUi.h"
+#include "VeiCutAudioContainer.h"
+#include "VeiCutAudioView.h"
+#include "VeiCutterBar.h"
+#include "veitextdisplay.h"
+#include "VideoEditorCommon.h"      // Video Editor UID
+#include "VideoEditorHelp.hlp.hrh"  // Topic contexts (literals)
+#include "VeiVideoEditorSettings.h"
+#include "VideoEditorUtils.h"
+#include "SampleArrayHandler.h"
+#include "VeiErrorUi.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+CVeiCutAudioContainer* CVeiCutAudioContainer::NewL( const TRect& aRect, CVeiCutAudioView& aView, CVeiErrorUI& aErrorUI )
+    {
+    CVeiCutAudioContainer* self = CVeiCutAudioContainer::NewLC( aRect, aView, aErrorUI );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CVeiCutAudioContainer* CVeiCutAudioContainer::NewLC( const TRect& aRect, CVeiCutAudioView& aView, CVeiErrorUI& aErrorUI )
+    {
+    CVeiCutAudioContainer* self = new (ELeave) CVeiCutAudioContainer( aRect, aView, aErrorUI );
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect, aView, aErrorUI );
+    return self;
+    }
+
+void CVeiCutAudioContainer::ConstructL( const TRect& aRect, CVeiCutAudioView& /*aView*/, CVeiErrorUI& /*aErrorUI*/ )
+    {
+    CreateWindowL();
+
+    iState = EStateInitializing;
+    iFrameReady = EFalse;
+
+    iSeekPos = TTimeIntervalMicroSeconds( 0 );
+    iSeeking = EFalse;
+    iCutAudioBar = CVeiCutterBar::NewL( this );
+    iCutTimeDisplay = CVeiTextDisplay::NewL( iCutTimeDisplayRect, this );
+
+    iPreviousScreenMode = -1;
+    iCurrentScreenMode = -1;
+
+    TFileName mbmPath( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) );
+
+    AknIconUtils::CreateIconL( iPauseBitmap, iPauseBitmapMask,
+        mbmPath, EMbmVideoeditoruicomponentsQgn_prop_ve_pause, 
+        EMbmVideoeditoruicomponentsQgn_prop_ve_pause_mask );
+
+    SetRect( aRect );
+
+    iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse );
+
+    iAudioSamplePlayer = CMdaAudioPlayerUtility::NewL( *this,EMdaPriorityMax, 
+        TMdaPriorityPreference( KAudioPrefVideoRecording ) );
+
+    iVideoBarTimer = CPeriodic::NewL( CActive::EPriorityLow );
+
+    iSampleArrayHandler = CSampleArrayHandler::NewL();
+
+    EnableDragEvents();
+
+    ActivateL();
+    }
+
+CVeiCutAudioContainer::CVeiCutAudioContainer( const TRect& /*aRect*/, CVeiCutAudioView& aView, CVeiErrorUI& aErrorUI ):iView( aView ), iErrorUI( aErrorUI )
+    {
+    }       
+
+void CVeiCutAudioContainer::OpenAudioFileL( const TDesC& aFileName )
+    {
+    if ( iAudioSamplePlayer )
+        {
+        iAudioSamplePlayer->OpenFileL( aFileName );
+        }
+    GetVisualizationL();
+    }
+
+CVeiCutAudioContainer::~CVeiCutAudioContainer()
+    {
+    if ( iProgressNote )
+        {
+        delete iProgressNote;
+        iProgressNote = NULL;
+        }
+    if ( iCutAudioBar )
+        {
+        delete iCutAudioBar;
+        }
+    if ( iCutTimeDisplay )
+        {
+        delete iCutTimeDisplay;
+        }
+    if ( iBgContext )
+        {
+        delete iBgContext;
+        }
+    delete iPauseBitmap;
+    delete iPauseBitmapMask;
+
+    if ( iVideoBarTimer )
+        {
+        iVideoBarTimer->Cancel();
+        delete iVideoBarTimer;
+        }
+    if ( iAudioSamplePlayer )
+        {
+        delete iAudioSamplePlayer;
+        }
+    if (iSampleArrayHandler)
+        {
+        delete iSampleArrayHandler;
+        }
+        
+    delete iCallBack;
+
+    delete iBufBitmap;
+    iBufBitmap = NULL;
+
+    delete iRemConTarget;
+    }
+
+void CVeiCutAudioContainer::SizeChanged()
+    {
+    TSize videoScreenSize;
+    TRect rect( Rect() ); 
+    if ( iBgContext )
+        {
+        iBgContext->SetRect( rect );
+        }
+
+    iPreviousScreenMode = iCurrentScreenMode;
+    iCurrentScreenMode = iEikonEnv->ScreenDevice()->CurrentScreenMode();
+
+
+	// Scissor icon
+	TAknLayoutRect scissorsIconLayout;
+	scissorsIconLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::main_vded_pane_g1());
+	iCutAudioBar->SetComponentRect(CVeiCutterBar::EScissorsIcon, scissorsIconLayout.Rect());
+		
+	// Progress bar
+	TAknLayoutRect progressBarLayout; 
+	progressBarLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded_slider_pane());
+	iCutAudioBar->SetComponentRect(CVeiCutterBar::EProgressBar, progressBarLayout.Rect());
+
+	// left end of the slider when that part is unselected
+	TAknLayoutRect sliderLeftEndLayout;
+	sliderLeftEndLayout.LayoutRect( progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g3() );
+	iCutAudioBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, sliderLeftEndLayout.Rect() );
+		
+	// middle part of the slider when that part is unselected	
+	TAknLayoutRect sliderMiddleLayout;
+	sliderMiddleLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g5());
+	iCutAudioBar->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon, sliderMiddleLayout.Rect() );		
+	
+	// right end of the slider when that part is unselected
+	TAknLayoutRect sliderRightEndLayout;
+	sliderRightEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g4());
+	iCutAudioBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon, sliderRightEndLayout.Rect() );	
+		
+	// left end of the cut selection slider 
+	TAknLayoutRect sliderSelectedLeftEndLayout;
+	sliderSelectedLeftEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g3());
+	iCutAudioBar->SetComponentRect( CVeiCutterBar::ESliderSelectedLeftEndIcon, sliderSelectedLeftEndLayout.Rect() );
+		
+	// middle part of the cut selection slider 
+	TAknLayoutRect sliderSelectedMiddleLayout;
+	sliderSelectedMiddleLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g5());
+	iCutAudioBar->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon, sliderSelectedMiddleLayout.Rect() );		
+	
+	// right end of the cut selection slider 
+	TAknLayoutRect sliderSelectedRightEndLayout;
+	sliderSelectedRightEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g4());
+	iCutAudioBar->SetComponentRect( CVeiCutterBar::ESliderSelectedRightEndIcon, sliderSelectedRightEndLayout.Rect() ); 
+
+    // playhead
+    TAknLayoutRect playheadLayout;
+	playheadLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g1());
+	iCutAudioBar->SetComponentRect( CVeiCutterBar::EPlayheadIcon, playheadLayout.Rect() ); 
+
+    // left/right border of cut selection slider
+    TAknLayoutRect cutAreaBorderLayout;
+	cutAreaBorderLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g2());
+	iCutAudioBar->SetComponentRect( CVeiCutterBar::ECutAreaBorderIcon, cutAreaBorderLayout.Rect() ); 
+		
+		
+	// Start cut time text
+	TAknLayoutText startTimeTextLayout;
+	startTimeTextLayout.LayoutText(rect, AknLayoutScalable_Apps::main_vded_pane_t1() );
+	iCutTimeDisplay->SetComponentRect(CVeiTextDisplay::EStartTimeText, startTimeTextLayout.TextRect());
+	
+	// End cut time text
+	TAknLayoutText endTimeTextLayout;
+	endTimeTextLayout.LayoutText(rect, AknLayoutScalable_Apps::main_vded_pane_t2() );
+	iCutTimeDisplay->SetComponentRect(CVeiTextDisplay::EEndTimeText, endTimeTextLayout.TextRect());
+	
+	// Start cut time icon
+	TAknLayoutRect startTimeIconLayout;
+	startTimeIconLayout.LayoutRect(rect, AknLayoutScalable_Apps::main_vded_pane_g2() );
+	iCutTimeDisplay->SetComponentRect(CVeiTextDisplay::EStartTimeIcon, startTimeIconLayout.Rect());
+	
+	// End cut time icon
+	TAknLayoutRect endTimeIconLayout;
+	endTimeIconLayout.LayoutRect(rect, AknLayoutScalable_Apps::main_vded_pane_g3() );
+	iCutTimeDisplay->SetComponentRect(CVeiTextDisplay::EEndTimeIcon, endTimeIconLayout.Rect());
+		
+	// Pause icon
+	
+
+
+	// Video Display	
+	TAknLayoutRect videoDisplayLayout;
+	videoDisplayLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded_video_pane());
+
+	iIconDisplayRect = videoDisplayLayout.Rect();
+	LOGFMT2(KVideoEditorLogFile, "CVeiCutAudioContainer::SizeChanged(): iIconDisplayRect: %d,%d", iIconDisplayRect.iBr.iX, iIconDisplayRect.iBr.iY);
+
+	//CVeiCutterBar
+	// : Change this when LAF data is ready
+	TPoint cutBarTl = TPoint(STATIC_CAST( TInt, rect.iBr.iX*0.0114 ),
+		STATIC_CAST( TInt, rect.iBr.iY*0.875 ) );
+	TSize cutBarSize = TSize(STATIC_CAST( TInt, rect.iBr.iX*0.9773 ),
+		STATIC_CAST( TInt, rect.iBr.iY*0.0973 ) );
+
+	TRect cutBarRect( cutBarTl, cutBarSize );
+	iCutAudioBar->SetRect( cutBarRect );
+
+	//CVeiTextDisplay
+	// : Change this when LAF data is ready
+	TPoint cutTimeDisplayTl = TPoint(cutBarTl.iX,
+		STATIC_CAST( TInt, rect.iBr.iY*0.757 ) );
+	TSize cutTimeDisplaySize = TSize(cutBarSize.iWidth,
+		STATIC_CAST( TInt, rect.iBr.iY*0.0903 ) );
+
+	iCutTimeDisplayRect = TRect( cutTimeDisplayTl, cutTimeDisplaySize );
+	iCutTimeDisplay->SetRect( iCutTimeDisplayRect );
+	iCutTimeDisplay->SetLayout( CVeiTextDisplay::ECutInCutOut );
+
+
+
+    TInt iconWidth = STATIC_CAST( TInt, rect.iBr.iX * 0.07954545455 );
+    AknIconUtils::SetSize( iPauseBitmap, TSize(iconWidth,iconWidth), EAspectRatioNotPreserved );
+
+    //  Create buffer bitmap with the correct size
+    if (iBufBitmap)
+        {
+        delete iBufBitmap;
+        iBufBitmap = NULL;
+        }
+    TSize size = Rect().Size();
+    TDisplayMode dmode = EColor64K;
+    // " ... If the instantiation process really needs 
+    // not to leave, use "new CXxx" and check for NULL."
+    iBufBitmap = new CFbsBitmap;
+    TInt err = KErrNone;
+    if (iBufBitmap)
+        {
+        err = iBufBitmap->Create(size, dmode);
+        }
+
+    if (iState != EStateInitializing && !err)
+        {
+        TRAP_IGNORE( DrawToBufBitmapL() );
+        }
+    }
+
+
+TTypeUid::Ptr CVeiCutAudioContainer::MopSupplyObject( TTypeUid aId )
+    {
+    if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext )
+        {
+        return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+        }
+    return CCoeControl::MopSupplyObject( aId );
+    }
+
+TInt CVeiCutAudioContainer::CountComponentControls() const
+    {
+    return 2;
+    }
+
+CCoeControl* CVeiCutAudioContainer::ComponentControl( TInt aIndex ) const
+    {
+    switch ( aIndex )
+        {
+        case 0:
+            return iCutAudioBar;
+        case 1:
+            return iCutTimeDisplay;
+        default:
+            return NULL;
+        }
+    }
+
+void CVeiCutAudioContainer::DrawToBufBitmapL()
+    {
+    //  Create bitmap graphics context
+    CFbsBitmapDevice * bitmapDevice = CFbsBitmapDevice::NewL (iBufBitmap);
+    CleanupStack::PushL (bitmapDevice);
+    CFbsBitGc * bitmapContext = 0;
+    User::LeaveIfError (bitmapDevice->CreateContext (bitmapContext));
+    CleanupStack::PushL (bitmapContext);
+    CGraphicsContext * graphicsContext = 0;
+    User::LeaveIfError (bitmapDevice->CreateContext (graphicsContext));
+    CleanupStack::PushL (graphicsContext);
+
+    // Draw skin background
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );    
+    AknsDrawUtils::DrawBackground( skin, cc, this, *((CBitmapContext*)graphicsContext), TPoint(0,0), Rect(), KAknsDrawParamDefault );
+
+    if ( iState == EStatePaused )
+        {
+        TPoint pauseIconTl = TPoint( iIconDisplayRect.iTl.iX - STATIC_CAST( TInt, Rect().iBr.iX*0.105),
+            iIconDisplayRect.iTl.iY + STATIC_CAST( TInt, Rect().iBr.iY*0.178 ));
+        bitmapContext->BitBltMasked( pauseIconTl, iPauseBitmap, 
+            TRect( TPoint(0,0), iPauseBitmap->SizeInPixels() ), 
+            iPauseBitmapMask, EFalse );
+        }
+
+    if (iSampleArrayHandler)
+        {
+        bitmapContext->SetPenSize( TSize(2,1) );    
+        bitmapContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
+        bitmapContext->SetBrushColor(KRgbWhite);
+        bitmapContext->SetPenColor( KRgbBlack); 
+        bitmapContext->DrawRoundRect( iIconDisplayRect, TSize(4,4));
+
+        iSampleArrayHandler->ScaleAudioVisualization(iIconDisplayRect.Height()/2 - 3); // -2 to eliminate drawing columns to long
+
+        // how many pixels are reserved for each vertical sample line
+        TInt diff = 1;          
+        // how many samples fit in rect
+        TInt samplesInDisplay = iIconDisplayRect.Width()/diff;  
+
+        TBool started = EFalse;
+        TPoint topLeftHighlighted(iIconDisplayRect.iTl.iX, iIconDisplayRect.iTl.iY);    
+        TPoint bottomRightLighted(iIconDisplayRect.iTl.iX, iIconDisplayRect.iBr.iY);
+
+        for (TInt i = 0; (iSampleArrayHandler->CurrentPoint()+i) - samplesInDisplay/2 < iSampleArrayHandler->Size() && 
+            iIconDisplayRect.iTl.iX + i*diff < iIconDisplayRect.iBr.iX;  i++)                               
+            {
+            TInt x = iIconDisplayRect.iTl.iX + i*diff;  
+            TInt y = iIconDisplayRect.iBr.iY - iIconDisplayRect.Height()/2;
+
+            // in the beginning of clip, nothing is drawn on the left side of the rect                      
+            if ((iSampleArrayHandler->CurrentPoint() + i) - samplesInDisplay/2 > 1)
+                {
+                if (iSampleArrayHandler->SampleCutted((iSampleArrayHandler->CurrentPoint()+i) - samplesInDisplay/2))
+                    {
+                    if (!started)
+                        {                       
+                        topLeftHighlighted.iX = x;
+                        started = ETrue;
+                        }
+                    bottomRightLighted.iX = x;
+                    bitmapContext->SetPenColor( KRgbRed );
+                    }
+                else
+                    {
+                    bitmapContext->SetBrushStyle(CGraphicsContext::EDiamondCrossHatchBrush);    
+                    TRect rec(TPoint(1,1), TPoint(2,2));
+                    bitmapContext->DrawRect( rec);
+                    bitmapContext->SetPenColor( KRgbBlack); 
+                    }
+
+                // to eliminate from drawing over surrounding black rect
+                if (x > iIconDisplayRect.iTl.iX + 1)
+                    {                   
+                    bitmapContext->DrawLine(TPoint(x, y),
+                        TPoint(x, (y - 1) - iSampleArrayHandler->Sample((iSampleArrayHandler->CurrentPoint()+i) - samplesInDisplay/2)));
+
+                    bitmapContext->DrawLine(TPoint(x, y),
+                        TPoint(x, (y + 1) + iSampleArrayHandler->Sample((iSampleArrayHandler->CurrentPoint()+i) - samplesInDisplay/2)));
+                    }
+                }
+            }
+
+        // not selected area is "dimmed"
+        bitmapContext->SetPenColor( KRgbBlack); 
+        bitmapContext->SetDrawMode(CGraphicsContext::EDrawModeAND);
+        bitmapContext->SetBrushStyle(CGraphicsContext::EDiamondCrossHatchBrush);
+
+        TPoint brArea1(topLeftHighlighted.iX, iIconDisplayRect.iBr.iY);
+        TRect rect1(iIconDisplayRect.iTl, brArea1);
+        bitmapContext->DrawRoundRect( rect1, TSize(4,4));
+
+        TPoint tlArea2(bottomRightLighted.iX, iIconDisplayRect.iTl.iY);
+        TRect rect2(tlArea2, iIconDisplayRect.iBr);
+        bitmapContext->DrawRoundRect( rect2, TSize(4,4));
+
+        bitmapContext->SetPenColor( KRgbGreen );    
+        bitmapContext->DrawLine(TPoint((iIconDisplayRect.iTl.iX + iIconDisplayRect.iBr.iX)/2, 
+            iIconDisplayRect.iTl.iY + 1),
+            TPoint((iIconDisplayRect.iTl.iX + iIconDisplayRect.iBr.iX)/2, 
+            iIconDisplayRect.iBr.iY - 2));
+        }
+
+    CleanupStack::PopAndDestroy( graphicsContext ); 
+    CleanupStack::PopAndDestroy( bitmapContext );
+    CleanupStack::PopAndDestroy( bitmapDevice );         
+    DrawDeferred();
+    }
+
+void CVeiCutAudioContainer::Draw( const TRect& /*aRect*/ ) const
+    {
+    CWindowGc& gc = SystemGc();
+
+    if ( iBufBitmap && iBufBitmap->Handle() )
+        {
+        gc.BitBlt(TPoint(0,0), iBufBitmap);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CVeiCutAudioContainer::GetHelpContext(...) const
+//
+// Gets the control's help context. Associates the control with a particular
+// Help file and topic in a context sensitive application.
+// ----------------------------------------------------------------------------
+//
+void CVeiCutAudioContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::GetHelpContext(): In");
+
+    // Set UID of the CS Help file (same as application UID).
+    aContext.iMajor = KUidVideoEditor;
+
+    // Set the context/topic.
+    aContext.iContext = KVED_HLP_CUT_AUDIO_VIEW;
+
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::GetHelpContext(): Out");
+    }
+
+
+void CVeiCutAudioContainer::HandleControlEventL(
+    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CVeiCutAudioContainer::HandlePointerEventL
+// From CCoeControl
+// ----------------------------------------------------------------------------
+//		
+void CVeiCutAudioContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent )
+	{
+	LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::HandlePointerEventL(): In");
+	if( AknLayoutUtils::PenEnabled() && iCutAudioBar )
+		{
+		CCoeControl::HandlePointerEventL( aPointerEvent );
+		
+		switch( aPointerEvent.iType )
+			{
+			case TPointerEvent::EButton1Down:
+				{
+				iIsMarkDrag = EFalse;
+				iIsMarkTapped = EFalse;
+				TRect startMarkRect = iCutAudioBar->StartMarkRect();
+				TRect endMarkRect = iCutAudioBar->EndMarkRect();				
+				// check if the pen goes down inside the start mark
+				if (startMarkRect.Contains(aPointerEvent.iPosition)) 
+					{
+					iIsMarkTapped = ETrue;
+					iTappedMark = EStartMark;
+					}
+				// check if the pen goes down inside the end mark	
+				else if (endMarkRect.Contains(aPointerEvent.iPosition))
+					{
+					iIsMarkTapped = ETrue;
+					iTappedMark = EEndMark;
+					}					
+				
+				TRect progressBarRect(iCutAudioBar->ProgressBarRect());	
+				// check if the pen goes down inside the progress bar				
+				if( progressBarRect.Contains( aPointerEvent.iPosition ) )
+					{
+					iIsMarkDrag = EFalse;					
+					}
+				break;
+				}
+			case TPointerEvent::EDrag:
+				{
+				
+				TRect progressBarRect(iCutAudioBar->ProgressBarRect());
+				if ( progressBarRect.Contains( aPointerEvent.iPosition ) )
+				{
+					
+					if (iIsMarkTapped)
+						{
+						iIsMarkDrag = ETrue;
+						HandleProgressBarTouchL( progressBarRect, 
+												 aPointerEvent.iPosition.iX,
+												 ETrue,
+												 iTappedMark );
+						}
+					else 
+						{
+						
+						HandleProgressBarTouchL( progressBarRect, 
+												 aPointerEvent.iPosition.iX,
+												 EFalse);
+						}
+				}
+				break;		
+				}
+			case TPointerEvent::EButton1Up:
+				{
+				// pen up event is handled if it wasn't dragged
+				if (!iIsMarkDrag)
+					{
+					TRect progressBarRect(iCutAudioBar->ProgressBarRect());					
+					// Check if pressed position is in progress bar's rect
+					if( progressBarRect.Contains( aPointerEvent.iPosition ) )
+						{
+						HandleProgressBarTouchL( progressBarRect, 
+											 aPointerEvent.iPosition.iX,
+											 EFalse);
+						}
+					}
+				break;
+				}		
+			default:
+				{
+				break;	
+				}	
+			}
+		}	
+	LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::HandlePointerEventL(): Out");		
+	}
+
+
+// ----------------------------------------------------------------------------
+// CVeiCutAudioContainer::HandleProgressBarTouchL
+// 
+// ----------------------------------------------------------------------------
+//	
+void CVeiCutAudioContainer::HandleProgressBarTouchL( TRect aPBRect, 
+												 TInt aPressedPoint,
+												 TBool aDragMarks,
+												 CVeiCutAudioContainer::TCutMark aCutMark )
+	{
+	if ( (AknLayoutUtils::PenEnabled()) && ( iState!=EStateInitializing ))
+		{	
+		LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::HandleProgressBarTouchL(): In");
+
+		if (iState == EStatePlaying)		
+			{
+			StopL();	
+			}
+		
+		// Progress Bar start and end points, and length
+		TInt pbEndPoint( aPBRect.iBr.iX );
+		TInt pbStartPoint = ( aPBRect.iTl.iX );		
+		TInt totalPBLength( pbEndPoint - pbStartPoint );
+				
+		// calculate the time position from the tapped progress bar coordinates 
+		TTimeIntervalMicroSeconds newPosition( 
+										( ( aPressedPoint - pbStartPoint ) * 
+							  			iAudioSamplePlayer->Duration().Int64() ) / 
+							  			totalPBLength );
+		
+		// move cut marks
+		if (aDragMarks)
+		{
+			// check that the start mark doesn't go past the end mark
+			// and not to the beginning			
+			if ((aCutMark == EStartMark) && 
+			    (newPosition.Int64() > 0) &&
+				(aPressedPoint < iCutAudioBar->EndMarkPoint() - 2*iCutAudioBar->EndMarkRect().Width()))
+				{				
+				iView.MoveStartOrEndMarkL(newPosition, EStartMark);				
+				iCutAudioBar->SetInPoint( newPosition	);
+				iCutTimeDisplay->SetCutIn( newPosition );
+				}
+			// check that the end mark doesn't go before the start mark	
+			// and not too close to the beginning			
+			else if ((aCutMark == EEndMark) && 
+				(newPosition.Int64() >= KMinCutVideoLength) &&			
+				(aPressedPoint > iCutAudioBar->StartMarkPoint() + 2*iCutAudioBar->StartMarkRect().Width()))
+                
+				{				
+				iView.MoveStartOrEndMarkL(newPosition, EEndMark);				
+				iCutAudioBar->SetOutPoint( newPosition	);
+				iCutTimeDisplay->SetCutOut( newPosition );
+				}
+		}
+				
+		// move playhead
+		else if (( newPosition != iLastPosition ) && !aDragMarks)
+			{
+			iLastPosition = newPosition;
+			
+			iSeekPos = TTimeIntervalMicroSeconds( newPosition );
+			
+			iCutAudioBar->SetCurrentPoint( (static_cast<TInt32>(iSeekPos.Int64() / 1000)));
+			iAudioSamplePlayer->SetPosition( iSeekPos );
+			UpdateVisualizationL();
+					
+			iView.UpdateTimeL();
+			}	
+			
+		LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::HandleProgressBarTouchL(): Out");
+			
+		}// PenEnabled
+		
+	}
+
+
+void CVeiCutAudioContainer::PlayL( const TTimeIntervalMicroSeconds& aStartTime )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiCutAudioContainer::PlayL(): In, aStartTime:%Ld", aStartTime.Int64());
+    if ( aStartTime != TTimeIntervalMicroSeconds(0) )
+        {
+        LOGFMT(KVideoEditorLogFile, "CVeiCutAudioContainer::PlayL() 2, setting pos:%Ld", aStartTime.Int64());
+        iAudioSamplePlayer->SetPosition( aStartTime );
+        UpdateVisualizationL();
+        }
+    else
+        {
+        LOGFMT(KVideoEditorLogFile, "CVeiCutAudioContainer::PlayL() 3, setting pos:%Ld", iSeekPos.Int64());     
+        iAudioSamplePlayer->SetPosition( iSeekPos );
+        UpdateVisualizationL();
+        }   
+
+    SetStateL( EStatePlaying );
+
+    iAudioSamplePlayer->Play();
+    const TUint delay = 100000;
+
+    if ( !iVideoBarTimer->IsActive() )
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::PlayL() 4");
+        iVideoBarTimer->Start( delay, delay, TCallBack( CVeiCutAudioContainer::DoAudioBarUpdate, this ) );
+        LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::PlayL() 5");
+        }
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::PlayL(): Out");    
+    }
+
+void CVeiCutAudioContainer::StopL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::StopL(): In");
+    iAudioSamplePlayer->Stop();
+
+    iSeekPos = TTimeIntervalMicroSeconds( 0 );
+    iLastPosition = TTimeIntervalMicroSeconds( 0 );
+    SetStateL( EStateStopped );
+    PlaybackPositionL();
+
+    iVideoBarTimer->Cancel();
+    iCutAudioBar->SetFinishedStatus( ETrue );
+
+    UpdateVisualizationL();
+
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::StopL(): Out");
+    }
+
+void CVeiCutAudioContainer::PauseL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::PauseL(): In");
+
+    PlaybackPositionL();
+
+    iVideoBarTimer->Cancel();
+    iAudioSamplePlayer->Pause();
+
+    if (iState != EStateInitializing) 
+        {
+        SetStateL( EStatePaused );
+        }
+    else
+        {
+        SetStateL( EStateStoppedInitial );
+        }
+    iView.UpdateCBAL(iState);
+    // draw new visualization to bitmap
+    DrawToBufBitmapL();
+
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::PauseL(): Out");
+    }
+
+void CVeiCutAudioContainer::CloseStreamL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::CloseStreamL(): In");
+
+    PlaybackPositionL();
+    SetStateL( EStateStopped );
+
+    iAudioSamplePlayer->Stop();
+    iAudioSamplePlayer->Close();
+
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::CloseStreamL(): Out");
+    }
+
+void CVeiCutAudioContainer::SetInTimeL( const TTimeIntervalMicroSeconds& aTime )
+    {
+    iMarkedInTime = aTime;
+    if ( iCutTimeDisplay )
+        {       
+        iCutTimeDisplay->SetCutIn( aTime );
+        }
+    if ( iCutAudioBar )
+        {
+        iCutAudioBar->SetInPoint( aTime );
+        }
+    if (iSampleArrayHandler)
+        {
+        iSampleArrayHandler->SetCutInPoint(aTime);          
+        }
+    // draw new visualization to bitmap
+    DrawToBufBitmapL();
+    }
+
+void CVeiCutAudioContainer::SetOutTimeL( const TTimeIntervalMicroSeconds& aTime )
+    {
+    iMarkedOutTime = aTime;
+    if ( iCutTimeDisplay )
+        {
+        iCutTimeDisplay->SetCutOut( aTime );
+        }
+    if ( iCutAudioBar )
+        {
+        iCutAudioBar->SetOutPoint( aTime );
+        }
+    if (iSampleArrayHandler)
+        {
+        iSampleArrayHandler->SetCutOutPoint(aTime);         
+        }
+    // draw new visualization to bitmap
+    DrawToBufBitmapL();
+    }
+
+const TTimeIntervalMicroSeconds& CVeiCutAudioContainer::TotalLength()
+    {
+    return iDuration;
+    }
+
+const TTimeIntervalMicroSeconds& CVeiCutAudioContainer::PlaybackPositionL()
+    {
+    if (iSeeking)
+        {
+        return iSeekPos;
+        }
+    if (iState != EStatePlaying)
+        {
+        return iLastPosition;
+        }
+
+    TInt posError = iAudioSamplePlayer->GetPosition( iLastPosition );
+    //LOGFMT2(KVideoEditorLogFile, "CVeiCutAudioContainer::PlaybackPositionL(): %Ld, error: %d", iLastPosition.Int64(), posError);
+    posError = 0;
+
+    return iLastPosition;
+    }
+
+TKeyResponse CVeiCutAudioContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
+    {
+    if ( aType == EEventKeyDown ) 
+        {
+        iKeyRepeatCount = 0;
+
+        iAudioSamplePlayer->GetPosition( iSeekPos );
+
+        LOGFMT(KVideoEditorLogFile, "CVeiCutAudioContainer::OfferKeyEventL(): EEventKeyDown, pos: %Ld", iSeekPos.Int64());
+
+        return EKeyWasConsumed;
+        }
+    else if ( aType == EEventKeyUp ) 
+        {
+
+        if ( iSeeking == EFalse )
+            {
+            LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::OfferKeyEventL(): EEventKeyUp, seeking false");
+            return EKeyWasNotConsumed;
+            }
+
+        iSeeking = EFalse;
+        iLastPosition = iSeekPos;
+        iAudioSamplePlayer->SetPosition( iSeekPos );
+        UpdateVisualizationL();
+        if ( iState == EStatePlaying )
+            {
+            iAudioSamplePlayer->Play();
+            }
+
+        LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::OfferKeyEventL(): EEventKeyUp, seeking true");
+
+        return EKeyWasConsumed;
+        }
+    else if ( aType == EEventKey )
+        {
+        if ( ( aKeyEvent.iRepeats == 0 ) &&
+            ( (aKeyEvent.iCode != EKeyDownArrow ) &&
+            ( aKeyEvent.iCode != EKeyUpArrow ) ) )
+            {
+            iAudioSamplePlayer->Pause();
+            }
+        iLastKeyCode = aKeyEvent.iCode;
+
+        switch (aKeyEvent.iCode)
+            {
+            case EKeyOK:
+                {
+                iView.HandleCommandL( EAknSoftkeyOk );
+                return EKeyWasConsumed;
+                }
+            case EKeyDownArrow:
+                {
+                iView.ProcessCommandL( EVeiCmdCutVideoVolumeDown );
+                return EKeyWasConsumed;
+                }
+            case EKeyUpArrow:
+                {
+                iView.ProcessCommandL( EVeiCmdCutVideoVolumeUp );
+                return EKeyWasConsumed;
+                }
+            case EKeyRightArrow:
+                {
+
+                if ( iSeeking == EFalse )
+                    {
+                    iAudioSamplePlayer->Pause();
+                    }
+
+                iSeeking = ETrue;
+                iKeyRepeatCount++;
+
+                TInt adjustment = TimeIncrement( iKeyRepeatCount );
+
+                TInt64 newPos = iSeekPos.Int64() + adjustment;
+
+                if ( newPos > iAudioSamplePlayer->Duration().Int64() )
+                    {
+                    newPos = iAudioSamplePlayer->Duration().Int64();
+                    }
+                iSeekPos = TTimeIntervalMicroSeconds( newPos );
+                iCutAudioBar->SetCurrentPoint( static_cast<TInt32>((iSeekPos.Int64() / 1000)));
+
+                iView.UpdateTimeL();
+
+                // mieti onko eka rivi tarpeen
+                iAudioSamplePlayer->SetPosition( iSeekPos );
+                UpdateVisualizationL();
+                return EKeyWasConsumed;
+                }
+
+            case EKeyLeftArrow:
+                {
+                if ( iSeeking == EFalse )
+                    {
+                    iAudioSamplePlayer->Pause();
+                    }
+
+                iSeeking = ETrue;
+                iKeyRepeatCount++;
+
+                TInt adjustment = TimeIncrement( iKeyRepeatCount );
+
+                TInt64 newPos = iSeekPos.Int64() - adjustment;
+                if ( newPos < 0 ) 
+                    {
+                    newPos = 0;
+                    }
+                iSeekPos = TTimeIntervalMicroSeconds( newPos ); 
+                iCutAudioBar->SetCurrentPoint(static_cast<TInt32>( (iSeekPos.Int64() / 1000)));
+
+                iView.UpdateTimeL();                
+                iAudioSamplePlayer->SetPosition( iSeekPos );
+                UpdateVisualizationL();
+                return EKeyWasConsumed;
+                }
+            case EKeyBackspace:     //Clear 
+                {
+                iView.ClearInOutL( ETrue, ETrue );
+                UpdateVisualizationL();             
+                return EKeyWasConsumed;
+                }
+            default:
+                {
+                return EKeyWasNotConsumed;
+                }
+            }
+        }
+    else
+        {
+        return EKeyWasNotConsumed;
+        }
+    }
+
+
+
+TInt CVeiCutAudioContainer::TimeIncrement(TInt aKeyCount) const
+    {
+    if ( aKeyCount < 3 )
+        {
+        return 100000;
+        }
+    else if ( aKeyCount < 4 )
+        {
+        return 300000;
+        }
+    else if ( aKeyCount < 5 )
+        {
+        return 500000;
+        }
+    else if ( aKeyCount < 10 )
+        {
+        return 1000000;
+        }
+    else if ( aKeyCount < 13 )
+        {
+        return 2000000;
+        }
+    else if ( aKeyCount < 15 )
+        {
+        return 3000000;
+        }
+    else
+        {
+        return 5000000;
+        }
+    }
+
+void CVeiCutAudioContainer::SetStateL(CVeiCutAudioContainer::TCutAudioState aState)
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiCutAudioContainer::SetStateL(): In: aState:%d", aState);
+
+    iState = aState;
+    iView.UpdateCBAL( aState );
+
+    // If the foreground is lost while an arrow key is down, we do not get
+    // the key up -event, and iSeeking remains true. Reseting it here just in case.
+    iSeeking = EFalse;
+
+    // While playing, grab the volume keys for adjusting playback volume.
+    // In other states let them pass e.g. to the music player.
+    if(EStatePlaying == iState)
+        {
+        if (!iRemConTarget)
+            {
+            iRemConTarget = CVeiRemConTarget::NewL( *this );
+            }
+        }
+    else
+        {
+        delete iRemConTarget;
+        iRemConTarget = NULL;
+        }
+
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::SetStateL(): Out");
+    }
+
+void CVeiCutAudioContainer::MarkedInL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::MarkedInL(): In");             
+
+    if (iState == EStateInitializing || iState == EStateOpening)
+        {
+        return;
+        }
+
+    TTimeIntervalMicroSeconds cutIn = PlaybackPositionL();
+    if ( iCutTimeDisplay )
+        {
+        iCutTimeDisplay->SetCutIn( cutIn );
+        }
+    LOGFMT2(KVideoEditorLogFile, "\tIn point: %Ld, state: %d", cutIn.Int64(), iState);
+
+    iCutAudioBar->SetInPoint( cutIn );
+    
+    if (iSampleArrayHandler)
+        {
+        iSampleArrayHandler->SetCutInPoint(cutIn);          
+        }
+        
+    if ( iState == EStatePlaying )
+        {
+        PauseL();
+        }
+    else
+        {
+        iView.UpdateCBAL( iState );
+        }
+    
+    UpdateVisualizationL();     
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::MarkedInL(): Out");    
+    }
+
+void CVeiCutAudioContainer::MarkedOutL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::MarkedOutL(): In");
+    
+    if (iState == EStateInitializing || iState == EStateOpening)
+        {
+        return;
+        }
+    
+    TTimeIntervalMicroSeconds cutOut = PlaybackPositionL();
+    
+    if ( iCutTimeDisplay )
+        {
+        iCutTimeDisplay->SetCutOut( cutOut );
+        }
+
+    LOGFMT2(KVideoEditorLogFile, "\tOut point: %Ld, state: %d", cutOut.Int64(), iState);
+    iCutAudioBar->SetOutPoint( cutOut );
+    
+    if (iSampleArrayHandler)
+        {
+        iSampleArrayHandler->SetCutOutPoint(cutOut);            
+        }
+    
+    if ( iState == EStatePlaying )
+        {
+        PauseL();
+        }
+    else
+        {
+        iView.UpdateCBAL( iState );
+        }
+        
+    UpdateVisualizationL();                 
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::MarkedOutL(): Out");
+    }
+    
+void CVeiCutAudioContainer::SetVolumeL( TInt aVolumeChange )
+    {
+    iInternalVolume += aVolumeChange;
+
+    if ( iInternalVolume < 0 )
+        {
+        iInternalVolume = 0;
+        }
+    if ( iInternalVolume > KMaxCutAudioVolumeLevel )
+        {
+        iInternalVolume = KMaxCutAudioVolumeLevel;
+        }
+    
+    if ( iAudioSamplePlayer )   
+        {
+        TInt vol = STATIC_CAST( TInt, (iInternalVolume*iMaxVolume)/KMaxCutAudioVolumeLevel );
+        iAudioSamplePlayer->SetVolume( vol );
+        }
+    }
+
+TInt CVeiCutAudioContainer::DoAudioBarUpdate( TAny* aThis )
+    {
+    STATIC_CAST( CVeiCutAudioContainer*, aThis )->DoUpdate();
+    return 42;
+    }
+
+void CVeiCutAudioContainer::DoUpdate()
+    {
+    TTimeIntervalMicroSeconds time;
+    iAudioSamplePlayer->GetPosition( time );
+
+    if ( iSeeking )
+        {
+        time = iSeekPos;
+        LOGFMT(KVideoEditorLogFile, "CVeiCutAudioContainer::DoUpdate(): 1, time:%Ld", time.Int64());
+        }
+    else
+        {
+        LOGFMT(KVideoEditorLogFile, "CVeiCutAudioContainer::DoUpdate(): 2, time:%Ld", time.Int64());
+        }
+    
+    iCutAudioBar->SetCurrentPoint(static_cast<TInt32>( (time.Int64() / 1000)));
+    iCutAudioBar->DrawDeferred();
+
+    TRAP_IGNORE( UpdateVisualizationL() );
+    }
+    
+
+void CVeiCutAudioContainer::UpdateVisualizationL()
+    {   
+    TTimeIntervalMicroSeconds time;
+    iAudioSamplePlayer->GetPosition( time );
+    iSampleArrayHandler->SetCurrentPoint(time);
+
+    DrawToBufBitmapL();
+    }
+
+// @: not leave safe!
+void CVeiCutAudioContainer::MapcInitComplete( TInt aError,
+                    const TTimeIntervalMicroSeconds& DEBUGLOG_ARG(aDuration) )
+    {
+    LOGFMT2(KVideoEditorLogFile, "CVeiCutAudioContainer::MapcInitComplete(): In, aError:%d, aDuration:%Ld", aError, aDuration.Int64());
+    if( aError == KErrNone )    // The sample is ready to play.
+        {
+        CVeiVideoEditorSettings::GetMediaPlayerVolumeLevelL( iInternalVolume );
+
+        iMaxVolume = iAudioSamplePlayer->MaxVolume();
+        TInt vol = STATIC_CAST( TInt, (iInternalVolume*iMaxVolume)/KMaxCutAudioVolumeLevel );
+        iAudioSamplePlayer->SetVolume( vol );
+        /* Show mute icon in navipane */
+        if ( vol == 0 )
+            {
+            iView.VolumeDownL();
+            }
+        }
+    iCutAudioBar->SetTotalDuration( iDuration );
+
+    SetStateL( EStateStoppedInitial );
+    iView.UpdateTimeL();
+
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::MapcInitComplete(): Out");
+    }
+    
+void CVeiCutAudioContainer::SetDuration( const TTimeIntervalMicroSeconds& aDuration )
+    {
+    iDuration = aDuration;
+    iCutAudioBar->SetTotalDuration( iDuration );
+    }   
+
+void CVeiCutAudioContainer::LaunchProgressNoteL()
+    {
+    iProgressNote = new ( ELeave ) CAknProgressDialog( REINTERPRET_CAST( CEikDialog**, 
+                    &iProgressNote), ETrue);
+    iProgressNote->SetCallback(this);
+    iProgressNote->PrepareLC( R_VEI_PROGRESS_NOTE_WITH_CANCEL );
+
+    HBufC* stringholder  = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_CUT, iEikonEnv );
+    iProgressNote->SetTextL( *stringholder );
+    CleanupStack::PopAndDestroy(stringholder);
+        
+    iProgressNote->GetProgressInfoL()->SetFinalValue( 100 );
+    iProgressNote->RunLD();
+    }
+
+void CVeiCutAudioContainer::MapcPlayComplete( TInt DEBUGLOG_ARG(aError) )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiCutAudioContainer::MapcPlayComplete(): In, error:%d", aError);
+
+    if (EStateTerminating == iState)
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::MapcPlayComplete: app is closing...");
+        return;
+        }
+
+    TRAP_IGNORE( SetStateL( EStateStopped ) );
+    iVideoBarTimer->Cancel();
+
+    iCutAudioBar->SetFinishedStatus( ETrue );
+    iLastPosition = TTimeIntervalMicroSeconds( 0 );
+    iSeekPos = 0;
+    TRAP_IGNORE( iView.StopNaviPaneUpdateL() );
+
+    TRAP_IGNORE( UpdateVisualizationL() );
+
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::MapcPlayComplete(): Out");
+    }
+
+void CVeiCutAudioContainer::NotifyAudioClipVisualizationStarted(const CVedAudioClipInfo& /*aInfo*/)
+    {
+    TRAP_IGNORE( LaunchProgressNoteL() );
+    }
+
+void CVeiCutAudioContainer::NotifyAudioClipVisualizationProgressed(const CVedAudioClipInfo& /*aInfo*/, 
+                                                        TInt aPercentage)
+    {   
+    if ( iProgressNote )
+        {
+        TRAP_IGNORE( iProgressNote->GetProgressInfoL()->SetAndDraw( aPercentage ) );
+        }   
+    }
+                                                        
+void CVeiCutAudioContainer::NotifyAudioClipVisualizationCompleted(const CVedAudioClipInfo& /*aInfo*/, 
+                                                       TInt aError, TInt8* aVisualization,
+                                                       TInt aResolution)
+    {       
+    if ( iProgressNote )
+        {
+        TRAP_IGNORE( iProgressNote->GetProgressInfoL()->SetAndDraw(100) );
+        TRAP_IGNORE( iProgressNote->ProcessFinishedL() );
+        }
+    if (KErrNone == aError)
+        {       
+        iSampleArrayHandler->SetVisualizationArray(aVisualization, aResolution);
+        TRAP_IGNORE( DrawToBufBitmapL() );
+        }
+    }
+
+TInt CVeiCutAudioContainer::VisualizationResolution() const
+    {
+    return iIconDisplayRect.Width();    
+    }   
+
+void CVeiCutAudioContainer::DialogDismissedL( TInt aButtonId )
+    {
+    if (aButtonId != EAknSoftkeyDone )
+        {   
+        iView.CancelVisualizationL();
+        if (! iCallBack)
+            {       
+            TCallBack cb (CVeiCutAudioContainer::AsyncBack, this);
+            iCallBack = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard);
+            }
+        iCallBack->CallBack();
+        }
+    }
+    
+TInt CVeiCutAudioContainer::AsyncBack(TAny* aThis)
+    {
+    LOG( KVideoEditorLogFile, "CVeiCutAudioContainer::AsyncExit");
+
+    CVeiCutAudioContainer* view = static_cast<CVeiCutAudioContainer*>(aThis);
+    TRAPD( err, view->HandleCommandL(EVeiCmdCutVideoViewBack) );
+    
+    return err;
+    }   
+
+
+void CVeiCutAudioContainer::HandleCommandL(TInt aCommand)       
+    {
+    iView.HandleCommandL(aCommand); 
+    }
+
+void CVeiCutAudioContainer::GetVisualizationL()
+    {   
+    iView.GetAudioVisualizationL();
+    }
+
+//=============================================================================
+void CVeiCutAudioContainer::HandleVolumeUpL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::HandleVolumeUpL: in");
+
+    iView.VolumeUpL();
+
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::HandleVolumeUpL: out");
+    }
+
+//=============================================================================
+void CVeiCutAudioContainer::HandleVolumeDownL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::HandleVolumeDownL: in");
+
+    iView.VolumeDownL();
+
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::HandleVolumeDownL: out");
+    }
+
+//=============================================================================
+void CVeiCutAudioContainer::PrepareForTerminationL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::PrepareForTerminationL: in");
+
+    SetStateL( EStateTerminating );
+
+    iVideoBarTimer->Cancel();
+    iAudioSamplePlayer->Stop();
+    iAudioSamplePlayer->Close();
+
+    LOG(KVideoEditorLogFile, "CVeiCutAudioContainer::PrepareForTerminationL: out");
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiCutAudioView.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,989 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+// System includes
+#include <aknviewappui.h>
+#include <avkon.hrh>
+#include <manualvideoeditor.rsg>
+#include <VedAudioClipInfo.h>
+
+#include <akntitle.h> 
+#include <barsread.h>
+#include <stringloader.h> 
+#include <aknnotewrappers.h>
+#include <aknquerydialog.h>
+#include <aknnavide.h>
+#include <eikbtgpc.h>
+#include <eikmenub.h>
+#include <eikmenup.h>
+#include <eikprogi.h>
+#include <apparc.h>
+#include <aknselectionlist.h>
+
+//User includes
+#include "VeiAppUi.h"
+#include "VeiCutAudioView.h"
+#include "VeiCutAudioContainer.h" 
+#include "ManualVideoEditor.hrh"
+#include "VeiTimeLabelNavi.h"
+#include "VideoEditorCommon.h"
+#include "VeiVideoEditorSettings.h"
+#include "VeiErrorUi.h"
+
+CVeiCutAudioView* CVeiCutAudioView::NewL()
+    {
+    CVeiCutAudioView* self = CVeiCutAudioView::NewLC();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+CVeiCutAudioView* CVeiCutAudioView::NewLC()
+    {
+    CVeiCutAudioView* self = new (ELeave) CVeiCutAudioView();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+CVeiCutAudioView::CVeiCutAudioView()
+    {
+    }
+
+void CVeiCutAudioView::ConstructL()
+    {
+    BaseConstructL( R_VEI_CUT_AUDIO_VIEW );
+
+    CEikStatusPane* sp = StatusPane();
+
+    iNaviPane = (CAknNavigationControlContainer*) sp->ControlL(
+            TUid::Uid(EEikStatusPaneUidNavi));
+
+    iTimeNavi = CreateTimeLabelNaviL();
+    iTimeNavi->SetMopParent( this );
+
+    iVolumeNavi = iNaviPane->CreateVolumeIndicatorL(
+            R_AVKON_NAVI_PANE_VOLUME_INDICATOR );
+
+    iErrorUI = CVeiErrorUI::NewL( *iCoeEnv );   
+    
+    iTimeUpdater = CPeriodic::NewL( CActive::EPriorityLow );
+    iVolumeHider = CPeriodic::NewL( CActive::EPriorityLow );
+    }
+
+// ---------------------------------------------------------
+// CVeiCutAudioView::~CVeiCutAudioView()
+// ?implementation_description
+// ---------------------------------------------------------
+//
+CVeiCutAudioView::~CVeiCutAudioView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = 0;
+        }
+    if ( iTimeUpdater )
+        {
+        iTimeUpdater->Cancel();
+        delete iTimeUpdater;
+        }
+    if ( iVolumeHider )
+        {
+        iVolumeHider->Cancel();
+        delete iVolumeHider;
+        }
+
+    if ( iErrorUI )
+        {
+        delete iErrorUI;
+        }
+
+    delete iVolumeNavi;
+
+    delete iTimeNavi;
+    
+    delete iCallBack;
+    }
+
+
+void CVeiCutAudioView::DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane )
+    {
+    TInt state = iContainer->State();
+
+    if (aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU_CLEAR_MARKS)
+        {
+        // delet in, out, in & out as necessary.
+
+        if (iMovie->AudioClipCutInTime(iIndex) <= TTimeIntervalMicroSeconds(0)) 
+            {
+            aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksIn, ETrue);
+            }
+        if (iMovie->AudioClipCutOutTime(iIndex) >= iMovie->AudioClipInfo(iIndex)->Duration() ) 
+            {
+            aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksOut, ETrue);
+            }
+        if (!((iMovie->AudioClipCutOutTime(iIndex) < iMovie->AudioClipInfo(iIndex)->Duration())
+            && (iMovie->AudioClipCutInTime(iIndex) > TTimeIntervalMicroSeconds(0))))
+            {
+            aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksInOut, ETrue);
+            }
+        }
+
+    if ( aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU )
+        {
+        aMenuPane->SetItemDimmed( EVeiCmdCutVideoTakeSnapshot, ETrue );
+
+        if ( iPopupMenuOpened != EFalse )
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewClearMarks, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewHelp, ETrue );
+            }
+
+        if ( ( iMovie->AudioClipCutInTime( iIndex ) == TTimeIntervalMicroSeconds( 0 ) && 
+            iMovie->AudioClipCutOutTime( iIndex ) == iMovie->AudioClipInfo( iIndex )->Duration() ) )
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewPlayMarked );
+            }
+        if ( state != CVeiCutAudioContainer::EStatePlayingMenuOpen && 
+            state != CVeiCutAudioContainer::EStatePaused )
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewContinue );
+            }
+        if ( ( state == CVeiCutAudioContainer::EStateStopped ) ||
+             ( state == CVeiCutAudioContainer::EStateStoppedInitial ) )
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewStop );
+            }
+
+        if ( ( iMovie->AudioClipCutOutTime( iIndex ) >= iMovie->AudioClipInfo( iIndex )->Duration() ) &&
+            ( iMovie->AudioClipCutInTime( iIndex ) <= TTimeIntervalMicroSeconds( 0 ) ) ) 
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewClearMarks, ETrue );
+            }
+        if ( state == CVeiCutAudioContainer::EStatePaused )
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewPlay, ETrue  );
+            }
+        if ( state == CVeiCutAudioContainer::EStateStoppedInitial )
+            {
+            //aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkIn, ETrue );
+            //aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkOut, ETrue );    
+            }
+        }
+
+    if ( aResourceId != R_VEI_CUT_VIDEO_VIEW_MENU )
+        return;
+
+
+    if ( ( state != CVeiCutAudioContainer::EStateStopped ) && 
+        ( state != CVeiCutAudioContainer::EStateStoppedInitial ) &&
+        ( state != CVeiCutAudioContainer::EStatePaused ) )
+        {
+        aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewPlay, ETrue  );
+        aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkIn, ETrue  );
+        aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkOut, ETrue  ); 
+        }
+    else
+        {
+        if ( iContainer->PlaybackPositionL() <= iMovie->AudioClipCutInTime( iIndex ) )
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkOut, ETrue );  
+            }
+        else 
+            {
+            if ( iContainer->PlaybackPositionL() >= iMovie->AudioClipCutOutTime( iIndex ) )
+                {
+                aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkIn, ETrue );
+                }
+            }
+        }
+
+    }
+
+TUid CVeiCutAudioView::Id() const
+    {
+    return TUid::Uid( EVeiCutAudioView );
+    }
+
+void CVeiCutAudioView::HandleCommandL(TInt aCommand)
+    {   
+    switch ( aCommand )
+        {
+        case EAknSoftkeyOk:
+            {
+            iPopupMenuOpened = ETrue;
+            if (iContainer->State() == CVeiCutAudioContainer::EStatePlaying) 
+                {
+                PausePreviewL();
+                iContainer->SetStateL(CVeiCutAudioContainer::EStatePlayingMenuOpen);
+                }
+
+            MenuBar()->TryDisplayMenuBarL();
+            if (iContainer->State() == CVeiCutAudioContainer::EStatePlayingMenuOpen) 
+                {
+                iContainer->SetStateL(CVeiCutAudioContainer::EStatePaused);
+                }
+            iPopupMenuOpened = EFalse;
+            break;
+            }       
+        case EVeiCmdCutVideoViewDone:
+        case EVeiCmdCutVideoViewBack:
+        case EAknSoftkeyBack:
+            {
+            iContainer->CloseStreamL();
+
+            StopNaviPaneUpdateL();
+
+            // Activate Edit Video view
+            AppUi()->ActivateLocalViewL( TUid::Uid(EVeiEditVideoView) );
+            break;
+            }
+
+        case EVeiCmdCutVideoViewMarkIn:
+            {
+            MarkInL();
+            break;
+            }
+        case EVeiCmdCutVideoViewMarkOut:
+            {
+            MarkOutL();
+            break;
+            }
+        case EVeiCmdCutVideoViewClearMarksInOut:
+            {
+            ClearInOutL( ETrue, ETrue );
+            break;
+            }
+        case EVeiCmdCutVideoViewClearMarksIn:
+            {
+            ClearInOutL( ETrue, EFalse );
+            break;
+            }
+        case EVeiCmdCutVideoViewClearMarksOut:
+            {
+            ClearInOutL( EFalse, ETrue );
+            break;
+            }
+        case EVeiCmdCutVideoViewPlayMarked:
+            {
+            STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+                SetPauseIconVisibilityL( EFalse );
+            PlayMarkedL();
+            break;
+            }
+        case EVeiCmdCutVideoViewPlay:
+            {
+            STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+                SetPauseIconVisibilityL( EFalse );
+            iNaviPane->PushL( *iTimeNavi );
+            
+            PlayPreviewL();
+            break;
+            }
+        case EVeiCmdCutVideoViewStop:
+            {
+            STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+                SetPauseIconVisibilityL( EFalse );
+            iNaviPane->PushL( *iTimeNavi );
+            iContainer->StopL();
+            StopNaviPaneUpdateL();
+            break;
+            }
+        case EVeiCmdCutVideoViewContinue:
+            {
+            STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+                SetPauseIconVisibilityL( EFalse );
+            iNaviPane->PushL( *iTimeNavi );
+            PlayPreviewL();
+            break;
+            }
+        case EVeiCmdCutVideoVolumeDown:
+            {
+            if ( !iAudioMuted )
+                {
+                VolumeDownL();
+                }
+            break;
+            }
+        case EVeiCmdCutVideoVolumeUp:
+            {
+            if ( !iAudioMuted )
+                {
+                VolumeUpL();    
+                }
+            break;
+            }
+        //
+        // Options->Help
+        //
+        case EVeiCmdCutVideoViewHelp:
+            {
+            // CS Help launching is handled in Video Editor's AppUi.
+            AppUi()->HandleCommandL( EVeiCmdCutVideoViewHelp );
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+
+void CVeiCutAudioView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+
+    if (!iContainer)
+        {
+        iContainer = CVeiCutAudioContainer::NewL( AppUi()->ClientRect(), *this, *iErrorUI );
+        iContainer->SetMopParent( this );
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    CEikStatusPane *statusPane = ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); 
+    
+    CAknTitlePane* titlePane = (CAknTitlePane*) statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) );
+    TResourceReader reader1;
+    iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_CUTAUDIO_VIEW_TITLE_NAME );
+    titlePane->SetFromResourceL( reader1 );
+    CleanupStack::PopAndDestroy(); //reader1
+
+    iNaviPane->PushL( *iTimeNavi );
+    
+    iAudioMuted = EFalse;
+
+    STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->
+        SetVolumeIconVisibilityL( ETrue );
+    STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+            SetPauseIconVisibilityL( EFalse );
+    
+    iContainer->SetInTimeL( iMovie->AudioClipCutInTime( iIndex ) );
+    iContainer->SetOutTimeL( iMovie->AudioClipCutOutTime( iIndex ) );
+    iContainer->SetDuration( iMovie->AudioClipInfo( iIndex )->Duration() );
+    
+    // <testing>
+/*  TTimeIntervalMicroSeconds time1 = iMovie->AudioClipInfo( iIndex )->Duration();
+    TTimeIntervalMicroSeconds time2 = iMovie->AudioClipCutInTime( iIndex );
+    TTimeIntervalMicroSeconds time3 = iMovie->AudioClipCutOutTime( iIndex );    
+    TTimeIntervalMicroSeconds time4 = iMovie->AudioClipStartTime( iIndex );
+    TTimeIntervalMicroSeconds time5 = iMovie->AudioClipEndTime( iIndex );
+    TTimeIntervalMicroSeconds time6 = iMovie->AudioClipEditedDuration( iIndex );
+    TTimeIntervalMicroSeconds time7(time3.Int64() - time2.Int64());
+    TTimeIntervalMicroSeconds time8(time5.Int64() - time4.Int64());
+*/  // </testing>
+
+    // Start processing the file asynchronously. This is needed because
+    // CVeiCutAudioContainer::OpenAudioFileL launches a progress dialog.
+    // If it is called syncronously the previous view deactivation has 
+    // not completed, and view shutter dismisses the progress dialog...
+    if (! iCallBack)
+        {       
+        TCallBack cb (CVeiCutAudioView::AsyncOpenAudioFile, this);
+        iCallBack = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard);
+        }
+    iCallBack->CallBack();
+
+    iOriginalCutInTime = iMovie->AudioClipCutInTime( iIndex );
+    
+    DrawTimeNaviL();
+
+    iErrorNmb = 0;      
+    }
+
+// ---------------------------------------------------------
+// CVeiCutAudioView::AsyncOpenAudioFile
+// ?implementation_description
+// ---------------------------------------------------------
+//
+TInt CVeiCutAudioView::AsyncOpenAudioFile(TAny* aThis)
+    {
+    LOG( KVideoEditorLogFile, "CVeiCutAudioView::AsyncOpenAudioFile");
+
+    // In the asynchronous version, trap the rest of the functions 
+    // to make sure that the caller's TRequestStatus is always 
+    // completed, also in case of failures.
+    CVeiCutAudioView* view = static_cast<CVeiCutAudioView*>(aThis);
+    TRAPD(err, view->OpenAudioFileL() );
+
+    if (err)
+        {
+        // Display error message here, otherwise it would be quietly ignored.
+        TBuf<256> unused;
+        view->AppUi()->HandleError(err, SExtendedError(), unused, unused);
+        }
+
+    return err;
+    }
+
+// ---------------------------------------------------------
+// CVeiCutAudioView::OpenAudioFileL()
+// ?implementation_description
+// ---------------------------------------------------------
+//
+void CVeiCutAudioView::OpenAudioFileL()
+    {
+    TFileName audioClipFileName = iMovie->AudioClipInfo( iIndex )->FileName();
+    iContainer->OpenAudioFileL( audioClipFileName );
+    }
+
+// ---------------------------------------------------------
+// CVeiCutAudioView::DoDeactivate()
+// ?implementation_description
+// ---------------------------------------------------------
+//
+void CVeiCutAudioView::DoDeactivate()
+   {  
+    iNaviPane->Pop( iVolumeNavi );
+
+    if ( iTimeUpdater )
+        {
+        iTimeUpdater->Cancel();
+        }
+    if ( iVolumeHider )
+        {
+        iVolumeHider->Cancel();
+        }
+    if ( iContainer )
+        {
+        iNaviPane->Pop( iTimeNavi );
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+
+        delete iContainer;
+        iContainer = NULL;
+        }
+
+    }
+
+void CVeiCutAudioView::SetVideoClipAndIndex( CVedMovie& aVideoClip, TInt aIndex )
+    {
+    iMovie = &aVideoClip;
+
+    iIndex = aIndex;
+    }
+
+void CVeiCutAudioView::PlayPreviewL()
+    {
+    iPlayMarked = EFalse;
+    StartNaviPaneUpdateL();
+    iContainer->PlayL();
+    }
+
+void CVeiCutAudioView::PausePreviewL()
+    {
+    STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+        SetPauseIconVisibilityL( ETrue );
+    StopNaviPaneUpdateL();
+    iContainer->PauseL();
+    }
+
+void CVeiCutAudioView::UpdateCBAL(TInt aState)
+    {
+    switch (aState)
+        {
+        case CVeiCutAudioContainer::EStateInitializing:
+        case CVeiCutAudioContainer::EStateOpening:
+            {
+            Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY); 
+            break;
+            }
+        case CVeiCutAudioContainer::EStateStoppedInitial:
+            {           
+            if ( ( iMovie->AudioClipCutInTime( iIndex ) == TTimeIntervalMicroSeconds( 0 ) ) &&
+                 ( iMovie->AudioClipCutOutTime( iIndex ) == iMovie->AudioClipInfo(iIndex)->Duration() ) )
+                {       
+                Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);   
+                }
+            else
+                {                                                               
+                Cba()->SetCommandSetL(R_VEI_SOFTKEYS_OPTIONS_DONE);             
+                }
+            break;          
+            }
+        case CVeiCutAudioContainer::EStatePaused:
+        case CVeiCutAudioContainer::EStateStopped:
+            {
+            if ( ( iMovie->AudioClipCutInTime( iIndex ) == TTimeIntervalMicroSeconds( 0 ) ) &&
+                 ( iMovie->AudioClipCutOutTime( iIndex ) == iMovie->AudioClipInfo(iIndex)->Duration() ) )
+                {       
+                Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);   
+                }
+            else
+                {                                                               
+                Cba()->SetCommandSetL(R_VEI_SOFTKEYS_OPTIONS_DONE);             
+                }
+            break;
+            }
+        case CVeiCutAudioContainer::EStatePlaying:
+            {
+
+            if ( iContainer->PlaybackPositionL() < iMovie->AudioClipCutInTime( iIndex ) )
+                {
+                Cba()->SetCommandSetL( R_VEI_SOFTKEYS_IN_EMPTY ); 
+                iMarkState = EMarkStateIn;
+                }
+            else if ( iContainer->PlaybackPositionL() < iMovie->AudioClipCutOutTime( iIndex ) )
+                {
+                Cba()->SetCommandSetL( R_VEI_SOFTKEYS_IN_OUT ); 
+                iMarkState = EMarkStateInOut;
+                }
+            else if ( ( iContainer->PlaybackPositionL() > iMovie->AudioClipCutOutTime( iIndex ) ) && iPlayMarked )
+                {
+                iContainer->StopL();
+                iPlayMarked = EFalse;
+                }
+            else
+                {
+                Cba()->SetCommandSetL( R_VEI_SOFTKEYS_EMPTY_OUT ); 
+                iMarkState = EMarkStateOut;
+                }
+            break;
+            }
+        default:
+            {
+            break;  
+            }
+        }
+    Cba()->DrawDeferred();
+    }
+
+void CVeiCutAudioView::PlayMarkedL()
+    {
+    TTimeIntervalMicroSeconds audioPlayStartTime;
+    audioPlayStartTime = iMovie->AudioClipCutInTime( iIndex );
+    
+    TTimeIntervalMicroSeconds audioPlayCutOutTime;
+    audioPlayCutOutTime = iMovie->AudioClipCutOutTime( iIndex );
+    
+    if ( !(( audioPlayStartTime.Int64() + 50000 ) > audioPlayCutOutTime.Int64() ) )
+        {
+        iPlayMarked = ETrue;    
+        StartNaviPaneUpdateL();
+    
+        iContainer->PlayL( audioPlayStartTime.Int64() + 1000 );
+        }
+    else    
+        {
+        iContainer->StopL();
+        }
+    }
+
+void CVeiCutAudioView::ClearInOutL( TBool aClearIn, TBool aClearOut )
+    {
+    if ( aClearIn ) 
+        {
+        iMovie->AudioClipSetCutInTime( iIndex, TTimeIntervalMicroSeconds( 0 ) );
+        iContainer->SetInTimeL( iMovie->AudioClipCutInTime( iIndex ) );
+        }
+    if ( aClearOut ) 
+        {
+        TTimeIntervalMicroSeconds audioClipOriginalDuration;
+        audioClipOriginalDuration = iMovie->AudioClipInfo( iIndex )->Duration();
+        iMovie->AudioClipSetCutOutTime( iIndex, audioClipOriginalDuration );
+        iContainer->SetOutTimeL( audioClipOriginalDuration );
+        }
+        
+    TTimeIntervalMicroSeconds cutin = iMovie->AudioClipCutInTime( iIndex );
+    TTimeIntervalMicroSeconds cutout = iMovie->AudioClipCutOutTime( iIndex );
+    
+    if ( ( cutin == TTimeIntervalMicroSeconds( 0 ) ) &&
+         ( cutout == iMovie->AudioClipInfo(iIndex)->Duration() ) )
+        {       
+        Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);   
+        Cba()->DrawDeferred();
+        }   
+    }
+
+void CVeiCutAudioView::MarkInL()
+    {
+    STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+                SetPauseIconVisibilityL( ETrue );
+    StopNaviPaneUpdateL();
+/* Check that cut in time is before cut out time */
+    TTimeIntervalMicroSeconds cutOutTime = iMovie->AudioClipCutOutTime( iIndex );
+    TTimeIntervalMicroSeconds cutInTime = iContainer->PlaybackPositionL();
+    if ( cutInTime >= cutOutTime )
+        {
+        cutInTime = cutOutTime.Int64() - 100000;
+        }
+    
+    iMovie->AudioClipSetCutInTime( iIndex, cutInTime );
+    iContainer->MarkedInL();
+    }
+
+void CVeiCutAudioView::MarkOutL()
+    {
+    STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+        SetPauseIconVisibilityL( ETrue );
+    StopNaviPaneUpdateL();
+    
+    TTimeIntervalMicroSeconds cutOutTime = iContainer->PlaybackPositionL();
+    TTimeIntervalMicroSeconds cutInTime = iMovie->AudioClipCutInTime( iIndex );
+    if ( cutOutTime <= cutInTime )
+        {
+        cutOutTime = cutInTime.Int64() + 100000;
+        }           
+    
+    //iMovie->AudioClipSetCutOutTime( iIndex, iContainer->PlaybackPositionL() );
+    iMovie->AudioClipSetCutOutTime( iIndex, cutOutTime );   
+    iContainer->MarkedOutL();
+    }
+
+void CVeiCutAudioView::MoveStartOrEndMarkL( TTimeIntervalMicroSeconds aPosition, CVeiCutAudioContainer::TCutMark aMarkType )
+	{
+	LOG(KVideoEditorLogFile, "CVeiCutAudioView::MoveStartOrEndMarkL, In");
+	
+	StopNaviPaneUpdateL();
+	
+	LOG(KVideoEditorLogFile, "CVeiCutAudioView::MoveStartOrEndMarkL, 2");
+	
+	if ( aMarkType == CVeiCutAudioContainer::EStartMark )
+		{
+		iMovie->VideoClipSetCutInTime( iIndex, aPosition );
+		}
+	else if ( aMarkType == CVeiCutAudioContainer::EEndMark )
+		{
+		iMovie->VideoClipSetCutOutTime( iIndex, aPosition );
+		}		
+	LOG( KVideoEditorLogFile, "CVeiCutAudioView::MoveStartOrEndMarkL, Out" );
+	}
+
+
+TUint CVeiCutAudioView::InPointTime()
+    {
+    if ( !iMovie )
+        {
+        return 0;
+        }
+    else
+        {
+        return (static_cast<TInt32>(iMovie->AudioClipCutInTime(iIndex).Int64() / 1000));
+        }
+    }
+
+TUint CVeiCutAudioView::OutPointTime()
+    {
+    if ( !iMovie )
+        {
+        return 0;
+        }
+    else
+        {
+        return (static_cast<TInt32>(iMovie->AudioClipCutOutTime(iIndex).Int64() / 1000));
+        }
+    }
+
+CAknNavigationDecorator* CVeiCutAudioView::CreateTimeLabelNaviL()
+    {
+    CVeiTimeLabelNavi* timelabelnavi = CVeiTimeLabelNavi::NewLC();
+    CAknNavigationDecorator* decoratedFolder =
+        CAknNavigationDecorator::NewL(iNaviPane, timelabelnavi, CAknNavigationDecorator::ENotSpecified);
+    CleanupStack::Pop(timelabelnavi);
+    
+    CleanupStack::PushL(decoratedFolder);
+    decoratedFolder->SetContainerWindowL(*iNaviPane);
+    CleanupStack::Pop(decoratedFolder);
+    decoratedFolder->MakeScrollButtonVisible(EFalse);
+
+    return decoratedFolder;
+    }
+
+TInt CVeiCutAudioView::UpdateTimeCallbackL(TAny* aPtr)
+    {
+    CVeiCutAudioView* view = (CVeiCutAudioView*)aPtr;
+
+    view->UpdateTimeL();
+
+    return 1;
+    }
+
+
+void CVeiCutAudioView::UpdateTimeL()
+    {
+    DrawTimeNaviL();
+
+    TTimeIntervalMicroSeconds playbackPos = iContainer->PlaybackPositionL();
+
+    if (iMarkState == EMarkStateIn) 
+        {
+        if (playbackPos > iMovie->AudioClipCutInTime( iIndex )) 
+            {
+            UpdateCBAL(iContainer->State());
+            }
+        }
+    else if (iMarkState == EMarkStateOut) 
+        {
+        if (playbackPos < iMovie->AudioClipCutOutTime( iIndex )) 
+            {
+            UpdateCBAL(iContainer->State());
+            }
+        }
+    else 
+        {
+        if ((playbackPos < iMovie->AudioClipCutInTime( iIndex )) ||
+            (playbackPos > iMovie->AudioClipCutOutTime( iIndex ))) 
+            {
+            UpdateCBAL(iContainer->State());
+            }
+        }
+    }
+
+void CVeiCutAudioView::DrawTimeNaviL()
+    {
+    TTime elapsed( iContainer->PlaybackPositionL().Int64() );
+    TTime total( iContainer->TotalLength().Int64() );
+
+    TBuf<16> elapsedBuf;
+    TBuf<16> totalBuf;
+
+    HBufC* dateFormatString;
+
+    if ( ( total.Int64() / 1000 ) < 3600000 )   // check if time is over 99:59
+        {
+        dateFormatString = iEikonEnv->AllocReadResourceLC( R_QTN_TIME_DURAT_MIN_SEC );
+        }
+    else
+        {
+        dateFormatString = iEikonEnv->AllocReadResourceLC( R_QTN_TIME_DURAT_LONG );
+        }
+
+    elapsed.FormatL(elapsedBuf, *dateFormatString);
+    total.FormatL(totalBuf, *dateFormatString);
+    CleanupStack::PopAndDestroy(dateFormatString);
+           
+    CDesCArrayFlat* strings = new (ELeave) CDesCArrayFlat(2);
+    CleanupStack::PushL(strings);
+    strings->AppendL(elapsedBuf);
+    strings->AppendL(totalBuf);
+    HBufC* stringholder = StringLoader::LoadL(R_VEI_NAVI_TIME, *strings, iEikonEnv);
+    CleanupStack::PopAndDestroy(strings);
+    CleanupStack::PushL(stringholder);
+
+    STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLabelL(stringholder->Des());
+
+    CleanupStack::PopAndDestroy(stringholder);
+
+
+    /* Prevent the screen light dimming. */
+    if (elapsed.DateTime().Second() == 0 || elapsed.DateTime().Second() == 15 || elapsed.DateTime().Second() == 30 || elapsed.DateTime().Second() == 45)
+        {
+        User::ResetInactivityTime();
+        }
+    }
+
+
+void CVeiCutAudioView::StartNaviPaneUpdateL()
+    {
+    DrawTimeNaviL();
+    if (iTimeUpdater && !iTimeUpdater->IsActive())
+        {
+        iTimeUpdater->Start(500000, 500000, TCallBack(CVeiCutAudioView::UpdateTimeCallbackL, this));
+        }
+    }
+
+void CVeiCutAudioView::StopNaviPaneUpdateL()
+    {
+    if (iContainer)
+        {
+        DrawTimeNaviL();
+        }
+    if (iTimeUpdater && iTimeUpdater->IsActive())
+        {
+        iTimeUpdater->Cancel();
+        }
+    }
+
+TInt CVeiCutAudioView::HideVolumeCallbackL(TAny* aPtr)
+    {
+    CVeiCutAudioView* view = (CVeiCutAudioView*)aPtr;
+    view->HideVolume();
+    return 0;
+    }
+
+void CVeiCutAudioView::HideVolume()
+    {
+    iNaviPane->Pop(iVolumeNavi);
+    }
+
+void CVeiCutAudioView::VolumeMuteL()
+    {
+    iContainer->SetVolumeL(-1000);
+    }
+
+void CVeiCutAudioView::VolumeDownL()
+    {
+    iContainer->SetVolumeL(-1);
+    TInt volume = iContainer->Volume();
+    if (iVolumeHider->IsActive())
+        {
+        iVolumeHider->Cancel();
+        }
+    if (volume == 0) 
+        {
+        STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->
+            SetVolumeIconVisibilityL( EFalse );
+        HideVolume();
+        volume = 1;
+        return;
+        }
+
+    iNaviPane->PushL(*iVolumeNavi);
+    iVolumeHider->Start(1000000, 100000, TCallBack(CVeiCutAudioView::HideVolumeCallbackL, this));
+
+    STATIC_CAST(CAknVolumeControl*, iVolumeNavi->DecoratedControl())->SetValue(volume);
+
+    STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLeftArrowVisibilityL(ETrue);
+
+    if (volume < iContainer->MaxVolume())
+        {
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetRightArrowVisibilityL(ETrue);
+        }
+    else
+        {
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetRightArrowVisibilityL(EFalse);
+        }
+    }
+
+void CVeiCutAudioView::VolumeUpL()
+    {
+    iContainer->SetVolumeL(1);
+    STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->
+            SetVolumeIconVisibilityL( ETrue );
+
+    TInt volume = iContainer->Volume();
+    if (iVolumeHider->IsActive())
+        {
+        iVolumeHider->Cancel();
+        }
+    iNaviPane->PushL(*iVolumeNavi);
+    iVolumeHider->Start(1000000, 1000000, TCallBack(CVeiCutAudioView::HideVolumeCallbackL, this));
+
+    STATIC_CAST(CAknVolumeControl*, iVolumeNavi->DecoratedControl())->SetValue(volume);
+
+    if (volume > iContainer->MinVolume() + 1)
+        {
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLeftArrowVisibilityL(ETrue);
+        }
+    else
+        {
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLeftArrowVisibilityL(EFalse);
+        }
+
+    if (volume < iContainer->MaxVolume())
+        {
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetRightArrowVisibilityL(ETrue);
+        }
+    else
+        {
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetRightArrowVisibilityL(EFalse);
+        }
+    
+    }
+
+void CVeiCutAudioView::HandleForegroundEventL  ( TBool aForeground )
+    {
+    if ( !aForeground )
+        {
+        // If the application is closing down, calling PauseL could result in 
+        // a callback from the MMF player after the container is already deleted,
+        // causing KERN-EXEC 3
+        if ( static_cast<CVeiAppUi*>( AppUi() )->AppIsOnTheWayToDestruction() )
+            {
+            iContainer->PrepareForTerminationL();
+            }
+        else
+            {
+            iContainer->PauseL();
+            }
+        iNaviPane->Pop( iTimeNavi );
+        }
+    else
+        {
+        iNaviPane->PushL( *iTimeNavi );
+        }
+    }
+
+// ---------------------------------------------------------
+// CVeiCutAudioView::HandleStatusPaneSizeChange()
+// ---------------------------------------------------------
+//
+void CVeiCutAudioView::HandleStatusPaneSizeChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( AppUi()->ClientRect() );
+        }
+    }
+
+void CVeiCutAudioView::GetAudioVisualizationL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutAudioView::GetAudioVisualization(), In");
+    CVedAudioClipInfo* audioInfo = NULL;
+    if (iMovie)
+        {       
+        audioInfo = iMovie->AudioClipInfo( iIndex );        
+        if (audioInfo && iContainer)
+            {
+            TInt64 duration = audioInfo->Duration().Int64();
+            TInt resolution = (duration/1000)/KAudioSampleInterval;
+
+            LOGFMT(KVideoEditorLogFile, "CVeiCutAudioView::GetAudioVisualization() 2, calling audioInfo->GetVisualizationL(*iContainer, resolution, 1), where resolution is:%Ld", resolution);
+            audioInfo->GetVisualizationL(*iContainer, resolution, 1);
+            }               
+        }
+
+    LOG(KVideoEditorLogFile, "CVeiCutAudioView::GetAudioVisualization(), Out");
+    }
+
+void CVeiCutAudioView::CancelVisualizationL()
+    {
+    CVedAudioClipInfo* audioInfo = NULL;
+    if (iMovie)
+        {       
+        audioInfo = iMovie->AudioClipInfo( iIndex );        
+        }
+    if (audioInfo && iContainer)
+        {       
+        TInt resolution = (audioInfo->Duration().Int64()/1000)/KAudioSampleInterval;    
+        audioInfo->CancelVisualizationL();      
+        }   
+    }
+
+void CVeiCutAudioView::HandleResourceChange(TInt aType)
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiCutAudioView::HandleResourceChange() In, aType:%d", aType);
+    
+    if (KAknsMessageSkinChange == aType)
+        {
+        // Handle skin change in the navi label controls - they do not receive 
+        // it automatically since they are not in the control stack
+        iTimeNavi->DecoratedControl()->HandleResourceChange( aType );
+        iVolumeNavi->DecoratedControl()->HandleResourceChange( aType );
+        }
+    
+    LOG(KVideoEditorLogFile, "CVeiCutAudioView::HandleResourceChange() Out");
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiCutVideoContainer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1653 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+// System includes
+#include <manualvideoeditor.rsg>
+#include <videoeditoruicomponents.mbg>
+#include <eikbtgpc.h>
+#include <vedvideoclipinfo.h>
+#include <coemain.h>
+#include <eikenv.h>
+#include <aknsbasicbackgroundcontrolcontext.h> 
+#include <aknsdrawutils.h> 
+#include <aknsdatacontext.h> 
+#include <stringloader.h>
+#include <aknnotewrappers.h> 
+#include <pathinfo.h> 
+#include <eikprogi.h>
+#include <aknlayoutscalable_avkon.cdl.h>
+#include <aknlayoutscalable_apps.cdl.h>
+// User includes
+#include "VeiAppUi.h"
+#include "VeiCutterBar.h"
+#include "VeiCutVideoContainer.h"
+#include "VeiCutVideoView.h"
+#include "veitextdisplay.h"
+#include "VideoEditorHelp.hlp.hrh"  // Topic contexts (literals)
+#include "VideoEditorCommon.h"
+#include "VideoEditorUtils.h"
+#include "VeiErrorUi.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+void CleanupRarray( TAny* object )
+    {
+    (( RImageTypeDescriptionArray*)object)->ResetAndDestroy();
+    }
+
+CVeiCutVideoContainer* CVeiCutVideoContainer::NewL( const TRect& aRect, CVeiCutVideoView& aView, CVeiErrorUI& aErrorUI )
+    {
+    CVeiCutVideoContainer* self = CVeiCutVideoContainer::NewLC( aRect, aView, aErrorUI );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CVeiCutVideoContainer* CVeiCutVideoContainer::NewLC( const TRect& aRect, CVeiCutVideoView& aView, CVeiErrorUI& aErrorUI )
+    {
+    CVeiCutVideoContainer* self = new (ELeave) CVeiCutVideoContainer( aRect, aView, aErrorUI );
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect, aView, aErrorUI );
+    return self;
+    }
+
+void CVeiCutVideoContainer::ConstructL( const TRect& aRect, CVeiCutVideoView& /*aView*/, CVeiErrorUI& /*aErrorUI*/ )
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::ConstructL: in");
+    CreateWindowL();
+
+    iInternalVolume = 0;
+
+    iState = EStateInitializing;
+    iFrameReady = EFalse;
+    iPlayOrPlayMarked = EFalse;
+
+    iSeekPos = TTimeIntervalMicroSeconds( 0 );
+    iSeeking = EFalse;
+    iCutVideoBar = CVeiCutterBar::NewL( this );
+
+    iConverter = CVeiImageConverter::NewL( this );
+    iTakeSnapshot = EFalse;
+    iVideoDisplay = CVeiVideoDisplay::NewL( iDisplayRect, this, *this );
+    iCutTimeDisplay = CVeiTextDisplay::NewL( iCutTimeDisplayRect, this );
+
+    TFileName mbmPath( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) ); 
+
+    AknIconUtils::CreateIconL( iPauseBitmap, iPauseBitmapMask,
+            mbmPath, EMbmVideoeditoruicomponentsQgn_prop_ve_pause, 
+            EMbmVideoeditoruicomponentsQgn_prop_ve_pause_mask );
+
+    SetRect( aRect );
+
+    iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse );
+    iVideoBarTimer = CPeriodic::NewL( CActive::EPriorityLow );
+
+    EnableDragEvents();
+
+    ActivateL();
+
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::ConstructL: out");
+    }
+
+CVeiCutVideoContainer::CVeiCutVideoContainer( const TRect& /*aRect*/, CVeiCutVideoView& aView, CVeiErrorUI& aErrorUI ):iView( aView ), iErrorUI( aErrorUI )
+    {
+    }
+
+
+CVeiCutVideoContainer::~CVeiCutVideoContainer()
+    {
+    if ( iCutVideoBar )
+        {
+        delete iCutVideoBar;
+        }
+    if ( iBgContext )
+        {
+        delete iBgContext;
+        }
+    if ( iVideoDisplay )
+        {
+        delete iVideoDisplay;
+        }
+    if ( iCutTimeDisplay )
+        {
+        delete iCutTimeDisplay;
+        }
+    if ( iVideoClipInfo )
+        {
+        delete iVideoClipInfo;
+        iVideoClipInfo = NULL;
+        }
+    if ( iConverter )
+        {
+        iConverter->Cancel();
+        delete iConverter;
+        }
+    if ( iVideoBarTimer )
+        {
+        iVideoBarTimer->Cancel();
+        delete iVideoBarTimer;
+        }
+
+    if ( iProgressDialog )
+        {
+        delete iProgressDialog;
+        iProgressDialog = NULL;
+        }
+    if ( iSaveToFileName )
+        {
+        delete iSaveToFileName;
+        iSaveToFileName = NULL;
+        }
+
+    delete iPauseBitmap;
+    delete iPauseBitmapMask;
+
+    delete iRemConTarget;
+    
+    delete iCallBackSaveSnapshot;
+    delete iCallBackTakeSnapshot;
+    }
+
+void CVeiCutVideoContainer::DialogDismissedL( TInt aButtonId )
+    {
+    if ( aButtonId == -1 )
+        { // when pressing cancel button.
+        CancelSnapshotSave();
+        }
+    iTakeSnapshot = EFalse;
+    }
+
+void CVeiCutVideoContainer::SizeChanged()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::SizeChanged(): In");
+	TSize videoScreenSize;
+    TRect rect( Rect() ); 
+	if ( iBgContext )
+		{
+		iBgContext->SetRect( rect );
+		}
+	LOGFMT2(KVideoEditorLogFile, "CVeiCutVideoContainer::SizeChanged(): Rect(): %d,%d", rect.iBr.iX, rect.iBr.iY);
+
+	// Scissor icon
+	TAknLayoutRect scissorsIconLayout;
+	scissorsIconLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::main_vded_pane_g1());
+	iCutVideoBar->SetComponentRect(CVeiCutterBar::EScissorsIcon, scissorsIconLayout.Rect());
+		
+	// Progress bar
+	TAknLayoutRect progressBarLayout; 
+	progressBarLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded_slider_pane());
+	iCutVideoBar->SetComponentRect(CVeiCutterBar::EProgressBar, progressBarLayout.Rect());
+
+	// left end of the slider when that part is unselected
+	TAknLayoutRect sliderLeftEndLayout;
+	sliderLeftEndLayout.LayoutRect( progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g3() );
+	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, sliderLeftEndLayout.Rect() );
+		
+	// middle part of the slider when that part is unselected	
+	TAknLayoutRect sliderMiddleLayout;
+	sliderMiddleLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g5());
+	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon, sliderMiddleLayout.Rect() );		
+	
+	// right end of the slider when that part is unselected
+	TAknLayoutRect sliderRightEndLayout;
+	sliderRightEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g4());
+	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon, sliderRightEndLayout.Rect() );	
+		
+	// left end of the cut selection slider 
+	TAknLayoutRect sliderSelectedLeftEndLayout;
+	sliderSelectedLeftEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g3());
+	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderSelectedLeftEndIcon, sliderSelectedLeftEndLayout.Rect() );
+		
+	// middle part of the cut selection slider 
+	TAknLayoutRect sliderSelectedMiddleLayout;
+	sliderSelectedMiddleLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g5());
+	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon, sliderSelectedMiddleLayout.Rect() );		
+	
+	// right end of the cut selection slider 
+	TAknLayoutRect sliderSelectedRightEndLayout;
+	sliderSelectedRightEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g4());
+	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderSelectedRightEndIcon, sliderSelectedRightEndLayout.Rect() ); 
+
+    // playhead
+    TAknLayoutRect playheadLayout;
+	playheadLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g1());
+	iCutVideoBar->SetComponentRect( CVeiCutterBar::EPlayheadIcon, playheadLayout.Rect() ); 
+
+    // left/right border of cut selection slider
+    TAknLayoutRect cutAreaBorderLayout;
+	cutAreaBorderLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g2());
+	iCutVideoBar->SetComponentRect( CVeiCutterBar::ECutAreaBorderIcon, cutAreaBorderLayout.Rect() ); 
+		
+		
+	// Start cut time text
+	TAknLayoutText startTimeTextLayout;
+	startTimeTextLayout.LayoutText(rect, AknLayoutScalable_Apps::main_vded_pane_t1() );
+	iCutTimeDisplay->SetComponentRect(CVeiTextDisplay::EStartTimeText, startTimeTextLayout.TextRect());
+	
+	// End cut time text
+	TAknLayoutText endTimeTextLayout;
+	endTimeTextLayout.LayoutText(rect, AknLayoutScalable_Apps::main_vded_pane_t2() );
+	iCutTimeDisplay->SetComponentRect(CVeiTextDisplay::EEndTimeText, endTimeTextLayout.TextRect());
+	
+	// Start cut time icon
+	TAknLayoutRect startTimeIconLayout;
+	startTimeIconLayout.LayoutRect(rect, AknLayoutScalable_Apps::main_vded_pane_g2() );
+	iCutTimeDisplay->SetComponentRect(CVeiTextDisplay::EStartTimeIcon, startTimeIconLayout.Rect());
+	
+	// End cut time icon
+	TAknLayoutRect endTimeIconLayout;
+	endTimeIconLayout.LayoutRect(rect, AknLayoutScalable_Apps::main_vded_pane_g3() );
+	iCutTimeDisplay->SetComponentRect(CVeiTextDisplay::EEndTimeIcon, endTimeIconLayout.Rect());
+		
+	// Pause icon
+	
+
+
+	// Video Display	
+	TAknLayoutRect videoDisplayLayout;
+	videoDisplayLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded_video_pane());
+	iVideoDisplay->SetRect(videoDisplayLayout.Rect());
+	
+	iDisplayRect = videoDisplayLayout.Rect();	
+	iIconDisplayRect = videoDisplayLayout.Rect();
+	LOGFMT2(KVideoEditorLogFile, "CVeiCutVideoContainer::SizeChanged(): iDisplayRect: %d,%d", iDisplayRect.iBr.iX, iDisplayRect.iBr.iY);
+
+	//CVeiCutterBar
+	// : Change this when LAF data is ready
+	TPoint cutBarTl = TPoint(STATIC_CAST( TInt, rect.iBr.iX*0.0114 ),
+		STATIC_CAST( TInt, rect.iBr.iY*0.875 ) );
+	TSize cutBarSize = TSize(STATIC_CAST( TInt, rect.iBr.iX*0.9773 ),
+		STATIC_CAST( TInt, rect.iBr.iY*0.0973 ) );
+
+	TRect cutBarRect( cutBarTl, cutBarSize );
+	iCutVideoBar->SetRect( cutBarRect );
+
+	//CVeiTextDisplay
+	// : Change this when LAF data is ready
+	TPoint cutTimeDisplayTl = TPoint(cutBarTl.iX,
+		STATIC_CAST( TInt, rect.iBr.iY*0.757 ) );
+	TSize cutTimeDisplaySize = TSize(cutBarSize.iWidth,
+		STATIC_CAST( TInt, rect.iBr.iY*0.0903 ) );
+
+	iCutTimeDisplayRect = TRect( cutTimeDisplayTl, cutTimeDisplaySize );
+	iCutTimeDisplay->SetRect( iCutTimeDisplayRect );
+	iCutTimeDisplay->SetLayout( CVeiTextDisplay::ECutInCutOut );
+
+		
+	TInt iconWidth = STATIC_CAST( TInt, rect.iBr.iX * 0.07954545455 );
+	AknIconUtils::SetSize( iPauseBitmap, TSize(iconWidth,iconWidth), EAspectRatioNotPreserved );
+        
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::SizeChanged(): Out");
+    }
+
+TTypeUid::Ptr CVeiCutVideoContainer::MopSupplyObject( TTypeUid aId )
+    {
+    if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext )
+        {
+        return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+        }
+    return CCoeControl::MopSupplyObject( aId );
+    }
+
+TInt CVeiCutVideoContainer::CountComponentControls() const
+    {
+    return 3; 
+    }
+
+CCoeControl* CVeiCutVideoContainer::ComponentControl( TInt aIndex ) const
+    {
+    switch ( aIndex )
+        {
+        case 0:
+            return iCutVideoBar;
+        case 1:
+            return iVideoDisplay;
+        case 2:
+            return iCutTimeDisplay;
+        default:
+            return NULL;
+        }
+    }
+
+void CVeiCutVideoContainer::Draw( const TRect& aRect ) const
+    {
+    CWindowGc& gc = SystemGc();
+    // draw skin background
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );    
+    AknsDrawUtils::Background( skin, cc, this, gc, aRect );
+
+    if ( EStatePaused == iState )
+        {       
+        TPoint pauseIconTl = TPoint( iIconDisplayRect.iTl.iX - STATIC_CAST( TInt, Rect().iBr.iX*0.105),
+            iIconDisplayRect.iTl.iY + STATIC_CAST( TInt, Rect().iBr.iY*0.178 ));
+        gc.BitBltMasked( pauseIconTl, iPauseBitmap, 
+            TRect( TPoint(0,0), iPauseBitmap->SizeInPixels() ), 
+            iPauseBitmapMask, EFalse );
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiCutVideoContainer::GetHelpContext(...) const
+//
+// Gets the control's help context. Associates the control with a particular
+// Help file and topic in a context sensitive application.
+// ----------------------------------------------------------------------------
+//
+void CVeiCutVideoContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::GetHelpContext(): In");
+
+    // Set UID of the CS Help file (same as application UID).
+    aContext.iMajor = KUidVideoEditor;
+
+    // Set the context/topic.
+    aContext.iContext = KVED_HLP_CUT_VIDEO_VIEW;
+
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::GetHelpContext(): Out");
+    }
+
+
+void CVeiCutVideoContainer::HandleControlEventL(
+    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CVeiCutVideoContainer::HandlePointerEventL
+// From CCoeControl
+// ----------------------------------------------------------------------------
+//		
+void CVeiCutVideoContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
+	{
+	LOG( KVideoEditorLogFile, "CVeiCutVideoContainer::HandlePointerEventL(): In" );
+	if( AknLayoutUtils::PenEnabled() && iCutVideoBar )
+		{
+		CCoeControl::HandlePointerEventL( aPointerEvent );
+		
+		switch( aPointerEvent.iType )
+			{
+			case TPointerEvent::EButton1Down:
+				{
+				iIsMarkDrag = EFalse;
+				iIsMarkTapped = EFalse;
+				TRect startMarkRect = iCutVideoBar->StartMarkRect();
+				TRect endMarkRect = iCutVideoBar->EndMarkRect();				
+				// check if the pen goes down inside the start mark
+				if (startMarkRect.Contains(aPointerEvent.iPosition)) 
+					{
+					iIsMarkTapped = ETrue;
+					iTappedMark = EStartMark;
+					}
+				// check if the pen goes down inside the end mark	
+				else if (endMarkRect.Contains(aPointerEvent.iPosition))
+					{
+					iIsMarkTapped = ETrue;
+					iTappedMark = EEndMark;
+					}					
+				
+				TRect progressBarRect(iCutVideoBar->ProgressBarRect());	
+				// check if the pen goes down inside the progress bar				
+				if( progressBarRect.Contains( aPointerEvent.iPosition ) )
+					{
+					iIsMarkDrag = EFalse;					
+					}
+				break;
+				}
+			case TPointerEvent::EDrag:
+				{
+				
+				TRect progressBarRect(iCutVideoBar->ProgressBarRect());
+				if ( progressBarRect.Contains( aPointerEvent.iPosition ) )
+				{
+					
+					if (iIsMarkTapped)
+						{
+						iIsMarkDrag = ETrue;
+						HandleProgressBarTouchL( progressBarRect, 
+												 aPointerEvent.iPosition.iX,
+												 ETrue,
+												 iTappedMark );
+						}
+					else 
+						{
+						
+						HandleProgressBarTouchL( progressBarRect, 
+												 aPointerEvent.iPosition.iX,
+												 EFalse);
+						}
+				}
+				break;		
+				}
+			case TPointerEvent::EButton1Up:
+				{
+				// pen up event is handled if it wasn't dragged
+				if (!iIsMarkDrag)
+					{
+					TRect progressBarRect(iCutVideoBar->ProgressBarRect());					
+					// Check if pressed position is in progress bar's rect
+					if( progressBarRect.Contains( aPointerEvent.iPosition ) )
+						{
+						HandleProgressBarTouchL( progressBarRect, 
+											 aPointerEvent.iPosition.iX,
+											 EFalse);
+						}
+					}
+				break;
+				}		
+			default:
+				{
+				break;	
+				}	
+			}
+		}	
+	LOG( KVideoEditorLogFile, "CVeiCutVideoContainer::HandlePointerEventL(): Out" );		
+	}
+
+
+// ----------------------------------------------------------------------------
+// CVeiCutVideoContainer::HandleProgressBarTouchL
+// 
+// ----------------------------------------------------------------------------
+//	
+void CVeiCutVideoContainer::HandleProgressBarTouchL( TRect aPBRect, 
+												 TInt aPressedPoint,
+												 TBool aDragMarks,
+												 CVeiCutVideoContainer::TCutMark aCutMark )
+	{
+	if (( AknLayoutUtils::PenEnabled() ) && ( iState!=EStateInitializing ))
+		{	
+		LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::HandleProgressBarTouchL(): In");
+
+		if ( iState == EStatePlaying )		
+			{
+			StopL();	
+			}
+		
+		// Progress Bar start and end points, and length
+		TInt pbEndPoint( aPBRect.iBr.iX );
+		TInt pbStartPoint = ( aPBRect.iTl.iX );		
+		TInt totalPBLength( pbEndPoint - pbStartPoint );
+				
+		// calculate the time position from the tapped progress bar coordinates 
+		TTimeIntervalMicroSeconds newPosition( 
+										( ( aPressedPoint - pbStartPoint ) * 
+							  			iVideoClipInfo->Duration().Int64() ) / 
+							  			totalPBLength );
+		
+		// move cut marks
+		if (aDragMarks)
+		{
+			// check that the start mark doesn't go past the end mark
+			// and not to the beginning			
+			if ((aCutMark == EStartMark) && 
+			    (newPosition.Int64() > 0) &&
+				(aPressedPoint < iCutVideoBar->EndMarkPoint() - 2*iCutVideoBar->EndMarkRect().Width()))
+				{				
+				iView.MoveStartOrEndMarkL(newPosition, EStartMark);				
+				iCutVideoBar->SetInPoint( newPosition	);
+				iCutTimeDisplay->SetCutIn( newPosition );
+				}
+			// check that the end mark doesn't go before the start mark	
+			// and not too close to the beginning			
+			else if ((aCutMark == EEndMark) && 
+				(newPosition.Int64() >= KMinCutVideoLength) &&			
+				(aPressedPoint > iCutVideoBar->StartMarkPoint() + 2*iCutVideoBar->StartMarkRect().Width()))
+                
+				{				
+				iView.MoveStartOrEndMarkL(newPosition, EEndMark);				
+				iCutVideoBar->SetOutPoint( newPosition	);
+				iCutTimeDisplay->SetCutOut( newPosition );
+				}
+		}
+				
+		// move playhead
+		else if (( newPosition != iLastPosition ) && !aDragMarks)
+			{
+			iLastPosition = newPosition;
+			
+			iSeekPos = TTimeIntervalMicroSeconds( newPosition );
+			
+			iCutVideoBar->SetCurrentPoint(( static_cast<TInt32>(iSeekPos.Int64() / 1000) ));
+			iVideoDisplay->SetPositionL( iSeekPos );
+			GetThumbAtL( iSeekPos );
+					
+			iView.UpdateTimeL();
+			}	
+			
+		LOG( KVideoEditorLogFile, "CVeiCutVideoContainer::HandleProgressBarTouchL(): Out" );
+			
+		}// PenEnabled
+		
+	}
+
+
+
+
+void CVeiCutVideoContainer::PlayL( const TDesC& aFilename )
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::PlayL: in");   
+    iVideoDisplay->SetPositionL( iSeekPos );
+    
+    if (iVideoClipInfo && !iFrameReady)
+        {                               
+        iVideoClipInfo->CancelFrame();
+        }
+    iVideoDisplay->PlayL( aFilename );
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::PlayL: out");
+    }
+
+void CVeiCutVideoContainer::PlayMarkedL( const TDesC& aFilename,
+                                    const TTimeIntervalMicroSeconds& aStartTime, 
+                                    const TTimeIntervalMicroSeconds& aEndTime )
+    {
+    LOGFMT3(KVideoEditorLogFile, "CVeiCutVideoContainer::PlayMarkedL, In, aStartTime:%Ld, aEndTime:%Ld, aFilename:%S", aStartTime.Int64(), aEndTime.Int64(), &aFilename);
+    iPlayOrPlayMarked = ETrue;
+
+    if (iVideoClipInfo && !iFrameReady)
+        {                               
+        iVideoClipInfo->CancelFrame();
+        }
+    iVideoDisplay->PlayL( aFilename, aStartTime, aEndTime );
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::PlayMarkedL, Out");
+    }
+
+void CVeiCutVideoContainer::StopL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::StopL, in");
+    iVideoDisplay->Stop( EFalse );
+
+    iSeekPos = TTimeIntervalMicroSeconds( 0 );
+    
+    SetStateL( EStateStopped );
+    PlaybackPositionL();
+    
+    if (iVideoBarTimer)
+        {       
+        iVideoBarTimer->Cancel();
+        }
+    
+    iCutVideoBar->SetFinishedStatus( ETrue );
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::StopL, in");
+    }
+
+void CVeiCutVideoContainer::TakeSnapshotL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::TakeSnapshotL in");
+    
+    if( !iVideoClipInfo || !iFrameReady )
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::TakeSnapshotL: 1");
+        if (!iFrameReady)
+            {
+            iTakeSnapshotWaiting = ETrue;   
+            }       
+        return;
+        }
+        
+    iTakeSnapshotWaiting = EFalse;
+    iTakeSnapshot = ETrue;
+    const TTimeIntervalMicroSeconds& pos = PlaybackPositionL();
+
+    GetThumbAtL( pos );
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::TakeSnapshotL out");
+    }
+
+void CVeiCutVideoContainer::PauseL( TBool aUpdateCBA )
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::PauseL: In");
+
+    if (EStatePlaying == iState)
+        {       
+        iLastPosition = iVideoDisplay->PositionL();                 
+        iSeekPos = iLastPosition;
+        // to set next start point
+        iVideoDisplay->SetPositionL(iSeekPos);
+        }
+
+    iVideoDisplay->PauseL();
+    if (iVideoBarTimer)
+        {       
+        iVideoBarTimer->Cancel();
+        }
+
+    #ifdef GET_PAUSE_THUMBNAIL
+    GetThumbAtL( iLastPosition );
+    #endif
+
+    if (EStateStoppedInitial == iState || EStateStopped == iState ||
+        (EStateGettingFrame == iState && 
+            (EStateStoppedInitial == iPreviousState || EStateStopped == iPreviousState)))
+        {
+        // just to trigger cba-update
+        SetStateL( iState, aUpdateCBA );
+        }   
+    else if (EStateInitializing != iState) 
+        {
+        SetStateL( EStatePaused, aUpdateCBA );
+        }
+    else
+        {
+        SetStateL( EStateStoppedInitial );
+        }
+            
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::PauseL: Out");
+    }
+
+void CVeiCutVideoContainer::SaveSnapshotL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::SaveSnapshotL: In");   
+    //first we have to encode bitmap
+    // get encoder types 
+    RImageTypeDescriptionArray imageTypes; 
+    iConverter->GetEncoderImageTypesL( imageTypes );    
+
+    CleanupStack::PushL( TCleanupItem( CleanupRarray, &imageTypes ) );
+
+    TInt selectedIdx = 0;
+
+    for( TInt i=0; i<imageTypes.Count(); i++ ) 
+        {
+        if ( imageTypes[i]->Description() == KEncoderType )
+            {
+            selectedIdx = i;
+            }
+        }
+
+    RFs&    fs = iEikonEnv->FsSession();
+
+    TParse file;
+    TFileName newname;
+    TFileName snapshotdir;
+
+    TVeiSettings saveSettings;
+    // Get default snapshot name from settings view
+
+    STATIC_CAST( CVeiAppUi*, iEikonEnv->AppUi() )->ReadSettingsL( saveSettings );   
+
+    CAknMemorySelectionDialog::TMemory memory( saveSettings.MemoryInUse() );
+
+    newname.Append( saveSettings.DefaultSnapshotName() );
+    newname.Append( _L(".JPEG") );
+    file.Set( newname, NULL, NULL );
+
+    TInt error = KErrNone;
+
+    snapshotdir.Zero();
+
+    if ( memory == CAknMemorySelectionDialog::EPhoneMemory )
+        {
+        snapshotdir.Append( PathInfo::PhoneMemoryRootPath() ); 
+        }
+    else
+        {
+        snapshotdir.Append( PathInfo::MemoryCardRootPath() ); 
+        }
+    snapshotdir.Append( PathInfo::ImagesPath() );
+
+    error = fs.MkDirAll( file.Path() );
+    if ( ( error != KErrAlreadyExists ) && ( error != KErrNone ) )
+        {
+        return;
+        }
+
+    newname.Zero();
+    newname.Append( file.NameAndExt() );
+    newname.Insert( 0, snapshotdir );
+    CApaApplication::GenerateFileName( fs, newname );
+
+    //for cancellation
+    if ( iSaveToFileName )
+        {
+        delete iSaveToFileName;
+        iSaveToFileName = NULL;
+        }
+    iSaveToFileName = HBufC::NewL( newname.Length() );
+    *iSaveToFileName = newname;
+
+    // request the actuall save/encode
+    // asynchronous, the result is reported via callback NotifyCompletion
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::SaveSnapshotL: 1, calling iConverter->StartToEncodeL");    
+    iConverter->StartToEncodeL( newname, 
+        imageTypes[selectedIdx]->ImageType(), imageTypes[selectedIdx]->SubType());
+
+    CleanupStack::PopAndDestroy( &imageTypes );
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::SaveSnapshotL: Out");  
+    }
+
+void CVeiCutVideoContainer::CancelSnapshotSave()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::CancelSnapshotSave: in");
+    if ( iConverter )
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::CancelSnapshotSave: 1");
+        iConverter->Cancel();
+        iConverter->CancelEncoding(); //also close the file
+        }
+    if ( iSaveToFileName )
+        {
+        LOGFMT(KVideoEditorLogFile, "CVeiCutVideoContainer::CancelSnapshotSave: 2, iSaveToFileName:%S", iSaveToFileName);
+
+        RFs&    fs = iEikonEnv->FsSession(); 
+        /*TInt result =*/ fs.Delete( *iSaveToFileName ); 
+        delete iSaveToFileName;
+        iSaveToFileName = NULL;
+        }
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::CancelSnapshotSave: out"); 
+    }
+
+void CVeiCutVideoContainer::CloseStreamL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::CloseStreamL, in");
+    if( !iFrameReady && iVideoClipInfo )
+        {
+        iVideoClipInfo->CancelFrame();
+        }
+    PlaybackPositionL();
+    SetStateL( EStateStopped, EFalse );
+    iView.UpdateCBAL(iState);
+    
+    iVideoDisplay->Stop( ETrue );
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::CloseStreamL, out");
+    }
+
+void CVeiCutVideoContainer::SetInTime( const TTimeIntervalMicroSeconds& aTime )
+    {
+    if ( iCutTimeDisplay )
+        {
+        iCutTimeDisplay->SetCutIn( aTime );
+        }
+    if ( iCutVideoBar )
+        {
+        iCutVideoBar->SetInPoint( aTime );
+        }
+    }
+
+void CVeiCutVideoContainer::SetOutTime( const TTimeIntervalMicroSeconds& aTime )
+    {
+    if ( iCutTimeDisplay )
+        {
+        iCutTimeDisplay->SetCutOut( aTime );
+        }
+
+    if ( iCutVideoBar )
+        {
+        iCutVideoBar->SetOutPoint( aTime );
+        }
+    }
+
+TTimeIntervalMicroSeconds CVeiCutVideoContainer::PlaybackPositionL()
+    {
+    if ( ( iSeeking ) || ( EStateStopped == iState ) )
+        {
+        return iSeekPos;
+        }
+    if ( iState != EStatePlaying  )
+        {
+        return iLastPosition;
+        }
+
+    if ( iVideoClipInfo && (iVideoDisplay->PositionL() < iVideoClipInfo->Duration()) )
+        {
+        iLastPosition = iVideoDisplay->PositionL();
+        }
+
+    if ( ( iLastPosition == TTimeIntervalMicroSeconds( 0 ) ) &&
+         ( iSeekPos != TTimeIntervalMicroSeconds( 0 ) ) )
+        {
+        return iSeekPos;
+        }
+
+    return iLastPosition;
+    }
+
+TKeyResponse CVeiCutVideoContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
+    {
+    if ( aType == EEventKeyDown ) 
+        {
+        iKeyRepeatCount = 0;
+
+        TBool shiftKeyPressed = (aKeyEvent.iModifiers & EModifierShift );
+        if( shiftKeyPressed )
+            {
+            if( iView.IsEnoughFreeSpaceToSaveL() && (iTakeSnapshot == EFalse )) 
+                {
+                /*if (EStatePlaying == iState)
+                    {
+                    PauseL();   
+                    }
+                    */
+                TakeSnapshotL();
+                }
+            return EKeyWasConsumed;
+            }   
+
+        return EKeyWasNotConsumed;
+        }
+    else if ( aType == EEventKeyUp ) 
+        {
+        if ( iSeeking == EFalse )
+            {
+            return EKeyWasNotConsumed;
+            }
+        iLastPosition = iSeekPos;
+        iVideoDisplay->SetPositionL( iSeekPos );
+
+        iSeeking = EFalse;
+
+        if ( ( ( EStateStopped == iState ) || ( EStateStoppedInitial == iState )
+            || ( EStatePaused == iState )) && 
+             ( ( iLastKeyCode == EKeyLeftArrow ) || ( iLastKeyCode == EKeyRightArrow ) ) )
+            {
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::OfferKeyEventL: 1, calling GetThumbAtL()");
+            GetThumbAtL( iSeekPos );
+            return EKeyWasConsumed;
+            }
+        else if ( EStatePlaying == iState )
+            {
+            if ( iVideoBarTimer->IsActive() )
+                {
+                iVideoBarTimer->Cancel();
+                }
+
+            if ( iVideoClipInfo &&  (iSeekPos >= iVideoClipInfo->Duration()) )
+                {
+                LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::OfferKeyEventL: 2, calling iVideoDisplay->Stop");
+                iVideoDisplay->Stop( EFalse );
+                }
+            else
+                {
+                iVideoDisplay->SetPositionL( iSeekPos );
+                iVideoDisplay->ShowBlackScreen();
+                if (iVideoClipInfo && !iFrameReady)
+                    {                               
+                    iVideoClipInfo->CancelFrame();
+                    }
+                iVideoDisplay->Play();
+                }
+            return EKeyWasConsumed;
+            }
+        else
+            {
+            return EKeyWasConsumed;
+            }
+        }
+    else if ( aType == EEventKey )
+        {
+        iLastKeyCode = aKeyEvent.iCode;
+
+        switch (aKeyEvent.iCode)
+            {
+            case EKeyOK:
+                {
+                iView.HandleCommandL( EAknSoftkeyOk );
+                return EKeyWasConsumed;
+                }
+            case EKeyDownArrow:
+            case EKeyUpArrow:
+                {
+                iVideoDisplay->OfferKeyEventL( aKeyEvent, aType );
+                return EKeyWasConsumed;
+                }
+            case EKeyRightArrow:
+                {
+                iKeyRepeatCount++;
+
+                if ( (iKeyRepeatCount > 2)  && (iSeeking == EFalse) )
+                    {
+                    if ( EStatePlaying == iState )
+                        {
+                        iSeekPos = iVideoDisplay->PositionL();
+                        }
+    
+                    iVideoDisplay->PauseL();
+                    iSeeking = ETrue;
+                    iKeyRepeatCount = 0;                
+                    }
+
+                if ( iSeeking && ( iState!=EStateInitializing ) &&
+                    ( iState!=EStatePlayingMenuOpen ) )
+                    {
+                    TInt adjustment = TimeIncrement( iKeyRepeatCount );
+
+                    TInt64 newPos = iSeekPos.Int64() + adjustment;
+                    if ( iVideoClipInfo && (newPos > iVideoClipInfo->Duration().Int64()) )
+                        {
+                        newPos = iVideoClipInfo->Duration().Int64();
+                        }
+    
+                    iSeekPos = TTimeIntervalMicroSeconds( newPos );
+                    
+                    iCutVideoBar->SetCurrentPoint( (static_cast<TInt32>(iSeekPos.Int64() / 1000)));
+
+                    iView.UpdateTimeL();
+                    return EKeyWasConsumed;
+                    }
+                return EKeyWasNotConsumed;
+                }
+
+            case EKeyLeftArrow:
+                {
+                iKeyRepeatCount++;
+
+                if ( (iKeyRepeatCount > 2)  && (iSeeking == EFalse) )
+                    {
+                    
+                    if ( EStatePlaying == iState )
+                        {
+                        iSeekPos = iVideoDisplay->PositionL();
+                        }
+
+                    iVideoDisplay->PauseL();
+                    iSeeking = ETrue;
+                    iKeyRepeatCount = 0;                
+                    }
+
+                if ( iSeeking && ( iState!=EStateInitializing ) &&
+                    ( iState!=EStatePlayingMenuOpen ) )
+                    {
+
+                    TInt adjustment = TimeIncrement( iKeyRepeatCount );
+
+                    TInt64 newPos = iSeekPos.Int64() - adjustment;
+                    if ( newPos < 0 ) 
+                        {
+                        newPos = 0;
+                        }
+                    iSeekPos = TTimeIntervalMicroSeconds( newPos ); 
+
+                    iCutVideoBar->SetCurrentPoint( static_cast<TInt32>((iSeekPos.Int64() / 1000)) );
+
+                    iView.UpdateTimeL();
+
+                    return EKeyWasConsumed;
+                    }
+                return EKeyWasNotConsumed;
+                }
+            case EKeyBackspace:     //Clear 
+                {
+                if (EStatePlaying != iState)
+                    {
+                    iView.ClearInOutL( ETrue, ETrue );                      
+                    }
+                
+                return EKeyWasConsumed;
+                }
+            default:
+                {
+                return EKeyWasNotConsumed;
+                }
+            }
+        }
+    else
+        {
+        return EKeyWasNotConsumed;
+        }
+    }
+
+
+
+TInt CVeiCutVideoContainer::TimeIncrement(TInt aKeyCount) const
+    {
+    if ( aKeyCount < 3 )
+        {
+        return 100000;
+        }
+    else if ( aKeyCount < 4 )
+        {
+        return 300000;
+        }
+    else if ( aKeyCount < 5 )
+        {
+        return 500000;
+        }
+    else if ( aKeyCount < 10 )
+        {
+        return 1000000;
+        }
+    else if ( aKeyCount < 13 )
+        {
+        return 2000000;
+        }
+    else if ( aKeyCount < 15 )
+        {
+        return 3000000;
+        }
+    else
+        {
+        return 5000000;
+        }   
+    }
+
+TInt CVeiCutVideoContainer::UpdateProgressNoteL()
+    {
+    TTime intervalTime;
+    intervalTime.HomeTime();
+    intervalTime += TTimeIntervalMicroSeconds( 50000 );
+    TTime currentTime;
+    currentTime.HomeTime();
+    while ( intervalTime > currentTime )
+        {
+        currentTime.HomeTime();
+        }
+
+    iProgressInfo->IncrementAndDraw( 1 );
+
+    if ( KProgressbarFinalValue <= iProgressInfo->CurrentValue() )
+        {
+        return 0;
+        }
+    return 1;
+    }
+
+
+void CVeiCutVideoContainer::GetThumbL( const TDesC& aFilename )
+    {
+    if ( iVideoClipInfo )
+        {
+        delete iVideoClipInfo;
+        iVideoClipInfo = NULL;      
+        }
+
+    /*iVideoClipInfo = */CVedVideoClipInfo::NewL( aFilename, *this );
+    }
+
+
+void CVeiCutVideoContainer::GetThumbAtL( const TTimeIntervalMicroSeconds& aTime )
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::GetThumbAtL: In");
+    if( !iVideoClipInfo || ( !iFrameReady ) )
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::GetThumbAtL: 1");
+        return;
+        }
+
+    TRect clipResolution = iVideoClipInfo->Resolution();
+    TSize resolution( iVideoDisplay->Size() );
+
+    TInt frameIndex;
+    TInt totalFrameCount;
+
+    frameIndex = iVideoClipInfo->GetVideoFrameIndexL( aTime );
+    totalFrameCount = iVideoClipInfo->VideoFrameCount();
+
+    if ( frameIndex > totalFrameCount )
+        {
+        frameIndex = totalFrameCount;
+        }
+
+    //Generates a thumbnail bitmap of the given frame from video clip
+    if ( iTakeSnapshot )
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::GetThumbAtL: 2");
+        TDisplayMode displayMode = ENone;
+        TBool enhance = ETrue;
+        TSize resol( clipResolution.iBr.iX, clipResolution.iBr.iY ); 
+                
+        /* :
+         check out on every phone before releasing whether videodisplay should be stopped before starting
+         asynchronous GetFrameL()
+         see how EStateGettingFrame is handled in SetPreviewState 
+         Stopping frees memory and it is needed in memory sensible devices 
+        */
+        iVideoClipInfo->GetFrameL( *this, frameIndex, &resol, displayMode, enhance );
+        SetStateL( EStateGettingFrame );
+        iFrameReady = EFalse;           
+        ShowProgressNoteL();        
+        }
+    else
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::GetThumbAtL: 3");              
+        /* :
+         check out on every phone before releasing whether videodisplay should be stopped before starting
+         asynchronous GetFrameL()
+         see how EStateGettingFrame is handled in SetPreviewState 
+         Stopping frees memory and it is needed in memory sensible devices 
+        */
+        iVideoClipInfo->GetFrameL( *this, frameIndex, &resolution );
+        SetStateL( EStateGettingFrame );
+        iFrameReady = EFalse;       
+        }
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::GetThumbAtL: out");    
+    }
+
+void CVeiCutVideoContainer::NotifyCompletion( TInt aErr ) 
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyCompletion: In, aErr:%d", aErr);  
+
+    if (EStateTerminating == iState)
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyCompletion(): app is closing...");
+        return;
+        }
+
+    if ( KErrNone == aErr )
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyCompletion: 1");
+
+        if (iProgressDialog)
+            {
+            TRAP_IGNORE(iProgressDialog->GetProgressInfoL()->SetAndDraw( KProgressbarFinalValue );
+                        iProgressDialog->ProcessFinishedL());
+            }
+        }
+    else
+        {
+        if (iProgressDialog)
+            {
+            TRAP_IGNORE(iProgressDialog->GetProgressInfoL()->SetAndDraw( KProgressbarFinalValue );
+                        iProgressDialog->ProcessFinishedL());
+            }
+        iErrorUI.ShowGlobalErrorNote( aErr );
+        }
+
+    //  to eliminate previous (wrong) output file from being deleted in CancelSnapshotSave()
+    delete iSaveToFileName;
+    iSaveToFileName = NULL;
+
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyCompletion: Out");   
+    }
+
+void CVeiCutVideoContainer::NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo, 
+                                          TInt aError )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoClipInfoReady, In, aError:%d", aError);
+    if (KErrNone == aError)
+        {
+        if (iVideoClipInfo)     
+            {
+            delete iVideoClipInfo;
+            iVideoClipInfo = NULL;  
+            }
+        iVideoClipInfo = &aInfo;    
+
+        TRect clipResolution = Rect();
+        iDuration = iVideoClipInfo->Duration();
+        iCutVideoBar->SetTotalDuration( iDuration );
+        iView.DrawTimeNaviL();
+
+        TSize resolution( clipResolution.iBr.iX, clipResolution.iBr.iY-KVeiCutBarHeight ); 
+        iFrameReady = EFalse;
+        iVideoClipInfo->GetFrameL( *this, 0, &resolution );
+        }
+    SetStateL( EStateStoppedInitial );          
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoClipInfoReady, Out");
+    }
+
+
+void CVeiCutVideoContainer::NotifyVideoClipFrameCompleted(CVedVideoClipInfo& /*aInfo*/, 
+                                               TInt aError, 
+                                               CFbsBitmap* aFrame)
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoClipFrameCompleted, In, aError:%d", aError);
+    iFrameReady = ETrue;
+    
+    if (EStateGettingFrame == iState)
+        {
+        SetStateL(iPreviousState);          
+        }       
+    
+    if (KErrNone == aError && aFrame)
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoClipFrameCompleted 1");         
+
+        if ( iTakeSnapshot )
+            {
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoClipFrameCompleted 2");         
+            iConverter->SetBitmap( aFrame );
+            if (! iCallBackSaveSnapshot)
+                {       
+                TCallBack cb (CVeiCutVideoContainer::AsyncSaveSnapshot, this);
+                iCallBackSaveSnapshot = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard);
+                }
+            iCallBackSaveSnapshot->CallBack();
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoClipFrameCompleted 3");
+            }
+        else
+            {
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoClipFrameCompleted 4");
+            TRAP_IGNORE(iVideoDisplay->ShowPictureL( *aFrame ));
+            delete aFrame;
+            aFrame = NULL;
+            
+            if (iTakeSnapshotWaiting)
+                {
+                if (! iCallBackTakeSnapshot)
+                    {       
+                    TCallBack cb (CVeiCutVideoContainer::AsyncTakeSnapshot, this);
+                    iCallBackTakeSnapshot = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard);
+                    }
+                iCallBackTakeSnapshot->CallBack();              
+                }
+            }
+        }
+    else
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoClipFrameCompleted 5");
+        if (aFrame) 
+            {
+            delete aFrame;
+            aFrame = NULL;  
+            }       
+        
+        if (iProgressDialog)
+            {
+            iProgressInfo->SetAndDraw( KProgressbarFinalValue );
+            TRAP_IGNORE(iProgressDialog->ProcessFinishedL());
+            }       
+        }
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoClipFrameCompleted, Out");  
+    }
+
+TInt CVeiCutVideoContainer::AsyncSaveSnapshot(TAny* aThis)
+    {
+    LOG( KVideoEditorLogFile, "CVeiCutVideoView::AsyncSaveSnapshot in");
+    
+    // In the asynchronous version, trap the rest of the functions 
+    // to make sure that the caller's TRequestStatus is always 
+    // completed, also in case of failures.
+    CVeiCutVideoContainer* container = static_cast<CVeiCutVideoContainer*>(aThis);
+    TInt err = KErrNone;
+    TRAP(err, container->SaveSnapshotL());
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::AsyncSaveSnapshot 2, err:%d", err);
+    
+    if (KErrNone != err)
+        {
+        container->StopProgressDialog();
+        container->ShowGlobalErrorNote(err);
+        }  
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::AsyncSaveSnapshot 3, returning");
+    return KErrNone;                
+    }       
+    
+void CVeiCutVideoContainer::ShowGlobalErrorNote(const TInt aErr)
+    {       
+    iErrorUI.ShowGlobalErrorNote( aErr );
+    }
+
+void CVeiCutVideoContainer::StopProgressDialog()
+    {
+    if (iProgressDialog)
+        {
+        TRAP_IGNORE(iProgressDialog->GetProgressInfoL()->SetAndDraw( KProgressbarFinalValue );
+                    iProgressDialog->ProcessFinishedL());
+        }   
+    }
+
+void CVeiCutVideoContainer::NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo  )
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent, In");
+
+    if (EStateTerminating == iState)
+        {
+        LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent(): app is closing...");
+        return;
+        }
+
+    switch (aEvent)
+        {
+        case MVeiVideoDisplayObserver::ELoadingStarted:
+            {   
+            SetStateL(EStateOpening);
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::ELoadingStarted");
+            break;
+            }
+        case MVeiVideoDisplayObserver::EOpenComplete:
+            {
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EOpenComplete 1");      
+            iVideoDisplay->SetRotationL( EVideoRotationNone );
+            TTimeIntervalMicroSeconds cutInTime = iView.GetVideoClipCutInTime();
+            TTimeIntervalMicroSeconds cutOutTime = iView.GetVideoClipCutOutTime();
+
+            if ( iView.IsForeground() )
+                {               
+                if (iVideoClipInfo && !iFrameReady)
+                    {                               
+                    iVideoClipInfo->CancelFrame();
+                    }                           
+                if ( iPlayOrPlayMarked )
+                    {
+                    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EOpenComplete 2");                  
+                    iVideoDisplay->PlayMarkedL( cutInTime, cutOutTime );
+                    }
+                else
+                    {
+                    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EOpenComplete 3");  
+                    iVideoDisplay->Play();
+                    }
+                iPlayOrPlayMarked = EFalse;             
+                }
+            else
+                {
+                LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EOpenComplete 4");                 
+                PauseL();                   
+                }   
+            break;
+            }
+        case MVeiVideoDisplayObserver::EBufferingStarted:
+            {
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EBufferingStarted");           
+            SetStateL( EStateBuffering );
+            if ( iVideoBarTimer )
+                {
+                iVideoBarTimer->Cancel();
+                }
+            break;
+            }   
+        case MVeiVideoDisplayObserver::ELoadingComplete:
+            {           
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::ELoadingComplete 1");
+            // if VED is put to background in the middle of the buffering
+            // iVideoDisplay->PauseL(); cannot be called during the buffering, so its called here
+            if (EStatePaused == iState)
+                {
+                iVideoDisplay->PauseL();    
+                }
+            else
+                {                           
+                SetStateL( EStatePlaying );                     
+                if (iVideoClipInfo && !iFrameReady)
+                    {                               
+                    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::ELoadingComplete 2");
+                    iVideoClipInfo->CancelFrame();
+                    }
+                if ( !iVideoBarTimer->IsActive() )
+                    {
+                    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::ELoadingComplete 3");               
+                    const TUint delay = 100000;
+                    iVideoBarTimer->Start( delay, delay, TCallBack( CVeiCutVideoContainer::DoAudioBarUpdate, this ) );
+                    }
+                iVideoDisplay->ShowBlackScreen();           
+                DrawDeferred();
+                }
+            break;
+            }
+        case MVeiVideoDisplayObserver::EPlayComplete:
+            {
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EPlayComplete");
+            iVideoDisplay->SetBlackScreen( EFalse );            
+            iSeekPos = TTimeIntervalMicroSeconds( 0 );
+
+            iLastPosition = TotalLength();
+            iView.StopNaviPaneUpdateL();
+            iCutVideoBar->SetFinishedStatus( ETrue );
+            
+            if (iVideoBarTimer)
+                {
+                iVideoBarTimer->Cancel();   
+                }           
+
+            GetThumbAtL(0);
+
+            SetStateL( EStateStopped );
+            
+            if (KErrNoMemory == aInfo || KErrSessionClosed == aInfo)
+                {
+                iErrorUI.ShowGlobalErrorNote( aInfo );                  
+                StopL();
+                CloseStreamL();
+                }
+
+            DrawDeferred();
+            break;
+            }
+        case MVeiVideoDisplayObserver::EStop:
+            {
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop");
+            
+            if (EStateGettingFrame == iState)
+                {
+                break;  
+                }              
+            
+            if ( iVideoBarTimer )
+                {                
+                iVideoBarTimer->Cancel();
+                }
+            iSeekPos = TTimeIntervalMicroSeconds( 0 );
+
+            GetThumbAtL(0);
+            iLastPosition = TotalLength();
+            iView.StopNaviPaneUpdateL();
+            iCutVideoBar->SetFinishedStatus( ETrue );
+        
+            SetStateL( EStateStopped );
+            DrawDeferred();
+            break;
+            }                                                               
+        case MVeiVideoDisplayObserver::EVolumeLevelChanged:
+            {
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EVolumeLevelChanged");
+            TInt playerVolume = iVideoDisplay->Volume();
+            iView.ShowVolumeLabelL( playerVolume );
+            break;
+            }
+        case MVeiVideoDisplayObserver::EError:
+            {
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EError");
+//          iErrorUI.ShowGlobalErrorNoteL( KErrGeneral );
+            SetStateL( EStateStoppedInitial );
+            break;
+            }
+        default:
+            {
+            LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::default");
+            break;
+            };
+        }
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::NotifyVideoDisplayEvent, Out");
+    }
+
+
+void CVeiCutVideoContainer::SetStateL(CVeiCutVideoContainer::TCutVideoState aState, TBool aUpdateCBA)
+    {
+    LOGFMT2(KVideoEditorLogFile, "CVeiCutVideoContainer::SetStateL: in, iState:%d, aState:%d", iState, aState);
+    if (EStateGettingFrame == aState)
+        {
+        iPreviousState = iState;    
+        }
+        
+    iState = aState;
+    if (EStatePaused == iState)
+        {
+        DrawNow();  
+        }
+
+    // If the foreground is lost while an arrow key is down, we do not get
+    // the key up -event, and iSeeking remains true. Reseting it here just in case.
+    iSeeking = EFalse;
+
+    if ( aUpdateCBA )
+        {
+        iView.UpdateCBAL( iState );
+        }
+
+    // While playing, grab the volume keys for adjusting playback volume.
+    // In other states let them pass e.g. to the music player.
+    if(EStatePlaying == iState)
+        {
+        if (!iRemConTarget)
+            {
+            iRemConTarget = CVeiRemConTarget::NewL( *this );
+            }
+        }
+    else
+        {
+        delete iRemConTarget;
+        iRemConTarget = NULL;
+        }
+
+    if (EStateGettingFrame == aState)
+        {   
+        /* :
+         check out on every phone before releasing whether videodisplay should be stopped before starting
+         asynchronous GetFrameL()
+         see how EStateGettingFrame is handled in SetPreviewState 
+         Stopping frees memory and it is needed in memory sensible devices 
+        */
+        //iVideoDisplay->Stop(ETrue);           
+        }
+
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::SetStateL:: out");
+    }
+
+void CVeiCutVideoContainer::MarkedInL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::MarkedInL, In");
+    if ( EStateInitializing == iState )
+        {
+        return;
+        }
+    const TTimeIntervalMicroSeconds& position = PlaybackPositionL();
+    iSeekPos = position;
+
+    LOGFMT(KVideoEditorLogFile, "CVeiCutVideoContainer::MarkedInL, 2, setting cutINpoint:%Ld", position.Int64());
+    iCutVideoBar->SetInPoint( position  );
+    iCutTimeDisplay->SetCutIn( position );
+    PauseL();
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::MarkedInL, Out");
+    }
+
+void CVeiCutVideoContainer::MarkedOutL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::MarkedOutL, In");
+    if ( EStateInitializing == iState )
+        {
+        return;
+        }
+    const TTimeIntervalMicroSeconds& position = PlaybackPositionL();
+    iSeekPos = position;
+
+    LOGFMT(KVideoEditorLogFile, "CVeiCutVideoContainer::MarkedOutL, 2, setting cutOUTpoint:%Ld", position.Int64());
+    iCutVideoBar->SetOutPoint( position );
+    iCutTimeDisplay->SetCutOut( position );
+
+    PauseL();
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::MarkedOutL, Out");
+    }
+
+void CVeiCutVideoContainer::ShowInformationNoteL( const TDesC& aMessage ) const
+    {
+    CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
+    note->ExecuteLD( aMessage );
+    }
+
+void CVeiCutVideoContainer::ShowProgressNoteL() 
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::ShowProgressNoteL, in");
+    iProgressDialog = new ( ELeave ) CAknProgressDialog( REINTERPRET_CAST( CEikDialog**, 
+                    &iProgressDialog ), ETrue);
+    iProgressDialog->SetCallback( this );
+    iProgressDialog->PrepareLC( R_VEI_PROGRESS_NOTE_WITH_CANCEL );
+
+    HBufC* stringholder  = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_SAVING_IMAGE, iEikonEnv );
+    CleanupStack::PushL( stringholder );
+
+    iProgressDialog->SetTextL( *stringholder );
+    CleanupStack::PopAndDestroy( stringholder );
+
+    iProgressInfo = iProgressDialog->GetProgressInfoL();
+    iProgressInfo->SetFinalValue( KProgressbarFinalValue );
+    iProgressDialog->RunLD();
+
+    iProgressInfo->SetAndDraw( 50 );
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::ShowProgressNoteL, Out");
+    }
+
+TInt CVeiCutVideoContainer::DoAudioBarUpdate( TAny* aThis )
+    {
+    STATIC_CAST( CVeiCutVideoContainer*, aThis )->DoUpdate();
+    return 42;
+    }
+
+void CVeiCutVideoContainer::DoUpdate()
+    {
+    TTimeIntervalMicroSeconds time;
+    time = iVideoDisplay->PositionL();
+    if ( iSeeking )
+        {
+        time = iSeekPos;
+        LOGFMT(KVideoEditorLogFile, "CVeiCutVideoContainer::DoUpdate(): 1, time:%Ld", time.Int64());
+        }
+    else
+        {           
+        LOGFMT(KVideoEditorLogFile, "CVeiCutVideoContainer::DoUpdate(): 2, time:%Ld", time.Int64());
+        }
+    iCutVideoBar->SetCurrentPoint( static_cast<TInt32>((time.Int64() / 1000)));
+    iCutVideoBar->DrawDeferred();
+    }
+void CVeiCutVideoContainer::MuteL()
+    {
+    iVideoDisplay->SetMuteL( ETrue );
+    }
+
+//=============================================================================
+void CVeiCutVideoContainer::HandleVolumeUpL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::HandleVolumeUpL: in");
+
+    iVideoDisplay->AdjustVolumeL( 1 );
+
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::HandleVolumeUpL: out");
+    }
+
+//=============================================================================
+void CVeiCutVideoContainer::HandleVolumeDownL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::HandleVolumeDownL: in");
+
+    iVideoDisplay->AdjustVolumeL( -1 );
+
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::HandleVolumeDownL: out");
+    }
+
+//=============================================================================
+void CVeiCutVideoContainer::PrepareForTerminationL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::PrepareForTerminationL: in");
+
+    SetStateL( EStateTerminating );
+
+    if( !iFrameReady && iVideoClipInfo )
+        {
+        iVideoClipInfo->CancelFrame();
+        }
+    iState = EStateTerminating;
+    iVideoDisplay->Stop( ETrue );
+
+    LOG(KVideoEditorLogFile, "CVeiCutVideoContainer::PrepareForTerminationL: out");
+    }
+
+
+TInt CVeiCutVideoContainer::AsyncTakeSnapshot(TAny* aThis)
+    {
+    LOG( KVideoEditorLogFile, "CVeiCutVideoContainer::AsyncTakeSnapshot");
+    
+    // In the asynchronous version, trap the rest of the functions 
+    // to make sure that the caller's TRequestStatus is always 
+    // completed, also in case of failures.
+    CVeiCutVideoContainer* container = static_cast<CVeiCutVideoContainer*>(aThis);
+    TInt err = KErrNone;
+    TRAP(err, container->TakeSnapshotL());
+    LOGFMT( KVideoEditorLogFile, "CVeiCutVideoContainer::AsyncTakeSnapshot 1, err:%d", err);    
+    User::LeaveIfError(err);        
+    return KErrNone;                
+    }
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiCutVideoView.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1310 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+// System includes
+#include <aknviewappui.h>
+#include <avkon.hrh>
+#include <manualvideoeditor.rsg>
+#include <akntitle.h> 
+#include <barsread.h>
+#include <stringloader.h> 
+#include <aknnotewrappers.h>
+#include <aknquerydialog.h>
+#include <aknlists.h>
+#include <aknPopup.h>
+#include <AknProgressDialog.h>
+#include <aknnavide.h>
+#include <eikbtgpc.h>
+#include <eikmenub.h>
+#include <eikmenup.h>
+#include <eikprogi.h>
+#include <CAknMemorySelectionDialog.h>
+#include <CAknFileNamePromptDialog.h>
+#include <apparc.h>
+#include <aknselectionlist.h>
+#include <sysutil.h>
+
+// User includes
+#include "VeiAppUi.h"
+#include "VeiCutVideoView.h"
+#include "VeiCutVideoContainer.h" 
+#include "manualvideoeditor.hrh"
+#include "veitempmaker.h"
+#include "VeiTimeLabelNavi.h"
+#include "VeiEditVideoView.h"
+#include "VideoEditorCommon.h"
+#include "VeiErrorUi.h"
+
+void CVeiCutVideoView::ConstructL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::ConstructL: in");
+
+    BaseConstructL( R_VEI_CUT_VIDEO_VIEW );
+
+    CEikStatusPane* sp = StatusPane();
+
+    iNaviPane = (CAknNavigationControlContainer*) sp->ControlL(
+            TUid::Uid(EEikStatusPaneUidNavi));
+
+    iTimeNavi = CreateTimeLabelNaviL();
+
+    iVolumeNavi = iNaviPane->CreateVolumeIndicatorL(
+            R_AVKON_NAVI_PANE_VOLUME_INDICATOR );
+
+    iErrorUI = CVeiErrorUI::NewL( *iCoeEnv );   
+    
+    iTimeUpdater = CPeriodic::NewL( CActive::EPriorityLow );
+    iVolumeHider = CPeriodic::NewL( CActive::EPriorityLow );
+
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::ConstructL: out");
+    }
+
+// ---------------------------------------------------------
+// CVeiCutVideoView::~CVeiCutVideoView()
+// ?implementation_description
+// ---------------------------------------------------------
+//
+CVeiCutVideoView::~CVeiCutVideoView()
+    {
+    if ( iProgressNote )
+        {
+        delete iProgressNote;
+        iProgressNote = NULL;
+        }
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = 0;
+        }
+    if ( iTempMovie )
+        {
+        iTempMovie->Reset();
+        delete iTempMovie;
+        iTempMovie = NULL;
+        }
+    if ( iTimeUpdater )
+        {
+        iTimeUpdater->Cancel();
+        delete iTimeUpdater;
+        }
+    if ( iVolumeHider )
+        {
+        iVolumeHider->Cancel();
+        delete iVolumeHider;
+        }
+
+    if ( iErrorUI )
+        {
+        delete iErrorUI;
+        }
+
+    delete iVolumeNavi;
+
+    delete iTimeNavi;
+
+    delete iProcessedTempFile;
+    }
+
+TUid CVeiCutVideoView::Id() const
+     {
+     return TUid::Uid( EVeiCutVideoView );
+     }
+
+void CVeiCutVideoView::DialogDismissedL( TInt aButtonId )
+    {
+    if ( aButtonId != EAknSoftkeyDone )
+        {   
+        iTempMovie->CancelProcessing();
+        }
+    else
+        {
+        if ( iErrorNmb == KErrNone )
+            {       
+            iContainer->SetInTime( iMovie->VideoClipCutInTime( iIndex ) );
+            iContainer->SetOutTime( iMovie->VideoClipCutOutTime( iIndex ) );
+
+            iContainer->GetThumbL( *iProcessedTempFile ); 
+            }
+        else
+            {
+            if ( iProcessedTempFile )       // delete temp
+                {
+                iEikonEnv->FsSession().Delete( *iProcessedTempFile );
+                delete iProcessedTempFile;
+                iProcessedTempFile = NULL;
+                }       
+
+            iErrorUI->ShowGlobalErrorNote( iErrorNmb );
+            iErrorNmb = 0;
+            HandleCommandL( EVeiCmdCutVideoViewBack );
+            }
+        }
+    }
+
+void CVeiCutVideoView::DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane )
+    {
+    TInt state = iContainer->State();
+
+    if (aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU_CLEAR_MARKS)
+        {
+        // delete in, out, in & out as necessary.
+
+        if (iMovie->VideoClipCutInTime(iIndex) <= TTimeIntervalMicroSeconds(0)) 
+            {
+            aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksIn, ETrue);
+            }
+        if (iMovie->VideoClipCutOutTime(iIndex) >= iMovie->VideoClipInfo(iIndex)->Duration()) 
+            {
+            aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksOut, ETrue);
+            }
+
+        if (!((iMovie->VideoClipCutOutTime(iIndex) < iMovie->VideoClipInfo(iIndex)->Duration())
+            && (iMovie->VideoClipCutInTime(iIndex) > TTimeIntervalMicroSeconds(0))))
+            {
+            aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksInOut, ETrue);
+            }
+        }
+
+    if ( aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU )
+        {
+        if ( iPopupMenuOpened != EFalse )
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewClearMarks, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdCutVideoTakeSnapshot, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewHelp, ETrue );
+            }
+        }
+    if ( !(( aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU ) ||
+            ( aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU ) ) )
+        return;
+
+    if ( iContainer->PlaybackPositionL() >= iContainer->TotalLength() )
+        {
+        aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewPlay, ETrue );
+
+        }
+    if ( ( state == CVeiCutVideoContainer::EStatePaused ) ||
+            ( state == CVeiCutVideoContainer::EStateInitializing ) )
+        {
+        aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewPlay, ETrue  );
+        }
+
+    if ( ( state != CVeiCutVideoContainer::EStateStopped ) && 
+        ( state != CVeiCutVideoContainer::EStateStoppedInitial ) &&
+        ( state != CVeiCutVideoContainer::EStatePaused ) )
+        {
+        aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewPlay, ETrue  );
+        aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkIn, ETrue  );
+        aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkOut, ETrue  ); 
+        }
+    else
+        {
+        TTimeIntervalMicroSeconds pos = iContainer->PlaybackPositionL(); 
+        CVedVideoClipInfo* info = iMovie->VideoClipInfo( iIndex );
+        
+        TInt cutInFrameIndex = info->GetVideoFrameIndexL( iMovie->VideoClipCutInTime( iIndex ));
+        TInt cutOutFrameIndex = info->GetVideoFrameIndexL( iMovie->VideoClipCutOutTime( iIndex ));
+        TInt videoFrameCount = info->VideoFrameCount();
+        
+        // if we are in the existing start/end mark position the start/end mark is removed from the menu
+        if (info->GetVideoFrameIndexL(pos) == cutInFrameIndex)
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkIn ); 
+            }       
+        else if (info->GetVideoFrameIndexL(pos) == cutOutFrameIndex)
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkOut );    
+            }
+        
+        if( cutInFrameIndex < (videoFrameCount-1 ) )
+            {
+            cutInFrameIndex++;
+            }
+
+        if( cutOutFrameIndex > 0 )
+            {
+            cutOutFrameIndex--;
+            }
+
+        TTimeIntervalMicroSeconds nextFramePosCutIn = info->VideoFrameStartTimeL( cutInFrameIndex );
+        TTimeIntervalMicroSeconds previousFramePosCutOut = info->VideoFrameStartTimeL( cutOutFrameIndex );
+
+        if ( pos < nextFramePosCutIn )
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkOut );    
+            }
+        else 
+            {
+            if ( pos > previousFramePosCutOut )
+                {
+                aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkIn );
+                }
+            }
+        // something crashes somewhere outside VED UI if end mark is put to near to begin               
+        TInt ind = -1;  
+        if (aMenuPane->MenuItemExists(EVeiCmdCutVideoViewMarkOut, ind) && pos.Int64() < KMinCutVideoLength) 
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkOut );    
+            }   
+        }
+    if ( ( iMovie->VideoClipCutInTime( iIndex ) == TTimeIntervalMicroSeconds( 0 ) && 
+        iMovie->VideoClipCutOutTime( iIndex ) == iMovie->VideoClipInfo( iIndex )->Duration() ) )
+        {
+        aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewPlayMarked );
+        }
+    if ( state != CVeiCutVideoContainer::EStatePlayingMenuOpen && 
+            state != CVeiCutVideoContainer::EStatePaused )
+        {
+        aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewContinue );
+        }
+    if ( ( state == CVeiCutVideoContainer::EStateStopped ) ||
+         ( state == CVeiCutVideoContainer::EStateStoppedInitial ) ||
+         ( state == CVeiCutVideoContainer::EStateOpening ) ||
+         ( state == CVeiCutVideoContainer::EStateBuffering ) )
+        {
+        aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewStop );
+        }       
+
+    if ( ( iMovie->VideoClipCutOutTime( iIndex ) >= iMovie->VideoClipInfo( iIndex )->Duration() ) &&
+        ( iMovie->VideoClipCutInTime( iIndex ) <= TTimeIntervalMicroSeconds( 0 ) ) ) 
+        {
+        aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewClearMarks, ETrue );
+        }
+    }
+
+void CVeiCutVideoView::HandleCommandL(TInt aCommand)
+    {   
+    switch ( aCommand )
+        {
+        case EAknSoftkeyOk:
+            {
+            iPopupMenuOpened = ETrue;
+            if (iContainer->State() == CVeiCutVideoContainer::EStatePlaying) 
+                {
+                PausePreviewL();
+                iContainer->SetStateL(CVeiCutVideoContainer::EStatePlayingMenuOpen);
+                }
+
+            MenuBar()->TryDisplayMenuBarL();
+            if (iContainer->State() == CVeiCutVideoContainer::EStatePlayingMenuOpen) 
+                {
+                iContainer->SetStateL(CVeiCutVideoContainer::EStatePaused);
+                }
+            iPopupMenuOpened = EFalse;
+            break;
+            }       
+        case EVeiCmdCutVideoViewDone:
+        case EVeiCmdCutVideoViewBack:
+        case EAknSoftkeyBack:
+            {
+            StopNaviPaneUpdateL();
+
+            iContainer->StopL();
+            iContainer->CloseStreamL();
+
+            // Activate Edit Video view
+            AppUi()->ActivateLocalViewL( TUid::Uid(EVeiEditVideoView) );
+            break;
+            }
+
+        case EVeiCmdCutVideoViewMarkIn:
+            {
+            STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+                SetPauseIconVisibilityL( ETrue );
+            MarkInL();
+            break;
+            }
+        case EVeiCmdCutVideoViewMarkOut:
+            {
+            STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+                SetPauseIconVisibilityL( ETrue );
+            MarkOutL();
+            break;
+            }
+        case EVeiCmdCutVideoViewClearMarksInOut:
+            {
+            ClearInOutL( ETrue, ETrue );
+            break;
+            }
+        case EVeiCmdCutVideoViewClearMarksIn:
+            {
+            ClearInOutL( ETrue, EFalse );
+            break;
+            }
+        case EVeiCmdCutVideoViewClearMarksOut:
+            {
+            ClearInOutL( EFalse, ETrue );
+            break;
+            }
+        case EVeiCmdCutVideoViewPlayMarked:
+            {
+            STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+            SetPauseIconVisibilityL( EFalse );
+            PlayMarkedL();
+            break;
+            }
+        case EVeiCmdCutVideoViewPlay:
+            {
+            STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+            SetPauseIconVisibilityL( EFalse );
+            iNaviPane->PushL( *iTimeNavi );
+            
+            PlayPreviewL();
+            break;
+            }
+        case EVeiCmdCutVideoViewStop:
+            {
+            STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+                SetPauseIconVisibilityL( EFalse );
+            iNaviPane->PushL( *iTimeNavi );
+            StopNaviPaneUpdateL();
+            iContainer->StopL();
+            break;
+            }
+        case EVeiCmdCutVideoViewContinue:
+            {
+            STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+            SetPauseIconVisibilityL( EFalse );
+            iNaviPane->PushL( *iTimeNavi );
+            PlayPreviewL();
+            break;
+            }
+        case EVeiCmdCutVideoTakeSnapshot:
+            {
+            if( IsEnoughFreeSpaceToSaveL() )
+                {
+                iContainer->TakeSnapshotL();
+                }
+            break;
+            }
+        //
+        // Options->Help
+        //
+        case EVeiCmdCutVideoViewHelp:
+            {
+            // CS Help launching is handled in Video Editor's AppUi.
+            AppUi()->HandleCommandL( EVeiCmdCutVideoViewHelp );
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+void CVeiCutVideoView::NotifyMovieProcessingStartedL( CVedMovie& /*aMovie*/ )
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::NotifyMovieProcessingStartedL: In");
+    iProgressNote = 
+        new (ELeave) CAknProgressDialog(REINTERPRET_CAST(CEikDialog**, 
+        &iProgressNote), ETrue);
+    iProgressNote->SetCallback(this);
+    iProgressNote->ExecuteDlgLD( R_VEI_PROGRESS_NOTE_WITH_CANCEL );
+
+    HBufC* stringholder;
+
+    stringholder = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_CUT, iEikonEnv );
+    CleanupStack::PushL( stringholder );
+
+    iProgressNote->SetTextL( *stringholder );
+    CleanupStack::PopAndDestroy( stringholder );  
+
+    iProgressInfo = iProgressNote->GetProgressInfoL();
+    iProgressInfo->SetFinalValue(100);
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::NotifyMovieProcessingStartedL: Out");
+    }
+
+void CVeiCutVideoView::NotifyMovieProcessingProgressed( CVedMovie& /*aMovie*/, TInt aPercentage )
+    {
+    iProgressInfo->SetAndDraw( aPercentage );
+    }
+
+void CVeiCutVideoView::NotifyMovieProcessingCompleted( CVedMovie& /*aMovie*/, TInt aError )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiCutVideoView::NotifyMovieProcessingCompleted: In, aError:%d", aError);
+    if ( iTempMovie )   //Effected clip is ready, Delete tempmovie
+        {
+        iTempMovie->Reset();
+        delete iTempMovie;
+        iTempMovie = NULL;
+        }
+
+    if ( aError == KErrCancel )
+        {
+        HandleCommandL( EVeiCmdCutVideoViewBack );
+        }
+    else
+        {
+        iProgressInfo->SetAndDraw(100);
+        iErrorNmb = aError;
+        iProgressNote->ProcessFinishedL();
+        }
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::NotifyMovieProcessingCompleted: Out");
+    }
+
+void CVeiCutVideoView::NotifyVideoClipAdded( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::NotifyVideoClipAdded: In");
+
+    iTempMovie->UnregisterMovieObserver( this );
+    iTempMovie->VideoClipSetColorEffect( 0, iMovie->VideoClipColorEffect( iIndex ) );
+    iTempMovie->VideoClipSetColorTone( 0, iMovie->VideoClipColorTone( iIndex ) );       
+    iTempMovie->SetVideoClipVolumeGainL( 0, iMovie->GetVideoClipVolumeGainL( iIndex ) );
+
+    iProcessedTempFile = HBufC::NewL( KMaxFileName );
+
+    TRAPD( err, 
+        CVeiTempMaker* maker = CVeiTempMaker::NewL();
+        maker->GenerateTempFileName( *iProcessedTempFile, iMemoryInUse, iMovie->Format() );
+        delete maker;
+        );
+
+    if ( err == KErrNone )
+        {
+        TRAP( err, iTempMovie->ProcessL( *iProcessedTempFile, *this ) );
+        }
+
+    if ( err != KErrNone )
+        {
+        iErrorUI->ShowGlobalErrorNote( err );
+
+        if ( iProcessedTempFile )       // delete temp
+            {
+            iEikonEnv->FsSession().Delete( *iProcessedTempFile );
+            delete iProcessedTempFile;
+            iProcessedTempFile = NULL;
+            }       
+        }
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::NotifyVideoClipAdded: Out");
+    }
+
+void CVeiCutVideoView::NotifyVideoClipAddingFailed( CVedMovie& /*aMovie*/, TInt /*aError*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyVideoClipRemoved( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyVideoClipIndicesChanged( CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, 
+                                               TInt /*aNewIndex*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyVideoClipTimingsChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyVideoClipColorEffectChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyVideoClipAudioSettingsChanged( CVedMovie& /*aMovie*/,
+                                                     TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyStartTransitionEffectChanged( CVedMovie& /*aMovie*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyMiddleTransitionEffectChanged( CVedMovie& /*aMovie*/, 
+                                                     TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyEndTransitionEffectChanged( CVedMovie& /*aMovie*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyAudioClipAdded( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyAudioClipAddingFailed( CVedMovie& /*aMovie*/, TInt /*aError*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyAudioClipRemoved( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyAudioClipIndicesChanged( CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, 
+                                               TInt /*aNewIndex*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyAudioClipTimingsChanged( CVedMovie& /*aMovie*/,
+                                               TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyMovieReseted( CVedMovie& /*aMovie*/ )
+    {
+    }
+
+void CVeiCutVideoView::NotifyVideoClipGeneratorSettingsChanged(CVedMovie& /*aMovie*/,
+                                                         TInt /*aIndex*/) 
+    {
+    }
+
+void CVeiCutVideoView::NotifyVideoClipDescriptiveNameChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/)
+    {
+    }
+
+void CVeiCutVideoView::NotifyMovieQualityChanged(CVedMovie& /*aMovie*/)
+    {
+    }
+
+void CVeiCutVideoView::NotifyMovieOutputParametersChanged(CVedMovie& /*aMovie*/)
+    {
+    }
+
+void CVeiCutVideoView::NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, 
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+    {
+    }
+
+void CVeiCutVideoView::NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+    {
+    }
+
+void CVeiCutVideoView::NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/,
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+    {
+    }
+
+void CVeiCutVideoView::NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+    {
+    }
+
+void CVeiCutVideoView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+
+    if (!iContainer)
+        {
+        iContainer = CVeiCutVideoContainer::NewL( AppUi()->ClientRect(), *this, *iErrorUI );
+        iContainer->SetMopParent( this );
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    CEikStatusPane *statusPane = ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); 
+
+    CAknTitlePane* titlePane = (CAknTitlePane*) statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) );
+    TResourceReader reader1;
+    iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_CUTVIDEO_VIEW_TITLE_NAME );
+    titlePane->SetFromResourceL( reader1 );
+    CleanupStack::PopAndDestroy(); //reader1
+
+    UpdateCBAL( CVeiCutVideoContainer::EStateInitializing );
+    iNaviPane->PushL( *iTimeNavi );
+
+    iAudioMuted = !( iMovie->VideoClipEditedHasAudio( iIndex ) );
+
+    STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+            SetPauseIconVisibilityL( EFalse );
+
+    if ( iAudioMuted  )
+        {
+        STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->
+            SetVolumeIconVisibilityL( EFalse );
+        VolumeMuteL();
+        }
+    else
+        {
+        STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->
+            SetVolumeIconVisibilityL( ETrue );
+        }
+    iErrorNmb = 0;
+
+    iContainer->SetInTime( iMovie->VideoClipCutInTime( iIndex ) );
+    iContainer->SetOutTime( iMovie->VideoClipCutOutTime( iIndex ) );
+
+    CVedVideoClipInfo* clipinfo = iMovie->VideoClipInfo( iIndex );
+
+/**
+* First try to open video clip in videoplayerutility. If it leaves with error code 
+* KErrNotSupported(-5), then GenerateEffectedClipL() is called. 
+*/  if (EVedColorEffectBlackAndWhite == iMovie->VideoClipColorEffect( iIndex ) ||
+        EVedColorEffectToning == iMovie->VideoClipColorEffect( iIndex ))
+        {
+        GenerateEffectedClipL();
+        }
+    else if (iMovie->VideoClipInfo(iIndex)->HasAudio() && iMovie->GetVideoClipVolumeGainL(iIndex))
+        {       
+        GenerateEffectedClipL();
+        } 
+    else
+        {
+        iContainer->GetThumbL( clipinfo->FileName() );
+        }
+    }
+
+void CVeiCutVideoView::GenerateEffectedClipL()
+    {
+    TEntry fileinfo;
+// check if there is enough space to create temp file
+    RFs&    fs = iEikonEnv->FsSession();
+
+    CVedVideoClipInfo* videoclipinfo = iMovie->VideoClipInfo( iIndex );
+
+    fs.Entry( videoclipinfo->FileName(), fileinfo );
+
+    TBool spaceBelowCriticalLevel( EFalse );
+
+    TVeiSettings movieSaveSettings;
+
+   
+    STATIC_CAST( CVeiAppUi*, iEikonEnv->AppUi() )->ReadSettingsL( movieSaveSettings );  
+
+    CAknMemorySelectionDialog::TMemory memoryInUse( movieSaveSettings.MemoryInUse() );
+
+
+    if ( memoryInUse == CAknMemorySelectionDialog::EPhoneMemory )
+        {   
+        spaceBelowCriticalLevel = SysUtil::DiskSpaceBelowCriticalLevelL( 
+                                        &fs, fileinfo.iSize, EDriveC );
+        }
+    else
+        {
+        spaceBelowCriticalLevel = SysUtil::MMCSpaceBelowCriticalLevelL( 
+                                        &fs, fileinfo.iSize );
+        }   
+    
+    if ( !spaceBelowCriticalLevel )
+        {
+        iTempMovie = CVedMovie::NewL( NULL );
+        iTempMovie->RegisterMovieObserverL( this );
+        CVedVideoClipInfo* clipinfo = iMovie->VideoClipInfo( iIndex );
+        iTempMovie->InsertVideoClipL( clipinfo->FileName(), 0 );
+        }
+    else 
+        {
+        HBufC* stringholder;
+
+        stringholder = StringLoader::LoadLC( R_VEI_NOT_ENOUGH_SPACE, iEikonEnv );
+
+        CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+        dlg->ExecuteLD( *stringholder );
+
+        CleanupStack::PopAndDestroy( stringholder);
+
+        HandleCommandL( EVeiCmdCutVideoViewBack );
+        }
+
+    }
+
+// ---------------------------------------------------------
+// CVeiCutVideoView::HandleCommandL(TInt aCommand)
+// ?implementation_description
+// ---------------------------------------------------------
+//
+void CVeiCutVideoView::DoDeactivate()
+    {  
+    iNaviPane->Pop( iVolumeNavi );
+
+    if ( iTimeUpdater )
+        {
+        iTimeUpdater->Cancel();
+        }
+    if ( iVolumeHider )
+        {
+        iVolumeHider->Cancel();
+        }
+    if ( iContainer )
+        {
+        iNaviPane->Pop( iTimeNavi );
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+
+        delete iContainer;
+        iContainer = NULL;
+        }
+
+    if ( iProcessedTempFile )
+        {
+        iEikonEnv->FsSession().Delete( *iProcessedTempFile );
+        delete iProcessedTempFile;
+        iProcessedTempFile = NULL;
+        }
+
+    }
+
+void CVeiCutVideoView::SetVideoClipAndIndex( CVedMovie& aVideoClip, TInt aIndex )
+    {
+    iMovie = &aVideoClip;
+    iIndex = aIndex;
+    }
+
+void CVeiCutVideoView::PlayPreviewL()
+    {
+    StartNaviPaneUpdateL();
+    iContainer->PlayL( iMovie->VideoClipInfo( iIndex )->FileName() );
+    }
+
+void CVeiCutVideoView::PausePreviewL()
+    {
+    STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl() )->
+            SetPauseIconVisibilityL( ETrue );
+    StopNaviPaneUpdateL();
+
+    iContainer->PauseL();
+    }
+
+void CVeiCutVideoView::UpdateCBAL(TInt aState)
+    {
+    switch (aState)
+        {
+        case CVeiCutVideoContainer::EStateInitializing:
+        case CVeiCutVideoContainer::EStateOpening:
+        case CVeiCutVideoContainer::EStateBuffering:        
+            {
+            Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY); 
+            break;
+            }
+        case CVeiCutVideoContainer::EStateStoppedInitial:       
+            {
+            if ( ( iMovie->VideoClipCutInTime( iIndex ) == TTimeIntervalMicroSeconds( 0 ) ) &&
+                 ( iMovie->VideoClipCutOutTime( iIndex ) == iMovie->VideoClipInfo(iIndex)->Duration() ) )
+                {       
+                Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);   
+                }
+            else
+                {                                                               
+                Cba()->SetCommandSetL(R_VEI_SOFTKEYS_OPTIONS_DONE);             
+                }
+            break;
+            }
+        case CVeiCutVideoContainer::EStatePaused:
+        case CVeiCutVideoContainer::EStateStopped:
+            {
+            if ( ( iMovie->VideoClipCutInTime( iIndex ) == TTimeIntervalMicroSeconds( 0 ) ) &&
+                 ( iMovie->VideoClipCutOutTime( iIndex ) == iMovie->VideoClipInfo(iIndex)->Duration() ) )
+                {           
+                Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);   
+                }
+            else
+                {                                                               
+                Cba()->SetCommandSetL(R_VEI_SOFTKEYS_OPTIONS_DONE);             
+                }
+            break;
+            }
+        case CVeiCutVideoContainer::EStatePlaying:
+            {
+            if ( iContainer->PlaybackPositionL() < iMovie->VideoClipCutInTime( iIndex ) )
+                {
+                Cba()->SetCommandSetL( R_VEI_SOFTKEYS_IN_EMPTY ); 
+                iMarkState = EMarkStateIn;
+                }
+            else if ( iContainer->PlaybackPositionL() < iMovie->VideoClipCutOutTime( iIndex ) )
+                {
+                Cba()->SetCommandSetL( R_VEI_SOFTKEYS_IN_OUT ); 
+                iMarkState = EMarkStateInOut;
+                }
+            else
+                {
+                Cba()->SetCommandSetL( R_VEI_SOFTKEYS_EMPTY_OUT ); 
+                iMarkState = EMarkStateOut;
+                }
+            break;
+            }
+        default:
+            {
+            break;  
+            }
+        }
+    Cba()->DrawDeferred();
+    }
+
+void CVeiCutVideoView::PlayMarkedL()
+    {
+    LOGFMT3(KVideoEditorLogFile, "CVeiCutVideoView::PlayMarkedL: In: iIndex:%d, iMovie->VideoClipCutInTime():%Ld, iMovie->VideoClipCutOutTime():%Ld", iIndex, iMovie->VideoClipCutInTime( iIndex ).Int64(), iMovie->VideoClipCutOutTime( iIndex ).Int64());
+
+    StartNaviPaneUpdateL(); 
+    iContainer->PlayMarkedL( iMovie->VideoClipInfo( iIndex )->FileName(),
+        iMovie->VideoClipCutInTime( iIndex ), iMovie->VideoClipCutOutTime( iIndex ) );      
+    
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::PlayMarkedL: Out");
+    }
+
+void CVeiCutVideoView::ClearInOutL( TBool aClearIn, TBool aClearOut )
+    {
+    if ( aClearIn ) 
+        {
+        iMovie->VideoClipSetCutInTime( iIndex, TTimeIntervalMicroSeconds( 0 ) );
+        iContainer->SetInTime( iMovie->VideoClipCutInTime( iIndex ) );
+        }
+    if ( aClearOut ) 
+        {
+        iMovie->VideoClipSetCutOutTime( iIndex, iMovie->VideoClipInfo( iIndex )->Duration() );
+        iContainer->SetOutTime( iMovie->VideoClipInfo( iIndex )->Duration() );
+        }
+    TTimeIntervalMicroSeconds cutin = iMovie->VideoClipCutInTime( iIndex );
+    TTimeIntervalMicroSeconds cutout = iMovie->VideoClipCutOutTime( iIndex );
+    
+    if ( ( cutin == TTimeIntervalMicroSeconds( 0 ) ) &&
+         ( cutout == iMovie->VideoClipInfo(iIndex)->Duration() ) )
+        {       
+        Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);   
+        Cba()->DrawDeferred();
+        }   
+    }
+
+void CVeiCutVideoView::MarkInL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::MarkInL, In");
+    TTimeIntervalMicroSeconds pos = iContainer->PlaybackPositionL();
+    
+//  TTimeIntervalMicroSeconds clipDuration = iMovie->VideoClipInfo( iIndex )->Duration();
+//  CVedVideoClipInfo* info = iMovie->VideoClipInfo( iIndex );
+//  TTimeIntervalMicroSeconds intraPos = info->VideoFrameStartTimeL( 
+//          info->GetVideoFrameIndexL( pos ) );
+
+    if (iMovie->VideoClipCutOutTime(iIndex) > pos)
+        {
+        StopNaviPaneUpdateL();      
+        LOGFMT2(KVideoEditorLogFile, "CVeiCutVideoView::MarkInL, 2, iIndex:%d, pos:%Ld", iIndex, pos.Int64());
+        iMovie->VideoClipSetCutInTime( iIndex, pos );
+        iContainer->MarkedInL();    
+        }
+    
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::MarkInL, Out");
+    }
+
+void CVeiCutVideoView::MarkOutL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::MarkOutL, In");
+    TTimeIntervalMicroSeconds pos = iContainer->PlaybackPositionL();
+//  CVedVideoClipInfo* info = iMovie->VideoClipInfo( iIndex );
+//  TTimeIntervalMicroSeconds intraPos = info->VideoFrameStartTimeL( 
+//          info->GetVideoFrameIndexL( pos ) );
+
+    if (iMovie->VideoClipCutInTime(iIndex) < pos)
+        {           
+        StopNaviPaneUpdateL();
+        iMovie->VideoClipSetCutOutTime( iIndex, pos );
+        LOGFMT2(KVideoEditorLogFile, "CVeiCutVideoView::MarkOutL, 2, iIndex:%d, pos:%Ld", iIndex, pos.Int64() );        
+        iContainer->MarkedOutL();
+        }
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::MarkOutL, Out");
+    }
+
+void CVeiCutVideoView::MoveStartOrEndMarkL( TTimeIntervalMicroSeconds aPosition, CVeiCutVideoContainer::TCutMark aMarkType )
+	{
+	LOG( KVideoEditorLogFile, "CVeiCutVideoView::MoveStartOrEndMarkL, In" );
+	
+	StopNaviPaneUpdateL();
+	
+	LOG( KVideoEditorLogFile, "CVeiCutVideoView::MoveStartOrEndMarkL, 2" );
+	
+	if ( aMarkType == CVeiCutVideoContainer::EStartMark )
+		{
+		iMovie->VideoClipSetCutInTime( iIndex, aPosition );
+		}
+	else if ( aMarkType == CVeiCutVideoContainer::EEndMark )
+		{
+		iMovie->VideoClipSetCutOutTime( iIndex, aPosition );
+		}		
+	LOG( KVideoEditorLogFile, "CVeiCutVideoView::MoveStartOrEndMarkL, Out" );
+	}
+
+
+TUint CVeiCutVideoView::InPointTime()
+    {
+    if ( !iMovie )
+        {
+        return 0;
+        }
+    else
+        {
+        return static_cast<TInt32>((iMovie->VideoClipCutInTime(iIndex).Int64() / 1000));
+        }
+    }
+
+TUint CVeiCutVideoView::OutPointTime()
+    {
+    if ( !iMovie )
+        {
+        return 0;
+        }
+    else
+        {
+        return static_cast<TInt32>(iMovie->VideoClipCutOutTime(iIndex).Int64() / 1000);
+        }
+    }
+
+CAknNavigationDecorator* CVeiCutVideoView::CreateTimeLabelNaviL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::CreateTimeLabelNaviL: in");
+    CVeiTimeLabelNavi* timelabelnavi = CVeiTimeLabelNavi::NewLC();
+    CAknNavigationDecorator* decoratedFolder =
+        CAknNavigationDecorator::NewL(iNaviPane, timelabelnavi, CAknNavigationDecorator::ENotSpecified);
+    CleanupStack::Pop(timelabelnavi);
+    
+    CleanupStack::PushL(decoratedFolder);
+    decoratedFolder->SetContainerWindowL(*iNaviPane);
+    CleanupStack::Pop(decoratedFolder);
+    decoratedFolder->MakeScrollButtonVisible(EFalse);
+    LOG(KVideoEditorLogFile, "CVeiCutVideoView::CreateTimeLabelNaviL: out");
+    return decoratedFolder;
+    }
+
+TInt CVeiCutVideoView::UpdateTimeCallbackL(TAny* aPtr)
+    {
+    CVeiCutVideoView* view = (CVeiCutVideoView*)aPtr;
+
+    view->UpdateTimeL();
+
+    return 1;
+    }
+
+
+void CVeiCutVideoView::UpdateTimeL()
+    {
+    DrawTimeNaviL();
+
+    if (iMarkState == EMarkStateIn) 
+        {
+        if (iContainer->PlaybackPositionL() > iMovie->VideoClipCutInTime( iIndex )) 
+            {
+            UpdateCBAL(iContainer->State());
+            }
+        }
+    else if (iMarkState == EMarkStateOut) 
+        {
+        if (iContainer->PlaybackPositionL() < iMovie->VideoClipCutOutTime( iIndex )) 
+            {
+            UpdateCBAL(iContainer->State());
+            }
+        }
+    else 
+        {
+        if ((iContainer->PlaybackPositionL() < iMovie->VideoClipCutInTime( iIndex )) ||
+            (iContainer->PlaybackPositionL() > iMovie->VideoClipCutOutTime( iIndex ))) 
+            {
+            UpdateCBAL(iContainer->State());
+            }
+        }
+    }
+
+void CVeiCutVideoView::DrawTimeNaviL()
+    {
+    TTime elapsed( iContainer->PlaybackPositionL().Int64() );
+    TTime total( iContainer->TotalLength().Int64() );
+
+    TBuf<16> elapsedBuf;
+    TBuf<16> totalBuf;
+
+    HBufC* dateFormatString;
+    HBufC* stringholder;
+
+    if ( ( total.Int64() / 1000 ) < 3600000 )   // check if time is over 99:59
+        {
+        dateFormatString = iEikonEnv->AllocReadResourceLC( R_QTN_TIME_DURAT_MIN_SEC );
+    
+        elapsed.FormatL(elapsedBuf, *dateFormatString);
+        total.FormatL(totalBuf, *dateFormatString);
+        CleanupStack::PopAndDestroy(dateFormatString);
+           
+        CDesCArrayFlat* strings = new (ELeave) CDesCArrayFlat(2);
+        CleanupStack::PushL(strings);
+        strings->AppendL(elapsedBuf);
+        strings->AppendL(totalBuf);
+        stringholder = StringLoader::LoadL(R_VEI_NAVI_TIME, *strings, iEikonEnv);
+        CleanupStack::PopAndDestroy(strings);
+
+        
+        CleanupStack::PushL(stringholder);  
+
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLabelL(stringholder->Des());
+
+        CleanupStack::PopAndDestroy(stringholder);
+        }
+    else
+        {
+        TBuf<25> layoutTime;
+        TBuf<15> minsec;   
+        TTimeIntervalMinutes minutes; 
+        TTimeIntervalMicroSeconds32 seconds; 
+        
+        TInt64 duration = ( iContainer->PlaybackPositionL().Int64() / 1000 ); 
+        TChar timeSeparator = TLocale().TimeSeparator(2);
+        //over 1 minute
+        if( duration >= 60000 ) 
+            { 
+            minutes = TTimeIntervalMinutes(static_cast<TInt32>( duration) / 60000 ); 
+            minsec.AppendNum( minutes.Int() ); 
+            minsec.Append( timeSeparator ); 
+
+            duration = duration - minutes.Int() * 60000; 
+            }
+        else
+            {
+            minsec.Append( _L( "00" ) ); 
+            minsec.Append( timeSeparator ); 
+            }   
+        if( duration >= 1000 ) 
+            { 
+            seconds = TTimeIntervalMicroSeconds32( static_cast<TInt32>(duration) / 1000 ); 
+
+            if( seconds.Int() >= 60 ) 
+                { 
+                minsec.AppendNum( seconds.Int() - 60 ); 
+                } 
+            else 
+                { 
+                if ( seconds.Int() < 10 ) 
+                    { 
+                    minsec.Append( _L("0") ); 
+                    } 
+                minsec.AppendNum( seconds.Int() ); 
+                } 
+            }
+        else 
+            { 
+            minsec.Append( _L("00") ); 
+            } 
+        layoutTime.Append( minsec );
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutTime );
+
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLabelL(layoutTime);
+        }
+
+
+    /* Prevent the screen light dimming. */
+    if (elapsed.DateTime().Second() == 0 || elapsed.DateTime().Second() == 15 || elapsed.DateTime().Second() == 30 || elapsed.DateTime().Second() == 45)
+        {
+        User::ResetInactivityTime();
+        }
+    }
+
+
+void CVeiCutVideoView::StartNaviPaneUpdateL()
+    {
+    DrawTimeNaviL();
+    if (iTimeUpdater && !iTimeUpdater->IsActive())
+        {
+        iTimeUpdater->Start(200000, 1000000/10, TCallBack(CVeiCutVideoView::UpdateTimeCallbackL, this));
+        }
+    }
+
+void CVeiCutVideoView::StopNaviPaneUpdateL()
+    {
+    if (iContainer)
+        {
+        DrawTimeNaviL();
+        }
+    if (iTimeUpdater && iTimeUpdater->IsActive())
+        {
+        iTimeUpdater->Cancel();
+        }
+    }
+
+TInt CVeiCutVideoView::HideVolumeCallbackL(TAny* aPtr)
+    {
+    CVeiCutVideoView* view = (CVeiCutVideoView*)aPtr;
+    view->HideVolume();
+    return 0;
+    }
+
+void CVeiCutVideoView::HideVolume()
+    {
+    iNaviPane->Pop(iVolumeNavi);
+    }
+
+void CVeiCutVideoView::VolumeMuteL()
+    {
+    iContainer->MuteL();
+    }
+
+
+
+void CVeiCutVideoView::ShowVolumeLabelL( TInt aVolume )
+    {
+    STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->
+            SetVolumeIconVisibilityL( ETrue );
+
+    if (iVolumeHider->IsActive())
+        {
+        iVolumeHider->Cancel();
+        }
+    if (aVolume == 0) 
+        {
+        STATIC_CAST( CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->
+            SetVolumeIconVisibilityL( EFalse );
+        HideVolume();
+        return;
+        }
+
+    iNaviPane->PushL(*iVolumeNavi);
+    iVolumeHider->Start(1000000, 1000000, TCallBack(CVeiCutVideoView::HideVolumeCallbackL, this));
+
+    STATIC_CAST(CAknVolumeControl*, iVolumeNavi->DecoratedControl())->SetValue(aVolume);
+    
+    if (aVolume > iContainer->MinVolume() + 1 )
+        {
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLeftArrowVisibilityL(ETrue);
+        }
+    else
+        {
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetLeftArrowVisibilityL(EFalse);
+        }
+
+    if (aVolume < iContainer->MaxVolume())
+        {
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetRightArrowVisibilityL(ETrue);
+        }
+    else
+        {
+        STATIC_CAST(CVeiTimeLabelNavi*, iTimeNavi->DecoratedControl())->SetRightArrowVisibilityL(EFalse);
+        }
+    
+    }
+
+void CVeiCutVideoView::HandleForegroundEventL  ( TBool aForeground )
+    {
+    if ( !aForeground )
+        {
+        // If the application is closing down, calling PauseL could result in 
+        // a callback from the MMF player after the container is already deleted,
+        // causing KERN-EXEC 3
+        if ( static_cast<CVeiAppUi*>( AppUi() )->AppIsOnTheWayToDestruction() )
+            {
+            iContainer->PrepareForTerminationL();
+            }
+        else
+            {
+            iContainer->PauseL( EFalse );
+            }
+        iNaviPane->Pop( iTimeNavi );
+        }
+    else
+        {
+        UpdateCBAL( iContainer->State() );
+        iNaviPane->PushL( *iTimeNavi );
+        }
+    }
+
+// ---------------------------------------------------------
+// CVeiCutVideoView::HandleStatusPaneSizeChange()
+// ---------------------------------------------------------
+//
+void CVeiCutVideoView::HandleStatusPaneSizeChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( AppUi()->ClientRect() );
+        }
+    }
+
+TBool CVeiCutVideoView::IsEnoughFreeSpaceToSaveL()// const
+    {
+
+    STATIC_CAST( CVeiAppUi*, AppUi() )->ReadSettingsL( iMovieSaveSettings );
+    iMemoryInUse = iMovieSaveSettings.MemoryInUse();
+
+    RFs&    fs = iEikonEnv->FsSession();
+    TBool spaceBelowCriticalLevel( EFalse );
+
+    /* seek position of clip */
+    TTimeIntervalMicroSeconds frame;
+    frame = iContainer->PlaybackPositionL();
+
+    /* frame index of position */
+    TInt frameIndex;
+    frameIndex = iMovie->VideoClipInfo( iIndex )->GetVideoFrameIndexL( frame );
+
+    /* frame size */
+    TInt sizeEstimate; 
+    sizeEstimate = iMovie->VideoClipInfo( iIndex )->VideoFrameSizeL( frameIndex );
+
+    if ( iMemoryInUse == CAknMemorySelectionDialog::EPhoneMemory )
+        {   
+        spaceBelowCriticalLevel = SysUtil::DiskSpaceBelowCriticalLevelL( &fs, sizeEstimate, EDriveC );
+        }
+    else
+        {
+        spaceBelowCriticalLevel = SysUtil::MMCSpaceBelowCriticalLevelL( &fs, sizeEstimate );
+        }   
+
+
+    if ( !spaceBelowCriticalLevel )
+        {
+        return ETrue;
+        }
+    else 
+        {
+        HBufC* stringholder;
+        stringholder = StringLoader::LoadLC( R_VEI_MEMORY_RUNNING_OUT, iEikonEnv );
+        CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+        dlg->ExecuteLD( *stringholder );
+        CleanupStack::PopAndDestroy( stringholder );  
+
+        return EFalse;
+        }
+    }
+
+TTimeIntervalMicroSeconds CVeiCutVideoView::GetVideoClipCutInTime()
+    {
+    TTimeIntervalMicroSeconds cutInTime(0);
+    if ( iMovie )
+        {
+        cutInTime = iMovie->VideoClipCutInTime( iIndex );
+        }
+    return cutInTime;
+    }
+
+TTimeIntervalMicroSeconds CVeiCutVideoView::GetVideoClipCutOutTime()
+    {
+    TTimeIntervalMicroSeconds cutOutTime(0);
+    if ( iMovie )
+        {
+        cutOutTime = iMovie->VideoClipCutOutTime( iIndex );
+        }
+    return cutOutTime;
+    }
+
+void CVeiCutVideoView::HandleResourceChange(TInt aType)
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoView::HandleResourceChange() In, aType:%d", aType);
+    
+    if (KAknsMessageSkinChange == aType)
+        {
+        // Handle skin change in the navi label controls - they do not receive 
+        // it automatically since they are not in the control stack
+        iTimeNavi->DecoratedControl()->HandleResourceChange( aType );
+        iVolumeNavi->DecoratedControl()->HandleResourceChange( aType );
+        }
+    
+    LOG(KVideoEditorLogFile, "CVeiEditVideoView::HandleResourceChange() Out");
+    }
+ 
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiDocument.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+#include "VeiDocument.h"
+#include "VeiAppUi.h"
+#include "videoeditorcommon.h"
+#include <aiwgenericparam.h>
+
+// ================= MEMBER FUNCTIONS =======================
+
+// constructor
+CVeiDocument::CVeiDocument(CEikApplication& aApp)
+: CAiwGenericParamConsumer(aApp)    
+    {
+    }
+
+// destructor
+CVeiDocument::~CVeiDocument()
+    {
+    }
+
+// Default constructor can leave.
+void CVeiDocument::ConstructL()
+    {
+    }
+
+// Two-phased constructor.
+CVeiDocument* CVeiDocument::NewL(
+        CEikApplication& aApp)     // CVeiApp reference
+    {
+    CVeiDocument* self = new (ELeave) CVeiDocument( aApp );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ----------------------------------------------------
+// CVeiDocument::OpenFileL
+// 
+// ----------------------------------------------------
+//
+void CVeiDocument::OpenFileL(CFileStore*& /*aFileStore*/, RFile& aFile)
+    {
+    LOG(KVideoEditorLogFile, "CVeiDocument::OpenFileL: In");
+
+    // File handle is not used, but close it because Open File Service
+    // duplicates the handle and may not close it.
+    aFile.Close();
+
+    // Get the input files
+    CCoeEnv* coeEnv = CCoeEnv::Static();
+    const CAiwGenericParamList* inParamList = NULL;
+    inParamList = GetInputParameters();
+    const TAiwGenericParam* param = NULL;
+    TInt index(0);
+    if (inParamList && inParamList->Count() > 0)
+        {
+        LOGFMT(KVideoEditorLogFile, "\tAIW parameter count: %d", inParamList->Count());
+
+        param = inParamList->FindFirst( index,EGenericParamFile );  
+
+        while( index != KErrNotFound )  
+            {
+            TFileName filename = param->Value().AsDes();
+            LOGFMT(KVideoEditorLogFile, "\tInserting video clip to movie: %S", &filename);
+            STATIC_CAST( CVeiAppUi*, coeEnv->AppUi() )->InsertVideoClipToMovieL( 
+                EFalse, filename );
+
+            param = inParamList->FindNext( index, EGenericParamFile );
+            }
+        }
+
+    TFileName filee;
+    filee.Append( _L("eeee"));
+    STATIC_CAST( CVeiAppUi*, coeEnv->AppUi() )->InsertVideoClipToMovieL( 
+            ETrue, filee);
+
+    LOG(KVideoEditorLogFile, "CVeiDocument::OpenFileL: Out");
+    }
+
+// ----------------------------------------------------
+// CVeiDocument::CreateAppUiL()
+// constructs CVeiAppUi
+// ----------------------------------------------------
+//
+CEikAppUi* CVeiDocument::CreateAppUiL()
+    {
+    return new (ELeave) CVeiAppUi;
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiEditVideoContainer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,5936 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+
+// System includes
+#include <manualvideoeditor.rsg>
+#include <manualvideoeditor.mbg>
+#include <videoeditoruicomponents.rsg>
+#include <videoeditoruicomponents.mbg>
+#include <videoeditorbitmaps.mbg>
+#include <gulicon.h>
+#include <stringloader.h>
+#include <aknsdrawutils.h> 
+#include <aknsdatacontext.h> 
+#include <aknsbasicbackgroundcontrolcontext.h> 
+#include <aknquerydialog.h> 
+#include <eikprogi.h> 
+#include <aknnotewrappers.h> 
+#include <errorui.h>
+#include <aknbiditextutils.h>
+#include <gulfont.h>
+#include <akniconutils.h>
+#include <pathinfo.h>
+#include <f32file.h>
+#include <CMGAlbumManager.h>
+#include <vedcommon.h>
+#include <mmf/common/mmferrors.h>
+
+// User includes
+#include "VeiEditVideoContainer.h"
+#include "VeiVideoDisplay.h"
+#include "VeiTextDisplay.h"
+#include "VeiCutterBar.h"
+#include "veiappui.h"
+#include "veiframetaker.h"
+#include "VeiIconBox.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorUtils.h"
+#include "VideoEditorHelp.hlp.hrh"  // Topic contexts (literals)
+#include "VeiEditVideoView.h"
+#include "ManualVideoEditor.hrh"
+#include "VeiSlider.h"
+#include "StoryboardItems.h"
+#include "TransitionInfo.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+void CleanupRArray( TAny* object )
+    {
+    (( RImageTypeDescriptionArray*)object)->ResetAndDestroy();
+    }
+
+CVeiEditVideoContainer* CVeiEditVideoContainer::NewL( const TRect& aRect, 
+                                CVedMovie& aMovie, CVeiEditVideoView& aView )
+    {
+    CVeiEditVideoContainer* self = CVeiEditVideoContainer::NewLC( aRect, 
+                                                            aMovie, aView );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CVeiEditVideoContainer* CVeiEditVideoContainer::NewLC( const TRect& aRect,
+                                CVedMovie& aMovie, CVeiEditVideoView& aView )
+    {
+    CVeiEditVideoContainer* self = new (ELeave) CVeiEditVideoContainer( aMovie, aView );
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect );
+    return self;
+    }
+
+// ---------------------------------------------------------
+// CVeiEditVideoContainer::ConstructL(const TRect& aRect)
+// EPOC two phased constructor
+// ---------------------------------------------------------
+//
+void CVeiEditVideoContainer::ConstructL( const TRect& aRect )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConstructL in");
+
+    CreateWindowL();
+
+    iMovie.RegisterMovieObserverL( this );
+
+    iConverter = CVeiImageConverter::NewL( this );
+
+    TFileName mbmPath(  VideoEditorUtils::IconFileNameAndPath(KManualVideoEditorIconFileId) );
+    TFileName mbmPath2( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) );
+    TFileName mbmPath3( VideoEditorUtils::IconFileNameAndPath(KVeiNonScalableIconFileId) );
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConstructL  Loading bitmaps..");
+
+    // No thumbnail icon (shown when video thumb nail cannot be generated)
+    AknIconUtils::CreateIconL( iNoThumbnailIcon, iNoThumbnailIconMask,
+            mbmPath2, EMbmVideoeditoruicomponentsQgn_graf_ve_novideo, 
+            EMbmVideoeditoruicomponentsQgn_graf_ve_novideo_mask );
+
+    iAudioIcon = AknIconUtils::CreateIconL( mbmPath, 
+                    EMbmManualvideoeditorQgn_graf_ve_symbol_audio );
+
+    // Video timeline icon
+
+    AknIconUtils::CreateIconL( iVideoTrackIcon, iVideoTrackIconMask,
+            mbmPath, EMbmManualvideoeditorQgn_prop_ve_file_video, 
+            EMbmManualvideoeditorQgn_prop_ve_file_video_mask );
+
+    // Audio timeline icon
+
+    AknIconUtils::CreateIconL( iAudioTrackIcon, iAudioTrackIconMask,
+            mbmPath, EMbmManualvideoeditorQgn_prop_ve_file_audio, 
+            EMbmManualvideoeditorQgn_prop_ve_file_audio_mask );    
+
+    // Audio mixing icon
+    iAudioMixingIcon = AknIconUtils::CreateIconL( mbmPath3, 
+            EMbmVideoeditorbitmapsMix_audio_background );
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConstructL  Bitmaps OK!");
+
+    iTransitionInfo = CTransitionInfo::NewL();
+
+    iZoomTimer = CPeriodic::NewL( CActive::EPriorityLow );
+
+    iVideoDisplayBox = TRect(0,0,100,100);
+
+    iVideoDisplay = CVeiVideoDisplay::NewL( iVideoDisplayBox, this, *this );
+
+/* Video Display components for transitioin state*/
+    iTransitionDisplayRight = CVeiVideoDisplay::NewL( iVideoDisplayBox, this, *this );
+    iTransitionDisplayLeft = CVeiVideoDisplay::NewL( iVideoDisplayBox, this, *this );
+
+    iDummyCutBar = CVeiCutterBar::NewL( this, ETrue );
+    iDummyCutBarLeft = CVeiCutterBar::NewL( this, ETrue );
+
+/* IconBox */
+    iEffectSymbolBox = TRect(0,0,10,10);
+    iEffectSymbols = CVeiIconBox::NewL( iEffectSymbolBox, this );
+
+    iInfoDisplay = CVeiTextDisplay::NewL( iVideoDisplayBox, this );
+    iInfoDisplay->SetMopParent( this );
+    iArrowsDisplay = CVeiTextDisplay::NewL( iVideoDisplayBox, this );
+
+    SetRect( aRect );
+    iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse );
+
+    iFrameTaker = CVeiFrameTaker::NewL( *this );
+
+    iGradientBitmap = new(ELeave)CFbsBitmap;
+    TRgb startColor = TRgb( 0x7a, 0xbe, 0xe7);
+    TRgb endColor = TRgb( 0x00, 0x3e, 0x80 );
+    TInt breadth = 30;
+    ColorUtils::TBitmapOrientation bitmapOrientation = ColorUtils::EBitmapOrientationHorizontal;
+    ColorUtils::CreateGradientBitmapL( *iGradientBitmap, iEikonEnv->WsSession(), breadth,
+        bitmapOrientation, startColor, endColor );
+    LOG(KVideoEditorLogFile, "Gradient bitmap created..");
+    SetCursorLocation( ECursorOnEmptyVideoTrack );
+
+/* Timer to keep back light on when user is not giving key events */
+    iScreenLight = CVeiDisplayLighter::NewL();
+
+    iCurrentPoint = 0;
+/* Timer. Draws playhead */
+    iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
+    iSeekPos = TTimeIntervalMicroSeconds( 0 );
+    SetPreviewState(EStateInitializing);    
+
+    iBlackScreen = EFalse;  
+
+    CreateScrollBarL(aRect);                
+                
+    AknIconUtils::CreateIconL( iPauseBitmap, iPauseBitmapMask,
+            mbmPath2, EMbmVideoeditoruicomponentsQgn_prop_ve_pause, 
+            EMbmVideoeditoruicomponentsQgn_prop_ve_pause_mask );
+            
+    EnableDragEvents();            
+    
+    ActivateL();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConstructL: out");
+    }
+    
+//===========================================================================    
+void CVeiEditVideoContainer::CreateScrollBarL(const TRect& aRect)
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::CreateScrollBarL: in");
+    // create vertical slider control in the middle of the
+    // screen in vertical direction and 10 pixels from the
+    // right side of the screen
+
+    iVerticalSlider = CVeiVerticalSlider::NewL(aRect, *this);
+    iVerticalSlider->SetMinimum( KVolumeSliderMin );
+    iVerticalSlider->SetMaximum( KVolumeSliderMax );
+    iVerticalSlider->SetStep( KVolumeSliderStep );
+
+    iVerticalSlider->SetPosition(0);
+
+    iHorizontalSlider = CVeiHorizontalSlider::NewL(aRect, *this);
+    iHorizontalSlider->SetMinimum(-10);
+    iHorizontalSlider->SetMaximum(10);
+    iHorizontalSlider->SetStep(1);
+
+    iHorizontalSlider->SetPosition(0);
+
+    iVerticalSlider->MakeVisible(EFalse);
+    iHorizontalSlider->MakeVisible(EFalse); 
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::CreateScrollBarL: out");
+    }
+
+//===========================================================================    
+CVeiEditVideoContainer::CVeiEditVideoContainer( CVedMovie& aMovie, CVeiEditVideoView& aView )
+    :iView( aView ), iMovie( aMovie )
+    {
+    iCurrentlyProcessedIndex = -1;
+    iSelectionMode = EModeNavigation;
+    iVideoCursorPos = 0;
+    iAudioCursorPos = 0;
+
+    iCursorLocation = ECursorOnEmptyVideoTrack;
+    iPrevCursorLocation = ECursorOnClip;
+    iTakeSnapshot = EFalse;
+    iSeeking = EFalse;
+    iCloseStream = EFalse;
+    iBackKeyPressed = EFalse;
+    /* Flag to make sure that engine has finished frame before trying to get next one. */
+    iFrameReady = ETrue;
+    }
+
+
+CVeiEditVideoContainer::~CVeiEditVideoContainer()
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::~CVeiEditVideoContainer(): In");
+    if ( iMovie.MovieObserverIsRegistered( this ) )
+        {
+        iMovie.UnregisterMovieObserver( this );
+        }
+
+    if ( iTempVideoInfo )
+        {       
+        iTempVideoInfo->CancelFrame();
+        delete iTempVideoInfo;
+        iTempVideoInfo = NULL;      
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::~CVeiEditVideoContainer(): iTempVideoInfo delete OK..");
+        }
+
+    if ( iConverter )
+        {
+        iConverter->CancelEncoding();
+        delete iConverter;
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::~CVeiEditVideoContainer(): iConverter delete OK..");
+        }
+
+    delete iTransitionInfo;
+    delete iScreenLight;
+    delete iVideoTrackIcon;
+    delete iVideoTrackIconMask;
+    delete iAudioTrackIcon;
+    delete iAudioTrackIconMask;
+    delete iAudioIcon;
+    delete iAudioMixingIcon;
+    delete iNoThumbnailIcon;
+    delete iNoThumbnailIconMask;
+    delete iGradientBitmap;
+    delete iBgContext;
+    delete iVideoDisplay;
+    delete iTransitionDisplayRight;
+    delete iTransitionDisplayLeft;
+    delete iDummyCutBar;
+    delete iDummyCutBarLeft;
+    delete iEffectSymbols;
+    delete iInfoDisplay;
+    delete iArrowsDisplay;
+    delete iFrameTaker;
+    delete iRemConTarget;
+
+    if ( iZoomTimer )
+        {
+        iZoomTimer->Cancel();
+        delete iZoomTimer;
+        }
+    iVideoItemArray.ResetAndDestroy();
+    iAudioItemArray.ResetAndDestroy();
+    iVideoItemRectArray.Close();
+    
+    if ( iPeriodic ) 
+        {
+        iPeriodic->Cancel();
+        delete iPeriodic;
+        }
+            
+    if ( iTempFileName )
+        {
+        delete iTempFileName;
+        iTempFileName = NULL;
+        }
+    if ( iSaveToFileName )
+        {
+        delete iSaveToFileName;
+        iSaveToFileName = NULL;
+        }
+        
+    delete iHorizontalSlider;    
+    delete iVerticalSlider;        
+
+    delete iPauseBitmap;
+    delete iPauseBitmapMask;
+
+    delete iCallBack;           
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::~CVeiEditVideoContainer(): Out");
+    }
+
+// ---------------------------------------------------------
+// CVeiEditVideoContainer::SizeChanged()
+// Called by framework when the view size is changed
+// ---------------------------------------------------------
+//
+void CVeiEditVideoContainer::SizeChanged()
+    {
+    LOGFMT2(KVideoEditorLogFile, "CVeiEditVideoContainer SizeChanged: In: (%d,%d)", Size().iWidth, Size().iHeight);
+
+    TRect rect = Rect();
+
+    if ( iBgContext )
+        iBgContext->SetRect( rect );
+
+    TInt audioTrackBoxTlX = -1;
+    TInt audioTrackBoxSizeWidth = -1;
+    TInt videoScreenSizeWidth = -1;
+    TInt videoScreenSizeHeight = -1;
+    TInt effectSymbolBoxTlXPortrait = -1; 
+    TInt videoScreenXPortrait = -1;
+    TInt videoScreenYPortrait = -1;
+    TInt infoDisplayBoxSizeHeight = -1;
+    TInt thumbnailStartPaneBoxTlY = -1;
+    TInt thumbnailStartPaneBoxSizeWidth = -1;
+    TInt thumbnailStartPaneBoxSizeHeight = -1;
+    TInt thumbnailEndPaneBoxTlY = -1;
+    TInt sliderThickness = -1;
+
+    switch( rect.iBr.iX )
+        {
+            case 240:
+            case 320:
+                audioTrackBoxTlX = 25;              
+                audioTrackBoxSizeWidth = 204;
+                videoScreenSizeWidth = 156;
+                videoScreenSizeHeight = 128;
+                effectSymbolBoxTlXPortrait = 23;
+                videoScreenXPortrait = 47;
+                videoScreenYPortrait = 2;
+                infoDisplayBoxSizeHeight = 24;
+                thumbnailStartPaneBoxTlY = 12;
+                thumbnailStartPaneBoxSizeWidth = 78;
+                thumbnailStartPaneBoxSizeHeight = 64;
+                thumbnailEndPaneBoxTlY = 12;
+                sliderThickness = 12;
+                break;
+            case 176:
+            case 208:
+                audioTrackBoxTlX = 19;              
+                audioTrackBoxSizeWidth = rect.iBr.iX-25;//153;
+                videoScreenSizeWidth = 96;
+                videoScreenSizeHeight = 78;
+                effectSymbolBoxTlXPortrait = 25;
+                videoScreenXPortrait = 40;
+                videoScreenYPortrait = 2;
+                infoDisplayBoxSizeHeight = 15;
+                thumbnailStartPaneBoxTlY = 8;
+                thumbnailStartPaneBoxSizeWidth = 56;
+                thumbnailStartPaneBoxSizeHeight = 46;
+                thumbnailEndPaneBoxTlY = 8;
+                sliderThickness = 8;
+                break;
+            case 352:
+            case 416:
+                audioTrackBoxTlX = 38;
+                audioTrackBoxSizeWidth = 306;
+                videoScreenSizeWidth = 193;
+                videoScreenSizeHeight = 158;
+                effectSymbolBoxTlXPortrait = 43;
+                videoScreenXPortrait = 80;
+                videoScreenYPortrait = 4;
+                infoDisplayBoxSizeHeight = 31;
+                thumbnailStartPaneBoxTlY = 16;
+                thumbnailStartPaneBoxSizeWidth = 112;
+                thumbnailStartPaneBoxSizeHeight = 93;
+                thumbnailEndPaneBoxTlY = 16;
+                sliderThickness = 12;
+                break;
+            default:
+                audioTrackBoxTlX = 38;
+                audioTrackBoxSizeWidth = 306;
+                videoScreenSizeWidth = 193;
+                videoScreenSizeHeight = 158;
+                effectSymbolBoxTlXPortrait = 43;
+                videoScreenXPortrait = 80;
+                videoScreenYPortrait = 4;
+                infoDisplayBoxSizeHeight = 31;
+                thumbnailStartPaneBoxTlY = 16;
+                thumbnailStartPaneBoxSizeWidth = 112;
+                thumbnailStartPaneBoxSizeHeight = 93;
+                thumbnailEndPaneBoxTlY = 16;
+                sliderThickness = 12;
+                break;          
+        };
+
+    iTransitionMarkerSize.iWidth = 7;
+    iTransitionMarkerSize.iHeight = 9;
+
+    iAudioBarBox.iTl.iX = (rect.iTl.iX + 1) + iTransitionMarkerSize.iWidth / 2 + 20;
+    iAudioBarBox.iTl.iY = rect.iBr.iY - 16;
+    iAudioBarBox.iBr.iX = (rect.iBr.iX - 1) - iTransitionMarkerSize.iWidth / 2;
+    iAudioBarBox.iBr.iY = rect.iBr.iY - 1;
+
+    TPoint audioTrackBoxTl = TPoint(audioTrackBoxTlX, 
+        STATIC_CAST(TInt, rect.iBr.iY*0.8994 ));
+
+    TSize audioTrackBoxSize = TSize(audioTrackBoxSizeWidth, 
+        STATIC_CAST(TInt, rect.iBr.iY*0.0764 )); 
+    iAudioTrackBox = TRect( audioTrackBoxTl, audioTrackBoxSize );
+
+    iAudioBarIconPos.iX = STATIC_CAST(TInt,0.01137*rect.iBr.iX);//rect.iTl.iX;
+    iAudioBarIconPos.iY = iAudioTrackBox.iTl.iY;
+
+    AknIconUtils::SetSize( iVideoTrackIcon, TSize( iAudioTrackBox.Height(), iAudioTrackBox.Height() ) );
+    AknIconUtils::SetSize( iAudioTrackIcon, TSize( iAudioTrackBox.Height(), iAudioTrackBox.Height() ) );
+
+    iAudioBarBox = iAudioTrackBox;
+
+    iVideoBarBox.iTl.iX = iAudioBarBox.iTl.iX;
+    iVideoBarBox.iTl.iY = iAudioBarBox.iTl.iY - iTransitionMarkerSize.iHeight - 16;
+    iVideoBarBox.iBr.iX = iAudioBarBox.iBr.iX;
+    iVideoBarBox.iBr.iY = iAudioBarBox.iTl.iY - 10;
+
+    TPoint videoTrackBoxTl = TPoint(audioTrackBoxTl.iX,
+    STATIC_CAST(TInt,rect.iBr.iY*0.7882 ));
+
+    TSize videoTrackBoxSize = TSize(audioTrackBoxSize.iWidth, 
+        STATIC_CAST(TInt, rect.iBr.iY*0.0764 )); 
+
+    iVideoTrackBox = TRect( videoTrackBoxTl, videoTrackBoxSize );
+
+    iVideoBarIconPos.iX = iAudioBarIconPos.iX;
+    iVideoBarIconPos.iY = iVideoTrackBox.iTl.iY;
+
+    iVideoBarBox = iVideoTrackBox;
+
+    iBarArea.iTl.iX = rect.iTl.iX;
+    iBarArea.iTl.iY = iVideoBarBox.iTl.iY;
+    iBarArea.iBr.iX = rect.iBr.iX;
+    iBarArea.iBr.iY = iAudioBarBox.iBr.iY;
+
+    TBool landscape = VideoEditorUtils::IsLandscapeScreenOrientation();
+
+    if ( landscape ) //Landscape
+        {
+        // clip thumbnail pane
+        TInt videoScreenX = STATIC_CAST( TInt, rect.iBr.iX*0.0097 );
+        TInt videoScreenY = STATIC_CAST( TInt, rect.iBr.iY*0.0139 );
+
+        TSize videoScreenSize( videoScreenSizeWidth, videoScreenSizeHeight );
+
+        iVideoDisplayBox = TRect( TPoint( videoScreenX, videoScreenY ), videoScreenSize );
+        iVideoDisplay->SetRect( iVideoDisplayBox );
+
+        //clip cut timeline pane
+        TSize cutBarBoxSize = TSize(videoScreenSize.iWidth, 
+            STATIC_CAST(TInt,rect.iBr.iY*0.09375 ));
+        iDummyCutBarBox = TRect( TPoint(iVideoDisplayBox.iTl.iX, iVideoDisplayBox.iBr.iY), cutBarBoxSize );
+        iDummyCutBar->SetRect( iDummyCutBarBox );
+
+        //clip info pane
+        TSize infoDisplayBoxSize = TSize( STATIC_CAST(TInt,rect.iBr.iX*0.4159),STATIC_CAST(TInt,rect.iBr.iY*0.56) );
+        iInfoDisplayBox = TRect( TPoint(iVideoDisplayBox.iBr.iX+videoScreenX, iVideoDisplayBox.iTl.iY), 
+            infoDisplayBoxSize );
+
+        //clip indicator pane 
+        TInt iconHeight = STATIC_CAST( TInt, rect.iBr.iY * 0.0972222222 ); 
+
+        TPoint effectSymbolBoxTl = TPoint( iInfoDisplayBox.iTl.iX, iInfoDisplayBox.iBr.iY/*+videoScreenY*/);
+        TSize effectSymbolBoxSize = TSize( STATIC_CAST(TInt,rect.iBr.iX*0.22115385), iconHeight );
+
+        iEffectSymbolBox = TRect( effectSymbolBoxTl, effectSymbolBoxSize);
+        iEffectSymbols->SetLandscapeScreenOrientation( landscape );
+
+        //pause indicator box (for preview state)
+        iPauseIconBox = TRect( effectSymbolBoxTl, TSize(iconHeight, iconHeight) );
+
+        //slider controls
+        if (iVerticalSlider)
+            {
+            iVerticalSliderSize = TSize(sliderThickness, iVideoDisplayBox.Height() + iDummyCutBarBox.Height());
+            iVerticalSliderPoint = TPoint( rect.Width() - sliderThickness * 2, videoScreenY );
+            iVerticalSlider->SetExtent( iVerticalSliderPoint, iVerticalSliderSize );
+            }
+        if (iHorizontalSlider)
+            {
+            iHorizontalSliderSize = TSize(videoScreenSize.iWidth, sliderThickness);
+            iHorizontalSliderPoint = TPoint( videoScreenX, videoScreenY + videoScreenSize.iHeight + sliderThickness);
+            iHorizontalSlider->SetExtent( iHorizontalSliderPoint, iHorizontalSliderSize );
+            }
+
+        //transition
+
+        //ved_clip_thumbnail_start_pane
+        TPoint thumbnailEndPaneBoxTl = TPoint(videoScreenX,videoScreenY);
+
+        TSize thumbnailEndPaneBoxSize = TSize(STATIC_CAST(TInt, 0.3198*rect.iBr.iX),
+            STATIC_CAST(TInt,rect.iBr.iY*0.3785));
+
+        iTransitionDisplayLeftBox = TRect( thumbnailEndPaneBoxTl, thumbnailEndPaneBoxSize );
+        iTransitionDisplayLeft->SetRect( iTransitionDisplayLeftBox );
+
+
+        //ved_clip_thumbnail_end_pane
+        TPoint thumbnailStartPaneBoxTl = TPoint(STATIC_CAST(TInt, 0.6707*rect.iBr.iX),videoScreenY);
+
+        TSize thumbnailStartPaneBoxSize = thumbnailEndPaneBoxSize; 
+        
+        iTransitionDisplayRightBox = TRect( thumbnailStartPaneBoxTl, thumbnailStartPaneBoxSize );
+        iTransitionDisplayRight->SetRect( iTransitionDisplayRightBox );
+
+        //ved_transition_info_pane
+        TPoint transitionArrowsBoxTl = TPoint(STATIC_CAST(TInt, 0.0866*rect.iBr.iX),
+            STATIC_CAST(TInt,0.4896*rect.iBr.iY ) );
+
+        TSize transitionArrowsBoxSize = TSize(STATIC_CAST(TInt, 0.827*rect.iBr.iX),
+            STATIC_CAST(TInt,0.2848*rect.iBr.iY ) );
+
+        iTransitionArrowsBox = TRect( transitionArrowsBoxTl, transitionArrowsBoxSize );
+
+        TInt SlowMotionBoxTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.1346 );
+        TInt SlowMotionBoxTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.6806 );  
+        TInt SlowMotionBoxBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.4423077 );
+        TInt SlowMotionBoxBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.7639 );
+            
+        iSlowMotionBox = TRect(SlowMotionBoxTlX, SlowMotionBoxTlY, SlowMotionBoxBrX, 
+            SlowMotionBoxBrY);
+
+        TInt widthAndheight = STATIC_CAST( TInt, rect.iBr.iX * 0.057692 );
+
+        iArrowsDisplay->SetArrowSize(TSize( widthAndheight, widthAndheight ));
+
+        // video display when cursor is on transition. 
+        iVideoDisplayBoxOnTransition = TRect(TPoint((rect.iBr.iX/2) - 
+                STATIC_CAST( TInt, 1.19*iTransitionDisplayRightBox.Size().iHeight)/2,
+                iTransitionDisplayLeftBox.iTl.iY), 
+                TSize(STATIC_CAST( TInt, 1.19*iTransitionDisplayRightBox.Size().iHeight), 
+                iTransitionDisplayRightBox.Size().iHeight)); // w:108, h:91             
+                
+        iDummyCutBarBoxOnTransition = TRect( TPoint(iTransitionDisplayRightBox.iTl.iX,
+            iTransitionDisplayRightBox.iBr.iY), TSize( iTransitionDisplayRightBox.Width(), 
+            iDummyCutBarBox.Height() ));
+        }
+        else    //Portrait
+        {
+        // clip thumbnail pane
+        TInt videoScreenX = videoScreenXPortrait;
+        TInt videoScreenY = videoScreenYPortrait;
+
+        TSize videoScreenSize( videoScreenSizeWidth, videoScreenSizeHeight );
+
+        iVideoDisplayBox = TRect( TPoint( videoScreenX, videoScreenY ), videoScreenSize );
+        iVideoDisplay->SetRect( iVideoDisplayBox );
+
+        //clip cut timeline pane
+        TSize cutBarBoxSize = TSize(videoScreenSize.iWidth, STATIC_CAST(TInt,rect.iBr.iY*0.0938 ));
+        iDummyCutBarBox = TRect( TPoint(iVideoDisplayBox.iTl.iX, 
+                        iVideoDisplayBox.iBr.iY - iVideoDisplay->GetBorderWidth()), cutBarBoxSize );
+        iDummyCutBar->SetRect( iDummyCutBarBox );
+        iDummyCutBarLeft->MakeVisible( EFalse );
+
+        //clip info pane
+        TPoint infoDisplayBoxTl = TPoint(STATIC_CAST(TInt, rect.iBr.iX*0.074), 
+            STATIC_CAST(TInt, rect.iBr.iY*0.6598 ));
+        TSize infoDisplayBoxSize = TSize(STATIC_CAST(TInt, rect.iBr.iX*0.855),
+            infoDisplayBoxSizeHeight );
+        iInfoDisplayBox = TRect( infoDisplayBoxTl, infoDisplayBoxSize );
+
+        //clip indicator pane
+        TInt iconWidth = STATIC_CAST( TInt, rect.iBr.iX * 0.07954545455 );
+
+        TInt effectSymbolBoxTlX = effectSymbolBoxTlXPortrait;
+        TInt effectSymbolBoxTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.131944444 );
+        TSize effectSymbolBoxSize = TSize(iconWidth, STATIC_CAST(TInt,rect.iBr.iY * 0.3194444444 ));
+
+        iEffectSymbolBox = TRect( TPoint(effectSymbolBoxTlX, effectSymbolBoxTlY), effectSymbolBoxSize);
+        iEffectSymbols->SetLandscapeScreenOrientation( landscape );
+
+        //pause indicator box (for preview state)
+        iPauseIconBox = TRect( iEffectSymbolBox.iTl, TSize(iconWidth, iconWidth) );
+
+        //slider controls
+        if (iVerticalSlider)
+            {
+            iVerticalSliderSize = TSize(sliderThickness, iVideoDisplayBox.Height() + iDummyCutBarBox.Height());
+            iVerticalSliderPoint = TPoint( rect.Width() - sliderThickness * 2, videoScreenY );
+            iVerticalSlider->SetExtent( iVerticalSliderPoint, iVerticalSliderSize );
+            }
+        if (iHorizontalSlider)
+            {
+            iHorizontalSliderSize = TSize(videoScreenSize.iWidth, sliderThickness);
+            iHorizontalSliderPoint = TPoint( videoScreenX, videoScreenY + videoScreenSize.iHeight + sliderThickness);
+            iHorizontalSlider->SetExtent( iHorizontalSliderPoint, iHorizontalSliderSize );
+            }
+
+        //transition
+
+        //ved_clip_thumbnail_start_pane
+        TPoint thumbnailStartPaneBoxTl = TPoint(STATIC_CAST(TInt, 0.6705*rect.iBr.iX),
+            thumbnailStartPaneBoxTlY);
+
+        TSize thumbnailStartPaneBoxSize = TSize(thumbnailStartPaneBoxSizeWidth,
+            thumbnailStartPaneBoxSizeHeight);
+
+        iTransitionDisplayRightBox = TRect( thumbnailStartPaneBoxTl, thumbnailStartPaneBoxSize );
+        iTransitionDisplayRight->SetRect( iTransitionDisplayRightBox );
+
+        //ved_clip_thumbnail_end_pane
+        TPoint thumbnailEndPaneBoxTl = TPoint(STATIC_CAST(TInt, 0.0116*rect.iBr.iX),
+            thumbnailEndPaneBoxTlY );
+
+        TSize thumbnailEndPaneBoxSize = thumbnailStartPaneBoxSize;
+
+        iTransitionDisplayLeftBox = TRect( thumbnailEndPaneBoxTl, thumbnailEndPaneBoxSize );
+        iTransitionDisplayLeft->SetRect( iTransitionDisplayLeftBox );
+
+        TInt SlowMotionBoxTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.3 );
+        TInt SlowMotionBoxTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.65 );    
+        TInt SlowMotionBoxBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.7 );
+        TInt SlowMotionBoxBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.76 );
+
+        iSlowMotionBox = TRect(SlowMotionBoxTlX, SlowMotionBoxTlY, SlowMotionBoxBrX, 
+            SlowMotionBoxBrY);
+
+        //ved_transition_info_pane
+        TPoint transitionArrowsBoxTl = TPoint(STATIC_CAST(TInt, 0.0116*rect.iBr.iX),
+            STATIC_CAST(TInt,0.4792*rect.iBr.iY ) );
+
+        TSize transitionArrowsBoxSize = TSize(STATIC_CAST(TInt, 0.9773*rect.iBr.iX),
+            STATIC_CAST(TInt,0.2848*rect.iBr.iY ) );
+
+        iTransitionArrowsBox = TRect( transitionArrowsBoxTl, transitionArrowsBoxSize );
+
+
+        TInt widthAndheight = STATIC_CAST( TInt, rect.iBr.iX * 0.068182 );
+
+        iInfoDisplay->SetArrowSize(TSize( widthAndheight, widthAndheight ));
+        iArrowsDisplay->SetArrowSize(TSize( widthAndheight, widthAndheight ));
+
+        // video display when cursor is on transition. 
+        iVideoDisplayBoxOnTransition = TRect( TPoint(STATIC_CAST( TInt, 0.341*rect.iBr.iX),
+                iTransitionDisplayLeftBox.iTl.iY), iTransitionDisplayRightBox.Size() );
+
+        iDummyCutBarBoxOnTransition = TRect( TPoint(iTransitionDisplayRightBox.iTl.iX,
+            iTransitionDisplayRightBox.iBr.iY - iVideoDisplay->GetBorderWidth()), 
+            TSize( iTransitionDisplayRightBox.Width(), iDummyCutBarBox.Height() ));
+        }
+
+    iInfoDisplay->SetRect( iInfoDisplayBox );
+    iInfoDisplay->SetLandscapeScreenOrientation( landscape );
+    iArrowsDisplay->SetRect(iSlowMotionBox);
+
+    AknIconUtils::SetSize( iNoThumbnailIcon, TSize( iVideoDisplayBox.Size() ) );
+    AknIconUtils::SetSize( iAudioIcon, TSize( iVideoDisplayBox.Size() ) );
+    AknIconUtils::SetSize( iPauseBitmap, TSize( iPauseIconBox.Size() ), EAspectRatioNotPreserved );     
+
+    // Update iconbox after screen rotation
+    iEffectSymbols->SetRect( iEffectSymbolBox );
+    if ( CursorLocation() == ECursorOnTransition && 
+            iView.EditorState() != CVeiEditVideoView::EPreview )
+        {
+        SetCursorLocation( CursorLocation() );
+        }
+
+    iArrowsDisplay->DrawDeferred();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer SizeChanged: Out");
+    }
+
+TInt CVeiEditVideoContainer::CurrentIndex() const
+    {
+    if ((iCursorLocation == ECursorOnAudio) ||
+        (iCursorLocation == ECursorOnEmptyAudioTrack))
+        {
+        return iAudioCursorPos;
+        }
+    else
+        {
+        if ( iCursorLocation == ECursorOnEmptyVideoTrack )
+            {
+            return iMovie.VideoClipCount() - 1;
+            }
+
+        return iVideoCursorPos;
+        }
+    }
+
+TUint CVeiEditVideoContainer::GetAndDecrementCurrentIndex()
+    {
+    TUint ret = 0;
+
+    if ( iCursorLocation == ECursorOnClip )
+        {
+        ret = iVideoCursorPos;
+        if ( iVideoCursorPos > 0 )
+            {
+            iVideoCursorPos--;
+            }
+        }
+    else if ( iCursorLocation == ECursorOnAudio ) 
+        {
+        ret = iAudioCursorPos;
+        if ( iAudioCursorPos > 0 )
+            {
+            iAudioCursorPos--;
+            }
+        }
+    else
+        {
+        User::Panic( _L("VideoEditor"), 0 );
+        }
+    return ret;
+    }
+    
+void CVeiEditVideoContainer::GetThumbAtL( const TTimeIntervalMicroSeconds& aTime )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::GetThumbAtL: In, iFrameReady:%d", iFrameReady);
+    if( !iTempVideoInfo || !iFrameReady )
+        {
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetThumbAtL: 1");
+        return;
+        }
+
+    TSize resolution( iTempVideoInfo->Resolution() );
+    TInt frameIndex = iTempVideoInfo->GetVideoFrameIndexL( aTime );
+
+    TInt totalFrameCount = iTempVideoInfo->VideoFrameCount();
+    iFrameReady = EFalse;
+    if ( frameIndex > totalFrameCount )
+        {
+        frameIndex = totalFrameCount;
+        }    
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetThumbAtL: 2");        
+    /* :
+     check out on every phone before releasing whether videodisplay should be stopped before starting
+     asynchronous GetFrameL()
+     see how EStateGettingFrame is handled in SetPreviewState 
+     Stopping frees memory and it is needed in memory sensible devices 
+    */
+    iTempVideoInfo->GetFrameL( *this, frameIndex, &resolution ); 
+    SetPreviewState(EStateGettingFrame);                
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetThumbAtL: Out");
+    }
+
+void CVeiEditVideoContainer::StartZooming()
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartZooming: In");
+
+    const TUint delay = 90000;
+
+    if (iView.EditorState() != CVeiEditVideoView::EQuickPreview )
+        {
+        iZoomFactorX = 0;
+        iZoomFactorY = 0;
+        }
+    else
+        {
+        iZoomFactorX = KMaxZoomFactorX;
+        iZoomFactorY = KMaxZoomFactorY;
+        }
+
+    if ( iZoomTimer->IsActive() )
+        {
+        iZoomTimer->Cancel();
+        }
+    iZoomTimer->Start( delay, delay, TCallBack( CVeiEditVideoContainer::Update, this ) );
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartZooming: Out");
+    }                       
+
+TKeyResponse CVeiEditVideoContainer::HandleScrollBarL (
+    const TKeyEvent &   aKeyEvent,
+    TEventCode          aType
+    )
+    {
+    TKeyResponse ret = EKeyWasNotConsumed;
+
+    if (EEventKey == aType)
+    {
+        switch (aKeyEvent.iCode)
+        {
+
+            case EKeyDownArrow:
+            {
+                iVerticalSlider->Increment();                   
+                iVerticalSlider->DrawDeferred();
+                ret = EKeyWasConsumed;
+                break;
+            }
+            case EKeyUpArrow:
+            {
+                iVerticalSlider->Decrement();
+                iVerticalSlider->DrawDeferred();
+                ret = EKeyWasConsumed;
+                break;
+            }
+
+            case EKeyLeftArrow:
+            {
+                iHorizontalSlider->Decrement();
+                iHorizontalSlider->DrawDeferred();
+                ret = EKeyWasConsumed;
+                break;
+            }
+            case EKeyRightArrow:
+            {
+                iHorizontalSlider->Increment();
+                iHorizontalSlider->DrawDeferred();
+                ret = EKeyWasConsumed;
+                break;
+            }
+
+            case EKeyOK:
+            {
+                ret = EKeyWasConsumed;
+                break;
+            }
+
+            /*case EKeyLeftArrow:
+            case EKeyRightArrow:
+            {
+                ret = EKeyWasConsumed;
+                break;
+            }*/
+
+            default:
+            {
+                break;
+            }
+        }
+    }
+
+    return ret;
+    }
+
+
+TKeyResponse CVeiEditVideoContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+    if (EModeMixingAudio == iSelectionMode || EModeAdjustVolume == iSelectionMode)
+        {       
+        CVeiEditVideoView::TEditorState editorState = iView.EditorState();
+        if (CVeiEditVideoView::EMixAudio == editorState ||
+            CVeiEditVideoView::EAdjustVolume == editorState)
+            {           
+            TKeyResponse ret = HandleScrollBarL(aKeyEvent, aType);
+            DrawDeferred();
+            return ret;
+            }
+        }
+
+    if ( iSeeking )
+        {       
+        DoUpdatePosition();
+        }
+
+    if ( aType == EEventKeyDown ) 
+        {
+
+        if ( iView.EditorState() == CVeiEditVideoView::EPreview )//large preview
+            {
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::OfferKeyEventL preview back");
+            iVideoDisplay->Stop( ETrue );
+            iBackKeyPressed = ETrue;
+            SetBlackScreen( EFalse );
+            }
+
+        iKeyRepeatCount = 0;
+
+        // Shift key check. move clip - state
+        TBool shiftKeyPressed = (aKeyEvent.iModifiers & EModifierShift );
+        if( shiftKeyPressed )
+            {
+            if ( (iView.EditorState() == CVeiEditVideoView::EPreview ) &&
+                (iPreviewState == EStatePlaying ))//large preview
+                {
+                iVideoDisplay->Stop( ETrue );
+
+                iView.SetFullScreenSelected( EFalse );
+                SetBlackScreen( EFalse );
+                return EKeyWasConsumed;
+                }           
+            else if  (((((iCursorLocation == ECursorOnClip) && (iMovie.VideoClipCount()>1) ) && (iView.EditorState() != CVeiEditVideoView::EQuickPreview))  ||
+                 ( (iCursorLocation == ECursorOnAudio) && (iMovie.AudioClipCount()>0) ) ) &&
+                 iSelectionMode == EModeNavigation )
+                {
+                iView.ProcessCommandL( EVeiCmdEditVideoViewEditVideoMove );
+                return EKeyWasConsumed;
+                }
+            else if (iView.EditorState() == CVeiEditVideoView::EQuickPreview)
+                {
+                if( iView.IsEnoughFreeSpaceToSaveL() && !iTakeSnapshot )
+                    {
+                    /*if (EStatePlaying == iPreviewState)   
+                        {
+                        PauseVideoL();                      
+                        }                   
+                        */
+                    TakeSnapshotL();
+                    return EKeyWasConsumed;
+                    }
+                }
+            return EKeyWasNotConsumed;
+            }
+        //Check that it's a seeking key and we're in a suitable state. 
+        if ( iPreviewState != EStatePlaying ) 
+            {
+            return EKeyWasNotConsumed;
+            }
+
+        iSeekPos = iVideoDisplay->PositionL();
+
+        return EKeyWasConsumed;
+        }  
+    else if ( aType == EEventKeyUp ) 
+        {
+        iBackKeyPressed = EFalse;
+
+        if ( (iView.EditorState() == CVeiEditVideoView::EPreview ) &&
+            (iPreviewState == EStatePaused ))//large preview
+            {
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::OfferKeyEventL preview back"); 
+            iVideoDisplay->Stop( ETrue );
+            iBackKeyPressed = ETrue;
+            SetBlackScreen( EFalse );
+            }
+
+             
+        if ( iSeeking == EFalse )
+            {
+            return EKeyWasNotConsumed;
+            }
+        iLastPosition = iSeekPos;
+
+        iSeeking = EFalse;
+
+        if ( (iPreviewState == EStatePaused || iPreviewState == EStateStopped) && 
+             (iLastKeyCode == EKeyLeftArrow || iLastKeyCode == EKeyRightArrow) )
+            {
+            GetThumbAtL( iSeekPos );            
+            return EKeyWasConsumed;
+            }
+        else if ( iPreviewState == EStatePlaying )
+            {
+            if ( iTempVideoInfo && (iSeekPos >= iTempVideoInfo->Duration().Int64()) )
+                {
+                iVideoDisplay->Stop( EFalse );
+                }
+            else
+                {
+                iVideoDisplay->SetPositionL( iSeekPos );
+                iVideoDisplay->ShowBlackScreen();
+                DrawDeferred();
+                if ( iTempVideoInfo && !iFrameReady)
+                    {                               
+                    iTempVideoInfo->CancelFrame();
+                    }                                                                       
+                iVideoDisplay->Play();              
+                }
+            return EKeyWasConsumed;
+            }
+        else
+            {
+            return EKeyWasConsumed;
+            }
+        }    
+    else if ( aType == EEventKey )
+        {
+        iLastKeyCode = aKeyEvent.iCode;
+        iKeyRepeatCount++;  
+
+        if( iBackKeyPressed )
+            {
+            iView.SetFullScreenSelected( EFalse );
+            }
+
+        if ( iView.EditorState() == CVeiEditVideoView::EPreview )//large preview
+            {
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::OfferKeyEventL preview back");
+            iVideoDisplay->Stop( ETrue );
+            iBackKeyPressed = ETrue;
+            SetBlackScreen( EFalse );   
+            }
+       
+        switch ( aKeyEvent.iCode )
+            {               
+            case EKeyOK:
+                {
+                if ( iBackKeyPressed  )
+                    {
+                    return EKeyWasNotConsumed;
+                    }
+                 if ( iView.EditorState() == CVeiEditVideoView::EPreview )
+                     {
+                     iView.HandleCommandL( EAknSoftkeyBack );
+                     return EKeyWasConsumed;
+                     }
+
+                if ( ( iCursorLocation == ECursorOnClip && iMovie.VideoClipCount() == 0 ) ||
+                        ( iCursorLocation == ECursorOnEmptyVideoTrack ) ) 
+                    {
+                    iView.Popup()->ShowInsertStuffPopupList();
+                    }
+                else if ( ( iSelectionMode == EModeRecordingSetStart ) ||
+                          ( iSelectionMode == EModeRecording ) ||
+                          ( iSelectionMode == EModeRecordingPaused ) )
+                    {
+                    return EKeyWasConsumed;
+                    }
+                else if ( ( iCursorLocation == ECursorOnAudio && iMovie.AudioClipCount() == 0 ) ||
+                        ( iCursorLocation == ECursorOnEmptyAudioTrack  ) ) 
+                    {
+                    iView.Popup()->ShowInsertAudioPopupList();
+                    }
+                else if ( ( iCursorLocation == ECursorOnClip || iCursorLocation == ECursorOnAudio )
+                    && ( iSelectionMode == EModeMove ) )
+                    {
+                    iView.HandleCommandL( EAknSoftkeyOk );
+                    }
+
+                else if (iCursorLocation == ECursorOnClip && iSelectionMode == EModeDuration)
+                    {
+                    iView.HandleCommandL( EAknSoftkeyOk );  
+                    }
+                else if( iSelectionMode == EModeSlowMotion && iCursorLocation == ECursorOnClip )
+                    {
+                    SetSelectionMode( CVeiEditVideoContainer::EModeSlowMotion ); 
+                    iView.HandleCommandL( EAknSoftkeyOk );
+                    iInfoDisplay->SetSlowMotionOn( EFalse );
+                    iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration );
+
+                    ArrowsControl();
+                    }
+                else if ( iSelectionMode == EModeDuration && iCursorLocation == ECursorOnAudio )
+                    {
+                    iView.HandleCommandL( EAknSoftkeyOk );
+                    }
+
+                else
+                    {
+                    if (EStateGettingFrame != iPreviewState && EStateBuffering != iPreviewState &&
+                        EStateTerminating != iPreviewState && EStateOpening != iPreviewState)
+                        {
+                        iView.ProcessCommandL( EVeiCmdEditVideoViewContainerShowMenu );     
+                        }               
+                    }
+                    
+                return EKeyWasConsumed;
+                }// case EKeyOk
+            
+            case EKeyRightArrow:
+                {
+                if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview )
+                    {
+                    if ( (iKeyRepeatCount > 2)  && (iSeeking == EFalse) )
+                        {
+                        if ( iPreviewState == EStatePlaying )
+                            {
+                            iLastPosition = iVideoDisplay->PositionL();
+                            iSeekPos = iVideoDisplay->PositionL();
+                            }
+
+                        iVideoDisplay->PauseL();
+                        if (iPeriodic)
+                            {                           
+                            iPeriodic->Cancel();                                
+                            }
+                        iSeeking = ETrue;
+                        iKeyRepeatCount = 0;                
+                        }
+
+                    if ( iSeeking &&( iPreviewState == EStateStopped ) ||
+                                    ( iPreviewState == EStatePlaying ) || 
+                                    ( iPreviewState == EStatePaused ) )
+                        {
+                        TInt adjustment = TimeIncrement( iKeyRepeatCount );
+
+                        TInt64 newPos = iSeekPos.Int64() + adjustment;
+
+                        if ( iTempVideoInfo && (newPos > iTempVideoInfo->Duration().Int64()) )
+                            {
+                            newPos = iTempVideoInfo->Duration().Int64();
+                            }
+
+                        iSeekPos = TTimeIntervalMicroSeconds( newPos );
+
+                        iView.DoUpdateEditNaviLabelL();
+                        return EKeyWasConsumed;
+                        }
+                    }
+
+                if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed )
+                    {
+                    return EKeyWasNotConsumed;
+                    }
+                if ( iCursorLocation == ECursorOnClip )
+                    {
+                    //SM - RIGHT = MORE
+                    if((iSelectionMode == EModeSlowMotion) && (iCursorLocation == ECursorOnClip))
+                        {
+                        if( iSlowMotionValue < 1000)
+                            {
+                            iVideoDisplay->SetFrameIntervalL( -25 );
+                            iSlowMotionValue = iSlowMotionValue + 50;
+                            iMovie.VideoClipSetSpeed( CurrentIndex(), iSlowMotionValue );
+                            iArrowsDisplay->SetSlowMotionPreset( iSlowMotionValue / 10);
+                            ArrowsControl();            
+                            }
+                        return EKeyWasConsumed;
+                        }
+
+                    if ( iSelectionMode == EModeNavigation )
+                        {
+                        if ( iMovie.VideoClipCount() > 0 ) 
+                            {
+                            ++iVideoCursorPos;
+                            SetCursorLocation( ECursorOnTransition );
+                            }
+                        }
+                    else
+                        {
+                        if ( ( iSelectionMode == EModeMove ) && ( iVideoCursorPos  < iMovie.VideoClipCount() - 1 ) ) 
+                            {
+                            TInt oldplace = iVideoCursorPos;
+                            ++iVideoCursorPos;
+                            iMovie.VideoClipSetIndex( oldplace, iVideoCursorPos );
+                            }
+                        }
+
+                    if (iSelectionMode == EModeDuration) 
+                        {
+                        CVedVideoClipInfo* info = iMovie.VideoClipInfo( iVideoCursorPos );
+
+                        TInt64 newDurationInt = iMovie.VideoClipEditedDuration( iVideoCursorPos ).Int64() + TimeIncrement(iKeyRepeatCount);
+
+                        if (info->Class() == EVedVideoClipClassGenerated) 
+                            {
+                            if (info->Generator()->Uid() == KUidTitleClipGenerator) 
+                                {
+                                CVeiTitleClipGenerator* generator = STATIC_CAST(CVeiTitleClipGenerator*, info->Generator());
+                                generator->SetDuration(TTimeIntervalMicroSeconds(newDurationInt));
+                                }
+                            else if (info->Generator()->Uid() == KUidImageClipGenerator) 
+                                {
+                                CVeiImageClipGenerator* generator = STATIC_CAST(CVeiImageClipGenerator*, info->Generator());
+                                generator->SetDuration(TTimeIntervalMicroSeconds(newDurationInt));
+                                }
+                            }
+                        }
+
+                    } // if ( iCursorLocation == ECursorOnClip )
+                    
+                else if ( iCursorLocation == ECursorOnTransition )
+                    {
+                    if ( iVideoCursorPos < iMovie.VideoClipCount() )
+                        {   
+                        SetCursorLocation( ECursorOnClip );
+                        }
+                    else
+                        {
+                        SetCursorLocation( ECursorOnEmptyVideoTrack );  
+                        }
+                    }
+                else if ( iCursorLocation == ECursorOnAudio )
+                    {
+                    if ( iSelectionMode == EModeNavigation )
+                        {
+                        if ( iAudioCursorPos < iMovie.AudioClipCount() - 1 ) 
+                            {
+                            ++iAudioCursorPos;
+                            SetCursorLocation( ECursorOnAudio );
+                            }
+                        else
+                            {
+                            SetCursorLocation( ECursorOnEmptyAudioTrack );  
+                            }
+                        }
+                    else if ( iSelectionMode == EModeMove ) 
+                        {
+                        return MoveAudioRight();
+                        }
+                    else if (iSelectionMode == EModeDuration) 
+                        {
+
+                        TTimeIntervalMicroSeconds clipCutOutTime = iMovie.AudioClipCutOutTime( iAudioCursorPos );   
+
+                        TInt64 newEndTimeInt = clipCutOutTime.Int64() + TimeIncrement(iKeyRepeatCount);
+
+                        if (iAudioCursorPos < (iMovie.AudioClipCount() - 1))
+                            {
+                            TInt64 nextStartTimeInt = iMovie.AudioClipStartTime( iAudioCursorPos + 1 ).Int64();
+                            TInt64 currentEndTimeInt = iMovie.AudioClipEndTime( iAudioCursorPos ).Int64() + TimeIncrement(iKeyRepeatCount);
+
+                            if ( currentEndTimeInt > nextStartTimeInt)
+                                {
+                                newEndTimeInt = nextStartTimeInt - iMovie.AudioClipStartTime( iAudioCursorPos ).Int64();
+                                }
+                            }
+                        CVedAudioClipInfo* audioclipinfo = iMovie.AudioClipInfo( iAudioCursorPos );
+                        if (newEndTimeInt > audioclipinfo->Duration().Int64() )                 
+                            {
+                            newEndTimeInt = audioclipinfo->Duration().Int64();
+                            }
+                        iMovie.AudioClipSetCutOutTime( iAudioCursorPos, TTimeIntervalMicroSeconds( newEndTimeInt ) );                                           
+                        }
+                    } // else if ( iCursorLocation == ECursorOnAudio )
+                    DrawDeferred();
+
+                    return EKeyWasConsumed;
+                } // case EKeyRightArrow
+            case EKeyLeftArrow:
+                {
+                if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview )
+                    {
+                    iKeyRepeatCount++;
+
+                    if ( (iKeyRepeatCount > 2)  && (iSeeking == EFalse) )
+                        {
+                    
+                        if ( iPreviewState == EStatePlaying )
+                            {
+                            iLastPosition = iVideoDisplay->PositionL();
+                            iSeekPos = iVideoDisplay->PositionL();
+                            }                                                   
+                        
+                        iVideoDisplay->PauseL();
+                        if (iPeriodic)
+                            {                           
+                            iPeriodic->Cancel();                            
+                            }
+                        iSeeking = ETrue;
+                                                
+                        iKeyRepeatCount = 0;                
+                        }
+
+                    if ( iSeeking&&( iPreviewState == EStateStopped ) ||
+                        ( iPreviewState == EStatePlaying ) || 
+                        ( iPreviewState == EStatePaused ) )
+                        {
+                        TInt adjustment = TimeIncrement( iKeyRepeatCount );
+
+                        TInt64 newPos = iSeekPos.Int64() - adjustment;
+                        if ( newPos < 0 ) 
+                            {
+                            newPos = 0;
+                            }
+                        iSeekPos = TTimeIntervalMicroSeconds( newPos ); 
+                        
+                        iView.DoUpdateEditNaviLabelL();
+                        return EKeyWasConsumed;
+                        }
+                    }
+                 
+                if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed  )
+                    {
+                    return EKeyWasNotConsumed;
+                    }               
+                if ( iCursorLocation == ECursorOnClip )
+                    {
+                    // SM - LEFT = LESS
+                    if(( iSelectionMode == EModeSlowMotion) && (iCursorLocation == ECursorOnClip))
+                        {   
+                        
+                        if( iSlowMotionValue > 250)
+                            {
+                            iVideoDisplay->SetFrameIntervalL( 25 );
+                            iSlowMotionValue = iSlowMotionValue - 50; 
+                            iMovie.VideoClipSetSpeed( CurrentIndex(), iSlowMotionValue );
+                            iArrowsDisplay->SetSlowMotionPreset( iSlowMotionValue / 10);
+                            ArrowsControl();
+                            }
+                        return EKeyWasConsumed;
+                        }
+                    
+
+                    if ( iSelectionMode == EModeNavigation )
+                        {
+                        if ( iMovie.VideoClipCount() > 0 ) 
+                            {
+                            SetCursorLocation( ECursorOnTransition );
+                            }
+                        }
+                    else
+                        {
+                        if ( ( iSelectionMode == EModeMove ) && ( iVideoCursorPos > 0 ) ) 
+                            {
+                            TInt oldplace = iVideoCursorPos;
+                            iVideoCursorPos--;
+                            iMovie.VideoClipSetIndex( oldplace, iVideoCursorPos );
+                            }
+                        }
+
+                    if (iSelectionMode == EModeDuration) 
+                        {
+                        TInt64 newDurationInt = iMovie.VideoClipEditedDuration(iVideoCursorPos).Int64() - TimeIncrement(iKeyRepeatCount);
+
+                        if (newDurationInt < 1000000)
+                            {
+                            newDurationInt = 1000000;
+                            }
+
+                        CVedVideoClipInfo* info = iMovie.VideoClipInfo(iVideoCursorPos);
+                        if (info->Class() == EVedVideoClipClassGenerated) 
+                            {
+                            if (info->Generator()->Uid() == KUidTitleClipGenerator) 
+                                {
+                                CVeiTitleClipGenerator* generator = STATIC_CAST(CVeiTitleClipGenerator*, info->Generator());
+                                generator->SetDuration(TTimeIntervalMicroSeconds(newDurationInt));
+                                }
+                            else if (info->Generator()->Uid() == KUidImageClipGenerator) 
+                                {
+                                CVeiImageClipGenerator* generator = STATIC_CAST(CVeiImageClipGenerator*, info->Generator());
+                                generator->SetDuration(TTimeIntervalMicroSeconds(newDurationInt));
+                                }
+                            }
+                        }
+
+                    }
+                else if ( iCursorLocation == ECursorOnTransition )
+                    {
+                    if ( iVideoCursorPos > 0 )
+                        {   
+                        --iVideoCursorPos;
+                        SetCursorLocation( ECursorOnClip );
+                        }
+                    }
+                else if ( iCursorLocation == ECursorOnAudio )
+                    {
+                    if ( iSelectionMode == EModeNavigation )
+                        {
+                        if ( iAudioCursorPos > 0 ) 
+                            {
+                            iAudioCursorPos--;
+                            SetCursorLocation( ECursorOnAudio );
+                            }
+                        }
+                    else if (iSelectionMode == EModeMove) 
+                        {
+                        return MoveAudioLeft();
+                        }
+                    else if (iSelectionMode == EModeDuration) 
+                        {
+
+                        TInt64 newDurationInt = iMovie.AudioClipCutOutTime( iAudioCursorPos ).Int64() - TimeIncrement(iKeyRepeatCount);                     
+                        if (newDurationInt < 1000000)
+                            {
+                            newDurationInt = 1000000;
+                            }
+                        TInt64 newEndTimeInt = iMovie.AudioClipStartTime( iAudioCursorPos ).Int64() + newDurationInt;
+                        for (TInt i = iMovie.VideoClipCount() - 1; i >= 0; i--)
+                            {
+                            if ( ( iMovie.AudioClipEndTime( iAudioCursorPos ) > iMovie.VideoClipEndTime( i ) ) &&
+                                TTimeIntervalMicroSeconds(newEndTimeInt) < iMovie.VideoClipEndTime( i ) )
+                                {
+                                newDurationInt = iMovie.VideoClipEndTime( i ).Int64() - iMovie.AudioClipStartTime( iAudioCursorPos ).Int64();
+                                break;
+                                }
+                            }
+                        if ( newDurationInt < ( iMovie.AudioClipCutInTime( iAudioCursorPos ).Int64() ) )
+                            {
+                            newDurationInt = iMovie.AudioClipCutInTime( iAudioCursorPos ).Int64();
+                            }
+                        iMovie.AudioClipSetCutOutTime( iAudioCursorPos, TTimeIntervalMicroSeconds( newDurationInt ) );              
+                        }
+                    }
+
+                else if ( iCursorLocation == ECursorOnEmptyVideoTrack )
+                    {
+                    if ( iMovie.VideoClipCount() > 0 )
+                        {
+                        SetCursorLocation( ECursorOnTransition );
+                        }
+                    }
+                else if ( iCursorLocation == ECursorOnEmptyAudioTrack )
+                    {
+                    if ( iMovie.AudioClipCount() > 0 )
+                        {
+                        SetCursorLocation( ECursorOnAudio );
+                        }
+                    }
+
+                DrawDeferred();
+                return EKeyWasConsumed;
+                } // EKeyLeftArrow
+            
+            case EKeyUpArrow:
+            case EStdKeyIncVolume:
+                {           
+                if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed )
+                    {
+                    if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview )
+                        {
+                        iVideoDisplay->OfferKeyEventL( aKeyEvent, aType );
+                        return EKeyWasConsumed;
+                        }
+                    return EKeyWasNotConsumed;
+                    }
+                if ( ((iCursorLocation==ECursorOnAudio) || (iCursorLocation==ECursorOnEmptyAudioTrack) )
+                        && (iSelectionMode == EModeNavigation ) ) 
+                    {
+                    SetCursorLocation( iPrevCursorLocation );
+                    DrawDeferred();
+                    return EKeyWasConsumed;
+                    }
+                else if ( iCursorLocation == ECursorOnTransition ) 
+                    {
+                    iView.HandleCommandL( EVeiCmdEditVideoViewTransitionKeyUp );
+                    return EKeyWasConsumed;
+                    }
+                else
+                    {
+                    return EKeyWasNotConsumed;
+                    }
+                }
+            case EKeyDownArrow:
+            case EStdKeyDecVolume:
+                {
+                if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed )
+                    {
+                    if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview )
+                        {
+                        iVideoDisplay->OfferKeyEventL( aKeyEvent, aType );
+                        return EKeyWasConsumed;
+                        }
+                    return EKeyWasNotConsumed;
+                    }
+                if ( iCursorLocation == ECursorOnTransition ) 
+                    {
+                    iView.HandleCommandL( EVeiCmdEditVideoViewTransitionKeyDown );
+                    return EKeyWasConsumed;
+                    }
+                else if ( (iCursorLocation != ECursorOnAudio )&& (iSelectionMode == EModeNavigation) &&
+                        (iCursorLocation != ECursorOnEmptyAudioTrack ) ) 
+                    {
+                    iPrevCursorLocation = iCursorLocation;
+                    SetCursorLocation( ECursorOnAudio );
+                    DrawDeferred();
+                    return EKeyWasConsumed;
+                    }
+                else
+                    {
+                    return EKeyWasNotConsumed;
+                    }
+                }
+            case EKeyBackspace:     //Clear 0x08
+                {
+                if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed )
+                    {
+                    return EKeyWasNotConsumed;
+                    }
+                if ( ( ( iCursorLocation == ECursorOnClip ) || ( iCursorLocation == ECursorOnAudio ) )
+                    && ( ( iMovie.VideoClipCount() > 0 ) || ( iMovie.AudioClipCount() > 0 ) ) && ( iSelectionMode == EModeNavigation ) )
+                    {
+                    iView.ProcessCommandL( EVeiCmdEditVideoViewEditVideoRemove );
+                    return EKeyWasConsumed;
+                    }
+                else if ((iCursorLocation == ECursorOnTransition) && (iSelectionMode == EModeNavigation))
+                    {
+                    iView.ProcessCommandL( EVeiCmdEditVideoViewTransitionNone );
+                    }
+                else if ( ( iSelectionMode == EModeSlowMotion ))
+                    {
+                    return EKeyWasNotConsumed;
+                    }
+                return EKeyWasNotConsumed;
+                }
+            case EKeyYes:       //Send 63586
+                {
+                if ( iView.EditorState() != CVeiEditVideoView::EEdit || iBackKeyPressed  )
+                    {
+                    return EKeyWasNotConsumed;
+                    }
+                if ( iSelectionMode == EModeNavigation )
+                    {
+                    iView.SetSendKey( ETrue );
+                    iView.ProcessCommandL( EVeiCmdSendMovie );  
+                    return EKeyWasConsumed;
+                    }
+                break;
+                }
+            default:
+                {
+                return EKeyWasNotConsumed;
+                }
+            }
+        }
+    return EKeyWasNotConsumed;
+    }
+
+
+TKeyResponse CVeiEditVideoContainer::MoveAudioLeft()
+    {
+    TInt i;
+
+    TInt index = iAudioCursorPos;
+
+    if ( iAudioCursorPos > 0 )
+        {
+        TTimeIntervalMicroSeconds startTime = iMovie.AudioClipStartTime( iAudioCursorPos ); //second
+        TTimeIntervalMicroSeconds prevEndTime = iMovie.AudioClipEndTime( iAudioCursorPos-1 ); //first
+                    
+        if ( startTime == prevEndTime )
+            {
+            TInt newIndex = iAudioCursorPos - 1;
+            while ( newIndex > 0 )
+                {
+                TTimeIntervalMicroSeconds newNextStartTime = iMovie.AudioClipStartTime( newIndex ); //first
+                TTimeIntervalMicroSeconds newPrevEndTime = iMovie.AudioClipEndTime( newIndex - 1);
+
+                if ( newPrevEndTime == newNextStartTime )
+                    {
+                    newIndex--;
+                    }
+                else
+                    {
+                    break;
+                    }
+                }
+            if ( ( newIndex == 0 ) && ( iMovie.AudioClipStartTime( 0 ) == TTimeIntervalMicroSeconds(0) ) )
+                {
+                return EKeyWasConsumed;
+                }
+
+            TInt64 newEndTimeInt = iMovie.AudioClipStartTime( newIndex ).Int64();   //first
+
+            TInt64 newStartTimeInt = newEndTimeInt - iView.OriginalAudioDuration().Int64();
+
+            TInt64 newCutOutTimeInt = (newEndTimeInt - newStartTimeInt) + iMovie.AudioClipCutInTime( index ).Int64();
+
+            if (newStartTimeInt < 0)
+                {
+                newStartTimeInt = 0;
+                }
+
+            if ( newIndex > 0 )
+                {
+                TInt64 newPrevEndTimeInt = iMovie.AudioClipEndTime( newIndex - 1 ).Int64();
+                if ( newStartTimeInt < newPrevEndTimeInt )
+                    {
+                    newStartTimeInt = newPrevEndTimeInt;
+                    }
+                }
+
+            if ( (newCutOutTimeInt+newStartTimeInt) > iMovie.AudioClipStartTime( index - 1 ).Int64() )
+                {
+                TInt64 audioStartTime = iMovie.AudioClipStartTime( index - 1 ).Int64();
+                newCutOutTimeInt = (audioStartTime - newStartTimeInt) + iMovie.AudioClipCutInTime( index ).Int64();
+                }
+
+            iMovie.AudioClipSetStartTime( index,TTimeIntervalMicroSeconds( newStartTimeInt ) );
+            iMovie.AudioClipSetCutOutTime( newIndex, TTimeIntervalMicroSeconds( newCutOutTimeInt ) );
+
+            iAudioCursorPos = newIndex;
+
+            DrawDeferred();
+
+            return EKeyWasConsumed;
+            }
+        }
+
+    TTimeIntervalMicroSeconds audioclipstart =  iMovie.AudioClipStartTime( index );
+    TTimeIntervalMicroSeconds audioclipend =    iMovie.AudioClipEndTime( index );
+    TInt64 audioclipeditedduration =            iMovie.AudioClipEditedDuration( index ).Int64();
+
+    TInt64 newStartTimeInt = audioclipstart.Int64() - TimeIncrement( iKeyRepeatCount );
+
+    if ( newStartTimeInt < 0 )
+        {
+        newStartTimeInt = 0;
+        }
+
+    for ( i = iMovie.VideoClipCount() - 1; i >= 0; i-- )
+        {
+        TTimeIntervalMicroSeconds endtime = iMovie.VideoClipEndTime( i );
+
+        if ( ( audioclipstart > endtime ) && TTimeIntervalMicroSeconds(newStartTimeInt) < endtime )
+            {
+            newStartTimeInt = endtime.Int64();
+            break;
+            }
+        }
+
+    TInt64 newEndTimeInt = newStartTimeInt + audioclipeditedduration;
+
+    for (i = iMovie.VideoClipCount() - 1; i >= 0; i-- )
+        {
+        if ((audioclipend > iMovie.VideoClipEndTime(i)) && TTimeIntervalMicroSeconds(newEndTimeInt) < iMovie.VideoClipEndTime(i))
+            {
+            newStartTimeInt = iMovie.VideoClipEndTime(i).Int64() - audioclipeditedduration;
+            break;
+            }
+        }
+
+    if (iAudioCursorPos > 0)
+        {
+        TInt64 prevEndTimeInt = iMovie.AudioClipEndTime( iAudioCursorPos - 1 ).Int64();
+                        
+        if (newStartTimeInt < prevEndTimeInt)
+            {
+            newStartTimeInt = prevEndTimeInt;
+            }
+        }
+    iMovie.AudioClipSetStartTime( index, TTimeIntervalMicroSeconds(newStartTimeInt) );
+    iAudioCursorPos = index;
+    return EKeyWasConsumed;
+    }
+
+
+TKeyResponse CVeiEditVideoContainer::MoveAudioRight()
+    {
+    TInt i;
+    TInt index = iAudioCursorPos;
+
+    if ( iAudioCursorPos < ( iMovie.AudioClipCount() - 1 ) )
+        {
+        TTimeIntervalMicroSeconds endTime = iMovie.AudioClipEndTime( iAudioCursorPos );
+        TTimeIntervalMicroSeconds nextStartTime = iMovie.AudioClipStartTime( iAudioCursorPos+1 );
+
+        if (endTime == nextStartTime)
+            {
+            TInt newIndex = iAudioCursorPos + 1;
+            while ( newIndex < ( iMovie.AudioClipCount() - 1 ) )
+                {
+                TTimeIntervalMicroSeconds newPrevEndTime = iMovie.AudioClipEndTime( newIndex );
+                TTimeIntervalMicroSeconds newNextStartTime = iMovie.AudioClipStartTime( newIndex+1 );
+
+                if (newPrevEndTime == newNextStartTime)
+                    {
+                    newIndex++;
+                    }
+                else
+                    {
+                    break;
+                    }
+                }
+
+            TInt64 newStartTimeInt = iMovie.AudioClipEndTime( newIndex ).Int64();
+            TInt64 newEndTimeInt = newStartTimeInt + iView.OriginalAudioDuration().Int64();
+
+            TInt64 newCutOutTimeInt = (newEndTimeInt - newStartTimeInt) + iMovie.AudioClipCutInTime( index ).Int64();
+
+            if ( newIndex < ( iMovie.AudioClipCount()-1 ) )
+                {
+                TInt64 newNextStartTimeInt = iMovie.AudioClipStartTime(newIndex + 1).Int64();
+                if ( newEndTimeInt > newNextStartTimeInt )
+                    {
+                    newEndTimeInt = newNextStartTimeInt;
+                    }
+
+                if ( (newCutOutTimeInt+newStartTimeInt) > iMovie.AudioClipStartTime( newIndex + 1 ).Int64() )
+                    {
+                    TInt64 audioStartTime = iMovie.AudioClipStartTime( newIndex + 1 ).Int64();
+                    newCutOutTimeInt = audioStartTime - newStartTimeInt;
+                    }
+                }
+
+            iMovie.AudioClipSetStartTime( index,TTimeIntervalMicroSeconds( newStartTimeInt ) );
+            iMovie.AudioClipSetCutOutTime( newIndex, TTimeIntervalMicroSeconds( newCutOutTimeInt ) );
+
+            iAudioCursorPos = newIndex;
+
+            DrawDeferred();
+
+            return EKeyWasConsumed;
+            }
+        }
+
+    TInt64 newStartTimeInt = iMovie.AudioClipStartTime( iAudioCursorPos ).Int64() + TimeIncrement( iKeyRepeatCount );
+                    
+    for ( i = 0; i < iMovie.VideoClipCount(); i++ )
+        {
+        TTimeIntervalMicroSeconds endtime = iMovie.VideoClipEndTime( i );
+        TTimeIntervalMicroSeconds audioclipstart =  iMovie.AudioClipStartTime( index );
+
+        if ( ( audioclipstart < endtime ) && TTimeIntervalMicroSeconds(newStartTimeInt) > endtime )
+            {
+            newStartTimeInt = endtime.Int64();
+            break;
+            }
+        }
+
+    TInt64 audioclipeditedduration = iMovie.AudioClipEditedDuration( index ).Int64();
+
+    TInt64 newEndTimeInt = newStartTimeInt + audioclipeditedduration;
+    TTimeIntervalMicroSeconds audioclipend = iMovie.AudioClipEndTime( index );
+
+    for (i = 0; i < iMovie.VideoClipCount(); i++)
+        {
+        if ( ( audioclipend < iMovie.VideoClipEndTime(i)) && 
+            TTimeIntervalMicroSeconds( newEndTimeInt ) > iMovie.VideoClipEndTime( i ) )
+            {
+            newStartTimeInt = iMovie.VideoClipEndTime(i).Int64() - audioclipeditedduration;
+            break;
+            }
+        }
+
+    if (iAudioCursorPos < (iMovie.AudioClipCount() - 1))
+        {
+        newEndTimeInt = newStartTimeInt + audioclipeditedduration;
+        TInt64 nextStartTimeInt = iMovie.AudioClipStartTime( iAudioCursorPos + 1 ).Int64();
+                        
+        if (newEndTimeInt > nextStartTimeInt)
+            {
+            newStartTimeInt -= (newEndTimeInt - nextStartTimeInt);
+            }
+        }
+    iMovie.AudioClipSetStartTime( index, TTimeIntervalMicroSeconds(newStartTimeInt) );
+    iAudioCursorPos = index;
+    return EKeyWasConsumed;
+    }
+
+
+TInt CVeiEditVideoContainer::TimeIncrement(TInt aKeyCount) const
+    {
+    if ( aKeyCount < 3 )
+        {
+        return 100000;
+        }
+    else if ( aKeyCount < 4 )
+        {
+        return 300000;
+        }
+    else if ( aKeyCount < 5 )
+        {
+        return 500000;
+        }
+    else if ( aKeyCount < 19 )
+        {
+        return 1000000;
+        }
+    else
+        {
+        return 5000000;
+        }   
+    }
+
+
+TTimeIntervalMicroSeconds CVeiEditVideoContainer::TotalLength()
+    {
+    TTimeIntervalMicroSeconds duration = TTimeIntervalMicroSeconds(0);
+
+    if ( iVideoDisplay )
+        {
+        duration = iVideoDisplay->TotalLengthL();
+        }
+
+    return duration;
+    }
+    
+// ---------------------------------------------------------
+// CVeiEditVideoContainer::CountComponentControls() const
+// ---------------------------------------------------------
+//
+TInt CVeiEditVideoContainer::CountComponentControls() const
+    {
+    if (EModeMixingAudio == iSelectionMode || EModeAdjustVolume == iSelectionMode)
+        {
+        return 9; // return nbr of controls inside this container   
+        }
+    else
+        {       
+        return 10; // return nbr of controls inside this container
+        }
+    }
+
+// ---------------------------------------------------------
+// CVeiEditVideoContainer::ComponentControl(TInt aIndex) const
+// ---------------------------------------------------------
+//
+CCoeControl* CVeiEditVideoContainer::ComponentControl( TInt aIndex ) const
+    {
+    switch ( aIndex )
+        {
+        case 0:
+            return iVideoDisplay;
+        case 1:
+            return iInfoDisplay;
+        case 2:
+            return iDummyCutBarLeft;
+        case 3:         
+            return iTransitionDisplayLeft;
+        case 4:
+            return iTransitionDisplayRight;
+        case 5:
+            return iEffectSymbols;
+        case 6:
+            return iArrowsDisplay;
+        case 7:         
+            return iVerticalSlider; 
+        case 8:
+            return iHorizontalSlider;
+        case 9:
+            // this one is not used in modes EModeMixingAudio and EModeAdjustVolume
+            if (EModeMixingAudio != iSelectionMode && EModeAdjustVolume != iSelectionMode)
+                {       
+                return iDummyCutBar;
+                }
+            else
+                {
+                return NULL;
+                }
+        default: 
+            return NULL;
+        }
+    }
+
+void CVeiEditVideoContainer::SaveSnapshotL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::SaveSnapshotL(): in");
+
+    //first we have to encode bitmap
+    // get encoder types 
+    RImageTypeDescriptionArray imageTypes; 
+    iConverter->GetEncoderImageTypesL( imageTypes );    
+
+    CleanupStack::PushL( TCleanupItem( CleanupRArray, &imageTypes ) );
+
+    TInt selectedIdx = 0;
+
+    _LIT( KEncoderType, "JPEG" ); // encoder type for image conversion
+
+    for( TInt i=0; i<imageTypes.Count(); i++ ) 
+        {
+        if ( imageTypes[i]->Description() == KEncoderType )
+            {
+            selectedIdx = i;
+            }
+        }
+
+    RFs&    fs = iEikonEnv->FsSession();
+
+    TParse file;
+    TFileName newname;
+    TFileName snapshotdir;
+
+    TVeiSettings saveSettings;
+    // Get default snapshot name from settings view
+
+    STATIC_CAST( CVeiAppUi*, iEikonEnv->AppUi() )->ReadSettingsL( saveSettings );   
+
+    CAknMemorySelectionDialog::TMemory memory( saveSettings.MemoryInUse() );
+
+    newname.Append( saveSettings.DefaultSnapshotName() );
+    newname.Append( _L(".JPEG") );
+    file.Set( newname, NULL, NULL );
+    
+    TInt error = KErrNone;
+
+    snapshotdir.Zero();
+
+    if ( memory == CAknMemorySelectionDialog::EPhoneMemory )
+        {
+        snapshotdir.Append( PathInfo::PhoneMemoryRootPath() ); 
+        }
+    else
+        {
+        snapshotdir.Append( PathInfo::MemoryCardRootPath() ); 
+        }
+    snapshotdir.Append( PathInfo::ImagesPath() );
+
+    error = fs.MkDirAll( file.Path() );
+    if ( ( error != KErrAlreadyExists ) && ( error != KErrNone ) )
+        {
+        return;
+        }
+
+    newname.Zero();
+    newname.Append( file.NameAndExt() );
+    newname.Insert( 0, snapshotdir );
+    CApaApplication::GenerateFileName( fs, newname );
+
+    //for cancellation
+    if ( iSaveToFileName )
+        {
+        delete iSaveToFileName;
+        iSaveToFileName = NULL;
+        }
+    iSaveToFileName = HBufC::NewL( newname.Length() );
+    *iSaveToFileName = newname;
+
+    // request the actuall save/encode
+    // asynchronous, the result is reported via callback NotifyCompletion
+    iConverter->StartToEncodeL( newname, 
+        imageTypes[selectedIdx]->ImageType(), imageTypes[selectedIdx]->SubType() );
+
+    /*
+    if (iProgressDialog)
+        {
+        delete iProgressDialog;
+        iProgressDialog = NULL; 
+        }
+   
+    iProgressDialog = 
+           new (ELeave) CAknProgressDialog(REINTERPRET_CAST(CEikDialog**, 
+          &iProgressDialog), ETrue);
+    iProgressDialog->SetCallback(this);
+    iProgressDialog->ExecuteDlgLD( R_VEI_PROGRESS_NOTE );
+
+
+    HBufC* stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_SAVING_IMAGE, iEikonEnv );      
+    iProgressDialog->SetTextL( *stringholder );
+    CleanupStack::PopAndDestroy( stringholder );
+
+    iProgressDialog->GetProgressInfoL()->SetFinalValue(100);
+    */
+    
+    CleanupStack::PopAndDestroy( &imageTypes ); 
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::SaveSnapshotL(): out");
+    }
+
+
+void CVeiEditVideoContainer::SetFinishedStatus( TBool aStatus )
+    {
+    iFinished = aStatus;
+    iCurrentPoint = 0;
+    DrawPlayHead();
+    }
+
+TInt CVeiEditVideoContainer::Update( TAny* aThis )
+    {
+    STATIC_CAST( CVeiEditVideoContainer*, aThis )->DoUpdate();
+    return 42;
+    }
+
+void CVeiEditVideoContainer::DoUpdate()
+    {
+    if (iView.EditorState() != CVeiEditVideoView::EQuickPreview )
+        {
+        iZoomFactorX++;
+        iZoomFactorY++;
+        if ( iZoomFactorX > KMaxZoomFactorX )
+            {
+            iZoomFactorX = KMaxZoomFactorX;
+            }
+        if ( iZoomFactorY > KMaxZoomFactorY )
+            {
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::DoUpdate: Zooming completed");
+            iZoomTimer->Cancel();
+            }
+        }
+    else
+        {
+        iZoomFactorX--;
+        iZoomFactorY--;
+        if ( iZoomFactorX < 0 )
+            {
+            iZoomFactorX = 0;
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::DoUpdate: Zooming completed");
+            iZoomTimer->Cancel();
+            }
+        if ( iZoomFactorY < 0 )
+            {
+            iZoomFactorY = 0;
+            }
+        }
+
+    if( iSelectionMode != EModePreview )
+        {
+        DrawTrackBoxes();
+        }
+    }
+
+TInt CVeiEditVideoContainer::UpdatePosition( TAny* aThis )
+    {   
+    STATIC_CAST( CVeiEditVideoContainer*, aThis )->DoUpdatePosition();          
+    return 42;
+    }   
+
+void CVeiEditVideoContainer::DoUpdatePosition()
+    {
+    
+    TUint time = static_cast<TInt32>(PlaybackPositionL().Int64() / 1000);
+    
+    //LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::DoUpdatePosition(): 1, time:%d", time);    
+
+/** Check if playhead needs to be drawn again*/
+    TInt64 barDuration = iMovie.Duration().Int64();
+
+    if (barDuration < 30000000)
+        {
+        barDuration = 30000000;
+        }
+    else if (barDuration < 45000000)
+        {
+        barDuration = 45000000;
+        }
+    else{
+        barDuration = ((barDuration / 30000000) + 1) * 30000000;
+        }
+
+    TInt barWidth = iVideoBarBox.Width();
+    
+    TInt videoClipCount = iMovie.VideoClipCount();
+    TInt audioClipCount = iMovie.AudioClipCount();  
+    TInt lastVideoClipX(0);
+    TTimeIntervalMicroSeconds endTime;
+
+    __ASSERT_ALWAYS( ((iMovie.VideoClipCount()>0) || (iMovie.AudioClipCount()>0)), 
+                    User::Panic( _L("VideoEditor" ), 34 ) );
+
+
+    if (( videoClipCount > 0 ) && ( audioClipCount > 0 ))
+        {
+        TTimeIntervalMicroSeconds videoClipEndTime = iMovie.VideoClipEndTime( videoClipCount-1 );
+        TTimeIntervalMicroSeconds audioClipEndTime = iMovie.AudioClipEndTime( audioClipCount-1 );
+        if ( videoClipEndTime > audioClipEndTime )
+            {
+            endTime = videoClipEndTime;
+            }
+        else
+            {
+            endTime = audioClipEndTime;
+            }
+        }
+    else if ( videoClipCount > 0 )
+        {
+        endTime = iMovie.VideoClipEndTime( videoClipCount-1 );
+        }
+    else
+        {
+        endTime = iMovie.AudioClipEndTime( audioClipCount-1 );
+        }
+
+    lastVideoClipX = iVideoBarBox.iTl.iX
+        + static_cast<TInt32>((((endTime.Int64() * barWidth)) / barDuration)) + 1;
+    
+    TInt width = lastVideoClipX - iVideoBarBox.iTl.iX;
+
+    TUint totalTime = static_cast<TInt32>(iMovie.Duration().Int64() /1000);
+    TInt nextPosition = time * width / totalTime + iVideoBarBox.iTl.iX;
+
+    if ( nextPosition != iCurrentPointX ) 
+        {
+        iCurrentPoint = time;
+        DrawPlayHead();
+        }
+    else
+        {
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::DoUpdatePosition 3, drawplayhead skipped");               
+        }
+    }
+
+void CVeiEditVideoContainer::PlayVideoFileL( const TDesC& aFilename, const TBool& aFullScreen )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideoFileL(): In");
+
+     if ( iTempFileName )
+        {
+        delete iTempFileName;
+        iTempFileName = NULL;
+        }
+
+    iTempFileName = HBufC::NewL(KMaxFileName);
+    *iTempFileName = aFilename;
+    
+    // Get default movie name from settings view
+
+    TFileName newname;
+    TVeiSettings movieSaveSettings;
+
+    STATIC_CAST( CVeiAppUi*, iEikonEnv->AppUi() )->ReadSettingsL( movieSaveSettings );  
+
+    newname.Append( movieSaveSettings.DefaultVideoName() );
+    iInfoDisplay->SetName( newname );
+
+    TTimeIntervalMicroSeconds movieDuration = iMovie.Duration();
+    iInfoDisplay->SetDuration( movieDuration );
+
+    if ( iTempVideoInfo ) 
+        {
+        delete iTempVideoInfo;
+        iTempVideoInfo = 0;     
+        }
+    iFullScreenSelected = aFullScreen;
+
+    if ( iCursorLocation == ECursorOnTransition )
+        {
+        iTransitionDisplayLeft->MakeVisible( EFalse );
+        iTransitionDisplayRight->MakeVisible( EFalse );
+        iArrowsDisplay->SetUpperArrowVisibility( EFalse );
+        iArrowsDisplay->SetLowerArrowVisibility( EFalse );
+        iDummyCutBar->SetRect( iDummyCutBarBox );
+        }
+    iInfoDisplay->MakeVisible( EFalse );
+    iDummyCutBar->MakeVisible( EFalse );
+    iDummyCutBarLeft->MakeVisible( EFalse );
+    iEffectSymbols->MakeVisible( EFalse );
+    iVideoDisplay->StopAnimation();
+    
+    SetPreviewState(EStateOpening);    
+
+    if ( !iScreenLight->IsActive() )
+        {
+        iScreenLight->Start();
+        }
+    
+    if ( iFullScreenSelected )
+        {        
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideoFileL: fullscreen selected");
+        iView.SetEditorState( CVeiEditVideoView::EPreview);    
+
+        SetBlackScreen( ETrue );        
+        iVideoDisplay->OpenFileL( aFilename );    
+        }
+    else
+        {
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideoFileL: fullscreen not selected");
+        iView.SetEditorState( CVeiEditVideoView::EQuickPreview);    
+        iVideoDisplay->SetRect( iVideoDisplayBox );
+        iVideoDisplay->ShowBlackScreen();
+        iInfoDisplay->SetRect( iInfoDisplayBox );
+
+        iDummyCutBar->MakeVisible( ETrue );
+        iDummyCutBar->Dim( ETrue );
+        iVideoDisplay->OpenFileL( aFilename );
+        }
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideoFileL(): Out");
+    }
+
+void CVeiEditVideoContainer::PlayVideo(const TDesC& /*aFilename*/, TBool& /*aFullScreen*/ )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideo In");
+    
+    if ( iVideoDisplay )
+        {
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideo(): 1");             
+
+        //  associated with, when put into background and back to foreground, play starts from different
+        // position it was paused (iSeekPos is not iLastPosition)
+        iVideoDisplay->SetPositionL( iSeekPos );
+                        
+        if ( iTempVideoInfo && !iFrameReady)
+            {           
+            iTempVideoInfo->CancelFrame();
+            }
+        iVideoDisplay->Play();      
+        }
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PlayVideo(): Out");   
+    }
+
+void CVeiEditVideoContainer::StopVideo( TBool aCloseStream )
+    { 
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::StopVideo: In, aCloseStream:%d", aCloseStream);
+    SetPreviewState(EStateStopped);    
+    if ( iPeriodic )
+        {
+        iPeriodic->Cancel();
+        }
+
+    iSeekPos = TTimeIntervalMicroSeconds( 0 );
+
+    iCloseStream = aCloseStream;
+
+    iVideoDisplay->Stop( aCloseStream ); 
+
+    iScreenLight->Stop();
+    if ( aCloseStream )
+        {
+        SetPreviewState(EStateClosed);        
+        }
+    else
+        {
+        SetFinishedStatus( ETrue );
+        }
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StopVideo: out");
+    }
+
+void CVeiEditVideoContainer::TakeSnapshotL()
+    {   
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::TakeSnapshotL: In, iFrameReady:%d", iFrameReady);
+
+    if( !iTempVideoInfo || !iFrameReady )
+        {
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::TakeSnapshotL: 1");
+        if (!iFrameReady)
+            {
+            iTakeSnapshotWaiting = ETrue;   
+            }   
+        return;
+        }
+        
+    iTakeSnapshotWaiting = EFalse;  
+    iTakeSnapshot = ETrue;
+    TTimeIntervalMicroSeconds pos = PlaybackPositionL();
+
+    TInt frameIndex;
+    TInt totalFrameCount;
+
+    frameIndex = iTempVideoInfo->GetVideoFrameIndexL( pos );
+    totalFrameCount = iTempVideoInfo->VideoFrameCount();
+
+    if ( frameIndex > totalFrameCount )
+        {
+        frameIndex = totalFrameCount;
+        }
+
+    TRect clipResolution = Rect();
+    TSize resol( clipResolution.iBr.iX, clipResolution.iBr.iY ); 
+    TDisplayMode displayMode = ENone;    
+    iFrameReady = EFalse;
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::TakeSnapshotL: 2");
+    //iTempVideoInfo->GetFrameL(*this, frameIndex, &resol, displayMode, ETrue);         
+
+    /* :
+     check out on every phone before releasing whether videodisplay should be stopped before starting
+     asynchronous GetFrameL()
+     see how EStateGettingFrame is handled in SetPreviewState 
+     Stopping frees memory and it is needed in memory sensible devices 
+    */
+    iTempVideoInfo->GetFrameL(*this, frameIndex, NULL, displayMode, ETrue);
+    SetPreviewState(EStateGettingFrame);
+
+    StartProgressDialogL(R_VEI_PROGRESS_NOTE_WITH_CANCEL, R_VEI_PROGRESS_NOTE_SAVING_IMAGE);
+
+    /*
+    if (iProgressDialog)
+        {
+        delete iProgressDialog;
+        iProgressDialog = NULL; 
+        }
+
+    iProgressDialog = 
+           new (ELeave) CAknProgressDialog(REINTERPRET_CAST(CEikDialog**, 
+          &iProgressDialog), ETrue);
+    iProgressDialog->SetCallback(this);
+    iProgressDialog->ExecuteDlgLD( R_VEI_PROGRESS_NOTE_WITH_CANCEL );
+
+
+    HBufC* stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_SAVING_IMAGE, iEikonEnv );      
+    iProgressDialog->SetTextL( *stringholder );
+    CleanupStack::PopAndDestroy( stringholder );
+
+    iProgressDialog->GetProgressInfoL()->SetFinalValue(100);
+    */
+    // this is good place to start Progress Note, but for some reason this causes some phones to crash
+    // that is why progress note is started now in NotifyVideoClipFrameCompleted
+    //StartProgressDialogL(R_VEI_PROGRESS_NOTE_WITH_CANCEL, R_VEI_PROGRESS_NOTE_SAVING_IMAGE);
+            
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::TakeSnapshotL: Out");
+    }
+
+void CVeiEditVideoContainer::PauseVideoL()
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::PauseVideoL: In, iPreviewState:%d", iPreviewState);        
+
+    // if-condition added in order to prevent entering to pause state (icon is showed) from "wrong" state
+    // etc. from "stopped" state
+    if (EStatePlaying == iPreviewState)
+        {                           
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PauseVideoL 1");          
+        iLastPosition = iVideoDisplay->PositionL();
+
+        // think whether this should be here?
+        iSeekPos = iVideoDisplay->PositionL();
+        iVideoDisplay->SetPositionL(iSeekPos);
+        }
+    iVideoDisplay->PauseL();
+    SetPreviewState(EStatePaused);
+    iScreenLight->Stop();
+    if ( iPeriodic )
+        {
+        iPeriodic->Cancel();
+        }
+    iView.StopNaviPaneUpdateL();
+            
+    #ifdef GET_PAUSE_THUMBNAIL
+    GetThumbAtL( iLastPosition );
+    #endif      
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PauseVideoL out");            
+    }
+
+TTimeIntervalMicroSeconds CVeiEditVideoContainer::PlaybackPositionL()
+    {
+    if ( ( iSeeking ) || ( EStateStopped == iPreviewState) )
+        {
+        return iSeekPos;
+        }
+    if ( EStatePlaying != iPreviewState )
+        {
+        return iLastPosition;
+        }
+        
+    iLastPosition = iVideoDisplay->PositionL();
+
+    // for what situation is this for?
+    if ( ( iLastPosition == TTimeIntervalMicroSeconds( 0 ) ) &&
+         ( iSeekPos != TTimeIntervalMicroSeconds( 0 ) ) )
+        {
+        return iSeekPos;
+        }
+    // for what situation is this for?
+    return iLastPosition;
+    }
+
+
+void CVeiEditVideoContainer::SetSelectionMode( TSelectionMode aSelectionMode )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::SetSelectionMode: In, aSelectionMode:%d", aSelectionMode);
+    iSelectionMode = aSelectionMode;
+
+    if (EModeMixingAudio == iSelectionMode)
+        {               
+        iHorizontalSlider->SetPosition(0);
+            
+        if (0 != iMovie.GetVideoClipVolumeGainL(KVedClipIndexAll))
+            {               
+            TReal gain = iMovie.GetVideoClipVolumeGainL(KVedClipIndexAll);///(KVolumeMaxGain/10);
+            gain = gain/(KVolumeMaxGain/10);
+            if (0 < gain)
+                {
+                gain += 0.5;
+                }
+            else
+                {
+                gain -= 0.5;
+                }                   
+            iHorizontalSlider->SetPosition( (TInt)(-gain) ); // see impl. of CSliderBar
+            }           
+                        
+        else if(0 != iMovie.GetAudioClipVolumeGainL(KVedClipIndexAll))
+            {           
+            TReal gain = iMovie.GetAudioClipVolumeGainL(KVedClipIndexAll);///(KVolumeMaxGain/10);
+            gain = gain/(KVolumeMaxGain/10);
+            if (0 < gain)
+                {
+                gain += 0.5;
+                }
+            else
+                {
+                gain -= 0.5;
+                }           
+            iHorizontalSlider->SetPosition( (TInt)gain );
+            }           
+                 
+        iHorizontalSlider->MakeVisible(ETrue);
+        iVerticalSlider->MakeVisible(EFalse);       
+        iVideoDisplay->ShowPictureL( *iAudioMixingIcon );
+        iInfoDisplay->MakeVisible(EFalse);
+
+
+        iVideoDisplay->StopAnimation();
+        if ( iCursorLocation == ECursorOnTransition )
+            {        
+            iTransitionDisplayLeft->MakeVisible( EFalse );
+            iTransitionDisplayRight->MakeVisible( EFalse );
+            iArrowsDisplay->SetUpperArrowVisibility( EFalse );
+            iArrowsDisplay->SetLowerArrowVisibility( EFalse );
+            iDummyCutBar->SetRect( iDummyCutBarBox );
+            }
+
+
+        }
+    else if (EModeAdjustVolume == iSelectionMode)
+        {       
+        
+        iVerticalSlider->SetPosition(0);
+        
+        if (VideoEditor::ECursorOnClip == CursorLocation())
+            {                                       
+            if (0 != iMovie.GetVideoClipVolumeGainL(CurrentIndex()))
+                {   
+                TReal adjustVolume = iMovie.GetVideoClipVolumeGainL(CurrentIndex());///(KVolumeMaxGain/10);
+                adjustVolume = adjustVolume/(KVolumeMaxGain/10);                                                
+                
+                if (0 < adjustVolume)
+                    {
+                    adjustVolume += 0.5;
+                    }
+                else if (0 > adjustVolume)
+                    {
+                    adjustVolume -= 0.5;
+                    }                   
+                iVerticalSlider->SetPosition(-adjustVolume); // see impl. of CSliderBar             
+                }                               
+            }
+        else if (VideoEditor::ECursorOnAudio == CursorLocation())
+            {                   
+            if (0 != iMovie.GetAudioClipVolumeGainL(CurrentIndex()))
+                {                                   
+                TReal adjustVolume = iMovie.GetAudioClipVolumeGainL(CurrentIndex());///(KVolumeMaxGain/10);
+                adjustVolume = adjustVolume/(KVolumeMaxGain/10);                                        
+                
+                if (0 < adjustVolume)
+                    {
+                    adjustVolume += 0.5;
+                    }
+                else if (0 > adjustVolume)
+                    {
+                    adjustVolume -= 0.5;
+                    }           
+                iVerticalSlider->SetPosition(-adjustVolume);                
+                }                           
+            }
+                
+        iHorizontalSlider->MakeVisible(EFalse);
+        iVerticalSlider->MakeVisible(ETrue);
+        }
+    else
+        {
+        iHorizontalSlider->MakeVisible(EFalse);
+        iVerticalSlider->MakeVisible(EFalse);
+        }
+
+    if ( iSelectionMode == EModeSlowMotion )
+        {
+        ArrowsControl();
+        }
+        
+    else 
+        {
+        iInfoDisplay->SetSlowMotionOn( EFalse );
+        switch(iSelectionMode)
+            {
+            case EModeRecordingSetStart:
+                iEffectSymbols->MakeVisible( ETrue );
+                iEffectSymbols->SetPauseAudioIconVisibility( EFalse );
+                iEffectSymbols->SetRecAudioIconVisibility( EFalse );
+                break;
+            case EModeRecordingPaused:
+                iEffectSymbols->MakeVisible( ETrue );
+                iInfoDisplay->SetLayout( CVeiTextDisplay::ERecordingPaused );
+                iEffectSymbols->SetRecAudioIconVisibility( EFalse );
+                iEffectSymbols->SetPauseAudioIconVisibility( ETrue );   
+                iEffectSymbols->DrawNow();
+                break;
+            case EModeRecording:
+                iEffectSymbols->MakeVisible( ETrue );
+                iEffectSymbols->SetPauseAudioIconVisibility( EFalse );
+                iEffectSymbols->SetRecAudioIconVisibility( ETrue );
+                break;
+            default:
+                iEffectSymbols->SetPauseAudioIconVisibility( EFalse );
+                iEffectSymbols->SetRecAudioIconVisibility( EFalse );
+                if ( !iFullScreenSelected )
+                {
+                if ( VideoEditorUtils::IsLandscapeScreenOrientation() ) //Landscape     
+                    {
+                    iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything );
+                    }
+                else
+                    {
+                    iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration );
+                    }
+                }
+                break;
+            }
+        }
+
+    DrawDeferred();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::SetSelectionMode: Out");
+    }
+
+TTypeUid::Ptr CVeiEditVideoContainer::MopSupplyObject( TTypeUid aId )
+    {
+    if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext )
+        {
+        return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+        }
+    return CCoeControl::MopSupplyObject( aId );
+    }
+// ---------------------------------------------------------
+// CVeiEditVideoContainer::Draw(const TRect& aRect) const
+// ---------------------------------------------------------
+//
+void CVeiEditVideoContainer::Draw( const TRect& /*aRect*/ ) const
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::Draw() In, iPreviewState:%d", iPreviewState);
+    CWindowGc& gc = SystemGc();
+
+    if(iBlackScreen)
+        {
+        gc.Clear( Rect() );
+        gc.SetPenStyle( CWindowGc::ESolidPen );
+        gc.SetBrushColor( KRgbBlack );
+        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+        gc.DrawRect( Rect() );
+        gc.SetPenStyle( CWindowGc::ESolidPen ); 
+        gc.DrawRoundRect( Rect(), TSize(4,4));
+        }
+    else
+        {
+        // Draw skin background
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+        MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+        AknsDrawUtils::Background( skin, cc, this, gc, Rect() );            
+
+        if ( EStatePaused == iPreviewState  )
+            {               
+            gc.BitBltMasked( iPauseIconBox.iTl, iPauseBitmap, 
+                TRect( TPoint(0,0), iPauseBitmap->SizeInPixels() ), 
+                iPauseBitmapMask, EFalse );
+            }
+
+        if (EModeMixingAudio == iSelectionMode && CVeiEditVideoView::EMixAudio != iView.EditorState())
+            {
+            iHorizontalSlider->MakeVisible(EFalse);
+            }
+        else if (EModeMixingAudio == iSelectionMode && CVeiEditVideoView::EMixAudio == iView.EditorState())
+            {
+            iHorizontalSlider->MakeVisible(ETrue);
+            TPoint mixAudioVideoIconPoint(iHorizontalSliderPoint.iX, iHorizontalSliderPoint.iY + 20);   
+            TRect videoTrackIconSourceRect(0, 0, iVideoTrackIcon->SizeInPixels().iWidth, 
+                iVideoTrackIcon->SizeInPixels().iHeight);
+            gc.BitBltMasked( mixAudioVideoIconPoint, iVideoTrackIcon, videoTrackIconSourceRect,
+                iVideoTrackIconMask, EFalse);
+
+            TPoint mixAudioAudioIconPoint(iHorizontalSliderPoint.iX + 
+                iHorizontalSliderSize.iWidth - 15, iHorizontalSliderPoint.iY + 20);
+            TRect audioTrackIconSourceRect(0, 0, iAudioTrackIcon->SizeInPixels().iWidth, 
+                iAudioTrackIcon->SizeInPixels().iHeight);
+            gc.BitBltMasked(mixAudioAudioIconPoint, iAudioTrackIcon, audioTrackIconSourceRect,
+                iAudioTrackIconMask, EFalse);
+
+            return;
+            }
+
+        else if (EModeAdjustVolume == iSelectionMode && CVeiEditVideoView::EAdjustVolume != iView.EditorState())
+            {
+            iVerticalSlider->MakeVisible(EFalse);
+            }
+        else if (EModeAdjustVolume == iSelectionMode && CVeiEditVideoView::EAdjustVolume && iView.EditorState())
+            {
+            iVerticalSlider->MakeVisible(ETrue);
+            TPoint pluspoint(iVerticalSliderPoint.iX - 12, iVerticalSliderPoint.iY + 20); 
+            TPoint minuspoint(iVerticalSliderPoint.iX - 12, iVerticalSliderPoint.iY + iVerticalSliderSize.iHeight);
+            _LIT(KPlus, "+");
+            _LIT(KMinus, "-");
+
+            const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+            gc.UseFont( font );
+
+            // Get text color from skin
+            TRgb textColor( KRgbBlack );
+            MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+            AknsUtils::GetCachedColor(skinInstance, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
+            gc.SetPenColor( textColor );
+
+            gc.DrawText( KPlus, pluspoint );
+            gc.DrawText( KMinus, minuspoint );
+
+            gc.DiscardFont();
+
+            return;
+            }
+
+        /* Initialize icon & text areas. */
+
+        CFbsBitmap* thumbnail = 0;
+
+        TInt i;
+
+        TSize roundEdgeSize(2,2);
+
+        /* Draw bar area. */
+
+        TRgb rgbUnselectedBorder = TRgb( 132,132,132 );
+
+        TRgb rgbUnselectedTrackFill = TRgb(221,221,221);
+        TRgb rgbUnselectedTrackBorder = TRgb( 201,201,201 );
+        TRgb rgbUnselectedTrackBorderOuterRect = TRgb( 162,162,162 );
+
+        TRgb rgbUnselectedAudioMarker = KRgbWhite;
+
+        TRgb rgbUnselectedClip = TRgb( 140,166,198 );
+
+        TRgb rgbUnselectedTransition = KRgbWhite;
+        TRgb rgbSelectedBorder = TRgb( 94,97,101 );
+        TRgb rgbSelectedAudioMarker = KRgbBlack;
+        TRgb rgbSelectedClip = TRgb( 108,139,182 );
+        TRgb rgbSelectedTransition = TRgb( 0x00, 0x9b, 0xff );
+        TRgb rgbActiveBorder = KRgbRed;
+        TRgb rgbActiveAudioMarker = KRgbRed;
+        TRgb rgbActiveClip = TRgb( 140,166,198 );
+        
+        TRect videoTrackIconSourceRect(0, 0, iVideoTrackIcon->SizeInPixels().iWidth, 
+                iVideoTrackIcon->SizeInPixels().iHeight);
+
+        gc.BitBltMasked( iVideoBarIconPos, iVideoTrackIcon, videoTrackIconSourceRect,
+            iVideoTrackIconMask, EFalse);
+
+        TRect audioTrackIconSourceRect(0, 0, iAudioTrackIcon->SizeInPixels().iWidth, 
+            iAudioTrackIcon->SizeInPixels().iHeight);
+        gc.BitBltMasked(iAudioBarIconPos, iAudioTrackIcon, audioTrackIconSourceRect,
+            iAudioTrackIconMask, EFalse);
+
+        gc.SetPenStyle( CGraphicsContext::ESolidPen );
+        gc.SetPenColor( rgbUnselectedTrackBorderOuterRect );
+        gc.SetBrushColor( rgbUnselectedTrackFill );
+        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+
+        if ( ( iMovie.VideoClipCount() == 0 ) && ( iCursorLocation != ECursorOnAudio ) &&
+             ( iCursorLocation != ECursorOnEmptyAudioTrack )  || 
+                ( iCursorLocation == ECursorOnEmptyVideoTrack ) )
+            {
+            gc.SetPenColor(rgbSelectedBorder);
+            gc.SetBrushColor( TRgb( 180,206,238 ) );
+            }
+
+        gc.DrawRoundRect(iVideoTrackBox, TSize(2,2));
+        gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+        gc.SetPenColor(rgbUnselectedTrackBorder);
+        TRect outerRect(iVideoTrackBox);
+        outerRect.Shrink(1,1);
+        gc.DrawRoundRect(outerRect, TSize(2,2) );
+
+
+        gc.SetPenColor( rgbUnselectedTrackBorderOuterRect );
+        gc.SetBrushColor( rgbUnselectedTrackFill );
+        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+
+        if (((iMovie.AudioClipCount() == 0) && (iCursorLocation == ECursorOnAudio) )|| 
+                ( iCursorLocation == ECursorOnEmptyAudioTrack ) )
+            {
+            gc.SetPenColor(rgbSelectedBorder);
+            gc.SetBrushColor( TRgb( 180,206,238 ) );
+            }
+
+        gc.DrawRoundRect(iAudioTrackBox, TSize(2,2));
+
+        gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+        gc.SetPenColor(rgbUnselectedTrackBorder);
+        outerRect = iAudioTrackBox;
+        outerRect.Shrink(1,1);
+        gc.DrawRoundRect(outerRect, TSize(2,2) );
+
+        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+
+        TInt64 barDuration = iMovie.Duration().Int64();
+        TInt64 audioDuration(0);
+        if ( (iMovie.AudioClipCount() != 0) && ((iSelectionMode == EModeRecording ) ||
+            (iSelectionMode == EModeRecordingPaused)))
+            {
+            audioDuration = (iMovie.AudioClipEndTime( iMovie.AudioClipCount() - 1 )).Int64();
+            }
+
+        audioDuration+= iRecordedAudioDuration.Int64();
+
+        if ( audioDuration > barDuration )
+            {
+            barDuration = audioDuration;
+            }
+
+        if ( iRecordedAudioStartTime > barDuration )
+            {
+            barDuration = iRecordedAudioStartTime.Int64();
+            }
+        if (barDuration < 30000000)
+            {
+            barDuration = 30000000;
+            }
+        else if (barDuration < 45000000)
+            {
+            barDuration = 45000000;
+            }
+        else{
+            barDuration = ((barDuration / 30000000) + 1) * 30000000;
+            }
+        
+        TBool drawSelectedRect = EFalse;
+        TInt selectedAudioClipIndex( -1 );
+        TRect selectedRect;
+
+        gc.SetPenColor(rgbUnselectedBorder);
+        gc.SetBrushColor(rgbUnselectedClip);
+
+        TRect audioBoxes  = TRect();
+       
+        TRect box;
+        box.iTl.iY = iAudioBarBox.iTl.iY;
+        box.iBr.iY = iAudioBarBox.iBr.iY;
+        TInt barWidth = iAudioBarBox.Width();
+        TInt videoIndex = 0;
+
+        for (i = 0; i < iMovie.AudioClipCount(); i++)
+            {
+            box.iTl.iX = iAudioBarBox.iTl.iX
+                + static_cast<TInt32>((iMovie.AudioClipStartTime(i).Int64() * barWidth) / 
+                barDuration);
+            box.iBr.iX = iAudioBarBox.iTl.iX
+                + static_cast<TInt32>((iMovie.AudioClipEndTime(i).Int64() * barWidth) / barDuration)+ 1;
+
+            if ((iCursorLocation == ECursorOnAudio)
+                && (i == CurrentIndex()) && (( iSelectionMode == EModeNavigation )
+                || ( iSelectionMode == EModeMove ) ||
+                   ( iSelectionMode == EModeDuration ) ))
+                {
+                drawSelectedRect = ETrue;
+                selectedAudioClipIndex = i;
+                selectedRect = box;
+                }
+            else
+                {
+                gc.DrawRect(box);
+
+                gc.SetPenColor(rgbUnselectedAudioMarker);
+
+                audioBoxes.Resize( box.Size() );
+               
+                if ( ( iMovie.AudioClipCutOutTime( i ).Int64() -
+                     iMovie.AudioClipCutInTime( i ).Int64() ) <
+                     iMovie.AudioClipInfo( i )->Duration().Int64() )        
+                    {
+                    TRect truncateBox;
+                    truncateBox.iTl.iY = box.iTl.iY + 2;
+                    truncateBox.iBr.iY = box.iBr.iY - 2;
+
+                    truncateBox.iTl.iX = box.iBr.iX - 4;
+                    truncateBox.iBr.iX = truncateBox.iTl.iX + 1;
+                    if (truncateBox.iTl.iX >= (box.iTl.iX + 2))
+                        {
+                        gc.DrawRect(truncateBox);
+                        }
+                
+                    truncateBox.iTl.iX = box.iBr.iX - 7;
+                    truncateBox.iBr.iX = truncateBox.iTl.iX + 1;
+                    if (truncateBox.iTl.iX >= (box.iTl.iX + 2))
+                        {
+                        gc.DrawRect(truncateBox);
+                        }
+
+                    truncateBox.iTl.iX = box.iBr.iX - 10;
+                    truncateBox.iBr.iX = truncateBox.iTl.iX + 1;
+                    if (truncateBox.iTl.iX >= (box.iTl.iX + 2))
+                        {
+                        gc.DrawRect(truncateBox);
+                        }
+                    }
+
+                gc.SetPenColor(rgbUnselectedBorder);
+                }
+
+            TTimeIntervalMicroSeconds audioClipStartTimeInt = iMovie.AudioClipStartTime(i).Int64() + iMovie.AudioClipCutInTime(i).Int64(); 
+            TTimeIntervalMicroSeconds audioClipEndTimeInt =   iMovie.AudioClipEndTime(i).Int64(); 
+
+            if ((audioClipStartTimeInt == TTimeIntervalMicroSeconds(0)) && (iMovie.VideoClipCount() > 0))
+                {
+                TRect syncBox;
+                syncBox.iTl.iX = box.iTl.iX;
+                syncBox.iTl.iY = iVideoBarBox.iBr.iY;
+                syncBox.iBr.iX = box.iTl.iX + 1;
+                syncBox.iBr.iY = iAudioBarBox.iTl.iY;
+
+                gc.DrawRect(syncBox);
+                }
+
+            while (videoIndex < iMovie.VideoClipCount())
+                {
+                TInt oldIndex = videoIndex;
+                if ( iMovie.VideoClipEndTime( oldIndex ) < audioClipStartTimeInt )
+                    {
+                    videoIndex++;
+                    }
+                else if ( iMovie.VideoClipEndTime( oldIndex ) == audioClipStartTimeInt )
+                    {
+                    TRect syncBox;
+                    syncBox.iTl.iX = box.iTl.iX;
+                    syncBox.iTl.iY = iVideoBarBox.iBr.iY;
+                    syncBox.iBr.iX = box.iTl.iX + 1;
+                    syncBox.iBr.iY = iAudioBarBox.iTl.iY;
+
+                    gc.DrawRect(syncBox);
+                    break;
+                    }
+                else
+                    {
+                    break;
+                    }
+                }
+
+            while (videoIndex < iMovie.VideoClipCount())
+                {
+                TInt oldIndex = videoIndex;
+
+                if ( iMovie.VideoClipEndTime( oldIndex ) < audioClipEndTimeInt )
+                    {
+                    videoIndex++;
+                    }
+                else if ( iMovie.VideoClipEndTime( oldIndex ) == audioClipEndTimeInt )
+                    {
+                    TRect syncBox;
+                    syncBox.iTl.iX = box.iBr.iX - 1;
+                    syncBox.iTl.iY = iVideoBarBox.iBr.iY;
+                    syncBox.iBr.iX = box.iBr.iX;
+                    syncBox.iBr.iY = iAudioBarBox.iTl.iY;
+
+                    gc.DrawRect(syncBox);
+                    break;
+                    }
+                else
+                    {
+                    break;
+                    }
+                }
+            }
+
+        if ((iSelectionMode == EModeRecordingSetStart) || (iSelectionMode == EModeRecording)
+            || (iSelectionMode == EModeRecordingPaused))
+            {
+            box.iTl.iX = iAudioBarBox.iTl.iX
+                + static_cast<TInt32>((iRecordedAudioStartTime.Int64() * barWidth) / barDuration);
+            TInt64 recordedAudioEndTimeInt = iRecordedAudioStartTime.Int64() + iRecordedAudioDuration.Int64();
+            box.iBr.iX = iAudioBarBox.iTl.iX
+                + static_cast<TInt32>((recordedAudioEndTimeInt * barWidth) / barDuration)+ 1;
+
+            gc.SetPenColor(rgbActiveBorder);
+            gc.SetBrushColor(rgbSelectedClip);
+            gc.DrawRect(box);
+            gc.SetPenColor(rgbUnselectedBorder);
+            gc.SetBrushColor(rgbUnselectedClip);
+            }
+
+        box.iTl.iY = iVideoBarBox.iTl.iY;
+        box.iBr.iY = iVideoBarBox.iBr.iY;
+        barWidth = iVideoBarBox.Width();
+        
+        TRect videoBoxes  = TRect();
+        
+        for (i = 0; i < iMovie.VideoClipCount(); i++)
+            {
+            box.iTl.iX = iVideoBarBox.iTl.iX
+                + static_cast<TInt32>((iMovie.VideoClipStartTime( i ).Int64() * barWidth) / barDuration);
+            box.iBr.iX = iVideoBarBox.iTl.iX
+                + static_cast<TInt32>((iMovie.VideoClipEndTime( i ).Int64() * barWidth) / barDuration)+ 1;
+            
+            videoBoxes.Resize( box.Size() );
+            
+            if ((iCursorLocation == ECursorOnClip)
+                && (i == CurrentIndex()) && ( iView.EditorState() == CVeiEditVideoView::EEdit ))
+                {
+                drawSelectedRect = ETrue;
+                selectedRect = box;
+                gc.DrawRect(box);
+                }
+            else
+                {
+                gc.DrawRect(box);
+                //Draw thumbnail in video box.
+                if ( i < iVideoItemArray.Count() )
+                    {
+                    thumbnail = iVideoItemArray[i]->iTimelineBitmap;
+                    }
+                if ( thumbnail )
+                    {
+                    //TSize thumbnailSizeInPixels = thumbnail->SizeInPixels();
+                    TPoint pos( box.iTl.iX+1, box.iTl.iY+1 );
+                    TSize pieceSize = TSize(STATIC_CAST(TInt, (box.Height()-2)*1.22), box.Height()-2);
+                    
+                    if ( pieceSize.iWidth >= box.Width()-2  )
+                        {
+                        pieceSize.SetSize( box.Width()-2, box.Height()-2 );
+                        }
+                    TRect pieceRect( TPoint(0,0), pieceSize );
+                    gc.BitBlt( pos, thumbnail, pieceRect ); 
+                    }
+
+             
+                //Draw play head.
+                if( iPreviewState == EStatePaused || iPreviewState == EStateStopped)
+                    {
+                    TRect bar( iBarArea );//bar rect.
+
+                    const TUint barY = 6;
+
+                    bar.iTl.iY += barY;
+                    bar.iTl.iX += barY;
+                    bar.iTl.iX += iVideoTrackIcon->SizeInPixels().iWidth;
+                    bar.iBr.iY -= barY / 2;
+                    bar.iBr.iX -= barY;
+
+                        
+                    gc.SetBrushColor( KRgbBlack );
+                    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+                    gc.SetPenColor( KRgbDarkGray );
+                    gc.SetPenStyle( CGraphicsContext::ESolidPen );
+
+                    TPoint inPointList[3];
+                    inPointList[0] = TPoint( (iCurrentPointX - barY) + 1, iBarArea.iTl.iY - 5 );
+                    inPointList[1] = TPoint( (iCurrentPointX + barY) - 1, iBarArea.iTl.iY - 5 );
+                    inPointList[2] = TPoint( iCurrentPointX, bar.iTl.iY - 6  );
+                    gc.DrawPolygon( inPointList, 3 );
+
+                    inPointList[0] = TPoint( (iCurrentPointX - barY) + 1, iBarArea.iBr.iY + 5 );
+                    inPointList[1] = TPoint( (iCurrentPointX + barY) - 1, iBarArea.iBr.iY + 5 );
+                    inPointList[2] = TPoint( iCurrentPointX, bar.iBr.iY );
+                    gc.DrawPolygon( inPointList, 3 );
+
+                    gc.SetPenSize( TSize( 3, 1 ) );
+                    gc.DrawLine( TPoint( iCurrentPointX, bar.iTl.iY - 5 ), 
+                    TPoint( iCurrentPointX, bar.iBr.iY ) );
+                    
+                    gc.SetPenColor(rgbUnselectedBorder);
+                    gc.SetBrushColor(rgbUnselectedClip);
+                    gc.SetPenSize( TSize( 1, 1 ) );
+                    }
+                }
+            }
+
+        if (drawSelectedRect)
+            {
+            selectedRect.Grow( iZoomFactorX,iZoomFactorY );
+
+
+            TRect outerBlackRect = selectedRect;
+            outerBlackRect.Grow(1,1);
+            gc.SetPenColor( KRgbBlack );
+            gc.SetPenStyle( CGraphicsContext::ESolidPen );
+            gc.DrawRoundRect( outerBlackRect, TSize(2,2) );
+
+
+            if (iSelectionMode == EModeMove )   //Move, draw dashed outline
+                {
+                gc.SetPenStyle( CGraphicsContext::EDashedPen );
+                gc.SetPenColor( KRgbBlack );
+                gc.SetBrushColor(rgbActiveClip);
+                }
+            else    
+                {
+                gc.SetPenColor(rgbSelectedBorder);
+                gc.SetBrushColor(rgbSelectedClip);
+                }
+
+            gc.DrawRoundRect( selectedRect,roundEdgeSize );
+            
+            selectedRect.Shrink(2,2);
+            gc.DrawBitmap( selectedRect, iGradientBitmap );
+
+             //Draw thumbnail in video box
+            if ( iCursorLocation == ECursorOnClip )
+                {
+                selectedRect.Grow(2,2);
+                
+                thumbnail = iVideoItemArray[CurrentIndex()]->iTimelineBitmap;
+                if ( thumbnail )
+                    {
+                    TPoint pos( selectedRect.iTl.iX+1, selectedRect.iTl.iY+1 );
+                    TSize pieceSize = TSize(STATIC_CAST(TInt, (selectedRect.Height()-2)*1.22), 
+                        selectedRect.Height()-2);
+
+                    if ( pieceSize.iWidth >= selectedRect.Width()-2 )
+                        {
+                        pieceSize.SetSize( selectedRect.Width()-2, selectedRect.Height()-2 );
+                        }
+                    TRect pieceRect( TPoint(0,0), pieceSize );
+                    gc.BitBlt( pos, thumbnail, pieceRect ); 
+                    }
+                }
+            drawSelectedRect = EFalse;
+
+            if (iSelectionMode == EModeNavigation)
+                {
+                gc.SetPenColor(rgbSelectedAudioMarker);
+                }
+            else
+                {
+                gc.SetPenColor(rgbActiveAudioMarker);
+                }
+
+            if ((selectedAudioClipIndex != -1) && 
+                 ( ( iMovie.AudioClipCutOutTime( selectedAudioClipIndex ).Int64() -
+                     iMovie.AudioClipCutInTime( selectedAudioClipIndex ).Int64() ) <
+                     iMovie.AudioClipInfo( selectedAudioClipIndex )->Duration().Int64() ) )
+                {
+                TRect truncateBox;
+                truncateBox.iTl.iY = selectedRect.iTl.iY + 2;
+                truncateBox.iBr.iY = selectedRect.iBr.iY - 2;
+
+                truncateBox.iTl.iX = selectedRect.iBr.iX - 4;
+                truncateBox.iBr.iX = truncateBox.iTl.iX + 1;
+                if (truncateBox.iTl.iX >= (selectedRect.iTl.iX + 2))
+                    {
+                    gc.DrawRect(truncateBox);
+                    }
+            
+                truncateBox.iTl.iX = selectedRect.iBr.iX - 7;
+                truncateBox.iBr.iX = truncateBox.iTl.iX + 1;
+                if (truncateBox.iTl.iX >= (selectedRect.iTl.iX + 2))
+                    {
+                    gc.DrawRect(truncateBox);
+                    }
+
+                truncateBox.iTl.iX = selectedRect.iBr.iX - 10;
+                truncateBox.iBr.iX = truncateBox.iTl.iX + 1;
+                if (truncateBox.iTl.iX >= (selectedRect.iTl.iX + 2))
+                    {
+                    gc.DrawRect(truncateBox);
+                    }
+                }
+            }
+
+        gc.SetPenStyle(CGraphicsContext::ESolidPen);
+        gc.SetPenColor(rgbUnselectedBorder);
+        gc.SetBrushColor(rgbUnselectedTransition);
+
+        box.iTl.iY += (box.Height() - iTransitionMarkerSize.iHeight) / 2; 
+        box.iBr.iY = box.iTl.iY + iTransitionMarkerSize.iHeight;
+        for (i = iMovie.VideoClipCount(); (i >= 0) && (iMovie.VideoClipCount() > 0); i--)
+            {
+            if ((i == 0) && (iMovie.VideoClipCount() > 0))
+                {
+                box.iTl.iX = iVideoBarBox.iTl.iX
+                    - (iTransitionMarkerSize.iWidth / 2);
+                }
+            else
+                {
+                box.iTl.iX = iVideoBarBox.iTl.iX
+                    + static_cast<TInt32>((iMovie.VideoClipEndTime( i-1 ).Int64() * barWidth) / barDuration)
+                    - (iTransitionMarkerSize.iWidth / 2);
+                }
+
+            box.iBr.iX = box.iTl.iX + iTransitionMarkerSize.iWidth;
+
+            if ((iCursorLocation == ECursorOnTransition) && (i == CurrentIndex() ) ) 
+                {
+                drawSelectedRect = ETrue;
+                selectedRect = box;
+                }
+            else
+                {
+                if ( (iCursorLocation == ECursorOnClip) && (i == CurrentIndex() ) &&( iSelectionMode != EModePreview ) )
+                    {
+                    box.Move( -iZoomFactorX,0);
+                    box.Grow(0,iZoomFactorX/2);
+                    gc.DrawRect(box);
+                    box.Shrink(0,iZoomFactorX/2);
+                    box.Move( iZoomFactorX,0 );
+                    }
+                else if ( (iCursorLocation == ECursorOnClip) && (i == CurrentIndex()+1 ) && ( iSelectionMode != EModePreview ) )
+                    {
+                    box.Move( iZoomFactorX,0 );
+                    box.Grow(0,iZoomFactorX/2);
+                    gc.DrawRect(box);
+                    box.Shrink(0,iZoomFactorX/2);
+                    box.Move( -iZoomFactorX,0 );
+                    }
+                else
+                    {
+                    gc.DrawRect(box);
+                    }
+                }
+            }
+
+        if (drawSelectedRect)
+            {
+            selectedRect.Grow(1,iZoomFactorX/2);
+            gc.SetPenColor(rgbSelectedBorder);
+            gc.SetBrushColor(rgbSelectedTransition);
+            gc.DrawRect(selectedRect);
+            }
+            
+        // draw the new position for the clip when a clip is dragged with touch
+        if ( iIsVideoDrag ) 
+            {    
+            TRgb rgbSelectedBorder = KRgbDarkMagenta;
+            TRgb rgbSelectedTransition = KRgbDarkMagenta;
+            gc.SetPenColor( rgbSelectedBorder );
+            gc.SetBrushColor( rgbSelectedTransition );
+            
+            box.iTl.iY = iVideoBarBox.iTl.iY;
+            box.iBr.iY = iVideoBarBox.iBr.iY;
+
+            // clip is moved from right to left
+            if ( iClickedClip > iNewClipPosition )
+                {
+                if ( iNewClipPosition == 0 )
+                    {
+                    box.iTl.iX = iVideoItemRectArray[ iNewClipPosition ].iTl.iX;
+                    box.iBr.iX = iVideoItemRectArray[ iNewClipPosition ].iTl.iX + 5;                        
+                    }
+                else
+                    {
+                    box.iTl.iX = iVideoItemRectArray[ iNewClipPosition ].iTl.iX - 5;
+                    box.iBr.iX = iVideoItemRectArray[ iNewClipPosition ].iTl.iX + 5;                        
+                    }
+                gc.DrawRect( box );
+                }
+            // clip is moved from left to right
+            else if ( iClickedClip < iNewClipPosition )
+                {
+                box.iTl.iX = iVideoItemRectArray[ iNewClipPosition ].iBr.iX - 5;
+                box.iBr.iX = iVideoItemRectArray[ iNewClipPosition ].iBr.iX + 5;                
+                gc.DrawRect( box );
+                }
+            }            
+        }//else 
+    }
+
+void CVeiEditVideoContainer::HandleResourceChange(TInt aType)
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleResourceChange() In, aType:%d", aType);
+    
+    if (KAknsMessageSkinChange == aType)
+        {
+        HandleComponentControlsResourceChange(aType);
+        }
+    CCoeControl::HandleResourceChange(aType);
+    
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleResourceChange() Out");
+    }
+
+void CVeiEditVideoContainer::DrawTrackBoxes() const
+    {
+    if(!iBlackScreen)
+        {
+        TRect drawableRect = iBarArea;
+        drawableRect.iTl.iX = (iVideoTrackBox.iTl.iX - KMaxZoomFactorX) - 2;
+        drawableRect.iBr.iX = (iVideoTrackBox.iBr.iX + KMaxZoomFactorX) + 2;
+        drawableRect.iTl.iY = (iVideoTrackBox.iTl.iY - KMaxZoomFactorY) - 2;
+        drawableRect.iBr.iY = (iAudioTrackBox.iBr.iY + KMaxZoomFactorY) + 2;
+
+        Window().Invalidate( drawableRect );
+        ActivateGc();
+    //Redraw of the window's invalid region.
+        Window().BeginRedraw( drawableRect );
+        Draw( drawableRect );
+
+        Window().EndRedraw();
+        DeactivateGc();
+        }
+    }
+
+
+
+
+// ----------------------------------------------------------------------------
+// CVeiEditVideoContainer::GetHelpContext(...) const
+//
+// Gets the control's help context. Associates the control with a particular
+// Help file and topic in a context sensitive application.
+// ----------------------------------------------------------------------------
+//
+void CVeiEditVideoContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetHelpContext(): In");
+
+    // Set UID of the CS Help file (same as application UID).
+    aContext.iMajor = KUidVideoEditor;
+
+    // Set the context/topic.
+    aContext.iContext = KVED_HLP_EDIT_VIDEO_VIEW;
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetHelpContext(): Out");
+    }
+
+
+void CVeiEditVideoContainer::ArrowsControl() const
+    {           
+    
+    iInfoDisplay->SetLayout( CVeiTextDisplay::EOnlyName );
+    iInfoDisplay->SetUpperArrowVisibility( EFalse );
+    iInfoDisplay->SetLowerArrowVisibility( EFalse );
+    iInfoDisplay->SetRightArrowVisibility( EFalse );
+    iInfoDisplay->SetLeftArrowVisibility( EFalse );
+ 
+    iArrowsDisplay->MakeVisible( EFalse );
+    iArrowsDisplay->SetUpperArrowVisibility( EFalse );
+    iArrowsDisplay->SetLowerArrowVisibility( EFalse );
+    iArrowsDisplay->SetRightArrowVisibility( EFalse );
+    iArrowsDisplay->SetLeftArrowVisibility( EFalse );
+    
+    iInfoDisplay->SetSlowMotionOn( EFalse );
+
+    iDummyCutBar->MakeVisible( ETrue );
+
+    if ( iCursorLocation == ECursorOnClip)
+        {
+        iInfoDisplay->MakeVisible( ETrue );
+        iInfoDisplay->SetRect( iInfoDisplayBox );
+
+        if( VideoEditorUtils::IsLandscapeScreenOrientation() )
+            {
+            iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything );
+            }
+        else
+            {
+            iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration );
+            }
+
+        if (iSelectionMode == EModeSlowMotion)
+            {
+            iArrowsDisplay->MakeVisible( ETrue );
+
+            if( !VideoEditorUtils::IsLandscapeScreenOrientation() )
+                {
+                iInfoDisplay->MakeVisible( EFalse );
+                }
+
+            iArrowsDisplay->SetSlowMotionOn( ETrue );
+            iArrowsDisplay->SetLayout( CVeiTextDisplay::EArrowsHorizontal );
+
+            iDummyCutBar->MakeVisible( EFalse );
+            
+            if ( iSlowMotionValue < 1000  )
+                {
+                iArrowsDisplay->SetRightArrowVisibility( ETrue );
+                }
+            if ( iSlowMotionValue > 250  ) 
+                {
+                iArrowsDisplay->SetLeftArrowVisibility( ETrue );
+                }
+                iArrowsDisplay->SetRect( iSlowMotionBox );
+            }       
+        else
+            {
+            iVideoDisplay->StopAnimation();
+            }
+        }
+    else if ( iCursorLocation == ECursorOnAudio )
+        {
+        iInfoDisplay->MakeVisible( ETrue );
+        iInfoDisplay->SetRect( iInfoDisplayBox );
+
+        if( VideoEditorUtils::IsLandscapeScreenOrientation() )
+            {
+            iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything );
+            }
+        else
+            {
+            iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration );
+            }
+
+        }
+     else if ( iCursorLocation == ECursorOnTransition )
+        {            
+        iDummyCutBar->MakeVisible( ETrue );
+        iInfoDisplay->MakeVisible( ETrue );
+
+        iInfoDisplay->SetUpperArrowVisibility( ETrue );
+        iInfoDisplay->SetLowerArrowVisibility( ETrue );
+        iInfoDisplay->SetLayout( CVeiTextDisplay::EArrowsVertical );
+        iInfoDisplay->SetRect( iTransitionArrowsBox );      
+        }
+    if ( iView.EditorState() == CVeiEditVideoView::EMixAudio || 
+            iView.EditorState() == CVeiEditVideoView::EAdjustVolume)
+        {               
+        iDummyCutBar->MakeVisible( EFalse );
+        }                   
+    
+    if ( iView.EditorState() == CVeiEditVideoView::EMixAudio)
+        {
+        iInfoDisplay->MakeVisible(EFalse);          
+        }       
+    if ( iView.EditorState() == CVeiEditVideoView::EAdjustVolume)
+        {
+        iInfoDisplay->MakeVisible(ETrue);           
+        }       
+    }
+
+void CVeiEditVideoContainer::DrawPlayHead()
+    {
+    CFbsBitmap* thumbnail = 0;
+    TRect redrawArea = TRect(iVideoBarIconPos.iX+iVideoTrackIcon->SizeInPixels().iWidth, 
+        iBarArea.iTl.iY - 5, iBarArea.iBr.iX, iBarArea.iBr.iY + 10 );
+    
+    Window().Invalidate( redrawArea );
+    ActivateGc();
+    //Redraw of the window's invalid region.
+    Window().BeginRedraw( redrawArea );
+    CWindowGc& gc = SystemGc();
+    
+    // Draw skin background
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+    AknsDrawUtils::Background( skin, cc, this, gc, Rect() );
+
+    /* Draw bar area. */
+    TInt i;
+    TRgb rgbUnselectedBorder = TRgb( 132,132,132 );
+    TRgb rgbUnselectedTrackFill = TRgb(221,221,221);
+    TRgb rgbUnselectedTrackBorder = TRgb( 201,201,201 );
+    TRgb rgbUnselectedTrackBorderOuterRect = TRgb( 162,162,162 );
+
+    TRgb rgbUnselectedAudioMarker = KRgbWhite;
+    TRgb rgbUnselectedClip = TRgb( 140,166,198 );
+    TRgb rgbUnselectedTransition = KRgbWhite;
+    
+    gc.SetPenStyle( CGraphicsContext::ESolidPen );
+    gc.SetPenColor( rgbUnselectedTrackBorderOuterRect );
+    gc.SetBrushColor( rgbUnselectedTrackFill );
+    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+    gc.DrawRoundRect(iVideoTrackBox, TSize(2,2));
+
+    gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+    gc.SetPenColor( rgbUnselectedTrackBorder );
+    TRect outerRect( iVideoTrackBox );
+    outerRect.Shrink(1,1);
+    gc.DrawRoundRect(outerRect, TSize(2,2) );
+
+    gc.SetPenColor( rgbUnselectedTrackBorderOuterRect );
+    gc.SetBrushColor( rgbUnselectedTrackFill );
+    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+    gc.DrawRoundRect(iAudioTrackBox, TSize(2,2));
+
+    gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+    gc.SetPenColor(rgbUnselectedTrackBorder);
+    outerRect = iAudioTrackBox;
+    outerRect.Shrink(1,1);
+    gc.DrawRoundRect(outerRect, TSize(2,2) );
+
+    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+
+    TInt64 barDuration = iMovie.Duration().Int64();
+    TInt64 audioDuration(0);
+    if ( (iMovie.AudioClipCount() != 0) && (iSelectionMode == EModeRecording ))
+        {
+        audioDuration = (iMovie.AudioClipEndTime( iMovie.AudioClipCount() - 1 )).Int64();
+        }
+
+    audioDuration+= iRecordedAudioDuration.Int64();
+
+    if ( audioDuration > barDuration )
+        {
+        barDuration = audioDuration;
+        }
+
+    if ( iRecordedAudioStartTime > barDuration )
+        {
+        barDuration = iRecordedAudioStartTime.Int64();
+        }
+    if (barDuration < 30000000)
+        {
+        barDuration = 30000000;
+        }
+    else if (barDuration < 45000000)
+        {
+        barDuration = 45000000;
+        }
+    else{
+        barDuration = ((barDuration / 30000000) + 1) * 30000000;
+        }
+
+    gc.SetPenColor(rgbUnselectedBorder);
+    gc.SetBrushColor(rgbUnselectedClip);
+
+    TRect audioBoxes  = TRect(0,0,0,0);
+    
+    TRect box;
+    box.iTl.iY = iAudioBarBox.iTl.iY;
+    box.iBr.iY = iAudioBarBox.iBr.iY;
+    TInt barWidth = iAudioBarBox.Width();
+    TInt videoIndex = 0;
+
+    for (i = 0; i < iMovie.AudioClipCount(); i++)
+        {
+        box.iTl.iX = iAudioBarBox.iTl.iX
+            + static_cast<TInt32>((iMovie.AudioClipStartTime(i).Int64() * barWidth) / 
+            barDuration);
+        box.iBr.iX = iAudioBarBox.iTl.iX
+            + static_cast<TInt32>((iMovie.AudioClipEndTime(i).Int64() * barWidth) / barDuration)+ 1;
+
+            {
+            gc.DrawRect(box);
+
+            gc.SetPenColor(rgbUnselectedAudioMarker);
+            
+            audioBoxes = box;
+            
+            gc.SetPenColor(rgbUnselectedAudioMarker);
+
+            if ( ( iMovie.AudioClipCutOutTime( i ).Int64() -
+                 iMovie.AudioClipCutInTime( i ).Int64() ) <
+                 iMovie.AudioClipInfo( i )->Duration().Int64() )        
+                {
+                TRect truncateBox;
+                truncateBox.iTl.iY = box.iTl.iY + 2;
+                truncateBox.iBr.iY = box.iBr.iY - 2;
+
+                truncateBox.iTl.iX = box.iBr.iX - 4;
+                truncateBox.iBr.iX = truncateBox.iTl.iX + 1;
+                if (truncateBox.iTl.iX >= (box.iTl.iX + 2))
+                    {
+                    gc.DrawRect(truncateBox);
+                    }
+            
+                truncateBox.iTl.iX = box.iBr.iX - 7;
+                truncateBox.iBr.iX = truncateBox.iTl.iX + 1;
+                if (truncateBox.iTl.iX >= (box.iTl.iX + 2))
+                    {
+                    gc.DrawRect(truncateBox);
+                    }
+
+                truncateBox.iTl.iX = box.iBr.iX - 10;
+                truncateBox.iBr.iX = truncateBox.iTl.iX + 1;
+                if (truncateBox.iTl.iX >= (box.iTl.iX + 2))
+                    {
+                    gc.DrawRect(truncateBox);
+                    }
+                }
+
+            gc.SetPenColor(rgbUnselectedBorder);
+            }
+
+        TTimeIntervalMicroSeconds audioClipStartTimeInt = iMovie.AudioClipStartTime(i).Int64() + iMovie.AudioClipCutInTime(i).Int64(); 
+        TTimeIntervalMicroSeconds audioClipEndTimeInt =   iMovie.AudioClipEndTime(i).Int64(); 
+
+        if ((audioClipStartTimeInt == TTimeIntervalMicroSeconds(0)) && (iMovie.VideoClipCount() > 0))
+            {
+            TRect syncBox;
+            syncBox.iTl.iX = box.iTl.iX;
+            syncBox.iTl.iY = iVideoBarBox.iBr.iY;
+            syncBox.iBr.iX = box.iTl.iX + 1;
+            syncBox.iBr.iY = iAudioBarBox.iTl.iY;
+
+            gc.DrawRect(syncBox);
+            }
+
+        while (videoIndex < iMovie.VideoClipCount())
+            {
+            TInt oldIndex = videoIndex;
+            if ( iMovie.VideoClipEndTime( oldIndex ) < audioClipStartTimeInt )
+                {
+                videoIndex++;
+                }
+            else if ( iMovie.VideoClipEndTime( oldIndex ) == audioClipStartTimeInt )
+                {
+                TRect syncBox;
+                syncBox.iTl.iX = box.iTl.iX;
+                syncBox.iTl.iY = iVideoBarBox.iBr.iY;
+                syncBox.iBr.iX = box.iTl.iX + 1;
+                syncBox.iBr.iY = iAudioBarBox.iTl.iY;
+
+                gc.DrawRect(syncBox);
+                break;
+                }
+            else
+                {
+                break;
+                }
+            }
+
+        while (videoIndex < iMovie.VideoClipCount())
+            {
+            TInt oldIndex = videoIndex;
+
+            if ( iMovie.VideoClipEndTime( oldIndex ) < audioClipEndTimeInt )
+                {
+                videoIndex++;
+                }
+            else if ( iMovie.VideoClipEndTime( oldIndex ) == audioClipEndTimeInt )
+                {
+                TRect syncBox;
+                syncBox.iTl.iX = box.iBr.iX - 1;
+                syncBox.iTl.iY = iVideoBarBox.iBr.iY;
+                syncBox.iBr.iX = box.iBr.iX;
+                syncBox.iBr.iY = iAudioBarBox.iTl.iY;
+
+                gc.DrawRect(syncBox);
+                break;
+                }
+            else
+                {
+                break;
+                }
+            }
+        }
+
+    box.iTl.iY = iVideoBarBox.iTl.iY;
+    box.iBr.iY = iVideoBarBox.iBr.iY;
+    barWidth = iVideoBarBox.Width();
+
+
+    TRect videoBoxes  = TRect();
+    
+    for (i = 0; i < iMovie.VideoClipCount(); i++)
+        {
+        box.iTl.iX = iVideoBarBox.iTl.iX
+            + static_cast<TInt32>((iMovie.VideoClipStartTime( i ).Int64() * barWidth) / barDuration);
+        box.iBr.iX = iVideoBarBox.iTl.iX
+            + static_cast<TInt32>((iMovie.VideoClipEndTime( i ).Int64() * barWidth) / barDuration) + 1;
+        
+        videoBoxes.Resize( box.Size() );
+        
+        gc.DrawRect(box);
+        //Draw thumbnail in video boxes on the timeline. 
+        thumbnail = iVideoItemArray[i]->iTimelineBitmap;
+        if ( thumbnail )
+            {
+            TPoint pos( box.iTl.iX+1, box.iTl.iY+1 );
+
+            TSize pieceSize = TSize(STATIC_CAST(TInt, (box.Height()-2)*1.22), box.Height()-2);
+            
+            if ( pieceSize.iWidth >= box.Width()-2  )
+                {
+                pieceSize.SetSize( box.Width()-2, box.Height()-2 );
+                }
+            TRect pieceRect( TPoint(0,0), pieceSize );
+            gc.BitBlt( pos, thumbnail, pieceRect );
+            }
+        }
+
+    gc.SetPenStyle(CGraphicsContext::ESolidPen);
+    gc.SetPenColor(rgbUnselectedBorder);
+    gc.SetBrushColor(rgbUnselectedTransition);
+
+    box.iTl.iY += (box.Height() - iTransitionMarkerSize.iHeight) / 2; 
+    box.iBr.iY = box.iTl.iY + iTransitionMarkerSize.iHeight;
+    for (i = iMovie.VideoClipCount(); (i >= 0) && (iMovie.VideoClipCount() > 0); i--)
+        {
+        if ((i == 0) && (iMovie.VideoClipCount() > 0))
+            {
+            box.iTl.iX = iVideoBarBox.iTl.iX
+                - (iTransitionMarkerSize.iWidth / 2);
+            }
+        else
+            {
+            box.iTl.iX = iVideoBarBox.iTl.iX
+                + static_cast<TInt32>((iMovie.VideoClipEndTime( i-1 ).Int64() * barWidth) / barDuration)
+                - (iTransitionMarkerSize.iWidth / 2);
+            }
+
+        box.iBr.iX = box.iTl.iX + iTransitionMarkerSize.iWidth;
+
+        
+        gc.DrawRect(box);
+        }
+
+    //Draw play head.
+    TRect bar( iBarArea );//bar rect.
+    const TUint barY = 6;
+    TUint width = videoBoxes.Width();
+    TInt audioTrackWidth(0);
+    if ( audioBoxes.iBr.iX > 0 )
+        {
+        audioTrackWidth = audioBoxes.iBr.iX - iAudioTrackBox.iTl.iX;
+        }
+
+    if ( videoBoxes.Width() >= audioTrackWidth )
+        {
+        width = videoBoxes.Width();
+        }
+    else
+        {
+        width = audioTrackWidth;
+        }
+    TUint totalTime = static_cast<TInt32>(iMovie.Duration().Int64() /1000);//( iVideoDisplay->TotalLengthL().Int64() / 1000 ).Low();
+
+    if ( totalTime == 0 ) 
+        {
+        totalTime = 1;
+        }
+
+    TInt currentPointX = iCurrentPoint * width / totalTime + iVideoBarBox.iTl.iX;
+    iCurrentPointX = currentPointX;
+    
+    bar.iTl.iY += barY;
+    bar.iTl.iX += barY;
+    bar.iTl.iX += iVideoTrackIcon->SizeInPixels().iWidth;
+    bar.iBr.iY -= barY / 2;
+    bar.iBr.iX -= barY;
+
+                    
+    gc.SetBrushColor( KRgbBlack );
+    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+    gc.SetPenColor( KRgbDarkGray );
+    gc.SetPenStyle( CGraphicsContext::ESolidPen );
+
+    TPoint inPointList[3];
+    inPointList[0] = TPoint( currentPointX - barY + 1, iBarArea.iTl.iY - 5 );
+    inPointList[1] = TPoint( currentPointX + barY - 1, iBarArea.iTl.iY - 5 );
+    inPointList[2] = TPoint( currentPointX, bar.iTl.iY - 6  );
+    gc.DrawPolygon( inPointList, 3 );
+
+    inPointList[0] = TPoint( currentPointX - barY + 1, iBarArea.iBr.iY + 5 );
+    inPointList[1] = TPoint( currentPointX + barY - 1, iBarArea.iBr.iY + 5 );
+    inPointList[2] = TPoint( currentPointX, bar.iBr.iY  );
+    gc.DrawPolygon( inPointList, 3 );
+
+    gc.SetPenSize( TSize( 3, 1 ) );
+    gc.DrawLine( TPoint( currentPointX, bar.iTl.iY - 5 ), 
+    TPoint( currentPointX, bar.iBr.iY ) );
+    
+    Window().EndRedraw();
+    DeactivateGc();
+    }
+
+void CVeiEditVideoContainer::DialogDismissedL( TInt aButtonId )
+    {
+    iTakeSnapshot = EFalse;     
+    if ( aButtonId == -1 )  
+        { 
+        // when pressing cancel button.
+        /*if ( iTempVideoInfo && !iFrameReady)
+            {                           
+            iTempVideoInfo->CancelFrame();          
+            }       
+            */
+        CancelSnapshotSave();
+        }       
+    }
+    
+void CVeiEditVideoContainer::CancelSnapshotSave()
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::CancelSnapshotSave: in");
+    if ( iConverter )
+        {
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::CancelSnapshotSave: 1");       
+        iConverter->Cancel();
+        iConverter->CancelEncoding(); //also close the file
+        }
+    if ( iSaveToFileName )
+        {
+        LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::CancelSnapshotSave: 2, iSaveToFileName:%S", iSaveToFileName);
+
+        RFs&    fs = iEikonEnv->FsSession(); 
+        TInt result = fs.Delete( *iSaveToFileName ); 
+        delete iSaveToFileName;
+        iSaveToFileName = NULL;
+        }
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::CancelSnapshotSave: out"); 
+    }   
+
+void CVeiEditVideoContainer::SetCurrentIndex( TInt aCurrentIndex )
+    {
+    if ( (iCursorLocation == ECursorOnAudio) ||
+        (iCursorLocation == ECursorOnEmptyAudioTrack) )
+        {
+        iAudioCursorPos = aCurrentIndex;
+        }
+    else
+        {
+        iVideoCursorPos = aCurrentIndex;
+        }
+    }
+
+void CVeiEditVideoContainer::NotifyVideoClipAdded( CVedMovie& /*aMovie*/, 
+                                                        TInt aIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipAdded: in");
+
+    CStoryboardVideoItem* item=0;
+
+    if ( iView.WaitMode() == CVeiEditVideoView::EDuplicating )
+        {
+        TTimeIntervalMicroSeconds cutInTime = iMovie.VideoClipCutInTime( aIndex - 1 );
+        TTimeIntervalMicroSeconds cutOutTime = iMovie.VideoClipCutOutTime( aIndex - 1 );
+
+        iMovie.VideoClipSetColorEffect( aIndex, iMovie.VideoClipColorEffect( aIndex - 1 ) );
+        iMovie.VideoClipSetColorTone( aIndex, iMovie.VideoClipColorTone( aIndex - 1 ) );                
+        iMovie.SetVideoClipVolumeGainL(aIndex, iMovie.GetVideoClipVolumeGainL(aIndex - 1));
+
+        iMovie.VideoClipSetSpeed( aIndex, iMovie.VideoClipSpeed( aIndex - 1 ) );
+        iMovie.VideoClipSetMuted( aIndex, iMovie.VideoClipIsMuted( aIndex - 1 ) );
+
+        TBool isFile(iMovie.VideoClipInfo( aIndex )->Class() == EVedVideoClipClassFile);
+        if ( isFile )
+            {
+            iMovie.VideoClipSetCutInTime( aIndex, cutInTime );
+            iMovie.VideoClipSetCutOutTime( aIndex, cutOutTime );
+            }
+        /* Copy bitmaps, names etc. to new storyboarditem. */
+        TRAP_IGNORE( item = CStoryboardVideoItem::NewL( 
+            *iVideoItemArray[aIndex-1]->iIconBitmap, 
+            *iVideoItemArray[aIndex-1]->iIconMask, 
+            *iVideoItemArray[aIndex-1]->iFilename, 
+            iVideoItemArray[aIndex-1]->iIsFile,
+            *iVideoItemArray[aIndex-1]->iAlbumName ) );
+        if (item)
+            {
+            item->InsertLastFrameL( *iVideoItemArray[aIndex-1]->iLastFrameBitmap,
+                *iVideoItemArray[aIndex-1]->iLastFrameMask );
+            item->InsertTimelineFrameL( *iVideoItemArray[aIndex-1]->iTimelineBitmap,
+                *iVideoItemArray[aIndex-1]->iTimelineMask );
+
+            iVideoItemArray.Insert( item, aIndex );
+            }
+
+        iVideoCursorPos = aIndex;
+        iCursorLocation = ECursorOnClip; 
+        DrawDeferred();
+        iView.SetWaitMode( CVeiEditVideoView::ENotWaiting );
+        SetCursorLocation( CursorLocation() );
+        return;
+        }
+
+    iCurrentlyProcessedIndex = aIndex;
+    TFileName fileName;
+
+    TBool isFile(iMovie.VideoClipInfo( aIndex )->Class() == EVedVideoClipClassFile);
+    if ( isFile )
+        {
+        fileName = iMovie.VideoClipInfo( aIndex )->FileName();
+        }
+    else
+        {
+        CVedVideoClipInfo* info = iMovie.VideoClipInfo( aIndex );
+
+        if (info->Class() == EVedVideoClipClassGenerated) 
+            {
+            if (info->Generator()->Uid() == KUidTitleClipGenerator) 
+                {
+                fileName = iMovie.VideoClipInfo( aIndex )->DescriptiveName();
+                }
+            else if (info->Generator()->Uid() == KUidImageClipGenerator) 
+                {
+                CVeiImageClipGenerator* generator = STATIC_CAST(CVeiImageClipGenerator*, info->Generator());
+                fileName = generator->ImageFilename();
+                }
+            }
+        }
+
+    TFileName albumName;
+    GetAlbumL( fileName, albumName );
+
+    TRAPD( error, (item = CStoryboardVideoItem::NewL( *iNoThumbnailIcon, 
+        *iNoThumbnailIconMask, fileName, isFile, albumName )) );
+
+    if ( error == KErrNone )
+        {
+        iVideoItemArray.Insert( item, iCurrentlyProcessedIndex );
+    
+        iVideoCursorPos = aIndex;
+        iCursorLocation = ECursorOnClip; 
+        iZoomFactorX = 0;
+        iZoomFactorY = 0;
+
+        TRAPD( frameError, StartFrameTakerL( aIndex ) );
+        if ( frameError )
+            {
+            iMovie.RemoveVideoClip( aIndex );
+            iView.ShowErrorNote( R_VEI_VIDEO_FAILED );
+            iView.CancelWaitDialog();
+            iView.AddNext();
+            }
+        }
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipAdded: out");
+    }
+
+void CVeiEditVideoContainer::NotifyVideoClipAddingFailed( CVedMovie& 
+                /*aMovie*/, TInt DEBUGLOG_ARG(aError) )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipAddingFailed: In and Out, aError:%d", aError);
+    }
+
+void CVeiEditVideoContainer::NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo,
+                                                      TInt aError )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipInfoReady: In, aError:%d", aError);
+    // video info ready, get thumbnail
+    if (KErrNone == aError)
+        {   
+        if (iTempVideoInfo)     
+            {
+            delete iTempVideoInfo;
+            iTempVideoInfo = NULL;  
+            }
+        iTempVideoInfo = &aInfo;
+        TSize thumbResolution;
+        thumbResolution = iVideoDisplay->GetScreenSize();
+        /* Check if cursor is on transition. When editvideocontainer is activated
+            and right key is pressed very fast application crashes without this check */
+
+        TInt currentIndex;
+        currentIndex = CurrentIndex();
+
+        if ( iCursorLocation == ECursorOnTransition )
+            {
+            currentIndex--;
+            }
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipInfoReady: 1");
+        //we are in preview mode.
+        if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview )
+            {
+            return;
+            }
+        
+        TTimeIntervalMicroSeconds cutInTime = iMovie.VideoClipCutInTime( currentIndex );
+        TTimeIntervalMicroSeconds cutOutTime = iMovie.VideoClipCutOutTime( currentIndex );
+
+        TInt firstThumbNailIndex = iTempVideoInfo->GetVideoFrameIndexL( cutInTime );    
+    //  TInt lastThumbNailIndex = aInfo.GetVideoFrameIndexL( cutOutTime );    
+    //  lastThumbNailIndex--;   
+
+        TDisplayMode thumbnailDisplayMode( ENone ); 
+
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipInfoReady: 2");                        
+        /* :
+         check out on every phone before releasing whether videodisplay should be stopped before starting
+         asynchronous GetFrameL()
+         see how EStateGettingFrame is handled in SetPreviewState 
+         Stopping frees memory and it is needed in memory sensible devices 
+        */
+        TRAPD( err, iTempVideoInfo->GetFrameL( *this, firstThumbNailIndex, &thumbResolution, 
+            thumbnailDisplayMode ) );
+        if (KErrNone == err)
+            {
+            SetPreviewState(EStateGettingFrame);    
+            }       
+        LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipInfoReady: 3, err:%d", err);    
+        if ( KErrNone != err )
+            {
+            if ( iProgressDialog )
+                {
+                iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 );
+                TRAP_IGNORE( iProgressDialog->ProcessFinishedL() );
+                //iProgressDialog = NULL;
+                }
+            User::Panic( _L("VideoEditor"), 65 );
+            }
+        }
+    
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipInfoReady: Out");  
+    }
+
+void CVeiEditVideoContainer::NotifyVideoClipFrameCompleted(CVedVideoClipInfo& /*aInfo*/, 
+                                               TInt aError, 
+                                               CFbsBitmap* aFrame)
+    {
+    LOGFMT2(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipFrameCompleted: In, aError:%d, iTakeSnapshot:%d", aError, iTakeSnapshot);  
+    
+    iFrameReady = ETrue;
+        
+    if (EStateGettingFrame == iPreviewState)
+        {
+        SetPreviewState(iPreviousPreviewState); 
+        // SetEditorState is effective because iPreviewState is changed     
+        iView.SetEditorState( iView.EditorState() );
+        }       
+
+    if(KErrNone == aError && aFrame)
+        {
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipFrameCompleted: 3 calling iVideoDisplay->ShowPictureL()"); 
+        //TRAP_IGNORE(iVideoDisplay->ShowPictureL( *aFrame ));
+
+        if ( iTakeSnapshot)
+            {
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipFrameCompleted: 2");   
+
+            // For some reason some phones crash in taking snapshot if this progress note is started 
+            // earlier from TakeSnapshotL, that is why it is started now here
+            //StartProgressDialogL(R_VEI_PROGRESS_NOTE_WITH_CANCEL, R_VEI_PROGRESS_NOTE_SAVING_IMAGE);
+            iConverter->SetBitmap( aFrame );
+            SaveSnapshotL();
+            return;         
+            }
+        TRAP_IGNORE(iVideoDisplay->ShowPictureL( *aFrame ));    
+        delete aFrame;
+        aFrame = NULL;  
+        if (iProgressDialog )
+            {
+            iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 );
+            TRAP_IGNORE( iProgressDialog->ProcessFinishedL() );
+            //iProgressDialog = NULL;       
+            }
+        DrawDeferred();
+        if (iTakeSnapshotWaiting)
+            {
+            if (! iCallBack)
+                {       
+                TCallBack cb (CVeiEditVideoContainer::AsyncTakeSnapshot, this);
+                iCallBack = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard);
+                }
+            iCallBack->CallBack();              
+            }
+        return;
+        }   
+    
+    if ( aFrame )
+        {
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipFrameCompleted: 4");
+        delete aFrame;
+        aFrame = NULL;  
+        }
+    
+    if (iProgressDialog )
+        {
+        iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 );
+        TRAP_IGNORE( iProgressDialog->ProcessFinishedL() );
+        //iProgressDialog = NULL;       
+        }
+    else if ( KErrNone == aError)
+        {
+        iView.HandleCommandL( EAknSoftkeyOk );
+        }
+/* In case of an error, we'll do nothing. */
+/* If clip is too short, we won't get new thumbnail, so use old one->return; */
+    if (KErrNone != aError)
+        {
+        iCurrentlyProcessedIndex = -1;
+        return;
+        }
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipFrameCompleted: Out");     
+    }
+
+void CVeiEditVideoContainer::NotifyVideoClipGeneratorSettingsChanged(CVedMovie& /*aMovie*/,
+                                                         TInt aIndex) 
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipGeneratorSettingsChanged: In");        
+    iCurrentlyProcessedIndex = aIndex;
+    StartFrameTakerL( aIndex );
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipGeneratorSettingsChanged: Out");       
+    }
+
+void CVeiEditVideoContainer::NotifyVideoClipDescriptiveNameChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/)
+    {   
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipDescriptiveNameChanged: In");      
+    TFileName fileName;
+    fileName = iMovie.VideoClipInfo( CurrentIndex() )->DescriptiveName();
+    iInfoDisplay->SetName(fileName);
+    iVideoDisplay->DrawDeferred();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipDescriptiveNameChanged: Out");     
+    }
+
+void CVeiEditVideoContainer::NotifyMovieQualityChanged(CVedMovie& /*aMovie*/)
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMovieQualityChanged: In and Out");      
+    }
+void CVeiEditVideoContainer::NotifyVideoClipRemoved( 
+                                    CVedMovie& /*aMovie*/, TInt aIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipRemoved: In");     
+    CStoryboardVideoItem* item = iVideoItemArray[ aIndex ];
+    iVideoItemArray.Remove( aIndex );
+    delete item;
+    SetCursorLocation( ECursorOnClip );
+    DrawDeferred();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipRemoved: Out");        
+    }
+
+void CVeiEditVideoContainer::NotifyVideoClipIndicesChanged( 
+                    CVedMovie& /*aMovie*/, TInt aOldIndex, TInt aNewIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipIndicesChanged: In");      
+    CStoryboardVideoItem* item = iVideoItemArray[ aOldIndex ];
+    iVideoItemArray.Remove( aOldIndex );    
+    iVideoItemArray.Insert( item, aNewIndex );
+    DrawDeferred();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipIndicesChanged: Out");     
+    }
+
+void CVeiEditVideoContainer::NotifyVideoClipTimingsChanged( 
+                                    CVedMovie& aMovie, TInt aIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipTimingsChanged: In");      
+    /* Check is slowmotion on */
+    if ( iMovie.VideoClipSpeed( iVideoCursorPos ) != 1000 )
+        {
+        iEffectSymbols->SetSlowMotionIconVisibility(ETrue);
+        }
+    else
+        {
+        // Engine sets mute automatically on if speed is set under 1000, but it does not return
+        // mute state to original if speed is reset to 1000, reclaimed to nokia
+        // problem is that we should respect user's mute settings prior to slow motion
+        // i.e. when removing slow motion mute settings should be reset to user defined value
+    //  iMovie.VideoClipSetMuted(aIndex, EFalse);
+        iEffectSymbols->SetSlowMotionIconVisibility(EFalse);
+        }
+    /* If SM is on, audio is muted */
+    if ((iMovie.VideoClipIsMuted(aIndex) != EFalse) || 
+            (iMovie.VideoClipEditedHasAudio(aIndex) == EFalse))
+        {       
+        iEffectSymbols->SetVolumeMuteIconVisibility(ETrue); 
+        }
+    else
+        {       
+        iEffectSymbols->SetVolumeMuteIconVisibility(EFalse);
+        }
+
+    TTimeIntervalMicroSeconds editedDuration = aMovie.VideoClipEditedDuration( aIndex );
+    
+    iInfoDisplay->SetDuration( editedDuration );
+
+    DrawTrackBoxes();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipTimingsChanged: Out");     
+    }
+    
+void CVeiEditVideoContainer::NotifyVideoClipColorEffectChanged( 
+                                    CVedMovie& /*aMovie*/, TInt aIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipColorEffectChanged: In");      
+
+    if ( iView.WaitMode() != CVeiEditVideoView::EDuplicating )
+        TRAP_IGNORE( UpdateThumbnailL( aIndex ) );
+
+    SetColourToningIcons(aIndex);   
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipColorEffectChanged: Out");     
+    }
+
+void CVeiEditVideoContainer::NotifyVideoClipAudioSettingsChanged( 
+                                    CVedMovie& /*aMovie*/, TInt aIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipAudioSettingsChanged: In");        
+    /* Check is Mute on */
+    if ((iMovie.VideoClipIsMuted(aIndex) != EFalse) || 
+            (iMovie.VideoClipEditedHasAudio(aIndex) == EFalse))
+        {       
+        iEffectSymbols->SetVolumeMuteIconVisibility(ETrue); 
+        }
+    else
+        {
+        iEffectSymbols->SetVolumeMuteIconVisibility(EFalse);
+        }
+    DrawDeferred();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipAudioSettingsChanged: Out");       
+    }
+
+void CVeiEditVideoContainer::NotifyStartTransitionEffectChanged( 
+                                                    CVedMovie& aMovie )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyStartTransitionEffectChanged: In");     
+    iInfoDisplay->SetName( *iTransitionInfo->StartTransitionName( aMovie.StartTransitionEffect() ) );
+        
+    ShowStartAnimationL( aMovie.StartTransitionEffect() );
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyStartTransitionEffectChanged: Out");        
+    }
+
+void CVeiEditVideoContainer::NotifyMiddleTransitionEffectChanged( 
+                                    CVedMovie& aMovie, TInt aIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMiddleTransitionEffectChanged: In");        
+    iInfoDisplay->SetName( *iTransitionInfo->MiddleTransitionName( aMovie.MiddleTransitionEffect( aIndex ) ) );
+
+    ShowMiddleAnimationL( aMovie.MiddleTransitionEffect( aIndex ) );
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMiddleTransitionEffectChanged: Out");       
+    }
+
+void CVeiEditVideoContainer::NotifyEndTransitionEffectChanged( 
+                                                    CVedMovie& aMovie )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyEndTransitionEffectChanged: In");       
+    iInfoDisplay->SetName( *iTransitionInfo->EndTransitionName( aMovie.EndTransitionEffect() ) );
+    ShowEndAnimationL( aMovie.EndTransitionEffect() );
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyEndTransitionEffectChanged: Out");      
+    }
+
+void CVeiEditVideoContainer::NotifyAudioClipAdded( 
+                                            CVedMovie& aMovie, TInt aIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipAdded: In");
+    CStoryboardAudioItem* item;
+/*  When audio clip is duplicated, check if original was recorded.
+    TMPXXXXX.XXX name is not shown on main pane if iRecordedAudio is ETrue.
+**/
+    if ( (aIndex > 0 ) && (iView.WaitMode() == CVeiEditVideoView::EDuplicating ))
+        {   
+        if ( iAudioItemArray[aIndex-1]->iRecordedAudio == 1 )
+            {
+            iRecordedAudio = ETrue; 
+            }
+        }
+    
+    if (CVeiEditVideoView::EDuplicating == iView.WaitMode())
+        {   
+        //copy adjust volume parameter from original clip (aIndex - 1)
+        TReal adjustVolume = aMovie.GetAudioClipVolumeGainL(aIndex-1);
+        aMovie.SetAudioClipVolumeGainL(aIndex, (TInt)(adjustVolume));
+        }   
+    item = CStoryboardAudioItem::NewLC( iRecordedAudio,
+                        aMovie.AudioClipInfo( aIndex )->FileName() );
+
+    iAudioCursorPos = aIndex;
+
+    iAudioItemArray.Insert( item, aIndex );
+    CleanupStack::Pop( item );
+
+    iView.SetWaitMode( CVeiEditVideoView::ENotWaiting );    
+    SetCursorLocation( ECursorOnAudio );
+    iRecordedAudio = EFalse;
+    DrawDeferred();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipAdded: Out");
+    }
+
+void CVeiEditVideoContainer::NotifyAudioClipAddingFailed( 
+                                    CVedMovie& /*aMovie*/, TInt DEBUGLOG_ARG(aError) )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipAddingFailed: In, aError:%d", aError);
+    DrawDeferred();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipAddingFailed: Out");
+    }
+
+void CVeiEditVideoContainer::NotifyAudioClipRemoved( 
+                                    CVedMovie& /*aMovie*/, TInt aIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipRemoved: In");
+    CStoryboardAudioItem* item = iAudioItemArray[aIndex];
+    iAudioItemArray.Remove(aIndex);
+    delete item;
+    SetCursorLocation( ECursorOnAudio );
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipRemoved: Out");
+    }
+
+void CVeiEditVideoContainer::NotifyAudioClipIndicesChanged( 
+                        CVedMovie& /*aMovie*/, TInt aOldIndex, TInt aNewIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipIndicesChanged: In");
+    CStoryboardAudioItem* item = iAudioItemArray[ aOldIndex ];
+    iAudioItemArray.Remove( aOldIndex );
+    TInt err = iAudioItemArray.Insert( item, aNewIndex );
+    if ( err != KErrNone )
+        {
+        TBuf<30>buf;
+        buf.Format( _L("Audio clip moving failed (%d)."), err );
+        }
+
+    iAudioCursorPos = aNewIndex;
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipIndicesChanged: Out");
+    }
+
+void CVeiEditVideoContainer::NotifyAudioClipTimingsChanged( 
+                                CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+    {   
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipTimingsChanged: In");
+    IsAudioClipCutted();
+    DrawDeferred();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipTimingsChanged: Out");
+    }
+
+void CVeiEditVideoContainer::NotifyMovieReseted( CVedMovie& /*aMovie*/ )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMovieReseted: In");
+    iAudioItemArray.ResetAndDestroy();
+    iVideoItemArray.ResetAndDestroy();
+    iVideoCursorPos = 0;
+    iAudioCursorPos = 0;
+    iCursorLocation = ECursorOnClip;
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMovieReseted: Out");
+    }
+
+void CVeiEditVideoContainer::NotifyMovieOutputParametersChanged(CVedMovie& /*aMovie*/)
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyMovieOutputParametersChanged: In and Out");
+    // @
+    }
+
+void CVeiEditVideoContainer::NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, 
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+    {
+    // @
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipDynamicLevelMarkInserted: In and out");
+    }
+
+void CVeiEditVideoContainer::NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyAudioClipDynamicLevelMarkRemoved: In and out");
+    // @
+    }
+
+void CVeiEditVideoContainer::NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/,
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipDynamicLevelMarkInserted: In and out");
+    // @
+    }
+
+void CVeiEditVideoContainer::NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoClipDynamicLevelMarkRemoved: In and out");
+    // @
+    }
+
+void CVeiEditVideoContainer::UpdateThumbnailL( TInt aIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::UpdateThumbnailL: In");
+    /*HBufC* stringholder;
+    
+    if (iProgressNote)
+    {
+        delete iProgressNote;
+        iProgressNote = NULL;   
+    }
+    
+    iProgressNote = 
+        new (ELeave) CAknProgressDialog(REINTERPRET_CAST(CEikDialog**, 
+        &iProgressNote), ETrue);
+    iProgressNote->SetCallback(this);
+    
+    if( iView.WaitMode() == CVeiEditVideoView::EProcessingMovieForCutting )
+        {
+        stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_CUTTING_VIDEO, iEikonEnv );
+        }
+    else
+        {
+        stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_COLOR_EFFECT, iEikonEnv );
+        }
+        
+    iProgressNote->ExecuteDlgLD( R_VEI_PROGRESS_NOTE );
+    iProgressNote->SetTextL( *stringholder );
+    CleanupStack::PopAndDestroy( stringholder );
+
+    iProgressNote->GetProgressInfoL()->SetFinalValue(100);
+    */
+    TInt resid; 
+    if( iView.WaitMode() == CVeiEditVideoView::EProcessingMovieForCutting )
+        {
+        resid = R_VEI_PROGRESS_NOTE_CUTTING_VIDEO;
+        }
+    else
+        {
+        resid = R_VEI_PROGRESS_NOTE_COLOR_EFFECT;
+        }
+    StartProgressDialogL(R_VEI_PROGRESS_NOTE, resid);
+
+    iCurrentlyProcessedIndex = iVideoCursorPos; 
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::UpdateThumbnailL: 2");
+    StartFrameTakerL( aIndex );
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::UpdateThumbnailL: Out");
+    }
+
+// ---------------------------------------------------------
+// CVeiEditVideoContainer::ConvertBW(CFbsBitmap& aBitmap)     
+// ---------------------------------------------------------
+//
+void CVeiEditVideoContainer::ConvertBW( CFbsBitmap& aBitmap ) const
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConvertBW: In");
+    TInt width =  aBitmap.SizeInPixels().iWidth;
+    TInt height = aBitmap.SizeInPixels().iHeight;
+
+    TBitmapUtil bitmapUtil( &aBitmap );
+    bitmapUtil.Begin( TPoint(0,0) );
+
+    for ( TInt y=0;y<height;y++ )
+        {
+        for ( TInt x=0;x<width;x++ )
+            {
+            bitmapUtil.SetPos( TPoint( x,y ) );
+
+            TUint32 colorr = ( bitmapUtil.GetPixel() );
+
+            TRgb vari = TRgb::Color64K( colorr );
+
+            TInt red = vari.Red();
+            TInt green = vari.Green();
+            TInt blue = vari.Blue();
+            
+            TUint Yy = STATIC_CAST( TUint, red*0.299 + green*0.587 + blue*0.114 );
+
+            bitmapUtil.SetPixel( TRgb(Yy,Yy,Yy).Color64K() );
+            }
+        }
+    bitmapUtil.End();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConvertBW: Out");
+    }
+
+// ---------------------------------------------------------
+// CVeiEditVideoContainer::ConvertToning(CFbsBitmap& aBitmap)     
+// ---------------------------------------------------------
+//
+void CVeiEditVideoContainer::ConvertToning( CFbsBitmap& aBitmap ) const
+    {   
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConvertToning: In");
+//  TInt ind = CurrentIndex();
+    TRgb toning = iMovie.VideoClipColorTone(CurrentIndex());
+    
+    TInt width =  aBitmap.SizeInPixels().iWidth;
+    TInt height = aBitmap.SizeInPixels().iHeight;
+
+    TBitmapUtil bitmapUtil( &aBitmap );
+    bitmapUtil.Begin( TPoint(0,0) );
+    
+    TInt R_ct = toning.Red();
+    TInt G_ct = toning.Green();         
+    TInt B_ct = toning.Blue();      
+                
+    /*
+    //vihreä
+    TInt R_ct = 185;
+    TInt G_ct = 255;            
+    TInt B_ct = 0;          
+    */
+    
+    TInt kr =   45808*R_ct - 38446*G_ct -  7362*B_ct + 32768;
+    TInt kg = - 19496*R_ct + 26952*G_ct -  3750*B_ct + 32768;
+    TInt kb = - 19608*R_ct - 38184*G_ct + 57792*B_ct + 32768;  
+
+    for ( TInt y=0;y<height;y++ )
+        {
+        for ( TInt x=0;x<width;x++ )
+            {
+            bitmapUtil.SetPos( TPoint( x,y ) );
+                                                                                
+            TUint32 colorr = ( bitmapUtil.GetPixel() );
+            TRgb vari = TRgb::Color64K( colorr );
+        
+            TInt alpha = 19668*vari.Red() + 38442*vari.Green() + 7450*vari.Blue(); 
+            TInt R_out = (alpha + kr)>>16;
+            TInt G_out = (alpha + kg)>>16;
+            TInt B_out = (alpha + kb)>>16;                          
+            
+            if(R_out<0) R_out=0;  if(R_out>255) R_out=255;
+            if(G_out<0) G_out=0;  if(G_out>255) G_out=255;
+            if(B_out<0) B_out=0;  if(B_out>255) B_out=255;                      
+
+            bitmapUtil.SetPixel( TRgb(R_out,G_out,B_out).Color64K() );
+            }
+        }
+    bitmapUtil.End();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::ConvertToning: Out");
+    }
+    
+    
+// ---------------------------------------------------------
+// CVeiEditVideoContainer::HandleControlEventL(
+//     CCoeControl* aControl,TCoeEvent aEventType)
+// ---------------------------------------------------------
+//
+void CVeiEditVideoContainer::HandleControlEventL(
+    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
+    {
+    // : Add your control event handler code here
+    }
+
+// ----------------------------------------------------------------------------
+// CVeiEditVideoContainer::HandlePointerEventL
+// From CCoeControl
+// ----------------------------------------------------------------------------
+//		
+void CVeiEditVideoContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
+	{
+	LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::HandlePointerEventL(): In" );
+    	
+	if( AknLayoutUtils::PenEnabled() )
+		{
+		CCoeControl::HandlePointerEventL( aPointerEvent );
+				
+		switch( aPointerEvent.iType )
+			{
+			case TPointerEvent::EButton1Down:
+				{
+				LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::HandlePointerEventL(): EButton1Down" );
+								
+                // Initialise the touch related member variables
+				iIsVideoDrag = EFalse;
+				iIsVideoTapped = EFalse;
+				
+				// the user taps the timeline bar				
+				if( iVideoBarBox.Contains( aPointerEvent.iPosition ) )
+					{
+					iCursorLocation = ECursorOnClip;
+                    HandleVideoTimelineTouchL( aPointerEvent );
+					}
+				// the user double-taps the cut bar
+				else if (( iDummyCutBar->Rect().Contains( aPointerEvent.iPosition )) &&
+				         ( aPointerEvent.iModifiers & EModifierDoubleClick ))
+				    {
+                    // open cut view    
+                    iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoCutting );
+				    }
+				// : the user double taps the thumbnail	(wait for the layout data)			
+				// : the user taps the transition arrows (wait for the layout data)
+				
+				// the volume adjustment view is active and the user taps the volume slider
+				else if (( EModeAdjustVolume == iSelectionMode ) && 
+				         ( iVerticalSlider->Rect().Contains( aPointerEvent.iPosition )))
+				    {
+				    HandleVolumeSliderTouchL( aPointerEvent );
+				    }
+				break;
+				}
+			case TPointerEvent::EDrag:
+				{
+				LOGFMT( KVideoEditorLogFile, "CVeiEditVideoContainer::HandlePointerEventL(): \
+				                              EDrag, iIsVideoTapped = %d", iIsVideoTapped );				
+				                              
+                // video drag takes effect only when the pointer has gone down inside a 
+                // video clip (i.e. iIsVideoTapped == ETrue)
+				if ( iVideoBarBox.Contains( aPointerEvent.iPosition ) && ( iIsVideoTapped ))
+	    			{
+	    			iIsVideoDrag = ETrue;
+                    HandleVideoTimelineTouchL( aPointerEvent );
+                    }
+				// the volume adjustment view is active and the user taps the volume slider
+				else if (( EModeAdjustVolume == iSelectionMode ) && 
+				         ( iVerticalSlider->Rect().Contains( aPointerEvent.iPosition )))
+				    {
+				    HandleVolumeSliderTouchL( aPointerEvent );
+				    }                    
+                break;		
+                }
+			case TPointerEvent::EButton1Up:
+				{				    
+				// pen up event is handled if it was dragged
+				if (iIsVideoDrag)
+					{
+                    iIsVideoDrag = EFalse;   
+					// pressed position is inside the timeline bar
+					if( iVideoBarBox.Contains( aPointerEvent.iPosition ) )
+						{
+						HandleVideoTimelineTouchL( aPointerEvent );
+						}						
+				    else
+				        {
+				        // the new position indicator has to be removed from the UI
+				        iNewClipPosition = iClickedClip;
+                        DrawNow();
+				        }
+					}
+					
+				break;
+				}		
+			default:
+				{
+				break;	
+				}	
+			}
+		}	
+	LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::HandlePointerEventL(): Out" );		
+	}
+
+
+// ----------------------------------------------------------------------------
+// CVeiEditVideoContainer::HandleVideoTimelineTouchL
+// 
+// ----------------------------------------------------------------------------
+//	
+void CVeiEditVideoContainer::HandleVideoTimelineTouchL( TPointerEvent aPointerEvent )
+	{
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVideoTimelineTouchL(): In" );
+    	
+    CVeiEditVideoView::TEditorState state = iView.EditorState();
+
+	if (( AknLayoutUtils::PenEnabled() ) && 
+	    ( state!=CVeiEditVideoView::EPreview ) && 
+	    ( state!=CVeiEditVideoView::EQuickPreview ))
+		{	
+        
+        LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVideoTimelineTouchL, \
+                                     iClickedClip:%d", iClickedClip );
+				
+		// move video clip by dragging
+		if ( aPointerEvent.iType == TPointerEvent::EDrag )
+		    {
+		    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVideoTimelineTouchL, EDrag, \
+		                                 aPointerEvent.iPosition.iX = %d", aPointerEvent.iPosition.iX );
+		    
+		    // Find the clip that includes the current pointer position. 
+		    TInt clipIncludingDrag = FindClickedClip( aPointerEvent.iPosition.iX );
+		    
+		    // the pen is inside the same clip where it went down
+		    if (( clipIncludingDrag == iClickedClip ))
+		        {
+		        // the new position indicator has to be removed from UI
+                iNewClipPosition = iClickedClip; 		            
+		        }
+	        
+	        // the pen is on the empty part of the timeline
+	        else if ( aPointerEvent.iPosition.iX > iEmptyVideoTimeLineRect.iTl.iX ) 
+	            {
+	            // the last clip can't be moved right
+	            if ( iClickedClip < iMovie.VideoClipCount() - 1 )
+		            {
+		            iNewClipPosition = iMovie.VideoClipCount() - 1;
+		            }
+	            }
+   		    // the pen is on the left end of a video clip
+		    else if (( clipIncludingDrag >= 0) &&
+		             ( iVideoItemRectArray[ clipIncludingDrag ].Contains( TPoint( aPointerEvent.iPosition.iX, iVideoBarBox.Center().iY ))) && 
+		             ( aPointerEvent.iPosition.iX <= iVideoItemRectArray[ clipIncludingDrag ].iTl.iX + iVideoItemRectArray[ clipIncludingDrag ].Width()/2 ))
+		        {
+    		    // moving a clip from left to right
+    		    if (( iClickedClip < clipIncludingDrag ) && ( iClickedClip < clipIncludingDrag - 1 ))
+    		        {
+        		    iNewClipPosition = clipIncludingDrag - 1;
+    		        }
+    		    // moving a clip from right to left
+    		    else if ( iClickedClip > clipIncludingDrag )
+    		        {
+        		    iNewClipPosition = clipIncludingDrag;
+    		        }
+    		    else
+    		        {
+    		        iNewClipPosition = iClickedClip;    
+    		        }
+		        }
+		    // the pen is on the right end of a video clip
+		    else if (( clipIncludingDrag >= 0) &&
+          		     ( iVideoItemRectArray[ clipIncludingDrag ].Contains( TPoint( aPointerEvent.iPosition.iX, iVideoBarBox.Center().iY ))) && 
+		             ( aPointerEvent.iPosition.iX > iVideoItemRectArray[ clipIncludingDrag ].iTl.iX + iVideoItemRectArray[ clipIncludingDrag ].Width()/2 ))
+		        {
+    		    // moving a clip from left to right
+    		    if (( iClickedClip < clipIncludingDrag ))
+    		        {
+        		    iNewClipPosition = clipIncludingDrag;
+    		        }
+    		    // moving a clip from right to left
+    		    else if ( iClickedClip > clipIncludingDrag + 1)
+    		        {
+        		    iNewClipPosition = clipIncludingDrag + 1;
+    		        }
+    		    else
+    		        {
+    		        iNewClipPosition = iClickedClip;    
+    		        }
+		        }
+		    }
+		    
+		// pen up event after dragging
+        else if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
+            {
+            iMovie.VideoClipSetIndex( iClickedClip, iNewClipPosition );    
+            if ( iVideoCursorPos != iNewClipPosition ) // eliminates blinking of the already selected clip
+                {
+                iVideoCursorPos = iNewClipPosition;
+                SetCursorLocation( ECursorOnClip );                                        
+                }
+
+            }
+        // user taps a clip
+		else if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) 
+		    {
+			CalculateVideoClipRects();	
+
+            iClickedClip = FindClickedClip( aPointerEvent.iPosition.iX );
+            iNewClipPosition = iClickedClip;
+				    
+		    if ( iClickedClip >= 0 )
+		        {
+		        iIsVideoTapped = ETrue;
+		        if ( iClickedClip != iVideoCursorPos ) // eliminates blinking of the already selected clip
+			        {  
+                    iVideoCursorPos = iClickedClip;
+                    SetCursorLocation( ECursorOnClip );        
+                    }
+		        }
+		    }
+
+        // : when the user clicks a transition marker, the transition view should open
+        
+        DrawNow();
+		LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVideoTimelineTouchL(): Out" );
+			
+		}// PenEnabled
+		
+	}
+
+
+// ----------------------------------------------------------------------------
+// CVeiEditVideoContainer::HandleVolumeSliderTouchL
+// 
+// ----------------------------------------------------------------------------
+//	
+void CVeiEditVideoContainer::HandleVolumeSliderTouchL( TPointerEvent aPointerEvent )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeSliderTouchL in");    
+
+    // calculate the new slider position
+    TInt newSliderPosition;
+    TInt volumeSliderSteps = KVolumeSliderMax - KVolumeSliderMin + 1;
+    TInt pointerPosInSlider = aPointerEvent.iPosition.iY - iVerticalSlider->Rect().iTl.iY;
+    newSliderPosition = (( volumeSliderSteps * pointerPosInSlider ) / iVerticalSlider->Rect().Height()) + KVolumeSliderMin;            
+    
+    iVerticalSlider->SetPosition( newSliderPosition);
+    iVerticalSlider->DrawNow();
+    
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeSliderTouchL out");        
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiEditVideoContainer::ClipContainingClick
+// 
+// ----------------------------------------------------------------------------
+//	
+TInt CVeiEditVideoContainer::FindClickedClip( TInt aPressedPointX )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::FindClickedClip in"); 
+	// Video Timeline start and end points, and length
+	TInt timelineLeftEnd( iVideoBarBox.iTl.iX );
+	TInt timelineRightEnd( iVideoBarBox.iBr.iX );
+	TInt totalPBLength( timelineRightEnd - timelineLeftEnd );
+
+    // check which part of the timeline contains the click
+    TInt clickedClip = -1;
+    TInt i = 0;
+    while (( clickedClip < 0) && ( i < iMovie.VideoClipCount() ))
+        {
+        if ( ( aPressedPointX > iVideoItemRectArray[i].iTl.iX ) && 
+             ( aPressedPointX < iVideoItemRectArray[i].iBr.iX ))
+            {
+            clickedClip = i;    
+            }
+        else
+            {
+            i++;
+            }
+        }		
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::FindClickedClip out");         
+    return clickedClip;
+    }
+            
+            
+
+void CVeiEditVideoContainer::SetCursorLocation( TCursorLocation aCursorLocation ) 
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::SetCursorLocation in");   
+    
+    iCursorLocation = aCursorLocation; 
+    
+    if ( iView.EditorState() == CVeiEditVideoView::EMixAudio)
+        {       
+        iVideoDisplay->MakeVisible( ETrue );
+        iVideoDisplay->SetRect( iVideoDisplayBox ); 
+        iVideoDisplay->ShowPictureL(*iAudioMixingIcon);
+        iInfoDisplay->MakeVisible(EFalse);
+        iHorizontalSlider->MakeVisible(ETrue);
+        return;
+        }           
+    
+    iTransitionDisplayLeft->MakeVisible( EFalse );
+    iTransitionDisplayRight->MakeVisible( EFalse );
+    iDummyCutBarLeft->MakeVisible( EFalse );
+    iInfoDisplay->SetRect( iInfoDisplayBox );
+    iEffectSymbols->MakeVisible( EFalse );
+    if (CVeiEditVideoContainer::EModeSlowMotion != iSelectionMode)
+        {
+        // currently slow motion wastes processing time in background
+        iVideoDisplay->StopAnimation(); 
+        }   
+
+    if ( iCursorLocation == ECursorOnClip && iInfoDisplay )
+        {
+        iVideoDisplay->MakeVisible( ETrue );
+        iVideoDisplay->SetRect( iVideoDisplayBox ); 
+
+        if ( iMovie.VideoClipCount() > 0 )
+            {
+            if ( (iVideoCursorPos > (iMovie.VideoClipCount()-1)))
+                {
+                iVideoCursorPos--;
+                }
+
+            TParse parser;
+
+            parser.Set( iVideoItemArray[ CurrentIndex() ]->iFilename->Des(), NULL, NULL );          
+            iVideoDisplay->ShowPictureL( *iVideoItemArray[CurrentIndex()]->iIconBitmap,
+                    *iVideoItemArray[CurrentIndex()]->iIconMask );              
+                
+            iDummyCutBar->SetRect( iDummyCutBarBox );
+            iDummyCutBar->Dim( EFalse );
+
+            // : start using LAF data when it is available
+            // iDummyCutBar->Rect() == (80, 160, 273, 204) includes the scissor icon and the progress bar
+            iDummyCutBar->SetComponentRect( CVeiCutterBar::EProgressBar, TRect(115, 160,273,204)); 
+            iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, TRect(115, 160,135,204) );
+            iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon,  TRect(135,160,244,204) );
+            iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon,TRect(244,160,273,204) );                        
+            iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedLeftEndIcon, TRect(115, 160,135,204) );
+            iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon,  TRect(135,160,244,204) );
+            iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedRightEndIcon,TRect(244,160,273,204) );                     
+            iDummyCutBar->SetComponentRect( CVeiCutterBar::EScissorsIcon, TRect(80, 167,110,197) );
+            iDummyCutBar->SetComponentRect( CVeiCutterBar::ECutAreaBorderIcon,TRect(115,160,124,204) );            
+
+            TTimeIntervalMicroSeconds clipDuration = iMovie.VideoClipInfo( CurrentIndex())->Duration();
+            TTimeIntervalMicroSeconds clipCutInTime = iMovie.VideoClipCutInTime( CurrentIndex() );
+            TTimeIntervalMicroSeconds clipCutOutTime = iMovie.VideoClipCutOutTime( CurrentIndex() );
+
+            iDummyCutBar->SetTotalDuration( clipDuration );
+            iDummyCutBar->SetInPoint( clipCutInTime );
+            iDummyCutBar->SetOutPoint( clipCutOutTime );
+
+            TTime       fileModified;
+
+            RFs& fs = iEikonEnv->FsSession();
+            if ( parser.ExtPresent() )
+                {
+                fs.Modified( *iVideoItemArray[CurrentIndex()]->iFilename, fileModified );
+                }
+            else
+                {
+                fileModified = iVideoItemArray[CurrentIndex()]->iDateModified;
+                }
+
+            if ( VideoEditorUtils::IsLandscapeScreenOrientation() ) //Landscape     
+                {
+                iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything );
+                }
+            else
+                {
+                iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration );
+                }
+
+            iInfoDisplay->SetLocation( *iVideoItemArray[CurrentIndex()]->iAlbumName );
+
+            TFileName clipName = parser.Name();
+            TTimeIntervalMicroSeconds editedDuration = iMovie.VideoClipEditedDuration( CurrentIndex() );
+            iInfoDisplay->MakeVisible( ETrue );
+
+            if( !CurrentClipIsFile() )
+                {
+                TFileName fileName;
+                fileName = iMovie.VideoClipInfo( CurrentIndex() )->DescriptiveName();
+                iInfoDisplay->SetName(fileName);
+                }
+            else
+                {
+                iInfoDisplay->SetName( clipName );
+                }
+
+            iInfoDisplay->SetDuration( editedDuration );
+            iInfoDisplay->SetTime( fileModified );
+
+            // *** IconBox drawing ****
+            // indicator icons are hidden in preview state 
+            CVeiEditVideoView::TEditorState state = iView.EditorState();
+            if (state != CVeiEditVideoView::EPreview && state != CVeiEditVideoView::EQuickPreview)
+                {
+                if ((iMovie.VideoClipIsMuted(iVideoCursorPos) != EFalse) || 
+                    (iMovie.VideoClipEditedHasAudio(iVideoCursorPos) == EFalse))
+                    {               
+                    iEffectSymbols->SetVolumeMuteIconVisibility(ETrue); 
+                    }
+                else
+                    {               
+                    iEffectSymbols->SetVolumeMuteIconVisibility(EFalse);    
+                    }
+            
+                if ( iMovie.VideoClipSpeed( iVideoCursorPos ) != 1000 )
+                    {
+                    iEffectSymbols->SetSlowMotionIconVisibility(ETrue);
+                    }
+                else
+                    {
+                    iEffectSymbols->SetSlowMotionIconVisibility(EFalse);    
+                    }
+
+                SetColourToningIcons(iVideoCursorPos);
+
+                iEffectSymbols->MakeVisible( ETrue );
+                iEffectSymbols->SetRect( iEffectSymbolBox );
+                }
+            }
+        else
+            {
+            iInfoDisplay->SetLayout( CVeiTextDisplay::EOnlyName );
+            iVideoDisplay->ShowBlankScreen();
+            
+            iDummyCutBar->Dim( ETrue );
+            HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NO_VIDEO, iEikonEnv );
+            iInfoDisplay->SetName( *stringholder );         
+            CleanupStack::PopAndDestroy( stringholder );
+            }
+        StartZooming();
+        }
+    else if ( iCursorLocation == ECursorOnEmptyVideoTrack )
+        {
+        iVideoDisplay->MakeVisible( ETrue );
+        iVideoDisplay->SetRect( iVideoDisplayBox );
+        iDummyCutBar->SetRect( iDummyCutBarBox );
+        iDummyCutBar->Dim( ETrue );
+        iDummyCutBar->MakeVisible( EFalse); 
+        
+        iInfoDisplay->SetLayout( CVeiTextDisplay::EOnlyName );
+        iVideoDisplay->ShowBlankScreen();
+        iInfoDisplay->MakeVisible( ETrue );
+
+        HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NO_VIDEO, iEikonEnv );
+        iInfoDisplay->SetName( *stringholder );         
+        CleanupStack::PopAndDestroy( stringholder );
+        }
+    else if (( iCursorLocation == ECursorOnAudio ) &&
+            (( iSelectionMode == EModeRecordingSetStart ) ||
+             ( iSelectionMode == EModeRecording )))
+        {
+        HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NEW_AUDIO, iEikonEnv );
+
+        iVideoDisplay->MakeVisible( ETrue );
+        iInfoDisplay->MakeVisible( ETrue );
+        iInfoDisplay->SetName( *stringholder );     
+        iVideoDisplay->ShowPictureL( *iAudioIcon );
+        
+        iEffectSymbols->SetVolumeMuteIconVisibility( EFalse );
+        iEffectSymbols->SetBlackAndWhiteIconVisibility( EFalse );
+        iEffectSymbols->SetColourIconVisibility( EFalse );
+        iEffectSymbols->SetSlowMotionIconVisibility( EFalse );  
+
+        iVideoDisplay->SetRect( iVideoDisplayBox ); 
+        iDummyCutBar->SetRect( iDummyCutBarBox );
+
+        if ( iSelectionMode == EModeRecordingSetStart )
+            {
+            TTimeIntervalMicroSeconds duration = TTimeIntervalMicroSeconds(0);
+            iInfoDisplay->SetDuration( duration );
+            }
+        else
+            {
+            iInfoDisplay->SetDuration( iRecordedAudioDuration );
+            }
+        CleanupStack::PopAndDestroy( stringholder );
+        }
+    else if ( iCursorLocation == ECursorOnAudio )
+        {
+
+        iVideoDisplay->MakeVisible( ETrue );
+        iEffectSymbols->SetVolumeMuteIconVisibility( EFalse );
+        iEffectSymbols->SetBlackAndWhiteIconVisibility( EFalse );
+        iEffectSymbols->SetColourIconVisibility( EFalse );
+        iEffectSymbols->SetSlowMotionIconVisibility( EFalse );
+
+        iVideoDisplay->SetRect( iVideoDisplayBox ); 
+        iDummyCutBar->SetRect( iDummyCutBarBox );
+
+        if ( iMovie.AudioClipCount() > 0 )
+            {
+
+            CVedAudioClipInfo* audioclipinfo = iMovie.AudioClipInfo( CurrentIndex() );
+
+            TTimeIntervalMicroSeconds audioClipEditedDuration = iMovie.AudioClipEditedDuration( CurrentIndex() );
+            TTimeIntervalMicroSeconds audioClipDuration = audioclipinfo->Duration();
+            TTimeIntervalMicroSeconds audioClipCutInTime = iMovie.AudioClipCutInTime( CurrentIndex() );
+            TTimeIntervalMicroSeconds audioClipCutOutTime = iMovie.AudioClipCutOutTime( CurrentIndex() );
+            
+            iDummyCutBar->Dim( EFalse );
+
+            iDummyCutBar->SetTotalDuration( audioClipDuration );
+            iDummyCutBar->SetInPoint( audioClipCutInTime );
+            iDummyCutBar->SetOutPoint( audioClipCutOutTime );
+
+            TParse parser;
+            parser.Set( *iAudioItemArray[CurrentIndex()]->iFilename, NULL, NULL );          
+            iVideoDisplay->ShowPictureL( *iAudioIcon );
+
+            TTime       fileModified;
+
+            RFs& fs = iEikonEnv->FsSession();
+            fs.Modified( parser.FullName(), fileModified );
+
+            if ( VideoEditorUtils::IsLandscapeScreenOrientation() ) //Landscape     
+                {
+                iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything );
+                }
+            else
+                {
+                iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration );
+                }
+            TFileName audioClipName;
+
+            if ( iAudioItemArray[CurrentIndex()]->iRecordedAudio )
+                {
+                HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NEW_AUDIO, iEikonEnv );
+                audioClipName = *stringholder;
+                CleanupStack::PopAndDestroy( stringholder );
+                }
+            else
+                {
+                audioClipName = parser.Name();
+                }
+
+            iInfoDisplay->MakeVisible( ETrue );
+            iInfoDisplay->SetName( audioClipName );
+            iInfoDisplay->SetDuration( audioClipEditedDuration );
+            iInfoDisplay->SetTime( fileModified );
+            }
+        else
+            {
+            iVideoDisplay->MakeVisible( ETrue );
+            iInfoDisplay->SetLayout( CVeiTextDisplay::EOnlyName );
+            iVideoDisplay->ShowBlankScreen();
+            iDummyCutBar->Dim( ETrue );
+            iInfoDisplay->MakeVisible( ETrue );
+            HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NO_AUDIO, iEikonEnv );
+            iInfoDisplay->SetName( *stringholder );         
+            CleanupStack::PopAndDestroy( stringholder );
+            }
+        StartZooming();
+        }
+    else if ( iCursorLocation == ECursorOnTransition )
+        {
+        iVideoDisplay->MakeVisible( ETrue );
+        iTransitionDisplayLeft->MakeVisible( ETrue );
+        iTransitionDisplayRight->MakeVisible( ETrue );
+
+        TTimeIntervalMicroSeconds clipDuration;
+        TTimeIntervalMicroSeconds clipCutInTime;
+        TTimeIntervalMicroSeconds clipCutOutTime;
+
+        TInt nextIndex;
+        nextIndex = iVideoCursorPos;
+
+        if ( ( nextIndex < iMovie.VideoClipCount() ) ) // video on both sides OR no video on the left hand side 
+            {
+            CStoryboardVideoItem* item = iVideoItemArray[ nextIndex ];
+    
+            iConverter->ScaleL( item->iIconBitmap, item->iIconBitmap, iTransitionDisplayRight->GetScreenSize() );
+
+            clipDuration = iMovie.VideoClipInfo( nextIndex )->Duration();
+            clipCutInTime = iMovie.VideoClipCutInTime( nextIndex );
+            clipCutOutTime = iMovie.VideoClipCutOutTime( nextIndex );
+
+            iDummyCutBar->Dim( EFalse );
+            iDummyCutBar->SetTotalDuration( clipDuration );
+            iDummyCutBar->SetInPoint( clipCutInTime );
+            iDummyCutBar->SetOutPoint( clipCutOutTime );
+            }
+        else // no video on the right hand side 
+            {
+            iTransitionDisplayRight->ShowBlankScreen();
+            iDummyCutBar->Dim( ETrue );
+            }
+        nextIndex--;
+                
+        if ( nextIndex >= 0 ) // video on both sides OR no video on the right hand side 
+            {
+            CStoryboardVideoItem* item = iVideoItemArray[ nextIndex ];
+            if ( item->iLastFrameBitmap != NULL )
+                {               
+                iTransitionDisplayLeft->ShowPictureL( *item->iLastFrameBitmap, *item->iLastFrameMask);
+                }
+            iDummyCutBarLeft->Dim( EFalse );
+
+            clipDuration = iMovie.VideoClipInfo( nextIndex )->Duration();
+            clipCutInTime = iMovie.VideoClipCutInTime( nextIndex );
+            clipCutOutTime = iMovie.VideoClipCutOutTime( nextIndex );
+
+            iDummyCutBarLeft->SetTotalDuration( clipDuration );
+            iDummyCutBarLeft->SetInPoint( clipCutInTime );
+            iDummyCutBarLeft->SetOutPoint( clipCutOutTime );
+            }
+        else // no video on the left hand side
+            {
+            iTransitionDisplayLeft->ShowBlankScreen();
+            iDummyCutBarLeft->Dim( ETrue );
+            }
+
+        iVideoDisplay->ShowBlankScreen();
+
+        iVideoDisplay->SetRect( iVideoDisplayBoxOnTransition );
+        iDummyCutBar->SetRect( iDummyCutBarBoxOnTransition ); 
+        
+        // : start using LAF data when it is available
+        // iDummyCutBar->Rect() == (321, 107, 433, 151) includes the scissor icon and the progress bar
+        iDummyCutBar->SetComponentRect( CVeiCutterBar::EProgressBar, TRect(355,107,433,151)); 
+        iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, TRect(355,107,360 ,151) );
+        iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon,  TRect(360,107,400 ,151) );
+        iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon,TRect(400,107,433 ,151) );                    
+        iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedLeftEndIcon, TRect(355,107,360 ,151) );
+        iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon,  TRect(360,107,400 ,151) );
+        iDummyCutBar->SetComponentRect( CVeiCutterBar::ESliderSelectedRightEndIcon,TRect(400,107,433 ,151) );            
+        iDummyCutBar->SetComponentRect( CVeiCutterBar::EScissorsIcon, TRect(321,107,350 ,151) );
+        iDummyCutBar->SetComponentRect( CVeiCutterBar::ECutAreaBorderIcon,TRect(321,107,350 ,151) );                        
+
+        iDummyCutBarLeft->MakeVisible( ETrue );
+        iDummyCutBarLeft->SetPosition( TPoint(iTransitionDisplayLeftBox.iTl.iX,
+            iTransitionDisplayLeftBox.iBr.iY- iVideoDisplay->GetBorderWidth() ) );
+        iDummyCutBarLeft->SetSize( TSize( iTransitionDisplayLeftBox.Width(), iDummyCutBarBox.Height() ) );
+
+        // : start using LAF data when it is available
+        // iDummyCutBarLeft->Rect() == (5, 107, 117, 151) includes the scissor icon and the progress bar
+        iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::EProgressBar, TRect(35,107,117,151)); 
+        iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, TRect(35,107,55 ,151) );
+        iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon,  TRect(55,107,100 ,151) );
+        iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon,TRect(100,107,117 ,151) );                    
+        iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderSelectedLeftEndIcon, TRect(35,107,55 ,151) );
+        iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon,  TRect(55,107,100 ,151) );
+        iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ESliderSelectedRightEndIcon,TRect(100,107,117 ,151) );                    
+        iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::EScissorsIcon, TRect(5,107,30 ,151) );
+        iDummyCutBarLeft->SetComponentRect( CVeiCutterBar::ECutAreaBorderIcon,TRect(5,107,30 ,151) );                        
+
+        ArrowsControl();
+
+        if ( iVideoCursorPos == 0 )
+            {
+            ShowStartAnimationL( iMovie.StartTransitionEffect() );
+            iInfoDisplay->SetName( *iTransitionInfo->StartTransitionName( iMovie.StartTransitionEffect() ) );
+            }
+        else if ( iVideoCursorPos == iMovie.VideoClipCount() )
+            {
+            iInfoDisplay->SetName( *iTransitionInfo->EndTransitionName( iMovie.EndTransitionEffect() ) );
+            ShowEndAnimationL( iMovie.EndTransitionEffect() );
+            }
+        else
+            {           
+            iInfoDisplay->SetName( *iTransitionInfo->MiddleTransitionName( iMovie.MiddleTransitionEffect( CurrentIndex() - 1 ) ) );
+            ShowMiddleAnimationL( iMovie.MiddleTransitionEffect( CurrentIndex() - 1 ) );
+            }
+        StartZooming();
+        }
+    else if ( iCursorLocation == ECursorOnEmptyAudioTrack )
+        {
+        iVideoDisplay->MakeVisible( ETrue );
+        iInfoDisplay->SetLayout( CVeiTextDisplay::EOnlyName );
+        iVideoDisplay->ShowBlankScreen();
+        iInfoDisplay->MakeVisible( ETrue );
+
+        HBufC* stringholder = StringLoader::LoadLC( R_VEI_EDIT_VIEW_NO_AUDIO, iEikonEnv );
+        iInfoDisplay->SetName( *stringholder );         
+        CleanupStack::PopAndDestroy( stringholder );
+
+        iVideoDisplay->SetRect( iVideoDisplayBox );
+        iDummyCutBar->SetRect( iDummyCutBarBox );
+        iDummyCutBar->Dim( ETrue );
+        }
+    if ( iView.EditorState() == CVeiEditVideoView::EQuickPreview)
+        {
+        TFileName newname;
+        TVeiSettings movieSaveSettings;
+        STATIC_CAST( CVeiAppUi*, iEikonEnv->AppUi() )->ReadSettingsL( movieSaveSettings );  
+        newname.Append( movieSaveSettings.DefaultVideoName() );
+        iInfoDisplay->SetName( newname );
+
+        TTimeIntervalMicroSeconds tempFileDuration;
+        tempFileDuration = iVideoDisplay->TotalLengthL();
+        iInfoDisplay->SetDuration( tempFileDuration );
+        }
+    /*if ( iView.EditorState() == CVeiEditVideoView::EMixAudio)
+        {       
+        
+        //iHorizontalSliderSize = TSize(iHorizontalSlider->MinimumSize().iWidth, 50);
+        //  iHorizontalSliderPoint = TPoint( videoScreenX - 25, + videoScreenY + videoScreenSize.iHeight + 70); 
+        iHorizontalSlider->SetExtent( iHorizontalSliderPoint, iHorizontalSliderSize );              
+        iHorizontalSlider->MakeVisible(ETrue);
+        iHorizontalSlider->DrawDeferred();
+        iVideoDisplay->ShowPictureL(*iAudioMixingIcon);
+        }   
+        */
+    }
+
+TBool CVeiEditVideoContainer::CurrentClipIsFile()
+    {
+    if ( (iCursorLocation == ECursorOnClip) && (iMovie.VideoClipCount() > 0 ) )
+        {
+        return iVideoItemArray[ CurrentIndex() ]->iIsFile;
+        }
+    else
+        return EFalse;
+    }
+
+
+void CVeiEditVideoContainer::ShowMiddleAnimationL( TVedMiddleTransitionEffect aMiddleEffect )
+    {
+    switch( aMiddleEffect )
+        {
+        case EVedMiddleTransitionEffectNone:
+            iVideoDisplay->StopAnimation();
+            break;
+        case EVedMiddleTransitionEffectDipToBlack:
+            iVideoDisplay->ShowAnimationL( R_VEI_DIP_TO_BLACK_ANIMATION );
+            break;
+        case EVedMiddleTransitionEffectDipToWhite:
+            iVideoDisplay->ShowAnimationL( R_VEI_DIP_TO_WHITE_ANIMATION );
+            break;
+        case EVedMiddleTransitionEffectCrossfade:
+            iVideoDisplay->ShowAnimationL( R_VEI_CROSSFADE_ANIMATION );
+            break;
+        case EVedMiddleTransitionEffectWipeLeftToRight:
+            iVideoDisplay->ShowAnimationL( R_VEI_WIPE_LEFT_ANIMATION );
+            break;
+        case EVedMiddleTransitionEffectWipeRightToLeft:
+            iVideoDisplay->ShowAnimationL( R_VEI_WIPE_RIGHT_ANIMATION );
+            break;
+        case EVedMiddleTransitionEffectWipeTopToBottom:
+            iVideoDisplay->ShowAnimationL( R_VEI_WIPE_TOP_TO_BOTTOM_ANIMATION );
+            break;
+        case EVedMiddleTransitionEffectWipeBottomToTop:
+            iVideoDisplay->ShowAnimationL( R_VEI_WIPE_BOTTOM_TO_TOP_ANIMATION );
+            break;
+        default:
+            break;
+        }
+    }
+
+
+void CVeiEditVideoContainer::ShowStartAnimationL( TVedStartTransitionEffect aStartEffect )
+    {
+    switch( aStartEffect )
+        {
+        case EVedStartTransitionEffectNone:
+            iVideoDisplay->StopAnimation();
+            break;
+        case EVedStartTransitionEffectFadeFromBlack:
+            iVideoDisplay->ShowAnimationL( R_VEI_FADE_FROM_BLACK_ANIMATION );
+            break;
+        case EVedStartTransitionEffectFadeFromWhite:
+            iVideoDisplay->ShowAnimationL( R_VEI_FADE_FROM_WHITE_ANIMATION );
+            break;
+        default:
+            break;
+        }
+    }
+
+void CVeiEditVideoContainer::ShowEndAnimationL( TVedEndTransitionEffect aEndEffect )
+    {
+    switch( aEndEffect )
+        {
+        case EVedEndTransitionEffectNone:
+            iVideoDisplay->StopAnimation();
+            break;
+        case EVedEndTransitionEffectFadeToBlack:
+            iVideoDisplay->ShowAnimationL( R_VEI_FADE_TO_BLACK_ANIMATION );
+            break;
+        case EVedEndTransitionEffectFadeToWhite:
+            iVideoDisplay->ShowAnimationL( R_VEI_FADE_TO_WHITE_ANIMATION );
+            break;
+        default:
+            break;
+        }
+    }
+
+
+void CVeiEditVideoContainer::NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo  )
+    {
+    LOGFMT4(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() In, \
+                aEvent:%d, iFullScreenSelected:%d, iView.EditorState():%d, iPreviewState:%d", \
+                aEvent, iFullScreenSelected, iView.EditorState(), iPreviewState);
+
+    if (EStateTerminating == iPreviewState)
+        {
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent(): app is closing...");
+        return;
+        }
+
+    switch (aEvent)
+        {
+        case MVeiVideoDisplayObserver::ELoadingStarted:
+            {
+            SetPreviewState(EStateOpening);     
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::ELoadingStarted");            
+            break;
+            }
+        case MVeiVideoDisplayObserver::EOpenComplete:
+            {
+            LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EOpenComplete 1:%Ld", iVideoDisplay->PositionL().Int64());
+                
+            iCursorPreviousLocation = CursorLocation();
+            
+            if ( !iFullScreenSelected )
+                {
+                TRAP_IGNORE( (/*iTempVideoInfo =*/ CVedVideoClipInfo::NewL( *iTempFileName,*this) ) );
+                
+                //for draw function
+                iCursorLocation = ECursorOnClip;
+                }
+
+            if ( CVeiEditVideoView::EPreview == iView.EditorState() )//Large preview
+                {
+                TRect wholeScreenRect = iView.ClientOrApplicationRect( iFullScreenSelected );
+                SetRect( iView.ClientOrApplicationRect( iFullScreenSelected ) );
+                iVideoDisplay->SetRect( wholeScreenRect );  
+
+                if ( !VideoEditorUtils::IsLandscapeScreenOrientation() ) //Portrait
+                    {
+                    iVideoDisplay->SetRotationL( EVideoRotationClockwise90 );                           
+                    }
+                
+                if ( iView.IsForeground() )
+                    {
+                    iVideoDisplay->ShowBlackScreen();
+                    DrawDeferred();
+                    if ( iTempVideoInfo && !iFrameReady)
+                        {                           
+                        iTempVideoInfo->CancelFrame();
+                        }
+                    iVideoDisplay->Play();      
+                    }
+                else
+                    {
+                    iView.SetEditorState( CVeiEditVideoView::EEdit );
+                    SetBlackScreen( EFalse );
+                    iView.SetFullScreenSelected( EFalse );
+                    iVideoDisplay->Stop( ETrue ); 
+                    }           
+                    
+                }       
+             else //Small preview
+                {
+                iVideoDisplay->SetRect( iVideoDisplayBox );
+                iInfoDisplay->SetRect( iInfoDisplayBox );
+                iVideoDisplay->SetRotationL( EVideoRotationNone );        
+
+                if ( !VideoEditorUtils::IsLandscapeScreenOrientation() ) //Portrait
+                    {
+                    iInfoDisplay->SetLayout( CVeiTextDisplay::ENameAndDuration );
+                    iInfoDisplay->MakeVisible( ETrue );
+                    }
+                else //Landscape
+                    {
+                    iInfoDisplay->SetLayout( CVeiTextDisplay::EEverything );
+                    iInfoDisplay->MakeVisible( ETrue );
+                    }
+                
+                if ( iView.IsForeground() )
+                    {
+                    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EOpenComplete 2");
+                    iVideoDisplay->ShowBlackScreen();
+                    DrawDeferred();
+                    if ( iTempVideoInfo && !iFrameReady)
+                        {                           
+                        iTempVideoInfo->CancelFrame();
+                        }
+                    iVideoDisplay->Play();                          
+                    }
+                else
+                    {
+                    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EOpenComplete 3");                    
+                    PauseVideoL();
+                    }           
+                }
+            break;
+            }                                                                                           
+        case MVeiVideoDisplayObserver::EBufferingStarted:
+            {
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EBufferingStarted");          
+            SetPreviewState( EStateBuffering );
+            if ( iPeriodic )
+                {
+                iPeriodic->Cancel();
+                }
+            break;
+            }
+        case MVeiVideoDisplayObserver::ELoadingComplete:
+            {
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::ELoadingComplete 1");                     
+            
+            if (EStatePaused == iPreviewState)
+                {
+                iVideoDisplay->PauseL();    
+                }
+            else
+                {
+                SetPreviewState( EStatePlaying );           
+            
+                if (iFullScreenSelected)
+                    {               
+                    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::ELoadingComplete 2");
+                    iView.SetEditorState( CVeiEditVideoView::EPreview);
+                    }
+                else 
+                    {               
+                    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::ELoadingComplete 3");
+                    iView.SetEditorState( CVeiEditVideoView::EQuickPreview);
+                    DrawDeferred();
+                    iVideoDisplay->ShowBlackScreen();
+                    iScreenLight->Start();
+                    const TUint delay = 100000;             
+                    iPeriodic->Start( delay, delay, TCallBack( CVeiEditVideoContainer::UpdatePosition, this ) );
+                    TRAP_IGNORE(iView.StartNaviPaneUpdateL()); 
+                    }
+                }
+            break;
+            }
+        case MVeiVideoDisplayObserver::EPlayComplete:
+            {
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EPlayComplete 1");
+            iScreenLight->Stop();
+            if ( iPeriodic )
+                {
+                iPeriodic->Cancel();
+                }
+            
+            if ( !iFullScreenSelected )
+                {
+                SetPreviewState(EStateStopped);
+                
+                iLastPosition = iVideoDisplay->TotalLengthL();
+                iSeekPos = TTimeIntervalMicroSeconds( 0 );
+                
+                SetFinishedStatus( ETrue );
+                LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EPlayComplete 2");                
+                GetThumbAtL(0);  
+                LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EPlayComplete 3"); 
+                
+                iView.SetEditorState( CVeiEditVideoView::EQuickPreview );
+                iView.StopNaviPaneUpdateL();
+                }
+            else
+                {
+                if (EModeMixingAudio != iSelectionMode)
+                    {                                               
+                    iView.SetEditorState( CVeiEditVideoView::EEdit );                   
+                    }
+                else
+                    {
+                    iView.SetEditorState(CVeiEditVideoView::EMixAudio);                 
+                    }
+                                
+                SetBlackScreen( EFalse );
+                iView.SetFullScreenSelected( EFalse );
+                iVideoDisplay->Stop( ETrue ); 
+                DrawDeferred();
+                }
+            
+            if (KErrNoMemory == aInfo || KErrSessionClosed == aInfo)
+                {
+                LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EPlayComplete 4");
+                iView.ShowGlobalErrorNote( aInfo );
+                StopVideo(ETrue);               
+                }  
+            
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EPlayComplete 5");
+            break;
+            }
+        case MVeiVideoDisplayObserver::EStop:
+            {
+            LOGFMT3(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop 1, \
+            iFullScreenSelected:%d, iSelectionMode:%d, iCloseStream:%d", \
+            iFullScreenSelected, iSelectionMode, iCloseStream);  
+            
+            if ( iPeriodic )
+                {                
+                iPeriodic->Cancel();
+                }
+            iView.StopNaviPaneUpdateL();    
+                
+            if (EStateGettingFrame == iPreviewState)
+                {
+                break;  
+                }
+            // position must be set here to 0 because state EStateGettingFrame cannot be resoluted in player                    
+            // and position must not be set to 0 in that state
+            iVideoDisplay->SetPositionL(TTimeIntervalMicroSeconds( 0 ));
+                                               
+            if ( iFullScreenSelected || iCloseStream )
+                {
+                LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop 4");
+                SetPreviewState(EStateClosed);                
+                iVideoDisplay->SetBlackScreen( EFalse );
+                iDummyCutBar->MakeVisible( ETrue );
+                
+                if (EModeMixingAudio != iSelectionMode)
+                    {                                   
+                    iView.SetEditorState( CVeiEditVideoView::EEdit );
+                    SetSelectionMode( EModeNavigation );
+                    }
+                else
+                    {
+                    iView.SetEditorState(CVeiEditVideoView::EMixAudio);
+                    break;
+                    }
+                SetCursorLocation( iCursorPreviousLocation );
+                LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop 5");
+                DrawDeferred();
+                iCloseStream = EFalse;
+                break;
+                }
+                
+            if (EModeMixingAudio != iSelectionMode)
+                {   
+                LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop 2");
+                GetThumbAtL(0); 
+                LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop 3");
+                }    
+
+            SetPreviewState(EStateStopped);            
+            iLastPosition = iVideoDisplay->TotalLengthL();
+            iSeekPos = TTimeIntervalMicroSeconds( 0 );
+            iView.DoUpdateEditNaviLabelL();
+            SetFinishedStatus( ETrue );
+            iView.SetEditorState( CVeiEditVideoView::EQuickPreview );
+            // redraw needed at least to erase pause icon
+            DrawDeferred();            
+            break;
+            }
+        case MVeiVideoDisplayObserver::EVolumeLevelChanged:
+            {
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EVolumeLevelChanged 1");
+            TInt playerVolume = iVideoDisplay->Volume();
+            iView.ShowVolumeLabelL( playerVolume );
+            break;
+            }
+        case MVeiVideoDisplayObserver::EError:
+            {
+            LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EError 1");
+            iView.ShowGlobalErrorNote( aInfo );         
+            if (KErrMMAudioDevice  == aInfo)
+                {
+                PauseVideoL();  
+                }
+            else
+                {
+                StopVideo(ETrue);
+                }               
+            break;
+            }                           
+        default:
+            {
+            LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() default case, aEvent:%d", aEvent);
+            };
+        }
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyVideoDisplayEvent() Out");
+    }
+
+
+void CVeiEditVideoContainer::StartFrameTakerL( TInt aIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartFrameTakerL: In");
+
+// First frame is shown in main display so it is bigger.. Last frame is always
+// on transition display and one frame for the video timeline.
+    TSize firstThumbResolution = iVideoDisplay->GetScreenSize();
+    TSize lastThumbResolution = iTransitionDisplayLeft->GetScreenSize();
+    TSize timelineThumbResolution = TSize( 34, /*iVideoBarBox.Height()-2*/28 );
+    
+    TTimeIntervalMicroSeconds cutInTime = iMovie.VideoClipCutInTime( aIndex );
+    TTimeIntervalMicroSeconds cutOutTime = iMovie.VideoClipCutOutTime( aIndex );
+
+
+    TInt frameCount = iMovie.VideoClipInfo(aIndex)->VideoFrameCount();
+
+    TInt firstThumbNailIndex =  iMovie.VideoClipInfo(aIndex)->GetVideoFrameIndexL( cutInTime ); 
+    TInt lastThumbNailIndex =  iMovie.VideoClipInfo(aIndex)->GetVideoFrameIndexL( cutOutTime );    
+    if ( lastThumbNailIndex >= frameCount )
+        {
+        lastThumbNailIndex = frameCount-1;
+        }
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartFrameTakerL: 2");
+
+    iFrameTaker->GetFramesL( *iMovie.VideoClipInfo(aIndex), 
+            firstThumbNailIndex, &firstThumbResolution,
+            lastThumbNailIndex, &lastThumbResolution, 
+            firstThumbNailIndex, &timelineThumbResolution,
+            EPriorityLow );
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartFrameTakerL: Out");          
+    }
+
+void CVeiEditVideoContainer::NotifyFramesCompleted( CFbsBitmap* aFirstFrame, 
+                                       CFbsBitmap* aLastFrame,  CFbsBitmap* aTimelineFrame,  TInt aError )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyFramesCompleted: In, aError:%d", aError);
+    CStoryboardVideoItem* item;
+    if( aError==KErrNone )
+        {
+        if ( iMovie.VideoClipColorEffect( iVideoCursorPos ) == EVedColorEffectBlackAndWhite ) 
+            {
+            ConvertBW( *aFirstFrame );
+            ConvertBW( *aLastFrame );
+            ConvertBW( *aTimelineFrame );
+            }
+        if ( iMovie.VideoClipColorEffect( iVideoCursorPos ) == EVedColorEffectToning ) 
+            {
+            //TRgb toning = iMovie.VideoClipColorTone(CurrentIndex());
+            ConvertToning(*aFirstFrame);
+            ConvertToning(*aLastFrame);
+            ConvertToning(*aTimelineFrame);
+            }   
+
+        item = iVideoItemArray[ iCurrentlyProcessedIndex ];
+        TRAP_IGNORE( 
+            item->InsertLastFrameL( *aLastFrame, *aLastFrame );
+            item->InsertFirstFrameL( *aFirstFrame, *aFirstFrame );
+            item->InsertTimelineFrameL( *aTimelineFrame, *aTimelineFrame );         
+            iVideoDisplay->ShowPictureL( *item->iIconBitmap, *item->iIconMask);
+            );
+
+        // UpdateThumbnail launches progressnote. 
+        if (iProgressDialog )
+            {
+            iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 );
+            TRAP_IGNORE( iProgressDialog->ProcessFinishedL() );
+            //iProgressDialog = NULL;           
+            }
+        iView.HandleCommandL( EAknSoftkeyOk );
+        }
+        
+    // UpdateThumbnail launches progressnote. 
+    if (iProgressDialog )
+        {
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyFramesCompleted: 2");
+        iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 );
+        TRAP_IGNORE( iProgressDialog->ProcessFinishedL() );
+        //iProgressDialog = NULL;
+        }   
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyFramesCompleted: 3");
+    iCurrentlyProcessedIndex = -1;
+    iView.SetWaitMode( CVeiEditVideoView::ENotWaiting );
+    SetCursorLocation( CursorLocation() );
+    
+    iView.CancelWaitDialog(aError);
+    iView.AddNext();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyFramesCompleted: Out");         
+    }
+
+void CVeiEditVideoContainer::NotifyCompletion( TInt DEBUGLOG_ARG(aErr) )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyCompletion: In, err:%d", aErr);
+
+    if (EStateTerminating == iPreviewState)
+        {
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyCompletion(): app is closing...");
+        return;
+        }
+
+    if ( iTakeSnapshot )
+        {
+        //  to eliminate previous (wrong) output file from being deleted in CancelSnapshotSave()    
+        delete iSaveToFileName;
+        iSaveToFileName = NULL;
+        
+        if ( iProgressDialog )
+            {
+            iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 );
+            TRAP_IGNORE( iProgressDialog->ProcessFinishedL() );
+            //iProgressDialog = NULL;
+            }
+        return;
+        }
+    
+    TRAP_IGNORE(iTransitionDisplayRight->ShowPictureL( *iConverter->GetBitmap()));
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::NotifyCompletion: Out");          
+    }
+
+void CVeiEditVideoContainer::SetSlowMotionStartValueL(TInt aSlowMotionStartValue)
+    {       
+    iSlowMotionValue = aSlowMotionStartValue; 
+    iArrowsDisplay->SetSlowMotionPreset( iSlowMotionValue / 10 );
+    
+    TInt frameInterval = (1000-iSlowMotionValue)/2;
+
+    iVideoDisplay->ShowAnimationL( R_VEI_SLOW_MOTION_ANIMATION, frameInterval );
+    }
+
+void CVeiEditVideoContainer::SetRecordedAudioDuration( const TTimeIntervalMicroSeconds& aDuration )
+    {
+    iRecordedAudioDuration = aDuration;
+        
+    if ( (iCursorLocation==ECursorOnTransition) && (CurrentIndex() > 0) )
+        {
+        iVideoCursorPos--;
+        }
+    iInfoDisplay->SetLayout( CVeiTextDisplay::ERecording ); // Name and duration RED
+    iInfoDisplay->SetDuration( iRecordedAudioDuration );
+    }
+
+
+TBool CVeiEditVideoContainer::IsAudioClipCutted()
+    {       
+        TTimeIntervalMicroSeconds audioClipDuration = iMovie.AudioClipInfo( CurrentIndex())->Duration();
+        TTimeIntervalMicroSeconds audioClipCutInTime = iMovie.AudioClipCutInTime( CurrentIndex() );
+        TTimeIntervalMicroSeconds audioClipCutOutTime = iMovie.AudioClipCutOutTime( CurrentIndex() );
+    
+        TTimeIntervalMicroSeconds appendTime(500000);
+        TTimeIntervalMicroSeconds cuttedAudioDuration = ( audioClipCutOutTime.Int64() - audioClipCutInTime.Int64() ) + appendTime.Int64();
+        iInfoDisplay->SetDuration( cuttedAudioDuration );
+
+        iDummyCutBar->SetTotalDuration( audioClipDuration );
+        iDummyCutBar->SetInPoint( audioClipCutInTime );
+        iDummyCutBar->SetOutPoint( audioClipCutOutTime );
+        iDummyCutBar->Dim( EFalse );
+
+        if ( ( audioClipCutOutTime.Int64() - audioClipCutInTime.Int64() ) == audioClipDuration.Int64() )
+            {
+            return EFalse;
+            }
+        else
+            {
+            return ETrue; 
+            }           
+    }
+
+/* Checks if aFilename is belongs to any album. Album name is returned, or KNullDesC
+if aFilename does not belong to album. */
+void CVeiEditVideoContainer::GetAlbumL( const TDesC& aFilename, TDes& aAlbumName ) const
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetAlbumL: in");
+
+    CMGAlbumManager* albumManager = MGAlbumManagerFactory::NewAlbumManagerL();
+    TInt albumCount = albumManager->AlbumCount();
+
+    // Get album Id 
+    for( TInt i=0;i<albumCount;i++ )
+        {
+        CMGAlbumInfo* albumInfo = albumManager->AlbumInfoLC( i );
+        TInt albumId = albumInfo->Id();
+        TInt itemCount = albumInfo->ItemCount();
+
+        TFileName albumName = albumInfo->Name();
+        CleanupStack::PopAndDestroy(albumInfo);
+
+        if ( itemCount > 0 )
+            {
+            TInt itemPos;
+            CDesCArrayFlat* filenameArray = new (ELeave) CDesCArrayFlat( itemCount );
+            CleanupStack::PushL (filenameArray);
+
+            albumManager->GetAlbumFileArrayL( albumId, *filenameArray );
+        
+            TInt isFound = filenameArray->Find( aFilename, itemPos );
+            CleanupStack::PopAndDestroy (filenameArray);
+
+            if ( isFound == KErrNone ) /* filename was found on filenamearray */
+                {
+                delete albumManager;
+                aAlbumName.Append(albumName);
+                LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetAlbumL: out1");
+                return;
+                }
+            }
+        }
+    delete albumManager;
+
+    aAlbumName = KNullDesC;
+    
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::GetAlbumL: out2");
+    }
+
+
+void CVeiEditVideoContainer::SetBlackScreen( TBool aBlack )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::SetBlackScreen: In, aBlack:%d", aBlack);
+
+    iBlackScreen = aBlack;
+
+    // Black backbround for the preview
+    if ( iBlackScreen )
+        {
+        iVideoDisplay->MakeVisible( EFalse );
+        /* Video Display components for transitioin state*/
+        iTransitionDisplayRight->MakeVisible( EFalse );
+        iTransitionDisplayLeft->MakeVisible( EFalse );
+
+        iDummyCutBar->MakeVisible( EFalse );
+        iDummyCutBarLeft->MakeVisible( EFalse );
+
+        /* IconBox */   
+        iEffectSymbols->MakeVisible( EFalse );
+        iInfoDisplay->MakeVisible( EFalse );
+        iArrowsDisplay->MakeVisible( EFalse );
+
+        iHorizontalSlider->MakeVisible( EFalse );
+        iVerticalSlider->MakeVisible( EFalse );
+    
+        if( iCursorLocation == ECursorOnTransition )
+            {
+            iVideoDisplay->StopAnimation();
+            }
+        }
+    else
+        {
+        SetCursorLocation( CursorLocation() );
+        }
+    DrawDeferred();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::SetBlackScreen: Out");
+    }
+
+TInt CVeiEditVideoContainer::SnapshotSize()
+    {
+    TInt sizeEstimate = 0;
+
+    if( iTempVideoInfo )
+        {       
+        TTimeIntervalMicroSeconds playBackPos = PlaybackPositionL();
+        TInt frame = iTempVideoInfo->GetVideoFrameIndexL( playBackPos );
+        sizeEstimate = iTempVideoInfo->VideoFrameSizeL( frame );
+        }
+
+    return sizeEstimate;
+    }
+
+TInt CVeiEditVideoContainer::AudioMixingRatio() const
+    {
+    return iHorizontalSlider->SliderPosition(); 
+    }
+
+
+TInt CVeiEditVideoContainer::Volume() const
+    {
+    return -(iVerticalSlider->SliderPosition());
+    }
+
+//=============================================================================
+void CVeiEditVideoContainer::SetColourToningIcons(TInt /*aIndex*/)
+    {
+    if ( ( iMovie.VideoClipColorEffect( iVideoCursorPos ) ) == EVedColorEffectBlackAndWhite )
+        {
+        iEffectSymbols->SetBlackAndWhiteIconVisibility(ETrue);
+        }
+    else
+        {
+        iEffectSymbols->SetBlackAndWhiteIconVisibility(EFalse);
+        }
+    if ( ( iMovie.VideoClipColorEffect( iVideoCursorPos ) ) == EVedColorEffectToning )
+        {
+        iEffectSymbols->SetColourIconVisibility(ETrue);
+        }
+    else
+        {
+        iEffectSymbols->SetColourIconVisibility(EFalse);
+        }
+    }
+//=======================================================================================================
+void CVeiEditVideoContainer::StartProgressDialogL(const TInt aDialogResId, const TInt aTextResId)
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartProgressDialogL: In");   
+    
+    if (iProgressDialog)
+        {       
+        LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartProgressDialogL: 1");
+        delete iProgressDialog;
+        iProgressDialog = NULL;
+        }
+    
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartProgressDialogL: 2");    
+    
+    iProgressDialog = new (ELeave) CAknProgressDialog( 
+        reinterpret_cast<CEikDialog**>(&iProgressDialog), ETrue );
+    iProgressDialog->PrepareLC(aDialogResId);   
+    iProgressDialog->SetCallback( this );   
+
+                                                        
+    HBufC* stringholder = StringLoader::LoadLC( aTextResId, iEikonEnv );
+    iProgressDialog->SetTextL( *stringholder );
+    CleanupStack::PopAndDestroy(stringholder);
+
+    iProgressDialog->GetProgressInfoL()->SetFinalValue( 100 );
+    iProgressDialog->RunLD();
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::StartProgressDialogL: Out");  
+    }
+
+//=============================================================================
+void CVeiEditVideoContainer::SetPreviewState(const TPreviewState aNewState)
+    {   
+    LOGFMT3(KVideoEditorLogFile, "CVeiEditVideoContainer::SetPreviewState In, aNewState:%d, iPreviewState:%d, iPreviousPreviewState:%d", aNewState, iPreviewState, iPreviousPreviewState);
+
+    if (EStateGettingFrame == aNewState)
+        {
+        iPreviousPreviewState = iPreviewState;                                  
+        }               
+    iPreviewState = aNewState;
+    iSeeking = EFalse;
+    
+    /*if (EStateTerminating != iPreviewState)
+        {
+        iView.SetEditorState( iView.EditorState() );    
+        }   
+        */
+
+    // Make sure that the pause indicator is drawn immediately
+    if (EStatePaused == iPreviewState)
+        {
+        DrawNow();
+        }
+
+    // While playing, grab the volume keys for adjusting playback volume.
+    // In other states let them pass e.g. to the music player.
+    if(EStatePlaying == aNewState)
+        {
+        if (!iRemConTarget)
+            {
+            // We can ignore the possible error - the if the remote connection
+            // fails, we just won't receive volume keys, which is a minor problem.
+            TRAPD(err, iRemConTarget = CVeiRemConTarget::NewL( *this ) );
+            if (KErrNone != err)
+                {
+                LOGFMT(KVideoEditorLogFile, "CVeiEditVideoContainer::SetPreviewState: CVeiRemConTarget::NewL failed: %d", err);
+                }
+            }
+        }
+    else
+        {
+        delete iRemConTarget;
+        iRemConTarget = NULL;
+        }
+    
+    // : implement #ifdef here to facilitate easy remove of unnecessary stopping    
+    //#ifdef STOP_PLAYER_DURING_GETFRAME
+    if (EStateGettingFrame == aNewState)
+        {   
+        /* :
+         check out on every phone before releasing whether videodisplay should be stopped before starting
+         asynchronous GetFrameL()
+         see how EStateGettingFrame is handled in SetPreviewState 
+         Stopping frees memory and it is needed in memory sensible devices 
+        */
+        //iVideoDisplay->Stop(ETrue);   
+        // SetEditorState is effective because iPreviewState is changed
+        iView.SetEditorState( iView.EditorState() );        
+        }
+    //#endif    
+    }
+
+//=============================================================================
+void CVeiEditVideoContainer::HandleVolumeUpL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeUpL: in");
+
+    iVideoDisplay->AdjustVolumeL( 1 );
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeUpL: out");
+    }
+
+//=============================================================================
+void CVeiEditVideoContainer::HandleVolumeDownL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeDownL: in");
+
+    iVideoDisplay->AdjustVolumeL( -1 );
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::HandleVolumeDownL: out");
+    }
+
+//=============================================================================
+void CVeiEditVideoContainer::PrepareForTerminationL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PrepareForTerminationL: in");
+
+    SetPreviewState( EStateTerminating );
+    iVideoDisplay->Stop(ETrue);
+    iScreenLight->Stop();
+
+    LOG(KVideoEditorLogFile, "CVeiEditVideoContainer::PrepareForTerminationL: out");
+    }
+
+//=============================================================================
+TInt CVeiEditVideoContainer::AsyncTakeSnapshot(TAny* aThis)
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::AsyncTakeSnapshot");
+    
+    // In the asynchronous version, trap the rest of the functions 
+    // to make sure that the caller's TRequestStatus is always 
+    // completed, also in case of failures.
+    CVeiEditVideoContainer* container = static_cast<CVeiEditVideoContainer*>(aThis);
+    TInt err = KErrNone;
+    TRAP(err, container->TakeSnapshotL());
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoContainer::AsyncTakeSnapshot 1, err:%d", err);   
+    User::LeaveIfError(err);        
+    return KErrNone;
+    }
+
+//=============================================================================    
+void CVeiEditVideoContainer::CalculateVideoClipRects()
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::CalculateVideoClipRects: in" );
+    iVideoItemRectArray.Reset();
+    
+    TRect selectedRect; // rect of the highlighted clip
+    TRect videoClipRect; // rect of the video clip in timeline
+    TInt barWidth = iVideoBarBox.Width();
+    TInt64 barDuration = iMovie.Duration().Int64();
+    
+    TInt64 audioDuration(0);
+    if ( (iMovie.AudioClipCount() != 0) && ((iSelectionMode == EModeRecording ) ||
+        (iSelectionMode == EModeRecordingPaused)))
+        {
+        audioDuration = (iMovie.AudioClipEndTime( iMovie.AudioClipCount() - 1 )).Int64();
+        }
+
+    audioDuration+= iRecordedAudioDuration.Int64();
+
+    if ( audioDuration > barDuration )
+        {
+        barDuration = audioDuration;
+        }
+    if ( iRecordedAudioStartTime > barDuration )
+        {
+        barDuration = iRecordedAudioStartTime.Int64();
+        }
+    if (barDuration < 30000000)
+        {
+        barDuration = 30000000;
+        }
+    else if (barDuration < 45000000)
+        {
+        barDuration = 45000000;
+        }
+    else{
+        barDuration = ((barDuration / 30000000) + 1) * 30000000;
+        }
+
+    videoClipRect.iTl.iY = iVideoBarBox.iTl.iY;
+    videoClipRect.iBr.iY = iVideoBarBox.iBr.iY;
+      
+    // calculate the rect of each of the video clip  
+    for (TInt i = 0; i < iMovie.VideoClipCount(); i++ )
+        {
+        videoClipRect.iTl.iX = iVideoBarBox.iTl.iX
+            + static_cast<TInt32>( (iMovie.VideoClipStartTime( i ).Int64() * barWidth ) / barDuration );
+        videoClipRect.iBr.iX = iVideoBarBox.iTl.iX
+            + static_cast<TInt32>( (iMovie.VideoClipEndTime( i ).Int64() * barWidth ) / barDuration )+ 1;
+                
+        if ((iCursorLocation == ECursorOnClip)
+            && (i == CurrentIndex()) && ( iView.EditorState() == CVeiEditVideoView::EEdit ))
+            // the current video clip selected
+            {
+            LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::CalculateVideoClipRects: selected clip" );
+            selectedRect = videoClipRect;
+            selectedRect.Grow( iZoomFactorX,iZoomFactorY );            
+            iVideoItemRectArray.Insert( selectedRect, i );
+            }
+        else
+            {
+            iVideoItemRectArray.Insert( videoClipRect, i );
+            }
+
+        LOGFMT6( KVideoEditorLogFile, "CVeiEditVideoContainer::CalculateVideoClipRects, iVideoItemRectArray.[%d]->Rect(): \
+                                                    (%d,%d,%d,%d), barWidth = %d ", \
+                                                    i,
+                                                    iVideoItemRectArray[i].iTl.iX, 
+                                                    iVideoItemRectArray[i].iTl.iY, 
+                                                    iVideoItemRectArray[i].iBr.iX,
+                                                    iVideoItemRectArray[i].iBr.iY,
+                                                    barWidth );
+        }
+
+    // Calculate the empty rect of the timeline
+    if ( iMovie.VideoClipCount() > 0 )
+        {
+        iEmptyVideoTimeLineRect.iTl = TPoint ( iVideoItemRectArray[ iMovie.VideoClipCount()-1 ].iBr.iX, iVideoBarBox.iTl.iY );
+        iEmptyVideoTimeLineRect.iBr = iVideoBarBox.iBr; 
+        }
+    else
+        {
+        iEmptyVideoTimeLineRect = iVideoBarBox; 
+        }
+
+    LOGFMT4( KVideoEditorLogFile, "CVeiEditVideoContainer::CalculateVideoClipRects, iEmptyVideoTimeLineRect: \
+                                                    (%d,%d,%d,%d) ", \
+                                                    iEmptyVideoTimeLineRect.iTl.iX, 
+                                                    iEmptyVideoTimeLineRect.iTl.iY, 
+                                                    iEmptyVideoTimeLineRect.iBr.iX,
+                                                    iEmptyVideoTimeLineRect.iBr.iY );                                                    
+                    
+    LOG( KVideoEditorLogFile, "CVeiEditVideoContainer::CalculateVideoClipRects: out" );
+    }
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiEditVideoView.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,5569 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+
+// System includes
+#include <aknviewappui.h>
+#include <avkon.hrh>
+#include <manualvideoeditor.rsg>
+#include <aknappui.h>
+#include <akntitle.h> 
+#include <caknfilenamepromptdialog.h> 
+#include <aknnotewrappers.h> 
+#include <aknlists.h> 
+#include <aknquerydialog.h> 
+#include <pathinfo.h> 
+#include <eikmenub.h> 
+
+#include <sendui.h> 
+#include <caknfileselectiondialog.h>
+#include <stringloader.h> 
+#include <eikprogi.h>
+#include <mgfetch.h> 
+#include <aknnavilabel.h> 
+#include <aknnavide.h> 
+#include <aknselectionlist.h> 
+#include <MdaAudioSampleEditor.h> 
+#include <bautils.h>
+#include <sysutil.h>
+#include <aknwaitdialog.h>
+#include <utf.h>
+#include <akncolourselectiongrid.h>
+//#include <akncontext.h>
+#include <MGXFileManagerFactory.h>
+#include <CMGXFileManager.h>
+#include <audiopreference.h>
+#include <senduiconsts.h>
+#include <mmsconst.h>
+#include <CMessagedata.h>
+#include <e32property.h>
+#include <e32math.h> 
+
+#include <VedVideoClipInfo.h>
+
+// User includes 
+#include "veiapp.h"
+#include "veicutaudioview.h"
+#include "VeiEditVideoView.h"
+#include "VeiEditVideoContainer.h" 
+#include "manualvideoeditor.hrh"
+#include "veieditvideolabelnavi.h"
+#include "veicutvideoview.h"
+#include "veiappui.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorUtils.h"
+#include "VeiTimeLabelNavi.h"
+#include "veiaddqueue.h"
+#include "veitempmaker.h"
+#include "videoeditorcommon.h"
+#include "VeiImageClipGenerator.h"
+#include "VeiTitleClipGenerator.h"
+#include "VeiTextDisplay.h"
+#include "VeiPopup.h"
+#include "VeiVideoEditorSettings.h"
+#include "VeiMGFetchVerifier.h"
+#include "VeiErrorUi.h"
+
+
+const TInt KTitleScreenMaxTextLength = 100; //2048;
+
+
+void CleanupRestoreOrientation( TAny* object )
+    {
+    LOG( KVideoEditorLogFile, "CleanupRestoreOrientation: in" );
+
+    CVeiEditVideoView* me = static_cast < CVeiEditVideoView*  > ( object );
+    me->RestoreOrientation();
+
+    LOG( KVideoEditorLogFile, "CleanupRestoreOrientation: Out" );
+    }
+
+CVeiEditVideoView* CVeiEditVideoView::NewL( CVeiCutVideoView& aCutView,
+                                            CVeiCutAudioView& aCutAudioView, 
+                                            CSendUi& aSendAppUi )
+    {
+    CVeiEditVideoView* self = CVeiEditVideoView::NewLC( aCutView, aCutAudioView, aSendAppUi );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CVeiEditVideoView* CVeiEditVideoView::NewLC( CVeiCutVideoView& aCutView,
+                                             CVeiCutAudioView& aCutAudioView, 
+                                             CSendUi& aSendAppUi )
+    {
+    CVeiEditVideoView* self = new ( ELeave ) CVeiEditVideoView( aCutView, aCutAudioView, aSendAppUi );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+CVeiEditVideoView::CVeiEditVideoView( CVeiCutVideoView& aCutView, 
+                                      CVeiCutAudioView& aCutAudioView, 
+                                      CSendUi& aSendAppUi )
+    : iCutView( aCutView ), 
+      iCutAudioView( aCutAudioView ), 
+      iSendAppUi( aSendAppUi ), 
+      iOriginalAudioStartPoint( -1 ), 
+      iOriginalAudioDuration( -1 ), 
+      iMemoryCardChecked(EFalse),
+      iOriginalOrientation( CAknAppUiBase::EAppUiOrientationAutomatic )
+    {
+    iOriginalVideoClipIndex =  - 1;
+    iMovieSavedFlag = ETrue;
+    SetNewTempFileNeeded( EFalse );
+    iMovieFirstAddFlag = ETrue;
+    iWaitMode = ENotWaiting;
+    }
+
+void CVeiEditVideoView::ConstructL()
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::ConstructL: in" );
+
+    BaseConstructL( R_VEI_EDIT_VIDEO_VIEW );
+
+    CEikStatusPane* sp = StatusPane();
+    iNaviPane = ( CAknNavigationControlContainer* ) sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
+
+    /** General navilabel(mms state, movie size, movie time). 
+    Is visible always except when in moving state */
+    iEditLabel = CreateEditNaviLabelL();
+
+
+    /** Navilabel when previewing video in small preview */
+    iPreviewLabel = CreatePreviewNaviLabelL();
+
+    /** Navipane updating timer when editor is on small preview - mode */
+    iPreviewUpdatePeriodic = CPeriodic::NewL( CActive::EPriorityLow );
+
+    /* volume bars are showed when volume is changed in small preview */
+    //	iVolumeHider = CPeriodic::NewL( CActive::EPriorityLow );
+
+    iVolumeNavi = iNaviPane->CreateVolumeIndicatorL(
+        R_AVKON_NAVI_PANE_VOLUME_INDICATOR );
+
+    /** Navilabel when audio or video clip is in moving state */
+    iMoveLabel = CreateMoveNaviLabelL();
+
+    iTempMaker = CVeiTempMaker::NewL();
+
+    iErrorUI = CVeiErrorUI::NewL( *iCoeEnv );
+
+    iMovie = CVedMovie::NewL( NULL );
+    iMovie->RegisterMovieObserverL( this );
+
+    /** All media files are added to video/audio tracks through mediaqueue */
+    iMediaQueue = CVeiAddQueue::NewL( *this, * iMovie, * this );
+
+    iOriginalAudioDuration = TTimeIntervalMicroSeconds(  - 1 );
+    /* Create recorder with max priority. */
+    iRecorder = CMdaAudioRecorderUtility::NewL( *this, NULL, EMdaPriorityMax,
+                       TMdaPriorityPreference( KAudioPrefVideoRecording )
+                       /*EMdaPriorityPreferenceQuality*/ );
+    iAudioRecordPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
+
+    /** Popup menus for video editor */
+    iPopup = CVeiPopup::NewL( *this );
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::ConstructL: out" );
+    }
+
+TUid CVeiEditVideoView::Id()const
+    {
+    return TUid::Uid( EVeiEditVideoView );
+    }
+
+CAknNavigationDecorator* CVeiEditVideoView::CreateMoveNaviLabelL()
+    {
+    CAknNaviLabel* movelabel = new( ELeave )CAknNaviLabel;
+    movelabel->SetNaviLabelType( CAknNaviLabel::ENavigationLabel );
+
+    CleanupStack::PushL( movelabel );
+
+    CAknNavigationDecorator* decoratedFolder = CAknNavigationDecorator::NewL(
+        iNaviPane, movelabel, CAknNavigationDecorator::ENotSpecified );
+
+    CleanupStack::Pop( movelabel );
+
+    CleanupStack::PushL( decoratedFolder );
+    decoratedFolder->SetContainerWindowL( *iNaviPane );
+    CleanupStack::Pop( decoratedFolder );
+    decoratedFolder->MakeScrollButtonVisible( ETrue );
+
+    return decoratedFolder;
+    }
+
+CAknNavigationDecorator* CVeiEditVideoView::CreatePreviewNaviLabelL()
+    {
+    CVeiTimeLabelNavi* timelabelnavi = CVeiTimeLabelNavi::NewLC();
+    CAknNavigationDecorator* decoratedFolder = CAknNavigationDecorator::NewL(
+        iNaviPane, timelabelnavi, CAknNavigationDecorator::ENotSpecified );
+    CleanupStack::Pop( timelabelnavi );
+
+    CleanupStack::PushL( decoratedFolder );
+    decoratedFolder->SetContainerWindowL( *iNaviPane );
+    CleanupStack::Pop( decoratedFolder );
+    decoratedFolder->MakeScrollButtonVisible( EFalse );
+
+    return decoratedFolder;
+    }
+
+/**
+ * Default navilabel. Shows MMS,Size and Time information. 
+ */
+CAknNavigationDecorator* CVeiEditVideoView::CreateEditNaviLabelL()
+    {
+    CVeiEditVideoLabelNavi* editvideolabelnavi = CVeiEditVideoLabelNavi::NewLC();
+
+    editvideolabelnavi->SetState( CVeiEditVideoLabelNavi::EStateInitializing );
+
+    CAknNavigationDecorator* navidecorator = CAknNavigationDecorator::NewL(
+        iNaviPane, editvideolabelnavi, CAknNavigationDecorator::ENotSpecified );
+
+    CleanupStack::Pop( editvideolabelnavi );
+
+    CleanupStack::PushL( navidecorator );
+    navidecorator->SetContainerWindowL( *iNaviPane );
+    CleanupStack::Pop( navidecorator );
+    navidecorator->MakeScrollButtonVisible( EFalse );
+
+    return navidecorator;
+    }
+
+CVeiEditVideoView::~CVeiEditVideoView()
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: In" );
+
+    if ( iProgressNote )
+        {
+        delete iProgressNote;
+        iProgressNote = NULL;
+        }
+
+    if ( iPopup )
+        {
+        delete iPopup;
+        iPopup = NULL;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iContainer" );
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iMediaQueue" );
+    if ( iMediaQueue )
+        {
+        delete iMediaQueue;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iMovie" );
+    if ( iMovie )
+        {
+        iMovie->Reset();
+        //if application is closed from cut video view, observer is not
+        //registered.
+        if ( ( EProcessingMovieForCutting != iWaitMode ) &&
+            ( ECuttingAudio != iWaitMode ) )
+            {
+            iMovie->UnregisterMovieObserver( this );
+            }
+        delete iMovie;
+        iMovie = NULL;
+        }
+
+    if ( iAudioRecordPeriodic )
+        {
+        iAudioRecordPeriodic->Cancel();
+        delete iAudioRecordPeriodic;
+        }
+
+    if ( iPreviewUpdatePeriodic )
+        {
+        iPreviewUpdatePeriodic->Cancel();
+        delete iPreviewUpdatePeriodic;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iTempFile" );
+    if ( iTempFile )
+        {
+        TInt err = iEikonEnv->FsSession().Delete( *iTempFile );
+        if ( err )
+            {
+            // what to do when error occurs in destructor???
+            }
+        delete iTempFile;
+        iTempFile = NULL;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iSaveToFileName" );
+        
+    if ( iSaveToFileName )
+        {
+        delete iSaveToFileName;
+        iSaveToFileName = NULL;
+        }
+
+    if ( iTempRecordedAudio )
+        {
+        TInt err = iEikonEnv->FsSession().Delete( *iTempRecordedAudio );
+        if ( err )
+            {
+            // what to do when error occurs in destructor???
+            }
+        delete iTempRecordedAudio;
+        iTempRecordedAudio = NULL;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iTempMaker" );
+        
+    if ( iTempMaker )
+        {
+        delete iTempMaker;
+        iTempMaker = NULL;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iErrorUI" );
+    if ( iErrorUI )
+        {
+        delete iErrorUI;
+        iErrorUI = NULL;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iAudioClipInfo" );
+    delete iAudioClipInfo;
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iEditLabel" );
+    delete iEditLabel;
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iMoveLabel" );
+    delete iMoveLabel;
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iPreviewLabel" );
+    delete iPreviewLabel;
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iRecorder" );
+    if ( iRecorder )
+        {
+        delete iRecorder;
+        iRecorder = NULL;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iVolumeHider" );
+    if ( iVolumeHider )
+        {
+        iVolumeHider->Cancel();
+        delete iVolumeHider;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: iVolumeNavi" );
+    delete iVolumeNavi;
+
+    delete iCallBack;
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::~CVeiEditVideoView: Out" );
+    }
+
+void CVeiEditVideoView::DialogDismissedL( TInt aButtonId )
+    {
+    LOGFMT2( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: In, aButtonId:%d, iWaitMode:%d", aButtonId, iWaitMode );
+
+    IsEnoughFreeSpaceToSaveL();
+
+    if ( aButtonId != EAknSoftkeyDone )
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: In, 2" );
+        CMdaAudioRecorderUtility::TState rState;
+        rState = CMdaAudioClipUtility::ENotReady;
+
+        if ( iRecorder )
+            {
+            rState = iRecorder->State();
+            }
+
+        if (( EOpeningAudioInfo == iWaitMode ) || ( CMdaAudioClipUtility::EOpen == rState ))
+            {
+            delete iAudioClipInfo;
+            iAudioClipInfo = NULL;
+            iWaitMode = EProcessingError;
+            iMovie->CancelProcessing();
+            }
+        else
+            {
+            iWaitMode = EProcessingError;
+            iMovie->CancelProcessing();
+            }
+        }
+    else if ( EProcessingMovieSend == iWaitMode )
+        {
+        //SendMovieL();
+        if ( !iCallBack )
+            {
+            TCallBack cb( CVeiEditVideoView::AsyncBackSend, this );
+            iCallBack = new ( ELeave ) CAsyncCallBack( cb, CActive::EPriorityStandard );
+            }
+        iCallBack->CallBack();
+        }
+    else if ( EProcessingMovieTrimMms == iWaitMode )
+        {
+        SetNewTempFileNeeded( EFalse );
+
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 3, EProcessingMovieTrimMms" );
+
+        RFs& fs = iEikonEnv->FsSession();
+        TEntry entry;
+        User::LeaveIfError( fs.Entry( *iTempFile, entry ));
+        TInt tempFileSize = entry.iSize / 1024;
+        TInt maxMmsSize = STATIC_CAST( CVeiEditVideoLabelNavi*, iEditLabel->DecoratedControl() )->GetMaxMmsSize();
+
+        LOGFMT2( KVideoEditorLogFile, 
+                "CVeiEditVideoView::DialogDismissedL: 4, tempFileSize:%d, maxMmsSize:%d", tempFileSize, maxMmsSize );
+
+        if ( iMovie->IsMovieMMSCompatible())
+            {
+            if ( tempFileSize <= maxMmsSize )
+                {
+                LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 5, MMS SIZE OK -- SEND" );
+                iWaitMode = EProcessingMovieSend;
+                iGivenSendCommand = KSenduiMtmMmsUid; // MMS
+
+                //SendMovieL();
+                if ( !iCallBack )
+                    {
+                    TCallBack cb( CVeiEditVideoView::AsyncBackSend, this );
+                    iCallBack = new( ELeave )CAsyncCallBack( cb, CActive::EPriorityStandard );
+                    }
+                iCallBack->CallBack();
+                }
+            else
+                {
+                LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 6, MMS SIZE FAILED - to TRIMM" );
+                TBuf8 < 255 > conv8Filename;
+                CnvUtfConverter::ConvertFromUnicodeToUtf8( conv8Filename, *iTempFile );
+                iMovie->UnregisterMovieObserver( iContainer );
+                iMovie->UnregisterMovieObserver( this );
+
+                AppUi()->ActivateLocalViewL( TUid::Uid( EVeiTrimForMmsView ), TUid::Uid(0), conv8Filename );
+                }
+            }
+        else
+            {
+            // if movie is not mms capable, trimming it does not help, instead its quality should be set
+            // trimming is made when other compatibility issues are fullfilled 
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 7, MMS Compatible FAILED - to TRIMM" );
+            TBuf8 < KMaxFileName > conv8Filename;
+            CnvUtfConverter::ConvertFromUnicodeToUtf8( conv8Filename, *iTempFile );
+                
+            iMovie->UnregisterMovieObserver( iContainer );
+            iMovie->UnregisterMovieObserver( this );
+
+            AppUi()->ActivateLocalViewL( TUid::Uid( EVeiTrimForMmsView ), TUid::Uid( 0 ), conv8Filename );
+            }
+        iMovie->SetQuality( iBackupSaveQuality );
+        return ;
+        }
+    else if (( EProcessingMovieSave == iWaitMode ) ||
+             ( EProcessingMovieSaveThenQuit == iWaitMode ))
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 8, EProcessingMovieSave|EProcessingMovieSaveThenQuit" );
+        RFs& fs = iEikonEnv->FsSession();
+
+        CFileMan* fileman = CFileMan::NewL( fs );
+        CleanupStack::PushL( fileman );
+
+        TInt moveErr( KErrNone );
+
+        if ( iTempFile->Left( 1 ) == iSaveToFileName->Left( 1 ))
+            {
+            moveErr = fileman->Rename( *iTempFile, * iSaveToFileName );
+            LOGFMT2( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 9, rename %S to %S", iTempFile, iSaveToFileName );
+            }
+        else
+            {
+            moveErr = fileman->Move( *iTempFile, * iSaveToFileName );
+            LOGFMT2( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 10, moved %S to %S", iTempFile, iSaveToFileName );
+            }
+        CleanupStack::PopAndDestroy( fileman );
+
+        delete iTempFile;
+        iTempFile = NULL;
+
+        if ( moveErr )
+            {
+            ShowGlobalErrorNote( moveErr );
+            UpdateEditNaviLabel();
+            iWaitMode = ENotWaiting;
+            return ;
+            }
+
+        iMovieSavedFlag = ETrue;
+
+        if ( EProcessingMovieSaveThenQuit == iWaitMode )
+            {
+            iMovie->Reset();
+            iMovieFirstAddFlag = ETrue; // True for the next edit process.						
+            }
+
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 11" );
+        UpdateMediaGalleryL();
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 12, media gallery updated" );
+
+        if ( EProcessingMovieSaveThenQuit == iWaitMode )
+            {
+            if ( !iCallBack )
+                {
+                TCallBack cb( CVeiEditVideoView::AsyncBackSaveThenExitL, this );
+                iCallBack = new( ELeave )CAsyncCallBack( cb, CActive::EPriorityStandard );
+                                
+                }
+            iCallBack->CallBack();
+            }
+
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL Out" );
+        return ;
+        }
+    else if ( EProcessingMoviePreview == iWaitMode && ( iTempFile != NULL ))
+        {
+        iContainer->SetSelectionMode( CVeiEditVideoContainer::EModePreview );
+        iContainer->PlayVideoFileL( *iTempFile, iFullScreenSelected );
+        }
+    else
+        {
+        if ( EProcessingError == iWaitMode )
+            {
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 13" );
+            if ( iTempFile )
+                {
+                RFs& fs = iEikonEnv->FsSession();
+
+                fs.Delete( *iTempFile );
+                delete iTempFile;
+                iTempFile = NULL;
+                SetNewTempFileNeeded( ETrue );
+                }
+
+            iWaitMode = ENotWaiting;
+            ShowGlobalErrorNote( iErrorNmb );
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 14" );
+            UpdateEditNaviLabel();
+            }
+
+        if ( EProcessingAudioError == iWaitMode )
+            {
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 15" );
+            ShowErrorNote( R_VEI_ERRORNOTE_AUDIO_INSERTING_FAILED );
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: 16" );
+            UpdateEditNaviLabel();
+            iWaitMode = ENotWaiting;
+            }
+
+        if ( iChangedFromMMCToPhoneMemory )
+            {
+            HBufC* noteText = StringLoader::LoadLC( R_VED_MMC_NOT_INSERTED,
+                                                        iEikonEnv );
+            CAknInformationNote* informationNote = new( ELeave )
+                                                    CAknInformationNote( ETrue );
+            informationNote->ExecuteLD( *noteText );
+
+            CleanupStack::PopAndDestroy( noteText );
+            }
+        }
+    if ( EProcessingMovieSend != iWaitMode )
+        {
+        iWaitMode = ENotWaiting;
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::DialogDismissedL: Out" );
+    }
+
+
+TInt CVeiEditVideoView::AsyncBackSend( TAny* aThis )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::AsyncBackSend" );
+
+    // In the asynchronous version, trap the rest of the functions 
+    // to make sure that the caller's TRequestStatus is always 
+    // completed, also in case of failures.
+    CVeiEditVideoView* view = static_cast < CVeiEditVideoView*  > ( aThis );
+    TInt err = KErrNone;
+    TRAP( err, view->SendMovieL());
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::AsyncBackSend 1, err:%d", err );
+           
+    view->iWaitMode = ENotWaiting;
+    User::LeaveIfError( err );
+    return KErrNone;
+    }
+
+TInt CVeiEditVideoView::AsyncBackSaveThenExitL( TAny* aThis )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::AsyncBackSaveThenExitL In" );
+
+    // In the asynchronous version, trap the rest of the functions 
+    // to make sure that the caller's TRequestStatus is always 
+    // completed, also in case of failures.
+
+    CVeiEditVideoView* view = static_cast < CVeiEditVideoView*  > ( aThis );
+
+    view->AppUi()->HandleCommandL( EAknCmdExit );
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::AsyncBackSaveThenExitL 1" );
+    return KErrNone;
+    }
+
+void CVeiEditVideoView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane*
+    aMenuPane )
+    {
+    if ( !iContainer || !iMovie )
+        {
+        return ;
+        }
+    if ( aResourceId == R_VEI_EDIT_VIDEO_VIEW_MENU && CVeiEditVideoContainer
+        ::EModeMixingAudio == iContainer->SelectionMode())
+        {
+        // Dim all the items and replace the with 
+        // R_VEI_EDIT_VIDEO_VIEW_AUDIO_MIXING_MENU
+        aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewInsert, ETrue );
+        aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditVideo, ETrue );
+        aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditAudio, ETrue );
+        aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditText, ETrue );
+        aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditImage, ETrue );
+        aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewMovie, ETrue );
+        aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewSettings, ETrue );
+        aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditStartTransition, ETrue );
+        aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditMiddleTransition, ETrue );
+        aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditEndTransition, ETrue );
+        aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewHelp, ETrue );
+        aMenuPane->SetItemDimmed( EEikCmdExit, ETrue );
+
+        aMenuPane->AddMenuItemsL( R_VEI_EDIT_VIDEO_VIEW_AUDIO_MIXING_MENU );
+
+        return ;
+        }
+
+    if (( aResourceId == R_VEI_EDIT_VIDEO_VIEW_EDIT_VIDEO_MENU ) || 
+        ( aResourceId == R_VEI_EDIT_VIDEO_VIEW_EDIT_VIDEO_SUBMENU ))
+        {
+        // @ : if muted, remove AdjustVolume, if video has no audio, remove AdjustVolume
+        //if (!iMovie->VideoClipEditedHasAudio(iContainer->CurrentIndex()))				
+        if ( !( iMovie->VideoClipInfo( iContainer->CurrentIndex()))->HasAudio())
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdEditVideoAdjustVolume );
+            }
+
+        if ( iMovie->VideoClipCount() < 2 )
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewEditVideoMove );
+            }
+
+        if ( iMovie->VideoClipIsMuteable( iContainer->CurrentIndex()) == EFalse
+            )
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewEditVideoMute );
+            aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewEditVideoUnmute );
+            }
+        else if ( iMovie->VideoClipIsMuted( iContainer->CurrentIndex()))
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewEditVideoMute );
+            }
+        else
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewEditVideoUnmute );
+            }
+        // remove "cut" if video duration < 1 sec. because engine/codec(s) do not handle them wholly at the moment
+        TTimeIntervalMicroSeconds duration = iMovie->VideoClipInfo( 
+                                        iContainer->CurrentIndex())->Duration();
+        if ( duration.Int64() < KMinCutVideoLength )
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewEditVideoCutting );
+            }
+        }
+
+    if ( aResourceId == R_VEI_EDIT_VIDEO_VIEW_MOVIE_SUBMENU )
+        {
+        if ( STATIC_CAST( CVeiEditVideoLabelNavi* , 
+                          iEditLabel->DecoratedControl())->IsMMSAvailable())
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewTrimForMms, ETrue );
+            }
+
+        /*TInt tempint;
+        if (aMenuPane->MenuItemExists(EVeiCmdEditVideoMixAudio, tempint))
+        {
+        if ((iMovie->VideoClipCount() > 0 && 
+        (iMovie->VideoClipEditedHasAudio(0) && 
+        iMovie->VideoClipEditedHasAudio(iMovie->VideoClipCount() - 1)))
+        && iMovie->AudioClipCount() > 0)*/
+        if ( MixingConditionsOk())
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoMixAudio, EFalse );
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoMixAudio, ETrue );
+            }
+        //}	
+        }
+
+    if ( aResourceId == R_VEI_EDIT_VIDEO_VIEW_MENU )
+        {
+        if ( iSendKey )
+        //Display send menu. 
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewInsert, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditVideo, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditAudio, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditText, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditImage, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewMovie, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewSettings, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditStartTransition, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditMiddleTransition, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditEndTransition, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewHelp, ETrue );
+            aMenuPane->SetItemDimmed( EEikCmdExit, ETrue );
+
+            ShowAndHandleSendMenuCommandsL();
+
+            iSendKey = EFalse;
+            return ;
+            }
+
+        if ( iMovie->VideoClipCount() == 0 )
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditVideo, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditText, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditImage, ETrue );
+            }
+
+
+        if ( iMovie->VideoClipCount() == 0 && iMovie->AudioClipCount() == 0 )
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditStartTransition, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditMiddleTransition, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditEndTransition, ETrue );
+
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewMovie, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditAudio, ETrue );
+            return ;
+            }
+        else
+            {
+            TInt index = 0;
+
+            aMenuPane->ItemAndPos( EVeiCmdEditVideoViewHelp, index );
+            iSendAppUi.AddSendMenuItemL( *aMenuPane, index, EVeiCmdEditVideoViewSend );
+            }
+        /* Remove irrelevant "edit" menus. */
+
+        if ( iContainer->CursorLocation() != VideoEditor::ECursorOnClip )
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditText, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditVideo, ETrue );
+            }
+        /* Checks if title or image */
+        if (( iContainer->CursorLocation() == VideoEditor::ECursorOnClip ) && 
+            ( iMovie->VideoClipCount() > 0 ) && 
+            ( iMovie->VideoClipInfo( iContainer->CurrentIndex())->Class() 
+                                                == EVedVideoClipClassGenerated
+            ))
+            {
+            /* Now refine the menu dimming to specific generators. */
+            TUid generatorUid = iMovie->VideoClipInfo( 
+                                iContainer->CurrentIndex())->Generator()->Uid();
+
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditVideo, ETrue );
+            if ( generatorUid == KUidImageClipGenerator )
+                {
+                aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditText, ETrue );
+                }
+            else
+                {
+                aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditImage, ETrue )
+                    ;
+                }
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditImage, ETrue );
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditText, ETrue );
+            }
+
+
+        if ( iContainer->CurrentClipIsFile())
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditText, ETrue );
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditVideo, ETrue );
+            }
+
+        if ( iContainer->CursorLocation() != VideoEditor::ECursorOnTransition )
+            {
+            aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewEditStartTransition )
+                                      ;
+            aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewEditEndTransition );
+            aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewEditMiddleTransition
+                                      );
+            }
+        if (( iContainer->CursorLocation() != VideoEditor::ECursorOnAudio ) || 
+            ( iMovie->AudioClipCount() == 0 ))
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditAudio, ETrue );
+            }
+
+        /* Remove irrelevant transition effect menus. */
+        if ( iContainer->CursorLocation() == VideoEditor::ECursorOnAudio )
+            {
+            aMenuPane->SetItemDimmed( EVeiCmdEditVideoViewEditText, ETrue );
+            }
+
+        if ( iContainer->CursorLocation() == VideoEditor::ECursorOnTransition )
+            {
+            if ( iContainer->CurrentIndex() == 0 )
+                {
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewEditEndTransition );
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewEditMiddleTransition );
+                }
+            else if ( iContainer->CurrentIndex() < iMovie->VideoClipCount())
+                {
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewEditStartTransition );
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewEditEndTransition );
+                }
+            else
+                {
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewEditStartTransition );
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewEditMiddleTransition );
+                }
+            }
+        }
+
+    if ( aResourceId == R_VEI_EDIT_VIDEO_VIEW_EDIT_START_TRANSITION_SUBMENU )
+        {
+        switch ( iMovie->StartTransitionEffect())
+            {
+            case EVedStartTransitionEffectNone:
+                aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewTransitionNone );
+                break;
+            case EVedStartTransitionEffectFadeFromBlack:
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewTransitionFadeFromBlack );
+                break;
+            case EVedStartTransitionEffectFadeFromWhite:
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewTransitionFadeFromWhite );
+                break;
+            default:
+                break;
+            }
+        }
+
+    if ( aResourceId == R_VEI_EDIT_VIDEO_VIEW_EDIT_END_TRANSITION_SUBMENU )
+        {
+        switch ( iMovie->EndTransitionEffect())
+            {
+            case EVedEndTransitionEffectNone:
+                aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewTransitionNone );
+                break;
+            case EVedEndTransitionEffectFadeToBlack:
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewTransitionFadeToBlack );
+                break;
+            case EVedEndTransitionEffectFadeToWhite:
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewTransitionFadeToWhite );
+                break;
+            default:
+                break;
+            }
+        }
+
+    if ( aResourceId == R_VEI_EDIT_VIDEO_VIEW_EDIT_MIDDLE_TRANSITION_SUBMENU )
+        {
+        TInt currentindex = iContainer->CurrentIndex() - 1;
+        switch ( iMovie->MiddleTransitionEffect( currentindex ))
+            {
+            case EVedMiddleTransitionEffectNone:
+                aMenuPane->DeleteMenuItem( EVeiCmdEditVideoViewTransitionNone );
+                break;
+            case EVedMiddleTransitionEffectDipToBlack:
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewTransitionDipToBlack );
+                break;
+            case EVedMiddleTransitionEffectDipToWhite:
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewTransitionDipToWhite );
+                break;
+            case EVedMiddleTransitionEffectCrossfade:
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewTransitionCrossfade );
+                break;
+            case EVedMiddleTransitionEffectWipeLeftToRight:
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewTransitionWipeFromLeft );
+                break;
+            case EVedMiddleTransitionEffectWipeRightToLeft:
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewTransitionWipeFromRight );
+                break;
+            case EVedMiddleTransitionEffectWipeTopToBottom:
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewTransitionWipeFromTop );
+                break;
+            case EVedMiddleTransitionEffectWipeBottomToTop:
+                aMenuPane->DeleteMenuItem(
+                    EVeiCmdEditVideoViewTransitionWipeFromBottom );
+                break;
+            default:
+                break;
+            }
+        }
+    }
+
+void CVeiEditVideoView::HandleCommandL( TInt aCommand )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::HandleCommandL( %d ): In", aCommand );
+
+    // At the startup HandleCommandL may get called before iContainer
+    // has been constructed.
+    if ( !iContainer )
+        {
+        LOG( KVideoEditorLogFile, "\tiContainer == NULL" );
+        AppUi()->HandleCommandL( aCommand );
+        return ;
+        }
+
+    TInt index;
+    switch ( aCommand )
+        {
+        /* Cursor is on transition and up/key key is pressed*/
+        case EVeiCmdEditVideoViewTransitionKeyUp:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionKeyUp" );
+                BrowseStartTransition( ETrue );
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionKeyDown:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionKeyDown" );
+                BrowseStartTransition( EFalse );
+                break;
+                }
+        case EVeiCmdSendMovie:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdSendMovie" );
+                if (( iMovie->VideoClipCount() == 0 ) && 
+                    ( iMovie->AudioClipCount() == 0 ))
+                    {
+                    iSendKey = EFalse;
+                    }
+                else
+                    {
+                    MenuBar()->TryDisplayMenuBarL();
+                    }
+                break;
+                }
+        case EAknSoftkeyDone:
+                {
+                LOG( KVideoEditorLogFile, "\tEAknSoftkeyDone" );
+
+                /*if (CVeiEditVideoContainer::EModeMixingAudio == iContainer->SelectionMode())
+                {
+                Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                Cba()->DrawDeferred();
+                iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+                //iContainer->ArrowsControl();
+                break;	
+                }	
+                 */
+
+                if ( CVeiEditVideoContainer::EModeMixingAudio == iContainer->SelectionMode())
+                    
+                    {
+
+                    MixAudio();
+
+                    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                    Cba()->DrawDeferred();
+
+                    VideoEditor::TCursorLocation cursorLocation = iContainer->CursorLocation();
+                    if (( cursorLocation == VideoEditor::ECursorOnClip ) && 
+                        ( iContainer->SelectionMode() == CVeiEditVideoContainer::EModeSlowMotion ))
+                        
+                        {
+                        iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+                        iContainer->ArrowsControl();
+                        }
+                    else
+                        {
+                        iOriginalAudioClipIndex =  - 1;
+                        iOriginalVideoClipIndex =  - 1;
+                        iOriginalAudioStartPoint = TTimeIntervalMicroSeconds( -1 );
+                        iOriginalAudioDuration = TTimeIntervalMicroSeconds(  -1 );
+                            
+
+                        iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+                        }
+                    SetEditorState( EEdit );
+                    UpdateEditNaviLabel();
+
+                    // Setting the cursor location resets the image in the video display box
+                    iContainer->SetCursorLocation( cursorLocation );
+                    }
+                break;
+                }
+
+        case EAknSoftkeyOk:
+                {
+                LOG( KVideoEditorLogFile, "\tEAknSoftkeyOk" );
+
+                if ( CVeiEditVideoContainer::EModeAdjustVolume == iContainer->SelectionMode())
+                    
+                    {
+                    AdjustVolumeL();
+                    SetEditorState( EEdit );
+                    }
+
+                Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                Cba()->DrawDeferred();
+
+                if (( iContainer->CursorLocation() == VideoEditor::ECursorOnClip ) &&
+                    ( iContainer->SelectionMode() == CVeiEditVideoContainer::EModeSlowMotion ))
+                    
+                    {
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+                    iContainer->ArrowsControl();
+                    }
+                else
+                    {
+                    iOriginalAudioClipIndex =  - 1;
+                    iOriginalVideoClipIndex =  - 1;
+                    iOriginalAudioStartPoint = TTimeIntervalMicroSeconds(  -1 );
+                    iOriginalAudioDuration = TTimeIntervalMicroSeconds(  -1 );
+
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+                    }
+                UpdateEditNaviLabel();
+                break;
+                }
+        case EAknSoftkeyCancel:
+        case EVeiCmdEditVideoMixAudioCancel:
+                {
+                LOG( KVideoEditorLogFile, "\tEAknSoftkeyCancel||EVeiCmdEditVideoMixAudioCancel" );
+
+                Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                Cba()->DrawDeferred();
+
+                SetEditorState( EEdit );
+
+                if ( CVeiEditVideoContainer::EModeMixingAudio == iContainer->SelectionMode() ||
+                     CVeiEditVideoContainer::EModeAdjustVolume == iContainer->SelectionMode())
+                    {
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+                    // Setting the cursor location resets the image in the video display box
+                    iContainer->SetCursorLocation( iContainer->CursorLocation());
+                    break;
+                    }
+
+                if (( iContainer->CursorLocation() == VideoEditor::ECursorOnClip ) &&
+                     ( iContainer->SelectionMode() == CVeiEditVideoContainer::EModeSlowMotion ))
+                    {
+                    iMovie->VideoClipSetSpeed( iContainer->CurrentIndex(), iOriginalVideoSpeed );
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+                        
+                    iContainer->ArrowsControl();
+                    }
+                else
+                    {
+                    if ( iContainer->CursorLocation() == VideoEditor
+                        ::ECursorOnAudio )
+                        {
+                        if ( iOriginalAudioStartPoint >= TTimeIntervalMicroSeconds( 0 ))
+                            {
+                            iMovie->AudioClipSetStartTime( iContainer->CurrentIndex(), iOriginalAudioStartPoint );
+                            iOriginalAudioStartPoint = TTimeIntervalMicroSeconds(  -1 );
+                            iMovie->AudioClipSetCutOutTime( iContainer->CurrentIndex(), iOriginalAudioDuration );
+                            iOriginalAudioDuration = TTimeIntervalMicroSeconds( -1 );
+                            }
+                        else
+                            {
+                            index = iContainer->CurrentIndex();
+
+                            iContainer->SetCurrentIndex( iOriginalAudioClipIndex );
+                            iOriginalAudioClipIndex =  - 1;
+                            iOriginalAudioDuration = TTimeIntervalMicroSeconds( -1 );
+
+                            iMovie->RemoveAudioClip( index );
+                            }
+                        }
+                    else
+                        {
+                        if ( iContainer->SelectionMode() != CVeiEditVideoContainer::EModeDuration )
+                            {
+                            iMovie->VideoClipSetIndex( iContainer->CurrentIndex(), iOriginalVideoClipIndex );
+                            iContainer->SetVideoCursorPosition( iOriginalVideoClipIndex );
+                            iOriginalVideoClipIndex =  - 1;
+                            }
+                        else
+                            {
+                            CVedVideoClipInfo* info = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+                            if ( info->Class() == EVedVideoClipClassGenerated )
+                                {
+                                if ( info->Generator()->Uid() == KUidTitleClipGenerator )
+                                    {
+                                    CVeiTitleClipGenerator* generator =
+                                                    STATIC_CAST( CVeiTitleClipGenerator* , info->Generator());
+                                    generator->SetDuration( TTimeIntervalMicroSeconds(
+                                                                iOriginalVideoCutOutTime.Int64() -
+                                                                iOriginalVideoCutInTime.Int64()));
+                                    }
+                                else if ( info->Generator()->Uid() == KUidImageClipGenerator )
+                                    {
+                                    CVeiImageClipGenerator* generator =
+                                            STATIC_CAST( CVeiImageClipGenerator* , info->Generator());
+                                    generator->SetDuration( TTimeIntervalMicroSeconds(
+                                                                iOriginalVideoCutOutTime.Int64() -
+                                                                iOriginalVideoCutInTime.Int64()));
+                                    }
+                                }
+                            }
+                        }
+                    }
+
+                if ( iContainer->SelectionMode() == CVeiEditVideoContainer
+                    ::EModePreview )
+                    {
+                    iContainer->SetBlackScreen( EFalse );
+                    iContainer->SetRect( AppUi()->ClientRect());
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+                    iContainer->ArrowsControl();
+                    }
+                else
+                    {
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+                    UpdateEditNaviLabel();
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewSend:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewSend" );
+                ShowAndHandleSendMenuCommandsL();
+                break;
+                }
+
+        case EVeiCmdEditVideoViewPreviewLarge:
+        case EVeiCmdEditVideoViewPreviewSmall:
+                {
+                LOG( KVideoEditorLogFile, 
+                    "\tEVeiCmdEditVideoViewPreviewLarge||EVeiCmdEditVideoViewPreviewSmall" );
+
+                if ( CVeiEditVideoContainer::EModeMixingAudio == iContainer->SelectionMode())
+                    {
+                    MixAudio();
+                    }
+
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    if ( aCommand == EVeiCmdEditVideoViewPreviewLarge )
+                        {
+                        iFullScreenSelected = ETrue;
+                        }
+                    else
+                        {
+                        iFullScreenSelected = EFalse;
+                        }
+                    iWaitMode = EProcessingMoviePreview;
+                    StartTempFileProcessingL();
+                    }
+                break;
+                }
+
+            /**
+             * Trim for MMS
+             */
+        case EVeiCmdEditVideoViewTrimForMms:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTrimForMms" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    iWaitMode = EProcessingMovieTrimMms;
+                    StartTempFileProcessingL();
+                    }
+                break;
+                }
+            /**
+             * Cut (Audio and Video)
+             */
+        case EVeiCmdEditVideoViewEditVideoCutting:
+                {
+                LOG( KVideoEditorLogFile, 
+                    "\tEVeiCmdEditVideoViewEditVideoCutting" );
+
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    // Cut video
+                    if ( iContainer->CursorLocation() == VideoEditor::ECursorOnClip )
+                        {
+                        __ASSERT_ALWAYS( iMovie->VideoClipCount() > 0, 
+                                         User::Panic( _L( "VideoEditor" ), 34 ));
+
+                        iCutVideoIndex = iContainer->CurrentIndex();
+                        iWaitMode = EProcessingMovieForCutting;
+                        iOriginalCutInTime = iMovie->VideoClipCutInTime( iCutVideoIndex );
+                        iOriginalCutOutTime = iMovie->VideoClipCutOutTime( iCutVideoIndex );
+
+                        iMovie->UnregisterMovieObserver( iContainer );
+                        iMovie->UnregisterMovieObserver( this );
+
+                        AppUi()->DeactivateActiveViewL();
+
+                        // set file name & clip
+                        iCutView.SetVideoClipAndIndex( *iMovie, iCutVideoIndex )
+                            ;
+
+                        // activate cut  view
+                        AppUi()->ActivateLocalViewL( iCutView.Id());
+                        }
+                    else if ( iContainer->CursorLocation() == VideoEditor::ECursorOnAudio )
+                    // Cut audio
+                        {
+                        __ASSERT_ALWAYS( iMovie->AudioClipCount() > 0, 
+                                         User::Panic( _L( "VideoEditor" ), 34 ));
+
+                        iCutAudioIndex = iContainer->CurrentIndex();
+                        iWaitMode = ECuttingAudio;
+                        iOriginalAudioCutInTime = iMovie->AudioClipCutInTime( iCutAudioIndex );
+                        iOriginalAudioCutOutTime = iMovie->AudioClipCutOutTime( iCutAudioIndex );
+
+                        iMovie->UnregisterMovieObserver( iContainer );
+                        iMovie->UnregisterMovieObserver( this );
+
+                        AppUi()->DeactivateActiveViewL();
+
+                        // set file name & clip
+                        iCutAudioView.SetVideoClipAndIndex( *iMovie, iCutAudioIndex );
+                        // activate cut  view
+                        AppUi()->ActivateLocalViewL( TUid::Uid( EVeiCutAudioView ));
+                        }
+                    }
+                break;
+                }
+            /**
+             * Selection (joystick).
+             */
+        case EVeiCmdEditVideoViewContainerShowMenu:
+                {
+                LOG( KVideoEditorLogFile, 
+                    "\tEVeiCmdEditVideoViewContainerShowMenu" );
+
+                //preview popup
+                if ( iEditorState != EEdit )
+                    {
+                    if ( iEditorState == CVeiEditVideoView::EQuickPreview )
+                        {
+                        StopNaviPaneUpdateL();
+                        iContainer->PauseVideoL();
+                        LOG( KVideoEditorLogFile, 
+                            "\tEVeiCmdEditVideoViewContainerShowMenu, setting R_VEI_SOFTKEYS_PREVIEW_PLAY_BACK" );
+                        Cba()->SetCommandSetL( R_VEI_SOFTKEYS_PREVIEW_PLAY_BACK
+                            );
+                        Cba()->DrawDeferred();
+                        }
+                    MenuBar()->SetMenuTitleResourceId( R_VEI_PREVIEW_BAR );
+                    MenuBar()->TryDisplayMenuBarL();
+                    MenuBar()->SetMenuTitleResourceId(
+                            R_VEI_MENUBAR_EDIT_VIDEO_VIEW );
+                    break;
+                    }
+                switch ( iContainer->CursorLocation())
+                    {
+                    case VideoEditor::ECursorOnAudio: 
+                        {
+                        iPopup->ShowEditAudioPopupList();
+                        break;
+                        }
+                    case VideoEditor::ECursorOnClip: 
+                        {
+                        if ( iMovie->VideoClipInfo( iContainer->CurrentIndex())->Class() == EVedVideoClipClassFile )
+                            {
+                            iPopup->ShowEditVideoPopupList();
+                            }
+                        else
+                            {
+
+                            TUid generatorUid = iMovie->VideoClipInfo(
+                                                    iContainer->CurrentIndex())->Generator()->Uid();
+                            if ( generatorUid == KUidImageClipGenerator )
+                            // Image 
+                                {
+                                iPopup->ShowEditImagePopupList();
+                                }
+                            else
+                            // Text
+                                {
+                                iPopup->ShowEditTextPopupList();
+                                }
+                            }
+                        break;
+                        }
+                    /**
+                     * Cursor on video transition.
+                     */
+                    case VideoEditor::ECursorOnTransition: 
+                        {
+                        if ( iContainer->CurrentIndex() == 0 )
+                            {
+                            iPopup->ShowStartTransitionPopupListL();
+                            }
+                        else if ( iContainer->CurrentIndex() < iMovie->VideoClipCount())
+                            {
+                            iPopup->ShowMiddleTransitionPopupListL();
+                            }
+                        else
+                            {
+                            iPopup->ShowEndTransitionPopupListL();
+                            }
+                        break;
+                        }
+                default:
+                    break;
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewInsert:
+        case EVeiCmdEditVideoViewEditVideo:
+        case EVeiCmdEditVideoViewEditAudio:
+            LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewInsert||EVeiCmdEditVideoViewEditVideo||EVeiCmdEditVideoViewEditAudio" );
+            break;
+        case EVeiCmdEditVideoViewTransitionNone:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionNone" );
+
+                if ( iContainer->CurrentIndex() == 0 )
+                    {
+                    iMovie->SetStartTransitionEffect( EVedStartTransitionEffectNone );
+                    }
+                else if ( iContainer->CurrentIndex() < iMovie->VideoClipCount())
+                    {
+                    index = iContainer->CurrentIndex() - 1;
+                    iMovie->SetMiddleTransitionEffect( EVedMiddleTransitionEffectNone, index );
+                    }
+                else
+                    {
+                    iMovie->SetEndTransitionEffect( EVedEndTransitionEffectNone );
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionFadeFromBlack:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionFadeFromBlack" );
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() == 0, User::Panic( _L( "VideoEditor" ), 34 ));
+                iMovie->SetStartTransitionEffect( EVedStartTransitionEffectFadeFromBlack );
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionFadeFromWhite:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionFadeFromWhite" );
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() == 0, User::Panic( _L( "VideoEditor" ), 34 ));
+                iMovie->SetStartTransitionEffect( EVedStartTransitionEffectFadeFromWhite );
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionDipToBlack:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionDipToBlack" );
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() < iMovie->VideoClipCount(), User::Panic( _L( "VideoEditor" ), 34 ));
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() > 0, User::Panic( _L( "VideoEditor" ), 34 ));
+                index = iContainer->CurrentIndex() - 1;
+                iMovie->SetMiddleTransitionEffect( EVedMiddleTransitionEffectDipToBlack, index );
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionDipToWhite:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionDipToWhite" );
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() < iMovie->VideoClipCount(), User::Panic( _L( "VideoEditor" ), 34 ));
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() > 0, User::Panic( _L( "VideoEditor" ), 34 ));
+                index = iContainer->CurrentIndex() - 1;
+                iMovie->SetMiddleTransitionEffect( EVedMiddleTransitionEffectDipToWhite, index );
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionCrossfade:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionCrossfade" );
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() < iMovie->VideoClipCount(), User::Panic( _L( "VideoEditor" ), 34 ));
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() > 0, User::Panic( _L( "VideoEditor" ), 34 ));
+                index = iContainer->CurrentIndex() - 1;
+                iMovie->SetMiddleTransitionEffect( EVedMiddleTransitionEffectCrossfade, index );
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionWipeFromLeft:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionWipeFromLeft" );
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() < iMovie->VideoClipCount(), User::Panic( _L( "VideoEditor" ), 34 ));
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() > 0, User::Panic( _L( "VideoEditor" ), 34 ));
+                index = iContainer->CurrentIndex() - 1;
+                iMovie->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeLeftToRight, index );
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionWipeFromRight:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionWipeFromRight" );
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() < iMovie->VideoClipCount(), User::Panic( _L( "VideoEditor" ), 34 ));
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() > 0, User::Panic( _L( "VideoEditor" ), 34 ));
+                index = iContainer->CurrentIndex() - 1;
+                iMovie->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeRightToLeft, index );
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionWipeFromTop:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionWipeFromTop" );
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() < iMovie->VideoClipCount(), User::Panic( _L( "VideoEditor" ), 34 ));
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() > 0, User::Panic( _L( "VideoEditor" ), 34 ));
+                index = iContainer->CurrentIndex() - 1;
+                iMovie->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeTopToBottom, index );
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionWipeFromBottom:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionWipeFromBottom" );
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() < iMovie->VideoClipCount(), User::Panic( _L( "VideoEditor" ), 34 ));
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() > 0, User::Panic( _L( "VideoEditor" ), 34 ));
+                index = iContainer->CurrentIndex() - 1;
+                iMovie->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeBottomToTop, index );
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionFadeToBlack:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionFadeToBlack" );
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() == iMovie->VideoClipCount(), User::Panic( _L( "VideoEditor" ), 34 ));
+                iMovie->SetEndTransitionEffect( EVedEndTransitionEffectFadeToBlack );
+                break;
+                }
+        case EVeiCmdEditVideoViewTransitionFadeToWhite:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewTransitionFadeToWhite" );
+                __ASSERT_ALWAYS( iContainer->CurrentIndex() == iMovie->VideoClipCount(), User::Panic( _L( "VideoEditor" ), 34 ));
+                iMovie->SetEndTransitionEffect( EVedEndTransitionEffectFadeToWhite );
+                break;
+                }
+        case EVeiCmdEditVideoViewEditStartTransition:
+        case EVeiCmdEditVideoViewEditMiddleTransition:
+        case EVeiCmdEditVideoViewEditEndTransition:
+            LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditStartTransition||EVeiCmdEditVideoViewEditMiddleTransition||EVeiCmdEditVideoViewEditEndTransition" );
+            break;
+        case EVeiCmdEditVideoViewSaveTo:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewSaveTo" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    TInt err;
+                    TRAP( err, SaveL( EProcessingMovieSave ));
+                    if ( err != KErrNone )
+                        {
+                        ShowErrorNote( R_VEI_ERROR_NOTE );
+                        }
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoMixAudio:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoMixAudio" );
+                SetEditorState( EMixAudio );
+                break;
+                }
+
+        case EVeiCmdEditVideoAdjustVolume:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoAdjustVolume" );
+                SetEditorState( EAdjustVolume );
+                break;
+                }
+
+        case EVeiCmdEditVideoViewInsertVideo:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewInsertVideo" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    __ASSERT_ALWAYS( iMediaQueue, User::Panic( _L( "CVeiEditVideoView" ), 1 ));
+
+                    if ( !iMediaQueue->ShowVideoClipDialogL( iContainer->CursorLocation(), iContainer->CurrentIndex()))
+                        {
+                        return ;
+                        }
+                    }
+                HandleScreenDeviceChangedL();
+                break;
+                }
+        case EVeiCmdEditVideoDuplicate:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoDuplicate" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    TEntry fileinfo;
+
+                    SetNewTempFileNeeded( ETrue );
+                    iMovieSavedFlag = EFalse;
+
+                    iWaitMode = EDuplicating;
+
+                    if ( iContainer->CursorLocation() == VideoEditor::ECursorOnClip )
+                        {
+                        CVedVideoClipInfo* previousInfo = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+
+                        RFs& fs = iEikonEnv->FsSession();
+                        fs.Entry( previousInfo->FileName(), fileinfo );
+
+                        if ( IsEnoughFreeSpaceToSaveL( fileinfo.iSize ))
+                            {
+                            iMovie->InsertVideoClipL( previousInfo->FileName(), iContainer->CurrentIndex() + 1 );
+                            }
+                        }
+                    else
+                        {
+                        if ( iContainer->CursorLocation() == VideoEditor::ECursorOnAudio )
+                            {
+                            CVedAudioClipInfo* currentInfo = iMovie->AudioClipInfo( iContainer->CurrentIndex());
+                            TTimeIntervalMicroSeconds currentDuration = iMovie->AudioClipEditedDuration( iContainer->CurrentIndex());
+
+                            TInt currentIndex = iContainer->CurrentIndex();
+
+                            for ( TInt i = iMovie->AudioClipCount() - 1; i > currentIndex; i-- )
+                                {
+                                TTimeIntervalMicroSeconds oldStartTime = iMovie->AudioClipStartTime( i );
+                                iMovie->AudioClipSetStartTime( i, TTimeIntervalMicroSeconds( oldStartTime.Int64() + currentDuration.Int64()));
+                                }
+
+                            TTimeIntervalMicroSeconds currentAudioClipEndTime = iMovie->AudioClipEndTime( currentIndex );
+                            TTimeIntervalMicroSeconds currentCutInTime = iMovie->AudioClipCutInTime( currentIndex );
+                            TTimeIntervalMicroSeconds currentCutOutTime = iMovie->AudioClipCutOutTime( currentIndex );
+                            iMovie->AddAudioClipL( currentInfo->FileName(), currentAudioClipEndTime, currentCutInTime, currentCutOutTime );
+                            }
+                        }
+                    }
+                break;
+                }
+
+            /*
+             * Insert TITLE text *	
+             */
+        case EVeiCmdEditVideoViewInsertText:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewInsertText" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    iPopup->ShowInsertTextPopupList();
+                    }
+                break;
+                }
+
+        case EVeiCmdEditVideoViewInsertTextTitle:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewInsertTextTitle" );
+
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    StoreOrientation();
+                    CleanupStack::PushL( TCleanupItem( CleanupRestoreOrientation, this ));
+                    AppUi()->SetOrientationL( CAknAppUiBase::EAppUiOrientationPortrait );
+
+                    TSize res = TSize( iMovie->Resolution());
+
+                    CVeiTitleClipGenerator* generator = CVeiTitleClipGenerator::NewLC( res, 
+                                                                                       EVeiTitleClipTransitionNone, 
+                                                                                       EVeiTitleClipHorizontalAlignmentCenter, 
+                                                                                       EVeiTitleClipVerticalAlignmentCenter );
+
+                    HBufC* descriptiveName = StringLoader::LoadLC( R_VEI_EDIT_VIEW_TITLE_NAME, iEikonEnv );
+                    generator->SetDescriptiveNameL( *descriptiveName );
+                    CleanupStack::PopAndDestroy( descriptiveName );
+
+                    generator->SetTransitionAndAlignmentsL( EVeiTitleClipTransitionNone, 
+                                                            EVeiTitleClipHorizontalAlignmentCenter, 
+                                                            EVeiTitleClipVerticalAlignmentCenter );
+
+                    /* Ask for text. */
+                    HBufC* text = HBufC::NewLC( KTitleScreenMaxTextLength );
+                    TPtr txtptr( text->Des());
+                    CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL( txtptr );
+                    CleanupStack::PushL( textQuery );
+
+                    textQuery->SetMaxLength( KTitleScreenMaxTextLength );
+                    //textQuery->SetPredictiveTextInputPermitted(ETrue);
+                    CleanupStack::Pop( textQuery );
+
+                    if ( !textQuery->ExecuteLD( R_VEI_EDITVIDEO_TITLESCREEN_TEXT_QUERY ))
+                        {
+                        CleanupStack::PopAndDestroy( text );
+                        CleanupStack::PopAndDestroy( generator );
+                        CleanupStack::PopAndDestroy( this ); // restore appui orientation
+                        break;
+                        }
+
+                    generator->SetTextL( *text );
+                    CleanupStack::PopAndDestroy( text );
+
+                    /* Insert generator into the movie. */
+                    TInt err = 0;
+                    index = ( iContainer->CurrentIndex() == iMovie->VideoClipCount()) ? iMovie->VideoClipCount(): iContainer->CurrentIndex() + 1;
+                    TRAP( err, iMovie->InsertVideoClipL( *generator, ETrue, index ));
+
+                    CleanupStack::Pop( generator );
+                    User::LeaveIfError( err );
+
+                    CleanupStack::PopAndDestroy( this ); // restore appui orientation
+                    }
+                break;
+                }
+            /*
+             * Insert TITLE (fading) text *	
+             */
+        case EVeiCmdEditVideoViewInsertTextTitleFading:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewInsertTextTitleFading" );
+
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+
+                    StoreOrientation();
+                    CleanupStack::PushL( TCleanupItem( CleanupRestoreOrientation, this ));
+                    AppUi()->SetOrientationL( CAknAppUiBase::EAppUiOrientationPortrait );
+
+                    TSize res = TSize( iMovie->Resolution());
+                    CVeiTitleClipGenerator* generator = CVeiTitleClipGenerator::NewLC( res, 
+                                                                                       EVeiTitleClipTransitionNone, 
+                                                                                       EVeiTitleClipHorizontalAlignmentCenter, 
+                                                                                       EVeiTitleClipVerticalAlignmentCenter );
+
+                    HBufC* descriptiveName = StringLoader::LoadLC( R_VEI_EDIT_VIEW_TITLE_FADING_NAME, iEikonEnv );
+                    generator->SetDescriptiveNameL( *descriptiveName );
+                    CleanupStack::PopAndDestroy( descriptiveName );
+
+                    generator->SetTransitionAndAlignmentsL( EVeiTitleClipTransitionFade, 
+                                                            EVeiTitleClipHorizontalAlignmentCenter, 
+                                                            EVeiTitleClipVerticalAlignmentCenter );
+                    /* Ask for text. */
+                    HBufC* text = HBufC::NewLC( KTitleScreenMaxTextLength );
+                    TPtr txtptr( text->Des());
+
+                    CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL( txtptr );
+                    CleanupStack::PushL( textQuery );
+
+                    textQuery->SetMaxLength( KTitleScreenMaxTextLength );
+                    //textQuery->SetPredictiveTextInputPermitted(ETrue);
+                    CleanupStack::Pop( textQuery );
+
+                    if ( !textQuery->ExecuteLD( R_VEI_EDITVIDEO_TITLESCREEN_TEXT_QUERY ))
+                        {
+                        CleanupStack::PopAndDestroy( text );
+                        CleanupStack::PopAndDestroy( generator );
+                        CleanupStack::PopAndDestroy( this ); // restore appui orientation
+                        break;
+                        }
+
+                    generator->SetTextL( *text );
+                    CleanupStack::PopAndDestroy( text );
+
+                    /* Insert generator into the movie. */
+                    TInt err = 0;
+                    index = ( iContainer->CurrentIndex() == iMovie->VideoClipCount()) ? iMovie->VideoClipCount(): iContainer->CurrentIndex() + 1;
+                    TRAP( err, iMovie->InsertVideoClipL( *generator, ETrue, index ));
+                    CleanupStack::Pop( generator );
+                    User::LeaveIfError( err );
+
+                    CleanupStack::PopAndDestroy( this ); // restore appui orientation
+                    }
+                break;
+                }
+            /*
+             * Insert SUBTITLE text *	
+             */
+        case EVeiCmdEditVideoViewInsertTextSubTitle:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewInsertTextSubTitle" );
+
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    StoreOrientation();
+                    CleanupStack::PushL( TCleanupItem( CleanupRestoreOrientation, this ));
+                    AppUi()->SetOrientationL( CAknAppUiBase::EAppUiOrientationPortrait );
+
+                    TSize res = TSize( iMovie->Resolution());
+                    CVeiTitleClipGenerator* generator = CVeiTitleClipGenerator::NewLC( res, 
+                                                                                       EVeiTitleClipTransitionNone, 
+                                                                                       EVeiTitleClipHorizontalAlignmentCenter, 
+                                                                                       EVeiTitleClipVerticalAlignmentCenter );
+
+                    HBufC* descriptiveName = StringLoader::LoadLC( R_VEI_EDIT_VIEW_SUBTITLE_NAME, iEikonEnv );
+                    generator->SetDescriptiveNameL( *descriptiveName );
+                    CleanupStack::PopAndDestroy( descriptiveName );
+
+                    generator->SetTransitionAndAlignmentsL( EVeiTitleClipTransitionNone, 
+                                                            EVeiTitleClipHorizontalAlignmentLeft, 
+                                                            EVeiTitleClipVerticalAlignmentBottom );
+
+                    /* Ask for text. */
+                    HBufC* text = HBufC::NewLC( KTitleScreenMaxTextLength );
+                    TPtr txtptr( text->Des());
+                    CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL( txtptr );
+                    CleanupStack::PushL( textQuery );
+
+                    textQuery->SetMaxLength( KTitleScreenMaxTextLength );
+                    //textQuery->SetPredictiveTextInputPermitted(ETrue);
+                    CleanupStack::Pop( textQuery );
+
+                    if ( !textQuery->ExecuteLD( R_VEI_EDITVIDEO_TITLESCREEN_TEXT_QUERY ))
+                        {
+                        CleanupStack::PopAndDestroy( text );
+                        CleanupStack::PopAndDestroy( generator );
+                        CleanupStack::PopAndDestroy( this ); // restore appui orientation
+                        break;
+                        }
+
+                    generator->SetTextL( *text );
+                    CleanupStack::PopAndDestroy( text );
+
+                    /* Insert generator into the movie. */
+                    TInt err = 0;
+                    index = ( iContainer->CurrentIndex() == iMovie->VideoClipCount()) ? iMovie->VideoClipCount(): iContainer->CurrentIndex() + 1;
+                    TRAP( err, iMovie->InsertVideoClipL( *generator, ETrue, index ));
+                    CleanupStack::Pop( generator );
+                    User::LeaveIfError( err );
+
+                    CleanupStack::PopAndDestroy( this ); // restore appui orientation
+                    }
+                break;
+                }
+            /*
+             * Insert SUBTITLE (fading) text *	
+             */
+        case EVeiCmdEditVideoViewInsertTextSubTitleFading:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewInsertTextSubTitleFading" );
+
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    StoreOrientation();
+                    CleanupStack::PushL( TCleanupItem( CleanupRestoreOrientation, this ));
+                    AppUi()->SetOrientationL( CAknAppUiBase::EAppUiOrientationPortrait );
+
+                    TSize res = TSize( iMovie->Resolution());
+                    CVeiTitleClipGenerator* generator = CVeiTitleClipGenerator::NewLC( res, 
+                                                                                       EVeiTitleClipTransitionNone, 
+                                                                                       EVeiTitleClipHorizontalAlignmentCenter, 
+                                                                                       EVeiTitleClipVerticalAlignmentCenter );
+
+                    HBufC* descriptiveName = StringLoader::LoadLC( R_VEI_EDIT_VIEW_SUBTITLE_FADING_NAME, iEikonEnv );
+                    generator->SetDescriptiveNameL( *descriptiveName );
+                    CleanupStack::PopAndDestroy( descriptiveName );
+
+                    generator->SetTransitionAndAlignmentsL( EVeiTitleClipTransitionFade, 
+                                                            EVeiTitleClipHorizontalAlignmentLeft, 
+                                                            EVeiTitleClipVerticalAlignmentBottom );
+
+                    /* Ask for text. */
+                    HBufC* text = HBufC::NewLC( KTitleScreenMaxTextLength );
+                    TPtr txtptr( text->Des());
+                    CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL( txtptr );
+                    CleanupStack::PushL( textQuery );
+
+                    textQuery->SetMaxLength( KTitleScreenMaxTextLength );
+                    //textQuery->SetPredictiveTextInputPermitted(ETrue);
+                    CleanupStack::Pop( textQuery );
+
+                    if ( !textQuery->ExecuteLD( R_VEI_EDITVIDEO_TITLESCREEN_TEXT_QUERY ))
+                        {
+                        CleanupStack::PopAndDestroy( text );
+                        CleanupStack::PopAndDestroy( generator );
+                        CleanupStack::PopAndDestroy( this ); // restore appui orientation
+                        break;
+                        }
+
+                    generator->SetTextL( *text );
+                    CleanupStack::PopAndDestroy( text );
+
+                    /* Insert generator into the movie. */
+                    TInt err = 0;
+                    index = ( iContainer->CurrentIndex() == iMovie->VideoClipCount()) ? iMovie->VideoClipCount(): iContainer->CurrentIndex() + 1;
+                    TRAP( err, iMovie->InsertVideoClipL( *generator, ETrue, index ));
+                    CleanupStack::Pop( generator );
+                    User::LeaveIfError( err );
+
+                    CleanupStack::PopAndDestroy( this ); // restore appui orientation
+                    }
+                break;
+                }
+            /*
+             * Insert CREDIT text *	
+             */
+        case EVeiCmdEditVideoViewInsertTextCredits:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewInsertTextCredits" );
+
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    StoreOrientation();
+                    CleanupStack::PushL( TCleanupItem( CleanupRestoreOrientation, this ));
+                    AppUi()->SetOrientationL( CAknAppUiBase::EAppUiOrientationPortrait );
+
+                    TSize res = TSize( iMovie->Resolution());
+                    CVeiTitleClipGenerator* generator = CVeiTitleClipGenerator::NewLC( res, 
+                                                                                       EVeiTitleClipTransitionNone, 
+                                                                                       EVeiTitleClipHorizontalAlignmentCenter, 
+                                                                                       EVeiTitleClipVerticalAlignmentCenter );
+
+                    HBufC* descriptiveName = StringLoader::LoadLC( R_VEI_EDIT_VIEW_CREDITS_NAME, iEikonEnv );
+                    generator->SetDescriptiveNameL( *descriptiveName );
+                    CleanupStack::PopAndDestroy( descriptiveName );
+
+                    generator->SetTransitionAndAlignmentsL( EVeiTitleClipTransitionScrollBottomToTop, 
+                                                            EVeiTitleClipHorizontalAlignmentCenter, 
+                                                            EVeiTitleClipVerticalAlignmentCenter );
+
+                    /* Ask for text. */
+                    HBufC* text = HBufC::NewLC( KTitleScreenMaxTextLength );
+                    TPtr txtptr( text->Des());
+                    CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL( txtptr );
+                    CleanupStack::PushL( textQuery );
+
+                    textQuery->SetMaxLength( KTitleScreenMaxTextLength );
+                    //textQuery->SetPredictiveTextInputPermitted(ETrue);
+                    CleanupStack::Pop( textQuery );
+
+                    if ( !textQuery->ExecuteLD( R_VEI_EDITVIDEO_TITLESCREEN_TEXT_QUERY ))
+                        {
+                        CleanupStack::PopAndDestroy( text );
+                        CleanupStack::PopAndDestroy( generator );
+                        CleanupStack::PopAndDestroy( this );
+                        break;
+                        }
+                    generator->SetTextL( *text );
+                    CleanupStack::PopAndDestroy( text );
+
+                    /* Insert generator into the movie. */
+                    TInt err = 0;
+                    index = ( iContainer->CurrentIndex() == iMovie->VideoClipCount()) ? iMovie->VideoClipCount(): iContainer->CurrentIndex() + 1;
+                    TRAP( err, iMovie->InsertVideoClipL( *generator, ETrue, index ));
+                    CleanupStack::Pop( generator );
+                    User::LeaveIfError( err );
+
+                    CleanupStack::PopAndDestroy( this ); // restore appui orientation
+                    }
+                break;
+                }
+
+            /*
+             * Edit Text *
+             */
+        case EVeiCmdEditVideoViewEditTextMove:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextMove" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
+                    Cba()->DrawDeferred();
+
+                    index = iContainer->CurrentIndex();
+
+                    if ( iContainer->CursorLocation() == VideoEditor::ECursorOnClip )
+                        {
+                        iOriginalVideoClipIndex = index;
+                        }
+                    else
+                        {
+                        User::Panic( _L( "VideoEditor" ), 34 );
+                        }
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeMove );
+                    UpdateEditNaviLabel();
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditTextChangeDuration:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextChangeDuration" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
+                    Cba()->DrawDeferred();
+                    index = iContainer->CurrentIndex();
+
+                    iOriginalVideoStartPoint = iMovie->VideoClipStartTime( index );
+                    iOriginalVideoCutInTime = iMovie->VideoClipCutInTime( index );
+                    iOriginalVideoCutOutTime = iMovie->VideoClipCutOutTime( index );
+
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeDuration );
+                    UpdateEditNaviLabel();
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditTextChangeText:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextChangeText" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    StoreOrientation();
+                    CleanupStack::PushL( TCleanupItem( CleanupRestoreOrientation, this ));
+                    AppUi()->SetOrientationL( CAknAppUiBase::EAppUiOrientationPortrait );
+
+                    Cba()->DrawDeferred();
+                    CVedVideoClipInfo* info = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+
+                    CVeiTitleClipGenerator* generator = STATIC_CAST( CVeiTitleClipGenerator* , info->Generator());
+                    HBufC* text = HBufC::NewLC( KTitleScreenMaxTextLength );
+                    *text = (( CVeiTitleClipGenerator* )info->Generator())->Text();
+
+                    TPtr txtptr( text->Des());
+                    CAknTextQueryDialog* textQuery = CAknTextQueryDialog::NewL( txtptr );
+                    CleanupStack::PushL( textQuery );
+
+                    textQuery->SetMaxLength( KTitleScreenMaxTextLength );
+                    //textQuery->SetPredictiveTextInputPermitted(ETrue);
+                    CleanupStack::Pop( textQuery );
+
+                    if ( !textQuery->ExecuteLD( R_VEI_EDITVIDEO_TITLESCREEN_TEXT_QUERY ))
+                        {
+                        CleanupStack::PopAndDestroy( text );
+                        CleanupStack::PopAndDestroy( this ); // restore appui orientation
+                        break;
+                        }
+                    generator->SetTextL( *text );
+                    CleanupStack::PopAndDestroy( text );
+                    UpdateEditNaviLabel();
+
+                    CleanupStack::PopAndDestroy( this ); // restore appui orientation
+                    }
+                break;
+                }
+
+        case EVeiCmdEditVideoViewEditTextSetTextColor:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextSetTextColor" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    CVedVideoClipInfo* info = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+                    CVeiTitleClipGenerator* generator = STATIC_CAST( CVeiTitleClipGenerator* , info->Generator());
+
+                    TRgb color = generator->TextColor();
+                    if ( !iPopup->ShowColorSelectorL( color ))
+                        {
+                        break;
+                        }
+                    generator->SetTextColorL( color );
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditTextSetBackGround:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextSetBackGround" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    CVedVideoClipInfo* info = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+                    CVeiTitleClipGenerator* generator = STATIC_CAST( CVeiTitleClipGenerator* , info->Generator());
+
+                    // ask for color or image
+                    TBool imageSelected;
+                    TInt err = iPopup->ShowTitleScreenBackgroundSelectionPopupL( imageSelected );
+                    if ( err != KErrNone )
+                        {
+                        break;
+                        }
+
+                    if ( imageSelected )
+                        {
+                        CDesCArrayFlat* selectedFiles = new( ELeave )CDesCArrayFlat( 1 );
+                        CleanupStack::PushL( selectedFiles );
+
+                        CVeiMGFetchVerifier* mgFetchVerifier = CVeiMGFetchVerifier::NewLC();
+
+                        if ( MGFetch::RunL( *selectedFiles, EImageFile, EFalse, mgFetchVerifier ) == EFalse )
+                            {
+                            /* User cancelled the dialog. */
+                            CleanupStack::PopAndDestroy( mgFetchVerifier );
+                            CleanupStack::PopAndDestroy( selectedFiles );
+                            break;
+                            }
+
+                        CleanupStack::PopAndDestroy( mgFetchVerifier );
+
+                        if ( !iWaitDialog )
+                            {
+                            iWaitDialog = new( ELeave )CAknWaitDialog( REINTERPRET_CAST( CEikDialog** , &iWaitDialog ), ETrue );
+                            iWaitDialog->ExecuteLD( R_VEI_WAIT_DIALOG_INSERTING_IMAGE );
+                            }
+
+
+                        TRAP( err, generator->SetBackgroundImageL(( *selectedFiles )[0], * this ));
+
+                        if ( err )
+                            {
+                            if ( iWaitDialog )
+                                {
+                                CancelWaitDialog();
+                                }
+                            ShowErrorNote( R_VEI_ERRORNOTE_IMAGE_INSERTING_FAILED );
+                            }
+
+                        CleanupStack::PopAndDestroy( selectedFiles );
+                        }
+                    else
+                        {
+                        TRgb color = generator->BackgroundColor();
+                        if ( !iPopup->ShowColorSelectorL( color ))
+                            {
+                            break;
+                            }
+                        generator->SetBackgroundColorL( color );
+                        }
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditTextStyle:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextStyle" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    /* Ask for style. */
+                    iPopup->ShowTitleScreenStyleSelectionPopupL();
+                    }
+                break;
+                }
+            /*
+             * Edit text, AddColorEffect *	
+             */
+        case EVeiCmdEditVideoViewEditTextAddColorEffect:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextAddColorEffect" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    iPopup->ShowEffectSelectionPopupListL();
+                    }
+                break;
+                }
+            /*
+             * Edit text style *	
+             */
+        case EVeiCmdEditVideoViewEditTextStyleTitle:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextStyleTitle" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    CVedVideoClipInfo* info = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+
+                    CVeiTitleClipGenerator* generator = STATIC_CAST( CVeiTitleClipGenerator* , info->Generator());
+
+                    HBufC* descriptiveName = StringLoader::LoadLC( R_VEI_EDIT_VIEW_TITLE_NAME, iEikonEnv );
+                    generator->SetDescriptiveNameL( *descriptiveName );
+                    CleanupStack::PopAndDestroy( descriptiveName );
+
+                    generator->SetTransitionAndAlignmentsL( EVeiTitleClipTransitionNone, 
+                                                            EVeiTitleClipHorizontalAlignmentCenter, 
+                                                            EVeiTitleClipVerticalAlignmentCenter );
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditTextStyleTitleFading:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextStyleTitleFading" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    CVedVideoClipInfo* info = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+
+                    CVeiTitleClipGenerator* generator = STATIC_CAST( CVeiTitleClipGenerator* , info->Generator());
+
+                    HBufC* descriptiveName = StringLoader::LoadLC( R_VEI_EDIT_VIEW_TITLE_FADING_NAME, iEikonEnv );
+                    generator->SetDescriptiveNameL( *descriptiveName );
+                    CleanupStack::PopAndDestroy( descriptiveName );
+                    generator->SetTransitionAndAlignmentsL( EVeiTitleClipTransitionFade, 
+                                                            EVeiTitleClipHorizontalAlignmentCenter, 
+                                                            EVeiTitleClipVerticalAlignmentCenter );
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditTextStyleSubTitle:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextStyleSubTitle" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    CVedVideoClipInfo* info = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+
+                    CVeiTitleClipGenerator* generator = STATIC_CAST( CVeiTitleClipGenerator* , info->Generator());
+
+                    HBufC* descriptiveName = StringLoader::LoadLC( R_VEI_EDIT_VIEW_SUBTITLE_NAME, iEikonEnv );
+                    generator->SetDescriptiveNameL( *descriptiveName );
+                    CleanupStack::PopAndDestroy( descriptiveName );
+                    generator->SetTransitionAndAlignmentsL( EVeiTitleClipTransitionNone, 
+                                                            EVeiTitleClipHorizontalAlignmentLeft, 
+                                                            EVeiTitleClipVerticalAlignmentBottom );
+
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditTextStyleSubTitleFading:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextStyleSubTitleFading" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    CVedVideoClipInfo* info = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+
+                    CVeiTitleClipGenerator* generator = STATIC_CAST( CVeiTitleClipGenerator* , info->Generator());
+
+                    HBufC* descriptiveName = StringLoader::LoadLC( R_VEI_EDIT_VIEW_SUBTITLE_FADING_NAME, iEikonEnv );
+                    generator->SetDescriptiveNameL( *descriptiveName );
+                    CleanupStack::PopAndDestroy( descriptiveName );
+                    generator->SetTransitionAndAlignmentsL( EVeiTitleClipTransitionFade, 
+                                                            EVeiTitleClipHorizontalAlignmentLeft, 
+                                                            EVeiTitleClipVerticalAlignmentBottom );
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditTextStyleCredit:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextStyleCredit" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    CVedVideoClipInfo* info = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+
+                    CVeiTitleClipGenerator* generator = STATIC_CAST( CVeiTitleClipGenerator* , info->Generator());
+
+                    HBufC* descriptiveName = StringLoader::LoadLC( R_VEI_EDIT_VIEW_CREDITS_NAME, iEikonEnv );
+                    generator->SetDescriptiveNameL( *descriptiveName );
+                    CleanupStack::PopAndDestroy( descriptiveName );
+                    generator->SetTransitionAndAlignmentsL( EVeiTitleClipTransitionScrollBottomToTop, 
+                                                            EVeiTitleClipHorizontalAlignmentCenter, 
+                                                            EVeiTitleClipVerticalAlignmentCenter );
+                    }
+                break;
+                }
+            /*
+             * Edit text, Duplicate *	
+             */
+        case EVeiCmdEditVideoViewEditTextDuplicate:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditTextDuplicate" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    CVedVideoClipInfo* previousInfo = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+                    CVeiTitleClipGenerator* generator = STATIC_CAST( CVeiTitleClipGenerator* , previousInfo->Generator());
+
+                    iWaitMode = EDuplicating;
+
+                    CVeiTitleClipGenerator* generator2 = CVeiTitleClipGenerator::NewLC( iMovie->Resolution(), 
+                                                                                        generator->Transition(), 
+                                                                                        generator->HorizontalAlignment(), 
+                                                                                        generator->VerticalAlignment());
+
+                    generator2->SetDescriptiveNameL( generator->DescriptiveName());
+                    generator2->SetTransitionAndAlignmentsL( generator->Transition(), 
+                                                             generator->HorizontalAlignment(), 
+                                                             generator->VerticalAlignment() );
+                    generator2->SetTextL( generator->Text());
+                    generator2->SetTextColorL( generator->TextColor());
+
+                    generator2->SetBackgroundColorL( generator->BackgroundColor());
+                    if ( generator->BackgroundImage())
+                        {
+                        generator2->SetBackgroundImageL( generator->BackgroundImage());
+                        }
+
+                    generator2->SetDuration( generator->Duration());
+
+                    TInt err = 0;
+                    index = ( iContainer->CurrentIndex() == iMovie->VideoClipCount()) ? iMovie->VideoClipCount(): iContainer->CurrentIndex() + 1;
+                    TRAP( err, iMovie->InsertVideoClipL( *generator2, ETrue, index ));
+
+                    CleanupStack::Pop( generator2 );
+                    User::LeaveIfError( err );
+                    }
+                break;
+                }
+            /**
+             * Insert Image
+             */
+        case EVeiCmdEditVideoViewInsertImage:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewInsertImage" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    TTimeIntervalMicroSeconds duration( 5000000 );
+
+                    CDesCArrayFlat* selectedFiles = new( ELeave )CDesCArrayFlat( 1 );
+                    CleanupStack::PushL( selectedFiles );
+
+                    CVeiMGFetchVerifier* mgFetchVerifier = CVeiMGFetchVerifier::NewLC();
+
+                    if ( MGFetch::RunL( *selectedFiles, EImageFile, EFalse, mgFetchVerifier ) == EFalse )
+                        {
+                        /* User cancelled the dialog. */
+                        CleanupStack::PopAndDestroy( mgFetchVerifier );
+                        CleanupStack::PopAndDestroy( selectedFiles );
+                        break;
+                        }
+
+                    CleanupStack::PopAndDestroy( mgFetchVerifier );
+
+                    if ( !iWaitDialog )
+                        {
+                        iWaitDialog = new( ELeave )CAknWaitDialog( REINTERPRET_CAST( CEikDialog** , &iWaitDialog ), ETrue );
+                        iWaitDialog->ExecuteLD( R_VEI_WAIT_DIALOG_INSERTING_IMAGE );
+                        }
+
+                    RFs& fs = iEikonEnv->FsSession();
+
+                    TRAPD( err, iGenerator = CVeiImageClipGenerator::NewL(( *selectedFiles )[0], 
+                                                                            TSize( KMaxVideoFrameResolutionX, KMaxVideoFrameResolutionY ), 
+                                                                            duration, 
+                                                                            KRgbBlack, 
+                                                                            KVideoClipGenetatorDisplayMode, 
+                                                                            fs, 
+                                                                            *this ));
+                    if ( err )
+                        {
+                        if ( iWaitDialog )
+                            {
+                            CancelWaitDialog();
+                            }
+                        ShowErrorNote( R_VEI_ERRORNOTE_IMAGE_INSERTING_FAILED );
+                        }
+
+                    CleanupStack::PopAndDestroy( selectedFiles );
+                    }
+                break;
+                }
+
+            /**
+             * Edit Image * 
+             */
+        case EVeiCmdEditVideoViewEditImageMove:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditImageMove" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
+                    Cba()->DrawDeferred();
+
+                    index = iContainer->CurrentIndex();
+
+                    if ( iContainer->CursorLocation() == VideoEditor::ECursorOnClip )
+                        {
+                        iOriginalVideoClipIndex = index;
+                        }
+                    else
+                        {
+                        User::Panic( _L( "VideoEditor" ), 34 );
+                        }
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeMove );
+                    UpdateEditNaviLabel();
+                    }
+                break;
+                }
+
+        case EVeiCmdEditVideoViewEditImageChangeDuration:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditImageChangeDuration" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
+                    Cba()->DrawDeferred();
+                    index = iContainer->CurrentIndex();
+
+                    iOriginalVideoStartPoint = iMovie->VideoClipStartTime( index );
+                    iOriginalVideoCutInTime = iMovie->VideoClipCutInTime( index );
+                    iOriginalVideoCutOutTime = iMovie->VideoClipCutOutTime( index );
+
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeDuration );
+                    UpdateEditNaviLabel();
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditImageBackGround:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditImageBackGround" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    CVedVideoClipInfo* info = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+                    CVeiImageClipGenerator* generator = STATIC_CAST( CVeiImageClipGenerator* , info->Generator());
+
+                    // ask for color			
+                    TRgb color = generator->BackgroundColor();
+                    if ( !iPopup->ShowColorSelectorL( color ))
+                        {
+                        break;
+                        }
+
+                    generator->SetBackgroundColor( color );
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditImageAddColorEffect:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditImageAddColorEffect" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    iPopup->ShowEffectSelectionPopupListL();
+                    }
+                break;
+                }
+            // * DUPLICATE Image *
+        case EVeiCmdEditVideoViewEditImageDuplicate:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditImageDuplicate" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    CVedVideoClipInfo* previousInfo = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+                    CVeiImageClipGenerator* generator = STATIC_CAST( CVeiImageClipGenerator* , previousInfo->Generator());
+
+                    RFs& fs = iEikonEnv->FsSession();
+
+                    iWaitMode = EDuplicating;
+
+                    iGenerator = CVeiImageClipGenerator::NewL( generator->ImageFilename(), 
+                                                               TSize( KMaxVideoFrameResolutionX, KMaxVideoFrameResolutionY ), 
+                                                               previousInfo->Duration(), 
+                                                               generator->BackgroundColor(), 
+                                                               KVideoClipGenetatorDisplayMode, 
+                                                               fs, 
+                                                               *this );
+                    }
+                break;
+                }
+
+            /**
+             * Insert -> Sound clip
+             */
+        case EVeiCmdEditVideoViewInsertAudio:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewInsertAudio" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    if ( !iMediaQueue->ShowAudioClipDialogL())
+                        {
+                        break;
+                        }
+                    }
+                HandleScreenDeviceChangedL();
+                break;
+                }
+            /**
+             * Insert -> New sound clip
+             */
+        case EVeiCmdEditVideoViewInsertNewAudio:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewInsertNewAudio" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    InsertNewAudio();
+                    }
+                break;
+                }
+
+        case EVeiCmdEditVideoViewEditAudioSetDuration:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditAudioSetDuration" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
+                    Cba()->DrawDeferred();
+                    index = iContainer->CurrentIndex();
+
+                    iOriginalAudioStartPoint = iMovie->AudioClipStartTime( index );
+                    iOriginalAudioDuration = iMovie->AudioClipEditedDuration( index );
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeDuration );
+                    UpdateEditNaviLabel();
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewSettings:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewSettings" );
+                AppUi()->ActivateLocalViewL( TUid::Uid( EVeiSettingsView ));
+                break;
+                }
+        case EVeiCmdEditVideoViewRecord:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewRecord" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    /* Set the mode, CBAs and Navi label. */
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeRecording );
+
+                    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
+                    Cba()->DrawDeferred();
+                    UpdateEditNaviLabel();
+
+                    iRecordedAudioMaxDuration = TTimeIntervalMicroSeconds(  - 1 );
+                    for ( TInt i = 0; i < iMovie->AudioClipCount(); i++ )
+                        {
+
+                        if ( iMovie->AudioClipStartTime( i ) > iContainer->RecordedAudioStartTime())
+                            {
+                            TInt64 startTimeInt = iContainer->RecordedAudioStartTime().Int64();
+                            TInt64 nextStartTimeInt = iMovie->AudioClipStartTime( i ).Int64();
+                            iRecordedAudioMaxDuration = TTimeIntervalMicroSeconds( nextStartTimeInt - startTimeInt );
+                            break;
+                            }
+                        }
+
+                    iRecorder->RecordL();
+                    const TUint delay = 1000 * 1000 / 10;
+
+                    iAudioRecordPeriodic->Start( delay, delay, TCallBack( CVeiEditVideoView::UpdateAudioRecording, this ));
+
+                    iContainer->SetRecordedAudioDuration( TTimeIntervalMicroSeconds( 0 ));
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewRecordCancel:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewRecordCancel" );
+                // cancel recording
+                iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+                Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                iContainer->SetRecordedAudioStartTime( TTimeIntervalMicroSeconds( 0 ));
+                iContainer->SetCursorLocation( VideoEditor::ECursorOnAudio );
+                Cba()->DrawDeferred();
+
+                UpdateEditNaviLabel();
+                break;
+                }
+            /*
+             *   Stop previewing
+             */
+        case EVeiCmdPlayViewStop:
+        case EVeiCmdCutVideoViewStop:
+        case EVeiCmdEditVideoViewRecordStop:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdPlayViewStop||EVeiCmdCutVideoViewStop||EVeiCmdEditVideoViewRecordStop" );
+                if ( EditorState() == EQuickPreview )
+                    {
+                    iContainer->StopVideo( EFalse );
+                    iContainer->SetFinishedStatus( ETrue );
+                    StopNaviPaneUpdateL();
+                    LOG( KVideoEditorLogFile, "\tEVeiCmdPlayViewStop||EVeiCmdCutVideoViewStop||EVeiCmdEditVideoViewRecordStop, setting R_VEI_SOFTKEYS_PREVIEW_PLAY_BACK" );
+                    Cba()->SetCommandSetL( R_VEI_SOFTKEYS_PREVIEW_PLAY_BACK );
+                    Cba()->DrawDeferred();
+                    break;
+                    }
+
+                // stop recording
+                iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+                Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                Cba()->DrawDeferred();
+                UpdateEditNaviLabel();
+
+                iRecorder->Stop();
+                iAudioRecordPeriodic->Cancel();
+
+                if ( iAudioClipInfo )
+                    {
+                    delete iAudioClipInfo;
+                    iAudioClipInfo = NULL;
+                    }
+
+                iProgressNote = new( ELeave )CAknProgressDialog( REINTERPRET_CAST( CEikDialog** , &iProgressNote ), ETrue );
+
+                iProgressNote->SetCallback( this );
+                iProgressNote->ExecuteDlgLD( R_VEI_PROGRESS_NOTE );
+                HBufC* stringholder = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_INSERTING_AUDIO, iEikonEnv );
+                CleanupStack::PushL( stringholder );
+
+                iProgressNote->SetTextL( *stringholder );
+                CleanupStack::PopAndDestroy( this ); // stringholder
+
+                iProgressNote->GetProgressInfoL()->SetFinalValue( 100 );
+                iWaitMode = EOpeningAudioInfo;
+
+                iAudioClipInfo = CVedAudioClipInfo::NewL( *iTempRecordedAudio, *this );
+                break;
+                }
+        case EVeiCmdPlayViewPause:
+        case EVeiCmdEditVideoViewRecordPause:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdPlayViewPause||EVeiCmdEditVideoViewRecordPause" );
+                if ( EditorState() == EQuickPreview )
+                    {
+                    iContainer->PauseVideoL();
+                    StopNaviPaneUpdateL();
+
+                    LOG( KVideoEditorLogFile, "\tEVeiCmdPlayViewPause||EVeiCmdEditVideoViewRecordPause, setting R_VEI_SOFTKEYS_PREVIEW_PLAY_BACK" );
+                    Cba()->SetCommandSetL( R_VEI_SOFTKEYS_PREVIEW_PLAY_BACK );
+                    Cba()->DrawDeferred();
+                    }
+                else
+                    {
+                    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
+                    Cba()->DrawDeferred();
+
+                    // Pause recording
+                    // Cba is set to CONTINUE_STOP in DoUpdateAudioRecording()
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeRecordingPaused );
+                    iRecorder->Stop();
+                    UpdateEditNaviLabel();
+                    }
+                break;
+                }
+            /*
+             *	Preview continue:
+             */
+        case EVeiCmdCutVideoViewPlay:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdCutVideoViewPlay" );
+
+                if ( !iUpdateTemp && !iTempFile && 1 == iMovie->VideoClipCount() )
+                    {
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModePreview );
+                    iContainer->PlayVideo( iMovie->VideoClipInfo( 0 )->DescriptiveName(), iFullScreenSelected );
+                    }
+                else
+                    {
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModePreview );
+                    iContainer->PlayVideo( *iTempFile, iFullScreenSelected );
+                    }
+
+                // @: think should this be put under condition play was started
+                // (actually play starts when "loadingComplete" event comes to NotifyVideoDisplayEvent
+                //StartNaviPaneUpdateL();            
+                break;
+                }
+
+        case EVeiCmdCutVideoTakeSnapshot:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdCutVideoTakeSnapshot" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    iContainer->TakeSnapshotL();
+                    }
+                break;
+                }
+
+        case EVeiCmdCutVideoViewContinue:
+        case EVeiCmdEditVideoViewContinue:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdCutVideoViewContinue||EVeiCmdEditVideoViewContinue" );
+                if (( iRecorder->State() != CMdaAudioClipUtility::ERecording ) && 
+                    ( iRecorder->State() != CMdaAudioClipUtility::ENotReady ) )
+                    {
+                    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
+                    Cba()->DrawDeferred();
+
+                    // Continue recording
+                    iRecorder->RecordL();
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeRecording );
+
+                    UpdateEditNaviLabel();
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditAudioMove:
+        case EVeiCmdEditVideoViewEditVideoMove:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditAudioMove||EVeiCmdEditVideoViewEditVideoMove" );
+                Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
+                Cba()->DrawDeferred();
+
+                index = iContainer->CurrentIndex();
+
+                if ( iContainer->CursorLocation() == VideoEditor::ECursorOnAudio )
+                    {
+                    iOriginalAudioStartPoint = iMovie->AudioClipStartTime( index );
+                    iOriginalAudioDuration = iMovie->AudioClipEditedDuration( index );
+                    }
+                else if ( iContainer->CursorLocation() == VideoEditor::ECursorOnClip )
+                    {
+                    iOriginalVideoClipIndex = index;
+                    }
+                else
+                    {
+                    User::Panic( _L( "VideoEditor" ), 34 );
+                    }
+                iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeMove );
+                UpdateEditNaviLabel();
+                break;
+                }
+            /**
+             * Edit video clip -> Add colour effect
+             */
+        case EVeiCmdEditVideoViewEditVideoColorEffect:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditVideoColorEffect" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    iPopup->ShowEffectSelectionPopupListL();
+                    }
+                break;
+                }
+            /**
+             * Use slow motion
+             */
+        case EVeiCmdEditVideoViewEditVideoSlowMotion:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditVideoSlowMotion" );
+                if ( IsEnoughFreeSpaceToSaveL())
+                    {
+                    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
+                    Cba()->DrawDeferred();
+                    iOriginalVideoSpeed = iMovie->VideoClipSpeed( iContainer->CurrentIndex());
+                    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeSlowMotion );
+                    iContainer->SetSlowMotionStartValueL( iOriginalVideoSpeed );
+                    iContainer->ArrowsControl();
+                    }
+                break;
+                }
+        case EVeiCmdEditVideoViewEditVideoMute:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditVideoMute" );
+                SetNewTempFileNeeded( ETrue );
+                iMovie->VideoClipSetMuted( iContainer->CurrentIndex(), ETrue );
+                break;
+                }
+        case EVeiCmdEditVideoViewEditVideoUnmute:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditVideoUnmute" );
+                SetNewTempFileNeeded( ETrue );
+                iMovie->VideoClipSetMuted( iContainer->CurrentIndex(), EFalse );
+                break;
+                }
+        case EVeiCmdEditVideoViewEditAudioRemove:
+        case EVeiCmdEditVideoViewEditVideoRemove:
+        case EVeiCmdEditVideoViewEditTextRemove:
+        case EVeiCmdEditVideoViewEditImageRemove:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewEditAudioRemove||EVeiCmdEditVideoViewEditVideoRemove||EVeiCmdEditVideoViewEditTextRemove||EVeiCmdEditVideoViewEditImageRemove" );
+                RemoveCurrentClipL();
+                break;
+                }
+            /**
+             * Back
+             */
+        case EAknSoftkeyBack:
+                {
+                LOG( KVideoEditorLogFile, "CVeiEditVideoView::HandleCommandL: EAknSoftkeyBack" );
+                LOGFMT( KVideoEditorLogFile, "\tiFullScreenSelected: %d", iFullScreenSelected );
+
+                if ( EditorState() != EEdit || iFullScreenSelected )
+                    {
+                    iFullScreenSelected = EFalse;
+                    iContainer->StopVideo( ETrue );
+                    StopNaviPaneUpdateL();
+                    UpdateEditNaviLabel();
+                    break;
+                    }
+                else if ( !iMovieSavedFlag && ( iMovie->VideoClipCount() > 0 || iMovie->AudioClipCount() > 0 ))
+                    {
+                    HBufC* saveConfirmationString; // String holding the text shown in dialog.
+                    CAknQueryDialog* dlg; // Save confirmation dialog.
+                    TInt saveEditedVideo; // Query result.
+
+                    saveConfirmationString = StringLoader::LoadLC( R_VEI_CONFIRM_EXIT_SAVE, iEikonEnv );
+                    dlg = new( ELeave )CAknQueryDialog( *saveConfirmationString, CAknQueryDialog::ENoTone );
+                    saveEditedVideo = dlg->ExecuteLD( R_VEI_CONFIRMATION_QUERY );
+
+                    if ( !saveEditedVideo )
+                    // Do not save.
+                        {
+                        // Activate videos view.                    
+                        AppUi()->HandleCommandL( EAknCmdExit );
+
+                        iMovie->Reset();
+
+                        iMovieSavedFlag = ETrue; // Movie is saved.
+                        iMovieFirstAddFlag = ETrue; // True for the next edit process.
+
+                        AppUi()->HandleCommandL( aCommand );
+                        }
+                    else
+                        {
+                        if ( SaveL( EProcessingMovieSaveThenQuit ))
+                        // Quit after saving?
+                            {
+                            //iMovieSavedFlag = ETrue;		// Movie is saved.
+                            iMovieFirstAddFlag = ETrue; // True for the next edit process.
+                            iWaitMode = EProcessingMovieSaveThenQuit;
+                            }
+                        }
+
+                    CleanupStack::PopAndDestroy( saveConfirmationString ); 
+                    }
+                // No changes to clip(s) or no clip(s) in time line.
+                else
+                    {
+                    // Remove all clips from edit view (for future use).
+                    iMovie->Reset();
+
+                    iMovieSavedFlag = ETrue; // Movie is saved.
+                    iMovieFirstAddFlag = ETrue; // True for the next edit process.
+                    AppUi()->HandleCommandL( aCommand );
+                    }
+
+                break;
+                }
+            //
+            // Options->Help
+            //
+        case EVeiCmdEditVideoViewHelp:
+                {
+                LOG( KVideoEditorLogFile, "\tEVeiCmdEditVideoViewHelp" );
+                // CS Help launching is handled in Video Editor's AppUi.
+                AppUi()->HandleCommandL( EVeiCmdEditVideoViewHelp );
+                break;
+                }
+            /**
+             * Exit
+             */
+        case EEikCmdExit:
+                {
+                LOG( KVideoEditorLogFile, "\tEEikCmdExit" );
+                // Edited movie is not saved yet and there are video or audio clip(s) at the time line.
+                if ( !iMovieSavedFlag && ( iMovie->VideoClipCount() > 0 || iMovie->AudioClipCount() > 0 ))
+                    {
+                    HBufC* stringholder; // String holding the text shown in dialog.
+                    
+                    CAknQueryDialog* dlg; // Save confirmation dialog.
+                    TInt queryok; // Query result.
+
+                    stringholder = StringLoader::LoadLC( R_VEI_CONFIRM_EXIT_SAVE, iEikonEnv );
+
+                    dlg = new( ELeave )CAknQueryDialog( *stringholder, CAknQueryDialog::ENoTone );
+                    queryok = dlg->ExecuteLD( R_VEI_CONFIRMATION_QUERY );
+
+                    if ( !queryok )
+                        {
+                        iMovie->Reset();
+                        AppUi()->HandleCommandL( aCommand );
+                        }
+                    else
+                        {
+                        SaveL( EProcessingMovieSaveThenQuit );
+                        iWaitMode = EProcessingMovieSaveThenQuit;
+                        }
+
+                    CleanupStack::PopAndDestroy( stringholder );
+                    }
+                else
+                // No changes to clip(s) or no clip(s) in time line.
+                    {
+                    iMovie->Reset(); // Remove all clips from edit view.
+                    AppUi()->HandleCommandL( aCommand ); // Let appUi handle the exit.
+                    }
+                break;
+                }
+        default:
+                {
+                LOG( KVideoEditorLogFile, "\tdefault" );
+                AppUi()->HandleCommandL( aCommand );
+                break;
+                }
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::HandleCommandL: Out" );
+    }
+
+void CVeiEditVideoView::HandleResourceChange( TInt aType )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::HandleResourceChange() In, aType:%d", aType );
+
+    if ( KAknsMessageSkinChange == aType )
+        {
+        // Handle skin change in the navi label controls - they do not receive 
+        // it automatically since they are not in the control stack
+        iPreviewLabel->DecoratedControl()->HandleResourceChange( aType );
+        iEditLabel->DecoratedControl()->HandleResourceChange( aType );
+        iVolumeNavi->DecoratedControl()->HandleResourceChange( aType );
+        iMoveLabel->DecoratedControl()->HandleResourceChange( aType );
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::HandleResourceChange() Out" );
+    }
+
+void CVeiEditVideoView::SetEditorState( TEditorState aState )
+    {
+    LOGFMT3( KVideoEditorLogFile, "CVeiEditVideoView::SetEditorState: in, aState:%d, iEditorState:%d, iFullScreenSelected:%d", aState, iEditorState, iFullScreenSelected );
+
+    CAknTitlePane* titlePane;
+    CEikStatusPane* statusPane;
+    TResourceReader reader1;
+
+    iEditorState = aState;
+
+    switch ( aState )
+        {
+        case EPreview:
+            /*
+            if ( iFullScreenSelected )
+            {
+            // @: this need more elaborating
+            // problem is: after large preview signal and battery pane are black in some phone models
+            //statusPane = ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); 
+            //statusPane ->MakeVisible( EFalse );
+            Cba()->MakeVisible( EFalse );
+            Cba()->DrawDeferred();
+            }
+            else
+            {
+            iEditorState = EQuickPreview;
+            statusPane = ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); 
+
+            titlePane = (CAknTitlePane*) statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) );
+            iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_PREVIEW_VIEW_TITLE_NAME );
+            titlePane->SetFromResourceL( reader1 );
+            CleanupStack::PopAndDestroy(); //reader1
+
+            LOG(KVideoEditorLogFile, "CVeiEditVideoView::SetEditorState, 1, setting R_VEI_SOFTKEYS_PREVIEW_PAUSE_BACK");
+            Cba()->SetCommandSetL( R_VEI_SOFTKEYS_PREVIEW_PAUSE_BACK );
+            Cba()->DrawDeferred();
+            }
+             */
+            Cba()->MakeVisible( EFalse );
+            Cba()->DrawDeferred();
+            break;
+        case EQuickPreview:
+                {
+                LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::SetEditorState: 2, iContainer->PreviewState():%d", iContainer->PreviewState());
+                statusPane = (( CAknAppUi* )iEikonEnv->EikAppUi())->StatusPane();
+
+                titlePane = ( CAknTitlePane* )statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ));
+                iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_PREVIEW_VIEW_TITLE_NAME );
+                titlePane->SetFromResourceL( reader1 );
+                CleanupStack::PopAndDestroy(); //reader1
+
+                if (( iContainer->PreviewState() == CVeiEditVideoContainer::EStatePaused ) || 
+                    ( iContainer->PreviewState() == CVeiEditVideoContainer::EStateStopped ))
+                    {
+                    LOG( KVideoEditorLogFile, "CVeiEditVideoView::SetEditorState, 3, setting R_VEI_SOFTKEYS_PREVIEW_PLAY_BACK" );
+                    Cba()->SetCommandSetL( R_VEI_SOFTKEYS_PREVIEW_PLAY_BACK );
+                    }
+                else if (( iContainer->PreviewState() == CVeiEditVideoContainer::EStateOpening ) || 
+                         ( iContainer->PreviewState() == CVeiEditVideoContainer::EStateGettingFrame ) || 
+                         ( iContainer->PreviewState() == CVeiEditVideoContainer::EStateBuffering ))
+                    {
+                    LOG( KVideoEditorLogFile, "CVeiEditVideoView::SetEditorState, 4, setting R_AVKON_SOFTKEYS_EMPTY" );
+                    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
+                    }
+                else
+                    {
+                    LOG( KVideoEditorLogFile, "CVeiEditVideoView::SetEditorState, 5, setting R_VEI_SOFTKEYS_PREVIEW_PAUSE_BACK" );
+                    Cba()->SetCommandSetL( R_VEI_SOFTKEYS_PREVIEW_PAUSE_BACK );
+                    }
+                Cba()->DrawDeferred();
+                break;
+                }
+        case EEdit:
+            iContainer->SetRect( AppUi()->ClientRect());
+            statusPane = (( CAknAppUi* )iEikonEnv->EikAppUi())->StatusPane();
+            // @: this needs more elaborating
+            //statusPane ->MakeVisible( ETrue );
+
+            titlePane = ( CAknTitlePane* )statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ));
+            iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_EDIT_VIDEO_VIEW_TITLE_NAME );
+            titlePane->SetFromResourceL( reader1 );
+            CleanupStack::PopAndDestroy(); //reader1
+
+            Cba()->MakeVisible( ETrue );
+            Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+            Cba()->DrawDeferred();
+            break;
+
+        case EMixAudio:
+            iContainer->SetRect( AppUi()->ClientRect());
+            statusPane = (( CAknAppUi* )iEikonEnv->EikAppUi())->StatusPane();
+
+            titlePane = ( CAknTitlePane* )statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ));
+            iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_AUDIO_MIX_VIEW_TITLE_NAME );
+            titlePane->SetFromResourceL( reader1 );
+            CleanupStack::PopAndDestroy(); //reader1
+
+            Cba()->MakeVisible( ETrue );
+            Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_DONE );
+            Cba()->DrawDeferred();
+            iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeMixingAudio );
+
+            break;
+
+        case EAdjustVolume:
+            iContainer->SetRect( AppUi()->ClientRect());
+            statusPane = (( CAknAppUi* )iEikonEnv->EikAppUi())->StatusPane();
+
+            titlePane = ( CAknTitlePane* )statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ));
+            iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_ADJUST_VOLUME_VIEW_TITLE_NAME );
+            titlePane->SetFromResourceL( reader1 );
+            CleanupStack::PopAndDestroy(); //reader1
+
+            Cba()->MakeVisible( ETrue );
+            //Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_DONE);			
+            Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
+            Cba()->DrawDeferred();
+            iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeAdjustVolume );
+
+            break;
+
+
+        default:
+                {
+                break;
+                }
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::SetEditorState: Out" );
+    }
+
+
+void CVeiEditVideoView::SendMovieL()
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::SendMovieL() -- SENDING" );
+
+    TEntry fileinfo;
+
+    RFs& fs = iEikonEnv->FsSession();
+    // Rename movie from xxxx.$$$ to defaultfilename from settingsview.
+    // looks better in attachment list..
+
+    // Get default movie name from settings view
+
+    TPtr temppeet = iTempFile->Des();
+
+    TParse parse;
+    parse.Set( iMovieSaveSettings.DefaultVideoName(), &temppeet, NULL );
+
+    TFileName orgPathAndName = parse.FullName();
+
+    TVedVideoFormat movieQuality = iMovie->Format();
+    if ( movieQuality == EVedVideoFormatMP4 )
+        {
+        orgPathAndName.Replace( orgPathAndName.Length() - 4, 4, KExtMp4 );
+        }
+    else
+        {
+        orgPathAndName.Replace( orgPathAndName.Length() - 4, 4, KExt3gp );
+        }
+
+    fs.Replace( *iTempFile, orgPathAndName );
+    iTempFile->Des() = orgPathAndName;
+
+    fs.Entry( *iTempFile, fileinfo );
+
+    DEBUGLOG_ARG( TInt tempFileSize = fileinfo.iSize / 1024 );
+    LOGFMT3( KVideoEditorLogFile, "CVeiEditVideoView::SendMovieL() 1, iWaitMode:%d, tempFileSize:%d, ValidateServiceL:%d", iWaitMode, tempFileSize, iSendAppUi.ValidateServiceL( iGivenSendCommand, TSendingCapabilities( 0, tempFileSize, TSendingCapabilities::ESupportsAttachments )));
+
+    if ( EProcessingMovieSend == iWaitMode 
+                /*&& (iSendAppUi.ValidateServiceL(
+                                iGivenSendCommand, 
+                                TSendingCapabilities( 0, 
+                                                      tempFileSize, 
+                                                      TSendingCapabilities::ESupportsAttachments ) ) ) */ )
+        {
+        RFs shareFServer;
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::SendMovieL: shareFServer connect." );
+
+        User::LeaveIfError( shareFServer.Connect());
+        shareFServer.ShareProtected();
+        CleanupClosePushL < RFs > ( shareFServer );
+
+        RFile openFileHandle;
+
+        TInt err = openFileHandle.Open( shareFServer, * iTempFile, EFileRead | EFileShareReadersOnly );
+        if ( KErrNone != err )
+            {
+            LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::SendMovieL 2: Could not open file %S with EFileShareReadersOnly. Trying EFileShareAny", iTempFile );
+            User::LeaveIfError( openFileHandle.Open( shareFServer, * iTempFile, EFileRead | EFileShareAny ));
+            }
+
+        CMessageData* messageData = CMessageData::NewLC();
+        messageData->AppendAttachmentHandleL( openFileHandle );
+
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::SendMovieL() 3" );
+
+        iSendAppUi.CreateAndSendMessageL( iGivenSendCommand, messageData, KNullUid, EFalse );
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::SendMovieL() 4" );
+        CleanupStack::PopAndDestroy( messageData );
+
+        CleanupStack::PopAndDestroy( &shareFServer ); // shareFServer.Close();
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::SendMovieL 5: shareFServer closed." );
+        }
+
+    DoUpdateEditNaviLabelL();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::SendMovieL() Out" );
+    }
+
+
+void CVeiEditVideoView::StartTempFileProcessingL()
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::StartTempFileProcessingL: In" );
+
+    RFs& fs = iEikonEnv->FsSession();
+
+    TBool fileExists( ETrue );
+    if ( iTempFile )
+        {
+        fileExists = BaflUtils::FileExists( fs, * iTempFile );
+        }
+
+    /* to save from unnecessary processing before preview
+    prerequisites:
+    -user selected preview
+    -no movie modifying actions taken by user before preview (iUpdateTemp is EFalse)	 
+     */
+    if ( EProcessingMoviePreview == iWaitMode && !iUpdateTemp && !iTempFile && 1 == iMovie->VideoClipCount())
+        {
+        if ( iFullScreenSelected )
+            {
+            iContainer->SetBlackScreen( ETrue );
+            iContainer->SetRect( AppUi()->ApplicationRect());
+            }
+
+        iContainer->SetSelectionMode( CVeiEditVideoContainer::EModePreview );
+        iContainer->PlayVideoFileL( iMovie->VideoClipInfo( 0 )->DescriptiveName(), iFullScreenSelected );
+        }
+    else if ( EProcessingMovieTrimMms == iWaitMode && !iUpdateTemp && !iTempFile && 1 == iMovie->VideoClipCount() && !FitsToMmsL())
+        {
+        /*
+        Read documentation of FitsToMmsL() in the header file
+         */
+        TBuf8 < KMaxFileName > conv8Filename;
+        CnvUtfConverter::ConvertFromUnicodeToUtf8( conv8Filename, iMovie->VideoClipInfo( 0 )->DescriptiveName());
+        iMovie->UnregisterMovieObserver( iContainer );
+        iMovie->UnregisterMovieObserver( this );
+        AppUi()->ActivateLocalViewL( TUid::Uid( EVeiTrimForMmsView ), TUid::Uid( 0 ), conv8Filename );
+        }
+    else if ( iUpdateTemp || !fileExists || ( !iTempFile ))
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::StartTempFileProcessingL() 1, -- NEW TEMP" );
+
+        Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
+        Cba()->DrawDeferred();
+        if ( iTempFile && fileExists )
+            {
+            User::LeaveIfError( fs.Delete( *iTempFile ));
+            delete iTempFile;
+            iTempFile = NULL;
+            }
+
+        if ( !IsEnoughFreeSpaceToSaveL()) // modifies iMemoryInUse
+            {
+            return ;
+            }
+
+        iTempFile = HBufC::NewL( KMaxFileName );
+        iTempMaker->GenerateTempFileName( *iTempFile, iMemoryInUse, iMovie->Format());
+        LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::StartTempFileProcessingL 2, iTempFile:%S", iTempFile );
+
+        TVeiSettings movieSaveSettings;
+
+        STATIC_CAST( CVeiAppUi* , AppUi())->ReadSettingsL( movieSaveSettings );
+
+        TInt settingsSaveQuality = movieSaveSettings.SaveQuality();
+        CVedMovie::TVedMovieQuality saveQuality;
+
+        switch ( settingsSaveQuality )
+            {
+            case TVeiSettings::EMmsCompatible: 
+                {
+                saveQuality = CVedMovie::EQualityMMSInteroperability;
+                break;                    
+                }
+            case TVeiSettings::EMedium: 
+                {
+                saveQuality = CVedMovie::EQualityResolutionMedium;
+                break;                    
+                }
+            case TVeiSettings::EBest: 
+                {
+                saveQuality = CVedMovie::EQualityResolutionHigh;
+                break;                    
+                }
+            case TVeiSettings::EAuto: default:
+                {
+                saveQuality = CVedMovie::EQualityAutomatic;
+                break;                    
+                }
+            }
+
+        iMovie->SetQuality( saveQuality );
+        iBackupSaveQuality = saveQuality;
+
+        if ( EProcessingMovieTrimMms == iWaitMode )
+            {
+            if ( saveQuality != CVedMovie::EQualityMMSInteroperability )
+                {
+                iMovie->SetQuality( CVedMovie::EQualityMMSInteroperability );
+                SetNewTempFileNeeded( ETrue );
+                }
+            else
+                {
+                SetNewTempFileNeeded( EFalse );
+                }
+            }
+
+        TInt err;
+        LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::StartTempFileProcessingL 3, calling iMovie->Process(%S)", iTempFile );
+        TRAP( err, iMovie->ProcessL( *iTempFile, * this ));
+        LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::StartTempFileProcessingL 4, err:%d", err );
+        if ( err )
+            {
+            Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+            Cba()->DrawDeferred();
+            ShowGlobalErrorNote( err );
+            }
+        }
+    else
+    /* use old temp file*/
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::StartTempFileProcessingL() 5, -- OLD TEMP" );
+        if ( EProcessingMovieSend == iWaitMode )
+            {
+            SendMovieL();
+            }
+        else if ( EProcessingMovieTrimMms == iWaitMode )
+            {
+            if ( iMovie->IsMovieMMSCompatible())
+                {
+                LOG( KVideoEditorLogFile, "CVeiEditVideoView::StartTempFileProcessingL 6, MMS COMPATIBLE" );
+
+                TEntry entry;
+                User::LeaveIfError( fs.Entry( *iTempFile, entry ));
+                TInt tempFileSize = entry.iSize / 1024;
+                TInt maxMmsSize = STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->GetMaxMmsSize();
+
+                if ( tempFileSize < maxMmsSize )
+                    {
+                    LOG( KVideoEditorLogFile, "CVeiEditVideoView::StartTempFileProcessingL() 7, -- MMS SIZE OK" );
+                    iWaitMode = EProcessingMovieSend;
+                    SendMovieL();
+                    }
+                else
+                    {
+                    SetNewTempFileNeeded( EFalse );
+
+                    LOG( KVideoEditorLogFile, "CVeiEditVideoView::StartTempFileProcessingL() 8, -- TRIM MMS" );
+
+                    TBuf8 < KMaxFileName > conv8Filename;
+                    CnvUtfConverter::ConvertFromUnicodeToUtf8( conv8Filename, * iTempFile );
+                    iMovie->UnregisterMovieObserver( iContainer );
+                    iMovie->UnregisterMovieObserver( this );
+                    AppUi()->ActivateLocalViewL( TUid::Uid( EVeiTrimForMmsView ), TUid::Uid( 0 ), conv8Filename );
+                    }
+                }
+            else
+                {
+                LOG( KVideoEditorLogFile, "CVeiEditVideoView::StartTempFileProcessingL() 9, -- NO MMS COMPATIBLE" );
+
+                TInt err;
+                if ( EProcessingMovieTrimMms == iWaitMode )
+                    {
+                    iMovie->SetQuality( CVedMovie::EQualityMMSInteroperability );
+                    }
+
+                TRAP( err, iMovie->ProcessL( *iTempFile, * this ));
+
+                if ( err )
+                    {
+                    ShowGlobalErrorNote( err );
+                    }
+                }
+            }
+        else if ( EProcessingMoviePreview == iWaitMode )
+            {
+            if ( iFullScreenSelected )
+                {
+                iContainer->SetBlackScreen( ETrue );
+                iContainer->SetRect( AppUi()->ApplicationRect());
+                }
+            iContainer->SetSelectionMode( CVeiEditVideoContainer::EModePreview );
+            iContainer->PlayVideoFileL( *iTempFile, iFullScreenSelected );
+            }
+        else if (( EProcessingMovieSave == iWaitMode ) || ( EProcessingMovieSaveThenQuit == iWaitMode ))
+            {
+            CFileMan* fileman = CFileMan::NewL( fs );
+            CleanupStack::PushL( fileman );
+
+            if ( iTempFile->Left( 1 ) == iSaveToFileName->Left( 1 ))
+                {
+                fileman->Rename( *iTempFile, * iSaveToFileName );
+                }
+            else
+                {
+                fileman->Move( *iTempFile, * iSaveToFileName );
+                }
+
+            CleanupStack::PopAndDestroy( fileman );
+
+            HBufC* stringholder = StringLoader::LoadL( R_VEI_NOTE_VIDEO_SAVED, iEikonEnv );
+            CleanupStack::PushL( stringholder );
+            iWaitMode = ENotWaiting;
+            ShowInformationNoteL( *stringholder );
+            iMovieSavedFlag = ETrue;
+            CleanupStack::PopAndDestroy( stringholder);
+
+            UpdateMediaGalleryL();
+            }
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::StartTempFileProcessingL: Out" );
+    }
+
+void CVeiEditVideoView::InsertNewAudio()
+    {
+    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
+    Cba()->DrawDeferred();
+
+    iContainer->SetRecordedAudio( ETrue );
+
+    TInt64 startTimeInt = 0;
+    TInt64 durationInt = 1000000;
+    TInt currIndex( 0 );
+
+    if ((( iContainer->CursorLocation() == VideoEditor::ECursorOnAudio ) || 
+         ( iContainer->CursorLocation() == VideoEditor::ECursorOnEmptyAudioTrack )) && 
+         ( iMovie->AudioClipCount() > 0 ))
+        {
+        currIndex = iContainer->CurrentIndex() + 1;
+        startTimeInt = iMovie->AudioClipEndTime( iContainer->CurrentIndex()).Int64();
+        }
+    else
+        {
+        currIndex = iMovie->AudioClipCount() - 1;
+        if ( currIndex >= 0 )
+            {
+            startTimeInt = iMovie->AudioClipEndTime( currIndex ).Int64();
+            }
+        else
+            {
+            currIndex = 0;
+            }
+        }
+
+    while ( currIndex < iMovie->AudioClipCount())
+        {
+        // safety margin: it is not possible to insert new audio if there is less than 1s between clips
+        TInt64 adjustedClipStartTimeInt = iMovie->AudioClipStartTime( currIndex ).Int64() - 1000000;
+
+        if ( startTimeInt > adjustedClipStartTimeInt )
+            {
+            startTimeInt = iMovie->AudioClipEndTime( currIndex ).Int64();
+            currIndex++;
+            }
+        else
+            {
+            break;
+            }
+        }
+
+    if ( currIndex < iMovie->AudioClipCount())
+        {
+        TInt64 endTimeInt = startTimeInt + durationInt;
+        TInt64 nextStartTimeInt = iMovie->AudioClipStartTime( currIndex ).Int64();
+
+        if ( endTimeInt > nextStartTimeInt )
+            {
+            durationInt = nextStartTimeInt - startTimeInt;
+            }
+        }
+
+    iContainer->SetRecordedAudioStartTime( TTimeIntervalMicroSeconds( startTimeInt ));
+    iContainer->SetRecordedAudioDuration( TTimeIntervalMicroSeconds( durationInt ));
+    iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeRecordingSetStart );
+    iContainer->SetCursorLocation( VideoEditor::ECursorOnAudio );
+
+    UpdateEditNaviLabel();
+
+    /* Create temp file. */
+    if ( iTempRecordedAudio )
+        {
+        delete iTempRecordedAudio;
+        iTempRecordedAudio = NULL;
+        }
+
+    iTempRecordedAudio = HBufC::NewL( KMaxFileName );
+    iTempMaker->GenerateTempFileName( *iTempRecordedAudio, iMemoryInUse, iMovie->Format(), ETrue );
+
+    /* Open the file, this is asynchronous so we'll come to our callback. */
+    iRecorder->OpenFileL( *iTempRecordedAudio );
+    }
+
+TBool CVeiEditVideoView::IsEnoughFreeSpaceToSaveL( TInt aBytesToAdd )const
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::IsEnoughFreeSpaceToSaveL: in" );
+    RFs& fs = iEikonEnv->FsSession();
+
+    TBool spaceBelowCriticalLevel( EFalse );
+
+    TInt sizeEstimate = iMovie->GetSizeEstimateL();
+    sizeEstimate += aBytesToAdd;
+
+    if ( iEditorState == EQuickPreview )
+        {
+        TInt snapShotSize = iContainer->SnapshotSize();
+        if ( snapShotSize != 0 )
+            {
+            sizeEstimate = snapShotSize;
+            }
+        }
+
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::IsEnoughFreeSpaceToSaveL: 2, needed space: %d", sizeEstimate );
+
+    if ( iMemoryInUse == CAknMemorySelectionDialog::EPhoneMemory )
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::IsEnoughFreeSpaceToSaveL: " );
+        spaceBelowCriticalLevel = SysUtil::DiskSpaceBelowCriticalLevelL( &fs, sizeEstimate, EDriveC );
+        }
+    else
+        {
+        LOG( KVideoEditorLogFile, "\tMmc selected" );
+
+        spaceBelowCriticalLevel = SysUtil::MMCSpaceBelowCriticalLevelL( &fs, sizeEstimate );
+        }
+
+    if ( spaceBelowCriticalLevel )
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::IsEnoughFreeSpaceToSaveL: 3, space is below critical level" );
+        ShowErrorNote( R_VEI_MEMORY_RUNNING_OUT );
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::IsEnoughFreeSpaceToSaveL out" );
+
+    return !spaceBelowCriticalLevel;
+    }
+
+
+TBool CVeiEditVideoView::IsEnoughFreeSpaceToSave2L( TInt aBytesToAdd )const
+    {
+    RFs& fs = iEikonEnv->FsSession();
+    TBool spaceBelowCriticalLevel( EFalse );
+    TInt sizeEstimate = iMovie->GetSizeEstimateL();
+    sizeEstimate += aBytesToAdd;
+
+    if ( iMemoryInUse == CAknMemorySelectionDialog::EPhoneMemory )
+        {
+        spaceBelowCriticalLevel = SysUtil::DiskSpaceBelowCriticalLevelL( &fs, sizeEstimate, EDriveC );
+        }
+    else
+        {
+        spaceBelowCriticalLevel = SysUtil::MMCSpaceBelowCriticalLevelL( &fs, sizeEstimate );
+        }
+
+    if ( !spaceBelowCriticalLevel )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+TBool CVeiEditVideoView::FitsToMmsL()
+    {
+    /*
+    Read documentation of FitsToMmsL() in the header file
+     */
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::FitsToMmsL() in" );
+    TInt maxMmsSize = STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->GetMaxMmsSize();
+
+    CVedMovie::TVedMovieQuality origQuality = iMovie->Quality();
+    iMovie->SetQuality( CVedMovie::EQualityMMSInteroperability );
+    TInt videoTimeLineSize = iMovie->GetSizeEstimateL() / 1024;
+    iMovie->SetQuality( origQuality );
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::FitsToMmsL() out" );
+    videoTimeLineSize = videoTimeLineSize * 1.1;
+    return videoTimeLineSize < maxMmsSize;
+    }
+
+void CVeiEditVideoView::BrowseStartTransition( TBool aUpOrDown )
+    {
+    TInt currentEffect;
+    TInt currentIndex = iContainer->CurrentIndex();
+
+    if ( currentIndex == 0 )
+        {
+        currentEffect = iMovie->StartTransitionEffect();
+        if ( aUpOrDown )
+            {
+            if ( !( TVedStartTransitionEffect( currentEffect - 1 ) < EVedStartTransitionEffectNone ))
+                {
+                iMovie->SetStartTransitionEffect( TVedStartTransitionEffect( currentEffect - 1 ));
+                }
+            else
+                {
+                iMovie->SetStartTransitionEffect( TVedStartTransitionEffect( EVedStartTransitionEffectLast - 1 ));
+                }
+            }
+        else
+            {
+            if ( !( TVedStartTransitionEffect( currentEffect + 1 ) >= EVedStartTransitionEffectLast ))
+                {
+                iMovie->SetStartTransitionEffect( TVedStartTransitionEffect( currentEffect + 1 ));
+                }
+            else
+                {
+                iMovie->SetStartTransitionEffect( TVedStartTransitionEffect( EVedStartTransitionEffectNone ));
+                }
+            }
+        }
+    else if ( currentIndex < iMovie->VideoClipCount())
+        {
+        currentEffect = iMovie->MiddleTransitionEffect( currentIndex - 1 );
+
+        if ( aUpOrDown )
+            {
+            if ( !( TVedMiddleTransitionEffect( currentEffect - 1 ) < EVedMiddleTransitionEffectNone ))
+                {
+                iMovie->SetMiddleTransitionEffect( TVedMiddleTransitionEffect( currentEffect - 1 ), currentIndex - 1 );
+                }
+            else
+                {
+                iMovie->SetMiddleTransitionEffect( TVedMiddleTransitionEffect( EVedMiddleTransitionEffectLast - 1 ), currentIndex - 1 );
+                }
+            }
+        else
+            {
+            if ( !( TVedMiddleTransitionEffect( currentEffect + 1 ) >= EVedMiddleTransitionEffectLast ))
+                {
+                iMovie->SetMiddleTransitionEffect( TVedMiddleTransitionEffect( currentEffect + 1 ), currentIndex - 1 );
+                }
+            else
+                {
+                iMovie->SetMiddleTransitionEffect( TVedMiddleTransitionEffect( EVedMiddleTransitionEffectNone ), currentIndex - 1 );
+                }
+            }
+        }
+    else
+        {
+        currentEffect = iMovie->EndTransitionEffect();
+
+        if ( aUpOrDown )
+            {
+            if ( !( TVedEndTransitionEffect( currentEffect - 1 ) < EVedEndTransitionEffectNone ))
+                {
+                iMovie->SetEndTransitionEffect( TVedEndTransitionEffect( currentEffect - 1 ));
+                }
+            else
+                {
+                iMovie->SetEndTransitionEffect( TVedEndTransitionEffect( EVedEndTransitionEffectLast - 1 ));
+                }
+            }
+        else
+            {
+            if ( !( TVedEndTransitionEffect( currentEffect + 1 ) >= EVedEndTransitionEffectLast ))
+                {
+                iMovie->SetEndTransitionEffect( TVedEndTransitionEffect( currentEffect + 1 ));
+                }
+            else
+                {
+                iMovie->SetEndTransitionEffect( TVedEndTransitionEffect( EVedEndTransitionEffectNone ));
+                }
+            }
+        }
+
+    }
+
+void CVeiEditVideoView::ShowErrorNote( const TInt aResourceId, TInt /*aError*/ )const
+    {
+    CVeiErrorUI::ShowErrorNote( *iEikonEnv, aResourceId );
+    }
+
+void CVeiEditVideoView::ShowGlobalErrorNote( const TInt aError )const
+    {
+    iErrorUI->ShowGlobalErrorNote( aError );
+    }
+
+void CVeiEditVideoView::ShowInformationNoteL( const TDesC& aMessage )const
+    {
+    CAknInformationNote* note = new( ELeave )CAknInformationNote( ETrue );
+    note->ExecuteLD( aMessage );
+    }
+
+void CVeiEditVideoView::ShowVolumeLabelL( TInt aVolume )
+    {
+    STATIC_CAST( CVeiTimeLabelNavi* , iPreviewLabel->DecoratedControl())->SetVolumeIconVisibilityL( ETrue );
+
+    if ( iVolumeHider && iVolumeHider->IsActive())
+        {
+        iVolumeHider->Cancel();
+        }
+    if ( aVolume == 0 )
+        {
+        STATIC_CAST( CVeiTimeLabelNavi* , iPreviewLabel->DecoratedControl())->SetVolumeIconVisibilityL( EFalse );
+        HideVolume();
+        return ;
+        }
+
+    iNaviPane->PushL( *iVolumeNavi );
+    if ( !iVolumeHider )
+        {
+        iVolumeHider = CPeriodic::NewL( CActive::EPriorityLow );
+        }
+    iVolumeHider->Start( 1000000, 1000000, TCallBack( CVeiEditVideoView::HideVolumeCallbackL, this ));
+
+    STATIC_CAST( CAknVolumeControl* , iVolumeNavi->DecoratedControl())->SetValue( aVolume );
+
+    if ( aVolume > KMinVolume + 1 )
+        {
+        STATIC_CAST( CVeiTimeLabelNavi* , iPreviewLabel->DecoratedControl())->SetLeftArrowVisibilityL( ETrue );
+        }
+    else
+        {
+        STATIC_CAST( CVeiTimeLabelNavi* , iPreviewLabel->DecoratedControl())->SetLeftArrowVisibilityL( EFalse );
+        }
+
+    if ( aVolume < KMaxVolume )
+        {
+        STATIC_CAST( CVeiTimeLabelNavi* , iPreviewLabel->DecoratedControl())->SetRightArrowVisibilityL( ETrue );
+        }
+    else
+        {
+        STATIC_CAST( CVeiTimeLabelNavi* , iPreviewLabel->DecoratedControl())->SetRightArrowVisibilityL( EFalse );
+        }
+
+    }
+
+void CVeiEditVideoView::RemoveCurrentClipL()
+    {
+    if ( !iContainer )
+        {
+        return ;
+        }
+    TParse fp;
+
+    if ( iContainer->CursorLocation() == VideoEditor::ECursorOnAudio )
+        {
+        if ( iMovie->AudioClipCount() == 0 )
+            {
+            return ;
+            }
+        CVedAudioClipInfo* audioclipinfo = iMovie->AudioClipInfo( iContainer->CurrentIndex());
+        fp.Set( audioclipinfo->FileName(), NULL, NULL );
+        }
+    else
+        {
+        if ( iMovie->VideoClipCount() == 0 )
+            {
+            return ;
+            }
+
+        /* Get filename to remove query. */
+        TBool isFile( iMovie->VideoClipInfo( iContainer->CurrentIndex())->Class() == EVedVideoClipClassFile );
+        CVedVideoClipInfo* videoclipinfo = iMovie->VideoClipInfo( iContainer->CurrentIndex());
+
+        if ( isFile )
+            {
+            fp.Set( videoclipinfo->FileName(), NULL, NULL );
+            }
+        else
+            {
+            fp.Set( videoclipinfo->DescriptiveName(), NULL, NULL );
+            }
+        }
+
+    HBufC* stringholder = StringLoader::LoadL( R_VEI_REMOVE_CLIP_QUERY, fp.Name(), iEikonEnv );
+    CleanupStack::PushL( stringholder );
+    CAknQueryDialog* dlg = new( ELeave )CAknQueryDialog( *stringholder, CAknQueryDialog::ENoTone );
+    TInt queryok = dlg->ExecuteLD( R_VEI_CONFIRMATION_QUERY );
+    CleanupStack::PopAndDestroy( stringholder );
+
+    if ( queryok )
+        {
+        TUint currentIndex = iContainer->GetAndDecrementCurrentIndex();
+
+        if ( iContainer->CursorLocation() == VideoEditor::ECursorOnAudio )
+            {
+            iMovie->RemoveAudioClip( currentIndex );
+            }
+        else if ( iContainer->CursorLocation() == VideoEditor::ECursorOnClip )
+            {
+            iMovie->RemoveVideoClip( currentIndex );
+            }
+        else
+            {
+            ShowErrorNote( R_VEI_ERROR_NOTE );
+            }
+        }
+    }
+
+
+TInt CVeiEditVideoView::AddClipL( const TDesC& aFilename, TBool aStartNow )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::AddClipL: In" );
+
+    if ( !iContainer )
+        {
+        iContainer = new( ELeave )CVeiEditVideoContainer( *iMovie, * this );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( AppUi()->ClientRect());
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    iMediaQueue->InsertMediaL( aFilename );
+
+    if ( aStartNow )
+        {
+        iMediaQueue->StartProcessingL();
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::AddClipL: Out" );
+    return KErrNone;
+    }
+
+
+void CVeiEditVideoView::AddNext()
+    {
+    iMediaQueue->GetNext();
+    }
+
+TBool CVeiEditVideoView::SaveL( TWaitMode aQuitAfterSaving )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::SaveL: In" );
+    RFs& fs = iEikonEnv->FsSession();
+
+    TParse file;
+    TFileName newname;
+
+    // Get default movie name from settings view	
+    CAknMemorySelectionDialog::TMemory memory( iMovieSaveSettings.MemoryInUse());
+
+    if ( memory == CAknMemorySelectionDialog::EPhoneMemory )
+        {
+        newname = PathInfo::PhoneMemoryRootPath();
+        }
+    else
+        {
+        newname = PathInfo::MemoryCardRootPath();
+        }
+
+    newname.Append( PathInfo::VideosPath());
+
+    TVedVideoFormat movieQuality = iMovie->Format();
+    if ( movieQuality == EVedVideoFormatMP4 )
+        {
+        newname.Append( KExtMp4 );
+        }
+    else
+        {
+        newname.Append( KExt3gp );
+        }
+
+    file.Set( iMovieSaveSettings.DefaultVideoName(), &newname, NULL );
+
+    TInt error( KErrNone );
+    error = fs.MkDirAll( file.DriveAndPath());
+
+    if (( error != KErrAlreadyExists ) && ( error != KErrNone ))
+        {
+        return EFalse;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::SaveL: 2" );
+    if ( IsEnoughFreeSpaceToSaveL())
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::SaveL: 3" );
+        //FileNameQuery
+        newname.Zero();
+        newname.Append( file.FullName());
+
+        CApaApplication::GenerateFileName( fs, newname );
+        CAknFileNamePromptDialog* dlg = CAknFileNamePromptDialog::NewL();
+        CleanupStack::PushL( dlg );
+
+        HBufC* filenametitle = StringLoader::LoadLC( R_VEI_QUERY_FILE_NAME, iEikonEnv );
+
+        dlg->SetTitleL( *filenametitle );
+        CleanupStack::PopAndDestroy( filenametitle );
+
+        TBool namegiven = dlg->ExecuteL( newname );
+        CleanupStack::PopAndDestroy( dlg );
+
+        if ( namegiven )
+            {
+            newname.Insert( 0, file.DriveAndPath());
+
+            file.Set( newname, NULL, NULL );
+
+            if ( BaflUtils::FileExists( fs, newname ))
+                {
+                TBool overWrite;
+                CAknQueryDialog* queryDlg;
+
+                HBufC* overWriteConfirmationString;
+                overWriteConfirmationString = StringLoader::LoadLC( R_VEI_CONFIRM_OVERWRITE, file.Name(), iEikonEnv );
+                queryDlg = new( ELeave )CAknQueryDialog( *overWriteConfirmationString, CAknQueryDialog::ENoTone );
+                overWrite = queryDlg->ExecuteLD( R_VEI_CONFIRMATION_QUERY );
+
+                CleanupStack::PopAndDestroy( overWriteConfirmationString );
+                if ( !overWrite )
+                    {
+                    return EFalse;
+                    }
+                }
+
+            iWaitMode = aQuitAfterSaving;
+
+            if ( iSaveToFileName )
+                {
+                delete iSaveToFileName;
+                iSaveToFileName = NULL;
+                }
+
+            iSaveToFileName = HBufC::NewL( newname.Length());
+            *iSaveToFileName = newname;
+            LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::SaveL: 4, iSaveToFileName:%S", iSaveToFileName );
+            StartTempFileProcessingL();
+
+            return ETrue;
+            }
+        else
+            {
+            return EFalse;
+            }
+        }
+
+    else
+        {
+        return EFalse;
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiEditVideoView::CheckMemoryCardAvailability()
+//
+//  Checks the memory card availability if MMC is selected as save store in
+//  application settings. An information note is shown in following
+//  situations:
+//  - MMC not inserted
+//  - MMC corrupted (unformatted)
+//  [- MMC is read-only (not implemented)]
+//  
+//  If note is popped up, this function waits until it's dismissed.
+// ----------------------------------------------------------------------------
+//
+void CVeiEditVideoView::CheckMemoryCardAvailabilityL()
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::CheckMemoryCardAvailability(): in" );
+
+    // Read the video editor settings from ini file.
+
+    iChangedFromMMCToPhoneMemory = EFalse;
+
+    TVeiSettings settings;
+    STATIC_CAST( CVeiAppUi* , AppUi())->ReadSettingsL( settings );
+
+    CAknMemorySelectionDialog::TMemory memoryInUse( settings.MemoryInUse());
+
+    // Check the MMC accessibility only if MMC is used as saving store.
+    if ( memoryInUse == CAknMemorySelectionDialog::EMemoryCard )
+        {
+        RFs& fs = iEikonEnv->FsSession();
+        TDriveInfo driveInfo;
+
+        User::LeaveIfError( fs.Drive( driveInfo, KMmcDrive ));
+
+        // Media is not present (MMC card not inserted).
+        if ( driveInfo.iType == EMediaNotPresent )
+            {
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::CheckMemoryCardAvailability(): no media" );
+            iChangedFromMMCToPhoneMemory = ETrue;
+
+            settings.MemoryInUse() = CAknMemorySelectionDialog::EPhoneMemory;
+            STATIC_CAST( CVeiAppUi* , AppUi())->WriteSettingsL( settings );
+            }
+        // Media is present
+        else
+            {
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::CheckMemoryCardAvailability(): media present" );
+
+            TVolumeInfo volumeInfo;
+            TInt volumeErr = fs.Volume( volumeInfo, KMmcDrive );
+            LOGFMT( KVideoEditorLogFile, "CEditVideoView::CheckMemoryCardAvailability() Volume(): %d", volumeErr );
+
+            // Show note if media is corrupted/unformatted.
+            if ( volumeErr == KErrCorrupt )
+                {
+                HBufC* noteText = StringLoader::LoadLC( R_VED_MMC_NOT_INSERTED, iEikonEnv );
+                CAknInformationNote* informationNote = new( ELeave )CAknInformationNote( ETrue );
+                informationNote->ExecuteLD( *noteText );
+
+                CleanupStack::PopAndDestroy( noteText );
+
+                settings.MemoryInUse() = CAknMemorySelectionDialog::EPhoneMemory;
+                STATIC_CAST( CVeiAppUi* , AppUi())->WriteSettingsL( settings );
+                }
+            }
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::CheckMemoryCardAvailability(): out" );
+    }
+
+void CVeiEditVideoView::UpdateEditNaviLabel()const
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::UpdateEditNaviLabel(): In" );
+    if ( !iContainer )
+        {
+        return ;
+        }
+
+    TRAPD( err, DoUpdateEditNaviLabelL());
+
+    if ( err != KErrNone )
+        {
+        ShowGlobalErrorNote( err );
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::UpdateEditNaviLabel(): In" );
+    }
+
+void CVeiEditVideoView::DoUpdateEditNaviLabelL()const
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::DoUpdateEditNaviLabelL(): In" );
+
+    HBufC* buf;
+
+    CAknNavigationDecorator* currentDecorator = iNaviPane->Top();
+
+    iNaviPane->Pop( iMoveLabel );
+    iNaviPane->Pop( iPreviewLabel );
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::DoUpdateEditNaviLabelL(): navi labels popped" );
+
+    TBool leftArrowVisible = EFalse;
+    TBool rightArrowVisible = EFalse;
+
+    TInt currentIndex = iContainer->CurrentIndex();
+
+    TInt test = iContainer->SelectionMode();
+
+    // Draw the time indicators to the navi pane in Small preview state.
+    // However, if the volume indicator is being show, do not draw the time label
+    if ( iContainer->SelectionMode() == CVeiEditVideoContainer::EModePreview && !iFullScreenSelected && !iVolumeHider )
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::DoUpdateEditNaviLabelL(): iContainer->SelectionMode() == CVeiEditVideoContainer::EModePreview && !iFullScreenSelected && !iVolumeHider" );
+
+        TTime elapsed( iContainer->PlaybackPositionL().Int64());
+        TTime total( iContainer->TotalLength().Int64());
+
+        TBuf < 16 > elapsedBuf;
+        TBuf < 16 > totalBuf;
+
+        HBufC* dateFormatString;
+
+        // check if time is over 99:59
+        if (( total.Int64() / 1000 ) < 3600000 ) 
+            {
+            dateFormatString = iEikonEnv->AllocReadResourceLC( R_QTN_TIME_DURAT_MIN_SEC );
+            }
+        else
+            {
+            dateFormatString = iEikonEnv->AllocReadResourceLC( R_QTN_TIME_DURAT_LONG );
+            }
+
+        elapsed.FormatL( elapsedBuf, * dateFormatString );
+        total.FormatL( totalBuf, * dateFormatString );
+        CleanupStack::PopAndDestroy( dateFormatString );
+
+        CDesCArrayFlat* strings = new CDesCArrayFlat( 2 );
+        CleanupStack::PushL( strings );
+        strings->AppendL( elapsedBuf );
+        strings->AppendL( totalBuf );
+        HBufC* stringholder = StringLoader::LoadL( R_VEI_NAVI_TIME, * strings, iEikonEnv );
+        CleanupStack::PopAndDestroy( strings );
+        CleanupStack::PushL( stringholder );
+
+        STATIC_CAST( CVeiTimeLabelNavi* , iPreviewLabel->DecoratedControl())->SetLabelL( stringholder->Des());
+
+        CleanupStack::PopAndDestroy( stringholder );
+
+        iNaviPane->PushL( *iPreviewLabel );
+        }
+
+
+    else if ( iContainer->SelectionMode() == CVeiEditVideoContainer::EModeMove )
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::DoUpdateEditNaviLabelL(): iContainer->SelectionMode() == CVeiEditVideoContainer::EModeMove" );
+
+        if ( iContainer->CursorLocation() == VideoEditor::ECursorOnAudio )
+            {
+            buf = StringLoader::LoadLC( R_VEI_MOVE_AUDIO_NAVILABEL, iEikonEnv );
+
+            TTimeIntervalMicroSeconds startTime = iMovie->AudioClipStartTime( currentIndex );
+
+            if (( currentIndex == 0 ) && ( startTime > TTimeIntervalMicroSeconds( 0 )))
+                {
+                leftArrowVisible = ETrue;
+                }
+            else
+                {
+                if ( currentIndex >= 1 )
+                    {
+                    TTimeIntervalMicroSeconds prevEndTime = iMovie->AudioClipEndTime( currentIndex - 1 );
+                    TTimeIntervalMicroSeconds modifiedStartTime = TTimeIntervalMicroSeconds( startTime.Int64() - 100000 );
+
+                    if ( modifiedStartTime > prevEndTime )
+                        {
+                        leftArrowVisible = ETrue;
+                        }
+                    }
+                }
+
+            if ( currentIndex < ( iMovie->AudioClipCount() - 1 ))
+                {
+                TTimeIntervalMicroSeconds modifiedEndTime = TTimeIntervalMicroSeconds( iMovie->AudioClipEndTime( currentIndex ).Int64() + 100000 );
+                TTimeIntervalMicroSeconds nextStartTime = iMovie->AudioClipStartTime( currentIndex + 1 );
+                if ( modifiedEndTime < nextStartTime )
+                    {
+                    rightArrowVisible = ETrue;
+                    }
+                }
+
+            if ( currentIndex == iMovie->AudioClipCount() - 1 )
+                {
+                rightArrowVisible = ETrue;
+                }
+            }
+        else
+            {
+            buf = StringLoader::LoadLC( R_VEI_MOVE_VIDEO_NAVILABEL, iEikonEnv );
+
+            if ( currentIndex > 0 )
+                {
+                leftArrowVisible = ETrue;
+                }
+            if ( currentIndex < iMovie->VideoClipCount() - 1 )
+                {
+                rightArrowVisible = ETrue;
+                }
+            }
+
+        STATIC_CAST( CAknNaviLabel* , iMoveLabel->DecoratedControl())->SetTextL( *buf );
+
+        CleanupStack::PopAndDestroy( buf );
+
+        iMoveLabel->DrawNow();
+
+        iMoveLabel->MakeScrollButtonVisible( ETrue );
+        iMoveLabel->SetScrollButtonDimmed( CAknNavigationDecorator::ELeftButton, !leftArrowVisible );
+        iMoveLabel->SetScrollButtonDimmed( CAknNavigationDecorator::ERightButton, !rightArrowVisible );
+
+        iNaviPane->PushL( *iMoveLabel );
+        }
+    else if ( iContainer->SelectionMode() == CVeiEditVideoContainer::EModeDuration )
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::DoUpdateEditNaviLabelL(): iContainer->SelectionMode() == CVeiEditVideoContainer::EModeDuration" );
+
+        buf = StringLoader::LoadLC( R_VEI_NAVI_PANE_DURATION, iEikonEnv );
+
+        STATIC_CAST( CAknNaviLabel* , iMoveLabel->DecoratedControl())->SetTextL( *buf );
+
+        CleanupStack::PopAndDestroy( buf );
+
+        iMoveLabel->DrawNow();
+
+        if ( currentDecorator )
+            {
+            iMoveLabel->MakeScrollButtonVisible( ETrue );
+
+            if ( iContainer->CursorLocation() == VideoEditor::ECursorOnAudio )
+                {
+                TTimeIntervalMicroSeconds editedDuration = iMovie->AudioClipEditedDuration( currentIndex );
+                TTimeIntervalMicroSeconds duration = iMovie->AudioClipInfo( currentIndex )->Duration();
+
+                if ( editedDuration > TTimeIntervalMicroSeconds( 100000 ))
+                    {
+                    leftArrowVisible = ETrue;
+                    }
+
+                if ( editedDuration < duration )
+                    {
+                    rightArrowVisible = ETrue;
+                    }
+                }
+            else
+            // Cursor on generated video clip
+                {
+                TTimeIntervalMicroSeconds duration = iMovie->VideoClipInfo( currentIndex )->Duration();
+                if ( duration > TTimeIntervalMicroSeconds( 100000 ))
+                    {
+                    leftArrowVisible = ETrue;
+                    }
+                rightArrowVisible = ETrue;
+                }
+
+            iMoveLabel->SetScrollButtonDimmed( CAknNavigationDecorator::ELeftButton, !leftArrowVisible );
+            iMoveLabel->SetScrollButtonDimmed( CAknNavigationDecorator::ERightButton, !rightArrowVisible );
+            iNaviPane->PushL( *iMoveLabel );
+            }
+        }
+    else
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::DoUpdateEditNaviLabelL(): else-branch" );
+
+        TInt maxMmsSize = STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->GetMaxMmsSize();
+
+        CVedMovie::TVedMovieQuality origQuality = iMovie->Quality();
+        iMovie->SetQuality( CVedMovie::EQualityMMSInteroperability );
+
+        TInt videoTimeLineSize = iMovie->GetSizeEstimateL() / 1024;
+
+        iMovie->SetQuality( origQuality );
+
+        // Navipanes MMS icon control. 
+        if ( videoTimeLineSize < maxMmsSize )
+            {
+            STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->SetMmsAvailableL( ETrue );
+            }
+        else
+            {
+            STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->SetMmsAvailableL( EFalse );
+            }
+
+        TInt size = iMovie->GetSizeEstimateL() / 1024;
+        /* If in recording state, show last audio clip end time+ recorded audio clip duration in navipane*/
+        LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::DoUpdateEditNaviLabelL: iMovie->GetSizeEstimateL() OK : %d", size );
+        TTimeIntervalMicroSeconds audioEndTime( 0 );
+        if ((( iContainer->SelectionMode() == CVeiEditVideoContainer::EModeRecording ) || 
+             ( iContainer->SelectionMode() == CVeiEditVideoContainer::EModeRecordingPaused )))
+            {
+            TInt audioCount = iMovie->AudioClipCount();
+            /* check that cursor is on last audio clip */
+            if (( audioCount > 0 ) && ( iContainer->CurrentIndex() == audioCount - 1 ))
+                {
+                audioEndTime = iMovie->AudioClipEndTime( audioCount - 1 );
+                }
+            audioEndTime = audioEndTime.Int64() + iContainer->RecordedAudioDuration().Int64();
+            /*
+             * Get recorded audio clip size and add it to engine size estimate
+             * The size won't match with size estimate that engine gives when recorded audio clip is added,
+             * 
+             */
+            RFs& fs = iEikonEnv->FsSession();
+            TEntry entry;
+
+            User::LeaveIfError( fs.Entry( *iTempRecordedAudio, entry ));
+            TInt recordedClipSize = entry.iSize / 1024;
+            size += recordedClipSize;
+            }
+
+        if ( audioEndTime > iMovie->Duration())
+            {
+            STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->SetDurationLabelL( audioEndTime.Int64());
+            }
+        else
+            {
+            STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->SetDurationLabelL( iMovie->Duration().Int64());
+            LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::DoUpdateEditNaviLabelL: iMovie->Duration() OK : %Ld", iMovie->Duration().Int64());
+            }
+
+        // Video line size to navipane.
+        STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->SetSizeLabelL( size );
+
+        LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::DoUpdateEditNaviLabelL: SetSizeLabelL(%d) OK", size );
+
+        // Get default memory from settings view
+
+        if ( iMemoryInUse == CAknMemorySelectionDialog::EPhoneMemory )
+            {
+            STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->SetMemoryInUseL( ETrue );
+            }
+        else
+            {
+            STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->SetMemoryInUseL( EFalse );
+            }
+
+        if ( IsEnoughFreeSpaceToSave2L())
+            {
+            STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->SetMemoryAvailableL( ETrue );
+            }
+        else
+            {
+            STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->SetMemoryAvailableL( EFalse );
+            }
+        if ( !currentDecorator )
+            {
+            iNaviPane->PushL( *iEditLabel );
+            }
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::DoUpdateEditNaviLabelL(): Out" );
+    }
+
+void CVeiEditVideoView::NotifyQueueProcessingStarted( MVeiQueueObserver::TProcessing aMode )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyQueueProcessingStarted: in" );
+
+    if ( iProgressNote )
+        {
+        delete iProgressNote;
+        iProgressNote = NULL;
+        }
+
+    if ( iWaitDialog )
+        {
+        CancelWaitDialog();
+        }
+
+    HBufC* stringholder;
+
+    switch ( aMode )
+        {
+        case MVeiQueueObserver::EProcessingAudio: 
+
+        iProgressNote = new( ELeave )CAknProgressDialog( REINTERPRET_CAST( CEikDialog** , &iProgressNote ), ETrue );
+
+        iProgressNote->SetCallback( this );
+
+        iProgressNote->ExecuteDlgLD( R_VEI_PROGRESS_NOTE_WITH_CANCEL );
+
+
+        stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_INSERTING_AUDIO, iEikonEnv );
+        iProgressNote->SetTextL( *stringholder );
+        CleanupStack::PopAndDestroy( stringholder );
+
+        iWaitMode = EOpeningAudioInfo;
+        iProgressNote->GetProgressInfoL()->SetFinalValue( 100 );
+        break;
+        case MVeiQueueObserver::EProcessingVideo: 
+
+        iWaitDialog = new( ELeave )CAknWaitDialog( REINTERPRET_CAST( CEikDialog** , &iWaitDialog ), ETrue );
+        iWaitDialog->ExecuteLD( R_VEI_WAIT_DIALOG_INSERTING_VIDEO );
+        break;
+        default:
+            iProgressNote = new( ELeave )CAknProgressDialog( REINTERPRET_CAST( CEikDialog** , &iProgressNote ), ETrue );
+
+            iProgressNote->SetCallback( this );
+
+            iProgressNote->ExecuteDlgLD( R_VEI_PROGRESS_NOTE );
+            UpdateInsertingProgressNoteL( 1 );
+            iProgressNote->GetProgressInfoL()->SetFinalValue( 100 );
+            break;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyQueueProcessingStarted: out" );
+    }
+
+void CVeiEditVideoView::NotifyQueueProcessingProgressed( TInt aProcessedCount, TInt aPercentage )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyQueueProcessingProgressed: in" );
+    if ( iProgressNote )
+        {
+        UpdateInsertingProgressNoteL( aProcessedCount );
+        iProgressNote->GetProgressInfoL()->SetAndDraw( aPercentage );
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyQueueProcessingProgressed: out" );
+    }
+
+TBool CVeiEditVideoView::NotifyQueueClipFailed( const TDesC& aFilename, TInt aError )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::NotifyQueueClipFailed: in, aError:%d", aError );
+
+    TBool result;
+    if ( aError == CVeiAddQueue::EInsertingSingleClip )
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyQueueClipFailed: 1" );
+        ShowErrorNote( R_VEI_VIDEO_FAILED );
+        result = ETrue;
+        }
+    else
+        {
+        TBool continueProcessing;
+        CAknQueryDialog* dlg;
+        HBufC* failedContinueString;
+
+        failedContinueString = StringLoader::LoadLC( R_VEI_WARNING_NOTE_INSERTING_FAILED, aFilename, iEikonEnv );
+        dlg = new( ELeave )CAknQueryDialog( *failedContinueString, CAknQueryDialog::ENoTone );
+        continueProcessing = dlg->ExecuteLD( R_VEI_CONFIRMATION_QUERY );
+
+        CleanupStack::PopAndDestroy( failedContinueString );
+
+        result = continueProcessing;
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyQueueClipFailed: out" );
+
+    return result;
+    }
+
+void CVeiEditVideoView::NotifyQueueEmpty( TInt /*aInserted*/, TInt DEBUGLOG_ARG( aFailed ))
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::NotifyQueueEmpty: in, aFailed:%d", aFailed );
+    if ( iProgressNote )
+        {
+        iProgressNote->GetProgressInfoL()->SetAndDraw( 100 );
+        TRAP_IGNORE( iProgressNote->ProcessFinishedL());
+        }
+    if ( iWaitDialog )
+        {
+        CancelWaitDialog();
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyQueueEmpty: out" );
+    }
+
+
+void CVeiEditVideoView::NotifyMovieProcessingStartedL( CVedMovie&  /*aMovie*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieProcessingStartedL: in" );
+
+    iPercentProcessed = 0;
+
+    iProgressNote = new( ELeave )CAknProgressDialog( REINTERPRET_CAST( CEikDialog** , &iProgressNote ), ETrue );
+    iProgressNote->SetCallback( this );
+    iProgressNote->ExecuteDlgLD( R_VEI_PROGRESS_NOTE_WITH_CANCEL );
+
+    HBufC* stringholder;
+
+    if (( EProcessingMovieSend == iWaitMode ) && ( KSenduiMtmBtUid == iGivenSendCommand ))
+        {
+        stringholder = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_PROCESSING, iEikonEnv );
+        }
+    else if ( EProcessingMovieSend == iWaitMode )
+        {
+        stringholder = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_SEND, iEikonEnv );
+        }
+    else if ( EProcessingMoviePreview == iWaitMode )
+        {
+        stringholder = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_PROCESSING, iEikonEnv );
+        }
+    else if ( EProcessingMovieTrimMms == iWaitMode )
+        {
+        stringholder = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_PROCESSING, iEikonEnv );
+        }
+    else
+        {
+        stringholder = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_SAVING, iEikonEnv );
+        }
+
+    CleanupStack::PushL( stringholder );
+
+    iProgressNote->SetTextL( *stringholder );
+    CleanupStack::PopAndDestroy( stringholder );
+
+    iProgressNote->GetProgressInfoL()->SetFinalValue( 100 );
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieProcessingStartedL: out" );
+    }
+
+void CVeiEditVideoView::NotifyMovieProcessingProgressed( CVedMovie&  /*aMovie*/, TInt aPercentage )
+    {
+    iPercentProcessed = aPercentage;
+    User::ResetInactivityTime();
+    iProgressNote->GetProgressInfoL()->SetAndDraw( aPercentage );
+    }
+
+void CVeiEditVideoView::NotifyMovieProcessingCompleted( CVedMovie& aMovie, TInt aError )
+    {
+    LOGFMT2( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieProcessingCompleted: in, aError:%d, iPercentProcessed:%d", aError, iPercentProcessed );
+
+    aMovie.SetMovieSizeLimit( 0 ); // Movie size limit not in use
+
+    if ( aError == KErrNone )
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieProcessingCompleted: 2" );
+        Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+        Cba()->DrawDeferred();
+        SetNewTempFileNeeded( EFalse );
+        iProgressNote->GetProgressInfoL()->SetAndDraw( 100 );
+        TRAP_IGNORE( iProgressNote->ProcessFinishedL());
+        }
+    else
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieProcessingCompleted: 3" );
+        if ( iProgressNote )
+            {
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieProcessingCompleted: 4" );
+            iWaitMode = EProcessingError;
+            TRAP_IGNORE( iProgressNote->GetProgressInfoL()->SetAndDraw( 100 ));
+            iErrorNmb = aError;
+            TRAP_IGNORE( iProgressNote->ProcessFinishedL());
+            }
+        else
+            {
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieProcessingCompleted: 5" );
+            if ( iTempFile )
+                {
+                LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieProcessingCompleted: 6" );
+                RFs& fs = iEikonEnv->FsSession();
+
+                fs.Delete( *iTempFile );
+                delete iTempFile;
+                iTempFile = NULL;
+                SetNewTempFileNeeded( ETrue );
+                }
+            }
+
+        // SetEditorState() must be called because of its side effects eventhough state has not changed,
+        // it sets CBAs. CBAs are set to empty before calling ProcessL()	
+        if ( EMixAudio != iEditorState )
+            {
+            SetEditorState( EEdit );
+            }
+        else
+            {
+            SetEditorState( EMixAudio );
+            }
+
+        iContainer->SetBlackScreen( EFalse );
+        iContainer->SetRect( AppUi()->ClientRect());
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieProcessingCompleted: out" );
+    }
+
+void CVeiEditVideoView::NotifyVideoClipAdded( CVedMovie&  /*aMovie*/, TInt aIndex )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipAdded: in" );
+    SetNewTempFileNeeded( ETrue );
+    iMovieSavedFlag = EFalse;
+
+    if ( iMovieFirstAddFlag )
+        {
+        CVedVideoClipInfo* info = iMovie->VideoClipInfo( aIndex );
+
+        if ( EVedVideoClipClassGenerated != info->Class())
+            {
+            SetNewTempFileNeeded( EFalse );
+            iMovieSavedFlag = ETrue;
+            }
+        iMovieFirstAddFlag = EFalse;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipAdded: Completed" );
+
+    STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->SetState( CVeiEditVideoLabelNavi::EStateEditView );
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipAdded: out" );
+    }
+
+void CVeiEditVideoView::NotifyVideoClipAddingFailed( CVedMovie&  /*aMovie*/, TInt DEBUGLOG_ARG( aError ))
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipAddingFailed: in, aError:%d", aError );
+    if ( iProgressNote )
+        {
+        iProgressNote->GetProgressInfoL()->SetAndDraw( 100 );
+        TRAP_IGNORE( iProgressNote->ProcessFinishedL());
+        }
+
+    if ( iWaitDialog )
+        {
+        CancelWaitDialog();
+        }
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipAddingFailed: out" );
+    }
+
+void CVeiEditVideoView::NotifyVideoClipRemoved( CVedMovie&  /*aMovie*/, TInt  /*aIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipRemoved: in" );
+    SetNewTempFileNeeded( ETrue );
+    iMovieSavedFlag = EFalse;
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipRemoved: out" );
+    }
+
+void CVeiEditVideoView::NotifyVideoClipIndicesChanged( CVedMovie&  /*aMovie*/, TInt /*aOldIndex*/, TInt /*aNewIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipIndicesChanged: in" );
+    iMovieSavedFlag = EFalse;
+    SetNewTempFileNeeded( ETrue );
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipIndicesChanged: out" );
+    }
+
+void CVeiEditVideoView::NotifyVideoClipTimingsChanged( CVedMovie&  /*aMovie*/, TInt /*aIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipTimingsChanged: in" );
+    SetNewTempFileNeeded( ETrue );
+    iMovieSavedFlag = EFalse;
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipTimingsChanged: out" );
+    }
+
+void CVeiEditVideoView::NotifyVideoClipColorEffectChanged( CVedMovie&  /*aMovie*/, TInt /*aIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipColorEffectChanged: in" );
+    SetNewTempFileNeeded( ETrue );
+    iMovieSavedFlag = EFalse;
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipColorEffectChanged: out" );
+    }
+
+void CVeiEditVideoView::NotifyVideoClipAudioSettingsChanged( CVedMovie&  /*aMovie*/, TInt /*aIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipAudioSettingsChanged: in" );
+    SetNewTempFileNeeded( ETrue );
+    iMovieSavedFlag = EFalse;
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipAudioSettingsChanged: out" );
+    }
+
+void CVeiEditVideoView::NotifyStartTransitionEffectChanged( CVedMovie&  /*aMovie*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyStartTransitionEffectChanged: in" );
+    iMovieSavedFlag = EFalse;
+    SetNewTempFileNeeded( ETrue );
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyStartTransitionEffectChanged: out" );
+    }
+
+void CVeiEditVideoView::NotifyMiddleTransitionEffectChanged( CVedMovie&  /*aMovie*/, TInt /*aIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMiddleTransitionEffectChanged: in" );
+    iMovieSavedFlag = EFalse;
+    SetNewTempFileNeeded( ETrue );
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMiddleTransitionEffectChanged: out" );
+    }
+
+void CVeiEditVideoView::NotifyEndTransitionEffectChanged( CVedMovie&  /*aMovie*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyEndTransitionEffectChanged: in" );
+    iMovieSavedFlag = EFalse;
+    SetNewTempFileNeeded( ETrue );
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyEndTransitionEffectChanged: out" );
+    }
+
+void CVeiEditVideoView::NotifyAudioClipAdded( CVedMovie& aMovie, TInt aIndex )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipAdded: in" );
+    iMovieSavedFlag = EFalse;
+    SetNewTempFileNeeded( ETrue );
+
+    if ( iProgressNote )
+        {
+        iProgressNote->GetProgressInfoL()->SetAndDraw( 100 );
+        TRAP_IGNORE( iProgressNote->ProcessFinishedL());
+        }
+
+    iOriginalAudioClipIndex = iContainer->CurrentIndex();
+
+    if ( iOriginalAudioClipIndex > aIndex )
+        {
+        iOriginalAudioClipIndex--;
+        }
+    iContainer->SetCurrentIndex( aIndex );
+
+    iOriginalAudioStartPoint = TTimeIntervalMicroSeconds(  - 1 );
+    CVedAudioClipInfo* audioclipinfo = aMovie.AudioClipInfo( aIndex );
+    iOriginalAudioDuration = audioclipinfo->Duration();
+
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipAdded: out" );
+    }
+
+void CVeiEditVideoView::NotifyAudioClipAddingFailed( CVedMovie&  /*aMovie*/, TInt DEBUGLOG_ARG( aError ))
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipAddingFailed: in, aError:%d", aError );
+    if ( iProgressNote )
+        {
+        iProgressNote->GetProgressInfoL()->SetAndDraw( 100 );
+        TRAP_IGNORE( iProgressNote->ProcessFinishedL());
+        }
+
+    if ( iWaitDialog )
+        {
+        CancelWaitDialog();
+        }
+    ShowErrorNote( R_VEI_ERRORNOTE_AUDIO_INSERTING_FAILED );
+
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipAddingFailed: out" );
+    }
+
+void CVeiEditVideoView::NotifyAudioClipRemoved( CVedMovie&  /*aMovie*/, TInt  /*aIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipRemoved: in" );
+    if ( iTempRecordedAudio )
+        {
+        delete iTempRecordedAudio;
+        iTempRecordedAudio = NULL;
+        }
+    iMovieSavedFlag = EFalse;
+    SetNewTempFileNeeded( ETrue );
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipRemoved: out" );
+    }
+
+void CVeiEditVideoView::NotifyAudioClipIndicesChanged( CVedMovie&  /*aMovie*/, TInt /*aOldIndex*/, TInt /*aNewIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipIndicesChanged: in" );
+    iMovieSavedFlag = EFalse;
+    SetNewTempFileNeeded( ETrue );
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipIndicesChanged: out" );
+    }
+
+void CVeiEditVideoView::NotifyAudioClipTimingsChanged( CVedMovie&  /*aMovie*/, TInt /*aIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipTimingsChanged: in" );
+    iMovieSavedFlag = EFalse;
+    SetNewTempFileNeeded( ETrue );
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipTimingsChanged: out" );
+    }
+
+void CVeiEditVideoView::NotifyMovieReseted( CVedMovie&  /*aMovie*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieReseted: in" );
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieReseted: out" );
+    }
+
+void CVeiEditVideoView::NotifyAudioClipInfoReady( CVedAudioClipInfo& aInfo, TInt aError )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipInfoReady: in, aError:%d", aError );
+    TInt err( KErrNone );
+
+    if ( aError == KErrNone )
+        {
+        if ( aInfo.Type() == EVedAudioTypeUnrecognized )
+            {
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipInfoReady: 2: EVedAudioTypeUnrecognized" );
+
+            aError = KErrNotSupported;
+
+            /*TPtrC filename = aInfo.FileName();
+
+            iTempRecordedAudio = HBufC::NewL(KMaxFileName);
+            iTempMaker->GenerateTempFileName( *iTempRecordedAudio, iMovie );
+
+            TRAP_IGNORE( iConverter->StartConversionL( filename, *iTempRecordedAudio) );	
+
+            delete iTempRecordedAudio;
+            iTempRecordedAudio = NULL;
+             */
+            }
+        else if (( aInfo.Type() == EVedAudioTypeAMR ) || 
+                 ( aInfo.Type() == EVedAudioTypeAMRWB ) || 
+                 ( aInfo.Type() == EVedAudioTypeMP3 ) || 
+                 ( aInfo.Type() == EVedAudioTypeAAC_LC ) || 
+                 ( aInfo.Type() == EVedAudioTypeAAC_LTP ) || 
+                 ( aInfo.Type() == EVedAudioTypeWAV ))
+            {
+
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipInfoReady: 3" );
+            TInt index = 0;
+            TInt64 startTimeInt = 0;
+            TInt64 durationInt = aInfo.Duration().Int64();
+
+            if ((( iContainer->CursorLocation() == VideoEditor::ECursorOnAudio ) || 
+                 ( iContainer->CursorLocation() == VideoEditor::ECursorOnEmptyAudioTrack )) && 
+                 ( iMovie->AudioClipCount() > 0 ))
+                {
+                index = iContainer->CurrentIndex() + 1;
+                startTimeInt = iMovie->AudioClipEndTime( iContainer->CurrentIndex()).Int64();
+                }
+
+            while ( index < iMovie->AudioClipCount())
+                {
+                if ( TTimeIntervalMicroSeconds( startTimeInt ) == iMovie->AudioClipStartTime( index ))
+                    {
+                    startTimeInt = iMovie->AudioClipEndTime( index ).Int64();
+                    index++;
+                    }
+                else
+                    {
+                    break;
+                    }
+                }
+
+            if ( index < iMovie->AudioClipCount())
+                {
+                TInt64 endTimeInt = startTimeInt + durationInt;
+                TInt64 nextStartTimeInt = iMovie->AudioClipStartTime( index ).Int64();
+                if ( endTimeInt > nextStartTimeInt )
+                    {
+                    durationInt = nextStartTimeInt - startTimeInt;
+                    }
+                }
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipInfoReady: 4" );
+            TRAP( err, iMovie->AddAudioClipL( aInfo.FileName(), 
+                                              TTimeIntervalMicroSeconds( startTimeInt ), 
+                                              TTimeIntervalMicroSeconds( 0 ), 
+                                              TTimeIntervalMicroSeconds( durationInt )));
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipInfoReady: 5" );
+            }
+        }
+    if (( aError != KErrNone ) || ( err != KErrNone ))
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipInfoReady: 6" );
+        if ( aError != KErrCancel )
+            {
+            if ( aError )
+                {
+                iErrorNmb = aError;
+                }
+            else
+                {
+                iErrorNmb = err;
+                }
+            }
+        iWaitMode = EProcessingAudioError;
+
+        iProgressNote->GetProgressInfoL()->SetAndDraw( 100 );
+        TRAP_IGNORE( iProgressNote->ProcessFinishedL());
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipInfoReady: out" );
+    }
+
+
+
+void CVeiEditVideoView::NotifyVideoClipGeneratorSettingsChanged( CVedMovie&  /*aMovie*/, TInt /*aIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipGeneratorSettingsChanged: in" );
+    if ( iWaitDialog )
+        {
+        iWaitDialog->ProcessFinishedL();
+        }
+
+    SetNewTempFileNeeded( ETrue );
+    iMovieSavedFlag = EFalse;
+    UpdateEditNaviLabel();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipGeneratorSettingsChanged: out" );
+    }
+
+void CVeiEditVideoView::NotifyVideoClipDescriptiveNameChanged( CVedMovie&  /*aMovie*/, TInt /*aIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipDescriptiveNameChanged: in and out" );
+    }
+
+void CVeiEditVideoView::NotifyMovieQualityChanged( CVedMovie&  /*aMovie*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieQualityChanged: in" );
+
+    // If there are text generator inserted into the movie, they need
+    // to be notified that the movie resolution has changed so that
+    // they can re-calculate the the wrapping etc. parameters.
+    /*	TInt clipCount = iMovie->VideoClipCount();
+    for (TInt i = 0; i < clipCount; i++)
+    {
+    CVedVideoClipInfo* clipInfo = iMovie->VideoClipInfo(i);
+    if (clipInfo->Class() == EVedVideoClipClassGenerated)
+    {
+    TUid generatorUid = clipInfo->Generator()->Uid();
+    if (generatorUid == KUidTitleClipGenerator)
+    {
+    CVeiTitleClipGenerator* generator = static_cast<CVeiTitleClipGenerator*>(clipInfo->Generator());
+    generator->RefreshTextFrameParametersL();
+    }
+    }
+    }*/
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieQualityChanged: out" );
+    }
+
+void CVeiEditVideoView::NotifyMovieOutputParametersChanged( CVedMovie& /*aMovie*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyMovieOutputParametersChanged: in and out" );
+    SetNewTempFileNeeded( ETrue );
+    iMovieSavedFlag = EFalse;
+    }
+
+void CVeiEditVideoView::NotifyAudioClipDynamicLevelMarkInserted( CVedMovie& /*aMovie*/, 
+                                                                 TInt /*aClipIndex*/, 
+                                                                 TInt /*aMarkIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipDynamicLevelMarkInserted: in and out" );
+    SetNewTempFileNeeded( ETrue );
+    iMovieSavedFlag = EFalse;
+    }
+
+void CVeiEditVideoView::NotifyAudioClipDynamicLevelMarkRemoved( CVedMovie& /*aMovie*/, 
+                                                                TInt /*aClipIndex*/, 
+                                                                TInt /*aMarkIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipDynamicLevelMarkRemoved: in and out" );
+    SetNewTempFileNeeded( ETrue );
+    iMovieSavedFlag = EFalse;
+    }
+
+void CVeiEditVideoView::NotifyVideoClipDynamicLevelMarkInserted( CVedMovie& /*aMovie*/, 
+                                                                 TInt /*aClipIndex*/, 
+                                                                 TInt /*aMarkIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipDynamicLevelMarkInserted: in and out" );
+    SetNewTempFileNeeded( ETrue );
+    iMovieSavedFlag = EFalse;
+    }
+
+void CVeiEditVideoView::NotifyVideoClipDynamicLevelMarkRemoved( CVedMovie& /*aMovie*/, 
+                                                                TInt /*aClipIndex*/, 
+                                                                TInt /*aMarkIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyVideoClipDynamicLevelMarkRemoved: in and out" );
+    SetNewTempFileNeeded( ETrue );
+    iMovieSavedFlag = EFalse;
+    }
+
+void CVeiEditVideoView::MoscoStateChangeEvent( CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode )
+    {
+    LOGFMT3( KVideoEditorLogFile, "CVeiEditVideoView::MoscoStateChangeEvent: In: aPreviousState:%d, aCurrentState:%d, aErrorCode:%d", aPreviousState, aCurrentState, aErrorCode );
+
+    if ( aObject == iRecorder )
+        {
+        if ( aErrorCode != KErrNone )
+            {
+            ShowErrorNote( R_VEI_RECORDING_FAILED );
+
+            if ( iTempRecordedAudio )
+                {
+                TInt err = iEikonEnv->FsSession().Delete( *iTempRecordedAudio );
+                if ( err ){
+
+                }
+                delete iTempRecordedAudio;
+                iTempRecordedAudio = NULL;
+                }
+
+            iContainer->SetSelectionMode( CVeiEditVideoContainer::EModeNavigation );
+            TRAP_IGNORE( Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ));
+            Cba()->DrawDeferred();
+            UpdateEditNaviLabel();
+
+            iRecorder->Close();
+            }
+        else if ( aCurrentState == CMdaAudioClipUtility::ERecording )
+            {
+            const TUint delay = 1000 * 1000 / 10;
+
+            if ( !iAudioRecordPeriodic->IsActive())
+                {
+                iAudioRecordPeriodic->Start( delay, delay, TCallBack( CVeiEditVideoView::UpdateAudioRecording, this ));
+                }
+
+            Cba()->SetCommandSetL( R_VEI_SOFTKEYS_PAUSE_STOP );
+            Cba()->DrawDeferred();
+            }
+        else if ( aPreviousState == CMdaAudioClipUtility::ENotReady )
+            {
+            TRAP_IGNORE( Cba()->SetCommandSetL( R_VEI_SOFTKEYS_RECORD_CANCEL ));
+            Cba()->DrawDeferred();
+            }
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::MoscoStateChangeEvent: Out" );
+    }
+
+
+void CVeiEditVideoView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, 
+                                     TUid /*aCustomMessageId*/, 
+                                     const TDesC8& /*aCustomMessage*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::DoActivateL: In" );
+    if ( !iMemoryCardChecked )
+        {
+        CheckMemoryCardAvailabilityL();
+        iMemoryCardChecked = ETrue;
+        }
+
+    if ( !iContainer )
+        {
+        iContainer = new( ELeave )CVeiEditVideoContainer( *iMovie, * this );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( AppUi()->ClientRect());
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    SetEditorState( EEdit );
+
+    // Add Context Pane icon
+
+    /*	TUid contextPaneUid;
+    contextPaneUid.iUid = EEikStatusPaneUidContext;
+
+    CEikStatusPane* sp = StatusPane();
+    CEikStatusPaneBase::TPaneCapabilities subPane = sp->PaneCapabilities( contextPaneUid );
+
+    if ( subPane.IsPresent() && subPane.IsAppOwned() )
+    {	
+    CAknContextPane* contextPane = (CAknContextPane*)sp->ControlL( contextPaneUid);
+
+    TFileName mbmPath( VideoEditorUtils::IconFileNameAndPath(KManualVideoEditorIconFileId) );
+    }*/
+
+    // Quality is taken from settings and set to engine.
+    STATIC_CAST( CVeiAppUi* , AppUi())->ReadSettingsL( iMovieSaveSettings );
+
+    TInt settingsSaveQuality = iMovieSaveSettings.SaveQuality();
+    CVedMovie::TVedMovieQuality saveQuality;
+
+    switch ( settingsSaveQuality )
+        {
+        case TVeiSettings::EMmsCompatible: saveQuality = CVedMovie::EQualityMMSInteroperability;
+        break;
+        case TVeiSettings::EMedium: saveQuality = CVedMovie::EQualityResolutionMedium;
+        break;
+        case TVeiSettings::EBest: saveQuality = CVedMovie::EQualityResolutionHigh;
+        break;
+        case TVeiSettings::EAuto: default:
+            saveQuality = CVedMovie::EQualityAutomatic;
+            break;
+        }
+
+    iMovie->SetQuality( saveQuality );
+    iMemoryInUse = iMovieSaveSettings.MemoryInUse();
+
+    if (( EProcessingMovieForCutting == iWaitMode ) || 
+        ( EProcessingMovieTrimMms == iWaitMode ) || 
+        ( ECuttingAudio == iWaitMode ))
+        {
+        iMovie->RegisterMovieObserverL( this );
+        iMovie->RegisterMovieObserverL( iContainer );
+        }
+
+    if ( EProcessingMovieForCutting == iWaitMode )
+        {
+        // miksi laitetaan jos ollaan oltu rimmaamassa?
+        //SetNewTempFileNeeded(ETrue);
+
+        TTimeIntervalMicroSeconds cutin;
+        TTimeIntervalMicroSeconds cutout;
+        cutin = iMovie->VideoClipCutInTime( iCutVideoIndex );
+        cutout = iMovie->VideoClipCutOutTime( iCutVideoIndex );
+
+        if (( cutin != TTimeIntervalMicroSeconds( 0 )) || 
+            ( cutout != iMovie->VideoClipInfo( iCutVideoIndex )->Duration()))
+            {
+            iMovieSavedFlag = EFalse;
+            }
+
+        if (( cutin != iOriginalCutInTime ) || ( cutout != iOriginalCutOutTime ) )
+            {
+            SetNewTempFileNeeded( ETrue );
+            iContainer->DrawNow();
+            Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
+            iContainer->UpdateThumbnailL( iCutVideoIndex );
+            }
+        iContainer->SetCursorLocation( VideoEditor::ECursorOnClip );
+        }
+    else if ( ECuttingAudio == iWaitMode )
+        {
+
+        //SetNewTempFileNeeded(ETrue);
+
+        TTimeIntervalMicroSeconds cutin;
+        TTimeIntervalMicroSeconds cutout;
+        cutin = iMovie->AudioClipCutInTime( iCutAudioIndex );
+        cutout = iMovie->AudioClipCutOutTime( iCutAudioIndex );
+
+        if (( cutin != TTimeIntervalMicroSeconds( 0 )) || 
+            ( cutout != iMovie->AudioClipInfo( iCutAudioIndex )->Duration()))
+            {
+            iMovieSavedFlag = EFalse;
+            }
+
+        TTimeIntervalMicroSeconds currentEndTime;
+        TTimeIntervalMicroSeconds nextStartTime;
+
+        for ( TInt i = iContainer->CurrentIndex(); i < ( iMovie->AudioClipCount() - 1 ); i++ )
+            {
+            currentEndTime = iMovie->AudioClipEndTime( i );
+            nextStartTime = iMovie->AudioClipStartTime( i + 1 );
+
+            if ( nextStartTime < currentEndTime )
+            // what is the reason behind?
+            // is this a typo, should it be like this?:
+            //if ( nextStartTime != currentEndTime )
+                {
+                nextStartTime = currentEndTime;
+                iMovie->AudioClipSetStartTime( i + 1, nextStartTime );
+                }
+            }
+        if (( cutin != iOriginalAudioCutInTime ) || ( cutout != iOriginalAudioCutOutTime ))
+            {
+            SetNewTempFileNeeded( ETrue );
+            iContainer->DrawNow();
+            }
+
+        iContainer->SetCursorLocation( VideoEditor::ECursorOnAudio );
+        }
+
+    iNaviPane->PushL( *iEditLabel );
+
+    iSendKey = EFalse;
+    iWaitMode = ENotWaiting;
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::DoActivateL: out" );
+    }
+
+void CVeiEditVideoView::HandleForegroundEventL( TBool aForeground )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::HandleForegroundEventL: in: %d", aForeground );
+
+    if ( !aForeground )
+        {
+        // If the application is closing down, calling PauseVideoL could result in 
+        // a callback from the MMF player after the container is already deleted,
+        // causing KERN-EXEC 3
+        if ( static_cast < CVeiAppUi*  > ( AppUi())->AppIsOnTheWayToDestruction())
+            {
+            iContainer->PrepareForTerminationL();
+            return ;
+            }
+
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::HandleForegroundEventL 1" );
+        //if ( (EditorState() != EEdit ) && iContainer)
+        if ( EPreview == EditorState() || EQuickPreview == EditorState())
+            {
+            iContainer->PauseVideoL();
+            }
+        // In phones with clamshell (läppäpuhelin) background can be activated with closing the shell
+        // iContainer's OfferKeyEvent do not get this kind of shell events
+        if ( EPreview == EditorState())
+        // large preview
+            {
+            LOG( KVideoEditorLogFile, "CVeiEditVideoView::HandleForegroundEventL 2" );
+            SetEditorState( CVeiEditVideoView::EEdit );
+            iContainer->SetBlackScreen( EFalse );
+            SetFullScreenSelected( EFalse );
+            iContainer->StopVideo( ETrue );
+            }
+
+        if (( iContainer->SelectionMode() == CVeiEditVideoContainer::EModeRecordingPaused ) || ( iContainer->SelectionMode() == CVeiEditVideoContainer::EModeRecording ))
+            {
+            HandleCommandL( EVeiCmdEditVideoViewRecordStop );
+            }
+        DoDeactivate();
+        }
+    else
+        {
+        if ( EditorState() != EEdit )
+            {
+            if ( EMixAudio != EditorState() && EAdjustVolume != EditorState())
+                {
+                LOG( KVideoEditorLogFile, "CVeiEditVideoView::HandleForegroundEventL: 3, setting R_VEI_SOFTKEYS_PREVIEW_PLAY_BACK" );
+                Cba()->SetCommandSetL( R_VEI_SOFTKEYS_PREVIEW_PLAY_BACK );
+                }
+            Cba()->DrawDeferred();
+            }
+
+        /* When view is activated some clips can be deleted or
+        names can be changed.. So check that all video and audio clips are still available.*/
+        if ( iMovie )
+            {
+            TInt i;
+            TFileName clipName;
+            RFs& fs = iEikonEnv->FsSession();
+
+            for ( i = 0; i < iMovie->VideoClipCount(); i++ )
+                {
+                if ( iMovie->VideoClipInfo( i )->Class() == EVedVideoClipClassFile )
+                    {
+                    clipName = iMovie->VideoClipInfo( i )->FileName();
+
+                    if ( !BaflUtils::FileExists( fs, clipName ))
+                        {
+                        iContainer->GetAndDecrementCurrentIndex();
+
+                        iMovie->RemoveVideoClip( i );
+                        i--;
+                        UpdateMediaGalleryL();
+                        }
+                    clipName.Zero();
+                    }
+                }
+
+            for ( i = 0; i < iMovie->AudioClipCount(); i++ )
+                {
+                clipName = iMovie->AudioClipInfo( i )->FileName();
+
+                if ( !BaflUtils::FileExists( fs, clipName ))
+                    {
+                    iContainer->GetAndDecrementCurrentIndex();
+
+                    iMovie->RemoveAudioClip( i );
+                    i--;
+                    UpdateMediaGalleryL();
+                    }
+                clipName.Zero();
+                }
+
+            }
+
+        UpdateEditNaviLabel();
+        HandleScreenDeviceChangedL();
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::HandleForegroundEventL: out" );
+    }
+
+void CVeiEditVideoView::DoDeactivate()
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView:DoDeactivate: In" );
+
+    iNaviPane->Pop( iEditLabel );
+
+    if ( iVolumeHider )
+        {
+        iVolumeHider->Cancel();
+        delete iVolumeHider;
+        iVolumeHider = NULL;
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView:DoDeactivate: Out" );
+    }
+
+
+TTimeIntervalMicroSeconds CVeiEditVideoView::OriginalAudioDuration()const
+    {
+    return iOriginalAudioDuration;
+    }
+
+TInt CVeiEditVideoView::UpdateNaviPreviewing( TAny* aThis )
+    {
+    STATIC_CAST( CVeiEditVideoView* , aThis )->DoUpdateEditNaviLabelL();
+    return 1;
+    }
+
+
+TInt CVeiEditVideoView::UpdateAudioRecording( TAny* aThis )
+    {
+    STATIC_CAST( CVeiEditVideoView* , aThis )->DoUpdateAudioRecording();
+    return 1;
+    }
+
+void CVeiEditVideoView::DoUpdateAudioRecording()
+    {
+    if ( iRecorder->State() != CMdaAudioClipUtility::ERecording )
+        {
+        iAudioRecordPeriodic->Cancel();
+        Cba()->SetCommandSetL( R_VEI_SOFTKEYS_CONTINUE_STOP );
+        Cba()->DrawDeferred();
+        }
+    else
+        {
+        TTimeIntervalMicroSeconds duration = iRecorder->Duration();
+
+        iContainer->SetRecordedAudioDuration( duration );
+        iContainer->DrawTrackBoxes();
+
+        UpdateEditNaviLabel();
+
+        // !!!*** Safety margin of 0.5s because cropping does not work, remove when cropping fixed. ***!!!
+        duration = TTimeIntervalMicroSeconds( duration.Int64());
+
+        if (( iRecordedAudioMaxDuration >= TTimeIntervalMicroSeconds( 0 )) && ( duration > iRecordedAudioMaxDuration ))
+            {
+            TRAP_IGNORE( HandleCommandL( EVeiCmdEditVideoViewRecordStop ));
+            }
+        }
+    }
+
+void CVeiEditVideoView::CancelWaitDialog( TInt aError )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::CancelWaitDialog: In, aError:%d", aError );
+    if ( iWaitDialog )
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::CancelWaitDialog: 2" );
+        iWaitDialog->ProcessFinishedL();
+        }
+
+    if ( aError )
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::CancelWaitDialog: 3" );
+        ShowGlobalErrorNote( aError );
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::CancelWaitDialog: 4" );
+        }
+    Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::CancelWaitDialog: 5" );
+    Cba()->DrawDeferred();
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::CancelWaitDialog: Out" );
+    }
+
+void CVeiEditVideoView::NotifyImageClipGeneratorInitializationComplete( CVeiImageClipGenerator&  /*aGenerator*/, TInt aError )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::NotifyImageClipGeneratorInitializationComplete: in, aError:%d", aError );
+    if ( aError != KErrNone )
+        {
+        ShowGlobalErrorNote( aError );
+        delete iGenerator;
+        iGenerator = 0;
+        return ;
+        }
+
+    // insert the generator into movie
+    TInt index = ( iContainer->CurrentIndex() == iMovie->VideoClipCount()) ? iMovie->VideoClipCount(): iContainer->CurrentIndex() + 1;
+    iMovie->InsertVideoClipL( *iGenerator, ETrue, index );
+
+    // Generator is no longer our concern
+    iGenerator = 0;
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyImageClipGeneratorInitializationComplete: out" );
+    }
+
+
+void CVeiEditVideoView::NotifyTitleClipBackgroundImageLoadComplete( CVeiTitleClipGenerator&  /*aGenerator*/, TInt aError )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::NotifyTitleClipBackgroundImageLoadComplete: in, aError:%d", aError );
+    if ( aError != KErrNone )
+        {
+        ShowGlobalErrorNote( aError );
+        delete iGenerator;
+        iGenerator = 0;
+        return ;
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyTitleClipBackgroundImageLoadComplete: out" );
+    }
+
+void CVeiEditVideoView::UpdateInsertingProgressNoteL( TInt aProcessed )
+    {
+    TInt queueCount = iMediaQueue->Count();
+
+    CArrayFix < TInt > * numbers = new CArrayFixFlat < TInt > ( 2 );
+    CleanupStack::PushL( numbers );
+    numbers->AppendL( aProcessed );
+    numbers->AppendL( queueCount );
+
+    HBufC* stringholder = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_INSERTING_MEDIA, * numbers, iEikonEnv );
+
+    CleanupStack::PushL( stringholder );
+
+    iProgressNote->SetTextL( *stringholder );
+    iProgressNote->DrawNow(); // otherwise text is not drawn at all 
+    CleanupStack::PopAndDestroy( stringholder );
+    CleanupStack::PopAndDestroy( numbers );
+    }
+
+void CVeiEditVideoView::MmsSendCompatibleCheck()
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::MmsSendCompatibleCheck(): in" );
+
+    TInt maxMmsSize = STATIC_CAST( CVeiEditVideoLabelNavi* , iEditLabel->DecoratedControl())->GetMaxMmsSize()* 1024;
+
+    CVedMovie::TVedMovieQuality origQuality = iMovie->Quality();
+    iMovie->SetQuality( CVedMovie::EQualityMMSInteroperability );
+    TInt sizeEstimate = 0;
+    TRAP_IGNORE( sizeEstimate = iMovie->GetSizeEstimateL());
+    iMovie->SetQuality( origQuality );
+
+    LOGFMT2( KVideoEditorLogFile, "CVeiEditVideoView::MmsSendCompatibleCheck(): maxMmsSize: %d, sizeEstimate: %d", maxMmsSize, sizeEstimate );
+
+    TInt movieSizeLimit = ( TInt )( maxMmsSize* 0.9 );
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::MmsSendCompatibleCheck(): testing, test:%d", movieSizeLimit );
+
+    if ( sizeEstimate < ( TInt )( maxMmsSize* 1.1 ))
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::MmsSendCompatibleCheck(): SetMovieSizeLimit..ok" );
+        iMovie->SetMovieSizeLimit( movieSizeLimit );
+        }
+
+    TVeiSettings movieSaveSettings;
+
+    if ( iMovie->IsMovieMMSCompatible())
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::MmsSendCompatibleCheck: MMSCompatible YES" );
+        iWaitMode = EProcessingMovieTrimMms;
+        StartTempFileProcessingL();
+        }
+    else
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::MmsSendCompatibleCheck: MMSCompatible NO" );
+        iWaitMode = EProcessingMovieTrimMms;
+        movieSaveSettings.SaveQuality() = TVeiSettings::EMmsCompatible;
+        StartTempFileProcessingL();
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::MmsSendCompatibleCheck(): out" );
+    }
+
+// Screen twisting 
+/*
+/* experimental code trying to fix this:
+EECO-6W39YS 
+Manual Video Editor: Wrong layout displays if switching phone mode during large preview playing
+
+void CVeiEditVideoView::HandleScreenDeviceChangedL()
+{	
+LOG(KVideoEditorLogFile, "CVeiEditVideoView::HandleScreenDeviceChangedL() in");
+if ( iContainer )
+{
+// Orientation changed. Resize container rect and update component
+//positions.
+
+
+//	iContainer->SetRect( ClientOrApplicationRect( iFullScreenSelected ) );
+//	
+//	iContainer->SetRect( AppUi()->ClientRect() );
+//	
+
+if(CVeiEditVideoContainer::EModePreview == iContainer->SelectionMode() && iFullScreenSelected &&
+CVeiEditVideoContainer::EStatePlaying == iContainer->PreviewState())
+{
+LOG(KVideoEditorLogFile, "CVeiEditVideoView::HandleScreenDeviceChangedL() 1");
+iContainer->SetBlackScreen( ETrue );
+iContainer->SetRect( ClientOrApplicationRect( iFullScreenSelected ) );
+return;	
+}		
+LOG(KVideoEditorLogFile, "CVeiEditVideoView::HandleScreenDeviceChangedL() 2");				
+iContainer->SetCursorLocation( iContainer->CursorLocation() );
+iContainer->ArrowsControl();
+
+iContainer->DrawDeferred();
+}		
+LOG(KVideoEditorLogFile, "CVeiEditVideoView::HandleScreenDeviceChangedL() out");	
+}
+ */
+/* Screen twisting */
+void CVeiEditVideoView::HandleScreenDeviceChangedL()
+    {
+    if ( iContainer )
+        {
+        // Orientation changed. Resize container rect and update component
+        //positions.
+        iContainer->SetRect( AppUi()->ClientRect());
+
+        iContainer->SetCursorLocation( iContainer->CursorLocation());
+        iContainer->ArrowsControl();
+
+        iContainer->DrawDeferred();
+        }
+    }
+
+void CVeiEditVideoView::HideVolume()
+    {
+    iNaviPane->Pop( iVolumeNavi );
+
+    delete iVolumeHider;
+    iVolumeHider = NULL;
+    }
+
+TInt CVeiEditVideoView::HideVolumeCallbackL( TAny* aPtr )
+    {
+    CVeiEditVideoView* view = ( CVeiEditVideoView* )aPtr;
+    view->HideVolume();
+    return 0;
+    }
+
+void CVeiEditVideoView::UpdateMediaGalleryL()
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::UpdateMediaGalleryL(): In" );
+
+  
+    // Publish & Subscribe API used to make the saved file name available to AIW provider
+    if ( iSaveToFileName )
+        {
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::UpdateMediaGalleryL(): Calling RProperty::Define(KUidVideoEditorProperties, VideoEditor::EPropertyFilename, RProperty::EText); " );
+        TInt err = RProperty::Define( KUidVideoEditorProperties, VideoEditor::EPropertyFilename, RProperty::EText );
+        if ( err != KErrAlreadyExists )
+            {
+            User::LeaveIfError( err );
+            }
+        User::LeaveIfError( RProperty::Set( KUidVideoEditorProperties, VideoEditor::EPropertyFilename, iSaveToFileName->Des()));
+        }
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::UpdateMediaGalleryL(): Out" );
+    }
+
+void CVeiEditVideoView::SetFullScreenSelected( TBool aFullScreenSelected )
+    {
+    iFullScreenSelected = aFullScreenSelected;
+    }
+
+void CVeiEditVideoView::StartNaviPaneUpdateL()
+    {
+    if ( iPreviewUpdatePeriodic )
+        {
+        if ( iPreviewUpdatePeriodic->IsActive())
+            {
+            iPreviewUpdatePeriodic->Cancel();
+            }
+
+        iPreviewUpdatePeriodic->Start( 100000, 100000, TCallBack( CVeiEditVideoView::UpdateNaviPreviewing, this ));
+        }
+    }
+
+void CVeiEditVideoView::ShowAndHandleSendMenuCommandsL()
+    {
+    /* Show send menu, postcard dimmed */
+    CArrayFix < TUid > * mtmToDim = new( ELeave )CArrayFixFlat < TUid > ( 3 );
+    TUid userSelection;
+    CleanupStack::PushL( mtmToDim );
+    /*
+    this uid is empirically got with one device 19.10.2006
+    there is currently (19.10.2006) no constans found in headers for Web Upload
+     */
+
+    const TInt KSenduiMtmOwnWebUploadIntValue = 536873429;
+    const TUid KSenduiMtmOwnWebUpload = 
+        {
+        KSenduiMtmOwnWebUploadIntValue
+    };
+
+    mtmToDim->AppendL( KSenduiMtmPostcardUid );
+    mtmToDim->AppendL( KSenduiMtmAudioMessageUid );
+    mtmToDim->AppendL( KSenduiMtmOwnWebUpload );
+
+
+    userSelection = iSendAppUi.ShowSendQueryL( NULL, TSendingCapabilities( 0, 0, TSendingCapabilities::ESupportsAttachments ), mtmToDim );
+    CleanupStack::PopAndDestroy( mtmToDim );
+
+    iGivenSendCommand = userSelection;
+
+    if ( IsEnoughFreeSpaceToSaveL())
+        {
+        switch ( userSelection.iUid )
+            {
+            case KSenduiMtmSmtpUidValue:
+            case KSenduiMtmImap4UidValue:
+            case KSenduiMtmPop3UidValue:
+                    {
+                    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::ShowAndHandleSendMenuCommandsL: MTM UID: %d", userSelection.iUid );
+                    iWaitMode = EProcessingMovieSend;
+                    StartTempFileProcessingL();
+                    break;
+                    }
+            case KSenduiMtmIrUidValue:
+                    {
+                    LOG( KVideoEditorLogFile, "CVeiEditVideoView::ShowAndHandleSendMenuCommandsL: MTM UID: KSenduiMtmIrUidValue" );
+                    iWaitMode = EProcessingMovieSend;
+                    StartTempFileProcessingL();
+                    break;
+                    }
+            case KSenduiMtmMmsUidValue:
+                    {
+                    LOG( KVideoEditorLogFile, "CVeiEditVideoView::ShowAndHandleSendMenuCommandsL: MTM UID: KSenduiMtmMmsUidValue" );
+                    iWaitMode = EProcessingMovieTrimMms;
+                    MmsSendCompatibleCheck();
+                    break;
+                    }
+            case KSenduiMtmBtUidValue:
+                    {
+                    LOG( KVideoEditorLogFile, "CVeiEditVideoView::ShowAndHandleSendMenuCommandsL: MTM UID: KSenduiMtmBtUidValue" );
+                    iWaitMode = EProcessingMovieSend;
+                    StartTempFileProcessingL();
+                    break;
+                    }
+                /*case KSenduiMtmOwnWebUploadIntValue:			// 0x200009D5
+                {
+                LOG(KVideoEditorLogFile, "CVeiEditVideoView::ShowAndHandleSendMenuCommandsL 6: MTM UID: 536873429");
+                iWaitMode = EProcessingMovieSend;
+                StartTempFileProcessingL();
+                break;            	
+                }	
+                 */
+            default:
+                break;
+
+            }
+        }
+    }
+
+void CVeiEditVideoView::StopNaviPaneUpdateL()
+    {
+    DoUpdateEditNaviLabelL();
+
+    if ( iPreviewUpdatePeriodic && iPreviewUpdatePeriodic->IsActive())
+        {
+        iPreviewUpdatePeriodic->Cancel();
+        }
+    }
+
+TRect CVeiEditVideoView::ClientOrApplicationRect( TBool aFullScreenSelected )const
+    {
+    if ( aFullScreenSelected )
+        {
+        return AppUi()->ApplicationRect();
+        }
+    else
+        {
+        return AppUi()->ClientRect();
+        }
+
+    }
+
+TBool CVeiEditVideoView::MixingConditionsOk()const
+    {
+    // prerequisites for sound mixing: at least one video with audio and one imported audio exist
+    if ( iMovie->VideoClipCount() > 0 && iMovie->AudioClipCount() > 0 )
+        {
+        for ( TInt i = 0; i < iMovie->VideoClipCount(); i++ )
+            {
+            //if (iMovie->VideoClipEditedHasAudio(i))
+            if ( iMovie->VideoClipInfo( i )->HasAudio())
+                {
+                return ETrue;
+                }
+            }
+        }
+    return EFalse;
+    }
+
+/*void CVeiEditVideoView::MixAudio()
+{		
+
+//TReal gainVideoNew(0);
+//TReal gainAudioNew(0);
+
+TInt gainVideoNew(0);
+TInt gainAudioNew(0);
+
+TInt gainVideoCurrent = iMovie->GetVideoClipVolumeGainL(KVedClipIndexAll);
+TInt gainAudioCurrent = iMovie->GetAudioClipVolumeGainL(KVedClipIndexAll);
+
+// video clips are faded      
+if (iContainer->AudioMixingRatio() > 0)    
+{
+//@ : think how to tackle situations where value is form x.0, adding 0.5 gets wrong int
+//Math::Round(fadevideo, iContainer->AudioMixingRatio()*(KVolumeMaxGain/10), 2);
+
+gainVideoNew = iContainer->AudioMixingRatio()*(KVolumeMaxGain/10);    	
+gainVideoNew += 0.5; // for making real to int rounding work in constructor of TVedDynamicLevelMark
+gainVideoNew = 0 - gainVideoNew;    	
+}
+// audio clips are faded
+else if (iContainer->AudioMixingRatio() < 0)    
+{
+//@ : think how to tackle situations where value is form x.0, adding 0.5 gets wrong int
+//Math::Round(fadeaudio, iContainer->AudioMixingRatio()*(KVolumeMaxGain/10), 2);    	
+gainAudioNew = iContainer->AudioMixingRatio()*(KVolumeMaxGain/10);     	    	    	    	
+gainAudioNew -= 0.5;    // for making real to int rounding	work in constructor of TVedDynamicLevelMark    	
+}        			    
+
+if (gainVideoNew != gainVideoCurrent)
+{
+iMovie->SetVideoClipVolumeGainL(KVedClipIndexAll, gainVideoNew);
+}
+if (gainAudioNew != gainAudioCurrent)
+{
+iMovie->SetAudioClipVolumeGainL(KVedClipIndexAll, gainAudioNew);	
+}    	    	    	
+}
+ */
+
+void CVeiEditVideoView::MixAudio()
+    {
+    TReal fadevideo( 0 );
+    TReal fadeaudio( 0 );
+
+    // video clips are faded        
+    if ( iContainer->AudioMixingRatio() > 0 )
+        {
+        //@ : think how to tackle situations where value is form x.0, adding 0.5 gets wrong int
+        //Math::Round(fadevideo, iContainer->AudioMixingRatio()*(KVolumeMaxGain/10), 2);
+
+        fadevideo = iContainer->AudioMixingRatio()*( KVolumeMaxGain / 10 );
+        fadevideo += 0.5; // for making real to int rounding work in constructor of TVedDynamicLevelMark
+        fadevideo = 0-fadevideo;
+        fadeaudio = 0;
+        }
+    // audio clips are faded
+    else if ( iContainer->AudioMixingRatio() < 0 )
+        {
+        //@ : think how to tackle situations where value is form x.0, adding 0.5 gets wrong int
+        //Math::Round(fadeaudio, iContainer->AudioMixingRatio()*(KVolumeMaxGain/10), 2);
+
+        fadeaudio = iContainer->AudioMixingRatio()*( KVolumeMaxGain / 10 );
+        fadeaudio -= 0.5; // for making real to int rounding	work in constructor of TVedDynamicLevelMark
+        fadevideo = 0;
+        }
+
+    // video clips are faded        
+    if ( iContainer->AudioMixingRatio() > 0 && iMovie->VideoClipCount() > 0 )
+        {
+        TInt gain = iMovie->GetVideoClipVolumeGainL( KVedClipIndexAll ); ///(KVolumeMaxGain/10);
+        TInt gainNew = ( TInt )fadevideo;
+        if ( gainNew != gain )
+            {
+            iMovie->SetAudioClipVolumeGainL( KVedClipIndexAll, 0 );
+            iMovie->SetVideoClipVolumeGainL( KVedClipIndexAll, gainNew );
+            }
+        }
+    // audio clips are faded
+    else if ( iContainer->AudioMixingRatio() < 0 && iMovie->AudioClipCount() > 0 )
+        {
+        TInt gain = iMovie->GetAudioClipVolumeGainL( KVedClipIndexAll ); ///(KVolumeMaxGain/10);
+        TInt gainNew = ( TInt )fadeaudio;
+        if ( gainNew != gain )
+            {
+            iMovie->SetVideoClipVolumeGainL( KVedClipIndexAll, 0 );
+            iMovie->SetAudioClipVolumeGainL( KVedClipIndexAll, gainNew );
+            }
+        }
+    else
+    //if marks set back to position '0'
+        {
+        if ( 0 != iMovie->GetVideoClipVolumeGainL( KVedClipIndexAll ))
+            {
+            iMovie->SetVideoClipVolumeGainL( KVedClipIndexAll, 0 );
+            }
+        if ( 0 != iMovie->GetAudioClipVolumeGainL( KVedClipIndexAll ))
+            {
+            iMovie->SetAudioClipVolumeGainL( KVedClipIndexAll, 0 );
+            }
+        }
+    }
+
+void CVeiEditVideoView::AdjustVolumeL()
+    {
+    TReal adjustVolume = iContainer->Volume()*( KVolumeMaxGain / 10 );
+    // to make rounding to int work correctly in constructor of TVedDynamicLevelMark
+    // @ : if adjustvolume is x.0, rounding does not work, think how to fix problem
+    if ( 0 < adjustVolume )
+        {
+        adjustVolume += 0.5;
+        }
+    else
+        {
+        adjustVolume -= 0.5;
+        }
+
+    if ( iContainer->CursorLocation() == VideoEditor::ECursorOnClip )
+        {
+        TReal currentVolume = iMovie->GetVideoClipVolumeGainL( iContainer->CurrentIndex()); ///(KVolumeMaxGain/10);						
+        if ( 0 == iContainer->Volume())
+            {
+            if ( 0 != ( TInt )currentVolume )
+                {
+                iMovie->SetVideoClipVolumeGainL( iContainer->CurrentIndex(), 0 );
+                }
+            }
+        else if (( TInt )currentVolume != ( TInt )adjustVolume )
+            {
+            iMovie->SetVideoClipVolumeGainL( iContainer->CurrentIndex(), ( TInt )adjustVolume );
+            }
+        }
+    else if ( iContainer->CursorLocation() == VideoEditor::ECursorOnAudio )
+        {
+        TReal currentVolume = iMovie->GetAudioClipVolumeGainL( iContainer->CurrentIndex()); ///(KVolumeMaxGain/10);		
+        if ( 0 == iContainer->Volume())
+            {
+            if ( 0 != ( TInt )currentVolume )
+                {
+                iMovie->SetAudioClipVolumeGainL( iContainer->CurrentIndex(), 0 );
+                }
+            }
+        else if (( TInt )currentVolume != ( TInt )adjustVolume )
+            {
+            iMovie->SetAudioClipVolumeGainL( iContainer->CurrentIndex(), ( TInt )adjustVolume );
+            }
+        }
+    }
+
+void CVeiEditVideoView::StoreOrientation()
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::StoreOrientation: in" );
+
+    iOriginalOrientation = AppUi()->Orientation();
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::StoreOrientation: out" );
+    }
+
+void CVeiEditVideoView::RestoreOrientation()
+    {
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::RestoreOrientation: in" );
+
+    TRAP_IGNORE( AppUi()->SetOrientationL( iOriginalOrientation ));
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::RestoreOrientation: out" );
+    }
+
+void CVeiEditVideoView::SetNewTempFileNeeded( const TBool aUpdateNeeded )
+    {
+    iUpdateTemp = aUpdateNeeded;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiIconBox.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,289 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+
+// System includes
+#include <coemain.h>
+#include <akniconutils.h>
+#include <manualvideoeditor.mbg>
+#include <videoeditoruicomponents.mbg>
+
+// User includes
+#include "veiappui.h"
+#include "veieditvideocontainer.h"
+#include "VeiIconBox.h"
+#include "VideoEditorUtils.h"
+
+
+CVeiIconBox* CVeiIconBox::NewL( const TRect& aRect, const CCoeControl* aParent )
+    {
+    CVeiIconBox* self = CVeiIconBox::NewLC( aRect, aParent );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CVeiIconBox* CVeiIconBox::NewLC( const TRect& aRect, const CCoeControl* aParent )
+    {
+    CVeiIconBox* self = new( ELeave )CVeiIconBox;
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect, aParent );
+    return self;
+    }
+
+void CVeiIconBox::ConstructL( const TRect& aRect, const CCoeControl* aParent )
+    {
+    SetContainerWindowL( *aParent );
+
+    TFileName mbmPath( VideoEditorUtils::IconFileNameAndPath( KManualVideoEditorIconFileId ));
+    TFileName mbmPath2( VideoEditorUtils::IconFileNameAndPath( KVideoEditorUiComponentsIconFileId ));
+
+    AknIconUtils::CreateIconL( iVolumeMute, 
+                               iVolumeMuteMask, 
+                               mbmPath, 
+                               EMbmManualvideoeditorQgn_prop_ve_muted, 
+                               EMbmManualvideoeditorQgn_prop_ve_muted_mask );
+
+    AknIconUtils::CreateIconL( iSlowMotion, 
+                               iSlowMotionMask, 
+                               mbmPath, 
+                               EMbmManualvideoeditorQgn_prop_ve_slow, 
+                               EMbmManualvideoeditorQgn_prop_ve_slow_mask );
+
+    AknIconUtils::CreateIconL( iBlackAndWhite, 
+                               iBlackAndWhiteMask, 
+                               mbmPath, 
+                               EMbmManualvideoeditorQgn_prop_ve_bw, 
+                               EMbmManualvideoeditorQgn_prop_ve_bw_mask );
+
+    AknIconUtils::CreateIconL( iColour, 
+                               iColourMask, 
+                               mbmPath, 
+                               EMbmManualvideoeditorQgn_prop_ve_colour, 
+                               EMbmManualvideoeditorQgn_prop_ve_colour_mask );
+
+    AknIconUtils::CreateIconL( iRecAudio, 
+                               iRecAudioMask, 
+                               mbmPath, 
+                               EMbmManualvideoeditorQgn_prop_ve_rec, 
+                               EMbmManualvideoeditorQgn_prop_ve_rec_mask );
+
+    AknIconUtils::CreateIconL( iPauseAudio, 
+                               iPauseAudioMask, 
+                               mbmPath2, 
+                               EMbmVideoeditoruicomponentsQgn_prop_ve_pause, 
+                               EMbmVideoeditoruicomponentsQgn_prop_ve_pause_mask );
+
+    SetRect( aRect );
+    ActivateL();
+    }
+
+CVeiIconBox::~CVeiIconBox()
+    {
+    delete iBlackAndWhite;
+    delete iBlackAndWhiteMask;
+    delete iColour;
+    delete iColourMask;
+    delete iSlowMotion;
+    delete iSlowMotionMask;
+    delete iVolumeMute;
+    delete iVolumeMuteMask;
+    delete iRecAudio;
+    delete iRecAudioMask;
+    delete iPauseAudio;
+    delete iPauseAudioMask;
+    }
+
+
+void CVeiIconBox::SizeChanged()
+    {
+    TRect rect = Rect();
+    TSize iconSize;
+    if ( !iLandscapeScreenOrientation )
+        {
+        iconSize.SetSize( rect.Width(), rect.Width());
+        }
+    else
+        {
+        iconSize.SetSize( rect.Height(), rect.Height());
+        }
+
+    AknIconUtils::SetSize( iVolumeMute, iconSize, EAspectRatioNotPreserved );
+    AknIconUtils::SetSize( iSlowMotion, iconSize, EAspectRatioNotPreserved );
+    AknIconUtils::SetSize( iBlackAndWhite, iconSize, EAspectRatioNotPreserved );
+    AknIconUtils::SetSize( iColour, iconSize, EAspectRatioNotPreserved );
+    AknIconUtils::SetSize( iRecAudio, iconSize, EAspectRatioNotPreserved );
+    AknIconUtils::SetSize( iPauseAudio, iconSize, EAspectRatioNotPreserved );
+    }
+
+void CVeiIconBox::SetLandscapeScreenOrientation( TBool aLandscapeScreenOrientation )
+    {
+    iLandscapeScreenOrientation = aLandscapeScreenOrientation;
+    }
+
+void CVeiIconBox::SetVolumeMuteIconVisibility( TBool aVisible )
+    {
+    iVolumeMuteIconVisible = aVisible;
+    DrawDeferred();
+    }
+
+void CVeiIconBox::SetSlowMotionIconVisibility( TBool aVisible )
+    {
+    iSlowMotionIconVisible = aVisible;
+    DrawDeferred();
+    }
+
+void CVeiIconBox::SetBlackAndWhiteIconVisibility( TBool aVisible )
+    {
+    iBlackAndWhiteIconVisible = aVisible;
+    DrawDeferred();
+    }
+
+void CVeiIconBox::SetColourIconVisibility( TBool aVisible )
+    {
+    iColourIconVisible = aVisible;
+    DrawDeferred();
+    }
+
+void CVeiIconBox::SetRecAudioIconVisibility( TBool aVisible )
+    {
+    iRecAudioIconVisibile = aVisible;
+    DrawDeferred();
+    }
+
+void CVeiIconBox::SetPauseAudioIconVisibility( TBool aVisible )
+    {
+    iPauseAudioIconVisibile = aVisible;
+    DrawDeferred();
+    }
+
+
+
+void CVeiIconBox::Draw( const TRect& aRect )const
+    {
+    CWindowGc& gc = SystemGc();
+
+    TRect rect = aRect;
+
+    TPoint slowMotionPos;
+    TPoint BWPos;
+
+    /* Icon area frame */
+
+    if ( !iLandscapeScreenOrientation )
+    // Portrait
+        {
+        TInt symboldistance = STATIC_CAST( TInt, rect.Size().iHeight* 0.01428571 );
+        /** volume, rec and pause icons are on same position.*/
+        if ( iVolumeMuteIconVisible )
+            {
+            TPoint audioMutePos( rect.iTl );
+            TRect clipRect( TPoint( 0, 0 ), iVolumeMute->SizeInPixels().AsPoint());
+            gc.BitBltMasked( audioMutePos, iVolumeMute, clipRect, iVolumeMuteMask, EFalse );
+            }
+        else
+            {
+            if ( iRecAudioIconVisibile )
+                {
+                TPoint audioRecPos( rect.iTl );
+                TRect clipRect( TPoint( 0, 0 ), iRecAudio->SizeInPixels().AsPoint());
+                gc.BitBltMasked( audioRecPos, iRecAudio, clipRect, iRecAudioMask, EFalse );
+                }
+            else if ( iPauseAudioIconVisibile )
+                {
+                TPoint audioPausePos( rect.iTl );
+                TRect clipRect( TPoint( 0, 0 ), iPauseAudio->SizeInPixels().AsPoint());
+                gc.BitBltMasked( audioPausePos, iPauseAudio, clipRect, iPauseAudioMask, EFalse );
+                }
+            }
+
+        if ( iSlowMotionIconVisible )
+            {
+            slowMotionPos.SetXY( rect.iTl.iX, rect.iTl.iY + iVolumeMute->SizeInPixels().iHeight + symboldistance );
+            TRect clipRect( TPoint( 0, 0 ), iVolumeMute->SizeInPixels().AsPoint());
+            gc.BitBltMasked( slowMotionPos, iSlowMotion, clipRect, iSlowMotionMask, EFalse );
+            }
+
+
+        if ( iBlackAndWhiteIconVisible )
+            {
+            BWPos.SetXY( rect.iTl.iX, rect.iTl.iY + iVolumeMute->SizeInPixels().iHeight + iSlowMotion->SizeInPixels().iHeight + symboldistance* 2 );
+            TRect clipRect( TPoint( 0, 0 ), iVolumeMute->SizeInPixels().AsPoint());
+            gc.BitBltMasked( BWPos, iBlackAndWhite, clipRect, iBlackAndWhiteMask, EFalse );
+            }
+
+        if ( iColourIconVisible )
+            {
+            BWPos.SetXY( rect.iTl.iX, rect.iTl.iY + iVolumeMute->SizeInPixels().iHeight + iSlowMotion->SizeInPixels().iHeight + symboldistance* 2 );
+            TRect clipRect( TPoint( 0, 0 ), iVolumeMute->SizeInPixels().AsPoint());
+            gc.BitBltMasked( BWPos, iColour, clipRect, iColourMask, EFalse );
+            }
+
+
+        }
+    else
+    // Landscape
+        {
+        TInt symboldistance = STATIC_CAST( TInt, rect.Size().iWidth* 0.04347826 );
+        if ( iVolumeMuteIconVisible )
+            {
+            TPoint audioMutePos( rect.iTl );
+            TRect clipRect( TPoint( 0, 0 ), iVolumeMute->SizeInPixels().AsPoint());
+            gc.BitBltMasked( audioMutePos, iVolumeMute, clipRect, iVolumeMuteMask, EFalse );
+            }
+        else
+            {
+            if ( iRecAudioIconVisibile )
+                {
+                TPoint audioRecPos( rect.iTl );
+                TRect clipRect( TPoint( 0, 0 ), iRecAudio->SizeInPixels().AsPoint());
+                gc.BitBltMasked( audioRecPos, iRecAudio, clipRect, iRecAudioMask, EFalse );
+                }
+            else if ( iPauseAudioIconVisibile )
+                {
+                TPoint audioPausePos( rect.iTl );
+                TRect clipRect( TPoint( 0, 0 ), iPauseAudio->SizeInPixels().AsPoint());
+                gc.BitBltMasked( audioPausePos, iPauseAudio, clipRect, iPauseAudioMask, EFalse );
+                }
+            }
+
+        if ( iSlowMotionIconVisible )
+            {
+            slowMotionPos.SetXY( rect.iTl.iX + iVolumeMute->SizeInPixels().iWidth + symboldistance, rect.iTl.iY );
+            TRect clipRect( TPoint( 0, 0 ), iVolumeMute->SizeInPixels().AsPoint());
+            gc.BitBltMasked( slowMotionPos, iSlowMotion, clipRect, iSlowMotionMask, EFalse );
+            }
+
+        if ( iBlackAndWhiteIconVisible )
+            {
+            BWPos.SetXY( rect.iTl.iX + iVolumeMute->SizeInPixels().iWidth + iSlowMotion->SizeInPixels().iWidth + symboldistance * 2, rect.iTl.iY );
+            TRect clipRect( TPoint( 0, 0 ), iVolumeMute->SizeInPixels().AsPoint());
+            gc.BitBltMasked( BWPos, iBlackAndWhite, clipRect, iBlackAndWhiteMask, EFalse );
+            }
+
+        if ( iColourIconVisible )
+            {
+            BWPos.SetXY( rect.iTl.iX + iVolumeMute->SizeInPixels().iWidth + iSlowMotion->SizeInPixels().iWidth + symboldistance * 2, rect.iTl.iY );
+            TRect clipRect( TPoint( 0, 0 ), iVolumeMute->SizeInPixels().AsPoint());
+            gc.BitBltMasked( BWPos, iColour, clipRect, iColourMask, EFalse );
+            }
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiPopup.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1029 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+
+// System includes
+#include <avkon.hrh>
+#include <manualvideoeditor.rsg>
+
+
+#include <akntitle.h> 
+#include <aknlists.h>
+#include <aknquerydialog.h>  
+#include <eikmenub.h> 
+#include <caknfileselectiondialog.h>
+#include <stringloader.h> 
+#include <mgfetch.h> 
+#include <akncolourselectiongrid.h>
+
+// User includes
+#include "VeiEditVideoView.h"
+#include "manualvideoeditor.hrh" 
+#include "veipopup.h" 
+#include "veiaddqueue.h"
+#include "veieditvideocontainer.h"
+#include "videoeditorcommon.h"
+#include "veiappui.h"
+
+
+CVeiPopup* CVeiPopup::NewL( CVeiEditVideoView& aView )
+    {
+    CVeiPopup* self = CVeiPopup::NewLC( aView );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CVeiPopup* CVeiPopup::NewLC( CVeiEditVideoView& aView )
+    {
+    CVeiPopup* self = new( ELeave )CVeiPopup( aView );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+CVeiPopup::CVeiPopup( CVeiEditVideoView& aView ): iView( aView )
+{
+
+}
+
+
+void CVeiPopup::ConstructL()
+    {
+    LOG( KVideoEditorLogFile, "CVeiPopup::ConstructL: in" );
+    LOG( KVideoEditorLogFile, "CVeiPopup::ConstructL: out" );
+    }
+
+CVeiPopup::~CVeiPopup()
+    {
+    LOG( KVideoEditorLogFile, "CVeiPopup::~CVeiPopup" );
+    }
+
+TInt CVeiPopup::ExecutePopupListL( TInt aSoftkeysResourceId, 
+                                   TInt aPopupTitleResourceId, 
+                                   TInt aArrayResourceId, 
+                                   TInt aTablesize, 
+                                   TBool aDynPopup ) const
+    {
+
+    // Create listbox and PUSH it.
+    CAknSinglePopupMenuStyleListBox* listBox = new( ELeave )CAknSinglePopupMenuStyleListBox;
+    CleanupStack::PushL( listBox );
+
+    // Create popup list and PUSH it.
+    CAknPopupList* popupList = CAknPopupList::NewL( listBox, aSoftkeysResourceId );
+    CleanupStack::PushL( popupList );
+
+    // Set title for popup from defined resource.
+    HBufC* title = CCoeEnv::Static()->AllocReadResourceLC( aPopupTitleResourceId );
+    popupList->SetTitleL( *title );
+    CleanupStack::PopAndDestroy( title );
+
+    // initialize listbox.
+    listBox->ConstructL( popupList, EAknListBoxMenuList );
+
+    // Make listitems. and PUSH it
+    CDesCArrayFlat* items = CCoeEnv::Static()->ReadDesCArrayResourceL( aArrayResourceId );
+    CleanupStack::PushL( items );
+
+    // Remove given index if at correct range.
+
+    if ( aDynPopup )
+        {
+        TInt i;
+        for ( i = aTablesize - 1; i >= 0; i-- )
+            {
+            if ( 0 == RemoveArrayIndex[i] )
+                {
+                items->Delete( i );
+                }
+            }
+        }
+    else
+        {
+        if ( aTablesize >= 0 && aTablesize <= ( items->Count() - 1 ))
+            {
+            items->Delete( aTablesize );
+            }
+        }
+
+
+    // Set listitems.
+    CTextListBoxModel* model = listBox->Model();
+    model->SetItemTextArray( items );
+    model->SetOwnershipType( ELbmOwnsItemArray );
+
+    CleanupStack::Pop( items ); // Pop effect items
+
+    listBox->CreateScrollBarFrameL( ETrue );
+    listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+
+    TInt popOk = popupList->ExecuteLD();
+
+    TInt returnValue;
+
+    if ( popOk )
+        {
+        // Return selected item's index.
+        returnValue = listBox->CurrentItemIndex();
+        }
+    else
+        {
+        returnValue =  - 1;
+        }
+
+    // Clenup and destroy.
+    CleanupStack::Pop( popupList );
+    CleanupStack::PopAndDestroy( listBox );
+
+    return returnValue;
+    }
+
+
+void CVeiPopup::ShowEndTransitionPopupListL()
+    {
+    TInt removeIndex;
+    // Which effect to remove from listbox.
+    switch ( iView.Movie()->EndTransitionEffect())
+        {
+        case EVedEndTransitionEffectFadeToBlack:
+            removeIndex = 0;
+            break;
+        case EVedEndTransitionEffectFadeToWhite:
+            removeIndex = 1;
+            break;
+        case EVedEndTransitionEffectNone:
+            removeIndex = 2;
+            break;
+        default:
+            removeIndex =  - 1;
+            break;
+        }
+
+    TInt selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
+                                            R_VEI_TRANSTION_POPUP_TITLE, 
+                                            R_VEI_END_TRANSITION_LIST_BOX_ARRAY, 
+                                            removeIndex, 
+                                            EFalse );
+
+    switch ( selectedIndex )
+        {
+        case 0:
+                {
+                if ( removeIndex == 0 )
+                    {
+                    iView.Movie()->SetEndTransitionEffect( EVedEndTransitionEffectFadeToWhite );
+                    }
+                else
+                    {
+                    iView.Movie()->SetEndTransitionEffect( EVedEndTransitionEffectFadeToBlack );
+                    }
+                break;
+                }
+        case 1:
+                {
+                if ( removeIndex <= 1 )
+                    {
+                    iView.Movie()->SetEndTransitionEffect( EVedEndTransitionEffectNone );
+                    }
+                else
+                    {
+                    iView.Movie()->SetEndTransitionEffect( EVedEndTransitionEffectFadeToWhite );
+                    }
+                break;
+                }
+        default:
+            break;
+        }
+
+    }
+
+void CVeiPopup::ShowMiddleTransitionPopupListL()
+    {
+    TInt currentindex = iView.Container()->CurrentIndex() - 1;
+    TInt removeIndex;
+    switch ( iView.Movie()->MiddleTransitionEffect( currentindex ))
+        {
+        case EVedMiddleTransitionEffectWipeTopToBottom:
+            removeIndex = 0;
+            break;
+        case EVedMiddleTransitionEffectWipeBottomToTop:
+            removeIndex = 1;
+            break;
+        case EVedMiddleTransitionEffectWipeLeftToRight:
+            removeIndex = 2;
+            break;
+        case EVedMiddleTransitionEffectWipeRightToLeft:
+            removeIndex = 3;
+            break;
+        case EVedMiddleTransitionEffectCrossfade:
+            removeIndex = 4;
+            break;
+        case EVedMiddleTransitionEffectDipToBlack:
+            removeIndex = 5;
+            break;
+        case EVedMiddleTransitionEffectDipToWhite:
+            removeIndex = 6;
+            break;
+        case EVedMiddleTransitionEffectNone:
+            removeIndex = 7;
+            break;
+        default:
+            removeIndex =  - 1;
+            break;
+        }
+
+    TInt selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
+                                            R_VEI_TRANSTION_POPUP_TITLE, 
+                                            R_VEI_MIDDLE_TRANSITION_LIST_BOX_ARRAY, 
+                                            removeIndex, 
+                                            EFalse );
+
+    switch ( selectedIndex )
+        {
+        case 0:
+                {
+                if ( removeIndex == 0 )
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeBottomToTop, currentindex );
+                    }
+                else
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeTopToBottom, currentindex );
+                    }
+                break;
+                }
+        case 1:
+                {
+                if ( removeIndex <= 1 )
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeLeftToRight, currentindex );
+                    }
+                else
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeBottomToTop, currentindex );
+                    }
+                break;
+                }
+        case 2:
+                {
+                if ( removeIndex <= 2 )
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeRightToLeft, currentindex );
+                    }
+                else
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeLeftToRight, currentindex );
+                    }
+                break;
+                }
+        case 3:
+                {
+                if ( removeIndex <= 3 )
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectCrossfade, currentindex );
+                    }
+                else
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeRightToLeft, currentindex );
+                    }
+                break;
+                }
+        case 4:
+                {
+                if ( removeIndex <= 4 )
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectDipToBlack, currentindex );
+                    }
+                else
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectCrossfade, currentindex );
+                    }
+                break;
+                }
+        case 5:
+                {
+                if ( removeIndex <= 5 )
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectDipToWhite, currentindex );
+                    }
+                else
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectDipToBlack, currentindex );
+                    }
+                break;
+                }
+        case 6:
+                {
+                if ( removeIndex <= 6 )
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectNone, currentindex );
+                    }
+                else
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectDipToWhite, currentindex );
+                    }
+                break;
+                }
+        case 7:
+                {
+                if ( removeIndex <= 7 )
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeLeftToRight, currentindex );
+                    }
+                else
+                    {
+                    iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectNone, currentindex );
+                    iView.Movie()->SetEndTransitionEffect( EVedEndTransitionEffectFadeToWhite );
+                    }
+                break;
+                }
+        default:
+            break;
+        }
+
+    }
+
+void CVeiPopup::ShowStartTransitionPopupListL()
+    {
+    TInt removeIndex;
+    switch ( iView.Movie()->StartTransitionEffect())
+        {
+        case EVedStartTransitionEffectFadeFromBlack:
+            removeIndex = 0;
+            break;
+        case EVedStartTransitionEffectFadeFromWhite:
+            removeIndex = 1;
+            break;
+        case EVedStartTransitionEffectNone:
+            removeIndex = 2;
+            break;
+        default:
+            removeIndex =  - 1;
+            break;
+        }
+
+    TInt selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
+                                            R_VEI_TRANSTION_POPUP_TITLE, 
+                                            R_VEI_START_TRANSITION_LIST_BOX_ARRAY, 
+                                            removeIndex, 
+                                            EFalse );
+
+    switch ( selectedIndex )
+        {
+        case 0:
+                {
+                if ( removeIndex == 0 )
+                    {
+                    iView.Movie()->SetStartTransitionEffect( EVedStartTransitionEffectFadeFromWhite );
+                    }
+                else
+                    {
+                    iView.Movie()->SetStartTransitionEffect( EVedStartTransitionEffectFadeFromBlack );
+                    }
+                break;
+                }
+        case 1:
+                {
+                if ( removeIndex <= 1 )
+                    {
+                    iView.Movie()->SetStartTransitionEffect( EVedStartTransitionEffectNone );
+                    }
+                else
+                    {
+                    iView.Movie()->SetStartTransitionEffect( EVedStartTransitionEffectFadeFromWhite );
+                    }
+                break;
+                }
+        default:
+            break;
+        }
+
+    }
+
+void CVeiPopup::ShowInsertAudioPopupList()
+    {
+    TInt selectedIndex; // Selected item's index in popup list.
+    TInt removeIndex; // Index to remove from list.
+
+    removeIndex =  - 1; // -1 = Nothing to remove from list array.
+
+    selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
+                                       R_VEI_POPUP_INSERT_AUDIO_TITLE, 
+                                       R_VEI_INSERT_AUDIO_LIST_BOX_ARRAY, 
+                                       removeIndex, 
+                                       EFalse );
+
+    switch ( selectedIndex )
+        {
+        /**
+         * Sound clip
+         */
+        case 0:
+            iView.HandleCommandL( EVeiCmdEditVideoViewInsertAudio );
+            break;
+            /**
+             * New sound clip
+             */
+        case 1:
+            iView.InsertNewAudio();
+            break;
+        default:
+            break;
+        }
+
+    }
+
+/*
+Show popup list when cursor is on empty video track.
+Video, text, image etc..
+ */
+
+void CVeiPopup::ShowInsertStuffPopupList()
+    {
+    TInt selectedIndex; // Selected item's index in popup list.
+    TInt removeIndex; // Index to remove from list.
+
+    removeIndex =  - 1; // -1 = Nothing to remove from list array.
+
+    selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
+                                       R_VEI_POPUP_INSERT_STUFF_TITLE, 
+                                       R_VEI_INSERT_STUFF_LIST_BOX_ARRAY, 
+                                       removeIndex, 
+                                       EFalse );
+
+    switch ( selectedIndex )
+        {
+        /**
+         * Video clip
+         */
+        case 0:
+            iView.HandleCommandL( EVeiCmdEditVideoViewInsertVideo );
+            break;
+            /**
+            INSERT IMAGE
+             */
+        case 1:
+            iView.HandleCommandL( EVeiCmdEditVideoViewInsertImage );
+            break;
+            /**
+            INSERT Text
+             */
+        case 2:
+            ShowInsertTextPopupList();
+            break;
+        default:
+            break;
+        }
+
+    }
+
+/*
+Show popup list when cursor is on empty video track.
+Video, text, image etc..
+ */
+
+
+void CVeiPopup::ShowInsertTextPopupList()
+    {
+    TInt selectedIndex; // Selected item's index in popup list.
+    TInt removeIndex; // Index to remove from list.
+
+    removeIndex =  - 1; // -1 = Nothing to remove from list array.
+
+    selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
+                                       R_VEI_POPUP_INSERT_STUFF_TITLE, 
+                                       R_VEI_INSERT_TEXT_LIST_BOX_ARRAY, 
+                                       removeIndex, 
+                                       EFalse );
+
+    switch ( selectedIndex )
+        {
+        case 0:
+            iView.HandleCommandL( EVeiCmdEditVideoViewInsertTextTitle );
+            break;
+        case 1:
+            iView.HandleCommandL( EVeiCmdEditVideoViewInsertTextTitleFading );
+            break;
+        case 2:
+            iView.HandleCommandL( EVeiCmdEditVideoViewInsertTextSubTitle );
+            break;
+        case 3:
+            iView.HandleCommandL( EVeiCmdEditVideoViewInsertTextSubTitleFading );
+            break;
+        case 4:
+            iView.HandleCommandL( EVeiCmdEditVideoViewInsertTextCredits );
+            break;
+        default:
+            break;
+        }
+    }
+
+void CVeiPopup::ShowEffectSelectionPopupListL()
+    {
+    TInt currentIndex = iView.Container()->CurrentIndex();
+    TInt removeIndex;
+
+    // Which effect to remove from listbox.
+    switch ( iView.Movie()->VideoClipColorEffect( currentIndex ))
+        {
+        case EVedColorEffectBlackAndWhite:
+            removeIndex = 0; // blackandwhite removed from list
+            break;
+            /*case EVedColorEffectToning: // some other color must be able to be chosen still
+            removeIndex = 1;
+            break;					
+             */
+        case EVedColorEffectNone:
+            removeIndex = 2;
+            break;
+        default:
+            removeIndex =  - 1; // Remove nothing from array.
+            break;
+        }
+
+
+    /*
+    array indexes:
+    qtn_vei_list_query_select_effect_black_white;
+    qtn_vei_list_query_select_effect_colour;
+    qtn_vei_list_query_select_effect_no_effect;	
+
+     */
+
+    // Execute popup list with proper parameters.
+    TInt selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
+                                            R_VEI_POPUP_SELECT_EFFECT_TITLE, 
+                                            R_VEI_EFFECT_LIST_BOX_ARRAY, // order: bw, col, no effect
+                                            removeIndex, 
+                                            EFalse );
+    switch ( selectedIndex )
+        {
+        case 0:
+            // blackandwhite
+                {
+                if ( removeIndex == 0 )
+                // current effect blackandwhite -> colour chosen
+                    {
+                    TRgb color;
+                    if ( !ShowColorSelectorL( color ))
+                        {
+                        break;
+                        }
+
+                    iView.Movie()->VideoClipSetColorTone( currentIndex, color );
+                    iView.Movie()->VideoClipSetColorEffect( currentIndex, EVedColorEffectToning );
+                    }
+                else
+                    {
+                    iView.Movie()->VideoClipSetColorEffect( currentIndex, EVedColorEffectBlackAndWhite );
+                    }
+                break;
+                }
+        case 1:
+            // colour
+                {
+                if ( removeIndex == 0 )
+                // // current effect blackandwhite -> no effect chosen
+                    {
+                    iView.Movie()->VideoClipSetColorEffect( currentIndex, EVedColorEffectNone );
+                    }
+                else
+                    {
+                    // current event none
+                    TRgb color;
+
+                    if ( !ShowColorSelectorL( color ))
+                        {
+                        break;
+                        }
+
+                    //				TInt R_ct = color.Red();
+                    //				TInt G_ct = color.Green();
+                    //				TInt B_ct = color.Blue();	
+
+                    iView.Movie()->VideoClipSetColorTone( currentIndex, color );
+                    iView.Movie()->VideoClipSetColorEffect( currentIndex, EVedColorEffectToning );
+
+                    //				TRgb toning = iView.Movie()->VideoClipColorTone(currentIndex);
+                    //				R_ct = toning.Red();
+                    //				G_ct = toning.Green();
+                    //				B_ct = toning.Blue();
+                    }
+                break;
+                }
+        case 2:
+            // no effect
+                {
+                iView.Movie()->VideoClipSetColorEffect( currentIndex, EVedColorEffectNone );
+                break;
+                }
+        default:
+            break;
+        }
+
+    }
+
+void CVeiPopup::ShowEditTextPopupList()
+    {
+    TInt selectedIndex =  - 1; // Selected item's index in popup list.
+    TInt listSelection =  - 1; // -1 = Nothing to remove from list array.
+    TInt removeIndex =  - 1; // -1 = Nothing to remove from list array.
+
+    TBool oneclip = EFalse;
+
+    if ( iView.Movie()->VideoClipCount() <= 1 )
+        {
+        removeIndex = 0;
+        oneclip = ETrue;
+        }
+
+    selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_EDIT_TEXT_TITLE, R_VEI_EDIT_TEXT_LIST_BOX_ARRAY, removeIndex, EFalse );
+
+    listSelection = selectedIndex;
+
+    if ( selectedIndex >= 0 )
+        {
+        if ( oneclip )
+            {
+            listSelection++;
+            }
+        }
+
+    switch ( listSelection )
+        {
+        case 0:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextMove );
+            break;
+        case 1:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextRemove );
+            break;
+        case 2:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextChangeDuration );
+            break;
+        case 3:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextChangeText );
+            break;
+        case 4:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextSetTextColor );
+            break;
+        case 5:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextSetBackGround );
+            break;
+        case 6:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextAddColorEffect );
+            break;
+        case 7:
+            ShowEditTextStylePopUpList();
+            break;
+        case 8:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextDuplicate );
+            break;
+        default:
+            break;
+        }
+
+    }
+
+void CVeiPopup::ShowEditTextStylePopUpList()
+    {
+
+    TInt selectedIndex; // Selected item's index in popup list.
+    TInt removeIndex; // Index to remove from list.
+
+    removeIndex =  - 1; // -1 = Nothing to remove from list array.
+
+    selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_EDIT_TEXT_TITLE, R_VEI_INSERT_TEXT_LIST_BOX_ARRAY, removeIndex, EFalse );
+
+    switch ( selectedIndex )
+        {
+        case 0:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleTitle );
+            break;
+        case 1:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleTitleFading );
+            break;
+        case 2:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleSubTitle );
+            break;
+        case 3:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleSubTitleFading );
+            break;
+        case 4:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleCredit );
+            break;
+        default:
+            break;
+        }
+
+    }
+
+void CVeiPopup::ShowEditVideoPopupList()
+    {
+
+    TInt originalIndex =  - 1;
+    // Selected item's index in original list (read from resource file)	
+    TInt dynamicIndex =  - 1;
+    // Selected item's index in dynamic list (where some items in original list may be removed)
+
+    // by default, all items are included in list (all are 1s)			
+    for ( TInt i = 0; i < KAmountOfMenuItems; i++ )
+        {
+        RemoveArrayIndex[i] = 1;
+        }
+
+    // next some items are possibly removed from the list (by marking their index with '0's)
+    // the reference order MUST be the same what it is in the original list in .rss
+
+    // menu item "Cut" removed
+    TTimeIntervalMicroSeconds duration = iView.Movie()->VideoClipInfo( iView.Container()->CurrentIndex())->Duration();
+    if ( duration.Int64() < KMinCutVideoLength )
+        {
+        RemoveArrayIndex[0] = 0;
+        }
+    // menu item "Move" removed
+    if ( iView.Movie()->VideoClipCount() <= 1 )
+        {
+        RemoveArrayIndex[1] = 0;
+        }
+
+    // menu items "Mute" and "Unmute" removed		
+    if ( EFalse == iView.Movie()->VideoClipIsMuteable( iView.Container()->CurrentIndex()))
+        {
+        RemoveArrayIndex[4] = 0;
+        RemoveArrayIndex[5] = 0;
+        }
+    else
+        {
+        // menu item "Mute" removed
+        if ( iView.Movie()->VideoClipIsMuted( iView.Container()->CurrentIndex()) )
+            {
+            RemoveArrayIndex[4] = 0;
+            }
+        // menu item "Unmute" removed	
+        else
+            {
+            RemoveArrayIndex[5] = 0;
+            }
+        }
+
+    if ( !( iView.Movie()->VideoClipInfo( iView.Container()->CurrentIndex()))->HasAudio())
+        {
+        RemoveArrayIndex[6] = 0; //EVeiCmdEditVideoAdjustVolume);
+        }
+
+
+    dynamicIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_EDIT_VIDEO_TITLE, R_VEI_EDIT_VIDEO_LIST_BOX_ARRAY, KAmountOfMenuItems, ETrue );
+
+    if ( dynamicIndex < 0 )
+        {
+        return ;
+        }
+
+    // next find out what was the selected item in the original list
+    // i.e. count 1's until dynamicIndex reached
+    TInt cnt =  - 1;
+    for ( TInt i = 0; i < KAmountOfMenuItems; i++ )
+        {
+        if ( 1 == RemoveArrayIndex[i] )
+            {
+            cnt++;
+            if ( dynamicIndex == cnt )
+                {
+                originalIndex = i;
+                break;
+                }
+            }
+        }
+
+    switch ( originalIndex )
+        {
+        case 0:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoCutting );
+            break;
+        case 1:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoMove );
+            break;
+        case 2:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoColorEffect );
+            break;
+        case 3:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoSlowMotion );
+            break;
+        case 4:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoMute );
+            break;
+        case 5:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoUnmute );
+            break;
+        case 6:
+            iView.HandleCommandL( EVeiCmdEditVideoAdjustVolume );
+            break;
+        case 7:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoRemove );
+            break;
+        case 8:
+            iView.HandleCommandL( EVeiCmdEditVideoDuplicate );
+            break;
+        default:
+            break;
+        }
+    }
+
+void CVeiPopup::ShowEditImagePopupList()
+    {
+    TInt selectedIndex =  - 1; // Selected item's index in popup list.
+    TInt listSelection =  - 1; // -1 = Nothing to remove from list array.
+    TInt removeIndex =  - 1; // -1 = Nothing to remove from list array.
+
+    TBool oneclip = EFalse;
+
+    if ( iView.Movie()->VideoClipCount() <= 1 )
+        {
+        removeIndex = 0;
+        oneclip = ETrue;
+        }
+
+
+    selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_EDIT_IMAGE_TITLE, R_VEI_EDIT_IMAGE_LIST_BOX_ARRAY, removeIndex, EFalse );
+
+    listSelection = selectedIndex;
+
+    if ( selectedIndex >= 0 )
+        {
+        if ( oneclip )
+            {
+            listSelection++;
+            }
+        }
+
+    switch ( listSelection )
+        {
+        case 0:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditImageMove );
+            break;
+        case 1:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditImageRemove );
+            break;
+        case 2:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditImageChangeDuration );
+            break;
+        case 3:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditImageBackGround );
+            break;
+        case 4:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditImageAddColorEffect );
+            break;
+        case 5:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditImageDuplicate );
+            break;
+        default:
+            break;
+        }
+
+    }
+
+TInt CVeiPopup::ShowTitleScreenBackgroundSelectionPopupL( TBool& aImageSelected )const
+    {
+    TInt selectedItem(  - 1 );
+    CAknListQueryDialog* query = new( ELeave )CAknListQueryDialog( &selectedItem );
+    query->PrepareLC( R_VEI_TITLESCREEN_BACKGROUND_LIST_QUERY );
+    if ( !query->RunLD())
+        {
+        return KErrCancel;
+        }
+
+    if ( selectedItem == 0 )
+        {
+        aImageSelected = ETrue;
+        }
+    else
+        {
+        aImageSelected = EFalse;
+        }
+
+    return KErrNone;
+
+    }
+
+void CVeiPopup::ShowTitleScreenStyleSelectionPopupL()
+    {
+    TInt selectedIndex; // Selected item's index in popup list.
+    TInt removeIndex; // Index to remove from list.
+
+    removeIndex =  - 1; // -1 = Nothing to remove from list array.
+
+    selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_SELECT_TEXT_STYLE_TITLE, R_VEI_INSERT_TEXT_LIST_BOX_ARRAY, removeIndex, EFalse );
+
+    switch ( selectedIndex )
+        {
+        case 0:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleTitle );
+            break;
+        case 1:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleTitleFading );
+            break;
+        case 2:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleSubTitle );
+            break;
+        case 3:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleSubTitleFading );
+            break;
+        case 4:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleCredit );
+            break;
+        default:
+            break;
+        }
+
+    }
+
+void CVeiPopup::ShowEditAudioPopupList()
+    {
+    TInt selectedIndex; // Selected item's index in popup list.
+    TInt removeIndex; // Index to remove from list.
+
+    removeIndex =  - 1; // -1 = Nothing to remove from list array.
+
+    selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_EDIT_AUDIO_TITLE, R_VEI_EDIT_AUDIO_LIST_BOX_ARRAY, removeIndex, EFalse );
+
+    switch ( selectedIndex )
+        {
+        case 0:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoCutting );
+            break;
+        case 1:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoMove );
+            break;
+        case 2:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditAudioSetDuration );
+            break;
+        case 3:
+            iView.HandleCommandL( EVeiCmdEditVideoAdjustVolume );
+            break;
+        case 4:
+            iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoRemove );
+            break;
+        case 5:
+            iView.HandleCommandL( EVeiCmdEditVideoDuplicate );
+            break;
+        default:
+            break;
+        }
+
+    }
+
+TBool CVeiPopup::ShowColorSelectorL( TRgb& aColor )const
+    {
+    TBool noneChosen = EFalse;
+    /* None color option: True/False */
+
+
+    TBool noneExist = EFalse;
+
+    CArrayFixFlat < TRgb > * colors = new( ELeave )CArrayFixFlat < TRgb > ( 16 );
+    CleanupStack::PushL( colors );
+
+    colors->AppendL( TRgb( 0xffffff ));
+    colors->AppendL( TRgb( 0xcccccc ));
+    colors->AppendL( TRgb( 0x4d4d4d ));
+    colors->AppendL( TRgb( 0x000000 ));
+    colors->AppendL( TRgb( 0x00ffff ));
+    colors->AppendL( TRgb( 0x44d8ff ));
+    colors->AppendL( TRgb( 0x0268ff ));
+    colors->AppendL( TRgb( 0x001ef1 ));
+    colors->AppendL( TRgb( 0x00ffb9 ));
+    colors->AppendL( TRgb( 0x00c873 ));
+    colors->AppendL( TRgb( 0x026c3e ));
+    colors->AppendL( TRgb( 0x0017c8 ));
+    colors->AppendL( TRgb( 0xe7be7a ));
+    colors->AppendL( TRgb( 0xff9b00 ));
+    colors->AppendL( TRgb( 0xb36718 ));
+    colors->AppendL( TRgb( 0x803e00 ));
+
+
+    CAknColourSelectionGrid* d = CAknColourSelectionGrid::NewL( colors, noneExist, noneChosen, aColor );
+    TBool selected = d->ExecuteLD();
+    CleanupStack::PopAndDestroy( colors );
+
+    //return !noneChosen;
+    return selected;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiSettingItemList.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#include "FilenameSettingItem.h"
+#include "manualvideoeditor.hrh"	// For setting item ids
+#include "VeiSettingItemList.h"
+
+#include <caknmemoryselectionsettingitem.h> 
+#include <manualvideoeditor.rsg>
+
+CVeiSettingItemList::CVeiSettingItemList( TVeiSettings& aSettings ): iSettings( aSettings )
+{}
+
+CVeiSettingItemList::~CVeiSettingItemList()
+{}
+
+/**
+ * Called by framework when the view size is changed. Resizes the
+ * setting list accordingly.
+ */
+void CVeiSettingItemList::SizeChanged()
+    {
+    if ( ListBox())
+        {
+        ListBox()->SetRect( Rect());
+        }
+    }
+
+/**
+ *
+ *
+ */
+CAknSettingItem* CVeiSettingItemList::CreateSettingItemL( TInt aSettingId )
+    {
+    CAknSettingItem* settingItem = NULL;
+
+    switch ( aSettingId )
+        {
+        /**
+         * Default video name
+         */
+        case EVeiVideoNameSettingItem:
+            settingItem = new( ELeave )CFileNameSettingItem( aSettingId, iSettings.DefaultVideoName(), R_VEI_ILLEGAL_FILENAME, R_VEI_UNSUITABLE_FILENAME );
+            break;
+            /**
+             * Default snapshot name
+             */
+        case EVeiSnapshotNameSettingItem:
+            settingItem = new( ELeave )CFileNameSettingItem( aSettingId, iSettings.DefaultSnapshotName(), R_VEI_ILLEGAL_FILENAME, R_VEI_UNSUITABLE_FILENAME );
+            break;
+            /**
+             * Save quality
+             */
+        case EVeiSaveQualitySettingItem:
+            settingItem = new( ELeave )CAknEnumeratedTextPopupSettingItem( aSettingId, iSettings.SaveQuality());
+            break;
+            /**
+             * Memory in use
+             */
+        case EVeiMemoryInUseSettingItem:
+            settingItem = new( ELeave )CAknMemorySelectionSettingItem( aSettingId, iSettings.MemoryInUse());
+            break;
+            /**
+             * Default
+             */
+        default:
+            // Panic the aplication if all setting items defined in rss
+            // are not constructed
+            User::Panic( _L( "CVeiSettingItemList" ), KErrNotFound );
+            break;
+        }
+    // Return constructed item and transfer the ownership to base class.
+    return settingItem;
+    }
+
+/**
+ *
+ *
+ */
+void CVeiSettingItemList::ChangeFocusedItemL()
+    {
+    EditItemL( ListBox()->CurrentItemIndex(), ETrue );
+    }
+
+/**
+ * 
+ *
+ */
+void CVeiSettingItemList::EditItemL( TInt aIndex, TBool aCalledFromMenu )
+    {
+    CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu );
+    ( *SettingItemArray())[aIndex]->StoreL();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiSettingsContainer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+// INCLUDES
+// System includes
+#include <manualvideoeditor.rsg>
+// User includes
+#include "VeiSettingsContainer.h"
+#include "VeiSettingItemList.h"
+#include "VideoEditorCommon.h"      // Help (application) UID
+#include "VideoEditorHelp.hlp.hrh"  // Topic context (literal)
+#include "VideoEditorDebugUtils.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CVeiSettingsContainer::ConstructL(const TRect& aRect)
+// EPOC two phased constructor
+// ---------------------------------------------------------
+//
+void CVeiSettingsContainer::ConstructL( const TRect& aRect, TVeiSettings& aSettings )
+    {
+    CreateWindowL();
+    SetRect( aRect );
+
+    iSettingItemList = new( ELeave )CVeiSettingItemList( aSettings );
+    iSettingItemList->SetMopParent( this );
+    iSettingItemList->ConstructFromResourceL( R_VEI_SETTING_ITEM_LIST );
+
+
+    ActivateL();
+    }
+
+// Destructor
+CVeiSettingsContainer::~CVeiSettingsContainer()
+    {
+    delete iSettingItemList;
+    }
+
+// ---------------------------------------------------------
+// CVeiSettingsContainer::CountComponentControls() const
+// return nbr of controls inside this container
+// ---------------------------------------------------------
+//
+TInt CVeiSettingsContainer::CountComponentControls()const
+    {
+    return 1;
+    }
+
+// ---------------------------------------------------------
+// CVeiSettingsContainer::ComponentControl(TInt aIndex) const
+// ---------------------------------------------------------
+//
+CCoeControl* CVeiSettingsContainer::ComponentControl( TInt aIndex )const
+    {
+    switch ( aIndex )
+        {
+        case 0:
+            return iSettingItemList;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CVeiSettingsContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+//
+//
+// ----------------------------------------------------------------------------
+//
+void CVeiSettingsContainer::GetHelpContext( TCoeHelpContext& aContext )const
+    {
+    // Set UID of the CS Help file (same as application UID).
+    aContext.iMajor = KUidVideoEditor;
+
+    // Set the context.
+    aContext.iContext = KVED_HLP_SETTINGS_VIEW;
+    }
+
+
+void CVeiSettingsContainer::ChangeFocusedItemL()
+    {
+    if ( iSettingItemList )
+        {
+        iSettingItemList->ChangeFocusedItemL();
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CVeiSettingsContainer::OfferKeyEventL( 
+//      const TKeyEvent& aKeyEvent,TEventCode aType )
+// ---------------------------------------------------------
+//
+
+TKeyResponse CVeiSettingsContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    if ( iSettingItemList )
+        {
+        return iSettingItemList->OfferKeyEventL( aKeyEvent, aType );
+        }
+    else
+        {
+        return EKeyWasNotConsumed;
+        }
+    }
+
+void CVeiSettingsContainer::HandleResourceChange( TInt aType )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiSettingsContainer::HandleResourceChange() In, aType:%d", aType );
+
+    if ( aType == KEikDynamicLayoutVariantSwitch && OwnsWindow())
+        {
+        LOG( KVideoEditorLogFile, "CVeiSettingsContainer::HandleResourceChange() 1" );
+        TRect rect;
+
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
+        LOGFMT4( KVideoEditorLogFile, "CVeiSettingsContainer::HandleResourceChange(): 2, (%d,%d),(%d,%d)", rect.iTl.iX, rect.iTl.iY, rect.iBr.iX, rect.iBr.iY );
+        SetRect( rect );
+        }
+    iSettingItemList->DrawNow();
+    CCoeControl::HandleResourceChange( aType );
+
+    LOG( KVideoEditorLogFile, "CVeiSettingsContainer::HandleResourceChange() Out" );
+    }
+
+
+
+void CVeiSettingsContainer::SizeChanged()
+    {
+    LOG( KVideoEditorLogFile, "CVeiSettingsContainer::SizeChanged(): In" );
+    //TRect rect( Rect() ); 
+    TRect rect;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
+
+    LOGFMT4( KVideoEditorLogFile, "CVeiSettingsContainer::SizeChanged(): 1, (%d,%d),(%d,%d)", rect.iTl.iX, rect.iTl.iY, rect.iBr.iX, rect.iBr.iY );
+
+    LOG( KVideoEditorLogFile, "CVeiSettingsContainer::SizeChanged(): 2" );
+    if ( iSettingItemList )
+        {
+        LOG( KVideoEditorLogFile, "CVeiSettingsContainer::SizeChanged(): 3" );
+        iSettingItemList->SetRect( rect );
+        }
+    LOG( KVideoEditorLogFile, "CVeiSettingsContainer::SizeChanged(): Out" );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiSettingsView.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <aknviewappui.h>
+#include <avkon.hrh>
+#include <manualvideoeditor.rsg>
+#include <akncontext.h> 
+#include <akntitle.h> 
+#include <barsread.h>
+#include <s32stor.h>
+#include <aknquerydialog.h> 
+#include <s32stor.h> 
+
+// User includes 
+#include "Manualvideoeditor.hrh"
+#include "VeiSettingsView.h"
+#include "VeiSettingsContainer.h" 
+#include "VeiApp.h" 
+#include "VeiAppUi.h"
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+CVeiSettingsView* CVeiSettingsView::NewL()
+    {
+    CVeiSettingsView* self = CVeiSettingsView::NewLC();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+CVeiSettingsView* CVeiSettingsView::NewLC()
+    {
+    CVeiSettingsView* self = new( ELeave )CVeiSettingsView();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CVeiSettingsView::ConstructL(const TRect& aRect)
+// EPOC two-phased constructor
+// ---------------------------------------------------------
+//
+void CVeiSettingsView::ConstructL()
+    {
+    BaseConstructL( R_VEI_SETTINGS_VIEW );
+    }
+
+
+CVeiSettingsView::CVeiSettingsView()
+    {
+    }
+
+// ---------------------------------------------------------
+// CVeiSettingsView::~CVeiSettingsView()
+// Destructor
+// ---------------------------------------------------------
+//
+CVeiSettingsView::~CVeiSettingsView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        }
+
+    delete iContainer;
+    }
+
+// ---------------------------------------------------------
+// TUid CVeiSettingsView::Id()
+// Returns settings view UID
+// ---------------------------------------------------------
+//
+TUid CVeiSettingsView::Id()const
+    {
+    return TUid::Uid( EVeiSettingsView );
+    }
+
+// ---------------------------------------------------------
+// CVeiSettingsView::HandleCommandL(TInt aCommand)
+// ---------------------------------------------------------
+//
+void CVeiSettingsView::HandleCommandL( TInt aCommand )
+    {
+    switch ( aCommand )
+        {
+        /**
+         * Back
+         */
+        case EAknSoftkeyBack:
+            // Do not force 
+            // the settings view into portrait, even though it contains text input.
+            //AppUi()->SetOrientationL( iOriginalOrientation );
+            STATIC_CAST( CVeiAppUi* , AppUi())->WriteSettingsL( iSettings );
+            // Activate Edit Video view
+            AppUi()->ActivateLocalViewL( TUid::Uid( EVeiEditVideoView ));
+            break;
+            /**
+             * Change
+             */
+        case EVeiCmdSettingsViewChange:
+            iContainer->ChangeFocusedItemL(); // Start editing the focused item.
+            break;
+            /**
+             * Help
+             */
+        case EVeiCmdSettingsViewHelp:
+            AppUi()->HandleCommandL( EVeiCmdSettingsViewHelp );
+            break;
+            /**
+             * Exit
+             */
+        case EEikCmdExit:
+            STATIC_CAST( CVeiAppUi* , AppUi())->WriteSettingsL( iSettings );
+            AppUi()->HandleCommandL( EEikCmdExit );
+            break;
+        default:
+            AppUi()->HandleCommandL( aCommand );
+            break;
+        }
+    }
+
+// ---------------------------------------------------------
+// CVeiSettingsView::HandleClientRectChange()
+// ---------------------------------------------------------
+//
+void CVeiSettingsView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect());
+        }
+
+    }
+
+// ---------------------------------------------------------
+// CVeiSettingsView::DoActivateL(...)
+// ---------------------------------------------------------
+//
+void CVeiSettingsView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, 
+                                    TUid /*aCustomMessageId*/, 
+                                    const TDesC8& /*aCustomMessage*/ )
+    {
+    // do not force the settings view into portrait,
+    //  even though it contains text input.
+    // iOriginalOrientation = AppUi()->Orientation();
+    //AppUi()->SetOrientationL( CAknAppUiBase::EAppUiOrientationPortrait );
+
+    if ( !iContainer )
+        {
+        STATIC_CAST( CVeiAppUi* , AppUi())->ReadSettingsL( iSettings );
+        // Read da settings.
+
+        iContainer = new( ELeave )CVeiSettingsContainer;
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( AppUi()->ClientRect(), iSettings );
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    CEikStatusPane* statusPane = (( CAknAppUi* )iEikonEnv->EikAppUi())->StatusPane();
+
+    CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ));
+    TResourceReader reader1;
+    iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_SETTINGS_VIEW_TITLE_NAME );
+    titlePane->SetFromResourceL( reader1 );
+    CleanupStack::PopAndDestroy(); //reader1
+    }
+
+// ---------------------------------------------------------
+// CVeiSettingsView::DoDeactivate()
+// ---------------------------------------------------------
+//
+void CVeiSettingsView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        }
+
+    delete iContainer;
+    iContainer = NULL;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiTrimForMmsContainer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,958 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+// INCLUDE FILES
+// System includes
+#include <AknIconUtils.h>   // AknIconUtils
+#include <eikenv.h>     // iEikonEnv
+#include <manualvideoeditor.rsg>    // Video Editor resources
+#include <StringLoader.h>   // StringLoader
+
+#include <aknbiditextutils.h>
+#include <gulfont.h>
+
+#include <aknsdrawutils.h> 
+#include <aknsdatacontext.h> 
+#include <aknsbasicbackgroundcontrolcontext.h>
+
+#include <AknProgressDialog.h> 
+#include <eikprogi.h>
+#include <AknWaitDialog.h>
+
+
+// User includes
+#include "VeiTrimForMmsContainer.h"
+#include "VeiVideoDisplay.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorHelp.hlp.hrh"  // Topic contexts (literals)
+#include "veiframetaker.h"
+#include "VeiTrimForMmsView.h"
+#include "VeiCutterBar.h"
+#include "VeiVideoEditorSettings.h"
+#include "VideoEditorUtils.h"
+#include "VideoEditorDebugUtils.h"
+
+void CVeiTrimForMmsContainer::DialogDismissedL( TInt /*aButtonId*/ )
+    {
+    iProgressInfo = NULL;
+    }
+
+
+CVeiTrimForMmsContainer* CVeiTrimForMmsContainer::NewL( const TRect& aRect, 
+                                                        CVedMovie& aMovie, 
+                                                        CVeiTrimForMmsView& aView )
+    {
+    CVeiTrimForMmsContainer* self = CVeiTrimForMmsContainer::NewLC( aRect, aMovie, aView );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+CVeiTrimForMmsContainer* CVeiTrimForMmsContainer::NewLC( const TRect& aRect, 
+                                                         CVedMovie& aMovie, 
+                                                         CVeiTrimForMmsView& aView )
+    {
+    CVeiTrimForMmsContainer* self = new( ELeave )CVeiTrimForMmsContainer( aMovie, aView );
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect );
+
+    return self;
+    }
+
+
+CVeiTrimForMmsContainer::CVeiTrimForMmsContainer( CVedMovie& aMovie, CVeiTrimForMmsView& aView ): 
+                            iLastKeyLeftOrRight( EFalse ), iMovie( aMovie ), iView( aView )
+
+{}
+
+
+void CVeiTrimForMmsContainer::ConstructL( const TRect& aRect )
+    {
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsContainer::ConstructL: in" );
+
+    // Make this compound control window-owning.
+    CreateWindowL();
+
+    iMovie.RegisterMovieObserverL( this );
+
+    // Read the texts shown above the thumbnails from resources
+    iStartText = StringLoader::LoadL( R_VED_THUMBNAIL_START_TEXT, iEikonEnv );
+    iEndText = StringLoader::LoadL( R_VED_THUMBNAIL_END_TEXT, iEikonEnv );
+
+    iSeekPos = TTimeIntervalMicroSeconds( 0 );
+
+    iVideoDisplayStart = CVeiVideoDisplay::NewL( iVideoDisplayStartRect, this, *this );
+
+    iVideoDisplayEnd = CVeiVideoDisplay::NewL( iVideoDisplayEndRect, this, * this );
+
+    iCutterBar = CVeiCutterBar::NewL( this );
+    iCutterBar->SetPlayHeadVisible( EFalse );
+    iVideoDisplay = CVeiVideoDisplay::NewL( aRect, this, * this );
+
+    iFrameTaker = CVeiFrameTaker::NewL( *this );
+
+    /* Timer to keep back light on when user is not giving key events */
+    iScreenLight = CVeiDisplayLighter::NewL();
+    CVeiVideoEditorSettings::GetMaxMmsSizeL( iMaxMmsSize );
+    /* SharedData returns maxmmssize in kbytes. Change it to bytes(1000) and
+    add some margin to final value.*/
+    iMaxMmsSize = STATIC_CAST( TInt, iMaxMmsSize* 0.98 );
+    iBlack = EFalse;
+
+    // Set this control extent.
+    SetRect( aRect );
+    iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse );
+
+    ActivateL();
+
+    iKeyEnable = EFalse;
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsContainer::ConstructL: out" );
+    }
+
+
+
+CVeiTrimForMmsContainer::~CVeiTrimForMmsContainer()
+    {
+    iMovie.UnregisterMovieObserver( this );
+
+    delete iEndText;
+    delete iStartText;
+    delete iScreenLight;
+
+    delete iCutterBar;
+
+    delete iVideoDisplayStart;
+    delete iVideoDisplayEnd;
+    if ( iVideoDisplay )
+        {
+        delete iVideoDisplay;
+        iVideoDisplay = NULL;
+        }
+
+    if ( iFrameTaker )
+        {
+        delete iFrameTaker;
+        iFrameTaker = NULL;
+        }
+
+    if ( iProgressNote )
+        {
+        delete iProgressNote;
+        iProgressNote = NULL;
+        }
+    iProgressInfo = NULL;
+
+    delete iBgContext;
+    }
+
+void CVeiTrimForMmsContainer::SetMaxMmsSize( TInt aMaxSizeInBytes )
+    {
+    iMaxMmsSize = aMaxSizeInBytes;
+    }
+
+const TTimeIntervalMicroSeconds& CVeiTrimForMmsContainer::CutInTime()const
+    {
+    return iSeekPos;
+    }
+
+
+const TTimeIntervalMicroSeconds& CVeiTrimForMmsContainer::CutOutTime()const
+    {
+    return iSeekEndPos;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsContainer::ComponentControl(...) const
+//
+// Gets the specified component of a compound control. 
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CVeiTrimForMmsContainer::ComponentControl( TInt aIndex )const
+    {
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsContainer::ComponentControl()" );
+
+    switch ( aIndex )
+        {
+        //
+        // iCutterDisplay
+        //
+        case ECutFrame:
+                {
+                return iCutterBar;
+                }
+            //
+            // iVideoDisplayStart
+            //
+        case EVideoDisplayStart:
+                {
+                return iVideoDisplayStart;
+                }
+            //
+            // iVideoDisplayEnd
+            //
+        case EVideoDisplayEnd:
+                {
+                return iVideoDisplayEnd;
+                }
+            //
+            // iVideoDisplay
+            //
+        case EVideoPreview:
+                {
+                return iVideoDisplay;
+                }
+            //
+            // Default
+            //
+        default:
+                {
+                return NULL;
+                }
+        }
+
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsContainer::CountComponentControls() const
+//
+// Gets the number of controls contained in a compound control.
+// ----------------------------------------------------------------------------
+//
+TInt CVeiTrimForMmsContainer::CountComponentControls()const
+    {
+    return ENumberOfControls;
+    }
+
+
+void CVeiTrimForMmsContainer::Draw( const TRect& aRect )const
+    {
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsContainer::Draw(): In" );
+
+    CWindowGc& gc = SystemGc();
+    gc.Clear( aRect );
+
+    // Black backbround for the preview
+    if ( iBlack )
+        {
+        iVideoDisplay->MakeVisible( EFalse );
+        gc.SetPenStyle( CWindowGc::ENullPen );
+        gc.SetBrushColor( KRgbBlack );
+        gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+        gc.DrawRect( aRect );
+        gc.SetPenStyle( CWindowGc::ESolidPen );
+        gc.DrawRoundRect( aRect, TSize( 4, 4 ));
+        return ;
+        }
+    else
+        {
+        // Draw skin background
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+        MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+        AknsDrawUtils::Background( skin, cc, this, gc, aRect );
+
+        // Get text color from skin
+        TRgb textColor( KRgbBlack );
+        AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
+        gc.SetPenColor( textColor );
+
+        const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+        TBuf < 95 > startVisualText;
+        TPoint startTextPoint;
+        TBuf < 95 > endVisualText;
+        TPoint endTextPoint;
+
+        startTextPoint.iY = iStartTextBox.iTl.iY + font->HeightInPixels();
+        endTextPoint.iY = iEndTextBox.iTl.iY + font->HeightInPixels();
+
+        gc.UseFont( font );
+
+        TBidiText::TDirectionality textDirectionality;
+
+        textDirectionality = AknTextUtils::CurrentScriptDirectionality();
+
+        TInt maxWidthNonClippingStart = iStartTextBox.Width();
+
+        AknBidiTextUtils::ConvertToVisualAndClip( *iStartText, 
+                                                  startVisualText, 
+                                                  *font, 
+                                                  maxWidthNonClippingStart, 
+                                                  maxWidthNonClippingStart );
+        /** check text alignment */
+        if ( textDirectionality == TBidiText::ELeftToRight )
+            {
+            startTextPoint.iX = iVideoDisplayStartRect.iTl.iX;
+            }
+        else
+            {
+            startTextPoint.iX = iVideoDisplayStartRect.iBr.iX - font->TextWidthInPixels( startVisualText );
+            }
+
+        gc.DrawText( startVisualText, startTextPoint );
+
+
+        TInt maxWidthNonClippingEnd = iEndTextBox.Width();
+
+        AknBidiTextUtils::ConvertToVisualAndClip( *iEndText, 
+                                                  endVisualText, 
+                                                  *font, 
+                                                  maxWidthNonClippingEnd, 
+                                                  maxWidthNonClippingEnd );
+        /** check text alignment */
+        if ( textDirectionality == TBidiText::ELeftToRight )
+            {
+            endTextPoint.iX = iVideoDisplayEndRect.iTl.iX;
+            }
+        else
+            {
+            endTextPoint.iX = iVideoDisplayEndRect.iBr.iX - font->TextWidthInPixels( endVisualText );
+            }
+
+        gc.DrawText( endVisualText, endTextPoint );
+
+        gc.DiscardFont();
+
+        // Draw Start/End displays
+        iVideoDisplayStart->SetRect( iVideoDisplayStartRect );
+        iVideoDisplayEnd->SetRect( iVideoDisplayEndRect );
+
+        if ( iPreviewState == EPlaying )
+            {
+            iVideoDisplay->MakeVisible( ETrue );
+            }
+        else
+            {
+            iVideoDisplay->MakeVisible( EFalse );
+            }
+
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsContainer::Draw(): Out" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsContainer::GetHelpContext(...) const
+//
+// Gets the control's help context. Associates the control with a particular
+// Help file and topic in a context sensitive application.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsContainer::GetHelpContext( TCoeHelpContext& aContext )const
+    {
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsContainer::GetHelpContext(): In" );
+
+    // Set UID of the CS Help file (same as application UID).
+    aContext.iMajor = KUidVideoEditor;
+
+    // Set the context/topic.
+    aContext.iContext = KVED_HLP_TRIM_FOR_MMS_VIEW;
+
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsContainer::GetHelpContext(): Out" );
+    }
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsContainer::SizeChanged()
+//
+// The function is called whenever SetExtent(), SetSize(), SetRect(),
+// SetCornerAndSize(), or SetExtentToWholeScreen() are called on the control.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsContainer::SizeChanged()
+    {
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsContainer::SizeChanged(): In" );
+
+    TRect rect = Rect();
+    if ( iBgContext )
+        {
+        iBgContext->SetRect( rect );
+        }
+
+    if ( VideoEditorUtils::IsLandscapeScreenOrientation())
+    //Landscape
+        {
+        //  Start Text rect
+        TInt startTextTlX = STATIC_CAST( TInt, rect.iBr.iX* 0.00962 );
+        TInt startTextTlY = STATIC_CAST( TInt, rect.iBr.iY* 0.01389 );
+        TInt startTextBrX = STATIC_CAST( TInt, rect.iBr.iX* 0.49512 );
+        TInt startTextBrY = STATIC_CAST( TInt, rect.iBr.iY* 0.09375 );
+
+        iStartTextBox = TRect( startTextTlX, startTextTlY, startTextBrX, startTextBrY );
+        //  End Text rect
+        TInt endTextTlX = STATIC_CAST( TInt, rect.iBr.iX* 0.50481 );
+        TInt endTextTlY = STATIC_CAST( TInt, rect.iBr.iY* 0.01389 );
+        TInt endTextBrX = STATIC_CAST( TInt, rect.iBr.iX* 0.99039 );
+        TInt endTextBrY = STATIC_CAST( TInt, rect.iBr.iY* 0.09375 );
+
+        iEndTextBox = TRect( endTextTlX, endTextTlY, endTextBrX, endTextBrY );
+
+        // Start Video rect
+        TInt startVideoTlX = STATIC_CAST( TInt, rect.iBr.iX* 0.00962 );
+        TInt startVideoTlY = STATIC_CAST( TInt, rect.iBr.iY* 0.10764 );
+        TInt startVideoBrX = STATIC_CAST( TInt, rect.iBr.iX* 0.49512 );
+        TInt startVideoBrY = STATIC_CAST( TInt, rect.iBr.iY* 0.68056 );
+
+        iVideoDisplayStartRect = TRect( startVideoTlX, startVideoTlY, startVideoBrX, startVideoBrY );
+        //  End Video rect
+        TInt endVideoTlX = STATIC_CAST( TInt, rect.iBr.iX* 0.50481 );
+        TInt endVideoTlY = STATIC_CAST( TInt, rect.iBr.iY* 0.10764 );
+        TInt endVideoBrX = STATIC_CAST( TInt, rect.iBr.iX* 0.99039 );
+        TInt endVideoBrY = STATIC_CAST( TInt, rect.iBr.iY* 0.68056 );
+
+        iVideoDisplayEndRect = TRect( endVideoTlX, endVideoTlY, endVideoBrX, endVideoBrY );
+
+        // Timeline rect
+        TInt timeLineTlX = STATIC_CAST( TInt, rect.iBr.iX* 0.0114 );
+        TInt timeLineTlY = STATIC_CAST( TInt, rect.iBr.iY* 0.80208 );
+
+        TSize cutBarSize = TSize( STATIC_CAST( TInt, rect.iBr.iX* 0.9773 ), STATIC_CAST( TInt, rect.iBr.iY* 0.0973 ));
+
+        iTimelineRect = TRect( TPoint( timeLineTlX, timeLineTlY ), cutBarSize );
+        }
+    else
+    // Portrait
+        {
+        //  Start Text rect
+        TInt startTextTlX = STATIC_CAST( TInt, rect.iBr.iX* 0.01136 );
+        TInt startTextTlY = STATIC_CAST( TInt, rect.iBr.iY* 0.01389 );
+        TInt startTextBrX = STATIC_CAST( TInt, rect.iBr.iX* 0.49432 );
+        TInt startTextBrY = STATIC_CAST( TInt, rect.iBr.iY* 0.10417 );
+
+        iStartTextBox = TRect( startTextTlX, startTextTlY, startTextBrX, startTextBrY );
+
+        //  End Text rect
+        TInt endTextTlX = STATIC_CAST( TInt, rect.iBr.iX* 0.50568 );
+        TInt endTextTlY = STATIC_CAST( TInt, rect.iBr.iY* 0.01389 );
+        TInt endTextBrX = STATIC_CAST( TInt, rect.iBr.iX* 0.98864 );
+        TInt endTextBrY = STATIC_CAST( TInt, rect.iBr.iY* 0.10417 );
+
+        iEndTextBox = TRect( endTextTlX, endTextTlY, endTextBrX, endTextBrY );
+
+        // Start Video rect
+        TInt startVideoTlX = STATIC_CAST( TInt, rect.iBr.iX* 0.01136 );
+        TInt startVideoTlY = STATIC_CAST( TInt, rect.iBr.iY* 0.11806 );
+        TInt startVideoBrX = STATIC_CAST( TInt, rect.iBr.iX* 0.49432 );
+        TInt startVideoBrY = STATIC_CAST( TInt, rect.iBr.iY* 0.60069 );
+
+        iVideoDisplayStartRect = TRect( startVideoTlX, startVideoTlY, startVideoBrX, startVideoBrY );
+
+        //  End Video rect
+        TInt endVideoTlX = STATIC_CAST( TInt, rect.iBr.iX* 0.50568 );
+        TInt endVideoTlY = STATIC_CAST( TInt, rect.iBr.iY* 0.11806 );
+        TInt endVideoBrX = STATIC_CAST( TInt, rect.iBr.iX* 0.98864 );
+        TInt endVideoBrY = STATIC_CAST( TInt, rect.iBr.iY* 0.60069 );
+
+        iVideoDisplayEndRect = TRect( endVideoTlX, endVideoTlY, endVideoBrX, endVideoBrY );
+
+        // Timeline rect
+        TInt timeLineTlX = STATIC_CAST( TInt, rect.iBr.iX* 0.0114 );
+        TInt timeLineTlY = STATIC_CAST( TInt, rect.iBr.iY* 0.767361 );
+
+
+        TSize cutBarSize = TSize( STATIC_CAST( TInt, rect.iBr.iX* 0.9773 ), STATIC_CAST( TInt, rect.iBr.iY* 0.0973 ));
+
+        iTimelineRect = TRect( TPoint( timeLineTlX, timeLineTlY ), cutBarSize );
+        }
+
+    iCutterBar->SetRect( iTimelineRect );
+
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsContainer::SizeChanged(): Out" );
+    }
+
+TKeyResponse CVeiTrimForMmsContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    if ( iKeyEnable )
+        {
+        switch ( aType )
+            {
+            //
+            // Key down event
+            //
+            case EEventKeyDown:
+                    {
+                    iKeyRepeatCount = 0;
+                    if ( iPreviewState == EPlaying )
+                        {
+                        //					iView.SetTrimStateL( CVeiTrimForMmsView::ESeek );
+                        //					Stop( ETrue );
+                        return EKeyWasConsumed;
+                        }
+                    else
+                        {
+                        //iMovie.VideoClipSetCutInTime( 0,TTimeIntervalMicroSeconds(0) );
+                        //iMovie.VideoClipSetCutOutTime( 0, iDuration );
+                        return EKeyWasConsumed;
+                        }
+                    }
+                //
+                // The key event
+                //
+            case EEventKey:
+                    {
+                    if ( iPreviewState == EPlaying )
+                        {
+                        return EKeyWasConsumed;
+                        }
+                    switch ( aKeyEvent.iCode )
+                        {
+                        //
+                        // Navi-key right
+                        //
+                    case EKeyRightArrow:
+                            {
+
+                            if ( 0 == iKeyRepeatCount )
+                                {
+                                iMovie.VideoClipSetCutInTime( 0, TTimeIntervalMicroSeconds( 0 ));
+                                iMovie.VideoClipSetCutOutTime( 0, iDuration );
+                                }
+
+                            if ( iSeekEndPos != iDuration )
+                                {
+                                iSeekEvent = ETrue;
+                                iLastKeyLeftOrRight = ETrue;
+                                if ( iKeyRepeatCount < 18 )
+                                    {
+                                    iKeyRepeatCount++;
+                                    }
+
+                                TInt adjustment = TimeIncrement( iKeyRepeatCount );
+                                TInt64 newPos = iSeekPos.Int64() + adjustment;
+
+                                TTimeIntervalMicroSeconds endTime( 0 );
+                                iMovie.GetDurationEstimateL( iMaxMmsSize, newPos, endTime );
+
+                                // what is the reasoning behid this?
+                                // should args be checked before call to GetDurationEstimateL(), like in 
+                                // EKeyLeftArrow?
+                                if ( endTime.Int64() >= iDuration.Int64() - adjustment )
+                                    {
+                                    iKeyRepeatCount -= 3;
+                                    adjustment = TimeIncrement( iKeyRepeatCount );
+                                    endTime = iDuration;
+                                    newPos += adjustment;
+                                    }
+
+                                iSeekPos = TTimeIntervalMicroSeconds( newPos );
+                                iSeekEndPos = endTime;
+                                iCutterBar->SetInPoint( iSeekPos );
+                                iCutterBar->SetOutPoint( endTime );
+                                }
+
+                            return EKeyWasConsumed;
+                            }
+                        //
+                        // Navi-key left
+                        //
+                    case EKeyLeftArrow:
+                            {
+
+                            if ( 0 == iKeyRepeatCount )
+                                {
+                                iMovie.VideoClipSetCutInTime( 0, TTimeIntervalMicroSeconds( 0 ));
+                                iMovie.VideoClipSetCutOutTime( 0, iDuration );
+                                }
+
+                            if ( iSeekPos.Int64() > 0 )
+                                {
+                                iSeekEvent = ETrue;
+                                iLastKeyLeftOrRight = ETrue;
+                                // Process the command only when repeat count is zero.
+                                iKeyRepeatCount++;
+
+
+                                TInt adjustment = TimeIncrement( iKeyRepeatCount );
+
+                                TInt64 newPos = iSeekPos.Int64() - adjustment;
+                                if ( newPos < 0 )
+                                    {
+                                    newPos = 0;
+                                    }
+                                iSeekPos = TTimeIntervalMicroSeconds( newPos );
+
+                                TTimeIntervalMicroSeconds endTime( 0 );
+                                iMovie.GetDurationEstimateL( iMaxMmsSize, newPos, endTime );
+
+                                iSeekEndPos = endTime;
+
+                                iCutterBar->SetInPoint( iSeekPos );
+                                iCutterBar->SetOutPoint( endTime );
+                                }
+                            return EKeyWasConsumed;
+                            }
+                        //
+                        // Default
+                        //
+                    default:
+                            {
+                            return EKeyWasNotConsumed;
+                            }
+                        }
+                    }
+                //
+                // Key up event
+                //
+
+            case EEventKeyUp:
+                    {
+                    iKeyRepeatCount = 0;
+                    if ( iPreviewState == EPlaying )
+                        {
+                        iView.SetTrimStateL( CVeiTrimForMmsView::ESeek );
+
+                        Stop( ETrue );
+                        return EKeyWasConsumed;
+                        }
+                    else
+                        {
+                        if ( iLastKeyLeftOrRight )
+                            {
+                            iView.ProcessNeeded( ETrue );
+                            iMovie.VideoClipSetCutInTime( 0, iSeekPos );
+                            iMovie.VideoClipSetCutOutTime( 0, iSeekEndPos );
+                            iView.UpdateNaviPaneL( iMovie.GetSizeEstimateL() / 1024, iMovie.Duration());
+                            iLastKeyLeftOrRight = EFalse;
+                            if ( iSeekEvent )
+                                {
+                                StartFrameTakerL( iClipIndex );
+                                iSeekEvent = EFalse;
+                                }
+                            return EKeyWasConsumed;
+                            }
+                        }
+                    break;
+                    }
+                //
+                // Default
+                //
+            default:
+                return EKeyWasNotConsumed;
+            }
+    } //iKeyEnable
+    return EKeyWasNotConsumed;
+    }
+
+
+TInt CVeiTrimForMmsContainer::TimeIncrement( TInt aKeyCount )const
+    {
+    if ( aKeyCount < 3 )
+        {
+        return 100000;
+        }
+    else if ( aKeyCount < 6 )
+    // 4
+        {
+        return 300000;
+        }
+    else if ( aKeyCount < 9 )
+    // 5
+        {
+        return 500000;
+        }
+    else if ( aKeyCount < 12 )
+    // 10
+        {
+        return 1000000;
+        }
+    else if ( aKeyCount < 15 )
+    // 13
+        {
+        return 2000000;
+        }
+    else if ( aKeyCount < 18 )
+    // 15
+        {
+        return 3000000;
+        }
+    else
+        {
+        return 5000000;
+        }
+    }
+
+
+void CVeiTrimForMmsContainer::NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo )
+    {
+    switch ( aEvent )
+        {
+        case MVeiVideoDisplayObserver::EOpenComplete: 
+            {
+            iVideoDisplay->SetRect( iPreviewRect );
+            if ( !VideoEditorUtils::IsLandscapeScreenOrientation())
+            //Portrait
+                {
+                iVideoDisplay->SetRotationL( EVideoRotationClockwise90 );
+                }
+            iPreviewState = ELoading;
+
+            iVideoDisplay->SetPositionL( CutInTime());
+            iVideoDisplay->PlayL( iMovie.VideoClipInfo( iClipIndex )->FileName(), CutInTime(), CutOutTime());
+
+            break;
+            }
+
+        case MVeiVideoDisplayObserver::ELoadingComplete: 
+            {
+
+            iVideoDisplay->MakeVisible( ETrue );
+            iPreviewState = EPlaying;
+            break;
+            }
+
+        case MVeiVideoDisplayObserver::EStop: 
+            {
+            iPreviewState = EIdle;
+            iView.SetTrimStateL( CVeiTrimForMmsView::ESeek );
+
+            iVideoDisplay->MakeVisible( EFalse );
+
+            DrawDeferred();
+            break;
+            }
+        case MVeiVideoDisplayObserver::EPlayComplete: 
+            {
+            iView.SetTrimStateL( CVeiTrimForMmsView::ESeek );
+            Stop( ETrue );
+            if ( KErrNoMemory == aInfo )
+                {
+                iView.ShowGlobalErrorNoteL( KErrNoMemory );
+                }
+            break;
+            }
+        default:
+                {
+                break;
+                }
+        }
+    }
+
+
+/**
+ * Called to notify that a new video clip has been successfully
+ * added to the movie. Note that the indices and the start and end times
+ * of the video clips after the new clip have also changed as a result.
+ * Note that the transitions may also have changed. 
+ *
+ * @param aMovie  movie
+ * @param aIndex  index of video clip in movie
+ */
+void CVeiTrimForMmsContainer::NotifyVideoClipAdded( CVedMovie& aMovie, TInt aIndex )
+    {
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsContainer::NotifyVideoClipAdded: in" );
+
+    iSeekPos = TTimeIntervalMicroSeconds( 0 );
+
+    aMovie.GetDurationEstimateL( iMaxMmsSize, iSeekPos, iSeekEndPos );
+    LOGFMT3( KVideoEditorLogFile, "CVeiTrimForMmsContainer::NotifyVideoClipAdded: 1, iMaxMmsSize:%d, iSeekPos:%Ld, iSeekEndPos:%Ld", iMaxMmsSize, iSeekPos.Int64(), iSeekEndPos.Int64());
+
+    iCutterBar->SetInPoint( iSeekPos );
+    iCutterBar->SetOutPoint( iSeekEndPos );
+    iCutterBar->SetTotalDuration( aMovie.Duration());
+    iDuration = aMovie.Duration();
+
+    iClipIndex = aIndex;
+
+    aMovie.VideoClipSetCutInTime( 0, iSeekPos );
+    aMovie.VideoClipSetCutOutTime( 0, iSeekEndPos );
+
+    TInt movieSizeLimit = static_cast < TInt > ( iMaxMmsSize* 0.9 );
+    aMovie.SetMovieSizeLimit( movieSizeLimit );
+
+    LOGFMT( KVideoEditorLogFile, "CVeiTrimForMmsContainer::NotifyVideoClipAdded(): 2, movie size set to:%d", movieSizeLimit );
+
+    StartFrameTakerL( iClipIndex );
+
+    iSeekEvent = EFalse;
+
+
+    iView.UpdateNaviPaneL( iMovie.GetSizeEstimateL() / 1024, iMovie.Duration());
+
+    iKeyEnable = ETrue;
+
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsContainer::NotifyVideoClipAdded: out" );
+    }
+
+
+void CVeiTrimForMmsContainer::NotifyVideoClipAddingFailed( CVedMovie& /*aMovie*/, TInt /*aError*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyVideoClipRemoved( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyVideoClipIndicesChanged( CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, TInt /*aNewIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyVideoClipTimingsChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyVideoClipColorEffectChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyVideoClipAudioSettingsChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyVideoClipGeneratorSettingsChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyVideoClipDescriptiveNameChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyStartTransitionEffectChanged( CVedMovie& /*aMovie*/ ){}
+
+
+void CVeiTrimForMmsContainer::NotifyMiddleTransitionEffectChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyEndTransitionEffectChanged( CVedMovie& /*aMovie*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyAudioClipAdded( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyAudioClipAddingFailed( CVedMovie& /*aMovie*/, TInt /*aError*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyAudioClipRemoved( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyAudioClipIndicesChanged( CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, TInt /*aNewIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyAudioClipTimingsChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyMovieQualityChanged( CVedMovie& /*aMovie*/
+ ){}
+
+
+void CVeiTrimForMmsContainer::NotifyMovieReseted( CVedMovie& /*aMovie*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyMovieOutputParametersChanged( CVedMovie& /*aMovie*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyAudioClipDynamicLevelMarkInserted( CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyAudioClipDynamicLevelMarkRemoved( CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyVideoClipDynamicLevelMarkInserted( CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/ ){}
+
+void CVeiTrimForMmsContainer::NotifyVideoClipDynamicLevelMarkRemoved( CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/ ){}
+
+void CVeiTrimForMmsContainer::PlayL( const TDesC& aFilename, const TRect& aRect )
+    {
+    iCutterBar->MakeVisible( EFalse );
+    iVideoDisplayStart->MakeVisible( EFalse );
+    iVideoDisplayEnd->MakeVisible( EFalse );
+    iVideoDisplay->MakeVisible( EFalse );
+
+    iVideoDisplay->ShowBlackScreen();
+
+    iPreviewRect = aRect;
+    iBlack = ETrue;
+    if ( !iScreenLight->IsActive())
+        {
+        iScreenLight->Start();
+        }
+
+
+    iPreviewState = EOpeningFile;
+    iVideoDisplay->OpenFileL( aFilename );
+    }
+
+void CVeiTrimForMmsContainer::Stop( TBool aCloseStream )
+    {
+    iCutterBar->MakeVisible( ETrue );
+    iVideoDisplayStart->MakeVisible( ETrue );
+    iVideoDisplayEnd->MakeVisible( ETrue );
+    iBlack = EFalse;
+    iScreenLight->Stop();
+    iVideoDisplay->Stop( aCloseStream );
+    DrawNow();
+    }
+
+void CVeiTrimForMmsContainer::PauseL()
+    {
+    iPreviewState = EPause;
+    iVideoDisplay->PauseL();
+    iVideoDisplay->MakeVisible( EFalse );
+    DrawNow();
+    }
+
+TInt CVeiTrimForMmsContainer::PreviewState()const
+    {
+    return iPreviewState;
+    }
+
+void CVeiTrimForMmsContainer::NotifyFramesCompleted( CFbsBitmap* aFirstFrame, 
+                                                     CFbsBitmap* aLastFrame, 
+                                                     CFbsBitmap*  /*aTimelineFrame*/, 
+                                                     TInt aError )
+    {
+    if ( aError == KErrNone )
+        {
+        iVideoDisplayStart->ShowPictureL( *aFirstFrame );
+        iVideoDisplayEnd->ShowPictureL( *aLastFrame );
+        }
+
+    if ( iProgressNote )
+        {
+        iProgressInfo->SetAndDraw( 100 );
+        iProgressNote->ProcessFinishedL();
+        }
+    }
+
+void CVeiTrimForMmsContainer::StartFrameTakerL( TInt aIndex )
+    {
+    iProgressNote = new( ELeave )CAknProgressDialog( REINTERPRET_CAST( CEikDialog** , &iProgressNote ), ETrue );
+    iProgressNote->SetCallback( this );
+    iProgressNote->ExecuteDlgLD( R_VEI_PROGRESS_NOTE );
+
+    HBufC* stringholder;
+    stringholder = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_PROCESSING, iEikonEnv );
+    CleanupStack::PushL( stringholder );
+    iProgressNote->SetTextL( *stringholder );
+    CleanupStack::PopAndDestroy( stringholder );
+
+    iProgressInfo = iProgressNote->GetProgressInfoL();
+    iProgressInfo->SetFinalValue( 100 );
+    iProgressInfo->SetAndDraw( 50 );
+
+    // First frame is shown in main display so it is bigger.. Last frame is always
+    // on transition display and one frame for the video timeline.
+    TSize firstThumbResolution = iVideoDisplayStart->GetScreenSize();
+    TSize lastThumbResolution = iVideoDisplayEnd->GetScreenSize();
+    TSize timelineThumbResolution = TSize( 34, 28 );
+
+    TInt frameCount = iMovie.VideoClipInfo( aIndex )->VideoFrameCount();
+
+    TInt firstThumbNailIndex = iMovie.VideoClipInfo( aIndex )->GetVideoFrameIndexL( CutInTime());
+    TInt lastThumbNailIndex = iMovie.VideoClipInfo( aIndex )->GetVideoFrameIndexL( CutOutTime());
+    if ( lastThumbNailIndex >= frameCount )
+        {
+        lastThumbNailIndex = frameCount - 1;
+        }
+
+
+    iFrameTaker->GetFramesL( *iMovie.VideoClipInfo( aIndex ), 
+                             firstThumbNailIndex, 
+                             &firstThumbResolution, 
+                             lastThumbNailIndex, 
+                             &lastThumbResolution, 
+                             firstThumbNailIndex, 
+                             &timelineThumbResolution, 
+                             EPriorityLow );
+    }
+
+TTypeUid::Ptr CVeiTrimForMmsContainer::MopSupplyObject( TTypeUid aId )
+    {
+    if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext )
+        {
+        return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+        }
+    return CCoeControl::MopSupplyObject( aId );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/ManualVideoEditor/src/VeiTrimForMmsView.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,876 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+// INCLUDES
+// System includes
+#include <aknviewappui.h>
+#include <akntitle.h>
+#include <aknnavi.h>        // CAknNavigationControlContainer
+#include <aknnavide.h>      // CAknNavigationDecorator
+#include <AknProgressDialog.h>      // CAknProgressDialog
+#include <aknsoundsystem.h>         // CAknKeySoundSystem
+#include <bautils.h>        // BaflUtils
+#include <barsread.h>
+#include <eikprogi.h>       // CEikProgressInfo
+#include <manualvideoeditor.rsg>
+#include <utf.h>        // CnvUtfConverter
+#include <sendui.h>     // CSendAppUi
+#include <SenduiMtmUids.h>
+#include <StringLoader.h>   // StringLoader 
+#include <CMessageData.h>
+// User includes
+#include "Manualvideoeditor.hrh"
+#include "VeiAppUi.h"
+#include "VeiSettings.h"
+#include "VeiTrimForMmsView.h"
+#include "VeiTrimForMmsContainer.h"
+#include "VeiEditVideoLabelNavi.h"
+#include "VideoEditorCommon.h"
+#include "VeiTempMaker.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorDebugUtils.h"
+#include "VeiErrorUi.h"
+
+// CONSTANTS
+const TInt KVedVideoClipIndex( 0 );
+const TInt KProgressNoteMaxValue( 100 );
+const TInt KVedTrimForMmsDefaultCba( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+
+
+CVeiTrimForMmsView* CVeiTrimForMmsView::NewL( CSendUi& aSendAppUi )
+    {
+    CVeiTrimForMmsView* self = CVeiTrimForMmsView::NewLC( aSendAppUi );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+CVeiTrimForMmsView* CVeiTrimForMmsView::NewLC( CSendUi& aSendAppUi )
+    {
+    CVeiTrimForMmsView* self = new( ELeave )CVeiTrimForMmsView( aSendAppUi );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVeiTrimForMmsView::ConstructL
+// Symbian 2nd phase constructor that can leave.
+// -----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::ConstructL()
+    {
+    BaseConstructL( R_VEI_TRIM_FOR_MMS_VIEW );
+
+    iErrorUi = CVeiErrorUI::NewL( *iCoeEnv );
+
+    iTempMaker = CVeiTempMaker::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVeiTrimForMmsView::CVeiTrimForMmsView( CSendUi& aSendAppUi )
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+CVeiTrimForMmsView::CVeiTrimForMmsView( CSendUi& aSendAppUi ): iSendAppUi( aSendAppUi )
+{
+}
+
+
+CVeiTrimForMmsView::~CVeiTrimForMmsView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        }
+    if ( iNaviDecorator )
+        {
+        delete iNaviDecorator;
+        }
+
+    if ( iVedMovie )
+        {
+        iVedMovie->UnregisterMovieObserver( this );
+        delete iVedMovie;
+        }
+
+    if ( iTempMaker )
+        {
+        delete iTempMaker;
+        iTempMaker = NULL;
+        }
+    if ( iTempFile )
+        {
+        TInt err = iEikonEnv->FsSession().Delete( *iTempFile );
+        if ( err )
+            {
+            // what to do when error occurs in destructor???
+            }
+
+        delete iTempFile;
+        }
+
+    delete iErrorUi;
+
+    iProgressInfo = NULL;
+    }
+
+
+TUid CVeiTrimForMmsView::Id()const
+    {
+    return TUid::Uid( EVeiTrimForMmsView );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::HandleCommandL( TInt aCommand )
+//
+//  
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::HandleCommandL( TInt aCommand )
+    {
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::HandleCommandL: In" );
+
+    TInt state;
+    state = iContainer->PreviewState();
+
+    switch ( aCommand )
+        {
+        /**
+         * Options -> Send via multimedia
+         */
+        case EVeiCmdSendViaMms:
+                {
+                CmdSendViaMultimediaL();
+                break;
+                }
+            /**
+             * Options -> Preview
+             */
+        case EVeiCmdPreview:
+                {
+                if ( state == EIdle || state == EStop )
+                    {
+                    SetTrimStateL( EFullPreview );
+                    PlayPreviewL();
+                    }
+                break;
+                }
+            //
+            // Options -> Help
+            //
+        case EVeiCmdTrimForMmsViewHelp:
+                {
+                AppUi()->HandleCommandL( aCommand );
+                break;
+                }
+            /**
+             * Options -> Back
+             */
+        case EAknSoftkeyBack:
+                {
+                if ( state != EFullPreview )
+                    {
+                    CmdSoftkeyBackL();
+                    }
+                else
+                    {
+                    SetTrimStateL( ESeek );
+                    }
+                break;
+                }
+            /**
+             * Adjust video length -> Ok
+             */
+        case EAknSoftkeyOk:
+                {
+                if ( state == EPause )
+                    {
+                    SetTrimStateL( ESeek );
+                    iContainer->Stop( ETrue );
+                    }
+                else
+                    {
+                    CmdSoftkeyOkL();
+                    }
+                break;
+                }
+            /**
+             * Adjust video length -> Cancel
+             */
+        case EAknSoftkeyCancel:
+                {
+                if ( state == EPause )
+                    {
+                    SetTrimStateL( ESeek );
+                    iContainer->Stop( ETrue );
+                    }
+                else
+                    {
+                    CmdSoftkeyCancelL();
+                    }
+                break;
+                }
+        default:
+                {
+                AppUi()->HandleCommandL( aCommand );
+                break;
+                }
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::HandleCommandL: Out" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::CmdSendViaMultimediaL()
+//  Function for handling the Send Via Multimedia command.
+//  
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::CmdSendViaMultimediaL()
+    {
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: In" );
+
+    // Start processing the trimmed video
+    // Possible leave codes:
+    //	- KErrNoMemory if memory allocation fails
+    //	- KErrAccessDenied if the file access is denied
+    //	- KErrDiskFull if the disk is full
+    //	- KErrWrite if not all data could be written
+    //	- KErrBadName if the filename is bad
+    //  - KErrDirFull if the directory is full
+    // : If video clip is already processed and frame is in same position
+    //       do not reprocess the movie.
+
+
+    UpdateNaviPaneSize();
+
+    TBool fileExists( ETrue );
+    RFs& fs = iEikonEnv->FsSession();
+
+    if ( iTempFile )
+        {
+        fileExists = BaflUtils::FileExists( fs, * iTempFile );
+        }
+
+    if ( !fileExists || ( !iTempFile ) || iProcessNeeded )
+        {
+
+        if ( iTempFile && fileExists )
+            {
+            User::LeaveIfError( fs.Delete( *iTempFile ));
+            delete iTempFile;
+            iTempFile = NULL;
+            }
+
+        iTempFile = HBufC::NewL( KMaxFileName );
+
+        // @: check the quality setting. should we set it here to MMS compatible?
+
+        // Quality is taken from settings and set to engine.
+        ReadSettingsL( iMovieSaveSettings );
+
+        iTempMaker->GenerateTempFileName( *iTempFile, iMovieSaveSettings.MemoryInUse(), iVedMovie->Format());
+
+        TEntry fileinfo;
+        // Rename movie from xxxx.$$$ to defaultfilename from settingsview.
+        // looks better in attachment list..
+
+        // Get default movie name from settings view
+        TPtr temppeet = iTempFile->Des();
+        TParse parse;
+
+        parse.Set( iMovieSaveSettings.DefaultVideoName(), &temppeet, NULL );
+
+        TFileName orgPathAndName = parse.FullName();
+
+        //		TVedVideoFormat movieQuality = iVedMovie->Format();
+
+        orgPathAndName.Replace( orgPathAndName.Length() - 4, 4, KExt3gp );
+
+        fs.Replace( *iTempFile, orgPathAndName );
+        iTempFile->Des() = orgPathAndName;
+        fs.Entry( *iTempFile, fileinfo );
+
+
+        iVedMovie->SetQuality( CVedMovie::EQualityMMSInteroperability );
+        LOGFMT( KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: 1, iTempFile:%S", iTempFile );
+        TRAPD( processError, iVedMovie->ProcessL( *iTempFile, * this ));
+        LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: 2" );
+        if ( processError == KErrNone )
+            {
+            // Text for the progress note is loaded from TBUF resource
+            HBufC* noteText;
+            noteText = StringLoader::LoadLC( R_VED_PROCESSING_FOR_MMS, iEikonEnv );
+
+            // Construct and execute progress note.
+            iProgressNote = new( ELeave )CAknProgressDialog( REINTERPRET_CAST( CEikDialog** , &iProgressNote ), ETrue );
+            iProgressNote->PrepareLC( R_VEI_PROGRESS_NOTE );
+            iProgressNote->SetTextL( *noteText );
+
+            iProgressInfo = iProgressNote->GetProgressInfoL();
+            iProgressInfo->SetFinalValue( KProgressNoteMaxValue );
+
+            iProgressNote->RunLD();
+
+            CleanupStack::PopAndDestroy( noteText ); // Pop and destroy the text
+            }
+        else
+            {
+            // : add error handling here
+            }
+
+        }
+    else
+        {
+
+        RFs shareFServer;
+        LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: shareFServer connect." );
+
+        User::LeaveIfError( shareFServer.Connect());
+        shareFServer.ShareProtected();
+
+        RFile openFileHandle;
+
+        TInt err = openFileHandle.Open( shareFServer, * iTempFile, EFileRead | EFileShareReadersOnly );
+        if ( KErrNone != err )
+            {
+            LOGFMT( KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: Could not open file %S with EFileShareReadersOnly. Trying EFileShareAny", iTempFile );
+            User::LeaveIfError( openFileHandle.Open( shareFServer, * iTempFile, EFileRead | EFileShareAny ));
+            }
+
+        CMessageData* messageData = CMessageData::NewLC();
+
+
+        messageData->AppendAttachmentHandleL( openFileHandle );
+
+        iSendAppUi.CreateAndSendMessageL( KSenduiMtmMmsUid, messageData, KNullUid, EFalse );
+
+        CleanupStack::PopAndDestroy( messageData );
+
+        shareFServer.Close();
+        LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: shareFServer closed." );
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: Out" );
+    }
+
+void CVeiTrimForMmsView::CmdSoftkeyBackL()
+    {
+    // Compare previous view's application uid to video editor uid.
+    if ( iPreviousViewId.iAppUid == KUidVideoEditor )
+        {
+        CEikStatusPane* statusPane = AppUi()->StatusPane();
+        TUid naviPaneUid = TUid::Uid( EEikStatusPaneUidNavi ); // Navi pane UID
+
+        CAknNavigationControlContainer* naviContainer = ( CAknNavigationControlContainer* )statusPane->ControlL( naviPaneUid );
+        naviContainer->Pop( iNaviDecorator );
+
+        // Activate previous local view.
+        AppUi()->ActivateLocalViewL( iPreviousViewId.iViewUid );
+        }
+    else
+        {
+        // Exit video editor
+        AppUi()->HandleCommandL( EEikCmdExit );
+        }
+    }
+
+
+void CVeiTrimForMmsView::CmdSoftkeyOkL()
+    {
+    // Set CBA labels back to view default
+    Cba()->SetCommandSetL( KVedTrimForMmsDefaultCba );
+    Cba()->DrawDeferred();
+
+    PushKeySoundL( R_VED_LEFT_RIGHT_SILENT_SKEY_LIST );
+    }
+
+
+void CVeiTrimForMmsView::CmdSoftkeyCancelL()
+    {
+    // Set CBA labels back to view default
+    Cba()->SetCommandSetL( KVedTrimForMmsDefaultCba );
+    Cba()->DrawDeferred();
+
+    PushKeySoundL( R_VED_LEFT_RIGHT_SILENT_SKEY_LIST );
+    }
+
+
+void CVeiTrimForMmsView::DoActivateL( const TVwsViewId& aPrevViewId, 
+                                      TUid  /*aCustomMessageId*/, 
+                                      const TDesC8& aCustomMessage )
+    {
+    if ( !iContainer )
+        {
+        iPreviousViewId = aPrevViewId; // Save the previous view id
+
+        // Disable left and right navi-key sounds
+        PushKeySoundL( R_VED_LEFT_RIGHT_SILENT_SKEY_LIST );
+
+        SetTitlePaneTextL();
+        CreateNaviPaneL();
+
+        STATIC_CAST( CVeiEditVideoLabelNavi* , 
+                     iNaviDecorator->DecoratedControl())->SetState( CVeiEditVideoLabelNavi::EStateTrimForMmsView );
+
+        TFileName inputFileName;
+        CnvUtfConverter::ConvertToUnicodeFromUtf8( inputFileName, aCustomMessage );
+
+        if ( !iVedMovie )
+            {
+            iVedMovie = CVedMovie::NewL( NULL );
+            iVedMovie->RegisterMovieObserverL( this );
+            iVedMovie->InsertVideoClipL( inputFileName, KVedVideoClipIndex );
+            iVedMovie->SetQuality( CVedMovie::EQualityMMSInteroperability );
+            }
+
+        iContainer = CVeiTrimForMmsContainer::NewL( AppUi()->ClientRect(), * iVedMovie, * this );
+        iContainer->SetMopParent( this );
+
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    }
+
+
+void CVeiTrimForMmsView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        iContainer = NULL;
+
+        if ( iVedMovie )
+            {
+            iVedMovie->Reset();
+            iVedMovie->UnregisterMovieObserver( this );
+            delete iVedMovie;
+            iVedMovie = NULL;
+            }
+        }
+    }
+
+
+void CVeiTrimForMmsView::PushKeySoundL( const TInt aResourceId )const
+    {
+    CAknKeySoundSystem* aknKeySoundSystem = AppUi()->KeySounds();
+    aknKeySoundSystem->PushContextL( aResourceId );
+    }
+
+
+void CVeiTrimForMmsView::PopKeySound()const
+    {
+    AppUi()->KeySounds()->PopContext();
+    }
+
+
+void CVeiTrimForMmsView::SetTitlePaneTextL()const
+    {
+    TUid titleUid;
+    titleUid.iUid = EEikStatusPaneUidTitle;
+
+    CEikStatusPane* statusPane = AppUi()->StatusPane();
+
+    CEikStatusPaneBase::TPaneCapabilities titlePaneCap = statusPane->PaneCapabilities( titleUid );
+
+    if ( titlePaneCap.IsPresent() && titlePaneCap.IsAppOwned())
+        {
+        CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( titleUid );
+
+        TResourceReader reader;
+        iCoeEnv->CreateResourceReaderLC( reader, R_VEI_TRIM_FOR_MMS_VIEW_TITLE_NAME );
+        titlePane->SetFromResourceL( reader );
+
+        CleanupStack::PopAndDestroy(); //reader
+        }
+
+    }
+
+
+void CVeiTrimForMmsView::CreateNaviPaneL()
+    {
+    TUid naviPaneUid = TUid::Uid( EEikStatusPaneUidNavi ); // Navi pane UID
+
+    CEikStatusPane* statusPane = AppUi()->StatusPane(); // Get status pane
+
+    CEikStatusPaneBase::TPaneCapabilities naviPaneCap = statusPane->PaneCapabilities( naviPaneUid );
+
+    if ( naviPaneCap.IsPresent() && naviPaneCap.IsAppOwned())
+        {
+        CAknNavigationControlContainer* naviContainer = ( CAknNavigationControlContainer* )statusPane->ControlL( naviPaneUid );
+
+        CVeiEditVideoLabelNavi* editvideolabelnavi = CVeiEditVideoLabelNavi::NewLC();
+        editvideolabelnavi->SetState( CVeiEditVideoLabelNavi::EStateInitializing );
+
+        iNaviDecorator = CAknNavigationDecorator::NewL( naviContainer, editvideolabelnavi, CAknNavigationDecorator::ENotSpecified );
+        CleanupStack::Pop( editvideolabelnavi );
+
+        iNaviDecorator->SetContainerWindowL( *naviContainer );
+        iNaviDecorator->MakeScrollButtonVisible( EFalse );
+
+        naviContainer->PushL( *iNaviDecorator );
+
+        }
+    }
+
+void CVeiTrimForMmsView::UpdateNaviPaneSize()
+    {
+    if ( iContainer )
+        {
+        iVedMovie->VideoClipSetCutInTime( KVedVideoClipIndex, iContainer->CutInTime());
+        iVedMovie->VideoClipSetCutOutTime( KVedVideoClipIndex, iContainer->CutOutTime());
+        }
+    }
+
+void CVeiTrimForMmsView::SetNaviPaneSizeLabelL( const TInt& aSizeInBytes )
+    {
+    STATIC_CAST( CVeiEditVideoLabelNavi* , iNaviDecorator->DecoratedControl())->SetSizeLabelL( aSizeInBytes );
+    }
+
+
+void CVeiTrimForMmsView::SetNaviPaneDurationLabelL( const TTimeIntervalMicroSeconds& aTime )
+    {
+    STATIC_CAST( CVeiEditVideoLabelNavi* , iNaviDecorator->DecoratedControl())->SetDurationLabelL( aTime.Int64());
+    }
+
+void CVeiTrimForMmsView::UpdateNaviPaneL( const TInt& aSizeInBytes, const TTimeIntervalMicroSeconds& aTime )
+    {
+    TInt maxMmsSize = STATIC_CAST( CVeiEditVideoLabelNavi* , iNaviDecorator->DecoratedControl())->GetMaxMmsSize();
+
+    // Navipanes MMS icon control. 
+    if ( aSizeInBytes < maxMmsSize )
+        {
+        STATIC_CAST( CVeiEditVideoLabelNavi* , iNaviDecorator->DecoratedControl())->SetMmsAvailableL( ETrue );
+        }
+    else
+        {
+        STATIC_CAST( CVeiEditVideoLabelNavi* , iNaviDecorator->DecoratedControl())->SetMmsAvailableL( EFalse );
+        }
+
+    STATIC_CAST( CVeiEditVideoLabelNavi* , iNaviDecorator->DecoratedControl())->SetSizeLabelL( aSizeInBytes );
+
+    STATIC_CAST( CVeiEditVideoLabelNavi* , iNaviDecorator->DecoratedControl())->SetDurationLabelL( aTime.Int64());
+    }
+
+void CVeiTrimForMmsView::HandleResourceChange( TInt aType )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiTrimForMmsView::HandleResourceChange() In, aType:%d", aType );
+
+    if ( KAknsMessageSkinChange == aType && iNaviDecorator )
+        {
+        // Handle skin change in the navi label controls - they do not receive 
+        // it automatically since they are not in the control stack
+        CCoeControl* navi = iNaviDecorator->DecoratedControl();
+        if ( navi )
+            {
+            navi->HandleResourceChange( aType );
+            }
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::HandleResourceChange() Out" );
+    }
+
+// ============= MVedMovieProcessingObserver FUNCTIONS START ==================
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::NotifyMovieProcessingStartedL( CVedMovie& aMovie )
+//
+// Called to notify that a new movie processing operation has been started.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::NotifyMovieProcessingStartedL( CVedMovie&  /*aMovie*/ ){}
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::NotifyMovieProcessingProgressed( CVedMovie& aMovie,
+//                                                      TInt aPercentage )
+//
+// Called to inform about the current progress of the movie processing
+// operation.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::NotifyMovieProcessingProgressed( CVedMovie&  /*aMovie*/, TInt aPercentage )
+    {
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingProgressed(): In" );
+
+    // Increment the progress bar.
+    iProgressInfo->SetAndDraw( aPercentage );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::NotifyMovieProcessingCompleted( CVedMovie& aMovie,
+//                                                     TInt aError )
+//
+// Called to notify that the movie processing operation has been completed.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::NotifyMovieProcessingCompleted( CVedMovie&  /*aMovie*/, TInt aError )
+    {
+    LOGFMT( KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingCompleted(): In, aError:%d", aError );
+
+    if ( !aError )
+        {
+        ProcessNeeded( EFalse );
+        }
+
+    __ASSERT_ALWAYS( iProgressNote, User::Panic( _L( "CVeiTrimForMmsView" ), 1 ) );
+
+    // Draw the progress bar to 100%.
+    iProgressInfo->SetAndDraw( 100 );
+
+    // Delete the note.
+    TRAP_IGNORE( iProgressNote->ProcessFinishedL());
+
+    RFs shareFServer;
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingCompleted: shareFServer connect." );
+
+    User::LeaveIfError( shareFServer.Connect());
+    shareFServer.ShareProtected();
+
+    RFile openFileHandle;
+
+    TInt err = openFileHandle.Open( shareFServer, * iTempFile, EFileRead | EFileShareReadersOnly );
+    if ( KErrNone != err )
+        {
+        LOGFMT( KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingCompleted: Could not open file %S with EFileShareReadersOnly. Trying EFileShareAny", iTempFile );
+        User::LeaveIfError( openFileHandle.Open( shareFServer, * iTempFile, EFileRead | EFileShareAny ));
+        }
+
+    CMessageData* messageData = CMessageData::NewLC();
+    messageData->AppendAttachmentHandleL( openFileHandle );
+
+    iSendAppUi.CreateAndSendMessageL( KSenduiMtmMmsUid, messageData, KNullUid, EFalse );
+
+    CleanupStack::PopAndDestroy( messageData );
+
+    shareFServer.Close();
+
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingCompleted: shareFServer closed." );
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingCompleted(): Out" );
+    }
+
+// ============== MVedMovieProcessingObserver FUNCTIONS END ===================
+
+
+/**
+ * Called to notify that a new video clip has been successfully
+ * added to the movie. Note that the indices and the start and end times
+ * of the video clips after the new clip have also changed as a result.
+ * Note that the transitions may also have changed. 
+ *
+ * @param aMovie  movie
+ * @param aIndex  index of video clip in movie
+ */
+void CVeiTrimForMmsView::NotifyVideoClipAdded( CVedMovie&  /*aMovie*/, TInt  /*aIndex*/ )
+    {
+    ProcessNeeded( ETrue );
+    }
+
+
+/**
+ * Called to notify that adding a new video clip to the movie has failed.
+ *
+ * Possible error codes:
+ *	- <code>KErrNotFound</code> if there is no file with the specified name
+ *    in the specified directory (but the directory exists)
+ *	- <code>KErrPathNotFound</code> if the specified directory
+ *    does not exist
+ *	- <code>KErrUnknown</code> if the specified file is of unknown format
+ *	- <code>KErrNotSupported</code> if the format of the file is recognized but
+ *    adding it to the movie is not supported (e.g., it is of different resolution
+ *    or format than the other clips)
+ *
+ * @param aMovie  movie
+ * @param aError  one of the system wide error codes
+ */
+void CVeiTrimForMmsView::NotifyVideoClipAddingFailed( CVedMovie&  /*aMovie*/, TInt /*aError*/ )
+    {
+    User::Panic( _L( "MmsView" ), 20 );
+    }
+
+
+void CVeiTrimForMmsView::NotifyVideoClipRemoved( CVedMovie&  /*aMovie*/, TInt  /*aIndex*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyVideoClipIndicesChanged( CVedMovie&  /*aMovie*/, TInt /*aOldIndex*/, TInt /*aNewIndex*/ ){}
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::NotifyVideoClipTimingsChanged( CVedMovie& aMovie, 
+//                                                    TInt aIndex )
+//
+// Called to notify that the timings (that is, the cut in or cut out time or
+// the speed and consequently the end time, edited duration, and possibly audio
+// settings) of a video clip have changed (but the index of the clip has 
+// not changed). Note that the start and end times of the video clips 
+// after the changed clip have also changed.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::NotifyVideoClipTimingsChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+    {
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyVideoClipTimingsChanged()" );
+    }
+
+
+void CVeiTrimForMmsView::NotifyVideoClipColorEffectChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyVideoClipAudioSettingsChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyVideoClipGeneratorSettingsChanged( CVedMovie&  /*aMovie*/, TInt /*aIndex*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyVideoClipDescriptiveNameChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyStartTransitionEffectChanged( CVedMovie& /*aMovie*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyMiddleTransitionEffectChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyEndTransitionEffectChanged( CVedMovie& /*aMovie*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyAudioClipAdded( CVedMovie& /*aMovie*/, TInt  /*aIndex*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyAudioClipAddingFailed( CVedMovie& /*aMovie*/, TInt /*aError*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyAudioClipRemoved( CVedMovie& /*aMovie*/, TInt  /*aIndex*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyAudioClipIndicesChanged( CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, TInt /*aNewIndex*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyAudioClipTimingsChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ ){}
+
+
+void CVeiTrimForMmsView::NotifyMovieQualityChanged( CVedMovie& /*aMovie*/ ){}
+
+void CVeiTrimForMmsView::NotifyMovieReseted( CVedMovie& /*aMovie*/ ){}
+
+void CVeiTrimForMmsView::NotifyMovieOutputParametersChanged( CVedMovie& /*aMovie*/ ){}
+
+void CVeiTrimForMmsView::NotifyAudioClipDynamicLevelMarkInserted( CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/ ){}
+
+void CVeiTrimForMmsView::NotifyAudioClipDynamicLevelMarkRemoved( CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/ ){}
+
+void CVeiTrimForMmsView::NotifyVideoClipDynamicLevelMarkInserted( CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/ ){}
+
+void CVeiTrimForMmsView::NotifyVideoClipDynamicLevelMarkRemoved( CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/ ){}
+
+void CVeiTrimForMmsView::PlayPreviewL()
+    {
+    TRect rect( AppUi()->ApplicationRect());
+    iContainer->SetRect( rect );
+
+    iContainer->PlayL( iVedMovie->VideoClipInfo( 0 )->FileName(), rect );
+    }
+
+void CVeiTrimForMmsView::HandleStatusPaneSizeChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( AppUi()->ClientRect());
+        }
+
+    }
+
+void CVeiTrimForMmsView::SetTrimStateL( TTrimState aState )
+    {
+    iTrimState = aState;
+    CEikStatusPane* statusPane;
+    CAknTitlePane* titlePane;
+
+    TResourceReader reader1;
+
+    switch ( iTrimState )
+        {
+        case EFullPreview:
+
+            Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
+            Cba()->DrawDeferred();
+
+            break;
+
+        case ESeek:
+            iContainer->SetRect( AppUi()->ClientRect());
+            statusPane = (( CAknAppUi* )iEikonEnv->EikAppUi())->StatusPane();
+
+            titlePane = ( CAknTitlePane* )statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ));
+            iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_TRIM_FOR_MMS_VIEW_TITLE_NAME );
+            titlePane->SetFromResourceL( reader1 );
+            CleanupStack::PopAndDestroy(); //reader1
+
+            Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+            Cba()->DrawDeferred();
+
+            break;
+
+        default:
+                {
+                break;
+                }
+
+        }
+    }
+
+void CVeiTrimForMmsView::DialogDismissedL( TInt aButtonId )
+    {
+    if ( aButtonId != EAknSoftkeyDone )
+        {
+        iVedMovie->CancelProcessing();
+        }
+    iProgressInfo = NULL;
+    }
+
+void CVeiTrimForMmsView::ProcessNeeded( TBool aProcessNeed )
+    {
+    iProcessNeeded = aProcessNeed;
+    }
+
+void CVeiTrimForMmsView::ShowGlobalErrorNoteL( const TInt aError )const
+    {
+    iErrorUi->ShowGlobalErrorNote( aError );
+    }
+
+//=============================================================================
+void CVeiTrimForMmsView::ReadSettingsL( TVeiSettings& aSettings )const
+    {
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::ReadSettingsL: in" );
+
+    STATIC_CAST( CVeiAppUi* , AppUi())->ReadSettingsL( aSettings );
+
+    LOG( KVideoEditorLogFile, "CVeiTrimForMmsView::ReadSettingsL: out" );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/data/VedSimpleCutVideo.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,694 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+//  RESOURCE IDENTIFIER
+NAME    VSCV // 4 letter ID
+
+//  INCLUDES
+
+#include <eikon.rh>
+#include "VedSimpleCutVideo.hrh"
+
+#include <SimpleVideoEditor.loc>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <e32keys.h>			// Key codes
+#include <CommonDialogs.rh>		// avkon.loc is NOT included in this file if
+#include <avkon.loc>			
+#include <CommonDialogs.hrh>
+#include <appinfo.rh>
+#include <data_caging_paths_strings.hrh>
+#include <AvkonIcons.hrh>
+
+
+//  RESOURCE DEFINITIONS 
+
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf="svcut"; }
+
+RESOURCE EIK_APP_INFO
+    {
+	cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT;	   
+    }
+
+RESOURCE LOCALISABLE_APP_INFO r_vsc_localisable_app_info
+	{
+	short_caption=" ";
+	caption_and_icon =
+	CAPTION_AND_ICON_INFO
+		{
+		caption=" ";
+		};
+	}
+//----------------------------------------------------
+//   
+//    r_vei_hotkeys
+//
+//----------------------------------------------------
+//
+RESOURCE HOTKEYS r_vei_hotkeys
+    {
+    control=
+        {
+        HOTKEY { command=EVeiCmdCutVideoViewExit; key='e'; } 
+        };
+    }
+
+//=====================================================
+//
+//		*****		AVKON VIEWS		*****
+//
+//
+//=====================================================
+
+
+//----------------------------------------------------
+//   
+//    r_vei_cut_video
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_vei_cut_video_view
+    {
+    hotkeys=r_vei_hotkeys;
+    menubar=r_vei_menubar_cut_video_view;  
+    cba=R_AVKON_SOFTKEYS_SELECTION_LIST;    
+    }
+
+
+//=====================================================
+//
+//		*****		MENU BARS		*****
+//
+//
+//=====================================================
+
+
+//-----------------------------------------------------
+//				
+//    r_vei_menubar_cut_video_view
+//    ?description
+//
+//----------------------------------------------------
+//
+
+RESOURCE MENU_BAR r_vei_menubar_cut_video_view
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_vei_cut_video_view_menu; }
+        };
+    }
+
+
+//-----------------------------------------------------
+//				
+//    r_vei_menubar_cut_video_view_context
+//    ?description
+//
+//----------------------------------------------------
+//
+
+RESOURCE MENU_BAR r_vei_menubar_cut_video_view_context
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_vei_cut_video_view_context_menu; }
+        };
+    }
+// <msk> end
+
+
+//=====================================================
+//
+//		*****		MENU PANES		*****
+//
+//
+//=====================================================
+
+//----------------------------------------------------
+//   
+//    r_vei_cut_video_menu
+//
+//----------------------------------------------------
+//
+
+RESOURCE MENU_PANE r_vei_cut_video_view_menu
+    {
+    items=
+        {
+		MENU_ITEM { command=EVeiCmdCutVideoViewPlay;		txt=qtn_vie_options_play; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewContinue;	txt=qtn_vie_options_resume; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewPlayMarked;	txt=qtn_vie_options_play_marked; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewStop;		txt=qtn_vie_options_stop; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewMarkIn;		txt=qtn_vie_options_start_mark; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewMarkOut;		txt=qtn_vie_options_end_mark; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewClearMarks;	txt=qtn_vie_options_remove_mark; cascade = r_vei_cut_video_view_menu_clear_marks; },
+		MENU_ITEM { command=EVeiCmdCutVideoTakeSnapshot;	txt=qtn_vie_options_snapshot; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewSave;		txt=qtn_vie_options_save; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewHelp;		txt=qtn_options_help; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewExit;			txt=qtn_options_exit; } 
+        };
+    }
+//----------------------------------------------------
+//   
+//    r_vei_videos_view_menu_mark
+//    Videos view mark submenu.
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_vei_cut_video_view_menu_clear_marks
+    {
+    items=
+        {
+        MENU_ITEM { command=EVeiCmdCutVideoViewClearMarksIn;	txt=qtn_vie_options_remove_mark_start; },
+        MENU_ITEM { command=EVeiCmdCutVideoViewClearMarksOut;	txt=qtn_vie_options_remove_mark_end; },
+        MENU_ITEM { command=EVeiCmdCutVideoViewClearMarksInOut; txt=qtn_vie_options_remove_mark_both; }
+		};
+	}
+
+//----------------------------------------------------
+//   
+//    r_vei_cut_video_msk_menu
+//    ?description
+//
+//----------------------------------------------------
+//
+
+RESOURCE MENU_PANE r_vei_cut_video_view_context_menu 
+    {
+    items=
+        {
+		MENU_ITEM { command=EVeiCmdCutVideoViewContinue;	txt=qtn_vie_options_resume; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewPlayMarked;	txt=qtn_vie_options_play_marked; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewStop;		txt=qtn_vie_options_stop; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewMarkIn;		txt=qtn_vie_options_start_mark; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewMarkOut;		txt=qtn_vie_options_end_mark; },
+		MENU_ITEM { command=EVeiCmdCutVideoViewExit;		txt=qtn_options_exit; } // not in UI spec 
+        };
+    }
+
+
+//----------------------------------------------------
+//
+//  LIST QUERY (contents updated dynamically)
+//
+//----------------------------------------------------
+RESOURCE AVKON_LIST_QUERY r_vie_list_query
+{
+	items =
+	{
+		AVKON_LIST_QUERY_DLG_LINE
+		{
+			control = AVKON_LIST_QUERY_CONTROL
+			{
+				listtype = EAknCtSinglePopupMenuListBox;
+				heading = " ";
+				listbox = AVKON_LIST_QUERY_LIST
+				{
+					// array of items will be defined dynamically
+				};
+			};
+		}
+	};
+}
+
+
+
+//=====================================================
+//
+//		*****		RESOURCE DIALOGS		*****
+//
+//
+//=====================================================
+
+//----------------------------------------------------
+//
+//    r_vei_wait_note_with_cancel
+//    
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_wait_note_with_cancel
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control= AVKON_NOTE 
+                { 
+                layout = EWaitLayout;
+                imagefile = AVKON_ICON_FILE;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_vei_progress_note_with_cancel
+//    Progress note
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_progress_note_with_cancel
+	{
+	flags = EAknProgressNoteFlags;
+	buttons = R_AVKON_SOFTKEYS_CANCEL;
+	items =
+		{
+		DLG_LINE
+			{
+			type = EAknCtNote;
+			id = EGeneralNote;
+			control = AVERELL_NOTE
+				{
+				layout = EProgressLayout;
+				imagefile = AVKON_ICON_FILE;
+				imageid = EMbmAvkonQgn_note_progress;
+				imagemask = EMbmAvkonQgn_note_progress_mask;
+			};
+			}
+		};
+	}
+
+//----------------------------------------------------
+//
+//    r_vei_progress_note
+//    Progress note
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_progress_note
+	{
+	flags = EAknProgressNoteFlags;
+	buttons = R_AVKON_SOFTKEYS_EMPTY;
+	items =
+		{
+		DLG_LINE
+			{
+			type = EAknCtNote;
+			id = EGeneralNote;
+			control = AVERELL_NOTE
+				{
+				layout = EProgressLayout;
+				singular_label = qtn_vie_note_processing;
+				imagefile = AVKON_ICON_FILE;
+				imageid = EMbmAvkonQgn_note_progress;
+				imagemask = EMbmAvkonQgn_note_progress_mask;
+			};
+			}
+		};
+	}	
+
+
+//----------------------------------------------------
+//
+//    r_vie_confirmation_query
+//    Confirmation query
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vie_confirmation_query
+{
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+    {
+        DLG_LINE
+        {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+            {
+                layout = EConfirmationQueryLayout;
+                label = " ";
+            };
+        }
+    };
+}
+
+//=====================================================
+//
+//		*****		SOFTKEYS   			*****
+//
+//
+//=====================================================
+
+
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_options_back__play
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_options_back__play
+    {
+    buttons =
+        {
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyOptions; 
+        		txt = text_softkey_option;
+        		},
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyBack; 
+        		txt = text_softkey_back; 
+        		},
+        CBA_BUTTON 
+        		{
+        		id=EVeiCmdCutVideoViewPlay;
+        		txt = qtn_msk_play; 
+        		}		
+        };
+    }
+    
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_options_back__menu
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_options_back__menu
+    {
+    buttons =
+        {
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyOptions; 
+        		txt = text_softkey_option;
+        		},
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyBack; 
+        		txt = text_softkey_back; 
+        		},
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyContextOptions;
+        		txt = text_softkey_option; 
+        		}		
+        };
+    }    
+    
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_options_cut__play
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_options_cut__play
+    {
+    buttons =
+        {
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyOptions; 
+        		txt = text_softkey_option;
+        		},
+        CBA_BUTTON 
+        		{
+        		id=EVeiCmdCutVideoViewCut; 
+        		txt = qtn_vie_softkey_cut_done; 
+        		},
+        CBA_BUTTON 
+        		{
+        		id=EVeiCmdCutVideoViewPlay;
+        		txt = qtn_msk_play; 
+        		}		
+        };
+    }    
+    
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_options_cut__menu
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_options_cut__menu
+    {
+    buttons =
+        {
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyOptions; 
+        		txt = text_softkey_option;
+        		},
+        CBA_BUTTON 
+        		{
+        		id=EVeiCmdCutVideoViewCut; 
+        		txt = qtn_vie_softkey_cut_done; 
+        		},
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyContextOptions;
+        		txt = text_softkey_option; 
+        		}		
+        };
+    }    
+
+    
+//<msk> end
+
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_stop_out__menu
+//    CBA for options/out softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_stop_out__menu  //6
+    {
+    buttons =
+		{
+		CBA_BUTTON
+				{
+				id=EVeiCmdCutVideoViewStop; 
+				txt = text_softkey_stop;
+				},
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewMarkOut;
+				txt = qtn_vie_softkey_end_mark;
+				},
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyContextOptions; 
+        		txt = text_softkey_option; 
+        		}										
+		};
+    }
+
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_none_out__menu
+//    CBA for options/out softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_none_out__menu
+    {
+    buttons =
+		{
+		CBA_BUTTON
+				{
+				id=EVeiCmdCutVideoViewNone; 
+				},
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewMarkOut;
+				txt = qtn_vie_softkey_end_mark;
+				},
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyContextOptions; 
+        		txt = text_softkey_option; 
+        		}										
+		};
+    }
+
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_in_out__menu
+//    CBA for in out menu softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_in_out__menu //5 
+    {
+    buttons =
+		{
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewMarkIn; 
+				txt = qtn_vie_softkey_start_mark;
+				},
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewMarkOut;
+				txt = qtn_vie_softkey_end_mark;
+				},
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyContextOptions; 
+        		txt = text_softkey_option; 
+        		}						
+		};
+    }
+
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_in_stop__menu
+//    CBA for options/out softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_in_stop__menu  //4
+    {
+    buttons =
+		{
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewMarkIn;
+				txt = qtn_vie_softkey_start_mark;
+				},
+		CBA_BUTTON
+				{
+				id=EVeiCmdCutVideoViewStop; 
+				txt = text_softkey_stop;
+				},
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyContextOptions; 
+        		txt = text_softkey_option; 
+        		}										
+		};
+    }
+
+//----------------------------------------------------
+//   
+//    r_videoeditor_softkeys_in_none__menu
+//    CBA for options/out softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_in_none__menu
+    {
+    buttons =
+		{
+		CBA_BUTTON 
+				{
+				id = EVeiCmdCutVideoViewMarkIn;
+				txt = qtn_vie_softkey_start_mark;
+				},
+		CBA_BUTTON
+				{
+				id=EVeiCmdCutVideoViewNone; 
+				},
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyContextOptions; 
+        		txt = text_softkey_option; 
+        		}										
+		};
+    }
+
+//----------------------------------------------------
+//   
+//    r_vei_softkeys_options_out__menu
+//    CBA for options/out softkeys
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_vei_softkeys_options_out__menu 
+    {
+    buttons =
+        {
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyOptions; 
+        		txt = text_softkey_option;
+        		},
+        CBA_BUTTON 
+        		{
+    				id = EVeiCmdCutVideoViewMarkOut;
+    				txt = qtn_vie_softkey_end_mark;
+        		},
+        CBA_BUTTON 
+        		{
+        		id=EAknSoftkeyContextOptions;
+        		txt = text_softkey_option; 
+        		}
+		};
+    }
+
+
+// ============================== NOTE STRINGS ================================
+
+// Time navi pane string (formats the shown time)
+RESOURCE TBUF64  r_vei_navi_time									{ buf = "%0U/%1U";} 
+
+// 
+// PROGRESS NOTE
+//
+RESOURCE TBUF r_vei_progress_note_saving						{ buf = qtn_gen_note_saving; }
+RESOURCE TBUF r_vei_progress_note_cut							{ buf = qtn_vie_note_processing; }
+RESOURCE TBUF r_vei_progress_note_cutting_video					{ buf = qtn_fldr_file_saving_wait; }
+RESOURCE TBUF r_vei_progress_note_saving_image					{ buf = qtn_fldr_file_saving_wait; }
+RESOURCE TBUF r_vei_progress_note_processing					{ buf = qtn_vie_note_processing; }
+
+RESOURCE TBUF r_vei_not_enough_space							{ buf = qtn_memlo_not_enough_memory; }
+RESOURCE TBUF r_vei_memory_running_out							{ buf = qtn_memlo_memory_running_out; } 
+RESOURCE TBUF r_ved_mmc_not_inserted 							{ buf = qtn_vie_note_mmc_not_accessible_mass_storage; }
+RESOURCE TBUF r_vei_video_failed								{ buf = qtn_vie_note_err_edit; }
+
+RESOURCE TBUF r_vei_opening										{ buf = qtn_gen_note_opening; }
+
+// SETTINGS
+RESOURCE TBUF128 r_vei_settings_view_settings_item2_value		{ buf = qtn_vie_default_name_snapshot; }
+
+// QUERY STRINGS
+RESOURCE TBUF r_vie_query_heading_save							{ buf = qtn_vie_query_heading_save;	}
+RESOURCE TBUF r_vie_query_save_new								{ buf = qtn_vie_query_save_new;	}
+RESOURCE TBUF r_vie_query_save_replace							{ buf = qtn_vie_query_save_replace;	}
+RESOURCE TBUF r_vie_query_save_changes							{ buf = qtn_vie_query_conf_save_changes;}
+
+
+//----------------------------------------------------
+//
+//    r_wait_dialog
+//    animated progress note
+//
+//----------------------------------------------------	
+RESOURCE DIALOG r_wait_dialog
+{
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+}	
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/data/VedSimpleCutVideo_caption.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#include "VedSimpleCutVideo.loc"
+#include <apcaptionfile.rh>
+
+RESOURCE CAPTION_DATA
+{
+    caption=qtn_app_caption_string;
+    shortcaption=qtn_app_short_caption_string;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/data/VedSimpleCutVideo_reg.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#include <appinfo.rh>
+#include <VedSimpleCutVideo.rsg>
+#include <data_caging_paths_strings.hrh>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x200009DF
+
+RESOURCE APP_REGISTRATION_INFO
+	{
+	app_file="VedSimpleCutVideo";
+	localisable_resource_file = APP_RESOURCE_DIR"\\VedSimpleCutVideo";	
+	localisable_resource_id = R_VSC_LOCALISABLE_APP_INFO;	
+	hidden = KAppIsHidden;
+	embeddability = KAppEmbeddable;
+	launch = KAppLaunchInForeground;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/data/qgn_menu_ve_cxt.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="88" height="88" viewBox="0 0 88 88">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="none" width="88" height="88"/>
+<g>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M14.226,63.871c-1.643,0.616-5.108,1.973-6.092,2.365        c-1.611,0.645-1.572,2.035,1.065,2.742c0.994,0.261,49.768,13.211,52.065,13.809c2.299,0.595,4.518,0.147,5.523-0.593        c1.014-0.74,3.643-2.421,4.979-3.607c1.232-1.093-0.33-2.292-2.01-2.689c-1.682-0.401-48.792-11.771-50.708-12.236        C17.132,63.201,15.874,63.253,14.226,63.871z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M14.385,64.303c-1.366,0.509-4.264,1.644-5.228,2.03        c-1.522,0.6-1.34,1.798,0.938,2.408c2.89,0.769,49.056,13.025,51.285,13.601c2.186,0.568,4.256,0.133,5.145-0.514        c0.945-0.701,3.254-2.087,4.275-3.105c1.227-0.901-0.193-2.154-1.859-2.549c-3.424-0.827-48.34-11.667-50.001-12.07        C17.088,63.661,15.928,63.724,14.385,64.303z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M14.548,64.726c-1.098,0.413-3.421,1.326-4.364,1.704        c-1.437,0.55-1.112,1.563,0.802,2.073c4.796,1.274,48.349,12.834,50.509,13.396c2.076,0.538,3.99,0.112,4.754-0.444        c0.676-0.49,2.68-1.681,3.586-2.595c1.123-0.834-0.057-2.021-1.705-2.41c-5.17-1.249-47.892-11.559-49.294-11.896        C17.051,64.116,15.983,64.193,14.548,64.726z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M14.708,65.155c-0.822,0.31-2.577,1-3.501,1.366c-1.35,0.51-0.883,1.329,0.672,1.743        c6.694,1.779,47.635,12.649,49.731,13.192c1.963,0.509,3.732,0.091,4.375-0.371c0.5-0.369,2.08-1.507,2.885-2.098        c1.016-0.753,0.078-1.878-1.549-2.265c-6.916-1.674-47.449-11.45-48.595-11.729C17.005,64.579,16.04,64.661,14.708,65.155z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M14.867,65.583c-0.546,0.209-1.731,0.678-2.632,1.033        c-1.269,0.465-0.66,1.092,0.534,1.415c8.6,2.28,46.928,12.456,48.956,12.982c1.852,0.48,3.471,0.072,3.986-0.297        c0.334-0.246,1.564-1.131,2.191-1.588c0.908-0.689,0.219-1.74-1.393-2.13c-8.666-2.095-47.002-11.343-47.894-11.56        C16.964,65.04,16.096,65.128,14.867,65.583z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M15.028,66.017c-0.274,0.1-0.89,0.351-1.769,0.692        c-1.181,0.423-0.431,0.858,0.403,1.084c10.501,2.788,46.216,12.272,48.173,12.776c1.746,0.452,3.213,0.056,3.607-0.223        c0.162-0.122,1.045-0.752,1.49-1.083c0.807-0.616,0.357-1.604-1.238-1.988c-10.402-2.522-46.55-11.236-47.185-11.391        C16.922,65.499,16.152,65.592,15.028,66.017z"/>
+<path fill-opacity="0.06" stroke-opacity="0.06" d="M15.19,66.442c0,0-0.046,0.026-0.908,0.361c-1.093,0.379-0.202,0.628,0.271,0.752        c12.406,3.296,45.508,12.086,47.401,12.572c1.633,0.425,2.945,0.03,3.219-0.151c-0.002,0.003,0.523-0.373,0.797-0.579        c0.697-0.548,0.494-1.467-1.084-1.849C52.731,74.606,18.78,66.421,18.402,66.331C16.879,65.964,16.21,66.062,15.19,66.442z"/>
+</g>
+<g>
+<linearGradient id="XMLID_7_" gradientUnits="userSpaceOnUse" x1="41.8213" y1="19.2471" x2="51.3221" y2="56.611">
+<stop offset="0" style="stop-color:#222221"/>
+<stop offset="0.0284" style="stop-color:#4C4C4C"/>
+<stop offset="0.0535" style="stop-color:#6B6B6B"/>
+<stop offset="0.0674" style="stop-color:#777777"/>
+<stop offset="0.1348" style="stop-color:#BFBFC0"/>
+<stop offset="0.1742" style="stop-color:#FFFFFF"/>
+<stop offset="0.2584" style="stop-color:#FFFFFF"/>
+<stop offset="0.2921" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#3D3D3D"/>
+</linearGradient>
+<path fill="url(#XMLID_7_)" d="M69.997,25.755c0.066-1.852-0.063-3.643-0.688-4.602c-0.9-1.38-2.43-2.107-3.805-2.429        c-1.371-0.322-15.725-1.919-21.967-2.428c-6.237-0.514-16.409-1.091-19.034-1.279c-2.618-0.191-4.93,0-6.676,0.126        c-1.118,0.085-2.869,0.555-3.988,0.885c0,0-0.002,0-0.004,0c0.742-0.104,1.262,0.037,1.262,0.037s10.323,0.501,20.451,1.398        c10.132,0.9,23.185,2.696,23.185,2.696s3.236,0.196,4.381,2.191c0.887,1.547,0.875,5.29,0.875,5.29s0.297,14.466,0,24.042        c-0.289,9.575-0.973,21.949-0.973,21.949s-0.059,3.259-1.754,4.19c0.021-0.011,0.037-0.024,0.057-0.035        c0.742-0.376,2.699-1.366,3.748-1.982c1.311-0.764,2.934-1.852,3.369-2.939c0.441-1.091,1.438-18.664,1.561-28.446        C70.124,34.64,69.934,27.61,69.997,25.755z"/>
+</g>
+<g>
+<path fill="#FFFFFF" d="M15.097,16.065c0,0,10.323,0.501,20.451,1.398c10.132,0.9,23.185,2.696,23.185,2.696        s3.162,0.155,4.381,2.191c0.887,1.485,0.875,5.29,0.875,5.29s0.297,14.466,0,24.042c-0.289,9.575-0.973,21.949-0.973,21.949        s-0.049,3.28-1.754,4.19c-2.244,1.201-5.537,0.282-5.537,0.282s-14.036-2.979-21.245-4.77        c-7.209-1.798-18.897-5.091-18.897-5.091s-2.63-0.498-3.604-2.093c-0.883-1.446-1.035-4.226-1.035-4.226        s-0.488-14.531-0.524-21.713c-0.03-7.186-0.096-20.154-0.096-20.154s0.105-1.86,1.363-2.994        C13.34,15.569,15.097,16.065,15.097,16.065z"/>
+</g>
+<g>
+<radialGradient id="XMLID_8_" cx="21.8848" cy="21.8428" r="57.3996" fx="21.8848" fy="21.8428" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.0056" style="stop-color:#FFFFFF"/>
+<stop offset="0.249" style="stop-color:#F8F8F8"/>
+<stop offset="0.6016" style="stop-color:#E5E5E5"/>
+<stop offset="1" style="stop-color:#C7C7C7"/>
+</radialGradient>
+<path fill="url(#XMLID_8_)" d="M22.177,40.313L22.152,19.29c0,0,7.686,0.32,13.324,0.8c5.626,0.479,15.477,1.584,15.477,1.584        L49.36,73.37c0,0-7.999-1.6-14.757-3.271c-6.761-1.674-11.439-3.074-11.439-3.074L22.177,40.313z"/>
+</g>
+<g>
+<polyline fill="#3C3C3C" points="14.508,40.698 14.508,46.235 18.779,46.948 18.779,46.005 15.819,45.414 15.819,40.867 "/>
+<polyline fill="#3C3C3C" points="18.597,35.139 15.42,34.716 15.42,30.192 14.373,30.103 14.373,35.637 18.592,35.972 "/>
+<polygon fill="#3C3C3C" points="18.145,24.12 15.373,23.923 15.27,18.873 13.979,18.885 14.102,24.263 18.145,24.639 "/>
+<path fill="#3C3C3C" d="M48.815,43.634c-1.197,0.205-7.779-1.031-10.306-1.419c-2.597-0.4-14.341-2.052-15.191-2.601        c-0.848-0.549-0.748-1.399-0.748-1.399V19.323l-2.948-0.199l-1.25,0.349l0.013,0.049l-0.239-0.017l3.449,0.241v18.612        c0,0,0.24,0.96,0.723,1.362c0.479,0.402,0.964,0.804,0.964,0.804l24.064,3.771c0,0,0.965,0.077,1.365-0.482"/>
+<polyline fill="#3C3C3C" points="19.117,56.536 16.071,55.955 16.071,51.53 14.891,51.378 14.891,56.915 19.109,57.64 "/>
+<polygon points="53.049,21.924 50.954,21.674 49.112,22.069 51.678,22.391 51.678,27.928 57.211,28.648 57.211,27.914         53.049,27.419 "/>
+<polyline points="51.846,34.148 51.831,39.915 57.032,40.748 57.077,39.737 52.95,39.166 52.95,34.245 "/>
+<polyline points="51.834,46.424 51.834,52.127 57.034,53.124 57.04,52.277 52.852,51.51 52.852,46.588 "/>
+<polyline points="57.04,62.878 52.801,62.007 52.801,57.29 51.834,57.135 51.834,62.838 57.034,63.834 "/>
+<polyline points="52.965,69.241 52.786,75.061 53.792,74.233 53.901,69.368 "/>
+<path d="M60.745,23.821c-0.496-0.848-2.045-1.297-2.045-1.297l-1.352,0.199l0.008,0.067c0.395,0.011,1.572,0.178,2.422,1.688        c1.051,1.845,0.885,3.369,0.885,3.369l-0.564,42.761c0,0-0.074,2.936-1.209,3.945c0.498-0.175,0.979-0.631,1.123-0.745        c0.5-0.4,0.732-2.558,0.834-3.759c0.1-1.198,0.852-37.681,0.852-37.681s0.049-2.55,0.049-4.05        C61.747,26.822,61.249,24.673,60.745,23.821z"/>
+<path fill="#3C3C3C" d="M23.038,48.868c-0.483,0.318-0.883,1.281-0.883,1.281v17.41l0.006-0.004l0.98-0.526l0.002-16.943        c0,0-0.029-0.932,0.123-1.333C23.188,48.785,23.111,48.819,23.038,48.868z"/>
+<polyline fill="#3C3C3C" points="15.336,61.544 15.336,66.035 15.319,66.044 16.422,65.653 16.438,61.798 "/>
+</g>
+<g>
+<g>
+<linearGradient id="XMLID_9_" gradientUnits="userSpaceOnUse" x1="11.6455" y1="47.2861" x2="60.6724" y2="47.2861">
+<stop offset="0" style="stop-color:#B0B0AF"/>
+<stop offset="0.0115" style="stop-color:#A9A9A8"/>
+<stop offset="0.0713" style="stop-color:#8A8A89"/>
+<stop offset="0.1389" style="stop-color:#6E6E6E"/>
+<stop offset="0.2154" style="stop-color:#585858"/>
+<stop offset="0.3046" style="stop-color:#474747"/>
+<stop offset="0.4151" style="stop-color:#3C3C3C"/>
+<stop offset="0.57" style="stop-color:#353535"/>
+<stop offset="1" style="stop-color:#333333"/>
+</linearGradient>
+<path fill="url(#XMLID_9_)" d="M59.778,24.479c-1.041-1.846-2.566-1.688-2.566-1.688v5.857l-5.533-0.721         v-5.537l-2.566-0.321v20.22c0,0,0,0.961-0.402,1.524c-0.4,0.56-1.365,0.482-1.365,0.482L23.28,40.524         c0,0-0.484-0.401-0.964-0.804c-0.482-0.402-0.723-1.362-0.723-1.362V19.746l-3.449-0.241v5.134l-4.043-0.376l-0.13-5.241         c0,0-1.285,0.725-1.686,1.285c-0.398,0.56-0.641,1.925-0.641,1.925l0.964,37.146c0,0,0.16,1.442,0.16,2.002         c0,0.562,0.161,1.69,0.563,2.89c0.399,1.203,2.004,1.766,2.004,1.766v-4.491l4.094,0.961v4.414l2.726,0.641v-17.41         c0,0,0.399-0.963,0.883-1.281c0.48-0.32,1.125-0.162,1.125-0.162l23.425,4.254c0,0,0.959,0.496,1.438,1.06         c0.482,0.559,0.262,2.03,0.262,2.03l0.01,18.318l3.488,0.684l0.176-5.808l3.871,0.517l-0.125,5.79         c0,0,1.201-0.478,2.057-0.935c1.205-0.644,1.334-4.008,1.334-4.008l0.564-42.761C60.663,27.848,60.829,26.323,59.778,24.479z          M14.373,30.103l4.271,0.365l-0.052,5.504l-4.219-0.335V30.103z M14.508,40.698l4.271,0.552v5.698l-4.271-0.713V40.698z          M19.109,57.64l-4.219-0.725v-5.537l4.261,0.552L19.109,57.64z M51.848,34.148l5.217,0.457l-0.033,6.143l-5.201-0.833         L51.848,34.148z M57.034,63.834l-5.199-0.996v-5.703l5.232,0.829L57.034,63.834z M57.034,53.124l-5.199-0.997v-5.703         l5.232,0.828L57.034,53.124z"/>
+</g>
+</g>
+<polygon fill="#211E18" points="58.274,53.018 65.979,47.879 70.004,52.259 63.002,57.162 "/>
+<path fill="#392216" d="M67.071,45.823c0,0-0.008-8.405,7.471-8.405c6.832,0,8.641,6.304,8.057,9.454       c-0.658,3.56-2.801,5.372-4.32,6.071c-1.979,0.914,5.205-7.446-1.195-12.724C72.092,36.105,67.071,45.823,67.071,45.823z"/>
+<path fill="#392216" d="M72.559,40.337c-3.193,1.926-4.166,4.271-4.166,7.398c0,3.56,5.361,5.731,7.902,4.523       c2.867-1.364,3.232-3.062,1.928-2.188c-1.186,0.788-2.625,0.996-4.906-0.395C67.497,46.129,72.559,40.337,72.559,40.337z"/>
+<path fill="#392216" d="M69.848,65.334c0,0-1.414,2.846-0.758,5.516c1.045,4.249,4.596,4.685,7.311,4.552       c1.496-0.071,0.482,2.364-2.275,2.191c-2.758-0.178-6.217-2.498-7.049-3.81c-0.832-1.313-0.219-4.729,0.352-5.999       C67.997,66.516,69.848,65.334,69.848,65.334z"/>
+<path fill="#392216" d="M23.782,39.869c0,0,2.917-3.852,9.688-1.634c6.771,2.217,22.645,10.739,27.081,15.175       c4.498,4.496,6.52,6.116,9.221,8.637c0.439,0.409,0.533,0.461,0.658,0.717c0,0,0.611-0.438,2.494-0.744       c4.127-0.671,7.779,3.979,8.309,7.218c0.5,3.063-0.035,6.002-3.539,8.221c-2.145,1.357,2.838-7.905-0.654-11.017       c-5.254-4.685-8.199,0.861-8.199,0.861S52.731,53.527,45.26,50.259C39.21,47.611,23.782,39.869,23.782,39.869z"/>
+<path fill="#443C27" d="M56.45,53.41c-0.818,0.234-31.283,6.07-32.219,6.186       c-1.417,0.18,2.104,3.271,6.538,3.621c6.438,0.507,13.201-0.604,22.296-3.036C63.102,57.495,56.45,53.41,56.45,53.41z"/>
+<linearGradient id="XMLID_10_" gradientUnits="userSpaceOnUse" x1="24.3804" y1="58.8408" x2="59.0796" y2="58.8408">
+<stop offset="0" style="stop-color:#E3B83A"/>
+<stop offset="0.1974" style="stop-color:#DEA826"/>
+<stop offset="0.4652" style="stop-color:#D89812"/>
+<stop offset="0.7333" style="stop-color:#D58E06"/>
+<stop offset="1" style="stop-color:#D48B02"/>
+</linearGradient>
+<path fill="url(#XMLID_10_)" d="M56.918,53.877c-0.816,0.234-31.287,6.069-32.219,6.186       c-1.418,0.179,2.1,3.27,6.537,3.62c6.438,0.509,13.201-0.603,22.295-3.035C63.571,57.963,56.918,53.877,56.918,53.877z"/>
+<linearGradient id="XMLID_11_" gradientUnits="userSpaceOnUse" x1="65.3833" y1="42.7988" x2="77.0609" y2="54.4764">
+<stop offset="0" style="stop-color:#C6833A"/>
+<stop offset="1" style="stop-color:#D48B02"/>
+</linearGradient>
+<path fill="url(#XMLID_11_)" d="M69.409,52.128l-6.307,4.318l-4.318-4.202l7.705-5.137l-0.117-0.935       c0,0-0.59-8.307,6.887-8.172c6.42,0.117,8.5,6.072,8.406,9.223c-0.117,3.853-2.334,4.904-3.734,5.836       c-0.766,0.511-4.871,2.075-8.396-0.956C69.375,51.966,69.409,52.128,69.409,52.128z M73.959,40.629       c-2.826-0.489-4.902,2.177-4.902,5.077c0,2.901,2.451,4.67,4.318,5.254c2.738,0.854,5.785-2.01,5.604-4.903       C78.803,43.255,76.995,41.154,73.959,40.629z"/>
+<linearGradient id="XMLID_12_" gradientUnits="userSpaceOnUse" x1="30.2354" y1="32.5767" x2="76.4562" y2="78.7976">
+<stop offset="0" style="stop-color:#E3BD3A"/>
+<stop offset="0.2015" style="stop-color:#E2B938"/>
+<stop offset="0.404" style="stop-color:#E1AD31"/>
+<stop offset="0.6071" style="stop-color:#DD9925"/>
+<stop offset="0.8093" style="stop-color:#D97D15"/>
+<stop offset="1" style="stop-color:#D45B02"/>
+</linearGradient>
+<path fill="url(#XMLID_12_)" d="M22.89,40.001c0,0,2.086-3.487,8.856-1.27       c6.77,2.218,22.995,10.857,27.432,15.293c4.434,4.435,9.457,8.947,9.674,9.308c0,0,2.511-1.231,5.166-0.307       c7.787,2.712,7.162,11.587,3.604,14.579c-2.006,1.687-6.91,1.654-9.689-1.4c-3.502-3.854-2.1-8.58-2.1-8.58       S51.196,54.169,43.726,50.901C37.676,48.254,22.89,40.001,22.89,40.001z M72.18,65.478c-2.602,0-4.189,1.962-4.363,4.306       c-0.234,3.152,1.053,6.068,4.787,6.536c2.572,0.32,5.531-1.218,4.828-5.59C77,68.037,74.782,65.478,72.18,65.478z"/>
+<circle cx="56.565" cy="56.328" r="1.75"/>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/group/VedSimpleCutVideo.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+#include <data_caging_paths.hrh>
+#include "../../Group/buildconfig.hrh"
+
+#if defined( __DEBUG_ON__ )
+MACRO           DEBUG_ON
+#endif
+#if defined( __DEBUG_ON_ALWAYS__ )
+MACRO           DEBUG_ON_ALWAYS
+#endif
+#if defined(__DEBUG_ON__) || defined(__DEBUG_ON_ALWAYS__)
+LIBRARY         flogger.lib
+#endif
+
+#if defined (__GET_PAUSE_THUMBNAIL__)
+MACRO           GET_PAUSE_THUMBNAIL
+#endif
+
+TARGET  VedSimpleCutVideo.exe
+TARGETTYPE  exe
+UID    0x100039CE 0x200009DF
+CAPABILITY CAP_APPLICATION
+SECUREID 0x200009DF
+VENDORID        VID_DEFAULT
+
+EPOCSTACKSIZE 0x8000
+EPOCHEAPSIZE 0x100000 0x1600000
+
+SOURCEPATH ../src
+SOURCE  VeiSimpleCutVideoApp.cpp 
+SOURCE  VeiSimpleCutVideoAppUi.cpp
+SOURCE  VeiSimpleCutVideoDocument.cpp
+SOURCE  VeiSimpleCutVideoView.cpp
+SOURCE 	VeiSimpleCutVideoContainer.cpp
+SOURCE  veinavipanecontrol.cpp
+
+START RESOURCE ../data/VedSimpleCutVideo.rss
+HEADER 
+TARGETPATH APP_RESOURCE_DIR 
+LANGUAGE_IDS
+END
+
+START RESOURCE ../data/VedSimpleCutVideo_reg.rss
+DEPENDS vedsimplecutvideo.rsg
+TARGETPATH /private/10003a3f/apps
+END
+
+
+USERINCLUDE .
+USERINCLUDE ../inc
+USERINCLUDE ../../VideoEditorCommon/inc
+USERINCLUDE ../../VideoEditorUiComponents/inc
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE   . 
+SYSTEMINCLUDE	/epoc32/include/ECom
+SYSTEMINCLUDE   /epoc32/include/mda/client
+SYSTEMINCLUDE   /epoc32/include/mmf/server
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+
+LIBRARY aknicon.lib
+LIBRARY AknLayout2.lib
+LIBRARY aknlayout2adaptation.lib
+LIBRARY aknlayout2scalable.lib
+LIBRARY aknskins.lib
+LIBRARY apparc.lib 
+LIBRARY avkon.lib 
+LIBRARY bafl.lib
+LIBRARY cdlengine.lib
+LIBRARY CommonDialogs.lib 
+LIBRARY commonengine.lib		//StringLoader
+LIBRARY cone.lib 
+LIBRARY efsrv.lib 
+LIBRARY egul.lib 
+LIBRARY eikcoctl.lib 
+LIBRARY eikcore.lib 
+LIBRARY eikctl.lib
+LIBRARY estor.lib			//FOR settings view rreadstream
+LIBRARY euser.lib 
+LIBRARY fbscli.lib 
+LIBRARY featmgr.lib 
+LIBRARY gdi.lib
+LIBRARY hlplch.lib
+LIBRARY ImageConversion.lib	 //image conversion
+LIBRARY MediaClientAudio.lib
+LIBRARY MediaClientVideo.lib
+LIBRARY PlatformEnv.lib		//volume settings, pathinfos
+LIBRARY sysutil.lib
+LIBRARY VedEngine.lib
+LIBRARY VideoEditorCommon.lib
+LIBRARY VideoEditorUiComponents.lib
+LIBRARY ws32.lib
+LIBRARY apgrfx.lib
+
+#ifdef RD_TACTILE_FEEDBACK
+LIBRARY     	touchfeedback.lib
+#endif /* RD_TACTILE_FEEDBACK  */
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Build information file for Simple Cut Video.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../../Group/buildconfig.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+// Help export
+#include "../help/group/bld.inf"
+
+// Exported headers
+PRJ_EXPORTS
+../rom/SimpleCutVideo.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(SimpleCutVideo.iby)
+../rom/SimpleCutVideo_resource.iby  LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(SimpleCutVideo_resource.iby)
+
+// ROM build files
+PRJ_MMPFILES
+VedSimpleCutVideo.mmp
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE VedSimpleCutVideo_aif.MIF
+OPTION HEADERFILE VedSimpleCutVideo_aif.MBG
+OPTION SOURCEDIR ../data
+OPTION SOURCES -c8,8 qgn_menu_ve_cxt
+END
+
+PRJ_TESTMMPFILES
+
+
+// End of File
Binary file videditor/SimpleCutVideo/help/data/xhtml.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/help/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+* 
+* Description:
+* Export help related files.
+*
+*/
+
+#include <platform_paths.hrh>				
+PRJ_EXPORTS
+:zip ../data/xhtml.zip   /epoc32/data/z/resource/ overwrite
+:zip ../data/xhtml.zip   /epoc32/winscw/c/resource/ overwrite
+
+../inc/vided.hlp.hrh	MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/vided.hlp.hrh)
+../rom/simplecutvideohelps_variant.iby		CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(simplecutvideohelps_variant.iby)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/help/inc/vided.hlp.hrh	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,14 @@
+//
+// vided.hlp.hrh
+// 
+
+//
+// File generated by CSXHelp Utilities on 2008-08-12
+// 
+
+#ifndef __VIDED_HLP_HRH__
+#define __VIDED_HLP_HRH__
+
+_LIT(KVIE_HLP_CUT, "VIE_HLP_CUT"); // 
+
+#endif 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/help/rom/simplecutvideohelps_variant.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+#ifndef __SIMPLECUTVIDEOHELPS_VARIANT_IBY__
+#define __SIMPLECUTVIDEOHELPS_VARIANT_IBY__
+
+#if defined(FF_S60_HELPS_IN_USE)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10208A29\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x10208A29\contents.zip)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10208A29\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10208A29\index.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10208A29\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10208A29\keywords.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x10208A29\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x10208A29\meta.xml)
+#endif
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/VedSimpleCutVideo.hrh	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEDSIMPLECUTVIDEO_HRH
+#define VEDSIMPLECUTVIDEO_HRH
+
+enum TVeijoCommandIds
+    {
+	EVeiCmdHelp = 1,
+/* Cut video */
+	EVeiCmdCutVideoViewPlay,
+	EVeiCmdCutVideoViewPlayMarked,
+	EVeiCmdCutVideoViewClearMarks,
+	EVeiCmdCutVideoViewClearMarksIn,
+	EVeiCmdCutVideoViewClearMarksOut,
+	EVeiCmdCutVideoViewClearMarksInOut,
+	EVeiCmdCutVideoViewHelp,
+	EVeiCmdCutVideoViewBack,
+	EVeiCmdCutVideoViewDone,
+	EVeiCmdCutVideoViewMarkIn,
+	EVeiCmdCutVideoViewMarkOut,
+	EVeiCmdCutVideoViewContinue,
+	EVeiCmdCutVideoViewStop,
+	EVeiCmdCutVideoVolumeDown,
+	EVeiCmdCutVideoVolumeUp,
+	EVeiCmdCutVideoTakeSnapshot,
+	EVeiCmdPlayPreview,
+	EVeiCmdSettingsViewBack,
+	EVeiCmdPlayViewPause,
+	EVeiCmdPlayViewStop,
+	EVeiCmdEditVideoViewPreview,
+	EVeiCmdEditVideoViewTrimForMms,
+	EVeiCmdEditVideoViewPreviewLarge,
+	EVeiCmdEditVideoViewPreviewSmall,
+	EVeiCmdEditVideoViewMovie,
+	EVeiCmdEditVideoViewInsert,
+	EVeiCmdEditVideoViewSettings,
+	EVeiCmdEditVideoViewInsertVideo,
+	EVeiCmdEditVideoViewInsertAudio,
+	EVeiCmdEditVideoViewInsertImage,
+	EVeiCmdEditVideoViewInsertText,	//32
+	EVeiCmdCutVideoViewCut, 
+	EVeiCmdCutVideoViewSave,
+	EVeiCmdCutVideoViewNone,
+	EVeiCmdCutVideoViewExit 
+    };
+
+
+ // Video Editor view IDs.
+enum TVeiViewIds
+ 	{
+	EVeiSimpleCutVideoView 	
+ 	};
+
+#endif      
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/VeiSimpleCutVideoApp.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+#ifndef VEDSIMPLECUTVIDEOAPP_H
+#define VEDSIMPLECUTVIDEOAPP_H
+
+// INCLUDES
+// System includes
+#include <aknapp.h>
+
+// CLASS DECLARATION
+
+/**
+ * CVeiApp application class.
+ * Provides factory to create concrete document object.
+ */
+class CVeiSimpleCutVideoApp : public CAknApplication
+    {
+    
+    public: // Functions from base classes
+    private:
+
+        /**
+        * From CApaApplication, creates CVeiDocument document object.
+        * @return A pointer to the created document object.
+        */
+        CApaDocument* CreateDocumentL();
+        
+        /**
+        * From CApaApplication, returns application's UID (KUidveijo).
+        * @return The value of KUidveijo.
+        */
+        TUid AppDllUid() const;
+
+		CDictionaryStore* OpenIniFileLC(RFs& aFs) const; 
+
+    };
+
+#endif
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/VeiSimpleCutVideoAppUi.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+#ifndef VEDSIMPLECUTVIDEOAPPUI_H
+#define VEDSIMPLECUTVIDEOAPPUI_H
+
+// INCLUDES
+// System includes
+#include <eikapp.h>
+#include <eikdoc.h>
+#include <e32std.h>
+#include <coeccntx.h>
+#include <aknviewappui.h>
+#include <akntabgrp.h>
+#include <aknnavide.h>
+#include "VeiSettings.h"
+#include "VideoEditorDebugUtils.h"
+
+// FORWARD DECLARATIONS
+class CVeiSimpleCutVideoView;
+class CEikAppUi;
+
+
+/**
+* Application UI class.
+* Provides support for the following features:
+* - EIKON control architecture
+* - view architecture
+* - status pane
+* 
+*/
+class CVeiSimpleCutVideoAppUi : public CAknViewAppUi
+
+    {
+    public: // // Constructors and destructor
+
+        /**
+        * Default constructor.
+        */      
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */      
+        ~CVeiSimpleCutVideoAppUi();
+
+    public: // New functions
+		inline TInt GetVolumeLevel() { return iVolume; };
+		
+		inline void SetVolumeLevel( TInt aVolume ) { iVolume=aVolume; };
+
+		void CutVideoL( TBool aDoOpen, const RFile& aFile );
+
+		CVeiSimpleCutVideoAppUi();
+		
+		void Exit();
+
+		/**
+		 * Reads application settings data from ini-file. 
+		 *
+		 * @param aSettings Settings data where values are read.
+		 */		
+		void ReadSettingsL( TVeiSettings& aSettings ) const;
+		
+		/**
+		 * Writes application settings data to ini-file.
+		 *
+		 * @param aSettings Settings data where values are written.
+		 */
+		void WriteSettingsL( const TVeiSettings& aSettings );
+		
+		inline TBool AppIsOnTheWayToDestruction() { return iOnTheWayToDestruction; };
+
+    private:
+        /**
+        * From CEikAppUi, takes care of command handling.
+        * @param aCommand command to be handled
+        */
+        void HandleCommandL(TInt aCommand);
+
+        /**
+        * From CEikAppUi, handles key events.
+        * @param aKeyEvent Event to handled.
+        * @param aType Type of the key event. 
+        * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). 
+        */
+        virtual TKeyResponse HandleKeyEventL(
+            const TKeyEvent& aKeyEvent,TEventCode aType);
+
+        /**
+        * From CAknAppUiBase.   
+	    * Calls CAknViewAppUi::HandleScreenDeviceChangedL().
+        */
+		virtual void HandleScreenDeviceChangedL();	
+
+		/**
+	    * From @c CEikAppUi. Handles a change to the application's resources which
+	    * are shared across the environment. This function calls 
+	    * @param aType The type of resources that have changed. 
+	    */
+		virtual void HandleResourceChangeL(TInt aType);
+
+		/** 
+		* From CAknAppUi, HandleForegroundEventL( TBool aForeground )
+		* @param aForeground
+		*/
+		virtual void HandleForegroundEventL( TBool aForeground );
+		
+		// From MMGXFileNotificationObserver
+		virtual void HandleFileNotificationEventL();
+
+    private: //Data
+    
+    	CVeiSimpleCutVideoView*	iSimpleCutVideoView;
+        
+        /**
+         * Common volume setting.
+         */
+		TInt				iVolume;
+
+		TProcessPriority 	iOriginalProcessPriority;
+		TBool 				iProcessPriorityAltered;
+		
+		TBool 				iOnTheWayToDestruction;
+	};
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/VeiSimpleCutVideoContainer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,560 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEICUTVIDEOCONTAINER_H
+#define VEICUTVIDEOCONTAINER_H
+
+#include <coecntrl.h>
+#include <VideoPlayer.h>
+#include <VedCommon.h>
+#include <VedMovie.h>
+#include <aknprogressdialog.h>
+#include <coedef.h>
+
+#include "VeiVideoDisplay.h"
+#include "VeiImageConverter.h"
+#include "VeiRemConTarget.h"
+#include "mveinavipanecontrolobserver.h" 
+
+
+class CVeiSimpleCutVideoView;
+class CVeiCutterBar;
+class CAknsBasicBackgroundControlContext;
+class CVeiErrorUI;
+class CVeiVideoDisplay;
+class CVeiTextDisplay;
+#ifdef RD_TACTILE_FEEDBACK 
+class MTouchFeedback; 
+#endif /* RD_TACTILE_FEEDBACK  */
+
+//const TInt KMinVolumeLevel = 1;			
+const TInt KVeiCutBarHeight = 20;
+const TInt KProgressbarFinalValue = 50;
+_LIT(KEncoderType, "JPEG" );			// encoder type for image conversion	
+
+/**
+ * CVeiSimpleCutVideoContainer container control class.
+ *  
+ * Container for CVeiSimpleCutVideoView.
+ */
+class CVeiSimpleCutVideoContainer :	public CCoeControl,
+								public MCoeControlObserver,
+								public MVedVideoClipFrameObserver,
+								public MVedVideoClipInfoObserver, 
+								public MConverterController, 
+								public MProgressDialogCallback,
+								public MVeiVideoDisplayObserver,
+								public MVeiMediakeyObserver,
+						        public MVeiNaviPaneControlObserver
+    {
+	public:
+		/**
+		 * Edit state.
+		 */
+		enum TCutVideoState
+			{
+			EStateInitializing = 1,
+			EStateOpening,
+			EStateStoppedInitial,
+			EStateStopped,
+			EStatePlaying,
+			EStatePlayingMenuOpen,
+			EStatePaused,
+			EStateGettingFrame,
+			EStateBuffering,
+			EStateTerminating
+			};
+			
+		/**
+		 * Start or end mark.
+		 */
+		enum TCutMark
+			{
+			ENoMark,
+			EStartMark,
+			EEndMark,
+			EPlayHead
+			};
+			
+    public:
+		/**
+		 * Creates a CVeiSimpleCutVideoContainer object, which will draw itself to aRect.
+		 *
+		 * @param aRect Frame rectangle for container.
+		 * @param aView 
+		 *
+		 * @return a pointer to the created instance of CStoryboardContainer
+		 */
+		 static CVeiSimpleCutVideoContainer* NewL( const TRect& aRect, CVeiSimpleCutVideoView& aView, CVeiErrorUI& aErrorUI );
+
+		/**  
+		* Creates a CVeiSimpleCutVideoContainer object, which will draw itself to aRect.
+		* Leaves the created object in the cleanup stack.
+		*
+		* @param aRect Frame rectangle for container.
+		* @param aMovie  movie being edited
+		*
+		* @return a pointer to the created instance of CStoryboardContainer
+		*/
+		static CVeiSimpleCutVideoContainer* NewLC( const TRect& aRect, CVeiSimpleCutVideoView& aView, CVeiErrorUI& aErrorUI );
+
+	     /**
+         * Default constructor.
+		 *
+         * @param aRect  Frame rectangle for container.
+		 * @param aView  pointer to the view.
+         */
+        void ConstructL(const TRect& aRect, CVeiSimpleCutVideoView& aView, CVeiErrorUI& aErrorUI );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVeiSimpleCutVideoContainer();
+
+    public: 
+		/**
+		 * Takes one thumbnail bitmap from given file.
+		 *
+		 * @param aFilename	name of video clip file
+		 */
+		void GetThumbL( const TDesC& aFilename );
+
+		/**
+		 * ###Missin' description###
+		 *
+		 * @param aState
+		 */
+		void SetStateL( CVeiSimpleCutVideoContainer::TCutVideoState aState, TBool aUpdateCBA = ETrue);
+		/**
+		 * Starts playing.
+		 *
+		 * @param aStartTime
+		 */
+		void PlayL( const TDesC& aFilename );
+		void PlayMarkedL( 	const TDesC& aFilename, 
+							const TTimeIntervalMicroSeconds& aStartTime, 
+							const TTimeIntervalMicroSeconds& aEndTime );
+		/**
+		 * Stops playing.
+		 */
+		void StopL();
+
+		/**
+		 * Pauses playing.
+		 */
+		void PauseL( TBool aUpdateCBA = ETrue );
+
+		/**
+		 * Closes the stream.
+		 */
+		void CloseStreamL();
+
+		/**
+		 * Returns the playback position.
+		 *
+		 * @return  playback position
+		 */
+		TTimeIntervalMicroSeconds PlaybackPositionL();
+
+		/**
+		 * Marks the in point.
+		 */
+		void MarkedInL();
+
+		/**
+		 * Marks the out point.
+		 */
+		void MarkedOutL();
+
+		/**
+		 * Sets cut in time to cut video bar.
+		 *
+		 * @param aTime	Cut ín time
+		 */
+		void SetInTime( const TTimeIntervalMicroSeconds& aTime );
+
+		/**
+		 * Sets cut out time to cut video bar.
+		 *
+		 * @param aTime	Cut out time
+		 */
+		void SetOutTime( const TTimeIntervalMicroSeconds& aTime );
+
+		/**
+		* Takes the snapshot from current frame
+		*/
+		void TakeSnapshotL();
+		
+		void MuteL();
+    public: 
+	
+		/**
+		 * Update function that is called by the static callback method.
+		 */
+		void DoUpdate();
+		// from MVeiVideoDisplayObserver
+		virtual void NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo = 0 );
+
+		virtual void NotifyVideoClipFrameCompleted(CVedVideoClipInfo& aInfo, 
+											   TInt aError, 
+							 				   CFbsBitmap* aFrame);
+		/**
+		 * Called to notify that video clip info is ready
+		 * for reading.
+		 *
+		 * Possible error codes:
+		 *	- <code>KErrNotFound</code> if there is no file with the specified name
+		 *    in the specified directory (but the directory exists)
+		 *	- <code>KErrPathNotFound</code> if the specified directory
+		 *    does not exist
+		 *	- <code>KErrUnknown</code> if the specified file is of unknown format
+		 *
+		 * @param aInfo   video clip info
+		 * @param aError  <code>KErrNone</code> if info is ready
+		 *                for reading; one of the system wide
+		 *                error codes if reading file failed
+		 */
+		virtual void NotifyVideoClipInfoReady(CVedVideoClipInfo& aInfo, 
+										  TInt aError);
+		
+       /**
+        * From CCoeControl, OfferKeyEventL.
+		*
+		* @param aKeyEvent  key event
+		* @param aType  event code
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
+
+		/**
+		 * From MProgressDialogCallback, DialogDismissedL.
+		 *
+		 * @param aButtonId  button id
+		 */
+		virtual void DialogDismissedL( TInt aButtonId );
+
+		/**
+		 * Opens a video clip file and initializes videoplayerutility.
+		 *
+		 * @param aFilename  file to open
+		 */
+		void OpenFileL( const TDesC& aFilename/*, TBool aStartPlaying = EFalse */);
+		
+		/**
+		 * Prepares the control for termination; stops video playback
+		 * and sets the state to EStateTerminating.
+		 * 
+		 */
+		void PrepareForTerminationL();
+
+		// From MConverterController
+		void NotifyCompletion( TInt aErr );
+
+		void ResolveCaptionNameL( TApaAppCaption& aCaption ) const;
+		
+		void FocusChanged(TDrawNow aDrawNow);
+    
+	private: 
+		/**
+		 * Callback function for the timer.
+		 *
+		 * @param aThis  self pointer
+		 *
+		 * @return  dummy value
+		 */
+		static TInt DoAudioBarUpdate( TAny* aThis );
+
+		/**
+		* Time increment.
+		*
+		* @param aKeyCount number a key events
+		* @return time 
+		*/
+		TInt TimeIncrement( TInt aKeyCount ) const;
+	
+		/**
+		 * Constructor.
+		 *
+		 * @param aView	instance of cut video view
+		 * @param aErrorUI instance of CVeiErrorUI
+		 */
+		CVeiSimpleCutVideoContainer( const TRect& aRect, CVeiSimpleCutVideoView& aView, CVeiErrorUI& aErrorUI );
+
+		/**
+		 * Gets intra frame bitmap from video clip.
+		 *
+		 * @param aTime	intra frame time.
+		 */
+		void GetThumbAtL( const TTimeIntervalMicroSeconds& aTime );
+
+		/**
+        * From CoeControl, MopSupplyObject.
+		*
+		* @param aId  
+        */
+		virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
+       /**
+        * From CoeControl, SizeChanged.
+        */
+        void SizeChanged();
+
+       /**
+        * From CoeControl, CountComponentControls.
+		* 
+		* @return  number of component controls in this control
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl, ComponentControl.
+		*
+		* @param aIndex  index of the control to return
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+		*
+		* @param aRect  region of the control to be redrawn
+        */
+        void Draw(const TRect& aRect) const;
+
+        /**
+         * From CCoeControl, gets the control's help context. Associates the
+         * control with a particular Help file and topic in a context sensitive
+         * application.
+         *
+         * @param aContext Control's help context.
+         */
+        void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+       /**
+        * From CCoeControl, HandleControlEventL
+        */
+        void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
+
+	    /**
+	    * HandlePointerEventL
+	    * Handles pen inputs
+	    *
+	    * @param aPointerEvent  pointer event
+	    */
+	    void HandlePointerEventL(const TPointerEvent& aPointerEvent );
+
+		/**
+		* Handles progress bar touch events
+		* @param aPBRect Current progress bar rectangle 
+		* @param aPressedPoint The x coordinate value that was pressed
+		* 			inside the progress bar
+		* @param aDragMarks ETrue if the user drags start or end marks.
+		*					EFalse otherwise
+		*/
+		void HandleProgressBarTouchL( TRect aPBRect, TInt aPressedPoint, TBool aDragMarks, CVeiSimpleCutVideoContainer::TCutMark aCutMark = ENoMark );
+
+		/**
+		* Rounds the parameter value to nearest second value
+		* @param aMicroSecs Time value in microseconds
+		* @return Rounded value in seconds
+		*/
+		TInt RoundMicroSecsToSecs( TTimeIntervalMicroSeconds aMicroSecs );
+
+		/*
+		* Indicates ProgressNote. 
+		*
+		*/
+		void ShowProgressNoteL();
+
+		/**
+		 * Shows information note with given message.
+		 * 
+		 * @param aMessage message to show.
+		 */
+		void ShowInformationNoteL( const TDesC& aMessage ) const;
+
+		/**
+        * The entity of ProgressCallBackL() function
+        * @return 0 when work is done, otherwise return 1.
+        */
+        TInt UpdateProgressNote();
+
+		/**
+		* Saves snapshot.
+		*/
+		void SaveSnapshotL();
+
+		/**
+		* Cancels saving of the snapshot.
+		*/
+		void CancelSnapshotSave();				
+		
+		void StopProgressDialog();
+		
+		void ShowGlobalErrorNote(const TInt aErr);
+
+		/**	HandleVolumeUpL 
+		*
+		*   @see MVeiMediakeyObserver
+		*/
+		virtual void HandleVolumeUpL();	
+		
+		/**
+		* From MVeiNaviPaneControlObserver
+		*/
+		void SetVolumeLevelL( TInt aVolume );			
+
+		/**	HandleVolumeDownL 
+		*
+		*   @see MVeiMediakeyObserver
+		*/
+		virtual void HandleVolumeDownL();
+		
+		/** Callback function */
+		static TInt AsyncTakeSnapshot(TAny* aThis);
+		/** Callback function */
+		static TInt AsyncSaveSnapshot(TAny* aThis);
+		
+	    /**	LaunchSavingDialogsL
+		*   
+		*	Displays Avkon file handling queries
+		*
+		* 	@param 
+		*   @return ETrue if a file name is successfully created
+		*			EFalse otherwise	 
+		*	
+		*/		
+		TBool LaunchSavingDialogsL();
+
+	protected:		
+		// implementation
+	    void HandleVideoClickedL();
+
+    private: //data
+		/** cut video view */
+		CVeiSimpleCutVideoView& iView;
+
+		/** Error UI */
+		CVeiErrorUI&	iErrorUI;
+
+		/** Video clip info*/
+		CVedVideoClipInfo*	iVideoClipInfo;
+
+		/** Current state. */
+		TCutVideoState iState;
+		
+		/** Previous state. */
+		TCutVideoState iPreviousState;
+
+		/** Previous state. */
+		TCutVideoState iPrevState;
+
+		/** cut video bar. */
+		CVeiCutterBar* iCutVideoBar;
+
+		/** Last position. */
+		TTimeIntervalMicroSeconds iLastPosition; 
+
+		/** Video clip duration */
+		TTimeIntervalMicroSeconds iDuration;
+
+		/**
+		 * Control context that provides a layout background with a 
+		 * background bitmap and its layout rectangle.
+		 */
+		CAknsBasicBackgroundControlContext*	iBgContext;
+
+		/** Key repeat count in seek function. */
+		TInt iKeyRepeatCount;
+
+		/** Seek thumbnail position in video clip. */
+		TTimeIntervalMicroSeconds iSeekPos;
+
+		/** Seek - flag. */
+		TBool iSeeking;
+
+		/** Frame ready - flag */
+		TBool iFrameReady;
+
+		/** Last keycode, used in OfferKeyEventL(); */
+		TUint iLastKeyCode;
+
+		/** The actuall calls to ICL are done from this image converter. */
+		CVeiImageConverter* iConverter;
+		
+		//** Whether we need to take snapshot. */
+		TBool iTakeSnapshot;
+
+		/** Progress dialog */
+		CAknProgressDialog* iProgressDialog;
+
+		HBufC*	            iSaveToFileName;	        
+		TSize               iFrameSize;
+		CPeriodic*	        iVideoBarTimer;
+		CVeiVideoDisplay*	iVideoDisplay;
+		TRect				iDisplayRect;
+		TRect				iCutTimeDisplayRect;
+		CVeiTextDisplay*	iCutTimeDisplay;
+		TBool				iPlayOrPlayMarked;
+		
+		TRect				iIconDisplayRect;
+		CFbsBitmap*			iPauseBitmap;
+		CFbsBitmap*			iPauseBitmapMask;
+		CFbsBitmap*			iPlayBitmap;
+		CFbsBitmap*			iPlayBitmapMask;
+		
+		/** Callback utility */
+		CAsyncCallBack* 	iCallBackSaveSnapshot;
+		CAsyncCallBack* 	iCallBackTakeSnapshot;
+
+		/** Remote connection API used to handle the volume keys. */
+		CVeiRemConTarget* 	iRemConTarget;
+		
+		TBool 				iTakeSnapshotWaiting;
+
+		/** ETrue if user is dragging the start or end mark with a pen,
+			EFalse otherwise */
+		TBool iIsMarkDrag;
+		
+		/** ETrue if the pen is in start or end mark area when it goes down,
+			EFalse otherwise */		
+		TBool iIsMarkTapped;
+		
+		/** ETrue if the pen is in display area or in play/pause button area 
+		    when it goes down, EFalse otherwise */
+		TBool iIsIconOrDisplayTapped;
+		
+		/** Indicates which mark the user has tapped */						
+		TCutMark iTappedMark;
+		
+		/// Point where button down event has occured.
+		TPoint iButtonDownPoint;
+        
+		/** File name that is used when saving the snapshot */						        
+        TFileName           iSnapshotFileName; 
+		
+    	// Feedback for screen touch:
+#ifdef RD_TACTILE_FEEDBACK 
+		MTouchFeedback* iTouchFeedBack;
+#endif /* RD_TACTILE_FEEDBACK  */ 
+
+#include "veicutvideocontainer.inl"
+
+    };
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/VeiSimpleCutVideoContainer.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#ifndef __VEICUTVIDEOCONTAINER_INL__
+#define __VEICUTVIDEOCONTAINER_INL__
+
+public:
+		/**
+		 * Returns total length of the video clip.
+		 *
+		 * @return  total length
+		 */
+		inline TTimeIntervalMicroSeconds TotalLength() { return iDuration; };
+
+		/**
+		 * Returns the player state.
+		 *
+		 * @return  player state
+		 */
+		inline TCutVideoState State() { return iState; };
+		/**
+		 * Returns current volume level.
+		 *
+		 * @return	volume level
+		 */
+		inline TInt Volume() const { return iInternalVolume; };
+
+		/**
+		 * Returns minimum volume level.
+		 *
+		 * @return	min volume level
+		 */
+		inline TInt MinVolume() const { return KMinVolumeLevel; };
+
+		/**
+		 * Returns maximum volume level.
+		 *
+		 * @return	max volume level
+		 */
+		inline TInt MaxVolume() const { return KMaxVolumeLevel; };
+		/**
+		 * Change volume level. Changes current volume level to given level.
+		 *
+		 * @param aVolumeLevel		new volume level 
+		 */
+		inline void SetVolume( TInt aVolumeLevel ) { iInternalVolume = aVolumeLevel; };
+	
+#endif  // __VEICUTVIDEOCONTAINER
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/VeiSimpleCutVideoDocument.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#ifndef VEDSIMPLECUTVIDEODOCUMENT_H
+#define VEDSIMPLECUTVIDEODOCUMENT_H
+
+// INCLUDES
+#include <akndoc.h>
+#include <eikapp.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class  CEikAppUi;
+
+// CLASS DECLARATION
+
+/**
+*  CVeiDocument application class.
+*/
+class CVeiSimpleCutVideoDocument : public CAknDocument
+    {
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CVeiSimpleCutVideoDocument* NewL(CEikApplication& aApp);
+		
+		//CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs);
+		//void OpenFileL(TBool aDoOpen , RFile& aFile);
+		void OpenFileL( CFileStore*& aFileStore, RFile& aFile );
+        
+		/**
+        * Destructor.
+        */
+        virtual ~CVeiSimpleCutVideoDocument();
+
+    private:
+
+        /**
+        * Default constructor.
+        */
+        CVeiSimpleCutVideoDocument(CEikApplication& aApp);
+        void ConstructL();
+
+    private:
+
+        /**
+        * From CEikDocument, create CVeiAppUi "App UI" object.
+        */
+        CEikAppUi* CreateAppUiL();
+        
+	private: // Data
+    };
+
+#endif
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/VeiSimpleCutVideoView.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,472 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEISIMPLECUTVIDEOVIEW_H
+#define VEISIMPLECUTVIDEOVIEW_H
+
+
+#include <aknview.h>
+#include <VedMovie.h>
+#include <VedCommon.h>
+#include <aknprogressdialog.h> 
+#include <utility.h>
+#include <caknmemoryselectiondialog.h> 
+#include "extprogressdialog.h"
+#include "VeiSimpleCutVideoContainer.h"
+
+//class CAknTitlePane;
+class CPeriodic;
+class CVeiErrorUI;
+class CAknMemorySelectionDialog;
+class CVeiTempMaker;
+class CVeiNaviPaneControl;
+
+
+/**
+*  CVeiCutVideoView view class.
+* 
+*/
+class CVeiSimpleCutVideoView : public CAknView, public MVedMovieObserver,
+						 public MVedMovieProcessingObserver, 
+						 public MProgressDialogCallback,
+						 public MExtProgressDialogCallback
+    {
+    public:
+
+        /**
+        * Default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVeiSimpleCutVideoView();
+
+	protected:
+
+		/** 
+		* From CAknView, HandleForegroundEventL( TBool aForeground )
+		*
+		* @param aForeground
+		*/
+		virtual void HandleForegroundEventL( TBool aForeground );
+
+    private:
+ 
+		/**
+		 * From CAknView, DynInitMenuPaneL.
+		 *
+		 * @param aResourceId  resource id
+		 * @param aMenuPane  menu pane
+		 */
+		void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);	
+
+		/** 
+		* From MVedMovieProcessingObserver
+		*/
+		virtual void NotifyMovieProcessingStartedL(CVedMovie& aMovie);
+		virtual void NotifyMovieProcessingProgressed(CVedMovie& aMovie, TInt aPercentage);
+		virtual void NotifyMovieProcessingCompleted(CVedMovie& aMovie, TInt aError);
+	
+		/**
+		* From MVedMovieObserver
+		*/
+		virtual void NotifyVideoClipAdded( CVedMovie& aMovie, TInt aIndex );
+		virtual void NotifyVideoClipAddingFailed( CVedMovie& aMovie, TInt aError );
+		virtual void NotifyVideoClipRemoved( CVedMovie& aMovie, TInt aIndex );
+		virtual void NotifyVideoClipIndicesChanged( CVedMovie& aMovie, TInt aOldIndex, 
+									           TInt aNewIndex );
+		virtual void NotifyVideoClipTimingsChanged( CVedMovie& aMovie,
+											   TInt aIndex );
+		virtual void NotifyVideoClipColorEffectChanged( CVedMovie& aMovie,
+												   TInt aIndex );
+		virtual void NotifyVideoClipAudioSettingsChanged( CVedMovie& aMovie,
+											         TInt aIndex );
+		virtual void NotifyStartTransitionEffectChanged( CVedMovie& aMovie );
+		virtual void NotifyMiddleTransitionEffectChanged( CVedMovie& aMovie, 
+													 TInt aIndex );
+		virtual void NotifyEndTransitionEffectChanged( CVedMovie& aMovie );
+		virtual void NotifyAudioClipAdded( CVedMovie& aMovie, TInt aIndex );
+		virtual void NotifyAudioClipAddingFailed( CVedMovie& aMovie, TInt aError );
+		virtual void NotifyAudioClipRemoved( CVedMovie& aMovie, TInt aIndex );
+		virtual void NotifyAudioClipIndicesChanged( CVedMovie& aMovie, TInt aOldIndex, 
+									           TInt aNewIndex );
+		virtual void NotifyAudioClipTimingsChanged( CVedMovie& aMovie,
+											   TInt aIndex );
+		virtual void NotifyMovieReseted( CVedMovie& aMovie );
+
+		virtual void NotifyVideoClipGeneratorSettingsChanged(CVedMovie& aMovie,
+											             TInt aIndex);
+
+		virtual void NotifyVideoClipDescriptiveNameChanged(CVedMovie& aMovie, TInt aIndex);
+		virtual void NotifyMovieQualityChanged(CVedMovie& aMovie);				
+
+		virtual void NotifyMovieOutputParametersChanged(CVedMovie& aMovie);
+	    virtual void NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex);
+		virtual void NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
+                                                        TInt aClipIndex, 
+                                                        TInt aMarkIndex);
+		virtual void NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex);
+		virtual void NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
+                                                        TInt aClipIndex, 
+                                                        TInt aMarkIndex);
+
+		/**
+		* From MProgressDialogCallback
+		*/
+		void DialogDismissedL(TInt aButtonId);
+
+
+	public:
+	    /**
+        * 
+		* 
+		* @return VeiSimpleCutVideoView Uid
+        */
+        TUid Id() const;
+
+		/**
+		 * Starts temporary clip processing.
+		 */
+		void GenerateEffectedClipL();
+
+       /**
+        * From CAknView, HandleCommandL(TInt aCommand);
+		*
+		* @param aCommand
+        */
+        void HandleCommandL(TInt aCommand);
+
+		/**
+		 * Draws the time label navi.
+		 */
+		void DrawTimeNaviL();
+
+		/**
+		 * Clears the in and/or out points.
+		 *
+		 * @param aClearIn  whether to clear the in point
+		 * @param aClearOut  whether to clear the out point
+		 */
+		void ClearInOutL( TBool aClearIn, TBool aClearOut );
+
+		/**
+		 * Sets the movie and index
+		 *
+		 * @param aVideoClip	movie name
+		 * @param aIndex		index of the video clip in movie
+		 */
+		void SetVideoClipAndIndex(CVedMovie& aVideoClip, TInt aIndex);
+
+		/**
+		 * Returns the cut out time.
+		 *
+		 * @return cut out time
+		 */
+		TUint OutPointTime();
+
+		/**
+		 * Returns the  cut in time.
+		 *
+		 * @return  cut in time
+		 */
+		TUint InPointTime();
+
+		/**
+		 * Changes the CBA (command button array) according to the edit
+		 * state.
+		 *
+		 * @param aState  current state
+		 */
+		void UpdateCBAL( TInt aState );
+
+		/**
+		 * Updates the time label navi. This method is called by the
+		 * static callback function.
+		 */
+		void UpdateTimeL();
+
+		/**
+		 * Starts the navi pane update, that is, the periodic timer.	
+		 */
+		void StartNaviPaneUpdateL();
+
+		/**
+		 * Stops the navi pane update.
+		 */
+		void StopNaviPaneUpdateL();
+
+		/**
+		 * 
+		 */
+		void ShowVolumeLabelL( TInt aVolume );
+
+		/**
+		 * Mutes the volume.
+		 */
+		void VolumeMuteL();
+
+		/** Possible mark states */
+		enum TMarkState
+			{
+			EMarkStateIn,
+			EMarkStateOut,
+			EMarkStateInOut
+			};
+
+		void HandleStatusPaneSizeChange();
+		
+		TInt AddClipL( const TDesC& aFilename, TBool aStartNow );
+		
+		/**
+         * No description.
+         *
+         * 
+         * @return No description.
+         */
+        TBool IsEnoughFreeSpaceToSaveL();// const;
+		TTimeIntervalMicroSeconds GetVideoClipCutInTime();
+		TTimeIntervalMicroSeconds GetVideoClipCutOutTime();
+
+		/** 
+		 * Handles a change to the control's resources.
+		 */
+		void HandleResourceChange( TInt aType );
+
+	    /**
+        * Get pointer to the movie instance.
+		* 
+		* @return CVedMovie*
+        */
+        const CVedMovie* Movie() const;
+        
+        inline TBool AppIsOnTheWayToDestruction() { return iOnTheWayToDestruction; };
+        
+        void PrepareForTermination();
+        
+        inline TVeiSettings Settings() { return iMovieSaveSettings; };
+
+	    /**
+        * Moves the start or end mark when user drags them.
+		* 
+		* @param aPosition	position where the mark is moved to
+		* @param aMarkType  EStartMark or EEndMark
+		* @return -
+        */               
+		void MoveStartOrEndMarkL(TTimeIntervalMicroSeconds aPosition, CVeiSimpleCutVideoContainer::TCutMark aMarkType);
+		
+	private:
+		/**
+		 * Starts playing the clip. If the clip is paused, resumes 
+		 * playing.
+		 */
+		void PlayPreviewL();
+
+		/**
+		 * Pauses the playback.
+		 */
+		void PausePreviewL();
+
+		/**
+		 * Plays the marked section of the clip.
+		 */
+		void PlayMarkedL();
+
+		/**
+		 * Marks the in point to the current point.
+		 */
+		void MarkInL();
+
+		/**
+		 * Marks the out point to the current point.
+		 */
+		void MarkOutL();
+
+		/**
+		 * Static callback function for the periodical timer that updates
+		 * the time navi.
+		 *
+		 * @param aPtr  self pointer
+		 *
+		 * @return dummy value
+		 */
+		static TInt UpdateTimeCallbackL( TAny* aPtr );
+		
+		TBool SaveL();
+		void StartTempFileProcessingL();
+		
+		/**
+         * Shows error note with given message.
+         * 
+         * @param aResourceId No description.
+         * @param aError No description.
+         */
+        void ShowErrorNoteL( const TInt aResourceId, TInt aError = 0 ) const;
+
+
+        void StartProgressNoteL();
+        void StartAnimatedProgressNoteL();
+
+        /**
+         *  Checks the memory card availability, if MMC is selected as save
+         *  store in application settings. An information note is shown in
+         *  following situations:
+         *  - MMC not inserted
+         *  - MMC corrupted (unformatted)
+         *  [- MMC is read-only (not implemented)]
+         *  
+         *  If note is popped up, this function waits until it's dismissed.
+         */
+        void CheckMemoryCardAvailabilityL();
+        
+    private:
+
+        void CloseWaitDialog();
+        
+         /**
+         * From AknView, DoActivateL.
+		 * 
+		 * @param aPrevViewId  previous view id
+		 * @param aCustomMessageId  custom message id
+		 * @param aCustomMessage  custom message
+         */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+        
+		/**
+        * From AknView, DoDeactivate
+        */
+        void DoDeactivate();
+		
+		/** Callback function */
+		static TInt AsyncExit(TAny* aThis);
+
+
+		/**
+         * Sets the current file name as title pane text
+         * 
+         * @param -
+         * @param .
+         */		
+		void SetTitlePaneTextL ();
+		
+	    /**	QueryAndSaveL
+		*   
+		*	Displays Avkon file handling queries and calls
+		*	SaveL() 
+		*
+		*   @param -
+		*   @return TInt 1 if the image has been saved, otherwise 0
+		*/    	
+		TInt QueryAndSaveL();
+		
+		TBool IsCutMarkSet();
+		
+    private: // Data
+		/* cut video container	*/
+        CVeiSimpleCutVideoContainer* iContainer;
+
+		/* index of the video clip in the movie	*/
+		TUint iIndex;
+
+		/* movie */
+		CVedMovie* iMovie;
+
+		/** Time updater. */
+		CPeriodic* iTimeUpdater;
+
+		/** Progress note. */
+		CAknProgressDialog* iProgressNote;
+
+		/** Popup menu state flag */
+		TBool iPopupMenuOpened;
+
+		/** Audio muted flag */
+		TBool iAudioMuted;
+
+		/** current mark state */
+		TMarkState iMarkState;
+
+		/** Error number */
+		TInt	  iErrorNmb;
+
+		/** Error UI */
+		CVeiErrorUI* iErrorUI;
+
+		CAknMemorySelectionDialog::TMemory iMemoryInUse;
+
+		TVeiSettings iMovieSaveSettings;				    	
+    	
+    	/**
+         * Temporary file name for storing preview clip.
+         */
+        HBufC*                  iTempFile;
+        
+        /**
+         * No description.
+         */
+        HBufC*                  iSaveToFileName;
+        
+        /**
+         * No description.
+         */
+        CVeiTempMaker*          iTempMaker;
+        
+		
+		CAknWaitDialog*			iWaitDialog;
+		
+		/**
+	    * Progress dialog.
+	    */
+	    CExtProgressDialog*		iAnimatedProgressDialog;
+
+		TBool		iSaving;
+		
+		TBool		iClosing;
+		
+		TInt iProcessed;
+		
+		/** Callback utility */
+		CAsyncCallBack* iCallBack;
+
+		TBool 				iOnTheWayToDestruction;
+		TBool 				iSelectionKeyPopup;
+
+		/** Indicates if the image will be overwritten or not */		
+		TBool iOverWriteFile;
+		
+		/** Indicates if the video has been paused */
+		TBool iPaused;
+		
+		/** ETrue if the user selects "Save" from menu */
+		TBool iSaveOnly; 
+
+		/// Own: NaviPaneControl		
+		CVeiNaviPaneControl*    iCVeiNaviPaneControl;
+		
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/VeiSimpleCutVideoView.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEIEDITVIDEOCONTAINER_INL__
+#define __VEIEDITVIDEOCONTAINER_INL__
+
+public:
+
+
+		inline HBufC* TempFilename() { return iProcessedTempFile; };
+
+#endif   //__VEIEDITVIDEOCONTAINER_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/VideoEditorHelp.hlp.hrh	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* This file contains all the Video Editor contextual help 
+* identifiers for the CSHelp system (implemented in 
+* HlpLauncher).
+*
+*/
+
+
+
+#ifndef __VIDEOEDITORHELP_HLP_HRH__
+#define __VIDEOEDITORHELP_HLP_HRH__
+
+// CONSTANTS
+_LIT(KVED_HLP_EDIT_VIDEO_VIEW,"VED_HLP_EDIT_VIDEO_VIEW"); //Video editing view
+_LIT(KVED_HLP_SETTINGS_VIEW,"VED_HLP_SETTINGS_VIEW"); //Settings view
+_LIT(KVED_HLP_PREVIEW_VIEW,"VED_HLP_PREVIEW_VIEW"); //Play view
+_LIT(KVED_HLP_CUT_VIDEO_VIEW,"VIE_HLP_CUT"); //Cut video view
+_LIT(KVED_HLP_CUT_AUDIO_VIEW,"VED_HLP_CUT_AUDIO_VIEW"); //Cut audio view
+_LIT(KVED_HLP_TRIM_FOR_MMS_VIEW,"VED_HLP_TRIM_FOR_MMS_VIEW"); //Trim video clip for MMS view
+
+#endif  // __VIDEOEDITORHELP_HLP_HRH__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/VideoEditorTest.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+* Video Editor Engine Test DLL.
+*
+*/
+
+
+/* Choose proper header file, depending on which test framework 
+   the tests are built for */
+
+#ifndef VEDTESTTOP_H
+#define VEDTESTTOP_H
+
+#ifdef USING_CPPUNIT_FRAMEWORK
+
+ /* CppUnit headers */
+#include <CppUnit/Test.h>
+#include <CppUnit/TestCase.h>
+#include <CppUnit/TestCaller.h>
+#include <CppUnit/TestSuite.h>
+
+#else
+
+  /* STIF TFW headers */
+//#include "TestFramework/test.h"
+//#include "TestFramework/TestCase.h"
+//#include "TestFramework/TestCaller.h"
+//#include "TestFramework/TestSuite.h"
+
+#endif
+
+
+//////////////////
+// Utility function
+//////////////////
+
+void AddDriveLetterToPath(const TDesC &aFileName,TDes &aFileNameWithPath ) ;
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/mveinavipanecontrolobserver.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Observer API.
+*
+*/
+
+
+#ifndef MVEINAVIPANECONTROLOBSERVER_H
+#define MVEINAVIPANECONTROLOBSERVER_H
+
+/**
+ *  Observer api for CVeiNaviPaneControl
+ *
+ *  @lib internal
+ *  @since S60 v5.0
+ */
+class MVeiNaviPaneControlObserver
+    {
+
+public:
+    /**
+     * SetVolumeLevelL
+     *
+     * Called when volume level is changed
+     * @since S60 v5.0
+     * @param aVolume Volume level
+     */
+    virtual void SetVolumeLevelL( TInt aVolume ) = 0;
+    };
+
+
+#endif // MVEINAVIPANECONTROLOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/veicutvideocontainer.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEICUTVIDEOCONTAINER_INL__
+#define __VEICUTVIDEOCONTAINER_INL__
+
+public:
+		/**
+		 * Returns total length of the video clip.
+		 *
+		 * @return  total length
+		 */
+		inline TTimeIntervalMicroSeconds TotalLength() { return iDuration; };
+
+		/**
+		 * Returns the player state.
+		 *
+		 * @return  player state
+		 */
+		inline TCutVideoState State() { return iState; };
+
+	
+#endif  // __VEICUTVIDEOCONTAINER
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/inc/veinavipanecontrol.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Navipane control for SVE.
+*
+*/
+
+#ifndef C_CVEINAVIPANECONTROL_H
+#define C_CVEINAVIPANECONTROL_H
+
+#include <e32base.h>
+#include <coecobs.h>        // MCoeControlObserver
+#include "mtimelabelnaviobserver.h"
+
+class CEikStatusPane;
+class CAknNavigationDecorator;
+class CAknNavigationControlContainer;
+class CVeiTimeLabelNavi;
+class CAknVolumeControl;
+class CPeriodic;
+class MVeiNaviPaneControlObserver;
+
+/**
+ *  Navipane control.
+ *
+ *  @code
+ *   ?good_class_usage_example(s)
+ *  @endcode
+ *
+ *  @lib internal (VedSimpleCutVideo.exe)
+ *  @since S60 v5.0
+ */
+class CVeiNaviPaneControl : public CBase, MCoeControlObserver,
+    MTimeLabelNaviObserver
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aStatusPane aPointer to app status pane
+     */
+    static CVeiNaviPaneControl* NewL( CEikStatusPane* aStatusPane );
+     
+    /**
+    * Destructor.
+    */
+    ~CVeiNaviPaneControl();
+
+    /**
+     * DrawTimeNaviL
+     *
+     * @since S60 v5.0
+     * @param aElapsed Elapsed time
+     * @param aTotal Total time
+     */      
+    void DrawTimeNaviL( TTime aElapsed, TTime aTotal );
+
+    /**
+     * SetObserver
+     *
+     * @since S60 v5.0
+     * @param aObserver Navi pane control observer. 
+     *      See "mveinavipanecontrolobserver.h"
+     */     
+    void SetObserver( MVeiNaviPaneControlObserver* aObserver )
+        {
+        ASSERT( aObserver );
+        iObserver = aObserver;
+        };
+    
+    /**
+     * SetPauseIconVisibilityL
+     *
+     * @since S60 v5.0
+     * @param aVisible ETrue = visible
+     */    
+    void SetPauseIconVisibilityL( TBool aVisible );
+    
+    /**
+     * SetVolumeIconVisibilityL
+     *
+     * @since S60 v5.0
+     * @param aVisible ETrue = visible
+     */    
+    void SetVolumeIconVisibilityL( TBool aVisible );    
+
+    /**
+     * ShowVolumeLabelL
+     *
+     * @since S60 v5.0
+     * @param aVolume Volume level
+     */
+    void ShowVolumeLabelL( TInt aVolume );
+    
+    /**
+     * HandleResourceChange
+     *
+     * @since S60 v5.0
+     * @param aType Type of the resource change.
+     */
+    void HandleResourceChange( TInt aType );
+    
+// from base class MCoeControlObserver
+    void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
+    
+// from base class MTimeLabelNaviObserver    
+    void HandleNaviEventL();
+    
+private:
+
+    CVeiNaviPaneControl( CEikStatusPane* aStatusPane );
+    void ConstructL();
+
+// Implementation
+
+    CAknNavigationDecorator* CreateTimeLabelNaviL();
+    CVeiTimeLabelNavi* GetTimeLabelControl();
+    CAknVolumeControl* GetVolumeControl();
+    static TInt HideVolumeCallbackL(TAny* aPtr);
+    void HideVolume();    
+    
+private: // data
+
+    /**
+     * Ref to StatusPane.
+     * Not own.
+     */
+	CEikStatusPane* iStatusPane;
+	 
+    /**
+     * Ref to NaviPane.
+     * Not own.
+     */
+	CAknNavigationControlContainer* iNaviPane;	
+    
+    /**
+     * Time Navi item.
+     * Own.
+     */
+	CAknNavigationDecorator* iTimeNavi; 
+	
+	/**
+     * Volume navi decorator.
+     * Own.
+     */
+	CAknNavigationDecorator* iVolumeNavi;
+	
+	/**
+     * Volume navi decorator.
+     * Own.
+     */
+	CPeriodic* iVolumeHider;
+
+	/**
+     * Ref to observer.
+     * Not own.
+     */	
+	MVeiNaviPaneControlObserver* iObserver;		
+    };
+
+
+#endif // C_CVEINAVIPANECONTROL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/rom/SimpleCutVideo.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+#ifdef RD_S60_SIMPLE_VIDEO_EDITOR
+
+#ifndef __SIMPLECUTVIDEO_IBY__
+#define __SIMPLECUTVIDEO_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+// Application
+S60_APP_EXE(VedSimpleCutVideo)
+S60_APP_AIF_RSC(VedSimpleCutVideo)
+S60_APP_AIF_ICONS(VedSimpleCutVideo)
+
+#endif	// __SIMPLECUTVIDEO_IBY__
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/rom/SimpleCutVideo_resource.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#ifdef RD_S60_SIMPLE_VIDEO_EDITOR
+
+#ifndef __SIMPLECUTVIDEOEDITORRESOURCES_IBY__
+#define __SIMPLECUTVIDEOEDITORRESOURCES_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+S60_APP_RESOURCE(VedSimpleCutVideo)
+S60_APP_CAPTION(VedSimpleCutVideo)
+
+#endif	// __SIMPLECUTVIDEOEDITORRESOURCES_IBY__
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/src/VeiSimpleCutVideoApp.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+
+// INCLUDE FILES
+#include <eikstart.h>
+// User includes
+#include "VeiSimpleCutVideoApp.h"
+#include "VeiSimpleCutVideoDocument.h"
+#include "VideoEditorCommon.h"  // Application UID
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+//
+// ---------------------------------------------------------
+// NewApplication() 
+// Constructs CVeiApp
+// Returns: created application object
+// ---------------------------------------------------------
+//
+EXPORT_C CApaApplication* NewApplication()
+    {
+    return new CVeiSimpleCutVideoApp;
+    }
+
+// ---------------------------------------------------------
+// E32Main()
+// Starts the exe
+// ---------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+	{
+	return EikStart::RunApplication(NewApplication);
+	}
+
+// ---------------------------------------------------------
+// CVeiApp::AppDllUid()
+// Returns application UID
+// ---------------------------------------------------------
+//
+TUid CVeiSimpleCutVideoApp::AppDllUid() const
+    {
+    return KUidSimpleCutVideo;
+    }
+
+   
+// ---------------------------------------------------------
+// CVeiApp::CreateDocumentL()
+// Creates CVeiDocument object
+// ---------------------------------------------------------
+//
+CApaDocument* CVeiSimpleCutVideoApp::CreateDocumentL()
+    {
+    return CVeiSimpleCutVideoDocument::NewL( *this );
+    }
+
+// --------------------------------------------------------- 
+// CVeiApp::OpenIniFileLC( RFs& aFs ) 
+// Enables INI file creation 
+// Returns: 
+// --------------------------------------------------------- 
+// 
+CDictionaryStore* CVeiSimpleCutVideoApp::OpenIniFileLC( RFs& aFs ) const 
+    { 
+    //Opens the application’s ini file if it exists. 
+    //If an ini file does not exist for this application, 
+    //or if it is corrupt, this function creates a new ini file 
+    //and opens that. ini files are located on KIniFileDrive (by default, c:), 
+    //in the same directory as the application DLL. 
+
+    return CEikApplication::OpenIniFileLC( aFs ); 
+    } 
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/src/VeiSimpleCutVideoAppUi.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,333 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+// INCLUDE FILES
+// System includes
+#include <avkon.hrh>
+#include <eikmenup.h>
+#include <eikenv.h>
+#include <hlplch.h>     // HlpLauncher
+#include <VedSimpleCutVideo.rsg>
+#include <stringloader.h>
+#include <bautils.h>
+#include <mgfetch.h> 
+#include <data_caging_path_literals.hrh>
+
+// User includes
+#include "VedSimpleCutVideo.hrh"
+#include "veisimplecutvideoappui.h"
+#include "veisimplecutvideoview.h"
+
+#include "VeiTempMaker.h"
+#include "VideoEditorCommon.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ----------------------------------------------------------
+// CVeiSimpleCutVideoAppUi::ConstructL()
+// ?implementation_description
+// ----------------------------------------------------------
+//
+void CVeiSimpleCutVideoAppUi::ConstructL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::ConstructL: In");
+
+   	BaseConstructL( EAppOrientationAutomatic|EAknEnableSkin|EAknEnableMSK );
+	
+	CVeiTempMaker* maker = CVeiTempMaker::NewL();
+	maker->EmptyTempFolder();
+	delete maker;
+	
+/*
+*	Cut video view and Cut audio view are references to edit video view and
+*	ownerships must be transfered(AddViewL(...)) to CAknViewAppUi(this) 
+*	AFTER references are taken to edit video view. Otherwise exit is not clean.
+*/
+
+
+// Cut Video view	    
+	/*iSimpleMergeView = CVeiSimpleCutVideoView::NewLC( ClientRect() );
+	AddViewL( iSimpleMergeView );  // transfer ownership to CAknViewAppUi
+	CleanupStack::Pop( iSimpleMergeView );
+	*/
+
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::ConstructL: Out");
+    }
+
+// ----------------------------------------------------
+// CVeiSimpleCutVideoAppUi::~CVeiSimpleCutVideoAppUi()
+// Destructor
+// Frees reserved resources
+// ----------------------------------------------------
+//
+CVeiSimpleCutVideoAppUi::~CVeiSimpleCutVideoAppUi()
+    {
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::~CVeiSimpleCutVideoAppUi()");
+	}
+	
+void CVeiSimpleCutVideoAppUi::Exit()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::Exit(): In");
+
+	TRAP_IGNORE ( 
+		CVeiTempMaker* maker = CVeiTempMaker::NewL();
+		maker->EmptyTempFolder();
+		delete maker; 
+		);
+
+	CAknAppUiBase::Exit();
+	
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::Exit(): Out");
+	}
+
+//=============================================================================
+CVeiSimpleCutVideoAppUi::CVeiSimpleCutVideoAppUi()
+	{
+	}
+
+//=============================================================================
+void CVeiSimpleCutVideoAppUi::CutVideoL( TBool aDoOpen, const RFile& aFile )
+	{
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::CutVideoL: In");
+
+	// Cut Video view
+	if ( !iSimpleCutVideoView )
+		{		
+		CVeiSimpleCutVideoView* simpleCutVideoView = 
+		    new (ELeave) CVeiSimpleCutVideoView;
+		CleanupStack::PushL( simpleCutVideoView );
+		simpleCutVideoView->ConstructL();
+		iSimpleCutVideoView = simpleCutVideoView;
+	    TFileName filename;
+	    User::LeaveIfError( aFile.FullName(filename) );
+	    simpleCutVideoView->AddClipL( filename, aDoOpen );
+		
+		AddViewL(simpleCutVideoView);
+		CleanupStack::Pop( simpleCutVideoView );
+		iVolume = -1;		// Volume not set
+
+	   	iCoeEnv->RootWin().EnableScreenChangeEvents(); 
+
+		SetDefaultViewL( *simpleCutVideoView );   
+		ActivateLocalViewL(simpleCutVideoView->Id());		
+		}
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::CutVideoL: Out");
+	}
+
+// ----------------------------------------------------
+// CVeiSimpleCutVideoAppUi::HandleKeyEventL(
+//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
+// ?implementation_description
+// ----------------------------------------------------
+//
+TKeyResponse CVeiSimpleCutVideoAppUi::HandleKeyEventL(
+    const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
+    {
+    return EKeyWasNotConsumed;
+    }
+
+
+// ----------------------------------------------------
+// CVeiSimpleCutVideoAppUi::HandleCommandL(TInt aCommand)
+// ?implementation_description
+// ----------------------------------------------------
+//
+void CVeiSimpleCutVideoAppUi::HandleCommandL( TInt aCommand )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::HandleCommandL( %d ): In", aCommand);
+    
+    switch ( aCommand )
+        {
+        //
+        // Context Sensitive Help launching for:
+        //  -'Settings' view
+        //  -'Trim for MMS' view
+        //  -'Edit video' view
+        //  -'Cut video' view
+        //  -'Cut audio' view
+        //
+    case EAknCmdHelp:        
+    case EVeiCmdCutVideoViewHelp:
+            {
+            // Get the current context
+            CArrayFix<TCoeHelpContext>* context = AppHelpContextL();
+
+            // Launch the help application with current context topic
+            HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
+                                                 context );
+            break;
+            }
+    case EAknSoftkeyBack:
+    case EEikCmdExit:
+    case EAknSoftkeyExit:
+    case EAknCmdExit:
+            {
+            iOnTheWayToDestruction = ETrue;
+            
+            CVeiTempMaker* maker = CVeiTempMaker::NewL();
+            maker->EmptyTempFolder();
+            delete maker;
+				
+            Exit();
+            break;
+            }
+        default:
+            break;      
+        }
+        LOG(KVideoEditorLogFile, "CVeiAppUi::HandleCommandL: Out");
+    }
+
+//=============================================================================
+void CVeiSimpleCutVideoAppUi::ReadSettingsL( TVeiSettings& aSettings ) const
+	{
+	LOG(KVideoEditorLogFile, "CVeiAppUi::ReadSettingsL: in");
+	CDictionaryStore* store = Application()->OpenIniFileLC( iCoeEnv->FsSession() );
+
+	TBool storePresent = store->IsPresentL( KUidVideoEditor );	// UID has an associated stream?
+
+	if( storePresent ) 
+		{
+		RDictionaryReadStream readStream;
+		readStream.OpenLC( *store, KUidVideoEditor );
+
+		readStream >> aSettings;	// Internalize data to TVeiSettings.
+		
+		CleanupStack::PopAndDestroy( &readStream );
+		}
+	else {
+		// In the case of simple cut, the video name is generated automatically
+		// when saving is started.
+		aSettings.DefaultVideoName() = KNullDesC;
+
+		/* Read the default snapshot filename from resource */
+		const CFont* myFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+		HBufC*	snapshotName = iEikonEnv->AllocReadResourceLC( R_VEI_SETTINGS_VIEW_SETTINGS_ITEM2_VALUE );
+		aSettings.DefaultSnapshotName() = AknTextUtils::ChooseScalableText(snapshotName->Des(), *myFont, 400 );
+		CleanupStack::PopAndDestroy( snapshotName );
+
+		/* Memory card is used as a default target */
+		aSettings.MemoryInUse() = CAknMemorySelectionDialog::EMemoryCard;
+
+         /* Set save quality to "Auto" by default. */
+        aSettings.SaveQuality() = TVeiSettings::EAuto;
+
+		RDictionaryWriteStream writeStream;
+		writeStream.AssignLC( *store, KUidVideoEditor );
+
+		writeStream << aSettings;
+
+		writeStream.CommitL();
+
+		store->CommitL();
+		
+		CleanupStack::PopAndDestroy( &writeStream );	
+		}
+	CleanupStack::PopAndDestroy( store );
+	LOG(KVideoEditorLogFile, "CVeiAppUi::ReadSettingsL: out");
+	}
+
+//=============================================================================
+void CVeiSimpleCutVideoAppUi::WriteSettingsL( const TVeiSettings& aSettings ) 
+	{
+	LOG(KVideoEditorLogFile, "CVeiAppUi::WriteSettingsL: in");
+	CDictionaryStore* store = Application()->OpenIniFileLC( iCoeEnv->FsSession() );
+
+	RDictionaryWriteStream writeStream;
+	writeStream.AssignLC( *store, KUidVideoEditor );
+	writeStream << aSettings;
+	writeStream.CommitL();
+
+	store->CommitL();
+
+	CleanupStack::PopAndDestroy( &writeStream );
+	CleanupStack::PopAndDestroy( store );
+	LOG(KVideoEditorLogFile, "CVeiAppUi::WriteSettingsL: out");
+	}
+
+//=============================================================================
+void CVeiSimpleCutVideoAppUi::HandleScreenDeviceChangedL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::HandleScreenDeviceChangedL: In");
+
+	CAknAppUi::HandleScreenDeviceChangedL();
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::HandleScreenDeviceChangedL: Out");
+	}
+
+//=============================================================================
+void CVeiSimpleCutVideoAppUi::HandleResourceChangeL(TInt aType)
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::HandleResourceChangeL: In");
+	CAknAppUi::HandleResourceChangeL(aType);
+	if ( iSimpleCutVideoView )
+		{
+		iSimpleCutVideoView->HandleResourceChange(aType);
+		}
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::HandleResourceChangeL: Out");
+	}
+
+//=============================================================================
+void CVeiSimpleCutVideoAppUi::HandleFileNotificationEventL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::HandleFileNotificationEventL: In");
+	/*if ( iSimpleCutVideoView )
+		{
+		if( iSimpleCutVideoView->WaitMode() == CVeiEditVideoView::EProcessingMovieSaveThenQuit )
+			{
+			HandleCommandL( EAknCmdExit );
+			}
+		}*/
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::HandleFileNotificationEventL: Out");
+	}
+
+//=============================================================================
+void CVeiSimpleCutVideoAppUi::HandleForegroundEventL  ( TBool aForeground )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::HandleForegroundEventL: In: %d", aForeground);
+	CAknViewAppUi::HandleForegroundEventL( aForeground );
+	if ( !aForeground )
+		{
+		// Set the priority to low. This is needed to handle the situations 
+		// where the engine is performing heavy processing while the application 
+		// is in background.
+		RProcess myProcess;
+		iOriginalProcessPriority = myProcess.Priority();
+		LOGFMT3(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::HandleForegroundEventL: changing priority of process %Ld from %d to %d", myProcess.Id().Id(), iOriginalProcessPriority, EPriorityLow);
+		myProcess.SetPriority( EPriorityLow );
+		iProcessPriorityAltered = ETrue;
+		}
+	else if ( iProcessPriorityAltered )
+		{
+		// Return to normal priority.
+		RProcess myProcess;
+		TProcessPriority priority = myProcess.Priority();
+		if ( priority < iOriginalProcessPriority )
+			{
+			myProcess.SetPriority( iOriginalProcessPriority );
+			}
+		iProcessPriorityAltered = EFalse;
+		LOGFMT2(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::HandleForegroundEventL: process %Ld back to normal priority %d", myProcess.Id().Id(), priority);
+		}
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoAppUi::HandleForegroundEventL: Out");
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/src/VeiSimpleCutVideoContainer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1981 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+// INCLUDE FILES
+// System includes
+#include <VedSimpleCutVideo.rsg>
+#include <videoeditoruicomponents.mbg>
+#include <eikbtgpc.h>
+#include <vedvideoclipinfo.h>
+#include <coemain.h>
+#include <eikenv.h>
+//#include <CMGXFileManager.h>
+//#include <MGXFileManagerFactory.h>
+#include <aknsbasicbackgroundcontrolcontext.h> 
+#include <aknsdrawutils.h> 
+#include <aknsdatacontext.h> 
+#include <stringloader.h>
+#include <aknnotewrappers.h> 
+#include <pathinfo.h> 
+#include <eikprogi.h>
+#include <aknlayoutscalable_avkon.cdl.h>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <CAknMemorySelectionDialog.h> 
+#include <CAknFileNamePromptDialog.h> 
+#include <AknCommonDialogsDynMem.h> 
+#include <CAknMemorySelectionDialogMultiDrive.h> 
+#include <apgcli.h>
+#include <csxhelp/vided.hlp.hrh>
+
+#ifdef RD_TACTILE_FEEDBACK 
+#include <touchfeedback.h>
+#endif /* RD_TACTILE_FEEDBACK  */
+
+// User includes
+#include "VeiSimpleCutVideoAppUi.h"
+#include "VeiCutterBar.h"
+#include "VeiSimpleCutVideoContainer.h"
+#include "VeiSimpleCutVideoView.h"
+#include "veitextdisplay.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorUtils.h"
+#include "VeiErrorUi.h"
+#include "VedSimpleCutVideo.hrh"
+
+#define KMediaGalleryUID3           0x101F8599 
+
+// ================= MEMBER FUNCTIONS =======================
+void CleanupRarray( TAny* object )
+	{
+	(( RImageTypeDescriptionArray*)object)->ResetAndDestroy();
+	}
+
+CVeiSimpleCutVideoContainer* CVeiSimpleCutVideoContainer::NewL( const TRect& aRect, CVeiSimpleCutVideoView& aView, CVeiErrorUI& aErrorUI )
+    {
+    CVeiSimpleCutVideoContainer* self = CVeiSimpleCutVideoContainer::NewLC( aRect, aView, aErrorUI );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CVeiSimpleCutVideoContainer* CVeiSimpleCutVideoContainer::NewLC( const TRect& aRect, CVeiSimpleCutVideoView& aView, CVeiErrorUI& aErrorUI )
+    {
+    CVeiSimpleCutVideoContainer* self = new (ELeave) CVeiSimpleCutVideoContainer( aRect, aView, aErrorUI );
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect, aView, aErrorUI );
+    return self;
+    }
+
+void CVeiSimpleCutVideoContainer::ConstructL( const TRect& aRect, CVeiSimpleCutVideoView& /*aView*/, CVeiErrorUI& /*aErrorUI*/ )
+    {
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::ConstructL: in");
+	CreateWindowL();
+
+	iState = EStateInitializing;
+	iFrameReady = EFalse;
+	iPlayOrPlayMarked = EFalse;
+
+	iSeekPos = TTimeIntervalMicroSeconds( 0 );
+	iSeeking = EFalse;
+	iCutVideoBar = CVeiCutterBar::NewL( this );
+
+	iConverter = CVeiImageConverter::NewL( this );
+	iTakeSnapshot = EFalse;
+	iVideoDisplay = CVeiVideoDisplay::NewL( iDisplayRect, this, *this );
+
+	TFileName mbmPath( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) );	
+
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+		iCutTimeDisplay = CVeiTextDisplay::NewL( iCutTimeDisplayRect, this );
+               
+		// A new icon. Temporarely same bitmap is used for non touch pause as in touch devices
+		// A new icon has been requested and it should be changed here as soon as it's in the build
+		AknIconUtils::CreateIconL( iPauseBitmap, iPauseBitmapMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded_pause, 
+				EMbmVideoeditoruicomponentsQgn_indi_vded_pause_mask );
+		}
+	else
+		{
+		AknIconUtils::CreateIconL( iPlayBitmap, iPlayBitmapMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded2_play, 
+				EMbmVideoeditoruicomponentsQgn_indi_vded2_play_mask );
+				
+		AknIconUtils::CreateIconL( iPauseBitmap, iPauseBitmapMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded2_pause, 
+				EMbmVideoeditoruicomponentsQgn_indi_vded2_pause_mask );
+		}
+
+    SetRect( aRect );
+
+	iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse );
+	iVideoBarTimer = CPeriodic::NewL( CActive::EPriorityLow );
+
+#ifdef RD_TACTILE_FEEDBACK 
+    iTouchFeedBack = MTouchFeedback::Instance();    
+#endif /* RD_TACTILE_FEEDBACK  */     
+
+	iRemConTarget = CVeiRemConTarget::NewL( *this );
+
+	EnableDragEvents();
+
+    ActivateL();
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::ConstructL: out");
+    }
+
+CVeiSimpleCutVideoContainer::CVeiSimpleCutVideoContainer( 
+    const TRect& /*aRect*/, CVeiSimpleCutVideoView& aView, 
+    CVeiErrorUI& aErrorUI ) : iView( aView ), iErrorUI( aErrorUI )
+	{
+	}
+
+CVeiSimpleCutVideoContainer::~CVeiSimpleCutVideoContainer()
+    {
+	if ( iCutVideoBar )
+		{
+		delete iCutVideoBar;
+		}
+	if ( iBgContext )
+		{
+		delete iBgContext;
+		}
+	if ( iVideoDisplay )
+		{
+		delete iVideoDisplay;
+		}
+	if ( iCutTimeDisplay )
+		{
+		delete iCutTimeDisplay;
+		}
+	if ( iVideoClipInfo )
+		{
+		delete iVideoClipInfo;
+		iVideoClipInfo = NULL;
+		}
+	if ( iConverter )
+		{
+		iConverter->Cancel();
+		delete iConverter;
+		}
+	if ( iVideoBarTimer )
+		{
+		iVideoBarTimer->Cancel();
+		delete iVideoBarTimer;
+		}
+
+	if ( iProgressDialog )
+		{
+		delete iProgressDialog;
+		iProgressDialog = NULL;
+		}
+	if ( iSaveToFileName )
+		{
+		delete iSaveToFileName;
+		iSaveToFileName = NULL;
+		}
+
+	delete iCallBackSaveSnapshot;
+	delete iCallBackTakeSnapshot;
+
+	if ( iPlayBitmap )
+		{
+		delete iPlayBitmap;
+		}
+	if ( iPlayBitmapMask )
+		{
+		delete iPlayBitmapMask;
+		}
+	delete iPauseBitmap;
+	delete iPauseBitmapMask;
+
+	delete iRemConTarget;
+    }
+
+void CVeiSimpleCutVideoContainer::DialogDismissedL( TInt aButtonId )
+	{
+	if ( aButtonId == -1 )
+        { // when pressing cancel button.
+		CancelSnapshotSave();
+        }
+	iTakeSnapshot = EFalse;
+	}
+
+void CVeiSimpleCutVideoContainer::SizeChanged()
+    {
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SizeChanged(): In");
+	TSize videoScreenSize;
+    TRect rect( Rect() ); 
+	if ( iBgContext )
+		{
+		iBgContext->SetRect( rect );
+		}
+	LOGFMT2(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SizeChanged(): Rect(): %d,%d", rect.iBr.iX, rect.iBr.iY);
+
+	TInt variety = 0;
+	if (VideoEditorUtils::IsLandscapeScreenOrientation())
+		{
+		variety = 1;
+		}
+
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+		// Progress bar
+		TAknLayoutRect progressBarLayout; 
+		progressBarLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded_slider_pane());
+		iCutVideoBar->SetComponentRect(CVeiCutterBar::EProgressBar, progressBarLayout.Rect());
+
+	    TAknLayoutRect sliderLeftEndLayout;
+	    TAknLayoutRect sliderRightEndLayout;
+	    if ( AknLayoutUtils::LayoutMirrored () )
+	        {
+	        // left end of the slider when that part is unselected
+	    	sliderLeftEndLayout.LayoutRect( progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g4() );
+	    	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, sliderLeftEndLayout.Rect() );
+	    	
+	    	// right end of the slider when that part is unselected
+	    	sliderRightEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g3());
+	    	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon, sliderRightEndLayout.Rect() );	
+	        }
+	    else
+	        {
+	        // left end of the slider when that part is unselected
+	    	sliderLeftEndLayout.LayoutRect( progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g3() );
+	    	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, sliderLeftEndLayout.Rect() );
+	    	
+	    	// right end of the slider when that part is unselected
+	    	sliderRightEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g4());
+	    	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon, sliderRightEndLayout.Rect() );	
+	        }
+
+		// middle part of the slider when that part is unselected	
+		TAknLayoutRect sliderMiddleLayout;
+		sliderMiddleLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g5());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon, sliderMiddleLayout.Rect() );		
+	    				
+		// left end of the cut selection slider 
+		TAknLayoutRect sliderSelectedLeftEndLayout;
+		sliderSelectedLeftEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g3());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderSelectedLeftEndIcon, sliderSelectedLeftEndLayout.Rect() );
+			
+		// middle part of the cut selection slider 
+		TAknLayoutRect sliderSelectedMiddleLayout;
+		sliderSelectedMiddleLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g5());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon, sliderSelectedMiddleLayout.Rect() );		
+		
+		// right end of the cut selection slider 
+		TAknLayoutRect sliderSelectedRightEndLayout;
+		sliderSelectedRightEndLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g4());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderSelectedRightEndIcon, sliderSelectedRightEndLayout.Rect() ); 
+
+	    // playhead
+	    TAknLayoutRect playheadLayout;
+		playheadLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g1());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::EPlayheadIcon, playheadLayout.Rect() ); 
+
+	    // left/right border of cut selection slider
+	    TAknLayoutRect cutAreaBorderLayout;
+		cutAreaBorderLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded_slider_pane_g2());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::ECutAreaBorderIcon, cutAreaBorderLayout.Rect() ); 
+			
+		TAknLayoutText startTimeTextLayout;
+		TAknLayoutText endTimeTextLayout;
+		TAknLayoutRect startTimeIconLayout;
+		TAknLayoutRect endTimeIconLayout;
+
+		// Video Display	
+		TAknLayoutRect videoDisplayLayout;
+		videoDisplayLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded_video_pane());
+		iVideoDisplay->SetRect(videoDisplayLayout.Rect());
+		
+		iDisplayRect = videoDisplayLayout.Rect();	
+		iIconDisplayRect = videoDisplayLayout.Rect();
+		LOGFMT2(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SizeChanged(): iDisplayRect: %d,%d", iDisplayRect.iBr.iX, iDisplayRect.iBr.iY);
+
+		//CVeiCutterBar	    
+	    TRect cutBarRect( sliderLeftEndLayout.Rect().iTl, sliderRightEndLayout.Rect().iBr );
+	    iCutVideoBar->SetRect( cutBarRect );
+			
+		TInt iconWidth = STATIC_CAST( TInt, rect.iBr.iX * 0.07954545455 );
+		AknIconUtils::SetSize( iPauseBitmap, TSize(iconWidth,iconWidth), EAspectRatioNotPreserved );
+		}
+	else
+		{
+		// Progress bar
+		TAknLayoutRect progressBarLayout; 
+		progressBarLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded2_slider_pane(variety));
+
+		TAknLayoutRect progressBGLayout; 
+		progressBGLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane());
+		iCutVideoBar->SetComponentRect(CVeiCutterBar::EProgressBar, progressBGLayout.Rect());
+
+	    TAknLayoutRect sliderLeftEndLayout;
+	    TAknLayoutRect sliderRightEndLayout;
+	    if ( AknLayoutUtils::LayoutMirrored () )
+	        {
+	        // left end of the slider when that part is unselected
+	    	sliderLeftEndLayout.LayoutRect( progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g2());
+	    	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, sliderLeftEndLayout.Rect() );
+	    	
+	    	// right end of the slider when that part is unselected
+	    	sliderRightEndLayout.LayoutRect(progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g1());
+	    	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon, sliderRightEndLayout.Rect() );	
+
+	        }
+	    else
+	        {
+	        // left end of the slider when that part is unselected
+	    	sliderLeftEndLayout.LayoutRect( progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g1());
+	    	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderLeftEndIcon, sliderLeftEndLayout.Rect() );
+	    	
+	    	// right end of the slider when that part is unselected
+	    	sliderRightEndLayout.LayoutRect(progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g2());
+	    	iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderRightEndIcon, sliderRightEndLayout.Rect() );	
+	        }
+
+		// middle part of the slider when that part is unselected	
+		TAknLayoutRect sliderMiddleLayout;
+		sliderMiddleLayout.LayoutRect(progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g3());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderMiddleIcon, sliderMiddleLayout.Rect() );		
+	    				
+		// middle part of the cut selection slider 
+		TAknLayoutRect sliderSelectedMiddleLayout;
+		sliderSelectedMiddleLayout.LayoutRect(progressBGLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_bg_pane_g3());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::ESliderSelectedMiddleIcon, sliderSelectedMiddleLayout.Rect() );		
+
+	    // playhead
+	    TAknLayoutRect playheadLayout;
+		playheadLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_pane_g3());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::EPlayheadIcon, playheadLayout.Rect() ); 
+
+	    // left/right border of cut selection slider
+	    TAknLayoutRect cutAreaBorderLayout;
+		cutAreaBorderLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_pane_g1());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::EStartMarkIcon, cutAreaBorderLayout.Rect() ); 
+		cutAreaBorderLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::vded2_slider_pane_g2());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::EEndMarkIcon, cutAreaBorderLayout.Rect() ); 
+
+		// Video Display	
+		TAknLayoutRect videoDisplayLayout;
+		videoDisplayLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::vded_video_pane());
+		iVideoDisplay->SetRect(videoDisplayLayout.Rect());
+		
+		iDisplayRect = videoDisplayLayout.Rect();	
+		iIconDisplayRect = videoDisplayLayout.Rect();
+		LOGFMT2(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SizeChanged(): iDisplayRect: %d,%d", iDisplayRect.iBr.iX, iDisplayRect.iBr.iY);
+
+		// CVeiCutterBar	    
+	    TRect cutBarRect( progressBarLayout.Rect().iTl, progressBarLayout.Rect().iBr );
+	    iCutVideoBar->SetRect( cutBarRect );
+
+		// pause icon		
+		TAknLayoutRect iconLayout;
+		iconLayout.LayoutRect(Rect(),AknLayoutScalable_Apps::main_vded2_pane_g2(variety));
+		iIconDisplayRect = iconLayout.Rect();
+		AknIconUtils::SetSize( iPlayBitmap, iIconDisplayRect.Size(), EAspectRatioNotPreserved );
+		AknIconUtils::SetSize( iPauseBitmap, iIconDisplayRect.Size(), EAspectRatioNotPreserved );
+
+		// cut bar touch areas
+	    TAknLayoutRect touchAreaLayout;
+		touchAreaLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::aid_size_touch_vded2_playhead());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::EPlayheadTouch, touchAreaLayout.Rect() ); 
+		touchAreaLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::aid_size_touch_vded2_start());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::EStartMarkTouch, touchAreaLayout.Rect() ); 
+		touchAreaLayout.LayoutRect(progressBarLayout.Rect(),AknLayoutScalable_Apps::aid_size_touch_vded2_end());
+		iCutVideoBar->SetComponentRect( CVeiCutterBar::EEndMarkTouch, touchAreaLayout.Rect() ); 
+		}
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SizeChanged(): Out");
+	}
+
+TTypeUid::Ptr CVeiSimpleCutVideoContainer::MopSupplyObject( TTypeUid aId )
+	{
+	if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext )
+		{
+		return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+		}
+	return CCoeControl::MopSupplyObject( aId );
+	}
+
+TInt CVeiSimpleCutVideoContainer::CountComponentControls() const
+    {
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+	    return 3; 
+		}
+	else
+		{
+	    return 2; 
+		}
+    }
+
+CCoeControl* CVeiSimpleCutVideoContainer::ComponentControl( TInt aIndex ) const
+    {
+    switch ( aIndex )
+        {
+        case 0:
+			return iCutVideoBar;
+		case 1:
+			return iVideoDisplay;
+		case 2:
+			return iCutTimeDisplay;
+        default:
+            return NULL;
+        }
+    }
+
+void CVeiSimpleCutVideoContainer::Draw( const TRect& aRect ) const
+    {
+    CWindowGc& gc = SystemGc();
+	// draw skin background
+	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+	MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );	
+	AknsDrawUtils::Background( skin, cc, this, gc, aRect );
+
+    if ( EStatePlaying != iState && EStatePlayingMenuOpen != iState
+         && AknLayoutUtils::PenEnabled() )
+		{
+		gc.BitBltMasked( iIconDisplayRect.iTl, iPlayBitmap, 
+			TRect(iIconDisplayRect.Size()), 
+			iPlayBitmapMask, EFalse );
+		}
+	else if ( ( EStatePlaying == iState || EStatePlayingMenuOpen == iState )
+	          && AknLayoutUtils::PenEnabled() )
+		{		
+		gc.BitBltMasked( iIconDisplayRect.iTl, iPauseBitmap, 
+			TRect(iIconDisplayRect.Size()), 
+			iPauseBitmapMask, EFalse );
+		}
+
+	if ( EStatePaused == iState && !AknLayoutUtils::PenEnabled() )
+		{		
+ 		TPoint pauseIconTl = TPoint( iIconDisplayRect.iTl.iX - STATIC_CAST( TInt, Rect().iBr.iX*0.105),
+			iIconDisplayRect.iTl.iY + STATIC_CAST( TInt, Rect().iBr.iY*0.178 ));
+		gc.BitBltMasked( pauseIconTl, iPauseBitmap, 
+			TRect( TPoint(0,0), iPauseBitmap->SizeInPixels() ), 
+			iPauseBitmapMask, EFalse );
+		}
+	}
+
+// ----------------------------------------------------------------------------
+// CVeiSimpleCutVideoContainer::GetHelpContext(...) const
+//
+// Gets the control's help context. Associates the control with a particular
+// Help file and topic in a context sensitive application.
+// ----------------------------------------------------------------------------
+//
+void CVeiSimpleCutVideoContainer::GetHelpContext( TCoeHelpContext& aContext ) const
+    {
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetHelpContext(): In");
+
+    // Set UID of the CS Help file (same as application UID).
+    aContext.iMajor = KUidVideoEditor;
+
+    // Set the context/topic.
+    aContext.iContext = KVIE_HLP_CUT;
+
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetHelpContext(): Out");
+    }
+
+
+void CVeiSimpleCutVideoContainer::HandleControlEventL(
+    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CVeiSimpleCutVideoContainer::HandlePointerEventL
+// From CCoeControl
+// ----------------------------------------------------------------------------
+//		
+void CVeiSimpleCutVideoContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent )
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandlePointerEventL(): In");
+	if( AknLayoutUtils::PenEnabled() && iCutVideoBar )
+		{
+		CCoeControl::HandlePointerEventL( aPointerEvent );
+
+		switch( aPointerEvent.iType )
+			{
+			case TPointerEvent::EButton1Down:
+				{
+				iButtonDownPoint = aPointerEvent.iPosition;
+				iIsMarkDrag = EFalse;
+				iIsMarkTapped = EFalse;
+				iIsIconOrDisplayTapped = EFalse;
+				TRect startMarkRect = iCutVideoBar->StartMarkRect();
+				TRect endMarkRect = iCutVideoBar->EndMarkRect();				
+				TRect playheadRect = iCutVideoBar->PlayHeadRect();
+				// check if the pen goes down inside the start mark
+				if (startMarkRect.Contains(aPointerEvent.iPosition)) 
+					{
+					iIsMarkTapped = ETrue;
+					iTappedMark = EStartMark;		
+					iCutVideoBar->SetPressedComponent( CVeiCutterBar::EPressedStartMarkTouch );					
+					}
+				// check if the pen goes down inside the end mark	
+				else if (endMarkRect.Contains(aPointerEvent.iPosition))
+					{
+					iIsMarkTapped = ETrue;
+					iTappedMark = EEndMark;
+					iCutVideoBar->SetPressedComponent( CVeiCutterBar::EPressedEndMarkTouch );
+					}					
+				// check if the pen goes down inside the playhead	
+				else if (playheadRect.Contains(aPointerEvent.iPosition))
+					{
+					iIsMarkTapped = ETrue;
+					iTappedMark = EPlayHead;
+					iCutVideoBar->SetPressedComponent( CVeiCutterBar::EPressedPlayheadTouch );					
+					}					
+                else if ( iDisplayRect.Contains( iButtonDownPoint ) ||
+                          iIconDisplayRect.Contains( iButtonDownPoint ) )
+                    {
+                    iIsIconOrDisplayTapped = ETrue;
+                    }
+                    
+                if ( iIsMarkTapped )
+                	{
+    	            DrawDeferred();	    	            
+                	}    	        	       
+
+#ifdef RD_TACTILE_FEEDBACK 
+					if ( iTouchFeedBack && ( iIsMarkTapped || iIsIconOrDisplayTapped ))
+	                	{
+			            iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic );
+	                	}
+#endif /* RD_TACTILE_FEEDBACK  */	
+				
+//				TRect progressBarRect(iCutVideoBar->ProgressBarRect());	
+				// check if the pen goes down inside the progress bar				
+//				if( progressBarRect.Contains( aPointerEvent.iPosition ) )
+//					{
+//					iIsMarkDrag = EFalse;					
+//					}
+				break;
+				}
+			case TPointerEvent::EDrag:
+				{
+				if (iIsMarkTapped)
+					{
+					TRect touchRect(iCutVideoBar->ProgressBarRect());
+					TRect smallRect(iCutVideoBar->EndMarkRect());
+					TInt pressPoint = aPointerEvent.iPosition.iX;
+					TBool dragMarks = ETrue;
+					if (iTappedMark == EStartMark)
+						{
+							pressPoint += iCutVideoBar->StartMarkRect().Width()/2;
+						}
+					if (iTappedMark == EEndMark)
+						{
+							pressPoint -= iCutVideoBar->StartMarkRect().Width()/2;
+						}
+					if (iTappedMark == EPlayHead)
+						{
+							smallRect = iCutVideoBar->PlayHeadRect();
+							dragMarks = EFalse;
+						}
+					touchRect.iTl.iY = smallRect.iTl.iY;
+					touchRect.iBr.iY = smallRect.iBr.iY;
+					HandleProgressBarTouchL( touchRect, 
+											 pressPoint,
+											 dragMarks,
+											 iTappedMark );
+					iIsMarkDrag = ETrue;
+					}
+				break;		
+				}
+			case TPointerEvent::EButton1Up:
+				{
+				// pen up event is handled if it wasn't dragged
+//				if (!iIsMarkDrag)
+				if (0)
+					{
+					TRect progressBarRect(iCutVideoBar->ProgressBarRect());					
+					// Check if pressed position is in progress bar's rect
+					if( progressBarRect.Contains( aPointerEvent.iPosition ) )
+						{
+						HandleProgressBarTouchL( progressBarRect, 
+											 aPointerEvent.iPosition.iX,
+											 EFalse);
+						}
+					}
+				
+				if ((iDisplayRect.Contains(aPointerEvent.iPosition) && 
+				    iDisplayRect.Contains(iButtonDownPoint)) ||
+					(iIconDisplayRect.Contains(aPointerEvent.iPosition) && 
+				    iIconDisplayRect.Contains(iButtonDownPoint)))
+				    {			        	        
+				    HandleVideoClickedL();
+				    }
+				    iCutVideoBar->SetPressedComponent( CVeiCutterBar::ENoPressedIcon );
+				    DrawDeferred();
+				break;
+				}		
+			default:
+				{
+				break;	
+				}	
+			}
+		}	
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandlePointerEventL(): Out");		
+	}
+
+
+// ----------------------------------------------------------------------------
+// CVeiSimpleCutVideoContainer::HandleProgressBarTouchL
+// 
+// ----------------------------------------------------------------------------
+//	
+void CVeiSimpleCutVideoContainer::HandleProgressBarTouchL( TRect aPBRect, 
+												 TInt aPressedPoint,
+												 TBool aDragMarks,
+												 CVeiSimpleCutVideoContainer::TCutMark aCutMark )
+	{
+	if ( (AknLayoutUtils::PenEnabled()) && ( iState!=EStateInitializing ))
+		{	
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleProgressBarTouchL(): In");
+
+		if (iState == EStatePlaying)		
+			{
+			PauseL();	
+			}
+		
+		// Progress Bar start and end points, and length
+		TInt pbEndPoint( aPBRect.iBr.iX );
+		TInt pbStartPoint = ( aPBRect.iTl.iX );		
+		TInt totalPBLength( pbEndPoint - pbStartPoint );
+				
+		// calculate the time position from the tapped progress bar coordinates 
+		TTimeIntervalMicroSeconds newPosition( 
+										( ( aPressedPoint - pbStartPoint ) * 
+							  			iVideoClipInfo->Duration().Int64() ) / 
+							  			totalPBLength );
+		if (newPosition >= iVideoClipInfo->Duration())
+			{
+			newPosition = TTimeIntervalMicroSeconds( iVideoClipInfo->Duration().Int64() - 1 );
+			}
+		if (newPosition <= 0)
+			{
+			newPosition = 0;
+			}
+
+		TBool movePlayhead = ETrue;
+		
+		// move cut marks
+		if (aDragMarks)
+			{
+			movePlayhead = EFalse;
+			//one sec buffer:
+			const TUint markBuffer = ((KMinCutVideoLength *  totalPBLength) / iVideoClipInfo->Duration().Int64());
+			// check that the start mark doesn't go past the end mark - 1 sec buffer
+			// and not to the beginning	
+			if ((aCutMark == EStartMark) && 
+			    (newPosition.Int64() >= 0) &&
+				(aPressedPoint < (iCutVideoBar->EndMarkPoint() - markBuffer ) /*- 2*iCutVideoBar->EndMarkRect().Width()*/))
+				{				
+				iView.MoveStartOrEndMarkL(newPosition, EStartMark);				
+				iCutVideoBar->SetInPoint( newPosition );
+				movePlayhead = ETrue;
+				}
+			// check that the end mark doesn't go before the start mark - +1 sec buffer
+			// and not too close to the beginning			
+			else if ((aCutMark == EEndMark) && 
+				(newPosition.Int64() >= KMinCutVideoLength) &&			
+				(aPressedPoint > (iCutVideoBar->StartMarkPoint() + markBuffer)/* + 2*iCutVideoBar->StartMarkRect().Width()*/))                
+				{				
+				iView.MoveStartOrEndMarkL(newPosition, EEndMark);				
+				iCutVideoBar->SetOutPoint( newPosition );
+				movePlayhead = ETrue;
+				}
+			}
+				
+		// move playhead
+//		else if (( newPosition != iLastPosition ) && !aDragMarks)
+		if (( newPosition != iLastPosition ) && movePlayhead)
+			{
+			iLastPosition = newPosition;
+
+			iSeekPos = TTimeIntervalMicroSeconds( newPosition );
+
+			iCutVideoBar->SetCurrentPoint( (static_cast<TInt32>(iSeekPos.Int64() / 1000)));
+			iVideoDisplay->SetPositionL( iSeekPos );
+			GetThumbAtL( iSeekPos );
+					
+			iView.UpdateTimeL();
+			}	
+		
+		iView.UpdateCBAL(iState);
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleProgressBarTouchL(): Out");
+			
+		}// PenEnabled
+		
+	}
+
+
+void CVeiSimpleCutVideoContainer::PlayL( const TDesC& aFilename )
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PlayL: in");
+	iVideoDisplay->SetPositionL( iSeekPos );
+	
+	if (iVideoClipInfo && !iFrameReady)
+		{								
+		iVideoClipInfo->CancelFrame();
+		}
+	iVideoDisplay->PlayL( aFilename );
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PlayL: out");
+	}
+
+void CVeiSimpleCutVideoContainer::PlayMarkedL( const TDesC& aFilename,
+									const TTimeIntervalMicroSeconds& aStartTime, 
+									const TTimeIntervalMicroSeconds& aEndTime )
+	{
+	LOGFMT3(KVideoEditorLogFile, "CVeisimpleCutVideoContainer::PlayMarkedL, In, aStartTime:%Ld, aEndTime:%Ld, aFilename:%S", aStartTime.Int64(), aEndTime.Int64(), &aFilename);
+	iPlayOrPlayMarked = ETrue;
+
+	if (iVideoClipInfo && !iFrameReady)
+		{								
+		iVideoClipInfo->CancelFrame();
+		}
+	iVideoDisplay->PlayL( aFilename, aStartTime, aEndTime );
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PlayMarkedL, Out");
+	}
+
+void CVeiSimpleCutVideoContainer::StopL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::StopL, in");
+	iVideoDisplay->Stop( EFalse );
+
+	iSeekPos = TTimeIntervalMicroSeconds( 0 );
+	
+	// When adding a new video clip after saving, PlaybackPositionL() 
+	// returns a value > 0 eventhough the playhead is in the beginning
+	// so iLastPosition has to be set to the beginning.
+	iLastPosition = TTimeIntervalMicroSeconds( 0 ); 
+    
+	SetStateL( EStateStopped );
+	PlaybackPositionL();
+	
+	if (iVideoBarTimer)
+		{		
+		iVideoBarTimer->Cancel();
+		}
+	
+	iCutVideoBar->SetFinishedStatus( ETrue );
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::StopL, in");
+	}
+
+
+void CVeiSimpleCutVideoContainer::TakeSnapshotL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::TakeSnapshotL in");
+	
+	if( !iVideoClipInfo || !iFrameReady )
+		{
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::TakeSnapshotL: 1");
+		if (!iFrameReady)
+			{
+			iTakeSnapshotWaiting = ETrue;	
+			}		
+		return;
+		}
+		
+	iTakeSnapshotWaiting = EFalse;	
+	iTakeSnapshot = ETrue;
+	const TTimeIntervalMicroSeconds& pos = PlaybackPositionL();
+
+	GetThumbAtL( pos );
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::TakeSnapshotL out");
+	}
+
+void CVeiSimpleCutVideoContainer::PauseL( TBool aUpdateCBA )
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PauseL: In");
+
+	if (EStatePlaying == iState)
+		{		
+		iLastPosition = iVideoDisplay->PositionL();					
+		iSeekPos = iLastPosition;
+		// to set next start point
+		iVideoDisplay->SetPositionL(iSeekPos);
+		}
+
+	iVideoDisplay->PauseL();
+	if (iVideoBarTimer)
+		{		
+		iVideoBarTimer->Cancel();
+		}
+
+	#ifdef GET_PAUSE_THUMBNAIL
+	GetThumbAtL( iLastPosition );
+	#endif
+
+	if (EStateStoppedInitial == iState || EStateStopped == iState) 
+		{
+		// just to trigger cba-update
+		SetStateL( iState, aUpdateCBA );
+		}	
+	else if (EStateInitializing != iState) 
+		{
+		SetStateL( EStatePaused, aUpdateCBA );
+		}
+	else
+		{
+		SetStateL( EStateStoppedInitial );
+		}
+			
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PauseL: Out");
+	}
+
+void CVeiSimpleCutVideoContainer::SaveSnapshotL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SaveSnapshotL: In");	
+
+    if (LaunchSavingDialogsL())
+        {		
+        //first we have to encode bitmap
+        // get encoder types 
+        RImageTypeDescriptionArray imageTypes; 
+        iConverter->GetEncoderImageTypesL( imageTypes );	
+
+        CleanupStack::PushL( TCleanupItem( CleanupRarray, &imageTypes ) );
+
+        TInt selectedIdx = 0;
+
+        for( TInt i=0; i<imageTypes.Count(); i++ ) 
+        	{
+        	if ( imageTypes[i]->Description() == KEncoderType )
+        		{
+        		selectedIdx = i;
+        		}
+        	}
+
+        //for cancellation
+        if ( iSaveToFileName )
+        	{
+        	delete iSaveToFileName;
+        	iSaveToFileName = NULL;
+        	}
+        iSaveToFileName = HBufC::NewL( iSnapshotFileName.Length() );
+        *iSaveToFileName = iSnapshotFileName;
+
+        // request the actuall save/encode
+        // asynchronous, the result is reported via callback NotifyCompletion
+        LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SaveSnapshotL: 1, calling iConverter->StartToEncodeL");	
+        iConverter->StartToEncodeL( iSnapshotFileName, 
+        	imageTypes[selectedIdx]->ImageType(), imageTypes[selectedIdx]->SubType());
+
+        CleanupStack::PopAndDestroy( &imageTypes );
+        LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SaveSnapshotL: Out");	
+
+        ShowProgressNoteL();		            
+        }
+	}
+
+
+TBool CVeiSimpleCutVideoContainer::LaunchSavingDialogsL()
+    {
+   	TBool ret = EFalse;	
+	RFs	fs = CCoeEnv::Static()->FsSession();
+	
+	iSnapshotFileName.Zero();
+	iSnapshotFileName.Append( iView.Settings().DefaultSnapshotName() );
+    iSnapshotFileName.Append( _L(".JPEG") );	
+    
+    // Multiple drive support
+#ifdef RD_MULTIPLE_DRIVE
+	TDriveNumber driveNumber;
+    TFileName driveAndPath;
+    CAknMemorySelectionDialogMultiDrive* multiDriveDlg = 
+                                    CAknMemorySelectionDialogMultiDrive::NewL(ECFDDialogTypeSave, EFalse );			
+                                    
+	CleanupStack::PushL(multiDriveDlg);
+	
+	// launch "Select memory" query
+    if (multiDriveDlg->ExecuteL( driveNumber, &driveAndPath, NULL ))
+		{
+		driveAndPath.Append( PathInfo::ImagesPath() );
+			        
+        iSnapshotFileName.Insert(0,driveAndPath);
+
+		// Generate a default name for the new file
+		CApaApplication::GenerateFileName( fs, iSnapshotFileName );	
+				
+		// launch file name prompt dialog
+		if (CAknFileNamePromptDialog::RunDlgLD(iSnapshotFileName, driveAndPath, KNullDesC))
+			{
+			driveAndPath.Append(iSnapshotFileName);
+			iSnapshotFileName = driveAndPath;
+            ret = ETrue;
+            }
+		else
+			{
+			iTakeSnapshot = EFalse;
+			iTakeSnapshotWaiting = EFalse;
+			}
+		}
+	else
+		{
+		iTakeSnapshot = EFalse;
+		iTakeSnapshotWaiting = EFalse;
+		}
+	CleanupStack::PopAndDestroy( multiDriveDlg ); 
+#else // no multiple drive support
+	CAknMemorySelectionDialog::TMemory selectedMemory(CAknMemorySelectionDialog::EPhoneMemory);		
+	// launch "Select memory" query
+	if (CAknMemorySelectionDialog::RunDlgLD(selectedMemory))
+		{
+		// create path for the image	
+		TFileName driveAndPath;        		
+		if (selectedMemory == CAknMemorySelectionDialog::EPhoneMemory)
+			{
+			driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() );
+			driveAndPath.Append( PathInfo::ImagesPath() );							
+			}
+		else if (selectedMemory == CAknMemorySelectionDialog::EMemoryCard)
+			{	
+			driveAndPath.Copy( PathInfo::MemoryCardRootPath() );
+			driveAndPath.Append( PathInfo::ImagesPath() );							
+			}        				 
+        
+        iSnapshotFileName.Insert(0,driveAndPath);
+
+        // Generate a default name for the new file
+        CApaApplication::GenerateFileName( fs, iSnapshotFileName );					
+        
+		// launch file name prompt dialog
+		if (CAknFileNamePromptDialog::RunDlgLD(iSnapshotFileName, driveAndPath, KNullDesC))
+			{
+			driveAndPath.Append(iSnapshotFileName);
+			iSnapshotFileName = driveAndPath;
+            ret = ETrue;
+            }
+		else
+			{
+			iTakeSnapshot = EFalse;
+			iTakeSnapshotWaiting = EFalse;
+			}
+		}
+	else
+		{
+		iTakeSnapshot = EFalse;
+		iTakeSnapshotWaiting = EFalse;
+		}
+#endif
+	return ret;
+    }
+
+void CVeiSimpleCutVideoContainer::CancelSnapshotSave()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CancelSnapshotSave: in");
+	if ( iConverter )
+		{
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CancelSnapshotSave: 1");
+		iConverter->Cancel();
+		iConverter->CancelEncoding(); //also close the file
+		}
+	if ( iSaveToFileName )
+		{
+		LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CancelSnapshotSave: 2, iSaveToFileName:%S", iSaveToFileName);
+
+		RFs&	fs = iEikonEnv->FsSession(); 
+		/*TInt result =*/ fs.Delete( *iSaveToFileName ); 
+		delete iSaveToFileName;
+		iSaveToFileName = NULL;
+		}
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CancelSnapshotSave: out");	
+	}
+
+void CVeiSimpleCutVideoContainer::CloseStreamL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CloseStreamL, in");
+	if( !iFrameReady && iVideoClipInfo )
+		{
+		iVideoClipInfo->CancelFrame();
+		}
+	PlaybackPositionL();
+	iState = EStateStopped;
+	iView.UpdateCBAL(iState);
+	
+	iVideoDisplay->Stop( ETrue );
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::CloseStreamL, out");
+	}
+
+void CVeiSimpleCutVideoContainer::SetInTime( const TTimeIntervalMicroSeconds& aTime )
+	{
+	if ( iCutTimeDisplay )
+		{
+		iCutTimeDisplay->SetCutIn( aTime );
+		}
+	if ( iCutVideoBar )
+		{
+		iCutVideoBar->SetInPoint( aTime );
+		}
+	}
+
+void CVeiSimpleCutVideoContainer::SetOutTime( const TTimeIntervalMicroSeconds& aTime )
+	{
+	if ( iCutTimeDisplay )
+		{
+		iCutTimeDisplay->SetCutOut( aTime );
+		}
+	if ( iCutVideoBar )
+		{
+		iCutVideoBar->SetOutPoint( aTime );
+		}
+	}
+
+TTimeIntervalMicroSeconds CVeiSimpleCutVideoContainer::PlaybackPositionL()
+	{
+	if ( ( iSeeking ) || ( EStateStopped == iState ) )
+		{
+		return iSeekPos;
+		}
+	if ( iState != EStatePlaying  )
+		{
+		return iLastPosition;
+		}
+
+	if ( iVideoClipInfo && (iVideoDisplay->PositionL() < iVideoClipInfo->Duration()) )
+		{
+		iLastPosition = iVideoDisplay->PositionL();
+		}
+
+	if ( ( iLastPosition == TTimeIntervalMicroSeconds( 0 ) ) &&
+		 ( iSeekPos != TTimeIntervalMicroSeconds( 0 ) ) )
+		{
+		return iSeekPos;
+		}
+
+	return iLastPosition;
+	}
+
+TKeyResponse CVeiSimpleCutVideoContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
+	{
+	if ( aType == EEventKeyDown ) 
+		{
+		iKeyRepeatCount = 0;
+		if(aKeyEvent.iScanCode == EStdKeyDevice7) //for camera key
+			{
+			PauseL(ETrue);
+			}
+		TBool shiftKeyPressed = (aKeyEvent.iModifiers & EModifierShift );
+		if( shiftKeyPressed )
+			{
+			if( iView.IsEnoughFreeSpaceToSaveL() && (iTakeSnapshot == EFalse )) 
+				{
+				/*if (EStatePlaying == iState)
+					{
+					PauseL();	
+					}
+				*/	
+				TakeSnapshotL();
+				}
+			return EKeyWasConsumed;
+			}	
+
+		return EKeyWasNotConsumed;
+		}
+	else if ( aType == EEventKeyUp ) 
+		{
+		if ( iSeeking == EFalse )
+			{
+			return EKeyWasNotConsumed;
+			}
+		iLastPosition = iSeekPos;
+		iVideoDisplay->SetPositionL( iSeekPos );
+
+		iSeeking = EFalse;
+
+		if ( ( ( EStateStopped == iState ) || ( EStateStoppedInitial == iState )
+			|| ( EStatePaused == iState )) && 
+			 ( ( iLastKeyCode == EKeyLeftArrow ) || ( iLastKeyCode == EKeyRightArrow ) ) )
+			{
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::OfferKeyEventL: 1, calling GetThumbAtL()");
+			GetThumbAtL( iSeekPos );
+			return EKeyWasConsumed;
+			}
+		else if ( EStatePlaying == iState )
+			{
+			if ( iVideoBarTimer->IsActive() )
+				{
+				iVideoBarTimer->Cancel();
+				}
+
+			if ( iVideoClipInfo &&  (iSeekPos >= iVideoClipInfo->Duration()) )
+				{
+				LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::OfferKeyEventL: 2, calling iVideoDisplay->Stop");
+				iVideoDisplay->Stop( EFalse );
+				}
+			else
+				{
+				iVideoDisplay->SetPositionL( iSeekPos );
+				iVideoDisplay->ShowBlackScreen();
+				if (iVideoClipInfo && !iFrameReady)
+					{								
+					iVideoClipInfo->CancelFrame();
+					}
+				iVideoDisplay->Play();
+				}
+			return EKeyWasConsumed;
+			}
+		else
+			{
+			return EKeyWasConsumed;
+			}
+		}
+	else if ( aType == EEventKey )
+		{
+		iLastKeyCode = aKeyEvent.iCode;
+
+		switch (aKeyEvent.iCode)
+			{
+			case EKeyEnter:
+				{
+			    if ( EStateStoppedInitial == iState )
+					{
+			        iView.HandleCommandL( EVeiCmdCutVideoViewPlay );
+					}
+				else
+					{
+					if ( EStatePlaying == iState || EStatePlayingMenuOpen == iState )
+						{		
+						PauseL();	
+						}
+					iView.ProcessCommandL( EAknSoftkeyOptions );
+					}
+				return EKeyWasConsumed;
+				}
+			case EKeyOK:
+				{
+				iView.HandleCommandL( EAknSoftkeyOk );
+				return EKeyWasConsumed;
+				}
+			case EKeyDownArrow:
+			case EKeyUpArrow:
+				{
+				iVideoDisplay->OfferKeyEventL( aKeyEvent, aType );
+				return EKeyWasConsumed;
+				}
+			case EKeyRightArrow:
+				{
+				iKeyRepeatCount++;
+
+				if ( (iKeyRepeatCount > 2)	&& (iSeeking == EFalse) )
+					{
+					if ( EStatePlaying == iState )
+						{
+						iSeekPos = iVideoDisplay->PositionL();
+						}
+	
+					iVideoDisplay->PauseL();
+					iSeeking = ETrue;
+					iKeyRepeatCount = 0;				
+					}
+
+				if ( iSeeking && ( iState!=EStateInitializing ) &&
+					( iState!=EStatePlayingMenuOpen ) )
+					{
+					TInt adjustment = TimeIncrement( iKeyRepeatCount );
+
+					TInt64 newPos = iSeekPos.Int64() + adjustment;
+					if ( iVideoClipInfo && (newPos > iVideoClipInfo->Duration().Int64()) )
+						{
+						newPos = iVideoClipInfo->Duration().Int64();
+						}
+	
+					iSeekPos = TTimeIntervalMicroSeconds( newPos );
+					
+					iCutVideoBar->SetCurrentPoint( (static_cast<TInt32>(iSeekPos.Int64() / 1000)));
+
+					iView.UpdateTimeL();
+					return EKeyWasConsumed;
+					}
+				return EKeyWasNotConsumed;
+				}
+
+			case EKeyLeftArrow:
+				{
+				iKeyRepeatCount++;
+
+				if ( (iKeyRepeatCount > 2)	&& (iSeeking == EFalse) )
+					{
+					
+					if ( EStatePlaying == iState )
+						{
+						iSeekPos = iVideoDisplay->PositionL();
+						}
+
+					iVideoDisplay->PauseL();
+					iSeeking = ETrue;
+					iKeyRepeatCount = 0;				
+					}
+
+				if ( iSeeking && ( iState!=EStateInitializing ) &&
+					( iState!=EStatePlayingMenuOpen ) )
+					{
+
+					TInt adjustment = TimeIncrement( iKeyRepeatCount );
+
+					TInt64 newPos = iSeekPos.Int64() - adjustment;
+					if ( newPos < 0 ) 
+						{
+						newPos = 0;
+						}
+					iSeekPos = TTimeIntervalMicroSeconds( newPos );	
+
+					iCutVideoBar->SetCurrentPoint( static_cast<TInt32>((iSeekPos.Int64() / 1000)) );
+
+					iView.UpdateTimeL();
+
+					return EKeyWasConsumed;
+					}
+				return EKeyWasNotConsumed;
+		        }
+			case EKeyBackspace:		//Clear 
+				{
+				if (EStatePlaying != iState)
+					{
+					iView.ClearInOutL( ETrue, ETrue );						
+					}
+				
+				return EKeyWasConsumed;
+				}
+			default:
+			    {
+				return EKeyWasNotConsumed;
+		        }
+			}
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+	}
+
+TInt CVeiSimpleCutVideoContainer::TimeIncrement(TInt aKeyCount) const
+	{
+	if ( aKeyCount < 3 )
+		{
+		return 100000;
+		}
+	else if ( aKeyCount < 4 )
+		{
+		return 300000;
+		}
+	else if ( aKeyCount < 5 )
+		{
+		return 500000;
+		}
+	else if ( aKeyCount < 10 )
+		{
+		return 1000000;
+		}
+	else if ( aKeyCount < 13 )
+		{
+		return 2000000;
+		}
+	else if ( aKeyCount < 15 )
+		{
+		return 3000000;
+		}
+	else
+		{
+		return 5000000;
+		}	
+	}
+
+TInt CVeiSimpleCutVideoContainer::UpdateProgressNote()
+    {
+    TTime intervalTime;
+    intervalTime.HomeTime();
+    intervalTime += TTimeIntervalMicroSeconds( 50000 );
+    TTime currentTime;
+    currentTime.HomeTime();
+    while ( intervalTime > currentTime )
+        {
+        currentTime.HomeTime();
+        }
+
+    iProgressDialog->GetProgressInfoL()->IncrementAndDraw( 1 );
+
+    if ( KProgressbarFinalValue <= iProgressDialog->GetProgressInfoL()->CurrentValue() )
+        {
+        return 0;
+        }
+    return 1;
+    }
+
+
+void CVeiSimpleCutVideoContainer::GetThumbL( const TDesC& aFilename )
+	{
+	if ( iVideoClipInfo )
+		{
+		delete iVideoClipInfo;
+		iVideoClipInfo = NULL;		
+		}
+
+	/*iVideoClipInfo = */CVedVideoClipInfo::NewL( aFilename, *this );
+	}
+
+
+void CVeiSimpleCutVideoContainer::GetThumbAtL( const TTimeIntervalMicroSeconds& aTime )
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: In");
+	if( !iVideoClipInfo )
+		{
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: 1");
+		return;
+		}
+	if ( !iFrameReady )
+		{
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: 1.5");
+		iVideoClipInfo->CancelFrame();
+		}
+
+	TRect clipResolution = iVideoClipInfo->Resolution();
+	TSize resolution( iVideoDisplay->Size() );
+
+	TInt frameIndex;
+	TInt totalFrameCount;
+
+	frameIndex = iVideoClipInfo->GetVideoFrameIndexL( aTime );
+	totalFrameCount = iVideoClipInfo->VideoFrameCount();
+
+	if ( frameIndex > totalFrameCount )
+		{
+		frameIndex = totalFrameCount;
+		}
+
+	//Generates a thumbnail bitmap of the given frame from video clip
+	if ( iTakeSnapshot )
+		{
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: 2");
+		TDisplayMode displayMode = ENone;
+		TBool enhance = EFalse;
+		TSize resol( clipResolution.iBr.iX, clipResolution.iBr.iY ); 
+    	/* :
+	     check out on every phone before releasing whether videodisplay should be stopped before starting
+	     asynchronous GetFrameL()
+	     see how EStateGettingFrame is handled in SetPreviewState 
+	     Stopping frees memory and it is needed in memory sensible devices 
+	    */
+		iVideoClipInfo->GetFrameL( *this, frameIndex, &resol ); //, displayMode, enhance );
+		SetStateL( EStateGettingFrame );
+		iFrameReady = EFalse;			
+//		ShowProgressNoteL();		
+		}
+	else
+		{
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: 3");
+		/* :
+	     check out on every phone before releasing whether videodisplay should be stopped before starting
+	     asynchronous GetFrameL()
+	     see how EStateGettingFrame is handled in SetPreviewState 
+	     Stopping frees memory and it is needed in memory sensible devices 
+	    */
+		TSize resol( clipResolution.iBr.iX, clipResolution.iBr.iY );
+		iVideoClipInfo->GetFrameL( *this, frameIndex, &resol ); 
+		SetStateL( EStateGettingFrame );
+		iFrameReady = EFalse;		
+		}
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::GetThumbAtL: out");	
+	}
+
+void CVeiSimpleCutVideoContainer::NotifyCompletion( TInt aErr ) 
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyCompletion: In, aErr:%d", aErr);	
+
+	if (EStateTerminating == iState)
+		{
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyCompletion(): 1, app is closing...");
+		return;
+		}
+
+    if ( KErrNone == aErr )
+        {
+        //Update notification to Media Gallery
+        LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyCompletion: 2");
+
+	    if (iProgressDialog)
+		    {
+		    TRAP_IGNORE(iProgressDialog->GetProgressInfoL()->SetAndDraw( KProgressbarFinalValue );
+		    			iProgressDialog->ProcessFinishedL());
+		    }
+        }
+    else
+		{
+		if (iProgressDialog)
+			{
+		    TRAP_IGNORE(iProgressDialog->GetProgressInfoL()->SetAndDraw( KProgressbarFinalValue );
+		    			iProgressDialog->ProcessFinishedL());
+		    }
+		iErrorUI.ShowGlobalErrorNote( aErr );
+		}
+
+	//  to eliminate previous (wrong) output file from being deleted in CancelSnapshotSave()
+	delete iSaveToFileName;
+    iSaveToFileName = NULL;
+
+	// to fix progress bar shadow
+	DrawDeferred();
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyCompletion: Out");
+	}
+
+void CVeiSimpleCutVideoContainer::NotifyVideoClipInfoReady( CVedVideoClipInfo& aInfo, 
+										  TInt aError )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeisimpleCutVideoContainer::NotifyVideoClipInfoReady, In, aError:%d", aError);
+	if (KErrNone == aError)
+		{
+		if (iVideoClipInfo)		
+			{
+			delete iVideoClipInfo;
+			iVideoClipInfo = NULL;	
+			}
+		iVideoClipInfo = &aInfo;	
+
+		TRect clipResolution = iVideoClipInfo->Resolution();
+		iDuration = iVideoClipInfo->Duration();
+		iCutVideoBar->SetTotalDuration( iDuration );
+		iView.DrawTimeNaviL();
+
+		TSize resolution( clipResolution.iBr.iX, clipResolution.iBr.iY ); 
+		iFrameReady = EFalse;
+		iVideoClipInfo->GetFrameL( *this, 0, &resolution );
+		}
+	SetStateL( EStateStoppedInitial );			
+	LOG(KVideoEditorLogFile, "CVeisimpleCutVideoContainer::NotifyVideoClipInfoReady, Out");
+	}
+
+
+void CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted(CVedVideoClipInfo& /*aInfo*/, 
+											   TInt aError, 
+							 				   CFbsBitmap* aFrame)
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted, In, aError:%d", aError);
+	iFrameReady = ETrue;
+	
+	if (EStateGettingFrame == iState)
+		{
+		SetStateL(iPreviousState);			
+		}		
+	
+	if (KErrNone == aError && aFrame)
+		{
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted 1");	
+
+		if ( iTakeSnapshot )
+			{
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted 2");			
+			iConverter->SetBitmap( aFrame );
+			if (! iCallBackSaveSnapshot)
+				{		
+				TCallBack cb (CVeiSimpleCutVideoContainer::AsyncSaveSnapshot, this);
+				iCallBackSaveSnapshot = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard);
+				}
+			iCallBackSaveSnapshot->CallBack();
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted 3");
+			}
+		else
+			{
+			LOG(KVideoEditorLogFile, "CVeisimpleCutVideoContainer::NotifyVideoClipFrameCompleted 4");
+			TRAP_IGNORE(iVideoDisplay->ShowPictureL( *aFrame ));
+			delete aFrame;
+			aFrame = NULL;
+			
+			if (iTakeSnapshotWaiting)
+				{
+				if (! iCallBackTakeSnapshot)
+					{		
+					TCallBack cb (CVeiSimpleCutVideoContainer::AsyncTakeSnapshot, this);
+					iCallBackTakeSnapshot = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard);
+					}
+				iCallBackTakeSnapshot->CallBack();				
+				}
+			}
+		}
+	else
+		{
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted 5");
+		if (aFrame)	
+			{
+			delete aFrame;
+			aFrame = NULL;	
+			}
+		
+		if (iProgressDialog)
+			{
+			iProgressDialog->GetProgressInfoL()->SetAndDraw( KProgressbarFinalValue );
+		    TRAP_IGNORE(iProgressDialog->ProcessFinishedL());
+			}		
+		}
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoClipFrameCompleted, Out");	
+	}
+
+TInt CVeiSimpleCutVideoContainer::AsyncSaveSnapshot(TAny* aThis)
+	{
+    LOG( KVideoEditorLogFile, "CVeiSimpleCutVideoView::AsyncSaveSnapshot in");
+	
+    // In the asynchronous version, trap the rest of the functions 
+    // to make sure that the caller's TRequestStatus is always 
+    // completed, also in case of failures.
+	CVeiSimpleCutVideoContainer* container = static_cast<CVeiSimpleCutVideoContainer*>(aThis);
+	TInt err = KErrNone;
+	TRAP(err, container->SaveSnapshotL());
+	LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::AsyncSaveSnapshot 2, err:%d", err);
+	
+	if (KErrNone != err)
+		{
+		container->StopProgressDialog();
+		container->ShowGlobalErrorNote(err);
+		}  
+	LOG( KVideoEditorLogFile, "CVeiEditVideoView::AsyncSaveSnapshot 3, returning");
+	return KErrNone;				
+	}		
+	
+void CVeiSimpleCutVideoContainer::ShowGlobalErrorNote(const TInt aErr)
+	{		
+	iErrorUI.ShowGlobalErrorNote( aErr );
+	}
+
+void CVeiSimpleCutVideoContainer::StopProgressDialog()
+	{
+	if (iProgressDialog)
+	    {
+	    TRAP_IGNORE(iProgressDialog->GetProgressInfoL()->SetAndDraw( KProgressbarFinalValue );
+	    			iProgressDialog->ProcessFinishedL());
+	    }	
+	}
+
+void CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo )
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, In");
+	
+	if (EStateTerminating == iState)
+		{
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent(): 1, app is closing...");
+		return;
+		}
+	
+	switch (aEvent)
+		{
+		case MVeiVideoDisplayObserver::ELoadingStarted:
+			{	
+			SetStateL(EStateOpening);
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::ELoadingStarted");
+			break;
+			}
+		case MVeiVideoDisplayObserver::EOpenComplete:
+			{
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EOpenComplete 1");		
+            iVideoDisplay->SetRotationL( EVideoRotationNone );
+			TTimeIntervalMicroSeconds cutInTime = iView.GetVideoClipCutInTime();
+			TTimeIntervalMicroSeconds cutOutTime = iView.GetVideoClipCutOutTime();
+
+			if ( iView.IsForeground() )
+				{				
+				if (iVideoClipInfo && !iFrameReady)
+					{								
+					iVideoClipInfo->CancelFrame();
+					}							
+				if ( iPlayOrPlayMarked )
+					{
+					LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EOpenComplete 2");					
+					iVideoDisplay->PlayMarkedL( cutInTime, cutOutTime );
+					}
+				else
+					{
+					LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EOpenComplete 3");	
+					iVideoDisplay->Play();
+					}
+				iPlayOrPlayMarked = EFalse;				
+				}
+			else
+				{
+				LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EOpenComplete 4");					
+				PauseL();					
+				}	
+			break;
+			}
+		case MVeiVideoDisplayObserver::EBufferingStarted:
+			{
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EBufferingStarted");			
+			SetStateL( EStateBuffering );
+			if ( iVideoBarTimer )
+                {
+                iVideoBarTimer->Cancel();
+                }
+			break;
+			}	
+		case MVeiVideoDisplayObserver::ELoadingComplete:
+			{
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::ELoadingComplete 1");
+			// if VED is put to background in the middle of the buffering
+			// iVideoDisplay->PauseL(); cannot be called during the buffering, so its called here
+			if (EStatePaused == iState)
+				{
+				iVideoDisplay->PauseL();	
+				}
+			else
+				{							
+				SetStateL( EStatePlaying );						
+				if (iVideoClipInfo && !iFrameReady)
+					{								
+					LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::ELoadingComplete 2");
+					iVideoClipInfo->CancelFrame();
+					}
+				if ( !iVideoBarTimer->IsActive() )
+					{
+					LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::ELoadingComplete 3");				
+					const TUint delay = 100000;
+					iVideoBarTimer->Start( delay, delay, TCallBack( CVeiSimpleCutVideoContainer::DoAudioBarUpdate, this ) );
+					}
+				iVideoDisplay->ShowBlackScreen();			
+				DrawDeferred();
+				}
+			break;
+			}
+		case MVeiVideoDisplayObserver::EPlayComplete:
+			{
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EPlayComplete");
+			iVideoDisplay->SetBlackScreen( EFalse );			
+			iSeekPos = TTimeIntervalMicroSeconds( 0 );
+
+			iLastPosition = TotalLength();
+			iView.StopNaviPaneUpdateL();
+			iCutVideoBar->SetFinishedStatus( ETrue );
+			
+			if (iVideoBarTimer)
+				{
+				iVideoBarTimer->Cancel();	
+				}			
+
+			GetThumbAtL(0);
+			iVideoDisplay->Stop( ETrue );
+			SetStateL( EStateStopped );
+			
+			if (KErrNoMemory == aInfo || KErrSessionClosed == aInfo)
+				{
+				iErrorUI.ShowGlobalErrorNote( aInfo );					
+				StopL();
+				CloseStreamL();
+				}
+
+			DrawDeferred();
+			break;
+			}
+		case MVeiVideoDisplayObserver::EStop:
+			{
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EStop");
+			
+			if (EStateGettingFrame == iState)
+	            {
+	            break;	
+	            }	           
+			
+			if ( iVideoBarTimer )
+                {                
+                iVideoBarTimer->Cancel();
+                }
+			iSeekPos = TTimeIntervalMicroSeconds( 0 );
+
+			GetThumbAtL(0);
+			iLastPosition = TotalLength();
+			iView.StopNaviPaneUpdateL();
+			iCutVideoBar->SetFinishedStatus( ETrue );
+			iVideoDisplay->Stop( ETrue );
+			SetStateL( EStateStopped );
+			DrawDeferred();
+			break;
+			}																
+		case MVeiVideoDisplayObserver::EVolumeLevelChanged:
+			{
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::EVolumeLevelChanged");
+			TInt playerVolume = iVideoDisplay->Volume();
+			iView.ShowVolumeLabelL( playerVolume );
+			break;
+			}
+		case MVeiVideoDisplayObserver::EError:
+			{
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent() MVeiVideoDisplayObserver::EError");
+//			iErrorUI.ShowGlobalErrorNoteL( KErrGeneral );
+			SetStateL( EStateStoppedInitial );
+			break;
+			}	
+		default:
+			{
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, MVeiVideoDisplayObserver::default");
+			break;
+			};
+		}
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::NotifyVideoDisplayEvent, Out");
+	}
+
+
+void CVeiSimpleCutVideoContainer::SetStateL(CVeiSimpleCutVideoContainer::TCutVideoState aState, TBool aUpdateCBA)
+	{
+	LOGFMT2(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SetStateL: in, iState:%d, aState:%d", iState, aState);
+	if (EStateGettingFrame == aState)
+		{
+		iPreviousState = iState;	
+		}
+		
+	iState = aState;
+	if (EStatePaused == iState)
+		{
+		DrawNow();	
+		}
+
+	// If the foreground is lost while an arrow key is down, we do not get
+	// the key up -event, and iSeeking remains true. Reseting it here just in case.
+	iSeeking = EFalse;
+
+	if ( aUpdateCBA )
+		{
+		iView.UpdateCBAL( iState );
+		}
+
+	//#ifdef STOP_PLAYER_DURING_GETFRAME
+	if (EStateGettingFrame == aState)
+		{
+		/* :
+	     check out on every phone before releasing whether videodisplay should be stopped before starting
+	     asynchronous GetFrameL()
+	     see how EStateGettingFrame is handled in SetPreviewState 
+	     Stopping frees memory and it is needed in memory sensible devices 
+	    */	
+		//iVideoDisplay->Stop(ETrue);		    		
+		}
+	//#endif	
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::SetStateL:: out");
+	}
+
+
+void CVeiSimpleCutVideoContainer::MarkedInL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedInL, In");
+	if ( EStateInitializing == iState )
+		{
+		return;
+		}
+	const TTimeIntervalMicroSeconds& position = PlaybackPositionL();
+	iSeekPos = position;
+
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedInL, 2, setting cutINpoint:%Ld", position.Int64());
+	iCutVideoBar->SetInPoint( position	);
+	TInt tempPos = static_cast<TInt32>((position.Int64()/1000));
+	iCutVideoBar->SetCurrentPoint( tempPos );
+
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+		iCutTimeDisplay->SetCutIn( position );
+		}
+
+	PauseL();
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedInL, Out");
+	}
+
+void CVeiSimpleCutVideoContainer::MarkedOutL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedOutL, In");
+	if ( EStateInitializing == iState )
+		{
+		return;
+		}
+	const TTimeIntervalMicroSeconds& position = PlaybackPositionL();
+	iSeekPos = position;
+
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedOutL, 2, setting cutOUTpoint:%Ld", position.Int64());
+	iCutVideoBar->SetOutPoint( position );
+	TInt tempPos = static_cast<TInt32>((position.Int64()/1000));
+	iCutVideoBar->SetCurrentPoint( tempPos );
+
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+		iCutTimeDisplay->SetCutOut( position );
+		}
+
+	PauseL();
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::MarkedOutL, Out");
+	}
+
+void CVeiSimpleCutVideoContainer::ShowInformationNoteL( const TDesC& aMessage ) const
+	{
+	CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
+	note->ExecuteLD( aMessage );
+	}
+
+void CVeiSimpleCutVideoContainer::ShowProgressNoteL() 
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::ShowProgressNoteL, in");
+	iProgressDialog = new ( ELeave ) CAknProgressDialog( REINTERPRET_CAST( CEikDialog**, 
+					&iProgressDialog ), ETrue);
+    iProgressDialog->SetCallback( this );
+    iProgressDialog->PrepareLC( R_VEI_PROGRESS_NOTE_WITH_CANCEL );
+
+	HBufC* stringholder;
+    TApaAppCaption caption;
+    TRAPD( err, ResolveCaptionNameL( caption ) );
+    
+    // If something goes wrong, show basic "Saving" note
+    if ( err )
+        {
+        stringholder = iEikonEnv->AllocReadResourceLC( R_VEI_PROGRESS_NOTE_SAVING );
+        }
+    else
+        {
+        stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_SAVING_IMAGE, caption, iEikonEnv );
+        }        
+
+	iProgressDialog->SetTextL( *stringholder );
+	CleanupStack::PopAndDestroy( stringholder );
+
+    iProgressDialog->GetProgressInfoL()->SetFinalValue( KProgressbarFinalValue );
+    iProgressDialog->RunLD();
+
+	iProgressDialog->GetProgressInfoL()->SetAndDraw( 50 );
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::ShowProgressNoteL, Out");
+	}
+
+//=============================================================================
+void CVeiSimpleCutVideoContainer::ResolveCaptionNameL( TApaAppCaption& aCaption ) const
+    {   
+    RApaLsSession appArcSession;
+    CleanupClosePushL( appArcSession );
+    User::LeaveIfError( appArcSession.Connect() );       	    
+
+    // Get Media Gallery caption
+    TApaAppInfo appInfo;
+    User::LeaveIfError( appArcSession.GetAppInfo( appInfo, TUid::Uid( KMediaGalleryUID3 ) ) );
+
+    aCaption = appInfo.iCaption;
+
+    CleanupStack::PopAndDestroy( &appArcSession );  
+    }
+
+TInt CVeiSimpleCutVideoContainer::DoAudioBarUpdate( TAny* aThis )
+	{
+	STATIC_CAST( CVeiSimpleCutVideoContainer*, aThis )->DoUpdate();
+	return 42;
+	}
+
+void CVeiSimpleCutVideoContainer::DoUpdate()
+	{
+	TTimeIntervalMicroSeconds time;
+	time = iVideoDisplay->PositionL();
+	if ( iSeeking )
+		{
+		time = iSeekPos;
+		LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::DoUpdate(): 1, time:%Ld", time.Int64());
+		}
+	else
+		{			
+		LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::DoUpdate(): 2, time:%Ld", time.Int64());
+		}
+	iCutVideoBar->SetCurrentPoint( static_cast<TInt32>((time.Int64() / 1000)));
+	iCutVideoBar->DrawDeferred();
+	}
+void CVeiSimpleCutVideoContainer::MuteL()
+	{
+	iVideoDisplay->SetMuteL( ETrue );
+	}
+
+//=============================================================================
+void CVeiSimpleCutVideoContainer::HandleVolumeUpL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleVolumeUpL: in");
+
+	iVideoDisplay->AdjustVolumeL( 1 );
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleVolumeUpL: out");
+	}
+	
+	
+void CVeiSimpleCutVideoContainer::SetVolumeLevelL( TInt aVolume )
+    {
+    iVideoDisplay->AdjustVolumeL( aVolume - iVideoDisplay->Volume() );
+    }	
+
+//=============================================================================
+void CVeiSimpleCutVideoContainer::HandleVolumeDownL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleVolumeDownL: in");
+
+	iVideoDisplay->AdjustVolumeL( -1 );
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleVolumeDownL: out");
+	}
+
+//=============================================================================
+void CVeiSimpleCutVideoContainer::PrepareForTerminationL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PrepareForTerminationL: in");
+
+	SetStateL( EStateTerminating );
+
+	if( !iFrameReady && iVideoClipInfo )
+		{
+		iVideoClipInfo->CancelFrame();
+		}
+	iState = EStateTerminating;
+	iVideoDisplay->Stop( ETrue );
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::PrepareForTerminationL: out");
+	}
+
+TInt CVeiSimpleCutVideoContainer::AsyncTakeSnapshot(TAny* aThis)
+	{
+    LOG( KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::AsyncTakeSnapshot");
+	
+    // In the asynchronous version, trap the rest of the functions 
+    // to make sure that the caller's TRequestStatus is always 
+    // completed, also in case of failures.
+	CVeiSimpleCutVideoContainer* container = static_cast<CVeiSimpleCutVideoContainer*>(aThis);
+	TInt err = KErrNone;
+	TRAP(err, container->TakeSnapshotL());
+	LOGFMT( KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::AsyncTakeSnapshot 1, err:%d", err);	
+	User::LeaveIfError(err);		
+	return KErrNone;				
+	}
+
+void CVeiSimpleCutVideoContainer::HandleVideoClickedL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoContainer::HandleVideoClickedL");
+
+    if ( EStatePlaying != iState && EStatePlayingMenuOpen != iState )
+		{
+        iView.HandleCommandL( EVeiCmdCutVideoViewPlay );
+		}
+	else if ( EStatePlaying == iState || EStatePlayingMenuOpen == iState )
+		{		
+		PauseL();	
+//        iView.HandleCommandL( EVeiCmdCutVideoViewStop );
+		}
+    }
+
+void CVeiSimpleCutVideoContainer::FocusChanged( TDrawNow /*aDrawNow*/ )
+	{
+	if (IsFocused())
+		{
+		DrawDeferred();
+		}
+	}
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/src/VeiSimpleCutVideoDocument.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+#include "VeiSimpleCutVideoDocument.h"
+#include "VeiSimpleCutVideoAppUi.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// constructor
+CVeiSimpleCutVideoDocument::CVeiSimpleCutVideoDocument(CEikApplication& aApp)
+: CAknDocument(aApp)    
+    {
+    }
+
+// destructor
+CVeiSimpleCutVideoDocument::~CVeiSimpleCutVideoDocument()
+    {
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoDocument::~CVeiSimpleCutVideoDocument(): In");    
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoDocument::~CVeiSimpleCutVideoDocument(): Out");
+    }
+
+// Default constructor can leave.
+void CVeiSimpleCutVideoDocument::ConstructL()
+    {
+    }
+
+// Two-phased constructor.
+CVeiSimpleCutVideoDocument* CVeiSimpleCutVideoDocument::NewL(
+        CEikApplication& aApp)     // CVeiApp reference
+    {
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoDocument::NewL: In ");
+    
+    CVeiSimpleCutVideoDocument* self = new (ELeave) CVeiSimpleCutVideoDocument( aApp );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoDocument::NewL: Out");
+    return self;
+    }
+
+void CVeiSimpleCutVideoDocument::OpenFileL(CFileStore*& /*aFileStore*/, RFile& aFile)
+ 	{
+ 	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoDocument::OpenFileL: In");
+
+	CleanupClosePushL( aFile );
+
+    // File handle must be closed. Open File Service won't do it. 
+    // Using cleanup stack, because iAppUi->OpenFileL() may leave.
+#ifdef DEBUG_ON
+	TFileName file;
+	User::LeaveIfError( aFile.FullName(file) );
+ 	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoDocument::OpenFileL: %S", &file);
+#endif
+ 
+ 	static_cast<CVeiSimpleCutVideoAppUi*>(CCoeEnv::Static()->AppUi())->CutVideoL(ETrue, aFile);
+	
+	CleanupStack::PopAndDestroy( &aFile ); 
+	
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoDocument::OpenFileL: Out");
+ 	}   
+
+// ----------------------------------------------------
+// CVeiSimpleCutVideoDocument::CreateAppUiL()
+// constructs CVeiSimpleCutVideoAppUi
+// ----------------------------------------------------
+//
+CEikAppUi* CVeiSimpleCutVideoDocument::CreateAppUiL()
+    {
+    return new (ELeave) CVeiSimpleCutVideoAppUi;
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/src/VeiSimpleCutVideoView.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1869 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+// System includes
+#include <aknviewappui.h>
+#include <avkon.hrh>
+#include <vedsimplecutvideo.rsg>
+
+#include <akntitle.h> 
+#include <stringloader.h> 
+#include <aknnotewrappers.h>
+#include <aknquerydialog.h>
+#include <aknlists.h>
+#include <aknPopup.h>
+#include <AknProgressDialog.h>
+#include <eikprogi.h>
+#include <CAknMemorySelectionDialog.h>
+#include <CAknFileNamePromptDialog.h>
+#include <apparc.h>
+#include <aknselectionlist.h>
+#include <sysutil.h>
+#include <aknwaitdialog.h>
+#include <e32property.h>
+#include <PathInfo.h> 
+#include <AknCommonDialogsDynMem.h> 
+#include <CAknMemorySelectionDialogMultiDrive.h> 
+
+// User includes
+#include "VeiSimpleCutVideoAppUi.h"
+#include "VeiSimpleCutVideoView.h"
+#include "VeiSimpleCutVideoContainer.h" 
+#include "VedSimpleCutVideo.hrh"
+#include "veitempmaker.h"
+#include "VeiTimeLabelNavi.h"
+#include "videoeditorcommon.h"
+#include "VideoeditorUtils.h"
+#include "VeiErrorUi.h"
+#include "veinavipanecontrol.h"
+
+void CVeiSimpleCutVideoView::ConstructL()
+    {
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::ConstructL: in");
+
+    BaseConstructL( R_VEI_CUT_VIDEO_VIEW );
+
+	iCVeiNaviPaneControl = CVeiNaviPaneControl::NewL( StatusPane() );
+
+	iErrorUI = CVeiErrorUI::NewL( *iCoeEnv );	
+
+	iTimeUpdater = CPeriodic::NewL( CActive::EPriorityLow );
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::ConstructL: creating iMovie");
+	iMovie = CVedMovie::NewL( NULL );
+	iMovie->RegisterMovieObserverL( this );
+	
+	iTempMaker = CVeiTempMaker::NewL();
+	
+	iOverWriteFile = EFalse;
+	iPaused = EFalse; 
+		
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::ConstructL: out");
+    }
+
+// ---------------------------------------------------------
+TInt CVeiSimpleCutVideoView::AddClipL( const TDesC& aFilename, TBool /*aStartNow*/ )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoView::AddClipL: In: %S", &aFilename);
+	
+	iMovie->InsertVideoClipL( aFilename, 0 );
+	
+	iWaitDialog = new ( ELeave ) CAknWaitDialog( 
+	    REINTERPRET_CAST( CEikDialog**, &iWaitDialog ), ETrue);
+	iWaitDialog->PrepareLC(R_VEI_WAIT_NOTE_WITH_CANCEL);
+	iWaitDialog->SetCallback(this);
+
+	HBufC* stringholder = StringLoader::LoadLC( R_VEI_OPENING, iEikonEnv );
+	iWaitDialog->SetTextL( *stringholder );	
+	CleanupStack::PopAndDestroy(stringholder);
+
+	iWaitDialog->RunLD();
+
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::AddClipL: Out");
+	return KErrNone;
+	}
+    
+
+// ---------------------------------------------------------
+// CVeiSimpleCutVideoView::~CVeiSimpleCutVideoView()
+// ?implementation_description
+// ---------------------------------------------------------
+//
+CVeiSimpleCutVideoView::~CVeiSimpleCutVideoView()
+    {
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::~CVeiSimpleCutVideoView(): In");
+
+	if ( iProgressNote )
+		{
+		delete iProgressNote;
+		iProgressNote = NULL;
+		}
+	if ( iAnimatedProgressDialog )
+		{
+		delete iAnimatedProgressDialog;
+		iAnimatedProgressDialog = NULL;
+		}
+	
+	if (iWaitDialog)
+		{
+		CloseWaitDialog();
+		iWaitDialog->MakeVisible( EFalse );
+		delete iWaitDialog;
+		iWaitDialog = NULL;	
+		}
+    
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+		delete iContainer;
+		iContainer = 0;
+        }	
+	
+	if ( iTimeUpdater )
+		{
+		iTimeUpdater->Cancel();
+		delete iTimeUpdater;
+		}
+		
+	if ( iErrorUI )
+		{
+		delete iErrorUI;
+		}
+			
+	if ( iMovie )
+		{
+		iMovie->Reset();		
+		iMovie->UnregisterMovieObserver( this );			
+		delete iMovie;
+		iMovie = NULL;
+		}
+	
+	if ( iTempMaker )
+		{
+		delete iTempMaker;
+		iTempMaker = NULL;
+		}
+		
+	if ( iSaveToFileName )
+		{
+		delete iSaveToFileName;
+		iSaveToFileName = NULL;
+		}
+				
+	if ( iTempFile )
+		{
+		TInt err = iEikonEnv->FsSession().Delete( *iTempFile );
+		if ( err ) 
+			{
+			// what to do when error occurs in destructor???
+			}
+		delete iTempFile;
+		iTempFile = NULL;
+		}
+	
+	delete iCallBack;	
+	delete iCVeiNaviPaneControl;
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::~CVeiSimpleCutVideoView(): Out");
+    }
+
+TUid CVeiSimpleCutVideoView::Id() const
+     {
+     return TUid::Uid( EVeiSimpleCutVideoView );
+     }
+
+void CVeiSimpleCutVideoView::DialogDismissedL( TInt aButtonId )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DialogDismissedL: In, abuttonId:%d", aButtonId);	
+	if (iSaving)
+		{	
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DialogDismissedL: 2");
+		iSaving = EFalse;	
+		if ( aButtonId != EAknSoftkeyDone )
+			{	
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DialogDismissedL: 3");
+			iMovie->CancelProcessing();
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DialogDismissedL: 4");
+			}
+		else if (KErrNone == iErrorNmb)
+			{	
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DialogDismissedL: 5");
+			iErrorNmb = 0;
+			RFs& fs = iEikonEnv->FsSession();		
+			CFileMan* fileman = CFileMan::NewL( fs );	
+			CleanupStack::PushL( fileman );
+			
+			TInt moveErr( KErrNone );
+
+			// the user selects to overwrite the existing file
+			if (iOverWriteFile) 
+				{
+				// temp file located in the same drive as the target file
+				if ( iTempFile->Left(1) == iMovie->VideoClipInfo( iIndex )->FileName().Left(1) )
+					{
+					moveErr = fileman->Rename( *iTempFile, iMovie->VideoClipInfo( iIndex )->FileName(), CFileMan::EOverWrite ); 
+					}
+				else
+					{
+					moveErr = fileman->Move( *iTempFile, iMovie->VideoClipInfo( iIndex )->FileName(), CFileMan::EOverWrite );
+					}
+				if (!moveErr)
+					{
+					//AddClipL( iMovie->VideoClipInfo( iIndex )->FileName(), NULL );
+					ClearInOutL(ETrue, ETrue); 
+					iContainer->StopL(); 	
+					TTimeIntervalMicroSeconds pos = iContainer->PlaybackPositionL();
+					iContainer->GetThumbL( iMovie->VideoClipInfo( iIndex )->FileName() );		
+					}
+				}
+			// the user selects to save with a new file name						
+			else 
+				{	
+				// both files located in the same drive
+				if ( iTempFile->Left(1) == iSaveToFileName->Left(1) )
+					{
+					moveErr = fileman->Rename( *iTempFile, *iSaveToFileName );	
+					}
+				else
+					{
+					moveErr = fileman->Move( *iTempFile, *iSaveToFileName );	
+					}
+				if (!moveErr)
+					{
+					ClearInOutL(ETrue, ETrue); 
+					iContainer->StopL(); 
+					iMovie->RemoveVideoClip(0);
+					AddClipL( *iSaveToFileName, NULL );
+					}
+				}
+			CleanupStack::PopAndDestroy( fileman ); 
+
+			delete iTempFile;
+			iTempFile = NULL;
+
+			if ( moveErr )
+				{
+				iErrorUI->ShowGlobalErrorNote( moveErr );			
+				}
+			
+			//if ( BaflUtils::FileExists(fs, *iSaveToFileName) )
+			// Checking for iSaveToFileName doesn't work when overwriting so moveErr has to be used. 
+			else
+				{
+				// Video saved successfully!
+				LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DialogDismissedL: 6");
+				
+				// The marks can be removed now that the video is saved
+			//	ClearInOutL(ETrue, ETrue); 
+			//	iContainer->StopL(); 
+				//TTimeIntervalMicroSeconds pos = iContainer->PlaybackPositionL();
+							
+				// Publish & Subscribe API used to make the saved file name available to AIW provider
+				LOG(KVideoEditorLogFile, "CVeiEditVideoView::UpdateMediaGalleryL(): Calling RProperty::Define(KUidVideoEditorProperties, VideoEditor::EPropertyFilename, RProperty::EText); ");
+				TInt err = RProperty::Define(KUidVideoEditorProperties, VideoEditor::EPropertyFilename, RProperty::EText);
+				if (err != KErrAlreadyExists)
+					{
+					User::LeaveIfError(err);
+					}
+				User::LeaveIfError(RProperty::Set(KUidVideoEditorProperties, VideoEditor::EPropertyFilename, iSaveToFileName->Des()));
+
+	
+				// the user has selected "Cut" or "Exit"			
+				if (!iSaveOnly) 
+					{					
+					//AppUi()->Exit();
+					if (! iCallBack)
+						{		
+						TCallBack cb (CVeiSimpleCutVideoView::AsyncExit, this);
+						iCallBack = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard);
+						}
+					iCallBack->CallBack();									
+					}	
+
+				}				
+				LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DialogDismissedL: 7");
+			}
+		else
+			{
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DialogDismissedL: 8");
+			iErrorUI->ShowGlobalErrorNote( iErrorNmb );
+			iErrorNmb = 0;
+			}
+		}
+	else if (KErrCancel != aButtonId && iErrorNmb)
+			{			
+			LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DialogDismissedL: 9");
+			if (KErrCorrupt == iErrorNmb || KErrTooShortVideoForCut == iErrorNmb)
+				{
+				HBufC* stringholder = StringLoader::LoadLC( R_VEI_VIDEO_FAILED, iEikonEnv );								
+				CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+				dlg->ExecuteLD( *stringholder );
+				CleanupStack::PopAndDestroy( stringholder );	
+				}
+			else
+				{				
+				iErrorUI->ShowGlobalErrorNote( iErrorNmb );
+				}
+			
+			if (! iCallBack)
+				{		
+				TCallBack cb (CVeiSimpleCutVideoView::AsyncExit, this);
+				iCallBack = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityStandard);
+				}
+			iCallBack->CallBack();
+			iErrorNmb = 0;
+			}
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DialogDismissedL: Out");
+	}
+		
+TInt CVeiSimpleCutVideoView::AsyncExit(TAny* aThis)
+	{
+    LOG( KVideoEditorLogFile, "CVeiSimpleCutVideoView::AsyncExit");
+
+    // In the asynchronous version, trap the rest of the functions 
+    // to make sure that the caller's TRequestStatus is always 
+    // completed, also in case of failures.
+	CVeiSimpleCutVideoView* view = static_cast<CVeiSimpleCutVideoView*>(aThis);
+	view->PrepareForTermination();
+	view->AppUi()->Exit();
+	return KErrNone;
+	}
+
+void CVeiSimpleCutVideoView::DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane )
+	{
+	TInt state = iContainer->State();
+
+	if (aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU_CLEAR_MARKS)
+		{
+		// delete in, out, in & out as necessary.
+
+		if (iMovie->VideoClipCutInTime(iIndex) <= TTimeIntervalMicroSeconds(0)) 
+			{
+			aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksIn, ETrue);
+			}
+		if (iMovie->VideoClipCutOutTime(iIndex) >= iMovie->VideoClipInfo(iIndex)->Duration()) 
+			{
+			aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksOut, ETrue);
+			}
+
+		if (!((iMovie->VideoClipCutOutTime(iIndex) < iMovie->VideoClipInfo(iIndex)->Duration())
+			&& (iMovie->VideoClipCutInTime(iIndex) > TTimeIntervalMicroSeconds(0))))
+			{
+			aMenuPane->SetItemDimmed(EVeiCmdCutVideoViewClearMarksInOut, ETrue);
+			}
+		}
+
+	if ( aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU )
+		{
+		if ( iPopupMenuOpened != EFalse )
+			{
+			aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewClearMarks, ETrue );
+			aMenuPane->SetItemDimmed( EVeiCmdCutVideoTakeSnapshot, ETrue );
+			aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewHelp, ETrue );
+			}
+		if ( !IsCutMarkSet() )
+			{
+			aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewSave, ETrue );
+			}			
+		}
+	if ( !(( aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU ) ||
+			( aResourceId == R_VEI_CUT_VIDEO_VIEW_CONTEXT_MENU ) ) ) 
+		return;
+
+	if ( iContainer->PlaybackPositionL() >= iContainer->TotalLength() )
+		{
+		if (aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU) 
+			{
+			aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewPlay, ETrue );
+			}
+
+		}
+	if ( ( state == CVeiSimpleCutVideoContainer::EStatePaused ) ||
+			( state == CVeiSimpleCutVideoContainer::EStateInitializing ) )
+		{
+		if (aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU) 
+			{		
+			aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewPlay, ETrue  );
+			}
+		}
+
+	if ( ( state != CVeiSimpleCutVideoContainer::EStateStopped ) && 
+		( state != CVeiSimpleCutVideoContainer::EStateStoppedInitial ) &&
+		( state != CVeiSimpleCutVideoContainer::EStatePaused ) )
+		{
+		if (aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU) 
+			{		
+			aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewPlay, ETrue  );
+			}
+		aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkIn, ETrue  );
+		aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewMarkOut, ETrue  );	
+		}
+	else
+		{
+		TTimeIntervalMicroSeconds pos = iContainer->PlaybackPositionL(); 
+		CVedVideoClipInfo* info = iMovie->VideoClipInfo( iIndex );
+		
+		TInt cutInFrameIndex = info->GetVideoFrameIndexL( iMovie->VideoClipCutInTime( iIndex ));
+		TInt cutOutFrameIndex =	info->GetVideoFrameIndexL( iMovie->VideoClipCutOutTime( iIndex ));
+		TInt videoFrameCount = info->VideoFrameCount();
+		
+		// if we are in the existing start/end mark position the start/end mark is removed from the menu
+		if (info->GetVideoFrameIndexL(pos) == cutInFrameIndex)
+			{
+			aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkIn );	
+			}		
+		else if (info->GetVideoFrameIndexL(pos) == cutOutFrameIndex)
+			{
+			aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkOut );	
+			}	
+		
+		if( cutInFrameIndex < (videoFrameCount-1 ) )
+			{
+			cutInFrameIndex++;
+			}
+
+		if( cutOutFrameIndex > 0 )
+			{
+			cutOutFrameIndex--;
+			}
+
+		TTimeIntervalMicroSeconds nextFramePosCutIn = info->VideoFrameStartTimeL( cutInFrameIndex );
+		TTimeIntervalMicroSeconds previousFramePosCutOut = info->VideoFrameStartTimeL( cutOutFrameIndex );
+
+		if ( pos < nextFramePosCutIn )
+			{
+			aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkOut );	
+			}
+		else 
+			{
+			if ( pos > previousFramePosCutOut )
+				{
+				aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkIn );
+				}
+			}
+		// something crashes somewhere outside VED UI if end mark is put to near to begin				
+		TInt ind = -1;	
+		if (aMenuPane->MenuItemExists(EVeiCmdCutVideoViewMarkOut, ind) && pos.Int64() < KMinCutVideoLength)	
+			{
+			aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewMarkOut );	
+			}	
+		}
+	if ( ( iMovie->VideoClipCutInTime( iIndex ) == TTimeIntervalMicroSeconds( 0 ) && 
+		iMovie->VideoClipCutOutTime( iIndex ) == iMovie->VideoClipInfo( iIndex )->Duration() ) )
+		{
+		aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewPlayMarked );
+		}
+	if ( state != CVeiSimpleCutVideoContainer::EStatePlayingMenuOpen && 
+			state != CVeiSimpleCutVideoContainer::EStatePaused )
+		{
+		aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewContinue );
+		}
+	if ( ( state == CVeiSimpleCutVideoContainer::EStateStopped ) ||
+		 ( state == CVeiSimpleCutVideoContainer::EStateStoppedInitial ) ||
+		 ( state == CVeiSimpleCutVideoContainer::EStateOpening ) ||
+		 ( state == CVeiSimpleCutVideoContainer::EStateBuffering ) )
+		{
+			aMenuPane->DeleteMenuItem( EVeiCmdCutVideoViewStop );
+		}
+
+	if ( ( iMovie->VideoClipCutOutTime( iIndex ) >= iMovie->VideoClipInfo( iIndex )->Duration() ) &&
+		( iMovie->VideoClipCutInTime( iIndex ) <= TTimeIntervalMicroSeconds( 0 ) ) ) 
+		{
+		if (aResourceId == R_VEI_CUT_VIDEO_VIEW_MENU) 
+			{		
+			aMenuPane->SetItemDimmed( EVeiCmdCutVideoViewClearMarks, ETrue );
+			}
+		}
+	}
+
+void CVeiSimpleCutVideoView::HandleCommandL(TInt aCommand)
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoView::HandleCommandL( %d ): In", aCommand);
+
+    switch ( aCommand )
+        {
+		case EAknSoftkeyOk:
+			{
+			iPopupMenuOpened = ETrue;
+			if (iContainer->State() == CVeiSimpleCutVideoContainer::EStatePlaying) 
+				{
+				PausePreviewL();
+				iContainer->SetStateL(CVeiSimpleCutVideoContainer::EStatePlayingMenuOpen);
+				}
+
+			MenuBar()->TryDisplayMenuBarL();
+			if (iContainer->State() == CVeiSimpleCutVideoContainer::EStatePlayingMenuOpen) 
+				{
+				iContainer->SetStateL(CVeiSimpleCutVideoContainer::EStatePaused);
+				}
+			iPopupMenuOpened = EFalse;
+			break;
+			}		
+		case EVeiCmdCutVideoViewBack:
+        case EAknSoftkeyBack:
+        	{	
+        	PrepareForTermination();
+        	AppUi()->Exit();
+        	break;
+        	}
+       	case EVeiCmdCutVideoViewExit: 
+       		{
+            iSaveOnly = EFalse; 
+			StopNaviPaneUpdateL();
+
+			iContainer->StopL();
+			iContainer->CloseStreamL();
+
+			if ( ( iMovie->VideoClipCutInTime( 0 ) > TTimeIntervalMicroSeconds( 0 ) ) ||
+				 ( iMovie->VideoClipCutOutTime( 0 ) < iMovie->VideoClipInfo(0)->Duration() ) )
+				{
+				if (VideoEditorUtils::LaunchSaveChangesQueryL())
+					{
+	            	QueryAndSaveL();	    
+					}				
+				else
+					{
+					PrepareForTermination();
+					AppUi()->Exit();
+					}	
+				}
+			else
+				{
+				PrepareForTermination();
+				AppUi()->Exit();
+				}       		
+       		}
+       		break;
+		case EVeiCmdCutVideoViewCut: 
+            {
+            iSaveOnly = EFalse; 
+			StopNaviPaneUpdateL();
+
+			iContainer->StopL();
+			iContainer->CloseStreamL();
+
+			if ( ( iMovie->VideoClipCutInTime( 0 ) > TTimeIntervalMicroSeconds( 0 ) ) ||
+				 ( iMovie->VideoClipCutOutTime( 0 ) < iMovie->VideoClipInfo(0)->Duration() ) )
+				{
+				QueryAndSaveL(); 
+				}
+            break;
+            }
+        case EVeiCmdCutVideoViewSave:
+        	{
+        	iSaveOnly = ETrue; 
+
+			StopNaviPaneUpdateL();
+			iContainer->StopL();
+			iContainer->CloseStreamL();
+
+        	QueryAndSaveL(); 
+        	break;
+        	}
+        case EVeiCmdCutVideoViewMarkIn:
+            {
+			iCVeiNaviPaneControl->SetPauseIconVisibilityL( ETrue );
+			MarkInL();
+            break;
+            }
+        case EVeiCmdCutVideoViewMarkOut:
+            {
+			iCVeiNaviPaneControl->SetPauseIconVisibilityL( ETrue );
+			MarkOutL();
+            break;
+            }
+        case EVeiCmdCutVideoViewClearMarksInOut:
+            {
+			ClearInOutL( ETrue, ETrue );
+            break;
+            }
+        case EVeiCmdCutVideoViewClearMarksIn:
+            {
+			ClearInOutL( ETrue, EFalse );
+            break;
+            }
+        case EVeiCmdCutVideoViewClearMarksOut:
+            {
+			ClearInOutL( EFalse, ETrue );
+            break;
+            }
+        case EVeiCmdCutVideoViewPlayMarked:
+            {
+			iCVeiNaviPaneControl->SetPauseIconVisibilityL( EFalse );
+			PlayMarkedL();
+            break;
+            }
+		case EVeiCmdCutVideoViewPlay:
+			{
+			iCVeiNaviPaneControl->SetPauseIconVisibilityL( EFalse );
+			PlayPreviewL();
+			break;
+			}
+		case EVeiCmdCutVideoViewStop:
+			{
+			iCVeiNaviPaneControl->SetPauseIconVisibilityL( EFalse );
+			StopNaviPaneUpdateL();
+			iContainer->StopL();
+			break;
+			}
+		case EVeiCmdCutVideoViewContinue:
+            {
+			iCVeiNaviPaneControl->SetPauseIconVisibilityL( EFalse );
+			PlayPreviewL();
+            break;
+            }
+		case EVeiCmdCutVideoTakeSnapshot:
+			{
+			if( IsEnoughFreeSpaceToSaveL() )
+				{
+				iContainer->TakeSnapshotL();
+				}
+			break;
+			}
+        
+        //
+        // Options->Help
+        //
+        case EVeiCmdCutVideoViewHelp:
+            {
+            // CS Help launching is handled in Video Editor's AppUi.
+            AppUi()->HandleCommandL( EVeiCmdCutVideoViewHelp );
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::HandleCommandL: out");
+    }
+
+void CVeiSimpleCutVideoView::NotifyMovieProcessingStartedL( CVedMovie& /*aMovie*/ )
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::NotifyMovieProcessingStartedL: In");	
+	iProcessed = 0;
+	// @ : r_ved_cutting_note_animation
+	//StartAnimatedProgressNote();
+	StartProgressNoteL();
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::NotifyMovieProcessingStartedL: Out");	
+	}
+
+void CVeiSimpleCutVideoView::NotifyMovieProcessingProgressed( CVedMovie& /*aMovie*/, TInt aPercentage )
+	{
+	//Not allow screensaver, when processing image.
+	User::ResetInactivityTime();
+	
+	iProcessed = aPercentage;
+	if (iAnimatedProgressDialog)
+		{		
+		iAnimatedProgressDialog->GetProgressInfoL()->SetAndDraw( aPercentage );
+		}
+   	else if (iProgressNote)
+	   	{   		
+		iProgressNote->GetProgressInfoL()->SetAndDraw( aPercentage );
+	   	}
+	}
+
+void CVeiSimpleCutVideoView::NotifyMovieProcessingCompleted( CVedMovie& /*aMovie*/, TInt aError )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoView::NotifyMovieProcessingCompleted: In, aError:%d", aError);			
+	iErrorNmb = aError;
+	if (iAnimatedProgressDialog)
+		{
+   		iAnimatedProgressDialog->GetProgressInfoL()->SetAndDraw( 100 );	
+		delete iAnimatedProgressDialog;
+		iAnimatedProgressDialog = NULL;
+		DialogDismissedL(EAknSoftkeyDone);
+		//TRAP_IGNORE( iAnimatedProgressDialog->ProcessFinishedL() );
+		}
+	else if (iProgressNote)
+		{
+		iProgressNote->GetProgressInfoL()->SetAndDraw(100);		
+		iProgressNote->ProcessFinishedL();
+		}
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::NotifyMovieProcessingCompleted: Out");	
+	}
+
+void CVeiSimpleCutVideoView::NotifyVideoClipAdded( CVedMovie& /*aMovie*/, TInt aIndex)
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::NotifyVideoClipAdded: In");	
+
+	iErrorNmb = 0;
+	
+	TTimeIntervalMicroSeconds duration = iMovie->Duration();
+	LOGFMT(KVideoEditorLogFile, "CVeiCutVideCVeiSimpleCutVideoView::NotifyVideoClipAdded, 2, duration:%Ld", duration.Int64());
+//	if (duration.Int64() < KMinCutVideoLength)
+//		{
+//		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::NotifyVideoClipAdded: 3");	
+//		iErrorNmb = KErrTooShortVideoForCut;			
+//		iClosing = ETrue;
+//		}
+//	else
+		{
+		iAudioMuted = !( iMovie->VideoClipEditedHasAudio( aIndex ) );	
+
+		iCVeiNaviPaneControl->SetPauseIconVisibilityL( EFalse );
+
+		if ( iAudioMuted  )
+			{
+			iCVeiNaviPaneControl->SetVolumeIconVisibilityL( EFalse );
+			VolumeMuteL();
+			}
+		else
+			{
+			iCVeiNaviPaneControl->SetVolumeIconVisibilityL( ETrue );
+			}
+			
+//		iContainer->SetInTime( iMovie->VideoClipCutInTime( aIndex ) );
+//		iContainer->SetOutTime( iMovie->VideoClipCutOutTime( aIndex ) );	
+		iContainer->GetThumbL( iMovie->VideoClipInfo( iIndex )->FileName() );		
+		}
+
+	if (iWaitDialog)
+		{
+		delete iWaitDialog;
+		iWaitDialog = NULL;	
+		}
+//	CloseWaitDialog();
+	iContainer->DrawDeferred();
+
+	// video clip has to be added before setting the title pane text	
+	// : handle leave
+	SetTitlePaneTextL(); 
+			
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::NotifyVideoClipAdded: Out");		
+	}
+
+void CVeiSimpleCutVideoView::NotifyVideoClipAddingFailed( CVedMovie& /*aMovie*/, TInt aError )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoView::NotifyVideoClipAddingFailed: In, aError:%d", aError);	
+	iErrorNmb = aError;	
+	iClosing = ETrue;
+	
+	CloseWaitDialog();
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::NotifyVideoClipAddingFailed: Out");			
+	}
+
+void CVeiSimpleCutVideoView::NotifyVideoClipRemoved( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyVideoClipIndicesChanged( CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, 
+									           TInt /*aNewIndex*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyVideoClipTimingsChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyVideoClipColorEffectChanged( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyVideoClipAudioSettingsChanged( CVedMovie& /*aMovie*/,
+											         TInt /*aIndex*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyStartTransitionEffectChanged( CVedMovie& /*aMovie*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyMiddleTransitionEffectChanged( CVedMovie& /*aMovie*/, 
+													 TInt /*aIndex*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyEndTransitionEffectChanged( CVedMovie& /*aMovie*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyAudioClipAdded( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyAudioClipAddingFailed( CVedMovie& /*aMovie*/, TInt /*aError*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyAudioClipRemoved( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyAudioClipIndicesChanged( CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, 
+									           TInt /*aNewIndex*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyAudioClipTimingsChanged( CVedMovie& /*aMovie*/,
+											   TInt /*aIndex*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyMovieReseted( CVedMovie& /*aMovie*/ )
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyVideoClipGeneratorSettingsChanged(CVedMovie& /*aMovie*/,
+											             TInt /*aIndex*/) 
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyVideoClipDescriptiveNameChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/)
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyMovieQualityChanged(CVedMovie& /*aMovie*/)
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyMovieOutputParametersChanged(CVedMovie& /*aMovie*/)
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, 
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/,
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiSimpleCutVideoView::NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiSimpleCutVideoView::CloseWaitDialog()
+    {
+    if ( iWaitDialog )
+        {
+        TRAP_IGNORE( iWaitDialog->ProcessFinishedL() );
+        }       
+    }
+
+
+void CVeiSimpleCutVideoView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DoActivateL, In");
+	iPaused = EFalse;
+    if (!iContainer)
+        {
+		iContainer = CVeiSimpleCutVideoContainer::NewL( AppUi()->ClientRect(), *this, *iErrorUI );
+		iContainer->SetMopParent( this );
+		AppUi()->AddToStackL( *this, iContainer );
+		iCVeiNaviPaneControl->SetObserver( iContainer );
+        }
+
+	UpdateCBAL( CVeiSimpleCutVideoContainer::EStateInitializing );
+	
+	CheckMemoryCardAvailabilityL();
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::DoActivateL, out");
+	}
+
+// ---------------------------------------------------------
+// CVeiSimpleCutVideoView::HandleCommandL(TInt aCommand)
+// ?implementation_description
+// ---------------------------------------------------------
+//
+void CVeiSimpleCutVideoView::DoDeactivate()
+   {    
+	if ( iTimeUpdater )
+		{
+		iTimeUpdater->Cancel();
+		}
+
+	if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+
+		delete iContainer;
+		iContainer = NULL;
+        }
+	}
+
+void CVeiSimpleCutVideoView::PlayPreviewL()
+	{
+	iPaused = EFalse;
+	StartNaviPaneUpdateL();
+	iContainer->PlayL( iMovie->VideoClipInfo( iIndex )->FileName() );
+	}
+
+void CVeiSimpleCutVideoView::PausePreviewL()
+	{
+	iCVeiNaviPaneControl->SetPauseIconVisibilityL( ETrue );
+	StopNaviPaneUpdateL();
+
+	iContainer->PauseL();
+	}
+
+void CVeiSimpleCutVideoView::UpdateCBAL(TInt aState)
+	{	
+	MenuBar()->SetContextMenuTitleResourceId( R_VEI_MENUBAR_CUT_VIDEO_VIEW_CONTEXT ); 
+	switch (aState)
+		{
+		case CVeiSimpleCutVideoContainer::EStateInitializing:
+		case CVeiSimpleCutVideoContainer::EStateOpening:
+		case CVeiSimpleCutVideoContainer::EStateBuffering:		
+			{
+			if (! iClosing)
+				{				
+				Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY); 
+				}
+			break;
+			}
+		case CVeiSimpleCutVideoContainer::EStateStoppedInitial:
+			{
+			if (! iClosing)
+				{		
+				// no marks set
+				if ( ( iMovie->VideoClipCutInTime( 0 ) == TTimeIntervalMicroSeconds( 0 ) ) &&
+				 ( iMovie->VideoClipCutOutTime( 0 ) == iMovie->VideoClipInfo(0)->Duration() ) )
+					{		
+					// playhead in the beginning	
+					if ( iContainer->PlaybackPositionL() == 0 || AknLayoutUtils::PenEnabled() )
+						{
+						Cba()->SetCommandSetL(R_VEI_SOFTKEYS_OPTIONS_BACK__PLAY); 
+					}
+					// playhead not in the beginning
+					else
+						{
+						Cba()->SetCommandSetL(R_VEI_SOFTKEYS_IN_OUT__MENU);	
+						}
+					}
+				//start or end mark has been set	
+				else 
+					{
+					// start mark has been set, end mark has not been set 
+					// and the the playhead is on the right hand side of the start mark
+					if (( iMovie->VideoClipCutInTime( 0 ) != TTimeIntervalMicroSeconds( 0 ) ) && 
+					    ( iMovie->VideoClipCutOutTime( 0 ) == iMovie->VideoClipInfo(0)->Duration() ) &&
+					    ( iContainer->PlaybackPositionL() > iMovie->VideoClipCutInTime( 0 ))
+					    && !AknLayoutUtils::PenEnabled() )
+					    {
+					    Cba()->SetCommandSetL( R_VEI_SOFTKEYS_OPTIONS_OUT__MENU ); 
+					    }
+					else
+					    {
+					    Cba()->SetCommandSetL(R_VEI_SOFTKEYS_OPTIONS_CUT__MENU);
+					    }
+					}
+				}
+			break;
+			}
+		case CVeiSimpleCutVideoContainer::EStatePaused:
+		case CVeiSimpleCutVideoContainer::EStateStopped:
+			{							
+			
+			// no marks set
+			if ( ( iMovie->VideoClipCutInTime( 0 ) == TTimeIntervalMicroSeconds( 0 ) ) &&
+				 ( iMovie->VideoClipCutOutTime( 0 ) == iMovie->VideoClipInfo(0)->Duration() ) )
+				{
+				// playhead in the beginning		
+				if (iContainer->PlaybackPositionL() == 0 || AknLayoutUtils::PenEnabled() )
+					{
+					Cba()->SetCommandSetL(R_VEI_SOFTKEYS_OPTIONS_BACK__PLAY); 
+					}
+				else
+					{
+					Cba()->SetCommandSetL(R_VEI_SOFTKEYS_IN_OUT__MENU);	
+					}
+				}
+			// start or end mark has been set
+			else
+				{		
+					// start mark has been set, end mark has not been set 
+					// and the the playhead is on the right hand side of the start mark
+					if (( iMovie->VideoClipCutInTime( 0 ) != TTimeIntervalMicroSeconds( 0 ) ) && 
+					    ( iMovie->VideoClipCutOutTime( 0 ) == iMovie->VideoClipInfo(0)->Duration() ) &&					
+					    ( iContainer->PlaybackPositionL() > iMovie->VideoClipCutInTime( 0 ))
+					    && !AknLayoutUtils::PenEnabled() ) 
+					    {
+					    Cba()->SetCommandSetL( R_VEI_SOFTKEYS_OPTIONS_OUT__MENU );    
+					    }
+					else
+					    {																
+        				Cba()->SetCommandSetL(R_VEI_SOFTKEYS_OPTIONS_CUT__MENU); 
+					    }
+				}
+			break;
+			}
+		case CVeiSimpleCutVideoContainer::EStatePlaying:
+			{			
+			// playhead outside cut area
+			if ( iContainer->PlaybackPositionL() < iMovie->VideoClipCutInTime( iIndex ) )
+				{
+				if ( AknLayoutUtils::PenEnabled() )
+					{
+					Cba()->SetCommandSetL( R_VEI_SOFTKEYS_IN_NONE__MENU ); 
+					}
+				else
+					{
+					Cba()->SetCommandSetL( R_VEI_SOFTKEYS_IN_STOP__MENU ); 
+					}
+				iMarkState = EMarkStateIn;
+				}
+			// playdhead inside cut area	
+			else if ( iContainer->PlaybackPositionL() < iMovie->VideoClipCutOutTime( iIndex ) )
+				{
+				Cba()->SetCommandSetL( R_VEI_SOFTKEYS_IN_OUT__MENU ); 
+				iMarkState = EMarkStateInOut;
+				}
+			// playhead outside cut area
+			else
+				{
+				if ( AknLayoutUtils::PenEnabled() )
+					{
+					Cba()->SetCommandSetL( R_VEI_SOFTKEYS_NONE_OUT__MENU ); 
+					}
+				else
+					{
+					Cba()->SetCommandSetL( R_VEI_SOFTKEYS_STOP_OUT__MENU ); 
+					}
+				iMarkState = EMarkStateOut;
+				}
+				
+			break;
+			}
+		case CVeiSimpleCutVideoContainer::EStateTerminating:
+			{
+			return;
+			}
+		default:
+			{
+			break;	
+			}
+		}
+	Cba()->DrawDeferred();
+	}
+
+void CVeiSimpleCutVideoView::PlayMarkedL()
+	{
+	LOGFMT3(KVideoEditorLogFile, "CVeiSimpleCutVideoView::PlayMarkedL: In: iIndex:%d, iMovie->VideoClipCutInTime():%Ld, iMovie->VideoClipCutOutTime():%Ld", iIndex, iMovie->VideoClipCutInTime( iIndex ).Int64(), iMovie->VideoClipCutOutTime( iIndex ).Int64());
+	iPaused = EFalse;
+	StartNaviPaneUpdateL();	
+	iContainer->PlayMarkedL( iMovie->VideoClipInfo( iIndex )->FileName(),
+		iMovie->VideoClipCutInTime( iIndex ), iMovie->VideoClipCutOutTime( iIndex ) );		
+	
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::PlayMarkedL: Out");
+	}
+
+void CVeiSimpleCutVideoView::ClearInOutL( TBool aClearIn, TBool aClearOut )
+	{
+	if ( aClearIn ) 
+		{
+		iMovie->VideoClipSetCutInTime( iIndex, TTimeIntervalMicroSeconds( 0 ) );
+		iContainer->SetInTime( iMovie->VideoClipCutInTime( iIndex ) );
+		}
+	if ( aClearOut ) 
+		{
+		iMovie->VideoClipSetCutOutTime( iIndex, iMovie->VideoClipInfo( iIndex )->Duration() );
+		iContainer->SetOutTime( iMovie->VideoClipInfo( iIndex )->Duration() );
+		}
+	TTimeIntervalMicroSeconds cutin = iMovie->VideoClipCutInTime( 0 );
+	TTimeIntervalMicroSeconds cutout = iMovie->VideoClipCutOutTime( 0 );
+	
+	if ( ( cutin == TTimeIntervalMicroSeconds( 0 ) ) &&
+		 ( cutout == iMovie->VideoClipInfo(0)->Duration() ) )
+		{		
+		Cba()->SetCommandSetL(R_VEI_SOFTKEYS_OPTIONS_BACK__MENU); 
+		Cba()->DrawDeferred();
+		}
+	}
+
+void CVeiSimpleCutVideoView::MarkInL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::MarkInL, In");
+	TTimeIntervalMicroSeconds pos = iContainer->PlaybackPositionL();
+
+    // the start mark can't be put right to the beginning
+    // because start mark is at position 0 when it is not set
+    if (pos == 0)
+        {
+        pos = 1;
+        }
+	
+//	TTimeIntervalMicroSeconds clipDuration = iMovie->VideoClipInfo( iIndex )->Duration();
+//	CVedVideoClipInfo* info = iMovie->VideoClipInfo( iIndex );
+//	TTimeIntervalMicroSeconds intraPos = info->VideoFrameStartTimeL( 
+//			info->GetVideoFrameIndexL( pos ) );
+	if (iMovie->VideoClipCutOutTime(iIndex) > pos)
+		{
+		StopNaviPaneUpdateL();		
+		LOGFMT2(KVideoEditorLogFile, "CVeiSimpleCutVideoView::MarkInL, 2, iIndex:%d, pos:%Ld", iIndex, pos.Int64());
+		iMovie->VideoClipSetCutInTime( iIndex, pos );
+		iContainer->MarkedInL();	
+		}
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::MarkInL, Out");
+	}
+
+void CVeiSimpleCutVideoView::MarkOutL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::MarkOutL, In");
+	TTimeIntervalMicroSeconds pos = iContainer->PlaybackPositionL();
+//	CVedVideoClipInfo* info = iMovie->VideoClipInfo( iIndex );
+//	TTimeIntervalMicroSeconds intraPos = info->VideoFrameStartTimeL( 
+//			info->GetVideoFrameIndexL( pos ) );
+
+	if (iMovie->VideoClipCutInTime(iIndex) < pos)
+		{			
+		StopNaviPaneUpdateL();
+		iMovie->VideoClipSetCutOutTime( iIndex, pos );
+		LOGFMT2(KVideoEditorLogFile, "CVeiSimpleCutVideoView::MarkOutL, 2, iIndex:%d, pos:%Ld", iIndex, pos.Int64() );		
+		iContainer->MarkedOutL();
+		}
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::MarkOutL, Out");
+	}
+
+
+void CVeiSimpleCutVideoView::MoveStartOrEndMarkL(TTimeIntervalMicroSeconds aPosition, CVeiSimpleCutVideoContainer::TCutMark aMarkType)
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::MoveStartOrEndMarkL, In");
+	
+	StopNaviPaneUpdateL();
+	
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::MoveStartOrEndMarkL, 2");
+	
+	if (aMarkType == CVeiSimpleCutVideoContainer::EStartMark)
+		{
+		iMovie->VideoClipSetCutInTime( iIndex, aPosition);
+		}
+	else if (aMarkType == CVeiSimpleCutVideoContainer::EEndMark)
+		{
+		iMovie->VideoClipSetCutOutTime( iIndex, aPosition);
+		}		
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::MoveStartOrEndMarkL, Out");
+	}
+
+TUint CVeiSimpleCutVideoView::InPointTime()
+	{
+	if ( !iMovie )
+		{
+		return 0;
+		}
+	else
+		{
+		return static_cast<TInt32>((iMovie->VideoClipCutInTime(iIndex).Int64() / 1000));
+		}
+	}
+
+TUint CVeiSimpleCutVideoView::OutPointTime()
+	{
+	if ( !iMovie )
+		{
+		return 0;
+		}
+	else
+		{
+		return static_cast<TInt32>(iMovie->VideoClipCutOutTime(iIndex).Int64() / 1000);
+		}
+	}
+
+TInt CVeiSimpleCutVideoView::UpdateTimeCallbackL(TAny* aPtr)
+	{
+	CVeiSimpleCutVideoView* view = (CVeiSimpleCutVideoView*)aPtr;
+
+    view->UpdateTimeL();
+
+	return 1;
+	}
+
+
+void CVeiSimpleCutVideoView::UpdateTimeL()
+	{
+	DrawTimeNaviL();
+
+	if (iMarkState == EMarkStateIn) 
+		{
+		if (iContainer->PlaybackPositionL() > iMovie->VideoClipCutInTime( iIndex )) 
+			{
+			UpdateCBAL(iContainer->State());
+			}
+		}
+	else if (iMarkState == EMarkStateOut) 
+		{
+		if (iContainer->PlaybackPositionL() < iMovie->VideoClipCutOutTime( iIndex )) 
+			{
+			UpdateCBAL(iContainer->State());
+			}
+		}
+	else 
+		{
+		if ((iContainer->PlaybackPositionL() < iMovie->VideoClipCutInTime( iIndex )) ||
+			(iContainer->PlaybackPositionL() > iMovie->VideoClipCutOutTime( iIndex ))) 
+			{
+			UpdateCBAL(iContainer->State());
+			}
+		}
+	}
+
+void CVeiSimpleCutVideoView::DrawTimeNaviL()
+	{
+	TTime elapsed( iContainer->PlaybackPositionL().Int64() );
+	TTime total( iContainer->TotalLength().Int64() );
+	iCVeiNaviPaneControl->DrawTimeNaviL( elapsed, total );
+	}
+
+
+void CVeiSimpleCutVideoView::StartNaviPaneUpdateL()
+	{
+	DrawTimeNaviL();
+	if (iTimeUpdater && !iTimeUpdater->IsActive())
+		{
+		iTimeUpdater->Start(200000, 1000000/10, TCallBack(CVeiSimpleCutVideoView::UpdateTimeCallbackL, this));
+		}
+	}
+
+void CVeiSimpleCutVideoView::StopNaviPaneUpdateL()
+	{
+	if (iContainer)
+		{
+		DrawTimeNaviL();
+		}
+	if (iTimeUpdater)
+		{
+		iTimeUpdater->Cancel();
+		}
+	}
+
+
+void CVeiSimpleCutVideoView::VolumeMuteL()
+	{
+	iContainer->MuteL();
+	}
+
+
+
+void CVeiSimpleCutVideoView::ShowVolumeLabelL( TInt aVolume )
+	{
+	iCVeiNaviPaneControl->ShowVolumeLabelL( aVolume );	
+	}
+
+void CVeiSimpleCutVideoView::HandleForegroundEventL  ( TBool aForeground )
+	{
+	if ( !aForeground )
+		{
+		// If the application is closing down, calling PauseL could result in 
+		// a callback from the MMF player after the container is already deleted,
+		// causing KERN-EXEC 3
+		if ( iOnTheWayToDestruction || 
+		     static_cast<CVeiSimpleCutVideoAppUi*>( AppUi() )->AppIsOnTheWayToDestruction() )
+			{
+			iContainer->PrepareForTerminationL();
+			return;
+			}
+		else
+			{
+			if( iContainer->State() == CVeiSimpleCutVideoContainer::EStatePlaying ||
+		    	iContainer->State() == CVeiSimpleCutVideoContainer::EStatePlayingMenuOpen )
+				{
+				iPaused = ETrue;
+				iContainer->PauseL( EFalse );
+				}
+			}
+		}
+	else
+		{
+		UpdateCBAL( iContainer->State() );
+		if( 0 )
+//		if( iPaused )
+			{
+			iPaused = EFalse;
+			PlayPreviewL();
+			}
+		}
+	}
+
+// ---------------------------------------------------------
+// CVeiSimpleCutVideoView::HandleStatusPaneSizeChange()
+// ---------------------------------------------------------
+//
+void CVeiSimpleCutVideoView::HandleStatusPaneSizeChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( AppUi()->ClientRect() );
+        }
+    }
+
+TBool CVeiSimpleCutVideoView::IsEnoughFreeSpaceToSaveL()// const
+	{
+	RFs&	fs = iEikonEnv->FsSession();
+	TBool spaceBelowCriticalLevel( EFalse );
+
+	/* seek position of clip */
+	TTimeIntervalMicroSeconds frame;
+	frame = iContainer->PlaybackPositionL();
+
+	/* frame index of position */
+	TInt frameIndex;
+	frameIndex = iMovie->VideoClipInfo( iIndex )->GetVideoFrameIndexL( frame );
+
+	/* frame size */
+	TInt sizeEstimate; 
+	sizeEstimate = iMovie->VideoClipInfo( iIndex )->VideoFrameSizeL( frameIndex );
+
+	// In this case, we decide the target drive automatically when starting 
+	// to save the video. Thus it is enough to know that there is free space 
+	// on either drive at this stage.
+	spaceBelowCriticalLevel = SysUtil::DiskSpaceBelowCriticalLevelL( &fs, sizeEstimate, EDriveC );
+	if( spaceBelowCriticalLevel )
+		{
+		spaceBelowCriticalLevel = SysUtil::MMCSpaceBelowCriticalLevelL( &fs, sizeEstimate );
+		}	
+
+
+	if ( !spaceBelowCriticalLevel )
+		{
+		return ETrue;
+		}
+	else 
+		{
+		HBufC* stringholder;
+		stringholder = StringLoader::LoadLC( R_VEI_MEMORY_RUNNING_OUT, iEikonEnv );
+		CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+		dlg->ExecuteLD( *stringholder );
+		CleanupStack::PopAndDestroy( stringholder ); 
+
+		return EFalse;
+		}
+	}
+
+TTimeIntervalMicroSeconds CVeiSimpleCutVideoView::GetVideoClipCutInTime()
+	{
+	TTimeIntervalMicroSeconds cutInTime(0);
+	if ( iMovie )
+		{
+		cutInTime = iMovie->VideoClipCutInTime( iIndex );
+		}
+	return cutInTime;
+	}
+
+TTimeIntervalMicroSeconds CVeiSimpleCutVideoView::GetVideoClipCutOutTime()
+	{
+	TTimeIntervalMicroSeconds cutOutTime(0);
+	if ( iMovie )
+		{
+		cutOutTime = iMovie->VideoClipCutOutTime( iIndex );
+		}
+	return cutOutTime;
+	}
+
+void CVeiSimpleCutVideoView::HandleResourceChange(TInt aType)
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoView::HandleResourceChange() In, aType:%d", aType);
+    
+    if ( iContainer )
+    	{    	
+    	if ( aType == KEikMessageFadeAllWindows && (iContainer->State() == CVeiSimpleCutVideoContainer::EStatePlaying) )
+    		{
+    		this->PausePreviewL();
+    		iSelectionKeyPopup = ETrue;
+    		}
+    	else if ( iSelectionKeyPopup && aType == KEikMessageUnfadeWindows && (iContainer->State() == CVeiSimpleCutVideoContainer::EStatePaused) )
+    		{
+    		this->PlayPreviewL();
+    		iSelectionKeyPopup = EFalse;
+    		}
+    	}
+    
+    if (KAknsMessageSkinChange == aType)
+        {
+        // Handle skin change in the navi label controls - they do not receive 
+        // it automatically since they are not in the control stack
+        iCVeiNaviPaneControl->HandleResourceChange( aType );
+        }
+    
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::HandleResourceChange() Out");
+    }
+
+//=======================================================================================================
+const CVedMovie* CVeiSimpleCutVideoView::Movie() const
+	{
+	return iMovie;
+	}
+
+//=======================================================================================================
+TBool CVeiSimpleCutVideoView::SaveL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::SaveL: in");
+
+	TFileName outputFile;
+	TBool ret = EFalse;
+
+	TTimeIntervalMicroSeconds cutin;
+	TTimeIntervalMicroSeconds cutout;
+	cutin = iMovie->VideoClipCutInTime( 0 );
+	cutout = iMovie->VideoClipCutOutTime( 0 );
+
+	if ( ( cutin != TTimeIntervalMicroSeconds( 0 ) ) ||
+		 ( cutout!= iMovie->VideoClipInfo(0)->Duration() ) )
+		{
+		RFs&	fs = iEikonEnv->FsSession();
+
+		// GenerateNewDocumentNameL also checks disk space
+		TInt err(KErrNone);
+		if(!iOverWriteFile)
+			{
+			err = VideoEditorUtils::GenerateNewDocumentNameL (
+				fs,
+				iMovie->VideoClipInfo( iIndex )->FileName(),
+				outputFile,
+				iMovie->Format(),
+				iMovie->GetSizeEstimateL() );
+			}
+		else
+			{
+			outputFile.Zero();
+			outputFile.Copy(iMovie->VideoClipInfo( iIndex )->FileName());
+			}
+		
+		LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoView::SaveL: 1, err:%d", err);
+
+		if ( KErrNone == err )
+			{
+			if (iSaveToFileName)
+				{
+				delete iSaveToFileName;
+				iSaveToFileName = NULL;	
+				}
+			iSaveToFileName = HBufC::NewL( outputFile.Length() );
+			*iSaveToFileName = outputFile;
+
+			// Start saviong the video. 
+			// To be finished in DialogDismissedL...
+			iSaving = ETrue;
+			StartTempFileProcessingL();
+
+            ret = ETrue;
+			}
+		else 
+			{
+			iErrorUI->ShowGlobalErrorNote( err );
+			ret = EFalse;
+			}						
+		}
+	else 
+		{
+		ret = EFalse;
+		}
+
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoView::SaveL: out: %d", ret);
+
+	return ret;
+	}
+
+
+//=============================================================================
+TInt CVeiSimpleCutVideoView::QueryAndSaveL()
+{
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::QueryAndSaveL: in");
+
+	TFileName outputFile;
+	TBool ret = EFalse;
+
+	TTimeIntervalMicroSeconds cutin;
+	TTimeIntervalMicroSeconds cutout;
+	cutin = iMovie->VideoClipCutInTime( 0 );
+	cutout = iMovie->VideoClipCutOutTime( 0 );
+
+	if ( ( cutin != TTimeIntervalMicroSeconds( 0 ) ) ||
+		 ( cutout!= iMovie->VideoClipInfo(0)->Duration() ) )
+		{
+		RFs	fs = CCoeEnv::Static()->FsSession();
+
+
+ 		// launch query with choices "Replace original" and "Save with a new file name" 
+ 		TInt userSelection = VideoEditorUtils::LaunchSaveVideoQueryL(); 
+ 		
+	  	if(userSelection == 0) 
+	  	// the user selects to save with a new file name
+			{
+			iOverWriteFile = EFalse;
+
+            // Multiple drive support enabled
+#ifdef RD_MULTIPLE_DRIVE	
+		    TDriveNumber driveNumber;
+            TFileName driveAndPath;
+            CAknMemorySelectionDialogMultiDrive* multiDriveDlg = CAknMemorySelectionDialogMultiDrive::NewL(ECFDDialogTypeSave, EFalse );			
+		    CleanupStack::PushL( multiDriveDlg );
+		    
+			// launch "Select memory" query
+            if (multiDriveDlg->ExecuteL( driveNumber, &driveAndPath, NULL ))
+    			{
+	    		outputFile.Zero();				
+			
+		    	// Generate a default name for the new file
+			    TInt err = VideoEditorUtils::GenerateFileNameL (
+                                    					fs,
+                                    					iMovie->VideoClipInfo( iIndex )->FileName(),		
+                                    					outputFile,
+                                    					iMovie->Format(),
+                                    					iMovie->GetSizeEstimateL(),
+                                    					driveAndPath);	
+				
+                driveAndPath.Append( PathInfo::VideosPath() );					
+				
+			    if ( KErrNone == err )
+					{
+					if (iSaveToFileName)
+						{
+						delete iSaveToFileName;
+						iSaveToFileName = NULL;	
+						}				 
+
+					// launch file name prompt dialog
+					if (CAknFileNamePromptDialog::RunDlgLD(outputFile, driveAndPath, KNullDesC))
+						{
+						driveAndPath.Append(outputFile);
+						outputFile.Copy(driveAndPath);
+						iSaveToFileName = HBufC::NewL( outputFile.Length() );
+						*iSaveToFileName = outputFile;
+
+						// Start saving the video. 
+						// To be finished in DialogDismissedL...
+						iSaving = ETrue;
+						StartTempFileProcessingL();
+
+			            ret = ETrue;
+			            }
+					}
+				else // err != KErrNone 
+					{
+					ret = EFalse;
+					}						
+    			}
+		    CleanupStack::PopAndDestroy( multiDriveDlg );
+#else // no multiple drive support
+			// launch "Select memory" query
+		    CAknMemorySelectionDialog::TMemory selectedMemory(CAknMemorySelectionDialog::EPhoneMemory);		
+			if (CAknMemorySelectionDialog::RunDlgLD(selectedMemory))
+				{
+				// create path for the image	
+				TFileName driveAndPath;        		
+				VideoEditor::TMemory memorySelection = VideoEditor::EMemPhoneMemory;		 
+				if (selectedMemory == CAknMemorySelectionDialog::EPhoneMemory)
+					{
+					memorySelection = VideoEditor::EMemPhoneMemory;
+					driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() );
+					driveAndPath.Append( PathInfo::VideosPath() );							
+					}
+				else if (selectedMemory == CAknMemorySelectionDialog::EMemoryCard)
+					{	
+					memorySelection = VideoEditor::EMemMemoryCard;				
+					driveAndPath.Copy( PathInfo::MemoryCardRootPath() );
+					driveAndPath.Append( PathInfo::VideosPath() );							
+					}        				 
+
+				// GenerateNewDocumentNameL also checks disk space
+				TInt err = VideoEditorUtils::GenerateNewDocumentNameL (
+					fs,
+					iMovie->VideoClipInfo( iIndex )->FileName(),
+					outputFile,
+					iMovie->Format(),
+					iMovie->GetSizeEstimateL(),
+					memorySelection );
+					
+				if ( KErrNone == err )
+					{
+					if (iSaveToFileName)
+						{
+						delete iSaveToFileName;
+						iSaveToFileName = NULL;	
+						}				 
+
+					// launch file name prompt dialog
+					if (CAknFileNamePromptDialog::RunDlgLD(outputFile, driveAndPath, KNullDesC))
+						{
+						driveAndPath.Append(outputFile);
+						outputFile.Copy(driveAndPath);
+						iSaveToFileName = HBufC::NewL( outputFile.Length() );
+						*iSaveToFileName = outputFile;
+
+						// Start saving the video. 
+						// To be finished in DialogDismissedL...
+						iSaving = ETrue;
+						StartTempFileProcessingL();
+
+			            ret = ETrue;
+			            }
+					}
+				else // err != KErrNone 
+					{
+					ret = EFalse;
+					}						
+				}
+#endif				
+			}
+		// user selects to overwrite
+		else if (userSelection == 1)
+		
+			{
+			iOverWriteFile = ETrue;
+			ret = SaveL();
+			return ret;	
+			}
+		else // user cancelled
+			{
+			ret = EFalse;
+			}
+		}
+	else 
+		{
+		ret = EFalse;
+		}
+
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoView::QueryAndSaveL: out: %d", ret);
+
+	return ret;
+}
+
+
+
+//=======================================================================================================
+TBool CVeiSimpleCutVideoView::IsCutMarkSet()
+	{
+	ASSERT( iMovie ); // We always have iMovie
+	TTimeIntervalMicroSeconds cutIn( iMovie->VideoClipCutInTime( iIndex ) ); 
+	TTimeIntervalMicroSeconds cutOut( iMovie->VideoClipCutOutTime( iIndex ) ); 
+	TTimeIntervalMicroSeconds duration( iMovie->VideoClipInfo(iIndex)->Duration() );
+	// cutIn or cutOut mark is set
+	return (cutIn != TTimeIntervalMicroSeconds( 0 ) || cutOut != duration);
+	}
+
+//=======================================================================================================
+void CVeiSimpleCutVideoView::StartTempFileProcessingL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::StartTempFileProcessingL: in");
+
+	RFs&	fs = iEikonEnv->FsSession();
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::StartTempFileProcessingL() -- NEW TEMP");
+
+	if (iTempFile)
+		{
+		delete iTempFile;
+		iTempFile = NULL;
+		}
+	iTempFile = HBufC::NewL(KMaxFileName);
+	iTempMaker->GenerateTempFileName( *iTempFile, iMovieSaveSettings.MemoryInUse(), iMovie->Format() );
+	LOGFMT(KVideoEditorLogFile, "CVeiSimpleCutVideoView::StartTempFileProcessingL: 1, iTempFile:%S", iTempFile);
+
+	if ( !IsEnoughFreeSpaceToSaveL() )
+		{
+		LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::StartTempFileProcessingL: 2");
+		return;
+		}
+
+	iMovie->ProcessL( *iTempFile, *this );
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::StartTempFileProcessingL: out");
+	}
+
+//=======================================================================================================
+void CVeiSimpleCutVideoView::ShowErrorNoteL( const TInt aResourceId, TInt aError ) const
+	{
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::ShowErrorNoteL: in");
+
+	HBufC* stringholder;
+	if ( aError == 0 )
+		{
+		stringholder = StringLoader::LoadLC( aResourceId, iEikonEnv );
+		}
+	else
+		{
+		stringholder = StringLoader::LoadLC( aResourceId, aError, iEikonEnv );
+		}
+
+	CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+	dlg->ExecuteLD( *stringholder );
+
+	CleanupStack::PopAndDestroy( stringholder );
+
+	LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::ShowErrorNoteL: out");
+	}
+
+//=======================================================================================================
+
+void CVeiSimpleCutVideoView::StartProgressNoteL()
+{
+	iProgressNote = 
+		new (ELeave) CAknProgressDialog(REINTERPRET_CAST(CEikDialog**, 
+		&iProgressNote), ETrue);
+	iProgressNote->SetCallback(this);
+	iProgressNote->ExecuteDlgLD( R_VEI_PROGRESS_NOTE_WITH_CANCEL );
+
+	HBufC* stringholder;
+    TApaAppCaption caption;
+    TRAPD( err, iContainer->ResolveCaptionNameL( caption ) );
+    
+    // If something goes wrong, show basic "Saving" note
+    if ( err )
+        {
+        stringholder = iEikonEnv->AllocReadResourceLC( R_VEI_PROGRESS_NOTE_SAVING );
+        }
+    else
+        {
+        stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_CUTTING_VIDEO, caption, iEikonEnv );
+        }        
+
+	iProgressNote->SetTextL( *stringholder );
+	CleanupStack::PopAndDestroy( stringholder );	
+	
+	iProgressNote->GetProgressInfoL()->SetFinalValue(100);	
+}
+
+//=======================================================================================================
+void CVeiSimpleCutVideoView::StartAnimatedProgressNoteL()
+{
+	if (iAnimatedProgressDialog)
+    	{
+    	delete iAnimatedProgressDialog;
+    	iAnimatedProgressDialog = NULL;
+    	}
+    	
+   
+	iAnimatedProgressDialog = new (ELeave) CExtProgressDialog( &iAnimatedProgressDialog);
+	iAnimatedProgressDialog->PrepareLC(R_WAIT_DIALOG);	
+	iAnimatedProgressDialog->SetCallback( this );
+	
+	HBufC* stringholder = StringLoader::LoadLC( R_VEI_PROGRESS_NOTE_CUTTING_VIDEO, iEikonEnv );
+	iAnimatedProgressDialog->SetTextL( *stringholder );
+	CleanupStack::PopAndDestroy(stringholder);
+	
+	iAnimatedProgressDialog->SetAnimationResourceIdL( VideoEditor::EAnimationCut );
+	iAnimatedProgressDialog->GetProgressInfoL()->SetFinalValue( 100 );
+	iAnimatedProgressDialog->StartAnimationL();
+	iAnimatedProgressDialog->RunLD();
+}
+
+// ----------------------------------------------------------------------------
+// CVeiSimpleCutVideoView::CheckMemoryCardAvailability()
+//
+//  Checks the memory card availability if MMC is selected as save store in
+//  application settings. An information note is shown in following
+//  situations:
+//  - MMC not inserted
+//  - MMC corrupted (unformatted)
+//  [- MMC is read-only (not implemented)]
+//  
+//  If note is popped up, this function waits until it's dismissed.
+// ----------------------------------------------------------------------------
+//
+void CVeiSimpleCutVideoView::CheckMemoryCardAvailabilityL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::CheckMemoryCardAvailability(): in");
+
+    // Read the video editor settings from ini file.
+        
+    STATIC_CAST(CVeiSimpleCutVideoAppUi*,AppUi())->ReadSettingsL( iMovieSaveSettings );
+    
+    CAknMemorySelectionDialog::TMemory memoryInUse( iMovieSaveSettings.MemoryInUse() );
+
+    // Check the MMC accessibility only if MMC is used as saving store.
+    if( memoryInUse == CAknMemorySelectionDialog::EMemoryCard )
+        {
+        RFs& fs = iEikonEnv->FsSession();
+        TDriveInfo driveInfo;
+        
+        User::LeaveIfError( fs.Drive( driveInfo, KMmcDrive ) );
+
+        // Media is not present (MMC card not inserted).
+        if( EMediaNotPresent == driveInfo.iType )
+            {
+            LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::CheckMemoryCardAvailability(): no media");
+            
+            iMovieSaveSettings.MemoryInUse() = CAknMemorySelectionDialog::EPhoneMemory;
+            // do not overwrite because doing so permanently sets memory to phone memory
+			//STATIC_CAST( CVeiSimpleCutVideoAppUi*, AppUi() )->WriteSettingsL( settings );
+    	    }
+        // Media is present
+        else
+            {
+            LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::CheckMemoryCardAvailability(): media present");
+
+            TVolumeInfo volumeInfo;
+            TInt volumeErr = fs.Volume( volumeInfo, KMmcDrive );
+            LOGFMT(KVideoEditorLogFile, "CEditVideoView::CheckMemoryCardAvailability() Volume(): %d", volumeErr);
+
+            // Show note if media is corrupted/unformatted.
+            if( KErrCorrupt == volumeErr )
+                {
+                HBufC* noteText = StringLoader::LoadLC( R_VED_MMC_NOT_INSERTED,
+                                                    iEikonEnv );
+                CAknInformationNote* informationNote = 
+                                new(ELeave)CAknInformationNote( ETrue );
+                informationNote->ExecuteLD( *noteText );
+
+                CleanupStack::PopAndDestroy( noteText );
+
+				iMovieSaveSettings.MemoryInUse() = CAknMemorySelectionDialog::EPhoneMemory;
+				// do not overwrite because doing so permanently sets memory to phone memory
+				//STATIC_CAST( CVeiSimpleCutVideoAppUi*, AppUi() )->WriteSettingsL( settings );
+                }
+            }
+        }
+
+    LOG(KVideoEditorLogFile, "CVeiSimpleCutVideoView::CheckMemoryCardAvailability(): out");
+    }
+
+void CVeiSimpleCutVideoView::PrepareForTermination()
+	{
+	iOnTheWayToDestruction = ETrue;
+	}
+
+void CVeiSimpleCutVideoView::SetTitlePaneTextL ()
+{
+
+	TPtrC fileName = iMovie->VideoClipInfo( iIndex )->FileName();
+	HBufC * title_text = HBufC::NewLC( fileName.Length() );
+	TPtr title_text_ptr = title_text->Des();
+			
+	title_text_ptr.Copy (fileName);
+	TParsePtr parser (title_text_ptr); 
+	title_text_ptr = parser.Name();
+	
+    //  Set title pane text
+   	CEikStatusPane *statusPane = ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane();
+    CAknTitlePane* titlePane = ( CAknTitlePane* ) statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) );
+	titlePane->SetTextL(title_text_ptr);
+	
+	CleanupStack::PopAndDestroy( title_text ); 
+}
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleCutVideo/src/veinavipanecontrol.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,302 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+* Navipane control for SVE.
+*
+*/
+
+
+#include <aknnavide.h>
+#include <Eikspane.h>
+#include <stringloader.h> 
+#include <AknVolumePopup.h>
+
+#include "veinavipanecontrol.h"
+#include "VeiTimeLabelNavi.h"
+#include "mveinavipanecontrolobserver.h" 
+#include <VedSimpleCutVideo.rsg>
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CVeiNaviPaneControl
+// ---------------------------------------------------------------------------
+//
+CVeiNaviPaneControl::CVeiNaviPaneControl( CEikStatusPane* aStatusPane ) :
+	iStatusPane( aStatusPane )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVeiNaviPaneControl::ConstructL()
+    {
+    if( iStatusPane )
+        {        
+        iNaviPane = (CAknNavigationControlContainer*) iStatusPane->ControlL(
+            TUid::Uid(EEikStatusPaneUidNavi) );
+        iTimeNavi = CreateTimeLabelNaviL();
+        iVolumeNavi = iNaviPane->CreateVolumeIndicatorL(
+			R_AVKON_NAVI_PANE_VOLUME_INDICATOR );
+		iVolumeNavi->SetObserver( this );
+        iVolumeHider = CPeriodic::NewL( CActive::EPriorityStandard );        
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CVeiNaviPaneControl* CVeiNaviPaneControl::NewL( CEikStatusPane* aStatusPane )
+    {
+    CVeiNaviPaneControl* self = 
+    	new( ELeave ) CVeiNaviPaneControl( aStatusPane );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ~CVeiNaviPaneControl
+// ---------------------------------------------------------------------------
+//
+CVeiNaviPaneControl::~CVeiNaviPaneControl()
+    {
+    iObserver = NULL;
+    delete iTimeNavi;
+    delete iVolumeNavi;
+    delete iVolumeHider;
+    }
+
+// ---------------------------------------------------------------------------
+// DrawTimeNaviL
+// ---------------------------------------------------------------------------
+//
+void CVeiNaviPaneControl::DrawTimeNaviL( TTime aElapsed, TTime aTotal )
+    {
+	// check if time is over 59min:59s, then use 00h:00m:00s
+	TBool useLong( aTotal.DateTime().Hour() );
+
+	HBufC* dateFormatString = CCoeEnv::Static()->AllocReadResourceLC(
+	    useLong ?  R_QTN_TIME_DURAT_LONG_WITH_ZERO : 
+	        R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO ); 
+	        
+    const TInt bufLength(16);
+    TBuf<bufLength> elapsedBuf;			
+	aElapsed.FormatL(elapsedBuf, *dateFormatString);
+    TBuf<bufLength> totalBuf;
+	aTotal.FormatL(totalBuf, *dateFormatString);
+	CleanupStack::PopAndDestroy(dateFormatString);
+       
+	CDesCArrayFlat* strings = new (ELeave) CDesCArrayFlat(2);
+	CleanupStack::PushL(strings);
+	strings->AppendL(elapsedBuf);
+	strings->AppendL(totalBuf);
+	HBufC* stringholder = StringLoader::LoadL(R_VEI_NAVI_TIME, *strings);
+	CleanupStack::PopAndDestroy(strings);
+
+	
+	CleanupStack::PushL(stringholder);	
+
+	GetTimeLabelControl()->SetLabelL(*stringholder);
+
+	CleanupStack::PopAndDestroy(stringholder);
+
+
+    
+    if( iNaviPane->Top() != iVolumeNavi )
+        {        
+        iNaviPane->PushL( *iTimeNavi );
+        }
+    
+	/* Prevent the screen light dimming. */
+	if (aElapsed.DateTime().Second() == 0 || 
+	    aElapsed.DateTime().Second() == 15 || 
+	    aElapsed.DateTime().Second() == 30 || 
+	    aElapsed.DateTime().Second() == 45)
+		{
+		User::ResetInactivityTime();
+		}        
+    }
+
+// ---------------------------------------------------------------------------
+// SetPauseIconVisibilityL
+// ---------------------------------------------------------------------------
+//
+void CVeiNaviPaneControl::SetPauseIconVisibilityL( TBool aVisible )
+    {
+	GetTimeLabelControl()->SetPauseIconVisibilityL( aVisible );
+	if( iNaviPane->Top() != iVolumeNavi )
+        {  
+	    iNaviPane->PushL( *iTimeNavi );    
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// SetVolumeIconVisibilityL
+// ---------------------------------------------------------------------------
+//
+void CVeiNaviPaneControl::SetVolumeIconVisibilityL( TBool aVisible )
+    {
+    GetTimeLabelControl()->SetVolumeIconVisibilityL( aVisible );
+	if( iNaviPane->Top() != iVolumeNavi )
+        {  
+	    iNaviPane->PushL( *iTimeNavi );    
+        }
+    }
+// ---------------------------------------------------------------------------
+// ShowVolumeLabelL
+// ---------------------------------------------------------------------------
+//
+void CVeiNaviPaneControl::ShowVolumeLabelL( TInt aVolume )
+    {	    
+	GetTimeLabelControl()->SetVolumeIconVisibilityL( ETrue );
+
+  	// Remove volume slider from navi control after 2 sec
+	iVolumeHider->Cancel();
+	const TInt twoSeconds(1900000);
+	iVolumeHider->Start(twoSeconds, twoSeconds, 
+	    TCallBack( CVeiNaviPaneControl::HideVolumeCallbackL, this) );    
+
+	if (aVolume == 0) 
+		{
+        // Hide volume icon when volume is set to 0
+		GetTimeLabelControl()->SetVolumeIconVisibilityL( EFalse );    
+		}
+	if(GetVolumeControl()->Value()!= aVolume) 
+		{
+		//this is in case we change volume with other control than the popup
+		GetVolumeControl()->SetValue(aVolume);
+		}	
+	CAknVolumePopup* popup = static_cast<CAknVolumePopup*> ( GetVolumeControl()->Parent() );
+	TRAP_IGNORE( popup->ShowVolumePopupL() );
+
+  	}
+
+// ---------------------------------------------------------------------------
+// HandleResourceChange
+// ---------------------------------------------------------------------------
+//
+void CVeiNaviPaneControl::HandleResourceChange( TInt aType )
+    {
+    if( iTimeNavi && iVolumeNavi )
+        {        
+        iTimeNavi->DecoratedControl()->HandleResourceChange( aType );
+        iVolumeNavi->DecoratedControl()->HandleResourceChange( aType );    
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// HandleResourceChange from MCoeControlObserver
+// ---------------------------------------------------------------------------
+//
+void CVeiNaviPaneControl::HandleControlEventL( 
+    CCoeControl* /* aControl */,TCoeEvent /* aEventType */ )
+    {
+    CAknNavigationDecorator* cntr = iNaviPane->Top( );    
+    if ( iVolumeNavi && cntr == iVolumeNavi )
+        {
+        if( iObserver )
+            {
+            iObserver->SetVolumeLevelL( GetVolumeControl()->Value() );
+            }
+        }
+ 
+    }
+
+// ---------------------------------------------------------------------------
+// HandleNaviEventL from MTimeLabelNaviObserver
+// ---------------------------------------------------------------------------
+//
+void CVeiNaviPaneControl::HandleNaviEventL()
+    {
+    // Open Volume slider
+	// First push then set value	
+	iNaviPane->PushL(*iVolumeNavi); 
+	TInt currenValue( GetVolumeControl()->Value() );	    
+	ShowVolumeLabelL( currenValue );
+	
+    }
+    
+// ---------------------------------------------------------------------------
+// CreateTimeLabelNaviL
+// ---------------------------------------------------------------------------
+//
+CAknNavigationDecorator* CVeiNaviPaneControl::CreateTimeLabelNaviL()
+	{
+	ASSERT( iNaviPane );
+	
+	CVeiTimeLabelNavi* timelabelnavi = CVeiTimeLabelNavi::NewLC();
+	timelabelnavi->SetNaviObserver( this );
+	CAknNavigationDecorator* decoratedFolder = CAknNavigationDecorator::NewL(
+	    iNaviPane, timelabelnavi, CAknNavigationDecorator::ENotSpecified);
+    CleanupStack::Pop(timelabelnavi);
+	
+    CleanupStack::PushL(decoratedFolder);
+	decoratedFolder->SetContainerWindowL(*iNaviPane);
+	CleanupStack::Pop(decoratedFolder);
+	decoratedFolder->MakeScrollButtonVisible(EFalse);
+	
+	return decoratedFolder;
+	}
+
+// ---------------------------------------------------------------------------
+// GetTimeLabelControl
+// ---------------------------------------------------------------------------
+//
+CVeiTimeLabelNavi* CVeiNaviPaneControl::GetTimeLabelControl()
+    {
+    ASSERT( iTimeNavi );
+    return static_cast<CVeiTimeLabelNavi*> ( iTimeNavi->DecoratedControl() );
+    }
+
+// ---------------------------------------------------------------------------
+// GetVolumeControl
+// ---------------------------------------------------------------------------
+//
+CAknVolumeControl* CVeiNaviPaneControl::GetVolumeControl()
+    {
+    ASSERT( iVolumeNavi );
+    return static_cast<CAknVolumeControl*> ( iVolumeNavi->DecoratedControl() );
+    }
+
+// ---------------------------------------------------------------------------
+// HideVolumeCallbackL
+// ---------------------------------------------------------------------------
+//    
+TInt CVeiNaviPaneControl::HideVolumeCallbackL(TAny* aPtr)
+	{
+	CVeiNaviPaneControl* view = (CVeiNaviPaneControl*)aPtr;
+    view->HideVolume();
+	return 0;
+	}
+
+// ---------------------------------------------------------------------------
+// HideVolume
+// ---------------------------------------------------------------------------
+//
+void CVeiNaviPaneControl::HideVolume()
+    {
+    ASSERT( iVolumeNavi );
+   	iNaviPane->Pop( iVolumeNavi );
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/BWINS/SimpleVideoEditor.DEF	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,12 @@
+EXPORTS
+	??1CSimpleVideoEditor@@UAE@XZ @ 1 NONAME ; CSimpleVideoEditor::~CSimpleVideoEditor(void)
+	?AddText@CSimpleVideoEditor@@QAEXABVTDesC16@@@Z @ 2 NONAME ; void CSimpleVideoEditor::AddText(class TDesC16 const &)
+	?Cancel@CSimpleVideoEditor@@QAEXXZ @ 3 NONAME ; void CSimpleVideoEditor::Cancel(void)
+	?ChangeAudio@CSimpleVideoEditor@@QAEXABVTDesC16@@@Z @ 4 NONAME ; void CSimpleVideoEditor::ChangeAudio(class TDesC16 const &)
+	?Merge@CSimpleVideoEditor@@QAEXABVTDesC16@@@Z @ 5 NONAME ; void CSimpleVideoEditor::Merge(class TDesC16 const &)
+	?NewL@CSimpleVideoEditor@@SAPAV1@AAVMSimpleVideoEditorExitObserver@@@Z @ 6 NONAME ; class CSimpleVideoEditor * CSimpleVideoEditor::NewL(class MSimpleVideoEditorExitObserver &)
+	??0CMultiLineQueryDialog@@AAE@AAVTDes16@@ABW4TTone@CAknQueryDialog@@@Z @ 7 NONAME ; CMultiLineQueryDialog::CMultiLineQueryDialog(class TDes16 &, enum CAknQueryDialog::TTone const &)
+	??1CMultiLineQueryDialog@@UAE@XZ @ 8 NONAME ; CMultiLineQueryDialog::~CMultiLineQueryDialog(void)
+	?NewL@CMultiLineQueryDialog@@SAPAV1@AAVTDes16@@ABW4TTone@CAknQueryDialog@@@Z @ 9 NONAME ; class CMultiLineQueryDialog * CMultiLineQueryDialog::NewL(class TDes16 &, enum CAknQueryDialog::TTone const &)
+	?OfferKeyEventL@CMultiLineQueryDialog@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 10 NONAME ; enum TKeyResponse CMultiLineQueryDialog::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/EABI/SimpleVideoEditor.DEF	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,19 @@
+EXPORTS
+	_ZN18CSimpleVideoEditor11ChangeAudioERK7TDesC16 @ 1 NONAME
+	_ZN18CSimpleVideoEditor4NewLER30MSimpleVideoEditorExitObserver @ 2 NONAME
+	_ZN18CSimpleVideoEditor5MergeERK7TDesC16 @ 3 NONAME
+	_ZN18CSimpleVideoEditor6CancelEv @ 4 NONAME
+	_ZN18CSimpleVideoEditor7AddTextERK7TDesC16 @ 5 NONAME
+	_ZN18CSimpleVideoEditorD0Ev @ 6 NONAME
+	_ZN18CSimpleVideoEditorD1Ev @ 7 NONAME
+	_ZN18CSimpleVideoEditorD2Ev @ 8 NONAME
+	_ZN21CMultiLineQueryDialog14OfferKeyEventLERK9TKeyEvent10TEventCode @ 9 NONAME
+	_ZN21CMultiLineQueryDialog4NewLER6TDes16RKN15CAknQueryDialog5TToneE @ 10 NONAME
+	_ZN21CMultiLineQueryDialogC1ER6TDes16RKN15CAknQueryDialog5TToneE @ 11 NONAME
+	_ZN21CMultiLineQueryDialogC2ER6TDes16RKN15CAknQueryDialog5TToneE @ 12 NONAME
+	_ZN21CMultiLineQueryDialogD0Ev @ 13 NONAME
+	_ZN21CMultiLineQueryDialogD1Ev @ 14 NONAME
+	_ZN21CMultiLineQueryDialogD2Ev @ 15 NONAME
+	_ZTI21CMultiLineQueryDialog @ 16 NONAME ; #<TI>#
+	_ZTV21CMultiLineQueryDialog @ 17 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/data/SimpleVideoEditor.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,398 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+NAME	SVED
+
+// INCLUDES
+#include <Eikon.rh>
+#include <avkon.loc>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <AvkonIcons.hrh>
+#include <SimpleVideoEditor.loc>
+#include "videoeditorcommon.hrh"
+#include <errorres.loc>
+RESOURCE RSS_SIGNATURE { }
+
+//----------------------------------------------------
+//
+//    r_vesm_progress_note_with_cancel
+//    Progress note
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vesm_progress_note_with_cancel
+	{
+	flags = EAknProgressNoteFlags;
+	buttons = R_AVKON_SOFTKEYS_CANCEL;
+	items =
+		{
+		DLG_LINE
+			{
+			type = EAknCtNote;
+			id = EGeneralNote;
+			control = AVERELL_NOTE
+				{
+				layout = EProgressLayout;
+//				singular_label = qtn_vei_progress_note_processing;
+				imagefile = AVKON_ICON_FILE;
+				imageid = EMbmAvkonQgn_note_progress;
+				imagemask = EMbmAvkonQgn_note_progress_mask;
+				};
+			}
+		};
+	}
+
+//----------------------------------------------------
+//
+//    r_vei_wait_note_with_cancel
+//    
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_wait_note_with_cancel
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control= AVKON_NOTE 
+                { 
+                layout = EWaitLayout;
+                imagefile = AVKON_ICON_FILE;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_vei_wait_note_without_cancel
+//    
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vei_wait_note_without_cancel
+    {
+    flags = EEikDialogFlagNoDrag|EEikDialogFlagNoTitleBar;    
+    //buttons = R_AVKON_SOFTKEYS_CANCEL;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    //buttons = r_vei_wait_note_without_cancel_buttons;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control= AVKON_NOTE 
+                { 
+                layout = EWaitLayout;
+                imagefile = AVKON_ICON_FILE;
+                imageid = EMbmAvkonQgn_note_progress;
+                imagemask = EMbmAvkonQgn_note_progress_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+    
+//----------------------------------------------------
+//
+//    r_vie_confirmation_query
+//    Confirmation query
+//
+//----------------------------------------------------
+RESOURCE DIALOG r_vie_confirmation_query
+{
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+    {
+        DLG_LINE
+        {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+            {
+                layout = EConfirmationQueryLayout;
+                label = " ";
+            };
+        }
+    };
+}    
+    
+RESOURCE CBA r_vei_wait_note_without_cancel_buttons
+    {
+    buttons =
+		{
+		CBA_BUTTON 
+				{
+				id = 20; 
+				txt = " ";
+				},
+		CBA_BUTTON 
+				{
+				id = 21;	
+				txt = " ";
+				}
+		};
+    }
+    
+
+//----------------------------------------------------
+//
+//  LIST QUERY (contents updated dynamically)
+//
+//----------------------------------------------------
+RESOURCE AVKON_LIST_QUERY r_vie_list_query
+{
+	items =
+	{
+		AVKON_LIST_QUERY_DLG_LINE
+		{
+			control = AVKON_LIST_QUERY_CONTROL
+			{
+				listtype = EAknCtSinglePopupMenuListBox;
+				heading = " ";
+				listbox = AVKON_LIST_QUERY_LIST
+				{
+					// array of items will be defined dynamically
+				};
+			};
+		}
+	};
+}
+
+RESOURCE TBUF256 r_vesm_edit_view_title_name						{ buf = qtn_vei_edit_video_main_text_t; }
+
+//----------------------------------------------------
+//   
+//    r_vesm_editvideo_titlescreen_text_query
+//    data query for the title screen text
+//
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_vesm_editvideo_titlescreen_text_query
+	{
+	flags=EGeneralQueryFlags; 
+	buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+	items =
+		{
+		DLG_LINE
+			{
+			type = EAknCtQuery;
+			id = EGeneralQuery;
+			control = AVKON_DATA_QUERY
+				{
+				layout = EDataLayout;
+				label = qtn_vie_query_heading_enter_text; 
+				control = 
+					EDWIN
+						{
+						width = AKNTEXT_QUERY_WIDTH;
+						lines = AKNTEXT_QUERY_LINES;
+						maxlength = AKNTEXT_QUERY_WIDTH * AKNTEXT_QUERY_LINES;
+						};
+				};
+			}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//
+//    r_ved_insert_position_query
+//    List Query dialog
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_ved_insert_position_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_SELECT_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtListQueryControl;
+            id = EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    flags = EAknListBoxMenuList;
+                    array_id = r_ved_insert_position_query_items;
+                    };
+                heading = "#heading";
+                };
+            }
+        };
+    }	
+    
+    
+//-----------------------------------------------------------------------------
+//
+//    r_ved_insert_position_query_items
+//    Items array for List Query
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ved_insert_position_query_items
+    {
+    items =
+        {
+        LBUF
+            {           
+            txt = qtn_vie_query_add_text_to_beginning; 
+            },
+        LBUF
+            {           
+            txt = qtn_vie_query_add_text_to_end; 
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+//
+//    r_ved_video_or_image_query
+//    List Query dialog
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_ved_video_or_image_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_SELECT_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtListQueryControl;
+            id = EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    flags = EAknListBoxMenuList;
+                    array_id = r_ved_video_or_image_query_items;
+                    };
+                heading = "#heading";
+                };
+            }
+        };
+    }	
+    
+    
+//-----------------------------------------------------------------------------
+//
+//    r_ved_video_or_image_query_items
+//    Items array for List Query
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_ved_video_or_image_query_items
+    {
+    items =
+        {
+        LBUF
+            { 
+            txt = qtn_vie_query_merge_with_video; 
+            },
+        LBUF
+            { 
+            txt = qtn_vie_query_merge_with_image; 
+            }
+        };
+    }    
+
+// List query headings
+RESOURCE TBUF r_vei_query_heading_add_text_to   { buf = qtn_vie_query_heading_add_text_to; }
+RESOURCE TBUF r_vei_query_heading_merge_with    { buf = qtn_vie_query_heading_merge_with; } 
+
+// Progress note texts
+RESOURCE TBUF r_vei_note_merging		{ buf = qtn_fldr_file_saving_wait;} 
+RESOURCE TBUF r_vei_note_adding_audio	{ buf = qtn_vie_note_processing;} 
+RESOURCE TBUF r_vei_note_adding_text	{ buf = qtn_vie_note_processing;} 
+RESOURCE TBUF r_vei_note_cutting		{ buf = qtn_vie_note_cutting;} 
+RESOURCE TBUF r_vei_note_processing		{ buf = qtn_vie_note_processing; } 
+
+// Other note texts
+RESOURCE TBUF r_vei_memory_running_out	{ buf = qtn_memlo_memory_running_out; } 
+RESOURCE TBUF r_vei_not_enough_memory	{ buf = qtn_memlo_ram_out_of_mem; }
+
+RESOURCE TBUF256 r_vei_error_note		                { buf= qtn_err_eikon_general; }
+RESOURCE TBUF    r_vei_errornote_image_inserting_failed	{ buf = qtn_vie_note_err_unable_to_insert_image; }
+RESOURCE TBUF    r_vei_errornote_audio_inserting_failed	{ buf = qtn_vie_note_err_audio_format; }
+
+RESOURCE TBUF r_vie_query_insert_short_audio    { buf = qtn_vie_query_insert_short_audio; }
+RESOURCE TBUF r_vie_query_insert_long_audio     { buf = qtn_vie_query_insert_long_audio; }
+
+//----------------------------------------------------
+//
+//    r_wait_dialog
+//    animated progress note
+//
+//----------------------------------------------------	
+RESOURCE DIALOG r_wait_dialog
+{
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+}	
+
+RESOURCE TBUF r_vei_in_use                  { buf = qtn_err_in_use;}
+
+RESOURCE TBUF r_vei_unable_to_edit                  { buf = qtn_vie_note_err_edit;}
+RESOURCE TBUF r_vei_unable_to_insert_video			{ buf = qtn_vie_note_err_unable_to_insert_video;}
+RESOURCE TBUF r_vei_unable_to_insert_sound			{ buf = qtn_vie_note_err_audio_format;} 
+RESOURCE TBUF r_vei_unable_to_insert_image			{ buf = qtn_vie_note_err_unable_to_insert_image;}
+
+RESOURCE TBUF r_vei_unable_to_insert_text			{ buf = qtn_vie_note_err_unable_to_add_text;}
+RESOURCE TBUF r_vei_unable_to_merge_videos			{ buf = qtn_vie_note_err_unable_to_merge_video_video;}
+RESOURCE TBUF r_vei_unable_to_merge_video_image		{ buf = qtn_vie_note_err_unable_to_merge_video_image;}
+RESOURCE TBUF r_vei_unable_to_change_sound			{ buf = qtn_vie_note_err_unable_to_change_sound;}
+RESOURCE TBUF r_vei_audio_format_not_supported		{ buf = qtn_vie_note_err_audio_format;} 
+RESOURCE TBUF r_vei_image_format_not_supported		{ buf = qtn_vie_note_err_image_format_not_supported;}
+
+RESOURCE TBUF r_vie_query_heading_save				{ buf = qtn_vie_query_heading_save;	}
+RESOURCE TBUF r_vie_query_save_new					{ buf = qtn_vie_query_save_new;	}
+RESOURCE TBUF r_vie_query_save_replace				{ buf = qtn_vie_query_save_replace;	}
+
+
+RESOURCE TBUF r_vie_query_heading_add_image_to 		{ buf = qtn_vie_query_heading_add_image_to; }
+RESOURCE TBUF r_vie_query_heading_add_video_to 		{ buf = qtn_vie_query_heading_add_video_to; }
+
+
+// The following strings should be added:
+// qtn_vie_note_unable_convert
+
+// Dummy dialog to consume key presses during operations
+RESOURCE DIALOG r_dummy_dialog
+   {
+   flags = EEikDialogFlagNoDrag | EEikDialogFlagCbaButtons; 
+   buttons = R_AVKON_SOFTKEYS_EMPTY ;    
+   }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/group/SimpleVideoEditor.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+#include <data_caging_paths.hrh>
+#include "../../Group/buildconfig.hrh"
+
+#if defined( __DEBUG_ON__ )
+MACRO           DEBUG_ON
+#endif
+#if defined( __DEBUG_ON_ALWAYS__ )
+MACRO           DEBUG_ON_ALWAYS
+#endif
+#if defined(__DEBUG_ON__) || defined(__DEBUG_ON_ALWAYS__)
+LIBRARY         flogger.lib
+#endif
+
+
+TARGET		SimpleVideoEditor.dll
+TARGETTYPE	DLL
+CAPABILITY	CAP_GENERAL_DLL
+UID		0x1000008d 0xA0000302
+
+
+USERINCLUDE	../inc
+USERINCLUDE	../../VideoEditorCommon/inc
+USERINCLUDE	../../VideoEditorUiComponents/inc
+#if defined(DEBUG_ON)
+USERINCLUDE	../utils/inc
+#endif
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH	../src
+SOURCE		SimpleVideoEditor.cpp
+SOURCE		SimpleVideoEditorImpl.cpp
+SOURCE		DummyControl.cpp
+SOURCE		CMultiLineQueryDialog.cpp
+
+SOURCEPATH	../data
+START RESOURCE  SimpleVideoEditor.rss
+HEADER
+TARGET SimpleVideoEditor.rsc
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+LIBRARY apparc.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY bitgdi.lib
+LIBRARY BitmapTransforms.lib
+LIBRARY	CommonDialogs.lib
+LIBRARY commonengine.lib
+LIBRARY commonui.lib
+LIBRARY cone.lib 
+LIBRARY efsrv.lib
+LIBRARY	eikcoctl.lib 
+LIBRARY eikcore.lib 
+LIBRARY eikctl.lib
+LIBRARY	eikdlg.lib 
+LIBRARY estor.lib
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+LIBRARY featmgr.lib
+LIBRARY gdi.lib
+LIBRARY ImageConversion.lib
+LIBRARY MGFetch.lib
+LIBRARY platformenv.lib
+LIBRARY ServiceHandler.lib
+LIBRARY sysutil.lib
+LIBRARY VedEngine.lib
+LIBRARY VideoEditorCommon.lib
+LIBRARY ws32.lib
+LIBRARY VideoEditorUiComponents.lib
+LIBRARY apgrfx.lib
+ 
+
+
+
+NOSTRICTDEF
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+#include "../../Group/buildconfig.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/SimpleVideoEditor.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(SimpleVideoEditor.iby)
+../rom/SimpleVideoEditorResources.iby  LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(SimpleVideoEditorResources.iby)
+
+
+PRJ_MMPFILES
+SimpleVideoEditor.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/inc/CMultiLineQueryDialog.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+#ifndef CMULTILINEQUERYDIALOG_H_
+#define CMULTILINEQUERYDIALOG_H_
+
+//  INCLUDES
+#include <AknQueryDialog.h>
+
+// CLASS DECLARATION
+
+/**
+ *  Text query dialog that accepts multiple lines input.
+ *  Wrapper for CAknTextQueryDialog 
+ */
+class CMultiLineQueryDialog : public CAknTextQueryDialog
+    {
+    
+    public:  // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @see CAknTextQueryDialog::NewL
+         */
+        IMPORT_C static CMultiLineQueryDialog* NewL( TDes& aDataText, 
+                        const TTone& aTone = ENoTone );
+        
+        /**
+         * Destructor.
+         */
+        ~CMultiLineQueryDialog();
+
+    public: // Functions from base classes
+        
+        /**
+         * Handle key events.
+         * @see CAknTextQueryDialog
+         */
+        IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                     			TEventCode aType );
+        
+    private:
+
+        /**
+         * C++ default constructor.
+         * @see CAknTextQueryDialog::CAknTextQueryDialog
+         */
+    	CMultiLineQueryDialog( TDes& aDataText, const TTone& aTone = ENoTone );
+        
+    private: // Data    
+    	
+
+    };
+
+#endif /*CMULTILINEQUERYDIALOG_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/inc/DummyControl.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/*
+* ============================================================================
+*  Name     : DummyControl.h
+*  Part of  : Video Editor
+*  Description:
+*     Declares dummy control class
+* ============================================================================
+*/
+  
+#ifndef _DUMMYCONTROL_H_
+#define _DUMMYCONTROL_H_
+
+#include <coecntrl.h>
+#include <akndialog.h>
+
+NONSHARABLE_CLASS( CDummyControl ) : public CAknDialog 
+	{
+public:
+	
+	void ConstructL ();
+	virtual ~CDummyControl();	
+	TKeyResponse OfferKeyEventL (const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/);
+	TBool OkToExitL (TInt aButtonId);
+
+	};
+
+#endif _DUMMYCONTROL_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/inc/SimpleVideoEditor.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Declares Base service API for all providers to implement in order to
+* offer services to Application Interworking Framework.
+*
+*/
+
+  
+#ifndef _SIMPLEVIDEOEDITOR_H_
+#define _SIMPLEVIDEOEDITOR_H_
+
+//<IBUDSW>
+#include <e32base.h>
+#include "SimpleVideoEditorExitObserver.h"
+
+// FORWARD DECLARATIONS
+class CSimpleVideoEditorImpl;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS(CSimpleVideoEditor) :  public CBase
+	{
+	public:	// Constructor and destructor
+
+		IMPORT_C static CSimpleVideoEditor* NewL( MSimpleVideoEditorExitObserver& aExitObserver );
+		IMPORT_C ~CSimpleVideoEditor();
+
+	public: // New functions
+
+		/** 
+		*	Merges the source video clip with another video or image.
+		*
+		*   @param aSourceFileName - The input video clip
+		*   @return -
+		*/
+		IMPORT_C void Merge( const TDesC& aSourceFileName );
+
+		/** 
+		*	Adds sound track to the source video clip.
+		*	Removes the original sound track.
+		*
+		*   @param aSourceFileName - The input video clip
+		*   @return -
+		*/
+		IMPORT_C void ChangeAudio( const TDesC& aSourceFileName );
+
+		/** 
+		*	Adds text to the source video clip.
+		*
+		*   @param aSourceFileName - The input video clip
+		*   @return -
+		*/
+		IMPORT_C void AddText( const TDesC& aSourceFileName );		
+
+		/** 
+		*	Cancels ongoing processing.
+		*
+		*   @param -
+		*   @return -
+		*/
+		IMPORT_C void Cancel();	
+
+	private: // Construct
+
+		CSimpleVideoEditor();
+		void ConstructL( MSimpleVideoEditorExitObserver& aExitObserver );
+
+	private: // Data
+
+		CSimpleVideoEditorImpl*	iImpl;
+	};
+
+//</IBUDSW>
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/inc/SimpleVideoEditorExitObserver.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:    
+*
+*/
+
+  
+#ifndef _SIMPLEVIDEOEDITOREXITOBSERVER_H_
+#define _SIMPLEVIDEOEDITOREXITOBSERVER_H_
+
+//<IBUDSW>
+#include <e32base.h>
+
+// CLASS DECLARATION
+class MSimpleVideoEditorExitObserver
+	{
+	public:
+		/**
+		*   @param aReason - Error code.
+		*   @param aResultFileName - 
+		*			The name of the created file.
+		*			In case of failure contains empty descriptor.
+		*/
+		virtual void HandleSimpleVideoEditorExit (TInt aReason, const TDesC& aResultFileName) = 0;
+	};
+
+//</IBUDSW>
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/inc/SimpleVideoEditorImpl.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,350 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+  
+#ifndef _SIMPLEVIDEOEDITORIMPL_H_
+#define _SIMPLEVIDEOEDITORIMPL_H_
+
+//<IBUDSW>
+
+// INCLUDES
+#include <e32std.h>
+#include <coemain.h>
+#include <ConeResLoader.h> 
+#include <aknappui.h>
+#include <VedMovie.h>
+#include <aknprogressdialog.h>
+#include <aknwaitdialog.h> 
+#include <VedAudioClipInfo.h>
+#include "SimpleVideoEditorExitObserver.h"
+#include "ExtProgressDialog.h"
+#include "VeiImageClipGenerator.h"
+#include "VeiTitleClipGenerator.h"
+
+#include "SimpleVideoEditor.h"
+#include "veisettings.h"
+
+// FORWARD DECLATATIONS
+class CVeiTempMaker;
+class CExtProgressDialog;
+class CDummyControl;
+class CErrorUI;
+
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS(CSimpleVideoEditorImpl) : public CActive, 
+											public MVedMovieObserver,
+											public MVedMovieProcessingObserver,
+											public MVeiImageClipGeneratorObserver,
+											public MProgressDialogCallback,
+											public MExtProgressDialogCallback,
+											public MCoeForegroundObserver,
+											public MVedAudioClipInfoObserver
+	{
+	public:	// Constructor and destructor
+
+		static CSimpleVideoEditorImpl* NewL(MSimpleVideoEditorExitObserver& aExitObserver);
+		~CSimpleVideoEditorImpl();
+
+	public: // New functions
+
+		void StartMerge( const TDesC& aSourceFileName );
+		void StartChangeAudio( const TDesC& aSourceFileName );
+		void StartAddText( const TDesC& aSourceFileName );
+
+		void StartWaitDialogL();
+		void StartProgressDialogL();
+		void StartAnimatedProgressDialogL ();
+		void CancelMovieProcessing();
+
+	private: // from CActive
+
+		void DoCancel();
+		void RunL();
+		TInt RunError(TInt aError);
+
+	private: // from MProgressDialogCallback
+
+		void DialogDismissedL( TInt aButtonId );
+
+	private: //from MVedMovieObserver
+
+		void NotifyVideoClipAdded(CVedMovie& aMovie, TInt aIndex);
+		void NotifyVideoClipAddingFailed(CVedMovie& aMovie, TInt aError);
+		void NotifyVideoClipRemoved(CVedMovie& aMovie, TInt aIndex);
+		void NotifyVideoClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, TInt aNewIndex);
+		void NotifyVideoClipTimingsChanged(CVedMovie& aMovie, TInt aIndex);
+		void NotifyVideoClipSettingsChanged(CVedMovie& aMovie, TInt aIndex);
+	    void NotifyVideoClipColorEffectChanged(CVedMovie& aMovie, TInt aIndex);
+	    void NotifyVideoClipAudioSettingsChanged(CVedMovie& aMovie, TInt aIndex);
+		void NotifyVideoClipGeneratorSettingsChanged(CVedMovie& aMovie, TInt aIndex);
+	    void NotifyVideoClipDescriptiveNameChanged(CVedMovie& aMovie, TInt aIndex);
+		void NotifyStartTransitionEffectChanged(CVedMovie& aMovie);
+		void NotifyMiddleTransitionEffectChanged(CVedMovie& aMovie, TInt aIndex);
+		void NotifyEndTransitionEffectChanged(CVedMovie& aMovie);
+		void NotifyAudioClipAdded(CVedMovie& aMovie, TInt aIndex);
+		void NotifyAudioClipAddingFailed(CVedMovie& aMovie, TInt aError);
+		void NotifyAudioClipRemoved(CVedMovie& aMovie, TInt aIndex);
+		void NotifyAudioClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, TInt aNewIndex);
+		void NotifyAudioClipTimingsChanged(CVedMovie& aMovie, TInt aIndex);
+		void NotifyMovieQualityChanged(CVedMovie& aMovie);
+	    void NotifyMovieReseted(CVedMovie& aMovie);
+		void NotifyMovieOutputParametersChanged(CVedMovie& aMovie);
+	    void NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& aMovie, TInt aClipIndex,  TInt aMarkIndex);
+		void NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& aMovie, TInt aClipIndex, TInt aMarkIndex);
+		void NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& aMovie, TInt aClipIndex, TInt aMarkIndex);
+		void NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& aMovie, TInt aClipIndex, TInt aMarkIndex);
+
+	private: //from MVedMovieProcessingObserver
+
+	    void NotifyMovieProcessingStartedL(CVedMovie& aMovie);
+	    void NotifyMovieProcessingProgressed(CVedMovie& aMovie, TInt aPercentage);
+		void NotifyMovieProcessingCompleted(CVedMovie& aMovie, TInt aError);
+		
+    public: // from MVedAudioClipInfoObserver 
+
+        void NotifyAudioClipInfoReady( CVedAudioClipInfo& aInfo, TInt aError );
+
+	public: //from MVeiImageClipGeneratorObserver
+
+		void NotifyImageClipGeneratorInitializationComplete(CVeiImageClipGenerator& aGenerator, TInt aError);
+    
+	private: // From MCoeForegroundObserver
+
+		virtual void HandleGainingForeground();
+		virtual void HandleLosingForeground();
+
+	private: // Construct
+
+		CSimpleVideoEditorImpl(MSimpleVideoEditorExitObserver& aExitObserver);
+		void ConstructL();
+
+	private: // New functions
+
+		// Helper functions to keep RunL function smaller
+		void InitializeOperationL();
+		void GetMergeInputFileL();
+		void GetAudioFileL();
+		void GetTextL();
+
+		TInt ShowListQueryL( TInt& aPosition, TInt aHeadingResourceId, TInt aQueryResourceId ) const;	
+        
+        void StartMovieProcessingL(const TDesC& aSourceFile);
+        
+        void RestoreOrientation();
+        
+        /** FilterError
+		*
+		*	Sets error code based on current values of iState and iOperationMode
+		*	i.e this is a context sensitive error mapping function
+		*
+		*	@param 
+		*	@return new error code
+		*/
+        TInt FilterError() const;
+
+		/** CompleteRequest
+		*
+		*	Force RunL
+		*
+		*	@param -
+		*	@return -
+		*/
+		void CompleteRequest();
+
+		/**
+        *   Shows error note with given message.
+        * 
+        *   @param aResourceId No description.         
+        */
+        void ShowErrorNote( const TInt aResourceId ) const;
+
+		/**
+		*   HandleError
+		* 
+		*   @param aErr Error code         
+		*/
+		void HandleError();
+				
+		/*	QueryAudioInsertionL
+		*
+		*	Launches a query dialog in case audio clip is shorter or longer
+		*   than the video clip
+		*
+		*   @param - 
+		*   @return 0 if user selects "No", 
+		*           1 if video and audio clips are the same length or
+		*             the user selects "Yes"
+		*/												
+        TInt QueryAudioInsertionL( TTimeIntervalMicroSeconds aVideoDuration, 
+                                   TTimeIntervalMicroSeconds aAudioDuration );										
+		
+		/**
+		*   ProcessingOkL
+		* 
+		*   Called after succesfull processing
+		*/
+		void ProcessingOkL();
+		
+		/**
+		*   ProcessingFailed
+		* 
+		*   Called after unsuccesfull processing
+		*/
+		void ProcessingFailed();
+		
+	    /**	QueryAndSaveL
+		*   
+		*	Displays Avkon file handling queries
+		*
+		* 	@param aSourceFileName  name of the video clip that
+		*							is selected to be merged
+		*   @return TInt 1 if the video should be saved,
+		*				 0 if the user has cancelled the saving
+		*	
+		*/		
+		TInt QueryAndSaveL(const TDesC& aSourceFileName); 
+		
+		/*	LaunchSaveVideoQueryL 
+		*
+		*	Launches a query dialog "Save video:" with items
+		*	"Replace original" and "Save with a new name"
+		*
+		*   @param - 
+		*   @return - list query id or -1 if the user selects No
+		*/        		
+		TInt LaunchSaveVideoQueryL (); 
+		
+		/*	LaunchSaveChangesQueryL
+		*
+		*	Launches a query dialog "Save changes?" query.
+		*
+		*   @param - 
+		*   @return 0 if user selects "No", otherwise 1
+		*/		
+		TInt LaunchListQueryDialogL (MDesCArray *	aTextItems,
+										const TDesC &	aPrompt); 
+								
+		void ResolveCaptionNameL( TApaAppCaption& aCaption ) const;
+
+	private: // Data
+
+		enum TOperationMode
+			{
+			EOperationModeMin = 0, // invalid
+			EOperationModeMerge,
+			EOperationModeMergeWithVideo,
+			EOperationModeMergeWithImage,
+			EOperationModeChangeAudio,
+			EOperationModeAddText,
+			EOperationModeMax      // invalid
+			} iOperationMode;
+					
+		enum TState
+			{
+			EStateMin = 0, // Invalid
+			EStateInitializing,
+			EStateInsertInputFirst,
+			EStateInsertInputSecond,
+			EStateInsertVideo,
+			EStateCreateImageGenerator,
+			EStateInsertImage,
+			EStateCheckAudioLength,
+			EStateInsertAudio,
+			EStateInsertTextToBegin,
+			EStateInsertTextToEnd,
+			EStateProcessing,
+			EStateProcessingOk,
+			EStateProcessingFailed,
+			EStateFinalizing,
+			EStateReady,
+			EOpMax      // Invalid
+			} iState;
+
+		CEikonEnv&				iEnv;
+
+		// Dummy control to eat key presses while dialogs are not active
+		CDummyControl*			iDummyControl;
+
+		// Interface to notify completion
+		MSimpleVideoEditorExitObserver& iExitObserver;
+
+		RConeResourceLoader 	iResLoader;
+
+		// 
+		CVedMovie*              iMovie;
+
+        // Temporary file name for storing preview clip.
+        HBufC*                  iTempFile;
+
+		// Owned by iMovie
+		CVeiImageClipGenerator* iImageClipGenerator;
+		
+		// Owned by iMovie
+		CVeiTitleClipGenerator* iTextGenerator;
+
+		// Input and output file names
+		TFileName 				iSourceFileName;
+		TFileName				iMergeFileName;
+		TFileName 				iAudioFileName;
+		HBufC*					iAddText;
+		TFileName 				iOutputFileName;
+
+		// Store the original orientation when forcing to portrait
+		CAknAppUiBase::TAppUiOrientation iOriginalOrientation;
+
+		// For process priority manipulation
+		TProcessPriority 		iOriginalProcessPriority;
+		TBool 					iProcessPriorityAltered;
+
+		// Progress dialog.
+		CAknProgressDialog*		iProgressDialog;
+
+		// Progress dialog.
+		CExtProgressDialog*		iAnimatedProgressDialog;
+
+		// Wait dialog.
+		CAknWaitDialog*			iWaitDialog;
+
+		TInt 					iPercentagesProcessed;
+		TInt 					iCancelPercentage;
+		TInt					iError;
+		
+		// Position where the image or video will be merged
+		// 0 if to the beginning, 1 if to the end.
+		TInt					iVideoOrImageIndex; 
+			
+		/** Error UI */
+		CErrorUI*            iErrorUI; 
+        
+        /** Pointer to an instance of CVedAudioClipInfo */
+        CVedAudioClipInfo* iAudioClipInfo;
+
+		/** Allowed audio mime types, used as playback in video */
+		CDesCArrayFlat *iAcceptedAudioTypes;
+		
+		/** Used to figure out if the CVeiImageClipGenerator::NewL() has
+		 *  completed in a situation where the action is cancelled. */
+		TBool				iGeneratorComplete;
+		TBool				iDialogDismissed;
+	};
+
+//</IBUDSW>
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/rom/SimpleVideoEditor.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#ifdef RD_S60_SIMPLE_VIDEO_EDITOR
+
+#ifndef __SIMPLEVIDEOEDITOR_IBY__
+#define __SIMPLEVIDEOEDITOR_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+// SimpleVideoEditor dll
+file=ABI_DIR\BUILD_DIR\SimpleVideoEditor.dll 	SHARED_LIB_DIR\SimpleVideoEditor.dll
+
+#endif	// __SIMPLEVIDEOEDITOR_IBY__
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/rom/SimpleVideoEditorResources.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __SIMPLEVIDEOEDITORRESOURCES_IBY__
+#define __SIMPLEVIDEOEDITORRESOURCES_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+data=DATAZ_\RESOURCE_FILES_DIR\SimpleVideoEditor.rsc    RESOURCE_FILES_DIR\SimpleVideoEditor.rsc
+
+#endif	// __SIMPLEVIDEOEDITORRESOURCES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/src/CMultiLineQueryDialog.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Class implementation.
+*
+*/
+/*
+* ============================================================================
+*  Name     : CMultiLineQueryDialog.cpp
+*  Part of  : Video Editor
+*  Interface : 
+*  Description:
+*     Class implementation.
+*  Version  :
+* ============================================================================
+*/
+
+// INCLUDES
+#include "CMultiLineQueryDialog.h"
+#include "VideoEditorCommon.h"
+
+// CONSTANTS
+
+_LIT( KNewLine, "\n" );
+
+// MEMBER FUNCTIONS
+
+// -----------------------------------------------------------------------------
+// CMultiLineQueryDialog::CMultiLineQueryDialog
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMultiLineQueryDialog::CMultiLineQueryDialog( TDes& aDataText, 
+                                        const TTone& aTone /*= ENoTone*/ )
+    : CAknTextQueryDialog( aDataText, aTone )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiLineQueryDialog::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMultiLineQueryDialog* CMultiLineQueryDialog::NewL( TDes& aDataText, 
+                                              const TTone& aTone /*= ENoTone*/ )
+    {
+    CMultiLineQueryDialog* self = new( ELeave ) CMultiLineQueryDialog( aDataText, aTone );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+//  Destructor
+// -----------------------------------------------------------------------------
+//    
+
+EXPORT_C CMultiLineQueryDialog::~CMultiLineQueryDialog()
+    {    
+    }
+
+// -----------------------------------------------------------------------------
+// CMultiLineQueryDialog::OfferKeyEventL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TKeyResponse CMultiLineQueryDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+                                         TEventCode aType )
+    { 
+    TKeyResponse response;
+	if ( aType == EEventKey && aKeyEvent.iCode == EKeyEnter )
+		{
+		CAknQueryControl* control = static_cast<CAknQueryControl*>( ControlOrNull( EGeneralQuery ) );
+		CEikEdwin* edWin = static_cast<CEikEdwin*>( control->ControlByLayoutOrNull( EDataLayout ) );
+		if (edWin)
+	    	{
+	    	edWin->GetText( iDataText );
+	    	iDataText.Append( KNewLine );
+	    	edWin->SetTextL( &iDataText );
+	    	edWin->ClearSelectionL();
+	    	}
+        response = EKeyWasConsumed;
+		}
+	else
+		{
+		response = CAknTextQueryDialog::OfferKeyEventL( aKeyEvent, aType );
+		}
+	
+	return response;
+    }
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/src/DummyControl.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+/*
+* ============================================================================
+*  Name     : DummyControl.cpp
+*  Part of  : Video Editor
+*  Interface : 
+*  Description:
+*     Class implementation.
+* ============================================================================
+*/
+
+#include "DummyControl.h"
+#include <SimpleVideoEditor.rsg>
+
+void CDummyControl::ConstructL ()
+	{
+	MakeVisible(EFalse);
+	this->ExecuteLD(R_DUMMY_DIALOG);
+	}
+
+CDummyControl::~CDummyControl()	
+	{
+	}
+
+TKeyResponse CDummyControl::OfferKeyEventL (const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/)
+	{
+	return EKeyWasConsumed;
+	}
+
+TBool CDummyControl::OkToExitL (TInt /*aButtonId*/)
+	{
+	return EFalse;
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/src/SimpleVideoEditor.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Class implementation.
+*
+*/
+
+
+// INCLUDES
+#include "VideoEditorCommon.h"
+#include "SimpleVideoEditor.h"
+#include "SimpleVideoEditorImpl.h"
+#include "VideoEditorDebugUtils.h"
+
+
+// MEMBER FUNCTIONS
+
+//=============================================================================
+EXPORT_C CSimpleVideoEditor* CSimpleVideoEditor::NewL( MSimpleVideoEditorExitObserver& aExitObserver )
+	{
+	CSimpleVideoEditor* self = new (ELeave)	CSimpleVideoEditor();
+	CleanupStack::PushL (self);
+	self->ConstructL( aExitObserver );
+	CleanupStack::Pop (self);
+	return self;
+	}
+
+//=============================================================================
+EXPORT_C CSimpleVideoEditor::~CSimpleVideoEditor()
+	{
+	delete iImpl;
+	}
+
+//=============================================================================
+EXPORT_C void CSimpleVideoEditor::Merge( const TDesC& aSourceFileName )
+	{
+	iImpl->StartMerge(aSourceFileName);
+	} 
+
+//=============================================================================
+EXPORT_C void CSimpleVideoEditor::ChangeAudio( const TDesC& aSourceFileName )
+	{
+	iImpl->StartChangeAudio(aSourceFileName);
+	}
+
+//=============================================================================
+EXPORT_C void CSimpleVideoEditor::AddText( const TDesC& aSourceFileName )
+	{
+	iImpl->StartAddText(aSourceFileName);
+	}
+
+//=============================================================================
+EXPORT_C void CSimpleVideoEditor::Cancel()
+	{
+	iImpl->CancelMovieProcessing();
+	}
+
+//=============================================================================
+void CSimpleVideoEditor::ConstructL(MSimpleVideoEditorExitObserver& aExitObserver)
+	{
+	iImpl = CSimpleVideoEditorImpl::NewL(aExitObserver);
+	}
+
+//=============================================================================
+CSimpleVideoEditor::CSimpleVideoEditor() 
+	{
+	}
+
+
+	
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/SimpleVideoEditor/src/SimpleVideoEditorImpl.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1866 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDES
+#include "SimpleVideoEditorImpl.h"
+#include <SimpleVideoEditor.rsg>
+#include <e32std.h>
+#include <aknutils.h>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+#include <mgfetch.h> 
+#include <sysutil.h>
+#include <stringloader.h>
+#include <aknnotewrappers.h> 
+#include <eikenv.h>
+#include <errorui.h>
+#include <PathInfo.h>
+#include <eikprogi.h>
+#include <stringloader.h>
+#include <VedAudioClipInfo.h>
+#include <CAknMemorySelectionDialog.h> 
+#include <CAknFileNamePromptDialog.h> 
+#include <AknCommonDialogsDynMem.h>
+#include <CAknMemorySelectionDialogMultiDrive.h>
+#include <apgcli.h>
+
+#include "VideoEditorUtils.h"
+#include "VeiAddQueue.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorDebugUtils.h"
+#include "VeiTempMaker.h"
+#include "ExtProgressDialog.h"
+#include "VeiMGFetchVerifier.h"
+#include "VeiImageClipGenerator.h"
+#include "DummyControl.h"
+#include "CMultiLineQueryDialog.h"
+
+// CONSTANTS
+_LIT(KResourceFile, "SimpleVideoEditor.rsc");
+const TProcessPriority KLowPriority = EPriorityLow;
+const TInt KAudioLevelMin = -127;
+const TUint KFadeInTimeMicroSeconds = 50000;
+
+#define KMediaGalleryUID3           0x101F8599 
+
+//=======================================================================================================
+CSimpleVideoEditorImpl* CSimpleVideoEditorImpl::NewL(MSimpleVideoEditorExitObserver& aExitObserver)
+	{
+	CSimpleVideoEditorImpl* self = new (ELeave)	CSimpleVideoEditorImpl(aExitObserver);
+	CleanupStack::PushL (self);
+	self->ConstructL();
+	CleanupStack::Pop (self);
+	return self;
+	}
+	
+//=======================================================================================================
+CSimpleVideoEditorImpl::~CSimpleVideoEditorImpl()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::~CSimpleVideoEditorImpl, In");
+
+	// Remove foreground event observer
+	iEnv.RemoveForegroundObserver( *this );
+
+	Cancel();
+	iResLoader.Close();
+
+	if ( iMovie )
+		{
+		iMovie->Reset();	
+		iMovie->UnregisterMovieObserver( this );				
+		delete iMovie;
+		iMovie = NULL;
+		}		
+
+	if ( iTempFile )
+		{
+		(void) iEnv.FsSession().Delete( *iTempFile );
+		delete iTempFile;
+		iTempFile = NULL;
+		}
+
+    if ( iProgressDialog )
+		{
+		iProgressDialog->SetCallback( NULL );		
+		delete iProgressDialog;
+		iProgressDialog = NULL;
+		}
+		
+	if ( iWaitDialog )
+		{
+		iWaitDialog->SetCallback(NULL);
+		delete iWaitDialog;
+		iWaitDialog = NULL;
+		}
+	if ( iAnimatedProgressDialog )
+		{			
+		delete iAnimatedProgressDialog;	
+		}
+		
+	if (iImageClipGenerator)
+		{
+		delete iImageClipGenerator;
+		}
+		
+	if (iTextGenerator)
+		{
+		delete iTextGenerator;	
+		}
+		
+	if (iAddText)
+		{
+		delete iAddText;	
+		}
+	
+	if ( iErrorUI )
+		{
+		delete iErrorUI;
+		}
+    
+    if ( iAudioClipInfo )
+        {
+        delete iAudioClipInfo;
+        }
+
+	if ( iAcceptedAudioTypes )
+		{
+		delete iAcceptedAudioTypes;
+		iAcceptedAudioTypes = 0;
+		}
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::~CSimpleVideoEditorImpl, Out");
+    }
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::RestoreOrientation()
+	{
+	CAknAppUiBase* appUi = static_cast<CAknAppUiBase *>( iEnv.EikAppUi() );
+	CAknAppUiBase::TAppUiOrientation orientation = appUi->Orientation();
+
+	if (orientation != iOriginalOrientation)
+		{
+		TRAP_IGNORE( appUi->SetOrientationL(iOriginalOrientation) );
+
+		// Send screen device change event to validate screen
+		TWsEvent event;
+
+		RWsSession& rws = iEnv.WsSession();
+		event.SetType( EEventScreenDeviceChanged );
+		event.SetTimeNow(); 
+		event.SetHandle( rws.WsHandle() ); 
+
+		(void)rws.SendEventToAllWindowGroups( event );
+		}
+	}
+
+//=======================================================================================================
+CSimpleVideoEditorImpl::CSimpleVideoEditorImpl(MSimpleVideoEditorExitObserver& aExitObserver) 
+: 	CActive (EPriorityStandard), 
+	iEnv( *CEikonEnv::Static() ), 
+	iExitObserver (aExitObserver), 
+	iResLoader( iEnv ),
+	iGeneratorComplete( ETrue ),
+	iDialogDismissed( EFalse )
+	{
+	CActiveScheduler::Add(this);   
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::ConstructL()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::ConstructL: In");
+
+	// Locate and open the resource file
+    TFileName fileName;
+    TParse p;    
+
+    Dll::FileName(fileName);
+    p.Set(KResourceFile, &KDC_RESOURCE_FILES_DIR, &fileName);
+    fileName = p.FullName();
+    
+    LOGFMT(KVideoEditorLogFile, "\tLoading resource file: %S", &fileName);
+	iResLoader.OpenL( fileName ); // RConeResourceLoader selects the correct language file
+
+	// Always use automatic save quality for the result movie
+	iMovie = CVedMovie::NewL( NULL );	
+	iMovie->RegisterMovieObserverL( this );
+	iMovie->SetQuality( CVedMovie::EQualityAutomatic );
+
+	CVeiTempMaker* maker = CVeiTempMaker::NewLC();
+	// this call can leave even though it does not end with 'L'
+	maker->EmptyTempFolder();
+	CleanupStack::PopAndDestroy(maker);
+	//delete maker;
+		
+	iEnv.AddForegroundObserverL( *this );
+	
+		
+	iErrorUI = CErrorUI::NewL( iEnv );
+
+	iAcceptedAudioTypes = new ( ELeave ) CDesCArrayFlat( 4 );
+
+	iAcceptedAudioTypes->Reset();
+
+	iAcceptedAudioTypes->AppendL( _L( "audio/mpeg" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/aac" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/amr" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/mp3" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/x-mp3" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/3gpp" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/3gpp2" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/m4a" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/mp4" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/mpeg4" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/wav" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/x-wav" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/x-realaudio" ) );
+	iAcceptedAudioTypes->AppendL( _L( "audio/wma" ) );
+		
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::ConstructL: Out");
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::StartMerge( const TDesC& aSourceFileName )
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartMerge: In");
+
+	iSourceFileName = aSourceFileName;
+	iOperationMode = EOperationModeMerge;
+	iState = EStateInitializing;
+
+	CompleteRequest();
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartMerge: Out");
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::StartChangeAudio( const TDesC& aSourceFileName )
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartChangeAudio: In");
+
+	iSourceFileName = aSourceFileName;
+	iOperationMode = EOperationModeChangeAudio;
+	iState = EStateInitializing;
+
+	CompleteRequest();
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartChangeAudio: Out");
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::StartAddText( const TDesC& aSourceFileName )
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartAddText: In");
+
+	iSourceFileName = aSourceFileName;
+	iOperationMode = EOperationModeAddText;
+	iState = EStateInitializing;
+
+	CompleteRequest();
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartAddText: Out");
+	}
+
+
+//=============================================================================
+void CSimpleVideoEditorImpl::RunL()
+	{	
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::RunL: In");
+
+	// Resetting these indicators. This is not necessary right now,
+	// but might be in the future if the code is changed so it's reasonable to
+	// to do it anyway, just in case.
+	iGeneratorComplete = ETrue;
+	iDialogDismissed = EFalse;
+	
+	// if RunL() leaves, RunError() is called and iState is changed to EStateFinalizing
+	// (or to EStateReady if already in EStateFinalizing
+	
+	switch (iState)
+		{
+		case EStateInitializing:
+			{
+			InitializeOperationL();
+
+			iState = EStateInsertInputFirst;
+			CompleteRequest();
+			break;
+			}
+		case EStateInsertInputFirst:
+			{
+			// Common to all operation modes: Insert the original video clip to the movie
+			// (Operation continues from the NotifyVideoClipAdded() callback method).
+			iMovie->InsertVideoClipL( iSourceFileName, 0 );
+			StartWaitDialogL();
+
+			break;
+			}
+		case EStateInsertInputSecond:
+			{
+			// Get the input - text, image, video or sound clip
+			switch (iOperationMode)
+				{
+				case EOperationModeMerge:
+					{											
+					GetMergeInputFileL();						
+					CompleteRequest();	
+					break;
+					}
+								
+				case EOperationModeChangeAudio:
+					{
+					GetAudioFileL();
+					CompleteRequest();
+					break;
+					}
+				
+				case EOperationModeAddText:
+					{
+					GetTextL();
+					CompleteRequest();
+					break;
+					}
+					
+				default:
+					User::Invariant();
+					break;
+				}			
+				break;
+			}				
+	    case EStateCheckAudioLength:
+	        {
+	        // NotifyAudioClipInfoReady is called instead of RunL
+	        break;    
+	        }
+		case EStateInsertVideo:
+			{																				
+			iMovie->InsertVideoClipL(iMergeFileName, iVideoOrImageIndex); 
+			StartWaitDialogL();
+			break;
+			}
+		case EStateCreateImageGenerator:	
+			{																						
+			TTimeIntervalMicroSeconds duration( 3000000 );
+		    TRgb background = KRgbBlack;
+		    // Setting to false to indicate that the
+		    // NewL() called below hasn't yet completed.
+		    iGeneratorComplete = EFalse;
+
+			// Create the image clip generator
+		    iImageClipGenerator = CVeiImageClipGenerator::NewL( 
+    			iMergeFileName, 
+    			iMovie->Resolution(),
+    			duration, 
+    			background, 
+    			KVideoClipGenetatorDisplayMode, 
+    			iEnv.FsSession(), 
+    			*this );
+    		StartWaitDialogL();	    						    			
+			break;
+			}
+		case EStateInsertImage:
+			{		
+			TRAPD(err, iMovie->InsertVideoClipL( *iImageClipGenerator, ETrue, iVideoOrImageIndex )); // generator owned by movie 
+			if (KErrNone == err)
+				{				
+				// Generator is no longer our concern, ownership transferred to iMovie							
+				iImageClipGenerator = 0;				
+				StartWaitDialogL();
+				}
+			else
+				{					
+				iError = err;
+				iError = FilterError();
+				iState = EStateFinalizing;
+				CompleteRequest();
+				}
+			break;			
+			}	
+		
+		case EStateInsertAudio:
+			{
+			LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::RunL: Inserting audio clip %S", &iAudioFileName);
+
+			iMovie->AddAudioClipL( iAudioFileName, TTimeIntervalMicroSeconds( 0 ));    
+			StartWaitDialogL();
+			break;
+			}
+					
+		case EStateInsertTextToBegin:
+			{	
+			LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::RunL: 1");
+			
+			
+			iTextGenerator = CVeiTitleClipGenerator::NewL( iMovie->Resolution(),
+																			   EVeiTitleClipTransitionNone, 
+																			   EVeiTitleClipHorizontalAlignmentCenter,
+																			   EVeiTitleClipVerticalAlignmentCenter);
+			
+			HBufC* descriptiveName = StringLoader::LoadLC(R_VESM_EDIT_VIEW_TITLE_NAME, &iEnv );
+			iTextGenerator->SetDescriptiveNameL(*descriptiveName);
+			CleanupStack::PopAndDestroy(descriptiveName);			
+			iTextGenerator->SetTextL(*iAddText);
+			
+			iTextGenerator->SetTransitionAndAlignmentsL(EVeiTitleClipTransitionNone, 
+														EVeiTitleClipHorizontalAlignmentCenter, 
+														EVeiTitleClipVerticalAlignmentCenter);
+			LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::RunL: 2");			
+			TRAPD(err, iMovie->InsertVideoClipL( *iTextGenerator, ETrue, 0));	
+												
+			if (KErrNone == err)
+				{				
+				// Generator is no longer our concern, ownership transferred to iMovie							
+				iTextGenerator = 0;				
+				LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::RunL: 3");		
+				StartWaitDialogL();
+				}
+			else
+				{				
+				iError = err;
+				iError = FilterError();
+				iState = EStateFinalizing;
+				CompleteRequest();
+				}		
+			break;
+			}
+		
+		case EStateInsertTextToEnd:
+			{
+			LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::RunL: 4");									
+			
+			iTextGenerator = CVeiTitleClipGenerator::NewL( iMovie->Resolution(),
+																		   EVeiTitleClipTransitionScrollBottomToTop, 
+																		   EVeiTitleClipHorizontalAlignmentCenter,
+																		   EVeiTitleClipVerticalAlignmentCenter);
+			
+			HBufC* descriptiveName = StringLoader::LoadLC(R_VESM_EDIT_VIEW_TITLE_NAME, &iEnv );
+			iTextGenerator->SetDescriptiveNameL(*descriptiveName);
+			CleanupStack::PopAndDestroy(descriptiveName);			
+			iTextGenerator->SetTextL(*iAddText);
+			
+			iTextGenerator->SetTransitionAndAlignmentsL(EVeiTitleClipTransitionScrollBottomToTop,
+													EVeiTitleClipHorizontalAlignmentCenter, 
+													EVeiTitleClipVerticalAlignmentCenter);
+			LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::RunL: 5");
+			
+			TRAPD(err, iMovie->InsertVideoClipL( *iTextGenerator, ETrue, 1));
+				
+			if (KErrNone == err)
+				{				
+				// Generator is no longer our concern, ownership transferred to iMovie							
+				iTextGenerator = 0;				
+				LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::RunL: 6");
+				StartWaitDialogL();
+				}
+			else
+				{	
+				iError = err;
+				iError = FilterError();
+				iState = EStateFinalizing;
+				CompleteRequest();
+				}
+			break;	
+			}	
+
+		case EStateProcessing:
+			{			
+			StartMovieProcessingL(iSourceFileName);
+			break;
+			}
+		
+		case EStateProcessingOk:
+			{			
+			ProcessingOkL();
+			CompleteRequest();
+			break;
+			}
+				
+		case EStateProcessingFailed:
+			{			
+			ProcessingFailed();
+			CompleteRequest();					
+			break;
+			}
+			
+		case EStateFinalizing:
+			{			
+			// Show possible error dialog etc.
+			// in TRAP because endless call loop may otherwise be resulted in case of leave in HandleErrorL
+			// @ : should FilterError() be called only from here?
+			HandleError();
+			iState = EStateReady;	
+			CompleteRequest();
+			break;
+			}
+			
+		case EStateReady:
+			{				
+			// Notify completion to observer
+			iExitObserver.HandleSimpleVideoEditorExit( iError, iOutputFileName );
+			break;
+			}
+
+		default:
+			{
+			User::Invariant();
+			break;
+			}
+		}
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::RunL: Out");
+	}
+
+//=============================================================================
+void CSimpleVideoEditorImpl::DoCancel()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::DoCancel: In");
+	CancelMovieProcessing();
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::DoCancel: Out");
+	}
+//=============================================================================	
+	
+void CSimpleVideoEditorImpl::CancelMovieProcessing()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::CancelMovieProcessing: In");
+
+	if (iMovie)
+		{
+		iMovie->CancelProcessing();
+		}	
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::CancelMovieProcessing: Out");
+	}	
+//=============================================================================
+
+TInt CSimpleVideoEditorImpl::RunError( TInt aError )
+	{
+	LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::RunError: %d", aError);
+	//@ :  think how to solve this
+	
+	// Show possible error dialog etc.
+	iError = aError;
+	// @: if leave and error happens so that Notify callbacks are not called
+	iError = FilterError();
+	
+	// if leave happens in HandleError, iState must be changed to prevent same leave happening eternally 
+	if (EStateReady == iState)
+		{
+		iExitObserver.HandleSimpleVideoEditorExit( iError, iOutputFileName );
+		}
+	else
+		{			
+		iState = EStateReady;	
+		HandleError();
+		iExitObserver.HandleSimpleVideoEditorExit( iError, iOutputFileName );
+		// If CompleteRequest() is called here, system crashes because ~CSimpleVideoEditorImpl() gets
+		// called from iExitObserver.HandleSimpleVideoEditorExitL(), stray signal resulted
+		//CompleteRequest();
+		}							
+
+	return KErrNone;	
+	}
+//=======================================================================================================
+
+void CSimpleVideoEditorImpl::InitializeOperationL()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::InitializeOperationL: In");
+
+	iOutputFileName.Zero();
+
+	if( !AknLayoutUtils::PenEnabled() && EOperationModeAddText == iOperationMode )
+		{
+		// Text input is always inserted in portrait mode.
+		// Store the original screen orientation.
+		CAknAppUiBase* appUi = static_cast<CAknAppUiBase *>( iEnv.EikAppUi() );
+		iOriginalOrientation = appUi->Orientation();
+		appUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait);
+		}
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::InitializeOperationL: Out");
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::GetMergeInputFileL()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::GetMergeInputFileL: In");
+
+	iVideoOrImageIndex = 0; 
+
+	CDesCArrayFlat* selectedFiles = new ( ELeave ) CDesCArrayFlat( 1 );
+	CleanupStack::PushL(selectedFiles);
+
+	CDesCArrayFlat* mimetypesVideo = new ( ELeave ) CDesCArrayFlat( 1 );
+	CleanupStack::PushL(mimetypesVideo);
+	mimetypesVideo->AppendL(_L("video/*"));
+
+	CDesCArrayFlat* mimetypesImage = new ( ELeave ) CDesCArrayFlat( 1 );
+	CleanupStack::PushL(mimetypesImage);
+	mimetypesImage->AppendL(_L("image/*"));
+	
+	TInt videoOrImage = -1;
+	TBool chosen = EFalse;
+
+	// Select the input type: video clip or image
+	if ( ShowListQueryL(videoOrImage, R_VEI_QUERY_HEADING_MERGE_WITH, R_VED_VIDEO_OR_IMAGE_QUERY) )
+		{
+		CVeiMGFetchVerifier* mgFetchVerifier = CVeiMGFetchVerifier::NewLC();
+		if (0 == videoOrImage) // video chosen
+			{
+			if ( MGFetch::RunL( *selectedFiles, EVideoFile, EFalse, KNullDesC(), KNullDesC(), mimetypesVideo, mgFetchVerifier))
+				{
+				chosen = ETrue;
+				}
+			}
+		else if (1 == videoOrImage) // image chosen
+			{
+		    if ( MGFetch::RunL( *selectedFiles, EImageFile, EFalse, KNullDesC(), KNullDesC(), mimetypesImage, mgFetchVerifier))
+				{
+				chosen = ETrue;
+				}
+			}
+		CleanupStack::PopAndDestroy( mgFetchVerifier );
+
+		if (chosen)
+			{
+			iMergeFileName = selectedFiles->MdcaPoint(0);
+			TInt headingResourceId = R_VIE_QUERY_HEADING_ADD_VIDEO_TO; 
+			if (0 == videoOrImage) // video chosen
+				{
+				iOperationMode = EOperationModeMergeWithVideo;
+				iState = EStateInsertVideo;				
+				headingResourceId = R_VIE_QUERY_HEADING_ADD_VIDEO_TO; 
+				LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::GetMergeInputFileL: 4");								
+				} 
+			else if (1 == videoOrImage) // image chosen
+				{
+				iOperationMode = EOperationModeMergeWithImage;
+				iState = EStateCreateImageGenerator;			    			    
+				headingResourceId = R_VIE_QUERY_HEADING_ADD_IMAGE_TO; 
+				LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::GetMergeInputFileL: 5");				
+				}
+
+			TInt begOrEnd = -1;
+			if ( ShowListQueryL(begOrEnd, headingResourceId, R_VED_INSERT_POSITION_QUERY) )
+				{			
+				LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::GetMergeInputFileL: 6");
+																
+				if (0 == begOrEnd) // video or image to the beginning
+					{			
+					iVideoOrImageIndex = 0;				
+					}
+				else // video or image to end 
+					{				
+					iVideoOrImageIndex = 1;				
+					}		    
+				}
+			else
+				{
+				iState = EStateFinalizing;	
+				}	
+			} // if (chosen)
+		else
+			{
+			iState = EStateFinalizing;	
+			}
+		} // if ( ShowListQueryL for image or video
+	else
+		{
+		iState = EStateFinalizing;	
+		}
+	
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::GetMergeInputFileL: 7");
+	CleanupStack::PopAndDestroy(mimetypesImage);
+	CleanupStack::PopAndDestroy(mimetypesVideo);
+	CleanupStack::PopAndDestroy(selectedFiles);
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::GetMergeInputFileL: Out");	
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::GetAudioFileL()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::GetAudioFileL: In");
+
+	TFileName outputFile;
+
+	CDesCArrayFlat* selectedFiles = new ( ELeave ) CDesCArrayFlat( 1 );
+	CleanupStack::PushL(selectedFiles);
+	CVeiMGFetchVerifier* mgFetchVerifier = CVeiMGFetchVerifier::NewLC();
+
+	if ( MGFetch::RunL( *selectedFiles, EAudioFile, EFalse, KNullDesC, KNullDesC , iAcceptedAudioTypes, mgFetchVerifier ) )
+		{
+        iAudioFileName = selectedFiles->MdcaPoint(0);
+        iAudioClipInfo = CVedAudioClipInfo::NewL( iAudioFileName, *this );
+        iState = EStateCheckAudioLength;
+		}
+	else
+		{
+		iState = EStateFinalizing;	
+		}
+				
+	CleanupStack::PopAndDestroy( mgFetchVerifier );
+	CleanupStack::PopAndDestroy(selectedFiles);			
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::GetAudioFileL: Out");
+	}
+	
+//=======================================================================================================
+void CSimpleVideoEditorImpl::GetTextL()
+	{	
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::GetTextL: In");
+
+	// Ask for text. 
+	iAddText = HBufC::NewL(AKNTEXT_QUERY_WIDTH * AKNTEXT_QUERY_LINES); // think what these limit values should be?	
+	TPtr textPtr = iAddText->Des();
+	CMultiLineQueryDialog* textQuery = CMultiLineQueryDialog::NewL(textPtr);	
+	textQuery->SetMaxLength(AKNTEXT_QUERY_WIDTH * AKNTEXT_QUERY_LINES);	
+	//textQuery->SetPredictiveTextInputPermitted(ETrue);
+
+	if (textQuery->ExecuteLD(R_VESM_EDITVIDEO_TITLESCREEN_TEXT_QUERY))
+		{					
+		// Restore the original screen orientation immediately after the text input ends
+		RestoreOrientation();
+		
+		TInt begOrEnd = -1;		
+		
+		if ( ShowListQueryL(begOrEnd, R_VEI_QUERY_HEADING_ADD_TEXT_TO, R_VED_INSERT_POSITION_QUERY) )
+			{			
+			LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::GetTextL: 1");
+															
+			if (0 == begOrEnd) // text to begin
+				{			
+				iState = EStateInsertTextToBegin;				
+				}
+			else // text to end in credits style (rolling down the screen)
+				{				
+				iState = EStateInsertTextToEnd;				
+				}		    		    
+			}
+		else
+			{
+			iState = EStateFinalizing;	
+			}
+		}
+	else
+		{
+		// Restore the original screen orientation immediately after the text input ends
+		RestoreOrientation();
+		iState = EStateFinalizing;
+		}
+	
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::GetTextL: Out");
+	}
+
+//=======================================================================================================
+TInt CSimpleVideoEditorImpl::ShowListQueryL (TInt& aPosition, 
+											 TInt aHeadingResourceId,
+											 TInt aQueryResourceId) const
+    {
+    CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &aPosition );
+    dlg->PrepareLC( aQueryResourceId );
+    
+    CAknPopupHeadingPane* heading = dlg->QueryHeading();
+    HBufC* noteText = StringLoader::LoadLC( aHeadingResourceId, &iEnv );
+    heading->SetTextL( noteText->Des() );
+    CleanupStack::PopAndDestroy( noteText );
+
+    return dlg->RunLD();        
+    }
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::StartMovieProcessingL(const TDesC& aSourceFile)
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartMovieProcessingL: In");
+
+	RFs&	fs = iEnv.FsSession();
+
+	if (QueryAndSaveL(aSourceFile)) 
+	{	
+		// Generate temp file.
+		// Take the drive from the target file name.
+		CAknMemorySelectionDialog::TMemory memory( CAknMemorySelectionDialog::EMemoryCard );
+		if( 0 != iOutputFileName.Left(1).CompareF( PathInfo::MemoryCardRootPath().Left(1) ) )
+			{
+			memory = CAknMemorySelectionDialog::EPhoneMemory;
+			}
+
+		iTempFile = HBufC::NewL(KMaxFileName);
+		CVeiTempMaker* maker = CVeiTempMaker::NewL();
+		maker->GenerateTempFileName( *iTempFile, memory, iMovie->Format() );
+		delete maker;
+
+		// Start rendering video to the temporary file.
+		LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartMovieProcessingL: 1, calling iMovie->ProcessL(%S)", iTempFile);
+		iMovie->ProcessL(*iTempFile, *this);
+	}
+	else
+	{
+		LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartMovieProcessingL: User cancelled saving");
+		iState = EStateProcessingFailed;
+		CompleteRequest();
+	}
+	
+	// Next: wait for MVedMovieProcessingObserver callback
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartMovieProcessingL: Out");
+	}
+
+//=============================================================================
+TInt CSimpleVideoEditorImpl::QueryAndSaveL(const TDesC& aSourceFileName)
+{
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::QueryAndSaveL: in");
+
+	TBool ret = EFalse;
+	
+	RFs	fs = CCoeEnv::Static()->FsSession();
+
+	// launch query with choices "Replace original" and "Save with a new file name" 
+	TInt userSelection = LaunchSaveVideoQueryL(); 
+	
+  	if(userSelection == 0) 
+  	// the user selects to save with a new file name
+		{
+		CAknMemorySelectionDialog::TMemory selectedMemory(CAknMemorySelectionDialog::EPhoneMemory);		
+
+        // Multiple drive support
+#ifdef RD_MULTIPLE_DRIVE
+		
+		TDriveNumber driveNumber;
+        TFileName driveAndPath;
+        CAknMemorySelectionDialogMultiDrive* multiDriveDlg = CAknMemorySelectionDialogMultiDrive::NewL(ECFDDialogTypeSave, EFalse );			
+		CleanupStack::PushL(multiDriveDlg);
+		
+		// launch "Select memory" query
+        if (multiDriveDlg->ExecuteL( driveNumber, &driveAndPath, NULL ))
+			{
+			iOutputFileName.Zero();				
+			
+			// Generate a default name for the new file
+			TInt err = VideoEditorUtils::GenerateFileNameL (
+                                    					fs,
+                                    					aSourceFileName,		
+                                    					iOutputFileName,
+                                    					iMovie->Format(),
+                                    					iMovie->GetSizeEstimateL(),
+                                    					driveAndPath);	
+				
+            driveAndPath.Append( PathInfo::VideosPath() );					
+				
+			if ( KErrNone == err )
+				{				
+				// launch file name prompt dialog
+				if (CAknFileNamePromptDialog::RunDlgLD(iOutputFileName, driveAndPath, KNullDesC))
+					{
+					driveAndPath.Append(iOutputFileName);
+					iOutputFileName = driveAndPath;
+		            ret = ETrue;
+		            }
+				}
+			else // err != KErrNone 
+				{
+				iErrorUI->ShowGlobalErrorNoteL( err );
+				ret = EFalse;
+				}											
+			}
+		CleanupStack::PopAndDestroy( multiDriveDlg );
+
+#else // no multiple drive support
+			
+		// launch "Select memory" query
+		if (CAknMemorySelectionDialog::RunDlgLD(selectedMemory))
+			{
+			// create path for the image	
+			TFileName driveAndPath;        		
+			VideoEditor::TMemory memorySelection = VideoEditor::EMemPhoneMemory;		 
+			if (selectedMemory == CAknMemorySelectionDialog::EPhoneMemory)
+				{
+				memorySelection = VideoEditor::EMemPhoneMemory;
+				driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() );
+				driveAndPath.Append( PathInfo::VideosPath() );							
+				}
+			else if (selectedMemory == CAknMemorySelectionDialog::EMemoryCard)
+				{	
+				memorySelection = VideoEditor::EMemMemoryCard;				
+				driveAndPath.Copy( PathInfo::MemoryCardRootPath() );
+				driveAndPath.Append( PathInfo::VideosPath() );							
+				}        				 
+
+
+			// GenerateNewDocumentNameL also checks disk space
+			iOutputFileName.Zero();
+			TInt err = VideoEditorUtils::GenerateNewDocumentNameL (
+				fs,
+				aSourceFileName,		
+				iOutputFileName,
+				iMovie->Format(),
+				iMovie->GetSizeEstimateL(),
+				memorySelection);	
+				
+			if ( KErrNone == err )
+				{				
+				// launch file name prompt dialog
+				if (CAknFileNamePromptDialog::RunDlgLD(iOutputFileName, driveAndPath, KNullDesC))
+					{
+					driveAndPath.Append(iOutputFileName);
+					iOutputFileName = driveAndPath;
+		            ret = ETrue;
+		            }
+				}
+			else // err != KErrNone 
+				{
+				ret = EFalse;
+				}						
+			}
+#endif
+		}
+	// user selects to overwrite
+	else if (userSelection == 1)
+	
+		{
+		iOutputFileName = aSourceFileName;
+		return ETrue;	
+		}
+	else // user cancelled
+		{
+		ret = EFalse;
+		}
+
+	LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::QueryAndSaveL: out: %d", ret);
+
+	return ret;
+}
+
+
+
+//=============================================================================
+TInt CSimpleVideoEditorImpl::LaunchListQueryDialogL (
+	MDesCArray *	aTextItems,
+	const TDesC &	aPrompt
+	) 
+{
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::LaunchListQueryDialogL: in");
+	//	Selected text item index
+	TInt index (-1);
+
+	//	Create a new list dialog
+    CAknListQueryDialog * dlg = new (ELeave) CAknListQueryDialog (&index);
+
+	//	Prepare list query dialog
+	dlg->PrepareLC (R_VIE_LIST_QUERY);
+
+	//	Set heading
+	dlg->QueryHeading()->SetTextL (aPrompt);
+
+	//	Set text item array
+	dlg->SetItemTextArray (aTextItems);	
+
+	//	Set item ownership
+	dlg->SetOwnershipType (ELbmDoesNotOwnItemArray);
+
+	//	Execute
+	if (dlg->RunLD())
+	{
+		LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::LaunchListQueryDialogL: out: return %d", index);	
+		return index;
+	}
+	else
+	{
+		LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::LaunchListQueryDialogL: out: return -1");		
+		return -1;
+	}
+}
+
+//=============================================================================
+TInt CSimpleVideoEditorImpl::LaunchSaveVideoQueryL () 
+{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::LaunchSaveVideoQueryL: in");
+	//	Create dialog heading and options
+    HBufC * heading = CEikonEnv::Static()->AllocReadResourceLC (R_VIE_QUERY_HEADING_SAVE);
+    HBufC * option1 = CEikonEnv::Static()->AllocReadResourceLC (R_VIE_QUERY_SAVE_NEW);       
+    HBufC * option2 = CEikonEnv::Static()->AllocReadResourceLC (R_VIE_QUERY_SAVE_REPLACE); 
+                
+	//	Query dialog texts
+	CDesCArray * options = new (ELeave) CDesCArraySeg (2);
+	CleanupStack::PushL (options);
+	options->AppendL( option1->Des() );
+	options->AppendL( option2->Des() );
+
+	//	Execute query dialog
+	TInt ret = LaunchListQueryDialogL (options, *heading);
+
+	options->Reset();
+	
+	CleanupStack::PopAndDestroy( options ); 
+	CleanupStack::PopAndDestroy( option2 ); 
+	CleanupStack::PopAndDestroy( option1 ); 		
+	CleanupStack::PopAndDestroy( heading ); 
+	
+	LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::LaunchListQueryDialogL: out: return %d", ret);			
+	return ret;
+}
+
+
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::HandleLosingForeground()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::HandleLosingForeground(): In");
+
+	// Set the priority to low. This is needed to handle the situations 
+	// where the engine is performing heavy processing while the application 
+	// is in background.
+	RProcess myProcess;
+	iOriginalProcessPriority = myProcess.Priority();
+	LOGFMT3(KVideoEditorLogFile, "CSimpleVideoEditorImpl::HandleLosingForeground: changing priority of process %Ld from %d to %d", myProcess.Id().Id(), iOriginalProcessPriority, KLowPriority);
+	myProcess.SetPriority( KLowPriority );
+	iProcessPriorityAltered = ETrue;
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::HandleLosingForeground(): Out");
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::HandleGainingForeground()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::HandleGainingForeground(): In");
+
+	// Return to normal priority.
+	RProcess myProcess;
+	TProcessPriority priority = myProcess.Priority();
+	if ( priority < iOriginalProcessPriority )
+		{
+		myProcess.SetPriority( iOriginalProcessPriority );
+		}
+	iProcessPriorityAltered = EFalse;
+
+	LOGFMT2(KVideoEditorLogFile, "CSimpleVideoEditorImpl::HandleGainingForeground: Out: process %Ld back to normal priority %d", myProcess.Id().Id(), priority);
+	}
+
+//=======================================================================================================
+TInt CSimpleVideoEditorImpl::FilterError(/*const TInt& aErrEngine, const TInt& aErrUi*/) const
+	{
+	// here standard leave codes are converted to our own codes having correspondent localized error messages						
+	if (KErrNone != iError && KErrCancel != iError)
+		{		
+		if (EStateInsertInputFirst == iState )
+			{
+			return KErrUnableToEditVideo;
+			}
+		else if (EStateInsertVideo == iState)
+		    {
+		    if (KErrNotSupported == iError)	
+				{
+				return KErrVideoFormatNotSupported;	
+				}
+			else return KErrUnableToInsertVideo;
+		    }
+		else if (EStateInsertImage == iState || EStateCreateImageGenerator == iState)
+			{
+			if (KErrNotSupported == iError)	
+				{
+				return KErrImageFormatNotSupported;	
+				}		
+			else return KErrUnableToInsertImage;
+			}		
+		else if (EStateInsertAudio == iState || EStateCheckAudioLength == iState )
+			{
+			if (KErrNotSupported == iError)	
+				{
+				return KErrAudioFormatNotSupported;	
+				}
+			else 
+				{
+				return KErrUnableToInsertSound;
+				}
+			}
+		else if (EStateInsertTextToBegin == iState || EStateInsertTextToEnd == iState)
+			{		
+			return KErrUnableToInsertText;	
+			}			
+		else if (EOperationModeMergeWithVideo == iOperationMode)
+			{
+			return KErrUnableToMergeVideos;
+			} 
+		else if (EOperationModeMergeWithImage == iOperationMode)
+			{
+			return KErrUnableToMergeVideoAndImage;
+			} 
+		else if (EOperationModeChangeAudio == iOperationMode)
+			{
+			return KErrUnableToChangeSound;
+			}
+		else if (EOperationModeAddText == iOperationMode)
+			{
+			if (iError == KErrNoMemory) return KErrNoMemory;
+			return KErrUnableToInsertText;
+			} 
+		}
+	
+	return iError;					
+	}
+
+
+//=============================================================================
+void CSimpleVideoEditorImpl::CompleteRequest()
+	{
+	if ( IsActive() )
+		{
+		Cancel();
+		}
+	TRequestStatus * p = &iStatus;
+	SetActive();
+	User::RequestComplete (p, KErrNone);
+	}
+
+//=============================================================================
+void CSimpleVideoEditorImpl::HandleError()
+	{		
+	LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::HandleErrorL: In, iError:%d", iError);
+
+	if (KErrNone != iError && KErrCancel != iError)
+		{
+						
+		if (iTempFile)
+			{			
+			TInt delErr = iEnv.FsSession().Delete( *iTempFile );
+			LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::HandleErrorL: 1, delErr:%d", delErr);
+			delete iTempFile;
+			iTempFile = NULL;
+			}
+		
+		switch (iError)
+			{
+		    case KErrInUse:
+	            {
+	            ShowErrorNote(R_VEI_IN_USE);
+                break;	            
+	            }
+		    case KErrUnableToEditVideo:
+	            {
+	            ShowErrorNote(R_VEI_UNABLE_TO_EDIT);
+                break;	            
+	            }
+			case KErrUnableToInsertVideo:
+				{
+				ShowErrorNote(R_VEI_UNABLE_TO_INSERT_VIDEO);
+				break;
+				}
+			case KErrUnableToInsertSound:
+				{
+				ShowErrorNote(R_VEI_UNABLE_TO_INSERT_SOUND);
+				break;
+				}
+			case KErrUnableToInsertImage:
+				{
+				ShowErrorNote(R_VEI_UNABLE_TO_INSERT_IMAGE);
+				break;
+				}
+			case KErrUnableToInsertText:
+				{
+				ShowErrorNote(R_VEI_UNABLE_TO_INSERT_TEXT);
+				break;
+				}
+			case KErrUnableToMergeVideos:
+				{
+				ShowErrorNote(R_VEI_UNABLE_TO_MERGE_VIDEOS);
+				break;
+				}		
+			case KErrUnableToMergeVideoAndImage:
+				{
+				ShowErrorNote(R_VEI_UNABLE_TO_MERGE_VIDEO_IMAGE);
+				break;
+				}
+			case KErrUnableToChangeSound:
+				{
+				ShowErrorNote(R_VEI_UNABLE_TO_CHANGE_SOUND);
+				break;
+				}
+			case KErrVideoFormatNotSupported:
+				{
+				ShowErrorNote(R_VEI_UNABLE_TO_INSERT_VIDEO);
+				break;
+				}
+			case KErrAudioFormatNotSupported:
+				{
+				ShowErrorNote(R_VEI_AUDIO_FORMAT_NOT_SUPPORTED);
+				break;
+				}
+			case KErrImageFormatNotSupported:
+				{
+				ShowErrorNote(R_VEI_IMAGE_FORMAT_NOT_SUPPORTED);
+				break;
+				}					
+			case KErrNoMemory:
+				{
+				ShowErrorNote(R_VEI_NOT_ENOUGH_MEMORY);
+				break;
+				}	
+			default:
+				{			
+				LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::HandleErrorL: 4");
+				ShowErrorNote(R_VEI_ERROR_NOTE);
+				LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::HandleErrorL: 5");
+				break;
+				}
+			}
+		}
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::HandleErrorL: Out");
+	}
+
+//=============================================================================
+void CSimpleVideoEditorImpl::ShowErrorNote( const TInt aResourceId ) const
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::ShowErrorNoteL: In");
+
+	TRAP_IGNORE(
+		HBufC* stringholder = StringLoader::LoadLC( aResourceId, &iEnv );								
+		CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+		dlg->ExecuteLD( *stringholder );
+		CleanupStack::PopAndDestroy( stringholder ); 
+		);
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::ShowErrorNoteL: out");
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::StartWaitDialogL()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartWaitDialogL: In");
+	if (iWaitDialog)
+		{
+		LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartWaitDialogL: 2");
+		delete iWaitDialog;
+		iWaitDialog = NULL;	
+		}
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartWaitDialogL: 3");
+
+	iWaitDialog = new ( ELeave ) CAknWaitDialog( 
+		reinterpret_cast<CEikDialog**>(&iWaitDialog), ETrue ); // !!!
+	iWaitDialog->PrepareLC(R_VEI_WAIT_NOTE_WITH_CANCEL);
+	iWaitDialog->SetCallback( this );
+
+	HBufC* stringholder = StringLoader::LoadLC( R_VEI_NOTE_PROCESSING, &iEnv );
+	iWaitDialog->SetTextL( *stringholder );	
+	CleanupStack::PopAndDestroy(stringholder);
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartWaitDialogL: 4");
+	iWaitDialog->RunLD();
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartWaitDialogL: Out");
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::StartProgressDialogL()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartProgressDialogL: In");	
+	
+	if (iProgressDialog)
+		{		
+		LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartProgressDialogL: 1");
+		delete iProgressDialog;
+		iProgressDialog = NULL;
+		}
+	
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartProgressDialogL: 2");	
+	
+	iProgressDialog = new (ELeave) CAknProgressDialog( 
+		reinterpret_cast<CEikDialog**>(&iProgressDialog), ETrue );
+	iProgressDialog->PrepareLC(R_VESM_PROGRESS_NOTE_WITH_CANCEL);	
+	iProgressDialog->SetCallback( this );
+
+	TInt resId = -1;
+	HBufC* stringholder = NULL;
+	switch (iOperationMode)
+		{
+		case EOperationModeMergeWithVideo:
+		case EOperationModeMergeWithImage:
+		    TApaAppCaption caption;
+		    TRAPD( err, ResolveCaptionNameL( caption ) );
+		    
+		    // If something goes wrong, show basic "Saving" note
+		    if ( err )
+		        {
+		        stringholder = iEnv.AllocReadResourceLC( R_VEI_NOTE_PROCESSING );
+		        }
+		    else
+		        {
+		        stringholder =  StringLoader::LoadLC( R_VEI_NOTE_MERGING, caption, &iEnv );
+		        }        
+			break;
+		case EOperationModeChangeAudio:
+			resId = R_VEI_NOTE_ADDING_AUDIO;
+			stringholder = StringLoader::LoadLC( resId, &iEnv );
+			break;
+		case EOperationModeAddText:
+			resId = R_VEI_NOTE_ADDING_TEXT;
+			stringholder = StringLoader::LoadLC( resId, &iEnv );
+			break;
+		default :
+			resId = R_VEI_NOTE_PROCESSING;
+			stringholder = StringLoader::LoadLC( resId, &iEnv );
+			break;
+		}
+
+	iProgressDialog->SetTextL( *stringholder );
+	CleanupStack::PopAndDestroy(stringholder);
+
+	iProgressDialog->GetProgressInfoL()->SetFinalValue( 100 );
+	iProgressDialog->RunLD();
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::StartProgressDialogL: Out");	
+	}
+
+//=============================================================================
+void CSimpleVideoEditorImpl::ResolveCaptionNameL( TApaAppCaption& aCaption ) const
+    {   
+    RApaLsSession appArcSession;
+    CleanupClosePushL( appArcSession );
+    User::LeaveIfError( appArcSession.Connect() );       	    
+
+    // Get Media Gallery caption
+    TApaAppInfo appInfo;
+    User::LeaveIfError( appArcSession.GetAppInfo( appInfo, TUid::Uid( KMediaGalleryUID3 ) ) );
+
+    aCaption = appInfo.iCaption;
+
+    CleanupStack::PopAndDestroy( &appArcSession );  
+    }
+
+//=======================================================================================================	
+void CSimpleVideoEditorImpl::StartAnimatedProgressDialogL ()
+	{
+    delete iAnimatedProgressDialog;
+    iAnimatedProgressDialog = NULL;
+	iAnimatedProgressDialog = new (ELeave) CExtProgressDialog( &iAnimatedProgressDialog );
+	
+	iAnimatedProgressDialog->PrepareLC(R_WAIT_DIALOG);	
+	iAnimatedProgressDialog->SetCallback( this );
+
+	TInt labelResId = -1;
+	TInt animResId = -1;
+	switch (iOperationMode)
+		{
+		case EOperationModeMerge:
+			labelResId = R_VEI_NOTE_MERGING;
+			animResId = VideoEditor::EAnimationMerging;
+			break;
+		case EOperationModeChangeAudio:
+			labelResId = R_VEI_NOTE_ADDING_AUDIO;
+			animResId = VideoEditor::EAnimationChangeAudio;
+			break;
+		case EOperationModeAddText:
+			labelResId = R_VEI_NOTE_ADDING_TEXT;
+			animResId = VideoEditor::EAnimationAddText;
+			break;
+		default :
+			labelResId = R_VEI_NOTE_PROCESSING;
+			// @ : what is best default animation?
+			animResId = VideoEditor::EAnimationMerging;
+			break;
+		}
+
+	HBufC* stringholder = StringLoader::LoadLC( labelResId, &iEnv );
+	iAnimatedProgressDialog->SetTextL( *stringholder );
+	CleanupStack::PopAndDestroy(stringholder);
+		
+	iAnimatedProgressDialog->SetAnimationResourceIdL( animResId );
+
+	iAnimatedProgressDialog->GetProgressInfoL()->SetFinalValue( 100 );
+	iAnimatedProgressDialog->StartAnimationL();
+	iAnimatedProgressDialog->RunLD();		 	    
+	}
+
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::NotifyMovieProcessingStartedL(CVedMovie& /*aMovie*/)
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyMovieProcessingStartedL: In");
+
+	iPercentagesProcessed = 0;
+
+	StartProgressDialogL();
+	//StartAnimatedProgressDialogL();
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyMovieProcessingStartedL: Out");
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::NotifyMovieProcessingProgressed(CVedMovie& /*aMovie*/, TInt aPercentage)
+    {
+    iPercentagesProcessed = aPercentage;
+   	User::ResetInactivityTime();
+   	if (iAnimatedProgressDialog)
+   	    {   		
+		TRAP_IGNORE( iAnimatedProgressDialog->GetProgressInfoL()->SetAndDraw( aPercentage ) );
+   	    }
+
+   	if (iProgressDialog)
+   	    {
+		TRAP_IGNORE( iProgressDialog->GetProgressInfoL()->SetAndDraw( aPercentage ) );
+   	    }
+    
+    if ( iCancelPercentage <= aPercentage )
+        {
+        iCancelPercentage = 101;
+        }
+    }
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::NotifyMovieProcessingCompleted(CVedMovie& /*aMovie*/, TInt aError)
+    {    
+    LOGFMT2(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyMovieProcessingCompleted: In, aError:%d, iPercentagesProcessed:%d", aError, iPercentagesProcessed);		
+
+	iError = aError;	
+	iError = FilterError();
+    
+    if (KErrNone == aError)
+		{		
+		LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyMovieProcessingCompleted: 1");
+		iState = EStateProcessingOk;
+		}
+    else 
+		{		
+		LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyMovieProcessingCompleted: 2");
+		iState = EStateProcessingFailed;
+		}
+    
+    if (iAnimatedProgressDialog)
+   		{
+   		TRAP_IGNORE( iAnimatedProgressDialog->GetProgressInfoL()->SetAndDraw( 100 ) );
+		delete iAnimatedProgressDialog;
+		iAnimatedProgressDialog = NULL;
+   		}
+    if (iProgressDialog)
+    	{
+    	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyMovieProcessingCompleted: 3");
+		TRAP_IGNORE( iProgressDialog->GetProgressInfoL()->SetAndDraw( 100 ) );
+		TRAP_IGNORE( iProgressDialog->ProcessFinishedL() );
+		LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyMovieProcessingCompleted: 4");
+    	}
+
+    // CompleteRequest() moved to DialogDismissed()    
+    LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyMovieProcessingCompleted: Out");
+    }
+    
+    
+    
+//=======================================================================================================    
+void CSimpleVideoEditorImpl::NotifyAudioClipInfoReady( CVedAudioClipInfo& aInfo, TInt aError )
+    {    
+    
+    LOGFMT( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipInfoReady: in, aError:%d", aError );
+        
+    if ( aError == KErrNone )
+        {        
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipInfoReady: 1" );
+
+        TTimeIntervalMicroSeconds audioDuration = aInfo.Duration();
+        TTimeIntervalMicroSeconds videoDuration = iMovie->Duration();
+        TInt changeSound = 1;
+
+        TRAP_IGNORE( changeSound = QueryAudioInsertionL( videoDuration, audioDuration ));
+        
+        if ( changeSound )
+            {
+            iState = EStateInsertAudio;
+            }
+        else 
+            {
+            iState = EStateFinalizing;             
+            }
+        CompleteRequest();
+        
+        LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipInfoReady: 2" );
+        }
+    else
+        {
+        iError = aError;
+        iError = FilterError();
+        iState = EStateFinalizing;
+        CompleteRequest();   
+        }
+
+    LOG( KVideoEditorLogFile, "CVeiEditVideoView::NotifyAudioClipInfoReady: out" );    
+    }
+    
+    
+//=======================================================================================================
+TInt CSimpleVideoEditorImpl::QueryAudioInsertionL( TTimeIntervalMicroSeconds aVideoDuration, 
+                                                   TTimeIntervalMicroSeconds aAudioDuration )
+    {
+    TInt changeSound = 1;
+    
+    // round the durations to seconds so that the comparing will be more realistic
+    TTimeIntervalSeconds videoDurationInSeconds = aVideoDuration.Int64()/1000000;
+    TTimeIntervalSeconds audioDurationInSeconds = aAudioDuration.Int64()/1000000;
+        
+    if ( audioDurationInSeconds < videoDurationInSeconds )
+        {
+        HBufC* queryString = StringLoader::LoadLC( R_VIE_QUERY_INSERT_SHORT_AUDIO );
+        CAknQueryDialog* dlg = new( ELeave )CAknQueryDialog( *queryString, CAknQueryDialog::ENoTone );
+        changeSound = dlg->ExecuteLD( R_VIE_CONFIRMATION_QUERY );
+        CleanupStack::PopAndDestroy( queryString );
+        }
+    else if ( audioDurationInSeconds > videoDurationInSeconds )
+        {
+        HBufC* queryString = StringLoader::LoadLC( R_VIE_QUERY_INSERT_LONG_AUDIO );
+        CAknQueryDialog* dlg = new( ELeave )CAknQueryDialog( *queryString, CAknQueryDialog::ENoTone );
+        changeSound = dlg->ExecuteLD( R_VIE_CONFIRMATION_QUERY );
+        CleanupStack::PopAndDestroy( queryString );            
+        }
+    //else the audio clip is the same length as the video clip
+
+    return changeSound;
+    }
+    
+    
+    
+//=======================================================================================================
+
+void CSimpleVideoEditorImpl::ProcessingOkL()
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::ProcessingOkL: In");
+	RFs& fs = iEnv.FsSession();
+	CFileMan* fileman = CFileMan::NewL( fs );	
+	CleanupStack::PushL( fileman );
+	
+	TInt moveErr( KErrNone );
+	if ( iTempFile->Left(1) == iOutputFileName.Left(1) )
+		{
+		moveErr = fileman->Rename( *iTempFile, iOutputFileName );
+		LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::ProcessingOkL: 1 renamed temp file: err %d", moveErr);
+		}
+	else
+		{
+		moveErr = fileman->Move( *iTempFile, iOutputFileName );
+		LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::ProcessingOkL: 2 moved tem file: err %d", moveErr);
+		}
+	CleanupStack::PopAndDestroy( fileman );  
+
+	delete iTempFile;
+	iTempFile = NULL;		
+	iError = moveErr;
+
+	iState = EStateFinalizing;	
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::ProcessingOkL: Out");
+	}
+//=======================================================================================================	
+
+void CSimpleVideoEditorImpl::ProcessingFailed()
+	{		
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::ProcessingFailed: In");
+	TInt delErr = iEnv.FsSession().Delete( *iTempFile );
+	LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::ProcessingFailed: 1, delErr:%d", delErr);
+	if ( delErr ) 
+		{
+		// @: should something be done?
+		}
+	delete iTempFile;
+	iTempFile = NULL;		
+	iState = EStateFinalizing;	
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::ProcessingFailed: Out");
+	}	
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::NotifyVideoClipAdded(CVedMovie& /*aMovie*/, TInt /*aIndex*/)
+    {
+    LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyVideoClipAdded: In");	   	
+
+	if ( EStateInsertInputFirst == iState )
+		{
+		// Next insert the second item (i.e. video|image|audio|text)
+		iState = EStateInsertInputSecond;
+		}
+	else if ( EStateInsertVideo == iState ||	EStateInsertImage == iState 
+				|| EStateInsertTextToBegin == iState || EStateInsertTextToEnd == iState)
+		{
+		// Next start processing the movie		
+		iState = EStateProcessing;
+		}	
+	// if cancel is pressed in the middle of iMovie->InsertVideoClip(), state is put to iStateFinalizing to stop
+	// the process			
+	else if ( EStateFinalizing == iState || EStateReady == iState )	
+		{
+		;
+		}
+	else
+		{
+		User::Invariant();
+		}
+		
+	if ( iWaitDialog )
+		{		
+		TRAP_IGNORE(iWaitDialog->ProcessFinishedL());
+		}	
+	//CompleteRequest();
+
+    LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyVideoClipAdded: Out");
+    }
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::NotifyVideoClipAddingFailed(CVedMovie& /*aMovie*/, TInt aError)
+	{
+	LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyVideoClipAddingFailed: In, aError:%d", aError);
+	
+	iError = aError;		
+	iError = FilterError();
+	
+	// Next handle error and exit
+	iState = EStateFinalizing;
+
+	if ( iWaitDialog )
+		{
+		TRAP_IGNORE(iWaitDialog->ProcessFinishedL());
+		}
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyVideoClipAddingFailed: Out");
+	}
+
+
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::NotifyAudioClipAdded(CVedMovie& /*aMovie*/, TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyAudioClipAdded: In");
+
+	ASSERT(iMovie && iMovie->VideoClipCount() == 1);
+
+	if ( EStateInsertAudio == iState )
+		{
+		TInt audioClipCount = iMovie->AudioClipCount();
+		TTimeIntervalMicroSeconds currentAudioClipEndTime = iMovie->AudioClipEndTime( audioClipCount - 1 ); // in movie timebase
+
+		TTimeIntervalMicroSeconds videoClipEndTime = iMovie->VideoClipEndTime(0); // in movie timebase
+		if( currentAudioClipEndTime > videoClipEndTime )
+			{
+			// Adjust the length so that the audio duration does not exceed video duration. 				
+			CVedAudioClipInfo* audioClip = iMovie->AudioClipInfo( audioClipCount - 1 );
+			TInt64 cutOutTime = audioClip->Duration().Int64() - ( currentAudioClipEndTime.Int64() - videoClipEndTime.Int64() );
+			iMovie->AudioClipSetCutOutTime( audioClipCount - 1, TTimeIntervalMicroSeconds(cutOutTime) ); // in clip timebase
+			}
+		ASSERT( iMovie->Duration() == videoClipEndTime );
+		
+		TTimeIntervalMicroSeconds audioClipEndTime = iMovie->AudioClipEndTime( audioClipCount - 1);				
+
+        ASSERT( audioClipEndTime.Int64() <= videoClipEndTime.Int64() );
+
+        TInt error = KErrNone;
+        
+		if ( audioClipEndTime == videoClipEndTime )
+		    {
+		    if ( iMovie->VideoClipIsMuteable(0) )
+		        {
+		        iMovie->VideoClipSetMuted(0, ETrue);
+		        }
+		    } 
+		    
+        // if the audio clip is shorter than the video clip, the original sound 
+        // of the video clip has to be muted until the end of the new sound clip
+		else if ( audioClipEndTime < videoClipEndTime )
+		    {
+		
+		    if ( iMovie->VideoClipEditedHasAudio(0) )
+		        {
+    		
+		        TVedDynamicLevelMark mark1( TTimeIntervalMicroSeconds(0), KAudioLevelMin );
+    		    
+    		    TInt64 time = audioClipEndTime.Int64() - KFadeInTimeMicroSeconds; 
+    		    
+		        TVedDynamicLevelMark mark2( TTimeIntervalMicroSeconds(time) , KAudioLevelMin );
+    		    
+    		    TVedDynamicLevelMark mark3( audioClipEndTime, 0 );
+    		
+    		    TRAP( error, iMovie->VideoClipInsertDynamicLevelMarkL( 0, mark1 ) );
+    		    
+    		    if ( error == KErrNone )
+    		        {
+    		        TRAP( error, iMovie->VideoClipInsertDynamicLevelMarkL( 0, mark2 ) );
+    		        }
+    		        
+    		    if ( error == KErrNone )
+    		        {		    
+    		        TRAP( error, iMovie->VideoClipInsertDynamicLevelMarkL( 0, mark3 ) );
+    		        }
+    		        
+    		    if ( error != KErrNone ) 
+        		    {
+        		    iError = error;	
+    	            iError = FilterError();		        		    
+        		    }
+        		        
+		        }
+		    }
+		    
+		if ( error == KErrNone )
+		    {
+		    iState = EStateProcessing;        
+		    }
+		else
+		    {
+		    iState = EStateProcessingFailed;    
+		    }
+		}
+		
+	if( iWaitDialog )
+		{
+		TRAP_IGNORE(iWaitDialog->ProcessFinishedL());
+		}	
+		
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyAudioClipAdded: Out");
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::NotifyAudioClipAddingFailed(CVedMovie& /*aMovie*/, TInt aError)
+    {    
+    LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyAudioClipAddingFailed: In, aError:%d", aError);
+
+    iError = aError;	    
+		
+	iError = FilterError();	
+
+	// Next handle error and exit
+	iState = EStateFinalizing;
+	if ( iWaitDialog )
+		{
+		TRAP_IGNORE(iWaitDialog->ProcessFinishedL());
+		}
+
+    LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyAudioClipAddingFailed: Out");
+    }
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::NotifyImageClipGeneratorInitializationComplete(CVeiImageClipGenerator& /*aGenerator*/, TInt aError)
+	{
+	LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyImageClipGeneratorInitializationComplete, In, aError:%d", aError);
+
+	iError = aError;			
+	
+	// If the wait dialog has been dismissed, i.e the action has been cancelled,
+	// we expect that the DialogDismissedL() method has set the correct state and won't
+	// set the state ourselves.
+	iGeneratorComplete = ETrue;
+	if( !iDialogDismissed ) 
+		{
+		if (KErrNone == aError)
+			{
+			iState = EStateInsertImage;
+			LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyImageClipGeneratorInitializationComplete: 2");		    
+			}
+		else
+			{		
+			iError = FilterError();
+			// Next handle error and exit				
+					
+			/*
+			If iImageClipGenerator is deleted here (in NotifyImageClipGeneratorInitializationComplete), endless
+			loop is  resulted, because calling iImageClipGenerator's destructor leads to calling NotifyImageClipGeneratorInitializationComplete
+			again until stack overdoses etc.
+			iImageClipGenerator does not have to be deleted here, it is deleted in destructor.
+			delete iImageClipGenerator;
+			iImageClipGenerator = 0;		
+			*/
+		
+			iState = EStateFinalizing;
+			}
+		}
+
+	CompleteRequest();	
+
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::NotifyImageClipGeneratorInitializationComplete, Out");
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::DialogDismissedL( TInt aButtonId )
+	{
+	LOGFMT(KVideoEditorLogFile, "CSimpleVideoEditorImpl::DialogDismissedL, In, aButtonId:%d", aButtonId);
+
+	if ( aButtonId != EAknSoftkeyDone)
+		{
+		// If the action was cancelled, we set up the correspondig state
+		// and also set the iDialogDismissed property to indicate that.
+		iDialogDismissed = ETrue;
+		
+		LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::DialogDismissedL, 1");
+	
+		if (EStateProcessing == iState && iMovie)
+			{
+			LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::DialogDismissedL, 2, canceling processing...");
+			iState = EStateProcessingFailed;
+			/* 
+			 It depends on scheduling of active objects whether NotifyMovieProcessingCompleted()
+			 gets called. If iProgressDialog is NULLed by itself in the time DialogDismissed() gets called
+			 it should be nonrelevant whether NotifyMovieProcessingCompleted() called or not because
+			 in NotifyMovieProcessingCompleted() iProgressDialog->ProcessFinished() is called only if
+			 it is not NULL leading to another call to DialogDismissed(). But even if DialogDismissed()
+			 gets called multiple times it should not cause any harm.
+			*/ 
+			iMovie->CancelProcessing();									
+			LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::DialogDismissedL, 4, ...canceling called");
+			}
+		else
+			{
+			// if wait dialog is canceled during inserts
+			iError = KErrCancel;
+			iState = EStateFinalizing;	
+			}
+		
+		// this problem is because in add text mode orientation is forced to portrait in 
+		// such an early stage
+		// ask Heikki's opinion, why appUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait);
+		// is called in InitializeOperationL()?
+		// Can it be moved to where it is neede, in GetText()?
+		if (EOperationModeAddText == iOperationMode)
+			{
+			RestoreOrientation();
+			}
+		}
+	
+	// Only if the VeiImageClipGenerator::NewL() called from the RunL() has finished and called 
+	// the NotifyImageClipGeneratorInitializationComplete() method we complete and activate again.
+	// If not, we rely that the NotifyImageClipGeneratorInitializationComplete() method
+	// calls CompleteRequest() when it's called. 
+	if( iGeneratorComplete )
+		{
+		CompleteRequest();		
+		}
+	
+	LOG(KVideoEditorLogFile, "CSimpleVideoEditorImpl::DialogDismissedL, Out");
+	}
+
+//=======================================================================================================
+void CSimpleVideoEditorImpl::NotifyVideoClipRemoved(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CSimpleVideoEditorImpl::NotifyVideoClipIndicesChanged(CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, TInt /*aNewIndex*/){}
+void CSimpleVideoEditorImpl::NotifyVideoClipTimingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CSimpleVideoEditorImpl::NotifyVideoClipSettingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CSimpleVideoEditorImpl::NotifyVideoClipColorEffectChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CSimpleVideoEditorImpl::NotifyVideoClipAudioSettingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CSimpleVideoEditorImpl::NotifyVideoClipGeneratorSettingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CSimpleVideoEditorImpl::NotifyVideoClipDescriptiveNameChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CSimpleVideoEditorImpl::NotifyStartTransitionEffectChanged(CVedMovie& /*aMovie*/){}
+void CSimpleVideoEditorImpl::NotifyMiddleTransitionEffectChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CSimpleVideoEditorImpl::NotifyEndTransitionEffectChanged(CVedMovie& /*aMovie*/){}
+void CSimpleVideoEditorImpl::NotifyAudioClipRemoved(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CSimpleVideoEditorImpl::NotifyAudioClipIndicesChanged(CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, TInt /*aNewIndex*/){}
+void CSimpleVideoEditorImpl::NotifyAudioClipTimingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CSimpleVideoEditorImpl::NotifyMovieQualityChanged(CVedMovie& /*aMovie*/){}
+void CSimpleVideoEditorImpl::NotifyMovieReseted(CVedMovie& /*aMovie*/){}
+void CSimpleVideoEditorImpl::NotifyMovieOutputParametersChanged(CVedMovie& /*aMovie*/){}
+void CSimpleVideoEditorImpl::NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/){}
+void CSimpleVideoEditorImpl::NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/){}
+void CSimpleVideoEditorImpl::NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/){}
+void CSimpleVideoEditorImpl::NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/){}
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/data/TrimForMms.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,251 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// ====================================================================
+// File: TrimForMms.rss
+// Created: 04/18/06
+// Author: 
+// 
+// ==================================================================== */
+
+NAME TRIM
+
+#include <appinfo.rh>
+#include <eikon.rh>
+#include <eikon.rsg>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.hrh>
+#include <e32keys.h>
+#include <AvkonIcons.hrh>
+#include <avkon.mbg>
+
+#include "TrimForMms.hrh"
+#include "manualvideoeditor.loc"
+
+// ---------------------------------------------------------
+//   
+//    Define the resource file signature 
+//    This resource should be empty.
+//
+// ---------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE { }
+
+// ---------------------------------------------------------
+//   
+//    Default Document Name
+//
+// ---------------------------------------------------------
+//
+RESOURCE TBUF r_default_document_name { buf=""; }
+
+// ---------------------------------------------------------
+//   
+//    Define default menu and CBA key.
+//
+// ---------------------------------------------------------
+//
+RESOURCE EIK_APP_INFO
+    {
+    menubar = r_TrimForMms_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
+    }
+
+RESOURCE LOCALISABLE_APP_INFO r_trim_for_mms_localisable_app_info
+	{
+	short_caption = qtn_app_short_caption_string;
+	caption_and_icon =
+		{
+		CAPTION_AND_ICON_INFO 
+			{
+		    caption=qtn_app_caption_string;
+		    number_of_icons=0;
+		    //icon_file=APP_BITMAP_DIR"\\TrimForMms_aif.mif";
+			}
+		};
+	}
+
+// ---------------------------------------------------------
+//   
+//   r_TrimForMms_menubar
+//   Menubar for TrimForMms example
+//
+// ---------------------------------------------------------
+//
+RESOURCE MENU_BAR r_TrimForMms_menubar
+    {
+    titles =
+        {
+        MENU_TITLE {menu_pane = r_TrimForMms_menu;}
+        };
+    }
+
+
+// ---------------------------------------------------------
+//   
+//   r_TrimForMms_menu
+//   Menu for "Options"
+//
+// ---------------------------------------------------------
+//
+RESOURCE MENU_PANE r_TrimForMms_menu
+    {
+    items = 
+        {
+        MENU_ITEM {command = EAknSoftkeyExit;   txt = "Exit";}
+        };
+    }
+
+RESOURCE HOTKEYS r_vei_hotkeys
+    {
+    control=
+        {
+        HOTKEY { command=EAknCmdExit; key='e'; }
+        };
+    }
+    
+RESOURCE MENU_BAR r_vei_menubar_trim_for_mms_view
+	{
+    titles=
+        {
+        MENU_TITLE 
+			{ 
+			menu_pane=r_vei_menu_pane_trim_for_mms_view; 
+			txt=""; 
+			}
+        };
+	}
+
+RESOURCE MENU_PANE r_vei_menu_pane_trim_for_mms_view
+    {
+    items=
+        {
+		MENU_ITEM { command=EVeiCmdSendViaMms;			txt=qtn_vei_menu_send_via_mms; },
+		MENU_ITEM { command=EVeiCmdPreview;				txt=qtn_vei_menu_preview; },
+//		MENU_ITEM { command=EVeiCmdVideoLength;			txt=qtn_vei_menu_video_length; },
+		MENU_ITEM { command=EVeiCmdTrimForMmsViewHelp;	txt=qtn_clipb_litxt_help; }
+        };
+    }
+
+// ---------------------------------------------------------
+//   
+//   r_vei_trim_for_mms_view
+//   View
+//
+// ---------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_vei_trim_for_mms_view
+    {
+    hotkeys=r_vei_hotkeys;
+    menubar=r_vei_menubar_trim_for_mms_view;  
+    cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;    
+    }
+
+RESOURCE TBUF r_ved_thumbnail_start_text
+    {
+    buf = qtn_ved_trim_start;   
+    }
+
+
+RESOURCE TBUF r_ved_thumbnail_end_text
+    {
+    buf = qtn_ved_trim_end;
+    }
+
+RESOURCE AVKON_SKEY_LIST r_ved_left_right_silent_skey_list
+	{
+	list =
+		{
+		AVKON_SKEY_INFO 
+			{ 
+			key = EStdKeyRightArrow; 
+			sid = EAvkonSIDNoSound; 
+			type = ESKeyTypeLong;
+			},	
+		AVKON_SKEY_INFO 
+			{ 
+			key = EStdKeyRightArrow;
+			sid = EAvkonSIDNoSound;
+			type = ESKeyTypeRepeat; 
+			},
+		AVKON_SKEY_INFO 
+			{ 
+			key = EStdKeyLeftArrow;
+			sid = EAvkonSIDNoSound;
+			type =ESKeyTypeLong;
+			},
+		AVKON_SKEY_INFO 
+			{ 
+			key = EStdKeyLeftArrow;
+			sid = EAvkonSIDNoSound;
+			type =ESKeyTypeRepeat;
+			}
+		};
+	} 
+
+RESOURCE TBUF r_ved_processing_for_mms
+    {
+    buf = qtn_ved_processing_for_mms;
+    }
+
+RESOURCE TBUF128 r_vei_progress_note_processing	
+    { 
+    buf = qtn_ved_processing_movie; 
+    }
+
+RESOURCE DIALOG r_vei_progress_note
+	{
+	flags = EAknProgressNoteFlags;
+	buttons = R_AVKON_SOFTKEYS_EMPTY;
+	items =
+		{
+		DLG_LINE
+			{
+			type = EAknCtNote;
+			id = EGeneralNote;
+			control = AVKON_NOTE
+				{
+				layout = EProgressLayout;
+				singular_label = qtn_vei_progress_note_processing;
+				imagefile = AVKON_ICON_FILE;
+				imageid = EMbmAvkonQgn_note_progress;
+				imagemask = EMbmAvkonQgn_note_progress_mask;
+				};
+			}
+		};
+	}	
+    
+RESOURCE TITLE_PANE r_vei_trim_for_mms_view_title_name
+    {
+    txt = qtn_vei_trim_mms_title;
+    }
+    
+// SETTINGS
+RESOURCE TBUF128 r_vei_settings_view_settings_item_value
+    { 
+    buf = qtn_vei_settings_value1_movie; 
+    }
+
+RESOURCE TBUF128 r_vei_settings_view_settings_item2_value
+    { 
+    buf = qtn_vei_settings_value2_snapshot; 
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/data/TrimForMms_reg.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// ====================================================================
+// File: TrimForMms_reg.rss
+// Created: 04/18/06
+// Author: 
+// 
+// ==================================================================== */
+
+//TrimForMms application's registration resource file 
+
+#include <appinfo.rh>
+#include <TrimForMms.rsg>
+#include <data_caging_paths_strings.hrh>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x200009D
+
+RESOURCE APP_REGISTRATION_INFO 
+	{
+	app_file="TrimForMms";
+	localisable_resource_file=APP_RESOURCE_DIR"\\TrimForMms_loc";
+	localisable_resource_id = R_TRIM_FOR_MMS_LOCALISABLE_APP_INFO;	
+	hidden = KAppNotHidden;
+	embeddability = KAppEmbeddable;
+	launch = KAppLaunchInForeground;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/group/TrimForMms.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+#include <data_caging_paths.hrh>
+#include "../../Group/buildconfig.hrh"
+
+#if defined( __DEBUG_ON__ )
+MACRO           DEBUG_ON
+#endif
+#if defined( __DEBUG_ON_ALWAYS__ )
+MACRO           DEBUG_ON_ALWAYS
+#endif
+#if defined(__DEBUG_ON__) || defined(__DEBUG_ON_ALWAYS__)
+LIBRARY         flogger.lib
+#endif
+
+
+TARGETPATH          /sys/bin
+TARGET              TrimForMms.exe
+TARGETTYPE          exe
+
+UID                 0x100039CE 0x200009D
+
+CAPABILITY          CAP_APPLICATION
+SECUREID            0x200009D
+
+SOURCEPATH          ../src
+SOURCE              TrimForMms.cpp
+SOURCE              TrimForMmsApplication.cpp 
+SOURCE              TrimForMmsAppUi.cpp
+SOURCE              TrimForMmsDocument.cpp 
+SOURCE              VeiTrimForMmsContainer.cpp
+SOURCE              VeiTrimForMmsView.cpp
+
+SOURCEPATH          ../group
+
+USERINCLUDE         ../inc 
+USERINCLUDE         ../../VideoEditorCommon/inc
+USERINCLUDE         ../../VideoEditorCommon/loc
+USERINCLUDE         ../../VideoEditorUiComponents/inc
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY             euser.lib
+LIBRARY             apparc.lib
+LIBRARY             cone.lib 
+LIBRARY             eikcore.lib
+LIBRARY             eikcoctl.lib 
+LIBRARY             eikctl.lib  
+LIBRARY             avkon.lib  
+LIBRARY             sendui.lib
+LIBRARY             aknskins.lib
+LIBRARY             efsrv.lib 
+LIBRARY             hlplch.lib
+LIBRARY             charconv.lib
+LIBRARY             mmsserversettings.lib
+LIBRARY             VedEngine.lib
+LIBRARY             VideoEditorCommon.lib
+LIBRARY             VideoEditorUiComponents.lib
+LIBRARY             bafl.lib 
+LIBRARY             estor.lib
+LIBRARY             commonengine.lib
+LIBRARY             gdi.lib
+LIBRARY             ws32.lib
+
+START RESOURCE      ../data/TrimForMms.RSS
+HEADER
+TARGETPATH	        /resource/apps
+LANG		        sc
+END
+   
+START RESOURCE	    ../data/TrimForMms_reg.rss
+DEPENDS trimformms.rsg
+TARGETPATH          /private/10003a3f/import/apps
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+PRJ_MMPFILES
+
+TrimForMms.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/inc/TrimForMms.hrh	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+/* ====================================================================
+ * File: TrimForMms.hrh
+ * Created: 04/18/06
+ * Author: 
+ * 
+ * ==================================================================== */
+
+#ifndef __TrimForMms_HRH__
+#define __TrimForMms_HRH__
+
+/** TrimForMms enumerate command codes */
+enum TTrimForMmsIds
+    {
+    EVeiCmdSendViaMms = 1,  // start value must not be 0
+    EVeiCmdPreview,
+    EVeiCmdTrimForMmsViewHelp
+    };
+
+enum TTrimForMmsViewIds
+ 	{
+	EVeiTrimForMmsView
+ 	};
+ 
+#endif // __TrimForMms_HRH__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/inc/TrimForMms.pan	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+/* ====================================================================
+ * File: TrimForMms.pan
+ * Created: 04/18/06
+ * Author: 
+ * 
+ * ==================================================================== */
+
+#ifndef __TRIMFORMMS_PAN__
+#define __TRIMFORMMS_PAN__
+
+/** TrimForMms application panic codes */
+enum TTrimForMmsPanics 
+    {
+    ETrimForMmsBasicUi = 1
+    // add further panics here
+    };
+
+inline void Panic(TTrimForMmsPanics aReason)
+    {
+	_LIT(applicationName,"TrimForMms");
+    User::Panic(applicationName, aReason);
+    }
+
+#endif // __TRIMFORMMS_PAN__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/inc/TrimForMmsApplication.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/* ====================================================================
+ * File: TrimForMmsApplication.h
+ * Created: 04/18/06
+ * Author: 
+ * 
+ * ==================================================================== */
+
+#ifndef __TRIMFORMMS_APPLICATION_H__
+#define __TRIMFORMMS_APPLICATION_H__
+
+#include <aknapp.h>
+
+
+/*! 
+  @class CTrimForMmsApplication
+  
+  @discussion An instance of CTrimForMmsApplication is the application part of the AVKON
+  application framework for the TrimForMms example application
+  */
+class CTrimForMmsApplication : public CAknApplication
+    {
+public:  // from CAknApplication
+
+/*! 
+  @function AppDllUid
+  
+  @discussion Returns the application DLL UID value
+  @result the UID of this Application/Dll
+  */
+    TUid AppDllUid() const;
+
+protected: // from CAknApplication
+/*! 
+  @function CreateDocumentL
+  
+  @discussion Create a CApaDocument object and return a pointer to it
+  @result a pointer to the created document
+  */
+    CApaDocument* CreateDocumentL();
+    };
+
+#endif // __TRIMFORMMS_APPLICATION_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/inc/TrimForMmsAppui.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/* ====================================================================
+ * File: TrimForMmsAppUi.h
+ * Created: 04/18/06
+ * Author: 
+ * 
+ * ==================================================================== */
+
+#ifndef __TRIMFORMMS_APPUI_H__
+#define __TRIMFORMMS_APPUI_H__
+
+#include <aknviewappui.h>
+
+// Forward reference
+class CVeiTrimForMmsView;
+class CSendUi;
+class TVeiSettings;
+
+/*! 
+  @class CTrimForMmsAppUi
+  
+  @discussion An instance of class CTrimForMmsAppUi is the UserInterface part of the AVKON
+  application framework for the TrimForMms example application
+  */
+class CTrimForMmsAppUi : public CAknViewAppUi
+    {
+public:
+/*!
+  @function ConstructL
+  
+  @discussion Perform the second phase construction of a CTrimForMmsAppUi object
+  this needs to be public due to the way the framework constructs the AppUi 
+  */
+    void ConstructL();
+
+/*!
+  @function CTrimForMmsAppUi
+  
+  @discussion Perform the first phase of two phase construction.
+  This needs to be public due to the way the framework constructs the AppUi 
+  */
+    CTrimForMmsAppUi();
+
+
+/*!
+  @function ~CTrimForMmsAppUi
+  
+  @discussion Destroy the object and release all memory objects
+  */
+    ~CTrimForMmsAppUi();
+
+
+/*!
+  Reads application settings data from ini-file. 
+ 
+ @param aSettings Settings data where values are read.
+ */
+	void ReadSettingsL( TVeiSettings& aSettings );
+
+
+public: // from CAknAppUi
+/*!
+  @function HandleCommandL
+  
+  @discussion Handle user menu selections
+  @param aCommand the enumerated code for the option selected
+  */
+    void HandleCommandL(TInt aCommand);
+
+/*!
+  Calls CAknAppUiBase::HandleScreenDeviceChangedL().
+  */
+//	virtual void HandleScreenDeviceChangedL();	
+
+	/**
+    * From @c CEikAppUi. Handles a change to the application's resources which
+    * are shared across the environment. This function calls 
+    * @param aType The type of resources that have changed. 
+    */
+	virtual void HandleResourceChangeL(TInt aType);
+
+private:
+/*! @var iTrimForMmsView The application view */
+    CVeiTrimForMmsView*     iTrimForMmsView;
+    
+    CSendUi*                iSendUi;
+    };
+
+
+#endif // __TRIMFORMMS_APPUI_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/inc/TrimForMmsAppview.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/* ====================================================================
+ * File: TrimForMmsAppView.h
+ * Created: 04/18/06
+ * Author: 
+ * 
+ * ==================================================================== */
+
+#ifndef __TRIMFORMMS_APPVIEW_H__
+#define __TRIMFORMMS_APPVIEW_H__
+
+
+#include <coecntrl.h>
+
+// FORWARD DECLARATIONS
+class CSendUi;
+
+/*! 
+  @class CTrimForMmsAppView
+  
+  @discussion An instance of the Application View object for the TrimForMms 
+  example application
+  */
+class CTrimForMmsAppView : public CCoeControl
+    {
+public:
+
+/*!
+  @function NewL
+   
+  @discussion Create a CTrimForMmsAppView object, which will draw itself to aRect
+  @param aRect the rectangle this view will be drawn to
+  @result a pointer to the created instance of CTrimForMmsAppView
+  */
+    static CTrimForMmsAppView* NewL(const TRect& aRect);
+
+/*!
+  @function NewLC
+   
+  @discussion Create a CTrimForMmsAppView object, which will draw itself to aRect
+  @param aRect the rectangle this view will be drawn to
+  @result a pointer to the created instance of CTrimForMmsAppView
+  */
+    static CTrimForMmsAppView* NewLC(const TRect& aRect);
+
+
+/*!
+  @function ~CTrimForMmsAppView
+  
+  @discussion Destroy the object and release all memory objects
+  */
+     ~CTrimForMmsAppView();
+
+
+public:  // from CCoeControl
+/*!
+  @function Draw
+  
+  @discussion Draw this CTrimForMmsAppView to the screen
+  @param aRect the rectangle of this view that needs updating
+  */
+    void Draw(const TRect& aRect) const;
+  
+
+private:
+
+/*!
+  @function ConstructL
+  
+  @discussion  Perform the second phase construction of a CTrimForMmsAppView object
+  @param aRect the rectangle this view will be drawn to
+  */
+    void ConstructL(const TRect& aRect);
+
+/*!
+  @function CTrimForMmsAppView
+  
+  @discussion Perform the first phase of two phase construction 
+  */
+    CTrimForMmsAppView();
+    
+    
+    // Send UI
+    CSendUi*        iSendUi;
+    
+    };
+
+
+#endif // __TRIMFORMMS_APPVIEW_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/inc/TrimForMmsDocument.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+/* ====================================================================
+ * File: TrimForMmsDocument.h
+ * Created: 04/18/06
+ * Author: 
+ * 
+ * ==================================================================== */
+
+#ifndef __TRIMFORMMS_DOCUMENT_H__
+#define __TRIMFORMMS_DOCUMENT_H__
+
+
+#include <akndoc.h>
+
+// Forward references
+class CTrimForMmsAppUi;
+class CEikApplication;
+
+
+/*! 
+  @class CTrimForMmsDocument
+  
+  @discussion An instance of class CTrimForMmsDocument is the Document part of the AVKON
+  application framework for the TrimForMms example application
+  */
+class CTrimForMmsDocument : public CAknDocument
+    {
+public:
+
+/*!
+  @function NewL
+  
+  @discussion Construct a CTrimForMmsDocument for the AVKON application aApp 
+  using two phase construction, and return a pointer to the created object
+  @param aApp application creating this document
+  @result a pointer to the created instance of CTrimForMmsDocument
+  */
+    static CTrimForMmsDocument* NewL(CEikApplication& aApp);
+
+/*!
+  @function NewLC
+  
+  @discussion Construct a CTrimForMmsDocument for the AVKON application aApp 
+  using two phase construction, and return a pointer to the created object
+  @param aApp application creating this document
+  @result a pointer to the created instance of CTrimForMmsDocument
+  */
+    static CTrimForMmsDocument* NewLC(CEikApplication& aApp);
+
+/*!
+  @function ~CTrimForMmsDocument
+  
+  @discussion Destroy the object and release all memory objects
+  */
+    ~CTrimForMmsDocument();
+
+public: // from CAknDocument
+/*!
+  @function CreateAppUiL 
+  
+  @discussion Create a CTrimForMmsAppUi object and return a pointer to it
+  @result a pointer to the created instance of the AppUi created
+  */
+    CEikAppUi* CreateAppUiL();
+
+
+    void OpenFileL(CFileStore*& /*aFileStore*/, RFile& aFile);
+    
+private:
+
+/*!
+  @function ConstructL
+  
+  @discussion Perform the second phase construction of a CTrimForMmsDocument object
+  */
+    void ConstructL();
+
+/*!
+  @function CTrimForMmsDocument
+  
+  @discussion Perform the first phase of two phase construction 
+  @param aApp application creating this document
+  */
+    CTrimForMmsDocument(CEikApplication& aApp);
+
+    };
+
+
+#endif // __TRIMFORMMS_DOCUMENT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/inc/VeiTrimForMmsContainer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,378 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#ifndef VEITRIMFORMMSCONTAINER_H
+#define VEITRIMFORMMSCONTAINER_H
+
+// INCLUDES
+// System includes
+#include <AknUtils.h>   // TAknLayoutText
+#include <coecntrl.h>
+#include <AknProgressDialog.h> 
+#include <VedMovie.h>
+#include <VedVideoClipInfo.h>
+// User includes
+#include "VeiVideoDisplay.h"
+#include "VeiFrameTaker.h"
+#include "VeiTrimForMmsView.h"
+#include "VeiDisplayLighter.h"
+
+// FORWARD DECLARATIONS
+class CVeiCutterBar;
+class CVeiTrimForMmsView;
+class CVeiTrimForMmsView;
+class CAknsBasicBackgroundControlContext;
+class CAknProgressDialog;
+//class CEikProgressInfo;
+
+// CLASS DECLARATION
+
+/**
+ *
+ */
+class CVeiTrimForMmsContainer : public CCoeControl,
+                                public MVedMovieObserver,
+                                public MVeiVideoDisplayObserver,
+								public MVeiFrameTakerObserver,
+								public MProgressDialogCallback
+    {
+    public:
+
+        static CVeiTrimForMmsContainer* NewL( const TRect& aRect,
+                                              CVedMovie& aMovie,
+											  CVeiTrimForMmsView& aView );
+
+        static CVeiTrimForMmsContainer* NewLC( const TRect& aRect,
+                                               CVedMovie& aMovie,
+											   CVeiTrimForMmsView& aView);
+
+        ~CVeiTrimForMmsContainer();
+
+    public:     // New functions
+
+        const TTimeIntervalMicroSeconds& CutInTime() const;
+
+        const TTimeIntervalMicroSeconds& CutOutTime() const;
+
+		void SetMaxMmsSize( TInt aMaxSizeInBytes );
+
+		/**
+		 * Start full screen preview. Calls CVeiVideoDisplay. 
+		 *
+		 * @param aFilename filename.
+		 * @param aRect full screen size.
+		 */
+		void PlayL( const TDesC& aFilename, const TRect& aRect  );
+
+		/**
+		 *	Stop preview. Stops CVeiVideoDisplay
+		 *
+		 * @param aCloseStream 
+		 */
+		void Stop( TBool aCloseStream );
+
+		/**
+		 *
+		 */
+		void PauseL();
+
+		/**
+         * Return the video display state of CVeiTrimForMmsContainer. 
+         *
+         * @param 
+         */
+		TInt PreviewState() const;
+
+		void StartFrameTakerL( TInt aIndex );
+
+    private:    // From CCoeControl
+
+		virtual void DialogDismissedL( TInt aButtonId );
+
+        CCoeControl* ComponentControl(TInt aIndex) const;    
+
+        TInt CountComponentControls() const;
+
+        /**
+         * Gets the control's help context. Associates the control with a 
+         * particular Help file and topic in a context sensitive application.
+         *
+         * @param aContext The control's help context.
+         */
+        void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+        void Draw( const TRect& aRect ) const;
+
+        void SizeChanged();
+
+        TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, 
+											TEventCode aType);
+
+    private:    // From MVeiVideoDisplayObserver
+      
+        virtual void NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo = 0 );
+
+		virtual void NotifyFramesCompleted( CFbsBitmap* aFirstFrame, CFbsBitmap* aLastFrame, 
+            CFbsBitmap* /*aTimelineFrame*/, TInt aError );
+
+
+		/**
+		 * Gets an object whose type is encapsulated by the specified TTypeUid 
+		 * object.
+		 *
+		 * @param aId Encapsulates the Uid that identifies the type of object
+		 * required.
+		 *
+		 * @return
+		 */
+		virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
+    protected:  // From MVedMovieObserver
+
+        virtual void NotifyVideoClipAdded(CVedMovie& aMovie, TInt aIndex);
+
+	    virtual void NotifyVideoClipAddingFailed(CVedMovie& aMovie, TInt aError);
+
+    	virtual void NotifyVideoClipRemoved(CVedMovie& aMovie, TInt aIndex);
+	
+	    virtual void NotifyVideoClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
+									           TInt aNewIndex);
+
+    	virtual void NotifyVideoClipTimingsChanged(CVedMovie& aMovie,
+											   TInt aIndex);
+
+    	virtual void NotifyVideoClipColorEffectChanged(CVedMovie& aMovie,
+												   TInt aIndex);
+	
+	    virtual void NotifyVideoClipAudioSettingsChanged(CVedMovie& aMovie,
+											         TInt aIndex);
+
+	    virtual void NotifyVideoClipGeneratorSettingsChanged(CVedMovie& aMovie,
+											             TInt aIndex);
+
+	    virtual void NotifyVideoClipDescriptiveNameChanged(CVedMovie& aMovie,
+																TInt aIndex);
+
+	    virtual void NotifyStartTransitionEffectChanged(CVedMovie& aMovie);
+
+	    virtual void NotifyMiddleTransitionEffectChanged(CVedMovie& aMovie, 
+													 TInt aIndex);
+
+	    virtual void NotifyEndTransitionEffectChanged(CVedMovie& aMovie);
+
+	    virtual void NotifyAudioClipAdded(CVedMovie& aMovie, TInt aIndex);
+
+	    virtual void NotifyAudioClipAddingFailed(CVedMovie& aMovie, TInt aError);
+
+	    virtual void NotifyAudioClipRemoved(CVedMovie& aMovie, TInt aIndex);
+
+        virtual void NotifyAudioClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
+									           TInt aNewIndex);
+
+	    virtual void NotifyAudioClipTimingsChanged(CVedMovie& aMovie,
+											   TInt aIndex);
+
+        virtual void NotifyMovieQualityChanged(CVedMovie& aMovie);
+
+        virtual void NotifyMovieReseted(CVedMovie& aMovie);
+
+		virtual void NotifyMovieOutputParametersChanged(CVedMovie& aMovie);
+
+	    virtual void NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex);
+
+		virtual void NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
+                                                        TInt aClipIndex, 
+                                                        TInt aMarkIndex);
+
+		virtual void NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex);
+
+		virtual void NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
+                                                        TInt aClipIndex, 
+                                                        TInt aMarkIndex);  
+
+    private:    // New functions
+		TInt TimeIncrement(TInt aKeyCount) const;
+
+    private:    // Constructors
+
+        CVeiTrimForMmsContainer( CVedMovie& aMovie, CVeiTrimForMmsView& aView);
+
+        void ConstructL( const TRect& aRect );
+
+    private:    // Enumeration
+        
+        enum TTrimForMmsControls
+            {
+            ECutFrame,
+            EVideoDisplayStart,
+            EVideoDisplayEnd,
+			EVideoPreview,
+            ENumberOfControls   // This is always the last one!
+            };
+
+	public:
+		enum TPreviewState
+			{
+			EIdle = 0,
+			ELoading,
+			EPreview,
+			EPlaying,
+			EStop,
+			EStopAndExit,
+			EOpeningFile,
+			EPause
+			};
+
+    private:    // Data
+
+        /**
+         * Whether or not the last key pressed was left or right navi-key.
+         */
+        TBool                   iLastKeyLeftOrRight;
+
+        /**
+         *
+         */
+        TInt                    iVideoDisplayStartIndex;        
+
+        /**
+         *
+         */
+        TInt                    iVideoDisplayEndIndex;
+
+        /**
+         *
+         */
+        TRect                   iVideoDisplayEndRect;
+
+        /**
+         * Text layout for main pane's end text.
+         */
+        TAknLayoutText          iLayoutTextEnd;
+
+        /**
+         * Text layout for main pane's start text.
+         */
+        TAknLayoutText          iLayoutTextStart;
+
+        /**
+         * Layout for start thumbnail.
+         */
+        TAknLayoutRect          iLayoutRectStart;
+
+        /**
+         * Layout for end thumbnail.
+         */
+        TAknLayoutRect          iLayoutRectEnd;
+
+        /**
+         * Layout for trim timeline icon.
+         */
+        TAknLayoutRect          iLayoutRectIcon;
+
+        /**
+         * Layout for cut frame.
+         */
+        TAknLayoutRect iLayoutRectCutFrame;
+
+        /**
+         * Text shown above the end thumbnail.
+         */
+        HBufC*                  iEndText;
+
+        /**
+         * Text shown above the start thumbnail.
+         */
+        HBufC*                  iStartText;
+
+        /**
+         *
+         */
+		CVeiCutterBar*			iCutterBar;
+        /**
+         *
+         */
+        CVedMovie&              iMovie;
+
+        /**
+         *
+         */
+        CVeiVideoDisplay*       iVideoDisplayStart;
+
+        /**
+         *
+         */
+        CVeiVideoDisplay*       iVideoDisplayEnd;
+
+		CVeiVideoDisplay*		iVideoDisplay;
+
+		TPreviewState			iPreviewState;
+				
+		TRect					iPreviewRect;
+
+		CVeiFrameTaker*			iFrameTaker;
+
+		/*
+		 * Updated by NotifyVideoClipAdded( CVedMovie& aMovie, TInt aIndex ) 
+		 */
+		TInt					iClipIndex;
+
+		CVeiTrimForMmsView&		iView;
+
+
+		TRect					iStartTextBox;
+		TRect					iEndTextBox;
+		TRect					iVideoDisplayStartRect;
+		TRect					iTimelineRect;
+		TRect					iCutIconRect;
+		TRect					iAdjustRect;
+
+		TPoint					iCutIconPoint;
+		TSize					iCutIconSize;
+
+		TTimeIntervalMicroSeconds	iSeekPos;
+		TTimeIntervalMicroSeconds	iSeekEndPos;
+		TTimeIntervalMicroSeconds	iDuration;
+		TInt					iKeyRepeatCount;
+		/** Background context. Skin stuff. */
+		CAknsBasicBackgroundControlContext*	iBgContext;
+
+		CVeiDisplayLighter*		iScreenLight;
+		TInt					iMaxMmsSize;
+		TBool 					iBlack;
+
+
+		TBool					iSeekEvent;
+		  /**
+         * Progress dialog.
+         */
+        CAknProgressDialog*		iProgressNote;
+
+		/** Progress info for the progress note. */
+		CEikProgressInfo* 		iProgressInfo;
+		TBool 					iKeyEnable;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/inc/VeiTrimForMmsView.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,341 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef VEITRIMFORMMSVIEW_H
+#define VEITRIMFORMMSVIEW_H
+
+// INCLUDES
+// System includes
+#include <aknview.h>    // CAknView
+#include <CAknMemorySelectionDialog.h> 
+#include <VedMovie.h>   // CVedmovie
+// User includes
+#include "VeiSettings.h"
+
+// FORWARD DECLARATIONS
+class CAknNavigationDecorator;
+class CAknProgressDialog;
+class CVeiErrorUI;
+class CSendUi;
+class CVeiTrimForMmsContainer;
+class CVedMovie;
+class CMessageData;
+class CEikProgressInfo;
+class CVeiTempMaker;
+
+
+
+// CLASS DECLARATION
+
+/**
+ *
+ */
+class CVeiTrimForMmsView: public CAknView,
+                          public MVedMovieObserver,
+                          public MVedMovieProcessingObserver
+						  
+    {
+    public: // Constructors and destructor
+        
+        static CVeiTrimForMmsView* NewL( CSendUi& aSendAppUi );
+
+        static CVeiTrimForMmsView* NewLC( CSendUi& aSendAppUi );
+
+        virtual ~CVeiTrimForMmsView();
+
+	enum TPreviewState
+			{
+			EIdle = 0,
+			ELoading,
+			EPreview,
+			EPlaying,
+			EStop,
+			EStopAndExit,
+			EOpeningFile,
+			EPause
+			};
+
+    public:
+		void UpdateNaviPaneL( const TInt& aSizeInBytes, 
+					const TTimeIntervalMicroSeconds& aTime );
+
+        void UpdateNaviPaneSize();
+
+		enum TTrimState
+            {
+            ESeek = 0,			
+			EFullPreview
+			};
+
+		void SetTrimStateL( TTrimState aState );
+
+		/**
+		 * From <code>MProgressDialogCallback</code>, callback method gets
+         * called when a dialog is dismissed.
+		 *
+		 * @param aButtonId  Button id.
+		 */
+		virtual void DialogDismissedL( TInt aButtonId );
+		void ProcessNeeded( TBool aProcessNeed );
+		
+		/**
+         * Shows global error note for given error.
+         * 
+         * @param aError No description.
+         */
+        void ShowGlobalErrorNoteL( TInt aError = 0 ) const;
+
+		/** 
+		 * Handles a change to the control's resources.
+		 */
+		void HandleResourceChange( TInt aType );
+
+    private:    // From CAknView
+        
+        TUid Id() const;  
+
+        void HandleCommandL(TInt aCommand);
+
+        void DoActivateL( 
+            const TVwsViewId& aPrevViewId,
+            TUid aCustomMessageId,
+            const TDesC8& aCustomMessage );
+        
+         void DoDeactivate();  
+
+		 void HandleStatusPaneSizeChange();
+
+         void ReadSettingsL( TVeiSettings& aSettings ) const;
+
+    protected:  // From MVedMovieObserver
+
+        virtual void NotifyVideoClipAdded(CVedMovie& aMovie, TInt aIndex);
+
+	    virtual void NotifyVideoClipAddingFailed(CVedMovie& aMovie, TInt aError);
+
+    	virtual void NotifyVideoClipRemoved(CVedMovie& aMovie, TInt aIndex);
+	
+	    virtual void NotifyVideoClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
+									           TInt aNewIndex);
+
+    	virtual void NotifyVideoClipTimingsChanged(CVedMovie& aMovie,
+											   TInt aIndex);
+
+    	virtual void NotifyVideoClipColorEffectChanged(CVedMovie& aMovie,
+												   TInt aIndex);
+	
+	    virtual void NotifyVideoClipAudioSettingsChanged(CVedMovie& aMovie,
+											         TInt aIndex);
+
+	    virtual void NotifyVideoClipGeneratorSettingsChanged(CVedMovie& aMovie,
+											             TInt aIndex);
+
+	    virtual void NotifyVideoClipDescriptiveNameChanged(CVedMovie& aMovie,
+																TInt aIndex);
+
+	    virtual void NotifyStartTransitionEffectChanged(CVedMovie& aMovie);
+
+	    virtual void NotifyMiddleTransitionEffectChanged(CVedMovie& aMovie, 
+													 TInt aIndex);
+
+	    virtual void NotifyEndTransitionEffectChanged(CVedMovie& aMovie);
+
+	    virtual void NotifyAudioClipAdded(CVedMovie& aMovie, TInt aIndex);
+
+	    virtual void NotifyAudioClipAddingFailed(CVedMovie& aMovie, TInt aError);
+
+	    virtual void NotifyAudioClipRemoved(CVedMovie& aMovie, TInt aIndex);
+
+        virtual void NotifyAudioClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
+									           TInt aNewIndex);
+
+	    virtual void NotifyAudioClipTimingsChanged(CVedMovie& aMovie,
+											   TInt aIndex);
+
+        virtual void NotifyMovieQualityChanged(CVedMovie& aMovie);
+
+        virtual void NotifyMovieReseted(CVedMovie& aMovie);
+
+		virtual void NotifyMovieOutputParametersChanged(CVedMovie& aMovie);
+
+	    virtual void NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex);
+
+		virtual void NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
+                                                        TInt aClipIndex, 
+                                                        TInt aMarkIndex);
+
+		virtual void NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex);
+
+		virtual void NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
+                                                        TInt aClipIndex, 
+                                                        TInt aMarkIndex);  
+
+    protected:  // From MVedMovieProcessingObserver
+
+	    /**
+	     * Called to notify that a new movie processing operation has been started. 
+	     *
+	     * @param aMovie  movie
+	     */
+	    void NotifyMovieProcessingStartedL( CVedMovie& aMovie );
+
+	    /**
+	     * Called to inform about the current progress of the movie processing operation.
+	     *
+	     * @param aMovie       movie
+	     * @param aPercentage  percentage of the operation completed, must be 
+  	     *                     in range 0..100
+	     */
+	    void NotifyMovieProcessingProgressed( CVedMovie& aMovie, TInt aPercentage );
+
+	    /**
+	     * Called to notify that the movie processing operation has been completed. 
+	     * 
+	     * @param aMovie  movie
+	     * @param aError  error code why the operation was completed. 
+	     *                <code>KErrNone</code> if the operation was completed 
+	     *                successfully.
+	     */
+	    void NotifyMovieProcessingCompleted( CVedMovie& aMovie, TInt aError );
+
+    private:    // New functions
+
+        void CmdSoftkeyCancelL();
+                
+        /**
+         * 
+         */
+        void CmdSoftkeyOkL();
+
+
+        /**
+         * Send via multimedia command handling.
+         */
+        void CmdSendViaMultimediaL();        
+
+        void CmdSoftkeyBackL();
+
+        void PushKeySoundL( const TInt aResourceId ) const;
+
+        void PopKeySound() const;
+
+        /**
+         * Sets the text for title pane.
+         */
+        void SetTitlePaneTextL() const;
+
+        void CreateNaviPaneL();
+
+        void SetNaviPaneDurationLabelL( const TTimeIntervalMicroSeconds& aTime );
+
+        void SetNaviPaneSizeLabelL( const TInt& aSizeInBytes );
+
+		/**
+		 * Start full screen preview.
+		 */
+		void PlayPreviewL();
+
+    private:    // Constructors
+        
+        CVeiTrimForMmsView( CSendUi& aSendAppUi );
+
+        void ConstructL();
+
+    private:    // Data
+
+        /** 
+         * Cut in time in microseconds (clip timebase) for trimmed video.
+         */
+        TTimeIntervalMicroSeconds   iCutInTime;
+
+        /** 
+         * Cut out time in microseconds (clip timebase) for trimmed video.
+         */
+        TTimeIntervalMicroSeconds   iCutOutTime;
+
+        /**
+         * Progress note for saving the trimmed video
+         */
+        CAknProgressDialog*         iProgressNote;
+        
+        /**
+         * Progress info for the progress dialog.
+         */
+        CEikProgressInfo*           iProgressInfo;
+        
+        /**
+         * Container
+         */
+        CVeiTrimForMmsContainer*    iContainer;
+
+        /**
+         * Navigation pane decorator
+         */
+        CAknNavigationDecorator*    iNaviDecorator;
+
+        /**
+         *
+         */
+        CSendUi&                    iSendAppUi;
+
+        /**
+         *
+         */
+        CVedMovie*                  iVedMovie;
+
+        /**
+         * Previous view which activated this view.
+         */
+        TVwsViewId                  iPreviousViewId;
+
+        /**
+         * Utility class to display error notes by applications. 
+         */
+        CVeiErrorUI*                   iErrorUi;
+
+		/**
+         * No description.
+         */
+        CVeiTempMaker*              iTempMaker;
+
+		/**
+         * Temporary file name for storing preview/send clip.
+         */
+        HBufC*                      iTempFile;
+
+
+		TTrimState				    iTrimState;
+
+		TVeiSettings                iMovieSaveSettings;
+
+		/*
+		 * Indecates if process needed.
+		 */
+		TBool					    iProcessNeeded;
+
+
+
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/src/TrimForMms.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/* ====================================================================
+ * File: TrimForMms.cpp
+ * Created: 04/18/06
+ * Author: 
+ *
+ * ==================================================================== */
+
+#include "TrimForMmsApplication.h"
+#include <eikstart.h>
+
+// Create an application, and return a pointer to it
+CApaApplication* NewApplication()
+	{
+	return new CTrimForMmsApplication;
+	}
+
+
+TInt E32Main()
+	{
+	return EikStart::RunApplication(NewApplication);
+	
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/src/TrimForMmsApplication.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+/* ====================================================================
+ * File: TrimForMmsApplication.cpp
+ * Created: 04/18/06
+ * Author: 
+ * 
+ * ==================================================================== */
+
+#include "TrimForMmsDocument.h"
+#include "TrimForMmsApplication.h"
+#include "VideoEditorCommon.h"  // Application UID
+
+CApaDocument* CTrimForMmsApplication::CreateDocumentL()
+    {  
+    // Create an TrimForMms document, and return a pointer to it
+    CApaDocument* document = CTrimForMmsDocument::NewL(*this);
+    return document;
+    }
+
+TUid CTrimForMmsApplication::AppDllUid() const
+    {
+    // Return the UID for the TrimForMms application
+    return KUidTrimForMms;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/src/TrimForMmsAppui.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+/* ====================================================================
+ * File: TrimForMmsAppUi.cpp
+ * Created: 04/18/06
+ * Author: 
+ * 
+ * ==================================================================== */
+
+#include <avkon.hrh>
+#include <aknnotewrappers.h> 
+#include <trimformms.rsg>
+
+#include "TrimForMms.pan"
+#include "TrimForMmsAppUi.h"
+#include "VeiSettings.h"
+#include "VeiTrimForMmsView.h"
+#include "TrimForMms.hrh"
+#include "VideoEditorCommon.h"
+#include "VideoEditorDebugUtils.h"
+
+#include <sendui.h>
+
+// ConstructL is called by the application framework
+void CTrimForMmsAppUi::ConstructL()
+    {
+
+    BaseConstructL(EAppOrientationAutomatic|EAknEnableSkin);
+
+    iSendUi = CSendUi::NewL();
+
+    iTrimForMmsView = CVeiTrimForMmsView::NewL(*iSendUi);
+
+    AddViewL (iTrimForMmsView);    // transfers ownership
+
+    }
+
+CTrimForMmsAppUi::CTrimForMmsAppUi()                              
+    {
+	// no implementation required
+    }
+
+CTrimForMmsAppUi::~CTrimForMmsAppUi()
+    {
+    if (iTrimForMmsView)
+        {
+        delete iTrimForMmsView;
+        iTrimForMmsView = NULL;
+        }
+        
+    delete iSendUi;
+    }
+
+// handle any menu commands
+void CTrimForMmsAppUi::HandleCommandL(TInt aCommand)
+    {
+    switch(aCommand)
+        {
+        case EEikCmdExit:
+        case EAknSoftkeyExit:
+            Exit();
+            break;
+
+        default:
+            Panic(ETrimForMmsBasicUi);
+            break;
+        }
+    }
+
+//=============================================================================
+void CTrimForMmsAppUi::ReadSettingsL( TVeiSettings& aSettings ) 
+	{
+	LOG(KVideoEditorLogFile, "CTrimForMmsAppUi::ReadSettingsL: in");
+	CDictionaryStore* store = Application()->OpenIniFileLC( iCoeEnv->FsSession() );
+
+	TBool storePresent = store->IsPresentL( KUidVideoEditor );	// UID has an associated stream?
+
+	if( storePresent ) 
+		{
+		RDictionaryReadStream readStream;
+		readStream.OpenLC( *store, KUidVideoEditor );
+
+		readStream >> aSettings;	// Internalize data to TVeiSettings.
+		
+		CleanupStack::PopAndDestroy( readStream ); 
+		}
+	else 
+		{
+		/* Read the default filenames from resources */
+		HBufC*	videoName = iEikonEnv->AllocReadResourceLC( R_VEI_SETTINGS_VIEW_SETTINGS_ITEM_VALUE );
+
+		const CFont* myFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+
+		aSettings.DefaultVideoName() = AknTextUtils::ChooseScalableText(videoName->Des(), *myFont, 400 );	
+		CleanupStack::PopAndDestroy( videoName );
+
+		HBufC*	snapshotName = iEikonEnv->AllocReadResourceLC( R_VEI_SETTINGS_VIEW_SETTINGS_ITEM2_VALUE );
+		aSettings.DefaultSnapshotName() = AknTextUtils::ChooseScalableText(snapshotName->Des(), *myFont, 400 );
+		CleanupStack::PopAndDestroy( snapshotName );
+
+		/* Memory card is used as a default target */
+		aSettings.MemoryInUse() = CAknMemorySelectionDialog::EMemoryCard;
+
+         /* Set save quality to "Auto" by default. */
+        aSettings.SaveQuality() = TVeiSettings::EAuto;
+
+		RDictionaryWriteStream writeStream;
+		writeStream.AssignLC( *store, KUidVideoEditor );
+
+		writeStream << aSettings;
+
+		writeStream.CommitL();
+
+		store->CommitL();
+		
+		CleanupStack::PopAndDestroy( writeStream );	
+		}
+	CleanupStack::PopAndDestroy( store );
+	LOG(KVideoEditorLogFile, "CTrimForMmsAppUi::ReadSettingsL: out");
+	}
+
+//=============================================================================
+/*void CTrimForMmsAppUi::HandleScreenDeviceChangedL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiAppUi::HandleScreenDeviceChangedL: In");
+	CAknAppUi::HandleScreenDeviceChangedL(); 
+	if ( iTrimForMmsView )
+		{
+		iTrimForMmsView->HandleScreenDeviceChangedL();
+		}
+	LOG(KVideoEditorLogFile, "CVeiAppUi::HandleScreenDeviceChangedL: Out");
+	}*/
+
+//=============================================================================
+void CTrimForMmsAppUi::HandleResourceChangeL(TInt aType)
+	{
+	LOG(KVideoEditorLogFile, "CTrimForMmsAppUi::HandleResourceChangeL: In");
+	CAknAppUi::HandleResourceChangeL(aType);
+	if ( iTrimForMmsView )
+		{
+		iTrimForMmsView->HandleResourceChange(aType);
+		}
+	LOG(KVideoEditorLogFile, "CTrimForMmsAppUi::HandleResourceChangeL: Out");
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/src/TrimForMmsDocument.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+/* ====================================================================
+ * File: TrimForMmsDocument.cpp
+ * Created: 04/18/06
+ * Author: 
+ * 
+ * ==================================================================== */
+
+#include "TrimForMmsAppUi.h"
+#include "TrimForMmsDocument.h"
+#include <utf.h>
+
+
+// Standard Symbian OS construction sequence
+CTrimForMmsDocument* CTrimForMmsDocument::NewL(CEikApplication& aApp)
+    {
+    CTrimForMmsDocument* self = NewLC(aApp);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CTrimForMmsDocument* CTrimForMmsDocument::NewLC(CEikApplication& aApp)
+    {
+    CTrimForMmsDocument* self = new (ELeave) CTrimForMmsDocument(aApp);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+void CTrimForMmsDocument::ConstructL()
+    {
+	// no implementation required
+    }    
+
+CTrimForMmsDocument::CTrimForMmsDocument(CEikApplication& aApp) : CAknDocument(aApp) 
+    {
+	// no implementation required
+    }
+
+CTrimForMmsDocument::~CTrimForMmsDocument()
+    {
+	// no implementation required
+    }
+
+CEikAppUi* CTrimForMmsDocument::CreateAppUiL()
+    {
+    // Create the application user interface, and return a pointer to it,
+    // the framework takes ownership of this object
+    CEikAppUi* appUi = new (ELeave) CTrimForMmsAppUi;
+    return appUi;
+    }
+
+void CTrimForMmsDocument::OpenFileL(CFileStore*& /*aFileStore*/, RFile& aFile)
+ 	{
+ 	TFileName file;
+ 	User::LeaveIfError(aFile.FullName(file)); 	
+ 	
+ 	TBuf8<KMaxFileName> conv8Filename;
+					CnvUtfConverter::ConvertFromUnicodeToUtf8( conv8Filename,file );
+ 	
+ 	STATIC_CAST( CTrimForMmsAppUi*, CCoeEnv::Static()->AppUi() )
+ 	    ->ActivateLocalViewL(TUid::Uid(0), TUid::Uid(0), conv8Filename);
+ 	
+ 	aFile.Close();
+ 	
+ 	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/src/VeiTrimForMmsContainer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1018 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+
+// INCLUDE FILES
+// System includes
+#include <AknIconUtils.h>   // AknIconUtils
+#include <eikenv.h>     // iEikonEnv
+#include <trimformms.rsg>    // Video Editor resources
+#include <StringLoader.h>   // StringLoader
+
+#include <aknbiditextutils.h>
+#include <gulfont.h>
+
+#include <aknsdrawutils.h> 
+#include <aknsdatacontext.h> 
+#include <aknsbasicbackgroundcontrolcontext.h>
+
+#include <AknProgressDialog.h> 
+#include <eikprogi.h>
+#include <AknWaitDialog.h>
+
+
+// User includes
+#include "VeiTrimForMmsContainer.h"
+#include "VeiVideoDisplay.h"
+#include "VideoEditorCommon.h"
+//#include "VideoEditorHelp.hlp.hrh"  // Topic contexts (literals)
+#include "veiframetaker.h"
+#include "VeiTrimForMmsView.h"
+#include "VeiCutterBar.h"
+#include "VeiVideoEditorSettings.h"
+#include "VideoEditorUtils.h"
+#include "VideoEditorDebugUtils.h"
+
+void CVeiTrimForMmsContainer::DialogDismissedL( TInt /*aButtonId*/ )
+	{
+	iProgressInfo = NULL;
+	}
+
+
+CVeiTrimForMmsContainer* CVeiTrimForMmsContainer::NewL( const TRect& aRect,
+                                                        CVedMovie& aMovie, CVeiTrimForMmsView& aView )
+    {
+    CVeiTrimForMmsContainer* self = CVeiTrimForMmsContainer::NewLC( aRect,
+                                                                    aMovie,
+																	aView );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+CVeiTrimForMmsContainer* CVeiTrimForMmsContainer::NewLC( const TRect& aRect,
+                                                         CVedMovie& aMovie,
+														 CVeiTrimForMmsView& aView)
+    {
+    CVeiTrimForMmsContainer* self = 
+            new(ELeave)CVeiTrimForMmsContainer( aMovie, aView );
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect );
+
+    return self;
+    }
+
+
+CVeiTrimForMmsContainer::CVeiTrimForMmsContainer( CVedMovie& aMovie, CVeiTrimForMmsView& aView ):
+                                                  iLastKeyLeftOrRight(EFalse),
+                                                  iMovie(aMovie),
+												  iView( aView )
+                                                  
+    {
+    }
+
+
+void CVeiTrimForMmsContainer::ConstructL( const TRect& aRect )
+    {
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsContainer::ConstructL: in");
+
+    // Make this compound control window-owning.
+    CreateWindowL();
+
+    iMovie.RegisterMovieObserverL( this );    
+
+    // Read the texts shown above the thumbnails from resources
+    iStartText = StringLoader::LoadL( R_VED_THUMBNAIL_START_TEXT, iEikonEnv );
+    iEndText = StringLoader::LoadL( R_VED_THUMBNAIL_END_TEXT, iEikonEnv );
+	
+	iSeekPos = TTimeIntervalMicroSeconds( 0 );
+
+    iVideoDisplayStart = CVeiVideoDisplay::NewL( iVideoDisplayStartRect, this, *this );
+
+    iVideoDisplayEnd = CVeiVideoDisplay::NewL( iVideoDisplayEndRect, this, *this );
+
+	iCutterBar = CVeiCutterBar::NewL( this );
+	iCutterBar->SetPlayHeadVisible( EFalse );
+	iVideoDisplay = CVeiVideoDisplay::NewL( aRect, this, *this );
+
+	iFrameTaker = CVeiFrameTaker::NewL( *this );
+
+	/* Timer to keep back light on when user is not giving key events */
+	iScreenLight = CVeiDisplayLighter::NewL();
+	CVeiVideoEditorSettings::GetMaxMmsSizeL( iMaxMmsSize );
+	/* SharedData returns maxmmssize in kbytes. Change it to bytes(1000) and
+	   add some margin to final value.*/
+	iMaxMmsSize = STATIC_CAST( TInt, iMaxMmsSize*0.98 );
+	iBlack = EFalse;
+
+	// Set this control extent.
+    SetRect( aRect );
+	iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, Rect(), EFalse );
+
+    ActivateL();
+
+	iKeyEnable = EFalse;
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsContainer::ConstructL: out");
+    }
+
+
+
+CVeiTrimForMmsContainer::~CVeiTrimForMmsContainer()
+    {
+	iMovie.UnregisterMovieObserver( this );
+
+    delete iEndText;
+    delete iStartText;
+	delete iScreenLight;
+
+    delete iCutterBar;
+    
+    delete iVideoDisplayStart;
+    delete iVideoDisplayEnd;
+	if( iVideoDisplay )
+        {
+        delete iVideoDisplay;
+		iVideoDisplay = NULL;
+        }
+
+	if (iFrameTaker)
+		{
+		delete iFrameTaker;
+		iFrameTaker = NULL;
+		}
+
+	if ( iProgressNote )
+		{
+		delete iProgressNote;
+		iProgressNote = NULL;
+		}
+	iProgressInfo = NULL;
+
+	delete iBgContext;
+    }
+
+void CVeiTrimForMmsContainer::SetMaxMmsSize( TInt aMaxSizeInBytes )
+	{
+	iMaxMmsSize = aMaxSizeInBytes;
+	}
+
+const TTimeIntervalMicroSeconds& CVeiTrimForMmsContainer::CutInTime() const
+    {
+	return iSeekPos;
+	}
+
+
+const TTimeIntervalMicroSeconds& CVeiTrimForMmsContainer::CutOutTime() const
+    {
+	return iSeekEndPos;
+	}
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsContainer::ComponentControl(...) const
+//
+// Gets the specified component of a compound control. 
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CVeiTrimForMmsContainer::ComponentControl( TInt aIndex ) const
+    {
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsContainer::ComponentControl()");
+
+    switch( aIndex )
+        {
+        //
+        // iCutterDisplay
+        //
+        case ECutFrame:
+            {
+            return iCutterBar;
+            }
+        //
+        // iVideoDisplayStart
+        //
+        case EVideoDisplayStart:
+            {
+            return iVideoDisplayStart;
+            }
+        //
+        // iVideoDisplayEnd
+        //
+        case EVideoDisplayEnd:
+            {
+            return iVideoDisplayEnd;
+            }
+		//
+        // iVideoDisplay
+        //
+		case EVideoPreview:
+			{
+			return iVideoDisplay;
+	
+			}
+			
+        //
+        // Default
+        //
+        default:
+            {
+            return NULL;
+            }
+        }
+
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsContainer::CountComponentControls() const
+//
+// Gets the number of controls contained in a compound control.
+// ----------------------------------------------------------------------------
+//
+TInt CVeiTrimForMmsContainer::CountComponentControls() const
+    {
+    return ENumberOfControls;
+    }
+
+
+void CVeiTrimForMmsContainer::Draw( const TRect& aRect ) const
+    {
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsContainer::Draw(): In");
+
+    CWindowGc& gc = SystemGc();
+	gc.Clear( aRect );
+
+	// Black backbround for the preview
+	if ( iBlack )
+        {
+		iVideoDisplay->MakeVisible( EFalse );
+        gc.SetPenStyle( CWindowGc::ENullPen );
+		gc.SetBrushColor( KRgbBlack );
+		gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+		gc.DrawRect( aRect );
+        gc.SetPenStyle( CWindowGc::ESolidPen );	
+	    gc.DrawRoundRect(aRect, TSize(4,4));
+		return;
+        }
+	else
+	{
+	 // Draw skin background
+	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+	MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+	AknsDrawUtils::Background( skin, cc, this, gc, aRect );
+
+	const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+	TBuf<95> startVisualText;
+	TPoint startTextPoint;
+	TBuf<95> endVisualText;
+	TPoint endTextPoint;
+
+	startTextPoint.iY = iStartTextBox.iTl.iY + font->HeightInPixels();
+	endTextPoint.iY = iEndTextBox.iTl.iY + font->HeightInPixels();
+	
+	gc.UseFont( font );
+		
+	TBidiText::TDirectionality textDirectionality;
+
+	textDirectionality = AknTextUtils::CurrentScriptDirectionality();
+
+	TInt maxWidthNonClippingStart = iStartTextBox.Width();
+
+	AknBidiTextUtils::ConvertToVisualAndClip( *iStartText, startVisualText, *font, maxWidthNonClippingStart, 
+		maxWidthNonClippingStart );
+	/** check text alignment */
+	if ( textDirectionality == TBidiText::ELeftToRight )
+		{
+		startTextPoint.iX = iVideoDisplayStartRect.iTl.iX;
+		}
+	else
+		{
+		startTextPoint.iX = iVideoDisplayStartRect.iBr.iX - font->TextWidthInPixels( startVisualText );
+		}
+
+	gc.DrawText( startVisualText, startTextPoint );	
+
+
+	TInt maxWidthNonClippingEnd = iEndTextBox.Width();
+
+	AknBidiTextUtils::ConvertToVisualAndClip( *iEndText, endVisualText, *font, maxWidthNonClippingEnd, 
+		maxWidthNonClippingEnd );
+	/** check text alignment */
+	if ( textDirectionality == TBidiText::ELeftToRight )
+		{
+		endTextPoint.iX = iVideoDisplayEndRect.iTl.iX;
+		}
+	else
+		{
+		endTextPoint.iX = iVideoDisplayEndRect.iBr.iX - font->TextWidthInPixels( endVisualText );
+		}
+
+	gc.DrawText( endVisualText, endTextPoint );	
+
+	gc.DiscardFont();
+
+	// Draw Start/End displays
+	iVideoDisplayStart->SetRect( iVideoDisplayStartRect );
+	iVideoDisplayEnd->SetRect( iVideoDisplayEndRect );
+
+	if( iPreviewState == EPlaying )
+		{
+		iVideoDisplay->MakeVisible( ETrue );
+		}	
+	else
+		{
+		iVideoDisplay->MakeVisible( EFalse );
+		}
+
+	}
+
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsContainer::Draw(): Out");
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsContainer::GetHelpContext(...) const
+//
+// Gets the control's help context. Associates the control with a particular
+// Help file and topic in a context sensitive application.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsContainer::GetHelpContext( TCoeHelpContext& /*aContext*/ ) const
+    {
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsContainer::GetHelpContext(): In");
+
+    // Set UID of the CS Help file (same as application UID).
+    //aContext.iMajor = KUidVideoEditor;
+
+    // Set the context/topic.
+    //aContext.iContext = KVED_HLP_TRIM_FOR_MMS_VIEW;
+
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsContainer::GetHelpContext(): Out");
+    }
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsContainer::SizeChanged()
+//
+// The function is called whenever SetExtent(), SetSize(), SetRect(),
+// SetCornerAndSize(), or SetExtentToWholeScreen() are called on the control.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsContainer::SizeChanged()
+    {
+	LOG(KVideoEditorLogFile, "CVeiTrimForMmsContainer::SizeChanged(): In");
+
+	TRect rect = Rect();
+	if ( iBgContext )
+		{
+		iBgContext->SetRect( rect );
+		}
+
+	if ( VideoEditorUtils::IsLandscapeScreenOrientation() ) //Landscape
+	{
+		//  Start Text rect
+		TInt startTextTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.00962 );
+		TInt startTextTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.01389 );	
+		TInt startTextBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.49512 );
+		TInt startTextBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.09375 );
+			
+		iStartTextBox = TRect(startTextTlX, startTextTlY, startTextBrX, 
+			startTextBrY);
+		//  End Text rect
+		TInt endTextTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.50481 );
+		TInt endTextTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.01389 );	
+		TInt endTextBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.99039 );
+		TInt endTextBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.09375 );
+			
+		iEndTextBox = TRect(endTextTlX, endTextTlY, endTextBrX, 
+			endTextBrY);
+
+		// Start Video rect
+		TInt startVideoTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.00962 );
+		TInt startVideoTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.10764 );	
+		TInt startVideoBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.49512 );
+		TInt startVideoBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.68056 );
+			
+		iVideoDisplayStartRect = TRect(startVideoTlX, startVideoTlY, startVideoBrX, 
+			startVideoBrY);
+		//  End Video rect
+		TInt endVideoTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.50481 );
+		TInt endVideoTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.10764 );	
+		TInt endVideoBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.99039 );
+		TInt endVideoBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.68056 );
+			
+		iVideoDisplayEndRect = TRect(endVideoTlX, endVideoTlY, endVideoBrX, 
+			endVideoBrY);
+
+		// Timeline rect
+		TInt timeLineTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.0114 );
+		TInt timeLineTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.80208 );
+			
+		TSize cutBarSize = TSize(STATIC_CAST( TInt, rect.iBr.iX*0.9773 ),
+			STATIC_CAST( TInt, rect.iBr.iY*0.0973 ) );
+
+		iTimelineRect = TRect( TPoint(timeLineTlX, timeLineTlY), cutBarSize );
+	}
+	else // Portrait
+	{
+		//  Start Text rect
+		TInt startTextTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.01136 );
+		TInt startTextTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.01389 );	
+		TInt startTextBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.49432 );
+		TInt startTextBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.10417 );
+			
+		iStartTextBox = TRect(startTextTlX, startTextTlY, startTextBrX, 
+			startTextBrY);
+
+		//  End Text rect
+		TInt endTextTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.50568 );
+		TInt endTextTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.01389 );	
+		TInt endTextBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.98864 );
+		TInt endTextBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.10417 );
+			
+		iEndTextBox = TRect(endTextTlX, endTextTlY, endTextBrX, 
+			endTextBrY);
+
+		// Start Video rect
+		TInt startVideoTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.01136 );
+		TInt startVideoTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.11806 );	
+		TInt startVideoBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.49432 );
+		TInt startVideoBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.60069 );
+			
+		iVideoDisplayStartRect = TRect(startVideoTlX, startVideoTlY, startVideoBrX, 
+			startVideoBrY);
+
+		//  End Video rect
+		TInt endVideoTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.50568 );
+		TInt endVideoTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.11806 );	
+		TInt endVideoBrX = STATIC_CAST( TInt, rect.iBr.iX * 0.98864 );
+		TInt endVideoBrY = STATIC_CAST( TInt, rect.iBr.iY * 0.60069 );
+			
+		iVideoDisplayEndRect = TRect(endVideoTlX, endVideoTlY, endVideoBrX, 
+			endVideoBrY);
+		
+		// Timeline rect
+		TInt timeLineTlX = STATIC_CAST( TInt, rect.iBr.iX * 0.0114 );
+		TInt timeLineTlY = STATIC_CAST( TInt, rect.iBr.iY * 0.767361 );
+
+			
+		TSize cutBarSize = TSize(STATIC_CAST( TInt, rect.iBr.iX*0.9773 ),
+			STATIC_CAST( TInt, rect.iBr.iY*0.0973 ) );
+
+		iTimelineRect = TRect(TPoint(timeLineTlX, timeLineTlY), cutBarSize);				
+		}
+
+	iCutterBar->SetRect( iTimelineRect );
+
+	LOG(KVideoEditorLogFile, "CVeiTrimForMmsContainer::SizeChanged(): Out");
+    }
+
+
+TKeyResponse CVeiTrimForMmsContainer::OfferKeyEventL( 
+                                        const TKeyEvent& aKeyEvent,
+									    TEventCode aType )
+    {
+	if( iKeyEnable )
+	{
+    switch( aType )
+        {
+        //
+        // Key down event
+        //
+        case EEventKeyDown:
+            {				
+			if( iPreviewState == EPlaying )
+				{
+//				iView.SetTrimStateL( CVeiTrimForMmsView::ESeek );
+//				Stop( ETrue );
+				return EKeyWasConsumed;
+				}
+			else
+				{
+				iKeyRepeatCount = 0;
+
+				iMovie.VideoClipSetCutInTime( 0,TTimeIntervalMicroSeconds(0) );
+		    	iMovie.VideoClipSetCutOutTime( 0, iDuration );
+				return EKeyWasConsumed;
+				}
+			}
+        //
+        // The key event
+        //
+        case EEventKey:
+            {
+			if( iPreviewState == EPlaying )
+				{
+				return EKeyWasConsumed;
+				}
+            switch( aKeyEvent.iCode )
+                {
+                //
+                // Navi-key right
+                //
+                case EKeyRightArrow:
+                    {
+					if( iSeekEndPos != iDuration )
+						{
+						iSeekEvent = ETrue;
+						iLastKeyLeftOrRight = ETrue;
+						if(iKeyRepeatCount < 18)
+							{
+							iKeyRepeatCount++;
+							}
+
+						TInt adjustment = TimeIncrement( iKeyRepeatCount );
+						TInt64 newPos = iSeekPos.Int64() + adjustment;
+
+						TTimeIntervalMicroSeconds endTime(0);
+				        iMovie.GetDurationEstimateL( iMaxMmsSize, newPos, endTime );
+						
+						if ( endTime.Int64() >= iDuration.Int64() - adjustment )			
+							{
+							iKeyRepeatCount-=3;
+							adjustment = TimeIncrement( iKeyRepeatCount );						
+							endTime = iDuration;
+							newPos+=adjustment;
+							}
+	
+						iSeekPos = TTimeIntervalMicroSeconds( newPos );
+				
+						iSeekEndPos = endTime;
+						iCutterBar->SetInPoint(iSeekPos);
+						iCutterBar->SetOutPoint(endTime);
+						}
+				
+					return EKeyWasConsumed;
+                    }
+                //
+                // Navi-key left
+                //
+                case EKeyLeftArrow:
+                    {
+					if( iSeekPos.Int64() > 0 )
+						{
+					iSeekEvent = ETrue;
+					iLastKeyLeftOrRight = ETrue;
+                    // Process the command only when repeat count is zero.
+  					iKeyRepeatCount++;
+
+
+					TInt adjustment = TimeIncrement( iKeyRepeatCount );
+
+					TInt64 newPos = iSeekPos.Int64() - adjustment;
+					if ( newPos < 0 ) 
+						{
+						newPos = 0;
+						}
+					iSeekPos = TTimeIntervalMicroSeconds( newPos );	
+
+					TTimeIntervalMicroSeconds endTime(0);
+			        iMovie.GetDurationEstimateL( iMaxMmsSize, newPos, endTime );
+
+					iSeekEndPos = endTime;
+
+					iCutterBar->SetInPoint(iSeekPos);
+					iCutterBar->SetOutPoint(endTime);
+						}
+					return EKeyWasConsumed;
+                    }
+                //
+                // Default
+                //
+                default:
+                    {
+                    return EKeyWasNotConsumed;
+                    }
+                }
+              }
+        //
+        // Key up event
+        //
+
+        case EEventKeyUp:  
+			{
+			if( iPreviewState == EPlaying )
+				{
+				iView.SetTrimStateL( CVeiTrimForMmsView::ESeek );
+		
+				Stop( ETrue );
+				return EKeyWasConsumed;
+				}
+			else
+				{
+				if ( iLastKeyLeftOrRight )
+					{
+					iView.ProcessNeeded( ETrue );
+				    iMovie.VideoClipSetCutInTime( 0, iSeekPos );
+					iMovie.VideoClipSetCutOutTime( 0, iSeekEndPos );
+					iView.UpdateNaviPaneL( iMovie.GetSizeEstimateL()/1024,iMovie.Duration() );
+					iLastKeyLeftOrRight = EFalse;
+					if( iSeekEvent )
+					{
+					StartFrameTakerL( iClipIndex );
+					iSeekEvent = EFalse;
+					}
+					return EKeyWasConsumed;
+					}
+				}
+            break;
+			}
+        //
+        // Default
+        //
+        default:
+            return EKeyWasNotConsumed;
+        }
+		} //iKeyEnable
+	return EKeyWasNotConsumed;  
+    }
+
+
+
+TInt CVeiTrimForMmsContainer::TimeIncrement(TInt aKeyCount) const
+	{
+	if ( aKeyCount < 3 )
+		{
+		return 100000;
+		}
+	else if ( aKeyCount < 6 ) // 4
+		{
+		return 300000;
+		}
+	else if ( aKeyCount < 9 ) // 5
+		{
+		return 500000;
+		}
+	else if ( aKeyCount < 12 ) // 10
+		{
+		return 1000000;
+		}
+	else if ( aKeyCount < 15 ) // 13
+		{
+		return 2000000;
+		}
+	else if ( aKeyCount < 18 ) // 15
+		{
+		return 3000000;
+		}
+	else
+		{
+		return 5000000;
+		}	
+	}
+
+
+void CVeiTrimForMmsContainer::NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo  )
+    {
+	switch (aEvent)
+		{
+		case MVeiVideoDisplayObserver::EOpenComplete:
+			{
+			iVideoDisplay->SetRect( iPreviewRect );
+			if ( !VideoEditorUtils::IsLandscapeScreenOrientation() ) //Portrait
+				{
+				iVideoDisplay->SetRotationL( EVideoRotationClockwise90 );
+				}
+			iPreviewState = ELoading;
+
+			iVideoDisplay->SetPositionL( CutInTime() );
+			iVideoDisplay->PlayL( iMovie.VideoClipInfo( iClipIndex )->FileName(), CutInTime(), CutOutTime() );
+
+			break;
+			}
+
+		case MVeiVideoDisplayObserver::ELoadingComplete:
+			{
+
+			iVideoDisplay->MakeVisible( ETrue );			
+			iPreviewState = EPlaying;
+			break;
+			}
+
+		case MVeiVideoDisplayObserver::EStop:
+			{	
+			iPreviewState = EIdle;
+			iView.SetTrimStateL( CVeiTrimForMmsView::ESeek );
+
+			iVideoDisplay->MakeVisible(EFalse);
+
+			DrawDeferred();			
+			break;
+			}
+		case MVeiVideoDisplayObserver::EPlayComplete:
+			{
+			iView.SetTrimStateL( CVeiTrimForMmsView::ESeek );
+			Stop( ETrue );
+			if (KErrNoMemory == aInfo)
+				{
+				iView.ShowGlobalErrorNoteL( KErrNoMemory );	
+				}
+			break;
+			}
+		default:
+			{
+			break;
+			}
+		}
+    }
+
+
+/**
+ * Called to notify that a new video clip has been successfully
+ * added to the movie. Note that the indices and the start and end times
+ * of the video clips after the new clip have also changed as a result.
+ * Note that the transitions may also have changed. 
+ *
+ * @param aMovie  movie
+ * @param aIndex  index of video clip in movie
+ */
+void CVeiTrimForMmsContainer::NotifyVideoClipAdded( CVedMovie& aMovie, TInt aIndex )
+    {
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsContainer::NotifyVideoClipAdded: in");
+
+	iSeekPos = TTimeIntervalMicroSeconds(0);
+
+	aMovie.GetDurationEstimateL( iMaxMmsSize, iSeekPos, iSeekEndPos );
+	LOGFMT3(KVideoEditorLogFile, "CVeiTrimForMmsContainer::NotifyVideoClipAdded: 1, iMaxMmsSize:%d, iSeekPos:%Ld, iSeekEndPos:%Ld", 
+	iMaxMmsSize, iSeekPos.Int64(), iSeekEndPos.Int64());
+
+	iCutterBar->SetInPoint( iSeekPos );
+	iCutterBar->SetOutPoint( iSeekEndPos );
+	iCutterBar->SetTotalDuration( aMovie.Duration() );
+	iDuration = aMovie.Duration();
+    
+	iClipIndex = aIndex;
+
+    aMovie.VideoClipSetCutInTime( 0, iSeekPos );
+    aMovie.VideoClipSetCutOutTime( 0, iSeekEndPos );
+    
+    TInt movieSizeLimit = static_cast<TInt>(iMaxMmsSize*0.9);
+	aMovie.SetMovieSizeLimit( movieSizeLimit );
+	
+	LOGFMT(KVideoEditorLogFile, "CVeiTrimForMmsContainer::NotifyVideoClipAdded(): 2, movie size set to:%d", movieSizeLimit);
+
+    StartFrameTakerL( iClipIndex );
+
+	iSeekEvent = EFalse;
+
+
+	iView.UpdateNaviPaneL( iMovie.GetSizeEstimateL()/1024,iMovie.Duration() );
+
+	iKeyEnable = ETrue;
+
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsContainer::NotifyVideoClipAdded: out");
+    }
+
+
+void CVeiTrimForMmsContainer::NotifyVideoClipAddingFailed( CVedMovie& /*aMovie*/,
+                                                           TInt /*aError*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyVideoClipRemoved( CVedMovie& /*aMovie*/,
+                                                      TInt /*aIndex*/ )
+    {
+    }
+	
+void CVeiTrimForMmsContainer::NotifyVideoClipIndicesChanged( CVedMovie& /*aMovie*/,
+                                                             TInt /*aOldIndex*/, 
+									                         TInt /*aNewIndex*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyVideoClipTimingsChanged( 
+                                                CVedMovie& /*aMovie*/,
+											    TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyVideoClipColorEffectChanged(
+                                                CVedMovie& /*aMovie*/,
+												TInt /*aIndex*/ )
+    {
+    }
+	
+void CVeiTrimForMmsContainer::NotifyVideoClipAudioSettingsChanged(
+                                                CVedMovie& /*aMovie*/,
+											    TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyVideoClipGeneratorSettingsChanged(
+                                                CVedMovie& /*aMovie*/,
+											    TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyVideoClipDescriptiveNameChanged(
+                                                CVedMovie& /*aMovie*/,
+												TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyStartTransitionEffectChanged(
+                                                CVedMovie& /*aMovie*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsContainer::NotifyMiddleTransitionEffectChanged(
+                                                CVedMovie& /*aMovie*/, 
+											    TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyEndTransitionEffectChanged(
+                                                CVedMovie& /*aMovie*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyAudioClipAdded( CVedMovie& /*aMovie*/,
+                                                    TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyAudioClipAddingFailed( 
+                                                CVedMovie& /*aMovie*/,
+                                                TInt /*aError*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyAudioClipRemoved( CVedMovie& /*aMovie*/,
+                                                      TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyAudioClipIndicesChanged(
+                                                CVedMovie& /*aMovie*/,
+                                                TInt /*aOldIndex*/, 
+									            TInt /*aNewIndex*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyAudioClipTimingsChanged( 
+                                                CVedMovie& /*aMovie*/,
+											    TInt /*aIndex*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyMovieQualityChanged( CVedMovie& /*aMovie*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsContainer::NotifyMovieReseted( CVedMovie& /*aMovie*/ )
+    {
+    }
+
+void CVeiTrimForMmsContainer::NotifyMovieOutputParametersChanged(CVedMovie& /*aMovie*/)
+	{
+	}
+
+void CVeiTrimForMmsContainer::NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, 
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiTrimForMmsContainer::NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiTrimForMmsContainer::NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/,
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiTrimForMmsContainer::NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiTrimForMmsContainer::PlayL( const TDesC& aFilename, const TRect& aRect )
+	{
+	iCutterBar->MakeVisible( EFalse );
+	iVideoDisplayStart->MakeVisible( EFalse );
+	iVideoDisplayEnd->MakeVisible( EFalse );
+	iVideoDisplay->MakeVisible( EFalse );
+
+	iVideoDisplay->ShowBlackScreen();
+
+	iPreviewRect = aRect; 
+	iBlack = ETrue;
+	iScreenLight->Start();
+	
+	iPreviewState = EOpeningFile;
+	iVideoDisplay->OpenFileL( aFilename );
+	}
+
+void CVeiTrimForMmsContainer::Stop( TBool aCloseStream )
+	{
+		iCutterBar->MakeVisible( ETrue );
+		iVideoDisplayStart->MakeVisible( ETrue );
+		iVideoDisplayEnd->MakeVisible( ETrue );
+		iBlack = EFalse;
+		iScreenLight->Stop();
+		iVideoDisplay->Stop( aCloseStream ); 
+		DrawNow();
+	}
+
+void CVeiTrimForMmsContainer::PauseL()
+	{	
+		iPreviewState = EPause;
+		iVideoDisplay->PauseL();
+		iVideoDisplay->MakeVisible(EFalse);
+		DrawNow();
+	}
+
+TInt CVeiTrimForMmsContainer::PreviewState() const
+	{
+	return iPreviewState;
+	}	
+
+void CVeiTrimForMmsContainer::NotifyFramesCompleted( CFbsBitmap* aFirstFrame, 
+									   CFbsBitmap* aLastFrame,  CFbsBitmap* /*aTimelineFrame*/,  TInt aError )
+	{
+	if( aError==KErrNone )
+		{
+		iVideoDisplayStart->ShowPictureL( *aFirstFrame );
+		iVideoDisplayEnd->ShowPictureL( *aLastFrame );
+		}
+
+	if( iProgressNote )
+		{
+		iProgressInfo->SetAndDraw(100);	
+		iProgressNote->ProcessFinishedL();	
+		}
+	}
+
+void CVeiTrimForMmsContainer::StartFrameTakerL( TInt aIndex )
+	{
+	iProgressNote = 
+		new (ELeave) CAknProgressDialog(REINTERPRET_CAST(CEikDialog**, &iProgressNote), ETrue);
+	iProgressNote->SetCallback(this);
+	iProgressNote->ExecuteDlgLD( R_VEI_PROGRESS_NOTE );
+
+	HBufC* stringholder;
+	stringholder = StringLoader::LoadL( R_VEI_PROGRESS_NOTE_PROCESSING, iEikonEnv );
+	CleanupStack::PushL( stringholder );
+	iProgressNote->SetTextL( *stringholder );
+	CleanupStack::PopAndDestroy( stringholder );	
+
+	iProgressInfo = iProgressNote->GetProgressInfoL();
+	iProgressInfo->SetFinalValue(100);
+	iProgressInfo->SetAndDraw(50);	
+
+// First frame is shown in main display so it is bigger.. Last frame is always
+// on transition display and one frame for the video timeline.
+	TSize firstThumbResolution = iVideoDisplayStart->GetScreenSize();
+	TSize lastThumbResolution = iVideoDisplayEnd->GetScreenSize();
+    TSize timelineThumbResolution = TSize( 34, 28 );
+	 
+	TInt frameCount = iMovie.VideoClipInfo(aIndex)->VideoFrameCount();
+
+	TInt firstThumbNailIndex =  iMovie.VideoClipInfo(aIndex)->GetVideoFrameIndexL( CutInTime() );	
+	TInt lastThumbNailIndex =  iMovie.VideoClipInfo(aIndex)->GetVideoFrameIndexL( CutOutTime() );    
+	if ( lastThumbNailIndex >= frameCount )
+		{
+		lastThumbNailIndex = frameCount-1;
+		}
+
+
+	iFrameTaker->GetFramesL( *iMovie.VideoClipInfo(aIndex), 
+			firstThumbNailIndex, &firstThumbResolution,
+			lastThumbNailIndex, &lastThumbResolution, 
+            firstThumbNailIndex, &timelineThumbResolution,
+			EPriorityLow );
+	}
+
+TTypeUid::Ptr CVeiTrimForMmsContainer::MopSupplyObject( TTypeUid aId )
+	{
+	if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext )
+		{
+		return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+		}
+	return CCoeControl::MopSupplyObject( aId );
+	}
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/TrimForMms/src/VeiTrimForMmsView.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,964 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+// INCLUDES
+// System includes
+#include <aknviewappui.h>
+#include <akntitle.h>
+#include <aknnavi.h>        // CAknNavigationControlContainer
+#include <aknnavide.h>      // CAknNavigationDecorator
+#include <AknProgressDialog.h>      // CAknProgressDialog
+#include <aknsoundsystem.h>         // CAknKeySoundSystem
+#include <bautils.h>        // BaflUtils
+#include <barsread.h>
+#include <eikprogi.h>       // CEikProgressInfo
+#include <trimformms.rsg>
+#include <utf.h>        // CnvUtfConverter
+#include <sendui.h>     // CSendAppUi
+#include <SenduiMtmUids.h>
+#include <StringLoader.h>   // StringLoader 
+#include <CMessageData.h>
+// User includes
+#include "TrimForMms.hrh"
+#include "TrimForMmsAppUi.h"
+#include "VeiSettings.h"
+#include "VeiTrimForMmsView.h"
+#include "VeiTrimForMmsContainer.h"
+#include "VeiEditVideoLabelNavi.h"
+#include "VideoEditorCommon.h"
+#include "VeiTempMaker.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorDebugUtils.h"
+#include "VeiErrorUi.h"
+
+// CONSTANTS
+const TInt KVedVideoClipIndex(0);
+const TInt KProgressNoteMaxValue(100);
+const TInt KVedTrimForMmsDefaultCba( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+
+
+CVeiTrimForMmsView* CVeiTrimForMmsView::NewL( CSendUi& aSendAppUi )
+	{
+    CVeiTrimForMmsView* self = CVeiTrimForMmsView::NewLC( aSendAppUi );
+    CleanupStack::Pop( self );
+
+    return self;
+	}
+
+
+CVeiTrimForMmsView* CVeiTrimForMmsView::NewLC( CSendUi& aSendAppUi )
+	{
+    CVeiTrimForMmsView* self = new (ELeave) CVeiTrimForMmsView( aSendAppUi );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CVeiTrimForMmsView::ConstructL
+// Symbian 2nd phase constructor that can leave.
+// -----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::ConstructL()
+    {
+    BaseConstructL( R_VEI_TRIM_FOR_MMS_VIEW );
+
+    iErrorUi = CVeiErrorUI::NewL( *iCoeEnv );
+
+	iTempMaker = CVeiTempMaker::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CVeiTrimForMmsView::CVeiTrimForMmsView( CSendUi& aSendAppUi )
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+CVeiTrimForMmsView::CVeiTrimForMmsView( CSendUi& aSendAppUi ):
+    iSendAppUi( aSendAppUi )
+    {
+    }
+
+
+CVeiTrimForMmsView::~CVeiTrimForMmsView()
+    {
+    if( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        }
+    if( iNaviDecorator )
+        {
+        delete iNaviDecorator;
+        }
+
+    if( iVedMovie )
+        {
+		iVedMovie->UnregisterMovieObserver( this );
+        delete iVedMovie;
+        }
+
+	if ( iTempMaker )
+		{
+		delete iTempMaker;
+		iTempMaker = NULL;
+		}
+	if( iTempFile )
+        {
+		TInt err = CCoeEnv::Static()->FsSession().Delete( *iTempFile );
+		if ( err ) 
+			{
+			// what to do when error occurs in destructor???
+			}
+
+        delete iTempFile;
+        }
+	
+    delete iErrorUi;
+    
+    iProgressInfo = NULL;
+    }
+
+
+TUid CVeiTrimForMmsView::Id() const
+    {
+    return TUid::Uid( EVeiTrimForMmsView );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::HandleCommandL( TInt aCommand )
+//
+//  
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::HandleCommandL( TInt aCommand )
+    {
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::HandleCommandL: In");
+	
+	TInt state;
+	state = iContainer->PreviewState();
+
+    switch ( aCommand )
+        {
+        /**
+         * Options -> Send via multimedia
+         */
+        case EVeiCmdSendViaMms:
+            {
+            CmdSendViaMultimediaL();
+            break;
+            }
+        /**
+         * Options -> Preview
+         */
+        case EVeiCmdPreview:
+            {		
+			if(	state == EIdle || state == EStop ) 
+				{
+				SetTrimStateL( EFullPreview );
+				PlayPreviewL();
+				}
+            break;
+            }
+        //
+        // Options -> Help
+        //
+        case EVeiCmdTrimForMmsViewHelp:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        /**
+         * Options -> Back
+         */
+        case EAknSoftkeyBack:
+            {
+			if( state != EFullPreview )
+				{
+				CmdSoftkeyBackL();
+				}
+			else
+				{
+				SetTrimStateL( ESeek );
+				}
+            break;
+            }
+        /**
+         * Adjust video length -> Ok
+         */
+        case EAknSoftkeyOk:
+            {
+			if( state == EPause )
+				{
+				SetTrimStateL( ESeek );
+				iContainer->Stop( ETrue );
+				}
+			else
+				{	
+				CmdSoftkeyOkL();  
+				}
+            break;
+            }
+        /**
+         * Adjust video length -> Cancel
+         */
+        case EAknSoftkeyCancel:
+            {
+			if( state == EPause )
+				{
+				SetTrimStateL( ESeek );
+				iContainer->Stop( ETrue );
+				}
+			else
+				{	
+				CmdSoftkeyCancelL();
+				}
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::HandleCommandL: Out");
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::CmdSendViaMultimediaL()
+//  Function for handling the Send Via Multimedia command.
+//  
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::CmdSendViaMultimediaL()
+    {
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: In");
+
+        // Start processing the trimmed video
+	    // Possible leave codes:
+	    //	- KErrNoMemory if memory allocation fails
+	    //	- KErrAccessDenied if the file access is denied
+	    //	- KErrDiskFull if the disk is full
+	    //	- KErrWrite if not all data could be written
+	    //	- KErrBadName if the filename is bad
+	    //  - KErrDirFull if the directory is full
+        // : If video clip is already processed and frame is in same position
+        //       do not reprocess the movie.
+
+
+	UpdateNaviPaneSize();
+
+	TBool fileExists( ETrue );
+	RFs	fs = CCoeEnv::Static()->FsSession();
+
+	if ( iTempFile )
+		{
+		fileExists = BaflUtils::FileExists( fs, *iTempFile );
+		}
+
+	if ( !fileExists || ( !iTempFile  ) || iProcessNeeded )
+		{
+
+		if ( iTempFile && fileExists )
+			{
+			User::LeaveIfError( fs.Delete( *iTempFile ) );
+			delete iTempFile;
+			iTempFile = NULL;
+			}
+
+		iTempFile = HBufC::NewL(KMaxFileName);
+
+// @: check the quality setting. should we set it here to MMS compatible?
+
+		// Quality is taken from settings and set to engine.
+		ReadSettingsL( iMovieSaveSettings );
+
+		iTempMaker->GenerateTempFileName( *iTempFile, iMovieSaveSettings.MemoryInUse(), iVedMovie->Format() );
+
+		TEntry fileinfo;
+		// Rename movie from xxxx.$$$ to defaultfilename from settingsview.
+		// looks better in attachment list..
+
+		// Get default movie name from settings view
+		TPtr temppeet = iTempFile->Des();
+		TParse parse;
+
+		parse.Set( iMovieSaveSettings.DefaultVideoName(), &temppeet, NULL );
+
+		TFileName orgPathAndName = parse.FullName();
+		
+//		TVedVideoFormat movieQuality = iVedMovie->Format();
+		
+		orgPathAndName.Replace( orgPathAndName.Length()-4, 4, KExt3gp );
+
+		fs.Replace( *iTempFile, orgPathAndName );
+		iTempFile->Des() = orgPathAndName;
+		fs.Entry( *iTempFile, fileinfo );
+
+				
+		iVedMovie->SetQuality( CVedMovie::EQualityMMSInteroperability );
+		LOGFMT(KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: 1, iTempFile:%S", iTempFile);
+        TRAPD( processError, iVedMovie->ProcessL( *iTempFile, *this ) );
+		LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: 2");
+        if( processError == KErrNone )
+            {
+            // Text for the progress note is loaded from TBUF resource
+            HBufC* noteText;
+            noteText = StringLoader::LoadLC( R_VED_PROCESSING_FOR_MMS, iEikonEnv );
+
+            // Construct and execute progress note.
+            iProgressNote = new(ELeave) CAknProgressDialog( REINTERPRET_CAST(CEikDialog**, 
+                                                             &iProgressNote), ETrue);
+			iProgressNote->PrepareLC( R_VEI_PROGRESS_NOTE );
+            iProgressNote->SetTextL( *noteText );
+            
+            iProgressInfo = iProgressNote->GetProgressInfoL();
+			iProgressInfo->SetFinalValue( KProgressNoteMaxValue );
+            
+            iProgressNote->RunLD(); 
+
+            CleanupStack::PopAndDestroy( noteText );    // Pop and destroy the text
+            }
+            else 
+            {
+            // : add error handling here
+            }
+
+        }
+    else
+        {
+        
+		RFs shareFServer;
+	   	LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: shareFServer connect.");
+
+	 	User::LeaveIfError(shareFServer.Connect());
+	    shareFServer.ShareProtected();
+		
+		RFile openFileHandle;
+    	
+		TInt err = openFileHandle.Open(shareFServer,*iTempFile,EFileRead|EFileShareReadersOnly);
+		if (KErrNone != err)
+			{
+			LOGFMT(KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: Could not open file %S with EFileShareReadersOnly. Trying EFileShareAny", iTempFile);
+			User::LeaveIfError( openFileHandle.Open (shareFServer, *iTempFile, EFileRead|EFileShareAny) );
+			}
+		 
+		CMessageData* messageData = CMessageData::NewLC();	
+		 
+		 
+		messageData->AppendAttachmentHandleL( openFileHandle );
+
+		iSendAppUi.CreateAndSendMessageL( KSenduiMtmMmsUid, messageData, KNullUid, EFalse );	
+		
+		CleanupStack::PopAndDestroy( messageData );
+		 
+        shareFServer.Close();
+	   	LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: shareFServer closed.");
+        }
+
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::CmdSendViaMultimediaL: Out");
+    }
+
+void CVeiTrimForMmsView::CmdSoftkeyBackL()
+    {
+    // Compare previous view's application uid to video editor uid.
+    if( iPreviousViewId.iAppUid == KUidVideoEditor )
+        {
+	    CEikStatusPane* statusPane = AppUi()->StatusPane();
+	    TUid naviPaneUid = TUid::Uid( EEikStatusPaneUidNavi );  // Navi pane UID
+
+        CAknNavigationControlContainer *naviContainer = (CAknNavigationControlContainer*)statusPane->ControlL( naviPaneUid );
+        naviContainer->Pop( iNaviDecorator );
+        
+        // Activate previous local view.
+        AppUi()->ActivateLocalViewL( iPreviousViewId.iViewUid );
+        }
+    else
+        {
+        // Exit video editor
+        AppUi()->HandleCommandL( EEikCmdExit);
+        }
+    }
+
+
+void CVeiTrimForMmsView::CmdSoftkeyOkL()
+    {
+    // Set CBA labels back to view default
+    Cba()->SetCommandSetL( KVedTrimForMmsDefaultCba );
+    Cba()->DrawDeferred();
+
+    PushKeySoundL( R_VED_LEFT_RIGHT_SILENT_SKEY_LIST );
+    }
+
+
+void CVeiTrimForMmsView::CmdSoftkeyCancelL()
+    {
+    // Set CBA labels back to view default
+    Cba()->SetCommandSetL( KVedTrimForMmsDefaultCba );
+    Cba()->DrawDeferred();
+
+    PushKeySoundL( R_VED_LEFT_RIGHT_SILENT_SKEY_LIST );
+    }
+
+
+void CVeiTrimForMmsView::DoActivateL( const TVwsViewId& aPrevViewId,
+                                        TUid /*aCustomMessageId*/,
+                                        const TDesC8& aCustomMessage )
+    {
+    if( !iContainer ) 
+        {
+        iPreviousViewId = aPrevViewId;  // Save the previous view id
+
+        // Disable left and right navi-key sounds
+        PushKeySoundL( R_VED_LEFT_RIGHT_SILENT_SKEY_LIST );
+
+        SetTitlePaneTextL();
+        CreateNaviPaneL();
+		
+        STATIC_CAST( CVeiEditVideoLabelNavi*, iNaviDecorator->DecoratedControl() )->SetState( CVeiEditVideoLabelNavi::EStateTrimForMmsView );
+        
+        TFileName inputFileName;
+       	CnvUtfConverter::ConvertToUnicodeFromUtf8( inputFileName, aCustomMessage );
+
+
+		// TEST
+		if (inputFileName.Length() == 0)
+			{
+			inputFileName.Copy( _L("c:\\Data\\Videos\\test.mp4") );
+			}
+		// END TEST
+
+    
+        if( !iVedMovie )
+            {
+            iVedMovie = CVedMovie::NewL( NULL );
+            iVedMovie->RegisterMovieObserverL( this );
+            iVedMovie->InsertVideoClipL( inputFileName, KVedVideoClipIndex );
+			iVedMovie->SetQuality( CVedMovie::EQualityMMSInteroperability );
+            }
+
+        iContainer = CVeiTrimForMmsContainer::NewL( AppUi()->ClientRect(),
+                                                    *iVedMovie, *this );
+        iContainer->SetMopParent( this );
+        
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    }
+
+
+void CVeiTrimForMmsView::DoDeactivate()
+    {
+    if( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        iContainer = NULL;
+
+        if( iVedMovie )
+            {
+            iVedMovie->Reset();
+            iVedMovie->UnregisterMovieObserver( this );
+             delete iVedMovie;
+            iVedMovie = NULL;
+            }
+        }
+    }
+
+
+void CVeiTrimForMmsView::PushKeySoundL( const TInt aResourceId ) const
+    {
+    CAknKeySoundSystem* aknKeySoundSystem = AppUi()->KeySounds();
+    aknKeySoundSystem->PushContextL( aResourceId );
+    }
+
+
+void CVeiTrimForMmsView::PopKeySound() const
+    {
+    AppUi()->KeySounds()->PopContext();
+    }
+
+
+void CVeiTrimForMmsView::SetTitlePaneTextL() const
+    {
+    TUid titleUid;
+    titleUid.iUid = EEikStatusPaneUidTitle;
+
+    CEikStatusPane* statusPane = AppUi()->StatusPane();
+
+    CEikStatusPaneBase::TPaneCapabilities titlePaneCap = 
+        statusPane->PaneCapabilities( titleUid );
+
+    if( titlePaneCap.IsPresent() && titlePaneCap.IsAppOwned() )
+        {
+        CAknTitlePane* titlePane = 
+            (CAknTitlePane*)statusPane->ControlL( titleUid );
+
+		TResourceReader reader;
+		iCoeEnv->CreateResourceReaderLC( reader,
+            R_VEI_TRIM_FOR_MMS_VIEW_TITLE_NAME );
+		titlePane->SetFromResourceL( reader );
+
+        CleanupStack::PopAndDestroy(); //reader
+        }
+
+    }
+
+
+void CVeiTrimForMmsView::CreateNaviPaneL()
+    {
+    TUid naviPaneUid = TUid::Uid( EEikStatusPaneUidNavi );  // Navi pane UID
+
+    CEikStatusPane* statusPane = AppUi()->StatusPane();     // Get status pane
+
+    CEikStatusPaneBase::TPaneCapabilities naviPaneCap =
+        statusPane->PaneCapabilities( naviPaneUid );
+
+    if( naviPaneCap.IsPresent() && naviPaneCap.IsAppOwned() )
+        {
+        CAknNavigationControlContainer *naviContainer = (CAknNavigationControlContainer*)statusPane->ControlL( naviPaneUid );
+        
+        CVeiEditVideoLabelNavi* editvideolabelnavi = CVeiEditVideoLabelNavi::NewLC();
+        editvideolabelnavi->SetState( CVeiEditVideoLabelNavi::EStateInitializing );
+
+        iNaviDecorator = 
+            CAknNavigationDecorator::NewL( naviContainer, editvideolabelnavi,
+                                       CAknNavigationDecorator::ENotSpecified );
+        CleanupStack::Pop( editvideolabelnavi );
+
+        iNaviDecorator->SetContainerWindowL( *naviContainer );		
+	    iNaviDecorator->MakeScrollButtonVisible( EFalse );
+
+        naviContainer->PushL( *iNaviDecorator );
+ 
+        }
+    }
+
+void CVeiTrimForMmsView::UpdateNaviPaneSize()
+    {
+    if( iContainer )
+        {
+        iVedMovie->VideoClipSetCutInTime( KVedVideoClipIndex, iContainer->CutInTime() );
+        iVedMovie->VideoClipSetCutOutTime( KVedVideoClipIndex, iContainer->CutOutTime() );
+        }
+    }
+void CVeiTrimForMmsView::SetNaviPaneSizeLabelL( const TInt& aSizeInBytes )
+    {
+    STATIC_CAST(CVeiEditVideoLabelNavi*,
+        iNaviDecorator->DecoratedControl())->SetSizeLabelL( aSizeInBytes );
+    }
+
+
+void CVeiTrimForMmsView::SetNaviPaneDurationLabelL(
+                                    const TTimeIntervalMicroSeconds& aTime )
+    {
+    STATIC_CAST(CVeiEditVideoLabelNavi*, 
+       iNaviDecorator->DecoratedControl())->SetDurationLabelL( aTime.Int64() );
+    }
+
+void CVeiTrimForMmsView::UpdateNaviPaneL( const TInt& aSizeInBytes, 
+								const TTimeIntervalMicroSeconds& aTime )
+	{ 
+	TInt maxMmsSize = STATIC_CAST( CVeiEditVideoLabelNavi*, iNaviDecorator->DecoratedControl() )->GetMaxMmsSize();
+
+		// Navipanes MMS icon control. 
+	if( aSizeInBytes < maxMmsSize )
+		{
+		STATIC_CAST( CVeiEditVideoLabelNavi*, iNaviDecorator->DecoratedControl() )->SetMmsAvailableL( ETrue );
+		}
+	else 
+		{
+		STATIC_CAST( CVeiEditVideoLabelNavi*, iNaviDecorator->DecoratedControl() )->SetMmsAvailableL( EFalse );
+		}
+
+    STATIC_CAST(CVeiEditVideoLabelNavi*,
+        iNaviDecorator->DecoratedControl())->SetSizeLabelL( aSizeInBytes );
+	
+    STATIC_CAST(CVeiEditVideoLabelNavi*, 
+       iNaviDecorator->DecoratedControl())->SetDurationLabelL( aTime.Int64() );
+ 	}
+
+void CVeiTrimForMmsView::HandleResourceChange(TInt aType)
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiTrimForMmsView::HandleResourceChange() In, aType:%d", aType);
+    
+    if (KAknsMessageSkinChange == aType && iNaviDecorator)
+        {
+        // Handle skin change in the navi label controls - they do not receive 
+        // it automatically since they are not in the control stack
+        CCoeControl* navi = iNaviDecorator->DecoratedControl();
+        if (navi)
+        	{
+        	navi->HandleResourceChange( aType );
+        	}
+        }
+    
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::HandleResourceChange() Out");
+    }
+
+// ============= MVedMovieProcessingObserver FUNCTIONS START ==================
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::NotifyMovieProcessingStartedL( CVedMovie& aMovie )
+//
+// Called to notify that a new movie processing operation has been started.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::NotifyMovieProcessingStartedL( CVedMovie& /*aMovie*/ )
+    {
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::NotifyMovieProcessingProgressed( CVedMovie& aMovie,
+//                                                      TInt aPercentage )
+//
+// Called to inform about the current progress of the movie processing
+// operation.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::NotifyMovieProcessingProgressed( CVedMovie&/*aMovie*/,
+                                                         TInt aPercentage )
+    {
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingProgressed(): In");
+
+    // Increment the progress bar.
+    iProgressInfo->SetAndDraw( aPercentage );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::NotifyMovieProcessingCompleted( CVedMovie& aMovie,
+//                                                     TInt aError )
+//
+// Called to notify that the movie processing operation has been completed.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::NotifyMovieProcessingCompleted( CVedMovie& /*aMovie*/,
+                                                        TInt aError )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingCompleted(): In, aError:%d", aError);
+
+	if( !aError )
+		{
+		ProcessNeeded( EFalse );
+		}
+
+    __ASSERT_ALWAYS( iProgressNote, User::Panic(_L("CVeiTrimForMmsView"),1) );
+
+	// Draw the progress bar to 100%.
+    iProgressInfo->SetAndDraw( 100 );
+
+    // Delete the note.
+    TRAP_IGNORE( iProgressNote->ProcessFinishedL() );
+
+	RFs shareFServer;
+	LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingCompleted: shareFServer connect.");
+
+	User::LeaveIfError(shareFServer.Connect());
+	shareFServer.ShareProtected();
+		
+	RFile openFileHandle;
+
+	TInt err = openFileHandle.Open(shareFServer,*iTempFile,EFileRead|EFileShareReadersOnly);
+	if (KErrNone != err)
+		{
+		LOGFMT(KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingCompleted: Could not open file %S with EFileShareReadersOnly. Trying EFileShareAny", iTempFile);
+		User::LeaveIfError( openFileHandle.Open (shareFServer, *iTempFile, EFileRead|EFileShareAny) );
+		}
+
+	CMessageData* messageData = CMessageData::NewLC();	
+	messageData->AppendAttachmentHandleL( openFileHandle );
+
+	iSendAppUi.CreateAndSendMessageL( KSenduiMtmMmsUid, messageData, KNullUid, EFalse );	
+		
+	CleanupStack::PopAndDestroy( messageData );
+		 
+    shareFServer.Close();
+
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingCompleted: shareFServer closed.");
+	LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyMovieProcessingCompleted(): Out");
+    }
+
+// ============== MVedMovieProcessingObserver FUNCTIONS END ===================
+
+
+/**
+ * Called to notify that a new video clip has been successfully
+ * added to the movie. Note that the indices and the start and end times
+ * of the video clips after the new clip have also changed as a result.
+ * Note that the transitions may also have changed. 
+ *
+ * @param aMovie  movie
+ * @param aIndex  index of video clip in movie
+ */
+void CVeiTrimForMmsView::NotifyVideoClipAdded( CVedMovie& /*aMovie*/,
+                                               TInt /*aIndex*/ )
+    {
+		ProcessNeeded( ETrue );
+    }
+
+
+/**
+ * Called to notify that adding a new video clip to the movie has failed.
+ *
+ * Possible error codes:
+ *	- <code>KErrNotFound</code> if there is no file with the specified name
+ *    in the specified directory (but the directory exists)
+ *	- <code>KErrPathNotFound</code> if the specified directory
+ *    does not exist
+ *	- <code>KErrUnknown</code> if the specified file is of unknown format
+ *	- <code>KErrNotSupported</code> if the format of the file is recognized but
+ *    adding it to the movie is not supported (e.g., it is of different resolution
+ *    or format than the other clips)
+ *
+ * @param aMovie  movie
+ * @param aError  one of the system wide error codes
+ */
+void CVeiTrimForMmsView::NotifyVideoClipAddingFailed( CVedMovie& /*aMovie*/, 
+                                                      TInt /*aError*/ )
+    {
+    User::Panic( _L("MmsView"), 20 );
+    }
+
+
+void CVeiTrimForMmsView::NotifyVideoClipRemoved( CVedMovie& /*aMovie*/, 
+                                                 TInt /*aIndex*/ )
+    {
+    }
+	
+
+void CVeiTrimForMmsView::NotifyVideoClipIndicesChanged( CVedMovie& /*aMovie*/,
+                                                        TInt /*aOldIndex*/, 
+									                    TInt /*aNewIndex*/ )
+    {
+    }
+
+
+// ----------------------------------------------------------------------------
+// CVeiTrimForMmsView::NotifyVideoClipTimingsChanged( CVedMovie& aMovie, 
+//                                                    TInt aIndex )
+//
+// Called to notify that the timings (that is, the cut in or cut out time or
+// the speed and consequently the end time, edited duration, and possibly audio
+// settings) of a video clip have changed (but the index of the clip has 
+// not changed). Note that the start and end times of the video clips 
+// after the changed clip have also changed.
+// ----------------------------------------------------------------------------
+//
+void CVeiTrimForMmsView::NotifyVideoClipTimingsChanged( CVedMovie& /*aMovie*/,
+            										    TInt /*aIndex*/ )
+    {
+    LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::NotifyVideoClipTimingsChanged()");
+    }
+
+
+void CVeiTrimForMmsView::NotifyVideoClipColorEffectChanged( CVedMovie& /*aMovie*/,
+												   TInt /*aIndex*/ )
+    {
+    }
+
+	
+void CVeiTrimForMmsView::NotifyVideoClipAudioSettingsChanged( CVedMovie& /*aMovie*/,
+											         TInt /*aIndex*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsView::NotifyVideoClipGeneratorSettingsChanged( CVedMovie& /*aMovie*/,
+											             TInt /*aIndex*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsView::NotifyVideoClipDescriptiveNameChanged( CVedMovie& /*aMovie*/,
+																TInt /*aIndex*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsView::NotifyStartTransitionEffectChanged( CVedMovie& /*aMovie*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsView::NotifyMiddleTransitionEffectChanged( CVedMovie& /*aMovie*/, 
+													 TInt /*aIndex*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsView::NotifyEndTransitionEffectChanged( CVedMovie& /*aMovie*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsView::NotifyAudioClipAdded( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsView::NotifyAudioClipAddingFailed( CVedMovie& /*aMovie*/, TInt /*aError*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsView::NotifyAudioClipRemoved( CVedMovie& /*aMovie*/, TInt /*aIndex*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsView::NotifyAudioClipIndicesChanged( CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, 
+									           TInt /*aNewIndex*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsView::NotifyAudioClipTimingsChanged( CVedMovie& /*aMovie*/,
+											   TInt /*aIndex*/ )
+    {
+    }
+
+
+void CVeiTrimForMmsView::NotifyMovieQualityChanged( CVedMovie& /*aMovie*/ )
+    {
+    }
+
+void CVeiTrimForMmsView::NotifyMovieReseted(CVedMovie& /*aMovie*/ )
+    {
+    }
+
+void CVeiTrimForMmsView::NotifyMovieOutputParametersChanged(CVedMovie& /*aMovie*/)
+	{
+	}
+
+void CVeiTrimForMmsView::NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, 
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiTrimForMmsView::NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiTrimForMmsView::NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/,
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiTrimForMmsView::NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+	{
+	}
+
+void CVeiTrimForMmsView::PlayPreviewL()
+	{
+	TRect rect( AppUi()->ApplicationRect() );
+	iContainer->SetRect( rect );
+	
+	iContainer->PlayL( iVedMovie->VideoClipInfo( 0 )->FileName(), rect  );
+	}
+
+void CVeiTrimForMmsView::HandleStatusPaneSizeChange()
+	{
+	if ( iContainer )
+		{
+		iContainer->SetRect( AppUi()->ClientRect() );
+		}
+
+	}
+void CVeiTrimForMmsView::SetTrimStateL( TTrimState aState )
+	{
+	iTrimState = aState;
+	CEikStatusPane *statusPane;
+	CAknTitlePane* titlePane;
+
+	TResourceReader reader1;
+
+	switch ( iTrimState )
+        {
+	case EFullPreview:		               
+
+			Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
+ 			Cba()->DrawDeferred();
+			
+			break;
+
+		case ESeek:
+			iContainer->SetRect( AppUi()->ClientRect() );
+			statusPane = ( ( CAknAppUi* )iEikonEnv->EikAppUi() )->StatusPane(); 
+	
+			titlePane = (CAknTitlePane*) statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) );
+   			iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_TRIM_FOR_MMS_VIEW_TITLE_NAME );
+			titlePane->SetFromResourceL( reader1 );
+			CleanupStack::PopAndDestroy(); //reader1
+			
+			Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+ 			Cba()->DrawDeferred();
+			
+			break;
+			
+		default:
+			{
+			break;
+			}
+
+		}
+	}
+
+void CVeiTrimForMmsView::DialogDismissedL( TInt aButtonId )
+	{
+	if ( aButtonId != EAknSoftkeyDone )
+		{	
+		iVedMovie->CancelProcessing();        
+        }
+    iProgressInfo = NULL;
+	}
+
+void CVeiTrimForMmsView::ProcessNeeded( TBool aProcessNeed )
+	{
+	iProcessNeeded = aProcessNeed;
+	}
+
+void CVeiTrimForMmsView::ShowGlobalErrorNoteL( const TInt aError ) const
+	{	
+	iErrorUi->ShowGlobalErrorNote( aError );
+	}	
+
+//=============================================================================
+void CVeiTrimForMmsView::ReadSettingsL( TVeiSettings& aSettings ) const
+	{
+	LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::ReadSettingsL: in");
+
+	STATIC_CAST( CTrimForMmsAppUi*, AppUi() )->ReadSettingsL( aSettings );
+
+	LOG(KVideoEditorLogFile, "CVeiTrimForMmsView::ReadSettingsL: out");
+	}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/BWINS/VideoEditorCommon.DEF	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,129 @@
+EXPORTS
+	??1CLogFile@@UAE@XZ @ 1 NONAME ; CLogFile::~CLogFile(void)
+	??1CVeiAddQueue@@UAE@XZ @ 2 NONAME ; CVeiAddQueue::~CVeiAddQueue(void)
+	??1CVeiImageClipGenerator@@UAE@XZ @ 3 NONAME ; CVeiImageClipGenerator::~CVeiImageClipGenerator(void)
+	??1CVeiImageConverter@@UAE@XZ @ 4 NONAME ; CVeiImageConverter::~CVeiImageConverter(void)
+	??1CVeiMGFetchVerifier@@UAE@XZ @ 5 NONAME ; CVeiMGFetchVerifier::~CVeiMGFetchVerifier(void)
+	??1CVeiTempMaker@@UAE@XZ @ 6 NONAME ; CVeiTempMaker::~CVeiTempMaker(void)
+	??1CVeiTitleClipGenerator@@UAE@XZ @ 7 NONAME ; CVeiTitleClipGenerator::~CVeiTitleClipGenerator(void)
+	?AddMediaFileToMGAlbumL@VideoEditorUtils@@SAXABVTDesC16@@H@Z @ 8 NONAME ; void VideoEditorUtils::AddMediaFileToMGAlbumL(class TDesC16 const &, int)
+	?BackgroundColor@CVeiImageClipGenerator@@QBEABVTRgb@@XZ @ 9 NONAME ; class TRgb const & CVeiImageClipGenerator::BackgroundColor(void) const
+	?BackgroundColor@CVeiTitleClipGenerator@@QBE?AVTRgb@@XZ @ 10 NONAME ; class TRgb CVeiTitleClipGenerator::BackgroundColor(void) const
+	?BackgroundImage@CVeiTitleClipGenerator@@QBEPAVCFbsBitmap@@XZ @ 11 NONAME ; class CFbsBitmap * CVeiTitleClipGenerator::BackgroundImage(void) const
+	?CancelEncoding@CVeiImageConverter@@QAEXXZ @ 12 NONAME ; void CVeiImageConverter::CancelEncoding(void)
+	?CancelFrame@CVeiImageClipGenerator@@UAEXXZ @ 13 NONAME ; void CVeiImageClipGenerator::CancelFrame(void)
+	?CancelFrame@CVeiTitleClipGenerator@@UAEXXZ @ 14 NONAME ; void CVeiTitleClipGenerator::CancelFrame(void)
+	?Count@CVeiAddQueue@@QBEHXZ @ 15 NONAME ; int CVeiAddQueue::Count(void) const
+	?DefaultSnapshotName@TVeiSettings@@QAEAAVTDes16@@XZ @ 16 NONAME ; class TDes16 & TVeiSettings::DefaultSnapshotName(void)
+	?DefaultSnapshotName@TVeiSettings@@QBE?AVTPtrC16@@XZ @ 17 NONAME ; class TPtrC16 TVeiSettings::DefaultSnapshotName(void) const
+	?DefaultVideoName@TVeiSettings@@QAEAAVTDes16@@XZ @ 18 NONAME ; class TDes16 & TVeiSettings::DefaultVideoName(void)
+	?DefaultVideoName@TVeiSettings@@QBE?AVTPtrC16@@XZ @ 19 NONAME ; class TPtrC16 TVeiSettings::DefaultVideoName(void) const
+	?DescriptiveName@CVeiImageClipGenerator@@UBE?AVTPtrC16@@XZ @ 20 NONAME ; class TPtrC16 CVeiImageClipGenerator::DescriptiveName(void) const
+	?DescriptiveName@CVeiTitleClipGenerator@@UBE?AVTPtrC16@@XZ @ 21 NONAME ; class TPtrC16 CVeiTitleClipGenerator::DescriptiveName(void) const
+	?Duration@CVeiImageClipGenerator@@UBE?AVTTimeIntervalMicroSeconds@@XZ @ 22 NONAME ; class TTimeIntervalMicroSeconds CVeiImageClipGenerator::Duration(void) const
+	?Duration@CVeiTitleClipGenerator@@UBE?AVTTimeIntervalMicroSeconds@@XZ @ 23 NONAME ; class TTimeIntervalMicroSeconds CVeiTitleClipGenerator::Duration(void) const
+	?EmptyTempFolder@CVeiTempMaker@@QBEXXZ @ 24 NONAME ; void CVeiTempMaker::EmptyTempFolder(void) const
+	?ExternalizeL@TVeiSettings@@QBEXAAVRWriteStream@@@Z @ 25 NONAME ; void TVeiSettings::ExternalizeL(class RWriteStream &) const
+	?FinishGetFrameL@CVeiTitleClipGenerator@@AAEPAVCFbsBitmap@@H@Z @ 26 NONAME ; class CFbsBitmap * CVeiTitleClipGenerator::FinishGetFrameL(int)
+	?GenerateFileNameL@VideoEditorUtils@@SAHAAVRFs@@ABVTDesC16@@AAVTDes16@@W4TVedVideoFormat@@HV?$TBuf@$0BAA@@@@Z @ 27 NONAME ; int VideoEditorUtils::GenerateFileNameL(class RFs &, class TDesC16 const &, class TDes16 &, enum TVedVideoFormat, int, class TBuf<256>)
+	?GenerateNewDocumentNameL@VideoEditorUtils@@SAHAAVRFs@@ABVTDesC16@@AAVTDes16@@W4TVedVideoFormat@@HW4TMemory@VideoEditor@@@Z @ 28 NONAME ; int VideoEditorUtils::GenerateNewDocumentNameL(class RFs &, class TDesC16 const &, class TDes16 &, enum TVedVideoFormat, int, enum VideoEditor::TMemory)
+	?GenerateTempFileName@CVeiTempMaker@@QBEXAAVHBufC16@@W4TMemory@CAknMemorySelectionDialog@@W4TVedVideoFormat@@H@Z @ 29 NONAME ; void CVeiTempMaker::GenerateTempFileName(class HBufC16 &, enum CAknMemorySelectionDialog::TMemory, enum TVedVideoFormat, int) const
+	?GetBitmap@CVeiImageConverter@@QAEPAVCFbsBitmap@@XZ @ 30 NONAME ; class CFbsBitmap * CVeiImageConverter::GetBitmap(void)
+	?GetEncoderImageTypesL@CVeiImageConverter@@SAXAAV?$RPointerArray@VCImageTypeDescription@@@@@Z @ 31 NONAME ; void CVeiImageConverter::GetEncoderImageTypesL(class RPointerArray<class CImageTypeDescription> &)
+	?GetFirstFrameL@CVeiTitleClipGenerator@@AAEPAVCFbsBitmap@@XZ @ 32 NONAME ; class CFbsBitmap * CVeiTitleClipGenerator::GetFirstFrameL(void)
+	?GetFrameL@CVeiImageClipGenerator@@UAEXAAVMVedVideoClipGeneratorFrameObserver@@HPAVTSize@@W4TDisplayMode@@HH@Z @ 33 NONAME ; void CVeiImageClipGenerator::GetFrameL(class MVedVideoClipGeneratorFrameObserver &, int, class TSize *, enum TDisplayMode, int, int)
+	?GetFrameL@CVeiTitleClipGenerator@@UAEXAAVMVedVideoClipGeneratorFrameObserver@@HPAVTSize@@W4TDisplayMode@@HH@Z @ 34 NONAME ; void CVeiTitleClipGenerator::GetFrameL(class MVedVideoClipGeneratorFrameObserver &, int, class TSize *, enum TDisplayMode, int, int)
+	?GetFramesL@CVeiFrameTaker@@QAEXAAVCVedVideoClipInfo@@HPAVTSize@@H1H1H@Z @ 35 NONAME ; void CVeiFrameTaker::GetFramesL(class CVedVideoClipInfo &, int, class TSize *, int, class TSize *, int, class TSize *, int)
+	?GetMGAlbumsListForMediaFileL@VideoEditorUtils@@SAXAAV?$RArray@H@@ABVTDesC16@@@Z @ 36 NONAME ; void VideoEditorUtils::GetMGAlbumsListForMediaFileL(class RArray<int> &, class TDesC16 const &)
+	?GetMaxMmsSizeL@CVeiVideoEditorSettings@@SAXAAH@Z @ 37 NONAME ; void CVeiVideoEditorSettings::GetMaxMmsSizeL(int &)
+	?GetMediaPlayerVolumeLevelL@CVeiVideoEditorSettings@@SAXAAH@Z @ 38 NONAME ; void CVeiVideoEditorSettings::GetMediaPlayerVolumeLevelL(int &)
+	?GetNext@CVeiAddQueue@@QAEXXZ @ 39 NONAME ; void CVeiAddQueue::GetNext(void)
+	?GetVideoFrameIndex@CVeiImageClipGenerator@@UBEHVTTimeIntervalMicroSeconds@@@Z @ 40 NONAME ; int CVeiImageClipGenerator::GetVideoFrameIndex(class TTimeIntervalMicroSeconds) const
+	?GetVideoFrameIndex@CVeiTitleClipGenerator@@UBEHVTTimeIntervalMicroSeconds@@@Z @ 41 NONAME ; int CVeiTitleClipGenerator::GetVideoFrameIndex(class TTimeIntervalMicroSeconds) const
+	?HorizontalAlignment@CVeiTitleClipGenerator@@QBE?AW4TVeiTitleClipHorizontalAlignment@@XZ @ 42 NONAME ; enum TVeiTitleClipHorizontalAlignment CVeiTitleClipGenerator::HorizontalAlignment(void) const
+	?IconFileNameAndPath@VideoEditorUtils@@SA?AV?$TBuf@$0BAA@@@H@Z @ 43 NONAME ; class TBuf<256> VideoEditorUtils::IconFileNameAndPath(int)
+	?ImageFilename@CVeiImageClipGenerator@@QBE?AVTPtrC16@@XZ @ 44 NONAME ; class TPtrC16 CVeiImageClipGenerator::ImageFilename(void) const
+	?InsertMediaL@CVeiAddQueue@@QAEXABVTDesC16@@@Z @ 45 NONAME ; void CVeiAddQueue::InsertMediaL(class TDesC16 const &)
+	?InternalizeL@TVeiSettings@@QAEXAAVRReadStream@@@Z @ 46 NONAME ; void TVeiSettings::InternalizeL(class RReadStream &)
+	?IsDrmProtectedL@VideoEditorUtils@@SAHABVTDesC16@@@Z @ 47 NONAME ; int VideoEditorUtils::IsDrmProtectedL(class TDesC16 const &)
+	?IsEnoughFreeSpaceToSaveL@VideoEditorUtils@@SAHAAVRFs@@ABVTDesC16@@H@Z @ 48 NONAME ; int VideoEditorUtils::IsEnoughFreeSpaceToSaveL(class RFs &, class TDesC16 const &, int)
+	?IsLandscapeScreenOrientation@VideoEditorUtils@@SAHXZ @ 49 NONAME ; int VideoEditorUtils::IsLandscapeScreenOrientation(void)
+	?LaunchListQueryDialogL@VideoEditorUtils@@SAHPAVMDesC16Array@@ABVTDesC16@@@Z @ 50 NONAME ; int VideoEditorUtils::LaunchListQueryDialogL(class MDesC16Array *, class TDesC16 const &)
+	?LaunchQueryDialogL@VideoEditorUtils@@SAHABVTDesC16@@@Z @ 51 NONAME ; int VideoEditorUtils::LaunchQueryDialogL(class TDesC16 const &)
+	?LaunchSaveChangesQueryL@VideoEditorUtils@@SAHXZ @ 52 NONAME ; int VideoEditorUtils::LaunchSaveChangesQueryL(void)
+	?LaunchSaveVideoQueryL@VideoEditorUtils@@SAHXZ @ 53 NONAME ; int VideoEditorUtils::LaunchSaveVideoQueryL(void)
+	?Log@CLogFile@@QAEXABVTDesC16@@@Z @ 54 NONAME ; void CLogFile::Log(class TDesC16 const &)
+	?Log@CLogFile@@QAEXABVTDesC8@@@Z @ 55 NONAME ; void CLogFile::Log(class TDesC8 const &)
+	?Log@CLogFile@@QAEXE@Z @ 56 NONAME ; void CLogFile::Log(unsigned char)
+	?Log@CLogFile@@QAEXI@Z @ 57 NONAME ; void CLogFile::Log(unsigned int)
+	?LogBytes@CLogFile@@QAEXABVTDesC8@@@Z @ 58 NONAME ; void CLogFile::LogBytes(class TDesC8 const &)
+	?LogNewline@CLogFile@@QAEXXZ @ 59 NONAME ; void CLogFile::LogNewline(void)
+	?LogTime@CLogFile@@QAEXXZ @ 60 NONAME ; void CLogFile::LogTime(void)
+	?MemoryInUse@TVeiSettings@@QAEAAW4TMemory@CAknMemorySelectionDialog@@XZ @ 61 NONAME ; enum CAknMemorySelectionDialog::TMemory & TVeiSettings::MemoryInUse(void)
+	?MemoryInUse@TVeiSettings@@QBEABW4TMemory@CAknMemorySelectionDialog@@XZ @ 62 NONAME ; enum CAknMemorySelectionDialog::TMemory const & TVeiSettings::MemoryInUse(void) const
+	?NewL@CLogFile@@SAPAV1@ABVTDesC16@@H@Z @ 63 NONAME ; class CLogFile * CLogFile::NewL(class TDesC16 const &, int)
+	?NewL@CVeiAddQueue@@SAPAV1@AAVMVedAudioClipInfoObserver@@AAVCVedMovie@@AAVMVeiQueueObserver@@@Z @ 64 NONAME ; class CVeiAddQueue * CVeiAddQueue::NewL(class MVedAudioClipInfoObserver &, class CVedMovie &, class MVeiQueueObserver &)
+	?NewL@CVeiDisplayLighter@@SAPAV1@XZ @ 65 NONAME ; class CVeiDisplayLighter * CVeiDisplayLighter::NewL(void)
+	?NewL@CVeiFrameTaker@@SAPAV1@AAVMVeiFrameTakerObserver@@@Z @ 66 NONAME ; class CVeiFrameTaker * CVeiFrameTaker::NewL(class MVeiFrameTakerObserver &)
+	?NewL@CVeiImageClipGenerator@@SAPAV1@ABVTDesC16@@ABVTSize@@ABVTTimeIntervalMicroSeconds@@ABVTRgb@@W4TDisplayMode@@AAVRFs@@AAVMVeiImageClipGeneratorObserver@@@Z @ 67 NONAME ; class CVeiImageClipGenerator * CVeiImageClipGenerator::NewL(class TDesC16 const &, class TSize const &, class TTimeIntervalMicroSeconds const &, class TRgb const &, enum TDisplayMode, class RFs &, class MVeiImageClipGeneratorObserver &)
+	?NewL@CVeiImageConverter@@SAPAV1@PAVMConverterController@@@Z @ 68 NONAME ; class CVeiImageConverter * CVeiImageConverter::NewL(class MConverterController *)
+	?NewL@CVeiRemConTarget@@SAPAV1@AAVMVeiMediakeyObserver@@@Z @ 69 NONAME ; class CVeiRemConTarget * CVeiRemConTarget::NewL(class MVeiMediakeyObserver &)
+	?NewL@CVeiTempMaker@@SAPAV1@XZ @ 70 NONAME ; class CVeiTempMaker * CVeiTempMaker::NewL(void)
+	?NewL@CVeiTitleClipGenerator@@SAPAV1@ABVTSize@@W4TVeiTitleClipTransition@@W4TVeiTitleClipHorizontalAlignment@@W4TVeiTitleClipVerticalAlignment@@@Z @ 71 NONAME ; class CVeiTitleClipGenerator * CVeiTitleClipGenerator::NewL(class TSize const &, enum TVeiTitleClipTransition, enum TVeiTitleClipHorizontalAlignment, enum TVeiTitleClipVerticalAlignment)
+	?NewLC@CLogFile@@SAPAV1@ABVTDesC16@@H@Z @ 72 NONAME ; class CLogFile * CLogFile::NewLC(class TDesC16 const &, int)
+	?NewLC@CVeiAddQueue@@SAPAV1@AAVMVedAudioClipInfoObserver@@AAVCVedMovie@@AAVMVeiQueueObserver@@@Z @ 73 NONAME ; class CVeiAddQueue * CVeiAddQueue::NewLC(class MVedAudioClipInfoObserver &, class CVedMovie &, class MVeiQueueObserver &)
+	?NewLC@CVeiImageClipGenerator@@SAPAV1@ABVTDesC16@@ABVTSize@@ABVTTimeIntervalMicroSeconds@@ABVTRgb@@W4TDisplayMode@@AAVRFs@@AAVMVeiImageClipGeneratorObserver@@@Z @ 74 NONAME ; class CVeiImageClipGenerator * CVeiImageClipGenerator::NewLC(class TDesC16 const &, class TSize const &, class TTimeIntervalMicroSeconds const &, class TRgb const &, enum TDisplayMode, class RFs &, class MVeiImageClipGeneratorObserver &)
+	?NewLC@CVeiMGFetchVerifier@@SAPAV1@XZ @ 75 NONAME ; class CVeiMGFetchVerifier * CVeiMGFetchVerifier::NewLC(void)
+	?NewLC@CVeiTempMaker@@SAPAV1@XZ @ 76 NONAME ; class CVeiTempMaker * CVeiTempMaker::NewLC(void)
+	?NewLC@CVeiTitleClipGenerator@@SAPAV1@ABVTSize@@W4TVeiTitleClipTransition@@W4TVeiTitleClipHorizontalAlignment@@W4TVeiTitleClipVerticalAlignment@@@Z @ 77 NONAME ; class CVeiTitleClipGenerator * CVeiTitleClipGenerator::NewLC(class TSize const &, enum TVeiTitleClipTransition, enum TVeiTitleClipHorizontalAlignment, enum TVeiTitleClipVerticalAlignment)
+	?NotifyNewMediaDocumentL@VideoEditorUtils@@SAXAAVRFs@@ABVTDesC16@@@Z @ 78 NONAME ; void VideoEditorUtils::NotifyNewMediaDocumentL(class RFs &, class TDesC16 const &)
+	?Reset@CVeiDisplayLighter@@QAEXXZ @ 79 NONAME ; void CVeiDisplayLighter::Reset(void)
+	?SaveQuality@TVeiSettings@@QAEAAHXZ @ 80 NONAME ; int & TVeiSettings::SaveQuality(void)
+	?SaveQuality@TVeiSettings@@QBEHXZ @ 81 NONAME ; int TVeiSettings::SaveQuality(void) const
+	?ScaleL@CVeiImageConverter@@QAEXPAVCFbsBitmap@@0ABVTSize@@@Z @ 82 NONAME ; void CVeiImageConverter::ScaleL(class CFbsBitmap *, class CFbsBitmap *, class TSize const &)
+	?SetAutoFlush@CLogFile@@QAEXH@Z @ 83 NONAME ; void CLogFile::SetAutoFlush(int)
+	?SetAutoNewline@CLogFile@@QAEXH@Z @ 84 NONAME ; void CLogFile::SetAutoNewline(int)
+	?SetAutoTimeStamp@CLogFile@@QAEXH@Z @ 85 NONAME ; void CLogFile::SetAutoTimeStamp(int)
+	?SetBackgroundColor@CVeiImageClipGenerator@@QAEXABVTRgb@@@Z @ 86 NONAME ; void CVeiImageClipGenerator::SetBackgroundColor(class TRgb const &)
+	?SetBackgroundColorL@CVeiTitleClipGenerator@@QAEXABVTRgb@@@Z @ 87 NONAME ; void CVeiTitleClipGenerator::SetBackgroundColorL(class TRgb const &)
+	?SetBackgroundImageL@CVeiTitleClipGenerator@@QAEXABVTDesC16@@AAVMVeiTitleClipGeneratorObserver@@@Z @ 88 NONAME ; void CVeiTitleClipGenerator::SetBackgroundImageL(class TDesC16 const &, class MVeiTitleClipGeneratorObserver &)
+	?SetBackgroundImageL@CVeiTitleClipGenerator@@QAEXPBVCFbsBitmap@@@Z @ 89 NONAME ; void CVeiTitleClipGenerator::SetBackgroundImageL(class CFbsBitmap const *)
+	?SetBitmap@CVeiImageConverter@@QAEXPAVCFbsBitmap@@@Z @ 90 NONAME ; void CVeiImageConverter::SetBitmap(class CFbsBitmap *)
+	?SetDescriptiveNameL@CVeiTitleClipGenerator@@QAEXABVTDesC16@@@Z @ 91 NONAME ; void CVeiTitleClipGenerator::SetDescriptiveNameL(class TDesC16 const &)
+	?SetDuration@CVeiImageClipGenerator@@QAEXABVTTimeIntervalMicroSeconds@@@Z @ 92 NONAME ; void CVeiImageClipGenerator::SetDuration(class TTimeIntervalMicroSeconds const &)
+	?SetDuration@CVeiTitleClipGenerator@@QAEXABVTTimeIntervalMicroSeconds@@@Z @ 93 NONAME ; void CVeiTitleClipGenerator::SetDuration(class TTimeIntervalMicroSeconds const &)
+	?SetMediaPlayerVolumeLevelL@CVeiVideoEditorSettings@@SAXH@Z @ 94 NONAME ; void CVeiVideoEditorSettings::SetMediaPlayerVolumeLevelL(int)
+	?SetTextColorL@CVeiTitleClipGenerator@@QAEXABVTRgb@@@Z @ 95 NONAME ; void CVeiTitleClipGenerator::SetTextColorL(class TRgb const &)
+	?SetTextL@CVeiTitleClipGenerator@@QAEXABVTDesC16@@@Z @ 96 NONAME ; void CVeiTitleClipGenerator::SetTextL(class TDesC16 const &)
+	?SetTransitionAndAlignmentsL@CVeiTitleClipGenerator@@QAEXW4TVeiTitleClipTransition@@W4TVeiTitleClipHorizontalAlignment@@W4TVeiTitleClipVerticalAlignment@@@Z @ 97 NONAME ; void CVeiTitleClipGenerator::SetTransitionAndAlignmentsL(enum TVeiTitleClipTransition, enum TVeiTitleClipHorizontalAlignment, enum TVeiTitleClipVerticalAlignment)
+	?ShowAudioClipDialogL@CVeiAddQueue@@QAEHXZ @ 98 NONAME ; int CVeiAddQueue::ShowAudioClipDialogL(void)
+	?ShowVideoClipDialogL@CVeiAddQueue@@QAEHW4TCursorLocation@VideoEditor@@H@Z @ 99 NONAME ; int CVeiAddQueue::ShowVideoClipDialogL(enum VideoEditor::TCursorLocation, int)
+	?Start@CVeiDisplayLighter@@QAEXXZ @ 100 NONAME ; void CVeiDisplayLighter::Start(void)
+	?StartProcessingL@CVeiAddQueue@@QAEXXZ @ 101 NONAME ; void CVeiAddQueue::StartProcessingL(void)
+	?StartToEncodeL@CVeiImageConverter@@QAEXABVTDesC16@@ABVTUid@@1@Z @ 102 NONAME ; void CVeiImageConverter::StartToEncodeL(class TDesC16 const &, class TUid const &, class TUid const &)
+	?StaticLog@CLogFile@@SAXABVTDesC16@@0@Z @ 103 NONAME ; void CLogFile::StaticLog(class TDesC16 const &, class TDesC16 const &)
+	?StaticLog@CLogFile@@SAXABVTDesC16@@ABVTDesC8@@@Z @ 104 NONAME ; void CLogFile::StaticLog(class TDesC16 const &, class TDesC8 const &)
+	?StaticLogL@CLogFile@@SAXABVTDesC16@@0@Z @ 105 NONAME ; void CLogFile::StaticLogL(class TDesC16 const &, class TDesC16 const &)
+	?StaticLogL@CLogFile@@SAXABVTDesC16@@ABVTDesC8@@@Z @ 106 NONAME ; void CLogFile::StaticLogL(class TDesC16 const &, class TDesC8 const &)
+	?Stop@CVeiDisplayLighter@@QAEXXZ @ 107 NONAME ; void CVeiDisplayLighter::Stop(void)
+	?Text@CVeiTitleClipGenerator@@QBE?AVTPtrC16@@XZ @ 108 NONAME ; class TPtrC16 CVeiTitleClipGenerator::Text(void) const
+	?TextColor@CVeiTitleClipGenerator@@QBE?AVTRgb@@XZ @ 109 NONAME ; class TRgb CVeiTitleClipGenerator::TextColor(void) const
+	?Transition@CVeiTitleClipGenerator@@QBE?AW4TVeiTitleClipTransition@@XZ @ 110 NONAME ; enum TVeiTitleClipTransition CVeiTitleClipGenerator::Transition(void) const
+	?Uid@CVeiImageClipGenerator@@UBE?AVTUid@@XZ @ 111 NONAME ; class TUid CVeiImageClipGenerator::Uid(void) const
+	?Uid@CVeiTitleClipGenerator@@UBE?AVTUid@@XZ @ 112 NONAME ; class TUid CVeiTitleClipGenerator::Uid(void) const
+	?VerifySelectionL@CVeiMGFetchVerifier@@UAEHPBVMDesC16Array@@@Z @ 113 NONAME ; int CVeiMGFetchVerifier::VerifySelectionL(class MDesC16Array const *)
+	?VerticalAlignment@CVeiTitleClipGenerator@@QBE?AW4TVeiTitleClipVerticalAlignment@@XZ @ 114 NONAME ; enum TVeiTitleClipVerticalAlignment CVeiTitleClipGenerator::VerticalAlignment(void) const
+	?VideoFirstFrameComplexityFactor@CVeiImageClipGenerator@@UBEHXZ @ 115 NONAME ; int CVeiImageClipGenerator::VideoFirstFrameComplexityFactor(void) const
+	?VideoFirstFrameComplexityFactor@CVeiTitleClipGenerator@@UBEHXZ @ 116 NONAME ; int CVeiTitleClipGenerator::VideoFirstFrameComplexityFactor(void) const
+	?VideoFrameCount@CVeiImageClipGenerator@@UBEHXZ @ 117 NONAME ; int CVeiImageClipGenerator::VideoFrameCount(void) const
+	?VideoFrameCount@CVeiTitleClipGenerator@@UBEHXZ @ 118 NONAME ; int CVeiTitleClipGenerator::VideoFrameCount(void) const
+	?VideoFrameDifferenceFactor@CVeiImageClipGenerator@@UBEHH@Z @ 119 NONAME ; int CVeiImageClipGenerator::VideoFrameDifferenceFactor(int) const
+	?VideoFrameDifferenceFactor@CVeiTitleClipGenerator@@UBEHH@Z @ 120 NONAME ; int CVeiTitleClipGenerator::VideoFrameDifferenceFactor(int) const
+	?VideoFrameDuration@CVeiImageClipGenerator@@UBE?AVTTimeIntervalMicroSeconds@@H@Z @ 121 NONAME ; class TTimeIntervalMicroSeconds CVeiImageClipGenerator::VideoFrameDuration(int) const
+	?VideoFrameDuration@CVeiTitleClipGenerator@@UBE?AVTTimeIntervalMicroSeconds@@H@Z @ 122 NONAME ; class TTimeIntervalMicroSeconds CVeiTitleClipGenerator::VideoFrameDuration(int) const
+	?VideoFrameEndTime@CVeiImageClipGenerator@@UBE?AVTTimeIntervalMicroSeconds@@H@Z @ 123 NONAME ; class TTimeIntervalMicroSeconds CVeiImageClipGenerator::VideoFrameEndTime(int) const
+	?VideoFrameEndTime@CVeiTitleClipGenerator@@UBE?AVTTimeIntervalMicroSeconds@@H@Z @ 124 NONAME ; class TTimeIntervalMicroSeconds CVeiTitleClipGenerator::VideoFrameEndTime(int) const
+	?VideoFrameIsIntra@CVeiImageClipGenerator@@UBEHH@Z @ 125 NONAME ; int CVeiImageClipGenerator::VideoFrameIsIntra(int) const
+	?VideoFrameStartTime@CVeiImageClipGenerator@@UBE?AVTTimeIntervalMicroSeconds@@H@Z @ 126 NONAME ; class TTimeIntervalMicroSeconds CVeiImageClipGenerator::VideoFrameStartTime(int) const
+	?VideoFrameStartTime@CVeiTitleClipGenerator@@UBE?AVTTimeIntervalMicroSeconds@@H@Z @ 127 NONAME ; class TTimeIntervalMicroSeconds CVeiTitleClipGenerator::VideoFrameStartTime(int) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/EABI/VideoEditorCommon.DEF	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,158 @@
+EXPORTS
+	_ZN12CVeiAddQueue12InsertMediaLERK7TDesC16 @ 1 NONAME
+	_ZN12CVeiAddQueue16StartProcessingLEv @ 2 NONAME
+	_ZN12CVeiAddQueue20ShowAudioClipDialogLEv @ 3 NONAME
+	_ZN12CVeiAddQueue20ShowVideoClipDialogLEN11VideoEditor15TCursorLocationEi @ 4 NONAME
+	_ZN12CVeiAddQueue4NewLER25MVedAudioClipInfoObserverR9CVedMovieR17MVeiQueueObserver @ 5 NONAME
+	_ZN12CVeiAddQueue5NewLCER25MVedAudioClipInfoObserverR9CVedMovieR17MVeiQueueObserver @ 6 NONAME
+	_ZN12CVeiAddQueue7GetNextEv @ 7 NONAME
+	_ZN12CVeiAddQueueD0Ev @ 8 NONAME
+	_ZN12CVeiAddQueueD1Ev @ 9 NONAME
+	_ZN12CVeiAddQueueD2Ev @ 10 NONAME
+	_ZN12TVeiSettings11MemoryInUseEv @ 11 NONAME
+	_ZN12TVeiSettings11SaveQualityEv @ 12 NONAME
+	_ZN12TVeiSettings12InternalizeLER11RReadStream @ 13 NONAME
+	_ZN12TVeiSettings16DefaultVideoNameEv @ 14 NONAME
+	_ZN12TVeiSettings19DefaultSnapshotNameEv @ 15 NONAME
+	_ZN13CVeiTempMaker4NewLEv @ 16 NONAME
+	_ZN13CVeiTempMaker5NewLCEv @ 17 NONAME
+	_ZN13CVeiTempMakerD0Ev @ 18 NONAME
+	_ZN13CVeiTempMakerD1Ev @ 19 NONAME
+	_ZN13CVeiTempMakerD2Ev @ 20 NONAME
+	_ZN14CVeiFrameTaker10GetFramesLER17CVedVideoClipInfoiP5TSizeiS3_iS3_i @ 21 NONAME
+	_ZN14CVeiFrameTaker4NewLER22MVeiFrameTakerObserver @ 22 NONAME
+	_ZN16CVeiRemConTarget4NewLER20MVeiMediakeyObserver @ 23 NONAME
+	_ZN16VideoEditorUtils15IsDrmProtectedLERK7TDesC16 @ 24 NONAME
+	_ZN16VideoEditorUtils17GenerateFileNameLER3RFsRK7TDesC16R6TDes1615TVedVideoFormati4TBufILi256EE @ 25 NONAME
+	_ZN16VideoEditorUtils18LaunchQueryDialogLERK7TDesC16 @ 26 NONAME
+	_ZN16VideoEditorUtils19IconFileNameAndPathEi @ 27 NONAME
+	_ZN16VideoEditorUtils21LaunchSaveVideoQueryLEv @ 28 NONAME
+	_ZN16VideoEditorUtils22AddMediaFileToMGAlbumLERK7TDesC16i @ 29 NONAME
+	_ZN16VideoEditorUtils22LaunchListQueryDialogLEP12MDesC16ArrayRK7TDesC16 @ 30 NONAME
+	_ZN16VideoEditorUtils23LaunchSaveChangesQueryLEv @ 31 NONAME
+	_ZN16VideoEditorUtils23NotifyNewMediaDocumentLER3RFsRK7TDesC16 @ 32 NONAME
+	_ZN16VideoEditorUtils24GenerateNewDocumentNameLER3RFsRK7TDesC16R6TDes1615TVedVideoFormatiN11VideoEditor7TMemoryE @ 33 NONAME
+	_ZN16VideoEditorUtils24IsEnoughFreeSpaceToSaveLER3RFsRK7TDesC16i @ 34 NONAME
+	_ZN16VideoEditorUtils28GetMGAlbumsListForMediaFileLER6RArrayIiERK7TDesC16 @ 35 NONAME
+	_ZN16VideoEditorUtils28IsLandscapeScreenOrientationEv @ 36 NONAME
+	_ZN18CVeiDisplayLighter4NewLEv @ 37 NONAME
+	_ZN18CVeiDisplayLighter4StopEv @ 38 NONAME
+	_ZN18CVeiDisplayLighter5ResetEv @ 39 NONAME
+	_ZN18CVeiDisplayLighter5StartEv @ 40 NONAME
+	_ZN18CVeiImageConverter14CancelEncodingEv @ 41 NONAME
+	_ZN18CVeiImageConverter14StartToEncodeLERK7TDesC16RK4TUidS5_ @ 42 NONAME
+	_ZN18CVeiImageConverter21GetEncoderImageTypesLER13RPointerArrayI21CImageTypeDescriptionE @ 43 NONAME
+	_ZN18CVeiImageConverter4NewLEP20MConverterController @ 44 NONAME
+	_ZN18CVeiImageConverter6ScaleLEP10CFbsBitmapS1_RK5TSize @ 45 NONAME
+	_ZN18CVeiImageConverter9GetBitmapEv @ 46 NONAME
+	_ZN18CVeiImageConverter9SetBitmapEP10CFbsBitmap @ 47 NONAME
+	_ZN18CVeiImageConverterD0Ev @ 48 NONAME
+	_ZN18CVeiImageConverterD1Ev @ 49 NONAME
+	_ZN18CVeiImageConverterD2Ev @ 50 NONAME
+	_ZN19CVeiMGFetchVerifier16VerifySelectionLEPK12MDesC16Array @ 51 NONAME
+	_ZN19CVeiMGFetchVerifier5NewLCEv @ 52 NONAME
+	_ZN19CVeiMGFetchVerifierD0Ev @ 53 NONAME
+	_ZN19CVeiMGFetchVerifierD1Ev @ 54 NONAME
+	_ZN19CVeiMGFetchVerifierD2Ev @ 55 NONAME
+	_ZN22CVeiImageClipGenerator11CancelFrameEv @ 56 NONAME
+	_ZN22CVeiImageClipGenerator11SetDurationERK25TTimeIntervalMicroSeconds @ 57 NONAME
+	_ZN22CVeiImageClipGenerator18SetBackgroundColorERK4TRgb @ 58 NONAME
+	_ZN22CVeiImageClipGenerator4NewLERK7TDesC16RK5TSizeRK25TTimeIntervalMicroSecondsRK4TRgb12TDisplayModeR3RFsR30MVeiImageClipGeneratorObserver @ 59 NONAME
+	_ZN22CVeiImageClipGenerator5NewLCERK7TDesC16RK5TSizeRK25TTimeIntervalMicroSecondsRK4TRgb12TDisplayModeR3RFsR30MVeiImageClipGeneratorObserver @ 60 NONAME
+	_ZN22CVeiImageClipGenerator9GetFrameLER35MVedVideoClipGeneratorFrameObserveriP5TSize12TDisplayModeii @ 61 NONAME
+	_ZN22CVeiImageClipGeneratorD0Ev @ 62 NONAME
+	_ZN22CVeiImageClipGeneratorD1Ev @ 63 NONAME
+	_ZN22CVeiImageClipGeneratorD2Ev @ 64 NONAME
+	_ZN22CVeiTitleClipGenerator11CancelFrameEv @ 65 NONAME
+	_ZN22CVeiTitleClipGenerator11SetDurationERK25TTimeIntervalMicroSeconds @ 66 NONAME
+	_ZN22CVeiTitleClipGenerator13SetTextColorLERK4TRgb @ 67 NONAME
+	_ZN22CVeiTitleClipGenerator14GetFirstFrameLEv @ 68 NONAME
+	_ZN22CVeiTitleClipGenerator15FinishGetFrameLEi @ 69 NONAME
+	_ZN22CVeiTitleClipGenerator19SetBackgroundColorLERK4TRgb @ 70 NONAME
+	_ZN22CVeiTitleClipGenerator19SetBackgroundImageLEPK10CFbsBitmap @ 71 NONAME
+	_ZN22CVeiTitleClipGenerator19SetBackgroundImageLERK7TDesC16R30MVeiTitleClipGeneratorObserver @ 72 NONAME
+	_ZN22CVeiTitleClipGenerator19SetDescriptiveNameLERK7TDesC16 @ 73 NONAME
+	_ZN22CVeiTitleClipGenerator27SetTransitionAndAlignmentsLE23TVeiTitleClipTransition32TVeiTitleClipHorizontalAlignment30TVeiTitleClipVerticalAlignment @ 74 NONAME
+	_ZN22CVeiTitleClipGenerator4NewLERK5TSize23TVeiTitleClipTransition32TVeiTitleClipHorizontalAlignment30TVeiTitleClipVerticalAlignment @ 75 NONAME
+	_ZN22CVeiTitleClipGenerator5NewLCERK5TSize23TVeiTitleClipTransition32TVeiTitleClipHorizontalAlignment30TVeiTitleClipVerticalAlignment @ 76 NONAME
+	_ZN22CVeiTitleClipGenerator8SetTextLERK7TDesC16 @ 77 NONAME
+	_ZN22CVeiTitleClipGenerator9GetFrameLER35MVedVideoClipGeneratorFrameObserveriP5TSize12TDisplayModeii @ 78 NONAME
+	_ZN22CVeiTitleClipGeneratorD0Ev @ 79 NONAME
+	_ZN22CVeiTitleClipGeneratorD1Ev @ 80 NONAME
+	_ZN22CVeiTitleClipGeneratorD2Ev @ 81 NONAME
+	_ZN23CVeiVideoEditorSettings14GetMaxMmsSizeLERi @ 82 NONAME
+	_ZN23CVeiVideoEditorSettings26GetMediaPlayerVolumeLevelLERi @ 83 NONAME
+	_ZN23CVeiVideoEditorSettings26SetMediaPlayerVolumeLevelLEi @ 84 NONAME
+	_ZN8CLogFile10LogNewlineEv @ 85 NONAME
+	_ZN8CLogFile10StaticLogLERK7TDesC16RK6TDesC8 @ 86 NONAME
+	_ZN8CLogFile10StaticLogLERK7TDesC16S2_ @ 87 NONAME
+	_ZN8CLogFile12SetAutoFlushEi @ 88 NONAME
+	_ZN8CLogFile14SetAutoNewlineEi @ 89 NONAME
+	_ZN8CLogFile16SetAutoTimeStampEi @ 90 NONAME
+	_ZN8CLogFile3LogERK6TDesC8 @ 91 NONAME
+	_ZN8CLogFile3LogERK7TDesC16 @ 92 NONAME
+	_ZN8CLogFile3LogEh @ 93 NONAME
+	_ZN8CLogFile3LogEj @ 94 NONAME
+	_ZN8CLogFile4NewLERK7TDesC16i @ 95 NONAME
+	_ZN8CLogFile5NewLCERK7TDesC16i @ 96 NONAME
+	_ZN8CLogFile7LogTimeEv @ 97 NONAME
+	_ZN8CLogFile8LogBytesERK6TDesC8 @ 98 NONAME
+	_ZN8CLogFile9StaticLogERK7TDesC16RK6TDesC8 @ 99 NONAME
+	_ZN8CLogFile9StaticLogERK7TDesC16S2_ @ 100 NONAME
+	_ZN8CLogFileD0Ev @ 101 NONAME
+	_ZN8CLogFileD1Ev @ 102 NONAME
+	_ZN8CLogFileD2Ev @ 103 NONAME
+	_ZNK12CVeiAddQueue5CountEv @ 104 NONAME
+	_ZNK12TVeiSettings11MemoryInUseEv @ 105 NONAME
+	_ZNK12TVeiSettings11SaveQualityEv @ 106 NONAME
+	_ZNK12TVeiSettings12ExternalizeLER12RWriteStream @ 107 NONAME
+	_ZNK12TVeiSettings16DefaultVideoNameEv @ 108 NONAME
+	_ZNK12TVeiSettings19DefaultSnapshotNameEv @ 109 NONAME
+	_ZNK13CVeiTempMaker15EmptyTempFolderEv @ 110 NONAME
+	_ZNK13CVeiTempMaker20GenerateTempFileNameER7HBufC16N25CAknMemorySelectionDialog7TMemoryE15TVedVideoFormati @ 111 NONAME
+	_ZNK22CVeiImageClipGenerator13ImageFilenameEv @ 112 NONAME
+	_ZNK22CVeiImageClipGenerator15BackgroundColorEv @ 113 NONAME
+	_ZNK22CVeiImageClipGenerator15DescriptiveNameEv @ 114 NONAME
+	_ZNK22CVeiImageClipGenerator15VideoFrameCountEv @ 115 NONAME
+	_ZNK22CVeiImageClipGenerator17VideoFrameEndTimeEi @ 116 NONAME
+	_ZNK22CVeiImageClipGenerator17VideoFrameIsIntraEi @ 117 NONAME
+	_ZNK22CVeiImageClipGenerator18GetVideoFrameIndexE25TTimeIntervalMicroSeconds @ 118 NONAME
+	_ZNK22CVeiImageClipGenerator18VideoFrameDurationEi @ 119 NONAME
+	_ZNK22CVeiImageClipGenerator19VideoFrameStartTimeEi @ 120 NONAME
+	_ZNK22CVeiImageClipGenerator26VideoFrameDifferenceFactorEi @ 121 NONAME
+	_ZNK22CVeiImageClipGenerator31VideoFirstFrameComplexityFactorEv @ 122 NONAME
+	_ZNK22CVeiImageClipGenerator3UidEv @ 123 NONAME
+	_ZNK22CVeiImageClipGenerator8DurationEv @ 124 NONAME
+	_ZNK22CVeiTitleClipGenerator10TransitionEv @ 125 NONAME
+	_ZNK22CVeiTitleClipGenerator15BackgroundColorEv @ 126 NONAME
+	_ZNK22CVeiTitleClipGenerator15BackgroundImageEv @ 127 NONAME
+	_ZNK22CVeiTitleClipGenerator15DescriptiveNameEv @ 128 NONAME
+	_ZNK22CVeiTitleClipGenerator15VideoFrameCountEv @ 129 NONAME
+	_ZNK22CVeiTitleClipGenerator17VerticalAlignmentEv @ 130 NONAME
+	_ZNK22CVeiTitleClipGenerator17VideoFrameEndTimeEi @ 131 NONAME
+	_ZNK22CVeiTitleClipGenerator18GetVideoFrameIndexE25TTimeIntervalMicroSeconds @ 132 NONAME
+	_ZNK22CVeiTitleClipGenerator18VideoFrameDurationEi @ 133 NONAME
+	_ZNK22CVeiTitleClipGenerator19HorizontalAlignmentEv @ 134 NONAME
+	_ZNK22CVeiTitleClipGenerator19VideoFrameStartTimeEi @ 135 NONAME
+	_ZNK22CVeiTitleClipGenerator26VideoFrameDifferenceFactorEi @ 136 NONAME
+	_ZNK22CVeiTitleClipGenerator31VideoFirstFrameComplexityFactorEv @ 137 NONAME
+	_ZNK22CVeiTitleClipGenerator3UidEv @ 138 NONAME
+	_ZNK22CVeiTitleClipGenerator4TextEv @ 139 NONAME
+	_ZNK22CVeiTitleClipGenerator8DurationEv @ 140 NONAME
+	_ZNK22CVeiTitleClipGenerator9TextColorEv @ 141 NONAME
+	_ZTI12CVeiAddQueue @ 142 NONAME ; #<TI>#
+	_ZTI22CVeiImageClipGenerator @ 143 NONAME ; #<TI>#
+	_ZTI22CVeiTitleClipGenerator @ 144 NONAME ; #<TI>#
+	_ZTI27CVeiImageClipFrameOperation @ 145 NONAME ; #<TI>#
+	_ZTI28CVeiImageClipDecodeOperation @ 146 NONAME ; #<TI>#
+	_ZTI33CVeiTitleClipImageDecodeOperation @ 147 NONAME ; #<TI>#
+	_ZTV12CVeiAddQueue @ 148 NONAME ; #<VT>#
+	_ZTV22CVeiImageClipGenerator @ 149 NONAME ; #<VT>#
+	_ZTV22CVeiTitleClipGenerator @ 150 NONAME ; #<VT>#
+	_ZTV27CVeiImageClipFrameOperation @ 151 NONAME ; #<VT>#
+	_ZTV28CVeiImageClipDecodeOperation @ 152 NONAME ; #<VT>#
+	_ZTV33CVeiTitleClipImageDecodeOperation @ 153 NONAME ; #<VT>#
+	_ZThn4_N19CVeiMGFetchVerifier16VerifySelectionLEPK12MDesC16Array @ 154 NONAME ; #<thunk>#
+	_ZThn4_N19CVeiMGFetchVerifierD0Ev @ 155 NONAME ; #<thunk>#
+	_ZThn4_N19CVeiMGFetchVerifierD1Ev @ 156 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/data/VideoEditorCommon.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*     
+*/
+
+
+NAME	VECM
+
+// INCLUDES
+#include <Eikon.rh>
+#include <avkon.loc>
+#include <DRMCommon.loc>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.hrh>
+
+//#include "manualvideoeditor.loc"
+#include "videoeditorcommon.hrh"
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF	r_vei_note_drm_not_allowed							{ buf = qtn_drm_not_allowed; }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/group/VideoEditorCommon.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+#include <data_caging_paths.hrh>
+#include "../../Group/buildconfig.hrh"
+
+#if defined( __DEBUG_ON__ )
+MACRO           DEBUG_ON
+#endif
+#if defined( __DEBUG_ON_ALWAYS__ )
+MACRO           DEBUG_ON_ALWAYS
+#endif
+#if defined(__DEBUG_ON__) || defined(__DEBUG_ON_ALWAYS__)
+LIBRARY         flogger.lib
+#endif
+
+
+TARGET		VideoEditorCommon.dll
+TARGETTYPE	DLL
+CAPABILITY	CAP_GENERAL_DLL
+UID		0x1000008d 0xA0000303
+
+
+USERINCLUDE	../inc
+USERINCLUDE	../data
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH	../src
+SOURCE		VideoEditorUtils.cpp
+SOURCE		VeiTitleClipGenerator.cpp
+SOURCE		VeiImageClipGenerator.cpp
+SOURCE		VeiAddQueue.cpp
+SOURCE		VeiSettings.cpp
+SOURCE		VeiVideoEditorSettings.cpp
+SOURCE		VeiImageConverter.cpp
+SOURCE		VeiTempMaker.cpp
+SOURCE		VeiFrameTaker.cpp
+SOURCE		VeiDisplayLighter.cpp
+SOURCE		VeiMGFetchVerifier.cpp
+SOURCE		VeiRemConTarget.cpp
+SOURCE		logfile.cpp
+
+SOURCEPATH	../data
+START RESOURCE  VideoEditorCommon.rss
+HEADER
+TARGET VideoEditorCommon.rsc
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+LIBRARY apparc.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY bitgdi.lib
+LIBRARY BitmapTransforms.lib
+LIBRARY centralrepository.lib
+LIBRARY charconv.lib 	// for CLogFile
+LIBRARY commonengine.lib
+LIBRARY cone.lib 
+LIBRARY DRMCommon.lib
+LIBRARY efsrv.lib
+LIBRARY eikcore.lib 
+LIBRARY eikctl.lib
+LIBRARY estor.lib
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+LIBRARY FontUtils.lib
+LIBRARY gdi.lib
+LIBRARY hal.lib 		// for CLogFile
+LIBRARY ImageConversion.lib
+LIBRARY MGFetch.lib
+LIBRARY platformenv.lib
+LIBRARY remconcoreapi.lib
+LIBRARY remconinterfacebase.lib
+LIBRARY ServiceHandler.lib
+LIBRARY sysutil.lib
+LIBRARY VedEngine.lib
+LIBRARY ws32.lib
+LIBRARY MPEngine.lib
+
+NOSTRICTDEF
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../../Group/buildconfig.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// ROM description files
+../rom/VideoEditorCommon.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(VideoEditorCommon.iby)
+../rom/VideoEditorCommon_resource.iby  LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(VideoEditorCommon_resource.iby)
+
+PRJ_MMPFILES
+../Group/VideoEditorCommon.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/ManualVideoEditor.loc	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1214 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+//d: Caption of the application
+//l: list_single_large_graphic_pane_1
+#define qtn_app_caption_string					 		"Video Editor"
+
+//d: Short format of the caption
+//l: cell_app_pane_1
+#define qtn_app_short_caption_string			 		"Vid. editor"
+
+//d: Text in the navi pane.
+//d: Shows elapsed time and total length of the video.
+//l: navi_pane_4
+#define qtn_time_prog_total_min_sec						"%0U/%1U"
+
+//d: Text in the Edit view navi pane when
+//d: text title or image selected on the video timeline
+//d: and Edit text-Change duration in options menu pressed. 
+//l: navi_pane_3
+#define qtn_vei_navi_change_text_duration				"Change duration"
+
+//d: Command in the Small Preview popup menu
+//d: Plays the selected video clip
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_cmd_play								"Play"
+
+//d: Command in the Preview popup menu and Cut Video view menu.
+//d: Takes snapshot from current frame
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_cmd_take_snapshot 						"Take snapshot"
+
+//d: Shows confirmation note of saving the movie.
+//l: popup_note_window_1
+#define qtn_vei_confirmation_note_quit_save				"Save changes made to video clip?"
+
+//d: Command in the Cut Video view menu
+//d: Opens the Remove submenu.
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_cut_video_cmd_clear_marks			  	"Remove"
+
+//d: Command in the Remove submenu
+//d: Removes the In mark
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_cut_video_cmd_clear_marks_in			"Start mark"
+
+//d: Command in the Remove submenu
+//d: Removes both marks (In & Out)
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_cut_video_cmd_clear_marks_in_out		"All marks"
+
+//d: Command in the Remove submenu
+//d: Removes the Out mark
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_cut_video_cmd_clear_marks_out			"End mark"
+
+//d: Command in the Cut Video view menu
+//d: Continues playing the clip
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_cut_video_cmd_continue					"Play and mark"
+
+//d: Text for the right softkey in Cut Video View
+//d: Sets the mark in position.
+//l: control_pane_1
+#define qtn_vei_mark_in									"Start mk."
+
+//d:Command in the Cut Video view menu
+//d:and option in popup menu when selection key is pressed.
+//l:list_single_popup_menu_pane_1
+#define qtn_vei_cut_video_cmd_mark_in					"Start mark"
+
+//d: Text for the left softkey in Cut Video View
+//d: Sets the mark out position.
+//l: control_pane_1
+#define qtn_vei_mark_out								"End mark"
+
+//d:Command in the Cut Video view menu
+//d:and option in popup menu when selection key is pressed.
+//l:list_single_popup_menu_pane_1
+#define qtn_vei_cut_video_cmd_mark_out					"End mark"
+
+//d: Command in the Cut Video view menu
+//d: Plays the clip
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_cut_video_cmd_play						"Play and mark"
+
+//d: Command in the Cut Video view menu
+//d: Plays the clip
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_cut_video_cmd_play_marked				"Play marked section"
+
+//d: Command in the Cut Video view menu
+//d: Stops playing the clip
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_cut_video_cmd_stop						"Stop"			
+
+//d: The title of the Cut Video view.
+//l: title_pane_1
+#define qtn_vei_cut_video_title_cut_video				"Cut video"
+
+
+//d: File name prompt dialog is used to file naming 
+//d: in various situations.
+//l: popup_list_heading_pane_1
+#define qtn_vei_data_query_set_file_name				"File name:"
+
+//d: The title of the Large Preview and Small Preview views
+//l: title_pane_1
+#define qtn_vei_edit_preview_title_preview				"Preview"
+
+//d: The title of the Transition edit view.
+//l: title_pane_1
+#define qtn_vei_edit_transition_title_transition		"Edit transition"
+
+//d: Command in the Edit Video/EditAudio sub menu.
+//d: Copy-paste selected video/audio.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_duplicate			"Duplicate"	 
+
+//d: Command in the Edit menu when the Edit Audio option
+//d: is selected.
+//d: Opens the audio editing sub menu.
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_edit_video_cmd_edit_audio				"Edit sound clip"
+
+//d: Command in the Edit menu.
+//d: Opens the Edit Transition sub menu.
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_edit_video_cmd_edit_tran				"Edit Transition"
+
+//d: Command in the Edit menu when the Edit Transition option
+//d: is selected.
+//d: Adds the fade to black middle transition.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_tran_dip_to_black	"Dip to black"
+
+//d: Command in the Edit menu when the Edit Transition option
+//d: is selected.
+//d: Adds the fade to white middle transition.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_tran_dip_to_white	"Dip to white"
+
+//d: Command in the transition menu when the Edit Transition option
+//d: is selected.
+//d: Adds the fade from black start transition.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_tran_fade_from_black "Fade from black"
+
+//d: Command in the Edit menu when the Edit Transition option
+//d: is selected.
+//d: Adds the fade from white start transition.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_tran_fade_from_white "Fade from white"
+
+//d: Command in the Edit menu when the Edit Transition option
+//d: is selected.
+//d: Adds the fade to black end transition.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_tran_fade_to_black	"Fade to black"
+
+//d: Command in the Edit menu when the Edit Transition option
+//d: is selected.
+//d: Adds the fade to white end transition.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_tran_fade_to_white	"Fade to white"
+
+//d: Command in the Edit Transition sub. 
+//d: Removes the current transition.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_tran_no_tran		"No transition"
+
+//d: Command in the Edit menu.
+//d: Opens sub menu for editing the video
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_edit_video_cmd_edit_video				"Edit video clip"
+
+//d: Command in the Edit submenu when the Edit Video option
+//d: is selected.
+//d: Adds color effect to the video.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_video_color_effect 	"Add colour effect"
+
+//d: Command in the Edit submenu when the Edit Video/Audio option
+//d: is selected.
+//d: Starts the cutting of the video/audio
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_video_cutting		"Cut"
+
+//d: Command in the Edit submenu when the Edit Video option
+//d: is selected.
+//d: Moves the clip.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_video_move			"Move"
+
+//d: Command in the popup menu when in the navikey is 
+//d: is pressed in the Edit mode.
+//d: Mutes the audio
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_video_mute			"Mute sound"
+
+//d: Command in the Edit submenu when the Edit Video Option  
+//d: is selected.
+//d: Removes the clip.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_video_remove		"Remove"
+
+//d: Command in the Edit submenu when the Edit Video Option 
+//d: is selected.
+//d: Adds slow motion effect
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_video_slow_motion	"Use slow motion"
+
+//d: Command in the popup menu when in the navikey 
+//d: is pressed in the Edit mode.
+//d: Unmutes the audio
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_video_unmute		"Unmute sound"
+
+//d: Command in the Edit menu.
+//d: Opens the Insert submenu
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_edit_video_cmd_insert					"Insert"
+
+//d: Command in the Edit menu when the Insert option
+//d: is selected.
+//d: Inserts an audio track.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_insert_audio				"Sound clip"
+
+//d: Command in the Edit menu when the Insert option
+//d: is selected.
+//d: Records a new audio track.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_insert_new_audio			"New sound clip"
+
+//d: Command in the Edit menu when the Insert option
+//d: is selected.
+//d: Inserts a clip.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_insert_video				"Video clip"
+
+//d: Command in the Edit view Movie submenu.
+//d: Opens the Preview submenu.
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_edit_video_cmd_preview					"Preview"
+
+//d: Command in the Edit view Movie submenu.
+//d: Saving the video.
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_edit_video_cmd_save_to					"Save"
+
+//d: Text in the main pane, which is shown when the fade to black
+//d: middle transition set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_dip_to_black		"Dip to black"
+
+//d: Text in the main pane, which is shown when the fade to white 
+//d: middle transition set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_dip_to_white		"Dip to white"
+
+//d: Text in the main pane, which is shown when the fade from black 
+//d: start transition set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_fade_from_black	"Fade from black"
+
+//d: Text in the main pane, which is shown when the fade from white 
+//d: start transition set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_fade_from_white	"Fade from white"
+
+//d: Text which is shown when the fade from black 
+//d: end transition set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_fade_to_black		"Fade to black"
+
+//d: Text in the main pane, which is shown when the fade from white 
+//d: end transition set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_fade_to_white		"Fade to white"
+
+//d: Text in the main pane, which is shown when "no transition" set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_no					"No transition"
+
+//
+// Main pane - Text clip descriptive name
+//
+
+//d: Text in the main pane when video clip selected on
+//d: the timeline.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_text_t						"Title" 
+
+//d: Text in the main pane when video clip selected on
+//d: the timeline.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_text_tf						"Title (fading)"
+
+//d: Text in the main pane when video clip selected on
+//d: the timeline.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_text_subt					"Subtitle" 
+
+//d: Text in the main pane when video clip selected on
+//d: the timeline.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_text_subtf					"Subtitle (fading)" 
+
+//d: Text in the main pane when video clip selected on
+//d: the timeline.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_text_credit					"Credits" 
+
+
+//d: The title of the Edit View
+//l: title_pane_1
+#define qtn_vei_edit_video_title_edit_video				"Edit video"
+
+//d: Query heading text
+//l: popup_list_heading_pane_1
+#define qtn_vei_list_query_select_effect				"Select effect:"
+
+//d: Option in effect dialog. Black & white effect.
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_effect_black_white	"Black and white"
+
+//d: Option in effect dialog. Removes effect if any
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_effect_no_effect		"No effect"
+
+//d: Query heading text
+//l: popup_list_heading_pane_1
+#define qtn_vei_list_query_select_tran_title 			"Select transition:"	
+
+//d: Option in list query when selection key is pressed
+//d: and video/audio clip is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_video_cut				"Cut"
+
+//d: Option in list query when selection key is pressed
+//d: and video clip is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_video_color_effect	"Add colour effect"
+
+//d: Option in list query when selection key is pressed
+//d: and video clip or audio clip is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_video_move			"Move"
+
+//d: Option in list query when selection key is pressed
+//d: and video clip is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_video_mute			"Mute sound"
+
+//d: Option in list query when selection key is pressed
+//d: and video clip or audio clip is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_video_remove			"Remove"
+
+//d: Option in list query when selection key is pressed
+//d: and video clip is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_video_slow_motion		"Use slow motion"
+
+//d: Option in list query when selection key is pressed
+//d: and video clip is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_video_unmute			"Unmute sound"
+
+//d: Text in the navi pane when moving audio clip
+//l: navi_pane_2
+#define qtn_vei_navilabel_move_audio					"Moving sound clip"
+
+//d: Text in the navi pane when moving video clip
+//l: navi_pane_2
+#define qtn_vei_navilabel_move_video					"Moving video clip"
+
+//d: Shows progress note of applying color effect
+//l: popup_note_wait_window_1
+#define qtn_vei_progress_note_applying_color_effect		"Applying color effect"
+
+//d: Shows progress note of cutting video clip.
+//l: popup_note_wait_window_1
+#define qtn_vei_progress_note_cutting_video				"Cutting video clip"
+
+//d: Shows progress note of preparing to cut.
+//l: popup_note_wait_window_1
+#define qtn_vei_progress_note_preparing_to_cut			"Processing clip"
+
+//d: Shows progress note when sending video 
+//l: popup_note_wait_window_1
+#define qtn_vei_progress_note_preparing_to_send			"Processing movie for Send"
+
+//d: Softkey record in the Edit Video view.
+//d: Starts recording the audio
+//l: control_pane_1
+#define qtn_vei_record									"Record"
+
+//d: Error note when recording audio failed
+//l: popup_note_window_1
+#define qtn_vei_recording_failed						"Unable to record"
+
+//d: List title in the Settings view
+//l: list_setting_pane_1
+#define qtn_vei_settings_label1_default_movie_name		"Default video name"
+
+//d: List title in the Settings view
+//l: list_setting_pane_1
+#define qtn_vei_settings_label2_default_snapshot_name 	"Default snapshot name"
+
+//d: List title in the Settings view
+//l: list_setting_pane_1
+#define qtn_vei_settings_label3_memory_in_use 			"Memory in use"
+
+//d: The title of the Settings view
+//l: title_pane_1
+#define qtn_vei_settings_title_settings					"Settings"
+
+//d: Default name for the movie
+//l: list_setting_pane_2
+#define qtn_vei_settings_value1_movie					"Video"
+
+//d: Default name for the snapshot
+//l: list_setting_pane_2
+#define qtn_vei_settings_value2_snapshot 				"Snapshot"
+
+//d: Error note when inserting video failed
+//d: video format is not supported
+//l: popup_note_window_1
+#define qtn_vei_video_failed							"Unable to insert video clip"
+
+
+//d: Title pane text in Cut Audio View.
+//l: title_pane_1
+#define qtn_vei_cut_audio_title 						"Cut sound"	
+
+//d: Option in popup menu when selection key is pressed
+//d: and some of the transitions is already selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_no_tran			"No transition"
+
+//d: Option in popup menu when selection key is pressed
+//d: and between transition is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_dip_to_black		"Dip to black"
+
+//d: Option in popup menu when selection key is pressed
+//d: and between transition is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_dip_to_white		"Dip to white"
+
+//d: Option in popup menu when selection key is pressed
+//d: and start transition is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_fade_from_black	"Fade from black"
+
+//d: Option in popup menu when selection key is pressed
+//d: and start transition is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_fade_from_white	"Fade from white"
+
+//d: Option in popup menu when selection key is pressed
+//d: and end transition is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_fade_to_black	"Fade to black"
+
+//d: Option in popup menu when selection key is pressed
+//d: and end transition is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_fade_to_white	"Fade to white"
+
+//d: Option in popup menu when selection key is pressed
+//d: and video/audio clip is selected.
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_video_duplicate  		"Duplicate"  	
+
+//d: Title of the popup menu when selection key is pressed
+//l: popup_list_heading_pane_1
+#define qtn_vei_list_query_insert_sound_type			"Insert:"
+
+//d: Option in popup menu when selection key is pressed
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_insert_sound_type_sound		"Sound clip"
+
+//d: Option in popup menu when selection key is pressed
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_insert_sound_type_new_audio	"Record sound clip"
+
+//d: Command in the Edit Audio sub menu.
+//d: Moves the audio track.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_audio_move			"Move"
+
+//d: Command in the Edit Audio sub menu.
+//d: Removes audio track.
+//l: list_single_popup_submenu_pane_1
+#define qtn_vei_edit_video_cmd_edit_audio_remove		"Remove"
+
+//d:Information note to show when memory card is not accessible,
+//d:but it's selected as current storage.
+//l:popup_note_window_1
+#define qtn_ved_mmc_not_inserted						"Memory card not accessible. Phone memory will be used instead."
+
+//d:Wait note.
+//l:popup_note_wait_window_1
+#define qtn_ved_inserting_video							"Inserting video clip"
+
+//d:Wait note.
+//l:popup_note_wait_window_1
+#define qtn_ved_inserting_mult_media					"Inserting media %0N/%1N"
+
+//d:Wait note / progress note.
+//l:popup_note_wait_window_1
+#define qtn_ved_inserting_audio							"Inserting sound clip"
+
+//d:Wait note.
+//l:popup_note_wait_window_1
+#define qtn_ved_inserting_image							"Inserting image"
+
+//d:Wait note.
+//l:popup_note_wait_window_1
+#define qtn_ved_saving_snapshot							"Saving snapshot to Gallery"
+
+//d:Progress note.
+//l:popup_note_wait_window_1
+#define qtn_ved_processing_for_mms						"Processing movie for MMS"
+
+//d:Progress note.
+//l:popup_note_wait_window_1
+#define qtn_ved_processing_movie						"Processing movie"
+
+//d:Error note.
+//l:popup_note_window_1
+#define qtn_ved_audio_format_not_supported				"Sound format not supported"
+
+//d:Error note.
+//l:popup_note_window_1
+#define qtn_ved_image_insert_failed						"Unable to insert image"
+
+//d:Error note.
+//l:popup_note_window_1
+#define qtn_ved_audio_insert_failed						"Unable to insert sound clip"
+
+//d:Warning note.
+//l:popup_note_window_1
+#define qtn_ved_inserting_failed_continue				"Inserting %U failed. Continue?"
+
+//d:Main pane (Trim for MMS)
+//l:main_pane_1_empty
+#define qtn_ved_trim_start								"Start:"
+
+//d:Main pane (Trim for MMS)
+//l:main_pane_1_empty
+#define qtn_ved_trim_end								"End:"
+
+//d: Text on navi pane when select video.
+//l: navi_pane_3
+#define qtn_vei_navi_pane_mms							"MMS" 
+
+//d: Text on navi pane when select video.
+//l: navi_pane_3
+#define qtn_vei_size_mb									" %U MB"
+
+//d: Command in the Edit view Insert-submenu 
+//d: when video clip selected on  the timeline.
+//d: Adds image to the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_insert_image						"Image"
+
+//d: Command in the Edit view Insert-submenu 
+//d: when video clip selected on the timeline.
+//d: Opens text popup menu.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_insert_text						"Text"
+
+//
+//Options Edit text submenu
+//
+
+//d: Command in the Edit view menu 
+//d: when text title selected on the timline. 
+//d: Opens the "Edit text" submenu.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_editt								"Edit text"
+
+//d: Command in the Edit view Edit text-submenu
+//d: when text title selected on the timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_move						"Move"
+
+//d: Command in the Edit view Edit text-submenu
+//d: when text title selected on the timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_remove						"Remove"
+
+//d: Command in the Edit view Edit text-submenu
+//d: when text title selected on the timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_duplicate					"Duplicate"
+
+//d: Command in the Edit view Edit audio / Edit text-submenu
+//d: when text title selected on the timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_dur							"Change duration"
+
+//d: Command in the Edit view Edit text-submenu
+//d: when text title selected on the timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_text						"Change text" 
+
+//d: Command in the Edit view Edit text-submenu
+//d: when text title selected on the timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_color						"Set text color"
+
+//d: Command in the Edit view Edit text-submenu
+//d: when text title selected on the timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_bg							"Set backgroud"
+
+//d: Command in the Edit view Edit text-submenu
+//d: when text title selected on the timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_style						"Style"
+
+//d: Command in the Edit view Edit text-submenu
+//d: when text title selected on the timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_color_effect				"Add color effect"
+
+
+//Edit text-Style popup menu and Insert-Text popup menu
+
+
+//d: Command in the Edit view Insert-Text and Edit text-Style popup menu 
+//d: when video clip selected on  the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_text_t						"Title" 
+
+//d: Command in the Edit view Insert-Text and Edit text-Style popup menu 
+//d: when video clip selected on  the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_text_tf						"Title (fading)"  
+
+//d: Command in the Edit view Insert-Text and Edit text-Style popup menu
+//d: when video clip selected on  the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_text_subt					"Subtitle"  
+
+//d: Command in the Edit view Insert-Text and Edit text-Style popup menu
+//d: when video clip selected on  the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_text_subtf					"Subtitle (fading)"   
+
+//d: Command in the Edit view Insert-Text and Edit text-Style popup menu
+//d: when video clip selected on  the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_text_credit					"Credits"   
+
+
+//Options Edit image submenu
+
+
+//d: Command in the Edit view menu 
+//d: when image selected on the video timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_editi								"Edit image"
+
+//d: Command in the Edit view Edit image submenu
+//d: when image selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editi_move						"Move"
+
+//d: Command in the Edit view Edit image submenu
+//d: when image selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editi_remove						"Remove"
+
+//d: Command in the Edit view Edit image submenu
+//d: when image selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editi_duplicate					"Duplicate"
+
+//d: Command in the Edit view Edit image submenu
+//d: when image selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editi_dur							"Change duration"
+
+//d: Command in the Edit view Edit image submenu
+//d: when image selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editi_bg							"Set background"
+
+//d: Command in the Edit view Edit image submenu
+//d: when image selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editi_color_effect				"Add color effect"
+
+//Edit text and Edit image popup menus
+
+//d: Option in popup menu when Edit text
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_editt_text							"Change text" 
+
+//d: Option in popup menu when Edit text
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_editt_color						"Set text color" 
+
+//d: Option in popup menu when Edit text / Edit image
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_editt_bg							"Set background" 
+
+//d: Option in popup menu when Edit text
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_editt_style						"Style"				
+
+//d: Pop-up menu title when Edit text - Set background 
+//d: in option menu in Edit view selected.
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_smenu_editt_select_heading_background	"Select background:"
+
+//d: Option in popup menu when Edit text - Set background 
+//d: in option menu in Edit view selected.
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_editt_select_bg_image				"Image"  
+
+//d: Option in popup menu when Edit text - Set background 
+//d: in option menu in Edit view selected.
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_editt_select_bg_color				"Color"   
+
+//d: Command in the Edit view Edit transition submenu
+//d: when transition selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_cf							"Crossfade"
+
+//d: Command in the Edit view Edit transition submenu
+//d: when transition selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_wipet						"Wipe from top"
+
+//d: Command in the Edit view Edit transition submenu
+//d: when transition selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_wipeb						"Wipe from bottom"
+
+//d: Command in the Edit view Edit transition submenu
+//d: when transition selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_wipel						"Wipe from left"
+
+//d: Command in the Edit view Edit transition submenu
+//d: when transition selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_editt_wiper						"Wipe from right"
+
+//d: Command in the Edit view Movie submenu
+//d: when video clip selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_movie_mms							"Trim for Mms"
+
+//d: Command in the Edit view Movie - Preview submenu
+//d: when video clip selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_movie_lpreview					"Large"
+
+//d: Command in the Edit view Movie - Preview submenu
+//d: when transition selected on the video timeline.
+//l: list_single_popup_submenu_pane_1
+#define qtn_ved_smenu_movie_spreview					"Small"
+
+//d: Command in the Edit view menu 
+//d: Opens the Settings view.
+//l: list_single_popup_menu_pane_1
+#define qtn_options_settings							"Settings"
+
+//d: Command in the Edit view menu 
+//d: Opens the Movie submenu.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_movie								"Movie"
+
+//d: Title of the popup menu when selection key is pressed
+//d: when video timeline empty.
+//l: popup_list_heading_pane_1
+#define qtn_ved_menu_title_insert_video					"Insert:"
+
+//d: Title of the popup menu when selection key is pressed
+//d: and focus is on text clip.
+//l: popup_list_heading_pane_1
+#define qtn_ved_menu_title_edit_text					"Edit text:"
+
+//d: Title of the popup menu when selection key is pressed
+//d: and focus is on image clip.
+//l: popup_list_heading_pane_1
+#define qtn_ved_menu_title_edit_image					"Edit image:"
+
+//d: Title of the popup menu when selection key is pressed
+//d: and focus is on video clip.
+//l: popup_list_heading_pane_1
+#define qtn_ved_menu_title_edit_video					"Edit video:"
+
+//d: Title of the popup menu when selection key is pressed
+//d: and focus is on audio clip.
+//l: popup_list_heading_pane_1
+#define qtn_ved_menu_title_edit_audio					"Edit sound:"
+
+//d: Option in popup menu when selection key is pressed
+//d: when video timeline empty.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_video						"Video clip"
+
+//d: Option in popup menu when selection key is pressed
+//d: when video timeline empty.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_image						"Image"
+
+//d: Title of the popup menu when selection key is pressed
+//d: when text title selected on the timeline.
+//l: popup_list_heading_pane_1
+#define qtn_ved_smenu_heading_editt						"Select style:"
+
+//d: Option in popup menu when selection key is pressed
+//d: when video timeline empty.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_text						"Text"
+
+//d: Option in popup menu when selection key is pressed
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_text_t						"Title"
+
+//d: Option in popup menu when selection key is pressed
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_text_tf						"Title (fading)"
+
+//d: Option in popup menu when selection key is pressed
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_text_subt					"Subtitle"
+
+//d: Option in popup menu when selection key is pressed
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_text_subtf					"Subtitle (fading)"
+
+//d: Option in popup menu when selection key is pressed
+//d: when text title selected on the timeline.
+//l: list_single_popup_menu_pane_1
+#define qtn_ved_menu_insert_text_credit					"Credits"
+
+// Main pane
+
+//d: Text in in the Edit view main pane
+//d: in landscape orientation,
+//d: when video clip inserted
+//l: main_pane_1_empty
+#define qtn_ved_edit_video_duration						"Dur.:"
+
+//d: Text in the Cut view main pane.
+//l: main_pane_1_empty
+#define qtn_ved_cut_video_in							"In:"
+
+//d: Text in the Cut view main pane.
+//l: main_pane_1_empty
+#define qtn_ved_cut_video_out							"Out:"
+
+//d: Text in the Edit view main pane
+//d: when empty video timeline.
+//l: main_pane_1_empty
+#define qtn_ved_edit_video_no_video						"No video"
+
+//d: Text in the Edit view main pane
+//d: when empty audio timeline.
+//l: main_pane_1_empty
+#define qtn_ved_edit_video_no_audio						"No sound"
+
+//d: Text on the main pane, which is shown 
+//d: when the crossfade transition set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_crossfade			"Crossfade"
+
+//d: Text on the main pane, which is shown 
+//d: when the Wipe left to right transition set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_wipe_left			"Wipe left to right"
+
+//d: Text on the main pane, which is shown 
+//d: when the Wipe right to left transition set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_wipe_right			"Wipe right to left"
+
+//d: Text on the main pane, which is shown 
+//d: when the Wipe top to bottom transition set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_wipe_top			"Wipe top to bottom"
+
+//d: Text on the main pane, which is shown 
+//d: when the Wipe bottom to top transition set.
+//l: main_pane_1_empty
+#define qtn_vei_edit_video_main_tran_wipe_bottom		"Wipe bottom to top"
+
+//d: Option in popup menu when selection key is pressed
+//d: and transition is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_crossfade		"Crossfade"
+
+//d: Option in popup menu when selection key is pressed
+//d: and transition is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_wipe_left		"Wipe left to right"
+
+//d: Option in popup menu when selection key is pressed
+//d: and transition is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_wipe_right		"Wipe right to left"
+
+//d: Option in popup menu when selection key is pressed
+//d: and transition is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_wipe_top			"Wipe top to bottom"
+
+//d: Option in popup menu when selection key is pressed
+//d: and transition is selected
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_list_query_select_tran_wipe_bottom		"Wipe bottom to top"
+
+//d: Enter text prompt dialog when
+//d: Insert-Text selected. 
+//l: popup_list_heading_pane_1
+#define qtn_vei_textinserting_for_title_screen			"Enter text"
+
+//d: List title in the Settings view
+//l: list_setting_pane_1
+#define qtn_vei_setting_item_save_quality				"Save quality"
+
+//d: Save quality option in enumerated text list;
+//d: output resolution is resolved automatically.
+//l: list_setting_pane_2
+#define qtn_vei_save_quality_auto						"Auto"
+
+//d: Save quality option in enumerated text list;
+//d: output resolution is MMS compatible.
+//l: list_setting_pane_2
+#define qtn_vei_save_quality_mms						"MMS compatible"
+
+//d: Save quality option in enumerated text list;
+//d: output resolution is best possible (CIF).
+//l: list_setting_pane_2
+#define qtn_vei_save_quality_best						"Best"
+
+//d: Command in the "Trim for MMS" view options menu
+//d: Sends the trimmed video via multimedia
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_menu_send_via_mms						"Send via MMS"
+
+//d: Command in the "Trim for MMS" view options menu
+//d: Previews the trimmed video in full screen
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_menu_preview							"Preview"
+
+//d: Command in the "Trim for MMS" view options menu
+//d: Adjusts the size of the fork in video timeline
+//l: list_single_popup_menu_pane_1
+#define qtn_vei_menu_video_length						"Adjust video length"
+
+//d: The title of the "Trim for MMS" view
+//l: title_pane_1
+#define qtn_vei_trim_mms_title							"Trim for MMS"
+
+//d: Idlestate softkey text
+//l: control_pane_1
+#define qtn_vei_idle_mode								"Video Editor"
+
+//d: Text on the main pane,
+//d: 
+//l:
+#define qtn_vei_edit_video_main_new_audio			"New sound clip"
+
+//d: Information note when movie saved
+//l:popup_note_window_1
+#define qtn_vei_edit_video_note_saved				"Video Saved"
+
+//d: Text in the Edit view navi pane when
+//d: audio selected
+//d: and Edit sound clip-Set duration in options menu pressed. 
+//l: navi_pane_3
+#define qtn_vei_navi_change_audio_duration		 "Clip duration"
+
+//d: Confirmation note. The user has launched the Video editor in the portrait mode and 
+//d: is inserting text to the editing window.  Before saving the text s/he turns the phone 
+//d: to landscape mode, which interrupts the input -the keypad only works in the landscape 
+//d: mode. The user is asked whether s/he wants to continue editing the text. To do that s/he 
+//d: should turn the phone back to portrait mode. Twisting the phone back to portrait mode 
+//d: allows the user to continue inserting text. Accepting the query discards the note and 
+//d: the user stays in the landscape mode. \n
+//l: popup_note_window_t5
+#define qtn_vei_confirm_note_cancel_textinsert "To continue entering text, phone must be in portrait mode. Delete text?"
+
+//d: Options list item, command. This allows the user to change the duration of the text 
+//d: that is seen on the display.  This is one of the options in the list the heading text 
+//d: of which is (qtn_ved_menu_title_edit_text/manualvideoeditor). 
+//l: list_single_pane_t1_cp2
+#define qtn_ved_menu_editt_dur "Set duration"
+
+//d: Confirmation note. Seen after the user has taken a snapshot and it has been saved.
+//l: popup_note_window
+#define qtn_vei_note_snapshot_saved "Snapshot saved"
+
+//d: Confirmation note. This is seen in case the snapshot has been taken with Edit key and 
+//d: it will be saved to Images folder.
+//l: popup_note_window
+#define qtn_vei_note_snapshot_taken_to_images "Snapshot saved to Images"
+
+
+//d:Command in the AIW provider's Edit submenu
+//Starts the simple "2Click" Merge video applcation
+//l:list_single_popup_submenu_pane_t1
+#define qtn_vei_menu_merge     "Merge"
+
+//d:Command in the AIW provider's Edit submenu
+//Starts the simple "2Click" Add audio application
+//l:list_single_popup_submenu_pane_t1
+//#define qtn_vei_menu_add_audio "Add sound"
+
+//d:Command in the AIW provider's Edit submenu
+//Starts the simple "2Click" Add text application
+//l:list_single_popup_submenu_pane_t1
+#define qtn_vei_menu_add_text  "Add text"
+
+//d:Command in the AIW provider's Edit submenu
+//Starts the simple "2Click" Cut video application
+//l:list_single_popup_submenu_pane_t1
+#define qtn_vei_menu_cut       "Cut"
+
+//d:Command in the AIW provider's Edit submenu
+//d:Starts the full video editor application
+//l:list_single_popup_submenu_pane_t1
+#define qtn_vei_menu_advanced  "Video editor"
+
+//d:Query heading text
+//d:for the location to insert an image in a movie (begining/end?)
+//l:heading_pane_t1
+#define qtn_vei_menu_insert_image "Add image to:"
+
+//d:Query heading text
+//d:for the location to insert text in a movie (begining/end?)
+//l:heading_pane_t1
+#define qtn_vei_menu_insert_text "Add text to:"
+
+//d:Select to insert text, image etc. 
+//d:into the begining of the movie
+//l:list_single_pane_t1_cp2
+#define qtn_vei_menu_insert_point_begin "Beginning"
+
+//d:Select to insert text, image etc. into the
+//d:end of the movie
+//l:list_single_pane_t1_cp2
+#define qtn_vei_menu_insert_point_end   "End"
+
+//d:Progress note for merging videos
+//l:popup_note_wait_window
+#define qtn_vei_note_merging "Merging"
+
+//d:Progress note for porocessing "add sound"
+//l:popup_note_wait_window
+//#define qtn_vei_note_adding_audio "Adding sound"
+
+//d:Progress note for porocessing "add text"
+//l:popup_note_wait_window
+#define qtn_vei_note_adding_text "Adding text"
+
+//d:Progress note for processing "Cut video", i.e.
+//d:the 2Click cut video
+//l:popup_note_wait_window
+#define qtn_vei_note_cutting "Cutting"
+
+//d:Command to launch "Adjust audio volume" -functionality
+//l:list_single_pane_t1_cp2
+#define qtn_vei_edit_video_cmd_edit_adj_vol "Adjust volume"
+
+//d:Command to launch audio mixing
+//l:list_single_pane_t1_cp2
+#define qtn_vei_edit_video_cmd_audio_mix "Sound mixing"
+
+//d:List query heading text.
+//d:This list query is used to select whether image files
+//d:or video clips are listed. It is used at least with the
+//d:"Merge" functionality (qtn_vei_menu_merge), where
+//d:the user can merge a video clip with another video clip,
+//d:or alternatively with an image file.
+//l:heading_pane_t1
+#define qtn_vei_menu_select "Select:"
+
+//d:Select to list the image files from the Media gallery.
+//d:(list query item)
+//l:list_single_pane_t1_cp2
+#define qtn_vei_menu_select_image "Image"
+
+//d:Select to list the video clips from the Media gallery.
+//d:(list query item)
+//l:list_single_pane_t1_cp2
+#define qtn_vei_menu_select_video "Video clip"
+
+//d:New text
+//d:Used but not localized
+//d:One option in selecting video resolution in settings (check list item)
+//l: list_set_graphic_pane_t1
+#define qtn_vei_save_quality_medium "Medium"
+
+//d:New text
+//d:Command in the AIW provider's Edit submenu
+//Starts the simple "2Click" Change sound application
+//l:list_single_popup_submenu_pane_t1
+#define qtn_vei_menu_change_sound "Change sound"
+	    
+//d:New text
+//d:Progress note for porocessing "Change sound"
+//l:popup_note_wait_window
+#define qtn_vei_note_changing_sound "Changing sound"
+	    
+//d:New text 
+//d:User note, used in simple function "Add text"
+//d:when processing video A and text together fails
+//d:	process has three phases where some of can fail:
+//d:		a) generating video B from text
+//d:		or :
+//d:		b) inserting video B to movie
+//d:		or :
+//d:		c) processing videos A and B together 
+//l:popup_note_window
+#define qtn_vei_unable_to_insert_text "Unable to add text" 
+
+//d:New text 
+//d:Error message showed in simple function "Merge videos" 
+//d:when processing two videos together fails
+//l:popup_note_window
+#define qtn_vei_unable_to_merge_videos "Unable to merge video clips"
+
+//d:New text 
+//d:Error message showed in simple function "Merge video and image" 
+//d:when processing video and image together fails
+//l:popup_note_window
+#define qtn_vei_unable_to_merge_video_image "Unable to merge video clip and image"
+
+//d:New text 
+//d:Error message showed in simple function "Change sound" 
+//d:when processing video and audio together fails
+//l:popup_note_window
+#define qtn_vei_unable_to_change_sound "Unable to change sound"
+
+//d:New text 
+//d:Error message showed in simple functions "Merge", "Add text" and "Change sound" 
+//d:when video clip is not supported by ved engine
+//l:popup_note_window
+#define qtn_vei_video_format_not_supported "Video clip format not supported" // in merge there can be two videos
+
+//d:New text 
+//d:Error message showed in simple function "Change sound" 
+//d:when audio clip is not supported by ved engine
+//l:popup_note_window
+#define qtn_vei_audio_format_not_supported "Sound clip format not supported"
+
+//d:New text 
+//d:Error message showed in simple function "Merge" 
+//d:when image is not supported by ved engine
+//l:popup_note_window
+#define qtn_vei_image_format_not_supported "Image format not supported"
+
+//d:New text
+//d:List query heading text.
+//d:This list query is used to select one video file
+//d:from the list of videos. It is used at least with the
+//d:"Merge" functionality (qtn_vei_menu_merge), where
+//d:the user can merge a video clip with another video clip.
+//l:heading_pane_t1
+#define qtn_vei_menu_merge_with_video "Merge with:"
+
+//d:New text
+//d:List query heading text.
+//d:This list query is used to select one image file
+//d:from the list of images. It is used at least with the
+//d:"Merge" functionality (qtn_vei_menu_merge), where
+//d:the user can merge a video clip with an image file.
+//l:heading_pane_t1
+#define qtn_vei_menu_merge_with_image "Merge with:"
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VeiAddQueue.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEIADDQUEUE_H
+#define VEIADDQUEUE_H
+
+#include <e32base.h>
+#include <vedmovie.h>
+#include "veiimageclipgenerator.h"
+#include "VideoEditorCommon.h"
+
+class CVedVideoClipGenerator;
+
+
+class MVeiQueueObserver
+	{
+public:
+	enum TProcessing
+		{
+		EProcessingAudio = 0x50,
+		EProcessingVideo,
+		EProcessingImage,
+		ENotProcessing
+		};
+
+public:
+
+	virtual void NotifyQueueProcessingStarted( MVeiQueueObserver::TProcessing aMode = MVeiQueueObserver::ENotProcessing ) = 0;
+
+	virtual void NotifyQueueEmpty( TInt aInserted, TInt aFailed ) = 0;
+
+	virtual void NotifyQueueProcessingProgressed( TInt aProcessedCount, TInt aPercentage ) = 0;
+
+	virtual TBool NotifyQueueClipFailed( const TDesC& aFilename, TInt aError ) = 0;
+	};
+
+
+class CVeiAddQueue :	public CActive,
+						public MVedMovieObserver,
+						public MVeiImageClipGeneratorObserver
+    {
+	public:
+	    IMPORT_C static CVeiAddQueue* NewL( MVedAudioClipInfoObserver& aView, CVedMovie& aMovie, MVeiQueueObserver& aObserver );
+
+        IMPORT_C static CVeiAddQueue* NewLC( MVedAudioClipInfoObserver& aView, CVedMovie& aMovie, MVeiQueueObserver& aObserver );
+
+        IMPORT_C virtual ~CVeiAddQueue();
+
+    public:
+
+		IMPORT_C TBool ShowAudioClipDialogL();
+
+		IMPORT_C TBool ShowVideoClipDialogL( VideoEditor::TCursorLocation aLocation, TInt aCurrentIndex );
+
+		IMPORT_C void InsertMediaL( const TDesC& aFilename );
+
+		IMPORT_C void StartProcessingL();
+
+		IMPORT_C void GetNext();
+
+		IMPORT_C TInt Count() const;
+
+		enum TErrorCases
+			{
+			EInsertingSingleClip = -90,
+			EInsertingFromGallery
+			};
+	private:
+
+		TInt AddNextL( TInt aPosition = -1 );
+
+		void DoCancel();
+		
+		void RunL();
+
+		CVeiAddQueue( MVedAudioClipInfoObserver& aView, CVedMovie& aMovie, MVeiQueueObserver& aObserver );
+
+	    void ConstructL();
+
+  
+
+	private:
+// From MVeiImageClipGeneratorObserver
+		virtual void NotifyImageClipGeneratorInitializationComplete(
+			CVeiImageClipGenerator& aGenerator, TInt aError);
+
+// From MVedMovieObserver
+		virtual void NotifyVideoClipAdded(CVedMovie& aMovie, TInt aIndex);
+		virtual void NotifyVideoClipAddingFailed(CVedMovie& aMovie, TInt aError);
+		virtual void NotifyVideoClipRemoved(CVedMovie& aMovie, TInt aIndex);
+		virtual void NotifyVideoClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
+									           TInt aNewIndex);
+		virtual void NotifyVideoClipTimingsChanged(CVedMovie& aMovie,
+											   TInt aIndex);
+		virtual void NotifyVideoClipColorEffectChanged(CVedMovie& aMovie,
+												   TInt aIndex);
+		virtual void NotifyVideoClipAudioSettingsChanged(CVedMovie& aMovie,
+											         TInt aIndex);
+		virtual void NotifyVideoClipGeneratorSettingsChanged(CVedMovie& aMovie,
+											             TInt aIndex);
+		virtual void NotifyVideoClipDescriptiveNameChanged(CVedMovie& aMovie,
+																TInt aIndex);
+		virtual void NotifyStartTransitionEffectChanged(CVedMovie& aMovie);
+		virtual void NotifyMiddleTransitionEffectChanged(CVedMovie& aMovie, 
+													 TInt aIndex);
+		virtual void NotifyEndTransitionEffectChanged(CVedMovie& aMovie);
+		virtual void NotifyAudioClipAdded(CVedMovie& aMovie, TInt aIndex);
+		virtual void NotifyAudioClipAddingFailed(CVedMovie& aMovie, TInt aError);
+		virtual void NotifyAudioClipRemoved(CVedMovie& aMovie, TInt aIndex);
+		virtual void NotifyAudioClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
+									           TInt aNewIndex);
+		virtual void NotifyAudioClipTimingsChanged(CVedMovie& aMovie,
+											   TInt aIndex);
+		virtual void NotifyMovieQualityChanged(CVedMovie& aMovie);
+		virtual void NotifyMovieReseted(CVedMovie& aMovie);
+
+		virtual void NotifyMovieOutputParametersChanged(CVedMovie& aMovie);
+	    virtual void NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex);
+		virtual void NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
+                                                        TInt aClipIndex, 
+                                                        TInt aMarkIndex);
+		virtual void NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex);
+		virtual void NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
+                                                        TInt aClipIndex, 
+                                                        TInt aMarkIndex);
+
+	private:
+	     /**
+         * No description.
+         */
+        RPointerArray<TDesC>    iAddQueue;
+
+	     /**
+         * No description.
+         */
+		MVeiQueueObserver*		iObserver;
+
+	     /**
+         * No description.
+         */
+		CVedMovie&				iMovie;
+
+		MVedAudioClipInfoObserver&		iView;
+	     /**
+         * Inserting failed to movie
+         */
+		TInt					iFailedCount;
+
+	     /**
+         * Files added to movie.
+         */
+		TInt					iInsertedCount;
+
+	     /**
+         * Total number of files in queue when processing is started.
+         */
+		TInt					iTotalCount;
+
+	     /**
+         * No description.
+         */
+		CVedVideoClipGenerator* iGenerator;
+
+	     /**
+         * No description.
+         */
+        CVedAudioClipInfo*      iAudioClipInfo;
+		CActiveSchedulerWait *iWaitScheduler;
+		TInt				iError;
+		TBool				iInsertVideoDialogOn;
+	};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VeiDisplayLighter.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+* Declares VeiCutAudioBar control for the video editor application.
+* 
+*/
+
+
+
+#ifndef VEIDISPLAYLIGHTER_H
+#define VEIDISPLAYLIGHTER_H
+
+#include <e32base.h>
+/**
+ * CVeiDisplayLighter control class.
+ */
+NONSHARABLE_CLASS( CVeiDisplayLighter ) : public CActive
+	{
+	public:
+		IMPORT_C static CVeiDisplayLighter* NewL();
+		IMPORT_C void Start();
+		IMPORT_C void Reset();
+		IMPORT_C void Stop();
+		virtual ~CVeiDisplayLighter();
+	protected:
+		void DoCancel();
+		void RunL();
+
+		CVeiDisplayLighter();
+		void ConstructL();
+
+	private:
+		RTimer iTimer;
+		TInt   iTimeout;
+	
+	};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VeiFrameTaker.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __FRAMETAKER_H
+#define __FRAMETAKER_H
+
+#include <vedmovie.h>
+
+class MVeiFrameTakerObserver
+	{
+
+public:
+
+	virtual void NotifyFramesCompleted( CFbsBitmap* aFirstFrame, CFbsBitmap* aLastFrame, 
+        CFbsBitmap* aTimelineFrame, TInt aError ) = 0;
+	};
+
+
+NONSHARABLE_CLASS( CVeiFrameTaker ):	public CActive,
+										public MVedVideoClipFrameObserver
+
+{
+public:
+    IMPORT_C static CVeiFrameTaker* NewL( MVeiFrameTakerObserver& aObserver );
+    ~CVeiFrameTaker();
+
+public:
+	IMPORT_C void GetFramesL(CVedVideoClipInfo& aInfo,
+							TInt const aFirstFrame, TSize* const aFirstResolution, 
+							TInt const aLastFrame, TSize* const aLastResolution,
+                            TInt const aTimelineFrame, TSize* const aTimelineResolution,
+							TInt aPriority);
+
+private:
+	CVeiFrameTaker( MVeiFrameTakerObserver& aObserver );
+	void ConstructL();
+
+	void DoCancel();
+	void RunL();
+
+	virtual void NotifyVideoClipFrameCompleted(CVedVideoClipInfo& aInfo, 
+											   TInt aError, 
+							 				   CFbsBitmap* aFrame);
+private:
+	CActiveSchedulerWait *iWaitScheduler;
+	CFbsBitmap*	iFirstFrame;
+	CFbsBitmap*	iLastFrame;
+    CFbsBitmap*	iTimelineFrame;
+
+	TInt		iFrameCount;
+	TInt		iError;
+
+	MVeiFrameTakerObserver& iObserver;
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VeiImageClipGenerator.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,446 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+#ifndef __VEIIMAGECLIPGENERATOR_H__
+#define __VEIIMAGECLIPGENERATOR_H__
+
+#include <e32base.h>
+
+#include <VedVideoClipGenerator.h>
+
+/*
+ * UID of this generator. The Uids are only used to identify generators
+ * in UI, the Engine does not use Uids for any purpose.
+ */
+#define KUidImageClipGenerator TUid::Uid(0x00000001)
+
+
+// Forward declarations
+class CVeiImageClipFrameOperation;
+class CVeiImageClipDecodeOperation;
+class CFbsBitmap;
+class CImageDecoder;
+class CVeiImageClipGenerator;
+class CBitmapScaler;
+
+
+/**
+ * Image clip generator observer.
+ */
+class MVeiImageClipGeneratorObserver
+	{
+public:
+	/**
+	 * Callback method to notify that the image clip generator initialization
+	 * is complete.
+	 *
+	 * @param aGenerator  generator that caused the event
+	 * @param aError	  error code
+	 */
+	virtual void NotifyImageClipGeneratorInitializationComplete(
+		CVeiImageClipGenerator& aGenerator, TInt aError) = 0;
+	};
+
+
+/**
+ * Image clip generator.
+ */
+class CVeiImageClipGenerator : public CVedVideoClipGenerator
+	{
+public:
+
+	/* Constructors / destructors. */
+
+	/**
+	 * Factory method. Creates a new image clip generator.
+	 * 
+	 * @param aFilename		  filename for the image
+	 * @param aMaxResolution  maximum resolution that will be used
+	 * @param aDuration		  duration of the image frame
+	 * @param aBackgroundColor  background color
+	 * @param aMaxDisplayMode	display mode in which the bitmap is stored
+	 * @param aFs			  RFs session to use for loading the image
+	 * @param aObserver		  observer that will be notified when the
+	 *						  initialization is complete
+	 *
+	 * @return  constructed image clip generator
+	 */
+	IMPORT_C static CVeiImageClipGenerator* NewL(const TDesC& aFilename,
+												 const TSize& aMaxResolution, 
+												 const TTimeIntervalMicroSeconds& aDuration, 
+												 const TRgb& aBackgroundColor,
+												 TDisplayMode aMaxDisplayMode,
+												 RFs& aFs,
+												 MVeiImageClipGeneratorObserver& aObserver);
+		
+	/**
+	 * Factory method. Creates a new image clip generator and leaves it
+	 * in the cleanup stack.
+	 * 
+	 * @param aFilename		    filename for the image
+	 * @param aMaxResolution    maximum resolution that will be used
+	 * @param aDuration		    duration of the image frame
+	 * @param aBackgroundColor  background color
+	 * @param aMaxDisplayMode	display mode in which the bitmap is stored
+	 * @param aFs			    RFs session to use for loading the image
+	 * @param aObserver		    observer that will be notified when the
+	 *						    initialization is complete
+	 *
+	 * @return  constructed image clip generator
+	 */
+	IMPORT_C static CVeiImageClipGenerator* NewLC(const TDesC& aFilename,
+												  const TSize& aMaxResolution,
+												  const TTimeIntervalMicroSeconds& aDuration, 
+												  const TRgb& aBackgroundColor,
+												  TDisplayMode aMaxDisplayMode,
+ 												  RFs& aFs,
+												  MVeiImageClipGeneratorObserver& aObserver);
+
+	/**
+	 * Destructor.
+	 */
+	IMPORT_C virtual ~CVeiImageClipGenerator();
+
+
+	/* Property methods. */
+
+	IMPORT_C virtual TPtrC DescriptiveName() const;
+
+	IMPORT_C virtual TUid Uid() const;
+
+    IMPORT_C virtual TTimeIntervalMicroSeconds Duration() const;
+
+
+	/* Video frame property methods. */
+
+    IMPORT_C virtual TInt VideoFrameCount() const ;
+
+	IMPORT_C virtual TTimeIntervalMicroSeconds VideoFrameStartTime(TInt aIndex) const;
+
+	IMPORT_C virtual TTimeIntervalMicroSeconds VideoFrameEndTime(TInt aIndex) const;
+
+	IMPORT_C virtual TTimeIntervalMicroSeconds VideoFrameDuration(TInt aIndex) const;
+
+	IMPORT_C virtual TBool VideoFrameIsIntra(TInt aIndex) const;
+
+	IMPORT_C virtual TInt VideoFirstFrameComplexityFactor() const;
+
+	IMPORT_C virtual TInt VideoFrameDifferenceFactor(TInt aIndex) const;
+
+    IMPORT_C virtual TInt GetVideoFrameIndex(TTimeIntervalMicroSeconds aTime) const;
+
+
+	/* Frame methods. */
+
+	IMPORT_C virtual void GetFrameL(MVedVideoClipGeneratorFrameObserver& aObserver,
+                           TInt aIndex,
+		                   TSize* const aResolution,
+						   TDisplayMode aDisplayMode,
+						   TBool aEnhance,
+						   TInt aPriority);
+    
+	IMPORT_C virtual void CancelFrame();
+
+
+	/* New methods. */
+
+	/**
+	 * Sets the duration.
+	 *
+	 * @param aDuration  duration
+	 */
+	IMPORT_C void SetDuration(const TTimeIntervalMicroSeconds& aDuration);
+
+	/**
+	 * Sets the background color.
+	 *
+	 * @param aBackgroundColor
+	 */
+	IMPORT_C void SetBackgroundColor(const TRgb& aBackgroundColor);
+
+	/**
+	 * Gets the background color.
+	 * 
+	 * @return  background color
+	 */
+	IMPORT_C const TRgb& BackgroundColor() const;
+
+	/**
+	 * Returns the image file name.
+	 *
+	 * @return  filename
+	 */
+	IMPORT_C TPtrC ImageFilename() const;
+
+private: // constructors
+	
+	/**
+	 * First-phase constructor.
+	 * 
+	 * @param aDuration        duration
+	 * @param aBackgroundColor background color 
+	 * @param aMaxResolution   maximum resolution
+	 */
+	CVeiImageClipGenerator(const TTimeIntervalMicroSeconds& aDuration, 
+						   const TRgb& aBackgroundColor,
+						   const TSize& aMaxResolution);
+
+	/**
+	 * Second-phase constructor.
+	 * 
+	 * @param aFilename       filename of the image
+	 * @param aObserver       observer
+	 * @param aMaxDisplyMode  display mode
+	 * @param aFs             RFs session
+	 */
+	void ConstructL(const TDesC& aFilename, 
+					MVeiImageClipGeneratorObserver& aObserver,
+					TDisplayMode aMaxDisplayMode, RFs& aFs);
+
+	
+private:
+	/**
+	 * Updates the first frame complexity factor.
+	 */
+	void UpdateFirstFrameComplexityFactorL();
+
+private:
+    // Member variables
+
+	/** Flag for readiness indication. */
+	TBool iReady;
+
+	/** First frame complexity factor. */
+	TInt iFirstFrameComplexityFactor;
+
+	/** Resolution. */
+	TSize iMaxResolution;
+
+	/** Duration. */
+	TTimeIntervalMicroSeconds iDuration;
+
+	/** Background color. */
+	TRgb iBackgroundColor;
+
+	/** Image decode operation. */
+	CVeiImageClipDecodeOperation* iDecodeOperation;
+
+	/** Frame generating operation. */
+	CVeiImageClipFrameOperation* iFrameOperation;
+
+	/** Descriptive name. */
+	HBufC* iDescriptiveName;
+
+	/** Image filename */
+	HBufC* iFilename;
+	
+	/** Bitmap. */
+	CFbsBitmap* iBitmap;
+
+	/** Mask. */
+	CFbsBitmap* iMask;
+
+	/** Is the generator initializing? */
+	TBool iInitializing;
+
+	/** Frame count. */
+	TInt iFrameCount;
+
+	friend class CVeiImageClipDecodeOperation;
+	};
+
+
+/**
+ * Image decode operation. Helper class for decoding the image and 
+ * performing first-stage resizing.
+ */
+class CVeiImageClipDecodeOperation : public CActive
+	{
+	public: 
+		/**
+		 * Factory constructor. 
+		 * 
+		 * @param aGenerator  generator that owns this operation
+		 * @param aFilename	  filename for the image
+		 * @param aObserver	  observer that will be notified when the
+		 *					  operation completes
+		 * @param aFs		  RFs session to use for loading the image
+		 * @param aPriority   priority of the active object
+		 *
+		 * @return  constructed image clip decode operation
+		 */
+		static CVeiImageClipDecodeOperation* NewL(CVeiImageClipGenerator& aGenerator,
+												  const TDesC& aFilename, 
+												  MVeiImageClipGeneratorObserver& aObserver,
+												  RFs& aFs,
+												  TInt aPriority = CActive::EPriorityStandard);
+		/**
+		 * Destructor.
+		 */
+		virtual ~CVeiImageClipDecodeOperation();
+
+		virtual void RunL();
+		virtual void DoCancel();
+		virtual TInt RunError(TInt aError);
+
+		/**
+		 * Starts the operation.
+		 * 
+		 * @param aMaxResolution  maximum resolution that will be used
+		 * @param aDisplayMode	  display mode
+		 */
+		void StartOperationL(const TSize& aMaxResolution, TDisplayMode aDisplayMode);
+
+	private: // methods
+
+		/**
+		 * First-phase constructor.
+		 *
+		 * @param aGenerator  generator that owns this operation
+		 * @param aObserver	  observer that will be notified when the
+		 *					  operation completes
+		 * @param aPriority   priority of the active object
+		 */
+		CVeiImageClipDecodeOperation(CVeiImageClipGenerator& aGenerator, 
+									 MVeiImageClipGeneratorObserver& aObserver,
+									 TInt aPriority);
+
+		/**
+		 * Second-phase constructor.
+		 *
+ 		 * @param aFilename	  filename for the image
+		 * @param aFs		  RFs session to use for loading the image
+		 */
+
+		void ConstructL(const TDesC& aFilename, RFs& aFs);
+
+	private: // members
+
+		/** Generator that owns this operation*/
+		CVeiImageClipGenerator& iGenerator;
+
+		/** Observer to be notified when the operation completes. */
+		MVeiImageClipGeneratorObserver& iObserver;
+
+		/** Decoder. */
+		CImageDecoder* iDecoder;
+
+		/** Bitmap. */
+		CFbsBitmap* iBitmap;
+
+		/** Mask. */
+		CFbsBitmap* iMask;
+	};
+
+
+/**
+ * Image frame operation.
+ */
+class CVeiImageClipFrameOperation : public CActive
+	{
+	public: 
+		/**
+		 * Factory constructor. 
+		 * 
+		 * @param aGenerator  generator that owns this operation
+		 *
+		 * @return  constructed image clip frame operation
+		 */
+		static CVeiImageClipFrameOperation* NewL(CVeiImageClipGenerator& aGenerator);
+
+		/**
+		 * Destructor. 
+		 */
+		virtual ~CVeiImageClipFrameOperation();
+
+		/**
+		 * Starts the operation.
+		 *
+		 * @param aObserver      observer to notify when the frame is complete
+		 * @param aIndex         index of the frame to generate
+		 * @param aEnhance       <code>ETrue</code> to produce better results
+		 *                       but slower, <code>EFalse</code> to be as fast
+		 *                       as possible.
+		 * @param aSourceBitmap  source bitmap
+		 * @param aDestBitmap    destination bitmap
+		 * @param aSourceMask    source mask
+		 * @param aPriority      priority for the active object
+		 *
+		 */
+		void StartOperationL(MVedVideoClipGeneratorFrameObserver* aObserver, 
+			TInt aIndex, TBool aEnhance, CFbsBitmap* aSourceBitmap, 
+			CFbsBitmap* aDestBitmap, CFbsBitmap* aSourceMask, TInt aPriority);
+
+		virtual void RunL();
+		virtual void DoCancel();
+		virtual TInt RunError(TInt aError);
+
+	private: // methods
+		/**
+		 * First-phase constructor.
+		 * 
+		 * @param aGenerator  generator that owns this operation
+		 */
+		CVeiImageClipFrameOperation(CVeiImageClipGenerator& aGenerator);
+
+		/**
+		 * Second-phase constructor.
+		 */
+		void ConstructL();
+
+	private: // members
+		/** Generator. */
+		CVeiImageClipGenerator& iGenerator;
+
+		/** Index of the frame being generated. */
+		TInt iIndex;
+
+		/** Whether to be fast or do quality work. */
+		TBool iEnhance;
+
+		/** Source bitmap. */
+		CFbsBitmap* iSourceBitmap;
+
+		/** Destination bitmap. */
+		CFbsBitmap* iDestBitmap;
+
+		/** Scaled bitmap. */
+		CFbsBitmap* iScaledBitmap;
+
+		/** Scaled mask. */
+		CFbsBitmap* iScaledMask;
+
+		/** Source mask. */
+		CFbsBitmap* iSourceMask;
+
+		/** Scaler. */
+		CBitmapScaler* iScaler;
+
+		/** Flag for no scaling. */
+		TBool iNoScaling;
+
+		/** Observer. */
+		MVedVideoClipGeneratorFrameObserver* iObserver;
+	};
+
+
+
+#endif // __VEIIMAGECLIPGENERATOR_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VeiImageConverter.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+// INCLUDE FILES
+#ifndef IMAGECONVERTER_H
+#define IMAGECONVERTER_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>
+#include <ImageConversion.h>
+
+class CFbsBitmap;
+class CBitmapRotator;
+class CBitmapScaler;
+
+/**
+ * Observer for notifying that image conversion is ready.
+ * 
+ */
+class MConverterController
+	{
+	public:
+		/**
+		* Called to notify that image conversion is completed
+		* 
+		*/
+		virtual void NotifyCompletion( TInt aErr ) = 0;
+		
+	};
+/**
+* Utility class for image conversion.
+*/
+NONSHARABLE_CLASS( CVeiImageConverter ) : public CActive
+	{
+	// states for this object
+	enum TState 
+		{
+		EIdle = 0,
+		EEncoding,
+		EScaling
+		};
+
+	public: // contructors/destructors
+
+		/**
+		* NewL 
+		* Create a CVeiImageConverter object and return a pointer to it.
+		*
+		* @param aController Pointer to a MConverterController interface.
+		* The engine uses NotifyCompletion callback from this interface
+		* to notify the controller about completions of coding or 
+		* encoding requests.
+		*		 
+		* @return a pointer to the created engine
+		*/	
+		IMPORT_C static CVeiImageConverter* NewL( MConverterController* aController );
+	
+		IMPORT_C ~CVeiImageConverter();
+
+	public: // interface methods
+
+		IMPORT_C CFbsBitmap* GetBitmap();
+		IMPORT_C void SetBitmap(CFbsBitmap* aBitmap);
+
+		/** StartToEncodeL 
+		* Starts to encode an image to a file. When completed calls 
+		* NotifyCompletion, from iController.
+		*
+		* @param aFileName Full path and filename to the image to be encoded.
+		*		 
+		* @returns Nothing
+		*/
+		IMPORT_C void StartToEncodeL( const TDesC& aFileName, 
+			const TUid& aImageType, const TUid& aImageSubType );
+		
+		/**
+		* GetEncoderImageTypesL
+		* Gets descriptions of supported (encoding) image types. 
+		*
+		* @param aImageTypeArray Reference to an array to be filled.
+		*
+		* @return Nothing 
+		*/
+		IMPORT_C static void GetEncoderImageTypesL( 
+			RImageTypeDescriptionArray& aImageTypeArray );
+
+		IMPORT_C void CancelEncoding();
+		
+		IMPORT_C void ScaleL(CFbsBitmap* aSrcBitmap,CFbsBitmap* aDestBitmap, const TSize& aSize);
+	
+
+	protected: // implementation of CActive
+		void DoCancel();
+		void RunL();
+		TInt RunError(TInt aError);
+
+	private: // internal methods
+		CVeiImageConverter( MConverterController* aController ); 
+		void ConstructL();
+
+	public: // data	
+
+		/** Decoded image. */
+		CFbsBitmap* iBitmap;
+
+	private: // internal data
+
+		/** ui controller. */
+		MConverterController* iController; 
+		
+		/** for opening/saving images from/to files. */
+		RFs iFs; 
+		
+		/** decoder from ICL API. */
+		//CImageDecoder* iImageDecoder; // 
+
+		/** encoder from ICL API. */
+		CImageEncoder* iImageEncoder; 
+		CBitmapScaler* iBitmapScaler;
+	
+		TState iState;
+	};
+
+#endif 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VeiMGFetchVerifier.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+
+#ifndef VEIMGFETCHVERIFIER_H
+#define VEIMGFETCHVERIFIER_H
+
+#include <mmgfetchverifier.h>
+#include <ConeResLoader.h>
+
+/**
+ * CVeiMGFetchVerifier class.
+ */
+NONSHARABLE_CLASS( CVeiMGFetchVerifier ) : public CBase, public MMGFetchVerifier
+	{
+	public:
+		IMPORT_C static CVeiMGFetchVerifier* NewLC();
+		IMPORT_C virtual ~CVeiMGFetchVerifier();
+        IMPORT_C virtual TBool VerifySelectionL( const MDesCArray* aSelectedFiles );
+
+	private:
+		CVeiMGFetchVerifier();
+		void ConstructL();
+	
+	private:
+		RConeResourceLoader 	iResLoader;
+	};
+#endif
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VeiRemConTarget.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEIREMCONTARGET_H
+#define VEIREMCONTARGET_H
+
+//  INCLUDES
+#include <remconcoreapitargetobserver.h>
+
+// FORWARD DECLARATIONS
+class CRemConCoreApiTarget;
+class CRemConInterfaceSelector;
+
+// CLASS DECLARATION
+
+class MVeiMediakeyObserver
+	{
+	public:
+		 
+     	virtual void HandleVolumeUpL() = 0;	
+     	virtual void HandleVolumeDownL() = 0;
+	};
+
+/**
+*  mgx listener for RemCon commands.
+*/
+NONSHARABLE_CLASS( CVeiRemConTarget ) :	public CBase, public MRemConCoreApiTargetObserver
+    {
+    public:  // Methods
+
+	// Constructors and destructor
+
+        /**
+        * Static constructor.
+        */
+        IMPORT_C static CVeiRemConTarget* NewL(MVeiMediakeyObserver& aObserver);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVeiRemConTarget();
+
+	// Methods from base classes
+
+		/**
+		* From MRemConCoreApiTargetObserver MrccatoCommand.
+		* A command has been received. 
+		* @param aOperationId The operation ID of the command.
+		* @param aButtonAct The button action associated with the command.
+		*/
+		void MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct);
+
+		/**
+		* From MRemConCoreApiTargetObserver MrccatoPlay.
+		* A 'play' command has been received. 
+		* @param aSpeed The playback speed.
+		* @param aButtonAct The button action associated with the command.
+		*/
+		void MrccatoPlay(TRemConCoreApiPlaybackSpeed aSpeed, TRemConCoreApiButtonAction aButtonAct);
+
+		/**
+		* From MRemConCoreApiTargetObserver MrccatoTuneFunction.
+		* A 'tune function' command has been received.
+		* @param aTwoPart If EFalse, only aMajorChannel is to be used. Otherwise, 
+		* both aMajorChannel and aMinorChannel are to be used.
+		* @param aMajorChannel The major channel number.
+		* @param aMinorChannel The minor channel number.
+		* @param aButtonAct The button action associated with the command.
+		*/
+		void MrccatoTuneFunction(TBool aTwoPart, TUint aMajorChannel, TUint aMinorChannel, TRemConCoreApiButtonAction aButtonAct);
+
+		/**
+		* From MRemConCoreApiTargetObserver MrccatoSelectDiskFunction.
+		* A 'select disk function' has been received.
+		* @param aDisk The disk.
+		* @param aButtonAct The button action associated with the command.
+		*/
+		void MrccatoSelectDiskFunction(TUint aDisk, TRemConCoreApiButtonAction aButtonAct);
+
+		/**
+		* From MRemConCoreApiTargetObserver MrccatoSelectAvInputFunction.
+		* A 'select AV input function' has been received.
+		* @param aAvInputSignalNumber The AV input.
+		* @param aButtonAct The button action associated with the command.
+		*/
+		void MrccatoSelectAvInputFunction(TUint8 aAvInputSignalNumber, TRemConCoreApiButtonAction aButtonAct);
+
+		/**
+		* From MRemConCoreApiTargetObserver MrccatoSelectAudioInputFunction.
+		* A 'select audio input function' has been received.
+		* @param aAudioInputSignalNumber The audio input.
+		* @param aButtonAct The button action associated with the command.
+		*/
+		void MrccatoSelectAudioInputFunction(TUint8 aAudioInputSignalNumber, TRemConCoreApiButtonAction aButtonAct);
+
+    protected:  // Methods
+
+    private: //Methods
+
+		/**
+        * C++ default constructor.
+        */
+        CVeiRemConTarget(MVeiMediakeyObserver& aObserver);
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+    	
+    	MVeiMediakeyObserver& iObserver;
+		// RemCon interface selector.
+    	CRemConInterfaceSelector*	iInterfaceSelector;
+		// RemCon Core API target class.
+		CRemConCoreApiTarget*		iCoreTarget;
+	    };
+
+#endif      //VEIREMCONTARGET_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VeiSettings.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEISETTINGS_H__
+#define __VEISETTINGS_H__
+
+#include <s32strm.h>
+#include <CAknMemorySelectionDialog.h>
+
+// Max size of serialized settings object:
+//	DefaultSnapshotName	256 bytes
+//	DefaultVideoName	256 bytes
+//	MemoryInUse			8 bit
+//	SaveQuality			8 bit
+const TInt KveiSettingsMaxSerializedSizeInBytes = 520;
+
+NONSHARABLE_CLASS( TVeiSettings )
+	{
+    public:     // Enumerations
+
+        enum TSaveQuality 
+            {
+            EAuto = 0,
+            EMmsCompatible,
+            EMedium,
+            EBest
+            };
+
+	public:
+		/** 
+		 * Getter/setter for default snapshot name, non-const
+		 */
+		IMPORT_C TDes& DefaultSnapshotName();
+	
+		/**
+		 * Getter for default snapshot name, const
+		 */
+		IMPORT_C TPtrC DefaultSnapshotName() const;
+
+		/**
+		 * Getter/setter for default video name, non-const
+		 */
+		IMPORT_C TDes& DefaultVideoName();
+
+		/**
+		 * Getter for default video name, const
+		 */
+		IMPORT_C TPtrC DefaultVideoName() const;
+
+		/**
+		 * Getter/setter for used memory, non-const
+		 */
+		IMPORT_C CAknMemorySelectionDialog::TMemory& MemoryInUse();
+
+		/**
+		 * Getter for used memory, const
+		 */
+		IMPORT_C const CAknMemorySelectionDialog::TMemory& MemoryInUse() const;
+
+        /**
+         * Getter for save quality, const
+         */
+        IMPORT_C TInt& SaveQuality();
+
+        /**
+         * Getter for save quality, const
+         */
+        IMPORT_C TInt SaveQuality() const;
+
+		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
+
+		IMPORT_C void InternalizeL(RReadStream& aStream);
+
+#ifdef SETTINGS_TO_CENREP
+	public:
+        /**
+         * Load values from Central Repository
+         */
+		void LoadL();
+
+        /**
+         * Save values to Central Repository
+         */
+		void SaveL() const;
+#endif
+
+	private:  // Member data.
+		/**
+		 * Default snapshot name.
+		 */
+		TBuf<128>	iDefaultSnapshotName;
+	
+		/**
+		 * Default video name.
+		 */
+		TBuf<128>	iDefaultVideoName;
+
+		/**
+		 * Memory in use.
+		 */
+		CAknMemorySelectionDialog::TMemory iMemoryInUse;
+
+        /**
+         * Save quality.
+         */
+        TSaveQuality        iSaveQuality;
+
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VeiTempMaker.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEITEMPMAKER_H
+#define __VEITEMPMAKER_H
+
+#include <e32base.h>
+#include <e32def.h>
+#include <caknmemoryselectiondialog.h>
+#include <vedcommon.h>
+/**
+* CVeiTempMaker. Class for temporary file actions(filename, clean up).
+*
+*/
+NONSHARABLE_CLASS( CVeiTempMaker ) : public CBase
+	{
+	public:
+		/**
+		 * Static factory constructor.
+		 *
+		 * @return  created instance
+		 */
+		IMPORT_C static CVeiTempMaker* NewL();
+
+		/**
+		 * Static factory constructor. Leaves the created instance in the
+		 * cleanup stack.
+		 *
+		 * @return  created instance
+		 */
+		IMPORT_C static CVeiTempMaker* NewLC();
+
+		/**
+		 * Destructor.
+		 */
+		IMPORT_C ~CVeiTempMaker();
+
+		IMPORT_C void EmptyTempFolder() const;
+
+		IMPORT_C void GenerateTempFileName( 
+			HBufC& aTempPathAndName, 
+			CAknMemorySelectionDialog::TMemory aMemory,
+			TVedVideoFormat aVideoFormat,
+			TBool aExtAMR = EFalse ) const;
+
+	private:
+		/**
+		 * Default constructor.
+		 */
+		void ConstructL();
+
+		/**
+		 * Default constructor.
+		 */
+		CVeiTempMaker();
+	
+		TBool GetTempPath( const CAknMemorySelectionDialog::TMemory& aMemory, TDes& aTempPath ) const;
+		
+//		void ListFilesL(const TDesC& aFindFromDir, const TDesC& aWriteResultTo) const;
+		
+		void DoEmptyTempFolderL() const;
+	};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VeiTitleClipGenerator.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,586 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+#ifndef __VEITITLECLIPGENERATOR_H__
+#define __VEITITLECLIPGENERATOR_H__
+
+#include <e32base.h>
+
+#include <VedVideoClipGenerator.h>
+
+/*
+ * UID of this generator. The Uids are only used to identify generators
+ * in UI, the Engine does not use Uids for any purpose.
+ */
+#define KUidTitleClipGenerator TUid::Uid(0x00000002)
+
+
+// Forward declarations
+
+class CVeiTitleClipGenerator;
+//class CVeiTitleClipMainTitleFrameOperation;
+//class CVeiTitleClipScrollerFrameOperation;
+class CVeiTitleClipImageDecodeOperation;
+class CFbsBitmap;
+class CBitmapScaler;
+class CImageDecoder;
+class CFont;
+
+// Enumerations
+
+/**
+ * Title clip style.
+ */
+enum TVeiTitleClipVerticalAlignment 
+	{
+	EVeiTitleClipVerticalAlignmentTop,
+	EVeiTitleClipVerticalAlignmentBottom,
+	EVeiTitleClipVerticalAlignmentCenter
+	};
+
+/**
+ * Title clip justification.
+ */
+enum TVeiTitleClipHorizontalAlignment
+	{
+	EVeiTitleClipHorizontalAlignmentLeft,
+	EVeiTitleClipHorizontalAlignmentRight,
+	EVeiTitleClipHorizontalAlignmentCenter
+	};
+
+/**
+ * Title clip transition.
+ */
+enum TVeiTitleClipTransition 
+	{
+	EVeiTitleClipTransitionNone = 0,
+	EVeiTitleClipTransitionScrollLeftToRight,
+	EVeiTitleClipTransitionScrollRightToLeft,
+	EVeiTitleClipTransitionScrollTopToBottom,
+	EVeiTitleClipTransitionScrollBottomToTop,
+	EVeiTitleClipTransitionFade
+	};
+
+
+
+/**
+ * Observer for title clip generator.
+ */
+class MVeiTitleClipGeneratorObserver
+	{
+public:
+	/**
+	 * Notifies that the title clip generator has finished loading and
+	 * preparing the background image.
+	 *
+	 * @param aGenerator  generator that caused the event
+	 * @param aError      error code
+	 */
+	virtual void NotifyTitleClipBackgroundImageLoadComplete(CVeiTitleClipGenerator& aGenerator, TInt aError) = 0;
+	};
+
+/**
+ * Title clip generator.
+ */
+class CVeiTitleClipGenerator : public CVedVideoClipGenerator
+	{
+public:
+
+	/* Constructors / destructors. */
+
+	IMPORT_C static CVeiTitleClipGenerator* NewL(const TSize& aMaxResolution, 
+		TVeiTitleClipTransition aTransition, 
+		TVeiTitleClipHorizontalAlignment aHorizontalAlignment,
+		TVeiTitleClipVerticalAlignment aVerticalAlignment);
+
+	IMPORT_C static CVeiTitleClipGenerator* NewLC(const TSize& aMaxResolution,
+		TVeiTitleClipTransition aTransition,
+		TVeiTitleClipHorizontalAlignment aHorizontalAlignment,
+		TVeiTitleClipVerticalAlignment aVerticalAlignment);
+
+	IMPORT_C virtual ~CVeiTitleClipGenerator();
+
+	/* Property methods. */
+
+	IMPORT_C virtual TPtrC DescriptiveName() const;
+
+	IMPORT_C virtual TUid Uid() const;
+	
+    IMPORT_C virtual TTimeIntervalMicroSeconds Duration() const;
+
+
+	/* Video frame property methods. */
+
+    IMPORT_C virtual TInt VideoFrameCount() const;
+
+	IMPORT_C virtual TTimeIntervalMicroSeconds VideoFrameStartTime(TInt aIndex) const;
+
+	IMPORT_C virtual TTimeIntervalMicroSeconds VideoFrameEndTime(TInt aIndex) const;
+
+	IMPORT_C virtual TTimeIntervalMicroSeconds VideoFrameDuration(TInt aIndex) const;
+
+    IMPORT_C virtual TInt GetVideoFrameIndex(TTimeIntervalMicroSeconds aTime) const;
+
+	IMPORT_C virtual TInt VideoFirstFrameComplexityFactor() const;
+
+	IMPORT_C virtual TInt VideoFrameDifferenceFactor(TInt aIndex) const;
+
+
+	/* Frame methods. */
+
+	IMPORT_C virtual void GetFrameL(MVedVideoClipGeneratorFrameObserver& aObserver,
+                           TInt aIndex,
+		                   TSize* const aResolution,
+						   TDisplayMode aDisplayMode,
+						   TBool aEnhance,
+						   TInt aPriority);
+    
+	IMPORT_C virtual void CancelFrame();
+		
+
+
+	/* New methods. */
+
+	/**
+	 * Sets the text for the generator.
+	 *
+	 * @param aText  text for the generator
+	 */
+	IMPORT_C void SetTextL(const TDesC& aText);
+
+	/**
+	 * Returns the text for this generator.
+	 *
+	 * @return  text for the generator
+	 */
+	IMPORT_C TPtrC Text() const;
+
+	/**
+	 * Returns the transition of this title screen clip.
+	 *
+	 * @return  transition
+	 */
+	IMPORT_C TVeiTitleClipTransition Transition() const;
+
+	/**
+	 * Returns the horizontal alignment.
+	 * 
+	 * @return  horizontal alignment
+	 */
+	IMPORT_C TVeiTitleClipHorizontalAlignment HorizontalAlignment() const;
+
+	/**
+	 * Returns the vertical alignment.
+	 * 
+	 * @return  vertical alignment
+	 */
+	IMPORT_C TVeiTitleClipVerticalAlignment VerticalAlignment() const;
+
+	/**
+	 * Sets the transiton and alignments. They are all tied together
+	 * to allow them to be set at once to avoid generating several 
+	 * thumbnails when setting many options at the same time.
+	 *
+	 * @param aTransition  transition for the generator.
+	 * @param aHorizontalAlignment  horizontal alignment
+	 * @param aVerticalAlignment  vertical alignment
+	 */
+	IMPORT_C void SetTransitionAndAlignmentsL(TVeiTitleClipTransition aTransition,
+		TVeiTitleClipHorizontalAlignment aHorizontalAlignment,
+		TVeiTitleClipVerticalAlignment aVerticalAlignment);
+
+	/**
+	 * Returns the background color.
+	 *
+	 * @return  background color.
+	 */
+	IMPORT_C TRgb BackgroundColor() const;
+
+	/**
+	 * Sets the background color. This is used only if no background image
+	 * is set.
+	 *
+	 * @param aBacgroundColor  background color
+	 */ 
+	IMPORT_C void SetBackgroundColorL(const TRgb& aBackgroundColor);
+
+	/**
+	 * Returns the text color.
+	 *
+	 * @return  text color.
+	 */
+	IMPORT_C TRgb TextColor() const;
+
+	/**
+	 * Sets the text color. 
+	 *
+	 * @param aBacgroundColor  text color
+	 */ 
+	IMPORT_C void SetTextColorL(const TRgb& aTextColor);
+
+	/**
+	 * Sets the background image. Transfers the ownership of the bitmap
+	 * to the generator.
+	 *
+	 * @param aBackgroundImage  background image
+	 */
+	IMPORT_C void SetBackgroundImageL(const CFbsBitmap* aBackgroundImage);
+
+	/**
+	 * Sets the background image from the specified file. 
+	 *
+	 * @param aFilename  filename for the image to load
+	 * @param aObserver  observer to notify when loading is complete
+	 */
+	IMPORT_C void SetBackgroundImageL(const TDesC& aFilename, MVeiTitleClipGeneratorObserver& aObserver);
+
+	/**
+	 * Returns the background image.
+	 *
+	 * @return  background image
+	 */
+	IMPORT_C CFbsBitmap* BackgroundImage() const;
+
+	/**
+	 * Sets the duration.
+	 *
+	 * @param aDuration  duration
+	 */
+	IMPORT_C void SetDuration(const TTimeIntervalMicroSeconds& aDuration);
+
+	/**
+	 * Sets the descriptive name.
+	 *
+	 * @param aDescriptiveName  descriptive name
+	 */
+	IMPORT_C void SetDescriptiveNameL(const TDesC& aDescriptiveName);
+
+private: 
+	// from MVedVideoClipGeneratorFrameObserver	
+	void NotifyVideoClipGeneratorFrameCompleted(CVedVideoClipGenerator& aGenerator, TInt aError, CFbsBitmap* aBitmap);
+
+private: // constructors
+	
+	/**
+	 * First-phase constructor. 
+	 * 
+	 * @param aMaxResolution		maximum resolution
+	 * @param aTransition			transition
+	 * @param aHorizontalAlignment	horizontal alignment
+	 * @param aVerticalAlignment	vertical alignment
+	 */
+	CVeiTitleClipGenerator(const TSize& aMaxResolution, 
+						   TVeiTitleClipTransition aTransition, 
+						   TVeiTitleClipHorizontalAlignment aHorizontalAlignment,
+						   TVeiTitleClipVerticalAlignment aVerticalAlignment);
+
+	/**
+	 * Second-phase constructor.
+	 */
+	void ConstructL();
+
+private: // new methods
+
+	/**
+	 * Wrap the input text into lines.
+	 */
+	void WrapTextToArrayL(const TDesC& aText);
+
+	/**
+	 * Updates the first frame complexity factor value.
+	 */
+	void UpdateFirstFrameComplexityFactorL();
+
+	/**
+	 * Calculates the fading transition start and end indices.
+	 *
+	 * @param  aInEndFrame     for returning the end frame of in-transition
+	 * @param  aOutStartFrame  for returning the start frame of out-transition
+	 * @param  aNumberOfFrames for returning number of frames
+	 */
+	void CalculateTransitionFrameIndices(TInt& aInEndFrame, TInt& aOutStartFrame) const;
+
+	/**
+	 * Gets the text font suitable for the current frame resolution.
+	 */
+	void GetTextFont(TInt aFontDivisor = 0);
+
+	/**
+	 * Draws wrapped texts on the specified bitmap.
+	 *
+	 * @param aBitmap       bitmap to draw on
+	 * @param aTextPoint    text starting point
+	 * @param aTextColor    text color
+	 * @param aBgColor      background color
+	 * @param aShadowColor  shadow color
+	 */
+	void DrawWrappedTextL(CFbsBitmap& aBitmap, const TPoint& aTextPoint, const TRgb& aTextColor,
+		const TRgb& aBgColor, const TRgb& aShadowColor, TBool aDrawBackground);
+
+	/**
+	 * Finishes the GetFrameL() call.
+	 */
+	CFbsBitmap* FinishGetFrameL(TInt aError = KErrNone);
+
+	/**
+	 * Synchronous method for getting the first frame for complexity
+	 * calculation.
+	 *
+	 * @return  first frame
+	 */
+	CFbsBitmap* GetFirstFrameL();
+
+	/**
+	 * Draws the main title frame on a specified bitmap.
+	 *
+	 * @param aBitmap  bitmap to draw on
+	 * @param aIndex   index of the frame to draw
+	 */
+	void DrawMainTitleFrameL(CFbsBitmap& aBitmap, TInt aIndex);
+
+	/**
+	 * Draws the scroll title frame on a specified bitmap.
+	 *
+	 * @param aBitmap  bitmap to draw on
+	 * @param aIndex   index of the frame to draw
+	 */
+	void DrawScrollTitleFrameL(CFbsBitmap& aBitmap, TInt aIndex);
+
+	/**
+	 * Get the maximum frame rate, which is either the movie's 
+	 * frame rate, of the hard-coded maximum value.
+	 *
+	 * @return  max frames per second
+	 */
+	TInt MaximumFramerate() const;
+
+private:
+    // Member variables
+
+	/** First frame complexity factor. */
+	TInt iFirstFrameComplexityFactor;
+
+	/** Text. */
+	HBufC* iText;
+
+	/** Font for the text */
+	const CFont* iTextFont;
+
+	/** Resolution used to calculate font size. */
+	TSize iGetFontResolution;
+
+	/** Desciptive name. */
+	HBufC* iDescriptiveName;
+
+	/** Wrapped text pointer array. */
+	CArrayFix<TPtrC>* iWrappedArray;
+
+	/** Height of the wrapped text box. */
+	TInt iWrappedTextBoxHeight;
+
+	/** Resolution. */
+	TSize iMaxResolution;
+
+	/** Duration. */
+	TTimeIntervalMicroSeconds iDuration;
+
+	/** Transition. */
+	TVeiTitleClipTransition iTransition;
+
+	/** Horizontal alignment. */
+	TVeiTitleClipHorizontalAlignment iHorizontalAlignment;
+
+	/** Vertical alignment. */
+	TVeiTitleClipVerticalAlignment iVerticalAlignment;
+
+	/** Background image decode operation. */
+	CVeiTitleClipImageDecodeOperation* iDecodeOperation;
+	
+	/** Background color. */
+	TRgb iBackgroundColor;
+	
+	/** Text color. */
+	TRgb iTextColor;
+
+	/** Flag for notifying setting change. */
+	TBool iSettingsChanged;
+
+	/** Background image. */
+	CFbsBitmap* iBackgroundImage;
+
+	/** Scaled background image. */
+	CFbsBitmap* iScaledBackgroundImage;
+
+	/** Flag indicating that we should use the scaled bitmap. */
+	TBool iUseScaledImage;
+
+
+	/* 
+	 * Following member variables are temporary storage for the two-phase 
+	 * GetFrameL. 
+	 */
+
+	/** Observer. */
+	MVedVideoClipGeneratorFrameObserver* iGetFrameObserver;
+	/**	Index. */
+    TInt iGetFrameIndex;
+	/** Resolution. */
+	TSize iGetFrameResolution;
+	/** DisplayMode. */
+	TDisplayMode iGetFrameDisplayMode;
+	/** Enhance flag. */
+	TBool iGetFrameEnhance;
+	/** Priority. */
+	TInt iGetFramePriority;
+
+	/* Operation classes need to be our friends. */
+	friend class CVeiTitleClipImageDecodeOperation;
+	};
+
+/**
+ * Image decode operation. Helper class for decoding the image and 
+ * performing first-stage resizing.
+ */
+class CVeiTitleClipImageDecodeOperation : public CActive
+	{
+	public: 
+		/**
+		 * Factory constructor method. Constructs a decode operation.
+		 *
+		 * @param aGenerator  generator that owns this operation 
+		 * @param aObserver   observer that will be notified when the
+		 *                    operation is complete
+		 * @param aFilename   filename of the image to be decoded
+		 * @param aPriority   priority of the active object
+		 *
+		 * @return  constructed instance of decode operation
+		 */
+		static CVeiTitleClipImageDecodeOperation* NewL(CVeiTitleClipGenerator& aGenerator,
+													   MVeiTitleClipGeneratorObserver& aObserver,
+													   const TDesC& aFilename,
+													   TInt aPriority = CActive::EPriorityStandard);
+
+
+		/**
+		 * Factory constructor method. Constructs a decode operation.
+		 *
+		 * @param aGenerator  generator that owns this operation 
+		 * @param aSourceBitmap source bitmap
+		 * @param aPriority   priority of the active object
+		 *
+		 * @return  constructed instance of decode operation
+		 */
+		static CVeiTitleClipImageDecodeOperation* NewL(CVeiTitleClipGenerator& aGenerator,
+													   CFbsBitmap* aSourceBitmap,
+													   TInt aPriority = CActive::EPriorityStandard);
+
+		/**
+		 * Destructor.
+		 */
+		virtual ~CVeiTitleClipImageDecodeOperation();
+
+		virtual void RunL();
+		virtual void DoCancel();
+		virtual TInt RunError(TInt aError);
+
+		/**
+		 * Starts the loading operation. 
+		 * 
+		 * @param aMaxResolution  maximum resolution that will be used
+		 */
+		void StartLoadOperationL(const TSize& aMaxResolution);
+
+		/**
+		 * Starts the scaling operation. 
+		 * 
+		 * @param aResolution  resolution for the image
+		 */
+		void StartScalingOperationL(const TSize& aResolution);
+
+	private: // methods
+		/**
+		 * EPOC first-phase constructor.
+		 *
+		 * @param aGenerator  generator that owns this decode operation
+		 * @param aObserver   observer to notify when the operation is
+		 *                    complete
+		 * @param aPriority   priority for the active object
+		 */
+		CVeiTitleClipImageDecodeOperation(CVeiTitleClipGenerator& aGenerator,
+										  MVeiTitleClipGeneratorObserver& aObserver,
+										  TInt aPriority = CActive::EPriorityStandard);
+
+		/**
+		 * EPOC first-phase constructor.
+		 *
+		 * @param aGenerator    generator that owns this decode operation
+		 * @param aSourceBitmap source bitmap
+		 * @param aPriority     priority for the active object
+		 */
+		CVeiTitleClipImageDecodeOperation(CVeiTitleClipGenerator& aGenerator, 
+										  CFbsBitmap* aSourceBitmap,
+										  TInt aPriority = CActive::EPriorityStandard);
+		/**
+		 * EPOC second-phase constructor.
+		 * 
+		 * @param aFilename  filename to decode.
+		 */
+		void ConstructL(const TDesC& aFilename);
+
+	private: // members
+
+		/**
+		 * Enumeration for the decode phase.
+		 */
+		enum TDecodePhase 
+			{
+			EPhaseNotStarted = 0,
+			EPhaseLoading,
+			EPhaseScaling,
+			EPhaseComplete
+			};
+
+		/** Decode phase. */
+		TDecodePhase iDecodePhase;
+
+		/** Generator that owns this decoder operation. */
+		CVeiTitleClipGenerator& iGenerator;
+
+		/** Observer.*/
+		MVeiTitleClipGeneratorObserver* iObserver;
+
+		/** Decoder. */
+		CImageDecoder* iDecoder;
+
+		/** Bitmap. */
+		CFbsBitmap* iBitmap;
+
+		/** Scaler. */
+		CBitmapScaler* iScaler;
+
+		/** Flag indicating whether to notify observer. */
+		TBool iNotifyObserver;
+	};
+
+
+
+
+#endif // __VEITITLECLIPGENERATOR_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VeiVideoEditorSettings.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Common settings.
+*
+*/
+
+
+#ifndef __VEIVIDEOEDITORSETTINS_H
+#define __VEIVIDEOEDITORSETTINS_H
+
+// INCLUDES
+// System includes
+#include    <e32base.h>
+
+// CLASS DECLARATION
+
+/**
+*  Common settings handler
+*
+*  @lib VideoEditorCommon.lib
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS( CVeiVideoEditorSettings )
+    {
+    public: // New functions
+        
+        /**
+        * GetMediaPlayerVolumeLevelL.
+        * @since S60
+        * @param aVolumeLevel returns volume level from MediaPlayer settings
+        */
+        IMPORT_C static void GetMediaPlayerVolumeLevelL( TInt& aVolumeLevel );
+        
+        /**
+        * SetMediaPlayerVolumeLevelL.
+        * @since ?Series60_version
+        * @param aVolumeLevel save volume level. See <MPMediaPlayerSettings.h>
+        *        for min / max values               
+        */        
+		IMPORT_C static void SetMediaPlayerVolumeLevelL( TInt aVolumeLevel );
+        
+        /**
+        * GetMaxMmsSizeL.
+        * @since ?Series60_version
+        * @param aMaxMmsSize returns maximum MMS size
+        */		
+		IMPORT_C static void GetMaxMmsSizeL( TInt& aMaxMmsSize );
+    };
+
+#endif      // __VEIVIDEOEDITORSETTINS_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VideoEditorCommon.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+
+#ifndef VIDEOEDITORCOMMON_H
+#define VIDEOEDITORCOMMON_H
+
+// INCLUDES
+// System includes
+#include <f32file.h>    // TDriveNumber
+#include <gdi.h>        // TDisplayMode
+#include "VideoEditorCommon.hrh"
+
+// TYPE DEFINITIONS
+namespace VideoEditor
+	{
+	/**
+	* Enumeration for possible cursor locations.
+	*/
+	enum TCursorLocation 
+		{
+		ECursorOnClip = 0,
+		ECursorOnTransition,
+		ECursorOnAudio,
+		ECursorOnEmptyVideoTrack,
+		ECursorOnEmptyAudioTrack
+		};
+
+	/**
+	* Enumeration for used memory locations.
+	*/
+	enum TMemory 
+		{
+		EMemAutomatic = 0,
+		EMemPhoneMemory,
+		EMemMemoryCard
+		};
+
+	/**
+	* Publish & Subscribe property keys.
+	*/
+	enum TPropertyKeys
+		{
+		EPropertyFilename   // Document file name
+		};
+	
+	
+	/**
+	* Animations for simple functions
+	*/
+	enum TSimpleFunctionAnimations
+		{
+		EAnimationMerging,
+		EAnimationChangeAudio,
+		EAnimationAddText,
+		EAnimationCut
+		};
+	}
+
+
+// CONSTANTS
+const TUid KUidVideoEditor = { 0x10208A29 };		// app. UID of the manual video editor
+const TUid KUidSimpleCutVideo = {0x200009DF};		// app. UID of the simple cut video
+const TUid KUidVideoProvider = { 0x101FFA8E };		// interface UID of the AIW provider
+const TUid KUidTrimForMms = {0x200009D};            // app. UID of the trim for mms
+const TUid KUidVideoEditorProperties = {0x03341234};// Property UID for Publish & Subscribe API. NOTE: currently unregistered UID
+
+const TInt KMmcDrive( EDriveE );    // Memory card drive number
+
+const TInt KAudioSampleInterval = 200; // Audio sample rate in audio visualization (in milliseconds)
+const TReal KVolumeMaxGain = 127; // scale is -127 - 127
+
+const TInt KMaxVideoFrameResolutionX = 640; // use VGA as maximum resolution
+const TInt KMaxVideoFrameResolutionY = 480;
+const TDisplayMode KVideoClipGenetatorDisplayMode = EColor64K;
+const TInt KMinCutVideoLength = 1000000; // in microseconds
+
+// If the number of files given to AIW provider (i.e. files selected in Gallery)
+// exceeds this number, the AIW provider does not provide menu items.
+// Otherwise the menu slows down dramatically when a very large number
+// of files is selected.
+const TInt KAiwMaxNumberOfFilesSimultaneouslyHandled = KMaxTInt;
+
+// erros codes used in simple functions "Merge", "Add text", "Change sound"
+const TInt KErrUnableToInsertVideo 			= -50000;
+const TInt KErrUnableToInsertSound 			= KErrUnableToInsertVideo - 1;
+const TInt KErrUnableToInsertImage 			= KErrUnableToInsertVideo - 2;
+const TInt KErrUnableToInsertText 			= KErrUnableToInsertVideo - 3;
+const TInt KErrUnableToMergeVideos 			= KErrUnableToInsertVideo - 4;
+const TInt KErrUnableToMergeVideoAndImage 	= KErrUnableToInsertVideo - 5;
+const TInt KErrUnableToChangeSound 			= KErrUnableToInsertVideo - 6;
+const TInt KErrVideoFormatNotSupported 		= KErrUnableToInsertVideo - 7;
+const TInt KErrAudioFormatNotSupported 		= KErrUnableToInsertVideo - 8;
+const TInt KErrImageFormatNotSupported 		= KErrUnableToInsertVideo - 9;
+const TInt KErrUnableToEditVideo 		    = KErrUnableToInsertVideo - 10;
+
+// error code(s) used in simple function cut
+const TInt KErrTooShortVideoForCut 			= -60000;
+
+// file name extensions
+_LIT (KExtMp4, ".mp4");
+_LIT (KExt3gp, ".3gp");
+_LIT (KExtAmr, ".amr");
+
+#endif      // VIDEOEDITORCOMMON_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VideoEditorCommon.hrh	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+
+#ifndef VIDEOEDITORCOMMON_HRH
+#define VIDEOEDITORCOMMON_HRH
+
+
+#define AKNEXQUERY_LISTBOX_HEIGHT 3
+#define AKNEXQUERY_LISTBOX_WIDTH 3
+#define AKNTEXT_QUERY_WIDTH 50
+#define AKNTEXT_QUERY_LINES 5
+
+#endif // VIDEOEDITORCOMMON_HRH
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VideoEditorDebugUtils.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,426 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// Simple RFileLogger based set of log writer macros.
+//
+// Instructions:
+//
+// 1. Put the following line into you MMP file
+// LIBRARY flogger.lib
+//
+// 2. Define DEBUG_ON to enable logs in UDEB builds.
+//    Alternatively, define DEBUG_ON_ALWAYS to enable logs 
+//    always (NOTE: do not use in productions code)
+//    - in mmp file: macro DEBUG_ON
+//    - in cpp file: #define DEBUG_ON
+// 
+// 3a. Call LOG_RESET to create the log file, overwriting possibly
+//    existing old log file.
+//
+// 3b. Alternatively, you can skip the step 3a, in which case the 
+//    the output is appended to the possibly existing old file.
+//
+// 4. Use the macros to write to the log file. For example
+//    LOG("Started processing")
+// 
+// 5. To enable the logs, manually create the logging 
+//    directory "C:\Logs\VideoEditor" on the device.
+//
+
+#ifndef __DEBUGUTILS_H__
+#define __DEBUGUTILS_H__
+
+// Two alternative implementations:
+// - using RFileLogger (system component)
+// - using ClogFile (implemented in this project)
+//#define _FLOGGER_IMPLEMENTATION_
+#define _CLOGFILE_IMPLEMENTATION_
+
+#ifdef _FLOGGER_IMPLEMENTATION_
+#include <flogger.h>
+#else
+#include "logfile.h"
+#include <bautils.h>
+#include <f32file.h>
+#endif
+#include <e32svr.h>
+
+// Default log files
+_LIT(KVideoEditorLogFile,"VideoEditor.log");
+_LIT(KVideoProviderLogFile,"VideoProvider.log");
+
+// Log directory
+_LIT(KLogDir, "VideoEditor");
+
+// Maximum length for a log line. 
+const TInt KMaxLogLineLength = 256;
+
+// Overflow handler. Too log lines are truncated. 
+class TLogFileDes16OverflowHandler : public TDes16Overflow
+	{
+	virtual void Overflow(TDes16& /*aDes*/) 
+		{
+		// do nothing
+		}
+	};
+
+_LIT(KLogsFolder, "C:\\Logs\\");
+_LIT(KBackslash, "\\");
+
+
+// The log is enabled in debug builds only, unless
+// DEBUG_ON_ALWAYS is defined to always enable it.
+#ifdef _DEBUG
+	#ifdef DEBUG_ON
+	#define _ENABLED_
+	#endif
+#else
+	#ifdef DEBUG_ON_ALWAYS
+	#define _ENABLED_
+	#endif
+#endif
+
+#ifdef _ENABLED_
+
+#define DEBUGLOG_ARG(x) x
+
+#ifdef _FLOGGER_IMPLEMENTATION_ 
+
+// Initialize the log file, overwrite existing
+// Logs file are always created in C:\Logs. The first argument to CreateLog() 
+// is a directory name relative to this C:\Logs directory.
+#define LOG_RESET(aLogFile) \
+	{\
+	RFileLogger logger;\
+	logger.Connect();\
+	logger.CreateLog(KLogDir,aLogFile,EFileLoggingModeOverwrite);\
+	logger.Write(KLogDir,aLogFile,EFileLoggingModeAppend,_L("*** Log file created ***"));\
+	logger.CloseLog();\
+	logger.Close();\
+	}
+
+// Log a simple text, e.g.
+//   LOG(_L("logfile.txt"),"Something happens here")
+#define LOG(aLogFile,aText) \
+	{\
+	RFileLogger::Write(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText));\
+	RDebug::Print(_L(aText));\
+	}
+
+// Log a Descriptor
+#define LOGDES(aLogFile,aDes) \
+	{\
+	RFileLogger::Write(KLogDir,aLogFile,EFileLoggingModeAppend,aDes);\
+	RDebug::Print(aDes);\
+	}
+
+// Log a number with string format, e.g. 
+//	LOGFMT(KLogFile,"Result=%d",err)
+//	LOGFMT(KLogFile, "FileName: %S", &aFileName );
+#define LOGFMT(aLogFile,aText,aParam) \
+	{\
+	RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText),aParam);\
+	RDebug::Print(_L(aText), aParam);\
+	}
+
+// With 2 parameters
+#define LOGFMT2(aLogFile,aText,aParam1,aParam2) \
+	{\
+	RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText),aParam1,aParam2);\
+	RDebug::Print(_L(aText), aParam1,aParam2);\
+	}
+
+// With 3 parameters
+#define LOGFMT3(aLogFile,aText,aParam1,aParam2,aParam3) \
+	{\
+	RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText),aParam1,aParam2,aParam3);\
+	RDebug::Print(_L(aText), aParam1,aParam2,aParam3);\
+	}
+
+// With 4 parameters
+#define LOGFMT4(aLogFile,aText,aParam1,aParam2,aParam3,aParam4) \
+	{\
+	RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText),aParam1,aParam2,aParam3,aParam4);\
+	RDebug::Print(_L(aText), aParam1,aParam2,aParam3,aParam4);\
+	}
+
+// With 6 parameters
+#define LOGFMT6(aLogFile,aText,aParam1,aParam2,aParam3,aParam4,aParam5,aParam6) \
+	{\
+	RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText),aParam1,aParam2,aParam3,aParam4,aParam5,aParam6);\
+	RDebug::Print(_L(aText), aParam1,aParam2,aParam3,aParam4,aParam5,aParam6);\
+	}
+
+// With 12 parameters
+#define LOGFMT12(aLogFile,aText,aParam1,aParam2,aParam3,aParam4,aParam5,aParam6,aParam7,aParam8,aParam9,aParam10,aParam11,aParam12) \
+	{\
+	RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText),aParam1,aParam2,aParam3,aParam4);\
+	RDebug::Print(_L(aText), aParam1,aParam2,aParam3,aParam4,,aParam5,aParam6,aParam7,aParam8,aParam9,aParam10,aParam11,aParam12);\
+	}
+
+// Log hex dump
+#define LOGHEXDUMP(aLogFile,aHeader,aMargin,aPtr,aLen) \
+	RFileLogger::HexDump(KLogDir,aLogFile, EFileLoggingModeAppend, _S(aHeader), _S(aMargin), aPtr, aLen);
+
+// Log the memory allocated on the current thread's default heap
+#define LOG_HEAP_USAGE(aLogFile) \
+	{\
+	TInt allocSize;\
+	User::Heap().AllocSize(allocSize);\
+	_LIT(KText,"* Memory allocated on the thread's default heap: %d *");\
+	RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,KText,allocSize);\
+	RDebug::Print(KText,allocSize);\
+	}
+
+#endif // _FLOGGER_IMPLEMENTATION_
+
+#ifdef _CLOGFILE_IMPLEMENTATION_
+
+#define LOG_RESET(aLogFile) \
+	{\
+	TFileName path(KLogsFolder);\
+	path.Append(KLogDir);\
+	path.Append(KBackslash);\
+	TFileName fileNameAndPath(path);\
+	fileNameAndPath.Append(aLogFile);\
+	RFs fs;\
+	fs.Connect();\
+	if(BaflUtils::FolderExists(fs,path))\
+		{\
+		RFile file;\
+		file.Replace(fs, fileNameAndPath, EFileShareAny|EFileWrite);\
+		file.Close();\
+		CLogFile::StaticLog(fileNameAndPath,_L("*** Log file created ***\n"));\
+		}\
+	fs.Close();\
+	}
+
+#define LOG(aLogFile,aText) \
+	{\
+	TFileName path(KLogsFolder);\
+	path.Append(KLogDir);\
+	path.Append(KBackslash);\
+	TFileName fileNameAndPath(path);\
+	fileNameAndPath.Append(aLogFile);\
+	RFs fs;\
+	fs.Connect();\
+	if(BaflUtils::FolderExists(fs,path))\
+		{\
+		CLogFile::StaticLog(fileNameAndPath,_L(aText));\
+		}\
+	fs.Close();\
+	RDebug::Print(_L(aText));\
+	}
+
+#define LOGDES(aLogFile,aDes) \
+	{\
+	TFileName path(KLogsFolder);\
+	path.Append(KLogDir);\
+	path.Append(KBackslash);\
+	TFileName fileNameAndPath(path);\
+	fileNameAndPath.Append(aLogFile);\
+	RFs fs;\
+	fs.Connect();\
+	if(BaflUtils::FolderExists(fs,path))\
+		{\
+		CLogFile::StaticLog(fileNameAndPath,aDes);\
+		}\
+	fs.Close();\
+	RDebug::Print(aDes);\
+	}
+
+#define LOGFMT(aLogFile,aText,aParam) \
+	{\
+	TFileName path(KLogsFolder);\
+	path.Append(KLogDir);\
+	path.Append(KBackslash);\
+	TFileName fileNameAndPath(path);\
+	fileNameAndPath.Append(aLogFile);\
+	RFs fs;\
+	fs.Connect();\
+	if(BaflUtils::FolderExists(fs,path))\
+		{\
+		_LIT(KText,aText);\
+		TLogFileDes16OverflowHandler ofh;\
+		TBuf<KMaxLogLineLength> buf;\
+		buf.AppendFormat(KText,&ofh,aParam);\
+		CLogFile::StaticLog(fileNameAndPath,buf);\
+		}\
+	fs.Close();\
+	RDebug::Print(_L(aText), aParam);\
+	}
+
+// With 2 parameters
+#define LOGFMT2(aLogFile,aText,aParam1,aParam2) \
+	{\
+	TFileName path(KLogsFolder);\
+	path.Append(KLogDir);\
+	path.Append(KBackslash);\
+	TFileName fileNameAndPath(path);\
+	fileNameAndPath.Append(aLogFile);\
+	RFs fs;\
+	fs.Connect();\
+	if(BaflUtils::FolderExists(fs,path))\
+		{\
+		_LIT(KText,aText);\
+		TLogFileDes16OverflowHandler ofh;\
+		TBuf<KMaxLogLineLength> buf;\
+		buf.AppendFormat(KText,&ofh,aParam1,aParam2);\
+		CLogFile::StaticLog(fileNameAndPath,buf);\
+		}\
+	fs.Close();\
+	RDebug::Print(_L(aText), aParam1,aParam2);\
+	}
+
+// With 3 parameters
+#define LOGFMT3(aLogFile,aText,aParam1,aParam2,aParam3) \
+	{\
+	TFileName path(KLogsFolder);\
+	path.Append(KLogDir);\
+	path.Append(KBackslash);\
+	TFileName fileNameAndPath(path);\
+	fileNameAndPath.Append(aLogFile);\
+	RFs fs;\
+	fs.Connect();\
+	if(BaflUtils::FolderExists(fs,path))\
+		{\
+		_LIT(KText,aText);\
+		TLogFileDes16OverflowHandler ofh;\
+		TBuf<KMaxLogLineLength> buf;\
+		buf.AppendFormat(KText,&ofh,aParam1,aParam2,aParam3);\
+		CLogFile::StaticLog(fileNameAndPath,buf);\
+		}\
+	fs.Close();\
+	RDebug::Print(_L(aText), aParam1,aParam2,aParam3);\
+	}
+
+// With 4 parameters
+#define LOGFMT4(aLogFile,aText,aParam1,aParam2,aParam3,aParam4) \
+	{\
+	TFileName path(KLogsFolder);\
+	path.Append(KLogDir);\
+	path.Append(KBackslash);\
+	TFileName fileNameAndPath(path);\
+	fileNameAndPath.Append(aLogFile);\
+	RFs fs;\
+	fs.Connect();\
+	if(BaflUtils::FolderExists(fs,path))\
+		{\
+		_LIT(KText,aText);\
+		TLogFileDes16OverflowHandler ofh;\
+		TBuf<KMaxLogLineLength> buf;\
+		buf.AppendFormat(KText,&ofh,aParam1,aParam2,aParam3,aParam4);\
+		CLogFile::StaticLog(fileNameAndPath,buf);\
+		}\
+	fs.Close();\
+	RDebug::Print(_L(aText), aParam1,aParam2,aParam3,aParam4);\
+	}
+
+// With 6 parameters
+#define LOGFMT6(aLogFile,aText,aParam1,aParam2,aParam3,aParam4,aParam5,aParam6) \
+	{\
+	TFileName path(KLogsFolder);\
+	path.Append(KLogDir);\
+	path.Append(KBackslash);\
+	TFileName fileNameAndPath(path);\
+	fileNameAndPath.Append(aLogFile);\
+	RFs fs;\
+	fs.Connect();\
+	if(BaflUtils::FolderExists(fs,path))\
+		{\
+		_LIT(KText,aText);\
+		TLogFileDes16OverflowHandler ofh;\
+		TBuf<KMaxLogLineLength> buf;\
+		buf.AppendFormat(KText,&ofh,aParam1,aParam2,aParam3,aParam4,aParam5,aParam6);\
+		CLogFile::StaticLog(fileNameAndPath,buf);\
+		}\
+	fs.Close();\
+	RDebug::Print(_L(aText), aParam1,aParam2,aParam3,aParam4,aParam5,aParam6);\
+	}
+
+// With 12 parameters
+#define LOGFMT12(aLogFile,aText,aParam1,aParam2,aParam3,aParam4,aParam5,aParam6,aParam7,aParam8,aParam9,aParam10,aParam11,aParam12) \
+	{\
+	TFileName path(KLogsFolder);\
+	path.Append(KLogDir);\
+	path.Append(KBackslash);\
+	TFileName fileNameAndPath(path);\
+	fileNameAndPath.Append(aLogFile);\
+	RFs fs;\
+	fs.Connect();\
+	if(BaflUtils::FolderExists(fs,path))\
+		{\
+		_LIT(KText,aText);\
+		TLogFileDes16OverflowHandler ofh;\
+		TBuf<KMaxLogLineLength> buf;\
+		buf.AppendFormat(KText,&ofh,aParam1,aParam2,aParam3,aParam4,aParam5,aParam6,aParam7,aParam8,aParam9,aParam10,aParam11,aParam12);\
+		CLogFile::StaticLog(fileNameAndPath,buf);\
+		}\
+	fs.Close();\
+	RDebug::Print(_L(aText), aParam1,aParam2,aParam3,aParam4,aParam5,aParam6,aParam7,aParam8,aParam9,aParam10,aParam11,aParam12);\
+	}
+
+// Not implemented
+#define LOGHEXDUMP(aLogFile,aHeader,aMargin,aPtr,aLen)
+
+// Log the memory allocated on the current thread's default heap
+#define LOG_HEAP_USAGE(aLogFile) \
+	{\
+	TFileName path(KLogsFolder);\
+	path.Append(KLogDir);\
+	path.Append(KBackslash);\
+	TFileName fileNameAndPath(path);\
+	fileNameAndPath.Append(aLogFile);\
+	RFs fs;\
+	fs.Connect();\
+	TInt allocSize;\
+	User::Heap().AllocSize(allocSize);\
+	_LIT(KText,"* Memory allocated on the thread's default heap: %d *");\
+	if(BaflUtils::FolderExists(fs,path))\
+		{\
+		TLogFileDes16OverflowHandler ofh;\
+		TBuf<KMaxLogLineLength> buf;\
+		buf.AppendFormat(KText,&ofh,allocSize);\
+		CLogFile::StaticLog(fileNameAndPath,buf);\
+		}\
+	fs.Close();\
+	RDebug::Print(KText, allocSize);\
+	}
+
+#endif // _CLOGFILE_IMPLEMENTATION_
+
+#else // _ENABLED_
+
+#define DEBUGLOG_ARG(x)
+
+#define LOG_RESET(aLogFile)
+#define LOG(aLogFile,aText)
+#define LOGDES(aLogFile,aDes)
+#define LOGFMT(aLogFile,aText,aParam)
+#define LOGFMT2(aLogFile,aText,aParam1,aParam2)
+#define LOGFMT3(aLogFile,aText,aParam1,aParam2,aParam3)
+#define LOGFMT4(aLogFile,aText,aParam1,aParam2,aParam3,aParam4)
+#define LOGFMT6(aLogFile,aText,aParam1,aParam2,aParam3,aParam4,aParam5,aParam6)
+#define LOGFMT12(aLogFile,aText,aParam1,aParam2,aParam3,aParam4,aParam5,aParam6,aParam7,aParam8,aParam9,aParam10,aParam11,aParam12)
+#define LOGHEXDUMP(aLogFile,aHeader,aMargin,aPtr,aLen)
+#define LOG_HEAP_USAGE(aLogFile)
+
+#endif // _ENABLED_
+
+#endif // __DEBUGUTILS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VideoEditorInternalCRKeys.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef VIDEOEDITORINTERNALCRKEYS_H
+#define VIDEOEDITORINTERNALCRKEYS_H
+
+const TUid KCRUidVideoEditor = {0xE3341234}; // test uid
+
+/**
+* KVedSaveQuality 
+* Defines the quality of saved video clip.
+* Possible values are 	0 ( TVeiSettings::EAuto ) 
+* 						1 ( TVeiSettings::EMmsCompatible ) 
+*						2 ( TVeiSettings::EMedium )
+*						2 ( TVeiSettings::EBest )
+* Default value is 0.
+*/
+const TUint32 KVedSaveQuality 					= 0x0000001;
+
+/**
+* KVedMemoryInUse 
+* Defines where to same the video clip.
+* Possible values are 	0 ( CAknMemorySelectionDialog::EPhoneMemory ) 
+* 						1 ( CAknMemorySelectionDialog::EMemoryCard ) 
+* Default value is 1.
+*/
+const TUint32 KVedMemoryInUse 					= 0x0000002;
+
+/** Default file name for saved video
+*
+* Text type
+*
+* Default value: ""
+**/
+const TUint32 KVedDefaultVideoName				= 0x00000003;
+
+/** Default file name for snapshot image
+*
+* Text type
+*
+* Default value: ""
+**/
+const TUint32 KVedDefaultSnapshotName			= 0x00000004;
+
+
+#endif      // VIDEOEDITORINTERNALCRKEYS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/VideoEditorUtils.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,285 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#ifndef VIDEOEDITORUTILS_H
+#define VIDEOEDITORUTILS_H
+
+// INCLUDES
+#include <e32base.h>
+#include <coemain.h>
+#include <VedCommon.h>
+#include "VideoEditorCommon.h"
+
+// FORWARD DECLARATIONS
+class RFs;
+class TVeiSettings;
+
+// CONSTANTS
+const TInt KManualVideoEditorIconFileId = 0;
+const TInt KVideoEditorUiComponentsIconFileId = 1;
+const TInt KVeiNonScalableIconFileId = 2;
+
+/**	CLASS:	VideoEditorUtils
+* 
+*	Static utility class.
+*
+*/
+NONSHARABLE_CLASS( VideoEditorUtils )
+{
+public:
+
+    /** @name Methods:*/
+    //@{
+
+    /**	GenerateNewDocumentNameL 
+	*
+	*   Generates a new name for the loaded document at the startup.
+	*
+    *   The generated file is located on the MMC dy default. If the 
+    *   MMC is full or not present, the file will be in phone memory.
+    *   Uses internally VideoFitsToDriveL to check the space.
+    *
+	*   Media gallery album id list now obsolete after Media Gallery removal.
+    *	If an invalid album list is passed the behaviour is undefined.
+	*
+	*   @param aFsSession -
+	*   @param aSourceFileName -
+	*   @param aTargetFileName -
+	*   @param aOutputFormat - video format of the target file
+	*   @param aTargetSizeEstimate - the expected target file size. 
+	*             This value is used to check whether there is enough space on the disks.
+	*   @param aMemoryInUse - where the target file is created.
+	*   @return - KErrNone if successfully generated file name
+	*             KSIEENotEnoughDiskSpace if no disk space to save the file
+	*             (size of aSourceFileName used to check the space)
+	*             KSIEEOpenFile if the source filename is invalid
+	*/
+    IMPORT_C static TInt GenerateNewDocumentNameL (
+        RFs& aFsSession, 
+        const TDesC& aSourceFileName, 
+        TDes& aTargetFileName,
+        TVedVideoFormat aOutputFormat,
+        TInt aTargetSizeEstimate,
+        VideoEditor::TMemory aMemoryInUse = VideoEditor::EMemAutomatic
+        );
+        
+    /**	GenerateFileNameL 
+    *
+    *   Generates a new file name.
+    *
+    *   Generates a file name into a given drive. Increments a running number
+    *   at the end of the file name until a file with the same name doesn't exist.
+    *   Uses internally VideoFitsToDriveL to check the space.
+    *
+    *
+    *   @param aFsSession -
+    *   @param aSourceFileName - name of the source file
+    *   @param aTargetFileName - name of the new file
+    *   @param aOutputFormat - video format of the target file
+    *   @param aTargetSizeEstimate - the expected target file size. 
+    *             This value is used to check whether there is enough space on the disks.
+    *   @param aDrive - drive where the target file is created.
+    *   @return - KErrNone if successfully generated file name
+    *             KSIEENotEnoughDiskSpace if no disk space to save the file
+    *             (size of aSourceFileName used to check the space)
+    *             KSIEEOpenFile if the source filename is invalid
+    */        
+    IMPORT_C static TInt GenerateFileNameL (
+        RFs& aFsSession, 
+        const TDesC& aSourceFileName, 
+        TDes& aTargetFileName,
+        TVedVideoFormat aOutputFormat,
+        TInt aTargetSizeEstimate,
+        TFileName aDrive );
+
+
+    /**	NotifyNewMediaDocumentL 
+	*
+	*   Notifies the system that a new media file has been saved,
+	*   making it visible in the Media Gallery.
+	*   
+	*   @param aFileName -
+	*   @return - 
+	*/
+    IMPORT_C static void NotifyNewMediaDocumentL (
+        RFs& aFsSession,
+        const TDesC& aFileName
+        );
+
+    /**	GetMGAlbumsListForMediaFileL 
+	*
+	*   Finds out which Media Gallery Albums the file belongs to.
+	*   (if compiled without album support, this function
+	*   returns an empty array). Album support is now removed.
+	*
+	*   @param aFileName - The media file
+	*   @param aAlbumList -
+    *           On return, contains the ID:s of the Media Gallery
+    *           albums the file belongs to.
+    *           If the list is not empty, it is retained and
+    *           new IDs are appended into the list.
+	*   @return - 
+	*/
+    IMPORT_C static void GetMGAlbumsListForMediaFileL ( 
+        RArray<TInt>& aAlbumIdList,
+        const TDesC& aFilename
+        );
+
+    /**	AddMediaFileToMGAlbumL 
+	*
+	*   Add the given media file to the given album.
+	*   (if compiled without album support, this function
+	*   does nothing)
+	*   
+	*   @param aFileName -
+	*   @param aAlbumId -
+	*   @return - 
+	*/
+    IMPORT_C static void AddMediaFileToMGAlbumL ( 
+        const TDesC& aFileName,
+        TInt aAlbumId
+        );
+
+    /**	IsEnoughFreeSpaceToSaveL
+	*
+	*   Checks whether there is enough disk space to save
+	*   the given file.
+	*
+	*   @param aFsSession -
+	*   @param aFileName - The path to save (only drive part needed)
+	*   @param aSizeEstimate - The space required for the file to save
+	*   @return - TBool
+	*/
+	IMPORT_C static TBool IsEnoughFreeSpaceToSaveL( 
+		RFs& aFsSession, 
+		const TDesC& aFileName,
+		TInt aSizeEstimate  );
+
+    /**	IsDrmProtectedL
+	*
+	*   Checks whether the given file is DRM protected.
+	*
+	*   @param aFileName - The path of the file to check
+	*   @return - TBool
+	*/
+	IMPORT_C static TBool IsDrmProtectedL( const TDesC& aFileName );
+
+    /**	IconFileNameAndPath 
+	*
+	*	Returns file name and path for one of the icon files used in this module.
+	*	Currently there is the primary icon file (MIF file), and the secondary 
+	*	icon file (a MBM file), which contains the non-scalable (bitmap) graphics.
+	*   
+	*	@param  TInt aInconFileIndex -	Which file. Supported values:
+	*				KManualVideoEditorIconFileId
+	*				KVideoEditorUiComponentsIconFileId
+	*				KVeiNonScalableIconFileId 
+	*	@return TFileName - 
+	*/
+   	IMPORT_C static TFileName IconFileNameAndPath( TInt aInconFileIndex );
+
+    /**	IsLandscapeScreenOrientation
+	*
+	*   Check if the screen is in landscape mode. In other words, see
+	*   if the X dimension of the screen is greater than the Y dimendion.
+	*
+	*   @param -
+	*   @return - TBool
+	*/
+	IMPORT_C static TBool IsLandscapeScreenOrientation();
+
+
+	/** LaunchQueryDialogL
+	*
+    *   Launches a confirmation query dialog.
+    *
+	*	@param aPrompt - dialog prompt descriptor
+	*	@return -
+	*/
+    IMPORT_C static TInt LaunchQueryDialogL (const TDesC & aPrompt);
+
+	/** LaunchListQueryDialogL
+	*
+    *   Launches a confirmation query dialog.
+    *
+	*	@param aPrompt - dialog prompt descriptor
+	*	@return 0 if user selects "No", otherwise 1
+	*/
+	IMPORT_C static TInt LaunchListQueryDialogL (MDesCArray *	aTextItems,
+										const TDesC &	aPrompt);
+										
+	/*	LaunchSaveVideoQueryL 
+	*
+	*	Launches a query dialog "Save video:" with items
+	*	"Replace original" and "Save with a new name"
+	*
+	*   @param - 
+	*   @return - list query id or -1 if the user selects No
+	*/        
+	IMPORT_C static TInt LaunchSaveVideoQueryL ();
+
+
+	/*	LaunchSaveChangesQueryL
+	*
+	*	Launches a query dialog "Save changes?" query.
+	*
+	*   @param - 
+	*   @return 0 if user selects "No", otherwise 1
+	*/
+	IMPORT_C static TInt LaunchSaveChangesQueryL ();
+
+    //@}
+
+private:
+
+    /** @name Methods:*/
+    //@{
+
+    /**	FindSuffix 
+	*
+	*   Finds the offset of the edited file name suffix of form "-NNN", where
+    *   NNN is the edit sequence number.
+	*
+	*   @param aName - File name without extension
+	*   @return - 
+	*/
+    static TInt FindSuffix ( 
+        const TDesC &   aName
+        );
+
+    /**	FileAlreadyExistsL 
+	*
+	*   Check if a file with the specified name already exista on the system.
+	*
+	*   @param - aFs
+	*   @param - aFileName
+	*   @return - TBool
+	*/
+    static TBool FileAlreadyExistsL ( 
+        RFs& aFsSession, 
+        const TDesC& aFileName 
+        );
+
+    //@}
+};
+
+#endif
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/logfile.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,347 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __LOGFILE_H__
+#define __LOGFILE_H__
+
+#include <eikapp.h>
+#include <e32base.h>
+#include <coemain.h>
+
+// Link with the following libraries: EFSRV.LIB HAL.LIB CHARCONV.LIB           
+
+#define LOG_INIT(name) CLogFile *log = CLogFile::NewL(_L(name), ETrue);
+
+#define LOG_INIT2(name) CLogFile *log = CLogFile::NewL(_L(name), EFalse);
+
+#define LOGL(event) \
+	log->Log(_L(event));\
+	log->LogNewline();
+
+#define LOGNLN(event) \
+	log->Log(_L(event));\
+
+#define LOGS(event) \
+	log->Log(event);\
+	log->LogNewline();
+
+#define LOGN(num) \
+	TBuf<64> log_num;\
+	log_num.AppendNum(num); \
+	log->Log(log_num);\
+	log->LogNewline();
+
+#define LOGF(numf) \
+	TBuf<16> log_float;\
+	log_float.AppendNum(numf, TRealFormat());\
+	log->Log(log_float);\
+	log->LogNewline();
+
+#define LOGN2(text, num) \
+	TBuf<64> log_num;\
+	log_num.AppendNum(num);\
+	log->Log(_L(text));\
+	log->Log(log_num);\
+	log->LogNewline();
+
+#define LOGF2(text, numf) \
+	TBuf<16> log_float;\
+	log_float.AppendNum(numf, TRealFormat());\
+	log->Log(_L(text));\
+	log->Log(log_float);\
+	log->LogNewline();
+
+#define LOG_END \
+	delete log;\
+	log = 0;
+
+
+
+/*! 
+  @class CLogFile
+  
+  @discussion Class to generate a text file containing logging information
+  */
+NONSHARABLE_CLASS( CLogFile ) : public CBase
+    {
+public:
+/*!
+  @function NewL
+   
+  @discussion Create a CLogFile object
+  @param aFileName the name of the file to create
+  @param aInitialiseLog if true, and the log file already exists, previous
+  contents will be deleted. If false, append to any existing contents
+  @result a pointer to the created instance of CLogFile
+  */
+    IMPORT_C static CLogFile* NewL(const TDesC& aFileName, TBool aInitialiseLog);
+
+/*!
+  @function NewLC
+   
+  @discussion Create a CLogFile object
+  @param aFileName the name of the file to create
+  @param aInitialiseLog if true, and the log file already exists, previous
+  contents will be deleted. If false, append to any existing contents
+  @result a pointer to the created instance of CLogFile
+  */
+    IMPORT_C static CLogFile* NewLC(const TDesC& aFileName, TBool aInitialiseLog);
+
+/*!
+  @function ~CLogFile
+  
+  @discussion Destroy the object and release all memory objects
+  */
+    IMPORT_C ~CLogFile();
+
+/*!
+  @function Log
+  
+  @discussion Append the byte to the log file (if not a printable char, it will be logged as ascii-hex)
+  @param aByte the byte to log
+  */
+    IMPORT_C void Log(TUint8 aByte);
+
+/*!
+  @function Log
+  
+  @discussion Append the integer to the log file (logged as ascii-hex)
+  @param aNumber the integer to log
+  */
+    IMPORT_C void Log(TUint aNumber);
+
+/*!
+  @function Log
+  
+  @discussion Append text to the log file
+  @param aText the text to log
+  */
+    IMPORT_C void Log(const TDesC8& aText);
+
+/*!
+  @function Log
+  
+  @discussion Append text to the log file
+  @param aText the text to log
+  */
+    IMPORT_C void Log(const TDesC& aText);
+
+/*!
+  @function LogTime
+  
+  @discussion Append a timestamp to the log file.
+  Timestamps are in seconds with three decimal places (but resolution is limited to system timer tick period)
+  */
+    IMPORT_C void LogTime();
+
+/*!
+  @function LogBytes
+
+  @discussion Append the bytes to the log file (non-printable bytes will be logged as ascii-hex)
+  @param aBuffer the bytes to log
+  */
+    IMPORT_C void LogBytes(const TDesC8& aBuffer);
+
+/*!
+  @function LogNewline
+
+  @discussion Start a newline in the log file
+  */
+    IMPORT_C void LogNewline();
+
+/*!
+  @function SetAutoFlush
+
+  @discussion Turn AutoFlush on or off. AutoFlush will automatically flush the log file after each write
+  @param aOn if true turns AutoFlush on
+  */
+    IMPORT_C void SetAutoFlush(TBool aOn);
+
+/*!
+  @function SetAutoTimeStamp
+
+  @discussion Turn AutoTimeStamp on or off. AutoTimeStamp will add a timestamp to the start of each new line in the log
+  @param aOn if true turn AutoTimeStamp on
+  */
+    IMPORT_C void SetAutoTimeStamp(TBool aOn);
+
+/*!
+  @function SetAutoNewline
+
+  @discussion Turn AutoNewline on or off. AutoNewline starts a new line after each log operation
+  @param aOn if true turn AutoNewline on
+  */
+    IMPORT_C void SetAutoNewline(TBool aOn);
+
+/*!
+  @function StaticLogL
+
+  @discussion Static option to append text to the log file (leaving version)
+  @param aFileName the file to append to
+  @param aText the text to append
+  */
+    IMPORT_C static void StaticLogL(const TDesC& aFileName, const TDesC8& aText);
+
+/*!
+  @function StaticLogL
+
+  @discussion Static option to append text to the log file (leaving version)
+  @param aFileName the file to append to
+  @param aText the text to append
+  */
+    IMPORT_C static void StaticLogL(const TDesC& aFileName, const TDesC& aText);
+
+/*!
+  @function StaticLog
+
+  @discussion Static option to append text to the log file (non-leaving version)
+  @param aFileName the file to append to
+  @param aText the text to append
+  */
+    IMPORT_C static void StaticLog(const TDesC& aFileName, const TDesC8& aText);
+
+/*!
+  @function StaticLog
+
+  @discussion Static option to append text to the log file (non-leaving version)
+  @param aFileName the file to append to
+  @param aText the text to append
+  */
+    IMPORT_C static void StaticLog(const TDesC& aFileName, const TDesC& aText);
+
+/*!
+  @function FileName
+
+  @discussion Get the file name and path of the file we are writing to
+  @param aFileName
+  */
+    void GetFileName( TDes& aFileName ) const;
+
+private:
+/*!
+  @function CLogFile
+  
+  @discussion Perform the first phase of two phase construction 
+  */
+    CLogFile();
+/*!
+  @function ConstructL
+  
+  @discussion  Perform the second phase construction of a CLogFile object
+  @param aFileName the file to open
+  @param aInitialiseLog if true, and the log file already exists, previous
+  contents will be deleted. If false, append to any existing contents
+  */
+    void ConstructL(const TDesC& aFileName, TBool aInitialiseLog);
+/*!
+  @function LogTimeInternal
+
+  @discussion Internal function to log time
+  */
+    void LogTimeInternal();
+/*!
+  @function LogTextInternal
+
+  @discussion Internal function to log text
+  @param aText the text to log
+  */
+    void LogTextInternal(const TDesC8& aText);
+/*!
+  @function LogByteInternal
+
+  @discussion internal function to log a byte
+  @param aByte the byte to log
+  */
+    void LogByteInternal(TUint8 aByte);
+/*!
+  @function LogIntInternal
+
+  @discussion Internal function to log an integer
+  @param aNumber the integer to log
+  */
+    void LogIntInternal(TUint aNumber);
+/*!
+  @function StartWrite
+
+  @discussion Perform any initial operation before the main log operation
+  */
+    void StartWrite();
+
+/*!
+  @function EndWrite
+
+  @discussion Perform any tidying up operations after the main log operation
+  */
+    void EndWrite();
+
+/*!
+  @function Write
+
+  @discussion Do the actual writing, and associated error checking
+  @param aText the text to write
+  */
+    void Write(const TDesC8& aText);
+
+/*!
+  @function DoLogTextL
+
+  @discussion Leaving functions from void Log(const TDesC& aText)
+  */
+    void DoLogTextL(const TDesC& aText);
+
+private:
+/*!
+  @var iLogFile handle to the log file
+  */
+    RFile       iLogFile;
+
+/*!
+  @var iSession file server session
+  */
+    RFs         iSession;
+
+/*!
+  @var iLogMillisecsPerTick number of millisecs per system timer tick
+  */
+    TInt        iLogMillisecsPerTick;
+
+/*!
+  @var iAutoFlush flag - AutoFlush on
+  */
+    TBool       iAutoFlush;
+
+/*!
+  @var iAutoTimestamp flag - AutoTimeStamp on
+  */
+    TBool       iAutoTimestamp;
+
+/*!
+  @var iAutoNewline flag - AutoNewline on
+  */
+    TBool       iAutoNewline;
+
+/*!
+  @var iCheckNestDepth internal to check StartWrite and EndWrite have been called correctly
+  */
+    TInt        iCheckNestDepth;
+
+    };
+
+#endif // __LOGFILE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/inc/logfile.pan	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+#ifndef __LOGFILE_PAN__
+#define __LOGFILE_PAN__
+
+_LIT(KLogFilePanic, "LogFile");
+
+enum TLogFilePanics 
+	{
+	ELogFileWriteFailed = 1,
+	ELogFileUtilityNotInstantiated
+	};
+
+#endif // __TESTFRAME_PAN__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/rom/VideoEditorCommon.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifdef RD_S60_SIMPLE_VIDEO_EDITOR
+
+#ifndef __VIDEOEDITORCOMMON_IBY__
+#define __VIDEOEDITORCOMMON_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+// VideoEditorCommon dll
+file=ABI_DIR\BUILD_DIR\VideoEditorCommon.dll	SHARED_LIB_DIR\VideoEditorCommon.dll
+
+#endif	// __VIDEOEDITORCOMMON_IBY__
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/rom/VideoEditorCommon_resource.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifdef RD_S60_SIMPLE_VIDEO_EDITOR
+
+#ifndef __VIDEOEDITORCOMMONRESOURCES_IBY__
+#define __VIDEOEDITORCOMMONRESOURCES_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+data=DATAZ_\RESOURCE_FILES_DIR\VideoEditorCommon.rsc	RESOURCE_FILES_DIR\VideoEditorCommon.rsc
+
+#endif	// __VIDEOEDITORCOMMONRESOURCES_IBY__
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VeiAddQueue.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,524 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+// INCLUDE FILES
+
+// System includes
+#include <bautils.h>
+#include <coemain.h>
+#include <mgfetch.h>
+
+// User includes
+#include "Veiaddqueue.h"
+#include "Veiimageclipgenerator.h"
+#include "VeiMGFetchVerifier.h"
+#include "VideoEditorUtils.h"
+#include "VideoEditorDebugUtils.h"
+
+
+EXPORT_C CVeiAddQueue* CVeiAddQueue::NewL( MVedAudioClipInfoObserver& aView, CVedMovie& aMovie, MVeiQueueObserver& aObserver )
+	{
+    CVeiAddQueue* self = CVeiAddQueue::NewLC( aView, aMovie, aObserver );
+    CleanupStack::Pop( self );
+
+    return self;
+	}
+
+
+EXPORT_C CVeiAddQueue* CVeiAddQueue::NewLC( MVedAudioClipInfoObserver& aView, CVedMovie& aMovie, MVeiQueueObserver& aObserver )
+	{
+    CVeiAddQueue* self = new (ELeave) CVeiAddQueue( aView, aMovie, aObserver );
+    CleanupStack::PushL( self ); 
+    self->ConstructL();
+
+    return self;
+	}
+
+CVeiAddQueue::CVeiAddQueue( MVedAudioClipInfoObserver& aView, CVedMovie& aMovie, MVeiQueueObserver& aObserver ) : 
+	CActive(CActive::EPriorityStandard), iObserver( &aObserver ), iMovie( aMovie ), iView( aView )
+	{
+	}
+
+void CVeiAddQueue::ConstructL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::ConstructL");
+
+	CActiveScheduler::Add(this);
+	iInsertVideoDialogOn = EFalse;
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;
+	iMovie.RegisterMovieObserverL( this );
+	}
+
+EXPORT_C CVeiAddQueue::~CVeiAddQueue()
+	{
+	iAddQueue.ResetAndDestroy();
+	delete iWaitScheduler;
+
+	if ( iAudioClipInfo )
+		{
+		delete iAudioClipInfo;
+		iAudioClipInfo = NULL;
+		}
+
+	iMovie.UnregisterMovieObserver( this );
+
+	iObserver = NULL;
+	iGenerator = NULL;
+	}
+
+
+EXPORT_C TBool CVeiAddQueue::ShowAudioClipDialogL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::ShowAudioClipDialogL() in");
+	// Audio insert dialog for single file
+	CDesCArrayFlat* selectedFiles = new ( ELeave ) CDesCArrayFlat( 1 );
+	CleanupStack::PushL(selectedFiles);
+
+	CVeiMGFetchVerifier* mgFetchVerifier = CVeiMGFetchVerifier::NewLC();
+
+	if ( MGFetch::RunL( *selectedFiles, EAudioFile, EFalse, mgFetchVerifier ) == EFalse )
+		{
+		// User cancelled the dialog.
+		CleanupStack::PopAndDestroy( mgFetchVerifier );
+		CleanupStack::PopAndDestroy( selectedFiles );
+		return EFalse;
+		}
+
+	CleanupStack::PopAndDestroy( mgFetchVerifier );
+
+	if ( iAudioClipInfo )
+		{
+		delete iAudioClipInfo;
+		iAudioClipInfo = NULL;
+		}
+	iObserver->NotifyQueueProcessingStarted( MVeiQueueObserver::EProcessingAudio );
+	// AudioClipInfoReady notifier is in EditVideoView
+	iAudioClipInfo = CVedAudioClipInfo::NewL( ( *selectedFiles )[0], iView );
+
+	CleanupStack::PopAndDestroy( selectedFiles );
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::ShowAudioClipDialogL() out");
+	return ETrue;
+	}
+
+
+
+EXPORT_C TBool CVeiAddQueue::ShowVideoClipDialogL( VideoEditor::TCursorLocation aLocation, TInt aCurrentIndex )
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::ShowVideoClipDialogL In");
+	// Video insert dialog for single file
+	CDesCArrayFlat* selectedFiles = new ( ELeave ) CDesCArrayFlat( 1 );
+	CleanupStack::PushL(selectedFiles);
+
+	CVeiMGFetchVerifier* mgFetchVerifier = CVeiMGFetchVerifier::NewLC();
+
+	if ( MGFetch::RunL( *selectedFiles, EVideoFile, EFalse, mgFetchVerifier ) == EFalse )
+		{
+		CleanupStack::PopAndDestroy( mgFetchVerifier );
+		CleanupStack::PopAndDestroy( selectedFiles );
+		return EFalse;
+		}
+
+	CleanupStack::PopAndDestroy( mgFetchVerifier );
+
+	TInt insertIndex;
+	iInsertVideoDialogOn = ETrue;
+
+	// Video clip is added next to selected video clip. If cursor is not on videotrack, clip is 
+	// inserted last. 
+	if ( iMovie.VideoClipCount() == 0 )
+		{
+		insertIndex = 0;
+		}
+	else if ( aLocation == VideoEditor::ECursorOnAudio || aLocation == VideoEditor::ECursorOnTransition )
+		{
+		insertIndex = iMovie.VideoClipCount();
+		}
+	else
+		{
+		insertIndex = aCurrentIndex + 1;
+		}
+
+	HBufC* filename = HBufC::NewLC( (*selectedFiles )[0].Length() );
+	*filename = (*selectedFiles )[0];
+	iAddQueue.Append( filename );
+	
+	iFailedCount = 0;
+	iInsertedCount = 0;
+
+	iTotalCount = iAddQueue.Count();
+
+	iObserver->NotifyQueueProcessingStarted( MVeiQueueObserver::EProcessingVideo );
+	AddNextL( insertIndex );	
+
+	CleanupStack::Pop(filename);
+	CleanupStack::PopAndDestroy( selectedFiles );
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::ShowVideoClipDialogL Out");
+	return ETrue;
+	}
+
+		
+EXPORT_C void CVeiAddQueue::InsertMediaL( const TDesC& aFilename )
+	{
+	// aFilename is added to queue. Queue processing is started with StartProcessingL() function. 
+	RFs&	fs = CCoeEnv::Static()->FsSession();
+
+	if ( BaflUtils::FileExists( fs, aFilename ) )
+		{
+		HBufC* filename = HBufC::NewLC( aFilename.Length() );
+		*filename = aFilename;
+		iAddQueue.Append( filename );
+
+		iTotalCount = iAddQueue.Count();
+
+		CleanupStack::Pop( filename ); 
+		}
+	}
+
+EXPORT_C TInt CVeiAddQueue::Count() const
+	{
+	return iTotalCount;
+	}
+
+EXPORT_C void CVeiAddQueue::StartProcessingL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::StartProcessingL");
+
+	iFailedCount = 0;
+	iInsertedCount = 0;
+
+	iTotalCount = iAddQueue.Count();
+
+	if ( iTotalCount > 0 )
+		{
+		iObserver->NotifyQueueProcessingStarted();
+		
+		AddNextL();
+		}
+	}
+
+TInt CVeiAddQueue::AddNextL( TInt aPosition )
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::AddNextL: In");
+
+// Image params
+	TTimeIntervalMicroSeconds imageDuration( 5000000 );
+
+	RFs&	fs = CCoeEnv::Static()->FsSession();
+	TInt insertErr( KErrNone );
+	TInt insertPosition;
+
+	for( TInt i=0;i<iTotalCount;i++ )
+		{
+		insertErr = KErrNone;
+
+		if ( iAddQueue.Count() > 0 )
+			{
+			TInt percentage;
+			percentage = STATIC_CAST( TInt, ( TReal(iInsertedCount+iFailedCount) / TReal(iTotalCount) )*100 + 0.5 );
+			iObserver->NotifyQueueProcessingProgressed( iInsertedCount+iFailedCount+1, percentage );
+
+			TDesC* filename = iAddQueue[0];
+
+			TBool fileExists = BaflUtils::FileExists( fs, *filename );
+
+			TParse file;
+			file.Set( *iAddQueue[0], NULL, NULL );
+
+			// Do not allow inserting DRM protected content.
+			if( VideoEditorUtils::IsDrmProtectedL(*filename) )
+				{
+				LOGFMT(KVideoEditorLogFile, "CVeiAddQueue::AddNextL: DRM protected file is rejected: %S", &filename);
+				insertErr = KErrAccessDenied;
+				}
+
+			if ( file.ExtPresent() && fileExists && KErrNone == insertErr )
+				{
+				if ( (file.Ext().CompareF( KExt3gp )== 0) ||
+						(file.Ext().CompareF( KExtMp4 )== 0 ))
+					{
+					if ( aPosition == -1 )
+						{
+						insertPosition = iMovie.VideoClipCount();
+						}
+					else
+						{
+						insertPosition = aPosition;
+						}
+					LOG(KVideoEditorLogFile, "CVeiAddQueue::AddNextL: 2");
+					iMovie.InsertVideoClipL( *filename, insertPosition );
+					LOG(KVideoEditorLogFile, "CVeiAddQueue::AddNextL: 3");
+					}
+				else
+					{
+					LOG(KVideoEditorLogFile, "CVeiAddQueue::AddNextL: 4");
+					TRAP( insertErr, 
+							iGenerator = CVeiImageClipGenerator::NewL(
+							file.FullName(), 
+							TSize(KMaxVideoFrameResolutionX,KMaxVideoFrameResolutionY), 
+							imageDuration, 
+							KRgbBlack, 
+							KVideoClipGenetatorDisplayMode, 
+							fs, 
+							*this) 
+						);
+					LOG(KVideoEditorLogFile, "CVeiAddQueue::AddNextL: 5");     		 
+					}
+						
+				}
+			if ( fileExists && insertErr == KErrNone )
+				{
+				iWaitScheduler->Start();
+				}
+			else
+				{
+				LOG(KVideoEditorLogFile, "CVeiAddQueue::AddNextL: 7");
+				if ( iInsertVideoDialogOn )
+					{
+					insertErr = EInsertingSingleClip;
+					}
+				else
+					{
+					insertErr = EInsertingFromGallery;
+					}
+				TFileName fileName = file.Name();
+				TBool cntn = iObserver->NotifyQueueClipFailed( fileName, insertErr );
+				if ( !cntn )
+					{
+					iAddQueue.Reset();
+					break;
+					}	
+				iFailedCount++;
+				}
+
+			delete iAddQueue[0];
+			iAddQueue.Remove( 0 );
+			} // if
+		} // for
+	LOGFMT2(KVideoEditorLogFile, "CVeiAddQueue::AddNextL: 8, iInsertedCount:%d, iFailedCount:%d", iInsertedCount, iFailedCount);
+	iObserver->NotifyQueueEmpty( iInsertedCount, iFailedCount );
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::AddNextL: Out");
+	return insertErr;
+	}
+
+EXPORT_C void CVeiAddQueue::GetNext()
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::GetNext: In");
+	if (iWaitScheduler->IsStarted() )
+		{
+		LOG(KVideoEditorLogFile, "CVeiAddQueue::GetNext: 1");
+		iWaitScheduler->AsyncStop();
+		}
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::GetNext: Out");
+	}
+
+void CVeiAddQueue::DoCancel()
+    {
+    }
+
+void CVeiAddQueue::RunL()
+    {
+    }
+
+
+void CVeiAddQueue::NotifyImageClipGeneratorInitializationComplete(
+	CVeiImageClipGenerator& /*aGenerator*/, TInt DEBUGLOG_ARG(aError) )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiAddQueue::NotifyImageClipGeneratorInitializationComplete: in, aError:%d", aError);
+	TRAP_IGNORE( iMovie.InsertVideoClipL(*iGenerator, ETrue, 0) );
+
+	// Generator is no longer our concern
+	iGenerator = NULL;
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyImageClipGeneratorInitializationComplete: out");
+	}
+
+
+void CVeiAddQueue::NotifyVideoClipAdded(CVedMovie& /*aMovie*/, TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipAdded: In");
+	iInsertedCount++;
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipAdded: Out");
+	}
+
+void CVeiAddQueue::NotifyVideoClipAddingFailed(CVedMovie& /*aMovie*/, TInt DEBUGLOG_ARG(aError) )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipAddingFailed: In, aError:%d", aError);
+	TInt error;
+
+	if ( iInsertVideoDialogOn )
+		{
+		error = EInsertingSingleClip;
+		}
+	else
+		{
+		error = EInsertingFromGallery;
+		}
+
+
+	TParse file;
+	file.Set( *iAddQueue[0], NULL, NULL );
+
+	TFileName fileName = file.Name();
+	TBool ifContinue = iObserver->NotifyQueueClipFailed( fileName, error );
+	if ( ifContinue && (error == EInsertingFromGallery) )
+		{
+		LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipAddingFailed: 1");
+		iObserver->NotifyQueueProcessingStarted();
+		GetNext();
+		}
+	else
+		{
+		// @: release iWaitScheduler
+		LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipAddingFailed: 2");
+		iWaitScheduler->AsyncStop();
+		LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipAddingFailed: 3");
+		}
+	iFailedCount++;
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipAddingFailed: Out");
+	}
+
+void CVeiAddQueue::NotifyVideoClipRemoved(CVedMovie& /*aMovie*/, TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipRemoved: In and out");
+	}
+
+void CVeiAddQueue::NotifyVideoClipIndicesChanged(CVedMovie& /*aMovie*/, TInt /*aOldIndex*/,
+									           TInt /*aNewIndex*/)
+   	{
+   	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipIndicesChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyVideoClipTimingsChanged(CVedMovie& /*aMovie*/,
+										   TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipTimingsChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyVideoClipColorEffectChanged(CVedMovie& /*aMovie*/,
+												   TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipColorEffectChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyVideoClipAudioSettingsChanged(CVedMovie& /*aMovie*/,
+											         TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipAudioSettingsChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyVideoClipGeneratorSettingsChanged(CVedMovie& /*aMovie*/,
+											             TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipGeneratorSettingsChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyVideoClipDescriptiveNameChanged(CVedMovie& /*aMovie*/,
+																TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipDescriptiveNameChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyStartTransitionEffectChanged(CVedMovie& /*aMovie*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyStartTransitionEffectChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyMiddleTransitionEffectChanged(CVedMovie& /*aMovie*/, 
+													 TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyMiddleTransitionEffectChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyEndTransitionEffectChanged(CVedMovie& /*aMovie*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyEndTransitionEffectChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyAudioClipAdded(CVedMovie& /*aMovie*/, TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyAudioClipAdded: In and out");
+	}
+
+void CVeiAddQueue::NotifyAudioClipAddingFailed(CVedMovie& /*aMovie*/, TInt DEBUGLOG_ARG(aError) )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiAddQueue::NotifyAudioClipAddingFailed: In and out, aError:%d", aError);
+	}
+
+void CVeiAddQueue::NotifyAudioClipRemoved(CVedMovie& /*aMovie*/, TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyAudioClipRemoved: In and out");
+	}
+
+void CVeiAddQueue::NotifyAudioClipIndicesChanged(CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, 
+									           TInt /*aNewIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyAudioClipIndicesChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyAudioClipTimingsChanged(CVedMovie& /*aMovie*/,
+											   TInt /*aIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyAudioClipTimingsChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyMovieQualityChanged(CVedMovie& /*aMovie*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyMovieQualityChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyMovieReseted(CVedMovie& /*aMovie*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyMovieReseted: In and out");
+	}
+
+void CVeiAddQueue::NotifyMovieOutputParametersChanged(CVedMovie& /*aMovie*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyMovieOutputParametersChanged: In and out");
+	}
+
+void CVeiAddQueue::NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, 
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyAudioClipDynamicLevelMarkInserted: In and out");
+	}
+
+void CVeiAddQueue::NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyAudioClipDynamicLevelMarkRemoved: In and out");
+	}
+
+void CVeiAddQueue::NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/,
+                                                         TInt /*aClipIndex*/, 
+                                                         TInt /*aMarkIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipDynamicLevelMarkInserted: In and out");
+	}
+
+void CVeiAddQueue::NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, 
+                                                        TInt /*aClipIndex*/, 
+                                                        TInt /*aMarkIndex*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiAddQueue::NotifyVideoClipDynamicLevelMarkRemoved: In and out");
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VeiDisplayLighter.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// INCLUDE FILES
+
+// User includes
+#include "VeiDisplayLighter.h"
+
+EXPORT_C CVeiDisplayLighter* CVeiDisplayLighter::NewL()
+	{
+	CVeiDisplayLighter* self = new (ELeave) CVeiDisplayLighter();
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+CVeiDisplayLighter::CVeiDisplayLighter(): CActive( CActive::EPriorityLow )
+	{
+	CActiveScheduler::Add( this );
+	}
+
+CVeiDisplayLighter::~CVeiDisplayLighter()
+	{
+	Cancel();
+	iTimer.Close();
+	}
+
+void CVeiDisplayLighter::ConstructL()
+	{
+	iTimeout = 10;
+	iTimer.CreateLocal();
+	}
+
+EXPORT_C void CVeiDisplayLighter::Reset()
+	{
+	Cancel();
+	Start();
+	}
+
+EXPORT_C void CVeiDisplayLighter::Stop()
+	{
+	Cancel();
+	}
+
+
+void CVeiDisplayLighter::DoCancel()
+	{
+	iTimer.Cancel();
+	}
+
+EXPORT_C void CVeiDisplayLighter::Start()
+	{
+	if ( !IsActive() )
+		{
+		iTimer.Inactivity( iStatus, iTimeout );
+		SetActive();
+		}
+	}
+
+void CVeiDisplayLighter::RunL()
+	{
+	if ( iStatus == KErrNone )
+		{
+		TInt inactivity = User::InactivityTime().Int();
+		if ( inactivity >= iTimeout )
+			{
+			User::ResetInactivityTime();
+			iTimer.Inactivity( iStatus, iTimeout );
+			SetActive();
+			}
+		}
+	}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VeiFrameTaker.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// INCLUDE FILES
+
+// System includes
+#include <e32base.h>
+#include <vedmovie.h>
+#include <fbs.h>
+// User includes
+
+#include "VideoEditorDebugUtils.h"
+#include "veiframetaker.h"
+
+CVeiFrameTaker::CVeiFrameTaker( MVeiFrameTakerObserver& aObserver ) : CActive(CActive::EPriorityLow), iObserver( aObserver )
+	{
+	}
+
+
+CVeiFrameTaker::~CVeiFrameTaker()
+	{
+	delete iWaitScheduler;
+	delete iFirstFrame;
+	delete iLastFrame;
+    delete iTimelineFrame;
+	}
+
+
+
+EXPORT_C CVeiFrameTaker* CVeiFrameTaker::NewL( MVeiFrameTakerObserver& aObserver )
+	{
+	CVeiFrameTaker* self = new (ELeave) CVeiFrameTaker( aObserver );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+	}
+
+EXPORT_C void CVeiFrameTaker::GetFramesL( CVedVideoClipInfo& aInfo,
+									  TInt const aFirstFrame,  TSize* const aFirstResolution,
+									  TInt const aLastFrame,  TSize* const aLastResolution,
+                                      TInt const aTimelineFrame,  TSize* const aTimelineResolution,
+									  TInt aPriority)
+	{
+	LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: In");
+	iError = KErrNone;
+	iFrameCount = 0;
+
+	delete iFirstFrame;
+	iFirstFrame = NULL;
+	delete iLastFrame;
+	iLastFrame = NULL;
+    delete iTimelineFrame;
+    iTimelineFrame = NULL;
+
+	LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 1");
+	aInfo.GetFrameL( *this, aFirstFrame, aFirstResolution, EColor64K, EFalse, aPriority );
+	LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 2");
+	
+	if ( iFrameCount == 0 )		// GetFrameL is still active, so start waiting
+		{		
+		LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 3");
+		iWaitScheduler->Start();
+		LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 4");
+		}
+	LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 5");
+	if ( iError == KErrNone )
+		{
+		LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 6");
+		aInfo.GetFrameL( *this, aLastFrame, aLastResolution, EColor64K, EFalse, aPriority );
+		LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 7");
+		if ( iFrameCount == 1 )	
+			{			
+			LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 8");
+			iWaitScheduler->Start();
+			LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 9");
+			}
+			LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 10");
+		}
+	LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 11");	
+    if ( iError == KErrNone )
+        {
+        LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 12");
+        aInfo.GetFrameL( *this, aTimelineFrame, aTimelineResolution, EColor64K, EFalse, aPriority );
+		LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 13");
+        if ( iFrameCount == 2 )	
+        	{
+        	LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 14");        
+			iWaitScheduler->Start();
+			LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 15");
+        	}        	
+        }
+	LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: 16");
+	iObserver.NotifyFramesCompleted( iFirstFrame, iLastFrame, iTimelineFrame, iError );
+	LOG(KVideoEditorLogFile, "CVeiFrameTaker::GetFramesL: Out");
+	}
+
+void CVeiFrameTaker::ConstructL()
+	{
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;
+	CActiveScheduler::Add(this);
+	}
+
+void CVeiFrameTaker::DoCancel()
+    {
+    }
+
+void CVeiFrameTaker::RunL()
+    {
+    iWaitScheduler->AsyncStop();
+    }
+
+void CVeiFrameTaker::NotifyVideoClipFrameCompleted(CVedVideoClipInfo& /*aInfo*/, TInt aError, CFbsBitmap* aFrame)
+    {
+	iError = aError;
+
+	if ( iFrameCount == 0 )
+		{
+		iFirstFrame = aFrame;
+		}
+	else if ( iFrameCount == 1 )
+		{
+		iLastFrame = aFrame;
+		}
+    else if ( iFrameCount == 2 )
+		{
+		iTimelineFrame = aFrame;
+		}
+
+	iFrameCount++;
+// Text frame generator is quite fast, so waitscheduler is not
+// started everytime.
+	if (iWaitScheduler->IsStarted() )
+		iWaitScheduler->AsyncStop();
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VeiImageClipGenerator.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,999 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "VeiImageClipGenerator.h"
+
+#include <VedMovie.h>
+#include <fbs.h>
+#include <bitdev.h>
+#include <gdi.h>
+#include <aknutils.h>
+#include <ImageConversion.h>
+#include <BitmapTransforms.h>
+
+#define KMiddleFrameDuration TTimeIntervalMicroSeconds(1000000)
+
+const TInt KNumberOfTransitionFrames = 10;
+
+EXPORT_C CVeiImageClipGenerator* CVeiImageClipGenerator::NewL(const TDesC& aFilename,
+												     const TSize& aMaxResolution,
+													 const TTimeIntervalMicroSeconds& aDuration, 
+													 const TRgb& aBackgroundColor,
+													 TDisplayMode aMaxDisplayMode,
+													 RFs& aFs,
+													 MVeiImageClipGeneratorObserver& aObserver)
+	{
+	CVeiImageClipGenerator* self = 
+		CVeiImageClipGenerator::NewLC(aFilename, aMaxResolution, aDuration, aBackgroundColor, aMaxDisplayMode, aFs, aObserver);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+
+EXPORT_C CVeiImageClipGenerator* CVeiImageClipGenerator::NewLC(const TDesC& aFilename,
+													  const TSize& aMaxResolution,
+													  const TTimeIntervalMicroSeconds& aDuration,
+													  const TRgb& aBackgroundColor,
+													  TDisplayMode aMaxDisplayMode,
+													  RFs& aFs,
+													  MVeiImageClipGeneratorObserver& aObserver)
+	{
+	CVeiImageClipGenerator* self = new (ELeave) CVeiImageClipGenerator(aDuration, aBackgroundColor, aMaxResolution);
+	CleanupStack::PushL(self);
+	self->ConstructL(aFilename, aObserver, aMaxDisplayMode, aFs);
+	return self;
+	}
+
+
+CVeiImageClipGenerator::CVeiImageClipGenerator(const TTimeIntervalMicroSeconds& aDuration, 
+											   const TRgb& aBackgroundColor,
+											   const TSize& aMaxResolution)
+   : iReady(EFalse), iMaxResolution(aMaxResolution), iBackgroundColor(aBackgroundColor), iInitializing(ETrue)
+	{
+	__ASSERT_ALWAYS(iMaxResolution.iHeight >= 0, TVedPanic::Panic(TVedPanic::EImageClipGeneratorIllegalMaxResolution));
+	__ASSERT_ALWAYS(iMaxResolution.iWidth >= 0, TVedPanic::Panic(TVedPanic::EImageClipGeneratorIllegalMaxResolution));
+
+	SetDuration(aDuration);
+
+	iInitializing = EFalse;
+	}
+
+
+void CVeiImageClipGenerator::ConstructL(const TDesC& aFilename, 
+										MVeiImageClipGeneratorObserver& aObserver, 
+										TDisplayMode aMaxDisplayMode, RFs& aFs)
+	{
+	iDecodeOperation = CVeiImageClipDecodeOperation::NewL(*this, aFilename, aObserver, aFs);
+	iFrameOperation = CVeiImageClipFrameOperation::NewL(*this);
+	
+	iFilename = aFilename.AllocL();
+
+	TParse parse;
+	parse.Set(aFilename, 0, 0);
+	iDescriptiveName = parse.Name().AllocL();
+
+	iDecodeOperation->StartOperationL(iMaxResolution, aMaxDisplayMode);
+	}
+
+
+EXPORT_C CVeiImageClipGenerator::~CVeiImageClipGenerator()
+	{
+	delete iDecodeOperation;
+	delete iFrameOperation;
+	delete iDescriptiveName;
+	delete iBitmap;
+	delete iMask;
+	delete iFilename;
+	}
+
+
+EXPORT_C TPtrC CVeiImageClipGenerator::DescriptiveName() const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));
+
+	return *iDescriptiveName;
+	}
+
+
+EXPORT_C TUid CVeiImageClipGenerator::Uid() const
+	{
+	return KUidImageClipGenerator;
+	}
+
+EXPORT_C TTimeIntervalMicroSeconds CVeiImageClipGenerator::Duration() const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));
+
+	return iDuration;
+	}
+
+
+EXPORT_C TInt CVeiImageClipGenerator::VideoFrameCount() const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));
+
+	TInt frameCount = 0;
+
+	TInt maxFramerate = 10;
+	if (IsInserted()) 
+		{
+		maxFramerate = Movie()->MaximumFramerate();
+		}
+
+	TTimeIntervalMicroSeconds frameDuration(TInt64(1000000 / maxFramerate));
+	if (iDuration.Int64() < (TInt64(KNumberOfTransitionFrames * 2 + 1) * frameDuration.Int64()))
+		{
+		frameCount = (static_cast<TInt>(iDuration.Int64() / frameDuration.Int64()));
+		if ((iDuration.Int64() % frameDuration.Int64()) != 0)
+			{
+			frameCount++;
+			}
+		}
+	else
+		{
+		frameCount = KNumberOfTransitionFrames * 2; 
+		TTimeIntervalMicroSeconds middleTime(iDuration.Int64() - (TInt64(KNumberOfTransitionFrames * 2) * frameDuration.Int64()));
+		frameCount += (static_cast<TInt32>(middleTime.Int64() / KMiddleFrameDuration.Int64()));
+		if ((middleTime.Int64() % KMiddleFrameDuration.Int64()) != 0)
+			{
+			frameCount++;
+			}
+		}
+	return frameCount;
+	}
+
+
+EXPORT_C TTimeIntervalMicroSeconds CVeiImageClipGenerator::VideoFrameStartTime(TInt aIndex) const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));
+	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < VideoFrameCount(), TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalVideoFrameIndex));
+	
+	TInt maxFramerate = 10;
+	if (IsInserted()) 
+		{
+		maxFramerate = Movie()->MaximumFramerate();
+		}
+
+	TTimeIntervalMicroSeconds frameDuration(TInt64(1000000 / maxFramerate));
+	TTimeIntervalMicroSeconds finalThreshold(iDuration.Int64() - TInt64(KNumberOfTransitionFrames) * frameDuration.Int64());
+	TTimeIntervalMicroSeconds startThreshold(TInt64(KNumberOfTransitionFrames) * frameDuration.Int64());
+	TTimeIntervalMicroSeconds startTime(-1);
+	TInt frameCount = VideoFrameCount();
+
+
+	if (frameCount < (KNumberOfTransitionFrames * 2 + 1))
+		{		
+		// Special case: less than KNumberOfTransitionFrames frames in the movie
+		startTime = TTimeIntervalMicroSeconds(TInt64(aIndex) * frameDuration.Int64());
+		}
+	else if (aIndex < KNumberOfTransitionFrames) 
+		{
+		// Start frames
+		startTime = TTimeIntervalMicroSeconds(TInt64(aIndex) * frameDuration.Int64());
+		}
+	else if (aIndex >= (frameCount - KNumberOfTransitionFrames))
+		{
+		// End frames
+		startTime = TTimeIntervalMicroSeconds(
+			static_cast<TInt64>((aIndex - frameCount) + KNumberOfTransitionFrames) 
+			* frameDuration.Int64() + finalThreshold.Int64() );
+		}
+	else  
+		{
+		// Middle frames
+		startTime = TTimeIntervalMicroSeconds(startThreshold.Int64() 
+			+ TInt64(aIndex- KNumberOfTransitionFrames) * KMiddleFrameDuration.Int64());
+		}
+
+	return startTime;
+	}
+
+
+EXPORT_C TTimeIntervalMicroSeconds CVeiImageClipGenerator::VideoFrameEndTime(TInt aIndex) const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));
+	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < VideoFrameCount(), TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalVideoFrameIndex));
+	
+	if (aIndex == VideoFrameCount() - 1) 
+		{
+		return iDuration;
+		}
+
+	TInt maxFramerate = 10;
+	if (IsInserted()) 
+		{
+		maxFramerate = Movie()->MaximumFramerate();
+		}
+
+	TTimeIntervalMicroSeconds frameDuration(TInt64(1000000 / maxFramerate));
+	TTimeIntervalMicroSeconds finalThreshold(iDuration.Int64() - TInt64(KNumberOfTransitionFrames) * frameDuration.Int64());
+	TTimeIntervalMicroSeconds startThreshold(TInt64(KNumberOfTransitionFrames) * frameDuration.Int64());
+	TTimeIntervalMicroSeconds endTime(-1);
+
+
+	TInt frameCount = VideoFrameCount();
+
+	if (frameCount < (KNumberOfTransitionFrames * 2 + 1))
+		{
+		// Special case: less than KNumberOfTransitionFrames frames in the movie
+		endTime = TTimeIntervalMicroSeconds(TInt64(aIndex + 1) * frameDuration.Int64());
+		}
+	else if (aIndex < KNumberOfTransitionFrames) 
+		{
+		// start frames
+		endTime = TTimeIntervalMicroSeconds(TInt64(aIndex + 1) * frameDuration.Int64());
+		}
+	else if (aIndex > (frameCount - KNumberOfTransitionFrames))
+		{
+		// end frames
+		endTime = TTimeIntervalMicroSeconds(TInt64((aIndex - frameCount) 
+			+ KNumberOfTransitionFrames) * frameDuration.Int64() 
+			+ finalThreshold.Int64());
+		}
+	else  
+		{
+		// middle frames
+		endTime = TTimeIntervalMicroSeconds(startThreshold.Int64() 
+			+ TInt64(aIndex - (KNumberOfTransitionFrames - 1)) 
+			* KMiddleFrameDuration.Int64());
+
+		if (endTime.Int64() >= finalThreshold.Int64())
+			{
+			// last of the middle frames may be shorter than normal
+			endTime = finalThreshold;
+			}
+		}
+	return endTime;
+	}
+
+
+EXPORT_C TTimeIntervalMicroSeconds CVeiImageClipGenerator::VideoFrameDuration(TInt aIndex) const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));
+	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < VideoFrameCount(), TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalVideoFrameIndex));
+
+
+	// check maximum framerate
+	TInt maxFramerate = 10;
+	if (IsInserted()) 
+		{
+		maxFramerate = Movie()->MaximumFramerate();
+		}
+
+	// calculate some timing values. 
+	TTimeIntervalMicroSeconds frameDuration(TInt64(1000000 / maxFramerate));
+	TTimeIntervalMicroSeconds finalThreshold(iDuration.Int64() - TInt64(KNumberOfTransitionFrames) * frameDuration.Int64());
+	TTimeIntervalMicroSeconds startThreshold(TInt64(KNumberOfTransitionFrames) * frameDuration.Int64());
+
+
+	TInt frameCount = VideoFrameCount();
+	TInt finalThresholdIndex = GetVideoFrameIndex(finalThreshold);
+
+	if ((frameCount < (KNumberOfTransitionFrames * 2 + 1)) && (aIndex == (frameCount - 1)))
+		{
+		// Special case: short clip with only frames that have max framerate 
+		// - all of the frames are of equal duration (frameDuration) except 
+		// the last one.
+		frameDuration = TTimeIntervalMicroSeconds(iDuration.Int64() - (TInt64(frameCount - 1) * frameDuration.Int64()));
+		}
+	else if (aIndex >= KNumberOfTransitionFrames && aIndex < finalThresholdIndex) 
+		{
+		if (aIndex == (finalThresholdIndex - 1)) 
+			{
+			// Last one of the middle frames
+			frameDuration = TTimeIntervalMicroSeconds(finalThreshold.Int64() - VideoFrameStartTime(aIndex).Int64());
+			}
+		else
+			{
+			// Ordinary middle frame
+			frameDuration = KMiddleFrameDuration;
+			}
+		}
+	return frameDuration;
+	}
+
+EXPORT_C TBool CVeiImageClipGenerator::VideoFrameIsIntra(TInt aIndex) const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));
+	if (aIndex == 0) 
+		{
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+EXPORT_C TInt CVeiImageClipGenerator::VideoFirstFrameComplexityFactor() const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));
+	return iFirstFrameComplexityFactor;
+	}
+
+EXPORT_C TInt CVeiImageClipGenerator::VideoFrameDifferenceFactor(TInt aIndex) const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));
+	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < VideoFrameCount(), TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalVideoFrameIndex));
+
+	if (aIndex == 0) 
+		{
+		return 1000;
+		}
+	else 
+		{
+		return 0;
+		}
+	}
+
+
+EXPORT_C TInt CVeiImageClipGenerator::GetVideoFrameIndex(TTimeIntervalMicroSeconds aTime) const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));
+	__ASSERT_ALWAYS(aTime.Int64() >= 0, TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalVideoFrameTime));
+	__ASSERT_ALWAYS(aTime.Int64() <= iDuration.Int64(), TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalVideoFrameTime));
+
+	TInt index = -1;
+
+	TInt maxFramerate = 10;
+	if (IsInserted()) 
+		{
+		maxFramerate = Movie()->MaximumFramerate();
+		}
+
+	TTimeIntervalMicroSeconds frameDuration(TInt64(1000000 / maxFramerate));
+	TTimeIntervalMicroSeconds finalThreshold(
+		iDuration.Int64() - TInt64(KNumberOfTransitionFrames) * frameDuration.Int64());
+	TTimeIntervalMicroSeconds startThreshold(
+		TInt64(KNumberOfTransitionFrames) * frameDuration.Int64());
+
+	if (iDuration <= (TInt64(KNumberOfTransitionFrames * 2) * frameDuration.Int64())) 
+		{
+		index = static_cast<TInt>(aTime.Int64() / frameDuration.Int64());
+		}
+	else if (aTime < startThreshold) 
+		{
+		index = static_cast<TInt>(aTime.Int64() / frameDuration.Int64());
+		}
+	else if (aTime >= finalThreshold) 
+		{
+		TTimeIntervalMicroSeconds middleDuration(finalThreshold.Int64() - startThreshold.Int64());
+		TInt numberOfMiddleFrames = 
+		    static_cast<TInt32>(middleDuration.Int64() / KMiddleFrameDuration.Int64());
+		if (middleDuration.Int64() % KMiddleFrameDuration.Int64() != 0) 
+			{
+			numberOfMiddleFrames++;
+			}
+
+		index = KNumberOfTransitionFrames + numberOfMiddleFrames 
+			+ static_cast<TInt>((aTime.Int64() - finalThreshold.Int64()) / frameDuration.Int64()); 
+		}
+	else  
+		{
+		index = KNumberOfTransitionFrames 
+			+ static_cast<TInt>((aTime.Int64() - startThreshold.Int64()) / KMiddleFrameDuration.Int64());
+		}
+	
+	return index;
+	}
+
+
+EXPORT_C void CVeiImageClipGenerator::GetFrameL(MVedVideoClipGeneratorFrameObserver& aObserver,
+								  TInt aIndex, TSize* const aResolution,
+								  TDisplayMode aDisplayMode, TBool aEnhance,
+								  TInt aPriority)
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));
+	__ASSERT_ALWAYS((aIndex >= 0  && aIndex < VideoFrameCount()) || 
+					 aIndex == KFrameIndexBestThumb, 
+					TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalVideoFrameIndex));
+	__ASSERT_ALWAYS((aResolution->iHeight <= iMaxResolution.iHeight &&
+					 aResolution->iWidth  <= iMaxResolution.iWidth), 
+					TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalFrameResolution));
+	__ASSERT_ALWAYS((aResolution->iHeight >= 0 && aResolution->iWidth  >= 0), 
+					TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalFrameResolution));
+	
+
+    TDisplayMode displayMode = aDisplayMode;
+
+    // check validity of thumbnail and associated operation
+    if(aEnhance)	// for saving to file
+        {
+        if(displayMode == ENone)					// if no preference
+			{
+            displayMode = EColor16M;				// 24-bit color image for enhancement
+			}
+        else if(displayMode != EColor16M)	// invalid combination
+			{
+            User::Leave(KErrNotSupported);
+			}
+        }
+    else								// for screen display
+        {
+        if(displayMode == ENone)					// if no preference
+			{
+            displayMode = EColor64K;				// 16-bit image 
+			}
+        }
+    
+    CFbsBitmap* destBitmap = new (ELeave) CFbsBitmap;
+	CleanupStack::PushL(destBitmap);
+	User::LeaveIfError(destBitmap->Create(*aResolution, displayMode));
+	CleanupStack::Pop(destBitmap);
+
+	iFrameOperation->StartOperationL(&aObserver, aIndex, aEnhance, iBitmap,
+		destBitmap, iMask, aPriority);
+	}
+
+
+EXPORT_C void CVeiImageClipGenerator::CancelFrame()
+	{
+	iFrameOperation->Cancel();
+	}
+
+	
+EXPORT_C void CVeiImageClipGenerator::SetDuration(const TTimeIntervalMicroSeconds& aDuration)
+	{
+	__ASSERT_ALWAYS(iReady || iInitializing,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));	
+	__ASSERT_ALWAYS(aDuration.Int64() > 0, 
+		TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalDuration));
+
+	iDuration = aDuration;
+
+	if (!iInitializing) 
+		{
+		ReportDurationChanged();
+		}
+	}
+
+
+EXPORT_C void CVeiImageClipGenerator::SetBackgroundColor(const TRgb& aBackgroundColor)
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));	
+
+	iBackgroundColor = aBackgroundColor;
+	ReportSettingsChanged();
+	}
+
+EXPORT_C const TRgb& CVeiImageClipGenerator::BackgroundColor() const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));	
+
+	return iBackgroundColor;
+	}
+
+EXPORT_C TPtrC CVeiImageClipGenerator::ImageFilename() const
+	{
+	__ASSERT_ALWAYS(iReady,
+		TVedPanic::Panic(TVedPanic::EImageClipGeneratorNotReady));	
+	return *iFilename;
+	}
+
+void CVeiImageClipGenerator::UpdateFirstFrameComplexityFactorL()
+	{
+	iFirstFrameComplexityFactor = CalculateFrameComplexityFactor(iBitmap);
+	}
+
+//////////////////////////////////////////////////////////////////////////
+//  Decode operation
+//////////////////////////////////////////////////////////////////////////
+
+
+CVeiImageClipDecodeOperation* CVeiImageClipDecodeOperation::NewL(CVeiImageClipGenerator& aGenerator, 
+																 const TDesC& aFilename, 
+																 MVeiImageClipGeneratorObserver& aObserver,
+																 RFs& aFs,
+																 TInt aPriority)
+	{
+    CVeiImageClipDecodeOperation* self = 
+		new (ELeave) CVeiImageClipDecodeOperation(aGenerator, aObserver, aPriority);
+    CleanupStack::PushL(self);
+    self->ConstructL(aFilename, aFs);
+    CleanupStack::Pop(self);
+    return self;	
+	}
+
+
+CVeiImageClipDecodeOperation::CVeiImageClipDecodeOperation(CVeiImageClipGenerator& aGenerator, 
+														   MVeiImageClipGeneratorObserver& aObserver,
+														   TInt aPriority)
+  : CActive(aPriority), iGenerator(aGenerator), iObserver(aObserver)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+
+void CVeiImageClipDecodeOperation::ConstructL(const TDesC& aFilename, RFs& aFs)
+	{
+	iDecoder = CImageDecoder::FileNewL(aFs, aFilename);
+	}
+
+
+CVeiImageClipDecodeOperation::~CVeiImageClipDecodeOperation()
+	{
+	Cancel();
+
+	delete iDecoder;
+	iDecoder = 0;
+	delete iBitmap;
+	iBitmap = 0;
+	delete iMask;
+	iMask = 0;
+	}
+
+
+void CVeiImageClipDecodeOperation::DoCancel()
+	{
+	if (iDecoder) 
+		{
+		iDecoder->Cancel();
+		}
+
+	delete iDecoder;
+	iDecoder = 0;
+
+	delete iBitmap;
+	iBitmap = 0;
+
+	delete iMask;
+	iMask = 0;
+
+	iObserver.NotifyImageClipGeneratorInitializationComplete(iGenerator, KErrCancel);
+	}
+
+
+void CVeiImageClipDecodeOperation::RunL()
+	{
+	/* Transfer ownership of iBitmap to generator. */
+	iGenerator.iBitmap = iBitmap;
+	iBitmap = 0;
+	iGenerator.iMask = iMask;
+	iMask = 0;
+	iGenerator.iReady = ETrue;
+	iGenerator.UpdateFirstFrameComplexityFactorL();
+
+	/* Notify observer. */
+	iObserver.NotifyImageClipGeneratorInitializationComplete(iGenerator, KErrNone);
+	delete iDecoder;
+	iDecoder = 0;
+	}
+
+TInt CVeiImageClipDecodeOperation::RunError(TInt aError)
+	{
+	if (iDecoder) 
+		{
+		iDecoder->Cancel();
+		}
+	delete iDecoder;
+	iDecoder = 0;
+	delete iBitmap;
+	iBitmap = 0;
+	delete iMask;
+	iMask = 0;
+
+	iObserver.NotifyImageClipGeneratorInitializationComplete(iGenerator, aError);
+	return KErrNone;
+	}
+
+
+
+void CVeiImageClipDecodeOperation::StartOperationL(const TSize& aMaxResolution, TDisplayMode aDisplayMode)
+	{
+	__ASSERT_ALWAYS(!IsActive(), TVedPanic::Panic(TVedPanic::EInternal));
+
+	const TFrameInfo& info = iDecoder->FrameInfo();
+	TSize targetResolution(0, 0);
+	const TSize sourceResolution(info.iOverallSizeInPixels);
+
+	/* Calculate resolution. */
+
+	if ((sourceResolution.iWidth <= aMaxResolution.iWidth) 
+		&& (sourceResolution.iHeight <= aMaxResolution.iHeight))
+		{
+		targetResolution.iWidth = sourceResolution.iWidth;
+		targetResolution.iHeight = sourceResolution.iHeight;
+		}
+	else if (info.iFlags & TFrameInfo::EFullyScaleable) 
+		{
+		if ((sourceResolution.iWidth * aMaxResolution.iHeight) > 
+			(sourceResolution.iHeight * aMaxResolution.iWidth))
+			{
+			targetResolution.iWidth = aMaxResolution.iWidth;
+			targetResolution.iHeight = 
+				(targetResolution.iWidth * sourceResolution.iHeight) / sourceResolution.iWidth;
+			}
+		else
+			{
+			targetResolution.iHeight = aMaxResolution.iHeight;
+			targetResolution.iWidth = 
+				(targetResolution.iHeight * sourceResolution.iWidth) / sourceResolution.iHeight;
+			}
+		}
+	else 
+		{
+		targetResolution.iWidth = (sourceResolution.iWidth / 8) + 1;
+		targetResolution.iHeight = (sourceResolution.iHeight / 8) + 1;
+		
+		if ((targetResolution.iWidth < aMaxResolution.iWidth) 
+			&& (targetResolution.iHeight < aMaxResolution.iHeight))
+			{
+			targetResolution.iWidth = (sourceResolution.iWidth / 4) + 1;
+			targetResolution.iHeight = (sourceResolution.iHeight / 4) + 1;
+			}
+
+		if ((targetResolution.iWidth < aMaxResolution.iWidth) 
+			&& (targetResolution.iHeight < aMaxResolution.iHeight))
+			{
+			targetResolution.iWidth = (sourceResolution.iWidth / 2) + 1;
+			targetResolution.iHeight = (sourceResolution.iHeight / 2) + 1;
+			}
+
+		if ((targetResolution.iWidth < aMaxResolution.iWidth) 
+			&& (targetResolution.iHeight < aMaxResolution.iHeight))
+			{
+			targetResolution.iWidth = (sourceResolution.iWidth);
+			targetResolution.iHeight = (sourceResolution.iHeight);
+			}
+		}
+
+
+	iBitmap = new (ELeave) CFbsBitmap;
+	TInt err = iBitmap->Create(targetResolution, aDisplayMode);
+
+	if (err != KErrNone) 
+		{
+		delete iBitmap;
+		iBitmap = 0;
+		iObserver.NotifyImageClipGeneratorInitializationComplete(iGenerator, err);
+		return;
+		}
+
+	if (info.iFlags & TFrameInfo::ETransparencyPossible)
+		{
+		iMask = new (ELeave) CFbsBitmap;
+		if (info.iFlags & TFrameInfo::EAlphaChannel) 
+			{
+			err = iMask->Create(targetResolution, EGray256);
+			}
+		else 
+			{
+			err = iMask->Create(targetResolution, EGray2);
+			}
+		}
+	
+	if (err != KErrNone) 
+		{
+		delete iBitmap;
+		iBitmap = 0;
+		delete iMask;
+		iMask = 0;
+		iObserver.NotifyImageClipGeneratorInitializationComplete(iGenerator, err);
+		return;
+		}
+
+	if (iMask != 0)
+		{
+		iDecoder->Convert(&iStatus, *iBitmap, *iMask);
+		}
+	else
+		{
+		iDecoder->Convert(&iStatus, *iBitmap);
+		}
+
+	SetActive();
+	}
+
+
+//////////////////////////////////////////////////////////////////////////
+// Frame operation
+//////////////////////////////////////////////////////////////////////////
+
+CVeiImageClipFrameOperation* CVeiImageClipFrameOperation::NewL(CVeiImageClipGenerator& aGenerator)
+    {
+    CVeiImageClipFrameOperation* self = 
+		new (ELeave) CVeiImageClipFrameOperation(aGenerator);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+CVeiImageClipFrameOperation::CVeiImageClipFrameOperation(CVeiImageClipGenerator& aGenerator)
+		: CActive(EPriorityStandard), iGenerator(aGenerator)
+    {
+	CActiveScheduler::Add(this);
+	}
+
+
+void CVeiImageClipFrameOperation::ConstructL()
+    {
+	}
+
+
+CVeiImageClipFrameOperation::~CVeiImageClipFrameOperation()
+    {
+	Cancel();
+	delete iScaler;
+	iScaler = 0;
+	delete iDestBitmap;
+	iDestBitmap = 0;
+	delete iScaledBitmap;
+	iScaledBitmap = 0;
+	delete iScaledMask;
+	iScaledMask = 0;
+
+	iSourceBitmap = 0;
+	iSourceMask = 0;
+	iObserver = 0;
+    }
+
+
+void CVeiImageClipFrameOperation::StartOperationL(MVedVideoClipGeneratorFrameObserver* aObserver,
+												 TInt aIndex, TBool aEnhance, 
+												 CFbsBitmap* aSourceBitmap, CFbsBitmap* aDestBitmap, 
+												 CFbsBitmap* aSourceMask, TInt aPriority)
+	{
+	__ASSERT_ALWAYS(!IsActive(), TVedPanic::Panic(TVedPanic::EImageClipGeneratorFrameOperationAlreadyRunning));
+
+	iObserver = aObserver;
+	iSourceBitmap = aSourceBitmap;
+	iDestBitmap = aDestBitmap;
+	iSourceMask = aSourceMask;
+	iIndex = aIndex;
+	iEnhance = aEnhance;
+
+	SetPriority(aPriority);
+
+
+	TSize sourceRes = iSourceBitmap->SizeInPixels();
+	TSize destRes = iDestBitmap->SizeInPixels();
+	TSize movieRes = iGenerator.Movie()->Resolution();
+
+	TSize imageResInMovie(0,0);
+	if ((sourceRes.iWidth >= movieRes.iWidth) || (sourceRes.iHeight >= movieRes.iHeight)) 
+		{
+		// Downscaling
+		if ((sourceRes.iWidth * movieRes.iHeight) > 
+			(sourceRes.iHeight * movieRes.iWidth))
+			{
+			imageResInMovie.iWidth = movieRes.iWidth;
+			imageResInMovie.iHeight =
+				(movieRes.iWidth * sourceRes.iHeight) / sourceRes.iWidth;
+			}
+		else 
+			{
+			imageResInMovie.iHeight = movieRes.iHeight;
+			imageResInMovie.iWidth = 
+				(movieRes.iHeight * sourceRes.iWidth) / sourceRes.iHeight;
+			}
+		}
+	else
+		{
+		// Upscaling - limit to a factor of two
+		if ((sourceRes.iWidth * movieRes.iHeight) > 
+			(sourceRes.iHeight * movieRes.iWidth))
+			{
+			imageResInMovie.iWidth = Min(movieRes.iWidth, (sourceRes.iWidth * 2));
+			imageResInMovie.iHeight = (imageResInMovie.iWidth * sourceRes.iHeight) / sourceRes.iWidth;
+			}
+		else 
+			{
+			imageResInMovie.iHeight = Min((sourceRes.iHeight * 2), movieRes.iHeight);
+			imageResInMovie.iWidth = (imageResInMovie.iHeight * sourceRes.iWidth) / sourceRes.iHeight;
+			}
+		}
+
+	TSize movieResInDestBitmap(-1,-1);
+	if ((movieRes.iWidth * destRes.iHeight) > 
+		(movieRes.iHeight * destRes.iWidth))
+		{
+		movieResInDestBitmap.iWidth = destRes.iWidth;
+		movieResInDestBitmap.iHeight =
+			(movieResInDestBitmap.iWidth * movieRes.iHeight) / movieRes.iWidth;
+		}
+	else 
+		{
+		movieResInDestBitmap.iHeight = destRes.iHeight;
+		movieResInDestBitmap.iWidth = 
+			(movieResInDestBitmap.iHeight * movieRes.iWidth) / movieRes.iHeight;
+		}
+	
+
+	TSize targetRes(imageResInMovie);
+	targetRes.iWidth = imageResInMovie.iWidth * movieResInDestBitmap.iWidth / movieRes.iWidth;
+	targetRes.iHeight = imageResInMovie.iHeight * movieResInDestBitmap.iHeight / movieRes.iHeight;
+
+	TSize cachedRes(-1, -1);
+	if (iScaledBitmap) 
+		{
+		cachedRes = iScaledBitmap->SizeInPixels();
+		}
+
+	/* Check if we already have scaled this bitmap.*/
+	if ((cachedRes.iWidth == targetRes.iWidth) || 
+		(cachedRes.iHeight == targetRes.iHeight))
+		{
+		SetActive();
+		TRequestStatus* status = &iStatus;
+		User::RequestComplete(status, KErrNone);
+		return;
+		}
+	else if (iScaledBitmap) 
+		{
+		delete iScaledBitmap;
+		iScaledBitmap = 0;
+		delete iScaledMask;
+		iScaledMask = 0;
+		}
+
+	delete iScaler;
+	iScaler = NULL;
+	iScaler = CBitmapScaler::NewL();
+
+	iScaledBitmap = new (ELeave) CFbsBitmap;
+	User::LeaveIfError(iScaledBitmap->Create(targetRes, iDestBitmap->DisplayMode()));
+	iScaler->Scale(&iStatus, *iSourceBitmap, *iScaledBitmap, ETrue);
+	SetActive();
+	}
+
+
+
+void CVeiImageClipFrameOperation::RunL()
+	{
+	if (!iNoScaling && iSourceMask && !iScaledMask) 
+		{
+		/* Scale the mask. */
+		iScaledMask = new (ELeave) CFbsBitmap;
+		User::LeaveIfError(iScaledMask->Create(iScaledBitmap->SizeInPixels(), iSourceMask->DisplayMode()));
+		iScaler->Scale(&iStatus, *iSourceMask, *iScaledMask, ETrue);
+		SetActive();
+		return;
+		}
+
+	/* Select source. */
+	CFbsBitmap* bitmap = 0;
+	CFbsBitmap* mask = 0;
+
+	if (iScaledBitmap) 
+		{
+		bitmap = iScaledBitmap;
+		}
+	else
+		{
+		bitmap = iSourceBitmap;
+		}
+
+	if (iScaledMask) 
+		{
+		mask = iScaledMask;
+		}
+	else
+		{
+		mask = iSourceMask;
+		}
+
+
+	/* Initialize context. */
+	CFbsDevice* device = CFbsBitmapDevice::NewL(iDestBitmap);
+	CleanupStack::PushL(device);
+	CFbsBitGc* gc = NULL;
+	User::LeaveIfError(device->CreateContext(gc));
+
+	/* Calculate source point. */
+	TSize destRes = iDestBitmap->SizeInPixels();
+	TSize sourceRes = bitmap->SizeInPixels();	
+	TPoint sourcePoint((destRes.iWidth - sourceRes.iWidth) / 2,
+						(destRes.iHeight - sourceRes.iHeight) / 2);
+
+	/* Draw background (this is relevant for scaled images and transparency). */
+	gc->SetBrushColor(iGenerator.BackgroundColor());
+	gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
+	gc->DrawRect(TRect(TPoint(0, 0), destRes));
+
+	if (mask) 
+		{
+		TRect sourceRect(bitmap->SizeInPixels());
+		gc->BitBltMasked(sourcePoint, bitmap, sourceRect, mask, EFalse);
+		}
+	else
+		{
+		gc->BitBlt(sourcePoint, bitmap);
+		}
+
+	delete gc;
+	CleanupStack::PopAndDestroy(device);
+
+	/* This transfers the bitmap ownership to the observer. */
+	iObserver->NotifyVideoClipGeneratorFrameCompleted(iGenerator, KErrNone, iDestBitmap);
+
+	delete iScaler;
+	iScaler = 0;
+
+	iSourceBitmap = 0;
+	iSourceMask = 0;
+	iDestBitmap = 0;
+	iObserver = 0;
+	iIndex = -1;
+	iNoScaling = EFalse;
+	}
+
+TInt CVeiImageClipFrameOperation::RunError(TInt aError)
+	{
+	iObserver->NotifyVideoClipGeneratorFrameCompleted(iGenerator, aError, NULL);
+
+	if (iScaler) 
+		{
+		iScaler->Cancel();
+		}
+	
+	delete iScaler;
+	iScaler = 0;
+	delete iScaledBitmap;
+	iScaledBitmap = 0;
+	delete iScaledMask;
+	iScaledMask = 0;
+	delete iDestBitmap;
+	iDestBitmap = 0;
+	iSourceBitmap = 0;
+	iSourceMask = 0;
+	iObserver = 0;
+	iIndex = -1;
+
+	return KErrNone;
+	}
+
+
+void CVeiImageClipFrameOperation::DoCancel()
+	{
+	iObserver->NotifyVideoClipGeneratorFrameCompleted(iGenerator, KErrCancel, 0);
+
+	if (iScaler) 
+		{
+		iScaler->Cancel();
+		}
+	
+	delete iScaler;
+	iScaler = 0;
+	delete iScaledBitmap;
+	iScaledBitmap = 0;
+	delete iScaledMask;
+	iScaledMask = 0;
+
+	delete iDestBitmap;
+	iDestBitmap = 0;
+	iSourceBitmap = 0;
+	iSourceMask = 0;
+	iObserver = 0;
+	iIndex = -1;
+	}
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VeiImageConverter.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,261 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "VeiImageConverter.h"
+
+#include <fbs.h>
+#include <ImageConversion.h>
+#include <BitmapTransforms.h>
+#include "VideoEditorCommon.h" 
+#include "VideoEditorDebugUtils.h"
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CVeiImageConverter::CVeiImageConverter::NewL(
+//		MConverterController* aController ) 
+// ---------------------------------------------------------
+//
+EXPORT_C CVeiImageConverter* CVeiImageConverter::NewL( 
+	MConverterController* aController )
+	{
+	CVeiImageConverter* self = 
+		new(ELeave) CVeiImageConverter( aController );
+	CleanupStack::PushL( self );
+	
+	self->ConstructL();
+
+	CleanupStack::Pop( self );
+	return self; 
+	}
+// ---------------------------------------------------------
+// CVeiImageConverter::CVeiImageConverter(
+//		MConverterController* aController )
+// ---------------------------------------------------------
+//
+CVeiImageConverter::CVeiImageConverter( 
+	MConverterController* aController ) : 
+	CActive( EPriorityStandard ), iController( aController )
+	{
+	}
+
+// ---------------------------------------------------------
+// CVeiImageConverter::ConstructL()
+// EPOC two phased constructor
+// ---------------------------------------------------------
+//
+void CVeiImageConverter::ConstructL()
+	{
+	User::LeaveIfError( iFs.Connect() );
+	// create the destination bitmap
+	
+	iBitmapScaler = CBitmapScaler::NewL();
+	
+	CActiveScheduler::Add( this );
+	}
+
+// Destructor
+EXPORT_C CVeiImageConverter::~CVeiImageConverter()
+	{
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::~CVeiImageConverter(): in");
+	if ( IsActive() )
+		{
+		Cancel();	
+		}
+
+	delete iImageEncoder; 
+	delete iBitmapScaler;
+							// CImageDecoder must be deleted before the 
+	iFs.Close();			//   related RFs is closed, 
+	delete iBitmap;			//   otherwise a related thread might panic	
+
+	iController = NULL;
+
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::~CVeiImageConverter(): out");
+	}	
+
+
+
+// ---------------------------------------------------------
+// CVeiImageConverter::StartToEncodeL( 
+//		TFileName& aFileName, TUid aImageType, TUid aImageSubType )
+// ---------------------------------------------------------
+//
+EXPORT_C void CVeiImageConverter::StartToEncodeL( 
+	const TDesC& aFileName, const TUid& aImageType, const TUid& aImageSubType )
+	{
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::StartToEncodeL(): In");
+	if ( iImageEncoder )
+		{
+		delete iImageEncoder; 
+		iImageEncoder = NULL;
+		}
+	
+	// create the encoder
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::StartToEncodeL(): 2, own thread started");
+	iImageEncoder = CImageEncoder::FileNewL( iFs, aFileName, 
+		CImageEncoder::EOptionAlwaysThread, aImageType, aImageSubType );	
+
+	iState = EEncoding;
+	iImageEncoder->Convert( &iStatus, *iBitmap );
+	
+	SetActive();
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::StartToEncodeL(): Out");
+	}
+// ---------------------------------------------------------
+// CVeiImageConverter::DoCancel()
+// ---------------------------------------------------------
+//
+void CVeiImageConverter::DoCancel()
+	{
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::DoCancel(): in");
+	if ( iState == EEncoding && iImageEncoder )
+		{
+		iImageEncoder->Cancel();
+		}
+	else if ( iState == EScaling )
+		{
+		iBitmapScaler->Cancel();
+		}
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::DoCancel(): out");
+	}
+// ---------------------------------------------------------
+// CVeiImageConverter::RunL()
+// ---------------------------------------------------------
+//
+void CVeiImageConverter::RunL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::RunL: In");
+	switch( iState ) 
+		{
+		case EEncoding:
+			{
+			iState = EIdle;
+			iController->NotifyCompletion( iStatus.Int() );
+			break;
+			}
+		
+		default: // some error
+			{
+			LOG(KVideoEditorLogFile, "CVeiImageConverter::RunL: Scale completed");
+			iState = EIdle;
+			iController->NotifyCompletion( iStatus.Int() );
+			}
+		}
+	}
+
+// ---------------------------------------------------------
+// CVeiImageConverter::RunError(TInt aError)
+// ---------------------------------------------------------
+//
+TInt CVeiImageConverter::RunError(TInt aError)
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiImageConverter::RunError(): in, aError:%d", aError);
+	TInt err;
+	err = aError;
+	return err;
+	}
+
+// ---------------------------------------------------------
+// CVeiImageConverter::GetEncoderImageTypesL(
+//		RImageTypeDescriptionArray& aImageTypeArray )
+// ---------------------------------------------------------
+//
+EXPORT_C void CVeiImageConverter::GetEncoderImageTypesL( 
+	RImageTypeDescriptionArray& aImageTypeArray )
+	{
+	CImageEncoder::GetImageTypesL( aImageTypeArray );
+	}
+
+// ---------------------------------------------------------
+// CVeiImageConverter::SetBitmap()
+// ---------------------------------------------------------
+//
+EXPORT_C void CVeiImageConverter::SetBitmap( CFbsBitmap* aBitmap )
+	{
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::SetBitmap(): in");
+	if (iBitmap)
+		{
+		delete iBitmap;
+		iBitmap = NULL;
+		}
+	iBitmap = aBitmap;
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::SetBitmap(): out");
+	}
+
+// ---------------------------------------------------------
+// CVeiImageConverter::GetBitmap()
+// ---------------------------------------------------------
+//
+EXPORT_C CFbsBitmap* CVeiImageConverter::GetBitmap()
+	{
+	return iBitmap;
+	}
+
+// ---------------------------------------------------------
+// CVeiImageConverter::Scale()
+// ---------------------------------------------------------
+//
+EXPORT_C void CVeiImageConverter::ScaleL(CFbsBitmap* aSrcBitmap,CFbsBitmap* aDestBitmap, const TSize& aSize)
+	{
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::Scale: in");
+	if ( IsActive() )
+		{
+		Cancel();
+		}
+
+	if ( iBitmap )
+		{
+		delete iBitmap;
+		iBitmap = NULL;
+		}
+/* Create new bitmap where scaled bitmap is stored
+	When scaling is ready, NotifyCompletion() callback and
+	bitmap address can be asked with GetBitmap function */
+
+	iBitmap = aDestBitmap;
+	iBitmap = new (ELeave) CFbsBitmap;
+	iBitmap->Create( aSize, aSrcBitmap->DisplayMode() );
+
+	iState = EScaling;
+	iBitmapScaler->Scale( &iStatus, *aSrcBitmap, *iBitmap, EFalse );
+
+	SetActive();
+
+	LOG(KVideoEditorLogFile, "CVeiImageConverter::Scale: out");
+	}
+
+// ---------------------------------------------------------
+// CVeiImageConverter::CancelEncoding()
+// ---------------------------------------------------------
+//
+EXPORT_C void CVeiImageConverter::CancelEncoding()
+	{
+	if ( iImageEncoder )
+		{
+		delete iImageEncoder; 
+		iImageEncoder = NULL;
+		} 
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VeiMGFetchVerifier.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#include <coemain.h>
+#include <aknnotewrappers.h>
+#include <drmcommon.h>
+#include <stringloader.h>
+#include <data_caging_path_literals.hrh>
+
+#include <VideoEditorCommon.rsg>
+#include "VeiMGFetchVerifier.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorDebugUtils.h"
+
+// CONSTANTS
+_LIT(KResourceFile, "VideoEditorCommon.rsc");
+
+
+EXPORT_C CVeiMGFetchVerifier* CVeiMGFetchVerifier::NewLC()
+	{
+	CVeiMGFetchVerifier* self = new ( ELeave ) CVeiMGFetchVerifier;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+	}
+
+CVeiMGFetchVerifier::CVeiMGFetchVerifier() : iResLoader( *CCoeEnv::Static() )
+	{
+	}
+
+EXPORT_C CVeiMGFetchVerifier::~CVeiMGFetchVerifier()
+	{
+	iResLoader.Close();
+	}
+
+EXPORT_C TBool CVeiMGFetchVerifier::VerifySelectionL( const MDesCArray* aSelectedFiles )
+	{
+	LOG(KVideoEditorLogFile, "CVeiMGFetchVerifier::VerifySelectionL: in");
+        
+	TBool selectionAccepted( ETrue );
+
+	DRMCommon* drmCommon = DRMCommon::NewL();
+	CleanupStack::PushL (drmCommon);
+	
+	User::LeaveIfError( drmCommon->Connect() );
+	
+	TUint itemCount = aSelectedFiles->MdcaCount();
+	for (TUint i=0;i<itemCount;i++)
+		{
+		TInt fileProtectionStatus(0);
+		
+		TPtrC fileName = aSelectedFiles->MdcaPoint(i);
+		
+		drmCommon->IsProtectedFile( fileName, fileProtectionStatus );
+
+		if ( fileProtectionStatus != EFalse )
+			{
+			LOGFMT(KVideoEditorLogFile, "CVeiMGFetchVerifier::VerifySelectionL: File (%S) is protected. Show error note.", &fileName);
+			HBufC* stringholder;
+			CCoeEnv* coeEnv = CCoeEnv::Static();
+
+			stringholder = StringLoader::LoadLC( R_VEI_NOTE_DRM_NOT_ALLOWED, coeEnv );
+
+			CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
+			note->ExecuteLD( *stringholder );
+
+			CleanupStack::PopAndDestroy( stringholder );
+			selectionAccepted = EFalse;	
+			break;
+			}
+		LOGFMT(KVideoEditorLogFile, "CVeiMGFetchVerifier::VerifySelectionL: File (%S) is not protected.", &fileName);
+		}
+	drmCommon->Disconnect();
+	CleanupStack::PopAndDestroy (drmCommon);
+
+	LOGFMT(KVideoEditorLogFile, "CVeiMGFetchVerifier::VerifySelectionL: out: %d", selectionAccepted);
+	return selectionAccepted;
+	}
+
+	
+void CVeiMGFetchVerifier::ConstructL()
+	{
+	// Locate and open the resource file
+    TFileName fileName;
+    TParse p;    
+
+    Dll::FileName(fileName);
+    p.Set(KResourceFile, &KDC_RESOURCE_FILES_DIR, &fileName);
+    fileName = p.FullName();
+    
+    LOGFMT(KVideoEditorLogFile, "\tLoading resource file: %S", &fileName);
+	iResLoader.OpenL( fileName ); // RConeResourceLoader selects the correct language file
+
+	}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VeiRemConTarget.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// INCLUDE FILES
+#include <remconcoreapitarget.h>
+#include <remconinterfaceselector.h>
+#include <aknconsts.h>					
+
+#include "VeiRemConTarget.h"
+#include "VideoEditorDebugUtils.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CVeiRemConTarget::CVeiRemConTarget(MVeiMediakeyObserver& aObserver) : iObserver(aObserver)
+	{
+	}
+
+// Default constructor can leave.
+void CVeiRemConTarget::ConstructL()
+	{
+	// Create interface selector.
+	iInterfaceSelector = CRemConInterfaceSelector::NewL();
+	// Create a new CRemConCoreApiTarget, owned by the interface selector.
+	iCoreTarget = CRemConCoreApiTarget::NewL(*iInterfaceSelector, *this);
+	// Start being a target.
+	iInterfaceSelector->OpenTargetL();
+	}
+
+// Two-phased constructor.
+EXPORT_C CVeiRemConTarget* CVeiRemConTarget::NewL(MVeiMediakeyObserver& aObserver)
+	{
+	LOG(KVideoEditorLogFile, "CVeiRemConTarget::NewL");
+
+	CVeiRemConTarget* self = new (ELeave) CVeiRemConTarget(aObserver);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// Destructor
+CVeiRemConTarget::~CVeiRemConTarget()
+    {
+    delete iInterfaceSelector;
+    // iCoreTarget was owned by iInterfaceSelector.
+    iCoreTarget = NULL;
+    }
+
+// ---------------------------------------------------------
+// CVeiRemConTarget::MrccatoCommand
+// ---------------------------------------------------------
+//
+void CVeiRemConTarget::MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction DEBUGLOG_ARG(aButtonAct))
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiRemConTarget::MrccatoCommand: buttonact:%d >>", aButtonAct );
+	switch (aOperationId)
+		{
+		case ERemConCoreApiVolumeUp:
+			iObserver.HandleVolumeUpL();
+			break;
+		case ERemConCoreApiVolumeDown:
+			iObserver.HandleVolumeDownL();
+			break;
+
+		default:
+			break;
+		}
+	LOG(KVideoEditorLogFile, "CVeiRemConTarget::MrccatoCommand << " );
+	}
+
+// ---------------------------------------------------------
+// CDmhRemConTarget::MrccatoPlay
+// ---------------------------------------------------------
+//
+void CVeiRemConTarget::MrccatoPlay(TRemConCoreApiPlaybackSpeed /*aSpeed*/, TRemConCoreApiButtonAction /*aButtonAct*/)
+	{
+	LOG(KVideoEditorLogFile, "CVeiRemConTarget::MrccatoPlay <<");
+	}
+	
+// ---------------------------------------------------------
+// CDmhRemConTarget::MrccatoTuneFunction
+// ---------------------------------------------------------
+//
+void CVeiRemConTarget::MrccatoTuneFunction(TBool /*aTwoPart*/, TUint /*aMajorChannel*/, TUint /*aMinorChannel*/, TRemConCoreApiButtonAction /*aButtonAct*/)
+	{
+
+	}
+	
+// ---------------------------------------------------------
+// CDmhRemConTarget::MrccatoSelectDiskFunction
+// ---------------------------------------------------------
+//
+void CVeiRemConTarget::MrccatoSelectDiskFunction(TUint /*aDisk*/, TRemConCoreApiButtonAction /*aButtonAct*/)
+	{
+
+	}
+	
+// ---------------------------------------------------------
+// CVeiRemConTarget::MrccatoSelectAvInputFunction
+// ---------------------------------------------------------
+//
+void CVeiRemConTarget::MrccatoSelectAvInputFunction(TUint8 /*aAvInputSignalNumber*/, TRemConCoreApiButtonAction /*aButtonAct*/)
+	{
+
+	}
+	
+// ---------------------------------------------------------
+// CVeiRemConTarget::MrccatoSelectAudioInputFunction
+// ---------------------------------------------------------
+//
+void CVeiRemConTarget::MrccatoSelectAudioInputFunction(TUint8 /*aAudioInputSignalNumber*/, TRemConCoreApiButtonAction /*aButtonAct*/)
+	{
+
+	}
+	
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VeiSettings.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// INCLUDE FILES
+
+// User includes
+#include "VeiSettings.h"
+
+#ifdef SETTINGS_TO_CENREP
+#include <centralrepository.h>
+#include "VideoEditorInternalCRKeys.h"
+#endif
+
+EXPORT_C TDes& TVeiSettings::DefaultSnapshotName() 
+	{
+	return iDefaultSnapshotName;
+	}
+
+EXPORT_C TPtrC TVeiSettings::DefaultSnapshotName() const
+	{
+	return iDefaultSnapshotName;
+	}
+
+EXPORT_C TDes& TVeiSettings::DefaultVideoName()
+	{
+	return iDefaultVideoName;
+	}
+
+EXPORT_C TPtrC TVeiSettings::DefaultVideoName() const
+	{
+	return iDefaultVideoName;
+	}
+
+EXPORT_C CAknMemorySelectionDialog::TMemory& TVeiSettings::MemoryInUse()
+	{
+	return iMemoryInUse;
+	}
+
+EXPORT_C const CAknMemorySelectionDialog::TMemory& TVeiSettings::MemoryInUse() const
+	{
+	return iMemoryInUse;
+	}
+
+EXPORT_C TInt& TVeiSettings::SaveQuality()
+    {
+    return (TInt&)iSaveQuality;
+    }
+
+EXPORT_C TInt TVeiSettings::SaveQuality() const
+    {
+    return (TInt)iSaveQuality;
+    }
+
+EXPORT_C void TVeiSettings::ExternalizeL(RWriteStream& aStream) const 
+	{
+    aStream << iDefaultVideoName;
+
+    aStream.WriteUint8L( static_cast<TUint8>(iSaveQuality) );
+
+    aStream << iDefaultSnapshotName;
+
+    aStream.WriteUint8L( static_cast<TUint8>(iMemoryInUse) );
+	}
+
+EXPORT_C void TVeiSettings::InternalizeL(RReadStream& aStream) 
+	{
+    aStream >> iDefaultVideoName;
+
+    iSaveQuality = static_cast<TSaveQuality>(aStream.ReadUint8L());
+
+    aStream >> iDefaultSnapshotName;
+
+    iMemoryInUse = static_cast<CAknMemorySelectionDialog ::TMemory> (aStream.ReadUint8L());
+	}
+
+#ifdef SETTINGS_TO_CENREP
+
+void TVeiSettings::LoadL()
+	{
+	CRepository* repository = NULL;
+	User::LeaveIfError( repository = CRepository::NewLC(KCRUidVideoEditor) );
+	
+	TInt saveQuality = 0;
+	repository->Get(KVedSaveQuality, saveQuality);
+	SetSaveQuality( (TSaveQuality)saveQuality );
+
+	TInt memoryInUse = 0;
+	repository->Get(KVedMemoryInUse, memoryInUse);
+	SetMemoryInUse( (CAknMemorySelectionDialog::TMemory)memoryInUse );
+
+	repository->Get(KVedDefaultVideoName, iDefaultVideoName);
+
+	repository->Get(KVedDefaultSnapshotName, iDefaultSnapshotName);
+
+	CleanupStack::PopAndDestroy(repository);	
+	}
+
+void TVeiSettings::SaveL() const
+	{
+	CRepository* repository = CRepository::NewLC(KCRUidVideoEditor);
+	
+	repository->Set(KVedSaveQuality, (TInt)iSaveQuality);
+
+	repository->Set(KVedMemoryInUse, (TInt)iMemoryInUse);
+
+	repository->Set(KVedDefaultVideoName, iDefaultVideoName);
+
+	repository->Set(KVedDefaultSnapshotName, iDefaultSnapshotName);
+
+	CleanupStack::PopAndDestroy(repository);
+	}
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VeiTempMaker.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// INCLUDE FILES
+
+// System includes
+#include <eikenv.h>
+#include <pathinfo.h>
+#include <eikappui.h>
+#include <bautils.h>
+#include <e32math.h>
+#include <vedcommon.h>
+
+// User includes
+#include "VeiTempMaker.h"
+#include "VideoEditorCommon.h"
+#include "VeiSettings.h"
+#include "VideoEditorDebugUtils.h"
+
+
+EXPORT_C CVeiTempMaker* CVeiTempMaker::NewL()
+    {
+    CVeiTempMaker* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+    
+EXPORT_C CVeiTempMaker* CVeiTempMaker::NewLC()
+    {
+    CVeiTempMaker* self = new (ELeave) CVeiTempMaker();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+void CVeiTempMaker::ConstructL()
+	{
+	}
+
+CVeiTempMaker::CVeiTempMaker()
+    {
+    }
+
+
+EXPORT_C CVeiTempMaker::~CVeiTempMaker()
+    {
+    }
+
+EXPORT_C void CVeiTempMaker::EmptyTempFolder() const
+	{
+	LOG(KVideoEditorLogFile, "CVeiTempMaker::EmptyTempFolder(): In");
+
+	TRAP_IGNORE( DoEmptyTempFolderL() );
+
+	LOG(KVideoEditorLogFile, "CVeiTempMaker::EmptyTempFolder(): Out");
+	}
+
+void CVeiTempMaker::DoEmptyTempFolderL() const
+	{
+	LOG(KVideoEditorLogFile, "CVeiTempMaker::DoEmptyTempFolderL(): In");
+
+	RFs&	fs = CCoeEnv::Static()->FsSession();
+
+	CFileMan* fileManager = CFileMan::NewL( fs );
+	CleanupStack::PushL( fileManager );
+		
+	TFileName tempDir;
+	// First try to delete from Phone Memory
+	TBool dirExists = GetTempPath( CAknMemorySelectionDialog::EPhoneMemory, tempDir );
+	if ( dirExists )
+		{
+		LOGFMT(KVideoEditorLogFile, "\tFolder \"%S\" exists...Deleting...", &tempDir);
+		fileManager->RmDir( tempDir );
+		}
+	// ..then from MMC
+	dirExists = GetTempPath( CAknMemorySelectionDialog::EMemoryCard, tempDir );
+	if ( dirExists )
+		{
+		LOGFMT(KVideoEditorLogFile, "\tFolder \"%S\" exists...Deleting...", &tempDir);
+		fileManager->RmDir( tempDir );
+		}
+
+	CleanupStack::PopAndDestroy( fileManager );
+
+	LOG(KVideoEditorLogFile, "CVeiTempMaker::DoEmptyTempFolderL(): Out");
+	}
+
+EXPORT_C void CVeiTempMaker::GenerateTempFileName( 
+	HBufC& aTempPathAndName, 
+	CAknMemorySelectionDialog::TMemory aMemory,
+	TVedVideoFormat aVideoFormat,
+	TBool aExtAMR ) const
+	{
+	LOG(KVideoEditorLogFile, "CVeiTempMaker::GenerateTempFileName(): In");
+
+	RFs&	fs = CCoeEnv::Static()->FsSession();
+	
+
+// Parse tempPath. MMC or memoryroot
+	TFileName tempPath;
+	RFile temp;
+// Temp files are processed to \\data\\videos\\[application uid]\\[random name]
+	TBool tempFolderExists = GetTempPath( aMemory, tempPath );
+	if ( !tempFolderExists )
+		{
+		fs.MkDirAll( tempPath );
+		fs.SetAtt( tempPath, KEntryAttHidden, KEntryAttDir );
+		}
+	
+	TUint32 randomName;
+
+	randomName = Math::Random();
+	tempPath.AppendNum( randomName, EHex );
+	
+	if ( aExtAMR )
+		{
+		tempPath.Append( KExtAmr );
+		}	
+	else if ( aVideoFormat == EVedVideoFormatMP4 )
+		{
+		tempPath.Append( KExtMp4 );
+		}
+	else
+		{
+		tempPath.Append( KExt3gp );
+		}
+
+	temp.Create( fs, tempPath, EFileWrite );
+	temp.Close();
+
+	aTempPathAndName = tempPath;
+
+	LOGFMT(KVideoEditorLogFile, "CVeiTempMaker::GenerateTempFileName(): Out: %S", &tempPath);
+	}
+	
+TBool CVeiTempMaker::GetTempPath( const CAknMemorySelectionDialog::TMemory& aMemory, TDes& aTempPath ) const
+	{
+	LOG(KVideoEditorLogFile, "CVeiTempMaker::GetTempPath: In");
+
+	if ( aMemory == CAknMemorySelectionDialog::EPhoneMemory )
+		{
+		aTempPath = PathInfo::PhoneMemoryRootPath();
+		}
+	else
+		{
+		aTempPath = PathInfo::MemoryCardRootPath();
+		}
+		
+	aTempPath.Append( PathInfo::VideosPath() ); 	
+	aTempPath.AppendNum( KUidVideoEditor.iUid, EHex );
+	aTempPath.Append(_L("\\"));	
+
+	LOGFMT(KVideoEditorLogFile, "CVeiTempMaker::GetTempPath: Out: %S", &aTempPath);
+
+	return BaflUtils::FolderExists( CCoeEnv::Static()->FsSession(), aTempPath );
+	}
+
+/*void CVeiTempMaker::ListFilesL(const TDesC& aFindFromDir, const TDesC& aWriteResultTo) const
+{	
+	LOGFMT(KVideoEditorLogFile, "CVeiTempMaker::ListFiles(): In, aFindFromDir:%S", &aFindFromDir);
+	CDir* dir = NULL;
+	//RFile file;
+	RFs fileSession;
+	
+	TInt err = fileSession.Connect();	
+
+//	err = file.Replace(fileSession, aWriteResultTo, EFileWrite);
+
+	
+	CleanupClosePushL(fileSession);
+	//CleanupClosePushL(file);
+
+	//_LIT8(KNewLine, "\r\n");
+	//TBuf8<255> buf8;
+	TBuf<KMaxFileName> buf;
+	TFileName fileName;
+	fileName.Append(aFindFromDir); 
+	
+	fileSession.GetDir(fileName, KEntryAttNormal, ESortNone, dir);
+	LOG(KVideoEditorLogFile, "CVeiTempMaker::ListFiles(): 2");
+	if (dir)
+	{
+		CleanupStack::PushL(dir);
+		
+
+		for(TInt index=0; index < dir->Count(); index++)
+		{
+			LOG(KVideoEditorLogFile, "CVeiTempMaker::ListFiles(): 3 in loop");
+
+			//buf8.Copy((*dir)[index].iName);		
+			//buf.Copy((*dir)[index].iName);		
+			
+			LOG(KVideoEditorLogFile, "CVeiTempMaker::ListFiles(): 4 in loop");
+
+			LOGFMT(KVideoEditorLogFile, "%S", &((*dir)[index].iName));			
+			//file.Write(buf8);
+
+			//file.Write(KNewLine);		
+
+		}
+		CleanupStack::PopAndDestroy( dir );	
+	}	
+	LOG(KVideoEditorLogFile, "CVeiTempMaker::ListFiles(): 5");
+	//CleanupStack::PopAndDestroy( file );	
+	CleanupStack::PopAndDestroy( fileSession );	
+	LOG(KVideoEditorLogFile, "CVeiTempMaker::ListFiles(): Out");
+}*/
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VeiTitleClipGenerator.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1515 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "VeiTitleClipGenerator.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorDebugUtils.h"
+
+#include <VedMovie.h>
+#include <fbs.h>
+#include <bitdev.h>
+#include <gdi.h>
+#include <aknutils.h>
+#include <ImageConversion.h>
+#include <BitmapTransforms.h>
+#include <aknbiditextutils.h>
+
+#include <AknFontAccess.h>
+#include <AknFontSpecification.h>
+#include <AknLayoutFont.h>
+
+#include "VideoEditorDebugUtils.h"
+
+const TInt KDefaultNumberOfLines = 15;
+const TInt KLineSpacing = 4;
+const TInt KMargin = 10;
+const TInt KVeiTitleClipDefaultDuration = 5000000;
+const TInt KVeiTitleClipFadeLimit = 2000000;
+// Restrict the maximum frame rate to 15fps regardless of the movie properties
+const TInt KMaxFrameRate = 15;
+
+
+EXPORT_C CVeiTitleClipGenerator* CVeiTitleClipGenerator::NewL(const TSize& aMaxResolution,
+	TVeiTitleClipTransition aTransition, TVeiTitleClipHorizontalAlignment aHorizontalAlignment,
+		TVeiTitleClipVerticalAlignment aVerticalAlignment)
+	{
+	LOGFMT2(KVideoEditorLogFile, "CVeiTitleClipGenerator::NewL: aMaxResolution: (%d,%d)", aMaxResolution.iWidth,aMaxResolution.iHeight);
+
+	__ASSERT_ALWAYS(aMaxResolution.iHeight >= 0, TVedPanic::Panic(TVedPanic::ETitleClipGeneratorIllegalMaxResolution));
+	__ASSERT_ALWAYS(aMaxResolution.iWidth >= 0, TVedPanic::Panic(TVedPanic::ETitleClipGeneratorIllegalMaxResolution));
+
+	CVeiTitleClipGenerator* self = CVeiTitleClipGenerator::NewLC(aMaxResolution, aTransition, aHorizontalAlignment, aVerticalAlignment);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+EXPORT_C CVeiTitleClipGenerator* CVeiTitleClipGenerator::NewLC(const TSize& aMaxResolution, 
+	TVeiTitleClipTransition aTransition, TVeiTitleClipHorizontalAlignment aHorizontalAlignment,
+		TVeiTitleClipVerticalAlignment aVerticalAlignment)
+	{
+	LOGFMT2(KVideoEditorLogFile, "CVeiTitleClipGenerator::NewLC: In: aMaxResolution: (%d,%d)", aMaxResolution.iWidth,aMaxResolution.iHeight);
+
+	__ASSERT_ALWAYS(aMaxResolution.iHeight >= 0, TVedPanic::Panic(TVedPanic::ETitleClipGeneratorIllegalMaxResolution));
+	__ASSERT_ALWAYS(aMaxResolution.iWidth >= 0, TVedPanic::Panic(TVedPanic::ETitleClipGeneratorIllegalMaxResolution));
+
+	CVeiTitleClipGenerator* self = new (ELeave) CVeiTitleClipGenerator(aMaxResolution, aTransition, aHorizontalAlignment, aVerticalAlignment);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+void CVeiTitleClipGenerator::ConstructL()
+	{
+	iDescriptiveName = HBufC::NewL(0);
+	iWrappedArray = new (ELeave) CArrayFixFlat<TPtrC>(KDefaultNumberOfLines);
+	iText = HBufC::NewL(0);
+	GetTextFont();
+	}
+
+EXPORT_C CVeiTitleClipGenerator::~CVeiTitleClipGenerator()
+	{
+	LOG(KVideoEditorLogFile, "CVeiTitleClipGenerator::~CVeiTitleClipGenerator(): In");
+	delete iDecodeOperation;
+	delete iText;
+	if (iWrappedArray) 
+		{ 
+		iWrappedArray->Reset();
+		}
+	delete iWrappedArray;
+	delete iBackgroundImage;
+	delete iScaledBackgroundImage;
+	delete iDescriptiveName;
+
+	LOG(KVideoEditorLogFile, "CVeiTitleClipGenerator::~CVeiTitleClipGenerator(): Out");
+	}
+
+CVeiTitleClipGenerator::CVeiTitleClipGenerator(const TSize& aMaxResolution, 
+											   TVeiTitleClipTransition aTransition, 
+											   TVeiTitleClipHorizontalAlignment aHorizontalAlignment,
+											   TVeiTitleClipVerticalAlignment aVerticalAlignment)
+   : iFirstFrameComplexityFactor(0),
+     iGetFontResolution(aMaxResolution),
+     iMaxResolution(aMaxResolution),
+     iTransition(aTransition),
+     iHorizontalAlignment(aHorizontalAlignment),
+	 iVerticalAlignment(aVerticalAlignment)
+	{
+	// Set some default values
+	iDuration = TTimeIntervalMicroSeconds(KVeiTitleClipDefaultDuration);
+	iBackgroundColor = KRgbBlack;
+	iTextColor = KRgbWhite;
+	}
+
+EXPORT_C TPtrC CVeiTitleClipGenerator::DescriptiveName() const
+	{
+	return *iDescriptiveName;
+	}
+
+EXPORT_C TUid CVeiTitleClipGenerator::Uid() const
+	{
+	return KUidTitleClipGenerator;
+	}
+
+EXPORT_C TTimeIntervalMicroSeconds CVeiTitleClipGenerator::Duration() const
+	{
+	return iDuration;
+	}
+
+EXPORT_C TInt CVeiTitleClipGenerator::VideoFrameCount() const
+	{
+	TReal countReal((TReal)( (static_cast<TInt32>(iDuration.Int64())) / 1000000.0 ) * (TReal)(MaximumFramerate()) + 0.5);
+	return (TInt) countReal;
+	}
+
+EXPORT_C TTimeIntervalMicroSeconds CVeiTitleClipGenerator::VideoFrameStartTime(TInt aIndex) const
+	{
+	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < VideoFrameCount(), 
+		TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalVideoFrameIndex));
+
+	TTimeIntervalMicroSeconds frameTime(1000000 / MaximumFramerate());
+	return TTimeIntervalMicroSeconds(TInt64(aIndex) * frameTime.Int64());
+	}
+
+EXPORT_C TTimeIntervalMicroSeconds CVeiTitleClipGenerator::VideoFrameEndTime(TInt aIndex) const
+	{
+	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < VideoFrameCount(), 
+		TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalVideoFrameIndex));
+
+	TTimeIntervalMicroSeconds frameTime(1000000 / MaximumFramerate());
+	return TTimeIntervalMicroSeconds( (static_cast<TInt64>(aIndex) + 1) * frameTime.Int64() ); 
+	}
+
+EXPORT_C TTimeIntervalMicroSeconds CVeiTitleClipGenerator::VideoFrameDuration(TInt aIndex) const
+	{
+	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < VideoFrameCount(), 
+		TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalVideoFrameIndex));
+
+	return TTimeIntervalMicroSeconds(VideoFrameEndTime(aIndex).Int64() - VideoFrameStartTime(aIndex).Int64());
+	}
+
+EXPORT_C TInt CVeiTitleClipGenerator::VideoFirstFrameComplexityFactor() const
+	{
+	return iFirstFrameComplexityFactor;
+	}
+
+EXPORT_C TInt CVeiTitleClipGenerator::VideoFrameDifferenceFactor(TInt aIndex) const
+	{
+	__ASSERT_ALWAYS(aIndex > 0 && aIndex < VideoFrameCount(), 
+		TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalVideoFrameIndex));
+
+	TInt differenceFactor = 0;
+	TInt pixels = iMaxResolution.iHeight * iMaxResolution.iWidth;
+	TInt scale = 1000;
+	TInt fontHeight = iTextFont->HeightInPixels();
+	
+	switch(iTransition) 
+		{
+	case EVeiTitleClipTransitionNone:
+		{
+		differenceFactor = 0; // if there is no transition, it's just a static text
+		}
+		break;
+	case EVeiTitleClipTransitionFade:
+		{
+		TInt inEndFrame;
+		TInt outStartFrame;
+		CalculateTransitionFrameIndices(inEndFrame, outStartFrame);
+		if ((aIndex < inEndFrame) || (aIndex > outStartFrame)) 
+			{
+			for (TInt i = 0; i < iWrappedArray->Count(); i++)
+				{
+				TInt lineWidth = iTextFont->TextWidthInPixels(iWrappedArray->At(i));
+				differenceFactor += fontHeight * lineWidth;
+				}
+			differenceFactor *= scale;
+			differenceFactor /= pixels;
+			}
+		else
+			{
+			differenceFactor = 0;
+			}
+		}
+		break;
+	case EVeiTitleClipTransitionScrollBottomToTop:
+	case EVeiTitleClipTransitionScrollTopToBottom:
+		{
+		TInt yTravelPerFrame = (iMaxResolution.iHeight + iWrappedTextBoxHeight) / VideoFrameCount() + 1;
+
+		TInt maxLineWidth = 0;
+		for (TInt i = 0; i < iWrappedArray->Count(); i++)
+			{
+			TInt lineWidth = iTextFont->TextWidthInPixels(iWrappedArray->At(i));
+			if (lineWidth > maxLineWidth) 
+				{
+				maxLineWidth = lineWidth;
+				}
+			}
+		differenceFactor = scale * maxLineWidth * yTravelPerFrame / pixels;
+		break;
+		}
+	case EVeiTitleClipTransitionScrollLeftToRight:
+	case EVeiTitleClipTransitionScrollRightToLeft:
+		{
+		TInt xTravelPerFrame = (iMaxResolution.iWidth + iTextFont->TextWidthInPixels(*iText)) / VideoFrameCount() + 1;
+		differenceFactor = scale * xTravelPerFrame * fontHeight / pixels;
+		break;
+		}
+	default:
+		TVedPanic::Panic(TVedPanic::EInternal);
+		}
+
+	return differenceFactor;
+	}
+
+EXPORT_C TInt CVeiTitleClipGenerator::GetVideoFrameIndex(TTimeIntervalMicroSeconds aTime) const
+	{
+	__ASSERT_ALWAYS(aTime.Int64() >= 0 && aTime.Int64() <= iDuration.Int64(),
+		TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalVideoFrameIndex));
+
+	TTimeIntervalMicroSeconds frameTime(1000000 / MaximumFramerate());
+	return (static_cast<TInt32>(aTime.Int64() / frameTime.Int64()));
+	}
+
+EXPORT_C void CVeiTitleClipGenerator::GetFrameL(MVedVideoClipGeneratorFrameObserver& aObserver,
+								  TInt aIndex, TSize* const aResolution,
+								  TDisplayMode aDisplayMode, TBool aEnhance,
+								  TInt aPriority)
+	{
+#ifdef VERBOSE
+	LOGFMT3(KVideoEditorLogFile, "CVeiTitleClipGenerator::GetFrameL(): In: aIndex:%d, aResolution:(%d,%d)",\
+		aIndex, aResolution->iWidth, aResolution->iHeight);
+#endif
+
+	__ASSERT_ALWAYS(aIndex == KFrameIndexBestThumb || aIndex >= 0 
+		&& aIndex < VideoFrameCount(), 
+		TVedPanic::Panic(TVedPanic::EVideoClipGeneratorIllegalVideoFrameIndex));
+
+    TDisplayMode displayMode = aDisplayMode;
+
+    // check validity of thumbnail and associated operation
+    if(aEnhance)	// for saving to file
+        {
+        if(displayMode == ENone)					// if no preference
+			{
+            displayMode = EColor16M;				// 24-bit color image for enhancement
+			}
+        else if(displayMode != EColor16M)	// invalid combination
+			{
+            User::Leave(KErrNotSupported);
+			}
+        }
+    else								// for screen display
+        {
+        if(displayMode == ENone)					// if no preference
+			{
+            displayMode = EColor64K;				// 16-bit image
+			}
+        }
+
+
+	iUseScaledImage = EFalse;
+	iGetFrameObserver = &aObserver;
+    iGetFrameIndex = aIndex;
+	iGetFrameResolution = TSize(aResolution->iWidth, aResolution->iHeight);
+	iGetFrameDisplayMode = displayMode;
+	iGetFrameEnhance = aEnhance;
+	iGetFramePriority = aPriority;	
+
+	if (!iBackgroundImage)
+		{
+		// No background image, just finish.
+		FinishGetFrameL();
+		}
+	else if	((aResolution->iHeight == iBackgroundImage->SizeInPixels().iHeight) || 
+			 (aResolution->iWidth == iBackgroundImage->SizeInPixels().iWidth)) 
+		{
+		// The background image does not need scaling - deleting scaled image
+		// causes FinishGetFrameL() to use the original.
+		iUseScaledImage = EFalse;
+		FinishGetFrameL();
+		}
+	else if (iScaledBackgroundImage &&
+			 ((aResolution->iHeight == iScaledBackgroundImage->SizeInPixels().iHeight) || 
+			 (aResolution->iWidth == iScaledBackgroundImage->SizeInPixels().iWidth)))
+		{
+		// Scaled image is in correct resolution
+		iUseScaledImage = ETrue;
+		FinishGetFrameL();
+		}
+	else
+		{
+		// We need to scale the image.
+		iUseScaledImage = ETrue;
+		if (iScaledBackgroundImage) 
+			{
+			delete iScaledBackgroundImage;
+			iScaledBackgroundImage = 0;
+			}
+
+		if (iDecodeOperation) 
+			{
+			delete iDecodeOperation;
+			iDecodeOperation = 0;
+			}
+
+		CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
+		CleanupStack::PushL(bitmap);
+		User::LeaveIfError(bitmap->Create(iBackgroundImage->SizeInPixels(), iBackgroundImage->DisplayMode()));
+		CFbsDevice* device = CFbsBitmapDevice::NewL(bitmap);
+		CFbsBitGc* gc = NULL;
+		device->CreateContext(gc);
+		gc->BitBlt(TPoint(0,0), iBackgroundImage);
+		delete gc;
+		delete device;		
+		iDecodeOperation = CVeiTitleClipImageDecodeOperation::NewL(*this, bitmap);
+		CleanupStack::Pop(bitmap);
+		iDecodeOperation->StartScalingOperationL(iGetFrameResolution);
+		}
+
+#ifdef VERBOSE
+	LOG(KVideoEditorLogFile, "CVeiTitleClipGenerator::GetFrameL(): Out");
+#endif
+	}
+
+
+EXPORT_C CFbsBitmap* CVeiTitleClipGenerator::FinishGetFrameL(TInt aError)
+	{
+#ifdef VERBOSE
+	LOGFMT(KVideoEditorLogFile, "CVeiTitleClipGenerator::FinishGetFrameL(): In: aError:%d", aError);
+#endif
+
+	ASSERT(iGetFrameResolution.iWidth > 0 && iGetFrameResolution.iHeight > 0);
+
+	if (aError != KErrNone) 
+		{
+		iGetFrameObserver->NotifyVideoClipGeneratorFrameCompleted(*this, aError, NULL);
+		return NULL;
+		}
+
+	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
+	CleanupStack::PushL(bitmap);
+	TInt err = bitmap->Create(iGetFrameResolution, iGetFrameDisplayMode);
+	if (err != KErrNone) 
+		{
+		delete bitmap;
+		bitmap = NULL;
+		iGetFrameObserver->NotifyVideoClipGeneratorFrameCompleted(*this, err, NULL);
+		}
+	else
+		{
+		CFbsDevice* device = CFbsBitmapDevice::NewL(bitmap);
+		CFbsBitGc* gc = NULL;
+		device->CreateContext(gc);
+
+		/* Draw the background. */
+		if (iUseScaledImage) 
+			{
+			TSize bgImageSize(iScaledBackgroundImage->SizeInPixels());
+			TPoint bgPoint((iGetFrameResolution.iWidth - bgImageSize.iWidth) / 2,
+						   (iGetFrameResolution.iHeight - bgImageSize.iHeight) / 2);
+			gc->BitBlt(bgPoint, iScaledBackgroundImage);
+			}
+		else if (iBackgroundImage) 
+			{
+			TSize bgImageSize(iBackgroundImage->SizeInPixels());
+			TPoint bgPoint((iGetFrameResolution.iWidth - bgImageSize.iWidth) / 2,
+						   (iGetFrameResolution.iHeight - bgImageSize.iHeight) / 2);
+			gc->BitBlt(bgPoint, iBackgroundImage);
+			}
+		else
+			{
+			gc->SetBrushColor(iBackgroundColor);
+			gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
+			gc->DrawRect(bitmap->SizeInPixels());
+			}
+
+		delete gc;
+		delete device;
+
+		switch(iTransition) 
+			{
+		case EVeiTitleClipTransitionNone:
+		case EVeiTitleClipTransitionFade:
+			{
+			DrawMainTitleFrameL(*bitmap, iGetFrameIndex);
+			break;
+			}
+		case EVeiTitleClipTransitionScrollBottomToTop:
+		case EVeiTitleClipTransitionScrollTopToBottom:
+		case EVeiTitleClipTransitionScrollLeftToRight:
+		case EVeiTitleClipTransitionScrollRightToLeft:
+			{
+			DrawScrollTitleFrameL(*bitmap, iGetFrameIndex);
+			break;
+			}
+		default:
+			TVedPanic::Panic(TVedPanic::EInternal);
+			}
+
+		/* Notify the observer. */
+		if (iGetFrameObserver) 
+			{
+			iGetFrameObserver->NotifyVideoClipGeneratorFrameCompleted(*this, KErrNone, bitmap);
+			}
+
+		iGetFrameObserver = 0;
+	    iGetFrameIndex = -5;
+
+		CleanupStack::Pop(bitmap);
+		}
+
+#ifdef VERBOSE
+	LOG(KVideoEditorLogFile, "CVeiTitleClipGenerator::FinishGetFrameL(): Out");
+#endif
+
+	return bitmap;
+	}
+
+EXPORT_C void CVeiTitleClipGenerator::CancelFrame()
+	{
+	if (iDecodeOperation) 
+		{
+		iDecodeOperation->Cancel();
+		}
+	}
+
+EXPORT_C TVeiTitleClipTransition CVeiTitleClipGenerator::Transition() const
+	{
+	return iTransition;
+	}
+
+EXPORT_C TVeiTitleClipHorizontalAlignment CVeiTitleClipGenerator::HorizontalAlignment() const
+	{
+	return iHorizontalAlignment;
+	}
+
+EXPORT_C TVeiTitleClipVerticalAlignment CVeiTitleClipGenerator::VerticalAlignment() const
+	{
+	return iVerticalAlignment;
+	}
+
+EXPORT_C void CVeiTitleClipGenerator::SetTransitionAndAlignmentsL(												
+		TVeiTitleClipTransition aTransition,
+		TVeiTitleClipHorizontalAlignment aHorizontalAlignment,
+		TVeiTitleClipVerticalAlignment aVerticalAlignment)
+	{
+	TBool updateNeeded = EFalse;
+	if (iTransition != aTransition) 
+		{
+		iTransition = aTransition;
+		updateNeeded = ETrue;
+		}
+
+	if (iHorizontalAlignment != aHorizontalAlignment) 
+		{
+		iHorizontalAlignment = aHorizontalAlignment;
+		updateNeeded = ETrue;
+		}
+
+	if (iVerticalAlignment != aVerticalAlignment) 
+		{
+		iVerticalAlignment = aVerticalAlignment;
+		updateNeeded = ETrue;
+		}
+
+	if (updateNeeded) 
+		{
+		UpdateFirstFrameComplexityFactorL();
+		ReportSettingsChanged();
+		}
+	}
+
+EXPORT_C void CVeiTitleClipGenerator::SetTextL(const TDesC& aText)
+	{
+	LOG(KVideoEditorLogFile, "CVeiTitleClipGenerator::SetTextL(): In");
+
+	/* Don't do anything if the texts are equal. */
+	if (iText && !iText->Compare(aText)) 
+		{
+		return;
+		}
+
+	/* Delete old text. */
+	if (iText) 
+		{
+		delete iText;
+		iText = 0;
+		}
+
+	/* Wrap the string to lines. */
+	WrapTextToArrayL(aText);
+	ReportSettingsChanged();
+
+	LOG(KVideoEditorLogFile, "CVeiTitleClipGenerator::SetTextL(): Out");
+	}
+
+EXPORT_C void CVeiTitleClipGenerator::SetDescriptiveNameL(const TDesC& aDescriptiveName)
+	{
+	if (iDescriptiveName && !iDescriptiveName->Compare(aDescriptiveName)) 
+		{
+		return;
+		}
+
+	if (iDescriptiveName) 
+		{
+		delete iDescriptiveName;
+		iDescriptiveName = 0;
+		}
+	iDescriptiveName = HBufC::NewL(aDescriptiveName.Length());
+	*iDescriptiveName = aDescriptiveName;
+	ReportDescriptiveNameChanged();
+	}
+
+EXPORT_C TPtrC CVeiTitleClipGenerator::Text() const
+	{
+	return *iText;
+	}
+
+
+EXPORT_C void CVeiTitleClipGenerator::SetBackgroundColorL(const TRgb& aBackgroundColor)
+	{
+	if (iBackgroundImage) 
+		{
+		delete iBackgroundImage;
+		iBackgroundImage = 0;
+		delete iScaledBackgroundImage;
+		iScaledBackgroundImage = 0;
+		}
+	else if (aBackgroundColor == iBackgroundColor) 
+		{
+		return;
+		}
+
+	iBackgroundColor = aBackgroundColor;
+	UpdateFirstFrameComplexityFactorL();
+	ReportSettingsChanged();
+	}
+
+EXPORT_C TRgb CVeiTitleClipGenerator::BackgroundColor() const
+	{
+	return iBackgroundColor;
+	}
+
+EXPORT_C void CVeiTitleClipGenerator::SetTextColorL(const TRgb& aTextColor)
+	{
+	if (iTextColor != aTextColor) 
+		{
+		iTextColor = aTextColor;
+		ReportSettingsChanged();
+		UpdateFirstFrameComplexityFactorL();
+		}
+	}
+
+EXPORT_C TRgb CVeiTitleClipGenerator::TextColor() const
+	{
+	return iTextColor;
+	}
+
+EXPORT_C void CVeiTitleClipGenerator::SetBackgroundImageL(const CFbsBitmap* aBackgroundImage)
+	{
+	if (iBackgroundImage) 
+		{
+		delete iBackgroundImage;
+		iBackgroundImage = 0;
+		delete iScaledBackgroundImage;
+		iScaledBackgroundImage = 0;
+		}
+
+	iBackgroundImage = new (ELeave) CFbsBitmap;
+	iBackgroundImage->Duplicate(aBackgroundImage->Handle());
+	UpdateFirstFrameComplexityFactorL();
+	ReportSettingsChanged();
+	}
+
+EXPORT_C void CVeiTitleClipGenerator::SetBackgroundImageL(const TDesC& aFilename, MVeiTitleClipGeneratorObserver& aObserver)
+	{
+	delete iDecodeOperation;
+	iDecodeOperation = 0;
+	delete iBackgroundImage;
+	iBackgroundImage = 0;
+	delete iScaledBackgroundImage;
+	iScaledBackgroundImage = 0;
+
+	iDecodeOperation = CVeiTitleClipImageDecodeOperation::NewL(*this, aObserver, aFilename);
+	iDecodeOperation->StartLoadOperationL(iMaxResolution);
+	}
+
+EXPORT_C CFbsBitmap* CVeiTitleClipGenerator::BackgroundImage() const
+	{
+	return iBackgroundImage;
+	}
+
+EXPORT_C void CVeiTitleClipGenerator::SetDuration(const TTimeIntervalMicroSeconds& aDuration)
+	{
+	if (iDuration != aDuration) 
+		{
+		iDuration = aDuration;
+		ReportDurationChanged();
+		}
+	}
+
+void CVeiTitleClipGenerator::WrapTextToArrayL(const TDesC& aText)
+	{
+	LOGFMT2(KVideoEditorLogFile, "CVeiTitleClipGenerator::WrapTextToArrayL(): In: iMaxResolution: (%d,%d)", iMaxResolution.iWidth, iMaxResolution.iHeight);
+
+	TInt fontdivisor = 11;
+	
+	do
+		{
+		
+			if (iText) 
+				{
+				delete iText;
+				iText = 0;
+				}
+				
+    	if (iWrappedArray) 
+    		{
+    		iWrappedArray->Reset();
+    		}
+
+    	TInt width = iMaxResolution.iWidth - KMargin * 2;
+    	GetTextFont(fontdivisor);
+    	iText = AknBidiTextUtils::ConvertToVisualAndWrapToArrayL(aText, width, *iTextFont, *iWrappedArray);
+    
+    	/* Recalculate text dependant values. */
+    	TInt lineHeight = iTextFont->HeightInPixels() + KLineSpacing;
+    	iWrappedTextBoxHeight = iWrappedArray->Count() * lineHeight;
+    	LOGFMT2(KVideoEditorLogFile, "CVeiTitleClipGenerator::WrapTextToArrayL(): In: iWrappedArray->Count %d, iWrappedTextBoxHeight  %d", iWrappedArray->Count(), iWrappedTextBoxHeight);
+
+    	fontdivisor++;
+		}
+	while(iWrappedTextBoxHeight > iMaxResolution.iHeight);
+
+	UpdateFirstFrameComplexityFactorL();
+
+	LOG(KVideoEditorLogFile, "CVeiTitleClipGenerator::WrapTextToArrayL(): Out");
+	}
+
+void CVeiTitleClipGenerator::UpdateFirstFrameComplexityFactorL()
+	{
+	CFbsBitmap* bitmap = GetFirstFrameL();
+	CleanupStack::PushL(bitmap);
+	iFirstFrameComplexityFactor = CalculateFrameComplexityFactor(bitmap);	
+	CleanupStack::PopAndDestroy(bitmap);
+	}
+
+void CVeiTitleClipGenerator::CalculateTransitionFrameIndices(TInt& aInEndFrame, TInt& aOutStartFrame) const
+	{
+	/* Calculate some values for timing the transitions */
+	TInt64 divider = 3;
+	TInt64 durationInt = iDuration.Int64();
+	TTimeIntervalMicroSeconds inEndTime(durationInt / divider);
+	TTimeIntervalMicroSeconds outStartTime(durationInt - durationInt / divider);
+
+	/* Limit the fade in/out times to a reasonable value. */
+	if (inEndTime.Int64() > TInt64(KVeiTitleClipFadeLimit)) 
+		{
+		inEndTime = TTimeIntervalMicroSeconds(KVeiTitleClipFadeLimit);
+		outStartTime = TTimeIntervalMicroSeconds(durationInt - KVeiTitleClipFadeLimit);
+		}
+
+	if (IsInserted()) 
+		{
+		aInEndFrame = GetVideoFrameIndex(inEndTime);
+		aOutStartFrame = GetVideoFrameIndex(outStartTime);
+		}
+	else
+		{
+		aInEndFrame = 5;
+		aOutStartFrame = 10;
+		}
+	}
+
+
+void CVeiTitleClipGenerator::GetTextFont(TInt aFontDivisor)
+	{
+#ifdef VERBOSE
+	LOGFMT4(KVideoEditorLogFile, "CVeiTitleClipGenerator::GetTextFont(): iGetFrameResolution: (%d,%d), iMaxResolution: (%d,%d)",\
+		iGetFrameResolution.iWidth, iGetFrameResolution.iHeight, iMaxResolution.iWidth, iMaxResolution.iHeight);
+#endif
+
+	if (!iTextFont || iGetFontResolution != iGetFrameResolution)
+		{
+		LOGFMT6(KVideoEditorLogFile, "CVeiTitleClipGenerator::GetTextFont(): Getting new font. iGetFontResolution: (%d,%d), iGetFrameResolution: (%d,%d), iMaxResolution: (%d,%d)",\
+			iGetFontResolution.iWidth, iGetFontResolution.iHeight, iGetFrameResolution.iWidth, iGetFrameResolution.iHeight, iMaxResolution.iWidth, iMaxResolution.iHeight);
+
+		TInt movieHeight = iGetFrameResolution.iHeight;
+		iGetFontResolution = iGetFrameResolution;
+		if (movieHeight <= 0)
+			{
+			movieHeight = iMaxResolution.iHeight;
+			iGetFontResolution = iMaxResolution;
+			}
+
+		// If the generator is inserted, we can use the actual movie height
+		// otherwise, we'll just assume max resolution.
+		if (IsInserted())
+			{
+			CVedMovie* movie = Movie();
+			movieHeight = movie->Resolution().iHeight;
+			}
+		TInt fontHeightInPixels;
+		if(aFontDivisor)
+			{
+			fontHeightInPixels = movieHeight / (aFontDivisor -3);
+			if (movieHeight >= 200)
+				{
+				fontHeightInPixels = movieHeight / aFontDivisor;
+				}
+			}
+		else
+			{
+			fontHeightInPixels = movieHeight / 8;
+			if (movieHeight >= 200)
+				{
+				fontHeightInPixels = movieHeight / 11;
+				}
+			}
+
+		TAknFontSpecification spec( EAknFontCategoryPrimary );
+		spec.SetTextPaneHeight( fontHeightInPixels );
+		spec.SetWeight( EStrokeWeightBold );
+		spec.SetPosture( EPostureUpright );
+
+		CWsScreenDevice* dev = CCoeEnv::Static()->ScreenDevice();
+		CAknLayoutFont* layoutFont = NULL;
+		TRAPD(err, layoutFont = AknFontAccess::CreateLayoutFontFromSpecificationL( *dev, spec ) );
+		if (err)
+			{
+			LOGFMT(KVideoEditorLogFile, "CVeiTitleClipGenerator::GetTextFont(): Creating font from font spec failed (%d)", err);
+
+			// In case of failure (should not happen...) make sure that some font is still available
+			ASSERT(EFalse);
+			TInt fontId = 0; 
+			if (movieHeight >= 200)
+			    {
+				fontId =EAknLogicalFontPrimaryFont;
+			    }
+			else
+				{
+				fontId = EAknLogicalFontSecondaryFont; 
+				}
+			iTextFont = AknLayoutUtils::FontFromId( fontId );
+			}
+		else
+			{
+			iTextFont = (const CFont*)layoutFont;
+			}
+		}
+
+#ifdef VERBOSE
+	LOG(KVideoEditorLogFile, "CVeiTitleClipGenerator::GetTextFont(): Out");
+#endif
+	}
+
+void CVeiTitleClipGenerator::DrawWrappedTextL(CFbsBitmap& aBitmap,
+	const TPoint& aTextPoint, const TRgb& aTextColor, const TRgb& aBgColor, const TRgb& aShadowColor,
+	TBool aDrawBackground)
+	{
+#ifdef VERBOSE
+	LOG(KVideoEditorLogFile, "CVeiTitleClipGenerator::DrawWrappedTextL(): In");
+#endif
+
+	// Make sure the text is wrapped using the movie's frame resolution.
+	// If the generator is not inserted, just use the maximum resolution.
+	//  - unfortunately this does not seem to work, if the text is re-wrapped
+	//    here, the program seems to get stuck.
+/*	if (IsInserted())
+		{
+		CVedMovie* movie = Movie();
+		TSize res = movie->Resolution();
+		if (iMaxResolution != res)
+			{
+			HBufC* oldText = iText->Des().AllocLC();
+			delete iText;
+			iText = NULL;
+			iMaxResolution = res;
+			WrapTextToArrayL(oldText->Des());
+			CleanupStack::PopAndDestroy(oldText);
+			}
+		}
+*/
+	CFbsDevice* device = CFbsBitmapDevice::NewL(&aBitmap);
+	CleanupStack::PushL(device);
+	CFbsBitGc* gc = NULL;
+	device->CreateContext(gc);
+	CleanupStack::PushL(gc);
+	gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
+
+	if (aDrawBackground)
+		{
+		gc->SetPenColor(aBgColor);
+		gc->SetBrushColor(aBgColor);
+		gc->DrawRect(TRect(aBitmap.SizeInPixels()));
+		}
+
+	gc->SetPenSize(TSize(1,1));
+
+	GetTextFont();
+	gc->UseFont(iTextFont);
+	
+	TPoint textPoint(aTextPoint);
+	TRect rect(aBitmap.SizeInPixels());
+
+	/* Draw text and shadow. */
+	
+	textPoint = aTextPoint;
+
+	for (TInt i = 0; i < iWrappedArray->Count(); i++)
+		{
+		TInt textWidth = iTextFont->TextWidthInPixels(iWrappedArray->At(i));
+		TInt baseX = 0;
+		switch(iHorizontalAlignment) 
+			{
+		case EVeiTitleClipHorizontalAlignmentCenter:
+			baseX = (rect.Width() - textWidth) / 2;
+			break;
+		case EVeiTitleClipHorizontalAlignmentLeft:
+			baseX = KMargin;
+			break;
+		case EVeiTitleClipHorizontalAlignmentRight:
+			baseX = (rect.iBr.iX - textWidth) - KMargin;
+			break;
+		default:
+			TVedPanic::Panic(TVedPanic::EInternal);
+			}
+		textPoint.iX = baseX + 1;
+		textPoint.iY += iTextFont->AscentInPixels() + KLineSpacing / 2 + 2;
+		gc->SetBrushColor(aShadowColor);
+		gc->SetPenColor(aShadowColor);
+		gc->DrawText(iWrappedArray->At(i), textPoint);
+		textPoint.iX -= 1;
+		textPoint.iY -= 2;
+		gc->SetBrushColor(aTextColor);
+		gc->SetPenColor(aTextColor);
+		gc->DrawText(iWrappedArray->At(i), textPoint);
+		textPoint.iY += iTextFont->DescentInPixels() + KLineSpacing / 2;
+		}
+
+	gc->DiscardFont();
+	CleanupStack::PopAndDestroy(gc);
+	CleanupStack::PopAndDestroy(device);
+
+#ifdef VERBOSE
+	LOG(KVideoEditorLogFile, "CVeiTitleClipGenerator::DrawWrappedTextL(): Out");
+#endif
+	}
+
+EXPORT_C CFbsBitmap* CVeiTitleClipGenerator::GetFirstFrameL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiTitleClipGenerator::GetFirstFrameL()");
+
+	iUseScaledImage = EFalse;
+	iGetFrameObserver = 0;
+    iGetFrameIndex = 0;
+
+	if (iBackgroundImage) 
+		{
+		iGetFrameResolution = iBackgroundImage->SizeInPixels();
+
+		LOGFMT2(KVideoEditorLogFile, "CVeiTitleClipGenerator::GetFirstFrameL(): Using BG image resolution: (%d,%d)", \
+			iGetFrameResolution.iWidth, iGetFrameResolution.iHeight);
+		}
+	else
+		{
+		iGetFrameResolution = iMaxResolution;
+
+		LOGFMT2(KVideoEditorLogFile, "CVeiTitleClipGenerator::GetFirstFrameL(): Using iMaxResolution: (%d,%d)", \
+			iGetFrameResolution.iWidth, iGetFrameResolution.iHeight);
+		}
+
+	iGetFrameDisplayMode = KVideoClipGenetatorDisplayMode;
+	iGetFrameEnhance = EFalse;
+	return FinishGetFrameL();
+	}
+
+void CVeiTitleClipGenerator::DrawMainTitleFrameL(CFbsBitmap& aBitmap, TInt aIndex)
+	{
+	ASSERT(iGetFrameResolution.iWidth > 0 && iGetFrameResolution.iHeight > 0);
+
+	TInt inEndFrame;
+	TInt outStartFrame;
+
+	CalculateTransitionFrameIndices(inEndFrame, outStartFrame);
+	
+	TInt index = aIndex;
+
+	/* Best thumbnail frame would be the one just after the transition. */
+	if (aIndex == KFrameIndexBestThumb) 
+		{
+		if (iTransition == EVeiTitleClipTransitionFade) 
+			{
+			/* Select a bit different looking frame for fading effects. */
+			index = inEndFrame / 2;
+			}
+		else
+			{
+			index = inEndFrame;
+			}
+		}
+
+	TRect rect(aBitmap.SizeInPixels());
+
+	/* Calculate text points */
+	TInt yAdjust;
+	if (iVerticalAlignment == EVeiTitleClipVerticalAlignmentBottom)
+		{
+		yAdjust = (rect.Height() - iWrappedTextBoxHeight) - KMargin; 
+		}
+	else if (iVerticalAlignment == EVeiTitleClipVerticalAlignmentCenter) 
+		{
+		yAdjust = (rect.Height() - iWrappedTextBoxHeight) / 2;
+		}
+	else
+		{
+		yAdjust = KMargin;
+		}
+
+	TPoint textPoint(rect.iTl.iX, rect.iTl.iY + yAdjust);
+
+	/* Initializations for drawing the text. */
+	CFbsBitmap* textBitmap = new (ELeave) CFbsBitmap;
+	CleanupStack::PushL(textBitmap);
+	User::LeaveIfError(textBitmap->Create(aBitmap.SizeInPixels(), aBitmap.DisplayMode()));
+
+	/* Determine shadow color. */
+
+	TRgb shadowColor;
+	if (iTextColor.Gray2() > 0) 
+		{
+		shadowColor = KRgbBlack;
+		}
+	else
+		{
+		shadowColor = KRgbWhite;
+		}
+
+	/* Draw the text. */
+	DrawWrappedTextL(*textBitmap, textPoint, iTextColor, iBackgroundColor, shadowColor, ETrue);
+
+	/* Create mask. */
+	CFbsBitmap* maskBitmap = new (ELeave) CFbsBitmap;
+	CleanupStack::PushL(maskBitmap);
+	User::LeaveIfError(maskBitmap->Create(aBitmap.SizeInPixels(), EGray256));
+
+	/* Calculate fading if necessary. */
+	TInt colorIndex = 255; // default: obilque text
+	if (iTransition == EVeiTitleClipTransitionFade)
+		{
+		if (index < inEndFrame) 
+			{
+			// fade in
+			colorIndex = index * 255 / inEndFrame;
+			}
+		else if (index > outStartFrame) 
+			{
+			// fade out
+			TInt endFrame = VideoFrameCount() - 1;
+			colorIndex = (index - endFrame) * 255 / (outStartFrame - endFrame);
+			}
+		}
+	
+	textPoint = TPoint(rect.iTl.iX, rect.iTl.iY + yAdjust);
+	DrawWrappedTextL(*maskBitmap, textPoint, TRgb::Gray256(colorIndex), TRgb::Gray256(0), TRgb::Gray256(colorIndex), ETrue);
+
+	/* Combine aBitmap & mask. */
+	CFbsDevice* device = CFbsBitmapDevice::NewL(&aBitmap);
+	CleanupStack::PushL(device);
+	CFbsBitGc* gc = NULL;
+	device->CreateContext(gc);
+	CleanupStack::PushL(gc);
+
+	gc->BitBltMasked(TPoint(0,0), textBitmap, rect, maskBitmap, EFalse);
+
+	CleanupStack::PopAndDestroy(gc);
+	CleanupStack::PopAndDestroy(device);
+	CleanupStack::PopAndDestroy(maskBitmap);
+	CleanupStack::PopAndDestroy(textBitmap);
+	}
+
+
+void CVeiTitleClipGenerator::DrawScrollTitleFrameL(CFbsBitmap& aBitmap, TInt aIndex)
+	{
+	TInt index = aIndex;
+
+	TInt numberOfFrames = VideoFrameCount();
+
+	/* Select thumbnail so that it's a bit different from the centered ones. */
+	if (aIndex == KFrameIndexBestThumb) 
+		{
+		index = numberOfFrames - numberOfFrames / 3;
+		}
+
+	TRect rect(aBitmap.SizeInPixels());
+	TPoint textPoint;
+	
+	/* Calculate amounts for vertical scrollers. */
+	TInt yTravelPerFrame = (rect.Height() + iWrappedTextBoxHeight) / numberOfFrames + 1;
+	TInt yStartPoint = (rect.iTl.iY - iWrappedTextBoxHeight) - 10;
+
+	TRgb shadowColor;
+	if (iTextColor.Gray2() > 0) 
+		{
+		shadowColor = KRgbBlack;
+		}
+	else
+		{
+		shadowColor = KRgbWhite;
+		}
+
+	if (iTransition == EVeiTitleClipTransitionScrollBottomToTop) 
+		{
+		textPoint.iY = yStartPoint + yTravelPerFrame * (numberOfFrames - index);
+		DrawWrappedTextL(aBitmap, textPoint, iTextColor, iBackgroundColor, shadowColor, EFalse);
+		}
+	else 
+		{
+		CFbsDevice* device = CFbsBitmapDevice::NewL(&aBitmap);
+		CFbsBitGc* gc = NULL;
+		device->CreateContext(gc);
+
+		GetTextFont();
+		gc->UseFont(iTextFont);
+
+		gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
+		gc->SetPenSize(TSize(1,1));
+
+		/* Calculate scroll amounts for horizontal scrollers. */
+		TInt xTravelPerFrame = (rect.Width() + iTextFont->TextWidthInPixels(*iText)) / numberOfFrames + 1;
+		TInt xStartPoint = ( rect.iTl.iX - iTextFont->TextWidthInPixels(*iText) ) - 10;
+
+		if (iTransition == EVeiTitleClipTransitionScrollTopToBottom) 
+			{
+			textPoint.iY = yStartPoint + yTravelPerFrame * index;
+
+			/* Draw texts. */	
+			for (TInt i = iWrappedArray->Count(); i > 0; i--)
+				{
+				TInt textWidth = iTextFont->TextWidthInPixels(iWrappedArray->At(i - 1));
+				TInt baseX = 0;
+				switch(HorizontalAlignment()) 
+					{
+				case EVeiTitleClipHorizontalAlignmentCenter:
+					baseX = (rect.Width() - textWidth) / 2;
+					break;
+				case EVeiTitleClipHorizontalAlignmentLeft:
+					baseX = 0;
+					break;
+				case EVeiTitleClipHorizontalAlignmentRight:
+					baseX = rect.iBr.iX - textWidth;
+					break;
+				default:
+					TVedPanic::Panic(TVedPanic::EInternal);
+					}
+				textPoint.iX = baseX + 1;
+				textPoint.iY += iTextFont->AscentInPixels() + KLineSpacing / 2 + 2;
+				gc->SetBrushColor(shadowColor);
+				gc->SetPenColor(shadowColor);
+				gc->DrawText(iWrappedArray->At(i), textPoint);
+				textPoint.iX -= 1;
+				textPoint.iY -= 2;
+				gc->SetBrushColor(TextColor());
+				gc->SetPenColor(TextColor());
+				gc->DrawText(iWrappedArray->At(i), textPoint);
+				textPoint.iY += iTextFont->DescentInPixels() + KLineSpacing / 2;
+				}
+			}
+		else if (iTransition == EVeiTitleClipTransitionScrollRightToLeft) 
+			{
+			textPoint.iY = rect.Height() / 2 + 2;
+			textPoint.iX = xStartPoint + xTravelPerFrame * (numberOfFrames - index) + 1;
+			gc->SetBrushColor(shadowColor);
+			gc->SetPenColor(shadowColor);
+			gc->DrawText(*iText, textPoint);
+			textPoint.iX -= 1;
+			textPoint.iY -= 2;
+			gc->SetBrushColor(TextColor());
+			gc->SetPenColor(TextColor());
+			gc->DrawText(*iText, textPoint);
+			}
+		else if (iTransition == EVeiTitleClipTransitionScrollLeftToRight) 
+			{
+			textPoint.iX = xStartPoint + xTravelPerFrame * index + 1;
+			textPoint.iY = rect.Height() / 2 + 2;
+			gc->SetBrushColor(shadowColor);
+			gc->SetPenColor(shadowColor);
+			gc->DrawText(*iText, textPoint);
+			textPoint.iX -= 1;
+			textPoint.iY -= 2;
+			gc->SetBrushColor(TextColor());
+			gc->SetPenColor(TextColor());
+			gc->DrawText(*iText, textPoint);
+			}
+		
+		gc->DiscardFont();
+		delete gc;
+		delete device;
+		}
+	}
+
+TInt CVeiTitleClipGenerator::MaximumFramerate() const
+	{
+	TInt maxFrameRate;
+	if (IsInserted()) 
+		{
+		maxFrameRate = Movie()->MaximumFramerate();
+		if (maxFrameRate > KMaxFrameRate)
+			{
+			maxFrameRate = KMaxFrameRate;
+			}
+		}
+	else
+		{
+		maxFrameRate = KMaxFrameRate;
+		}
+
+#ifdef VERBOSE
+	LOGFMT(KVideoEditorLogFile, "CVeiTitleClipGenerator::MaximumFramerate(): %d", maxFrameRate);
+#endif
+
+	return maxFrameRate;
+	}
+
+//////////////////////////////////////////////////////////////////////////
+//  Decode operation
+//////////////////////////////////////////////////////////////////////////
+
+
+CVeiTitleClipImageDecodeOperation* CVeiTitleClipImageDecodeOperation::NewL(
+								CVeiTitleClipGenerator& aGenerator,
+								MVeiTitleClipGeneratorObserver& aObserver,
+								const TDesC& aFilename, 
+ 							    TInt aPriority)
+	{
+    CVeiTitleClipImageDecodeOperation* self = 
+		new (ELeave) CVeiTitleClipImageDecodeOperation(aGenerator, 
+													   aObserver, 
+													   aPriority);
+    CleanupStack::PushL(self);
+    self->ConstructL(aFilename);
+    CleanupStack::Pop(self);
+    return self;	
+	}
+
+CVeiTitleClipImageDecodeOperation::CVeiTitleClipImageDecodeOperation(CVeiTitleClipGenerator& aGenerator, 
+														   MVeiTitleClipGeneratorObserver& aObserver,
+														   TInt aPriority)
+  : CActive(aPriority), iGenerator(aGenerator), iObserver(&aObserver)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+
+CVeiTitleClipImageDecodeOperation* CVeiTitleClipImageDecodeOperation::NewL(
+								CVeiTitleClipGenerator& aGenerator,
+								CFbsBitmap* aSourceBitmap,
+ 							    TInt aPriority)
+	{
+    CVeiTitleClipImageDecodeOperation* self = 
+		new (ELeave) CVeiTitleClipImageDecodeOperation(aGenerator, 
+													   aSourceBitmap, 
+													   aPriority);
+    return self;	
+	}
+
+
+CVeiTitleClipImageDecodeOperation::CVeiTitleClipImageDecodeOperation(
+										CVeiTitleClipGenerator& aGenerator, 
+										CFbsBitmap* aSourceBitmap,
+										TInt aPriority)
+  : CActive(aPriority), iGenerator(aGenerator), iObserver(0), iBitmap(aSourceBitmap), iNotifyObserver(EFalse)
+	{
+	CActiveScheduler::Add(this);
+	}
+
+
+void CVeiTitleClipImageDecodeOperation::ConstructL(const TDesC& aFilename)
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::constructL(): In: aFilename: %S", &aFilename);
+
+	RFs&	fs = CCoeEnv::Static()->FsSession();
+	iDecoder = CImageDecoder::FileNewL(fs, aFilename);
+	iNotifyObserver = ETrue;
+	
+	LOG(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::ConstructL(): Out");
+	}
+
+CVeiTitleClipImageDecodeOperation::~CVeiTitleClipImageDecodeOperation()
+	{
+	Cancel();
+
+	delete iDecoder;
+	iDecoder = 0;
+	delete iScaler;
+	iScaler = 0;
+	delete iBitmap;
+	iBitmap = 0;
+	iObserver = 0;
+	}
+
+void CVeiTitleClipImageDecodeOperation::DoCancel()
+	{
+	LOG(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::DoCancel(): In");
+
+	if (iDecoder) 
+		{
+		iDecoder->Cancel();
+		}
+
+	delete iScaler;
+	iScaler = 0;
+	delete iDecoder;
+	iDecoder = 0;
+	delete iBitmap;
+	iBitmap = 0;
+
+	if (iNotifyObserver) 
+		{
+		iObserver->NotifyTitleClipBackgroundImageLoadComplete(iGenerator, KErrCancel);
+		}
+	else
+		{
+		TRAP_IGNORE( iGenerator.FinishGetFrameL() );
+		}
+
+	LOG(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::DoCancel(): Out");
+	}
+
+void CVeiTitleClipImageDecodeOperation::RunL()
+	{
+	switch(iDecodePhase) 
+		{
+	case EPhaseLoading:
+			{
+			StartScalingOperationL(iGenerator.iMaxResolution);
+			break;
+			}
+	case EPhaseScaling:
+			{
+			delete iDecoder;
+			iDecoder = 0;
+			delete iScaler;
+			iScaler = 0;
+			iDecodePhase = EPhaseComplete;
+			if (iNotifyObserver) 
+				{
+				/* Notify observer. */
+				iObserver->NotifyTitleClipBackgroundImageLoadComplete(iGenerator, KErrNone);
+
+				/* Transfer ownership of iBitmap to generator. */
+				iGenerator.iBackgroundImage = iBitmap;
+				iBitmap = 0;
+				iGenerator.UpdateFirstFrameComplexityFactorL();
+				iGenerator.ReportSettingsChanged();
+				}
+			else
+				{
+				iGenerator.iScaledBackgroundImage = iBitmap;
+				iBitmap = 0;
+				iGenerator.FinishGetFrameL();
+				}
+			break;
+			}
+	default:
+		TVedPanic::Panic(TVedPanic::EInternal);
+		}
+	}
+
+TInt CVeiTitleClipImageDecodeOperation::RunError(TInt aError)
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::RunError(): In: %d", aError);
+	if (iDecoder) 
+		{
+		iDecoder->Cancel();
+		}
+
+	delete iScaler;
+	iScaler = 0;
+	delete iDecoder;
+	iDecoder = 0;
+	delete iBitmap;
+	iBitmap = 0;
+
+	TInt err = KErrNone;
+	if (iNotifyObserver) 
+		{
+		iObserver->NotifyTitleClipBackgroundImageLoadComplete(iGenerator, aError);
+		}
+	else
+		{
+		TRAP(err, iGenerator.FinishGetFrameL(aError) );
+		}
+
+	LOGFMT(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::RunError(): Out: %d", err);
+	return err;
+	}
+
+void CVeiTitleClipImageDecodeOperation::StartLoadOperationL(const TSize& aMaxResolution)
+	{
+	LOGFMT2(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::StartLoadOperationL(): In: aMaxResolution: (%d,%d)", aMaxResolution.iWidth, aMaxResolution.iHeight);
+
+	__ASSERT_ALWAYS(!IsActive(), TVedPanic::Panic(TVedPanic::EInternal));
+
+	iDecodePhase = EPhaseLoading;
+
+	const TFrameInfo& info = iDecoder->FrameInfo();
+	TSize targetResolution(0, 0);
+	const TSize sourceResolution(info.iOverallSizeInPixels);
+
+	/* Calculate resolution. */
+
+	if ((sourceResolution.iWidth <= aMaxResolution.iWidth) 
+		&& (sourceResolution.iHeight <= aMaxResolution.iHeight))
+		{
+		targetResolution.iWidth = sourceResolution.iWidth;
+		targetResolution.iHeight = sourceResolution.iHeight;
+		}
+	else if (info.iFlags & TFrameInfo::EFullyScaleable) 
+		{
+		if ((sourceResolution.iWidth * aMaxResolution.iWidth) > 
+			(sourceResolution.iHeight * aMaxResolution.iHeight))
+			{
+			targetResolution.iWidth = aMaxResolution.iWidth;
+			targetResolution.iHeight = 
+				(targetResolution.iWidth * sourceResolution.iHeight) / sourceResolution.iWidth;
+			}
+		else
+			{
+			targetResolution.iHeight = aMaxResolution.iHeight;
+			targetResolution.iWidth = 
+				(targetResolution.iHeight * sourceResolution.iWidth) / sourceResolution.iHeight;
+			}
+		}
+	else 
+		{
+		targetResolution.iWidth = (sourceResolution.iWidth / 8) + 1;
+		targetResolution.iHeight = (sourceResolution.iHeight / 8) + 1;
+		
+		if ((targetResolution.iWidth < aMaxResolution.iWidth) 
+			&& (targetResolution.iHeight < aMaxResolution.iHeight))
+			{
+			targetResolution.iWidth = (sourceResolution.iWidth / 4) + 1;
+			targetResolution.iHeight = (sourceResolution.iHeight / 4) + 1;
+			}
+
+		if ((targetResolution.iWidth < aMaxResolution.iWidth) 
+			&& (targetResolution.iHeight < aMaxResolution.iHeight))
+			{
+			targetResolution.iWidth = (sourceResolution.iWidth / 2) + 1;
+			targetResolution.iHeight = (sourceResolution.iHeight / 2) + 1;
+			}
+
+		if ((targetResolution.iWidth < aMaxResolution.iWidth) 
+			&& (targetResolution.iHeight < aMaxResolution.iHeight))
+			{
+			targetResolution.iWidth = (sourceResolution.iWidth);
+			targetResolution.iHeight = (sourceResolution.iHeight);
+			}
+		}
+
+	iBitmap = new (ELeave) CFbsBitmap;
+	TInt err = iBitmap->Create(targetResolution, EColor64K);
+
+	if (err != KErrNone) 
+		{
+		delete iBitmap;
+		iBitmap = 0;
+		iObserver->NotifyTitleClipBackgroundImageLoadComplete(iGenerator, err);
+		return;
+		}
+
+	iDecoder->Convert(&iStatus, *iBitmap);
+	SetActive();
+
+	LOG(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::StartLoadingOperationL(): Out");
+	}
+
+
+void CVeiTitleClipImageDecodeOperation::StartScalingOperationL(const TSize& aResolution)
+	{
+	LOGFMT2(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::StartScalingOperationL(): In: aResolution: (%d,%d)", aResolution.iWidth, aResolution.iHeight);
+
+	__ASSERT_ALWAYS(!IsActive(), TVedPanic::Panic(TVedPanic::EInternal));
+
+	iDecodePhase = EPhaseScaling;
+
+	TSize sourceRes = iBitmap->SizeInPixels();
+	TSize destRes(aResolution);
+	TSize movieRes = iGenerator.Movie()->Resolution();
+
+	if (destRes.iHeight > movieRes.iHeight || destRes.iWidth > movieRes.iWidth) 
+		{
+		movieRes = destRes;
+		}
+	
+	TSize imageResInMovie(0,0);
+	if ((sourceRes.iWidth > movieRes.iWidth) || (sourceRes.iHeight > movieRes.iHeight)) 
+		{
+		LOG(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::StartScalingOperationL downscaling");
+		// Downscaling
+		if ((sourceRes.iWidth * movieRes.iHeight) < 
+			(sourceRes.iHeight * movieRes.iWidth))
+			{
+			imageResInMovie.iWidth = movieRes.iWidth;
+			imageResInMovie.iHeight =
+				(movieRes.iWidth * sourceRes.iHeight) / sourceRes.iWidth;
+			}
+		else 
+			{
+			imageResInMovie.iHeight = movieRes.iHeight;
+			imageResInMovie.iWidth = 
+				(movieRes.iHeight * sourceRes.iWidth) / sourceRes.iHeight;
+			}
+		}
+	else if (iNotifyObserver) 
+		{
+		imageResInMovie = sourceRes;
+		}
+	else
+		{
+		LOG(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::StartScalingOperationL upscaling");
+		// Upscaling - limit to a factor of two
+		if ((sourceRes.iWidth * movieRes.iHeight) < 
+			(sourceRes.iHeight * movieRes.iWidth))
+			{
+			imageResInMovie.iWidth = Min(movieRes.iWidth, (sourceRes.iWidth * 2));
+			imageResInMovie.iHeight = Min((sourceRes.iHeight * 2),
+				((movieRes.iWidth * sourceRes.iHeight) / sourceRes.iWidth));
+			}
+		else 
+			{
+			imageResInMovie.iHeight = Min((sourceRes.iHeight * 2), movieRes.iHeight);
+			imageResInMovie.iWidth = Min((sourceRes.iWidth * 2),
+				((movieRes.iHeight * sourceRes.iWidth) / sourceRes.iHeight));
+			}
+		}
+
+	TSize movieResInDestBitmap(-1,-1);
+	if ((movieRes.iWidth * destRes.iHeight) < 
+		(movieRes.iHeight * destRes.iWidth))
+		{
+		movieResInDestBitmap.iWidth = destRes.iWidth;
+		movieResInDestBitmap.iHeight =
+			(movieResInDestBitmap.iWidth * movieRes.iHeight) / movieRes.iWidth;
+		}
+	else 
+		{
+		movieResInDestBitmap.iHeight = destRes.iHeight;
+		movieResInDestBitmap.iWidth = 
+			(movieResInDestBitmap.iHeight * movieRes.iWidth) / movieRes.iHeight;
+		}
+	
+
+	TSize targetRes(imageResInMovie);
+	targetRes.iWidth = imageResInMovie.iWidth * movieResInDestBitmap.iWidth / movieRes.iWidth;
+	targetRes.iHeight = imageResInMovie.iHeight * movieResInDestBitmap.iHeight / movieRes.iHeight;
+
+	LOGFMT12(KVideoEditorLogFile,\
+		"CVeiTitleClipOperation::StartOperation() sourceRes=(%d,%d) movieRes=(%d,%d) destRes=(%d,%d) targetRes=(%d,%d) imageResInMovie=(%d,%d) movieResInDestBitmap=(%d,%d)", \
+		sourceRes.iWidth, sourceRes.iHeight, \
+		movieRes.iWidth, movieRes.iHeight, \
+		destRes.iWidth, destRes.iHeight, \
+		targetRes.iWidth, targetRes.iHeight, \
+		imageResInMovie.iWidth, imageResInMovie.iHeight, \
+		movieResInDestBitmap.iWidth, movieResInDestBitmap.iHeight);
+	
+
+	if (iGenerator.iScaledBackgroundImage)
+		{
+		TSize scaledRes = iGenerator.iScaledBackgroundImage->SizeInPixels();
+		if ((scaledRes.iWidth == targetRes.iWidth) || (scaledRes.iHeight == targetRes.iHeight)) 
+			{
+			LOG(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::StartScalingOperationL Using scaled");
+			iGenerator.FinishGetFrameL();
+			return;
+			}
+		}
+
+	delete iScaler;	
+	iScaler = NULL;
+	iScaler = CBitmapScaler::NewL();
+	iScaler->Scale(&iStatus, *iBitmap, targetRes, EFalse);
+	SetActive();
+
+	LOG(KVideoEditorLogFile, "CVeiTitleClipImageDecodeOperation::StartScalingOperationL(): Out");
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VeiVideoEditorSettings.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Common settings.
+*
+*/
+
+
+
+// INCLUDES
+// System includes
+#include <centralrepository.h>
+#include <MmsEngineDomainCRKeys.h>
+#include <MPMediaPlayerSettings.h>
+#include <e32property.h>
+
+// User includes
+#include "VeiVideoEditorSettings.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorDebugUtils.h"
+
+
+// CONSTANTS
+
+EXPORT_C void CVeiVideoEditorSettings::GetMediaPlayerVolumeLevelL( TInt& aVolumeLevel )
+	{
+    LOG(KVideoEditorLogFile, "CVeiVideoEditorSettings::GetMediaPlayerVolumeLevelL(): In");
+    CMPMediaPlayerSettings* mpSettings = CMPMediaPlayerSettings::NewL();
+    CleanupStack::PushL( mpSettings );
+    
+    aVolumeLevel = mpSettings->VolumeLevelL();
+    
+    CleanupStack::PopAndDestroy( mpSettings );
+    LOG(KVideoEditorLogFile, "CVeiVideoEditorSettings::GetMediaPlayerVolumeLevelL(): Out");
+	}
+
+EXPORT_C void CVeiVideoEditorSettings::SetMediaPlayerVolumeLevelL( TInt aVolumeLevel )
+	{
+    LOG(KVideoEditorLogFile, "CVeiVideoEditorSettings::SetMediaPlayerVolumeLevelL(): In");
+    
+    CMPMediaPlayerSettings* mpSettings = CMPMediaPlayerSettings::NewL();
+    CleanupStack::PushL( mpSettings );
+    
+    mpSettings->SetVolumeLevelL( aVolumeLevel );
+    
+    CleanupStack::PopAndDestroy( mpSettings );    
+    LOG(KVideoEditorLogFile, "CVeiVideoEditorSettings::SetMediaPlayerVolumeLevelL(): Out");
+	}
+
+EXPORT_C void CVeiVideoEditorSettings::GetMaxMmsSizeL( TInt& aMaxMmsSize )
+	{
+    LOG(KVideoEditorLogFile, "CVeiVideoEditorSettings::GetMaxMmsSizeL(): In");
+
+	CRepository* repository = CRepository::NewL(KCRUidMmsEngine);
+	repository->Get(KMmsEngineMaximumSendSize, aMaxMmsSize);
+	LOGFMT(KVideoEditorLogFile, "CVeiVideoEditorSettings::GetMaxMmsSizeL() 1, KMmsEngineMaximumSendSize:%d", aMaxMmsSize);
+	delete repository;
+
+    LOG(KVideoEditorLogFile, "CVeiVideoEditorSettings::GetMaxMmsSizeL(): Out");
+	}
+	
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/VideoEditorUtils.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,531 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+// INCLUDES
+#include <bautils.h>
+#include <eikenv.h>
+#include <badesca.h>
+#include <PathInfo.h>
+#include <sysutil.h>
+#include <DRMCommon.h>
+#include <AknUtils.h>
+#include <data_caging_path_literals.hrh>
+#include <AknListQueryDialog.h> 
+#include <VedSimpleCutVideo.rsg>
+#include <BAUTILS.H> 
+
+#include "VideoEditorUtils.h"
+#include "VideoEditorCommon.h"
+#include "VeiSettings.h"
+#include "VideoEditorDebugUtils.h"
+
+
+// CONSTANTS
+_LIT (KEditedSuffix, "-");
+_LIT(KManualVideoEditorMifFile,        "ManualVideoEditor.mif");
+_LIT(KVideoEditorUiComponentsMifFile,  "VideoEditorUiComponents.mif");
+_LIT(KVideoEditorMbmFile,              "VideoEditorBitmaps.mbm");
+
+//=============================================================================
+EXPORT_C void VideoEditorUtils::NotifyNewMediaDocumentL (
+    RFs& /*aFsSession*/, 
+    const TDesC& aFileName )
+{
+	LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::NotifyNewMediaDocumentL: In (%S)", &aFileName);
+    LOG(KVideoEditorLogFile, "VideoEditorUtils::NotifyNewMediaDocumentL: Out");
+}
+
+//=============================================================================
+EXPORT_C TInt VideoEditorUtils::GenerateNewDocumentNameL (
+    RFs& aFsSession, 
+    const TDesC& aSourceFileName, 
+    TDes& aTargetFileName,
+    TVedVideoFormat aOutputFormat,
+    TInt aTargetSizeEstimate,
+    VideoEditor::TMemory aMemoryInUse )
+{
+	LOG(KVideoEditorLogFile, "VideoEditorUtils::GenerateNewDocumentNameL, in:");
+	LOGFMT4(KVideoEditorLogFile, "VideoEditorUtils::GenerateNewDocumentNameL 1\tSource file: %S, output format: %d, required space: %d, memory in use: %d", &aSourceFileName, aOutputFormat, aTargetSizeEstimate, aMemoryInUse);
+
+	TInt err = KErrNone;
+
+	//	Set file name to parser
+	TParsePtrC fileParse (aSourceFileName);
+
+	//  Test filename is already too long
+	if (fileParse.NameAndExt().Length() > KMaxFileName - 5)
+	{
+		err = KErrArgument;
+	}
+
+	// Otherwise proceed to generate the filename
+	else
+	{
+		//	If the memory is specified as EMemAutomatic, the target is primarily
+		//	on the memory card, and if that is full, on the phone memory.
+		//	If EMemPhoneMemory or EMemMemoryCard is specified, only that one is used.
+		VideoEditor::TMemory selectedMemoryInUse;
+		aMemoryInUse == VideoEditor::EMemAutomatic ? 
+			selectedMemoryInUse = VideoEditor::EMemMemoryCard : 
+			selectedMemoryInUse = aMemoryInUse;
+
+		//  Find file suffix that is not yet used 
+		TInt val = 1;
+		TFileName temp;
+
+		//  First try the above selected primary location.
+		TFileName driveAndPath;
+		if (selectedMemoryInUse == VideoEditor::EMemPhoneMemory)
+		{
+			driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() );
+		}
+		else
+		{
+			driveAndPath.Copy( PathInfo::MemoryCardRootPath() );
+		}
+		driveAndPath.Append( PathInfo::VideosPath() );
+		TRAPD(errBafl, BaflUtils::EnsurePathExistsL (aFsSession, driveAndPath));
+		LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::GenerateNewDocumentNameL 2, errBafl:%d", errBafl );
+		TBool primaryLocationFull = ( KErrNone != errBafl 
+			|| !IsEnoughFreeSpaceToSaveL ( aFsSession, driveAndPath, aTargetSizeEstimate ) );
+
+
+		//	If the memory is full, and the memory is selected as automatic,
+		//	try alternative location.
+		if (primaryLocationFull && aMemoryInUse == VideoEditor::EMemAutomatic)
+		{
+			if (selectedMemoryInUse == VideoEditor::EMemMemoryCard)
+			{
+				driveAndPath.Copy (PathInfo::PhoneMemoryRootPath() );
+			}
+			else
+			{
+				driveAndPath.Copy (PathInfo::MemoryCardRootPath() );
+			}
+			driveAndPath.Append ( PathInfo::VideosPath() );
+			TBool secondaryLocationFull = ( !BaflUtils::FolderExists (aFsSession, driveAndPath)
+            || !IsEnoughFreeSpaceToSaveL ( aFsSession, driveAndPath, aTargetSizeEstimate ) );
+			if (secondaryLocationFull)
+			{
+				err = KErrDiskFull;
+			}
+		}
+
+        //	Now sufficient disk space has been verified.
+        //	Proceed to generate the unique file name.
+        if (KErrNone == err)
+        {
+            LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::GenerateNewDocumentNameL 3, File will be saved to path: %S", &driveAndPath );
+
+            //  Copy drive and path to temporary file name
+            temp.Copy( driveAndPath );
+
+            //  Add file name without suffix 
+            TPtrC name = fileParse.Name();
+            TInt offset = FindSuffix ( name );
+            if (offset == KErrNotFound)
+	        {
+                temp.Append ( fileParse.Name() );
+            }
+            else
+            {
+                temp.Append ( name.Left (offset) );
+            }
+    
+            temp.Append ( KEditedSuffix );
+            temp.AppendNumFixedWidth (val, EDecimal, 3);
+            temp.Append ( aOutputFormat == EVedVideoFormat3GPP ? KExt3gp : KExtMp4 );
+
+            //  Increase edit number until we find a file name that is not used
+            while ( FileAlreadyExistsL(aFsSession, temp) )
+            {
+                ++val;
+                temp.Zero();
+                temp.Copy ( driveAndPath );
+                if (offset == KErrNotFound)
+                {
+                    temp.Append ( fileParse.Name() );
+                }
+		        else
+                {
+                    temp.Append ( name.Left (offset) );
+                }
+
+                temp.Append ( KEditedSuffix );
+                if (val < 1000)
+                {
+                    temp.AppendNumFixedWidth ( val, EDecimal, 3);
+                }
+                else
+                {
+                    temp.AppendNumFixedWidth ( val, EDecimal, 4);
+                }
+
+                temp.Append ( aOutputFormat == EVedVideoFormat3GPP ? KExt3gp : KExtMp4 );
+            }
+
+            //  Set document name 
+            aTargetFileName.Copy ( temp );
+        }
+    }
+
+    LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::GenerateNewDocumentNameL: out (%d)", err);    
+    return err;
+}
+
+
+//=============================================================================
+EXPORT_C TInt VideoEditorUtils::GenerateFileNameL (
+    RFs& aFsSession, 
+    const TDesC& aSourceFileName, 
+    TDes& aTargetFileName,
+    TVedVideoFormat aOutputFormat,
+    TInt aTargetSizeEstimate,
+    TFileName aDrive )
+{
+	LOG(KVideoEditorLogFile, "VideoEditorUtils::GenerateNewDocumentNameL, in:");
+	LOGFMT4(KVideoEditorLogFile, "VideoEditorUtils::GenerateNewDocumentNameL 1\tSource file: %S, output format: %d, required space: %d, memory in use: %d", &aSourceFileName, &aOutputFormat, &aTargetSizeEstimate, &aDrive);
+
+	TInt err = KErrNone;
+
+	//	Set file name to parser
+	TParsePtrC fileParse (aSourceFileName);
+
+	//  Test if filename is already too long
+	if (fileParse.NameAndExt().Length() > KMaxFileName - 5)
+	{
+		err = KErrArgument;
+	}
+
+	// Otherwise proceed to generate the filename
+	else
+	{
+		//  Find file suffix that is not yet used 
+		TInt val = 1;
+		TFileName temp;
+
+		TFileName driveAndPath = aDrive;
+		driveAndPath.Append( PathInfo::VideosPath() );
+		
+		// create the folder if it doesn't exist
+		TRAPD(errBafl, BaflUtils::EnsurePathExistsL (aFsSession, driveAndPath));
+		LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::GenerateNewDocumentNameL 2, errBafl:%d", errBafl );
+				
+		TBool selectedLocationFull = ( KErrNone != errBafl 
+
+			|| !IsEnoughFreeSpaceToSaveL ( aFsSession, driveAndPath, aTargetSizeEstimate ) );
+
+		if (selectedLocationFull)
+			{
+				err = KErrDiskFull;
+			}
+	
+	    //	Now sufficient disk space has been verified.
+        //	Proceed to generate the unique file name.
+        if (KErrNone == err)
+        {
+           LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::GenerateNewDocumentNameL 3, File will be saved to path: %S", &driveAndPath );
+
+            //  Copy drive and path to temporary file name
+            temp.Copy( driveAndPath );
+
+            //  Add file name without suffix 
+            TPtrC name = fileParse.Name();
+
+            TInt offset = FindSuffix ( name );
+
+            if (offset == KErrNotFound)
+	        {
+                temp.Append ( fileParse.Name() );
+            }
+            else
+            {
+                temp.Append ( name.Left (offset) );
+            }
+    
+            temp.Append ( KEditedSuffix );
+            temp.AppendNumFixedWidth (val, EDecimal, 3);
+            temp.Append ( aOutputFormat == EVedVideoFormat3GPP ? KExt3gp : KExtMp4 );
+
+            //  Increase edit number until we find a file name that is not used
+            while ( FileAlreadyExistsL(aFsSession, temp) )
+            {
+                ++val;
+                temp.Zero();
+                temp.Copy ( driveAndPath );
+                if (offset == KErrNotFound)
+                {
+                    temp.Append ( fileParse.Name() );
+                }
+		        else
+                {
+                    temp.Append ( name.Left (offset) );
+                }
+
+                temp.Append ( KEditedSuffix );
+                if (val < 1000)
+                {
+                    temp.AppendNumFixedWidth ( val, EDecimal, 3);
+                }
+                else
+                {
+                    temp.AppendNumFixedWidth ( val, EDecimal, 4);
+                }
+
+                temp.Append ( aOutputFormat == EVedVideoFormat3GPP ? KExt3gp : KExtMp4 );
+            }
+
+            //  Set document name 
+            aTargetFileName.Copy ( temp );
+        }
+    }
+
+    LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::GenerateNewDocumentNameL: out (%d)", err);    
+    return err;
+}
+
+
+//=============================================================================
+EXPORT_C TBool VideoEditorUtils::IsEnoughFreeSpaceToSaveL( 
+	RFs& aFsSession, 
+	const TDesC& aFileName, 
+	TInt aSizeEstimate ) 
+	{
+	LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::IsEnoughFreeSpaceToSaveL: in: %S", &aFileName);
+
+	TBool spaceBelowCriticalLevel( EFalse );
+
+	TParsePtrC fileParse (aFileName);
+
+	TInt mmc = fileParse.Drive().Left(1).CompareF( PathInfo::MemoryCardRootPath().Left(1) );
+	if( mmc == 0 )
+		{
+		spaceBelowCriticalLevel = SysUtil::MMCSpaceBelowCriticalLevelL( 
+										&aFsSession, aSizeEstimate );
+		}
+	else
+		{
+		spaceBelowCriticalLevel = SysUtil::DiskSpaceBelowCriticalLevelL( 
+										&aFsSession, aSizeEstimate, EDriveC );
+		}	
+
+	LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::IsEnoughFreeSpaceToSaveL: out: %d", !spaceBelowCriticalLevel);
+	return !spaceBelowCriticalLevel;
+	}
+
+//=============================================================================
+EXPORT_C TBool VideoEditorUtils::IsDrmProtectedL( const TDesC& aFileName ) 
+	{
+	LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::IsDrmProtectedL: in: %S", &aFileName);
+
+	TBool isProtected = EFalse;
+	DRMCommon* drm = DRMCommon::NewL();
+	CleanupStack::PushL (drm);
+	drm->IsProtectedFile( aFileName, isProtected );
+	CleanupStack::PopAndDestroy (drm);
+
+	LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::IsDrmProtectedL: out: %d", isProtected);
+	return isProtected;
+	}
+
+//=============================================================================
+EXPORT_C TFileName VideoEditorUtils::IconFileNameAndPath( TInt aInconFileIndex )
+	{
+	LOG(KVideoEditorLogFile, "VideoEditorUtils::IconFileNameAndPath: in:");
+
+	TFileName fileName;
+	Dll::FileName(fileName);
+	TParse p;
+
+	switch (aInconFileIndex)
+		{
+		case KManualVideoEditorIconFileId:
+			p.Set(KManualVideoEditorMifFile, &KDC_APP_BITMAP_DIR, &fileName);
+			break;
+		case KVideoEditorUiComponentsIconFileId:
+			p.Set(KVideoEditorUiComponentsMifFile, &KDC_APP_BITMAP_DIR, &fileName);
+			break;
+		case KVeiNonScalableIconFileId:
+			p.Set(KVideoEditorMbmFile, &KDC_APP_BITMAP_DIR, &fileName);
+			break;
+		default:
+			User::Invariant();
+		}
+
+	TPtrC fullName = p.FullName();
+	LOGFMT2(KVideoEditorLogFile, "VideoEditorUtils::IconFileNameAndPath: Id: %d, name: %S", aInconFileIndex, &fullName);
+
+	return fullName;
+	}
+
+//=============================================================================
+TInt VideoEditorUtils::FindSuffix ( 
+    const TDesC &   aName
+    )
+{
+    TInt offset = KErrNotFound;
+    TInt l = aName.Length();
+
+    while (l)
+    {
+        l--;
+                
+        if ( l <= (aName.Length() - 3) && aName[l] == TChar('-') )
+        {
+            offset = l;
+            break;    
+        }
+        else if ( aName[l] < 0x30 || aName[l] > 0x39 )
+        {
+            break;                
+        }
+        
+    }
+
+    return offset;
+}
+
+//=============================================================================
+TBool VideoEditorUtils::FileAlreadyExistsL ( RFs& aFsSession, const TDesC& aFileName )
+{
+	LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::FileAlreadyExistsL: %S", &aFileName);
+
+    TBool fileExists = BaflUtils::FileExists( aFsSession, aFileName );
+
+	LOGFMT(KVideoEditorLogFile, "VideoEditorUtils::FileAlreadyExistsL: Out: %d", fileExists);
+    return fileExists;
+}
+
+//=============================================================================
+EXPORT_C void VideoEditorUtils::GetMGAlbumsListForMediaFileL ( 
+    RArray<TInt>& /*aAlbumIdList*/,
+    const TDesC& /*aFileName*/ )
+{
+    LOG(KVideoEditorLogFile, "VideoEditorUtils::GetMGAlbumsListForMediaFileL: In" );
+	LOG(KVideoEditorLogFile, "VideoEditorUtils::GetMGAlbumsListForMediaFileL: Out" );
+}
+
+
+//=============================================================================
+EXPORT_C void VideoEditorUtils::AddMediaFileToMGAlbumL( 
+    const TDesC& /*aFilename*/, 
+    TInt /*aAlbumId*/ )
+	{
+	LOG(KVideoEditorLogFile, "VideoEditorUtils::AddMediaFileToMGAlbumL: In");
+	LOG(KVideoEditorLogFile, "VideoEditorUtils::AddMediaFileToMGAlbumL: Out");
+	}
+
+//=============================================================================
+EXPORT_C TBool VideoEditorUtils::IsLandscapeScreenOrientation()
+	{
+	TRect rect;
+	AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, rect);
+	return rect.Width() > rect.Height();
+	}
+
+
+//=============================================================================
+EXPORT_C TInt VideoEditorUtils::LaunchQueryDialogL (const TDesC & aPrompt)
+{
+	CAknQueryDialog * dlg = 
+		new (ELeave) CAknQueryDialog ( const_cast<TDesC&>(aPrompt) );
+
+	return dlg->ExecuteLD (R_VIE_CONFIRMATION_QUERY);
+}
+
+
+//=============================================================================
+EXPORT_C TInt VideoEditorUtils::LaunchListQueryDialogL (
+	MDesCArray *	aTextItems,
+	const TDesC &	aPrompt
+	) 
+{
+	//	Selected text item index
+	TInt index (-1);
+
+	//	Create a new list dialog
+    CAknListQueryDialog * dlg = new (ELeave) CAknListQueryDialog (&index);
+
+	//	Prepare list query dialog
+	dlg->PrepareLC (R_VIE_LIST_QUERY);
+
+	//	Set heading
+	dlg->QueryHeading()->SetTextL (aPrompt);
+
+	//	Set text item array
+	dlg->SetItemTextArray (aTextItems);	
+
+	//	Set item ownership
+	dlg->SetOwnershipType (ELbmDoesNotOwnItemArray);
+
+	//	Execute
+	if (dlg->RunLD())
+	{
+		return index;
+	}
+	else
+	{
+		return -1;
+	}
+}
+
+//=============================================================================
+EXPORT_C TInt VideoEditorUtils::LaunchSaveVideoQueryL () 
+{
+	//	Create dialog heading and options
+    HBufC * heading = CEikonEnv::Static()->AllocReadResourceLC ( R_VIE_QUERY_HEADING_SAVE );
+    HBufC * option1 = CEikonEnv::Static()->AllocReadResourceLC ( R_VIE_QUERY_SAVE_NEW );       
+    HBufC * option2 = CEikonEnv::Static()->AllocReadResourceLC ( R_VIE_QUERY_SAVE_REPLACE ); 
+                
+	//	Query dialog texts
+	CDesCArray * options = new (ELeave) CDesCArraySeg ( 2 );
+	CleanupStack::PushL (options);
+	options->AppendL( option1->Des() );
+	options->AppendL( option2->Des() );
+
+	//	Execute query dialog
+	TInt ret = LaunchListQueryDialogL ( options, *heading );
+
+	options->Reset();
+	
+	CleanupStack::PopAndDestroy( options ); 
+	CleanupStack::PopAndDestroy( option2 );
+	CleanupStack::PopAndDestroy( option1 );
+	CleanupStack::PopAndDestroy( heading );
+		
+	return ret;
+}
+
+
+//=============================================================================
+EXPORT_C TInt VideoEditorUtils::LaunchSaveChangesQueryL () 
+{
+	//	Create dialog prompt
+    HBufC * prompt = CEikonEnv::Static()->AllocReadResourceLC ( R_VIE_QUERY_SAVE_CHANGES );
+    
+	//	Execute query dialog
+	TInt ret = LaunchQueryDialogL ( *prompt );
+
+	CleanupStack::PopAndDestroy( prompt );
+
+	return ret;
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorCommon/src/logfile.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,413 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include <hal.h>
+#include <charconv.h>
+#include <bautils.h>
+#include "logfile.h"
+#include "logfile.pan"
+
+_LIT8(KCrLf8, "\r\n");
+_LIT(KCrLf, "\r\n");
+
+static const TInt KAsciiStart = 0x20;
+static const TInt KAsciiEnd = 0x7f;
+static const TInt KHexCharLeft = '<';
+static const TInt KHexCharRight = '>';
+
+//static const TInt KNumberOfDecimalPlaces = 3;
+
+EXPORT_C CLogFile* CLogFile::NewL(const TDesC& aFileName, TBool aInitialiseLog)
+	{
+    CLogFile* self = NewLC(aFileName, aInitialiseLog);
+    CleanupStack::Pop(self);
+    return(self);
+	}
+
+
+EXPORT_C CLogFile* CLogFile::NewLC(const TDesC& aFileName, TBool aInitialiseLog)
+	{
+    CLogFile* self = new (ELeave) CLogFile();
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileName, aInitialiseLog);
+    return(self);
+	}
+
+
+CLogFile::CLogFile()
+	{
+    // No implementation required
+	}
+
+
+EXPORT_C CLogFile::~CLogFile()
+	{
+    iLogFile.Flush();
+    iLogFile.Close();
+    iSession.Close();
+	}
+
+
+void CLogFile::ConstructL(const TDesC& aFileName, TBool aInitialiseLog)
+	{
+
+#ifdef ORIGINAL_TIMESTAMP
+    TInt period;
+	User::LeaveIfError(HAL::Get(HALData::ESystemTickPeriod, period));
+
+    iLogMillisecsPerTick = period / 1000;
+
+    if (iLogMillisecsPerTick == 0)
+    	{
+        iLogMillisecsPerTick = 1;
+    	}
+#endif
+
+    User::LeaveIfError(iSession.Connect());
+
+    if (aInitialiseLog)
+    	{
+        User::LeaveIfError(iLogFile.Replace(iSession, aFileName, EFileShareAny | EFileWrite));
+    	}
+    else
+    	{
+        TInt err = iLogFile.Open(iSession, aFileName, EFileShareAny | EFileWrite);
+
+        switch (err)
+        	{
+            case KErrNone: // Opened ok, so seek to end of file
+                {
+                TInt position = 0;
+                User::LeaveIfError(iLogFile.Seek(ESeekEnd, position));
+                }
+                break;
+
+            case KErrNotFound: // File doesn't exist, so create it
+                User::LeaveIfError(iLogFile.Create(iSession, aFileName, EFileShareAny | EFileWrite));
+                break;
+
+            default: // Unexepected error
+                User::Leave(err);
+                break;
+        	}
+    	}
+	}
+
+
+EXPORT_C void CLogFile::LogTime()
+	{
+    StartWrite();
+    LogTimeInternal();
+    EndWrite();
+	}
+
+
+EXPORT_C void CLogFile::Log(const TDesC8& aText)
+	{
+    StartWrite();
+    LogTextInternal(aText);
+    EndWrite();
+	}
+
+
+EXPORT_C void CLogFile::Log(const TDesC& aText)
+	{
+    StartWrite();
+
+	TRAP_IGNORE( DoLogTextL(aText) );
+
+    EndWrite();
+	}
+
+void CLogFile::DoLogTextL(const TDesC& aText)
+	{
+    // Create character converter
+    CCnvCharacterSetConverter* characterConverter = CCnvCharacterSetConverter::NewLC();
+    CCnvCharacterSetConverter::TAvailability converterAvailability;
+    converterAvailability = characterConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierAscii, iSession);
+
+    for (TInt i = 0; i < aText.Length(); i++)
+    	{
+        if (aText.Mid(i).Find(KCrLf) == 0)
+        	{
+            LogNewline();
+            i++;
+        	}
+        else if (converterAvailability == CCnvCharacterSetConverter::EAvailable)
+        	{
+            // Convert character from unicode
+            TBuf<1> unicodeBuffer;
+            TBuf8<10> asciiBuffer;
+
+            unicodeBuffer.Append(aText[i]);
+            TInt status = characterConverter->ConvertFromUnicode(asciiBuffer, unicodeBuffer);
+
+            if (status >= 0)
+                {
+                LogTextInternal(asciiBuffer);
+                }
+            }
+        else // character converter not available
+            {
+            TBuf8<1> asciiBuffer;
+            asciiBuffer.Append(static_cast<TUint8>(aText[i]));
+            LogTextInternal(asciiBuffer);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(characterConverter);
+	}
+
+EXPORT_C void CLogFile::Log(TUint8 aByte)
+	{
+    StartWrite();
+    LogByteInternal(aByte);
+    EndWrite();        
+	}
+
+
+EXPORT_C void CLogFile::Log(TUint aNumber)
+	{
+    StartWrite();
+    LogIntInternal(aNumber);
+    EndWrite();        
+	}
+
+
+EXPORT_C void CLogFile::LogBytes(const TDesC8& aBuffer)
+	{
+    StartWrite();
+
+    for (TInt i = 0; i < aBuffer.Length(); i++)
+    	{
+        LogByteInternal(aBuffer[i]);
+    	}
+
+    EndWrite();
+	}
+
+
+void CLogFile::LogTimeInternal()
+	{
+    TBuf8<50> text;
+    
+#ifdef ORIGINAL_TIMESTAMP
+
+    TInt timeInMillisecs = User::TickCount() * iLogMillisecsPerTick;
+    TInt secs = timeInMillisecs / 1000;
+    TInt millisecs = timeInMillisecs % 1000;
+    text.Num(secs);
+    text.Append('.');
+	Write(text);
+    text.Num(millisecs);
+
+    while (text.Length() < KNumberOfDecimalPlaces)
+    	{
+        text.Insert(0, _L8("0"));
+    	}
+
+    text.Append('-');
+   	Write(text);
+
+#else
+
+    TTime time;
+    time.HomeTime();
+    TBuf<31> dateString;
+    _LIT(KDateString4,"%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B ");
+	TRAPD(err, time.FormatL(dateString,KDateString4) );
+	if (KErrNone == err)
+		{
+		text.Append(dateString);
+		}
+	else
+		{
+		text.Append( _L("### date string format error: ") );
+		text.AppendNum(err);
+		}
+	Write(text);
+
+#endif // ORIGINAL_TIMESTAMP
+	}	
+
+
+void CLogFile::LogTextInternal(const TDesC8& aText)
+	{
+	TPtrC8 tail(aText.Ptr(), aText.Length());
+
+    TInt newLinePosition = tail.Find(KCrLf8);
+	while (newLinePosition != KErrNotFound)
+		{
+		if (newLinePosition > 0)
+			{
+			Write(tail.Left(newLinePosition));
+			tail.Set(aText.Ptr() + newLinePosition, tail.Length() - newLinePosition);
+			}
+        LogNewline();
+		tail.Set(aText.Ptr() + KCrLf8.iTypeLength, tail.Length() - KCrLf8.iTypeLength);
+
+		newLinePosition = tail.Find(KCrLf8);
+		}
+
+	//	No more newlines left so print remainder
+	Write(tail);
+
+	}
+
+
+void CLogFile::LogByteInternal(TUint8 aByte)
+	{
+    if ((aByte >= KAsciiStart) && (aByte < KAsciiEnd))
+    	{
+        // Display as ASCII char
+        TBuf8<1> str;
+        str.Append(aByte);
+		Write(str);
+    	}
+    else
+    	{
+        // Display as hex number
+        TBuf8<4> str;
+        str.Append(KHexCharLeft);
+        str.AppendNum((TUint)aByte, EHex);
+        str.Append(KHexCharRight);
+		Write(str);
+    	}
+	}
+
+
+void CLogFile::LogIntInternal(TUint aNumber)
+	{
+    // Display as ASCII char
+    TBuf8<20> str;
+    str.Append(KHexCharLeft);
+    str.AppendNum(aNumber, EHex);
+    str.Append(KHexCharRight);
+	Write(str);
+	}
+
+
+EXPORT_C void CLogFile::LogNewline()
+	{
+    Write(KCrLf8);
+
+    if (iAutoTimestamp)
+    	{
+        LogTimeInternal();
+    	}
+	}
+
+
+void CLogFile::StartWrite()
+	{
+    ASSERT(iCheckNestDepth == 0);
+    iCheckNestDepth++;
+
+    if (iAutoNewline)
+    	{
+        LogNewline();
+    	}
+	}
+
+
+void CLogFile::EndWrite()
+	{
+    if (iAutoFlush)
+    	{
+        iLogFile.Flush();
+    	}
+
+    iCheckNestDepth--;
+    ASSERT(iCheckNestDepth == 0);
+	}
+
+void CLogFile::Write(const TDesC8& aText)
+    {
+
+    if (iLogFile.Write(aText) != KErrNone)
+        {
+        //  As the framework may be trapping User::Panic we need to
+        //  produce the panic at a lower level.
+        RThread().Panic(KLogFilePanic, ELogFileWriteFailed);
+        }
+    }
+
+EXPORT_C void CLogFile::SetAutoFlush(TBool aOn)
+	{
+    iAutoFlush = aOn;
+	}
+
+
+EXPORT_C void CLogFile::SetAutoTimeStamp(TBool aOn)
+	{
+    iAutoTimestamp = aOn;
+	}
+
+
+EXPORT_C void CLogFile::SetAutoNewline(TBool aOn)
+	{
+    iAutoNewline = aOn;
+	}
+
+
+EXPORT_C void CLogFile::StaticLog(const TDesC& aFileName, const TDesC8& aText)
+	{
+	// This needs to be inside a TRAP statement. Calling StaticLogL 
+	// from certain places, for example AppUi destructors, 
+	// would result in E32USER-CBase 66 panic.
+	TRAP_IGNORE( CLogFile::StaticLogL(aFileName,aText) );
+	}
+
+
+EXPORT_C void CLogFile::StaticLog(const TDesC& aFileName, const TDesC& aText)
+	{
+	// This needs to be inside a TRAP statement. Calling StaticLogL 
+	// from certain places, for example AppUi destructors, 
+	// would result in E32USER-CBase 66 panic.
+	TRAP_IGNORE( CLogFile::StaticLogL(aFileName,aText) );
+	}
+
+
+EXPORT_C void CLogFile::StaticLogL(const TDesC& aFileName, const TDesC8& aText)
+	{
+	CLogFile* logFile = NewLC(aFileName, EFalse);
+	logFile->SetAutoNewline(ETrue);
+	logFile->SetAutoTimeStamp(ETrue);
+	logFile->Log(aText);
+	CleanupStack::PopAndDestroy(logFile);
+	}
+
+
+EXPORT_C void CLogFile::StaticLogL(const TDesC& aFileName, const TDesC& aText)
+	{
+	CLogFile* logFile = NewLC(aFileName, EFalse);
+	logFile->SetAutoNewline(ETrue);
+	logFile->SetAutoTimeStamp(ETrue);
+	logFile->Log(aText);
+	CleanupStack::PopAndDestroy(logFile);
+	}
+
+void CLogFile::GetFileName(TDes& aFileName) const
+	{
+	iLogFile.FullName(aFileName);
+	}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/BWINS/VideoEditorUiComponents.DEF	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,88 @@
+EXPORTS
+	??0CExtProgressDialog@@QAE@PAPAV0@@Z @ 1 NONAME ; CExtProgressDialog::CExtProgressDialog(class CExtProgressDialog * *)
+	??1CExtProgressDialog@@UAE@XZ @ 2 NONAME ; CExtProgressDialog::~CExtProgressDialog(void)
+	??1CVeiCutterBar@@UAE@XZ @ 3 NONAME ; CVeiCutterBar::~CVeiCutterBar(void)
+	??1CVeiTextDisplay@@UAE@XZ @ 4 NONAME ; CVeiTextDisplay::~CVeiTextDisplay(void)
+	??1CVeiTimeLabelNavi@@UAE@XZ @ 5 NONAME ; CVeiTimeLabelNavi::~CVeiTimeLabelNavi(void)
+	??1CVeiVideoDisplay@@UAE@XZ @ 6 NONAME ; CVeiVideoDisplay::~CVeiVideoDisplay(void)
+	?AdjustVolumeL@CVeiVideoDisplay@@QAEXH@Z @ 7 NONAME ; void CVeiVideoDisplay::AdjustVolumeL(int)
+	?Dim@CVeiCutterBar@@UAEXH@Z @ 8 NONAME ; void CVeiCutterBar::Dim(int)
+	?EndMarkPoint@CVeiCutterBar@@QAEIXZ @ 9 NONAME ; unsigned int CVeiCutterBar::EndMarkPoint(void)
+	?EndMarkRect@CVeiCutterBar@@QAE?AVTRect@@XZ @ 10 NONAME ; class TRect CVeiCutterBar::EndMarkRect(void)
+	?GetBorderWidth@CVeiVideoDisplay@@QBEHXZ @ 11 NONAME ; int CVeiVideoDisplay::GetBorderWidth(void) const
+	?GetProgressInfoL@CExtProgressDialog@@QAEPAVCEikProgressInfo@@XZ @ 12 NONAME ; class CEikProgressInfo * CExtProgressDialog::GetProgressInfoL(void)
+	?GetScreenSize@CVeiVideoDisplay@@QBE?AVTSize@@XZ @ 13 NONAME ; class TSize CVeiVideoDisplay::GetScreenSize(void) const
+	?NewL@CVeiCutterBar@@SAPAV1@PBVCCoeControl@@H@Z @ 14 NONAME ; class CVeiCutterBar * CVeiCutterBar::NewL(class CCoeControl const *, int)
+	?NewL@CVeiErrorUI@@SAPAV1@AAVCCoeEnv@@@Z @ 15 NONAME ; class CVeiErrorUI * CVeiErrorUI::NewL(class CCoeEnv &)
+	?NewL@CVeiTextDisplay@@SAPAV1@ABVTRect@@PBVCCoeControl@@@Z @ 16 NONAME ; class CVeiTextDisplay * CVeiTextDisplay::NewL(class TRect const &, class CCoeControl const *)
+	?NewL@CVeiTimeLabelNavi@@SAPAV1@XZ @ 17 NONAME ; class CVeiTimeLabelNavi * CVeiTimeLabelNavi::NewL(void)
+	?NewL@CVeiVideoDisplay@@SAPAV1@ABVTRect@@PBVCCoeControl@@AAVMVeiVideoDisplayObserver@@@Z @ 18 NONAME ; class CVeiVideoDisplay * CVeiVideoDisplay::NewL(class TRect const &, class CCoeControl const *, class MVeiVideoDisplayObserver &)
+	?NewLC@CVeiCutterBar@@SAPAV1@PBVCCoeControl@@H@Z @ 19 NONAME ; class CVeiCutterBar * CVeiCutterBar::NewLC(class CCoeControl const *, int)
+	?NewLC@CVeiTextDisplay@@SAPAV1@ABVTRect@@PBVCCoeControl@@@Z @ 20 NONAME ; class CVeiTextDisplay * CVeiTextDisplay::NewLC(class TRect const &, class CCoeControl const *)
+	?NewLC@CVeiTimeLabelNavi@@SAPAV1@XZ @ 21 NONAME ; class CVeiTimeLabelNavi * CVeiTimeLabelNavi::NewLC(void)
+	?NewLC@CVeiVideoDisplay@@SAPAV1@ABVTRect@@PBVCCoeControl@@AAVMVeiVideoDisplayObserver@@@Z @ 22 NONAME ; class CVeiVideoDisplay * CVeiVideoDisplay::NewLC(class TRect const &, class CCoeControl const *, class MVeiVideoDisplayObserver &)
+	?OpenFileL@CVeiVideoDisplay@@QAEXABVTDesC16@@@Z @ 23 NONAME ; void CVeiVideoDisplay::OpenFileL(class TDesC16 const &)
+	?PauseL@CVeiVideoDisplay@@QAEXXZ @ 24 NONAME ; void CVeiVideoDisplay::PauseL(void)
+	?Play@CVeiVideoDisplay@@QAEXXZ @ 25 NONAME ; void CVeiVideoDisplay::Play(void)
+	?PlayHeadRect@CVeiCutterBar@@QAE?AVTRect@@XZ @ 26 NONAME ; class TRect CVeiCutterBar::PlayHeadRect(void)
+	?PlayL@CVeiVideoDisplay@@QAEXABVTDesC16@@ABVTTimeIntervalMicroSeconds@@1@Z @ 27 NONAME ; void CVeiVideoDisplay::PlayL(class TDesC16 const &, class TTimeIntervalMicroSeconds const &, class TTimeIntervalMicroSeconds const &)
+	?PlayMarkedL@CVeiVideoDisplay@@QAEXABVTTimeIntervalMicroSeconds@@0@Z @ 28 NONAME ; void CVeiVideoDisplay::PlayMarkedL(class TTimeIntervalMicroSeconds const &, class TTimeIntervalMicroSeconds const &)
+	?PositionL@CVeiVideoDisplay@@QBE?AVTTimeIntervalMicroSeconds@@XZ @ 29 NONAME ; class TTimeIntervalMicroSeconds CVeiVideoDisplay::PositionL(void) const
+	?PrepareLC@CExtProgressDialog@@UAEXH@Z @ 30 NONAME ; void CExtProgressDialog::PrepareLC(int)
+	?ProgressBarRect@CVeiCutterBar@@QAE?AVTRect@@XZ @ 31 NONAME ; class TRect CVeiCutterBar::ProgressBarRect(void)
+	?RotationL@CVeiVideoDisplay@@QBE?AW4TVideoRotation@@XZ @ 32 NONAME ; enum TVideoRotation CVeiVideoDisplay::RotationL(void) const
+	?SetAnimationResourceIdL@CExtProgressDialog@@QAEXABH@Z @ 33 NONAME ; void CExtProgressDialog::SetAnimationResourceIdL(int const &)
+	?SetArrowSize@CVeiTextDisplay@@QAEXABVTSize@@@Z @ 34 NONAME ; void CVeiTextDisplay::SetArrowSize(class TSize const &)
+	?SetBlackScreen@CVeiVideoDisplay@@QAEXH@Z @ 35 NONAME ; void CVeiVideoDisplay::SetBlackScreen(int)
+	?SetCallback@CExtProgressDialog@@QAEXPAVMExtProgressDialogCallback@@@Z @ 36 NONAME ; void CExtProgressDialog::SetCallback(class MExtProgressDialogCallback *)
+	?SetComponentRect@CVeiCutterBar@@QAEXW4TCutterBarComponent@1@VTRect@@@Z @ 37 NONAME ; void CVeiCutterBar::SetComponentRect(enum CVeiCutterBar::TCutterBarComponent, class TRect)
+	?SetComponentRect@CVeiTextDisplay@@QAEXW4TTextDisplayComponent@1@VTRect@@@Z @ 38 NONAME ; void CVeiTextDisplay::SetComponentRect(enum CVeiTextDisplay::TTextDisplayComponent, class TRect)
+	?SetCurrentPoint@CVeiCutterBar@@UAEXH@Z @ 39 NONAME ; void CVeiCutterBar::SetCurrentPoint(int)
+	?SetCutIn@CVeiTextDisplay@@QAEXABVTTimeIntervalMicroSeconds@@@Z @ 40 NONAME ; void CVeiTextDisplay::SetCutIn(class TTimeIntervalMicroSeconds const &)
+	?SetCutOut@CVeiTextDisplay@@QAEXABVTTimeIntervalMicroSeconds@@@Z @ 41 NONAME ; void CVeiTextDisplay::SetCutOut(class TTimeIntervalMicroSeconds const &)
+	?SetDuration@CVeiTextDisplay@@QAEXABVTTimeIntervalMicroSeconds@@@Z @ 42 NONAME ; void CVeiTextDisplay::SetDuration(class TTimeIntervalMicroSeconds const &)
+	?SetFinishedStatus@CVeiCutterBar@@UAEXH@Z @ 43 NONAME ; void CVeiCutterBar::SetFinishedStatus(int)
+	?SetFrameIntervalL@CVeiVideoDisplay@@QAEXH@Z @ 44 NONAME ; void CVeiVideoDisplay::SetFrameIntervalL(int)
+	?SetInPoint@CVeiCutterBar@@UAEXABVTTimeIntervalMicroSeconds@@@Z @ 45 NONAME ; void CVeiCutterBar::SetInPoint(class TTimeIntervalMicroSeconds const &)
+	?SetLabelL@CVeiTimeLabelNavi@@QAEXABVTDesC16@@@Z @ 46 NONAME ; void CVeiTimeLabelNavi::SetLabelL(class TDesC16 const &)
+	?SetLandscapeScreenOrientation@CVeiTextDisplay@@QAEXH@Z @ 47 NONAME ; void CVeiTextDisplay::SetLandscapeScreenOrientation(int)
+	?SetLayout@CVeiTextDisplay@@QAEXW4TVeiLayout@1@@Z @ 48 NONAME ; void CVeiTextDisplay::SetLayout(enum CVeiTextDisplay::TVeiLayout)
+	?SetLeftArrowVisibility@CVeiTextDisplay@@QAEXH@Z @ 49 NONAME ; void CVeiTextDisplay::SetLeftArrowVisibility(int)
+	?SetLeftArrowVisibilityL@CVeiTimeLabelNavi@@QAEXH@Z @ 50 NONAME ; void CVeiTimeLabelNavi::SetLeftArrowVisibilityL(int)
+	?SetLocation@CVeiTextDisplay@@QAEXABVTDesC16@@@Z @ 51 NONAME ; void CVeiTextDisplay::SetLocation(class TDesC16 const &)
+	?SetLowerArrowVisibility@CVeiTextDisplay@@QAEXH@Z @ 52 NONAME ; void CVeiTextDisplay::SetLowerArrowVisibility(int)
+	?SetMuteL@CVeiVideoDisplay@@QAEXH@Z @ 53 NONAME ; void CVeiVideoDisplay::SetMuteL(int)
+	?SetName@CVeiTextDisplay@@QAEXABVTDesC16@@@Z @ 54 NONAME ; void CVeiTextDisplay::SetName(class TDesC16 const &)
+	?SetOutPoint@CVeiCutterBar@@UAEXABVTTimeIntervalMicroSeconds@@@Z @ 55 NONAME ; void CVeiCutterBar::SetOutPoint(class TTimeIntervalMicroSeconds const &)
+	?SetPauseIconVisibilityL@CVeiTimeLabelNavi@@QAEXH@Z @ 56 NONAME ; void CVeiTimeLabelNavi::SetPauseIconVisibilityL(int)
+	?SetPictureL@CVeiVideoDisplay@@QAEXABVCFbsBitmap@@@Z @ 57 NONAME ; void CVeiVideoDisplay::SetPictureL(class CFbsBitmap const &)
+	?SetPlayHeadVisible@CVeiCutterBar@@UAEXH@Z @ 58 NONAME ; void CVeiCutterBar::SetPlayHeadVisible(int)
+	?SetPositionL@CVeiVideoDisplay@@QAEXABVTTimeIntervalMicroSeconds@@@Z @ 59 NONAME ; void CVeiVideoDisplay::SetPositionL(class TTimeIntervalMicroSeconds const &)
+	?SetPressedComponent@CVeiCutterBar@@QAEXW4TCutterBarPressedIcon@1@@Z @ 60 NONAME ; void CVeiCutterBar::SetPressedComponent(enum CVeiCutterBar::TCutterBarPressedIcon)
+	?SetRightArrowVisibility@CVeiTextDisplay@@QAEXH@Z @ 61 NONAME ; void CVeiTextDisplay::SetRightArrowVisibility(int)
+	?SetRightArrowVisibilityL@CVeiTimeLabelNavi@@QAEXH@Z @ 62 NONAME ; void CVeiTimeLabelNavi::SetRightArrowVisibilityL(int)
+	?SetRotationL@CVeiVideoDisplay@@QAEXW4TVideoRotation@@@Z @ 63 NONAME ; void CVeiVideoDisplay::SetRotationL(enum TVideoRotation)
+	?SetSlowMotionOn@CVeiTextDisplay@@QAEXH@Z @ 64 NONAME ; void CVeiTextDisplay::SetSlowMotionOn(int)
+	?SetSlowMotionPreset@CVeiTextDisplay@@QAEXH@Z @ 65 NONAME ; void CVeiTextDisplay::SetSlowMotionPreset(int)
+	?SetTextL@CExtProgressDialog@@QAEXABVTDesC16@@@Z @ 66 NONAME ; void CExtProgressDialog::SetTextL(class TDesC16 const &)
+	?SetTime@CVeiTextDisplay@@QAEXABVTTime@@@Z @ 67 NONAME ; void CVeiTextDisplay::SetTime(class TTime const &)
+	?SetTotalDuration@CVeiCutterBar@@UAEXABVTTimeIntervalMicroSeconds@@@Z @ 68 NONAME ; void CVeiCutterBar::SetTotalDuration(class TTimeIntervalMicroSeconds const &)
+	?SetUpperArrowVisibility@CVeiTextDisplay@@QAEXH@Z @ 69 NONAME ; void CVeiTextDisplay::SetUpperArrowVisibility(int)
+	?SetVolumeIconVisibilityL@CVeiTimeLabelNavi@@QAEXH@Z @ 70 NONAME ; void CVeiTimeLabelNavi::SetVolumeIconVisibilityL(int)
+	?ShowAnimationL@CVeiVideoDisplay@@QAEXHH@Z @ 71 NONAME ; void CVeiVideoDisplay::ShowAnimationL(int, int)
+	?ShowBlackScreen@CVeiVideoDisplay@@QAEXXZ @ 72 NONAME ; void CVeiVideoDisplay::ShowBlackScreen(void)
+	?ShowBlankScreen@CVeiVideoDisplay@@QAEXXZ @ 73 NONAME ; void CVeiVideoDisplay::ShowBlankScreen(void)
+	?ShowErrorNote@CVeiErrorUI@@SAHAAVCCoeEnv@@HH@Z @ 74 NONAME ; int CVeiErrorUI::ShowErrorNote(class CCoeEnv &, int, int)
+	?ShowGlobalErrorNote@CVeiErrorUI@@QBEHH@Z @ 75 NONAME ; int CVeiErrorUI::ShowGlobalErrorNote(int) const
+	?ShowPictureL@CVeiVideoDisplay@@QAEXABVCFbsBitmap@@0@Z @ 76 NONAME ; void CVeiVideoDisplay::ShowPictureL(class CFbsBitmap const &, class CFbsBitmap const &)
+	?ShowPictureL@CVeiVideoDisplay@@QAEXABVCFbsBitmap@@@Z @ 77 NONAME ; void CVeiVideoDisplay::ShowPictureL(class CFbsBitmap const &)
+	?SlowMotionOn@CVeiTextDisplay@@QBEHXZ @ 78 NONAME ; int CVeiTextDisplay::SlowMotionOn(void) const
+	?SlowMotionPreset@CVeiTextDisplay@@QBEHXZ @ 79 NONAME ; int CVeiTextDisplay::SlowMotionPreset(void) const
+	?StartAnimationL@CExtProgressDialog@@QAEXXZ @ 80 NONAME ; void CExtProgressDialog::StartAnimationL(void)
+	?StartMarkPoint@CVeiCutterBar@@QAEIXZ @ 81 NONAME ; unsigned int CVeiCutterBar::StartMarkPoint(void)
+	?StartMarkRect@CVeiCutterBar@@QAE?AVTRect@@XZ @ 82 NONAME ; class TRect CVeiCutterBar::StartMarkRect(void)
+	?Stop@CVeiVideoDisplay@@QAEXH@Z @ 83 NONAME ; void CVeiVideoDisplay::Stop(int)
+	?StopAnimation@CVeiVideoDisplay@@QAEXXZ @ 84 NONAME ; void CVeiVideoDisplay::StopAnimation(void)
+	?TotalLengthL@CVeiVideoDisplay@@QAE?AVTTimeIntervalMicroSeconds@@XZ @ 85 NONAME ; class TTimeIntervalMicroSeconds CVeiVideoDisplay::TotalLengthL(void)
+	?Volume@CVeiVideoDisplay@@QBEHXZ @ 86 NONAME ; int CVeiVideoDisplay::Volume(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/EABI/VideoEditorUiComponents.DEF	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,109 @@
+EXPORTS
+	_ZN11CVeiErrorUI13ShowErrorNoteER7CCoeEnvii @ 1 NONAME
+	_ZN11CVeiErrorUI4NewLER7CCoeEnv @ 2 NONAME
+	_ZN13CVeiCutterBar10SetInPointERK25TTimeIntervalMicroSeconds @ 3 NONAME
+	_ZN13CVeiCutterBar11EndMarkRectEv @ 4 NONAME
+	_ZN13CVeiCutterBar11SetOutPointERK25TTimeIntervalMicroSeconds @ 5 NONAME
+	_ZN13CVeiCutterBar12EndMarkPointEv @ 6 NONAME
+	_ZN13CVeiCutterBar12PlayHeadRectEv @ 7 NONAME
+	_ZN13CVeiCutterBar13StartMarkRectEv @ 8 NONAME
+	_ZN13CVeiCutterBar14StartMarkPointEv @ 9 NONAME
+	_ZN13CVeiCutterBar15ProgressBarRectEv @ 10 NONAME
+	_ZN13CVeiCutterBar15SetCurrentPointEi @ 11 NONAME
+	_ZN13CVeiCutterBar16SetComponentRectENS_19TCutterBarComponentE5TRect @ 12 NONAME
+	_ZN13CVeiCutterBar16SetTotalDurationERK25TTimeIntervalMicroSeconds @ 13 NONAME
+	_ZN13CVeiCutterBar17SetFinishedStatusEi @ 14 NONAME
+	_ZN13CVeiCutterBar18SetPlayHeadVisibleEi @ 15 NONAME
+	_ZN13CVeiCutterBar19SetPressedComponentENS_21TCutterBarPressedIconE @ 16 NONAME
+	_ZN13CVeiCutterBar3DimEi @ 17 NONAME
+	_ZN13CVeiCutterBar4NewLEPK11CCoeControli @ 18 NONAME
+	_ZN13CVeiCutterBar5NewLCEPK11CCoeControli @ 19 NONAME
+	_ZN13CVeiCutterBarD0Ev @ 20 NONAME
+	_ZN13CVeiCutterBarD1Ev @ 21 NONAME
+	_ZN13CVeiCutterBarD2Ev @ 22 NONAME
+	_ZN15CVeiTextDisplay11SetDurationERK25TTimeIntervalMicroSeconds @ 23 NONAME
+	_ZN15CVeiTextDisplay11SetLocationERK7TDesC16 @ 24 NONAME
+	_ZN15CVeiTextDisplay12SetArrowSizeERK5TSize @ 25 NONAME
+	_ZN15CVeiTextDisplay15SetSlowMotionOnEi @ 26 NONAME
+	_ZN15CVeiTextDisplay16SetComponentRectENS_21TTextDisplayComponentE5TRect @ 27 NONAME
+	_ZN15CVeiTextDisplay19SetSlowMotionPresetEi @ 28 NONAME
+	_ZN15CVeiTextDisplay22SetLeftArrowVisibilityEi @ 29 NONAME
+	_ZN15CVeiTextDisplay23SetLowerArrowVisibilityEi @ 30 NONAME
+	_ZN15CVeiTextDisplay23SetRightArrowVisibilityEi @ 31 NONAME
+	_ZN15CVeiTextDisplay23SetUpperArrowVisibilityEi @ 32 NONAME
+	_ZN15CVeiTextDisplay29SetLandscapeScreenOrientationEi @ 33 NONAME
+	_ZN15CVeiTextDisplay4NewLERK5TRectPK11CCoeControl @ 34 NONAME
+	_ZN15CVeiTextDisplay5NewLCERK5TRectPK11CCoeControl @ 35 NONAME
+	_ZN15CVeiTextDisplay7SetNameERK7TDesC16 @ 36 NONAME
+	_ZN15CVeiTextDisplay7SetTimeERK5TTime @ 37 NONAME
+	_ZN15CVeiTextDisplay8SetCutInERK25TTimeIntervalMicroSeconds @ 38 NONAME
+	_ZN15CVeiTextDisplay9SetCutOutERK25TTimeIntervalMicroSeconds @ 39 NONAME
+	_ZN15CVeiTextDisplay9SetLayoutENS_10TVeiLayoutE @ 40 NONAME
+	_ZN15CVeiTextDisplayD0Ev @ 41 NONAME
+	_ZN15CVeiTextDisplayD1Ev @ 42 NONAME
+	_ZN15CVeiTextDisplayD2Ev @ 43 NONAME
+	_ZN16CVeiVideoDisplay11PlayMarkedLERK25TTimeIntervalMicroSecondsS2_ @ 44 NONAME
+	_ZN16CVeiVideoDisplay11SetPictureLERK10CFbsBitmap @ 45 NONAME
+	_ZN16CVeiVideoDisplay12SetPositionLERK25TTimeIntervalMicroSeconds @ 46 NONAME
+	_ZN16CVeiVideoDisplay12SetRotationLE14TVideoRotation @ 47 NONAME
+	_ZN16CVeiVideoDisplay12ShowPictureLERK10CFbsBitmap @ 48 NONAME
+	_ZN16CVeiVideoDisplay12ShowPictureLERK10CFbsBitmapS2_ @ 49 NONAME
+	_ZN16CVeiVideoDisplay12TotalLengthLEv @ 50 NONAME
+	_ZN16CVeiVideoDisplay13AdjustVolumeLEi @ 51 NONAME
+	_ZN16CVeiVideoDisplay13StopAnimationEv @ 52 NONAME
+	_ZN16CVeiVideoDisplay14SetBlackScreenEi @ 53 NONAME
+	_ZN16CVeiVideoDisplay14ShowAnimationLEii @ 54 NONAME
+	_ZN16CVeiVideoDisplay15ShowBlackScreenEv @ 55 NONAME
+	_ZN16CVeiVideoDisplay15ShowBlankScreenEv @ 56 NONAME
+	_ZN16CVeiVideoDisplay17SetFrameIntervalLEi @ 57 NONAME
+	_ZN16CVeiVideoDisplay4NewLERK5TRectPK11CCoeControlR24MVeiVideoDisplayObserver @ 58 NONAME
+	_ZN16CVeiVideoDisplay4PlayEv @ 59 NONAME
+	_ZN16CVeiVideoDisplay4StopEi @ 60 NONAME
+	_ZN16CVeiVideoDisplay5NewLCERK5TRectPK11CCoeControlR24MVeiVideoDisplayObserver @ 61 NONAME
+	_ZN16CVeiVideoDisplay5PlayLERK7TDesC16RK25TTimeIntervalMicroSecondsS5_ @ 62 NONAME
+	_ZN16CVeiVideoDisplay6PauseLEv @ 63 NONAME
+	_ZN16CVeiVideoDisplay8SetMuteLEi @ 64 NONAME
+	_ZN16CVeiVideoDisplay9OpenFileLERK7TDesC16 @ 65 NONAME
+	_ZN16CVeiVideoDisplayD0Ev @ 66 NONAME
+	_ZN16CVeiVideoDisplayD1Ev @ 67 NONAME
+	_ZN16CVeiVideoDisplayD2Ev @ 68 NONAME
+	_ZN17CVeiTimeLabelNavi23SetLeftArrowVisibilityLEi @ 69 NONAME
+	_ZN17CVeiTimeLabelNavi23SetPauseIconVisibilityLEi @ 70 NONAME
+	_ZN17CVeiTimeLabelNavi24SetRightArrowVisibilityLEi @ 71 NONAME
+	_ZN17CVeiTimeLabelNavi24SetVolumeIconVisibilityLEi @ 72 NONAME
+	_ZN17CVeiTimeLabelNavi4NewLEv @ 73 NONAME
+	_ZN17CVeiTimeLabelNavi5NewLCEv @ 74 NONAME
+	_ZN17CVeiTimeLabelNavi9SetLabelLERK7TDesC16 @ 75 NONAME
+	_ZN17CVeiTimeLabelNaviD0Ev @ 76 NONAME
+	_ZN17CVeiTimeLabelNaviD1Ev @ 77 NONAME
+	_ZN17CVeiTimeLabelNaviD2Ev @ 78 NONAME
+	_ZN18CExtProgressDialog11SetCallbackEP26MExtProgressDialogCallback @ 79 NONAME
+	_ZN18CExtProgressDialog15StartAnimationLEv @ 80 NONAME
+	_ZN18CExtProgressDialog16GetProgressInfoLEv @ 81 NONAME
+	_ZN18CExtProgressDialog23SetAnimationResourceIdLERKi @ 82 NONAME
+	_ZN18CExtProgressDialog8SetTextLERK7TDesC16 @ 83 NONAME
+	_ZN18CExtProgressDialog9PrepareLCEi @ 84 NONAME
+	_ZN18CExtProgressDialogC1EPPS_ @ 85 NONAME
+	_ZN18CExtProgressDialogC2EPPS_ @ 86 NONAME
+	_ZN18CExtProgressDialogD0Ev @ 87 NONAME
+	_ZN18CExtProgressDialogD1Ev @ 88 NONAME
+	_ZN18CExtProgressDialogD2Ev @ 89 NONAME
+	_ZNK11CVeiErrorUI19ShowGlobalErrorNoteEi @ 90 NONAME
+	_ZNK15CVeiTextDisplay12SlowMotionOnEv @ 91 NONAME
+	_ZNK15CVeiTextDisplay16SlowMotionPresetEv @ 92 NONAME
+	_ZNK16CVeiVideoDisplay13GetScreenSizeEv @ 93 NONAME
+	_ZNK16CVeiVideoDisplay14GetBorderWidthEv @ 94 NONAME
+	_ZNK16CVeiVideoDisplay6VolumeEv @ 95 NONAME
+	_ZNK16CVeiVideoDisplay9PositionLEv @ 96 NONAME
+	_ZNK16CVeiVideoDisplay9RotationLEv @ 97 NONAME
+	_ZTI13CVeiCutterBar @ 98 NONAME ; #<TI>#
+	_ZTI15CVeiTextDisplay @ 99 NONAME ; #<TI>#
+	_ZTI16CVeiVideoDisplay @ 100 NONAME ; #<TI>#
+	_ZTI17CVeiTimeLabelNavi @ 101 NONAME ; #<TI>#
+	_ZTI18CExtProgressDialog @ 102 NONAME ; #<TI>#
+	_ZTV13CVeiCutterBar @ 103 NONAME ; #<VT>#
+	_ZTV15CVeiTextDisplay @ 104 NONAME ; #<VT>#
+	_ZTV16CVeiVideoDisplay @ 105 NONAME ; #<VT>#
+	_ZTV17CVeiTimeLabelNavi @ 106 NONAME ; #<VT>#
+	_ZTV18CExtProgressDialog @ 107 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/VideoEditorUiComponents.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,662 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+NAME	VEUI
+
+// INCLUDES
+#include <Eikon.rh>
+#include <avkon.loc>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <AvkonIcons.hrh>
+#include <data_caging_paths_strings.hrh>
+#include <VideoeditorUiComponents.mbg>
+#include <SimpleVideoEditor.loc>
+#include "videoeditorcommon.hrh"
+
+#if defined(__WINS__)
+#define vei_scalable_bitmap_file "\\epoc32\\release\\"$(PLATFORM)"\\"$(CFG)"\\Z\\"APP_BITMAP_DIR"\\VideoEditorUiComponents.mif"
+// Removed because bitmaps are used by manual video editor only
+//#define vei_bitmap_file "\\epoc32\\release\\"$(PLATFORM)"\\"$(CFG)"\\Z\\"APP_BITMAP_DIR"\\VideoEditorBitmaps.mbm"
+#else
+#define vei_scalable_bitmap_file ""APP_BITMAP_DIR"\\VideoEditorUiComponents.mif"
+// Removed because bitmaps are used by manual video editor only
+//#define vei_bitmap_file ""APP_BITMAP_DIR"\\VideoEditorBitmaps.mbm"
+#endif
+
+
+RESOURCE RSS_SIGNATURE { }
+
+// TEXT RESOURCES
+
+RESOURCE TBUF64	 r_vei_cut_video_in									{ buf = qtn_vie_start_mark; } 
+RESOURCE TBUF64	 r_vei_cut_video_out								{ buf = qtn_vie_end_mark; } 
+RESOURCE TBUF64	 r_vei_edit_video_duration							{ buf = qtn_ved_edit_video_duration; }
+RESOURCE TBUF    r_vei_default_error_note							{ buf= qtn_err_eikon_general; }
+
+RESOURCE TBUF64  r_vei_navi_pane_mms								{ buf = qtn_vei_navi_pane_mms; }
+RESOURCE TBUF32	 r_vei_size_kb										{ buf = qtn_size_kb; }
+RESOURCE TBUF32	 r_vei_size_mb										{ buf = " %U MB"; } // change this to a logical string when Manual Video Editor is localised
+RESOURCE TBUF32	 r_vei_size_gb										{ buf = qtn_size_gb; }
+
+
+
+
+// ============================== ANIMATIONS ==================================
+
+RESOURCE BMPANIM_DATA r_vei_slow_motion_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_scalable_bitmap_file;
+	frames = r_vei_slow_motion_animation_array;
+	}
+
+
+RESOURCE ARRAY r_vei_slow_motion_animation_array
+	{	
+	items =
+   		{
+   		// Old own icons that are not compiled anymore. New graphics need to be
+   		// requested from graphics team if needed in the future.
+   		/*
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion1;
+			maskid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion1_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion2;
+			maskid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion2_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion3;
+			maskid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion3_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion4;
+			maskid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion2_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion5;
+			maskid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion5_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion6;
+			maskid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion6_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion7;
+			maskid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion7_mask;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion8;
+			maskid = EMbmVideoeditoruicomponentsQgn_graf_ve_trans_slowmotion8_mask;
+			}
+		*/	
+		};
+	}
+
+RESOURCE BMPANIM_DATA r_ved_adding_text_note_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_ved_adding_text_note_animation_array;
+	}
+	
+
+RESOURCE ARRAY r_ved_adding_text_note_animation_array
+	{	
+	items =
+		{
+		// Old own icons that are not compiled anymore. New graphics need to be
+   		// requested from graphics team if needed in the future.
+        /*  
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00000;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00000;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00001;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00001;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00002;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00002;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00003;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00003;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00004;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00004;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00005;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00005;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00006;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00006;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00007;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00007;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00008;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00008;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00009;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00009;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00010;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00010;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00011;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00011;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00012;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00012;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00013;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00013;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00014;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00014;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00015;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00015;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00016;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00016;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00017;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00017;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00018;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00018;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00019;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00019;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00020;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00020;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00021;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00021;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00022;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00022;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsAdding_text_00023;
+			maskid = EMbmVideoeditorbitmapsAdding_text_mask_soft_00023;
+			}
+		*/	
+		};
+	}
+
+
+RESOURCE BMPANIM_DATA r_ved_cutting_note_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_ved_cutting_note_animation_array;
+	}
+
+RESOURCE ARRAY r_ved_cutting_note_animation_array
+	{	
+	items =
+		{
+   		// Old own icons that are not compiled anymore. New graphics need to be
+   		// requested from graphics team if needed in the future.
+		/*
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsCutting_00000;
+			maskid = EMbmVideoeditorbitmapsCutting_mask_soft_00000;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsCutting_00001;
+			maskid = EMbmVideoeditorbitmapsCutting_mask_soft_00001;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsCutting_00002;
+			maskid = EMbmVideoeditorbitmapsCutting_mask_soft_00002;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsCutting_00003;
+			maskid = EMbmVideoeditorbitmapsCutting_mask_soft_00003;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsCutting_00004;
+			maskid = EMbmVideoeditorbitmapsCutting_mask_soft_00004;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsCutting_00005;
+			maskid = EMbmVideoeditorbitmapsCutting_mask_soft_00005;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsCutting_00006;
+			maskid = EMbmVideoeditorbitmapsCutting_mask_soft_00006;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsCutting_00007;
+			maskid = EMbmVideoeditorbitmapsCutting_mask_soft_00007;
+			}
+			*/
+		};
+	}
+
+RESOURCE BMPANIM_DATA r_ved_merging_note_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_ved_merging_note_animation_array;
+	}
+
+
+RESOURCE ARRAY r_ved_merging_note_animation_array
+	{	
+	items =
+		{
+		// Old own icons that are not compiled anymore. New graphics need to be
+   		// requested from graphics team if needed in the future.
+        /*
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00000;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00000_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00001;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00001_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00002;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00002_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00003;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00003_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00004;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00004_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00005;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00005_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00006;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00006_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00007;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00007_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00008;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00008_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00009;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00009_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00010;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00010_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00011;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00011_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00012;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00012_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00013;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00013_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00014;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00014_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00015;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00015_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00016;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00016_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00017;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00017_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00018;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00018_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00019;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00019_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00020;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00020_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00021;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00021_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00022;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00022_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00023;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00023_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00024;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00024_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00025;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00025_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00026;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00026_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00027;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00027_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00028;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00028_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00029;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00029_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00030;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00030_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00031;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00031_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00032;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00032_1;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_00033;
+			maskid = EMbmVideoeditorbitmapsMerging_mask_soft_00033_1;
+			}
+			*/
+		};
+		
+	}
+
+	
+RESOURCE BMPANIM_DATA r_ved_merging_audio_note_animation
+	{
+	frameinterval = 100;
+	playmode = EAknBitmapAnimationPlayModeCycle;
+	flash = 0;
+	bmpfile = vei_bitmap_file;
+	frames = r_ved_merging_audio_note_animation_array;
+	}
+
+
+RESOURCE ARRAY r_ved_merging_audio_note_animation_array
+	{	
+	items =
+		{
+		// Old own icons that are not compiled anymore. New graphics need to be
+   		// requested from graphics team if needed in the future.
+        /*
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00000;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00000;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00001;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00001;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00002;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00002;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00003;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00003;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00004;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00004;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00005;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00005;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00006;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00006;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00007;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00007;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00008;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00008;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00009;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00009;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00010;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00010;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00011;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00011;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00012;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00012;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00013;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00013;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00014;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00014;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00015;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00015;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00016;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00016;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00017;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00017;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00018;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00018;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00019;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00019;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00020;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00020;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00021;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00021;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00022;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00022;
+			},
+		BMPANIM_FRAME
+			{
+			bmpid = EMbmVideoeditorbitmapsMerging_audio_00023;
+			maskid = EMbmVideoeditorbitmapsMerging_audio_mask_soft_00023;
+			}
+		*/	
+		};
+		
+	}
+
+// End of file
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00000.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00001.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00002.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00003.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00004.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00005.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00006.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00007.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00008.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00009.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00010.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00011.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00012.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00013.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00014.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00015.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00016.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00017.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00018.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00019.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00020.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00021.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00022.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_00023.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00000.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00001.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00002.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00003.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00004.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00005.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00006.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00007.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00008.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00009.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00010.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00011.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00012.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00013.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00014.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00015.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00016.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00017.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00018.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00019.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00020.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00021.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00022.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/adding_text_mask_soft_00023.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_00000.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_00001.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_00002.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_00003.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_00004.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_00005.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_00006.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_00007.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00000.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00001.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00002.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00003.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00004.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00005.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00006.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/cutting_mask_soft_00007.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00000.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00001.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00002.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00003.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00004.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00005.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00006.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00007.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00008.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00009.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00010.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00011.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00012.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00013.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00014.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00015.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00016.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00017.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00018.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00019.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00020.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00021.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00022.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00023.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00024.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00025.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00026.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00027.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00028.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00029.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00030.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00031.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00032.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_00033.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00000.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00001.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00002.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00003.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00004.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00005.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00006.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00007.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00008.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00009.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00010.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00011.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00012.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00013.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00014.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00015.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00016.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00017.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00018.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00019.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00020.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00021.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00022.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_00023.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00000.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00001.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00002.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00003.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00004.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00005.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00006.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00007.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00008.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00009.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00010.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00011.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00012.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00013.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00014.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00015.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00016.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00017.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00018.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00019.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00020.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00021.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00022.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_audio_mask_soft_00023.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00000_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00001_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00002_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00003_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00004_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00005_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00006_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00007_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00008_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00009_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00010_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00011_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00012_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00013_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00014_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00015_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00016_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00017_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00018_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00019_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00020_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00021_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00022_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00023_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00024_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00025_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00026_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00027_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00028_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00029_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00030_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00031_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00032_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/merging_mask_soft_00033_1.bmp has changed
Binary file videditor/VideoEditorUiComponents/data/bitmap/mix_audio_background.bmp has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_hslider.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="189" height="10"
+	 viewBox="1.999 -20.226 189 10" overflow="visible" enable-background="new 1.999 -20.226 189 10" xml:space="preserve">
+<g>
+	
+		<radialGradient id="XMLID_2_" cx="-333.3989" cy="505.1084" r="179.8347" gradientTransform="matrix(1.331581e-07 -1 1 1.331581e-07 -316.2763 -343.7261)" gradientUnits="userSpaceOnUse">
+		<stop  offset="0.0056" style="stop-color:#FA0404"/>
+		<stop  offset="0.5337" style="stop-color:#FBF814"/>
+		<stop  offset="1" style="stop-color:#01FE01"/>
+	</radialGradient>
+	<rect x="2.998" y="-20.226" fill="url(#XMLID_2_)" width="188" height="10"/>
+	<polygon points="1.999,-20.226 2.999,-20.226 2.999,-11.226 190.999,-11.226 190.999,-10.226 1.999,-10.226 	"/>
+	<polygon fill="#808080" points="2.999,-20.226 2.999,-11.226 189.999,-11.226 189.999,-12.226 3.999,-12.226 3.999,-20.226 	"/>
+	<polygon fill="#C7C7C7" points="190.999,-11.226 190.999,-20.226 3.999,-20.226 3.999,-19.226 189.999,-19.226 189.999,-11.226 	
+		"/>
+	<rect x="22.999" y="-18.226" fill="#E5E5E5" width="2" height="5"/>
+	<rect x="40.999" y="-18.226" fill="#E5E5E5" width="2" height="5"/>
+	<rect x="94.999" y="-18.226" fill="#E5E5E5" width="2" height="5"/>
+	<rect x="76.999" y="-18.226" fill="#E5E5E5" width="2" height="5"/>
+	<rect x="58.999" y="-18.226" fill="#E5E5E5" width="2" height="5"/>
+	<rect x="112.999" y="-18.226" fill="#E5E5E5" width="2" height="5"/>
+	<rect x="166.999" y="-18.226" fill="#E5E5E5" width="2" height="5"/>
+	<rect x="148.999" y="-18.226" fill="#E5E5E5" width="2" height="5"/>
+	<rect x="130.999" y="-18.226" fill="#E5E5E5" width="2" height="5"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_hslider_v1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.0"
+   width="189"
+   height="10"
+   viewBox="0 0 10 189"
+   id="svg1479"
+   xml:space="preserve"
+   sodipodi:version="0.32"
+   inkscape:version="0.43"
+   sodipodi:docname="qgn_graf_ied_hslider_v1.svg"
+   sodipodi:docbase="X:\Video_Editor_Gundam\Implementation\VideoEditorUiComponents\data\svg"><metadata
+   id="metadata1701"><rdf:RDF><cc:Work
+       rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+         rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
+   inkscape:window-height="968"
+   inkscape:window-width="1280"
+   inkscape:pageshadow="2"
+   inkscape:pageopacity="0.0"
+   borderopacity="1.0"
+   bordercolor="#666666"
+   pagecolor="#ffffff"
+   id="base"
+   inkscape:zoom="6.2910053"
+   inkscape:cx="94.5"
+   inkscape:cy="5"
+   inkscape:window-x="-4"
+   inkscape:window-y="-4"
+   inkscape:current-layer="svg1479" /><defs
+   id="defs1520">
+			
+		
+				<radialGradient
+   cx="0.1025"
+   cy="3.1621001"
+   r="179.82249"
+   fx="0.1025"
+   fy="3.1621001"
+   id="XMLID_2_"
+   gradientUnits="userSpaceOnUse"
+   gradientTransform="matrix(18.9,0,0,18.9,-2.131628e-14,-1781.05)">
+					<stop
+   style="stop-color:#fa0404;stop-opacity:1"
+   offset="0.0056"
+   id="stop1487" />
+					<stop
+   style="stop-color:#fbf814;stop-opacity:1"
+   offset="0.53369999"
+   id="stop1489" />
+					<stop
+   style="stop-color:#01fe01;stop-opacity:1"
+   offset="1"
+   id="stop1491" />
+					<a:midPointStop
+   style="stop-color:#FA0404"
+   offset="0.0056" />
+					<a:midPointStop
+   style="stop-color:#FA0404"
+   offset="0.5" />
+					<a:midPointStop
+   style="stop-color:#FBF814"
+   offset="0.5337" />
+					<a:midPointStop
+   style="stop-color:#FBF814"
+   offset="0.5" />
+					<a:midPointStop
+   style="stop-color:#01FE01"
+   offset="1" />
+				</radialGradient>
+				 
+				
+				
+				
+				 
+				 
+				 
+				 
+				 
+				 
+				 
+				 
+				 
+			<radialGradient
+   inkscape:collect="always"
+   xlink:href="#XMLID_2_"
+   id="radialGradient2013"
+   gradientUnits="userSpaceOnUse"
+   gradientTransform="matrix(18.9,0,0,18.9,-4.263256e-14,-1809.95)"
+   cx="0.1025"
+   cy="3.1621001"
+   fx="0.1025"
+   fy="3.1621001"
+   r="179.82249" /></defs>
+	
+		<g
+   id="g2015"><rect
+     transform="matrix(0,1,-1,0,0,0)"
+     id="rect1493"
+     style="fill:url(#radialGradient2013)"
+     y="-1791.0499"
+     x="-4.2632564e-014"
+     height="3553.2"
+     width="189" /><polygon
+     transform="matrix(0,18.9,18.9,0,-1781.05,-2.131628e-14)"
+     id="polygon1495"
+     points="10,0 10,1 1,1 1,189 0,189 0,0 10,0 " /><polygon
+     transform="matrix(0,18.9,18.9,0,-1781.05,-2.131628e-14)"
+     id="polygon1497"
+     style="fill:#808080"
+     points="10,1 1,1 1,188 2,188 2,2 10,2 10,1 " /><polygon
+     transform="matrix(0,18.9,18.9,0,-1781.05,-2.131628e-14)"
+     id="polygon1499"
+     style="fill:#c7c7c7"
+     points="1,189 10,189 10,2 9,2 9,188 1,188 1,189 " /><rect
+     transform="matrix(0,1,1,0,0,0)"
+     id="rect1501"
+     style="fill:#e5e5e5"
+     y="-1384.15"
+     x="56.700001"
+     height="37.799999"
+     width="94.5" /><rect
+     transform="matrix(0,1,1,0,0,0)"
+     id="rect1503"
+     style="fill:#e5e5e5"
+     y="-1043.95"
+     x="56.700001"
+     height="37.799999"
+     width="94.5" /><rect
+     transform="matrix(0,1,1,0,0,0)"
+     id="rect1505"
+     style="fill:#e5e5e5"
+     y="-23.35"
+     x="56.700001"
+     height="37.799999"
+     width="94.5" /><rect
+     transform="matrix(0,1,1,0,0,0)"
+     id="rect1507"
+     style="fill:#e5e5e5"
+     y="-363.54999"
+     x="56.700001"
+     height="37.799999"
+     width="94.5" /><rect
+     transform="matrix(0,1,1,0,0,0)"
+     id="rect1509"
+     style="fill:#e5e5e5"
+     y="-703.75"
+     x="56.700001"
+     height="37.799999"
+     width="94.5" /><rect
+     transform="matrix(0,1,1,0,0,0)"
+     id="rect1511"
+     style="fill:#e5e5e5"
+     y="316.85001"
+     x="56.700001"
+     height="37.799999"
+     width="94.5" /><rect
+     transform="matrix(0,1,1,0,0,0)"
+     id="rect1513"
+     style="fill:#e5e5e5"
+     y="1337.45"
+     x="56.700001"
+     height="37.799999"
+     width="94.5" /><rect
+     transform="matrix(0,1,1,0,0,0)"
+     id="rect1515"
+     style="fill:#e5e5e5"
+     y="997.25"
+     x="56.700001"
+     height="37.799999"
+     width="94.5" /><rect
+     transform="matrix(0,1,1,0,0,0)"
+     id="rect1517"
+     style="fill:#e5e5e5"
+     y="657.04999"
+     x="56.700001"
+     height="37.799999"
+     width="94.5" /></g>
+	</svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_hslider_v2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,387 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<svg:svg
+   xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/"
+   xmlns:xap="http://ns.adobe.com/xap/1.0/"
+   xmlns:ns0="http://ns.adobe.com/SaveForWeb/1.0/"
+   xmlns:ns="http://ns.adobe.com/Variables/1.0/"
+   xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/"
+   xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+   xmlns:x="adobe:ns:meta/"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   i:viewOrigin="425 384"
+   i:rulerOrigin="0 0"
+   i:pageBounds="0 595.2754 841.8896 0"
+   width="189"
+   height="10"
+   viewBox="0 0 10 189"
+   overflow="visible"
+   enable-background="new 0 0 10 189"
+   xml:space="preserve"
+   id="svg1805"
+   sodipodi:version="0.32"
+   inkscape:version="0.43"
+   sodipodi:docname="qgn_graf_ied_vslider_v2.svg"
+   sodipodi:docbase="X:\Video_Editor_Gundam\Implementation\VideoEditorUiComponents\data\svg"
+   version="1.0"><svg:defs
+   id="defs1846" /><sodipodi:namedview
+   inkscape:window-height="540"
+   inkscape:window-width="957"
+   inkscape:pageshadow="2"
+   inkscape:pageopacity="0.0"
+   borderopacity="1.0"
+   bordercolor="#666666"
+   pagecolor="#ffffff"
+   id="base"
+   inkscape:zoom="3.9470899"
+   inkscape:cx="94.890728"
+   inkscape:cy="23.569035"
+   inkscape:window-x="25"
+   inkscape:window-y="415"
+   inkscape:current-layer="svg1805" />
+	<svg:metadata
+   id="metadata1807">
+		<ns:variableSets>
+			<ns:variableSet
+   varSetName="binding1"
+   locked="none">
+				<ns:variables />
+				<ns:sampleDataSets>
+					</ns:sampleDataSets>
+			</ns:variableSet>
+		</ns:variableSets>
+		<ns0:sfw>
+			<ns0:slices />
+			<ns0:sliceSourceBounds
+   y="195"
+   x="425"
+   width="10"
+   height="189"
+   bottomLeftOrigin="true" />
+		</ns0:sfw>
+		<x:xmpmeta
+   x:xmptk="XMP toolkit 3.0-29, framework 1.6">
+			
+		<svg:metadata
+   id="metadata1848"><rdf:RDF>
+				<rdf:Description
+   rdf:about="" />
+				<rdf:Description
+   rdf:about="" />
+				<rdf:Description
+   rdf:about="">
+					<xap:CreateDate>2005-12-20T11:58:47Z</xap:CreateDate>
+					<xap:ModifyDate>2005-12-20T11:59:00Z</xap:ModifyDate>
+					<xap:CreatorTool>Illustrator</xap:CreatorTool>
+					<xap:Thumbnails>
+						<rdf:Alt>
+							<rdf:li
+   rdf:parseType="Resource">
+								<xapGImg:format>JPEG</xapGImg:format>
+								<xapGImg:width>16</xapGImg:width>
+								<xapGImg:height>256</xapGImg:height>
+								<xapGImg:image>/9j/4AAQSkZJRgABAgEBLAEsAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABABLAAAAAEA
+AQEsAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AivlLyn5YuPLGlTz6VaSz
+SWsLySPDGzMzRgkkkEkk5utDoceXHxSu7eN7b7bz6bPwQqqvf3nzerfkv5Q8tWvmuPUbTTre3vLa
+qxTQxIjASwyqwqoHUDKu0NJDEBw9b/Q5fYHamXVmXiV6a5eYl+p595LP/OpaP/zBwf8AJtcz+zD+
+6+LzvtR/jX+b+kvWPyg/47cnzX/k1NmP2ufp+P6HY+yHPJ74/dN5N5MP/OpaP/zBwf8AJtcs7OP7
+v4uv9p/8a/zf0l6x+T5/3NyfNf8Ak1NlHap+n4/odh7I88nvj903nv5W6Faar5T0/wCsalBp/o2d
+rx9cgc+Ue/GrL9nj+OQ02YwxiomW/T4Mu19Djz6qXHkjiqI+rrvLzHJ6n+XelW+meZzbwX0V+jIk
+hmhIKglJxxNC2/w1yrW5TOIJHDz/AEOZ2BpYYMk4xnHIPQbj/wAlNuZeJeTj/wA6po//ADBwf8m1
+zI0J9Dovab/Gv839Jetfk4f9zcvzX/k1NlXaB5fH9DsPZLnk98fum8k8n/8AKKaP/wAwcH/JtcOk
+PocD2l/xr/N/SXrX5N/8duX5r/yamyvWnl8f0Ow9k+eT3x+6bz38rvLF3rnlXT/q9xBB9Xs7Xl67
+Mtece3Git/LvkMOUQjvae1uzJ6rVS4DEcMR9RrmZeR7nqf5c6FcaL5na1nmind0jlDwMWUApcLQk
+hd/hyGoyCQBH45OZ2DoZ6bJOEjEk8B9Jv+f5DueJeUD/AM6rpH/MHB/ybXJ4D6XR+0n+M/5v6S9a
+/Jk/7m5fmn/JqbIag8nYeynOfvj903kflE/86tpH/MHB/wAm1wYjs4HtJ/jP+b+kvW/yX/47cvzT
+/k1Nkcxdh7Kc5++P3Tefflb5S1LzD5WsfqUkMf1WztfU9ZnWvqR7U4q/8hyAlQZ9p9lZNXqZcBiO
+GI531Mu4Hueqflz5dvtA80tZ3jxSSyJHMDCWZeLJcL+0qGtUwSlbl9idnz0uScJkEnhO3+f5DueH
+eVP+UX0j/mDg/wCTYwAui9ov8Z+H6S9b/JT/AI7c3+sn/JqfAS7D2W5z98fum8j8qn/nV9I/5g4P
++TYyEi4HtF/jPw/SXrf5J/8AHbm/1k/5NT4guf7Lc5++P3Tec/lv5X1jXfLGn/o2NZPq1na+rydU
+pzj+H7R/yTkZRssO1tBm1GpPhi+EC9wOZPe9W/K7QdS0TzM9pqCCOZ1jlVVYMOJjuFG491OGIpze
+wdHk085xyCj6T0/p9zxPynPNF5Z0n05GStlb14kitIx4ZVlmQdnUe0H+M/D9JeufkpLLLrszSOzs
+CgqxJNPSn8cOKRN25/sxzn74/dN4/wCWP+UZ0j/mCg/5NjKNSfV8HA9oP8Z+H63rv5H/APHcn/1k
+/wCTU+S0x5uf7Mc5++P3Tebfl55Y1vXfLWn/AKMgE/1eytfWq6JTnH8P2ytfsnBnxGctu5r7W0Ob
+PqT4ceKgL3A533kPWPyp0HVNF8zSWupQiGd1jlVQyv8AAY7hQaoWHVTktPjMSQfL9Lm9g6XJgnOO
+QcJ9J6H+f3W8a8nX19a+WdK+q3EsHOyt+fpOyVpGKV4kVpXBnJEtu51fbuWcNSeEkbdPeXrf5MXV
+1c6/NJczPPIDGoeRi5AEU5pVifHJae97c72bySnKZkSfp5+6bx7yv/yjOkf8wUH/ACbGOYbut9oP
+8Z+H6S9d/JD/AI7k3+sn/JqfJYBzc/2Y5z98fum808geXtY1fyxpv6OtWufQs7b1eJUcecfw/aI6
+8Tk5xstHbGjy59SfDjxUBfzL1j8ptH1LSfMclvqEBt5nEcioxBJUx3AB+EnupxhGnN9n9NkwznHI
+OE+k/wC7eR+R9V1Ow8saX9Ru5rX1bO39T0XZOXGMUrxIrSpyw263t3UZMepPBKUbA5Ejqe56z+UG
+oX995hlmvbiS5lX00WSVy7BRHOaVYnapOAOf7N5p5JTM5GR9PMk9J97xzyp/yi+kf8wcH/JsZOnV
+e0X+M/D9Jeufkp/x25v9ZP8Ak1PgIdh7Lc5++P3TeY+QtF1XUvK+mfULWS59KztvU9MV48oxSvzo
+csiNnG7c0uXLqTwRMqiOQvqXrH5S6ZqGneYZIb63e3lbg6pIKEqY5xX7wcE3O9m8E8UpiYMT6ef+
+e8p8g6xqmm+VtM+oXUlt6tnbep6bceXGMUr8qnLMcbDgdu6rLi1J4JGNxHI11L1j8ptSv9Q8wyTX
+073EqhEV5DUhRHOafeTkcopzvZvUTyymZyMj6ef+e8c8oj/nVdI/5g4P+Ta5dhHpdT7Sf4z/AJv6
+S9a/Jj/jty/NP+TU2Qzjk7D2U5z98fum8v8AImmaje+VdK+pWs1z6dnb+p6MbSceUYpXiDStMtwk
+CO5cXt/TZMupPBGUqiOQJ6nuesflJY3tlr8kV5byW0rcGCTIyMVMc4rRgNtshqCDVfjk53szhnjl
+MTiYn08xXSbzH8t/MOsaP5V039G3HoevZ23q/Aj14R/D9tWpTkemW4MUZQ3cftntDNptUfClw8UR
+ewPIy7we96r+WGs6lq/mR7nUJvXmRUjV+KJRRHOwFECjqxyvU4xEADz/AEOb7PazLqJzlkPFIcI6
+Db19zxnyf/yimj/8wcH/ACbXMrRj0Ol9pf8AGv8AN/SXrX5N/wDHbl+a/wDJqbKtcOXx/Q7D2T55
+PfH7pvLfItjeXXlTSfq0Ek/Czt+fpoz0rGKV4g+GX6OQGPc9XD9osM56r0xMvSOQvqXq/wCUlrc2
+2vSJcRPC54MFkUqaenMK0NMq15BArz/Q5/stilCUxIGJ9PPbpN5r+WvmHV9H8p6b+jp/R9eztvV+
+BHrwj+H7Yb+Y5bpMEMmP1C6P6nH7b7Rz6bVHwpcPFEXsDyMu8F6p+Wes6jq3mRrm/l9aZFSNW4qv
+wiOdgKKAOrHKtdhjjAERXP8AQ5vs5rMuonOWQ8UhwDkBt6+6njfkwf8AOpaP/wAwcH/Jtczezh+7
++Lpfaf8Axr/N/SXrH5Pj/c3J81/5NTZR2oPp+P6HYeyPPJ74/dN5R5LH/OpaP/zBwf8AJtcyuzB+
+6+Lrvaf/ABr/ADf0l6x+UH/Hbk+a/wDJqbMftcfT8f0Ox9keeT3x+6bzXyNomrS+TdEljtZGjksr
+dkYCoIMS75b2dqMcMdSkAbavaHs/Pm1HFCEpR4envL1P8q9PvbTWz9ZhaLmRw5ClaRS1/XlHamaE
++HhN8/0Ob7MaPLhM/EiY2Y1fum//2Q==
+									</xapGImg:image>
+							</rdf:li>
+						</rdf:Alt>
+					</xap:Thumbnails>
+				</rdf:Description>
+				<rdf:Description
+   rdf:about="">
+					<dc:format>image/svg+xml</dc:format>
+				</rdf:Description>
+			<cc:Work
+   rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+     rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></svg:metadata></x:xmpmeta>
+<xpacket /><x:xmpmeta
+   x:xmptk="XMP toolkit 3.0-29, framework 1.6">
+<rdf:RDF>
+
+ <rdf:Description
+   rdf:about="">
+ </rdf:Description>
+
+ <rdf:Description
+   rdf:about="">
+ </rdf:Description>
+
+ <rdf:Description
+   rdf:about="">
+  <xap:CreateDate>2005-12-20T11:58:47Z</xap:CreateDate>
+  <xap:ModifyDate>2005-12-22T07:35:50Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li
+   rdf:parseType="Resource">
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>16</xapGImg:width>
+     <xapGImg:height>256</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA
+AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AivlLyn5YuPLGlTz6VaSz
+SWsLySPDGzMzRgkkkEkk5utDoceXHxSu7eN7b7bz6bPwQqqvf3nzerfkv5Q8tWvmuPUbTTre3vLa
+qxTQxIjASwyqwqoHUDKu0NJDEBw9b/Q5fYHamXVmXiV6a5eYl+p595LP/OpaP/zBwf8AJtcz+zD+
+6+LzvtR/jX+b+kvWPyg/47cnzX/k1NmP2ufp+P6HY+yHPJ74/dN5N5MP/OpaP/zBwf8AJtcs7OP7
+v4uv9p/8a/zf0l6x+T5/3NyfNf8Ak1NlHap+n4/odh7I88nvj903nv5W6Faar5T0/wCsalBp/o2d
+rx9cgc+Ue/GrL9nj+OQ02YwxiomW/T4Mu19Djz6qXHkjiqI+rrvLzHJ6n+XelW+meZzbwX0V+jIk
+hmhIKglJxxNC2/w1yrW5TOIJHDz/AEOZ2BpYYMk4xnHIPQbj/wAlNuZeJeTj/wA6po//ADBwf8m1
+zI0J9Dovab/Gv839Jetfk4f9zcvzX/k1NlXaB5fH9DsPZLnk98fum8k8n/8AKKaP/wAwcH/JtcOk
+PocD2l/xr/N/SXrX5N/8duX5r/yamyvWnl8f0Ow9k+eT3x+6bz38rvLF3rnlXT/q9xBB9Xs7Xl67
+Mtece3Git/LvkMOUQjvae1uzJ6rVS4DEcMR9RrmZeR7nqf5c6FcaL5na1nmind0jlDwMWUApcLQk
+hd/hyGoyCQBH45OZ2DoZ6bJOEjEk8B9Jv+f5DueJeUD/AM6rpH/MHB/ybXJ4D6XR+0n+M/5v6S9a
+/Jk/7m5fmn/JqbIag8nYeynOfvj903kflE/86tpH/MHB/wAm1wYjs4HtJ/jP+b+kvW/yX/47cvzT
+/k1Nkcxdh7Kc5++P3Tefflb5S1LzD5WsfqUkMf1WztfU9ZnWvqR7U4q/8hyAlQZ9p9lZNXqZcBiO
+GI531Mu4Hueqflz5dvtA80tZ3jxSSyJHMDCWZeLJcL+0qGtUwSlbl9idnz0uScJkEnhO3+f5DueH
+eVP+UX0j/mDg/wCTYwAui9ov8Z+H6S9b/JT/AI7c3+sn/JqfAS7D2W5z98fum8j8qn/nV9I/5g4P
++TYyEi4HtF/jPw/SXrf5J/8AHbm/1k/5NT4guf7Lc5++P3Tec/lv5X1jXfLGn/o2NZPq1na+rydU
+pzj+H7R/yTkZRssO1tBm1GpPhi+EC9wOZPe9W/K7QdS0TzM9pqCCOZ1jlVVYMOJjuFG491OGIpze
+wdHk085xyCj6T0/p9zxPynPNF5Z0n05GStlb14kitIx4ZVlmQdnUe0H+M/D9JeufkpLLLrszSOzs
+CgqxJNPSn8cOKRN25/sxzn74/dN4/wCWP+UZ0j/mCg/5NjKNSfV8HA9oP8Z+H63rv5H/APHcn/1k
+/wCTU+S0x5uf7Mc5++P3Tebfl55Y1vXfLWn/AKMgE/1eytfWq6JTnH8P2ytfsnBnxGctu5r7W0Ob
+PqT4ceKgL3A533kPWPyp0HVNF8zSWupQiGd1jlVQyv8AAY7hQaoWHVTktPjMSQfL9Lm9g6XJgnOO
+QcJ9J6H+f3W8a8nX19a+WdK+q3EsHOyt+fpOyVpGKV4kVpXBnJEtu51fbuWcNSeEkbdPeXrf5MXV
+1c6/NJczPPIDGoeRi5AEU5pVifHJae97c72bySnKZkSfp5+6bx7yv/yjOkf8wUH/ACbGOYbut9oP
+8Z+H6S9d/JD/AI7k3+sn/JqfJYBzc/2Y5z98fum808geXtY1fyxpv6OtWufQs7b1eJUcecfw/aI6
+8Tk5xstHbGjy59SfDjxUBfzL1j8ptH1LSfMclvqEBt5nEcioxBJUx3AB+EnupxhGnN9n9NkwznHI
+OE+k/wC7eR+R9V1Ow8saX9Ru5rX1bO39T0XZOXGMUrxIrSpyw263t3UZMepPBKUbA5Ejqe56z+UG
+oX995hlmvbiS5lX00WSVy7BRHOaVYnapOAOf7N5p5JTM5GR9PMk9J97xzyp/yi+kf8wcH/JsZOnV
+e0X+M/D9Jeufkp/x25v9ZP8Ak1PgIdh7Lc5++P3TeY+QtF1XUvK+mfULWS59KztvU9MV48oxSvzo
+csiNnG7c0uXLqTwRMqiOQvqXrH5S6ZqGneYZIb63e3lbg6pIKEqY5xX7wcE3O9m8E8UpiYMT6ef+
+e8p8g6xqmm+VtM+oXUlt6tnbep6bceXGMUr8qnLMcbDgdu6rLi1J4JGNxHI11L1j8ptSv9Q8wyTX
+073EqhEV5DUhRHOafeTkcopzvZvUTyymZyMj6ef+e8c8oj/nVdI/5g4P+Ta5dhHpdT7Sf4z/AJv6
+S9a/Jj/jty/NP+TU2Qzjk7D2U5z98fum8v8AImmaje+VdK+pWs1z6dnb+p6MbSceUYpXiDStMtwk
+CO5cXt/TZMupPBGUqiOQJ6nuesflJY3tlr8kV5byW0rcGCTIyMVMc4rRgNtshqCDVfjk53szhnjl
+MTiYn08xXSbzH8t/MOsaP5V039G3HoevZ23q/Aj14R/D9tWpTkemW4MUZQ3cftntDNptUfClw8UR
+ewPIy7we96r+WGs6lq/mR7nUJvXmRUjV+KJRRHOwFECjqxyvU4xEADz/AEOb7PazLqJzlkPFIcI6
+Db19zxnyf/yimj/8wcH/ACbXMrRj0Ol9pf8AGv8AN/SXrX5N/wDHbl+a/wDJqbKtcOXx/Q7D2T55
+PfH7pvLfItjeXXlTSfq0Ek/Czt+fpoz0rGKV4g+GX6OQGPc9XD9osM56r0xMvSOQvqXq/wCUlrc2
+2vSJcRPC54MFkUqaenMK0NMq15BArz/Q5/stilCUxIGJ9PPbpN5r+WvmHV9H8p6b+jp/R9eztvV+
+BHrwj+H7Yb+Y5bpMEMmP1C6P6nH7b7Rz6bVHwpcPFEXsDyMu8F6p+Wes6jq3mRrm/l9aZFSNW4qv
+wiOdgKKAOrHKtdhjjAERXP8AQ5vs5rMuonOWQ8UhwDkBt6+6njfkwf8AOpaP/wAwcH/Jtczezh+7
++Lpfaf8Axr/N/SXrH5Pj/c3J81/5NTZR2oPp+P6HYeyPPJ74/dN5R5LH/OpaP/zBwf8AJtcyuzB+
+6+Lrvaf/ABr/ADf0l6x+UH/Hbk+a/wDJqbMftcfT8f0Ox9keeT3x+6bzXyNomrS+TdEljtZGjksr
+dkYCoIMS75b2dqMcMdSkAbavaHs/Pm1HFCEpR4envL1P8q9PvbTWz9ZhaLmRw5ClaRS1/XlHamaE
++HhN8/0Ob7MaPLhM/EiY2Y1fum//2Q==</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description
+   rdf:about="">
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <xpacket />
+			</svg:metadata>
+		<svg:g
+   id="Layer_1"
+   i:layer="yes"
+   i:dimmedPercent="50"
+   i:rgbTrio="#4F008000FFFF"
+   transform="matrix(0,18.9,18.9,0,-1781.05,1.225409e-14)">
+			<svg:g
+   id="g1810">
+				<svg:linearGradient
+   id="XMLID_2_"
+   gradientUnits="userSpaceOnUse"
+   x1="5"
+   y1="189"
+   x2="5"
+   y2="1.0005">
+					<svg:stop
+   offset="0"
+   style="stop-color:#2DB6E0"
+   id="stop1813" />
+					<svg:stop
+   offset="0.5225"
+   style="stop-color:#01AD4E"
+   id="stop1815" />
+					<svg:stop
+   offset="1"
+   style="stop-color:#2DB6E0"
+   id="stop1817" />
+					<a:midPointStop
+   offset="0"
+   style="stop-color:#2DB6E0" />
+					<a:midPointStop
+   offset="0.5"
+   style="stop-color:#2DB6E0" />
+					<a:midPointStop
+   offset="0.5225"
+   style="stop-color:#01AD4E" />
+					<a:midPointStop
+   offset="0.5"
+   style="stop-color:#01AD4E" />
+					<a:midPointStop
+   offset="1"
+   style="stop-color:#2DB6E0" />
+				</svg:linearGradient>
+				<svg:rect
+   y="1"
+   i:knockout="Off"
+   width="10"
+   height="188"
+   id="rect1819"
+   x="0"
+   style="fill:url(#XMLID_2_)" /> 
+				<svg:polygon
+   i:knockout="Off"
+   points="10,0 10,1 1,1 1,189 0,189 0,0 10,0 "
+   id="polygon1821" />
+				<svg:polygon
+   i:knockout="Off"
+   points="10,1 1,1 1,188 2,188 2,2 10,2 10,1 "
+   id="polygon1823"
+   style="fill:#808080" />
+				<svg:polygon
+   i:knockout="Off"
+   points="1,189 10,189 10,2 9,2 9,188 1,188 1,189 "
+   id="polygon1825"
+   style="fill:#c7c7c7" />
+				<svg:rect
+   x="3"
+   y="21"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1827"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="39"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1829"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="93"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1831"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="75"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1833"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="57"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1835"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="111"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1837"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="165"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1839"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="147"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1841"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="129"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1843"
+   style="fill:#e5e5e5" /> 
+			</svg:g>
+		</svg:g>
+	</svg:svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_hslider_v3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,360 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<svg:svg
+   xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/"
+   xmlns:xap="http://ns.adobe.com/xap/1.0/"
+   xmlns:ns0="http://ns.adobe.com/SaveForWeb/1.0/"
+   xmlns:ns="http://ns.adobe.com/Variables/1.0/"
+   xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/"
+   xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+   xmlns:x="adobe:ns:meta/"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   i:viewOrigin="425 384"
+   i:rulerOrigin="0 0"
+   i:pageBounds="0 595.2754 841.8896 0"
+   width="189"
+   height="10"
+   viewBox="0 0 10 189"
+   overflow="visible"
+   enable-background="new 0 0 10 189"
+   xml:space="preserve"
+   id="svg1850"
+   sodipodi:version="0.32"
+   inkscape:version="0.43"
+   sodipodi:docname="qgn_graf_ied_vslider_v3.svg"
+   sodipodi:docbase="X:\Video_Editor_Gundam\Implementation\VideoEditorUiComponents\data\svg"
+   version="1.0"><svg:defs
+   id="defs1891" /><sodipodi:namedview
+   inkscape:window-height="614"
+   inkscape:window-width="1110"
+   inkscape:pageshadow="2"
+   inkscape:pageopacity="0.0"
+   borderopacity="1.0"
+   bordercolor="#666666"
+   pagecolor="#ffffff"
+   id="base"
+   inkscape:zoom="2.7910141"
+   inkscape:cx="122.72593"
+   inkscape:cy="50.730615"
+   inkscape:window-x="131"
+   inkscape:window-y="20"
+   inkscape:current-layer="svg1850" />
+	<svg:metadata
+   id="metadata1852">
+		<ns:variableSets>
+			<ns:variableSet
+   varSetName="binding1"
+   locked="none">
+				<ns:variables />
+				<ns:sampleDataSets>
+					</ns:sampleDataSets>
+			</ns:variableSet>
+		</ns:variableSets>
+		<ns0:sfw>
+			<ns0:slices />
+			<ns0:sliceSourceBounds
+   y="195"
+   x="425"
+   width="10"
+   height="189"
+   bottomLeftOrigin="true" />
+		</ns0:sfw>
+		<x:xmpmeta
+   x:xmptk="XMP toolkit 3.0-29, framework 1.6">
+			
+		<svg:metadata
+   id="metadata1893"><rdf:RDF>
+				<rdf:Description
+   rdf:about="" />
+				<rdf:Description
+   rdf:about="" />
+				<rdf:Description
+   rdf:about="">
+					<xap:CreateDate>2005-12-20T11:59:27Z</xap:CreateDate>
+					<xap:ModifyDate>2005-12-20T11:59:39Z</xap:ModifyDate>
+					<xap:CreatorTool>Illustrator</xap:CreatorTool>
+					<xap:Thumbnails>
+						<rdf:Alt>
+							<rdf:li
+   rdf:parseType="Resource">
+								<xapGImg:format>JPEG</xapGImg:format>
+								<xapGImg:width>16</xapGImg:width>
+								<xapGImg:height>256</xapGImg:height>
+								<xapGImg:image>/9j/4AAQSkZJRgABAgEBLAEsAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABABLAAAAAEA
+AQEsAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AgmgaF5fPl/SpJNJs5ZZb
+OGSSSSBGZmZASSSN8uhAENU5kF63+RHlry8nmwajBpttbXlp8MMsESRkCaGYOCVHcLgyQATCRLzP
+y+tfLejf8wNv/wAQGWYuTDJzev8A5FCmtXHzj/5NT5HMnE8k8uLXy1o3/MDb/wDEBksXJjk5vXfy
+NFNbuPnH/wAmp8jmZYmBfll5Ztdb8saf6+pw6d9XsbTj61Pj5xmvGrJ9nj+OCEqCyjZeq/lrocGj
+eaZLaG+i1BXSKQzQ04glLheOzNv8NfpwZJWGUBTxHysK+V9G/wCYKD/k2MsxcmvJzet/koKa3N80
+/wCTU2RzMsTyjymtfKujf8wUH/JsZLFyY5eb1r8lxTW5vmn/ACamyOZliYF+Vvla413ypp/o3ENv
+9XsrXl6xIrzj2pQHpxwQnQWcbL1P8u9Am0TzO1rNNHOzpHKHiJKgFJ1puBv8ODJKwmEaeLeTVr5S
+0b/mCg/5NjLMXJhl5vWPyeFNbk+a/wDJqbI5mWLq8r8lLXyjo/8AzBwf8m1yWLkxy83q/wCUQprU
+nzX/AJNy5HMnEwL8qPLF/rnlDTvqkkSfV7O15+qWFece1OKt/LjCYiEzgSXqPkLQrvRfMv1W6eN5
+HRJQYixFCk6/tBd/hyOSVhOONF435DWvk7R/+YOD/k2uWYuTXl5vVvypFNab5j/k3LkczLC8t8gL
+Xybo/wDzCQf8mlyWLkxy83qv5WimtN8x/wAm5cjmZYerz78p9Bv9W8l6Z9UCn0bS258m4/aiFP8A
+iOMJgDdZwJOz1DyLpF3pfmIQXQUSOokHE8hxKSj+GDJIEbMscSHk35bSzR+StI9KRkraQV4kitIl
+8Mni5NeU7vUvy4klfXOUjs7dKsSTT05PHI5mWEvLfy3WvkjR/wDmFg/5NLksXJjl5vUvy3FNa/z/
+AN9yZHMyw9Xnv5R6Pfaj5H0v6qgf0rW351YLTlEtOvyxhIAboyRJOz0/yXpt1p/mBIblQkjLzABB
+2KSDt8sGSQPJliiRzeV/lXPcReRtJ9GV4+VrBy4MVrSJetMniAprykgvUPIks0uuK0sjSMNgzEsa
+cJNt8jmHJnhPN5V+WTU8jaP/AMwsP/JpMni5MM3N6j+XprrS/wCf+65Mhm6MsHV5p+U+m3995I0r
+6pCZfTtbfnQgU5RLTqR4YccgBuuSJJ2eoeRrG7s9fWK6jMUhHMKSD8JSQV2J8MjlIPJliiRzeUfl
+fqN7Z+SdJ+rTvDztLfnwJFaRLSv35LHEEMchIOz1H8v726u9eElzK0zgBQzmppwlNPxwZRScRJ5v
+Ivy9ankvR/8AmEg/5NLksXJjl5vVPyxNdaPzH/JuTI5mWF5l+WWmajfeTdK+pwNP6dpb+px7cohT
+9WHHIAboyRJOz1L8urG9svMHo3cTQyMA4VuvEpKK/hkcpBZYhTyn8tdX1HT/ACdpX1O4aD1bO39T
+j34xin68ljiCN2OSRB2ep/ltqN7f+YDNdzNNIoVAzdQojmNPxyOUAMsRt475HanlDR/+YOD/AJNr
+k8XJhl5vVvykNdbf5r/yblyOZlheW+QLDULzyjpP1O1mufTs7f1PRjaTjyjFK8QaVphxkAIyAkvV
+fyrs7y0194ruCS3kPFgkqMjFTHMK0YDbbI5TbLEHl35ceYtX0fynpn6OuPQ9eytvV+BHrwj+H7at
+/McOOII3RORB2eqfljrWo6t5je4v5vWmRUjVuKpRQk5AogUdWODJEDkyxknm8W8pNTyro3/MFB/y
+bGTxcmGXm9Z/Jg11ub5p/wAmpsjmZYnlPkyyvrrytpH1W3luOFlb8/SRnpWMUrxBpWmHGdkZBu9Z
+/J21u7bXpo7mGSCQ8GCSKUJBjnFaMBttkcpTiDzD8vPNOsaF5Y039GyrF9YsbX1eSK9eEfw/aB/m
+OGEQRus5EF6t+Vev6lrfmaW61CQSTIscSsqqnwhLhgKKB3Y5HJEBOORLw/y41PLOjf8AMDb/APEB
+k8XJhk5vXfyMaut3Hzj/AOTU+DMyxPHtBanlvRv+YG3/AOIDDi5Iyc3rv5Dmut3Pzj/5NT4MycTz
+Pyz5Y1+68raJPb2MkkL2FuVcAUIKD3xxyACziSXq35LaNqmm63L9etnt/VZPT5034xTVp8qjI5JA
+ssYIf//Z
+									</xapGImg:image>
+							</rdf:li>
+						</rdf:Alt>
+					</xap:Thumbnails>
+				</rdf:Description>
+				<rdf:Description
+   rdf:about="">
+					<dc:format>image/svg+xml</dc:format>
+				</rdf:Description>
+			<cc:Work
+   rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+     rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></svg:metadata></x:xmpmeta>
+<xpacket /><x:xmpmeta
+   x:xmptk="XMP toolkit 3.0-29, framework 1.6">
+<rdf:RDF>
+
+ <rdf:Description
+   rdf:about="">
+ </rdf:Description>
+
+ <rdf:Description
+   rdf:about="">
+ </rdf:Description>
+
+ <rdf:Description
+   rdf:about="">
+  <xap:CreateDate>2005-12-20T11:59:27Z</xap:CreateDate>
+  <xap:ModifyDate>2005-12-22T07:36:04Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li
+   rdf:parseType="Resource">
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>16</xapGImg:width>
+     <xapGImg:height>256</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA
+AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AgmgaF5fPl/SpJNJs5ZZb
+OGSSSSBGZmZASSSN8uhAENU5kF63+RHlry8nmwajBpttbXlp8MMsESRkCaGYOCVHcLgyQATCRLzP
+y+tfLejf8wNv/wAQGWYuTDJzev8A5FCmtXHzj/5NT5HMnE8k8uLXy1o3/MDb/wDEBksXJjk5vXfy
+NFNbuPnH/wAmp8jmZYmBfll5Ztdb8saf6+pw6d9XsbTj61Pj5xmvGrJ9nj+OCEqCyjZeq/lrocGj
+eaZLaG+i1BXSKQzQ04glLheOzNv8NfpwZJWGUBTxHysK+V9G/wCYKD/k2MsxcmvJzet/koKa3N80
+/wCTU2RzMsTyjymtfKujf8wUH/JsZLFyY5eb1r8lxTW5vmn/ACamyOZliYF+Vvla413ypp/o3ENv
+9XsrXl6xIrzj2pQHpxwQnQWcbL1P8u9Am0TzO1rNNHOzpHKHiJKgFJ1puBv8ODJKwmEaeLeTVr5S
+0b/mCg/5NjLMXJhl5vWPyeFNbk+a/wDJqbI5mWLq8r8lLXyjo/8AzBwf8m1yWLkxy83q/wCUQprU
+nzX/AJNy5HMnEwL8qPLF/rnlDTvqkkSfV7O15+qWFece1OKt/LjCYiEzgSXqPkLQrvRfMv1W6eN5
+HRJQYixFCk6/tBd/hyOSVhOONF435DWvk7R/+YOD/k2uWYuTXl5vVvypFNab5j/k3LkczLC8t8gL
+Xybo/wDzCQf8mlyWLkxy83qv5WimtN8x/wAm5cjmZYerz78p9Bv9W8l6Z9UCn0bS258m4/aiFP8A
+iOMJgDdZwJOz1DyLpF3pfmIQXQUSOokHE8hxKSj+GDJIEbMscSHk35bSzR+StI9KRkraQV4kitIl
+8Mni5NeU7vUvy4klfXOUjs7dKsSTT05PHI5mWEvLfy3WvkjR/wDmFg/5NLksXJjl5vUvy3FNa/z/
+AN9yZHMyw9Xnv5R6Pfaj5H0v6qgf0rW351YLTlEtOvyxhIAboyRJOz0/yXpt1p/mBIblQkjLzABB
+2KSDt8sGSQPJliiRzeV/lXPcReRtJ9GV4+VrBy4MVrSJetMniAprykgvUPIks0uuK0sjSMNgzEsa
+cJNt8jmHJnhPN5V+WTU8jaP/AMwsP/JpMni5MM3N6j+XprrS/wCf+65Mhm6MsHV5p+U+m3995I0r
+6pCZfTtbfnQgU5RLTqR4YccgBuuSJJ2eoeRrG7s9fWK6jMUhHMKSD8JSQV2J8MjlIPJliiRzeUfl
+fqN7Z+SdJ+rTvDztLfnwJFaRLSv35LHEEMchIOz1H8v726u9eElzK0zgBQzmppwlNPxwZRScRJ5v
+Ivy9ankvR/8AmEg/5NLksXJjl5vVPyxNdaPzH/JuTI5mWF5l+WWmajfeTdK+pwNP6dpb+px7cohT
+9WHHIAboyRJOz1L8urG9svMHo3cTQyMA4VuvEpKK/hkcpBZYhTyn8tdX1HT/ACdpX1O4aD1bO39T
+j34xin68ljiCN2OSRB2ep/ltqN7f+YDNdzNNIoVAzdQojmNPxyOUAMsRt475HanlDR/+YOD/AJNr
+k8XJhl5vVvykNdbf5r/yblyOZlheW+QLDULzyjpP1O1mufTs7f1PRjaTjyjFK8QaVphxkAIyAkvV
+fyrs7y0194ruCS3kPFgkqMjFTHMK0YDbbI5TbLEHl35ceYtX0fynpn6OuPQ9eytvV+BHrwj+H7at
+/McOOII3RORB2eqfljrWo6t5je4v5vWmRUjVuKpRQk5AogUdWODJEDkyxknm8W8pNTyro3/MFB/y
+bGTxcmGXm9Z/Jg11ub5p/wAmpsjmZYnlPkyyvrrytpH1W3luOFlb8/SRnpWMUrxBpWmHGdkZBu9Z
+/J21u7bXpo7mGSCQ8GCSKUJBjnFaMBttkcpTiDzD8vPNOsaF5Y039GyrF9YsbX1eSK9eEfw/aB/m
+OGEQRus5EF6t+Vev6lrfmaW61CQSTIscSsqqnwhLhgKKB3Y5HJEBOORLw/y41PLOjf8AMDb/APEB
+k8XJhk5vXfyMaut3Hzj/AOTU+DMyxPHtBanlvRv+YG3/AOIDDi5Iyc3rv5Dmut3Pzj/5NT4MycTz
+Pyz5Y1+68raJPb2MkkL2FuVcAUIKD3xxyACziSXq35LaNqmm63L9etnt/VZPT5034xTVp8qjI5JA
+ssYIf//Z</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description
+   rdf:about="">
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <xpacket />
+			</svg:metadata>
+		<svg:g
+   id="Layer_1"
+   i:layer="yes"
+   i:dimmedPercent="50"
+   i:rgbTrio="#4F008000FFFF"
+   transform="matrix(0,18.9,18.9,0,-1781.05,-2.131628e-14)">
+			<svg:g
+   id="g1855">
+				<svg:radialGradient
+   id="XMLID_2_"
+   cx="0.1025"
+   cy="3.1621001"
+   r="179.82249"
+   fx="0.1025"
+   fy="3.1621001"
+   gradientUnits="userSpaceOnUse">
+					<svg:stop
+   offset="0"
+   style="stop-color:#5D6877"
+   id="stop1858" />
+					<svg:stop
+   offset="0.5337"
+   style="stop-color:#9CACBD"
+   id="stop1860" />
+					<svg:stop
+   offset="1"
+   style="stop-color:#5D6877"
+   id="stop1862" />
+					<a:midPointStop
+   offset="0"
+   style="stop-color:#5D6877" />
+					<a:midPointStop
+   offset="0.5"
+   style="stop-color:#5D6877" />
+					<a:midPointStop
+   offset="0.5337"
+   style="stop-color:#9CACBD" />
+					<a:midPointStop
+   offset="0.5"
+   style="stop-color:#9CACBD" />
+					<a:midPointStop
+   offset="1"
+   style="stop-color:#5D6877" />
+				</svg:radialGradient>
+				<svg:rect
+   y="1"
+   i:knockout="Off"
+   width="10"
+   height="188"
+   id="rect1864"
+   style="fill:url(#XMLID_2_)"
+   x="0" /> 
+				<svg:polygon
+   i:knockout="Off"
+   points="10,0 10,1 1,1 1,189 0,189 0,0 10,0 "
+   id="polygon1866" />
+				<svg:polygon
+   i:knockout="Off"
+   points="10,1 1,1 1,188 2,188 2,2 10,2 10,1 "
+   id="polygon1868"
+   style="fill:#808080" />
+				<svg:polygon
+   i:knockout="Off"
+   points="1,189 10,189 10,2 9,2 9,188 1,188 1,189 "
+   id="polygon1870"
+   style="fill:#c7c7c7" />
+				<svg:rect
+   x="3"
+   y="21"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1872"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="39"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1874"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="93"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1876"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="75"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1878"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="57"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1880"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="111"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1882"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="165"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1884"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="147"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1886"
+   style="fill:#e5e5e5" /> 
+				<svg:rect
+   x="3"
+   y="129"
+   i:knockout="Off"
+   width="5"
+   height="2"
+   id="rect1888"
+   style="fill:#e5e5e5" /> 
+			</svg:g>
+		</svg:g>
+	</svg:svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_hslider_v4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<svg:svg
+   xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/"
+   xmlns:xap="http://ns.adobe.com/xap/1.0/"
+   xmlns:ns0="http://ns.adobe.com/SaveForWeb/1.0/"
+   xmlns:ns="http://ns.adobe.com/Variables/1.0/"
+   xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/"
+   xmlns:x="adobe:ns:meta/"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   i:viewOrigin="428 383"
+   i:rulerOrigin="0 0"
+   i:pageBounds="0 595.2754 841.8896 0"
+   width="187"
+   height="3"
+   viewBox="0 0 3 187"
+   overflow="visible"
+   enable-background="new 0 0 3 187"
+   xml:space="preserve"
+   id="svg1895"
+   sodipodi:version="0.32"
+   inkscape:version="0.43"
+   sodipodi:docname="qgn_graf_ied_vslider_v4.svg"
+   sodipodi:docbase="X:\Video_Editor_Gundam\Implementation\VideoEditorUiComponents\data\svg"
+   version="1.0"><svg:defs
+   id="defs1923" /><sodipodi:namedview
+   inkscape:window-height="968"
+   inkscape:window-width="1280"
+   inkscape:pageshadow="2"
+   inkscape:pageopacity="0.0"
+   borderopacity="1.0"
+   bordercolor="#666666"
+   pagecolor="#ffffff"
+   id="base"
+   inkscape:zoom="256"
+   inkscape:cx="93.74725"
+   inkscape:cy="1.5269149"
+   inkscape:window-x="-4"
+   inkscape:window-y="-4"
+   inkscape:current-layer="svg1895" />
+	<svg:metadata
+   id="metadata1897">
+		<ns:variableSets>
+			<ns:variableSet
+   varSetName="binding1"
+   locked="none">
+				<ns:variables />
+				<ns:sampleDataSets>
+					</ns:sampleDataSets>
+			</ns:variableSet>
+		</ns:variableSets>
+		<ns0:sfw>
+			<ns0:slices />
+			<ns0:sliceSourceBounds
+   y="196"
+   x="428"
+   width="3"
+   height="187"
+   bottomLeftOrigin="true" />
+		</ns0:sfw>
+		<x:xmpmeta
+   x:xmptk="XMP toolkit 3.0-29, framework 1.6">
+			
+		<svg:metadata
+   id="metadata1925"><rdf:RDF>
+				<rdf:Description
+   rdf:about="" />
+				<rdf:Description
+   rdf:about="" />
+				<rdf:Description
+   rdf:about="">
+					<xap:CreateDate>2005-12-20T12:00:19Z</xap:CreateDate>
+					<xap:ModifyDate>2005-12-20T12:00:25Z</xap:ModifyDate>
+					<xap:CreatorTool>Illustrator</xap:CreatorTool>
+					<xap:Thumbnails>
+						<rdf:Alt>
+							<rdf:li
+   rdf:parseType="Resource">
+								<xapGImg:format>JPEG</xapGImg:format>
+								<xapGImg:width>4</xapGImg:width>
+								<xapGImg:height>256</xapGImg:height>
+								<xapGImg:image>/9j/4AAQSkZJRgABAgEBLAEsAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABABLAAAAAEA
+AQEsAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAEAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AhOZTjOxV2KsV/Rv5gf8A
+V2t/+Ra/9UshUu9nce5lWTYOxViX/IRv+Xb/AITK/Uz9LLcsYOxViP6Z8+/9WiL7/wDr5ldy7mdR
+72XZYwdirEf8V+Zv+pfl/wCH/wCaMr4j3M+Ed7LssYOxViX+P/8AtVXP+f0ZXx+TPg82W5YwdirE
+/wDlZOhf74uv+Aj/AOqmV+IGfhllmWMHYqx7/Hvlr/lof/kW/wDTIeIGXAU1/Q2j/wDLDb/8ik/p
+kqCLKMwoSj/Fnlz/AJb4/wAf6ZHiCeEqn+GvL/8A1b4P+AGHhC8RTPChAfp7Qv8Aq42v/I6P/mrB
+xBPCUD/gfyv/AMsX/JWb/mvBwBPGU9yTF2KuxV//2Q==
+									</xapGImg:image>
+							</rdf:li>
+						</rdf:Alt>
+					</xap:Thumbnails>
+				</rdf:Description>
+				<rdf:Description
+   rdf:about="">
+					<dc:format>image/svg+xml</dc:format>
+				</rdf:Description>
+			<cc:Work
+   rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+     rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></svg:metadata></x:xmpmeta>
+<xpacket /><x:xmpmeta
+   x:xmptk="XMP toolkit 3.0-29, framework 1.6">
+<rdf:RDF>
+
+ <rdf:Description
+   rdf:about="">
+ </rdf:Description>
+
+ <rdf:Description
+   rdf:about="">
+ </rdf:Description>
+
+ <rdf:Description
+   rdf:about="">
+  <xap:CreateDate>2005-12-20T12:00:19Z</xap:CreateDate>
+  <xap:ModifyDate>2005-12-22T07:36:17Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li
+   rdf:parseType="Resource">
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>4</xapGImg:width>
+     <xapGImg:height>256</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA
+AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAEAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AhOZTjOxV2KsV/Rv5gf8A
+V2t/+Ra/9UshUu9nce5lWTYOxViX/IRv+Xb/AITK/Uz9LLcsYOxViP6Z8+/9WiL7/wDr5ldy7mdR
+72XZYwdirEf8V+Zv+pfl/wCH/wCaMr4j3M+Ed7LssYOxViX+P/8AtVXP+f0ZXx+TPg82W5YwdirE
+/wDlZOhf74uv+Aj/AOqmV+IGfhllmWMHYqx7/Hvlr/lof/kW/wDTIeIGXAU1/Q2j/wDLDb/8ik/p
+kqCLKMwoSj/Fnlz/AJb4/wAf6ZHiCeEqn+GvL/8A1b4P+AGHhC8RTPChAfp7Qv8Aq42v/I6P/mrB
+xBPCUD/gfyv/AMsX/JWb/mvBwBPGU9yTF2KuxV//2Q==</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description
+   rdf:about="">
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <xpacket />
+			</svg:metadata>
+		<svg:g
+   id="Layer_1"
+   i:layer="yes"
+   i:dimmedPercent="50"
+   i:rgbTrio="#4F008000FFFF"
+   transform="matrix(0,62.33333,-62.33333,0,5829.178,-0.11709)">
+			<svg:g
+   id="g1900">
+				<svg:rect
+   i:knockout="Off"
+   width="3"
+   height="187"
+   id="rect1902"
+   x="0"
+   y="0"
+   style="fill:#515a66" /> 
+				<svg:rect
+   y="19"
+   i:knockout="Off"
+   width="3"
+   height="2"
+   id="rect1904"
+   x="0" /> 
+				<svg:rect
+   y="37"
+   i:knockout="Off"
+   width="3"
+   height="2"
+   id="rect1906"
+   x="0" /> 
+				<svg:rect
+   y="73"
+   i:knockout="Off"
+   width="3"
+   height="2"
+   id="rect1908"
+   x="0" /> 
+				<svg:rect
+   y="55"
+   i:knockout="Off"
+   width="3"
+   height="2"
+   id="rect1910"
+   x="0" /> 
+				<svg:rect
+   y="163"
+   i:knockout="Off"
+   width="3"
+   height="2"
+   id="rect1912"
+   x="0" /> 
+				<svg:rect
+   y="145"
+   i:knockout="Off"
+   width="3"
+   height="2"
+   id="rect1914"
+   x="0" /> 
+				<svg:rect
+   y="127"
+   i:knockout="Off"
+   width="3"
+   height="2"
+   id="rect1916"
+   x="0" /> 
+				<svg:rect
+   y="91"
+   i:knockout="Off"
+   width="3"
+   height="2"
+   id="rect1918"
+   x="0" /> 
+				<svg:rect
+   y="109"
+   i:knockout="Off"
+   width="3"
+   height="2"
+   id="rect1920"
+   x="0" /> 
+			</svg:g>
+		</svg:g>
+	</svg:svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_htab.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="24" height="10" viewBox="0 0 24 10"
+	 overflow="visible" enable-background="new 0 0 24 10" xml:space="preserve">
+<rect x="0.013" y="0.021" fill="#A4A4A4" width="23.971" height="9.992"/>
+<g>
+	<rect x="7.007" y="2.001" fill="#4E4E4E" width="1" height="6"/>
+	<rect x="8.007" y="2.001" fill="#C0C1C3" width="1" height="6"/>
+	<rect x="11.007" y="2.001" fill="#4E4E4E" width="1" height="6"/>
+	<rect x="12.007" y="2.001" fill="#C0C1C3" width="1" height="6"/>
+	<rect x="15.007" y="2.001" fill="#4E4E4E" width="1" height="6"/>
+	<rect x="16.007" y="2.001" fill="#C0C1C3" width="1" height="6"/>
+</g>
+<polygon fill="#A4A4A4" points="0,0 24,0 24,0 "/>
+<polygon fill="#C6C7C8" points="23.998,10 22.999,10 22.999,1 0.999,1 0.999,0 23.998,0 "/>
+<polygon fill="#4C4C4C" points="22.999,10 -0.002,10 -0.002,0 0.999,0 0.999,9 22.999,9 "/>
+<polygon fill="#737373" points="18.999,1.999 18.999,7.999 21.999,4.999 "/>
+<polygon fill="#4C4C4C" points="21.646,4.642 19.009,7.25 18.999,7.994 21.999,4.994 "/>
+<g>
+	<polygon fill="#4C4C4C" points="18.999,7.999 18.999,2.688 19.498,3.173 19.498,7.482 	"/>
+</g>
+<polygon fill="#C6C7C8" points="21.646,5.354 18.994,2.702 18.999,1.999 21.999,4.999 "/>
+<polygon fill="#737373" points="4.995,7.999 4.995,1.999 1.995,4.999 "/>
+<polygon fill="#4C4C4C" points="2.348,5.359 4.985,2.75 4.995,2.006 1.995,5.006 "/>
+<polygon fill="#4C4C4C" points="2.348,4.646 5,7.298 4.995,7.999 1.995,4.999 "/>
+<g>
+	<polygon fill="#C6C7C8" points="4.995,1.999 4.995,7.984 4.493,7.5 4.493,2.515 	"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vslider.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+	<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+	<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+	<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+	<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+	<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg 
+	 xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="425 384" i:rulerOrigin="0 0" i:pageBounds="0 595.2754 841.8896 0"
+	 xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="10" height="189"
+	 viewBox="0 0 10 189" overflow="visible" enable-background="new 0 0 10 189" xml:space="preserve">
+	<metadata>
+		<variableSets  xmlns="http://ns.adobe.com/Variables/1.0/">
+			<variableSet  varSetName="binding1" locked="none">
+				<variables></variables>
+				<v:sampleDataSets  xmlns="http://ns.adobe.com/GenericCustomNamespace/1.0/" xmlns:v="http://ns.adobe.com/Variables/1.0/">
+					</v:sampleDataSets>
+			</variableSet>
+		</variableSets>
+		<sfw  xmlns="&ns_sfw;">
+			<slices></slices>
+			<sliceSourceBounds  y="195" x="425" width="10" height="189" bottomLeftOrigin="true"></sliceSourceBounds>
+		</sfw>
+		<x:xmpmeta  x:xmptk="XMP toolkit 3.0-29, framework 1.6" xmlns:x="adobe:ns:meta/">
+			<rdf:RDF  xmlns:iX="http://ns.adobe.com/iX/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+				<rdf:Description  rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:tiff="http://ns.adobe.com/tiff/1.0/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:xap="http://ns.adobe.com/xap/1.0/">
+					<xap:CreateDate>2005-12-20T11:58:06Z</xap:CreateDate>
+					<xap:ModifyDate>2005-12-20T11:58:14Z</xap:ModifyDate>
+					<xap:CreatorTool>Illustrator</xap:CreatorTool>
+					<xap:Thumbnails>
+						<rdf:Alt>
+							<rdf:li  rdf:parseType="Resource">
+								<xapGImg:format>JPEG</xapGImg:format>
+								<xapGImg:width>16</xapGImg:width>
+								<xapGImg:height>256</xapGImg:height>
+								<xapGImg:image>/9j/4AAQSkZJRgABAgEBLAEsAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABABLAAAAAEA
+AQEsAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A5vpun6JDomkk6RYzPNZQ
+SyyywI7s7LuS3fNRrNZPHOg+h+zns3ptZpvEycXFxVtXcPJ69/zj3omhSea21GPTLW1vLKiwS28S
+xkCaGYOCR7Llmg1U8pPF0r9Lge1HYuDQiHhX6hLn5GHkO8vKrJK6Hoh/7V1v/wARzX9pn978HrPY
+w/4F/nn7ovZP+cd1prV784v+TVxl3ZB3l8P986j27O2L3T+/G8j0uPloGiH/ALV9v/xDMTtY/vfh
++t2XsfL/AAL/ADj90XsP/OPq8dau/nF/yanzI7FO8vh/vnU+3JsYvdP78bB/y48p2mv+XNPNxqsO
+mfVrCz4+vT95zRq8aun2eP4463TDLmNyEaA5/Fp7G7VnpNHHhxyy8UpfT0oR8jzt6t+V3l630LzV
+NaQX8WopJHDKZ4acQStyvDZn3+GvXvl3ZuAYpyAkJfTy/wA5wfaPXy1WKE5QljrjFS/5J78g8R8u
+R8vLOin/AJcLf/iAzU9tH9/8P0l3/spL/BP879AeufkanHWrj3Mf/JubMrsA7z/zf98632yNjH7p
+/fB5X5Vj5eVtFP8Ay4wf8mxmB26f3/8Am/pLm+y8v8F/zv0B63+Sycdan9yn/JubMz2dO8/83/fO
+u9rzYx+6X3wYN+VnlW413ylpphuIoPq9la8vVJFecfagPTjj2joJajUGpCPDEc/My/U09ldqR0ul
+jcZS4pHl5CP63qX5e6BNonmZrWWaOZpI0lDxEkUKzrTcDf4cyeyNIdPOcSQfpO3+e4fbuvGqxwmA
+Y1xjf/km8c8jpy8n6Mf+XOD/AJNrmj9oT/hH+b+ku59nT/g3+d+gPVvymTjrT/7H/k3Lmb7MHef+
+b/vnA9qTYh7pffB5j5ATl5M0Y/8ALnB/ybXNd7SH/Cf839Jcr2fP+D/536A9V/K5OOtN9H/JuTM7
+2VO+T/N+6bg+0psQ90vviwT8ofL13q/knTDbvGno2lty9QsK8ohSlA38uHtTsrLq9SeAxHDGPO+p
+l3A9zT2f2lDTYBxAniJ5eQj5h6d5M0e40rzEsE7IzugkBjJIoUlHcL4Zldh6CelyThMgkiB2/wA/
+yHc43a2thqIRlEGhxDf/ADHk/wCWScvI2jn/AJdYP+TS5z3tQf8ACv8AN/SXZ9in9x8f0B6j+Xqc
+dZH+f+63zYeyB3yf5v3TcPt82If53+9ebflXHy8h6Of+XWH/AJNJmr9qj/hX+aPvLd2PL9z8f1PT
+/IqcdZT3r/xB82Pscd8nvh903F7cN8Px/wB6wH8mNMuL3yBpRhp+7toOXI06wr/TI9t9lZtXqz4V
+emMbs1zMv1MNDq4YcQ4upP6HpflmwmstehjlpyZSwoa7cHH8MzfZvs/LpcmSGSuI8B232/eD9DR2
+lqY5YxMeW/8AvXmn5NmQfl7pBRitbeGtCR/ulM5/2rzThq/SSPQOR85OT2cAcW/f+p6Z5X5nWoSz
+FjRtya/sNmy9jMspyymRJPo5+6bR2rVRrz/Q85/JdK/l1pB/5d4f+TMeab2xP+GD+oPvk2dnn938
+XpXl1OOs2/yf/iBzZ+wx3y++H3TaO0zfD8f0MA/Iy2eb8t9JKitIIa/8iI8r9ouydRrNafBjxcMI
+3uBzM65+5hps8YQ373pGkQPFrVqGFCRIf+EOZ/sp2dm0mTJDKKkeA8wdv3g6e5q1mUTAI8/0PPPy
+J5f8q00ihI/cw9P+MEeaD2v1WXFrfRKUbgORI/il3M9NRhuHo+mV/TNoSamknX/UzZ+w+oyZZZTO
+RkfRzN9Mne16utq8/wBDzb8jHp+WukD/AIoi/wCTEeab20H+Gj+oPvkwwzqL0bSWrrNr8pP+IHNr
+7BDfL74fdkYZ5XTzb8jY5ZPy30kRrypBDX6YI8h7S9l6jVaw+DHi4YRvl1Mq5+5oEqej6Okia1bL
+IOJo5p7cDmx9kdBm0s8sMseGR4D8P3nd7lMreX/kpcSxfl1pARytbeGtDT/dKZrPajWZsGs/dTlC
+4C6NXvJxcuSi9K8vzPLrVuXYsQHFTv8AsNmy9j9TlzTySySM5egWTf8AqjLDPit5X+Tz8fy90cf8
+u8P/ACZTNP7XD/DP8wffJwdZkqfwemeVH5azD/sv+INmz9iRvl98Pum2aGd38P0vMfydtrq48gaS
+LeMycLaDlTtWFafqyv2i0GbUas+HEyqIuvfJxNdjnPL6RdD9b0zypBcQa7FHOhjehYA+BRxX8M2H
+sro8uCeSOSJjL0Hf/ko29mwlEyEhR2/3zyb8qNWurHyLpK28pi52sBanekS0zF7f1ebDqj4cjG4i
+68jJ0/bPaE8GeomriPvL07yNqM99rqyTyGV1HEMfDhIaZnezOoy5p5JZCZH0Df8Az3J7A1stRKZk
+eIjh/wB88Z8hf8oZov8AzBwf8m1zX+0f+M/5v6S8v7X/AONj+oPvk9U/Kz/jtP8AR/ybkzP9luc/
+fH7puw9iv8r/AJn+/eY/lxY3135M0j6rbyz8LO35+kjPSsYpXiDStMxu3tPkyan0RlKojkCepcX2
+o0uXNq/3cJTqAvhBPWXc9T/LW0urXXTHcwvBIQGCSKUJHCUVowHhmd7N4Z45TE4mJ9PMV/Pdh7Ia
+fJilkjkjKJ9HMEfz+95n+Vut6npnkzS/qM3o+rZ2/qfCjV4xCn2g38xzH7Z1+bT6k+HLh4oi9geR
+l3hxfaDtTUaXVnwZcPFCN7A8jKuYPe9R/L/VL7UvMPr3svqyqqorcVX4QkppRQB1JzM7A1eTPOcs
+h4j6R0H8/uc/2X1+bUzyTynikOAcgNv3ndXe8g/L/wD5QzR/+YSD/k0uaj2k/wAZ/wA39JdD7W/4
+3/mj75PVfyu/47R+Y/5Ny5ney3PJ/m/dN2XsXzye+H3TeXflva3Vx5M0n0IXl42kHLgpalYlpWmY
+vtBhnPU+mJl6RyF9S4PtPgyZNX6ImVRHIX1k9U/LS3ng13hNG0TGhCupU09OXehzN9mcUoGYkDE+
+nnt/Pdj7H4p45ZBMGJ9HMV0m80/KvWtT0zybpv1Gb0fVtbf1PhRq8YhT7Qb+Y5X2z2hm0+pPhmuK
+IvYHkZd7j9vdqZ9LrJeDLh4oi9geRlXMHvepeQNUvtR8wie9l9WVQEVuKr8IjmNKKFHUnMvsDWZN
+ROcshs+kf7vuc/2Y1+bU5Mk8p4pDgHIDb953V3vH/wAvP+UN0n/mFg/5NJmn9pf8ZH9X9Jef9q/8
+cP8AV/SXqv5X/wDHb+kf8mpczvZXnk/zf987X2L55PfD7sjyn8uv+UN0r/mGg/5MpmD7S/4yP6v6
+S6n2q/xw+79Jerflh/x2/pH/ACalzO9leeT/ADf987X2L55PfD7sjzL8u9N1EeS9Hf6tKUltIHjZ
+UZgVMS0NQDg7d7Pz5s4ljiZDh/SXE9pNBqMuqMoY5yjXMRJ6l6j+WtvcQ62vrRPFyPw81K1pFL0q
+BmX7PaLLgM/Ejw3w1/snZ+yeky4TPxIShZjVgjpPvf/Z
+									</xapGImg:image>
+							</rdf:li>
+						</rdf:Alt>
+					</xap:Thumbnails>
+				</rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
+					<dc:format>image/svg+xml</dc:format>
+				</rdf:Description>
+			</rdf:RDF>
+		</x:xmpmeta>
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 3.0-29, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+
+ <rdf:Description rdf:about=''
+  xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:xap='http://ns.adobe.com/xap/1.0/'
+  xmlns:xapGImg='http://ns.adobe.com/xap/1.0/g/img/'>
+  <xap:CreateDate>2005-12-20T11:58:06Z</xap:CreateDate>
+  <xap:ModifyDate>2005-12-22T07:35:37Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li rdf:parseType='Resource'>
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>16</xapGImg:width>
+     <xapGImg:height>256</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A5vpun6JDomkk6RYzPNZQ&#xA;SyyywI7s7LuS3fNRrNZPHOg+h+zns3ptZpvEycXFxVtXcPJ69/zj3omhSea21GPTLW1vLKiwS28S&#xA;xkCaGYOCR7Llmg1U8pPF0r9Lge1HYuDQiHhX6hLn5GHkO8vKrJK6Hoh/7V1v/wARzX9pn978HrPY&#xA;w/4F/nn7ovZP+cd1prV784v+TVxl3ZB3l8P986j27O2L3T+/G8j0uPloGiH/ALV9v/xDMTtY/vfh&#xA;+t2XsfL/AAL/ADj90XsP/OPq8dau/nF/yanzI7FO8vh/vnU+3JsYvdP78bB/y48p2mv+XNPNxqsO&#xA;mfVrCz4+vT95zRq8aun2eP4463TDLmNyEaA5/Fp7G7VnpNHHhxyy8UpfT0oR8jzt6t+V3l630LzV&#xA;NaQX8WopJHDKZ4acQStyvDZn3+GvXvl3ZuAYpyAkJfTy/wA5wfaPXy1WKE5QljrjFS/5J78g8R8u&#xA;R8vLOin/AJcLf/iAzU9tH9/8P0l3/spL/BP879AeufkanHWrj3Mf/JubMrsA7z/zf98632yNjH7p&#xA;/fB5X5Vj5eVtFP8Ay4wf8mxmB26f3/8Am/pLm+y8v8F/zv0B63+Sycdan9yn/JubMz2dO8/83/fO&#xA;u9rzYx+6X3wYN+VnlW413ylpphuIoPq9la8vVJFecfagPTjj2joJajUGpCPDEc/My/U09ldqR0ul&#xA;jcZS4pHl5CP63qX5e6BNonmZrWWaOZpI0lDxEkUKzrTcDf4cyeyNIdPOcSQfpO3+e4fbuvGqxwmA&#xA;Y1xjf/km8c8jpy8n6Mf+XOD/AJNrmj9oT/hH+b+ku59nT/g3+d+gPVvymTjrT/7H/k3Lmb7MHef+&#xA;b/vnA9qTYh7pffB5j5ATl5M0Y/8ALnB/ybXNd7SH/Cf839Jcr2fP+D/536A9V/K5OOtN9H/JuTM7&#xA;2VO+T/N+6bg+0psQ90vviwT8ofL13q/knTDbvGno2lty9QsK8ohSlA38uHtTsrLq9SeAxHDGPO+p&#xA;l3A9zT2f2lDTYBxAniJ5eQj5h6d5M0e40rzEsE7IzugkBjJIoUlHcL4Zldh6CelyThMgkiB2/wA/&#xA;yHc43a2thqIRlEGhxDf/ADHk/wCWScvI2jn/AJdYP+TS5z3tQf8ACv8AN/SXZ9in9x8f0B6j+Xqc&#xA;dZH+f+63zYeyB3yf5v3TcPt82If53+9ebflXHy8h6Of+XWH/AJNJmr9qj/hX+aPvLd2PL9z8f1PT&#xA;/IqcdZT3r/xB82Pscd8nvh903F7cN8Px/wB6wH8mNMuL3yBpRhp+7toOXI06wr/TI9t9lZtXqz4V&#xA;emMbs1zMv1MNDq4YcQ4upP6HpflmwmstehjlpyZSwoa7cHH8MzfZvs/LpcmSGSuI8B232/eD9DR2&#xA;lqY5YxMeW/8AvXmn5NmQfl7pBRitbeGtCR/ulM5/2rzThq/SSPQOR85OT2cAcW/f+p6Z5X5nWoSz&#xA;FjRtya/sNmy9jMspyymRJPo5+6bR2rVRrz/Q85/JdK/l1pB/5d4f+TMeab2xP+GD+oPvk2dnn938&#xA;XpXl1OOs2/yf/iBzZ+wx3y++H3TaO0zfD8f0MA/Iy2eb8t9JKitIIa/8iI8r9ouydRrNafBjxcMI&#xA;3uBzM65+5hps8YQ373pGkQPFrVqGFCRIf+EOZ/sp2dm0mTJDKKkeA8wdv3g6e5q1mUTAI8/0PPPy&#xA;J5f8q00ihI/cw9P+MEeaD2v1WXFrfRKUbgORI/il3M9NRhuHo+mV/TNoSamknX/UzZ+w+oyZZZTO&#xA;RkfRzN9Mne16utq8/wBDzb8jHp+WukD/AIoi/wCTEeab20H+Gj+oPvkwwzqL0bSWrrNr8pP+IHNr&#xA;7BDfL74fdkYZ5XTzb8jY5ZPy30kRrypBDX6YI8h7S9l6jVaw+DHi4YRvl1Mq5+5oEqej6Okia1bL&#xA;IOJo5p7cDmx9kdBm0s8sMseGR4D8P3nd7lMreX/kpcSxfl1pARytbeGtDT/dKZrPajWZsGs/dTlC&#xA;4C6NXvJxcuSi9K8vzPLrVuXYsQHFTv8AsNmy9j9TlzTySySM5egWTf8AqjLDPit5X+Tz8fy90cf8&#xA;u8P/ACZTNP7XD/DP8wffJwdZkqfwemeVH5azD/sv+INmz9iRvl98Pum2aGd38P0vMfydtrq48gaS&#xA;LeMycLaDlTtWFafqyv2i0GbUas+HEyqIuvfJxNdjnPL6RdD9b0zypBcQa7FHOhjehYA+BRxX8M2H&#xA;sro8uCeSOSJjL0Hf/ko29mwlEyEhR2/3zyb8qNWurHyLpK28pi52sBanekS0zF7f1ebDqj4cjG4i&#xA;68jJ0/bPaE8GeomriPvL07yNqM99rqyTyGV1HEMfDhIaZnezOoy5p5JZCZH0Df8Az3J7A1stRKZk&#xA;eIjh/wB88Z8hf8oZov8AzBwf8m1zX+0f+M/5v6S8v7X/AONj+oPvk9U/Kz/jtP8AR/ybkzP9luc/&#xA;fH7puw9iv8r/AJn+/eY/lxY3135M0j6rbyz8LO35+kjPSsYpXiDStMxu3tPkyan0RlKojkCepcX2&#xA;o0uXNq/3cJTqAvhBPWXc9T/LW0urXXTHcwvBIQGCSKUJHCUVowHhmd7N4Z45TE4mJ9PMV/Pdh7Ia&#xA;fJilkjkjKJ9HMEfz+95n+Vut6npnkzS/qM3o+rZ2/qfCjV4xCn2g38xzH7Z1+bT6k+HLh4oi9geR&#xA;l3hxfaDtTUaXVnwZcPFCN7A8jKuYPe9R/L/VL7UvMPr3svqyqqorcVX4QkppRQB1JzM7A1eTPOcs&#xA;h4j6R0H8/uc/2X1+bUzyTynikOAcgNv3ndXe8g/L/wD5QzR/+YSD/k0uaj2k/wAZ/wA39JdD7W/4&#xA;3/mj75PVfyu/47R+Y/5Ny5ney3PJ/m/dN2XsXzye+H3TeXflva3Vx5M0n0IXl42kHLgpalYlpWmY&#xA;vtBhnPU+mJl6RyF9S4PtPgyZNX6ImVRHIX1k9U/LS3ng13hNG0TGhCupU09OXehzN9mcUoGYkDE+&#xA;nnt/Pdj7H4p45ZBMGJ9HMV0m80/KvWtT0zybpv1Gb0fVtbf1PhRq8YhT7Qb+Y5X2z2hm0+pPhmuK&#xA;IvYHkZd7j9vdqZ9LrJeDLh4oi9geRlXMHvepeQNUvtR8wie9l9WVQEVuKr8IjmNKKFHUnMvsDWZN&#xA;ROcshs+kf7vuc/2Y1+bU5Mk8p4pDgHIDb953V3vH/wAvP+UN0n/mFg/5NJmn9pf8ZH9X9Jef9q/8&#xA;cP8AV/SXqv5X/wDHb+kf8mpczvZXnk/zf987X2L55PfD7sjyn8uv+UN0r/mGg/5MpmD7S/4yP6v6&#xA;S6n2q/xw+79Jerflh/x2/pH/ACalzO9leeT/ADf987X2L55PfD7sjzL8u9N1EeS9Hf6tKUltIHjZ&#xA;UZgVMS0NQDg7d7Pz5s4ljiZDh/SXE9pNBqMuqMoY5yjXMRJ6l6j+WtvcQ62vrRPFyPw81K1pFL0q&#xA;BmX7PaLLgM/Ejw3w1/snZ+yeky4TPxIShZjVgjpPvf/Z</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:dc='http://purl.org/dc/elements/1.1/'>
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?xpacket end='w'?>
+			</metadata>
+		<g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+			<g>
+				<radialGradient id="XMLID_2_" cx="0.1025" cy="3.1621" r="179.8225" fx="0.1025" fy="3.1621" gradientUnits="userSpaceOnUse">
+					<stop  offset="0.0056" style="stop-color:#FA0404"/>
+					<stop  offset="0.5337" style="stop-color:#FBF814"/>
+					<stop  offset="1" style="stop-color:#01FE01"/>
+					<a:midPointStop  offset="0.0056" style="stop-color:#FA0404"/>
+					<a:midPointStop  offset="0.5" style="stop-color:#FA0404"/>
+					<a:midPointStop  offset="0.5337" style="stop-color:#FBF814"/>
+					<a:midPointStop  offset="0.5" style="stop-color:#FBF814"/>
+					<a:midPointStop  offset="1" style="stop-color:#01FE01"/>
+				</radialGradient>
+				<rect y="1" i:knockout="Off" fill="url(#XMLID_2_)" width="10" height="188"/> 
+				<polygon i:knockout="Off" points="10,0 10,1 1,1 1,189 0,189 0,0 "/>
+				<polygon i:knockout="Off" fill="#808080" points="10,1 1,1 1,188 2,188 2,2 10,2 "/>
+				<polygon i:knockout="Off" fill="#C7C7C7" points="1,189 10,189 10,2 9,2 9,188 1,188 "/>
+				<rect x="3" y="21" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="39" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="93" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="75" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="57" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="111" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="165" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="147" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="129" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+			</g>
+		</g>
+	</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vslider_v1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+	<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+	<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+	<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+	<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+	<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg 
+	 xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="425 384" i:rulerOrigin="0 0" i:pageBounds="0 595.2754 841.8896 0"
+	 xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="10" height="189"
+	 viewBox="0 0 10 189" overflow="visible" enable-background="new 0 0 10 189" xml:space="preserve">
+	<metadata>
+		<variableSets  xmlns="http://ns.adobe.com/Variables/1.0/">
+			<variableSet  varSetName="binding1" locked="none">
+				<variables></variables>
+				<v:sampleDataSets  xmlns="http://ns.adobe.com/GenericCustomNamespace/1.0/" xmlns:v="http://ns.adobe.com/Variables/1.0/">
+					</v:sampleDataSets>
+			</variableSet>
+		</variableSets>
+		<sfw  xmlns="&ns_sfw;">
+			<slices></slices>
+			<sliceSourceBounds  y="195" x="425" width="10" height="189" bottomLeftOrigin="true"></sliceSourceBounds>
+		</sfw>
+		<x:xmpmeta  x:xmptk="XMP toolkit 3.0-29, framework 1.6" xmlns:x="adobe:ns:meta/">
+			<rdf:RDF  xmlns:iX="http://ns.adobe.com/iX/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+				<rdf:Description  rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:tiff="http://ns.adobe.com/tiff/1.0/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:xap="http://ns.adobe.com/xap/1.0/">
+					<xap:CreateDate>2005-12-20T11:58:06Z</xap:CreateDate>
+					<xap:ModifyDate>2005-12-20T11:58:14Z</xap:ModifyDate>
+					<xap:CreatorTool>Illustrator</xap:CreatorTool>
+					<xap:Thumbnails>
+						<rdf:Alt>
+							<rdf:li  rdf:parseType="Resource">
+								<xapGImg:format>JPEG</xapGImg:format>
+								<xapGImg:width>16</xapGImg:width>
+								<xapGImg:height>256</xapGImg:height>
+								<xapGImg:image>/9j/4AAQSkZJRgABAgEBLAEsAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABABLAAAAAEA
+AQEsAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A5vpun6JDomkk6RYzPNZQ
+SyyywI7s7LuS3fNRrNZPHOg+h+zns3ptZpvEycXFxVtXcPJ69/zj3omhSea21GPTLW1vLKiwS28S
+xkCaGYOCR7Llmg1U8pPF0r9Lge1HYuDQiHhX6hLn5GHkO8vKrJK6Hoh/7V1v/wARzX9pn978HrPY
+w/4F/nn7ovZP+cd1prV784v+TVxl3ZB3l8P986j27O2L3T+/G8j0uPloGiH/ALV9v/xDMTtY/vfh
++t2XsfL/AAL/ADj90XsP/OPq8dau/nF/yanzI7FO8vh/vnU+3JsYvdP78bB/y48p2mv+XNPNxqsO
+mfVrCz4+vT95zRq8aun2eP4463TDLmNyEaA5/Fp7G7VnpNHHhxyy8UpfT0oR8jzt6t+V3l630LzV
+NaQX8WopJHDKZ4acQStyvDZn3+GvXvl3ZuAYpyAkJfTy/wA5wfaPXy1WKE5QljrjFS/5J78g8R8u
+R8vLOin/AJcLf/iAzU9tH9/8P0l3/spL/BP879AeufkanHWrj3Mf/JubMrsA7z/zf98632yNjH7p
+/fB5X5Vj5eVtFP8Ay4wf8mxmB26f3/8Am/pLm+y8v8F/zv0B63+Sycdan9yn/JubMz2dO8/83/fO
+u9rzYx+6X3wYN+VnlW413ylpphuIoPq9la8vVJFecfagPTjj2joJajUGpCPDEc/My/U09ldqR0ul
+jcZS4pHl5CP63qX5e6BNonmZrWWaOZpI0lDxEkUKzrTcDf4cyeyNIdPOcSQfpO3+e4fbuvGqxwmA
+Y1xjf/km8c8jpy8n6Mf+XOD/AJNrmj9oT/hH+b+ku59nT/g3+d+gPVvymTjrT/7H/k3Lmb7MHef+
+b/vnA9qTYh7pffB5j5ATl5M0Y/8ALnB/ybXNd7SH/Cf839Jcr2fP+D/536A9V/K5OOtN9H/JuTM7
+2VO+T/N+6bg+0psQ90vviwT8ofL13q/knTDbvGno2lty9QsK8ohSlA38uHtTsrLq9SeAxHDGPO+p
+l3A9zT2f2lDTYBxAniJ5eQj5h6d5M0e40rzEsE7IzugkBjJIoUlHcL4Zldh6CelyThMgkiB2/wA/
+yHc43a2thqIRlEGhxDf/ADHk/wCWScvI2jn/AJdYP+TS5z3tQf8ACv8AN/SXZ9in9x8f0B6j+Xqc
+dZH+f+63zYeyB3yf5v3TcPt82If53+9ebflXHy8h6Of+XWH/AJNJmr9qj/hX+aPvLd2PL9z8f1PT
+/IqcdZT3r/xB82Pscd8nvh903F7cN8Px/wB6wH8mNMuL3yBpRhp+7toOXI06wr/TI9t9lZtXqz4V
+emMbs1zMv1MNDq4YcQ4upP6HpflmwmstehjlpyZSwoa7cHH8MzfZvs/LpcmSGSuI8B232/eD9DR2
+lqY5YxMeW/8AvXmn5NmQfl7pBRitbeGtCR/ulM5/2rzThq/SSPQOR85OT2cAcW/f+p6Z5X5nWoSz
+FjRtya/sNmy9jMspyymRJPo5+6bR2rVRrz/Q85/JdK/l1pB/5d4f+TMeab2xP+GD+oPvk2dnn938
+XpXl1OOs2/yf/iBzZ+wx3y++H3TaO0zfD8f0MA/Iy2eb8t9JKitIIa/8iI8r9ouydRrNafBjxcMI
+3uBzM65+5hps8YQ373pGkQPFrVqGFCRIf+EOZ/sp2dm0mTJDKKkeA8wdv3g6e5q1mUTAI8/0PPPy
+J5f8q00ihI/cw9P+MEeaD2v1WXFrfRKUbgORI/il3M9NRhuHo+mV/TNoSamknX/UzZ+w+oyZZZTO
+RkfRzN9Mne16utq8/wBDzb8jHp+WukD/AIoi/wCTEeab20H+Gj+oPvkwwzqL0bSWrrNr8pP+IHNr
+7BDfL74fdkYZ5XTzb8jY5ZPy30kRrypBDX6YI8h7S9l6jVaw+DHi4YRvl1Mq5+5oEqej6Okia1bL
+IOJo5p7cDmx9kdBm0s8sMseGR4D8P3nd7lMreX/kpcSxfl1pARytbeGtDT/dKZrPajWZsGs/dTlC
+4C6NXvJxcuSi9K8vzPLrVuXYsQHFTv8AsNmy9j9TlzTySySM5egWTf8AqjLDPit5X+Tz8fy90cf8
+u8P/ACZTNP7XD/DP8wffJwdZkqfwemeVH5azD/sv+INmz9iRvl98Pum2aGd38P0vMfydtrq48gaS
+LeMycLaDlTtWFafqyv2i0GbUas+HEyqIuvfJxNdjnPL6RdD9b0zypBcQa7FHOhjehYA+BRxX8M2H
+sro8uCeSOSJjL0Hf/ko29mwlEyEhR2/3zyb8qNWurHyLpK28pi52sBanekS0zF7f1ebDqj4cjG4i
+68jJ0/bPaE8GeomriPvL07yNqM99rqyTyGV1HEMfDhIaZnezOoy5p5JZCZH0Df8Az3J7A1stRKZk
+eIjh/wB88Z8hf8oZov8AzBwf8m1zX+0f+M/5v6S8v7X/AONj+oPvk9U/Kz/jtP8AR/ybkzP9luc/
+fH7puw9iv8r/AJn+/eY/lxY3135M0j6rbyz8LO35+kjPSsYpXiDStMxu3tPkyan0RlKojkCepcX2
+o0uXNq/3cJTqAvhBPWXc9T/LW0urXXTHcwvBIQGCSKUJHCUVowHhmd7N4Z45TE4mJ9PMV/Pdh7Ia
+fJilkjkjKJ9HMEfz+95n+Vut6npnkzS/qM3o+rZ2/qfCjV4xCn2g38xzH7Z1+bT6k+HLh4oi9geR
+l3hxfaDtTUaXVnwZcPFCN7A8jKuYPe9R/L/VL7UvMPr3svqyqqorcVX4QkppRQB1JzM7A1eTPOcs
+h4j6R0H8/uc/2X1+bUzyTynikOAcgNv3ndXe8g/L/wD5QzR/+YSD/k0uaj2k/wAZ/wA39JdD7W/4
+3/mj75PVfyu/47R+Y/5Ny5ney3PJ/m/dN2XsXzye+H3TeXflva3Vx5M0n0IXl42kHLgpalYlpWmY
+vtBhnPU+mJl6RyF9S4PtPgyZNX6ImVRHIX1k9U/LS3ng13hNG0TGhCupU09OXehzN9mcUoGYkDE+
+nnt/Pdj7H4p45ZBMGJ9HMV0m80/KvWtT0zybpv1Gb0fVtbf1PhRq8YhT7Qb+Y5X2z2hm0+pPhmuK
+IvYHkZd7j9vdqZ9LrJeDLh4oi9geRlXMHvepeQNUvtR8wie9l9WVQEVuKr8IjmNKKFHUnMvsDWZN
+ROcshs+kf7vuc/2Y1+bU5Mk8p4pDgHIDb953V3vH/wAvP+UN0n/mFg/5NJmn9pf8ZH9X9Jef9q/8
+cP8AV/SXqv5X/wDHb+kf8mpczvZXnk/zf987X2L55PfD7sjyn8uv+UN0r/mGg/5MpmD7S/4yP6v6
+S6n2q/xw+79Jerflh/x2/pH/ACalzO9leeT/ADf987X2L55PfD7sjzL8u9N1EeS9Hf6tKUltIHjZ
+UZgVMS0NQDg7d7Pz5s4ljiZDh/SXE9pNBqMuqMoY5yjXMRJ6l6j+WtvcQ62vrRPFyPw81K1pFL0q
+BmX7PaLLgM/Ejw3w1/snZ+yeky4TPxIShZjVgjpPvf/Z
+									</xapGImg:image>
+							</rdf:li>
+						</rdf:Alt>
+					</xap:Thumbnails>
+				</rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
+					<dc:format>image/svg+xml</dc:format>
+				</rdf:Description>
+			</rdf:RDF>
+		</x:xmpmeta>
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 3.0-29, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+
+ <rdf:Description rdf:about=''
+  xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:xap='http://ns.adobe.com/xap/1.0/'
+  xmlns:xapGImg='http://ns.adobe.com/xap/1.0/g/img/'>
+  <xap:CreateDate>2005-12-20T11:58:06Z</xap:CreateDate>
+  <xap:ModifyDate>2005-12-22T07:35:37Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li rdf:parseType='Resource'>
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>16</xapGImg:width>
+     <xapGImg:height>256</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A5vpun6JDomkk6RYzPNZQ&#xA;SyyywI7s7LuS3fNRrNZPHOg+h+zns3ptZpvEycXFxVtXcPJ69/zj3omhSea21GPTLW1vLKiwS28S&#xA;xkCaGYOCR7Llmg1U8pPF0r9Lge1HYuDQiHhX6hLn5GHkO8vKrJK6Hoh/7V1v/wARzX9pn978HrPY&#xA;w/4F/nn7ovZP+cd1prV784v+TVxl3ZB3l8P986j27O2L3T+/G8j0uPloGiH/ALV9v/xDMTtY/vfh&#xA;+t2XsfL/AAL/ADj90XsP/OPq8dau/nF/yanzI7FO8vh/vnU+3JsYvdP78bB/y48p2mv+XNPNxqsO&#xA;mfVrCz4+vT95zRq8aun2eP4463TDLmNyEaA5/Fp7G7VnpNHHhxyy8UpfT0oR8jzt6t+V3l630LzV&#xA;NaQX8WopJHDKZ4acQStyvDZn3+GvXvl3ZuAYpyAkJfTy/wA5wfaPXy1WKE5QljrjFS/5J78g8R8u&#xA;R8vLOin/AJcLf/iAzU9tH9/8P0l3/spL/BP879AeufkanHWrj3Mf/JubMrsA7z/zf98632yNjH7p&#xA;/fB5X5Vj5eVtFP8Ay4wf8mxmB26f3/8Am/pLm+y8v8F/zv0B63+Sycdan9yn/JubMz2dO8/83/fO&#xA;u9rzYx+6X3wYN+VnlW413ylpphuIoPq9la8vVJFecfagPTjj2joJajUGpCPDEc/My/U09ldqR0ul&#xA;jcZS4pHl5CP63qX5e6BNonmZrWWaOZpI0lDxEkUKzrTcDf4cyeyNIdPOcSQfpO3+e4fbuvGqxwmA&#xA;Y1xjf/km8c8jpy8n6Mf+XOD/AJNrmj9oT/hH+b+ku59nT/g3+d+gPVvymTjrT/7H/k3Lmb7MHef+&#xA;b/vnA9qTYh7pffB5j5ATl5M0Y/8ALnB/ybXNd7SH/Cf839Jcr2fP+D/536A9V/K5OOtN9H/JuTM7&#xA;2VO+T/N+6bg+0psQ90vviwT8ofL13q/knTDbvGno2lty9QsK8ohSlA38uHtTsrLq9SeAxHDGPO+p&#xA;l3A9zT2f2lDTYBxAniJ5eQj5h6d5M0e40rzEsE7IzugkBjJIoUlHcL4Zldh6CelyThMgkiB2/wA/&#xA;yHc43a2thqIRlEGhxDf/ADHk/wCWScvI2jn/AJdYP+TS5z3tQf8ACv8AN/SXZ9in9x8f0B6j+Xqc&#xA;dZH+f+63zYeyB3yf5v3TcPt82If53+9ebflXHy8h6Of+XWH/AJNJmr9qj/hX+aPvLd2PL9z8f1PT&#xA;/IqcdZT3r/xB82Pscd8nvh903F7cN8Px/wB6wH8mNMuL3yBpRhp+7toOXI06wr/TI9t9lZtXqz4V&#xA;emMbs1zMv1MNDq4YcQ4upP6HpflmwmstehjlpyZSwoa7cHH8MzfZvs/LpcmSGSuI8B232/eD9DR2&#xA;lqY5YxMeW/8AvXmn5NmQfl7pBRitbeGtCR/ulM5/2rzThq/SSPQOR85OT2cAcW/f+p6Z5X5nWoSz&#xA;FjRtya/sNmy9jMspyymRJPo5+6bR2rVRrz/Q85/JdK/l1pB/5d4f+TMeab2xP+GD+oPvk2dnn938&#xA;XpXl1OOs2/yf/iBzZ+wx3y++H3TaO0zfD8f0MA/Iy2eb8t9JKitIIa/8iI8r9ouydRrNafBjxcMI&#xA;3uBzM65+5hps8YQ373pGkQPFrVqGFCRIf+EOZ/sp2dm0mTJDKKkeA8wdv3g6e5q1mUTAI8/0PPPy&#xA;J5f8q00ihI/cw9P+MEeaD2v1WXFrfRKUbgORI/il3M9NRhuHo+mV/TNoSamknX/UzZ+w+oyZZZTO&#xA;RkfRzN9Mne16utq8/wBDzb8jHp+WukD/AIoi/wCTEeab20H+Gj+oPvkwwzqL0bSWrrNr8pP+IHNr&#xA;7BDfL74fdkYZ5XTzb8jY5ZPy30kRrypBDX6YI8h7S9l6jVaw+DHi4YRvl1Mq5+5oEqej6Okia1bL&#xA;IOJo5p7cDmx9kdBm0s8sMseGR4D8P3nd7lMreX/kpcSxfl1pARytbeGtDT/dKZrPajWZsGs/dTlC&#xA;4C6NXvJxcuSi9K8vzPLrVuXYsQHFTv8AsNmy9j9TlzTySySM5egWTf8AqjLDPit5X+Tz8fy90cf8&#xA;u8P/ACZTNP7XD/DP8wffJwdZkqfwemeVH5azD/sv+INmz9iRvl98Pum2aGd38P0vMfydtrq48gaS&#xA;LeMycLaDlTtWFafqyv2i0GbUas+HEyqIuvfJxNdjnPL6RdD9b0zypBcQa7FHOhjehYA+BRxX8M2H&#xA;sro8uCeSOSJjL0Hf/ko29mwlEyEhR2/3zyb8qNWurHyLpK28pi52sBanekS0zF7f1ebDqj4cjG4i&#xA;68jJ0/bPaE8GeomriPvL07yNqM99rqyTyGV1HEMfDhIaZnezOoy5p5JZCZH0Df8Az3J7A1stRKZk&#xA;eIjh/wB88Z8hf8oZov8AzBwf8m1zX+0f+M/5v6S8v7X/AONj+oPvk9U/Kz/jtP8AR/ybkzP9luc/&#xA;fH7puw9iv8r/AJn+/eY/lxY3135M0j6rbyz8LO35+kjPSsYpXiDStMxu3tPkyan0RlKojkCepcX2&#xA;o0uXNq/3cJTqAvhBPWXc9T/LW0urXXTHcwvBIQGCSKUJHCUVowHhmd7N4Z45TE4mJ9PMV/Pdh7Ia&#xA;fJilkjkjKJ9HMEfz+95n+Vut6npnkzS/qM3o+rZ2/qfCjV4xCn2g38xzH7Z1+bT6k+HLh4oi9geR&#xA;l3hxfaDtTUaXVnwZcPFCN7A8jKuYPe9R/L/VL7UvMPr3svqyqqorcVX4QkppRQB1JzM7A1eTPOcs&#xA;h4j6R0H8/uc/2X1+bUzyTynikOAcgNv3ndXe8g/L/wD5QzR/+YSD/k0uaj2k/wAZ/wA39JdD7W/4&#xA;3/mj75PVfyu/47R+Y/5Ny5ney3PJ/m/dN2XsXzye+H3TeXflva3Vx5M0n0IXl42kHLgpalYlpWmY&#xA;vtBhnPU+mJl6RyF9S4PtPgyZNX6ImVRHIX1k9U/LS3ng13hNG0TGhCupU09OXehzN9mcUoGYkDE+&#xA;nnt/Pdj7H4p45ZBMGJ9HMV0m80/KvWtT0zybpv1Gb0fVtbf1PhRq8YhT7Qb+Y5X2z2hm0+pPhmuK&#xA;IvYHkZd7j9vdqZ9LrJeDLh4oi9geRlXMHvepeQNUvtR8wie9l9WVQEVuKr8IjmNKKFHUnMvsDWZN&#xA;ROcshs+kf7vuc/2Y1+bU5Mk8p4pDgHIDb953V3vH/wAvP+UN0n/mFg/5NJmn9pf8ZH9X9Jef9q/8&#xA;cP8AV/SXqv5X/wDHb+kf8mpczvZXnk/zf987X2L55PfD7sjyn8uv+UN0r/mGg/5MpmD7S/4yP6v6&#xA;S6n2q/xw+79Jerflh/x2/pH/ACalzO9leeT/ADf987X2L55PfD7sjzL8u9N1EeS9Hf6tKUltIHjZ&#xA;UZgVMS0NQDg7d7Pz5s4ljiZDh/SXE9pNBqMuqMoY5yjXMRJ6l6j+WtvcQ62vrRPFyPw81K1pFL0q&#xA;BmX7PaLLgM/Ejw3w1/snZ+yeky4TPxIShZjVgjpPvf/Z</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:dc='http://purl.org/dc/elements/1.1/'>
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?xpacket end='w'?>
+			</metadata>
+		<g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+			<g>
+				<radialGradient id="XMLID_2_" cx="0.1025" cy="3.1621" r="179.8225" fx="0.1025" fy="3.1621" gradientUnits="userSpaceOnUse">
+					<stop  offset="0.0056" style="stop-color:#FA0404"/>
+					<stop  offset="0.5337" style="stop-color:#FBF814"/>
+					<stop  offset="1" style="stop-color:#01FE01"/>
+					<a:midPointStop  offset="0.0056" style="stop-color:#FA0404"/>
+					<a:midPointStop  offset="0.5" style="stop-color:#FA0404"/>
+					<a:midPointStop  offset="0.5337" style="stop-color:#FBF814"/>
+					<a:midPointStop  offset="0.5" style="stop-color:#FBF814"/>
+					<a:midPointStop  offset="1" style="stop-color:#01FE01"/>
+				</radialGradient>
+				<rect y="1" i:knockout="Off" fill="url(#XMLID_2_)" width="10" height="188"/> 
+				<polygon i:knockout="Off" points="10,0 10,1 1,1 1,189 0,189 0,0 "/>
+				<polygon i:knockout="Off" fill="#808080" points="10,1 1,1 1,188 2,188 2,2 10,2 "/>
+				<polygon i:knockout="Off" fill="#C7C7C7" points="1,189 10,189 10,2 9,2 9,188 1,188 "/>
+				<rect x="3" y="21" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="39" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="93" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="75" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="57" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="111" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="165" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="147" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="129" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+			</g>
+		</g>
+	</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vslider_v2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+	<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+	<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+	<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+	<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+	<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg 
+	 xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="425 384" i:rulerOrigin="0 0" i:pageBounds="0 595.2754 841.8896 0"
+	 xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="10" height="189"
+	 viewBox="0 0 10 189" overflow="visible" enable-background="new 0 0 10 189" xml:space="preserve">
+	<metadata>
+		<variableSets  xmlns="http://ns.adobe.com/Variables/1.0/">
+			<variableSet  varSetName="binding1" locked="none">
+				<variables></variables>
+				<v:sampleDataSets  xmlns="http://ns.adobe.com/GenericCustomNamespace/1.0/" xmlns:v="http://ns.adobe.com/Variables/1.0/">
+					</v:sampleDataSets>
+			</variableSet>
+		</variableSets>
+		<sfw  xmlns="&ns_sfw;">
+			<slices></slices>
+			<sliceSourceBounds  y="195" x="425" width="10" height="189" bottomLeftOrigin="true"></sliceSourceBounds>
+		</sfw>
+		<x:xmpmeta  x:xmptk="XMP toolkit 3.0-29, framework 1.6" xmlns:x="adobe:ns:meta/">
+			<rdf:RDF  xmlns:iX="http://ns.adobe.com/iX/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+				<rdf:Description  rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:tiff="http://ns.adobe.com/tiff/1.0/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:xap="http://ns.adobe.com/xap/1.0/">
+					<xap:CreateDate>2005-12-20T11:58:47Z</xap:CreateDate>
+					<xap:ModifyDate>2005-12-20T11:59:00Z</xap:ModifyDate>
+					<xap:CreatorTool>Illustrator</xap:CreatorTool>
+					<xap:Thumbnails>
+						<rdf:Alt>
+							<rdf:li  rdf:parseType="Resource">
+								<xapGImg:format>JPEG</xapGImg:format>
+								<xapGImg:width>16</xapGImg:width>
+								<xapGImg:height>256</xapGImg:height>
+								<xapGImg:image>/9j/4AAQSkZJRgABAgEBLAEsAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABABLAAAAAEA
+AQEsAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AivlLyn5YuPLGlTz6VaSz
+SWsLySPDGzMzRgkkkEkk5utDoceXHxSu7eN7b7bz6bPwQqqvf3nzerfkv5Q8tWvmuPUbTTre3vLa
+qxTQxIjASwyqwqoHUDKu0NJDEBw9b/Q5fYHamXVmXiV6a5eYl+p595LP/OpaP/zBwf8AJtcz+zD+
+6+LzvtR/jX+b+kvWPyg/47cnzX/k1NmP2ufp+P6HY+yHPJ74/dN5N5MP/OpaP/zBwf8AJtcs7OP7
+v4uv9p/8a/zf0l6x+T5/3NyfNf8Ak1NlHap+n4/odh7I88nvj903nv5W6Faar5T0/wCsalBp/o2d
+rx9cgc+Ue/GrL9nj+OQ02YwxiomW/T4Mu19Djz6qXHkjiqI+rrvLzHJ6n+XelW+meZzbwX0V+jIk
+hmhIKglJxxNC2/w1yrW5TOIJHDz/AEOZ2BpYYMk4xnHIPQbj/wAlNuZeJeTj/wA6po//ADBwf8m1
+zI0J9Dovab/Gv839Jetfk4f9zcvzX/k1NlXaB5fH9DsPZLnk98fum8k8n/8AKKaP/wAwcH/JtcOk
+PocD2l/xr/N/SXrX5N/8duX5r/yamyvWnl8f0Ow9k+eT3x+6bz38rvLF3rnlXT/q9xBB9Xs7Xl67
+Mtece3Git/LvkMOUQjvae1uzJ6rVS4DEcMR9RrmZeR7nqf5c6FcaL5na1nmind0jlDwMWUApcLQk
+hd/hyGoyCQBH45OZ2DoZ6bJOEjEk8B9Jv+f5DueJeUD/AM6rpH/MHB/ybXJ4D6XR+0n+M/5v6S9a
+/Jk/7m5fmn/JqbIag8nYeynOfvj903kflE/86tpH/MHB/wAm1wYjs4HtJ/jP+b+kvW/yX/47cvzT
+/k1Nkcxdh7Kc5++P3Tefflb5S1LzD5WsfqUkMf1WztfU9ZnWvqR7U4q/8hyAlQZ9p9lZNXqZcBiO
+GI531Mu4Hueqflz5dvtA80tZ3jxSSyJHMDCWZeLJcL+0qGtUwSlbl9idnz0uScJkEnhO3+f5DueH
+eVP+UX0j/mDg/wCTYwAui9ov8Z+H6S9b/JT/AI7c3+sn/JqfAS7D2W5z98fum8j8qn/nV9I/5g4P
++TYyEi4HtF/jPw/SXrf5J/8AHbm/1k/5NT4guf7Lc5++P3Tec/lv5X1jXfLGn/o2NZPq1na+rydU
+pzj+H7R/yTkZRssO1tBm1GpPhi+EC9wOZPe9W/K7QdS0TzM9pqCCOZ1jlVVYMOJjuFG491OGIpze
+wdHk085xyCj6T0/p9zxPynPNF5Z0n05GStlb14kitIx4ZVlmQdnUe0H+M/D9JeufkpLLLrszSOzs
+CgqxJNPSn8cOKRN25/sxzn74/dN4/wCWP+UZ0j/mCg/5NjKNSfV8HA9oP8Z+H63rv5H/APHcn/1k
+/wCTU+S0x5uf7Mc5++P3Tebfl55Y1vXfLWn/AKMgE/1eytfWq6JTnH8P2ytfsnBnxGctu5r7W0Ob
+PqT4ceKgL3A533kPWPyp0HVNF8zSWupQiGd1jlVQyv8AAY7hQaoWHVTktPjMSQfL9Lm9g6XJgnOO
+QcJ9J6H+f3W8a8nX19a+WdK+q3EsHOyt+fpOyVpGKV4kVpXBnJEtu51fbuWcNSeEkbdPeXrf5MXV
+1c6/NJczPPIDGoeRi5AEU5pVifHJae97c72bySnKZkSfp5+6bx7yv/yjOkf8wUH/ACbGOYbut9oP
+8Z+H6S9d/JD/AI7k3+sn/JqfJYBzc/2Y5z98fum808geXtY1fyxpv6OtWufQs7b1eJUcecfw/aI6
+8Tk5xstHbGjy59SfDjxUBfzL1j8ptH1LSfMclvqEBt5nEcioxBJUx3AB+EnupxhGnN9n9NkwznHI
+OE+k/wC7eR+R9V1Ow8saX9Ru5rX1bO39T0XZOXGMUrxIrSpyw263t3UZMepPBKUbA5Ejqe56z+UG
+oX995hlmvbiS5lX00WSVy7BRHOaVYnapOAOf7N5p5JTM5GR9PMk9J97xzyp/yi+kf8wcH/JsZOnV
+e0X+M/D9Jeufkp/x25v9ZP8Ak1PgIdh7Lc5++P3TeY+QtF1XUvK+mfULWS59KztvU9MV48oxSvzo
+csiNnG7c0uXLqTwRMqiOQvqXrH5S6ZqGneYZIb63e3lbg6pIKEqY5xX7wcE3O9m8E8UpiYMT6ef+
+e8p8g6xqmm+VtM+oXUlt6tnbep6bceXGMUr8qnLMcbDgdu6rLi1J4JGNxHI11L1j8ptSv9Q8wyTX
+073EqhEV5DUhRHOafeTkcopzvZvUTyymZyMj6ef+e8c8oj/nVdI/5g4P+Ta5dhHpdT7Sf4z/AJv6
+S9a/Jj/jty/NP+TU2Qzjk7D2U5z98fum8v8AImmaje+VdK+pWs1z6dnb+p6MbSceUYpXiDStMtwk
+CO5cXt/TZMupPBGUqiOQJ6nuesflJY3tlr8kV5byW0rcGCTIyMVMc4rRgNtshqCDVfjk53szhnjl
+MTiYn08xXSbzH8t/MOsaP5V039G3HoevZ23q/Aj14R/D9tWpTkemW4MUZQ3cftntDNptUfClw8UR
+ewPIy7we96r+WGs6lq/mR7nUJvXmRUjV+KJRRHOwFECjqxyvU4xEADz/AEOb7PazLqJzlkPFIcI6
+Db19zxnyf/yimj/8wcH/ACbXMrRj0Ol9pf8AGv8AN/SXrX5N/wDHbl+a/wDJqbKtcOXx/Q7D2T55
+PfH7pvLfItjeXXlTSfq0Ek/Czt+fpoz0rGKV4g+GX6OQGPc9XD9osM56r0xMvSOQvqXq/wCUlrc2
+2vSJcRPC54MFkUqaenMK0NMq15BArz/Q5/stilCUxIGJ9PPbpN5r+WvmHV9H8p6b+jp/R9eztvV+
+BHrwj+H7Yb+Y5bpMEMmP1C6P6nH7b7Rz6bVHwpcPFEXsDyMu8F6p+Wes6jq3mRrm/l9aZFSNW4qv
+wiOdgKKAOrHKtdhjjAERXP8AQ5vs5rMuonOWQ8UhwDkBt6+6njfkwf8AOpaP/wAwcH/Jtczezh+7
++Lpfaf8Axr/N/SXrH5Pj/c3J81/5NTZR2oPp+P6HYeyPPJ74/dN5R5LH/OpaP/zBwf8AJtcyuzB+
+6+Lrvaf/ABr/ADf0l6x+UH/Hbk+a/wDJqbMftcfT8f0Ox9keeT3x+6bzXyNomrS+TdEljtZGjksr
+dkYCoIMS75b2dqMcMdSkAbavaHs/Pm1HFCEpR4envL1P8q9PvbTWz9ZhaLmRw5ClaRS1/XlHamaE
++HhN8/0Ob7MaPLhM/EiY2Y1fum//2Q==
+									</xapGImg:image>
+							</rdf:li>
+						</rdf:Alt>
+					</xap:Thumbnails>
+				</rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
+					<dc:format>image/svg+xml</dc:format>
+				</rdf:Description>
+			</rdf:RDF>
+		</x:xmpmeta>
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 3.0-29, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+
+ <rdf:Description rdf:about=''
+  xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:xap='http://ns.adobe.com/xap/1.0/'
+  xmlns:xapGImg='http://ns.adobe.com/xap/1.0/g/img/'>
+  <xap:CreateDate>2005-12-20T11:58:47Z</xap:CreateDate>
+  <xap:ModifyDate>2005-12-22T07:35:50Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li rdf:parseType='Resource'>
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>16</xapGImg:width>
+     <xapGImg:height>256</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AivlLyn5YuPLGlTz6VaSz&#xA;SWsLySPDGzMzRgkkkEkk5utDoceXHxSu7eN7b7bz6bPwQqqvf3nzerfkv5Q8tWvmuPUbTTre3vLa&#xA;qxTQxIjASwyqwqoHUDKu0NJDEBw9b/Q5fYHamXVmXiV6a5eYl+p595LP/OpaP/zBwf8AJtcz+zD+&#xA;6+LzvtR/jX+b+kvWPyg/47cnzX/k1NmP2ufp+P6HY+yHPJ74/dN5N5MP/OpaP/zBwf8AJtcs7OP7&#xA;v4uv9p/8a/zf0l6x+T5/3NyfNf8Ak1NlHap+n4/odh7I88nvj903nv5W6Faar5T0/wCsalBp/o2d&#xA;rx9cgc+Ue/GrL9nj+OQ02YwxiomW/T4Mu19Djz6qXHkjiqI+rrvLzHJ6n+XelW+meZzbwX0V+jIk&#xA;hmhIKglJxxNC2/w1yrW5TOIJHDz/AEOZ2BpYYMk4xnHIPQbj/wAlNuZeJeTj/wA6po//ADBwf8m1&#xA;zI0J9Dovab/Gv839Jetfk4f9zcvzX/k1NlXaB5fH9DsPZLnk98fum8k8n/8AKKaP/wAwcH/JtcOk&#xA;PocD2l/xr/N/SXrX5N/8duX5r/yamyvWnl8f0Ow9k+eT3x+6bz38rvLF3rnlXT/q9xBB9Xs7Xl67&#xA;Mtece3Git/LvkMOUQjvae1uzJ6rVS4DEcMR9RrmZeR7nqf5c6FcaL5na1nmind0jlDwMWUApcLQk&#xA;hd/hyGoyCQBH45OZ2DoZ6bJOEjEk8B9Jv+f5DueJeUD/AM6rpH/MHB/ybXJ4D6XR+0n+M/5v6S9a&#xA;/Jk/7m5fmn/JqbIag8nYeynOfvj903kflE/86tpH/MHB/wAm1wYjs4HtJ/jP+b+kvW/yX/47cvzT&#xA;/k1Nkcxdh7Kc5++P3Tefflb5S1LzD5WsfqUkMf1WztfU9ZnWvqR7U4q/8hyAlQZ9p9lZNXqZcBiO&#xA;GI531Mu4Hueqflz5dvtA80tZ3jxSSyJHMDCWZeLJcL+0qGtUwSlbl9idnz0uScJkEnhO3+f5DueH&#xA;eVP+UX0j/mDg/wCTYwAui9ov8Z+H6S9b/JT/AI7c3+sn/JqfAS7D2W5z98fum8j8qn/nV9I/5g4P&#xA;+TYyEi4HtF/jPw/SXrf5J/8AHbm/1k/5NT4guf7Lc5++P3Tec/lv5X1jXfLGn/o2NZPq1na+rydU&#xA;pzj+H7R/yTkZRssO1tBm1GpPhi+EC9wOZPe9W/K7QdS0TzM9pqCCOZ1jlVVYMOJjuFG491OGIpze&#xA;wdHk085xyCj6T0/p9zxPynPNF5Z0n05GStlb14kitIx4ZVlmQdnUe0H+M/D9JeufkpLLLrszSOzs&#xA;CgqxJNPSn8cOKRN25/sxzn74/dN4/wCWP+UZ0j/mCg/5NjKNSfV8HA9oP8Z+H63rv5H/APHcn/1k&#xA;/wCTU+S0x5uf7Mc5++P3Tebfl55Y1vXfLWn/AKMgE/1eytfWq6JTnH8P2ytfsnBnxGctu5r7W0Ob&#xA;PqT4ceKgL3A533kPWPyp0HVNF8zSWupQiGd1jlVQyv8AAY7hQaoWHVTktPjMSQfL9Lm9g6XJgnOO&#xA;QcJ9J6H+f3W8a8nX19a+WdK+q3EsHOyt+fpOyVpGKV4kVpXBnJEtu51fbuWcNSeEkbdPeXrf5MXV&#xA;1c6/NJczPPIDGoeRi5AEU5pVifHJae97c72bySnKZkSfp5+6bx7yv/yjOkf8wUH/ACbGOYbut9oP&#xA;8Z+H6S9d/JD/AI7k3+sn/JqfJYBzc/2Y5z98fum808geXtY1fyxpv6OtWufQs7b1eJUcecfw/aI6&#xA;8Tk5xstHbGjy59SfDjxUBfzL1j8ptH1LSfMclvqEBt5nEcioxBJUx3AB+EnupxhGnN9n9NkwznHI&#xA;OE+k/wC7eR+R9V1Ow8saX9Ru5rX1bO39T0XZOXGMUrxIrSpyw263t3UZMepPBKUbA5Ejqe56z+UG&#xA;oX995hlmvbiS5lX00WSVy7BRHOaVYnapOAOf7N5p5JTM5GR9PMk9J97xzyp/yi+kf8wcH/JsZOnV&#xA;e0X+M/D9Jeufkp/x25v9ZP8Ak1PgIdh7Lc5++P3TeY+QtF1XUvK+mfULWS59KztvU9MV48oxSvzo&#xA;csiNnG7c0uXLqTwRMqiOQvqXrH5S6ZqGneYZIb63e3lbg6pIKEqY5xX7wcE3O9m8E8UpiYMT6ef+&#xA;e8p8g6xqmm+VtM+oXUlt6tnbep6bceXGMUr8qnLMcbDgdu6rLi1J4JGNxHI11L1j8ptSv9Q8wyTX&#xA;073EqhEV5DUhRHOafeTkcopzvZvUTyymZyMj6ef+e8c8oj/nVdI/5g4P+Ta5dhHpdT7Sf4z/AJv6&#xA;S9a/Jj/jty/NP+TU2Qzjk7D2U5z98fum8v8AImmaje+VdK+pWs1z6dnb+p6MbSceUYpXiDStMtwk&#xA;CO5cXt/TZMupPBGUqiOQJ6nuesflJY3tlr8kV5byW0rcGCTIyMVMc4rRgNtshqCDVfjk53szhnjl&#xA;MTiYn08xXSbzH8t/MOsaP5V039G3HoevZ23q/Aj14R/D9tWpTkemW4MUZQ3cftntDNptUfClw8UR&#xA;ewPIy7we96r+WGs6lq/mR7nUJvXmRUjV+KJRRHOwFECjqxyvU4xEADz/AEOb7PazLqJzlkPFIcI6&#xA;Db19zxnyf/yimj/8wcH/ACbXMrRj0Ol9pf8AGv8AN/SXrX5N/wDHbl+a/wDJqbKtcOXx/Q7D2T55&#xA;PfH7pvLfItjeXXlTSfq0Ek/Czt+fpoz0rGKV4g+GX6OQGPc9XD9osM56r0xMvSOQvqXq/wCUlrc2&#xA;2vSJcRPC54MFkUqaenMK0NMq15BArz/Q5/stilCUxIGJ9PPbpN5r+WvmHV9H8p6b+jp/R9eztvV+&#xA;BHrwj+H7Yb+Y5bpMEMmP1C6P6nH7b7Rz6bVHwpcPFEXsDyMu8F6p+Wes6jq3mRrm/l9aZFSNW4qv&#xA;wiOdgKKAOrHKtdhjjAERXP8AQ5vs5rMuonOWQ8UhwDkBt6+6njfkwf8AOpaP/wAwcH/Jtczezh+7&#xA;+Lpfaf8Axr/N/SXrH5Pj/c3J81/5NTZR2oPp+P6HYeyPPJ74/dN5R5LH/OpaP/zBwf8AJtcyuzB+&#xA;6+Lrvaf/ABr/ADf0l6x+UH/Hbk+a/wDJqbMftcfT8f0Ox9keeT3x+6bzXyNomrS+TdEljtZGjksr&#xA;dkYCoIMS75b2dqMcMdSkAbavaHs/Pm1HFCEpR4envL1P8q9PvbTWz9ZhaLmRw5ClaRS1/XlHamaE&#xA;+HhN8/0Ob7MaPLhM/EiY2Y1fum//2Q==</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:dc='http://purl.org/dc/elements/1.1/'>
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?xpacket end='w'?>
+			</metadata>
+		<g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+			<g>
+				<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="5" y1="189" x2="5" y2="1.0005">
+					<stop  offset="0" style="stop-color:#2DB6E0"/>
+					<stop  offset="0.5225" style="stop-color:#01AD4E"/>
+					<stop  offset="1" style="stop-color:#2DB6E0"/>
+					<a:midPointStop  offset="0" style="stop-color:#2DB6E0"/>
+					<a:midPointStop  offset="0.5" style="stop-color:#2DB6E0"/>
+					<a:midPointStop  offset="0.5225" style="stop-color:#01AD4E"/>
+					<a:midPointStop  offset="0.5" style="stop-color:#01AD4E"/>
+					<a:midPointStop  offset="1" style="stop-color:#2DB6E0"/>
+				</linearGradient>
+				<rect y="1" i:knockout="Off" fill="url(#XMLID_2_)" width="10" height="188"/> 
+				<polygon i:knockout="Off" points="10,0 10,1 1,1 1,189 0,189 0,0 "/>
+				<polygon i:knockout="Off" fill="#808080" points="10,1 1,1 1,188 2,188 2,2 10,2 "/>
+				<polygon i:knockout="Off" fill="#C7C7C7" points="1,189 10,189 10,2 9,2 9,188 1,188 "/>
+				<rect x="3" y="21" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="39" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="93" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="75" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="57" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="111" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="165" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="147" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="129" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+			</g>
+		</g>
+	</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vslider_v3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+	<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+	<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+	<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+	<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+	<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg 
+	 xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="425 384" i:rulerOrigin="0 0" i:pageBounds="0 595.2754 841.8896 0"
+	 xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="10" height="189"
+	 viewBox="0 0 10 189" overflow="visible" enable-background="new 0 0 10 189" xml:space="preserve">
+	<metadata>
+		<variableSets  xmlns="http://ns.adobe.com/Variables/1.0/">
+			<variableSet  varSetName="binding1" locked="none">
+				<variables></variables>
+				<v:sampleDataSets  xmlns="http://ns.adobe.com/GenericCustomNamespace/1.0/" xmlns:v="http://ns.adobe.com/Variables/1.0/">
+					</v:sampleDataSets>
+			</variableSet>
+		</variableSets>
+		<sfw  xmlns="&ns_sfw;">
+			<slices></slices>
+			<sliceSourceBounds  y="195" x="425" width="10" height="189" bottomLeftOrigin="true"></sliceSourceBounds>
+		</sfw>
+		<x:xmpmeta  x:xmptk="XMP toolkit 3.0-29, framework 1.6" xmlns:x="adobe:ns:meta/">
+			<rdf:RDF  xmlns:iX="http://ns.adobe.com/iX/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+				<rdf:Description  rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:tiff="http://ns.adobe.com/tiff/1.0/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:xap="http://ns.adobe.com/xap/1.0/">
+					<xap:CreateDate>2005-12-20T11:59:27Z</xap:CreateDate>
+					<xap:ModifyDate>2005-12-20T11:59:39Z</xap:ModifyDate>
+					<xap:CreatorTool>Illustrator</xap:CreatorTool>
+					<xap:Thumbnails>
+						<rdf:Alt>
+							<rdf:li  rdf:parseType="Resource">
+								<xapGImg:format>JPEG</xapGImg:format>
+								<xapGImg:width>16</xapGImg:width>
+								<xapGImg:height>256</xapGImg:height>
+								<xapGImg:image>/9j/4AAQSkZJRgABAgEBLAEsAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABABLAAAAAEA
+AQEsAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AgmgaF5fPl/SpJNJs5ZZb
+OGSSSSBGZmZASSSN8uhAENU5kF63+RHlry8nmwajBpttbXlp8MMsESRkCaGYOCVHcLgyQATCRLzP
+y+tfLejf8wNv/wAQGWYuTDJzev8A5FCmtXHzj/5NT5HMnE8k8uLXy1o3/MDb/wDEBksXJjk5vXfy
+NFNbuPnH/wAmp8jmZYmBfll5Ztdb8saf6+pw6d9XsbTj61Pj5xmvGrJ9nj+OCEqCyjZeq/lrocGj
+eaZLaG+i1BXSKQzQ04glLheOzNv8NfpwZJWGUBTxHysK+V9G/wCYKD/k2MsxcmvJzet/koKa3N80
+/wCTU2RzMsTyjymtfKujf8wUH/JsZLFyY5eb1r8lxTW5vmn/ACamyOZliYF+Vvla413ypp/o3ENv
+9XsrXl6xIrzj2pQHpxwQnQWcbL1P8u9Am0TzO1rNNHOzpHKHiJKgFJ1puBv8ODJKwmEaeLeTVr5S
+0b/mCg/5NjLMXJhl5vWPyeFNbk+a/wDJqbI5mWLq8r8lLXyjo/8AzBwf8m1yWLkxy83q/wCUQprU
+nzX/AJNy5HMnEwL8qPLF/rnlDTvqkkSfV7O15+qWFece1OKt/LjCYiEzgSXqPkLQrvRfMv1W6eN5
+HRJQYixFCk6/tBd/hyOSVhOONF435DWvk7R/+YOD/k2uWYuTXl5vVvypFNab5j/k3LkczLC8t8gL
+Xybo/wDzCQf8mlyWLkxy83qv5WimtN8x/wAm5cjmZYerz78p9Bv9W8l6Z9UCn0bS258m4/aiFP8A
+iOMJgDdZwJOz1DyLpF3pfmIQXQUSOokHE8hxKSj+GDJIEbMscSHk35bSzR+StI9KRkraQV4kitIl
+8Mni5NeU7vUvy4klfXOUjs7dKsSTT05PHI5mWEvLfy3WvkjR/wDmFg/5NLksXJjl5vUvy3FNa/z/
+AN9yZHMyw9Xnv5R6Pfaj5H0v6qgf0rW351YLTlEtOvyxhIAboyRJOz0/yXpt1p/mBIblQkjLzABB
+2KSDt8sGSQPJliiRzeV/lXPcReRtJ9GV4+VrBy4MVrSJetMniAprykgvUPIks0uuK0sjSMNgzEsa
+cJNt8jmHJnhPN5V+WTU8jaP/AMwsP/JpMni5MM3N6j+XprrS/wCf+65Mhm6MsHV5p+U+m3995I0r
+6pCZfTtbfnQgU5RLTqR4YccgBuuSJJ2eoeRrG7s9fWK6jMUhHMKSD8JSQV2J8MjlIPJliiRzeUfl
+fqN7Z+SdJ+rTvDztLfnwJFaRLSv35LHEEMchIOz1H8v726u9eElzK0zgBQzmppwlNPxwZRScRJ5v
+Ivy9ankvR/8AmEg/5NLksXJjl5vVPyxNdaPzH/JuTI5mWF5l+WWmajfeTdK+pwNP6dpb+px7cohT
+9WHHIAboyRJOz1L8urG9svMHo3cTQyMA4VuvEpKK/hkcpBZYhTyn8tdX1HT/ACdpX1O4aD1bO39T
+j34xin68ljiCN2OSRB2ep/ltqN7f+YDNdzNNIoVAzdQojmNPxyOUAMsRt475HanlDR/+YOD/AJNr
+k8XJhl5vVvykNdbf5r/yblyOZlheW+QLDULzyjpP1O1mufTs7f1PRjaTjyjFK8QaVphxkAIyAkvV
+fyrs7y0194ruCS3kPFgkqMjFTHMK0YDbbI5TbLEHl35ceYtX0fynpn6OuPQ9eytvV+BHrwj+H7at
+/McOOII3RORB2eqfljrWo6t5je4v5vWmRUjVuKpRQk5AogUdWODJEDkyxknm8W8pNTyro3/MFB/y
+bGTxcmGXm9Z/Jg11ub5p/wAmpsjmZYnlPkyyvrrytpH1W3luOFlb8/SRnpWMUrxBpWmHGdkZBu9Z
+/J21u7bXpo7mGSCQ8GCSKUJBjnFaMBttkcpTiDzD8vPNOsaF5Y039GyrF9YsbX1eSK9eEfw/aB/m
+OGEQRus5EF6t+Vev6lrfmaW61CQSTIscSsqqnwhLhgKKB3Y5HJEBOORLw/y41PLOjf8AMDb/APEB
+k8XJhk5vXfyMaut3Hzj/AOTU+DMyxPHtBanlvRv+YG3/AOIDDi5Iyc3rv5Dmut3Pzj/5NT4MycTz
+Pyz5Y1+68raJPb2MkkL2FuVcAUIKD3xxyACziSXq35LaNqmm63L9etnt/VZPT5034xTVp8qjI5JA
+ssYIf//Z
+									</xapGImg:image>
+							</rdf:li>
+						</rdf:Alt>
+					</xap:Thumbnails>
+				</rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
+					<dc:format>image/svg+xml</dc:format>
+				</rdf:Description>
+			</rdf:RDF>
+		</x:xmpmeta>
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 3.0-29, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+
+ <rdf:Description rdf:about=''
+  xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:xap='http://ns.adobe.com/xap/1.0/'
+  xmlns:xapGImg='http://ns.adobe.com/xap/1.0/g/img/'>
+  <xap:CreateDate>2005-12-20T11:59:27Z</xap:CreateDate>
+  <xap:ModifyDate>2005-12-22T07:36:04Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li rdf:parseType='Resource'>
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>16</xapGImg:width>
+     <xapGImg:height>256</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAQAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AgmgaF5fPl/SpJNJs5ZZb&#xA;OGSSSSBGZmZASSSN8uhAENU5kF63+RHlry8nmwajBpttbXlp8MMsESRkCaGYOCVHcLgyQATCRLzP&#xA;y+tfLejf8wNv/wAQGWYuTDJzev8A5FCmtXHzj/5NT5HMnE8k8uLXy1o3/MDb/wDEBksXJjk5vXfy&#xA;NFNbuPnH/wAmp8jmZYmBfll5Ztdb8saf6+pw6d9XsbTj61Pj5xmvGrJ9nj+OCEqCyjZeq/lrocGj&#xA;eaZLaG+i1BXSKQzQ04glLheOzNv8NfpwZJWGUBTxHysK+V9G/wCYKD/k2MsxcmvJzet/koKa3N80&#xA;/wCTU2RzMsTyjymtfKujf8wUH/JsZLFyY5eb1r8lxTW5vmn/ACamyOZliYF+Vvla413ypp/o3ENv&#xA;9XsrXl6xIrzj2pQHpxwQnQWcbL1P8u9Am0TzO1rNNHOzpHKHiJKgFJ1puBv8ODJKwmEaeLeTVr5S&#xA;0b/mCg/5NjLMXJhl5vWPyeFNbk+a/wDJqbI5mWLq8r8lLXyjo/8AzBwf8m1yWLkxy83q/wCUQprU&#xA;nzX/AJNy5HMnEwL8qPLF/rnlDTvqkkSfV7O15+qWFece1OKt/LjCYiEzgSXqPkLQrvRfMv1W6eN5&#xA;HRJQYixFCk6/tBd/hyOSVhOONF435DWvk7R/+YOD/k2uWYuTXl5vVvypFNab5j/k3LkczLC8t8gL&#xA;Xybo/wDzCQf8mlyWLkxy83qv5WimtN8x/wAm5cjmZYerz78p9Bv9W8l6Z9UCn0bS258m4/aiFP8A&#xA;iOMJgDdZwJOz1DyLpF3pfmIQXQUSOokHE8hxKSj+GDJIEbMscSHk35bSzR+StI9KRkraQV4kitIl&#xA;8Mni5NeU7vUvy4klfXOUjs7dKsSTT05PHI5mWEvLfy3WvkjR/wDmFg/5NLksXJjl5vUvy3FNa/z/&#xA;AN9yZHMyw9Xnv5R6Pfaj5H0v6qgf0rW351YLTlEtOvyxhIAboyRJOz0/yXpt1p/mBIblQkjLzABB&#xA;2KSDt8sGSQPJliiRzeV/lXPcReRtJ9GV4+VrBy4MVrSJetMniAprykgvUPIks0uuK0sjSMNgzEsa&#xA;cJNt8jmHJnhPN5V+WTU8jaP/AMwsP/JpMni5MM3N6j+XprrS/wCf+65Mhm6MsHV5p+U+m3995I0r&#xA;6pCZfTtbfnQgU5RLTqR4YccgBuuSJJ2eoeRrG7s9fWK6jMUhHMKSD8JSQV2J8MjlIPJliiRzeUfl&#xA;fqN7Z+SdJ+rTvDztLfnwJFaRLSv35LHEEMchIOz1H8v726u9eElzK0zgBQzmppwlNPxwZRScRJ5v&#xA;Ivy9ankvR/8AmEg/5NLksXJjl5vVPyxNdaPzH/JuTI5mWF5l+WWmajfeTdK+pwNP6dpb+px7cohT&#xA;9WHHIAboyRJOz1L8urG9svMHo3cTQyMA4VuvEpKK/hkcpBZYhTyn8tdX1HT/ACdpX1O4aD1bO39T&#xA;j34xin68ljiCN2OSRB2ep/ltqN7f+YDNdzNNIoVAzdQojmNPxyOUAMsRt475HanlDR/+YOD/AJNr&#xA;k8XJhl5vVvykNdbf5r/yblyOZlheW+QLDULzyjpP1O1mufTs7f1PRjaTjyjFK8QaVphxkAIyAkvV&#xA;fyrs7y0194ruCS3kPFgkqMjFTHMK0YDbbI5TbLEHl35ceYtX0fynpn6OuPQ9eytvV+BHrwj+H7at&#xA;/McOOII3RORB2eqfljrWo6t5je4v5vWmRUjVuKpRQk5AogUdWODJEDkyxknm8W8pNTyro3/MFB/y&#xA;bGTxcmGXm9Z/Jg11ub5p/wAmpsjmZYnlPkyyvrrytpH1W3luOFlb8/SRnpWMUrxBpWmHGdkZBu9Z&#xA;/J21u7bXpo7mGSCQ8GCSKUJBjnFaMBttkcpTiDzD8vPNOsaF5Y039GyrF9YsbX1eSK9eEfw/aB/m&#xA;OGEQRus5EF6t+Vev6lrfmaW61CQSTIscSsqqnwhLhgKKB3Y5HJEBOORLw/y41PLOjf8AMDb/APEB&#xA;k8XJhk5vXfyMaut3Hzj/AOTU+DMyxPHtBanlvRv+YG3/AOIDDi5Iyc3rv5Dmut3Pzj/5NT4MycTz&#xA;Pyz5Y1+68raJPb2MkkL2FuVcAUIKD3xxyACziSXq35LaNqmm63L9etnt/VZPT5034xTVp8qjI5JA&#xA;ssYIf//Z</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:dc='http://purl.org/dc/elements/1.1/'>
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?xpacket end='w'?>
+			</metadata>
+		<g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+			<g>
+				<radialGradient id="XMLID_2_" cx="0.1025" cy="3.1621" r="179.8225" fx="0.1025" fy="3.1621" gradientUnits="userSpaceOnUse">
+					<stop  offset="0" style="stop-color:#5D6877"/>
+					<stop  offset="0.5337" style="stop-color:#9CACBD"/>
+					<stop  offset="1" style="stop-color:#5D6877"/>
+					<a:midPointStop  offset="0" style="stop-color:#5D6877"/>
+					<a:midPointStop  offset="0.5" style="stop-color:#5D6877"/>
+					<a:midPointStop  offset="0.5337" style="stop-color:#9CACBD"/>
+					<a:midPointStop  offset="0.5" style="stop-color:#9CACBD"/>
+					<a:midPointStop  offset="1" style="stop-color:#5D6877"/>
+				</radialGradient>
+				<rect y="1" i:knockout="Off" fill="url(#XMLID_2_)" width="10" height="188"/> 
+				<polygon i:knockout="Off" points="10,0 10,1 1,1 1,189 0,189 0,0 "/>
+				<polygon i:knockout="Off" fill="#808080" points="10,1 1,1 1,188 2,188 2,2 10,2 "/>
+				<polygon i:knockout="Off" fill="#C7C7C7" points="1,189 10,189 10,2 9,2 9,188 1,188 "/>
+				<rect x="3" y="21" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="39" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="93" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="75" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="57" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="111" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="165" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="147" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+				<rect x="3" y="129" i:knockout="Off" fill="#E5E5E5" width="5" height="2"/> 
+			</g>
+		</g>
+	</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vslider_v4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+	<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+	<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+	<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+	<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+	<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg 
+	 xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="428 383" i:rulerOrigin="0 0" i:pageBounds="0 595.2754 841.8896 0"
+	 xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="3" height="187"
+	 viewBox="0 0 3 187" overflow="visible" enable-background="new 0 0 3 187" xml:space="preserve">
+	<metadata>
+		<variableSets  xmlns="http://ns.adobe.com/Variables/1.0/">
+			<variableSet  varSetName="binding1" locked="none">
+				<variables></variables>
+				<v:sampleDataSets  xmlns="http://ns.adobe.com/GenericCustomNamespace/1.0/" xmlns:v="http://ns.adobe.com/Variables/1.0/">
+					</v:sampleDataSets>
+			</variableSet>
+		</variableSets>
+		<sfw  xmlns="&ns_sfw;">
+			<slices></slices>
+			<sliceSourceBounds  y="196" x="428" width="3" height="187" bottomLeftOrigin="true"></sliceSourceBounds>
+		</sfw>
+		<x:xmpmeta  x:xmptk="XMP toolkit 3.0-29, framework 1.6" xmlns:x="adobe:ns:meta/">
+			<rdf:RDF  xmlns:iX="http://ns.adobe.com/iX/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+				<rdf:Description  rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:tiff="http://ns.adobe.com/tiff/1.0/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:xap="http://ns.adobe.com/xap/1.0/">
+					<xap:CreateDate>2005-12-20T12:00:19Z</xap:CreateDate>
+					<xap:ModifyDate>2005-12-20T12:00:25Z</xap:ModifyDate>
+					<xap:CreatorTool>Illustrator</xap:CreatorTool>
+					<xap:Thumbnails>
+						<rdf:Alt>
+							<rdf:li  rdf:parseType="Resource">
+								<xapGImg:format>JPEG</xapGImg:format>
+								<xapGImg:width>4</xapGImg:width>
+								<xapGImg:height>256</xapGImg:height>
+								<xapGImg:image>/9j/4AAQSkZJRgABAgEBLAEsAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABABLAAAAAEA
+AQEsAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAEAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AhOZTjOxV2KsV/Rv5gf8A
+V2t/+Ra/9UshUu9nce5lWTYOxViX/IRv+Xb/AITK/Uz9LLcsYOxViP6Z8+/9WiL7/wDr5ldy7mdR
+72XZYwdirEf8V+Zv+pfl/wCH/wCaMr4j3M+Ed7LssYOxViX+P/8AtVXP+f0ZXx+TPg82W5YwdirE
+/wDlZOhf74uv+Aj/AOqmV+IGfhllmWMHYqx7/Hvlr/lof/kW/wDTIeIGXAU1/Q2j/wDLDb/8ik/p
+kqCLKMwoSj/Fnlz/AJb4/wAf6ZHiCeEqn+GvL/8A1b4P+AGHhC8RTPChAfp7Qv8Aq42v/I6P/mrB
+xBPCUD/gfyv/AMsX/JWb/mvBwBPGU9yTF2KuxV//2Q==
+									</xapGImg:image>
+							</rdf:li>
+						</rdf:Alt>
+					</xap:Thumbnails>
+				</rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
+					<dc:format>image/svg+xml</dc:format>
+				</rdf:Description>
+			</rdf:RDF>
+		</x:xmpmeta>
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 3.0-29, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+
+ <rdf:Description rdf:about=''
+  xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:xap='http://ns.adobe.com/xap/1.0/'
+  xmlns:xapGImg='http://ns.adobe.com/xap/1.0/g/img/'>
+  <xap:CreateDate>2005-12-20T12:00:19Z</xap:CreateDate>
+  <xap:ModifyDate>2005-12-22T07:36:17Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li rdf:parseType='Resource'>
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>4</xapGImg:width>
+     <xapGImg:height>256</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAAAEAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AhOZTjOxV2KsV/Rv5gf8A&#xA;V2t/+Ra/9UshUu9nce5lWTYOxViX/IRv+Xb/AITK/Uz9LLcsYOxViP6Z8+/9WiL7/wDr5ldy7mdR&#xA;72XZYwdirEf8V+Zv+pfl/wCH/wCaMr4j3M+Ed7LssYOxViX+P/8AtVXP+f0ZXx+TPg82W5YwdirE&#xA;/wDlZOhf74uv+Aj/AOqmV+IGfhllmWMHYqx7/Hvlr/lof/kW/wDTIeIGXAU1/Q2j/wDLDb/8ik/p&#xA;kqCLKMwoSj/Fnlz/AJb4/wAf6ZHiCeEqn+GvL/8A1b4P+AGHhC8RTPChAfp7Qv8Aq42v/I6P/mrB&#xA;xBPCUD/gfyv/AMsX/JWb/mvBwBPGU9yTF2KuxV//2Q==</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:dc='http://purl.org/dc/elements/1.1/'>
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?xpacket end='w'?>
+			</metadata>
+		<g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+			<g>
+				<rect i:knockout="Off" fill="#515A66" width="3" height="187"/> 
+				<rect y="19" i:knockout="Off" width="3" height="2"/> 
+				<rect y="37" i:knockout="Off" width="3" height="2"/> 
+				<rect y="73" i:knockout="Off" width="3" height="2"/> 
+				<rect y="55" i:knockout="Off" width="3" height="2"/> 
+				<rect y="163" i:knockout="Off" width="3" height="2"/> 
+				<rect y="145" i:knockout="Off" width="3" height="2"/> 
+				<rect y="127" i:knockout="Off" width="3" height="2"/> 
+				<rect y="91" i:knockout="Off" width="3" height="2"/> 
+				<rect y="109" i:knockout="Off" width="3" height="2"/> 
+			</g>
+		</g>
+	</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ied_vtab.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 11.0, SVG Export Plug-In . SVG Version: 6.0.0 Build 78)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
+	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
+	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
+	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
+	<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
+	<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
+	<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
+	<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
+	<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg 
+	 xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" i:viewOrigin="416 310" i:rulerOrigin="0 0" i:pageBounds="0 595.2754 841.8896 0"
+	 xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="10" height="24"
+	 viewBox="0 0 10 24" overflow="visible" enable-background="new 0 0 10 24" xml:space="preserve">
+	<metadata>
+		<variableSets  xmlns="http://ns.adobe.com/Variables/1.0/">
+			<variableSet  varSetName="binding1" locked="none">
+				<variables></variables>
+				<v:sampleDataSets  xmlns="http://ns.adobe.com/GenericCustomNamespace/1.0/" xmlns:v="http://ns.adobe.com/Variables/1.0/">
+					</v:sampleDataSets>
+			</variableSet>
+		</variableSets>
+		<sfw  xmlns="&ns_sfw;">
+			<slices></slices>
+			<sliceSourceBounds  y="286" x="416" width="10" height="24" bottomLeftOrigin="true"></sliceSourceBounds>
+		</sfw>
+		<x:xmpmeta  x:xmptk="XMP toolkit 3.0-29, framework 1.6" xmlns:x="adobe:ns:meta/">
+			<rdf:RDF  xmlns:iX="http://ns.adobe.com/iX/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+				<rdf:Description  rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:tiff="http://ns.adobe.com/tiff/1.0/"></rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:xap="http://ns.adobe.com/xap/1.0/">
+					<xap:CreateDate>2005-12-19T09:01:32Z</xap:CreateDate>
+					<xap:ModifyDate>2005-12-19T09:01:40Z</xap:ModifyDate>
+					<xap:CreatorTool>Illustrator</xap:CreatorTool>
+					<xap:Thumbnails>
+						<rdf:Alt>
+							<rdf:li  rdf:parseType="Resource">
+								<xapGImg:format>JPEG</xapGImg:format>
+								<xapGImg:width>108</xapGImg:width>
+								<xapGImg:height>256</xapGImg:height>
+								<xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA
+AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAABsAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A7BhQ7FXYq7FXYq7FXYq7
+FXYq7FXYq7FXYqmP/TOf9Hv/ADJxS+e/+Vuecv8AfsH/ACKXArOPJvnHWdU0g3N4Y2lErJVU4igA
+I2B98VT39N3ngn3H+uKu/Td54J9x/rirv03eeCfcf64q79N3ngn3H+uKu/Td54J9x/rirv03eeCf
+cf64q79N3ngn3H+uKu/Td54J9x/rirv03eeCfcf64q79N3ngn3H+uKp9hQmP/TOf9Hv/ADJxS+R8
+CvUPy3/5R5v+Yh/+IrirKsVdirsVdiq5YpXR5EQtHH/eMOgxVbirsVdirsVdirLcKEx/6Zz/AKPf
++ZOKXyPgV6h+W/8Ayjzf8xD/APEVxVlWKuxV2Ksf81earfRrf046SahIP3UXZR/O/t4DvirX5aef
+bmblpurmqcibe9NAOTmpjfp3Ox7YqzXUtLCAzW60UbvGO3uMVSvFXYq7FXYqy3ChMf8ApnP+j3/m
+Til8j4Feoflv/wAo83/MQ/8AxFcVZVirsVY/5q81W+jW/px0k1CQfuouyj+d/bwHfFXm1vb3mrXj
+3Fw7NyblNM3UnwH+e2KsjhhjhjWONeKLsAMVZz5P84ceGm6k/wAOy29wx6eCOf1HFWRanpnGs8A+
+Hq6Dt7jFUqxV2KuxVluFCY/9M5/0e/8AMnFL5HwK9Q/Lf/lHm/5iH/4iuKsqxVj/AJq81W+jW/px
+0k1CQfuouyj+d/bwHfFXm1vb3mrXklxcSMxZuU0zdST2H+e2KsjhhjhjWONeKLsAMVX4q7FWbeT/
+ADhx4abqT/DstvcMengjn9RxVkWp6ZxrPAPh6ug7e4xVKsVdirLcKEx/6Zz/AKPf+ZOKXyPgV6h+
+W/8Ayjzf8xD/APEVxVPdXl1KOxc6bAJ7s/DGrMFVa/tHkRWnhirzmfyT5uurh57iIPNIeTyPKhJP
+0HFVn/KvvM3++Y/+Ri/1xV3/ACr7zN/vmP8A5GL/AFxV3/KvvM3++Y/+Ri/1xV3/ACr7zN/vmP8A
+5GL/AFxV3/KvvM3++Y/+Ri/1xV6T5H1LzHYWn6P12L1YYhS1uldXcAfsOK1I8Diqa3r2kknO3DLy
++0hAAr7UOKofFWW4UJj/ANM5/wBHv/MnFL5HwK9Q/Lf/AJR5v+Yh/wDiK4qyrFXYq7FXYq7FXYq7
+FXYq7FXYqy3ChMf+mc/6Pf8AmTil8j4Feoflv/yjzf8AMQ//ABFcVZVirsVdirsVdirsVdirsVdi
+rsVZbhQmP/TOf9Hv/MnFL5HwK9Q/Lf8A5R5v+Yh/+IriqO84aveaVpIubQqJTKqVYchQgnp9GKsJ
+/wCVheY/54v+RYxV3/KwvMf88X/IsYq7/lYXmP8Ani/5FjFXf8rC8x/zxf8AIsYq7/lYXmP+eL/k
+WMVd/wArC8x/zxf8ixirv+VheY/54v8AkWMVTryl5t1jVNYW1umQwlHYhUCmqjbfFWcYqy3ChMf+
+mc/6Pf8AmTil8j4Feoflv/yjzf8AMQ//ABFcVTTzL5fvte04WNk0azCRZCZSVXioIO4DeOKsW/5V
+D5p/37af8jH/AOqeGld/yqHzT/v20/5GP/1TxpXf8qh80/79tP8AkY//AFTxpXf8qh80/wC/bT/k
+Y/8A1TxpXf8AKofNP+/bT/kY/wD1TxpXf8qh80/79tP+Rj/9U8aV3/KofNP+/bT/AJGP/wBU8aVM
+/Ln5fa5oeprf3kkDQhGQiJ2ZqsNtiq4FZZirLcKEx/6Zz/o9/wCZOKXyPgV6h+W//KPN/wAxD/8A
+EVxVm2k/71H/AFT/AAxCpzhQ7FXYq7FXYq7FXYqg9V/3kP8ArDFUmwJZbhQmP/TOf9Hv/MnFL5Hw
+K9Q/Lf8A5R5v+Yh/+IrirKsVdirsVdirsVdirsVdirsVdirLcKEx/wCmc/6Pf+ZOKXyPgV6h+W//
+ACjzf8xD/wDEVxVlWKuxV2KuxV2KuxV2KuxV2KuxVluFCY/9M5/0e/8AMnFL5HwK9Q/Lf/lHm/5i
+H/4iuKp5rGsWmk2guroOYi4T4ACakE9yPDFUk/5WN5f/AJZ/+AX/AJqxV3/KxvL/APLP/wAAv/NW
+Ku/5WN5f/ln/AOAX/mrFXf8AKxvL/wDLP/wC/wDNWKu/5WN5f/ln/wCAX/mrFXf8rG8v/wAs/wDw
+C/8ANWKu/wCVjeX/AOWf/gF/5qxVG6R5w0nVbwWlsJRKVLDmoAovXoTiqeYqy3ChMf8ApnP+j3/m
+Til8j4Feoflv/wAo83/MQ/8AxFcVb/Mb/lH1/wCM6f8AEWxV5jirsVdirsVdirsVdirJfy9/5SNP
++MUn6sVepYqy3ChMf+mc/wCj3/mTil8j4Feoflv/AMo83/MQ/wDxFcVZtpP+9R/1T/DEKnOFDsVd
+irsVdirsVdiqD1X/AHkP+sMVSbAlluFCY/8ATOf9Hv8AzJxS+R8CvUPy3/5R5v8AmIf/AIiuKsut
+7h4H5pStKb4qiP0tdeC/d/bjau/S114L939uNq79LXXgv3f242rv0tdeC/d/bjau/S114L939uNq
+79LXXgv3f242rv0tdeC/d/bjaqc9/PNHwfjxrXYeGKofFWW4UJj/ANM5/wBHv/MnFL5HwK9Q/Lf/
+AJR5v+Yh/wDiK4qyrFXYq7FXYq7FXYq7FXYq7FXYqy3ChMf+mc/6Pf8AmTil8j4Feoflv/yjzf8A
+MQ//ABFcVZVirsVdirsVdirsVdirsVdirsVZbhQmP/TOf9Hv/MnFL5HwK9Q/Lf8A5R5v+Yh/+Iri
+rf5jf8o+v/GdP+ItirzHFXYq7FXYq7FXYq7FWS/l7/ykaf8AGKT9WKvUsVZbhQmP/TOf9Hv/ADJx
+S+R8CvUPy3/5R5v+Yh/+IrirJptC0/W1+p36s0APqUVip5LsNx88VUf+VV+T/wDfEv8AyNbDSu/5
+VX5P/wB8S/8AI1saV3/Kq/J/++Jf+RrY0rv+VV+T/wDfEv8AyNbGld/yqvyf/viX/ka2NK7/AJVX
+5P8A98S/8jWxpXf8qr8n/wC+Jf8Aka2NKvi8i+XtGf67YxyJOvwAtIzCjddjiqvgVluFCY/9M5/0
+e/8AMnFL5HwK9Q/Lf/lHm/5iH/4iuKsysJ44Z+b148SNt8VTH9K2ni33YUO/Stp4t92Ku/Stp4t9
+2Ku/Stp4t92Ku/Stp4t92Ku/Stp4t92Ku/Stp4t92Koe+vrea3KITyqDuMUpdgVluFCY/wDTOf8A
+R7/zJxS+R8CvUPy3/wCUeb/mIf8A4iuKsqxV2KuxV2KuxV2KuxV2KuxV2KstwoTH/pnP+j3/AJk4
+pfI+BXqH5b/8o83/ADEP/wARXFWVYq7FXYq7FXYq7FXYq7FXYq7FWW4UJj/0zn/R7/zJxS+R8CvU
+Py3/AOUeb/mIf/iK4qymg5LUngD8YWlSPaoIxVObfSLCWNZY5pJEYbbr/wA0jCqr+hLP+Z/vH9MV
+d+hLP+Z/vH9MVd+hLP8Amf7x/TFXfoSz/mf7x/TFXfoSz/mf7x/TFWjodof2pB9I/piqUXaWqy8b
+Z3dV2Z2KlSfagH34FUsVZbhQmP8A0zn/AEe/8ycUvkfAr1D8t/8AlHm/5iH/AOIrirKsVSPzP5cG
+rW3OCQwX0Y/dSAkBv8l6dvftirzi31LVNLvHtroyji3GaJmNVPiN/wDbxVkMV48sayRzMyMKghji
+q715/wDfjfecVd68/wDvxvvOKpJrGvT721vM3hJIGP3DFU+8meVrqbhqWpvJ6OzW9szH4/B3H8vg
+O/y6qs9xV2KstwoTH/pnP+j3/mTil8j4Feoflv8A8o83/MQ//EVxVlWKuxVj/mryrb6zb+pHSPUI
+x+6l7MP5H9vA9sVecW1zd6TdvbXKMoVuM0LdQfEf574qyKKWOWNZI2DIwqCMVSbV9XpytrZt+kkg
+/UMVTzyX5L9b09T1OP8Ac7NbWzD7Xg7j+XwHf5dVXoWKuxV2KstwoTH/AKZz/o9/5k4pfI+BXqH5
+b/8AKPN/zEP/AMRXFWVYq7FXYqx/zV5Vt9Zt/UjpHqEY/dS9mH8j+3ge2KvMXk1DT2nsn5QuDxlj
+PUEeGKss8leTBOI9U1JKw7NbW7ft+DuP5fAd/l1VehYq7FXYq7FWW4UJj/0zn/R7/wAycUvkfAr1
+D8t/+Ueb/mIf/iK4qyrFXYq7FXYqlepeW9I1G8gu7qEPNAfkHA6K4/aAP+dMVTPFW8VdirsVdirL
+cKEx/wCmc/6Pf+ZOKXyPgVmvlDzfpOkaSbW6EplMrP8AAoIoQB3I8MVTv/lZHl7+W4/4Bf8AmrFX
+f8rI8vfy3H/AL/zVirv+VkeXv5bj/gF/5qxV3/KyPL38tx/wC/8ANWKu/wCVkeXv5bj/AIBf+asV
+d/ysjy9/Lcf8Av8AzVirv+VkeXv5bj/gF/5qxV3/ACsjy9/Lcf8AAL/zVirv+VkeXv5bj/gF/wCa
+sVd/ysjy9/Lcf8Av/NWKp7/yuPyn/vu7/wCRaf8ANeKsj/5WJoH/ACrz9O8Z/qX6U+rceC+pz9Dl
+05UpT3xV834q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq9G/wDKBf8Agxf9iuKv/9k=
+									</xapGImg:image>
+							</rdf:li>
+						</rdf:Alt>
+					</xap:Thumbnails>
+				</rdf:Description>
+				<rdf:Description  rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
+					<dc:format>image/svg+xml</dc:format>
+				</rdf:Description>
+			</rdf:RDF>
+		</x:xmpmeta>
+<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='XMP toolkit 3.0-29, framework 1.6'>
+<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'>
+
+ <rdf:Description rdf:about=''
+  xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:xap='http://ns.adobe.com/xap/1.0/'
+  xmlns:xapGImg='http://ns.adobe.com/xap/1.0/g/img/'>
+  <xap:CreateDate>2005-12-19T09:01:32Z</xap:CreateDate>
+  <xap:ModifyDate>2005-12-22T07:35:20Z</xap:ModifyDate>
+  <xap:CreatorTool>Illustrator</xap:CreatorTool>
+  <xap:Thumbnails>
+   <rdf:Alt>
+    <rdf:li rdf:parseType='Resource'>
+     <xapGImg:format>JPEG</xapGImg:format>
+     <xapGImg:width>108</xapGImg:width>
+     <xapGImg:height>256</xapGImg:height>
+     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAABsAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A7BhQ7FXYq7FXYq7FXYq7&#xA;FXYq7FXYq7FXYqmP/TOf9Hv/ADJxS+e/+Vuecv8AfsH/ACKXArOPJvnHWdU0g3N4Y2lErJVU4igA&#xA;I2B98VT39N3ngn3H+uKu/Td54J9x/rirv03eeCfcf64q79N3ngn3H+uKu/Td54J9x/rirv03eeCf&#xA;cf64q79N3ngn3H+uKu/Td54J9x/rirv03eeCfcf64q79N3ngn3H+uKp9hQmP/TOf9Hv/ADJxS+R8&#xA;CvUPy3/5R5v+Yh/+IrirKsVdirsVdiq5YpXR5EQtHH/eMOgxVbirsVdirsVdirLcKEx/6Zz/AKPf&#xA;+ZOKXyPgV6h+W/8Ayjzf8xD/APEVxVlWKuxV2Ksf81earfRrf046SahIP3UXZR/O/t4DvirX5aef&#xA;bmblpurmqcibe9NAOTmpjfp3Ox7YqzXUtLCAzW60UbvGO3uMVSvFXYq7FXYqy3ChMf8ApnP+j3/m&#xA;Til8j4Feoflv/wAo83/MQ/8AxFcVZVirsVY/5q81W+jW/px0k1CQfuouyj+d/bwHfFXm1vb3mrXj&#xA;3Fw7NyblNM3UnwH+e2KsjhhjhjWONeKLsAMVZz5P84ceGm6k/wAOy29wx6eCOf1HFWRanpnGs8A+&#xA;Hq6Dt7jFUqxV2KuxVluFCY/9M5/0e/8AMnFL5HwK9Q/Lf/lHm/5iH/4iuKsqxVj/AJq81W+jW/px&#xA;0k1CQfuouyj+d/bwHfFXm1vb3mrXklxcSMxZuU0zdST2H+e2KsjhhjhjWONeKLsAMVX4q7FWbeT/&#xA;ADhx4abqT/DstvcMengjn9RxVkWp6ZxrPAPh6ug7e4xVKsVdirLcKEx/6Zz/AKPf+ZOKXyPgV6h+&#xA;W/8Ayjzf8xD/APEVxVPdXl1KOxc6bAJ7s/DGrMFVa/tHkRWnhirzmfyT5uurh57iIPNIeTyPKhJP&#xA;0HFVn/KvvM3++Y/+Ri/1xV3/ACr7zN/vmP8A5GL/AFxV3/KvvM3++Y/+Ri/1xV3/ACr7zN/vmP8A&#xA;5GL/AFxV3/KvvM3++Y/+Ri/1xV6T5H1LzHYWn6P12L1YYhS1uldXcAfsOK1I8Diqa3r2kknO3DLy&#xA;+0hAAr7UOKofFWW4UJj/ANM5/wBHv/MnFL5HwK9Q/Lf/AJR5v+Yh/wDiK4qyrFXYq7FXYq7FXYq7&#xA;FXYq7FXYqy3ChMf+mc/6Pf8AmTil8j4Feoflv/yjzf8AMQ//ABFcVZVirsVdirsVdirsVdirsVdi&#xA;rsVZbhQmP/TOf9Hv/MnFL5HwK9Q/Lf8A5R5v+Yh/+IriqO84aveaVpIubQqJTKqVYchQgnp9GKsJ&#xA;/wCVheY/54v+RYxV3/KwvMf88X/IsYq7/lYXmP8Ani/5FjFXf8rC8x/zxf8AIsYq7/lYXmP+eL/k&#xA;WMVd/wArC8x/zxf8ixirv+VheY/54v8AkWMVTryl5t1jVNYW1umQwlHYhUCmqjbfFWcYqy3ChMf+&#xA;mc/6Pf8AmTil8j4Feoflv/yjzf8AMQ//ABFcVTTzL5fvte04WNk0azCRZCZSVXioIO4DeOKsW/5V&#xA;D5p/37af8jH/AOqeGld/yqHzT/v20/5GP/1TxpXf8qh80/79tP8AkY//AFTxpXf8qh80/wC/bT/k&#xA;Y/8A1TxpXf8AKofNP+/bT/kY/wD1TxpXf8qh80/79tP+Rj/9U8aV3/KofNP+/bT/AJGP/wBU8aVM&#xA;/Ln5fa5oeprf3kkDQhGQiJ2ZqsNtiq4FZZirLcKEx/6Zz/o9/wCZOKXyPgV6h+W//KPN/wAxD/8A&#xA;EVxVm2k/71H/AFT/AAxCpzhQ7FXYq7FXYq7FXYqg9V/3kP8ArDFUmwJZbhQmP/TOf9Hv/MnFL5Hw&#xA;K9Q/Lf8A5R5v+Yh/+IrirKsVdirsVdirsVdirsVdirsVdirLcKEx/wCmc/6Pf+ZOKXyPgV6h+W//&#xA;ACjzf8xD/wDEVxVlWKuxV2KuxV2KuxV2KuxV2KuxVluFCY/9M5/0e/8AMnFL5HwK9Q/Lf/lHm/5i&#xA;H/4iuKp5rGsWmk2guroOYi4T4ACakE9yPDFUk/5WN5f/AJZ/+AX/AJqxV3/KxvL/APLP/wAAv/NW&#xA;Ku/5WN5f/ln/AOAX/mrFXf8AKxvL/wDLP/wC/wDNWKu/5WN5f/ln/wCAX/mrFXf8rG8v/wAs/wDw&#xA;C/8ANWKu/wCVjeX/AOWf/gF/5qxVG6R5w0nVbwWlsJRKVLDmoAovXoTiqeYqy3ChMf8ApnP+j3/m&#xA;Til8j4Feoflv/wAo83/MQ/8AxFcVb/Mb/lH1/wCM6f8AEWxV5jirsVdirsVdirsVdirJfy9/5SNP&#xA;+MUn6sVepYqy3ChMf+mc/wCj3/mTil8j4Feoflv/AMo83/MQ/wDxFcVZtpP+9R/1T/DEKnOFDsVd&#xA;irsVdirsVdiqD1X/AHkP+sMVSbAlluFCY/8ATOf9Hv8AzJxS+R8CvUPy3/5R5v8AmIf/AIiuKsut&#xA;7h4H5pStKb4qiP0tdeC/d/bjau/S114L939uNq79LXXgv3f242rv0tdeC/d/bjau/S114L939uNq&#xA;79LXXgv3f242rv0tdeC/d/bjaqc9/PNHwfjxrXYeGKofFWW4UJj/ANM5/wBHv/MnFL5HwK9Q/Lf/&#xA;AJR5v+Yh/wDiK4qyrFXYq7FXYq7FXYq7FXYq7FXYqy3ChMf+mc/6Pf8AmTil8j4Feoflv/yjzf8A&#xA;MQ//ABFcVZVirsVdirsVdirsVdirsVdirsVZbhQmP/TOf9Hv/MnFL5HwK9Q/Lf8A5R5v+Yh/+Iri&#xA;rf5jf8o+v/GdP+ItirzHFXYq7FXYq7FXYq7FWS/l7/ykaf8AGKT9WKvUsVZbhQmP/TOf9Hv/ADJx&#xA;S+R8CvUPy3/5R5v+Yh/+IrirJptC0/W1+p36s0APqUVip5LsNx88VUf+VV+T/wDfEv8AyNbDSu/5&#xA;VX5P/wB8S/8AI1saV3/Kq/J/++Jf+RrY0rv+VV+T/wDfEv8AyNbGld/yqvyf/viX/ka2NK7/AJVX&#xA;5P8A98S/8jWxpXf8qr8n/wC+Jf8Aka2NKvi8i+XtGf67YxyJOvwAtIzCjddjiqvgVluFCY/9M5/0&#xA;e/8AMnFL5HwK9Q/Lf/lHm/5iH/4iuKsysJ44Z+b148SNt8VTH9K2ni33YUO/Stp4t92Ku/Stp4t9&#xA;2Ku/Stp4t92Ku/Stp4t92Ku/Stp4t92Ku/Stp4t92Koe+vrea3KITyqDuMUpdgVluFCY/wDTOf8A&#xA;R7/zJxS+R8CvUPy3/wCUeb/mIf8A4iuKsqxV2KuxV2KuxV2KuxV2KuxV2KstwoTH/pnP+j3/AJk4&#xA;pfI+BXqH5b/8o83/ADEP/wARXFWVYq7FXYq7FXYq7FXYq7FXYq7FWW4UJj/0zn/R7/zJxS+R8CvU&#xA;Py3/AOUeb/mIf/iK4qymg5LUngD8YWlSPaoIxVObfSLCWNZY5pJEYbbr/wA0jCqr+hLP+Z/vH9MV&#xA;d+hLP+Z/vH9MVd+hLP8Amf7x/TFXfoSz/mf7x/TFXfoSz/mf7x/TFWjodof2pB9I/piqUXaWqy8b&#xA;Z3dV2Z2KlSfagH34FUsVZbhQmP8A0zn/AEe/8ycUvkfAr1D8t/8AlHm/5iH/AOIrirKsVSPzP5cG&#xA;rW3OCQwX0Y/dSAkBv8l6dvftirzi31LVNLvHtroyji3GaJmNVPiN/wDbxVkMV48sayRzMyMKghji&#xA;q715/wDfjfecVd68/wDvxvvOKpJrGvT721vM3hJIGP3DFU+8meVrqbhqWpvJ6OzW9szH4/B3H8vg&#xA;O/y6qs9xV2KstwoTH/pnP+j3/mTil8j4Feoflv8A8o83/MQ//EVxVlWKuxVj/mryrb6zb+pHSPUI&#xA;x+6l7MP5H9vA9sVecW1zd6TdvbXKMoVuM0LdQfEf574qyKKWOWNZI2DIwqCMVSbV9XpytrZt+kkg&#xA;/UMVTzyX5L9b09T1OP8Ac7NbWzD7Xg7j+XwHf5dVXoWKuxV2KstwoTH/AKZz/o9/5k4pfI+BXqH5&#xA;b/8AKPN/zEP/AMRXFWVYq7FXYqx/zV5Vt9Zt/UjpHqEY/dS9mH8j+3ge2KvMXk1DT2nsn5QuDxlj&#xA;PUEeGKss8leTBOI9U1JKw7NbW7ft+DuP5fAd/l1VehYq7FXYq7FWW4UJj/0zn/R7/wAycUvkfAr1&#xA;D8t/+Ueb/mIf/iK4qyrFXYq7FXYqlepeW9I1G8gu7qEPNAfkHA6K4/aAP+dMVTPFW8VdirsVdirL&#xA;cKEx/wCmc/6Pf+ZOKXyPgVmvlDzfpOkaSbW6EplMrP8AAoIoQB3I8MVTv/lZHl7+W4/4Bf8AmrFX&#xA;f8rI8vfy3H/AL/zVirv+VkeXv5bj/gF/5qxV3/KyPL38tx/wC/8ANWKu/wCVkeXv5bj/AIBf+asV&#xA;d/ysjy9/Lcf8Av8AzVirv+VkeXv5bj/gF/5qxV3/ACsjy9/Lcf8AAL/zVirv+VkeXv5bj/gF/wCa&#xA;sVd/ysjy9/Lcf8Av/NWKp7/yuPyn/vu7/wCRaf8ANeKsj/5WJoH/ACrz9O8Z/qX6U+rceC+pz9Dl&#xA;05UpT3xV834q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq9G/wDKBf8Agxf9iuKv/9k=</xapGImg:image>
+    </rdf:li>
+   </rdf:Alt>
+  </xap:Thumbnails>
+ </rdf:Description>
+
+ <rdf:Description rdf:about=''
+  xmlns:dc='http://purl.org/dc/elements/1.1/'>
+  <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+
+</rdf:RDF>
+</x:xmpmeta>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <?xpacket end='w'?>
+			</metadata>
+		<g id="Layer_1" i:layer="yes" i:dimmedPercent="50" i:rgbTrio="#4F008000FFFF">
+			<g>
+				<rect i:knockout="Off" fill="#A4A4A4" width="10" height="24"/> 
+				<polygon i:knockout="Off" fill="#C6C7C8" points="0,0 0,1 9,1 9,23 10,23 10,0 "/>
+				<polygon i:knockout="Off" fill="#4C4C4C" points="0,1 0,24 10,24 10,23 1,23 1,1 "/>
+				<rect x="2" y="7" i:knockout="Off" fill="#4E4E4E" width="6" height="1"/> 
+				<rect x="2" y="8" i:knockout="Off" fill="#C0C1C3" width="6" height="1"/> 
+				<rect x="2" y="11" i:knockout="Off" fill="#4E4E4E" width="6" height="1"/> 
+				<rect x="2" y="12" i:knockout="Off" fill="#C0C1C3" width="6" height="1"/> 
+				<rect x="2" y="15" i:knockout="Off" fill="#4E4E4E" width="6" height="1"/> 
+				<rect x="2" y="16" i:knockout="Off" fill="#C0C1C3" width="6" height="1"/> 
+				<polygon i:knockout="Off" fill="#737373" points="8,5 2,5 5,2 "/>
+				<polygon i:knockout="Off" fill="#4C4C4C" points="5.359,2.354 2.75,4.99 2.006,5 5.006,2 "/>
+				<g i:knockout="Off">
+					<polygon i:knockout="Off" fill="#4C4C4C" points="2,5 7.313,5 6.828,4.5 2.516,4.5 "/>
+				</g>
+				<polygon i:knockout="Off" fill="#C6C7C8" points="4.646,2.354 7.298,5.005 8,5 5,2 "/>
+				<polygon i:knockout="Off" fill="#737373" points="2,19.005 8,19.005 5,22.005 "/>
+				<polygon i:knockout="Off" fill="#4C4C4C" points="4.641,21.651 7.25,19.015 7.994,19.005 4.994,22.005 "/>
+				<polygon i:knockout="Off" fill="#4C4C4C" points="5.354,21.651 2.702,19 2,19.005 5,22.005 "/>
+				<g i:knockout="Off">
+					<polygon i:knockout="Off" fill="#C6C7C8" points="8,19.005 2.016,19.005 2.5,19.505 7.484,19.505 "/>
+				</g>
+			</g>
+		</g>
+	</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_end_left.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16" version="1.1" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<rect fill="none" height="16" width="16"/>
+<path d="M0,5.749v4.395c0,0.961,0.85,1.744,1.896,1.744H16V4.006H1.896C0.85,4.006,0,4.787,0,5.749z" fill="#E1EBF4" fill-opacity="0.6" stroke-opacity="0.6"/>
+<path d="M0,5.749v4.395c0,0.961,0.85,1.744,1.896,1.744H16v-0.762H1.896c-0.625,0-1.135-0.44-1.135-0.982V5.749   c0-0.541,0.51-0.981,1.135-0.981H16V4.006H1.896C0.85,4.006,0,4.787,0,5.749z" fill="#496DA2"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_end_left_selected.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16" version="1.1" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<path d="M15.983,0.01H16V0H0v16h15.983V0.01z" fill="none"/>
+<path d="M0.741,5.759v4.395c0,0.542,0.51,0.982,1.135,0.982h14.104V4.777H1.876   C1.251,4.777,0.741,5.218,0.741,5.759z" fill="#6C8EB7"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_end_middle.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16" version="1.1" viewBox="0 0 16.001 16" width="16.001" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<rect fill="none" height="16" width="16" x="0.001"/>
+<g>
+<rect fill="#E1EBF4" fill-opacity="0.6" height="7.881" stroke-opacity="0.6" width="15.995" y="4.066"/>
+<rect fill="#496DA2" height="0.762" width="15.994" x="0.006" y="4.051"/>
+<rect fill="#496DA2" height="0.762" width="15.994" x="0.006" y="11.186"/>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_end_right.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16" version="1.1" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<rect fill="none" height="16" width="16"/>
+<path d="M0,5.749v4.395c0,0.961,0.85,1.744,1.896,1.744H16V4.006H1.896C0.85,4.006,0,4.787,0,5.749z" fill="#E1EBF4" fill-opacity="0.6" stroke-opacity="0.6"/>
+<path d="M0,5.749v4.395c0,0.961,0.85,1.744,1.896,1.744H16v-0.762H1.896c-0.625,0-1.135-0.44-1.135-0.982V5.749   c0-0.541,0.51-0.981,1.135-0.981H16V4.006H1.896C0.85,4.006,0,4.787,0,5.749z" fill="#496DA2"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_end_right_selected.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16" version="1.1" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<path d="M14.087,11.136c0.625,0,1.135-0.44,1.135-0.982V5.759c0-0.541-0.51-0.981-1.135-0.981H0v6.358H14.087z" fill="#6C8EB7"/>
+<path d="M15.983,0.01H16V0H0v16h15.983V0.01z" fill="none"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_middle.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16" version="1.1" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<g>
+<rect fill="#6C8EB7" height="4.463" width="16" y="5.769"/>
+</g>
+<rect fill="none" height="16" width="16"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_nslider_vded_middle_selected.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16" version="1.1" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<path d="M15.984,0.01H16V0H0v16h15.984V0.01z" fill="none"/>
+<rect fill="#6C8EB7" height="6.373" width="15.999" y="4.813"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_arrow.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="24" height="24" viewBox="0 0 24 24"
+	 overflow="visible" enable-background="new 0 0 24 24" xml:space="preserve">
+<rect fill="none" width="24" height="24"/>
+<polygon stroke="#FFFFFF" stroke-width="2" stroke-linejoin="round" points="22.54,21.127 12,2.87 1.457,21.127 "/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_novideo.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="189" height="155" viewBox="0 0 189 155">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="#FFFFFF" width="189" height="155"/>
+<g>
+<rect x="3.16" y="2.065" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="13.917" y="12.821" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="24.673" y="2.065" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="35.429" y="12.821" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="46.186" y="2.065" fill="#CCCCCC" width="10.757" height="10.756"/>
+<rect x="56.763" y="12.821" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="67.519" y="2.065" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="78.275" y="12.821" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="89.032" y="2.065" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="3.16" y="23.579" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="13.917" y="34.334" fill="#CCCCCC" width="10.756" height="10.758"/>
+<rect x="24.673" y="23.579" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="35.429" y="34.334" fill="#CCCCCC" width="10.757" height="10.758"/>
+<rect x="46.186" y="23.579" fill="#CCCCCC" width="10.757" height="10.756"/>
+<rect x="56.763" y="34.334" fill="#CCCCCC" width="10.756" height="10.758"/>
+<rect x="67.519" y="23.579" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="78.275" y="34.334" fill="#CCCCCC" width="10.756" height="10.758"/>
+<rect x="89.032" y="23.579" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="3.16" y="45.09" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="13.917" y="55.847" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="24.673" y="45.09" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="35.429" y="55.847" fill="#CCCCCC" width="10.757" height="10.756"/>
+<rect x="46.186" y="45.09" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="56.763" y="55.847" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="67.519" y="45.09" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="78.275" y="55.847" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="89.032" y="45.09" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="3.16" y="66.603" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="13.917" y="77.359" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="24.673" y="66.603" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="35.429" y="77.359" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="46.186" y="66.603" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="56.763" y="77.359" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="67.519" y="66.603" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="78.275" y="77.359" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="89.032" y="66.603" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="89.211" y="2.065" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="99.968" y="12.821" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="110.724" y="2.065" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="121.48" y="12.821" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="132.237" y="2.065" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="142.814" y="12.821" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="153.57" y="2.065" fill="#CCCCCC" width="10.757" height="10.756"/>
+<rect x="164.327" y="12.821" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="175.084" y="2.065" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="89.211" y="23.579" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="99.968" y="34.334" fill="#CCCCCC" width="10.756" height="10.758"/>
+<rect x="110.724" y="23.579" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="121.48" y="34.334" fill="#CCCCCC" width="10.756" height="10.758"/>
+<rect x="132.237" y="23.579" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="142.814" y="34.334" fill="#CCCCCC" width="10.756" height="10.758"/>
+<rect x="153.57" y="23.579" fill="#CCCCCC" width="10.757" height="10.756"/>
+<rect x="164.327" y="34.334" fill="#CCCCCC" width="10.757" height="10.758"/>
+<rect x="175.084" y="23.579" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="89.211" y="45.09" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="99.968" y="55.847" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="110.724" y="45.09" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="121.48" y="55.847" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="132.237" y="45.09" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="142.814" y="55.847" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="153.57" y="45.09" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="164.327" y="55.847" fill="#CCCCCC" width="10.757" height="10.756"/>
+<rect x="175.084" y="45.09" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="89.211" y="66.603" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="99.968" y="77.359" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="110.724" y="66.603" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="121.48" y="77.359" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="132.237" y="66.603" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="142.814" y="77.359" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="153.57" y="66.603" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="164.327" y="77.359" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="175.084" y="66.603" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="89.211" y="88.395" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="99.968" y="99.151" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="110.724" y="88.395" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="121.48" y="99.151" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="132.237" y="88.395" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="142.814" y="99.151" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="153.57" y="88.395" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="164.327" y="99.151" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="175.084" y="88.395" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="89.211" y="109.908" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="99.968" y="120.664" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="110.724" y="109.908" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="121.48" y="120.664" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="132.237" y="109.908" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="142.814" y="120.664" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="153.57" y="109.908" fill="#CCCCCC" width="10.757" height="10.756"/>
+<rect x="164.327" y="120.664" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="175.084" y="109.908" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="89.211" y="131.419" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="99.968" y="142.176" fill="#CCCCCC" width="10.756" height="10.759"/>
+<rect x="110.724" y="131.419" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="121.48" y="142.176" fill="#CCCCCC" width="10.756" height="10.759"/>
+<rect x="132.237" y="131.419" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="142.814" y="142.176" fill="#CCCCCC" width="10.756" height="10.759"/>
+<rect x="153.57" y="131.419" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="164.327" y="142.176" fill="#CCCCCC" width="10.757" height="10.759"/>
+<rect x="175.084" y="131.419" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="3.16" y="88.395" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="13.917" y="99.151" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="24.673" y="88.395" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="35.429" y="99.151" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="46.186" y="88.395" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="56.763" y="99.151" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="67.519" y="88.395" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="78.275" y="99.151" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="89.032" y="88.395" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="3.16" y="109.908" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="13.917" y="120.664" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="24.673" y="109.908" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="35.429" y="120.664" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="46.186" y="109.908" fill="#CCCCCC" width="10.757" height="10.756"/>
+<rect x="56.763" y="120.664" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="67.519" y="109.908" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="78.275" y="120.664" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="89.032" y="109.908" fill="#CCCCCC" width="10.756" height="10.756"/>
+<rect x="3.16" y="131.419" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="13.917" y="142.176" fill="#CCCCCC" width="10.756" height="10.759"/>
+<rect x="24.673" y="131.419" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="35.429" y="142.176" fill="#CCCCCC" width="10.757" height="10.759"/>
+<rect x="46.186" y="131.419" fill="#CCCCCC" width="10.757" height="10.757"/>
+<rect x="56.763" y="142.176" fill="#CCCCCC" width="10.756" height="10.759"/>
+<rect x="67.519" y="131.419" fill="#CCCCCC" width="10.756" height="10.757"/>
+<rect x="78.275" y="142.176" fill="#CCCCCC" width="10.756" height="10.759"/>
+<rect x="89.032" y="131.419" fill="#CCCCCC" width="10.756" height="10.757"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion1.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="189" height="155.001" viewBox="0 0 189 155.001">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="none" width="189" height="155.001"/>
+<radialGradient id="XMLID_2_" cx="94.5317" cy="76.7612" r="70.0129" fx="94.5317" fy="76.7612" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</radialGradient>
+<circle fill="url(#XMLID_2_)" cx="94.531" cy="76.761" r="70.013"/>
+<g>
+<path fill="#FFFFFF" d="M94.945,7.584l0.5,69l48.75-47.75C121.252,1.13,94.945,7.584,94.945,7.584z"/>
+</g>
+<g>
+<path fill="#FFFFFF" d="M22.529,77.291c0,39.708,32.305,72.014,72.013,72.014        c19.235,0,37.319-7.49,50.921-21.092s21.092-31.687,21.092-50.922c0-39.708-32.305-72.014-72.013-72.014        S22.529,37.582,22.529,77.291z M26.529,77.291c0-37.503,30.51-68.014,68.013-68.014c37.502,0,68.013,30.511,68.013,68.014        c0,18.167-7.074,35.247-19.921,48.093c-12.846,12.847-29.925,19.921-48.092,19.921        C57.039,145.304,26.529,114.793,26.529,77.291z"/>
+</g>
+<g>
+<rect x="93.618" y="6.687" fill="#FFFFFF" width="2" height="140.5"/>
+</g>
+<g>
+<rect x="23.532" y="75.761" fill="#FFFFFF" width="142" height="2"/>
+</g>
+<g>
+<rect x="24.26" y="76.273" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 107.3338 199.0043)" fill="#FFFFFF" width="141.245" height="2"/>
+</g>
+<g>
+<line fill="#FFFFFF" x1="144.945" y1="28.334" x2="43.945" y2="126.335"/>
+<rect x="93.445" y="6.97" transform="matrix(-0.6963 -0.7178 0.7178 -0.6963 104.6966 198.9714)" fill="#FFFFFF" width="2" height="140.731"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion2.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="189" height="155.001" viewBox="0 0 189 155.001">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="none" width="189" height="155.001"/>
+<radialGradient id="XMLID_2_" cx="94.5317" cy="76.7612" r="70.0129" fx="94.5317" fy="76.7612" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</radialGradient>
+<circle fill="url(#XMLID_2_)" cx="94.531" cy="76.761" r="70.013"/>
+<path fill="#FFFFFF" d="M163.695,76.584h-68.25l48.75-46.5C144.195,30.084,164.946,50.193,163.695,76.584z"/>
+<g>
+<path fill="#FFFFFF" d="M22.529,77.291c0,39.708,32.305,72.014,72.013,72.014        c19.235,0,37.319-7.49,50.921-21.092s21.092-31.687,21.092-50.922c0-39.708-32.305-72.014-72.013-72.014        S22.529,37.582,22.529,77.291z M26.529,77.291c0-37.503,30.51-68.014,68.013-68.014c37.502,0,68.013,30.511,68.013,68.014        c0,18.167-7.074,35.247-19.921,48.093c-12.846,12.847-29.925,19.921-48.092,19.921        C57.039,145.304,26.529,114.793,26.529,77.291z"/>
+</g>
+<g>
+<rect x="93.618" y="6.687" fill="#FFFFFF" width="2" height="140.5"/>
+</g>
+<g>
+<rect x="23.532" y="75.761" fill="#FFFFFF" width="142" height="2"/>
+</g>
+<g>
+<rect x="24.26" y="76.273" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 107.3338 199.0043)" fill="#FFFFFF" width="141.245" height="2"/>
+</g>
+<g>
+<line fill="#FFFFFF" x1="144.945" y1="28.334" x2="43.945" y2="126.335"/>
+<rect x="93.445" y="6.97" transform="matrix(-0.6963 -0.7178 0.7178 -0.6963 104.6966 198.9714)" fill="#FFFFFF" width="2" height="140.731"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion3.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="189" height="155.001" viewBox="0 0 189 155.001">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="none" width="189" height="155.001"/>
+<radialGradient id="XMLID_2_" cx="94.5317" cy="76.7612" r="70.0129" fx="94.5317" fy="76.7612" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</radialGradient>
+<circle fill="url(#XMLID_2_)" cx="94.531" cy="76.761" r="70.013"/>
+<path fill="#FFFFFF" d="M144.195,126.085l-48.75-49.501l68,0.75C163.445,77.334,162.79,104.103,144.195,126.085z"/>
+<g>
+<path fill="#FFFFFF" d="M22.529,77.291c0,39.708,32.305,72.014,72.013,72.014        c19.235,0,37.319-7.49,50.921-21.092s21.092-31.687,21.092-50.922c0-39.708-32.305-72.014-72.013-72.014        S22.529,37.582,22.529,77.291z M26.529,77.291c0-37.503,30.51-68.014,68.013-68.014c37.502,0,68.013,30.511,68.013,68.014        c0,18.167-7.074,35.247-19.921,48.093c-12.846,12.847-29.925,19.921-48.092,19.921        C57.039,145.304,26.529,114.793,26.529,77.291z"/>
+</g>
+<g>
+<rect x="93.618" y="6.687" fill="#FFFFFF" width="2" height="140.5"/>
+</g>
+<g>
+<rect x="23.532" y="75.761" fill="#FFFFFF" width="142" height="2"/>
+</g>
+<g>
+<rect x="24.26" y="76.273" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 107.3338 199.0043)" fill="#FFFFFF" width="141.245" height="2"/>
+</g>
+<g>
+<line fill="#FFFFFF" x1="144.945" y1="28.334" x2="43.945" y2="126.335"/>
+<rect x="93.445" y="6.97" transform="matrix(-0.6963 -0.7178 0.7178 -0.6963 104.6966 198.9714)" fill="#FFFFFF" width="2" height="140.731"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion4.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="189" height="155.001" viewBox="0 0 189 155.001">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="none" width="189" height="155.001"/>
+<radialGradient id="XMLID_2_" cx="94.5317" cy="76.7612" r="70.0129" fx="94.5317" fy="76.7612" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</radialGradient>
+<circle fill="url(#XMLID_2_)" cx="94.531" cy="76.761" r="70.013"/>
+<path fill="#FFFFFF" d="M95.195,147.835l-0.5-70.751l49.5,49.001C133.195,133.585,126.945,144.335,95.195,147.835z"/>
+<g>
+<path fill="#FFFFFF" d="M22.529,77.291c0,39.708,32.305,72.014,72.013,72.014        c19.235,0,37.319-7.49,50.921-21.092s21.092-31.687,21.092-50.922c0-39.708-32.305-72.014-72.013-72.014        S22.529,37.582,22.529,77.291z M26.529,77.291c0-37.503,30.51-68.014,68.013-68.014c37.502,0,68.013,30.511,68.013,68.014        c0,18.167-7.074,35.247-19.921,48.093c-12.846,12.847-29.925,19.921-48.092,19.921        C57.039,145.304,26.529,114.793,26.529,77.291z"/>
+</g>
+<g>
+<rect x="93.618" y="6.687" fill="#FFFFFF" width="2" height="140.5"/>
+</g>
+<g>
+<rect x="23.532" y="75.761" fill="#FFFFFF" width="142" height="2"/>
+</g>
+<g>
+<rect x="24.26" y="76.273" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 107.3338 199.0043)" fill="#FFFFFF" width="141.245" height="2"/>
+</g>
+<g>
+<line fill="#FFFFFF" x1="144.945" y1="28.334" x2="43.945" y2="126.335"/>
+<rect x="93.445" y="6.97" transform="matrix(-0.6963 -0.7178 0.7178 -0.6963 104.6966 198.9714)" fill="#FFFFFF" width="2" height="140.731"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion5.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="189" height="155.001" viewBox="0 0 189 155.001">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="none" width="189" height="155.001"/>
+<radialGradient id="XMLID_2_" cx="94.5317" cy="76.7612" r="70.0129" fx="94.5317" fy="76.7612" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</radialGradient>
+<circle fill="url(#XMLID_2_)" cx="94.531" cy="76.761" r="70.013"/>
+<path fill="#FFFFFF" d="M44.945,125.585l49.75-48.501l0.25,69.251C86.814,146.222,64.386,150.337,44.945,125.585z"/>
+<g>
+<path fill="#FFFFFF" d="M22.529,77.291c0,39.708,32.305,72.014,72.013,72.014        c19.235,0,37.319-7.49,50.921-21.092s21.092-31.687,21.092-50.922c0-39.708-32.305-72.014-72.013-72.014        S22.529,37.582,22.529,77.291z M26.529,77.291c0-37.503,30.51-68.014,68.013-68.014c37.502,0,68.013,30.511,68.013,68.014        c0,18.167-7.074,35.247-19.921,48.093c-12.846,12.847-29.925,19.921-48.092,19.921        C57.039,145.304,26.529,114.793,26.529,77.291z"/>
+</g>
+<g>
+<rect x="93.618" y="6.687" fill="#FFFFFF" width="2" height="140.5"/>
+</g>
+<g>
+<rect x="23.532" y="75.761" fill="#FFFFFF" width="142" height="2"/>
+</g>
+<g>
+<rect x="24.26" y="76.273" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 107.3338 199.0043)" fill="#FFFFFF" width="141.245" height="2"/>
+</g>
+<g>
+<line fill="#FFFFFF" x1="144.945" y1="28.334" x2="43.945" y2="126.335"/>
+<rect x="93.445" y="6.97" transform="matrix(-0.6963 -0.7178 0.7178 -0.6963 104.6966 198.9714)" fill="#FFFFFF" width="2" height="140.731"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion6.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="189" height="155.001" viewBox="0 0 189 155.001">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="none" width="189" height="155.001"/>
+<radialGradient id="XMLID_2_" cx="94.5317" cy="76.7612" r="70.0129" fx="94.5317" fy="76.7612" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</radialGradient>
+<circle fill="url(#XMLID_2_)" cx="94.531" cy="76.761" r="70.013"/>
+<path fill="#FFFFFF" d="M45.695,124.835l48.069-47.412l-69.235-0.133C24.754,105.048,44.654,123.916,45.695,124.835z"/>
+<g>
+<path fill="#FFFFFF" d="M22.529,77.291c0,39.708,32.305,72.014,72.013,72.014        c19.235,0,37.319-7.49,50.921-21.092s21.092-31.687,21.092-50.922c0-39.708-32.305-72.014-72.013-72.014        S22.529,37.582,22.529,77.291z M26.529,77.291c0-37.503,30.51-68.014,68.013-68.014c37.502,0,68.013,30.511,68.013,68.014        c0,18.167-7.074,35.247-19.921,48.093c-12.846,12.847-29.925,19.921-48.092,19.921        C57.039,145.304,26.529,114.793,26.529,77.291z"/>
+</g>
+<g>
+<rect x="93.618" y="6.687" fill="#FFFFFF" width="2" height="140.5"/>
+</g>
+<g>
+<rect x="23.532" y="75.761" fill="#FFFFFF" width="142" height="2"/>
+</g>
+<g>
+<rect x="24.26" y="76.273" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 107.3338 199.0043)" fill="#FFFFFF" width="141.245" height="2"/>
+</g>
+<g>
+<line fill="#FFFFFF" x1="144.945" y1="28.334" x2="43.945" y2="126.335"/>
+<rect x="93.445" y="6.97" transform="matrix(-0.6963 -0.7178 0.7178 -0.6963 104.6966 198.9714)" fill="#FFFFFF" width="2" height="140.731"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion7.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="189" height="155.001" viewBox="0 0 189 155.001">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="none" width="189" height="155.001"/>
+<radialGradient id="XMLID_2_" cx="94.5317" cy="76.7612" r="70.0129" fx="94.5317" fy="76.7612" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</radialGradient>
+<circle fill="url(#XMLID_2_)" cx="94.531" cy="76.761" r="70.013"/>
+<path fill="#FFFFFF" d="M44.945,27.334l48,48.75l-67.25,0.25C25.195,73.334,28.651,45.775,44.945,27.334z"/>
+<g>
+<path fill="#FFFFFF" d="M22.529,77.291c0,39.708,32.305,72.014,72.013,72.014        c19.235,0,37.319-7.49,50.921-21.092s21.092-31.687,21.092-50.922c0-39.708-32.305-72.014-72.013-72.014        S22.529,37.582,22.529,77.291z M26.529,77.291c0-37.503,30.51-68.014,68.013-68.014c37.502,0,68.013,30.511,68.013,68.014        c0,18.167-7.074,35.247-19.921,48.093c-12.846,12.847-29.925,19.921-48.092,19.921        C57.039,145.304,26.529,114.793,26.529,77.291z"/>
+</g>
+<g>
+<rect x="93.618" y="6.687" fill="#FFFFFF" width="2" height="140.5"/>
+</g>
+<g>
+<rect x="23.532" y="75.761" fill="#FFFFFF" width="142" height="2"/>
+</g>
+<g>
+<rect x="24.26" y="76.273" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 107.3338 199.0043)" fill="#FFFFFF" width="141.245" height="2"/>
+</g>
+<g>
+<line fill="#FFFFFF" x1="144.945" y1="28.334" x2="43.945" y2="126.335"/>
+<rect x="93.445" y="6.97" transform="matrix(-0.6963 -0.7178 0.7178 -0.6963 104.6966 198.9714)" fill="#FFFFFF" width="2" height="140.731"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_graf_ve_trans_slowmotion8.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="189" height="155.001" viewBox="0 0 189 155.001">
+<switch>
+<foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" width="1" height="1" content="structured text"/>
+<g>
+<g>
+<rect fill="none" width="189" height="155.001"/>
+<radialGradient id="XMLID_2_" cx="94.5317" cy="76.7612" r="70.0129" fx="94.5317" fy="76.7612" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#0099FF"/>
+</radialGradient>
+<circle fill="url(#XMLID_2_)" cx="94.531" cy="76.761" r="70.013"/>
+<path fill="#FFFFFF" d="M46.195,27.834l48.5,48.5L94.618,6.687C73.945,8.334,52.062,20.808,46.195,27.834z"/>
+<g>
+<path fill="#FFFFFF" d="M22.529,77.291c0,39.708,32.305,72.014,72.013,72.014        c19.235,0,37.319-7.49,50.921-21.092s21.092-31.687,21.092-50.922c0-39.708-32.305-72.014-72.013-72.014        S22.529,37.582,22.529,77.291z M26.529,77.291c0-37.503,30.51-68.014,68.013-68.014c37.502,0,68.013,30.511,68.013,68.014        c0,18.167-7.074,35.247-19.921,48.093c-12.846,12.847-29.925,19.921-48.092,19.921        C57.039,145.304,26.529,114.793,26.529,77.291z"/>
+</g>
+<g>
+<rect x="93.618" y="6.687" fill="#FFFFFF" width="2" height="140.5"/>
+</g>
+<g>
+<rect x="23.532" y="75.761" fill="#FFFFFF" width="142" height="2"/>
+</g>
+<g>
+<rect x="24.26" y="76.273" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 107.3338 199.0043)" fill="#FFFFFF" width="141.245" height="2"/>
+</g>
+<g>
+<line fill="#FFFFFF" x1="144.945" y1="28.334" x2="43.945" y2="126.335"/>
+<rect x="93.445" y="6.97" transform="matrix(-0.6963 -0.7178 0.7178 -0.6963 104.6966 198.9714)" fill="#FFFFFF" width="2" height="140.731"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_vded_end.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16" version="1.1" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<polygon fill="#364B60" points="11,1.647 11,0 16,0 16,16 11,16 11,14.352 14.535,14.352 14.535,1.647  "/>
+<rect fill="none" height="16" width="16"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_vded_playhead.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="18" version="1.1" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<polygon fill="#FFFFFF" points="5.504,0 5.504,3.91 6.541,3.91 6.541,14.08 5.504,14.08 5.504,17.99 12.496,18 12.496,14.09   11.443,14.09 11.443,3.92 12.496,3.92 12.496,0.01 "/>
+<polygon fill="#364B60" points="11.59,3.052 11.59,1 6.41,1 6.41,3.042 7.443,3.042 7.443,14.985 6.41,14.985 6.41,16.938   11.59,16.938 11.59,14.995 10.557,14.995 10.557,3.052 "/>
+<rect fill="none" height="17.99" width="18"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_vded_scissors.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16" version="1.1" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<path d="M4.294,11.713l2.382-2.768C4.824,7.953,2.766,10.275,4.294,11.713z" fill="none"/>
+<path d="M9.096,9.403L9.02,8.867V8.288l0.436-0.135c0,0,4.189-3.794,3.458-5.114L9.13,6.84l1.164-5.245   C8.79,1.697,8.071,7.311,8.071,7.311l0.075,0.435L7.463,8.178L6.922,8.496C4.425,7.07,2.863,9.768,3.011,10.564   c0.154,0.828,0.419,1.7,1.392,2.277l3.646-4.25l0.243-0.077l0.044,0.276l-0.201,5.502c1.108,0.311,1.944-0.055,2.556-0.633   C11.229,13.145,11.898,10.055,9.096,9.403z M4.294,11.713c-1.528-1.438,0.53-3.76,2.382-2.768L4.294,11.713z M8.762,8.188   c-0.229,0-0.415-0.186-0.415-0.414c0-0.228,0.186-0.413,0.415-0.413c0.228,0,0.412,0.186,0.412,0.413   C9.174,8.003,8.989,8.188,8.762,8.188z M8.967,13.631L9.1,9.98C11.111,10.705,10.677,13.844,8.967,13.631z" fill="#364B60"/>
+<rect fill="none" height="16" width="16"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_vded_start.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16" version="1.1" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<polygon fill="#364B60" points="5,1.647 5,0 0,0 0,16 5,16 5,14.352 1.463,14.352 1.463,1.647  "/>
+<rect fill="none" height="16" width="16"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_vded_timeline_selected.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="18" version="1.1" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<rect fill="#FFFFFF" height="12" width="6.375" x="5.813" y="3"/>
+<rect fill="#364B60" height="11.95" width="4.375" x="6.813" y="3.023"/>
+<rect fill="none" height="18" width="18"/>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_mmc.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="34" height="32" viewBox="0 0 34 32"
+	 overflow="visible" enable-background="new 0 0 34 32" xml:space="preserve">
+<rect fill="none" width="34" height="32"/>
+<path fill="#FFFFFF" d="M13.13,23.923h7.739v-2.166H13.13V23.923z M11.798,2.434L7.247,6.562L7.244,29.564h19.509V2.434
+	L11.798,2.434z M23.15,26.525H10.845V7.564h2.778v4.93h1.886v-4.93h2.977v4.93h1.889v-4.93h2.775V26.525z"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_mmc_non.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="34" height="32" viewBox="0 0 34 32"
+	 overflow="visible" enable-background="new 0 0 34 32" xml:space="preserve">
+<rect x="0" y="0.02" fill="none" width="34" height="31.999"/>
+<path fill="#B2B2B2" d="M13.129,23.941h7.739v-2.166h-7.739V23.941z M11.797,2.454L7.246,6.581L7.244,29.583h19.508V2.453
+	L11.797,2.454z M23.149,26.544H10.844V7.584h2.778v4.93h1.886v-4.93h2.977v4.93h1.889v-4.93h2.775V26.544z"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_mms_non.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="34" height="32" viewBox="0 0 34 32"
+	 overflow="visible" enable-background="new 0 0 34 32" xml:space="preserve">
+<rect fill="none" width="34" height="32"/>
+<path fill="#B2B2B2" d="M16.95,15.844l10.746-8.15c0.011-0.008,0.022-0.011,0.033-0.019c-0.045-0.008-0.086-0.026-0.132-0.026H6.145
+	c-0.006,0-0.011,0.003-0.017,0.003C6.153,7.668,6.18,7.675,6.205,7.694L16.95,15.844z M17.569,17.275
+	c-0.195,0.147-0.418,0.216-0.617,0.211c-0.201,0.006-0.425-0.062-0.622-0.21L5.33,8.933v14.542c0,0.449,0.364,0.814,0.815,0.814
+	h21.452c0.449,0,0.813-0.365,0.813-0.814V9.053L17.569,17.275z"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_mms_ok.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="34" height="32" viewBox="0 0 34 32"
+	 overflow="visible" enable-background="new 0 0 34 32" xml:space="preserve">
+<rect fill="none" width="34" height="32"/>
+<path fill="#FFFFFF" d="M16.941,15.831l10.746-8.15c0.011-0.008,0.022-0.011,0.033-0.019c-0.045-0.008-0.086-0.026-0.132-0.026
+	H6.136c-0.006,0-0.011,0.003-0.017,0.003c0.025,0.016,0.052,0.023,0.077,0.042L16.941,15.831z M17.561,17.263
+	c-0.195,0.147-0.418,0.216-0.617,0.211c-0.201,0.006-0.425-0.062-0.622-0.21L5.321,8.92v14.542c0,0.449,0.364,0.814,0.815,0.814
+	h21.452c0.449,0,0.813-0.365,0.813-0.814V9.041L17.561,17.263z"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_phone.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="34" height="32" viewBox="0 0 34 32"
+	 overflow="visible" enable-background="new 0 0 34 32" xml:space="preserve">
+<rect fill="none" width="34" height="32"/>
+<path fill="#FFFFFF" d="M23.826,3.413h-0.769c-0.553,0-1,0.445-1,0.995v1.563H10.503c-0.607,0-1.099,0.474-1.099,1.06v20.312
+	c0,0.585,0.492,1.061,1.099,1.061h13.225c0.606,0,1.099-0.476,1.099-1.061V4.408C24.826,3.857,24.378,3.413,23.826,3.413z
+	 M14.328,25.528h-2.175v-2.175h2.175V25.528z M14.328,21.546h-2.175V19.37h2.175V21.546z M18.282,25.528h-2.174v-2.175h2.174V25.528
+	z M18.282,21.546h-2.174V19.37h2.174V21.546z M22.237,25.528h-2.175v-2.175h2.175V25.528z M22.237,21.546h-2.175V19.37h2.175V21.546
+	z M22.685,16.117c0,0.664-0.459,1.202-1.024,1.202h-9.089c-0.566,0-1.024-0.539-1.024-1.202V9.663c0-0.664,0.458-1.202,1.024-1.202
+	h9.089c0.565,0,1.024,0.538,1.024,1.202V16.117z"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_phone_non.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="34" height="32" viewBox="0 0 34 32"
+	 overflow="visible" enable-background="new 0 0 34 32" xml:space="preserve">
+<rect fill="none" width="34" height="32"/>
+<path fill="#B2B2B2" d="M23.826,3.413h-0.769c-0.553,0-1,0.445-1,0.995v1.563H10.503c-0.607,0-1.099,0.474-1.099,1.06v20.312
+	c0,0.585,0.492,1.061,1.099,1.061h13.225c0.606,0,1.099-0.476,1.099-1.061V4.408C24.826,3.857,24.378,3.413,23.826,3.413z
+	 M14.328,25.528h-2.175v-2.175h2.175V25.528z M14.328,21.546h-2.175V19.37h2.175V21.546z M18.282,25.528h-2.174v-2.175h2.174V25.528
+	z M18.282,21.546h-2.174V19.37h2.174V21.546z M22.237,25.528h-2.175v-2.175h2.175V25.528z M22.237,21.546h-2.175V19.37h2.175V21.546
+	z M22.685,16.117c0,0.663-0.459,1.202-1.024,1.202h-9.089c-0.566,0-1.024-0.539-1.024-1.202V9.663c0-0.664,0.458-1.202,1.024-1.202
+	h9.089c0.565,0,1.024,0.538,1.024,1.202V16.117z"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_indi_ve_videolength.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="34" height="32" viewBox="0 0 34 32"
+	 overflow="visible" enable-background="new 0 0 34 32" xml:space="preserve">
+<rect fill="none" width="34" height="32"/>
+<circle fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" cx="16.74" cy="16.324" r="11.658"/>
+<polyline fill="none" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" points="16.517,8.89 16.517,16.553 21.96,16.553 
+	"/>
+<line fill="none" stroke="#FFFFFF" stroke-linecap="round" x1="7.785" y1="16.102" x2="9.718" y2="16.102"/>
+<line fill="none" stroke="#FFFFFF" stroke-linecap="round" x1="24.616" y1="16.102" x2="26.55" y2="16.102"/>
+<line fill="none" stroke="#FFFFFF" stroke-linecap="round" x1="16.726" y1="23.551" x2="16.726" y2="25.484"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/data/svg/qgn_prop_ve_pause.svg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
+	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+]>
+<svg  version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="28" height="28" viewBox="-6 -6 28 28"
+	 overflow="visible" enable-background="new -6 -6 28 28" xml:space="preserve">
+<rect x="-6" y="-6" fill="none" width="28" height="28"/>
+<g>
+	<rect x="-1.274" y="-1.232" fill="#0A86FF" stroke="#FFFFFF" stroke-width="1.8903" width="7.21" height="18.46"/>
+	<rect x="10.062" y="-1.232" fill="#0A86FF" stroke="#FFFFFF" stroke-width="1.8903" width="7.21" height="18.46"/>
+</g>
+<rect fill="none" width="16" height="16"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/group/VideoEditorUiComponents.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+#include <data_caging_paths.hrh>
+#include "../../Group/buildconfig.hrh"
+
+#if defined( __DEBUG_ON__ )
+MACRO           DEBUG_ON
+#endif
+#if defined( __DEBUG_ON_ALWAYS__ )
+MACRO           DEBUG_ON_ALWAYS
+#endif
+#if defined(__DEBUG_ON__) || defined(__DEBUG_ON_ALWAYS__)
+LIBRARY         flogger.lib
+#endif
+
+
+TARGET		VideoEditorUiComponents.dll
+TARGETTYPE	DLL
+CAPABILITY	CAP_GENERAL_DLL
+UID		0x1000008d 0xA0000305 
+VENDORID        VID_DEFAULT
+
+
+USERINCLUDE	../inc
+USERINCLUDE	../../VideoEditorCommon/inc
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH	../src
+SOURCE		VeiCutterbar.cpp
+// Removed to disable Manual Video Editor
+//SOURCE		VeiEditVideoLabelNavi.cpp
+SOURCE		VeiTimeLabelNavi.cpp
+SOURCE		VeiTextDisplay.cpp
+SOURCE		VeiVideoDisplay.cpp
+// Removed to disable Manual Video Editor
+//SOURCE		VeiSlider.cpp
+SOURCE		VeiErrorUi.cpp
+SOURCE		ExtProgressDialog.cpp
+SOURCE		ExtProgressContainer.cpp
+SOURCE		ExtProgressAnimationControl.cpp
+
+
+SOURCEPATH	../data
+START RESOURCE  VideoEditorUiComponents.rss
+HEADER
+TARGET VideoEditorUiComponents.rsc
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+LIBRARY apparc.lib
+LIBRARY aknicon.lib
+LIBRARY AknLayout2.lib
+LIBRARY aknlayout2adaptation.lib
+LIBRARY aknlayout2scalable.lib
+LIBRARY aknskins.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY bitgdi.lib
+LIBRARY BitmapTransforms.lib
+LIBRARY bmpanim.lib
+LIBRARY cdlengine.lib
+LIBRARY commonengine.lib
+LIBRARY commonui.lib
+LIBRARY cone.lib 
+LIBRARY efsrv.lib
+LIBRARY eikcdlg.lib
+LIBRARY eikcore.lib
+LIBRARY eikcoctl.lib 
+LIBRARY eikctl.lib
+LIBRARY eikdlg.lib
+LIBRARY estor.lib
+LIBRARY	euser.lib
+LIBRARY fbscli.lib
+LIBRARY fontutils.lib
+LIBRARY gdi.lib
+LIBRARY ImageConversion.lib
+LIBRARY MGFetch.lib
+LIBRARY mediaclientvideo.lib
+LIBRARY platformenv.lib
+LIBRARY ServiceHandler.lib
+LIBRARY VideoEditorCommon.lib
+LIBRARY ws32.lib
+LIBRARY mmfcontrollerframework.lib 
+
+#ifdef RD_TACTILE_FEEDBACK
+LIBRARY     	touchfeedback.lib
+#endif /* RD_TACTILE_FEEDBACK  */
+
+NOSTRICTDEF
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+#include "../../Group/buildconfig.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/VideoEditorUiComponents.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(VideoEditorUiComponents.iby)
+../rom/VideoEditorUiComponents_resource.iby  LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(VideoEditorUiComponents_resource.iby)
+
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE VideoEditorUiComponents.mif
+OPTION HEADERFILE VideoEditorUiComponents.mbg
+OPTION SOURCEFILE iconlist.txt
+END
+
+
+PRJ_MMPFILES
+../Group/VideoEditorUiComponents.mmp
+
+PRJ_TESTMMPFILES
+//../tsrc/ProgNote/group/ProgNote.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/group/iconlist.txt	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+-c24,8 qgn_indi_vded_scissors
+-c24,8 qgn_indi_vded_play
+-c24,8 qgn_indi_vded2_play
+-c24,8 qgn_indi_vded2_pause
+-c24,8 qgn_indi_vded_pause
+-c24,8 qgn_indi_vded_start
+-c24,8 qgn_indi_vded_end
+-c24,8 qgn_indi_vded_volume_up_down
+-c24,8 qgn_indi_vded2_start
+-c24,8 qgn_indi_vded2_start_pressed
+-c24,8 qgn_indi_vded2_end
+-c24,8 qgn_indi_vded2_end_pressed
+-c24,8 qgn_indi_vded2_playhead
+-c24,8 qgn_indi_vded2_playhead_pressed
+-c24,8 qgn_graf_nslider_vded2_end_left
+-c24,8 qgn_graf_nslider_vded2_end_right
+-c24,8 qgn_graf_nslider_vded2_middle
+-c24,8 qgn_graf_nslider_vded2_end_left_selected
+-c24,8 qgn_graf_nslider_vded2_end_right_selected
+-c24,8 qgn_graf_nslider_vded2_middle_selected
+-c24,8 qgn_graf_nslider_vded_end_left
+-c24,8 qgn_graf_nslider_vded_end_left_selected
+-c24,8 qgn_graf_nslider_vded_end_middle
+-c24,8 qgn_graf_nslider_vded_end_right
+-c24,8 qgn_graf_nslider_vded_end_right_selected
+-c24,8 qgn_graf_nslider_vded_middle
+-c24,8 qgn_graf_nslider_vded_middle_selected
+-c24,8 qgn_indi_vded_playhead
+-c24,8 qgn_indi_vded_timeline_selected
+-c24,8 qgn_indi_volume_arrow_up
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/ExtProgressAnimationControl.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/*
+*   File:       ExtProgressAnimationControl.h
+*   Created:    17-10-2005
+*   Author:     
+*               
+*/
+
+#ifndef EXTPROGRESSANIMATIONCONTROL_H
+#define EXTPROGRESSANIMATIONCONTROL_H
+
+// INCLUDES
+#include <coecntrl.h>
+   
+// FORWARD DECLARATIONS
+class CAknBitmapAnimation;
+class CAknsBasicBackgroundControlContext;
+
+// CLASS DECLARATION
+
+/**	CLASS: CExtProgressAnimationControl
+*
+*	CExtProgressAnimationControl represent animated transition using two 
+*	thumbnail images. The thumbnails and transition type can be set
+*	to the control. 
+*/
+NONSHARABLE_CLASS( CExtProgressAnimationControl ) : public CCoeControl, public MCoeControlObserver
+{
+
+public:
+
+/** @name Methods:*/
+//@{
+	/** NewL factory method, pops cleanup stack
+	*
+	*	@param aRect - control rectangle
+	*	@param aParent - pointer to window owning control
+	*	@return pointer to created CExtProgressAnimationControl object
+	*/
+	static CExtProgressAnimationControl * NewL (
+		const TRect &		aRect,
+		const CCoeControl *	aParent
+		);
+
+    /**	Destructor
+	*
+    *	@param -
+	*	@return -
+    */
+    ~CExtProgressAnimationControl();
+
+    /**	StartAnimationL
+	*
+	*	Starts animation routine.
+	*
+    *	@param - 
+	*	@return -
+    */
+    void StartAnimationL( TInt aFrameIntervalInMilliSeconds=-1 );
+
+    /**	SetAnimationResourceId
+	*
+    *	@param -
+	*	@return -
+    */
+	void SetAnimationResourceId(const TInt &aResourceId);
+
+    /**	MinimumSize
+	*
+    *	@param -
+	*	@return -
+    */
+    //TSize MinimumSize();
+
+    /**	SetAnimationResourceId
+	*
+    *	@param -
+	*	@return -
+    */
+    void HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/);
+
+    /**	StopAnimation
+	*
+    *	@param -
+	*	@return -
+    */
+	void StopAnimation(); 
+
+    /**	SetFrameIntervalL
+	*
+    *	@param -
+	*	@return -
+    */
+	void SetFrameIntervalL(TInt aFrameIntervalInMilliSeconds);
+
+//@}
+
+
+private:
+
+/** @name Methods:*/
+//@{
+
+    /**	Default constructor
+	*
+    *	@param -
+	*	@return -
+    */
+    CExtProgressAnimationControl();
+
+    /**	ConstructL
+	*
+	*	Second phase constructor
+	*
+	*	@param aRect - control rectangle
+	*	@param aParent - pointer to window owning control
+	*	@param aLeft - left icon
+	*	@param aRight - right icon
+	*	@return -
+    */
+    void ConstructL (
+		const TRect &		aRect,
+		const CCoeControl *	aParent
+		);
+
+	/**	SizeChanged
+	*
+    *	@see CCoeControl
+    */
+    void SizeChanged();
+
+	/**	CountComponentControls
+	*
+    *	@see CCoeControl
+    */
+    //TInt CountComponentControls() const;
+
+	/**	ComponentControl
+	*
+    *	@see CCoeControl
+    */
+    //CCoeControl * ComponentControl (TInt aIndex) const;
+
+	/**	Draw
+	*
+    *	@see CCoeControl
+    */
+    void Draw (const TRect& aRect) const;
+    
+	/**
+	* From CoeControl, MopSupplyObject.
+	*
+	* @param aId  
+	*/
+	virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
+//@}
+    
+/** @name Members:*/
+//@{
+
+//@}
+        
+/** @name Members:*/
+//@{
+
+	TBool					iAnimationOn;        
+	CAknBitmapAnimation*	iAnimation;
+	TInt					iAnimationSpeedInMilliSeconds;
+	TInt					iBorderWidth;
+	
+	TInt 					iAnimationResourceId;
+	
+	/** Background context. Skin stuff. */
+	CAknsBasicBackgroundControlContext*	iBgContext;
+
+//@}
+
+};
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/ExtProgressContainer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/*
+*   File:       CExtProgressContainer.h
+*   Created:    17-10-2005
+*   Author:     
+*               
+*/
+
+#ifndef EXTPROGRESSCONTAINER_H
+#define EXTPROGRESSCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <akncontrol.h>
+
+// FORWARD DECLARATIONS
+class CEikProgressInfo;
+class CExtProgressAnimationControl;
+class CFbsBitmap;
+class CEikLabel;
+class CAknsBasicBackgroundControlContext;
+
+/*  CLASS: CExtProgressContainer
+*
+*
+*/ 
+NONSHARABLE_CLASS( CExtProgressContainer ) :	public CCoeControl, public MCoeControlObserver
+{
+
+public:
+
+	/** NewL factory method, does not pop cleanupstack
+	*
+	*   @param -
+	*	@return pointer to created CExtProgressContainer object
+	*/
+    static CExtProgressContainer * NewL (const TRect& aRect, 
+                                          CCoeControl* aParent);
+
+	/** Destructor
+	*
+	*	@param -
+	*	@return -
+	*/
+	virtual ~CExtProgressContainer ();
+
+	/*	Second phase constructor	
+	*
+	*	@param -
+	*	@return -
+	*/
+    void ConstructL (const TRect& aRect, CCoeControl* aParent);
+
+	/*	GetProgressInfoL	
+	*
+	*	@param -
+	*	@return -
+	*/
+    CEikProgressInfo* GetProgressInfoL();
+
+	/*	GetAnimationControlL	
+	*
+	*	@param -
+	*	@return -
+	*/
+    CExtProgressAnimationControl* GetAnimationControlL();
+    
+	/*	SetTextL	
+	*
+	*	@param aText - label text
+	*	@return -
+	*/
+    void SetTextL(const TDesC &aText);
+
+    // Test function
+    void Test();
+   
+ 
+    
+protected:
+
+    /** CountComponentControls
+    *  
+    * @see CCoeControl
+    *
+    */
+    TInt CountComponentControls() const;
+
+    /** ComponentControl
+    *  
+    * @see CCoeControl
+    *
+    */
+    CCoeControl* ComponentControl(TInt aIndex) const;
+
+    /** SizeChanged
+    *  
+    * @see CCoeControl
+    *
+    */
+    void SizeChanged();
+
+    /** HandleControlEventL
+    *  
+    * @see CCoeControl
+    *
+    */
+    void HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType);
+
+    /** Draw
+    * 
+    * 
+    * @see CCoeControl
+    *
+    */
+    void Draw(const TRect& aRect) const;
+
+	/**
+	* From CoeControl, MopSupplyObject.
+	*
+	* @param aId  
+	*/
+	virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
+    /** MinimumSize
+    * 
+    * 
+    * @see CCoeControl
+    *
+    */
+    TSize MinimumSize();
+
+private:
+
+    /** Default constructor, cannot leave.
+	*
+	*	@param -
+	*	@return -
+	*/
+	CExtProgressContainer ();
+
+private: // data
+
+    CEikLabel*                      iLabel;
+    CEikProgressInfo*               iProgressInfo;
+    CExtProgressAnimationControl*   iAnimationControl;
+    
+	/** Background context. Skin stuff. */
+	CAknsBasicBackgroundControlContext*	iBgContext;
+};
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/ExtProgressDialog.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/*
+*   File:       ExtProgressDialog.h
+*   Created:    17-10-2005
+*   Author:     
+*               
+*/
+
+#ifndef EXTPROGRESSDIALOG_H
+#define EXTPROGRESSDIALOG_H
+
+#include <akndialog.h>
+#include <coecobs.h>
+#include <ConeResLoader.h> 
+
+// Forward Declarations
+class CFbsBitmap;
+class CEikLabel;
+class CEikProgressInfo;
+class CExtProgressContainer;
+class CExtProgressNoteAnimationControl;
+
+/*  CLASS: MExtProgressDialogCallback
+*
+*
+*/ 
+class MExtProgressDialogCallback
+{
+public:
+
+    /** DialogDismissedL
+    *
+    * Callback method. Gets called when a dialog is dismissed.
+    *
+    *   @param aButtonId - id of the button pressed
+    *   @return -
+    */
+    virtual void DialogDismissedL( TInt aButtonId ) = 0;
+
+};
+
+/*  CLASS: CExtProgressDialog
+*
+*
+*   Usage:
+*      
+*     iProgNote = new (ELeave) CExtProgressDialog (&iProgNote, iBitmap1, iBitmap2);
+*     iProgNote->PrepareLC(R_WAIT_DIALOG);
+*     iProgNote->GetProgressInfoL()->SetFinalValue (aFinalValue);
+*     iProgNote->StartAnimationL();
+*     iProgNote->SetTextL( aPrompt );
+*     iProgNote->SetCallback (this);    
+*     iProgNote->RunLD();
+*
+*   Resource definition:
+*
+*     RESOURCE DIALOG r_wait_dialog
+*     {
+*        flags = EAknWaitNoteFlags;
+*        buttons = R_AVKON_SOFTKEYS_CANCEL;
+*     }
+*
+*/ 
+class CExtProgressDialog :	public CAknDialog
+{
+
+public:
+
+  	/** Constructor
+	*
+	*	@param aBitmap - background bitmap
+	*	@param aSelectedItem - selected item
+	*	@param aItems - Plugin info item array
+	*	@return -
+	*/
+    IMPORT_C CExtProgressDialog(CExtProgressDialog** aSelfPtr);
+
+  	/** Destructor
+	*
+	*	@param  -
+	*	@return -
+	*/
+    IMPORT_C ~CExtProgressDialog();
+
+   	/** PrepareLC
+	*
+	*	@param aResourceId - resource id
+	*	@return -
+	*/
+    IMPORT_C void PrepareLC(TInt aResourceId);	
+	
+   	/** SetCallback
+	*
+	*	@param aCallback - callback
+	*	@return -
+	*/
+    IMPORT_C void SetCallback(MExtProgressDialogCallback* aCallback);
+
+   	/** GetProgressInfoL
+	*
+	*	@param - 
+	*	@return - progress info 
+	*/
+    IMPORT_C CEikProgressInfo* GetProgressInfoL();
+
+   	/** StartAnimationL
+	*
+	*	@param - 
+	*	@return - 
+	*/
+    IMPORT_C void StartAnimationL();
+    
+   	/** SetTextL
+	*
+	*	@param aText - title text
+	*	@return - 
+	*/
+    IMPORT_C void SetTextL(const TDesC &aText);
+    
+    /** SetAnimationResourceId
+	*
+	*	@param aResourceId - animation resource id
+	*	@return - 
+	*/
+    IMPORT_C void SetAnimationResourceIdL(const TInt &aResourceId);
+ 
+protected:
+
+    /** OkToExitL
+    * 
+    * From CEikDialog update member variables .
+    * @param aButtonId The ID of the button that was activated.
+    * @return Should return ETrue if the dialog should exit,
+    *    and EFalse if it should not
+    */
+    TBool OkToExitL( TInt aButtonId );
+
+    /** OfferKeyEventL
+    *  
+    * @see CCoeControl
+    *
+    */
+    TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
+
+    /** HandleControlEventL
+    *  
+    * @see CCoeControl
+    *
+    */
+    void HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType);
+
+    /** PreLayoutDynInitL
+    *  
+    * @see CEikDialog
+    *
+    */
+    void PreLayoutDynInitL();
+
+    /** SetSizeAndPosition
+    *  
+    * @see CEikDialog
+    *
+    */
+    void SetSizeAndPosition(const TSize &aSize);
+    
+    /** CountComponentControls
+    *  
+    * @see CCoeControl
+    *
+    */
+    TInt CountComponentControls() const;
+
+    /** ComponentControl
+    *  
+    * @see CCoeControl
+    *
+    */
+    CCoeControl* ComponentControl(TInt aIndex) const;
+  
+private:
+    
+    CExtProgressDialog** 		iSelfPtr;
+
+    MExtProgressDialogCallback* iCallback;
+    RConeResourceLoader 		iResLoader;
+    
+    CExtProgressContainer* 		iContainer;
+};
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/VeiCutterBar.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,351 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Declares CVeiCutterBar control for the Video Editor.
+*
+*/
+
+
+
+#ifndef VEICUTTERBAR_H
+#define VEICUTTERBAR_H
+
+#include <coecntrl.h>
+
+class CPeriodic;
+
+/**
+ * CVeiCutterBar control class.
+ */
+class CVeiCutterBar : public CCoeControl, public MCoeControlObserver
+    {
+    public:
+    		/**
+		 * CVeiCutterBar components.
+		 */
+		 enum TCutterBarComponent
+			{
+			EScissorsIcon = 1,
+			EProgressBar,
+			ESliderLeftEndIcon,
+			ESliderMiddleIcon,
+			ESliderRightEndIcon,
+			ESliderSelectedLeftEndIcon,
+			ESliderSelectedMiddleIcon,
+			ESliderSelectedRightEndIcon,
+			EPlayheadIcon,
+			ECutAreaBorderIcon,
+			EStartMarkIcon,
+			EEndMarkIcon,
+			EPlayheadTouch,
+			EStartMarkTouch,
+			EEndMarkTouch
+			};
+        
+        // CVeiCutterBar icons that can be in pressed state
+        enum TCutterBarPressedIcon
+			{
+			ENoPressedIcon = 0,
+			EPressedPlayheadTouch,
+			EPressedStartMarkTouch,
+			EPressedEndMarkTouch
+			};
+    public:
+        /**
+         * Destructor.
+         */
+        IMPORT_C virtual ~CVeiCutterBar();
+
+		/** 
+		 * Static factory method.
+		 * 
+		 * @param aCont  pointer to the container
+		 *
+		 * @return  the created CVeiCutterBar object
+		 */
+		IMPORT_C static CVeiCutterBar* NewL( const CCoeControl* aParent, TBool aDrawBorder = EFalse );
+
+		/** 
+		 * Static factory method. Leaves the created object in the cleanup
+		 * stack.
+		 * 
+		 * @param aCont  pointer to the container
+		 *
+		 * @return  the created CVeiCutterBar object
+		 */
+		IMPORT_C static CVeiCutterBar* NewLC( const CCoeControl* aParent, TBool aDrawBorder = EFalse  );
+
+    public:
+
+		IMPORT_C virtual void SetPlayHeadVisible( TBool aVisible );
+		/**
+		 * Sets the mark in point.
+		 *
+		 * @param aIn  new In-point
+		 */
+		IMPORT_C virtual void SetInPoint( const TTimeIntervalMicroSeconds& aIn );
+
+		/**
+		 * Sets the mark out point.
+		 *
+		 * @param aOut  new Out-point
+		 */
+		IMPORT_C virtual void SetOutPoint( const TTimeIntervalMicroSeconds& aOut );
+
+		/**
+		 * Sets the "finished" status, i.e., if the clip is finished, the
+		 * leftover areas outside in/out points are grayed out.
+		 *
+		 * @param aStatus  <code>ETrue</code> for "is finished";
+		 *                 <code>EFalse</code> for "not finished"
+		 */
+		IMPORT_C virtual void SetFinishedStatus( TBool aStatus );
+
+		IMPORT_C virtual void SetTotalDuration( const TTimeIntervalMicroSeconds& aDuration );
+
+		IMPORT_C virtual void SetCurrentPoint( TInt aLocation );
+
+		IMPORT_C virtual void Dim( TBool aDimmed );
+
+		/** 
+		 * Getter for iCutBarRect
+		 * CVeiCutterBar's rect covers also the scissor icon area but iCutBarRect 
+		 * is the visible area of the progress bar
+		 * 
+		 * @param -
+		 *
+		 * @return  the progress bar rect
+		 */
+		IMPORT_C TRect ProgressBarRect(); 
+		
+		/** 
+		 * Returns the playhead rectangle.
+		 * If the playheadhasn't been set, returns an empty rect
+		 * 
+		 * @param -
+		 *
+		 * @return  playhead rect or empty rect
+		 */		
+		IMPORT_C TRect PlayHeadRect(); 
+
+		/** 
+		 * Returns the start mark rectangle.
+		 * If the start mark hasn't been set, returns an empty rect
+		 * 
+		 * @param -
+		 *
+		 * @return  start mark rect or empty rect
+		 */		
+		IMPORT_C TRect StartMarkRect(); 
+
+		/** 
+		 * Returns the end mark rectangle.
+		 * If the end mark hasn't been set, returns an empty rect
+		 * 
+		 * @param -
+		 *
+		 * @return  end mark rect or empty rect
+		 */		
+		IMPORT_C TRect EndMarkRect(); 
+
+		/** 
+		 * Returns the start mark position in progress bar
+		 * 
+		 * @param -
+		 *
+		 * @return  the start mark position
+		 */		
+		IMPORT_C TUint StartMarkPoint(); 
+		
+		/** 
+		 * Returns the end mark position in progress bar
+		 * 
+		 * @param -
+		 *
+		 * @return  the end mark position
+		 */		
+		IMPORT_C TUint EndMarkPoint(); 
+
+		/** 
+		 * Sets the rect of a component
+		 * 
+		 * @param aComponentIndex specifies the component
+		 * @param aRect the rect that the component is set
+		 *
+		 * @return  the end mark position
+		 */		
+		IMPORT_C void SetComponentRect(TCutterBarComponent aComponentIndex, TRect aRect);
+		
+		/** 
+		 * Sets one of the cutterbar components to pressed state. This function
+		 * can also be used to set ENoPressedIcon as pressed component (= none
+		 * of the components is pressed) 
+		 * 
+		 * @param aComponentIndex specifies the component that should be 
+		 *          set to pressed state
+		 *
+		 * @return -
+		 */	
+		IMPORT_C void SetPressedComponent(TCutterBarPressedIcon aComponentIndex);
+
+    public:
+
+		/**
+		 * Handles key events from framework.
+		 * 
+		 * @param aKeyEvent  the key event
+		 * @param aType  the type of key event
+		 *
+		 * @return always <code>EKeyWasNotConsumed</code>
+		 */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
+			TEventCode aType);        
+
+    private:
+
+        /**
+         * Default constructor.
+		 *
+         * @param aCont  pointer to the container
+         */
+        void ConstructL( const CCoeControl* aParent, TBool aDrawBorder );
+
+       /**
+        * From CoeControl,SizeChanged.
+        */
+        void SizeChanged();
+
+       /**
+        * From CoeControl,CountComponentControls.
+		*
+		* @return  number of component controls in this control
+        */
+        TInt CountComponentControls() const;
+
+       /**
+        * From CCoeControl,ComponentControl.
+		*
+		* @param aIndex  index of the control to return
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+       /**
+        * From CCoeControl,Draw.
+		*
+		* @param aRect  rectangle to draw
+        */
+        void Draw(const TRect& aRect) const;
+
+       /**
+        * From MCoeControlObserver, called when there is a control event
+		* to handle.
+		*
+		* @param aControl  control originating the event
+		* @param aEventType  event type
+        */
+        void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
+                
+        // for test use
+        void DrawCoordinate(TInt aX, TInt aY, TInt aData1, TInt aData2, const TDesC& aInfo) const;
+
+		/**
+		 * Calculates the rect of the slider area that the user 
+		 * has selected to be cut
+		 * 
+		 * @param -
+		 *
+		 * @return rect of the area to be cut
+		 */
+        TRect CVeiCutterBar::CalculateCutAreaRect() const;
+
+    private:
+
+		/** In point. */
+		TUint iInPoint;
+
+		/** Out point. */
+		TUint iOutPoint;
+
+		TUint iTotalDuration;
+		/** Current point. This is where the vertical bar is drawn. */
+		TUint iCurrentPoint;
+
+		/** Flag for marking when the editing is finished. */
+		TBool iFinished;
+
+		TRect iCutBarRect;
+		TRect iScissorsIconRect;
+		
+		TBool iDimmed;
+		TBool iDrawBorder;
+		TBool iDrawPlayHead;
+		
+		/** Slider Graphics */
+		CFbsBitmap*		iScissorsIcon;
+		CFbsBitmap*		iScissorsIconMask;
+		CFbsBitmap*		iSliderLeftEndIcon;
+		CFbsBitmap*		iSliderLeftEndIconMask;
+		CFbsBitmap*		iSliderMiddleIcon;
+		CFbsBitmap*		iSliderMiddleIconMask;
+		CFbsBitmap*		iSliderRightEndIcon;
+		CFbsBitmap*		iSliderRightEndIconMask;		
+		CFbsBitmap*		iSliderSelectedLeftEndIcon;
+		CFbsBitmap*		iSliderSelectedLeftEndIconMask;
+		CFbsBitmap*		iSliderSelectedMiddleIcon;
+		CFbsBitmap*		iSliderSelectedMiddleIconMask;
+		CFbsBitmap*		iSliderSelectedRightEndIcon;
+		CFbsBitmap*		iSliderSelectedRightEndIconMask;		
+		CFbsBitmap*		iPlayheadIcon;
+		CFbsBitmap*		iPlayheadIconMask;
+		CFbsBitmap*		iPlayheadIconPressed;
+		CFbsBitmap*		iPlayheadIconPressedMask;
+		CFbsBitmap*		iStartMarkIcon;
+		CFbsBitmap*		iStartMarkIconMask;	
+		CFbsBitmap*		iStartMarkIconPressed;
+		CFbsBitmap*		iStartMarkIconPressedMask;	
+		CFbsBitmap*		iEndMarkIcon;
+		CFbsBitmap*		iEndMarkIconMask;
+		CFbsBitmap*		iEndMarkIconPressed;
+		CFbsBitmap*		iEndMarkIconPressedMask;		
+		CFbsBitmap*		iCutAreaBorderIcon;
+		CFbsBitmap*		iCutAreaBorderIconMask;		
+
+		/** Rects for the slider graphics */
+		TRect  iSliderLeftEndIconRect;
+		TRect  iSliderRightEndIconRect;
+		TRect  iSliderMiddleIconRect;
+		TRect  iSliderSelectedLeftEndIconRect;
+		TRect  iSliderSelectedMiddleIconRect;
+		TRect  iSliderSelectedRightEndIconRect;
+		TRect  iPlayheadIconRect;
+		TRect  iCutAreaBorderIconRect;
+
+		/** Start mark rect. Position moves dynamically. */
+        TRect iStartMarkRect;
+
+		/** End mark rect. Position moves dynamically. */        
+        TRect iEndMarkRect;
+
+        TRect iStartMarkTouchRect;
+        TRect iEndMarkTouchRect;
+		TRect iPlayheadTouchRect;
+		
+		// Tells what cutter bar component is pressed if any
+		TCutterBarPressedIcon iPressedComponent;
+
+    };
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/VeiEditVideoLabelNavi.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEIEDITVIDEOLABELNAVI_H__
+#define __VEIEDITVIDEOLABELNAVI_H__
+
+#include <aknview.h>
+#include <coecntrl.h>
+#include <aknutils.h>
+#include <ConeResLoader.h>
+
+// Forward declarations
+class CAknLayoutFont;
+
+/**
+* CVeiEditVideoLabelNavi. Navilabel with envelope and time.
+*
+*/
+
+class CVeiEditVideoLabelNavi : public CCoeControl
+    {
+public:
+	/**
+	* LabelNavi state.
+	*/
+	enum TLabelNaviState
+		{
+        EStateInitializing = 1,
+		EStateEditView,
+		EStateTrimForMmsView
+		};
+public: 
+	/**
+    * Destructor.
+    */
+	IMPORT_C virtual ~CVeiEditVideoLabelNavi();
+
+	/** 
+	* Static factory method.
+	*
+	* @return  the created CVeiEditVideoLabelNavi object
+	*/
+	IMPORT_C static CVeiEditVideoLabelNavi* NewL();
+
+	/** 
+	* Static factory method. Leaves the created object in the cleanup
+	* stack.
+	*
+	* @return  the created CVeiEditVideoLabelNavi object
+	*/
+	IMPORT_C static CVeiEditVideoLabelNavi* NewLC();
+
+	/**
+	* Set MMS envelope without red line or with it.
+	*/
+	IMPORT_C void SetMmsAvailableL( TBool aIsAvailable );
+
+	/**
+	* 
+	*/
+	IMPORT_C void SetMemoryAvailableL( TBool aIsAvailable );
+
+	/**
+	* Set memory in use Phone/MMC.
+	*/
+	IMPORT_C void SetMemoryInUseL( TBool aPhoneMemory );
+
+    /**
+    *
+    */
+	IMPORT_C TInt GetMaxMmsSize() const;
+
+public:
+	/**
+	* Set movie duration.
+    * @param aDuration in microseconds
+	*/
+	void SetDurationLabelL( const TInt64& aDuration );
+
+	/**
+	* Set movie size.
+	* @param aSize in kB.
+	*/
+	void SetSizeLabelL( const TUint& aSize );
+
+	/**
+	* Set whether editview or trimformms-view 
+	* @param aState
+	*/
+	void SetState( CVeiEditVideoLabelNavi::TLabelNaviState aState );
+
+	/**
+	* Set whether editview or trimformms-view 
+	* @param aState
+	*/
+	TBool IsMMSAvailable() const;
+
+
+protected:
+	/**
+	 * From CCoeControl. Handle the size change events.
+	 */
+	void SizeChanged();
+
+	/**
+	 * From CCoeControl.  Draw a control.  
+	 * @param aRect The region of the control to be redrawn.   
+ 	 */
+	void Draw(const TRect& aRect) const;
+
+	/**
+	 * From CCoeControl. Handles a change to the control's resources.  
+	 * @param aType A message UID value.
+ 	 */
+	void HandleResourceChange(TInt aType); 
+
+private:
+    /**
+	* Default constructor.
+    */
+    void ConstructL();
+
+	/**
+	* Constructor.
+	*/
+	CVeiEditVideoLabelNavi();
+
+	/**
+	* Completes construction after session to the messaging serve has been opened.
+	*/
+	void CompleteConstructL();
+
+	/**
+	* Load the icon bitmaps.
+	*/
+	void LoadBitmapsL();
+
+	/**
+	* Delete the icon bitmaps.
+	*/
+	void DeleteBitmaps();
+
+private: 
+	/** Movie duration. */
+	TInt64			iStoryboardDuration;
+
+	/** Movie size. */
+	TInt			iStoryboardSize;
+
+	/** Layouts for text. */
+	TAknLayoutText	iTextLayout[3];
+
+    /** Layouts for icons. */
+	TAknLayoutRect  iBitmapLayout[3];
+	
+	/** MMS available bitmap. */
+	CFbsBitmap*		iMmsBitmap;
+    /** MMS available bitmap mask. */
+    CFbsBitmap*	    iMmsBitmapMask;
+	/** MMS not available bitmap. */
+	CFbsBitmap*		iNoMmsBitmap;
+    /** MMS not available bitmap mask. */
+    CFbsBitmap*     iNoMmsBitmapMask;
+
+	/** MMS available flag. */
+	TBool			iMmsAvailable;
+	/** MMS Max size. */
+	TInt			iMmsMaxSize;
+	
+	/** Current state. */
+	TLabelNaviState iState;
+
+	/** Hard disk available bitmap.  */
+	CFbsBitmap*	iPhoneMemoryBitmap;
+    /** Hard disk available bitmap mask.  */
+	CFbsBitmap*	iPhoneMemoryBitmapMask;
+
+	/** Hard disk not available bitmap. */
+	CFbsBitmap*	iNoPhoneMemoryBitmap;
+    /** Hard disk not available bitmap mask. */
+	CFbsBitmap*	iNoPhoneMemoryBitmapMask;
+
+	/** Hard disk available flag. */
+	TBool		iPhoneMemoryAvailable;
+
+	/** Hard disk available bitmap.  */
+	CFbsBitmap*	iMMCBitmap;
+    /** Hard disk available bitmap mask.  */
+	CFbsBitmap*	iMMCBitmapMask;
+
+	/** Hard disk not available bitmap. */
+	CFbsBitmap*	iNoMMCBitmap;
+    /** Hard disk not available bitmap mask. */
+	CFbsBitmap*	iNoMMCBitmapMask;
+
+
+	/** Hard disk available flag. */
+	TBool		iMMCAvailable;
+
+	/** Whether phone memory or memory card in use. */
+	TBool		iPhoneMemory;
+
+	/** Whether is enough memory  */
+	TBool		iMemoryAvailable;
+	
+	/** Time bitmap. */
+	CFbsBitmap* iTimeBitmap;
+
+	/** Time bitmap mask. */
+	CFbsBitmap* iTimeBitmapMask;
+
+	RConeResourceLoader 	iResLoader;
+	
+	CAknLayoutFont* 		iCustomFont;
+    };
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/VeiErrorUi.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VEIERRORUI_H
+#define VEIERRORUI_H
+
+// INCLUDES
+#include <e32base.h>
+#include <ConeResLoader.h>
+#include "VideoEditorCommon.h"
+
+// FORWARD DECLARATIONS
+class CErrorUI;
+class CCoeEnv;
+
+/**	CLASS:	CVeiErrorUI
+* 
+*	Extended error UI.
+*
+*/
+NONSHARABLE_CLASS( CVeiErrorUI ) : public CBase
+{
+public:
+
+	/** @name Methods:*/
+	//@{
+
+	/**
+	* Destructor
+	*/
+	CVeiErrorUI::~CVeiErrorUI();
+
+	/**
+	* Static factory constructor.
+	*
+	* @param   aCoeEnv
+	* @return  created instance
+	*/
+	IMPORT_C static CVeiErrorUI* NewL( CCoeEnv& aCoeEnv );
+
+	/**
+	* Shows global error note for given error.
+	* There are empirically tested error codes for which platform shows something
+	* For other ones platform does not show anything and for them default string is showed.
+	* These error codes must be individually tested for every phone model.
+	*
+	* @param aError standard error code
+	* @return error code if showing the note fails, or KErrNone
+	*/
+	IMPORT_C TInt ShowGlobalErrorNote( TInt aError ) const;
+
+	/**
+	* Shows error note with given message.
+	* 
+	* @param aCoeEnv No description.
+	* @param aResourceId No description.
+	* @param aError No description.
+	* @return error code if showing the note fails, or KErrNone
+	*/
+	IMPORT_C static TInt ShowErrorNote( CCoeEnv& aCoeEnv, const TInt aResourceId = 0, TInt aError = 0 );
+        
+	//@}
+
+private:
+
+    /** @name Methods:*/
+    //@{
+
+	/**
+	* C++ constructor.
+	*/
+	CVeiErrorUI( CCoeEnv& aCoeEnv );
+
+	/**
+	* Second-phase constructor.
+	*/
+	void ConstructL();
+
+    //@}
+
+private:
+
+	/** @name Members:*/
+	//@{
+
+	CCoeEnv& 				iCoeEnv;
+	RConeResourceLoader 	iResLoader;
+	CErrorUI* 				iErrorUI;
+
+	//@}
+};
+
+#endif
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/VeiSlider.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,346 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/*	
+*   File:       VeiSlider.h
+*   Created:    30-10-2004
+*   Author:     
+*               
+*/
+
+#ifndef __VEISLIDER_H__
+#define __VEISLIDER_H__
+
+#include <coecntrl.h>
+
+class CFbsBitmap;
+
+/*! 
+  @class CVeiSlider
+  @discussion Simple slider control base class.
+  */
+  
+class CVeiSlider : public CCoeControl
+    {
+	public: 
+
+		/*!
+		  @function ~CVeiSlider
+		  @discussion Destroy the object and release all memory objects
+		  */
+		IMPORT_C ~CVeiSlider();
+
+	public: // new functions
+
+		/*!
+		  @function SetMinimum
+		  @param aValue the new minimum value
+		  @discussion Sets the minimum value of the slider
+		  */
+		IMPORT_C void SetMinimum(TInt aValue);
+
+		/*!
+		  @function SetMaximum
+		  @param aValue the new maximum value
+		  @discussion Sets the maximum value of the slider
+		  */
+		IMPORT_C void SetMaximum(TInt aValue);
+
+		/*!
+		  @function SetStepL
+		  @param aValue the new step value
+		  @discussion Sets the step of the slider
+		  */
+		IMPORT_C void SetStep(TUint aValue);
+
+		/*!
+		  @function SetStepAmount
+		  @param aValue the new step amount
+		  @discussion Sets the number of steps in the slider
+		  */
+		IMPORT_C void SetStepAmount(TUint8 aValue);
+
+		/*!
+		  @function SetPosition
+		  @discussion Sets the position of the slider. Panics if the position is out of bounds.
+		  */
+		IMPORT_C void SetPosition(TInt aValue);
+
+		/*!
+		  @function Minimum
+		  @discussion Gets the minimum value of the slider
+		  @return minimum value
+		  */
+		IMPORT_C TInt Minimum() const;
+
+		/*!
+		  @function Maximum
+		  @discussion Gets the maximum value of the slider
+		  @return maximum value
+		  */
+		IMPORT_C TInt Maximum() const;
+
+		/*!
+		  @function Step
+		  @discussion Gets the step of the slider
+		  @return current step
+		  */
+		IMPORT_C TInt Step() const;
+
+		/*!
+		  @function SliderPosition
+		  @discussion Gets the position of the slider
+		  @return current position
+		  */
+		IMPORT_C TInt SliderPosition() const;
+
+		/*!
+		  @function Increment
+		  @discussion Increments the slider
+		  */
+		IMPORT_C void Increment();
+
+		/*!
+		  @function Decrement
+		  @discussion Decrements the slider
+		  */
+		IMPORT_C void Decrement();
+		
+		/*!
+		  @function MinimumSize
+		  @discussion Gets the minimum size of this component
+		  @return a minimum size of the control
+		  */
+		virtual TSize MinimumSize() = 0;
+
+	protected:
+
+		/*!
+		  @function CVeiSlider
+		  @discussion Constructs this object
+		  */
+		CVeiSlider();				
+
+		/*!
+		  @function LoadBitmapL
+		  @discussion Loads one bitmap and its mask
+		  */
+		void LoadBitmapL( 
+            CFbsBitmap*& aBitmap, 
+            CFbsBitmap*& aMask, 
+            TInt aBitmapIndex, 
+            TInt aMaskIndex 
+            ) const;
+
+	public: // from CoeControl
+
+		/*!
+		  @function CountComponentControls
+		  @return Number of component controls 
+		  */
+		virtual TInt CountComponentControls() const;
+
+		/*!
+		  @function ComponentControl.
+		  @param aIndex index of the component control
+		  @return Pointer to component control
+		  */
+		virtual CCoeControl* ComponentControl(TInt aIndex) const;
+
+
+	protected: // data
+
+		/// bitmap holding the slider background
+		CFbsBitmap* iSliderBg;
+
+		/// mask for the slider background
+		CFbsBitmap* iSliderBgMask;
+
+		/// bitmap holding the slider tab that moves
+		CFbsBitmap* iSliderTab;
+
+		/// mask for the slider tab
+		CFbsBitmap* iSliderTabMask;
+
+	private: // data
+
+		/// minimum value of the slider
+		TInt iMinimumValue;
+
+		/// maximum value of the slider
+		TInt iMaximumValue;
+
+		/// step value
+		TUint iStep;
+
+		/// number of steps
+		TUint8 iNumberOfSteps;
+
+		/// current position
+		TInt iPosition;
+
+    };
+
+
+
+/*! 
+  @class CVeiVerticalSlider
+  @discussion Vertical slider control
+  */
+
+NONSHARABLE_CLASS( CVeiVerticalSlider ) : public CVeiSlider
+    {
+	public: 
+
+		/*!
+		  @function NewL
+		  @discussion Create a CVeiVerticalSlider object, which will draw itself to aRect
+		  @param aRect the rectangle this view will be drawn to
+		  @return a pointer to the created instance of CVeiVerticalSlider
+		  */
+		IMPORT_C static CVeiVerticalSlider* NewL(const TRect& aRect, const CCoeControl& aControl);
+
+		/*!
+		  @function NewLC
+		  @discussion Create a CVeiSlider object, which will draw itself to aRect
+		  @param aRect the rectangle this view will be drawn to
+		  @return a pointer to the created instance of CVeiSlider
+		  */
+		IMPORT_C static CVeiVerticalSlider* NewLC(const TRect& aRect, const CCoeControl& aControl);
+
+		/*!
+		  @function ~CVeiSlider
+		  @discussion Destroy the object and release all memory objects
+		  */
+		IMPORT_C ~CVeiVerticalSlider();
+
+		/*!
+		  @function MinimumSize
+		  @discussion Gets the minimum size of this component
+		  @return a minimum size of the control
+		  */
+		IMPORT_C TSize MinimumSize();
+
+	private:
+
+		/*!
+		  @fuction ConstructL
+		  @discussion Perform the second phase construction of a CVeiVerticalSlider object
+		  @param aRect Frame rectangle for container.
+		  */
+		void ConstructL(const TRect& aRect, const CCoeControl& aControl);
+
+		/*!
+		  @function CVeiVerticalSlider
+		  @discussion Constructs this object
+		  */
+		CVeiVerticalSlider();
+
+	public: // from CoeControl
+
+		/*!
+		  @function Draw
+		  @discussion Draw this CVeiVerticalSlider to the screen
+		  @param aRect the rectangle of this view that needs updating
+		  */
+		virtual void Draw(const TRect& aRect) const;
+
+		/*!
+		  @function SizeChanged
+		  @discussion Responds to changes to the size and position of the contents of this control.
+		  */
+		virtual void SizeChanged();
+
+    };
+
+
+
+/*! 
+  @class CVeiHorizontalSlider
+  @discussion Horizontal slider control
+  */
+
+NONSHARABLE_CLASS( CVeiHorizontalSlider ) : public CVeiSlider
+    {
+	public: 
+
+		/*!
+		  @function NewL
+		  @discussion Create a CVeiHorizontalSlider object, which will draw itself to aRect
+		  @param aRect the rectangle this view will be drawn to
+		  @return a pointer to the created instance of CVeiHorizontalSlider
+		  */
+		IMPORT_C static CVeiHorizontalSlider* NewL(const TRect& aRect, const CCoeControl& aControl);
+
+		/*!
+		  @function NewLC
+		  @discussion Create a CVeiSlider object, which will draw itself to aRect
+		  @param aRect the rectangle this view will be drawn to
+		  @return a pointer to the created instance of CVeiSlider
+		  */
+		IMPORT_C static CVeiHorizontalSlider* NewLC(const TRect& aRect, const CCoeControl& aControl);
+
+		/*!
+		  @function ~CVeiSlider
+		  @discussion Destroy the object and release all memory objects
+		  */
+		IMPORT_C ~CVeiHorizontalSlider();
+
+		/*!
+		  @function MinimumSize
+		  @discussion Gets the minimum size of this component
+		  @return a minimum size of the control
+		  */
+		IMPORT_C TSize MinimumSize();
+
+	private:
+
+		/*!
+		  @fuction ConstructL
+		  @discussion Perform the second phase construction of a CVeiHorizontalSlider object
+		  @param aRect Frame rectangle for container.
+		  */
+		void ConstructL(const TRect& aRect, const CCoeControl& aControl);
+
+		/*!
+		  @function CVeiHorizontalSlider
+		  @discussion Constructs this object
+		  */
+		CVeiHorizontalSlider();
+
+	public: // from CoeControl
+
+		/*!
+		  @function Draw
+		  @discussion Draw this CVeiHorizontalSlider to the screen
+		  @param aRect the rectangle of this view that needs updating
+		  */
+		virtual void Draw(const TRect& aRect) const;
+
+		/*!
+		  @function SizeChanged
+		  @discussion Responds to changes to the size and position of the contents of this control.
+		  */
+		virtual void SizeChanged();
+
+    };
+
+#endif // __VEISLIDER_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/VeiSlider.pan	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#ifndef __VEISLIDER_PAN__
+#define __VEISLIDER_PAN__
+
+enum TVeiSliderPanic
+    {
+    EVeiSliderPanicMinMax = -0x100,
+    EVeiSliderPanicBitmapsNotLoaded,
+    EVeiSliderPanicStepNotPositive,
+    EVeiSliderPanicIndexUnderflow,
+    EVeiSliderPanicIndexOverflow,
+    EVeiSliderPanicOther
+    };
+
+void Panic(TInt aCategory)
+    {
+    _LIT(KComponentName, "VEISLIDER");
+    User::Panic(KComponentName, aCategory);
+    }
+
+#endif __VEISLIDER_PAN__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/VeiTextDisplay.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,242 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef VEITEXTDISPLAY_H
+#define VEITEXTDISPLAY_H
+
+#include <coecntrl.h>
+#include <ConeResLoader.h>
+
+
+/**
+ * CVeiTextDisplay control class.
+ */
+class CVeiTextDisplay : public CCoeControl
+    {
+    public:
+        /**
+         * Destructor.
+         */
+        IMPORT_C virtual ~CVeiTextDisplay();
+
+		/** 
+		 * Static factory method.
+		 * 
+		 * @return  the created CVeiTextDisplay object
+		 */
+		IMPORT_C static CVeiTextDisplay* NewL( const TRect& aRect, const CCoeControl* aParent );
+
+		/** 
+		 * Static factory method. Leaves the created object in the cleanup
+		 * stack.
+		 *
+		 * @return  the created CVeiCutAudioBar object
+		 */
+		IMPORT_C static CVeiTextDisplay* NewLC( const TRect& aRect, const CCoeControl* aParent );
+
+
+	public:
+
+		enum TVeiLayout
+			{
+			EOnlyName = 0x77,
+			ENameAndDuration,
+			EEverything,
+			ECutInCutOut,
+			EArrowsHorizontal,
+			EArrowsVertical,
+			ERecording,
+			ERecordingPaused,
+            EOnlyDuration
+			};
+			
+    	/**
+		 * CVeiTextDisplay components.
+		 */
+		 enum TTextDisplayComponent
+			{
+			EStartTimeText= 1,
+			EEndTimeText,
+			EStartTimeIcon,
+			EEndTimeIcon			
+			};			
+
+		IMPORT_C void SetLandscapeScreenOrientation( TBool aLandscapeScreenOrientation );
+
+		IMPORT_C void SetCutIn( const TTimeIntervalMicroSeconds& aCutInTime );
+		
+		IMPORT_C void SetCutOut( const TTimeIntervalMicroSeconds& aCutOutTime );
+
+		IMPORT_C void SetTime( const TTime& aClipTime );
+
+		IMPORT_C void SetLocation( const TDesC& aClipLocation );
+
+		IMPORT_C void SetLayout( TVeiLayout aLayout );
+
+		IMPORT_C void SetName( const TDesC& aName );
+
+		IMPORT_C void SetDuration( const TTimeIntervalMicroSeconds& aDuration );
+
+		/** 
+		 * Control Up arrow visibility.
+		 * 
+		 * @param aVisible True/False
+		 */
+		IMPORT_C void SetUpperArrowVisibility(TBool aVisible);
+
+		/** 
+		 * Control Lower arrow visibility.
+		 * 
+		 * @param aVisible True/False
+		 */
+		IMPORT_C void SetLowerArrowVisibility(TBool aVisible);
+
+		/** 
+		 * Control Right arrow visibility.
+		 * 
+		 * @param aVisible True/False
+		 */
+		IMPORT_C void SetRightArrowVisibility(TBool aVisible);
+
+		/** 
+		 * Control Left arrow visibility.
+		 * 
+		 * @param aVisible True/False
+		 */
+		IMPORT_C void SetLeftArrowVisibility(TBool aVisible);
+		
+		/** 
+		 * Set slow motion on status.
+		 * 
+		 * @param aOn True/False
+		 */
+		IMPORT_C void SetSlowMotionOn(TBool aOn);
+
+		/** 
+		 * slow motion on status.
+		 * 
+		 * @return aOn True/False
+		 */
+		IMPORT_C TBool SlowMotionOn() const;
+		
+		/** 
+		 * Set value of slow motion effect.
+		 * 
+		 * @param aPreset
+		 */
+		IMPORT_C void SetSlowMotionPreset(TInt aPreset);
+
+		/** 
+		 * Slow motion effect value.
+		 * 
+		 * @return value 
+		 */
+		IMPORT_C TInt SlowMotionPreset() const;
+
+		IMPORT_C void SetArrowSize(const TSize& aArrowSize);
+
+		void ParseTimeToMinSec( TDes& aLayoutTime, const TTimeIntervalMicroSeconds& aDuration ) const;
+		
+		/** 
+		 * Sets the rect of a component
+		 * 
+		 * @param aComponentIndex specifies the component
+		 * @param aRect the rect that the component is set
+		 *
+		 * @return  the end mark position
+		 */		
+		IMPORT_C void SetComponentRect(TTextDisplayComponent aComponentIndex, TRect aRect);
+
+    private:
+        /**
+         * Default constructor.
+		 *
+         */
+        void ConstructL( const TRect& aRect, const CCoeControl* aParent );
+
+        /**
+         * C++ default constructor.
+		 *
+         */
+		CVeiTextDisplay::CVeiTextDisplay();
+
+       /**
+        * From CCoeControl,Draw.
+		*
+		* @param aRect  rectangle to draw
+        */
+        void Draw(const TRect& aRect) const;
+
+		static TInt UpdateBlinker( TAny* aThis );
+		void DoUpdateBlinker();
+		void SizeChanged();
+
+    private:	// data
+		HBufC*		iClipName;
+		TTimeIntervalMicroSeconds iDuration;
+		TTime		iClipTime;		
+		HBufC*		iClipLocation;
+		
+		TTimeIntervalMicroSeconds	iCutInTime;
+		TTimeIntervalMicroSeconds	iCutOutTime;
+
+		TVeiLayout	iLayout;
+
+		CFbsBitmap* iUpperArrow;
+		CFbsBitmap* iLowerArrow;
+		CFbsBitmap* iRightArrow;
+		CFbsBitmap* iLeftArrow;
+		CFbsBitmap* iUpperArrowMask;
+		CFbsBitmap* iLowerArrowMask;
+		CFbsBitmap* iRightArrowMask;
+		CFbsBitmap* iLeftArrowMask;
+		CFbsBitmap* iStartMarkIcon;
+		CFbsBitmap* iStartMarkIconMask;
+		CFbsBitmap* iEndMarkIcon;
+		CFbsBitmap* iEndMarkIconMask;
+
+		TBool		iUpperArrowVisible;
+		TBool		iLowerArrowVisible;
+		TBool		iRightArrowVisible;
+		TBool		iLeftArrowVisible;
+
+		TBool		iLandscapeScreenOrientation;
+		TBool		iSlowMotionOn;
+		TInt		iPresetValue;	
+		
+		CPeriodic*	iBlinkTimer;
+		TBool		iBlinkFlag;
+
+		TSize		iDynamicArrowSize;
+		
+		TPoint 		iUpperArrowPoint;
+		TPoint 		iLowerArrowPoint;
+
+		RConeResourceLoader 	iResLoader;
+
+		TRect	iStartTimeIconRect;
+    	TRect	iEndTimeIconRect;
+       	TRect	iStartTimeTextRect;
+    	TRect	iEndTimeTextRect;
+
+    };
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/VeiTimeLabelNavi.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+#ifndef TIMELABELNAVI_H
+#define TIMELABELNAVI_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <aknutils.h>
+
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+class MTimeLabelNaviObserver;
+#ifdef RD_TACTILE_FEEDBACK 
+class MTouchFeedback; 
+#endif /* RD_TACTILE_FEEDBACK  */
+
+// CLASS DECLARATION
+
+/**
+ * CTimeLabelNavi
+ */
+class CVeiTimeLabelNavi : public CCoeControl
+{
+	public: // Constructors and destructor
+		/**
+		 *  Destructor      
+		 */
+		IMPORT_C virtual ~CVeiTimeLabelNavi();
+
+		/**
+		 *  Constructors.
+ 		 */
+		IMPORT_C static CVeiTimeLabelNavi* NewL();
+		IMPORT_C static CVeiTimeLabelNavi* NewLC();
+
+
+	public: // New functions
+		/**
+         * Changes navipane label.
+         * @param aLabel label text
+         */
+		IMPORT_C void SetLabelL(const TDesC& aLabel);
+		
+		/**
+         * Sets left navipane arrow visibility
+         * @param aVisible Whether to show or not.
+         * @return -
+         */
+		IMPORT_C void SetLeftArrowVisibilityL(TBool aVisible);
+
+		/**
+         * Sets right navipane arrow visibility
+         * @param aVisible Whether to show or not.
+         * @return -
+         */
+		IMPORT_C void SetRightArrowVisibilityL(TBool aVisible);
+
+		/**
+         * Sets volume icon visibility
+         * @param aVisible Whether to show or not.
+         * @return -
+         */
+		IMPORT_C void SetVolumeIconVisibilityL(TBool aVisible);
+		
+		/**
+		* Sets pause icon visibility
+		* @param aVisible whether to show or not.
+		* @return -
+		*/
+		IMPORT_C void SetPauseIconVisibilityL(TBool aVisible);
+
+		/**
+		* SetNaviObserver
+		* @param aObserver Observer.
+		*/		
+		void SetNaviObserver(MTimeLabelNaviObserver* aObserver)
+		    {
+		    iObserver = aObserver;
+		    };
+
+	protected: // Functions from base classes   
+
+		/**
+		* From CCoeControl. Handle the size change events.
+		*/
+		void SizeChanged();
+
+		/**
+		* From CCoeControl.  Draw a control.  
+		* @param aRect The region of the control to be redrawn.   
+		*/
+		void Draw(const TRect& aRect) const;
+
+		/**
+		* From CCoeControl. Handles a change to the control's resources.  
+		* @param aType A message UID value.
+	 	*/
+		void HandleResourceChange(TInt aType); 
+		
+		/**
+		* From CCoeControl. Handles a control's pointer events.  
+		* @param aPointerEvent  pointer event.
+	 	*/		
+		void HandlePointerEventL(const TPointerEvent& aPointerEvent);
+
+	private: // Constructors and destructor
+
+		/**
+		 * Constructor.
+		 */
+		CVeiTimeLabelNavi();
+
+		/**
+ 		 * EPOC 2nd phase constructor.
+		 */
+		void ConstructL();
+
+		/**
+ 		 * Load the icon bitmaps.
+		 */
+		void LoadBitmapsL();
+
+		/**
+ 		 * Delete the icon bitmaps.
+		 */
+		void DeleteBitmaps();
+	
+	private:    // Data
+	    /// Own: Volume bitmap
+	    CFbsBitmap* iVolumeBitmap;
+	    CFbsBitmap* iVolumeBitmapMask;
+	    
+	    /// Own: Arrow bitmap
+		CFbsBitmap* iArrowBitmap;
+		CFbsBitmap* iArrowBitmapMask;
+
+		/// Own: Muted bitmap
+		CFbsBitmap* iMutedBitmap;
+		CFbsBitmap* iMutedBitmapMask;
+		
+		/// Own: Paused bitmap
+		CFbsBitmap* iPausedBitmap;
+		CFbsBitmap* iPausedBitmapMask;
+		
+		TBool iArrowVisible;
+		TBool iVolumeIconVisible;
+		TBool iPauseIconVisible;
+
+		TBuf<32> iLabel;
+
+		/// Rectangle where label is drawn
+		TAknLayoutText iTextLayout;
+		/// Layout array for volume/muted, array and paused items 
+		TAknLayoutRect iBitmapLayout[3];
+		
+		/// Ref: to observer
+		MTimeLabelNaviObserver* iObserver;
+
+    	// Feedback for screen touch:
+#ifdef RD_TACTILE_FEEDBACK 
+		MTouchFeedback* iTouchFeedBack;
+#endif /* RD_TACTILE_FEEDBACK  */ 
+
+};
+
+#endif // VEITIMELABELNAVI_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/VeiVideoDisplay.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,254 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Declares VeiCutAudioBar control for the video editor application.
+*
+*/
+
+
+
+#ifndef VEIVIDEODISPLAY_H
+#define VEIVIDEODISPLAY_H
+
+#include <coecntrl.h>
+#include <coemain.h>
+#include <VideoPlayer.h>
+
+const TInt KMaxVolumeLevel = 10;
+
+class CAknBitmapAnimation;
+/**
+ * Observer for notifying that video player
+ * has finished playing
+ *
+ * 
+ */
+class MVeiVideoDisplayObserver
+	{
+public:
+		enum TPlayerEvent
+		{
+        EStop = 0x90, 
+		ELoadingStarted,
+		EOpenComplete,
+        EPlayComplete,
+		EBufferingStarted,
+		ELoadingComplete,
+		EVolumeLevelChanged,
+		EError
+		};
+	/**
+	 * Called to notify that amr conversion is completed
+	 * 
+	 * @param aConvertedFilename   converted filename.
+	 * @param aError  <code>KErrNone</code> if conversion was
+	 *                completed successfully; one of the system wide
+	 *                error codes if conversion failed
+	 */
+	virtual void NotifyVideoDisplayEvent( const TPlayerEvent aEvent, const TInt& aInfo = 0 ) = 0;
+	
+
+	};
+/**
+ * CVeiVideoDisplay control class.
+ */
+class CVeiVideoDisplay :	public CCoeControl, 
+							public MVideoPlayerUtilityObserver,
+							public MVideoLoadingObserver,
+							public MCoeForegroundObserver
+    {
+    public:
+        /**
+         * Destructor.
+         */
+        IMPORT_C virtual ~CVeiVideoDisplay();
+
+		/** 
+		 * Static factory method.
+		 * 
+		 * @return  the created CVeiVideoDisplay object
+		 */
+		IMPORT_C static CVeiVideoDisplay* NewL( const TRect& aRect, const CCoeControl* aParent,
+			 MVeiVideoDisplayObserver& aObserver );
+
+		/** 
+		 * Static factory method. Leaves the created object in the cleanup
+		 * stack.
+		 *
+		 * @return  the created CVeiCutAudioBar object
+		 */
+		IMPORT_C static CVeiVideoDisplay* NewLC( const TRect& aRect, const CCoeControl* aParent,
+			 MVeiVideoDisplayObserver& aObserver);
+
+	public:
+
+		IMPORT_C TInt Volume() const;
+		IMPORT_C void ShowAnimationL( TInt aResourceId, TInt aFrameIntervalInMilliSeconds=-1 );
+		IMPORT_C void StopAnimation();
+		IMPORT_C void OpenFileL( const TDesC& aFilename );
+
+		IMPORT_C void Play();
+		IMPORT_C void PlayL( const TDesC& aFilename,
+					const TTimeIntervalMicroSeconds& aStartPoint = 0, 
+					const TTimeIntervalMicroSeconds& aEndPoint = 0);
+					
+		IMPORT_C void PlayMarkedL( const TTimeIntervalMicroSeconds& aStartPoint, 
+			const TTimeIntervalMicroSeconds& aEndPoint);
+
+		IMPORT_C void Stop( TBool aCloseStream );
+
+		IMPORT_C void PauseL();
+
+		IMPORT_C void ShowPictureL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask );
+
+		IMPORT_C void ShowPictureL( const CFbsBitmap& aBitmap );
+
+        IMPORT_C void SetPictureL( const CFbsBitmap& aBitmap );
+
+		IMPORT_C void ShowBlankScreen();
+
+        IMPORT_C void ShowBlackScreen();
+
+        IMPORT_C void SetBlackScreen( TBool aBlack );
+
+		IMPORT_C TTimeIntervalMicroSeconds PositionL() const;
+
+		IMPORT_C void SetPositionL( const TTimeIntervalMicroSeconds& aPosition );
+
+		IMPORT_C TInt GetBorderWidth() const;
+
+		IMPORT_C TSize GetScreenSize() const;
+
+		IMPORT_C TTimeIntervalMicroSeconds TotalLengthL();
+
+		IMPORT_C void SetFrameIntervalL(TInt aFrameIntervalInMilliSeconds);
+
+        IMPORT_C void SetRotationL(TVideoRotation aRotation);
+
+        IMPORT_C TVideoRotation RotationL() const;
+
+		IMPORT_C void SetMuteL( TBool aMuted );
+
+		IMPORT_C void AdjustVolumeL( TInt aIncrement );
+
+	public:
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
+
+	private: // From MCoeForegroundObserver
+
+		virtual void HandleGainingForeground();
+		virtual void HandleLosingForeground();
+
+	private:
+		TInt TimeIncrement(TInt aKeyCount) const;
+
+		virtual void HandleResourceChange(TInt aType); 
+		 /**
+         * Default constructor.
+		 *
+         */
+        void ConstructL( const TRect& aRect, const CCoeControl* aParent );
+		 /**
+         * C++ default constructor.
+		 *
+         */
+        CVeiVideoDisplay( MVeiVideoDisplayObserver& aObserver );
+		/*
+        * From CoeControl,SizeChanged.
+        */
+        void SizeChanged();
+
+		// From MVideoPlayerUtilityObserver
+		void MvpuoOpenComplete( TInt aError );
+		void MvpuoFrameReady( CFbsBitmap& aFrame, TInt aError );
+		void MvpuoPlayComplete( TInt aError );
+		void MvpuoPrepareComplete( TInt aError );
+		void MvpuoEvent( const TMMFEvent& aEvent );
+		void MvloLoadingStarted();
+		void MvloLoadingComplete();
+       /**
+        * From CCoeControl,Draw.
+		*
+		* @param aRect  rectangle to draw
+        */
+        void Draw(const TRect& aRect) const;
+
+		TRect CalculateVideoPlayerArea();
+		
+		void LocateEntryL();
+		
+		void SetPlaybackVolumeL();
+
+		void StoreDisplayBitmapL( const CFbsBitmap& aBitmap, const CFbsBitmap* aMask = NULL);
+
+       /**
+        * Set the animation's frame interval via a callback. 
+        * This is needed because if the frame interval is altered immediately
+        * after the animation is started, the change does not take effect visually.
+		* There must be some delay in between.
+        */
+		void SetAnimationFrameIntervalCallbackL();
+		static TInt SetAnimationFrameIntervalCallbackMethod(TAny* aThis);
+
+    private:	// data
+
+		/** Video player utility. */
+		CVideoPlayerUtility*	iVideoPlayerUtility;
+		CFbsBitmap*				iDisplayBitmap;
+		CFbsBitmap*				iDisplayMask;
+
+		CFbsBitmap*				iBgSquaresBitmap;
+		CFbsBitmap*				iBgSquaresBitmapMask;
+
+		MVeiVideoDisplayObserver&	iObserver;
+		TBool					iBlank;
+		TInt					iBorderWidth;
+		TTimeIntervalMicroSeconds	iDuration;
+		/** Videoplayerutility volume */
+		TInt 					iInternalVolume;
+
+		/** Max volume */
+		TInt 					iMaxVolume;
+
+		
+		TBool					iAnimationOn;
+        TBool					iBlack;
+		CAknBitmapAnimation*	iAnimation;
+		TInt					iAnimationResourceId;
+		TInt					iAnimationFrameIntervalInMilliSeconds;
+		TInt					iStoredAnimationFrameIntervalInMilliSeconds;
+
+		/** Seek thumbnail position in video clip. */
+		//TTimeIntervalMicroSeconds iSeekPos;
+		
+		TInt					iKeyRepeatCount;
+
+		TBool					iSeeking;
+		TBool					iBufferingCompleted;
+		
+		TBool					iMuted;
+		
+		HBufC* 						iFilename;
+		TTimeIntervalMicroSeconds	iStartPoint;
+		TTimeIntervalMicroSeconds	iEndPoint;
+		
+		TBool						iNewFile;
+
+		/** Callback utility for setting the animation frame interval*/
+		CAsyncCallBack* 			iCallBack;
+    };
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/inc/mtimelabelnaviobserver.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Time label navi observer.
+*
+*/
+
+
+#ifndef M_TIMELABELNAVIOBSERVER_H
+#define M_TIMELABELNAVIOBSERVER_H
+
+/**  ?description */
+//const ?type ?constant_var = ?constant;
+
+/**
+ *  Time label navi observer API
+ *
+ *  @lib VideoEditorUiComponents.lib
+ *  @since S60 v5.0
+ */
+class MTimeLabelNaviObserver
+    {
+
+public:
+    /**
+     * HandleNaviEventL
+     *
+     * Callend when navipane is clicked.
+     * @since S60 v5.0
+     */
+    virtual void HandleNaviEventL() = 0;
+
+    };
+
+
+#endif // M_TIMELABELNAVIOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/rom/VideoEditorUiComponents.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifdef RD_S60_SIMPLE_VIDEO_EDITOR
+
+#ifndef __VIDEOEDITORUICOMPONENTS_IBY__
+#define __VIDEOEDITORUICOMPONENTS_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+// Video Editor UI Components dll
+file=ABI_DIR\BUILD_DIR\VideoEditorUiComponents.dll	SHARED_LIB_DIR\VideoEditorUiComponents.dll
+
+// icons (svg)
+S60_APP_BITMAP(VideoEditorUiComponents)
+
+// Icons (bitmap)
+S60_APP_BITMAP(VideoEditorBitmaps)
+
+#endif	// __VIDEOEDITORUICOMPONENTS_IBY__
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/rom/VideoEditorUiComponents_resource.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#ifdef RD_S60_SIMPLE_VIDEO_EDITOR
+
+#ifndef __VIDEOEDITORUICOMPONENTSRESOURCES_IBY__
+#define __VIDEOEDITORUICOMPONENTSRESOURCES_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+data=DATAZ_\RESOURCE_FILES_DIR\VideoEditorUiComponents.rsc	RESOURCE_FILES_DIR\VideoEditorUiComponents.rsc
+
+#endif	// __VIDEOEDITORUICOMPONENTSRESOURCES_IBY__
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/src/ExtProgressAnimationControl.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/*
+*   File:       ExtProgressAnimationControl.cpp
+*   Created:    17-10-2005
+*   Author:     
+*               
+*/
+
+#include <gdi.h>
+#include <aknbitmapanimation.h>
+#include <barsread.h>
+#include <bmpancli.h>
+#include <aknsbasicbackgroundcontrolcontext.h> 
+#include <aknsdrawutils.h> 
+#include <aknutils.h>
+#include <VideoEditorUiComponents.rsg>
+
+#include "ExtProgressAnimationControl.h"
+#include "videoeditorcommon.h"
+
+//const TInt KCropFastKeyTimerDelayInMicroseconds = 10000;
+//const TInt KDefaultFastKeyTimerIntervalInMicroseconds = 10000;
+
+//	CONSTANTS
+//const TReal KIconHeightFrac = 0.25;
+//const TInt	KStartOffsetX = 10;
+
+//=============================================================================
+CExtProgressAnimationControl * CExtProgressAnimationControl::NewL (
+	const TRect &		aRect,
+	const CCoeControl *	aParent
+	)
+{
+	CExtProgressAnimationControl * self = new (ELeave) CExtProgressAnimationControl;
+	CleanupStack::PushL(self);
+	self->ConstructL (aRect, aParent);
+	CleanupStack::Pop( self ); 
+	return self;
+}
+
+//=============================================================================
+CExtProgressAnimationControl::~CExtProgressAnimationControl()
+{  
+	StopAnimation();
+
+	delete iAnimation;
+	delete iBgContext;
+}
+
+//=============================================================================
+void CExtProgressAnimationControl::SetAnimationResourceId(const TInt &aResourceId)
+{	
+	switch (aResourceId)
+		{
+		case VideoEditor::EAnimationMerging:
+			{			
+			iAnimationResourceId = R_VED_MERGING_NOTE_ANIMATION;
+			break;
+			}
+		case VideoEditor::EAnimationChangeAudio:
+			{			
+			iAnimationResourceId = R_VED_MERGING_AUDIO_NOTE_ANIMATION;
+			break;
+			}
+		case VideoEditor::EAnimationAddText:
+			{			
+			iAnimationResourceId = R_VED_ADDING_TEXT_NOTE_ANIMATION;
+			break;
+			}	
+		case VideoEditor::EAnimationCut:
+			{			
+			iAnimationResourceId = R_VED_CUTTING_NOTE_ANIMATION;
+			break;
+			}				
+		default:
+			{
+			iAnimationResourceId = R_VED_MERGING_NOTE_ANIMATION;
+			break;
+			}
+	}
+	
+}
+
+//=============================================================================
+CExtProgressAnimationControl::CExtProgressAnimationControl() : iBorderWidth(2)
+{
+
+}
+
+//=============================================================================
+void CExtProgressAnimationControl::ConstructL (
+	const TRect &		aRect,
+	const CCoeControl *	aParent
+	)
+{
+	SetContainerWindowL( *aParent );
+	SetRect(aRect);
+
+	//	Activate control
+	ActivateL();     
+}
+
+//=============================================================================
+void CExtProgressAnimationControl::SizeChanged()
+{
+	TRect rect = Rect();
+	if ( iBgContext )
+	{
+		iBgContext->SetRect( rect );
+	}
+}
+
+//=============================================================================
+void CExtProgressAnimationControl::Draw (const TRect& aRect) const
+{
+	CWindowGc& gc = SystemGc();
+
+	// draw skin background
+	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+	MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+	AknsDrawUtils::Background( skin, cc, this, SystemGc(), aRect );
+}
+
+//============================================================================= 
+TTypeUid::Ptr CExtProgressAnimationControl::MopSupplyObject( TTypeUid aId )
+{
+	if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext )
+	{
+		return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+	}
+	return CCoeControl::MopSupplyObject( aId );
+}
+
+//============================================================================= 
+void CExtProgressAnimationControl::HandleControlEventL(
+    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
+    {
+    }
+
+//============================================================================= 
+void CExtProgressAnimationControl::StartAnimationL(TInt aFrameIntervalInMilliSeconds )
+	{
+
+	if ( iAnimation )
+		{
+		delete iAnimation;
+		iAnimation = 0;
+		}	
+
+	iAnimation = CAknBitmapAnimation::NewL();
+
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC( reader, iAnimationResourceId );
+	iAnimation->ConstructFromResourceL( reader );
+	TRect rect( Rect() );
+	rect.Move( iBorderWidth, iBorderWidth );
+	rect.Resize( -iBorderWidth*2, -iBorderWidth );
+	iAnimation->SetRect( rect );
+	iAnimation->SetContainerWindowL( *this );
+	iAnimationOn = ETrue;
+	iAnimation->StartAnimationL();
+	CleanupStack::PopAndDestroy(); //reader
+	CBitmapAnimClientData* animClientData = iAnimation->BitmapAnimData();
+	iAnimationSpeedInMilliSeconds = animClientData->FrameIntervalInMilliSeconds();
+
+	if ( aFrameIntervalInMilliSeconds > 0 )
+		{
+		SetFrameIntervalL( aFrameIntervalInMilliSeconds );
+		}
+	DrawDeferred();
+	}
+
+//============================================================================= 
+void CExtProgressAnimationControl::StopAnimation()
+	{
+	if ( iAnimationOn )
+		{
+		iAnimation->CancelAnimation();
+		}
+	iAnimationOn = EFalse;
+	DrawDeferred();
+	}
+
+//============================================================================= 
+void CExtProgressAnimationControl::SetFrameIntervalL(TInt aFrameIntervalInMilliSeconds)
+	{
+	iAnimationSpeedInMilliSeconds+=aFrameIntervalInMilliSeconds;
+	iAnimation->SetFrameIntervalL( iAnimationSpeedInMilliSeconds );
+	}	
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/src/ExtProgressContainer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+/*
+*   File:       ExtProgressContainer.cpp
+*   Created:    14-10-2005
+*   Author:     
+*               
+*/
+
+#include "ExtProgressContainer.h"
+#include "ExtProgressAnimationControl.h"
+
+#include <eikprogi.h>
+#include <AknUtils.h> 
+#include <eiklabel.h>
+#include <aknsbasicbackgroundcontrolcontext.h> 
+#include <aknsdrawutils.h> 
+#include <gdi.h>
+
+// Constants
+const TInt KProgressBarDefaultFinalValue = 20;
+const TInt KProgressBarDefaultHeight = 15;
+const TInt KProgressBarDefaultWidth = 240;
+
+// Positions
+const TReal KContTX = 0.00;
+const TReal KContTY = 0.20;
+const TReal KContBX = 1.00;
+const TReal KContBY = 1.00;
+
+const TReal KLabelTX = 0.10;
+const TReal KLabelTY = 0.10;
+const TReal KLabelBX = 0.90;
+const TReal KLabelBY = 0.30;
+
+const TReal KAnimTX = 0.10;
+const TReal KAnimTY = 0.30;
+const TReal KAnimBX = 0.90;
+const TReal KAnimBY = 0.80;
+
+const TReal KProgTX = 0.10;
+const TReal KProgTY = 0.80;
+//const TReal KProgBX = 0.70;
+//const TReal KProgBY = 0.90;
+
+
+
+//============================================================================= 
+CExtProgressContainer * CExtProgressContainer::NewL (const TRect& aRect, CCoeControl* aParent)
+{
+    CExtProgressContainer* self = new (ELeave) CExtProgressContainer();
+    CleanupStack::PushL(self);
+    self->ConstructL(aRect, aParent);
+    CleanupStack::Pop( self );
+    return self;
+}
+
+//============================================================================= 
+CExtProgressContainer::CExtProgressContainer ()
+{
+}
+
+//============================================================================= 
+CExtProgressContainer::~CExtProgressContainer ()
+{
+    delete iProgressInfo;
+    delete iAnimationControl;
+    delete iLabel;
+	delete iBgContext;
+}
+
+//============================================================================= 
+void CExtProgressContainer::ConstructL (const TRect& aRect, CCoeControl* aParent)
+{
+    SetContainerWindowL(*aParent);
+    
+    TRect rect;
+    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);   
+    TSize size = rect.Size();
+    SetRect(TRect
+        (static_cast<TInt>(size.iWidth * KContTX + 0.5), 
+         static_cast<TInt>(size.iHeight * KContTY + 0.5), 
+         static_cast<TInt>(size.iWidth * KContBX + 0.5), 
+         static_cast<TInt>(size.iHeight * KContBY + 0.5))); 
+ 
+   
+    iLabel = new(ELeave) CEikLabel;
+    iLabel->SetContainerWindowL(*this);
+
+    iAnimationControl = CExtProgressAnimationControl::NewL(aRect, aParent);
+    iAnimationControl->SetObserver(this);
+	iAnimationControl->SetContainerWindowL(*this);	
+
+    // Set Progress Bar property, coding directly
+    CEikProgressInfo::SInfo info;
+    
+    info.iHeight = KProgressBarDefaultHeight;
+    info.iWidth = KProgressBarDefaultWidth;
+    info.iSplitsInBlock = 0;
+    info.iTextType = EEikProgressTextNone;  
+    info.iFinalValue = KProgressBarDefaultFinalValue;
+
+    iProgressInfo = new( ELeave ) CEikProgressInfo( info );
+
+    iProgressInfo->ConstructL();
+    iProgressInfo->SetContainerWindowL(*this);   
+    
+    SizeChanged();        
+    
+    ActivateL();    
+}
+
+//============================================================================= 
+void CExtProgressContainer::HandleControlEventL(
+    CCoeControl* /*aControl*/,TCoeEvent aEventType)
+{
+    if (aEventType == MCoeControlObserver::EEventStateChanged )
+    {
+        ReportEventL(MCoeControlObserver::EEventStateChanged);    
+    }
+    
+}
+    
+//============================================================================= 
+TInt CExtProgressContainer::CountComponentControls() const
+{
+    return 3;
+}
+
+//============================================================================= 
+CCoeControl* CExtProgressContainer::ComponentControl(TInt aIndex) const
+{
+    CCoeControl* ret = NULL;
+    switch (aIndex)
+    {
+        case 0:
+        {
+            ret = iLabel;
+            break;
+        }        
+        case 1:
+        {
+            ret = iAnimationControl;
+            break;
+        }
+        case 2:
+        {
+            ret = iProgressInfo;
+            break;
+        }
+        default:
+        {
+            break;
+        }
+        
+    }
+    
+    return ret;
+}
+
+//============================================================================= 
+CEikProgressInfo* CExtProgressContainer::GetProgressInfoL()
+{
+    return iProgressInfo;
+}
+
+//============================================================================= 		  
+CExtProgressAnimationControl* CExtProgressContainer::GetAnimationControlL()
+{
+    return iAnimationControl;   
+}
+
+//============================================================================= 		  
+void CExtProgressContainer::SetTextL(const TDesC &aText)
+{
+    iLabel->SetTextL(aText);   
+    DrawNow();
+}
+								  
+
+//============================================================================= 
+void CExtProgressContainer::Draw(const TRect& aRect) const
+{
+	CWindowGc& gc = SystemGc();
+
+	MAknsSkinInstance* skin = AknsUtils::SkinInstance();	
+	MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+	
+	AknsDrawUtils::Background( skin, cc, this, gc, aRect );	
+//	AknsDrawUtils::Background( skin, cc, iLabel, gc, aRect );
+//	AknsDrawUtils::Background( skin, cc, iProgressInfo, gc, aRect );	
+//	AknsDrawUtils::Background( skin, cc, iAnimationControl, gc, aRect );	
+	    
+	// Just draw a rectangle round the edge of the control.
+	// CWindowGc& gc=SystemGc();
+	//gc.Clear(aRect);
+	//gc.SetClippingRect(aRect);
+	//gc.DrawRect(Rect());
+}
+
+
+//============================================================================= 
+void CExtProgressContainer::SizeChanged()
+{
+    TRect rect( Rect() ); 
+	if ( iBgContext )
+	{
+		iBgContext->SetRect( rect );
+	}
+
+    TSize size= rect.Size();
+
+    if (iLabel)
+    {
+        iLabel->SetRect(TRect
+            (static_cast<TInt>(size.iWidth * KLabelTX + 0.5), 
+             static_cast<TInt>(size.iHeight * KLabelTY + 0.5), 
+             static_cast<TInt>(size.iWidth * KLabelBX + 0.5), 
+             static_cast<TInt>(size.iHeight * KLabelBY + 0.5 )));      
+    }
+
+    if (iAnimationControl )
+    {
+        iAnimationControl->SetRect(TRect
+            (static_cast<TInt>(size.iWidth * KAnimTX + 0.5), 
+             static_cast<TInt>(size.iHeight * KAnimTY + 0.5), 
+             static_cast<TInt>(size.iWidth * KAnimBX + 0.5), 
+             static_cast<TInt>(size.iHeight * KAnimBY + 0.5)));         
+    }
+    
+    if (iProgressInfo)
+    {
+        TSize minSize = iProgressInfo->MinimumSize();
+
+        iProgressInfo->SetExtent(TPoint
+            (static_cast<TInt>(size.iWidth * KProgTX + 0.5), 
+             static_cast<TInt>(size.iHeight * KProgTY + 0.5)),
+             minSize);
+
+        /*
+        iProgressInfo->SetPosition(TPoint
+            (size.iWidth * KProgTX, 
+             size.iHeight * KProgTY));
+        
+        iProgressInfo->SetExtent(TRect
+            (size.iWidth * KProgTX, 
+             size.iHeight * KProgTY, 
+             size.iWidth * KProgBX, 
+             size.iHeight * KProgBY));    
+ 		  */
+    }
+        
+}
+
+//============================================================================= 
+TTypeUid::Ptr CExtProgressContainer::MopSupplyObject( TTypeUid aId )
+{
+	if ( aId.iUid == MAknsControlContext::ETypeId && iBgContext )
+	{
+		return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+	}
+	return CCoeControl::MopSupplyObject( aId );
+}
+
+//=============================================================================
+TSize CExtProgressContainer::MinimumSize()
+{  
+    return Rect().Size();   
+}
+	
+//=============================================================================
+void CExtProgressContainer::Test()
+{
+
+
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/src/ExtProgressDialog.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+/*
+*   File:       ExtProgressDialog.cpp
+*   Created:    14-10-2005
+*   Author:     
+*               
+*/
+
+#include "ExtProgressDialog.h"
+#include "ExtProgressContainer.h"
+#include "ExtProgressAnimationControl.h"
+
+#include <avkon.hrh>
+#include <aknborders.h> 
+#include <AknUtils.h> 
+#include <eikapp.h>
+#include <eikprogi.h>
+#include <eiklabel.h>
+#include <data_caging_path_literals.hrh>
+
+// CONSTANTS
+_LIT(KResourceFile, "VideoEditorUiComponents.rsc");
+
+
+//=============================================================================
+EXPORT_C CExtProgressDialog::CExtProgressDialog(CExtProgressDialog** aSelfPtr)
+: iSelfPtr(aSelfPtr), 
+  iResLoader(*CEikonEnv::Static()) 
+{
+}
+
+//=============================================================================
+EXPORT_C CExtProgressDialog::~CExtProgressDialog()
+{
+    
+    delete iContainer;
+    iResLoader.Close();   
+    
+    // Nullify self pointer
+    *iSelfPtr = NULL;        
+}
+
+//=============================================================================
+EXPORT_C void CExtProgressDialog::PrepareLC(TInt aResourceId)
+{
+	TFileName resourceFile;
+    Dll::FileName(resourceFile);
+    TParse p;
+    p.Set(KResourceFile, &KDC_RESOURCE_FILES_DIR, &resourceFile);
+    resourceFile = p.FullName();
+	iResLoader.OpenL( resourceFile );
+
+	CEikDialog::PrepareLC(aResourceId);
+
+	TRect rect;
+	iContainer = CExtProgressContainer::NewL(rect, this);
+
+	iContainer->SetControlContext(this);
+	iContainer->SetObserver(this);
+
+}
+
+//============================================================================= 
+void CExtProgressDialog::SetSizeAndPosition( const TSize& /*aSize*/ )
+{
+    TRect rect;
+    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
+
+    TSize size = iContainer->Rect().Size();
+    SetSize(size);
+    SetPosition(TPoint(0, rect.iBr.iY - size.iHeight));
+}
+
+//=============================================================================
+TBool CExtProgressDialog::OkToExitL( TInt aButtonId )
+{
+    if (iCallback)
+    {
+        iCallback->DialogDismissedL(aButtonId);
+    }
+    
+    return ETrue;
+}
+
+//=============================================================================    
+void CExtProgressDialog::PreLayoutDynInitL() 
+{ 
+
+}
+    
+//=============================================================================    
+TKeyResponse CExtProgressDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
+{
+    TKeyResponse res = EKeyWasConsumed;
+            
+    if (aType == EEventKey)
+    {
+        switch (aKeyEvent.iCode)
+        {
+            case 0x31:
+            {
+                iContainer->GetProgressInfoL()->IncrementAndDraw(1);
+                
+                break;
+            }
+            case 0x32:
+            {
+                DrawNow();
+                
+                break;
+            }
+            case 0x33:
+            {
+                iContainer->GetAnimationControlL()->StartAnimationL();
+                
+                break;
+            }
+            case 0x34:
+            {
+                iContainer->DrawNow();
+                
+                break;
+            }
+           case 0x37:
+            {
+                iContainer->Test();
+                
+                break;
+            }             
+           default:
+            {
+                res = CEikDialog::OfferKeyEventL(aKeyEvent, aType);
+            }
+        }
+    }
+    return res;
+}
+
+//=============================================================================    
+EXPORT_C void CExtProgressDialog::SetCallback(MExtProgressDialogCallback* aCallback)
+{
+    iCallback = aCallback;
+}
+
+//============================================================================= 
+EXPORT_C CEikProgressInfo* CExtProgressDialog::GetProgressInfoL()
+{
+    return iContainer->GetProgressInfoL();
+}
+ 
+//============================================================================= 
+EXPORT_C void CExtProgressDialog::StartAnimationL()
+{
+    return iContainer->GetAnimationControlL()->StartAnimationL();
+   
+}
+
+//============================================================================= 
+EXPORT_C void CExtProgressDialog::SetTextL(const TDesC &aText)
+{
+    iContainer->SetTextL(aText);
+}
+//============================================================================= 
+
+EXPORT_C void CExtProgressDialog::SetAnimationResourceIdL(const TInt &aResourceId)
+{
+    iContainer->GetAnimationControlL()->SetAnimationResourceId(aResourceId);
+}
+//============================================================================= 
+
+void CExtProgressDialog::HandleControlEventL(
+    CCoeControl* /*aControl*/,TCoeEvent aEventType)
+{
+    if (aEventType == MCoeControlObserver::EEventStateChanged )
+    {
+        DrawNow();    
+    }
+}
+
+//============================================================================= 
+TInt CExtProgressDialog::CountComponentControls() const
+{
+    return 1;
+}
+
+//============================================================================= 
+CCoeControl* CExtProgressDialog::ComponentControl(TInt aIndex) const
+{
+    CCoeControl* ret = NULL;
+    switch (aIndex)
+    {
+        case 0:
+        {
+            ret = iContainer;
+            break;
+        }
+        default:
+        {
+            break;
+        }
+        
+    }
+    
+    return ret;
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/src/VeiCutterBar.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,886 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// INCLUDE FILES
+
+// System includes
+#include <eikenv.h>
+#include <VideoEditorUiComponents.mbg>
+#include <akniconutils.h>
+#include <aknsdrawutils.h> 
+#include <aknsdatacontext.h> 
+#include <aknutils.h>
+#include <aknlayoutscalable_avkon.cdl.h>
+#include <aknlayoutscalable_apps.cdl.h>
+
+
+// User includes
+#include "VeiCutterBar.h"
+#include "VideoEditorUtils.h"
+
+
+EXPORT_C CVeiCutterBar* CVeiCutterBar::NewL( const CCoeControl* aParent, TBool aDrawBorder )
+    {
+    CVeiCutterBar* self = CVeiCutterBar::NewLC( aParent, aDrawBorder );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+EXPORT_C CVeiCutterBar* CVeiCutterBar::NewLC( const CCoeControl* aParent, TBool aDrawBorder )
+    {
+    CVeiCutterBar* self = new (ELeave) CVeiCutterBar;
+    CleanupStack::PushL( self );
+    self->ConstructL( aParent, aDrawBorder );
+    return self;
+    }
+
+void CVeiCutterBar::ConstructL( const CCoeControl* aParent, TBool aDrawBorder )
+    {
+	SetContainerWindowL( *aParent );
+
+	TFileName mbmPath( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) );
+
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+		AknIconUtils::CreateIconL( iScissorsIcon, iScissorsIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded_scissors, 
+				EMbmVideoeditoruicomponentsQgn_indi_vded_scissors_mask );
+
+	    // left end of the slider when that part is unselected
+		AknIconUtils::CreateIconL( iSliderLeftEndIcon, iSliderLeftEndIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_end_left, 
+				EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_end_left_mask );
+				
+		// middle part of the slider when that part is unselected	
+		// should be qgn_graf_nslider_vded_middle but that icon is currently incorrect	
+		AknIconUtils::CreateIconL( iSliderMiddleIcon, iSliderMiddleIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_end_middle, 
+				EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_end_middle_mask );	
+				
+		// right end of the slider when that part is unselected		
+		AknIconUtils::CreateIconL( iSliderRightEndIcon, iSliderRightEndIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_end_right, 
+				EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_end_right_mask );					
+
+	    // left end of the cut selection slider 
+		AknIconUtils::CreateIconL( iSliderSelectedLeftEndIcon, iSliderSelectedLeftEndIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_end_left_selected, 
+				EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_end_left_selected_mask );					
+
+	    // middle part of the cut selection slider 
+		AknIconUtils::CreateIconL( iSliderSelectedMiddleIcon, iSliderSelectedMiddleIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_middle_selected, 
+				EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_middle_selected_mask );					
+
+	    // right end of the cut selection slider 
+		AknIconUtils::CreateIconL( iSliderSelectedRightEndIcon, iSliderSelectedRightEndIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_end_right_selected, 
+				EMbmVideoeditoruicomponentsQgn_graf_nslider_vded_end_right_selected_mask );					
+	    
+	    // playhead
+		AknIconUtils::CreateIconL( iPlayheadIcon, iPlayheadIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded_playhead,
+				EMbmVideoeditoruicomponentsQgn_indi_vded_playhead_mask );					
+	    
+	    // left/right border of cut selection slider
+		AknIconUtils::CreateIconL( iCutAreaBorderIcon, iCutAreaBorderIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded_timeline_selected,
+				EMbmVideoeditoruicomponentsQgn_indi_vded_timeline_selected_mask );								
+		}
+	else
+		{
+	    // left end of the slider when that part is unselected
+		AknIconUtils::CreateIconL( iSliderLeftEndIcon, iSliderLeftEndIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_graf_nslider_vded2_end_left, 
+				EMbmVideoeditoruicomponentsQgn_graf_nslider_vded2_end_left_mask );
+				
+		// middle part of the slider when that part is unselected	
+		// should be qgn_graf_nslider_vded_middle but that icon is currently incorrect	
+		AknIconUtils::CreateIconL( iSliderMiddleIcon, iSliderMiddleIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_graf_nslider_vded2_middle, 
+				EMbmVideoeditoruicomponentsQgn_graf_nslider_vded2_middle_mask );	
+				
+		// right end of the slider when that part is unselected		
+		AknIconUtils::CreateIconL( iSliderRightEndIcon, iSliderRightEndIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_graf_nslider_vded2_end_right, 
+				EMbmVideoeditoruicomponentsQgn_graf_nslider_vded2_end_right_mask );					
+
+	    // middle part of the cut selection slider 
+		AknIconUtils::CreateIconL( iSliderSelectedMiddleIcon, iSliderSelectedMiddleIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_graf_nslider_vded2_middle_selected, 
+				EMbmVideoeditoruicomponentsQgn_graf_nslider_vded2_middle_selected_mask );					
+	    
+	    // playhead
+		AknIconUtils::CreateIconL( iPlayheadIcon, iPlayheadIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded2_playhead,
+				EMbmVideoeditoruicomponentsQgn_indi_vded2_playhead_mask );					
+	    
+	    // pressed playhead
+		AknIconUtils::CreateIconL( iPlayheadIconPressed, iPlayheadIconPressedMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded2_playhead_pressed,
+				EMbmVideoeditoruicomponentsQgn_indi_vded2_playhead_pressed_mask );	
+				
+	    // Start mark
+		AknIconUtils::CreateIconL( iStartMarkIcon, iStartMarkIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded2_start,
+				EMbmVideoeditoruicomponentsQgn_indi_vded2_start_mask );								
+        
+        // Pressed Start mark
+		AknIconUtils::CreateIconL( iStartMarkIconPressed, iStartMarkIconPressedMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded2_start_pressed,
+				EMbmVideoeditoruicomponentsQgn_indi_vded2_start_pressed_mask );								
+
+	    // End Mark
+		AknIconUtils::CreateIconL( iEndMarkIcon, iEndMarkIconMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded2_end,
+				EMbmVideoeditoruicomponentsQgn_indi_vded2_end_mask );
+		
+		// Pressed End Mark
+		AknIconUtils::CreateIconL( iEndMarkIconPressed, iEndMarkIconPressedMask,
+				mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded2_end_pressed,
+				EMbmVideoeditoruicomponentsQgn_indi_vded2_end_pressed_mask );										
+		}
+
+	iDrawBorder = aDrawBorder;
+	iInPoint = 0;
+	iCurrentPoint = 0;
+	iTotalDuration = 1;
+	iDimmed = EFalse;
+	iDrawPlayHead = ETrue;
+	iOutPoint = 13;
+	iFinished = ETrue;
+    }
+
+EXPORT_C CVeiCutterBar::~CVeiCutterBar()
+	{
+	if (iScissorsIcon)
+		{
+		delete iScissorsIcon;
+		delete iScissorsIconMask;
+		}
+
+	delete iSliderLeftEndIcon;
+	delete iSliderLeftEndIconMask;
+	delete iSliderMiddleIcon;
+	delete iSliderMiddleIconMask;
+	delete iSliderRightEndIcon;
+	delete iSliderRightEndIconMask;	
+
+	if (iSliderSelectedLeftEndIcon)
+		{
+		delete iSliderSelectedLeftEndIcon;
+		delete iSliderSelectedLeftEndIconMask;
+		}
+
+	delete iSliderSelectedMiddleIcon;
+	delete iSliderSelectedMiddleIconMask;		
+
+	if (iSliderSelectedRightEndIcon)
+		{
+		delete iSliderSelectedRightEndIcon;
+		delete iSliderSelectedRightEndIconMask;
+		}
+
+	delete iPlayheadIcon;
+	delete iPlayheadIconMask;
+    
+    if (iPlayheadIconPressed)
+		{
+		delete iPlayheadIconPressed;
+		delete iPlayheadIconPressedMask;		
+		}    
+	if (iStartMarkIcon)
+		{
+		delete iStartMarkIcon;
+		delete iStartMarkIconMask;		
+		}
+    if (iStartMarkIconPressed)
+		{
+		delete iStartMarkIconPressed;
+		delete iStartMarkIconPressedMask;		
+		}
+	if (iEndMarkIcon)
+		{
+		delete iEndMarkIcon;
+		delete iEndMarkIconMask;		
+		}
+    if (iEndMarkIconPressed)
+		{
+		delete iEndMarkIconPressed;
+		delete iEndMarkIconPressedMask;		
+		}
+	if (iCutAreaBorderIcon)
+		{
+		delete iCutAreaBorderIcon;
+		delete iCutAreaBorderIconMask;				
+		}
+	}
+
+TInt CVeiCutterBar::CountComponentControls() const
+    {
+    return 0;
+    }
+
+void CVeiCutterBar::DrawCoordinate(TInt aX, TInt aY, TInt aData1, TInt aData2, const TDesC& aInfo) const
+{
+	CWindowGc& gc = SystemGc();
+	TPoint writepoint(aX, aY);
+
+	_LIT(KXY, "%S:(%d,%d)");
+	_LIT(KX, "%S:%d");
+	TBuf<200> buffer;
+	if (aData2 > 0)
+		{
+		buffer.Format(KXY, &aInfo, aData1, aData2);
+		}
+		else
+		{
+		buffer.Format(KX, &aInfo, aData1);
+		}
+	const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+	gc.UseFont( font );	
+
+	// Get text color from skin
+	TRgb textColor( KRgbBlack );
+	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+	AknsUtils::GetCachedColor(skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
+	gc.SetPenColor( textColor );
+
+	gc.DrawText( buffer, writepoint );
+
+	gc.DiscardFont();
+}
+
+
+void CVeiCutterBar::Draw( const TRect& /*aRect*/ ) const
+    {
+    CWindowGc& gc = SystemGc();
+
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+		gc.BitBltMasked(iScissorsIconRect.iTl, iScissorsIcon, iScissorsIconRect.Size(), 
+				iScissorsIconMask, EFalse );	
+		}
+
+    // The following three icons are visible only when the user has selected an area to be cut.
+    // In the initial state, the whole slider is selected so these icons won't be shown.
+
+    // draw left end of the slider 
+	gc.BitBltMasked(iSliderLeftEndIconRect.iTl, iSliderLeftEndIcon, iSliderLeftEndIconRect.Size(), 
+			iSliderLeftEndIconMask, EFalse );				
+
+	// draw middle part of the slider 
+	gc.BitBltMasked(iSliderMiddleIconRect.iTl, iSliderMiddleIcon, iSliderMiddleIconRect.Size(), 
+			iSliderMiddleIconMask, EFalse );							
+
+	// draw right end of the slider 
+	gc.BitBltMasked(iSliderRightEndIconRect.iTl, iSliderRightEndIcon, iSliderRightEndIconRect.Size(), 
+			iSliderRightEndIconMask, EFalse );							
+
+    //  the selected area of the slider is constructed from 3 icons:
+    //
+    //  |<-------------- whole slider ------------------------>|
+    //
+    //        |<-------- selected area ------------>|
+    //
+    //   ----- -----a-------------------------b----- ----------
+    //  |     |left |          middle         |right|          |
+    //  |     |end  |           part          |end  |          |
+    //   ----- ----- ------------------------- ----- ---------- 
+      
+    TRect selectedArea(CalculateCutAreaRect());  
+
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+		// if the start and end mark are close to each other, the width of the left and
+		// right end icons has to be decreased	
+	    TRect leftRect(iSliderSelectedLeftEndIconRect); 
+	    TRect rightRect(iSliderSelectedRightEndIconRect); 
+	    
+		// the width of the selected area is smaller than the width of the left/right end
+		if (selectedArea.Width() <= iSliderSelectedRightEndIconRect.Width()) 
+			{ 	    
+			leftRect = selectedArea; 
+			rightRect = selectedArea; 
+			}    	        
+
+	    // calculate point a
+	    TInt leftEndWidth = iSliderSelectedLeftEndIconRect.Width();
+	    TInt xA = selectedArea.iTl.iX + leftEndWidth;
+	    TPoint pointA = TPoint(xA, selectedArea.iTl.iY);
+	    
+	    // calculate point b
+	    TInt rightEndWidth = rightRect.Width();
+	    TInt xB = selectedArea.iBr.iX - rightEndWidth;
+	    TPoint pointB = TPoint(xB, selectedArea.iTl.iY);    
+
+	    // calculate the size of the middle part
+	    TInt middlePartWidth = pointB.iX - pointA.iX;
+	    TSize middlePartSize = TSize(middlePartWidth, iSliderSelectedMiddleIconRect.Height());
+	    
+	    // draw left end of the cut selection slider
+		gc.BitBltMasked(selectedArea.iTl, iSliderSelectedLeftEndIcon, leftRect.Size(), 
+				iSliderSelectedLeftEndIconMask, EFalse );				
+							
+		// draw middle part of the cut selection slider
+		gc.BitBltMasked(pointA, iSliderSelectedMiddleIcon, middlePartSize, 
+				iSliderSelectedMiddleIconMask, EFalse );							
+				
+		// draw right end of the cut selection slider
+		gc.BitBltMasked(pointB, iSliderSelectedRightEndIcon, rightRect.Size(), 
+				iSliderSelectedRightEndIconMask, EFalse );							
+
+		if ( iFinished && !iDimmed )
+			{    
+	        // draw the left border of cut selection slider if the start mark has been set
+	        if ( iInPoint > 0 )  
+	            {	
+	        	gc.BitBltMasked(iStartMarkRect.iTl, iCutAreaBorderIcon, iCutAreaBorderIconRect.Size(), 
+	        			iCutAreaBorderIconMask, EFalse );										                
+	            }
+
+	        // draw the right border of the cut selection slider if the end mark has been set
+	        if (iOutPoint < iTotalDuration)
+	            {
+	        	gc.BitBltMasked(iEndMarkRect.iTl, iCutAreaBorderIcon, iCutAreaBorderIconRect.Size(), 
+	        			iCutAreaBorderIconMask, EFalse );													                
+	            }
+			}
+		}
+	else
+		{
+		// draw middle part of the cut selection slider
+		gc.BitBltMasked(selectedArea.iTl, iSliderSelectedMiddleIcon, selectedArea.Size(), 
+				iSliderSelectedMiddleIconMask, EFalse );							
+
+		if ( iFinished && !iDimmed )
+			{    
+			TPoint startPoint(selectedArea.iTl);
+			startPoint.iX = startPoint.iX - iStartMarkRect.Width();
+        	
+        	if( iPressedComponent == EPressedStartMarkTouch )
+	            {
+        	    gc.BitBltMasked(startPoint, iStartMarkIconPressed, iStartMarkRect.Size(), 
+        			    iStartMarkIconPressedMask, EFalse );										                
+	            }
+	        else
+	            {
+	            gc.BitBltMasked(startPoint, iStartMarkIcon, iStartMarkRect.Size(), 
+        			    iStartMarkIconMask, EFalse );
+	            }    
+	            
+			TPoint endPoint(selectedArea.iBr);
+			endPoint.iY = iEndMarkRect.iTl.iY;
+			
+			if( iPressedComponent == EPressedEndMarkTouch )
+	            {
+	            gc.BitBltMasked(endPoint, iEndMarkIconPressed, iEndMarkRect.Size(), 
+        			iEndMarkIconPressedMask, EFalse );
+	            }
+	        else
+	            {
+	            gc.BitBltMasked(endPoint, iEndMarkIcon, iEndMarkRect.Size(), 
+        			iEndMarkIconMask, EFalse );
+	            }
+        														                
+			}
+		}
+
+    // calculate the playhead position
+    TUint width = iCutBarRect.Width();
+    TInt currentPointX = 0;
+    if (iTotalDuration > 0)
+        {
+        currentPointX = iCurrentPoint * width / iTotalDuration + iCutBarRect.iTl.iX;   
+         
+        // set the center of the playhead icon to the current position
+        currentPointX = currentPointX - ( iPlayheadIconRect.Width()/2 );         
+        }
+
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+	    // don't draw the playhead outside the cut bar area because it is not refreshed often enough
+	    if ( currentPointX < iCutBarRect.iTl.iX )
+	        {
+	        currentPointX = iCutBarRect.iTl.iX;
+	        }
+	    else if ( currentPointX > iCutBarRect.iBr.iX )
+	        {
+	        currentPointX = iCutBarRect.iBr.iX;
+	        }
+
+	    // draw playhead
+		gc.BitBltMasked(TPoint(currentPointX,iCutBarRect.iTl.iY), iPlayheadIcon, iPlayheadIconRect.Size(), 
+				iPlayheadIconMask, EFalse );											
+		}
+	else
+		{
+	    // draw playhead	    
+	    if( iPressedComponent == EPressedPlayheadTouch )
+	        {
+	        gc.BitBltMasked(TPoint(currentPointX,iCutBarRect.iBr.iY - iPlayheadIconRect.Height()), iPlayheadIconPressed, 
+	            iPlayheadIconRect.Size(), iPlayheadIconPressedMask, EFalse );
+	        }
+	    else
+	        {
+	        gc.BitBltMasked(TPoint(currentPointX,iCutBarRect.iBr.iY - iPlayheadIconRect.Height()), iPlayheadIcon, iPlayheadIconRect.Size(), 
+				iPlayheadIconMask, EFalse );
+	        }    													
+		}
+    }
+
+CCoeControl* CVeiCutterBar::ComponentControl( TInt /*aIndex*/ ) const
+    {
+    return NULL;
+    }
+
+
+EXPORT_C void CVeiCutterBar::Dim( TBool aDimmed )
+	{
+	iDimmed = aDimmed;
+	DrawDeferred();
+	}
+
+EXPORT_C void CVeiCutterBar::SetPlayHeadVisible( TBool aVisible )
+	{
+	iDrawPlayHead = aVisible;
+	}
+
+void CVeiCutterBar::HandleControlEventL( CCoeControl* /*aControl*/,
+											TCoeEvent /*aEventType*/ )
+	{
+	DrawDeferred();
+	}
+
+void CVeiCutterBar::SizeChanged()
+	{
+	// the component rects are set in CVeiSimpleCutVideoContainer::SizeChanged(),
+	// CVeiEditVideoContainer::SetCursorLocation() or CVeiCutVideoContainer::SizeChanged()
+
+	// left end of the slider when that part is unselected
+	AknIconUtils::SetSize( iSliderLeftEndIcon, iSliderLeftEndIconRect.Size(), EAspectRatioNotPreserved);
+		
+	// middle part of the slider when that part is unselected	
+	AknIconUtils::SetSize( iSliderMiddleIcon, iSliderMiddleIconRect.Size(), EAspectRatioNotPreserved);		
+	
+	// right end of the slider when that part is unselected
+	AknIconUtils::SetSize( iSliderRightEndIcon, iSliderRightEndIconRect.Size(), EAspectRatioNotPreserved); 
+
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+		// left end of the cut selection slider 
+		AknIconUtils::SetSize( iSliderSelectedLeftEndIcon, iSliderSelectedLeftEndIconRect.Size(), EAspectRatioNotPreserved);
+			
+		// middle part of the cut selection slider 
+		AknIconUtils::SetSize( iSliderSelectedMiddleIcon, iSliderSelectedMiddleIconRect.Size(), EAspectRatioNotPreserved);		
+		
+		// right end of the cut selection slider 
+		AknIconUtils::SetSize( iSliderSelectedRightEndIcon, iSliderSelectedRightEndIconRect.Size(), EAspectRatioNotPreserved); 
+
+	    // left/right border of cut selection slider
+		AknIconUtils::SetSize( iCutAreaBorderIcon, iCutAreaBorderIconRect.Size(), EAspectRatioNotPreserved); 
+			
+		AknIconUtils::SetSize( iScissorsIcon, iScissorsIconRect.Size(), EAspectRatioNotPreserved);
+		
+		iStartMarkRect = TRect(CalculateCutAreaRect().iTl, iCutAreaBorderIconRect.Size());
+		
+	    TInt xD = CalculateCutAreaRect().iBr.iX - iCutAreaBorderIconRect.Width();
+	    TPoint pointD = TPoint (xD, iSliderSelectedLeftEndIconRect.iTl.iY);		
+			
+		// set the end mark rect
+	    iEndMarkRect = TRect(pointD, iCutAreaBorderIconRect.Size());
+		}
+	else
+		{
+		// middle part of the cut selection slider 
+		AknIconUtils::SetSize( iSliderSelectedMiddleIcon, TSize(iCutBarRect.Size().iWidth, iSliderSelectedMiddleIconRect.Size().iHeight), EAspectRatioNotPreserved);
+
+	    // left border of cut selection slider
+		AknIconUtils::SetSize( iStartMarkIcon, iStartMarkRect.Size(), EAspectRatioNotPreserved); 
+		AknIconUtils::SetSize( iStartMarkIconPressed, iStartMarkRect.Size(), EAspectRatioNotPreserved);
+			
+	    // right border of cut selection slider
+		AknIconUtils::SetSize( iEndMarkIcon, iEndMarkRect.Size(), EAspectRatioNotPreserved); 
+		AknIconUtils::SetSize( iEndMarkIconPressed, iEndMarkRect.Size(), EAspectRatioNotPreserved); 
+		}
+
+    // playhead
+	AknIconUtils::SetSize( iPlayheadIcon, iPlayheadIconRect.Size(), EAspectRatioNotPreserved); 
+	AknIconUtils::SetSize( iPlayheadIconPressed, iPlayheadIconRect.Size(), EAspectRatioNotPreserved);
+	}
+
+TKeyResponse CVeiCutterBar::OfferKeyEventL( const TKeyEvent& /*aKeyEvent*/,
+											 TEventCode /*aType*/ )
+	{
+	return EKeyWasNotConsumed;
+	}
+
+EXPORT_C void CVeiCutterBar::SetInPoint( const TTimeIntervalMicroSeconds& aIn )
+	{
+	iInPoint = static_cast<TInt32>((aIn.Int64()/1000));
+
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+	    iStartMarkRect = TRect(CalculateCutAreaRect().iTl, iCutAreaBorderIconRect.Size());
+		DrawDeferred();
+		return;
+		}
+
+    TInt xD = CalculateCutAreaRect().iTl.iX - iStartMarkRect.Width();
+    TPoint pointD = TPoint (xD, iStartMarkRect.iTl.iY);		
+	TInt delta = pointD.iX - iStartMarkRect.iTl.iX;
+	iStartMarkTouchRect.iTl.iX += delta;
+	iStartMarkTouchRect.iBr.iX += delta;
+
+	// set the start mark rect
+    iStartMarkRect = TRect(pointD, iStartMarkRect.Size());
+	DrawDeferred();
+	}
+
+EXPORT_C void CVeiCutterBar::SetOutPoint( const TTimeIntervalMicroSeconds& aOutPoint )
+	{
+	iOutPoint = static_cast<TInt32>((aOutPoint.Int64()/1000));
+
+    // calculate the top left point (d in the picture below) for the end mark rect	
+    // for more clarification, see the picture in Draw function
+    //	
+    //          right    
+    //      |<- end ->|
+    // -----b-----d---c---------
+    //      |     |bor|
+    //      |     |der|           
+    // -------------------------
+
+	if( !AknLayoutUtils::PenEnabled() )
+		{
+	    TInt xD = CalculateCutAreaRect().iBr.iX - iCutAreaBorderIconRect.Width();
+	    TPoint pointD = TPoint (xD, iSliderSelectedLeftEndIconRect.iTl.iY);		
+			
+		// set the end mark rect
+	    iEndMarkRect = TRect(pointD, iCutAreaBorderIconRect.Size());
+		}
+	else
+		{
+	    TPoint pointD = TPoint (CalculateCutAreaRect().iBr.iX, iEndMarkRect.iTl.iY);
+		TInt delta = pointD.iX - iEndMarkRect.iTl.iX;
+		iEndMarkTouchRect.iTl.iX += delta;
+		iEndMarkTouchRect.iBr.iX += delta;
+
+	    iEndMarkRect = TRect(pointD, iEndMarkRect.Size());
+		}
+
+	DrawDeferred();
+	}
+
+EXPORT_C void CVeiCutterBar::SetFinishedStatus( TBool aStatus )
+	{
+	iFinished = aStatus;
+//	iCurrentPoint = 0;
+	SetCurrentPoint( 0 );
+	DrawDeferred();
+	}
+
+EXPORT_C void CVeiCutterBar::SetTotalDuration( const TTimeIntervalMicroSeconds& aDuration ) 
+	{
+	TTimeIntervalMicroSeconds duration (aDuration);
+	if ( duration.Int64() == 0 ) 
+		{
+		duration = 1;	
+		}
+
+	TInt64 i = duration.Int64();
+	for (;0 == (i/1000);i++) 
+		{
+		;
+		}
+	duration = i;
+
+	iTotalDuration = static_cast<TInt32>((duration.Int64()/1000)); 
+	SetOutPoint(aDuration);
+//	DrawDeferred();
+	}
+
+EXPORT_C void CVeiCutterBar::SetCurrentPoint( TInt aLocation )
+	{ 
+	if( AknLayoutUtils::PenEnabled() )
+		{
+	    // calculate the playhead position
+	    TUint width = iCutBarRect.Width();
+	    TInt currentPointX = 0;
+	    if (iTotalDuration > 0)
+	        {
+	        currentPointX = aLocation * width / iTotalDuration + iCutBarRect.iTl.iX;   
+	        }
+	    currentPointX = currentPointX - ( iPlayheadTouchRect.Width()/2 );         
+		iPlayheadTouchRect.iBr.iX = currentPointX + iPlayheadTouchRect.Width();
+		iPlayheadTouchRect.iTl.iX = currentPointX;
+		}
+
+	iCurrentPoint = aLocation; 
+	DrawDeferred();
+	}
+
+// ----------------------------------------------------------------------------
+// CVeiCutterBar::ProgressBarRect
+// 
+// ----------------------------------------------------------------------------
+//	
+EXPORT_C TRect CVeiCutterBar::ProgressBarRect()
+	{
+	return iCutBarRect;	
+	}
+
+// ----------------------------------------------------------------------------
+// CVeiCutterBar::PlayHeadRect
+// 
+// ----------------------------------------------------------------------------
+//	
+EXPORT_C TRect CVeiCutterBar::PlayHeadRect()
+	{
+	return iPlayheadTouchRect;
+	}
+
+// ----------------------------------------------------------------------------
+// CVeiCutterBar::StartMarkRect
+// 
+// ----------------------------------------------------------------------------
+//	
+EXPORT_C TRect CVeiCutterBar::StartMarkRect()
+	{
+	if( AknLayoutUtils::PenEnabled() )
+		{
+		return iStartMarkTouchRect;
+		}
+
+	TRect startMarkArea;
+	
+	// start mark has not been set
+	if (iInPoint == 0)
+		{
+		startMarkArea = TRect(0,0,0,0);
+		}
+	else
+	    {
+	    startMarkArea = iStartMarkRect;	        
+	    }
+	return startMarkArea;
+	}
+
+// ----------------------------------------------------------------------------
+// CVeiCutterBar::EndMarkRect
+// 
+// ----------------------------------------------------------------------------
+//	
+EXPORT_C TRect CVeiCutterBar::EndMarkRect()
+	{
+	if( AknLayoutUtils::PenEnabled() )
+		{
+		return iEndMarkTouchRect;
+		}
+
+	TRect endMarkArea;
+	
+	// end mark has not been set
+	if (iOutPoint == iTotalDuration)
+		{
+		endMarkArea = TRect(0,0,0,0);
+		}
+	else
+	    {
+	    endMarkArea = iEndMarkRect;    	
+	    }
+	return endMarkArea;
+	}
+
+// ----------------------------------------------------------------------------
+// CVeiCutterBar::StartMarkPoint
+// 
+// ----------------------------------------------------------------------------
+//	
+EXPORT_C TUint CVeiCutterBar::StartMarkPoint()
+{
+	// start mark hasn't been set
+	if (iInPoint == 0)
+		{	
+		return 0;
+		}
+	// start mark has been set
+	else
+		{
+		TInt startPoint = iInPoint * iCutBarRect.Width() / iTotalDuration + iCutBarRect.iTl.iX;	
+		return startPoint;
+		}	
+}
+
+// ----------------------------------------------------------------------------
+// CVeiCutterBar::EndMarkPoint
+// 
+// ----------------------------------------------------------------------------
+//	
+EXPORT_C TUint CVeiCutterBar::EndMarkPoint()
+{
+	// end mark hasn't been set
+	if (iOutPoint == iTotalDuration)
+		{
+		return iCutBarRect.iBr.iX;
+		}
+	// end mark has been set	
+	else
+		{
+		TInt endPoint = iOutPoint * iCutBarRect.Width() / iTotalDuration + iCutBarRect.iTl.iX;
+		return endPoint;
+		}
+}
+
+
+// ----------------------------------------------------------------------------
+// CVeiCutterBar::SetComponentRect
+// 
+// ----------------------------------------------------------------------------
+//	
+EXPORT_C void CVeiCutterBar::SetComponentRect(TCutterBarComponent aComponentIndex, TRect aRect)
+	{
+    switch ( aComponentIndex )
+        {
+        case EScissorsIcon:
+        	{
+       		iScissorsIconRect = aRect;
+       		break;
+        	}
+        case EProgressBar:
+        	{
+    		iCutBarRect = aRect;
+    		break;
+        	}
+        case ESliderLeftEndIcon:
+            {
+            iSliderLeftEndIconRect = aRect;
+            break;    
+            }
+		case ESliderMiddleIcon:
+		    {
+		    iSliderMiddleIconRect = aRect;
+		    break;    
+		    }
+		case ESliderRightEndIcon:
+		    {
+		    iSliderRightEndIconRect = aRect;
+		    break;
+		    }
+		case ESliderSelectedLeftEndIcon:
+		    {
+		    iSliderSelectedLeftEndIconRect = aRect;
+		    break;    
+		    }
+		case ESliderSelectedMiddleIcon:
+		    {
+		    iSliderSelectedMiddleIconRect = aRect;
+		    break;    
+		    }
+		case ESliderSelectedRightEndIcon:
+		    {
+		    iSliderSelectedRightEndIconRect = aRect;
+		    break;    
+		    }
+		case EPlayheadIcon:
+		    {
+		    iPlayheadIconRect = aRect;
+		    break;    
+		    }
+		case ECutAreaBorderIcon:
+		    {
+		    iCutAreaBorderIconRect = aRect;
+		    break;    
+		    }
+		case EStartMarkIcon:
+		    {
+		    iStartMarkRect = aRect;
+		    break;    
+		    }
+		case EEndMarkIcon:
+		    {
+		    iEndMarkRect = aRect;
+		    break;    
+		    }
+		case EPlayheadTouch:
+		    {
+		    iPlayheadTouchRect = aRect;
+			SetCurrentPoint(iCurrentPoint);
+		    break;    
+		    }
+		case EStartMarkTouch:
+		    {
+		    iStartMarkTouchRect = aRect;
+		    break;    
+		    }
+		case EEndMarkTouch:
+		    {
+		    iEndMarkTouchRect = aRect;
+		    break;    
+		    }
+        }
+	}
+    
+// ----------------------------------------------------------------------------
+// CVeiCutterBar::SetPressedComponent
+// 
+// ----------------------------------------------------------------------------
+//	
+EXPORT_C void CVeiCutterBar::SetPressedComponent(TCutterBarPressedIcon aComponentIndex)
+    {
+    iPressedComponent = aComponentIndex;
+    }
+    
+// ----------------------------------------------------------------------------
+// CVeiCutterBar::CalculateCutAreaRect
+// 
+// ----------------------------------------------------------------------------
+//	
+TRect CVeiCutterBar::CalculateCutAreaRect() const
+    {
+
+	TUint width = iCutBarRect.Width();
+	TInt inPointX = 0;
+	TInt outPointX = 0;
+	
+	if (0 < iTotalDuration)
+	{
+		inPointX = iInPoint * width / iTotalDuration + iCutBarRect.iTl.iX;
+		outPointX = iOutPoint * width / iTotalDuration + iCutBarRect.iTl.iX;
+	}
+
+	if ( outPointX > iCutBarRect.iBr.iX )
+		{
+		outPointX = iCutBarRect.iBr.iX;
+		}
+	
+	// area to be cut
+	TRect selectedArea( iCutBarRect );
+
+	if ( iFinished && !iDimmed ) 
+		{
+		selectedArea.iTl.iX = inPointX;
+		selectedArea.iBr.iX = outPointX;
+		}
+	
+	return selectedArea;
+        
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/src/VeiEditVideoLabelNavi.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,625 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#include "VeiEditVideoLabelNavi.h"
+#include <videoeditoruicomponents.mbg>
+#include <videoeditoruicomponents.rsg>
+#include <stringloader.h> 
+#include <barsread.h>
+#include <e32std.h>
+#include <gulfont.h> 
+#include <e32math.h> 
+#include <aknsutils.h>
+#include <data_caging_path_literals.hrh>
+#include "VeiVideoEditorSettings.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorUtils.h"
+#include "VideoEditorDebugUtils.h"
+
+#include <AknFontAccess.h>
+#include <AknFontSpecification.h>
+#include <AknLayoutFont.h>
+
+// CONSTANTS
+_LIT(KResourceFile, "VideoEditorUiComponents.rsc");
+const TReal KQvgaTextAndIconShrinkFactor = 0.8;
+
+// ---------------------------------------------------------
+// CVeiEditVideoLabelNavi::NewL()
+// ---------------------------------------------------------
+//
+EXPORT_C CVeiEditVideoLabelNavi* CVeiEditVideoLabelNavi::NewL()
+    {
+    CVeiEditVideoLabelNavi* self = CVeiEditVideoLabelNavi::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+// ---------------------------------------------------------
+// CVeiEditVideoLabelNavi::NewLC()
+// ---------------------------------------------------------
+//
+EXPORT_C CVeiEditVideoLabelNavi* CVeiEditVideoLabelNavi::NewLC()
+    {
+    CVeiEditVideoLabelNavi* self = new (ELeave) CVeiEditVideoLabelNavi;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+// ---------------------------------------------------------
+// TUid CVeiEditVideoLabelNavi::ConstructL()
+// ---------------------------------------------------------
+//
+void CVeiEditVideoLabelNavi::ConstructL()
+    {
+	LOG(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::ConstructL: in");
+
+	iState = /*EStateEditView*/EStateInitializing;
+
+	iMmsMaxSize = 0;
+	CVeiVideoEditorSettings::GetMaxMmsSizeL( iMmsMaxSize );
+
+	LoadBitmapsL();
+
+	// Open resource file
+	TFileName resourceFile;
+    Dll::FileName(resourceFile);
+    TParse p;
+    p.Set(KResourceFile, &KDC_RESOURCE_FILES_DIR, &resourceFile);
+    resourceFile = p.FullName();
+	iResLoader.OpenL( resourceFile );
+
+	// The primary small font seems to be the smallest font available,
+	// but it is still too large to fit all the texts in QVGA mode. 
+	// We need to shrink it a little bit.
+	TAknFontSpecification spec( KAknFontCategoryPrimarySmall );
+	const CFont* myFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+	spec.SetTextPaneHeight( myFont->HeightInPixels() * KQvgaTextAndIconShrinkFactor );
+	CWsScreenDevice* dev = ControlEnv()->ScreenDevice();
+	iCustomFont = AknFontAccess::CreateLayoutFontFromSpecificationL( *dev, spec );
+
+	LOG(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::ConstructL: out");
+    }
+// ---------------------------------------------------------
+// TUid CVeiEditVideoLabelNavi::LoadBitmapsL()
+// ---------------------------------------------------------
+//
+void CVeiEditVideoLabelNavi::LoadBitmapsL()
+    {
+	LOG(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::LoadBitmapsL: in");
+
+	TFileName bitmapfile( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) );
+	MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+/* Mms bitmap */
+	AknsUtils::CreateColorIconL(
+            skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors,
+			EAknsCIQsnIconColorsCG6,
+            iMmsBitmap, iMmsBitmapMask,
+            bitmapfile,
+            EMbmVideoeditoruicomponentsQgn_indi_ve_mms_ok, EMbmVideoeditoruicomponentsQgn_indi_ve_mms_ok_mask,KRgbBlack);
+
+/* No Mms bitmap */
+	AknsUtils::CreateColorIconL(
+            skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors,
+			EAknsCIQsnIconColorsCG6,
+            iNoMmsBitmap, iNoMmsBitmapMask,
+            bitmapfile,
+            EMbmVideoeditoruicomponentsQgn_indi_ve_mms_non, EMbmVideoeditoruicomponentsQgn_indi_ve_mms_non_mask,KRgbBlack);
+
+/* Phone memory bitmap */
+	AknsUtils::CreateColorIconL(
+            skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors,
+			EAknsCIQsnIconColorsCG6,
+            iPhoneMemoryBitmap, iPhoneMemoryBitmapMask,
+            bitmapfile,
+            EMbmVideoeditoruicomponentsQgn_indi_ve_phone, EMbmVideoeditoruicomponentsQgn_indi_ve_phone_mask,KRgbBlack);
+
+/* No phone memory bitmap */
+	AknsUtils::CreateColorIconL(
+            skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors,
+			EAknsCIQsnIconColorsCG6,
+            iNoPhoneMemoryBitmap, iNoPhoneMemoryBitmapMask,
+            bitmapfile,
+            EMbmVideoeditoruicomponentsQgn_indi_ve_phone_non, EMbmVideoeditoruicomponentsQgn_indi_ve_phone_non_mask,KRgbBlack);
+
+/* MMC bitmap */
+	AknsUtils::CreateColorIconL(
+            skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors,
+			EAknsCIQsnIconColorsCG6,
+            iMMCBitmap, iMMCBitmapMask,
+            bitmapfile,
+            EMbmVideoeditoruicomponentsQgn_indi_ve_mmc, EMbmVideoeditoruicomponentsQgn_indi_ve_mmc_mask,KRgbBlack);
+
+/* No MMC bitmap */
+	AknsUtils::CreateColorIconL(
+            skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors,
+			EAknsCIQsnIconColorsCG6,
+            iNoMMCBitmap, iNoMMCBitmapMask,
+            bitmapfile,
+            EMbmVideoeditoruicomponentsQgn_indi_ve_mmc_non, EMbmVideoeditoruicomponentsQgn_indi_ve_mmc_non_mask,KRgbBlack);
+
+/* Time bitmap */
+	AknsUtils::CreateColorIconL(
+            skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors,
+			EAknsCIQsnIconColorsCG6,
+            iTimeBitmap, iTimeBitmapMask,
+            bitmapfile,
+            EMbmVideoeditoruicomponentsQgn_indi_ve_videolength, EMbmVideoeditoruicomponentsQgn_indi_ve_videolength_mask,KRgbBlack);
+
+	LOG(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::LoadBitmapsL: out");
+	}
+
+// ---------------------------------------------------------
+// TUid CVeiEditVideoLabelNavi::~CVeiEditVideoLabelNavi()
+// ---------------------------------------------------------
+//
+EXPORT_C CVeiEditVideoLabelNavi::~CVeiEditVideoLabelNavi()
+	{
+	DeleteBitmaps();
+	iResLoader.Close();
+	delete iCustomFont;
+	}
+
+void CVeiEditVideoLabelNavi::DeleteBitmaps()
+	{
+	delete iMmsBitmap;
+	iMmsBitmap = NULL;
+
+	delete iMmsBitmapMask;
+	iMmsBitmapMask = NULL;
+
+	delete iNoMmsBitmap;
+	iNoMmsBitmap = NULL;
+
+	delete iNoMmsBitmapMask;
+	iNoMmsBitmapMask = NULL;
+
+	delete iPhoneMemoryBitmap;
+	iPhoneMemoryBitmap = NULL;
+
+	delete iPhoneMemoryBitmapMask;
+	iPhoneMemoryBitmapMask = NULL;
+
+	delete iNoPhoneMemoryBitmap;
+	iNoPhoneMemoryBitmap = NULL;
+
+	delete iNoPhoneMemoryBitmapMask;
+	iNoPhoneMemoryBitmapMask = NULL;
+
+	delete iMMCBitmap;
+	iMMCBitmap = NULL;
+
+	delete iMMCBitmapMask;
+	iMMCBitmapMask = NULL;
+
+	delete iNoMMCBitmap;
+	iNoMMCBitmap = NULL;
+
+	delete iNoMMCBitmapMask;
+	iNoMMCBitmapMask = NULL;
+
+	delete iTimeBitmap;
+	iTimeBitmap = NULL;
+
+	delete iTimeBitmapMask;
+	iTimeBitmapMask = NULL;
+	}
+
+// ---------------------------------------------------------
+// CVeiEditVideoLabelNavi::CVeiEditVideoLabelNavi()
+// ---------------------------------------------------------
+//
+CVeiEditVideoLabelNavi::CVeiEditVideoLabelNavi() : iResLoader(*CEikonEnv::Static())
+	{
+	iStoryboardDuration = 0;
+	iStoryboardSize = 0;
+	}
+
+// ---------------------------------------------------------
+// CVeiEditVideoLabelNavi::Draw(const TRect& aRect) const
+// ---------------------------------------------------------
+//
+void CVeiEditVideoLabelNavi::Draw(const TRect& aRect) const
+    {
+    if ( iState == EStateInitializing )
+        {
+        return;
+        }
+	CWindowGc& gc=SystemGc();
+
+	// Get navi pane text color from skin
+	TRgb textColor( KRgbBlack );
+	MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+	AknsUtils::GetCachedColor(skinInstance, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG2 );
+
+	TBuf<25> layoutTime;
+	//minutes and seconds "120:13"
+	TBuf<15> minsec;  
+	TInt64 duration = 0; 
+	TTimeIntervalHours hours;
+	TTimeIntervalMinutes minutes; 
+	TTimeIntervalMicroSeconds seconds; 
+	duration = static_cast<TInt64>( iStoryboardDuration / 1000 ); 
+
+	TChar timeSeparator = TLocale().TimeSeparator(2);
+
+	//over 1 hour
+	if( duration >= 3600000 )
+		{
+		hours = TTimeIntervalHours( (TInt)(duration / 3600000) );
+		minsec.AppendNum( hours.Int() );
+		minsec.Append( timeSeparator );
+
+		duration = duration - TInt64(hours.Int()) * TInt64(3600000); 
+		}
+	//over 1 minute
+	if( duration >= 60000 )
+		{
+		minutes = TTimeIntervalMinutes( (TInt)(duration / 60000) );
+		minsec.AppendNum( minutes.Int() );
+
+		duration = duration - TInt64(minutes.Int()) * TInt64(60000); 
+		}
+	else
+		{
+		minsec.Append( _L( "00" ) );
+		}
+
+	if( duration >= 1000 ) 
+		{ 
+		seconds = TTimeIntervalMicroSeconds( duration / 1000 );
+
+		if( seconds.Int64() >= 60 ) 
+			{
+			minsec.Append( timeSeparator );
+			minsec.AppendNum( seconds.Int64() - 60 );
+			} 
+		else 
+			{
+			minsec.Append( timeSeparator );
+			if ( seconds.Int64() < 10 ) 
+				{ 
+				minsec.Append( _L("0") ); 
+				}
+
+			minsec.AppendNum( seconds.Int64() ); 
+			}
+		}
+	else 
+		{
+		minsec.Append( timeSeparator );
+		minsec.Append( _L("00") ); 
+		}
+	layoutTime.Append( minsec );
+	AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutTime );
+
+    //text MMS
+	TBuf<25> layoutTextMMS;
+	HBufC* stringholder = StringLoader::LoadLC( R_VEI_NAVI_PANE_MMS, iEikonEnv );
+	layoutTextMMS.Append( *stringholder );
+	AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutTextMMS );
+	CleanupStack::PopAndDestroy( stringholder );
+
+    //size of the movie in KB, MB or GB
+	TBuf<25> layoutSize;
+
+	if ( iStoryboardSize < 1000 )
+		{
+		HBufC* stringholder = StringLoader::LoadLC( R_VEI_SIZE_KB, iStoryboardSize, iEikonEnv );
+		layoutSize.Append( *stringholder );
+		AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutSize );
+		CleanupStack::PopAndDestroy( stringholder );
+		}
+	else 
+		{
+		TReal size = (TReal)iStoryboardSize / 1024;
+		if ( size >= 1000 )
+			{
+			// Gigabytes are handled differently from megabytes, because we don't have 
+			// appropriate localized string (i.e. with %U param) for gigabytes.
+			TInt gigaSize = (TInt) (size/1024 + 0.5);
+			stringholder = StringLoader::LoadLC( R_VEI_SIZE_GB, gigaSize, iEikonEnv );
+			layoutSize.Append( *stringholder );
+			AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutSize );
+			CleanupStack::PopAndDestroy( stringholder );
+			}
+		else
+			{
+			// for megabytes, drop the decimals if the value has 3 or more digits
+			TBuf16<256> sizeValue;
+			if (size < 100)
+				{
+				_LIT16( KFormat,"%3.1f" );
+				sizeValue.Format( KFormat,size );
+				}
+			else
+				{
+				_LIT16( KFormat,"%3.0f" );
+				sizeValue.Format( KFormat,size );
+				}
+			stringholder = StringLoader::LoadLC( R_VEI_SIZE_MB, sizeValue, iCoeEnv );
+			layoutSize.Append( *stringholder );
+			AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutSize );
+			CleanupStack::PopAndDestroy( stringholder );
+			}
+		}
+
+
+	if ( iState == EStateEditView ) //EditView owns the navipane
+		{
+		if ( iMmsAvailable )
+			{
+			iBitmapLayout[0].DrawImage( gc, iMmsBitmap, iMmsBitmapMask );
+			}
+		else
+			{
+			iBitmapLayout[0].DrawImage( gc, iNoMmsBitmap, iNoMmsBitmapMask );
+			}
+
+		if ( aRect.iBr.iX >= 148 ) // QVGA or bigger
+			{
+
+			if ( iPhoneMemory ) //phone memory in use.
+				{
+				if ( iMemoryAvailable )
+					{
+					iBitmapLayout[1].DrawImage( gc, iPhoneMemoryBitmap, iPhoneMemoryBitmapMask );
+					}
+				else
+					{
+					iBitmapLayout[1].DrawImage( gc, iNoPhoneMemoryBitmap, iNoPhoneMemoryBitmapMask );
+					}
+				}
+			else		//mmc-memory in use.
+				{
+				if ( iMemoryAvailable )
+					{
+					iBitmapLayout[1].DrawImage( gc, iMMCBitmap, iMMCBitmapMask );
+					}
+				else
+					{
+					iBitmapLayout[1].DrawImage( gc, iNoMMCBitmap, iNoMMCBitmapMask );
+					}
+				}
+			iTextLayout[1].DrawText( gc, layoutSize, ETrue, textColor );	
+			}
+
+		iBitmapLayout[2].DrawImage( gc, iTimeBitmap, iTimeBitmapMask );
+
+
+		iTextLayout[0].DrawText( gc, layoutTextMMS, ETrue, textColor );
+		iTextLayout[2].DrawText( gc, layoutTime, ETrue, textColor );
+
+		}
+	else if ( iState == EStateTrimForMmsView ) //TrimForMmsView owns the navi pane.
+		{
+		if ( iMmsAvailable )
+		    {
+		    iBitmapLayout[0].DrawImage( gc, iMmsBitmap, iMmsBitmapMask );
+			}
+		else
+			{
+			iBitmapLayout[0].DrawImage( gc, iNoMmsBitmap, iNoMmsBitmapMask );
+			}
+		iTextLayout[0].DrawText( gc, layoutSize, ETrue, textColor );
+        iBitmapLayout[2].DrawImage( gc, iTimeBitmap, iTimeBitmapMask );
+		iTextLayout[2].DrawText( gc, layoutTime, ETrue, textColor );
+		}
+
+	// TEST
+/*	gc.SetPenColor( KRgbRed );
+	iBitmapLayout[0].DrawOutLineRect(gc);
+	iBitmapLayout[1].DrawOutLineRect(gc);
+	iBitmapLayout[2].DrawOutLineRect(gc);
+
+	gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+	gc.DrawRect( iTextLayout[0].TextRect() );
+	gc.DrawRect( iTextLayout[1].TextRect() );
+	gc.DrawRect( iTextLayout[2].TextRect() );
+
+	gc.DrawRect( Rect() );*/
+	// END TEST
+
+	}
+
+// ---------------------------------------------------------
+// CVeiEditVideoLabelNavi::HandleResourceChange(TInt aType)
+// ---------------------------------------------------------
+//
+void CVeiEditVideoLabelNavi::HandleResourceChange(TInt aType)
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::HandleResourceChange() In, aType:%d", aType);
+
+	if (KAknsMessageSkinChange == aType)
+		{
+		// Reload the icon bitmaps with the current skin color
+		DeleteBitmaps();
+		TRAP_IGNORE( LoadBitmapsL() );
+		}
+	CCoeControl::HandleResourceChange(aType);
+
+	LOG(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::HandleResourceChange() Out");
+	}
+ 
+// --------------------------------------------------------
+// CVeiEditVideoLabelNavi::SetMmsAvailableL( TBool aIsAvailable )
+// Set MMS envelope without red line or with it.
+// ---------------------------------------------------------
+//
+EXPORT_C void CVeiEditVideoLabelNavi::SetMmsAvailableL( TBool aIsAvailable )
+	{
+	iMmsAvailable = aIsAvailable;
+	ReportEventL( MCoeControlObserver::EEventStateChanged );	
+	}
+EXPORT_C TBool CVeiEditVideoLabelNavi::IsMMSAvailable() const
+	{
+	return iMmsAvailable;
+	}
+
+// --------------------------------------------------------
+// CVeiEditVideoLabelNavi::SetMemoryInUseL( TBool aPhoneMemory )
+// Set memory in use Phone/MMC.
+// ---------------------------------------------------------
+//
+EXPORT_C void CVeiEditVideoLabelNavi::SetMemoryInUseL( TBool aPhoneMemory )
+	{
+	iPhoneMemory = aPhoneMemory;
+	ReportEventL( MCoeControlObserver::EEventStateChanged );
+	}
+// --------------------------------------------------------
+// CVeiEditVideoLabelNavi::SetMemoryAvailableL( TBool aIsAvailable )
+// ?implementation_description
+// ---------------------------------------------------------
+//
+EXPORT_C void CVeiEditVideoLabelNavi::SetMemoryAvailableL( TBool aIsAvailable )
+	{
+	iMemoryAvailable = aIsAvailable;
+	ReportEventL( MCoeControlObserver::EEventStateChanged );
+	}
+// ---------------------------------------------------------
+// CVeiEditVideoLabelNavi::SetDurationLabelL( const TUint& aDuration )
+// Set movie duration.
+// ---------------------------------------------------------
+//
+EXPORT_C void CVeiEditVideoLabelNavi::SetDurationLabelL( const TInt64& aDuration )
+	{
+	iStoryboardDuration = aDuration;
+	ReportEventL( MCoeControlObserver::EEventStateChanged );	
+	}
+
+// ---------------------------------------------------------
+// CVeiEditVideoLabelNavi::SetSizeLabelL( const TUint& aSize )
+// Set movie size.
+// ---------------------------------------------------------
+//
+EXPORT_C void CVeiEditVideoLabelNavi::SetSizeLabelL( const TUint& aSize )
+	{
+	iStoryboardSize = aSize;
+	ReportEventL( MCoeControlObserver::EEventStateChanged );	
+	}
+// ---------------------------------------------------------
+// CVeiEditVideoLabelNavi::SetState( CVeiEditVideoLabelNavi::TLabelNaviState aState )
+//  Set whether editview or trimformms-view 
+// ---------------------------------------------------------
+//
+EXPORT_C void CVeiEditVideoLabelNavi::SetState( CVeiEditVideoLabelNavi::TLabelNaviState aState )
+	{
+	iState = aState;
+	}
+
+// ---------------------------------------------------------
+// CVeiEditVideoLabelNavi::SizeChanged()
+// ---------------------------------------------------------
+//
+void CVeiEditVideoLabelNavi::SizeChanged()
+	{
+	TRect parentRect = Rect();
+    parentRect.iTl.iY = parentRect.iTl.iY +2;
+	TInt adjustLeftMemoryIcon(0);
+	TInt adjustLeftTimeIcon(0);
+
+	TInt adjustLeftMMSIcon = 0; 
+	TInt adjustWidth =  parentRect.Height();
+	TInt adjustHeight = parentRect.Height();
+
+	const CFont* myFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+
+	// For high resolution(352x416) use different font
+	if ( parentRect.iBr.iX >= 216 ) // high resolution(352x416)
+		{
+		adjustLeftMemoryIcon = STATIC_CAST( TInt, parentRect.Width() * 0.28 );
+		adjustLeftTimeIcon = STATIC_CAST( TInt, parentRect.Width() * 0.67 );
+		myFont = AknLayoutUtils::FontFromId( ELatinBold12 );
+		}
+	else if ( parentRect.iBr.iX >= 148 ) // QVGA (240x320)
+		{
+		adjustLeftMemoryIcon = STATIC_CAST( TInt, parentRect.Width() * 0.27 );
+		adjustLeftTimeIcon = STATIC_CAST( TInt, parentRect.Width() * 0.64 );
+
+		// Reduce the relative size of the icons a little bit.
+		adjustWidth *= KQvgaTextAndIconShrinkFactor;
+		adjustHeight *= KQvgaTextAndIconShrinkFactor;
+
+		// use the extra small font
+		myFont = (const CFont*)iCustomFont;
+		}
+	else
+		{
+		// in the small resolution (176x208) the memory icon and text are dropped out
+		adjustLeftMemoryIcon = STATIC_CAST( TInt, parentRect.Width() * 0.4138 );
+		adjustLeftTimeIcon = STATIC_CAST( TInt, parentRect.Width() * 0.42 + 15);
+		}
+
+	AknIconUtils::SetSize( iMmsBitmap, TSize( adjustWidth,adjustHeight) );
+	AknIconUtils::SetSize( iNoMmsBitmap, TSize(adjustWidth,adjustHeight) );
+	AknIconUtils::SetSize( iPhoneMemoryBitmap, TSize(adjustWidth,adjustHeight) );
+	AknIconUtils::SetSize( iNoPhoneMemoryBitmap, TSize(adjustWidth,adjustHeight) );
+	AknIconUtils::SetSize( iMMCBitmap, TSize(adjustWidth,adjustHeight) );
+	AknIconUtils::SetSize( iNoMMCBitmap, TSize(adjustWidth,adjustHeight) );
+	AknIconUtils::SetSize( iTimeBitmap, TSize(adjustWidth,adjustHeight) );
+
+	//LayoutRect(const TRect &aParent, TInt C, TInt left, TInt top, TInt right, TInt bottom, TInt Width, TInt Height);
+	iBitmapLayout[0].LayoutRect( parentRect, ELayoutEmpty, adjustLeftMMSIcon, 0, ELayoutEmpty, ELayoutEmpty, adjustWidth, adjustHeight );
+	iBitmapLayout[1].LayoutRect( parentRect, ELayoutEmpty, adjustLeftMemoryIcon, 0, ELayoutEmpty, ELayoutEmpty, adjustWidth, adjustHeight );
+	iBitmapLayout[2].LayoutRect( parentRect, ELayoutEmpty, adjustLeftTimeIcon, 0, ELayoutEmpty, ELayoutEmpty, adjustWidth, adjustHeight );
+	
+	//layout for MMS-text
+	TInt tX = adjustLeftMMSIcon + adjustWidth;
+	TInt tY = 2;
+
+	TInt bX = adjustLeftTimeIcon;
+	TInt bY = parentRect.Height();
+	TRect mmsTextArea( tX, tY, bX, bY ); 
+
+	TInt baseline = ( mmsTextArea.Height() / 2 ) + ( myFont->AscentInPixels() / 2 );
+	if (myFont == iCustomFont)
+		{
+		// It seems that even if the font size is scaled down, AscentInPixels()
+		// returns the original fon't ascent. We have to scale it down as well.
+		baseline = ( mmsTextArea.Height() / 2 ) + ( myFont->AscentInPixels() / 2 * KQvgaTextAndIconShrinkFactor );
+		}
+	TInt margin=1; 
+	TInt width = mmsTextArea.Width();
+	iTextLayout[0].LayoutText( mmsTextArea,0,0,margin,margin,baseline,width,ELayoutAlignLeft,myFont );
+	
+	//layout for size-text
+	tX = adjustLeftMemoryIcon + adjustWidth;
+	bX = adjustLeftTimeIcon;
+	TRect sizeTextArea( tX, tY, bX, bY ); 
+	width = sizeTextArea.Width();
+    //LayoutText(const TRect& aParent, TInt fontid, TInt C, TInt l, TInt r, TInt B, TInt W, TInt J, const CFont* aCustomFont=0);
+	iTextLayout[1].LayoutText( sizeTextArea, 0, 0, margin, margin, baseline, width, ELayoutAlignLeft, myFont );
+	
+	//layout for time-text
+	tX = adjustLeftTimeIcon + adjustWidth;
+	bX = parentRect.Width();
+	TRect timeTextArea( tX, tY, bX, bY ); 
+	width = timeTextArea.Width();
+	iTextLayout[2].LayoutText( timeTextArea, 0, 0, margin, margin, baseline, width, ELayoutAlignLeft, myFont );
+	}
+
+
+//-------------------------------------------------------------------------------
+//CVeiEditVideoLabelNavi::GetMaxMmsSize()
+// available max size of the MMS.
+//-------------------------------------------------------------------------------
+EXPORT_C TInt CVeiEditVideoLabelNavi::GetMaxMmsSize() const
+	{
+	return iMmsMaxSize/1024;
+	}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/src/VeiErrorUi.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// INCLUDES
+#include <errorui.h>
+#include <StringLoader.h>
+#include <AknNoteWrappers.h>
+#include <data_caging_path_literals.hrh>
+#include <VideoeditorUiComponents.rsg>
+#include "VeiErrorUi.h"
+#include "VideoEditorDebugUtils.h"
+
+// CONSTANTS
+_LIT(KResourceFile, "VideoEditorUiComponents.rsc");
+
+
+//=============================================================================
+EXPORT_C CVeiErrorUI* CVeiErrorUI::NewL( CCoeEnv& aCoeEnv )
+	{
+	CVeiErrorUI* self = new (ELeave) CVeiErrorUI( aCoeEnv );
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+//=============================================================================
+void CVeiErrorUI::ConstructL()
+	{
+	iErrorUI = CErrorUI::NewL();
+
+	// Locate and open the resource file
+    TFileName fileName;
+    TParse p;    
+
+    Dll::FileName(fileName);
+    p.Set(KResourceFile, &KDC_RESOURCE_FILES_DIR, &fileName);
+    fileName = p.FullName();
+    
+    LOGFMT(KVideoEditorLogFile, "\tLoading resource file: %S", &fileName);
+	iResLoader.OpenL( fileName ); // RConeResourceLoader selects the correct language file
+	}
+
+//=============================================================================
+CVeiErrorUI::CVeiErrorUI( CCoeEnv& aCoeEnv ) : iCoeEnv( aCoeEnv ), iResLoader( aCoeEnv )
+	{
+	}
+
+//=============================================================================
+CVeiErrorUI::~CVeiErrorUI()
+	{
+	delete iErrorUI;
+	iResLoader.Close();
+	}
+
+//=============================================================================
+EXPORT_C TInt CVeiErrorUI::ShowGlobalErrorNote( const TInt aError ) const
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiErrorUI::ShowGlobalErrorNoteL: In (%d)", aError);
+
+	TRAPD ( err,
+	    switch( aError )
+	        {
+	        case 0:
+	            {
+	            // do nothing to KErrNone
+	            break;
+	            }
+	        case -3:
+	            {
+	            // do nothing to KErrCancel
+	            break;
+	            }
+	        case -4: // KErrNoMemory
+	            {
+	            iErrorUI->ShowGlobalErrorNoteL( aError );
+	            break;
+	            }
+	        case -5: // KErrNotSupported
+	            {
+	            iErrorUI->ShowGlobalErrorNoteL( aError );
+	            break;
+	            }
+	        case -14: // KErrInUse
+	            {
+	            iErrorUI->ShowGlobalErrorNoteL( aError );
+	            break;
+	            }
+	        case -26: // KErrDiskFull
+	            {
+	            iErrorUI->ShowGlobalErrorNoteL( aError );
+	            break;
+	            }
+	        case -33: // KErrTimedOut
+	            {
+	            iErrorUI->ShowGlobalErrorNoteL( aError );
+	            break;
+	            }
+	        case -46: // KErrPermissionDenied
+	            {
+	            iErrorUI->ShowGlobalErrorNoteL( aError );
+	            break;
+	            }
+	        default :
+	            {
+				HBufC* stringholder;
+				stringholder = StringLoader::LoadLC( R_VEI_DEFAULT_ERROR_NOTE, &iCoeEnv );
+				CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+				dlg->ExecuteLD( *stringholder );
+				CleanupStack::PopAndDestroy( stringholder );
+	            break;
+	            }
+	        }
+		);
+
+    LOGFMT(KVideoEditorLogFile, "CVeiErrorUI::ShowGlobalErrorNote: Out: %d", err);
+
+    return err;
+    }
+
+//=============================================================================
+EXPORT_C TInt CVeiErrorUI::ShowErrorNote( CCoeEnv& aCoeEnv, const TInt aResourceId, TInt aError )
+	{
+	LOG(KVideoEditorLogFile, "CVeiErrorUI::ShowErrorNote: in");
+
+	TRAPD ( err,
+
+		HBufC* stringholder;
+		if ( aError == 0 )
+			{
+			stringholder = StringLoader::LoadLC( aResourceId, &aCoeEnv );
+			}
+		else
+			{
+			stringholder = StringLoader::LoadLC( aResourceId, aError, &aCoeEnv );
+			}
+
+		CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+		dlg->ExecuteLD( *stringholder );
+
+		CleanupStack::PopAndDestroy( stringholder );
+	);
+
+	LOGFMT(KVideoEditorLogFile, "CVeiErrorUI::ShowErrorNote: out: %d", err);
+
+	return err;
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/src/VeiSlider.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,429 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#include "VeiSlider.h"
+#include "VeiSlider.pan"
+#include "VideoEditorDebugUtils.h"
+
+#include <VideoEditorUiComponents.mbg>
+#include <fbs.h>
+#include <aknutils.h>
+#include <AknIconUtils.h>
+#include <eikenv.h>
+
+// CONSTANTS
+_LIT(KSliderMifFile, "\\resource\\apps\\VideoEditorUiComponents.mif");
+
+const TInt KTabAspectRatioX = 10;
+const TInt KTabAspectRatioY = 24;
+
+//=============================================================================
+//
+//	class CVeiSlider member functions
+//
+//=============================================================================
+
+//=============================================================================
+EXPORT_C CVeiSlider::~CVeiSlider()
+    {
+    delete iSliderBg;
+	delete iSliderBgMask;
+	delete iSliderTab;
+	delete iSliderTabMask;
+    }
+
+//=============================================================================
+CVeiSlider::CVeiSlider()
+    {
+    // no implementation required
+    }
+
+//=============================================================================
+TInt CVeiSlider::CountComponentControls() const
+    {
+    return 0;
+    }
+
+//=============================================================================
+CCoeControl* CVeiSlider::ComponentControl(TInt /*aIndex*/) const
+    {
+    return NULL;
+    }
+
+// setters
+
+//=============================================================================
+EXPORT_C void CVeiSlider::SetMinimum(TInt aValue)
+	{
+	iMinimumValue = aValue;
+	}
+
+//=============================================================================
+EXPORT_C void CVeiSlider::SetMaximum(TInt aValue)
+	{
+	iMaximumValue = aValue;
+	}
+
+//=============================================================================
+EXPORT_C void CVeiSlider::SetStep(TUint aValue)
+	{
+	iStep = aValue;
+	}
+
+//=============================================================================
+EXPORT_C void CVeiSlider::SetStepAmount(TUint8 aValue)
+	{
+	iNumberOfSteps = aValue;
+	
+	if(aValue == 0)
+		{
+		iStep = 0;
+		}
+	else
+		{
+		iStep = (iMaximumValue-iMinimumValue) / aValue;
+		}
+	}
+
+//=============================================================================
+EXPORT_C void CVeiSlider::SetPosition(TInt aValue)
+	{
+	__ASSERT_ALWAYS( aValue >= iMinimumValue, Panic(EVeiSliderPanicIndexUnderflow) );
+	__ASSERT_ALWAYS( aValue <= iMaximumValue, Panic(EVeiSliderPanicIndexOverflow) );
+
+	iPosition = aValue;
+	}
+
+// getters
+
+//=============================================================================
+EXPORT_C TInt CVeiSlider::Minimum() const
+	{
+	return iMinimumValue;
+	}
+
+//=============================================================================
+EXPORT_C TInt CVeiSlider::Maximum() const
+	{
+	return iMaximumValue;
+	}
+
+//=============================================================================
+EXPORT_C TInt CVeiSlider::Step() const
+	{
+	return iStep;
+	}
+
+//=============================================================================
+EXPORT_C TInt CVeiSlider::SliderPosition() const
+	{
+	return iPosition;
+	}
+
+//=============================================================================
+EXPORT_C void CVeiSlider::Increment()
+	{
+	iPosition += iStep;
+	if(iPosition > iMaximumValue)
+		{
+		iPosition = iMaximumValue;
+		}
+	}
+
+//=============================================================================
+EXPORT_C void CVeiSlider::Decrement()
+	{
+	iPosition -= iStep;
+	if(iPosition < iMinimumValue)
+		{
+		iPosition = iMinimumValue;
+		}
+	}
+
+//=============================================================================
+void CVeiSlider::LoadBitmapL( CFbsBitmap*& aBitmap, CFbsBitmap*& aMask, TInt aBitmapId, TInt aMaskId ) const
+	{
+    TFileName iconFile( KSliderMifFile );
+  
+    User::LeaveIfError( CompleteWithAppPath(iconFile) );
+
+    // Get ids for bitmap and mask
+    AknIconUtils::CreateIconL(
+        aBitmap,
+        aMask,
+        iconFile,
+        aBitmapId,
+        aMaskId
+        );                
+	}
+
+
+//=============================================================================
+//
+//	class CVeiVerticalSlider member functions
+//
+//=============================================================================
+
+//=============================================================================
+EXPORT_C CVeiVerticalSlider* CVeiVerticalSlider::NewL(const TRect& aRect, const CCoeControl& aControl)
+	{
+	CVeiVerticalSlider* self = CVeiVerticalSlider::NewLC(aRect, aControl);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+//=============================================================================
+EXPORT_C CVeiVerticalSlider* CVeiVerticalSlider::NewLC(const TRect& aRect, const CCoeControl& aControl)
+    {
+    CVeiVerticalSlider* self = new (ELeave) CVeiVerticalSlider;
+    CleanupStack::PushL(self);
+    self->ConstructL(aRect, aControl);
+    return self;
+    }
+
+//=============================================================================
+EXPORT_C CVeiVerticalSlider::~CVeiVerticalSlider()
+    {
+    }
+
+//=============================================================================
+void CVeiVerticalSlider::ConstructL(const TRect& aRect, const CCoeControl& aControl)
+	{
+	LOG(KVideoEditorLogFile, "CVeiVerticalSlider::ConstructL: in");
+
+	SetContainerWindowL(aControl);
+
+    // Load the bitmaps 
+    LoadBitmapL( iSliderBg, iSliderBgMask, EMbmVideoeditoruicomponentsQgn_graf_ied_vslider, EMbmVideoeditoruicomponentsQgn_graf_ied_vslider_mask );
+    LoadBitmapL( iSliderTab, iSliderTabMask, EMbmVideoeditoruicomponentsQgn_graf_ied_vtab, EMbmVideoeditoruicomponentsQgn_graf_ied_vtab_mask );
+
+	SetRect(aRect);
+	ActivateL();
+
+	LOG(KVideoEditorLogFile, "CVeiVerticalSlider::ConstructL: out");
+	}
+
+//=============================================================================
+CVeiVerticalSlider::CVeiVerticalSlider()
+    {
+    // no implementation required
+    }
+
+//=============================================================================
+void CVeiVerticalSlider::Draw(const TRect& aRect) const
+	{
+    if ( Minimum() <= Maximum() )
+    	{
+        TUint height = Maximum() - Minimum(); // height of the slider
+        TUint pixelsFromMin = SliderPosition() - Minimum(); // tab position from the beginning
+    
+        TReal factor = 0.0;
+        if (Minimum() < Maximum() )
+        	{
+            factor = (TReal) pixelsFromMin / height; // tab position from the beginning in percentage
+        	}
+        TUint sliderTabHeight = iSliderTab->SizeInPixels().iHeight; // slider tab height
+
+        // slider bitmap is actually a bit longer but this resolves the problem
+        // where the tab is drawn outside of the slider when in maximum position
+        TUint sliderBitmapHeight = iSliderBg->SizeInPixels().iHeight - sliderTabHeight;
+    
+        TUint tabPositionFromMinInPixels = (TUint) (factor * sliderBitmapHeight + 0.5); // calculate tab position
+
+        // top left coordinate
+        const TPoint tl = aRect.iTl;
+
+        CWindowGc& gc = SystemGc();
+
+        // draw actual slider using mask bitmap
+        TRect bgRect(TPoint(0,0), iSliderBg->SizeInPixels());
+        gc.BitBltMasked(tl, iSliderBg, bgRect, iSliderBgMask, ETrue);
+
+        // draw the tab using mask bitmap
+        TRect tabRect(TPoint(0,0), iSliderTab->SizeInPixels());
+        gc.BitBltMasked(TPoint(tl.iX, tl.iY+tabPositionFromMinInPixels), iSliderTab, tabRect, iSliderTabMask, ETrue);
+    	}
+	}
+
+//=============================================================================
+void CVeiVerticalSlider::SizeChanged()
+	{
+	LOG(KVideoEditorLogFile, "CVeiVerticalSlider::SizeChanged: in");
+
+	__ASSERT_ALWAYS( iSliderBg && iSliderTab, Panic(EVeiSliderPanicBitmapsNotLoaded) );
+
+	// Set size for scalable icons - MUST BE CALLED BEFORE ICON IS USABLE
+	TSize sliderSize;
+	TSize tabSize;
+
+	TInt w = Rect().Width();
+	TInt h = Rect().Height();
+
+	// NOTE: this assumes that the slider and the slider tab have the same width.
+	// If that is not the case, it should be handled with transparency in the SVG graphic.
+
+	// Set the slider bg to fill the whole rect
+	sliderSize.iWidth = w;
+	sliderSize.iHeight = h;
+	AknIconUtils::SetSize( iSliderBg, sliderSize, EAspectRatioNotPreserved);
+
+	// The slider tab is set to have the same width.
+	// The height is calculated from the aspect ratio (set based on the original SVG)
+	tabSize.iWidth = w;
+	tabSize.iHeight = (TInt)( w * KTabAspectRatioY / KTabAspectRatioX );
+	AknIconUtils::SetSize( iSliderTab, tabSize, EAspectRatioNotPreserved);
+
+	LOGFMT4(KVideoEditorLogFile, "CVeiVerticalSlider::SizeChanged: out: sliderSize(%d,%d), tabSize(%d,%d)", sliderSize.iWidth,sliderSize.iHeight,tabSize.iWidth,tabSize.iHeight);
+	}
+
+//=============================================================================
+TSize CVeiVerticalSlider::MinimumSize()
+	{
+	LOG(KVideoEditorLogFile, "CVeiVerticalSlider::MinimumSize()");
+
+	return iSliderBg->SizeInPixels();
+	}
+
+//=============================================================================
+//
+//	class CVeiHorizontalSlider member functions
+//
+//=============================================================================
+
+//=============================================================================
+EXPORT_C CVeiHorizontalSlider* CVeiHorizontalSlider::NewL(const TRect& aRect, const CCoeControl& aControl)
+	{
+	CVeiHorizontalSlider* self = CVeiHorizontalSlider::NewLC(aRect, aControl);
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+//=============================================================================
+EXPORT_C CVeiHorizontalSlider* CVeiHorizontalSlider::NewLC(const TRect& aRect, const CCoeControl& aControl)
+    {
+    CVeiHorizontalSlider* self = new (ELeave) CVeiHorizontalSlider;
+    CleanupStack::PushL(self);
+    self->ConstructL(aRect, aControl);
+    return self;
+    }
+
+//=============================================================================
+EXPORT_C CVeiHorizontalSlider::~CVeiHorizontalSlider()
+    {
+    }
+
+//=============================================================================
+void CVeiHorizontalSlider::ConstructL(const TRect& aRect, const CCoeControl& aControl)
+	{
+	LOG(KVideoEditorLogFile, "CVeiVerticalSlider::ConstructL: in");
+
+	SetContainerWindowL(aControl);
+
+    // Load the bitmaps 
+    LoadBitmapL( iSliderBg, iSliderBgMask, EMbmVideoeditoruicomponentsQgn_graf_ied_hslider, EMbmVideoeditoruicomponentsQgn_graf_ied_hslider_mask );
+    LoadBitmapL( iSliderTab, iSliderTabMask, EMbmVideoeditoruicomponentsQgn_graf_ied_htab, EMbmVideoeditoruicomponentsQgn_graf_ied_htab_mask );
+
+	SetRect(aRect);
+	ActivateL();
+
+	LOG(KVideoEditorLogFile, "CVeiVerticalSlider::ConstructL: out");
+	}
+
+//=============================================================================
+CVeiHorizontalSlider::CVeiHorizontalSlider()
+    {
+    // no implementation required
+    }
+
+//=============================================================================
+void CVeiHorizontalSlider::Draw(const TRect& aRect) const
+	{
+    if ( Minimum() <= Maximum() )
+    	{
+        TUint height = Maximum() - Minimum(); // height of the slider
+        TUint pixelsFromMin = SliderPosition() - Minimum(); // tab position from the beginning
+    
+        TReal factor = 0.0;
+        if (Minimum() < Maximum() )
+        	{
+            factor = (TReal) pixelsFromMin / height; // tab position from the beginning in percentage
+        	}
+        TUint sliderTabWidth = iSliderTab->SizeInPixels().iWidth; // slider tab width
+
+        // slider bitmap is actually a bit longer but this resolves the problem
+        // where the tab is drawn outside of the slider when in maximum position
+        TUint sliderBitmapWidth = iSliderBg->SizeInPixels().iWidth - sliderTabWidth;
+    
+        TUint tabPositionFromMinInPixels = (TUint) (factor * sliderBitmapWidth + 0.5); // calculate tab position
+
+        // top left coordinate
+        const TPoint tl = aRect.iTl;
+
+        CWindowGc& gc = SystemGc();
+
+        // draw actual slider using mask bitmap
+        TRect bgRect(TPoint(0,0), iSliderBg->SizeInPixels());
+        gc.BitBltMasked(tl, iSliderBg, bgRect, iSliderBgMask, ETrue);
+
+        // draw the tab using mask bitmap
+        TRect tabRect(TPoint(0,0),iSliderTab->SizeInPixels());
+        gc.BitBltMasked(TPoint(tl.iX + tabPositionFromMinInPixels, tl.iY), iSliderTab, tabRect, iSliderTabMask, ETrue);
+    	}
+	}
+
+//=============================================================================
+void CVeiHorizontalSlider::SizeChanged()
+	{
+	LOG(KVideoEditorLogFile, "CVeiHorizontalSlider::SizeChanged: in");
+
+	__ASSERT_ALWAYS( iSliderBg && iSliderTab, Panic(EVeiSliderPanicBitmapsNotLoaded) );
+
+	// Set size for scalable icons - MUST BE CALLED BEFORE ICON IS USABLE
+	TSize sliderSize;
+	TSize tabSize;
+
+	TInt w = Rect().Width();
+	TInt h = Rect().Height();
+
+	// NOTE: this assumes that the slider and the slider tab have the same height.
+	// If that is not the case, it should be handled with transparency in the SVG graphic.
+
+	// Set the slider bg to fill the whole rect.
+	sliderSize.iWidth = w;
+	sliderSize.iHeight = h;
+	AknIconUtils::SetSize( iSliderBg, sliderSize, EAspectRatioNotPreserved);
+
+	// The slider tab is set to have the same height with the bg.
+	// The width is calculated from the aspect ratio (set based on the original SVG).
+	tabSize.iWidth = (TInt)( h * KTabAspectRatioY / KTabAspectRatioX );
+	tabSize.iHeight = h;
+	AknIconUtils::SetSize( iSliderTab, tabSize, EAspectRatioNotPreserved);
+
+	LOGFMT4(KVideoEditorLogFile, "CVeiHorizontalSlider::SizeChanged: out: sliderSize(%d,%d), tabSize(%d,%d)", sliderSize.iWidth,sliderSize.iHeight,tabSize.iWidth,tabSize.iHeight);
+	}
+
+//=============================================================================
+TSize CVeiHorizontalSlider::MinimumSize()
+	{
+	LOG(KVideoEditorLogFile, "CVeiHorizontalSlider::MinimumSize()");
+
+	return iSliderBg->SizeInPixels();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/src/VeiTextDisplay.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,764 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// System includes
+#include <aknbiditextutils.h>
+#include <aknutils.h>
+#include <AknsSkinInstance.h>
+#include <AknsUtils.h> 
+#include <gulfont.h>
+#include <VideoEditorUiComponents.rsg>
+#include <avkon.rsg>
+#include <stringloader.h>
+#include <akniconutils.h>
+#include <VideoEditorUiComponents.mbg>
+#include <data_caging_path_literals.hrh>
+#include <aknlayoutscalable_avkon.cdl.h>
+#include <aknlayoutscalable_apps.cdl.h>
+
+// User includes
+#include "VeiTextDisplay.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorUtils.h"
+#include "VideoEditorDebugUtils.h"
+
+// CONSTANTS
+_LIT(KResourceFile, "VideoEditorUiComponents.rsc");
+
+EXPORT_C CVeiTextDisplay* CVeiTextDisplay::NewL( const TRect& aRect, const CCoeControl* aParent )
+    {
+    CVeiTextDisplay* self = CVeiTextDisplay::NewLC( aRect, aParent );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+EXPORT_C CVeiTextDisplay* CVeiTextDisplay::NewLC( const TRect& aRect, const CCoeControl* aParent )
+    {
+    CVeiTextDisplay* self = new (ELeave) CVeiTextDisplay;
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect, aParent );
+    return self;
+    }
+
+void CVeiTextDisplay::ConstructL( const TRect& aRect, const CCoeControl* aParent )
+    {
+	iClipName = HBufC::NewL( 0 );
+	iClipLocation = HBufC::NewL( 0 );
+
+	iLayout = EOnlyName;
+
+	TFileName mbmPath( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) );
+
+	AknIconUtils::CreateIconL( iUpperArrow, iUpperArrowMask,
+			mbmPath, EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up, 
+			EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up_mask );
+
+	AknIconUtils::CreateIconL( iLowerArrow, iLowerArrowMask,
+			mbmPath, EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up, 
+			EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up_mask );
+
+	AknIconUtils::CreateIconL( iRightArrow, iRightArrowMask,
+		    mbmPath, EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up, 
+			EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up_mask );
+	
+	AknIconUtils::CreateIconL( iLeftArrow, iLeftArrowMask,
+			mbmPath, EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up, 
+			EMbmVideoeditoruicomponentsQgn_indi_volume_arrow_up_mask );
+
+	AknIconUtils::CreateIconL( iStartMarkIcon, iStartMarkIconMask,
+			mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded_start, 
+			EMbmVideoeditoruicomponentsQgn_indi_vded_start_mask );
+			
+	AknIconUtils::CreateIconL( iEndMarkIcon, iEndMarkIconMask,
+			mbmPath, EMbmVideoeditoruicomponentsQgn_indi_vded_end, 
+			EMbmVideoeditoruicomponentsQgn_indi_vded_end_mask );			
+
+	iUpperArrowVisible = EFalse;
+	iLowerArrowVisible = EFalse;
+	iRightArrowVisible = EFalse;
+	iLeftArrowVisible = EFalse;
+
+	iSlowMotionOn = EFalse;
+
+	iBlinkTimer = CPeriodic::NewL( CActive::EPriorityLow );
+	
+	// Open resource file
+	TFileName resourceFile;
+    Dll::FileName(resourceFile);
+    TParse p;
+    p.Set(KResourceFile, &KDC_RESOURCE_FILES_DIR, &resourceFile);
+    resourceFile = p.FullName();
+	iResLoader.OpenL( resourceFile );
+
+	SetContainerWindowL( *aParent );
+    SetRect( aRect );
+    ActivateL();
+    }
+
+CVeiTextDisplay::CVeiTextDisplay() : iResLoader(*CEikonEnv::Static())
+	{
+	}
+
+EXPORT_C CVeiTextDisplay::~CVeiTextDisplay()
+	{
+	if ( iClipName )
+		{
+		delete iClipName;
+		}
+  
+	delete iClipLocation;
+    delete iUpperArrow;
+    delete iUpperArrowMask;
+
+    delete iLowerArrow;
+    delete iLowerArrowMask;
+
+    delete iRightArrow;
+    delete iRightArrowMask;
+
+    delete iLeftArrow;
+    delete iLeftArrowMask;
+
+	delete iStartMarkIcon;
+	delete iStartMarkIconMask;
+	
+	delete iEndMarkIcon;
+	delete iEndMarkIconMask;
+	
+	if ( iBlinkTimer )
+		{
+		iBlinkTimer->Cancel();
+		delete iBlinkTimer;
+		}
+	iResLoader.Close();
+	}
+
+void CVeiTextDisplay::SizeChanged()
+	{
+	TRect rect( Rect() );
+	const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+	TInt fontHeight = font->HeightInPixels();
+	
+	TSize arrowSize;
+	
+	if ( iLayout == EArrowsVertical )
+		{
+		arrowSize = TSize( (rect.Height()-fontHeight) / 2, (rect.Height()-fontHeight) / 2 );
+		}
+	else
+		{
+		arrowSize = iDynamicArrowSize;
+		}
+	
+	AknIconUtils::SetSize( iUpperArrow, arrowSize, 
+		EAspectRatioNotPreserved );
+
+	AknIconUtils::SetSizeAndRotation( iLowerArrow, 
+		arrowSize, EAspectRatioNotPreserved, 180 );
+
+	AknIconUtils::SetSizeAndRotation( iRightArrow, 
+		arrowSize, EAspectRatioNotPreserved, 90 );
+
+	AknIconUtils::SetSizeAndRotation( iLeftArrow,
+        arrowSize, EAspectRatioNotPreserved, 270 );
+        
+   	AknIconUtils::SetSize( iStartMarkIcon,
+        iStartTimeIconRect.Size(), EAspectRatioNotPreserved);    
+        
+   	AknIconUtils::SetSize( iEndMarkIcon,
+        iEndTimeIconRect.Size(), EAspectRatioNotPreserved);            
+        
+	TInt upperArrowY = ( (rect.iBr.iY - rect.Height() / 2) - fontHeight / 2) - iUpperArrow->SizeInPixels().iHeight;
+	TInt upperArrowX = (rect.iBr.iX - rect.Width() / 2) - iUpperArrow->SizeInPixels().iWidth / 2;
+
+	TInt lowerArrowY = (rect.iBr.iY - rect.Height() / 2) + fontHeight / 2;
+
+	iUpperArrowPoint.SetXY( upperArrowX, upperArrowY - 2 );			
+	iLowerArrowPoint.SetXY( upperArrowX, lowerArrowY );
+	}
+
+EXPORT_C void CVeiTextDisplay::SetName( const TDesC& aName )
+	{
+	if ( iClipName )
+		{
+		delete iClipName;
+		iClipName = NULL;
+		}
+
+	TRAP_IGNORE(
+		iClipName = HBufC::NewL( aName.Length() );
+		*iClipName = aName );
+
+	DrawDeferred();
+	}
+
+
+EXPORT_C void CVeiTextDisplay::SetDuration( const TTimeIntervalMicroSeconds& aDuration )
+	{
+	iDuration = aDuration;
+	DrawDeferred();
+	}
+
+
+EXPORT_C void CVeiTextDisplay::SetTime( const TTime& aClipTime )
+	{
+	iClipTime = aClipTime;
+	}
+
+EXPORT_C void CVeiTextDisplay::SetLocation( const TDesC& aClipLocation )
+	{
+	if ( iClipLocation )
+		{
+		delete iClipLocation;
+		iClipLocation = NULL;
+		}
+
+	TRAP_IGNORE(
+		iClipLocation = HBufC::NewL( aClipLocation.Length() );
+		*iClipLocation = aClipLocation );
+
+	DrawDeferred();
+	}
+
+EXPORT_C void CVeiTextDisplay::SetLandscapeScreenOrientation( TBool aLandscapeScreenOrientation )
+	{
+	iLandscapeScreenOrientation = aLandscapeScreenOrientation;
+
+	DrawDeferred();
+	}
+
+EXPORT_C void CVeiTextDisplay::SetCutIn( const TTimeIntervalMicroSeconds& aCutInTime )
+									
+	{
+	iCutInTime = aCutInTime;
+	DrawDeferred();
+	}
+EXPORT_C void CVeiTextDisplay::SetCutOut(  const TTimeIntervalMicroSeconds& aCutOutTime )
+	{
+	iCutOutTime = aCutOutTime;
+	DrawDeferred();
+	}
+
+EXPORT_C void CVeiTextDisplay::SetLayout( TVeiLayout aLayout )
+	{
+	iLayout = aLayout;
+
+	if ( iBlinkTimer->IsActive() )
+		{
+		iBlinkTimer->Cancel();
+		}
+	iBlinkFlag = ETrue;
+
+	if ( iLayout == ERecordingPaused )
+		{
+		const TUint delay = 350000;
+		iBlinkTimer->Start( delay, delay, TCallBack( CVeiTextDisplay::UpdateBlinker, this ) );
+		}
+	DrawDeferred();
+	}
+
+TInt CVeiTextDisplay::UpdateBlinker( TAny* aThis )
+	{
+	STATIC_CAST( CVeiTextDisplay*, aThis )->DoUpdateBlinker();
+	return 1;
+	}
+
+void CVeiTextDisplay::DoUpdateBlinker()
+	{
+	if ( iBlinkFlag )
+		iBlinkFlag = EFalse;
+	else
+		iBlinkFlag = ETrue;
+
+	DrawDeferred();
+	}
+
+EXPORT_C void CVeiTextDisplay::SetUpperArrowVisibility(TBool aVisible)
+	{
+	iUpperArrowVisible = aVisible;
+	}
+
+EXPORT_C void CVeiTextDisplay::SetLowerArrowVisibility(TBool aVisible)
+	{
+	iLowerArrowVisible = aVisible;		
+	}
+
+EXPORT_C void CVeiTextDisplay::SetRightArrowVisibility(TBool aVisible)
+	{
+	iRightArrowVisible = aVisible;	
+	}
+
+EXPORT_C void CVeiTextDisplay::SetLeftArrowVisibility(TBool aVisible)
+	{
+	iLeftArrowVisible = aVisible;	
+	}
+
+EXPORT_C void CVeiTextDisplay::SetSlowMotionOn(TBool aOn)
+	{
+	iSlowMotionOn = aOn;
+	}
+
+EXPORT_C TBool CVeiTextDisplay::SlowMotionOn() const
+	{
+	return iSlowMotionOn;
+	}
+
+EXPORT_C void CVeiTextDisplay::SetSlowMotionPreset(TInt aPreset)
+	{
+	iPresetValue = aPreset;	
+	DrawDeferred();
+	}
+
+EXPORT_C TInt CVeiTextDisplay::SlowMotionPreset() const
+	{
+	return iPresetValue;	
+	}
+
+EXPORT_C void CVeiTextDisplay::SetArrowSize(const TSize& aArrowSize)
+	{
+	iDynamicArrowSize = aArrowSize;
+	}
+
+void CVeiTextDisplay::Draw( const TRect& /*aRect*/ ) const
+    {
+    CWindowGc& gc = SystemGc();
+	
+	const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+	TFileName visualText;
+	TPoint textPoint;
+	TPoint persentPoint;
+	TBuf<60> layoutTime;
+
+
+
+	// Get text color from skin
+	TRgb textColor( KRgbBlack );
+	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+	AknsUtils::GetCachedColor(skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
+	gc.SetPenColor( textColor );
+
+	if ( (iLayout == EOnlyName) && (iClipName && iClipName->Length() > 0) )
+		{
+		gc.UseFont( font );
+
+		TInt maxWidthNonClipping = Rect().Width() - 20;
+
+		AknBidiTextUtils::ConvertToVisualAndClip( *iClipName, 
+			visualText, *font, maxWidthNonClipping, maxWidthNonClipping + 10 );
+
+		TInt xOffset = ( Rect().Width() - font->TextWidthInPixels( visualText ) ) / 2;
+		if( (xOffset < 0) || iLandscapeScreenOrientation )
+			{
+			xOffset = 0;
+			}
+
+		textPoint.iX = Rect().iTl.iX + xOffset;
+
+		gc.DrawText( visualText, textPoint );
+	
+		gc.DiscardFont();
+		}
+	else if (((iLayout == ENameAndDuration) || (iLayout == ERecording) || 
+		(iLayout == ERecordingPaused)) && !iLandscapeScreenOrientation )
+		{
+		gc.UseFont( font );
+
+		TBuf<10> durationValue;
+
+		TInt maxWidthNonClipping = Rect().Width() - 20;
+
+		ParseTimeToMinSec( layoutTime, iDuration );
+		durationValue.Append( layoutTime);
+		
+		TFileName nameAndDuration;
+		if (iClipName)
+			{
+			nameAndDuration.Append( *iClipName );
+			}
+
+		TInt durationWidthValue = font->TextWidthInPixels(durationValue);
+		
+		AknBidiTextUtils::ConvertToVisualAndClip( nameAndDuration, visualText, *font, 
+			maxWidthNonClipping - durationWidthValue,
+			maxWidthNonClipping );
+		
+		LOGFMT(KVideoEditorLogFile, "CVeiTextDisplay::Draw: duration width: %d", durationWidthValue);
+
+
+		visualText.Append( _L(" ") );
+		visualText.Append( durationValue );
+
+		textPoint.iX = Rect().iTl.iX
+			+ ( Rect().Width() - font->TextWidthInPixels( visualText ) ) / 2;
+	
+		if ((iLayout == ERecording) || (iLayout == ERecordingPaused))
+			{
+			if ( iBlinkFlag )
+				gc.SetPenColor( KRgbRed );
+			else
+				{
+				gc.DiscardFont();
+				return;
+				}
+			}
+		gc.DrawText( visualText, textPoint );
+	
+		gc.DiscardFont();
+		}
+	else if (iLayout == ECutInCutOut)
+		{
+		gc.UseFont( font );
+
+		TBuf<40> cutInValue;
+		TBuf<40> cutOutValue;
+		TFileName visualText2;
+
+		ParseTimeToMinSec( layoutTime, iCutInTime );
+		cutInValue.Append( layoutTime );
+		ParseTimeToMinSec( layoutTime, iCutOutTime );
+		cutOutValue.Append( layoutTime );
+
+		AknBidiTextUtils::ConvertToVisualAndClip( cutInValue, visualText, *font, iStartTimeTextRect.Width(),
+			iStartTimeTextRect.Width());
+
+		AknBidiTextUtils::ConvertToVisualAndClip( cutOutValue, visualText2, *font, iEndTimeTextRect.Width(),
+			iEndTimeTextRect.Width() );
+
+		TInt cutInWidth = font->TextWidthInPixels( visualText );
+		TInt cutOutWidth = font->TextWidthInPixels( visualText2 );
+		TInt marginWidth( font->MaxCharWidthInPixels() /2 );
+
+		gc.DrawText( visualText, iStartTimeTextRect, font->AscentInPixels(), CGraphicsContext::ELeft, 0  );
+		gc.DrawText( visualText2, iEndTimeTextRect, font->AscentInPixels(), CGraphicsContext::ELeft, 0 );			
+		gc.DiscardFont();		
+
+		gc.BitBltMasked( iStartTimeIconRect.iTl, iStartMarkIcon, iStartTimeIconRect.Size(),
+						iStartMarkIconMask, EFalse);
+		gc.BitBltMasked( iEndTimeIconRect.iTl, iEndMarkIcon, iEndTimeIconRect.Size(),
+					iEndMarkIconMask, EFalse);									
+		
+		}
+	else if (((iLayout == ENameAndDuration ) ||(iLayout == EEverything) || (iLayout == ERecording) || 
+		(iLayout == ERecordingPaused)) && iLandscapeScreenOrientation )
+		{
+		gc.UseFont( font );
+		textPoint.iX = Rect().iTl.iX;
+
+		TBuf<24> dateFormatString;
+		TBuf<24> timeFormatString;
+		StringLoader::Load( dateFormatString, R_QTN_DATE_USUAL_WITH_ZERO, iEikonEnv ); 
+		StringLoader::Load( timeFormatString, R_QTN_TIME_LONG_WITH_ZERO, iEikonEnv );
+
+		TBuf<50> dateValue;
+		TBuf<40> timeValue;
+		TBuf<40> durationValue;
+
+		// these should not fail...
+		TRAPD(err1, iClipTime.FormatL( dateValue, dateFormatString ));
+		if (KErrNone != err1)
+			{
+			dateValue.Zero();
+			}
+		TRAP(err1, iClipTime.FormatL( timeValue, timeFormatString ));
+		if (KErrNone != err1)
+			{
+			timeValue.Zero();
+			}
+
+		ParseTimeToMinSec( layoutTime, iDuration );
+		durationValue.Append( layoutTime );
+
+		TBuf<64> durString; 
+		StringLoader::Load( durString, R_VEI_EDIT_VIDEO_DURATION, iEikonEnv );
+		durationValue.Insert( 0, durString );
+
+		TInt maxWidthNonClipping = Rect().Width() - 10;
+		/* name */
+		if (iClipName)
+			{
+			AknBidiTextUtils::ConvertToVisualAndClip( *iClipName, visualText, *font, 
+				maxWidthNonClipping, maxWidthNonClipping + 10 );
+
+			if ((iLayout == ERecording) || (iLayout == ERecordingPaused))
+				{
+				if ( iBlinkFlag )
+					{
+					gc.SetPenColor( KRgbRed );
+					gc.DrawText( visualText, textPoint );
+					}
+				}
+			else
+				{
+				gc.DrawText( visualText, textPoint );
+				}
+			gc.SetPenColor( textColor );
+			}
+
+		/* date */
+		AknBidiTextUtils::ConvertToVisualAndClip( dateValue, visualText, *font, 
+			maxWidthNonClipping, maxWidthNonClipping + 10 );
+
+		textPoint.iY += font->HeightInPixels() + 3;
+		gc.DrawText( visualText, textPoint );
+		/* time */
+		AknBidiTextUtils::ConvertToVisualAndClip( timeValue, visualText, *font, 
+			maxWidthNonClipping, maxWidthNonClipping + 10 );
+
+		textPoint.iY += font->HeightInPixels() + 3;
+		gc.DrawText( visualText, textPoint );
+		/* location */
+		if( iClipLocation && iClipLocation->Length() > 0 )
+			{
+			AknBidiTextUtils::ConvertToVisualAndClip( *iClipLocation, visualText, *font, 
+			maxWidthNonClipping, maxWidthNonClipping + 10 );
+
+			textPoint.iY += font->HeightInPixels() + 3;
+			gc.DrawText( visualText, textPoint );
+			}
+		/* duration */
+		AknBidiTextUtils::ConvertToVisualAndClip( durationValue, visualText, *font, 
+		maxWidthNonClipping, maxWidthNonClipping + 10 );
+
+		textPoint.iY += font->HeightInPixels() + 3;
+		gc.DrawText( visualText, textPoint );	
+
+		gc.DiscardFont();
+		}
+	else if ( iLayout == EArrowsVertical )
+		{
+		// ** Transition ** 	
+		gc.UseFont( font );
+	
+		TInt maxWidthNonClipping = Rect().Width()-20;
+
+		if (iClipName)
+			{
+			AknBidiTextUtils::ConvertToVisualAndClip( *iClipName, visualText, *font, maxWidthNonClipping,
+				maxWidthNonClipping+10);
+
+			TInt xOffset = ( Rect().Width() - font->TextWidthInPixels( visualText ) ) / 2;
+			if( xOffset < 0)
+				{
+				xOffset = 0;
+				}
+
+			textPoint.iX = Rect().iTl.iX + xOffset;
+			textPoint.iY = (Rect().iBr.iY - iLowerArrow->SizeInPixels().iHeight) - 2;
+
+			gc.DrawText( visualText, textPoint );	
+			gc.DiscardFont();
+			}
+
+		TPoint upperArrowPos( Rect().iTl );
+		if(iUpperArrowVisible)
+			{				
+			TRect upArrowIconSourceRect(0, 0, iUpperArrow->SizeInPixels().iWidth, 
+				iUpperArrow->SizeInPixels().iHeight);
+
+			gc.BitBltMasked( iUpperArrowPoint, iUpperArrow, upArrowIconSourceRect,
+					iUpperArrowMask, EFalse);
+
+			}
+			
+		if(iLowerArrowVisible)
+			{
+			TRect downArrowIconSourceRect(0, 0, iLowerArrow->SizeInPixels().iWidth, 
+				iLowerArrow->SizeInPixels().iHeight);
+
+			gc.BitBltMasked( iLowerArrowPoint, iLowerArrow, downArrowIconSourceRect,
+					iLowerArrowMask, EFalse);
+			}				
+		}
+
+	else if ( iLayout == EArrowsHorizontal )
+		{
+		// ** SlowMotion **
+		if(iSlowMotionOn)
+			{
+			gc.UseFont( font );		
+			visualText.Format( _L("%d"),iPresetValue );			
+
+			// *** % char added in asciicode format
+			visualText.Append(37);
+
+			textPoint.iY = Rect().iTl.iY;					
+			textPoint.iY = textPoint.iY + font->HeightInPixels();
+			TInt NumberWidthInPixels = font->TextWidthInPixels( visualText );
+
+			// TRect's middle point
+			textPoint.iX = Rect().iTl.iX + (Rect().iBr.iX - Rect().iTl.iX) / 2; 
+			textPoint.iX =  textPoint.iX - NumberWidthInPixels / 2;
+			gc.DrawText( visualText, textPoint );
+			gc.DiscardFont();
+			
+			if(iLeftArrowVisible)
+				{
+				TPoint leftArrowPos( Rect().iTl.iX, ( Rect().iBr.iY - Rect().Height() / 2 ) -
+					iLeftArrow->SizeInPixels().iHeight / 2 );		
+				
+				TRect leftArrowIconSourceRect(0, 0, iLeftArrow->SizeInPixels().iWidth, 
+				iLeftArrow->SizeInPixels().iHeight);
+
+				gc.BitBltMasked( leftArrowPos, iLeftArrow, leftArrowIconSourceRect,
+					iLeftArrowMask, EFalse);
+				}		
+		
+			if(iRightArrowVisible)
+				{
+				TPoint rightArrowPos( Rect().iBr.iX - iRightArrow->SizeInPixels().iWidth, 
+					( Rect().iBr.iY - Rect().Height() / 2 ) - iLeftArrow->SizeInPixels().iHeight / 2 );						
+								
+				TRect rightArrowIconSourceRect(0, 0, iRightArrow->SizeInPixels().iWidth, 
+				iRightArrow->SizeInPixels().iHeight);
+
+				gc.BitBltMasked( rightArrowPos, iRightArrow, rightArrowIconSourceRect,
+					iRightArrowMask, EFalse);
+				}	
+			}
+		else
+			{
+		// ** Trim for MMS **
+			TPoint rightArrowPos( Rect().iTl );
+			if(iRightArrowVisible)
+				{	
+				rightArrowPos.SetXY(  Rect().iBr.iX, Rect().iBr.iY - iRightArrow->SizeInPixels().iHeight );
+
+				TRect rightArrowIconSourceRect(0, 0, iRightArrow->SizeInPixels().iWidth, 
+				iRightArrow->SizeInPixels().iHeight);
+
+				gc.BitBltMasked( rightArrowPos, iRightArrow, rightArrowIconSourceRect,
+					iRightArrowMask, EFalse);
+				}
+			TPoint leftArrowPos( Rect().iTl);
+			if(iLeftArrowVisible)
+				{
+				leftArrowPos.SetXY( Rect().iTl.iX - iLeftArrow->SizeInPixels().iWidth,  rightArrowPos.iY ); 
+			
+				TRect leftArrowIconSourceRect(0, 0, iLeftArrow->SizeInPixels().iWidth, 
+				iLeftArrow->SizeInPixels().iHeight);
+
+				gc.BitBltMasked( leftArrowPos, iLeftArrow, leftArrowIconSourceRect,
+					iLeftArrowMask, EFalse);
+				}	
+
+			if (iClipName)
+				{
+				gc.UseFont( font );
+
+				persentPoint.iX = Rect().iTl.iX + Rect().Width() / 2;
+				persentPoint.iX = persentPoint.iX - (font->TextWidthInPixels( *iClipName ) ) / 2;
+
+				persentPoint.iY = rightArrowPos.iY + iLeftArrow->SizeInPixels().iHeight;
+				persentPoint.iY = persentPoint.iY;
+
+				TInt maxWidthNonClipping = Rect().Width() - 20;
+				AknBidiTextUtils::ConvertToVisualAndClip( *iClipName, visualText, *font, maxWidthNonClipping, maxWidthNonClipping + 20 );
+
+				gc.DrawText( visualText, persentPoint );	
+				gc.DiscardFont();
+				}
+			}
+		}						
+	}
+
+void CVeiTextDisplay::ParseTimeToMinSec( TDes& aLayoutTime, const TTimeIntervalMicroSeconds& aDuration ) const 
+	{
+	//minutes and seconds "120:13"
+	aLayoutTime.Zero();
+	TBuf<30> minsec;  
+	TInt64 duration = 0; 
+	TTimeIntervalMinutes minutes; 
+	TTimeIntervalMicroSeconds32 seconds; 
+	duration = ( aDuration.Int64() / 1000 ); 
+
+	TChar timeSeparator = TLocale().TimeSeparator(2);
+	//over 1 minute
+	if( duration >= 60000 ) 
+		{ 
+		minutes = TTimeIntervalMinutes (static_cast<TInt32>(duration) / 60000 ); 
+		minsec.AppendNum( minutes.Int() ); 
+		minsec.Append( timeSeparator ); 
+
+		duration = duration - TInt64(minutes.Int()) * TInt64(60000); 
+		}
+	else
+		{
+		minsec.Append( _L( "0" ) ); 
+		minsec.Append( timeSeparator ); 
+		}	
+	if( duration >= 1000 ) 
+		{ 
+		seconds = TTimeIntervalMicroSeconds32 (static_cast<TInt32>(duration) / 1000 ); 
+
+		if( seconds.Int() >= 60 ) 
+			{ 
+			minsec.AppendNum( seconds.Int() - 60 ); 
+			} 
+		else 
+			{ 
+			if ( seconds.Int() < 10 ) 
+				{ 
+				minsec.Append( _L("0") ); 
+				} 
+     
+			minsec.AppendNum( seconds.Int() ); 
+			} 
+		}
+	else 
+		{ 
+		minsec.Append( _L("00") ); 
+		} 
+	aLayoutTime.Append( minsec );
+
+	AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aLayoutTime );
+	}
+
+// ----------------------------------------------------------------------------
+// CVeiTextDisplay::SetComponentRect
+// 
+// ----------------------------------------------------------------------------
+//	
+EXPORT_C void CVeiTextDisplay::SetComponentRect(TTextDisplayComponent aComponentIndex, TRect aRect)
+	{
+    switch ( aComponentIndex )
+        {
+        case EStartTimeText:
+        	{
+       		iStartTimeTextRect = aRect;
+       		break;
+        	}
+        case EEndTimeText:
+        	{
+    		iEndTimeTextRect= aRect;
+    		break;    	
+        	}        	        
+        case EStartTimeIcon:
+        	{
+       		iStartTimeIconRect = aRect;
+       		break;
+        	}
+        case EEndTimeIcon:
+        	{
+    		iEndTimeIconRect= aRect;
+    		break;    	
+        	}
+        }
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/src/VeiTimeLabelNavi.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,395 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+//  INCLUDE FILES
+// System includes
+#include <coecntrl.h>
+#include <aknconsts.h>
+#include <aknvolumecontrol.h> 
+#include <akniconutils.h>
+#include <barsread.h>
+#include <aknsutils.h>
+#include <aknsconstants.h>
+#include <aknsdrawutils.h>
+#include <aknsitemdef.h>
+#include <VideoEditorUiComponents.mbg>
+#include <avkon.mbg>
+
+#ifdef RD_TACTILE_FEEDBACK 
+#include <touchfeedback.h>
+#endif /* RD_TACTILE_FEEDBACK  */
+
+// User includes
+#include "VeiTimeLabelNavi.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorUtils.h"
+#include "VideoEditorDebugUtils.h"
+#include "mtimelabelnaviobserver.h"
+
+// CONSTANTS
+_LIT(KDefaultLabel,""); // empty label text
+
+enum TVeiTimeLabelLayout
+    {
+    EArrayItem = 0,
+    ESpeakerItem,
+    EPausedItem
+    };
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CTimeLabelNavi::~CTimeLabelNavi()
+// Destructor
+// ---------------------------------------------------------
+//
+EXPORT_C CVeiTimeLabelNavi::~CVeiTimeLabelNavi()
+	{
+	DeleteBitmaps();
+	}
+
+void CVeiTimeLabelNavi::DeleteBitmaps()
+	{
+	delete iArrowBitmap;
+	iArrowBitmap = NULL;
+	
+    delete iArrowBitmapMask;
+    iArrowBitmapMask = NULL;	
+
+	delete iVolumeBitmap;
+	iVolumeBitmap = NULL;
+
+	delete iVolumeBitmapMask;
+	iVolumeBitmapMask = NULL;
+
+	delete iMutedBitmap;
+	iMutedBitmap = NULL;
+
+	delete iMutedBitmapMask;
+	iMutedBitmapMask = NULL;
+
+	delete iPausedBitmap;
+	iPausedBitmap = NULL;
+
+	delete iPausedBitmapMask;
+	iPausedBitmapMask = NULL;
+	}
+
+// ---------------------------------------------------------
+// CTimeLabelNavi::CTimeLabelNavi()
+// Constructor
+// ---------------------------------------------------------
+//
+CVeiTimeLabelNavi::CVeiTimeLabelNavi():
+iArrowVisible(ETrue),
+iVolumeIconVisible(ETrue),
+iPauseIconVisible(EFalse)
+	{
+    iLabel = KDefaultLabel;	
+	}
+
+// ---------------------------------------------------------
+// CTimeLabelNavi::ConstructL()
+// Constructor
+// ---------------------------------------------------------
+//
+void CVeiTimeLabelNavi::ConstructL()
+	{
+	LoadBitmapsL();
+	}
+
+void CVeiTimeLabelNavi::LoadBitmapsL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiTimeLabelNavi::LoadBitmapsL: in");
+
+	TFileName bitmapfile( VideoEditorUtils::IconFileNameAndPath(
+	        KVideoEditorUiComponentsIconFileId) );
+
+	//Loads a specific bitmap from a multi-bitmap file.
+	//const bitmapfile = the filename of the multi-bitmap (.mbm) file. 
+	MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+
+/* muted bitmap */
+	AknsUtils::CreateColorIconL(
+            skinInstance, KAknsIIDQgnIndiSpeakerMuted,KAknsIIDQsnIconColors,
+			EAknsCIQsnIconColorsCG6,
+            iMutedBitmap, iMutedBitmapMask,
+            AknIconUtils::AvkonIconFileName(),
+            EMbmAvkonQgn_indi_speaker_muted, 
+            EMbmAvkonQgn_indi_speaker_muted_mask,KRgbBlack);
+// Arrow bitmap
+	AknsUtils::CreateColorIconL(
+	            skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors,
+	            EAknsCIQsnIconColorsCG6,
+	            iArrowBitmap, iArrowBitmapMask,
+	            bitmapfile,
+	            EMbmVideoeditoruicomponentsQgn_indi_vded_volume_up_down, 
+	            EMbmVideoeditoruicomponentsQgn_indi_vded_volume_up_down_mask,
+	            KRgbBlack);
+	
+/* Speaker bitmap */
+	AknsUtils::CreateColorIconL(
+            skinInstance, KAknsIIDQgnIndiSpeaker,KAknsIIDQsnIconColors,
+			EAknsCIQsnIconColorsCG6,
+            iVolumeBitmap, iVolumeBitmapMask,
+            AknIconUtils::AvkonIconFileName(),
+            EMbmAvkonQgn_indi_speaker, EMbmAvkonQgn_indi_speaker_mask,
+            KRgbBlack);
+
+/* Pause bitmap */	
+// Pause bitmap in not used anywhere at the moment. There is not proper
+// icon to be used for it anyway in the platform. If needed in the future,
+// a new icon graphic need to be requested.
+/*    
+    AknsUtils::CreateColorIconL(
+            skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors,
+			EAknsCIQsnIconColorsCG6,
+            iPausedBitmap, iPausedBitmapMask,
+            bitmapfile,
+            EMbmVideoeditoruicomponentsQgn_prop_ve_pause, 
+            EMbmVideoeditoruicomponentsQgn_prop_ve_pause_mask,KRgbBlack);
+*/
+
+#ifdef RD_TACTILE_FEEDBACK 
+    iTouchFeedBack = MTouchFeedback::Instance();    
+#endif /* RD_TACTILE_FEEDBACK  */     
+
+	LOG(KVideoEditorLogFile, "CVeiTimeLabelNavi::LoadBitmapsL: out");
+	}
+
+
+// ---------------------------------------------------------
+// CTimeLabelNavi::NewL()
+// Symbian OS two-phase contruction
+// ---------------------------------------------------------
+//
+EXPORT_C CVeiTimeLabelNavi* CVeiTimeLabelNavi::NewL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiTimeLabelNavi::NewL: in");
+
+	CVeiTimeLabelNavi* self = CVeiTimeLabelNavi::NewLC();
+	CleanupStack::Pop( self );
+
+	LOG(KVideoEditorLogFile, "CVeiTimeLabelNavi::NewL: out");
+	return self;
+	}
+
+EXPORT_C CVeiTimeLabelNavi* CVeiTimeLabelNavi::NewLC()
+	{
+	LOG(KVideoEditorLogFile, "CVeiTimeLabelNavi::NewLC: in");
+
+	CVeiTimeLabelNavi* self = new(ELeave) CVeiTimeLabelNavi();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+
+	LOG(KVideoEditorLogFile, "CVeiTimeLabelNavi::NewLC: out");
+	return self;
+	}
+
+
+EXPORT_C void CVeiTimeLabelNavi::SetLabelL( const TDesC& aLabel )
+	{
+	#ifdef VERBOSE
+	LOGFMT(KVideoEditorLogFile, "CVeiTimeLabelNavi::SetLabelL: %S", &aLabel);
+	#endif
+
+	if (aLabel.Length() <= iLabel.MaxLength())
+		{
+		iLabel = aLabel;
+		}
+	ReportEventL(MCoeControlObserver::EEventStateChanged);
+	}
+
+EXPORT_C void CVeiTimeLabelNavi::SetLeftArrowVisibilityL(TBool aVisible)
+	{
+	iArrowVisible = aVisible;
+	ReportEventL(MCoeControlObserver::EEventStateChanged);	
+	}
+
+EXPORT_C void CVeiTimeLabelNavi::SetRightArrowVisibilityL(TBool aVisible)
+	{
+	iArrowVisible = aVisible;
+	ReportEventL(MCoeControlObserver::EEventStateChanged);	
+	}
+
+EXPORT_C void CVeiTimeLabelNavi::SetVolumeIconVisibilityL(TBool aVisible)
+	{
+	iVolumeIconVisible = aVisible;
+	ReportEventL(MCoeControlObserver::EEventStateChanged);	
+	}
+
+EXPORT_C void CVeiTimeLabelNavi::SetPauseIconVisibilityL(TBool aVisible)
+	{
+	iPauseIconVisible = aVisible;
+	ReportEventL(MCoeControlObserver::EEventStateChanged);	
+	}
+
+void CVeiTimeLabelNavi::SizeChanged()
+	{
+    TRect parentRect(Rect());
+	parentRect.iTl.iY+=2;
+	/*
+	const TRect &    aParent,  
+	TInt    C,  
+	TInt    l,  
+	TInt    t,  
+	TInt    r,  
+	TInt    b,  
+	TInt    W,  
+	TInt    H 
+
+	//C  colour index, 0..255  
+	//l  left margin  
+	//r  right margin  
+	//B  Baseline from top of the parent rectangle  
+	//W  text width in pixels  
+	//J  justification. ELayoutAlignNone; ELayoutAlignCenter; ELayoutAlignLeft; ELayoutAlignRight  
+*/
+
+	const CFont* myFont = AknLayoutUtils::FontFromId( ELatinBold19/*EAknLogicalFontSecondaryFont*/ );
+	TInt baseline = ( parentRect.Height() / 2 ) + ( myFont->AscentInPixels() / 2 );
+	TInt iconHeightWidth = parentRect.Height();
+		
+	TSize iconSize = TSize(STATIC_CAST(TInt,0.0649*parentRect.Width()), 
+		STATIC_CAST(TInt,0.5625*parentRect.Height() )); //14,18
+	
+	AknIconUtils::SetSize( 
+	    iArrowBitmap,  
+	    iconSize,
+	    EAspectRatioNotPreserved );
+	    
+	AknIconUtils::SetSize( 
+	    iPausedBitmap, 
+	    iconSize,
+	    EAspectRatioNotPreserved );
+	    
+	TInt arrowTop = ( parentRect.iBr.iY/2 - iconSize.iHeight/2 );
+
+	iBitmapLayout[EArrayItem].LayoutRect(parentRect, ELayoutEmpty, STATIC_CAST(TInt, 0.0926*parentRect.Width()), arrowTop, ELayoutEmpty, ELayoutEmpty,iconHeightWidth,iconSize.iHeight);
+	iBitmapLayout[ESpeakerItem].LayoutRect(parentRect, ELayoutEmpty, STATIC_CAST(TInt, 0.1625*parentRect.Width()), 0, ELayoutEmpty, ELayoutEmpty, iconHeightWidth, iconHeightWidth);
+	iBitmapLayout[EPausedItem].LayoutRect(parentRect, ELayoutEmpty, 0, 0, ELayoutEmpty, ELayoutEmpty, 17, 16);
+
+	TInt textLeftMargin = STATIC_CAST( TInt, 0.6045*parentRect.Width() );
+	TInt textRightMargin = STATIC_CAST( TInt, 0.9546*parentRect.Width() );
+
+	if( parentRect.iBr.iX != 108 )
+		{
+		iTextLayout.LayoutText(parentRect, ELatinBold19, 0, textLeftMargin, 0, 
+			baseline, textRightMargin-textLeftMargin, ELayoutAlignLeft);
+
+		}
+	else
+		{
+		arrowTop = STATIC_CAST( TInt, parentRect.iBr.iY/2 - 9/2 );
+		iBitmapLayout[EArrayItem].LayoutRect(parentRect, ELayoutEmpty, 14, arrowTop, ELayoutEmpty, ELayoutEmpty,iconHeightWidth,9);
+		iBitmapLayout[ESpeakerItem].LayoutRect(parentRect, ELayoutEmpty, 20, 0,		ELayoutEmpty, ELayoutEmpty,iconHeightWidth,iconHeightWidth);
+		iBitmapLayout[EPausedItem].LayoutRect(parentRect, ELayoutEmpty, 0,  0,		ELayoutEmpty, ELayoutEmpty,17,			   16);
+		
+		
+		textLeftMargin = STATIC_CAST( TInt, 0.7273*parentRect.Width()/2 +20);	
+		textRightMargin = STATIC_CAST( TInt, 0.9546*parentRect.Width()/2 +20);
+
+		iTextLayout.LayoutText(parentRect, ELatinBold19, 0, textLeftMargin, 0, 
+			baseline, textRightMargin-textLeftMargin, ELayoutAlignLeft);	
+		}
+
+
+	AknIconUtils::SetSize( iVolumeBitmap, TSize( iconHeightWidth, iconHeightWidth) );
+
+	AknIconUtils::SetSize( iMutedBitmap, TSize( iconHeightWidth, iconHeightWidth) );
+	}
+
+void CVeiTimeLabelNavi::Draw(const TRect& /*aRect*/) const
+	{
+	CWindowGc& gc=SystemGc();
+
+	if ( iVolumeIconVisible )
+		{
+		iBitmapLayout[ESpeakerItem].DrawImage( gc, iVolumeBitmap, iVolumeBitmapMask );
+
+		if ( iArrowVisible && !AknLayoutUtils::PenEnabled() )
+			{
+			iBitmapLayout[EArrayItem].DrawImage( gc, iArrowBitmap, iArrowBitmapMask );
+			}
+		}
+	else
+		{
+		iBitmapLayout[ESpeakerItem].DrawImage( gc, iMutedBitmap, iMutedBitmapMask );
+		}
+
+	if ( iPauseIconVisible )
+		{
+		// not in use at the moment, pause icon is drawed in main pane instead
+		//iBitmapLayout[EPausedItem].DrawImage( gc, iPausedBitmap, NULL );
+		}
+
+	TBuf<32> labelWithConvNumbers;
+	labelWithConvNumbers.Append( iLabel );
+	AknTextUtils::DisplayTextLanguageSpecificNumberConversion( labelWithConvNumbers );
+
+	MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+	//AknsDrawUtils::DrawCachedImage(skinInstance,gc,TRect(0,0,24,24),KAknsIIDQgnIndiSpeaker);
+
+	// Get navi pane text color from skin
+	TRgb textColor( KRgbBlack );
+	// Note: we are using the navi icon color for the text. There should
+	// be separate color definition for the text, but I could not find
+	// out what it is. Apparently KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG2
+	// is NOT the correct color. Someone should find out which color is used 
+	// for the label in CAknNavigationDecorator.
+	//AknsUtils::GetCachedColor(skinInstance, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG2 );
+	AknsUtils::GetCachedColor(skinInstance, textColor, KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG6 );
+
+    gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+	iTextLayout.DrawText(gc, labelWithConvNumbers, ETrue, textColor);
+	}
+
+void CVeiTimeLabelNavi::HandleResourceChange(TInt aType)
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiTimeLabelNavi::HandleResourceChange() In, aType:%d", aType);
+
+	if (KAknsMessageSkinChange == aType)
+		{
+		// Reload the icon bitmaps with the current skin color
+		DeleteBitmaps();
+		TRAP_IGNORE( LoadBitmapsL() );
+		}
+	CCoeControl::HandleResourceChange(aType);
+
+	LOG(KVideoEditorLogFile, "CVeiTimeLabelNavi::HandleResourceChange() Out");
+    }
+
+void CVeiTimeLabelNavi::HandlePointerEventL(const TPointerEvent& aPointerEvent)
+    {
+    if( iObserver && 
+        iBitmapLayout[ESpeakerItem].Rect().Contains( aPointerEvent.iPosition ) )
+        {
+#ifdef RD_TACTILE_FEEDBACK 
+		if ( iTouchFeedBack )
+        	{
+            iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic );
+        	}
+#endif /* RD_TACTILE_FEEDBACK  */			        	        
+
+        iObserver->HandleNaviEventL();
+        }
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoEditorUiComponents/src/VeiVideoDisplay.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1025 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// System includes
+#include <gulicon.h>
+#include <coemain.h>
+#include <eikenv.h>
+#include <akniconutils.h>
+#include <aknsdrawutils.h> 
+#include <aknsdatacontext.h> 
+#include <akniconutils.h>
+#include <aknbitmapanimation.h>
+#include <barsread.h>
+#include <VideoEditorUiComponents.mbg>
+#include <VideoEditorUiComponents.rsg>
+#include <audiopreference.h>
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include <ConeResLoader.h>
+#include <data_caging_path_literals.hrh>
+#include <mmf/common/mmfcontrollerframeworkbase.h> 
+#include <mmf/common/mmferrors.h>
+#ifdef VERBOSE
+#include <eikappui.h>
+#endif
+
+// User includes
+#include "VeiVideoEditorSettings.h"
+#include "VeiVideoDisplay.h"
+#include "VideoEditorCommon.h"
+#include "VideoEditorUtils.h"
+#include "VideoEditorDebugUtils.h"
+
+// CONSTANTS
+_LIT(KResourceFile, "VideoEditorUiComponents.rsc");
+
+EXPORT_C CVeiVideoDisplay* CVeiVideoDisplay::NewL( const TRect& aRect, const CCoeControl* aParent,
+										  MVeiVideoDisplayObserver& aObserver )
+    {
+    CVeiVideoDisplay* self = CVeiVideoDisplay::NewLC( aRect, aParent, aObserver );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+EXPORT_C CVeiVideoDisplay* CVeiVideoDisplay::NewLC( const TRect& aRect, const CCoeControl* aParent,
+										   MVeiVideoDisplayObserver& aObserver )
+    {
+    CVeiVideoDisplay* self = new (ELeave) CVeiVideoDisplay (aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect, aParent );
+    return self;
+    }
+
+CVeiVideoDisplay::CVeiVideoDisplay( MVeiVideoDisplayObserver& aObserver ) : iObserver (aObserver)
+	{
+	}	
+
+void CVeiVideoDisplay::ConstructL( const TRect& aRect, 
+                                   const CCoeControl* aParent)
+    {
+    LOG(KVideoEditorLogFile, "CVeiVideoDisplay::ConstructL: in");
+
+	TFileName mbmPath( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) );
+    
+    
+// Backgroud squares icon loading is disabled there is no suitable graphic in 
+// S60 build at the moment. A new graphic should be requested and added here.
+    
+//	AknIconUtils::CreateIconL( iBgSquaresBitmap, iBgSquaresBitmapMask,
+//			mbmPath, EMbmVideoeditoruicomponentsQgn_graf_ve_novideo, 
+//			EMbmVideoeditoruicomponentsQgn_graf_ve_novideo_mask );    
+    
+    
+	TRAP_IGNORE( CVeiVideoEditorSettings::GetMediaPlayerVolumeLevelL( iInternalVolume ) );
+
+	iMuted = (iInternalVolume == 0);
+
+	iBorderWidth = 2;
+	iDuration = 0;
+	iMaxVolume = 0;
+	iBlank = ETrue;
+	iAnimationOn = EFalse;
+	iBufferingCompleted = ETrue;
+	SetContainerWindowL( *aParent );
+
+	SetRect( aRect );
+    ActivateL();
+
+	ControlEnv()->AddForegroundObserverL( *this );
+
+    LOG(KVideoEditorLogFile, "CVeiVideoDisplay::ConstructL: out");
+    }
+
+void CVeiVideoDisplay::SizeChanged()
+    {
+	LOGFMT2(KVideoEditorLogFile, "CVeiVideoDisplay::SizeChanged: in: Size(): (%d,%d)", Size().iWidth, Size().iHeight);
+
+	if ( iVideoPlayerUtility )
+		{
+		TRect screenRect = CalculateVideoPlayerArea();
+		LOGFMT4(KVideoEditorLogFile, "CVeiVideoDisplay::SizeChanged 1, ScreenRect Tl:(%d,%d) Br:(%d,%d)", screenRect.iTl.iX,screenRect.iTl.iY,screenRect.iBr.iX,screenRect.iBr.iY);
+
+		/* Get the required parameters for the video player. */
+		CCoeEnv* coeEnv = CCoeEnv::Static();
+		RWsSession& session = coeEnv->WsSession();
+		CWsScreenDevice* screenDevice = coeEnv->ScreenDevice();
+		RDrawableWindow* drawableWindow = DrawableWindow();
+
+		TRAPD(err, iVideoPlayerUtility->SetDisplayWindowL( session, *screenDevice, *drawableWindow,
+			screenRect, screenRect ) );
+		if( KErrNone != err )
+			{
+			LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::SizeChanged: iVideoPlayerUtility->SetDisplayWindowL failed: %d", err);
+			iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EError );
+			}
+		}
+	AknIconUtils::SetSize( iBgSquaresBitmap, Size(), EAspectRatioNotPreserved );
+
+
+	if( iAnimationOn )
+		{
+		iAnimation->CancelAnimation();
+		TRect rect( Rect() );
+		rect.Move( iBorderWidth, iBorderWidth );
+		rect.Resize( -iBorderWidth*2, -iBorderWidth );
+
+		iAnimation->SetRect( rect );
+		TRAPD(err, iAnimation->StartAnimationL() );
+		if( KErrNone != err )
+			{
+			LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::SizeChanged: StartAnimationL failed: %d", err);
+			iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EError );
+			}
+		}
+
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::SizeChanged: out");
+	}
+
+TRect CVeiVideoDisplay::CalculateVideoPlayerArea()
+	{
+	/* Calculate regions. */ 
+	TRect screenRect;
+	TRect rect( Rect() );
+	/* In full screen mode return whole screen rect*/
+	if ( rect.iTl == TPoint( 0,0) )
+		{
+		return rect;
+		}
+	LOGFMT4(KVideoEditorLogFile, "CVeiVideoDisplay::CalculateVideoPlayerArea() 1: Rect() Tl:(%d,%d) Br:(%d,%d)", rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
+	
+	TPoint position = PositionRelativeToScreen();
+	LOGFMT2(KVideoEditorLogFile, "CVeiVideoDisplay::CalculateVideoPlayerArea() 2: PositionRelativeToScreen(%d,%d)", position.iX, position.iY);
+
+	screenRect = rect;  
+	screenRect.Move( TPoint( iBorderWidth, (position.iY-Rect().iTl.iY) + iBorderWidth ) ); 
+	screenRect.Resize( -(iBorderWidth*2), -(iBorderWidth*2 ));
+	return screenRect;
+	}
+
+TKeyResponse CVeiVideoDisplay::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
+	{
+	LOGFMT2(KVideoEditorLogFile, "CVeiVideoDisplay::OfferKeyEventL: aKeyEvent.iCode:%d, aType:%d", aKeyEvent.iCode, aType);
+
+	if ( iMuted )
+		{
+		LOG(KVideoEditorLogFile, "CVeiVideoDisplay::OfferKeyEventL: volume is muted.");
+		return EKeyWasNotConsumed;
+		}
+	
+	if ( aType == EEventKey )
+		{
+		switch (aKeyEvent.iCode)
+			{
+			case EKeyDownArrow:
+			case EStdKeyDecVolume:
+				{
+				AdjustVolumeL( -1 );
+				return EKeyWasConsumed;
+				}
+			case EKeyUpArrow:
+			case EStdKeyIncVolume:
+				{
+				AdjustVolumeL( 1 );
+				return EKeyWasConsumed;
+				}
+			default:
+				{
+				return EKeyWasConsumed;
+				}
+			}
+		}
+	return EKeyWasConsumed;
+	}
+
+EXPORT_C CVeiVideoDisplay::~CVeiVideoDisplay()
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::~CVeiVideoDisplay(): In");
+	// Remove foreground event observer
+	ControlEnv()->RemoveForegroundObserver( *this );
+	if ( iDisplayBitmap )
+		{
+		delete iDisplayBitmap;
+		iDisplayBitmap = NULL;
+		}
+	if ( iDisplayMask )
+		{
+		delete iDisplayMask;
+		iDisplayMask = NULL;
+		}
+	delete iBgSquaresBitmap;
+	delete iBgSquaresBitmapMask;
+
+	if ( iVideoPlayerUtility != NULL )
+		{
+		iVideoPlayerUtility->Close();
+		delete iVideoPlayerUtility;
+		iVideoPlayerUtility = NULL;
+		}
+	delete iAnimation;
+	delete iCallBack;
+	delete iFilename;
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::~CVeiVideoDisplay(): Out");
+	}
+
+EXPORT_C void CVeiVideoDisplay::ShowPictureL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask )
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::ShowPictureL: In");
+
+	StoreDisplayBitmapL( aBitmap, &aMask );
+
+	DrawDeferred();
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::ShowPictureL: Out");
+	}
+
+EXPORT_C void CVeiVideoDisplay::ShowPictureL( const CFbsBitmap& aBitmap )
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::ShowPicture2: In");
+
+	StoreDisplayBitmapL( aBitmap );
+
+	// set screen size to pause mode
+	if ( iVideoPlayerUtility )
+		{
+		TRect screenRect = TRect( TPoint(0,0), TPoint(0,0) );			
+		LOGFMT4(KVideoEditorLogFile, "CVeiVideoDisplay::SizeChanged 1, ScreenRect Tl:(%d,%d) Br:(%d,%d)", screenRect.iTl.iX,screenRect.iTl.iY,screenRect.iBr.iX,screenRect.iBr.iY);
+
+		/* Get the required parameters for the video player. */
+		CCoeEnv* coeEnv = CCoeEnv::Static();
+		RWsSession& session = coeEnv->WsSession();
+		CWsScreenDevice* screenDevice = coeEnv->ScreenDevice();
+		RDrawableWindow* drawableWindow = DrawableWindow();
+
+		iVideoPlayerUtility->SetDisplayWindowL( session, *screenDevice, *drawableWindow,
+			screenRect, screenRect );
+		}
+
+	DrawDeferred();
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::ShowPicture2: Out");
+	}
+
+EXPORT_C void CVeiVideoDisplay::SetPictureL( const CFbsBitmap& aBitmap )
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::SetPictureL: In");
+
+	StoreDisplayBitmapL( aBitmap );
+
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::SetPictureL: Out");	
+	}
+
+void CVeiVideoDisplay::StoreDisplayBitmapL( const CFbsBitmap& aBitmap, const CFbsBitmap* aMask )
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::StoreDisplayBitmapL: In");
+
+	iBlank = EFalse;
+	iBlack = EFalse;
+
+	// Delete old bitmaps
+	if ( iDisplayBitmap )
+		{
+		delete iDisplayBitmap;
+		iDisplayBitmap = NULL;
+		}
+	if ( iDisplayMask )
+		{
+		delete iDisplayMask;
+		iDisplayMask = NULL;
+		}
+
+	// Create new bitmaps
+	iDisplayBitmap = new (ELeave) CFbsBitmap;
+	iDisplayBitmap->Duplicate( aBitmap.Handle() );
+	if (aMask)
+		{
+		iDisplayMask = new (ELeave) CFbsBitmap;
+		iDisplayMask->Duplicate( aMask->Handle() );
+		}
+
+#ifdef VERBOSE
+	// Write the display bitmap to disk
+	_LIT(KFileName, "C:\\data\\images\\videoeditor\\iDisplayBitmap.mbm");
+	TFileName saveToFile( KFileName );
+	CEikonEnv* env = CEikonEnv::Static();
+	env->EikAppUi()->Application()->GenerateFileName( env->FsSession(), saveToFile );
+	User::LeaveIfError( iDisplayBitmap->Save( saveToFile ) );
+	LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::StoreDisplayBitmapL: saved %S", &saveToFile);
+#endif
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::StoreDisplayBitmapL: Out");
+	}
+
+EXPORT_C void CVeiVideoDisplay::ShowBlackScreen()
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::ShowBlackScreen: In");	
+	iBlack = ETrue;
+	DrawDeferred();
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::ShowBlackScreen: Out");	
+	}
+EXPORT_C void CVeiVideoDisplay::SetBlackScreen( TBool aBlack )
+    {
+    LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::SetBlackScreen: In and out, aBlack:%d", aBlack);	
+    iBlack = aBlack;
+    }
+EXPORT_C void CVeiVideoDisplay::ShowBlankScreen()
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::ShowBlankScreen: In and out");	
+	iBlank = ETrue;
+	DrawDeferred();
+	}
+
+EXPORT_C TTimeIntervalMicroSeconds CVeiVideoDisplay::PositionL() const
+	{
+	if ( !iVideoPlayerUtility )
+		return TTimeIntervalMicroSeconds(0);
+	else
+		return iVideoPlayerUtility->PositionL();
+	}
+
+EXPORT_C TVideoRotation CVeiVideoDisplay::RotationL() const
+    {
+    if ( iVideoPlayerUtility )
+    	{
+        return iVideoPlayerUtility->RotationL();
+    	}
+    else
+    	{
+        return EVideoRotationNone;
+    	}
+    }
+
+EXPORT_C void CVeiVideoDisplay::SetPositionL( const TTimeIntervalMicroSeconds& aPosition )
+	{
+	LOGFMT(KVideoEditorLogFile, "VideoDisplay SetPositionL: %Ld", aPosition.Int64());
+	iStartPoint = aPosition;
+	if ( iVideoPlayerUtility && iBufferingCompleted )
+		{	
+		iVideoPlayerUtility->SetPositionL( iStartPoint );
+		}
+	}
+
+EXPORT_C void CVeiVideoDisplay::SetRotationL(TVideoRotation aRotation)
+    {
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::SetRotationL: in");
+    if ( iVideoPlayerUtility )
+		{
+		iVideoPlayerUtility->SetRotationL( aRotation );
+		}
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::SetRotationL: out");
+    }
+
+
+EXPORT_C void CVeiVideoDisplay::Stop( TBool aCloseStream )
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Stop: in");	
+	if ( iVideoPlayerUtility )
+		{
+		// this is poor solution, responsibility of taking care of iStartPoint be elsewhere
+		TRAP_IGNORE(iStartPoint = PositionL());
+		iVideoPlayerUtility->Stop();
+	
+		if ( aCloseStream )
+			{
+			LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Stop 1, Close CVideoPlayerUtility.");
+			iVideoPlayerUtility->Close(); 
+			delete iVideoPlayerUtility;
+			iVideoPlayerUtility = NULL;
+			}
+		}
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Stop 2");
+	iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EStop );
+
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Stop: out");
+	}
+
+EXPORT_C TInt CVeiVideoDisplay::GetBorderWidth() const
+	{
+	return iBorderWidth;
+	}
+
+EXPORT_C TSize CVeiVideoDisplay::GetScreenSize() const
+	{
+	TRect rect( Rect() );
+	rect.Shrink( iBorderWidth, iBorderWidth-1 );
+	return rect.Size();
+	}
+
+EXPORT_C void CVeiVideoDisplay::Play()
+	{
+	/*LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Play :in");
+	if (iVideoPlayerUtility &&  iBufferingCompleted )
+		{	
+		LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Play :2");
+		//SizeChanged();
+		iVideoPlayerUtility->Play();
+		}
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Play: out");
+	*/
+	PlayL(*iFilename);
+	}
+
+EXPORT_C void CVeiVideoDisplay::PlayMarkedL( const TTimeIntervalMicroSeconds& aStartPoint, const TTimeIntervalMicroSeconds& aEndPoint)
+	{
+	/*
+	LOGFMT2(KVideoEditorLogFile, "CVeiVideoDisplay::PlayMarked:In, aStartPoint:%Ld, aEndPoint:%Ld", aStartPoint.Int64(), aEndPoint.Int64());
+	iVideoPlayerUtility->SetPositionL(aStartPoint);
+	//SizeChanged();
+	iVideoPlayerUtility->Play(aStartPoint, aEndPoint);
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::PlayMarked :Out");
+	*/
+	PlayL(*iFilename, aStartPoint, aEndPoint);
+	}
+
+EXPORT_C void CVeiVideoDisplay::PlayL( 	const TDesC& aFilename,
+								const TTimeIntervalMicroSeconds& aStartPoint, 
+								const TTimeIntervalMicroSeconds& aEndPoint )
+	{
+	LOGFMT3(KVideoEditorLogFile, "CVeiVideoDisplay::PlayL(): In, aFilename:%S, aStartPoint:%Ld, aEndPoint:%Ld", &aFilename, aStartPoint.Int64(), aEndPoint.Int64());
+		
+	if ( iVideoPlayerUtility && iBufferingCompleted)
+		{
+		LOG(KVideoEditorLogFile, "CVeiVideoDisplay::PlayL 1");
+		if ( aEndPoint.Int64() != 0 )
+			{
+			LOGFMT2(KVideoEditorLogFile, "CVeiVideoDisplay::Play 2, iStartPoint:%Ld, aStartPoint:%Ld", iStartPoint.Int64(), aStartPoint.Int64());	
+			iStartPoint = aStartPoint;
+			//iVideoPlayerUtility->SetPositionL(iStartPoint);
+			//SizeChanged();
+			iVideoPlayerUtility->Stop();
+			iVideoPlayerUtility->Play( aStartPoint, aEndPoint );
+			}
+		else
+			{
+			LOG(KVideoEditorLogFile, "CVeiVideoDisplay::PlayL 3");	
+			//SizeChanged();
+			//iVideoPlayerUtility->Play(iStartPoint, iVideoPlayerUtility->DurationL());
+			iVideoPlayerUtility->Play();
+			}
+		}
+	else if (!iVideoPlayerUtility && iBufferingCompleted) /* should this be: if (! iVideoPlayerUtility)*/
+		{		
+		LOG(KVideoEditorLogFile, "CVeiVideoDisplay::PlayL 4");
+		if ( aEndPoint.Int64() != 0 )
+			{
+			iStartPoint = aStartPoint;
+			iEndPoint = aEndPoint;	
+			}	
+		OpenFileL( aFilename );
+		}
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::PlayL(): out");
+	}
+
+EXPORT_C void CVeiVideoDisplay::PauseL()
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::PauseL(): in");
+	if ( iVideoPlayerUtility && iBufferingCompleted )
+		{
+		LOG(KVideoEditorLogFile, "CVeiVideoDisplay::PauseL 1, calling pause");
+		iVideoPlayerUtility->PauseL();
+		
+		/*						
+		//@: for some reason this does not work 
+		TDisplayMode dmode = EColor64K;		
+		iVideoPlayerUtility->GetFrameL(dmode, ContentAccess::EPlay);
+		*/
+		
+		/*
+		//@: do not work either:
+		LOG(KVideoEditorLogFile, "CVeiVideoDisplay::PauseL(): 2, refreshing");
+		TInt err = KErrNone;
+		TRAP(err, iVideoPlayerUtility->RefreshFrameL());
+		LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::PauseL(): 3, err:%d", err);
+		*/
+		}
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::PauseL(): out");
+	}
+
+EXPORT_C void CVeiVideoDisplay::OpenFileL( const TDesC& aFilename )
+    {
+	LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::OpenFileL: In, aFilename:%S", &aFilename);		
+
+	/* Calculate regions. */ 
+    TRect screenRect = CalculateVideoPlayerArea();
+
+	/* Get the required parameters for the video player. */
+	CCoeEnv* coeEnv = CCoeEnv::Static();
+	RWsSession& session = coeEnv->WsSession();
+	CWsScreenDevice* screenDevice = coeEnv->ScreenDevice();
+	RDrawableWindow* drawableWindow = DrawableWindow();
+
+	if ( iVideoPlayerUtility != NULL )
+		{
+		delete iVideoPlayerUtility;
+		iVideoPlayerUtility = NULL;		
+		}
+		
+	if (!iFilename)
+		{	
+		iNewFile = ETrue;
+		iDuration = TTimeIntervalMicroSeconds(0);
+		iFilename = aFilename.AllocL();		
+		}	
+	else if ((*iFilename).CompareF(aFilename))
+		{
+		iNewFile = ETrue;
+		iDuration = TTimeIntervalMicroSeconds(0);
+		HBufC* temp = aFilename.AllocL();
+		delete iFilename;
+		iFilename = temp;
+		}
+
+	/* Initialize the video player. */
+	iVideoPlayerUtility = CVideoPlayerUtility::NewL( *this, 
+	static_cast<enum TMdaPriority>(KAudioPriorityRealOnePlayer),
+	static_cast<enum TMdaPriorityPreference>(KAudioPrefRealOneLocalPlayback),
+	session, *screenDevice, *drawableWindow, screenRect, screenRect );
+
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::OpenFileL 2");
+	iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::ELoadingStarted );
+	iVideoPlayerUtility->RegisterForVideoLoadingNotification( *this );
+	/* Open the file. */	
+	iVideoPlayerUtility->OpenFileL( *iFilename );
+
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::OpenFileL: Out");
+    }
+// ---------------------------------------------------------
+// CVeiPreviewContainer::MvpuoFrameReady( CFbsBitmap& aFrame, TInt aError )
+// Notification to the client that the frame requested by a call to GetFrameL is ready.
+// ---------------------------------------------------------
+void CVeiVideoDisplay::MvpuoFrameReady( CFbsBitmap& /*aFrame*/, TInt DEBUGLOG_ARG(aError) )
+	{	
+	LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::MvpuoFrameReady: In and Out, aError:%d", aError);
+	/*
+	@: for some reason this does not work 
+	if (KErrNone == aError)
+		{
+		SetPictureL(aFrame);		
+		}
+	DrawDeferred();
+	*/			
+	}
+
+// ---------------------------------------------------------
+// CVeiVideoDisplay::MvpuoOpenComplete( TInt aError )
+// Notification to the client that the opening of the video clip has completed.
+// ---------------------------------------------------------
+void CVeiVideoDisplay::MvpuoOpenComplete( TInt aError )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::MvpuoOpenComplete: In, aError:%d", aError);
+	if( aError != KErrNone )
+		{
+		iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EError );
+		return;
+		}
+	
+	iVideoPlayerUtility->Prepare();
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::MvpuoOpenComplete: Out");
+	}
+
+// ---------------------------------------------------------
+// CVeiVideoDisplay::MvpuoPlayComplete( TInt aError )
+// Notification that video playback has completed.
+// ---------------------------------------------------------
+void CVeiVideoDisplay::MvpuoPlayComplete( TInt aError )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::MvpuoPlayComplete:In, aError:%d", aError);
+	iStartPoint = TTimeIntervalMicroSeconds(0);
+	/* iBufferingCompleted is set to EFalse in MvloLoadingStarted and set back ETrue in 
+	   MvloLoadingCompleted.
+	   If error occurs in the middle of the loading process the latter one is not called and 
+	   iBufferingCompleted is left to EFalse, that is why is it set to ETrue here also for safety's sake
+	*/   
+	iBufferingCompleted = ETrue;
+	iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EPlayComplete, aError );			
+	
+	// Stop() better to be called from iObserver 
+	/*if ( KErrSessionClosed == aError ) // -45 (10/2006)
+		{		
+		Stop( ETrue );
+		}	
+		*/
+
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::MvpuoPlayComplete: Out");
+	}
+
+// ---------------------------------------------------------
+// CVeiPreviewContainer::MvpuoEvent( const TMMFEvent& /*aEvent*/ )
+// 
+// ---------------------------------------------------------
+void CVeiVideoDisplay::MvpuoEvent( const TMMFEvent& aEvent )
+	{	
+	LOGFMT2(KVideoEditorLogFile, "CVeiVideoDisplay::MvpuoEvent In, aEvent.iEventType:%d, aEvent.iErrorCode:%d",
+		aEvent.iEventType.iUid, aEvent.iErrorCode);			
+	
+	if (KMMFEventCategoryVideoPlayerGeneralError == aEvent.iEventType  &&
+		KErrMMAudioDevice == aEvent.iErrorCode)
+		{
+		iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EError, aEvent.iErrorCode );	
+		}
+	
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::MvpuoEvent, Out");	
+	}
+
+// ---------------------------------------------------------
+// CVeiVideoDisplay::MvpuoPrepareComplete( TInt aError )
+// Notification to the client that the opening of the video clip has been prepared.
+// ---------------------------------------------------------
+void CVeiVideoDisplay::MvpuoPrepareComplete( TInt aError )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::MvpuoPrepareComplete:In, aError:%d",aError);
+		
+	//LocateEntryL();
+	if( KErrNone != aError )
+		{		
+		iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EError, aError );
+		return;
+		}
+
+	SetPlaybackVolumeL();
+ 
+	SetPositionL(iStartPoint);
+	iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EOpenComplete, iStartPoint.Int64() );
+/** If volume is 0(muted) give event so muted icon is drawn to navipane */
+	if ( iInternalVolume == 0 )
+		{
+		LOG(KVideoEditorLogFile, "CVeiVideoDisplay::MvpuoPrepareComplete 1");
+		iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EVolumeLevelChanged);
+		}
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::MvpuoPrepareComplete: Out");	
+	}
+	
+
+void CVeiVideoDisplay::LocateEntryL()
+	{
+	TInt metaDataCount = iVideoPlayerUtility->NumberOfMetaDataEntriesL();
+	CMMFMetaDataEntry* entry = NULL;
+	// Loop through metadata
+	for ( TInt i = 0; i < metaDataCount; i++ )
+		{
+		entry =	iVideoPlayerUtility->MetaDataEntryL( i );		
+		HBufC* name = entry->Name().AllocLC();
+		HBufC* value = entry->Value().AllocLC();
+		LOGFMT3(KVideoEditorLogFile, "CVeiVideoDisplay::LocateEntryL, i:%d, name,value:%S,%S", i, name, value);
+		CleanupStack::PopAndDestroy( value );
+		CleanupStack::PopAndDestroy( name );
+		}		
+	}
+
+void CVeiVideoDisplay::MvloLoadingStarted()
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::MvloLoadingStarted, In");
+	iBufferingCompleted = EFalse;
+	iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EBufferingStarted );
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::MvloLoadingStarted, Out");
+	}
+
+void CVeiVideoDisplay::MvloLoadingComplete()
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::MvloLoadingComplete, In, iStartPoint:%Ld", iStartPoint.Int64());
+	iBufferingCompleted = ETrue;			
+	iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::ELoadingComplete, iStartPoint.Int64() );
+	// set screen size to play mode
+	SizeChanged();	
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::MvloLoadingComplete, Out");
+	}
+
+void CVeiVideoDisplay::Draw( const TRect& aRect ) const
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Draw in");
+    CWindowGc& gc = SystemGc();
+
+	TRect rect( Rect() );
+
+	rect.Move(iBorderWidth,iBorderWidth);
+	rect.Resize(-iBorderWidth*2,-iBorderWidth*2);
+	TSize clipRect( rect.Size() );
+
+    if ( Window().DisplayMode() == EColor16MA )
+        {
+        gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+        gc.SetBrushColor(TRgb::Color16MA( 0 ));
+        gc.Clear(aRect);
+        }
+	
+   	if ( iBlack )
+   		{        
+/*   		
+   		LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Draw 1");
+        gc.SetPenStyle( CWindowGc::ENullPen );
+		gc.SetBrushColor( KRgbBlack );
+		gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+		gc.DrawRect( rect );
+
+        gc.SetPenStyle( CWindowGc::ESolidPen );
+        gc.SetPenSize( TSize(iBorderWidth,iBorderWidth) );
+	
+	    gc.DrawRoundRect(aRect, TSize(4,4));
+*/ 
+		return;
+        }
+	
+	if ( iBlank )
+		{
+		LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Draw 2");
+		gc.BitBltMasked( rect.iTl, iBgSquaresBitmap, clipRect, iBgSquaresBitmapMask, EFalse);
+		}
+	else
+		{		
+		LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Draw 3");
+
+		if ( iDisplayBitmap->SizeInPixels() == GetScreenSize() )
+			{						
+
+			gc.BitBlt( rect.iTl, iDisplayBitmap, clipRect);
+			}
+		else
+			{						
+
+			TSize clipRectSize = iDisplayBitmap->SizeInPixels();                 
+            TRect destRect;
+            
+            // check which one has bigger aspect ratio, video diplay or thumbnail.
+            TReal displayAR = rect.Width() / TReal(rect.Height());
+            TReal thumbnailAR = clipRectSize.iWidth / TReal(clipRectSize.iHeight);
+            
+            if (thumbnailAR > displayAR)
+                {
+                //Create proper destination rect                                    
+                TInt newHeight = (clipRectSize.iHeight * rect.Width() ) / clipRectSize.iWidth;
+                TInt newTLiY = rect.iTl.iY + (rect.Height() - newHeight) / 2;
+                destRect = TRect(TPoint(rect.iTl.iX,newTLiY), TSize(rect.Width(), newHeight));
+                }
+            else
+                {
+                // write here destrect calculation when thumbnailAR < displayAR
+                TInt newWidth = rect.Height()*thumbnailAR;
+                TInt newTLiX = rect.iTl.iX + ((rect.Width()-newWidth)/2);
+                destRect = TRect (TPoint(newTLiX, rect.iTl.iY), TSize(newWidth, rect.Height()));
+                }
+		   gc.DrawBitmap( destRect, iDisplayBitmap );
+			}
+		}
+
+/*
+	gc.SetPenStyle( CWindowGc::ESolidPen );
+	gc.SetPenSize( TSize(iBorderWidth,iBorderWidth) );
+	
+	rect = Rect();
+	rect.Resize(-(iBorderWidth-1),-(iBorderWidth-1));
+	gc.DrawRoundRect( rect, TSize(4,4));
+*/	
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::Draw out");
+	}
+
+
+EXPORT_C TTimeIntervalMicroSeconds CVeiVideoDisplay::TotalLengthL()
+	{
+	if ( !iVideoPlayerUtility )
+		{
+		return iDuration;	
+		//return TTimeIntervalMicroSeconds(0);
+		}
+	else
+		{
+		TRAPD( err, iDuration =iVideoPlayerUtility->DurationL() );
+		if ( err == KErrNone )
+			{
+			return iDuration;
+			}
+		else
+			{
+			return TTimeIntervalMicroSeconds(0);
+			}
+		}
+	}
+
+EXPORT_C void CVeiVideoDisplay::AdjustVolumeL( TInt aIncrement )
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::AdjustVolumeL( %d ): in", aIncrement);
+
+	iInternalVolume += aIncrement;
+
+	if ( iInternalVolume < 0 )
+		{
+		iInternalVolume = 0;
+		}
+	if ( iInternalVolume > KMaxVolumeLevel )
+		{
+		iInternalVolume = KMaxVolumeLevel;
+		}
+
+	SetPlaybackVolumeL();
+	iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EVolumeLevelChanged );
+
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::SetVolumeL(): out");
+	}
+
+void CVeiVideoDisplay::SetPlaybackVolumeL()
+	{
+	LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::SetPlaybackVolumeL(): in: iInternalVolume: %d", iInternalVolume);
+
+	if ( iVideoPlayerUtility )
+		{
+		// Convert the internal volume to CVideoPlayerUtility's scale.
+		iMaxVolume = iVideoPlayerUtility->MaxVolume();
+
+		TInt vol = iMaxVolume * iInternalVolume / KMaxVolumeLevel;
+		iVideoPlayerUtility->SetVolumeL( vol );
+		}
+
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::SetPlaybackVolumeL(): out");
+	}
+
+EXPORT_C void CVeiVideoDisplay::ShowAnimationL( TInt aResourceId, TInt aFrameIntervalInMilliSeconds )
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::ShowAnimationL: in");
+
+	iAnimationResourceId = aResourceId;
+
+	if ( iAnimation )
+		{
+		delete iAnimation;
+		iAnimation = 0;
+		}
+	/* In slowmotion video thumbnail is shown */
+	if ( aResourceId != R_VEI_SLOW_MOTION_ANIMATION )
+		{
+		iBlack = ETrue;
+		DrawNow();
+		iBlack = EFalse;
+		}
+	else
+		{
+		DrawNow();
+		}
+
+	// Locate and open the resource file
+    TFileName fileName;
+    TParse p;    
+
+    Dll::FileName(fileName);
+    p.Set(KResourceFile, &KDC_RESOURCE_FILES_DIR, &fileName);
+    fileName = p.FullName();
+
+    LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::ShowAnimationL: Loading resource file: %S", &fileName);
+    RConeResourceLoader coneResLoader (*iCoeEnv);
+	coneResLoader.OpenL( fileName ); // RConeResourceLoader selects the correct language file
+	CleanupClosePushL( coneResLoader );
+
+	// Create animation from resource
+	iAnimation = CAknBitmapAnimation::NewL();
+
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC( reader, aResourceId );
+	iAnimation->ConstructFromResourceL( reader );
+	TRect rect( Rect() );
+	rect.Move( iBorderWidth, iBorderWidth );
+	rect.Resize( -iBorderWidth*2, -iBorderWidth );
+	iAnimation->SetRect( rect );
+	iAnimation->SetContainerWindowL( *this );
+	iAnimationOn = ETrue;
+	iAnimation->StartAnimationL();
+	CleanupStack::PopAndDestroy(); //reader
+	CBitmapAnimClientData* animClientData = iAnimation->BitmapAnimData();
+	iAnimationFrameIntervalInMilliSeconds = animClientData->FrameIntervalInMilliSeconds();
+	
+	CleanupStack::PopAndDestroy(); // coneResLoader
+
+	if ( aFrameIntervalInMilliSeconds > 0 )
+		{
+		SetFrameIntervalL( aFrameIntervalInMilliSeconds );
+		}
+	DrawDeferred();
+
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::ShowAnimationL: out");
+	}
+
+EXPORT_C void CVeiVideoDisplay::StopAnimation()
+	{
+	if ( iAnimationOn )
+		{
+		iAnimation->CancelAnimation();
+		}
+	iAnimationOn = EFalse;
+	DrawDeferred();
+	}
+
+EXPORT_C void CVeiVideoDisplay::SetFrameIntervalL(TInt aFrameIntervalInMilliSeconds)
+	{
+	iAnimationFrameIntervalInMilliSeconds+=aFrameIntervalInMilliSeconds;
+	iAnimation->SetFrameIntervalL( iAnimationFrameIntervalInMilliSeconds );
+	}
+
+void CVeiVideoDisplay::HandleResourceChange(TInt aType)
+	{
+	if( (aType == KEikMessageFadeAllWindows) && iAnimationOn )
+		{
+		iAnimation->CancelAnimation();
+		}
+	else if( (aType == KEikMessageUnfadeWindows) && iAnimationOn )
+		{
+		TRAPD(err, iAnimation->StartAnimationL() );
+		if( KErrNone != err )
+			{
+			LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::HandleResourceChange: StartAnimationL failed: %d", err);
+			iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EError );
+			}
+		}
+	}
+
+EXPORT_C TInt CVeiVideoDisplay::Volume() const
+	{
+	return iInternalVolume;
+	}
+	
+EXPORT_C void CVeiVideoDisplay::SetMuteL( TBool aMuted )
+	{
+	iMuted = aMuted;	
+	}
+
+//=======================================================================================================
+void CVeiVideoDisplay::HandleLosingForeground()
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::HandleLosingForeground(): In");
+
+	if( iAnimationOn )
+		{
+		LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::HandleLosingForeground(): stopping animation. iAnimationFrameIntervalInMilliSeconds == %d", iAnimationFrameIntervalInMilliSeconds);
+
+		// Delete the animation when going to backgroung. This should not be necessary, there are some
+		// platforms where the bitmap animation works incorrectly when swithching back (see EFLI-6VL4JS)
+		iStoredAnimationFrameIntervalInMilliSeconds = iAnimationFrameIntervalInMilliSeconds;
+		delete iAnimation;
+		iAnimation = NULL;
+		}
+
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::HandleLosingForeground(): Out");
+	}
+
+//=======================================================================================================
+void CVeiVideoDisplay::HandleGainingForeground()
+	{
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::HandleGainingForeground(): In");
+
+	if( iAnimationOn )
+		{
+		TRAPD(err, ShowAnimationL( iAnimationResourceId, 0 ));
+		if( KErrNone == err )
+			{
+			// restore the animation speed
+			LOGFMT2(KVideoEditorLogFile, "CVeiVideoDisplay::HandleLosingForeground(): animation started. next restoring speed to %d (now it is %d)", iStoredAnimationFrameIntervalInMilliSeconds, iAnimationFrameIntervalInMilliSeconds);
+			iAnimationFrameIntervalInMilliSeconds = iStoredAnimationFrameIntervalInMilliSeconds;
+			// set the animation's frame interval via callback. if set directly after starting the
+			// animation, the rate change does not take effect on screen.
+			SetAnimationFrameIntervalCallbackL();
+			}
+		else
+			{
+			LOGFMT(KVideoEditorLogFile, "CVeiVideoDisplay::SizeChanged: HandleGainingForeground failed: %d", err);
+			iObserver.NotifyVideoDisplayEvent( MVeiVideoDisplayObserver::EError );
+			}
+		}
+
+	LOG(KVideoEditorLogFile, "CVeiVideoDisplay::HandleGainingForeground: Out");
+	}
+
+//=======================================================================================================
+void CVeiVideoDisplay::SetAnimationFrameIntervalCallbackL()
+	{
+	LOG( KVideoEditorLogFile, "CVeiVideoDisplay::DoSetAnimationFrameIntervalL: in");
+
+	if (! iCallBack)
+		{		
+		TCallBack cb (CVeiVideoDisplay::SetAnimationFrameIntervalCallbackMethod, this);
+		iCallBack = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityLow);
+		}
+	iCallBack->CallBack();
+
+	LOG( KVideoEditorLogFile, "CVeiVideoDisplay::DoSetAnimationFrameIntervalL: out");
+	}
+
+//=======================================================================================================
+TInt CVeiVideoDisplay::SetAnimationFrameIntervalCallbackMethod(TAny* aThis)
+	{
+    LOG( KVideoEditorLogFile, "CVeiVideoDisplay::SetAnimationFrameIntervalCallbackMethod");
+
+	CVeiVideoDisplay* me = static_cast<CVeiVideoDisplay*>(aThis);
+	TRAPD( err, me->SetFrameIntervalL( 0 ) );
+	
+	return err;
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoProvider/group/VideoProvider.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+#include <data_caging_paths.hrh>
+#include "../inc/VideoProviderUids.hrh"
+#include "../../Group/buildconfig.hrh"
+
+#if defined( __DEBUG_ON__ )
+MACRO        	DEBUG_ON
+#endif
+#if defined( __DEBUG_ON_ALWAYS__ )
+MACRO           DEBUG_ON_ALWAYS
+#endif
+#if defined(__DEBUG_ON__) || defined(__DEBUG_ON_ALWAYS__)
+LIBRARY         flogger.lib
+#endif
+
+#if defined( __INCLUDE_MANUAL_VIDEO_EDITOR__ )
+MACRO           INCLUDE_MANUAL_VIDEO_EDITOR
+#endif
+
+#if defined( __INCLUDE_SIMPLE_VIDEO_EDITOR__ )
+MACRO           INCLUDE_SIMPLE_VIDEO_EDITOR
+LIBRARY         SimpleVideoEditor.lib
+#endif
+
+#if defined( __FILE_TIME_STAMP_UPDATE__ )
+MACRO           FILE_TIME_STAMP_UPDATE
+#endif
+
+// Define this macro to test the performance of the provider.
+// (This is independent of the rest of the logging so that
+// it does not affect the timings)
+//MACRO           LOG_TIMING
+
+
+TARGET		VideoProvider.dll
+TARGETTYPE	PLUGIN
+CAPABILITY  CAP_ECOM_PLUGIN
+
+// MAGIC Dll recognition UID followed by the unique UID for this dll
+UID	0x10009D8D 0x101FFA8E
+
+
+USERINCLUDE	../inc
+USERINCLUDE	../../SimpleVideoEditor/inc
+USERINCLUDE	../../VideoEditorCommon/inc
+USERINCLUDE	../../VideoEditorCommon/data
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE   /epoc32/include/caf
+SYSTEMINCLUDE	/epoc32/include/ECom
+
+SOURCEPATH	../src
+SOURCE		VideoProvider.cpp
+
+SOURCEPATH	../src
+
+START RESOURCE VideoProvider.rss
+TARGET          VideoProvider.rsc
+TARGETPATH      ECOM_RESOURCE_DIR
+END
+
+
+START RESOURCE  VideoProviderInternal.rss
+HEADER
+TARGET VideoProviderInternal.rsc
+TARGETPATH      RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+
+LIBRARY apgrfx.lib
+LIBRARY apmime.lib
+LIBRARY apparc.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY commonengine.lib
+LIBRARY cone.lib 
+LIBRARY efsrv.lib
+LIBRARY euser.lib
+LIBRARY ServiceHandler.lib
+LIBRARY VideoEditorCommon.lib
+
+LIBRARY         caf.lib     // CAF
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoProvider/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+#include "../../Group/buildconfig.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/VideoProvider.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(VideoProvider.iby)
+../rom/VideoProvider_resource.iby  LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(VideoProvider_resource.iby)
+
+PRJ_MMPFILES
+VideoProvider.mmp
+
+PRJ_TESTEXPORTS
+
+PRJ_TESTMMPFILES
+//../internal/tsrc/group/VideoEditorTest.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoProvider/inc/VideoProvider.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Declares Base service API for all providers to implement in order to
+* offer services to Application Interworking Framework.
+*
+*/
+
+  
+#ifndef _VIDEOPROVIDER_H
+#define _VIDEOPROVIDER_H
+
+//<IBUDSW>
+
+#include <AiwServiceIfMenu.h>
+#include <apparc.h>
+#include <ConeResLoader.h> 
+#include <AknServerApp.h> 
+#include "SimpleVideoEditor.h"
+
+
+// FORWARD DECLARATIONS
+class MAiwNotifyCallback;
+class CAknOpenFileService;
+class TDataType;
+
+
+class CVideoProvider :	public CAiwServiceIfMenu, 
+						public MAknServerAppExitObserver,
+						public MSimpleVideoEditorExitObserver
+	{
+	public:	
+		/** New factory method
+		*
+		*	
+		*	@param -
+		*	@return - pointer to a new instance of CEditorProvider
+		*/ 
+		static CVideoProvider* NewL();
+
+		/** Destructor
+		*	
+		*	@param -
+		*	@return - 
+		*/ 
+		~CVideoProvider();
+
+	public:		
+		/** InitialiseL
+		*
+		*   @see CAiwServiceIfBase
+		*/ 
+		virtual void InitialiseL (
+			MAiwNotifyCallback &			aFrameworkCallback,
+			const RCriteriaArray &			aInterest
+			);
+
+		/** HandleServiceCmdL
+		*
+		*   @see CAiwServiceIfBase
+		*/ 
+		virtual void HandleServiceCmdL (
+		    const TInt &                    aCmdId,
+			const CAiwGenericParamList &    aInParamList,
+			CAiwGenericParamList &          aOutParamList,
+			TUint                           aCmdOptions = 0,
+			const MAiwNotifyCallback *      aCallback = NULL
+			);
+
+		/** InitializeMenuPaneL
+		*
+		*   @see CAiwServiceIfMenu
+		*/ 
+		virtual void InitializeMenuPaneL (
+		    CAiwMenuPane &                  aMenuPane,
+		    TInt                            aIndex,
+		    TInt                            aCascadeId,
+		    const CAiwGenericParamList &    aInParamList
+		    );
+
+		/** HandleMenuCmdL
+		*
+		*   @see CAiwServiceIfMenu
+		*/ 
+		virtual void HandleMenuCmdL (
+		    TInt                            aMenuCmdId,
+		    const CAiwGenericParamList &	aInParamList,
+		    CAiwGenericParamList &          aOutParamList,
+		    TUint                           aCmdOptions = 0,
+		    const MAiwNotifyCallback *      aCallback = NULL
+		    );
+
+		/** HandleServerAppExit
+		*
+		*   @see MAknServerAppExitObserver
+		*/ 
+		virtual void HandleServerAppExit (TInt aReason);
+
+		/** HandleSimpleVideoEditorExit
+		*
+		*   @see MSimpleVideoEditorExitObserver
+		*/ 
+		virtual void HandleSimpleVideoEditorExit (TInt aReason, const TDesC& aResultFileName);
+
+	private:
+		CVideoProvider();
+
+	private:
+		/** 
+		*   @param aMenuCmdId
+		*   @param aFileName
+		*   @param CAiwGenericParamList
+		*   @return -
+		*/
+	    void LaunchEditorL( 
+	    	TInt aMenuCmdId, 
+			const TDesC & 					aFileName,
+		    const CAiwGenericParamList &	aInParamList
+		    );
+
+		/** HandleCmdsL
+		*
+		*   Handle menu and service commands
+		*
+		*   @see HandleMenuCmdL
+		*   @see HandleServiceCmdL
+		*/ 
+		void HandleCmdsL (
+		    TInt                            aMenuCmdId,
+		    const CAiwGenericParamList &	aInParamList,
+		    CAiwGenericParamList &          aOutParamList,
+		    TUint                           aCmdOptions,
+		    const MAiwNotifyCallback *      aCallback
+		    );
+
+		TBool IsSupportedVideoFile (const TDesC& aDataType) const;
+		TBool IsSupportedAudioFile (const TDesC& aDataType) const;
+		TBool IsSupportedImageFile (const TDesC& aDataType) const;
+		
+		void FinalizeL (const TDesC& aFileName);
+		void CloseFsSession();
+
+	private: // Data
+
+		RFs 						iSharableFS;
+		TFileName					iResourceFile;
+		RConeResourceLoader 		iResLoader;
+		TBool						iResFileIsLoaded;
+		CAknOpenFileService *		iOpenFileService;
+		const MAiwNotifyCallback*	iAiwNotifyCallback;
+		#if defined(INCLUDE_SIMPLE_VIDEO_EDITOR)
+		CSimpleVideoEditor* 		iSimpleVideoEditor;
+		#endif
+		CAiwGenericParamList*		iInParamList;
+		CAiwGenericParamList*		iOutParamList;
+
+		// Time stamp of the original file. If there are multiple files,
+		// the most recent.
+		TTime						iOriginalTimeStamp;
+		
+		/// Media Gallery Albums support. 
+		/// List of albums where the source file(s) belong(s) to.
+		RArray<TInt>				iSourceMGAlbumIdList;
+	};
+
+//</IBUDSW>
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoProvider/inc/VideoProvider.rh	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*     
+*/
+
+#ifndef _AIW_PROVIDER_EXAMPLE_RH
+#define _AIW_PROVIDER_EXAMPLE_RH
+
+enum
+	{
+	//EVideoEditorProviderCmdEdit = 1,
+	EVideoEditorProviderCmdMerge 	= 1,
+	EVideoEditorProviderCmdAddAudio = 2,
+	EVideoEditorProviderCmdAddText 	= 3,
+	EVideoEditorProviderCmdCut	= 4,
+	EVideoEditorProviderCmdAdvanced = 5
+	};
+
+#endif  // _AIW_PROVIDER_EXAMPLE_RH
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoProvider/inc/VideoProviderUids.hrh	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef _AIW_EXAMPLE_PROVIDER_UIDS_HRH
+#define _AIW_EXAMPLE_PROVIDER_UIDS_HRH
+
+
+#define KVideoEditorProviderDllUid   0x101FFA8E
+#define KVideoEditorProviderImplUid  0xA0000304
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoProvider/rom/VideoProvider.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifdef RD_S60_SIMPLE_VIDEO_EDITOR
+
+#ifndef __VIDEOPROVIDER_IBY__
+#define __VIDEOPROVIDER_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+//VideoProvider plugin dll
+ECOM_PLUGIN(VideoProvider.dll, VideoProvider.rsc)
+
+#endif	// __VIDEOPROVIDER_IBY__
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoProvider/rom/VideoProvider_resource.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifdef RD_S60_SIMPLE_VIDEO_EDITOR
+
+#ifndef __VIDEOPROVIDERRESOURCES_IBY__
+#define __VIDEOPROVIDERRESOURCES_IBY__
+
+#include <data_caging_paths_for_iby.hrh>
+
+//VideoProvider dll
+data=DATAZ_\RESOURCE_FILES_DIR\VideoProviderInternal.rsc    RESOURCE_FILES_DIR\VideoProviderInternal.rsc
+
+#endif	// __VIDEOPROVIDERRESOURCES_IBY__
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoProvider/src/VideoProvider.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,713 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#include <eikmenup.h>
+#include "VideoProvider.h"
+#include <AiwMenu.h>
+#include <AiwCommon.h>
+#include <AiwGenericParam.h>
+#include <eikenv.h>
+#include <VideoProviderInternal.rsg>
+#include <ImplementationProxy.h>
+#include "VideoProviderUids.hrh"
+#include "VideoProvider.rh"
+#include <aknutils.h>
+#include <bautils.h>
+#include <AknOpenFileService.h>
+#include <data_caging_path_literals.hrh>
+#include <apgcli.h>
+#include <apmrec.h>
+#include <caf.h> // for DRM checks
+#include <e32property.h>
+#include <f32file.h>
+#include "VideoEditorCommon.h"
+#include "VideoEditorUtils.h"
+#include "VideoEditorDebugUtils.h"
+#if defined(INCLUDE_SIMPLE_VIDEO_EDITOR)
+#include "SimpleVideoEditor.h"
+#endif
+
+using namespace ContentAccess;
+
+
+//=============================================================================
+CVideoProvider* CVideoProvider::NewL()
+	{
+    LOG(KVideoProviderLogFile, "CVideoProvider::NewL");
+
+	return new (ELeave)	CVideoProvider();
+	}
+	
+//=============================================================================
+CVideoProvider::CVideoProvider() : iResLoader(*CEikonEnv::Static())
+	{
+	LOG(KVideoProviderLogFile, "CVideoProvider::CVideoProvider: In");
+
+    _LIT(KResourceFile, "VideoProviderInternal.rsc");
+    TFileName fileName;
+    TParse p;    
+
+    Dll::FileName(fileName);
+    p.Set(KResourceFile, &KDC_RESOURCE_FILES_DIR, &fileName);
+    iResourceFile = p.FullName();
+
+	iResFileIsLoaded = EFalse;
+
+	LOG(KVideoProviderLogFile, "CVideoProvider::CVideoProvider: Out");
+	}
+
+//=============================================================================
+CVideoProvider::~CVideoProvider()
+	{
+	LOG(KVideoProviderLogFile, "CVideoProvider::~CVideoProvider(): In");
+
+	#if defined(INCLUDE_SIMPLE_VIDEO_EDITOR)
+	if (iSimpleVideoEditor)
+		{
+		iSimpleVideoEditor->Cancel();
+		}
+	delete iSimpleVideoEditor;
+	iSimpleVideoEditor = NULL;
+	#endif
+
+LOG(KVideoProviderLogFile, "CVideoProvider::~CVideoProvider(): 1");
+	CloseFsSession();
+LOG(KVideoProviderLogFile, "CVideoProvider::~CVideoProvider(): 2");	
+
+    iAiwNotifyCallback = NULL;
+    iInParamList->Reset();
+    delete iInParamList;
+    iOutParamList->Reset();
+    delete iOutParamList;
+LOG(KVideoProviderLogFile, "CVideoProvider::~CVideoProvider(): 3");
+	delete iOpenFileService;
+	iOpenFileService = NULL;
+	iResLoader.Close();
+LOG(KVideoProviderLogFile, "CVideoProvider::~CVideoProvider(): 4");
+	iSourceMGAlbumIdList.Close();
+
+	LOG(KVideoProviderLogFile, "CVideoProvider::~CVideoProvider(): Out");
+	}
+
+//=============================================================================
+void CVideoProvider::InitialiseL(MAiwNotifyCallback& /*aFrameworkCallback*/,
+								      const RCriteriaArray& /*aInterest*/)
+	{
+    LOG(KVideoProviderLogFile, "CVideoProvider::InitialiseL: in");
+
+    if (!iInParamList)
+    	{
+        iInParamList = CAiwGenericParamList::NewL();    
+    	}
+
+    if (!iOutParamList)
+    	{
+        iOutParamList = CAiwGenericParamList::NewL();    
+    	}
+
+	if ( !iResFileIsLoaded )
+		{
+		BaflUtils::NearestLanguageFile( CEikonEnv::Static()->FsSession(), iResourceFile );
+		LOGFMT(KVideoProviderLogFile, "CVideoProvider::InitialiseL: Loading resource file: %S", &iResourceFile);
+		iResLoader.OpenL( iResourceFile );
+		}
+
+	iResFileIsLoaded = ETrue;
+
+    // Publish & Subscribe API used for delivering document name from application to AIW provider
+    // NOTE: this assumes only a single instance of video editor(s) at a time.
+    TInt err = RProperty::Define(KUidVideoEditorProperties, VideoEditor::EPropertyFilename, RProperty::EText);
+    if (err != KErrAlreadyExists)
+        {
+    	LOGFMT(KVideoProviderLogFile, "CVideoProvider::InitialiseL: Calling RProperty::Define(KUidVideoEditorProperties, VideoEditor::EPropertyFilename, RProperty::EText): error %d", err);
+        User::LeaveIfError(err);
+        }
+
+    LOG(KVideoProviderLogFile, "CVideoProvider::InitialiseL: out");
+	}
+
+//=============================================================================
+void CVideoProvider::InitializeMenuPaneL(CAiwMenuPane& aMenuPane,
+											  TInt aIndex,
+											  TInt /*aCascadeId*/,
+											  const CAiwGenericParamList& aInParamList)
+	{
+	LOGFMT2(KVideoProviderLogFile, "CVideoProvider::InitializeMenuPaneL: In (aIndex: %d, aInParamList.Count(): %d)", aIndex, aInParamList.Count());
+
+#ifdef LOG_TIMING
+	TTime startTime(0);
+	startTime.UniversalTime();
+	TTime inputAnalyzedTime(0);
+	TTime endTime(0);
+#endif // LOG_TIMING
+
+	RFs& fs = CEikonEnv::Static()->FsSession();
+
+	// First check what kin of files the parameter list contains
+	// and what we can do with them
+	TInt numberOfEditableVideoClips = 0;
+	TInt numberOfEditableAudioClips = 0;
+	TInt numberOfEditableImages = 0;
+
+	// We trust that aInParamList is always the same, i.e.
+	// - a few (seems to be 3) parameters in the begining
+	// - after that, filename/mimetype pairs
+	TInt paramCount = aInParamList.Count();
+	TInt fileCount = aInParamList.Count( EGenericParamFile );
+
+	if ( fileCount <= KAiwMaxNumberOfFilesSimultaneouslyHandled )
+		{
+		for ( TInt i=0; i < paramCount ; i++ )
+			{
+			TBool isDRMProtected( EFalse );
+
+			// Extract file names from the parameter list.
+			const TAiwGenericParam& param = aInParamList[i];
+			if (param.SemanticId() == EGenericParamFile)
+				{
+				TPtrC fileName = param.Value().AsDes();
+				LOGFMT(KVideoProviderLogFile, "\tfile name: %S", &fileName);
+
+				// Next we need to get the MIME typ of the file.
+				TBuf<KMaxDataTypeLength> mimeType;
+				RFile file;
+				TInt err( file.Open( fs, fileName, EFileShareReadersOnly ) );
+				if( KErrNone != err ) 
+					{
+					err = file.Open( fs, fileName, EFileShareAny );
+					}
+					
+				if( KErrNone == err )
+					{
+					TDataRecognitionResult dataType;
+					CleanupClosePushL( file );
+			        // Check if the file is valid
+			        RApaLsSession lsSession;
+			        err = lsSession.Connect();
+			        CleanupClosePushL( lsSession );
+				    err = lsSession.RecognizeData( file, dataType );
+				    if ( KErrNone == err )
+				        {
+                        const TInt confidence( dataType.iConfidence );
+                        if( CApaDataRecognizerType::ECertain == confidence ||
+                            CApaDataRecognizerType::EProbable == confidence ||
+                            CApaDataRecognizerType::EPossible == confidence )
+                            {
+							mimeType = dataType.iDataType.Des();
+                            }
+				        }		
+				    CleanupStack::PopAndDestroy( 2 ); // file, lsSession
+					}
+
+				// Based on the MIME type, decice whether we support this file.
+				if (mimeType.Length())
+						{
+						// Create CContent-object
+                        CContent* pContent = CContent::NewLC(fileName); 
+						// See if the content object is protected
+                        User::LeaveIfError( pContent->GetAttribute( EIsProtected, isDRMProtected ) );
+                        
+                        CleanupStack::PopAndDestroy (pContent);
+						if (!isDRMProtected)
+							{
+							if ( IsSupportedVideoFile(mimeType) )
+								{
+								numberOfEditableVideoClips++;
+								}
+							else if ( IsSupportedAudioFile(mimeType) )
+								{
+								numberOfEditableAudioClips++;
+								}
+							else if ( IsSupportedImageFile(mimeType) )
+								{
+								numberOfEditableImages++;
+								}
+							}
+						else
+							{
+							LOGFMT(KVideoProviderLogFile, "\tCannot edit DRM protected file: %S", &fileName);
+							}
+						}		
+				}
+			}
+		}
+	else
+		{
+		LOGFMT(KVideoProviderLogFile, "CVideoProvider::InitialiseL: too many files to handle (%d). Ignored.", fileCount);
+		}
+
+	// When the content of the parameter list is analyzed, 
+	// add the appropriate menu items
+	LOGFMT3(KVideoProviderLogFile, "CVideoProvider::InitializeMenuPaneL: AIW parameter list content analyzed: numberOfEditableVideoClips: %d, numberOfEditableAudioClips: %d, numberOfEditableImages: %d", numberOfEditableVideoClips,numberOfEditableAudioClips,numberOfEditableImages);
+
+#ifdef LOG_TIMING
+	inputAnalyzedTime.UniversalTime();
+#endif // LOG_TIMING
+
+	// CASE 1: one video selected: all options available
+	if (numberOfEditableVideoClips == 1 && (numberOfEditableAudioClips+numberOfEditableImages) == 0)
+		{
+
+#if defined(INCLUDE_MANUAL_VIDEO_EDITOR)
+		
+		// Advanced (manual) editor
+		aMenuPane.AddMenuItemsL(
+			iResourceFile, 
+			R_VIDEOEDITORPROVIDER_ADVANCED_MENU,
+			KAiwCmdEdit,
+			aIndex );
+
+#endif // INCLUDE_MANUAL_VIDEO_EDITOR
+
+#if defined(INCLUDE_SIMPLE_VIDEO_EDITOR)
+
+		// Simple Cut
+		aMenuPane.AddMenuItemsL(
+			iResourceFile, 
+			R_VIDEOEDITORPROVIDER_CUT_MENU,
+			KAiwCmdEdit,
+			aIndex );
+
+		// Simple Add text
+		aMenuPane.AddMenuItemsL(
+			iResourceFile, 
+			R_VIDEOEDITORPROVIDER_ADD_TEXT_MENU,
+			KAiwCmdEdit,
+			aIndex );
+
+		// Simple Add audio
+		aMenuPane.AddMenuItemsL(
+			iResourceFile, 
+			R_VIDEOEDITORPROVIDER_ADD_AUDIO_MENU,
+			KAiwCmdEdit,
+			aIndex );
+
+		// Simple merge
+		aMenuPane.AddMenuItemsL(
+			iResourceFile, 
+			R_VIDEOEDITORPROVIDER_MERGE_MENU,
+			KAiwCmdEdit,
+			aIndex );
+
+		// Sub-menu title "Edit"
+		aMenuPane.AddMenuItemsL(
+			iResourceFile, 
+			R_VIDEOEDITORPROVIDER_SUBMENU_TITLE,
+			KAiwCmdEdit,
+			aIndex );
+
+#endif // INCLUDE_SIMPLE_VIDEO_EDITOR
+
+		}
+
+#if defined(INCLUDE_MANUAL_VIDEO_EDITOR)
+
+	// CASE 2: several video clips or other files selected: only manual editor available,
+	// and only if there is at least one video.
+	if (numberOfEditableVideoClips > 0 
+		&& (numberOfEditableVideoClips+numberOfEditableAudioClips+numberOfEditableImages) > 1)
+		{
+		// Advanced (manual) editor only
+		aMenuPane.AddMenuItemsL(
+			iResourceFile, 
+			R_VIDEOEDITORPROVIDER_EDIT_MENU,
+			KAiwCmdEdit, 
+			aIndex );
+		}
+
+#endif // INCLUDE_MANUAL_VIDEO_EDITOR
+
+#ifdef LOG_TIMING
+	endTime.UniversalTime();
+
+	TInt64 totalTime = endTime.Int64() - startTime.Int64();
+	TInt64 inputlistAnalyzingtime = inputAnalyzedTime.Int64() - startTime.Int64();
+	TInt64 menuPaneAddingTime = endTime.Int64() - inputAnalyzedTime.Int64();
+
+	_LIT(KText1, "AIW Parameter list contains %d files (total %d parameters). Times taken:");
+	_LIT(KText2, "    Total: %Ld, Analyzing input param list: %Ld, Adding menu items: %Ld");
+	TFileName path(KLogsFolder);
+	path.Append(KLogDir);
+	path.Append(KBackslash);
+	TFileName fileNameAndPath(path);
+	fileNameAndPath.Append(_L("VideoProviderTiming.log"));
+	if(BaflUtils::FolderExists(fs,path))
+		{
+		TLogFileDes16OverflowHandler ofh;
+		TBuf<KMaxLogLineLength> buf1;
+		TBuf<KMaxLogLineLength> buf2;
+		buf1.AppendFormat(KText1,&ofh,fileCount,paramCount);
+		buf2.AppendFormat(KText2,&ofh,totalTime,inputlistAnalyzingtime,menuPaneAddingTime);
+		CLogFile::StaticLog(fileNameAndPath,buf1);
+		CLogFile::StaticLog(fileNameAndPath,buf2);
+		}
+	RDebug::Print(KText1, fileCount, paramCount);
+	RDebug::Print(KText2, totalTime, inputlistAnalyzingtime, menuPaneAddingTime);
+#endif // LOG_TIMING
+
+	LOG(KVideoProviderLogFile, "CVideoProvider::InitializeMenuPaneL: out");
+	}
+
+//=============================================================================
+void CVideoProvider::HandleServiceCmdL(const TInt& aCmdId,
+								    	    const CAiwGenericParamList& aInParamList,
+											CAiwGenericParamList& aOutParamList,
+											TUint aCmdOptions,
+											const MAiwNotifyCallback* aCallback)
+	{
+	LOGFMT(KVideoProviderLogFile, "CVideoProvider::HandleServiceCmdL (%d)", aCmdId);
+	HandleCmdsL(aCmdId, aInParamList, aOutParamList, aCmdOptions, aCallback);
+	}
+
+//=============================================================================
+void CVideoProvider::HandleMenuCmdL (
+    TInt                            aMenuCmdId,
+    const CAiwGenericParamList &	aInParamList,
+    CAiwGenericParamList &          aOutParamList,
+    TUint                           aCmdOptions,
+    const MAiwNotifyCallback *      aCallback)
+
+	{
+	LOGFMT(KVideoProviderLogFile, "CVideoProvider::HandleMenuCmdL (%d)", aMenuCmdId);
+	HandleCmdsL(aMenuCmdId, aInParamList, aOutParamList, aCmdOptions, aCallback);
+	}
+
+//=============================================================================
+void CVideoProvider::HandleCmdsL(TInt aMenuCmdId, 
+										 const CAiwGenericParamList& aInParamList,
+										 CAiwGenericParamList& aOutParamList,
+										 TUint /*aCmdOptions*/,
+										 const MAiwNotifyCallback* aCallback)
+	{
+	LOGFMT(KVideoProviderLogFile, "CVideoProvider::HandleCmdsL (%d): In", aMenuCmdId);
+
+	switch ( aMenuCmdId )
+		{
+		case EVideoEditorProviderCmdMerge:
+		case EVideoEditorProviderCmdAddAudio:
+		case EVideoEditorProviderCmdAddText:
+		case EVideoEditorProviderCmdCut:
+		case EVideoEditorProviderCmdAdvanced:
+			{
+			// Store input parameters
+			if (aCallback)
+				{
+				iAiwNotifyCallback = aCallback;
+				iInParamList->Reset();
+				iInParamList->AppendL(aInParamList);
+				iOutParamList->Reset();
+				iOutParamList->AppendL(aOutParamList);
+				LOG(KVideoProviderLogFile, "CVideoProvider: Using AIW call back");
+				}
+			else
+				{
+				iAiwNotifyCallback = NULL;
+				}
+
+			// Open file server session
+			User::LeaveIfError(iSharableFS.Connect());
+			iSharableFS.ShareProtected();
+
+			// Find the first file on the generic param list...
+			// There must be at least one file, and all the files must exist.
+			TPtrC fileName;
+			TInt count = aInParamList.Count();
+			iSourceMGAlbumIdList.Reset();
+			for (TInt i = count - 1; i >= 0; --i)
+				{
+				const TAiwGenericParam& param = aInParamList[i];
+				if (param.SemanticId() == EGenericParamFile)
+					{
+					fileName.Set(param.Value().AsDes());
+
+					// Check that that the file exists and is accessible.
+					// The AIW consumer should provide us only valid files.
+					// If this is not the case, just leave and let the consumer handle the error.
+					TEntry entry;
+					TInt err = iSharableFS.Entry( fileName, entry );
+					LOGFMT2(KVideoProviderLogFile, "CVideoProvider::HandleCmdsL: Could not open file: %S, error: %d", &fileName, err);
+					User::LeaveIfError( err );
+
+					// Store the time stamp of the most recent file (needed later).
+					TTime time = entry.iModified;
+					if (iOriginalTimeStamp < time)
+						{
+						iOriginalTimeStamp = time;
+						}
+
+					// Find out whether the source file belongs to any albums
+					VideoEditorUtils::GetMGAlbumsListForMediaFileL (
+						iSourceMGAlbumIdList,
+						fileName );
+					}
+				}
+
+			// Launch the editor    
+			LaunchEditorL( aMenuCmdId, fileName, aInParamList);
+
+			break; 
+			}
+		default:
+			{
+			break;
+			}
+		}
+	LOG(KVideoProviderLogFile, "CVideoProvider::HandleCmdsL: out");
+	}
+
+//=============================================================================
+void CVideoProvider::LaunchEditorL( 
+	TInt aMenuCmdId, 
+	const TDesC & 					aFileName,
+    const CAiwGenericParamList &	aInParamList
+	)
+	{
+    LOGFMT(KVideoProviderLogFile, "CVideoProvider::LaunchEditorL: file: %S", &aFileName);
+
+	RFile fileHandle;
+	TInt err = fileHandle.Open(iSharableFS,aFileName,EFileWrite|EFileShareReadersOrWriters);
+	if (KErrNone != err)
+		{
+		LOG(KVideoEditorLogFile, "CVideoProvider::LaunchEditorL: Could not open file with EFileWrite. Trying EFileRead");
+		User::LeaveIfError( fileHandle.Open (iSharableFS,aFileName,EFileRead|EFileShareReadersOrWriters) );
+		}
+	CleanupClosePushL (fileHandle);
+
+	if (iAiwNotifyCallback)
+		{
+	    const_cast<MAiwNotifyCallback*>(iAiwNotifyCallback)->HandleNotifyL(KAiwCmdEdit, KAiwEventStarted, *iOutParamList, *iInParamList);    
+		}
+
+    switch ( aMenuCmdId )
+		{
+		case EVideoEditorProviderCmdMerge:
+			{
+			LOG(KVideoProviderLogFile, "\tEVideoEditorProviderCmdMerge");
+
+			#if defined(INCLUDE_SIMPLE_VIDEO_EDITOR)
+			delete iSimpleVideoEditor;
+			iSimpleVideoEditor = NULL;
+			iSimpleVideoEditor = CSimpleVideoEditor::NewL( *this );
+			iSimpleVideoEditor->Merge (aFileName);
+			#endif // INCLUDE_SIMPLE_VIDEO_EDITOR
+
+			break;
+			}
+		case EVideoEditorProviderCmdAddAudio:
+			{
+			LOG(KVideoProviderLogFile, "\tEVideoEditorProviderCmdAddAudio");
+
+			#if defined(INCLUDE_SIMPLE_VIDEO_EDITOR)
+			delete iSimpleVideoEditor;
+			iSimpleVideoEditor = NULL;
+			iSimpleVideoEditor = CSimpleVideoEditor::NewL( *this );
+			iSimpleVideoEditor->ChangeAudio (aFileName);
+			#endif // INCLUDE_SIMPLE_VIDEO_EDITOR
+
+			break;
+			}
+		case EVideoEditorProviderCmdAddText:
+			{
+			LOG(KVideoProviderLogFile, "\tEVideoEditorProviderCmdAddText");
+
+			#if defined(INCLUDE_SIMPLE_VIDEO_EDITOR)
+			delete iSimpleVideoEditor;
+			iSimpleVideoEditor = NULL;
+			iSimpleVideoEditor = CSimpleVideoEditor::NewL( *this );
+			iSimpleVideoEditor->AddText (aFileName);
+			#endif // INCLUDE_SIMPLE_VIDEO_EDITOR
+
+			break;
+			}
+		case EVideoEditorProviderCmdCut:
+			{
+			LOG(KVideoProviderLogFile, "\tEVideoEditorProviderCmdCut");
+			iOpenFileService = CAknOpenFileService::NewL (KUidSimpleCutVideo,fileHandle,(MAknServerAppExitObserver *)this,&const_cast<CAiwGenericParamList &>(aInParamList));
+			break;
+			}
+		case EVideoEditorProviderCmdAdvanced:
+			{
+			LOG(KVideoProviderLogFile, "\tEVideoEditorProviderCmdAdvanced");
+			iOpenFileService = CAknOpenFileService::NewL (KUidVideoEditor,fileHandle,(MAknServerAppExitObserver *)this,&const_cast<CAiwGenericParamList &>(aInParamList));
+			break;
+			}
+		default:
+			LOG(KVideoProviderLogFile, "\tUnknown command!");
+			break;
+		}
+
+	CleanupStack::PopAndDestroy( &fileHandle ); // close fileHandle
+
+	LOG(KVideoProviderLogFile, "CVideoProvider::LaunchEditorL: out");
+	}
+
+//=============================================================================
+TBool CVideoProvider::IsSupportedVideoFile (const TDesC& aDataType) const
+	{
+	_LIT(KMime3gp, "video/3gpp");
+	_LIT(KMimeMp4, "video/mp4");
+
+	return aDataType.CompareF( KMime3gp ) == 0 || aDataType.CompareF( KMimeMp4 ) == 0;
+	}
+
+//=============================================================================
+TBool CVideoProvider::IsSupportedAudioFile (const TDesC& aDataType) const
+	{
+	_LIT(KMimeAllAudio, "audio/");
+	return aDataType.Left(6).CompareF( KMimeAllAudio ) == 0;
+	}
+
+//=============================================================================
+TBool CVideoProvider::IsSupportedImageFile (const TDesC& aDataType) const
+	{
+	_LIT(KMimeAllImages, "image/");
+	return aDataType.Left(6).CompareF( KMimeAllImages ) == 0;
+	}
+
+//=============================================================================
+void CVideoProvider::HandleServerAppExit (TInt aReason)
+	{
+    LOGFMT(KVideoProviderLogFile, "CVideoProvider::HandleServerAppExit: In: %d", aReason);
+
+	delete iOpenFileService;
+	iOpenFileService = NULL;
+
+	// Get the output file name provided by the editor application
+    TFileName newFileName;
+    (void) RProperty::Get(KUidVideoEditorProperties, VideoEditor::EPropertyFilename, newFileName);
+
+	// Report new file to AIW consumer
+	TRAP_IGNORE( FinalizeL (newFileName) );
+    MAknServerAppExitObserver::HandleServerAppExit(aReason);
+
+    LOG(KVideoProviderLogFile, "CVideoProvider::HandleServerAppExit: Out");
+    }
+
+//=============================================================================
+void CVideoProvider::HandleSimpleVideoEditorExit (TInt DEBUGLOG_ARG(aReason), const TDesC& aResultFileName)
+	{
+    LOGFMT2(KVideoProviderLogFile, "CVideoProvider::HandleSimpleVideoEditorExitL: In: %d, %S", aReason, &aResultFileName);
+
+#if defined(INCLUDE_SIMPLE_VIDEO_EDITOR)
+
+	// Report new file to AIW consumer
+	TRAP_IGNORE( FinalizeL (aResultFileName) );
+
+	delete iSimpleVideoEditor;
+	iSimpleVideoEditor = NULL;
+
+
+#endif // INCLUDE_SIMPLE_VIDEO_EDITOR
+
+    LOG(KVideoProviderLogFile, "CVideoProvider::HandleSimpleVideoEditorExitL: Out");
+    }
+
+//=============================================================================
+void CVideoProvider::FinalizeL (const TDesC& aFileName)
+	{
+	LOGFMT(KVideoProviderLogFile, "CVideoProvider::FinalizeL: In: %S", &aFileName);
+
+#ifdef FILE_TIME_STAMP_UPDATE    
+	LOG(KVideoProviderLogFile, "CVideoProvider::FinalizeL: 2, executing FILE_TIME_STAMP_UPDATE");
+	// Set the timestamp of the saved file to original file's timestamp + 1 second.
+	// The idea is to make the original and edited images appear next to each other.
+	if( aFileName.Length() && BaflUtils::FileExists(iSharableFS,aFileName) )
+		{
+		// The requirement is to increment the time by 1 second.
+		// For some weird reason, setting Attribs to 
+		// iOriginalTimeStamp + TTimeIntervalSeconds (1) has no effect, 
+		// but 2 seconds works fine... 
+		TTime newTime = iOriginalTimeStamp + TTimeIntervalSeconds (2);
+
+		CFileMan* fileMan = CFileMan::NewL( iSharableFS );
+		CleanupStack::PushL (fileMan);
+		// do not set or clear any attribute, mofify time attribute
+		fileMan->Attribs(aFileName, 0, 0, newTime);
+		CleanupStack::PopAndDestroy (fileMan);
+		}
+#endif
+
+	iSourceMGAlbumIdList.Reset();
+
+	// Notify the AIW consumer
+	if (iAiwNotifyCallback)
+		{
+		// Insert the file name to the output parameter list
+		// (we assume that it is always the first item on the list)
+		iOutParamList->Reset();
+		TAiwVariant variant(aFileName);
+		TAiwGenericParam param(EGenericParamFile, variant);
+		iOutParamList->AppendL(param);
+
+	    LOG(KVideoProviderLogFile, "CVideoProvider: Calling HandleNotifyL");
+
+		// Non-leaving function shall use TRAP
+		TRAP_IGNORE ( 
+			const_cast<MAiwNotifyCallback*>(iAiwNotifyCallback)->HandleNotifyL(KAiwCmdEdit, KAiwEventCompleted, *iOutParamList, *iInParamList);    	    	    
+			const_cast<MAiwNotifyCallback*>(iAiwNotifyCallback)->HandleNotifyL(KAiwCmdEdit, KAiwEventStopped, *iOutParamList, *iInParamList);    
+			);
+
+		// Reset new filename property and out paramlist
+        User::LeaveIfError(RProperty::Set(KUidVideoEditorProperties, VideoEditor::EPropertyFilename, KNullDesC));
+        iOutParamList->Reset();
+		}
+
+	CloseFsSession();
+
+	LOG(KVideoProviderLogFile, "CVideoProvider::FinalizeL: Out");
+	}
+
+//=============================================================================
+void CVideoProvider::CloseFsSession()
+	{
+	LOG(KVideoProviderLogFile, "CVideoProvider::CloseFsSession(): In");
+
+	if (iSharableFS.Handle() != 0)
+        {
+        LOG(KVideoProviderLogFile, "\tClosing iSharableFS");
+        iSharableFS.Close();
+        }
+
+    LOG(KVideoProviderLogFile, "CVideoProvider::CloseFsSession(): Out");
+	}
+
+
+//
+// Rest of the file is for ECom initialization. 
+//
+
+// Map the interface UIDs to implementation factory functions
+LOCAL_D const TImplementationProxy ImplementationTable[] =
+	{
+	IMPLEMENTATION_PROXY_ENTRY( KVideoEditorProviderImplUid, CVideoProvider::NewL)
+	};
+
+// ---------------------------------------------------------
+//
+// Exported proxy for instantiation method resolution
+// ---------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+	return ImplementationTable;
+	}
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoProvider/src/VideoProvider.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Declares Base service API for all providers to implement in order to
+* offer services to Application Interworking Framework.
+*
+*/
+
+
+
+#include <Eikon.rh>
+#include "RegistryInfoV2.rh" 
+#include "VideoProvider.rh"
+#include "VideoProviderUids.hrh"
+#include <AiwCommon.hrh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	resource_format_version = RESOURCE_FORMAT_VERSION_2; 
+	dll_uid = KVideoEditorProviderDllUid;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = KAiwClassMenu;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KVideoEditorProviderImplUid;
+					version_no = 1;
+					display_name = "Video Editor Menu Provider";
+					default_data = "video/*";
+					opaque_data = KAiwCmdEditStr;
+					}
+				};
+			},
+		INTERFACE_INFO	
+			{
+			// Interface UID of resolvers
+			interface_uid = KAiwClassBase;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KVideoEditorProviderImplUid;
+					version_no = 1;
+					display_name = "Video Editor Base Provider";
+					default_data = "video/*";
+					opaque_data = KAiwCmdEditStr;
+					}
+				};
+			}
+		};
+	}
+
+// End of file
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/VideoProvider/src/VideoProviderInternal.rss	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Declares Base service API for all providers to implement in order to
+* offer services to Application Interworking Framework.
+*
+*/
+
+
+NAME	VEPI
+
+// INCLUDES
+#include <Eikon.rh>
+#include <avkon.loc>
+#include "RegistryInfoV2.rh" 
+#include "VideoProvider.rh"
+
+#include <AiwCommon.hrh>
+
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <AvkonIcons.hrh>
+#include <SimpleVideoEditor.loc>
+
+
+RESOURCE RSS_SIGNATURE { }
+
+// Menu title for the Edit sub-menu
+RESOURCE MENU_PANE r_videoeditorprovider_submenu_title
+{
+    items=
+    {
+        MENU_ITEM
+        {
+            command = AIW_SUBMENU_TITLE;
+            txt = qtn_vie_options_edit;
+        }
+    };
+}
+
+
+// Menu item for "Simple Merge"
+RESOURCE MENU_PANE r_videoeditorprovider_merge_menu
+{
+    items=
+    {
+        MENU_ITEM 
+        { 
+            command = EVideoEditorProviderCmdMerge; 
+            txt = qtn_vie_options_merge; // menu text
+            extratxt = qtn_vie_options_sub_merge; // submenu text
+        }
+    };
+}
+
+// Menu item for "Simple Change audio"
+RESOURCE MENU_PANE r_videoeditorprovider_add_audio_menu
+{
+    items=
+    {
+        MENU_ITEM 
+        { 
+            command = EVideoEditorProviderCmdAddAudio; 
+            txt = qtn_vie_options_change_sound; // menu text
+            extratxt = qtn_vie_options_sub_change_sound; // submenu text
+        }
+    };
+}
+
+// Menu item for "Simple Add text"
+RESOURCE MENU_PANE r_videoeditorprovider_add_text_menu
+{
+    items=
+    {
+        MENU_ITEM 
+        { 
+            command = EVideoEditorProviderCmdAddText; 
+            txt = qtn_vie_options_add_text; // menu text
+            extratxt =qtn_vie_options_sub_add_text; // submenu text
+        }
+    };
+}
+
+// Menu item for "Simple Cut"
+RESOURCE MENU_PANE r_videoeditorprovider_cut_menu
+{
+    items=
+    {
+        MENU_ITEM 
+        { 
+            command = EVideoEditorProviderCmdCut; 
+            txt = qtn_vie_options_cut; // menu text
+            extratxt = qtn_vie_options_sub_cut; // submenu text
+        }
+    };
+}
+
+// Menu item for "Manual video editor", used when the 
+// item is displayed in sub-menu with other edit commands
+RESOURCE MENU_PANE r_videoeditorprovider_advanced_menu
+{
+    items=
+    {
+        MENU_ITEM 
+        { 
+            command = EVideoEditorProviderCmdAdvanced; 
+            txt = qtn_vei_menu_advanced;
+        }
+    };
+}
+
+// Menu item for "Manual video editor", used when there
+// are no other editing options present (i.e. no sub-menu)
+RESOURCE MENU_PANE r_videoeditorprovider_edit_menu
+{
+    items=
+    {
+        MENU_ITEM 
+        { 
+            command = EVideoEditorProviderCmdAdvanced; 
+            txt = qtn_vei_menu_advanced;
+        },
+        MENU_ITEM
+        {
+            command = AIW_SUBMENU_TITLE;
+            txt = qtn_form_litxt_edit;
+        }
+    };
+}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/data/VideoEditor.pkg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,70 @@
+;
+; Copyright (c) 2010 Ixonos Plc.
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - Initial contribution
+;
+; Contributors:
+; Ixonos Plc
+;
+; Description:
+;
+; Languages
+&EN
+
+; Header
+#{"Video Editor"}, (0xA0000303), 1, 0, 0, TYPE=SA
+; Uid from VidoeEditorCommon
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+
+; Full video editor application
+; -----------------------------
+; ""-"z:\sys\bin\ManualVideoEditor.exe"						
+; ""-"z:\private\10003a3f\import\apps\manualvideoeditor_reg.rsc"
+; ""-"z:\resource\apps\ManualVideoEditor.RSC"
+; ""-"z:\resource\apps\ManualVideoEditor.mif"
+; ""-"z:\resource\help\VideoEditorHelp.hlp"
+
+; Simple Cut video function
+; -------------------------
+""-"z:\sys\bin\VedSimpleCutVideo.exe"
+""-"z:\resource\apps\VedSimpleCutVideo.rsc"
+""-"z:\private\10003a3f\import\apps\VedSimpleCutVideo_reg.rsc"
+
+; Merge, Add Text, Add Image, Add Audio)
+; --------------------------------------
+""-"z:\sys\bin\SimpleVideoEditor.dll"
+""-"z:\resource\SimpleVideoEditor.rsc"
+
+; AIW service provider
+; --------------------
+""-"z:\resource\plugins\VideoProvider.rsc"
+""-"z:\sys\bin\VideoProvider.dll"
+""-"z:\resource\VideoProviderInternal.rsc"
+
+; Common components DLL
+; ---------------------
+""-"z:\sys\bin\VideoEditorCommon.dll"
+""-"z:\resource\VideoEditorCommon.rsc"
+
+; UI components DLL
+; -----------------
+""-"z:\sys\bin\VideoEditorUiComponents.dll"
+""-"z:\resource\VideoEditorUiComponents.rsc"
+""-"z:\resource\apps\VideoEditorUiComponents.mif"
+""-"z:\resource\apps\VideoEditorBitmaps.mbm"
+
+; Trim For Mms
+; ------------
+; to be added later
Binary file videditor/data/VideoEditorStub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/data/VideoEditor_stub.pkg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,70 @@
+;
+; Copyright (c) 2010 Ixonos Plc.
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - Initial contribution
+;
+; Contributors:
+; Ixonos Plc
+;
+; Description:
+;
+; Languages
+&EN
+
+; Header
+#{"Video Editor"}, (0xA0000303), 1, 0, 0, TYPE=SA
+; Uid from VidoeEditorCommon
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+
+; Full video editor application
+; -----------------------------
+; ""-"z:\sys\bin\ManualVideoEditor.exe"						
+; ""-"z:\private\10003a3f\import\apps\manualvideoeditor_reg.rsc"
+; ""-"z:\resource\apps\ManualVideoEditor.RSC"
+; ""-"z:\resource\apps\ManualVideoEditor.mif"
+; ""-"z:\resource\help\VideoEditorHelp.hlp"
+
+; Simple Cut video function
+; -------------------------
+""-"z:\sys\bin\VedSimpleCutVideo.exe"
+""-"z:\resource\apps\VedSimpleCutVideo.rsc"
+""-"z:\private\10003a3f\import\apps\VedSimpleCutVideo_reg.rsc"
+
+; Merge, Add Text, Add Image, Add Audio)
+; --------------------------------------
+""-"z:\sys\bin\SimpleVideoEditor.dll"
+""-"z:\resource\SimpleVideoEditor.rsc"
+
+; AIW service provider
+; --------------------
+""-"z:\resource\plugins\VideoProvider.rsc"
+""-"z:\sys\bin\VideoProvider.dll"
+""-"z:\resource\VideoProviderInternal.rsc"
+
+; Common components DLL
+; ---------------------
+""-"z:\sys\bin\VideoEditorCommon.dll"
+""-"z:\resource\VideoEditorCommon.rsc"
+
+; UI components DLL
+; -----------------
+""-"z:\sys\bin\VideoEditorUiComponents.dll"
+""-"z:\resource\VideoEditorUiComponents.rsc"
+""-"z:\resource\apps\VideoEditorUiComponents.mif"
+""-"z:\resource\apps\VideoEditorBitmaps.mbm"
+
+; Trim For Mms
+; ------------
+; to be added later
Binary file videditor/data/VideoEditor_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/data/buildsis.bat	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,18 @@
+rem
+rem Copyright (c) 2010 Ixonos Plc.
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - Initial contribution
+rem
+rem Contributors:
+rem Ixonos Plc
+rem
+rem Description:
+rem
+
+makesis -s VideoEditor.pkg VideoEditorStub.sis
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Build information file for Simple Cut Video.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "buildconfig.hrh"
+
+#include "../VideoEditorCommon/Group/bld.inf"
+#include "../VideoEditorUiComponents/Group/bld.inf"
+#include "../SimpleVideoEditor/group/bld.inf"
+#include "../SimpleCutVideo/group/bld.inf"
+#include "../VideoProvider/group/bld.inf"
+#if defined (__INCLUDE_MANUAL_VIDEO_EDITOR__)
+#include "../ManualVideoEditor/group/bld.inf"
+#endif
+
+PRJ_EXPORTS
+// ROM description files
+//../internal/tsrc/rom/VideoEditor.iby  LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(VideoEditor.iby)
+//../internal/tsrc/rom/VideoEditorResource.iby  LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(VideoEditorResource.iby)
+
+// export localised loc file
+../loc/SimpleVideoEditor.loc			APP_LAYER_LOC_EXPORT_PATH(SimpleVideoEditor.loc)
+
+// sis stub
+../data/VideoEditorStub.sis   /epoc32/data/z/system/install/VideoEditorStub.sis
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/group/buildconfig.hrh	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+//
+// Compile-time variation for Video Editor project.
+//
+// After modifying this file, reallyclean and build the whole project!
+//
+
+#ifndef BUILDCONFIG_HRH
+#define BUILDCONFIG_HRH
+
+// Enable logging facility in all modules. 
+// Enabling logs will do the both of the following:
+//
+// 1) Write the the logging information to RDebug::Print()
+//    (in UDEB builds only)
+// 2) Write the log to file using RFileLogger (both in UDEB and UREL)
+//    or using internal logfile implementation (selected in VideoEditorDebugUtils.h)
+//
+//    Create the folder C:/Logs/VideoEditor to enable the file logging.
+//
+// - enable logs in UDEB builds:
+#define __DEBUG_ON__
+// - enable logs in all builds (not to be used in released code):
+//#define __DEBUG_ON_ALWAYS__
+
+
+// Export the ROM description (.iby) files
+// Not needed if we are not creating rom image.
+// Do not export if __DSW_EXPORTS defined
+//
+//#ifndef __DSW_EXPORTS
+//#define __EXPORT_ROM_DESCRIPTION_FILES__
+//#endif
+
+
+// Include the "full" video editor application into the build.
+//
+// NOTE: If this flag is defined, include the following 
+// IBY files in VideoEditor.iby:
+//
+// #include <ManualVideoEditor.iby>
+// #include <VideoEditorCommon.iby>
+// #include <VideoEditorUiComponents.iby>
+// #include <VideoProvider.iby>
+//
+//#define __INCLUDE_MANUAL_VIDEO_EDITOR__
+
+
+// Include the "simple" video editor components into the build.
+//
+// NOTE: If this flag is defined, include the following 
+// IBY files in VideoEditor.iby:
+//
+// #include <SimpleVideoEditor.iby>
+// #include <SimpleCutVideo.iby>
+// #include <VideoEditorCommon.iby>
+// #include <VideoEditorUiComponents.iby>
+// #include <VideoProvider.iby>
+//
+#define __INCLUDE_SIMPLE_VIDEO_EDITOR__
+
+
+// Change file time stamp to [original + 2 seconds]
+// before adding new video to gallery
+//
+#define __FILE_TIME_STAMP_UPDATE__
+
+// Force the application to draw video frame in playback's pause state
+// Depends on the device if this has to be defined
+//#define __GET_PAUSE_THUMBNAIL__
+
+#endif // BUILDCONFIG_HRH
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videditor/loc/SimpleVideoEditor.loc	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,512 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* This is a localisation file for Simple Video Editor.
+*
+*/
+#include <avkon.loc>
+
+
+//=============================================================================
+// ERROR NOTES
+//=============================================================================
+
+// d: Error note when inserting audio failed
+// d: audio format is not supported
+// l: popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_err_audio_format "Audio format not supported. Unable to insert."
+
+// d: Error note when there are problems with the video conversion
+// l: popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_unable_convert "Unable to convert the file. The file insertion canceled."
+
+// d: Error note when inserting video failed
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_err_unable_to_insert_video							"Unable to insert video."
+
+// d: Error note when editing video is not possible
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_err_edit						"Unable to edit. Video clip corrupted or format not supported."
+ 
+// d:Error note when inserting image failed.
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_err_unable_to_insert_image						"Unable to insert image."
+
+// d:Error note shown when merging two videos fails 
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_err_unable_to_merge_video_video 						"Unable to merge two video clips together."
+
+// d:Error note shown when merging video and image fails
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_err_unable_to_merge_video_image 					"Unable to merge video clip and image."
+
+// d:Error note shown Merge if the user selects an image
+// d:image that is in unsupported format
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_err_image_format_not_supported 					"Image format not supported. Unable to insert."
+
+// d:Error note shown when processing video and text together fails
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_err_unable_to_add_text 						"Unable to add text." 
+
+// d:Error note shown in Change sound
+// d:when processing video and audio together fails
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_err_unable_to_change_sound 					"Unable to change sound."
+
+// d:Error note shown if mmc is not accessible and
+// d:the phone contains a mass storage
+// d:Drive letter will be displayed in %U
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_mmc_not_accessible_mass_storage						"Memory card not accessible. %U Mass storage will be used instead."
+
+// d:Error note shown if mmc is not accessible and
+// d:the phone doesn't contain a mass storage
+// d:Drive letter will be displayed in %U
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_note_mmc_not_accessible_device								"Memory card not accessible. %U Device memory will be used instead."
+
+// d:Error note shown if processing video or audio fails
+// d: because of low RAM
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_sie_error_not_enough_memory		qtn_memlo_ram_out_of_mem
+
+//=============================================================================
+// PROGRESS NOTES
+//=============================================================================
+
+// d:Text in progress note 
+// d:Shown when user has selected "Changing video sound", 
+// d:"Adding text to video" or "Merge with video or image"
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_vie_note_processing "Processing video"
+
+// d:Text in progress note 
+// d:Shown when user has selected cutting function
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_vie_note_cutting "Saving video clip"
+
+// d:Text in progress note 
+// d:Shown when user has selected Snapshot function
+// l:popup_note_wait_window
+// r:5.0
+//
+#define	qtn_vie_note_saving_snapshot	"Saving snapshot to Gallery."
+
+//=============================================================================
+// OPTIONS MENU ITEMS
+//=============================================================================
+
+// d:Command in options menu
+// d:Saves the edited image
+// d:Re-used ImageEditor string.
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_save "Save"
+
+// d:Command in options menu
+// d:Takes a picture from the video clip (current frame) 
+// d:and saves it in to the memory
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_snapshot "Take snapshot"
+
+// d:Command in the Cut Video view options menu
+// d:Opens the Remove submenu.
+// l:list_single_pane_t1_cp2/opt3
+// r:5.0
+//
+#define qtn_vie_options_remove_mark "Reset mark"
+
+// d:Command in options menu
+// d:Removes both start and end marks from cutting timeline, view
+// d:returns to initial state. Only available, if both marks have been set.
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_vie_options_remove_mark_both "Both marks"
+
+// d:Command in the Remove submenu
+// d:Removes the Out mark
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_vie_options_remove_mark_end "End mark"
+
+// d:Command in the Remove submenu
+// d:Removes the In mark 
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_vie_options_remove_mark_start "Start mark"
+
+// d:Command in options menu
+// d:Inserts end mark into the current position.
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_end_mark "Set end mark"
+
+// d:Command in options menu
+// d:Inserts start mark into the current position.
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_start_mark "Set start mark"
+
+// d:Command in options menu
+// d:Stops the playback and moves playhead position to the beginning.
+// d:Re-used Media Player string
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_stop "Stop"
+
+// d:Command in options menu
+// d:Plays the marked section (between start and end marks).
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_play_marked "Play marked"
+
+// d:Command in options menu
+// d:Resumes playback.
+// d:Re-used Media Player string
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_resume "Resume"
+
+// d:Command in options menu
+// d:Starts playback.
+// d:Re-used Media Player string
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_play "Play"
+
+
+//=============================================================================
+// SIMPLE VIDEO EDITOR AIW COMMANDS
+//=============================================================================
+
+// d:Command in the AIW provider's menu
+// d:Launches Video editor's "Video sound change" functionality
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_change_sound "Change sound"
+
+// d:Command in the AIW provider's menu
+// d:Launches Video editor's "Add text" functionality
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_add_text "Add text"
+
+// d:Command in the AIW provider's menu
+// d:Launches Video editor's "Merge" functionality
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_merge "Merge"
+
+// d:Command in the AIW provider's menu
+// d:Launches Video editor's "Cut" functionality
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_options_cut "Cut"
+
+// d:Submenu title in the AIW provider's menu
+// d:Opens a submenu
+// l:list_single_pane_t1_cp2/opt3
+// r:5.0
+//
+#define qtn_vie_options_edit "Edit"
+
+// d:Command in the AIW provider's Edit submenu
+// d:Launches Video editor's "Video sound change" functionality
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_vie_options_sub_change_sound "Change sound"
+
+// d:Command in the AIW provider's Edit submenu
+// d:Launches Video editor's "Add text" functionality
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_vie_options_sub_add_text "Add text"
+
+// d:Command in the AIW provider's Edit submenu
+// d:Launches Video editor's "Merge" functionality
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_vie_options_sub_merge "Merge"
+
+// d:Command in the AIW provider's Edit submenu
+// d:Launches Video editor's "Cut" functionality
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_vie_options_sub_cut "Cut"
+
+
+//=============================================================================
+// SIMPLE VIDEO EDITOR SPECIFIC SOFTKEYS
+//=============================================================================
+
+// d:Softkey command
+// d:Softkey text if in playing state or if
+// d:user has moved the playhead with scroll left/right.
+// l:control_pane_t1/opt7
+// r:5.0
+//
+#define qtn_vie_softkey_start_mark "Start mark"
+
+// d:Softkey command
+// d:Softkey text if in playing state or if
+// d:user has moved the playhead with scroll left/right.
+// l:control_pane_t1/opt7
+// r:5.0
+//
+#define qtn_vie_softkey_end_mark "End mark"
+
+// d:Softkey command
+// d:Right softkey text if in cutting view 
+// d:Applies video cutting
+// l:control_pane_t1/opt7
+// r:5.0
+//
+#define qtn_vie_softkey_cut_done "Done"
+
+
+//=============================================================================
+// SAVING QUERY
+//=============================================================================
+
+// d:List query heading text.
+// d:This list query is used when option "Save" has been selected.
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_vie_query_heading_save "Save video:"
+
+// d:List query item in saving query.
+// d:Overwrites existing file.
+// d:Re-used Image Editor string.
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_query_save_replace "Replace original"
+
+// d:List query item in saving query.
+// d:Creates a new file.
+// d:Re-used Image Editor string.
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_query_save_new "Save with a new name"
+
+
+//=============================================================================
+// CUTTING QUERY
+//=============================================================================
+
+// d:List query heading text.
+// d:This list query is used when "Cut" has been selected from options menu
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_vie_query_heading_length "Cutting length:"
+
+// d:List query item in cutting query.
+// d:User can define him/herself cutting start and end marks
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_query_length_manual "User defined"
+
+// d:List query item in cutting query.
+// d:MMS properties define cutting length
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_query_length_mms "Multimedia message"
+
+
+//=============================================================================
+// MERGING LIST QUERY
+//=============================================================================
+
+// d:List query heading text.
+// d:This list query is used to select one video/image file
+// d:from the list of videos/images. 
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_vie_query_heading_merge_with "Merge with:"
+
+// d:Select to list the image files from the Media gallery.
+// d:(list query item)
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_query_merge_with_image "Image"
+
+// d:Select to list the video files from the Media gallery.
+// d:(list query item)
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_query_merge_with_video "Video"
+
+// d:List query heading text.
+// d:This list query is used to select where to insert selected image
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_vie_query_heading_add_image_to "Add image:"
+
+// d:List query heading text.
+// d:This list query is used to select where to insert selected video
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_vie_query_heading_add_video_to "Add video:"
+
+// d:Select if want to insert selected image/video to the beginning.
+// d:(list query item)
+// d:Used also when adding text to video
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_query_add_text_to_beginning "To the beginning"
+
+// d:Select if want to insert selected image/video to the end.
+// d:(list query item)
+// d:Used also when adding text to video
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_query_add_text_to_end "To the end"
+
+
+//=============================================================================
+// OTHER QUERY TEXTS
+//=============================================================================
+
+// d:Confirmation query text
+// d:Query is shown when user decides to send a video via MMS and the selected 
+// d:video exceeds the MMS size limitation
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_query_cut "Video too large to be sent via MMS. Cut video?" 
+
+// d:Query heading text
+// d:For the location to insert text in a video (beginning/end?)
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_vie_query_heading_add_text_to "Add text:"
+
+// d:Query heading text
+// d:Shown in the data query for adding text
+// l:popup_query_data_window
+// r:5.0
+//
+#define qtn_vie_query_heading_enter_text "Enter text:"
+
+// d:Confirmation query text
+// d:Shown when user decides to send a video via MMS and the selected video
+// d:format is not supported by MMS,
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_query_convert "Format not supported by MMS. Conversion to supported format may affect video quality. Convert and continue sending?" 
+
+// d:Confirmation query text
+// d:Shown when user tries to change video sound and selects a sound file, 
+// d:which is shorter than the selected video clip
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_query_insert_short_audio "Sound clip shorter than the video clip. Remaining part of the video will have the original audio. Change sound anyway?"
+
+// d:Confirmation query text
+// d:Shown when user tries to change video sound and selects a sound file, 
+// d:which is longer than the selected video clip 
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_query_insert_long_audio "Sound clip longer than the video clip. Remaining part of the sound will be cut. Change sound anyway?"
+
+// d:Confirmation query
+// d:When user selects "Exit", and video is modified 
+// d:user is prompted about saving the changes.
+// d:Re-used Image Editor string.
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_vie_query_conf_save_changes "Save changes?"
+
+
+//=============================================================================
+// MISCANCELLOUS
+//=============================================================================
+
+// d:Default name for the snapshot file
+// l:list_double_large_graphic_pane_t1_cp2
+// r:5.0
+//
+#define qtn_vie_default_name_snapshot "Snapshot"	
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditor_plat/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Includes all the API specific bld.inf files, which 
+* export files.
+*
+*/
+
+
+#include "../video_editor_engine_api/group/bld.inf"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditor_plat/video_editor_engine_api/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* File that exports the files belonging to 
+* Video Editor Engine API.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/VedMovie.h     MW_LAYER_PLATFORM_EXPORT_PATH(VedMovie.h)
+../inc/VedCommon.h     MW_LAYER_PLATFORM_EXPORT_PATH(VedCommon.h)
+../inc/VedCommon.inl     MW_LAYER_PLATFORM_EXPORT_PATH(VedCommon.inl)
+../inc/VedAudioClipInfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(VedAudioClipInfo.h)
+../inc/VedVideoClipInfo.h     MW_LAYER_PLATFORM_EXPORT_PATH(VedVideoClipInfo.h)
+../inc/VedVideoClipGenerator.h     MW_LAYER_PLATFORM_EXPORT_PATH(VedVideoClipGenerator.h)
+
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditor_plat/video_editor_engine_api/inc/VedAudioClipInfo.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __VEDAUDIOCLIPINFO_H__
+#define __VEDAUDIOCLIPINFO_H__
+
+#include <f32file.h>
+#include "VedCommon.h"
+
+/*
+ *  Forward declarations.
+ */
+class CVedAudioClipInfo;
+
+/**
+ * Observer for notifying that audio clip info
+ * is ready for reading.
+ *
+ * @see  CVedAudioClipInfo
+ */
+class MVedAudioClipInfoObserver 
+    {
+public:
+    /**
+     * Called to notify that audio clip info is ready
+     * for reading.
+     *
+     * Possible error codes:
+     *  - <code>KErrNotFound</code> if there is no file with the specified name
+     *    in the specified directory (but the directory exists)
+     *  - <code>KErrPathNotFound</code> if the specified directory
+     *    does not exist
+     *  - <code>KErrUnknown</code> if the specified file is of unknown type
+     *
+     * @param aInfo   audio clip info
+     * @param aError  <code>KErrNone</code> if info is ready
+     *                for reading; one of the system wide
+     *                error codes if reading file failed
+     */
+    virtual void NotifyAudioClipInfoReady(CVedAudioClipInfo& aInfo, 
+                                          TInt aError) = 0;
+    };
+
+
+/**
+ * Observer for audio clip visualization.
+ *
+ * @see  CVedAudioClipInfo
+ */
+class MVedAudioClipVisualizationObserver
+    {
+public:
+
+    /**
+     * Called to notify that audio clip visualization has been started. 
+     * 
+     * @param aInfo  audio clip info
+     */
+    virtual void NotifyAudioClipVisualizationStarted(const CVedAudioClipInfo& aInfo) = 0;
+
+    /**
+     * Called to inform about the current progress of the audio clip visualization.
+     *
+     * @param aInfo        audio clip info
+     * @param aPercentage  percentage of the operation completed, must be 
+       *                     in range 0..100
+     */
+    virtual void NotifyAudioClipVisualizationProgressed(const CVedAudioClipInfo& aInfo, 
+                                                        TInt aPercentage) = 0;
+
+    /**
+     * Called to notify that audio clip visualization has been completed. 
+     * Note that if the visualization was successfully completed, the ownership 
+     * of the visualization array is passed to the observer and the observer is 
+     * responsible for freeing the array).
+     * 
+     * @param aInfo           audio clip info
+     * @param aError          <code>KErrNone</code> if visualization was
+     *                          completed successfully; one of the system wide
+     *                          error codes if generating visualization failed
+     * @param aVisualization  pointer to the array containing the visualization values;
+     *                        note that the ownership of the array is passed to the
+     *                        observer (i.e., the observer is responsible for freeing
+     *                        the array); or 0, if generating the visualization failed
+     * @param aResolution     resolution of the visualization (i.e., the number of values
+     *                        in the visualization array); or 0, if generating the 
+     *                        visualization failed
+     */
+    virtual void NotifyAudioClipVisualizationCompleted(const CVedAudioClipInfo& aInfo, 
+                                                       TInt aError, TInt8* aVisualization,
+                                                       TInt aResolution) = 0;
+    };
+
+    
+/**
+ * Utility class for getting information about audio clip files.
+ *
+ */
+class CVedAudioClipInfo : public CBase
+    {
+public:
+
+    /* Constructors & destructor. */
+
+    /**
+     * Constructs a new CVedAudioClipInfo object to get information
+     * about the specified audio clip file. The specified observer
+     * is notified when info is ready for reading. This method
+     * may leave if no resources are available to construct 
+     * a new object.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFileName  name of audio clip file
+     * @param aObserver  observer to notify when info is ready for reading
+     *
+     * @return  pointer to a new CVedAudioClipInfo instance
+     */
+    IMPORT_C static CVedAudioClipInfo* NewL(const TDesC& aFileName,
+                                            MVedAudioClipInfoObserver& aObserver);
+
+    /**
+     * Constructs a new CVedAudioClipInfo object to get information
+     * about the specified audio clip file. The constructed object
+     * is left in the cleanup stack. The specified observer
+     * is notified when info is ready for reading. This method
+     * may leave if no resources are available to construct a new
+     * object.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFileName  name of audio clip file
+     * @param aObserver  observer to notify when info is ready for reading
+     *
+     * @return  pointer to a new CVedAudioClipInfo instance
+     */
+    IMPORT_C static CVedAudioClipInfo* NewLC(const TDesC& aFileName,
+                                             MVedAudioClipInfoObserver& aObserver);
+
+    /* Property methods. */
+
+    /**
+     * Returns the file name of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  file name
+     */
+    virtual TPtrC FileName() const = 0;
+
+    /**
+     * Returns the audio type of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  audio type
+     */
+    virtual TVedAudioType Type() const = 0;
+
+    /**
+     * Returns the duration of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  duration in microseconds
+     */
+    virtual TTimeIntervalMicroSeconds Duration() const = 0;
+
+    /**
+     * Returns the channel mode of the audio if applicable.
+     *
+     * @return  channel mode
+     */
+    virtual TVedAudioChannelMode ChannelMode() const = 0;
+
+    /**
+     * Returns the audio format of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  audio format of the clip
+     */
+    virtual TVedAudioFormat Format() const = 0;
+
+    /**
+     * Returns the sampling rate in hertz.
+     *
+     * @return  sampling rate
+     */
+    virtual TInt SamplingRate() const = 0;
+
+    /**
+     * Returns the bitrate mode.
+     *
+     * @return  bitrate mode
+     */
+    virtual TVedBitrateMode BitrateMode() const = 0;
+
+    /**
+     * Returns the bitrate.
+     *
+     * @return  bitrate in bits per second
+     */
+    virtual TInt Bitrate() const = 0;
+
+    /* Visualization methods. */
+
+    /**
+     * Generates a visualization of the audio clip. The visualization consists
+     * of an array of values with the specified resolution. This method is 
+     * asynchronous. The visualization is generated in background and the observer 
+     * is notified when the visualization is complete. This method panics if info 
+     * is not yet ready for reading or the resolution is illegal.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aObserver    observer to be notified when the visualization is completed
+     * @param aResolution  resolution of the visualization (i.e., the number of values
+     *                     in the visualization array)
+     * @param aPriority    priority of the visualization
+     */
+    virtual void GetVisualizationL(MVedAudioClipVisualizationObserver& aObserver,
+                                   TInt aResolution, TInt aPriority) = 0;
+    
+    /**
+     * Cancels visualization generation. If no visualization is currently being 
+     * generated, the function does nothing.
+     */
+    virtual void CancelVisualizationL() = 0;
+    
+     /**
+     * Constructs a new CVedAudioClipInfo object to get information
+     * about the specified audio clip file. The specified observer
+     * is notified when info is ready for reading. This method
+     * may leave if no resources are available to construct 
+     * a new object.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFileHandle handle of audio clip file
+     * @param aObserver  observer to notify when info is ready for reading
+     *
+     * @return  pointer to a new CVedAudioClipInfo instance
+     */
+    IMPORT_C static CVedAudioClipInfo* NewL(RFile* aFileHandle,
+                                            MVedAudioClipInfoObserver& aObserver);
+
+    /**
+     * Constructs a new CVedAudioClipInfo object to get information
+     * about the specified audio clip file. The constructed object
+     * is left in the cleanup stack. The specified observer
+     * is notified when info is ready for reading. This method
+     * may leave if no resources are available to construct a new
+     * object.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *     
+     * @param aFileHandle handle of audio clip file
+     * @param aObserver  observer to notify when info is ready for reading
+     *
+     * @return  pointer to a new CVedAudioClipInfo instance
+     */
+    IMPORT_C static CVedAudioClipInfo* NewLC(RFile* aFileHandle,
+                                             MVedAudioClipInfoObserver& aObserver);
+                                             
+     /**
+     * Returns the file handle of the clip. Panics if there is no file 
+     * associated with this clip or info is not yet ready for reading.
+     * 
+     * @return  file name of the clip
+     */
+    virtual RFile* FileHandle() const = 0;
+    
+    
+    };
+
+#endif // __VEDAUDIOCLIPINFO_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditor_plat/video_editor_engine_api/inc/VedCommon.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,349 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#ifndef __VEDCOMMON_H__
+#define __VEDCOMMON_H__
+
+#include <e32std.h>
+
+
+/**
+ * Constants for video clip speed settings. The speed is given by % x10, i.e. 1000 means 100 %.
+ */
+const TInt KVedNormalSpeed(1000);
+const TInt KVedMaxSpeed(1000);
+const TInt KVedMinSpeed(1);
+
+
+/**
+ * Enumeration for video clip classes.
+ */
+enum TVedVideoClipClass
+    {
+    EVedVideoClipClassFile = 15001,
+    EVedVideoClipClassGenerated
+    };
+
+
+/**
+ * Enumeration for bitrate modes.
+ */
+enum TVedBitrateMode
+	{
+	EVedBitrateModeUnrecognized = 18001,
+	EVedBitrateModeConstant,
+	EVedBitrateModeVariable,
+	EVedBitrateModeLast  // should always be the last one
+	};
+
+/**
+ * Enumeration for video bitstream modes.
+ */
+enum TVedVideoBitstreamMode
+    {
+    EVedVideoBitstreamModeUnknown = 0,          /* unrecognized mode; outside of H.263 Profile 0 Level 10, or MPEG-4 Visual Simple Profile */
+    EVedVideoBitstreamModeH263,                 /* H.263 Simple Profile (Profile 0, Level 10) */                                    
+    EVedVideoBitstreamModeMPEG4ShortHeader,     /* MPEG-4 Visual Simple Profile - Short Header */
+    EVedVideoBitstreamModeMPEG4Regular,         /* MPEG-4 Visual Simple Profile - Regular */
+    EVedVideoBitstreamModeMPEG4Resyn,           /* MPEG-4 Visual Simple Profile - Regular with Resynchronization Markers */
+    EVedVideoBitstreamModeMPEG4DP,              /* MPEG-4 Visual Simple Profile - Data Partitioned */
+    EVedVideoBitstreamModeMPEG4DP_RVLC,         /* MPEG-4 Visual Simple Profile - Data Partitioned with Reversible VLCs */
+    EVedVideoBitstreamModeMPEG4Resyn_DP,        /* MPEG-4 Visual Simple Profile - Data Partitioned with Resynchronization Markers */
+    EVedVideoBitstreamModeMPEG4Resyn_DP_RVLC,   /* MPEG-4 Visual Simple Profile - Data Partitioned with Reversible VLCs & Resynchronization Markers */
+    EVedVideoBitstreamModeAVC
+    };
+
+
+
+/* Video format of bitstream - used everywhere */
+enum TVedVideoType
+    {
+    EVedVideoTypeUnrecognized = 13001,  /* should always be the first one */
+    EVedVideoTypeNoVideo,               /* video is not present */
+    EVedVideoTypeH263Profile0Level10,   /* H.263 Simple Profile (Profile 0, Level 10) */
+    EVedVideoTypeH263Profile0Level45,   /* H.263 Simple Profile (Profile 0, Level 45) */
+    EVedVideoTypeMPEG4SimpleProfile,    /* MPEG-4 Visual Simple Profile (any mode) */
+    EVedVideoTypeAVCBaselineProfile,    /* AVC Baseline Profile */
+    EVedVideoTypeLast                   /* should always be the last one */
+    };
+	
+/**
+ * Enumeration for video formats.
+ */
+enum TVedVideoFormat
+    {
+    EVedVideoFormatUnrecognized = 11001,  // should always be the first one
+    EVedVideoFormat3GPP,
+    EVedVideoFormatMP4,
+    EVedVideoFormatLast  // should always be the last one
+    };
+
+/**
+ * Enumeration for audio formats.
+ */
+enum TVedAudioFormat
+	{
+	EVedAudioFormatUnrecognized = 16001,  // should always be the first one
+	EVedAudioFormat3GPP,
+	EVedAudioFormatMP4,
+	EVedAudioFormatAMR,
+	EVedAudioFormatAMRWB,
+	EVedAudioFormatMP3,
+	EVedAudioFormatAAC_ADIF,
+	EVedAudioFormatAAC_ADTS,
+	EVedAudioFormatWAV,
+	EVedAudioFormatLast  // should always be the last one
+	};
+
+
+/**
+ * Enumeration for audio types (that is, codecs).
+ */
+enum TVedAudioType
+    {
+    EVedAudioTypeUnrecognized = 14001,  // should always be the first one
+    EVedAudioTypeNoAudio,
+    EVedAudioTypeAMR,
+    EVedAudioTypeAMRWB,
+    EVedAudioTypeMP3,
+    EVedAudioTypeAAC_LC,
+    EVedAudioTypeAAC_LTP,
+    EVedAudioTypeWAV,
+    EVedAudioTypeLast  // should always be the last one
+    };
+
+/**
+ * Enumeration for audio channel modes.
+ */
+enum TVedAudioChannelMode
+    {
+    EVedAudioChannelModeUnrecognized = 17001,
+    EVedAudioChannelModeStereo,
+    EVedAudioChannelModeDualChannel,
+    EVedAudioChannelModeSingleChannel
+    };
+
+/**
+ * Output parameter class
+ */ 
+
+class TVedOutputParameters
+    {
+    public:
+        // default constructor; initializes optional parameters to values which mean that editor can decide the value
+        inline TVedOutputParameters() 
+        : iVideoType(EVedVideoTypeH263Profile0Level10), iVideoResolution(TSize(0,0)), iVideoBitrate(0), iVideoFrameRate(0), 
+        iAudioType(EVedAudioTypeAMR), iAudioBitrate(0), iAudioChannelMode(EVedAudioChannelModeSingleChannel), iAudioSamplingRate(0), 
+        iSyncIntervalInPicture(0), iSegmentSizeInBytes(0)
+            {}
+            
+    public:
+
+        // video codec
+        TVedVideoType iVideoType;
+        // target resolution, 0 = no preference (use from input)
+        TSize iVideoResolution;
+        // target video bitrate, 0 = no preference
+        TInt iVideoBitrate;
+        // target video framerate, 0 = no preference
+        TReal iVideoFrameRate;
+
+        // audio codec
+        TVedAudioType iAudioType;
+        // target audio bitrate, 0 = no preference
+        TInt iAudioBitrate;
+        // audio channel mode
+        TVedAudioChannelMode iAudioChannelMode;
+        // audio sampling rate, 0 = no preference
+        TInt iAudioSamplingRate;
+        
+        // Segment interval in picture. In H.263 baseline this means number of non-empty GOB headers (1=every GOB has a header), 
+        // Default is 0 == no segments inside picture
+        // Coding standard & used profile etc. limit the value.
+        TInt iSyncIntervalInPicture;
+        
+        // Target size of each coded video segment. Valid for H.264 and MPEG-4
+        // Default is 0 == no segments inside picture
+        TInt iSegmentSizeInBytes;
+        
+    };
+
+
+/**
+ * Enumeration for start transition effects.
+ */
+enum TVedStartTransitionEffect
+    {
+    EVedStartTransitionEffectNone = 21001,  // should always be the first one
+    EVedStartTransitionEffectFadeFromBlack,
+    EVedStartTransitionEffectFadeFromWhite,
+    EVedStartTransitionEffectLast  // should always be the last one
+    };
+
+
+/**
+ * Enumeration for middle transition effects.
+ */
+enum TVedMiddleTransitionEffect
+    {
+    EVedMiddleTransitionEffectNone = 22001,  // should always be the first one
+    EVedMiddleTransitionEffectDipToBlack,
+    EVedMiddleTransitionEffectDipToWhite,
+    EVedMiddleTransitionEffectCrossfade,
+    EVedMiddleTransitionEffectWipeLeftToRight,
+    EVedMiddleTransitionEffectWipeRightToLeft,
+    EVedMiddleTransitionEffectWipeTopToBottom,
+    EVedMiddleTransitionEffectWipeBottomToTop,
+    EVedMiddleTransitionEffectLast           // should always be the last one
+    };
+
+    
+/**
+ * Enumeration for end transition effects.
+ */
+enum TVedEndTransitionEffect
+    {
+    EVedEndTransitionEffectNone = 23001,  // should always be the first one
+    EVedEndTransitionEffectFadeToBlack,
+    EVedEndTransitionEffectFadeToWhite,
+    EVedEndTransitionEffectLast  // should always be the last one
+    };
+
+    
+/**
+ * Enumeration for color effects.
+ */
+enum TVedColorEffect
+    {
+    EVedColorEffectNone = 31001,  // should always be the first one
+    EVedColorEffectBlackAndWhite,
+    EVedColorEffectToning,
+    EVedColorEffectLast  // should always be the last one
+    };
+
+
+/**
+ * Class for storing dynamic level marks.
+ */
+class TVedDynamicLevelMark 
+    {
+public:
+    /** Mark time. */
+    TTimeIntervalMicroSeconds iTime;
+
+    /** 
+     * Dynamic level (-63.5 - +12.7) in dB:s; one step represents +0.1 or -0.5 dB => values are -127...+127
+     */
+    TInt8 iLevel;
+
+    /**
+     * Constructs a new dynamic level mark.
+     * 
+     * @param aTime   time for the mark
+     * @param aLevel  dynamic level (-63.5 ... +12.7) in dB:s one step = +0.1 or -0.5 dB => values can be -127...+127
+     */
+    inline TVedDynamicLevelMark(TTimeIntervalMicroSeconds aTime, TInt aLevel);
+
+    /**
+     * Constructs a new dynamic level mark from existing instance.
+     * 
+     * @param aMark  dynamic level mark to copy
+     */
+    inline TVedDynamicLevelMark(const TVedDynamicLevelMark& aMark);
+    };	
+
+
+/**
+ * Transcode factor.
+ */
+struct TVedTranscodeFactor
+    {
+    TInt iTRes;
+    TVedVideoBitstreamMode iStreamType;
+    };
+
+
+/**
+ * Enumerates video editor engine panic codes and 
+ * provides a static Panic() function.
+ *
+ */
+class TVedPanic
+    {
+public:
+    enum TVedPanicCodes 
+        {
+        EInternal = 1,  // internal error (that is, a  in the video editor engine)
+        EDeprecated,    // deprecated class or method
+        EVideoClipInfoNotReady,
+        EVideoClipInfoIllegalVideoFrameIndex,
+        EVideoClipInfoIllegalVideoFrameTime,
+        EVideoClipInfoFrameOperationAlreadyRunning,
+        EVideoClipInfoIllegalFrameResolution,
+        EVideoClipInfoNoFileAssociated,
+        EVideoClipInfoNoGeneratorAssociated,
+        EAudioClipInfoNotReady,  //10
+        EMovieEmpty,
+        EMovieAddOperationAlreadyRunning,
+        EMovieIllegalStartTransitionEffect,
+        EMovieIllegalMiddleTransitionEffect,
+        EMovieIllegalEndTransitionEffect,
+        EMovieProcessingOperationAlreadyRunning,
+        EMovieObserverAlreadyRegistered,
+        EMovieObserverNotRegistered,
+        EMovieIllegalQuality,
+        EVideoClipIllegalIndex, //20
+        EVideoClipIllegalSpeed, 
+        EVideoClipIllegalColorEffect,
+        EVideoClipIllegalCutInTime,
+        EVideoClipIllegalCutOutTime,
+        EVideoClipNoFileAssociated,
+        EAudioClipIllegalStartTime,
+        EAudioClipIllegalCutInTime,
+        EAudioClipIllegalCutOutTime,
+        EVideoClipGeneratorNotInserted,
+        EVideoClipGeneratorNotReady,//30
+        EVideoClipGeneratorAlreadyInserted,
+        EVideoClipGeneratorIllegalVideoFrameIndex,
+        EVideoClipGeneratorIllegalDuration,
+        EVideoClipGeneratorIllegalFrameResolution,
+        EVideoClipGeneratorIllegalVideoFrameTime,
+        EImageClipGeneratorIllegalMaxResolution,
+        EImageClipGeneratorNotReady,
+        EImageClipGeneratorFrameOperationAlreadyRunning,
+        ETitleClipGeneratorIllegalMaxResolution,
+        ETitleClipGeneratorIllegalMaxFramerate,//40
+        ETitleClipGeneratorFrameOperationAlreadyRunning,
+        EIllegalDynamicLevelMark,
+        EIllegalDynamicLevelMarkIndex,
+        EVideoClipGeneratorNotOveray,
+        EAnimationClipGeneratorNotReady
+        };
+
+public:
+    inline static void Panic(TInt aPanic);
+    };
+
+
+#include "VedCommon.inl"
+
+#endif // __VEDCOMMON_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditor_plat/video_editor_engine_api/inc/VedCommon.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+#ifndef __VEDCOMMON_INL__
+#define __VEDCOMMON_INL__
+
+
+inline void TVedPanic::Panic(TInt aPanic)
+    {
+    _LIT(KVedPanicCategory, "VIDEO EDITOR ENG");
+
+    User::Panic(KVedPanicCategory, aPanic);
+    }
+
+inline TVedDynamicLevelMark::TVedDynamicLevelMark(TTimeIntervalMicroSeconds aTime, TInt aLevel) 
+    {
+    iTime = aTime;
+    if ( aLevel < -127 )    // level is TInt8 with 0.5 dB steps
+        {
+        iLevel = -127;
+        }
+    else if (aLevel > 127 )
+        {
+        iLevel = 127;
+        }
+    else
+        {
+        iLevel = TInt8(aLevel);
+        }
+    }
+    
+inline TVedDynamicLevelMark::TVedDynamicLevelMark(const TVedDynamicLevelMark& aMark) 
+    {
+    iTime = aMark.iTime;
+    iLevel = aMark.iLevel;
+    }
+
+#endif //__VEDCOMMON_INL__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditor_plat/video_editor_engine_api/inc/VedMovie.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1308 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+  
+
+#ifndef __VEDMOVIE_H__
+#define __VEDMOVIE_H__
+
+/*
+ *  Constant definitions.
+ */
+#define KVedAudioClipOriginalDuration TTimeIntervalMicroSeconds(-1)
+
+const TInt KVedClipIndexAll(-1);
+
+#include <e32base.h>
+#include <f32file.h>
+#include "VedVideoClipInfo.h"
+#include "VedAudioClipInfo.h"
+
+class CVedMovie;
+class TVedDynamicLevelMark;
+
+/**
+ * Observer for movie events. 
+ * <p>
+ * Note that every change operation that is made to a movie or the clips it consists of 
+ * results in a maximum of one notification method called (that is, more than one 
+ * notification method is never called as a result of a single change). For example,
+ * changing the index of a clip results in the <code>NotifyVideoClipIndicesChanged()</code>
+ * method being called once. The <code>NotifyVideoClipTimingsChanged()</code> method is not 
+ * called even if the timings of several clips may have changed as a result. See the
+ * descriptions of the notification methods for more detailed information.
+ *
+ * @see  CVedMovie
+ */
+class MVedMovieObserver 
+    {
+public:
+
+    /**
+     * Called to notify that a new video clip has been successfully
+     * added to the movie. Note that the indices and the start and end times
+     * of the video clips after the new clip have also changed as a result.
+     * Note that the transitions may also have changed. 
+     *
+     * @param aMovie  movie
+     * @param aIndex  index of video clip in movie
+     */
+    virtual void NotifyVideoClipAdded(CVedMovie& aMovie, TInt aIndex) = 0;
+
+    /**
+     * Called to notify that adding a new video clip to the movie has failed.
+     *
+     * Possible error codes:
+     *  - <code>KErrNotFound</code> if there is no file with the specified name
+     *    in the specified directory (but the directory exists)
+     *  - <code>KErrPathNotFound</code> if the specified directory
+     *    does not exist
+     *  - <code>KErrUnknown</code> if the specified file is of unknown format
+     *  - <code>KErrNotSupported</code> if the format of the file is recognized but
+     *    adding it to the movie is not supported (e.g., it is of different resolution
+     *    or format than the other clips)
+     *
+     * @param aMovie  movie
+     * @param aError  one of the system wide error codes
+     */
+    virtual void NotifyVideoClipAddingFailed(CVedMovie& aMovie, TInt aError) = 0;
+
+    /**
+     * Called to notify that a video clip has been removed from the movie.
+     * Note that the indices and the start and end times of the video clips after 
+     * the removed clip have also changed as a result. Note that the 
+     * transitions may also have changed.
+     *
+     * @param aMovie  movie
+     * @param aIndex  index of the removed video clip
+     */
+    virtual void NotifyVideoClipRemoved(CVedMovie& aMovie, TInt aIndex) = 0;
+    
+    /**
+     * Called to notify that a video clip has moved (that is, its index and 
+     * start and end times have changed). Note that the indices and the start and
+     * end times of the clips between the old and new indices have also changed 
+     * as a result. Note that the transitions may also have changed.
+     *
+     * @param aMovie     movie
+     * @param aOldIndex  old index of the moved clip
+     * @param aNewIndex  new index of the moved clip
+     */
+    virtual void NotifyVideoClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
+                                               TInt aNewIndex) = 0;
+
+    /**
+     * Called to notify that the timings (that is, the cut in or cut out time or
+     * the speed and consequently the end time, edited duration, and possibly audio
+     * settings) of a video clip have changed (but the index of the clip has 
+     * <em>not</em> changed). Note that the start and end times of the video clips 
+     * after the changed clip have also changed.
+     *
+     * @param aMovie  movie
+     * @param aClip   changed video clip
+     */
+    virtual void NotifyVideoClipTimingsChanged(CVedMovie& aMovie,
+                                               TInt aIndex) = 0;
+
+    /**
+     * Called to notify that the color effect or a color tone of the existing effect
+     * of a video clip has changed.
+     *
+     * @param aMovie  movie
+     * @param aClip   changed video clip
+     */
+    virtual void NotifyVideoClipColorEffectChanged(CVedMovie& aMovie,
+                                                   TInt aIndex) = 0;
+    
+    /**
+     * Called to notify that the audio settings of a video clip have changed. 
+     *
+     * @param aMovie  movie
+     * @param aClip   changed video clip
+     */
+    virtual void NotifyVideoClipAudioSettingsChanged(CVedMovie& aMovie,
+                                                     TInt aIndex) = 0;
+
+    /**
+     * Called to notify that some generator-specific settings of 
+     * a generated video clip have changed.
+     *
+     * @param aMovie  movie
+     * @param aClip   changed video clip
+     */
+    virtual void NotifyVideoClipGeneratorSettingsChanged(CVedMovie& aMovie,
+                                                         TInt aIndex) = 0;
+
+    /**
+     * Called to notify that the descriptive name of a clip has changed. 
+     *
+     * @param aMovie  movie
+     * @param aIndex  changed video clip index
+     */
+    virtual void NotifyVideoClipDescriptiveNameChanged(CVedMovie& aMovie,
+                                                                TInt aIndex) = 0;
+
+    /**
+     * Called to notify that the start transition effect of the movie
+     * has changed (but no other changes have occurred).
+     *
+     * @param aMovie  movie
+     */
+    virtual void NotifyStartTransitionEffectChanged(CVedMovie& aMovie) = 0;
+
+    /**
+     * Called to notify that a middle transition effect has changed 
+     * (but no other changes have occurred).
+     *
+     * @param aMovie  movie
+     * @param aIndex  index of the changed middle transition effect
+     */
+    virtual void NotifyMiddleTransitionEffectChanged(CVedMovie& aMovie, 
+                                                     TInt aIndex) = 0;
+
+    /**
+     * Called to notify that the end transition effect of the movie
+     * has changed (but no other changes have occurred).
+     *
+     * @param aMovie  movie
+     */
+    virtual void NotifyEndTransitionEffectChanged(CVedMovie& aMovie) = 0;
+
+    /**
+     * Called to notify that a new audio clip has been successfully
+     * added to the movie. Note that the indices of the audio clips
+     * starting after the new clip have also changed as a result.
+     *
+     * @param aMovie  movie
+     * @param aClip   new audio clip
+     */
+    virtual void NotifyAudioClipAdded(CVedMovie& aMovie, TInt aIndex) = 0;
+
+    /**
+     * Called to notify that adding a new audio clip to the movie has failed.
+     *
+     * Possible error codes:
+     *  - <code>KErrNotFound</code> if there is no file with the specified name
+     *    in the specified directory (but the directory exists)
+     *  - <code>KErrPathNotFound</code> if the specified directory
+     *    does not exist
+     *  - <code>KErrUnknown</code> if the specified file is of unknown format
+     *
+     * @param aMovie  movie
+     * @param aError  one of the system wide error codes
+     */
+    virtual void NotifyAudioClipAddingFailed(CVedMovie& aMovie, TInt aError) = 0;
+
+    /**
+     * Called to notify that an audio clip has been removed from the movie.
+     * Note that the indices of the audio clips starting after the removed
+     * clip have also changed as a result.
+     *
+     * @param aMovie  movie
+     * @param aIndex  index of the removed audio clip
+     */
+    virtual void NotifyAudioClipRemoved(CVedMovie& aMovie, TInt aIndex) = 0;
+
+    /**
+     * Called to notify that an audio clip has moved (that is, its
+     * index has changed). This may happen when the start time of the audio 
+     * clip is changed. Note that the indices of the clips between the old and 
+     * new indices have also changed as a result.
+     *
+     * @param aMovie     movie
+     * @param aOldIndex  old index of the moved clip
+     * @param aNewIndex  new index of the moved clip
+     */
+    virtual void NotifyAudioClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, 
+                                               TInt aNewIndex) = 0;
+
+    /**
+     * Called to notify that the timings (for example, the start time or
+     * the duration) of an audio clip have changed (but the index of the
+     * clip has <em>not</em> changed as a result).
+     *
+     * @param aMovie  movie
+     * @param aClip   changed audio clip
+     */
+    virtual void NotifyAudioClipTimingsChanged(CVedMovie& aMovie,
+                                               TInt aIndex) = 0;
+
+    /**
+     * Called to notify that the quality setting of the movie has been
+     * changed.
+     *
+     * @param aMovie  movie
+     */
+    virtual void NotifyMovieQualityChanged(CVedMovie& aMovie) = 0;
+
+    /**
+     * Called to notify that the movie has been reseted.
+     *
+     * @param aMovie  movie
+     */
+    virtual void NotifyMovieReseted(CVedMovie& aMovie) = 0;
+    
+    /**
+     * Called to notify that the output parameters have been changed
+     *
+     * @param aMovie  movie
+     */
+    virtual void NotifyMovieOutputParametersChanged(CVedMovie& aMovie) = 0;
+    
+    /**
+     * Called to notify that a dynamic level mark has been inserted 
+     * to an audio clip.
+     *
+     * @param aMovie       movie
+     * @param aClipIndex   audio clip index
+     * @param aMarkIndex   index of the inserted level mark
+     */
+    virtual void NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex) = 0;
+
+    /**
+     * Called to notify that a dynamic level mark has been inserted 
+     * to an audio clip.
+     *
+     * @param aMovie       movie
+     * @param aClipIndex   audio clip index
+     * @param aMarkIndex   index of the inserted level mark
+     */
+    virtual void NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
+                                                        TInt aClipIndex, 
+                                                        TInt aMarkIndex) = 0;
+
+    /**
+     * Called to notify that a dynamic level mark has been inserted 
+     * to an audio clip.
+     *
+     * @param aMovie       movie
+     * @param aClipIndex   audio clip index
+     * @param aMarkIndex   index of the inserted level mark
+     */
+    virtual void NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& aMovie, 
+                                                         TInt aClipIndex, 
+                                                         TInt aMarkIndex) = 0;
+
+    /**
+     * Called to notify that a dynamic level mark has been inserted 
+     * to an audio clip.
+     *
+     * @param aMovie       movie
+     * @param aClipIndex   audio clip index
+     * @param aMarkIndex   index of the inserted level mark
+     */
+    virtual void NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& aMovie, 
+                                                        TInt aClipIndex, 
+                                                        TInt aMarkIndex) = 0;    
+    };
+
+
+/**
+ * Observer for movie processing operations. 
+ *
+ * 
+ * @see  CVedMovie
+ */
+class MVedMovieProcessingObserver
+    {
+public:
+    /**
+     * Called to notify that a new movie processing operation has been started. 
+     *
+     * @param aMovie  movie
+     */
+    virtual void NotifyMovieProcessingStartedL(CVedMovie& aMovie) = 0;
+
+    /**
+     * Called to inform about the current progress of the movie processing operation.
+     *
+     * @param aMovie       movie
+     * @param aPercentage  percentage of the operation completed, must be 
+     *                     in range 0..100
+     */
+    virtual void NotifyMovieProcessingProgressed(CVedMovie& aMovie, TInt aPercentage) = 0;
+
+    /**
+     * Called to notify that the movie processing operation has been completed. 
+     * 
+     * @param aMovie  movie
+     * @param aError  error code why the operation was completed. 
+     *                <code>KErrNone</code> if the operation was completed 
+     *                successfully.
+     */
+    virtual void NotifyMovieProcessingCompleted(CVedMovie& aMovie, TInt aError) = 0;
+    };
+
+
+/**
+ * Video movie, which consists of zero or more video clips and zero or more audio clips.
+ * 
+ * @see  CVedVideoClip
+ * @see  CVedAudioClip
+ */
+class CVedMovie : public CBase
+    {
+public:
+
+    /**
+     * Enumeration for movie quality settings.
+     */
+    enum TVedMovieQuality
+        {
+        EQualityAutomatic = 0,
+        EQualityMMSInteroperability,
+        EQualityResolutionCIF,      // Obsolete, please use Medium/High instead
+        EQualityResolutionQCIF,     // Obsolete, please use Medium/High instead
+        EQualityResolutionMedium,
+        EQualityResolutionHigh,        
+        EQualityLast  // this should always be the last
+        };
+
+
+public:
+
+    /* Constructors & destructor. */
+
+    /**
+     * Constructs a new empty CVedMovie object. May leave if no resources are available.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFs  file server session to use to lock the video and audio
+     *             clip files of the new movie; or NULL to not to lock the files
+     *
+     * @return  pointer to a new CVedMovie instance
+     */
+    IMPORT_C static CVedMovie* NewL(RFs* aFs);
+
+    /**
+     * Constructs a new empty CVedMovie object and leaves the object in the cleanup stack.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     * 
+     * @param aFs  file server session to use to lock the video and audio
+     *             clip files of the new movie; or NULL to not to lock the files
+     *
+     * @return  pointer to a new CVedMovie instance
+     */
+    IMPORT_C static CVedMovie* NewLC(RFs* aFs);
+
+    /* Property methods. */
+
+    /**
+     * Returns the quality setting of this movie.
+     *
+     * @return  quality setting of this movie
+     */
+    virtual TVedMovieQuality Quality() const = 0;
+
+    /**
+     * Sets the quality setting of this movie.
+     *
+     * @param aQuality  quality setting
+     */
+    virtual void SetQuality(TVedMovieQuality aQuality) = 0;
+
+    /**
+     * Returns the video format of this movie. 
+     * 
+     * @return  video format of this movie
+     */
+    virtual TVedVideoFormat Format() const = 0;
+
+    /**
+     * Returns the video type of this movie. 
+     * 
+     * @return  video type of this movie
+     */
+    virtual TVedVideoType VideoType() const = 0;
+
+    /**
+     * Returns the resolution of this movie. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no clips 
+     * in the movie.
+     * 
+     * @return  resolution of the movie
+     */
+    virtual TSize Resolution() const = 0;
+
+    /**
+     * Returns the recommended maximum framerate of this movie..
+     * <p>
+     * Note that the returned maximum framerate is a recommendation,
+     * not a guarantee. For example, the video clip generators inserted
+     * in this movie should not generate frames at higher framerates 
+     * than the recommendation. The movie may, however, exceed this
+     * framerate (for example, if the framerates of some of the video
+     * clips are higher than the recommendation and it is not possible
+     * to drop the framerate).
+     *
+     * @return  maximum framerate in frames per second
+     */
+    virtual TInt MaximumFramerate() const = 0;
+
+    /**
+     * Returns the audio type of the movie audio track.
+     * 
+     * @return  audio type of the movie audio track
+     */
+    virtual TVedAudioType AudioType() const = 0;
+
+    /**
+     * Returns the audio sampling rate of the movie audio track.
+     *
+     * @return  audio sampling rate of the movie audio track.
+     */
+    virtual TInt AudioSamplingRate() const = 0;
+
+    /**
+     * Returns the audio channel mode of the movie audio track.
+     * 
+     * @return  audio channel mode of the movie audio track.
+     */
+    virtual TVedAudioChannelMode AudioChannelMode() const = 0;
+
+    /**
+     * Returns the total duration of this movie.
+     * 
+     * @return  duration in microseconds
+     */
+    virtual TTimeIntervalMicroSeconds Duration() const = 0;
+
+    /**
+     * Returns an estimate of the total size of this movie.
+     * 
+     * @return  size estimate in bytes
+     */
+    virtual TInt GetSizeEstimateL() const = 0;
+
+    /**
+     * Estimates end cutpoint with given target size and start cutpoint for current movie.
+     *
+     * @param aTargetSize  Target filesize for section indicated by aStartTime and aEndTime.
+     * @param aStartTime   Start time for first frame included in cutted section. 
+     * @param aEndTime     On return contains estimated end time for given target size and start cutpoint for current movie..
+     */
+    virtual void GetDurationEstimateL(TInt aTargetSize, TTimeIntervalMicroSeconds aStartTime, TTimeIntervalMicroSeconds& aEndTime) = 0;
+
+    /**
+     * Returns whether movie properties meet MMS compatibility
+     * 
+     * @return  ETrue if MMS compatible, else EFalse
+     */
+    virtual TBool IsMovieMMSCompatible() const = 0;
+
+    /* Video clip management methods. */
+
+    /**
+     * Returns the number of video clips in this movie.
+     *
+     * @return  number of video clips
+     */
+    virtual TInt VideoClipCount() const = 0;
+
+    /** 
+     * Inserts a video clip from the specified file to the specified index 
+     * in this movie. The observers are notified when the clip has been added 
+     * or adding clip has failed. Panics with <code>EMovieAddOperationAlreadyRunning</code> 
+     * if another add video or audio clip operation is already running.
+     * Panics with code <code>USER-130</code> if the clip index is invalid.
+     * The file will be opened in EFileShareReadersOnly mode by default, 
+     * and the same mode should be used by the client too if it need to open
+     * the file at the same time.
+     *  
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFileName  file name of the clip to add
+     * @param aIndex     index the clip should be inserted at
+     */
+    virtual void InsertVideoClipL(const TDesC& aFileName, TInt aIndex) = 0;
+
+    /** 
+     * Inserts a video clip generated by the specified generator to the 
+     * specified index in this movie. The observers are notified when the clip 
+     * has been added or adding clip has failed. Note that a video clip
+     * generator can be inserted to a movie only once. Panics with
+     * <code>EVideoClipGeneratorAlreadyInserted</code> if the generator has
+     * already been inserted to a movie. Panics with 
+     * <code>EMovieAddOperationAlreadyRunning</code> if another add video 
+     * or audio clip operation is already running. Panics with code 
+     * <code>USER-130</code> if the clip index is invalid.
+     *
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aGenerator           generator to add
+     * @param aIsOwnedByVideoClip  <code>ETrue</code>, if this movie is responsible
+     *                             for deleting the generator when the clip
+     *                             is removed from this movie; <code>EFalse</code>,
+     *                             otherwise
+     * @param aIndex               index the clip should be inserted at
+     */
+    virtual void InsertVideoClipL(CVedVideoClipGenerator& aGenerator, TBool aIsOwnedByVideoClip,
+                                  TInt aIndex) = 0;
+
+    /** 
+     * Removes the video clip at the specified index from this movie.
+     * Panics with code <code>USER-130</code> if the clip index is invalid.
+     *
+     * @param aIndex  index of the clip to be removed
+     */
+    virtual void RemoveVideoClip(TInt aIndex) = 0;
+
+
+    /* Transition effect management methods. */
+
+    /** 
+     * Returns the start transition effect of this movie. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
+     * in the movie.
+     *
+     * @return  start transition effect
+     */ 
+    virtual TVedStartTransitionEffect StartTransitionEffect() const = 0;
+
+    /** 
+     * Sets the start transition effect of this movie. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
+     * in the movie.
+     *
+     * @param aEffect  start transition effect
+     */ 
+    virtual void SetStartTransitionEffect(TVedStartTransitionEffect aEffect) = 0;
+
+    /**
+     * Returns the number of middle transition effects in this movie.
+     * Note that this is the same as the number of video clips minus one.
+     *
+     * @return  number of middle transition effects
+     */
+    virtual TInt MiddleTransitionEffectCount() const = 0;
+
+    /** 
+     * Returns the middle transition effect at the specified index. 
+     * Panics with code <code>USER-130</code> if the index is invalid.
+     *
+     * @param aIndex  index
+     *
+     * @return  middle transition effect at the specified index
+     */ 
+    virtual TVedMiddleTransitionEffect MiddleTransitionEffect(TInt aIndex) const = 0;
+
+    /** 
+     * Sets the middle transition effect at the specified index. 
+     * Panics with code <code>USER-130</code> if the index is invalid.
+     *
+     * @param aEffect  middle transition effect
+     * @param aIndex   index
+     */ 
+    virtual void SetMiddleTransitionEffect(TVedMiddleTransitionEffect aEffect, TInt aIndex) = 0;
+
+    /** 
+     * Returns the end transition effect of this movie. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
+     * in the movie.
+     *
+     * @return  end transition effect
+     */ 
+    virtual TVedEndTransitionEffect EndTransitionEffect() const = 0;
+
+    /** 
+     * Sets the end transition effect of this movie. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
+     * in the movie.
+     *
+     * @param aEffect  end transition effect
+     */ 
+    virtual void SetEndTransitionEffect(TVedEndTransitionEffect aEffect) = 0;
+    
+
+    /* Audio clip management methods. */
+
+    /**
+     * Returns the number of audio clips in this movie.
+     *
+     * @return  number of audio clips
+     */
+    virtual TInt AudioClipCount() const = 0;
+
+    /** 
+     * Adds the specified audio clip to this movie. The observers are notified
+     * when the clip has been added or adding clip has failed. Panics with 
+     * <code>EMovieAddOperationAlreadyRunning</code> if another add video or
+     * audio clip operation is already running.
+     * The file will be opened in EFileShareReadersOnly mode by default, 
+     * and the same mode should be used by the client too if it need to open
+     * the file at the same time.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFileName   file name of the clip to add
+     * @param aStartTime  start time of the clip in movie timebase
+     * @param aCutInTime  cut in time of the clip
+     * @param aCutOutTime cut out time of the clip; or 
+     *                    <code>KVedAudioClipOriginalDuration</code> to specify
+     *                    that the original duration of the clip should be used
+     */
+    virtual void AddAudioClipL(const TDesC& aFileName,
+            TTimeIntervalMicroSeconds aStartTime,
+            TTimeIntervalMicroSeconds aCutInTime = TTimeIntervalMicroSeconds(0),
+            TTimeIntervalMicroSeconds aCutOutTime = KVedAudioClipOriginalDuration) = 0;
+
+    /** 
+     * Removes the audio clip at the specified index from this movie.
+     * Panics with code <code>USER-130</code> if the clip index is invalid.
+     *
+     * @param aIndex  index of the clip to be removed
+     */
+    virtual void RemoveAudioClip(TInt aIndex) = 0;
+    
+    
+    /* Whole movie management methods. */
+    
+    /** 
+     * Removes all video and audio clips and clears all transitions.
+     */
+    virtual void Reset() = 0;
+
+
+    /* Processing methods. */
+
+    /**
+     * Starts a video processing operation. This method is asynchronous and 
+     * returns immediately. The processing will happen in the background and
+     * the observer will be notified about the progress of the operation.
+     * Processed data is written into the specified file. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no clips 
+     * in the movie. Note that calling <code>ProcessL</code> may cause
+     * changes in the maximum frame rates of generated clips.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *  - <code>KErrAccessDenied</code> if the file access is denied
+     *  - <code>KErrDiskFull</code> if the disk is full
+     *  - <code>KErrWrite</code> if not all data could be written
+     *  - <code>KErrBadName</code> if the filename is bad
+     *  - <code>KErrDirFull</code> if the directory is full
+     * 
+     * @param aObserver  observer to be notified of the processing status
+     * @param aFileName  name of the file to be written
+     */
+    virtual void ProcessL(const TDesC& aFileName,
+                           MVedMovieProcessingObserver& aObserver) = 0;
+
+    /**
+     * Cancels the current video processing operation. If there is no 
+     * operation in progress, the function does nothing.
+     */
+    virtual void CancelProcessing() = 0;
+
+
+    /* Observer methods. */
+
+    /**
+     * Registers a movie observer. Panics with panic code 
+     * <code>EMovieObserverAlreadyRegistered</code> if the movie observer is 
+     * already registered.
+     *
+     * @param aObserver  observer that will receive the events
+     */
+    virtual void RegisterMovieObserverL(MVedMovieObserver* aObserver) = 0;
+
+    /**
+     * Unregisters a movie observer.
+     *
+     * @param aObserver  observer to be unregistered
+     */
+    virtual void UnregisterMovieObserver(MVedMovieObserver* aObserver) = 0;
+
+    /* Video Clip Methods */
+    /**
+     * Returns a video clip info object to get detailed information about
+     * the original video clip. Note that the specified editing operations 
+     * (for example, cutting or muting audio) do <em>not</em>
+     * affect the values returned by the info object.
+     * 
+     * @param aIndex  index of video clip in movie
+     * @return  pointer to a video clip info instance
+     */
+    virtual CVedVideoClipInfo* VideoClipInfo(TInt aIndex) const = 0;
+
+    /**
+     * Returns whether this video clip with the specified editing operations 
+     * applied (for example, changing speed or muting) has an audio track or not.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  <code>ETrue</code> if clip has an audio track;
+     *          <code>EFalse</code> otherwise
+     */
+    virtual TBool VideoClipEditedHasAudio(TInt aIndex) const = 0;
+
+    /**
+     * Sets the index of this video clip in the movie. 
+     * Panics with code <code>EVideoClipIllegalIndex</code> 
+     * if the clip index is invalid.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aNewIndex  new index of this clip
+     */
+    virtual void VideoClipSetIndex(TInt aOldIndex, TInt aNewIndex) = 0;
+ 
+    /**
+     * Returns the playback speed of this video clip. Playback speed is
+     * specified as parts per thousand of the normal playback speed. For example.
+     * 1000 means the normal speed, 750 means 75% of the normal speed, and so on.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  playback speed
+     */
+    virtual TInt VideoClipSpeed(TInt aIndex) const = 0;
+
+    /**
+     * Sets the playback speed of this video clip. Playback speed is
+     * specified as parts per thousand of the normal playback speed. For example.
+     * 1000 means the normal speed, 750 means 75% of the normal speed, and so on.
+     * Panics with <code>EVideoClipIllegalSpeed</code> if playback speed is
+     * illegal.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aSpeed  playback speed; must be between 1 and 1000
+     */
+    virtual void VideoClipSetSpeed(TInt aIndex, TInt aSpeed) = 0;
+    
+    /**
+     * Returns the color effect of this video clip.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  color effect
+     */
+    virtual TVedColorEffect VideoClipColorEffect(TInt aIndex) const = 0;
+
+    /**
+     * Sets the color effect of this video clip.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aColorEffect  color effect
+     */
+    virtual void VideoClipSetColorEffect(TInt aIndex, TVedColorEffect aColorEffect) = 0;
+
+    /**
+     * Returns whether this video clip can be muted or not (that is,
+     * whether the mute setting has any effect). For example, if
+     * this video clip has no audio track, it can never have audio
+     * even if the mute setting is false.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  <code>ETrue</code> if this video clip can be muted;
+     *          <code>EFalse</code> otherwise
+     */
+    virtual TBool VideoClipIsMuteable(TInt aIndex) const = 0;
+
+    /**
+     * Returns whether the audio track of this video clip is muted or not.
+     * Note that this returns ETrue only for cases where user has explicitly 
+     * muted the audio or if there is no audio track even in the input; 
+     * if the track is muted automatically, e.g. due to slow motion effect, 
+     * but not explicitly by the user, the return value is EFalse.
+     * If the user need to know for sure if there is audio track in the output, 
+     * and this method returns EFalse, then the user should also compare 
+     * the return value of VideoClipSpeed() to KVedNormalSpeed, 
+     * and if they are not equal, assume the audio track is muted.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  <code>ETrue</code> if the audio track is muted;
+     *          <code>EFalse</code> otherwise
+     */
+    virtual TBool VideoClipIsMuted(TInt aIndex) const = 0;
+
+    /**
+     * Sets whether the audio track of this video clip is muted or not.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aVolume  <code>ETrue</code> to mute the audio track;
+     *                 <code>EFalse</code> not to mute the audio track
+     */
+    virtual void VideoClipSetMuted(TInt aIndex, TBool aMuted) = 0;
+
+    /**
+     * Returns the cut in time of this video clip in clip timebase.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  cut in time in microseconds in clip timebase
+     */
+    virtual TTimeIntervalMicroSeconds VideoClipCutInTime(TInt aIndex) const = 0;
+
+    /**
+     * Sets the cut in time of this video clip in clip timebase.
+     * Panics with <code>EVideoClipIllegalCutInTime</code> if
+     * cut in time is illegal.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aCutInTime  cut in time in microseconds in clip timebase
+     */
+    virtual void VideoClipSetCutInTime(TInt aIndex, TTimeIntervalMicroSeconds aCutInTime) = 0;
+
+    /**
+     * Returns the cut out time of this video clip in clip timebase.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  cut out time in microseconds in clip timebase
+     */
+    virtual TTimeIntervalMicroSeconds VideoClipCutOutTime(TInt aIndex) const = 0;
+
+    /**
+     * Sets the cut out time of this video clip in clip timebase. 
+     * Panics with <code>EVideoClipIllegalCutOutTime</code> if
+     * cut out time is illegal.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aCutOutTime  cut out time in microseconds in clip timebase
+     */
+    virtual void VideoClipSetCutOutTime(TInt aIndex, TTimeIntervalMicroSeconds aCutOutTime) = 0;
+
+    /**
+     * Returns the start time of this video clip in movie timebase.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  start time in microseconds in movie timebase
+     */
+    virtual TTimeIntervalMicroSeconds VideoClipStartTime(TInt aIndex) const = 0;
+
+    /**
+     * Returns the end time of this video clip in movie timebase.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  end time in microseconds in movie timebase
+     */
+    virtual TTimeIntervalMicroSeconds VideoClipEndTime(TInt aIndex) const = 0;
+
+    /**
+     * Returns the duration of this video clip with the specified
+     * editing operations applied (for example, cutting 
+     * and changing speed)
+     * 
+     * @param aIndex  index of video clip in movie
+     * @return  duration in microseconds
+     */
+    virtual TTimeIntervalMicroSeconds VideoClipEditedDuration(TInt aIndex) const = 0;
+
+    /* Audio Clip Methods */
+
+    /**
+     * Returns an audio clip info object to get detailed information about
+     * the original audio clip. Note that the specified editing operations 
+     * (for example, changing duration) do <em>not</em>
+     * affect the values returned by the info object.
+     * 
+     * @param aIndex  index of audio clip in movie
+     * @return  pointer to an audio clip info instance
+     */
+    virtual CVedAudioClipInfo* AudioClipInfo(TInt aIndex) const = 0;
+
+    /**
+     * Returns the start time of this audio clip in movie timebase.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @return  start time in microseconds in movie timebase
+     */
+    virtual TTimeIntervalMicroSeconds AudioClipStartTime(TInt aIndex) const = 0;
+
+    /**
+     * Sets the start time of this audio clip in movie timebase. 
+     * Also updates the end time. Duration remains unchanged.
+     * Note that since the audio clips are ordered based on their
+     * start times, the index of the clip may change as a result
+     * of changing the start time.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @param aStartTime  start time in microseconds in movie timebase
+     */
+    virtual void AudioClipSetStartTime(TInt aIndex, TTimeIntervalMicroSeconds aStartTime) = 0;
+
+    /**
+     * Returns the end time of this audio clip in movie timebase.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @return  end time in microseconds in movie timebase
+     */
+    virtual TTimeIntervalMicroSeconds AudioClipEndTime(TInt aIndex) const = 0;
+
+    /**
+     * Returns the duration of the selected part of this clip.
+     * 
+     * @param aIndex  index of audio clip in movie
+     * @return  duration in microseconds
+     */
+    virtual TTimeIntervalMicroSeconds AudioClipEditedDuration(TInt aIndex) const = 0;
+
+    /**
+     * Returns the cut in time of this audio clip in clip timebase.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @return  cut in time in microseconds in clip timebase
+     */
+    virtual TTimeIntervalMicroSeconds AudioClipCutInTime(TInt aIndex) const = 0;
+
+    /**
+     * Sets the cut in time of this audio clip in clip timebase.
+     * Panics with <code>EAudioClipIllegalCutInTime</code> if
+     * cut in time is illegal.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @param aCutInTime  cut in time in microseconds in clip timebase
+     */
+    virtual void AudioClipSetCutInTime(TInt aIndex, TTimeIntervalMicroSeconds aCutInTime) = 0;
+
+    /**
+     * Returns the cut out time of this audio clip in clip timebase.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @return  cut out time in microseconds in clip timebase
+     */
+    virtual TTimeIntervalMicroSeconds AudioClipCutOutTime(TInt aIndex) const = 0;
+
+    /**
+     * Sets the cut out time of this audio clip in clip timebase.
+     * Panics with <code>EAudioClipIllegalCutOutTime</code> if
+     * cut in time is illegal.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @param aCutOutTime  cut out time in microseconds in clip timebase
+     */
+    virtual void AudioClipSetCutOutTime(TInt aIndex, TTimeIntervalMicroSeconds aCutOutTime) = 0;
+
+    /**
+     * Returns the target bitrate of the movie audio track.
+     * 
+     * @return  target bitrate of the movie audio track.
+     */
+    virtual TInt AudioBitrate() const = 0;
+
+    /**
+     * Returns the target bitrate of the movie video track.
+     * 
+     * @return  target bitrate of the movie video track.
+     */
+    virtual TInt VideoBitrate() const = 0;
+
+    /**
+     * Returns the target framerate of the movie video track.
+     * 
+     * @return  target framerate of the movie video track.
+     */
+    virtual TReal VideoFrameRate() const = 0;
+
+    /**
+     * Sets the output parameters for the movie. Leaves
+     * with KErrNotSupported if a parameter is illegal,
+     * e.g., target bitrate is too high for the given 
+     * codec. Setting a integer parameter to zero indicates
+     * that a default value will be used for that parameter.
+     *
+     * This method overrides the SetQuality method
+     *
+     * Possible leave codes:
+     *  - <code>KErrNotSupported</code> if setting is not valid
+     *
+     * @param Output parameters
+     */
+    
+    virtual void SetOutputParametersL(TVedOutputParameters& aOutputParams) = 0;
+    
+    /**
+     * Sets the maximum size for the movie
+     * 
+     * @param aLimit Maximum size in bytes
+     */
+    virtual void SetMovieSizeLimit(TInt aLimit) = 0;
+    
+     /**
+     * Returns whether this audio clip is normalized or not.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @return  <code>ETrue</code> if the audio clip is normalized;
+     *          <code>EFalse</code> otherwise
+     */
+    virtual TBool AudioClipNormalizing(TInt aIndex) const = 0;
+
+    /**
+     * Sets whether this audio clip is normalized or not.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @param aVolume  <code>ETrue</code> to normalize the audio clip;
+     *                 <code>EFalse</code> not to normalize the audio clip
+     */
+    virtual void AudioClipSetNormalizing(TInt aIndex, TBool aNormalizing) = 0;
+
+    /**
+     * Inserts a new dynamic level mark to the audio clip. The mark timing
+     * must be within the time boundaries of the audio clip.
+     *
+     * Note! This method should not be used at the same time with SetAudioClipVolumeGainL
+     * since these overrule each other; the latter one used stays valid.
+     *
+     * @param aIndex  index of the audio clip
+     * @param aMark   dynamic level mark to be inserted
+     */
+    virtual void AudioClipInsertDynamicLevelMarkL(TInt aIndex, TVedDynamicLevelMark aMark) = 0;
+    
+    /**
+     * Removes the specified dynamic level mark from the specified audio clip.
+     * The mark index must be between 0 and number of dynamic level marks in the clip.
+     *
+     * @param aClipIndex  index of the audio clip
+     * @param aMarkIndex  index of the mark to be removed
+     */
+    virtual void AudioClipRemoveDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex) = 0;
+
+    /**
+     * Returns the number of dynamic level marks in the specified audio clip.
+     * 
+     * @param aIndex  index of the audio clip
+     */
+    virtual TInt AudioClipDynamicLevelMarkCount(TInt aIndex) const = 0;
+
+    /**
+     * Returns the specified dynamic level mark from the specified audio clip.
+     * 
+     * @param aClipIndex  index of the audio clip
+     * @param aMarkIndex  index of the dynamic level mark
+     */    
+    virtual TVedDynamicLevelMark AudioClipDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex) = 0;
+
+    /**
+     * Returns whether the audio track of this video clip is normalized or not.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  <code>ETrue</code> if the audio track is normalized;
+     *          <code>EFalse</code> otherwise
+     */
+    virtual TBool VideoClipNormalizing(TInt aIndex) const = 0;
+
+    /**
+     * Sets whether the audio track of this video clip is normalized or not.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aVolume  <code>ETrue</code> to normalize the audio track;
+     *                 <code>EFalse</code> not to normalize the audio track
+     */
+    virtual void VideoClipSetNormalizing(TInt aIndex, TBool aNormalizing) = 0;
+
+    /**
+     * Inserts a new dynamic level mark to the video clip. The mark timing
+     * must be within the time boundaries of the video clip.
+     *
+     * Note! This method should not be used at the same time with SetVideoClipVolumeGainL
+     * since these overrule each other; the latter one used stays valid.
+     *
+     * @param aIndex  index of the video clip
+     * @param aMark   dynamic level mark to be inserted
+     */
+    virtual void VideoClipInsertDynamicLevelMarkL(TInt aIndex, TVedDynamicLevelMark aMark) = 0;
+    
+    /**
+     * Removes the specified dynamic level mark from the specified video clip.
+     * The mark index must be between 0 and number of dynamic level marks in the clip.
+     *
+     * @param aClipIndex  index of the video clip
+     * @param aMarkIndex  index of the mark to be removed
+     */
+    virtual void VideoClipRemoveDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex) = 0;
+
+    /**
+     * Returns the number of dynamic level marks in the specified video clip.
+     * 
+     * @param aIndex  index of the video clip
+     */
+    virtual TInt VideoClipDynamicLevelMarkCount(TInt aIndex) const = 0;
+
+    /**
+     * Returns the specified dynamic level mark from the specified video clip.
+     * 
+     * @param aClipIndex  index of the video clip
+     * @param aMarkIndex  index of the dynamic level mark
+     */    
+    virtual TVedDynamicLevelMark VideoClipDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex) = 0;    
+    
+     /**
+     * Returns the color tone of the specified clip.
+     *
+     * @return color tone
+     */
+    virtual TRgb VideoClipColorTone(TInt aVideoCLipIndex) const = 0;
+    
+    /**
+     * Sets the color tone of the specified clip.
+     *
+     * @param aColorTone  color tone
+     */
+    virtual void VideoClipSetColorTone(TInt aVideoClipIndex, TRgb aColorTone) = 0;
+    
+     /**
+     * Returns an estimate for movie processing time
+     *
+     * @return Processing time
+     */
+    virtual TTimeIntervalMicroSeconds GetProcessingTimeEstimateL() = 0;
+
+    /**
+     * Checks if a movie observer is registered.
+     *
+     * @param aObserver observer to be checked
+     * @return <code>ETrue</code> if the observer is registered
+     *         <code>EFalse</code> otherwise
+     */
+    virtual TBool MovieObserverIsRegistered(MVedMovieObserver* aObserver) = 0;
+
+    /**
+     * Set volume gain for audio track in the given video clip. Value 0 means no gain.
+     * In practice calls VideoClipInsertDynamicLevelMarkL to set dynamic level mark
+     * to the beginning and end of the clip. 
+     * Also the observer callback NotifyVideoClipDynamicLevelMarkInserted is called if gain
+     * is nonzero; if it is zero, callback NotifyVideoClipDynamicLevelMarkRemoved is called.
+     *
+     * If index is KVedClipIndexAll, the setting is applied to all video clips in the movie.
+     *
+     * Note! This method should not be used at the same time with VideoClipInsertDynamicLevelMarkL
+     * since these overrule each other; the latter one used stays valid.
+     *
+     * @param aClipIndex    index of the clip; KVedClipIndexAll if applied for all the clips
+     * @param aVolumeGain   Volume gain. One step equals 0.1 dedibels for positive values and
+     *                      0.5 decibels for negative values.
+     *                      Value = 0 sets the original level (no gain)
+     *                      Value range -127...127; if exceeded, the value is saturated to max
+     */
+    virtual void SetVideoClipVolumeGainL(TInt aClipIndex, TInt aVolumeGain) = 0;
+
+    /**
+     * Get volume gain for audio track in the given video clip.
+     * If index is KVedClipIndexAll, the global gain set for all video clips in the movie is returned.
+     *
+     * @param aClipIndex    index of the clip; KVedClipIndexAll if applied for all the clips (whole movie)
+     * @return Volume gain in +0.1 or -0.5 decibel steps
+     */
+    virtual TInt GetVideoClipVolumeGainL(TInt aClipIndex) = 0;
+
+    /**
+     * Set volume gain for the given audio clip. Value 0 means no gain.
+     * In practice calls AudioClipInsertDynamicLevelMarkL to set dynamic level mark
+     * to the beginning and end of the clip. 
+     * Also the observer callback NotifyAudioClipDynamicLevelMarkInserted is called if gain
+     * is nonzero; if it is zero, callback NotifyAudioClipDynamicLevelMarkRemoved is called.
+     *
+     * If index is KVedClipIndexAll, the setting is applied to all audio clips in the movie.
+     *
+     * Note! This method should not be used at the same time with AudioClipInsertDynamicLevelMarkL
+     * since these overrule each other; the latter one used stays valid.
+     *
+     * @param aClipIndex    Index of the clip; KVedClipIndexAll if applied for all the clips
+     * @param aVolumeGain   Volume gain. One step equals 0.1 dedibels for positive values and
+     *                      0.5 decibels for negative values. 
+     *                      Value = 0 sets the original level (no gain)
+     *                      Value range -127...127; if exceeded, the value is saturated to max
+     */
+    virtual void SetAudioClipVolumeGainL(TInt aClipIndex, TInt aVolumeGain) = 0;
+
+    /**
+     * Get volume gain for the given audio clip.
+     * If index is KVedClipIndexAll, the global gain set for all video clips in the movie is returned.
+     *
+     * @param aClipIndex    index of the clip; KVedClipIndexAll if applied for all the clips
+     * @return Volume gain in +0.1 or -0.5 decibel steps
+     */
+    virtual TInt GetAudioClipVolumeGainL(TInt aClipIndex) = 0;
+    
+    /** 
+     * Inserts a video clip from the specified file to the specified index 
+     * in this movie. The observers are notified when the clip has been added 
+     * or adding clip has failed. Panics with <code>EMovieAddOperationAlreadyRunning</code> 
+     * if another add video or audio clip operation is already running.
+     * Panics with code <code>USER-130</code> if the clip index is invalid.
+     * The file will be opened in EFileShareReadersOnly mode by default, 
+     * and the same mode should be used by the client too if it need to open
+     * the file at the same time.
+     *  
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFileHandle  file handle of the clip to add
+     * @param aIndex     index the clip should be inserted at
+     */
+    virtual void InsertVideoClipL(RFile* aFileHandle, TInt aIndex) = 0;
+    
+    /** 
+     * Adds the specified audio clip to this movie. The observers are notified
+     * when the clip has been added or adding clip has failed. Panics with 
+     * <code>EMovieAddOperationAlreadyRunning</code> if another add video or
+     * audio clip operation is already running.
+     * The file will be opened in EFileShareReadersOnly mode by default, 
+     * and the same mode should be used by the client too if it need to open
+     * the file at the same time.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFilehandle   file handle of the clip to add
+     * @param aStartTime  start time of the clip in movie timebase
+     * @param aCutInTime  cut in time of the clip
+     * @param aCutOutTime cut out time of the clip; or 
+     *                    <code>KVedAudioClipOriginalDuration</code> to specify
+     *                    that the original duration of the clip should be used
+     */
+    
+    virtual void AddAudioClipL(RFile* aFileHandle,
+            TTimeIntervalMicroSeconds aStartTime,
+            TTimeIntervalMicroSeconds aCutInTime = TTimeIntervalMicroSeconds(0),
+            TTimeIntervalMicroSeconds aCutOutTime = KVedAudioClipOriginalDuration) = 0;
+    
+    /**
+     * Starts a video processing operation. This method is asynchronous and 
+     * returns immediately. The processing will happen in the background and
+     * the observer will be notified about the progress of the operation.
+     * Processed data is written into the specified file. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no clips 
+     * in the movie. Note that calling <code>ProcessL</code> may cause
+     * changes in the maximum frame rates of generated clips.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *  - <code>KErrAccessDenied</code> if the file access is denied
+     *  - <code>KErrDiskFull</code> if the disk is full
+     *  - <code>KErrWrite</code> if not all data could be written
+     *  - <code>KErrBadName</code> if the filename is bad
+     *  - <code>KErrDirFull</code> if the directory is full
+     * 
+     * @param aObserver  observer to be notified of the processing status
+     * @param aFileHandle  handle of the file to be written
+     */
+    
+    virtual void ProcessL(RFile* aFileHandle,
+                          MVedMovieProcessingObserver& aObserver) = 0;
+    
+
+    };
+
+#endif // __VEDMOVIE_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditor_plat/video_editor_engine_api/inc/VedVideoClipGenerator.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,331 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+#ifndef __VEDVIDEOCLIPGENERATOR_H__
+#define __VEDVIDEOCLIPGENERATOR_H__
+
+#include <e32base.h>
+#include <fbs.h>
+
+#include "VedVideoClipInfo.h"
+
+class CVedMovie;
+class CVedVideoClip;
+class CVedVideoClipGenerator;
+
+
+/**
+ * Observer for notifying that video clip frame has been completed.
+ *
+ * @see  CVedVideoClipGenerator
+ */
+class MVedVideoClipGeneratorFrameObserver
+    {
+public:
+    /**
+     * Called to notify that a video clip frame has been completed. 
+     * 
+     * @param aGenerator  video clip generator
+     * @param aError      <code>KErrNone</code> if frame was
+     *                    completed successfully; one of the system wide
+     *                    error codes if generating frame failed
+     * @param aFrame      pointer to frame if it was completed successfully;
+     *                    <code>NULL</code> if generating frame failed
+     */
+    virtual void NotifyVideoClipGeneratorFrameCompleted(CVedVideoClipGenerator& aGenerator, 
+                                                        TInt aError, 
+                                                        CFbsBitmap* aFrame) = 0;
+    };
+
+    
+/**
+ * Abstract base class for video clip frame generators. Frame generators
+ * can be used to create video clips from bitmaps generated by the application
+ * (for example, by drawing with GDI).
+ */
+class CVedVideoClipGenerator : public CBase
+    {
+public:
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CVedVideoClipGenerator();
+
+    /**
+     * Returns whether this generator has been inserted to a movie
+     * or not.
+     *
+     * @return  <code>ETrue</code>, if this generator has been 
+     *          inserted; <code>EFalse</code>, otherwise
+     */
+    IMPORT_C TBool IsInserted() const;
+
+
+    /**
+     * Returns the movie this generator is associated with.
+     * Panics with <code>EVideoClipGeneratorNotInserted</code>
+     * if this generator has not been inserted to a movie yet.
+     *
+     * @return  movie
+     */
+    IMPORT_C CVedMovie* Movie() const;
+
+    /**
+     * Returns the index of the video clip this generator is 
+     * associated with.Panics with <code>EVideoClipGeneratorNotInserted</code>
+     * if this generator has not been inserted to a movie yet.
+     *
+     * @return  video clip index
+     */
+    IMPORT_C TInt VideoClipIndex() const;
+
+    /**
+     * Returns whether this generator is owned by the video clip
+     * it is associated with (i.e., whether the video clip is responsible
+     * for deleting this generator). Panics with 
+     * <code>EVideoClipGeneratorNotInserted</code> if this generator 
+     * has not been inserted to a movie yet.
+     *
+     * @return  <code>ETrue</code>, if this generator is owned by 
+     *          the video clip; <code>EFalse</code>, otherwise
+     */
+    IMPORT_C TBool IsOwnedByVideoClip() const;
+
+    /**
+     * Returns the uid of the frame generator. The use of the uid is 
+     * entirely application specific. It can be used for example to
+     * identify the frame generator type. The uid is not used in
+     * any way by the video editor engine.
+     *
+     * @return  uid of the frame generator
+     */
+    virtual TUid Uid() const = 0;
+
+    /**
+     * Returns a descriptive name for the clip.
+     *
+     * @return  descriptive name of the clip
+     */
+    virtual TPtrC DescriptiveName() const = 0;
+    
+    /**
+     * Returns the duration of the clip in microseconds.
+     * 
+     * @return  duration of the clip
+     */
+    virtual TTimeIntervalMicroSeconds Duration() const = 0;
+
+
+    /* Video frame property methods. */
+
+    /**
+     * Returns the number of video frames in this clip. Panics if the 
+     * clip is not ready.
+     * 
+     * @return  number of video frames in this clip
+     */
+    virtual TInt VideoFrameCount() const = 0;
+
+    /** 
+     * Returns the start time of the video frame at the specified index. 
+     * Panics if the index is illegal or if the clip is not ready.
+     *
+     * @param aIndex  index
+     *
+     * @return  start time of the video frame at the specified index in microseconds
+     */ 
+    virtual TTimeIntervalMicroSeconds VideoFrameStartTime(TInt aIndex) const = 0;
+
+    /** 
+     * Returns the end time of the video frame at the specified index. 
+     * Panics if the index is illegal or the clip is not ready.
+     *
+     * @param aIndex  index
+     *
+     * @return  end time of the video frame at the specified index in microseconds
+     */ 
+    virtual TTimeIntervalMicroSeconds VideoFrameEndTime(TInt aIndex) const = 0;
+
+    /** 
+     * Returns the duration of the video frame at the specified index. 
+     * Panics if the index is illegal or the clip is not ready.
+     *
+     * @param aIndex  index
+     *
+     * @return  duration of the video frame at the specified index in microseconds
+     */ 
+    virtual TTimeIntervalMicroSeconds VideoFrameDuration(TInt aIndex) const = 0;
+
+    /**
+     * Returns the complexity factor of the first video frame. The complexity factor
+     * should be in the range between 0 to 1000. 0 means no variation at all (a 
+     * blank frame), 1000 means a highly complex frame.
+     *
+     * @see CalculateFrameComplexityFactor
+     *
+     * @return  complexity factor, range 0...1000
+     */
+    virtual TInt VideoFirstFrameComplexityFactor() const = 0;
+
+
+    /**
+     * Returns the difference factor of the video frame at the specified 
+     * index. The difference factor describes how different the frame is
+     * from the previous frame. The difference factor should be in the range between
+     * 0 to 1000 (0 means that the frame is identical to the previous one, 1000
+     * means that the frame is completely different from the previous one.)
+     * Panics if the index is illegal or the clip is not yet ready. 
+     *
+     * @param aIndex  index (starting from 1)
+     * 
+     * @return  difference factor, range 0...1000
+     */
+    virtual TInt VideoFrameDifferenceFactor(TInt aIndex) const = 0;
+
+    /**
+     * Returns the video frame index at the specified time. Panics if info is not yet 
+     * ready for reading or the time is illegal.
+     *
+     * @param aTime  time
+     *
+     * @return  video frame index at the specified time
+     */
+    virtual TInt GetVideoFrameIndex(TTimeIntervalMicroSeconds aTime) const = 0;
+
+
+    /* Frame methods. */
+
+    /**
+     * Generates a bitmap of the given frame. The frame bitmap is  scaled
+     * to the specified resolution and converted to the specified display 
+     * mode. This method is asynchronous. The frame is generated in the
+     * background and the observer is notified when the frame is complete.
+     * This method panics if the resolution is illegal.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *  - <code>KErrNotSupported</code>, if the specified combination of 
+     *                                   parameters is not supported
+     *
+     * @param aObserver    observer to be notified when the frame is completed
+     * @param aIndex       index of frame, or KFrameIndexBestThumb to look for
+     *                     the most suitable thumbnail frame.
+     * @param aResolution  resolution of the desired frame bitmap, or
+     *                     <code>NULL</code> if the frame should be
+     *                     in the original resolution
+     * @param aDisplayMode desired display mode; or <code>ENone</code> if 
+     *                     any display mode is acceptable
+     * @param aEnhance     apply image enhancement algorithms to improve
+     *                     frame quality; note that this may considerably
+     *                     increase the processing time needed to prepare
+     *                     the frame
+     * @param aPriority    priority of the frame generation
+     */
+    virtual void GetFrameL(MVedVideoClipGeneratorFrameObserver& aObserver,
+                           TInt aIndex = KFrameIndexBestThumb,
+                           TSize* const aResolution = 0,
+                           TDisplayMode aDisplayMode = ENone,
+                           TBool aEnhance = EFalse,
+                           TInt aPriority = CActive::EPriorityIdle) = 0;
+    
+    /**
+     * Cancels frame generation. If no frame is currently being 
+     * generated, the function does nothing.
+     */
+    virtual void CancelFrame() = 0; 
+
+protected: // constructors and methods
+    
+    /**
+     * Constructor.
+     */
+    IMPORT_C CVedVideoClipGenerator();
+
+    /**
+     * Reports to the base class that the duration of the generated clip has
+     * changed. This method should <emph>always</emph> be called when the 
+     * settings of the generated clip change so that the duration of the
+     * clip is affected.
+     */
+    IMPORT_C void ReportDurationChanged() const;
+
+    /**
+     * Reports to the base class that some settings of the generated clip have
+     * changed but the duration of the clip has remained the same.
+     * This method should <emph>always</emph> be called when any settings
+     * of the generated clip change but the duration of the clip is not affected.
+     */
+    IMPORT_C void ReportSettingsChanged() const;
+
+    /**
+     * Reports to the base class that descriptive name of the generated 
+     * clip has changed. This method should <emph>always</emph> be called 
+     * when the descriptive name of the generated clip has changed but no 
+     * other changes have occurred.
+     */
+    IMPORT_C void ReportDescriptiveNameChanged() const;
+
+    /**
+     * Calculates the complexity of a frame. This method is meant for calculating
+     * frame complexity factors returned by <code>VideoFirstFrameComplexityFactor</code>
+     * method.
+     *
+     * @see VideoFirstFrameComplexityFactor
+     *
+     * @param aFrame  frame to analyze
+     *
+     * @return  complexity factor
+     */
+    IMPORT_C TInt CalculateFrameComplexityFactor(CFbsBitmap* aFrame) const;
+
+private: // methods
+
+    /**
+     * Sets the video clip this generator is associated with and whether
+     * the clip owns this generator or not. Note that these properties can 
+     * be set only once during the lifetime of a generator when the 
+     * generator is inserted to a movie. Panics with 
+     * <code>EVideoClipGeneratorAlreadyInserted</code> if the video clip 
+     * has already been set.
+     *
+     * @param aVideoClip           video clip
+     * @param aIsOwnedByVideoClip  <code>ETrue</code>, if the clip is responsible
+     *                             for deleting this generator; <code>EFalse</code>,
+     *                             otherwise
+     */
+    void SetVideoClip(CVedVideoClip& aVideoClip, TBool aIsOwnedByVideoClip);
+
+
+private:
+    // Member variables
+
+    CVedVideoClip* iVideoClip;
+    TBool iIsOwnedByVideoClip;
+
+    TInt iMaximumFramerate;
+
+    friend class CVedMovieAddClipOperation;
+    friend class CVideoEditorTest;
+    
+    };
+
+#endif // __VEDVIDEOCLIPGENERATOR_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditor_plat/video_editor_engine_api/inc/VedVideoClipInfo.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,396 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __VEDVIDEOCLIPINFO_H__
+#define __VEDVIDEOCLIPINFO_H__
+
+#include "VedCommon.h"
+
+#include <gdi.h>
+
+#define KFrameIndexBestThumb (-1) // search for best possible thumbnail from video
+
+/*
+ *  Forward declarations.
+ */
+class CFbsBitmap;  
+class CVedVideoClipInfo;
+class CVedVideoClipGenerator;
+
+/**
+ * Observer for notifying that video clip info
+ * is ready for reading.
+ *
+ * @see  CVedVideoClipInfo
+ */
+class MVedVideoClipInfoObserver 
+    {
+public:
+    /**
+     * Called to notify that video clip info is ready
+     * for reading.
+     *
+     * Possible error codes:
+     *  - <code>KErrNotFound</code> if there is no file with the specified name
+     *    in the specified directory (but the directory exists)
+     *  - <code>KErrPathNotFound</code> if the specified directory
+     *    does not exist
+     *  - <code>KErrUnknown</code> if the specified file is of unknown format
+     *
+     * @param aInfo   video clip info
+     * @param aError  <code>KErrNone</code> if info is ready
+     *                for reading; one of the system wide
+     *                error codes if reading file failed
+     */
+    virtual void NotifyVideoClipInfoReady(CVedVideoClipInfo& aInfo, 
+                                          TInt aError) = 0;
+    };
+
+
+/**
+ * Observer for notifying that video clip frame has been completed.
+ *
+ * @see  CVedVideoClipInfo
+ */
+class MVedVideoClipFrameObserver
+    {
+public:
+    /**
+     * Called to notify that video clip frame has been completed. 
+     * 
+     * @param aInfo   video clip info
+     * @param aError  <code>KErrNone</code> if frame was
+     *                completed successfully; one of the system wide
+     *                error codes if generating frame failed
+     * @param aFrame  pointer to frame if it was completed successfully;
+     *                <code>NULL</code> if generating frame failed
+     */
+    virtual void NotifyVideoClipFrameCompleted(CVedVideoClipInfo& aInfo, 
+                                               TInt aError, 
+                                               CFbsBitmap* aFrame) = 0;
+    };
+
+/**
+ * Utility class for getting information about video clip files.
+ */
+class CVedVideoClipInfo : public CBase
+    {
+public:
+
+    /* Constructors & destructor. */
+
+    /**
+     * Constructs a new CVedVideoClipInfo object to get information
+     * about the specified video clip file. The specified observer
+     * is notified when info is ready for reading. This method
+     * may leave if no resources are available to construct 
+     * a new object.
+     * The file will be opened in EFileShareReadersOnly mode by default, 
+     * and the same mode should be used by the client too if it need to open
+     * the file at the same time.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFileName  name of video clip file
+     * @param aObserver  observer to notify when info is ready for reading
+     *
+     * @return  pointer to a new CVedVideoClipInfo instance
+     */
+    IMPORT_C static CVedVideoClipInfo* NewL(const TDesC& aFileName,
+                                            MVedVideoClipInfoObserver& aObserver);
+
+    /**
+     * Constructs a new CVedVideoClipInfo object to get information
+     * about the specified video clip file. The constructed object
+     * is left in the cleanup stack. The specified observer
+     * is notified when info is ready for reading. This method
+     * may leave if no resources are available to construct a new
+     * object.
+     * The file will be opened in EFileShareReadersOnly mode by default, 
+     * and the same mode should be used by the client too if it need to open
+     * the file at the same time.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFileName  name of video clip file
+     * @param aObserver  observer to notify when info is ready for reading
+     *
+     * @return  pointer to a new CVedVideoClipInfo instance
+     */
+    IMPORT_C static CVedVideoClipInfo* NewLC(const TDesC& aFileName,
+                                             MVedVideoClipInfoObserver& aObserver);
+
+    /* General property methods. */
+
+
+    /**
+     * Returns a descriptive name for the clip. Panics if info is not yet
+     * ready for reading.
+     *
+     * @return  descriptive name of the clip
+     */
+    virtual TPtrC DescriptiveName() const = 0;
+
+    /**
+     * Returns the file name of the clip. Panics if there is no file 
+     * associated with this clip or info is not yet ready for reading.
+     * 
+     * @return  file name of the clip
+     */
+    virtual TPtrC FileName() const = 0;
+
+    /**
+     * Returns the generator of the clip. Panics if there is no video clip
+     * generator associated with the clip or info is not yet ready for reading.
+     *
+     * @return  generator of the clip
+     */
+    virtual CVedVideoClipGenerator* Generator() const = 0;
+
+    /**
+     * Returns the class of the clip.
+     *
+     * @return  class of the clip
+     */
+    virtual TVedVideoClipClass Class() const = 0;
+
+    /**
+     * Returns the video format of the clip. Panics if there is no file 
+     * associated with this clip or info is not yet ready for reading.
+     * 
+     * @return  video format of the clip
+     */
+    virtual TVedVideoFormat Format() const = 0;
+
+    /**
+     * Returns the video type of the clip. Panics if there is no file 
+     * associated with this clip or info is not yet ready for reading.
+     * 
+     * @return  video type of the clip
+     */
+    virtual TVedVideoType VideoType() const = 0;
+
+    /**
+     * Returns the resolution of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  resolution of the clip
+     */
+    virtual TSize Resolution() const = 0;
+
+    /**
+     * Returns whether this video clip has an audio track or not.
+     * Panics if info is not yet ready for reading.  
+     *
+     * @return  <code>ETrue</code> if clip has an audio track;
+     *          <code>EFalse</code> otherwise
+     */
+    virtual TBool HasAudio() const = 0;
+
+    /**
+     * Returns the audio type of the clip audio track. Panics if there is no file 
+     * associated with this clip or info is not yet ready for reading.
+     * 
+     * @return  audio type of the clip audio track
+     */
+    virtual TVedAudioType AudioType() const = 0;
+
+    /**
+     * Returns the channel mode of the audio if applicable.
+     *
+     * @return  channel mode
+     */
+    virtual TVedAudioChannelMode AudioChannelMode() const = 0;
+
+    /**
+     * Returns the sampling rate in kilohertz.
+     *
+     * @return  sampling rate
+     */
+    virtual TInt AudioSamplingRate() const = 0;
+
+    /**
+     * Returns the duration of the clip in microseconds. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  duration of the clip
+     */
+    virtual TTimeIntervalMicroSeconds Duration() const = 0;
+
+
+    /* Video frame property methods. */
+
+    /**
+     * Returns the number of video frames in this clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  number of video frames in this clip
+     */
+    virtual TInt VideoFrameCount() const = 0;
+    
+    /** 
+     * Returns the start time of the video frame at the specified index. 
+     * Panics if info is not yet ready for reading or the index is illegal.
+     *
+     * @param aIndex  index
+     *
+     * @return  start time of the video frame at the specified index in microseconds
+     */ 
+    virtual TTimeIntervalMicroSeconds VideoFrameStartTimeL(TInt aIndex) = 0;
+
+    /** 
+     * Returns the end time of the video frame at the specified index. 
+     * Panics if info is not yet ready for reading or the index is illegal.
+     *
+     * @param aIndex  index
+     *
+     * @return  end time of the video frame at the specified index in microseconds
+     */ 
+    virtual TTimeIntervalMicroSeconds VideoFrameEndTimeL(TInt aIndex) = 0;
+
+    /** 
+     * Returns the duration of the video frame at the specified index. 
+     * Panics if info is not yet ready for reading or the index is illegal.
+     *
+     * @param aIndex  index
+     *
+     * @return  duration of the video frame at the specified index in microseconds
+     */ 
+    virtual TTimeIntervalMicroSeconds VideoFrameDurationL(TInt aIndex) = 0;
+
+    /** 
+     * Returns the size of the video frame at the specified index. 
+     * Panics if there is no file associated with this clip, or info is not 
+     * yet ready for reading, or the index is illegal.
+     *
+     * @param aIndex  index
+     *
+     * @return  size of the video frame at the specified index in bytes
+     */ 
+    virtual TInt VideoFrameSizeL(TInt aIndex) = 0;
+
+    /** 
+     * Returns whether the video frame at the specified index is an intra
+     * frame or not. Panics if info is not yet ready for reading or 
+     * the index is illegal.
+     *
+     * @param aIndex  index
+     *
+     * @return  <code>ETrue</code>, if the video frame at the specified index is an
+     *          intra frame; <code>EFalse</code>, otherwise
+     */ 
+    virtual TBool VideoFrameIsIntraL(TInt aIndex) = 0;
+
+    /**
+     * Returns the video frame index at the specified time. Panics if info is not yet 
+     * ready for reading or the time is illegal.
+     *
+     * @param aTime  time
+     *
+     * @return  video frame index at the specified time
+     */
+    virtual TInt GetVideoFrameIndexL(TTimeIntervalMicroSeconds aTime) = 0;
+
+
+    /* Frame methods. */
+
+    /**
+     * Generates a bitmap of the given frame from video clip.
+     * The frame bitmap is scaled to the specified resolution and converted
+     * to the specified display mode. This method is asynchronous. The frame
+     * is generated in background and the observer is notified when the frame
+     * is complete. This method panics if info is not yet ready for reading or 
+     * the resolution is illegal.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *  - <code>KErrNotSupported</code>, if the specified combination of 
+     *                                   parameters is not supported
+     *
+     * @param aObserver    observer to be notified when the frame is completed
+     * @param aIndex       index of frame, or KFrameIndexBestThumb to look for
+     *                     most suitable thumbnail frame.
+     * @param aResolution  resolution of the desired frame bitmap, or
+     *                     <code>NULL</code> if the frame should be
+     *                     in the original resolution
+     * @param aDisplayMode desired display mode; or <code>ENone</code> if 
+     *                     any display mode is acceptable
+     * @param aEnhance     apply image enhancement algorithms to improve
+     *                     frame quality; note that this may considerably
+     *                     increase the processing time needed to prepare
+     *                     the frame
+     * @param aPriority    priority of the frame generation
+     */
+    virtual void GetFrameL(MVedVideoClipFrameObserver& aObserver,
+                            TInt aIndex = KFrameIndexBestThumb,
+                            TSize* const aResolution = 0,
+                            TDisplayMode aDisplayMode = ENone,
+                            TBool aEnhance = EFalse,
+                            TInt aPriority = CActive::EPriorityIdle) = 0;
+    
+    /**
+     * Cancels frame generation. If no frame is currently being 
+     * generated, the function does nothing.
+     */
+    virtual void CancelFrame() = 0;
+
+    /**
+     * Sets the transcode factor.
+     *
+     * @param aFactor  transcode factor
+     */
+    virtual void SetTranscodeFactor(TVedTranscodeFactor aFactor) = 0;
+
+    /**
+     * Returns the transcode factor.
+     *
+     * @return  transcode factor.
+     */
+    virtual TVedTranscodeFactor TranscodeFactor() = 0;
+
+    /**
+     * Returns whether video clip is MMSCompatible.
+     *
+     * @return  ETrue if compatible with MMS
+     */
+    virtual TBool IsMMSCompatible() = 0;
+    
+    IMPORT_C static CVedVideoClipInfo* NewL(RFile* aFileHandle,
+                                            MVedVideoClipInfoObserver& aObserver);
+                                            
+    IMPORT_C static CVedVideoClipInfo* NewLC(RFile* aFileHandle,
+                                             MVedVideoClipInfoObserver& aObserver);
+                                             
+     /**
+     * Returns the file name of the clip. Panics if there is no file 
+     * associated with this clip or info is not yet ready for reading.
+     * 
+     * @return  file name of the clip
+     */
+    virtual RFile* FileHandle() const = 0;
+    
+    };
+
+
+
+#endif // __VEDVIDEOCLIPINFO_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditor_plat/video_editor_engine_api/video_editor_engine_api.metaxml	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<api id="d72893ab8a6a13277e62bf59d73e826e" dataversion="2.0">
+  <name>Video Editor Engine API</name>
+  <description>API for video editing, transcoding, thumbnail generation</description>
+  <type>c++</type>
+  <collection>videoeditorengine</collection>
+  <libs>
+    <lib name="vedengine.lib" />
+  </libs>
+  <release category="platform"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/bwins/aedengineu.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,60 @@
+EXPORTS
+	??1CAudClipInfo@@UAE@XZ @ 1 NONAME ; CAudClipInfo::~CAudClipInfo(void)
+	??1CAudSong@@UAE@XZ @ 2 NONAME ; CAudSong::~CAudSong(void)
+	?AddClipL@CAudSong@@QAEXABVTDesC16@@VTTimeIntervalMicroSeconds@@H11@Z @ 3 NONAME ; void CAudSong::AddClipL(class TDesC16 const &, class TTimeIntervalMicroSeconds, int, class TTimeIntervalMicroSeconds, class TTimeIntervalMicroSeconds)
+	?AreOutputPropertiesSupported@CAudSong@@QAEHABVTAudFileProperties@@@Z @ 4 NONAME ; int CAudSong::AreOutputPropertiesSupported(class TAudFileProperties const &)
+	?CancelVisualization@CAudClipInfo@@QAEXXZ @ 5 NONAME ; void CAudClipInfo::CancelVisualization(void)
+	?Clip@CAudSong@@QBEPAVCAudClip@@HH@Z @ 6 NONAME ; class CAudClip * CAudSong::Clip(int, int) const
+	?ClipCount@CAudSong@@QBEHH@Z @ 7 NONAME ; int CAudSong::ClipCount(int) const
+	?CutInTime@CAudClip@@QBE?AVTTimeIntervalMicroSeconds@@XZ @ 8 NONAME ; class TTimeIntervalMicroSeconds CAudClip::CutInTime(void) const
+	?CutOutTime@CAudClip@@QBE?AVTTimeIntervalMicroSeconds@@XZ @ 9 NONAME ; class TTimeIntervalMicroSeconds CAudClip::CutOutTime(void) const
+	?DynamicLevelMark@CAudClip@@QBE?AVTAudDynamicLevelMark@@H@Z @ 10 NONAME ; class TAudDynamicLevelMark CAudClip::DynamicLevelMark(int) const
+	?DynamicLevelMarkCount@CAudClip@@QBEHXZ @ 11 NONAME ; int CAudClip::DynamicLevelMarkCount(void) const
+	?EditedDuration@CAudClip@@QBE?AVTTimeIntervalMicroSeconds@@XZ @ 12 NONAME ; class TTimeIntervalMicroSeconds CAudClip::EditedDuration(void) const
+	?EndTime@CAudClip@@QBE?AVTTimeIntervalMicroSeconds@@XZ @ 13 NONAME ; class TTimeIntervalMicroSeconds CAudClip::EndTime(void) const
+	?FileName@CAudClipInfo@@QBE?AVTPtrC16@@XZ @ 14 NONAME ; class TPtrC16 CAudClipInfo::FileName(void) const
+	?GetFrameDurationMicro@CAudSong@@QAEHXZ @ 15 NONAME ; int CAudSong::GetFrameDurationMicro(void)
+	?GetFrameSizeEstimateL@CAudSong@@QBEHVTTimeIntervalMicroSeconds@@0@Z @ 16 NONAME ; int CAudSong::GetFrameSizeEstimateL(class TTimeIntervalMicroSeconds, class TTimeIntervalMicroSeconds) const
+	?GetMP4DecoderSpecificInfoLC@CAudSong@@QBEHAAPAVHBufC8@@H@Z @ 17 NONAME ; int CAudSong::GetMP4DecoderSpecificInfoLC(class HBufC8 * &, int) const
+	?GetSizeEstimateL@CAudSong@@QBEHXZ @ 18 NONAME ; int CAudSong::GetSizeEstimateL(void) const
+	?GetTimeEstimateL@CAudSong@@QAE?AVTTimeIntervalMicroSeconds@@XZ @ 19 NONAME ; class TTimeIntervalMicroSeconds CAudSong::GetTimeEstimateL(void)
+	?GetTimeEstimateL@CAudSong@@QAEHAAVMAudTimeEstimateObserver@@W4TAudType@@HW4TChannelMode@@H@Z @ 20 NONAME ; int CAudSong::GetTimeEstimateL(class MAudTimeEstimateObserver &, enum TAudType, int, enum TChannelMode, int)
+	?GetVisualizationL@CAudClipInfo@@QBEXAAVMAudVisualizationObserver@@HH@Z @ 21 NONAME ; void CAudClipInfo::GetVisualizationL(class MAudVisualizationObserver &, int, int) const
+	?GetVolumeGain@CAudClip@@QAEHXZ @ 22 NONAME ; int CAudClip::GetVolumeGain(void)
+	?IndexOnTrack@CAudClip@@QBEHXZ @ 23 NONAME ; int CAudClip::IndexOnTrack(void) const
+	?Info@CAudClip@@QBEPAVCAudClipInfo@@XZ @ 24 NONAME ; class CAudClipInfo * CAudClip::Info(void) const
+	?InsertDynamicLevelMarkL@CAudClip@@QAEHABVTAudDynamicLevelMark@@@Z @ 25 NONAME ; int CAudClip::InsertDynamicLevelMarkL(class TAudDynamicLevelMark const &)
+	?Muting@CAudClip@@QBEHXZ @ 26 NONAME ; int CAudClip::Muting(void) const
+	?NewL@CAudClipInfo@@SAPAV1@ABVTDesC16@@AAVMAudClipInfoObserver@@@Z @ 27 NONAME ; class CAudClipInfo * CAudClipInfo::NewL(class TDesC16 const &, class MAudClipInfoObserver &)
+	?NewL@CAudSong@@SAPAV1@PAVRFs@@@Z @ 28 NONAME ; class CAudSong * CAudSong::NewL(class RFs *)
+	?NewLC@CAudClipInfo@@SAPAV1@ABVTDesC16@@AAVMAudClipInfoObserver@@@Z @ 29 NONAME ; class CAudClipInfo * CAudClipInfo::NewLC(class TDesC16 const &, class MAudClipInfoObserver &)
+	?NewLC@CAudSong@@SAPAV1@PAVRFs@@@Z @ 30 NONAME ; class CAudSong * CAudSong::NewLC(class RFs *)
+	?Normalizing@CAudClip@@QBEHXZ @ 31 NONAME ; int CAudClip::Normalizing(void) const
+	?OutputFileProperties@CAudSong@@QBE?AVTAudFileProperties@@XZ @ 32 NONAME ; class TAudFileProperties CAudSong::OutputFileProperties(void) const
+	?Priority@CAudClip@@QBEHXZ @ 33 NONAME ; int CAudClip::Priority(void) const
+	?Properties@CAudClipInfo@@QBE?AVTAudFileProperties@@XZ @ 34 NONAME ; class TAudFileProperties CAudClipInfo::Properties(void) const
+	?RegisterSongObserverL@CAudSong@@QAEXPAVMAudSongObserver@@@Z @ 35 NONAME ; void CAudSong::RegisterSongObserverL(class MAudSongObserver *)
+	?RemoveClip@CAudSong@@QAEXHH@Z @ 36 NONAME ; void CAudSong::RemoveClip(int, int)
+	?RemoveDynamicLevelMark@CAudClip@@QAEHH@Z @ 37 NONAME ; int CAudClip::RemoveDynamicLevelMark(int)
+	?Reset@CAudClip@@QAEXH@Z @ 38 NONAME ; void CAudClip::Reset(int)
+	?Reset@CAudSong@@QAEXH@Z @ 39 NONAME ; void CAudSong::Reset(int)
+	?SetCutInTime@CAudClip@@QAEXVTTimeIntervalMicroSeconds@@@Z @ 40 NONAME ; void CAudClip::SetCutInTime(class TTimeIntervalMicroSeconds)
+	?SetCutOutTime@CAudClip@@QAEXVTTimeIntervalMicroSeconds@@@Z @ 41 NONAME ; void CAudClip::SetCutOutTime(class TTimeIntervalMicroSeconds)
+	?SetDuration@CAudSong@@QAEHVTTimeIntervalMicroSeconds@@@Z @ 42 NONAME ; int CAudSong::SetDuration(class TTimeIntervalMicroSeconds)
+	?SetMuting@CAudClip@@QAEXH@Z @ 43 NONAME ; void CAudClip::SetMuting(int)
+	?SetNormalizing@CAudClip@@QAEXH@Z @ 44 NONAME ; void CAudClip::SetNormalizing(int)
+	?SetOutputFileFormat@CAudSong@@QAEHW4TAudType@@HW4TChannelMode@@H@Z @ 45 NONAME ; int CAudSong::SetOutputFileFormat(enum TAudType, int, enum TChannelMode, int)
+	?SetPriority@CAudClip@@QAEHH@Z @ 46 NONAME ; int CAudClip::SetPriority(int)
+	?SetStartTime@CAudClip@@QAEXVTTimeIntervalMicroSeconds@@@Z @ 47 NONAME ; void CAudClip::SetStartTime(class TTimeIntervalMicroSeconds)
+	?SetVolumeGain@CAudClip@@QAEXH@Z @ 48 NONAME ; void CAudClip::SetVolumeGain(int)
+	?StartTime@CAudClip@@QBE?AVTTimeIntervalMicroSeconds@@XZ @ 49 NONAME ; class TTimeIntervalMicroSeconds CAudClip::StartTime(void) const
+	?SyncCancelProcess@CAudSong@@QAEXXZ @ 50 NONAME ; void CAudSong::SyncCancelProcess(void)
+	?SyncProcessFrameL@CAudSong@@QAEHAAPAVHBufC8@@AAHAAVTTimeIntervalMicroSeconds@@@Z @ 51 NONAME ; int CAudSong::SyncProcessFrameL(class HBufC8 * &, int &, class TTimeIntervalMicroSeconds &)
+	?SyncStartProcessingL@CAudSong@@QAEHXZ @ 52 NONAME ; int CAudSong::SyncStartProcessingL(void)
+	?TrackIndex@CAudClip@@QBEHXZ @ 53 NONAME ; int CAudClip::TrackIndex(void) const
+	?UnregisterSongObserver@CAudSong@@QAEXPAVMAudSongObserver@@@Z @ 54 NONAME ; void CAudSong::UnregisterSongObserver(class MAudSongObserver *)
+	?AddClipL@CAudSong@@QAEXPAVRFile@@VTTimeIntervalMicroSeconds@@H11@Z @ 55 NONAME ; void CAudSong::AddClipL(class RFile *, class TTimeIntervalMicroSeconds, int, class TTimeIntervalMicroSeconds, class TTimeIntervalMicroSeconds)
+	?FileHandle@CAudClipInfo@@QBEPAVRFile@@XZ @ 56 NONAME ; class RFile * CAudClipInfo::FileHandle(void) const
+	?NewL@CAudClipInfo@@SAPAV1@PAVRFile@@AAVMAudClipInfoObserver@@@Z @ 57 NONAME ; class CAudClipInfo * CAudClipInfo::NewL(class RFile *, class MAudClipInfoObserver &)
+	?NewLC@CAudClipInfo@@SAPAV1@PAVRFile@@AAVMAudClipInfoObserver@@@Z @ 58 NONAME ; class CAudClipInfo * CAudClipInfo::NewLC(class RFile *, class MAudClipInfoObserver &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AAC/inc/AudParams.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+* Generic API for audio codecs.  
+*
+*/
+
+#ifndef __AUDPARAMS_H__
+#define __AUDPARAMS_H__
+
+
+// INCLUDES
+
+#include <E32Base.h>
+
+
+// CLASS DEFINITIONS
+/*
+-----------------------------------------------------------------------------
+
+    TAudioCodecParams
+
+    Audio codec parameters.
+
+-----------------------------------------------------------------------------
+*/
+class TAudioCodecParams
+    {
+public:
+    enum TParamsType
+        {
+        ETypeDecoder = 0,
+        ETypeEncoder
+        };
+public:
+    virtual TInt CodecId() const = 0;
+    virtual TInt Type() const = 0;
+    };
+
+
+/*
+-----------------------------------------------------------------------------
+
+    TAudioDecoderParams
+
+    Decoding parameters.
+
+-----------------------------------------------------------------------------
+*/
+class TAudioDecoderParams : public TAudioCodecParams
+    {
+public:
+    IMPORT_C virtual TInt Type() const;
+    };
+
+
+/*
+-----------------------------------------------------------------------------
+
+    TAudioEncoderParams
+
+    Encoding parameters.
+
+-----------------------------------------------------------------------------
+*/
+class TAudioEncoderParams : public TAudioCodecParams
+    {
+public:
+    IMPORT_C virtual TInt Type() const;
+    };
+
+
+#endif //__AUDPARAMS_H__
+//-----------------------------------------------------------------------------
+//  End of File
+//-----------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AAC/inc/ProcAACFrameHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+
+#ifndef __CPROCAACFRAMEHANDLER_H__
+#define __CPROCAACFRAMEHANDLER_H__
+
+#include <e32base.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "ProcFrameHandler.h"
+
+#include "AACConstants.h"
+#include "AACAPI.h"
+
+class CProcAACFrameHandler : public CProcFrameHandler 
+    {
+
+public:
+
+    // aGain -40(dB) - +20(dB)
+    virtual TBool ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain);
+
+    // From base class
+    virtual TBool GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const;
+    virtual TBool GetNormalizingMargin(const HBufC8* aFrame, TInt8& aMargin) const;
+
+    virtual ~CProcAACFrameHandler();
+
+    static CProcAACFrameHandler* NewL(TAACFrameHandlerInfo aAACInfo);
+    static CProcAACFrameHandler* NewLC(TAACFrameHandlerInfo aAACInfo);
+    
+    /*
+    *
+    * If there are several AAC frames in a row, their start positions and
+    * lengths can be parsed with this function
+    *
+    * @param aFrame                input frame to be parsed
+    * @param aFrameStarts        starting locations of each frame
+    * @param aFrameLengths        frame lengths of each frame
+    */
+    
+    TBool ParseFramesL(HBufC8* aFrame, RArray<TInt>& aFrameStarts, RArray<TInt>& aFrameLengths);
+
+    /*
+    * GetEnhancedAACPlusParametersL
+    *
+    * Fills in aacPlus related fields in aProperties
+    *
+    *
+    * @param    buf            audio data
+    * @param    bufLen        lenght of "buf"
+    * @param     aProperties    properties to fill in
+    * @param    aAACInfo    info for AAC framehandler    
+    *
+    */
+
+    static void GetEnhancedAACPlusParametersL(TUint8* buf, TInt bufLen, 
+                                            TAudFileProperties* aProperties, 
+                                            TAACFrameHandlerInfo *aAACInfo);
+
+    /*
+    * CalculateNumberOfHeaderBytes returns the number of ADTS header bytes 
+    * and the number of data blocks in a given frame
+    *
+    * @param    aFrame    input frame
+    * @param    aNumBlocks (output) number of data blocks in the frame (usually 1)
+    *
+    * @return    the number of ADTS header bytes
+    */
+
+    TInt CalculateNumberOfHeaderBytes(const HBufC8* aFrame, TInt& aNumBlocksInFrame) const;
+
+private:
+
+    // constructL
+    void ConstructL(TAACFrameHandlerInfo aAACInfo);
+    
+    // c++ constructor
+    CProcAACFrameHandler();
+
+    // updates the ADTS header if the lenght has 
+    // been changed after modifying AACPlus gain
+    TBool UpdateHeaderL(HBufC8* aFrame);
+
+private:
+
+    // AAC decoder handle
+    CAACAudDec* iDecHandle; 
+    
+    // stores the starting points of raw data blocks if there are 
+    // more than one data block in AAC frame
+    RArray<TInt> iFrameStarts;
+    
+    // lenghts of the data blocks 
+    RArray<TInt> iFrameLengths;
+    
+    // info needed for AAC decoder handle creation
+    TAACFrameHandlerInfo iAACInfo;
+    
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AAC/inc/ProcADTSInFileHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#ifndef __CPROCADTSINFILEHANDLER_H__
+#define __CPROCADTSINFILEHANDLER_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "ProcInFileHandler.h"
+#include "AACConstants.h"
+#include "ProcDecoder.h"
+
+
+
+class CProcADTSInFileHandler: public CProcInFileHandler 
+    {
+
+public:
+
+    static CProcADTSInFileHandler* NewL(const TDesC& aFileName, 
+                                        RFile* aFileHandle,
+                                        CAudClip* aClip, TInt aReadBufferSize, 
+                                        TInt aTargetSampleRate = 0,
+                                        TChannelMode aChannelMode = EAudSingleChannel);
+                                        
+    static CProcADTSInFileHandler* NewLC(const TDesC& aFileName, 
+                                         RFile* aFileHandle,
+                                         CAudClip* aClip, TInt aReadBufferSize,
+                                         TInt aTargetSampleRate = 0,
+                                         TChannelMode aChannelMode = EAudSingleChannel);
+
+
+    // From base class
+
+    void GetPropertiesL(TAudFileProperties* aProperties);
+    
+    /**
+    * Seeks a certain audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    * @param aTime            time from the beginning of file in milliseconds
+    *
+    * @return    ETrue if successful
+    *            EFalse if beyond the file
+    */
+    TBool SeekAudioFrame(TInt32 aTime);
+
+    
+    /**
+    * Seeks a cut in audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    *
+    * @return    ETrue if successful
+    *                
+    */
+    TBool SeekCutInFrame();
+
+    /**
+    *
+    * Sets the normalizing gain
+    *
+    * @param    aFrameHandler    AAC frame handler
+    *
+    * @return    ETrue if successful
+    */
+    TBool SetNormalizingGainL(const CProcFrameHandler* aFrameHandler);
+
+    /*
+    * Fills in aac info
+    *
+    * @param     aAACInfo    aac info
+    *
+    * @return    ETrue if successful
+    */
+    TBool GetInfoForFrameHandler(TAACFrameHandlerInfo& aAACInfo);
+
+
+    /**
+    * Generates decoder specific information for MP4/3GP files
+    * 
+    * The caller is responsible for releasing aDecSpecInfo 
+    *
+    * @param    aBytes    decoder specific info 
+    * @param    aBufferSize        max size of decSpecInfo
+    *
+    * @return    ETrue  if info was generated
+    *            EFalse if info was not generated (no need to release aFrame)
+    */
+    TBool ReadAudioDecoderSpecificInfoL(HBufC8*& aBytes, TInt aBufferSize);
+
+
+    ~CProcADTSInFileHandler();
+
+
+    
+
+private:
+
+    // constructL    
+    void ConstructL(const TDesC& aFileName, RFile* aFileHandle, CAudClip* aClip, TInt aReadBufferSize,
+                    TInt aTargetSampleRate = 0, TChannelMode aChannelMode = EAudSingleChannel);
+                    
+    virtual TBool GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime);
+    
+    // C++ constructor
+    CProcADTSInFileHandler();
+    
+    // Find the first AAC frame
+    // There might be some stuff in the file before audio data (e.g. ID3 header)
+    TBool FindFirstAACFrame();
+    
+    // calculates the frame length based of 4th, 5th and 6th byte of ADTS header
+    TUint CalculateAACFrameLength(TUint8 byte4, TUint8 byte5, TUint8 byte6);
+
+    // fills in fields of aProperties based on ADTS header
+    TBool ReadHeaderInformation(TAudFileProperties* aProperties);
+
+    // fills in the rest of the fields
+    TBool ReadOtherInformationL(TAudFileProperties* aProperties);
+
+private:
+
+    // info for frame handler
+    TAACFrameHandlerInfo* iFrameInfo;
+
+    // MP4 decoder specific info
+    HBufC8* iMP4DecSpecInfo;
+
+    // offset of the first ADTS frame in a file
+    TUint32 iFirstFrame;
+    
+    // flag to indicate whether the file can be parsed
+    TBool iSupportedFile;
+
+    // remainder if audio duration can't be handled accurately in TInt milliseconds, depends on sampling rate
+    TReal iAACFrameLenRemainderMilli;
+    
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AAC/src/ProcAACFrameHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,620 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+
+#include "ProcAACFrameHandler.h"
+#include "ProcFrameHandler.h"
+#include "ProcTools.h"
+#include "nok_bits.h"
+#include "AACAPI.h"
+
+#include <f32file.h>
+#include <e32math.h>
+
+
+TBool CProcAACFrameHandler::ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain) 
+    {
+
+    if (aFrameIn == 0)
+        return EFalse;
+
+    
+    TInt numBlocks = 1;
+    TInt headerBytes = CalculateNumberOfHeaderBytes(aFrameIn, numBlocks);
+    
+    // Unfortunately const casting is needed to avoid unecessary temporary arrays
+    // and we don't have a separate bitstream class for const objects
+    // Just have to make very sure not to modify const descriptors!!
+    TUint8* buf = const_cast<TUint8*>(aFrameIn->Right(aFrameIn->Size()-headerBytes).Ptr());
+    
+    uint8* gains = new (ELeave) uint8[16];
+    uint32* gainPos = new (ELeave) uint32[16];
+
+    TInt bufLen = aFrameIn->Size()-headerBytes;
+
+    TBitStream bs;
+    TBitStream bs2;
+    
+    BsInit(&bs, buf, bufLen);
+    BsInit(&bs2, buf, bufLen);
+    
+    for (TInt b = 0 ; b < numBlocks ; b++)
+        {
+        
+        TInt b_i = bs.buf_index;
+        iFrameStarts.Append(b_i+headerBytes);
+
+        BsSaveBufState(&bs, &bs2);
+
+        uint8 numberOfGains = GetAACGlobalGains(&bs, iDecHandle, 16, gains, gainPos);
+        
+        if (numberOfGains > 2)
+            {
+            // illegal frame??
+            delete[] gainPos;
+            delete[] gains;
+            return KErrGeneral;
+
+            }
+
+        if (bs.buf_index > 0)
+            iFrameLengths.Append(bs.buf_index - b_i);
+        else
+            iFrameLengths.Append(bs.buf_len - b_i);
+        
+        if (headerBytes > 7)
+            {
+            bs.buf_index += 2; // crc
+            bs.slots_read += 2;
+            bs.bits_read += 16;
+
+            }
+                
+        TInt tmpGain = aGain*500;
+        int16 newGain = static_cast<int16>(tmpGain/1500);
+        
+        
+        for (TInt a = 0 ; a < numberOfGains ; a++)
+        {
+            if (gains[a] + newGain > 255)
+            {
+                gains[a] = 255;
+            }
+            else if (gains[a] + newGain < 0)
+            {
+                gains[a] = 0;
+            }
+            else
+            {
+                gains[a] = static_cast<TUint8>(gains[a]+newGain);
+            }
+        }
+        
+    
+        if (iAACInfo.isSBR || iAACInfo.iIsParametricStereo)
+            {
+
+            uint8 *data = new (ELeave) uint8[1024];
+            CleanupStack::PushL(data);
+            TBitStream bsOut;
+
+            BsInit(&bsOut, data, 1024);
+
+            SetAACPlusGlobalGains(&bs2, &bsOut, iDecHandle, static_cast<int16>(-newGain), numberOfGains, gains, gainPos);
+            
+            TInt incBytes = (bsOut.bits_read >> 3) - bs2.buf_len;
+            iFrameLengths[iFrameLengths.Count()-1] +=incBytes; 
+            
+            TInt newSize = aFrameIn->Size()+incBytes;
+            aFrameOut = HBufC8::NewL(newSize);
+            aFrameOut->Des().Append(aFrameIn->Left(headerBytes));
+            aFrameOut->Des().Append(bsOut.bit_buffer, bsOut.bits_read >> 3);
+            
+            if (headerBytes != 0) UpdateHeaderL(aFrameOut);
+                
+            CleanupStack::Pop(data);
+            delete[] data;
+            data = 0;
+            
+                
+            }
+        else
+            {
+            SetAACGlobalGains(&bs2, numberOfGains, gains, gainPos);
+            aFrameOut = HBufC8::NewL(aFrameIn->Size());
+            aFrameOut->Des().Copy(aFrameIn->Ptr(), aFrameIn->Size());
+        
+            }
+            
+
+            
+        //    }
+
+        }
+    delete[] gains;
+    delete[] gainPos;
+    
+    
+    return ETrue;
+    }
+
+TBool CProcAACFrameHandler::GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const
+    {
+
+    
+    TInt numBlocks = 1;
+    TInt headerBytes = CalculateNumberOfHeaderBytes(aFrame, numBlocks);
+    
+    //TBitStream bs;
+    TUint8* buf = const_cast<TUint8*>(aFrame->Right(aFrame->Size()-headerBytes).Ptr());
+    //BsInit(&bs, buf, aFrame->Size()-headerBytes);
+
+    uint8* gains = new (ELeave) uint8[16];
+    CleanupStack::PushL(gains);
+    uint32* gainPos = new (ELeave) uint32[16];
+    CleanupStack::PushL(gainPos);
+
+    //TPtr8 frameWithoutHeader = aFrame->Right(aFrame->Size()-headerBytes));
+    TInt bufLen = aFrame->Size()-headerBytes;
+
+    TBitStream bs;
+
+    
+    BsInit(&bs, buf, bufLen);
+    
+    
+    for (TInt b = 0 ; b < numBlocks ; b++)
+    {
+                
+        uint8 numberOfGains = GetAACGlobalGains(&bs, iDecHandle, 16, gains, gainPos);
+
+        for (TInt a = 0 ; a < numberOfGains ; a++)
+        {
+            aGains.Append(gains[a]);
+        }
+
+        if (headerBytes > 7)
+            {
+            bs.buf_index += 2; // crc
+            bs.slots_read += 2;
+            bs.bits_read += 16;
+
+            }
+                
+    }
+    CleanupStack::Pop(); //(gainPos)
+    CleanupStack::Pop(); //(gains)
+    delete[] gains;
+    delete[] gainPos;
+
+    aMaxGain = 255;
+    return EFalse;
+
+
+
+    }
+
+
+TBool CProcAACFrameHandler::GetNormalizingMargin(const HBufC8* aFrame, TInt8& aMargin) const
+
+    {
+        
+    TUint8* buf = const_cast<TUint8*>(aFrame->Ptr());
+    TInt bufLen = aFrame->Size();
+
+    uint8* gains = new uint8[16];
+
+    uint32* gainPos = new uint32[16];
+    
+    
+    TBitStream bs;
+    
+    BsInit(&bs, buf, bufLen);
+
+    uint8 numberOfGains = GetAACGlobalGains(&bs, iDecHandle, 16, gains, gainPos);
+
+    TUint8 maxGain = 0;
+
+    for (TInt a = 0 ; a < numberOfGains ; a++)
+        {
+        if (gains[a] > maxGain)
+            {
+            maxGain = gains[a];
+            }
+        }
+    delete[] gains;
+    delete[] gainPos;
+
+    TInt marginInt = (255-maxGain)*6;
+
+    if (marginInt > 127)
+        {
+        aMargin = 127;
+        }
+    else if (marginInt < 0)
+        {
+        aMargin = 0;
+        }
+    else
+        {
+        aMargin = static_cast<TInt8>(marginInt);
+        }
+
+    return ETrue;
+
+
+    }
+
+CProcAACFrameHandler::~CProcAACFrameHandler()
+    {
+
+    iFrameStarts.Reset();
+    iFrameLengths.Reset();
+    if (iDecHandle != 0)
+        {
+        
+        DeleteAACAudDec(iDecHandle);
+        }
+
+
+    }
+
+CProcAACFrameHandler* CProcAACFrameHandler::NewL(TAACFrameHandlerInfo aAACInfo) 
+    {
+
+    
+    CProcAACFrameHandler* self = NewLC(aAACInfo);
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+CProcAACFrameHandler* CProcAACFrameHandler::NewLC(TAACFrameHandlerInfo aAACInfo) 
+    {
+
+    CProcAACFrameHandler* self = new (ELeave) CProcAACFrameHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL(aAACInfo);
+    return self;
+
+    }
+
+void CProcAACFrameHandler::ConstructL(TAACFrameHandlerInfo aAACInfo) 
+    {
+    
+    CreateAACAudDecL(iDecHandle, static_cast<TInt16>(aAACInfo.iNumChannels), 
+                                static_cast<TInt16>(aAACInfo.iNumCouplingChannels));
+    
+    InitAACAudDec(iDecHandle, static_cast<TInt16>(aAACInfo.iProfileID), 
+                                static_cast<TInt16>(aAACInfo.iSampleRateID), 
+                                static_cast<TUint8>(aAACInfo.iIs960));
+    
+    if(aAACInfo.isSBR)
+        {
+        uint8 isStereo;
+        
+        isStereo = (aAACInfo.iNumChannels > 1) ? 1 : 0;
+        
+        CreateAACPlusAudDecL(iDecHandle, static_cast<TInt16>(aAACInfo.iSampleRateID), isStereo, (uint8) 0);
+        }
+    iAACInfo = aAACInfo;
+    
+}
+
+CProcAACFrameHandler::CProcAACFrameHandler() : iDecHandle(0)
+{
+    
+}
+
+TInt CProcAACFrameHandler::CalculateNumberOfHeaderBytes(const HBufC8* aFrame, TInt& aNumBlocksInFrame) const
+    {
+
+    if (aFrame->Size() < 7) return 0;
+    TBuf8<7> possibleHeader(aFrame->Left(7));
+
+    TUint8 byte2 = possibleHeader[1];
+    TBuf8<8> byte2b;
+    ProcTools::Dec2Bin(byte2, byte2b);
+    TUint8 byte7 = possibleHeader[6];
+
+    // lets confirm that we have found a legal AAC header
+    if (possibleHeader[0] == 0xFF &&
+        byte2b[0] == '1' &&
+        byte2b[1] == '1' &&
+        byte2b[2] == '1' &&
+        byte2b[3] == '1' &&
+        //    byte2b[4] == '1' &&
+        byte2b[5] == '0' &&
+        byte2b[6] == '0')
+        {
+        
+        aNumBlocksInFrame = (byte7 & 0x3)+1;
+        
+        
+        // protection_absent -> the last bit of the second byte
+        if (byte2b[7] == '0')
+            {
+            return 9 + 2*(aNumBlocksInFrame-1);
+            }
+        else
+            {
+            return 7;
+            }
+        
+        
+        
+
+
+        }
+    else
+        {
+        // it seems like a raw data block
+        return 0;
+
+
+
+        }
+    }
+
+
+
+TBool CProcAACFrameHandler::ParseFramesL(HBufC8* aFrame, RArray<TInt>& aFrameStarts, RArray<TInt>& aFrameLengths)
+{
+    if (iFrameStarts.Count() > 0)
+    {
+        for (TInt a = 0 ; a < iFrameStarts.Count() ; a++)
+        {
+            aFrameStarts.Append(iFrameStarts[a]);
+            aFrameLengths.Append(iFrameLengths[a]);
+        }    
+        iFrameStarts.Reset();
+        iFrameLengths.Reset();
+        return ETrue;
+    }
+    else
+    {
+        
+        TInt numBlocks = 1;
+        TInt headerBytes = CalculateNumberOfHeaderBytes(aFrame, numBlocks);
+        if (headerBytes > 0)
+        {
+            //TBuf8<headerBytes> hB(aFrame->Left(headerBytes));
+            
+            
+        }
+        
+        //TBitStream bs;
+        TUint8* buf = const_cast<TUint8*>(aFrame->Right(aFrame->Size()-headerBytes).Ptr());
+        //BsInit(&bs, buf, aFrame->Size()-headerBytes);
+        
+        uint8* gains = new (ELeave) uint8[16];
+        CleanupStack::PushL(gains);
+        uint32* gainPos = new (ELeave) uint32[16];
+        CleanupStack::PushL(gainPos);
+        
+        //TPtr8 frameWithoutHeader = aFrame->Right(aFrame->Size()-headerBytes));
+        TInt bufLen = aFrame->Size()-headerBytes;
+        
+        TBitStream bs;
+    
+        BsInit(&bs, buf, bufLen);
+    
+        for (TInt b = 0 ; b < numBlocks ; b++)
+        {
+            
+            TInt b_i = bs.buf_index;
+            iFrameStarts.Append(b_i+headerBytes);
+            
+            uint8 numberOfGains = GetAACGlobalGains(&bs, iDecHandle, 16, gains, gainPos);
+            if (numberOfGains > 2) 
+                {
+                CleanupStack::Pop(); // gainPos
+                CleanupStack::Pop(); // gains
+                delete[] gains;
+                delete[] gainPos;
+                return EFalse;
+
+                }
+            
+            if (bs.buf_index > 0)
+                iFrameLengths.Append(bs.buf_index - b_i);
+            else
+                iFrameLengths.Append(bs.buf_len - b_i);
+            
+            if (headerBytes > 7)
+            {
+                bs.buf_index += 2; // crc
+                bs.slots_read += 2;
+                bs.bits_read += 16;
+                
+            }
+                        
+        }
+        CleanupStack::Pop(); // gainPos
+        CleanupStack::Pop(); // gains
+        delete[] gains;
+        delete[] gainPos;
+
+        
+        
+        for (TInt c = 0 ; c < iFrameStarts.Count() ; c++)
+            {
+            aFrameStarts.Append(iFrameStarts[c]);
+            aFrameLengths.Append(iFrameLengths[c]);
+            }    
+        iFrameStarts.Reset();
+        iFrameLengths.Reset();
+        return ETrue;    
+        
+    }
+    
+    
+    
+    
+}
+
+
+
+TBool CProcAACFrameHandler::UpdateHeaderL(HBufC8* aFrame)
+    {
+
+    _LIT8(KZero, "0");
+
+    TInt frameLength = aFrame->Size();
+
+    HBufC8* lenBin;
+    ProcTools::Dec2BinL(frameLength, lenBin);
+    
+    HBufC8* len13Bin = HBufC8::NewL(13);
+    TInt zerosNeeded = 13-lenBin->Size();
+    
+    TPtr8 framePtr(aFrame->Des());
+    for (TInt w = 0 ; w < zerosNeeded ; w++)
+        {
+        len13Bin->Des().Append(_L8("0"));
+        }
+    len13Bin->Des().Append(lenBin->Des());
+
+    if (len13Bin->Mid(0,1).Compare(KZero) == 0)
+        {
+        framePtr[3] &= 0xFD; // 1111 1101
+        }
+    else
+        {
+        framePtr[3] |= 2;
+        }
+
+    if (len13Bin->Mid(1,1).Compare(KZero) == 0)
+        {
+        framePtr[3] &= 0xFE; // 1111 1110
+
+        }
+    else
+        {
+        framePtr[3] |= 1;
+        }
+
+
+    TUint byte5 = 0;
+    ProcTools::Bin2Dec(len13Bin->Mid(2,8),byte5);
+    framePtr[4] = static_cast<TUint8>(byte5);
+
+    if (len13Bin->Mid(10,1).Compare(KZero) == 0)
+        {
+        framePtr[5] &= 0x7F;
+
+        }
+    else
+        {
+        framePtr[5] |= 0x80;
+        }
+
+    if (len13Bin->Mid(11,1).Compare(KZero) == 0)
+        {
+        framePtr[5] &= 0xBF;
+
+        }
+    else
+        {
+        framePtr[5] |= 0x40;
+        }
+
+    if (len13Bin->Mid(12,1).Compare(KZero) == 0)
+        {
+        framePtr[5] &= 0xDF;
+
+        }
+    else
+        {
+        framePtr[5] |= 0x20;
+        }
+    delete lenBin;
+    delete len13Bin;
+    return ETrue;
+    }
+
+
+
+void CProcAACFrameHandler::
+GetEnhancedAACPlusParametersL(TUint8* buf, TInt bufLen, 
+                              TAudFileProperties* aProperties, 
+                              TAACFrameHandlerInfo *aAACInfo)
+{
+  TBitStream bs;
+  uint8 sbrStatus;
+  int16 bytesInFrame;
+  CAACAudDec* decHandle = 0;
+
+  //-- No SBR by default. --//
+  aAACInfo->isSBR = 0;
+  aAACInfo->iIsParametricStereo = 0;
+  aProperties->iAudioTypeExtension = EAudExtensionTypeNoExtension;
+  aProperties->iChannelModeExtension = EAudChannelModeNotRecognized;
+
+  //-- Create AAC handle. --//
+  CreateAACAudDecL(decHandle, 
+                   static_cast<TInt16>(aAACInfo->iNumChannels), 
+                   static_cast<TInt16>(aAACInfo->iNumCouplingChannels));
+  CleanupStack::PushL(decHandle);
+
+  //-- Initialize AAC handle. --/
+  InitAACAudDec(decHandle, 
+                static_cast<TInt16>(aAACInfo->iProfileID), 
+                                static_cast<TInt16>(aAACInfo->iSampleRateID), 
+                                static_cast<TUint8>(aAACInfo->iIs960));
+
+  //-- Create SBR handle on top of the AAC handle. --
+  sbrStatus = CreateAACPlusAudDecL(decHandle, static_cast<TInt16>(aAACInfo->iSampleRateID), 
+                                   (uint8) ((aAACInfo->iNumChannels > 1) ? 1 : 0), 
+                                   (uint8) 0);
+
+  if(sbrStatus)
+  {
+    //-- Initialize bitstream. --
+    BsInit(&bs, buf, bufLen);
+
+    //-- Parse the AAC frame. --/
+    CountAACChunkLength(&bs, decHandle, &bytesInFrame);
+
+    //-- Were any SBR elements found? --
+    if(IsAACSBREnabled(decHandle))
+    {
+      aAACInfo->isSBR = 1;
+      aProperties->iAudioTypeExtension = EAudExtensionTypeEnhancedAACPlus;
+      
+      aAACInfo->iIsParametricStereo = IsAACParametricStereoEnabled(decHandle);
+
+      if(aAACInfo->iIsParametricStereo)
+      {
+        aProperties->iChannelModeExtension = EAudParametricStereoChannel;
+        aProperties->iAudioTypeExtension = EAudExtensionTypeEnhancedAACPlusParametricStereo;
+      }
+    }
+  }
+
+
+  //-- Delete resources. --/
+  CleanupStack::Pop(decHandle);
+  if(decHandle != 0)
+      {
+      DeleteAACAudDec(decHandle);    
+      }
+    
+  decHandle = 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AAC/src/ProcADTSInFileHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1028 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include <e32base.h>
+#include <f32file.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "ProcADTSInFileHandler.h"
+//#include "mp4aud.h"
+#include "mp4config.h"
+#include "audconstants.h"
+
+#include "ProcTools.h"
+#include "ProcAACFrameHandler.h"
+
+
+ 
+CProcADTSInFileHandler* CProcADTSInFileHandler::NewL(const TDesC& aFileName, RFile* aFileHandle,
+                                                     CAudClip* aClip, TInt aReadBufferSize, 
+                                                     TInt aTargetSampleRate, TChannelMode aChannelMode)
+    {
+  
+  CProcADTSInFileHandler* self = NewLC(aFileName, aFileHandle, aClip, aReadBufferSize, aTargetSampleRate, aChannelMode);
+  CleanupStack::Pop(self);
+  return self;
+
+    }
+    
+CProcADTSInFileHandler* CProcADTSInFileHandler::NewLC(const TDesC& aFileName, RFile* aFileHandle,
+                                                      CAudClip* aClip, TInt aReadBufferSize, TInt aTargetSampleRate,
+                                                      TChannelMode aChannelMode)
+
+    {
+
+  CProcADTSInFileHandler* self = new (ELeave) CProcADTSInFileHandler();
+  CleanupStack::PushL(self);
+  self->ConstructL(aFileName, aFileHandle, aClip, aReadBufferSize, aTargetSampleRate, aChannelMode);
+  return self;
+
+    }
+
+void CProcADTSInFileHandler::GetPropertiesL(TAudFileProperties* aProperties)
+    {
+
+    if (iProperties != 0)
+        {
+        *aProperties = *iProperties;
+        return;
+        }
+
+    aProperties->iDuration = 0;
+    aProperties->iSamplingRate = 0;
+    aProperties->iBitrate = 0;
+    aProperties->iChannelMode = EAudChannelModeNotRecognized;
+    aProperties->iFrameLen = 0;
+    aProperties->iFrameCount = 0;
+
+    aProperties->iAudioType = EAudTypeUnrecognized;
+    aProperties->iAudioTypeExtension = EAudExtensionTypeNoExtension;
+    aProperties->iFileFormat = EAudFormatUnrecognized;
+    aProperties->iBitrateMode = EAudBitrateModeNotRecognized;
+    aProperties->iFrameDuration = 0;
+    aProperties->iNumFramesPerSample = 1;
+    aProperties->iChannelModeExtension = EAudChannelModeNotRecognized;
+    aProperties->iAACObjectType = EAudAACObjectTypeNone;
+    
+    if (!iSupportedFile)
+        {
+        User::Leave(KErrNotSupported);
+        return;
+        }
+
+    ReadHeaderInformation(aProperties);
+    ReadOtherInformationL(aProperties);
+
+    aProperties->iBitrateMode = EAudConstant;
+
+    if (iProperties == 0)
+        {
+        iProperties = new (ELeave) TAudFileProperties;
+        *iProperties = *aProperties;
+        }
+
+    }
+
+
+TBool CProcADTSInFileHandler::SeekAudioFrame(TInt32 aTime)
+    {
+    
+    if (!iSupportedFile)
+        {
+        return EFalse;
+        }
+
+    if (aTime == 0) 
+        {
+        FindFirstAACFrame();
+        iCurrentTimeMilliseconds = aTime;
+        return ETrue;
+        }
+    
+    else FindFirstAACFrame();
+
+    TBuf8<6> header;
+
+    if(BufferedFileRead(header, 6) != 6)
+        {
+        return EFalse;
+        }
+
+    if (header.Length() != 6)
+        {
+        return EFalse;
+        }
+
+    TUint8 byte2 = header[1];
+    TBuf8<8> byte2b;
+    ProcTools::Dec2Bin(byte2, byte2b);
+    // lets confirm that we have found a legal AAC header
+    if (header[0] == 0xFF &&
+        byte2b[0] == '1' &&
+        byte2b[1] == '1' &&
+        byte2b[2] == '1' &&
+        byte2b[3] == '1' &&
+        //byte2b[4] == '1' &&
+        byte2b[5] == '0' &&
+        byte2b[6] == '0')
+        {
+        }    
+    else
+        {
+        return EFalse;
+        }
+
+    TUint8 byte4 = header[3];
+    TUint8 byte5 = header[4];
+    TUint8 byte6 = header[5];
+
+    TUint frameLen = CalculateAACFrameLength(byte4, byte5, byte6);    
+    //aFrame = HBufC8::NewL(frameLen);
+
+    TInt dur = 0;
+    
+    while (BufferedFileSetFilePos(iFilePos-6+frameLen))
+        {
+
+        dur = dur + ProcTools::MilliSeconds(iProperties->iFrameDuration);
+        if (dur > aTime)
+            {
+            break;
+            }
+
+        if(BufferedFileRead(header, 6) != 6)
+            {
+            break;
+            }
+
+        if (header.Length() != 6)
+            {
+            break;
+            }
+
+        if (header[0] != 0xFF) break;
+        byte4 = header[3];
+        byte5 = header[4];
+        byte6 = header[5];
+
+        frameLen = CalculateAACFrameLength(byte4, byte5, byte6);    
+    
+        }
+
+
+    aTime = dur;
+    iCurrentTimeMilliseconds = aTime;
+    return ETrue;
+    }
+
+TBool CProcADTSInFileHandler::SeekCutInFrame()
+    {
+    iCurrentTimeMilliseconds = iCutInTime;
+    return SeekAudioFrame(iCutInTime);
+    }
+
+
+
+
+TBool CProcADTSInFileHandler::SetNormalizingGainL(const CProcFrameHandler* aFrameHandler)
+    {
+    
+    
+    HBufC8* point = 0;
+    TInt siz;
+    TInt32 tim = 0;
+    TInt maxGain = 0;
+    RArray<TInt> gains;
+    TInt maxAverage = 0;
+    TInt tmpGain = 0;
+    TInt gainCounter = 0;
+    TInt timeNow = 0;
+    while(GetEncAudioFrameL(point, siz, tim)) 
+    {
+        CleanupStack::PushL(point);
+        
+        aFrameHandler->GetGainL(point, gains, maxGain);
+        timeNow += tim;
+        
+        for (TInt a = 0 ; a < gains.Count() ; a++)
+        {
+            tmpGain += gains[a];
+            gainCounter++;
+        }
+        gains.Reset();
+        
+        if (timeNow > 1000)
+        {
+            if (tmpGain/gainCounter > maxAverage)
+            {
+                maxAverage = tmpGain/gainCounter;
+            }
+            
+            timeNow = 0;
+            tmpGain = 0;
+            gainCounter = 0;
+        }
+        
+        CleanupStack::PopAndDestroy(point);
+        
+    }
+    
+    // bigger value makes normalizing more efficient, but makes
+    // dynamic compression more likely to occur
+    TInt NormalizingFactor = 175;
+    if (iProperties->iBitrate > 20000 && iProperties->iBitrate < 40000)
+    {
+        
+        // 32 kBit/s
+        NormalizingFactor = 170;
+        
+    }
+    else if (iProperties->iBitrate > 80000 && iProperties->iBitrate < 110000)
+    {
+        // 96 kBit/s
+        NormalizingFactor = 170;
+        
+    }
+    
+    
+    else if (iProperties->iBitrate > 110000 && iProperties->iBitrate < 140000)
+    {
+        // 128 kBit/s
+        if (iProperties->iChannelMode == EAudSingleChannel)
+            NormalizingFactor = 160;
+        else
+            NormalizingFactor = 170;
+        
+    }
+    else if (iProperties->iBitrate > 150000)
+    {
+        // 256 kBit/s
+        if (iProperties->iChannelMode == EAudSingleChannel)
+            NormalizingFactor = 150;
+        else
+            NormalizingFactor = 165;
+        
+    }
+    else
+    {
+        
+        if (iProperties->iChannelMode == EAudSingleChannel)
+            NormalizingFactor = 170;
+        
+    }
+    
+    
+    TInt gainBoost = (NormalizingFactor-maxAverage)*3;
+    
+    if (gainBoost < 0) gainBoost = 0;
+    
+    iNormalizingMargin = static_cast<TInt8>(gainBoost);
+    
+    return ETrue;
+
+    }
+
+
+TBool CProcADTSInFileHandler::ReadAudioDecoderSpecificInfoL(HBufC8*& aBytes, TInt aBufferSize)
+    {
+
+    if (aBufferSize < iMP4DecSpecInfo->Size()) return EFalse;
+
+    if (iMP4DecSpecInfo != 0)
+        {    
+        aBytes = HBufC8::NewL(iMP4DecSpecInfo->Size());    
+        aBytes->Des().Append(iMP4DecSpecInfo->Des());
+        return ETrue;
+        }
+    else 
+        {
+        aBytes = 0;
+        return EFalse;
+        }    
+
+    }
+
+
+CProcADTSInFileHandler::~CProcADTSInFileHandler()
+    {
+    ResetAndCloseFile();
+
+    if (iSilentFrame != 0)
+        {
+        delete iSilentFrame;
+        }
+
+    if (iMP4DecSpecInfo != 0)
+        {
+        delete iMP4DecSpecInfo;
+
+        }
+
+
+    if (iFrameInfo != 0)
+        {
+        delete iFrameInfo;
+
+        }
+    
+    delete iFrameHandler;
+        
+    delete iDecoder;
+    
+    }
+
+
+void CProcADTSInFileHandler::ConstructL(const TDesC& aFileName, 
+                                        RFile* aFileHandle,
+                                        CAudClip* aClip, 
+                                        TInt aReadBufferSize,
+                                        TInt aTargetSampleRate,
+                                        TChannelMode aChannelMode)
+    {
+
+    
+
+    iTargetSampleRate = aTargetSampleRate;
+    iChannelMode = aChannelMode;
+
+    InitAndOpenFileL(aFileName, aFileHandle, aReadBufferSize);
+    
+    if (aClip != 0)
+        {
+        iCutInTime = ProcTools::MilliSeconds(aClip->CutInTime());
+        
+        }
+    
+    TBool frameFound = FindFirstAACFrame();
+    
+    if (!frameFound)
+        {
+        iSupportedFile = EFalse;
+        return;
+        }
+    
+    iClip = aClip;
+
+    TAudFileProperties prop;
+    iFrameInfo = new (ELeave) TAACFrameHandlerInfo;
+    GetPropertiesL(&prop);
+
+    if (prop.iAudioTypeExtension != EAudExtensionTypeNoExtension)
+        {
+        // AACPlus frame duration is calculated from sampling rate
+        // the actual sampling rate of AAC plus is twice as high as
+        // the AAC part
+        iProperties->iFrameDuration = iProperties->iFrameDuration.Int64()/2;
+        
+        }
+
+    // fill in aacInfo for retrieving decoder specific information
+    //AACStreamInfo aacInfo;
+    int16 frameLen = 0;
+    int32 sampleRate = 0;
+    uint8 profile = 0;
+    uint8 nChannels = 0;
+
+    // generate a silent frame ------------------>
+
+    if (iProperties->iChannelMode == EAudSingleChannel)
+        {
+
+        iSilentFrame = HBufC8::NewL(KSilentMonoAACFrameLenght);    
+        
+        iSilentFrame->Des().Append(KSilentMonoAACFrame, KSilentMonoAACFrameLenght);
+
+        nChannels = 1;
+        }
+    else if (iProperties->iChannelMode == EAudStereo)
+        {
+
+        iSilentFrame = HBufC8::NewL(KSilentStereoAACFrameLenght);    
+        iSilentFrame->Des().Append(KSilentStereoAACFrame, KSilentStereoAACFrameLenght);
+        
+        nChannels = 2;
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+    // Check that the sample rate is supported    
+    if( (iProperties->iSamplingRate != KAedSampleRate8kHz) &&
+        (iProperties->iSamplingRate != KAedSampleRate11kHz) &&
+        (iProperties->iSamplingRate != KAedSampleRate16kHz) &&
+        (iProperties->iSamplingRate != KAedSampleRate22kHz) &&
+        (iProperties->iSamplingRate != KAedSampleRate24kHz) &&
+        (iProperties->iSamplingRate != KAedSampleRate32kHz) &&
+        (iProperties->iSamplingRate != KAedSampleRate44kHz) &&
+        (iProperties->iSamplingRate != KAedSampleRate48kHz) )
+        {
+        User::Leave(KErrNotSupported);
+        }
+         
+
+
+    uint8 decSpecInfo[16];
+    int16 nConfigBytes;
+  
+    
+    frameLen = 1024;
+    sampleRate = iProperties->iSamplingRate;
+    if (iFrameInfo->iProfileID == 3)
+        {
+        profile = LTP_OBJECT;
+        }
+    else if (iFrameInfo->iProfileID == 1)
+        {
+        profile = LC_OBJECT;
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    //nConfigBytes = AACGetMP4ConfigInfo(&aacInfo, decSpecInfo, 16);
+    nConfigBytes = AACGetMP4ConfigInfo(sampleRate, profile, 
+        nChannels, frameLen, decSpecInfo, 16);
+
+
+    if (nConfigBytes > 0)
+        {
+
+        iMP4DecSpecInfo = HBufC8::NewL(nConfigBytes);
+        iMP4DecSpecInfo->Des().Append(decSpecInfo, nConfigBytes);
+
+        }
+
+
+    mp4_u32 frameDurationMilli = ProcTools::MilliSeconds(iProperties->iFrameDuration);
+    
+    iSilentFrameDuration = frameDurationMilli;
+    
+
+    // <------------------generate a silent frame
+
+    // Generate a decoder ----------------------->
+
+    iDecoder = CProcDecoder::NewL();
+    
+    iDecodingPossible = iDecoder->InitL(*iProperties, aTargetSampleRate, aChannelMode);
+    
+    // <----------------------- Generate a decoder 
+    
+    // Create a frame handler --------------------->
+    
+    iFrameHandler = CProcAACFrameHandler::NewL(*iFrameInfo);
+    
+    if (iClip != 0 && iClip->Normalizing())
+        {
+        SetNormalizingGainL(iFrameHandler);    
+        }
+    
+
+    }
+
+
+
+
+TBool CProcADTSInFileHandler::GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime)
+    {
+
+    if (!iSupportedFile)
+        {
+        return EFalse;
+        }
+        
+        
+    TBuf8<7> header;
+
+    if(BufferedFileRead(header, 7) != 7)
+        {
+        return EFalse;
+        }
+
+    if (header.Length() != 7)
+        {
+        return EFalse;
+        }
+
+    if (header[0] != 0xFF) return EFalse;
+    TUint8 byte4 = header[3];
+    TUint8 byte5 = header[4];
+    TUint8 byte6 = header[5];
+//    TUint8 byte7 = header[6];
+
+    
+    TInt frameLen = CalculateAACFrameLength(byte4, byte5, byte6);    
+    aFrame = HBufC8::NewL(frameLen);
+
+    BufferedFileSetFilePos(iFilePos-7);
+    TPtr8 tmpDes((TPtr8)aFrame->Des());
+
+    if (BufferedFileRead((TPtr8&)tmpDes, frameLen) != frameLen)
+        {
+        delete aFrame;
+        aFrame = 0;
+        return EFalse;
+        }
+        
+    aSize = frameLen;
+    aTime = ProcTools::MilliSeconds(iProperties->iFrameDuration);
+    
+    // remove ADTS header -------------------------------------------->
+    
+    TInt headerLength = 0;  //  because we need to remove header in case of AAC frame from .aac files
+    //check Header length to be removed from the frame before writting to 3gp file
+    TUint8* dtPtr = (TUint8*)(aFrame->Ptr());
+    if((dtPtr[1]&& 0x01) == 0x00)    //based on bytes decide header length to remove
+        {
+            headerLength =9;
+        }
+    else if((dtPtr[1]&& 0x01)== 0x01)
+        {
+            headerLength =7;
+        }
+        else
+        {
+            headerLength =0;
+        }
+    
+    aFrame->Des().Delete(0,headerLength);
+    aSize -= headerLength;
+ 
+    // <--------------------------------------------- remove ADTS header
+    
+    iCurrentTimeMilliseconds += ProcTools::MilliSeconds(iProperties->iFrameDuration);
+    
+    
+    // Fix for synchronizing problem ---------------------------------->
+    // If the accurate frame length cannot be represented in milliseconds
+    // store the remainder and increase the output frame lenght by one ms 
+    // when needed. Accuracy depends on sampling rate
+    
+    TReal accurateFrameLen = TReal(1024000)/iProperties->iSamplingRate;
+    
+    iAACFrameLenRemainderMilli += accurateFrameLen - aTime;
+        
+    if (iAACFrameLenRemainderMilli > 1)
+        {
+        aTime += 1;
+        iCurrentTimeMilliseconds += 1;
+        iAACFrameLenRemainderMilli -= 1;
+        }
+
+    
+    // <---------------------------------- Fix for synchronizing problem
+    
+    
+    if (iProperties->iAudioTypeExtension == EAudExtensionTypeNoExtension)
+        {
+         
+          
+        // AACPlus is handled after decoding
+                
+        TRAPD(err, ManipulateGainL(aFrame));
+        
+        if (err != KErrNone)
+            {
+            // something went wrong with the gain manipulation
+            // continue by returning the original frame
+            }    
+        }
+    
+        
+    aSize = aFrame->Size();
+    
+    return ETrue;
+
+    
+    }
+
+CProcADTSInFileHandler::CProcADTSInFileHandler()  : CProcInFileHandler(), iFrameInfo(0),
+                                                    iSupportedFile(ETrue)
+    {
+    
+
+    }
+
+
+TBool CProcADTSInFileHandler::FindFirstAACFrame()
+    {    
+
+    TBuf8<8> byte2b;
+    TUint8 byte2;
+    TUint8 byte1;
+
+    TBool fileEnded = EFalse;
+    TUint ind = 0;
+    TBool frameFound = EFalse;
+
+  BufferedFileSetFilePos(0);
+
+    while (!fileEnded) 
+        {
+        if (BufferedFileReadChar(ind, byte1) == 0) 
+            {
+            fileEnded = ETrue;
+            }
+        ind++;
+        
+        if (byte1 != 0xFF) continue;
+
+
+        if (BufferedFileReadChar(ind, byte2) == 0) 
+            {
+            fileEnded = ETrue;
+            }
+        ind++;
+        ProcTools::Dec2Bin(byte2, byte2b);
+        
+    
+        if (byte1 == 0xFF &&
+            byte2b[0] == '1' &&
+            byte2b[1] == '1' &&
+            byte2b[2] == '1' &&
+            byte2b[3] == '1' &&
+            //byte2b[4] == '1' &&
+            byte2b[5] == '0' &&
+            byte2b[6] == '0') 
+            {
+                
+            // this looks like AAC frame header, let's confirm...    
+            TUint8 byte3, byte4, byte5, byte6;
+            BufferedFileReadChar(ind, byte3);    
+            BufferedFileReadChar(ind+1, byte4);
+            BufferedFileReadChar(ind+2, byte5);
+            BufferedFileReadChar(ind+3, byte6);
+
+            ind++;
+
+            TUint frameLength = CalculateAACFrameLength(byte4, byte5, byte6);
+            
+            TUint8 testByte1, testByte2, testByte3;
+            BufferedFileReadChar(ind+frameLength-3, testByte1);
+            BufferedFileReadChar(ind+frameLength-2, testByte2);
+            BufferedFileReadChar(ind+frameLength-1, testByte3);
+            
+            if (byte1 == testByte1 && byte2 == testByte2
+                && byte3 == testByte3) 
+                {
+                // this must be the header...
+                iFirstFrame = ind-3;
+                //FillInHeaderValues(byte2, byte3, byte4);
+                frameFound = ETrue;
+                break;
+                }
+    
+            }
+
+        }
+    if (frameFound)
+        {
+        BufferedFileSetFilePos(iFirstFrame);
+        }
+
+    return frameFound;
+    }
+
+
+TUint CProcADTSInFileHandler::CalculateAACFrameLength(TUint8 byte4, TUint8 byte5, TUint8 byte6) 
+    {
+
+    TBuf8<13> headerLengthB;
+    TBuf8<8> byte4b, byte5b, byte6b;
+    ProcTools::Dec2Bin(byte4, byte4b);
+    ProcTools::Dec2Bin(byte5, byte5b);
+    ProcTools::Dec2Bin(byte6, byte6b);
+    
+    headerLengthB.Append(byte4b[6]);
+    headerLengthB.Append(byte4b[7]);
+    headerLengthB.Append(byte5b);
+    headerLengthB.Append(byte6b[0]);
+    headerLengthB.Append(byte6b[1]);
+    headerLengthB.Append(byte6b[2]);
+
+
+    TUint headerLength = 0;
+    TLex8 leks(headerLengthB);
+
+    if (leks.Val(headerLength, EBinary) != KErrNone) 
+        {
+        return 0;
+        }
+
+    return headerLength;
+
+}
+
+
+TBool CProcADTSInFileHandler::ReadHeaderInformation(TAudFileProperties* aProperties)
+    {
+
+    TInt origFilePos = iFilePos;
+    
+    if (aProperties == 0)
+        return EFalse;
+
+    TBuf8<4> header;
+
+    if(BufferedFileRead(header, 4) != 4)
+        {
+        BufferedFileSetFilePos(origFilePos);
+        return EFalse;
+        }
+
+    if (header.Length() != 4)
+        {
+        BufferedFileSetFilePos(origFilePos);
+        return EFalse;
+        }
+
+    TUint8 byte2 = header[1];
+    TBuf8<8> byte2b;
+    ProcTools::Dec2Bin(byte2, byte2b);
+    // lets confirm that we have found a legal AAC header
+    if (header[0] == 0xFF &&
+        byte2b[0] == '1' &&
+        byte2b[1] == '1' &&
+        byte2b[2] == '1' &&
+        byte2b[3] == '1' &&
+        //byte2b[4] == '1' &&
+        byte2b[5] == '0' &&
+        byte2b[6] == '0')
+        {
+        // OK
+        aProperties->iFileFormat = EAudFormatAAC_ADTS;
+    //    aProperties->iFrameDuration = 23000;
+        }    
+    else
+        {
+        return EFalse;
+        }
+    /*
+    if (byte2b[4] == '1')
+        {
+        aProperties->iAudioType = EAudAAC_MPEG2;
+        }
+    else
+        {
+        aProperties->iAudioType = EAudAAC_MPEG4;
+        }
+    */
+    
+    // NOTE: call all MPeg audio EAudAAC_MPEG4
+    aProperties->iAudioType = EAudAAC_MPEG4;
+    
+    
+    TUint8 byte3 = header[2];
+    TUint8 byte4 = header[3];
+
+    TBuf8<8> byte3b;
+    TBuf8<8> byte4b;
+
+    ProcTools::Dec2Bin(byte2, byte2b);
+    ProcTools::Dec2Bin(byte3, byte3b);
+    ProcTools::Dec2Bin(byte4, byte4b);
+
+    TBuf8<2> profileId(byte3b.Left(2));
+    TUint proID = 0;
+    ProcTools::Bin2Dec(profileId, proID);
+    
+    iFrameInfo->iProfileID = static_cast<TUint8>(proID);
+    aProperties->iAACObjectType = TAudAACObjectType(iFrameInfo->iProfileID);
+
+
+    TBuf8<4> samplingRateIndexB;
+    samplingRateIndexB.Append(byte3b[2]);
+    samplingRateIndexB.Append(byte3b[3]);
+    samplingRateIndexB.Append(byte3b[4]);
+    samplingRateIndexB.Append(byte3b[5]);
+
+    TUint srIndex = 0;
+    TLex8 lek(samplingRateIndexB);
+
+    if (lek.Val(srIndex, EBinary) != KErrNone) 
+        {
+        BufferedFileSetFilePos(origFilePos);
+        return EFalse;
+        }
+    // aac sampling rates
+        
+    const TInt KAAC_SAMPLING_RATES[16] = {96000,88200,64000,48000,44100,32000,24000
+            ,22050,16000,12000,11025,8000,0,0,0,0};
+
+    iFrameInfo->iSampleRateID = static_cast<TUint8>(srIndex);
+    aProperties->iSamplingRate = KAAC_SAMPLING_RATES[srIndex];
+    samplingRateIndexB.Delete(0, samplingRateIndexB.Length());
+        
+    // channel configuration
+
+
+    TUint aacChannels = 0;
+    TBuf8<3> channelB;
+    channelB.Append(byte3b[7]);
+    channelB.Append(byte4b[0]);
+    channelB.Append(byte4b[1]);
+
+    TLex8 leks2(channelB);
+    if (leks2.Val(aacChannels, EBinary) != KErrNone) 
+        {
+        BufferedFileSetFilePos(origFilePos);
+        return EFalse;
+        }
+        
+    if (aacChannels == 1)
+        {
+        aProperties->iChannelMode = EAudSingleChannel;
+        }
+    else if (aacChannels == 2)
+        {
+        aProperties->iChannelMode = EAudStereo;
+        }
+    
+    iFrameInfo->iNumChannels = static_cast<TUint8>(aacChannels);
+    iFrameInfo->iNumCouplingChannels = 0;
+    iFrameInfo->iIs960 = 0;
+    
+
+    BufferedFileSetFilePos(origFilePos);
+    return ETrue;
+
+    }
+
+
+TBool CProcADTSInFileHandler::ReadOtherInformationL(TAudFileProperties* aProperties)
+    {
+
+    TInt origFilePos = iFilePos;
+
+    FindFirstAACFrame();
+
+    TBuf8<7> header;
+
+    if(BufferedFileRead(header, 7) != 7)
+        {
+        return EFalse;
+        }
+
+    if (header.Length() != 7)
+        {
+        return EFalse;
+        }
+
+    TUint8 byte2 = header[1];
+    TBuf8<8> byte2b;
+    ProcTools::Dec2Bin(byte2, byte2b);
+    // lets confirm that we have found a legal AAC header
+    if (header[0] == 0xFF &&
+        byte2b[0] == '1' &&
+        byte2b[1] == '1' &&
+        byte2b[2] == '1' &&
+        byte2b[3] == '1' &&
+    //    byte2b[4] == '1' &&
+        byte2b[5] == '0' &&
+        byte2b[6] == '0')
+        {
+        // OK
+        //aProperties->iAudioType = EAudAAC;
+        //aProperties->iFileFormat = EAudFormatAAC_ADTS;
+        }    
+    else
+        {
+        return EFalse;
+        }
+
+    TUint8 byte4 = header[3];
+    TUint8 byte5 = header[4];
+    TUint8 byte6 = header[5];
+
+    aProperties->iFrameDuration = ((1024*1000)/(aProperties->iSamplingRate))*1000;
+
+    TInt frameLen = CalculateAACFrameLength(byte4, byte5, byte6);
+    
+    
+    
+
+     /*-- Allocate resources and read 1st frame. --*/
+    HBufC8 *aFrame = HBufC8::NewL(frameLen);
+    CleanupStack::PushL(aFrame);
+
+    TPtr8 tmpDes((TPtr8)aFrame->Des());
+
+    BufferedFileRead((TPtr8&)tmpDes, frameLen - 7);
+
+    
+    const TInt KShortestAACFrame = 20;
+
+    if (frameLen > KShortestAACFrame) // a silent frame?
+        {
+        
+        
+
+        /*
+         * Get frame parameters for eAAC+ codec. It is possible that the bitstream
+        * is plain AAC but we don't know it before the 1st frame is parsed!
+        */
+
+        TUint8* buf = const_cast<TUint8*>(aFrame->Right(aFrame->Size()).Ptr());
+        CProcAACFrameHandler::GetEnhancedAACPlusParametersL(buf, frameLen - 7, aProperties, iFrameInfo);
+
+        }
+    else
+        {
+        iFrameInfo->iIsParametricStereo = EFalse;
+        iFrameInfo->isSBR = EFalse;
+            
+        }
+
+    CleanupStack::Pop(aFrame);
+    delete aFrame;
+    aFrame = 0;
+
+
+        
+
+
+    if(BufferedFileRead(header, 7) != 7)
+        {
+        return EFalse;
+        }
+
+    if (header.Length() != 7)
+        {
+        return EFalse;
+        }
+
+    byte4 = header[3];
+    byte5 = header[4];
+    byte6 = header[5];
+
+    TInt dur = ProcTools::MilliSeconds(aProperties->iFrameDuration);
+    TInt bytes = frameLen;
+    TInt frames = 1;
+
+    frameLen = CalculateAACFrameLength(byte4, byte5, byte6);
+
+    while (BufferedFileSetFilePos(iFilePos-7+frameLen))
+        {
+
+        dur += ProcTools::MilliSeconds(aProperties->iFrameDuration);
+        bytes += frameLen;
+        frames++;
+
+        if(BufferedFileRead(header, 7) != 7)
+            {
+            break;
+            }
+
+        if (header.Length() != 7)
+            {
+            break;
+            }
+
+        if (header[0] != 0xFF) break;
+        byte4 = header[3];
+        byte5 = header[4];
+        byte6 = header[5];
+
+        frameLen = CalculateAACFrameLength(byte4, byte5, byte6);    
+    
+        }
+    
+    TTimeIntervalMicroSeconds tmp((TInt64)(TInt)dur*1000);
+    aProperties->iDuration = tmp;
+
+    aProperties->iFrameCount = frames;
+    aProperties->iFrameLen = bytes/frames;
+    aProperties->iBitrate = (iFilePos*1000/(dur))*8;
+
+
+    BufferedFileSetFilePos(origFilePos);
+
+    return ETrue;
+    }
+
+TBool CProcADTSInFileHandler::GetInfoForFrameHandler(TAACFrameHandlerInfo& aAACInfo)
+    {
+    
+    aAACInfo = *iFrameInfo;
+    return ETrue;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AMR/inc/ProcAMRFrameHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCAMRFRAMEHANDLER_H__
+#define __CPROCAMRFRAMEHANDLER_H__
+
+#include <e32base.h>
+#include <f32file.h>
+
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "ProcFrameHandler.h"
+
+class CProcAMRFrameHandler : public CProcFrameHandler 
+    {
+
+public:
+
+    /*
+    * Symbian constructors and a destructor
+    */
+
+    static CProcAMRFrameHandler* NewL();
+    static CProcAMRFrameHandler* NewLC();
+
+    virtual ~CProcAMRFrameHandler();
+
+    // From base class CProcFrameHandler
+    virtual TBool ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain);
+    virtual TBool GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const;
+    virtual TBool GetNormalizingMargin(const HBufC8* aFrame, TInt8& aMargin) const;
+
+    
+private:
+    
+    // constructL
+    void ConstructL();
+    
+    // c++ constructor
+    CProcAMRFrameHandler();
+
+    // internal function to read AMR gains
+    TBool GetAMRGains(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const;
+
+    // gets the length of the next frame based on mode myte
+    TInt GetNextFrameLength(const HBufC8* aFrame, TInt aPosNow);
+    
+    TBool GetGPGains(const HBufC8* aFrame, RArray<TInt>& aGains) const;
+    
+    // member variables for energy calculation
+    mutable TReal iPreviousEnergy;
+	mutable TReal iPreviousRn[4];
+
+    
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AMR/inc/ProcAMRInFileHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __CPROCAMRINFILEHANDLER_H__
+#define __CPROCAMRINFILEHANDLER_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "ProcInFileHandler.h"
+#include "AudClip.h"
+
+#include "ProcDecoder.h"
+
+
+class CProcAMRInFileHandler: public CProcInFileHandler 
+    {
+
+public:
+
+    static CProcAMRInFileHandler* NewL(const TDesC& aFileName,  
+                                       RFile* aFileHandle,
+                                       CAudClip* aClip, TInt aReadBufferSize,
+                                       TInt aTargetSampleRate = 0, 
+                                       TChannelMode aChannelMode = EAudSingleChannel);
+                                       
+    static CProcAMRInFileHandler* NewLC(const TDesC& aFileName, 
+                                        RFile* aFileHandle,
+                                        CAudClip* aClip, TInt aReadBufferSize,
+                                        TInt aTargetSampleRate = 0, 
+                                        TChannelMode aChannelMode = EAudSingleChannel);
+
+
+    // From base class
+
+    void GetPropertiesL(TAudFileProperties* aProperties);
+    
+    /**
+    * Seeks a certain audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    * @param aFrameIndex    frame index
+    * @param aTime            time from the beginning of file in milliseconds
+    *
+    * @return    ETrue if successful
+    *            EFalse if beyond the file
+    */
+    TBool SeekAudioFrame(TInt32 aTime);
+
+    
+    /**
+    * Seeks a cut in audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    *
+    * @return    ETrue if successful
+    *                
+    */
+    TBool SeekCutInFrame();
+    
+    virtual TBool SetNormalizingGainL(const CProcFrameHandler* aFrameHandler);
+
+    virtual ~CProcAMRInFileHandler();
+
+
+    
+
+private:
+    
+    void ConstructL(const TDesC& aFileName, RFile* aFileHandle, CAudClip* aClip, 
+                    TInt aReadBufferSize, TInt aTargetSampleRate = 0, 
+                    TChannelMode aChannelMode = EAudSingleChannel);
+
+    virtual TBool GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime);
+    
+
+
+    // durations in milliseconds
+    virtual TBool GetFrameInfo(TInt& aSongDuration,
+                                TInt& aFrameAmount, 
+                                TInt& aAverageFrameDuration, 
+                                TInt& aAverageFrameSize);
+
+    TInt iLastDRCL;
+
+    
+protected:
+    
+    CProcAMRInFileHandler();
+    
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AMR/src/ProcAMRFrameHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,895 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "ProcAMRFrameHandler.h"
+#include "ProcFrameHandler.h"
+#include "ProcTools.h"
+
+#include <e32math.h>
+
+
+TBool CProcAMRFrameHandler::ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain) 
+{
+    
+    aFrameOut = HBufC8::NewLC(aFrameIn->Size());
+    
+    if (aFrameIn->Size() == 1) // noData element
+        {
+        aFrameOut->Des().Append(aFrameIn[0]);
+        CleanupStack::Pop(); // aFrameOut
+    
+        return ETrue;
+        }
+    
+
+    aGain = static_cast<TInt8>(aGain/2);
+    
+    
+    TInt posNow = 0;
+    TInt nextFrameLength = 1;
+    
+    while (nextFrameLength > 0)
+        {
+
+        nextFrameLength = GetNextFrameLength(aFrameIn, posNow);
+        if (nextFrameLength < 1) break;
+        
+        if (nextFrameLength + posNow > aFrameIn->Size())
+            {
+            // something wrong with the frame, return the original
+            aFrameOut->Des().Append(aFrameIn[0]);
+            CleanupStack::Pop(); // aFrameOut
+            return ETrue;
+            }
+        
+        HBufC8* tmpFrame = HBufC8::NewLC(nextFrameLength);
+        tmpFrame->Des().Copy(aFrameIn->Mid(posNow, nextFrameLength));
+
+        posNow += nextFrameLength;
+        
+        
+        const TUint8 ch = (*tmpFrame)[0];
+        
+        TUint dec_mode = (enum Mode)((ch & 0x0078) >> 3);
+        
+        TInt maxGain;
+        
+        RArray<TInt> gains;
+        GetAMRGains(tmpFrame, gains, maxGain);
+
+        
+        TInt gamma10000 = KAmrGain_dB2Gamma[aGain+127];
+        
+        TInt a = 0;
+        TInt old_gain, old_gain1 = 0;
+        TInt old_pitch, old_pitch1 = 0;
+        TInt new_gain, new_gain1 = 0;
+        TInt8 new_index = 0;
+        
+        
+        
+        switch (dec_mode){
+        case 0:
+            
+            for (a = 0; a < gains.Count()-1 ; a+=4) 
+            {
+                
+                old_gain = gains[a+1];
+                new_gain = static_cast<TInt>((gamma10000*old_gain)/10000);
+                old_pitch = gains[a];
+                
+                old_gain1 = gains[a+3];
+                new_gain1 = static_cast<TInt>((gamma10000*old_gain1)/10000);
+                old_pitch1 = gains[a+2];
+                
+                
+                new_index = ProcTools::FindNewIndex475VQ(new_gain, 
+                    old_pitch, 
+                    new_gain1, 
+                    old_pitch1);
+                
+                if (a == 0) 
+                {
+                    ProcTools::SetValueToShuffledFrame(tmpFrame, 
+                        new_index, 
+                        KAmrGains475_1_2, 
+                        8);
+                }
+                else if(a == 4) 
+                {
+                    ProcTools::SetValueToShuffledFrame(tmpFrame, 
+                        new_index, 
+                        KAmrGains475_3_4, 
+                        8);
+                }
+            }
+            
+            break;
+        case 1:
+            
+            for (a = 0; a < gains.Count()-1 ; a+=2) 
+            {
+                
+                old_gain = gains[a+1];
+                new_gain = static_cast<TInt>((gamma10000*old_gain)/10000);
+                old_pitch = gains[a];
+                
+                new_index = ProcTools::FindNewIndexVQ(new_gain, old_pitch, KAmrGainTable590, 128);
+                if (a == 0) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains515_1, 6);
+                else if (a == 2) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains515_2, 6);
+                else if (a == 4) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains515_3, 6);
+                else if (a == 6) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains515_4, 6);
+            }
+            
+            break;
+        case 2:
+
+            for (a = 0; a < gains.Count()-1 ; a+=2) 
+            {
+                
+                old_gain = gains[a+1];
+                new_gain = static_cast<TInt>((gamma10000*old_gain)/10000);
+                old_pitch = gains[a];
+                
+                new_index = ProcTools::FindNewIndexVQ(new_gain, old_pitch, KAmrGainTable590, 128);
+                if (a == 0) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains590_1, 6);
+                else if (a == 2) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains590_2, 6);
+                else if (a == 4) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains590_3, 6);
+                else if (a == 6) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains590_4, 6);
+            }
+            
+            break;
+        case 3:
+
+            for (a = 0; a < gains.Count()-1 ; a+=2) 
+            {
+                
+        
+                old_gain = gains[a+1];
+                new_gain = static_cast<TInt>((gamma10000*old_gain)/10000);
+                old_pitch = gains[a];
+                
+                new_index = ProcTools::FindNewIndexVQ(new_gain, old_pitch, KAmrGainTable102, 256);
+                if (a == 0) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains670_1, 7);
+                else if (a == 2) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains670_2, 7);
+                else if (a == 4) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains670_3, 7);
+                else if (a == 6) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains670_4, 7);
+            }
+            
+            break;
+        case 4:
+    
+            for (a = 0; a < gains.Count()-1 ; a+=2) 
+            {
+                
+                old_gain = gains[a+1];
+                new_gain = static_cast<TInt>((gamma10000*old_gain)/10000);
+                old_pitch = gains[a];
+                
+                new_index = ProcTools::FindNewIndexVQ(new_gain, old_pitch, KAmrGainTable102, 256);
+                if (a == 0) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains740_1, 7);
+                else if (a == 2) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains740_2, 7);
+                else if (a == 4) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains740_3, 7);
+                else if (a == 6) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains740_4, 7);
+            }
+            
+            break;
+        case 5:
+        
+            for (a = 0; a < gains.Count() ; a++) 
+            {
+                
+                old_gain = gains[a];
+                new_gain = static_cast<TInt>((gamma10000*old_gain)/10000);
+                
+                new_index = ProcTools::FindNewIndexSQ(new_gain, KAmrGainTable122, 32);
+                if (a == 0) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains795_1, 5);
+                else if (a == 1) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains795_2, 5);
+                else if (a == 2) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains795_3, 5);
+                else if (a == 3) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains795_4, 5);
+            }
+            
+            break;
+        case 6:
+    
+            
+            for (a = 0; a < gains.Count()-1 ; a+=2) 
+            {
+                
+                old_gain = gains[a+1];
+                new_gain = static_cast<TInt>((gamma10000*old_gain)/10000);
+                old_pitch = gains[a];
+                
+                new_index = ProcTools::FindNewIndexVQ(new_gain, old_pitch, KAmrGainTable102, 256);
+                if (a == 0) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains102_1, 7);
+                else if (a == 2) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains102_2, 7);
+                else if (a == 4) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains102_3, 7);
+                else if (a == 6) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains102_4, 7);
+            }
+            
+            break;
+            
+        case 7:
+        
+                        
+            for (a = 0; a < gains.Count() ; a++) 
+            {
+                
+                old_gain = gains[a];
+                new_gain = static_cast<TInt>((gamma10000*old_gain)/10000);
+                
+                new_index = ProcTools::FindNewIndexSQ(new_gain, KAmrGainTable122, 32);
+                if (a == 0) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains122_1, 5);
+                else if (a == 1) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains122_2, 5);
+                else if (a == 2) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains122_3, 5);
+                else if (a == 3) ProcTools::SetValueToShuffledFrame(tmpFrame, new_index, KAmrGains122_4, 5);
+            }
+            
+            break;
+        case 8:
+        
+            break;
+        case 15:
+        
+            break;
+        default:
+            
+            break;
+            };
+    
+    
+        gains.Reset();
+        aFrameOut->Des().Append(tmpFrame->Des());
+        CleanupStack::PopAndDestroy(tmpFrame);
+
+        }
+    CleanupStack::Pop(); // aFrameOut
+    
+    return ETrue;
+    }
+
+TBool CProcAMRFrameHandler::GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const
+    {
+    
+    TBool vectorQuant = EFalse;
+    
+	const TUint8 ch = (*aFrame)[0];
+
+	TUint dec_mode = (enum Mode)((ch & 0x0078) >> 3);
+	
+	TBool mode475 = EFalse;
+
+	switch (dec_mode)
+		{
+		case 0:
+
+			mode475 = ETrue;
+			vectorQuant = ETrue;
+			break;
+		
+		case 1:
+		case 2:
+		case 3:
+		case 4:
+		case 6:
+			vectorQuant = ETrue;
+			break;
+		
+		default:
+			break;
+		};
+
+
+	RArray<TInt> amrGains;
+	RArray<TInt> gpGains;
+
+	TInt maxGain = 0;
+	
+	TReal b[4] = {0.68, 0.58, 0.34, 0.19};
+
+
+	if (aFrame->Size() < 10)
+
+		{
+		// SID or no data
+		for (TInt r = 0; r < 4 ; r++)
+			{
+			iPreviousRn[r] = 0;
+			
+			iPreviousEnergy = 0;
+			
+			
+			}
+
+		aGains.Append(0);
+		aMaxGain = 1;
+        return ETrue;
+		}
+
+	GetAMRGains(aFrame, amrGains, maxGain);
+	GetGPGains(aFrame, gpGains);
+
+	TInt gains = 4;
+	if (mode475)
+		{
+		gains = 2;
+		}
+
+	for (TInt subFrame = 0 ; subFrame < gains ; subFrame++)
+		{
+
+		// calculate gc (fixed codebook gain) ------------------------->
+
+		TReal currentGamma = 0;
+		if (vectorQuant)
+			{
+			currentGamma = (TReal)(amrGains[subFrame*2+1])/4096.0; // Q12, 2^12 = 4096
+			}
+		else
+			{
+			currentGamma = (TReal)(amrGains[subFrame])/4096.0; 
+			}
+
+		TReal E = iPreviousRn[3]*b[0]+iPreviousRn[2]*b[1]+iPreviousRn[1]*b[2]+iPreviousRn[0]*b[3];
+		
+		TReal logGamma = 0;
+		Math::Log(logGamma, currentGamma);
+		TReal R = 20 * logGamma;
+
+		TReal gcPred = 0; //g'c
+		Math::Pow10(gcPred, 0.05*E);
+		TReal gc = gcPred*currentGamma;
+
+
+		// update previous R(n) values --------->
+		for (TInt re = 0; re < 3 ; re++)
+			{
+			iPreviousRn[re] = iPreviousRn[re+1];
+			}
+		iPreviousRn[3] = R;
+		// <---------- update ends
+
+		// <---------- gc calculated
+
+		// calculate energy from adaptive codebook ------------->
+		
+		TReal currentGp = 0;
+		
+		if (vectorQuant)
+			{
+			currentGp = (TReal)(amrGains[subFrame*2])/16384.0; // Q14 = 2^14 = 16384
+			}
+		else
+			{
+			currentGp = (TReal)(gpGains[subFrame])/16384.0; // Q14, 2^13 = 8192
+			}
+
+
+		TReal energyFromAdaptiveCB = (iPreviousEnergy*currentGp)/2;
+
+		// <----------------------- energy from adaptive codebook calculated
+
+		TReal totalEnergy = energyFromAdaptiveCB+(gc*45);
+
+		iPreviousEnergy = totalEnergy;
+
+		TReal logTotalEnergy = 0;
+		
+		if (totalEnergy < 1) totalEnergy = 1;
+		
+		Math::Log(logTotalEnergy, totalEnergy);
+		
+		if (logTotalEnergy > 3.5) 
+		    {
+		    logTotalEnergy = 3.5;
+		    }
+		
+		aGains.Append(logTotalEnergy*100);
+
+        const TInt KMaxGain = 350;
+
+        aMaxGain = KMaxGain;
+        
+        
+		}
+		
+		
+	amrGains.Reset();	
+	gpGains.Reset();
+	return ETrue;
+    }
+
+
+TBool CProcAMRFrameHandler::GetNormalizingMargin(const HBufC8* aFrame, TInt8& aMargin) const
+
+    {
+        
+    const TUint8 ch = (*aFrame)[0];
+
+    TUint dec_mode = (enum Mode)((ch & 0x0078) >> 3);
+    RArray<TInt> gains;
+    
+    TInt error = KErrNone;
+    TRAP(error, CleanupClosePushL(gains) );
+    
+    if (error != KErrNone)
+        return EFalse;
+    
+    TInt gamma10000 = 1;
+    TInt largestGain = 1;
+    TInt a = 0;
+    TInt maxGain;
+
+        switch (dec_mode)
+        {
+        case 0:
+        
+            GetAMRGains(aFrame, gains, maxGain);
+
+            for (a = 1 ; a < gains.Count() ; a+=2)
+                {
+                if (gains[a] > largestGain) 
+                    {
+                    largestGain = gains[a];
+                    }
+
+                }
+
+            gamma10000 = (KAmrLargestGain475*10000)/largestGain;
+
+            break;
+        case 1:
+        case 2:
+
+            // bitrates 515, 590
+            GetAMRGains(aFrame, gains, maxGain);
+            
+            for (a = 1 ; a < gains.Count() ; a+=2)
+                {
+                if (gains[a] > largestGain) 
+                    {
+                    largestGain = gains[a];
+                    }
+
+                }
+            gamma10000 = (KAmrLargestGain590*10000)/largestGain;
+
+
+            break;
+        case 3:
+        case 4:
+        case 6:
+            // bitRate = 670, 740, 1020;
+            GetAMRGains(aFrame, gains, maxGain);
+            
+            for (a = 1 ; a < gains.Count() ; a+=2)
+                {
+                if (gains[a] > largestGain) 
+                    {
+                    largestGain = gains[a];
+                    }
+
+                }
+            gamma10000 = (KAmrLargestGain102*10000)/largestGain;
+
+            break;
+        case 5:
+        case 7:
+            //bitRate = 795 & 12.2
+            GetAMRGains(aFrame, gains, maxGain);
+        
+            
+            for (a = 0 ; a < gains.Count() ; a++)
+                {
+                if (gains[a] > largestGain) 
+                    {
+                    largestGain = gains[a];
+                    }
+
+                }
+            gamma10000 = (KAmrLargestGain122*10000)/largestGain;
+
+
+            break;
+        
+        case 8:
+            
+        case 15:
+            
+        default:
+            aMargin = 100;
+            return ETrue;
+            
+        };
+
+
+    CleanupStack::PopAndDestroy(&gains);
+
+    TUint8 newIndex = ProcTools::FindNewIndexSQ(gamma10000, KAmrGain_dB2Gamma, 256);
+
+    TInt8 newGain = static_cast<TInt8>(newIndex-127); 
+
+
+    if (newGain > 63)
+        {
+        newGain = 63;
+        }
+    else if (newGain < -63)
+        {
+        newGain = -63;
+        }
+
+    aMargin = static_cast<TInt8>(newGain*2);
+    // aMargin is now in dB/2:s
+    return ETrue;
+
+
+    }
+
+CProcAMRFrameHandler::~CProcAMRFrameHandler() 
+    {
+
+    }
+
+CProcAMRFrameHandler* CProcAMRFrameHandler::NewL() 
+    {
+
+    
+    CProcAMRFrameHandler* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+CProcAMRFrameHandler* CProcAMRFrameHandler::NewLC() 
+    {
+
+    CProcAMRFrameHandler* self = new (ELeave) CProcAMRFrameHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+
+    }
+
+void CProcAMRFrameHandler::ConstructL() 
+    {
+
+
+    }
+
+CProcAMRFrameHandler::CProcAMRFrameHandler()
+    {
+
+    }
+ 
+TBool CProcAMRFrameHandler::GetAMRGains(const HBufC8* aFrame, 
+                                        RArray<TInt>& aGains, 
+                                        TInt& aMaxGain) const
+
+    {
+
+    
+    const TUint8 ch = (*aFrame)[0];
+
+    TUint dec_mode = (enum Mode)((ch & 0x0078) >> 3);
+    TInt gainIndex = 0;
+    
+
+        switch (dec_mode)
+        {
+        case 0:
+//            bitRate = 475;
+            
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains475_1_2, 8);
+            aGains.Append(KAmrGainTable475[gainIndex*4]);
+            aGains.Append(KAmrGainTable475[gainIndex*4+1]);
+            aGains.Append(KAmrGainTable475[gainIndex*4+2]);
+            aGains.Append(KAmrGainTable475[gainIndex*4+3]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains475_3_4, 8);
+            aGains.Append(KAmrGainTable475[gainIndex*4]);
+            aGains.Append(KAmrGainTable475[gainIndex*4+1]);
+            aGains.Append(KAmrGainTable475[gainIndex*4+2]);
+            aGains.Append(KAmrGainTable475[gainIndex*4+3]);
+
+            break;
+        case 1:
+//            bitRate = 515;
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains515_1, 6);
+            aGains.Append(KAmrGainTable590[gainIndex*2]);
+            aGains.Append(KAmrGainTable590[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains515_2, 6);
+            aGains.Append(KAmrGainTable590[gainIndex*2]);
+            aGains.Append(KAmrGainTable590[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains515_3, 6);
+            aGains.Append(KAmrGainTable590[gainIndex*2]);
+            aGains.Append(KAmrGainTable590[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains515_4, 6);
+            aGains.Append(KAmrGainTable590[gainIndex*2]);
+            aGains.Append(KAmrGainTable590[gainIndex*2+1]);
+            break;
+        case 2:
+//            bitRate = 590;
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains590_1, 6);
+            aGains.Append(KAmrGainTable590[gainIndex*2]);
+            aGains.Append(KAmrGainTable590[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains590_2, 6);
+            aGains.Append(KAmrGainTable590[gainIndex*2]);
+            aGains.Append(KAmrGainTable590[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains590_3, 6);
+            aGains.Append(KAmrGainTable590[gainIndex*2]);
+            aGains.Append(KAmrGainTable590[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains590_4, 6);
+            aGains.Append(KAmrGainTable590[gainIndex*2]);
+            aGains.Append(KAmrGainTable590[gainIndex*2+1]);
+
+            break;
+        case 3:
+//            bitRate = 670;
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains670_1, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains670_2, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains670_3, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains670_4, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            break;
+        case 4:
+//            bitRate = 740;
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains740_1, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains740_2, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains740_3, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains740_4, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            break;
+        case 5:
+//            bitRate = 795;
+            
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains795_1, 5);
+            aGains.Append(KAmrGainTable122[gainIndex]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains795_2, 5);
+            aGains.Append(KAmrGainTable122[gainIndex]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains795_3, 5);
+            aGains.Append(KAmrGainTable122[gainIndex]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains795_4, 5);
+            aGains.Append(KAmrGainTable122[gainIndex]);
+                
+            break;
+        case 6:
+//            bitRate = 1020;
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains102_1, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains102_2, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains102_3, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains102_4, 7);
+            aGains.Append(KAmrGainTable102[gainIndex*2]);
+            aGains.Append(KAmrGainTable102[gainIndex*2+1]);
+
+            break;
+        case 7:
+//            bitRate = 1220;
+                
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains122_1, 5);
+            aGains.Append(KAmrGainTable122[gainIndex]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains122_2, 5);
+            aGains.Append(KAmrGainTable122[gainIndex]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains122_3, 5);
+            aGains.Append(KAmrGainTable122[gainIndex]);
+
+            gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGains122_4, 5);
+            aGains.Append(KAmrGainTable122[gainIndex]);
+                
+                
+            break;
+        case 8:
+//            bitRate = 0;
+            break;
+        case 15:
+//            bitRate = 0;
+            break;
+        default:
+//            bitRate = 0;
+            break;
+        };
+
+
+    aMaxGain = KAmrLargestGain102;
+
+    return ETrue;
+
+
+    }
+
+TInt CProcAMRFrameHandler::GetNextFrameLength(const HBufC8* aFrame, TInt aPosNow)
+    {
+
+
+    if (aPosNow >= aFrame->Size()) return -1;
+
+
+    const TUint8 ch = (*aFrame)[aPosNow];
+
+    TUint dec_mode = (enum Mode)((ch & 0x0078) >> 3);
+    
+    switch (dec_mode)
+        {
+        case 0:
+            {
+            return 12+1;
+            }
+            
+        case 1:
+            {
+            return 13+1;
+            }
+            
+        case 2:
+            {
+            return 15+1;
+            }
+            
+        case 3:
+            {
+            return 17+1;
+            }
+            
+        case 4:
+            {
+            return 19+1;
+            }
+            
+        case 5:
+            {
+            return 20+1;
+            }
+            
+        case 6:
+            {
+            return 26+1;
+            }
+            
+        case 7:
+            {
+            return 31+1;
+            }
+            
+        case 8:
+            {
+            return 5+1;
+            }
+            
+        case 15:
+            {
+            return 0;
+            }
+            
+        default:
+            return 0+1;
+            
+        };
+    
+
+    }
+    
+
+TBool CProcAMRFrameHandler::GetGPGains(const HBufC8* aFrame, 
+										RArray<TInt>& aGains) const
+
+	{
+
+	
+	const TUint8 ch = (*aFrame)[0];
+
+	TUint dec_mode = (enum Mode)((ch & 0x0078) >> 3);
+	TInt gainIndex = 0;
+	
+
+		switch (dec_mode)
+		{
+		
+		case 7:
+//			bitRate = 1220;
+				
+			gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGPGains122_1, 4);
+			aGains.Append(KAmrGPTable[gainIndex]);
+
+			gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGPGains122_2, 4);
+			aGains.Append(KAmrGPTable[gainIndex]);
+
+			gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGPGains122_3, 4);
+			aGains.Append(KAmrGPTable[gainIndex]);
+
+			gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGPGains122_4, 4);
+			aGains.Append(KAmrGPTable[gainIndex]);
+				
+				
+			break;
+
+		case 5:
+		// 7.95
+			gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGPGains795_1, 4);
+			aGains.Append(KAmrGPTable[gainIndex]);
+
+			gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGPGains795_2, 4);
+			aGains.Append(KAmrGPTable[gainIndex]);
+
+			gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGPGains795_3, 4);
+			aGains.Append(KAmrGPTable[gainIndex]);
+
+			gainIndex = ProcTools::GetValueFromShuffledFrame(aFrame, KAmrGPGains795_4, 4);
+			aGains.Append(KAmrGPTable[gainIndex]);
+			break;
+
+
+
+		default:
+//			return EFalse;
+			break;
+		};
+
+
+	return ETrue;
+
+
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AMR/src/ProcAMRInFileHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,526 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "ProcAMRInFileHandler.h"
+#include "ProcAMRFrameHandler.h"
+#include "ProcTools.h"
+#include "AudPanic.h"
+
+
+CProcAMRInFileHandler* CProcAMRInFileHandler::NewL(const TDesC& aFileName, 
+                                                   RFile* aFileHandle,
+                                                   CAudClip* aClip, 
+                                                   TInt aReadBufferSize,
+                                                   TInt aTargetSampleRate, 
+                                                   TChannelMode aChannelMode) 
+    {
+
+    CProcAMRInFileHandler* self = NewLC(aFileName, aFileHandle, aClip, aReadBufferSize, 
+                                        aTargetSampleRate, aChannelMode);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CProcAMRInFileHandler* CProcAMRInFileHandler::NewLC(const TDesC& aFileName, 
+                                                    RFile* aFileHandle,
+                                                    CAudClip* aClip, 
+                                                    TInt aReadBufferSize,
+                                                    TInt aTargetSampleRate, 
+                                                    TChannelMode aChannelMode) 
+    {
+    
+    CProcAMRInFileHandler* self = new (ELeave) CProcAMRInFileHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileName, aFileHandle, aClip, aReadBufferSize,
+                    aTargetSampleRate, aChannelMode);
+    return self;
+    }
+
+CProcAMRInFileHandler::CProcAMRInFileHandler() : CProcInFileHandler() 
+    {
+    
+    
+    }
+
+void CProcAMRInFileHandler::GetPropertiesL(TAudFileProperties* aProperties) 
+    {
+
+    if (iProperties != 0)
+        {
+        *aProperties = *iProperties;
+        return;
+        }
+    aProperties->iAudioTypeExtension = EAudExtensionTypeNoExtension;
+    if (iFileOpen) 
+        {
+        aProperties->iFileFormat = EAudFormatAMR;
+        
+        TInt oldPos = iFilePos;
+
+        TInt fileSize = 0;
+        iFile.Size(fileSize);
+        
+        TBuf8<6> header;
+        //iFile.Read(0, header);
+        BufferedFileRead(0, header);
+        if (header.Compare(_L8("#!AMR\n")) == 0) 
+            {
+            aProperties->iAudioType = EAudAMR;
+            aProperties->iSamplingRate = 8000;
+            aProperties->iChannelMode = EAudSingleChannel;
+            aProperties->iBitrateMode = EAudVariable;
+            
+            TBuf8<1> buf;
+            //    iFile.Read(6, buf);
+            BufferedFileRead(6, buf);    
+            TUint dec_mode = (enum Mode)((buf[0] & 0x0078) >> 3);
+            
+            aProperties->iBitrate = KAmrBitRates[dec_mode];
+            TInt durationMilli = 0;
+            TInt frameAmount = 0;
+            TInt frameDuration = 0;
+            TInt frameSize = 0;
+
+            GetFrameInfo(durationMilli, frameAmount, frameDuration, frameSize);
+
+            TInt64 tmp = (TInt64)(TInt)durationMilli*1000;
+            // milliseconds->microseconds
+            TTimeIntervalMicroSeconds durationMicro(tmp);
+            aProperties->iDuration = durationMicro;
+            aProperties->iFrameCount = frameAmount;
+            
+            tmp = (TInt64)(TInt)frameDuration*1000;
+            TTimeIntervalMicroSeconds frameDurationMicro(tmp);
+            aProperties->iFrameDuration = frameDurationMicro;
+            aProperties->iFrameLen = frameSize;
+    
+            
+            }
+        BufferedFileSetFilePos(oldPos);
+        }
+    else 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    if (iProperties == 0)
+        {
+        iProperties = new (ELeave) TAudFileProperties;
+        *iProperties = *aProperties;
+        }
+    
+    
+    
+    
+    
+    }
+
+TBool CProcAMRInFileHandler::SeekAudioFrame(TInt32 aTime) 
+    {
+    
+
+    if (!iFileOpen) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    TInt fileSize = 0;
+    iFile.Size(fileSize);
+
+
+    TInt firstModeByte = 6;
+    TInt readSize = 0;
+    TBuf8<1> modeByte;
+    iCurrentTimeMilliseconds = 0;
+
+    TUint dec_mode; 
+    //iFile.Seek(ESeekStart, firstModeByte);
+    BufferedFileSetFilePos(firstModeByte);
+    
+    while(iCurrentTimeMilliseconds < aTime) 
+        {
+        
+        //iFile.Read(modeByte, 1);
+        BufferedFileRead(modeByte);
+        if (modeByte.Size() == 0) 
+            {
+            return EFalse;
+            }
+
+        dec_mode = (enum Mode)((modeByte[0] & 0x0078) >> 3);
+        
+        switch (dec_mode)
+        {
+        case 0:
+            readSize = 12;
+            break;
+        case 1:
+            readSize = 13;
+            break;
+        case 2:
+            readSize = 15;
+            break;
+        case 3:
+            readSize = 17;
+            break;
+        case 4:
+            readSize = 19;
+            break;
+        case 5:
+            readSize = 20;
+            break;
+        case 6:
+            readSize = 26;
+            break;
+        case 7:
+            readSize = 31;
+            break;
+        case 8:
+            readSize = 5;
+            break;
+        case 15:
+            readSize = 0;
+            break;
+        default:
+            readSize = 0;
+            break;
+        };
+        // read the next audio frame
+        //iFile.Read(audioFrame, read_size);
+        //if (iFile.Seek(ESeekCurrent, readSize) != KErrNone) {
+        //    return EFalse;
+        //}
+        if (!(BufferedFileSetFilePos(BufferedFileGetFilePos()+readSize))) 
+            {
+            
+            // EOF
+            return EFalse;
+            }
+        iCurrentTimeMilliseconds += 20;
+        }
+    return ETrue;
+    }    
+
+TBool CProcAMRInFileHandler::SeekCutInFrame() 
+    {
+
+    iCurrentTimeMilliseconds = iCutInTime;
+    return SeekAudioFrame(iCutInTime);
+    }
+    
+
+
+
+void CProcAMRInFileHandler::ConstructL(const TDesC& aFileName, 
+                                       RFile* aFileHandle,
+                                       CAudClip* aClip, 
+                                       TInt aReadBufferSize,
+                                       TInt aTargetSampleRate, 
+                                       TChannelMode aChannelMode) 
+    {
+    
+    
+
+    iTargetSampleRate = aTargetSampleRate;
+    iChannelMode = aChannelMode;
+
+    InitAndOpenFileL(aFileName, aFileHandle, aReadBufferSize);
+
+
+    if (aClip != 0)
+        {
+        iCutInTime = ProcTools::MilliSeconds(aClip->CutInTime());
+        
+        }
+
+    const TInt KSilentFrameSize = 13;
+    
+    TUint8 silentFrame[KSilentFrameSize]=
+        {
+        0x04,0x63,0x3C,0xC7,0xF0,0x03,0x04,0x39,0xFF,0xE0,
+        0x00,0x00,0x00
+        
+        };
+    
+
+    iSilentFrame = HBufC8::NewL(KSilentFrameSize);
+    iSilentFrame->Des().Append(silentFrame, KSilentFrameSize); 
+    iSilentFrameDuration = 20;
+
+    
+    iClip = aClip;
+    
+    TAudFileProperties prop;
+    GetPropertiesL(&prop);
+    
+    iDecoder = CProcDecoder::NewL();
+    
+    iDecodingPossible = iDecoder->InitL(prop, aTargetSampleRate, aChannelMode);
+    
+    
+    // Generate a frame handler --------------------->
+    
+    iFrameHandler = CProcAMRFrameHandler::NewL();
+    
+    if (iClip != 0 && iClip->Normalizing())
+        {
+        SetNormalizingGainL(iFrameHandler);    
+        }
+    
+    
+    }
+    
+TBool CProcAMRInFileHandler::GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime)
+    {
+    if (!iFileOpen) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    aFrame = NULL;
+    TInt readSize = 0;
+    TBuf8<1> modeByte;
+//    TBuf8<32> audioFrame;
+    TUint dec_mode; 
+
+
+    //iFile.Read(modeByte);
+    BufferedFileRead(modeByte);
+    if (modeByte.Size() == 0) 
+        {
+        return EFalse;
+        }
+
+    dec_mode = (enum Mode)((modeByte[0] & 0x0078) >> 3);
+        
+        switch (dec_mode)
+        {
+        case 0:
+            readSize = 12;
+            break;
+        case 1:
+            readSize = 13;
+            break;
+        case 2:
+            readSize = 15;
+            break;
+        case 3:
+            readSize = 17;
+            break;
+        case 4:
+            readSize = 19;
+            break;
+        case 5:
+            readSize = 20;
+            break;
+        case 6:
+            readSize = 26;
+            break;
+        case 7:
+            readSize = 31;
+            break;
+        case 8:
+            readSize = 5;
+            break;
+        case 15:
+            readSize = 0;
+            break;
+        default:
+            readSize = 0;
+            break;
+        };
+
+        HBufC8* audioFrame = HBufC8::NewL(readSize+1);
+
+        TPtr8 tmpDes((TPtr8)audioFrame->Des());
+
+        BufferedFileRead((TPtr8&) tmpDes, readSize);
+        audioFrame->Des().Insert(0, modeByte);
+
+        aFrame = audioFrame;
+
+        TRAPD(err, ManipulateGainL(aFrame));
+    
+        if (err != KErrNone)
+            {
+            // something went wrong with the gain manipulation
+            // continue by returning the original frame
+            }
+    
+
+        aSize = aFrame->Size();
+        aTime = 20;
+        iCurrentTimeMilliseconds += 20;
+    
+        return ETrue;
+    }
+
+
+
+CProcAMRInFileHandler::~CProcAMRInFileHandler() 
+    {
+
+    if (iSilentFrame != 0) delete iSilentFrame;
+
+    ResetAndCloseFile();
+    
+    delete iDecoder;
+
+    delete iFrameHandler;
+
+    }
+
+
+TBool CProcAMRInFileHandler::GetFrameInfo(TInt& aSongDuration,
+                                           TInt& aFrameAmount, 
+                                           TInt& aAverageFrameDuration, 
+                                           TInt& aAverageFrameSize) 
+    {
+
+
+        
+
+    if (!iFileOpen) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    TInt fileSize = 0;
+    iFile.Size(fileSize);
+
+
+    TInt firstModeByte = 6;
+    TInt frameIndex = 1;
+    TInt readSize = 0;
+    TBuf8<1> modeByte;
+
+    TInt32 frameSizeSum = 0;
+    
+    TInt filePos = iFilePos;
+
+    TUint dec_mode; 
+
+    BufferedFileSetFilePos(firstModeByte);
+    
+    while(frameIndex < 180000) // 1 hour 
+        {
+
+        BufferedFileRead(modeByte);
+        if (modeByte.Size() == 0) 
+            {
+            break;
+            }
+
+        dec_mode = (enum Mode)((modeByte[0] & 0x0078) >> 3);
+        
+        switch (dec_mode)
+        {
+        case 0:
+            readSize = 12;
+            break;
+        case 1:
+            readSize = 13;
+            break;
+        case 2:
+            readSize = 15;
+            break;
+        case 3:
+            readSize = 17;
+            break;
+        case 4:
+            readSize = 19;
+            break;
+        case 5:
+            readSize = 20;
+            break;
+        case 6:
+            readSize = 26;
+            break;
+        case 7:
+            readSize = 31;
+            break;
+        case 8:
+            readSize = 5;
+            break;
+        case 15:
+            readSize = 0;
+            break;
+        default:
+            readSize = 0;
+            break;
+        };
+        if (!(BufferedFileSetFilePos(BufferedFileGetFilePos()+readSize))) 
+            {
+            
+            break; // EOF
+            }
+        frameSizeSum += readSize;
+        aSongDuration += 20;
+        frameIndex++;
+        }
+
+    aAverageFrameSize = frameSizeSum/frameIndex;
+    aFrameAmount = frameIndex;
+    aAverageFrameDuration = aSongDuration/aFrameAmount;
+    BufferedFileSetFilePos(filePos);
+    return ETrue;
+
+
+    }
+
+
+TBool CProcAMRInFileHandler::SetNormalizingGainL(const CProcFrameHandler* aFrameHandler)
+    {
+
+    HBufC8* point = 0;
+    TInt siz;
+    TInt32 tim = 0;
+    TInt8 margin = 0;
+    TInt minMargin = KMaxTInt;
+    TInt tmpGain = 0;
+    TInt frameCounter = 0;
+    while(GetEncAudioFrameL(point, siz, tim)) 
+                    
+        {
+        aFrameHandler->GetNormalizingMargin(point, margin);
+        tmpGain += margin;
+                    
+        delete point;
+        point = 0;
+        frameCounter++;
+        if (frameCounter > 1) 
+            {
+            tmpGain = tmpGain/3;
+                        
+            if (tmpGain < minMargin) 
+                {
+                minMargin = tmpGain;
+                }
+                
+            frameCounter = 0;
+            tmpGain = 0;
+            }
+        }
+
+    iNormalizingMargin = static_cast<TInt8>(minMargin);
+
+    return ETrue;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AWB/inc/AWBConstants.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,334 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef AWBCONSTANTS_H
+#define AWBCONSTANTS_H
+
+
+/* size of packed frame for each mode, excluding TOC byte */
+const TInt16 KAWBPacked_size[16] = {17, 23, 32, 36, 40, 46, 50, 58,
+                                 60,  5,  0,  0,  0,  0,  0,  0};
+
+// possible bitrates of AMR wideband
+const TInt KAWBBitRates[9] = {6600, 8850, 12650, 14250, 
+                            15850, 18250, 19850, 23050, 23850};
+
+// enumeration for bitrates
+enum TAWBBitRate
+    {
+    TAWBBitRate6600 = 0,
+    TAWBBitRate8850 = 1,
+    TAWBBitRate12650 = 2,
+    TAWBBitRate14250 = 3,
+    TAWBBitRate15850 = 4,
+    TAWBBitRate18250 = 5,
+    TAWBBitRate19850 = 6,
+    TAWBBitRate23050 = 7,
+    TAWBBitRate23850 = 8
+    };
+
+// gain position in n:th subframe with 6600 kBit/s: KGainPositions[TAWBBitRate6600*4+n]
+
+const TInt KGainPositions[4*9] =
+    {
+    57, 80, 103, 126,
+    75, 106, 140, 171,
+    93, 143, 196, 246,
+    101, 159, 220, 278,
+    109, 175, 244, 310,
+    121, 199, 280, 358,
+    129, 215, 304, 390,
+    145, 247, 352, 454,
+    145, 251, 360, 466
+    };
+
+// KAwbGaindB2Gamma[0] is gamma*10000 at -127 dB
+// KAwbGaindB2Gamma[1] is gamma*10000 at -126 dB
+// KAwbGaindB2Gamma[127] is gamma*10000 at 0 dB
+// KAwbGaindB2Gamma[128] is gamma*10000 at 1 dB
+// KAwbGaindB2Gamma[255] is gamma*10000 at 128 dB
+
+// Note: gamma = (10^((gain/2)/20))^(1/_2.38_)
+
+const TInt KAwbGain_dB2Gamma[] = 
+
+    {
+ 
+21    ,
+23    ,
+24    ,
+25    ,
+26    ,
+27    ,
+29    ,
+30    ,
+32    ,
+33    ,
+35    ,
+37    ,
+38    ,
+40    ,
+42    ,
+44    ,
+47    ,
+49    ,
+51    ,
+54    ,
+57    ,
+59    ,
+62    ,
+65    ,
+69    ,
+72    ,
+76    ,
+79    ,
+83    ,
+87    ,
+92    ,
+96    ,
+101    ,
+106    ,
+111    ,
+117    ,
+123    ,
+129    ,
+135    ,
+142    ,
+149    ,
+156    ,
+164    ,
+172    ,
+180    ,
+189    ,
+199    ,
+209    ,
+219    ,
+230    ,
+241    ,
+253    ,
+266    ,
+279    ,
+293    ,
+307    ,
+322    ,
+338    ,
+355    ,
+373    ,
+391    ,
+411    ,
+431    ,
+452    ,
+475    ,
+498    ,
+523    ,
+549    ,
+576    ,
+605    ,
+635    ,
+666    ,
+699    ,
+734    ,
+770    ,
+808    ,
+848    ,
+890    ,
+935    ,
+981    ,
+1029    ,
+1080    ,
+1134    ,
+1190    ,
+1249    ,
+1311    ,
+1376    ,
+1444    ,
+1516    ,
+1591    ,
+1670    ,
+1753    ,
+1840    ,
+1931    ,
+2026    ,
+2127    ,
+2232    ,
+2343    ,
+2459    ,
+2581    ,
+2709    ,
+2843    ,
+2984    ,
+3132    ,
+3287    ,
+3450    ,
+3621    ,
+3800    ,
+3989    ,
+4186    ,
+4394    ,
+4612    ,
+4840    ,
+5080    ,
+5332    ,
+5596    ,
+5874    ,
+6165    ,
+6470    ,
+6791    ,
+7128    ,
+7481    ,
+7852    ,
+8241    ,
+8649    ,
+9078    ,
+9528    ,
+10000    ,
+10496    ,
+11016    ,
+11562    ,
+12135    ,
+12736    ,
+13368    ,
+14030    ,
+14725    ,
+15455    ,
+16221    ,
+17025    ,
+17869    ,
+18755    ,
+19684    ,
+20660    ,
+21684    ,
+22758    ,
+23886    ,
+25070    ,
+26313    ,
+27617    ,
+28986    ,
+30422    ,
+31930    ,
+33513    ,
+35174    ,
+36917    ,
+38747    ,
+40667    ,
+42683    ,
+44798    ,
+47019    ,
+49349    ,
+51795    ,
+54362    ,
+57056    ,
+59884    ,
+62852    ,
+65967    ,
+69237    ,
+72668    ,
+76270    ,
+80050    ,
+84017    ,
+88182    ,
+92552    ,
+97139    ,
+101954    ,
+107007    ,
+112310    ,
+117877    ,
+123719    ,
+129851    ,
+136287    ,
+143042    ,
+150131    ,
+157572    ,
+165382    ,
+173578    ,
+182181    ,
+191211    ,
+200688    ,
+210634    ,
+221074    ,
+232031    ,
+243531    ,
+255601    ,
+268270    ,
+281566    ,
+295521    ,
+310168    ,
+325541    ,
+341675    ,
+358610    ,
+376383    ,
+395038    ,
+414617    ,
+435167    ,
+456735    ,
+479372    ,
+503131    ,
+528067    ,
+554240    ,
+581709    ,
+610540    ,
+640800    ,
+672560    ,
+705894    ,
+740880    ,
+777600    ,
+816140    ,
+856590    ,
+899045    ,
+943604    ,
+990372    ,
+1039457    ,
+1090976    ,
+1145048    ,
+1201799    ,
+1261364    ,
+1323880    ,
+1389495    ,
+1458363    ,
+1530643    ,
+1606506    ,
+1686129    ,
+1769698    ,
+1857409    ,
+1949467    ,
+2046088    ,
+2147498    ,
+2253934    ,
+2365645    ,
+2482893    ,
+2605952    ,
+2735110    ,
+2870669    ,
+3012948    ,
+3162278    ,
+3319009    ,
+3483508    ,
+3656160    ,
+3837369    ,
+4027560    ,
+4227177    ,
+4436687    ,
+4656582    
+
+
+    
+};
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AWB/inc/ProcAWBFrameHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCAWBFRAMEHANDLER_H__
+#define __CPROCAWBFRAMEHANDLER_H__
+
+#include <e32base.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "ProcFrameHandler.h"
+
+class CProcAWBFrameHandler : public CProcFrameHandler 
+    {
+
+public:
+
+    // aGain -40(dB) - +20(dB)
+    virtual TBool ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain);
+
+    // From base class
+    virtual TBool GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const;
+    virtual TBool GetNormalizingMargin(const HBufC8* aFrame, TInt8& aMargin) const;
+
+    virtual ~CProcAWBFrameHandler();
+
+    static CProcAWBFrameHandler* NewL();
+    static CProcAWBFrameHandler* NewLC();
+
+private:
+
+    void ConstructL();
+    CProcAWBFrameHandler();
+
+    TBool GetAWBGainsL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const;
+
+//    RArray<TInt> iGains;
+//    TInt iGainsRead;
+
+    
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AWB/inc/ProcAWBInFileHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __CPROCAWBINFILEHANDLER_H__
+#define __CPROCAWBINFILEHANDLER_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "ProcInFileHandler.h"
+
+
+class CProcAWBInFileHandler: public CProcInFileHandler 
+    {
+
+public:
+
+    static CProcAWBInFileHandler* NewL(const TDesC& aFileName, 
+                                       RFile* aFileHandle,
+                                       CAudClip* aClip, TInt aReadBufferSize,
+                                       TInt aTargetSampleRate = 0, 
+                                       TChannelMode aChannelMode = EAudSingleChannel);
+                                       
+    static CProcAWBInFileHandler* NewLC(const TDesC& aFileName, 
+                                        RFile* aFileHandle,
+                                        CAudClip* aClip, TInt aReadBufferSize,
+                                        TInt aTargetSampleRate = 0, 
+                                        TChannelMode aChannelMode = EAudSingleChannel);
+
+
+    // From base class
+
+    void GetPropertiesL(TAudFileProperties* aProperties);
+    
+    /**
+    * Seeks a certain audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    * @param aFrameIndex    frame index
+    * @param aTime            time from the beginning of file in milliseconds
+    *
+    * @return    ETrue if successful
+    *            EFalse if beyond the file
+    */
+    TBool SeekAudioFrame(TInt32 aTime);
+
+    
+    /**
+    * Seeks a cut in audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    *
+    * @return    ETrue if successful
+    *                
+    */
+    TBool SeekCutInFrame();
+    
+    virtual TBool SetNormalizingGainL(const CProcFrameHandler* aFrameHandler);
+
+    virtual ~CProcAWBInFileHandler();
+
+
+    
+
+private:
+    
+    void ConstructL(const TDesC& aFileName, RFile* aFileHandle, CAudClip* aClip, 
+                    TInt aReadBufferSize, TInt aTargetSampleRate = 0, 
+                    TChannelMode aChannelMode = EAudSingleChannel);
+                    
+    TBool GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime);
+    
+    // durations in milliseconds
+    virtual TBool GetFrameInfo(TInt& aSongDuration,
+                                TInt& aFrameAmount, 
+                                TInt& aAverageFrameDuration, 
+                                TInt& aAverageFrameSize);
+
+
+
+protected:
+    
+    CProcAWBInFileHandler();
+    
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AWB/inc/mime_io.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,368 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef MIME_IO_H
+#define MIME_IO_H
+
+//static UWord8 toc_byte[16] = {0x04, 0x0C, 0x14, 0x1C, 0x24, 0x2C, 0x34, 0x3C,
+  //                            0x44, 0x4C, 0x54, 0x5C, 0x64, 0x6C, 0x74, 0x7C};
+
+/* number of speech bits for all modes */
+//TInt unpacked_size[16] = {132,  177, 253, 285, 317, 365, 397, 461,
+    //                               477,   35,   0,   0,   0,   0,   0,   0};
+
+/* size of packed frame for each mode, excluding TOC byte */
+//TInt packed_size[16] = {17, 23, 32, 36, 40, 46, 50, 58,
+  //                               60,  5,  0,  0,  0,  0,  0,  0};
+
+/* number of unused speech bits in packed format for each mode */
+//TInt unused_size[16] = {4, 7, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0};
+
+/* sorting tables for all modes */
+
+const TInt sort_660[132] = {
+     0,   5,   6,   7,  61,  84, 107, 130,  62,  85,
+     8,   4,  37,  38,  39,  40,  58,  81, 104, 127,
+    60,  83, 106, 129, 108, 131, 128,  41,  42,  80,
+   126,   1,   3,  57, 103,  82, 105,  59,   2,  63,
+   109, 110,  86,  19,  22,  23,  64,  87,  18,  20,
+    21,  17,  13,  88,  43,  89,  65, 111,  14,  24,
+    25,  26,  27,  28,  15,  16,  44,  90,  66, 112,
+     9,  11,  10,  12,  67, 113,  29,  30,  31,  32,
+    34,  33,  35,  36,  45,  51,  68,  74,  91,  97,
+   114, 120,  46,  69,  92, 115,  52,  75,  98, 121,
+    47,  70,  93, 116,  53,  76,  99, 122,  48,  71,
+    94, 117,  54,  77, 100, 123,  49,  72,  95, 118,
+    55,  78, 101, 124,  50,  73,  96, 119,  56,  79,
+   102, 125
+};
+
+const TInt sort_885[177] = {
+     0,   4,   6,   7,   5,   3,  47,  48,  49, 112,
+   113, 114,  75, 106, 140, 171,  80, 111, 145, 176,
+    77, 108, 142, 173,  78, 109, 143, 174,  79, 110,
+   144, 175,  76, 107, 141, 172,  50, 115,  51,   2,
+     1,  81, 116, 146,  19,  21,  12,  17,  18,  20,
+    16,  25,  13,  10,  14,  24,  23,  22,  26,   8,
+    15,  52, 117,  31,  82, 147,   9,  33,  11,  83,
+   148,  53, 118,  28,  27,  84, 149,  34,  35,  29,
+    46,  32,  30,  54, 119,  37,  36,  39,  38,  40,
+    85, 150,  41,  42,  43,  44,  45,  55,  60,  65,
+    70,  86,  91,  96, 101, 120, 125, 130, 135, 151,
+   156, 161, 166,  56,  87, 121, 152,  61,  92, 126,
+   157,  66,  97, 131, 162,  71, 102, 136, 167,  57,
+    88, 122, 153,  62,  93, 127, 158,  67,  98, 132,
+   163,  72, 103, 137, 168,  58,  89, 123, 154,  63,
+    94, 128, 159,  68,  99, 133, 164,  73, 104, 138,
+   169,  59,  90, 124, 155,  64,  95, 129, 160,  69,
+   100, 134, 165,  74, 105, 139, 170
+};
+
+const TInt sort_1265[253] = {
+     0,   4,   6,  93, 143, 196, 246,   7,   5,   3,
+    47,  48,  49,  50,  51, 150, 151, 152, 153, 154,
+    94, 144, 197, 247,  99, 149, 202, 252,  96, 146,
+   199, 249,  97, 147, 200, 250, 100, 203,  98, 148,
+   201, 251,  95, 145, 198, 248,  52,   2,   1, 101,
+   204, 155,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+   156,  31, 102, 205,   9,  33,  11, 103, 206,  54,
+   157,  28,  27, 104, 207,  34,  35,  29,  46,  32,
+    30,  55, 158,  37,  36,  39,  38,  40, 105, 208,
+    41,  42,  43,  44,  45,  56, 106, 159, 209,  57,
+    66,  75,  84, 107, 116, 125, 134, 160, 169, 178,
+   187, 210, 219, 228, 237,  58, 108, 161, 211,  62,
+   112, 165, 215,  67, 117, 170, 220,  71, 121, 174,
+   224,  76, 126, 179, 229,  80, 130, 183, 233,  85,
+   135, 188, 238,  89, 139, 192, 242,  59, 109, 162,
+   212,  63, 113, 166, 216,  68, 118, 171, 221,  72,
+   122, 175, 225,  77, 127, 180, 230,  81, 131, 184,
+   234,  86, 136, 189, 239,  90, 140, 193, 243,  60,
+   110, 163, 213,  64, 114, 167, 217,  69, 119, 172,
+   222,  73, 123, 176, 226,  78, 128, 181, 231,  82,
+   132, 185, 235,  87, 137, 190, 240,  91, 141, 194,
+   244,  61, 111, 164, 214,  65, 115, 168, 218,  70,
+   120, 173, 223,  74, 124, 177, 227,  79, 129, 182,
+   232,  83, 133, 186, 236,  88, 138, 191, 241,  92,
+   142, 195, 245                         
+};
+
+const TInt sort_1425[285] = {
+     0,   4,   6, 101, 159, 220, 278,   7,   5,   3,
+    47,  48,  49,  50,  51, 166, 167, 168, 169, 170,
+   102, 160, 221, 279, 107, 165, 226, 284, 104, 162,
+   223, 281, 105, 163, 224, 282, 108, 227, 106, 164,
+   225, 283, 103, 161, 222, 280,  52,   2,   1, 109,
+   228, 171,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+   172,  31, 110, 229,   9,  33,  11, 111, 230,  54,
+   173,  28,  27, 112, 231,  34,  35,  29,  46,  32,
+    30,  55, 174,  37,  36,  39,  38,  40, 113, 232,
+    41,  42,  43,  44,  45,  56, 114, 175, 233,  62,
+   120, 181, 239,  75, 133, 194, 252,  57, 115, 176,
+   234,  63, 121, 182, 240,  70, 128, 189, 247,  76,
+   134, 195, 253,  83, 141, 202, 260,  92, 150, 211,
+   269,  84, 142, 203, 261,  93, 151, 212, 270,  85,
+   143, 204, 262,  94, 152, 213, 271,  86, 144, 205,
+   263,  95, 153, 214, 272,  64, 122, 183, 241,  77,
+   135, 196, 254,  65, 123, 184, 242,  78, 136, 197,
+   255,  87, 145, 206, 264,  96, 154, 215, 273,  58,
+   116, 177, 235,  66, 124, 185, 243,  71, 129, 190,
+   248,  79, 137, 198, 256,  88, 146, 207, 265,  97,
+   155, 216, 274,  59, 117, 178, 236,  67, 125, 186,
+   244,  72, 130, 191, 249,  80, 138, 199, 257,  89,
+   147, 208, 266,  98, 156, 217, 275,  60, 118, 179,
+   237,  68, 126, 187, 245,  73, 131, 192, 250,  81,
+   139, 200, 258,  90, 148, 209, 267,  99, 157, 218,
+   276,  61, 119, 180, 238,  69, 127, 188, 246,  74,
+   132, 193, 251,  82, 140, 201, 259,  91, 149, 210,
+   268, 100, 158, 219, 277
+};
+
+const TInt sort_1585[317] = {
+     0,   4,   6, 109, 175, 244, 310,   7,   5,   3,
+    47,  48,  49,  50,  51, 182, 183, 184, 185, 186,
+   110, 176, 245, 311, 115, 181, 250, 316, 112, 178,
+   247, 313, 113, 179, 248, 314, 116, 251, 114, 180,
+   249, 315, 111, 177, 246, 312,  52,   2,   1, 117,
+   252, 187,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+   188,  31, 118, 253,   9,  33,  11, 119, 254,  54,
+   189,  28,  27, 120, 255,  34,  35,  29,  46,  32,
+    30,  55, 190,  37,  36,  39,  38,  40, 121, 256,
+    41,  42,  43,  44,  45,  56, 122, 191, 257,  63,
+   129, 198, 264,  76, 142, 211, 277,  89, 155, 224,
+   290, 102, 168, 237, 303,  57, 123, 192, 258,  70,
+   136, 205, 271,  83, 149, 218, 284,  96, 162, 231,
+   297,  62, 128, 197, 263,  75, 141, 210, 276,  88,
+   154, 223, 289, 101, 167, 236, 302,  58, 124, 193,
+   259,  71, 137, 206, 272,  84, 150, 219, 285,  97,
+   163, 232, 298,  59, 125, 194, 260,  64, 130, 199,
+   265,  67, 133, 202, 268,  72, 138, 207, 273,  77,
+   143, 212, 278,  80, 146, 215, 281,  85, 151, 220,
+   286,  90, 156, 225, 291,  93, 159, 228, 294,  98,
+   164, 233, 299, 103, 169, 238, 304, 106, 172, 241,
+   307,  60, 126, 195, 261,  65, 131, 200, 266,  68,
+   134, 203, 269,  73, 139, 208, 274,  78, 144, 213,
+   279,  81, 147, 216, 282,  86, 152, 221, 287,  91,
+   157, 226, 292,  94, 160, 229, 295,  99, 165, 234,
+   300, 104, 170, 239, 305, 107, 173, 242, 308,  61,
+   127, 196, 262,  66, 132, 201, 267,  69, 135, 204,
+   270,  74, 140, 209, 275,  79, 145, 214, 280,  82,
+   148, 217, 283,  87, 153, 222, 288,  92, 158, 227,
+   293,  95, 161, 230, 296, 100, 166, 235, 301, 105,
+   171, 240, 306, 108, 174, 243, 309
+};
+
+const TInt sort_1825[365] = {
+     0,   4,   6, 121, 199, 280, 358,   7,   5,   3,
+    47,  48,  49,  50,  51, 206, 207, 208, 209, 210,
+   122, 200, 281, 359, 127, 205, 286, 364, 124, 202,
+   283, 361, 125, 203, 284, 362, 128, 287, 126, 204,
+   285, 363, 123, 201, 282, 360,  52,   2,   1, 129,
+   288, 211,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+   212,  31, 130, 289,   9,  33,  11, 131, 290,  54,
+   213,  28,  27, 132, 291,  34,  35,  29,  46,  32,
+    30,  55, 214,  37,  36,  39,  38,  40, 133, 292,
+    41,  42,  43,  44,  45,  56, 134, 215, 293, 198,
+   299, 136, 120, 138,  60, 279,  58,  62, 357, 139,
+   140, 295, 156,  57, 219, 297,  63, 217, 137, 170,
+   300, 222,  64, 106,  61,  78, 294,  92, 142, 141,
+   135, 221, 296, 301, 343,  59, 298, 184, 329, 315,
+   220, 216, 265, 251, 218, 237, 352, 223, 157,  86,
+   171,  87, 164, 351, 111, 302,  65, 178, 115, 323,
+    72, 192, 101, 179,  93,  73, 193, 151, 337, 309,
+   143, 274,  69, 324, 165, 150,  97, 338, 110, 310,
+   330, 273,  68, 107, 175, 245, 114,  79, 113, 189,
+   246, 259, 174,  71, 185,  96, 344, 100, 322,  83,
+   334, 316, 333, 252, 161, 348, 147,  82, 269, 232,
+   260, 308, 353, 347, 163, 231, 306, 320, 188, 270,
+   146, 177, 266, 350, 256,  85, 149, 116, 191, 160,
+   238, 258, 336, 305, 255,  88, 224,  99, 339, 230,
+   228, 227, 272, 242, 241, 319, 233, 311, 102,  74,
+   180, 275,  66, 194, 152, 325, 172, 247, 244, 261,
+   117, 158, 166, 354,  75, 144, 108, 312,  94, 186,
+   303,  80, 234,  89, 195, 112, 340, 181, 345, 317,
+   326, 276, 239, 167, 118, 313,  70, 355, 327, 253,
+   190, 176, 271, 104,  98, 153, 103,  90,  76, 267,
+   277, 248, 225, 262, 182,  84, 154, 235, 335, 168,
+   331, 196, 341, 249, 162, 307, 148, 349, 263, 321,
+   257, 243, 229, 356, 159, 119,  67, 187, 173, 145,
+   240,  77, 304, 332, 314, 342, 109, 254,  81, 278,
+   105,  91, 346, 318, 183, 250, 197, 328,  95, 155,
+   169, 268, 226, 236, 264                 
+};
+
+const TInt sort_1985[397] = {
+     0,   4,   6, 129, 215, 304, 390,   7,   5,   3,
+    47,  48,  49,  50,  51, 222, 223, 224, 225, 226,
+   130, 216, 305, 391, 135, 221, 310, 396, 132, 218,
+   307, 393, 133, 219, 308, 394, 136, 311, 134, 220,
+   309, 395, 131, 217, 306, 392,  52,   2,   1, 137,
+   312, 227,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+   228,  31, 138, 313,   9,  33,  11, 139, 314,  54,
+   229,  28,  27, 140, 315,  34,  35,  29,  46,  32,
+    30,  55, 230,  37,  36,  39,  38,  40, 141, 316,
+    41,  42,  43,  44,  45,  56, 142, 231, 317,  63,
+    73,  92, 340,  82, 324, 149, 353, 159, 334, 165,
+   338, 178, 163, 254,  77, 168, 257, 153, 343,  57,
+   248, 238,  79, 252, 166,  67,  80, 201, 101, 267,
+   143, 164, 341, 255, 339, 187, 376, 318,  78, 328,
+   362, 115, 232, 242, 253, 290, 276,  62,  58, 158,
+    68,  93, 179, 319, 148, 169, 154,  72, 385, 329,
+   333, 344, 102,  83, 144, 233, 323, 124, 243, 192,
+   354, 237,  64, 247, 202, 209, 150, 116, 335, 268,
+   239, 299, 188, 196, 298,  94, 195, 258, 123, 363,
+   384, 109, 325, 371, 170, 370,  84, 110, 295, 180,
+    74, 210, 191, 106, 291, 205, 367, 381, 377, 206,
+   355, 122, 119, 120, 383, 160, 105, 108, 277, 380,
+   294, 284, 285, 345, 208, 269, 249, 366, 386, 300,
+   297, 259, 125, 369, 197,  97, 194, 286, 211, 281,
+   280, 183, 372,  87, 155, 283,  59, 348, 327, 184,
+    76, 111, 330, 203, 349,  69,  98, 152, 145, 189,
+    66, 320, 337, 173, 358, 251, 198, 174, 263, 262,
+   126, 241, 193,  88, 388, 117,  95, 387, 112, 359,
+   287, 244, 103, 272, 301, 171, 162, 234, 273, 127,
+   373, 181, 292,  85, 378, 302, 121, 107, 364, 346,
+   356, 212, 278, 213,  65, 382, 288, 207, 113, 175,
+    99, 296, 374, 368, 199, 260, 185, 336, 331, 161,
+   270, 264, 250, 240,  75, 350, 151,  60,  89, 321,
+   156, 274, 360, 326,  70, 282, 167, 146, 352,  81,
+    91, 389, 266, 245, 177, 235, 190, 256, 204, 342,
+   128, 118, 303, 104, 379, 182, 114, 375, 200,  96,
+   293, 172, 214, 365, 279,  86, 289, 351, 347, 357,
+   261, 186, 176, 271,  90, 100, 147, 322, 275, 361,
+    71, 332,  61, 265, 157, 246, 236         
+};
+
+const TInt sort_2305[461] = {
+     0,   4,   6, 145, 247, 352, 454,   7,   5,   3,
+    47,  48,  49,  50,  51, 254, 255, 256, 257, 258,
+   146, 248, 353, 455, 151, 253, 358, 460, 148, 250,
+   355, 457, 149, 251, 356, 458, 152, 359, 150, 252,
+   357, 459, 147, 249, 354, 456,  52,   2,   1, 153,
+   360, 259,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+   260,  31, 154, 361,   9,  33,  11, 155, 362,  54,
+   261,  28,  27, 156, 363,  34,  35,  29,  46,  32,
+    30,  55, 262,  37,  36,  39,  38,  40, 157, 364,
+    41,  42,  43,  44,  45,  56, 158, 263, 365, 181,
+   192, 170,  79,  57, 399,  90, 159, 297, 377, 366,
+   275,  68, 183, 388, 286, 194, 299, 92 ,  70, 182,
+   401, 172,  59,  91,  58, 400, 368, 161,  81, 160,
+   264, 171,  80, 389, 390, 378, 379, 193, 298,  69,
+   266, 265, 367, 277, 288, 276, 287, 184,  60, 195,
+    82,  93,  71, 369, 402, 173, 162, 444, 300, 391,
+    98,  76, 278,  61, 267, 374, 135, 411, 167, 102,
+   380, 200,  87, 178,  65,  94, 204, 124,  72, 342,
+   189, 305, 381, 396, 433, 301, 226, 407, 289, 237,
+   113, 215, 185, 128, 309, 403, 116, 320, 196, 331,
+   370, 422, 174,  64, 392,  83, 425, 219, 134, 188,
+   432, 112, 427, 139, 279, 163, 436, 208, 447, 218,
+   236, 229,  97, 294, 385, 230, 166, 268, 177, 443,
+   225, 426, 101, 272, 138, 127, 290, 117, 347, 199,
+   414,  95, 140, 240, 410, 395, 209, 129, 283, 346,
+   105, 241, 437,  86, 308, 448, 203, 345, 186, 107,
+   220, 415, 334, 319, 106, 313, 118, 123,  73, 207,
+   421, 214, 384, 373, 438,  62, 371, 341,  75, 449,
+   168, 323, 164, 242, 416, 324, 304, 197, 335, 404,
+   271,  63, 191, 325,  96, 169, 231, 280, 312, 187,
+   406,  84, 201, 100,  67, 382, 175, 336, 202, 330,
+   269, 393, 376, 383, 293, 307, 409, 179, 285, 314,
+   302, 372, 398, 190, 180,  89,  99, 103, 232,  78,
+    88,  77, 136, 387, 165, 198, 394, 125, 176, 428,
+    74, 375, 238, 227,  66, 273, 282, 141, 306, 412,
+   114,  85, 130, 348, 119, 291, 296, 386, 233, 397,
+   303, 405, 284, 445, 423, 221, 210, 205, 450, 108,
+   274, 434, 216, 343, 337, 142, 243, 321, 408, 451,
+   310, 292, 120, 109, 281, 439, 270, 429, 332, 295,
+   418, 211, 315, 222, 326, 131, 430, 244, 327, 349,
+   417, 316, 143, 338, 440, 234, 110, 212, 452, 245,
+   121, 419, 350, 223, 132, 441, 328, 413, 317, 339,
+   126, 104, 137, 446, 344, 239, 435, 115, 333, 206,
+   322, 217, 228, 424, 453, 311, 351, 111, 442, 224,
+   213, 122, 431, 340, 235, 246, 133, 144, 420, 329,
+   318
+};
+
+const TInt sort_2385[477] = {
+     0,   4,   6, 145, 251, 360, 466,   7,   5,   3,
+    47,  48,  49,  50,  51, 262, 263, 264, 265, 266,
+   146, 252, 361, 467, 151, 257, 366, 472, 148, 254,
+   363, 469, 149, 255, 364, 470, 156, 371, 150, 256,
+   365, 471, 147, 253, 362, 468,  52,   2,   1, 157,
+   372, 267,  19,  21,  12,  17,  18,  20,  16,  25,
+    13,  10,  14,  24,  23,  22,  26,   8,  15,  53,
+   268,  31, 152, 153, 154, 155, 258, 259, 260, 261,
+   367, 368, 369, 370, 473, 474, 475, 476, 158, 373,
+     9,  33,  11, 159, 374,  54, 269,  28,  27, 160,
+   375,  34,  35,  29,  46,  32,  30,  55, 270, 37,
+    36,  39,  38,  40, 161, 376,  41,  42,  43,  44,
+    45,  56, 162, 271, 377, 185, 196, 174,  79,  57,
+   411,  90, 163, 305, 389, 378, 283,  68, 187, 400,
+   294, 198, 307,  92,  70, 186, 413, 176,  59,  91,
+    58, 412, 380, 165,  81, 164, 272, 175,  80, 401,
+   402, 390, 391, 197, 306,  69, 274, 273, 379, 285,
+   296, 284, 295, 188,  60, 199,  82,  93,  71, 381,
+   414, 177, 166, 456, 308, 403,  98,  76, 286,  61,
+   275, 386, 135, 423, 171, 102, 392, 204,  87, 182,
+    65,  94, 208, 124,  72, 350, 193, 313, 393, 408,
+   445, 309, 230, 419, 297, 241, 113, 219, 189, 128,
+   317, 415, 116, 328, 200, 339, 382, 434, 178,  64,
+   404,  83, 437, 223, 134, 192, 444, 112, 439, 139,
+   287, 167, 448, 212, 459, 222, 240, 233,  97, 302,
+   397, 234, 170, 276, 181, 455, 229, 438, 101, 280,
+   138, 127, 298, 117, 355, 203, 426,  95, 140, 244,
+   422, 407, 213, 129, 291, 354, 105, 245, 449,  86,
+   316, 460, 207, 353, 190, 107, 224, 427, 342, 327,
+   106, 321, 118, 123,  73, 211, 433, 218, 396, 385,
+   450,  62, 383, 349,  75, 461, 172, 331, 168, 246,
+   428, 332, 312, 201, 343, 416, 279,  63, 195, 333,
+    96, 173, 235, 288, 320, 191, 418,  84, 205, 100,
+    67, 394, 179, 344, 206, 338, 277, 405, 388, 395,
+   301, 315, 421, 183, 293, 322, 310, 384, 410, 194,
+   184,  89,  99, 103, 236,  78,  88,  77, 136, 399,
+   169, 202, 406, 125, 180, 440,  74, 387, 242, 231,
+    66, 281, 290, 141, 314, 424, 114,  85, 130, 356,
+   119, 299, 304, 398, 237, 409, 311, 417, 292, 457,
+   435, 225, 214, 209, 462, 108, 282, 446, 220, 351,
+   345, 142, 247, 329, 420, 463, 318, 300, 120, 109,
+   289, 451, 278, 441, 340, 303, 430, 215, 323, 226,
+   334, 131, 442, 248, 335, 357, 429, 324, 143, 346,
+   452, 238, 110, 216, 464, 249, 121, 431, 358, 227,
+   132, 453, 336, 425, 325, 347, 126, 104, 137, 458,
+   352, 243, 447, 115, 341, 210, 330, 221, 232, 436,
+   465, 319, 359, 111, 454, 228, 217, 122, 443, 348,
+   239, 250, 133, 144, 432, 337, 326         
+};
+
+const TInt sort_SID[35] = {
+    0,  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
+};
+
+/* pointer table for bit sorting tables */
+//const TInt *sort_ptr[16] = { sort_660, sort_885, sort_1265, sort_1425, sort_1585, sort_1825, sort_1985, sort_2305,
+  //                             sort_2385, sort_SID,      NULL,      NULL,      NULL,      NULL,      NULL,      NULL};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AWB/inc/q_gain2.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,229 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/*------------------------------------------------------*
+ * Tables for function q_gain2()                        *
+ *                                                      *
+ *  g_pitch(Q14),  g_code(Q11)                          *
+ *                                                      *
+ * pitch gain are ordered in table to reduce complexity *
+ * during quantization of gains.                        *
+ *------------------------------------------------------*/
+
+#define nb_qua_gain6b  64     /* Number of quantization level */
+#define nb_qua_gain7b  128    /* Number of quantization level */
+
+
+const TInt t_qua_gain6b[64*2] = {
+   1566,  1332,
+   1577,  3557,
+   3071,  6490,
+   4193, 10163,
+   4496,  2534,
+   5019,  4488,
+   5586, 15614,
+   5725,  1422,
+   6453,   580,
+   6724,  6831,
+   7657,  3527,
+   8072,  2099,
+   8232,  5319,
+   8827,  8775,
+   9740,  2868,
+   9856,  1465,
+  10087, 12488,
+  10241,  4453,
+  10859,  6618,
+  11321,  3587,
+  11417,  1800,
+  11643,  2428,
+  11718,   988,
+  12312,  5093,
+  12523,  8413,
+  12574, 26214,
+  12601,  3396,
+  13172,  1623,
+  13285,  2423,
+  13418,  6087,
+  13459, 12810,
+  13656,  3607,
+  14111,  4521,
+  14144,  1229,
+  14425,  1871,
+  14431,  7234,
+  14445,  2834,
+  14628, 10036,
+  14860, 17496,
+  15161,  3629,
+  15209,  5819,
+  15299,  2256,
+  15518,  4722,
+  15663,  1060,
+  15759,  7972,
+  15939, 11964,
+  16020,  2996,
+  16086,  1707,
+  16521,  4254,
+  16576,  6224,
+  16894,  2380,
+  16906,   681,
+  17213,  8406,
+  17610,  3418,
+  17895,  5269,
+  18168, 11748,
+  18230,  1575,
+  18607, 32767,
+  18728, 21684,
+  19137,  2543,
+  19422,  6577,
+  19446,  4097,
+  19450,  9056,
+  20371, 14885};
+
+const TInt t_qua_gain7b[128*2] = {
+    204,   441,
+    464,  1977,
+    869,  1077,
+   1072,  3062,
+   1281,  4759,
+   1647,  1539,
+   1845,  7020,
+   1853,   634,
+   1995,  2336,
+   2351, 15400,
+   2661,  1165,
+   2702,  3900,
+   2710, 10133,
+   3195,  1752,
+   3498,  2624,
+   3663,   849,
+   3984,  5697,
+   4214,  3399,
+   4415,  1304,
+   4695,  2056,
+   5376,  4558,
+   5386,   676,
+   5518, 23554,
+   5567,  7794,
+   5644,  3061,
+   5672,  1513,
+   5957,  2338,
+   6533,  1060,
+   6804,  5998,
+   6820,  1767,
+   6937,  3837,
+   7277,   414,
+   7305,  2665,
+   7466, 11304,
+   7942,   794,
+   8007,  1982,
+   8007,  1366,
+   8326,  3105,
+   8336,  4810,
+   8708,  7954,
+   8989,  2279,
+   9031,  1055,
+   9247,  3568,
+   9283,  1631,
+   9654,  6311,
+   9811,  2605,
+  10120,   683,
+  10143,  4179,
+  10245,  1946,
+  10335,  1218,
+  10468,  9960,
+  10651,  3000,
+  10951,  1530,
+  10969,  5290,
+  11203,  2305,
+  11325,  3562,
+  11771,  6754,
+  11839,  1849,
+  11941,  4495,
+  11954,  1298,
+  11975, 15223,
+  11977,   883,
+  11986,  2842,
+  12438,  2141,
+  12593,  3665,
+  12636,  8367,
+  12658,  1594,
+  12886,  2628,
+  12984,  4942,
+  13146,  1115,
+  13224,   524,
+  13341,  3163,
+  13399,  1923,
+  13549,  5961,
+  13606,  1401,
+  13655,  2399,
+  13782,  3909,
+  13868, 10923,
+  14226,  1723,
+  14232,  2939,
+  14278,  7528,
+  14439,  4598,
+  14451,   984,
+  14458,  2265,
+  14792,  1403,
+  14818,  3445,
+  14899,  5709,
+  15017, 15362,
+  15048,  1946,
+  15069,  2655,
+  15405,  9591,
+  15405,  4079,
+  15570,  7183,
+  15687,  2286,
+  15691,  1624,
+  15699,  3068,
+  15772,  5149,
+  15868,  1205,
+  15970,   696,
+  16249,  3584,
+  16338,  1917,
+  16424,  2560,
+  16483,  4438,
+  16529,  6410,
+  16620, 11966,
+  16839,  8780,
+  17030,  3050,
+  17033, 18325,
+  17092,  1568,
+  17123,  5197,
+  17351,  2113,
+  17374,   980,
+  17566, 26214,
+  17609,  3912,
+  17639, 32767,
+  18151,  7871,
+  18197,  2516,
+  18202,  5649,
+  18679,  3283,
+  18930,  1370,
+  19271, 13757,
+  19317,  4120,
+  19460,  1973,
+  19654, 10018,
+  19764,  6792,
+  19912,  5135,
+  20040,  2841,
+  21234, 19833};
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AWB/src/ProcAWBFrameHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,419 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "ProcAWBFrameHandler.h"
+#include "ProcFrameHandler.h"
+#include "ProcTools.h"
+#include "q_gain2.h"
+#include "AWBConstants.h"
+
+#include <f32file.h>
+#include <e32math.h>
+
+
+TBool CProcAWBFrameHandler::ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain) 
+    {
+    
+    aFrameOut = HBufC8::NewLC(aFrameIn->Size());
+    aFrameOut->Des().Copy(aFrameIn->Ptr(), aFrameIn->Size());
+
+    aGain = static_cast<TInt8>(aGain/2);
+
+    const TUint8 modeByte = (*aFrameOut)[0];
+    
+    TUint8 toc = modeByte;
+    TUint8 mode = static_cast<TUint8>((toc >> 3) & 0x0F);
+            
+    TInt bitrate = KAWBBitRates[mode];
+    
+    RArray<TInt> gains;
+    CleanupClosePushL(gains);
+    TInt maxGain = 0;
+    GetAWBGainsL(aFrameOut, gains, maxGain);
+
+    TInt gamma10000 = KAwbGain_dB2Gamma[aGain+127];
+
+    TInt a = 0;
+    TInt old_gain = 0;
+    TInt old_pitch = 0;
+    TInt new_gain = 0;
+    TInt8 new_index = 0;
+    TInt bitRateIndex = -1;
+
+    switch (bitrate)
+        {
+
+        case 23850:
+        case 23050:
+        case 19850:
+        case 18250:
+        case 15850:
+        case 14250:
+        case 12650:
+            {
+
+            for (a = 0; a < gains.Count()-1 ; a+=2) 
+                {
+        
+                old_gain = gains[a+1];
+                new_gain = static_cast<TInt>((gamma10000*old_gain)/10000);
+                old_pitch = gains[a];
+
+                new_index = ProcTools::FindNewIndexVQ2(new_gain, old_pitch, 
+                                                    t_qua_gain7b, 
+                                                    2*128);
+
+            
+                bitRateIndex = ProcTools::FindIndex(bitrate, KAWBBitRates, 9);
+
+
+                if        (a == 0) ProcTools::SetValueToShuffledAWBFrame(new_index, 
+                                                                       aFrameOut, 
+                                                                       bitrate,
+                                                                       KGainPositions[bitRateIndex*4], 7);
+                else if (a == 2) ProcTools::SetValueToShuffledAWBFrame(new_index, 
+                                                                       aFrameOut, 
+                                                                       bitrate,
+                                                                       KGainPositions[bitRateIndex*4+1], 7);
+                else if (a == 4) ProcTools::SetValueToShuffledAWBFrame(new_index, 
+                                                                       aFrameOut, 
+                                                                       bitrate,
+                                                                       KGainPositions[bitRateIndex*4+2], 7);
+                else if (a == 6) ProcTools::SetValueToShuffledAWBFrame(new_index, 
+                                                                       aFrameOut, 
+                                                                       bitrate,
+                                                                       KGainPositions[bitRateIndex*4+3], 7);
+                
+            }
+
+    
+
+            break;
+            }
+
+        case 8850:
+        case 6600:
+            {
+            for (a = 0; a < gains.Count()-1 ; a+=2) 
+                {
+        
+                old_gain = gains[a+1];
+                new_gain = static_cast<TInt>((gamma10000*old_gain)/10000);
+                old_pitch = gains[a];
+
+                new_index = ProcTools::FindNewIndexVQ2(new_gain, old_pitch, 
+                                                    t_qua_gain6b, 
+                                                    2*64);
+
+                bitRateIndex = ProcTools::FindIndex(bitrate, KAWBBitRates, 9);
+
+
+                if        (a == 0) ProcTools::SetValueToShuffledAWBFrame(new_index, 
+                                                                       aFrameOut, 
+                                                                       bitrate,
+                                                                       KGainPositions[bitRateIndex*4], 6);
+                else if (a == 2) ProcTools::SetValueToShuffledAWBFrame(new_index, 
+                                                                       aFrameOut, 
+                                                                       bitrate,
+                                                                       KGainPositions[bitRateIndex*4+1], 6);
+                else if (a == 4) ProcTools::SetValueToShuffledAWBFrame(new_index, 
+                                                                       aFrameOut, 
+                                                                       bitrate,
+                                                                       KGainPositions[bitRateIndex*4+2], 6);
+                else if (a == 6) ProcTools::SetValueToShuffledAWBFrame(new_index, 
+                                                                       aFrameOut, 
+                                                                       bitrate,
+                                                                       KGainPositions[bitRateIndex*4+3], 6);
+                }
+
+            break;
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&gains);
+    CleanupStack::Pop(); // aFrameOut
+    return ETrue;
+    }
+
+TBool CProcAWBFrameHandler::GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const
+    {
+
+    RArray<TInt> AWBGains;
+    CleanupClosePushL(AWBGains);
+    GetAWBGainsL(aFrame, AWBGains, aMaxGain);
+    
+    for (TInt a = 0; a < AWBGains.Count() ; a++)
+        {
+        if (a%2 == 1)
+            {
+            aGains.Append(AWBGains[a]);
+            }
+
+        }
+    
+    CleanupStack::PopAndDestroy(&AWBGains);
+
+    return ETrue;
+    }
+
+
+TBool CProcAWBFrameHandler::GetNormalizingMargin(const HBufC8* aFrame, TInt8& aMargin) const
+
+    {
+
+    RArray<TInt> gains;
+
+    TInt error = KErrNone;
+    TRAP( error, CleanupClosePushL(gains) );
+    
+    if (error != KErrNone)
+        return EFalse;
+    
+    TInt maxGain;
+    
+    TRAPD(err, GetAWBGainsL(aFrame, gains, maxGain));
+    
+    if (err != KErrNone)
+        {
+        return EFalse;
+        }
+    
+    TInt largestGain = 1;
+
+    for (TInt a = 1 ; a < gains.Count() ; a+=2)
+        {
+        if (gains[a] > largestGain) 
+            {
+            largestGain = gains[a];
+            }
+
+        }
+    TInt gamma10000 = (32767*10000)/largestGain;
+
+
+    CleanupStack::PopAndDestroy(&gains);
+
+    TUint8 newIndex = ProcTools::FindNewIndexSQ(gamma10000, KAwbGain_dB2Gamma, 256);
+
+    TInt8 newGain = static_cast<TInt8>(newIndex-127); 
+
+    if (newGain > 63)
+        {
+        newGain = 63;
+        }
+    else if (newGain < -63)
+        {
+        newGain = -63;
+        }
+
+    aMargin = static_cast<TInt8>(newGain*2);
+    // aMargin is now in dB/2:s
+    return ETrue;
+
+    }
+
+CProcAWBFrameHandler::~CProcAWBFrameHandler() 
+    {
+
+        }
+
+CProcAWBFrameHandler* CProcAWBFrameHandler::NewL() 
+    {
+
+    
+    CProcAWBFrameHandler* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+CProcAWBFrameHandler* CProcAWBFrameHandler::NewLC() 
+    {
+
+    CProcAWBFrameHandler* self = new (ELeave) CProcAWBFrameHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+
+    }
+
+void CProcAWBFrameHandler::ConstructL() 
+    {
+
+    }
+
+CProcAWBFrameHandler::CProcAWBFrameHandler()
+    {
+
+    }
+ 
+TBool CProcAWBFrameHandler::GetAWBGainsL(const HBufC8* aFrame, 
+                                        RArray<TInt>& aGains, 
+                                        TInt& aMaxGain) const
+
+    {
+
+    const TUint8 modeByte = (*aFrame)[0];
+
+    TUint8 toc = modeByte;
+    TUint8 mode = static_cast<TUint8>((toc >> 3) & 0x0F);
+            
+    TInt bitrate = KAWBBitRates[mode];
+    TInt cbIndex = -1;
+    TInt a = 0;
+
+    switch (bitrate)
+        {
+
+        case 23850:
+            {
+
+            for (a = 0 ; a < 4 ; a++)
+                {
+                cbIndex = ProcTools::GetValueFromShuffledAWBFrameL(aFrame, bitrate, 
+                                                                KGainPositions[TAWBBitRate23850*4+a], 7);
+                TInt pitch = t_qua_gain7b[cbIndex*2]; 
+                TInt gain = t_qua_gain7b[cbIndex*2+1];
+                aGains.Append(pitch);
+                aGains.Append(gain);
+                }
+
+            break;
+            }
+
+        case 23050:
+            {
+            for (a = 0 ; a < 4 ; a++)
+                {
+                cbIndex = ProcTools::GetValueFromShuffledAWBFrameL(aFrame, bitrate, 
+                                                                KGainPositions[TAWBBitRate23050*4+a], 7);
+                TInt pitch = t_qua_gain7b[cbIndex*2];
+                TInt gain = t_qua_gain7b[cbIndex*2+1];
+                aGains.Append(pitch);
+                aGains.Append(gain);
+                }
+            break;
+            }
+        case 19850:
+            {
+            for (a = 0 ; a < 4 ; a++)
+                {
+                cbIndex = ProcTools::GetValueFromShuffledAWBFrameL(aFrame, bitrate, 
+                                                                KGainPositions[TAWBBitRate19850*4+a], 7);
+                TInt pitch = t_qua_gain7b[cbIndex*2];
+                TInt gain = t_qua_gain7b[cbIndex*2+1];
+                aGains.Append(pitch);
+                aGains.Append(gain);
+                }
+            break;
+            }
+        case 18250:
+            {
+            for (a = 0 ; a < 4 ; a++)
+                {
+            
+                cbIndex = ProcTools::GetValueFromShuffledAWBFrameL(aFrame, bitrate, 
+                                                                KGainPositions[TAWBBitRate18250*4+a], 7);
+                TInt pitch = t_qua_gain7b[cbIndex*2];
+                TInt gain = t_qua_gain7b[cbIndex*2+1];
+                aGains.Append(pitch);
+                aGains.Append(gain);
+                }
+            break;
+            }
+        case 15850:
+            {
+            for (a = 0 ; a < 4 ; a++)
+                {
+                cbIndex = ProcTools::GetValueFromShuffledAWBFrameL(aFrame, bitrate, 
+                                                                KGainPositions[TAWBBitRate15850*4+a], 7);
+                TInt pitch = t_qua_gain7b[cbIndex*2];
+                TInt gain = t_qua_gain7b[cbIndex*2+1];
+                aGains.Append(pitch);
+                aGains.Append(gain);
+                }
+
+            break;
+            }
+        case 14250:
+            {
+            for (a = 0 ; a < 4 ; a++)
+                {
+                cbIndex = ProcTools::GetValueFromShuffledAWBFrameL(aFrame, bitrate, 
+                                                                KGainPositions[TAWBBitRate14250*4+a], 7);
+                TInt pitch = t_qua_gain7b[cbIndex*2];
+                TInt gain = t_qua_gain7b[cbIndex*2+1];
+                aGains.Append(pitch);
+                aGains.Append(gain);
+                }
+
+            break;
+            }
+        case 12650:
+            {
+            for (a = 0 ; a < 4 ; a++)
+                {
+                cbIndex = ProcTools::GetValueFromShuffledAWBFrameL(aFrame, bitrate, 
+                                                                KGainPositions[TAWBBitRate12650*4+a], 7);
+                TInt pitch = t_qua_gain7b[cbIndex*2];
+                TInt gain = t_qua_gain7b[cbIndex*2+1];
+                aGains.Append(pitch);
+                aGains.Append(gain);
+                }
+
+            break;
+            }
+        case 8850:
+            {
+            for (a = 0 ; a < 4 ; a++)
+                {
+                cbIndex = ProcTools::GetValueFromShuffledAWBFrameL(aFrame, bitrate, 
+                                                                KGainPositions[TAWBBitRate8850*4+a], 6);
+                TInt pitch = t_qua_gain6b[cbIndex*2];
+                TInt gain = t_qua_gain6b[cbIndex*2+1];
+                aGains.Append(pitch);
+                aGains.Append(gain);
+                }
+
+            break;
+            }
+        case 6600:
+            {
+            for (a = 0 ; a < 4 ; a++)
+                {
+                cbIndex = ProcTools::GetValueFromShuffledAWBFrameL(aFrame, bitrate, 
+                                                                KGainPositions[TAWBBitRate6600*4+a], 6);
+                TInt pitch = t_qua_gain6b[cbIndex*2];
+                TInt gain = t_qua_gain6b[cbIndex*2+1];
+                aGains.Append(pitch);
+                aGains.Append(gain);
+                }
+
+            break;
+            }
+
+        }
+    aMaxGain = 32767;
+    
+    return ETrue;
+
+
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/AWB/src/ProcAWBInFileHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,426 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "ProcAWBInFileHandler.h"
+#include "ProcAWBFrameHandler.h"
+
+#include "AudPanic.h"
+#include "AWBConstants.h"
+#include "ProcTools.h"
+
+
+CProcAWBInFileHandler* CProcAWBInFileHandler::NewL(const TDesC& aFileName,  
+                                                   RFile* aFileHandle,
+                                                   CAudClip* aClip, 
+                                                   TInt aReadBufferSize,
+                                                   TInt aTargetSampleRate, 
+                                                   TChannelMode aChannelMode) 
+    {
+
+    CProcAWBInFileHandler* self = NewLC(aFileName, aFileHandle, aClip, 
+                    aReadBufferSize, aTargetSampleRate, aChannelMode);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CProcAWBInFileHandler* CProcAWBInFileHandler::NewLC(const TDesC& aFileName, 
+                                                    RFile* aFileHandle,
+                                                    CAudClip* aClip, 
+                                                    TInt aReadBufferSize,
+                                                    TInt aTargetSampleRate, 
+                                                    TChannelMode aChannelMode) 
+    {
+    
+    CProcAWBInFileHandler* self = new (ELeave) CProcAWBInFileHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileName, aFileHandle, aClip, aReadBufferSize, 
+                    aTargetSampleRate, aChannelMode);
+    return self;
+    }
+
+CProcAWBInFileHandler::CProcAWBInFileHandler() : CProcInFileHandler() 
+    {
+    
+    
+    }
+
+void CProcAWBInFileHandler::GetPropertiesL(TAudFileProperties* aProperties) 
+    {
+
+    if (iProperties != 0)
+        {
+        *aProperties = *iProperties;
+        return;
+        }
+    
+    aProperties->iAudioTypeExtension = EAudExtensionTypeNoExtension;
+    
+    if (iFileOpen) 
+        {
+        aProperties->iFileFormat = EAudFormatAMRWB;
+        
+        TInt oldPos = iFilePos;
+
+        TInt fileSize = 0;
+        iFile.Size(fileSize);
+        
+        TBuf8<9> header;
+
+        BufferedFileRead(0, header);
+        if (header.Compare(_L8("#!AMR-WB\n")) == 0) 
+            {
+            aProperties->iAudioType = EAudAMRWB;
+            aProperties->iSamplingRate = 16000;
+            aProperties->iChannelMode = EAudSingleChannel;
+            aProperties->iBitrateMode = EAudVariable;
+            
+            TBuf8<1> modeByte;
+            BufferedFileRead(9, modeByte);
+
+            TUint8 toc = modeByte[0];
+            
+            TUint8 mode = static_cast<TUint8>((toc >> 3) & 0x0F);
+            
+            aProperties->iBitrate = KAWBBitRates[mode];
+            TInt durationMilli = 0;
+            TInt frameAmount = 0;
+            TInt frameDuration = 0;
+            TInt frameSize = 0;
+
+            GetFrameInfo(durationMilli, frameAmount, frameDuration, frameSize);
+
+            TInt64 tmp = (TInt64)(TInt)durationMilli*1000;
+            // milliseconds->microseconds
+            TTimeIntervalMicroSeconds durationMicro(tmp);
+            aProperties->iDuration = durationMicro;
+            aProperties->iFrameCount = frameAmount;
+            
+            tmp = (TInt64)(TInt)frameDuration*1000;
+            TTimeIntervalMicroSeconds frameDurationMicro(tmp);
+            
+            aProperties->iFrameDuration = frameDurationMicro;
+            aProperties->iFrameLen = frameSize;
+            
+            
+            }
+        BufferedFileSetFilePos(oldPos);
+        }
+    else 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    if (iProperties == 0)
+        {
+        iProperties = new (ELeave) TAudFileProperties;
+        *iProperties = *aProperties;
+        }
+    
+    
+    
+    
+    }
+
+TBool CProcAWBInFileHandler::SeekAudioFrame(TInt32 aTime) 
+    {
+    
+    if (!iFileOpen) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    TInt fileSize = 0;
+    iFile.Size(fileSize);
+
+
+    TInt firstModeByte = 9;
+    TInt readSize = 0;
+    TBuf8<1> modeByte;
+    iCurrentTimeMilliseconds = 0;
+
+    BufferedFileSetFilePos(firstModeByte);
+    
+    while(iCurrentTimeMilliseconds < aTime) 
+        {
+        
+        //iFile.Read(modeByte, 1);
+        BufferedFileRead(modeByte);
+        if (modeByte.Size() == 0) 
+            {
+            return EFalse;
+            }
+
+        TUint8 toc = modeByte[0];
+        TUint8 mode = static_cast<TUint8>((toc >> 3) & 0x0F);
+
+        readSize = KAWBPacked_size[mode];
+
+        if (!(BufferedFileSetFilePos(BufferedFileGetFilePos()+readSize))) 
+            {
+            
+            // EOF
+            return EFalse;
+            }
+        iCurrentTimeMilliseconds += 20;
+
+        }
+    return ETrue;
+
+    }    
+
+TBool CProcAWBInFileHandler::SeekCutInFrame() 
+    {
+
+    iCurrentTimeMilliseconds = iCutInTime;
+    return SeekAudioFrame(iCutInTime);
+    }
+    
+
+
+void CProcAWBInFileHandler::ConstructL(const TDesC& aFileName, 
+                                       RFile* aFileHandle,
+                                       CAudClip* aClip, 
+                                       TInt aReadBufferSize,
+                                       TInt aTargetSampleRate, 
+                                       TChannelMode aChannelMode) 
+    {
+    
+
+    iTargetSampleRate = aTargetSampleRate;
+    iChannelMode = aChannelMode;
+
+
+    InitAndOpenFileL(aFileName, aFileHandle, aReadBufferSize);
+    
+
+    iClip = aClip;
+
+    if (aClip != 0)
+        {
+        iCutInTime = ProcTools::MilliSeconds(aClip->CutInTime());
+        
+        }
+
+
+    TUint8 sf[18] = {0x04,0x10,0x20,0x00,0x21,
+    0x1C,0x14,0xD0,0x11,0x40,0x4C,0xC1,0xA0,
+    0x50,0x00,0x00,0x44,0x30};
+    iSilentFrame = HBufC8::NewL(18);
+    iSilentFrame->Des().Append(sf,18);
+    iSilentFrameDuration = 20;
+    
+    
+    if (iClip != 0 && iClip->Normalizing())
+        {
+        SetNormalizingGainL(iFrameHandler);    
+        }
+    
+    TAudFileProperties prop;
+    GetPropertiesL(&prop);
+    
+    iDecoder = CProcDecoder::NewL();
+    
+    iDecodingPossible = iDecoder->InitL(prop, aTargetSampleRate, aChannelMode);
+    
+    
+    iFrameHandler = CProcAWBFrameHandler::NewL();
+    
+    if (iClip != 0 && iClip->Normalizing())
+        {
+        SetNormalizingGainL(iFrameHandler);    
+        }
+    
+    }
+
+
+
+
+TBool CProcAWBInFileHandler::GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime)
+    {
+    if (!iFileOpen) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    aFrame = NULL;
+    TInt readSize = 0;
+    TBuf8<1> modeByte;
+
+    BufferedFileRead(modeByte);
+
+    if (modeByte.Size() == 0) 
+        {
+        return EFalse;
+        }
+
+    TUint8 toc = modeByte[0];
+    TUint8 mode = static_cast<TUint8>((toc >> 3) & 0x0F);
+
+    readSize = KAWBPacked_size[mode];
+
+
+    
+    HBufC8* audioFrame = HBufC8::NewL(readSize+1);
+
+    TPtr8 tmpDes((TPtr8)audioFrame->Des());
+    
+    BufferedFileRead((TPtr8&) tmpDes, readSize);
+    audioFrame->Des().Insert(0, modeByte);
+
+    aFrame = audioFrame;
+
+    TRAPD(err, ManipulateGainL(aFrame));
+    
+    if (err != KErrNone)
+        {
+        // something went wrong with the gain manipulation
+        // continue by returning the original frame
+        }
+    
+
+    aSize = aFrame->Size();
+    aTime = 20;
+    iCurrentTimeMilliseconds += 20;
+    
+
+    return ETrue;
+    }
+
+
+
+CProcAWBInFileHandler::~CProcAWBInFileHandler() 
+    {
+
+    if (iSilentFrame != 0) delete iSilentFrame;
+    ResetAndCloseFile();
+
+
+    delete iDecoder;
+    delete iFrameHandler;
+    
+    }
+
+
+TBool CProcAWBInFileHandler::GetFrameInfo(TInt& aSongDuration,
+                                           TInt& aFrameAmount, 
+                                           TInt& aAverageFrameDuration, 
+                                           TInt& aAverageFrameSize) 
+    {
+
+
+        
+
+    if (!iFileOpen) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    TInt fileSize = 0;
+    iFile.Size(fileSize);
+
+
+    TInt firstModeByte = 9;
+    TInt frameIndex = 1;
+    TInt readSize = 0;
+    TBuf8<1> modeByte;
+
+    TInt32 frameSizeSum = 0;
+    
+    TInt filePos = iFilePos;
+
+    BufferedFileSetFilePos(firstModeByte);
+    
+    while(frameIndex < 180000) // 1 hour 
+        {
+        
+
+        BufferedFileRead(modeByte);
+        if (modeByte.Size() == 0) 
+            {
+            break;
+            }
+
+        TUint8 toc = modeByte[0];
+        TUint8 mode = static_cast<TUint8>((toc >> 3) & 0x0F);
+
+        readSize = KAWBPacked_size[mode];
+
+        frameSizeSum += readSize;
+        aSongDuration += 20;
+
+        if (!(BufferedFileSetFilePos(BufferedFileGetFilePos()+readSize))) 
+            {
+            
+            break; // EOF
+            }
+        
+        frameIndex++;
+        }
+
+    aAverageFrameSize = frameSizeSum/frameIndex;
+    aFrameAmount = frameIndex;
+    aAverageFrameDuration = aSongDuration/aFrameAmount;
+    BufferedFileSetFilePos(filePos);
+    return ETrue;
+
+
+    }
+
+
+TBool CProcAWBInFileHandler::SetNormalizingGainL(const CProcFrameHandler* aFrameHandler)
+    {
+
+    HBufC8* point = 0;
+    TInt siz;
+    TInt32 tim = 0;
+    TInt8 margin = 0;
+    TInt minMargin = KMaxTInt;
+    TInt tmpGain = 0;
+    TInt frameCounter = 0;
+    while(GetEncAudioFrameL(point, siz, tim)) 
+                    
+        {
+        aFrameHandler->GetNormalizingMargin(point, margin);
+        tmpGain += margin;
+                    
+        delete point;
+        point = 0;
+        frameCounter++;
+        if (frameCounter > 1) 
+            {
+            tmpGain = tmpGain/3;
+                        
+            if (tmpGain < minMargin) 
+                {
+                minMargin = tmpGain;
+                }
+                
+            frameCounter = 0;
+            tmpGain = 0;
+            }
+        }
+
+    iNormalizingMargin = static_cast<TInt8>(minMargin);
+
+    return ETrue;
+
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/MP4/inc/ProcMP4InFileHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,198 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __CPROCMP4INFILEHANDLER_H__
+#define __CPROCMP4INFILEHANDLER_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include "mp4lib.h"
+
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "ProcInFileHandler.h"
+//#include "mp4aud.h"
+#include "AACConstants.h"
+
+#include "ProcDecoder.h"
+
+
+class CMP4Parser;
+
+class CProcMP4InFileHandler: public CProcInFileHandler 
+    {
+
+public:
+
+    /*
+    *
+    * Constructors & destructor
+    * 
+    */
+
+    static CProcMP4InFileHandler* NewL(const TDesC& aFileName, RFile* aFileHandle,
+                                        CAudClip* aClip, TInt aReadBufferSize,
+                                            TInt aTargetSampleRate = 0, 
+                                            TChannelMode aChannelMode = EAudSingleChannel);
+                                            
+    static CProcMP4InFileHandler* NewLC(const TDesC& aFileName,  RFile* aFileHandle,
+                                        CAudClip* aClip, TInt aReadBufferSize,
+                                            TInt aTargetSampleRate = 0, 
+                                            TChannelMode aChannelMode = EAudSingleChannel);
+    virtual ~CProcMP4InFileHandler();
+
+    // From base class --------->
+
+    void GetPropertiesL(TAudFileProperties* aProperties);
+    
+    /**
+    * Seeks a certain audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    * @param aTime            time from the beginning of file in milliseconds
+    *
+    * @return    ETrue if successful
+    *            EFalse if beyond the file
+    */
+    TBool SeekAudioFrame(TInt32 aTime);
+
+    
+    /**
+    * Seeks a cut in audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    *
+    * @return    ETrue if successful
+    *                
+    */
+    TBool SeekCutInFrame();
+
+    virtual TBool SetNormalizingGainL(const CProcFrameHandler* aFrameHandler);
+
+    // <-------------------------------------- from base class
+
+    /*
+    *
+    * Used to retrieve information for frame handler
+    *
+    * @param    aBytes (output) decoder specific info
+    * @param     aBufferSize        maximum allowed aBytes
+    *
+    * @return    ETrue     if successful (memory reserved)
+    *            EFalse    if not successful (no memory reserved)
+    *
+    * NOTE: The caller is responsible for releasing the memory!
+    */
+    virtual TBool ReadAudioDecoderSpecificInfoL(HBufC8*& aBytes, TInt aBufferSize);
+    
+    /*
+    * Reads the time scale of the MP4 file
+    *
+    * @param    aTimescale    timescale
+    *
+    */
+    virtual TBool ReadTimeScale(mp4_u32& aTimescale);
+
+    /*
+    * Reads the audio description of the MP4 file
+    *
+    * @param    aAudiolength            length of the clip
+    * @param    aAudiotype                type of the clip
+    * @param    aFramespersample        number of frames in sample
+    * @param    aTimescale                timescale
+    * @param    aAveragebitrate            average bitrate
+    * 
+    */
+    MP4Err ParseRequestAudioDescription(mp4_u32 *aAudiolength,
+                                           mp4_u32 *aAudiotype,
+                                           mp4_u8 *aFramespersample,
+                                           mp4_u32 *aTimescale,
+                                           mp4_u32 *aAveragebitrate);
+
+    /*
+    *
+    * Returns AAC info
+    * @param    aAACInfo    AAC info
+    *
+    */
+    TBool GetInfoForFrameHandler(TAACFrameHandlerInfo& aAACInfo);
+
+    
+
+
+    
+
+private:
+
+    // constructL
+    void ConstructL(const TDesC& aFileName,  RFile* aFileHandle, CAudClip* aClip, 
+                    TInt aReadBufferSize, TInt aTargetSampleRate = 0, 
+                    TChannelMode aChannelMode = EAudSingleChannel);
+    
+    // c++ construtor
+    CProcMP4InFileHandler();
+
+    // gets audio frame info
+    TBool GetAudioFrameInfoL(TInt& aFrameAmount, TInt& aAverageFrameDuration, TInt& aAverageFrameSize,
+                            TAudFileProperties* aProperties);
+
+    TBool GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime);
+    
+    /*
+    * Reads one amr frame from iReadBuffer and updates iReadBufferPos
+    *
+    * @param aOneAMRFrame        amr frame in return
+    *
+    * @return                     ETrue if successful, the caller must release the memory
+    *                            EFalse if frame can not be read, no need to release memory
+    */
+    TBool ReadOneAMRFrameL(HBufC8*& aOneAMRFrame);
+    
+    TBool ReadOneAWBFrameL(HBufC8*& aOneAWBFrame);
+    
+private:
+
+    // Handle to MP4Lib
+    MP4Handle iParser;
+    
+    // timestamp of a previous frame
+    TInt32 iLastTimeStamp;
+
+    // information for frame handler
+    TAACFrameHandlerInfo* iFrameInfo;
+
+    // read buffer
+    mp4_u8 *iMP4ReadBuffer;
+    // read buffer size
+    TInt iMP4ReadBufferSize;
+    // position of the read buffer
+    TInt iMP4ReadBufferPos;
+    
+
+
+
+protected:
+    
+    
+    
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/MP4/inc/mp4aud.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  mp4aud.h - MPEG-4 Audio structures and interface methods.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 2001-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef MP4AUD_H_
+#define MP4AUD_H_
+
+/*-- Project Headers. --*/
+#include "nok_bits.h"
+#include "chandefs.h"
+
+/*-- Raw bitstream constants. --*/
+//#define LEN_PC_COMM       (8)
+
+/*-- Program configuration element --*/
+/*
+#define LEN_BYTE          (8)
+#define LEN_TAG           (4)
+#define LEN_PROFILE       (2) 
+#define LEN_SAMP_IDX      (4) 
+#define LEN_NUM_ELE       (4) 
+#define LEN_NUM_LFE       (2) 
+#define LEN_NUM_DAT       (3) 
+#define LEN_NUM_CCE       (4) 
+#define LEN_MMIX_IDX      (2) 
+#define LEN_PSUR_ENAB     (1) 
+#define LEN_ELE_IS_CPE    (1)
+#define LEN_IND_SW_CCE    (1)  
+#define LEN_COMMENT_BYTES (8)
+*/
+/*
+   Purpose:     MPEG-4 Audio object types.
+   Explanation: - */
+typedef enum AudioObjectType
+{
+  NULL_OBJECT = -1,
+  AAC_MAIN,
+  AAC_LC,
+  AAC_SSR,
+  AAC_LTP,
+  AAC_SBR,
+  AAC_SCALABLE,
+  TWINVQ,
+  CELP,
+  HVXC,
+  RESERVED10,
+  RESERVED11,
+  TTSI = 11,
+  MAIN_SYNTHETIC,
+  WAVETABLE_SYNTHESIS,
+  GENERAL_MIDI,
+  AUDIO_FX,
+  ER_AAC_LC, 
+  RESERVED18, 
+  ER_AAC_LTP, 
+  ER_AAC_SCALABLE, 
+  ER_TWINVQ,
+  ER_BSAC, 
+  ER_AAC_LD, 
+  ER_CELP, 
+  ER_HVXC, 
+  ER_HILN,
+  ER_PARAMETRIC, 
+  RESERVED28, 
+  RESERVED29, 
+  RESERVED30, 
+  RESERVED31
+
+} AudioObjectType;
+
+/*
+   Purpose:     Configuration information for MPEG-4 GA coder.
+   Explanation: - */
+typedef struct GaSpecificInfoStr
+{
+  /*-- Common to all object types. --*/
+  BOOL FrameLengthFlag;
+  BOOL DependsOnCoreCoder;
+  int16 CoreCoderDelay;
+
+  /*-- AAC Scalable parameters. --*/
+  uint8 layerNr;
+
+  /*-- ER BSAC parameters. --*/
+  uint8 numOfSubframe;
+  int16 layer_length;
+
+  /*-- ER object specific data. --*/
+  BOOL aacSectionDataResilienceFlag;
+  BOOL aacScalefactorDataResilienceFlag;
+  BOOL aacSpectralDataResilienceFlag;
+  
+  /*-- Future extension flag. --*/
+  BOOL extensionFlag3;
+
+} GaSpecificInfo;
+
+/*
+   Purpose:     Configuration information for MPEG-4 audio coder.
+   Explanation: - */
+typedef struct AudioSpecificInfoStr
+{
+  AudioObjectType audioObject; /* Object type.                            */
+  uint8 samplingFreqIdx;       /* Index to sampling frequency table.      */
+  int32 samplingFrequency;     /* Sampling frequency if not in the table. */
+  uint8 channelConfiguration;  /* Index to channel configuration table.   */
+  GaSpecificInfo gaInfo;       /* Config information for GA coder.        */
+
+  AudioObjectType extAudioObject;
+  int16 syncExtensionType;
+  int32 extSamplingFrequency;
+  uint8 extSamplingFreqIdx;
+  uint8 sbrPresentFlag;
+
+} AudioSpecificInfo;
+
+/*
+   Purpose:     Information about the audio channel.
+   Explanation: - */
+typedef struct 
+{
+  int16 num_ele;
+  int16 ele_is_cpe[1 << LEN_TAG];
+  int16 ele_tag[1 << LEN_TAG];
+
+} EleList;
+
+/*
+   Purpose:     Mixing information for downmixing multichannel input
+                into two-channel output.
+   Explanation: - */
+typedef struct 
+{
+  int16 present;
+  int16 ele_tag;
+  int16 pseudo_enab;
+
+} MIXdown;
+
+/*
+   Purpose:     Program configuration element.
+   Explanation: - */
+typedef struct 
+{
+  int16 tag;
+  int16 profile;
+  int16 sample_rate_idx;
+
+  BOOL pce_present;
+
+  EleList front;
+  EleList side;
+  EleList back;
+  EleList lfe;
+  EleList data;
+  EleList coupling;
+
+  MIXdown mono_mix;
+  MIXdown stereo_mix;
+  MIXdown matrix_mix;
+
+  int16 num_comment_bytes;
+  char comments[(1 << LEN_PC_COMM) + 1];
+
+} ProgConfig;
+
+/*
+   Purpose:     MPEG-4 AAC transport handle.
+   Explanation: - */
+typedef struct mp4AACTransportHandleStr
+{
+  ProgConfig progCfg;
+  AudioSpecificInfo audioInfo;
+
+} mp4AACTransportHandle;
+
+
+/*-- Access methods. --*/
+
+BOOL
+ReadMP4AudioConfig(uint8 *buffer, uint32 bufLen, mp4AACTransportHandle *mp4AAC_ff);
+
+void
+WriteMP4AudioConfig(uint8 *buffer, uint32 bufLen, mp4AACTransportHandle *mp4AAC_ff);
+
+#endif /*-- MP4AUD_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/MP4/src/ProcMP4InFileHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1365 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+ 
+#include <e32base.h>
+#include <f32file.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "AWBConstants.h"
+#include "ProcMP4InFileHandler.h"
+#include "mp4aud.h"
+#include "ProcAACFrameHandler.h"
+#include "ProcAMRFrameHandler.h"
+#include "ProcAWBFrameHandler.h"
+#include "audconstants.h"
+
+
+
+#include "ProcTools.h"
+//#include "aacenc_interface.h"
+
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+// Max coded AAC frame size (768 bytes per channel)
+const TUint KMaxAACFrameSize(1536);
+
+
+CProcMP4InFileHandler* CProcMP4InFileHandler::NewL(const TDesC& aFileName, 
+                                                   RFile* aFileHandle,
+                                                   CAudClip* aClip, TInt aReadBufferSize,
+                                                   TInt aTargetSampleRate, 
+                                                   TChannelMode aChannelMode)
+    {
+
+    CProcMP4InFileHandler* self = NewLC(aFileName, aFileHandle, aClip, aReadBufferSize, 
+                                        aTargetSampleRate, aChannelMode);
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+    
+CProcMP4InFileHandler* CProcMP4InFileHandler::NewLC(const TDesC& aFileName, 
+                                                    RFile* aFileHandle,
+                                                    CAudClip* aClip, TInt aReadBufferSize,
+                                                    TInt aTargetSampleRate, 
+                                                    TChannelMode aChannelMode)
+
+    {
+
+    CProcMP4InFileHandler* self = new (ELeave) CProcMP4InFileHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileName, aFileHandle, aClip, aReadBufferSize,
+                        aTargetSampleRate, aChannelMode);
+    return self;
+
+    }
+
+void CProcMP4InFileHandler::GetPropertiesL(TAudFileProperties* aProperties)
+    {
+    PRINT((_L("CProcMP4InFileHandler::GetPropertiesL in") ));
+    if (iProperties != 0)
+    {
+        *aProperties = *iProperties;
+        PRINT((_L("CProcMP4InFileHandler::GetPropertiesL use cached properties, out") ));
+        return;
+    }
+    
+    if (iProperties == 0)
+    {
+        iProperties = new (ELeave) TAudFileProperties;
+    }
+    
+    mp4_u32 audiolength = 0; 
+    mp4_u32 audiotype = 0; 
+    mp4_u8 framespersample = 0; 
+    mp4_u32 timescale = 0; 
+    mp4_u32 averagebitrate = 0;
+    
+    aProperties->iFileFormat = EAudFormatUnrecognized;
+    aProperties->iAudioType = EAudTypeUnrecognized;
+    aProperties->iDuration = 0;
+    aProperties->iSamplingRate = 0;
+    aProperties->iBitrate = 0;
+    aProperties->iChannelMode = EAudChannelModeNotRecognized;
+    aProperties->iBitrateMode = EAudBitrateModeNotRecognized;
+    aProperties->iAudioTypeExtension = EAudExtensionTypeNoExtension;
+    aProperties->iFrameLen = 0;
+    aProperties->iFrameDuration = 0;
+    aProperties->iFrameCount = 0;
+    aProperties->iNumFramesPerSample = 1;
+    aProperties->iAACObjectType = EAudAACObjectTypeNone;
+    
+    MP4Err err = MP4ParseRequestAudioDescription(iParser, 
+        &audiolength, 
+        &audiotype, 
+        &framespersample, 
+        &timescale, 
+        &averagebitrate);
+    
+    
+    if (err == MP4_OK)
+        {
+        if (audiotype == MP4_TYPE_MPEG4_AUDIO)
+            {
+
+            aProperties->iAudioType = EAudAAC_MPEG4;
+            aProperties->iBitrateMode = EAudVariable;
+            
+            }
+        else if (audiotype == MP4_TYPE_AMR_NB)
+            {
+            aProperties->iAudioType = EAudAMR;
+            aProperties->iBitrateMode = EAudVariable;
+            
+            }
+        else if (audiotype == MP4_TYPE_AMR_WB)
+            {
+            aProperties->iAudioType = EAudAMRWB;
+            aProperties->iBitrateMode = EAudVariable;
+
+            }
+        aProperties->iBitrate = averagebitrate;
+        
+        // casting for PC-Lint
+        TInt64 ti = (TInt64)(TInt)(audiolength*1000);
+        TTimeIntervalMicroSeconds TTaudiolength(ti);
+        
+        aProperties->iDuration = TTaudiolength;
+        aProperties->iFileFormat = EAudFormatMP4;
+        //aProperties->iFrameLen = framespersample;
+        
+        
+        }
+    else if (err == MP4_NO_AUDIO)
+        {
+        aProperties->iAudioType = EAudNoAudio;
+        *iProperties = *aProperties;
+        return; 
+
+        //User::Leave(KErrGeneral);
+        }
+    else
+        {
+        // a special case: there may be audio track but it is empty; if type was recognized, mark as no audio
+        if ( (audiotype == MP4_TYPE_MPEG4_AUDIO) || (audiotype == MP4_TYPE_AMR_NB) || (audiotype == MP4_TYPE_AMR_WB))
+            {
+            PRINT((_L("CProcMP4InFileHandler::GetPropertiesL problems with getting audio description, mark no audio since audio type was recognized")));
+            aProperties->iAudioType = EAudNoAudio;
+            *iProperties = *aProperties;
+            }
+        PRINT((_L("CProcMP4InFileHandler::GetPropertiesL out with MP4Err %d"), err ));
+        return;
+
+        }
+    
+    const TInt KMaxBufferSize = 128;
+    
+    mp4_u8 *buffer = new (ELeave) mp4_u8[KMaxBufferSize];
+    CleanupStack::PushL(buffer);
+    
+    mp4_u32 decspecinfosize = 0;
+    
+    err = MP4ParseReadAudioDecoderSpecificInfo(
+        iParser, 
+        buffer, 
+        KMaxBufferSize, 
+        &decspecinfosize);
+    
+    
+    mp4AACTransportHandle mp4AAC_ff;
+    
+    if (err == MP4_OK && aProperties->iAudioType == EAudAAC_MPEG4)
+        {
+        
+        PRINT((_L("CProcMP4InFileHandler::GetPropertiesL AAC found") ));
+        
+        TInt ret = ReadMP4AudioConfig(buffer, 
+            decspecinfosize, 
+            &mp4AAC_ff);
+        if (ret != TRUE)
+            {
+            aProperties->iFileFormat = EAudFormatUnrecognized;
+            aProperties->iAudioType = EAudTypeUnrecognized;
+            User::Leave(KErrNotSupported);
+            }
+        
+        //        ProgConfig progCfg = mp4AAC_ff.progCfg;
+        AudioSpecificInfo audioInfo = mp4AAC_ff.audioInfo;
+        aProperties->iSamplingRate = audioInfo.samplingFrequency;
+        //        TInt tmp = mp4AAC_ff.progCfg.coupling.num_ele;
+        
+        // Check that the sample rate is supported    
+        if( (aProperties->iSamplingRate != KAedSampleRate8kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate11kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate16kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate22kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate24kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate32kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate44kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate48kHz) )
+            {
+            User::Leave(KErrNotSupported);
+            }
+        
+        if (audioInfo.channelConfiguration == 2)
+            {
+            aProperties->iChannelMode = EAudStereo;
+            }
+        else if (audioInfo.channelConfiguration == 1)
+            {
+            
+            aProperties->iChannelMode = EAudSingleChannel;
+            }
+        else
+            {
+            aProperties->iChannelMode = EAudChannelModeNotRecognized; 
+            }
+        
+        if (mp4AAC_ff.audioInfo.samplingFreqIdx !=
+            mp4AAC_ff.progCfg.sample_rate_idx)
+            {
+            aProperties->iFileFormat = EAudFormatUnrecognized;
+            aProperties->iAudioType = EAudTypeUnrecognized;
+            aProperties->iDuration = 0;
+            aProperties->iSamplingRate = 0;
+            aProperties->iBitrate = 0;
+            aProperties->iChannelMode = EAudChannelModeNotRecognized;
+            aProperties->iBitrateMode = EAudBitrateModeNotRecognized;
+            aProperties->iFrameLen = 0;
+            aProperties->iFrameDuration = 0;
+            aProperties->iFrameCount = 0;
+            aProperties->iNumFramesPerSample = 1;
+            CleanupStack::PopAndDestroy(buffer);
+            PRINT((_L("CProcMP4InFileHandler::GetPropertiesL audio not recognized, out") ));
+            User::Leave(KErrNotSupported);
+            return;
+            }
+        
+
+        
+        iFrameInfo->iSampleRateID = static_cast<TUint8>(mp4AAC_ff.progCfg.sample_rate_idx);
+        iFrameInfo->iSampleRateID = static_cast<TUint8>(mp4AAC_ff.audioInfo.samplingFreqIdx);
+        
+
+        iFrameInfo->iProfileID = static_cast<TUint8>(mp4AAC_ff.progCfg.profile);
+        
+        aProperties->iAACObjectType = TAudAACObjectType(iFrameInfo->iProfileID);    
+        
+        if (aProperties->iChannelMode == EAudStereo)
+            {
+            iFrameInfo->iNumChannels = 2;
+            }
+        else if (aProperties->iChannelMode == EAudSingleChannel)
+            {
+            iFrameInfo->iNumChannels = 1;
+            }
+        else
+            {
+            iFrameInfo->iNumChannels = 0;
+            }
+        
+        
+        iFrameInfo->iIs960 = mp4AAC_ff.audioInfo.gaInfo.FrameLengthFlag;
+        
+        iFrameInfo->iNumCouplingChannels = 0;
+        
+        iFrameInfo->isSBR = 0;
+        iFrameInfo->iIsParametricStereo = 0;
+        
+        /*
+        * Get frame parameters for eAAC+ codec. It is possible that the bitstream
+        * is plain AAC but we don't know it before the 1st frame is parsed!
+        */
+
+        HBufC8* frame = 0;
+        TInt size = 0;
+        
+        TInt32 time = 0;
+        
+        // Set the iProperties as GetEncAudioFrameL is using it!! 
+        *iProperties = *aProperties;
+        if(GetEncAudioFrameL(frame, size, time))
+            {
+            PRINT((_L("CProcMP4InFileHandler::GetPropertiesL check AAC+ parameters") ));
+
+            TUint8* buf = const_cast<TUint8*>(frame->Right(frame->Size()).Ptr());
+            CProcAACFrameHandler::GetEnhancedAACPlusParametersL(buf, frame->Size(), aProperties, iFrameInfo);
+            delete frame;
+            frame = 0;
+          }
+        
+    }
+    else if (err == MP4_OK && aProperties->iAudioType == EAudAMR)
+        {
+        aProperties->iChannelMode = EAudSingleChannel;
+        aProperties->iSamplingRate = 8000;
+        
+        }
+    else if (err == MP4_OK && aProperties->iAudioType == EAudAMRWB)
+        {
+        aProperties->iChannelMode = EAudSingleChannel;
+        aProperties->iSamplingRate = 16000;
+        
+        }
+
+    TInt frameAmount = 0;
+    TInt frameSize = 0;
+    TInt frameDuration = 0;
+    
+    
+    TInt rv = ETrue;
+    
+    *iProperties = *aProperties;
+    rv = GetAudioFrameInfoL(frameAmount, frameDuration, frameSize, aProperties);
+    
+    if (rv)
+        {
+        aProperties->iFrameCount = frameAmount;
+        aProperties->iFrameLen = frameSize;
+        
+        // casting for PC-Lint
+        TInt64 durMicro = (TInt64) (TInt) frameDuration*1000;
+        aProperties->iFrameDuration = durMicro;
+        
+        }    
+    
+    
+    
+    
+    
+    *iProperties = *aProperties;
+    
+    
+    CleanupStack::PopAndDestroy(buffer);
+    
+    PRINT((_L("CProcMP4InFileHandler::GetPropertiesL out") ));
+    }
+
+
+TBool CProcMP4InFileHandler::SeekAudioFrame(TInt32 aTime)
+    {
+
+    mp4_u32 position = static_cast<TUint32>(aTime);
+    mp4_u32 audioPosition = 0;
+
+    mp4_u32 videoPosition = 0;
+    mp4_bool keyframe = EFalse;
+
+    if (iMP4ReadBuffer != 0)
+        {
+        delete[] iMP4ReadBuffer;
+        iMP4ReadBuffer = 0;
+        iMP4ReadBufferPos = 0;
+        iMP4ReadBufferSize = 0;    
+        }
+
+    MP4Err err = MP4ParseSeek(iParser,
+                        position,
+                        &audioPosition,
+                        &videoPosition,
+                        keyframe);
+
+    if (err == MP4_OK)
+        {
+        
+        iCurrentTimeMilliseconds = audioPosition;
+        iLastTimeStamp = audioPosition - I64INT(iProperties->iFrameDuration.Int64()/1000);
+        aTime = audioPosition;
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+TBool CProcMP4InFileHandler::SeekCutInFrame()
+    {
+
+    iCurrentTimeMilliseconds = iCutInTime;
+    return SeekAudioFrame(iCutInTime);
+    }
+
+
+
+TBool CProcMP4InFileHandler::SetNormalizingGainL(const CProcFrameHandler* aFrameHandler)
+{
+    
+    
+    if (iProperties->iAudioType == EAudAAC_MPEG4)
+    {
+        
+        HBufC8* point = 0;
+        TInt siz;
+        TInt32 tim = 0;
+        TInt maxGain = 0;
+        RArray<TInt> gains;
+        TInt maxAverage = 0;
+        TInt tmpGain = 0;
+        TInt gainCounter = 0;
+        TInt timeNow = 0;
+        while(GetEncAudioFrameL(point, siz, tim)) 
+        {
+            
+            aFrameHandler->GetGainL(point, gains, maxGain);
+            timeNow += tim;
+            
+            for (TInt a = 0 ; a < gains.Count() ; a++)
+            {
+                tmpGain += gains[a];
+                gainCounter++;
+            }
+            gains.Reset();
+            
+            if (timeNow > 1000)
+            {
+                if (tmpGain/gainCounter > maxAverage)
+                {
+                    maxAverage = tmpGain/gainCounter;
+                }
+                
+                timeNow = 0;
+                tmpGain = 0;
+                gainCounter = 0;
+            }
+            
+            delete point;
+            
+        }
+        
+        // bigger value makes normalizing more efficient, but makes
+        // dynamic compression more likely to occur
+        TInt NormalizingFactor = 175;
+        if (iProperties->iBitrate > 20000 && iProperties->iBitrate < 40000)
+        {
+            
+            // 32 kBit/s
+            NormalizingFactor = 170;
+            
+        }
+        else if (iProperties->iBitrate > 80000 && iProperties->iBitrate < 110000)
+        {
+            // 96 kBit/s
+            NormalizingFactor = 170;
+            
+        }
+        
+        
+        else if (iProperties->iBitrate > 110000 && iProperties->iBitrate < 140000)
+        {
+            // 128 kBit/s
+            if (iProperties->iChannelMode == EAudSingleChannel)
+                NormalizingFactor = 160;
+            else
+                NormalizingFactor = 170;
+            
+        }
+        else if (iProperties->iBitrate > 150000)
+        {
+            // 256 kBit/s
+            if (iProperties->iChannelMode == EAudSingleChannel)
+                NormalizingFactor = 150;
+            else
+                NormalizingFactor = 165;
+            
+        }
+        else
+        {
+            
+            if (iProperties->iChannelMode == EAudSingleChannel)
+                NormalizingFactor = 170;
+            
+        }
+        
+        
+        TInt gainBoost = (NormalizingFactor-maxAverage)*3;
+        
+        if (gainBoost < 0) gainBoost = 0;
+        
+        iNormalizingMargin = static_cast<TInt8>(gainBoost);
+        
+        
+    }
+    
+    else if (iProperties->iAudioType == EAudAMR)
+        {
+        HBufC8* point = 0;
+        TInt siz;
+        TInt32 tim = 0;
+        TInt8 margin = 0;
+        TInt minMargin = KMaxTInt;
+        TInt tmpGain = 0;
+        TInt frameCounter = 0;
+        while(GetEncAudioFrameL(point, siz, tim)) 
+                    
+            {
+            aFrameHandler->GetNormalizingMargin(point, margin);
+            tmpGain += margin;
+                    
+            delete point;
+            point = 0;
+            frameCounter++;
+            if (frameCounter > 1) 
+                {
+                tmpGain = tmpGain/3;
+                        
+                if (tmpGain < minMargin) 
+                    {
+                    minMargin = tmpGain;
+                    }
+                
+                frameCounter = 0;
+                tmpGain = 0;
+                }
+            }
+
+        iNormalizingMargin = static_cast<TInt8>(minMargin);
+        }
+    return ETrue;
+    
+}
+
+TBool CProcMP4InFileHandler::ReadAudioDecoderSpecificInfoL(HBufC8*& aBytes, TInt aBufferSize)
+    {
+
+    
+    aBytes = HBufC8::NewL(aBufferSize);
+
+    CleanupStack::PushL(aBytes);
+
+    mp4_u8 *buffer = new (ELeave) mp4_u8[aBufferSize];
+    mp4_u32 decspecinfosize = 0;
+
+    MP4Err err = MP4ParseReadAudioDecoderSpecificInfo(
+        iParser,
+        buffer,
+        aBufferSize,
+        &decspecinfosize);
+
+    if (err == MP4_OK)
+        {
+
+        for (TUint a = 0 ; a < decspecinfosize ; a++)
+            {
+            aBytes->Des().Append(buffer[a]);
+            }
+        }
+    else
+        {
+        delete[] buffer;
+        buffer = 0;
+        CleanupStack::PopAndDestroy(aBytes);
+        aBytes = 0;
+        return EFalse;;
+        }
+    
+    delete[] buffer;
+    buffer = 0;
+        
+    CleanupStack::Pop(aBytes);
+    return ETrue;
+
+
+    }
+
+
+CProcMP4InFileHandler::~CProcMP4InFileHandler()
+    {
+    if (iFileOpen)
+        {
+        MP4ParseClose(iParser);
+        }
+    if (iSilentFrame != 0)
+        {
+        delete iSilentFrame;
+        }
+
+    if (iFrameInfo != 0)
+        {
+        delete iFrameInfo;
+        iFrameInfo = 0;
+        }
+        
+    if (iMP4ReadBuffer != 0)
+        {
+        delete[] iMP4ReadBuffer;
+        }
+        
+    delete iDecoder;
+    
+    delete iFrameHandler;
+    
+    }
+
+
+void CProcMP4InFileHandler::ConstructL(const TDesC& aFileName, 
+                                       RFile* aFileHandle,
+                                       CAudClip* aClip, 
+                                       TInt /*aReadBufferSize*/,
+                                       TInt aTargetSampleRate, 
+                                       TChannelMode aChannelMode)
+    {
+    //InitAndOpenFileL(aFileName, aCutInTime, aReadBufferSize);
+
+    iFrameInfo = new (ELeave) TAACFrameHandlerInfo;
+    
+    
+    // init a raw silent frame
+    // in other in file handlers it is created in CProcInFileHandler
+        
+    const TInt KBitsPerSample = 16;
+    
+    TInt samplesIn20ms = ((iTargetSampleRate) * 
+        (KBitsPerSample)/8)/50;
+    
+    if (iChannelMode == EAudStereo)
+        {
+        samplesIn20ms *= 2;
+
+        }
+    if (samplesIn20ms % 2 != 0) samplesIn20ms--;
+    
+    iRawSilentFrame = HBufC8::NewL(samplesIn20ms);
+    
+    iRawSilentFrame->Des().SetLength(samplesIn20ms);
+    iRawSilentFrame->Des().Fill(0);
+        
+    iRawSilentFrameDuration = 20;    
+        
+    
+    iClip = aClip;
+    
+    iTargetSampleRate = aTargetSampleRate;
+    iChannelMode = aChannelMode;
+
+    if (iParser == 0)
+        {   
+         
+        MP4Err err;
+        if (aFileHandle)
+        {
+            err = MP4ParseOpenFileHandle(&iParser, aFileHandle); 
+        }         
+        else
+        {                    
+            TBuf<258> temp(aFileName);
+            temp.ZeroTerminate();
+            MP4FileName name = (MP4FileName)(temp.Ptr());        
+            err = MP4ParseOpen(&iParser , name);
+        }
+
+        if (err == MP4_FILE_ERROR)
+            {
+            User::Leave(KErrNotFound);
+            }
+        else if (err != MP4_OK)
+            {
+            User::Leave(KErrGeneral);
+            }
+        iFileOpen = ETrue;
+
+        }
+
+    TAudFileProperties prop;
+    GetPropertiesL(&prop);
+    
+    if (prop.iAudioType == EAudAAC_MPEG4)
+        {
+        // generate a silent frame ------------------>
+        
+        if (iProperties->iChannelMode == EAudSingleChannel)
+            {
+
+            iSilentFrame = HBufC8::NewL(KSilentMonoAACFrameLenght);    
+            iSilentFrame->Des().Append(KSilentMonoAACFrame, KSilentMonoAACFrameLenght);
+
+            }
+        else if (iProperties->iChannelMode == EAudStereo)
+            {
+
+            iSilentFrame = HBufC8::NewL(KSilentStereoAACFrameLenght);    
+            iSilentFrame->Des().Append(KSilentStereoAACFrame, KSilentStereoAACFrameLenght);
+
+
+            }
+        else
+            {
+            User::Leave(KErrNotSupported);
+            }
+        
+
+        mp4_u32 frameDurationMilli = ProcTools::MilliSeconds(iProperties->iFrameDuration);
+        
+        
+        iSilentFrameDuration = frameDurationMilli;
+        
+
+        
+        // <------------------generate a silent frame
+        
+        iFrameHandler = CProcAACFrameHandler::NewL(*iFrameInfo);
+                
+        }
+    else if (prop.iAudioType == EAudAMR)
+        {
+        const TInt KSilentFrameSize = 13;
+
+        TUint8 silentFrame[KSilentFrameSize]=
+            {
+            0x04,0x63,0x3C,0xC7,0xF0,0x03,0x04,0x39,0xFF,0xE0,
+            0x00,0x00,0x00
+            };
+        
+
+        iSilentFrame = HBufC8::NewL(KSilentFrameSize);
+        iSilentFrame->Des().Append(silentFrame, KSilentFrameSize); 
+        iSilentFrameDuration = 20;
+
+        
+        iFrameHandler = CProcAMRFrameHandler::NewL();
+        
+        }
+    else if (prop.iAudioType == EAudAMRWB)
+        {
+        TUint8 sf[18] = {0x04,0x10,0x20,0x00,0x21,
+            0x1C,0x14,0xD0,0x11,0x40,0x4C,0xC1,0xA0,
+            0x50,0x00,0x00,0x44,0x30};
+        iSilentFrame = HBufC8::NewL(18);
+        iSilentFrame->Des().Append(sf,18);
+        iSilentFrameDuration = 20;
+        
+        iFrameHandler = CProcAWBFrameHandler::NewL();
+
+        }
+    else if (prop.iAudioType == EAudNoAudio )
+        {
+        iDecodingPossible = EFalse;
+        return;
+        }
+    
+    if (aClip != 0)
+        {
+        iCutInTime = ProcTools::MilliSeconds(aClip->CutInTime());
+        
+        }
+    
+    iDecoder = CProcDecoder::NewL();
+    
+    iDecodingPossible = iDecoder->InitL(*iProperties, aTargetSampleRate, aChannelMode);
+    
+    if (iClip != 0 && iClip->Normalizing())
+        {
+        SetNormalizingGainL(iFrameHandler);    
+        }
+
+
+    }
+
+CProcMP4InFileHandler::CProcMP4InFileHandler()  : CProcInFileHandler(), iParser(0), 
+                                                  iLastTimeStamp(0), iFrameInfo(0)
+    {
+    
+    }
+
+TBool CProcMP4InFileHandler::GetAudioFrameInfoL(TInt& aFrameAmount, 
+                                                TInt& aAverageFrameDuration, 
+                                                TInt& aAverageFrameSize,
+                        TAudFileProperties* aProperties)
+    {
+        
+    PRINT((_L("CProcMP4InFileHandler::GetAudioFrameInfoL in")));
+    mp4_u32 audiolength = 0;
+    mp4_u32 audiotype = 0;
+
+    mp4_u8 framespersample = 0;
+    mp4_u32 timescale = 0;
+    mp4_u32 averagebitrate = 0;
+    
+    if (aProperties->iSamplingRate == 0) return KErrNotSupported;
+
+    MP4Err err = MP4ParseRequestAudioDescription(iParser, &audiolength, &audiotype, 
+                                        &framespersample, &timescale, &averagebitrate);
+
+
+    if (aProperties->iAudioType == EAudAMR)
+        {
+        aAverageFrameDuration = 20;
+
+        }
+    else if(aProperties->iAudioType == EAudAMRWB)
+        {
+        aAverageFrameDuration = 20;
+
+        }
+    else if(aProperties->iAudioType == EAudAAC_MPEG4)
+        {
+
+        aAverageFrameDuration = (1024*1000)/(aProperties->iSamplingRate);
+
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    aFrameAmount = TInt((TInt)audiolength/aAverageFrameDuration);
+
+    mp4_u32 lastPosition = 0;
+
+    err = MP4ParseGetLastPosition(iParser, &lastPosition);
+
+    SeekAudioFrame(0);
+
+
+    if (err != MP4_OK)
+        {
+        return EFalse;
+        
+        }
+
+    // ignore the first 2 frames
+    HBufC8* frame;
+    TInt size = 0;
+    TInt32 time = 0;
+
+
+      if(GetEncAudioFrameL(frame, size, time))
+          {
+
+        if (aProperties->iAudioType == EAudAAC_MPEG4)
+            {
+            
+            /*
+            * Read the eAAC+ parameters. Please note that the decoder specific
+            * configuration information does, in case of explicit signalling,
+            * signal the presence of SBR bitstream elements but not completely
+            * the configuration of the SBR. For example, parametric stereo is
+            * signalled only at the bitstream level (due to backwards comptibility
+            * reasons).
+            */
+
+            TUint8* buf = const_cast<TUint8*>(frame->Right(frame->Size()).Ptr());
+            CProcAACFrameHandler::GetEnhancedAACPlusParametersL(buf, size, aProperties, iFrameInfo);
+            
+            }
+        delete frame;
+        frame = 0;
+          }
+
+    if (GetEncAudioFrameL(frame, size, time))
+        {
+        delete frame;
+        frame = 0;
+        }
+
+    // calculate the average of the next 100 frames
+
+    TInt32 timeSum = 0;
+    TInt32 sizeSum = 0;
+    TInt divider = 0;
+    TInt maxFrameNr = 100;
+    if ( aFrameAmount < 100 )
+        {
+        maxFrameNr = aFrameAmount;
+        }
+
+
+    for (TInt a = 0 ; a < maxFrameNr ; a++)
+        {
+        if (GetEncAudioFrameL(frame, size, time))
+            {
+            timeSum += time;
+            sizeSum += size;
+            divider++; 
+            delete frame;
+            frame = 0;
+            }
+        else 
+            {
+
+            if ( a > 0 )
+                {
+                PRINT((_L("CProcMP4InFileHandler::GetAudioFrameInfoL breaking the loop since less than 100 frames in input (%d)"),a));
+                break;
+                }
+            else
+                {
+                PRINT((_L("CProcMP4InFileHandler::GetAudioFrameInfoL can't get any frames from input")));
+                SeekAudioFrame(lastPosition);
+                return EFalse;
+                }
+            }
+
+        }
+    
+    if (divider > 0)
+        {
+        aAverageFrameDuration = static_cast<TInt>(timeSum/divider); 
+        aAverageFrameSize = static_cast<TInt>(sizeSum/divider);
+        }
+
+    SeekAudioFrame(lastPosition);
+            
+    PRINT((_L("CProcMP4InFileHandler::GetAudioFrameInfoL out")));
+    return ETrue;
+    }
+
+
+TBool CProcMP4InFileHandler::GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime)
+    {
+    PRINT((_L("CProcMP4InFileHandler::GetEncAudioFrameL in")));
+    if (iParser == 0)
+        {
+        aFrame = 0;
+        return EFalse;
+        }
+
+    mp4_u32 type = 0;
+    if (iProperties->iAudioType == EAudAAC_MPEG4)
+        type = MP4_TYPE_MPEG4_AUDIO;
+    else if (iProperties->iAudioType == EAudAMR)
+        {
+        type = MP4_TYPE_AMR_NB;
+        if (iMP4ReadBuffer != 0 && iMP4ReadBufferSize > 0 && iMP4ReadBufferPos < iMP4ReadBufferSize)
+            {
+            // we can just read a frame from in-buffer
+            aTime = 20;
+            TBool ret = ReadOneAMRFrameL(aFrame);
+            
+            if (iClip != 0 && iFrameHandler != 0)
+                {
+                TRAPD(err0, ManipulateGainL(aFrame));    
+                if (err0 != KErrNone)
+                    {
+                    // something went wrong with the gain manipulation
+                    // continue by returning the original frame
+                    }
+                
+                }
+            PRINT((_L("CProcMP4InFileHandler::GetEncAudioFrameL out from AMRNB branch")));
+            return ret;
+            }
+        else
+            {
+            // if nothing more to read in the inBuffer
+            delete[] iMP4ReadBuffer;
+            iMP4ReadBuffer = 0;
+            iMP4ReadBufferPos = 0;
+            iMP4ReadBufferSize = 0;
+            }
+            
+        
+        // see if stuff left in the read buffer
+        }
+        
+    else if (iProperties->iAudioType == EAudAMRWB)
+        {
+        type = MP4_TYPE_AMR_WB;
+        
+        if (iMP4ReadBuffer != 0 && iMP4ReadBufferSize > 0 && iMP4ReadBufferPos < iMP4ReadBufferSize)
+            {
+            // we can just read a frame from in-buffer
+            aTime = 20;
+            TBool ret = ReadOneAWBFrameL(aFrame);
+            
+            if (iClip != 0 && iFrameHandler != 0)
+                {
+                TRAPD(err0, ManipulateGainL(aFrame));    
+                if (err0 != KErrNone)
+                    {
+                    // something went wrong with the gain manipulation
+                    // continue by returning the original frame
+                    }
+                
+                }
+            PRINT((_L("CProcMP4InFileHandler::GetEncAudioFrameL out from AMRWB branch")));
+            return ret;
+            }
+            
+        }
+        
+
+
+    mp4_u32 framesize = 0; 
+    mp4_u32 audiosize = 0;
+    mp4_u32 timestamp = 0;
+    mp4_u32 returnedframes = 0;
+    mp4_u32 timestamp2 = 0;
+
+    MP4Err err =MP4ParseNextFrameSize(iParser, type, &framesize);
+    if (err == MP4_OK)
+        {
+        
+        // some error handling
+        if (type == MP4_TYPE_MPEG4_AUDIO && (framesize > KMaxAACFrameSize))
+            {
+            // we got too many bytes for some reason...
+            delete[] iMP4ReadBuffer;
+            iMP4ReadBuffer = 0;
+            iMP4ReadBufferSize = 0;
+            iMP4ReadBufferPos = 0;
+            PRINT((_L("CProcClipInfoAO::CProcMP4InFileHandler::GetEncAudioFrameL out, too many bytes for AAC %d"), framesize ));
+            return EFalse;
+            
+            }
+        
+        
+        iMP4ReadBufferSize = framesize;
+        delete[] iMP4ReadBuffer;
+        iMP4ReadBuffer = 0;
+        iMP4ReadBuffer = new (ELeave) mp4_u8[framesize];
+        iMP4ReadBufferPos = 0;
+        
+        err = MP4ParseReadAudioFrames(iParser, 
+            iMP4ReadBuffer, 
+            framesize, 
+            &audiosize, 
+            &timestamp, 
+            &returnedframes, 
+            &timestamp2);
+
+        if (err == MP4_OK)
+            {
+            aSize = framesize;
+            aTime = timestamp - iLastTimeStamp;
+            iCurrentTimeMilliseconds = timestamp;
+            iLastTimeStamp = timestamp;
+
+            if (type == MP4_TYPE_MPEG4_AUDIO)
+                {
+                aFrame = HBufC8::NewL(audiosize);    
+                aFrame->Des().Append(iMP4ReadBuffer, audiosize);
+                
+                }
+            else if (type == MP4_TYPE_AMR_NB)
+                {
+                aTime = 20;
+                ReadOneAMRFrameL(aFrame);
+                }
+            else if (type == MP4_TYPE_AMR_WB)
+                {
+                aTime = 20;
+                ReadOneAWBFrameL(aFrame);
+                }
+            }
+        else
+            {
+            delete[] iMP4ReadBuffer;
+            iMP4ReadBuffer = 0;
+            iMP4ReadBufferSize = 0;
+            iMP4ReadBufferPos = 0;
+            PRINT((_L("CProcMP4InFileHandler::GetEncAudioFrameL out since MP4ParseReadAudioFrames failed")));
+            return EFalse;
+
+            }
+
+        // delete if MP4AUDIO.
+        // AMR frames will be read from buffer as MP4 library 
+        // might have returned more than one AMR-frames
+        if (type == MP4_TYPE_MPEG4_AUDIO)
+            {
+            delete[] iMP4ReadBuffer;
+            iMP4ReadBuffer = 0;
+            iMP4ReadBufferSize = 0;
+            iMP4ReadBufferPos = 0;
+            }
+        
+        }
+    else
+        {
+        PRINT((_L("CProcMP4InFileHandler::GetEncAudioFrameL out since MP4ParseNextFrameSize failed, error %d"),err));
+        return EFalse;
+
+        }
+
+    TInt err2 = KErrNone;
+    
+    if (iProperties->iAudioTypeExtension == EAudExtensionTypeNoExtension)
+        {
+        
+        // AAC Plus is manipulated in time domain 
+    
+        if (iClip != 0 && iFrameHandler != 0)
+            {
+            TRAP(err2, ManipulateGainL(aFrame));    
+            }
+        
+        }
+    
+    if (err2 != KErrNone)
+        {
+        // something went wrong with the gain manipulation
+        // continue by returning the original frame
+        }
+    aSize = aFrame->Size();
+
+    PRINT((_L("CProcMP4InFileHandler::GetEncAudioFrameL out successfully")));
+    return ETrue;
+    }
+
+
+TBool CProcMP4InFileHandler::ReadTimeScale(mp4_u32& aTimescale)
+    {
+
+    mp4_u32 audiolength = 0; 
+    mp4_u32 audiotype = 0; 
+    mp4_u8 framespersample = 0; 
+    mp4_u32 timescale = 0; 
+    mp4_u32 averagebitrate = 0;
+
+    MP4Err err = MP4ParseRequestAudioDescription(iParser, 
+        &audiolength, 
+        &audiotype, 
+        &framespersample, 
+        &timescale, 
+        &averagebitrate);
+
+
+
+    if (err == MP4_OK)
+        {
+        aTimescale = timescale;
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+
+    }
+
+
+MP4Err CProcMP4InFileHandler::ParseRequestAudioDescription(
+                                           mp4_u32 *aAudiolength,
+                                           mp4_u32 *aAudiotype,
+                                           mp4_u8 *aFramespersample,
+                                           mp4_u32 *aTimescale,
+                                           mp4_u32 *aAveragebitrate)
+
+    {
+
+    return MP4ParseRequestAudioDescription(iParser,
+                                            aAudiolength,
+                                           aAudiotype,
+                                           aFramespersample,
+                                           aTimescale,
+                                           aAveragebitrate);
+
+    }
+
+
+TBool CProcMP4InFileHandler::GetInfoForFrameHandler(TAACFrameHandlerInfo& aAACInfo)
+    {
+    if (iParser == 0)
+        {
+        return EFalse;
+        }
+
+    aAACInfo.iIs960 = iFrameInfo->iIs960;
+    aAACInfo.iIsParametricStereo = iFrameInfo->iIsParametricStereo;
+    aAACInfo.iNumChannels = iFrameInfo->iNumChannels;
+    aAACInfo.iNumCouplingChannels = iFrameInfo->iNumCouplingChannels;
+    aAACInfo.iProfileID = iFrameInfo->iProfileID;
+    aAACInfo.iSampleRateID = iFrameInfo->iSampleRateID;
+    aAACInfo.isSBR = iFrameInfo->isSBR;
+
+
+    mp4_u8 *buffer = 0;
+    
+    const TInt bufSize = 64; 
+    TRAPD(nerr, buffer = new (ELeave) mp4_u8[bufSize])
+    
+    if (nerr != KErrNone)
+        {
+        delete[] buffer;
+        return EFalse;
+        }
+    
+    
+    mp4_u32 decspecinfosize = 0;
+
+    MP4Err err = MP4ParseReadAudioDecoderSpecificInfo(
+        iParser, 
+        buffer, 
+        64, 
+        &decspecinfosize);
+
+
+    if (err == MP4_OK)
+        {
+
+        mp4AACTransportHandle mp4AAC_ff;
+        int16 err2 = ReadMP4AudioConfig(buffer, 
+                                      decspecinfosize, 
+                                      &mp4AAC_ff);
+        if (err2 != TRUE)
+            {
+            
+            delete[] buffer;
+            return EFalse;
+
+            }
+
+        aAACInfo.iSampleRateID = static_cast<TUint8>(mp4AAC_ff.progCfg.sample_rate_idx);
+        aAACInfo.iSampleRateID = static_cast<TUint8>(mp4AAC_ff.audioInfo.samplingFreqIdx);
+
+        aAACInfo.iProfileID = static_cast<TUint8>(mp4AAC_ff.progCfg.profile);
+        
+        if (iProperties->iChannelMode == EAudStereo)
+            {
+            aAACInfo.iNumChannels = 2;
+            }
+        else if (iProperties->iChannelMode == EAudSingleChannel)
+            {
+            aAACInfo.iNumChannels = 1;
+            }
+        else
+            {
+            aAACInfo.iNumChannels = 0;
+            }
+
+        
+        aAACInfo.iIs960 = mp4AAC_ff.audioInfo.gaInfo.FrameLengthFlag;
+
+        aAACInfo.iNumCouplingChannels = 0;
+
+        aAACInfo.iIsParametricStereo = 0;
+        aAACInfo.isSBR = 0;
+
+        }
+
+    else
+        {
+
+        delete[] buffer;
+        return EFalse;
+        
+        }
+
+    delete[] buffer;
+    return ETrue;
+        
+        
+
+    }
+    
+
+    
+    
+TBool CProcMP4InFileHandler::ReadOneAMRFrameL(HBufC8*& aOneAMRFrame)
+    {
+        if (iMP4ReadBuffer == 0 || iMP4ReadBufferSize < 1 
+                                || iMP4ReadBufferPos >= iMP4ReadBufferSize) 
+            {
+            aOneAMRFrame = 0;
+            return EFalse;    
+            }
+        
+        
+        TInt readSize = 0;
+        TUint8 dec_mode = (enum Mode)((iMP4ReadBuffer[iMP4ReadBufferPos] & 0x0078) >> 3);
+        
+        switch (dec_mode)
+        {
+        case 0:
+            readSize = 12;
+            break;
+        case 1:
+            readSize = 13;
+            break;
+        case 2:
+            readSize = 15;
+            break;
+        case 3:
+            readSize = 17;
+            break;
+        case 4:
+            readSize = 19;
+            break;
+        case 5:
+            readSize = 20;
+            break;
+        case 6:
+            readSize = 26;
+            break;
+        case 7:
+            readSize = 31;
+            break;
+        case 8:
+            readSize = 5;
+            break;
+        case 15:
+            readSize = 0;
+            break;
+        default:
+            readSize = 0;
+            break;
+        };    
+        
+        aOneAMRFrame = HBufC8::NewL(readSize+1);
+        
+//        TPtr8 tmpDes((TPtr8)aOneAMRFrame->Des());
+
+        TInt lastByte = iMP4ReadBufferPos + readSize;
+        
+        for (; iMP4ReadBufferPos <= lastByte ; iMP4ReadBufferPos++)
+            {
+            
+            aOneAMRFrame->Des().Append(iMP4ReadBuffer[iMP4ReadBufferPos]);
+            }
+//        iMP4ReadBufferPos++;
+
+        return ETrue;
+        
+    }
+    
+TBool CProcMP4InFileHandler::ReadOneAWBFrameL(HBufC8*& aOneAWBFrame)
+    {
+        if (iMP4ReadBuffer == 0 || iMP4ReadBufferSize < 1 
+                                || iMP4ReadBufferPos >= iMP4ReadBufferSize) 
+            {
+            aOneAWBFrame = 0;
+            return EFalse;    
+            }
+        TUint8 toc = iMP4ReadBuffer[iMP4ReadBufferPos];
+        TUint8 mode = static_cast<TUint8>((toc >> 3) & 0x0F);
+
+        TInt readSize = KAWBPacked_size[mode];
+            
+        aOneAWBFrame = HBufC8::NewL(readSize+1);
+        
+        TInt lastByte = iMP4ReadBufferPos + readSize;
+        
+        for (; iMP4ReadBufferPos <= lastByte ; iMP4ReadBufferPos++)
+            {
+            
+            aOneAWBFrame->Des().Append(iMP4ReadBuffer[iMP4ReadBufferPos]);
+            }
+
+        return ETrue;
+        
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/MP4/src/mp4aud.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,330 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  mp4aud.cpp - MPEG-4 Audio interface to MPEG-4 Systems layer.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 2001-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/*-- Project Headers. --*/
+#include "nok_bits.h"
+#include "mp4aud.h"
+#include "AACAPI.h"
+const int32 sample_rates[] = {
+  96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 
+  11025, 8000, 0, 0, 0, 0
+};
+
+/*
+ * Reads program configuration element from the specified bitstream.
+ */
+static INLINE int16
+GetPCE(TBitStream *bs, ProgConfig *p, TInt *numChans)
+{
+  int16 i;
+
+  p->tag = (int16) BsGetBits(bs, LEN_TAG);
+  p->profile = (int16) BsGetBits(bs, LEN_PROFILE);
+  p->sample_rate_idx = (int16) BsGetBits(bs, LEN_SAMP_IDX);
+  p->front.num_ele = (int16) BsGetBits(bs, LEN_NUM_ELE);
+  p->side.num_ele = (int16) BsGetBits(bs, LEN_NUM_ELE);
+  p->back.num_ele = (int16) BsGetBits(bs, LEN_NUM_ELE);
+  p->lfe.num_ele = (int16) BsGetBits(bs, LEN_NUM_LFE);
+  p->data.num_ele = (int16) BsGetBits(bs, LEN_NUM_DAT);
+  p->coupling.num_ele = (int16) BsGetBits(bs, LEN_NUM_CCE);
+
+  p->mono_mix.present = (int16) BsGetBits(bs, 1);
+  if(p->mono_mix.present == 1)
+    p->mono_mix.ele_tag = (int16) BsGetBits(bs, LEN_TAG);
+
+  p->stereo_mix.present = (int16) BsGetBits(bs, 1);
+  if(p->stereo_mix.present == 1)
+    p->stereo_mix.ele_tag = (int16) BsGetBits(bs, LEN_TAG);
+
+  p->matrix_mix.present = (int16) BsGetBits(bs, 1);
+  if(p->matrix_mix.present == 1)
+  {
+    p->matrix_mix.ele_tag = (int16) BsGetBits(bs, LEN_MMIX_IDX);
+    p->matrix_mix.pseudo_enab = (int16) BsGetBits(bs, LEN_PSUR_ENAB);
+  }
+
+  for(i = 0; i < p->front.num_ele; i++)
+  {
+    p->front.ele_is_cpe[i] = (int16) BsGetBits(bs, LEN_ELE_IS_CPE);
+    p->front.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+
+    *numChans += (p->front.ele_is_cpe[i] == 1) ? 2 : 1;
+  }
+
+  for(i = 0; i < p->side.num_ele; i++)
+  {
+    p->side.ele_is_cpe[i] = (int16) BsGetBits(bs, LEN_ELE_IS_CPE);
+    p->side.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+
+    *numChans += (p->front.ele_is_cpe[i] == 1) ? 2 : 1;
+  }
+
+  for(i = 0; i < p->back.num_ele; i++)
+  {
+    p->back.ele_is_cpe[i] = (int16) BsGetBits(bs, LEN_ELE_IS_CPE);
+    p->back.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+
+    *numChans += (p->front.ele_is_cpe[i] == 1) ? 2 : 1;
+  }
+
+  for(i = 0; i < p->lfe.num_ele; i++)
+  {
+    *numChans += 1;
+
+    p->lfe.ele_is_cpe[i] = 0;
+    p->lfe.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+  }
+
+  for(i = 0; i < p->data.num_ele; i++)
+  {
+    p->data.ele_is_cpe[i] = 0;
+    p->data.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+  }
+
+  for(i = 0; i < p->coupling.num_ele; i++)
+  {
+    p->coupling.ele_is_cpe[i] = (int16) BsGetBits(bs, LEN_ELE_IS_CPE);
+    p->coupling.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+  }
+
+  BsByteAlign(bs);
+
+  p->num_comment_bytes = (int16) BsGetBits(bs, LEN_COMMENT_BYTES);
+  for(i = 0; i < p->num_comment_bytes; i++)
+    p->comments[i] = (uint8) BsGetBits(bs, LEN_BYTE);
+  p->comments[i] = 0;
+
+  return (p->tag);
+}
+
+/*
+ * Determines sampling rate index for the MPEG-4 decoder. The input sampling
+ * rate as specified in the audio config part is not one of the rates listed
+ * in the standard.
+ */
+static INLINE int16
+DetermineSamplingFreqIdx(int32 samplingFreq)
+{
+  int16 idx;
+
+  if(samplingFreq >= 92017L)                               idx = 0;
+  else if(samplingFreq < 92017L && samplingFreq >= 75132L) idx = 1;
+  else if(samplingFreq < 75132L && samplingFreq >= 55426)  idx = 2;
+  else if(samplingFreq < 55426L && samplingFreq >= 46009L) idx = 3;
+  else if(samplingFreq < 46009L && samplingFreq >= 37566L) idx = 4;
+  else if(samplingFreq < 37566L && samplingFreq >= 27713L) idx = 5;
+  else if(samplingFreq < 27713L && samplingFreq >= 23004L) idx = 6;
+  else if(samplingFreq < 23004L && samplingFreq >= 18783L) idx = 7;
+  else if(samplingFreq < 18783L && samplingFreq >= 13856L) idx = 8;
+  else if(samplingFreq < 13856L && samplingFreq >= 11502L) idx = 9;
+  else if(samplingFreq < 11502L && samplingFreq >= 9391L)  idx = 10;
+  else                                                     idx = 11;
+
+  return (idx);
+}
+
+/*
+ * Reads GA decoder configuration information from the specified bitstream.
+ */
+static INLINE BOOL
+ReadGASpecificInfo(TBitStream *bs, AudioSpecificInfo *audInfo, ProgConfig *progCfg)
+{
+  int16 extensionFlag;
+  GaSpecificInfo *gaInfo = &audInfo->gaInfo;
+
+  gaInfo->FrameLengthFlag = (BOOL) BsGetBits(bs, 1);
+  gaInfo->DependsOnCoreCoder = (BOOL) BsGetBits(bs, 1);
+  gaInfo->CoreCoderDelay = (gaInfo->DependsOnCoreCoder) ? (int16) BsGetBits(bs, 14) : (int16)0;
+  extensionFlag = (int16) BsGetBits(bs, 1);
+
+  if(audInfo->channelConfiguration == 0)
+  {
+    TInt numChans = 0;
+
+    GetPCE(bs, progCfg, &numChans);
+    audInfo->channelConfiguration = (uint8) numChans;
+    if (audInfo->samplingFreqIdx != (uint8) progCfg->sample_rate_idx)
+        {
+        return FALSE;
+        }
+  }
+
+  /*
+   * Determine the sampling rate index so that sampling rate dependent
+   * tables can be initialized.
+   */
+  if(audInfo->samplingFreqIdx == 0xf && audInfo->channelConfiguration != 0)
+  {
+    audInfo->samplingFreqIdx = (uint8) DetermineSamplingFreqIdx(audInfo->samplingFrequency);
+    progCfg->sample_rate_idx = audInfo->samplingFreqIdx;
+  }
+  else
+    {
+
+    audInfo->samplingFreqIdx = (uint8) progCfg->sample_rate_idx;
+  
+    }
+
+  if(audInfo->audioObject == AAC_SCALABLE || audInfo->audioObject == ER_AAC_SCALABLE)
+    gaInfo->layerNr = (uint8) BsGetBits(bs, 3);
+  
+  if(extensionFlag)
+  {
+    if(audInfo->audioObject == ER_BSAC)
+    {
+      gaInfo->numOfSubframe = (uint8) BsGetBits(bs, 5);
+      gaInfo->layer_length = (uint8) BsGetBits(bs, 11);
+    }
+    
+    switch(audInfo->audioObject)
+    {
+      case ER_AAC_LC:
+      case ER_AAC_LTP:
+      case ER_AAC_SCALABLE:
+      case ER_TWINVQ:
+      case ER_AAC_LD:
+        gaInfo->aacSectionDataResilienceFlag = (BOOL) BsGetBits(bs, 1);
+        gaInfo->aacScalefactorDataResilienceFlag = (BOOL) BsGetBits(bs, 1);
+        gaInfo->aacSpectralDataResilienceFlag = (BOOL) BsGetBits(bs, 1);
+        break;
+
+      default:
+        break;
+    }
+
+    extensionFlag = (int16) BsGetBits(bs, 1);
+    if(extensionFlag)
+    {
+      ;
+    }
+  }
+  return TRUE;
+}
+
+/*
+ * Reads MPEG-4 audio decoder specific configuration information.
+ *
+ * Retuns TRUE on success, FALSE otherwise. FALSE indicates that 
+ * unsupported decoder configuration (e.g., object type) was detected.
+ */
+static INLINE BOOL
+ReadAudioSpecificConfig(TBitStream *bs, AudioSpecificInfo *audInfo, 
+            ProgConfig *progCfg, int32 bufLen)
+{
+  int16 bitsLeft;
+  AudioObjectType audObj;
+
+  /*-- Read common configuration information. --*/
+  audObj = audInfo->audioObject = (AudioObjectType)(BsGetBits(bs, 5) - 1);
+  audInfo->samplingFreqIdx = (uint8) BsGetBits(bs, 4);
+  audInfo->samplingFrequency = sample_rates[audInfo->samplingFreqIdx];
+  if(audInfo->samplingFreqIdx == 0xf)
+    audInfo->samplingFrequency = (int32) BsGetBits(bs, 24);
+  audInfo->channelConfiguration = (uint8) BsGetBits(bs, 4);
+
+  audInfo->extAudioObject = (AudioObjectType) 0;
+  audInfo->sbrPresentFlag = 0;
+
+  if(audInfo->audioObject == AAC_SBR)
+  {
+    audInfo->extAudioObject = audInfo->audioObject;
+    audInfo->sbrPresentFlag = 1;
+    audInfo->extSamplingFreqIdx = (uint8) BsGetBits(bs, 4);
+    if(audInfo->extSamplingFreqIdx == 0xf)
+      audInfo->extSamplingFrequency = (int32) BsGetBits(bs, 24);
+    audObj = audInfo->audioObject = (AudioObjectType)(BsGetBits(bs, 5) - 1);
+  }
+
+  /*-- Read object type specific configuration information. --*/
+  switch(audInfo->audioObject)
+  {
+    case AAC_MAIN:
+    case AAC_LC:
+    case AAC_LTP:
+      progCfg->profile = (int16) audObj;
+      progCfg->sample_rate_idx = audInfo->samplingFreqIdx;
+      if (ReadGASpecificInfo(bs, audInfo, progCfg) == FALSE)
+        {
+        return FALSE;
+        }
+      if(audInfo->samplingFreqIdx != 0xf)
+        audInfo->samplingFrequency = sample_rates[audInfo->samplingFreqIdx];
+      break;
+
+    default:
+      audObj = NULL_OBJECT;
+      break;
+  }
+
+  bitsLeft = (int16) ((bufLen << 3) - BsGetBitsRead(bs));
+  if(audInfo->extAudioObject != AAC_SBR && bitsLeft >= 16)
+  {
+    audInfo->syncExtensionType = (int16) BsGetBits(bs, 11);
+    if(audInfo->syncExtensionType == 0x2b7)
+    {
+      audInfo->extAudioObject = (AudioObjectType)(BsGetBits(bs, 5) - 1);
+      if(audInfo->extAudioObject == AAC_SBR)
+      {
+        audInfo->sbrPresentFlag = (uint8) BsGetBits(bs, 1);
+        if(audInfo->sbrPresentFlag)
+        {
+          audInfo->extSamplingFreqIdx = (uint8) BsGetBits(bs, 4);
+          if(audInfo->extSamplingFreqIdx == 0xf)
+            audInfo->extSamplingFrequency = (int32) BsGetBits(bs, 24);
+        }
+      }
+    }
+  }
+
+  return ((audObj == NULL_OBJECT) ? (BOOL) FALSE : (BOOL) TRUE);
+}
+
+BOOL
+ReadMP4AudioConfig(uint8 *buffer, uint32 bufLen, mp4AACTransportHandle *mp4AAC_ff)
+{
+  TBitStream bs;
+  BOOL retValue;
+
+  BsInit(&bs, buffer, bufLen);
+
+  retValue = ReadAudioSpecificConfig(&bs, &mp4AAC_ff->audioInfo, &mp4AAC_ff->progCfg, bufLen);
+
+  return (retValue);
+}
+
+void
+WriteMP4AudioConfig(uint8 *buffer, uint32 bufLen, mp4AACTransportHandle /* *mp4AAC_ff*/)
+{
+
+  TBitStream bs;
+
+  BsInit(&bs, buffer, bufLen);
+
+  /*-- Change object type to LC. --*/
+  BsPutBits(&bs, 5, 2);
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/WAV/inc/ProcWAVFrameHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCWAVFRAMEHANDLER_H__
+#define __CPROCWAVFRAMEHANDLER_H__
+
+#include <e32base.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "ProcFrameHandler.h"
+
+class CProcWAVFrameHandler : public CProcFrameHandler 
+    {
+
+public:
+
+    /*
+    * Constructors & destructor
+    *
+    */
+    static CProcWAVFrameHandler* NewL(TInt aBitsPerSample);
+    static CProcWAVFrameHandler* NewLC(TInt aBitsPerSample);
+    virtual ~CProcWAVFrameHandler();
+
+
+    // From base class --------------->
+    virtual TBool ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain);
+
+    
+    virtual TBool GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const;
+    virtual TBool GetNormalizingMargin(const HBufC8* aFrame, TInt8& aMargin) const;
+
+    virtual TBool IsMixingAvailable() const;
+    virtual TBool MixL(const HBufC8* aFrame1, const HBufC8* aFrame2, HBufC8*& aMixedFrame);
+    //<---------------------------------
+
+    
+private:
+
+    // ConstructL
+    void ConstructL();
+    
+    // c++ constructor
+    CProcWAVFrameHandler(TInt aBitsPerSample);
+    
+    // gets the highest gain
+    TInt GetHighestGain(const HBufC8* aFrame, TInt& aMaxGain) const;
+
+    // bitdepth
+    TInt iBitsPerSample;
+
+    
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/WAV/inc/ProcWAVInFileHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __CPROCWAVINFILEHANDLER_H__
+#define __CPROCWAVINFILEHANDLER_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "ProcInFileHandler.h"
+#include "ProcDecoder.h"
+
+
+class CProcWAVInFileHandler: public CProcInFileHandler 
+    {
+
+public:
+
+
+    /*
+    * Constructors & destructor
+    *
+    */
+
+    static CProcWAVInFileHandler* NewL(const TDesC& aFileName, RFile* aFileHandle,
+                                        CAudClip* aClip, TInt aReadBufferSize,
+                                            TInt aTargetSampleRate = 0, 
+                                            TChannelMode aChannelMode = EAudSingleChannel);
+    static CProcWAVInFileHandler* NewLC(const TDesC& aFileName, RFile* aFileHandle,
+                                        CAudClip* aClip, TInt aReadBufferSize,
+                                            TInt aTargetSampleRate = 0, 
+                                            TChannelMode aChannelMode = EAudSingleChannel);
+    virtual ~CProcWAVInFileHandler();
+
+    // From base class ------------------>
+
+    void GetPropertiesL(TAudFileProperties* aProperties);
+    
+    /**
+    * Seeks a certain audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    * @param aFrameIndex    frame index
+    * @param aTime            time from the beginning of file in milliseconds
+    *
+    * @return    ETrue if successful
+    *            EFalse if beyond the file
+    */
+    TBool SeekAudioFrame(TInt32 aTime);
+
+    
+    /**
+    * Seeks a cut in audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    *
+    * @return    ETrue if successful
+    *                
+    */
+    TBool SeekCutInFrame();
+
+    
+    virtual TBool SetNormalizingGainL(const CProcFrameHandler* aFrameHandler);
+
+    // <-------------------------- From base class
+
+private:
+
+    // number of samples in a frame
+    TInt iNumberofSamplesInFrame;    
+
+private:
+    
+    // constructL
+    void ConstructL(const TDesC& aFileName, RFile* aFileHandle, CAudClip* aClip, 
+                    TInt aReadBufferSize, TInt aTargetSampleRate = 0, 
+                    TChannelMode aChannelMode = EAudSingleChannel);
+    
+    TBool GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime);
+    
+    // c++ constructor
+    CProcWAVInFileHandler();
+
+private:
+
+
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/WAV/src/ProcWAVFrameHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,384 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "ProcWAVFrameHandler.h"
+#include "ProcFrameHandler.h"
+#include "ProcTools.h"
+#include "ProcConstants.h"
+
+#include <f32file.h>
+#include <e32math.h>
+
+
+TBool CProcWAVFrameHandler::ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain) 
+    {
+    TInt a = 0;
+
+    aFrameOut = HBufC8::NewLC(aFrameIn->Size());
+    
+    aFrameOut->Des().Copy(aFrameIn->Ptr(), aFrameIn->Size());
+
+    aGain = static_cast<TInt8>(aGain / 2);
+
+    TPtr8 framePtr(aFrameOut->Des());
+    if (iBitsPerSample == 8)
+        {
+
+        TReal multiplier = 0;
+        TReal gaR(aGain);
+        TReal exp = gaR/20;
+        Math::Pow(multiplier, 10, exp);
+
+        for (a = 0 ; a < aFrameOut->Length() ; a++)
+            {
+            TInt oldGain = (*aFrameOut)[a]-128;
+            TInt newGain = 0;
+            
+            newGain = static_cast<TInt>(oldGain * multiplier);
+            
+            if (newGain > 128) 
+                {
+                newGain = 128;
+                }
+            else if (newGain < -128)
+                {
+                newGain = -128;
+                }
+        
+            framePtr[a] = static_cast<TUint8>(newGain+128);
+            
+            }
+        }
+    else if (iBitsPerSample == 16)
+        {
+
+        TReal multiplier = 0;
+        TReal gaR(aGain);
+        TReal exp = gaR/20;
+        Math::Pow(multiplier, 10, exp);
+
+
+        for (a = 0 ; a < aFrameOut->Length()-1 ; a += 2)
+            {
+            
+            TUint16 oldGain = static_cast<TUint16>((*aFrameOut)[a+1]*256 + (*aFrameOut)[a]);
+
+            TBool negative = EFalse;
+
+            if (oldGain > 32767) 
+                {
+                oldGain = static_cast<TUint16>(~oldGain+1);// - 65793;
+                negative = ETrue;
+                }
+
+            TUint16 newGain = static_cast<TUint16>(oldGain * multiplier);
+
+            if (newGain > 32727) 
+                {
+                newGain = 32727;
+                }
+
+            
+            if (negative)
+                {
+                newGain = static_cast<TUint16>(~newGain-1);// - 65793;
+
+                }
+            framePtr[a+1] = static_cast<TUint8>(newGain/256);
+            framePtr[a] = static_cast<TUint8>(newGain%256);
+
+            
+
+            }
+        
+        }
+
+
+    CleanupStack::Pop(); // aFrameOut
+    return ETrue;
+    }
+
+TBool CProcWAVFrameHandler::GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const
+    {
+
+    TInt a = 0;
+
+    TInt highest = 0;
+
+    if (iBitsPerSample == 8)
+        {
+        
+        for (a = 0 ; a < aFrame->Length() ; a++)
+            {
+
+
+            if (Abs((*aFrame)[a]-128) > highest)
+                highest = Abs((*aFrame)[a]-128);
+    
+            }
+        }
+    else if (iBitsPerSample == 16)
+        {
+        
+        for (a = 0 ; a < aFrame->Length()-1 ; a += 2)
+            {
+            TInt ga = ((*aFrame)[a+1]*256 + (*aFrame)[a]);
+
+            if (ga > 32767) ga-= 65792;
+
+
+
+            if (ga > highest) highest = ga;
+
+    
+            }
+        
+        }
+
+
+    aGains.Append(highest);
+
+    if (iBitsPerSample == 8) aMaxGain = 128;
+    else if (iBitsPerSample == 16) aMaxGain = 32767;
+
+
+    return ETrue;
+    }
+
+
+TBool CProcWAVFrameHandler::GetNormalizingMargin(const HBufC8* aFrame, TInt8& aMargin) const
+
+    {
+
+
+    TInt maxGain = 0;
+    TInt highestGain = GetHighestGain(aFrame, maxGain);
+
+
+    TInt ma = ((maxGain - highestGain)*2)/5;
+    aMargin = static_cast<TInt8>(ma);
+
+    return ETrue;
+
+
+    }
+
+TBool CProcWAVFrameHandler::IsMixingAvailable() const
+    {
+    return ETrue;
+    }
+TBool CProcWAVFrameHandler::MixL(const HBufC8* aFrame1, const HBufC8* aFrame2, HBufC8*& aMixedFrame)
+    {
+
+    if (aFrame1->Length() != aFrame2->Length()) 
+        {
+        aMixedFrame = 0;
+        return EFalse;
+        }
+
+    aMixedFrame = HBufC8::NewL(aFrame1->Length());
+
+    TInt a = 0;
+    TInt newGain = 0;
+    
+    if (iBitsPerSample == 8)
+        {
+
+        for (a = 0 ; a < aFrame1->Length() ; a++)
+            {
+        
+            TInt oldGain1 = (*aFrame1)[a]-128;
+            TInt oldGain2 = (*aFrame2)[a]-128;
+            
+            newGain = oldGain1 + oldGain2;
+            
+            if (newGain > 128) 
+                {
+                newGain = 128;
+                }
+            else if (newGain < -128)
+                {
+                newGain = -128;
+                }
+        
+            aMixedFrame->Des().Append(static_cast<TUint8>(newGain+128));
+            
+            }
+        }
+    else if (iBitsPerSample == 16)
+        {
+
+
+        for (a = 0 ; a < aFrame1->Length()-1 ; a += 2)
+            {
+            
+            TUint16 oldGain1 = static_cast<TUint16>((*aFrame1)[a+1]*256 + (*aFrame1)[a]);
+            TUint16 oldGain2 = static_cast<TUint16>((*aFrame2)[a+1]*256 + (*aFrame2)[a]);
+
+
+            TBool negative1 = EFalse;
+            TBool negative2 = EFalse;
+
+            if (oldGain1 > 32767) 
+                {
+                //oldGain1 = ~oldGain1+1;// - 65793;
+                negative1 = ETrue;
+//                oldGain1 = oldGain1+((65536-oldGain1)/2);
+
+                }
+            else
+                {
+
+//                oldGain1 /= 2; 
+
+                }
+
+            if (oldGain2 > 32767) 
+                {
+                //oldGain2 = ~oldGain2+1;// - 65793;
+                negative2 = ETrue;
+//                oldGain2 = oldGain2+((65536-oldGain2)/2);
+
+                }
+            else
+                {
+//                oldGain2 /= 2; 
+                }
+
+
+            newGain = static_cast<TUint16>(oldGain1 + oldGain2);
+
+
+            if (negative1 && negative2)
+                {
+                if (newGain < 32767)
+                    {    
+                    newGain = 32768;
+                    }
+                }
+            else if (!negative1 && !negative2)
+                {
+                if (newGain > 32767)
+                    {    
+                    newGain = 32767;
+                    }
+                
+                }
+
+
+            aMixedFrame->Des().Append(static_cast<TUint8>(newGain%256));
+            aMixedFrame->Des().Append(static_cast<TUint8>(newGain/256));
+
+            }
+        
+        }
+
+    return ETrue;
+
+    }
+
+
+
+CProcWAVFrameHandler::~CProcWAVFrameHandler() 
+    {
+
+    }
+
+CProcWAVFrameHandler* CProcWAVFrameHandler::NewL(TInt aBitsPerSample) 
+    {
+
+    
+    CProcWAVFrameHandler* self = NewLC(aBitsPerSample);
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+CProcWAVFrameHandler* CProcWAVFrameHandler::NewLC(TInt aBitsPerSample) 
+    {
+
+    CProcWAVFrameHandler* self = new (ELeave) CProcWAVFrameHandler(aBitsPerSample);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+
+    }
+
+void CProcWAVFrameHandler::ConstructL() 
+    {
+
+    }
+
+CProcWAVFrameHandler::CProcWAVFrameHandler(TInt aBitsPerSample) : iBitsPerSample(aBitsPerSample)
+    {
+
+    }
+ 
+TInt CProcWAVFrameHandler::GetHighestGain(const HBufC8* aFrame, TInt& aMaxGain) const
+    {
+
+    TInt maxGain = 0;
+    TInt a = 0;
+
+    if (iBitsPerSample == 8)
+        {
+        aMaxGain = 210;
+            
+        for (a = 0 ; a < aFrame->Length() ; a++)
+            {
+            
+            TInt gain = Abs((*aFrame)[a]-128);
+            if (gain > maxGain) maxGain = gain;
+
+            }
+        }
+    else if (iBitsPerSample == 16)
+        {
+
+        aMaxGain = 452;
+        for (a = 0 ; a < aFrame->Length()-1 ; a += 2)
+            {
+            TInt ga = ((*aFrame)[a+1]*256 + (*aFrame)[a]);
+
+            if (ga > 32767) ga-= 65792;
+
+            ga = Abs(ga);
+            
+            if (ga > maxGain) maxGain = ga;
+
+            }
+        
+        }
+
+    TReal result = 0;
+    TReal gai(maxGain);
+
+    if (gai!= 0) Math::Log(result, gai);
+    result *= 100;
+
+    return (TInt) result;
+
+
+
+
+
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/WAV/src/ProcWAVInFileHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,473 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+#include "ProcWAVInFileHandler.h"
+#include "ProcWAVFrameHandler.h"
+#include "AudPanic.h"
+#include "ProcTools.h"
+#include "audconstants.h"
+
+
+
+CProcWAVInFileHandler* CProcWAVInFileHandler::NewL(const TDesC& aFileName, 
+                                                   RFile* aFileHandle,
+                                                   CAudClip* aClip, 
+                                                   TInt aReadBufferSize,
+                                                   TInt aTargetSampleRate, 
+                                                   TChannelMode aChannelMode) 
+    {
+
+    CProcWAVInFileHandler* self = NewLC(aFileName, aFileHandle, aClip, 
+                    aReadBufferSize, aTargetSampleRate, aChannelMode);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CProcWAVInFileHandler* CProcWAVInFileHandler::NewLC(const TDesC& aFileName, 
+                                                    RFile* aFileHandle,
+                                                    CAudClip* aClip, 
+                                                    TInt aReadBufferSize,
+                                                    TInt aTargetSampleRate, 
+                                                    TChannelMode aChannelMode) 
+    {
+    
+    CProcWAVInFileHandler* self = new (ELeave) CProcWAVInFileHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileName, aFileHandle, aClip, aReadBufferSize, aTargetSampleRate, aChannelMode);
+    return self;
+    }
+
+CProcWAVInFileHandler::CProcWAVInFileHandler() : CProcInFileHandler(), iNumberofSamplesInFrame(1)
+    {
+    
+    
+    }
+
+void CProcWAVInFileHandler::GetPropertiesL(TAudFileProperties* aProperties) 
+    {
+
+    if (iProperties != 0)
+        {
+        *aProperties = *iProperties;
+        return;
+        }
+    
+    
+    const TInt KFrameDurationMilli = 20;
+    const TInt KFramesPerSecond = 50;
+    
+    if (iFileOpen) 
+        {
+        aProperties->iFileFormat = EAudFormatUnrecognized;
+        aProperties->iAudioType = EAudTypeUnrecognized;
+        aProperties->iAudioTypeExtension = EAudExtensionTypeNoExtension;
+        aProperties->iBitrate = 0;
+        aProperties->iBitrateMode = EAudBitrateModeNotRecognized;
+        aProperties->iChannelMode = EAudChannelModeNotRecognized;
+        aProperties->iDuration = 0;
+        aProperties->iSamplingRate = 0;
+        aProperties->iFrameLen = 0;
+        aProperties->iFrameCount = 0;
+
+        TInt oldPos = iFilePos;
+
+        // check the validity of WAVE header
+
+        TBuf8<4> chunckID;
+        TBuf8<4> format;
+        TBuf8<4> fmt;
+        TBuf8<4> data;
+        
+        TBuf8<1> audioFormat;
+
+        BufferedFileRead(0, chunckID);
+        BufferedFileRead(8, format);
+        BufferedFileRead(12, fmt);
+        BufferedFileRead(20, audioFormat);
+        BufferedFileRead(36, data);
+
+
+        if (chunckID.Compare(_L8("RIFF")) == 0 &&
+            format.Compare(_L8("WAVE")) == 0 &&
+            fmt.Compare(_L8("fmt ")) == 0 &&
+            data.Compare(_L8("data")) == 0 &&
+            audioFormat[0] == 0x01)
+            {
+            aProperties->iFileFormat = EAudFormatWAV;
+            aProperties->iAudioType = EAudWAV;
+            }
+        else
+            {
+            aProperties->iFileFormat = EAudFormatUnrecognized;
+            User::Leave(KErrNotSupported);
+            return;
+
+            }
+        
+        TBuf8<1> numChannels;
+        BufferedFileRead(22, numChannels);
+        if (numChannels[0] == 0x01)
+            {
+            aProperties->iChannelMode = EAudSingleChannel;
+            }
+        else if (numChannels[0] == 0x02)
+            {
+            aProperties->iChannelMode = EAudStereo;
+            }
+        else
+            {
+            aProperties->iFileFormat = EAudFormatUnrecognized;
+            User::Leave(KErrNotSupported);
+            return;
+            }
+
+        TBuf8<4> sr;
+        BufferedFileRead(24, sr);
+
+        TBuf8<8> tmpBin;
+        TBuf8<8*4> srBin;
+    
+        // little endian:
+        for (TInt a = 3 ; a >= 0; a--)
+            {
+            ProcTools::Dec2Bin(sr[a], tmpBin);
+            srBin.Append(tmpBin);
+            }
+        
+        TUint srDec = 0;
+        ProcTools::Bin2Dec(srBin, srDec);
+
+        aProperties->iSamplingRate = srDec;
+        
+        // Check that the sample rate is supported    
+        if( (aProperties->iSamplingRate != KAedSampleRate8kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate11kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate16kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate22kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate24kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate32kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate44kHz) &&
+            (aProperties->iSamplingRate != KAedSampleRate48kHz) )
+            {
+            User::Leave(KErrNotSupported);
+            }
+
+        iNumberofSamplesInFrame = srDec/(KFramesPerSecond/numChannels[0]);
+        if (iNumberofSamplesInFrame%2 != 0) iNumberofSamplesInFrame++;
+        
+        tmpBin.Delete(0, tmpBin.Length());
+
+        TBuf8<4> byteRate;
+        TBuf8<8*4> byteRateBin;
+        TUint byteRateDec = 0;
+
+        BufferedFileRead(28, byteRate);
+        for (TInt b = 3 ; b >= 0; b--)
+            {
+            ProcTools::Dec2Bin(byteRate[b], tmpBin);
+            byteRateBin.Append(tmpBin);
+            }
+        ProcTools::Bin2Dec(byteRateBin, byteRateDec);
+
+        aProperties->iBitrate = byteRateDec*8;
+
+        TBuf8<1> numberOfBitsPerSample;
+        BufferedFileRead(34, numberOfBitsPerSample);
+        aProperties->iNumberOfBitsPerSample = numberOfBitsPerSample[0];
+
+        // other bit depths can be added later if (ever) needed
+        if (aProperties->iNumberOfBitsPerSample != 16 &&
+            aProperties->iNumberOfBitsPerSample != 8)
+            {
+            aProperties->iFileFormat = EAudFormatUnrecognized;
+            User::Leave(KErrNotSupported);
+            return;
+            }
+            
+        if (aProperties->iNumberOfBitsPerSample == 16)
+            {
+            iNumberofSamplesInFrame *= 2;
+            }
+
+        TBuf8<4> dataSize;
+        BufferedFileRead(40, dataSize);
+
+        TBuf8<8*4> dataSizeBin;
+        TUint dataSizeDec = 0;
+        tmpBin.Delete(0, tmpBin.Length());
+
+        for (TInt c = 3 ; c >= 0; c--)
+            {
+            ProcTools::Dec2Bin(dataSize[c], tmpBin);
+            dataSizeBin.Append(tmpBin);
+            }
+        ProcTools::Bin2Dec(dataSizeBin, dataSizeDec);
+        
+        TTimeIntervalMicroSeconds durationMicro((TInt64)(TInt)((TReal(dataSizeDec)/byteRateDec)*1000000));
+
+        aProperties->iDuration = durationMicro;
+        aProperties->iBitrateMode = EAudConstant;
+        aProperties->iFrameLen = iNumberofSamplesInFrame;
+        
+        aProperties->iFrameDuration = KFrameDurationMilli*1000;
+        
+        aProperties->iFrameCount = (TInt)dataSizeDec/iNumberofSamplesInFrame;
+        aProperties->iNumFramesPerSample = 1;
+
+
+
+        BufferedFileSetFilePos(oldPos);
+        }
+    else 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    
+    if (iProperties == 0)
+        {
+        iProperties = new (ELeave) TAudFileProperties;
+        *iProperties = *aProperties;
+        }
+    
+    
+    }
+
+TBool CProcWAVInFileHandler::SeekAudioFrame(TInt32 aTime) 
+    {
+    
+    TInt frameLengthMilliSeconds = ProcTools::MilliSeconds(iProperties->iFrameDuration);
+    
+    TInt framesFromStart = aTime/frameLengthMilliSeconds;
+
+    TInt bytesFromStart = framesFromStart*iNumberofSamplesInFrame;
+
+    const TInt KWAVHeaderLength = 44;
+
+    BufferedFileSetFilePos(bytesFromStart+KWAVHeaderLength);
+
+    if (!iFileOpen) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    iCurrentTimeMilliseconds = aTime;
+
+    return ETrue;
+    }    
+
+TBool CProcWAVInFileHandler::SeekCutInFrame() 
+    {
+
+    iCurrentTimeMilliseconds = iCutInTime;
+    return SeekAudioFrame(iCutInTime);
+    }
+    
+
+
+void CProcWAVInFileHandler::ConstructL(const TDesC& aFileName, 
+                                       RFile* aFileHandle,
+                                       CAudClip* aClip, 
+                                       TInt aReadBufferSize,
+                                       TInt aTargetSampleRate, 
+                                       TChannelMode aChannelMode) 
+    {
+    
+    
+    
+    
+
+    iTargetSampleRate = aTargetSampleRate;
+    iChannelMode = aChannelMode;
+
+    InitAndOpenFileL(aFileName, aFileHandle, aReadBufferSize);
+
+    
+    if (aClip != 0)
+        {
+        iCutInTime = ProcTools::MilliSeconds(aClip->CutInTime());
+        
+        }
+
+
+    TAudFileProperties prop;
+    GetPropertiesL(&prop);
+
+    if (iProperties != 0)
+        {
+        TInt samplesIn20ms = ((iProperties->iSamplingRate) * 
+            (iProperties->iNumberOfBitsPerSample)/8)/50;
+        
+        if (iProperties->iChannelMode == EAudStereo)
+            {
+            samplesIn20ms *= 2;
+
+            }
+        if (samplesIn20ms % 2 != 0) samplesIn20ms--;
+        
+        iSilentFrame = HBufC8::NewL(samplesIn20ms);
+        
+        if (iProperties->iNumberOfBitsPerSample == 16)
+        {
+            iSilentFrame->Des().SetLength(samplesIn20ms);
+            iSilentFrame->Des().Fill(0);
+            
+        }
+        else if(iProperties->iNumberOfBitsPerSample == 8)
+        {
+            iSilentFrame->Des().SetLength(samplesIn20ms);
+            iSilentFrame->Des().Fill(128);
+            
+        }
+        iSilentFrameDuration = 20;
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+        
+    iClip = aClip;
+    
+    iFrameHandler = CProcWAVFrameHandler::NewL(iProperties->iNumberOfBitsPerSample);
+    
+    // Generate a decoder ----------------------->
+
+    iDecoder = CProcDecoder::NewL();
+    
+    iDecodingPossible = iDecoder->InitL(*iProperties, aTargetSampleRate, aChannelMode);
+    
+
+    // <----------------------- Generate a decoder 
+
+    if (iClip != 0 && iClip->Normalizing())
+        {
+        SetNormalizingGainL(iFrameHandler);    
+        }
+
+    }
+    
+    
+TBool CProcWAVInFileHandler::GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime)
+    {
+    
+    if (!iFileOpen) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+    
+    TInt numberOfBytesInFrame = iNumberofSamplesInFrame;
+    TInt bufferSize = numberOfBytesInFrame;
+    if (iProperties->iNumberOfBitsPerSample == 8)
+        {
+        // need to expand to 16 bits per sample since encoders and MMF sample rate converter assumes 16-bit signed input
+        bufferSize *= 2;
+        }
+    
+
+    aFrame = HBufC8::NewL(bufferSize);
+    
+    TPtr8 tmpDes((TPtr8)aFrame->Des());
+
+    BufferedFileRead((TPtr8&)tmpDes , numberOfBytesInFrame);
+
+    if (aFrame->Des().Length() < numberOfBytesInFrame)
+        {
+        delete aFrame;
+        aFrame = 0;
+        return EFalse;
+        }
+    aTime = ProcTools::MilliSeconds(iProperties->iFrameDuration);
+    iCurrentTimeMilliseconds += aTime;
+    
+    TRAPD(err, ManipulateGainL(aFrame));
+    
+    if (err != KErrNone)
+        {
+        // something went wrong with the gain manipulation
+        // continue by returning the original frame
+        }
+    
+    if (iProperties->iNumberOfBitsPerSample == 8)
+        {
+        // need to expand to 16 bits per sample since encoders and MMF sample rate converter assumes 16-bit signed input
+        TUint8* buffer = const_cast<TUint8*>(aFrame->Ptr());
+        // start from the end to avoid overlapping
+        for ( TInt i = numberOfBytesInFrame-1; i >= 0 ; i-- )
+            {
+            buffer[i*2+1] = TInt8(buffer[i]) - 128; // 8-bit Wav's are unsigned, 16-bit Wav's are signed
+            buffer[i*2] = 0;
+            }
+        tmpDes.SetLength(bufferSize);
+
+        }
+    aSize = aFrame->Length();
+    
+    
+    return ETrue;
+    
+    }
+    
+    
+
+
+CProcWAVInFileHandler::~CProcWAVInFileHandler() 
+    {
+
+    ResetAndCloseFile();
+
+    if (iSilentFrame != 0) delete iSilentFrame;
+
+    delete iFrameHandler;
+    
+    delete iDecoder;
+
+    }
+
+
+TBool CProcWAVInFileHandler::SetNormalizingGainL(const CProcFrameHandler* aFrameHandler)
+    {
+
+    HBufC8* point = 0;
+    TInt siz;
+    TInt32 tim = 0;
+    TInt8 margin = 0;
+    TInt minMargin = KMaxTInt;
+    
+    while(GetEncAudioFrameL(point, siz, tim)) 
+                    
+        {
+        aFrameHandler->GetNormalizingMargin(point, margin);
+                    
+        delete point;
+        point = 0;
+        
+        if (minMargin > margin)
+            {
+            minMargin = margin;
+            }
+    
+        }
+
+    iNormalizingMargin = static_cast<TInt8>(minMargin);
+
+    return ETrue;
+
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/mp3/inc/ProcMP3FrameHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef __CPROCMP3FRAMEHANDLER_H__
+#define __CPROCMP3FRAMEHANDLER_H__
+
+/*-- System Headers. --*/
+#include <e32base.h>
+
+/*-- Project Headers. --*/
+#include "AudCommon.h"
+#include "ProcFrameHandler.h"
+#include "ProcInFileHandler.h"
+
+#include "MP3API.h"
+
+/**
+ * Frame handler class for accessing MP3 data elements.
+ *
+ * @author  Juha Ojanperä
+ */
+class CProcMP3FrameHandler : public CProcFrameHandler 
+    {
+public:
+
+    
+    /*
+    * Constructors & destructor
+    */
+    static CProcMP3FrameHandler* NewL();
+    static CProcMP3FrameHandler* NewLC();
+
+    ~CProcMP3FrameHandler();
+
+
+    // From base class CProcFrameHandler ---------->
+    TBool ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain);
+    TBool GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const;
+    TBool GetNormalizingMargin(const HBufC8* aFrame, TInt8& aMargin) const;
+    TBool IsMixingAvailable() const;
+    // <--------------------------------------------
+    
+    
+
+private:
+
+    // ConstructL
+    void ConstructL();
+    
+    // c++ constructor
+    CProcMP3FrameHandler();
+    
+    // internal function for reading MP3 gains
+    TBool GetMP3Gains(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain, TBitStream& aBs) const;
+
+private:
+
+    // a handle to MP3 editing class in MP3AACManipLib
+    CMp3Edit* iMp3Edit;
+    
+    // a flag to indicate whether MP3 decoder is initialized
+    mutable TBool decInitialized;
+    
+    // a handle to CMPAudDec
+    CMPAudDec *iMpAud;
+    TMpTransportHandle *iTHandle;
+    
+
+    friend class CProcMP3InFileHandler;
+
+    };
+
+#endif /*-- __CPROCMP3FRAMEHANDLER_H__ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/mp3/inc/ProcMP3InFileHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef __CPROCMP3INFILEHANDLER_H__
+#define __CPROCMP3INFILEHANDLER_H__
+
+/*-- System Headers. --*/
+#include <e32base.h>
+#include <f32file.h>
+
+/*-- Project Headers. --*/
+#include "AudCommon.h"
+#include "ProcFrameHandler.h"
+#include "ProcInFileHandler.h"
+#include "Logfile.h"
+
+#include "defines.h"
+
+#include "Mp3API.h"
+
+#include "ProcDecoder.h"
+//#include "mpif.h"
+
+
+
+/**
+ * File handler class for accessing MP3 content.
+ *
+ * @author  Juha Ojanperä
+ */
+class CProcMP3InFileHandler: public CProcInFileHandler 
+    {
+public:
+
+    /*
+    * Constructors & destructor
+    */
+
+    static CProcMP3InFileHandler* NewL(const TDesC& aFileName, RFile* aFileHandle,
+                                       CAudClip* aClip, TInt aReadBufferSize,
+                                           TInt aTargetSampleRate = 0, 
+                                           TChannelMode aChannelMode = EAudSingleChannel);
+
+    static CProcMP3InFileHandler* NewLC(const TDesC& aFileName, RFile* aFileHandle,
+                                        CAudClip* aClip, TInt aReadBufferSize,
+                                            TInt aTargetSampleRate = 0, 
+                                            TChannelMode aChannelMode = EAudSingleChannel);
+                                        
+    virtual ~CProcMP3InFileHandler();
+
+
+    // From CProcInFileHandler ----------------->
+    void GetPropertiesL(TAudFileProperties* aProperties);
+    
+    TBool SeekAudioFrame(TInt32 aTime);
+
+    TBool SeekCutInFrame();
+    
+    virtual TBool GetDurationL(TInt32& aTime, TInt& aFrameAmount);
+
+    virtual TBool SetNormalizingGainL(const CProcFrameHandler* aFrameHandler);
+
+    //<-----------------------------------------
+
+
+private:
+    
+    // constructL
+    void ConstructL(const TDesC& aFileName, RFile* aFileHandle, CAudClip* aClip, 
+                    TInt aReadBufferSize, TInt aTargetSampleRate = 0, 
+                    TChannelMode aChannelMode = EAudSingleChannel);
+    
+    // C++ constructor
+    CProcMP3InFileHandler();
+    
+    TBool GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime);
+
+    // gets one Mp3 frame
+    int16 GetMP3Frame(uint8 *dataBytes, int16 bufSize, TMpFrameState *frState, uint8 syncStatus);
+
+    // gets bitrate
+    int16 GetMP3Bitrate(void);
+    
+    // check that file is valid mp3
+    TBool Validate(TDes8& aDes);
+    
+    // seek for frame sync codes
+    TInt SeekSync(TDes8& aDes, TInt aBufPos);
+    
+    // get info for a single frame
+    TInt FrameInfo(const TUint8* aBuf,TInt aBufLen,TInt& aBitRate);
+    
+    // get ID3 header length
+    TInt ID3HeaderLength(TDes8& aDes, TInt aPosition);
+
+private:
+
+    /*-- MP3 file format handle. --*/
+    TMpTransportHandle *mp3FileFormat;
+
+    /*-- Legal MP3 file? --*/
+    uint8 isValidMP3;
+
+    /*-- Input buffer; start of frame is seached from here. --*/
+    uint8 *mp3HeaderBytes;
+    
+    CLogFile *mp3Log;
+    
+    /*-- Free format flag. --*/
+    uint8 isFreeFormatMP3;
+    
+    
+    // a handle to mp3 editing class in MP3AACManipLib    
+    CMp3Edit* iMp3Edit;
+
+    /*-- VBR bitrate flag; ETrue indicates VBR file, EFalse constant. --*/
+    uint8 isVbrMP3;
+    
+    };
+
+#endif /*-- __CPROCMP3INFILEHANDLER_H__ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/mp3/src/ProcMP3FrameHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/*-- Project Headers. --*/
+#include "ProcMP3FrameHandler.h"
+#include "ProcMP3InFileHandler.h"
+#include "ProcFrameHandler.h"
+
+#include "MP3API.h"
+
+
+//mixing files
+
+
+
+CProcMP3FrameHandler* 
+CProcMP3FrameHandler::NewL() 
+{    
+  CProcMP3FrameHandler* self = NewLC();
+  CleanupStack::Pop(self);
+  return self;
+}
+
+CProcMP3FrameHandler* 
+CProcMP3FrameHandler::NewLC() 
+{
+  CProcMP3FrameHandler* self = new (ELeave) CProcMP3FrameHandler();
+  CleanupStack::PushL(self);
+  self->ConstructL();
+  return self;
+}
+
+CProcMP3FrameHandler::~CProcMP3FrameHandler() 
+{
+
+    if (iMp3Edit != 0) delete iMp3Edit;
+
+    if (iMpAud != 0)
+        {
+        
+        delete iMpAud;
+        }
+    if (iTHandle != 0)
+        delete iTHandle;
+
+    
+}
+
+CProcMP3FrameHandler::CProcMP3FrameHandler() : decInitialized(EFalse)
+{
+    
+}
+
+void CProcMP3FrameHandler::
+ConstructL() 
+{
+
+    iMp3Edit = CMp3Edit::NewL();
+    
+    iTHandle = new (ELeave) TMpTransportHandle();
+
+    iMp3Edit->InitTransport(iTHandle);
+
+    iMpAud = CMPAudDec::NewL();
+    iMpAud->Init(iTHandle);
+    
+
+}
+
+TBool CProcMP3FrameHandler::
+ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain) 
+{
+
+    aFrameOut = HBufC8::NewLC(aFrameIn->Size());
+
+    aFrameOut->Des().Copy(aFrameIn->Ptr(), aFrameIn->Size());
+
+
+    RArray<TInt> gains;
+    CleanupClosePushL(gains);
+    TInt aMaxGain = 0;
+    TBitStream bs;
+    GetMP3Gains(aFrameOut, gains, aMaxGain, bs);
+    TUint8* globalGains = new (ELeave) TUint8[gains.Count()/2];
+    CleanupStack::PushL(globalGains);
+    TUint* globalGainPos = new (ELeave) TUint[gains.Count()/2];
+    CleanupStack::PushL(globalGainPos);
+
+
+    //for (TInt a = 0 ; a < gains.Count(); a++)
+    for (TInt a = 0 ; a < gains.Count()/2; a++)
+        {
+
+        
+        TInt newGain = aGain*500;
+        newGain = newGain/1500;
+
+        if (gains[a]+newGain < 0) globalGains[a] = 0;
+        else if(gains[a]+newGain > 255) globalGains[a] = 255;
+        else globalGains[a] = static_cast<TUint8>(gains[a*2]+newGain);
+        globalGainPos[a] = gains[a*2+1];
+        }
+    
+//SetMPGlobalGains(BitStream *bs, uint8 numGains, uint8 *globalGain, uint32 *gainPos);
+
+
+    iMp3Edit->SetMPGlobalGains(&bs, static_cast<TUint8>(gains.Count()/2), globalGains, globalGainPos);
+    
+
+    //delete[] globalGains;
+    //delete[] globalGainPos;
+    CleanupStack::PopAndDestroy(globalGainPos);
+    CleanupStack::PopAndDestroy(globalGains);
+    CleanupStack::PopAndDestroy(&gains);
+    CleanupStack::Pop(); // aFrameOut
+    return ETrue;
+    
+}
+
+TBool CProcMP3FrameHandler::
+GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const
+    {
+    RArray<TInt> gains;
+    TBitStream bs;
+    GetMP3Gains(aFrame, gains, aMaxGain, bs);
+    
+
+    for (TInt a = 0 ; a < gains.Count(); a++)
+        {
+        TInt ga = gains[a]-120;
+
+        if (ga < 0) ga = 0;
+
+        ga = ga*ga;
+        ga = ga/50;
+
+        aGains.Append(ga);
+        a++;
+        }
+
+    gains.Reset();
+    aMaxGain = 120;
+    return ETrue;
+    }
+
+TBool CProcMP3FrameHandler::
+GetMP3Gains(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain, TBitStream& aBs) const
+    {
+
+    TInt16 readBytes, frameBytes, headerBytes = 0;
+
+    if (!decInitialized)
+        {
+        iMp3Edit->SeekSync(iTHandle, const_cast<unsigned char*>(aFrame->Ptr()), 
+        aFrame->Length(), &readBytes, 
+        &frameBytes, &headerBytes, (uint8) 1);
+        iMpAud->Init(iTHandle);
+        decInitialized = ETrue;
+        }
+
+
+    int16 i;
+    uint32 globalGainPos[4];
+    uint8 globalGain[4], nBufs;
+    TBitStream bsTmp;
+
+    const TInt headerLength = 4;
+
+    TUint8* buf = const_cast<TUint8*>(aFrame->Right(aFrame->Size()-headerLength).Ptr());
+    BsInit(&aBs, buf, aFrame->Size() - headerLength);
+    BsSaveBufState(&aBs, &bsTmp);
+
+    //BsSaveBufState(&bsIn, &bsTmp);
+
+    nBufs = iMp3Edit->GetMPGlobalGains(&bsTmp, iTHandle, globalGain, globalGainPos);
+
+    for(i = 0; i < nBufs; i++)
+        {
+        TInt gg = globalGain[i];
+        TInt ggp = globalGainPos[i];
+
+        aGains.Append(gg);
+        aGains.Append(ggp);
+        }
+    aMaxGain = 255;
+
+    return (EFalse);
+    
+    }
+
+TBool CProcMP3FrameHandler::
+GetNormalizingMargin(const HBufC8* /*aFrame*/, TInt8& /*aMargin*/) const
+{
+  return (EFalse);
+}
+
+TBool CProcMP3FrameHandler::IsMixingAvailable() const
+{
+    return EFalse;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/codecs/mp3/src/ProcMP3InFileHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1463 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/*-- Project Headers. --*/
+#include "AudPanic.h"
+#include "ProcTools.h"
+#include "ProcMP3InFileHandler.h"
+#include "mpheader.h"
+#include "audconstants.h"
+
+
+#include "ProcMP3FrameHandler.h"
+
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+/*
+   Purpose:     Minimum buffer size for determining the payload size
+                of a free format mp3 bitstream.
+   Explanation: - */
+#define MIN_MP3_FREE_FORMAT_BUF_SIZE (42)
+
+/*
+   Purpose:     Buffer size for searching the start of a mp3 frame.
+   Explanation: - */
+const int16 Kmp3BufSize = 8;
+
+/*
+   Purpose:     Buffer size for determining an avarage frame size of a mp3 stream.
+   Explanation: - */
+const int16 Kmp3BitrateRegions = 4;
+
+/*
+   Purpose:     # of frames processed from each region.
+   Explanation: This is used when the avarage frame size is determined. */
+const int16 Kmp3BitrateNumFrames = 125;
+
+/*
+   Purpose:     Buffer size for determining if a clip is valid mp3
+   Explanation: - */
+const TUint Kmp3TempBufferSize = 4096;
+
+// ID3v2 header's tag offset
+const TUint KSizeOfTagOffset = 6;
+
+// The size of MP3 header, header must include bits for determining frame length
+const TInt KRawMp3FrameHeaderSize = 5;
+
+// Bit rates in bits/sec supported by MPEG2, MPEG1 and MPEG2.5 respectively
+const TInt16 cBitRateTable[3][16] =
+	{
+		{-1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0},
+		{-1,32,40,48,56,64,80,96,112,128,160,192,224,256,320,0},
+		{-1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0},
+	};
+
+// Sampling frequencies supported by MPEG2, MPEG1 and MPEG2.5 respectively
+const TUint16 cSamplingFrequencyTable[3][4] =
+	{
+		{22050,24000,16000,0},
+		{44100,48000,32000,0},
+		{11025,12000,8000,0},
+	};
+
+const TInt KRawMp3MaxFrameSize = 1441;     // 320kbit/s @ 32kHz = int((144*320000/32000)+1)
+
+CProcMP3InFileHandler* CProcMP3InFileHandler::NewL(const TDesC& aFileName, RFile* aFileHandle, CAudClip* aClip, 
+                            TInt aReadBufferSize, TInt aTargetSampleRate, TChannelMode aChannelMode) 
+{
+  CProcMP3InFileHandler* self = NewLC(aFileName, aFileHandle, aClip, aReadBufferSize, 
+                                          aTargetSampleRate, aChannelMode);
+  CleanupStack::Pop(self);
+  
+  return self;
+}
+
+CProcMP3InFileHandler* 
+CProcMP3InFileHandler::NewLC(const TDesC& aFileName, RFile* aFileHandle, CAudClip* aClip, 
+                            TInt aReadBufferSize, TInt aTargetSampleRate, TChannelMode aChannelMode) 
+{
+  CProcMP3InFileHandler* self = new (ELeave) CProcMP3InFileHandler();
+  CleanupStack::PushL(self);
+  self->ConstructL(aFileName, aFileHandle, aClip, aReadBufferSize,
+                      aTargetSampleRate, aChannelMode);
+  
+  return self;
+}
+
+CProcMP3InFileHandler::CProcMP3InFileHandler() : CProcInFileHandler(), mp3FileFormat(0),
+                                                 isValidMP3(0), mp3HeaderBytes(0), 
+                                                 mp3Log(0), isFreeFormatMP3(0), isVbrMP3(0) 
+{
+}
+
+
+
+
+TBool CProcMP3InFileHandler::GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime)
+    {
+    TBool rValue = EFalse;
+
+  if(!iFileOpen) 
+  {
+    TAudPanic::Panic(TAudPanic::EInternal);
+  }
+
+  aSize = 0;
+  aTime = 0;
+  aFrame = NULL;
+
+  if(isValidMP3)
+  {
+    TMpFrameState frState;
+    int16 frameFound;
+    TInt bufSize;
+    TPtr8 mp3DataBuf(mp3HeaderBytes, Kmp3BufSize);
+
+    /*-- Search start of next frame. --*/
+    
+    bufSize = BufferedFileRead((TDes8&) mp3DataBuf);
+    if(bufSize < Kmp3BufSize)
+      ZERO_MEMORY(mp3HeaderBytes + bufSize, Kmp3BufSize - bufSize);
+    frameFound = GetMP3Frame(mp3HeaderBytes, Kmp3BufSize, &frState, 0);
+
+    /*-- Frame found. --*/
+    if(frameFound == 0)
+    {
+      TInt fLen;
+
+      fLen = frState.frameBytes + frState.headerBytes;
+      fLen -= Kmp3BufSize - (frState.readBytes - frState.headerBytes);
+      if(fLen > 0)
+      {
+        TInt offset;
+        uint8 *audFrameOffsetPtr;
+        HBufC8 *audioFrame = HBufC8::NewL(frState.frameBytes + frState.headerBytes);
+
+        offset = frState.readBytes - frState.headerBytes;
+        mp3DataBuf.Set(mp3HeaderBytes + offset, Kmp3BufSize - offset, Kmp3BufSize - offset);
+
+        audioFrame->Des().Copy(((const TDesC8 &) mp3DataBuf));
+
+        audFrameOffsetPtr = (uint8 *) audioFrame->Des().Ptr();
+
+        TPtr8 audTmpPtr(audFrameOffsetPtr + Kmp3BufSize - offset, fLen, fLen);
+
+        bufSize = BufferedFileRead(audTmpPtr, fLen);
+
+        fLen = frState.frameBytes + frState.headerBytes;
+        audioFrame->Des().SetLength(fLen);
+
+        aFrame = audioFrame;
+        aSize = fLen;
+        aTime = iMp3Edit->GetFrameTime(mp3FileFormat);
+        iCurrentTimeMilliseconds += aTime;
+        
+        TRAPD(err, ManipulateGainL(aFrame));
+    
+        if (err != KErrNone)
+            {
+            // something went wrong with the gain manipulation
+            // continue by returning the original frame
+            }
+    
+
+        rValue = ETrue;
+      }
+    }
+  }
+
+
+
+
+  return (rValue);
+    }
+
+
+
+CProcMP3InFileHandler::~CProcMP3InFileHandler() 
+{
+//  if(iFileOpen)
+  CloseFile();
+
+  if (iMp3Edit != 0)
+    {
+      delete iMp3Edit;
+      iMp3Edit = 0;
+    }
+
+  if (iFileName != 0)
+    {
+      delete iFileName;
+      iFileName = 0;
+    }
+    
+  if (iReadBuffer != 0)
+    {
+      delete iReadBuffer;
+      iReadBuffer = 0;
+    }
+
+  if (mp3FileFormat != 0)
+    {
+      delete mp3FileFormat;
+      mp3FileFormat = 0;
+    }
+
+  if (mp3HeaderBytes != 0)
+    {
+      delete mp3HeaderBytes;
+      mp3HeaderBytes = 0;
+    }
+  
+  if (iDecoder != 0)
+    {
+      delete iDecoder;
+      iDecoder = 0;
+    }
+  
+  if (iFrameHandler != 0)
+    {
+      delete iFrameHandler;
+      iFrameHandler = 0;
+    }
+
+  if (iSilentFrame != 0)
+    {
+      delete iSilentFrame;
+      iSilentFrame = 0;
+    }
+}
+
+int16 CProcMP3InFileHandler::
+GetMP3Frame(uint8 *dataBytes, int16 bufSize, TMpFrameState *frState, uint8 syncStatus)
+{
+
+
+  int16 locateFrame;
+  int16 seekSyncStatus = 0;
+  TPtr8 mp3DataBuf(dataBytes, bufSize);
+
+  /*-- Search  start of 1st frame. --*/
+  locateFrame = 0;
+  frState->totalReadBytes = 0;
+  
+  while(locateFrame == 0)
+  {
+    if(syncStatus == 3)
+      seekSyncStatus = iMp3Edit->FreeMode(mp3FileFormat, dataBytes, bufSize, 
+                                   &frState->readBytes, &frState->frameBytes, 
+                                   &frState->headerBytes);
+    else
+      seekSyncStatus = iMp3Edit->SeekSync(mp3FileFormat, dataBytes, bufSize, 
+                                   &frState->readBytes, &frState->frameBytes, 
+                                   &frState->headerBytes, (uint8) syncStatus);
+    
+    /*-- Start of 1st frame found. --*/
+    if(seekSyncStatus == 0 || seekSyncStatus == 3)
+      locateFrame = 1;
+
+    /*-- Update data buffer, start of 1st frame not found yet. --*/
+    else if(seekSyncStatus == 2)
+    {
+      if(frState->readBytes)
+      {
+        TInt tmpBufLen, tmp2;
+
+        /*-- New data bytes to be read into buffer. --*/
+        tmpBufLen = (int16) (bufSize - frState->readBytes);
+
+        /*-- Move data that is possibly left in the buffer. --*/
+        if(tmpBufLen) COPY_MEMORY(dataBytes, dataBytes + frState->readBytes, tmpBufLen);
+
+        /*-- Prepare to read. --*/
+        mp3DataBuf.Set(dataBytes + tmpBufLen, frState->readBytes, frState->readBytes);
+
+        /*-- Update buffer. --*/
+        tmp2 = BufferedFileRead((TDes8&) mp3DataBuf);
+        if(tmp2 < frState->readBytes) 
+          ZERO_MEMORY(dataBytes + tmpBufLen + tmp2, frState->readBytes - tmp2);
+
+        frState->totalReadBytes += frState->readBytes;
+      }
+    }
+
+    /*-- Abort, start of 1st frame cannot be located. --*/
+    else locateFrame = 1;
+  }
+
+  return (seekSyncStatus);
+
+
+}
+
+void CProcMP3InFileHandler::
+ConstructL(const TDesC& aFileName, RFile* aFileHandle, CAudClip* aClip, TInt aReadBufferSize,
+            TInt aTargetSampleRate, TChannelMode aChannelMode) 
+{
+
+
+  iTargetSampleRate = aTargetSampleRate;
+  iChannelMode = aChannelMode;
+
+    
+  int16 locate1stFrame;
+  TMpFrameState frState;
+
+  isVbrMP3 = 0;
+  isValidMP3 = 0;
+  isFreeFormatMP3 = 0;
+
+  //-- Initialize file format handle. --
+  mp3FileFormat = (TMpTransportHandle *) new (ELeave) TMpTransportHandle[1];
+  ZERO_MEMORY(mp3FileFormat, sizeof(TMpTransportHandle));
+
+  //-- Buffer for header search. --
+  mp3HeaderBytes = new (ELeave) uint8[Kmp3BufSize];
+  ZERO_MEMORY(mp3HeaderBytes, Kmp3BufSize);
+  
+  // -- Buffer for validity check --
+  HBufC8* vldBuffer = (HBufC8*) HBufC8::NewLC(Kmp3TempBufferSize);
+
+  iMp3Edit = CMp3Edit::NewL();
+
+   // Set the file format parameters to default values. Note that this function
+   // should be called only once; when searching the start of 1st frame.
+   //
+  iMp3Edit->InitTransport(mp3FileFormat);
+
+  iClip = aClip;
+
+  //-- Open file. --//
+  InitAndOpenFileL(aFileName, aFileHandle, aReadBufferSize);
+
+  TPtr8 mp3DataBuf(mp3HeaderBytes, Kmp3BufSize);
+
+  /*-- Read 1st bytes in. --*/
+  BufferedFileSetFilePos(0);
+  BufferedFileRead((TDes8&) mp3DataBuf);
+  
+  
+  // ----------------------------------------->
+  
+  // Identify ID3v2 header:
+  
+  // more info in http://www.id3.org/
+  
+  TInt tagLen = 0;
+  if (mp3DataBuf.Left(3).Compare(_L8("ID3")) == 0)
+    {
+    
+    const TInt KLenOffset = 6;
+    
+    BufferedFileSetFilePos(KLenOffset);
+    BufferedFileRead((TDes8&) mp3DataBuf);
+    
+    // ID3v2 tag found, calculate lenght:
+
+    const TInt K2Pow7 = 128;
+    const TInt K2Pow14 = 16384;
+    const TInt K2Pow21 = 2097152;
+    
+    tagLen = K2Pow21 * mp3DataBuf[0] + 
+             K2Pow14 * mp3DataBuf[1] +
+             K2Pow7 * mp3DataBuf[2] +
+             mp3DataBuf[3];
+                  
+                  
+    tagLen += 10; // include ID3v2 header
+
+    }
+  
+  // <-----------------------------------------
+
+  BufferedFileSetFilePos(tagLen);
+  
+  TPtr8 vldDes( vldBuffer->Des() );
+  
+  TInt bytesRead = BufferedFileRead((TDes8&) vldDes);
+  vldDes.SetLength(bytesRead);
+    
+  TBool result = Validate(vldDes);
+  
+  CleanupStack::PopAndDestroy(vldBuffer);
+  
+  if (!result)
+  {
+      User::Leave(KErrCorrupt);
+  }
+
+  BufferedFileSetFilePos(tagLen);
+  bytesRead = BufferedFileRead((TDes8&) mp3DataBuf);
+
+  /*-- Search start of 1st frame. --*/
+  locate1stFrame = GetMP3Frame(mp3HeaderBytes, Kmp3BufSize, &frState, 1);
+
+  /*-- If free format, we must determine the payload size of the frames. --*/
+  if(locate1stFrame == 3)
+  {
+    int16 tmpBufLen;
+    uint8 tmpBuf[MIN_MP3_FREE_FORMAT_BUF_SIZE];
+
+    /*-- Switch to larger buffer. --*/
+    tmpBufLen = (int16) (Kmp3BufSize - frState.readBytes);
+    COPY_MEMORY(tmpBuf, mp3HeaderBytes + frState.readBytes, tmpBufLen);
+    if(frState.readBytes)
+    {
+      int16 tmpBufLen2;
+      
+      tmpBufLen2 = (int16) (MIN_MP3_FREE_FORMAT_BUF_SIZE - tmpBufLen);
+      mp3DataBuf.Set(tmpBuf + tmpBufLen, tmpBufLen2, tmpBufLen2);
+      BufferedFileRead((TDes8&) mp3DataBuf);
+    }
+
+    /*-- Determine the payload size. --*/
+    locate1stFrame = GetMP3Frame(tmpBuf, MIN_MP3_FREE_FORMAT_BUF_SIZE, &frState, 3);
+
+    /*-- If payload size known, then go back to the start of 1st frame. --*/
+    if(locate1stFrame == 0)
+    {
+      isFreeFormatMP3 = 1;
+
+      BufferedFileSetFilePos(0);
+      mp3DataBuf.Set(mp3HeaderBytes, Kmp3BufSize, Kmp3BufSize);
+      BufferedFileRead((TDes8&) mp3DataBuf);
+
+      locate1stFrame = GetMP3Frame(mp3HeaderBytes, Kmp3BufSize, &frState, 0);
+    }
+  }
+
+  if(locate1stFrame == 0)
+    isValidMP3 = 1;
+
+  BufferedFileSetFilePos(0);
+
+  TAudFileProperties prop;
+  GetPropertiesL(&prop);
+
+  if (iProperties != 0)
+    {
+      
+      
+      // generate a header -------------->
+      
+      
+      TUint8 byte1 = 0xFF; // sync
+      TUint8 byte2 = 0xFB; // sync + V1,L3 (mp3), no CRC
+      
+      TBuf8<8> byte3B;
+      
+      switch (iProperties->iBitrate)
+      {
+          
+      case (32000):
+          {
+              byte3B.Append(_L8("0001"));
+              break;
+          }
+      case (40000):
+          {
+              byte3B.Append(_L8("0010"));
+              break;
+          }
+      case (48000):
+          {
+              byte3B.Append(_L8("0011"));
+              break;
+          }
+      case (56000):
+          {
+              byte3B.Append(_L8("0100"));
+              break;
+          }
+      case (64000):
+          {
+              byte3B.Append(_L8("0101"));
+              break;
+          }
+      case (80000):
+          {
+              byte3B.Append(_L8("0110"));
+              break;
+          }
+      case (96000):
+          {
+              byte3B.Append(_L8("0111"));
+              break;
+          }
+      case (112000):
+          {
+              byte3B.Append(_L8("1000"));
+              break;
+          }
+      case (128000):
+          {
+              byte3B.Append(_L8("1001"));
+              break;
+          }
+      case (160000):
+          {
+              byte3B.Append(_L8("1010"));
+              break;
+          }
+      case (192000):
+          {
+              byte3B.Append(_L8("1011"));
+              break;
+          }
+      case (224000):
+          {
+              byte3B.Append(_L8("1100"));
+              break;
+          }
+      case (256000):
+          {
+              byte3B.Append(_L8("1101"));
+              break;
+          }
+      case (320000):
+          {
+              byte3B.Append(_L8("1110"));
+              break;
+          }
+      default:
+          {
+          if ( iProperties->iBitrateMode == EAudVariable )
+            {
+            // bitrate for silent frames in variable bitrate mode; use the lowest bitrate. 
+            // However, mp3 is not an output format so this is not so relevant currently
+              byte3B.Append(_L8("0001"));
+            
+            }
+          else
+            {
+            
+              User::Leave(KErrGeneral);
+            }
+              break;
+              
+          }
+          
+      }
+      
+      switch (iProperties->iSamplingRate)
+      {
+          
+      case(44100):
+          {
+              byte3B.Append(_L8("00"));
+              break;
+          }
+      case(48000):
+          {
+              byte3B.Append(_L8("01"));
+              break;
+          }
+      case(32000):
+          {
+              byte3B.Append(_L8("10"));
+              break;
+          }
+      default:
+          {
+              User::Leave(KErrGeneral);
+              break;
+          }
+      }
+      
+      
+      byte3B.Append(_L8("00")); // padding + protection bits
+      
+      TBuf8<8> byte4B;
+      
+      switch (iProperties->iChannelMode)
+      {
+          
+      case(EAudStereo):
+          {
+              byte4B.Append(_L8("00"));
+              break;
+          }
+      case(EAudDualChannel):
+          {
+              byte4B.Append(_L8("10"));
+              break;
+          }
+      case(EAudSingleChannel):
+          {
+              byte4B.Append(_L8("11"));
+              break;
+          }
+      default:
+          {
+              User::Leave(KErrGeneral);
+              break;
+          }
+      }
+      
+      
+      byte4B.Append(_L8("000")); // mode extension, 
+      //    not copyrighted, 
+      
+      if (iProperties->iOriginal)
+      {
+          byte4B.Append(_L8("100"));
+      }
+      else
+      {
+          byte4B.Append(_L8("000"));
+      }
+      //copy of original, no emphasis
+      
+      TInt frameLength;
+      if ( iProperties->iBitrateMode == EAudVariable )
+          {
+          // Use the lowest bitrate for silent frames in variable bitrate mode. 
+          // However, mp3 is not an output format so this is not so relevant currently
+          frameLength = (144*32000)/(iProperties->iSamplingRate);
+          }
+      else
+          {
+          frameLength = (144*iProperties->iBitrate)/(iProperties->iSamplingRate);
+          }
+          
+      iSilentFrame = HBufC8::NewL(frameLength);
+      
+      TUint byte3 = 0;
+      ProcTools::Bin2Dec(byte3B, byte3);
+      
+      TUint byte4 = 0;
+      ProcTools::Bin2Dec(byte4B, byte4);
+      
+      TPtr8 silentFramePtr(iSilentFrame->Des());
+      
+      silentFramePtr.FillZ(frameLength);
+      
+      silentFramePtr[0] = byte1;
+      silentFramePtr[1] = byte2;
+      silentFramePtr[2] = static_cast<TUint8>(byte3);
+      silentFramePtr[3] = static_cast<TUint8>(byte4);
+      iSilentFrameDuration = ProcTools::MilliSeconds(iProperties->iFrameDuration);
+      
+    }
+    
+    if (aClip != 0)
+        {
+        iCutInTime = ProcTools::MilliSeconds(aClip->CutInTime());
+        
+        }
+    
+    iDecoder = CProcDecoder::NewL();
+    
+    iDecodingPossible = iDecoder->InitL(*iProperties, aTargetSampleRate, aChannelMode);
+            
+    iFrameHandler = CProcMP3FrameHandler::NewL();
+
+
+    if (iClip != 0 && iClip->Normalizing())
+        {
+        SetNormalizingGainL(iFrameHandler);    
+        }
+
+}
+
+TBool CProcMP3InFileHandler::Validate(TDes8& aDes)
+{
+
+    const TUint8* bufferPtr = aDes.Ptr();
+    
+    TInt bufferSize = aDes.Length();
+	
+	TInt scannedBuffer = 0;    	
+	TInt lenMetaData = 0;    	
+	TInt syncOffset = 0;
+	TInt bufferPosition = 0;
+	
+    if (lenMetaData == 0)
+        {
+        syncOffset = 0;        
+        lenMetaData = ID3HeaderLength(aDes, bufferPosition);
+        }
+
+    TInt bufferRemaining = bufferSize;
+    
+    while (lenMetaData > 0)
+        {
+	    if (lenMetaData >= bufferRemaining)
+	        {
+	        // this buffer contains all metadata
+	        syncOffset += bufferRemaining;
+	        lenMetaData -= bufferRemaining;
+	        return KErrCorrupt;
+	        }
+	    else
+	        {
+	        syncOffset += lenMetaData;
+	        scannedBuffer += lenMetaData;
+	        // be sure to check for following id3 tags
+	        bufferRemaining = bufferSize - scannedBuffer;	        
+	        bufferPosition = scannedBuffer;	        
+	        lenMetaData = ID3HeaderLength(aDes, bufferPosition);
+    	    }
+        }
+
+
+    TInt seekOffset = 0;    
+    bufferPosition = scannedBuffer;
+    	
+	seekOffset = SeekSync(aDes, bufferPosition);
+
+    syncOffset += seekOffset; // offset to this point from content beginning
+    scannedBuffer += seekOffset; // offset to this point in this buffer
+        
+    bufferPosition = scannedBuffer;
+    
+	if (seekOffset == bufferSize)
+		{        
+        return EFalse;
+		}
+		
+    return ETrue;
+    
+    }
+    
+    
+TInt CProcMP3InFileHandler::SeekSync(TDes8& aDes, TInt aBufPos)
+    {
+    const TUint bufStart = aBufPos;    
+    
+    TInt bufLen = aDes.Length();
+    const TUint8* buf = aDes.Ptr() + bufStart;
+    const TInt KMaxFrames = 3;          // number of frames to check
+    const TInt KNotFound = bufLen;     // sync not found position
+    
+    TInt i = 0;
+    TInt syncPos = KNotFound;
+    TInt maxSeek = KMaxFrames;
+    TInt bitRate = 0;
+        
+    const TUint8* endPtr = buf+bufLen-bufStart;
+
+    // Seek a valid frame candidate byte by byte until a valid frame
+    // is found or all bytes have been checked.
+    while (buf < endPtr  &&  syncPos == KNotFound)
+	    {
+        TInt seekCount = 0;
+        const TUint8* framePtr = buf;
+        TInt frameBufLen = bufLen;
+        syncPos = i;
+
+		// Check the validity of this frame candidate and the nearest next
+        // frames. If they are not OK, syncPos will be set to KNotFound.
+        while (framePtr < endPtr  &&  syncPos != KNotFound  && seekCount < maxSeek)
+	        {
+	        
+            TInt length = FrameInfo(framePtr, frameBufLen, bitRate);
+
+			if (length == 0)
+            	{
+                syncPos = KNotFound;
+				}
+            
+            if ((length > 0) && (bitRate < 0))
+            	{
+                maxSeek = 1; // free formatcase
+				}
+            framePtr += length;
+            frameBufLen -= length;
+            seekCount++;
+
+			// consider SYNC not found if we reach end of buffer before finding 3 SYNC frames
+			if ((framePtr >= endPtr) && (seekCount < maxSeek))
+				{
+				syncPos = KNotFound;
+				buf += (bufLen-1);      // force an exit from while loop				
+				}
+
+        	}
+        buf++; bufLen--; i++;
+    	}
+    return syncPos;
+    }
+
+TInt CProcMP3InFileHandler::FrameInfo(const TUint8* aBuf,TInt aBufLen,TInt& aBitRate)
+    {
+    TInt length = 0;
+    TUint temp;
+    TUint lTempVal;
+
+    TInt samplingRate = 0;
+    TInt id = 0;
+    TInt Padding = 0;
+
+	if (aBufLen >= KRawMp3FrameHeaderSize)
+	    {
+		// Extract header fields to aInfo and check their bit syntax
+		// (including the sync word!). If the syntax is not OK the length
+		// is set to zero.
+
+		temp = 0;
+		temp = aBuf[0] << 24;
+		temp |= (aBuf[1] << 16);
+		temp |= (aBuf[2] << 8);
+		temp |= aBuf[3];
+		if (((temp >> 21) & 0x7FF) != 0x7FF)
+			{
+			return length;
+			}
+
+		lTempVal = (temp >> 19) & 0x03;
+		switch (lTempVal)
+			{
+			case 0:
+				id = 2;  // MPEG2.5				
+				break;
+			case 1:
+				return length;
+			case 2:				
+				id = 0;  // MPEG 2				
+				break;
+			case 3:
+				id = 1;  // MPEG 1				
+				break;
+			}
+
+		lTempVal = (temp >> 17) & 0x03;
+		if (lTempVal != 1)
+			{
+			return length;
+			}
+
+		lTempVal = (temp >> 12) & 0x0F;
+		aBitRate = cBitRateTable[id][lTempVal]*1000;
+
+		if (aBitRate == 0)
+			{
+			return length;
+			}
+
+		lTempVal = (temp >> 10) & 0x03;
+		if (lTempVal == 3)
+			{
+			return length;
+			}
+		else
+			{
+			samplingRate = cSamplingFrequencyTable[id][lTempVal];
+			}
+
+		Padding = (temp >> 9) & 0x01;
+
+		lTempVal = (temp >> 6) & 0x03;
+		
+
+		if (lTempVal == 3)
+			{			
+			}
+		else
+            {            
+            }        
+
+		if (aBitRate == -1)
+			{
+			// For free mode operation
+			length = KRawMp3MaxFrameSize;
+			}
+
+		if (samplingRate > 0  &&  aBitRate > 0)
+			{
+			length = (144*aBitRate)/samplingRate;
+
+			if (id != 1)
+				{
+				length >>= 1; /*for MPEG2 and MPEG2.5 */
+				}
+
+			if (Padding)
+				{
+				length++;
+				}
+			}	
+    	}
+    return length;
+    }
+
+
+TInt CProcMP3InFileHandler::ID3HeaderLength(TDes8& aDes, TInt aPosition)
+    {
+	TInt lenMetaData;	
+	TUint offset = aPosition;
+
+	_LIT8 (KTagID3, "ID3");
+	TPtrC8 searchBuf;
+
+	// Set search buffer	
+	searchBuf.Set(aDes);
+
+    const TUint8* ptr = aDes.Ptr();
+	TInt len = aDes.Length();
+	searchBuf.Set(ptr+offset, len-offset);
+
+    TInt startTagPos = searchBuf.Find (KTagID3);
+	if (startTagPos == KErrNotFound || startTagPos != 0)
+		{
+        lenMetaData = 0;
+		}
+	else
+		{
+        lenMetaData = searchBuf[KSizeOfTagOffset];
+        lenMetaData = ((lenMetaData << 8) | (searchBuf[KSizeOfTagOffset+1] << 1)) >> 1;
+		lenMetaData = ((lenMetaData << 8) | (searchBuf[KSizeOfTagOffset+2] << 1)) >> 1;
+		lenMetaData = ((lenMetaData << 8) | (searchBuf[KSizeOfTagOffset+3] << 1)) >> 1;
+		lenMetaData += 10;
+		}
+
+    return lenMetaData;
+    }
+
+
+int16 
+CProcMP3InFileHandler::GetMP3Bitrate(void)
+{
+
+
+  TMpFrameState frState;
+  int16 bitRate, frameFound, offsetBytes;
+  TPtr8 mp3DataBuf(mp3HeaderBytes, Kmp3BufSize);
+
+  bitRate = 0;
+  isVbrMP3 = 0;
+
+  /*-- Search start of 1st frame. --*/
+  BufferedFileRead((TDes8&) mp3DataBuf);
+  frameFound = GetMP3Frame(mp3HeaderBytes, Kmp3BufSize, &frState, 0);
+
+  /*-- How many unknown bytes at the start of the file? --*/
+  offsetBytes = static_cast<int16>(frState.totalReadBytes + (frState.readBytes - frState.headerBytes));
+
+  /*-- Get bitrate information. --*/
+  if(frameFound == 0)
+  {
+    if(isFreeFormatMP3)
+      bitRate = iMp3Edit->EstimateBitrate(mp3FileFormat, 0);
+
+    /*
+     * Since the mp3 stream is not using free format, we must somehow 
+     * determine the (average) bitrate. Yes, mp3 header includes
+     * information about the bitrate but that's valid only for
+     * the current frame. In case variable coding is used the bitrate
+     * can vary quite a lot depending on the goodness of the encoder
+     * and signal conditions. Also if the mp3 stream is already an edited
+     * version, the bitrate can change quite radicly between different portions
+     * of the file. At the moment we determine the avarage frame size by
+     * dividing the file into 'Kmp3BitrateRegions' regions of equal width
+     * and from each region we determine the average frame size. The 1st
+     * 'Kmp3BitrateNumFrames' frames are used from each region. The final
+     * average frame size is then averaged across each region.
+     * The reason why the bitrate estimation is so complicated is related
+     * to seeking. At the moment we jump to the desired position and in order
+     * to make this jump as accurate as possible we must have accurate information
+     * about the average frame size. The advantages of jumping is that it's fast,
+     * the side effect might be that we jump to incorrect position, the deviation
+     * is negligible with constant bitrate streams but with variable bitrate streams
+     * this can lead to quite large deviations, especially if the stream is using 
+     * the full range of allowed bitrates. Fortunately, this is not the case in 
+     * typical mp3 streams but after a series of editing we might have a 
+     * file where bitrate changes are significant. Of course this means also that
+     * the quality is not so good either, so probably the user will never create
+     * such files due to poor sound quality...
+     * 
+     * The other approach would be the loop each frame and store frame positions,
+     * let's say for every second. Works great, but the side effect is quite considerable
+     * delay, since it certainly takes some time to process 5000-10000 mp3 frames...
+     */
+    else
+    {
+      int32 fPosOffset[Kmp3BitrateRegions];
+      TInt fileSize, stepSize, nRegions, byteOffset;
+
+      if(iFile.Size(fileSize) == KErrNone)
+      {
+        uint8 idx;
+        int32 nFrames;
+        int16 prevBitRate;
+        TMPEG_Header *header;
+        TInt ProcessingOnGoing;
+
+        fileSize -= offsetBytes;
+        if(fileSize < 0)
+          return (0);
+
+        header = &mp3FileFormat->header;
+
+        /*-- Build the data region boundaries. --*/
+        nRegions = 1;
+        stepSize = fileSize / Kmp3BitrateRegions;
+        byteOffset = stepSize;
+        fPosOffset[0] = stepSize;
+        TInt i = 0;
+        for(i = 1; i < Kmp3BitrateRegions - 1; i++)
+        {
+          byteOffset += stepSize;
+          if(byteOffset < fileSize)
+          {
+            nRegions++;
+            fPosOffset[i] = byteOffset;
+          }
+          else break;
+        }
+
+        idx = 0;
+        nFrames = 0;
+        ProcessingOnGoing = 1;
+        mp3FileFormat->aveFrameLen = 0;
+
+        prevBitRate = bit_rate(header);
+
+        /*-- Process each data region and accumulate the frame size. --*/
+        while(ProcessingOnGoing)
+        {
+          TInt rValue, bufSize;
+
+          for(i = 0; i < Kmp3BitrateNumFrames; i++)
+          {
+            TInt fLen;
+
+            nFrames++;
+            fLen = static_cast<int16>(frState.frameBytes + frState.headerBytes);
+
+            frameFound = 2;
+            mp3FileFormat->aveFrameLen += fLen;
+
+            /*-- Check whether bitrate changed => variable bitrate. --*/
+            if(!isVbrMP3)
+              if(prevBitRate != bit_rate(header))
+                isVbrMP3 = 1;
+
+            /*
+             * Skip the payload, remember that the input buffer has 'Kmp3BufSize'
+             * bytes already that belong to the current mp3 frame. These bytes
+             * need to be compensated before jumping to the start of next frame.
+             */
+            fLen -= static_cast<int16>(Kmp3BufSize - (frState.readBytes - frState.headerBytes)); 
+            if(fLen < 0) fLen = 1;
+            rValue = BufferedFileSetFilePos(BufferedFileGetFilePos() + fLen);
+
+            if(rValue) 
+            {
+              /*-- Read new data for parsing of next frame. --*/
+              bufSize = BufferedFileRead((TDes8&) mp3DataBuf);
+              if(bufSize < Kmp3BufSize)
+                ZERO_MEMORY(mp3HeaderBytes + bufSize, Kmp3BufSize - bufSize);
+
+              frameFound = GetMP3Frame(mp3HeaderBytes, Kmp3BufSize, &frState, 0);
+            }
+            
+            if(frameFound != 0)
+            {
+              ProcessingOnGoing = 0;
+              break;
+            }
+          }
+
+          if(ProcessingOnGoing && idx < nRegions)
+          {
+            frameFound = 2;
+
+            /*-- Seek to start of next data region. --*/
+            rValue = BufferedFileSetFilePos(fPosOffset[idx++]);
+
+            if(rValue)
+            {
+              /*-- Read new data and search start of frame. --*/
+              bufSize = BufferedFileRead((TDes8&) mp3DataBuf);
+              if(bufSize < Kmp3BufSize)
+                ZERO_MEMORY(mp3HeaderBytes + bufSize, Kmp3BufSize - bufSize);
+
+              frameFound = GetMP3Frame(mp3HeaderBytes, Kmp3BufSize, &frState, 0);
+            }
+
+            if(frameFound != 0)
+              ProcessingOnGoing = 0;
+          }
+          else ProcessingOnGoing = 0;
+        }
+
+        if(frameFound != 0)
+        {
+          mp3FileFormat->execState.execMode = GLITCH_FREE;
+          mp3FileFormat->header.header = mp3FileFormat->headerOld.header;
+        }
+
+        /*-- Average frame length, in bytes. --*/
+        if(nFrames)
+        {
+          FLOAT tmp;
+
+          tmp = mp3FileFormat->aveFrameLen / (FLOAT) nFrames;
+          mp3FileFormat->aveFrameLen = (int16) (tmp + 0.5f);
+        }
+
+        /*-- This is our estimated bitrate. --*/
+        bitRate = iMp3Edit->EstimateBitrate(mp3FileFormat, 1);
+      }
+    }
+  }
+  return (bitRate);
+
+}
+
+void 
+CProcMP3InFileHandler::GetPropertiesL(TAudFileProperties* aProperties) 
+{
+    PRINT((_L("CProcMP3InFileHandler::GetPropertiesL in") ));
+
+
+    if (iProperties != 0)
+        {
+        *aProperties = *iProperties;
+        return;
+        }
+
+    if(iFileOpen) 
+        {
+        TInt origFilePos = iFilePos;
+
+        aProperties->iFileFormat = EAudFormatUnrecognized;
+        aProperties->iAudioType = EAudTypeUnrecognized;
+        aProperties->iAudioTypeExtension = EAudExtensionTypeNoExtension;
+        aProperties->iBitrate = 0;
+        aProperties->iBitrateMode = EAudBitrateModeNotRecognized;
+        aProperties->iChannelMode = EAudChannelModeNotRecognized;
+        aProperties->iDuration = 0;
+        aProperties->iSamplingRate = 0;
+        aProperties->iFrameLen = 0;
+        aProperties->iFrameCount = 0;
+
+        /*-- First mp3 frame found? --*/
+        if(isValidMP3)
+            {
+            TMPEG_Header *header;
+
+            header = &mp3FileFormat->header;
+
+            /*-- Seek to start of file. --*/
+            BufferedFileSetFilePos(0);
+
+          
+
+            if (version(header) != 1)
+                {
+                PRINT((_L("CProcMP4InFileHandler::GetPropertiesL header unsupported, leaving") ));
+                User::Leave(KErrNotSupported);
+                return;
+                }
+
+
+            /*-- Determine bitrate. --*/
+            aProperties->iBitrate = GetMP3Bitrate();
+
+         
+            if(aProperties->iBitrate)
+                {
+                TInt fileSize;
+
+                iFile.Size(fileSize);
+
+                aProperties->iAudioType = EAudMP3;
+                aProperties->iFileFormat = EAudFormatMP3;
+                aProperties->iBitrateMode = (!isVbrMP3) ? EAudConstant : EAudVariable;
+
+                /*-- Determine channel mode. --*/
+                switch(mode(header))
+                    {
+                    case 0:
+                    case 1:
+                        aProperties->iChannelMode = EAudStereo;
+                        break;
+
+                    case 2:
+                        aProperties->iChannelMode = EAudDualChannel;
+                        break;
+
+                    case 3:
+                    default:
+                        aProperties->iChannelMode = EAudSingleChannel;
+                        break;
+                    }
+
+                /*-- Estimate duration. --*/
+                TInt64 tmp = (TInt64)iMp3Edit->FileLengthInMs(mp3FileFormat, fileSize) * 1000;
+                TTimeIntervalMicroSeconds durationMicro(tmp);
+                aProperties->iDuration = durationMicro;
+
+                aProperties->iSamplingRate = frequency(header);
+                
+                // Check that the sample rate is supported    
+                if( (aProperties->iSamplingRate != KAedSampleRate8kHz) &&
+                    (aProperties->iSamplingRate != KAedSampleRate11kHz) &&
+                    (aProperties->iSamplingRate != KAedSampleRate16kHz) &&
+                    (aProperties->iSamplingRate != KAedSampleRate22kHz) &&
+                    (aProperties->iSamplingRate != KAedSampleRate24kHz) &&
+                    (aProperties->iSamplingRate != KAedSampleRate32kHz) &&
+                    (aProperties->iSamplingRate != KAedSampleRate44kHz) &&
+                    (aProperties->iSamplingRate != KAedSampleRate48kHz) )
+                    {
+                    User::Leave(KErrNotSupported);
+                    }
+
+                aProperties->iFrameLen = mp3FileFormat->aveFrameLen;
+            
+                // casting for PC-Lint
+                tmp = (TInt64) (TInt)(iMp3Edit->GetFrameTime(mp3FileFormat) * 1000);
+                aProperties->iFrameDuration = tmp;
+                aProperties->iFrameCount = ProcTools::GetTInt((aProperties->iDuration).Int64()/(aProperties->iFrameDuration).Int64());
+
+                if (((TUint32)header->header & 0x4) != 0)
+                    {
+
+                    aProperties->iOriginal = ETrue;
+                
+                    }
+
+                BufferedFileSetFilePos(origFilePos);
+                }
+            }
+        else
+            {
+            PRINT((_L("CProcMP4InFileHandler::GetPropertiesL could not parse frames, leaving") ));
+            User::Leave(KErrNotSupported);
+            }
+        }
+    else 
+    {
+        TAudPanic::Panic(TAudPanic::EInternal);
+    }
+
+    // bitrate is bytes not kilobytes
+    aProperties->iBitrate *= 1000;
+
+
+    if (iProperties == 0)
+    {
+        iProperties = new (ELeave) TAudFileProperties;
+        *iProperties = *aProperties;
+        
+    }
+    
+}
+
+TBool 
+CProcMP3InFileHandler::SeekAudioFrame(TInt32 aTime) 
+{
+  TBool rValue = EFalse;
+
+
+
+  if(!iFileOpen) 
+  {
+    TAudPanic::Panic(TAudPanic::EInternal);
+  }
+
+  if(isValidMP3)
+  {
+    int32 fPos;
+    
+    mp3FileFormat->aveFrameLen = iProperties->iFrameLen;
+    fPos = iMp3Edit->GetSeekOffset(mp3FileFormat, aTime);
+
+    BufferedFileSetFilePos(fPos);
+
+    iCurrentTimeMilliseconds = aTime;
+
+    rValue = ETrue;
+  }
+
+
+
+  return (rValue);
+}    
+
+TBool 
+CProcMP3InFileHandler::SeekCutInFrame() 
+{
+  iCurrentTimeMilliseconds = iCutInTime;
+
+  return SeekAudioFrame(iCutInTime);
+}
+
+
+TBool 
+CProcMP3InFileHandler::GetDurationL(TInt32& aTime, TInt& aFrameAmount) 
+{
+  TBool rValue = EFalse;
+
+
+
+  if(!iFileOpen) 
+  {
+    TAudPanic::Panic(TAudPanic::EInternal);
+  }
+
+  aTime = 0;
+  aFrameAmount = 0;
+
+  if(isValidMP3)
+  {
+    TInt filePos;
+    TAudFileProperties aProperties;
+    
+    filePos = iFilePos;
+
+    GetPropertiesL(&aProperties); 
+
+    if(aProperties.iBitrate)
+    {
+      rValue = ETrue;
+      aTime = ProcTools::MilliSeconds(aProperties.iDuration);
+      aFrameAmount = aTime / iMp3Edit->GetFrameTime(mp3FileFormat);
+    }
+
+    BufferedFileSetFilePos(filePos);
+  }
+    
+
+  return (rValue);
+}
+
+
+TBool 
+CProcMP3InFileHandler::SetNormalizingGainL(const CProcFrameHandler* aFrameHandler)
+{
+    
+    HBufC8* point = 0;
+    TInt siz;
+    TInt32 tim = 0;
+    TInt maxGain = 0;
+    RArray<TInt> gains;
+    TInt maxAverage = 0;
+    TInt tmpGain = 0;
+    TInt gainCounter = 0;
+    TInt timeNow = 0;
+    TBitStream bs;
+
+    while(GetEncAudioFrameL(point, siz, tim)) 
+    {
+        timeNow += tim;
+        ((CProcMP3FrameHandler*) aFrameHandler)->GetMP3Gains(point, gains, maxGain, bs);
+        
+        for (TInt a = 0 ; a < gains.Count() ; a = a+2)
+        {
+            tmpGain += gains[a];
+            gainCounter++;
+        }
+        gains.Reset();
+        
+        if (timeNow > 1000)
+        {
+            if (tmpGain/gainCounter > maxAverage)
+            {
+                maxAverage = tmpGain/gainCounter;
+            }
+            
+            timeNow = 0;
+            tmpGain = 0;
+            gainCounter = 0;
+        }
+        
+        delete point;
+        
+    }
+
+    // bigger value makes normalizing more efficient, but makes
+    // dynamic compression more likely to occur
+    TInt NormalizingFactor = 179;
+    if (iProperties->iBitrate > 20000 && iProperties->iBitrate < 40000)
+    {
+        
+        // 32 kBit/s
+        NormalizingFactor = 187;
+        
+    }
+    else if (iProperties->iBitrate > 40000 && iProperties->iBitrate < 80000)
+    {
+        // 64 kBit/s
+        NormalizingFactor = 181;
+        
+    }
+    
+    
+    else if (iProperties->iBitrate > 80000 && iProperties->iBitrate < 140000)
+    {
+        // 128 kBit/s
+        if (iProperties->iChannelMode == EAudSingleChannel)
+            NormalizingFactor = 170;
+        else
+            NormalizingFactor = 179;
+        
+    }
+    else if (iProperties->iBitrate > 140000)
+    {
+        // 256 kBit/s
+        if (iProperties->iChannelMode == EAudSingleChannel)
+            NormalizingFactor = 155;
+        else
+            NormalizingFactor = 167;
+        
+    }
+    else
+    {
+        
+        if (iProperties->iChannelMode == EAudSingleChannel)
+            NormalizingFactor = 170;
+        
+    }
+    
+    
+    TInt gainBoost = (NormalizingFactor-maxAverage)*3;
+    
+    if (gainBoost < 0) gainBoost = 0;
+    
+    iNormalizingMargin = static_cast<TInt8>(gainBoost);
+
+    SeekAudioFrame(0);
+
+    mp3FileFormat->execState.a0_s16[0] = 0;
+    mp3FileFormat->execState.a0_s16[1] = 0;
+    mp3FileFormat->execState.a0_s16[2] = 0;
+
+    mp3FileFormat->execState.a0_u32[0] = 0;
+    mp3FileFormat->execState.a0_u32[1] = 0;
+    mp3FileFormat->execState.a0_u32[2] = 0;
+
+
+
+    
+    return ETrue;
+    
+    
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/eabi/aedengineu.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,64 @@
+EXPORTS
+	_ZN12CAudClipInfo19CancelVisualizationEv @ 1 NONAME
+	_ZN12CAudClipInfo4NewLERK7TDesC16R20MAudClipInfoObserver @ 2 NONAME
+	_ZN12CAudClipInfo5NewLCERK7TDesC16R20MAudClipInfoObserver @ 3 NONAME
+	_ZN12CAudClipInfoD0Ev @ 4 NONAME
+	_ZN12CAudClipInfoD1Ev @ 5 NONAME
+	_ZN12CAudClipInfoD2Ev @ 6 NONAME
+	_ZN8CAudClip11SetPriorityEi @ 7 NONAME
+	_ZN8CAudClip12SetCutInTimeE25TTimeIntervalMicroSeconds @ 8 NONAME
+	_ZN8CAudClip12SetStartTimeE25TTimeIntervalMicroSeconds @ 9 NONAME
+	_ZN8CAudClip13GetVolumeGainEv @ 10 NONAME
+	_ZN8CAudClip13SetCutOutTimeE25TTimeIntervalMicroSeconds @ 11 NONAME
+	_ZN8CAudClip13SetVolumeGainEi @ 12 NONAME
+	_ZN8CAudClip14SetNormalizingEi @ 13 NONAME
+	_ZN8CAudClip22RemoveDynamicLevelMarkEi @ 14 NONAME
+	_ZN8CAudClip23InsertDynamicLevelMarkLERK20TAudDynamicLevelMark @ 15 NONAME
+	_ZN8CAudClip5ResetEi @ 16 NONAME
+	_ZN8CAudClip9SetMutingEi @ 17 NONAME
+	_ZN8CAudSong10RemoveClipEii @ 18 NONAME
+	_ZN8CAudSong11SetDurationE25TTimeIntervalMicroSeconds @ 19 NONAME
+	_ZN8CAudSong16GetTimeEstimateLER24MAudTimeEstimateObserver8TAudTypei12TChannelModei @ 20 NONAME
+	_ZN8CAudSong16GetTimeEstimateLEv @ 21 NONAME
+	_ZN8CAudSong17SyncCancelProcessEv @ 22 NONAME
+	_ZN8CAudSong17SyncProcessFrameLERP6HBufC8RiR25TTimeIntervalMicroSeconds @ 23 NONAME
+	_ZN8CAudSong19SetOutputFileFormatE8TAudTypei12TChannelModei @ 24 NONAME
+	_ZN8CAudSong20SyncStartProcessingLEv @ 25 NONAME
+	_ZN8CAudSong21GetFrameDurationMicroEv @ 26 NONAME
+	_ZN8CAudSong21RegisterSongObserverLEP16MAudSongObserver @ 27 NONAME
+	_ZN8CAudSong22UnregisterSongObserverEP16MAudSongObserver @ 28 NONAME
+	_ZN8CAudSong28AreOutputPropertiesSupportedERK18TAudFileProperties @ 29 NONAME
+	_ZN8CAudSong4NewLEP3RFs @ 30 NONAME
+	_ZN8CAudSong5NewLCEP3RFs @ 31 NONAME
+	_ZN8CAudSong5ResetEi @ 32 NONAME
+	_ZN8CAudSong8AddClipLERK7TDesC1625TTimeIntervalMicroSecondsiS3_S3_ @ 33 NONAME
+	_ZN8CAudSongD0Ev @ 34 NONAME
+	_ZN8CAudSongD1Ev @ 35 NONAME
+	_ZN8CAudSongD2Ev @ 36 NONAME
+	_ZNK12CAudClipInfo10PropertiesEv @ 37 NONAME
+	_ZNK12CAudClipInfo17GetVisualizationLER25MAudVisualizationObserverii @ 38 NONAME
+	_ZNK12CAudClipInfo8FileNameEv @ 39 NONAME
+	_ZNK8CAudClip10CutOutTimeEv @ 40 NONAME
+	_ZNK8CAudClip10TrackIndexEv @ 41 NONAME
+	_ZNK8CAudClip11NormalizingEv @ 42 NONAME
+	_ZNK8CAudClip12IndexOnTrackEv @ 43 NONAME
+	_ZNK8CAudClip14EditedDurationEv @ 44 NONAME
+	_ZNK8CAudClip16DynamicLevelMarkEi @ 45 NONAME
+	_ZNK8CAudClip21DynamicLevelMarkCountEv @ 46 NONAME
+	_ZNK8CAudClip4InfoEv @ 47 NONAME
+	_ZNK8CAudClip6MutingEv @ 48 NONAME
+	_ZNK8CAudClip7EndTimeEv @ 49 NONAME
+	_ZNK8CAudClip8PriorityEv @ 50 NONAME
+	_ZNK8CAudClip9CutInTimeEv @ 51 NONAME
+	_ZNK8CAudClip9StartTimeEv @ 52 NONAME
+	_ZNK8CAudSong16GetSizeEstimateLEv @ 53 NONAME
+	_ZNK8CAudSong20OutputFilePropertiesEv @ 54 NONAME
+	_ZNK8CAudSong21GetFrameSizeEstimateLE25TTimeIntervalMicroSecondsS0_ @ 55 NONAME
+	_ZNK8CAudSong27GetMP4DecoderSpecificInfoLCERP6HBufC8i @ 56 NONAME
+	_ZNK8CAudSong4ClipEii @ 57 NONAME
+	_ZNK8CAudSong9ClipCountEi @ 58 NONAME
+	_ZN12CAudClipInfo4NewLEP5RFileR20MAudClipInfoObserver @ 59 NONAME
+	_ZN12CAudClipInfo5NewLCEP5RFileR20MAudClipInfoObserver @ 60 NONAME
+	_ZN8CAudSong8AddClipLEP5RFile25TTimeIntervalMicroSecondsiS2_S2_ @ 61 NONAME
+	_ZNK12CAudClipInfo10FileHandleEv @ 62 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/group/AedEngine.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+
+TARGET          aedengine.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10204BF2
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+NOEXPORTLIBRARY
+
+SOURCEPATH     ../src
+
+SOURCE         AudPanic.cpp
+SOURCE         AudClip.cpp
+SOURCE         AudClipInfo.cpp
+SOURCE         AudSong.cpp
+SOURCE         AudProcessor.cpp
+SOURCE         ProcClipInfoAO.cpp
+SOURCE         ProcProcessAO.cpp
+SOURCE         ProcVisualizationAO.cpp
+SOURCE         ProcVisProcessor.cpp
+SOURCE         ProcInFileHandler.cpp
+SOURCE         ProcEncoder.cpp
+SOURCE		     ProcDecoder.cpp
+SOURCE		     ProcTimeEstimateAO.cpp
+SOURCE         RateConverter.cpp
+SOURCE         AudProcessorImpl.cpp
+SOURCE         ProcTools.cpp
+
+// AMR
+SOURCE         ProcFrameHandler.cpp
+SOURCE         ../codecs/AMR/src/ProcAMRFrameHandler.cpp
+SOURCE         ../codecs/AMR/src/ProcAMRInFileHandler.cpp
+
+// AAC
+SOURCE	       ../codecs/AAC/src/ProcAACFrameHandler.cpp
+SOURCE	       ../codecs/AAC/src/ProcADTSInFileHandler.cpp
+
+// MP4
+SOURCE         ../codecs/MP4/src/ProcMP4InFileHandler.cpp
+SOURCE	       ../codecs/MP4/src/mp4aud.cpp
+
+// MP3
+SOURCE         ../codecs/mp3/src/ProcMP3InFileHandler.cpp
+SOURCE         ../codecs/mp3/src/ProcMP3FrameHandler.cpp
+
+// AMR-WB
+SOURCE         ../codecs/AWB/src/ProcAWBInFileHandler.cpp
+SOURCE         ../codecs/AWB/src/ProcAWBFrameHandler.cpp
+
+// WAV
+SOURCE	       ../codecs/WAV/src/ProcWAVInFileHandler.cpp
+SOURCE	       ../codecs/WAV/src/ProcWAVFrameHandler.cpp
+
+SOURCE         ../util/src/Logfile.cpp
+
+SOURCE         ../resampler/src/resampler_rate_conversion_input_driven_int16.cpp
+SOURCE         ../resampler/src/resampler_rate_conversion_output_driven_int16.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_44_to_48_int16.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_44_to_48_tables_economy.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_44_to_48_tables_premium.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_44_to_48_tables_standard.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_one_to_three_int16.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_one_to_three_tables_standard.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_one_to_two_int16.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_one_to_two_tables_standard.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_two_to_three_int16.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_two_to_three_tables_standard.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_three_to_one_int16.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_three_to_one_tables_standard.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_two_to_one_int16.cpp
+SOURCE         ../resampler/src/resampler_sinc_conv_two_to_one_tables_standard.cpp
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE   /epoc32/include/libc 
+SYSTEMINCLUDE   /epoc32/include/mmf/server
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+
+USERINCLUDE    ../inc
+USERINCLUDE    ../util/inc
+USERINCLUDE    ../resampler/inc 
+
+USERINCLUDE    ../codecs/AAC/inc
+USERINCLUDE    ../codecs/AMR/inc
+USERINCLUDE    ../codecs/AWB/inc
+USERINCLUDE    ../codecs/mp3/inc
+USERINCLUDE    ../codecs/MP4/inc
+USERINCLUDE    ../codecs/WAV/inc
+
+USERINCLUDE    ../../mp3aacManipLib/inc
+USERINCLUDE    ../../mp3aacManipLib/AACGain/inc
+USERINCLUDE    ../../mp3aacManipLib/MP3Gain/inc
+
+LIBRARY		     euser.lib efsrv.lib charconv.lib hal.lib 
+LIBRARY        estlib.lib
+LIBRARY        3GPMP4Lib.lib
+
+LIBRARY		     aedmp3aaclib.lib
+LIBRARY 	     mmfserverbaseclasses.lib    // Audioconverter: MMFCodec
+LIBRARY        ecom.lib                    // Audioconverter: REComSession
+
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/group/AedEngineLib.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+
+TARGET          aedengine.lib
+TARGETTYPE      IMPLIB
+UID             0x1000008d 0x10204BF2
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+AedEngine.mmp
+AedEngineLib.mmp
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/AudClip.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,387 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#ifndef __AUDCLIP_H__
+#define __AUDCLIP_H__
+
+    
+
+#include <e32base.h>
+#include <f32file.h>
+
+
+#include "AudCommon.h"
+#include "AudObservers.h"
+
+/*
+*    Forward declarations.
+*/
+
+class CAudSong;
+class CAudSongObserver;
+class CAudClipInfo;
+class MAudClipInfoObserver;
+
+
+/*
+*  Constant definitions.
+*/
+
+
+/**
+* Individual audio clip stored as a single bitstream.
+*
+* @see CAudSong
+*/
+class CAudClip : public CBase
+    {
+public:
+    
+    /* Property methods. */
+    
+    /**
+    * Returns an audio clip info object to get detailed information about
+    * the original audio clip. Note that the specified editing operations 
+    * (for example, cutting or muting) do <em>not</em>
+    * affect the values returned by the info object.
+    * 
+    * @return  pointer to an audio clip info instance
+    */
+    IMPORT_C CAudClipInfo* Info() const;
+    
+    /**
+    * Returns a boolean value that indicates whether this clip is normalized
+    * 
+    * @return  ETrue if normalized, EFalse otherwise
+    */
+    IMPORT_C TBool Normalizing() const;
+    
+    /**
+    * Returns a dynamic level mark at the specified index
+    * If the index is illegal, the method panics with the code 
+    * <code>EIllegalDynamicLevelMarkIndex</code> 
+    *
+    * @return  A dynamic level mark
+    */
+    IMPORT_C TAudDynamicLevelMark DynamicLevelMark(TInt aIndex) const;
+    
+    /**
+    * Returns the number of dynamic level marks
+    * 
+    * @return  The number of dynamic level mark
+    */
+    IMPORT_C TInt DynamicLevelMarkCount() const;
+
+    /**
+    * Returns whether this clip is muted or not
+    * 
+    * @return  muting
+    */
+    IMPORT_C TBool Muting() const;
+
+    /**
+    * Sets the start time of this audio clip in clip timebase.
+    * Panics with <code>EAudioClipIllegalStartTime</code> if
+    * cut in time is illegal (negative).
+    *
+    * @param aCutInTime  cut in time in microseconds in clip timebase
+    */
+    IMPORT_C void SetStartTime(TTimeIntervalMicroSeconds aStartTime);
+
+    /**
+    * Returns the start time of this audio clip in song timebase.
+    *
+    * @return  start time in microseconds in song timebase
+    */
+    IMPORT_C TTimeIntervalMicroSeconds StartTime() const;
+    
+    /**
+    * Returns the start time of this audio clip in song timebase.
+    *
+    * @return  start time in milliseconds in song timebase
+    */
+    TInt32 StartTimeMilliSeconds() const;
+    
+
+    /**
+    * Returns the end time of this audio clip in song timebase.
+    *
+    * @return  end time in microseconds in song timebase
+    */
+    IMPORT_C TTimeIntervalMicroSeconds EndTime() const;
+    
+    /**
+    * Returns the duration of this audio clip with the specified
+    * editing operations applied (for example, cutting)
+    * 
+    * @return  duration in microseconds
+    */
+    IMPORT_C TTimeIntervalMicroSeconds EditedDuration() const;
+    
+    /**
+    * Returns the priority of this audio clip 
+    *
+    * @return  priority
+    */
+    IMPORT_C TInt Priority() const;
+
+    /**
+    * Returns the index of this audio clip __on a track__
+    *
+    * @return  index
+    */
+    IMPORT_C TInt IndexOnTrack() const;
+
+    
+    /**
+    * Returns the track index of this audio clip in CAudSong
+    *
+    * @return  track index
+    */
+    IMPORT_C TInt TrackIndex() const;
+
+
+
+    /* Song methods. */
+    
+    /**
+    * Returns the song that this audio clip is part of.
+    * 
+    * @return  song
+    */
+    IMPORT_C CAudSong* Song() const;
+    
+    /* Timing methods. */
+    
+    /**
+    * Returns the cut in time of this audio clip in clip timebase.
+    *
+    * @return  cut in time in microseconds in clip timebase
+    */
+    IMPORT_C TTimeIntervalMicroSeconds CutInTime() const;
+
+    /**
+    * Returns the cut in time of this audio clip in clip timebase.
+    *
+    * @return  cut in time in milliseconds in clip timebase
+    */
+    TInt32 CutInTimeMilliSeconds() const;
+    
+    /**
+    * Sets the cut in time of this audio clip in clip timebase.
+    * Panics with <code>EAudioClipIllegalCutInTime</code> if
+    * cut in time is illegal.
+    *
+    * @param aCutInTime  cut in time in microseconds in clip timebase
+    */
+    IMPORT_C void SetCutInTime(TTimeIntervalMicroSeconds aCutInTime);
+    
+    /**
+    * Returns the cut out time of this audio clip in clip timebase.
+    *
+    * @return  cut out time in microseconds in clip timebase
+    */
+    IMPORT_C TTimeIntervalMicroSeconds CutOutTime() const;
+    
+    /**
+    * Returns the cut out time of this audio clip in clip timebase.
+    *
+    * @return  cut out time in milliseconds in clip timebase
+    */
+    TInt32 CutOutTimeMilliSeconds() const;
+
+    /**
+    * Sets the cut out time of this audio clip in clip timebase. 
+    * Panics with <code>EAudioClipIllegalCutOutTime</code> if
+    * cut out time is illegal.
+    *
+    * @param aCutOutTime  cut out time in microseconds in clip timebase
+    */
+    IMPORT_C void SetCutOutTime(TTimeIntervalMicroSeconds aCutOutTime);
+        
+    /**
+    * Sets the priority of this audio clip
+    *
+    * @param        aPriority priority, >= 0
+    *
+    * @return        ETrue if aPriority >= 0
+    *                EFalse if aPriority < 0, priority not set
+    *
+    */
+    IMPORT_C TBool SetPriority(TInt aPriority);
+    
+    
+    /* Processing methods */
+    
+    /**
+    * Inserts a dynamic level mark to a clip.
+    * If time of the given mark is illegal
+    * <code>EIllegalDynamicLevelMark</code>-panic is raised
+    *
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *
+    * @param    aMark mark to be added in clip time domain
+    * @return   index of the mark inserted
+    */
+    IMPORT_C TInt InsertDynamicLevelMarkL(const TAudDynamicLevelMark& aMark);
+    
+    /**
+    * Removes a dynamic level mark in a clip.
+    * Panics with code <code>EAudioClipIllegalIndex</code> 
+    * if the clip index is invalid.
+    *
+    * @param    aIndex index of the removed mark in this clip
+    * @return  ETrue if mark was removed, EFalse otherwise
+    */
+    IMPORT_C TBool RemoveDynamicLevelMark(TInt aIndex);
+    
+    /**
+    * Sets whether this clip is muted or not.
+    *
+    * @param aMuting  <code>ETrue</code> to mute the audio clip;
+    *                 <code>EFalse</code> not to mute the audio clip
+    */
+    IMPORT_C void SetMuting(TBool aMuted);
+    
+    /**
+    * Sets whether this clip is normalized
+    * 
+    * @param  aNormalizing <code>ETrue</code> if normalized 
+    *                        <code>EFalse</code> otherwise
+    */
+    IMPORT_C void SetNormalizing(TBool aNormalizing);
+    
+    IMPORT_C void Reset(TBool aNotify);
+
+    /**
+    * Sets common volume gain for the clip. It is used to store
+    * the gain; the actual processing will be based on dynamic level
+    * marks which are set based on the gain value just before processing.
+    * Since global gain setting may affect the dynamic level mark,
+    * we need different variable to store the clip-specific gain also after the processing.
+    * I.e. dynamic level marks do not have effect to this value.
+    *
+    * @param aVolumeGain
+    */
+    IMPORT_C void SetVolumeGain(TInt aVolumeGain);
+    
+    /**
+    * Gets common volume gain for the clip. 
+    * Since global gain setting may affect the dynamic level mark,
+    * we need different variable to store the clip-specific gain also after the processing.
+    *
+    * @param aVolumeGain
+    */
+    IMPORT_C TInt GetVolumeGain();
+    
+    /**
+    *
+    * Compare is used by RPointerArray::Sort()
+    *
+    */
+    static TInt Compare(const CAudClip &c1, const CAudClip &c2);
+
+
+protected: 
+    
+    
+private:
+    
+    
+    
+    /* Constructors. */
+    
+    static CAudClip* NewL(CAudSong* aSong, const TDesC& aFileName,
+        TTimeIntervalMicroSeconds aStartTime,                            
+        MAudClipInfoObserver& aObserver, TInt aTrackIndex);
+        
+    static CAudClip* NewL(CAudSong* aSong, RFile* aFileHandle,
+        TTimeIntervalMicroSeconds aStartTime,                            
+        MAudClipInfoObserver& aObserver, TInt aTrackIndex);
+    
+    CAudClip(CAudSong* aSong);
+    
+    void ConstructL(const TDesC& aFileName,
+        TTimeIntervalMicroSeconds aStartTime,                            
+        MAudClipInfoObserver& aObserver, TInt aTrackIndex);
+        
+    void ConstructL(RFile* aFileHandle,
+        TTimeIntervalMicroSeconds aStartTime,                            
+        MAudClipInfoObserver& aObserver, TInt aTrackIndex);
+    
+    /* Destructor. */
+    
+    /**
+    * Destroys the object and releases all resources.
+    */    
+    virtual ~CAudClip();
+    
+private:
+    // Member variables
+    
+    // Song class this clip is part of.
+    CAudSong* iSong;
+    // File of the audio clip.
+    RFile iFile;        
+    
+    
+    // Info class of this audio clip.
+    CAudClipInfo* iInfo;
+    
+    // Cut in time of this audio clip.
+    TTimeIntervalMicroSeconds iCutInTime;
+    // Cut out time of this audio clip.
+    TTimeIntervalMicroSeconds iCutOutTime;
+    // Start time of this audio clip.
+    TTimeIntervalMicroSeconds iStartTime;
+    
+    // Muting of this audio clip.
+    // If ETrue, the clip is to be muted
+    TBool iMute;
+    
+    // Normalizing of this audio clip.
+    // If ETrue, the clip is to be normalized
+    TBool iNormalize;
+    
+    // Priority of this audio clip.
+    TInt iPriority;
+ 
+    // index of this clip in CAudSong
+    TInt iIndex;
+
+    // track index of this clip
+    TInt iTrackIndex;
+    
+    TInt iVolumeGain;
+    
+    // Marks used for manual level controlling
+    RPointerArray<TAudDynamicLevelMark> iDynamicLevelMarkArray;
+    
+    friend class CAudSong;
+    friend class CAudSongAddClipOperation;
+    friend class RPointerArray<CAudClip>;
+    
+    };
+
+
+#endif // __AUDCLIP_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/AudClipInfo.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,369 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __AUDCLIPINFO_H__
+#define __AUDCLIPINFO_H__
+
+
+#include <e32base.h>
+#include <MdaAudioSamplePlayer.h>
+
+#include "AudCommon.h"
+#include "AudObservers.h"
+
+
+
+/*
+*    Forward declarations.
+*/
+class CAudClipInfoOperation;
+class CAudProcessor;
+
+/**
+* Utility class for getting information about audio clip files.
+*/
+class CAudClipInfo : public CBase    
+
+    {
+    
+public:
+    
+    /* Constructors & destructor. */
+    
+    /**
+    * Constructs a new CAudClipInfo object to get information
+    * about the specified audio clip file. The specified observer
+    * is notified when info is ready for reading. This method
+    * may leave if no resources are available to construct 
+    * a new object.
+    * 
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *  - <code>KErrNotSupported</code> if the given file format is not supported 
+    * or is invalid
+    *
+    * @param aFileName  name of audio clip file
+    * @param aObserver  observer to notify when info is ready for reading
+    *
+    * @return  pointer to a new CAudClipInfo instance
+    */
+    IMPORT_C static CAudClipInfo* NewL(const TDesC& aFileName, MAudClipInfoObserver& aObserver);
+    
+    /**
+    * Constructs a new CAudClipInfo object to get information
+    * about the specified audio clip file. The constructed object
+    * is left in the cleanup stack. The specified observer
+    * is notified when info is ready for reading. This method
+    * may leave if no resources are available to construct a new
+    * object.
+    * 
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *  - <code>KErrNotSupported</code> if the given file format is not supported 
+    *    or is invalid
+    *
+    * @param aFileName  name of video clip file
+    * @param aObserver  observer to notify when info is ready for reading
+    *
+    * @return  pointer to a new CAudClipInfo instance
+    */
+    IMPORT_C static CAudClipInfo* NewLC(const TDesC& aFileName, MAudClipInfoObserver& aObserver);
+    
+    
+    /**
+    * Returns the properties of this audio file
+    * 
+    * @return  properties
+    */
+    IMPORT_C TAudFileProperties Properties() const;
+    
+    /**
+    * Generates a visualization of the current clip. 
+    * 
+    * Asynchronous operation; MAudVisualizationObserver::NotifyClipVisualizationCompleted
+    * is called as soon as the visualization process has completed. This method leads to
+    * memory reservation, so once NotifyClipVisualizationCompleted has occurred, 
+    * the caller is responsible for memory releasing.
+    * 
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *
+    * @param aObserver            observer to be notified when visualization is completed
+    * @param aSize                the size of aVisualization array (time resolution). 
+    * @param aPriority            priority
+    *
+    */
+    IMPORT_C void GetVisualizationL(MAudVisualizationObserver& aObserver,
+        TInt aSize, TInt aPriority) const;
+    
+    /**
+    * Cancels visualization generation. If no visualization is currently being 
+    * generated, the function does nothing.
+    */
+    IMPORT_C void CancelVisualization();
+    
+    /**
+     * Returns the file name of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  file name
+     */
+    IMPORT_C TPtrC FileName() const;
+
+    /**
+    * Destroys the object and releases all resources.
+    */    
+    IMPORT_C ~CAudClipInfo();
+    
+    /**
+    * Constructs a new CAudClipInfo object to get information
+    * about the specified audio clip file. The specified observer
+    * is notified when info is ready for reading. This method
+    * may leave if no resources are available to construct 
+    * a new object.
+    * 
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *  - <code>KErrNotSupported</code> if the given file format is not supported 
+    * or is invalid
+    *
+    * @param aFileHandle file handle of audio clip file
+    * @param aObserver  observer to notify when info is ready for reading
+    *
+    * @return  pointer to a new CAudClipInfo instance
+    */
+    IMPORT_C static CAudClipInfo* NewL(RFile* aFileHandle, MAudClipInfoObserver& aObserver);
+    
+    /**
+    * Constructs a new CAudClipInfo object to get information
+    * about the specified audio clip file. The constructed object
+    * is left in the cleanup stack. The specified observer
+    * is notified when info is ready for reading. This method
+    * may leave if no resources are available to construct a new
+    * object.
+    * 
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *  - <code>KErrNotSupported</code> if the given file format is not supported 
+    *    or is invalid
+    *
+    * @param aFileHandle file handle of audio clip file    
+    * @param aObserver  observer to notify when info is ready for reading
+    *
+    * @return  pointer to a new CAudClipInfo instance
+    */
+    IMPORT_C static CAudClipInfo* NewLC(RFile* aFileHandle, MAudClipInfoObserver& aObserver);
+    
+    /**
+     * Returns the file handle of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  file name
+     */
+    IMPORT_C RFile* FileHandle() const;
+    
+    
+private:
+    
+    // C++ constructor
+    CAudClipInfo();
+    
+    // ConstructL
+    // parameters: see NewL()
+    void ConstructL(const TDesC& aFileName, MAudClipInfoObserver& aObserver);
+    
+    void ConstructL(RFile* aFileHandle, MAudClipInfoObserver& aObserver);
+    
+private:
+
+    // properties of this clip
+    TAudFileProperties* iProperties;
+    
+    // file name of this clip
+    HBufC* iFileName;
+    
+    // file handle of this clip
+    RFile* iFileHandle;
+    
+    // flag to indicate whether info class is ready
+    TBool iInfoReady;
+
+    // operation class
+    CAudClipInfoOperation* iOperation;
+    
+    // friends
+    friend class CAudClipInfoOperation;
+    friend class CAudClip;
+
+    
+    };
+
+
+
+/**
+ * Observer for notifying that audio clip info
+ * is ready for reading.
+ *
+ */
+class MProcClipInfoObserver
+    {
+public:
+    /**
+     * Called to notify that audio clip info is ready
+     * for reading.
+     *
+     * Possible error codes:
+     *    - <code>KErrNotFound</code> if there is no file with the specified name
+     *    in the specified directory (but the directory exists)
+     *    - <code>KErrPathNotFound</code> if the specified directory
+     *    does not exist
+     *    - <code>KErrUnknown</code> if the specified file is of unknown type
+     *
+     * @param aError  <code>KErrNone</code> if info is ready
+     *                for reading; one of the system wide
+     *                error codes if reading file failed
+     */
+    virtual void NotifyClipInfoReady(TInt aError) = 0;
+    };
+
+
+
+/**
+ * Internal class for reading information from the audio clip file.
+ * Implements a simple object 
+ * to report to the audio clip info observer certain common error conditions 
+ * that would otherwise leave.
+ */
+class CAudClipInfoOperation :    public CBase, 
+                                public MProcClipInfoObserver, 
+                                public MAudVisualizationObserver
+    {
+    
+public:
+
+
+    /*
+    * Constructor
+    *
+    *
+    * @param aInfo        CAudClipInfo class that owns this object
+    * @param aObserver    observer for callbacks
+    */
+
+    static CAudClipInfoOperation* NewL(CAudClipInfo* aInfo,
+                                            MAudClipInfoObserver& aObserver);
+
+    /*
+    * Destructor
+    */
+    ~CAudClipInfoOperation();
+    
+    
+    // from base class MProcClipInfoObserver
+    void NotifyClipInfoReady(TInt aError);
+
+    // from base class MAudVisualizationObserver
+
+    void NotifySongVisualizationCompleted(const CAudSong& aSong, 
+        TInt aError, 
+        TInt8* aVisualization,
+        TInt aSize);
+
+    void NotifyClipInfoVisualizationCompleted(const CAudClipInfo& aClipInfo, 
+        TInt aError, 
+        TInt8* aVisualization,
+        TInt aSize);
+
+    void NotifySongVisualizationStarted(const CAudSong& aSong, 
+        TInt aError);
+
+    void NotifyClipInfoVisualizationStarted(const CAudClipInfo& aClipInfo, 
+        TInt aError);
+
+    void NotifySongVisualizationProgressed(const CAudSong& aSong, 
+        TInt aPercentage);
+
+    void NotifyClipInfoVisualizationProgressed(const CAudClipInfo& aClipInfo, 
+        TInt aPercentage);
+
+    /**
+    * Generates a visualization of the current clip. 
+    * 
+    * Asynchronous operation; MAudVisualizationObserver::NotifyClipVisualizationCompleted
+    * is called as soon as the visualization process has completed. This method leads to
+    * memory reservation, so once NotifyClipVisualizationCompleted has occurred, 
+    * the caller is responsible for memory releasing.
+    * 
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *
+    * @param aObserver            observer to be notified when visualization is completed
+    * @param aSize                the size of aVisualization array (time resolution).
+    * @param aPriority            priority
+    *
+    */
+        
+    void StartVisualizationL(MAudVisualizationObserver& aObserver, TInt aSize, TInt aPriority);
+
+    /**
+    * Cancels visualization generation. If no visualization is currently being 
+    * generated, the function does nothing.
+    */
+        
+    void CancelVisualization();
+
+    /**
+     * Called to start getting file properties
+     *
+     * NotifyClipInfoReady is called as soon as the operation completes
+     */
+    void StartGetPropertiesL();
+
+
+private:
+    
+    CAudClipInfoOperation(CAudClipInfo* aInfo, 
+                               MAudClipInfoObserver& aObserver);
+    void ConstructL();
+    
+
+private:
+
+    // info class that owns this object
+    CAudClipInfo* iInfo;
+    
+    // observer for clip info callbacks
+    MAudClipInfoObserver* iObserver;
+    
+    // observer for visualization callbacks
+    MAudVisualizationObserver* iVisualizationObserver;
+    
+    // processor class owned by this object
+    CAudProcessor* iProcessor;
+
+    friend class CAudClipInfo;
+    friend class CAudClip;
+
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/AudCommon.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Common definitions for audio.
+*
+*/
+
+
+
+#ifndef __AUDCOMMON_H__
+#define __AUDCOMMON_H__
+
+#include <e32std.h>
+
+
+const TInt KErrNoAudio = -400;
+/**
+ * Enumeration for audio file formats.
+ */
+enum TAudFormat
+    {
+    EAudFormatUnrecognized = 100001,  // should always be the first one
+    EAudFormat3GPP,
+    EAudFormatMP4,
+    EAudFormatAMR,
+    EAudFormatAMRWB,
+    EAudFormatMP3,
+    EAudFormatAAC_ADIF,
+    EAudFormatAAC_ADTS,
+    EAudFormatWAV,
+    EAudFormatLast  // should always be the last one
+    };
+
+
+/**
+ * Enumeration for audio types (that is, codecs).
+ */
+enum TAudType
+    {
+    EAudTypeUnrecognized = 101001,  // should always be the first one
+    EAudNoAudio,
+    EAudAMR,
+    EAudAMRWB,
+    EAudMP3,
+    EAudAAC_MPEG2, // EAudAAC_MPEG2 not used, all EAudAAC_MPEG is now 4
+    EAudAAC_MPEG4,
+    EAudWAV,
+    EAudTypeLast  // should always be the last one
+    };
+    
+/*
+   Purpose:     MPEG-4 Audio object types.
+   Explanation: - */
+enum TAudAACObjectType
+{
+  EAudAACObjectTypeNone = -1,
+  EAudAACObjectTypeMain,
+  EAudAACObjectTypeLC,
+  EAudAACObjectTypeSSR,
+  EAudAACObjectTypeLTP,
+  EAudAACObjectTypeLast
+};
+  
+/**
+ * Enumeration for audio extension types (AAC+)
+ */
+enum TAudExtensionType
+    {
+    EAudExtensionTypeNoExtension = 20000,
+    EAudExtensionTypeEnhancedAACPlus,
+    EAudExtensionTypeEnhancedAACPlusParametricStereo
+    
+    };    
+
+/**
+ * Constants for audio clip priorities.
+ */
+const TInt KAudClipPriorityHighest = 400;
+const TInt KAudClipPriorityHigh = 300;
+const TInt KAudClipPriorityNormal = 200;
+const TInt KAudClipPriorityLow = 100;
+const TInt KAudClipPriorityLowest = 0;
+
+
+  
+
+
+/**
+ * Enumeration for channel modes
+ */
+enum TChannelMode 
+    {
+    EAudChannelModeNotRecognized = 103001,   
+    EAudStereo,
+    EAudDualChannel,
+    EAudSingleChannel,
+    EAudParametricStereoChannel
+    };
+
+/**
+ * Enumeration for bitrate modes
+ */
+enum TBitrateMode 
+    {
+    EAudBitrateModeNotRecognized = 103001,
+    EAudConstant,
+    EAudVariable
+    };
+    
+/**
+ * Class for storing dynamic level marks.
+ */
+class TAudDynamicLevelMark 
+    {
+
+public:
+
+    /** Mark time. */
+    TTimeIntervalMicroSeconds iTime;
+
+    /** Dynamic level (-63.5 ... +63.5) in dB:s
+    * one step represents 0.5 dB, hence values can be -127 ... +127
+    */
+    TInt8 iLevel;
+
+    TAudDynamicLevelMark(TTimeIntervalMicroSeconds aTime, TInt aLevel) 
+        {
+        iTime = aTime;
+        if ( aLevel < -127 )
+            {
+            iLevel = -127;
+            }
+        else if (aLevel > 127 )
+            {
+            iLevel = 127;
+            }
+        else
+            {
+            iLevel = TInt8(aLevel);
+            }
+        }
+
+    TAudDynamicLevelMark(const TAudDynamicLevelMark& aMark) 
+        {
+        iTime = aMark.iTime;
+        iLevel = aMark.iLevel;
+        }
+    };    
+
+/**
+ * Class for storing general properties about an audio file.
+ */
+class TAudFileProperties 
+    {
+
+public:
+
+    // File format
+    TAudFormat iFileFormat;
+    // Codec
+    TAudType iAudioType;
+    // Extension type
+    TAudExtensionType iAudioTypeExtension;
+    // Duration of the clip in microseconds
+    TTimeIntervalMicroSeconds iDuration;
+    // Sampling rate in Hertzes
+    TInt iSamplingRate;
+    // Bitrate in bits/s
+    TInt iBitrate;
+    // Channel mode
+    TChannelMode iChannelMode;
+    // Channel mode for extension
+    TChannelMode iChannelModeExtension;
+    // Bitrate mode (constant or variable)
+    TBitrateMode iBitrateMode;
+    // Number of bytes in a compressed frame
+    TInt32 iFrameLen;
+    // Is iFrameLen constant?
+    TBool iConstantFrameLength;
+    // Duration of decoded frame in microseconds
+    TTimeIntervalMicroSeconds iFrameDuration;
+    // Number of frames in the clip
+    TInt32 iFrameCount;
+//    TCodecMode iCodecMode;
+    // Number of frames in a sample (e.g. amr in mp4 has several)
+    TInt iNumFramesPerSample;
+    // Bitdepth in PCM data (usually 8, 16 or 24, only for PCM-data)
+    TInt iNumberOfBitsPerSample; 
+    // Original field in MP3 fixed header
+    TBool iOriginal;
+    
+    // AAC object type
+    TAudAACObjectType iAACObjectType;
+
+    TBool isCompatible(const TAudFileProperties /*&c2*/) const 
+        {
+        
+        // Now that the clips can be decoded and encoded
+        // all the clips are "compatible" with each other        
+        
+        return ETrue;
+
+
+        }
+
+    };    
+
+
+
+#endif // __AUDCOMMON_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/AudObservers.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#ifndef __AUDOBSERVERS_H__
+#define __AUDOBSERVERS_H__
+
+
+#include <e32base.h>
+//#include "AudSong.h"
+//#include "AudClip.h"
+//#include "AudClipInfo.h"
+#include "AudCommon.h"
+
+class CAudSong;
+class CAudClip;
+class CAudClipInfo;
+
+/**
+ * Observer for movie processing operations. 
+ */
+class MAudSongProcessingObserver
+    {
+public:
+    /**
+     * Called to notify that a new audio processing operation has been started. 
+     *
+     * @param aSong  song
+     */
+    virtual void NotifyAudioProcessingStartedL(CAudSong& aSong) = 0;
+
+    /**
+     * Called to inform about the current progress of the audio processing operation.
+     *
+     * @param aSong       song
+     * @param aPercentage  percentage of the operation completed, must be 
+       *                     in range 0..100
+     */
+    virtual void NotifyAudioProcessingProgressed(CAudSong& aSong, TInt aPercentage) = 0;
+
+    /**
+    * Called to notify that the song processing operation has been completed. 
+    * 
+    * @param aSong  song
+    * @param aError  error code why the operation was completed. 
+    *                <code>KErrNone</code> if the operation was completed 
+    *                successfully.
+    */
+    virtual void NotifyAudioProcessingCompleted(CAudSong& aSong, TInt aError) = 0;
+    
+    };
+
+/**
+* Observer for audio visualization processes. 
+*/
+class MAudVisualizationObserver
+    {
+public:
+        
+    /**
+    * Called to notify that audio _clip_ visualization process has been completed. 
+    * The receiver is responsible for releasing the memory in 
+    * <code>aVisualization</code> if <code>aError = KErrNone</code>
+    * Note: if aError != KErrNone, aVisualization = NULL and aSize = 0;
+    * 
+    * @param aClipInfo        audio clip info
+    * @param aError            <code>KErrNone</code> if visualization was
+    *                        completed successfully; one of the system wide
+    *                        error codes if generating visualization failed
+    * @param aVisualization    pointer to TInt8 visualization array 
+    * @param aSize                size of the visualization array
+    */
+    virtual void NotifyClipInfoVisualizationCompleted(const CAudClipInfo& aClipInfo, 
+        TInt aError, 
+        TInt8* aVisualization,
+        TInt aSize) = 0;
+    
+
+    /**
+    * Called to notify that audio _clip_ visualization process has been started. 
+    * 
+    * @param aClipInfo            clip info
+    * @param aError                <code>KErrNone</code> if visualization was
+    *                            started successfully; one of the system wide
+    *                            error codes if generating visualization failed
+    */
+    virtual void NotifyClipInfoVisualizationStarted(const CAudClipInfo& aClipInfo, 
+        TInt aError) = 0;
+
+
+    /**
+     * Called to inform about the current progress of the audio clip visualization.
+     *
+     * @param aClipInfo    clip info
+     * @param aPercentage  percentage of the operation completed, must be 
+       *                     in range 0..100
+     */
+    virtual void NotifyClipInfoVisualizationProgressed(const CAudClipInfo& aClipInfo, 
+        TInt aPercentage) = 0;
+
+
+    };
+
+
+/**
+ * Observer for song events. 
+ * <p>
+ * Note that every change operation that is made to a song or the clips it consists of 
+ * results in a maximum of one notification method called (that is, more than one 
+ * notification method is never called as a result of a single change). For example,
+ * changing the index of a clip results in the <code>NotifyClipIndicesChanged()</code>
+ * method being called once. The <code>NotifyClipTimingsChanged()</code> method is not 
+ * called even if the timings of several clips may have changed as a result. See the
+ * descriptions of the notification methods for more detailed information.
+ *
+ * @see  CAudSong
+ */
+class MAudSongObserver 
+    {
+public:
+
+    /**
+     * Called to notify that a new audio clip has been successfully
+     * added to the song. Note that the indices and the start and end times
+     * of the audio clips after the new clip have also changed as a result.
+     * Note that the transitions may also have changed. 
+     *
+     * @param aSong            song
+     * @param aClip            new audio clip
+     * @param aIndex        index of the new audio clip on a track
+     * @param aTrackIndex    track index of the new clip
+     *
+     */
+    virtual void NotifyClipAdded(CAudSong& aSong, CAudClip& aClip, TInt aIndex, TInt aTrackIndex) = 0;
+
+    /**
+     * Called to notify that adding a new audio clip to the song has failed.
+     *
+     * Possible error codes:
+     *    - <code>KErrNotFound</code> if there is no file with the specified name
+     *    in the specified directory (but the directory exists)
+     *    - <code>KErrPathNotFound</code> if the specified directory
+     *    does not exist
+     *    - <code>KErrUnknown</code> if the specified file is of unknown format
+     *    - <code>KErrNotSupported</code> if the format of the file is recognized but
+     *    adding it to the song is not supported (e.g., it is of different codec
+     *    or format than the other clips)
+     *
+     * @param aSong   song
+     * @param aError  one of the system wide error codes
+     */
+    virtual void NotifyClipAddingFailed(CAudSong& aSong, TInt aError,  TInt aTrackIndex) = 0;
+
+    /**
+     * Called to notify that an audio clip has been removed from the song.
+     * Note that the indices and the start and end times of the audio clips after 
+     * the removed clip have also changed as a result. Note that the 
+     * transitions may also have changed.
+     *
+     * @param aSong            song
+     * @param aIndex        index of the removed clip (on a track)
+     * @param aTrackIndex    track index
+     */
+    virtual void NotifyClipRemoved(CAudSong& aSong, TInt aIndex, TInt aTrackIndex) = 0;
+    
+    /**
+     * Called to notify that the timings of the clip has changed.
+     * Note that the start and end times of the audio clips 
+     * after the changed clip have also changed.
+     *
+     * @param aSong  song
+     * @param aClip  changed clip
+     */
+    virtual void NotifyClipTimingsChanged(CAudSong& aSong,
+        CAudClip& aClip) = 0;
+    
+
+    /**
+     * Called to notify that the index of the clip has changed.
+     *
+     * @param aSong            song
+     * @param aOldIndex        old index on a track
+     * @param aNewIndex        new index on a track
+     * @param aTrackIndex    track index
+     */
+    virtual void NotifyClipIndicesChanged(CAudSong& aSong, TInt aOldIndex, 
+        TInt aNewIndex, TInt aTrackIndex) = 0;
+    
+    /**
+     * Called to notify that the song has been reseted.
+     *
+     * @param aSong  song
+     */
+    virtual void NotifySongReseted(CAudSong& aSong) = 0;
+
+
+    /**
+     * Called to notify that a clip has been reseted.
+     *
+     * @param aClip  clip
+     */
+    virtual void NotifyClipReseted(CAudClip& aClip) = 0;
+
+    
+    /**
+     * Called to notify that a new dynamic level mark has been successfully
+     * added to a _clip_.
+     *
+     * @param aClip  clip
+     * @param aMark  new level mark
+     * @param aIndex index of the new level mark
+     */
+    virtual void NotifyDynamicLevelMarkInserted(CAudClip& aClip, 
+        TAudDynamicLevelMark& aMark, 
+        TInt aIndex) = 0;
+
+    
+    /**
+     * Called to notify that a dynamic level mark has been removed from a _clip_.
+     * Note that indices of dynamic level marks has also changed as a result
+     *
+     * @param aClip   clip
+     * @param aIndex  index of the removed mark
+     */
+    virtual void NotifyDynamicLevelMarkRemoved(CAudClip& aClip, TInt aIndex) = 0;
+
+
+
+    };
+
+
+
+
+/**
+ * Observer for notifying that audio clip info
+ * is ready for reading.
+ *
+ * @see  CAudClipInfo
+ */
+class MAudClipInfoObserver
+    {
+public:
+    /**
+     * Called to notify that audio clip info is ready
+     * for reading.
+     *
+     * Possible error codes:
+     *    - <code>KErrNotFound</code> if there is no file with the specified name
+     *    in the specified directory (but the directory exists)
+     *    - <code>KErrPathNotFound</code> if the specified directory
+     *    does not exist
+     *    - <code>KErrUnknown</code> if the specified file is of unknown type
+     *
+     * @param aInfo   audio clip info
+     * @param aError  <code>KErrNone</code> if info is ready
+     *                for reading; one of the system wide
+     *                error codes if reading file failed
+     */
+    virtual void NotifyClipInfoReady(CAudClipInfo& aInfo, 
+                                          TInt aError) = 0;
+    };
+    
+class MAudTimeEstimateObserver
+    {
+public:
+    /**
+     * Called to notify that time estimate is ready
+     * for reading.
+     *
+     *
+     * @param aTimeEstimate   time estimate in microseconds
+     */
+    
+    virtual void NotifyTimeEstimateReady(TInt64 aTimeEstimate) = 0;
+
+    };
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/AudPanic.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#ifndef __AUDPANIC_H__
+#define __AUDPANIC_H__
+
+#include <e32base.h>
+
+
+class TAudPanic 
+    {
+public:
+    enum TCode
+        {
+        EInternal = 0,  // Internal error (that is, a  in the engine)
+        ESongEmpty,
+        ESongAddOperationAlreadyRunning,
+        ESongProcessingOperationAlreadyRunning,
+        ESongProcessingOperationNotRunning,
+        EVisualizationProcessAlreadyRunning,
+        EVisualizationProcessNotRunning,
+        EClipInfoProcessAlreadyRunning,
+        EAudioClipIllegalIndex,
+        EAudioClipIllegalCutInTime,
+        EAudioClipIllegalCutOutTime,
+        EIllegalDynamicLevelMark,
+        EIllegalDynamicLevelMarkIndex,
+        EAudioClipIllegalStartTime,
+        ESongObserverAlreadyRegistered,
+        ESongObserverNotRegistered
+
+
+        };
+
+public:
+    static void Panic(TCode aCode);
+    };
+
+#endif // __AUDPANIC_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/AudProcessor.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#ifndef __AUDPROCESSOR_H__
+#define __AUDPROCESSOR_H__
+
+
+#include <e32base.h>
+#include <e32std.h>
+
+#include "AudCommon.h"
+#include "AudClipInfo.h"
+#include "ProcClipInfoAO.h"
+#include "ProcProcessAO.h"
+#include "ProcVisualizationAO.h"
+#include "ProcTimeEstimateAO.h"
+
+/*
+ * Forward declarations.
+ */
+class CAudSong;
+class CAudClip;
+class MProcProcessObserver;
+class MProcClipInfoObserver;
+class CProcClipInfoAO;
+class CProcProcess;
+class CProcVisualizationAO;
+class CProcTimeEstimateAO;
+
+/**
+ * Audio processor.
+ */
+class CAudProcessor : public CBase
+    {
+public:
+
+    /** 
+     * Constructors for instantiating new audio processors.
+     * Should reserve as little resources as possible at this point.
+     */
+    static CAudProcessor* NewL();
+    static CAudProcessor* NewLC();
+
+    
+    virtual ~CAudProcessor();
+
+    /**
+    * Starts a syncronous song processing
+    */
+    TBool StartSyncProcessingL(const CAudSong* aSong);
+
+    TBool ProcessSyncPieceL(HBufC8*& aFrame, TInt& aProgress,
+                                       TTimeIntervalMicroSeconds& aDuration);
+
+    /**
+     * Cancel song processing.
+     */
+    void CancelProcessing(MProcProcessObserver& aObserver);
+
+
+
+    /**
+     * Read the header from the specified audio clip file and return its properties.
+     *
+     *
+     * Possible leave codes:
+     *    - <code>KErrNoMemory</code> if memory allocation fails
+     *    - <code>KErrNotFound</code> if there is no file with the specified name
+     *    in the specified directory (but the directory exists)
+     *    - <code>KErrPathNotFound</code> if the specified directory
+     *    does not exist
+     *    - <code>KErrUnknown</code> if the specified file is of unknown format
+     *
+     * @param aFileName             name of the file to read
+     * @param aFileHandle             handle of the file to read
+     * @param aProperties            Output parameter. Properties of the input file. 
+     *                                Allocated and released by the caller
+     * @param aObserver                Observer to be notified as soon as operation completes
+    */
+    void GetAudFilePropertiesL(const TDesC& aFileName, RFile* aFileHandle, 
+                               TAudFileProperties* aProperties, 
+                               MProcClipInfoObserver& aObserver, TInt aPriority);
+
+    /**
+    * Starts an asynchronous visualization operation for a clip. Progress
+    * indications are sent to an observer
+    *
+    * @param aClip        Clip to be visualized
+    * @param aSize        Lenght of the visualization array, must be positive
+    * @param aPriority  Priority of the operation
+    */
+    void StartGetClipVisualizationL(const CAudClipInfo* aClipInfo, TInt aSize,
+        MAudVisualizationObserver& aObserver, 
+        TInt aPriority);
+
+    /**
+    * Cancels a clip visualization operation. If an operation is not running
+    * a <code>TAudPanic::EVisualizationProcessNotRunning<code> is thrown
+    */
+    void CancelClipVisualization();
+
+    TBool StartTimeEstimateL(const CAudSong* aSong, MAudTimeEstimateObserver& aTEObserver);
+    
+    void CancelTimeEstimate();
+    
+
+
+protected:
+    CAudProcessor();
+
+    void ConstructL();
+
+private:
+
+    // clip info active object owned by this
+    CProcClipInfoAO* iClipInfoAO;
+    
+    // processing object owned by this
+    CProcProcess* iProcessingObject;
+    
+    // visualization active object owned by this
+    CProcVisualizationAO* iVisualizationAO;
+    
+    // Time estimation active object owned by this
+    CProcTimeEstimateAO* iTimeEstimateAO;
+    
+    
+    
+    // a flag to indicate whether there is some ongoing processing
+    TBool iProcessing;
+
+    friend class CProcProcess;
+    friend class CProcClipInfoAO;
+
+
+    };
+
+
+#endif // __AudProcessor_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/AudProcessorImpl.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CAUDPROCESSORIMPL_H__
+#define __CAUDPROCESSORIMPL_H__
+
+#include <e32base.h>
+#include <e32math.h>
+#include "AudClipInfo.h"
+#include "AudCommon.h"
+#include "AudSong.h"
+#include "ProcInFileHandler.h"
+
+#include "ProcFrameHandler.h"
+#include "ProcWAVFrameHandler.h"
+
+
+
+
+#include "ProcTools.h"
+
+
+class MProcClipInfoObserver;
+
+class CAudProcessorImpl : public CBase
+    {
+    
+public:
+
+    /*
+    *
+    * Symbian constructors and a destructor
+    *
+    */
+
+    static CAudProcessorImpl* NewL();
+    static CAudProcessorImpl* NewLC();
+
+    virtual ~CAudProcessorImpl();
+
+
+    /**
+    * Performs all initializations needed for a song processing
+    * such as output file opening
+    * 
+    * Can leave with one of the system wide error codes
+    * related to memory allocation and file opening
+    *
+    * Possible panic code
+    * <code>ESongProcessingOperationAlreadyRunning</code>
+    *
+    *
+    *
+    * @param aSong              song to be processed
+    * @param aRawFrameSize      length of raw audio frames
+    * @param aGetTimeEstimation ETrue if getting a time estimation
+    *
+    * @return
+    *
+    */
+    void ProcessSongL(const CAudSong* aSong, TInt aRawFrameSize, 
+                      TBool aGetTimeEstimation = EFalse);
+    
+    /**
+    * Processes one audio frame and writes it to an output file
+    *
+    * Possible panic code
+    * <code>ESongProcessingOperationNotRunning</code>
+    *
+    * @param aProgress    output parameter to indicate progress in percents
+    *
+    *
+    * @return            ETrue if processing completed, EFalse otherwise
+    *
+    */
+    TBool ProcessSyncPieceL(HBufC8*& aFrame, TInt& aProgress,
+                                       TTimeIntervalMicroSeconds& aDuration, TBool& aRaw);
+
+
+
+    /**
+    * Gets properties of an audio file
+    * 
+    * Can leave with one of the error codes related to file opening
+    * 
+    * @param aFileName        name of the file
+    * @param aFileHandle      file handle of the file to read
+    * @param aProperties    pointer to audio file properties (needs to be
+    *                        allocated before calling this function)
+    *
+    */
+    void GetAudFilePropertiesL(const TDesC& aFileName, RFile* aFileHandle,
+                               TAudFileProperties* aProperties);
+
+    /**
+    *
+    * Gets time estimate once the time estimate has been calculated
+    *
+    * If time estimation has not been processed, returns 0
+    *
+    * @return processing time estimate in microseconds
+    */
+    
+    TInt64 GetFinalTimeEstimate() const;
+    
+
+private:
+    
+    /*
+    * Symbian constructor
+    */
+    void ConstructL();
+
+    /*
+    * Generates processing events for the output clip
+    */
+    void GetProcessingEventsL();
+
+    /*
+    * Calculates a gain value on a given time
+    */
+    TInt8 GetGainNow(const CAudClip* aClip, TInt32 aTimeMilliSeconds);
+
+    /*
+    * Stops processing
+    */
+    TBool StopProcessing();
+
+    /*
+    * Writes one frame of silence
+    */
+    TBool WriteSilenceL(HBufC8*& aFrame, TInt& aProgress,
+                                       TTimeIntervalMicroSeconds& aDuration, TBool& aRaw);
+    /*
+    * Returns the index of the clip with highest priority 
+    */
+    TBool HighestInFilePriority(TInt& aFirst, TInt& aSecond);
+    
+    /*
+    * Compares the two properties and returns true if decoding is required
+    */
+    TBool IsDecodingRequired(const TAudFileProperties& prop1, const TAudFileProperties& prop2);
+
+    /*
+    * C++ constructor
+    */
+    CAudProcessorImpl();
+    
+private:
+    
+    // Array for all the input clips
+    RPointerArray<CProcInFileHandler> iInFiles;
+    
+    // Song
+    const CAudSong* iSong;
+
+    // frame handler for PCM operations such as mixing
+    CProcWAVFrameHandler* iWAVFrameHandler;
+
+    // time left before the end of last clip
+    // (additional silence may be written after that)
+    TInt32 iTimeLeft;
+    
+    // index of the current processing event
+    TInt iCurEvent;
+
+    // array for processing events
+    RPointerArray<CProcessingEvent> iProcessingEvents;
+    
+    // array for storing clip indexes that are currenty written
+    RArray<TInt> iClipsWritten;
+    
+    
+    // song duration in milliseconds
+    TInt iSongDurationMilliSeconds;
+
+    // how much has already been processed
+    TInt iSongProcessedMilliSeconds;
+
+    // index of the clip that was previously processed
+    TInt iLastInClip1;
+    
+    // a flag to indicate if we are getting a processing time estimate
+    TBool iGetTimeEstimation;
+    
+    // timer for calculating time estimation
+    TTime iTimer;
+    
+    // a variable for time estimate
+    TInt64 iTimeEstimate;
+    
+    // a variable for time estimate calculation
+    TReal iTimeEstimateCoefficient;
+    
+    TBool iSilenceStarted;
+    
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/AudSong.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,692 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#ifndef __AUDSONG_H__
+#define __AUDSONG_H__
+
+
+#include <e32base.h>
+#include <f32file.h>
+#include <e32std.h>
+
+#include "AudCommon.h"
+#include "AudObservers.h"
+
+
+// define _WRITE_OUTPUT_TO_FILE_ if you want audio engine to write its output to a file
+//#define _WRITE_OUTPUT_TO_FILE_;
+
+
+/*
+*    Forward declarations.
+*/
+
+
+class MAudVisualizationObserver;
+class MAudSongProcessingObserver;
+class CAudSongProcessOperation;
+class CAudSongVisualizationOperation;
+class MAudSongObserver;
+class CAudClipInfo;
+class MAudClipInfoObserver;
+class CAudSongAddClipOperation;
+class CAudProcessor;
+
+// constants that represent special parameter values
+
+// clip end time (used when setting cutOut-times)
+const TInt KClipEndTime = -1;
+
+// KAllTrackIndices represents all tracks in ClipCount()-function
+const TInt KAllTrackIndices = -1;
+
+// Let audio engine to decide the bitrate
+const TInt KAudBitRateDefault = -1;
+
+
+/**
+* Audio song, which consists of zero or more audio clips
+*
+* @see  CAudClip
+*/
+class CAudSong : public CBase
+    {
+public:
+    /* Constructors. */
+    
+    /**
+    * Constructs a new empty CAudSong object. May leave if no resources are available.
+    * 
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *
+    * @param aFs  file server session to use to lock the audio
+    *             clip files of the new song; or NULL to not to lock the files
+    * @return  pointer to a new CAudSong instance
+    */
+    IMPORT_C static CAudSong* NewL(RFs *aFs);
+    
+    /**
+    * Constructs a new empty CAudSong object and leaves the object in the cleanup stack.
+    * 
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    * 
+    * @param aFs  file server session to use to lock the audio
+    *             clip files of the new song; or NULL to not to lock the files
+    * @return  pointer to a new CAudSong instance
+    */
+    IMPORT_C static CAudSong* NewLC(RFs *aFs);
+    
+    /**
+    * Destroys the object and releases all resources.
+    */
+    IMPORT_C virtual ~CAudSong();
+    
+    
+    /* Property methods. */
+    
+    /**
+    * Returns an estimate of the total size of this song.
+    * 
+    * @return  size estimate in bytes
+    */
+    IMPORT_C TInt GetSizeEstimateL() const;
+    
+    /**
+    * Returns an estimate of the size of this song between the given time interval.
+    * 
+    * @param aStartTime Beginning of the time interval
+    * @param aEndTime End of the time interval
+    * @return size estimate in bytes
+    */
+    IMPORT_C TInt GetFrameSizeEstimateL(TTimeIntervalMicroSeconds aStartTime, 
+                                        TTimeIntervalMicroSeconds aEndTime) const;
+    
+    /**
+    * Returns the properties of this song.
+    * 
+    * @return  output file properties
+    */
+    IMPORT_C TAudFileProperties OutputFileProperties() const;
+    
+    /**
+    *
+    * Generates decoder specific info needed for MP4
+    * Caller is responsible for releasing aDecSpecInfo in the case ETrue is returned
+    *
+    * @param aMaxSize    maximum aDecSpecInfo size allowed    
+    *
+    */
+    IMPORT_C TBool GetMP4DecoderSpecificInfoLC(HBufC8*& aDecSpecInfo, TInt aMaxSize) const;
+
+    /**
+    * Get processing time estimate based on trial. Asynchronous version, requires observer.
+    *
+    */
+    IMPORT_C TBool GetTimeEstimateL(MAudTimeEstimateObserver& aObserver,
+                                    TAudType aAudType,
+                                    TInt aSamplingRate,
+                                    TChannelMode aChannelMode,
+                                    TInt aBitRate = -1);
+                                    
+    /**
+    * Get processing time estimate based on hardcoded constants. Synchronous version.
+    *
+    * @return   estimated processing time for the song
+    */
+    IMPORT_C TTimeIntervalMicroSeconds GetTimeEstimateL();
+    
+    /**
+    * Get the frame duration in microseconds. 
+    *
+    * @return   frame duration in microseconds
+    */
+    IMPORT_C TInt GetFrameDurationMicro();
+
+
+    /* Audio clip management methods. */
+    
+    /**
+    * Returns the number of audio clips in this song on a certain track.
+    *
+    * @param   aTrackIndex track index
+    *
+    * @return  number of audio clips on a defined track
+    */
+    IMPORT_C TInt ClipCount(TInt aTrackIndex = 0) const;
+    
+    /** 
+    * Returns the audio clip at the specified index. 
+    * Panics with code <code>EAudioClipIllegalIndex</code> if the clip index is invalid.
+    *
+    * @param aIndex            index of the clip on the certain track
+    * @param aTrackIndex    index of the track
+    *
+    * @return  clip at the specified index.
+    */    
+    IMPORT_C CAudClip* Clip(TInt aIndex, TInt aTrackIndex = 0) const;
+    
+    /** 
+    * Adds the specified audio clip to this song. Asynchronous operation
+    * CAudSongObserver::NotifyClipAdded or CAudSongObserver::NotifyClipAddingFailed
+    * is called once the operation has completed.
+    *
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *    - <code>KErrNotSupported</code> if audio format is not supported
+    *
+    * @param aFileName   file name of the clip to add
+    * @param aStartTime  start time of the clip in song timebase
+    * @param aTrackIndex track index. Used to categorize clips.
+    */
+    IMPORT_C void AddClipL(const TDesC& aFileName,
+        TTimeIntervalMicroSeconds aStartTime, TInt aTrackIndex = 0,
+        TTimeIntervalMicroSeconds aCutInTime = TTimeIntervalMicroSeconds(0),
+        TTimeIntervalMicroSeconds aCutOutTime = TTimeIntervalMicroSeconds(KClipEndTime));
+    
+    
+    /** 
+    * Removes the audio clip at the specified index from this song.
+    * Panics with code <code>USER-130</code> if the clip index is invalid.
+    *
+    * @param aIndex  index of the clip to be removed
+    * @param aTrackIndex track index
+    */
+    IMPORT_C void RemoveClip(TInt aIndex, TInt aTrackIndex = 0);
+    
+    /** 
+    * Removes all audio clips and clears all effects
+    *
+    * @param aNotify ETrue if observer should be notified
+    */
+    IMPORT_C void Reset(TBool aNotify);
+
+    /**
+    *
+    * Sets the duration of the output clip
+    * If necessary, silence is generated in the end
+    *
+    * @param    aDuration    output clip length in microseconds
+    * 
+    * @return    ETrue if a new duration was set, EFalse otherwise
+    *
+    */
+    IMPORT_C TBool SetDuration(TTimeIntervalMicroSeconds aDuration);
+
+    
+    /* Processing methods. */
+    
+    
+    /**
+    * Removes a dynamic level mark in a song. 
+    * Panics with code <code>EAudioClipIllegalIndex</code> 
+    * if the clip index is invalid.
+    *
+    * @param    aIndex index of the removed mark in this song
+    * @return  ETrue if mark was removed, EFalse otherwise
+    */
+    IMPORT_C TBool RemoveDynamicLevelMark(TInt aIndex);
+    
+    
+    /**
+    * Sets an output file format
+    *
+    * NOTE: only the following combinations are allowed: 
+    * AMR: single channel, 8000 Hz, 12000 kbps
+    *
+    * AAC/16kHz mono/stereo 
+    * AAC/48kHz mono/stereo
+    *
+    * @return   ETrue if format was successfully changed, 
+    *             EFalse if format cannot be set
+    */
+    IMPORT_C TBool SetOutputFileFormat(TAudType aAudType,
+                                        TInt aSamplingRate,
+                                        TChannelMode aChannelMode,
+                                        TInt aBitRate = KAudBitRateDefault);
+    
+    /**
+    * Checks if given properties are supported
+    *
+    *
+    * @param    aProperties audio properties
+    * @return   ETrue if properties are supported
+    *           EFalse if not
+    */
+    IMPORT_C TBool AreOutputPropertiesSupported(const TAudFileProperties& aProperties );
+    
+    
+    /*
+    * Processing methods
+    */
+
+    /**
+    * Starts a synchronous audio processing operation. After calling this function
+    * the current song can be processed frame by frame by calling ProcessPieceL-function
+    * Panics with 
+    * <code>TAudPanic::ESongEmpty</code> if there are no clips 
+    * in the song.
+    *     
+    */
+    IMPORT_C TBool SyncStartProcessingL();
+    
+    /**
+    * Processes synchronously next audio frame and passes it to the caller. 
+    * If a processing operation has not been started, panic 
+    * <code>TAudPanic::ESongProcessingNotRunning</code> is raised.
+    *
+    * Possibly leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *
+    * NOTE: This function allocates memory and the caller is responsible for
+    * releasing it.
+    *
+    * @param aFrame        pointer to a processed audio frame. Has to be deleted
+    *                    when not needed anymore.
+    * @param aDuration    Duration of processed audio frame in microseconds 
+    *                    after decoding
+    * 
+    * @return ETrue        Processing operation completed, no more frames to be processed. 
+    *                    No memory allocated.
+    *          EFalse    Processing operation not completed. Last processed frame stored
+    *                    in <code>aFrame</code>. Memory allocated for the processed frame
+    *                      
+    */
+    IMPORT_C TBool SyncProcessFrameL(HBufC8*& aFrame, TInt& aProgress, 
+                                TTimeIntervalMicroSeconds& aDuration);
+
+
+    /**
+    * Cancels the processing operation. Used for only synchronous processing 
+    * operations. If an operation is not running, 
+    * panic <code>TAudPanic::ESongProcessingNotRunning</code> is raised
+    */
+    IMPORT_C void SyncCancelProcess();
+
+
+    /* Observer methods. */
+
+    /**
+     * Registers a song observer. Panics with panic code 
+     * <code>ESongObserverAlreadyRegistered</code> if the song observer is 
+     * already registered.
+     *
+     * @param aObserver  observer that will receive the events
+     */
+    IMPORT_C void RegisterSongObserverL(MAudSongObserver* aObserver);
+
+    /**
+     * Unregisters a song observer. Panics with panic code 
+     * <code>ESongObserverNotRegistered</code> if the song observer is not registered.
+     *
+     * @param aObserver  observer to be unregistered
+     */
+    IMPORT_C void UnregisterSongObserver(MAudSongObserver* aObserver);
+    
+    
+    /** 
+    * Adds the specified audio clip to this song. Asynchronous operation
+    * CAudSongObserver::NotifyClipAdded or CAudSongObserver::NotifyClipAddingFailed
+    * is called once the operation has completed.
+    *
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *    - <code>KErrNotSupported</code> if audio format is not supported
+    *
+    * @param aFileHandle file handle of the clip to add
+    * @param aStartTime  start time of the clip in song timebase
+    * @param aTrackIndex track index. Used to categorize clips.
+    */
+    IMPORT_C void AddClipL(RFile* aFileHandle,
+        TTimeIntervalMicroSeconds aStartTime, TInt aTrackIndex = 0,
+        TTimeIntervalMicroSeconds aCutInTime = TTimeIntervalMicroSeconds(0),
+        TTimeIntervalMicroSeconds aCutOutTime = TTimeIntervalMicroSeconds(KClipEndTime));
+
+
+private:
+
+
+    // C++ constructor
+    CAudSong(RFs *aFs);
+
+    // functions for keeping clip indexes and arrays up to date
+    void UpdateClipIndexes();
+    void UpdateClipArray();
+
+    /**
+    * Returns a track domain clip index
+    * of the clip whose song doman index is <code>aIndex</code>
+    */
+    TInt Index2IndexOnTrack(TInt aIndex);
+
+    /*
+    * Returns a song domain clip index
+    */
+    TInt FindClipIndexOnSong(const CAudClip* aClip) const;
+    
+    /*
+    * ConstructL
+    */
+    
+    void ConstructL();
+
+private:
+    
+    // Member variables
+    
+    // File server session.
+    RFs* iFs;
+    // Audio clip array.
+    RPointerArray<CAudClip> iClipArray;
+    
+    // Marks used for manual level controlling
+    RPointerArray<TAudDynamicLevelMark> iDynamicLevelMarkArray;
+    
+    // Properties of the output file.
+    TAudFileProperties* iProperties;
+    
+    // Duration of the song
+    // if iSongDuration is greater than the cut out time of the last output clip,
+    // silence is generated in the end
+    TTimeIntervalMicroSeconds iSongDuration;
+    
+    // a flag to indicate whether the user has set the duration manually
+    // if not, the duration is the cutOutTime of the last input clip
+    TBool iSongDurationManuallySet;
+
+    // Observer array of the song class.
+    RPointerArray<MAudSongObserver> iObserverArray;
+    
+    // Normalizing of this audio clip.
+    // If ETrue, the song as a whole is to be normalized
+    TBool iNormalize;
+    
+    // process operation owned by this
+    CAudSongProcessOperation* iProcessOperation;
+    
+    // clip adding operation owned by this
+    CAudSongAddClipOperation* iAddOperation;
+    
+    // song visualization operation owned by this
+    CAudSongVisualizationOperation* iVisualizationOperation;
+    
+    
+private:
+
+    // Notifications to fire callbacks to all registered listeners -------->
+    
+    void FireClipAdded(CAudSong* aSong, CAudClip* aClip, TInt aIndex, TInt aTrackIndex);
+    
+    void FireClipAddingFailed(CAudSong* aSong, TInt aError, TInt aTrackIndex);
+
+    void FireClipRemoved(CAudSong* aSong, TInt aIndex, TInt aTrackIndex);
+
+    void FireClipIndicesChanged(CAudSong* aSong, TInt aOldIndex, 
+                                     TInt aNewIndex, TInt aTrackIndex);
+
+    void FireClipTimingsChanged(CAudSong* aSong, CAudClip* aClip);
+
+    void FireDynamicLevelMarkInserted(CAudSong& aSong, 
+        TAudDynamicLevelMark& aMark, 
+        TInt aIndex);
+    
+    void FireDynamicLevelMarkInserted(CAudClip& aClip, 
+        TAudDynamicLevelMark& aMark, 
+        TInt aIndex);
+
+    void FireDynamicLevelMarkRemoved(CAudSong& aSong, TInt aIndex);
+    void FireDynamicLevelMarkRemoved(CAudClip& aClip, TInt aIndex);
+    void FireSongReseted(CAudSong& aSong);
+    void FireClipReseted(CAudClip& aClip);
+
+    // <------------ Notifications to fire callbacks to all registered listeners
+
+    friend class CAudSongAddClipOperation;
+    friend class CAudClip;
+    friend class CAudProcessorImpl;
+    
+    
+#ifdef _WRITE_OUTPUT_TO_FILE_
+
+    TBool iFileOpen;
+    RFs iDebFs;
+    RFile iAudioFile;
+    RFile iTextFile;
+    
+    
+#endif
+    
+    };
+
+
+// Abstract interface class to get events from audio processor
+
+class MProcProcessObserver 
+    {
+
+public:
+    /**
+     * Called to notify that a new audio processing operation has been started. 
+     *
+     */
+    virtual void NotifyAudioProcessingStartedL() = 0;
+
+    /**
+     * Called to inform about the current progress of the audio processing operation.
+     *
+     * @param aPercentage  percentage of the operation completed, must be 
+       *                     in range 0..100
+     */
+    virtual void NotifyAudioProcessingProgressed(TInt aPercentage) = 0;
+
+    /**
+    * Called to notify that the song processing operation has been completed. 
+    * 
+    * @param aError  error code why the operation was completed. 
+    *                <code>KErrNone</code> if the operation was completed 
+    *                successfully.
+    */
+    virtual void NotifyAudioProcessingCompleted(TInt aError) = 0;
+
+    };
+
+
+
+/**
+* Internal class for processing a song.
+*/
+class CAudSongProcessOperation : public CBase, public MProcProcessObserver, public MAudTimeEstimateObserver
+    {
+    
+    
+    
+public:
+
+    
+    static CAudSongProcessOperation* NewL(CAudSong* aSong);
+
+    // From MProcProcessObserver
+
+    void NotifyAudioProcessingStartedL();
+    void NotifyAudioProcessingProgressed(TInt aPercentage);
+    void NotifyAudioProcessingCompleted(TInt aError);
+    
+    // From // MAudTimeEstimateObserver
+    void NotifyTimeEstimateReady(TInt64 aTimeEstimate);
+
+    /**
+    * Starts asyncronous processing a song
+    * 
+    * Can leave with one of the system wide error codes
+    *
+    * Possible panic code
+    * <code>ESongProcessingOperationAlreadyRunning</code>
+    *
+    * @param    aFileName    output file name
+    * @param    aObserver    an observer to be notified of progress
+    * @param    aPriority    priority of audio processing operation
+    */
+    void StartASyncProcL(const TDesC& aFileName, 
+        MAudSongProcessingObserver& aObserver, TInt aPriority);
+
+
+    /**
+    * Starts syncronous song processing
+    * 
+    * Can leave with one of the system wide error codes
+    *
+    * Possible panic code
+    * <code>ESongProcessingOperationAlreadyRunning</code>
+    *
+    */
+    TBool StartSyncProcL();
+    
+    
+    /**
+    * Processes synchronously next audio frame and passes it to the caller. 
+    * If a processing operation has not been started, panic 
+    * <code>TAudPanic::ESongProcessingNotRunning</code> is raised.
+    *
+    * Possibly leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *
+    * NOTE: This function allocates memory and the caller is responsible for
+    * releasing it.
+    *
+    * @param aFrame        pointer to a processed audio frame. Has to be deleted
+    *                    when not needed anymore.
+    * @param aDuration    Duration of processed audio frame in microseconds 
+    *                    after decoding
+    * 
+    * @return ETrue        Processing operation completed, no more frames to be processed. 
+    *                    No memory allocated.
+    *          EFalse    Processing operation not completed. Last processed frame stored
+    *                    in <code>aFrame</code>. Memory allocated for the processed frame
+    *                      
+    */
+    TBool ProcessSyncPieceL(HBufC8*& aFrame, TInt& aProgress,
+                                       TTimeIntervalMicroSeconds& aDuration);
+
+    /**
+    * Cancels both syncronous and and asyncronous song processing operation and deletes the output file
+    *
+    * Possible panic code
+    * <code>ESongProcessingOperationNotRunning</code>
+    *
+    */
+    void Cancel();
+    
+    TBool GetTimeEstimateL(MAudTimeEstimateObserver& aTEObserver);
+
+
+private:
+
+    CAudSongProcessOperation(CAudSong* aSong);
+    void ConstructL();
+    virtual ~CAudSongProcessOperation();
+    
+private:
+    
+   /* 
+    * Member Variables
+    */
+    
+    // song
+    CAudSong *iSong;
+    
+    // song processing observer
+    MAudSongProcessingObserver* iObserver;
+    
+    // time estimate observer
+    MAudTimeEstimateObserver* iTEObserver;
+    
+    // A flag that indicates whether this song has changed since
+    // the last processing
+    TBool iChanged;
+    
+    // processor owned by this
+    CAudProcessor* iProcessor;
+    
+    friend class CAudSong;
+    
+    
+    };
+
+
+/**
+* Internal class for adding clips.
+*/
+class CAudSongAddClipOperation : public CBase, public MAudClipInfoObserver 
+    {
+
+public:
+
+    /*
+    * Constuctor & destructor
+    */
+
+    static CAudSongAddClipOperation* NewL(CAudSong* aSong);
+
+    virtual ~CAudSongAddClipOperation();
+        
+    /*
+    * From base class MAudClipInfoObserver
+    */
+    virtual void NotifyClipInfoReady(CAudClipInfo& aInfo, 
+        TInt aError);
+    
+    
+private:
+    
+    /*
+    * ConstructL
+    */
+    void ConstructL();
+    
+    /*
+    * C++ constructor
+    */
+    CAudSongAddClipOperation(CAudSong* aSong);
+    
+    /*
+    * Completes add clip operation
+    */
+    void CompleteAddClipOperation();
+ 
+    
+private:
+
+    // song
+    CAudSong* iSong;
+    
+    // clip that we are trying to add
+    CAudClip* iClip;
+    
+    // error possible caught by callback function NotifyClipInfoReady
+    TInt iError;
+    
+    friend class CAudSong;
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcClipInfoAO.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCCLIPINFOAO_H__
+#define __CPROCCLIPINFOAO_H__
+
+#include <e32base.h>
+#include "AudCommon.h"
+#include "AudClipInfo.h"
+
+#include "AudProcessorImpl.h"
+
+class MProcClipInfoObserver;
+class CAudProcessorImpl;
+
+class CProcClipInfoAO : public CActive 
+    {
+
+public:
+
+    static CProcClipInfoAO* NewL();
+
+    virtual ~CProcClipInfoAO();
+
+    /**
+    *
+    * Starts retrieving audio clip info
+    *
+    * @param    aFilename        filename of the input file
+    * @param    aFileHandle      file handle of the input file
+    * @param    aObserver        observer to be notified of progress
+    * @param    aProperties        properties of the input file.
+    *                            Needs to be allocated by the caller,                            
+    *                            and will filled in as a result of calling
+    *                            this function
+    * @param    aPriority        priority of the operation
+    *
+    */
+    void StartL(const TDesC& aFilename, 
+                RFile* aFileHandle,
+        MProcClipInfoObserver &aObserver,         
+        TAudFileProperties* aProperties,
+        TInt aPriority);
+        
+      
+protected:
+    virtual void RunL();
+    virtual void DoCancel();
+
+private:
+    
+
+
+    void ConstructL();
+
+
+private:
+    
+    CProcClipInfoAO();
+    MProcClipInfoObserver* iObserver;
+    TAudFileProperties* iProperties;
+    HBufC* iFileName;
+    CAudProcessorImpl* iProcessorImpl;
+    RFile* iFileHandle;
+    
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcConstants.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,966 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __PROCCONSTANTS_H__
+#define __PROCCONSTANTS_H__
+
+#include <e32std.h>
+
+const TInt KAmrBitRates[] = 
+    {
+    4750,
+    5150,
+    5900,
+    6700,
+    7400,
+    7950,
+    10200,
+    12200
+    };
+
+// bit locations for fixed codebook gains
+
+// subframe 1, bitrate 12.2 kBit/s
+const TUint8 KAmrGains122_1[] = {59+8,63+8,67+8,92+8,104+8};
+// subframe 2, bitrate 12.2 kBit/s
+const TUint8 KAmrGains122_2[] = {60+8,64+8,68+8,93+8,105+8};
+// subframe 3, bitrate 12.2 kBit/s
+const TUint8 KAmrGains122_3[] = {61+8,65+8,69+8,94+8,106+8};
+// subframe 4, bitrate 12.2 kBit/s
+const TUint8 KAmrGains122_4[] = {62+8,66+8,70+8,95+8,107+8};
+
+// subframe 1, bitrate 7.95 kBit/s
+const TUint8 KAmrGains795_1[] = {23+8,27+8,31+8,59+8,83+8};
+// subframe 2, bitrate 7.95 kBit/s
+const TUint8 KAmrGains795_2[] = {24+8,28+8,32+8,60+8,84+8};
+// subframe 3, bitrate 7.95 kBit/s
+const TUint8 KAmrGains795_3[] = {25+8,29+8,33+8,61+8,85+8};
+// subframe 4, bitrate 7.95 kBit/s
+const TUint8 KAmrGains795_4[] = {26+8,30+8,34+8,62+8,86+8};
+
+
+// subframe 1, bitrate 10.2 kBit/s
+const TUint8 KAmrGains102_1[] = {33+8,53+8,83+8,34+8,35+8,82+8,84+8};
+// subframe 2, bitrate 10.2 kBit/s
+const TUint8 KAmrGains102_2[] = {36+8,54+8,86+8,37+8,38+8,85+8,87+8};
+// subframe 3, bitrate 10.2 kBit/s
+const TUint8 KAmrGains102_3[] = {39+8,55+8,89+8,40+8,41+8,88+8,90+8};
+// subframe 4, bitrate 10.2 kBit/s
+const TUint8 KAmrGains102_4[] = {42+8,56+8,92+8,43+8,44+8,91+8,93+8};
+
+
+// subframe 1, bitrate 7.4 kBit/s
+const TUint8 KAmrGains740_1[] = {27+8,31+8,78+8,35+8,39+8,57+8,68+8};
+// subframe 2, bitrate 7.4 kBit/s
+const TUint8 KAmrGains740_2[] = {28+8,32+8,79+8,36+8,40+8,58+8,69+8};
+// subframe 3, bitrate 7.4 kBit/s
+const TUint8 KAmrGains740_3[] = {29+8,33+8,80+8,37+8,41+8,59+8,70+8};
+// subframe 4, bitrate 7.4 kBit/s
+const TUint8 KAmrGains740_4[] = {30+8,34+8,81+8,38+8,42+8,60+8,71+8};
+
+
+// subframe 1, bitrate 6.7 kBit/s
+const TUint8 KAmrGains670_1[] = {35+8,85+8,66+8,41+8,45+8,55+8,74+8};
+// subframe 2, bitrate 6.7 kBit/s
+const TUint8 KAmrGains670_2[] = {36+8,84+8,67+8,42+8,46+8,56+8,75+8};
+// subframe 3, bitrate 6.7 kBit/s
+const TUint8 KAmrGains670_3[] = {37+8,83+8,68+8,43+8,47+8,57+8,76+8};
+// subframe 4, bitrate 6.7 kBit/s
+const TUint8 KAmrGains670_4[] = {38+8,82+8,69+8,44+8,48+8,58+8,77+8};
+
+
+// subframe 1, bitrate 5.9 kBit/s
+const TUint8 KAmrGains590_1[] = {76+8,55+8,51+8,47+8,37+8,29+8};
+// subframe 2, bitrate 5.9 kBit/s
+const TUint8 KAmrGains590_2[] = {77+8,56+8,52+8,48+8,38+8,30+8};
+// subframe 3, bitrate 5.9 kBit/s
+const TUint8 KAmrGains590_3[] = {78+8,57+8,53+8,49+8,39+8,31+8};
+// subframe 4, bitrate 5.9 kBit/s
+const TUint8 KAmrGains590_4[] = {79+8,58+8,54+8,50+8,40+8,32+8};
+
+
+
+// subframe 1, bitrate 5.15 kBit/s
+const TUint8 KAmrGains515_1[] = {55+8,45+8,36+8,26+8,25+8,24+8};
+// subframe 2, bitrate 5.15 kBit/s
+const TUint8 KAmrGains515_2[] = {56+8,46+8,37+8,29+8,28+8,27+8};
+// subframe 3, bitrate 5.15 kBit/s
+const TUint8 KAmrGains515_3[] = {57+8,47+8,38+8,32+8,31+8,30+8};
+// subframe 4, bitrate 5.15 kBit/s
+const TUint8 KAmrGains515_4[] = {58+8,48+8,39+8,35+8,34+8,33+8};
+
+
+//subframes 1 & s, bitrate 4.75 kBit/s
+const TUint8 KAmrGains475_1_2[] = {49+8,48+8,47+8,46+8,31+8,30+8,29+8,28+8};
+const TUint8 KAmrGains475_3_4[] = {43+8,42+8,41+8,40+8,35+8,34+8,33+8,32+8};
+
+
+// gp:s
+
+// subframe 1, bitrate 12.2 kBit/s
+const TUint8 KAmrGPGains122_1[] = {47+8, 51+8,55+8,88+8};
+// subframe 2, bitrate 12.2 kBit/s
+const TUint8 KAmrGPGains122_2[] = {48+8, 52+8,56+8,89+8};
+// subframe 3, bitrate 12.2 kBit/s
+const TUint8 KAmrGPGains122_3[] = {49+8, 53+8,57+8,90+8};
+// subframe 4, bitrate 12.2 kBit/s
+const TUint8 KAmrGPGains122_4[] = {50+8, 54+8,58+8,91+8};
+
+
+// subframe 1, bitrate 7.95 kBit/s
+const TUint8 KAmrGPGains795_1[] = {35+8, 39+8, 79+8, 87+8};
+// subframe 2, bitrate 7.95 kBit/s
+const TUint8 KAmrGPGains795_2[] = {36+8, 40+8, 80+8, 88+8};
+// subframe 3, bitrate 7.95 kBit/s
+const TUint8 KAmrGPGains795_3[] = {37+8, 41+8, 81+8, 89+8};
+// subframe 4, bitrate 7.95 kBit/s
+const TUint8 KAmrGPGains795_4[] = {38+8, 42+8, 82+8, 90+8};
+
+// Gain table 12.2 kBit/s and 7.95 kBit/s, scalar quantized
+const TInt KAmrGainTable122[] = 
+	{
+	159,
+	206,
+	268,
+	349,
+	419,
+	482,
+	554,
+	637,
+	733,
+	842,
+	969,
+	1114,
+	1281,
+	1473,
+	1694,
+	1948,
+	2241,
+	2577,
+	2963,
+	3408,
+	3919,
+	4507,
+	5183,
+	5960,
+	6855,
+	7883,
+	9065,
+	10425,
+	12510,
+	16263,
+	21142,
+	27485
+	};
+
+#define NB_QUA_PITCH 16
+
+const TInt KAmrGPTable[NB_QUA_PITCH] =
+{
+    0, 3277, 6556, 8192, 9830, 11469, 12288, 13107,
+    13926, 14746, 15565, 16384, 17203, 18022, 18842, 19661
+};
+
+
+const TInt KAmrLargestGain122 = 27485;
+
+// Gain table, 10.2, 6.70 and 7.40 kBit/s vector quantized
+
+// index = 0...127
+// KAmrGainTable[2*index] = g_pitch
+// KAmrGainTable[2*index+1] = g_fac (fixed codebook gain)
+
+const TInt KAmrGainTable102[] =
+    {
+//g_pit,    g_fac 
+    577,      662,        
+    806,     1836,           
+   3109,     1052,   
+   4181,     1387,           
+   2373,     1425,           
+   3248,     1985,           
+   1827,     2320,           
+    941,     3314,           
+   2351,     2977,           
+   3616,     2420,           
+   3451,     3096,           
+   2955,     4301,           
+   1848,     4500,           
+   3884,     5416,           
+   1187,     7210,           
+   3083,     9000,           
+   7384,      883,           
+   5962,     1506,           
+   5155,     2134,           
+   7944,     2009,           
+   6507,     2250,           
+   7670,     2752,           
+   5952,     3016,           
+   4898,     3764,           
+   6989,     3588,           
+   8174,     3978,           
+   6064,     4404,           
+   7709,     5087,           
+   5523,     6021,           
+   7769,     7126,           
+   6060,     7938,           
+   5594,    11487,           
+  10581,     1356,           
+   9049,     1597,           
+   9794,     2035,           
+   8946,     2415,            
+  10296,     2584,         
+   9407,     2734,            
+   8700,     3218,            
+   9757,     3395,            
+  10177,     3892,             
+   9170,     4528,            
+  10152,     5004,            
+   9114,     5735,            
+  10500,     6266,           
+  10110,     7631,            
+   8844,     8727,            
+   8956,    12496,          
+  12924,      976,          
+  11435,     1755,           
+  12138,     2328,            
+  11388,     2368,            
+  10700,     3064,            
+  12332,     2861,            
+  11722,     3327,            
+  11270,     3700,            
+  10861,     4413,           
+  12082,     4533,             
+  11283,     5205,            
+  11960,     6305,            
+  11167,     7534,             
+  12128,     8329,            
+  10969,    10777,            
+  10300,    17376,            
+  13899,     1681,           
+  12580,     2045,          
+  13265,     2439,           
+  14033,     2989,            
+  13452,     3098,           
+  12396,     3658,           
+  13510,     3780,            
+  12880,     4272,             
+  13533,     4861,           
+  12667,     5457,             
+  13854,     6106,             
+  13031,     6483,           
+  13557,     7721,             
+  12957,     9311,           
+  13714,    11551,            
+  12591,    15206,           
+  15113,     1540,           
+  15072,     2333,            
+  14527,     2511,           
+  14692,     3199,            
+  15382,     3560,           
+  14133,     3960,             
+  15102,     4236,             
+  14332,     4824,            
+  14846,     5451,           
+  15306,     6083,            
+  14329,     6888,           
+  15060,     7689,             
+  14406,     9426,           
+  15387,     9741,           
+  14824,    14271,           
+  13600,    24939,          
+  16396,     1969,           
+  16817,     2832,           
+  15713,     2843,            
+  16104,     3336,            
+  16384,     3963,            
+  16940,     4579,             
+  15711,     4599,            
+  16222,     5448,             
+  16832,     6382,            
+  15745,     7141,            
+  16326,     7469,           
+  16611,     8624,          
+  17028,    10418,           
+  15905,    11817,            
+  16878,    14690,            
+  16515,    20870,            
+  18142,     2083,            
+  19401,     3178,           
+  17508,     3426,            
+  20054,     4027,            
+  18069,     4249,             
+  18952,     5066,             
+  17711,     5402,             
+  19835,     6192,             
+  17950,     7014,            
+  21318,     7877,             
+  17910,     9289,           
+  19144,     9290,           
+  20517,    11381,           
+  18075,    14485,            
+  19999,    17882,            
+  18842,    32764
+  };
+
+const TInt KAmrLargestGain102 = 32764;
+
+
+// Gain table, 5.9 and 5.15 kBit/s vector quantized
+
+// index = 0...127
+// KAmrGainTable[2*index] = g_pitch
+// KAmrGainTable[2*index+1] = g_fac 
+// g_pitch        (Q14),
+// g_fac          (Q12), 
+
+const TInt KAmrGainTable590[] =
+    {
+//g_pit,    g_fac  
+  10813,    28753,            
+  20480,     2785,          
+  18841,     6594,           
+   6225,     7413,           
+  17203,    10444,           
+  21626,     1269,           
+  21135,     4423,           
+  11304,     1556,           
+  19005,    12820,            
+  17367,     2498,           
+  17858,     4833,            
+   9994,     2498,           
+  17530,     7864,            
+  14254,     1884,          
+  15892,     3153,            
+   6717,     1802,           
+  18186,    20193,            
+  18022,     3031,            
+  16711,     5857,             
+   8847,     4014,            
+  15892,     8970,            
+  18022,     1392,           
+  16711,     4096,              
+   8192,      655,           
+  15237,    13926,            
+  14254,     3112,            
+  14090,     4669,            
+   5406,     2703,            
+  13434,     6553,             
+  12451,      901,           
+  12451,     2662,           
+   3768,      655,           
+  14745,    23511,            
+  19169,     2457,            
+  20152,     5079,            
+   6881,     4096,               
+  20480,     8560,           
+  19660,      737,           
+  19005,     4259,             
+   7864,     2088,            
+  11468,    12288,           
+  15892,     1474,           
+  15728,     4628,            
+   9175,     1433,           
+  16056,     7004,           
+  14827,      737,          
+  15073,     2252,           
+   5079,     1228,           
+  13271,    17326,           
+  16547,     2334,            
+  15073,     5816,             
+   3932,     3686,           
+  14254,     8601,           
+  16875,      778,           
+  15073,     3809,           
+   6062,      614,           
+   9338,     9256,            
+  13271,     1761,           
+  13271,     3522,           
+   2457,     1966,           
+  11468,     5529,            
+  10485,      737,           
+  11632,     3194,           
+   1474,      778           
+    };
+
+const TInt KAmrLargestGain590 = 23511;
+
+
+// index = 0...127
+// KAmrGainTable[4*index] = g_pitch(even frame)
+// KAmrGainTable[4*index+1] = g_fac(even frame)
+// KAmrGainTable[4*index+2] = g_pitch(odd frame)
+// KAmrGainTable[4*index+3] = g_fac(odd frame)
+
+
+const TInt KAmrGainTable475[] = 
+    {
+//g_pit(0),    g_fac(0),      g_pit(1),    g_fac(1)      
+   812,          128,           542,      140,
+  2873,         1135,          2266,     3402,
+  2067,          563,         12677,      647,
+  4132,         1798,          5601,     5285,
+  7689,          374,          3735,      441,
+ 10912,         2638,         11807,     2494,
+ 20490,          797,          5218,      675,
+  6724,         8354,          5282,     1696,
+  1488,          428,          5882,      452,
+  5332,         4072,          3583,     1268,
+  2469,          901,         15894,     1005,
+ 14982,         3271,         10331,     4858,
+  3635,         2021,          2596,      835,
+ 12360,         4892,         12206,     1704,
+ 13432,         1604,          9118,     2341,
+  3968,         1538,          5479,     9936,
+  3795,          417,          1359,      414,
+  3640,         1569,          7995,     3541,
+ 11405,          645,          8552,      635,
+  4056,         1377,         16608,     6124,
+ 11420,          700,          2007,      607,
+ 12415,         1578,         11119,     4654,
+ 13680,         1708,         11990,     1229,
+  7996,         7297,         13231,     5715,
+  2428,         1159,          2073,     1941,
+  6218,         6121,          3546,     1804,
+  8925,         1802,          8679,     1580,
+ 13935,         3576,         13313,     6237,
+  6142,         1130,          5994,     1734,
+ 14141,         4662,         11271,     3321,
+ 12226,         1551,         13931,     3015,
+  5081,        10464,          9444,     6706,
+  1689,          683,          1436,     1306,
+  7212,         3933,          4082,     2713,
+  7793,          704,         15070,      802,
+  6299,         5212,          4337,     5357,
+  6676,          541,          6062,      626,
+ 13651,         3700,         11498,     2408,
+ 16156,          716,         12177,      751,
+  8065,        11489,          6314,     2256,
+  4466,          496,          7293,      523,
+ 10213,         3833,          8394,     3037,
+  8403,          966,         14228,     1880,
+  8703,         5409,         16395,     4863,
+  7420,         1979,          6089,     1230,
+  9371,         4398,         14558,     3363,
+ 13559,         2873,         13163,     1465,
+  5534,         1678,         13138,    14771,
+  7338,          600,          1318,      548,
+  4252,         3539,         10044,     2364,
+ 10587,          622,         13088,      669,
+ 14126,         3526,          5039,     9784,
+ 15338,          619,          3115,      590,
+ 16442,         3013,         15542,     4168,
+ 15537,         1611,         15405,     1228,
+ 16023,         9299,          7534,     4976,
+  1990,         1213,         11447,     1157,
+ 12512,         5519,          9475,     2644,
+  7716,         2034,         13280,     2239,
+ 16011,         5093,          8066,     6761,
+ 10083,         1413,          5002,     2347,
+ 12523,         5975,         15126,     2899,
+ 18264,         2289,         15827,     2527,
+ 16265,        10254,         14651,    11319,
+  1797,          337,          3115,      397,
+  3510,         2928,          4592,     2670,
+  7519,          628,         11415,      656,
+  5946,         2435,          6544,     7367,
+  8238,          829,          4000,      863,
+ 10032,         2492,         16057,     3551,
+ 18204,         1054,          6103,     1454,
+  5884,         7900,         18752,     3468,
+  1864,          544,          9198,      683,
+ 11623,         4160,          4594,     1644,
+  3158,         1157,         15953,     2560,
+ 12349,         3733,         17420,     5260,
+  6106,         2004,          2917,     1742,
+ 16467,         5257,         16787,     1680,
+ 17205,         1759,          4773,     3231,
+  7386,         6035,         14342,    10012,
+  4035,          442,          4194,      458,
+  9214,         2242,          7427,     4217,
+ 12860,          801,         11186,      825,
+ 12648,         2084,         12956,     6554,
+  9505,          996,          6629,      985,
+ 10537,         2502,         15289,     5006,
+ 12602,         2055,         15484,     1653,
+ 16194,         6921,         14231,     5790,
+  2626,          828,          5615,     1686,
+ 13663,         5778,          3668,     1554,
+ 11313,         2633,          9770,     1459,
+ 14003,         4733,         15897,     6291,
+  6278,         1870,          7910,     2285,
+ 16978,         4571,         16576,     3849,
+ 15248,         2311,         16023,     3244,
+ 14459,        17808,         11847,     2763,
+  1981,         1407,          1400,      876,
+  4335,         3547,          4391,     4210,
+  5405,          680,         17461,      781,
+  6501,         5118,          8091,     7677,
+  7355,          794,          8333,     1182,
+ 15041,         3160,         14928,     3039,
+ 20421,          880,         14545,      852,
+ 12337,        14708,          6904,     1920,
+  4225,          933,          8218,     1087,
+ 10659,         4084,         10082,     4533,
+  2735,          840,         20657,     1081,
+ 16711,         5966,         15873,     4578,
+ 10871,         2574,          3773,     1166,
+ 14519,         4044,         20699,     2627,
+ 15219,         2734,         15274,     2186,
+  6257,         3226,         13125,    19480,
+  7196,          930,          2462,     1618,
+  4515,         3092,         13852,     4277,
+ 10460,          833,         17339,      810,
+ 16891,         2289,         15546,     8217,
+ 13603,         1684,          3197,     1834,
+ 15948,         2820,         15812,     5327,
+ 17006,         2438,         16788,     1326,
+ 15671,         8156,         11726,     8556,
+  3762,         2053,          9563,     1317,
+ 13561,         6790,         12227,     1936,
+  8180,         3550,         13287,     1778,
+ 16299,         6599,         16291,     7758,
+  8521,         2551,          7225,     2645,
+ 18269,         7489,         16885,     2248,
+ 17882,         2884,         17265,     3328,
+  9417,        20162,         11042,     8320,
+  1286,          620,          1431,      583,
+  5993,         2289,          3978,     3626,
+  5144,          752,         13409,      830,
+  5553,         2860,         11764,     5908,
+ 10737,          560,          5446,      564,
+ 13321,         3008,         11946,     3683,
+ 19887,          798,          9825,      728,
+ 13663,         8748,          7391,     3053,
+  2515,          778,          6050,      833,
+  6469,         5074,          8305,     2463,
+  6141,         1865,         15308,     1262,
+ 14408,         4547,         13663,     4515,
+  3137,         2983,          2479,     1259,
+ 15088,         4647,         15382,     2607,
+ 14492,         2392,         12462,     2537,
+  7539,         2949,         12909,    12060,
+  5468,          684,          3141,      722,
+  5081,         1274,         12732,     4200,
+ 15302,          681,          7819,      592,
+  6534,         2021,         16478,     8737,
+ 13364,          882,          5397,      899,
+ 14656,         2178,         14741,     4227,
+ 14270,         1298,         13929,     2029,
+ 15477,         7482,         15815,     4572,
+  2521,         2013,          5062,     1804,
+  5159,         6582,          7130,     3597,
+ 10920,         1611,         11729,     1708,
+ 16903,         3455,         16268,     6640,
+  9306,         1007,          9369,     2106,
+ 19182,         5037,         12441,     4269,
+ 15919,         1332,         15357,     3512,
+ 11898,        14141,         16101,     6854,
+  2010,          737,          3779,      861,
+ 11454,         2880,          3564,     3540,
+  9057,         1241,         12391,      896,
+  8546,         4629,         11561,     5776,
+  8129,          589,          8218,      588,
+ 18728,         3755,         12973,     3149,
+ 15729,          758,         16634,      754,
+ 15222,        11138,         15871,     2208,
+  4673,          610,         10218,      678,
+ 15257,         4146,          5729,     3327,
+  8377,         1670,         19862,     2321,
+ 15450,         5511,         14054,     5481,
+  5728,         2888,          7580,     1346,
+ 14384,         5325,         16236,     3950,
+ 15118,         3744,         15306,     1435,
+ 14597,         4070,         12301,    15696,
+  7617,         1699,          2170,      884,
+  4459,         4567,         18094,     3306,
+ 12742,          815,         14926,      907,
+ 15016,         4281,         15518,     8368,
+ 17994,         1087,          2358,      865,
+ 16281,         3787,         15679,     4596,
+ 16356,         1534,         16584,     2210,
+ 16833,         9697,         15929,     4513,
+  3277,         1085,          9643,     2187,
+ 11973,         6068,          9199,     4462,
+  8955,         1629,         10289,     3062,
+ 16481,         5155,         15466,     7066,
+ 13678,         2543,          5273,     2277,
+ 16746,         6213,         16655,     3408,
+ 20304,         3363,         18688,     1985,
+ 14172,        12867,         15154,    15703,
+  4473,         1020,          1681,      886,
+  4311,         4301,          8952,     3657,
+  5893,         1147,         11647,     1452,
+ 15886,         2227,          4582,     6644,
+  6929,         1205,          6220,      799,
+ 12415,         3409,         15968,     3877,
+ 19859,         2109,          9689,     2141,
+ 14742,         8830,         14480,     2599,
+  1817,         1238,          7771,      813,
+ 19079,         4410,          5554,     2064,
+  3687,         2844,         17435,     2256,
+ 16697,         4486,         16199,     5388,
+  8028,         2763,          3405,     2119,
+ 17426,         5477,         13698,     2786,
+ 19879,         2720,          9098,     3880,
+ 18172,         4833,         17336,    12207,
+  5116,          996,          4935,      988,
+  9888,         3081,          6014,     5371,
+ 15881,         1667,          8405,     1183,
+ 15087,         2366,         19777,     7002,
+ 11963,         1562,          7279,     1128,
+ 16859,         1532,         15762,     5381,
+ 14708,         2065,         20105,     2155,
+ 17158,         8245,         17911,     6318,
+  5467,         1504,          4100,     2574,
+ 17421,         6810,          5673,     2888,
+ 16636,         3382,          8975,     1831,
+ 20159,         4737,         19550,     7294,
+  6658,         2781,         11472,     3321,
+ 19397,         5054,         18878,     4722,
+ 16439,         2373,         20430,     4386,
+ 11353,        26526,         11593,     3068,
+  2866,         1566,          5108,     1070,
+  9614,         4915,          4939,     3536,
+  7541,          878,         20717,      851,
+  6938,         4395,         16799,     7733,
+ 10137,         1019,          9845,      964,
+ 15494,         3955,         15459,     3430,
+ 18863,          982,         20120,      963,
+ 16876,        12887,         14334,     4200,
+  6599,         1220,          9222,      814,
+ 16942,         5134,          5661,     4898,
+  5488,         1798,         20258,     3962,
+ 17005,         6178,         17929,     5929,
+  9365,         3420,          7474,     1971,
+ 19537,         5177,         19003,     3006,
+ 16454,         3788,         16070,     2367,
+  8664,         2743,          9445,    26358,
+ 10856,         1287,          3555,     1009,
+  5606,         3622,         19453,     5512,
+ 12453,          797,         20634,      911,
+ 15427,         3066,         17037,    10275,
+ 18883,         2633,          3913,     1268,
+ 19519,         3371,         18052,     5230,
+ 19291,         1678,         19508,     3172,
+ 18072,        10754,         16625,     6845,
+  3134,         2298,         10869,     2437,
+ 15580,         6913,         12597,     3381,
+ 11116,         3297,         16762,     2424,
+ 18853,         6715,         17171,     9887,
+ 12743,         2605,          8937,     3140,
+ 19033,         7764,         18347,     3880,
+ 20475,         3682,         19602,     3380,
+ 13044,        19373,         10526,    23124
+};
+
+const TInt KAmrLargestGain475 = 26526;
+
+
+// KAmrGaindB2Gamma[0] is gamma*10000 at -127 dB
+// KAmrGaindB2Gamma[1] is gamma*10000 at -126 dB
+// KAmrGaindB2Gamma[127] is gamma*10000 at 0 dB
+// KAmrGaindB2Gamma[128] is gamma*10000 at 1 dB
+// KAmrGaindB2Gamma[255] is gamma*10000 at 128 dB
+
+const TInt KAmrGain_dB2Gamma[] = 
+
+    {
+53,
+55,
+58,
+60,
+62,
+65,
+68,
+71,
+74,
+77,
+80,
+83,
+87,
+91,
+94,
+98,
+103,
+107,
+111,
+116,
+121,
+126,
+131,
+137,
+143,
+149,
+155,
+161,
+168,
+175,
+183,
+190,
+198,
+207,
+215,
+225,
+234,
+244,
+254,
+265,
+276,
+288,
+300,
+312,
+325,
+339,
+353,
+368,
+384,
+400,
+417,
+435,
+453,
+472,
+492,
+512,
+534,
+557,
+580,
+604,
+630,
+656,
+684,
+713,
+743,
+774,
+807,
+841,
+876,
+913,
+952,
+992,
+1034,
+1077,
+1122,
+1170,
+1219,
+1270,
+1324,
+1380,
+1438,
+1498,
+1562,
+1627,
+1696,
+1767,
+1842,
+1919,
+2000,
+2084,
+2172,
+2264,
+2359,
+2459,
+2562,
+2670,
+2783,
+2900,
+3022,
+3149,
+3282,
+3420,
+3564,
+3714,
+3871,
+4034,
+4204,
+4381,
+4566,
+4758,
+4958,
+5167,
+5385,
+5612,
+5848,
+6095,
+6351,
+6619,
+6898,
+7188,
+7491,
+7807,
+8136,
+8478,
+8836,
+9208,
+9596,
+10000,
+10421,
+10860,
+11318,
+11795,
+12292,
+12809,
+13349,
+13911,
+14497,
+15108,
+15745,
+16408,
+17099,
+17820,
+18570,
+19353,
+20168,
+21017,
+21903,
+22826,
+23787,
+24789,
+25834,
+26922,
+28056,
+29238,
+30470,
+31754,
+33091,
+34485,
+35938,
+37452,
+39030,
+40674,
+42388,
+44173,
+46034,
+47974,
+49995,
+52101,
+54296,
+56583,
+58967,
+61451,
+64040,
+66738,
+69549,
+72479,
+75533,
+78715,
+82031,
+85487,
+89088,
+92841,
+96753,
+100829,
+105076,
+109503,
+114116,
+118924,
+123934,
+129155,
+134596,
+140266,
+146175,
+152334,
+158751,
+165439,
+172409,
+179672,
+187241,
+195129,
+203350,
+211917,
+220844,
+230148,
+239844,
+249948,
+260478,
+271451,
+282887,
+294804,
+307224,
+320167,
+333655,
+347711,
+362360,
+377625,
+393534,
+410113,
+427390,
+445395,
+464159,
+483713,
+504091,
+525327,
+547459,
+570522,
+594557,
+619605,
+645708,
+672910,
+701258,
+730801,
+761589,
+793673,
+827109,
+861954,
+898266,
+936108,
+975545,
+1016643,
+1059472,
+1104106,
+1150620,
+1199093,
+1249609,
+1302253,
+1357114,
+1414287,
+1473869,
+1535960,
+1600667,
+1668101,
+1738375,
+1811609,
+1887929,
+    };
+
+
+
+
+/*
+ * definition of modes for decoder
+ */
+enum Mode 
+    { 
+    MR475 = 0,
+    MR515,
+    MR59,
+    MR67,
+    MR74,
+    MR795,
+    MR102,
+    MR122,
+    MRDTX,
+    N_MODES     /* number of (SPC) modes */
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcDecoder.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCProcDecoder_H__
+#define __CPROCProcDecoder_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include <MMFCodec.h>
+
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "RateConverter.h"
+
+class CProcDecoder : public CBase
+    {
+
+public:
+    
+    /*
+    * Symbian constructors
+    *
+    */
+    
+    static CProcDecoder* NewL();
+                                        
+    static CProcDecoder* NewLC();
+
+    /*
+    * Destructor
+    */
+    ~CProcDecoder();
+    
+    /*
+    * Initialize the decoder
+    *
+    * @param aProperties            properties of the input clip (in compressed domain)
+    * @param aTargetSamplingRate    sampling rate to decode to
+    * @param aChannelMode           channel mode to decode to
+    *
+    * @return ETrue if successful
+    *
+    */
+
+    TBool InitL(TAudFileProperties aProperties, TInt aTargetSamplingRate, TChannelMode aChannelMode);
+
+    /*
+    * Feed the encoder
+    *
+    * @param    aEncFrame   encoded input frame
+    * @param    aDecbuffer  buffer for decoded output data
+    *
+    * @return   ETrue if output was generated, EFalse if more data is needed
+    */
+        
+    TBool FillDecBufferL(const HBufC8* aEncFrame, HBufC8*& aDecBuffer);
+    
+    
+
+protected:
+    
+    // constructL    
+    void ConstructL();
+    
+    // C++ constructor
+    CProcDecoder();
+    
+    // configure AAC decoder
+    // configure AAC Plus decoder
+    void ConfigureAACPlusDecoderL();
+    
+    // configure MP3 decoder
+    void ConfigureMP3DecoderL();
+    
+    // if input buffer is too small
+    void ReAllocBufferL( CMMFDataBuffer* aBuffer, TInt aNewMaxSize );
+    
+    // feed the codec
+    void FeedCodecL( CMMFCodec* aCodec, CMMFDataBuffer* aSourceBuffer, CMMFDataBuffer* aDestBuffer );
+    
+    // decode
+    TCodecProcessResult DecodeL( CMMFCodec* aCodec, CMMFDataBuffer* aInBuffer, CMMFDataBuffer* aOutBuffer);
+ 
+    // is supported dest codec?
+    TBool GetIsSupportedSourceCodec();
+     
+    // set source codec
+    void SetSourceCodecL();
+     
+    // is codec available?
+    TBool CheckIfCodecAvailableL(const TDesC8& aCodecFourCCString, const TUid& aCodecUId );
+ 
+    // update output buffer
+    TBool UpdateOutputBufferL(CMMFDataBuffer* aInBuffer);
+     
+ protected:
+     
+    // properties of the input data
+    TAudFileProperties iProperties;
+    
+    // a flag to indicate if decoding can take place
+    TBool iReady;
+    
+    // Input buffer for decoder.
+    CMMFDataBuffer* iSourceInputBuffer;
+    
+    // Input buffer for encoder (alternative output buffer for decoder).
+    CMMFDataBuffer* iDestInputBuffer;
+    
+    CMMFDataBuffer* iSampleRateChannelBuffer;
+        
+    // Codec used in decoding input audio to PCM16
+    CMMFCodec* iSourceCodec;
+    
+    // Channel and sample rate converter
+    CRateConverter* iRateConverter;    
+    
+    // Whether audio converter needs to do channel and/or samplerate conversion.
+    TBool iDoSampleRateChannelConversion;
+    
+    // Whether decoding is required (not required if input is WAV)
+    TBool iDoDecoding;
+
+    // Samplerate to convert from.
+    TInt iFromSampleRate;
+    // Samplerate to convert to.
+    TInt iToSampleRate;
+    // Number of channels in input.
+    TInt iFromChannels;
+    // Number of channels in output.
+    TInt iToChannels;
+    
+    // a pointer to store output buffer
+    HBufC8* iDecBuffer;
+   
+    // decimation factor for decoder
+    TInt iDecimFactor;
+
+    
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcEncoder.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCENCODER_H__
+#define __CPROCENCODER_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include <MMFCodec.h>
+
+#include "AudCommon.h"
+#include "ProcConstants.h"
+
+class CProcEncoder : public CBase
+    {
+
+public:
+    
+    /*
+    * Symbian constructors
+    */
+    
+    static CProcEncoder* NewL();
+                                        
+    static CProcEncoder* NewLC();
+
+    /*
+    * Destructor
+    */
+    ~CProcEncoder();
+
+    
+    /*
+    * Initializes encoder
+    *
+    * @param aAudioType             target audio type, EAudAMR and EAudAAC_MPEG4 supported
+    * @param aTargetSamplingRate    target sampling rate, 8000, 16000 supported, later 48000
+    * @param aChannelMode           target channel mode EAudSingleChannel supported, stereo later
+    *
+    * @return   ETrue if successful, EFalse if not
+    *
+    */
+    
+    TBool InitL(TAudType aAudioType, TInt aTargetSamplingRate, TChannelMode aChannelMode, TInt aBitrate);
+    
+    /*
+    * Feed the encoder
+    * If the encoder has enough data, output is written to aEncBuffer
+    *
+    * @param aRawFrame             input for the encoder, must have the same sample rate
+    *                              and channel mode as the desired target
+    * @param aEncBuffer            buffer for output
+    * @param aOutputDurationMilli  duration of the output buffer in return
+    *
+    * @return   ETrue if data was written to aEncBuffer, EFalse otherwise
+    *
+    */
+    TBool FillEncBufferL(const TDesC8& aRawFrame, HBufC8* aEncBuffer, TInt& aOutputDurationMilli);
+    
+    /*
+    * Returns the destination audio type
+    *
+    * @return destination audio type
+    */
+    TAudType DestAudType();
+    
+protected:
+    
+    // constructL    
+    void ConstructL();
+    
+    // C++ constructor
+    CProcEncoder();
+    
+    // reallocates a data buffer
+    void ReAllocBufferL( CMMFDataBuffer* aBuffer, TInt aNewMaxSize );
+    
+    // feed codec
+    void FeedCodecL( CMMFCodec* aCodec, CMMFDataBuffer* aSourceBuffer, CMMFDataBuffer* aDestBuffer );
+    
+    // encodeL
+    TCodecProcessResult EncodeL( CMMFCodec* aCodec, CMMFDataBuffer* aInBuffer, CMMFDataBuffer* aOutBuffer);
+ 
+    // is the destination codec supported?
+    TBool GetIsSupportedDestCodec();
+     
+    // configure AMR encoder
+    void ConfigureAMREncoderL();
+    
+    // configure AAC encoder
+    void ConfigureAACEncoderL();
+    
+    // set destination codec
+    void SetDestCodecL();
+     
+    // is codec available?
+    TBool CheckIfCodecAvailableL(const TDesC8& aCodecFourCCString, const TUid& aCodecUId);
+    
+protected:    
+
+    // target audio type
+    TAudType iAudioType;
+    
+    // is encoder ready for processing
+    TBool iReady;
+    
+    // Input buffer for raw data
+    CMMFDataBuffer* iSourceInputBuffer;
+    
+    // Input buffer for encoder (alternative output buffer for decoder).
+    CMMFDataBuffer* iDestInputBuffer;
+        
+    // Codec used in decoding input audio to PCM16
+    CMMFCodec* iDestCodec;
+    
+    // Samplerate to encode to.
+    TInt iToSampleRate;
+    // Number of channels in output and input
+    TInt iToChannels;
+    
+    // target bitrate
+    TInt iToBitRate;
+    
+    // output duration
+    TInt iOutputFrameDurationMilli;
+    
+    // sometimes more than one AMR frame are written to the output with one call
+    TInt iNumberOfFramesInOutputBuffer;
+    
+    // buffer for output
+    HBufC8* iEncBuffer;
+      
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcFrameHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCFRAMEHANDLER_H__
+#define __CPROCFRAMEHANDLER_H__
+
+#include <e32base.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+
+class CProcFrameHandler : public CBase 
+    {
+
+public:
+
+
+    /**
+    * Manipulates the gain of a certain audio frame
+    *
+    * @param    aFrameIn        a frame to be modified
+    * @param    aFrameOut    a modified frame, the caller is responsible for releasing!
+    * @param    aGain        gain change. One step represents 0.5 dB, so that
+    *                        0->no change, 10 -> +5dB and -10 -> -5dB
+    * @return    ETrue        if successful
+    *
+    *
+    */
+    virtual TBool ManipulateGainL(const HBufC8* aFrameIn, HBufC8*& aFrameOut, TInt8 aGain) = 0;
+
+    /**
+    * Retrieves the gains of a certain audio frame
+    *
+    * @param    aFrame    an audio frame
+    * @param    aGains    retrieved gains
+    * @param    aMaxGain the biggest possible gain value
+    * @return    ETrue    if successful
+    *
+    *
+    */
+    virtual TBool GetGainL(const HBufC8* aFrame, RArray<TInt>& aGains, TInt& aMaxGain) const = 0;
+
+    /**
+    * Calculates how many decibels this frame can be amplified
+    *
+    * @param aFrame        an audio frame
+    * @param aMargin    margin in debicels/2 -> 4 equals 2 decibels    
+    */
+    virtual TBool GetNormalizingMargin(const HBufC8* aFrame, TInt8& aMargin) const = 0;
+
+    /**
+    * Tells whether mixing is available or not
+    *
+    * @return ETrue        mixing is available
+    * @return EFalse    mixing is not available
+    */
+    virtual TBool IsMixingAvailable() const;
+
+    /**
+    * Mixes two frames with each other
+    *
+    * @param aFrame1        frame 1 to be mixed
+    * @param aFrame2        frame 2 to be mixed
+    * @param aMixedFrame    resulting mixed frame
+    *
+    * @return                ETrue if mixing was successful. The caller is responsible for releasing memory
+    *                        EFalse if mixing was not successful. aMixedFrame = 0 and the caller
+    *                                doesn't need to release memory
+    */
+    virtual TBool MixL(const HBufC8* aFrame1, const HBufC8* aFrame2, HBufC8*& aMixedFrame);
+
+
+    virtual ~CProcFrameHandler();
+
+private:
+
+protected:
+
+    
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcInFileHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,392 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCINFILEHANDLER_H__
+#define __CPROCINFILEHANDLER_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include "ProcFrameHandler.h"
+#include "ProcWAVFrameHandler.h"
+
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "AudClip.h"
+#include "ProcDecoder.h"
+
+class CProcInFileHandler : public CBase
+    {
+
+public:
+
+    /*
+    * Destructor
+    */
+    virtual ~CProcInFileHandler();
+
+
+    /**
+    * Gets properties of this input clip
+    *
+    * @param aProperties    audio clip properties. Needs to be allocated by the caller
+    *                        and is filled in by this function                        
+    *
+    */
+    virtual void GetPropertiesL(TAudFileProperties* aProperties) = 0;
+
+    /*
+    *
+    * Is decoding required?
+    */
+
+    TBool DecodingRequired();
+
+    /*
+    *
+    * Returns the size of a decoded frame
+    */   
+    TInt GetDecodedFrameSize();
+
+    /*
+    *
+    * Sets whether decoding is required?
+    */
+
+    void SetDecodingRequired(TBool aDecodingRequired);
+
+    /**
+    * Reads the next audio frame
+    * This function allocates memory and
+    * the caller is responsible for releasing it
+    *
+    * Possible leave codes:
+    *
+    *
+    * @param    aFrame        audio frame
+    * @param    aSize        size of the retrieved audio frame
+    * @param    aTime    duration of the returned frame in milliseconds
+    * @return    ETrue  if a frame was read
+    *            EFalse if frame was not read (EOF)
+    */
+    TBool GetAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime, TBool& aRawFrame);
+    
+    TBool GetRawAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime);
+
+
+    /**
+    * Sets properties of this in file handler
+    *
+    * @param aProperties    audio clip properties                        
+    *
+    */
+    
+    TBool SetPropertiesL(TAudFileProperties aProperties);
+    
+    /*
+    * Set the size of raw audio frames
+    *
+    * @param    aSize audio size
+    *
+    * @return   ETrue if successful, EFalse otherwise
+    */
+    
+    TBool SetRawAudioFrameSize(TInt aSize);
+    
+    
+    /**
+    * Seeks a certain audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    * @param aTime            time from the beginning of file in milliseconds
+    *
+    * @return    ETrue if successful
+    *            EFalse if beyond the file
+    */
+    virtual TBool SeekAudioFrame(TInt32 aTime) = 0;
+
+
+    /**
+    * Seeks a cut in audio frame for reading
+    *
+    * Possible leave codes:  
+    *    
+    *
+    * @return    ETrue if successful
+    *                
+    */
+    virtual TBool SeekCutInFrame() = 0;
+    
+
+    //virtual TBool GetAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime, TBool& aRawFrame) = 0;
+    
+    
+    /**
+    * Generates and returns a silent audio frame
+    * This function allocates memory and
+    * the caller is responsible for releasing it.
+    * The silent frame is generated according to audio
+    * properties of this input clip 
+    * (e.g. sampling rate, channel configuration, bitrate etc)
+    *
+    * Possible leave codes: , at least <code>KErrNotMemory</code>
+    *
+    *
+    * @param    aFrame        audio frame
+    * @param    aSize        size of the silent audio frame
+    * @param    aDuration    duration of the returned silent frame in milliseconds
+    * @return    ETrue  if a frame was generated
+    *            EFalse if frame was not generated (EOF, no need to release aFrame)
+    */
+    virtual TBool GetSilentAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aDuration,  TBool& aRawFrame);
+    
+
+
+    /**
+    * Gets the priority of this clip
+    *
+    * @return    priority of this clip
+    *
+    */
+    TInt Priority() const;
+
+    /**
+    * Gets the current time of the frame reading
+    *
+    * @return    current time in milliseconds
+    *
+    */
+    TInt32 GetCurrentTimeMilliseconds();
+
+    /**
+    * Gets the normalizing margin of this clip
+    *
+    * @return    normalizing margin
+    *
+    */
+    TInt8 NormalizingMargin() const;
+
+    /**
+    *
+    * Set priority of this clip
+    * 
+    * @param aPriority priority >= 0
+    *
+    * @return ETrue if priority >= 0 
+    *          EFalse otherwise, priority not set
+    */
+    TBool SetPriority(TInt aPriority);
+    
+    /*
+    * Sets the normalizing gain of this clip
+    *
+    * @param    aFrameHandler    frame handler
+    *
+    * @return ETrue if successful
+    */
+    virtual TBool SetNormalizingGainL(const CProcFrameHandler* aFrameHandler) = 0;
+
+    /**
+    * Gets ReadAudioDecoderSpecificInfo from file (if any)
+    *
+    * @param    aBytes            buffer
+    * @param    aBufferSize        maximum size of buffer
+    *
+    * @return    ETrue if bytes were read (The caller must release aBytes!!)
+    *
+    *            EFalse if no bytes were read (no memory releasing needed)         
+    *
+    */
+
+    virtual TBool ReadAudioDecoderSpecificInfoL(HBufC8*& aBytes, TInt aBufferSize);
+
+
+protected:
+    
+    // constructL
+    void ConstructL(const TDesC& aFileName);
+
+    // c++ constructor
+    CProcInFileHandler();
+    
+    
+    /**
+    * Reads the next raw frame
+    * This function allocates memory and
+    * the caller is responsible for releasing it
+    *
+    * Possible leave codes:
+    *
+    *
+    * @param    aFrame        audio frame
+    * @param    aSize        size of the retrieved audio frame
+    * @param    aTime    duration of the returned frame in milliseconds
+    * @return    ETrue  if a frame was read
+    *            EFalse if frame was not read (EOF)
+    */
+    
+    virtual TBool GetRawSilentAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aDuration);
+
+    virtual TBool GetEncAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime) = 0;
+    
+    virtual TBool GetEncSilentAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aDuration);
+    
+    TBool GetOneRawAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aDuration);
+    
+    
+    /**
+    * Performs all the necessary initializations and memory allocations needed.
+    * Should be always called by classes inherited from <code>CProcInFileHander</code>
+    *
+    * @param    aFileName            name of the file
+    * @param    aCutInTime            cut in time in milliseconds
+    * @param    aReadBufferSize        read buffer size
+    *
+    * @return    ETrue if successful
+    *
+    */
+    TBool InitAndOpenFileL(const TDesC& aFileName, RFile* aFileHandle, TInt aReadBufferSize);
+
+    
+    /**
+    * Performs all the necessary resource releasing and file closing
+    *
+    * should be called if <code>InitAndOpenFileL</code> has been called
+    *
+    * @return    ETrue if successful
+    *
+    */
+    void ResetAndCloseFile();
+    
+    // opens a file for readind
+    TBool OpenFileForReadingL();
+    
+    // closes the file if open
+    TBool CloseFile();
+    
+    
+    // File reading methods------------------>
+    TInt BufferedFileRead(TDes8& aDes,TInt aLength);
+    TInt BufferedFileSetFilePos(TInt aPos);
+    TInt BufferedFileGetFilePos();
+    TInt BufferedFileGetSize();
+    TInt BufferedFileRead(TInt aPos,TDes8& aDes);
+    TInt BufferedFileRead(TDes8& aDes);
+    TInt BufferedFileReadChar(TInt aPos, TUint8& aChar);
+    // <------------------ File reading methods
+    
+    
+    TBool ManipulateGainL(HBufC8*& aFrameIn); 
+    
+    // function for gain manipulation
+    TInt8 GetGainNow();
+    
+    TBool WriteDataToInputBufferL(const TDesC8& aData);
+    
+protected:
+
+    // is inputfile open?
+    TBool iFileOpen;
+    
+    // file name
+    HBufC* iFileName;
+
+    // RFile
+    RFile iFile;
+    
+    // file server session
+    RFs iFs;
+
+    // read buffer
+    HBufC8* iReadBuffer;
+
+    // size of the read buffer
+    TInt iReadBufferSize;
+    
+    // start offset of the read buffer
+    TInt iBufferStartOffset;
+    
+    // end offset of the read buffer
+    TInt iBufferEndOffset;
+    
+    // current file position
+    TInt iFilePos;
+    
+    // cut in time in milliseconds
+    TInt32 iCutInTime;
+    
+    // current read time in milliseconds
+    TInt32 iCurrentTimeMilliseconds;
+
+    // priority of the clip
+    TInt iPriority;
+    
+    // normalizing margin in dB/2
+    TInt8 iNormalizingMargin;
+
+    // audio file properties
+    TAudFileProperties* iProperties;
+    
+    // silent frame    
+    HBufC8* iSilentFrame;
+    
+    // duration of the silent frame
+    TInt32 iSilentFrameDuration;
+    
+    // raw silent frame    
+    HBufC8* iRawSilentFrame;
+    
+    // duration of the raw silent frame
+    TInt iRawSilentFrameDuration;
+   
+    // if true, this object opens and closes the input file    
+    TBool iOwnsFile;
+        
+    TInt iTargetSampleRate; 
+    
+    TChannelMode iChannelMode;
+    
+    CProcFrameHandler* iFrameHandler;
+    
+    CAudClip* iClip;
+    
+    TBool iDecodingRequired;
+    
+    CProcDecoder* iDecoder;
+    
+    TBool iDecodingPossible;
+
+    // We need a temporary storage for extra bytes 
+    // when retrieving raw frames af equal length
+    HBufC8* iInputBuffer;
+
+    TInt iRawFrameLength;
+
+    // wav frame handler for time domain gain manipulation
+    CProcWAVFrameHandler* iWavFrameHandler;
+
+    // remainder if audio duration can't be handled accurately in TInt milliseconds, depends on sampling rate
+    TReal iFrameLenRemainderMilli;
+    
+    // Counter for decoder errors. Try to continue after one error, but if there are more, stop decoding.
+    TInt iDecoderErrors;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcOutFileHandler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCOUTFILEHANDLER_H__
+#define __CPROCOUTFILEHANDLER_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+
+class CProcOutFileHandler : public CBase
+    {
+
+public:
+
+/*
+    static CProcOutFileHandler* NewL(const TDesC& aFileName, 
+                              TInt aWriteBufferSize,
+                              TAudFileProperties aProperties);
+
+    static CProcOutFileHandler* NewLC(const TDesC& aFileName, 
+                              TInt aWriteBufferSize,
+                              TAudFileProperties aProperties);
+*/
+    
+    /**
+    * Sets the output file properties
+    *
+    * @param    aProperties    properties of the output file
+    */
+    TBool SetPropertiesL(TAudFileProperties aProperties);
+
+    void GetPropertiesL(const TAudFileProperties*& aProperties);
+
+    /**
+    * Initializes an output file
+    * (writes file headers etc.)
+    *
+    * @return ETrue if successful
+    *
+    */
+    virtual TBool InitializeFileL();
+    
+    /**
+    * Finalizes an output file
+    * Writes some file specific information if needed and
+    * closes the file
+    *
+    */
+    virtual TBool FinalizeFile();
+
+    /**
+    * Writes a new audio frame to an output file
+    *
+    * @param    aFrame    an audio frame to be written
+    * @param    aSize    the number of bytes written
+    *
+    */
+    virtual TBool WriteAudioFrameL(const HBufC8*& aFrame, TInt& aSize);
+
+    /**
+    * Writes a new audio frame to an output file
+    *
+    * @param    aFrame    an audio frame to be written
+    * @param    aSize    the number of bytes written
+    * @param    aDurationMilliSeconds frame duration in milliseconds
+    *
+    */
+    virtual TBool WriteAudioFrameL(const HBufC8*& aFrame, TInt& aSize, TInt aDurationMilliSeconds);
+    
+    /**
+    * Writes silent frames to current file position
+    * 
+    * @param    aTime    time (in milliseconds) of how much silence is to be written
+    */
+    virtual TBool WriteSilenceL(TInt32 aTime) = 0;
+    virtual ~CProcOutFileHandler();
+
+    
+private:
+    
+protected:
+
+    void ConstructL(const TDesC& aFileName, TInt aWriteBufferSize, TAudFileProperties aProperties);
+    void InitL(const TDesC& aFileName, TInt aWriteBufferSize);
+    TBool OpenFileForWritingL();
+    TBool CloseFile();
+    CProcOutFileHandler();
+
+    TInt BufferedFileWriteL(const TDesC8& aDes,TInt aLength);
+    TInt BufferedFileGetPos();
+    TInt BufferedFileSetPos(TInt aPos);
+    
+    HBufC* iFileName;
+
+    RFile iFile;
+    RFs iFs;
+    TBool iFileOpen;
+
+    HBufC8* iWriteBuffer;
+
+    TInt iWriteBufferSize;
+
+    TAudFileProperties* iProperties;
+
+    HBufC8* iSilentFrame;
+
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcProcessAO.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCPROCESSAO_H__
+#define __CPROCPROCESSAO_H__
+
+#include <e32base.h>
+#include "AudCommon.h"
+#include "AudSong.h"
+
+#include "AudProcessor.h"
+
+#include "AudProcessorImpl.h"
+
+#include "ProcEncoder.h"
+
+class MProcProcessObserver;
+class CAudProcessorImpl;
+class CAudProcessor;
+
+class CProcProcess : public CBase
+    {
+
+public:
+
+    /**
+    *
+    * Constructor & destructor
+    *
+    */
+    static CProcProcess* NewL();
+
+    ~CProcProcess();
+
+    /**
+    * Starts a syncronous song processing operation
+    *
+    * @param    aSong        song
+    * 
+    */
+    TBool StartSyncProcessingL(const CAudSong* aSong, TBool aGetTimeEstimation = EFalse);
+
+    /**
+    * Processes one piece syncronously
+    *
+    * @param    aFrame        audio frame in output
+    * @param    aProgerss    current progress (0-100)
+    * @param    aDuration    duration of aFrame
+    * 
+    */
+    TBool ProcessSyncPieceL(HBufC8*& aFrame, TInt& aProgress,
+                                       TTimeIntervalMicroSeconds& aDuration);
+
+    /**
+    *
+    * Gets time estimate once the time estimate has been calculated
+    *
+    * If time estimation has not been processed, returns 0
+    *
+    * @return processing time estimate in microseconds
+    */
+
+    TInt64 GetFinalTimeEstimate() const;
+    
+    
+protected:
+
+private:
+    
+    // constructL
+    void ConstructL();
+    
+    // C++ constructor
+    CProcProcess();
+    
+private:
+    
+    // observer for callbacks
+    MProcProcessObserver* iObserver;
+    
+    // processorImpl owned by this
+    CAudProcessorImpl* iProcessorImpl;
+    
+    // song
+    const CAudSong* iSong;
+    
+    
+    // encoder
+    CProcEncoder* iEncoder;
+    
+    // buffer for getting data from encoder
+    HBufC8* iDecBuffer;
+    
+    // sometimes the encoder returns more than one AMR frame at a time
+    // still we need to return only one frame to the higher level
+    // this buffer is a temporary storage for extra AMR frames
+    
+    HBufC8* iAMRBuf;
+    
+    // progress
+    TInt iProgress;
+    
+    HBufC8* iAACBuf;
+    
+    // buffer for feeding the encoder
+    CMMFDataBuffer* iEncFeedBuffer;
+    
+    TInt64 iTimeEstimate;
+    
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcTimeEstimateAO.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCTIMEESTIMATEAO_H__
+#define __CPROCTIMEESTIMATEAO_H__
+
+#include <e32base.h>
+#include "AudSong.h"
+#include "AudCommon.h"
+#include "ProcProcessAO.h"
+
+class CProcProcess;
+
+
+class CProcTimeEstimateAO : public CActive 
+    {
+
+public:
+
+    static CProcTimeEstimateAO* NewL();
+
+    virtual ~CProcTimeEstimateAO();
+
+    /**
+    *
+    * Starts retrieving audio clip info
+    *
+    * @param    aFilename        filename of the input file
+    * @param    aObserver        observer to be notified of progress
+    * @param    aProperties        properties of the input file.
+    *                            Needs to be allocated by the caller,                            
+    *                            and will filled in as a result of calling
+    *                            this function
+    * @param    aPriority        priority of the operation
+    *
+    */
+    TBool StartL(const CAudSong* aSong, MAudTimeEstimateObserver& aTEObserver);
+    void CancelTimeEstimate();
+    
+        
+      
+protected:
+    virtual void RunL();
+    virtual void DoCancel();
+
+private:
+
+    void ConstructL();
+
+private:
+    
+    
+    // C++ constructor
+    CProcTimeEstimateAO();
+    
+    
+    // processing AC for getting frames
+    CProcProcess* iProcessingObject;
+    
+    // observer to notify
+    MAudTimeEstimateObserver* iTEObserver;
+    
+    // song
+    const CAudSong* iSong;
+    
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcTools.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,301 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __PROCTOOLS_H__
+#define __PROCTOOLS_H__
+
+#include <e32base.h>
+#include <f32file.h>
+#include "AudCommon.h"
+#include "ProcConstants.h"
+#include "Mp3API.h"
+
+class ProcTools 
+    {
+
+public:
+
+    /**
+    * Decimal number to binary number
+    */
+    static TBool Dec2Bin(TUint8 aDec, TBuf8<8>& aBinary);
+    /**
+    * This version allocates memory (aBin), remember to release
+    */
+    static TBool Dec2BinL(TUint32 aDec, HBufC8*& aBin);
+
+    /**
+    * Binary number to decimal number
+    */
+    static TBool Bin2Dec(const TDesC8& aBin, TUint& aDec);
+    
+    /**
+    * Decimal number in descriptor to unsigned integer
+    */
+    static TBool Des2Dec(TDesC8& aDes, TUint& aDec);
+    
+    /**
+    * Decimal number in descriptor to binary descriptor
+    * allocates memory, the caller must release
+    */
+    static TBool Des2BinL(const TDesC8& aDes, HBufC8*& aBin);
+    
+    /**
+    * Gets milliseconds(TInt) from microseconds (TTimeIntervalMicroSeconds)
+    * @param    aMicroSeconds    microseconds
+    *
+    * @return                     milliseconds
+    */
+    
+    static TInt MilliSeconds(TTimeIntervalMicroSeconds aMicroSeconds);
+    
+    /**
+    * Gets microseconds (TTimeIntervalMicroSeconds) from milliseconds (TInt)
+    * @param    aMilliSeconds    milliseconds
+    *
+    * @return                     microiseconds
+    */
+    
+    static TTimeIntervalMicroSeconds MicroSeconds(TInt aMilliSeconds);
+    
+    /**
+    * casts TInt64 to TInt (overflow possible, the user is resonsible!!)
+    *
+    * @param    aInt64    TInt64
+    *
+    * @return            Tint
+    */
+    
+    static TInt GetTInt(TInt64 aTInt64);
+    
+    
+    /**
+    * Retrieves a decimal number from a frame
+    *
+    * @param aFrame        frame
+    * @param aBitFirst    index of the first bit of the needed balue
+    * @param aLength    number of bits in the needed value
+    *
+    * @return            retrieved integer, if -1 then operation was unsuccessful
+    */
+    static TInt GetValueFromFrame(const HBufC8* aFrame, TInt aBitFirst, TInt aLength);
+    
+    /**
+    * Retrieves a decimal number from a frame, whose bits are shuffled
+    *
+    * @param aFrame            frame
+    * @param aBitRate        bitrate
+    * @param aBitPositions    bit position in a deshuffled frame
+    * @param aLength        number of bits read
+    *
+    * @return                retrieved integer
+    *
+    */
+    static TInt GetValueFromShuffledAWBFrameL(const HBufC8* aFrame, TInt aBitRate, TInt aBitPosition, TInt aLength);
+
+    static TBool SetValueToShuffledAWBFrame(TUint8 aNewValue, HBufC8* aFrame, 
+                                            TInt aBitRate, TInt aBitPosition, TInt aLength);
+
+    /**
+    * Retrieves a decimal number from a frame, whose bits are shuffled
+    *
+    * @param aFrame            frame
+    * @param aBitPositions    shuffling table
+    * @param TInt aSize        length of <code>aBitPositions</code>
+    *
+    * @return                retrieved integer, if -1 then operation was unsuccessful
+    *
+    */
+    static TInt GetValueFromShuffledFrame(const HBufC8* aFrame, const TUint8 aBitPositions[], TInt aSize);
+
+
+    /**
+    * Writes a decimal number to a frame, whose bits are shuffled
+    *
+    * @param aFrame            frame
+    * @param aNewValue        value to be written
+    * @param aBitPositions    bit indexes in order
+    * @param TInt aSize        length of <code>aBitPositions</code>
+    *
+    * @return                ETrue if successful
+    *
+    */
+    static TBool SetValueToShuffledFrame(HBufC8* aFrame, TUint8 aNewValue, const TUint8 aBitPositions[], TInt aSize);
+
+    /**
+    * Appends integers to a file separated by linefeeds
+    * Mostly for debugging purposes
+    *    
+    * @param aArray        array of integers to be written
+    * @param aFilename    file name, created if doesn't exist, append otherwise
+    *
+    * @return            ETrue if successful
+    */
+    static TBool WriteValuesToFileL(const RArray<TInt>& aArray, const TDesC& aFilename);
+
+    /**
+    * Finds a closest match in a gain table
+    * used for scalar quantized gain tables
+    *
+    * @param aNewGain        search key
+    * @param aGainTable        gain table
+    * @param aTableSize        gain table length
+    *
+    * @return                index of the closest match
+    */
+    static TUint8 FindNewIndexSQ(TInt aNewGain, const TInt aGainTable[], TInt aTableSize); 
+    
+    /**
+    * Finds a closest match in a gain table
+    * used for vector quantized gain tables
+    * pitch: Q14. FC gain Q12
+    *
+    * @param aNewGain        search key
+    * @param aGainTable        gain table
+    * @param aTableSize        gain table length
+    *
+    * @return                index of the closest match
+    */
+    static TUint8 FindNewIndexVQ(TInt aNewGain, TInt aOldPitch, const TInt aGainTable[], TInt aTableSize); 
+
+    /**
+    * Finds a closest match in a gain table
+    * used for vector quantized gain tables
+    * pitch: Q14. FC gain Q11!!
+    *
+    * @param aNewGain        search key
+    * @param aGainTable        gain table
+    * @param aTableSize        gain table length
+    *
+    * @return                index of the closest match
+    */
+    static TUint8 FindNewIndexVQ2(TInt aNewGain, TInt aOldPitch, const TInt aGainTable[], TInt aTableSize); 
+
+
+    /**
+    * Finds a closest match in a gain table for 4.75 kBit/s
+    *
+    * @param aNewGain0    new gain of subframe 0 or 2
+    * @param aOldPitch0 new pitch of subframe 0 or 2
+    * @param aNewGain1    new gain of subframe 1 or 3
+    * @param aNewGain1    new pitch of subframe 1 or 3
+    *
+    */
+    static TUint8 FindNewIndex475VQ(TInt aNewGain0, TInt aOldPitch0, TInt aNewGain1, TInt aOldPitch1);
+
+    static TInt FindIndex(TInt aKey, const TInt aBitPositions[], TInt aTableLength);
+
+    static TBool GenerateADTSHeaderL(TBuf8<7>& aHeader, TInt aFrameLength, TAudFileProperties aProperties);
+
+    static TInt GetNextAMRFrameLength(const HBufC8* aFrame, TInt aPosNow);
+
+    };
+
+
+/*
+*
+*    One processing event represents a section in the output clip
+*    It includes the following information:
+*        - when the section starts (iPosition)
+*        - is the new section a result of a new clip (iCutIn == ETrue)
+*            or a result of an ending clip (iCutIn == EFalse)
+*        - what clips are supposed to be mixed from this processing event (iAllIndexes)
+*        - what is the clip starting or ending that is causing this processing event (iChangedIndex)
+*
+*
+*/
+
+class CProcessingEvent : public CBase
+    {
+
+public:
+
+        
+    static CProcessingEvent* NewL();
+    ~CProcessingEvent();
+    /*
+    * Insert a new clip to this processing event
+    */
+    void InsertIndex(TInt aIndex);
+
+    /*
+    * Gets the clip index in CAudSong based on the clip index in processing event
+    */  
+    TInt GetIndex(TInt aProcessingEventIndex);
+    
+    /*
+    * Gets all clip indexes in this processing event
+    */
+    TBool GetAllIndexes(RArray<TInt>& aAllIndexes);
+    
+    /* 
+    * Index count
+    */
+    TInt IndexCount();
+    
+    /*
+    * Find processing event index based on clip index
+    */
+    TInt FindIndex(TInt aClipIndex);
+
+    /*
+    * Remove processing event
+    */
+    void RemoveIndex(TInt aProcessingEventIndex);
+
+public:
+
+    //global position in milliseconds
+    TInt32 iPosition; 
+    //true = cutIn, false = cutOut
+    TBool iCutIn; 
+    
+    // there can be only one different clip in iAllIndexes in consecutive
+    // processing events:
+    // iChangedClipIndex is that index
+    TInt iChangedClipIndex;
+    
+    // compare starting times (used by a common ordering function)
+    static TInt Compare(const CProcessingEvent& c1, const CProcessingEvent& c2);
+        
+private:
+
+    void ConstructL();
+    CProcessingEvent();
+    
+    // indexes of all the clips that should be mixed
+    // after this processing events
+    RArray<TInt> iAllIndexes; // -1 = silence
+    };
+
+
+
+class AudioEngineUtilTools 
+    {
+public:
+
+    /**
+    * Displays messages on a box
+    */
+    static void AudioEngineMessageBox(const TDesC& aMessage);
+
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcVisProcessor.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __CPROCVISPROCESSOR_H__
+#define __CPROCVISPROCESSOR_H__
+
+#include <e32base.h>
+#include <e32math.h>
+#include "AudClipInfo.h"
+#include "AudCommon.h"
+#include "AudSong.h"
+#include "ProcInFileHandler.h"
+
+#include "ProcFrameHandler.h"
+
+#include "ProcTools.h"
+
+class CProcVisProcessor : public CBase
+    {
+    
+public:
+
+    /*
+    * Symbian constructors
+    */
+
+    static CProcVisProcessor* NewL();
+    static CProcVisProcessor* NewLC();
+
+    ~CProcVisProcessor();
+
+    /**
+    * Performs all initializations needed for a clip visualization
+    * 
+    * Can leave with one of the system wide error codes
+    *
+    * Possible panic code
+    * <code>EVisualizationProcessAlreadyRunning</code>
+    *
+    * @param aClip        clip to be visualized
+    * @param aSize        size of the visualization array (time resolution)
+    *
+    * @return void
+    *
+    */
+    void VisualizeClipL(const CAudClipInfo* aClipInfo, TInt aSize);
+    
+    /**
+    * Visualizes one piece of clip
+    *
+    * Possible panic code
+    * <code>EVisualizationProcessNotRunning</code>
+    *
+    * @param aProgress    output parameter to indicate progress in percents
+    * @return            ETrue if visualization completed, EFalse otherwise
+    *
+    */
+    TBool VisualizeClipPieceL(TInt &aProgress);
+
+    /**
+    * Once visualization process has been completed,
+    * visualization array can be retrieved with this function
+    * NOTE: This function allocates memory and the caller
+    * is responsible for releasing it
+    *
+    * @param aVisualization    visualization array
+    * @param aSize            size of the visualization array
+    *
+    */
+    void GetFinalVisualizationL(TInt8*& aVisualization, TInt& aSize);
+
+
+private:
+    
+    // constructL
+    void ConstructL();
+
+    // C++ constructor
+    CProcVisProcessor();
+    
+private:
+
+    // visualization size
+    TInt iVisualizationSize;
+    // array for visualization
+    TInt8* iVisualization;
+    // infilehandler for clip visualized
+    CProcInFileHandler *iInFile;
+
+    // song
+    const CAudSong* iSong;
+
+    // clip that is visualized
+    const CAudClipInfo* iClipInfo;
+
+    // frame handler for getting gain
+    CProcFrameHandler* iFrameHandler;
+    
+    // how many percents have been written to visualization array
+    TInt iVisualizationWritten;
+    
+    // how many percents have been processed
+    TInt iVisualizationProcessed;
+    
+    // the number of frames altogether
+    TInt iFrameAmount;
+    
+    // how many frames have been processed
+    TInt iFramesProcessed;
+    
+    // current frame being processed
+    TInt iVisualizationPos;
+
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/ProcVisualizationAO.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CPROCVISUALIZATIONAO_H__
+#define __CPROCVISUALIZATIONAO_H__
+
+#include <e32base.h>
+#include "AudSong.h"
+#include "AudObservers.h"
+
+#include "AudProcessorImpl.h"
+
+class MProcProcessObserver;
+class CProcVisProcessor;
+
+class CProcVisualizationAO : public CActive 
+    {
+
+public:
+
+    static CProcVisualizationAO* NewL();
+
+    virtual ~CProcVisualizationAO();
+        
+    /**
+    * Starts a clip visualization operation
+    * 
+    * Can leave with one of the system wide error codes
+    *
+    * Possible panic code
+    * <code>EVisualizationProcessAlreadyRunning</code>
+    *
+    * @param aClip        song to be visualized
+    * @param aSize        size of the visualization array (time resolution)
+    * @param aObserver    observer to be notified of progress
+    *
+    * @return void
+    *
+    */
+    void StartClipVisualizationL(const CAudClipInfo* aClipInfo, TInt aSize, MAudVisualizationObserver& aObserver, TInt aPriority);
+    
+    /**
+    * Cancels a visualization operation
+    * 
+    * Possible panic code
+    * <code>EVisualizationProcessNotRunning</code>
+    *
+    */    
+    void CancelVisualization();
+    
+    /**
+    * Enumeration that represents the state of this object
+    */
+    enum TVisualizationState 
+        {
+        EProcGettingClipVisualization = 100,
+        EProcVisualizationIdle
+        };
+
+protected:
+    virtual void RunL();
+    virtual void DoCancel();
+
+private:
+    
+    void ConstructL();
+
+private:
+    
+    CProcVisualizationAO();
+
+    // visualization observer 
+    MAudVisualizationObserver* iObserver;
+    
+    // visualization processor
+    CProcVisProcessor* iProcVisProcessor;
+    // visualization state
+    TVisualizationState iVisualizationState;
+    
+    // clipinfo visualized
+    const CAudClipInfo* iClipInfo;
+    
+    // visualization size
+    TInt iSize;
+    
+    // previous progress value sent to the observer
+    TInt iPreviousProgressValue;
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/RateConverter.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __CRateConverter_H__
+#define __CRateConverter_H__
+
+#include <e32base.h>
+
+#include "resampler_rate_conversion_input_driven_int16.h"
+
+class CRateConverter : public CBase
+    {
+
+public:
+    
+    /*
+    * Symbian constructors
+    *
+    */
+    static CRateConverter* NewL(TInt aFromSampleRate, TInt aToSampleRate, TInt aFromChannels, TInt aToChannels);
+                                        
+    static CRateConverter* NewLC(TInt aFromSampleRate, TInt aToSampleRate, TInt aFromChannels, TInt aToChannels);
+
+    /*
+    * Destructor
+    */
+    ~CRateConverter();
+    
+    /*
+    * Initialize the rate converter
+    *
+    * @param aInputBufferSize Max size of the input buffer in number of samples
+    * @return ETrue if successful
+    *
+    */
+    TBool InitL(TInt aInputBufferSize);
+
+    /*
+    * Does rate and channel conversion for given buffer
+    *
+    * @param aInput Pointer to input buffer (16-bit samples)
+    * @param aOutput Pointer to output buffer (16-bit samples)
+    * @param aInputSampleCount Number of samples in the input buffer
+    * @return Number of samples in the output buffer
+    */
+    TInt ConvertBufferL(TInt16* aInput, TInt16* aOutput, TInt aInputSampleCount);  
+    
+    /*
+    * Returns the size of the output buffer
+    *
+    */
+    TInt GetOutputBufferSize() { return iOuputBlockSize; }
+    
+
+protected:
+    
+    // constructL    
+    void ConstructL();
+    
+    // C++ constructor
+    CRateConverter(TInt aFromSampleRate, TInt aToSampleRate, TInt aFromChannels, TInt aToChannels);
+    
+private:
+    
+    /*
+    * Does internal initialization
+    *
+    */
+    TBool DoInitL(TInt aInputBufferSize);
+    
+    /*
+    * Does the actual conversion
+    *
+    */
+    TInt DoConvertL(TInt16** aInput, TInt aInputSampleCount);
+    
+    /*
+    * Returns pointer to the output buffer
+    *
+    */
+    TInt16** GetOutputBuffer() { return iOutBuffer; }
+          
+private:
+
+    // Another converter incase two phase converting is needed
+    CRateConverter* iChild;
+
+    // The actual converter
+    RESAMPLER_RateConversionInputDrivenInt16* iConverter;
+    
+    // Input data for rate converter
+    TInt16** iInBuffer;
+    
+    // Output data from rate converter
+    TInt16** iOutBuffer;
+    
+    // Temp buffer used by converter
+    TInt8* iScratchBuffer;
+
+    // Size of the input buffer
+    TInt iInputBlockSize;
+    
+    // Size of the output buffer
+    TInt iOuputBlockSize;
+    
+    // Number of channels used in converter
+    TInt iChannels;
+
+    // Samplerate to convert from
+    TInt iFromSampleRate;
+    
+    // Samplerate to convert to
+    TInt iToSampleRate;
+    
+    // Number of channels in input
+    TInt iFromChannels;
+    
+    // Number of channels in output
+    TInt iToChannels;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/aedproctimeestimate.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __AEDPROCTIME_H__
+#define __AEDPROCTIME_H__
+
+
+// complexity constants; to be moved to some header
+const TReal KAEDMutingComplFactor = 0.02;
+const TReal KAEDAMRDecComplFactor = 0.1;
+const TReal KAEDAACDecComplFactor = 0.1;
+const TReal KAEDAACStereoDecAddComplFactor = 0.1;
+const TReal KAEDAMRWBDecComplFactor = 0.1;
+const TReal KAEDMP3DecComplFactor = 0.2;
+const TReal KAEDWavDecComplFactor = 0.02;
+const TReal KAEDAMREncComplFactor = 0.5;
+const TReal KAEDAACEncComplFactor = 0.3;
+const TReal KAEDAACStereoEncAddComplFactor = 0.2;
+const TReal KAEDBitstreamProcComplFactor = 0.05;
+const TReal KAEDPassThroughComplFactor = 0.02;
+
+#endif // __AEDPROCTIME_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/inc/audconstants.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Common internal constants for audio.
+*
+*/
+
+
+
+#ifndef __AUDCONSTANTS_H__
+#define __AUDCONSTANTS_H__
+
+
+
+// CONSTANTS
+
+const TInt KAedSampleRate8kHz = 8000;
+const TInt KAedSampleRate11kHz = 11025;
+const TInt KAedSampleRate16kHz = 16000;
+const TInt KAedSampleRate22kHz = 22050;
+const TInt KAedSampleRate24kHz = 24000;
+const TInt KAedSampleRate32kHz = 32000;
+const TInt KAedSampleRate44kHz = 44100;
+const TInt KAedSampleRate48kHz = 48000;
+
+const TInt KAedBitRateAMR = 12200;
+const TInt KAedBitRateAAC16kHz = 48000;
+const TInt KAedBitRateAAC48kHz = 192000;
+
+const TInt KAedAACMinBitRateMultiplier = 1; // min bitrate is 1 bit per sample
+const TInt KAedAACMaxBitRateMultiplier = 6; // max bitrate is 6 bits per sample
+
+const TInt KAedAMRFrameDuration = 20000;
+
+const TInt KAedSizeAACBuffer = 2048;
+const TInt KAedSizeAACStereoBuffer = 4096;
+const TInt KAedMaxFeedBufferSize = 4096;
+const TInt KAedMaxAACFrameLengthPerChannel = 768;
+const TInt KAedMaxAMRFrameLength = 32;
+const TInt KAedMaxAWBFrameLength = 61;
+const TInt KAedMaxMP3FrameLength = 1440;
+const TInt KAedSizeAMRBuffer = 320;
+const TInt KAedSizeAWBBuffer = 640;
+
+const TInt KAedMinAMRBitRate = 400;      // voice activity detection creates at least 1 byte per frame => 50 bytes/s = 400 bits/s
+const TInt KAedMaxAMRBitRate = 12200;
+const TInt KAedNumSupportedAACSampleRates = 2;
+const TInt KAedSupportedAACSampleRates[KAedNumSupportedAACSampleRates] = {KAedSampleRate16kHz, KAedSampleRate48kHz};
+
+// Max resolution for visualization; this should cover > 30 minute clip if 5 samples per sec are requested 
+const TInt KAedMaxVisualizationResolution = 10000;
+
+// UId of the AAC CMMFCodec encoder
+const TUid KAedAACEncSWCodecUid = {0x1020382F};    //KAdvancedUidCodecPCM16ToAAC
+// UId of the AMR-NB CMMFCodec encoder
+const TUid KAedAMRNBEncSWCodecUid = {0x101FAF68};    //KAdvancedUidCodecPCM16ToAMR
+
+// UId of the AAC CMMFCodec decoder
+const TUid KMmfAACDecSWCodecUid = {0x101FAF81};    //KMmfUidCodecAACToPCM16
+// UId of the AMR-NB CMMFCodec decoder
+const TUid KMmfAMRNBDecSWCodecUid = {0x101FAF67};    //KAdvancedUidCodecAMRToPCM16
+// UId of the eAAC+ CMMFCodec decoder
+const TUid KMmfUidCodecEnhAACPlusToPCM16 = {0x10207AA9};
+// UId of the AMR-WB CMMFCodec decoder
+const TUid KMmfAMRWBDecSWCodecUid = {0x101FAF5E};
+// UId of the MP3 CMMFCodec decoder
+const TUid KMmfAdvancedUidCodecMP3ToPCM16 = {0x101FAF85};
+
+// FourCC for the eAAC+
+const TUint32 KMMFFourCCCodeAACPlus = 0x43414520;		//(' ','E','A','C')
+
+// Used in CProcInFileHandler::GetGainNow() to reduce positive gains
+const TInt KAedPositiveGainDivider = 5;
+
+
+#endif // __AUDCONSTANTS_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_clip.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,149 @@
+#ifndef __RESAMPLER_CLIP_H__
+#define __RESAMPLER_CLIP_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_common_defs.h"
+#include "resampler_data_types.h"
+
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file 
+
+  @ingroup common_dsp
+
+  Helper functions to limit output to different numerical ranges.
+
+  The header file 'resampler_clip.h' contains helper (inline) functions for 
+  limiting the input to a specified numerical range, or more specifically,
+  to a specified number of bits. These functions are especially useful in 
+  fixed point DSP units for limiting the output range.
+*/
+
+/** Clip function for signed 16-bit integer range.
+
+  This function limits its input to the range -32768 <= output <= 32767.
+  The implementation uses the traditional conditionals to check for 
+  overflows..
+*/
+static FORCEINLINE int32 RESAMPLER_Clip16(int32 input)
+{
+    input = input < (-32768) ? (-32768) : input;
+    input = input > 32767 ?  32767 : input;
+    return input;
+}
+
+/** Shift-and-Clip function for signed 16-bit integer range.
+
+  This function limits its input to the range -32768 <= output <= 32767
+  after first shifting the input to the right by the given number of bits.
+*/
+static FORCEINLINE int32 RESAMPLER_RightShiftAndClip16(int32 input, int rightShift)
+{
+    input = input >> rightShift;
+    return RESAMPLER_Clip16(input);
+}
+
+/** Shift-round-and-clip function for signed 16-bit integer range.
+
+  This function limits its input to the range -32768 <= output <= 32767
+  after first shifting the input to the right by the given number of bits
+  with rounding.
+*/
+static FORCEINLINE int32 RESAMPLER_RightShiftRoundAndClip16(int32 input, int rightShift)
+{
+    if (rightShift > 0)
+    {
+        input += (int32)1 << (rightShift - 1);
+    }
+    input = input >> rightShift;
+    return RESAMPLER_Clip16(input);
+}
+
+/** Saturated 16-bit absolute value.
+
+  This function calculates a saturated 16-bit output value from a 16-bit 
+  input RESAMPLER_AbsAndClip16(0x8000) => 0x7FFF.
+*/
+static FORCEINLINE int16 RESAMPLER_AbsSaturate16(int16 input)
+{
+    return (int16)RESAMPLER_Clip16(labs((long)input));
+}
+
+/** Saturated addition of two 16-bit values.
+*/
+static FORCEINLINE int16 RESAMPLER_AddSaturate16(int16 input1, int16 input2)
+{
+    return (int16)RESAMPLER_Clip16((int32)input1 + input2);
+}
+
+
+/** Saturated subtraction of two 16-bit values.
+*/
+static FORCEINLINE int16 RESAMPLER_SubSaturate16(int16 input1, int16 input2)
+{
+    return (int16)RESAMPLER_Clip16((int32)input1 - input2);
+}
+
+/** Saturated addition of two 32-bit values.
+*/
+static FORCEINLINE int32 RESAMPLER_AddSaturate32(int32 input1, int32 input2)
+{
+    /* int40 is the shortest "long long" available on all 
+     * the current platforms 
+     */
+    int40 res = input1;
+    res += input2;
+    if (res > (int40)(2147483647L))
+    {
+        res = (int40)(2147483647L);
+    }
+    if (res < (int40)(-2147483647L - 1))
+    {
+        res = (int40)(-2147483647L - 1);
+    }
+    return (int32)res;
+}
+
+/** Saturated subtraction of two 32-bit values.
+*/
+static FORCEINLINE int32 RESAMPLER_SubSaturate32(int32 input1, int32 input2)
+{
+    int40 res = input1;
+    res -= input2;
+    if (res > (int40)(2147483647L))
+    {
+        res = (int40)(2147483647L);
+    }
+    if (res < (int40)(-2147483647L - 1))
+    {
+        res = (int40)(-2147483647L - 1);
+    }
+    return (int32)res;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __RESAMPLER_CLIP_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_common_defs.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,80 @@
+#ifndef __RESAMPLER_COMMON_DEFS_H__
+#define __RESAMPLER_COMMON_DEFS_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+
+/* Definitions for the FORCEINLINE macro. This is makes some of the 
+ * optimized versions far more easy to read.
+ */
+
+#if (!defined(__WINSCW__))
+#define FORCEINLINE __forceinline
+
+#else
+#define FORCEINLINE inline
+
+#endif // __WINSCW__
+
+/* Definitions for the packed struct.
+ */
+#if (!defined(__WINSCW__))
+#undef  PACKED_RVCT
+#define PACKED_RVCT  __packed
+#undef  PACKED_GCC
+#define PACKED_GCC
+
+#else
+#undef  PACKED_RVCT
+#define PACKED_RVCT
+#undef  PACKED_GCC
+#define PACKED_GCC
+
+#endif // __WINSCW__
+
+/* Definitions for the min and max macros */
+#define EAP_MAX(a, b) (((a)>=(b)) ? (a) : (b))
+#define EAP_MIN(a, b) (((a)<(b)) ? (a) : (b))
+
+#undef FLT_MAX
+#define FLT_MAX  3.40282347e+38F
+
+
+/* Handle stuff. */
+
+/** Declare a handle type corresponding to type @c aType.
+ *
+ *  For example, calling this macro with @c aType being @c X declares
+ *  handle type @c XHandle. */
+/* Defining handle types this way is safer than just typedef'ing void
+ * pointers, because the compiler is then able to catch more kinds of
+ * handle misusage. */
+#define DECLARE_HANDLE_TYPE(aType)                     \
+        struct aType##HandleTag { int m_dummy; };      \
+        typedef struct aType##HandleTag* aType##Handle
+
+/** @return A pointer to the instance of type @c aType, and associated
+ *          with @c aHandle. */
+#define HANDLE_TO_PINST(aType, aHandle) ((aType*)aHandle)
+
+/** @return A handle associated with the pointer to the instance of type
+ *          @c aType. */
+#define PINST_TO_HANDLE(aType, pInstance) ((aType##Handle)pInstance)
+
+#endif  /* __RESAMPLER_COMMON_DEFS_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_data_types.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,110 @@
+#ifndef __RESAMPLER_DATA_TYPES_H__
+#define __RESAMPLER_DATA_TYPES_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include <limits.h>
+#include <stddef.h>
+
+/* Disable some warnings so that code compiles cleanly with highest 
+ * warning levels. These are all related to function inlining.
+ */
+
+
+/* Disable warnings for Windows and WINS compilations */
+#if defined(_MSC_VER)
+/* unreferenced inline function has been removed */
+#pragma warning(disable: 4514) 
+
+/* function not inlined */
+#pragma warning(disable: 4710) 
+
+/* selected for automatic inline expansion */
+#pragma warning(disable: 4711)
+#endif
+
+/** @ingroup types
+
+@file resampler_data_types.h
+
+A header file for sized integer types.
+
+
+*/
+
+typedef signed short int        int16;
+typedef signed long int         int24;
+typedef signed int              int32;
+
+typedef signed long long int    int40;
+typedef signed long long int    int48;
+typedef signed long long int    int64;
+
+typedef unsigned short int      uint16;
+typedef unsigned long int       uint24;
+typedef unsigned int            uint32;
+
+typedef unsigned long long int  uint40;
+typedef unsigned long long int  uint48;
+typedef unsigned long long int  uint64;
+
+#define RESAMPLER_INT16_MAX        ((int16)32767)
+#define RESAMPLER_INT16_MIN ((int16)(-32767 - 1))
+#define RESAMPLER_INT24_MAX             (8388607)
+#define RESAMPLER_INT24_MIN        (-8388607 - 1)
+#define RESAMPLER_INT32_MAX          (2147483647)
+#define RESAMPLER_INT32_MIN     (-2147483647 - 1)
+
+
+typedef enum RESAMPLER_DataType
+{
+    /** Sixteen-bit data type (Q15) */
+    RESAMPLER_DATA_TYPE_INT16 = 0,
+    /** Twenty-four-bit data type (Q19) */
+    RESAMPLER_DATA_TYPE_INT24,
+    /** Thirty-two-bit data type (Q23) */
+    RESAMPLER_DATA_TYPE_INT32,
+    /** Thirty-two-bit data type (Q15) */
+    RESAMPLER_DATA_TYPE_INT32_Q15,
+    /** Floating-point data type */
+    RESAMPLER_DATA_TYPE_FLOAT,
+    /** Number of different data types */
+    RESAMPLER_DATA_TYPE_COUNT
+} RESAMPLER_DataType;
+
+/** @return A string that describes @c aType.
+ *
+ *  @pre @c aType is a valid instance of @c RESAMPLER_DataType. */
+const char*  RESAMPLER_DataType_AsString(RESAMPLER_DataType aType);
+
+/** @return The @c RESAMPLER_TestDataType that corresponds to @c pString.
+ *
+ *  @pre @c pString is equal to "int16", "int24", "int32", "int32Q15", or "float. */
+RESAMPLER_DataType RESAMPLER_DataType_FromString(const char* pString);
+
+/** @return Whether @c aType is a valid instance of
+ *          @c RESAMPLER_DataType. */
+int          RESAMPLER_DataType_IsValid(RESAMPLER_DataType aType);
+
+/** @return The size, in bytes, of an element of type @c aType.
+ *
+ *  @pre @c aType is a valid instance of @c RESAMPLER_DataType. */
+size_t       RESAMPLER_DataType_Size(RESAMPLER_DataType aType);
+
+#endif  /* __RESAMPLER_DATA_TYPES_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_rate_conversion_input_driven_int16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,187 @@
+#ifndef __RESAMPLER_RATE_CONVERSION_INPUT_DRIVEN_INT16_H__
+#define __RESAMPLER_RATE_CONVERSION_INPUT_DRIVEN_INT16_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/** @ingroup rate_conversion
+
+Base class for input-driven sampling rate conversion.
+
+*/
+
+#include "resampler_data_types.h"
+#include "resampler_rate_conversion_quality.h"
+
+class RESAMPLER_RateConversionInputDrivenInt16
+{
+
+public:
+    
+    /** @name Construction & Destruction */
+    
+    //@{
+
+    /** This method checks if the desired conversion is available.
+
+    @param[in] inRate       Input sampling rate
+    @param[in] outRate      Output sampling rate
+    @param[in] channelCount Number of audio channels
+    */
+    static bool RateSupported(float inRate, 
+                              float outRate, 
+                              int channelCount);
+
+    /** This method creates a sampling rate converter for input-driven
+    operation.
+
+    @param[in] inRate       Input sampling rate
+    @param[in] outRate      Output sampling rate
+    @param[in] channelCount Number of audio channels
+    */
+    static RESAMPLER_RateConversionInputDrivenInt16 * New(float inRate, 
+                                                    float outRate, 
+                                                    int channelCount);
+    
+    /** Constructor
+     */
+
+    RESAMPLER_RateConversionInputDrivenInt16() { ; }
+
+    /** Destructor
+     */
+    
+    virtual ~RESAMPLER_RateConversionInputDrivenInt16() { ; }
+    
+    //@}
+    
+    
+    /** @name Object lifetime methods */
+    
+    //@{
+    
+    /** Initializes the converter.
+    
+    This method initializes the sampling rate converter for input-driven
+    operation. Calling this method twice for the same converter instance
+    is considered a programming error, and behaviour in that case is 
+    undefined.
+
+    @return true if successful false otherwise
+    */
+    
+    virtual bool InitInputDriven() = 0;
+    
+    //@}
+
+    /** @name Operation */
+
+    //@{
+
+    /** Set the quality mode for the subsequent operations */
+
+    virtual bool SetQualityInputDriven(int mode);
+
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void EnableChannelInputDriven(int channel);
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelInputDriven(int channel);
+
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the converter needs to be 
+    able to handle in a single call to the processing functions.
+
+    @param[in] maxInputBlockSize  Maximum input blocksize
+    @return memory need in bytes
+    */
+
+    virtual size_t ScratchMemoryNeedInputDriven(int maxInputBlockSize) const = 0;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter. The caller of this
+    function is responsible of allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferInputDriven(char *buffer) = 0;
+
+    /** Get the maximum number of output samples for a given input sample count
+    
+    This method returns the maximum number of output samples the converter
+    can ever produce from a given number of input samples.
+      
+    @param[in] inSamples  Number of input samples
+    @return Maximum number of output samples
+    */
+
+    virtual int MaxOutputSampleCount(int inSamples) const = 0;
+
+    /** Run the sampling rate conversion for a block of samples
+    
+    This method runs the actual sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers. The 
+    output buffers must have space for MaxOutputSampleCount(inSamples) audio 
+    samples.
+      
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  inSamples      The number of input samples to process
+    @return Number of output samples
+    */
+
+    virtual int ProcessFromInput(int16 *outputBuffers[], 
+                                 int16 *inputBuffers[], 
+                                 int inSamples) = 0;
+
+    //@}
+
+};
+
+#endif  // __RESAMPLER_RATE_CONVERSION_INPUT_DRIVEN_INT16_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_rate_conversion_output_driven_int16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,202 @@
+#ifndef __RESAMPLER_RATE_CONVERSION_OUTPUT_DRIVEN_INT16_H__
+#define __RESAMPLER_RATE_CONVERSION_OUTPUT_DRIVEN_INT16_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/** @ingroup rate_conversion
+
+Base class for output-driven sampling rate conversion.
+
+*/
+
+#include "resampler_data_types.h"
+#include "resampler_rate_conversion_quality.h"
+
+
+class RESAMPLER_RateConversionOutputDrivenInt16
+{
+public:
+    
+    /** @name Construction & Destruction */
+    
+    //@{
+
+    /** This method checks if the desired conversion is available.
+
+    @param[in] inRate       Input sampling rate
+    @param[in] outRate      Output sampling rate
+    @param[in] channelCount Number of audio channels
+    */
+    static bool RateSupported(float inRate, 
+                              float outRate, 
+                              int channelCount);
+
+    /** This method creates a sampling rate converter for input-driven
+    operation.
+
+    @param[in] inRate       Input sampling rate
+    @param[in] outRate      Output sampling rate
+    @param[in] channelCount Number of audio channels
+    */
+
+    static RESAMPLER_RateConversionOutputDrivenInt16 * New(float inRate, 
+                                                     float outRate, 
+                                                     int channelCount);
+    
+    /** Constructor
+     */
+    
+    RESAMPLER_RateConversionOutputDrivenInt16() { ; }
+    
+    /** Destructor
+    */
+    
+    virtual ~RESAMPLER_RateConversionOutputDrivenInt16() { ; }
+    
+    //@}
+    
+    /** @name Object lifetime methods */
+    
+    //@{
+    
+    /** Initializes the converter.
+    
+    This method initializes the sampling rate converter for output-driven
+    operation. Calling this method twice for the same converter instance
+    is considered a programming error, and behaviour in that case is 
+    undefined.
+
+    @return true if successful false otherwise
+    */
+    
+    virtual bool InitOutputDriven() = 0;
+    
+    //@}
+
+    /** @name Operation */
+
+    //@{
+
+    /** Set the quality mode for the subsequent operations */
+
+    virtual bool SetQualityOutputDriven(int mode);
+
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void EnableChannelOutputDriven(int channel);
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelOutputDriven(int channel);
+
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the converter needs to be 
+    able to handle in a single call to the processing functions.
+
+    @param[in] maxOutputBlockSize  Maximum output blocksize
+    @return memory need in bytes
+    */
+
+    virtual size_t ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const = 0;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter. The caller of this
+    function is responsible of allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferOutputDriven(char *buffer) = 0;
+
+
+    /** Get the maximum number of input samples needed.
+    
+    This method returns the maximum number of input samples needed 
+    for a given output sample count.
+
+    @param[in] outSamples  Number of output samples
+    @return Maximum number of input samples
+    */
+
+    virtual int MaxInputSampleCount(int outSamples) const = 0;
+    
+    /** Get the amount of samples needed for input.
+      
+    This method returns the amount of samples needed for converter input
+    given the number of output samples. This method must be called before
+    each call to the processing methods. It is a serious error to have
+    \a outSamples greater than the value set with ScratchMemoryNeedOutputDriven().
+ 
+    @param[in] outSamples  Amount of samples the converter produces
+    @return number of input samples needed
+    */
+
+    virtual int InSamplesNeeded(int outSamples) = 0;
+
+    /** Run the sampling rate conversion for a block of samples
+
+    This method does the sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers.
+    The input buffers MUST contain the amount of samples returned by
+    a previous call to InSamplesNeeded. Output buffers must have space
+    for \a outSamples audio samples.
+ 
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  outSamples     The number of samples the converter produces
+    @return Number of output samples
+    */
+
+    virtual int ProcessToOutput(int16 *outputBuffers[], 
+                                int16 *inputBuffers[], 
+                                int outSamples) = 0;
+
+    //@}
+
+};
+
+#endif  // __RESAMPLER_RATE_CONVERSION_OUTPUT_DRIVEN_INT16_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_rate_conversion_quality.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,39 @@
+#ifndef __RESAMPLER_RATE_CONVERSION_QUALITY_H__
+#define __RESAMPLER_RATE_CONVERSION_QUALITY_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/** @file
+
+  @ingroup rate_conversion
+
+  @brief Sample rate conversion quality modes
+  
+ 
+$Date: 2005/01/19 13:16:12 $
+*/
+
+/** Worst quality */
+#define RESAMPLER_RATE_CONVERSION_QUALITY_ECONOMY 1
+/** Normal quality */
+#define RESAMPLER_RATE_CONVERSION_QUALITY_STANDARD 2
+/** Highest quality */
+#define RESAMPLER_RATE_CONVERSION_QUALITY_PREMIUM 3
+
+#endif  // __RESAMPLER_RATE_CONVERSION_QUALITY_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_44_to_48_int16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,327 @@
+#ifndef __RESAMPLER_SINC_CONV_44_TO_48_INT16_H__
+#define __RESAMPLER_SINC_CONV_44_TO_48_INT16_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_rate_conversion_input_driven_int16.h"
+#include "resampler_rate_conversion_output_driven_int16.h"
+
+/** @ingroup rate_conversion
+
+ Class for upsampling 16-bit audio from 44.1 kHz to 48kHz
+
+*/
+
+class RESAMPLER_SincConv44To48Int16 : public RESAMPLER_RateConversionInputDrivenInt16,
+                                public RESAMPLER_RateConversionOutputDrivenInt16
+{
+    friend class RESAMPLER_RateConversionInputDrivenInt16;
+    friend class RESAMPLER_RateConversionOutputDrivenInt16;
+
+public:
+    
+    /** @name Destruction */
+
+     //@{
+
+    /** Destructor
+      */
+
+    virtual ~RESAMPLER_SincConv44To48Int16();
+
+    //@}
+
+    /** @name Query methods */
+
+    //@{
+
+    static bool RateSupported(float inRate, float outRate)
+    { return (160 * inRate == 147 * outRate); }
+
+    //@}
+
+    /** @name Object lifetime methods */
+
+    //@{
+    
+    /** Initializes the converter.
+    
+    This method initializes the sampling rate converter for input-driven
+    operation.
+     
+    @return true if successful false otherwise
+    */
+    
+    virtual bool InitInputDriven();
+
+    /** Initializes the converter.
+    
+      This method initializes the sampling rate converter. The 
+      initialization will be successful only if 3*inRate == outRate.
+      
+      @return true if successful false otherwise
+    */
+
+    virtual bool InitOutputDriven();
+
+    //@}
+
+    /** @name Output-driven operation */
+
+    //@{
+
+    /** Set the quality mode for the subsequent operations */
+
+    virtual bool SetQualityOutputDriven(int mode);
+    
+    /** Set the quality mode for the subsequent operations */
+
+    virtual bool SetQualityInputDriven(int mode);
+    
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void EnableChannelInputDriven(int channel);
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelInputDriven(int channel);
+
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void EnableChannelOutputDriven(int channel);
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelOutputDriven(int channel);
+    
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the input driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxInputBlockSize  Maximum input blocksize
+    @return memory need in bytes
+    */
+    
+    virtual size_t ScratchMemoryNeedInputDriven(int maxInputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when the converter is 
+    used in output driven mode. . The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferInputDriven(char *buffer);
+
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the output driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxOutputBlockSize  Maximum output blocksize
+    @return memory need in bytes
+    */
+
+    virtual size_t ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when then converter is 
+    used in output driven mode. The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferOutputDriven(char *buffer);
+
+    /** Get the maximum number of input samples needed.
+    
+    This method returns the maximum number of input samples needed 
+    for a given output sample count.
+
+    @param[in] outSamples  Number of output samples
+    @return Maximum number of input samples
+    */
+
+    virtual int MaxInputSampleCount(int outSamples) const;
+    
+    /** Get the amount of samples needed for input.
+      
+    This method returns the amount of samples needed for converter input
+    given the number of output samples. This method must be called before
+    each call to the processing methods. It is a serious error to have
+    \a outSamples greater than the value set with ScratchMemoryNeedOutputDriven().
+ 
+    @param[in] outSamples  Amount of samples the converter produces
+    @return number of input samples needed
+    */
+
+    virtual int InSamplesNeeded(int outSamples);
+    
+    /** Get the maximum number of output samples for a given input sample count
+    
+    This method returns the maximum number of output samples the converter
+    can ever produce from a given number of input samples. The method assumes
+    that the converter be used either input-driven or output-driven; the
+    two modes should not be mixed.
+      
+    @param[in] inSamples  Number of input samples
+    @return Maximum number of output samples
+    */
+
+    virtual int MaxOutputSampleCount(int inSamples) const;
+    
+    /** Run the sampling rate conversion for a block of samples
+    
+    This method runs the actual sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers. The 
+    output buffers must have space for MaxOutputSampleCount(inSamples) audio 
+    samples.
+      
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  inSamples      The number of input samples to process
+    @return Number of output samples
+    */
+
+    virtual int ProcessFromInput(int16 *outputBuffers[], 
+                                 int16 *inputBuffers[], 
+                                 int inSamples);
+
+    /** Run the sampling rate conversion for a block of samples
+
+    This method does the sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers.
+    The input buffers MUST contain the amount of samples returned by
+    a previous call to InSamplesNeeded. Output buffers must have space
+    for \a outSamples audio samples.
+ 
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  outSamples     The number of samples the converter produces
+    @return Number of output samples
+    */
+
+    virtual int ProcessToOutput(int16 *outputBuffers[], 
+                                int16 *inputBuffers[], 
+                                int outSamples);
+
+    //@}
+
+private:
+
+     /** Constructor
+      */
+
+    RESAMPLER_SincConv44To48Int16(int channelCount);
+
+    /** Disabled copy contructor 
+    */
+	RESAMPLER_SincConv44To48Int16(const RESAMPLER_SincConv44To48Int16 &);
+    
+    /** Initializes the converter.
+    
+      This method initializes the sampling rate converter. The 
+      initialization will be successful only if 3*inRate == outRate.
+      
+      @return true if successful false otherwise
+    */
+
+    bool Init();
+
+    /** Deallocate all the allocated memory 
+
+    This methods deallocates all memory previously allocated by 
+    InitOutputDriven(). Can be used both for recovering from a memory 
+    allocation error and in destructor.
+    */
+    void DeInit();
+
+    int16       **m_memBuffers;
+    int16        *m_scratchBuffer;
+    int           m_channelCount;
+	int           m_blockSize;
+    bool         *m_channelEnabled;
+
+    int           m_inputSamples;
+
+    int           m_index1;
+    int           m_index2;
+
+    int           m_zeroCrossings;
+    const int16  *m_filterMatrix;
+};
+
+#endif  // __RESAMPLER_SINC_CONV_44_TO_48_INT16_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_44_to_48_tables_economy.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,28 @@
+#ifndef __RESAMPLER_SINC_CONV_44_TO_48_TABLES_ECONOMY_H__
+#define __RESAMPLER_SINC_CONV_44_TO_48_TABLES_ECONOMY_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_data_types.h"
+
+#define RESAMPLER_44_TO_48_ZERO_CROSSINGS_ECONOMY 8
+
+extern const int16 RESAMPLER_44_TO_48_FILTERS_ECONOMY[161 * RESAMPLER_44_TO_48_ZERO_CROSSINGS_ECONOMY];
+
+#endif // __RESAMPLER_SINC_CONV_44_TO_48_TABLES_ECONOMY_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_44_to_48_tables_premium.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,28 @@
+#ifndef __RESAMPLER_SINC_CONV_44_TO_48_TABLES_PREMIUM_H__
+#define __RESAMPLER_SINC_CONV_44_TO_48_TABLES_PREMIUM_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_data_types.h"
+
+#define RESAMPLER_44_TO_48_ZERO_CROSSINGS_PREMIUM 16
+
+extern const int16 RESAMPLER_44_TO_48_FILTERS_PREMIUM[161 * RESAMPLER_44_TO_48_ZERO_CROSSINGS_PREMIUM];
+
+#endif // __RESAMPLER_SINC_CONV_44_TO_48_TABLES_PREMIUM_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_44_to_48_tables_standard.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,28 @@
+#ifndef __RESAMPLER_SINC_CONV_44_TO_48_TABLES_STANDARD_H__
+#define __RESAMPLER_SINC_CONV_44_TO_48_TABLES_STANDARD_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_data_types.h"
+
+#define RESAMPLER_44_TO_48_ZERO_CROSSINGS_STANDARD 12
+
+extern const int16 RESAMPLER_44_TO_48_FILTERS_STANDARD[161 * RESAMPLER_44_TO_48_ZERO_CROSSINGS_STANDARD];
+
+#endif // __RESAMPLER_SINC_CONV_44_TO_48_TABLES_STANDARD_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_filter_int16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,47 @@
+#ifndef __RESAMPLER_SINC_CONV_FILTER_INT16_H__
+#define __RESAMPLER_SINC_CONV_FILTER_INT16_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_common_defs.h"
+#include "resampler_data_types.h"
+
+static FORCEINLINE int32 
+RESAMPLER_SincConvFilterInt16(const int16 *signalBuf, 
+                        const int16 *filterPtr1,
+                        const int16 *filterPtr2,
+                        int length)
+{
+
+    int32 newSample(0);
+    const int16 *bufferPtr1 = signalBuf; 
+    const int16 *bufferPtr2 = signalBuf+1;     
+    // Calculate the filter. 
+    // Keep newSample in s1.30 format to reduce rounding errors
+    for (int l = length; l >0 ; l-=4)
+    {
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
+    }
+    return newSample;
+}
+
+#endif /* __RESAMPLER_SINC_CONV_FILTER_INT16_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_filter_three_to_one_int16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,47 @@
+#ifndef __RESAMPLER_SINC_CONV_FILTER_THREE_TO_ONE_INT16_H__
+#define __RESAMPLER_SINC_CONV_FILTER_THREE_TO_ONE_INT16_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_common_defs.h"
+#include "resampler_data_types.h"
+
+static FORCEINLINE int32 
+RESAMPLER_SincConvFilterThreeToOneInt16(const int16 *signalBuf, 
+                                  const int16 *filterPtr,
+                                  int length)
+{
+    int32 newSample((int32)(*filterPtr++) * signalBuf[0]);
+    
+    const int16 *bufferPtr1 = signalBuf - 1; 
+    const int16 *bufferPtr2 = signalBuf + 1;
+    for (int l = length - 1; l > 0 ; l--)
+    {
+        // Calculate the filter. 
+        // Keep newSample in s1.30 format to reduce rounding errors
+        int16 coeff = *filterPtr++;
+        newSample += (int32)coeff * (*bufferPtr1) + (int32)coeff * (*bufferPtr2);
+        bufferPtr1--;
+        bufferPtr2++;
+	}
+
+    return newSample;
+}
+
+#endif /* __RESAMPLER_SINC_CONV_FILTER_THREE_TO_ONE_INT16_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_filter_two_to_one_int16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,48 @@
+#ifndef __RESAMPLER_SINC_CONV_FILTER_TWO_TO_ONE_INT16_H__
+#define __RESAMPLER_SINC_CONV_FILTER_TWO_TO_ONE_INT16_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_common_defs.h"
+#include "resampler_data_types.h"
+
+static FORCEINLINE int32 
+RESAMPLER_SincConvFilterTwoToOneInt16(const int16 *signalBuf, 
+								const int16 *filterPtr,
+								int length)
+{
+    int32 newSample((int32)signalBuf[0] << 14);
+    
+    const int16 *bufferPtr1 = signalBuf - 1; 
+    const int16 *bufferPtr2 = signalBuf + 1;
+    for (int l = length; l >0 ; l--)
+    {
+        // Calculate the filter. 
+        // Keep newSample in s1.30 format to reduce rounding errors
+        newSample += (int32)(*filterPtr) * (*bufferPtr1) + (int32)(*filterPtr) * (*bufferPtr2);
+		filterPtr++;
+		bufferPtr1 -= 2;
+		bufferPtr2 += 2;
+	}
+
+    return newSample;
+}
+
+
+#endif /* __RESAMPLER_SINC_CONV_FILTER_TWO_TO_ONE_INT16_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_one_to_three_int16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,334 @@
+#ifndef __RESAMPLER_SINC_CONV_ONE_TO_THREE_INT16_H__
+#define __RESAMPLER_SINC_CONV_ONE_TO_THREE_INT16_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_rate_conversion_input_driven_int16.h"
+#include "resampler_rate_conversion_output_driven_int16.h"
+
+
+/** @ingroup rate_conversion
+
+ Class for upsampling 16-bit audio to three times the source frequency 
+
+*/
+
+class RESAMPLER_SincConvOneToThreeInt16 : public RESAMPLER_RateConversionInputDrivenInt16, 
+                                    public RESAMPLER_RateConversionOutputDrivenInt16
+{
+    friend class RESAMPLER_RateConversionInputDrivenInt16;
+    friend class RESAMPLER_RateConversionOutputDrivenInt16;
+
+public:
+    
+    /** @name Destruction */
+
+     //@{
+
+    /** Destructor
+      */
+
+    virtual ~RESAMPLER_SincConvOneToThreeInt16();
+
+    //@}
+
+    /** @name Query methods */
+
+    //@{
+
+    static bool RateSupported(float inRate, float outRate)
+    { return (3*inRate == outRate); }
+
+    //@}
+
+    /** @name Object lifetime methods */
+
+    //@{
+
+    /** Initializes the converter.
+    
+    This method initializes the sampling rate converter for input-driven
+    operation.
+     
+    @return true if successful false otherwise
+    */
+    
+    virtual bool InitInputDriven();
+    
+    /** Initializes the converter.
+    
+    This method initializes the sampling rate converter for output-driven
+    operation.
+      
+    @return true if successful false otherwise
+    */
+    
+    virtual bool InitOutputDriven();
+    
+    //@}
+
+    /** @name Input-driven operation */
+    
+    //@{
+    
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void EnableChannelInputDriven(int channel)
+    { EnableChannel(channel); }
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelInputDriven(int channel)
+    { DisableChannel(channel); }
+
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the output driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxOutputBlockSize  Maximum output blocksize
+    @return memory need in bytes
+    */
+
+    virtual size_t ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when then converter is 
+    used in output driven mode. The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferOutputDriven(char *buffer);
+
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the input driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxInputBlockSize  Maximum input blocksize
+    @return memory need in bytes
+    */
+    
+    virtual size_t ScratchMemoryNeedInputDriven(int maxInputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when the converter is 
+    used in output driven mode. . The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferInputDriven(char *buffer);
+    
+    /** Get the maximum number of output samples for a given input sample count
+    
+    This method returns the maximum number of output samples the converter
+    can ever produce from a given number of input samples. The method assumes
+    that the converter be used either input-driven or output-driven; the
+    two modes should not be mixed.
+      
+    @param[in] inSamples  Number of input samples
+    @return Maximum number of output samples
+    */
+
+    virtual int MaxOutputSampleCount(int inSamples) const;
+    
+    /** Run the sampling rate conversion for a block of samples
+    
+    This method runs the actual sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers. The 
+    output buffers must have space for MaxOutputSampleCount(inSamples) audio 
+    samples.
+      
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  inSamples      The number of input samples to process
+    @return Number of output samples
+    */
+
+    virtual int ProcessFromInput(int16 *outputBuffers[], 
+                                 int16 *inputBuffers[], 
+                                 int inSamples);
+
+    //@}
+    
+    /** @name Output-driven operation */
+    
+    //@{
+    
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void EnableChannelOutputDriven(int channel)
+    { EnableChannel(channel); }
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelOutputDriven(int channel)
+    { DisableChannel(channel); }
+
+    /** Get the maximum number of input samples needed.
+    
+    This method returns the maximum number of input samples needed 
+    for a given output sample count.
+
+    @param[in] outSamples  Number of output samples
+    @return Maximum number of input samples
+    */
+
+    virtual int MaxInputSampleCount(int outSamples) const;
+    
+    /** Get the amount of samples needed for input.
+      
+    This method returns the amount of samples needed for converter input
+    given the number of output samples. This method must be called before
+    each call to the processing methods. It is a serious error to have
+    \a outSamples greater than the value set with ScratchMemoryNeedOutputDriven().
+ 
+    @param[in] outSamples  Amount of samples the converter produces
+    @return number of input samples needed
+    */
+
+    virtual int InSamplesNeeded(int outSamples);
+
+    /** Run the sampling rate conversion for a block of samples
+
+    This method does the sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers.
+    The input buffers MUST contain the amount of samples returned by
+    a previous call to InSamplesNeeded. Output buffers must have space
+    for \a outSamples audio samples.
+ 
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  outSamples     The number of samples the converter produces
+    @return Number of output samples
+    */
+    
+    virtual int ProcessToOutput(int16 *outputBuffers[], 
+                                int16 *inputBuffers[], 
+                                int outSamples);
+
+    //@}
+    
+private:
+
+    /** Constructor
+     */
+    RESAMPLER_SincConvOneToThreeInt16(int channelCount);
+
+    /** Disabled copy contructor 
+     */
+	RESAMPLER_SincConvOneToThreeInt16(const RESAMPLER_SincConvOneToThreeInt16 &);
+
+    /** Initializes the converter.
+    
+      This method initializes the sampling rate converter. The 
+      initialization will be successful only if 3*inRate == outRate.
+      
+      @return true if successful false otherwise
+    */
+
+    bool Init();
+
+    /** Deallocate all the allocated memory 
+
+    This methods deallocates all memory previously allocated by 
+    Init(). Can be used both for recovering from a memory 
+    allocation error and in destructor.
+    */
+    void DeInit();
+
+    /** Enable one of the channels */
+    void EnableChannel(int channel);
+
+    /** Disable one of the channels */
+    void DisableChannel(int channel);
+
+    int16       **m_memBuffers;
+    int16        *m_scratchBuffer;
+
+    const int16  *m_filter1;
+    const int16  *m_filter2;
+    int           m_channelCount;
+	int           m_blockSize;
+    bool         *m_channelEnabled;
+
+    int           m_inputSamples;
+	
+    int           m_state;
+};
+
+#endif  // __RESAMPLER_SINC_CONV_ONE_TO_THREE_INT16_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_one_to_three_tables_standard.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+#ifndef __RESAMPLER_SINC_CONV_ONE_TO_THREE_TABLES_STANDARD_H__
+#define __RESAMPLER_SINC_CONV_ONE_TO_THREE_TABLES_STANDARD_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+
+#include "resampler_data_types.h"
+
+
+#define RESAMPLER_ONE_TO_THREE_ZERO_CROSSINGS_STANDARD 16
+
+extern const int16 RESAMPLER_ONE_TO_THREE_FILTER1_STANDARD[RESAMPLER_ONE_TO_THREE_ZERO_CROSSINGS_STANDARD];
+extern const int16 RESAMPLER_ONE_TO_THREE_FILTER2_STANDARD[RESAMPLER_ONE_TO_THREE_ZERO_CROSSINGS_STANDARD];
+
+#endif // __RESAMPLER_SINC_CONV_ONE_TO_THREE_TABLES_STANDARD_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_one_to_two_int16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,330 @@
+#ifndef __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_H__
+#define __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_rate_conversion_input_driven_int16.h"
+#include "resampler_rate_conversion_output_driven_int16.h"
+
+
+/** @ingroup rate_conversion
+
+  @brief Sampling rate conversion implementation for upsampling by two.
+        
+*/
+
+class RESAMPLER_SincConvOneToTwoInt16 : public RESAMPLER_RateConversionInputDrivenInt16, 
+                                  public RESAMPLER_RateConversionOutputDrivenInt16
+{
+    friend class RESAMPLER_RateConversionInputDrivenInt16;
+    friend class RESAMPLER_RateConversionOutputDrivenInt16;
+
+public:
+    
+    /** @name Construction & Destruction */
+    
+    //@{
+    
+   /** Destructor
+    */
+    
+    virtual ~RESAMPLER_SincConvOneToTwoInt16();
+    
+    //@}
+    
+    /** @name Query methods */
+
+    //@{
+
+    static bool RateSupported(float inRate, float outRate)
+    { return (2*inRate == outRate); }
+
+    //@}
+
+    /** @name Object lifetime methods */
+    
+    //@{
+    
+    /** Initializes the converter.
+    
+    This method initializes the sampling rate converter for input-driven
+    operation.
+      
+    @return true if successful false otherwise
+    */
+    
+    virtual bool InitInputDriven();
+    
+    /** Initializes the converter.
+    
+    This method initializes the sampling rate converter for output-driven
+    operation.
+      
+    @return true if successful false otherwise
+    */
+    
+    virtual bool InitOutputDriven();
+    
+    //@}
+    
+    /** @name Input-driven operation */
+    
+    //@{
+    
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void EnableChannelInputDriven(int channel)
+    { EnableChannel(channel); }
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelInputDriven(int channel)
+    { DisableChannel(channel); }
+
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the input driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxInputBlockSize  Maximum input blocksize
+    @return memory need in bytes
+    */
+    
+    virtual size_t ScratchMemoryNeedInputDriven(int maxInputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when the converter is 
+    used in output driven mode. . The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferInputDriven(char *buffer);
+
+    /** Get the maximum number of input samples needed.
+    
+    This method returns the maximum number of input samples needed 
+    for a given output sample count.
+
+    @param[in] outSamples  Number of output samples
+    @return Maximum number of input samples
+    */
+
+    virtual int MaxInputSampleCount(int outSamples) const;
+    
+    /** Get the amount of samples needed for input.
+      
+    This method returns the amount of samples needed for converter input
+    given the number of output samples. This method must be called before
+    each call to the processing methods. It is a serious error to have
+    \a outSamples greater than the value set with ScratchMemoryNeedOutputDriven().
+ 
+    @param[in] outSamples  Amount of samples the converter produces
+    @return number of input samples needed
+    */
+
+    virtual int InSamplesNeeded(int outSamples);
+
+    /** Run the sampling rate conversion for a block of samples
+    
+    This method runs the actual sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers. The 
+    output buffers must have space for MaxOutputSampleCount(inSamples) audio 
+    samples.
+      
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  inSamples      The number of input samples to process
+    @return Number of output samples
+    */
+
+    virtual int ProcessFromInput(int16 *outputBuffers[], 
+                                 int16 *inputBuffers[], 
+                                 int inSamples);
+
+    //@}
+    
+    /** @name Output-driven operation */
+    
+    //@{
+    
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void EnableChannelOutputDriven(int channel)
+    { EnableChannel(channel); }
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelOutputDriven(int channel)
+    { DisableChannel(channel); }
+
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the output driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxOutputBlockSize  Maximum output blocksize
+    @return memory need in bytes
+    */
+
+    virtual size_t ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when then converter is 
+    used in output driven mode. The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferOutputDriven(char *buffer);
+
+    /** Get the maximum number of output samples for a given input sample count
+    
+    This method returns the maximum number of output samples the converter
+    can ever produce from a given number of input samples. The method assumes
+    that the converter be used either input-driven or output-driven; the
+    two modes should not be mixed.
+      
+    @param[in] inSamples  Number of input samples
+    @return Maximum number of output samples
+    */
+
+    virtual int MaxOutputSampleCount(int inSamples) const;
+
+    /** Run the sampling rate conversion for a block of samples
+
+    This method does the sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers.
+    The input buffers MUST contain the amount of samples returned by
+    a previous call to InSamplesNeeded. Output buffers must have space
+    for \a outSamples audio samples.
+ 
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  outSamples     The number of samples the converter produces
+    @return Number of output samples
+    */
+
+    virtual int ProcessToOutput(int16 *outputBuffers[], 
+                                int16 *inputBuffers[], 
+                                int outSamples);
+
+    //@}
+    
+private:
+    
+    /** Constructor
+     */
+    RESAMPLER_SincConvOneToTwoInt16(int channelCount);
+
+    /** Disabled copy contructor 
+     */
+    RESAMPLER_SincConvOneToTwoInt16(const RESAMPLER_SincConvOneToTwoInt16 &);
+    
+    /** Initializes the converter.
+    
+      This method initializes the sampling rate converter. The 
+      initialization will be successful only if 2*inRate == outRate.
+      
+      @return true if successful false otherwise
+    */
+    
+    bool Init();
+    
+    /** Deallocate all the allocated memory 
+
+    This methods deallocates all memory previously allocated by 
+    Init(). Can be used both for recovering from a memory 
+    allocation error and in destructor.
+    */
+    void DeInit();
+
+    /** Enable one of the channels */
+    void EnableChannel(int channel);
+
+    /** Disable one of the channels */
+    void DisableChannel(int channel);
+
+    int16       **m_memBuffers;
+    int16        *m_scratchBuffer;
+    const int16  *m_filter;
+    int           m_channelCount;
+    int           m_blockSize;
+    bool         *m_channelEnabled;
+    
+    int           m_state;
+};
+
+#endif  // __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_one_to_two_tables_standard.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+#ifndef __RESAMPLER_SINC_CONV_ONE_TO_TWO_TABLES_STANDARD_H__
+#define __RESAMPLER_SINC_CONV_ONE_TO_TWO_TABLES_STANDARD_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+
+#include "resampler_data_types.h"
+
+
+#define RESAMPLER_ONE_TO_TWO_ZERO_CROSSINGS_STANDARD 16
+
+extern const int16 RESAMPLER_ONE_TO_TWO_FILTERS_STANDARD[RESAMPLER_ONE_TO_TWO_ZERO_CROSSINGS_STANDARD];
+
+#endif // __RESAMPLER_SINC_CONV_ONE_TO_TWO_TABLES_STANDARD_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_three_to_one_int16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,332 @@
+#ifndef __RESAMPLER_SINC_CONV_THREE_TO_ONE_INT16_H__
+#define __RESAMPLER_SINC_CONV_THREE_TO_ONE_INT16_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_rate_conversion_input_driven_int16.h"
+#include "resampler_rate_conversion_output_driven_int16.h"
+
+/** @ingroup rate_conversion
+
+ Class for downsampling 16-bit audio in 3 to 1 ratio
+*/
+
+class RESAMPLER_SincConvThreeToOneInt16 : public RESAMPLER_RateConversionInputDrivenInt16,
+								    public RESAMPLER_RateConversionOutputDrivenInt16
+{
+    friend class RESAMPLER_RateConversionOutputDrivenInt16;
+	friend class RESAMPLER_RateConversionInputDrivenInt16;
+
+public:
+    
+    /** @name Destruction */
+
+     //@{
+
+    /** Destructor
+      */
+
+    virtual ~RESAMPLER_SincConvThreeToOneInt16();
+
+    //@}
+
+    /** @name Query methods */
+
+    //@{
+
+    static bool RateSupported(float inRate, float outRate)
+    { return (inRate == 3*outRate ); }
+
+    //@}
+
+    /** @name Object lifetime methods */
+
+    //@{
+
+    /** Initializes the converter.
+    
+	  This method initializes the sampling rate converter for output-driven
+      operation. The initialization will be successful only if 
+	  inRate == 2*outRate.
+      
+      @return true if successful false otherwise
+    */
+
+    virtual bool InitOutputDriven();
+
+    /** Initializes the converter.
+    
+    This method initializes the sampling rate converter for input-driven
+    operation.
+      
+    @return true if successful false otherwise
+    */
+    
+    virtual bool InitInputDriven();
+
+    //@}
+
+    /** @name Input-driven operation */
+
+    //@{
+
+	/** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelInputDriven(int channel)
+    { DisableChannel(channel); }
+
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+	virtual void EnableChannelInputDriven(int channel)
+    { EnableChannel(channel); }
+
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the input driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxInputBlockSize  Maximum input blocksize
+    @return memory need in bytes
+    */
+
+    virtual size_t ScratchMemoryNeedInputDriven(int maxInputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when then converter is 
+    used in input driven mode. The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferInputDriven(char *buffer);
+
+    /** Get the maximum number of input samples needed.
+    
+    This method returns the maximum number of input samples needed 
+    for a given output sample count.
+
+    @param[in] outSamples  Number of output samples
+    @return Maximum number of input samples
+    */
+
+    virtual int MaxInputSampleCount(int outSamples) const;
+    
+    /** Get the amount of samples needed for input.
+      
+    This method returns the amount of samples needed for converter input
+    given the number of output samples. This method must be called before
+    each call to the processing methods. It is a serious error to have
+    \a outSamples greater than the value set with ScratchMemoryNeedOutputDriven().
+ 
+    @param[in] outSamples  Amount of samples the converter produces
+    @return number of input samples needed
+    */
+
+    virtual int InSamplesNeeded(int outSamples);
+
+    /** Run the sampling rate conversion for a block of samples
+    
+    This method runs the actual sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers. The 
+    output buffers must have space for MaxOutputSampleCount(inSamples) audio 
+    samples.
+      
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  inSamples      The number of input samples to process
+    @return Number of output samples
+    */
+
+    virtual int ProcessFromInput(int16 *outputBuffers[], 
+                                 int16 *inputBuffers[], 
+                                 int inSamples);
+
+    //@}
+    
+    /** @name Output-driven operation */
+    
+    //@{
+
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+	virtual void EnableChannelOutputDriven(int channel)
+    { EnableChannel(channel); }
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelOutputDriven(int channel)
+    { DisableChannel(channel); }	
+
+	/** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the output driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxOutputBlockSize  Maximum output blocksize
+    @return memory need in bytes
+    */
+
+    virtual size_t ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when then converter is 
+    used in output driven mode. The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferOutputDriven(char *buffer);
+
+    /** Get the maximum number of output samples for a given input sample count
+    
+    This method returns the maximum number of output samples the converter
+    can ever produce from a given number of input samples. The method assumes
+    that the converter be used either input-driven or output-driven; the
+    two modes should not be mixed.
+      
+    @param[in] inSamples  Number of input samples
+    @return Maximum number of output samples
+    */
+
+    virtual int MaxOutputSampleCount(int inSamples) const;
+
+    /** Run the sampling rate conversion for a block of samples
+
+    This method does the sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers.
+    The input buffers MUST contain the amount of samples returned by
+    a previous call to InSamplesNeeded. Output buffers must have space
+    for \a outSamples audio samples.
+ 
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  outSamples     The number of samples the converter produces
+    @return Number of output samples
+    */
+
+    virtual int ProcessToOutput(int16 *outputBuffers[], 
+                                int16 *inputBuffers[], 
+                                int outSamples);
+
+    //@}
+
+private:
+
+     /** Constructor
+      */
+
+    RESAMPLER_SincConvThreeToOneInt16(int channelCount);
+
+    /** Disabled copy contructor 
+    */
+	RESAMPLER_SincConvThreeToOneInt16(const RESAMPLER_SincConvThreeToOneInt16 &);
+
+    /** Initializes the converter.
+    
+      This method initializes the sampling rate converter. The 
+      initialization will be successful only if 2*inRate == outRate.
+      
+      @return true if successful false otherwise
+    */
+    
+    bool Init();
+
+	/** Deallocate all the allocated memory 
+
+    This methods deallocates all memory previously allocated by 
+    InitOutputDriven(). Can be used both for recovering from a memory 
+    allocation error and in destructor.
+    */
+    void DeInit();
+
+    /** Enable one of the channels */
+    void EnableChannel(int channel);
+
+    /** Disable one of the channels */
+    void DisableChannel(int channel);
+
+    int16       **m_memBuffers;
+    int16        *m_scratchBuffer;
+    int           m_channelCount;
+	int           m_blockSize;
+    bool         *m_channelEnabled;
+
+    int           m_state;
+
+    int           m_coeffCount;
+    const int16  *m_filterMatrix;
+};
+
+#endif  // __RESAMPLER_SINC_CONV_THREE_TO_ONE_INT16_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_three_to_one_tables_standard.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+#ifndef __RESAMPLER_SINC_CONV_THREE_TO_ONE_TABLES_STANDARD_H__
+#define __RESAMPLER_SINC_CONV_THREE_TO_ONE_TABLES_STANDARD_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_data_types.h"
+
+#define RESAMPLER_THREE_TO_ONE_COEFF_COUNT_STANDARD   57
+
+extern const int16 RESAMPLER_THREE_TO_ONE_FILTERS_STANDARD[ RESAMPLER_THREE_TO_ONE_COEFF_COUNT_STANDARD ];
+
+
+#endif // __RESAMPLER_SINC_CONV_THREE_TO_ONE_TABLES_STANDARD_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_two_to_one_int16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,334 @@
+#ifndef __RESAMPLER_SINC_CONV_TWO_TO_ONE_INT16_H__
+#define __RESAMPLER_SINC_CONV_TWO_TO_ONE_INT16_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_rate_conversion_input_driven_int16.h"
+#include "resampler_rate_conversion_output_driven_int16.h"
+
+/** @ingroup rate_conversion
+
+ Class for downsampling 16-bit audio in 2 to 1 ratio
+
+ Copyright (c) 2001-2006, Nokia
+*/
+
+class RESAMPLER_SincConvTwoToOneInt16 : public RESAMPLER_RateConversionInputDrivenInt16,
+								  public RESAMPLER_RateConversionOutputDrivenInt16
+{
+    friend class RESAMPLER_RateConversionOutputDrivenInt16;
+	friend class RESAMPLER_RateConversionInputDrivenInt16;
+
+public:
+    
+    /** @name Destruction */
+
+     //@{
+
+    /** Destructor
+      */
+
+    virtual ~RESAMPLER_SincConvTwoToOneInt16();
+
+    //@}
+
+    /** @name Query methods */
+
+    //@{
+
+    static bool RateSupported(float inRate, float outRate)
+    { return (inRate == 2*outRate ); }
+
+    //@}
+
+    /** @name Object lifetime methods */
+
+    //@{
+
+    /** Initializes the converter.
+    
+	  This method initializes the sampling rate converter for output-driven
+      operation. The initialization will be successful only if 
+	  inRate == 2*outRate.
+      
+      @return true if successful false otherwise
+    */
+
+    virtual bool InitOutputDriven();
+
+    /** Initializes the converter.
+    
+    This method initializes the sampling rate converter for input-driven
+    operation.
+      
+    @return true if successful false otherwise
+    */
+    
+    virtual bool InitInputDriven();
+
+    //@}
+
+    /** @name Input-driven operation */
+
+    //@{
+
+	/** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelInputDriven(int channel)
+    { DisableChannel(channel); }
+
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+	virtual void EnableChannelInputDriven(int channel)
+    { EnableChannel(channel); }
+
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the input driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxInputBlockSize  Maximum input blocksize
+    @return memory need in bytes
+    */
+
+    virtual size_t ScratchMemoryNeedInputDriven(int maxInputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when then converter is 
+    used in input driven mode. The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferInputDriven(char *buffer);
+
+    /** Get the maximum number of input samples needed.
+    
+    This method returns the maximum number of input samples needed 
+    for a given output sample count.
+
+    @param[in] outSamples  Number of output samples
+    @return Maximum number of input samples
+    */
+
+    virtual int MaxInputSampleCount(int outSamples) const;
+    
+    /** Get the amount of samples needed for input.
+      
+    This method returns the amount of samples needed for converter input
+    given the number of output samples. This method must be called before
+    each call to the processing methods. It is a serious error to have
+    \a outSamples greater than the value set with ScratchMemoryNeedOutputDriven().
+ 
+    @param[in] outSamples  Amount of samples the converter produces
+    @return number of input samples needed
+    */
+
+    virtual int InSamplesNeeded(int outSamples);
+
+    /** Run the sampling rate conversion for a block of samples
+    
+    This method runs the actual sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers. The 
+    output buffers must have space for MaxOutputSampleCount(inSamples) audio 
+    samples.
+      
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  inSamples      The number of input samples to process
+    @return Number of output samples
+    */
+
+    virtual int ProcessFromInput(int16 *outputBuffers[], 
+                                 int16 *inputBuffers[], 
+                                 int inSamples);
+
+    //@}
+    
+    /** @name Output-driven operation */
+    
+    //@{
+
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+	virtual void EnableChannelOutputDriven(int channel)
+    { EnableChannel(channel); }
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelOutputDriven(int channel)
+    { DisableChannel(channel); }	
+
+	/** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the output driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxOutputBlockSize  Maximum output blocksize
+    @return memory need in bytes
+    */
+
+    virtual size_t ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when then converter is 
+    used in output driven mode. The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferOutputDriven(char *buffer);
+
+    /** Get the maximum number of output samples for a given input sample count
+    
+    This method returns the maximum number of output samples the converter
+    can ever produce from a given number of input samples. The method assumes
+    that the converter be used either input-driven or output-driven; the
+    two modes should not be mixed.
+      
+    @param[in] inSamples  Number of input samples
+    @return Maximum number of output samples
+    */
+
+    virtual int MaxOutputSampleCount(int inSamples) const;
+
+    /** Run the sampling rate conversion for a block of samples
+
+    This method does the sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers.
+    The input buffers MUST contain the amount of samples returned by
+    a previous call to InSamplesNeeded. Output buffers must have space
+    for \a outSamples audio samples.
+ 
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  outSamples     The number of samples the converter produces
+    @return Number of output samples
+    */
+
+    virtual int ProcessToOutput(int16 *outputBuffers[], 
+                                int16 *inputBuffers[], 
+                                int outSamples);
+
+    //@}
+
+private:
+
+     /** Constructor
+      */
+
+    RESAMPLER_SincConvTwoToOneInt16(int channelCount);
+
+    /** Disabled copy contructor 
+    */
+	RESAMPLER_SincConvTwoToOneInt16(const RESAMPLER_SincConvTwoToOneInt16 &);
+
+    /** Initializes the converter.
+    
+      This method initializes the sampling rate converter. The 
+      initialization will be successful only if 2*inRate == outRate.
+      
+      @return true if successful false otherwise
+    */
+    
+    bool Init();
+
+	/** Deallocate all the allocated memory 
+
+    This methods deallocates all memory previously allocated by 
+    InitOutputDriven(). Can be used both for recovering from a memory 
+    allocation error and in destructor.
+    */
+    void DeInit();
+
+    /** Enable one of the channels */
+    void EnableChannel(int channel);
+
+    /** Disable one of the channels */
+    void DisableChannel(int channel);
+
+    int16       **m_memBuffers;
+    int16        *m_scratchBuffer;
+    int           m_channelCount;
+	int           m_blockSize;
+    bool         *m_channelEnabled;
+
+    int           m_state;
+
+    int           m_zeroCrossings;
+    const int16  *m_filterMatrix;
+};
+
+#endif  // __RESAMPLER_SINC_CONV_TWO_TO_ONE_INT16_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_two_to_one_tables_standard.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,28 @@
+#ifndef __RESAMPLER_SINC_CONV_TWO_TO_ONE_TABLES_STANDARD_H__
+#define __RESAMPLER_SINC_CONV_TWO_TO_ONE_TABLES_STANDARD_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_data_types.h"
+
+#define RESAMPLER_TWO_TO_ONE_ZERO_CROSSINGS_STANDARD 16
+
+extern const int16 RESAMPLER_TWO_TO_ONE_FILTERS_STANDARD[RESAMPLER_TWO_TO_ONE_ZERO_CROSSINGS_STANDARD];
+
+#endif // __RESAMPLER_SINC_CONV_TWO_TO_ONE_TABLES_STANDARD_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_two_to_three_int16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,340 @@
+#ifndef __RESAMPLER_SINC_CONV_TWO_TO_THREE_INT16_H__
+#define __RESAMPLER_SINC_CONV_TWO_TO_THREE_INT16_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_rate_conversion_input_driven_int16.h"
+#include "resampler_rate_conversion_output_driven_int16.h"
+
+/* Define this 1 to use  code */
+
+
+
+
+/** @ingroup rate_conversion
+
+ Converter class for upsampling 16-bit audio to 3/2 
+ times the source frequency 
+ 
+
+*/
+
+class RESAMPLER_SincConvTwoToThreeInt16 : public RESAMPLER_RateConversionInputDrivenInt16, 
+                                    public RESAMPLER_RateConversionOutputDrivenInt16
+{
+    friend class RESAMPLER_RateConversionInputDrivenInt16;
+    friend class RESAMPLER_RateConversionOutputDrivenInt16;
+
+public:
+    
+    /** @name Destruction */
+
+     //@{
+
+    /** Destructor
+      */
+
+    virtual ~RESAMPLER_SincConvTwoToThreeInt16();
+
+    //@}
+
+    /** @name Query methods */
+
+    //@{
+
+    static bool RateSupported(float inRate, float outRate)
+    { return (3*inRate == 2*outRate); }
+
+    //@}
+
+    /** @name Object lifetime methods */
+
+     //@{
+
+    /** Initializes the converter.
+    
+    This method initializes the sampling rate converter for input-driven
+    operation.
+      
+    @return true if successful false otherwise
+    */
+    
+    virtual bool InitInputDriven();
+    
+    /** Initializes the converter.
+    
+    This method initializes the sampling rate converter for output-driven
+    operation.
+      
+    @return true if successful false otherwise
+    */
+    
+    virtual bool InitOutputDriven();
+    
+    //@}
+
+    /** @name Input-driven operation */
+    
+    //@{
+    
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void EnableChannelInputDriven(int channel)
+    { EnableChannel(channel); }
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelInputDriven(int channel)
+    { DisableChannel(channel); }
+  
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the input driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxInputBlockSize  Maximum input blocksize
+    @return memory need in bytes
+    */
+    
+    virtual size_t ScratchMemoryNeedInputDriven(int maxInputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when the converter is 
+    used in output driven mode. . The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferInputDriven(char *buffer);
+    
+    /** Get the maximum number of output samples for a given input sample count
+    
+    This method returns the maximum number of output samples the converter
+    can ever produce from a given number of input samples. The method assumes
+    that the converter be used either input-driven or output-driven; the
+    two modes should not be mixed.
+      
+    @param[in] inSamples  Number of input samples
+    @return Maximum number of output samples
+    */
+
+    virtual int MaxOutputSampleCount(int inSamples) const;
+    
+    /** Run the sampling rate conversion for a block of samples
+    
+    This method runs the actual sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers. The 
+    output buffers must have space for MaxOutputSampleCount(inSamples) audio 
+    samples.
+      
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  inSamples      The number of input samples to process
+    @return Number of output samples
+    */
+
+    virtual int ProcessFromInput(int16 *outputBuffers[], 
+                                 int16 *inputBuffers[], 
+                                 int inSamples);
+
+    //@}
+    
+    /** @name Output-driven operation */
+    
+    //@{
+    
+    /** Enable one of the channels.
+    
+    This method is used to (re-)enable a rate conversion channel after it's
+    been disabled. (All channels start in the enabled mode.) This is used to
+    tell the algorithm that the channel must be properly processed, if the
+    algorithm wants to take advantage of the optimization possibilities 
+    provided by the DisableInputDriven() method.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void EnableChannelOutputDriven(int channel)
+    { EnableChannel(channel); }
+
+    /** Disable one of the channels.
+    
+    This method can be used to tell the algorithm that the output from a
+    specific channel will not be used in subsequent operations, and the 
+    implementation may choose to optimize and leave the disabled channel
+    unprocessed. However, the caller must always provide valid pointers for
+    the actual processing methods for the case where it's difficult to 
+    actually disable memory access for the specific channel in an 
+    implementation.
+
+    @note The channel index MUST be valid, i.e., it has to be smaller than
+          @c numChannels given at initialization time.
+
+    @param[in] channel  The index of the channel to be enabled.
+    */
+
+    virtual void DisableChannelOutputDriven(int channel)
+    { DisableChannel(channel); }
+
+    /** Get the maximum number of input samples needed.
+    
+    This method returns the maximum number of input samples needed 
+    for a given output sample count.
+
+    @param[in] outSamples  Number of output samples
+    @return Maximum number of input samples
+    */
+
+    virtual int MaxInputSampleCount(int outSamples) const;
+    
+    /** Get the amount of samples needed for input.
+      
+    This method returns the amount of samples needed for converter input
+    given the number of output samples. This method must be called before
+    each call to the processing methods. It is a serious error to have
+    \a outSamples greater than the value set with ScratchMemoryNeedOutputDriven().
+ 
+    @param[in] outSamples  Amount of samples the converter produces
+    @return number of input samples needed
+    */
+
+    virtual int InSamplesNeeded(int outSamples);
+    /** Query the scratch memory need of the converter.
+    
+    This method queries the amount of scratch memory the output driven converter
+    needs to be able to handle in a single call to the processing functions.
+
+    @param[in] maxOutputBlockSize  Maximum output blocksize
+    @return memory need in bytes
+    */
+
+    virtual size_t ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const;
+
+    /** Set scratch buffer for the converter
+
+    This method sets scratch buffer needed by the converter when then converter is 
+    used in output driven mode. The caller of this function is responsible of 
+    allocating enough memory.
+
+    @param[in] *buffer pointer to the allocated buffer
+    */
+
+    virtual void SetScratchBufferOutputDriven(char *buffer);
+
+
+    /** Run the sampling rate conversion for a block of samples
+
+    This method does the sampling rate conversion. The pointer arrays
+    have to contain valid pointers for numChannels channel data buffers.
+    The input buffers MUST contain the amount of samples returned by
+    a previous call to InSamplesNeeded. Output buffers must have space
+    for \a outSamples audio samples.
+ 
+    @param[out] outputBuffers  Pointer to output buffer array
+    @param[in]  inputBuffers   Pointer to input buffer array
+    @param[in]  outSamples     The number of samples the converter produces
+    @return Number of output samples
+    */
+
+    virtual int ProcessToOutput(int16 *outputBuffers[], 
+                                int16 *inputBuffers[], 
+                                int outSamples);
+
+    //@}
+    
+private:
+
+    /** Constructor
+     */
+    RESAMPLER_SincConvTwoToThreeInt16(int channelCount);
+
+    /** Disabled copy contructor 
+     */
+    RESAMPLER_SincConvTwoToThreeInt16(const RESAMPLER_SincConvTwoToThreeInt16 &);
+
+     /** Initializes converter.
+      
+     This method initializes the sampling rate converter.
+     
+     @return true if success false otherwise
+      */
+
+    virtual bool Init();
+
+    /** Deallocate all the allocated memory 
+
+    This methods deallocates all memory previously allocated by 
+    Init(). Can be used both for recovering from a memory 
+    allocation error and in destructor.
+    */
+    void DeInit();
+
+    /** Enable one of the channels */
+    void EnableChannel(int channel);
+
+    /** Disable one of the channels */
+    void DisableChannel(int channel);
+
+    int16       **m_memBuffers;
+    int16        *m_scratchBuffer;
+
+    const int16  *m_filter1;
+    const int16  *m_filter2;
+    int           m_channelCount;
+	int           m_blockSize;
+    bool         *m_channelEnabled;
+
+    int           m_inputSamples;
+	
+    int           m_state;
+};
+
+
+#endif  // __RESAMPLER_SINC_CONV_TWO_TO_THREE_INT16_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/inc/resampler_sinc_conv_two_to_three_tables_standard.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+#ifndef __RESAMPLER_SINC_CONV_TWO_TO_THREE_TABLES_STANDARD_H__
+#define __RESAMPLER_SINC_CONV_TWO_TO_THREE_TABLES_STANDARD_H__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+
+#include "resampler_data_types.h"
+
+
+#define RESAMPLER_TWO_TO_THREE_ZERO_CROSSINGS_STANDARD 16
+
+extern const int16 RESAMPLER_TWO_TO_THREE_FILTER1_STANDARD[RESAMPLER_TWO_TO_THREE_ZERO_CROSSINGS_STANDARD];
+extern const int16 RESAMPLER_TWO_TO_THREE_FILTER2_STANDARD[RESAMPLER_TWO_TO_THREE_ZERO_CROSSINGS_STANDARD];
+
+#endif // __RESAMPLER_SINC_CONV_TWO_TO_THREE_TABLES_STANDARD_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_rate_conversion_input_driven_int16.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_rate_conversion_input_driven_int16.h"
+#include "resampler_sinc_conv_one_to_two_int16.h"
+#include "resampler_sinc_conv_one_to_three_int16.h"
+#include "resampler_sinc_conv_two_to_three_int16.h"
+#include "resampler_sinc_conv_two_to_one_int16.h"
+#include "resampler_sinc_conv_three_to_one_int16.h"
+#include "resampler_sinc_conv_44_to_48_int16.h"
+
+bool 
+RESAMPLER_RateConversionInputDrivenInt16::RateSupported(float inRate, 
+                                                  float outRate, 
+                                                  int channelCount)
+{
+    /* Note that this is a dummy test just to get rid of some warnings. */
+    if (inRate == 0 || outRate == 0 || channelCount == 0)
+    {
+        return false;
+    }
+
+    if (RESAMPLER_SincConvOneToTwoInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvOneToThreeInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvTwoToThreeInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvTwoToOneInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvThreeToOneInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConv44To48Int16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    return false;
+}
+
+
+RESAMPLER_RateConversionInputDrivenInt16 *
+RESAMPLER_RateConversionInputDrivenInt16::New(float inRate, 
+                                        float outRate, 
+                                        int channelCount)
+{
+    RESAMPLER_RateConversionInputDrivenInt16 *converter = 0;
+
+    /* Note that this is a dummy test just to make configuration easier. */
+    if (inRate == 0 || outRate == 0 || channelCount == 0)
+    {
+        converter = 0;
+    }
+
+    else if (2*inRate == outRate)
+    {
+        converter = new RESAMPLER_SincConvOneToTwoInt16(channelCount);
+    }
+
+    else if (3*inRate == outRate)
+    {
+        converter = new RESAMPLER_SincConvOneToThreeInt16(channelCount);
+    }
+
+    else if (3*inRate == 2*outRate)
+    {
+        converter = new RESAMPLER_SincConvTwoToThreeInt16(channelCount);
+    }
+
+    else if (inRate == 2 * outRate)
+    {
+        converter = new RESAMPLER_SincConvTwoToOneInt16(channelCount);
+    }
+
+    else if (inRate == 3 * outRate)
+    {
+        converter = new RESAMPLER_SincConvThreeToOneInt16(channelCount);
+    }
+    
+    else if (160 * inRate == 147 * outRate)
+    {
+        converter = new RESAMPLER_SincConv44To48Int16(channelCount);
+    }
+
+    return converter;
+}
+
+bool RESAMPLER_RateConversionInputDrivenInt16::SetQualityInputDriven(int /* mode */)
+{
+    return true;
+}
+
+void RESAMPLER_RateConversionInputDrivenInt16::EnableChannelInputDriven(int /* channel */)
+{
+}
+
+void RESAMPLER_RateConversionInputDrivenInt16::DisableChannelInputDriven(int /* channel */)
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_rate_conversion_output_driven_int16.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_rate_conversion_output_driven_int16.h"
+#include "resampler_sinc_conv_one_to_two_int16.h"
+#include "resampler_sinc_conv_one_to_three_int16.h"
+#include "resampler_sinc_conv_two_to_three_int16.h"
+#include "resampler_sinc_conv_44_to_48_int16.h"
+#include "resampler_sinc_conv_two_to_one_int16.h"
+#include "resampler_sinc_conv_three_to_one_int16.h"
+
+bool 
+RESAMPLER_RateConversionOutputDrivenInt16::RateSupported(float inRate, 
+                                                   float outRate, 
+                                                   int channelCount)
+{
+    /* Note that this is a dummy test just to get rid of some warnings. */
+    if (inRate == 0 || outRate == 0 || channelCount == 0)
+    {
+        return false;
+    }
+
+    if (RESAMPLER_SincConvOneToTwoInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvOneToThreeInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvTwoToThreeInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConv44To48Int16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvTwoToOneInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvThreeToOneInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    return false;
+}
+
+
+RESAMPLER_RateConversionOutputDrivenInt16 *
+RESAMPLER_RateConversionOutputDrivenInt16::New(float inRate, 
+                                         float outRate, 
+                                         int channelCount)
+{
+    RESAMPLER_RateConversionOutputDrivenInt16 *converter = 0;
+    
+    /* Note that this is a dummy test just to make configuration easier. */
+    if (inRate == 0 || outRate == 0 || channelCount == 0)
+    {
+        converter = 0;
+    }
+
+    else if (2*inRate == outRate)
+    {
+        converter = new RESAMPLER_SincConvOneToTwoInt16(channelCount);
+    }
+
+    else if (3*inRate == outRate)
+    {
+        converter = new RESAMPLER_SincConvOneToThreeInt16(channelCount);
+    }
+
+    else if (3*inRate == 2*outRate)
+    {
+        converter = new RESAMPLER_SincConvTwoToThreeInt16(channelCount);
+    }
+
+	else if (160 * inRate == 147 * outRate)
+    {
+        converter = new RESAMPLER_SincConv44To48Int16(channelCount);
+    }
+
+    else if (inRate == 2 * outRate)
+    {
+        converter = new RESAMPLER_SincConvTwoToOneInt16(channelCount);
+    }
+
+    else if (inRate == 3 * outRate)
+    {
+        converter = new RESAMPLER_SincConvThreeToOneInt16(channelCount);
+    }
+
+	return converter;
+}
+
+bool RESAMPLER_RateConversionOutputDrivenInt16::SetQualityOutputDriven(int /* mode */)
+{
+    return true;
+}
+
+void RESAMPLER_RateConversionOutputDrivenInt16::EnableChannelOutputDriven(int /* channel */)
+{
+}
+
+void RESAMPLER_RateConversionOutputDrivenInt16::DisableChannelOutputDriven(int /* channel */)
+{
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_44_to_48_int16.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,352 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_44_to_48_int16.h"
+#include "resampler_clip.h"
+#include "resampler_sinc_conv_44_to_48_tables_economy.h"
+#include "resampler_sinc_conv_44_to_48_tables_standard.h"
+#include "resampler_sinc_conv_44_to_48_tables_premium.h"
+
+#include <string.h>
+
+#include "resampler_sinc_conv_filter_int16.h"
+
+/*
+ * The amount of zero crossings in positive or negative
+ * side of the sinc function. Because of filter symmetry
+ * the amount of filter taps used in convolution is
+ * zero crossings * 2.
+ */
+static const int LC_MAX_ZERO_CROSSINGS = RESAMPLER_44_TO_48_ZERO_CROSSINGS_PREMIUM;
+
+static const int LC_BUFFER_ACCESS_OUTPUT = LC_MAX_ZERO_CROSSINGS;
+
+/*
+ * The number of filters needed in 44.1 to 48 kHz sinc interpolation
+ * sampling rate conversion. Filter symmetry is utilized.
+ */
+static const int LC_FILTER_COUNT = 160;
+
+/*
+ * Calculated as 160-147.
+ * 147/160 is the smallest ratio of 44100/48000.
+ * Used as a hop increment in the filter table defined below.
+ */
+static const int LC_MATRIX_HOP_SIZE = 13;       
+
+/*
+ * This constant is calculated as ceil(2^23/160).
+ * and used in InSamplesNeeded() method to 
+ * avoid the division by 160. The result of the multiplication
+ * has to be shifted afterwards by 23 bits right.
+ */
+static const int LC_SAMPLE_COUNT_MULT = 52429;   
+
+/** Do not remove! LC_MAX_BLOCK_SIZE used in assert!
+ */
+#if 0
+/* 
+ * M_INPUT_COUNT_MULT * (6289*13+160) = 4294826393 (0xfffdd999).
+ * 6289 is the largest number that fits 32 bits in the
+ * input sample count multiplication method.
+ */
+static const int LC_MAX_BLOCK_SIZE = 6289;      
+#endif // 0
+
+
+RESAMPLER_SincConv44To48Int16::RESAMPLER_SincConv44To48Int16(int channelCount) :
+m_memBuffers(0),
+m_scratchBuffer(0),
+m_channelCount(channelCount),
+m_blockSize(0),
+m_channelEnabled(0),
+m_inputSamples(0),
+m_index1(LC_FILTER_COUNT),
+m_index2(0),
+m_zeroCrossings(RESAMPLER_44_TO_48_ZERO_CROSSINGS_STANDARD),
+m_filterMatrix(RESAMPLER_44_TO_48_FILTERS_STANDARD)
+{
+}
+
+
+RESAMPLER_SincConv44To48Int16::~RESAMPLER_SincConv44To48Int16()
+{
+    DeInit();
+}
+
+bool RESAMPLER_SincConv44To48Int16::InitInputDriven()
+{
+    return Init();
+}
+
+
+bool RESAMPLER_SincConv44To48Int16::InitOutputDriven()
+{
+    return Init();
+}
+
+bool RESAMPLER_SincConv44To48Int16::Init()
+{
+    int i(0);
+
+    m_memBuffers = new int16 *[m_channelCount];
+    if (!m_memBuffers)
+    {
+        return false;
+    }
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = 0;
+    }
+
+    m_channelEnabled = new bool[m_channelCount];
+    if (!m_channelEnabled)
+    {
+        DeInit();
+        return false;
+    }
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_channelEnabled[i] = true;
+    }
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = new int16[LC_MAX_ZERO_CROSSINGS * 2];
+        if (!m_memBuffers[i])
+        {
+            DeInit();
+            return false;
+        }
+        memset(m_memBuffers[i], 0, sizeof(int16) * (LC_MAX_ZERO_CROSSINGS * 2));
+    }
+
+    return true;
+}
+
+void 
+RESAMPLER_SincConv44To48Int16::DeInit()
+{
+    if (m_channelCount)
+    {
+        for (int i = 0; i < m_channelCount; i++)
+        {
+            delete [] m_memBuffers[i];
+        }
+        delete [] m_memBuffers;
+        delete [] m_channelEnabled;
+    }
+}
+
+bool 
+RESAMPLER_SincConv44To48Int16::SetQualityInputDriven(int mode)
+{
+    return SetQualityOutputDriven(mode);
+}
+
+bool 
+RESAMPLER_SincConv44To48Int16::SetQualityOutputDriven(int mode)
+{
+    switch (mode)
+    {
+    case RESAMPLER_RATE_CONVERSION_QUALITY_ECONOMY:
+        m_zeroCrossings = RESAMPLER_44_TO_48_ZERO_CROSSINGS_ECONOMY;
+        m_filterMatrix  = RESAMPLER_44_TO_48_FILTERS_ECONOMY;
+        break;
+    case RESAMPLER_RATE_CONVERSION_QUALITY_STANDARD:
+        m_zeroCrossings = RESAMPLER_44_TO_48_ZERO_CROSSINGS_STANDARD;
+        m_filterMatrix  = RESAMPLER_44_TO_48_FILTERS_STANDARD;
+        break;
+    case RESAMPLER_RATE_CONVERSION_QUALITY_PREMIUM:
+        m_zeroCrossings = RESAMPLER_44_TO_48_ZERO_CROSSINGS_PREMIUM;
+        m_filterMatrix  = RESAMPLER_44_TO_48_FILTERS_PREMIUM;
+        break;
+    default:
+        return false;
+    }
+    return true;
+}
+
+void 
+RESAMPLER_SincConv44To48Int16::EnableChannelInputDriven(int channel)
+{
+    EnableChannelOutputDriven(channel);
+}
+
+
+void 
+RESAMPLER_SincConv44To48Int16::DisableChannelInputDriven(int channel)
+{
+    DisableChannelOutputDriven(channel);
+}
+
+
+void 
+RESAMPLER_SincConv44To48Int16::EnableChannelOutputDriven(int channel)
+{
+    m_channelEnabled[channel] = true;
+}
+
+
+void 
+RESAMPLER_SincConv44To48Int16::DisableChannelOutputDriven(int channel)
+{
+    m_channelEnabled[channel] = false;
+}
+
+size_t 
+RESAMPLER_SincConv44To48Int16::ScratchMemoryNeedInputDriven(int maxInputBlockSize) const
+{
+    /** 6289 == LC_MAX_BLOCK_SIZE
+     */
+    if (maxInputBlockSize > 6289 * 44100.0/48000.0)
+        {
+        return 0;
+        }
+
+    return sizeof(int16) * (LC_MAX_ZERO_CROSSINGS * 2 + maxInputBlockSize);
+}
+
+void 
+RESAMPLER_SincConv44To48Int16::SetScratchBufferInputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+size_t 
+RESAMPLER_SincConv44To48Int16::ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const
+{
+    int blockSize =  (int)((maxOutputBlockSize * 44100.0/48000.0) + 1); 
+    
+    return ScratchMemoryNeedInputDriven(blockSize);
+}
+
+void 
+RESAMPLER_SincConv44To48Int16::SetScratchBufferOutputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+
+
+int 
+RESAMPLER_SincConv44To48Int16::MaxInputSampleCount(int outSamples) const
+{ 
+    return (int)((outSamples * (44100.0 / 48000.0)) + 1); 
+}
+
+
+int 
+RESAMPLER_SincConv44To48Int16::InSamplesNeeded(int outSamples)
+{
+    m_inputSamples = outSamples - ((LC_SAMPLE_COUNT_MULT * (outSamples*13+m_index2)) >> 23);
+ 
+    return m_inputSamples;
+}
+
+int 
+RESAMPLER_SincConv44To48Int16::MaxOutputSampleCount(int inSamples) const
+{ 
+    return (int)(inSamples * 160.0 / 147.0 + 1.0); 
+}
+
+
+int RESAMPLER_SincConv44To48Int16::ProcessFromInput(int16 *outputBuffers[], 
+                                              int16 *inputBuffers[], 
+                                              int inSamples)
+{
+    int outSamples = (int)((inSamples * 160.0 + m_index2) / 147.0);
+    m_inputSamples = inSamples;
+    return ProcessToOutput(outputBuffers, inputBuffers, outSamples);
+}
+
+int 
+RESAMPLER_SincConv44To48Int16::ProcessToOutput(int16 *outputBuffers[], 
+                                         int16 *inputBuffers[], 
+                                         int outSamples)
+{
+    static const int FILTER_LENGTH = 2 * LC_MAX_ZERO_CROSSINGS;
+	int i, j;
+    int index1 = m_index1;
+    int index2 = m_index2;
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        if (!m_channelEnabled[i])
+        {
+            break;
+        }
+
+        int16 *tempBuf = m_scratchBuffer;
+        int16 *outBuf  = outputBuffers[i];
+        index1 = m_index1; /* 160 SRC filter number */
+        index2 = m_index2; /* 0 */
+        
+        int state = 0;
+
+        memcpy(m_scratchBuffer, 
+               m_memBuffers[i], 
+               FILTER_LENGTH * sizeof(int16));
+
+        // Read samples into memory
+        memcpy(tempBuf + FILTER_LENGTH, 
+               inputBuffers[i], 
+               m_inputSamples * sizeof(int16));
+
+        // Do band limited interpolation and set the result into 
+        // every index in the output buffer. 
+        for (j = 0; j < outSamples; j++) 
+        {
+            index1 -= LC_MATRIX_HOP_SIZE; /* -13 */ 
+            index2 += LC_MATRIX_HOP_SIZE;  /* +13 */ 
+
+            if (index1 <= 0)
+            {
+                index1 += LC_FILTER_COUNT; /* +160 */
+                index2 -= LC_FILTER_COUNT;  /* -160 */
+                state++;
+            }
+
+            /*lint -e{662} */
+            const int16 *filterPtr1 = m_filterMatrix + index1 * m_zeroCrossings;
+            const int16 *filterPtr2 = m_filterMatrix + index2 * m_zeroCrossings;
+              
+            int32 newSample = 
+                RESAMPLER_SincConvFilterInt16(tempBuf + LC_BUFFER_ACCESS_OUTPUT - state + j,
+                                        filterPtr1,
+                                        filterPtr2,
+                                        m_zeroCrossings);
+             
+            // round and shift down
+            outBuf[j] = (int16)RESAMPLER_Clip16((newSample + 16384) >> 15);
+        }
+        
+        // Copy the newest samples to the beginning of the buffer
+        memcpy(m_memBuffers[i], 
+               m_scratchBuffer + m_inputSamples, 
+               FILTER_LENGTH * sizeof(int16));       
+    }
+
+    m_index1 = index1;
+    m_index2 = index2;
+
+	return outSamples;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_44_to_48_int16.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,51 @@
+#ifndef __RESAMPLER_SINC_CONV_44_TO_48_INT16_INL__
+#define __RESAMPLER_SINC_CONV_44_TO_48_INT16_INL__/*
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_common_defs.h"
+#include "resampler_data_types.h"
+
+
+static FORCEINLINE int32 
+RESAMPLER_SincConv44To48FilterInt16(const int16 *signalBuf, 
+                              const int16 *filterPtr1,
+                              const int16 *filterPtr2,
+                              int length)
+{
+    int32 newSample(0);
+    int k = length;
+    const int16 *bufferPtr1 = signalBuf;
+    const int16 *bufferPtr2 = signalBuf + 1;
+
+    // Calculate the filter. 
+    // Keep newSample in s1.30 format to reduce rounding errors
+    for (k = length; k > 0; k -= 4)
+    {
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);    
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
+    }
+    
+    return newSample;
+}
+
+
+#endif /* __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_44_to_48_tables_economy.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_44_to_48_tables_economy.h"
+
+const int16 RESAMPLER_44_TO_48_FILTERS_ECONOMY[161 * RESAMPLER_44_TO_48_ZERO_CROSSINGS_ECONOMY] = 
+{
+    32767,     0,     0,     0,     0,     0,     0,     0,
+    32766,  -195,    86,   -46,    25,   -12,     6,    -2,
+    32759,  -387,   171,   -91,    49,   -25,    11,    -4,
+    32749,  -576,   255,  -136,    73,   -37,    16,    -6,
+    32733,  -763,   338,  -180,    97,   -49,    22,    -8,
+    32714,  -947,   421,  -225,   121,   -61,    27,    -9,
+    32690, -1128,   502,  -268,   145,   -73,    32,   -11,
+    32662, -1307,   583,  -312,   168,   -85,    37,   -13,
+    32630, -1482,   663,  -354,   191,   -96,    43,   -15,
+    32593, -1655,   742,  -397,   214,  -108,    48,   -16,
+    32552, -1825,   820,  -439,   236,  -119,    52,   -18,
+    32507, -1991,   897,  -480,   258,  -130,    57,   -20,
+    32458, -2155,   973,  -521,   280,  -141,    62,   -21,
+    32404, -2316,  1048,  -561,   302,  -152,    67,   -23,
+    32346, -2475,  1122,  -601,   323,  -162,    71,   -24,
+    32284, -2630,  1195,  -640,   344,  -173,    76,   -26,
+    32218, -2782,  1267,  -679,   365,  -183,    80,   -27,
+    32147, -2931,  1338,  -717,   385,  -193,    85,   -29,
+    32073, -3077,  1408,  -755,   405,  -203,    89,   -30,
+    31994, -3220,  1476,  -792,   425,  -213,    93,   -31,
+    31911, -3360,  1544,  -828,   445,  -223,    97,   -33,
+    31824, -3497,  1610,  -864,   464,  -232,   101,   -34,
+    31733, -3631,  1675,  -899,   483,  -241,   105,   -35,
+    31638, -3762,  1739,  -934,   501,  -250,   109,   -36,
+    31538, -3890,  1801,  -968,   519,  -259,   113,   -38,
+    31435, -4015,  1863, -1001,   537,  -268,   116,   -39,
+    31328, -4137,  1923, -1034,   554,  -276,   120,   -40,
+    31216, -4255,  1982, -1066,   571,  -285,   123,   -41,
+    31101, -4371,  2040, -1097,   588,  -293,   127,   -42,
+    30982, -4483,  2096, -1128,   604,  -301,   130,   -43,
+    30859, -4593,  2151, -1158,   620,  -308,   133,   -44,
+    30732, -4699,  2205, -1187,   635,  -316,   136,   -45,
+    30602, -4802,  2257, -1216,   651,  -323,   139,   -46,
+    30467, -4902,  2309, -1243,   665,  -330,   142,   -46,
+    30329, -5000,  2358, -1271,   680,  -337,   145,   -47,
+    30187, -5093,  2407, -1297,   694,  -344,   147,   -48,
+    30041, -5184,  2454, -1323,   707,  -350,   150,   -49,
+    29892, -5272,  2500, -1348,   720,  -357,   152,   -49,
+    29739, -5357,  2544, -1372,   733,  -363,   155,   -50,
+    29583, -5438,  2588, -1396,   745,  -368,   157,   -51,
+    29423, -5517,  2629, -1419,   757,  -374,   159,   -51,
+    29259, -5592,  2670, -1441,   769,  -380,   162,   -52,
+    29092, -5665,  2709, -1462,   780,  -385,   164,   -52,
+    28922, -5734,  2746, -1483,   791,  -390,   166,   -53,
+    28748, -5801,  2782, -1502,   801,  -395,   167,   -53,
+    28571, -5864,  2817, -1522,   811,  -399,   169,   -54,
+    28390, -5924,  2851, -1540,   821,  -404,   171,   -54,
+    28207, -5981,  2883, -1557,   830,  -408,   172,   -54,
+    28020, -6036,  2913, -1574,   839,  -412,   174,   -55,
+    27830, -6087,  2942, -1590,   847,  -416,   175,   -55,
+    27636, -6136,  2970, -1606,   855,  -419,   176,   -55,
+    27440, -6181,  2997, -1620,   862,  -423,   178,   -55,
+    27241, -6224,  3022, -1634,   869,  -426,   179,   -56,
+    27038, -6263,  3045, -1647,   876,  -429,   180,   -56,
+    26833, -6300,  3068, -1659,   882,  -432,   181,   -56,
+    26625, -6334,  3088, -1671,   888,  -434,   181,   -56,
+    26414, -6365,  3108, -1682,   893,  -436,   182,   -56,
+    26200, -6393,  3126, -1692,   898,  -439,   183,   -56,
+    25984, -6418,  3143, -1701,   903,  -440,   183,   -56,
+    25765, -6441,  3158, -1710,   907,  -442,   184,   -56,
+    25543, -6460,  3172, -1717,   911,  -444,   184,   -56,
+    25319, -6477,  3185, -1724,   915,  -445,   185,   -56,
+    25092, -6492,  3196, -1731,   918,  -446,   185,   -56,
+    24862, -6503,  3206, -1736,   920,  -447,   185,   -56,
+    24630, -6512,  3214, -1741,   922,  -448,   185,   -56,
+    24396, -6518,  3221, -1745,   924,  -448,   185,   -55,
+    24160, -6522,  3227, -1748,   926,  -449,   185,   -55,
+    23921, -6523,  3232, -1751,   927,  -449,   185,   -55,
+    23680, -6521,  3235, -1753,   927,  -449,   185,   -55,
+    23437, -6517,  3237, -1754,   928,  -449,   184,   -54,
+    23192, -6510,  3237, -1755,   928,  -448,   184,   -54,
+    22945, -6501,  3237, -1754,   927,  -448,   183,   -54,
+    22696, -6489,  3235, -1754,   926,  -447,   183,   -54,
+    22445, -6475,  3231, -1752,   925,  -446,   182,   -53,
+    22192, -6459,  3227, -1750,   924,  -445,   181,   -53,
+    21937, -6440,  3221, -1747,   922,  -444,   181,   -52,
+    21681, -6419,  3214, -1743,   919,  -442,   180,   -52,
+    21423, -6395,  3206, -1739,   917,  -441,   179,   -52,
+    21163, -6369,  3196, -1734,   914,  -439,   178,   -51,
+    20901, -6341,  3186, -1728,   910,  -437,   177,   -51,
+    20639, -6311,  3174, -1722,   907,  -435,   176,   -50,
+    20374, -6278,  3161, -1715,   903,  -433,   175,   -50,
+    20109, -6244,  3147, -1707,   898,  -430,   173,   -49,
+    19842, -6207,  3132, -1699,   894,  -428,   172,   -49,
+    19574, -6168,  3115, -1690,   889,  -425,   171,   -48,
+    19304, -6127,  3098, -1681,   883,  -422,   169,   -48,
+    19034, -6084,  3079, -1671,   878,  -419,   168,   -47,
+    18762, -6039,  3060, -1660,   872,  -416,   166,   -46,
+    18490, -5992,  3039, -1649,   866,  -413,   165,   -46,
+    18216, -5943,  3017, -1637,   859,  -409,   163,   -45,
+    17942, -5893,  2994, -1625,   852,  -406,   162,   -45,
+    17667, -5840,  2971, -1612,   845,  -402,   160,   -44,
+    17391, -5786,  2946, -1599,   838,  -398,   158,   -43,
+    17114, -5730,  2920, -1585,   830,  -394,   156,   -43,
+    16837, -5672,  2893, -1570,   822,  -390,   154,   -42,
+    16559, -5613,  2866, -1555,   814,  -386,   152,   -41,
+    16280, -5551,  2837, -1540,   806,  -381,   151,   -41,
+    16001, -5489,  2807, -1524,   797,  -377,   149,   -40,
+    15722, -5424,  2777, -1507,   788,  -372,   147,   -39,
+    15442, -5359,  2746, -1490,   779,  -368,   144,   -38,
+    15162, -5291,  2714, -1473,   769,  -363,   142,   -38,
+    14882, -5222,  2681, -1455,   759,  -358,   140,   -37,
+    14602, -5152,  2647, -1436,   750,  -353,   138,   -36,
+    14322, -5081,  2612, -1418,   739,  -348,   136,   -36,
+    14041, -5008,  2577, -1398,   729,  -343,   134,   -35,
+    13761, -4933,  2541, -1379,   719,  -338,   131,   -34,
+    13481, -4858,  2504, -1359,   708,  -332,   129,   -33,
+    13201, -4781,  2467, -1338,   697,  -327,   127,   -33,
+    12921, -4703,  2428, -1318,   686,  -321,   124,   -32,
+    12641, -4624,  2390, -1296,   674,  -316,   122,   -31,
+    12362, -4544,  2350, -1275,   663,  -310,   120,   -30,
+    12083, -4463,  2310, -1253,   651,  -304,   117,   -30,
+    11804, -4381,  2269, -1231,   639,  -299,   115,   -29,
+    11526, -4298,  2228, -1208,   627,  -293,   112,   -28,
+    11249, -4214,  2186, -1186,   615,  -287,   110,   -28,
+    10972, -4129,  2143, -1162,   603,  -281,   108,   -27,
+    10696, -4043,  2100, -1139,   591,  -275,   105,   -26,
+    10421, -3956,  2057, -1115,   578,  -269,   103,   -25,
+    10146, -3869,  2013, -1091,   565,  -263,   100,   -25,
+     9872, -3781,  1968, -1067,   553,  -256,    98,   -24,
+     9600, -3692,  1923, -1043,   540,  -250,    95,   -23,
+     9328, -3602,  1878, -1018,   527,  -244,    92,   -22,
+     9057, -3512,  1832,  -993,   513,  -238,    90,   -22,
+     8787, -3421,  1786,  -968,   500,  -231,    87,   -21,
+     8519, -3330,  1740,  -943,   487,  -225,    85,   -20,
+     8251, -3238,  1693,  -917,   474,  -219,    82,   -20,
+     7985, -3146,  1646,  -892,   460,  -212,    80,   -19,
+     7720, -3054,  1598,  -866,   447,  -206,    77,   -18,
+     7456, -2961,  1551,  -840,   433,  -199,    75,   -17,
+     7194, -2867,  1503,  -814,   419,  -193,    72,   -17,
+     6933, -2773,  1454,  -788,   406,  -186,    70,   -16,
+     6674, -2680,  1406,  -762,   392,  -180,    67,   -15,
+     6416, -2585,  1357,  -735,   378,  -173,    64,   -15,
+     6160, -2491,  1309,  -709,   364,  -167,    62,   -14,
+     5905, -2396,  1260,  -682,   350,  -160,    59,   -14,
+     5652, -2302,  1211,  -655,   337,  -154,    57,   -13,
+     5401, -2207,  1162,  -629,   323,  -147,    54,   -12,
+     5152, -2112,  1112,  -602,   309,  -141,    52,   -12,
+     4904, -2018,  1063,  -575,   295,  -134,    49,   -11,
+     4658, -1923,  1014,  -549,   281,  -128,    47,   -10,
+     4414, -1828,   964,  -522,   267,  -122,    45,   -10,
+     4173, -1734,   915,  -495,   253,  -115,    42,    -9,
+     3933, -1639,   866,  -468,   240,  -109,    40,    -9,
+     3695, -1545,   816,  -441,   226,  -102,    37,    -8,
+     3459, -1451,   767,  -415,   212,   -96,    35,    -8,
+     3225, -1357,   718,  -388,   198,   -90,    33,    -7,
+     2994, -1263,   669,  -361,   185,   -83,    30,    -6,
+     2765, -1170,   620,  -335,   171,   -77,    28,    -6,
+     2537, -1077,   571,  -308,   157,   -71,    26,    -5,
+     2313,  -985,   522,  -282,   144,   -65,    23,    -5,
+     2090,  -893,   473,  -256,   130,   -59,    21,    -4,
+     1870,  -801,   425,  -229,   117,   -53,    19,    -4,
+     1652,  -710,   377,  -203,   103,   -47,    17,    -3,
+     1437,  -619,   329,  -177,    90,   -41,    14,    -3,
+     1224,  -529,   281,  -152,    77,   -35,    12,    -2,
+     1014,  -439,   233,  -126,    64,   -29,    10,    -2,
+      806,  -350,   186,  -100,    51,   -23,     8,    -2,
+      600,  -261,   139,   -75,    38,   -17,     6,    -1,
+      398,  -174,    92,   -50,    25,   -11,     4,    -1,
+      198,   -86,    46,   -25,    13,    -6,     2,     0,
+        0,     0,     0,     0,     0,     0,     0,     0
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_44_to_48_tables_premium.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_44_to_48_tables_premium.h"
+
+
+const int16 RESAMPLER_44_TO_48_FILTERS_PREMIUM[161 * RESAMPLER_44_TO_48_ZERO_CROSSINGS_PREMIUM] = 
+{
+    32767,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+    32766,  -200,    95,   -58,    38,   -26,    17,   -12,     7,    -5,     3,    -2,     1,     0,     0,     0,
+    32759,  -397,   189,  -115,    76,   -51,    35,   -23,    15,    -9,     6,    -3,     2,    -1,     0,     0,
+    32749,  -592,   283,  -172,   114,   -77,    52,   -35,    22,   -14,     8,    -5,     2,    -1,     0,     0,
+    32734,  -783,   375,  -229,   151,  -102,    69,   -46,    30,   -18,    11,    -6,     3,    -1,     1,     0,
+    32715,  -973,   467,  -286,   189,  -128,    86,   -57,    37,   -23,    14,    -8,     4,    -2,     1,     0,
+    32691, -1159,   558,  -342,   226,  -153,   103,   -69,    44,   -27,    16,    -9,     5,    -2,     1,     0,
+    32664, -1343,   649,  -397,   262,  -178,   120,   -80,    51,   -32,    19,   -10,     5,    -2,     1,     0,
+    32632, -1524,   738,  -452,   299,  -202,   137,   -91,    59,   -36,    21,   -12,     6,    -3,     1,     0,
+    32596, -1702,   826,  -507,   335,  -227,   153,  -102,    66,   -41,    24,   -13,     7,    -3,     1,     0,
+    32556, -1877,   914,  -561,   371,  -251,   169,  -113,    73,   -45,    27,   -15,     8,    -3,     1,     0,
+    32511, -2049,  1000,  -614,   406,  -275,   186,  -123,    80,   -49,    29,   -16,     8,    -4,     1,     0,
+    32462, -2219,  1086,  -667,   442,  -299,   202,  -134,    86,   -54,    32,   -18,     9,    -4,     2,     0,
+    32409, -2385,  1170,  -720,   476,  -322,   218,  -144,    93,   -58,    34,   -19,    10,    -4,     2,     0,
+    32352, -2549,  1254,  -772,   511,  -346,   233,  -155,   100,   -62,    37,   -20,    10,    -5,     2,    -1,
+    32291, -2709,  1336,  -823,   545,  -369,   249,  -165,   106,   -66,    39,   -22,    11,    -5,     2,    -1,
+    32226, -2867,  1418,  -874,   579,  -392,   264,  -175,   113,   -70,    41,   -23,    12,    -5,     2,    -1,
+    32156, -3022,  1498,  -924,   612,  -414,   280,  -185,   120,   -74,    44,   -24,    12,    -6,     2,    -1,
+    32083, -3174,  1577,  -973,   645,  -437,   295,  -195,   126,   -78,    46,   -25,    13,    -6,     2,    -1,
+    32005, -3323,  1655, -1022,   677,  -459,   310,  -205,   132,   -82,    48,   -27,    14,    -6,     2,    -1,
+    31923, -3468,  1732, -1070,   710,  -480,   324,  -215,   138,   -86,    50,   -28,    14,    -6,     2,    -1,
+    31837, -3611,  1807, -1118,   741,  -502,   339,  -225,   145,   -89,    53,   -29,    15,    -7,     3,    -1,
+    31748, -3751,  1882, -1165,   772,  -523,   353,  -234,   151,   -93,    55,   -30,    15,    -7,     3,    -1,
+    31654, -3887,  1955, -1211,   803,  -544,   367,  -243,   156,   -97,    57,   -31,    16,    -7,     3,    -1,
+    31556, -4021,  2026, -1256,   834,  -564,   381,  -252,   162,  -100,    59,   -32,    16,    -7,     3,    -1,
+    31454, -4152,  2097, -1301,   863,  -585,   394,  -261,   168,  -104,    61,   -34,    17,    -8,     3,    -1,
+    31348, -4279,  2166, -1345,   893,  -605,   408,  -270,   174,  -107,    63,   -35,    18,    -8,     3,    -1,
+    31239, -4403,  2234, -1388,   922,  -624,   421,  -279,   179,  -111,    65,   -36,    18,    -8,     3,    -1,
+    31125, -4525,  2301, -1430,   950,  -643,   434,  -287,   185,  -114,    67,   -37,    19,    -8,     3,    -1,
+    31007, -4643,  2366, -1472,   978,  -662,   447,  -296,   190,  -117,    69,   -38,    19,    -9,     3,    -1,
+    30886, -4758,  2430, -1512,  1005,  -681,   459,  -304,   195,  -120,    71,   -39,    20,    -9,     3,    -1,
+    30761, -4870,  2493, -1552,  1032,  -699,   471,  -312,   200,  -124,    72,   -40,    20,    -9,     3,    -1,
+    30632, -4979,  2554, -1592,  1058,  -717,   483,  -320,   205,  -127,    74,   -41,    21,    -9,     3,    -1,
+    30499, -5084,  2614, -1630,  1084,  -734,   495,  -328,   210,  -130,    76,   -42,    21,    -9,     4,    -1,
+    30363, -5187,  2672, -1667,  1109,  -751,   506,  -335,   215,  -133,    78,   -43,    21,   -10,     4,    -1,
+    30223, -5286,  2729, -1704,  1134,  -768,   518,  -342,   220,  -135,    79,   -43,    22,   -10,     4,    -1,
+    30079, -5383,  2785, -1740,  1158,  -784,   529,  -350,   224,  -138,    81,   -44,    22,   -10,     4,    -1,
+    29932, -5476,  2839, -1775,  1181,  -800,   539,  -357,   229,  -141,    82,   -45,    23,   -10,     4,    -1,
+    29781, -5566,  2891, -1809,  1204,  -816,   550,  -363,   233,  -144,    84,   -46,    23,   -10,     4,    -1,
+    29627, -5653,  2942, -1842,  1226,  -831,   560,  -370,   237,  -146,    85,   -47,    23,   -10,     4,    -1,
+    29469, -5737,  2992, -1874,  1248,  -846,   570,  -377,   241,  -149,    87,   -47,    24,   -11,     4,    -1,
+    29307, -5818,  3040, -1905,  1269,  -860,   579,  -383,   245,  -151,    88,   -48,    24,   -11,     4,    -1,
+    29142, -5895,  3087, -1936,  1290,  -874,   589,  -389,   249,  -153,    89,   -49,    24,   -11,     4,    -1,
+    28974, -5970,  3132, -1965,  1310,  -887,   598,  -395,   253,  -156,    91,   -50,    25,   -11,     4,    -1,
+    28802, -6042,  3176, -1994,  1329,  -900,   607,  -401,   257,  -158,    92,   -50,    25,   -11,     4,    -1,
+    28627, -6110,  3218, -2022,  1348,  -913,   615,  -406,   260,  -160,    93,   -51,    25,   -11,     4,    -1,
+    28449, -6175,  3258, -2048,  1366,  -925,   623,  -412,   263,  -162,    94,   -51,    26,   -11,     4,    -1,
+    28267, -6238,  3298, -2074,  1383,  -937,   631,  -417,   267,  -164,    95,   -52,    26,   -11,     4,    -1,
+    28082, -6297,  3335, -2099,  1400,  -949,   639,  -422,   270,  -166,    96,   -53,    26,   -12,     4,    -1,
+    27895, -6353,  3371, -2123,  1416,  -960,   646,  -427,   273,  -167,    98,   -53,    26,   -12,     4,    -1,
+    27704, -6406,  3406, -2146,  1432,  -970,   653,  -431,   276,  -169,    98,   -54,    27,   -12,     4,    -1,
+    27509, -6456,  3439, -2168,  1447,  -980,   660,  -436,   278,  -171,    99,   -54,    27,   -12,     4,    -1,
+    27312, -6504,  3470, -2189,  1461,  -990,   667,  -440,   281,  -172,   100,   -54,    27,   -12,     4,    -1,
+    27112, -6548,  3500, -2209,  1475,  -999,   673,  -444,   284,  -174,   101,   -55,    27,   -12,     4,    -1,
+    26909, -6589,  3528, -2228,  1488, -1008,   679,  -448,   286,  -175,   102,   -55,    27,   -12,     4,    -1,
+    26703, -6627,  3555, -2246,  1500, -1017,   684,  -451,   288,  -177,   103,   -56,    28,   -12,     4,    -1,
+    26495, -6662,  3580, -2263,  1512, -1025,   690,  -455,   290,  -178,   103,   -56,    28,   -12,     4,    -1,
+    26283, -6695,  3603, -2280,  1523, -1032,   695,  -458,   292,  -179,   104,   -56,    28,   -12,     4,    -1,
+    26069, -6724,  3626, -2295,  1534, -1039,   699,  -461,   294,  -180,   105,   -57,    28,   -12,     4,    -1,
+    25852, -6751,  3646, -2309,  1544, -1046,   704,  -464,   296,  -181,   105,   -57,    28,   -12,     4,    -1,
+    25632, -6774,  3665, -2322,  1553, -1052,   708,  -466,   298,  -182,   106,   -57,    28,   -12,     4,    -1,
+    25410, -6795,  3682, -2335,  1561, -1058,   712,  -469,   299,  -183,   106,   -57,    28,   -12,     4,    -1,
+    25185, -6813,  3698, -2346,  1569, -1063,   715,  -471,   300,  -184,   106,   -58,    28,   -12,     4,    -1,
+    24958, -6828,  3713, -2356,  1576, -1068,   718,  -473,   302,  -184,   107,   -58,    29,   -12,     4,    -1,
+    24729, -6840,  3725, -2366,  1583, -1073,   721,  -475,   303,  -185,   107,   -58,    29,   -12,     4,    -1,
+    24497, -6850,  3737, -2374,  1589, -1077,   724,  -477,   304,  -186,   107,   -58,    29,   -12,     4,    -1,
+    24262, -6857,  3746, -2382,  1594, -1080,   726,  -478,   305,  -186,   108,   -58,    29,   -12,     4,    -1,
+    24026, -6861,  3755, -2388,  1599, -1083,   728,  -479,   305,  -186,   108,   -58,    29,   -12,     4,    -1,
+    23787, -6862,  3761, -2394,  1603, -1086,   730,  -480,   306,  -187,   108,   -58,    29,   -12,     4,    -1,
+    23546, -6861,  3767, -2398,  1606, -1088,   732,  -481,   306,  -187,   108,   -58,    29,   -12,     4,    -1,
+    23303, -6857,  3770, -2402,  1609, -1090,   733,  -482,   307,  -187,   108,   -58,    29,   -12,     4,    -1,
+    23057, -6850,  3773, -2404,  1611, -1091,   734,  -482,   307,  -187,   108,   -58,    29,   -12,     4,    -1,
+    22810, -6841,  3773, -2406,  1612, -1092,   734,  -483,   307,  -187,   108,   -58,    29,   -12,     4,    -1,
+    22561, -6830,  3773, -2407,  1613, -1093,   734,  -483,   307,  -187,   108,   -58,    29,   -12,     4,    -1,
+    22310, -6815,  3770, -2407,  1613, -1093,   734,  -483,   307,  -187,   108,   -58,    28,   -12,     4,    -1,
+    22057, -6799,  3767, -2406,  1612, -1093,   734,  -482,   307,  -187,   108,   -58,    28,   -12,     4,    -1,
+    21803, -6779,  3762, -2404,  1611, -1092,   733,  -482,   306,  -187,   107,   -58,    28,   -12,     4,    -1,
+    21546, -6758,  3755, -2401,  1609, -1091,   733,  -481,   306,  -186,   107,   -58,    28,   -12,     4,    -1,
+    21288, -6733,  3747, -2397,  1607, -1089,   731,  -480,   305,  -186,   107,   -57,    28,   -12,     4,    -1,
+    21029, -6707,  3738, -2392,  1604, -1087,   730,  -479,   305,  -185,   107,   -57,    28,   -12,     4,    -1,
+    20767, -6678,  3727, -2386,  1600, -1085,   728,  -478,   304,  -185,   106,   -57,    28,   -12,     4,    -1,
+    20505, -6647,  3715, -2379,  1596, -1082,   726,  -477,   303,  -184,   106,   -57,    28,   -12,     4,    -1,
+    20241, -6613,  3702, -2372,  1591, -1079,   724,  -475,   302,  -183,   105,   -56,    28,   -12,     4,    -1,
+    19975, -6577,  3687, -2364,  1586, -1075,   721,  -473,   300,  -183,   105,   -56,    27,   -12,     4,    -1,
+    19708, -6539,  3671, -2354,  1580, -1071,   719,  -471,   299,  -182,   104,   -56,    27,   -12,     4,    -1,
+    19440, -6499,  3653, -2344,  1573, -1066,   716,  -469,   298,  -181,   104,   -56,    27,   -12,     4,    -1,
+    19171, -6457,  3634, -2333,  1566, -1061,   712,  -467,   296,  -180,   103,   -55,    27,   -11,     4,    -1,
+    18901, -6412,  3614, -2321,  1559, -1056,   709,  -465,   295,  -179,   103,   -55,    27,   -11,     4,    -1,
+    18629, -6365,  3593, -2309,  1550, -1051,   705,  -462,   293,  -178,   102,   -54,    26,   -11,     4,    -1,
+    18357, -6317,  3570, -2295,  1541, -1044,   701,  -459,   291,  -177,   101,   -54,    26,   -11,     4,    -1,
+    18084, -6266,  3546, -2281,  1532, -1038,   696,  -456,   289,  -175,   100,   -54,    26,   -11,     4,    -1,
+    17809, -6213,  3521, -2265,  1522, -1031,   692,  -453,   287,  -174,   100,   -53,    26,   -11,     4,    -1,
+    17534, -6159,  3494, -2249,  1511, -1024,   687,  -450,   285,  -173,    99,   -53,    26,   -11,     4,    -1,
+    17258, -6102,  3467, -2233,  1500, -1017,   682,  -446,   283,  -171,    98,   -52,    25,   -11,     4,    -1,
+    16982, -6043,  3438, -2215,  1489, -1009,   676,  -443,   280,  -170,    97,   -52,    25,   -11,     4,    -1,
+    16705, -5983,  3408, -2197,  1477, -1001,   671,  -439,   278,  -168,    96,   -51,    25,   -10,     4,    -1,
+    16427, -5921,  3377, -2178,  1464,  -992,   665,  -435,   275,  -167,    95,   -51,    24,   -10,     4,    -1,
+    16148, -5857,  3345, -2158,  1451,  -983,   659,  -431,   273,  -165,    94,   -50,    24,   -10,     3,    -1,
+    15869, -5791,  3311, -2137,  1437,  -974,   653,  -427,   270,  -163,    93,   -50,    24,   -10,     3,    -1,
+    15590, -5724,  3277, -2116,  1423,  -964,   646,  -423,   267,  -162,    92,   -49,    24,   -10,     3,    -1,
+    15311, -5655,  3242, -2094,  1408,  -954,   639,  -418,   264,  -160,    91,   -48,    23,   -10,     3,    -1,
+    15031, -5584,  3205, -2071,  1393,  -944,   632,  -414,   261,  -158,    90,   -48,    23,   -10,     3,    -1,
+    14750, -5512,  3167, -2048,  1378,  -933,   625,  -409,   258,  -156,    89,   -47,    23,   -10,     3,    -1,
+    14470, -5439,  3129, -2024,  1362,  -922,   618,  -404,   255,  -154,    88,   -47,    22,    -9,     3,    -1,
+    14190, -5363,  3089, -1999,  1345,  -911,   610,  -399,   252,  -152,    87,   -46,    22,    -9,     3,    -1,
+    13909, -5287,  3049, -1973,  1328,  -900,   602,  -394,   249,  -150,    85,   -45,    22,    -9,     3,    -1,
+    13629, -5208,  3007, -1947,  1311,  -888,   594,  -388,   245,  -148,    84,   -45,    21,    -9,     3,    -1,
+    13348, -5129,  2965, -1921,  1293,  -876,   586,  -383,   242,  -146,    83,   -44,    21,    -9,     3,    -1,
+    13068, -5048,  2922, -1893,  1275,  -863,   578,  -378,   238,  -144,    82,   -43,    21,    -9,     3,    -1,
+    12788, -4966,  2877, -1865,  1256,  -851,   569,  -372,   235,  -141,    80,   -42,    20,    -8,     3,    -1,
+    12508, -4883,  2832, -1837,  1237,  -838,   561,  -366,   231,  -139,    79,   -42,    20,    -8,     3,    -1,
+    12228, -4798,  2786, -1808,  1218,  -825,   552,  -360,   227,  -137,    78,   -41,    20,    -8,     3,    -1,
+    11949, -4712,  2740, -1778,  1198,  -811,   543,  -354,   223,  -134,    76,   -40,    19,    -8,     3,    -1,
+    11670, -4625,  2692, -1748,  1178,  -798,   534,  -348,   219,  -132,    75,   -40,    19,    -8,     3,    -1,
+    11392, -4537,  2644, -1717,  1157,  -784,   524,  -342,   215,  -130,    74,   -39,    18,    -8,     3,     0,
+    11114, -4448,  2595, -1686,  1136,  -769,   515,  -336,   211,  -127,    72,   -38,    18,    -8,     2,     0,
+    10837, -4358,  2545, -1655,  1115,  -755,   505,  -329,   207,  -125,    71,   -37,    18,    -7,     2,     0,
+    10560, -4267,  2495, -1622,  1093,  -740,   495,  -323,   203,  -122,    69,   -36,    17,    -7,     2,     0,
+    10285, -4175,  2444, -1590,  1072,  -726,   485,  -316,   199,  -120,    68,   -36,    17,    -7,     2,     0,
+    10009, -4082,  2392, -1557,  1049,  -711,   475,  -310,   195,  -117,    66,   -35,    17,    -7,     2,     0,
+     9735, -3989,  2339, -1523,  1027,  -695,   465,  -303,   190,  -114,    65,   -34,    16,    -7,     2,     0,
+     9462, -3894,  2286, -1489,  1004,  -680,   454,  -296,   186,  -112,    63,   -33,    16,    -6,     2,     0,
+     9189, -3799,  2233, -1455,   981,  -664,   444,  -289,   182,  -109,    62,   -32,    15,    -6,     2,     0,
+     8917, -3703,  2179, -1420,   958,  -648,   433,  -282,   177,  -106,    60,   -32,    15,    -6,     2,     0,
+     8647, -3606,  2124, -1385,   934,  -632,   422,  -275,   173,  -104,    59,   -31,    15,    -6,     2,     0,
+     8377, -3509,  2069, -1349,   910,  -616,   412,  -268,   168,  -101,    57,   -30,    14,    -6,     2,     0,
+     8109, -3411,  2013, -1313,   886,  -600,   401,  -261,   164,   -98,    55,   -29,    14,    -6,     2,     0,
+     7842, -3312,  1957, -1277,   862,  -583,   390,  -254,   159,   -95,    54,   -28,    13,    -5,     2,     0,
+     7576, -3213,  1900, -1241,   837,  -567,   378,  -246,   155,   -93,    52,   -27,    13,    -5,     2,     0,
+     7311, -3114,  1843, -1204,   812,  -550,   367,  -239,   150,   -90,    51,   -26,    12,    -5,     2,     0,
+     7048, -3014,  1786, -1167,   787,  -533,   356,  -231,   145,   -87,    49,   -26,    12,    -5,     2,     0,
+     6786, -2913,  1728, -1130,   762,  -516,   344,  -224,   140,   -84,    47,   -25,    12,    -5,     2,     0,
+     6526, -2812,  1670, -1092,   737,  -499,   333,  -216,   136,   -81,    46,   -24,    11,    -5,     1,     0,
+     6267, -2711,  1612, -1054,   711,  -481,   321,  -209,   131,   -78,    44,   -23,    11,    -4,     1,     0,
+     6009, -2610,  1553, -1016,   686,  -464,   310,  -201,   126,   -75,    42,   -22,    10,    -4,     1,     0,
+     5753, -2509,  1494,  -978,   660,  -447,   298,  -194,   121,   -72,    41,   -21,    10,    -4,     1,     0,
+     5499, -2407,  1435,  -939,   634,  -429,   286,  -186,   116,   -70,    39,   -20,    10,    -4,     1,     0,
+     5247, -2305,  1375,  -901,   608,  -411,   274,  -178,   112,   -67,    37,   -19,     9,    -4,     1,     0,
+     4996, -2203,  1315,  -862,   582,  -394,   263,  -171,   107,   -64,    36,   -19,     9,    -4,     1,     0,
+     4747, -2101,  1256,  -823,   556,  -376,   251,  -163,   102,   -61,    34,   -18,     8,    -3,     1,     0,
+     4499, -1998,  1196,  -784,   529,  -358,   239,  -155,    97,   -58,    32,   -17,     8,    -3,     1,     0,
+     4254, -1896,  1136,  -745,   503,  -340,   227,  -147,    92,   -55,    31,   -16,     7,    -3,     1,     0,
+     4011, -1794,  1075,  -705,   476,  -322,   215,  -139,    87,   -52,    29,   -15,     7,    -3,     1,     0,
+     3769, -1692,  1015,  -666,   450,  -304,   203,  -132,    82,   -49,    27,   -14,     7,    -3,     1,     0,
+     3530, -1590,   955,  -627,   423,  -286,   191,  -124,    77,   -46,    26,   -13,     6,    -3,     1,     0,
+     3292, -1488,   894,  -587,   397,  -268,   179,  -116,    72,   -43,    24,   -13,     6,    -2,     1,     0,
+     3057, -1386,   834,  -548,   370,  -250,   167,  -108,    68,   -40,    23,   -12,     5,    -2,     1,     0,
+     2823, -1285,   773,  -508,   343,  -232,   155,  -100,    63,   -37,    21,   -11,     5,    -2,     1,     0,
+     2592, -1183,   713,  -469,   317,  -214,   143,   -92,    58,   -34,    19,   -10,     5,    -2,     1,     0,
+     2363, -1082,   653,  -429,   290,  -196,   131,   -85,    53,   -31,    18,    -9,     4,    -2,     1,     0,
+     2137,  -982,   593,  -390,   263,  -178,   119,   -77,    48,   -29,    16,    -8,     4,    -2,     0,     0,
+     1912,  -881,   533,  -350,   237,  -160,   107,   -69,    43,   -26,    14,    -7,     3,    -1,     0,     0,
+     1690,  -781,   473,  -311,   210,  -142,    95,   -61,    38,   -23,    13,    -7,     3,    -1,     0,     0,
+     1470,  -682,   413,  -272,   184,  -124,    83,   -54,    33,   -20,    11,    -6,     3,    -1,     0,     0,
+     1253,  -583,   353,  -232,   157,  -106,    71,   -46,    29,   -17,     9,    -5,     2,    -1,     0,     0,
+     1038,  -484,   294,  -193,   131,   -88,    59,   -38,    24,   -14,     8,    -4,     2,    -1,     0,     0,
+      825,  -386,   234,  -154,   104,   -71,    47,   -30,    19,   -11,     6,    -3,     1,    -1,     0,     0,
+      615,  -289,   175,  -116,    78,   -53,    35,   -23,    14,    -8,     5,    -2,     1,     0,     0,     0,
+      407,  -192,   117,   -77,    52,   -35,    23,   -15,     9,    -6,     3,    -2,     1,     0,     0,     0,
+      202,   -96,    58,   -38,    26,   -18,    12,    -8,     5,    -3,     2,    -1,     0,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_44_to_48_tables_standard.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_44_to_48_tables_standard.h"
+
+
+const int16 RESAMPLER_44_TO_48_FILTERS_STANDARD[161 * RESAMPLER_44_TO_48_ZERO_CROSSINGS_STANDARD] = 
+{
+    32767,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+    32766,  -197,    90,   -51,    30,   -18,    10,    -5,     3,    -1,     0,     0,
+    32759,  -391,   179,  -101,    60,   -35,    20,   -10,     5,    -2,     1,     0,
+    32749,  -583,   267,  -151,    90,   -53,    30,   -16,     7,    -3,     1,     0,
+    32734,  -772,   354,  -201,   120,   -70,    39,   -21,    10,    -4,     1,     0,
+    32714,  -958,   441,  -250,   149,   -87,    49,   -26,    12,    -5,     2,     0,
+    32691, -1142,   527,  -299,   178,  -104,    59,   -31,    15,    -6,     2,    -1,
+    32663, -1322,   611,  -348,   207,  -121,    68,   -36,    17,    -7,     2,    -1,
+    32631, -1500,   695,  -396,   235,  -138,    77,   -41,    19,    -8,     3,    -1,
+    32594, -1675,   778,  -443,   264,  -155,    87,   -45,    22,    -9,     3,    -1,
+    32554, -1847,   861,  -490,   291,  -171,    96,   -50,    24,   -10,     3,    -1,
+    32509, -2017,   942,  -537,   319,  -187,   105,   -55,    26,   -11,     4,    -1,
+    32460, -2183,  1022,  -583,   347,  -203,   114,   -60,    28,   -12,     4,    -1,
+    32407, -2346,  1101,  -628,   374,  -219,   123,   -64,    30,   -13,     4,    -1,
+    32349, -2507,  1179,  -673,   400,  -235,   131,   -69,    32,   -13,     5,    -1,
+    32287, -2664,  1256,  -718,   427,  -250,   140,   -73,    35,   -14,     5,    -1,
+    32221, -2819,  1332,  -761,   453,  -265,   148,   -77,    37,   -15,     5,    -1,
+    32151, -2971,  1407,  -805,   478,  -280,   157,   -82,    39,   -16,     5,    -1,
+    32077, -3119,  1481,  -847,   504,  -295,   165,   -86,    41,   -17,     6,    -1,
+    31999, -3265,  1553,  -889,   529,  -310,   173,   -90,    43,   -17,     6,    -1,
+    31916, -3407,  1625,  -931,   553,  -324,   181,   -94,    44,   -18,     6,    -1,
+    31830, -3547,  1695,  -971,   578,  -338,   189,   -98,    46,   -19,     6,    -1,
+    31739, -3683,  1764, -1011,   602,  -352,   197,  -102,    48,   -20,     7,    -1,
+    31645, -3817,  1832, -1051,   625,  -366,   204,  -106,    50,   -20,     7,    -2,
+    31546, -3947,  1898, -1090,   648,  -379,   211,  -110,    52,   -21,     7,    -2,
+    31443, -4075,  1964, -1128,   671,  -392,   219,  -114,    53,   -22,     7,    -2,
+    31337, -4199,  2028, -1165,   693,  -405,   226,  -117,    55,   -22,     7,    -2,
+    31226, -4320,  2091, -1202,   715,  -418,   233,  -121,    57,   -23,     8,    -2,
+    31112, -4438,  2152, -1238,   736,  -430,   240,  -124,    58,   -24,     8,    -2,
+    30993, -4553,  2212, -1273,   757,  -442,   246,  -128,    60,   -24,     8,    -2,
+    30871, -4665,  2271, -1307,   778,  -454,   253,  -131,    61,   -25,     8,    -2,
+    30745, -4773,  2329, -1341,   798,  -466,   259,  -134,    63,   -25,     8,    -2,
+    30615, -4879,  2385, -1374,   817,  -477,   266,  -137,    64,   -26,     9,    -2,
+    30481, -4982,  2440, -1407,   837,  -488,   272,  -140,    66,   -27,     9,    -2,
+    30344, -5081,  2494, -1438,   855,  -499,   277,  -143,    67,   -27,     9,    -2,
+    30203, -5177,  2546, -1469,   874,  -510,   283,  -146,    68,   -28,     9,    -2,
+    30058, -5271,  2596, -1499,   891,  -520,   289,  -149,    69,   -28,     9,    -2,
+    29910, -5361,  2646, -1528,   909,  -530,   294,  -152,    71,   -29,     9,    -2,
+    29758, -5448,  2694, -1556,   926,  -540,   300,  -154,    72,   -29,     9,    -2,
+    29602, -5532,  2740, -1584,   942,  -549,   305,  -157,    73,   -29,    10,    -2,
+    29443, -5613,  2785, -1611,   958,  -558,   310,  -159,    74,   -30,    10,    -2,
+    29280, -5691,  2829, -1637,   973,  -567,   314,  -162,    75,   -30,    10,    -2,
+    29114, -5765,  2871, -1662,   988,  -576,   319,  -164,    76,   -31,    10,    -2,
+    28945, -5837,  2912, -1686,  1003,  -584,   324,  -166,    77,   -31,    10,    -2,
+    28772, -5906,  2952, -1709,  1017,  -592,   328,  -168,    78,   -31,    10,    -2,
+    28595, -5971,  2990, -1732,  1030,  -600,   332,  -170,    79,   -32,    10,    -2,
+    28416, -6034,  3026, -1754,  1043,  -607,   336,  -172,    80,   -32,    10,    -2,
+    28233, -6093,  3061, -1775,  1056,  -614,   340,  -174,    81,   -32,    10,    -2,
+    28047, -6150,  3095, -1795,  1068,  -621,   343,  -176,    81,   -32,    10,    -2,
+    27858, -6203,  3127, -1815,  1079,  -628,   347,  -178,    82,   -33,    10,    -2,
+    27666, -6253,  3157, -1833,  1090,  -634,   350,  -179,    83,   -33,    10,    -2,
+    27470, -6301,  3187, -1851,  1101,  -640,   353,  -181,    83,   -33,    10,    -2,
+    27272, -6345,  3214, -1868,  1110,  -645,   356,  -182,    84,   -33,    11,    -2,
+    27071, -6387,  3241, -1883,  1120,  -651,   359,  -184,    84,   -33,    11,    -2,
+    26867, -6426,  3265, -1899,  1129,  -656,   362,  -185,    85,   -34,    11,    -2,
+    26659, -6461,  3289, -1913,  1137,  -661,   364,  -186,    85,   -34,    11,    -2,
+    26449, -6494,  3311, -1926,  1145,  -665,   366,  -187,    86,   -34,    11,    -2,
+    26237, -6524,  3331, -1939,  1153,  -669,   369,  -188,    86,   -34,    11,    -2,
+    26021, -6551,  3350, -1951,  1160,  -673,   371,  -189,    87,   -34,    11,    -2,
+    25803, -6576,  3368, -1962,  1166,  -677,   372,  -190,    87,   -34,    11,    -2,
+    25582, -6597,  3384, -1972,  1172,  -680,   374,  -190,    87,   -34,    11,    -2,
+    25359, -6616,  3398, -1981,  1177,  -683,   376,  -191,    87,   -34,    11,    -2,
+    25133, -6631,  3411, -1989,  1182,  -685,   377,  -192,    88,   -34,    11,    -2,
+    24904, -6645,  3423, -1997,  1187,  -688,   378,  -192,    88,   -34,    11,    -2,
+    24673, -6655,  3434, -2003,  1191,  -690,   379,  -193,    88,   -34,    11,    -2,
+    24440, -6663,  3442, -2009,  1194,  -692,   380,  -193,    88,   -34,    11,    -2,
+    24205, -6668,  3450, -2014,  1197,  -693,   381,  -193,    88,   -34,    11,    -2,
+    23967, -6670,  3456, -2018,  1199,  -694,   381,  -193,    88,   -34,    11,    -2,
+    23727, -6670,  3461, -2022,  1201,  -695,   381,  -193,    88,   -34,    11,    -2,
+    23485, -6667,  3464, -2024,  1203,  -696,   382,  -193,    88,   -34,    10,    -2,
+    23240, -6661,  3466, -2026,  1204,  -696,   382,  -193,    88,   -34,    10,    -2,
+    22994, -6653,  3466, -2027,  1204,  -697,   382,  -193,    88,   -34,    10,    -2,
+    22746, -6642,  3466, -2027,  1204,  -696,   381,  -193,    87,   -34,    10,    -2,
+    22496, -6629,  3463, -2027,  1204,  -696,   381,  -193,    87,   -34,    10,    -2,
+    22244, -6614,  3460, -2025,  1203,  -695,   380,  -192,    87,   -34,    10,    -2,
+    21990, -6596,  3455, -2023,  1201,  -694,   380,  -192,    87,   -34,    10,    -2,
+    21734, -6575,  3449, -2020,  1200,  -693,   379,  -191,    86,   -33,    10,    -2,
+    21477, -6553,  3441, -2016,  1197,  -691,   378,  -191,    86,   -33,    10,    -2,
+    21218, -6528,  3432, -2011,  1194,  -690,   377,  -190,    86,   -33,    10,    -2,
+    20957, -6500,  3422, -2006,  1191,  -688,   375,  -189,    85,   -33,    10,    -2,
+    20695, -6470,  3411, -2000,  1187,  -685,   374,  -188,    85,   -33,    10,    -2,
+    20431, -6438,  3398, -1993,  1183,  -683,   372,  -187,    84,   -32,    10,    -2,
+    20167, -6404,  3385, -1985,  1179,  -680,   371,  -186,    84,   -32,    10,    -2,
+    19900, -6368,  3369, -1977,  1174,  -677,   369,  -185,    83,   -32,     9,    -2,
+    19633, -6329,  3353, -1968,  1168,  -673,   367,  -184,    83,   -32,     9,    -2,
+    19364, -6289,  3336, -1958,  1162,  -670,   365,  -183,    82,   -31,     9,    -2,
+    19094, -6246,  3317, -1948,  1156,  -666,   362,  -182,    81,   -31,     9,    -2,
+    18823, -6201,  3297, -1937,  1149,  -662,   360,  -181,    81,   -31,     9,    -2,
+    18551, -6154,  3276, -1925,  1142,  -658,   358,  -179,    80,   -31,     9,    -2,
+    18278, -6106,  3254, -1912,  1135,  -653,   355,  -178,    79,   -30,     9,    -2,
+    18004, -6055,  3230, -1899,  1127,  -648,   352,  -176,    79,   -30,     9,    -1,
+    17729, -6002,  3206, -1885,  1118,  -643,   349,  -175,    78,   -30,     9,    -1,
+    17453, -5948,  3180, -1871,  1110,  -638,   346,  -173,    77,   -29,     9,    -1,
+    17177, -5891,  3154, -1855,  1100,  -633,   343,  -171,    76,   -29,     8,    -1,
+    16900, -5833,  3126, -1839,  1091,  -627,   340,  -170,    76,   -29,     8,    -1,
+    16622, -5773,  3098, -1823,  1081,  -621,   337,  -168,    75,   -28,     8,    -1,
+    16344, -5712,  3068, -1806,  1071,  -615,   333,  -166,    74,   -28,     8,    -1,
+    16066, -5649,  3037, -1788,  1060,  -609,   330,  -164,    73,   -27,     8,    -1,
+    15786, -5584,  3006, -1770,  1049,  -602,   326,  -162,    72,   -27,     8,    -1,
+    15507, -5517,  2973, -1751,  1038,  -596,   322,  -160,    71,   -27,     8,    -1,
+    15227, -5449,  2939, -1732,  1026,  -589,   319,  -158,    70,   -26,     8,    -1,
+    14947, -5380,  2905, -1712,  1015,  -582,   315,  -156,    69,   -26,     7,    -1,
+    14667, -5308,  2869, -1691,  1002,  -575,   311,  -154,    68,   -26,     7,    -1,
+    14387, -5236,  2833, -1670,   990,  -567,   307,  -152,    67,   -25,     7,    -1,
+    14106, -5162,  2796, -1649,   977,  -560,   302,  -150,    66,   -25,     7,    -1,
+    13826, -5087,  2758, -1627,   964,  -552,   298,  -148,    65,   -24,     7,    -1,
+    13545, -5010,  2719, -1604,   950,  -544,   294,  -145,    64,   -24,     7,    -1,
+    13265, -4932,  2679, -1581,   936,  -536,   289,  -143,    63,   -23,     7,    -1,
+    12985, -4853,  2639, -1557,   922,  -528,   285,  -141,    62,   -23,     6,    -1,
+    12705, -4773,  2598, -1533,   908,  -520,   280,  -138,    61,   -23,     6,    -1,
+    12426, -4691,  2556, -1509,   893,  -511,   275,  -136,    60,   -22,     6,    -1,
+    12147, -4608,  2513, -1484,   879,  -502,   270,  -134,    59,   -22,     6,    -1,
+    11868, -4525,  2470, -1459,   863,  -494,   266,  -131,    57,   -21,     6,    -1,
+    11589, -4440,  2426, -1433,   848,  -485,   261,  -129,    56,   -21,     6,    -1,
+    11312, -4354,  2381, -1407,   833,  -476,   256,  -126,    55,   -20,     6,    -1,
+    11034, -4267,  2336, -1380,   817,  -467,   251,  -124,    54,   -20,     5,    -1,
+    10758, -4180,  2290, -1353,   801,  -457,   246,  -121,    53,   -19,     5,    -1,
+    10482, -4091,  2244, -1326,   784,  -448,   240,  -118,    52,   -19,     5,    -1,
+    10207, -4002,  2196, -1299,   768,  -438,   235,  -116,    50,   -18,     5,    -1,
+     9932, -3911,  2149, -1271,   751,  -429,   230,  -113,    49,   -18,     5,    -1,
+     9659, -3820,  2101, -1242,   735,  -419,   225,  -110,    48,   -18,     5,    -1,
+     9386, -3729,  2052, -1214,   718,  -409,   219,  -108,    47,   -17,     5,    -1,
+     9115, -3636,  2003, -1185,   701,  -399,   214,  -105,    46,   -17,     5,    -1,
+     8844, -3543,  1953, -1156,   683,  -389,   208,  -102,    44,   -16,     4,    -1,
+     8575, -3450,  1903, -1126,   666,  -379,   203,   -99,    43,   -16,     4,    -1,
+     8306, -3355,  1853, -1097,   648,  -369,   197,   -97,    42,   -15,     4,    -1,
+     8039, -3261,  1802, -1067,   630,  -359,   192,   -94,    41,   -15,     4,    -1,
+     7773, -3166,  1751, -1037,   612,  -349,   186,   -91,    39,   -14,     4,     0,
+     7509, -3070,  1700, -1006,   594,  -338,   181,   -88,    38,   -14,     4,     0,
+     7245, -2974,  1648,  -976,   576,  -328,   175,   -85,    37,   -13,     4,     0,
+     6983, -2877,  1596,  -945,   558,  -317,   169,   -83,    36,   -13,     3,     0,
+     6723, -2781,  1543,  -914,   540,  -307,   164,   -80,    34,   -12,     3,     0,
+     6464, -2684,  1491,  -883,   521,  -296,   158,   -77,    33,   -12,     3,     0,
+     6206, -2586,  1438,  -852,   503,  -286,   152,   -74,    32,   -11,     3,     0,
+     5951, -2489,  1385,  -820,   484,  -275,   146,   -71,    31,   -11,     3,     0,
+     5696, -2391,  1331,  -789,   466,  -264,   141,   -68,    29,   -11,     3,     0,
+     5444, -2294,  1278,  -757,   447,  -254,   135,   -66,    28,   -10,     3,     0,
+     5193, -2196,  1224,  -726,   428,  -243,   129,   -63,    27,   -10,     3,     0,
+     4944, -2098,  1170,  -694,   409,  -232,   123,   -60,    26,    -9,     2,     0,
+     4697, -2000,  1117,  -662,   390,  -221,   118,   -57,    24,    -9,     2,     0,
+     4452, -1902,  1063,  -630,   372,  -211,   112,   -54,    23,    -8,     2,     0,
+     4208, -1804,  1009,  -598,   353,  -200,   106,   -51,    22,    -8,     2,     0,
+     3967, -1706,   955,  -566,   334,  -189,   100,   -49,    21,    -7,     2,     0,
+     3727, -1608,   901,  -534,   315,  -178,    95,   -46,    19,    -7,     2,     0,
+     3490, -1511,   847,  -502,   296,  -168,    89,   -43,    18,    -6,     2,     0,
+     3255, -1414,   793,  -470,   277,  -157,    83,   -40,    17,    -6,     2,     0,
+     3021, -1316,   739,  -438,   258,  -146,    77,   -37,    16,    -6,     1,     0,
+     2790, -1220,   685,  -406,   239,  -135,    72,   -35,    15,    -5,     1,     0,
+     2561, -1123,   631,  -375,   221,  -125,    66,   -32,    13,    -5,     1,     0,
+     2335, -1027,   577,  -343,   202,  -114,    60,   -29,    12,    -4,     1,     0,
+     2110,  -931,   524,  -311,   183,  -103,    55,   -26,    11,    -4,     1,     0,
+     1888,  -836,   471,  -279,   164,   -93,    49,   -24,    10,    -3,     1,     0,
+     1669,  -741,   417,  -248,   146,   -82,    43,   -21,     9,    -3,     1,     0,
+     1451,  -646,   364,  -216,   127,   -72,    38,   -18,     8,    -3,     1,     0,
+     1237,  -552,   311,  -185,   109,   -61,    32,   -16,     7,    -2,     1,     0,
+     1024,  -459,   259,  -154,    90,   -51,    27,   -13,     5,    -2,     0,     0,
+      814,  -366,   207,  -123,    72,   -41,    21,   -10,     4,    -1,     0,     0,
+      607,  -273,   154,   -92,    54,   -30,    16,    -8,     3,    -1,     0,     0,
+      402,  -181,   103,   -61,    36,   -20,    11,    -5,     2,    -1,     0,     0,
+      200,   -90,    51,   -30,    18,   -10,     5,    -3,     1,     0,     0,     0,
+        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_three_int16.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,275 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_one_to_three_int16.h"
+#include "resampler_clip.h"
+#include "resampler_sinc_conv_one_to_three_tables_standard.h"
+
+#include <string.h>
+
+#include "resampler_sinc_conv_one_to_three_int16.inl"
+
+static const int LC_ZERO_CROSSINGS = RESAMPLER_ONE_TO_THREE_ZERO_CROSSINGS_STANDARD;
+static const int LC_MOD3[6] = { 0, 1, 2, 0, 1, 2 };
+
+
+RESAMPLER_SincConvOneToThreeInt16::RESAMPLER_SincConvOneToThreeInt16(int channelCount) :
+m_memBuffers(0),
+m_scratchBuffer(0),
+m_filter1(RESAMPLER_ONE_TO_THREE_FILTER1_STANDARD),
+m_filter2(RESAMPLER_ONE_TO_THREE_FILTER2_STANDARD),
+m_channelCount(channelCount),
+m_blockSize(0),
+m_channelEnabled(0),
+m_inputSamples(0),
+m_state(2)
+{
+}
+
+
+RESAMPLER_SincConvOneToThreeInt16::~RESAMPLER_SincConvOneToThreeInt16()
+{
+    DeInit();
+}
+
+
+bool RESAMPLER_SincConvOneToThreeInt16::InitInputDriven()
+{
+    return Init();
+}
+
+
+bool RESAMPLER_SincConvOneToThreeInt16::InitOutputDriven()
+{
+    return Init();
+}
+
+
+/*
+*   This function must be called before using the converter.
+*   This function reserves memory for ring buffers and 
+*   prepares the ring buffer indexing.
+*/
+bool RESAMPLER_SincConvOneToThreeInt16::Init()
+{
+    int i(0);
+
+    m_memBuffers = new int16 *[m_channelCount];
+    if (!m_memBuffers)
+    {
+        return false;
+    }
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = 0;
+    }
+
+    m_channelEnabled = new bool[m_channelCount];
+    if (!m_channelEnabled)
+    {
+        DeInit();
+        return false;
+    }
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_channelEnabled[i] = true;
+    }
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = new int16[LC_ZERO_CROSSINGS * 2];
+        if (!m_memBuffers[i])
+        {
+            DeInit();
+            return false;
+        }
+        memset(m_memBuffers[i], 0, sizeof(int16) * (LC_ZERO_CROSSINGS * 2));
+    }
+
+    return true;
+}
+
+
+void RESAMPLER_SincConvOneToThreeInt16::DeInit()
+{
+    if (m_channelCount)
+    {
+        for (int i = 0; i < m_channelCount; i++)
+        {
+            delete [] m_memBuffers[i];
+        }
+        delete [] m_memBuffers;
+        delete [] m_channelEnabled;
+    }
+}
+
+
+void RESAMPLER_SincConvOneToThreeInt16::EnableChannel(int channel)
+{
+    m_channelEnabled[channel] = true;
+}
+
+
+void RESAMPLER_SincConvOneToThreeInt16::DisableChannel(int channel)
+{
+    m_channelEnabled[channel] = false;
+}
+
+
+int RESAMPLER_SincConvOneToThreeInt16::MaxOutputSampleCount(int inSamples) const
+{ 
+    return 3*inSamples; 
+}
+
+
+int RESAMPLER_SincConvOneToThreeInt16::ProcessFromInput(int16 *outputBuffers[], 
+                                                  int16 *inputBuffers[], 
+                                                  int inSamples)
+{
+    int outSamples(3 * inSamples);
+    m_inputSamples = inSamples;
+    return ProcessToOutput(outputBuffers, inputBuffers, outSamples);
+}
+
+
+size_t 
+RESAMPLER_SincConvOneToThreeInt16::ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const
+{
+    return ScratchMemoryNeedInputDriven((maxOutputBlockSize + 2) / 3);
+}
+
+
+void 
+RESAMPLER_SincConvOneToThreeInt16::SetScratchBufferOutputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+size_t 
+RESAMPLER_SincConvOneToThreeInt16::ScratchMemoryNeedInputDriven(int maxInputBlockSize) const
+{
+    return sizeof(int16) * (LC_ZERO_CROSSINGS * 2 + maxInputBlockSize);
+}
+
+
+void 
+RESAMPLER_SincConvOneToThreeInt16::SetScratchBufferInputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+
+int RESAMPLER_SincConvOneToThreeInt16::MaxInputSampleCount(int outSamples) const
+{ 
+    return (outSamples + 2) / 3; 
+}
+
+
+/*
+*   This function returns the value, which is given as
+*   a parameter to the nextSamplesOut() function. This
+*   function must be called every time before calling
+*   nextSamplesOut.
+*/
+int RESAMPLER_SincConvOneToThreeInt16::InSamplesNeeded(int outSamples)
+{
+    m_inputSamples = (outSamples + LC_MOD3[4 - m_state]) / 3;
+
+    return m_inputSamples;      
+}
+
+
+int RESAMPLER_SincConvOneToThreeInt16::ProcessToOutput(int16 *outputBuffers[], 
+                                                 int16 *inputBuffers[], 
+                                                 int outSamples)
+{
+    static const int FILTER_LENGTH = 2 * LC_ZERO_CROSSINGS;
+    int i, j, k;
+    int bufReadHead1 = LC_ZERO_CROSSINGS + 1 - (m_state != 2 ? 1 : 0);
+    int bufReadHead2 = LC_ZERO_CROSSINGS;
+    int bufReadHead3 = LC_ZERO_CROSSINGS - (m_state == 1 ? 1 : 0);
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        if (!m_channelEnabled[i])
+        {
+            break;
+        }
+
+        int16 *tempBuf = m_scratchBuffer;
+        int16 *outBuf  = outputBuffers[i];
+
+        memcpy(m_scratchBuffer, m_memBuffers[i], FILTER_LENGTH * sizeof(int16));
+
+        memcpy(tempBuf + FILTER_LENGTH, 
+               inputBuffers[i], 
+               m_inputSamples * sizeof(int16));
+
+        // copy samples into every third index of output buffer.
+        tempBuf = m_scratchBuffer + bufReadHead1;
+        for (j = 0, k = m_state; k < outSamples; j++, k+=3)
+        {
+            outBuf[k] = tempBuf[j];
+        }
+        
+        // Do band limited interpolation and set the result into 
+        // every third index in the output buffer. 
+        tempBuf = m_scratchBuffer + bufReadHead2;
+        for (j = 0, k = LC_MOD3[m_state+1]; k < outSamples; j++, k += 3) 
+        {
+            int32 newSample(0);
+             // Note that the filters are reversed
+            newSample = 
+                RESAMPLER_SincConvOneToThreeFilterInt16(tempBuf + j + 1,
+                                                  m_filter2,
+                                                  m_filter1,
+                                                  LC_ZERO_CROSSINGS);
+            // round and shift down 
+            outBuf[k] = (int16)RESAMPLER_Clip16((newSample + 16384) >> 15);
+        }
+       
+        // Do band limited interpolation and set the result into 
+        // every third index in the output buffer. 
+        tempBuf = m_scratchBuffer + bufReadHead3;
+        for (j = 0, k = LC_MOD3[m_state+2]; k < outSamples; j++, k += 3) 
+        {
+            int32 newSample(0);
+            newSample = 
+                RESAMPLER_SincConvOneToThreeFilterInt16(tempBuf + j + 1,
+                                                  m_filter1,
+                                                  m_filter2,
+                                                  LC_ZERO_CROSSINGS);
+            // round and shift down 
+            outBuf[k] = (int16)RESAMPLER_Clip16((newSample + 16384) >> 15);
+        }
+
+        // Copy the newest samples to the beginning of the buffer
+        memcpy(m_memBuffers[i], 
+               m_scratchBuffer + m_inputSamples, 
+               FILTER_LENGTH * sizeof(int16));       
+    }    
+
+    // Update state according to amount of output samples.
+    m_state = LC_MOD3[m_state + (3 - (outSamples % 3))];
+
+    return outSamples;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_three_int16.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,48 @@
+#ifndef __RESAMPLER_SINC_CONV_ONE_TO_THREE_INT16_INL__
+#define __RESAMPLER_SINC_CONV_ONE_TO_THREE_INT16_INL__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_common_defs.h"
+#include "resampler_data_types.h"
+
+static FORCEINLINE int32 
+RESAMPLER_SincConvOneToThreeFilterInt16(const int16 *signalBuf, 
+                                  const int16 *filterPtr1,
+                                  const int16 *filterPtr2,
+                                  int length)
+{
+    int32 newSample = 0;
+    const int16 *bufferPtr1 = signalBuf;
+    const int16 *bufferPtr2 = signalBuf - 1;
+
+    (void)length;
+    for (int l = length; l > 0; l-=4)
+    {
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1++) + (int32)(*filterPtr2++) * (*bufferPtr2--);
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1++) + (int32)(*filterPtr2++) * (*bufferPtr2--);
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1++) + (int32)(*filterPtr2++) * (*bufferPtr2--);
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1++) + (int32)(*filterPtr2++) * (*bufferPtr2--);
+    }
+
+    return newSample;
+}
+
+
+#endif /* __RESAMPLER_SINC_CONV_ONE_TO_THREE_INT16_INL__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_three_tables_standard.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_one_to_three_tables_standard.h"
+
+const int16 RESAMPLER_ONE_TO_THREE_FILTER1_STANDARD[RESAMPLER_ONE_TO_THREE_ZERO_CROSSINGS_STANDARD] = 
+{ 27074, -6676, 3701, -2471, 1782, -1332, 1013, -774, 589, -444, 329, -238, 167, -113, 71, -41 };
+
+const int16 RESAMPLER_ONE_TO_THREE_FILTER2_STANDARD[RESAMPLER_ONE_TO_THREE_ZERO_CROSSINGS_STANDARD] = 
+{ 13500, -5297, 3194, -2203, 1612, -1215, 926, -707, 537, -403, 296, -213, 148, -97, 60, -33 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_two_int16.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,262 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_one_to_two_int16.h"
+#include "resampler_clip.h"
+#include "resampler_sinc_conv_one_to_two_tables_standard.h"
+
+#include <string.h>
+
+#include "resampler_sinc_conv_one_to_two_int16.inl"
+
+static const int LC_ZERO_CROSSINGS = RESAMPLER_ONE_TO_TWO_ZERO_CROSSINGS_STANDARD; /* Needs to be divisible by two */
+
+
+RESAMPLER_SincConvOneToTwoInt16::RESAMPLER_SincConvOneToTwoInt16(int channelCount) :
+m_memBuffers(0),
+m_scratchBuffer(0),
+m_filter(RESAMPLER_ONE_TO_TWO_FILTERS_STANDARD),
+m_channelCount(channelCount),
+m_blockSize(0),
+m_channelEnabled(0),
+m_state(0)
+{
+}
+
+
+RESAMPLER_SincConvOneToTwoInt16::~RESAMPLER_SincConvOneToTwoInt16()
+{
+    DeInit();
+}
+
+
+bool RESAMPLER_SincConvOneToTwoInt16::InitInputDriven()
+{
+    return Init();
+}
+
+
+bool RESAMPLER_SincConvOneToTwoInt16::InitOutputDriven()
+{
+    return Init();
+}
+
+
+bool RESAMPLER_SincConvOneToTwoInt16::Init()
+{
+    int i(0);
+  
+    m_memBuffers = new int16 *[m_channelCount];
+    if (!m_memBuffers)
+    {
+        return false;
+    }
+    
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = 0;
+    }
+
+    m_channelCount = m_channelCount;  
+    
+    m_channelEnabled = new bool[m_channelCount];
+    if (!m_channelEnabled)
+    {
+        DeInit();
+        return false;
+    }
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_channelEnabled[i] = true;
+    }
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = new int16[LC_ZERO_CROSSINGS * 2];
+        if (!m_memBuffers[i])
+        {
+            DeInit();
+            return false;
+        }
+        memset(m_memBuffers[i], 0, sizeof(int16) * (LC_ZERO_CROSSINGS * 2));
+    }
+
+    return true;
+}
+
+
+void RESAMPLER_SincConvOneToTwoInt16::DeInit()
+{
+    if (m_channelCount)
+    {
+        for (int i = 0; i < m_channelCount; i++)
+        {
+            delete [] m_memBuffers[i];
+        }
+        delete [] m_memBuffers;
+        delete [] m_channelEnabled;
+    }
+}
+
+
+void RESAMPLER_SincConvOneToTwoInt16::EnableChannel(int channel)
+{
+    m_channelEnabled[channel] = true;
+}
+
+
+void RESAMPLER_SincConvOneToTwoInt16::DisableChannel(int channel)
+{
+    m_channelEnabled[channel] = false;
+}
+
+
+size_t 
+RESAMPLER_SincConvOneToTwoInt16::ScratchMemoryNeedInputDriven(int maxInputBlockSize) const
+{
+    return sizeof(int16) * (LC_ZERO_CROSSINGS * 2 + maxInputBlockSize);
+}
+
+
+void 
+RESAMPLER_SincConvOneToTwoInt16::SetScratchBufferInputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+
+int RESAMPLER_SincConvOneToTwoInt16::MaxOutputSampleCount(int inSamples) const 
+{ 
+    return 2 * inSamples; 
+}
+
+
+int RESAMPLER_SincConvOneToTwoInt16::ProcessFromInput(int16 *outputBuffers[], 
+                                                int16 *inputBuffers[], 
+                                                int inSamples)
+{
+    int outSamples(2 * inSamples + m_state);
+    return ProcessToOutput(outputBuffers, inputBuffers, outSamples);
+}
+
+
+size_t 
+RESAMPLER_SincConvOneToTwoInt16::ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const
+{
+    return ScratchMemoryNeedInputDriven((maxOutputBlockSize + 1) >> 1);
+}
+
+
+void 
+RESAMPLER_SincConvOneToTwoInt16::SetScratchBufferOutputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+
+int RESAMPLER_SincConvOneToTwoInt16::MaxInputSampleCount(int outSamples) const 
+{ 
+    return (outSamples + 1) >> 1; 
+}
+
+
+int RESAMPLER_SincConvOneToTwoInt16::InSamplesNeeded(int outSamples)
+{
+    int inSamples( (outSamples >> 1) + (outSamples & 1) * (1 - m_state) );
+    
+    return inSamples;       
+}
+
+
+int RESAMPLER_SincConvOneToTwoInt16::ProcessToOutput(int16 *outputBuffers[], 
+                                               int16 *inputBuffers[], 
+                                               int outSamples)
+{
+    static const int FILTER_LENGTH = 2 * LC_ZERO_CROSSINGS;
+
+    int i, j, k;
+    int oldState = m_state;
+    int newState = (oldState + outSamples) & 1;
+    
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        if (!m_channelEnabled[i])
+        {
+            break;
+        }
+
+        int16 *tempBuf     = m_scratchBuffer;
+        const int16 *inBuf = inputBuffers[i];
+        int16 *outBuf      = outputBuffers[i];
+
+        memcpy(m_scratchBuffer, m_memBuffers[i], FILTER_LENGTH * sizeof(int16));
+
+        // Read samples into the memory buffer and 
+        // copy samples into every second index of output buffer.
+        for (j = 0, k = oldState; k < outSamples; j++, k+=2)
+        {
+            int16 inputSample(inBuf[j]);
+            tempBuf[j + FILTER_LENGTH - 1 + oldState] = inputSample;
+            outBuf[k] = tempBuf[j + LC_ZERO_CROSSINGS - 1 + oldState];
+        }
+        int inSamples = j;
+        
+        // Do band-limited interpolation and set the result into 
+        // every second index in the output buffer. 
+#ifdef RESAMPLER_SINC_CONV_ONE_TO_TWO_DUAL_FILTERING
+        for (j = 0, k = 1 - oldState; k < outSamples; j+=2, k+=4) 
+        {
+            int newSample1(0);
+            int newSample2(0);
+
+            RESAMPLER_SincConvOneToTwoFilterDualInt16(newSample1,
+                                                newSample2,
+                                                tempBuf + LC_ZERO_CROSSINGS + j,
+                                                m_filter,
+                                                LC_ZERO_CROSSINGS);
+            // Round, shift down, and clip to 16 bits
+            outBuf[k] = (int16)RESAMPLER_Clip16((newSample1 + 16384) >> 15);
+            if (k + 2 < outSamples)
+            {
+                outBuf[k+2] = (int16)RESAMPLER_Clip16((newSample2 + 16384) >> 15);
+            }
+        }
+#else
+        for (j = 0, k = 1 - oldState; k < outSamples; j++, k+=2) 
+        {
+            int32 newSample = 
+                RESAMPLER_SincConvOneToTwoFilterInt16(tempBuf + LC_ZERO_CROSSINGS + j,
+                                                m_filter,
+                                                LC_ZERO_CROSSINGS);
+            // Round, shift down, and clip to 16 bits
+            outBuf[k] = (int16)RESAMPLER_Clip16((newSample + 16384) >> 15);
+        }
+#endif
+
+        // Copy the newest samples to the beginning of the buffer
+        memcpy(m_memBuffers[i], 
+               tempBuf + inSamples + oldState - newState, 
+               (FILTER_LENGTH - 1 + newState) * sizeof(int16));
+    }
+    
+    // Update state according to even or odd amount of output samples.
+    m_state = newState;
+    
+    return outSamples;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_two_int16.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,57 @@
+#ifndef __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__
+#define __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_common_defs.h"
+#include "resampler_data_types.h"
+
+
+
+/* Note! This version assumes the number of filter coefficients is 
+ * divisible by four.
+ */
+static FORCEINLINE int32 
+RESAMPLER_SincConvOneToTwoFilterInt16(const int16 *signalBuf, 
+                                const int16 *coeffBuf,
+                                int length)
+{
+    int32 newSample = 0;
+    const int16 *bufferPtr1 = signalBuf;
+    const int16 *bufferPtr2 = signalBuf - 1;
+
+    (void)length;
+    // Calculate the filter. 
+    // Keep newSample in s1.30 format to reduce rounding errors
+    for (int k = length; k>0; k-=4)
+    {
+        newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
+        newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
+        newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
+        newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
+        newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
+        newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
+        newSample += (int32)(*coeffBuf  ) * (*bufferPtr1++);
+        newSample += (int32)(*coeffBuf++) * (*bufferPtr2--);
+    }
+
+    return newSample;
+}
+
+#endif /* __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_one_to_two_tables_standard.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_one_to_two_tables_standard.h"
+
+const int16 RESAMPLER_ONE_TO_TWO_FILTERS_STANDARD[RESAMPLER_ONE_TO_TWO_ZERO_CROSSINGS_STANDARD] = 
+{ 20818, -6826, 3962, -2691, 1956, -1469, 1118, -854, 650, -488, 361, -260, 182, -121, 76, -43 };
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_three_to_one_int16.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_three_to_one_int16.h"
+#include "resampler_clip.h"
+#include "resampler_sinc_conv_three_to_one_tables_standard.h"
+#include "resampler_sinc_conv_filter_three_to_one_int16.h"
+
+
+#include <string.h>
+
+/*
+ * The amount of zero crossings in positive or negative
+ * side of the sinc function. Because of filter symmetry
+ * the amount of filter taps used in convolution is
+ * zero crossings * 2.
+ */
+static const int LC_MAX_COEFF_COUNT = RESAMPLER_THREE_TO_ONE_COEFF_COUNT_STANDARD;
+
+static const int LC_BUFFER_ACCESS_OUTPUT = LC_MAX_COEFF_COUNT - 1;
+
+
+RESAMPLER_SincConvThreeToOneInt16::RESAMPLER_SincConvThreeToOneInt16(int channelCount) :
+m_memBuffers(0),
+m_scratchBuffer(0),
+m_channelCount(channelCount),
+m_blockSize(0),
+m_channelEnabled(0),
+m_state(0),
+m_coeffCount(RESAMPLER_THREE_TO_ONE_COEFF_COUNT_STANDARD),
+m_filterMatrix(RESAMPLER_THREE_TO_ONE_FILTERS_STANDARD)
+{
+}
+
+
+RESAMPLER_SincConvThreeToOneInt16::~RESAMPLER_SincConvThreeToOneInt16()
+{
+    DeInit();
+}
+
+bool RESAMPLER_SincConvThreeToOneInt16::InitInputDriven()
+{
+    return Init();
+}
+
+bool RESAMPLER_SincConvThreeToOneInt16::InitOutputDriven()
+{
+    return Init();
+}
+
+bool 
+RESAMPLER_SincConvThreeToOneInt16::Init()
+{
+    int i(0);
+
+    m_memBuffers = new int16 *[m_channelCount];
+    if (!m_memBuffers)
+    {
+        return false;
+    }
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = 0;
+    }
+
+    m_channelEnabled = new bool[m_channelCount];
+    if (!m_channelEnabled)
+    {
+        DeInit();
+        return false;
+    }
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_channelEnabled[i] = true;
+    }
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = new int16[LC_MAX_COEFF_COUNT * 2 - 1];
+        if (!m_memBuffers[i])
+        {
+            DeInit();
+            return false;
+        }
+        memset(m_memBuffers[i], 0, sizeof(int16) * (LC_MAX_COEFF_COUNT * 2 - 1));
+    }
+
+    return true;
+}
+
+void 
+RESAMPLER_SincConvThreeToOneInt16::DeInit()
+{
+    if (m_channelCount)
+    {
+        for (int i = 0; i < m_channelCount; i++)
+        {
+            delete [] m_memBuffers[i];
+        }
+        delete [] m_memBuffers;
+        delete [] m_channelEnabled;
+    }
+}
+
+
+void 
+RESAMPLER_SincConvThreeToOneInt16::EnableChannel(int channel)
+{
+    m_channelEnabled[channel] = true;
+}
+
+void 
+RESAMPLER_SincConvThreeToOneInt16::DisableChannel(int channel)
+{
+    m_channelEnabled[channel] = false;
+}
+
+size_t 
+RESAMPLER_SincConvThreeToOneInt16::ScratchMemoryNeedInputDriven(int maxInputBlockSize) const
+{
+    return sizeof(int16) * ((LC_MAX_COEFF_COUNT * 2 - 1) + maxInputBlockSize);
+}
+
+void 
+RESAMPLER_SincConvThreeToOneInt16::SetScratchBufferInputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+size_t 
+RESAMPLER_SincConvThreeToOneInt16::ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const
+{
+    int blockSize = 3 * maxOutputBlockSize; 
+    
+    return ScratchMemoryNeedInputDriven(blockSize);
+}
+
+void 
+RESAMPLER_SincConvThreeToOneInt16::SetScratchBufferOutputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+
+int 
+RESAMPLER_SincConvThreeToOneInt16::MaxOutputSampleCount(int inSamples) const 
+{ 
+    return ( inSamples + 2 ) / 3; 
+}
+
+int 
+RESAMPLER_SincConvThreeToOneInt16::MaxInputSampleCount(int outSamples) const
+{ 
+    return 3 * outSamples; 
+}
+
+
+int 
+RESAMPLER_SincConvThreeToOneInt16::InSamplesNeeded(int outSamples)
+{
+    return 3 * outSamples;
+}
+
+
+int 
+RESAMPLER_SincConvThreeToOneInt16::ProcessToOutput(int16 *outputBuffers[], 
+                                             int16 *inputBuffers[], 
+                                             int outSamples)
+{
+    int inSamples( 3 * outSamples );
+    
+    return ProcessFromInput(outputBuffers, inputBuffers, inSamples);
+}
+
+int 
+RESAMPLER_SincConvThreeToOneInt16::ProcessFromInput(int16 *outputBuffers[], 
+                                              int16 *inputBuffers[], 
+                                              int inSamples)
+{
+    static const int FILTER_LENGTH = LC_MAX_COEFF_COUNT * 2 - 1;
+	int i, j;
+    int state = m_state;
+	int outSamples = (inSamples + state) / 3;
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        if (!m_channelEnabled[i])
+        {
+            break;
+        }
+
+        int16 *tempBuf = m_scratchBuffer;
+        int16 *outBuf  = outputBuffers[i];
+        state = m_state;
+        
+        memcpy(m_scratchBuffer, 
+               m_memBuffers[i], 
+               FILTER_LENGTH * sizeof(int16));
+
+        // Read samples into memory
+        memcpy(tempBuf + FILTER_LENGTH, 
+               inputBuffers[i], 
+               inSamples * sizeof(int16));
+
+        tempBuf += LC_BUFFER_ACCESS_OUTPUT - state;
+
+        for (j = 0; j < outSamples; j++) 
+        {
+            int32 newSample = 
+                RESAMPLER_SincConvFilterThreeToOneInt16(tempBuf,
+									              m_filterMatrix,
+												  m_coeffCount);
+            tempBuf += 3;
+
+            // round and shift down
+	        outBuf[j] = (int16)RESAMPLER_Clip16((newSample + 16384 ) >> 15);
+		}
+        
+        // Copy the newest samples to the beginning of the buffer
+        memcpy(m_memBuffers[i], 
+               m_scratchBuffer + inSamples, 
+               FILTER_LENGTH * sizeof(int16));       
+    }
+
+    m_state = (state + inSamples) % 3;
+
+	return outSamples;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_three_to_one_tables_standard.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_three_to_one_tables_standard.h"
+
+
+const int16 RESAMPLER_THREE_TO_ONE_FILTERS_STANDARD[ RESAMPLER_THREE_TO_ONE_COEFF_COUNT_STANDARD ] =
+{
+     9829,  8430,  4942,  1066, -1512, -2041,  -991,   441,  1173,   874,
+        0,  -691,  -730,  -214,   369,   572,   306,  -147,  -415,  -323,
+        0,   272,   293,    87,  -153,  -238,  -128,    62,   173,   135,
+        0,  -112,  -119,   -35,    61,    93,    49,   -23,   -64,   -49,
+        0,    39,    40,    11,   -19,   -28,   -14,     6,    17,    12,
+        0,    -8,    -8,    -2,     3,     4,     2
+};          
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_two_to_one_int16.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_two_to_one_int16.h"
+#include "resampler_clip.h"
+#include "resampler_sinc_conv_two_to_one_tables_standard.h"
+#include "resampler_sinc_conv_filter_two_to_one_int16.h"
+
+#include <string.h>
+
+/*
+ * The amount of zero crossings in positive or negative
+ * side of the sinc function. Because of filter symmetry
+ * the amount of filter taps used in convolution is
+ * zero crossings * 2.
+ */
+static const int LC_MAX_ZERO_CROSSINGS = RESAMPLER_TWO_TO_ONE_ZERO_CROSSINGS_STANDARD;
+
+static const int LC_BUFFER_ACCESS_OUTPUT = 2 * LC_MAX_ZERO_CROSSINGS;
+
+
+RESAMPLER_SincConvTwoToOneInt16::RESAMPLER_SincConvTwoToOneInt16(int channelCount) :
+m_memBuffers(0),
+m_scratchBuffer(0),
+m_channelCount(channelCount),
+m_blockSize(0),
+m_channelEnabled(0),
+m_state(0),
+m_zeroCrossings(RESAMPLER_TWO_TO_ONE_ZERO_CROSSINGS_STANDARD),
+m_filterMatrix(RESAMPLER_TWO_TO_ONE_FILTERS_STANDARD)
+{
+}
+
+
+RESAMPLER_SincConvTwoToOneInt16::~RESAMPLER_SincConvTwoToOneInt16()
+{
+    DeInit();
+}
+
+bool RESAMPLER_SincConvTwoToOneInt16::InitInputDriven()
+{
+    return Init();
+}
+
+bool RESAMPLER_SincConvTwoToOneInt16::InitOutputDriven()
+{
+    return Init();
+}
+
+bool 
+RESAMPLER_SincConvTwoToOneInt16::Init()
+{
+    int i(0);
+
+    m_memBuffers = new int16 *[m_channelCount];
+    if (!m_memBuffers)
+    {
+        return false;
+    }
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = 0;
+    }
+
+    m_channelEnabled = new bool[m_channelCount];
+    if (!m_channelEnabled)
+    {
+        DeInit();
+        return false;
+    }
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_channelEnabled[i] = true;
+    }
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = new int16[LC_MAX_ZERO_CROSSINGS * 4];
+        if (!m_memBuffers[i])
+        {
+            DeInit();
+            return false;
+        }
+        memset(m_memBuffers[i], 0, sizeof(int16) * (LC_MAX_ZERO_CROSSINGS * 4));
+    }
+
+    return true;
+}
+
+void 
+RESAMPLER_SincConvTwoToOneInt16::DeInit()
+{
+    if (m_channelCount)
+    {
+        for (int i = 0; i < m_channelCount; i++)
+        {
+            delete [] m_memBuffers[i];
+        }
+        delete [] m_memBuffers;
+        delete [] m_channelEnabled;
+    }
+}
+
+
+void 
+RESAMPLER_SincConvTwoToOneInt16::EnableChannel(int channel)
+{
+    m_channelEnabled[channel] = true;
+}
+
+void 
+RESAMPLER_SincConvTwoToOneInt16::DisableChannel(int channel)
+{
+    m_channelEnabled[channel] = false;
+}
+
+size_t 
+RESAMPLER_SincConvTwoToOneInt16::ScratchMemoryNeedInputDriven(int maxInputBlockSize) const
+{
+    return sizeof(int16) * (LC_MAX_ZERO_CROSSINGS * 4 + maxInputBlockSize);
+}
+
+void 
+RESAMPLER_SincConvTwoToOneInt16::SetScratchBufferInputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+size_t 
+RESAMPLER_SincConvTwoToOneInt16::ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const
+{
+    int blockSize = 2 * maxOutputBlockSize; 
+    
+    return ScratchMemoryNeedInputDriven(blockSize);
+}
+
+void 
+RESAMPLER_SincConvTwoToOneInt16::SetScratchBufferOutputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+
+int 
+RESAMPLER_SincConvTwoToOneInt16::MaxOutputSampleCount(int inSamples) const 
+{ 
+    return ( inSamples + 1 ) / 2; 
+}
+
+int 
+RESAMPLER_SincConvTwoToOneInt16::MaxInputSampleCount(int outSamples) const
+{ 
+    return 2 * outSamples; 
+}
+
+
+int 
+RESAMPLER_SincConvTwoToOneInt16::InSamplesNeeded(int outSamples)
+{
+    return 2 * outSamples;
+}
+
+
+int 
+RESAMPLER_SincConvTwoToOneInt16::ProcessToOutput(int16 *outputBuffers[], 
+                                           int16 *inputBuffers[], 
+                                           int outSamples)
+{
+    int inSamples( 2 * outSamples );
+    
+    return ProcessFromInput(outputBuffers, inputBuffers, inSamples);
+}
+
+
+int 
+RESAMPLER_SincConvTwoToOneInt16::ProcessFromInput(int16 *outputBuffers[], 
+                                            int16 *inputBuffers[], 
+                                            int inSamples)
+{
+    static const int FILTER_LENGTH = 4 * LC_MAX_ZERO_CROSSINGS;
+	int i, j;
+    int state = m_state;
+	int outSamples = (inSamples + state) >> 1;
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        if (!m_channelEnabled[i])
+        {
+            break;
+        }
+
+        int16 *tempBuf = m_scratchBuffer;
+        int16 *outBuf  = outputBuffers[i];
+        state = m_state;
+        
+        memcpy(m_scratchBuffer, 
+               m_memBuffers[i], 
+               FILTER_LENGTH * sizeof(int16));
+
+        // Read samples into memory
+        memcpy(tempBuf + FILTER_LENGTH, 
+               inputBuffers[i], 
+               inSamples * sizeof(int16));
+
+        tempBuf += LC_BUFFER_ACCESS_OUTPUT - state;
+
+        for (j = 0; j < outSamples; j++) 
+        {
+            int32 newSample = 
+                RESAMPLER_SincConvFilterTwoToOneInt16(tempBuf,
+												m_filterMatrix,
+												m_zeroCrossings);
+            tempBuf += 2;
+
+            // round and shift down
+	        outBuf[j] = (int16)RESAMPLER_Clip16((newSample + 16384 ) >> 15);
+		}
+        
+        // Copy the newest samples to the beginning of the buffer
+        memcpy(m_memBuffers[i], 
+               m_scratchBuffer + inSamples, 
+               FILTER_LENGTH * sizeof(int16));       
+    }
+
+    m_state = (state + inSamples) & 1;
+
+	return outSamples;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_two_to_one_tables_standard.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_two_to_one_tables_standard.h"
+
+const int16 RESAMPLER_TWO_TO_ONE_FILTERS_STANDARD[RESAMPLER_TWO_TO_ONE_ZERO_CROSSINGS_STANDARD] = 
+{
+	10401, -3390,  1944, -1297,   920,  -669,   490,  -357,   257,  -180,   123,   -80,    50,   -28,    14,    -5
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_two_to_three_int16.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,278 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_two_to_three_int16.h"
+#include "resampler_clip.h"
+#include "resampler_sinc_conv_two_to_three_tables_standard.h"
+
+#include "resampler_sinc_conv_two_to_three_int16.inl"
+
+
+#include <string.h>
+
+
+static const int LC_ZERO_CROSSINGS = RESAMPLER_TWO_TO_THREE_ZERO_CROSSINGS_STANDARD;
+static const int LC_MOD3[6] = { 0, 1, 2, 0, 1, 2 };
+
+
+RESAMPLER_SincConvTwoToThreeInt16::RESAMPLER_SincConvTwoToThreeInt16(int channelCount) :
+m_memBuffers(0),
+m_scratchBuffer(0),
+m_filter1(RESAMPLER_TWO_TO_THREE_FILTER1_STANDARD),
+m_filter2(RESAMPLER_TWO_TO_THREE_FILTER2_STANDARD),
+m_channelCount(channelCount),
+m_blockSize(0),
+m_channelEnabled(0),
+m_inputSamples(0),
+m_state(2)
+{
+}
+
+
+RESAMPLER_SincConvTwoToThreeInt16::~RESAMPLER_SincConvTwoToThreeInt16()
+{
+    DeInit();
+}
+
+
+bool RESAMPLER_SincConvTwoToThreeInt16::InitInputDriven()
+{
+    return Init();
+}
+
+
+bool RESAMPLER_SincConvTwoToThreeInt16::InitOutputDriven()
+{
+    return Init();
+}
+
+
+/*
+*   This function must be called before using the converter.
+*   This function reserves memory for ring buffers and 
+*   prepares the ring buffer indexing.
+*/
+bool RESAMPLER_SincConvTwoToThreeInt16::Init()
+{
+    int i = 0;
+
+    m_memBuffers = new int16 *[m_channelCount];
+    if (!m_memBuffers)
+    {
+        return false;
+    }
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = 0;
+    }
+
+    m_channelCount = m_channelCount;
+
+    m_channelEnabled = new bool[m_channelCount];
+    if (!m_channelEnabled)
+    {
+        DeInit();
+        return false;
+    }
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_channelEnabled[i] = true;
+    }
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        m_memBuffers[i] = new int16[LC_ZERO_CROSSINGS * 2];
+        if (!m_memBuffers[i])
+        {
+            DeInit();
+            return false;
+        }
+        memset(m_memBuffers[i], 0, sizeof(int16) * (LC_ZERO_CROSSINGS * 2));
+    }
+
+    return true;
+}
+
+
+void RESAMPLER_SincConvTwoToThreeInt16::DeInit()
+{
+    if (m_channelCount)
+    {
+        for (int i = 0; i < m_channelCount; i++)
+        {
+            delete [] m_memBuffers[i];
+        }
+        delete [] m_memBuffers;
+        delete [] m_channelEnabled;
+    }
+}
+
+
+void RESAMPLER_SincConvTwoToThreeInt16::EnableChannel(int channel)
+{
+    m_channelEnabled[channel] = true;
+}
+
+
+void RESAMPLER_SincConvTwoToThreeInt16::DisableChannel(int channel)
+{
+    m_channelEnabled[channel] = false;
+}
+
+
+int RESAMPLER_SincConvTwoToThreeInt16::MaxOutputSampleCount(int inSamples) const 
+{ 
+    return 3 * inSamples / 2 + 1; 
+}
+
+
+int RESAMPLER_SincConvTwoToThreeInt16::ProcessFromInput(int16 *outputBuffers[], 
+                                                  int16 *inputBuffers[], 
+                                                  int inSamples)
+{
+    int outSamples( (3*inSamples + 2 - m_state) / 2 );
+    m_inputSamples = inSamples;
+
+    return ProcessToOutput(outputBuffers, inputBuffers, outSamples);
+}
+
+
+size_t 
+RESAMPLER_SincConvTwoToThreeInt16::ScratchMemoryNeedOutputDriven(int maxOutputBlockSize) const
+{
+    return ScratchMemoryNeedInputDriven((2*maxOutputBlockSize + 2) / 3);
+}
+
+
+void 
+RESAMPLER_SincConvTwoToThreeInt16::SetScratchBufferOutputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+size_t 
+RESAMPLER_SincConvTwoToThreeInt16::ScratchMemoryNeedInputDriven(int maxInputBlockSize) const
+{
+    return sizeof(int16) * (LC_ZERO_CROSSINGS * 2 + maxInputBlockSize);
+}
+
+
+void 
+RESAMPLER_SincConvTwoToThreeInt16::SetScratchBufferInputDriven(char *buffer)
+{
+    m_scratchBuffer = (int16 *)buffer;
+}
+
+int RESAMPLER_SincConvTwoToThreeInt16::MaxInputSampleCount(int outSamples) const 
+{ 
+    return (2*outSamples+2)/3; 
+}
+
+    
+/*
+*   This function returns the value, which is given as
+*   a parameter to the nextSamplesOut() function. This
+*   function must be called every time before calling
+*   nextSamplesOut.
+*/
+int RESAMPLER_SincConvTwoToThreeInt16::InSamplesNeeded(int outSamples)
+{
+    m_inputSamples = (2 * outSamples + m_state) / 3;
+    return m_inputSamples;
+}
+
+
+int RESAMPLER_SincConvTwoToThreeInt16::ProcessToOutput(int16 *outputBuffers[], 
+                                                 int16 *inputBuffers[], 
+                                                 int outSamples)
+{
+    static const int FILTER_LENGTH = 2 * LC_ZERO_CROSSINGS; 
+    int i, j, k;
+    
+    int bufReadHead1 = LC_ZERO_CROSSINGS + m_state;
+    int bufReadHead2 = LC_ZERO_CROSSINGS + (m_state == 1 ? 1 : 0);
+    int bufReadHead3 = LC_ZERO_CROSSINGS + (m_state != 1 ? 1 : 0);
+
+    for (i = 0; i < m_channelCount; i++) 
+    {
+        if (!m_channelEnabled[i])
+        {
+            break;
+        }
+
+        int16 *tempBuf = m_scratchBuffer;
+        int16 *outBuf  = outputBuffers[i];
+
+        memcpy(m_scratchBuffer, m_memBuffers[i], FILTER_LENGTH * sizeof(int16));
+
+        memcpy(tempBuf + FILTER_LENGTH, 
+               inputBuffers[i], 
+               m_inputSamples * sizeof(int16));
+
+        // copy every second sample into every third index of output buffer.
+        tempBuf = m_scratchBuffer + bufReadHead1;
+        for (j = 0, k = m_state; k < outSamples; j+=2, k+=3)
+        {
+            outBuf[k] = tempBuf[j]; 
+        }
+        
+        // Do band limited interpolation and set the result into 
+        // every third index in the output buffer. 
+        tempBuf = m_scratchBuffer + bufReadHead2;
+        for (j = 0, k = LC_MOD3[m_state+1]; k < outSamples; j += 2, k += 3) 
+        {
+             // Note that the filters are reversed
+ 
+            int32 newSample = RESAMPLER_SincConvTwoToThreeFilterInt16(tempBuf + j, 
+                                                                m_filter2,
+                                                                m_filter1,
+                                                                LC_ZERO_CROSSINGS);
+
+            // round and shift down 
+            outBuf[k] = (int16)RESAMPLER_Clip16((newSample + 16384) >> 15);
+        }
+       
+        // Do band limited interpolation and set the result into 
+        // every third index in the output buffer. 
+        tempBuf = m_scratchBuffer + bufReadHead3;
+        for (j = 0, k = LC_MOD3[m_state+2]; k < outSamples; j += 2, k += 3) 
+        {
+            int32 newSample = RESAMPLER_SincConvTwoToThreeFilterInt16(tempBuf + j, 
+                                                                m_filter1,
+                                                                m_filter2,
+                                                                LC_ZERO_CROSSINGS);
+
+            // round and shift down 
+            outBuf[k] = (int16)RESAMPLER_Clip16((newSample + 16384) >> 15);
+        }
+
+        // Copy the newest samples to the beginning of the buffer
+        memcpy(m_memBuffers[i], 
+               m_scratchBuffer + m_inputSamples, 
+               FILTER_LENGTH * sizeof(int16));       
+    }    
+    
+    // Update state according to amount of output samples.
+    m_state = LC_MOD3[m_state + (3 - (outSamples % 3))];
+
+    return outSamples;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_two_to_three_int16.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,49 @@
+#ifndef __RESAMPLER_SINC_CONV_TWO_TO_THREE_INT16_INL__
+#define __RESAMPLER_SINC_CONV_TWO_TO_THREE_INT16_INL__
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_common_defs.h"
+#include "resampler_data_types.h"
+
+
+static FORCEINLINE int32 
+RESAMPLER_SincConvTwoToThreeFilterInt16(const int16 *signalBuf, 
+                                const int16 *filterPtr1,
+                                const int16 *filterPtr2,
+                                int length)
+{
+
+    int32 newSample(0);
+    const int16 *bufferPtr1 = signalBuf; 
+    const int16 *bufferPtr2 = signalBuf+1;     
+    // Calculate the filter. 
+    // Keep newSample in s1.30 format to reduce rounding errors
+    for (int l = length; l >0 ; l-=4)
+    {
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
+        newSample += (int32)(*filterPtr1++) * (*bufferPtr1--) + (int32)(*filterPtr2++) * (*bufferPtr2++);
+    }
+    return newSample;
+}
+
+
+#endif /* __RESAMPLER_SINC_CONV_ONE_TO_TWO_INT16_INL__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_sinc_conv_two_to_three_tables_standard.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_sinc_conv_two_to_three_tables_standard.h"
+
+
+const int16 RESAMPLER_TWO_TO_THREE_FILTER1_STANDARD[RESAMPLER_TWO_TO_THREE_ZERO_CROSSINGS_STANDARD] = 
+{ 27073, -6673, 3695, -2463, 1771, -1321, 1001, -761, 576, -431, 318, -228, 158, -105, 65, -37 };
+
+const int16 RESAMPLER_TWO_TO_THREE_FILTER2_STANDARD[RESAMPLER_TWO_TO_THREE_ZERO_CROSSINGS_STANDARD] = 
+{ 13498, -5293, 3187, -2194, 1602, -1203, 913, -694, 524, -390, 285, -203, 139, -91, 55, -29 };
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/Aud.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/* Copyright (C) 2004 Nokia Corporation. */
+
+#include <e32std.h>
+
+
+EXPORT_C TInt E32Dll(TDllReason)
+    {
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/AudClip.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,453 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/* Copyright (c) 2003 Nokia. All rights reserved. */
+
+#include "AudClip.h"
+#include "AudPanic.h"
+
+#include "AudClipInfo.h"
+#include "AudSong.h"
+#include "ProcTools.h"
+
+    
+CAudClip* CAudClip::NewL(CAudSong* aSong, const TDesC& aFileName,
+        TTimeIntervalMicroSeconds aStartTime,                            
+        MAudClipInfoObserver& aObserver, TInt aTrackIndex) 
+    {
+    
+    CAudClip* self = new (ELeave) CAudClip(aSong);
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileName, aStartTime, aObserver, aTrackIndex);
+    CleanupStack::Pop(self);
+    return self;
+    
+    }
+    
+CAudClip* CAudClip::NewL(CAudSong* aSong, RFile* aFileHandle,
+        TTimeIntervalMicroSeconds aStartTime,                            
+        MAudClipInfoObserver& aObserver, TInt aTrackIndex) 
+    {
+    
+    CAudClip* self = new (ELeave) CAudClip(aSong);
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileHandle, aStartTime, aObserver, aTrackIndex);
+    CleanupStack::Pop(self);
+    return self;
+    
+    }
+
+
+CAudClip::CAudClip(CAudSong* aSong) : iSong(aSong), iMute(EFalse), iNormalize(EFalse), 
+iPriority(KAudClipPriorityNormal) 
+    {
+    
+    }
+
+EXPORT_C CAudClipInfo* CAudClip::Info() const 
+    {
+
+    return iInfo;
+    }
+
+EXPORT_C TBool CAudClip::Normalizing() const 
+    {
+
+    return iNormalize;
+    }
+
+EXPORT_C TAudDynamicLevelMark CAudClip::DynamicLevelMark(TInt aIndex) const 
+    {
+
+    return *iDynamicLevelMarkArray[aIndex];
+    }
+    
+EXPORT_C TInt CAudClip::DynamicLevelMarkCount() const 
+    {
+
+    return iDynamicLevelMarkArray.Count();
+    }
+EXPORT_C TBool CAudClip::Muting() const
+    {
+    return iMute;
+    }
+
+EXPORT_C void CAudClip::SetStartTime(TTimeIntervalMicroSeconds aStartTime) 
+    {
+
+    if (iStartTime.Int64() != aStartTime.Int64()-iCutInTime.Int64()) 
+        {
+        iStartTime = aStartTime.Int64()-iCutInTime.Int64();
+        }
+        
+
+    TInt clipIndexOnSong = iSong->FindClipIndexOnSong(this);
+    TInt newIndex = 0;
+    TBool found = EFalse;
+    for (newIndex = 0 ; newIndex < iSong->ClipCount(KAllTrackIndices); newIndex++) 
+        {
+        if (iSong->iClipArray[newIndex]->StartTime() > aStartTime) 
+            {
+            found = ETrue;
+            break;
+            }
+        }
+    if (!found) 
+        {
+        newIndex = iSong->ClipCount(KAllTrackIndices);
+        }
+
+    // the order is the same
+    if (newIndex == clipIndexOnSong || newIndex == clipIndexOnSong+1) 
+        {
+        
+        iSong->FireClipTimingsChanged(iSong, this);
+        }
+    else 
+        {
+
+
+        TInt oldIndexOnTrack = iIndex;
+        iSong->UpdateClipArray();
+        iSong->UpdateClipIndexes();
+        TInt newIndexOnTrack = iIndex;
+
+        if (oldIndexOnTrack != newIndexOnTrack) 
+            {
+            iSong->FireClipIndicesChanged(iSong, oldIndexOnTrack, newIndexOnTrack, iTrackIndex);
+            }
+        else 
+            {
+            iSong->FireClipTimingsChanged(iSong, this);
+            }
+
+        }
+
+    }
+
+
+
+
+EXPORT_C TTimeIntervalMicroSeconds CAudClip::StartTime() const 
+    {
+
+    return iStartTime.Int64()+iCutInTime.Int64();
+    }
+
+
+
+TInt32 CAudClip::StartTimeMilliSeconds() const 
+    {
+
+    return ProcTools::MilliSeconds(iStartTime);
+    
+    }
+
+EXPORT_C TTimeIntervalMicroSeconds CAudClip::EndTime() const
+    {
+    return TTimeIntervalMicroSeconds(iStartTime.Int64()+iCutOutTime.Int64());
+
+    }
+
+
+EXPORT_C TTimeIntervalMicroSeconds CAudClip::EditedDuration() const
+    {
+    TTimeIntervalMicroSeconds edDur(iCutOutTime.Int64()-iCutInTime.Int64());
+    return edDur;
+
+    }
+
+EXPORT_C TInt CAudClip::Priority() const
+    {
+    return iPriority;
+    
+    }
+
+
+EXPORT_C TInt CAudClip::IndexOnTrack() const 
+    {
+
+    return iIndex;
+    }
+
+
+
+EXPORT_C TInt CAudClip::TrackIndex() const 
+    {
+
+    return iTrackIndex;
+    }
+
+
+EXPORT_C TTimeIntervalMicroSeconds CAudClip::CutInTime() const 
+    {
+    
+    return iCutInTime;
+    }
+    
+
+TInt32 CAudClip::CutInTimeMilliSeconds() const 
+    {
+
+    return ProcTools::MilliSeconds(iCutInTime);
+    
+    }
+
+EXPORT_C void CAudClip::SetCutInTime(TTimeIntervalMicroSeconds aCutInTime) 
+    {
+
+    TInt64 oldCutIn = iCutInTime.Int64();
+    TInt64 cutDif = aCutInTime.Int64() - oldCutIn;  
+
+    iCutInTime = aCutInTime;
+    iStartTime = (TTimeIntervalMicroSeconds)(iStartTime.Int64()-cutDif);
+    iSong->FireClipTimingsChanged(iSong, this);
+    }
+    
+EXPORT_C TTimeIntervalMicroSeconds CAudClip::CutOutTime() const 
+    {
+
+    return iCutOutTime;
+    }
+
+TInt32 CAudClip::CutOutTimeMilliSeconds() const 
+    {
+
+    return ProcTools::MilliSeconds(iCutOutTime);
+    
+
+    }
+    
+EXPORT_C void CAudClip::SetCutOutTime(TTimeIntervalMicroSeconds aCutOutTime) 
+    {
+
+    iCutOutTime = aCutOutTime;
+    iSong->FireClipTimingsChanged(iSong, this);
+    }
+
+
+
+
+EXPORT_C TBool CAudClip::SetPriority(TInt aPriority)
+
+    {
+    if (aPriority < 0) return EFalse;
+
+    iPriority = aPriority;
+    return ETrue;
+
+    }
+
+
+EXPORT_C TInt CAudClip::InsertDynamicLevelMarkL(const TAudDynamicLevelMark& aMark) 
+    {
+
+    if (aMark.iTime < TTimeIntervalMicroSeconds(0)) 
+        {
+        TAudPanic::Panic(TAudPanic::EIllegalDynamicLevelMark);
+        }
+
+    TAudDynamicLevelMark* newMark = new (ELeave) TAudDynamicLevelMark(aMark);
+    
+    TBool added = EFalse;
+    TInt err = KErrNone;
+
+    // insert marks so that they are always sorted by time
+    TInt index = 0;
+    for (index = 0 ; index < iDynamicLevelMarkArray.Count() ; index++) 
+        {
+        if (iDynamicLevelMarkArray[index]->iTime == newMark->iTime) 
+            {
+            // replace the level
+            TAudDynamicLevelMark* oldMark = iDynamicLevelMarkArray[index];
+            iDynamicLevelMarkArray.Remove(index);
+            delete oldMark;
+            err = iDynamicLevelMarkArray.Insert(newMark, index);
+            added = ETrue;
+            break;
+            }
+        else if (iDynamicLevelMarkArray[index]->iTime > newMark->iTime) 
+            {
+            err = iDynamicLevelMarkArray.Insert(newMark, index);
+            added = ETrue;
+            break;
+            }
+        }
+    if (!added) 
+        {
+        index = iDynamicLevelMarkArray.Count();
+        err = iDynamicLevelMarkArray.Insert(newMark, index);
+        }
+    if (err != KErrNone) 
+        {
+        User::Leave(err);
+        }
+
+    iSong->FireDynamicLevelMarkInserted(*this, *newMark, index);
+    return index;
+
+
+    }
+    
+EXPORT_C TBool CAudClip::RemoveDynamicLevelMark(TInt aIndex) 
+    {
+
+    if (aIndex > iDynamicLevelMarkArray.Count() || aIndex < 0) 
+        {
+        TAudPanic::Panic(TAudPanic::EAudioClipIllegalIndex);
+        }
+    
+    TAudDynamicLevelMark* mark = iDynamicLevelMarkArray[aIndex];
+    
+    iDynamicLevelMarkArray.Remove(aIndex);
+    delete mark;
+    
+    iSong->FireDynamicLevelMarkRemoved(*this, aIndex);
+    return ETrue;
+    }
+    
+EXPORT_C void CAudClip::SetMuting(TBool aMuted)
+    {
+    
+    iMute = aMuted;
+    
+    }
+
+EXPORT_C void CAudClip::SetNormalizing(TBool aNormalizing) 
+    {
+    
+    iNormalize = aNormalizing;    
+
+    }
+
+EXPORT_C void CAudClip::Reset(TBool aNotify) 
+    {
+
+    TInt a = 0;
+
+    for (a = 0 ; a < iDynamicLevelMarkArray.Count() ; a++) 
+        {
+        delete iDynamicLevelMarkArray[a];
+        }
+    iDynamicLevelMarkArray.Reset();
+    iCutInTime = 0;
+    
+    if (iInfo != 0)
+        {
+        iCutOutTime = iInfo->Properties().iDuration;
+        }
+
+    if (aNotify) 
+        {
+        iSong->FireClipReseted(*this);
+        }
+
+    }
+
+
+EXPORT_C void CAudClip::SetVolumeGain(TInt aVolumeGain)
+    {
+    iVolumeGain = aVolumeGain;
+    }
+
+EXPORT_C TInt CAudClip::GetVolumeGain()
+    {
+    return iVolumeGain;
+    }
+
+/*
+EXPORT_C TBool CAudClip::operator<(const CAudClip &c2) const {
+
+    return (this->iStartTime < c2.StartTime());
+
+}
+
+
+EXPORT_C TBool CAudClip::operator>(const CAudClip &c2) const {
+
+    return (this->iStartTime > c2.StartTime());
+
+}
+
+EXPORT_C TBool CAudClip::operator==(const CAudClip &c2) const {
+
+    return (this->iStartTime == c2.StartTime());
+
+}
+*/
+TInt CAudClip::Compare(const CAudClip& c1, const CAudClip& c2) 
+    {
+
+    if (c1.iStartTime > c2.iStartTime) 
+        {
+        return 1;
+        }
+    else if (c1.iStartTime < c2.iStartTime) 
+        {
+        return -1;
+        }
+    else 
+        {
+        return 0;
+        }
+    }
+
+
+
+void CAudClip::ConstructL(const TDesC& aFileName,
+                          TTimeIntervalMicroSeconds aStartTime,
+                          MAudClipInfoObserver& aObserver, TInt aTrackIndex) 
+    {
+    
+    __ASSERT_ALWAYS(aStartTime >= TInt64(0), 
+        TAudPanic::Panic(TAudPanic::EAudioClipIllegalStartTime));
+    iStartTime = aStartTime;
+    iTrackIndex = aTrackIndex;
+    
+    iInfo = CAudClipInfo::NewL(aFileName, aObserver);
+    
+    }
+    
+void CAudClip::ConstructL(RFile* aFileHandle,
+                          TTimeIntervalMicroSeconds aStartTime,
+                          MAudClipInfoObserver& aObserver, TInt aTrackIndex) 
+    {
+    
+    __ASSERT_ALWAYS(aStartTime >= TInt64(0), 
+        TAudPanic::Panic(TAudPanic::EAudioClipIllegalStartTime));
+    iStartTime = aStartTime;
+    iTrackIndex = aTrackIndex;
+    
+    iInfo = CAudClipInfo::NewL(aFileHandle, aObserver);
+    
+    }
+
+
+CAudClip::~CAudClip() 
+    {
+
+    Reset(EFalse);
+    if (iInfo != 0)
+        {
+        delete iInfo;
+        iInfo = 0;
+        }
+    
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/AudClipInfo.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,372 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/* Copyright (c) 2003, Nokia. All rights reserved */
+
+#include "AudClipInfo.h"
+#include "AudProcessor.h"
+#include "AudPanic.h"
+
+
+
+#include <fbs.h>
+#include <e32base.h>
+
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+
+EXPORT_C CAudClipInfo* CAudClipInfo::NewL(const TDesC& aFileName, 
+                                          MAudClipInfoObserver& aObserver)
+    {
+    CAudClipInfo* self = NewLC(aFileName, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+    
+EXPORT_C CAudClipInfo* CAudClipInfo::NewLC(const TDesC& aFileName, 
+                                           MAudClipInfoObserver& aObserver)
+    {
+    CAudClipInfo* self = new (ELeave) CAudClipInfo();
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileName, aObserver);
+    return self;
+    }
+    
+EXPORT_C CAudClipInfo* CAudClipInfo::NewL(RFile* aFileHandle,
+                                          MAudClipInfoObserver& aObserver)
+    {
+    CAudClipInfo* self = NewLC(aFileHandle, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+    
+EXPORT_C CAudClipInfo* CAudClipInfo::NewLC(RFile* aFileHandle,
+                                           MAudClipInfoObserver& aObserver)
+    {
+    CAudClipInfo* self = new (ELeave) CAudClipInfo();
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileHandle, aObserver);
+    return self;
+    }
+
+EXPORT_C TAudFileProperties CAudClipInfo::Properties() const
+    {
+
+    return *iProperties;
+    }
+
+EXPORT_C TPtrC CAudClipInfo::FileName() const 
+    {
+    return *iFileName;
+    }
+    
+EXPORT_C RFile* CAudClipInfo::FileHandle() const 
+    {
+    return iFileHandle;
+    }
+
+EXPORT_C void CAudClipInfo::GetVisualizationL(MAudVisualizationObserver& aObserver,
+                                              TInt aSize, TInt aPriority) const 
+    {
+
+
+    iOperation->StartVisualizationL(aObserver, aSize, aPriority);
+    }
+
+EXPORT_C void CAudClipInfo::CancelVisualization()
+    {
+
+
+    iOperation->CancelVisualization();
+    }
+
+CAudClipInfo::CAudClipInfo() : iInfoReady(EFalse)
+
+    {
+    }
+
+
+void CAudClipInfo::ConstructL(const TDesC& aFileName, MAudClipInfoObserver& aObserver)
+    {
+
+    iProperties = new (ELeave) TAudFileProperties();
+
+    iFileName = HBufC::NewL(aFileName.Length());
+    *iFileName = aFileName;
+    iFileHandle = NULL;
+    
+    iOperation = CAudClipInfoOperation::NewL(this, aObserver);
+    iOperation->StartGetPropertiesL();
+
+    }
+    
+void CAudClipInfo::ConstructL(RFile* aFileHandle, MAudClipInfoObserver& aObserver)
+    {
+
+    iProperties = new (ELeave) TAudFileProperties();
+        
+    iFileHandle = aFileHandle;
+    
+    iFileName = HBufC::NewL(1);
+    
+    iOperation = CAudClipInfoOperation::NewL(this, aObserver);
+    iOperation->StartGetPropertiesL();
+
+    }
+
+
+EXPORT_C CAudClipInfo::~CAudClipInfo() 
+    {
+    
+	PRINT((_L("CAudClipInfo::~CAudClipInfo() in")));
+    if (iProperties != 0)
+        {
+        delete iProperties;
+        iProperties = 0;
+        }
+	PRINT((_L("CAudClipInfo::~CAudClipInfo() deleted iProperties")));
+    if (iOperation)
+        {
+        delete iOperation;
+        iOperation = 0;
+        }
+
+	PRINT((_L("CAudClipInfo::~CAudClipInfo() deleted iOperation")));
+    if (iFileName != 0)
+        {
+        delete iFileName;
+        iFileName = 0;
+        }
+	PRINT((_L("CAudClipInfo::~CAudClipInfo() out")));
+    
+    }
+
+
+
+
+CAudClipInfoOperation* CAudClipInfoOperation::NewL(CAudClipInfo* aInfo,
+                                                             MAudClipInfoObserver& aObserver)
+    {
+    CAudClipInfoOperation* self = 
+        new (ELeave) CAudClipInfoOperation(aInfo, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+CAudClipInfoOperation::CAudClipInfoOperation(CAudClipInfo* aInfo,
+                                             MAudClipInfoObserver& aObserver) : 
+                                             iInfo(aInfo), iObserver(&aObserver)
+                                    
+    {
+
+    }
+
+
+void CAudClipInfoOperation::ConstructL() 
+    {
+
+   
+    }
+
+
+CAudClipInfoOperation::~CAudClipInfoOperation() 
+    {
+
+	PRINT((_L("CAudClipInfoOperation::~CAudClipInfoOperation() in")));
+    if (iProcessor != 0)
+        {
+        delete iProcessor;
+        iProcessor = 0;
+
+        }
+	PRINT((_L("CAudClipInfoOperation::~CAudClipInfoOperation() out")));
+
+    }
+
+
+void CAudClipInfoOperation::NotifyClipInfoReady(TInt aError) 
+    {
+    
+	PRINT((_L("CAudClipInfoOperation::NotifyClipInfoReady() in")));
+    
+    iInfo->iInfoReady = ETrue;
+
+    if (iProcessor == 0) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    if (iProcessor != 0)
+        {
+        delete iProcessor;
+        iProcessor = 0;
+        }
+
+    iObserver->NotifyClipInfoReady(*iInfo, aError);
+
+	PRINT((_L("CAudClipInfoOperation::NotifyClipInfoReady() out")));
+
+    }
+
+void CAudClipInfoOperation::StartGetPropertiesL() 
+    {
+	PRINT((_L("CAudClipInfoOperation::StartGetPropertiesL() in")));
+
+    if (iProcessor != 0) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+    iProcessor = CAudProcessor::NewL();        
+    iProcessor->GetAudFilePropertiesL(*iInfo->iFileName, iInfo->iFileHandle, 
+                                      iInfo->iProperties, *this, CActive::EPriorityStandard);
+
+	PRINT((_L("CAudClipInfoOperation::StartGetPropertiesL() out")));
+    }
+
+void CAudClipInfoOperation::StartVisualizationL(MAudVisualizationObserver& aObserver, TInt aSize, 
+                                            TInt aPriority) 
+    {
+
+    if (iProcessor != 0) 
+        {
+        TAudPanic::Panic(TAudPanic::EClipInfoProcessAlreadyRunning);
+        }
+    iVisualizationObserver = &aObserver;
+
+    CAudProcessor* processor = CAudProcessor::NewLC();
+    
+    processor->StartGetClipVisualizationL(iInfo, aSize, *this, aPriority);
+
+    
+    CleanupStack::Pop(processor);
+    iProcessor = processor;
+
+    }
+
+void CAudClipInfoOperation::CancelVisualization()
+    {
+    PRINT((_L("CAudClipInfoOperation::CancelVisualization() in")));
+
+    if (iProcessor == 0) 
+        {
+        PRINT((_L("CAudClipInfoOperation::CancelVisualization() no visualization going on, ignore")));
+        return;
+        }
+    else 
+        {
+        PRINT((_L("CAudClipInfoOperation::CancelVisualization() cancel iProcessor")));
+        iProcessor->CancelClipVisualization();
+        
+        delete iProcessor;
+        iProcessor = 0;
+            
+        iVisualizationObserver = 0;
+        PRINT((_L("CAudClipInfoOperation::CancelVisualization() out")));
+        }
+    }
+
+void CAudClipInfoOperation::NotifySongVisualizationCompleted(const CAudSong& /*aSong*/, 
+        TInt /*aError*/, 
+        TInt8* /*aVisualization*/,
+        TInt /*aSize*/) 
+    {
+
+    // should not be called
+    TAudPanic::Panic(TAudPanic::EInternal);
+
+
+    }
+
+void CAudClipInfoOperation::NotifySongVisualizationStarted(const CAudSong& /*aSong*/, 
+                                                                    TInt /*aError*/) 
+    {
+    // should not be called
+    TAudPanic::Panic(TAudPanic::EInternal);
+
+    }
+
+
+void CAudClipInfoOperation::NotifySongVisualizationProgressed(const CAudSong& /*aSong*/, 
+                                                                       TInt /*aPercentage*/) 
+    {
+
+    // should not be called
+    TAudPanic::Panic(TAudPanic::EInternal);
+    
+
+    }
+
+void CAudClipInfoOperation::NotifyClipInfoVisualizationCompleted(const CAudClipInfo& aClipInfo, 
+        TInt aError, 
+        TInt8* aVisualization,
+        TInt aSize) 
+    {
+    PRINT((_L("CAudClipInfoOperation::NotifyClipInfoVisualizationCompleted() in")));
+    if (aError != KErrNone)
+        {
+        iVisualizationObserver->NotifyClipInfoVisualizationCompleted(aClipInfo, aError, aVisualization, aSize);
+        PRINT((_L("CAudClipInfoOperation::NotifyClipInfoVisualizationCompleted() completed with error %d"),aError));
+        }
+    else
+        {
+        if (iProcessor != 0)
+            {
+            delete iProcessor;
+            iProcessor = 0;
+            }
+
+        MAudVisualizationObserver* observer = iVisualizationObserver;
+        iVisualizationObserver = 0;
+        observer->NotifyClipInfoVisualizationProgressed(aClipInfo, 100);
+        observer->NotifyClipInfoVisualizationCompleted(aClipInfo, aError, aVisualization, aSize);
+        PRINT((_L("CAudClipInfoOperation::NotifyClipInfoVisualizationCompleted() completed")));
+        }
+    
+    
+    PRINT((_L("CAudClipInfoOperation::NotifyClipInfoVisualizationCompleted() out")));
+    }
+
+
+void CAudClipInfoOperation::NotifyClipInfoVisualizationStarted(const CAudClipInfo& aClipInfo, 
+                                        TInt aError) 
+    {
+
+    
+    iVisualizationObserver->NotifyClipInfoVisualizationStarted(aClipInfo, aError);
+
+    }
+
+void CAudClipInfoOperation::NotifyClipInfoVisualizationProgressed(const CAudClipInfo& aClipInfo, 
+                                                                           TInt aPercentage) 
+    {
+
+    
+    iVisualizationObserver->NotifyClipInfoVisualizationProgressed(aClipInfo, aPercentage);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/AudPanic.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "AudPanic.h"
+
+
+void TAudPanic::Panic(TCode aCode)
+    {
+    User::Panic(_L("Audio Editor Eng"), aCode);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/AudProcessor.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "AudSong.h"
+#include "AudProcessor.h"
+#include "AudPanic.h"
+
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+
+CAudProcessor* CAudProcessor::NewL() 
+    {
+    CAudProcessor* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+CAudProcessor* CAudProcessor::NewLC()
+    {
+    CAudProcessor* self = new (ELeave) CAudProcessor;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+
+CAudProcessor::CAudProcessor() : iProcessing(EFalse)
+    {
+    
+    }
+
+
+void CAudProcessor::ConstructL()
+    {
+        iClipInfoAO = CProcClipInfoAO::NewL();
+        iProcessingObject = CProcProcess::NewL();
+        iVisualizationAO = CProcVisualizationAO::NewL();
+        iTimeEstimateAO = CProcTimeEstimateAO::NewL();
+        
+       
+        
+        
+    }
+
+
+CAudProcessor::~CAudProcessor()
+    {
+    PRINT((_L("CAudProcessor::~CAudProcessor() in") ));
+
+
+        
+        if (iVisualizationAO != 0)
+            {
+            delete iVisualizationAO;
+            iVisualizationAO = 0;
+            }
+    PRINT((_L("CAudProcessor::~CAudProcessor() deleted iVisualizationAO") ));
+
+        if (iProcessingObject != 0)
+            {
+            delete iProcessingObject;
+            iProcessingObject = 0;
+            }
+
+    PRINT((_L("CAudProcessor::~CAudProcessor() deleted iProcessingObject") ));
+        if (iClipInfoAO != 0)
+            {
+            delete iClipInfoAO;
+            iClipInfoAO = 0;
+            }
+            
+    PRINT((_L("CAudProcessor::~CAudProcessor() deleted iClipInfoAO") ));
+        if (iTimeEstimateAO != 0)
+            {
+            delete iTimeEstimateAO;
+            iTimeEstimateAO = 0;
+            }
+
+
+    PRINT((_L("CAudProcessor::~CAudProcessor() out") ));
+
+    }
+
+
+
+TBool CAudProcessor::StartSyncProcessingL(const CAudSong* aSong)
+    {
+
+    if (iProcessing) 
+        {
+        TAudPanic::Panic(TAudPanic::ESongProcessingOperationAlreadyRunning);
+        }
+
+
+    return iProcessingObject->StartSyncProcessingL(aSong);
+
+    }
+
+TBool CAudProcessor::ProcessSyncPieceL(HBufC8*& aFrame, TInt& aProgress,
+                                       TTimeIntervalMicroSeconds& aDuration)
+    {
+    TBool ret = iProcessingObject->ProcessSyncPieceL(aFrame, aProgress, aDuration);
+    
+    if (!ret) return EFalse;
+    else
+        {
+        delete iProcessingObject;
+        iProcessingObject = 0;
+        return ETrue;
+        }
+
+    }
+
+    
+/**
+ * Cancel song processing.
+ */
+void CAudProcessor::CancelProcessing(MProcProcessObserver& aObserver) 
+    {
+
+    iProcessing = EFalse;
+    aObserver.NotifyAudioProcessingCompleted(KErrCancel);
+    }
+
+
+void CAudProcessor::GetAudFilePropertiesL(const TDesC& aFileName, 
+                                          RFile* aFileHandle,
+                                          TAudFileProperties* aProperties, 
+                                          MProcClipInfoObserver& aObserver,
+                                          TInt aPriority) 
+    {
+
+    iClipInfoAO->StartL(aFileName, aFileHandle, aObserver, aProperties, aPriority);
+    }
+
+
+
+void CAudProcessor::StartGetClipVisualizationL(const CAudClipInfo* aClipInfo, TInt aSize,
+        MAudVisualizationObserver& aObserver, 
+        TInt aPriority) 
+    {
+
+    
+    iVisualizationAO->StartClipVisualizationL(aClipInfo, aSize, aObserver, aPriority);
+
+
+    }
+
+
+    
+void CAudProcessor::CancelClipVisualization() 
+    {
+
+    if (iVisualizationAO)
+        {
+        iVisualizationAO->CancelVisualization();
+        }
+
+    }
+    
+    
+TBool CAudProcessor::StartTimeEstimateL(const CAudSong* aSong, MAudTimeEstimateObserver& aTEObserver) 
+    {
+
+    if (iTimeEstimateAO)
+        {
+        return iTimeEstimateAO->StartL(aSong, aTEObserver);
+        }
+    else
+        {
+        return EFalse;
+        }
+
+    }
+
+void CAudProcessor::CancelTimeEstimate() 
+    {
+
+    if (iTimeEstimateAO)
+        {
+        iTimeEstimateAO->CancelTimeEstimate();
+        }
+
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/AudProcessorImpl.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,997 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "AudProcessorImpl.h"
+#include "ProcAMRInFileHandler.h"
+
+#include "ProcMP4InFileHandler.h"
+#include "ProcADTSInFileHandler.h"
+#include "ProcMP3InFileHandler.h"
+#include "ProcAWBInFileHandler.h"
+#include "ProcWAVInFileHandler.h"
+
+
+#include "ProcAMRFrameHandler.h"
+#include "ProcAACFrameHandler.h"
+#include "ProcMP3FrameHandler.h"
+#include "ProcAWBFrameHandler.h"
+#include "ProcWAVFrameHandler.h"
+
+
+
+#include "AudCommon.h"
+#include "ProcTools.h"
+#include "AudPanic.h"
+
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+const TInt KTimeEstimateTime = 2000; // 1000 ms
+
+CAudProcessorImpl* CAudProcessorImpl::NewL()
+    {
+
+
+    CAudProcessorImpl* self = new (ELeave) CAudProcessorImpl();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CAudProcessorImpl* CAudProcessorImpl::NewLC()
+    {
+    CAudProcessorImpl* self = new (ELeave) CAudProcessorImpl();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+CAudProcessorImpl::~CAudProcessorImpl() 
+    {
+    
+	PRINT((_L("CAudProcessorImpl::~CAudProcessorImpl() in")));
+    TInt a = 0;
+    
+    for (a = 0; a < iInFiles.Count() ; a++) 
+        {
+        delete iInFiles[a];
+        }
+    iInFiles.Reset();
+    
+	PRINT((_L("CAudProcessorImpl::~CAudProcessorImpl() deleted iInFiles")));
+    delete iWAVFrameHandler; 
+
+    iClipsWritten.Reset();
+
+    iProcessingEvents.ResetAndDestroy();
+
+	PRINT((_L("CAudProcessorImpl::~CAudProcessorImpl() out")));
+    }
+    
+
+void CAudProcessorImpl::ConstructL() 
+    {
+    
+    
+
+    }
+
+CAudProcessorImpl::CAudProcessorImpl() : iInFiles(8), iSong(0), 
+                                            iTimeLeft(0),
+                                            iCurEvent(0),
+                                            iProcessingEvents(8),
+                                            iSongDurationMilliSeconds(0),
+                                            iSongProcessedMilliSeconds(0)
+                                        
+    {
+
+
+    }
+
+void CAudProcessorImpl::ProcessSongL(const CAudSong* aSong, TInt aRawFrameSize, TBool aGetTimeEstimation) 
+{
+    PRINT((_L("CAudProcessorImpl::ProcessSongL in")));
+
+    iGetTimeEstimation = aGetTimeEstimation;
+    
+    iSilenceStarted = EFalse;
+    
+    iSong = aSong;
+    
+    TInt clips = aSong->iClipArray.Count();
+    
+    
+    // bitdepth always 16
+    const TInt KBitDepth = 16;
+    
+    iWAVFrameHandler = CProcWAVFrameHandler::NewL(KBitDepth);
+    
+    // create inFileHandlers for each input clips--->
+    for (TInt a = 0 ; a < clips ; a++) 
+    {
+        if (aSong->iClipArray[a]->Info()->Properties().iFileFormat == EAudFormatAMR) 
+        {
+            PRINT((_L("CAudProcessorImpl::ProcessSongL create AMRNB file handler")));
+            CProcInFileHandler* inFileHandler = 
+                CProcAMRInFileHandler::NewL(aSong->iClipArray[a]->Info()->FileName(), 
+                aSong->iClipArray[a]->Info()->FileHandle(), aSong->iClipArray[a],
+                4096, iSong->OutputFileProperties().iSamplingRate,
+                iSong->OutputFileProperties().iChannelMode);
+            
+            iInFiles.Insert(inFileHandler, iInFiles.Count());
+            inFileHandler->SetPropertiesL(aSong->iClipArray[a]->Info()->Properties());
+            inFileHandler->SetPriority(aSong->iClipArray[a]->Priority());
+        
+            inFileHandler->SeekCutInFrame();
+            
+            if (IsDecodingRequired(aSong->OutputFileProperties(), 
+                                   aSong->iClipArray[a]->Info()->Properties()))
+                {
+                inFileHandler->SetDecodingRequired(ETrue);
+                }
+                
+                
+                
+            
+        }            
+        else if (aSong->iClipArray[a]->Info()->Properties().iFileFormat == EAudFormatMP4) 
+        {
+            PRINT((_L("CAudProcessorImpl::ProcessSongL create MP4 file handler")));
+            CProcInFileHandler* inFileHandler = 
+                CProcMP4InFileHandler::NewL(aSong->iClipArray[a]->Info()->FileName(), 
+                aSong->iClipArray[a]->Info()->FileHandle(),
+                aSong->iClipArray[a],
+                4096, iSong->OutputFileProperties().iSamplingRate,
+                iSong->OutputFileProperties().iChannelMode);
+            
+            iInFiles.Insert(inFileHandler, iInFiles.Count());
+            TAudFileProperties prororo;
+            inFileHandler->GetPropertiesL(&prororo);
+            inFileHandler->SetPriority(aSong->iClipArray[a]->Priority());
+            inFileHandler->SeekCutInFrame();
+            
+            if (IsDecodingRequired(aSong->OutputFileProperties(), 
+                                   aSong->iClipArray[a]->Info()->Properties()))
+                {
+                inFileHandler->SetDecodingRequired(ETrue);
+                }
+            
+            
+            
+        }
+        
+        else if (aSong->iClipArray[a]->Info()->Properties().iFileFormat == EAudFormatAAC_ADTS) 
+        {
+            PRINT((_L("CAudProcessorImpl::ProcessSongL create AAC ADTS file handler")));
+            CProcInFileHandler* inFileHandler = 
+                CProcADTSInFileHandler::NewL(aSong->iClipArray[a]->Info()->FileName(), 
+                aSong->iClipArray[a]->Info()->FileHandle(),
+                aSong->iClipArray[a],
+                8092, iSong->OutputFileProperties().iSamplingRate,
+                iSong->OutputFileProperties().iChannelMode);
+            TAudFileProperties pro;
+            
+            iInFiles.Insert(inFileHandler, iInFiles.Count());
+            inFileHandler->GetPropertiesL(&pro);
+            inFileHandler->SetPriority(aSong->iClipArray[a]->Priority());
+            inFileHandler->SeekCutInFrame();
+            
+            if (IsDecodingRequired(aSong->OutputFileProperties(), 
+                                   aSong->iClipArray[a]->Info()->Properties()))
+                {
+                inFileHandler->SetDecodingRequired(ETrue);
+                }
+            
+                
+            
+        }
+        else if (aSong->iClipArray[a]->Info()->Properties().iFileFormat == EAudFormatMP3) 
+            {
+            PRINT((_L("CAudProcessorImpl::ProcessSongL create MP3 file handler")));
+            CProcInFileHandler* inFileHandler = 
+                CProcMP3InFileHandler::NewL(aSong->iClipArray[a]->Info()->FileName(), 
+                aSong->iClipArray[a]->Info()->FileHandle(), 
+                aSong->iClipArray[a],
+                4096, iSong->OutputFileProperties().iSamplingRate,
+                iSong->OutputFileProperties().iChannelMode);
+            
+            iInFiles.Insert(inFileHandler, iInFiles.Count());
+            inFileHandler->SetPropertiesL(aSong->iClipArray[a]->Info()->Properties());
+            inFileHandler->SetPriority(aSong->iClipArray[a]->Priority());
+            inFileHandler->SeekCutInFrame();
+            
+            
+            if (IsDecodingRequired(aSong->OutputFileProperties(), 
+                                   aSong->iClipArray[a]->Info()->Properties()))
+                {
+                inFileHandler->SetDecodingRequired(ETrue);
+                }
+            
+            }
+        else if (aSong->iClipArray[a]->Info()->Properties().iFileFormat == EAudFormatAMRWB) 
+            {
+            PRINT((_L("CAudProcessorImpl::ProcessSongL create AMRWB file handler")));
+            CProcInFileHandler* inFileHandler = 
+                CProcAWBInFileHandler::NewL(aSong->iClipArray[a]->Info()->FileName(), 
+                aSong->iClipArray[a]->Info()->FileHandle(), 
+                aSong->iClipArray[a],
+                4096, iSong->OutputFileProperties().iSamplingRate,
+                iSong->OutputFileProperties().iChannelMode);
+            
+            iInFiles.Insert(inFileHandler, iInFiles.Count());
+            inFileHandler->SetPropertiesL(aSong->iClipArray[a]->Info()->Properties());
+            inFileHandler->SetPriority(aSong->iClipArray[a]->Priority());
+            inFileHandler->SeekCutInFrame();
+            
+            if (IsDecodingRequired(aSong->OutputFileProperties(), 
+                                   aSong->iClipArray[a]->Info()->Properties()))
+                {
+                inFileHandler->SetDecodingRequired(ETrue);
+                }
+            
+            }
+        else if (aSong->iClipArray[a]->Info()->Properties().iFileFormat == EAudFormatWAV) 
+            {
+            PRINT((_L("CAudProcessorImpl::ProcessSongL create WAV file handler")));
+            CProcInFileHandler* inFileHandler = 
+                CProcWAVInFileHandler::NewL(aSong->iClipArray[a]->Info()->FileName(), 
+                aSong->iClipArray[a]->Info()->FileHandle(), 
+                aSong->iClipArray[a],
+                4096, iSong->OutputFileProperties().iSamplingRate,
+                iSong->OutputFileProperties().iChannelMode);
+            
+            iInFiles.Insert(inFileHandler, iInFiles.Count());
+            inFileHandler->SetPropertiesL(aSong->iClipArray[a]->Info()->Properties());
+            inFileHandler->SetPriority(aSong->iClipArray[a]->Priority());
+            inFileHandler->SeekCutInFrame();
+            
+            if (IsDecodingRequired(aSong->OutputFileProperties(), 
+                                   aSong->iClipArray[a]->Info()->Properties()))
+                {
+                inFileHandler->SetDecodingRequired(ETrue);
+                }
+            
+            }
+        
+        }
+    
+    
+    // find the biggest frame size for mixing buffer
+    TInt maxFrameSize = 0;
+    for (TInt q = 0 ; q < iInFiles.Count() ; q++)
+        {
+        iInFiles[q]->SetRawAudioFrameSize(aRawFrameSize);
+        
+        if (iInFiles[q]->GetDecodedFrameSize() > maxFrameSize)
+            {
+            maxFrameSize = iInFiles[q]->GetDecodedFrameSize();
+            }
+            
+        }
+        
+        
+    
+    GetProcessingEventsL();
+    iProcessingEvents[0]->GetAllIndexes(iClipsWritten);
+    iTimeLeft = iProcessingEvents[1]->iPosition;
+    iCurEvent = 0;
+    
+    
+    if (iGetTimeEstimation)
+        {
+        iTimer.HomeTime();
+        
+        if (iTimeLeft >= KTimeEstimateTime)
+            {
+            iTimeEstimateCoefficient = iTimeLeft/KTimeEstimateTime;
+            
+            iTimeLeft = KTimeEstimateTime;
+            }
+        else
+            {
+            iTimeEstimateCoefficient = 1;
+            }
+        
+        }
+    
+        
+    PRINT((_L("CAudProcessorImpl::ProcessSongL out")));
+    }
+
+TBool CAudProcessorImpl::ProcessSyncPieceL(HBufC8*& aFrame, TInt& aProgress,
+                                       TTimeIntervalMicroSeconds& aDuration, TBool& aRaw) 
+{
+    
+    PRINT((_L("CAudProcessorImpl::ProcessSyncPieceL in")));
+    aDuration = 0;
+    
+    if (iSongProcessedMilliSeconds > iSongDurationMilliSeconds)
+        {
+        // processing is ready
+        StopProcessing();
+        PRINT((_L("CAudProcessorImpl::ProcessSyncPieceL stopped processing 1, out")));
+        return ETrue;
+        
+        }
+    
+    
+    while (iTimeLeft <= 0) 
+        {
+        
+        iCurEvent++;
+    
+        if (iCurEvent >= iProcessingEvents.Count()-1) 
+            {
+
+            // do we need silence in the end?
+            if (iSongProcessedMilliSeconds < ProcTools::MilliSeconds(iSong->iSongDuration))
+                {
+                
+                if (iGetTimeEstimation)
+                    {
+                    StopProcessing();
+                    PRINT((_L("CAudProcessorImpl::ProcessSyncPieceL stopped processing in time estimate case, out")));
+                    return ETrue;        
+                    
+                    }
+                
+               
+                WriteSilenceL(aFrame, aProgress, aDuration, aRaw);
+                return EFalse;
+                }
+            // processing is ready
+            StopProcessing();
+            PRINT((_L("CAudProcessorImpl::ProcessSyncPieceL stopped processing 2, out")));
+            return ETrue;
+            }
+        
+        iClipsWritten.Reset();
+        for (TInt tr = 0 ; tr < iProcessingEvents[iCurEvent]->IndexCount() ; tr++)
+            {
+            
+            TInt clipIndex = iProcessingEvents[iCurEvent]->GetIndex(tr);
+
+            
+            if (clipIndex == -1 || !iSong->Clip(clipIndex, KAllTrackIndices)->Muting())
+                {
+                iClipsWritten.Append(iProcessingEvents[iCurEvent]->GetIndex(tr));
+                
+                }
+            
+            }
+        iTimeLeft = iProcessingEvents[iCurEvent+1]->iPosition -
+                iProcessingEvents[iCurEvent]->iPosition;
+                
+        if (iGetTimeEstimation)
+            {
+            
+            TTime timeNow;
+            timeNow.HomeTime();
+            
+            // how long has it been from the previous event?
+            TTimeIntervalMicroSeconds msFromPrev = timeNow.MicroSecondsFrom(iTimer);
+            
+            iTimeEstimate += msFromPrev.Int64() * iTimeEstimateCoefficient;
+            
+            // set iTimer to home time
+            iTimer.HomeTime();
+            
+            if (iTimeLeft > KTimeEstimateTime)
+                {
+                iTimeEstimateCoefficient = iTimeLeft/KTimeEstimateTime;
+                iTimeLeft = KTimeEstimateTime;
+                }
+            else
+                {
+                iTimeEstimateCoefficient = 1;
+                }
+            
+            }
+                    
+        }
+    
+    
+    if (iClipsWritten.Count() == 1) 
+        {
+        // if silence
+        WriteSilenceL(aFrame, aProgress, aDuration, aRaw);
+        PRINT((_L("CAudProcessorImpl::ProcessSyncPieceL silence, out")));
+        return EFalse;
+        
+        }
+    else if (iTimeLeft > 0) 
+        {
+
+
+        TInt inClipIndex1 = 0;
+        TInt inClipIndex2 = 0;
+        
+        HighestInFilePriority(inClipIndex1, inClipIndex2);
+        
+        CAudClip* clip1 = iSong->iClipArray[iClipsWritten[inClipIndex1]];
+        CAudClip* clip2 = iSong->iClipArray[iClipsWritten[inClipIndex2]];
+        
+        CProcInFileHandler* inHandler1 = iInFiles[iClipsWritten[inClipIndex1]];
+        CProcInFileHandler* inHandler2 = iInFiles[iClipsWritten[inClipIndex2]];
+        
+        
+        TBool writeClip1 = ETrue;
+        TBool writeClip2 = ETrue;
+        
+        if (clip1 == clip2)
+            {
+            writeClip2 = EFalse;
+            }
+        if (clip1->Muting())
+            {
+            writeClip1 = EFalse;
+            }
+        if (clip2->Muting())
+            {
+            writeClip2 = EFalse;
+            }
+
+
+        HBufC8* frame1 = 0;
+        HBufC8* frame2 = 0;
+        TInt siz1 = 0;
+        TInt32 tim1 = 0;
+        TInt siz2 = 0;
+        TInt32 tim2 = 0;
+        
+        TBool getFrameRet1 = EFalse;
+        TBool getFrameRet2 = EFalse;
+        // If the clip is muted -> return silence
+        
+        if (!writeClip1 && !writeClip2)
+            {
+            
+            getFrameRet1 = inHandler1->GetSilentAudioFrameL(frame1, siz1, tim1, aRaw);
+            
+            }
+            
+        else if (!writeClip1 && writeClip2)
+            {
+            
+            getFrameRet2 = inHandler2->GetAudioFrameL(frame2, siz2, tim2, aRaw);
+                
+            }
+        else if (writeClip1 && !writeClip2)
+            {
+            
+            getFrameRet1 = inHandler1->GetAudioFrameL(frame1, siz1, tim1, aRaw);
+                
+            }
+        else
+            {
+            
+            TBool decodingRequired1 = inHandler1->DecodingRequired();
+            TBool decodingRequired2 = inHandler2->DecodingRequired();
+            
+            // decoding is needed due to mixing
+            inHandler1->SetDecodingRequired(ETrue);
+            inHandler2->SetDecodingRequired(ETrue);
+            
+            getFrameRet1 = inHandler1->GetAudioFrameL(frame1, siz1, tim1, aRaw);
+            
+            // fix to rel2, put frame1 to cleanup stack for the next operation
+            CleanupStack::PushL(frame1);
+            getFrameRet2 = inHandler2->GetAudioFrameL(frame2, siz2, tim2, aRaw);
+            CleanupStack::Pop(); // frame1, will be put to cleanupstack later->
+
+
+            inHandler1->SetDecodingRequired(decodingRequired1);
+            inHandler2->SetDecodingRequired(decodingRequired2);
+            
+            }
+            
+        
+        if(!getFrameRet1 && !getFrameRet2)
+            {
+            // no audio frames left -> write silence
+        
+            getFrameRet1 = inHandler1->GetSilentAudioFrameL(frame1, siz1, tim1, aRaw);
+                            
+        }
+        
+        if (frame1 != 0)
+            {
+            CleanupStack::PushL(frame1);
+            }
+        if (frame2 != 0)
+            {
+            CleanupStack::PushL(frame2);
+            }
+            
+
+        if (getFrameRet1 && getFrameRet2)
+            {
+           
+            // mix the two frames
+            iWAVFrameHandler->MixL(frame1, frame2, aFrame);
+            CleanupStack::PopAndDestroy(frame2);
+            CleanupStack::PopAndDestroy(frame1);
+            aDuration = TUint(tim1*1000);
+            
+            }
+        else if (getFrameRet1 && !getFrameRet2)
+            {
+            aFrame = HBufC8::NewL(frame1->Length());
+            aFrame->Des().Copy(frame1->Des());
+            CleanupStack::PopAndDestroy(frame1);
+            aDuration = TUint(tim1*1000);
+            
+            
+            }
+        else if (!getFrameRet1 && getFrameRet2)
+            {
+            
+            aFrame = HBufC8::NewL(frame2->Length());
+            aFrame->Des().Copy(frame2->Des());
+            CleanupStack::PopAndDestroy(frame2);
+            aDuration = TUint(tim2*1000);
+            
+            }
+        else if (!getFrameRet1 && !getFrameRet2)
+            {
+            
+            // shouldn't get here...
+            
+            User::Leave(KErrGeneral);
+            }
+
+        
+        iTimeLeft -= ProcTools::MilliSeconds(aDuration);
+        iSongProcessedMilliSeconds += ProcTools::MilliSeconds(aDuration);
+        
+        
+    }
+    
+    if (iSongDurationMilliSeconds > 0)
+        {
+        
+        // update progress
+        aProgress = (iSongProcessedMilliSeconds*100)/iSongDurationMilliSeconds;
+            
+        }
+    PRINT((_L("CAudProcessorImpl::ProcessSyncPieceL out")));
+    return EFalse;
+    
+    }
+
+
+void CAudProcessorImpl::GetAudFilePropertiesL(const TDesC& aFileName, RFile* aFileHandle,
+                                              TAudFileProperties* aProperties) 
+    {
+
+    PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL in")));
+    
+    
+
+    PRINT(_L("CAudProcessorImpl::GetAudFilePropertiesL read header from file"));
+    
+    TBuf8<10> fileHeader;
+
+    if (!aFileHandle)
+    {
+        RFs* fs = new (ELeave) RFs;
+        CleanupStack::PushL(fs);
+        User::LeaveIfError( fs->Connect() );
+    
+        RFile file;    
+        TInt error = file.Open(*fs, aFileName, EFileShareReadersOnly | EFileStream | EFileRead);//EFileShareAny | EFileStream | EFileRead);
+        if (error != KErrNone)
+            {
+            error = file.Open(*fs, aFileName, EFileShareAny | EFileStream | EFileRead);
+            }
+        if (error == KErrNone)
+            {
+            error = file.Read(fileHeader);
+            }
+        file.Close();
+        fs->Close();
+        CleanupStack::PopAndDestroy(fs);
+        User::LeaveIfError(error);
+    } 
+    else
+    {
+        TInt pos = 0;
+        
+        User::LeaveIfError( aFileHandle->Seek(ESeekCurrent, pos) );
+        
+        TInt zero = 0;        
+        User::LeaveIfError( aFileHandle->Seek(ESeekStart, zero) );
+        User::LeaveIfError( aFileHandle->Read(fileHeader) );
+        
+        User::LeaveIfError( aFileHandle->Seek(ESeekStart, pos) );
+    }
+        
+    if (fileHeader.Length() < 10 )  //AMR-WB has 9-byte header, but header-only clips are not accepted. Hence accepting only 10 and more byte clips.
+        {
+        PRINT(_L("CAudProcessorImpl::GetAudFilePropertiesL the file has less than 9 bytes, it must be invalid"));        
+        User::Leave(KErrCorrupt);
+        }
+
+    PRINT(_L("CAudProcessorImpl::GetAudFilePropertiesL interpret the header"));
+    
+    TParse fp;
+    TFileName name;
+        
+    if (!aFileHandle)
+        fp.Set(aFileName, NULL, NULL);
+    else
+    {
+        User::LeaveIfError( aFileHandle->FullName(name) );
+        fp.Set(name, NULL, NULL);
+    }    
+    
+    if ( fileHeader.Mid(4,4) == _L8("ftyp") )
+            {
+        PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL 3gp/mp4/m4a based on ftyp")));
+        // 3gp/mp4/m4a; extension-based recognition later
+        CProcInFileHandler* inFileHandler = CProcMP4InFileHandler::NewL(aFileName, aFileHandle, 0, 4096);
+        CleanupStack::PushL(inFileHandler);
+        inFileHandler->GetPropertiesL(aProperties);
+        
+        CleanupStack::PopAndDestroy(inFileHandler);
+        }
+    else if (fileHeader.Mid(0,6) == _L8("#!AMR\n"))
+        {
+        PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL AMR-NB based on #!AMR")));
+        // AMR-NB
+        CProcInFileHandler* inFileHandler = CProcAMRInFileHandler::NewL(aFileName, aFileHandle, 0, 4096);
+        CleanupStack::PushL(inFileHandler);
+
+        inFileHandler->GetPropertiesL(aProperties);    
+        
+        CleanupStack::PopAndDestroy(inFileHandler);
+        
+        }
+    else if (fileHeader.Mid(0,9) == _L8("#!AMR-WB\n")) 
+        {
+        PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL awb based on #!AMR-WB")));
+        CProcInFileHandler* inFileHandler = CProcAWBInFileHandler::NewL(aFileName, aFileHandle,0, 4096);
+        CleanupStack::PushL(inFileHandler);
+        inFileHandler->GetPropertiesL(aProperties);
+
+        CleanupStack::PopAndDestroy(inFileHandler);
+        }
+    else if (fp.Ext().CompareF(_L(".aac")) == 0) 
+        {
+        PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL aac based on extension")));
+        CProcInFileHandler* inFileHandler = CProcADTSInFileHandler::NewL(aFileName, aFileHandle, 0, 4096);
+        CleanupStack::PushL(inFileHandler);
+        inFileHandler->GetPropertiesL(aProperties);
+
+        CleanupStack::PopAndDestroy(inFileHandler);
+        }
+    else if (fp.Ext().CompareF(_L(".3gp")) == 0) 
+        {
+        PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL 3gp based on extension")));
+
+        CProcInFileHandler* inFileHandler = CProcMP4InFileHandler::NewL(aFileName, aFileHandle, 0, 4096);
+        
+        CleanupStack::PushL(inFileHandler);
+        inFileHandler->GetPropertiesL(aProperties);
+        
+        CleanupStack::PopAndDestroy(inFileHandler);
+    
+        }
+
+    else if (fp.Ext().CompareF(_L(".m4a")) == 0 || 
+             fp.Ext().CompareF(_L(".mp4")) == 0) 
+        {
+        PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL mp4/m4a based on extension")));
+        
+        CProcInFileHandler* inFileHandler = 0;
+
+        inFileHandler = CProcMP4InFileHandler::NewL(aFileName, aFileHandle, 0, 4096);
+        CleanupStack::PushL(inFileHandler);
+        inFileHandler->GetPropertiesL(aProperties);    
+        CleanupStack::PopAndDestroy(inFileHandler);
+        
+        }
+    else if (fp.Ext().CompareF(_L(".amr")) == 0)
+        {
+        PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL AMR-NB based on extension")));
+        // AMR-NB
+        CProcInFileHandler* inFileHandler = CProcAMRInFileHandler::NewL(aFileName, aFileHandle, 0, 4096);
+        CleanupStack::PushL(inFileHandler);
+
+        inFileHandler->GetPropertiesL(aProperties);    
+        
+        CleanupStack::PopAndDestroy(inFileHandler);
+        }
+    else if (fp.Ext().CompareF(_L(".awb")) == 0)
+        {
+        PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL awb based on extension")));
+        CProcInFileHandler* inFileHandler = CProcAWBInFileHandler::NewL(aFileName, aFileHandle, 0, 4096);
+        CleanupStack::PushL(inFileHandler);
+        inFileHandler->GetPropertiesL(aProperties);
+
+        CleanupStack::PopAndDestroy(inFileHandler);
+        }
+    else if (fp.Ext().CompareF(_L(".mp3")) == 0) 
+        {
+        PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL mp3 based on extension")));
+        
+        CProcInFileHandler* inFileHandler = CProcMP3InFileHandler::NewL(aFileName, aFileHandle, 0, 4096);
+        CleanupStack::PushL(inFileHandler);
+        inFileHandler->GetPropertiesL(aProperties);
+        
+        CleanupStack::PopAndDestroy(inFileHandler);
+        }
+    else if (fp.Ext().CompareF(_L(".wav")) == 0) 
+        {
+        PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL wav based on extension")));
+        
+        CProcInFileHandler* inFileHandler = CProcWAVInFileHandler::NewL(aFileName, aFileHandle, 0, 8192);
+        CleanupStack::PushL(inFileHandler);
+        inFileHandler->GetPropertiesL(aProperties);
+        CleanupStack::PopAndDestroy(inFileHandler);
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+    PRINT((_L("CAudProcessorImpl::GetAudFilePropertiesL out")));
+    }
+    
+    
+TInt64 CAudProcessorImpl::GetFinalTimeEstimate() const
+    {
+    return iTimeEstimate;
+    }
+
+void CAudProcessorImpl::GetProcessingEventsL() 
+    {
+
+    TInt clips = iSong->iClipArray.Count();
+
+    CProcessingEvent* newEvent = 0;
+    
+    TInt a = 0;
+
+    // create a new processing event from each clips cutIn and cutOut
+    for (a = 0 ; a < clips ; a++) 
+        {
+        
+        
+        // cut in time:
+        newEvent = CProcessingEvent::NewL();
+        newEvent->iChangedClipIndex = a;
+        newEvent->iCutIn = ETrue;
+        TInt32 startTime = iSong->iClipArray[a]->StartTimeMilliSeconds();
+        TInt32 cutInTime= iSong->iClipArray[a]->CutInTimeMilliSeconds(); 
+        newEvent->iPosition = startTime+cutInTime;
+        iProcessingEvents.Insert(newEvent, 0);
+
+        // cut out time
+        newEvent = CProcessingEvent::NewL();
+        newEvent->iChangedClipIndex = a;
+        newEvent->iCutIn = EFalse;
+        TInt32 cutOutTime= iSong->iClipArray[a]->CutOutTimeMilliSeconds(); 
+        newEvent->iPosition = startTime+cutOutTime;
+        iProcessingEvents.Insert(newEvent, 0);
+
+        }
+
+    
+    
+
+    // order processing events
+    TLinearOrder<CProcessingEvent> order(CProcessingEvent::Compare);
+    iProcessingEvents.Sort(order);
+
+    // add a new processing events in the beginning to represent silence
+    // (there is a possibility that the first clip doesn't start from 0 ms)
+    newEvent = CProcessingEvent::NewL();
+    newEvent->iChangedClipIndex = -1;
+    newEvent->InsertIndex(-1);
+    newEvent->iCutIn = ETrue;
+    newEvent->iPosition = 0;
+    iProcessingEvents.Insert(newEvent, 0);
+
+    // the next for-loop adds indexes of those clips that are supposed to be mixed to
+    // each processing event
+
+    for (TInt r = 1; r < iProcessingEvents.Count() ; r++) 
+        {
+        
+        
+        for (TInt i = 0 ; i < iProcessingEvents[r-1]->IndexCount() ; i++)
+            {
+            iProcessingEvents[r]->InsertIndex(iProcessingEvents[r-1]->GetIndex(i));
+            }
+
+        
+        if (iProcessingEvents[r]->iCutIn)
+            {
+            iProcessingEvents[r]->InsertIndex(iProcessingEvents[r]->iChangedClipIndex);
+            }
+        else
+            {
+
+            TInt oldIndexInArray = iProcessingEvents[r]->FindIndex(iProcessingEvents[r]->iChangedClipIndex);
+
+            if (oldIndexInArray >= 0 && oldIndexInArray < iProcessingEvents[r]->IndexCount())
+                {
+                iProcessingEvents[r]->RemoveIndex(oldIndexInArray);
+                }
+
+            }
+
+        }
+                
+    //iSongDurationMilliSeconds = (iSong->iSongDuration.Int64()/1000);
+    iSongDurationMilliSeconds = ProcTools::MilliSeconds(iSong->iSongDuration);
+    
+    //iProcessingEvents[iProcessingEvents.Count()-1]->iPosition;
+
+
+    }
+
+
+
+
+TBool CAudProcessorImpl::StopProcessing()
+    {
+
+    if (iGetTimeEstimation)
+        {
+        
+        TTime timeNow;
+        timeNow.HomeTime();
+        
+        // how long has it been from the previous event?
+        TTimeIntervalMicroSeconds msFromPrev = timeNow.MicroSecondsFrom(iTimer);
+        
+        iTimeEstimate += msFromPrev.Int64() * iTimeEstimateCoefficient;
+        }
+
+
+    iProcessingEvents.ResetAndDestroy();
+    iInFiles.ResetAndDestroy();
+
+    return ETrue;
+    }
+
+TBool CAudProcessorImpl::WriteSilenceL(HBufC8*& aFrame, TInt& aProgress,
+                                       TTimeIntervalMicroSeconds& aDuration, TBool& aRaw)                                
+    {
+    HBufC8* silentFrame = 0;
+    TInt silSize = 0;
+    TInt32 silDur = 0;
+
+    if (iSong->iProperties->iAudioType == EAudAAC_MPEG4 && 
+        iSong->iProperties->iChannelMode == EAudSingleChannel)
+        {
+        
+        aDuration = ((1024*1000)/(iSong->iProperties->iSamplingRate))*1000;
+        
+        silDur = ProcTools::MilliSeconds(aDuration);
+        
+        aFrame = HBufC8::NewL(KSilentMonoAACFrameLenght);
+        aFrame->Des().Append(KSilentMonoAACFrame, KSilentMonoAACFrameLenght);
+        
+        aRaw = EFalse;
+
+        }
+    else if (iSong->iProperties->iAudioType == EAudAAC_MPEG4 && 
+             iSong->iProperties->iChannelMode == EAudStereo)
+        {
+
+        aDuration = ((1024*1000)/(iSong->iProperties->iSamplingRate))*1000;
+        
+        silDur = ProcTools::MilliSeconds(aDuration);
+        
+        aFrame = HBufC8::NewL(KSilentStereoAACFrameLenght);    
+        aFrame->Des().Append(KSilentStereoAACFrame, KSilentStereoAACFrameLenght);
+        
+        aRaw = EFalse;
+
+        }
+    else
+        {
+        iInFiles[0]->GetSilentAudioFrameL(silentFrame, silSize, silDur, aRaw);
+    
+        aFrame= silentFrame;
+        aDuration = TUint(silDur*1000);
+        
+        }
+    
+    iSongProcessedMilliSeconds += silDur;
+    iTimeLeft -= silDur;
+    
+    if (iSongDurationMilliSeconds > 0)
+        {
+        aProgress = (iSongProcessedMilliSeconds*100)/iSongDurationMilliSeconds;    
+        }
+        
+    return ETrue;
+    }
+
+
+TBool CAudProcessorImpl::HighestInFilePriority(TInt& aFirst, TInt& aSecond)
+    {
+    
+    aFirst = 1;
+    aSecond = 1;
+    
+    TInt highest = 1;
+    
+    TInt secondHighest = 1;
+    
+ 
+    for (TInt a = 1 ; a < iClipsWritten.Count() ; a++)
+        {
+        if (iInFiles[iClipsWritten[a]]->Priority() >= highest)
+            {
+            
+            // highest priority
+            aFirst = a;
+            highest = iInFiles[iClipsWritten[a]]->Priority();
+            
+            }
+        else if (iInFiles[iClipsWritten[a]]->Priority() >= secondHighest)
+            {
+            aSecond = a;
+            secondHighest = iInFiles[iClipsWritten[a]]->Priority();
+            }
+ 
+        }
+        
+ 
+    return ETrue;
+    }
+    
+TBool CAudProcessorImpl::IsDecodingRequired(const TAudFileProperties& prop1, 
+                                            const TAudFileProperties& prop2)
+    {
+    
+    TBool decodingNeeded = EFalse;
+    TAudFileProperties tmpProp1 = prop1;
+    TAudFileProperties tmpProp2 = prop2;
+    
+ 
+    if (tmpProp1.iAudioType != 
+        tmpProp2.iAudioType ||
+        tmpProp1.iSamplingRate != 
+        tmpProp2.iSamplingRate ||
+        tmpProp1.iChannelMode != 
+        tmpProp2.iChannelMode)
+        {
+        decodingNeeded = ETrue;
+        }
+        
+    return decodingNeeded;
+    
+    
+    }
+
+    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/AudSong.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1438 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "AudSong.h"
+#include "AudClip.h"
+#include "AudPanic.h"
+#include "ProcInFileHandler.h"
+#include "ProcADTSInFileHandler.h"
+#include "ProcAMRInFileHandler.h"
+#include "ProcMP4InFileHandler.h"
+#include "ProcAWBInFileHandler.h"
+#include "AACConstants.h"
+#include "audconstants.h"
+
+#include "AudProcessor.h"
+#include "AACApi.h"
+#include "aedproctimeestimate.h"
+
+#include <e32base.h>
+
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+EXPORT_C CAudSong* CAudSong::NewL(RFs *aFs)
+    {
+    CAudSong* self = NewLC(aFs);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+    
+EXPORT_C CAudSong* CAudSong::NewLC(RFs *aFs)
+    {
+    CAudSong* self = new (ELeave) CAudSong(aFs);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+ 
+CAudSong::CAudSong(RFs *aFs) : iFs(aFs), iClipArray(32),  iSongDuration(0), 
+                                iSongDurationManuallySet(EFalse), iObserverArray(16), iNormalize(EFalse)
+    {
+    }
+
+
+void CAudSong::ConstructL()
+    {
+    iProperties = new (ELeave) TAudFileProperties();
+    
+    iProperties->iAudioType = EAudNoAudio;
+    iProperties->iFileFormat = EAudFormatUnrecognized;
+    iProperties->iDuration = 0;
+    iProperties->iFrameCount = 0;
+    iProperties->iFrameLen = 0;
+    iProperties->iFrameDuration = 0;
+
+
+    iProcessOperation = CAudSongProcessOperation::NewL(this);
+    iAddOperation = CAudSongAddClipOperation::NewL(this);
+
+
+#ifdef _WRITE_OUTPUT_TO_FILE_
+
+
+    TBuf<32> fileName;
+    _LIT(KFn, "C:\\audioEngineOut.");
+    _LIT(KTextFileName, "C:\\audioEngineOut.txt");
+    
+    fileName.Append(KFn);
+    
+    if (iProperties->iAudioType == EAudAMR)
+        {
+        fileName.Append(_L("amr"));
+        }
+    else
+        {
+        fileName.Append(_L("aac"));
+        }
+    
+    
+    User::LeaveIfError(iDebFs.Connect());
+    iDebFs.Delete(fileName);
+    iDebFs.Delete(KTextFileName);
+
+    iFileOpen = EFalse;
+    TInt err1 = iAudioFile.Create(iDebFs, fileName, EFileWrite);
+    
+    TInt err2 = iTextFile.Create(iDebFs, KTextFileName, EFileWrite);
+    
+    if (err1 == KErrNone && err2 == KErrNone)
+        {
+        iFileOpen = ETrue;
+        }
+        
+    if (iFileOpen && iProperties->iAudioType == EAudAMR)
+        {
+        iAudioFile.Write(_L8("#!AMR"));
+        }
+    
+#endif
+
+
+    }
+
+
+EXPORT_C CAudSong::~CAudSong() 
+    {
+
+    Reset(EFalse);
+    delete iProperties;
+    iProperties = 0;
+    delete iProcessOperation;
+    iProcessOperation = 0;
+    delete iAddOperation;
+    iAddOperation = 0;
+
+
+    iObserverArray.Reset();
+
+
+#ifdef _WRITE_OUTPUT_TO_FILE_
+    iAudioFile.Close();
+    iTextFile.Close();
+    iDebFs.Close();
+    
+#endif
+
+    }
+
+EXPORT_C TInt CAudSong::GetSizeEstimateL() const
+    {
+    
+    
+    // if there are no clips added yet
+    if (iClipArray.Count() == 0)
+        {
+        return 0;
+        }
+        
+    TInt durationMilli = ProcTools::MilliSeconds(iClipArray[iClipArray.Count()-1]->EndTime());
+    TInt silenceDuration = ProcTools::MilliSeconds(iSongDuration) - durationMilli;
+    
+    if (silenceDuration < 0)
+        {
+        silenceDuration = 0;
+        }
+       
+    TInt sizeInBytes = 0;
+        
+    const TInt KBitrate = iProperties->iBitrate;
+    const TInt KBitsInByte = 8;
+    TInt KByterate = KBitrate/KBitsInByte;
+        
+    // make sure we round up
+    sizeInBytes = (durationMilli/1000+1)*KByterate;
+    
+    TInt frameDurationMilli = 20; // AMR
+    TInt silentFrameLen = 13; // AMR
+    
+    if (iProperties->iAudioType == EAudAAC_MPEG4)
+        {
+        
+        frameDurationMilli = ((1024*1000)/(iProperties->iSamplingRate));
+        
+        if (iProperties->iChannelMode == EAudSingleChannel)
+            {
+            silentFrameLen = KSilentMonoAACFrameLenght;
+            }
+        else
+            {
+            silentFrameLen = KSilentStereoAACFrameLenght;
+            }
+        
+        }
+        
+    if (frameDurationMilli > 0)
+        {
+        TInt silentFrames = silenceDuration/frameDurationMilli;
+        TInt silenceSize = silentFrames*silentFrameLen;
+        sizeInBytes += silenceSize;
+        
+        }
+
+    return sizeInBytes;
+    
+    }
+    
+EXPORT_C TInt CAudSong::GetFrameSizeEstimateL(TTimeIntervalMicroSeconds aStartTime, 
+                                              TTimeIntervalMicroSeconds aEndTime) const
+	{
+	// if there are no clips added yet
+    if (iClipArray.Count() == 0)
+        {
+        return 0;
+        }
+	
+	TInt frameDurationMicro = 20000; // AMR
+    
+    if (iProperties->iAudioType == EAudAAC_MPEG4)
+        {
+        
+        frameDurationMicro = ((1024*1000)/(iProperties->iSamplingRate))*1000;
+        }
+    
+    // just in case to prevent infinite loop    
+    if (frameDurationMicro <= 0)
+        {
+        return 0;
+        }
+	
+    TInt size = 0;
+    
+    // Calculate the time of the first frame included in the time interval
+    TInt64 firstFrameIndex = aStartTime.Int64() / frameDurationMicro;
+    TInt64 currentTime = firstFrameIndex * frameDurationMicro;
+    
+    while (currentTime + frameDurationMicro <= aEndTime.Int64())        // Make sure the whole frame fits inside the time interval
+        {
+     
+        TBool silence = ETrue;
+    	TInt clipIndex = 0;
+    	TInt overLappingClips = 0;
+    	
+    	for (TInt a = 0 ; a < iClipArray.Count() ; a++)
+    	    {
+    	    if (!iClipArray[a]->Muting())
+    	        {
+    	        
+        	    if ((currentTime >= iClipArray[a]->iStartTime.Int64() + iClipArray[a]->iCutInTime.Int64()) &&
+        	       (currentTime < iClipArray[a]->iStartTime.Int64() + iClipArray[a]->iCutOutTime.Int64()))
+        	        
+        	        {
+        	        silence = EFalse;
+        	        clipIndex = a;
+                    overLappingClips++;
+        	        
+        	        }
+    	        }
+    	    }
+    	    
+    	TInt frameSize = 0;
+    	if (silence)
+    	    {
+    	    
+    	    // if there is no audio around "aTime", just return a silent frame length
+    	    
+    	    if (iProperties->iAudioType == EAudAAC_MPEG4)
+                {
+                
+                if (iProperties->iChannelMode == EAudSingleChannel)
+                    {
+                    frameSize = KSilentMonoAACFrameLenght;
+                    }
+                else
+                    {
+                    frameSize = KSilentStereoAACFrameLenght;
+                    }
+                }
+    	    else if (iProperties->iAudioType == EAudAMR)
+    	        {
+    	        
+    	        TInt KSilentFrameLen = 13; // AMR
+    	        frameSize = KSilentFrameLen;
+    	        
+    	        }
+    	        
+    	    size +=frameSize;
+    	    currentTime += frameDurationMicro;
+    	    continue;
+    	    
+    	    }
+    	    
+    	    
+    	    
+    	// if not silent, estimate according to bitrate if transcoding
+    	// if no transcoding is necessary, return the frame length of the original
+    	// input clip
+    	
+    	// input clip is not transcoded if the original clip has the same
+    	// audio properties as the output clip and no mixing is needed
+    	    
+    	TAudFileProperties clipProp = iClipArray[clipIndex]->Info()->Properties();
+    	   
+    	TBool clipTranscoded = EFalse;
+    	    
+    	if (clipProp.iAudioType != 
+            iProperties->iAudioType ||
+            clipProp.iSamplingRate != 
+            iProperties->iSamplingRate ||
+            clipProp.iChannelMode != 
+            iProperties->iChannelMode)
+                {
+                clipTranscoded = ETrue;
+                }
+    	
+    	if (overLappingClips > 1)
+    	    {
+    	    clipTranscoded = ETrue;
+    	    }
+    	
+    	
+    	if (clipTranscoded)
+    	    {
+    	    const TInt KBitrate = iProperties->iBitrate;
+            const TInt KBitsInByte = 8;
+            
+            TInt KByterate = KBitrate/KBitsInByte;    
+        	
+        	TInt frameDurationMilli = 20; // AMR
+            
+            if (iProperties->iAudioType == EAudAAC_MPEG4)
+                {
+                
+                frameDurationMilli = ((1024*1000)/(iProperties->iSamplingRate));
+        	
+        		}
+        	
+        	frameSize = (KByterate/(1000/frameDurationMilli)+1);
+        	    
+    	    }
+    	else
+    	    {
+    	    
+    	    frameSize = clipProp.iFrameLen;
+    	    
+    	    }    
+    	
+    	size +=frameSize;
+    	currentTime += frameDurationMicro;
+    	continue;
+    	
+        }
+        
+    return size;
+
+	}
+
+EXPORT_C TAudFileProperties CAudSong::OutputFileProperties() const 
+    {
+
+    return *iProperties;
+    }
+    
+
+EXPORT_C TBool CAudSong::GetMP4DecoderSpecificInfoLC(HBufC8*& aDecSpecInfo, TInt aMaxSize) const
+    {
+    
+    if (iClipArray.Count() == 0)
+        {
+        return EFalse;
+        }
+    
+    if (iProperties->iAudioType == EAudAAC_MPEG4)
+        
+        {
+        
+        int16 frameLen = 1024;
+        int32 sampleRate = iProperties->iSamplingRate;
+        uint8 profile = LC_OBJECT;
+        uint8 nChannels = 1;
+        uint8 decSpecInfo[16];
+        int16 nConfigBytes;
+        
+        if (iProperties->iChannelMode == EAudStereo)
+            {
+            nChannels = 2;
+            }
+        
+        
+        //nConfigBytes = AACGetMP4ConfigInfo(&aacInfo, decSpecInfo, 16);
+        nConfigBytes = AACGetMP4ConfigInfo(sampleRate, profile, 
+            nChannels, frameLen, decSpecInfo, aMaxSize);
+
+
+        if (nConfigBytes > 0)
+            {
+
+            aDecSpecInfo = HBufC8::NewLC(nConfigBytes);
+            aDecSpecInfo->Des().Append(decSpecInfo, nConfigBytes);
+
+            }
+            
+        return ETrue;
+        
+        }
+    else if (iProperties->iAudioType == EAudAMR)
+        {
+        aDecSpecInfo = HBufC8::NewLC(aMaxSize);
+        
+        const TUint8 frameDecSpecInfo[] = {0x14,0x08};    //the decoder specific 
+        const TInt frameSize = 2;  //constant as maximum size of decoderspecific info is 2
+
+        for (TInt a = 0 ; a < frameSize ; a++)
+            {
+            aDecSpecInfo->Des().Append(frameDecSpecInfo[a]);
+            }
+        
+        
+        return ETrue;
+        }
+      
+    else
+        {
+        return EFalse;
+        }
+    
+
+    }
+
+EXPORT_C TBool CAudSong::GetTimeEstimateL(MAudTimeEstimateObserver& aObserver,
+                                            TAudType aAudType,
+                                            TInt aSamplingRate,
+                                            TChannelMode aChannelMode,
+                                            TInt aBitRate)
+    {
+    
+    
+    if (iClipArray.Count() == 0)
+        {
+        return EFalse;
+        }
+    
+    if (SetOutputFileFormat(aAudType, aSamplingRate, aChannelMode, aBitRate))
+        {
+        return iProcessOperation->GetTimeEstimateL(aObserver);
+        
+        }
+    else
+        {
+        return EFalse;
+        }
+    
+    
+    }
+    
+EXPORT_C TTimeIntervalMicroSeconds CAudSong::GetTimeEstimateL()
+    {
+    TAudFileProperties prop;
+    TInt64 estimatedTime = TInt64(0);
+    TReal complexityFactor = 0.0;
+    TInt a;
+    
+	for (a = 0; a < iClipArray.Count() ; a++) 
+		{		
+		complexityFactor = 0.0;
+		
+		prop = iClipArray[a]->Info()->Properties();
+		if ( iClipArray[a]->Muting() )
+		    {
+		    // the clip is muted
+		    complexityFactor = KAEDMutingComplFactor;
+		    }
+		else if ( (prop.iAudioType != iProperties->iAudioType )
+		    || (prop.iChannelMode != iProperties->iChannelMode )
+		    || (prop.iSamplingRate != iProperties->iSamplingRate ) )
+		    {
+		    // need transcoding
+		    
+		    // decoding
+		    switch (prop.iAudioType)
+		        {
+	            case EAudAMR :
+	                {
+    		        // AMR decoding
+    		        complexityFactor = KAEDAMRDecComplFactor;
+	                }
+	                break;
+	            case EAudAAC_MPEG4 :
+	                {
+    		        // AAC decoding
+    		        complexityFactor = KAEDAACDecComplFactor;
+	                }
+	                break;
+	            case EAudAMRWB :
+	                {
+    		        // AMR-WB decoding
+    		        complexityFactor = KAEDAMRWBDecComplFactor;
+	                }
+	                break;
+	            case EAudMP3 :
+	                {
+    		        // MP3 decoding
+    		        complexityFactor = KAEDMP3DecComplFactor;
+	                }
+	                break;
+                default:
+                    {
+	                //EAudWAV
+    		        complexityFactor = KAEDWavDecComplFactor;
+                    }
+		        }
+	        if ( prop.iChannelMode == EAudStereo )
+	            {
+	            complexityFactor += KAEDAACStereoDecAddComplFactor;
+	            }
+	        if ( prop.iSamplingRate > 8000 )
+	            {
+	            complexityFactor *= prop.iSamplingRate/16000;
+	            }
+		        
+		        
+		    // encoding
+		    if (iProperties->iAudioType == EAudAMR)
+                {
+		        // AMR encoding
+		        complexityFactor += KAEDAMREncComplFactor;
+                }
+            else
+                {
+		        // AAC encoding
+		        complexityFactor += KAEDAACEncComplFactor;
+		        if ( iProperties->iChannelMode == EAudStereo )
+		            {
+		            complexityFactor += KAEDAACStereoEncAddComplFactor;
+		            }
+		        complexityFactor *= iProperties->iSamplingRate/16000;
+                }
+                
+                
+		    }
+		else if (iClipArray[a]->DynamicLevelMarkCount() > 0)
+		    {
+		    // need bitstream processing (level control etc)
+		    complexityFactor = KAEDBitstreamProcComplFactor;
+		    }
+		else
+		    {
+		    // just passing through
+		    complexityFactor = KAEDPassThroughComplFactor;
+		    }
+		    
+		    
+		
+        estimatedTime = estimatedTime + TInt64(complexityFactor * I64INT(iClipArray[a]->EditedDuration().Int64()));
+		}
+		
+    return estimatedTime;
+    }
+    
+EXPORT_C TInt CAudSong::GetFrameDurationMicro()
+    {
+    TInt frameDurationMicro = 20000; // AMR
+    
+    if (iProperties->iAudioType == EAudAAC_MPEG4)
+        {
+        frameDurationMicro = ((1024 * 1000) / iProperties->iSamplingRate) * 1000;
+        }
+        
+    return frameDurationMicro;
+    }
+    
+
+EXPORT_C TInt CAudSong::ClipCount(TInt aTrackIndex) const 
+    {
+
+
+    if (aTrackIndex == KAllTrackIndices)
+        {
+        return iClipArray.Count();
+
+        }
+
+    TInt amount = 0;
+    for (TInt a = 0; a < iClipArray.Count() ; a++) 
+        {    
+        if (iClipArray[a]->TrackIndex() == aTrackIndex) amount++;
+
+        }
+
+    return amount;
+
+    }
+
+
+EXPORT_C CAudClip* CAudSong::Clip(TInt aIndex, TInt aTrackIndex) const 
+    {
+    
+    if (aTrackIndex == KAllTrackIndices)
+        {
+        return iClipArray[aIndex];
+        }
+
+	
+	TInt index = 0;
+	TInt a = 0;
+	TBool found = EFalse;
+	
+	if (aTrackIndex == KAllTrackIndices)
+	    {
+	    return iClipArray[aIndex];
+	    }
+
+	for (a = 0; a < iClipArray.Count() ; a++) 
+		{		
+		
+		if (iClipArray[a]->TrackIndex() == aTrackIndex) index++;
+		
+		if (index == aIndex+1) 
+			{
+			found = ETrue;
+			break;
+			}
+		
+
+		}
+
+	if (found) 
+		{
+		return iClipArray[a];
+		}
+	else 
+		{
+		TAudPanic::Panic(TAudPanic::EAudioClipIllegalIndex);
+		}
+	return NULL;
+	}
+
+
+
+EXPORT_C void CAudSong::AddClipL(const TDesC& aFileName,
+        TTimeIntervalMicroSeconds aStartTime, TInt aTrackIndex,
+        TTimeIntervalMicroSeconds aCutInTime,
+        TTimeIntervalMicroSeconds aCutOutTime) 
+    {
+
+    PRINT((_L("CAudSong::AddClipL in")));
+    if (iAddOperation->iClip != 0) 
+        {
+        TAudPanic::Panic(TAudPanic::ESongAddOperationAlreadyRunning);
+        }
+    if (iProcessOperation->iProcessor != 0 ) 
+        {
+        TAudPanic::Panic(TAudPanic::ESongProcessingOperationAlreadyRunning);
+        }
+
+    
+    iAddOperation->iClip = CAudClip::NewL(this, aFileName, aStartTime, *iAddOperation, aTrackIndex);
+    iAddOperation->iClip->iCutInTime = aCutInTime;
+    iAddOperation->iClip->iCutOutTime = aCutOutTime;
+
+    PRINT((_L("CAudSong::AddClipL out")));
+
+    }
+    
+
+EXPORT_C void CAudSong::RemoveClip(TInt aIndex, TInt aTrackIndex) 
+    {
+    PRINT((_L("CAudSong::RemoveClip in")));
+
+    TInt index = -1;
+    TInt a = 0;
+    TBool found = EFalse;
+
+    for (a = 0; a < iClipArray.Count() ; a++) 
+        {        
+    
+        
+        if (iClipArray[a]->TrackIndex() == aTrackIndex) index++;
+        
+        if (index == aIndex) 
+            {
+            found = ETrue;
+            break;
+            }
+        
+        }
+    
+    
+    if (found) 
+        {
+        
+        CAudClip* clip = iClipArray[a];
+        iClipArray.Remove(a);
+        delete clip;        
+        UpdateClipIndexes();
+        FireClipRemoved(this, aIndex, aTrackIndex);
+        }
+    else 
+        {
+        TAudPanic::Panic(TAudPanic::EAudioClipIllegalIndex);
+        }
+    
+    PRINT((_L("CAudSong::RemoveClip out")));
+
+    }
+
+
+EXPORT_C TBool CAudSong::SetOutputFileFormat(TAudType aAudType,
+                                            TInt aSamplingRate,
+                                            TChannelMode aChannelMode,
+                                            TInt aBitRate)
+    {
+    PRINT((_L("CAudSong::SetOutputFileFormat in")));
+    
+    // allow both EAudAAC_MPEG2 and EAudAAC_MPEG4
+    // as inpyt type, but consider all AAC_ MPEG as mpeg4
+    
+    if (aAudType == EAudAAC_MPEG2) 
+        {
+        aAudType = EAudAAC_MPEG4;
+        }
+    
+    // make sure the given parameters are correct
+   
+    if (aBitRate == KAudBitRateDefault)
+        {
+        // the defaut bitrates:
+        PRINT((_L("CAudSong::SetOutputFileFormat use default bitrate")));
+        if (aAudType == EAudAMR)
+            {
+            aBitRate = KAedBitRateAMR;
+            }
+        else if (aAudType == EAudAAC_MPEG4)
+            {
+            if (aSamplingRate == KAedSampleRate16kHz) 
+                {
+                aBitRate = KAedBitRateAAC16kHz;
+                }
+            else 
+                {
+                aBitRate = KAedBitRateAAC48kHz;
+                }
+            }
+        }
+    
+    if (aAudType == EAudAAC_MPEG4)
+        {
+        
+        iProperties->iAudioType = EAudAAC_MPEG4; 
+        iProperties->iAACObjectType = EAudAACObjectTypeLC;
+        
+        TInt channels = (aChannelMode == EAudSingleChannel) ? 1 : 2;
+        
+        // legal sampling rates are 16000 and 48000 Hz      
+        if (aSamplingRate == KAedSampleRate16kHz)
+            {
+            if (aBitRate < KAedAACMinBitRateMultiplier * KAedSampleRate16kHz * channels ||
+                aBitRate > KAedAACMaxBitRateMultiplier * KAedSampleRate16kHz * channels)
+                {
+                // illegal bitrate
+                PRINT((_L("CAudSong::SetOutputFileFormat out, unsupported bitrate given")));
+                return EFalse;
+                }
+            else 
+                {
+                iProperties->iSamplingRate = aSamplingRate;
+                iProperties->iBitrate = aBitRate;
+                iProperties->iChannelMode = aChannelMode;
+                }
+            }
+        else if (aSamplingRate == KAedSampleRate48kHz)
+            {
+            if (aBitRate < KAedAACMinBitRateMultiplier * KAedSampleRate48kHz * channels ||
+                aBitRate > KAedAACMaxBitRateMultiplier * KAedSampleRate48kHz * channels)
+                {
+                // illegal bitrate
+                PRINT((_L("CAudSong::SetOutputFileFormat out, unsupported bitrate given")));
+                return EFalse;
+                }
+            else 
+                {
+                iProperties->iSamplingRate = aSamplingRate;
+                iProperties->iBitrate = aBitRate;
+                iProperties->iChannelMode = aChannelMode;
+                }
+            }
+        else
+            {
+            PRINT((_L("CAudSong::SetOutputFileFormat out, unsupported sampling rate given")));
+            return EFalse;
+            }
+            
+        }
+        
+    
+    else if (aAudType == EAudAMR)
+        {
+        
+        iProperties->iAudioType = EAudAMR;
+        // for AMR the bitrate is always set to 12200 and sampling rate to 8000
+        iProperties->iSamplingRate = KAedSampleRate8kHz;
+        iProperties->iBitrate = KAedBitRateAMR;
+        iProperties->iChannelMode = EAudSingleChannel;
+        
+        }
+        
+    else 
+        {
+        PRINT((_L("CAudSong::SetOutputFileFormat out, unsupported output format given")));
+        return EFalse;
+        }
+    
+
+    PRINT((_L("CAudSong::SetOutputFileFormat out")));
+    return ETrue;
+    }
+
+EXPORT_C TBool CAudSong::AreOutputPropertiesSupported(const TAudFileProperties& aProperties )
+    {
+    if (   ( aProperties.iAudioType == EAudAAC_MPEG4 )
+        && ((aProperties.iSamplingRate == KAedSampleRate16kHz) 
+        ||  (aProperties.iSamplingRate == KAedSampleRate48kHz)))
+        {
+        return ETrue;
+        }
+    else if ( (aProperties.iAudioType == EAudAMR) 
+        &&    (aProperties.iSamplingRate == KAedSampleRate8kHz))
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+    
+
+EXPORT_C TBool CAudSong::SyncStartProcessingL()
+    {
+    PRINT((_L("CAudSong::SyncStartProcessingL")));
+    return iProcessOperation->StartSyncProcL();    
+    }
+
+EXPORT_C TBool CAudSong::SyncProcessFrameL(HBufC8*& aFrame, TInt& aProgress,
+                                       TTimeIntervalMicroSeconds& aDuration)
+    {
+    PRINT((_L("CAudSong::SyncProcessFrameL in")));
+    
+    aFrame = 0;
+    TBool ret = iProcessOperation->ProcessSyncPieceL(aFrame, aProgress, aDuration);
+    
+#ifdef _WRITE_OUTPUT_TO_FILE_
+    
+    
+    if (!ret)
+        {
+        
+        if (iFileOpen)
+            {
+        
+        
+        
+            TBuf8<32> mes;
+            mes.Append(_L8("aProgress: "));
+            mes.AppendNum(aProgress);
+            mes.Append(_L8("aDuration: "));
+            mes.AppendNum(I64INT(aDuration.Int64()/1000));
+            mes.Append(_L8("\n"));
+            
+            
+            iTextFile.Write(mes);
+            
+            
+            if (iProperties->iAudioType == EAudAMR)
+                {
+                iAudioFile.Write(aFrame->Des());
+                
+                }
+            else
+                {
+                TBuf8<7> adtsHeader;
+                
+                ProcTools::GenerateADTSHeaderL(adtsHeader, aFrame->Size(), *iProperties);
+                iAudioFile.Write(adtsHeader);
+                iAudioFile.Write(aFrame->Des());
+                
+                }
+            
+            }
+        
+        }
+    
+#endif
+    
+    PRINT((_L("CAudSong::SyncProcessFrameL out")));
+    return ret;
+
+    }
+
+EXPORT_C void CAudSong::SyncCancelProcess() 
+    {
+    
+    iProcessOperation->Cancel();
+
+    }
+
+
+EXPORT_C void CAudSong::Reset(TBool aNotify) 
+    {
+    iSongDurationManuallySet = EFalse;
+
+    iDynamicLevelMarkArray.ResetAndDestroy();
+    iClipArray.ResetAndDestroy();
+
+    if (aNotify) 
+        {
+        FireSongReseted(*this);
+        }
+    }
+
+EXPORT_C TBool CAudSong::SetDuration(TTimeIntervalMicroSeconds aDuration)
+    {
+
+    if (aDuration.Int64() > 0) 
+        {
+        iSongDuration = aDuration;
+        iSongDurationManuallySet = ETrue;
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+
+
+EXPORT_C void CAudSong::RegisterSongObserverL(MAudSongObserver* aObserver) 
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        if (iObserverArray[i] == aObserver)
+            {
+            TAudPanic::Panic(TAudPanic::ESongObserverAlreadyRegistered);
+            }
+        }
+
+    User::LeaveIfError(iObserverArray.Append(aObserver));
+    }
+
+
+EXPORT_C void CAudSong::UnregisterSongObserver(MAudSongObserver* aObserver) 
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++) 
+        {
+        if (iObserverArray[i] == aObserver) 
+            {
+            iObserverArray.Remove(i);
+            return;
+            }
+        }
+
+    TAudPanic::Panic(TAudPanic::ESongObserverNotRegistered);
+    }
+
+
+void CAudSong::UpdateClipIndexes() 
+    {
+
+    for (TInt i = 0; i < iClipArray.Count() ; i++)
+        {
+        
+        iClipArray[i]->iIndex = Index2IndexOnTrack(i);
+        
+        }
+    
+    }
+
+void CAudSong::UpdateClipArray() 
+    {
+
+    TLinearOrder<CAudClip> order(CAudClip::Compare);
+    iClipArray.Sort(order);
+
+
+    }
+
+TInt CAudSong::Index2IndexOnTrack(TInt aIndex) 
+    {
+
+    if (aIndex > iClipArray.Count()) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+    TInt indexOnTrack = 0;
+    TInt trackIndex = iClipArray[aIndex]->TrackIndex();
+
+    for (TInt a = 0; a < aIndex ; a++) 
+        {
+            
+        if (iClipArray[a]->TrackIndex() == trackIndex) 
+            {
+            indexOnTrack++;
+            }
+
+        }
+    return indexOnTrack;
+    }
+
+TInt CAudSong::FindClipIndexOnSong(const CAudClip* aClip) const 
+    {
+    
+    for (TInt index = 0 ; index < iClipArray.Count() ; index++) 
+        {
+        if (iClipArray[index] == aClip) 
+            {
+            return index;
+            }
+        }
+
+    // if the clip is not in the array...
+    TAudPanic::Panic(TAudPanic::EInternal);
+    return 0;
+
+    }
+
+void CAudSong::FireClipAdded(CAudSong* aSong, CAudClip* aClip, TInt aIndex, TInt aTrackIndex) 
+    {
+
+    for (TInt i = 0; i < iObserverArray.Count(); i++) 
+        {
+        iObserverArray[i]->NotifyClipAdded(*aSong, *aClip, aIndex, aTrackIndex);
+        }
+    }
+    
+void CAudSong::FireClipAddingFailed(CAudSong* aSong, TInt aError, TInt aTrackIndex) 
+    {
+
+    for (TInt i = 0; i < iObserverArray.Count(); i++) 
+        {
+        iObserverArray[i]->NotifyClipAddingFailed(*aSong, aError, aTrackIndex);
+        }
+    }
+
+void CAudSong::FireClipRemoved(CAudSong* aSong, TInt aIndex, TInt aTrackIndex) 
+    {
+    
+    for (TInt i = 0; i < iObserverArray.Count(); i++) 
+        {
+        iObserverArray[i]->NotifyClipRemoved(*aSong, aIndex, aTrackIndex);
+        }
+
+    }
+
+void CAudSong::FireClipIndicesChanged(CAudSong* aSong, TInt aOldIndex, 
+                                      TInt aNewIndex, TInt aTrackIndex) 
+    {
+    
+    for (TInt i = 0; i < iObserverArray.Count(); i++) 
+        {
+        iObserverArray[i]->NotifyClipIndicesChanged(*aSong, aOldIndex, aNewIndex, aTrackIndex);
+        }
+    }
+
+void CAudSong::FireClipTimingsChanged(CAudSong* aSong, CAudClip* aClip)    
+    {
+
+    
+    for (TInt i = 0; i < iObserverArray.Count(); i++) 
+        {
+        iObserverArray[i]->NotifyClipTimingsChanged(*aSong, *aClip);
+        }
+
+    }
+
+    
+void CAudSong::FireDynamicLevelMarkInserted(CAudClip& aClip, 
+        TAudDynamicLevelMark& aMark, 
+        TInt aIndex) 
+    {
+    
+    for (TInt i = 0; i < iObserverArray.Count(); i++) 
+        {
+        iObserverArray[i]->NotifyDynamicLevelMarkInserted(aClip, aMark, aIndex);
+        }
+
+
+    }
+
+void CAudSong::FireDynamicLevelMarkRemoved(CAudClip& aClip, TInt aIndex) 
+    {
+
+    for (TInt i = 0; i < iObserverArray.Count(); i++) 
+        {
+        iObserverArray[i]->NotifyDynamicLevelMarkRemoved(aClip, aIndex);
+        }
+
+    }
+
+void CAudSong::FireSongReseted(CAudSong& aSong) 
+    {
+
+    for (TInt i = 0; i < iObserverArray.Count(); i++) 
+        {
+        iObserverArray[i]->NotifySongReseted(aSong);
+        }
+    }
+
+void CAudSong::FireClipReseted(CAudClip& aClip) 
+    {
+
+    for (TInt i = 0; i < iObserverArray.Count(); i++) 
+        {
+        iObserverArray[i]->NotifyClipReseted(aClip);
+        }
+    }
+
+
+
+CAudSongProcessOperation* CAudSongProcessOperation::NewL(CAudSong* aSong)
+    {
+    CAudSongProcessOperation* self = 
+        new (ELeave) CAudSongProcessOperation(aSong);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+CAudSongProcessOperation::CAudSongProcessOperation(CAudSong* aSong)
+: iSong(aSong), iObserver(0), iProcessor(0)
+    {
+
+    }
+
+
+void CAudSongProcessOperation::ConstructL()
+    {
+    }
+
+CAudSongProcessOperation::~CAudSongProcessOperation()
+    {
+
+    if (iProcessor != 0)
+        {
+        delete iProcessor;
+        iProcessor = 0;
+
+        }
+
+    }
+
+
+
+void CAudSongProcessOperation::NotifyAudioProcessingStartedL() 
+    {
+    if (iObserver != 0)
+        iObserver->NotifyAudioProcessingStartedL(*iSong);
+
+    }
+void CAudSongProcessOperation::NotifyAudioProcessingProgressed(TInt aPercentage) 
+    {
+    if (iObserver != 0)
+        iObserver->NotifyAudioProcessingProgressed(*iSong, aPercentage);
+
+    }
+void CAudSongProcessOperation::NotifyAudioProcessingCompleted(TInt aError) 
+    {
+
+    delete iProcessor;
+    iProcessor = 0;
+
+    MAudSongProcessingObserver* observer = iObserver;
+    iObserver = 0;
+    if (observer != 0)
+        {
+        observer->NotifyAudioProcessingProgressed(*iSong, 100);
+        observer->NotifyAudioProcessingCompleted(*iSong, aError);
+        }
+    }
+
+void CAudSongProcessOperation::NotifyTimeEstimateReady(TInt64 aTimeEstimate) 
+    {
+
+    delete iProcessor;
+    iProcessor = 0;
+
+    MAudTimeEstimateObserver* observer = iTEObserver;
+    iTEObserver = 0;
+    
+    if (observer != 0)
+        {
+        observer->NotifyTimeEstimateReady(aTimeEstimate);
+        }
+    }
+
+
+TBool CAudSongProcessOperation::StartSyncProcL()
+    {
+
+    if (iProcessor != 0) 
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    CAudProcessor* processor = CAudProcessor::NewLC();
+    TBool ret = processor->StartSyncProcessingL(iSong);
+    CleanupStack::Pop(processor);
+    iProcessor = processor;
+
+    return ret;
+
+    }
+
+TBool CAudSongProcessOperation::ProcessSyncPieceL(HBufC8*& aFrame, TInt& aProgress,
+                                       TTimeIntervalMicroSeconds& aDuration)
+    {
+    TBool ret = iProcessor->ProcessSyncPieceL(aFrame, aProgress, aDuration);
+    if (!ret) return EFalse;
+    else
+        {
+        delete iProcessor;
+        iProcessor = 0;
+        return ETrue;
+
+        }
+    
+    }
+
+
+void CAudSongProcessOperation::Cancel() 
+    {
+
+    if (iProcessor == 0) 
+        {
+        TAudPanic::Panic(TAudPanic::ESongProcessingOperationNotRunning);
+        }
+    else 
+        {
+        iProcessor->CancelProcessing(*this);
+        }
+    }
+
+TBool CAudSongProcessOperation::GetTimeEstimateL(MAudTimeEstimateObserver& aTEObserver)
+    {
+    
+    
+    
+    if (iProcessor != 0)
+        {
+        User::Leave(KErrNotReady);
+        }
+    iTEObserver = &aTEObserver;
+    
+    CAudProcessor* processor = CAudProcessor::NewLC();
+    
+    
+    TBool ret = processor->StartTimeEstimateL(iSong, *this);
+    CleanupStack::Pop(processor);
+    iProcessor = processor;
+
+    return ret;
+    
+    }
+
+
+CAudSongAddClipOperation* CAudSongAddClipOperation::NewL(CAudSong* aSong)
+    {
+    CAudSongAddClipOperation* self = 
+        new (ELeave) CAudSongAddClipOperation(aSong);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+CAudSongAddClipOperation::CAudSongAddClipOperation(CAudSong* aSong)
+        : iSong(aSong), iClip(0)
+    {
+    }
+
+
+void CAudSongAddClipOperation::ConstructL()
+    {
+    }
+
+
+CAudSongAddClipOperation::~CAudSongAddClipOperation()
+    {
+    if (iClip)
+        {
+        delete iClip;
+        iClip = 0;
+        }
+
+    }
+
+
+void CAudSongAddClipOperation::NotifyClipInfoReady(CAudClipInfo& /*aInfo*/, 
+                                                         TInt aError)
+    {
+
+
+    iError = aError;
+    CompleteAddClipOperation();
+
+    }
+
+
+void CAudSongAddClipOperation::CompleteAddClipOperation()
+    {
+    PRINT((_L("CAudSongAddClipOperation::CompleteAddClipOperation in")));
+
+
+    if (iError != KErrNone)
+        {
+        TInt trackIndex = iClip->TrackIndex();
+        delete iClip;
+        iClip = 0;
+        iSong->FireClipAddingFailed(iSong, iError, trackIndex);
+        PRINT((_L("CAudSong::CompleteAddClipOperation failed, out")));
+        return;
+        }
+    else
+        {
+    
+        TAudFileProperties info = iClip->iInfo->Properties();
+
+        if (iSong->iClipArray.Count() > 0)
+            {
+            if (!(info.isCompatible(iSong->iClipArray[0]->Info()->Properties()))) 
+                {
+                TInt trackIndex = iClip->TrackIndex();
+        
+                delete iClip;
+                iClip = 0;
+                iSong->FireClipAddingFailed(iSong, KErrNotSupported, trackIndex);
+                PRINT((_L("CAudSong::CompleteAddClipOperation failed, out")));
+                return;
+                }
+            }
+        
+        if (iClip->CutOutTime() == TTimeIntervalMicroSeconds(KClipEndTime))
+            {
+    
+            iClip->iCutOutTime = info.iDuration;
+            }
+
+            
+        TInt err = KErrNone;
+
+        TBool added = EFalse;
+
+        // insert clips so that they are always sorted by start time
+        TInt index = 0;
+        for (index = 0 ; index < iSong->iClipArray.Count() ; index++) 
+            {
+            if (iSong->iClipArray[index]->StartTime() > iClip->StartTime()) 
+                {
+                err = iSong->iClipArray.Insert(iClip, index);
+                added = ETrue;
+                break;
+                }
+            }
+        if (!added) 
+            {
+            index = iSong->iClipArray.Count();
+            err = iSong->iClipArray.Insert(iClip, index);
+            if (err != KErrNone)
+                {
+                TInt trackIndex = iClip->TrackIndex();
+                delete iClip;
+                iClip = 0;
+                iSong->FireClipAddingFailed(iSong, KErrGeneral, trackIndex);
+                PRINT((_L("CAudSong::CompleteAddClipOperation failed, out")));
+                return;
+                }
+            
+            }
+        iClip->iIndex = iSong->Index2IndexOnTrack(index);
+        
+        if (err != KErrNone) 
+            {
+            TInt trackIndex = iClip->TrackIndex();
+        
+            delete iClip;
+            iClip = 0;
+            iSong->FireClipAddingFailed(iSong, err, trackIndex);            
+            }
+        else
+            {
+            iSong->UpdateClipIndexes();
+            CAudClip* clip = iClip;
+            iClip = 0;
+            
+
+            if (clip->EndTime() > iSong->iSongDuration)
+                {
+                iSong->iSongDuration = clip->EndTime();
+                }
+            
+
+            iSong->FireClipAdded(iSong, clip, clip->iIndex, clip->iTrackIndex);
+
+            
+            }
+        }
+    PRINT((_L("CAudSongAddClipOperation::CompleteAddClipOperation out")));
+    }    
+    
+EXPORT_C void CAudSong::AddClipL(RFile* aFileHandle,
+        TTimeIntervalMicroSeconds aStartTime, TInt aTrackIndex,
+        TTimeIntervalMicroSeconds aCutInTime,
+        TTimeIntervalMicroSeconds aCutOutTime) 
+    {
+
+    PRINT((_L("CAudSong::AddClipL in")));
+    if (iAddOperation->iClip != 0) 
+        {
+        TAudPanic::Panic(TAudPanic::ESongAddOperationAlreadyRunning);
+        }
+    if (iProcessOperation->iProcessor != 0 ) 
+        {
+        TAudPanic::Panic(TAudPanic::ESongProcessingOperationAlreadyRunning);
+        }
+
+    iAddOperation->iClip = CAudClip::NewL(this, aFileHandle, aStartTime, *iAddOperation, aTrackIndex);
+    iAddOperation->iClip->iCutInTime = aCutInTime;
+    iAddOperation->iClip->iCutOutTime = aCutOutTime;
+
+    PRINT((_L("CAudSong::AddClipL out")));
+
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/ProcClipInfoAO.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+
+#include "ProcClipInfoAO.h"
+
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+void CProcClipInfoAO::RunL() 
+    {
+    PRINT((_L("CProcClipInfoAO::RunL in") ));
+    
+
+    TRAPD(error, iProcessorImpl->GetAudFilePropertiesL(*iFileName, iFileHandle, iProperties));
+
+    if (error != KErrNone) 
+        {
+        
+        delete iFileName;
+        iFileName = 0;
+        delete iProcessorImpl;
+        iProcessorImpl = 0;
+        iObserver->NotifyClipInfoReady(error);
+        iProperties = 0;
+        iObserver = 0;
+        PRINT((_L("CProcClipInfoAO::RunL out with error %d"), error ));
+        return;
+        }
+    else 
+        {
+        
+        
+        delete iFileName;
+        iFileName = 0;
+        delete iProcessorImpl;
+        iProcessorImpl = 0;
+        
+        if (iProperties->iAudioType == EAudNoAudio)
+            {
+            MProcClipInfoObserver* observer = iObserver;
+            
+            iObserver = 0;
+            observer->NotifyClipInfoReady(KErrNoAudio); 
+            PRINT((_L("CProcClipInfoAO::RunL no audio in the clip") ));
+
+            }
+        else if (iProperties->iAudioType == EAudTypeUnrecognized ||
+            iProperties->iBitrate == 0 ||
+            iProperties->iBitrateMode == EAudBitrateModeNotRecognized || 
+            iProperties->iFileFormat == EAudFormatUnrecognized ||
+            iProperties->iChannelMode == EAudChannelModeNotRecognized ||
+            iProperties->iSamplingRate == 0) 
+            {
+            MProcClipInfoObserver* observer = iObserver;
+            
+            iObserver = 0;
+            observer->NotifyClipInfoReady(KErrNotSupported); 
+            PRINT((_L("CProcClipInfoAO::RunL audio in the clip not supported") ));
+            }
+        else 
+            {
+            MProcClipInfoObserver* observer = iObserver;
+            
+            iObserver = 0;
+            observer->NotifyClipInfoReady(KErrNone); 
+            }
+        
+        }
+    
+    PRINT((_L("CProcClipInfoAO::RunL out") ));
+
+
+    }
+
+void CProcClipInfoAO::DoCancel() 
+    {
+
+    }
+   
+CProcClipInfoAO* CProcClipInfoAO::NewL() 
+    {
+
+
+    CProcClipInfoAO* self = new (ELeave) CProcClipInfoAO();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CProcClipInfoAO::~CProcClipInfoAO() 
+    {
+    PRINT((_L("CProcClipInfoAO::~CProcClipInfoAO() in") ));
+    
+    Cancel();
+    
+    if (iFileName)
+        {
+        delete iFileName;
+        iFileName = 0;
+        }
+    
+    if (iProcessorImpl)
+        {
+        delete iProcessorImpl;
+        iProcessorImpl = 0;
+        }
+
+    PRINT((_L("CProcClipInfoAO::~CProcClipInfoAO() out") ));
+    }
+    
+
+void CProcClipInfoAO::StartL(const TDesC& aFilename, 
+                             RFile* aFileHandle,
+                             MProcClipInfoObserver &aObserver, 
+                             TAudFileProperties* aProperties,
+                             TInt aPriority) 
+    {
+
+    iObserver = &aObserver;
+    iProperties = aProperties;
+
+    if (!aFileHandle)
+    {        
+        iFileName = HBufC::NewL(aFilename.Length());
+        *iFileName = aFilename;
+        iFileHandle = NULL;
+    } 
+    else
+    {        
+        iFileHandle = aFileHandle;
+        iFileName = HBufC::NewL(1);
+    }
+    
+    CAudProcessorImpl* processorImpl = CAudProcessorImpl::NewLC();
+    
+    CleanupStack::Pop(processorImpl);
+    iProcessorImpl = processorImpl;
+    
+    SetPriority(aPriority);
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+
+    }
+    
+
+
+void CProcClipInfoAO::ConstructL() 
+    {
+
+    }
+
+CProcClipInfoAO::CProcClipInfoAO() :  CActive(0), iProperties(0), iFileName(0)
+                                       
+    {
+
+    CActiveScheduler::Add(this);
+
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/ProcDecoder.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,950 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "ProcDecoder.h"
+#include "audconstants.h"
+#include    <MmfDatabuffer.h>
+#include    <mmfcontrollerpluginresolver.h>
+#include    <mmf/plugin/mmfCodecImplementationUIDs.hrh>
+#include    <MMFCodec.h>
+
+
+// CONSTANTS
+
+
+
+
+
+// MACROS
+
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+
+CProcDecoder* CProcDecoder::NewL()
+                            
+    {
+    CProcDecoder* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    
+    }
+
+
+CProcDecoder* CProcDecoder::NewLC()
+                                
+    {
+
+    CProcDecoder* self = new (ELeave) CProcDecoder();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    
+    }
+
+CProcDecoder::~CProcDecoder()
+    {
+    
+    delete iSourceInputBuffer;
+    
+    // Input buffer for encoder (alternative output buffer for decoder).
+    delete  iDestInputBuffer;
+        
+    // Codec used in decoding input audio to PCM16
+    delete iSourceCodec;
+    
+    delete iSampleRateChannelBuffer;
+    
+    delete iRateConverter;
+        
+    }
+ 
+TBool CProcDecoder::InitL(TAudFileProperties aProperties, TInt aTargetSamplingRate, TChannelMode aChannelMode)
+    {
+    PRINT((_L("CProcDecoder::InitL() in")));
+    
+    if (aTargetSamplingRate == 0)
+        {
+        
+        // we are just adding a clip now, check if the source codec is available
+        iProperties = aProperties;    
+        SetSourceCodecL();
+        
+        return ETrue;
+        }
+    
+    
+    iDecimFactor = 0; // by default
+    
+    iDoDecoding = ETrue;
+    
+    if (aProperties.iAudioType == EAudWAV)
+        {
+        // if input is PCM, no decoding is required, but possibly sample rate conversion
+        iDoDecoding = EFalse;
+        }
+    
+    
+    
+    // set output params
+    iToSampleRate = aTargetSamplingRate;
+    iToChannels = 1;
+    
+    if (aChannelMode == EAudStereo)
+        {
+        iToChannels = 2;    
+        }
+    
+    
+    //set input params
+    iProperties = aProperties;
+    
+    iFromSampleRate = iProperties.iSamplingRate;
+    
+    iFromChannels = 1;
+    
+    if (aProperties.iChannelMode == EAudStereo)
+        {
+        iFromChannels = 2;    
+        }
+    
+    
+    iDoSampleRateChannelConversion = EFalse;
+    if (iFromSampleRate != iToSampleRate || iProperties.iChannelMode != aChannelMode)
+        {
+        // sample rate or channel conversion is needed
+        iDoSampleRateChannelConversion = ETrue;
+        }
+    
+ 
+    PRINT((_L("CProcDecoder::PrepareConverterL() in")));
+    
+    TInt destInputBufferSize = 0;
+    TInt sourceInputBufferSize = 0;
+    
+    // buffer sizes for input and output
+    if ( iProperties.iAudioType == EAudAMR )
+        {
+        destInputBufferSize = KAedSizeAMRBuffer;
+        sourceInputBufferSize = KAedMaxAMRFrameLength;
+       
+        }
+    else if ( iProperties.iAudioType == EAudAMRWB )
+        {
+        destInputBufferSize = KAedSizeAWBBuffer;
+        sourceInputBufferSize = KAedMaxAWBFrameLength;
+       
+        }
+    else if (iProperties.iAudioType == EAudAAC_MPEG4 &&
+             iProperties.iAudioTypeExtension == EAudExtensionTypeNoExtension)
+        {
+        if ( aProperties.iChannelMode == EAudSingleChannel )
+            {
+            destInputBufferSize = KAedSizeAACBuffer;
+            sourceInputBufferSize = KAedMaxAACFrameLengthPerChannel;
+            }
+        else
+            {
+            destInputBufferSize = KAedSizeAACStereoBuffer;
+            sourceInputBufferSize = 2* KAedMaxAACFrameLengthPerChannel;
+            }
+                 
+        }
+    else if (iProperties.iAudioType == EAudAAC_MPEG4 &&
+             iProperties.iAudioTypeExtension != EAudExtensionTypeNoExtension)
+        {
+        if ( iProperties.iAudioTypeExtension == EAudExtensionTypeEnhancedAACPlusParametricStereo )
+            {
+            // output is parametric stereo (mono channel, but decoded to stereo)
+            destInputBufferSize = KAedSizeAACStereoBuffer*2; // 2 for eAAC+
+            sourceInputBufferSize = KAedMaxAACFrameLengthPerChannel;
+            }
+        else
+            {
+            // output is normal stereo
+            destInputBufferSize = KAedSizeAACBuffer*2; // 2 for eAAC+
+            sourceInputBufferSize = 2* KAedMaxAACFrameLengthPerChannel;
+            }
+            
+                 
+        }
+    
+    else if ( iProperties.iAudioType == EAudMP3 )
+        {
+        // mp3 can be directly decoded to mono if necessary
+        if (iToChannels == 1)
+            {
+            iFromChannels = 1;
+            }
+        
+        // check if decimation would be useful    
+        if (iFromSampleRate == iToSampleRate * 4)
+            {
+            iFromSampleRate /= 4;
+            iDecimFactor = 4;
+            }
+            
+        if (iFromSampleRate == iToSampleRate * 2)
+            {
+            iFromSampleRate /= 2;
+            iDecimFactor = 2;
+            }
+            
+        if ((iToSampleRate == 8000) && ((iFromSampleRate == 48000) || (iFromSampleRate == 44100)))
+            {
+            iFromSampleRate /= 2;
+            iDecimFactor = 2;
+            }        
+        
+        const TReal KMP3FrameDurationSec = 0.026;
+        
+        destInputBufferSize =  (iFromSampleRate * KMP3FrameDurationSec + 1);
+        destInputBufferSize *= 2; //16 bit samples
+        if (iFromChannels == 2)
+            {
+            destInputBufferSize *= 2; // stereo
+            }
+        
+        sourceInputBufferSize = KAedMaxMP3FrameLength;
+        }
+        
+    else if (iProperties.iAudioType == EAudWAV)
+        {
+        // frame duration in WAV case is always 20 ms, that is 50 frames per sec
+        const TInt KNumberOfFramesInSecond = 50;
+            
+        destInputBufferSize = iFromSampleRate / KNumberOfFramesInSecond;    // Number of samples
+        destInputBufferSize *= iFromChannels;
+        if ((destInputBufferSize % 2) != 0) destInputBufferSize++;          // Must be even
+        destInputBufferSize *= 2;                                           // 16-bit samples
+        
+        sourceInputBufferSize = iProperties.iFrameLen;
+        
+        TInt sourceBufferSizeAfterExpansion = sourceInputBufferSize;
+        if (iProperties.iNumberOfBitsPerSample == 8)
+            {
+            // 8-bit samples are expanded to 16-bit so twice as big buffer is needed
+            sourceBufferSizeAfterExpansion *= 2;
+            }
+        
+        if (sourceBufferSizeAfterExpansion > destInputBufferSize)
+            {
+            // Make sure there's no overflow
+            destInputBufferSize = sourceBufferSizeAfterExpansion;
+            }
+        }
+        
+    PRINT((_L("CProcDecoder::InitL() source size: %d, dest size %d"), sourceInputBufferSize, destInputBufferSize));
+    
+
+    if ( iSourceInputBuffer )
+        {
+        delete iSourceInputBuffer;
+        iSourceInputBuffer = NULL;
+        }
+    // create buffer for input data
+    iSourceInputBuffer = CMMFDataBuffer::NewL(sourceInputBufferSize);
+    
+    
+    if ( iDestInputBuffer )
+        {
+        delete iDestInputBuffer;
+        iDestInputBuffer = NULL;
+        }
+
+    
+    TInt errC = KErrNone;
+    if (iDoDecoding)
+        {
+        SetSourceCodecL();
+        
+        // create buffer for output data if necessary
+        iDestInputBuffer = CMMFDataBuffer::NewL( destInputBufferSize);
+        }
+    
+
+
+    TInt err = KErrNone;
+
+    if (iProperties.iAudioType == EAudAAC_MPEG4)
+        {
+        // configure AAC plus decoder, used also for AAC
+        TRAP( err, ConfigureAACPlusDecoderL());
+        
+        }
+    
+    else if ( iProperties.iAudioType == EAudMP3 )
+        {
+        // configure mp3 decoder
+        TRAP( err, ConfigureMP3DecoderL());
+        
+        }
+    if (err != KErrNone || errC != KErrNone)
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    if ( iDoSampleRateChannelConversion )
+        {
+        if (iRateConverter)
+            {
+            delete iRateConverter;
+            iRateConverter = NULL;
+            }
+
+        iRateConverter = CRateConverter::NewL(iFromSampleRate, iToSampleRate, iFromChannels, iToChannels);
+        
+        if( !iRateConverter->InitL(destInputBufferSize / (2 * iFromChannels)) ) // 16-bit samples
+            {
+            User::Leave(KErrNotSupported);
+            }
+            
+        TInt sampleRateBufferSize = iRateConverter->GetOutputBufferSize() * 2 * iToChannels;    // 16-bit samples
+        
+        PRINT((_L("CProcDecoder::InitL() sample rate buffer size %d"), sampleRateBufferSize));
+               
+        if ( iSampleRateChannelBuffer )
+            {
+            delete iSampleRateChannelBuffer;
+            iSampleRateChannelBuffer = NULL;
+            }
+
+        // Buffer for sample rate conversion output
+        iSampleRateChannelBuffer = CMMFDataBuffer::NewL(sampleRateBufferSize);
+        }
+
+
+    iReady = ETrue;
+    PRINT((_L("CProcDecoder::InitL() out")));
+
+    
+    return ETrue;
+    }
+
+TBool CProcDecoder::FillDecBufferL(const HBufC8* aEncFrame, HBufC8*& aDecBuffer)
+    {
+    PRINT((_L("CProcDecoder::FillDecBufferL() in")));
+    
+    iDecBuffer = 0;
+    if (iProperties.iAudioType == EAudWAV && !iDoSampleRateChannelConversion)
+        {
+        
+        // if we don't have to do anything for input data ->
+        aDecBuffer = HBufC8::NewL(aEncFrame->Size());
+        aDecBuffer->Des().Append(*aEncFrame);
+        PRINT((_L("CProcDecoder::FillDecBufferL() out from Wav branch with ETrue")));
+        return ETrue;
+
+        }
+        
+        
+    if (!iReady)
+        {
+        User::Leave(KErrNotReady);
+        }
+      
+    if ( aEncFrame == 0 || !aEncFrame->Length() )
+        {
+        // no data in input buffer
+        PRINT((_L("CProcDecoder::FillDecBufferL() no input data, out with EFalse")));
+        return EFalse;
+        }
+    
+    if ( (TInt)(aEncFrame->Length() + iSourceInputBuffer->Position() ) > iSourceInputBuffer->Data().MaxLength() )
+        {
+        
+        ReAllocBufferL( iSourceInputBuffer, aEncFrame->Length() + iSourceInputBuffer->Position() );
+        }
+    
+    iSourceInputBuffer->Data().SetLength( 0 );
+    iSourceInputBuffer->SetPosition( 0 );
+    
+    iSourceInputBuffer->Data().Append( *aEncFrame );
+    iSourceInputBuffer->Data().SetLength( aEncFrame->Length() );
+    
+    PRINT((_L("CProcDecoder::FillDecBufferL(), iSourceInputBuffer length = %d"),aEncFrame->Length()));
+    if (iDoDecoding)
+        {
+        iDestInputBuffer->Data().SetLength(0);
+        iDestInputBuffer->SetPosition(0); 
+        
+        }
+            
+    if ( iDoSampleRateChannelConversion )
+        {
+        iSampleRateChannelBuffer->Data().SetLength(0);
+        iSampleRateChannelBuffer->SetPosition(0);
+        }
+        
+    
+    FeedCodecL( iSourceCodec, iSourceInputBuffer, iDestInputBuffer);
+ 
+    if ( aDecBuffer )
+        {
+        // in case of EDstNotFilled from decoder, you may end up looping and to avoid memory leaks, you need to 
+        // delete the previous allocated buffer. Alternative might be to not allocate a new one in this case.
+        delete aDecBuffer;
+        aDecBuffer = NULL;
+        }
+    aDecBuffer = iDecBuffer;    
+            
+    if (iDoDecoding)
+        {
+        iDestInputBuffer->Data().SetLength(0);
+        iDestInputBuffer->SetPosition(0); 
+        
+        }
+    
+    if (iDecBuffer != 0 && iDecBuffer->Size() > 0)
+        {
+        PRINT((_L("CProcDecoder::FillDecBufferL() out with ETrue")));
+        return ETrue;
+          
+        }
+               
+    PRINT((_L("CProcDecoder::FillDecBufferL() out with EFalse")));
+    return EFalse;
+        
+    }
+
+
+void CProcDecoder::ConstructL()
+    {
+    
+    
+    
+    }
+
+CProcDecoder::CProcDecoder()
+    {
+    
+    }
+    
+    
+    
+void CProcDecoder::ConfigureAACPlusDecoderL()
+    {
+
+    
+    RArray<TInt> config;
+    
+    if (iProperties.iAudioTypeExtension == EAudExtensionTypeEnhancedAACPlusParametricStereo)
+        {
+        
+        // for sample rate and channel converter, the output from parametric stereo
+        // is stereo, only the AAC part is incoded as mono
+        iFromChannels = 2;
+        }
+    
+    
+    config.Append( iFromSampleRate);
+    config.Append( iFromChannels );
+   
+    
+    if (iProperties.iAACObjectType ==  EAudAACObjectTypeLC)
+        {
+        config.Append( 1 );     // {1 - LC, 3 - LTP}    
+        }
+    else if (iProperties.iAACObjectType ==  EAudAACObjectTypeLTP)
+        {
+        config.Append( 3 );     // {1 - LC, 3 - LTP}    
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+    
+    config.Append( 8192 );  //Size of PCM Samples generated by decoder
+    
+    config.Append( 1024 );  //Number of PCM Samples generated by decoder per frame
+    
+    config.Append( iFromSampleRate);        //Sampling freq of AAC Code decoder
+    
+    config.Append( 0 );     // not used ??
+    
+  
+    config.Append( 0 );     // down sampled mode
+    
+    config.Append( 16 );    // Sample resolution: 16-bit resolution
+    
+    
+        
+    // NOTE!: for some reason, the sample rate of the output from AACPlus decoder used
+    // to be a half of the proper output sampling rate. 
+    // eAAC+ data consists of AAC band + enhancement band. The enhancement band is not included
+    // in the rate indicated in the header (iFromSampleRate)
+    // There was a workaround for the 
+    // earlier problem not to increase the sampling rate.
+    // Now, with 2006 releases it seems to work, and the sampling rate need to be doubled
+    // for the sampling rate converter.
+    
+    if (iProperties.iAudioTypeExtension == EAudExtensionTypeEnhancedAACPlus)
+        {
+        iFromSampleRate *= 2; // for sample rate converter ->
+        config.Append(iFromSampleRate);// Output sampling frequency
+        config.Append( 5 ); //Type of extended object (5=SBR/HE AAC profile; 6=PS is present)
+        
+        }
+    else if (iProperties.iAudioTypeExtension == EAudExtensionTypeEnhancedAACPlusParametricStereo)
+        {
+        iFromSampleRate *= 2; // for sample rate converter ->
+        config.Append(iFromSampleRate);// Output sampling frequency
+        config.Append( 6 ); //Type of extended object (5=SBR/HE AAC profile; 6=PS is present)
+        }
+    else
+        {
+        // AAC, in&out samplerates are equal, and extended object type is 0
+        config.Append(iFromSampleRate);// Output sampling frequency
+        config.Append( 0 );
+        
+        }
+        
+
+    TUid uid ={KUidMmfCodecAudioSettings}; // Use Uid reserved for codec configurations
+    TRAPD( err, iSourceCodec->ConfigureL( uid, reinterpret_cast<TDesC8&>(config)));
+            
+    if ( err != KErrNone )
+        {
+        PRINT((_L("CProcDecoder::PrepareConverterL() error, Source codec config failed")));
+        config.Close();
+        User::Leave( err );
+        }
+    config.Close();
+    
+    }
+    
+    
+void CProcDecoder::ConfigureMP3DecoderL()
+    {
+
+    
+    RArray<TInt> config;
+    
+    TInt stereoToMono = 0;
+    if (iToChannels == 1 || iFromChannels == 1)
+        {
+        stereoToMono = 1;
+        }
+    
+    config.Append( stereoToMono); // stereo to mono
+    config.Append( 0 ); //iLeftRight??
+    config.Append( iDecimFactor ); //iDecimFactor
+    config.Append( 0 ); //iConcealment
+    config.Append( 0 ); //iSampleLength??
+    config.Append( 0 ); //iSamplingFrequency
+    
+    TUid uid ={KUidMmfCodecAudioSettings}; // Use Uid reserved for codec configurations
+    TRAPD( err, iSourceCodec->ConfigureL( uid, reinterpret_cast<TDesC8&>(config)));
+            
+    if ( err != KErrNone )
+        {
+        PRINT((_L("CProcDecoder::PrepareConverterL() error, Source codec config failed")));
+        config.Close();
+        User::Leave( err );
+        }
+    config.Close();
+    }
+    
+    
+void CProcDecoder::ReAllocBufferL( CMMFDataBuffer* aBuffer, TInt aNewMaxSize )
+    {
+    if ( aBuffer->Data().Length() )
+        {
+        TInt position = aBuffer->Position();
+        TInt length = aBuffer->Data().Length();
+        HBufC8* oldData = aBuffer->Data().AllocL();
+        CleanupStack::PushL( oldData );
+        ((CMMFDescriptorBuffer*)aBuffer)->ReAllocBufferL( aNewMaxSize );
+        aBuffer->Data().Copy( *oldData );
+        CleanupStack::PopAndDestroy( oldData );
+        aBuffer->Data().SetLength( length );
+        aBuffer->SetPosition( position );
+        }
+    else
+        {
+        ((CMMFDescriptorBuffer*)aBuffer)->ReAllocBufferL( aNewMaxSize );
+        }
+    }
+    
+void CProcDecoder::FeedCodecL( CMMFCodec* aCodec, CMMFDataBuffer* aSourceBuffer, CMMFDataBuffer* aDestBuffer )
+    {
+    PRINT((_L("CProcDecoder::FeedCodecL() in")));
+    TBool completed = EFalse;
+    TCodecProcessResult result;
+
+    while ( !completed )
+        {
+
+        if (iDoDecoding)
+            {
+            // decode and check the result
+            result = DecodeL(aCodec, aSourceBuffer, aDestBuffer);
+            }
+        else
+            {
+            
+            // no need for decoding, just perform sample rate and channel conversion
+            result.iStatus = TCodecProcessResult::EProcessComplete;
+            }
+       
+        
+        switch ( result.iStatus )
+            {
+            case TCodecProcessResult::EProcessIncomplete:
+                // Not all data from input was consumed (DecodeL updated buffer members), but output was generated
+                    
+                if ( iDoSampleRateChannelConversion )
+                    {
+                    if ( !iRateConverter )
+                        {
+                        PRINT((_L("CProcDecoder::FeedCodecL() error, no rate converter")));
+                        User::Leave( KErrNotFound );
+                        }
+                    
+                    // Convert buffer size in bytes    
+                    TUint convertBufferSize = aDestBuffer->Data().Length();
+                    
+                    // Number of samples in the buffer
+                    TUint inputSamples = convertBufferSize / (2 * iFromChannels);    // 16-bit samples
+                    
+                    PRINT((_L("CProcDecoder::FeedCodecL() converting %d samples"), inputSamples));
+                    
+                    if ( convertBufferSize > ( iDestInputBuffer->Data().MaxLength() - iDestInputBuffer->Position() ) )
+                        {
+                        ReAllocBufferL( iDestInputBuffer, convertBufferSize + iDestInputBuffer->Position() );
+                        }
+
+                    TInt outputSamples = iRateConverter->ConvertBufferL( (TInt16*) aDestBuffer->Data().Ptr(),
+                        (TInt16*) iSampleRateChannelBuffer->Data().Ptr(), inputSamples );
+                        
+                    iSampleRateChannelBuffer->Data().SetLength( outputSamples * 2 * iToChannels );
+
+                    UpdateOutputBufferL(iSampleRateChannelBuffer);
+                    
+                    }  
+                else
+                    {
+                    if (iDoDecoding)
+                        {
+
+                        UpdateOutputBufferL(aDestBuffer);
+                        }
+                    }
+                    
+                break;
+
+            case TCodecProcessResult::EProcessComplete:
+                // all data from input was used and output was generated
+                if ( iDoSampleRateChannelConversion )
+                    {
+                    if ( !iRateConverter )
+                        {
+                        PRINT((_L("CProcDecoder::FeedCodecL() error, no rate converter")));
+                        User::Leave( KErrNotFound );
+                        }
+                        
+                        
+                    CMMFDataBuffer* src = 0;
+                        
+                    if (!iDoDecoding)
+                        {
+                        
+                        // if decoding was not needed, 
+                        // the input data for SR converter is in aSourceBuffer
+                        src = aSourceBuffer;
+                        }
+                    else
+                        {
+                        // if decoding was needed, 
+                        // the input data for SR converter is in iDestBuffer
+                      
+                        src = iDestInputBuffer;
+                        }
+                        
+                    // Convert buffer size in bytes 
+                    TUint convertBufferSize = src->Data().Length();
+                    
+                    // Number of samples in the buffer
+                    TUint inputSamples = convertBufferSize / (2 * iFromChannels);    // 16-bit samples
+                    
+                    PRINT((_L("CProcDecoder::FeedCodecL() converting %d samples"), inputSamples));
+   
+                    if ( convertBufferSize > ( src->Data().MaxLength() - src->Position() ) )
+                        {
+                        ReAllocBufferL( src, convertBufferSize + src->Position() );
+                        }
+                        
+                    TInt outputSamples = iRateConverter->ConvertBufferL( (TInt16*) src->Data().Ptr(),
+                        (TInt16*) iSampleRateChannelBuffer->Data().Ptr(), inputSamples );
+                        
+                    iSampleRateChannelBuffer->Data().SetLength( outputSamples * 2 * iToChannels );
+
+                    UpdateOutputBufferL(iSampleRateChannelBuffer);
+ 
+                    }
+                else
+                    {
+                    if (iDoDecoding)
+                        {
+                        UpdateOutputBufferL(aDestBuffer);
+                        }
+                    
+                    }
+        
+                completed = ETrue;
+                break;
+
+            case TCodecProcessResult::EDstNotFilled:
+                // need more input data, can't fill the output yet; put it back to the empty queue
+                completed = ETrue;
+             
+                break;
+
+            default:
+                // EEndOfData, EProcessError, EProcessIncompleteRepositionRequest, EProcessCompleteRepositionRequest
+                User::Leave( KErrUnknown );
+            }
+
+        }
+    
+
+    PRINT((_L("CProcDecoder::FeedCodecL() out")));
+    }
+    
+TCodecProcessResult CProcDecoder::DecodeL( CMMFCodec* aCodec, CMMFDataBuffer* aInBuffer, CMMFDataBuffer* aOutBuffer)
+    {
+    PRINT((_L("CProcDecoder::DecodeL() in, input pos: %d, length: %d"), aInBuffer->Position(), aInBuffer->Data().Length() ));
+    TCodecProcessResult result;
+
+    result = aCodec->ProcessL (*aInBuffer, *aOutBuffer);
+
+    switch (result.iStatus)
+        {
+        case TCodecProcessResult::EProcessComplete:
+            // finished processing source data, all data in sink buffer
+            PRINT((_L("CProcDecoder::FeedCodecL() EProcessComplete")));
+            aInBuffer->SetPosition( 0 );
+            aInBuffer->Data().SetLength(0);
+            break;
+
+        case TCodecProcessResult::EDstNotFilled:
+            // the destination is not full, we need more data. Handled in caller
+            PRINT((_L("CProcDecoder::FeedCodecL() EDstNotFilled")));
+            aInBuffer->SetPosition( 0 );
+            aInBuffer->Data().SetLength(0);
+            break;
+
+        case TCodecProcessResult::EProcessIncomplete:
+            // the sink was filled before all the source was processed
+            PRINT((_L("CProcDecoder::FeedCodecL() EProcessIncomplete")));
+            aOutBuffer->SetPosition( 0 );
+            aInBuffer->SetPosition( aInBuffer->Position() + result.iSrcBytesProcessed );
+            break;
+
+        default:
+            break;
+        }
+
+    PRINT((_L("CProcDecoder::DecodeL() out, %d -> %d"),result.iSrcBytesProcessed, result.iDstBytesAdded));
+    PRINT((_L("CProcDecoder::DecodeL() out, input pos: %d, length: %d"), aInBuffer->Position(), aInBuffer->Data().Length() ));
+    return result;
+    }
+    
+TBool CProcDecoder::GetIsSupportedSourceCodec()
+    {
+ 
+     TFourCC fourCC;
+     TUid uID;
+ 
+    if (iProperties.iAudioType == EAudAMR)
+        {
+        fourCC = TFourCC(KMMFFourCCCodeAMR);
+        uID = TUid(KMmfAMRNBDecSWCodecUid);
+        }
+    else if (iProperties.iAudioType == EAudAAC_MPEG4)
+        {
+        // use eAAC+ also for AAC
+        fourCC = TFourCC(KMMFFourCCCodeAACPlus);
+        uID = TUid(KMmfUidCodecEnhAACPlusToPCM16);
+        }
+    else if (iProperties.iAudioType == EAudMP3)
+        {
+        fourCC = TFourCC(KMMFFourCCCodeMP3);
+        uID = TUid(KMmfAdvancedUidCodecMP3ToPCM16);
+        }
+    else if (iProperties.iAudioType == EAudAMRWB)
+        {
+        fourCC = TFourCC(KMMFFourCCCodeAWB);
+        uID = TUid(KMmfAMRWBDecSWCodecUid);
+        }
+    else
+        {
+        //Wav, no codec
+        return ETrue;
+        }
+    
+    
+    
+    _LIT8(emptyFourCCString, "    ,    ");
+    TBufC8<9> fourCCString(emptyFourCCString);
+    TPtr8 fourCCPtr = fourCCString.Des();
+    TPtr8 fourCCPtr1(&fourCCPtr[0], 4);
+    TPtr8 fourCCPtr2(&fourCCPtr[5], 4 );
+
+    TFourCC srcFourCC(' ','P','1','6');
+    fourCC.FourCC(&fourCCPtr1);
+    srcFourCC.FourCC(&fourCCPtr2);
+
+    TBool found = EFalse;
+    TRAPD( err, found = CheckIfCodecAvailableL( fourCCPtr , uID));
+    
+    if (err == KErrNone)
+        {
+        return found;    
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+
+void CProcDecoder::SetSourceCodecL()
+    {
+    PRINT((_L("CProcDecoder::SetSourceCodecL() in")));
+
+    if ( !GetIsSupportedSourceCodec() )
+        {
+        PRINT((_L("CProcDecoder::SetSourceCodecL() error, unsupported codec")));
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( iSourceCodec )
+        {
+        delete iSourceCodec;
+        iSourceCodec = NULL;
+        }
+    
+    TFourCC destFourCC = KMMFFourCCCodePCM16;
+    
+    if (iProperties.iAudioType == EAudAMR)
+        {
+        iSourceCodec = CMMFCodec::NewL( KMmfAMRNBDecSWCodecUid );
+    
+        }
+    else if (iProperties.iAudioType == EAudAAC_MPEG4)
+        {
+        // use eAAC+ also for AAC
+        iSourceCodec = CMMFCodec::NewL( KMmfUidCodecEnhAACPlusToPCM16 );
+    
+        }
+    else if (iProperties.iAudioType == EAudMP3)
+        {
+        iSourceCodec = CMMFCodec::NewL( KMmfAdvancedUidCodecMP3ToPCM16 );
+    
+        }
+    else if (iProperties.iAudioType == EAudAMRWB)
+        {
+        iSourceCodec = CMMFCodec::NewL( KMmfAMRWBDecSWCodecUid );
+    
+        }
+    else
+        {
+        // Wav, but no codec needed then
+        }
+    
+    iReady = EFalse;
+
+    PRINT((_L("CProcDecoder::SetSourceCodecL() out")));
+    }
+    
+    
+    
+TBool CProcDecoder::CheckIfCodecAvailableL(const TDesC8& aCodecFourCCString, 
+                                            const TUid& aCodecUId )
+    {
+    PRINT((_L("CProcDecoder::CheckIfCodecAvailableL() in")));
+    TBool found = EFalse;
+
+    // Create a TEcomResolverParams structure.
+    TEComResolverParams resolverParams ;
+    resolverParams.SetDataType( aCodecFourCCString ) ;
+    resolverParams.SetWildcardMatch( EFalse ) ;
+
+    RImplInfoPtrArray plugInArray ; // Array to return matching decoders in (place on cleanupstack _after_ ListImplementationsL() )
+
+    TUid UidMmfPluginInterfaceCodec = {KMmfUidPluginInterfaceCodec};
+
+    // ListImplementationsL leaves if it cannot find anything so trap the error and ignore it.
+    TRAPD( err, REComSession::ListImplementationsL(UidMmfPluginInterfaceCodec, resolverParams, plugInArray ) ) ;
+    CleanupResetAndDestroyPushL(plugInArray);
+
+
+    if (err == KErrNone)
+        {
+        found = EFalse;
+        for ( TInt i = 0; i < plugInArray.Count(); i++)
+            {
+            // there is a match, but 1st we need to ensure it is the one we have tested with, and that have compatible implementation of ConfigureL
+            PRINT((_L("CProcDecoder::CheckIfCodecAvailable() plugin found with Uid 0x%x"), plugInArray[i]->ImplementationUid().iUid ));
+            if ( plugInArray[i]->ImplementationUid() == aCodecUId )
+                {
+			    //match accepted
+                PRINT((_L("CProcDecoder::CheckIfCodecAvailable() plugin accepted")));
+			    found = ETrue;
+                }
+            }
+        }
+    else
+        {
+        PRINT((_L("CProcDecoder::CheckIfCodecAvailable() Error in ListImp.: %d"), err));
+        //no match
+        found = EFalse;
+        }
+
+    CleanupStack::PopAndDestroy();  //plugInArray
+    PRINT((_L("CProcDecoder::CheckIfCodecAvailableL() out")));
+    return found;
+    }
+    
+TBool CProcDecoder::UpdateOutputBufferL(CMMFDataBuffer* aInBuffer)
+    {
+    if (iDecBuffer == 0)
+        {
+        iDecBuffer = HBufC8::NewL(aInBuffer->BufferSize());
+        iDecBuffer->Des().Append(aInBuffer->Data());
+        }
+    else
+        {
+        iDecBuffer = iDecBuffer->ReAlloc(iDecBuffer->Size()+aInBuffer->BufferSize());
+        iDecBuffer->Des().Append(aInBuffer->Data());
+        }
+    
+    aInBuffer->Data().SetLength( 0 );
+    aInBuffer->SetPosition( 0 );    
+    
+    return ETrue;
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/ProcEncoder.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,702 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "ProcEncoder.h"
+#include "audconstants.h"
+#include    <MmfDatabuffer.h>
+#include    <mmfcontrollerpluginresolver.h>
+#include    <mmfutilities.h>
+#include    <mmf/plugin/mmfCodecImplementationUIDs.hrh>
+#include    <MMFCodec.h>
+
+
+
+// MACROS
+
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x; 
+#else
+#define PRINT(x)
+#endif
+
+// -----------------------------------------------------------------------------
+// TCMRAMREncParams
+// Encoding parameters structure for SW AMR codec
+// -----------------------------------------------------------------------------
+//
+class TVedACAMREncParams
+    {
+public:
+    // encoding mode (for AMR-NB: 0=MR475,1=MR515,...,7=MR122, default 7)
+    TInt iMode;
+    // DTX flag (TRUE or default FALSE)
+    TInt iDTX;
+    };
+
+CProcEncoder* CProcEncoder::NewL()
+                            
+    {
+    CProcEncoder* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    
+    }
+
+
+CProcEncoder* CProcEncoder::NewLC()
+                                
+    {
+
+    CProcEncoder* self = new (ELeave) CProcEncoder();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    
+    }
+
+CProcEncoder::~CProcEncoder()
+    {
+    
+
+    delete iSourceInputBuffer;
+    
+    delete  iDestInputBuffer;
+        
+    delete iDestCodec;
+    
+    
+    }
+    
+    
+    
+    
+TBool CProcEncoder::InitL(TAudType aAudioType, TInt aTargetSamplingRate, TChannelMode aChannelMode,
+                          TInt aBitrate)
+    {
+    PRINT((_L("CProcEncoder::InitL() in")));
+    
+    if (aAudioType == EAudAMR)
+        {
+        iOutputFrameDurationMilli = 20;
+        }
+    else if (aAudioType == EAudAAC_MPEG4)
+        {
+        iOutputFrameDurationMilli = (1024*1000)/(aTargetSamplingRate);
+        }
+    else
+        {
+        // only AMR & AAC encoding supported
+        PRINT((_L("CProcEncoder::InitL() out, unsupported audio type")));
+        User::Leave(KErrNotSupported);
+        }
+    
+    iToBitRate = aBitrate;
+    
+    iAudioType = aAudioType;
+    
+    iNumberOfFramesInOutputBuffer = 0;
+
+    iToSampleRate = aTargetSamplingRate;
+       
+    iToChannels = 1; 
+    
+    if (aChannelMode == EAudStereo)
+        {
+        iToChannels = 2;    
+        }
+
+    
+    TInt destInputBufferSize = 0;
+    TInt sourceInputBufferSize = 0;
+   
+    // input buffer size:
+    // we never get longer than 64 milliseconds input
+    // as it is limited by the input formats
+    // for 16kHz AAC the frame duration is 64 ms
+    //
+    const TInt KMaxInputDurationMilli = 64;
+   
+    // multiplied by 2 as we have a bitdepth of 16
+    sourceInputBufferSize = (2*aTargetSamplingRate*KMaxInputDurationMilli)/1000;
+
+    if (aChannelMode == EAudStereo)
+        {
+        sourceInputBufferSize *= 2;
+        }
+
+    if ( aAudioType == EAudAMR )
+        {
+        
+        // from 64 ms input we can have maximum 4 AMR frames
+        destInputBufferSize = KAedMaxAMRFrameLength*4;
+        
+        
+        }
+    else if (aAudioType == EAudAAC_MPEG4)
+        {
+ 
+        if ( aChannelMode == EAudSingleChannel )
+            {
+            destInputBufferSize = KAedMaxAACFrameLengthPerChannel;
+            }
+        else
+            {
+            destInputBufferSize = 2 * KAedMaxAACFrameLengthPerChannel;
+        
+            }        
+        }
+    
+    if ( iSourceInputBuffer )
+        {
+        delete iSourceInputBuffer;
+        iSourceInputBuffer = NULL;
+        }
+    
+    iSourceInputBuffer = CMMFDataBuffer::NewL(sourceInputBufferSize*5);
+    
+    
+    if ( iDestInputBuffer )
+        {
+        delete iDestInputBuffer;
+        iDestInputBuffer = NULL;
+        }
+
+    TInt errC = KErrNone;
+
+    if (aAudioType == EAudAMR)
+        {
+        
+        // shouldn't get more than 6 AMR frames at a time -> 120 ms
+        iDestInputBuffer = CMMFDataBuffer::NewL( destInputBufferSize);
+        
+        }
+    else
+        {
+        
+        iDestInputBuffer = CMMFDataBuffer::NewL( destInputBufferSize);
+        
+        }
+    
+    TRAP (errC,SetDestCodecL());
+    
+    if (errC != KErrNone)
+        {
+        // initialization failed for some reason
+        User::Leave(KErrNotSupported);
+        
+        }
+
+    TInt err = KErrNone;
+
+    if ( iAudioType == EAudAAC_MPEG4 )
+        {
+        TRAP( err, ConfigureAACEncoderL());
+        
+        }
+    else if (iAudioType == EAudAMR)
+        {
+        TRAP( err, ConfigureAMREncoderL());
+        }
+    
+    
+    if (err != KErrNone || errC != KErrNone)
+        {
+
+        // initialization failed for some reason
+        User::Leave(KErrNotSupported);
+        }
+
+    iReady = ETrue;
+    PRINT((_L("CProcEncoder::InitL() out")));
+
+    return ETrue;
+    }
+
+TBool CProcEncoder::FillEncBufferL(const TDesC8& aRawFrame, HBufC8* aEncBuffer, TInt& aOutputDurationMilli)
+    {
+    PRINT((_L("CProcEncoder::FillEncBufferL() in")));
+    
+    aOutputDurationMilli = 0;
+    
+
+    if (!iReady)
+        {
+        User::Leave(KErrNotReady);
+        }
+    
+    iEncBuffer = aEncBuffer;
+    
+    if (iEncBuffer->Length() == 0)
+        {
+        iNumberOfFramesInOutputBuffer = 0;
+        }
+       
+    if ( !aRawFrame.Length() )
+        {
+        return EFalse;
+        }
+    
+    if ( (TInt)(aRawFrame.Length() + iSourceInputBuffer->Position() ) > iSourceInputBuffer->Data().MaxLength() )
+        {
+        ReAllocBufferL( iSourceInputBuffer, aRawFrame.Length() + iSourceInputBuffer->Position() );
+        
+        }
+    
+    
+    // copy the input data to MMF buffer
+    iSourceInputBuffer->Data().SetLength( 0 );
+    iSourceInputBuffer->SetPosition( 0 );
+
+    iSourceInputBuffer->Data().Append( aRawFrame );
+    iSourceInputBuffer->Data().SetLength( iSourceInputBuffer->Data().Length() );
+    iSourceInputBuffer->SetStatus(EFull);
+    
+    iDestInputBuffer->Data().SetLength(0);
+    iDestInputBuffer->SetPosition(0); 
+  
+    FeedCodecL( iDestCodec, iSourceInputBuffer, iDestInputBuffer);
+
+    
+    
+    iDestInputBuffer->Data().SetLength(0);
+    iDestInputBuffer->SetPosition(0); 
+    
+    if (iEncBuffer->Size() > 0)
+       {
+       
+       aOutputDurationMilli = iOutputFrameDurationMilli * iNumberOfFramesInOutputBuffer;
+       PRINT((_L("CProcEncoder::FillEncBufferL() out with ETrue (complete)")));
+       return ETrue;
+       }
+       
+    PRINT((_L("CProcEncoder::FillEncBufferL() out with EFalse (incomplete)")));
+    return EFalse;
+    }
+
+TAudType CProcEncoder::DestAudType()
+    {
+    return iAudioType;
+    }
+
+void CProcEncoder::ConstructL()
+    {
+    
+    }
+
+CProcEncoder::CProcEncoder()
+    {
+    
+    }
+    
+    
+void CProcEncoder::ConfigureAMREncoderL()
+    {
+    PRINT((_L("CProcEncoder::ConfigureAMREncoderL() in")));
+
+    if ( (iToBitRate < KAedMinAMRBitRate) || (iToBitRate > KAedMaxAMRBitRate) )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TVedACAMREncParams* configData = new (ELeave) TVedACAMREncParams;
+    CleanupStack::PushL( configData );
+
+    // the bitrates in the switch & if below are not magic numbers but AMR bitrates in bits per seconds and mode indices from TAmrEncParams
+
+    switch ( iToBitRate )
+        {
+        case 4750:
+            configData->iMode = 0;
+            configData->iDTX = EFalse;
+            break;
+        case 5150:
+            configData->iMode = 1;
+            configData->iDTX = EFalse;
+            break;
+        case 5900:
+            configData->iMode = 2;
+            configData->iDTX = EFalse;
+            break;
+        case 6700:
+            configData->iMode = 3;
+            configData->iDTX = EFalse;
+            break;
+        case 7400:
+            configData->iMode = 4;
+            configData->iDTX = EFalse;
+            break;
+        case 7950:
+            configData->iMode = 5;
+            configData->iDTX = EFalse;
+            break;
+        case 10200:
+            configData->iMode = 6;
+            configData->iDTX = EFalse;
+            break;
+        case 12200:
+            configData->iMode = 7;
+            configData->iDTX = EFalse;
+            break;
+        default :
+            // Interprets now the bitrate proprietarily: bitrates that are not exactly AMR bitrates 
+            // mean that voice activity detection is used and the AMR bitrates is the given bitrate rounded upwards to the next AMR bitrate
+            if ( iToBitRate < 4750 )
+                {
+                configData->iMode = 0;
+                configData->iDTX = ETrue;
+                }
+            else if ( iToBitRate < 5150 )
+                {
+                configData->iMode = 1;
+                configData->iDTX = ETrue;
+                }
+            else if ( iToBitRate < 5900 )
+                {
+                configData->iMode = 2;
+                configData->iDTX = ETrue;
+                }
+            else if ( iToBitRate < 6700 )
+                {
+                configData->iMode = 3;
+                configData->iDTX = ETrue;
+                }
+            else if ( iToBitRate < 7400 )
+                {
+                configData->iMode = 4;
+                configData->iDTX = ETrue;
+                }
+            else if ( iToBitRate < 7950 )
+                {
+                configData->iMode = 5;
+                configData->iDTX = ETrue;
+                }
+            else if ( iToBitRate < 10200 )
+                {
+                configData->iMode = 6;
+                configData->iDTX = ETrue;
+                }
+            else // must be: ( iToBitRate < 12200 ) since checked earlier
+                {
+                configData->iMode = 7;
+                configData->iDTX = ETrue;
+                }
+        }
+
+    TUid uid ={KUidMmfCodecAudioSettings}; // Use Uid reserved for codec configurations
+    iDestCodec->ConfigureL( uid, reinterpret_cast<TDesC8&>(*configData));
+    CleanupStack::PopAndDestroy( configData );
+    PRINT((_L("CProcEncoder::ConfigureAMREncoderL() out")));
+    }
+
+// -----------------------------------------------------------------------------
+// CProcEncoder::ConfigureAACEncoderL
+// 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CProcEncoder::ConfigureAACEncoderL()
+    {
+    PRINT((_L("CProcEncoder::ConfigureAACEncoderL() in")));
+    
+    TInt i = 0;
+    TBool iSet = EFalse;
+    for ( i = 0; i < KAedNumSupportedAACSampleRates; i++ )
+        {
+        if ( iToSampleRate == KAedSupportedAACSampleRates[i] )
+            {
+            iSet = ETrue;
+            }
+        }
+    if ( !iSet )
+        {
+        // given samplerate is not supported
+        User::Leave( KErrNotSupported );
+        }
+
+    // AAC codec interprets the input as array of TInts, not as a class
+    RArray<TInt> config;
+    config.Append (iToBitRate); //BitRate
+    config.Append (iToSampleRate);  //SamplingRate
+    config.Append (0);  //iToolFlags
+    config.Append (iToChannels);    //iNumChan
+    
+    // NOTE Ali: for 48kHz stereo we might need to use ADTS as output format
+    // as we can get more than one frame in synchronous call!
+    config.Append (0);  //iuseFormat 0=RAW; 1=ADTS; 2=ADIF
+    config.Append (0);  // 0 = 1 Frame only; 1 = Full Buffer
+
+    TUid uid ={KUidMmfCodecAudioSettings}; // Use Uid reserved for codec configurations
+    iDestCodec->ConfigureL( uid,  reinterpret_cast<TDesC8&>(config));
+    config.Close();
+    PRINT((_L("CProcEncoder::ConfigureAACEncoderL() out")));
+    }
+
+    
+void CProcEncoder::ReAllocBufferL( CMMFDataBuffer* aBuffer, TInt aNewMaxSize )
+    {
+    if ( aBuffer->Data().Length() )
+        {
+        TInt position = aBuffer->Position();
+        TInt length = aBuffer->Data().Length();
+        HBufC8* oldData = aBuffer->Data().AllocL();
+        CleanupStack::PushL( oldData );
+        ((CMMFDescriptorBuffer*)aBuffer)->ReAllocBufferL( aNewMaxSize );
+        aBuffer->Data().Copy( *oldData );
+        CleanupStack::PopAndDestroy( oldData );
+        aBuffer->Data().SetLength( length );
+        aBuffer->SetPosition( position );
+        }
+    else
+        {
+        ((CMMFDescriptorBuffer*)aBuffer)->ReAllocBufferL( aNewMaxSize );
+        }
+    }
+    
+void CProcEncoder::FeedCodecL( CMMFCodec* aCodec, CMMFDataBuffer* aSourceBuffer, CMMFDataBuffer* aDestBuffer )
+    {
+    PRINT((_L("CProcEncoder::FeedCodecL() in")));
+    TBool completed = EFalse;
+    TCodecProcessResult result;
+    TInt aSrcUsed = 0;
+
+    while ( !completed )
+        {
+
+        // encode and check the result
+        result = EncodeL(aCodec, aSourceBuffer, aDestBuffer);
+             
+        switch ( result.iStatus )
+            {
+            case TCodecProcessResult::EProcessIncomplete:
+                // Not all data from input was consumed (EncodeL updated buffer members), but output was generated
+                
+                iEncBuffer->Des().Append(aDestBuffer->Data());
+                iNumberOfFramesInOutputBuffer++;
+                         
+                aDestBuffer->Data().SetLength( 0 );
+                aDestBuffer->SetPosition( 0 );
+                
+                break;
+
+            case TCodecProcessResult::EProcessComplete:
+                // all data from input was used and output was generated
+      
+                iEncBuffer->Des().Append(aDestBuffer->Data());
+                
+                iNumberOfFramesInOutputBuffer++;
+                    
+                aDestBuffer->Data().SetLength( 0 );
+                aDestBuffer->SetPosition( 0 );
+         
+                //completed = ETrue;
+                
+                break;
+
+            case TCodecProcessResult::EDstNotFilled:
+                // need more input data, can't fill the output yet; put it back to the empty queue
+                //completed = ETrue;
+          
+                break;
+
+            default:
+                // EEndOfData, EProcessError, EProcessIncompleteRepositionRequest, EProcessCompleteRepositionRequest
+                User::Leave( KErrUnknown );
+            }
+        
+        aSrcUsed += result.iSrcBytesProcessed;
+        if (aSrcUsed >= (STATIC_CAST(CMMFDataBuffer*, aSourceBuffer)->Data().Length()))
+			{
+            PRINT((_L("CProcEncoder::FeedCodecL() ProcessL is completed aSrcUsed[%d]"), aSrcUsed));
+			completed = ETrue;
+			}
+            
+
+        }
+    
+    PRINT((_L("CProcEncoder::FeedCodecL() out")));
+    }
+    
+
+TBool CProcEncoder::GetIsSupportedDestCodec()
+    {
+    TFourCC fourCC; 
+    TUid euid;
+ 
+    if (iAudioType == EAudAMR)
+        {
+        fourCC = TFourCC(KMMFFourCCCodeAMR);
+        euid = KAedAMRNBEncSWCodecUid;
+        }
+    else if (iAudioType == EAudAAC_MPEG4 )
+        {
+        fourCC = TFourCC(KMMFFourCCCodeAAC);
+        euid = KAedAACEncSWCodecUid;
+        }
+    
+    _LIT8(emptyFourCCString, "    ,    ");
+    TBufC8<9> fourCCString(emptyFourCCString);
+    TPtr8 fourCCPtr = fourCCString.Des();
+    TPtr8 fourCCPtr1(&fourCCPtr[0], 4);
+    TPtr8 fourCCPtr2(&fourCCPtr[5], 4 );
+
+    TFourCC srcFourCC(' ','P','1','6');
+    srcFourCC.FourCC(&fourCCPtr1);
+    fourCC.FourCC(&fourCCPtr2);
+
+    TBool found = EFalse;
+    TRAPD( err, found = CheckIfCodecAvailableL( fourCCPtr, euid ));
+    
+    if (err == KErrNone)
+        {
+        return found;    
+        }
+    else
+        {
+        return EFalse;
+        }
+    
+    }
+
+    
+void CProcEncoder::SetDestCodecL()
+    {
+    PRINT((_L("CProcEncoder::SetDestCodecL() in")));
+
+    if ( !GetIsSupportedDestCodec() )
+        {
+        PRINT((_L("CProcEncoder::SetDestCodecL() error, unsupported codec")));
+        User::Leave( KErrNotSupported );
+        }
+    
+    if ( iDestCodec )
+        {
+        delete iDestCodec;
+        iDestCodec = NULL;
+        }
+
+    TUid euid = TUid::Null();
+ 
+    if (iAudioType == EAudAMR)
+        {
+        euid = KAedAMRNBEncSWCodecUid;
+        }
+    else if (iAudioType == EAudAAC_MPEG4 )
+        {
+        euid = KAedAACEncSWCodecUid;
+        }
+    
+    
+    iDestCodec = CMMFCodec::NewL (euid);
+    iReady = EFalse;
+
+    PRINT((_L("CProcEncoder::SetDestCodecL() out")));
+    }   
+   
+    
+TBool CProcEncoder::CheckIfCodecAvailableL(
+    const TDesC8& aCodecFourCCString, const TUid& aCodecUId )
+    {
+    PRINT((_L("CProcEncoder::CheckIfCodecAvailableL() in")));
+    TBool found = EFalse;
+
+    // Create a TEcomResolverParams structure.
+    TEComResolverParams resolverParams ;
+    resolverParams.SetDataType( aCodecFourCCString ) ;
+    resolverParams.SetWildcardMatch( EFalse ) ;
+
+    RImplInfoPtrArray plugInArray ; // Array to return matching decoders in (place on cleanupstack _after_ ListImplementationsL() )
+
+    TUid UidMmfPluginInterfaceCodec = {KMmfUidPluginInterfaceCodec};
+
+    // ListImplementationsL leaves if it cannot find anything so trap the error and ignore it.
+    TRAPD( err, REComSession::ListImplementationsL(UidMmfPluginInterfaceCodec, resolverParams, plugInArray ) ) ;
+    CleanupResetAndDestroyPushL(plugInArray);
+
+    if (err == KErrNone)
+        {
+        found = EFalse;
+        for ( TInt i = 0; i < plugInArray.Count(); i++)
+            {
+            // there is a match, but 1st we need to ensure it is the one we have tested with, and that have compatible implementation of ConfigureL
+            PRINT((_L("CProcEncoder::CheckIfCodecAvailable() plugin found with Uid 0x%x"), plugInArray[i]->ImplementationUid().iUid ));
+            if ( plugInArray[i]->ImplementationUid() == aCodecUId )
+                {
+			    //match accepted
+                PRINT((_L("CProcEncoder::CheckIfCodecAvailable() plugin accepted")));
+			    found = ETrue;
+                }
+            }
+        }
+    else
+        {
+        PRINT((_L("CProcEncoder::CheckIfCodecAvailable() Error in ListImp.: %d"), err));
+        //no match
+        found = EFalse;
+        }
+
+
+    CleanupStack::PopAndDestroy();  //plugInArray
+    PRINT((_L("CProcEncoder::CheckIfCodecAvailableL() out")));
+    return found;
+    }
+
+TCodecProcessResult CProcEncoder::EncodeL( CMMFCodec* aCodec, CMMFDataBuffer* aInBuffer, CMMFDataBuffer* aOutBuffer)
+    {
+    PRINT((_L("CProcEncoder::EncodeL() in, input pos: %d, length: %d"), aInBuffer->Position(), aInBuffer->Data().Length() ));
+    TCodecProcessResult result;
+
+    result = aCodec->ProcessL (*aInBuffer, *aOutBuffer);
+
+    switch (result.iStatus)
+        {
+        case TCodecProcessResult::EProcessComplete:
+            // finished processing source data, all data in sink buffer
+            PRINT((_L("CProcEncoder::FeedCodecL() EProcessComplete")));
+            aInBuffer->SetPosition( 0 );
+            aInBuffer->Data().SetLength(0);
+            break;
+
+        case TCodecProcessResult::EDstNotFilled:
+            // the destination is not full, we need more data. Handled in caller
+            PRINT((_L("CProcEncoder::FeedCodecL() EDstNotFilled")));
+            aInBuffer->SetPosition( 0 );
+            aInBuffer->Data().SetLength(0);
+            break;
+
+        case TCodecProcessResult::EProcessIncomplete:
+            // the sink was filled before all the source was processed
+            PRINT((_L("CProcEncoder::FeedCodecL() EProcessIncomplete")));
+            aOutBuffer->SetPosition( 0 );
+            aInBuffer->SetPosition( aInBuffer->Position() + result.iSrcBytesProcessed );
+            break;
+
+        default:
+            break;
+        }
+
+ 
+
+    PRINT((_L("CProcEncoder::EncodeL() out, %d -> %d"),result.iSrcBytesProcessed, result.iDstBytesAdded));
+    PRINT((_L("CProcEncoder::EncodeL() out, input pos: %d, length: %d"), aInBuffer->Position(), aInBuffer->Data().Length() ));
+    return result;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/ProcFrameHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "ProcFrameHandler.h"
+
+
+CProcFrameHandler::~CProcFrameHandler() 
+    {
+
+    }
+    
+
+
+TBool CProcFrameHandler::IsMixingAvailable() const
+    {
+
+    return EFalse;
+
+    }
+
+TBool CProcFrameHandler::MixL(const HBufC8* /*aFrame1*/, const HBufC8* /*aFrame2*/, HBufC8*& aMixedFrame)
+    {
+
+    aMixedFrame = 0;
+    return EFalse;
+
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/ProcInFileHandler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,881 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include <f32file.h>
+#include "AudPanic.h"
+#include "ProcInFileHandler.h"
+#include "AudClipInfo.h"
+#include "ProcTools.h"
+#include "audconstants.h"
+
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+CProcInFileHandler::~CProcInFileHandler() 
+    {
+
+    if (iFileOpen && iOwnsFile)
+        {
+        iFile.Close();
+        iFs.Close();
+        }
+
+
+    if (iProperties != 0)
+        {
+        delete iProperties;
+        iProperties = 0;
+        }
+
+
+    delete iRawSilentFrame;
+    
+    delete iInputBuffer;
+    
+    delete iWavFrameHandler;
+
+    }
+
+
+TBool CProcInFileHandler::DecodingRequired()
+    {
+    return iDecodingRequired;
+    }
+    
+
+TInt CProcInFileHandler::GetDecodedFrameSize()
+    {
+    if (iProperties == 0)
+        {
+        return 0;
+        }
+    else
+        {
+        
+        // divided by 1000000/2 cause time is in 
+        // microseconds and 16 bits are used for one sample
+#ifdef EKA2
+        TInt frameSize = (iProperties->iFrameDuration.Int64())*(iTargetSampleRate)/(1000000/2);
+#else
+        TInt frameSize = (iProperties->iFrameDuration.Int64().GetTInt())*(iTargetSampleRate)/(1000000/2);
+#endif        
+        
+        
+        if (iChannelMode == EAudStereo)
+            {
+            frameSize *= 2;
+            }
+        
+        return frameSize;
+        }
+    
+    
+    }
+
+
+void CProcInFileHandler::SetDecodingRequired(TBool aDecodingRequired)
+    {
+    iDecodingRequired = aDecodingRequired;
+    
+    }
+
+TBool CProcInFileHandler::GetAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime, TBool& aRawFrame) 
+    {
+
+    if (iDecodingRequired)
+        {
+        aRawFrame = ETrue;
+        return GetRawAudioFrameL(aFrame, aSize, aTime);
+        }
+    else
+        {
+        aRawFrame = EFalse;
+        return GetEncAudioFrameL(aFrame, aSize, aTime);
+        
+        }
+    }
+    
+    
+TBool CProcInFileHandler::GetRawAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime)
+    {
+    
+    
+    while (iInputBuffer == 0 || iInputBuffer->Length() < iRawFrameLength)
+        {
+        TBool ret = GetOneRawAudioFrameL(aFrame, aSize, aTime);
+        if (!ret)
+            {
+            return ret;
+            }
+        
+        WriteDataToInputBufferL(*aFrame);
+        delete aFrame;
+        aFrame = 0;
+    
+        }
+        
+    if (iInputBuffer->Length() >= iRawFrameLength)
+        {
+        aFrame = HBufC8::NewL(iRawFrameLength);
+        aFrame->Des().Append(iInputBuffer->Left(iRawFrameLength));
+        
+        
+        TInt bytesInSecond = iTargetSampleRate*2;
+            
+        if (iChannelMode == EAudStereo)
+            {
+            bytesInSecond *= 2;
+            }
+        
+        
+        // Fix for synchronizing problem ---------------------------------->
+        // If the accurate frame length cannot be represented in milliseconds
+        // store the remainder and increase the output frame lenght by one ms 
+        // when needed. Accuracy depends on sampling rate
+        
+        TReal accurateFrameLen = TReal(aFrame->Length()*1000)/bytesInSecond;
+        aTime = TUint((aFrame->Length()*1000)/bytesInSecond);
+        
+        iFrameLenRemainderMilli += accurateFrameLen - aTime;
+        
+        if (iFrameLenRemainderMilli > 1)
+            {
+            aTime += 1;
+            iFrameLenRemainderMilli -= 1;
+            }
+        // <---------------------------------- Fix for synchronizing problem
+            
+        iInputBuffer->Des().Delete(0, iRawFrameLength);
+
+        
+        }
+    
+    return ETrue;
+    
+    
+    }
+
+    
+TBool CProcInFileHandler::GetOneRawAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime)
+    {
+    
+
+    TInt size = 0;
+        
+    TInt32 time = 0;
+        
+    HBufC8* frame = 0;
+        
+    TBool encFrameRead = GetEncAudioFrameL(frame, size, time);    
+    
+    if (encFrameRead) 
+        {
+        CleanupStack::PushL(frame);
+        }
+    
+    aTime = time;
+    
+    if (!encFrameRead)
+        {
+        return EFalse;
+        }
+    
+    TRAPD(err, iDecoder->FillDecBufferL(frame, aFrame));
+    if (err == KErrNotFound)
+        {
+        // S60 audio decoders seem to leave with KErrNotFound if they find problems in input clips. 
+        // However, sometimes the problem is only in one frame, e.g. the 1st frame may contain some metadata that can't be decoded,
+        // but decoding can continue after that. But if there are many errors, the clip is most likely unusable.
+	    PRINT((_L("CProcInFileHandler::GetOneRawAudioFrameL() iDecoder->FillDecBufferL leaved with %d"),err));
+        if ( iDecoderErrors > 0 )
+            {
+            // several errors, leave, but change the error code to more readable
+    	    PRINT((_L("CProcInFileHandler::GetOneRawAudioFrameL() leave with %d"),KErrCorrupt));
+            User::Leave(KErrCorrupt);
+            }
+        iDecoderErrors++;
+        }
+    else if (err == KErrNone)
+        {
+        // keep filling the decoder buffer; the decoder seem to leave with KErrNone if it can't get enough data, ignore the leave
+        }
+    else
+        {
+        // some other error
+	    PRINT((_L("CProcInFileHandler::GetOneRawAudioFrameL() iDecoder->FillDecBufferL leaved with %d, leaving"),err));
+        User::Leave(err);
+        }
+    
+    if (encFrameRead) 
+        {
+        CleanupStack::PopAndDestroy(frame);
+        frame = 0;
+        
+        }
+    
+    while (aFrame == 0 || aFrame->Size() == 0)
+        {
+        
+        encFrameRead = GetEncAudioFrameL(frame, size, time);
+    
+        if (encFrameRead) 
+            {
+            CleanupStack::PushL(frame);
+            }
+        else
+            {
+            return EFalse;
+            }
+    
+        
+        aTime += time;
+        
+        
+        
+        iDecoder->FillDecBufferL(frame, aFrame);
+        if (encFrameRead) 
+            {
+            CleanupStack::PopAndDestroy(frame);
+            frame = 0;
+            }        
+        
+        }
+    
+    
+    aSize = aFrame->Length();
+    
+    if (iProperties->iAudioTypeExtension != EAudExtensionTypeNoExtension) 
+        {
+        
+        // AACPlus is always decoded, therefore the gain manipulation can be done
+        // in time domain
+        
+        ManipulateGainL(aFrame);
+        aSize = aFrame->Length();
+        
+        
+        }
+    
+    
+    return ETrue;
+        
+    }
+
+
+TBool CProcInFileHandler::SetRawAudioFrameSize(TInt aSize)
+    {
+    
+    const TInt KMaxRawFrameSize = 4096;
+    if (aSize > 0 && aSize <= KMaxRawFrameSize)
+        {
+        iRawFrameLength = aSize;
+        return ETrue;
+        }
+        
+    return EFalse;
+    }
+
+TBool CProcInFileHandler::GetSilentAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aTime, TBool& aRawFrame)
+    {
+    
+    if (iDecodingRequired)
+        {
+        aRawFrame = ETrue;
+        return GetRawSilentAudioFrameL(aFrame, aSize, aTime);
+        
+        }
+        
+    else
+        {
+        aRawFrame = EFalse;
+        return GetEncSilentAudioFrameL(aFrame, aSize, aTime);
+        }
+    }
+    
+    
+
+
+TBool CProcInFileHandler::GetRawSilentAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aDuration)
+    {
+    
+    
+    aFrame = HBufC8::NewL(iRawFrameLength);    
+    aFrame->Des().Fill(0, aFrame->Des().MaxLength());
+
+    TInt bytesInSecond = iTargetSampleRate*2;
+            
+    if (iChannelMode == EAudStereo)
+        {
+        bytesInSecond *= 2;
+        }
+    
+    aDuration = TUint((aFrame->Length()*1000)/bytesInSecond);
+    aSize = aFrame->Length();
+  
+    
+    // input buffer is created only if needed
+    if (iInputBuffer)
+        {
+        iInputBuffer->Des().Delete(0, iInputBuffer->Size());
+        
+        }
+    return ETrue;
+        
+    }
+
+TBool CProcInFileHandler::GetEncSilentAudioFrameL(HBufC8*& aFrame, TInt& aSize, TInt32& aDuration)
+    {
+    
+    if (iSilentFrame == 0)
+        {
+        return EFalse;
+        }
+    
+    aFrame = HBufC8::NewL(iSilentFrame->Size());    
+    aFrame->Des().Append(iSilentFrame->Des());
+
+    aDuration = iSilentFrameDuration;
+    aSize = iSilentFrame->Size();
+    return ETrue;
+
+    }
+
+
+CProcInFileHandler::CProcInFileHandler() : iFileOpen(EFalse)
+    {
+    
+    
+
+    }
+    
+TInt32 CProcInFileHandler::GetCurrentTimeMilliseconds() 
+    {
+    return iCurrentTimeMilliseconds;
+
+    }
+
+// default implementation for files that do not have buffered bytes
+TBool CProcInFileHandler::ReadAudioDecoderSpecificInfoL(HBufC8*& /*aBytes*/, TInt /*aBufferSize*/)
+    {
+    return EFalse;
+    }
+
+TBool CProcInFileHandler::OpenFileForReadingL() 
+    {   
+
+    if (iFileOpen)
+        {
+        User::Leave(KErrGeneral);
+        }
+ 
+    TInt err = iFs.Connect();
+    if (err != KErrNone) 
+        {
+        iFileOpen = EFalse;
+        User::Leave(err);
+        }
+
+    err=iFile.Open(iFs, iFileName->Des(), EFileShareReadersOnly);
+    if (err != KErrNone) 
+        {
+        err=iFile.Open(iFs, iFileName->Des(), EFileShareAny);
+        }
+    if (err != KErrNone) 
+        {
+        iFileOpen = EFalse;
+        iFs.Close();
+        User::Leave(err);
+        }
+    else 
+        {
+        iFileOpen = ETrue;
+        return ETrue;
+        }
+
+    return EFalse;
+
+    }
+
+TBool CProcInFileHandler::
+SetPropertiesL(TAudFileProperties aProperties) 
+{
+  if(iProperties == 0)
+    iProperties = new (ELeave) TAudFileProperties();
+
+  iProperties->iAudioType = aProperties.iAudioType;
+  iProperties->iBitrate = aProperties.iBitrate;
+  iProperties->iBitrateMode = aProperties.iBitrateMode;
+  iProperties->iChannelMode = aProperties.iChannelMode;
+  iProperties->iDuration = 0;
+  iProperties->iFileFormat = aProperties.iFileFormat;
+  iProperties->iSamplingRate = aProperties.iSamplingRate;
+  iProperties->iFrameLen = aProperties.iFrameLen;
+  iProperties->iFrameDuration = aProperties.iFrameDuration;
+  iProperties->iFrameCount = aProperties.iFrameCount;
+  
+  return (ETrue);
+}
+
+TBool CProcInFileHandler::SetPriority(TInt aPriority)
+    {
+    if (aPriority < 0) return EFalse;
+
+    iPriority = aPriority;
+
+    return ETrue;
+
+    }
+TInt CProcInFileHandler::Priority() const
+    {
+    return iPriority;
+
+    }
+
+TBool CProcInFileHandler::CloseFile() 
+    {
+
+    if (iOwnsFile)
+    {        
+        iFile.Close();
+        iFs.Close();
+        iFileOpen = EFalse;
+    }
+    
+    return ETrue;
+
+    }
+
+
+
+TBool CProcInFileHandler::InitAndOpenFileL(const TDesC& aFileName, 
+                                           RFile* aFileHandle,
+                                           TInt aReadBufferSize) 
+    {
+
+    
+    iBufferStartOffset = 0;
+    iBufferEndOffset = 0;
+    iCutInTime = 0;
+
+    if (!aFileHandle)
+    {        
+        iFileName = HBufC::NewL(aFileName.Length());
+        *iFileName = aFileName;
+    }
+        
+    iReadBufferSize = aReadBufferSize;
+    iReadBuffer = HBufC8::NewL(iReadBufferSize);
+    
+    const TInt KVedACSizeAMRBuffer = 320;
+    
+    // [JK]: Moved from OpenFileForReadingL
+    // AMR buffer is the smallest possible
+    // buffersize fill be increased if needed
+    iRawFrameLength = KVedACSizeAMRBuffer;
+    iInputBuffer = HBufC8::NewL(iRawFrameLength);
+
+    if (aFileHandle)
+    {
+        iFile = *aFileHandle;
+        iOwnsFile = EFalse;
+        iFileOpen = ETrue;
+        return 0;
+    }
+    
+    TBool err = OpenFileForReadingL();
+    if (!err) iFileOpen = ETrue;
+    
+    iOwnsFile = ETrue;
+    
+    return err;
+
+    }
+
+void CProcInFileHandler::ResetAndCloseFile()
+    {
+
+    if (iFileOpen) 
+        {
+        CloseFile();
+        }
+    if (iFileName != 0)
+        delete iFileName;
+    iFileName = 0;
+    if (iReadBuffer != 0)
+        delete iReadBuffer;
+    iReadBuffer = 0;
+    
+    delete iRawSilentFrame;
+    iRawSilentFrame = 0;
+    
+
+
+    }
+
+TInt CProcInFileHandler::BufferedFileRead(TInt aPos,TDes8& aDes) 
+    {
+    TInt bufSize;
+    
+    if (!iFileOpen) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+    
+    TBool readingNeeded = EFalse;
+    
+    if (aPos < iBufferStartOffset || aPos + aDes.MaxSize() > iBufferEndOffset) 
+        {
+        readingNeeded = ETrue;
+        }
+    
+    if(readingNeeded) 
+        {
+        TInt fSize;
+
+        iFile.Size(fSize);
+        if(aPos >= fSize) 
+            {
+            aDes.SetLength(0);
+            return 0;
+            }
+
+        TPtr8 tmpDes((TPtr8)iReadBuffer->Des());
+
+        iFile.Read(aPos, (TPtr8&)tmpDes, iReadBufferSize);
+
+        iBufferStartOffset = aPos;
+        iBufferEndOffset = aPos+iReadBuffer->Des().Size()-1;        
+        }
+
+    if (iReadBuffer->Size() == 0) 
+        {
+        return 0;
+        }
+    else 
+        {
+        bufSize = Min(iReadBuffer->Des().Length(), aDes.MaxSize());
+        aDes.Copy(iReadBuffer->Des().Mid(aPos-iBufferStartOffset, bufSize));
+        iFilePos = aPos+aDes.Size();
+
+        return aDes.Size();
+        }
+    }
+
+TInt CProcInFileHandler::BufferedFileRead(TDes8& aDes) 
+    {
+
+    if (!iFileOpen) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    return BufferedFileRead(iFilePos, aDes);
+    
+
+    }
+
+TInt CProcInFileHandler::BufferedFileRead(TDes8& aDes,TInt aLength) 
+    {
+    TInt bufSize;
+
+    if (!iFileOpen) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+    
+    aDes.Zero();
+
+    TBool readingNeeded = EFalse;
+    
+    if (iFilePos < iBufferStartOffset || iFilePos + aLength-1 > iBufferEndOffset) 
+        {
+        readingNeeded = ETrue;
+        }
+    
+    if(readingNeeded) 
+        {
+        TPtr8 tmpDes((TPtr8)iReadBuffer->Des());
+
+        iFile.Read(iFilePos, (TPtr8&)tmpDes, iReadBufferSize);
+        
+        if (iReadBuffer->Size() == 0) return 0; 
+        iFile.Seek(ESeekStart, iFilePos);
+        iBufferStartOffset = iFilePos;
+        iBufferEndOffset = iFilePos+iReadBuffer->Des().Size()-1;        
+        }
+    bufSize = Min(iReadBuffer->Des().Length(), aLength);
+    aDes.Copy(iReadBuffer->Des().Mid(iFilePos-iBufferStartOffset, bufSize));
+    iFilePos = iFilePos+aDes.Size();
+    return aDes.Size();
+
+    }
+
+TInt CProcInFileHandler::BufferedFileReadChar(TInt aPos, TUint8& aChar)
+    {
+
+    TBuf8<1> cha;
+    BufferedFileRead(aPos, cha);
+
+    if (cha.Size() == 1)
+        {
+        aChar = cha[0];
+        return 1;
+        }
+    else
+        {
+        return 0;
+        }
+
+    }
+
+TBool CProcInFileHandler::BufferedFileSetFilePos(TInt aPos) 
+    {
+
+    
+    TInt fileSize = 0;
+    iFile.Seek(ESeekEnd, fileSize);
+
+    iFile.Seek(ESeekStart, aPos);
+
+    if (aPos == 0)
+        {
+        iBufferStartOffset = 0;
+        iBufferEndOffset = 0;
+
+        }
+    
+    if (aPos < 0) 
+        {
+        return EFalse;
+        }
+    else if (aPos > fileSize) 
+        {
+        return EFalse;
+        }
+    else 
+        {
+        iFilePos = aPos;
+        }
+    return ETrue;
+    }
+
+TInt CProcInFileHandler::BufferedFileGetFilePos() 
+    {
+
+    return iFilePos;
+
+    }
+
+TInt CProcInFileHandler::BufferedFileGetSize()
+    {
+
+    TInt fileSize = 0;
+    iFile.Size(fileSize);
+
+    return fileSize;
+
+
+    }
+
+    
+TInt8 CProcInFileHandler::NormalizingMargin() const 
+    {
+    return iNormalizingMargin;
+    }
+    
+TBool CProcInFileHandler::ManipulateGainL(HBufC8*& aFrameIn) 
+    {
+    
+    if (iClip == 0)
+        {
+        return ETrue;
+        }
+                
+    if (iProperties->iAudioTypeExtension != EAudExtensionTypeNoExtension)
+        {
+        
+        // gain manipulation with AACPlus is done in time domain
+        
+        if (iWavFrameHandler == 0)
+            {
+            
+            const TInt KBitDepth = 16;
+            iWavFrameHandler = CProcWAVFrameHandler::NewL(KBitDepth);
+            }
+            
+        
+        }
+                
+    
+    // check if the clip is normalized
+    TInt8 normalizingGain1 = iNormalizingMargin;
+    
+    // check what is the current gain according to dynamic level marks
+    TInt8 newGain1 = GetGainNow();
+    
+    
+    // the combination of dynamic level marks + normalizing
+    TInt8 normalizedGain1 = 0;
+    if ( ((TInt)newGain1+normalizingGain1) > (TInt)KMaxTInt8)
+        {
+        normalizedGain1 = KMaxTInt8;
+        }
+    else
+        {
+        normalizedGain1 = static_cast<TInt8>(newGain1+normalizingGain1); 
+        }
+        
+    
+    if (normalizedGain1 != 0)
+        {
+        HBufC8* frameOut = 0;    
+        // if we need to adjust gain...
+        TBool manip = ETrue;
+        if (iProperties->iAudioTypeExtension != EAudExtensionTypeNoExtension)
+            {
+            
+            manip = iWavFrameHandler->ManipulateGainL(aFrameIn, frameOut, normalizedGain1);
+            }
+        else
+            {
+            manip = iFrameHandler->ManipulateGainL(aFrameIn, frameOut, normalizedGain1);    
+            }
+        
+        
+        if (manip)
+            {
+        
+            CleanupStack::PushL(aFrameIn);
+            CleanupStack::PushL(frameOut);
+            
+            if (frameOut->Size() > aFrameIn->Size())
+                {
+                // if manipulated frame was longer than the original
+                aFrameIn = aFrameIn->ReAllocL(frameOut->Size());
+                
+                }
+            aFrameIn->Des().Delete(0, aFrameIn->Size());
+            aFrameIn->Des().Copy(frameOut->Des());
+            
+            CleanupStack::PopAndDestroy(frameOut);
+            CleanupStack::Pop(); // aFrameIn
+            }
+        
+    
+        }
+    else
+        {
+        return EFalse;
+        }
+        
+    return ETrue;
+    }
+
+TInt8 CProcInFileHandler::GetGainNow() 
+    {
+    TInt markAmount = iClip->DynamicLevelMarkCount();
+    TTimeIntervalMicroSeconds ti(0);
+    TAudDynamicLevelMark previous(ti,0);
+    //TInt32 durationMilliseconds =     (aClip->Info()->Properties().iDuration.Int64()/1000).GetTInt();
+    TAudDynamicLevelMark next(iClip->Info()->Properties().iDuration,0);
+
+    for (TInt a = 0 ; a < markAmount ; a++) 
+        {
+        TAudDynamicLevelMark markNow = iClip->DynamicLevelMark(a);
+        
+        if (ProcTools::MilliSeconds(markNow.iTime) > iCurrentTimeMilliseconds) 
+            {
+            next = markNow;
+            break;
+            }
+
+        previous = markNow;
+
+        }
+
+    TInt32 previousMilli = ProcTools::MilliSeconds(previous.iTime);
+    
+    TInt32 nextMilli = ProcTools::MilliSeconds(next.iTime);
+    
+    TInt32 timeDifference = nextMilli - previousMilli;
+    
+    TInt8 previousLevel = previous.iLevel;
+    TInt8 nextLevel = next.iLevel;
+    
+    // If the levels are positive then the amount of gain needs to be reduced
+    if (previousLevel > 0)
+        {
+        previousLevel /= KAedPositiveGainDivider;
+        }
+    if (nextLevel > 0)
+        {
+        nextLevel /= KAedPositiveGainDivider;
+        }
+
+    if (timeDifference == 0) 
+        {
+        return previousLevel;
+        }
+        
+    TInt32 fraction = ((iCurrentTimeMilliseconds-previousMilli)*100)/timeDifference;
+    TInt8 newGain = 0;
+    
+    TInt8 levelDifference = static_cast<TInt8>(Abs(nextLevel - previousLevel));
+    TInt8 inc = 0;
+    if (fraction > 0) 
+        {
+        inc = static_cast<TInt8>((levelDifference*fraction)/100);
+        }
+
+    if (nextLevel - previousLevel >= 0) 
+        {
+        newGain = static_cast<TInt8>(previousLevel + inc);
+        }
+    else 
+        {
+        newGain = static_cast<TInt8>(previousLevel - inc);
+        }
+    
+    return newGain;
+
+    }
+    
+TBool CProcInFileHandler::WriteDataToInputBufferL(const TDesC8& aData)
+    {
+    
+    if (iInputBuffer == 0)
+        {
+        iInputBuffer = HBufC8::NewL(aData.Size());
+        }
+    else if (iInputBuffer->Des().MaxSize() < iInputBuffer->Length() + aData.Length())
+        {
+        iInputBuffer = iInputBuffer->ReAllocL(iInputBuffer->Length() + aData.Length());
+        }
+     
+    iInputBuffer->Des().Append(aData);
+    
+    return ETrue;
+    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/ProcProcessAO.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,332 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "ProcProcessAO.h"
+#include "AudCommon.h"
+#include "AudPanic.h"
+#include "audconstants.h"
+
+
+
+
+TBool CProcProcess::StartSyncProcessingL(const CAudSong* aSong, TBool aGetTimeEstimation)
+    {
+
+    iSong = aSong;
+    
+    if (iEncoder != 0)
+        {
+        delete iEncoder;
+        iEncoder = 0;
+        }
+    iEncoder = CProcEncoder::NewL();
+    iEncoder->InitL(iSong->OutputFileProperties().iAudioType, 
+                    iSong->OutputFileProperties().iSamplingRate,
+                    iSong->OutputFileProperties().iChannelMode, 
+                    iSong->OutputFileProperties().iBitrate );
+                    
+    
+    if (iAMRBuf)
+        {
+        delete iAMRBuf;
+        iAMRBuf = 0;
+        
+        }
+    // buffer for extra AMR-frames
+    iAMRBuf = HBufC8::NewL(KAedMaxAMRFrameLength);
+    
+    if (iDecBuffer)
+        {
+        delete iDecBuffer;   
+        iDecBuffer = 0;
+        
+        }
+        
+    iDecBuffer = HBufC8::NewL(KAedMaxFeedBufferSize);
+    
+    TInt rawFrameSize = KAedSizeAMRBuffer;
+    if (aSong->OutputFileProperties().iSamplingRate == KAedSampleRate8kHz)
+        {
+        rawFrameSize = KAedSizeAMRBuffer;
+        }
+    else 
+        {
+        rawFrameSize = KAedSizeAACBuffer;
+        if ( aSong->OutputFileProperties().iChannelMode == EAudStereo )
+            {
+            rawFrameSize *= 2;
+            }
+        }
+    
+
+    CAudProcessorImpl* processorImpl = CAudProcessorImpl::NewLC();
+
+    processorImpl->ProcessSongL(aSong, rawFrameSize, aGetTimeEstimation);
+
+    CleanupStack::Pop(processorImpl);
+    iProcessorImpl = processorImpl;
+
+
+    return ETrue;
+
+    }
+
+TBool CProcProcess::ProcessSyncPieceL(HBufC8*& aFrame, TInt& aProgress,
+                                       TTimeIntervalMicroSeconds& aDuration)
+    {
+    
+    // first check if we have frames left from the previous encoding
+    
+    if (iAMRBuf->Length() > 0)
+        {
+        // we do have some frames left
+        
+        TInt frLen = ProcTools::GetNextAMRFrameLength(iAMRBuf, 0);
+        
+        if (frLen > iAMRBuf->Length())
+            {
+            // something has gone wrong, we don't have a proper AMR frame in the buffer
+            User::Leave(KErrGeneral);
+            }
+        
+        aFrame = HBufC8::NewL(frLen);
+        aFrame->Des().Append(iAMRBuf->Left(frLen));
+        iAMRBuf->Des().Delete(0, frLen);
+        
+        aDuration = KAedAMRFrameDuration;
+        iProgress = aProgress;
+        
+        return EFalse;
+        }
+    
+    iDecBuffer->Des().Delete(0, iDecBuffer->Size());
+    
+    HBufC8* frame = 0;
+        
+    TBool rawFrame = EFalse;
+    
+    TInt outDurationMilli = 0;
+    
+    TBool ret = iProcessorImpl->ProcessSyncPieceL(frame, aProgress, aDuration, rawFrame);
+    iProgress = aProgress;
+    
+    if (!rawFrame)
+        {
+        
+        // frame already in compressed domain, no need for encoding
+        if (ret || frame == 0) 
+            {
+            
+            iTimeEstimate = iProcessorImpl->GetFinalTimeEstimate();
+            
+            aFrame = frame;
+            // no more frames left -> processing ready
+            delete iProcessorImpl;
+            iProcessorImpl = 0;
+            delete iDecBuffer;
+            iDecBuffer = 0;
+            return ETrue;
+            }
+        else 
+            {
+            aFrame = frame;
+            return EFalse;
+            }
+    
+        }
+    else
+        {
+        // frame needs to be encoded
+        if (ret || frame == 0) 
+            {
+            
+            iTimeEstimate = iProcessorImpl->GetFinalTimeEstimate();
+            // no more frames left -> processing ready
+            delete iProcessorImpl;
+            iProcessorImpl = 0;
+            delete iDecBuffer;
+            iDecBuffer = 0;
+            return ETrue;
+            }    
+        
+        
+        // feed encoder until we have something in the output buffer
+
+        
+        iEncoder->FillEncBufferL(*frame, iDecBuffer, outDurationMilli);
+ 
+        delete frame;
+        frame = 0;
+   
+        while (iDecBuffer->Size() == 0)
+            {
+            
+            // we need more input for encoder
+            
+            TTimeIntervalMicroSeconds dur;
+                       ret = iProcessorImpl->ProcessSyncPieceL(frame, aProgress, dur, rawFrame);
+                
+            if (!ret)
+                {
+                
+                }
+            else
+                {
+                
+                // no more frames left -> processing ready
+                
+                
+                iTimeEstimate = iProcessorImpl->GetFinalTimeEstimate();
+                delete iProcessorImpl;
+                iProcessorImpl = 0;
+                delete iDecBuffer;
+                iDecBuffer = 0;
+                return ETrue;
+                }
+                
+  
+            
+            iProgress = aProgress;
+            
+            if (ret) 
+                {
+                
+                // no more frames left -> processing ready
+                
+                iTimeEstimate = iProcessorImpl->GetFinalTimeEstimate();
+                delete iProcessorImpl;
+                iProcessorImpl = 0;
+                delete iDecBuffer;
+                iDecBuffer = 0;
+                return ETrue;
+                }
+            
+            if (!rawFrame)
+                {
+          
+                // we got encoded frame -> return it
+                aFrame = frame;
+                return EFalse;
+                }
+            
+            // we should now have a raw frame in aFrame -> feed the encoder
+            
+            aDuration = aDuration.Int64() + dur.Int64();
+
+            iEncoder->FillEncBufferL(*frame, iDecBuffer, outDurationMilli);
+            delete frame;
+            frame = 0;
+          
+            }
+        
+        }
+        
+    // read the encoded frame to aFrame
+    
+    TInt frameLen = 0;
+    if (iEncoder->DestAudType() == EAudAMR)
+        {
+        frameLen = ProcTools::GetNextAMRFrameLength(iDecBuffer, 0);
+        }
+    
+    if (frameLen < iDecBuffer->Length() && iEncoder->DestAudType() == EAudAMR)
+        {
+        
+        // we got more than one AMR frame, return the first now
+        // and the second when this function is called next time
+        aFrame = HBufC8::NewL(frameLen);
+        aFrame->Des().Append(iDecBuffer->Des().Left(frameLen));
+        
+        if ( (iDecBuffer->Length() + iAMRBuf->Length() - frameLen) > iAMRBuf->Des().MaxLength())
+            {
+            // if the temporary storage is too small, we need more space for it
+            iAMRBuf = iAMRBuf->ReAlloc(iDecBuffer->Length() + iAMRBuf->Length() - frameLen);
+            }
+            
+        iAMRBuf->Des().Append(iDecBuffer->Right(iDecBuffer->Length() - frameLen));
+        
+        }
+    else
+        {
+        
+        aFrame = HBufC8::NewL(iDecBuffer->Size());
+        aFrame->Des().Append(iDecBuffer->Des());
+        
+        }
+        
+    iDecBuffer->Des().Delete(0, iDecBuffer->Size());
+           
+    aDuration = outDurationMilli*1000;
+    
+    return EFalse;
+    
+    }
+
+TInt64 CProcProcess::GetFinalTimeEstimate() const
+    {
+    
+    return iTimeEstimate;
+    
+    }
+
+
+CProcProcess* CProcProcess::NewL() 
+    {
+
+
+    CProcProcess* self = new (ELeave) CProcProcess();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CProcProcess::~CProcProcess() 
+    {
+
+    if (iProcessorImpl != 0)
+        {
+        delete iProcessorImpl;
+        iProcessorImpl = 0;
+        }
+        
+    delete iEncoder;
+    
+    delete iDecBuffer;
+    iDecBuffer = 0;
+    
+    delete iAMRBuf;
+    
+    
+    }
+    
+
+void CProcProcess::ConstructL() 
+    {
+    
+    
+    }
+
+CProcProcess::CProcProcess() : iProcessorImpl(0), iSong(0)
+    {
+
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/ProcTimeEstimateAO.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+
+#include "ProcTimeEstimateAO.h"
+
+
+void CProcTimeEstimateAO::RunL() 
+    {
+    
+    HBufC8* frame = 0;
+    TInt progress = 0;
+    TTimeIntervalMicroSeconds duration;
+    
+    
+    TBool ret = EFalse; 
+    TRAPD(err, ret = iProcessingObject->ProcessSyncPieceL(frame, progress, duration));
+    
+    if (err != KErrNone)
+        {
+        // something went wrong
+        
+        delete frame;
+        
+        delete iProcessingObject;
+        iProcessingObject = 0;
+        
+        // notify
+        iTEObserver->NotifyTimeEstimateReady(0);
+        
+        }
+    
+    if (!ret) 
+        {
+        
+        if (frame)
+            {
+            
+            // frame is not needed
+            delete frame;
+            frame = 0;
+            
+            }
+        
+        SetActive();
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+        
+        return;
+        }
+    else
+        {
+        
+        TInt64 timeEstimate = iProcessingObject->GetFinalTimeEstimate();
+        
+        
+        delete iProcessingObject;
+        iProcessingObject = 0;
+        
+        // notify
+        iTEObserver->NotifyTimeEstimateReady(timeEstimate);
+        
+        return;
+        
+        }
+
+
+    }
+
+void CProcTimeEstimateAO::DoCancel() 
+    {
+
+    }
+   
+CProcTimeEstimateAO* CProcTimeEstimateAO::NewL() 
+    {
+
+
+    CProcTimeEstimateAO* self = new (ELeave) CProcTimeEstimateAO();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CProcTimeEstimateAO::~CProcTimeEstimateAO() 
+    {
+    Cancel();   
+    delete iProcessingObject;    
+
+    }
+    
+
+TBool CProcTimeEstimateAO::StartL(const CAudSong* aSong, MAudTimeEstimateObserver& aTEObserver) 
+    {
+    
+    iTEObserver = &aTEObserver;
+    
+    iSong = aSong;
+
+    delete iProcessingObject;
+    iProcessingObject = NULL; /* Must set to null before reallocating with NewL */
+    iProcessingObject = CProcProcess::NewL();
+    
+    iProcessingObject->StartSyncProcessingL(iSong, ETrue);
+     
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+    
+    return ETrue;
+
+    }
+    
+void CProcTimeEstimateAO::CancelTimeEstimate()
+    {
+
+    Cancel();   
+    delete iProcessingObject;
+    iProcessingObject = 0;
+    // notify
+    return;
+    
+    
+    }
+
+void CProcTimeEstimateAO::ConstructL() 
+    {
+
+    }
+
+CProcTimeEstimateAO::CProcTimeEstimateAO() :  CActive(0)
+    {
+
+    CActiveScheduler::Add(this);
+
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/ProcTools.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1043 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "ProcTools.h"
+#include "AudPanic.h"
+
+#include "mime_io.h"
+
+
+TBool ProcTools::Dec2Bin(TUint8 aDec, TBuf8<8>& aBinary) 
+    {
+
+    // clear aBinary just in case
+    aBinary.Delete(0, aBinary.Length());
+
+    aBinary.AppendNum(aDec, EBinary);
+
+    TInt zerosNeeded = 0;
+    if (aBinary.Length() == 8) 
+        {
+        // the MSB is one -> no padding needed
+        }
+    else 
+        {
+            
+        zerosNeeded = 8 - aBinary.Length();
+        for(TInt as = 0 ; as < zerosNeeded ; as++) 
+            {
+            aBinary.AppendNum(0);
+            }
+
+        for (TInt tr = 8 - 1 ; tr >= 0 ; tr--) 
+            {
+
+            if (tr >= zerosNeeded) 
+                { 
+                aBinary[tr] = aBinary[tr-zerosNeeded];
+                }
+            else 
+                {
+                aBinary[tr] = '0';
+                }
+        
+            }
+        }
+
+
+    return ETrue;
+    }
+
+TBool ProcTools::Dec2BinL(TUint32 aDec, HBufC8*& aBin)
+    {
+    
+    // 32 bits, the leftmost is one
+    TUint32 bitMask = 0x80000000;
+
+    TBool onlyZeros = ETrue;
+    for (TInt a = 32 ; a > 0 ; a--)
+        {
+        TUint32 res = bitMask & aDec;
+        
+        if (res > 0 && onlyZeros)
+            {
+            // the first one from left found
+            onlyZeros = EFalse;
+            aBin = HBufC8::NewL(a);
+            aBin->Des().Append('1');
+            }
+        else if (res > 0 && !onlyZeros)
+            {
+            aBin->Des().Append('1');
+            }
+        else if (res == 0 && !onlyZeros)
+            {    
+            aBin->Des().Append('0');
+        
+            }
+        bitMask >>= 1;
+        }
+
+    return ETrue;
+
+    }
+
+TBool ProcTools::Bin2Dec(const TDesC8& aBin, TUint& aDec) 
+    {
+
+    TLex8 leks(aBin);
+
+    if (leks.Val(aDec, EBinary) != KErrNone) 
+        {
+        return EFalse;
+        }
+    return ETrue;
+
+    }
+
+TBool ProcTools::Des2Dec(TDesC8& aDes, TUint& aDec) 
+    {
+
+    TLex8 leks(aDes);
+
+    if (leks.Val(aDec, EDecimal) != KErrNone) 
+        {
+        return EFalse;
+        }
+    return ETrue;
+
+
+    }
+
+TBool ProcTools::Des2BinL(const TDesC8& aDes, HBufC8*& aBin) 
+    {
+
+    aBin = HBufC8::NewL(aDes.Length()*8);
+    // clear aBinary just in case
+    
+    for (TInt a = 0 ; a < aDes.Length() ; a++) 
+        {
+    
+        TUint8 chDec = aDes[a];
+
+        aBin->Des().AppendNum(chDec, EBinary);
+        
+        TInt zerosNeeded = 0;
+        if (aBin->Des().Length() == (a+1)*8) 
+            {
+            // the MSB is one -> no padding needed
+            }
+        else 
+            {
+            
+            zerosNeeded = (a+1)*8 - aBin->Des().Length();
+            for(TInt as = 0 ; as < zerosNeeded ; as++) 
+                {
+                aBin->Des().Insert(a*8, _L8("0"));
+                //AppendNum(0);
+                }
+           
+            }
+        }
+
+
+    return ETrue;
+
+    }
+    
+TInt ProcTools::MilliSeconds(TTimeIntervalMicroSeconds aMicroSeconds)
+    {
+    
+#ifndef EKA2
+    return (aMicroSeconds.Int64()/1000).GetTInt();
+#else
+    return (aMicroSeconds.Int64()/1000);
+#endif
+    
+    }
+
+TTimeIntervalMicroSeconds ProcTools::MicroSeconds(TInt aMilliSeconds)
+    {
+    
+    TTimeIntervalMicroSeconds mic(aMilliSeconds*1000);
+    return mic;
+    }
+    
+TInt ProcTools::GetTInt(TInt64 aTInt64)
+    {
+
+#ifndef EKA2
+    return aTInt64.GetTInt();
+#else        
+    return aTInt64;
+#endif
+        
+    }
+
+TInt ProcTools::GetValueFromShuffledFrame(const HBufC8* aFrame, 
+                                          const TUint8 aBitPositions[], 
+                                          const TInt aSize) 
+    {
+
+    HBufC8* inBytes = 0;
+    TRAPD(err, inBytes = HBufC8::NewL(aSize));
+    if (err != KErrNone)
+        {
+        inBytes = 0;
+        return -1;
+        }
+    
+    
+    _LIT8(KZero, "0");
+    _LIT8(KOne, "1");
+
+
+    for (TInt a = 0 ; a < aSize ; a++) 
+        {
+        
+        TUint8 mask = 0x80; // 1000 0000b
+        TUint byteNumber = aBitPositions[a]/8;
+        TUint bitNumber = aBitPositions[a]%8;
+        
+        const TUint8 byteNow = (*aFrame)[byteNumber];
+
+        mask >>= bitNumber;
+
+        //TUint8 masked = byteNow & mask;
+        // why casting is needed, dunno?
+
+        TUint8 masked = static_cast<TUint8>(byteNow & mask);
+
+        if (masked == 0) 
+            {
+            inBytes->Des().Append(KZero);
+            }
+        else 
+            {
+            inBytes->Des().Append(KOne);
+            }
+        }
+    TUint dec = 0;
+    Bin2Dec(inBytes->Des(), dec);
+    delete inBytes;
+    inBytes = 0;
+    return dec;
+
+
+    }
+
+
+
+TInt ProcTools::GetValueFromShuffledAWBFrameL(const HBufC8* aFrame, TInt aBitRate, TInt aBitPosition, TInt aLength)
+    {
+
+    HBufC8* inBytes = HBufC8::NewLC(aLength);
+    
+    
+    _LIT8(KZero, "0");
+    _LIT8(KOne, "1");
+
+    const TInt* table = 0;
+    TInt tableSize = 0;
+
+    switch(aBitRate)
+        {
+        case(23850):
+            {
+            table = sort_2385;
+            tableSize = 477;
+            break;
+            }
+        case(23050):
+            {
+            table = sort_2305;
+            tableSize = 461;
+            break;
+            }
+        case(19850):
+            {
+            table = sort_1985;
+            tableSize = 397;
+            break;
+            }
+        case(18250):
+            {
+            table = sort_1825;
+            tableSize = 365;
+            break;
+            }
+        case(15850):
+            {
+            table = sort_1585;
+            tableSize = 317;
+            break;
+            }
+        case(14250):
+            {
+            table = sort_1425;
+            tableSize = 285;
+            break;
+            }
+        case(12650):
+            {
+            table = sort_1265;
+            tableSize = 253;
+            break;
+            }
+        case(8850):
+            {
+            table = sort_885;
+            tableSize = 177;
+            break;
+            }
+        case(6600):
+            {
+            table = sort_660;
+            tableSize = 132;
+            break;
+            }
+        default:
+            {
+            // illegal bitrate
+            CleanupStack::PopAndDestroy(inBytes);
+            return -1;
+            }
+
+        }
+
+
+    for (TInt a = 0 ; a < aLength ; a++) 
+        {
+        TInt bitIndex = FindIndex(aBitPosition+a, table, tableSize)+8;
+
+        TUint8 mask = 0x80; // 1000 0000b
+        TUint byteNumber = bitIndex/8;
+        TUint bitNumber = bitIndex%8;
+        
+        const TUint8 byteNow = (*aFrame)[byteNumber];
+
+        mask >>= bitNumber;
+
+        //TUint8 masked = byteNow & mask;
+        // why casting is needed, dunno?
+
+        TUint8 masked = static_cast<TUint8>(byteNow & mask);
+
+        if (masked == 0) 
+            {
+            inBytes->Des().Append(KZero);
+            }
+        else 
+            {
+            inBytes->Des().Append(KOne);
+            }
+        }
+
+    TUint dec = 0;
+    Bin2Dec(inBytes->Des(), dec);
+    CleanupStack::PopAndDestroy(inBytes);
+
+    inBytes = 0;
+    return dec;
+
+    }
+
+
+TBool ProcTools::SetValueToShuffledAWBFrame(TUint8 aNewValue, HBufC8* aFrame, 
+                                            TInt aBitRate, TInt aBitPosition, TInt aLength)
+    {
+
+    const TInt* table = 0;
+    TInt tableSize = 0;
+
+    switch(aBitRate)
+        {
+        case(23850):
+            {
+            table = sort_2385;
+            tableSize = 477;
+            
+            break;
+            }
+        case(23050):
+            {
+            table = sort_2305;
+            tableSize = 461;
+            
+            break;
+            }
+        case(19850):
+            {
+            table = sort_1985;
+            tableSize = 397;
+            
+            break;
+            }
+        case(18250):
+            {
+            table = sort_1825;
+            tableSize = 365;
+            
+            break;
+            }
+        case(15850):
+            {
+            table = sort_1585;
+            tableSize = 317;
+            
+            break;
+            }
+        case(14250):
+            {
+            table = sort_1425;
+            tableSize = 285;
+            
+            break;
+            }
+        case(12650):
+            {
+            table = sort_1265;
+            tableSize = 253;
+            
+            break;
+            }
+        case(8850):
+            {
+            table = sort_885;
+            tableSize = 177;
+            
+            break;
+            }
+        case(6600):
+            {
+            table = sort_660;
+            tableSize = 132;
+            
+            break;
+            }
+        default:
+            {
+            // illegal bitrate
+            return -1;
+            }
+
+        }
+
+
+    _LIT8(KZero, "0");
+
+    TBuf8<8> newValueBin;
+    Dec2Bin(aNewValue, newValueBin);
+    // remove leading zeros
+    newValueBin.Delete(0, 8-aLength);
+
+
+
+    TPtr8 framePtr(aFrame->Des());
+
+    for (TInt a = 0 ; a < newValueBin.Size() ; a++) 
+        {
+
+        TInt bitIndex = FindIndex(aBitPosition+a, table, tableSize)+8;
+
+        TUint8 bitPositionInByte = static_cast<TUint8>(bitIndex%8);
+        TUint byteNumber = bitIndex/8;
+
+        if (newValueBin.Mid(a,1).Compare(KZero) == 0) 
+            {
+
+            TUint8 mask = 0x80; // 0111 1111b
+            mask >>= bitPositionInByte;
+            mask = static_cast<TUint8>(~mask);
+
+            //--->
+//            TUint8 oldByte = framePtr[byteNumber];
+    //        TUint8 newByte = oldByte & mask;
+            //<--
+
+            framePtr[byteNumber] = static_cast<TUint8>(framePtr[byteNumber] & mask);  
+    
+            }
+        else 
+            {
+
+            TUint8 mask = 0x80; // 1000 0000b
+            mask >>= bitPositionInByte;
+            
+            //--->
+//            TUint8 oldByte = framePtr[byteNumber];
+//            TUint8 newByte = oldByte & mask;
+            //<--
+            framePtr[byteNumber] = static_cast<TUint8>(framePtr[byteNumber] | mask);
+
+            }
+        
+        }
+
+    return EFalse;
+    }
+
+TBool ProcTools::SetValueToShuffledFrame(HBufC8* aFrame, TUint8 aNewValue, 
+                                         const TUint8 aBitPositions[], 
+                                         TInt aSize) 
+    {
+
+    
+    _LIT8(KZero, "0");
+    
+    TBuf8<8> newValueBin;
+    Dec2Bin(aNewValue, newValueBin);
+    newValueBin.Delete(0, 8-aSize);
+
+    TPtr8 framePtr(aFrame->Des());
+
+    for (TInt a = 0 ; a < aSize ; a++) 
+        {
+
+        TUint8 bitPosition = static_cast<TUint8>(aBitPositions[a]%8);
+        TUint byteNumber = aBitPositions[a]/8;
+
+        if (newValueBin.Mid(a,1).Compare(KZero) == 0) 
+            {
+
+            TUint8 mask = 0x80; // 0111 1111b
+            mask >>= bitPosition;
+            mask = static_cast<TUint8>(~mask);
+
+            //--->
+//            TUint8 oldByte = framePtr[byteNumber];
+    //        TUint8 newByte = oldByte & mask;
+            //<--
+
+            framePtr[byteNumber] = static_cast<TUint8>(framePtr[byteNumber] & mask);  
+    
+            }
+        else 
+            {
+
+            TUint8 mask = 0x80; // 1000 0000b
+            mask >>= bitPosition;
+            
+            //--->
+//            TUint8 oldByte = framePtr[byteNumber];
+//            TUint8 newByte = oldByte & mask;
+            //<--
+            framePtr[byteNumber] = static_cast<TUint8>(framePtr[byteNumber] | mask);
+
+            }
+
+
+        
+        }
+    
+    return ETrue;
+
+    }
+
+
+
+TBool ProcTools::WriteValuesToFileL(const RArray<TInt>& aArray, const TDesC& aFilename) 
+    {
+
+    RFs fs;
+    User::LeaveIfError(fs.Connect());
+
+    RFile file;
+    TInt err=file.Open(fs, aFilename, EFileWrite);
+    
+    if (err==KErrNotFound) 
+        {
+        err=file.Create(fs, aFilename, EFileWrite);
+        }
+    TInt nolla = 0;
+    file.Seek(ESeekEnd, nolla);
+    for (TInt a = 0; a < aArray.Count() ; a++) 
+        {
+        TBuf8<8> num;
+        num.AppendNum(aArray[a]);
+        file.Write(num);
+        file.Write(_L8("\n"));
+
+
+        }
+
+    file.Close();
+    fs.Close();
+
+    return ETrue;
+    }
+
+
+TUint8 ProcTools::FindNewIndexSQ(TInt aNewGain, const TInt aGainTable[], TInt aTableSize) 
+    {
+
+    if (aTableSize > 256)
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    TUint8 tableSize = static_cast<TUint8>(aTableSize-1);
+
+    TInt minimum = 0xFFFF;
+    TUint8 indexFound = 0;
+
+    for (TUint a = 0 ; a <= tableSize ; a++) 
+        {
+            
+        if (Abs(aGainTable[a]-aNewGain) < minimum) 
+            {
+            minimum = Abs(aGainTable[a]-aNewGain);
+            indexFound = static_cast<TUint8>(a);
+            }
+        }
+
+    return indexFound;
+
+    }
+
+TUint8 ProcTools::FindNewIndexVQ(TInt aNewGain, TInt aOldPitch, const TInt aGainTable[], TInt aTableSize) 
+    {
+
+    if (aTableSize > 256)
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    TUint8 tableSize = static_cast<TUint8>(aTableSize-1);
+
+
+
+    TInt minimum = KMaxTInt;
+    TUint8 indexFound = 0;
+
+    for (TUint a = 0 ; a <= tableSize ; a+=2) 
+        {
+
+        // gpitch: Q14 , 2^14 = 16384
+        TInt distance_pitch = (100*(Abs(aGainTable[a]-aOldPitch)))/16384;
+
+        // g_fac: Q12 , 2^12 = 4096
+        TInt distance_fc = (100*Abs(aGainTable[a+1]-aNewGain))/4096;
+        
+
+        TInt distance = distance_pitch*distance_pitch + distance_fc*distance_fc;
+        
+        if (distance < minimum) 
+            {
+            minimum = distance;
+            indexFound = static_cast<TUint8>(a);
+            }
+        }
+
+    return static_cast<TUint8>(indexFound/2);
+
+    }
+
+TUint8 ProcTools::FindNewIndexVQ2(TInt aNewGain, TInt aOldPitch, const TInt aGainTable[], TInt aTableSize)
+    {
+
+    if (aTableSize > 256)
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+
+    TUint8 tableSize = static_cast<TUint8>(aTableSize-1);
+
+    TInt minimum = KMaxTInt;
+    TUint8 indexFound = 0;
+
+    for (TUint a = 0 ; a <= tableSize ; a+=2) 
+        {
+
+        // gpitch: Q14 , 2^14 = 16384
+        TInt distance_pitch = (100*(Abs(aGainTable[a]-aOldPitch)))/16384;
+
+        // g_fac: Q11 , 2^11 = 2048
+        TInt distance_fc = (100*Abs(aGainTable[a+1]-aNewGain))/2048;
+        
+
+        TInt distance = distance_pitch*distance_pitch + distance_fc*distance_fc;
+        
+        if (distance < minimum) 
+            {
+            minimum = distance;
+            indexFound = static_cast<TUint8>(a);
+            }
+        }
+
+    return static_cast<TUint8>(indexFound/2);
+
+    
+
+
+    }
+
+
+TUint8 ProcTools::FindNewIndex475VQ(TInt aNewGain0, TInt aOldPitch0, TInt aNewGain1, TInt aOldPitch1)
+    {
+
+    TInt minimum = KMaxTInt;
+    TInt indexFound = -1;
+
+    TInt tableSize = 256*4;
+
+
+    for (TInt a = 0 ; a < tableSize-3 ; a+=4) 
+        {
+
+        // gpitch: Q14 , 2^14 = 16384
+        TInt distance_pitch0 = (100*(Abs(KAmrGainTable475[a]-aOldPitch0)))/16384;
+        TInt distance_pitch1 = (100*(Abs(KAmrGainTable475[a+2]-aOldPitch1)))/16384;
+
+        // g_fac: Q12 , 2^12 = 4096
+        TInt distance_fc0 = (100*Abs(KAmrGainTable475[a+1]-aNewGain0))/4096;
+        TInt distance_fc1 = (100*Abs(KAmrGainTable475[a+3]-aNewGain1))/4096;        
+
+        TInt distance = distance_pitch0*distance_pitch0 + distance_fc0*distance_fc0 +
+                        distance_pitch1*distance_pitch1 + distance_fc1*distance_fc1;
+        
+        if (distance < minimum) 
+            {
+            minimum = distance;
+            indexFound = a;
+            }
+        }
+
+    return static_cast<TUint8>(indexFound/4);
+
+    }
+
+TInt ProcTools::FindIndex(TInt aKey, const TInt aBitPositions[], TInt aTableLength)
+    {
+    
+    for (TInt a = 0 ; a < aTableLength ; a++)
+        {
+        if (aBitPositions[a] == aKey) return a;
+        }
+
+    return -1;
+
+    }
+
+TBool ProcTools::GenerateADTSHeaderL(TBuf8<7>& aHeader, TInt aFrameLength, TAudFileProperties aProperties)
+    {
+    TUint8 byte1 = 0xFF;
+
+    TUint8 byte2 = 0x0;
+    if (aProperties.iAudioType == EAudAAC_MPEG2)
+        {
+        byte2 = 0xF9;
+        }
+    else if (aProperties.iAudioType == EAudAAC_MPEG4)
+        {
+        byte2 = 0xF1;
+        }
+    else return EFalse;
+    TBuf8<8> byte3b(8);
+    TBuf8<8> byte4b(8);
+    TBuf8<8> byte5b(8);
+    TBuf8<8> byte6b(8);
+    TBuf8<8> byte7b(8);
+
+    byte3b.Fill('0');
+    byte4b.Fill('0');
+    byte5b.Fill('0');
+    byte6b.Fill('0');
+    byte7b.Fill('0');
+
+    
+    const TInt KAAC_SAMPLING_RATES[16] = {96000,88200,64000,48000,44100,32000,24000,
+                                            22050,16000,12000,11025,8000,0,0,0,0};
+    
+    TBool srFound = EFalse;
+    TUint8 srIndex = 0; 
+    for (srIndex = 0 ; srIndex < 14 ; srIndex++)
+        {
+        if (KAAC_SAMPLING_RATES[srIndex] == aProperties.iSamplingRate) 
+            {
+            srFound = ETrue;
+            break;
+            }
+        }
+
+    if (srFound)
+        {
+        TBuf8<8> srB;
+        ProcTools::Dec2Bin(srIndex, srB);
+    
+        // Sampling rate
+        byte3b[2] = srB[4];
+        byte3b[3] = srB[5];
+        byte3b[4] = srB[6];
+        byte3b[5] = srB[7];
+
+        }
+
+    
+
+    // private bit
+    byte3b[6] = '0';
+
+    // channel configuration
+    byte3b[7] = '0';
+    if (aProperties.iChannelMode == EAudStereo)
+        {
+        byte4b[0] = '1';
+        byte4b[1] = '0';
+
+        }
+    else if(aProperties.iChannelMode == EAudSingleChannel)
+        {
+        byte4b[0] = '0';
+        byte4b[1] = '1';
+
+        }
+    else
+        {
+        return EFalse;
+        }
+
+    //original/copy & home
+    byte4b[2] = '0';
+    byte4b[3] = '0';
+    // copyright identification & start
+    byte4b[4] = '0';
+    byte4b[5] = '0';
+
+    HBufC8* lenBin = 0;
+    if (ProcTools::Dec2BinL(aFrameLength+7, lenBin))
+        {
+
+        TInt fromRight = 0;
+        for(TInt i = lenBin->Size()-1 ; i >= 0 ; i--)
+            {
+            if (fromRight < 3)
+                {
+                // byte7
+                byte6b[2-fromRight] = lenBin->Des()[i];    
+                }
+            else if (fromRight < 11)
+                {
+                // byte6
+                byte5b[10-fromRight] = lenBin->Des()[i];
+
+                }
+            else if (fromRight < 13)
+                {
+                // byte5
+                byte4b[18-fromRight] = lenBin->Des()[i];
+                }
+
+            fromRight++;
+            }
+
+        delete lenBin;
+        }
+    
+    TInt bitInd = 0; 
+    for (bitInd = 3 ; bitInd < 8 ; bitInd++)
+    {
+        byte6b[bitInd] = '1';
+    }
+    for (bitInd = 0 ; bitInd < 6 ; bitInd++)
+    {
+        byte7b[bitInd] = '1';
+    }
+    
+    
+    aHeader.Append(byte1);
+    aHeader.Append(byte2);
+
+    TUint tmpByte = 0;
+    ProcTools::Bin2Dec(byte3b, tmpByte);
+    
+    // profile
+    TUint8 bitMask = aProperties.iAACObjectType;
+    bitMask <<= 6;
+    tmpByte = tmpByte | bitMask;
+
+    aHeader.Append(static_cast<TUint8>(tmpByte));
+
+    ProcTools::Bin2Dec(byte4b, tmpByte);
+    aHeader.Append(static_cast<TUint8>(tmpByte));
+
+    ProcTools::Bin2Dec(byte5b, tmpByte);
+    aHeader.Append(static_cast<TUint8>(tmpByte));
+
+    ProcTools::Bin2Dec(byte6b, tmpByte);
+    aHeader.Append(static_cast<TUint8>(tmpByte));
+
+    ProcTools::Bin2Dec(byte7b, tmpByte);
+    aHeader.Append(static_cast<TUint8>(tmpByte));
+
+    return ETrue;
+
+    }
+
+TInt ProcTools::GetNextAMRFrameLength(const HBufC8* aFrame, TInt aPosNow)
+    {
+
+
+    if (aPosNow >= aFrame->Size()) return -1;
+
+
+    const TUint8 ch = (*aFrame)[aPosNow];
+
+    TUint dec_mode = (enum Mode)((ch & 0x0078) >> 3);
+    
+    switch (dec_mode)
+        {
+        case 0:
+            {
+            return 12+1;
+            }
+            
+        case 1:
+            {
+            return 13+1;
+            }
+            
+        case 2:
+            {
+            return 15+1;
+            }
+            
+        case 3:
+            {
+            return 17+1;
+            }
+            
+        case 4:
+            {
+            return 19+1;
+            }
+            
+        case 5:
+            {
+            return 20+1;
+            }
+            
+        case 6:
+            {
+            return 26+1;
+            }
+            
+        case 7:
+            {
+            return 31+1;
+            }
+            
+        case 8:
+            {
+            return 5+1;
+            }
+            
+        case 15:
+            {
+            return 0+1;
+            }
+            
+        default:
+            return 0+1;
+            
+        };
+    
+
+    }
+
+
+CProcessingEvent* CProcessingEvent::NewL()
+    {
+    CProcessingEvent* self = new (ELeave) CProcessingEvent();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+
+void CProcessingEvent::ConstructL()
+    {
+    }
+
+CProcessingEvent::~CProcessingEvent()
+    {
+    iAllIndexes.Close();
+    }
+
+
+CProcessingEvent::CProcessingEvent()
+    {
+    }
+
+void CProcessingEvent::InsertIndex(TInt aIndex)
+        {
+        iAllIndexes.Append(aIndex);
+        }
+
+TInt CProcessingEvent::GetIndex(TInt aProcessingEventIndex)
+    {
+    return iAllIndexes[aProcessingEventIndex];
+    }
+
+TBool CProcessingEvent::GetAllIndexes(RArray<TInt>& aAllIndexes)
+    {
+    for (TInt a = 0 ; a < iAllIndexes.Count() ; a++)
+        {
+        aAllIndexes.Append(iAllIndexes[a]);
+
+        }
+    return ETrue;
+    }
+
+TInt CProcessingEvent::IndexCount()
+    {
+    return iAllIndexes.Count();
+    }
+
+TInt CProcessingEvent::FindIndex(TInt aClipIndex)
+    {
+    return iAllIndexes.Find(aClipIndex);
+    }
+
+void CProcessingEvent::RemoveIndex(TInt aProcessingEventIndex)
+    {
+    iAllIndexes.Remove(aProcessingEventIndex);
+    }
+
+    
+TInt CProcessingEvent::Compare(const CProcessingEvent& c1, const CProcessingEvent& c2) 
+    {
+                
+    if (c1.iPosition > c2.iPosition) 
+        {
+        return 1;
+        }
+    else if (c1.iPosition < c2.iPosition) 
+        {
+        return -1;
+        }
+    else 
+        {
+        return 0;
+        }
+    }
+    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/ProcVisProcessor.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,464 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "ProcVisProcessor.h"
+#include "audconstants.h"
+
+#include "ProcMP4InFileHandler.h"
+#include "ProcADTSInFileHandler.h"
+#include "ProcMP3InFileHandler.h"
+#include "ProcAWBInFileHandler.h"
+#include "ProcWAVInFileHandler.h"
+#include "ProcAMRInFileHandler.h"
+
+
+#include "ProcAMRFrameHandler.h"
+#include "ProcAACFrameHandler.h"
+#include "ProcMP3FrameHandler.h"
+#include "ProcAWBFrameHandler.h"
+#include "ProcWAVFrameHandler.h"
+
+CProcVisProcessor* CProcVisProcessor::NewL()
+    {
+
+
+    CProcVisProcessor* self = new (ELeave) CProcVisProcessor();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CProcVisProcessor* CProcVisProcessor::NewLC()
+    {
+    CProcVisProcessor* self = new (ELeave) CProcVisProcessor();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+
+CProcVisProcessor::~CProcVisProcessor()
+    {
+
+    if (iVisualization != 0)
+        {
+        delete[] iVisualization;
+        }
+    if (iInFile != 0)
+        {
+        delete iInFile;
+        }
+    if (iFrameHandler != 0)
+        {
+        delete iFrameHandler;
+        }
+
+    }
+
+void CProcVisProcessor::VisualizeClipL(const CAudClipInfo* aClipInfo, TInt aSize)
+    {
+
+        // initialize...
+    iClipInfo = aClipInfo;
+    iVisualizationSize = aSize;
+    iVisualization = new (ELeave) TInt8[iVisualizationSize];
+    
+
+    if (aClipInfo->Properties().iFileFormat == EAudFormatAMR) 
+        {
+        CProcInFileHandler* inFileHandler = CProcAMRInFileHandler::NewL(aClipInfo->FileName(), 
+                                                                        aClipInfo->FileHandle(), 
+                                                                        0, 2048);
+        iInFile = inFileHandler;
+        iFrameHandler = CProcAMRFrameHandler::NewL();
+        TAudFileProperties properties;
+        inFileHandler->GetPropertiesL(&properties);
+        inFileHandler->SetPropertiesL(properties);
+        iFrameAmount = properties.iFrameCount;
+        inFileHandler->SeekAudioFrame(0);
+        }
+    else if (aClipInfo->Properties().iFileFormat == EAudFormatAMRWB) 
+        {
+        CProcInFileHandler* inFileHandler = CProcAWBInFileHandler::NewL(aClipInfo->FileName(), 
+                                                                        aClipInfo->FileHandle(), 
+                                                                        0, 2048);
+        iInFile = inFileHandler;
+        iFrameHandler = CProcAWBFrameHandler::NewL();
+        TAudFileProperties properties;
+        inFileHandler->GetPropertiesL(&properties);
+        inFileHandler->SetPropertiesL(properties);
+        iFrameAmount = properties.iFrameCount;
+        inFileHandler->SeekAudioFrame(0);
+        }
+    else if (aClipInfo->Properties().iFileFormat == EAudFormatMP3) 
+        {
+        CProcInFileHandler* inFileHandler = CProcMP3InFileHandler::NewL(aClipInfo->FileName(), 
+                                                                        aClipInfo->FileHandle(), 
+                                                                        0, 2048);
+        iInFile = inFileHandler;
+        iFrameHandler = CProcMP3FrameHandler::NewL();
+        TAudFileProperties properties;
+        inFileHandler->GetPropertiesL(&properties);
+        inFileHandler->SetPropertiesL(properties);
+        iFrameAmount = properties.iFrameCount;
+        inFileHandler->SeekAudioFrame(0);
+        }
+    else if (aClipInfo->Properties().iFileFormat == EAudFormatWAV) 
+        {
+        CProcInFileHandler* inFileHandler = CProcWAVInFileHandler::NewL(aClipInfo->FileName(), 
+                                                                        aClipInfo->FileHandle(), 
+                                                                        0, 8192);
+        iInFile = inFileHandler;
+        TAudFileProperties properties;
+        inFileHandler->GetPropertiesL(&properties);
+        inFileHandler->SetPropertiesL(properties);
+        iFrameAmount = properties.iFrameCount;
+        inFileHandler->SeekAudioFrame(0);
+        iFrameHandler = CProcWAVFrameHandler::NewL(properties.iNumberOfBitsPerSample);
+        }
+    
+
+    else if (aClipInfo->Properties().iFileFormat == EAudFormatMP4 &&                                                           
+            aClipInfo->Properties().iAudioType == EAudAAC_MPEG4)
+        {
+
+        CProcInFileHandler* inFileHandler = CProcMP4InFileHandler::NewL(aClipInfo->FileName(), 
+                                                                        aClipInfo->FileHandle(), 
+                                                                        0, 8192);
+
+        iInFile = inFileHandler;
+        TAudFileProperties properties;
+        
+        inFileHandler->GetPropertiesL(&properties);
+        
+        inFileHandler->SetPropertiesL(properties);
+        //inFileHandler->SetPropertiesL(properties);
+        iFrameAmount = properties.iFrameCount;
+        inFileHandler->SeekAudioFrame(0);
+
+        TAACFrameHandlerInfo frameInfo;
+        CProcMP4InFileHandler* MP4inFileHandler = static_cast<CProcMP4InFileHandler*>(inFileHandler);
+        MP4inFileHandler->GetInfoForFrameHandler(frameInfo);
+        
+        iFrameHandler = CProcAACFrameHandler::NewL(frameInfo);    
+
+        }
+    else if (aClipInfo->Properties().iFileFormat == EAudFormatMP4 &&
+            (aClipInfo->Properties().iAudioType == EAudAMR))
+        {
+
+        CProcInFileHandler* inFileHandler = CProcMP4InFileHandler::NewL(aClipInfo->FileName(), 
+                                                                        aClipInfo->FileHandle(), 
+                                                                        0, 8092);
+
+        iInFile = inFileHandler;
+        TAudFileProperties properties;
+        
+        inFileHandler->GetPropertiesL(&properties);
+        
+        inFileHandler->SetPropertiesL(properties);
+        //inFileHandler->SetPropertiesL(properties);
+        iFrameAmount = properties.iFrameCount;
+        inFileHandler->SeekAudioFrame(0);
+
+        iFrameHandler = CProcAMRFrameHandler::NewL();    
+
+        }
+    else if (aClipInfo->Properties().iFileFormat == EAudFormatMP4 &&
+            (aClipInfo->Properties().iAudioType == EAudAMRWB))
+        {
+
+        CProcInFileHandler* inFileHandler = CProcMP4InFileHandler::NewL(aClipInfo->FileName(), 
+                                                                        aClipInfo->FileHandle(), 
+                                                                        0, 8092);
+
+        iInFile = inFileHandler;
+        TAudFileProperties properties;
+        
+        inFileHandler->GetPropertiesL(&properties);
+        
+        inFileHandler->SetPropertiesL(properties);
+        //inFileHandler->SetPropertiesL(properties);
+        iFrameAmount = properties.iFrameCount;
+        inFileHandler->SeekAudioFrame(0);
+
+        iFrameHandler = CProcAWBFrameHandler::NewL();    
+
+        }
+    else if (aClipInfo->Properties().iFileFormat == EAudFormatAAC_ADTS &&
+            aClipInfo->Properties().iAudioType == EAudAAC_MPEG4
+            )
+        {
+
+        CProcInFileHandler* inFileHandler = CProcADTSInFileHandler::NewL(aClipInfo->FileName(), 
+                                                                         aClipInfo->FileHandle(), 
+                                                                        0, 8092);
+
+
+
+        iInFile = inFileHandler;
+        TAudFileProperties properties;
+        
+        inFileHandler->GetPropertiesL(&properties);
+        
+        inFileHandler->SetPropertiesL(properties);
+        iFrameAmount = properties.iFrameCount;
+        inFileHandler->SeekAudioFrame(0);
+
+        TAACFrameHandlerInfo frameInfo;
+        CProcADTSInFileHandler* ADTSinFileHandler = static_cast<CProcADTSInFileHandler*>(inFileHandler);
+        ADTSinFileHandler->GetInfoForFrameHandler(frameInfo);
+        
+        iFrameHandler = CProcAACFrameHandler::NewL(frameInfo);    
+
+        }
+
+
+    }
+
+TBool CProcVisProcessor::VisualizeClipPieceL(TInt &aProgress)
+    {
+
+    if (iInFile == 0)
+        return ETrue;
+    
+    if (iVisualizationPos >= iVisualizationSize) 
+    {
+        if (iInFile != 0)
+        {
+            delete iInFile;
+            iInFile = 0;
+        }
+        
+        if (iFrameHandler != 0)
+        {
+            delete iFrameHandler;
+            iFrameHandler = 0;
+        }
+        return ETrue;
+    }
+    
+    HBufC8* point = 0;
+    TInt siz;
+    TInt32 tim = 0;
+    
+    RArray<TInt> gains;
+    
+    TAudType audType = iClipInfo->Properties().iAudioType;
+    
+    
+    TInt maxGain = 0;
+    TInt gainAmount = 0;
+    TInt divider = 0;
+    for (TInt b = 0 ; b < 2 ; b++)
+    {
+        gains.Reset();
+        
+        
+        TBool decReq = iInFile->DecodingRequired();
+        iInFile->SetDecodingRequired(EFalse);
+        TBool tmp = EFalse;
+        
+        if (!iInFile->GetAudioFrameL(point, siz, tim, tmp)) 
+        {
+            iInFile->SetDecodingRequired(decReq);
+            
+            delete iInFile;
+            iInFile = 0;
+            delete iFrameHandler;
+            iFrameHandler = 0;
+            return ETrue;
+            
+        }
+        iInFile->SetDecodingRequired(decReq);
+        CleanupStack::PushL(point);
+        
+        iFramesProcessed++;
+        if (siz > 0) 
+        {
+            
+            
+            iFrameHandler->GetGainL(point, gains, maxGain);
+            
+            if (point != NULL) 
+            {
+                CleanupStack::PopAndDestroy(point);
+            }
+            
+            
+            if (audType == EAudAMR || audType == EAudAMRWB)
+            {
+                
+                for (TInt c = 0 ; c < gains.Count() ; c++)
+                {
+                    if (gains[c] > gainAmount)
+                    {
+                        gainAmount = gains[c];
+                    }
+                    
+                    //gainAmount+=gains[c];
+                }
+            }
+            else if (audType == EAudAAC_MPEG4)
+            {
+                for (TInt c = 0 ; c < gains.Count() ; c++)
+                {
+                    if (gains[c] > gainAmount)
+                    {
+                        gainAmount = gains[c];
+                    }
+                    
+                    //gainAmount+=gains[c];
+                }
+            }        
+            else if (audType == EAudMP3)
+            {
+                for (TInt c = 0 ; c < gains.Count() ; c++)
+                {
+                    
+                    gainAmount+=gains[c];
+                    divider++;
+                }
+                //gainAmount /= gains.Count();
+            }
+            else if (audType == EAudWAV)
+                {
+                for (TInt c = 0 ; c < gains.Count() ; c++)
+                    {
+                    
+                    gainAmount+=gains[c];
+                    divider++;
+                    }
+                //gainAmount /= gains.Count();
+                }
+            
+        }
+        
+        else 
+        {
+            CleanupStack::PopAndDestroy(point);
+            // silent frame
+            gains.Append(0);
+            gains.Append(0);
+            maxGain = 1;
+        }
+    }
+    
+    
+    if (audType == EAudMP3 && divider > 0) gainAmount/= divider;
+    if (audType == EAudWAV && divider > 0) gainAmount/= divider;
+    
+    
+    
+    iVisualizationProcessed = (iFramesProcessed*KAedMaxVisualizationResolution)/iFrameAmount;
+    
+    
+    while (iVisualizationWritten <= iVisualizationProcessed)
+    {
+        if (iVisualizationPos >= iVisualizationSize)
+        {
+            break;
+        }
+        
+        if (audType == EAudAAC_MPEG4)
+        {
+            
+            TReal ga(gainAmount-100);
+            TReal exponent= ga/36;
+            TReal visResult(0);
+            Math::Pow(visResult, 10, exponent);
+            
+            TInt16 visR = 0;
+            TInt err = Math::Int(visR, visResult);
+            
+            if (visR > 127) visR = 127;
+            
+            if (err == KErrNone)
+            {
+                iVisualization[iVisualizationPos] = static_cast<TInt8>(visR);
+            }
+            else
+            {
+                iVisualization[iVisualizationPos] = 0;
+                
+            }
+            
+        }
+        else 
+        {
+            TInt visValue = (127*gainAmount)/maxGain;
+            
+            if (visValue < 0)
+                {
+                visValue = 0;
+                }
+            else if (visValue > KMaxTInt8)
+                {
+                visValue = KMaxTInt8;
+                }
+        
+            iVisualization[iVisualizationPos] = static_cast<TInt8>(visValue);
+        }
+        iVisualizationPos++;
+        iVisualizationWritten = (KAedMaxVisualizationResolution*iVisualizationPos)/iVisualizationSize;
+    }
+    
+    
+    gains.Reset();
+    aProgress = iVisualizationWritten/(KAedMaxVisualizationResolution/100); // convert resolution to percentages
+    return EFalse;
+
+
+    }
+
+void CProcVisProcessor::GetFinalVisualizationL(TInt8*& aVisualization, TInt& aSize)
+    {
+
+    if (iVisualization == 0)
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    aVisualization = new (ELeave) TInt8[iVisualizationSize];
+    
+    for (TInt a = 0 ; a < iVisualizationSize ; a++)
+        {
+        aVisualization[a] = iVisualization[a];
+        }
+    aSize = iVisualizationSize;
+
+    delete[] iVisualization;
+    iVisualization = 0;
+
+    }
+
+
+void CProcVisProcessor::ConstructL()
+    {
+
+    }
+
+CProcVisProcessor::CProcVisProcessor()
+    {
+
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/ProcVisualizationAO.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "ProcVisualizationAO.h"
+#include "ProcVisProcessor.h"
+#include "AudPanic.h"
+
+
+void CProcVisualizationAO::RunL()
+    {
+    __ASSERT_DEBUG(iProcVisProcessor != 0, TAudPanic::Panic(TAudPanic::EInternal));
+    __ASSERT_DEBUG(iObserver != 0, TAudPanic::Panic(TAudPanic::EInternal));
+    
+    if(iVisualizationState == EProcVisualizationIdle) 
+        {
+        TAudPanic::Panic(TAudPanic::EInternal);
+        }
+    
+    else if (iVisualizationState == EProcGettingClipVisualization) 
+        {
+        
+        TBool completed = EFalse;
+        TInt progress = 0;
+        TRAPD(err, completed = iProcVisProcessor->VisualizeClipPieceL(progress));
+        
+        if (err != KErrNone)
+            {
+            delete iProcVisProcessor;
+            iProcVisProcessor = 0;
+            
+            MAudVisualizationObserver* observer = iObserver;
+            iObserver = 0;
+            iSize = 0;
+            iVisualizationState = EProcVisualizationIdle;
+            observer->NotifyClipInfoVisualizationCompleted(*iClipInfo, err, NULL, 0);
+            }
+        else if (completed)
+            {
+            TInt8* visualization = 0;
+            TInt size = 0;
+            TRAPD(err2, iProcVisProcessor->GetFinalVisualizationL(visualization, size));
+            
+            if (err2 != KErrNone)
+                {
+                MAudVisualizationObserver* observer = iObserver;
+                iObserver = 0;
+            
+                if (visualization != 0) delete[] visualization;
+                delete iProcVisProcessor;
+                iProcVisProcessor = 0;
+                iVisualizationState = EProcVisualizationIdle;
+                
+                observer->NotifyClipInfoVisualizationCompleted(*iClipInfo, err2, 0, 0);
+                return;
+                }
+            
+            delete iProcVisProcessor;
+            iProcVisProcessor = 0;
+            
+            MAudVisualizationObserver* observer = iObserver;
+            iObserver = 0;
+            iSize = 0;
+            iVisualizationState = EProcVisualizationIdle;
+
+            // NOTE: the upper level application is responsible for releasing "visualization"
+            observer->NotifyClipInfoVisualizationCompleted(*iClipInfo, KErrNone, visualization, size);
+            }
+        else
+            {
+
+            // progress is sent every 1 percent
+            if (iPreviousProgressValue < progress)
+                {
+                iObserver->NotifyClipInfoVisualizationProgressed(*iClipInfo, progress);
+                iPreviousProgressValue = progress;
+                }
+
+            SetActive();
+            TRequestStatus* status = &iStatus;
+            User::RequestComplete(status, KErrNone);
+            }
+        
+        }
+    }
+
+void CProcVisualizationAO::DoCancel() 
+    {
+
+    // ref to observer should be reset before callback to avoid recursion
+    MAudVisualizationObserver* observer = iObserver;
+    iObserver = 0;
+    // ref to clipInfo is good to reset before callback
+    const CAudClipInfo* clipInfo = iClipInfo;
+    iClipInfo = 0;
+    // processor not needed and should not exist any more; a new processor will be created for next visualization
+    delete iProcVisProcessor;
+    iProcVisProcessor = 0;
+    
+    if ((observer != 0) && (iVisualizationState == EProcGettingClipVisualization))
+        {
+        // reset state
+        iVisualizationState = EProcVisualizationIdle;
+
+        // note! this callback at least at the time of writing deletes this object => no operations should be done after this call
+        observer->NotifyClipInfoVisualizationCompleted(*clipInfo, KErrCancel, 0, 0);
+        }
+    }
+   
+CProcVisualizationAO* CProcVisualizationAO::NewL() 
+    {
+    CProcVisualizationAO* self = new (ELeave) CProcVisualizationAO();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CProcVisualizationAO::~CProcVisualizationAO()
+    {
+    // cancel the active object; it also deletes or resets member variables
+    Cancel();
+    }
+    
+
+void CProcVisualizationAO::ConstructL() 
+    {
+    // nothing to do; iProcVisProcessor will be created when started
+    }
+
+CProcVisualizationAO::CProcVisualizationAO() : 
+        CActive(0),
+        iVisualizationState(EProcVisualizationIdle) 
+        {
+
+    CActiveScheduler::Add(this);
+
+    }
+
+void CProcVisualizationAO::StartClipVisualizationL(const CAudClipInfo* aClipInfo, TInt aSize,
+                                                   MAudVisualizationObserver& aObserver, 
+                                                   TInt aPriority) 
+    {
+
+    if (iVisualizationState != EProcVisualizationIdle || iClipInfo != 0) 
+        {
+        TAudPanic::Panic(TAudPanic::EVisualizationProcessAlreadyRunning);
+        }
+
+    iSize = aSize;
+    iClipInfo = aClipInfo;
+    iProcVisProcessor = CProcVisProcessor::NewL();
+    
+    iPreviousProgressValue = 0;
+
+
+    TRAPD(err, iProcVisProcessor->VisualizeClipL(aClipInfo, aSize));
+
+    if (err != KErrNone)
+        {
+        delete iProcVisProcessor;
+        iProcVisProcessor = 0;
+        aObserver.NotifyClipInfoVisualizationCompleted(*aClipInfo, err, 0, 0);
+        User::Leave(err);
+        }
+
+    aObserver.NotifyClipInfoVisualizationStarted(*aClipInfo, KErrNone);
+
+    iObserver = &aObserver;
+
+    SetPriority(aPriority);
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+
+    iVisualizationState = EProcGettingClipVisualization;
+
+    }
+
+
+
+
+void CProcVisualizationAO::CancelVisualization() 
+    {
+    Cancel();
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/src/RateConverter.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,503 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "RateConverter.h"
+
+
+// CONSTANTS
+
+
+
+// MACROS
+
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+// -----------------------------------------------------------------------------
+// CRateConverter::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CRateConverter* CRateConverter::NewL(TInt aFromSampleRate, TInt aToSampleRate, TInt aFromChannels, TInt aToChannels)                          
+    {
+    CRateConverter* self = NewLC(aFromSampleRate, aToSampleRate, aFromChannels, aToChannels);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRateConverter::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CRateConverter* CRateConverter::NewLC(TInt aFromSampleRate, TInt aToSampleRate, TInt aFromChannels, TInt aToChannels)                             
+    {
+    CRateConverter* self = new (ELeave) CRateConverter(aFromSampleRate, aToSampleRate, aFromChannels, aToChannels);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRateConverter::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//    
+void CRateConverter::ConstructL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRateConverter::CRateConverter
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRateConverter::CRateConverter(TInt aFromSampleRate, TInt aToSampleRate, TInt aFromChannels, TInt aToChannels)
+ : iFromSampleRate(aFromSampleRate), iToSampleRate(aToSampleRate),
+   iFromChannels(aFromChannels), iToChannels(aToChannels)
+    {
+    // Select the smaller of the two
+    iChannels = (iFromChannels < iToChannels) ? iFromChannels : iToChannels;
+    }
+
+// ---------------------------------------------------------
+// CRateConverter::~CRateConverter
+// Destructor
+// ---------------------------------------------------------
+//
+CRateConverter::~CRateConverter()
+    {
+    if (iChild)
+        {
+        delete iChild;
+        iChild = NULL;
+        }
+    
+    if (iConverter)
+        {
+    	delete iConverter;
+    	iConverter = NULL;
+        }
+        
+    if (iInBuffer)
+        {
+        for (TInt i = 0; (i < iChannels) && iInBuffer[i]; i++)
+            {
+    		User::Free(iInBuffer[i]);
+    		iInBuffer[i] = NULL;
+            }
+    	User::Free(iInBuffer);
+    	iInBuffer = NULL;
+        }
+    
+    if (iOutBuffer)
+        {
+        for (TInt i = 0; (i < iChannels) && iOutBuffer[i]; i++)
+            {
+    		User::Free(iOutBuffer[i]);
+    		iOutBuffer[i] = NULL;
+            }
+    	User::Free(iOutBuffer);
+    	iOutBuffer = NULL;
+        }
+        
+    if (iScratchBuffer)
+        {
+        User::Free(iScratchBuffer);
+        iScratchBuffer = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CRateConverter::InitL
+// Initialize the rate converter
+// -----------------------------------------------------------------------------
+//  
+TBool CRateConverter::InitL(TInt aInputBufferSize)
+    {
+    PRINT((_L("CRateConverter::InitL() In")));
+    
+    if (iConverter)
+        {
+        PRINT((_L("CRateConverter::InitL() Already initialized")));
+        return EFalse;
+        }
+    
+    // Check that the input and output are either mono or stereo    
+    if ( ((iFromChannels != 1) && (iFromChannels != 2)) ||
+         ((iToChannels != 1) && (iToChannels != 2)) )
+        {
+        PRINT((_L("CRateConverter::InitL() Only mono and stereo are supported for input/output")));
+        return EFalse;
+        }
+        
+    if (iFromSampleRate == iToSampleRate)
+        {
+        // No sample rate conversion needed so do only channel conversion
+        iInputBlockSize = iOuputBlockSize = aInputBufferSize;
+        
+        PRINT((_L("CRateConverter::InitL() Out")));
+        return ETrue;
+        }
+        
+    if (!DoInitL(aInputBufferSize))
+        {
+        return EFalse;
+        }
+    
+    // Allocate internal input buffer
+    iInBuffer = (TInt16**) User::AllocL(iChannels * sizeof(TInt16*));
+    
+    for (TInt i = 0; i < iChannels; i++)
+        {
+        iInBuffer[i] = (TInt16*) User::AllocL(iInputBlockSize * sizeof(TInt16));
+        }
+        
+    PRINT((_L("CRateConverter::InitL() Out")));     
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CRateConverter::DoInitL
+// Does internal initialization
+// -----------------------------------------------------------------------------
+//    
+TBool CRateConverter::DoInitL(TInt aInputBufferSize)
+    {
+    iInputBlockSize = aInputBufferSize;
+    
+    // Supported direct conversions:
+    //
+    // 16000 ->  8000: /2
+    // 24000 ->  8000: /3
+    //
+    // 8000  -> 16000: *2
+    // 32000 -> 16000: /2
+    // 48000 -> 16000: /3
+    //
+    // 16000 -> 48000: *3
+    // 24000 -> 48000: *2
+    // 32000 -> 48000: *3/2
+    // 44100 -> 48000: *i
+    
+    // Try to use direct conversion
+    iConverter = RESAMPLER_RateConversionInputDrivenInt16::New(iFromSampleRate, iToSampleRate, iChannels);
+    
+    if (!iConverter)
+        {
+        // Direct conversion is not possible so multi phase conversion is needed
+
+        // Conversions are done in the following order:
+        // (*i means 160/147 conversion)
+        //
+        // 11025 ->  8000: *i *2 /3    (three phase)
+        // 22050 ->  8000: *i /3       (two phase)
+        // 32000 ->  8000: /2 /2       (two phase)
+        // 44100 ->  8000: *i /3 /2    (three phase)
+        // 48000 ->  8000: /3 /2       (two phase)
+        // 
+        // 11025 -> 16000: *2 *2 *i /3 (four phase)
+        // 22050 -> 16000: *2 *i /3    (three phase)
+        // 24000 -> 16000: *2 /3       (two phase)
+        // 44100 -> 16000: *i /3       (two phase)
+        // 
+        // 8000  -> 48000: *3 *2       (two phase)
+        // 11025 -> 48000: *2 *2 *i    (three phase)
+        // 22050 -> 48000: *2 *i       (two phase)
+        
+        // Check the last phase in the chain and make the decision where the child should convert
+        if( ((iToSampleRate == 8000) && ((iFromSampleRate == 11025) || (iFromSampleRate == 22050))) ||
+            (iToSampleRate == 16000) )
+            {
+            // Last phase is /3 so the child converter needs to do
+            // conversion from iFromSampleRate to iToSampleRate*3
+            
+            // Create the child converter
+            iChild = CRateConverter::NewL(iFromSampleRate, iToSampleRate * 3, iChannels, iChannels);
+            if (!iChild->DoInitL(aInputBufferSize))
+                {
+                return EFalse;
+                }
+            
+            // Update sample rates and buffer sizes
+            iFromSampleRate = iToSampleRate * 3;
+            aInputBufferSize = iChild->GetOutputBufferSize();
+        
+            // Try to create our converter  
+            iConverter = RESAMPLER_RateConversionInputDrivenInt16::New(iFromSampleRate, iToSampleRate, iChannels);
+            if (!iConverter)
+                {
+                return EFalse;
+                }
+            }
+        else if( (iToSampleRate == 8000) )
+            {
+            // Last phase is /2 so the child converter needs to do
+            // conversion from iFromSampleRate to iToSampleRate*2
+            
+            // Create the child converter
+            iChild = CRateConverter::NewL(iFromSampleRate, iToSampleRate * 2, iChannels, iChannels);
+            if (!iChild->DoInitL(aInputBufferSize))
+                {
+                return EFalse;
+                }
+            
+            // Update sample rates and buffer sizes
+            iFromSampleRate = iToSampleRate * 2;
+            aInputBufferSize = iChild->GetOutputBufferSize();
+            
+            // Try to create our converter  
+            iConverter = RESAMPLER_RateConversionInputDrivenInt16::New(iFromSampleRate, iToSampleRate, iChannels);
+            if (!iConverter)
+                {
+                return EFalse;
+                }
+            }
+        else if( ((iToSampleRate == 48000) && ((iFromSampleRate == 11025) || (iFromSampleRate == 22050))) )
+            {
+            // Last phase is *i so the child converter needs to do
+            // conversion from iFromSampleRate to 44100
+            
+            // Create the child converter
+            iChild = CRateConverter::NewL(iFromSampleRate, 44100, iChannels, iChannels);
+            if (!iChild->DoInitL(aInputBufferSize))
+                {
+                return EFalse;
+                }
+            
+            // Update sample rates and buffer sizes
+            iFromSampleRate = 44100;
+            aInputBufferSize = iChild->GetOutputBufferSize();
+            
+            // Try to create our converter  
+            iConverter = RESAMPLER_RateConversionInputDrivenInt16::New(iFromSampleRate, iToSampleRate, iChannels);
+            if (!iConverter)
+                {
+                return EFalse;
+                }
+            }
+        else if( ((iFromSampleRate == 11025) && ((iToSampleRate == 24000) || (iToSampleRate == 44100))) ||
+                 ((iFromSampleRate == 8000) && (iToSampleRate == 48000)) )
+            {
+            // Last phase is *2 so the child converter needs to do
+            // conversion from iFromSampleRate to iToSampleRate/2
+            
+            // Create the child converter
+            iChild = CRateConverter::NewL(iFromSampleRate, iToSampleRate / 2, iChannels, iChannels);
+            if (!iChild->DoInitL(aInputBufferSize))
+                {
+                return EFalse;
+                }
+                
+            // Update sample rates and buffer sizes
+            iFromSampleRate = iToSampleRate / 2;
+            aInputBufferSize = iChild->GetOutputBufferSize();
+            
+            // Try to create our converter  
+            iConverter = RESAMPLER_RateConversionInputDrivenInt16::New(iFromSampleRate, iToSampleRate, iChannels);
+            if (!iConverter)
+                {
+                return EFalse;
+                }
+            }
+        else
+            {
+            // We don't know how to convert, probably this is an unsupported conversion
+            PRINT((_L("CRateConverter::DoInitL() Can not convert from %d to %d"), iFromSampleRate, iToSampleRate));
+            return EFalse;
+            }
+        }
+        
+    if (!iConverter->InitInputDriven())
+        {
+        PRINT((_L("CRateConverter::InitL() Failed to initialize converter")));
+        return EFalse;
+        }
+    
+    // Set scratch memory buffer for converter    
+    size_t scratchBufferSize = iConverter->ScratchMemoryNeedInputDriven(aInputBufferSize);
+    
+    if (scratchBufferSize == 0)
+        {
+        PRINT((_L("CRateConverter::InitL() Scratch buffer size is too big")));
+        return EFalse;
+        }
+        
+    iScratchBuffer = (TInt8*) User::AllocL(scratchBufferSize);
+    iConverter->SetScratchBufferInputDriven((char *)iScratchBuffer);
+        
+    iOuputBlockSize = iConverter->MaxOutputSampleCount(aInputBufferSize);
+    
+    // Allocate internal output buffer
+    iOutBuffer = (TInt16**) User::AllocL(iChannels * sizeof(TInt16*));
+    
+    for (TInt i = 0; i < iChannels; i++)
+        {
+        iOutBuffer[i] = (TInt16*) User::AllocL(iOuputBlockSize * sizeof(TInt16));
+        }
+        
+    iConverter->SetQualityInputDriven(RESAMPLER_RATE_CONVERSION_QUALITY_STANDARD);
+    
+    PRINT((_L("CRateConverter::DoInitL() Convert %d -> %d Hz, %d -> %d channels"), iFromSampleRate, iToSampleRate, iFromChannels, iToChannels));
+    
+    PRINT((_L("CRateConverter::DoInitL() Input buffer %d, Output buffer %d"), iInputBlockSize, iOuputBlockSize));
+    
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CRateConverter::ConvertBufferL
+// Does rate and channel conversion for given buffer
+// -----------------------------------------------------------------------------
+//    
+TInt CRateConverter::ConvertBufferL(TInt16* aInput, TInt16* aOutput, TInt aInputSampleCount)
+    {
+    if (iFromSampleRate == iToSampleRate)
+        {
+        // No sample rate conversion needed
+        if (iFromChannels == iToChannels)
+            {
+            // No channel conversion needed either so copy input directly to output
+            Mem::Copy(aOutput, aInput, aInputSampleCount * 2 * iFromChannels);
+            }    
+        else if (iFromChannels == 2)
+            {
+            // Convert stereo to mono
+            for (TInt i = 0; i < aInputSampleCount; ++i)
+                {
+                // Average left and right samples
+                aOutput[i] = (aInput[2*i + 0] + aInput[2*i + 1]) >> 1;
+                }
+            }
+        else if (iToChannels == 2)
+            {
+            // Convert mono to stereo
+            for (TInt i = 0; i < aInputSampleCount; ++i)
+                {
+                // Duplicate left channel to right channel
+                aOutput[2*i + 0] = aInput[i];
+                aOutput[2*i + 1] = aInput[i];
+                }
+            }
+        
+        return aInputSampleCount;
+        }
+    
+    if (!iConverter)
+        {
+        PRINT((_L("CRateConverter::ConvertBufferL() Not initialized")));
+        User::Leave(KErrNotReady);
+        }
+    
+    if (aInputSampleCount > iInputBlockSize)
+        {
+        PRINT((_L("CRateConverter::ConvertBufferL() Too many input samples")));
+        User::Leave(KErrArgument);
+        }
+    
+    // Copy to input buffers and do channel conversion if needed    
+    if (iChannels == 2)
+        {
+        // Both channels are stereo so copy both channels to own buffers
+        for (TInt i = 0; i < aInputSampleCount; ++i)
+            {
+            iInBuffer[0][i] = aInput[2*i + 0];
+            iInBuffer[1][i] = aInput[2*i + 1];
+            }
+        }
+    else if (iFromChannels == 2)
+        {
+        // Source is stereo so convert stereo to mono
+        for (TInt i = 0; i < aInputSampleCount; ++i)
+            {
+            // Average left and right samples
+            iInBuffer[0][i] = (aInput[2*i + 0] + aInput[2*i + 1]) >> 1;
+            }
+        }
+    else
+        {
+        // Source is mono so copy it directly
+        Mem::Copy(iInBuffer[0], aInput, aInputSampleCount * 2);
+        }
+        
+    TInt outputSampleCount = DoConvertL(iInBuffer, aInputSampleCount);
+    
+    // Copy to output buffers and do channel conversion if needed    
+    if (iChannels == 2)
+        {
+        // Both channels are stereo so copy both channels to own buffers
+        for (TInt i = 0; i < outputSampleCount; ++i)
+            {
+            aOutput[2*i + 0] = iOutBuffer[0][i];
+            aOutput[2*i + 1] = iOutBuffer[1][i];
+            }
+        }
+    else if (iToChannels == 2)
+        {
+        // Ouput is stereo so convert mono to stereo
+        for (TInt i = 0; i < outputSampleCount; ++i)
+            {
+            // Duplicate left channel to right channel
+            aOutput[2*i + 0] = iOutBuffer[0][i];
+            aOutput[2*i + 1] = iOutBuffer[0][i];
+            }
+        }
+    else
+        {
+        // Output is mono so copy it directly
+        Mem::Copy(aOutput, iOutBuffer[0], outputSampleCount * 2);
+        }
+        
+    PRINT((_L("CRateConverter::ConvertBufferL() Output %d samples"), outputSampleCount));
+         
+    return outputSampleCount;
+    }
+
+// -----------------------------------------------------------------------------
+// CRateConverter::DoConvertL
+// Does the actual conversion
+// -----------------------------------------------------------------------------
+//     
+TInt CRateConverter::DoConvertL(TInt16** aInput, TInt aInputSampleCount)
+    {
+    if (iChild)
+        {
+        // If we have a child then we need to do a multi phase conversion
+        TInt tempSampleCount = iChild->DoConvertL(aInput, aInputSampleCount);
+        
+        // Get pointer to child's output and use it as an input
+        TInt16** tempBuf = iChild->GetOutputBuffer();
+        
+        return iConverter->ProcessFromInput(iOutBuffer, tempBuf, tempSampleCount);
+        }
+    else
+        {
+        // Otherwise process directly from input to output
+        return iConverter->ProcessFromInput(iOutBuffer, aInput, aInputSampleCount);
+        }
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/util/inc/Logfile.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,277 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __LOGFILE_H__
+#define __LOGFILE_H__
+
+#include <f32file.h>
+#include <charconv.h>
+
+class CCnvCharacterSetConverter;
+
+// Link with the following libraries: EFSRV.LIB HAL.LIB CHARCONV.LIB           
+
+/*! 
+  @class CLogFile
+  
+  @discussion Class to generate a text file containing logging information
+  */
+class CLogFile : public CBase
+    {
+public:
+/*!
+  @function NewL
+   
+  @discussion Create a CLogFile object
+  @param aFileName the name of the file to create
+  @param aInitialiseLog if true, and the log file already exists, previous
+  contents will be deleted. If false, append to any existing contents
+  @result a pointer to the created instance of CLogFile
+  */
+    static CLogFile* NewL(const TDesC& aFileName, TBool aInitialiseLog);
+
+/*!
+  @function NewLC
+   
+  @discussion Create a CLogFile object
+  @param aFileName the name of the file to create
+  @param aInitialiseLog if true, and the log file already exists, previous
+  contents will be deleted. If false, append to any existing contents
+  @result a pointer to the created instance of CLogFile
+  */
+    static CLogFile* NewLC(const TDesC& aFileName, TBool aInitialiseLog);
+
+/*!
+  @function ~CLogFile
+  
+  @discussion Destroy the object and release all memory objects
+  */
+    ~CLogFile();
+
+/*!
+  @function Log
+  
+  @discussion Append the byte to the log file (if not a printable char, it will be logged as ascii-hex)
+  @param aByte the byte to log
+  */
+    void Log(TUint8 aByte);
+
+/*!
+  @function Log
+  
+  @discussion Append the integer to the log file (logged as ascii-hex)
+  @param aNumber the integer to log
+  */
+    void Log(TUint aNumber);
+
+/*!
+  @function Log
+  
+  @discussion Append text to the log file
+  @param aText the text to log
+  */
+    void Log(const TDesC8& aText);
+
+/*!
+  @function Log
+  
+  @discussion Append text to the log file
+  @param aText the text to log
+  */
+    void Log(const TDesC& aText);
+
+/*!
+  @function LogTime
+  
+  @discussion Append a timestamp to the log file.
+  Timestamps are in seconds with three decimal places (but resolution is limited to system timer tick period)
+  */
+    void LogTime();
+
+/*!
+  @function LogBytes
+
+  @discussion Append the bytes to the log file (non-printable bytes will be logged as ascii-hex)
+  @param aBuffer the bytes to log
+  @param fastWrite writes data directly to file (no print out)
+  */
+    void LogBytes(const TDesC8& aBuffer, TBool fastWrite);
+
+/*!
+  @function LogNewline
+
+  @discussion Start a newline in the log file
+  */
+    void LogNewline();
+
+/*!
+  @function SetAutoFlush
+
+  @discussion Turn AutoFlush on or off. AutoFlush will automatically flush the log file after each write
+  @param aOn if true turns AutoFlush on
+  */
+    void SetAutoFlush(TBool aOn);
+
+/*!
+  @function SetAutoTimeStamp
+
+  @discussion Turn AutoTimeStamp on or off. AutoTimeStamp will add a timestamp to the start of each new line in the log
+  @param aOn if true turn AutoTimeStamp on
+  */
+    void SetAutoTimeStamp(TBool aOn);
+
+/*!
+  @function SetAutoNewline
+
+  @discussion Turn AutoNewline on or off. AutoNewline starts a new line after each log operation
+  @param aOn if true turn AutoNewline on
+  */
+    void SetAutoNewline(TBool aOn);
+
+/*!
+  @function StaticLogL
+
+  @discussion Static option to append text to the log file
+  @param aFileName the file to append to
+  @param aText the text to append
+  */
+    static void StaticLogL(const TDesC& aFileName, const TDesC8& aText);
+
+/*!
+  @function StaticLogL
+
+  @discussion Static option to append text to the log file
+  @param aFileName the file to append to
+  @param aText the text to append
+  */
+    static void StaticLogL(const TDesC& aFileName, const TDesC& aText);
+
+
+private:
+/*!
+  @function CLogFile
+  
+  @discussion Perform the first phase of two phase construction 
+  */
+    CLogFile();
+/*!
+  @function ConstructL
+  
+  @discussion  Perform the second phase construction of a CLogFile object
+  @param aFileName the file to open
+  @param aInitialiseLog if true, and the log file already exists, previous
+  contents will be deleted. If false, append to any existing contents
+  */
+    void ConstructL(const TDesC& aFileName, TBool aInitialiseLog);
+/*!
+  @function LogTimeInternal
+
+  @discussion Internal function to log time
+  */
+    void LogTimeInternal();
+/*!
+  @function LogTextInternal
+
+  @discussion Internal function to log text
+  @param aText the text to log
+  */
+    void LogTextInternal(const TDesC8& aText);
+/*!
+  @function LogByteInternal
+
+  @discussion internal function to log a byte
+  @param aByte the byte to log
+  */
+    void LogByteInternal(TUint8 aByte, TBool acsiiMode = EFalse);
+/*!
+  @function LogIntInternal
+
+  @discussion Internal function to log an integer
+  @param aNumber the integer to log
+  */
+    void LogIntInternal(TUint aNumber);
+/*!
+  @function StartWrite
+
+  @discussion Perform any initial operation before the main log operation
+  */
+    void StartWrite();
+
+/*!
+  @function EndWrite
+
+  @discussion Perform any tidying up operations after the main log operation
+  */
+    void EndWrite();
+
+/*!
+  @function Write
+
+  @discussion Do the actual writing, and associated error checking
+  @param aText the text to write
+  */
+    void Write(const TDesC8& aText);
+
+private:
+/*!
+  @var iLogFile handle to the log file
+  */
+    RFile       iLogFile;
+
+/*!
+  @var iSession file server session
+  */
+    RFs         iSession;
+
+/*!
+  @var iLogMillisecsPerTick number of millisecs per system timer tick
+  */
+    TInt        iLogMillisecsPerTick;
+
+/*!
+  @var iAutoFlush flag - AutoFlush on
+  */
+    TBool       iAutoFlush;
+
+/*!
+  @var iAutoTimestamp flag - AutoTimeStamp on
+  */
+    TBool       iAutoTimestamp;
+
+/*!
+  @var iAutoNewline flag - AutoNewline on
+  */
+    TBool       iAutoNewline;
+
+/*!
+  @var iCheckNestDepth internal to check StartWrite and EndWrite have been called correctly
+  */
+    TInt        iCheckNestDepth;
+/*!
+  @var iCharacterConverter converts between unicode and non-unicode characters
+  */
+    CCnvCharacterSetConverter* iCharacterConverter;
+
+/*!
+  @var iConverterAvailability flag indicating if conversion is able to occur
+  */
+    CCnvCharacterSetConverter::TAvailability iConverterAvailability;
+    };
+
+#endif // __LOGFILE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/util/inc/LogfilePanics.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __LOGFILEPANICS__
+#define __LOGFILEPANICS__
+
+_LIT(KLogFilePanic, "LogFile");
+
+enum TLogFilePanics 
+	{
+	TLogFileWriteFailed = 1
+	};
+
+#endif // __TESTFRAME_PAN__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/util/src/Logfile.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,363 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#include <hal.h>
+#include <charconv.h>
+#include "logfile.h"
+#include "logfilepanics.h"
+
+_LIT8(KCrLf8, "\r\n");
+_LIT(KCrLf, "\r\n");
+
+const TInt KAsciiStart = 0x20;
+const TInt KAsciiEnd = 0x7f;
+const TInt KHexCharLeft = '<';
+const TInt KHexCharRight = '>';
+
+const TInt KNumberOfDecimalPlaces = 3;
+
+CLogFile* CLogFile::NewL(const TDesC& aFileName, TBool aInitialiseLog)
+    {
+    CLogFile* self = NewLC(aFileName, aInitialiseLog);
+    CleanupStack::Pop();
+    return(self);
+    }
+
+
+CLogFile* CLogFile::NewLC(const TDesC& aFileName, TBool aInitialiseLog)
+    {
+    CLogFile* self = new (ELeave) CLogFile();
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileName, aInitialiseLog);
+    return(self);
+    }
+
+
+CLogFile::CLogFile()
+    {
+    // No implementation required
+    }
+
+
+CLogFile::~CLogFile()
+    {
+    iLogFile.Flush();
+    iLogFile.Close();
+    iSession.Close();
+
+    delete iCharacterConverter;
+    iCharacterConverter = NULL;
+    }
+
+
+void CLogFile::ConstructL(const TDesC& aFileName, TBool aInitialiseLog)
+    {
+    TInt period;
+    User::LeaveIfError(HAL::Get(HALData::ESystemTickPeriod, period));
+
+    iLogMillisecsPerTick = period / 1000;
+
+    if (iLogMillisecsPerTick == 0)
+        {
+        iLogMillisecsPerTick = 1;
+        }
+
+
+    User::LeaveIfError(iSession.Connect());
+
+    if (aInitialiseLog)
+        {
+        User::LeaveIfError(iLogFile.Replace(iSession, aFileName, EFileShareExclusive));
+        }
+    else
+        {
+        TInt err = iLogFile.Open(iSession, aFileName, EFileShareExclusive | EFileWrite);
+
+        switch (err)
+            {
+            case KErrNone: // Opened ok, so seek to end of file
+                {
+                TInt position = 0;
+                User::LeaveIfError(iLogFile.Seek(ESeekEnd, position));
+                }
+                break;
+
+            case KErrNotFound: // File doesn't exist, so create it
+                User::LeaveIfError(iLogFile.Create(iSession, aFileName, EFileShareExclusive | EFileWrite));
+                break;
+
+            default: // Unexepected error
+                User::Leave(err);
+                break;
+            }
+        }
+    
+    // Create character converter
+    iCharacterConverter = CCnvCharacterSetConverter::NewL();
+//    CCnvCharacterSetConverter::TAvailability iConverterAvailability;
+    iConverterAvailability = iCharacterConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierAscii, iSession);
+    }
+
+
+void CLogFile::LogTime()
+    {
+    StartWrite();
+    LogTimeInternal();
+    EndWrite();
+    }
+
+
+void CLogFile::Log(const TDesC8& aText)
+    {
+    StartWrite();
+    LogTextInternal(aText);
+    EndWrite();
+    }
+
+
+void CLogFile::Log(const TDesC& aText)
+    {
+    StartWrite();
+
+    for (TInt i = 0; i < aText.Length(); i++)
+        {
+        if (aText.Mid(i).Find(KCrLf) == 0)
+            {
+            LogNewline();
+            i++;
+            }
+        else if (iConverterAvailability == CCnvCharacterSetConverter::EAvailable)
+            {
+            // Convert character from unicode
+            TBuf<1> unicodeBuffer;
+            TBuf8<10> asciiBuffer;
+
+            unicodeBuffer.Append(aText[i]);
+            TInt status = iCharacterConverter->ConvertFromUnicode(asciiBuffer, unicodeBuffer);
+
+            if (status >= 0)
+                {
+                LogTextInternal(asciiBuffer);
+                }
+            }
+        else // character converter not available
+            {
+                TBuf8<1> asciiBuffer;
+                asciiBuffer.Append(static_cast<TUint8>(aText[i]));
+                LogTextInternal(asciiBuffer);
+            }
+        }
+
+    EndWrite();
+    }
+
+
+void CLogFile::Log(TUint8 aByte)
+    {
+    StartWrite();
+    LogByteInternal(aByte);
+    EndWrite();        
+    }
+
+
+void CLogFile::Log(TUint aNumber)
+    {
+    StartWrite();
+    LogIntInternal(aNumber);
+    EndWrite();        
+    }
+
+
+void CLogFile::LogBytes(const TDesC8& aBuffer, TBool fastWrite)
+    {
+    StartWrite();
+
+    if(fastWrite)
+      Write(aBuffer);
+    else
+    {
+      for (TInt i = 0; i < aBuffer.Length(); i++)
+      {
+        LogByteInternal(aBuffer[i], ETrue);
+      }
+    }
+
+    EndWrite();
+    }
+
+
+void CLogFile::LogTimeInternal()
+    {
+    TBuf8<50> text;
+    TInt timeInMillisecs = User::TickCount() * iLogMillisecsPerTick;
+    TInt secs = timeInMillisecs / 1000;
+    TInt millisecs = timeInMillisecs % 1000;
+    text.Num(secs);
+    text.Append('.');
+    Write(text);
+    text.Num(millisecs);
+
+    while (text.Length() < KNumberOfDecimalPlaces)
+        {
+        text.Insert(0, _L8("0"));
+        }
+
+    text.Append('-');
+    Write(text);
+    }
+
+
+void CLogFile::LogTextInternal(const TDesC8& aText)
+    {
+    TPtrC8 tail(aText.Ptr(), aText.Length());
+
+    TInt newLinePosition = tail.Find(KCrLf8);
+    while (newLinePosition != KErrNotFound)
+        {
+        if (newLinePosition > 0)
+            {
+            Write(tail.Left(newLinePosition));
+            tail.Set(aText.Ptr() + newLinePosition, tail.Length() - newLinePosition);
+            }
+        LogNewline();
+        tail.Set(aText.Ptr() + KCrLf8.iTypeLength, tail.Length() - KCrLf8.iTypeLength);
+
+        newLinePosition = tail.Find(KCrLf8);
+        }
+
+    //    No more newlines left so print remainder
+    Write(tail);
+
+    }
+
+
+void CLogFile::LogByteInternal(TUint8 aByte, TBool acsiiMode)
+    {
+    if ((aByte >= KAsciiStart) && (aByte < KAsciiEnd) || acsiiMode)
+        {
+        // Display as ASCII char
+        TBuf8<1> str;
+        str.Append(aByte);
+        Write(str);
+        }
+    else
+        {
+        // Display as hex number
+        TBuf8<4> str;
+        str.Append(KHexCharLeft);
+        str.AppendNum(static_cast<TUint>(aByte), EHex);
+        str.Append(KHexCharRight);
+        Write(str);
+        }
+    }
+
+
+void CLogFile::LogIntInternal(TUint aNumber)
+    {
+    // Display as ASCII char
+    TBuf8<20> str;
+    str.Append(KHexCharLeft);
+    str.AppendNum(aNumber/*, EHex*/);
+    str.Append(KHexCharRight);
+    Write(str);
+    }
+
+
+void CLogFile::LogNewline()
+    {
+    Write(KCrLf8);
+
+    if (iAutoTimestamp)
+        {
+        LogTimeInternal();
+        }
+    }
+
+
+void CLogFile::StartWrite()
+    {
+    ASSERT(iCheckNestDepth == 0);
+    iCheckNestDepth++;
+
+    if (iAutoNewline)
+        {
+        LogNewline();
+        }
+    }
+
+
+void CLogFile::EndWrite()
+    {
+    if (iAutoFlush)
+        {
+        iLogFile.Flush();
+        }
+
+    iCheckNestDepth--;
+    ASSERT(iCheckNestDepth == 0);
+    }
+
+void CLogFile::Write(const TDesC8& aText)
+    {
+
+    if (iLogFile.Write(aText) != KErrNone)
+        {
+        //  As the framework may be trapping User::Panic we need to
+        //  produce the panic at a lower level.
+        RThread().Panic(KLogFilePanic, TLogFileWriteFailed);
+        }
+    }
+
+void CLogFile::SetAutoFlush(TBool aOn)
+    {
+    iAutoFlush = aOn;
+    }
+
+
+void CLogFile::SetAutoTimeStamp(TBool aOn)
+    {
+    iAutoTimestamp = aOn;
+    }
+
+
+void CLogFile::SetAutoNewline(TBool aOn)
+    {
+    iAutoNewline = aOn;
+    }
+
+
+void CLogFile::StaticLogL(const TDesC& aFileName, const TDesC8& aText)
+    {
+    CLogFile* logFile = NewLC(aFileName, EFalse);
+    logFile->Log(aText);
+    CleanupStack::Pop(logFile);
+    delete logFile;
+    }
+
+
+void CLogFile::StaticLogL(const TDesC& aFileName, const TDesC& aText)
+    {
+    CLogFile* logFile = NewLC(aFileName, EFalse);
+    logFile->Log(aText);
+    CleanupStack::Pop(logFile);
+    delete logFile;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/bwins/vedavceditu.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@CVedAVCEdit@@SAPAV1@XZ @ 1 NONAME ; class CVedAVCEdit * CVedAVCEdit::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/eabi/vedavceditu.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	_ZN11CVedAVCEdit4NewLEv @ 1 NONAME
+	_ZTI11CVedAVCEdit @ 2 NONAME ; #<TI>#
+	_ZTV11CVedAVCEdit @ 3 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+vedavcedit.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/group/vedavcedit.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* The AVC editing DLL project definition file.
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+
+TARGET          vedavcedit.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10204C06   //KSharedLibraryUid
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+MACRO VIDEOEDITORENGINE_AVC_EDITING
+#define VIDEOEDITORENGINE_AVC_EDITING
+
+SOURCEPATH      ../src
+
+SOURCE          vedavcedit.cpp
+SOURCE          vedavceditimp.cpp
+SOURCE          sequence.cpp
+SOURCE          parameterset.cpp
+SOURCE          bitbuffer.cpp
+SOURCE          vld.cpp
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+SOURCE          slice.cpp
+SOURCE          macroblock.cpp
+SOURCE          dpb.cpp
+SOURCE          motcomp.cpp
+SOURCE          framebuffer.cpp
+SOURCE          invtransform.cpp
+#endif
+
+USERINCLUDE     ../inc 
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE	  /epoc32/include/libc
+
+// Symbian OS libraries
+LIBRARY 	      euser.lib 
+LIBRARY         estlib.lib
+
+//EXPORTUNFROZEN
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/avcdapi.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _AVCDECODER_H_
+#define _AVCDECODER_H_
+
+//#include <e32std.h>
+#include <e32def.h>
+
+
+#define AVCD_ERROR                       -1
+#define AVCD_OK                          0
+#define AVCD_OK_STREAM_NOT_DECODED       1
+#define AVCD_OK_FRAME_NOT_AVAILABLE      2
+
+#define AVCD_PICTURE_TYPE_P              0
+#define AVCD_PICTURE_TYPE_I              1
+
+#define AVCD_PROFILE_BASELINE            66
+#define AVCD_PROFILE_MAIN                77
+#define AVCD_PROFILE_EXTENDED            88
+#define AVCD_PROFILE_HIGH                100
+#define AVCD_PROFILE_HIGH_10             110
+#define AVCD_PROFILE_HIGH_422            122
+#define AVCD_PROFILE_HIGH_444            144
+
+
+typedef void avcdDecoder_t;
+
+avcdDecoder_t *avcdOpen();
+
+void avcdClose(avcdDecoder_t *dec);
+
+TInt avcdParseLevel(avcdDecoder_t *dec, void *nalUnitBits, TUint* nalUnitLen, TInt& aLevel);
+
+TInt avcdParseResolution(avcdDecoder_t *dec, void *nalUnitBits, TUint* nalUnitLen, 
+                         TInt& aWidth, TInt& aHeight);
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+
+TInt avcdParseParameterSet(avcdDecoder_t *dec, void *nalUnitBits, TUint* nalUnitLen);
+                    
+TInt avcdParseOneNal(avcdDecoder_t *dec, void *nalUnitBits, TUint* nalUnitLen);
+
+                    
+void FrameIsFromEncoder(avcdDecoder_t *dec, TUint aFromEncoder);
+
+
+
+TUint8* ReturnPPSSet(avcdDecoder_t *dec, TUint aIndex, TUint* aPPSLength);
+
+TUint ReturnNumPPS(avcdDecoder_t *dec);
+
+TUint8* ReturnSPSSet(avcdDecoder_t *dec, TUint aIndex, TUint* aSPSLength);
+
+TUint ReturnNumSPS(avcdDecoder_t *dec);
+
+TBool ReturnEncodeUntilIDR(avcdDecoder_t *dec);
+
+TInt avcdGenerateNotCodedFrame(avcdDecoder_t *dec, void *aNalUnitBits, TUint aNalUnitLen, TUint aFrameNumber);
+
+TInt avcdStoreCurrentPPSId(avcdDecoder_t *dec, TUint8 *nalUnitBits, TUint aNalUnitLen);
+
+void avcdModifyFrameNumber(avcdDecoder_t *dec, void *aNalUnitBits, TUint aNalUnitLen, TUint aFrameNumber);
+
+#endif // VIDEOEDITORENGINE_AVC_EDITING
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/biblin.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for Bit Buffer module.
+*
+*/
+
+
+#ifndef _BIBLIN_H_
+#define _BIBLIN_H_
+
+// @@ HARI AVC  Added the below 8 lines
+// make sure they are in the proper location etc... 
+#if defined(__SYMBIAN32__)
+#define __EPOC__
+//#include "epoclib.h"
+#else
+#include <assert.h>
+#include <string.h>
+//#include <stdlib.h>
+#endif
+
+#include "nrctyp32.h"
+
+/*
+ * Defines
+ */
+
+/* Error codes */
+/* Obsolete error codes are not used anymore and are defined only to maintain
+   backwards compatibility with older versions of the file. */
+#define ERR_BIB_STRUCT_ALLOC 1000      /* If a structure allocation failed */
+#define ERR_BIB_BUFFER_ALLOC 1001      /* Obsolete */
+#define ERR_BIB_FILE_READ 1002         /* Obsolete */
+#define ERR_BIB_NOT_ENOUGH_DATA 1003   /* If the number of bits requested from
+                                          the buffer is greater than the number
+                                          of bits available in the buffer */
+#define ERR_BIB_ALREADY_OPENED 1004    /* Obsolete */
+#define ERR_BIB_FILE_OPEN 1005         /* Obsolete */
+#define ERR_BIB_ALREADY_CLOSED 1006    /* Obsolete */
+#define ERR_BIB_FILE_CLOSE 1007        /* Obsolete */
+#define ERR_BIB_NUM_BITS 1008          /* Obsolete */
+#define ERR_BIB_FILE_NOT_OPEN 1009     /* Obsolete */
+#define ERR_BIB_ILLEGAL_SIZE 1010      /* Obsolete */
+#define ERR_BIB_CANNOT_REWIND 1011     /* If the number of bits requested to be
+                                          rewinded is greater than the number
+                                          of bits available in the buffer */
+#define ERR_BIB_BUFLIST 1012           /* If the internal buffer list has
+                                          been corrupted */
+#define ERR_BIB_TOO_SMALL_BUFFER 1013  /* Obsolete */
+#define ERR_BIB_FEC_RELOCK 1050        /* Obsolete */
+#define ERR_BIB_PSC_FOUND 1060         /* Obsolete */
+
+
+/*
+ * Structs and typedefs
+ */
+
+
+
+/* {{-output"bibBuffer_t_info.txt" -ignore"*" -noCR}}
+ * The bibBuffer_t data type is a structure containing all the necessary data
+ * for a bit buffer instance (except for the actual data buffer). This
+ * structure is passed to all of the bit buffer functions.
+ * {{-output"bibBuffer_t_info.txt"}}
+ */
+
+/* {{-output"bibBuffer_t.txt"}} */
+
+
+
+enum CopyMode {
+     CopyNone        = 0,
+     CopyWhole       = 1,
+     CopyWithEdit    = 2,
+     EditOnly        = 3
+};
+
+typedef struct bibEditParams_s {
+
+   int StartByteIndex;      // start byte position where data is to be written 
+   int StartBitIndex;       // start bit position where data is to be written 
+   int curNumBits;      // number of bits that need to be replaced 
+   int newNumBits;      // number of bits to be written 
+   int newValue;      // the value to be written 
+
+} bibEditParams_t; 
+
+typedef struct bibBufferEdit_s {
+
+    CopyMode copyMode; 
+    int numChanges; 
+    bibEditParams_t *editParams;
+
+} bibBufferEdit_t; 
+
+
+
+
+typedef struct bibBuffer_s {
+   u_char *baseAddr;       /* the start address of the buffer */
+
+   unsigned size;          /* the size of the buffer in bytes */
+
+   unsigned getIndex;      /* an index to the buffer where data was last got */
+
+   int bitIndex;           /* an index to the byte pointed by getIndex + 1 */
+
+   u_int32 bitsLeft;       /* the number of bits currently in the buffer */
+
+   u_int32 numBytesRead;   /* the total number of bytes read */
+
+   int error;               /* stores possible error code */
+
+} bibBuffer_t;
+/* {{-output"bibBuffer_t.txt"}} */
+
+#ifdef DEBUG_OUTPUT
+extern bibBuffer_t * buffer_global;
+#endif
+
+/* typedefs for bibFlushBits, bibGetBits, and bibShowBits function types */
+typedef void (*bibFlushBits_t) (int, bibBuffer_t *, int *, int *, int16 *);
+typedef u_int32 (*bibGetBits_t) (int, bibBuffer_t *, int *, int *, int16 *);
+typedef u_int32 (*bibShowBits_t) (int, bibBuffer_t *, int *, int *, int16 *);
+
+/*
+ * External macros
+ */
+
+/*
+    * bibNumberOfBitsLeft
+    *
+    * Parameters:
+    *    bibBuffer_t *buffer        input bit buffer instance
+    *
+    * Function:
+    *    This macro returns the number of bits which are left to be read
+    *    from the current position.
+    *
+    * Returns:
+    *    See above.
+    */
+
+   #define bibNumberOfBitsLeft(buffer) \
+      ((buffer)->bitsLeft)
+
+/*
+ * External function prototypes
+ */
+
+bibBuffer_t *bibCreate(void *srcBuffer, unsigned srcBufferLength,
+   int16 *errorCode);
+
+void bibDelete(bibBuffer_t *buffer, int16 *errorCode);
+
+u_int32 bibNumberOfFlushedBits(bibBuffer_t *buffer);
+
+u_int32 bibNumberOfFlushedBytes(bibBuffer_t *buffer);
+
+u_int32 bibNumberOfRewBits(bibBuffer_t *buffer);
+
+void bibRewindBits(u_int32 numberOfBits, bibBuffer_t *buffer, int16 *errorCode);
+
+int bibCheckPSCValidity( bibBuffer_t *buffer, int syncCodeLength );
+
+void bibAddMPEG4Header( bibBuffer_t *buffer, u_int8 *data, int length, int16 *errorCode );
+
+void bibMarkBufferWithPSC( bibBuffer_t *buffer, int16 *error );
+
+/* 
+ * Prototypes for bibFlushBits/bibGetBits/bibShowBits 
+ */
+
+void bibFlushBitsL(int numberOfBits, bibBuffer_t *buffer);
+u_int32 bibGetBitsL(int numberOfBits, bibBuffer_t *buffer);
+u_int32 bibShowBitsL(int numberOfBits, bibBuffer_t *buffer);
+
+inline void bibFlushBits(int numberOfBits, bibBuffer_t *buffer, int *numberOfBitsGot, int * /*bitErrorIndication*/, int16 * /*errorCode*/)
+{
+    *numberOfBitsGot = numberOfBits;
+    bibFlushBitsL(numberOfBits, buffer);
+}
+
+inline u_int32 bibGetBits(int numberOfBits, bibBuffer_t *buffer, int *numberOfBitsGot, int * /*bitErrorIndication*/, int16 * /*errorCode*/)
+{
+    *numberOfBitsGot = numberOfBits;
+    return bibGetBitsL(numberOfBits, buffer);
+}
+
+inline u_int32 bibShowBits(int numberOfBits, bibBuffer_t *buffer, int *numberOfBitsGot, int * /*bitErrorIndication*/, int16 * /*errorCode*/)
+{
+    *numberOfBitsGot = numberOfBits;
+    return bibShowBitsL(numberOfBits, buffer);
+}
+
+#define bibFlushBitsFromBuffer bibFlushBits
+#define bibGetBitsFromBuffer bibGetBits
+#define bibShowBitsFromBuffer bibShowBits
+
+
+bibBufferEdit_t *bibBufferEditCreate(int16 *errorCode);
+void bibBufEditDelete(bibBufferEdit_t *bufEdit, int16 *errorCode);
+
+// copy from input buffer to output buffer in various copy modes (with or without editing)
+void CopyStream(bibBuffer_t *SrcBuffer,bibBuffer_t *DestBuffer,bibBufferEdit_t *bufEdit, 
+								int ByteStart,int BitStart);
+// copy from input buffer to output buffer (without editing)
+void CopyBuffer(bibBuffer_t *SrcBuffer,bibBuffer_t *DestBuffer, 
+								int ByteStart,int BitStart, int ByteEnd, int BitEnd);
+// copy from BufferEdit to output buffer (no copying; rather, inserting code into output buffer)
+void CopyBufferEdit(bibBuffer_t *SrcBuffer, bibBuffer_t *DestBuffer, 
+										bibEditParams_t *edParam, int updateSrcBufferStats=1);
+// insert correct IntraDC values for H.263 chrominance blocks in output buffer
+void ResetH263IntraDcUV(bibBuffer_t *DestBuffer, int uValue, int vValue); 
+// insert correct IntraDC values for MPEG-4 chrominance blocks in output buffer
+void ResetMPEG4IntraDcUV(bibBuffer_t *DestBuffer, int IntraDC_size); 
+
+	/* 
+			SrcValue		the source value from which bits are to be extacted 
+			MaxNumBits	the length in bits of the source value
+			StartBit		the index of the starting bit form where data is to be retrieved
+			getBits			the number of bits to be retrieved 
+	*/
+u_int32 bibGetBitsFromWordL(u_int32 SrcValue, u_int32 getBits, u_int32 *StartBit, 
+												u_int32 MaxNumBits);
+void bibForwardBits(u_int32 numberOfBits, bibBuffer_t *buffer);
+void bibStuffBits(bibBuffer_t *buffer);
+void bibStuffBitsMPEG4(bibBuffer_t *inBuffer, bibBuffer_t *outBuffer, bibBufferEdit_t *bufEdit, 
+											 int *StartByteIndex, int *StartBitIndex, int updateSrcBufferStats);
+
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/bitbuffer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,355 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _BITBUFFER_H_
+#define _BITBUFFER_H_
+
+
+#include "globals.h"
+#include "nrctyp32.h"
+
+
+#define BIB_ERR_BIT_ERROR          -4
+#define BIB_INCORRECT_TRAILING_BIT -3
+#define BIB_ERR_NO_BITS            -2
+#define BIB_ERROR                  -1
+#define BIB_OK                      0
+
+
+typedef struct _bitbuffer_s 
+{
+  u_int8 *data;     /* point to the bit buffer. The physical buffer is allocated by the main module */
+  int dataLen;
+  int bytePos;
+  int bitpos;
+  int32 currentBits;
+  int errorStatus;
+} bitbuffer_s;
+
+
+#define bibRaiseError(bitbuf, error) ((bitbuf)->errorStatus = (error))
+
+#define bibGetStatus(bitbuf) (bitbuf)->errorStatus
+
+
+bitbuffer_s *bibOpen();
+
+int bibInit(bitbuffer_s *bitbuf, u_int8 *streamBytes, int length);
+
+int bibEnd(bitbuffer_s *bitbuf);
+
+void bibEndSlice(bitbuffer_s *bitbuf);
+
+void bibClose(bitbuffer_s *bitbuf);
+
+int bibGetBitFunc(bitbuffer_s *bitbuf);
+
+int32 bibGetBitsFunc(bitbuffer_s *bitbuf, int n);
+
+int32 bibShowBitsFunc(bitbuffer_s *bitbuf, int n);
+
+int bibSkipBitsFunc(bitbuffer_s *bitbuf, int n);
+
+int bibGetByte(bitbuffer_s *bitbuf, int *byteRet);
+
+int bibByteAlign(bitbuffer_s *bitbuf);
+
+int bibSkipTrailingBits(bitbuffer_s *bitbuf);
+
+int bibMoreRbspData(bitbuffer_s *bitbuf);
+
+int32 bibGetNumRemainingBits(bitbuffer_s *bitbuf);
+
+//int bibGetMax16bits(bitbuffer_s *bitbuf, TInt n, u_int32* retValue);
+void syncBitBufferBitpos(bitbuffer_s *bitbuf);
+
+
+/*
+ *
+ * bibGetBit
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      bit                   Return pointer for bit
+ *
+ * Function:
+ *      Get next bit from bitbuffer.
+ *
+ * Returns:
+ *      -
+ *
+ */
+#define bibGetBit(bitbuf, bit) \
+  if ((bitbuf)->bitpos <= 0) { \
+    if ((bitbuf)->bytePos < (bitbuf)->dataLen) { \
+      (bitbuf)->currentBits = (bitbuf)->data[(bitbuf)->bytePos++]; \
+      (bitbuf)->bitpos = 7; \
+      *(bit) = ((bitbuf)->currentBits >> (bitbuf)->bitpos) & 1; \
+    } \
+    else { \
+      (bitbuf)->errorStatus = BIB_ERR_NO_BITS; \
+      *(bit) = 0; \
+    } \
+  } \
+  else { \
+    (bitbuf)->bitpos--; \
+    *(bit) = ((bitbuf)->currentBits >> (bitbuf)->bitpos) & 1; \
+  }
+
+
+/*
+ *
+ * bibGetBits
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      n                     Number of bits requested
+ *      bits                  Return pointer for bits
+ *
+ * Function:
+ *      Get next n bits from bitbuffer. If bitbuffer is low on bits,
+ *      call bibGetBitsFunc to get more.
+ *
+ *      NOTE: maximum of 24 bits can be fetched
+ *
+ * Returns:
+ *      -
+ *
+ */
+#define bibGetBits(bitbuf, n, bits) \
+  if ((n) > (bitbuf)->bitpos) { \
+    if ((bitbuf)->bytePos+2 >= (bitbuf)->dataLen) \
+      *(bits) = bibGetBitsFunc(bitbuf, n); \
+    else { \
+      do { \
+        (bitbuf)->currentBits = ((bitbuf)->currentBits << 8) | (bitbuf)->data[(bitbuf)->bytePos++]; \
+        (bitbuf)->bitpos += 8; \
+      } while ((n) > (bitbuf)->bitpos); \
+      (bitbuf)->bitpos -= (n); \
+      *(bits) = ((bitbuf)->currentBits >> (bitbuf)->bitpos) & ~(((u_int32)-1)<<(n)); \
+    } \
+  } \
+  else { \
+    (bitbuf)->bitpos -= (n); \
+    *(bits) = ((bitbuf)->currentBits >> (bitbuf)->bitpos) & ~(((u_int32)-1)<<(n)); \
+  }
+
+
+/*
+ *
+ * bibGetMax16bits
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      n                     Number of bits requested
+ *      bits                  Return pointer for bits
+ *
+ * Function:
+ *      Get next n bits from bitbuffer. If bitbuffer is low on bits,
+ *      call bibGetBitsFunc to get more.
+ *
+ *      NOTE: maximum of 16 bits can be fetched
+ *
+ * Returns:
+ *      -
+ *
+ */
+#define bibGetMax16bits(bitbuf, n, bits) \
+  if ((n) > (bitbuf)->bitpos) { \
+    if ((bitbuf)->bytePos+1 >= (bitbuf)->dataLen) \
+      *(bits) = bibGetBitsFunc(bitbuf, n); \
+    else { \
+      (bitbuf)->currentBits = ((bitbuf)->currentBits << 8) | (bitbuf)->data[(bitbuf)->bytePos++]; \
+      (bitbuf)->currentBits = ((bitbuf)->currentBits << 8) | (bitbuf)->data[(bitbuf)->bytePos++]; \
+      (bitbuf)->bitpos += 16; \
+      (bitbuf)->bitpos -= (n); \
+      *(bits) = ((bitbuf)->currentBits >> (bitbuf)->bitpos) & ~(((u_int32)-1)<<(n)); \
+    } \
+  } \
+  else { \
+    (bitbuf)->bitpos -= (n); \
+    *(bits) = ((bitbuf)->currentBits >> (bitbuf)->bitpos) & ~(((u_int32)-1)<<(n)); \
+  }
+
+
+/*
+ *
+ * bibGetMax8bits
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      n                     Number of bits requested
+ *      bits                  Return pointer for bits
+ *
+ * Function:
+ *      Get next n bits from bitbuffer. If bitbuffer is low on bits,
+ *      call bibGetBitsFunc to get more.
+ *
+ *      NOTE: maximum of 8 bits can be fetched
+ *
+ * Returns:
+ *      -
+ *
+ */
+#define bibGetMax8bits(bitbuf, n, bits) \
+  if ((n) > (bitbuf)->bitpos) { \
+    if ((bitbuf)->bytePos >= (bitbuf)->dataLen) \
+      *(bits) = bibGetBitsFunc(bitbuf, n); \
+    else { \
+      (bitbuf)->currentBits = ((bitbuf)->currentBits << 8) | (bitbuf)->data[(bitbuf)->bytePos++]; \
+      (bitbuf)->bitpos += 8; \
+      (bitbuf)->bitpos -= (n); \
+      *(bits) = ((bitbuf)->currentBits >> (bitbuf)->bitpos) & ~(((u_int32)-1)<<(n)); \
+    } \
+  } \
+  else { \
+    (bitbuf)->bitpos -= (n); \
+    *(bits) = ((bitbuf)->currentBits >> (bitbuf)->bitpos) & ~(((u_int32)-1)<<(n)); \
+  }
+
+
+/*
+ *
+ * bibShowBits
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      n                     Number of bits requested
+ *      bits                  Return pointer for bits
+ *
+ * Function:
+ *      Get next n bits from bitbuffer without advancing bitbuffer pointer.
+ *      If bitbuffer is low on bits, call bibShowBitsFunc to get more.
+ *
+ *      NOTE: maximum of 24 bits can be fetched
+ *
+ * Returns:
+ *      -
+ *
+ */
+#define bibShowBits(bitbuf, n, bits) \
+  if ((n) > (bitbuf)->bitpos) { \
+    if ((bitbuf)->bytePos+2 >= (bitbuf)->dataLen) \
+      *(bits) = bibShowBitsFunc(bitbuf, n); \
+    else { \
+      do { \
+        (bitbuf)->currentBits = ((bitbuf)->currentBits << 8) | (bitbuf)->data[(bitbuf)->bytePos++]; \
+        (bitbuf)->bitpos += 8; \
+      } while ((n) > (bitbuf)->bitpos); \
+      *(bits) = ((bitbuf)->currentBits >> ((bitbuf)->bitpos-(n))) & ~(((u_int32)-1)<<(n)); \
+    } \
+  } \
+  else \
+    *(bits) = ((bitbuf)->currentBits >> ((bitbuf)->bitpos-(n))) & ~(((u_int32)-1)<<(n));
+
+
+/*
+ *
+ * bibShowMax16bits
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      n                     Number of bits requested
+ *      bits                  Return pointer for bits
+ *
+ * Function:
+ *      Get next n bits from bitbuffer without advancing bitbuffer pointer.
+ *      If bitbuffer is low on bits, call bibShowBitsFunc to get more.
+ *
+ *      NOTE: maximum of 16 bits can be fetched
+ *
+ * Returns:
+ *      -
+ *
+ */
+#define bibShowMax16bits(bitbuf, n, bits) \
+  if ((n) > (bitbuf)->bitpos) { \
+    if ((bitbuf)->bytePos+1 >= (bitbuf)->dataLen) \
+      *(bits) = bibShowBitsFunc(bitbuf, n); \
+    else { \
+      (bitbuf)->currentBits = ((bitbuf)->currentBits << 8) | (bitbuf)->data[(bitbuf)->bytePos++]; \
+      (bitbuf)->currentBits = ((bitbuf)->currentBits << 8) | (bitbuf)->data[(bitbuf)->bytePos++]; \
+      (bitbuf)->bitpos += 16; \
+      *(bits) = ((bitbuf)->currentBits >> ((bitbuf)->bitpos-(n))) & ~(((u_int32)-1)<<(n)); \
+    } \
+  } \
+  else \
+    *(bits) = ((bitbuf)->currentBits >> ((bitbuf)->bitpos-(n))) & ~(((u_int32)-1)<<(n));
+
+
+/*
+ *
+ * bibShowMax8bits
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      n                     Number of bits requested
+ *      bits                  Return pointer for bits
+ *
+ * Function:
+ *      Get next n bits from bitbuffer without advancing bitbuffer pointer.
+ *      If bitbuffer is low on bits, call bibShowBitsFunc to get more.
+ *
+ *      NOTE: maximum of 8 bits can be fetched
+ *
+ * Returns:
+ *      -
+ *
+ */
+#define bibShowMax8bits(bitbuf, n, bits) \
+  if ((n) > (bitbuf)->bitpos) { \
+    if ((bitbuf)->bytePos >= (bitbuf)->dataLen) \
+      *(bits) = bibShowBitsFunc(bitbuf, n); \
+    else { \
+      (bitbuf)->currentBits = ((bitbuf)->currentBits << 8) | (bitbuf)->data[(bitbuf)->bytePos++]; \
+      (bitbuf)->bitpos += 8; \
+      *(bits) = ((bitbuf)->currentBits >> ((bitbuf)->bitpos-(n))) & ~(((u_int32)-1)<<(n)); \
+    } \
+  } \
+  else \
+    *(bits) = ((bitbuf)->currentBits >> ((bitbuf)->bitpos-(n))) & ~(((u_int32)-1)<<(n));
+
+
+/*
+ *
+ * bibSkipBits
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      n                     Number of bits to be skipped
+ *
+ * Function:
+ *      Called after calling bibShowBits to skip the number of bits that
+ *      were actually needed. If bibShowBits fetched more bits than there were
+ *      bits in bitbuf->currentBits, calls bibSkipBitsFunc to clean up.
+ *
+ * Returns:
+ *      -
+ *
+ */
+#define bibSkipBits(bitbuf, n) \
+  (bitbuf)->bitpos -= (n); \
+  if ((bitbuf)->bitpos < 0) { \
+    (bitbuf)->bitpos += (n); \
+    bibSkipBitsFunc(bitbuf, n); \
+  }
+
+
+
+#endif  /* #ifndef _BITBUFFER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/clipbuf.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _CLIPBUF_H_
+#define _CLIPBUF_H_
+
+
+/*
+ * This table is used to clip values -256 ... 511 to the range of [0, 255]
+ */
+#ifndef AVC_MOTION_COMP_ASM
+static const u_int8 clip8Buf[768] = 
+{
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+    0,  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,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
+  224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
+  240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+};
+#else
+static const u_int8 clip8Buf[1536] = {
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+
+    0,   1,   1,   2,   2,   3,   3,   4,   4,   5,   5,   6,   6,   7,   7,   8,
+    8,   9,   9,  10,  10,  11,  11,  12,  12,  13,  13,  14,  14,  15,  15,  16,
+   16,  17,  17,  18,  18,  19,  19,  20,  20,  21,  21,  22,  22,  23,  23,  24,
+   24,  25,  25,  26,  26,  27,  27,  28,  28,  29,  29,  30,  30,  31,  31,  32,
+   32,  33,  33,  34,  34,  35,  35,  36,  36,  37,  37,  38,  38,  39,  39,  40,
+   40,  41,  41,  42,  42,  43,  43,  44,  44,  45,  45,  46,  46,  47,  47,  48,
+   48,  49,  49,  50,  50,  51,  51,  52,  52,  53,  53,  54,  54,  55,  55,  56,
+   56,  57,  57,  58,  58,  59,  59,  60,  60,  61,  61,  62,  62,  63,  63,  64,
+   64,  65,  65,  66,  66,  67,  67,  68,  68,  69,  69,  70,  70,  71,  71,  72,
+   72,  73,  73,  74,  74,  75,  75,  76,  76,  77,  77,  78,  78,  79,  79,  80,
+   80,  81,  81,  82,  82,  83,  83,  84,  84,  85,  85,  86,  86,  87,  87,  88,
+   88,  89,  89,  90,  90,  91,  91,  92,  92,  93,  93,  94,  94,  95,  95,  96,
+   96,  97,  97,  98,  98,  99,  99, 100, 100, 101, 101, 102, 102, 103, 103, 104,
+  104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112,
+  112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120,
+  120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127, 128,
+  128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135, 136,
+  136, 137, 137, 138, 138, 139, 139, 140, 140, 141, 141, 142, 142, 143, 143, 144,
+  144, 145, 145, 146, 146, 147, 147, 148, 148, 149, 149, 150, 150, 151, 151, 152,
+  152, 153, 153, 154, 154, 155, 155, 156, 156, 157, 157, 158, 158, 159, 159, 160,
+  160, 161, 161, 162, 162, 163, 163, 164, 164, 165, 165, 166, 166, 167, 167, 168,
+  168, 169, 169, 170, 170, 171, 171, 172, 172, 173, 173, 174, 174, 175, 175, 176,
+  176, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, 184,
+  184, 185, 185, 186, 186, 187, 187, 188, 188, 189, 189, 190, 190, 191, 191, 192,
+  192, 193, 193, 194, 194, 195, 195, 196, 196, 197, 197, 198, 198, 199, 199, 200,
+  200, 201, 201, 202, 202, 203, 203, 204, 204, 205, 205, 206, 206, 207, 207, 208,
+  208, 209, 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215, 215, 216,
+  216, 217, 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, 222, 223, 223, 224,
+  224, 225, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232,
+  232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 240,
+  240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 248,
+  248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255, 255,
+
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
+};
+
+#endif
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/dpb.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _DPB_H_
+#define _DPB_H_
+
+
+#include "globals.h"
+#include "nrctyp32.h"
+#include "framebuffer.h"
+
+
+#define DPB_ERR_MEM_ALLOC          -3
+#define DPB_ERR_PICTURE_NOT_FOUND  -2
+#define DPB_ERROR                  -1
+#define DPB_OK                      0
+
+
+#define DPB_MAX_SIZE  16
+
+
+typedef struct _dpb_s {
+  int size;
+  frmBuf_s *buffers[DPB_MAX_SIZE];
+
+  int fullness;
+  int maxNumRefFrames;
+  int numShortTermPics;
+  int numLongTermPics;
+
+  int maxLongTermFrameIdx;
+
+} dpb_s;
+
+
+
+dpb_s *dpbOpen();
+
+void dpbClose(dpb_s *dpb);
+
+void dpbSetSize(dpb_s *dpb, int dpbSize);
+
+frmBuf_s *dpbGetNextOutputPic(dpb_s *dpb, int *dpbHasIDRorMMCO5);
+
+int dpbStorePicture(dpb_s *dpb, frmBuf_s *currPic, frmBuf_s *outputQueue[]);
+
+void dpbUpdatePicNums(dpb_s *dpb, int32 frameNum, int32 maxFrameNum);
+
+void dpbMarkAllPicsAsNonRef(dpb_s *dpb);
+
+void dpbMarkLowestShortTermPicAsNonRef(dpb_s *dpb);
+
+int dpbMarkShortTermPicAsNonRef(dpb_s *dpb, int32 picNum);
+
+int dpbMarkLongTermPicAsNonRef(dpb_s *dpb, int longTermPicNum);
+
+void dpbVerifyLongTermFrmIdx(dpb_s *dpb, int longTermFrmIdx);
+
+int dpbMarkShortTermPicAsLongTerm(dpb_s *dpb, int32 picNum, int longTermFrmIdx);
+
+void dpbSetMaxLongTermFrameIdx(dpb_s *dpb, int maxLongTermFrmIdxPlus1);
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/framebuffer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _FRAMEBUFFER_H_
+#define _FRAMEBUFFER_H_
+
+
+#include "nrctyp32.h"
+#include "globals.h"
+#include "avcdapi.h"
+
+
+#define FRM_NON_REF_PIC     0
+#define FRM_SHORT_TERM_PIC  1
+#define FRM_LONG_TERM_PIC   2
+
+
+typedef struct _frmBuf_s {
+  int constraintSet0flag;
+  int constraintSet1flag;
+  int constraintSet2flag;
+  int profile;
+  int level;
+  int width;
+  int height;
+  unsigned cropLeftOff;
+  unsigned cropRightOff;
+  unsigned cropTopOff;
+  unsigned cropBottomOff;
+
+  int aspectRatioNum;
+  int aspectRatioDenom;
+  int overscanInfo;
+  int videoFormat;
+  int videoFullRangeFlag;
+  int matrixCoefficients;
+  int chromaSampleLocType;
+  int numReorderFrames;
+  float frameRate;
+
+  int imgPadding;
+
+  int qp;
+  int chromaQpIndexOffset;
+
+  int32 frameNum;
+  int32 maxFrameNum;
+  int32 picNum;
+  int longTermFrmIdx;
+  int longTermPicNum;
+  int refType;        /* non-ref, short term or long term */
+  int forOutput;      /* If this frame is waiting for output */
+  int nonExisting;    
+  int32 poc;
+  int isIDR;
+  int idrPicID;
+  int hasMMCO5;
+  int picType;
+
+  int pictureStructure;
+
+  int lossy;
+/*#if defined(ERROR_CONCEALMENT) && defined(BACKCHANNEL_INFO)
+  unsigned char *mbLossMap;
+#endif*/
+
+  int sceneCut;
+
+} frmBuf_s;
+
+
+typedef struct _mbAttributes_s {
+  int *sliceMap;
+  int8 *mbTypeTable;
+  int8 *qpTable;
+  int8 *refIdxTable;
+  int *cbpTable;
+  int8 *ipModesUpPred;
+  motVec_s *motVecTable;
+  int8 *numCoefUpPred[3];
+  int8 *filterModeTab;
+  int8 *alphaOffset;
+  int8 *betaOffset;
+} mbAttributes_s;
+
+
+frmBuf_s *frmOpen(mbAttributes_s **mbData, int width, int height);
+
+frmBuf_s *frmOpenRef(int width, int height);
+
+void frmClose(frmBuf_s *recoBuf, mbAttributes_s *mbData);
+
+void frmCloseRef(frmBuf_s *ref);
+
+frmBuf_s *frmMakeRefFrame(frmBuf_s *recoBuf, frmBuf_s *refBuf);
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/globals.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _GLOBALS_H_
+#define _GLOBALS_H_
+
+#include <s32file.h>
+#include "nrctyp32.h"
+//#include "rdtsc.h"
+
+
+/*
+ * General defines
+ */
+
+#ifdef __TMS320C55X__
+/* If this is defined, int is 16 bits */
+#define INT_IS_16_BITS
+#endif
+
+// Define the debug printing
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+/* If this is defined as 1, input bitstream is encapsulated in NAL packets */
+/* and contians start code emulation prevention bytes                      */
+#define ENCAPSULATED_NAL_PAYLOAD 1
+
+/* Minimum and maximum QP value */
+#define MIN_QP 0
+#define MAX_QP 51
+
+/* If this is defined, pixel clipping will use loop-up table */
+#ifndef __TMS320C55X__
+#define USE_CLIPBUF
+#endif
+
+#ifndef min
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
+#ifndef max
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
+/* This macro clips value val to the range of [min, max] */
+#define  clip(min, max, val) (((val)<(min))? (min):(((val)>(max))? (max):(val)))
+
+
+/*
+ * Defines for assembly functions
+ */
+
+#ifdef AVC_ARM_ASSEMBLY
+#define AVC_RECO_BLOCK_ASM
+#define AVC_LOOP_FILTER_ASM
+#define AVC_MOTION_COMP_ASM
+#endif
+
+#ifdef __TMS320C55X__
+#define AVC_RECO_BLOCK_ASM
+#endif
+
+
+/*
+ * Defines for error concealment
+ */
+
+/*#ifndef ERROR_CONCEALMENT
+#define ERROR_CONCEALMENT
+#endif*/
+
+#ifndef BACKCHANNEL_INFO
+#define BACKCHANNEL_INFO
+#endif
+
+/*
+ * Defines for slice
+ */
+
+/* All possible slice types */
+#define SLICE_MIN 0
+#define SLICE_P   0 // P (P slice)
+#define SLICE_B   1 // B (B slice)
+#define SLICE_I   2 // I (I slice)
+#define SLICE_SP  3 // SP (SP slice)
+#define SLICE_SI  4 // SI (SI slice)
+#define SLICE_P1  5	// P (P slice)
+#define SLICE_B1  6	// B (B slice)
+#define SLICE_I1  7	// I (I slice)
+#define SLICE_SP1 8	// SP (SP slice)
+#define SLICE_SI1 9	// SI (SI slice)
+#define SLICE_MAX 9
+
+/* Macros for testing whether slice is I slice, P slice or B slice */
+#define IS_SLICE_I(x) ((x) == SLICE_I || (x) == SLICE_I1 || (x) == SLICE_SI || (x) == SLICE_SI1)
+#define IS_SLICE_P(x) ((x) == SLICE_P || (x) == SLICE_P1 || (x) == SLICE_SP || (x) == SLICE_SP1)
+#define IS_SLICE_B(x) ((x) == SLICE_B || (x) == SLICE_B1)
+
+
+/*
+ * Defines for macroblock
+ */
+
+#define MBK_SIZE        16
+#define BLK_SIZE        4
+#define BLK_PER_MB      (MBK_SIZE/BLK_SIZE)
+#define MBK_SIZE_LOG2   4
+#define BLK_SIZE_LOG2   2
+
+/* Macroblock type */
+#define MBK_INTRA  0
+#define MBK_INTER  1
+
+/* Intra macroblock sub-type */
+#define MBK_INTRA_TYPE1     0
+#define MBK_INTRA_TYPE2     1
+#define MBK_INTRA_TYPE_PCM  2
+
+
+/*
+ * Defines for entropy coder
+ */
+
+/* These 2 macros are needed even if ENABLE_CABAC is not defined */
+#define ENTROPY_CAVLC       0
+#define ENTROPY_CABAC       1
+
+
+
+/*
+ * Global structures
+ */
+
+typedef struct _motVec_s {
+  int16 x;
+  int16 y;
+} motVec_s;
+
+
+/* Chrominance QP mapping table. Has to be static on Symbian. */
+/* Chroma QP = qpChroma[Luma QP]                              */
+#ifndef __SYMBIAN32__
+extern const u_int8 qpChroma[52];
+#else
+static const u_int8 qpChroma[52] = {
+    0, 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,29,30,31,32,32,33,34,34,35,35,36,36,37,37,
+   37,38,38,38,39,39,39,39
+}; 
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/invtransform.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _INVTRANSFORM_H_
+#define _INVTRANSFORM_H_
+
+
+#define ITR_DEQUANT_BITS   6
+#define ITR_DEQUANT_ROUND  (1<<(ITR_DEQUANT_BITS-1))
+
+
+void itrIDCTdequant4x4(int src[4][4], int dest[4][4], const int *dequantPtr,
+                       int qp_per, int isDc, int dcValue);
+
+void itrIHadaDequant4x4(int src[4][4], int dest[4][4], int deqc);
+
+void itrIDCTdequant2x2(int src[2][2], int dest[2][2], int deqc);
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/macroblock.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _MACROBLOCK_H_
+#define _MACROBLOCK_H_
+
+
+#include "globals.h"
+#include "framebuffer.h"
+#include "bitbuffer.h"
+
+
+#define MBK_ERROR  -1
+#define MBK_OK      0
+#define MBK_PCM_FOUND  2
+
+
+typedef struct _macroblock_s
+{
+  int type;
+  int numSkipped;
+
+  int intraType;
+  int intraMode;
+  int intraModeChroma;
+
+  int interMode;
+  int inter8x8modes[4];
+  int refNum[4];
+  int numMotVecs;
+
+  int qp, qpC;
+  int idxX, idxY;
+  int blkX, blkY;
+  int pixX, pixY;
+
+  int cbpY, cbpC, cbpChromaDC;
+
+  u_int8 predY[MBK_SIZE][MBK_SIZE];
+  u_int8 predC[MBK_SIZE/2][MBK_SIZE];
+
+  int dcCoefY[BLK_PER_MB][BLK_PER_MB];
+  int dcCoefC[2][BLK_PER_MB/2][BLK_PER_MB/2];
+
+  int coefY[BLK_PER_MB][BLK_PER_MB][BLK_SIZE][BLK_SIZE];
+  int coefC[2][BLK_PER_MB/2][BLK_PER_MB/2][BLK_SIZE][BLK_SIZE];
+
+  int mbAvailBits;
+
+  int8 numCoefLeftPred[BLK_PER_MB];
+  int8 numCoefLeftPredC[2][BLK_PER_MB/2];
+
+  int8 ipModesLeftPred[BLK_PER_MB];
+
+} macroblock_s;
+
+
+void mbkSetInitialQP(macroblock_s *mb, int qp, int chromaQpIdx);
+
+TInt mbkParse(macroblock_s *mb, 
+              TInt numRefFrames, mbAttributes_s *mbData, TInt picWidth, 
+              TInt picType, TInt constIpred, TInt chromaQpIdx,
+              TInt mbIdxX, TInt mbIdxY, void *streamBuf, TInt aBitOffset);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/motcomp.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _MOTION_H_
+#define _MOTION_H_
+
+
+#include "nrctyp32.h"
+#include "framebuffer.h"
+
+
+#define MOT_NUM_MODES     7
+#define MOT_COPY          0
+#define MOT_16x16         1
+#define MOT_16x8          2   
+#define MOT_8x16          3
+#define MOT_8x8           4
+#define MOT_8x4           5   
+#define MOT_4x8           6
+#define MOT_4x4           7
+
+
+int mcpGetNumMotVecs(int interMode, int subMbTypes[4]);
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/nrctyp32.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Data type definitions.
+*
+*/
+
+
+#ifndef _NRCTYP32_H_
+#define _NRCTYP32_H_
+
+typedef unsigned char   Byte;
+typedef unsigned char   u_char;
+typedef signed char     int8;
+typedef unsigned char   u_int8;
+typedef short           int16;
+typedef unsigned short  u_int16;
+typedef long            int32;
+typedef unsigned long   u_int32;
+typedef float           float32;
+typedef double          float64;
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/parameterset.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _PARAMETERSET_H_
+#define _PARAMETERSET_H_
+
+#include "nrctyp32.h"
+#include "bitbuffer.h"
+#include <e32def.h>
+#include <e32base.h>
+
+
+/* Parameter set error codes */
+#define PS_ERR_MEM_ALLOC            -5
+#define PS_ERR_UNSUPPORTED_FEATURE  -4
+#define PS_ERR_UNSUPPORTED_PROFILE  -3
+#define PS_ERR_ILLEGAL_VALUE        -2
+#define PS_ERROR                    -1
+#define PS_OK                        0
+
+
+/* Boolean Type */
+typedef unsigned int Boolean;
+
+/* According to the Awaji meeting decision: */
+#define PS_MAX_NUM_OF_SPS         32
+#define PS_MAX_NUM_OF_PPS         256
+
+/* Profile IDC's */
+#define PS_BASELINE_PROFILE_IDC   66
+#define PS_MAIN_PROFILE_IDC       77
+#define PS_EXTENDED_PROFILE_IDC   88
+
+#define PS_MAX_CPB_CNT            32
+
+#define PS_EXTENDED_SAR           255
+
+/* Slice groups supported by baseline profile and extended profile */
+#define PS_MAX_NUM_SLICE_GROUPS              8
+#define PS_SLICE_GROUP_MAP_TYPE_INTERLEAVED  0
+#define PS_SLICE_GROUP_MAP_TYPE_DISPERSED    1
+#define PS_SLICE_GROUP_MAP_TYPE_FOREGROUND   2
+#define PS_SLICE_GROUP_MAP_TYPE_CHANGING_3   3
+#define PS_SLICE_GROUP_MAP_TYPE_CHANGING_4   4
+#define PS_SLICE_GROUP_MAP_TYPE_CHANGING_5   5
+#define PS_SLICE_GROUP_MAP_TYPE_EXPLICIT     6
+#define PS_BASELINE_MAX_SLICE_GROUPS 		7
+
+
+#define PS_MAX_NUM_REF_FRAMES_IN_PIC_ORDER_CNT_CYCLE  256
+
+// NOTE: Levels up to 2 are eanbled for testing purposes
+//       1.2 is the max level we should support
+//#define PS_MAX_SUPPORTED_LEVEL 20		// Maximum level that we support
+
+//WVGA task
+#define PS_MAX_SUPPORTED_LEVEL 31
+
+
+/*
+ * Hypothetical reference decoder parameters
+ */
+
+typedef struct _hrd_parameters_s
+{
+  unsigned    cpb_cnt_minus1;                                   // ue(v)
+  unsigned    bit_rate_scale;                                   // u(4)
+  unsigned    cpb_size_scale;                                   // u(4)
+    u_int32   bit_rate_value_minus1[PS_MAX_CPB_CNT];            // ue(v)
+    u_int32   cpb_size_value_minus1[PS_MAX_CPB_CNT];            // ue(v)
+    unsigned  cbr_flag[PS_MAX_CPB_CNT];                         // u(1)
+  unsigned    initial_cpb_removal_delay_length_minus1;          // u(5)
+  unsigned    cpb_removal_delay_length_minus1;                  // u(5)
+  unsigned    dpb_output_delay_length_minus1;                   // u(5)
+  unsigned    time_offset_length;                               // u(5)
+} hrd_parameters_s;
+
+
+/*
+ * Video usability information
+ */
+
+typedef struct _vui_parameters_s
+{
+  Boolean             aspect_ratio_info_present_flag;                   // u(1)
+    unsigned          aspect_ratio_idc;                                 // u(8)
+      unsigned        sar_width;                                        // u(16)
+      unsigned        sar_height;                                       // u(16)
+  Boolean             overscan_info_present_flag;                       // u(1)
+    Boolean           overscan_appropriate_flag;                        // u(1)
+  Boolean             video_signal_type_present_flag;                   // u(1)
+    unsigned          video_format;                                     // u(3)
+    Boolean           video_full_range_flag;                            // u(1)
+    Boolean           colour_description_present_flag;                  // u(1)
+      unsigned        colour_primaries;                                 // u(8)
+      unsigned        transfer_characteristics;                         // u(8)
+      unsigned        matrix_coefficients;                              // u(8)
+  Boolean             chroma_loc_info_present_flag;                     // u(1)
+    unsigned          chroma_sample_loc_type_top_field;                 // ue(v)
+    unsigned          chroma_sample_loc_type_bottom_field;              // ue(v)
+  Boolean             timing_info_present_flag;                         // u(1)
+    u_int32           num_units_in_tick;                                // u(32)
+    u_int32           time_scale;                                       // u(32)
+    Boolean           fixed_frame_rate_flag;                            // u(1)
+  Boolean             nal_hrd_parameters_present_flag;                  // u(1)
+    hrd_parameters_s  nal_hrd_parameters;                               // hrd_paramters_s
+  Boolean             vcl_hrd_parameters_present_flag;                  // u(1)
+    hrd_parameters_s  vcl_hrd_parameters;                               // hrd_paramters_s
+  // if ((nal_hrd_parameters_present_flag || (vcl_hrd_parameters_present_flag))
+    Boolean           low_delay_hrd_flag;                               // u(1)
+  Boolean             pic_struct_present_flag;                          // u(1)
+  Boolean             bitstream_restriction_flag;                       // u(1)
+    Boolean           motion_vectors_over_pic_boundaries_flag;          // u(1)
+    unsigned          max_bytes_per_pic_denom;                          // ue(v)
+    unsigned          max_bits_per_mb_denom;                            // ue(v)
+    unsigned          log2_max_mv_length_horizontal;                    // ue(v)
+    unsigned          log2_max_mv_length_vertical;                      // ue(v)
+    unsigned          num_reorder_frames;                               // ue(v)
+    unsigned          max_dec_frame_buffering;                          // ue(v)
+} vui_parameters_s;
+
+
+/*
+ * Picture parameter set
+ */
+
+typedef struct _pic_parameter_set_s
+{
+  unsigned      pic_parameter_set_id;                          // ue(v)
+  unsigned      seq_parameter_set_id;                          // ue(v)
+  Boolean       entropy_coding_mode_flag;                      // u(1)
+  Boolean       pic_order_present_flag;                        // u(1)
+  unsigned      num_slice_groups_minus1;                       // ue(v)
+    unsigned    slice_group_map_type;                          // ue(v)
+      // if( slice_group_map_type = = 0 )
+      unsigned  run_length_minus1[PS_MAX_NUM_SLICE_GROUPS];    // ue(v)
+      // else if( slice_group_map_type = = 2 )
+      unsigned  top_left[PS_MAX_NUM_SLICE_GROUPS];             // ue(v)
+      unsigned  bottom_right[PS_MAX_NUM_SLICE_GROUPS];         // ue(v)
+      // else if( slice_group_map_type = = 3 || 4 || 5
+      Boolean   slice_group_change_direction_flag;             // u(1)
+      unsigned  slice_group_change_rate_minus1;                // ue(v)
+      // else if( slice_group_map_type = = 6 )
+      unsigned  pic_size_in_map_units_minus1;                  // ue(v)
+      unsigned  *slice_group_id;                               // complete MBAmap u(v)
+  unsigned      num_ref_idx_l0_active_minus1;                  // ue(v)
+  unsigned      num_ref_idx_l1_active_minus1;                  // ue(v)
+  Boolean       weighted_pred_flag;                            // u(1)
+  Boolean       weighted_bipred_idc;                           // u(2)
+  int           pic_init_qp_minus26;                           // se(v)
+  int           pic_init_qs_minus26;                           // se(v)
+  int           chroma_qp_index_offset;                        // se(v)
+  Boolean       deblocking_filter_parameters_present_flag;     // u(1)
+  Boolean       constrained_intra_pred_flag;                   // u(1)
+  Boolean       redundant_pic_cnt_present_flag;                // u(1)
+  
+	TUint8 indexChanged;	// Flag for changed PPS Id (because of Id conflict in clip (can happen in e.g. merge, cut operations)
+  	TUint newPPSId;
+  	TUint PPSlength;
+  	TUint8* codedPPSBuffer;
+    TUint encPPSId;
+    TUint origPPSId;
+} pic_parameter_set_s;
+
+
+/*
+ * Sequence parameter set
+ */
+
+typedef struct _seq_parameter_set_s
+{
+  unsigned  profile_idc;                                      // u(8)
+  Boolean   constraint_set0_flag;                             // u(1)
+  Boolean   constraint_set1_flag;                             // u(1)
+  Boolean   constraint_set2_flag;                             // u(1)
+  Boolean   constraint_set3_flag;                             // u(1)
+  Boolean   reserved_zero_4bits;                              // u(4)
+  unsigned  level_idc;                                        // u(8)
+  unsigned  seq_parameter_set_id;                             // ue(v)
+  unsigned  log2_max_frame_num_minus4;                        // ue(v)
+  unsigned  pic_order_cnt_type;
+    // if( pic_order_cnt_type == 0 ) 
+    unsigned log2_max_pic_order_cnt_lsb_minus4;               // ue(v)
+    // else if( pic_order_cnt_type == 1 )
+    Boolean delta_pic_order_always_zero_flag;                 // u(1)
+    int32   offset_for_non_ref_pic;                           // se(v)
+    int32   offset_for_top_to_bottom_field;                   // se(v)
+    unsigned  num_ref_frames_in_pic_order_cnt_cycle;          // ue(v)
+      // for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ )
+      int32 offset_for_ref_frame[PS_MAX_NUM_REF_FRAMES_IN_PIC_ORDER_CNT_CYCLE];   // se(v)
+  unsigned  num_ref_frames;                                   // ue(v)
+  Boolean   gaps_in_frame_num_value_allowed_flag;             // u(1)
+  unsigned  pic_width_in_mbs_minus1;                          // ue(v)
+  unsigned  pic_height_in_map_units_minus1;                   // ue(v)
+  Boolean   frame_mbs_only_flag;                              // u(1)
+    // if( !frame_mbs_only_flag ) 
+    Boolean mb_adaptive_frame_field_flag;                     // u(1)
+  Boolean   direct_8x8_inference_flag;                        // u(1)
+  Boolean       frame_cropping_flag;                           // u(1)
+    unsigned    frame_crop_left_offset;                        // ue(v)
+    unsigned    frame_crop_right_offset;                       // ue(v)
+    unsigned    frame_crop_top_offset;                         // ue(v)
+    unsigned    frame_crop_bottom_offset;                      // ue(v)
+  Boolean   vui_parameters_present_flag;                      // u(1)
+    vui_parameters_s vui_parameters;                          // vui_seq_parameters_s
+    
+  	TUint8 indexChanged;	// Flag for changed PPS Id (because of Id conflict in clip (can happen in e.g. merge, cut operations)
+  	TUint newSPSId;
+  	TUint SPSlength;
+    TUint8* codedSPSBuffer;
+    TUint encSPSId;
+    TUint origSPSId;
+    TUint8	maxFrameNumChanged;
+    TUint origMaxFrameNum;
+    TUint encMaxFrameNum;
+    TUint8	maxPOCNumChanged;
+    TUint origMaxPOCNum;
+    TUint encMaxPOCNum;
+} seq_parameter_set_s;
+
+
+
+/*
+ * Function prototypes
+ */
+
+
+
+TInt psParseLevelFromSPS( bitbuffer_s *bitbuf, TInt& aLevel );
+
+TInt AddBytesToBuffer(bitbuffer_s *aBitBuffer, TUint aNumBytes);
+
+int psDecodeSPS( bitbuffer_s *bitbuf, seq_parameter_set_s **spsList, 
+                 TInt& aWidth, TInt& aHeight );
+
+void psCloseParametersSets(seq_parameter_set_s **spsList,
+                           pic_parameter_set_s **ppsList);
+                           
+void psClosePPS( pic_parameter_set_s *pps );
+
+void psCloseSPS( seq_parameter_set_s *sps );
+
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+
+TInt psParseSPS( bitbuffer_s *bitbuf, seq_parameter_set_s **spsList, TUint aFrameFromEncoder, TBool *aEncodeUntilIDR, TUint *aNumSPS );
+
+TInt psParsePPS( bitbuffer_s *bitbuf, pic_parameter_set_s **ppsList, seq_parameter_set_s **spsList, 
+				 TUint aFrameFromEncoder, TUint *aNumPPS );
+
+void psGetAspectRatio(seq_parameter_set_s *sps, int *width, int *height);
+
+TInt GetNumTrailingBits(bitbuffer_s *aBitBuffer);
+
+TInt ReturnUnsignedExpGolombCodeLength(TUint aValue);
+
+void EncodeUnsignedExpGolombCode(bitbuffer_s *aBitBuffer, TUint aValue);
+
+void ShiftBitBufferBitsRight(bitbuffer_s *aBitBuffer, TInt aDiff);
+
+void ShiftBitBufferBitsLeft(bitbuffer_s *aBitBuffer, TInt aDiff);
+
+void ShiftBufferLeftByOneByte(bitbuffer_s *aBitBuffer);
+
+void ShiftBufferRightByOneByte(bitbuffer_s *aBitBuffer);
+
+void ShiftBufferRight(bitbuffer_s *aBitBuffer, TInt aDiff, TUint aTrailingBits, TUint aOldIdLength);
+
+void ShiftBufferLeft(bitbuffer_s *aBitBuffer, TInt aDiff, TUint aOldIdLength);
+
+
+#endif  // VIDEOEDITORENGINE_AVC_EDITING
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/sequence.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _SEQUENCE_H_
+#define _SEQUENCE_H_
+
+
+#include "globals.h"
+#include "framebuffer.h"
+#include "slice.h"
+#include "bitbuffer.h"
+
+
+/*
+ * Definitions of NAL types
+ */
+#define NAL_TYPE_UNSPECIFIED      0
+#define NAL_TYPE_CODED_SLICE      1
+#define NAL_TYPE_CODED_SLICE_P_A  2
+#define NAL_TYPE_CODED_SLICE_P_B  3
+#define NAL_TYPE_CODED_SLICE_P_C  4
+#define NAL_TYPE_CODED_SLICE_IDR  5
+#define NAL_TYPE_SEI              6
+#define NAL_TYPE_SPS              7
+#define NAL_TYPE_PPS              8
+#define NAL_TYPE_PIC_DELIMITER    9
+#define NAL_TYPE_END_SEQ          10
+#define NAL_TYPE_END_STREAM       11
+#define NAL_TYPE_FILLER_DATA      12
+
+
+typedef struct _sequence_s 
+{
+
+  dpb_s *dpb;
+
+  frmBuf_s *outputQueue[DPB_MAX_SIZE];
+  int outputQueuePos;
+  int numQueuedOutputPics;
+
+  bitbuffer_s *bitbuf;
+
+  int sliceNums[PS_MAX_NUM_SLICE_GROUPS];
+
+  seq_parameter_set_s *spsList[PS_MAX_NUM_OF_SPS];
+  pic_parameter_set_s *ppsList[PS_MAX_NUM_OF_PPS];
+
+  slice_s *currSlice;
+  slice_s *nextSlice;
+
+  int isFirstSliceOfSeq;
+  int isPicBoundary;
+  int isCurrPicFinished;
+  int isDpbStorePending;
+  int isSeqFinished;
+
+  unsigned int redundantPicCnt;
+
+  int32 unusedShortTermFrameNum;
+  int32 prevFrameNum;
+  int32 prevRefFrameNum;
+
+  /* for POC type 0 : */
+  int32 pocMsb;
+  int32 prevPocMsb;
+  int32 prevPocLsb;
+  /* for POC type 1 : */
+  int32 frameNumOffset;
+  int32 prevFrameNumOffset;
+
+  /* The previous decoded picture in decoding order includes */
+  /* a memory_management_control_operation equal to 5        */
+  int prevPicHasMMCO5; 
+                       
+  mbAttributes_s *mbData;
+  frmBuf_s *recoBuf;
+
+  TUint iFrameNumber;
+  TUint iFromEncoder;
+  TUint sliceDataModified;
+  	    
+  TBool iEncodeUntilIDR;	//	Encoded beginning of a clip has different SPS than the original
+  TBool iBitShiftInSlice;
+  
+  TUint iNumSPS;
+  TUint iNumPPS;
+  
+  TUint iPreviousPPSId;
+
+  // [KW]: For testing, remove later!!!
+  TUint iTotalFrameNumber;
+
+} sequence_s;
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/slice.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _SLICE_H_
+#define _SLICE_H_
+
+
+#include "globals.h"
+#include "nrctyp32.h"
+#include "bitbuffer.h"
+#include "framebuffer.h"
+#include "motcomp.h"
+#include "parameterset.h"
+#include "dpb.h"
+#include <e32std.h>
+
+/* Error codes */
+#define SLICE_ERR_NON_EXISTING_PPS     -5
+#define SLICE_ERR_NON_EXISTING_SPS     -4
+#define SLICE_ERR_UNSUPPORTED_FEATURE  -3
+#define SLICE_ERR_ILLEGAL_VALUE        -2
+#define SLICE_ERROR                    -1
+#define SLICE_OK                        0
+#define SLICE_STOP_PARSING				1
+#define SLICE_STOP_PARSING				1
+
+#define MAX_SLICE_GROUP_NUM      8
+#define MAX_NUM_OF_REORDER_CMDS  17
+#define MAX_NUM_OF_MMCO_OPS      35
+
+
+typedef struct _sliceMMCO_s {
+  unsigned int memory_management_control_operation;
+  unsigned int difference_of_pic_nums_minus1;
+  unsigned int long_term_pic_num;
+  unsigned int long_term_frame_idx;
+  unsigned int max_long_term_frame_idx_plus1;
+} sliceMMCO_s;
+
+
+typedef struct _sliceRefPicListReorderCmd_s {
+  unsigned int reordering_of_pic_nums_idc;
+  unsigned int abs_diff_pic_num_minus1;
+  unsigned int long_term_pic_num;
+} sliceRefPicListReorderCmd_s;
+
+
+
+typedef struct _slice_s {
+
+  /* Copied from NAL deader */
+  int nalType;
+  int nalRefIdc;
+
+  u_int32       maxFrameNum;
+
+  unsigned int  isIDR;
+  unsigned int  qp;
+  unsigned int  picHasMMCO5;
+
+  /*
+   * These are slice header syntax elements
+   */
+
+  unsigned int  first_mb_in_slice;
+  unsigned int  slice_type;
+  unsigned int  pic_parameter_set_id;
+  unsigned int  frame_num;
+
+    unsigned int  idr_pic_id;
+
+    unsigned int  pic_order_cnt_lsb;
+      int32         delta_pic_order_cnt_bottom;
+
+    int32         delta_pic_order_cnt_0;
+      int32         delta_pic_order_cnt_1;
+
+    unsigned int  redundant_pic_cnt;
+
+  unsigned int  num_ref_idx_active_override_flag;
+    unsigned int  num_ref_idx_l0_active_minus1;
+
+  unsigned int  ref_pic_list_reordering_flag0;
+    sliceRefPicListReorderCmd_s reorderCmdList[MAX_NUM_OF_REORDER_CMDS];
+
+/* pred_weight_table() */
+
+  /* if( nal_unit_type  = =  5 ) */
+    unsigned int  no_output_of_prior_pics_flag;
+    unsigned int  long_term_reference_flag;
+  /* else */
+    unsigned int  adaptive_ref_pic_marking_mode_flag;
+      sliceMMCO_s mmcoCmdList[MAX_NUM_OF_MMCO_OPS];
+
+  int           slice_qp_delta;
+
+    unsigned int  disable_deblocking_filter_idc;
+      int           slice_alpha_c0_offset_div2;
+      int           slice_beta_offset_div2;
+
+    unsigned int  slice_group_change_cycle;
+    
+    TInt	bitOffset;
+    TUint sliceDataModified;
+} slice_s;
+
+
+slice_s *sliceOpen();
+
+void sliceClose(slice_s *slice);
+
+TInt ParseSliceHeader(slice_s *slice, seq_parameter_set_s *spsList[],
+                     pic_parameter_set_s *ppsList[], bitbuffer_s *bitbuf, 
+                     TUint* frameNumber, TUint aFrameFromEncoder);
+
+TInt sliceParseMacroblocks(slice_s *slice, frmBuf_s *recoBuf, dpb_s *dpb,
+                           pic_parameter_set_s *pps,
+                           mbAttributes_s *mbData, TInt sliceID,
+                           bitbuffer_s *bitbuf,
+                           TBool aBitShiftInSlice);
+
+int sliceInitRefPicList(dpb_s *dpb, frmBuf_s *refPicList[]);
+
+int sliceFixRefPicList(dpb_s *dpb, frmBuf_s *refPicList[],
+                       int numRefPicActive, int numExistingRefFrames,
+                       int width, int height);
+                       
+void EncodeUnsignedNBits(bitbuffer_s *aBitBuffer, TUint aValue, TUint aLength);
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/vedavcedit.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* A header file defining the AVC editing API.
+*                
+*
+*/
+
+
+
+#ifndef VEDAVCEDIT_H
+#define VEDAVCEDIT_H
+
+#include <e32base.h>
+
+/**
+*  CVedAVCEdit abstract base class for AVC editing class
+*
+*  @lib vedAVCEdit
+*  @since
+*/
+class CVedAVCEdit : public CBase
+    {
+
+    public:  // Constants
+
+    public:  // Constructors and destructor        	
+
+        /**
+        * Two-phased constructor.
+        *
+        */
+        IMPORT_C static CVedAVCEdit* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CVedAVCEdit();
+
+    public:  // New functions
+    
+    	/*
+        * Add MDF specific NAL headers to input AVC frame
+        * 
+        * @param aBuf Input/output buffer
+        * @param aFrameLen Input/output frame length
+        * @param aDecInfoSize Decoder specific info size
+        * @param aFirstFrame ETrue for first frame in sequence
+        */                
+	    virtual void ProcessAVCBitStreamL(TDes8& aBuf, TInt& aFrameLen, TInt aDecInfoSize, TBool aFirstFrame) = 0;		
+
+ 	    /*
+        * Calculate default value for no. of buffered frames according to 
+        * H.264 spec Annex A
+        * 
+        * @param aLevel AVC level
+        * @param aResolution Video resolution        
+        */
+	    virtual TInt GetMaxAVCFrameBuffering(TInt aLevel, TSize aResolution) = 0;
+	    
+	    /*
+        * Get input bitstream level from SPS. Note: SPS Nal unit must be at the 
+        * beginning of the input buffer
+        * 
+        * @param aBuf Input buffer containing SPS
+        * @param aLevel Output: Baseline profile level
+        */        
+        virtual TInt GetLevel(TDesC8& aBuf, TInt& aLevel) = 0;
+                
+        /*
+        * Get input bitstream video resolution from SPS. Note: SPS Nal unit must 
+        * be at the beginning of the input buffer
+        * 
+        * @param aBuf        Input buffer containing SPS
+        * @param aResolution Output: Resolution
+        */        
+        virtual TInt GetResolution(TDesC8& aBuf, TSize& aResolution) = 0;
+     
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+
+        /*
+        * Convert AVC specific decoder config info to AVCDecoderConfigurationRecord -format
+        * 
+        * @param aSrcBuf Source buffer containing SPS/PPS NAL units in AVC MDF buffer format
+        * @param aDstBuf Destination buffer for AVCDecoderConfigurationRecord        
+        */        
+        virtual void ConvertAVCHeaderL(TDesC8& aSrcBuf, TDes8& aDstBuf ) = 0;	    
+
+	    /*
+        * Save SPS/PPS NAL units from AVCDecoderConfigurationRecord
+        * for later use
+        *  
+        * @param aBuf Input buffer containing AVCDecoderConfigurationRecord        
+        */                
+	    virtual void SaveAVCDecoderConfigurationRecordL(TDes8& aBuf, TBool aFromEncoder) = 0;	    
+	    
+	    /*
+        * Update slice header information: frame number and PPS id        
+        * 
+        * @param aBuf Buffer containing input frame
+        * @param aContainsDCR ETrue if AVC decoder config. record is included
+        * @param aFromEncoder ETrue if frame comes from the encoder
+        */	    
+        virtual TInt ParseFrame(HBufC8*& aBuf, TBool aContainsDCR, TBool aFromEncoder) = 0;
+        
+        /*
+        * Constructs AVCDecoderConfigurationRecord for the whole sequence, taking
+        * into account all input DCR's        
+        *  
+        * @param aDstBuf Destination buffer for AVCDecoderConfigurationRecord        
+        * @param aLevel Level output sequence    
+        */      
+        virtual void ConstructAVCDecoderConfigurationRecordL( TDes8& aDstBuf ) = 0;
+
+        /*
+        * Set length of NAL size field of output sequence
+        * 
+        * @param aSize Length of size field in bytes        
+        */	    
+        virtual void SetNALLengthSize( TInt aSize ) = 0;
+        
+        /*
+        * Set output level for constructing AVCDecoderConfigurationRecord
+        * 
+        * @param aLevel Output level
+        */	   
+        virtual void SetOutputLevel(TInt aLevel) = 0;
+        
+        /*
+        * Check if encoding is required until the next IDR unit
+        * 
+        */	   
+        virtual TBool EncodeUntilIDR() = 0;
+        
+        /*
+        * Check if NAL unit is an IDR NAL
+        * 
+        * @param aNalBuf buffer containing NAL unit
+        */	   
+        virtual TBool IsNALUnitIDR( TDes8& aNalBuf ) = 0;
+        
+        /*
+        * Store PPS id from the current slice
+        * 
+        * @param aNalBuf buffer containing NAL unit
+        */	   
+		virtual void StoreCurrentPPSId( TDes8& aNalBuf ) = 0;
+
+        /*
+        * Generate a not coded frame
+        * 
+        * @param aNalBuf buffer containing NAL unit
+        */	   
+		virtual TInt GenerateNotCodedFrame( TDes8& aNalBuf, TUint aFrameNumber ) = 0;
+
+        /*
+        * Modify the frame number of the NAL unit
+        * 
+        * @param aNalBuf buffer containing NAL unit
+        */	   
+		virtual void ModifyFrameNumber( TDes8& aNalBuf, TUint aFrameNumber ) = 0;
+#endif
+
+};
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/vedavceditimp.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* A header file for implementation class of AVC editing API.
+*               
+*/
+
+
+
+#ifndef VEDAVCEDITIMP_H
+#define VEDAVCEDITIMP_H
+
+// INCLUDES
+#include "avcdapi.h"
+#include "vedavcedit.h"
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  CTranscoder Implementation class
+*  @lib VEDAVCEDIT.LIB
+*  @since 
+*/
+
+NONSHARABLE_CLASS(CVedAVCEditImp) : public CVedAVCEdit
+{
+
+    public:  // Constructors and destructor
+    
+        /**
+        * Two-phased constructor.
+        */
+        static CVedAVCEditImp* NewL();
+
+        /**
+        * Destructor.
+        */        
+        ~CVedAVCEditImp();
+      
+    public: // Functions from CVedAVCEdit                    
+    
+    	/**
+        * From CVedAVCEdit Add MDF specific NAL headers to input AVC frame        
+        */                
+	    void ProcessAVCBitStreamL(TDes8& aBuf, TInt& aFrameLen, TInt aDecInfoSize, TBool aFirstFrame);
+	
+	    /**	    
+ 	    * From CVedAVCEdit Calculate default value for max no. of buffered frames
+        */        
+	    TInt GetMaxAVCFrameBuffering(TInt aLevel, TSize aResolution);
+	    
+	    /**
+        * From CVedAVCEdit Get input bitstream level from SPS
+        */
+        TInt GetLevel(TDesC8& aBuf, TInt& aLevel);
+                
+        /**
+        * From CVedAVCEdit Get input bitstream resolution from SPS
+        */
+        TInt GetResolution(TDesC8& aBuf, TSize& aResolution);
+	    
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+    
+    	/**
+		* From CVedAVCEdit Convert AVC decoder config info to AVCDecoderConfigurationRecord -format
+		*/        
+	    void ConvertAVCHeaderL(TDesC8& aSrcBuf, TDes8& aDstBuf );
+	    	    
+	    /**	    
+ 	    * From CVedAVCEdit Save SPS/PPS NAL units from AVCDecoderConfigurationRecord
+        */        
+        void SaveAVCDecoderConfigurationRecordL(TDes8& aBuf, TBool aFromEncoder);              
+        
+        /**	    
+ 	    * From CVedAVCEdit Update slice header information: frame number and PPS id        
+        */      
+        TInt ParseFrame(HBufC8*& aBuf, TBool aContainsDCR, TBool aFromEncoder);
+	    
+	    /**	    
+ 	    * From CVedAVCEdit Constructs AVCDecoderConfigurationRecord for the output sequence
+        */      
+        void ConstructAVCDecoderConfigurationRecordL( TDes8& aDstBuf );
+        
+        /**	    
+ 	    * From CVedAVCEdit Set length of NAL size field of output sequence
+        */      
+        void inline SetNALLengthSize( TInt aSize ) { iNalLengthSize = aSize; }
+        
+         /**	    
+ 	    * From CVedAVCEdit Set output level for constructing AVCDecoderConfigurationRecord
+        */     
+        void inline SetOutputLevel(TInt aLevel) { iOutputLevel = aLevel; }
+        
+        /**	    
+ 	    * From CVedAVCEdit Check if encoding is required until the next IDR unit
+        */     
+        TBool EncodeUntilIDR();
+
+        /**	    
+ 	    * From CVedAVCEdit Check if NAL unit is an IDR NAL
+        */     
+        TBool IsNALUnitIDR( TDes8& aNalBuf );
+
+        /**	    
+ 	    * From CVedAVCEdit Store PPS id from current slice
+        */     
+		void StoreCurrentPPSId( TDes8& aNalBuf );
+        
+        /**	    
+ 	    * From CVedAVCEdit Generate a not coded frame
+        */     
+		TInt GenerateNotCodedFrame( TDes8& aNalBuf, TUint aFrameNumber );
+		
+        /**
+        * From CVedAVCEdit Modify the frame number of the NAL unit
+        */	   
+		void ModifyFrameNumber( TDes8& aNalBuf, TUint aFrameNumber );
+		
+private:  // Private methods
+        
+        /*
+        * Saves one SPS/PPS NAL unit for later use
+        *  
+        * @param aBuf Input buffer containing AVCDecoderConfigurationRecord        
+        */                	    
+	    TInt ParseOneNAL(void *aNalUnitData, TUint* aNalUnitLength, TBool aFromEncoder);
+	    
+	    TInt ParseParameterSet(void *aNalUnitData, TUint* aNalUnitLength, TBool aFromEncoder);
+#endif
+        
+    private:
+    
+        /**
+        * C++ default constructor.
+        */
+        CVedAVCEditImp();
+        
+        /**
+        * 2nd phase constructor 
+        */
+        void ConstructL();
+	    
+	private:  // Data
+	
+	    avcdDecoder_t* iAvcDecoder;  // For parsing AVC content / for CD operations 
+	
+	    TInt iFrameLengthBytes;  // no. of bytes used for length field	    	    						
+	    
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+				
+	    TInt iNalLengthSize;	// The number of bytes used to signal NAL unit's length 
+	    
+	    TInt iOutputLevel;  // output level
+	    
+#endif
+
+};
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/inc/vld.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef _VLC_H_
+#define _VLC_H_
+
+
+#include "bitbuffer.h"
+
+
+#define VLD_OK                       0
+#define VLD_ERROR                   -1
+#define VLD_ERR_MAX_CW_LEN_EXCEEDED -2
+
+
+typedef struct _vldMBtype_s {
+  int type;
+  int intraType;
+  int intraMode;
+  int interMode;
+  int inter8x8modes[4];
+  int cbpY;
+  int cbpC;
+  int cbpChromaDC;
+} vldMBtype_s;
+
+
+unsigned int vldGetFLC(bitbuffer_s *bitbuf, int len);
+
+unsigned int vldGetUVLC(bitbuffer_s *bitbuf);
+
+int32 vldGetSignedUVLClong(bitbuffer_s *bitbuf);
+
+u_int32 vldGetUVLClong(bitbuffer_s *bitbuf);
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+
+void vldInvZigZagScan4x4(int *src, int dest[BLK_SIZE][BLK_SIZE]);
+
+int vldGetSignedUVLC(bitbuffer_s *bitbuf);
+
+int getLumaBlkCbp(int cbpY);
+
+void setChromaCbp(int nc, int *cbpDC, int *cbp);
+
+unsigned int vldGetRunIndicator(bitbuffer_s *bitbuf);
+
+int vldGetMBtype(bitbuffer_s *bitbuf, vldMBtype_s *hdr, int picType);
+
+int vldGetIntraPred(bitbuffer_s *bitbuf, int8 *ipTab);
+
+int vldGetChromaIntraPred(bitbuffer_s *bitbuf);
+
+int vldGetMotVecs(bitbuffer_s *bitbuf, int interMode, int numRefFrames,
+                  int *refNum, int predVecs[][2], int numVecs);
+
+int vldGetCBP(bitbuffer_s *bitbuf, int type,
+              int *cbpY, int *cbpChromaDC, int *cbpC);
+
+int vldGetDeltaqp(bitbuffer_s *bitbuf, int *delta_qp);
+
+int vldGetLumaDCcoeffs(bitbuffer_s *bitbuf, int coef[4][4],
+                       int8 *numCoefUpPred, int8 *numCoefLeftPred,
+                       int mbAvailBits);
+
+int vldGetLumaCoeffs(bitbuffer_s *bitbuf, int mbType, int intraType,
+                     int *cbpY, int coef[4][4][4][4], int8 *numCoefUpPred,
+                     int8 *numCoefLeftPred, int mbAvailBits);
+
+void vldGetZeroLumaCoeffs(int8 *numCoefUpPred, int8 *numCoefLeftPred);
+
+int vldGetChromaDCcoeffs(bitbuffer_s *bitbuf, int coef[2][2][2], int *cbpDC);
+
+int vldGetChromaCoeffs(bitbuffer_s *bitbuf, int coef[2][2][2][4][4], int *cbp,
+                       int8 *numCoefUpPred, int8 *numCoefUpPredV,
+                       int8 *numCoefLeftPred, int8 *numCoefLeftPredV,
+                       int mbAvailBits);
+
+void vldGetZeroChromaCoeffs(int8 *numCoefUpPredU, int8 *numCoefUpPredV,
+                            int8 numCoefLeftPred[2][2]);
+
+void vldGetAllCoeffs(int8 *numCoefUpPredY, int8 *numCoefUpPredU,
+                     int8 *numCoefUpPredV, int8 *numCoefLeftPredY,
+                     int8 numCoefLeftPredC[2][2]);
+
+int vldSetUVLC(int codeNumber, int* codeword, int* codewordLength);
+
+#endif  // VIDEOEDITORENGINE_AVC_EDITING
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/bitbuffer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,613 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include <string.h>
+#include "globals.h"
+#include "nrctyp32.h"
+#include "bitbuffer.h"
+
+#include "parameterset.h"
+
+
+/*
+ * Static functions
+ */
+
+static int removeStartCodeEmulationBytes(bitbuffer_s *bitbuf);
+static int addStartCodeEmulationBytes(bitbuffer_s *bitbuf);
+
+
+/*
+ *
+ * bibOpen:
+ *
+ * Parameters:
+ *
+ * Function:
+ *      Open bitbuffer
+ *
+ * Returns:
+ *      Pointer to bitbuffer object or NULL for allocation failure.
+ *
+ */
+bitbuffer_s *bibOpen()
+{
+  bitbuffer_s *bitbuf;
+
+  bitbuf = (bitbuffer_s *)User::Alloc(sizeof(bitbuffer_s));
+
+  if (bitbuf != NULL)
+    memset(bitbuf, 0, sizeof(bitbuffer_s));
+
+  return bitbuf;
+}
+
+
+/*
+ *
+ * bibInit:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      streamBytes           Pointer to data
+ *      length                Data length in bytes
+ *
+ * Function:
+ *      Initialize bitbuffer
+ *
+ * Returns:
+ *      BIB_ok for ok, BIB_ERROR for error
+ *
+ */
+int bibInit(bitbuffer_s *bitbuf, u_int8 *streamBytes, int length)
+{
+  bitbuf->data           = streamBytes;
+  bitbuf->dataLen        = length;
+  bitbuf->bytePos        = 0;
+  bitbuf->bitpos         = 0;
+  bitbuf->errorStatus    = BIB_OK;
+
+#if ENCAPSULATED_NAL_PAYLOAD
+  if (removeStartCodeEmulationBytes(bitbuf) < 0)
+    return BIB_ERROR;
+#endif
+
+  return BIB_OK;
+}
+
+
+/*
+ *
+ * bibClose:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Close bitbuffer
+ *
+ * Returns:
+ *      -
+ *
+ */
+void bibClose(bitbuffer_s *bitbuf)
+{
+  User::Free(bitbuf);
+}
+
+
+/*
+ *
+ * removeStartCodeEmulationBytes:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Remove start code emulation bytes from the bitbuffer
+ *
+ * Returns:
+ *      -
+ *
+ */
+static int removeStartCodeEmulationBytes(bitbuffer_s *bitbuf)
+{
+  	TInt i;
+  	TInt j;
+  	TInt numZero;
+  	TInt32 lastBytes;
+
+
+  	// Skip the start code if it exists
+  	numZero = 0;
+  	i = 0;
+  	while (i < bitbuf->dataLen) 
+  	{
+    	if (bitbuf->data[i] == 0)
+      		numZero++;
+    	else if (numZero > 1 && bitbuf->data[i] == 1) 
+    	{
+      		// Start code found
+      		i++;
+      		break;
+    	}
+    	else 
+    	{
+      		// No start code found 
+      		i = 0;
+      		break;
+    	}
+    	i++;
+  	}
+
+  	// Convert EBSP to RBSP. Note that the nal head byte is kept within the buffer
+  	lastBytes = 0xffffffff;
+  	j = 0;
+  	while (i < bitbuf->dataLen) 
+  	{
+    	lastBytes = (lastBytes << 8) | bitbuf->data[i];
+    	if ((lastBytes & 0xffffff) != 0x000003) 
+    	{
+	      	bitbuf->data[j] = bitbuf->data[i];
+	      	j++;
+    	}
+    	i++;
+  	}
+
+  	// If bytes were removed, set as many bytes zero at the end of the buffer
+  	if (j < bitbuf->dataLen)
+  	{
+  		// Prevention bytes have been removed, set the last bytes to zero
+  		TInt removedBytes = bitbuf->dataLen - j;
+  		for (i=0; i<removedBytes; i++)
+  		{
+  			bitbuf->data[bitbuf->dataLen-1-i] = 0;
+  		}
+	}
+  	
+  	// Adjust the bitbuffer dataLen
+  	bitbuf->dataLen = j;
+
+  	return BIB_OK;
+}
+
+
+/*
+ *
+ * bibGetBitFunc:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Get next bit from bitbuffer.
+ *
+ * Returns:
+ *      Next bit in bitbuffer or BIB_ERR_NO_BITS if no bits left.
+ *
+ */
+int bibGetBitFunc(bitbuffer_s *bitbuf)
+{
+  /* If there are no bits left in buffer return an error */
+  if (bitbuf->bitpos == 0 && bitbuf->bytePos >= bitbuf->dataLen) {
+    bitbuf->errorStatus = BIB_ERR_NO_BITS;
+    return 0;
+  }
+
+  /* Fill bitbuf->currentBits with bits */
+  while (bitbuf->bitpos <= 24 && bitbuf->bytePos < bitbuf->dataLen) {
+    bitbuf->currentBits = (bitbuf->currentBits << 8) | bitbuf->data[bitbuf->bytePos++];
+    bitbuf->bitpos += 8;
+  }
+
+  /* Return bit */
+  bitbuf->bitpos--;
+  return (bitbuf->currentBits >> bitbuf->bitpos) & 1;
+}
+
+
+/*
+ *
+ * bibGetBitsFunc:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      n                     Number of bits requested
+ *
+ * Function:
+ *      Get next n bits from bitbuffer.
+ *
+ *      NOTE: maximum of 24 bits can be fetched
+ *
+ * Returns:
+ *      Next n bits from bitbuffer
+ *
+ */
+int32 bibGetBitsFunc(bitbuffer_s *bitbuf, int n)
+{
+  /* Fill bitbuf->currentBits with bits */
+  while (n > bitbuf->bitpos && bitbuf->bytePos < bitbuf->dataLen) {
+    bitbuf->currentBits = (bitbuf->currentBits << 8) | bitbuf->data[bitbuf->bytePos++];
+    bitbuf->bitpos += 8;
+  }
+
+  /* If there are not enought bits there was an error */
+  if (n > bitbuf->bitpos) {
+    bitbuf->errorStatus = BIB_ERR_NO_BITS;
+    return 0;
+  }
+
+  /* Return bits */
+  bitbuf->bitpos -= n;
+  return (bitbuf->currentBits >> (bitbuf->bitpos)) & ~(((u_int32)-1)<<n);
+}
+
+
+/*
+ *
+ * bibShowBitsFunc:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      n                     Number of bits requested
+ *
+ * Function:
+ *      Get next n bits from bitbuffer without advancing bitbuffer pointer.
+ *      This function will not failt even if there are not enough bits in
+ *      the bitbuffer.
+ *
+ *      NOTE: maximum of 24 bits can be fetched
+ *
+ * Returns:
+ *      Next n bits of bitbuffer
+ *
+ */
+int32 bibShowBitsFunc(bitbuffer_s *bitbuf, int n)
+{
+  /* Fill bitbuf->currentBits with bits */
+  while (n > bitbuf->bitpos && bitbuf->bytePos < bitbuf->dataLen) {
+    bitbuf->currentBits = (bitbuf->currentBits << 8) | bitbuf->data[bitbuf->bytePos++];
+    bitbuf->bitpos += 8;
+  }
+
+  /* Check if there are enought bits in currentBits */
+  if (n <= bitbuf->bitpos)
+    /* Return bits normally */
+    return (bitbuf->currentBits >> (bitbuf->bitpos-n)) & ~(((u_int32)-1)<<n);
+  else
+    /* Return bits padded with zero bits */
+    return (bitbuf->currentBits << (n-bitbuf->bitpos)) & ~(((u_int32)-1)<<n);
+}
+
+
+/*
+ *
+ * bibSkipBitsFunc:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      n                     Number of bits to skip
+ *
+ * Function:
+ *      Skip next n bits in the bitbuffer
+ *
+ * Returns:
+ *      BIB_OK for no error and BIB_ERR_NO_BITS for end of buffer.
+ *
+ */
+int bibSkipBitsFunc(bitbuffer_s *bitbuf, int n)
+{
+  /* Fill bitbuf->currentBits with bits */
+  while (n > bitbuf->bitpos && bitbuf->bytePos < bitbuf->dataLen) {
+    bitbuf->currentBits = (bitbuf->currentBits << 8) | bitbuf->data[bitbuf->bytePos++];
+    bitbuf->bitpos += 8;
+  }
+
+  bitbuf->bitpos -= n;
+
+  /* Check for buffer underrun */
+  if (bitbuf->bitpos < 0) {
+    bitbuf->errorStatus = BIB_ERR_NO_BITS;
+    return BIB_ERR_NO_BITS;
+  }
+
+  return BIB_OK;
+}
+
+
+/*
+ *
+ * bibGetByte:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      byteRet               Return pointer for byte
+ *
+ * Function:
+ *      Get next byte aligned byte from bitbuffer.
+ *
+ * Returns:
+ *      1 for End Of Stream, 0 otherwise
+ *
+ */
+int bibGetByte(bitbuffer_s *bitbuf, int *byteRet)
+{
+  if (bitbuf->bitpos >= 8) {
+    bitbuf->bitpos = bitbuf->bitpos & ~7;
+    *byteRet = (bitbuf->currentBits >> (bitbuf->bitpos - 8)) & 0xff;
+    bitbuf->bitpos -= 8;
+  }
+  else {
+    bitbuf->bitpos = 0;
+
+    if (bitbuf->bytePos >= bitbuf->dataLen) {
+      return 1;
+    }
+
+    *byteRet = bitbuf->data[bitbuf->bytePos++];
+  }
+
+  return 0;
+}
+
+
+/*
+ *
+ * bibByteAlign:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Set bitbuffer pointer to next byte aligned position.
+ *
+ * Returns:
+ *      Number of bits skipped as a result of aligning.
+ *
+ */
+int bibByteAlign(bitbuffer_s *bitbuf)
+{
+  int bitpos = bitbuf->bitpos;
+
+  bitbuf->bitpos = bitbuf->bitpos & ~7;
+
+  return (bitpos - bitbuf->bitpos);
+}
+
+
+/*
+ * bibSkipTrailingBits:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Skip the trailing bits at the end of a NAL unit
+ *
+ * Returns:
+ *      The number of bits being skipped or <0 for error.
+ */
+int bibSkipTrailingBits(bitbuffer_s *bitbuf)
+{
+  int ret;
+  int len = 0;
+  int bit = 0;
+
+  bit = bibGetBitFunc(bitbuf);
+  len++;
+
+  ret = bibGetStatus(bitbuf);
+  if (ret < 0)
+    return ret;
+
+  /* First we expect to receive 1 bit */
+  if (bit != 1) {
+    bibRaiseError(bitbuf, BIB_INCORRECT_TRAILING_BIT);
+    return BIB_INCORRECT_TRAILING_BIT;
+  }
+
+  /* Remaining bits in current byte should be zero */
+  while ( bitbuf->bitpos % 8 != 0 ) {  
+    bibGetBit(bitbuf, &bit);
+    len++;
+    if (bit != 0) {
+      bibRaiseError(bitbuf, BIB_INCORRECT_TRAILING_BIT);
+      return BIB_INCORRECT_TRAILING_BIT;
+    }
+  }
+
+  ret = bibGetStatus(bitbuf);
+  if (ret < 0)
+    return ret;
+
+  return len;
+}
+
+
+/*
+ * bibMoreRbspData:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Check if there is more RBSP data in the bitbuffer.
+ *
+ * Returns:
+ *      0: no more rbsp data
+ *      1: more rbsp data
+ */
+int bibMoreRbspData(bitbuffer_s *bitbuf)
+{
+  int numBytesLeft;
+  u_int32 lastBits;
+
+  numBytesLeft = bitbuf->dataLen - bitbuf->bytePos;
+
+  if (numBytesLeft >= 2 || (numBytesLeft*8 + bitbuf->bitpos >= 9))
+    /* If there are at least 9 bits left, it is certain to have more rbsp data */
+    return 1;
+
+  if (numBytesLeft == 0 && bitbuf->bitpos == 0)
+    /* Something may be wrong. Normally, there should be at least one bit left */
+    return 0;
+
+  if (numBytesLeft == 1) {
+    /* Insert last byte to currentBits */
+    bitbuf->currentBits = (bitbuf->currentBits << 8) | bitbuf->data[bitbuf->bytePos++];
+    bitbuf->bitpos += 8;
+  }
+
+  /* Copy the last bits into "lastBits", then compare it with 0x1..00 */
+  lastBits = bitbuf->currentBits & ~(((u_int32)-1)<<bitbuf->bitpos);
+
+  if (lastBits == ((u_int32)1 << (bitbuf->bitpos-1)))
+    return 0;
+  else
+    return 1;
+}
+
+
+/*
+ * bibGetNumOfRemainingBits:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Return number of bits in bitbuffer.
+ *
+ * Returns:
+ *      Number of bits
+ */
+int32 bibGetNumRemainingBits(bitbuffer_s *bitbuf)
+{
+  return bitbuf->bitpos + 8*(bitbuf->dataLen - bitbuf->bytePos);
+}
+
+
+// syncBitBufferBitpos
+// Synchronizes the input bit buffer's bit position to be between one and eight, 
+// modifies the byte position and current bits if required.
+void syncBitBufferBitpos(bitbuffer_s *bitbuf)
+{
+	// To be able to edit the bitbuffer, reset the bit position to be eight at the maximum
+	while (bitbuf->bitpos > 8)
+	{
+		// If bit position is modified, then modify byte position and current bits accordingly
+		bitbuf->bitpos -= 8;
+		bitbuf->bytePos--;
+		bitbuf->currentBits >>= 8;
+	}
+}
+
+
+// addStartCodeEmulationBytes
+// Adds start code emulation bytes to the input bit buffer.
+static int addStartCodeEmulationBytes(bitbuffer_s *bitbuf)
+{
+  	TInt i = 0;
+  	TInt32 lastBytes;
+
+
+  	// Add prevention bytes that were removed for processing
+  	lastBytes = 0xffffffff;
+  	while (i < bitbuf->dataLen) 
+  	{
+    	lastBytes = (lastBytes << 8) | bitbuf->data[i];
+    	
+    	if(((lastBytes & 0xffff) == 0x0000) && ((i+1) < bitbuf->dataLen) && (bitbuf->data[i+1] < 4))
+    	{
+			// Add byte(s) to the bit buffer
+			TInt error = AddBytesToBuffer(bitbuf, 1);
+
+			if (error != 0)
+				return error;
+
+    		// Adjust data length
+    		bitbuf->dataLen++;
+
+    		// Make room for the emulation prevention byte 0x03 to the buffer
+    		for (TInt k=bitbuf->dataLen; k>i; k--)
+    		{
+    			bitbuf->data[k] = bitbuf->data[k-1];
+    		}
+    		
+    		// Add the emulation prevention byte to the buffer
+      		bitbuf->data[i+1] = 0x03;
+    	}
+    	
+    	i++;
+  	}
+	return KErrNone;
+}
+
+
+// bibEnd
+// Takes care of the bit buffer after the frame has been processed.
+int bibEnd(bitbuffer_s *bitbuf)
+{
+#if ENCAPSULATED_NAL_PAYLOAD
+  	return addStartCodeEmulationBytes(bitbuf);
+#endif
+}
+
+
+// addStartCodeEmulationBytesSlice
+// Adds start code emulation bytes to the input bit buffer.
+static void addStartCodeEmulationBytesSlice(bitbuffer_s *bitbuf)
+{
+  	TInt i = 0;
+  	TInt32 lastBytes;
+
+
+  	// Add prevention bytes that were removed for processing
+  	lastBytes = 0xffffffff;
+  	while (i < bitbuf->dataLen) 
+  	{
+    	lastBytes = (lastBytes << 8) | bitbuf->data[i];
+    	
+    	if(((lastBytes & 0xffff) == 0x0000) && ((i+1) < bitbuf->dataLen) && (bitbuf->data[i+1] < 4))
+    	{
+    		// Make room for the emulation prevention byte 0x03 to the buffer
+    		for (TInt k=bitbuf->dataLen; k>i; k--)
+    		{
+    			bitbuf->data[k] = bitbuf->data[k-1];
+    		}
+    		// Adjust data length
+    		bitbuf->dataLen++;
+    		
+    		// Add the emulation prevention byte to the buffer
+      		bitbuf->data[i+1] = 0x03;
+    	}
+    	
+    	i++;
+  	}
+}
+
+
+// bibEndSlice
+// Takes care of the bit buffer after the frame has been processed.
+void bibEndSlice(bitbuffer_s *bitbuf)
+{
+#if ENCAPSULATED_NAL_PAYLOAD
+  	addStartCodeEmulationBytesSlice(bitbuf);
+#endif
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/dpb.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,574 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include <string.h>
+#include "globals.h"
+#include "framebuffer.h"
+#include "dpb.h"
+
+
+
+/*
+ *
+ * dpbOpen:
+ *
+ * Parameters:
+ *
+ * Function:
+ *      Allocate DPB.
+ *
+ * Returns:
+ *      Pointer to dpb or NULL
+ *
+ */
+dpb_s *dpbOpen()
+{
+  dpb_s *dpb;
+
+  dpb = (dpb_s *)User::Alloc(sizeof(dpb_s));
+
+  if (dpb != NULL)
+    memset(dpb, 0, sizeof(dpb_s));
+
+  return dpb;
+}
+
+
+/*
+ *
+ * dpbClose:
+ *
+ * Parameters:
+ *      dpb                   DPB object
+ *
+ * Function:
+ *      Deinitialize DPB.
+ *
+ * Returns:
+ *      -
+ *
+ */
+void dpbClose(dpb_s *dpb)
+{
+  int i;
+
+  for (i = 0; i < DPB_MAX_SIZE; i++)
+    frmCloseRef(dpb->buffers[i]);
+
+  User::Free(dpb);
+}
+
+
+/*
+ *
+ * dpbSetSize:
+ *
+ * Parameters:
+ *      dpb                   DPB object
+ *      dpbSize               New DPB size
+ *
+ * Function:
+ *      Set DPB size in frames.
+ *
+ * Returns:
+ *      -
+ *
+ */
+void dpbSetSize(dpb_s *dpb, int dpbSize)
+{
+  int i;
+
+  /* If new DPB size is smaller than old, close any unneeded frame buffers */
+  for (i = dpbSize; i < dpb->size; i++) {
+    frmCloseRef(dpb->buffers[i]);
+    dpb->buffers[i] = NULL;
+  }
+
+  dpb->size = min(dpbSize, DPB_MAX_SIZE);
+}
+
+
+/*
+ *
+ * dpbGetNextOutputPic:
+ *
+ * Parameters:
+ *      dpb                   DPB object
+ *      dpbHasIDRorMMCO5      Set upon return if IDR picture or picture with
+ *                            MMCO5 command is found in DPB
+ *
+ * Function:
+ *      Find next frame to output (frame with the lowest POC).
+ *      Search is started from the last active frame in dpb and is
+ *      stopped if all frames have been checked or IDR picture or
+ *      picture with MMCO5 is found.
+ *
+ * Returns:
+ *      Framebuffer with the lowest POC or 0 if DPB is empty
+ *
+ */
+frmBuf_s *dpbGetNextOutputPic(dpb_s *dpb, int *dpbHasIDRorMMCO5)
+{
+  frmBuf_s * tmpFrm;
+  int i;
+
+  tmpFrm = 0;
+
+  /* Find first output pic in decoding order */
+  for (i = dpb->fullness-1; i >= 0; i--) {
+    if (dpb->buffers[i]->forOutput) {
+      tmpFrm = dpb->buffers[i];
+      break;
+    }
+  }
+
+  *dpbHasIDRorMMCO5 = 0;
+
+  /* Find picture with lowest poc. Stop search if IDR or MMCO5 is found */
+  for (; i >= 0; i--) {
+    if (dpb->buffers[i]->isIDR || dpb->buffers[i]->hasMMCO5) {
+      *dpbHasIDRorMMCO5 = 1;
+      break;
+    }
+    if (dpb->buffers[i]->forOutput && dpb->buffers[i]->poc < tmpFrm->poc)
+      tmpFrm = dpb->buffers[i];
+  }
+
+  return tmpFrm;
+}
+
+
+/*
+ *
+ * dpbStorePicture:
+ *
+ * Parameters:
+ *      dpb                   DPB object
+ *      currPic               Current picture
+ *      outputQueue           Output queue
+ *
+ * Function:
+ *      - Remove unused frames (non-reference, non-output frames) from the DPB.
+ *      - If there is room in the DPB, put picture to DPB.
+ *      - If there is no room in DPB, put pictures to output queue
+ *        until frame is available.
+ *
+ * Returns:
+ *      The number of pictures in output queue or negative value for error.
+ *
+ */
+int dpbStorePicture(dpb_s *dpb, frmBuf_s *currPic, frmBuf_s *outputQueue[])
+{
+  frmBuf_s *tmpRemList[DPB_MAX_SIZE];
+  frmBuf_s *tmpFrm;
+  int numFrm, numRemFrm;
+  int i;
+  int freeBufferFound;
+  int numOutput;
+  int dpbHasIDRorMMCO5;
+
+  /*
+   * If the current picture is a reference picture and DPB is already full of
+   * reference pictures, we cannot insert current picture to DPB. Therefore,
+   * we force one reference picture out of DPB to make space for current
+   * picture. This situation can only happen with corrupted bitstreams.
+   */
+  if (currPic->refType != FRM_NON_REF_PIC &&
+      (dpb->numShortTermPics+dpb->numLongTermPics) == dpb->size)
+  {
+    if (dpb->numLongTermPics == dpb->size)
+      dpb->buffers[dpb->fullness-1]->refType = FRM_NON_REF_PIC;
+    else
+      dpbMarkLowestShortTermPicAsNonRef(dpb);
+  }
+
+  /*
+   * Remove unused frames from dpb
+   */
+
+  numFrm = 0;
+  numRemFrm = 0;
+  for (i = 0; i < dpb->fullness; i++) {
+    if (dpb->buffers[i]->refType != FRM_NON_REF_PIC || dpb->buffers[i]->forOutput) {
+      dpb->buffers[numFrm] = dpb->buffers[i];
+      numFrm++;
+    }
+    else {
+      /* Put unsused pics to temporary list */
+      tmpRemList[numRemFrm] = dpb->buffers[i];
+      numRemFrm++;
+    }
+  }
+
+  /* Copy unused pics after active pics */
+  for (i = 0; i < numRemFrm; i++)
+    dpb->buffers[numFrm+i] = tmpRemList[i];
+
+  dpb->fullness = numFrm;
+
+
+  /*
+   * Try to store current pic to dpb. If there is no room in dpb, we have to
+   * output some pictures to make room.
+   */
+
+  /* Case 1: if current pic is unused, it won't be stored in dpb */
+  if (currPic->refType == FRM_NON_REF_PIC && !currPic->forOutput) {
+    return 0;
+  }
+
+  /* Case 2: if there is space left in dpb, store current pic */
+  if (dpb->fullness < dpb->size) {
+
+    tmpFrm = dpb->buffers[dpb->fullness];   /* Unused frame */
+
+    tmpFrm = frmMakeRefFrame(currPic, tmpFrm);
+    if (tmpFrm == NULL)
+      return DPB_ERR_MEM_ALLOC;
+
+    /* Move frames one position toward end of the list */
+    for (i = dpb->fullness; i > 0; i--)
+      dpb->buffers[i] = dpb->buffers[i-1];
+
+    /* Always insert new frame to the beginning of the list */
+    dpb->buffers[0] = tmpFrm;
+    dpb->fullness++;
+
+    if (currPic->refType == FRM_SHORT_TERM_PIC)
+      dpb->numShortTermPics++;
+    else if (currPic->refType == FRM_LONG_TERM_PIC)
+      dpb->numLongTermPics++;
+
+    /* Current picture is marked unused */
+    currPic->forOutput = 0;
+    currPic->refType   = FRM_NON_REF_PIC;
+
+    /* No pictures in ouput queue */
+    return 0;
+  }
+
+  /* Case 3: output pictures with bumping process until there is space in dpb or
+  *  current pic is non-reference and has lowest poc */
+  freeBufferFound = 0;
+  numOutput       = 0;
+  while (!freeBufferFound) {
+
+    /* Next picture to output is a picture having smallest POC in DPB */
+    tmpFrm = dpbGetNextOutputPic(dpb, &dpbHasIDRorMMCO5);
+
+    /* Current picture is output if it is non-reference picture having */
+    /* smaller POC than any of the pictures in DPB                     */
+    if (currPic->refType == FRM_NON_REF_PIC &&
+        (tmpFrm == 0 || (!dpbHasIDRorMMCO5 && currPic->poc < tmpFrm->poc)))
+    {
+      /* Output current picture  */
+      currPic->forOutput = 0;
+      outputQueue[numOutput] = currPic;
+      numOutput++;
+      freeBufferFound = 1;
+    }
+    else {
+      /* Output picture that we got from DPB */
+      tmpFrm->forOutput = 0;
+      outputQueue[numOutput] = tmpFrm;
+      numOutput++;
+      if (tmpFrm->refType == FRM_NON_REF_PIC)
+        freeBufferFound = 1;
+    }
+  }
+
+  return numOutput;
+}
+
+
+/*
+ *
+ * dpbUpdatePicNums:
+ *
+ * Parameters:
+ *      dpb                   DPB object
+ *      frameNum              Current picture frame number
+ *      maxFrameNum           Maximum frame number
+ *
+ * Function:
+ *      Compute picture numbers for all pictures in DPB.
+ *
+ * Returns:
+ *      -
+ *
+ */
+void dpbUpdatePicNums(dpb_s *dpb, int32 frameNum, int32 maxFrameNum)
+{
+  int i;
+  frmBuf_s **refPicList;
+
+  refPicList = dpb->buffers;
+
+  for (i = 0; i < dpb->fullness; i++) {
+    if (refPicList[i]->refType == FRM_SHORT_TERM_PIC) {
+      /* Short term pictures */
+      if (refPicList[i]->frameNum > frameNum)
+        refPicList[i]->picNum = refPicList[i]->frameNum - maxFrameNum;
+      else
+        refPicList[i]->picNum = refPicList[i]->frameNum;
+    }
+    else if (refPicList[i]->refType == FRM_LONG_TERM_PIC)
+      /* Long term pictures */
+      refPicList[i]->longTermPicNum = refPicList[i]->longTermFrmIdx;
+  }
+}
+
+
+/*
+ *
+ * dpbMarkAllPicsAsNonRef:
+ *
+ * Parameters:
+ *      dpb                   DPB object
+ *
+ * Function:
+ *      Mark all picrures as non-reference pictures.
+ *
+ * Returns:
+ *      -
+ *
+ */
+void dpbMarkAllPicsAsNonRef(dpb_s *dpb)
+{
+  int i;
+
+  /* Mark all pictures as not used for reference */
+  for (i = 0; i < dpb->fullness; i++)
+    dpb->buffers[i]->refType = FRM_NON_REF_PIC;
+
+  dpb->numShortTermPics = 0;
+  dpb->numLongTermPics  = 0;
+}
+
+
+/*
+ *
+ * dpbMarkLowestShortTermPicAsNonRef:
+ *
+ * Parameters:
+ *      dpb                   DPB object
+ *
+ * Function:
+ *      Mark short-term picture having lowest picture number as
+ *      non-reference pictures.
+ *
+ * Returns:
+ *      -
+ *
+ */
+void dpbMarkLowestShortTermPicAsNonRef(dpb_s *dpb)
+{
+  int picIdx;
+  int i;
+
+  /* Find short term pic with lowest picNum */
+  picIdx = -1;
+  for (i = dpb->fullness-1; i >= 0; i--) {
+    if (dpb->buffers[i]->refType == FRM_SHORT_TERM_PIC &&
+        (picIdx < 0 || dpb->buffers[i]->picNum < dpb->buffers[picIdx]->picNum))
+      picIdx = i;
+  }
+
+  /* Mark short term pic with lowest picNum as not reference picture */
+  if (picIdx >= 0) {
+    dpb->buffers[picIdx]->refType = FRM_NON_REF_PIC;
+    dpb->numShortTermPics--;
+  }
+}
+
+
+/*
+ *
+ * dpbMarkShortTermPicAsNonRef:
+ *
+ * Parameters:
+ *      dpb                   DPB object
+ *      picNum                Picture number
+ *
+ * Function:
+ *      Mark short-term picture having picture number picNum as
+ *      non-reference picture.
+ *
+ * Returns:
+ *      DPB_OK or DPB_ERR_PICTURE_NOT_FOUND
+ *
+ */
+int dpbMarkShortTermPicAsNonRef(dpb_s *dpb, int32 picNum)
+{
+  int i;
+
+  for (i = 0; i < dpb->fullness; i++) {
+    if (dpb->buffers[i]->refType == FRM_SHORT_TERM_PIC &&
+        dpb->buffers[i]->picNum == picNum)
+    {
+      dpb->buffers[i]->refType = FRM_NON_REF_PIC;
+      dpb->numShortTermPics--;
+      return DPB_OK;
+    }
+  }
+
+  return DPB_ERR_PICTURE_NOT_FOUND;
+}
+
+
+/*
+ *
+ * dpbMarkLongTermPicAsNonRef:
+ *
+ * Parameters:
+ *      dpb                   DPB object
+ *      longTermPicNum        Long-term picture number
+ *
+ * Function:
+ *      Mark long-term picture having long-term picture number longTermPicNum
+ *      as non-reference picture.
+ *
+ * Returns:
+ *      DPB_OK or DPB_ERR_PICTURE_NOT_FOUND
+ *
+ */
+int dpbMarkLongTermPicAsNonRef(dpb_s *dpb, int longTermPicNum)
+{
+  int i;
+
+  for (i = 0; i < dpb->fullness; i++) {
+    if (dpb->buffers[i]->refType == FRM_LONG_TERM_PIC &&
+        dpb->buffers[i]->longTermPicNum == longTermPicNum)
+    {
+      dpb->buffers[i]->refType = FRM_NON_REF_PIC;
+      dpb->numLongTermPics--;
+      return DPB_OK;
+    }
+  }
+
+  return DPB_ERR_PICTURE_NOT_FOUND;
+}
+
+
+/*
+ *
+ * dpbVerifyLongTermFrmIdx:
+ *
+ * Parameters:
+ *      dpb                   DPB object
+ *      longTermFrmIdx        Long-term frame index
+ *
+ * Function:
+ *      If there is a long-term picture having long term frame index
+ *      longTermFrmIdx, mark that picture as non-reference picture.
+ *
+ * Returns:
+ *      -
+ *
+ */
+void dpbVerifyLongTermFrmIdx(dpb_s *dpb, int longTermFrmIdx)
+{
+  int i;
+
+  /* Check if longTermFrmIdx is already in use */
+  for (i = 0; i < dpb->fullness; i++) {
+    if (dpb->buffers[i]->refType == FRM_LONG_TERM_PIC &&
+        dpb->buffers[i]->longTermFrmIdx == longTermFrmIdx)
+    {
+      dpb->buffers[i]->refType = FRM_NON_REF_PIC;
+      dpb->numLongTermPics--;
+      break;
+    }
+  }
+}
+
+
+/*
+ *
+ * dpbMarkShortTermPicAsLongTerm:
+ *
+ * Parameters:
+ *      dpb                   DPB object
+ *      picNum                Picture number
+ *      longTermFrmIdx        Long-term frame index
+ *
+ * Function:
+ *      Mark short-term picture having picture number picNum as long-term
+ *      picture having long-term frame index longTermFrmIdx.
+ *
+ * Returns:
+ *      DPB_OK or DPB_ERR_PICTURE_NOT_FOUND
+ *
+ */
+int dpbMarkShortTermPicAsLongTerm(dpb_s *dpb, int32 picNum, int longTermFrmIdx)
+{
+  int i;
+
+  /* To avoid duplicate of longTermFrmIdx */
+  dpbVerifyLongTermFrmIdx(dpb, longTermFrmIdx);
+
+  /* Mark pic with picNum as long term and assign longTermFrmIdx to it */
+  for (i = 0; i < dpb->fullness; i++) {
+    if (dpb->buffers[i]->refType == FRM_SHORT_TERM_PIC &&
+        dpb->buffers[i]->picNum == picNum)
+    {
+      dpb->buffers[i]->refType = FRM_LONG_TERM_PIC;
+      dpb->buffers[i]->longTermFrmIdx = longTermFrmIdx;
+      dpb->numShortTermPics--;
+      dpb->numLongTermPics++;
+      return DPB_OK;
+    }
+  }
+
+  return DPB_ERR_PICTURE_NOT_FOUND;
+}
+
+
+/*
+ *
+ * dpbSetMaxLongTermFrameIdx:
+ *
+ * Parameters:
+ *      dpb                     DPB object
+ *      maxLongTermFrmIdxPlus1  Maximum long-term frame index plus 1
+ *
+ * Function:
+ *      Set maximum long-term frame index. All long-term pictures having
+ *      bigger long-term frame index than maxLongTermFrmIdxPlus1-1 are
+ *      marked as non-reference pictures.
+ *
+ * Returns:
+ *      -
+ *
+ */
+void dpbSetMaxLongTermFrameIdx(dpb_s *dpb, int maxLongTermFrmIdxPlus1)
+{
+  int i;
+
+  for (i = 0; i < dpb->fullness; i++) {
+    if (dpb->buffers[i]->refType == FRM_LONG_TERM_PIC &&
+        dpb->buffers[i]->longTermFrmIdx > maxLongTermFrmIdxPlus1-1)
+    {
+      dpb->buffers[i]->refType = FRM_NON_REF_PIC;
+      dpb->numLongTermPics--;
+    }
+  }
+
+  dpb->maxLongTermFrameIdx = maxLongTermFrmIdxPlus1 - 1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/framebuffer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,289 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include <string.h>
+#include "globals.h"
+#include "framebuffer.h"
+
+/*
+ * Static functions
+ */
+
+static void *allocMem(int blkSize, size_t unitSize);
+
+static frmBuf_s *initRefFrame(frmBuf_s *recoBuf, frmBuf_s *refBuf);
+
+
+
+/*
+ *
+ * allocMem:
+ *
+ * Parameters:
+ *      blkSize               Block size
+ *      unitSize              unit size
+ *
+ * Function:
+ *      Allocate blkSize*unitSize bytes of memory
+ *
+ * Returns:
+ *      Pointer to allocated memory or NULL
+ *
+ */
+static void *allocMem(int blkSize, size_t unitSize)
+{
+  void *mem;
+
+  if ((mem = User::Alloc(blkSize*unitSize)) == NULL) {
+    PRINT((_L("Cannot allocate memory for frame\n")));     
+  }
+
+  return mem;
+}
+
+
+/*
+ *
+ * frmOpen:
+ *
+ * Parameters:
+ *      mbData                Macroblock state buffer
+ *      width                 Width of the frame
+ *      height                Height of the frame
+ *
+ * Function:
+ *      Allocate memory for frame buffer and macroblock state buffer.
+ *
+ * Returns:
+ *      Pointer to allocated frame buffer or NULL
+ *
+ */
+frmBuf_s *frmOpen(mbAttributes_s **mbData, int width, int height)
+{
+//  int numPels = width*height;
+  int numBlksPerLine = width/BLK_SIZE;
+  int numBlocks = numBlksPerLine*height/BLK_SIZE;
+  int numMacroblocks = width/MBK_SIZE*height/MBK_SIZE;
+  frmBuf_s *recoBuf;
+  mbAttributes_s *mbDataTmp;
+
+  if ((recoBuf = (frmBuf_s *)User::Alloc(sizeof(frmBuf_s))) == NULL)
+    return NULL;
+
+  memset(recoBuf, 0, sizeof(frmBuf_s));
+
+  recoBuf->width = width;
+  recoBuf->height = height;
+
+  if ((mbDataTmp = (mbAttributes_s *)User::Alloc(sizeof(mbAttributes_s))) == NULL)
+    return NULL;
+
+  memset(mbDataTmp, 0, sizeof(mbAttributes_s));
+
+  if ((mbDataTmp->sliceMap = (int *)allocMem(numMacroblocks, sizeof(int))) == NULL)
+    return NULL;
+  if ((mbDataTmp->mbTypeTable = (int8 *)allocMem(numMacroblocks, sizeof(int8))) == NULL)
+    return NULL;
+  if ((mbDataTmp->qpTable = (int8 *)allocMem(numMacroblocks, sizeof(int8))) == NULL)
+    return NULL;
+  if ((mbDataTmp->refIdxTable = (int8 *)allocMem(numBlocks, sizeof(int8))) == NULL)
+    return NULL;
+  if ((mbDataTmp->cbpTable = (int *)allocMem(numMacroblocks, sizeof(int))) == NULL)
+    return NULL;
+  if ((mbDataTmp->motVecTable = (motVec_s *)allocMem(numBlocks, sizeof(motVec_s))) == NULL)
+    return NULL;
+  if ((mbDataTmp->ipModesUpPred = (int8 *)allocMem(numBlksPerLine, sizeof(int8))) == NULL)
+    return NULL;
+
+  if ((mbDataTmp->numCoefUpPred[0] = (int8 *)allocMem(numBlksPerLine, sizeof(int8))) == NULL)
+    return NULL;
+  if ((mbDataTmp->numCoefUpPred[1] = (int8 *)allocMem(numBlksPerLine/2, sizeof(int8))) == NULL)
+    return NULL;
+  if ((mbDataTmp->numCoefUpPred[2] = (int8 *)allocMem(numBlksPerLine/2, sizeof(int8))) == NULL)
+    return NULL;
+
+  if ((mbDataTmp->filterModeTab = (int8 *)allocMem(numMacroblocks, sizeof(int8))) == NULL)
+    return NULL;
+  if ((mbDataTmp->alphaOffset = (int8 *)allocMem(numMacroblocks, sizeof(int8))) == NULL)
+    return NULL;
+  if ((mbDataTmp->betaOffset = (int8 *)allocMem(numMacroblocks, sizeof(int8))) == NULL)
+    return NULL;
+
+  *mbData = mbDataTmp;
+
+  return recoBuf;
+}
+
+
+/*
+ *
+ * frmOpenRef:
+ *
+ * Parameters:
+ *      width                 Width of the frame
+ *      height                Height of the frame
+ *
+ * Function:
+ *      Allocate memory for reference frame buffer
+ *
+ * Returns:
+ *      Pointer to Reference frame or NULL
+ *
+ */
+frmBuf_s *frmOpenRef(int width, int height)
+{
+//  int numPels = width*height;
+  frmBuf_s *ref;
+
+  if ((ref = (frmBuf_s *)User::Alloc(sizeof(frmBuf_s))) == NULL)
+    return NULL;
+
+  memset(ref, 0, sizeof(frmBuf_s));
+
+  ref->width      = width;
+  ref->height     = height;
+  ref->imgPadding = 0;
+
+  ref->forOutput = 0;
+  ref->refType = FRM_NON_REF_PIC;
+
+  return ref;
+}
+
+
+/*
+ *
+ * frmClose:
+ *
+ * Parameters:
+ *      frame                 Frame
+ *      mbData                MB state buffers
+ *
+ * Function:
+ *      Deallocate frame buffer and state array memory.
+ *
+ * Returns:
+ *      Nothing
+ *
+ */
+void frmClose(frmBuf_s *recoBuf, mbAttributes_s *mbData)
+{
+  if (!recoBuf)
+    return;
+
+  User::Free(mbData->sliceMap);
+  User::Free(mbData->mbTypeTable);
+  User::Free(mbData->qpTable);
+  User::Free(mbData->refIdxTable);
+  User::Free(mbData->cbpTable);
+  User::Free(mbData->motVecTable);
+  User::Free(mbData->ipModesUpPred);
+  User::Free(mbData->numCoefUpPred[0]);
+  User::Free(mbData->numCoefUpPred[1]);
+  User::Free(mbData->numCoefUpPred[2]);
+  User::Free(mbData->filterModeTab);
+  User::Free(mbData->alphaOffset);
+  User::Free(mbData->betaOffset);
+  User::Free(recoBuf);
+  User::Free(mbData);
+}
+
+
+/*
+ *
+ * frmCloseRef:
+ *
+ * Parameters:
+ *      ref                   Reference frame
+ *
+ * Function:
+ *      Deallocate reference frame buffer memory.
+ *
+ * Returns:
+ *      Nothing
+ *
+ */
+void frmCloseRef(frmBuf_s *ref)
+{
+  if (!ref)
+    return;
+  
+  User::Free(ref);
+}
+
+
+/*
+ *
+ * initRefFrame:
+ *
+ * Parameters:
+ *      recoBuf                Reconstruction frame
+ *      frameBuf               Frame buffer to initialize
+ *
+ * Function:
+ *      Initialize reference frame buffer refBuf using reconstructed buffer
+ *      recoBuf. If width and height of the reference buffer do not those
+ *      of the reconstructed buffer, reference buffer is reallocated.
+ *
+ * Returns:
+ *      Pointer to reference frame
+ *
+ */
+static frmBuf_s *initRefFrame(frmBuf_s *recoBuf, frmBuf_s *refBuf)
+{
+
+  /* If pic size is different, reopen with new size */
+  if (!refBuf || refBuf->width != recoBuf->width || refBuf->height != recoBuf->height) {
+    frmCloseRef(refBuf);
+    if ((refBuf = frmOpenRef(recoBuf->width, recoBuf->height)) == NULL)
+      return NULL;
+  }
+
+  /* Copy variables */
+  *refBuf = *recoBuf;
+
+  return refBuf;
+}
+
+
+/*
+ *
+ * frmMakeRefFrame:
+ *
+ * Parameters:
+ *      recoBuf               Reconstructed frame
+ *      refBuf                Reference frame
+ *
+ * Function:
+ *      Generate reference frame refBuf using reconstructed frame recoBuf.
+ *      Function does not copy pixel data, but it simply swaps pointers.
+ *
+ * Returns:
+ *      Pointer to reference frame
+ *
+ */
+frmBuf_s *frmMakeRefFrame(frmBuf_s *recoBuf, frmBuf_s *refBuf)
+{
+
+  refBuf = initRefFrame(recoBuf, refBuf);
+  if (refBuf == NULL)
+    return NULL;
+
+  return refBuf;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/invtransform.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "globals.h"
+#include "invtransform.h"
+
+
+#ifndef AVC_RECO_BLOCK_ASM
+
+/*
+ *
+ * itrIDCTdequant4x4:
+ *
+ * Parameters:
+ *      src                   Source values
+ *      dest                  Inverse transformed values
+ *      dequantPtr            Dequant coefficients
+ *      qp_per                qp/6
+ *      isDc                  True if DC is separate
+ *      dcValue               Possible DC value
+ *
+ * Function:
+ *      Dequantize coefficients and compute approximate 4x4 inverse DCT.
+ *
+ * Returns:
+ *      -
+ */
+void itrIDCTdequant4x4(int src[4][4], int dest[4][4], const int *dequantPtr,
+                       int qp_per, int isDc, int dcValue)
+{
+  int tmp[4][4];
+  int A, B, C, D, E, F;
+  int i;
+  int deqc;
+
+  /*
+   *  a = A + B + C + (D>>1)
+   *  b = A + (B>>1) - C - D
+   *  c = A - (B>>1) - C + D
+   *  d = A - B + C - (D>>1)
+   *   =>
+   *  E = A + C
+   *  F = B +  (D>>1)
+   *  a = E + F
+   *  d = E - F
+   *  E = A - C
+   *  F = (B>>1) - D
+   *  b = E + F
+   *  c = E - F
+   */
+
+  A = dcValue;
+
+  for (i = 0; i < 4; i++) {
+    deqc = (*dequantPtr++) << qp_per;
+
+    if (!isDc)
+      A = src[i][0] * deqc;
+
+    C = src[i][2] * deqc;
+
+    deqc = (*dequantPtr++) << qp_per;
+
+    B = src[i][1] * deqc;
+    D = src[i][3] * deqc;
+
+    E = A +  C;
+    F = B + (D>>1);
+    tmp[i][0] = E + F;
+    tmp[i][3] = E - F;
+    E =  A     - C;
+    F = (B>>1) - D;
+    tmp[i][1] = E + F;
+    tmp[i][2] = E - F;
+
+    isDc = 0;
+  }
+
+  for (i = 0; i < 4; i++) {
+    E = tmp[0][i] +  tmp[2][i];
+    F = tmp[1][i] + (tmp[3][i]>>1);
+    dest[0][i] = E + F;
+    dest[3][i] = E - F;
+    E =  tmp[0][i]     - tmp[2][i];
+    F = (tmp[1][i]>>1) - tmp[3][i];
+    dest[1][i] = E + F;
+    dest[2][i] = E - F;
+  }
+}
+
+#endif
+
+
+/*
+ *
+ * itrIHadaDequant4x4:
+ *
+ * Parameters:
+ *      src                   Source values
+ *      dest                  Inverse transformed values
+ *      deqc                  Dequantization coefficient
+ *
+ * Function:
+ *      Compute 4x4 inverse Hadamard transform and dequantize coefficients.
+ *
+ * Returns:
+ *      -
+ *
+ */
+void itrIHadaDequant4x4(int src[4][4], int dest[4][4], int deqc)
+{
+  int tmp[4][4];
+  int E;
+  int F;
+  int i;
+
+  for (i = 0; i < 4; i++) {
+    E = src[i][0] + src[i][2];
+    F = src[i][1] + src[i][3];
+    tmp[i][0] = E + F;
+    tmp[i][3] = E - F;
+    E = src[i][0] - src[i][2];
+    F = src[i][1] - src[i][3];
+    tmp[i][1] = E + F;
+    tmp[i][2] = E - F;
+  }
+
+  for (i = 0; i < 4; i++) {
+    E = tmp[0][i] + tmp[2][i];
+    F = tmp[1][i] + tmp[3][i];
+    dest[0][i] = ((E + F) * deqc + 2) >> 2;
+    dest[3][i] = ((E - F) * deqc + 2) >> 2;
+    E = tmp[0][i] - tmp[2][i];
+    F = tmp[1][i] - tmp[3][i];
+    dest[1][i] = ((E + F) * deqc + 2) >> 2;
+    dest[2][i] = ((E - F) * deqc + 2) >> 2;
+  }
+}
+
+
+/*
+ *
+ * itrIDCTdequant2x2:
+ *
+ * Parameters:
+ *      src                   Source values
+ *      dest                  Inverse transformed values
+ *      deqc                  Dequantization coefficient
+ *
+ * Function:
+ *      Compute 2x2 inverse DCT and dequantize coefficients.
+ *
+ * Returns:
+ *      -
+ *
+ */
+void itrIDCTdequant2x2(int src[2][2], int dest[2][2], int deqc)
+{
+  int DDC00 = src[0][0];
+  int DDC10 = src[0][1];
+  int DDC01 = src[1][0];
+  int DDC11 = src[1][1];
+  int A, B;
+
+  /*
+   *  DDC(0,0) DDC(1,0)  =>  DC0 DC1
+   *  DDC(0,1) DDC(1,1)      DC2 DC3
+   *
+   *  DC0 = (DDC00+DDC10+DDC01+DDC11)
+   *  DC1 = (DDC00-DDC10+DDC01-DDC11)
+   *  DC2 = (DDC00+DDC10-DDC01-DDC11)
+   *  DC3 = (DDC00-DDC10-DDC01+DDC11)
+   */
+
+  A = DDC00 + DDC01;
+  B = DDC10 + DDC11;
+  dest[0][0] = ((A + B) * deqc) >> 1;
+  dest[0][1] = ((A - B) * deqc) >> 1;
+  A = DDC00 - DDC01;
+  B = DDC10 - DDC11;
+  dest[1][0] = ((A + B) * deqc) >> 1;
+  dest[1][1] = ((A - B) * deqc) >> 1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/macroblock.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,612 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "globals.h"
+#include "bitbuffer.h"
+#include "macroblock.h"
+#include "motcomp.h"
+#include "framebuffer.h"
+#include "vld.h"
+#include "parameterset.h"
+
+#ifdef USE_CLIPBUF
+#include "clipbuf.h"
+#endif
+
+/*
+ * Static functions
+ */
+
+static int getMacroblock(macroblock_s *mb, int numRefFrames,
+                         int8 *ipTab, int8 **numCoefUpPred, int diffVecs[][2],
+                         int picType, int chromaQpIdx, bitbuffer_s *bitbuf);
+
+static int getMbAvailability(macroblock_s *mb, mbAttributes_s *mbData,
+                             int picWidth, int constrainedIntra);
+
+
+#ifdef USE_CLIPBUF
+const u_int8 *mcpGetClip8Buf()
+{
+  return clip8Buf;
+}
+#endif
+
+/*
+ *
+ * getMacroblock:
+ *
+ * Parameters:
+ *      mb                    Macroblock parameters
+ *      multRef               1 -> multiple reference frames used
+ *      ipTab                 Macroblock intra pred. modes
+ *      numCoefUpPred         Block coefficient counts of upper MBs
+ *      diffVecs              Macroblock delta motion vectors
+ *      picType               Picture type (intra/inter)
+ *      chromaQpIdx           Chroma QP index relative to luma QP
+ *      bitbuf                Bitbuffer handle
+ *
+ * Function:
+ *      Get macroblock parameters from bitbuffer
+ *      
+ * Returns:
+ *      MBK_OK for no error, MBK_ERROR for error
+ *
+ */
+static int getMacroblock(macroblock_s *mb, int numRefFrames,
+                         int8 *ipTab, int8 **numCoefUpPred, int diffVecs[][2],
+                         int picType, int chromaQpIdx, bitbuffer_s *bitbuf)
+{
+  vldMBtype_s hdr;
+  int numVecs;
+  int delta_qp;
+  int i;
+  int8 *numCoefPtrY, *numCoefPtrU, *numCoefPtrV;
+  int retCode;
+
+
+  numCoefPtrY = &numCoefUpPred[0][mb->blkX];
+  numCoefPtrU = &numCoefUpPred[1][mb->blkX>>1];
+  numCoefPtrV = &numCoefUpPred[2][mb->blkX>>1];
+
+  /*
+   * Get Macroblock type
+   */
+
+  /* Check if we have to fetch run indicator */
+  if (IS_SLICE_P(picType) && mb->numSkipped < 0) {
+
+    mb->numSkipped = vldGetRunIndicator(bitbuf);
+
+    if (bibGetStatus(bitbuf) < 0)
+      return MBK_ERROR;
+  }
+
+  if (IS_SLICE_P(picType) && mb->numSkipped > 0) {
+
+    /* If skipped MBs, set MB to COPY */
+    mb->type = MBK_INTER;
+    mb->interMode = MOT_COPY;
+    mb->refNum[0] = 0;
+    mb->cbpY = mb->cbpChromaDC = mb->cbpC = 0;
+    mb->numSkipped -= 1;
+
+    vldGetZeroLumaCoeffs(numCoefPtrY, mb->numCoefLeftPred);
+    vldGetZeroChromaCoeffs(numCoefPtrU, numCoefPtrV, mb->numCoefLeftPredC);
+
+    return MBK_OK;
+  }
+  else {
+
+    if (vldGetMBtype(bitbuf, &hdr, picType) < 0) {
+      PRINT((_L("Error: illegal MB type\n")));     
+      return MBK_ERROR;
+    }
+
+    mb->type        = hdr.type;
+    mb->intraType   = hdr.intraType;
+    mb->intraMode   = hdr.intraMode;
+    mb->interMode   = hdr.interMode;
+
+    for (i = 0; i < 4; i++)
+      mb->inter8x8modes[i] = hdr.inter8x8modes[i];
+
+    mb->cbpY        = hdr.cbpY;
+    mb->cbpChromaDC = hdr.cbpChromaDC;
+    mb->cbpC        = hdr.cbpC;
+
+    mb->numSkipped -= 1;
+  }
+
+  if (mb->type == MBK_INTRA && mb->intraType == MBK_INTRA_TYPE_PCM) {
+    vldGetAllCoeffs(numCoefPtrY, numCoefPtrU, numCoefPtrV,
+                    mb->numCoefLeftPred, mb->numCoefLeftPredC);
+    return MBK_OK;
+  }
+
+  /*
+   * 4x4 intra prediction modes 
+   */
+  if (mb->type == MBK_INTRA && mb->intraType == MBK_INTRA_TYPE1) {
+
+    if (vldGetIntraPred(bitbuf, ipTab) < 0) {
+      PRINT((_L("Error: illegal intra pred\n")));     
+      return MBK_ERROR;
+    }
+  }
+
+  /*
+   * 8x8 chroma intra prediction mode
+   */
+  if (mb->type == MBK_INTRA) {
+
+    mb->intraModeChroma = vldGetChromaIntraPred(bitbuf);
+
+    if (mb->intraModeChroma < 0) {
+      PRINT((_L("Error: illegal chroma intra pred\n")));     
+      return MBK_ERROR;
+    }
+  }
+
+  /*
+   * Reference frame number and motion vectors
+   */
+  if (mb->type == MBK_INTER) {
+
+    numVecs = mcpGetNumMotVecs(mb->interMode, mb->inter8x8modes);
+    mb->numMotVecs = numVecs;
+
+    retCode = vldGetMotVecs(bitbuf, mb->interMode, numRefFrames,
+                            mb->refNum, diffVecs, numVecs);
+
+    if (retCode < 0) {
+      PRINT((_L("Error: illegal motion vectors\n")));     
+      return MBK_ERROR;
+    }
+  }
+
+  /*
+   * Coded block pattern
+   */
+  if (!(mb->type == MBK_INTRA && mb->intraType == MBK_INTRA_TYPE2)) {
+
+    retCode = vldGetCBP(bitbuf, mb->type, &mb->cbpY, &mb->cbpChromaDC, &mb->cbpC);
+
+    if (retCode < 0) {
+      PRINT((_L("Error: illegal CBP\n")));     
+      return MBK_ERROR;
+    }
+  }
+
+
+  /* Delta QP */
+  if ((mb->type == MBK_INTRA && mb->intraType == MBK_INTRA_TYPE2) || 
+      (mb->cbpY | mb->cbpChromaDC | mb->cbpC) != 0)
+  {
+    retCode = vldGetDeltaqp(bitbuf, &delta_qp);
+
+    if (retCode < 0 || delta_qp < -(MAX_QP-MIN_QP+1)/2 || delta_qp >= (MAX_QP-MIN_QP+1)/2) {
+      PRINT((_L("Error: illegal delta qp\n")));     
+      return MBK_ERROR;
+    }
+
+    if (delta_qp != 0) {
+      int qp = mb->qp + delta_qp;
+      if (qp < MIN_QP)
+        qp += (MAX_QP-MIN_QP+1);
+      if (qp > MAX_QP)
+        qp -= (MAX_QP-MIN_QP+1);
+      mb->qp = qp;
+      mb->qpC = qpChroma[clip(MIN_QP, MAX_QP, mb->qp + chromaQpIdx)];
+    }
+  }
+
+
+  /*
+   * Get transform coefficients
+   */
+
+  /*
+   * Luma DC coefficients (if 16x16 intra)
+   */
+  if (mb->type == MBK_INTRA && mb->intraType == MBK_INTRA_TYPE2) {
+
+    retCode = vldGetLumaDCcoeffs(bitbuf, mb->dcCoefY, numCoefPtrY,
+                             mb->numCoefLeftPred, mb->mbAvailBits);
+    if (retCode < 0) {
+      PRINT((_L("Error: illegal luma DC coefficient\n")));     
+      return MBK_ERROR;
+    }
+  }
+
+  /*
+   * Luma AC coefficients
+   */
+  if (mb->cbpY != 0) {
+
+    retCode = vldGetLumaCoeffs(bitbuf, mb->type, mb->intraType, &mb->cbpY,
+                               mb->coefY, numCoefPtrY, mb->numCoefLeftPred,
+                               mb->mbAvailBits);
+    if (retCode < 0) {
+      PRINT((_L("Error: illegal luma AC coefficient\n")));     
+      return MBK_ERROR;
+    } 
+  }
+  else
+    vldGetZeroLumaCoeffs(numCoefPtrY, mb->numCoefLeftPred);
+
+  /*
+   * Chroma DC coefficients
+   */
+  if (mb->cbpChromaDC != 0) {
+
+    retCode = vldGetChromaDCcoeffs(bitbuf, mb->dcCoefC, &mb->cbpChromaDC);
+
+    if (retCode < 0) {
+      PRINT((_L("Error: illegal chroma DC coefficient\n")));     
+      return MBK_ERROR;
+    }
+  }
+
+  /*
+   * Chroma AC coefficients
+   */
+  if (mb->cbpC != 0) {
+
+    retCode = vldGetChromaCoeffs(bitbuf, mb->coefC, &mb->cbpC, numCoefPtrU, numCoefPtrV,
+                             mb->numCoefLeftPredC[0], mb->numCoefLeftPredC[1], mb->mbAvailBits);
+    if (retCode < 0) {
+      PRINT((_L("Error: illegal chroma AC coefficient\n")));     
+      return MBK_ERROR;
+    }
+  }
+  else {
+    vldGetZeroChromaCoeffs(numCoefPtrU, numCoefPtrV, mb->numCoefLeftPredC);
+  }
+
+  return MBK_OK;
+}
+
+
+/*
+ *
+ * mbkSetInitialQP:
+ *
+ * Parameters:
+ *      mb                    Macroblock object
+ *      qp                    Quantization parameter
+ *      chromaQpIdx           Chroma QP index relative to luma QP
+ *
+ * Function:
+ *      Set macroblock qp.
+ *      
+ * Returns:
+ *      -
+ *
+ */
+void mbkSetInitialQP(macroblock_s *mb, int qp, int chromaQpIdx)
+{
+  mb->qp  = qp;
+  mb->qpC = qpChroma[clip(MIN_QP, MAX_QP, qp + chromaQpIdx)];
+
+  mb->numSkipped = -1;
+}
+
+
+/*
+ *
+ * getMbAvailability:
+ *
+ * Parameters:
+ *      mb                    Macroblock object
+ *      mbData                Buffers for for macroblock attributes
+ *      picWidth              Picture width
+ *      constrainedIntra      Constrained intra prediction flag
+ *
+ * Function:
+ *      Get neighboring macroblock availability info
+ *      
+ * Returns:
+ *      Macroblock availability bits:
+ *        bit 0 : left macroblock
+ *        bit 1 : upper macroblock
+ *        bit 2 : upper-right macroblock
+ *        bit 3 : upper-left macroblock
+ *        bit 4 : left macroblock (intra)
+ *        bit 5 : upper macroblock (intra)
+ *        bit 6 : upper-right macroblock (intra)
+ *        bit 7 : upper-left macroblock (intra)
+ */
+static int getMbAvailability(macroblock_s *mb, mbAttributes_s *mbData,
+                             int picWidth, int constrainedIntra)
+{
+  int mbsPerLine;
+  int mbAddr;
+  int currSliceIdx;
+  int *sliceMap;
+  int8 *mbTypeTable;
+  int mbAvailBits;
+
+  mbsPerLine = picWidth/MBK_SIZE;
+  mbAddr = mb->idxY*mbsPerLine+mb->idxX;
+
+  sliceMap = & mbData->sliceMap[mbAddr];
+  currSliceIdx = sliceMap[0];
+
+  mbAvailBits = 0;
+
+  /* Check availability of left macroblock */
+  if (mb->idxX > 0 && sliceMap[-1] == currSliceIdx)
+    mbAvailBits |= 0x11;
+
+  /* Check availability of upper, upper-left and upper-right macroblocks */
+
+  if (mb->idxY > 0) {
+
+    sliceMap -= mbsPerLine;
+
+    /* Check availability of upper macroblock */
+    if (sliceMap[0] == currSliceIdx)
+      mbAvailBits |= 0x22;
+
+    /* Check availability of upper-right macroblock */
+    if (mb->idxX+1 < mbsPerLine && sliceMap[1] == currSliceIdx)
+      mbAvailBits |= 0x44;
+
+    /* Check availability of upper-left macroblock */
+    if (mb->idxX > 0 && sliceMap[-1] == currSliceIdx)
+      mbAvailBits |= 0x88;
+  }
+
+
+  /*
+   * Check availability of intra MB if constrained intra is enabled
+   */
+
+  if (constrainedIntra) {
+
+     mbTypeTable = & mbData->mbTypeTable[mbAddr];
+
+    /* Check availability of left intra macroblock */
+    if ((mbAvailBits & 0x10) && mbTypeTable[-1] != MBK_INTRA)
+      mbAvailBits &= ~0x10;
+
+    /* Check availability of upper, upper-left and upper-right intra macroblocks */
+
+    if (mbAvailBits & (0x20|0x40|0x80)) {
+
+      mbTypeTable -= mbsPerLine;
+
+      /* Check availability of upper intra macroblock */
+      if ((mbAvailBits & 0x20) && mbTypeTable[0] != MBK_INTRA)
+        mbAvailBits &= ~0x20;
+
+      /* Check availability of upper-right intra macroblock */
+      if ((mbAvailBits & 0x40) && mbTypeTable[1] != MBK_INTRA)
+        mbAvailBits &= ~0x40;
+
+      /* Check availability of upper-left intra macroblock */
+      if ((mbAvailBits & 0x80) && mbTypeTable[-1] != MBK_INTRA)
+        mbAvailBits &= ~0x80;
+    }
+  }
+
+  return mbAvailBits;
+}
+
+
+// mbkParse
+// Parses the input macroblock. If PCM coding is used then re-aligns the byte 
+// alignment if previous (slice header) modifications have broken the alignment.
+TInt mbkParse(macroblock_s *mb, TInt numRefFrames, mbAttributes_s *mbData, 
+			  TInt picWidth, TInt picType, TInt constIpred, TInt chromaQpIdx,
+              TInt mbIdxX, TInt mbIdxY, void *streamBuf, TInt aBitOffset)
+{
+  	TInt8 ipTab[BLK_PER_MB*BLK_PER_MB];
+  	TInt diffVecs[BLK_PER_MB*BLK_PER_MB][2];
+//  	TInt hasDc;
+//  	TInt pixOffset;
+  	TInt constrainedIntra;
+  	TInt copyMbFlag;
+  	TInt mbAddr;
+  	TInt pcmMbFlag;
+  	TInt retCode;
+
+  	mb->idxX = mbIdxX;
+  	mb->idxY = mbIdxY;
+
+  	mb->blkX = mbIdxX*BLK_PER_MB;
+  	mb->blkY = mbIdxY*BLK_PER_MB;
+
+  	mb->pixX = mbIdxX*MBK_SIZE;
+  	mb->pixY = mbIdxY*MBK_SIZE;
+
+  	mbAddr = mb->idxY*(picWidth/MBK_SIZE)+mb->idxX;
+
+  	copyMbFlag = pcmMbFlag = 0;
+
+  	constrainedIntra = constIpred && !(IS_SLICE_I(picType));
+
+  	mb->mbAvailBits = getMbAvailability(mb, mbData, picWidth, constrainedIntra);
+
+  	// Read macroblock bits
+    retCode = getMacroblock(mb, numRefFrames, ipTab, mbData->numCoefUpPred, diffVecs,
+                            picType, chromaQpIdx, (bitbuffer_s *)streamBuf);
+
+  	if (retCode < 0)
+	    return retCode;
+
+  	// Set PCM flag 
+  	if (mb->type == MBK_INTRA && mb->intraType == MBK_INTRA_TYPE_PCM)
+	    pcmMbFlag = 1;
+
+
+  	// Get intra/inter prediction
+  	if (mb->type == MBK_INTRA) 
+  	{
+    	mbData->mbTypeTable[mbAddr] = MBK_INTRA;
+
+    	if (pcmMbFlag) 
+    	{
+    		bitbuffer_s* tempBitBuffer = (bitbuffer_s *)streamBuf;
+    		
+    		// Synchronize bitbuffer bit position to get it between 1 and 8
+			syncBitBufferBitpos(tempBitBuffer);
+	
+   			// To find out how much we have to shift to reach the byte alignment again,
+   			// we have to first find out the old alignment
+   			// oldAlignment is the place of the bitpos before the aBitOffset, i.e. it is
+   			// the amount of zero alignment bits plus one
+   			TInt oldAlignmentBits = tempBitBuffer->bitpos + aBitOffset - 1;
+   			TInt shiftAmount;
+	   			
+   		
+   			// If Bit-wise shift, i.e. aBitOffset is zero, do nothing
+    		// Fix the possible bit buffer byte alignment
+    		if (aBitOffset > 0)
+    		{
+    		
+    			// aBitOffset > 0 indicates a bitshift to the right
+    			
+    			// To counter the shift to right we have to shift left by the same amount 
+    			// unless shift is larger than the number of original alignment bits in 
+    			// which case we have to shift more to the right 
+     			
+	   			// If the computed old alignment bits value is larger than eight, 
+	   			//the correct value is (computed value) % 8
+	   			oldAlignmentBits = oldAlignmentBits % 8;
+
+    			if ( oldAlignmentBits < aBitOffset )
+    			{
+    				// When the amount of shift is larger than the number of original alignment bits,
+    				// shift right to fill up the rest of the current byte with zeros
+    				shiftAmount = 8 - aBitOffset;
+
+   					// Here we can't shift back left since there were not enough alignment bits originally, 
+   					// thus we have to shift right by new bit position - tempBitBuffer->bitpos
+
+   					// E.g. original alignment bits 2, right shift by 4 bits:
+   					/////////////////////////////////////////////////////////////////
+					// original             after bit shift      byte alignment reset
+					// 1. byte: 2. byte:    1. byte: 2. byte:    1. byte: 2. byte: 3. byte:
+					// xxxxxx00 yyyyyyyy -> xxxxxxxx xx00yyyy -> xxxxxxxx xx000000 yyyyyyyy
+   					/////////////////////////////////////////////////////////////////
+   					ShiftBitBufferBitsRight(tempBitBuffer, shiftAmount);
+    			}
+    			else
+    			{
+   					// In this case, the old alignment bits are more than enough 
+   					// to shift back left by the aBitOffset amount
+   					
+   					// E.g. original alignment bits 4, right shift by 2 bits:
+   					/////////////////////////////////////////////////////////////////
+					// original             after bit shift      byte alignment reset
+   					// 1. byte: 2. byte:    1. byte: 2. byte:    1. byte: 2. byte:
+   					// xxxx0000 yyyyyyyy -> xxxxxx00 00yyyyyy -> xxxxxx00 yyyyyyyy
+   					/////////////////////////////////////////////////////////////////
+   					ShiftBitBufferBitsLeft(tempBitBuffer, aBitOffset);
+    			}
+    		}
+    		else if(aBitOffset < 0)
+    		{
+    			// There was a bit shift to left
+    			// Change the aBitOffset sign to positive
+    			aBitOffset = -aBitOffset;
+    		
+				// If the computed alignment bits is negative the correct value is -(computed value)
+				if ( oldAlignmentBits < 0 )
+				{
+					oldAlignmentBits = -oldAlignmentBits;
+				}
+    			
+    			if ( oldAlignmentBits + aBitOffset >= 8 )
+    			{
+					// When old alignment bits plus the shift are at least 8, then 
+					// we have to shift left by the 8 - shift to reach byte alignment. 
+	    			shiftAmount = 8 - aBitOffset;
+
+   					// E.g. original alignment bits 6, left shift by 4 bits:
+   					/////////////////////////////////////////////////////////////////
+					// original             after bit shift      byte alignment reset
+					// 1. byte: 2. byte:    1. byte: 2. byte:    1. byte: 2. byte: 
+					// xx000000 yyyyyyyy -> xxxxxx00 0000yyyy -> xxxxxx00 yyyyyyyy 
+   					/////////////////////////////////////////////////////////////////
+   					ShiftBitBufferBitsLeft(tempBitBuffer, shiftAmount);
+    			}
+    			else
+    			{
+
+   					// Here we can just shift right by the amount of bits shifted left to reach 
+   					// the byte alignment
+
+   					// E.g. original alignment bits 2, left shift by 4 bits:
+   					/////////////////////////////////////////////////////////////////
+					// original             after bit shift      byte alignment reset
+					// 1. byte: 2. byte:    1. byte: 2. byte:    1. byte: 2. byte: 
+					// xxxxxx00 yyyyyyyy -> xx00yyyy yyyyyyyy -> xx000000 yyyyyyyy 
+   					/////////////////////////////////////////////////////////////////
+   					ShiftBitBufferBitsRight(tempBitBuffer, aBitOffset);
+    			}
+    		}
+    	
+    		return MBK_PCM_FOUND;
+    	
+    	}
+  	}
+  	else 
+  	{
+
+    	mbData->mbTypeTable[mbAddr] = (TInt8)(mb->interMode+1);
+
+    	// If COPY MB, put skip motion vectors 
+    	if (mb->interMode == MOT_COPY) 
+    	{
+      		mb->interMode = MOT_16x16;
+    	}
+
+  	}
+
+
+  	// Decode prediction error & reconstruct MB
+  	if (!copyMbFlag && !pcmMbFlag) 
+  	{
+
+    	// If 4x4 intra mode, luma prediction error is already transformed 
+    	if (!(mb->type == MBK_INTRA && mb->intraType == MBK_INTRA_TYPE1)) 
+    	{
+
+//      		hasDc = (mb->type == MBK_INTRA && mb->intraType == MBK_INTRA_TYPE2) ? 1 : 0;
+
+    	}
+
+//    	pixOffset = ((mb->pixY*picWidth)>>2)+(mb->pixX>>1);
+  	}
+
+
+  	// Store qp and coded block pattern for current macroblock
+	if (pcmMbFlag)
+	    mbData->qpTable[mbAddr] = 0;
+  	else
+    	mbData->qpTable[mbAddr] = (TInt8)mb->qp;
+
+  	mbData->cbpTable[mbAddr] = mb->cbpY;
+
+  	return MBK_OK;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/motcomp.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifdef CHECK_MV_RANGE
+#include <stdio.h>
+#endif
+
+#include "globals.h"
+#include "motcomp.h"
+#include "framebuffer.h"
+
+#if defined(USE_CLIPBUF) && !defined(AVC_MOTION_COMP_ASM)
+#include "clipbuf.h"
+#endif
+
+
+#define ONEFOURTH1  20
+#define ONEFOURTH2  -5
+#define ONEFOURTH3  1
+
+
+static const int numModeMotVecs[MOT_NUM_MODES+1] = {
+  0, 1, 2, 2, 4, 8, 8, 16
+};
+
+static const int numModeMotVecs8x8[4] = {
+  1, 2, 2, 4
+};
+
+/*
+static const int blockShapes[][2] = {
+  {4, 4},
+  {4, 2},
+  {2, 4},
+  {2, 2}
+};
+
+static const int blockShapes8x8[][2] = {
+  {2, 2},
+  {2, 1},
+  {1, 2},
+  {1, 1}
+};
+*/
+
+
+#ifdef CHECK_MV_RANGE
+extern int maxVerticalMvRange;
+#endif
+
+
+/*
+ *
+ * mcpGetNumMotVecs:
+ *
+ * Parameters:
+ *      mode                  MB partition type (16x16, 8x16, 16x8, 8x8)
+ *      subMbTypes            Sub-MB partition types (8x8, 4x8, 8x4, 4x4)
+ *
+ * Function:
+ *      Get the number of motion vectors that need to be decoded for given
+ *      MB type and Sub-MB partition types.
+ *      
+ * Returns:
+ *      Number of motion vectors.
+ *
+ */
+int mcpGetNumMotVecs(int interMode, int subMbTypes[4])
+{
+  int numVecs;
+
+  if (interMode < MOT_8x8)
+    numVecs = numModeMotVecs[interMode];
+  else {
+    numVecs  = numModeMotVecs8x8[subMbTypes[0]];
+    numVecs += numModeMotVecs8x8[subMbTypes[1]];
+    numVecs += numModeMotVecs8x8[subMbTypes[2]];
+    numVecs += numModeMotVecs8x8[subMbTypes[3]];
+  }
+
+  return numVecs;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/parameterset.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,2403 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include <string.h>
+#include "globals.h"
+#include "vld.h"
+#include "parameterset.h"
+
+
+#define MIN_CHROMA_QP_INDEX           -12
+#define MAX_CHROMA_QP_INDEX            12
+#define NUM_LEVELS                     16     /* The number of AVC levels */
+#define MAX_PIC_SIZE_IN_MBS            36864
+#define MAX_PIC_WIDTH_IN_MBS           543    /* Sqrt( MAX_PIC_SIZE_IN_MBS * 8 ) */
+#define MAX_PIC_HEIGHT_IN_MBS          543    /* Sqrt( MAX_PIC_SIZE_IN_MBS * 8 ) */
+
+
+/* These fields are defined in Annex A of the standard */
+typedef struct _level_s 
+{
+  int8 levelNumber;
+  int8 constraintSet3flag;
+  int32 maxMBPS;
+  int32 maxFS;
+  int32 maxDPB;
+  int32 maxBR;
+  int32 maxCPB;
+  int16 maxVmvR;
+  int8 minCR;
+  int8 maxMvsPer2Mb;
+} level_s;
+
+/* Parameters for all levels */
+static const level_s levelArray[NUM_LEVELS] = {
+  {10, 0,   1485,    99,   152064,     64,    175,  64, 2, 32},
+  {11, 1,   1485,    99,   152064,    128,    350,  64, 2, 32}, /* level 1b */
+  {11, 0,   3000,   396,   345600,    192,    500, 128, 2, 32},
+  {12, 0,   6000,   396,   912384,    384,   1000, 128, 2, 32},
+  {13, 0,  11880,   396,   912384,    768,   2000, 128, 2, 32},
+  {20, 0,  11880,   396,   912384,   2000,   2000, 128, 2, 32},
+  {21, 0,  19800,   792,  1824768,   4000,   4000, 256, 2, 32},
+  {22, 0,  20250,  1620,  3110400,   4000,   4000, 256, 2, 32},
+  {30, 0,  40500,  1620,  3110400,  10000,  10000, 256, 2, 32},
+  {31, 0, 108000,  3600,  6912000,  14000,  14000, 512, 4, 16},
+  {32, 0, 216000,  5120,  7864320,  20000,  20000, 512, 4, 16},
+  {40, 0, 245760,  8192, 12582912,  20000,  25000, 512, 4, 16},
+  {41, 0, 245760,  8192, 12582912,  50000,  62500, 512, 2, 16},
+  {42, 0, 491520,  8192, 12582912,  50000,  62500, 512, 2, 16},
+  {50, 0, 589824, 22080, 42393600, 135000, 135000, 512, 2, 16},
+  {51, 0, 983040, 36864, 70778880, 240000, 240000, 512, 2, 16}
+};
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+
+struct aspectRatio_s 
+{
+  int width;
+  int height;
+};
+
+static const struct aspectRatio_s aspectRatioArr[13] = 
+{
+  {  1,  1},
+  { 12, 11},
+  { 10, 11},
+  { 16, 11},
+  { 40, 33},
+  { 24, 11},
+  { 20, 11},
+  { 32, 11},
+  { 80, 33},
+  { 18, 11},
+  { 15, 11},
+  { 64, 33},
+  {160, 99}
+};
+#endif  // VIDEOEDITORENGINE_AVC_EDITING
+
+/*
+ * AVC syntax functions as specified in specification
+ */
+
+/* Return fixed length code */
+static int u_n(bitbuffer_s *bitbuf, int len, unsigned int *val)
+{
+  *val = vldGetFLC(bitbuf, len);
+
+  if (bibGetStatus(bitbuf) < 0)
+    return PS_ERROR;
+
+  return PS_OK;
+}
+
+/* Return unsigned UVLC code */
+static int ue_v(bitbuffer_s *bitbuf, unsigned int *val, unsigned int maxVal)
+{
+  *val = vldGetUVLC(bitbuf);
+
+  if (bibGetStatus(bitbuf) < 0)
+    return PS_ERROR;
+
+  if (*val > maxVal)
+    return PS_ERR_ILLEGAL_VALUE;
+
+  return PS_OK;
+}
+
+/* Return long signed UVLC code */
+static int se_v_long(bitbuffer_s *bitbuf, int32 *val)
+{
+  *val = vldGetSignedUVLClong(bitbuf);
+
+  if (bibGetStatus(bitbuf) < 0)
+    return PS_ERROR;
+
+  return PS_OK;
+}
+
+/* Return long unsigned UVLC code */
+static int ue_v_long(bitbuffer_s *bitbuf, u_int32 *val, u_int32 maxVal)
+{
+  *val = vldGetUVLClong(bitbuf);
+
+  if (bibGetStatus(bitbuf) < 0)
+    return PS_ERROR;
+
+  if (*val > maxVal)
+    return PS_ERR_ILLEGAL_VALUE;
+
+  return PS_OK;
+}
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+
+/* Return signed UVLC code */
+static int se_v(bitbuffer_s *bitbuf, int *val, int minVal, int maxVal)
+{
+  *val = vldGetSignedUVLC(bitbuf);
+
+  if (bibGetStatus(bitbuf) < 0)
+    return PS_ERROR;
+
+  if (*val < minVal || *val > maxVal)
+    return PS_ERR_ILLEGAL_VALUE;
+
+  return PS_OK;
+}
+
+#endif  // VIDEOEDITORENGINE_AVC_EDITING
+
+
+/*
+ * getLevel:
+ *
+ * Parameters:
+ *      levelNumber
+ *      constraintSet3flag
+ *
+ * Function:
+ *      Return parameters for level based on level number.
+ *
+ *  Return:
+ *      Pointer to level or 0 if level does not exist
+ */
+static const level_s *getLevel(int levelNumber, int constraintSet3flag)
+{
+  int i;
+
+  for (i = 0; i < NUM_LEVELS; i++) {
+    if (levelArray[i].levelNumber == levelNumber &&
+        levelArray[i].constraintSet3flag == constraintSet3flag)
+      return &levelArray[i];
+  }
+
+  PRINT((_L("Unknown level: %i.\n"), levelNumber));            
+  return 0;
+}
+
+/*
+ *
+ * getHrdParameters:
+ *
+ * Parameters:
+ *      bitbuf                The bitbuffer object
+ *      hrd                   the pointer for returning HRD parameters
+ *
+ * Function:
+ *      decode the HRD Parameters
+ *
+ * Returns:
+ *      PS_OK:                Hrd parameters decoded succesfully
+ *      <0:                   Fail
+ */
+static int getHrdParameters(bitbuffer_s *bitbuf, hrd_parameters_s *hrd)
+{
+  unsigned int i;
+  int retCode;
+
+  if ((retCode = ue_v(bitbuf, &hrd->cpb_cnt_minus1, 31)) < 0)
+    return retCode;
+
+  if ((retCode = u_n(bitbuf, 4, &hrd->bit_rate_scale)) < 0)
+    return retCode;
+
+  if ((retCode = u_n(bitbuf, 4, &hrd->cpb_size_scale)) < 0)
+    return retCode;
+
+  for (i = 0; i <= hrd->cpb_cnt_minus1; i++) {
+    /* bit_rate_value_minus1 must be in range of 0 to 2^32-2 */
+    if ((retCode = ue_v_long(bitbuf, &hrd->bit_rate_value_minus1[i], (u_int32)4294967294U)) < 0)
+      return retCode;
+
+    /* cpb_size_value_minus1 must be in range of 0 to 2^32-2 */
+    if ((retCode = ue_v_long(bitbuf, &hrd->cpb_size_value_minus1[i], (u_int32)4294967294U)) < 0)
+      return retCode;
+
+    if ((retCode = u_n(bitbuf, 1, &hrd->cbr_flag[i])) < 0)
+      return retCode;
+  }
+
+  if ((retCode = u_n(bitbuf, 5, &hrd->initial_cpb_removal_delay_length_minus1)) < 0)
+    return retCode;
+
+  if ((retCode = u_n(bitbuf, 5, &hrd->cpb_removal_delay_length_minus1)) < 0)
+    return retCode;
+
+  if ((retCode = u_n(bitbuf, 5, &hrd->dpb_output_delay_length_minus1)) < 0)
+    return retCode;
+
+  if ((retCode = u_n(bitbuf, 5, &hrd->time_offset_length)) < 0)
+    return retCode;
+
+  return PS_OK;
+}
+
+
+
+/*
+ *
+ * getVUI:
+ *
+ * Parameters:
+ *      bitbuf                The bitbuffer object
+ *      vui                   the pointer for returning VUI parameters
+ *
+ * Function:
+ *      decode the VUI Parameters
+ *
+ * Returns:
+ *      PS_OK:                VUI parameters decoded succesfully
+ *      <0:                   Fail
+ */
+static int getVUI(bitbuffer_s *bitbuf, vui_parameters_s *vui)
+{
+  unsigned tempWordHi, tempWordLo;
+  int retCode;
+
+  if ((retCode = u_n(bitbuf, 1, &vui->aspect_ratio_info_present_flag)) < 0)
+    return retCode;
+
+  if (vui->aspect_ratio_info_present_flag) {
+    if ((retCode = u_n(bitbuf, 8, &vui->aspect_ratio_idc)) < 0)
+      return retCode;
+    if (vui->aspect_ratio_idc == PS_EXTENDED_SAR) {
+      if ((retCode = u_n(bitbuf, 16, &vui->sar_width)) < 0)
+        return retCode;
+      if ((retCode = u_n(bitbuf, 16, &vui->sar_height)) < 0)
+        return retCode;
+    }
+  }
+
+  if ((retCode = u_n(bitbuf, 1, &vui->overscan_info_present_flag)) < 0)
+    return retCode;
+
+  if (vui->overscan_info_present_flag) {
+    if ((retCode = u_n(bitbuf, 1, &vui->overscan_appropriate_flag)) < 0)
+      return retCode;
+  }
+
+  if ((retCode = u_n(bitbuf, 1, &vui->video_signal_type_present_flag)) < 0)
+    return retCode;
+
+  if (vui->video_signal_type_present_flag) {
+    if ((retCode = u_n(bitbuf, 3, &vui->video_format)) < 0)
+      return retCode;
+    if ((retCode = u_n(bitbuf, 1, &vui->video_full_range_flag)) < 0)
+      return retCode;
+    if ((retCode = u_n(bitbuf, 1, &vui->colour_description_present_flag)) < 0)
+      return retCode;
+    if (vui->colour_description_present_flag) {
+      if ((retCode = u_n(bitbuf, 8, &vui->colour_primaries)) < 0)
+        return retCode;
+      if ((retCode = u_n(bitbuf, 8, &vui->transfer_characteristics)) < 0)
+        return retCode;
+      if ((retCode = u_n(bitbuf, 8, &vui->matrix_coefficients)) < 0)
+        return retCode;
+    }
+  }
+
+  if ((retCode = u_n(bitbuf, 1, &vui->chroma_loc_info_present_flag)) < 0)
+    return retCode;
+
+  if (vui->chroma_loc_info_present_flag) {
+    if ((retCode = ue_v(bitbuf, &vui->chroma_sample_loc_type_top_field, 5)) < 0)
+      return retCode;
+    if ((retCode = ue_v(bitbuf, &vui->chroma_sample_loc_type_bottom_field, 5)) < 0)
+      return retCode;
+  }
+
+  if ((retCode = u_n(bitbuf, 1, &vui->timing_info_present_flag)) < 0)
+    return retCode;
+
+  if (vui->timing_info_present_flag) {
+    if ((retCode = u_n(bitbuf, 16, &tempWordHi)) < 0)
+      return retCode;
+    if ((retCode = u_n(bitbuf, 16, &tempWordLo)) < 0)
+      return retCode;
+    vui->num_units_in_tick = (((u_int32)tempWordHi) << 16) | ((u_int32)tempWordLo);
+
+    if ((retCode = u_n(bitbuf, 16, &tempWordHi)) < 0)
+      return retCode;
+    if ((retCode = u_n(bitbuf, 16, &tempWordLo)) < 0)
+      return retCode;
+    vui->time_scale = (((u_int32)tempWordHi) << 16) | ((u_int32)tempWordLo);
+
+    if ((retCode = u_n(bitbuf, 1, &vui->fixed_frame_rate_flag)) < 0)
+      return retCode;
+  }
+
+  if ((retCode = u_n(bitbuf, 1, &vui->nal_hrd_parameters_present_flag)) < 0)
+    return retCode;
+
+  if (vui->nal_hrd_parameters_present_flag) {
+    if ((retCode = getHrdParameters(bitbuf, &vui->nal_hrd_parameters)) < 0)
+      return retCode;
+  }
+
+  if ((retCode = u_n(bitbuf, 1, &vui->vcl_hrd_parameters_present_flag)) < 0)
+    return retCode;
+
+  if (vui->vcl_hrd_parameters_present_flag) {
+    if ((retCode = getHrdParameters(bitbuf, &vui->vcl_hrd_parameters)) < 0)
+      return retCode;
+  }
+
+  if (vui->nal_hrd_parameters_present_flag || vui->vcl_hrd_parameters_present_flag) {
+    if ((retCode = u_n(bitbuf, 1, &vui->low_delay_hrd_flag)) < 0)
+      return retCode;
+  }
+
+  if ((retCode = u_n(bitbuf, 1, &vui->pic_struct_present_flag)) < 0)
+    return retCode;
+
+  if ((retCode = u_n(bitbuf, 1, &vui->bitstream_restriction_flag)) < 0)
+    return retCode;
+
+  if (vui->bitstream_restriction_flag) {
+    if ((retCode = u_n(bitbuf, 1, &vui->motion_vectors_over_pic_boundaries_flag)) < 0)
+      return retCode;
+    if ((retCode = ue_v(bitbuf, &vui->max_bytes_per_pic_denom, 16)) < 0)
+      return retCode;
+    if ((retCode = ue_v(bitbuf, &vui->max_bits_per_mb_denom, 16)) < 0)
+      return retCode;
+    if ((retCode = ue_v(bitbuf, &vui->log2_max_mv_length_horizontal, 16)) < 0)
+      return retCode;
+    if ((retCode = ue_v(bitbuf, &vui->log2_max_mv_length_vertical, 16)) < 0)
+      return retCode;
+    if ((retCode = ue_v(bitbuf, &vui->num_reorder_frames, 16)) < 0)
+      return retCode;
+    if ((retCode = ue_v(bitbuf, &vui->max_dec_frame_buffering, 16)) < 0)
+      return retCode;
+  }
+
+  return PS_OK;
+}
+
+
+/*
+ *
+ * setVUIdefaults:
+ *
+ * Parameters:
+ *      vui                   Pointer to VUI parameters
+ *
+ * Function:
+ *      Set VUI parameters to their default values when default value is non-zero.
+ *
+ * Returns:
+ *      -
+ */
+static void setVUIdefaults(seq_parameter_set_s *sps)
+{
+  vui_parameters_s *vui;
+  const level_s *level;
+  int MaxDpbSize;
+
+  vui = &sps->vui_parameters;
+
+  vui->video_format                            = 5;
+  vui->colour_primaries                        = 2;
+  vui->transfer_characteristics                = 2;
+  vui->matrix_coefficients                     = 2;
+  vui->motion_vectors_over_pic_boundaries_flag = 1;
+  vui->max_bytes_per_pic_denom                 = 2;
+  vui->max_bits_per_mb_denom                   = 1;
+  vui->log2_max_mv_length_horizontal           = 16;
+  vui->log2_max_mv_length_vertical             = 16;
+
+  level = getLevel(sps->level_idc, sps->constraint_set3_flag);
+  MaxDpbSize = level->maxDPB /
+    ((sps->pic_width_in_mbs_minus1+1) * (sps->pic_height_in_map_units_minus1+1) * 384);
+  MaxDpbSize = clip(1, 16, MaxDpbSize);
+
+  vui->max_dec_frame_buffering = MaxDpbSize;
+  vui->num_reorder_frames      = vui->max_dec_frame_buffering;
+}
+
+/*
+ *
+ * psDecodeSPS:
+ *      
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      spsList               The list for SPS's, the newly decoded SPS will be stored into the list
+ *
+ * Function:
+ *      Decode the SPS, and store it into the SPS list
+ *
+ * Returns:
+ *      PS_OK:                SPS decoded succesfully
+ *      <0:                   Fail
+ */
+int psDecodeSPS( bitbuffer_s *bitbuf, seq_parameter_set_s **spsList, 
+                 TInt& aWidth, TInt& aHeight )
+{
+  seq_parameter_set_s *sps;
+  unsigned int i;
+  int retCode;
+
+  unsigned  profile_idc;                                      // u(8)
+  Boolean   constraint_set0_flag;                             // u(1)
+  Boolean   constraint_set1_flag;                             // u(1)
+  Boolean   constraint_set2_flag;                             // u(1)
+  Boolean   constraint_set3_flag;                             // u(1)
+  Boolean   reserved_zero_4bits;                              // u(4)
+  unsigned  level_idc;                                        // u(8)
+  unsigned  seq_parameter_set_id;                             // ue(v)
+
+
+  /*
+   * Parse sequence parameter set syntax until sps id
+   */
+
+  if ((retCode = u_n(bitbuf, 8, &profile_idc)) < 0)
+    return retCode;
+
+  /* If constraint_set0_flag == 1, stream is Baseline Profile compliant */
+  if ((retCode = u_n(bitbuf, 1, &constraint_set0_flag)) < 0)
+    return retCode;
+
+  /* If constraint_set1_flag == 1, stream is Main Profile compliant */
+  if ((retCode = u_n(bitbuf, 1, &constraint_set1_flag)) < 0)
+    return retCode;
+
+  /* If constraint_set2_flag == 1, stream is Extended Profile compliant */
+  if ((retCode = u_n(bitbuf, 1, &constraint_set2_flag)) < 0)
+    return retCode;
+
+  if ((retCode = u_n(bitbuf, 1, &constraint_set3_flag)) < 0)
+    return retCode;
+
+  /* If CABAC is not defined we support only baseline compliant streams */
+#ifndef ENABLE_CABAC
+  if (profile_idc != PS_BASELINE_PROFILE_IDC && constraint_set0_flag == 0)
+    return PS_ERR_UNSUPPORTED_PROFILE;
+#else
+  if (profile_idc != PS_BASELINE_PROFILE_IDC && constraint_set0_flag == 0 &&
+      profile_idc != PS_MAIN_PROFILE_IDC && constraint_set1_flag == 0)
+    return PS_ERR_UNSUPPORTED_PROFILE;
+#endif
+
+  /* We don't care what is in these bits */
+  if ((retCode = u_n(bitbuf, 4, &reserved_zero_4bits)) < 0)
+    return retCode;
+
+  /* Fetch level */
+  if ((retCode = u_n(bitbuf, 8, &level_idc)) < 0)
+    return retCode;
+
+  /* Find level in the list of legal levels */
+  for (i = 0; i < NUM_LEVELS; i++) {
+    if ((int)level_idc == levelArray[i].levelNumber)
+      break;
+  }
+
+  /* If level was not found in the list, return with error */
+  if (i == NUM_LEVELS)
+    return PS_ERR_ILLEGAL_VALUE;
+
+  /* Get sequence parameter set id */
+  if ((retCode = ue_v(bitbuf, &seq_parameter_set_id, PS_MAX_NUM_OF_SPS-1)) < 0)
+    return retCode;
+
+
+  /*
+   * Allocate memory for SPS
+   */
+
+  /* Pointer to sequence parameter set structure */
+  sps = spsList[seq_parameter_set_id];
+
+  /* allocate mem for SPS, if it has not been allocated already */
+  if (!sps) {
+    sps = (seq_parameter_set_s *) User::Alloc(sizeof(seq_parameter_set_s));    
+    if (sps == 0) {
+      return PS_ERR_MEM_ALLOC;
+    }
+    memset( sps, 0, sizeof(seq_parameter_set_s));
+    spsList[seq_parameter_set_id] = sps;
+  }
+
+
+  /* Copy temporary variables to sequence parameter set structure */
+  sps->profile_idc          = profile_idc;
+  sps->constraint_set0_flag = constraint_set0_flag;
+  sps->constraint_set1_flag = constraint_set1_flag;
+  sps->constraint_set2_flag = constraint_set2_flag;
+  sps->constraint_set3_flag = constraint_set3_flag;
+  sps->reserved_zero_4bits  = reserved_zero_4bits;
+  sps->level_idc            = level_idc;
+  sps->seq_parameter_set_id = seq_parameter_set_id;
+
+
+  /*
+   * Parse rest of the sequence parameter set syntax
+   */
+
+  /* This defines how many bits there are in frame_num syntax element */
+  if ((retCode = ue_v(bitbuf, &sps->log2_max_frame_num_minus4, 12)) < 0)
+    return retCode;
+
+  /* Fetch POC type */
+  if ((retCode = ue_v(bitbuf, &sps->pic_order_cnt_type, 2)) < 0)
+    return retCode;
+
+  if (sps->pic_order_cnt_type == 0) {
+    if ((retCode = ue_v(bitbuf, &sps->log2_max_pic_order_cnt_lsb_minus4, 12)) < 0)
+      return retCode;
+  }
+  else if (sps->pic_order_cnt_type == 1) {
+    if ((retCode = u_n(bitbuf, 1, &sps->delta_pic_order_always_zero_flag)) < 0)
+      return retCode;
+
+    if ((retCode = se_v_long(bitbuf, &sps->offset_for_non_ref_pic)) < 0)
+      return retCode;
+
+    if ((retCode = se_v_long(bitbuf, &sps->offset_for_top_to_bottom_field)) < 0)
+      return retCode;
+
+    if ((retCode = ue_v(bitbuf, &sps->num_ref_frames_in_pic_order_cnt_cycle, 255)) < 0)
+      return retCode;
+
+    for (i = 0; i < sps->num_ref_frames_in_pic_order_cnt_cycle; i++) {
+      if ((retCode = se_v_long(bitbuf, &sps->offset_for_ref_frame[i])) < 0)
+        return retCode;
+    }
+  }
+
+  if ((retCode = ue_v(bitbuf, &sps->num_ref_frames, 16)) < 0)
+    return retCode;
+
+  if ((retCode = u_n(bitbuf, 1, &sps->gaps_in_frame_num_value_allowed_flag)) < 0)
+    return retCode;
+
+  if ((retCode = ue_v(bitbuf, &sps->pic_width_in_mbs_minus1, MAX_PIC_WIDTH_IN_MBS-1)) < 0)
+    return retCode;
+  
+  aWidth = (sps->pic_width_in_mbs_minus1 + 1) * 16;
+
+  if ((retCode = ue_v(bitbuf, &sps->pic_height_in_map_units_minus1, MAX_PIC_WIDTH_IN_MBS-1)) < 0)
+    return retCode;
+  
+  aHeight = (sps->pic_height_in_map_units_minus1 + 1) * 16;
+
+  if ((retCode = u_n(bitbuf, 1, &sps->frame_mbs_only_flag)) < 0)
+    return retCode;
+
+  if (!sps->frame_mbs_only_flag) {
+    // u_n(bitbuf, 1, &sps->mb_adaptive_frame_field_flag);
+    return PS_ERR_UNSUPPORTED_FEATURE;
+  }
+
+  if ((retCode = u_n(bitbuf, 1, &sps->direct_8x8_inference_flag)) < 0)
+    return retCode;
+
+  if ((retCode = u_n(bitbuf, 1, &sps->frame_cropping_flag)) < 0)
+    return retCode;
+
+  /* Fetch cropping window */
+  if (sps->frame_cropping_flag) {
+    if ((retCode = ue_v(bitbuf, &sps->frame_crop_left_offset, 8*(sps->pic_width_in_mbs_minus1+1)-1)) < 0)
+      return retCode;
+
+    if ((retCode = ue_v(bitbuf, &sps->frame_crop_right_offset, 8*(sps->pic_width_in_mbs_minus1+1)-sps->frame_crop_left_offset-1)) < 0)
+      return retCode;
+
+    if ((retCode = ue_v(bitbuf, &sps->frame_crop_top_offset, 8*(sps->pic_height_in_map_units_minus1+1)-1)) < 0)
+      return retCode;
+
+    if ((retCode = ue_v(bitbuf, &sps->frame_crop_bottom_offset, 8*(sps->pic_height_in_map_units_minus1+1)-sps->frame_crop_top_offset-1)) < 0)
+      return retCode;
+    
+    TInt cropUnitX = 2;
+    TInt cropUnitY = 2 * ( 2 - sps->frame_mbs_only_flag );
+    
+    TInt leftBorder = cropUnitX * sps->frame_crop_left_offset;
+    TInt rightBorder = aWidth - ( cropUnitX * sps->frame_crop_right_offset );
+    
+    aWidth = rightBorder - leftBorder;
+    
+    TInt topBorder = cropUnitY * sps->frame_crop_top_offset;
+    TInt bottomBorder = ( 16 * (sps->pic_height_in_map_units_minus1 + 1) ) -
+                        cropUnitY * sps->frame_crop_bottom_offset;
+                        
+    aHeight = bottomBorder - topBorder;
+    
+  }
+
+  if ((retCode = u_n(bitbuf, 1, &sps->vui_parameters_present_flag)) < 0)
+    return retCode;
+
+  setVUIdefaults(sps);
+
+  if (sps->vui_parameters_present_flag) {
+    if ((retCode = getVUI(bitbuf, &sps->vui_parameters)) < 0)
+      return retCode;
+  }
+
+  if (bibSkipTrailingBits(bitbuf) < 0)
+    return PS_ERROR;
+
+  return PS_OK;
+}
+
+/*
+ *
+ * psCloseParametersSets:
+ *
+ * Parameters:
+ *      spsList               The sequence parameter set list
+ *      ppsList               The picture parameter set list
+ *
+ * Fucntion:
+ *      Free all parameter sets
+ *
+ * Returns:
+ *      -
+ */
+void psCloseParametersSets(seq_parameter_set_s **spsList,
+                           pic_parameter_set_s **ppsList)
+{
+  int i;
+
+  for (i = 0; i < PS_MAX_NUM_OF_SPS; i++) {
+    psCloseSPS(spsList[i]);
+    spsList[i] = 0;
+  }
+
+  for (i = 0; i < PS_MAX_NUM_OF_PPS; i++) {
+    psClosePPS(ppsList[i]);
+    ppsList[i] = 0;
+  }
+}
+
+/*
+ *
+ * psClosePPS:
+ *
+ * Parameters:
+ *      pps                   the picture parameter set to be freed
+ *
+ * Function:
+ *      free the picture parameter set
+ *
+ * Returns:
+ *      -
+ */
+void psClosePPS( pic_parameter_set_s *pps )
+{
+  if (pps == 0)
+    return;
+  
+  	// [KW]: Added
+  	if (pps->codedPPSBuffer)
+	  	User::Free(pps->codedPPSBuffer);
+
+
+  if (pps->slice_group_id)
+    User::Free(pps->slice_group_id);
+//    nccFree(pps->slice_group_id);
+
+//  nccFree(pps);
+	User::Free(pps);
+}
+
+
+/*
+ *
+ * psCloseSPS:
+ *
+ * Parameters:
+ *      sps                   the sequence parameter set to be freed
+ *
+ * Fucntion:
+ *      free the sequence parameter set
+ *
+ * Returns:
+ *      -
+ */
+void psCloseSPS( seq_parameter_set_s *sps )
+{
+  if (sps == 0)
+    return;
+  	
+  	// [KW]: Added
+  	if (sps->codedSPSBuffer)
+	  	User::Free(sps->codedSPSBuffer);
+
+//  nccFree(sps);
+  User::Free(sps);
+}
+
+
+// psParseLevelFromSPS
+// Returns the baseline profile level from SPS
+TInt psParseLevelFromSPS( bitbuffer_s *bitbuf, TInt& aLevel )
+{
+  	TInt retCode;
+  	TUint profile_idc;                                      // u(8)
+  	Boolean constraint_set0_flag;                          // u(1)
+  	Boolean constraint_set1_flag;                          // u(1)
+  	Boolean constraint_set2_flag;                          // u(1)
+  	Boolean constraint_set3_flag;                          // u(1)
+  	Boolean reserved_zero_4bits;                           // u(4)
+  	TUint level_idc;                                        // u(8)      
+  
+  	// Parse sequence parameter set syntax until sps id
+  	if ((retCode = u_n(bitbuf, 8, &profile_idc)) < 0)
+    	return retCode;
+
+  	// If constraint_set0_flag == 1, stream is Baseline Profile compliant 
+  	if ((retCode = u_n(bitbuf, 1, &constraint_set0_flag)) < 0)
+    	return retCode;
+
+  	// If constraint_set1_flag == 1, stream is Main Profile compliant 
+  	if ((retCode = u_n(bitbuf, 1, &constraint_set1_flag)) < 0)
+    	return retCode;
+
+  	// If constraint_set2_flag == 1, stream is Extended Profile compliant 
+  	if ((retCode = u_n(bitbuf, 1, &constraint_set2_flag)) < 0)
+    	return retCode;
+
+  	if ((retCode = u_n(bitbuf, 1, &constraint_set3_flag)) < 0)
+    	return retCode;
+
+  	// If CABAC is not defined we support only baseline compliant streams 
+	if (profile_idc != PS_BASELINE_PROFILE_IDC && constraint_set0_flag == 0)
+   		return PS_ERR_UNSUPPORTED_PROFILE;
+
+  	// We don't care what is in these bits 
+  	if ((retCode = u_n(bitbuf, 4, &reserved_zero_4bits)) < 0)
+    	return retCode;
+
+  	// Fetch level 
+  	if ((retCode = u_n(bitbuf, 8, &level_idc)) < 0)
+    	return retCode;
+  
+  	aLevel = level_idc;
+  
+  	if ( level_idc == 11 && constraint_set3_flag == 1 )
+    	aLevel = 101;  // level 1b
+  
+  	return KErrNone;
+}
+
+
+// AddBytesToBuffer
+// Adds aNumBytes bytes to bit buffer aBitBuffer, reallocates the bit buffer data if necessary.
+TInt AddBytesToBuffer(bitbuffer_s *aBitBuffer, TUint aNumBytes)
+{
+	TInt i;
+	
+	// Reallocate the bitbuffer data
+	aBitBuffer->data = (TUint8 *) User::ReAlloc(aBitBuffer->data, (aBitBuffer->dataLen+aNumBytes));
+
+	if (aBitBuffer->data == 0)
+        return KErrNoMemory;
+
+	// Set the new bytes as zeros
+	for (i=aBitBuffer->dataLen; i<aBitBuffer->dataLen+aNumBytes; i++)
+	{
+		aBitBuffer->data[i] = 0;
+	}
+
+	return KErrNone;
+}
+
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+
+
+/*
+ *
+ * psGetAspectRatio:
+ *      
+ * Parameters:
+ *      sps                   Sequence parameter set
+ *      width                 Horizontal size of the sample aspect ratio
+ *      height                Vertical size of the sample aspect ratio
+ *
+ * Function:
+ *      Return sample aspect ratio in width and height
+ *
+ * Returns:
+ *      -
+ */
+void psGetAspectRatio(seq_parameter_set_s *sps, int *width, int *height)
+{
+  vui_parameters_s *vui;
+
+  vui = &sps->vui_parameters;
+
+  *width  = 0;
+  *height = 0;
+
+  if (sps->vui_parameters_present_flag &&
+      vui->aspect_ratio_info_present_flag &&
+      vui->aspect_ratio_idc != 0 &&
+      (vui->aspect_ratio_idc <= 13 || vui->aspect_ratio_idc == 255))
+  {
+    if (vui->aspect_ratio_idc == 255) {
+      /* Extended_SAR */
+      if (vui->sar_width != 0 && vui->sar_height != 0) {
+        *width  = vui->sar_width;
+        *height = vui->sar_height;
+      }
+    }
+    else {
+      *width  = aspectRatioArr[vui->aspect_ratio_idc-1].width;
+      *height = aspectRatioArr[vui->aspect_ratio_idc-1].height;
+    }
+  }
+
+}
+
+
+// CompareSPSSets
+// Compares two SPS input sets to see if we can use one for both clips, if exact match is not required
+// then some parameters maybe be different in the two sets. 
+TInt CompareSPSSets( seq_parameter_set_s *aSPSSet1, seq_parameter_set_s *aSPSSet2, TBool aExactMatch )
+{
+	TUint i;
+
+	// Different maxFrameNum & maxPOCLsb can be handled by modifying the slice header, thus do not return EFalse
+	if ( aExactMatch )
+	{
+		// If exact match is required, return false for different max frame number value
+		if ( aSPSSet1->log2_max_frame_num_minus4 != aSPSSet2->log2_max_frame_num_minus4 )
+			return EFalse;	
+	}
+	
+	if ( aSPSSet1->pic_order_cnt_type != aSPSSet2->pic_order_cnt_type )
+	{
+		return EFalse;
+	}
+	else
+	{
+	  	if (aSPSSet1->pic_order_cnt_type == 0) 
+  		{
+			// Different maxFrameNum & maxPOCLsb can be handled by modifying the slice header, thus do not return EFalse
+			if ( aExactMatch )
+			{
+				// If exact match is required, return false for different max POCLSB number value
+				if ( aSPSSet1->log2_max_pic_order_cnt_lsb_minus4 != aSPSSet2->log2_max_pic_order_cnt_lsb_minus4 )
+					return EFalse;	
+			}
+	
+  		}
+	  	else if (aSPSSet1->pic_order_cnt_type == 1) 
+  		{
+			if ( aSPSSet1->delta_pic_order_always_zero_flag != aSPSSet2->delta_pic_order_always_zero_flag ||
+				 aSPSSet1->offset_for_non_ref_pic != aSPSSet2->offset_for_non_ref_pic ||
+				 aSPSSet1->num_ref_frames_in_pic_order_cnt_cycle != aSPSSet2->num_ref_frames_in_pic_order_cnt_cycle )
+			{
+				return EFalse;
+			}
+
+	    	for (i = 0; i < aSPSSet1->num_ref_frames_in_pic_order_cnt_cycle; i++) 
+    		{
+				if ( aSPSSet1->offset_for_ref_frame[i] != aSPSSet2->offset_for_ref_frame[i] )
+				{
+					return EFalse;
+				}
+    		}
+  		}
+	}
+
+	if ( aSPSSet1->num_ref_frames != aSPSSet2->num_ref_frames )
+	{
+		return EFalse;
+	}
+	
+	// Direct 8x8 inference flag is not used in baseline, ignore
+
+	return ETrue;
+}
+
+
+// IsSPSSupported
+// Checks if the input SPS contains supported values. Returns KErrNotSupported if 
+// unsupported parameters are found.
+TInt IsSPSSupported( seq_parameter_set_s *aSPS )
+{
+
+	// Only Baseline profile supported at the moment
+	if ( aSPS->profile_idc != PS_BASELINE_PROFILE_IDC )
+	{
+		return KErrNotSupported;
+	}
+	
+	// Check if maximum supported level is exceeded
+	if ( aSPS->level_idc > PS_MAX_SUPPORTED_LEVEL )
+	{
+		return KErrNotSupported;
+	}
+	
+	// For now more than one reference frames are not supported
+	if ( aSPS->num_ref_frames > 1 )
+	{
+		return KErrNotSupported;
+	}
+	
+	// Coded fields are not supported
+	if ( !aSPS->frame_mbs_only_flag )
+	{
+		return KErrNotSupported;
+	}
+	
+	if ( aSPS->vui_parameters_present_flag )
+	{
+		if ( aSPS->vui_parameters.num_reorder_frames != 0 && aSPS->pic_order_cnt_type != 2)
+		{
+			// Since we can't be sure how many input frames we have to buffer before getting 
+			// an output picture, return KErrNotSupported
+			return KErrNotSupported;
+		}
+	}
+	else
+	{
+		if ( aSPS->pic_order_cnt_type != 2)
+		{
+			// Since we can't be sure how many input frames we have to buffer before getting 
+			// an output picture, return KErrNotSupported
+			return KErrNotSupported;
+		}
+	}
+	
+	return KErrNone;
+}
+
+
+// IsPPSSupported
+// Checks if the input PPS contains supported values. Returns KErrNotSupported if 
+// unsupported parameters are found.
+TInt IsPPSSupported( pic_parameter_set_s *aPPS )
+{
+
+	// For baseline, both prediction values shall be zero
+	if( aPPS->weighted_pred_flag != 0 || aPPS->weighted_bipred_idc != 0)
+	{
+		return KErrNotSupported;
+	}
+	
+	// For baseline, entropy coding mode shall be zero
+	if ( aPPS->entropy_coding_mode_flag != 0 )
+	{
+		return KErrNotSupported;
+	}
+	
+	if ( aPPS->num_slice_groups_minus1 > PS_BASELINE_MAX_SLICE_GROUPS )
+	{
+		return KErrNotSupported;
+	}
+
+	return KErrNone;
+}
+
+
+// psParseSPS
+// Parses the input SPS set. Modifies the SPS id if a conflicting id is found 
+// and stores the modified data to codedSPSBuffer for later use.
+TInt psParseSPS( bitbuffer_s *bitbuf, seq_parameter_set_s **spsList, TUint aFrameFromEncoder, TBool *aEncodeUntilIDR, TUint *aNumSPS )
+{
+  	seq_parameter_set_s *sps;
+  	TUint i;
+  	TInt retCode;
+  	TUint bitPosit = 0;
+  	TUint bytePosit = 0;
+  	TUint profile_idc;                                      // u(8)
+  	Boolean constraint_set0_flag;                          // u(1)
+  	Boolean constraint_set1_flag;                          // u(1)
+  	Boolean constraint_set2_flag;                          // u(1)
+  	Boolean constraint_set3_flag;                          // u(1)
+  	Boolean reserved_zero_4bits;                           // u(4)
+  	TUint level_idc;                                        // u(8)
+  	TUint seq_parameter_set_id;                             // ue(v)
+  	TUint newSPSId = 0;
+  	TUint possibleIdConflict = 0;
+  	TUint useOneSPS = 0;
+
+
+  	if (!aFrameFromEncoder)
+  	{	
+	  	// Reset the encode until IDR flag if this SPS is not from the encoder.
+  		*aEncodeUntilIDR = EFalse;
+  	}
+
+  	// Parse sequence parameter set syntax until sps id
+  	if ((retCode = u_n(bitbuf, 8, &profile_idc)) < 0)
+    	return retCode;
+	
+  	// If constraint_set0_flag == 1, stream is Baseline Profile compliant 
+  	if ((retCode = u_n(bitbuf, 1, &constraint_set0_flag)) < 0)
+    	return retCode;
+
+  	// If constraint_set1_flag == 1, stream is Main Profile compliant 
+  	if ((retCode = u_n(bitbuf, 1, &constraint_set1_flag)) < 0)
+    	return retCode;
+
+  	// If constraint_set2_flag == 1, stream is Extended Profile compliant 
+  	if ((retCode = u_n(bitbuf, 1, &constraint_set2_flag)) < 0)
+    	return retCode;
+
+  	if ((retCode = u_n(bitbuf, 1, &constraint_set3_flag)) < 0)
+    	return retCode;
+
+  	// If CABAC is not defined we support only baseline compliant streams 
+	if (profile_idc != PS_BASELINE_PROFILE_IDC && constraint_set0_flag == 0)
+   		return PS_ERR_UNSUPPORTED_PROFILE;
+
+  	// We don't care what is in these bits 
+  	if ((retCode = u_n(bitbuf, 4, &reserved_zero_4bits)) < 0)
+    	return retCode;
+
+  	// Fetch level 
+  	if ((retCode = u_n(bitbuf, 8, &level_idc)) < 0)
+    	return retCode;
+
+  	// Find level in the list of legal levels 
+  	for (i = 0; i < NUM_LEVELS; i++) 
+  	{
+    	if ((int)level_idc == levelArray[i].levelNumber)
+      		break;
+  	}
+
+  	// If level was not found in the list, return with error 
+  	if (i == NUM_LEVELS)
+    	return PS_ERR_ILLEGAL_VALUE;
+
+  	// Get sequence parameter set id 
+  	if ((retCode = ue_v(bitbuf, &seq_parameter_set_id, PS_MAX_NUM_OF_SPS-1)) < 0)
+    	return retCode;
+
+  	// Pointer to sequence parameter set structure 
+  	sps = spsList[seq_parameter_set_id];
+
+  	// Allocate memory for SPS, if it has not been allocated already 
+  	if (!sps) 
+  	{
+    	sps = (seq_parameter_set_s *) User::Alloc(sizeof(seq_parameter_set_s));
+    	
+    	if (sps == 0) 
+    	{
+			PRINT((_L("Error while allocating memory for SPS.\n")));
+      			return PS_ERR_MEM_ALLOC;
+    	}
+    	
+    	memset( sps, 0, sizeof(seq_parameter_set_s));
+    	spsList[seq_parameter_set_id] = sps;
+
+  		sps->seq_parameter_set_id = seq_parameter_set_id;
+  		(*aNumSPS)++;
+  	}
+  	else
+  	{
+  		// There might be a conflicting Id with an existing SPS set
+  		// Give the new SPS set the next free SPS Id
+  		possibleIdConflict = 1;
+  		newSPSId = 0;
+  		useOneSPS = 1;
+  		
+  		// Search for the first free SPS id
+  		while (spsList[newSPSId])
+  		{
+  			newSPSId++;
+  		}
+  	
+  		// And allocate memory for the SPS
+    	sps = (seq_parameter_set_s *) User::Alloc(sizeof(seq_parameter_set_s));
+    	
+    	if (sps == 0) 
+    	{
+      		PRINT((_L("Error while allocating memory for SPS.\n")));
+      			return PS_ERR_MEM_ALLOC;
+    	}
+    
+    	memset( sps, 0, sizeof(seq_parameter_set_s));
+    
+    	sps->seq_parameter_set_id = newSPSId;
+
+  		// Store the position of the bit buffer
+  		bitPosit = bitbuf->bitpos;
+  		bytePosit = bitbuf->bytePos;
+  	}
+
+
+  	// Copy temporary variables to sequence parameter set structure 
+  	sps->profile_idc          = profile_idc;
+  	sps->constraint_set0_flag = constraint_set0_flag;
+  	sps->constraint_set1_flag = constraint_set1_flag;
+  	sps->constraint_set2_flag = constraint_set2_flag;
+  	sps->constraint_set3_flag = constraint_set3_flag;
+  	sps->reserved_zero_4bits  = reserved_zero_4bits;
+  	sps->level_idc            = level_idc;
+
+	// Initialize
+	sps->maxFrameNumChanged = 0;
+	sps->maxPOCNumChanged = 0;
+	
+  	// This defines how many bits there are in frame_num syntax element 
+  	if ((retCode = ue_v(bitbuf, &sps->log2_max_frame_num_minus4, 12)) < 0)
+    	return retCode;
+
+  	// Fetch POC type 
+  	if ((retCode = ue_v(bitbuf, &sps->pic_order_cnt_type, 2)) < 0)
+    	return retCode;
+
+  	if (sps->pic_order_cnt_type == 0) 
+  	{
+    	if ((retCode = ue_v(bitbuf, &sps->log2_max_pic_order_cnt_lsb_minus4, 12)) < 0)
+      		return retCode;
+  	}
+  	else if (sps->pic_order_cnt_type == 1) 
+  	{
+    	if ((retCode = u_n(bitbuf, 1, &sps->delta_pic_order_always_zero_flag)) < 0)
+      		return retCode;
+
+    	if ((retCode = se_v_long(bitbuf, &sps->offset_for_non_ref_pic)) < 0)
+      		return retCode;
+
+    	if ((retCode = se_v_long(bitbuf, &sps->offset_for_top_to_bottom_field)) < 0)
+      		return retCode;
+
+    	if ((retCode = ue_v(bitbuf, &sps->num_ref_frames_in_pic_order_cnt_cycle, 255)) < 0)
+      		return retCode;
+
+    	for (i = 0; i < sps->num_ref_frames_in_pic_order_cnt_cycle; i++) 
+    	{
+      		if ((retCode = se_v_long(bitbuf, &sps->offset_for_ref_frame[i])) < 0)
+        		return retCode;
+    	}
+  	}
+
+  	if ((retCode = ue_v(bitbuf, &sps->num_ref_frames, 16)) < 0)
+    	return retCode;
+
+  	if ((retCode = u_n(bitbuf, 1, &sps->gaps_in_frame_num_value_allowed_flag)) < 0)
+    	return retCode;
+
+  	if ((retCode = ue_v(bitbuf, &sps->pic_width_in_mbs_minus1, MAX_PIC_WIDTH_IN_MBS-1)) < 0)
+    	return retCode;
+
+  	if ((retCode = ue_v(bitbuf, &sps->pic_height_in_map_units_minus1, MAX_PIC_WIDTH_IN_MBS-1)) < 0)
+    	return retCode;
+
+  	if ((retCode = u_n(bitbuf, 1, &sps->frame_mbs_only_flag)) < 0)
+    	return retCode;
+
+  	if (!sps->frame_mbs_only_flag) 
+  	{
+    	return PS_ERR_UNSUPPORTED_FEATURE;
+  	}
+
+  	if ((retCode = u_n(bitbuf, 1, &sps->direct_8x8_inference_flag)) < 0)
+    	return retCode;
+
+  	if ((retCode = u_n(bitbuf, 1, &sps->frame_cropping_flag)) < 0)
+    	return retCode;
+
+  	// Fetch cropping window 
+  	if (sps->frame_cropping_flag) 
+  	{
+    	if ((retCode = ue_v(bitbuf, &sps->frame_crop_left_offset, 8*(sps->pic_width_in_mbs_minus1+1)-1)) < 0)
+      		return retCode;
+
+    	if ((retCode = ue_v(bitbuf, &sps->frame_crop_right_offset, 8*(sps->pic_width_in_mbs_minus1+1)-sps->frame_crop_left_offset-1)) < 0)
+      		return retCode;
+
+    	if ((retCode = ue_v(bitbuf, &sps->frame_crop_top_offset, 8*(sps->pic_height_in_map_units_minus1+1)-1)) < 0)
+      		return retCode;
+
+    	if ((retCode = ue_v(bitbuf, &sps->frame_crop_bottom_offset, 8*(sps->pic_height_in_map_units_minus1+1)-sps->frame_crop_top_offset-1)) < 0)
+      		return retCode;
+  	}
+
+  	if ((retCode = u_n(bitbuf, 1, &sps->vui_parameters_present_flag)) < 0)
+    	return retCode;
+
+  	setVUIdefaults(sps);
+
+  	if (sps->vui_parameters_present_flag) 
+  	{
+    	if ((retCode = getVUI(bitbuf, &sps->vui_parameters)) < 0)
+      		return retCode;
+  	}
+
+  	if (bibSkipTrailingBits(bitbuf) < 0)
+    	return PS_ERROR;
+  
+  	// Store the size of the SPS set
+  	sps->SPSlength = bitbuf->bytePos;
+  
+	syncBitBufferBitpos(bitbuf);
+	
+  	// If we had a possible conflict, compare the SPS sets with the same id to see if only one SPS set can be used.
+  	if (possibleIdConflict)
+  	{
+  		// Check if one SPS can be used instead of two separate ones
+	  	useOneSPS = CompareSPSSets(spsList[seq_parameter_set_id],sps,EFalse);
+	  	
+	  	if (!useOneSPS)
+	  	{
+  			TUint trailingBits = GetNumTrailingBits(bitbuf);
+  			TInt diff = 0;
+			TUint oldSPSId = seq_parameter_set_id;
+			TUint oldIdLength = ReturnUnsignedExpGolombCodeLength(oldSPSId);
+			TUint newIdLength = ReturnUnsignedExpGolombCodeLength(newSPSId);
+			TUint storeSPS = 1;
+		
+  			for (i=0; i<PS_MAX_NUM_OF_SPS; i++)
+  			{
+			  	// Check if an older SPS matches exactly this one, then use the old
+  				if (spsList[i])
+	  				useOneSPS = CompareSPSSets(spsList[i],sps,ETrue);
+  			
+	  			if (useOneSPS)
+	  			{
+	  				newSPSId = i;
+	  				storeSPS  =0;
+  					break;		
+	  			}
+  			}
+  		
+	  		if ( newSPSId > PS_MAX_NUM_OF_SPS )
+	  		{
+	  			// We have reached maximum number of SPS, return an error
+	  			return PS_ERROR;
+	  		}
+	  		
+	  		(*aNumSPS)++;
+	  	
+	  		// Set indexChanged to true and give the new index to old SPS, so that (new) PPS can refer to the new SPS
+	  		spsList[seq_parameter_set_id]->indexChanged = 1;
+	  		spsList[seq_parameter_set_id]->newSPSId = newSPSId;	// The new Id
+	  	
+	  		if (aFrameFromEncoder)
+	  		{
+		  		spsList[seq_parameter_set_id]->encSPSId = newSPSId;	// The new Id
+		  	
+		  		// Store information that there are different SPS in use, we have to encode until an IDR NAL unit.
+		  		*aEncodeUntilIDR = ETrue;
+	  		}
+			else
+		  		spsList[seq_parameter_set_id]->origSPSId = newSPSId;	// The new Id
+		  	
+	  		
+	  		// Store the new SPS at the new index and modify SPS id, 
+	  		// unless we are using a previously stored SPS
+	  		if(storeSPS)
+	  		{
+		  		spsList[newSPSId] = sps;
+		  		
+				// Restore the bit buffer position at the SPS Id
+				bitbuf->bitpos = bitPosit;
+				bitbuf->bytePos = bytePosit;
+		
+				if(trailingBits > 8)
+				{
+					trailingBits = 8;
+				}
+		
+				if ( oldIdLength == newIdLength )
+				{
+					// Just encode the new Id on top of the old Id
+					bitbuf->bitpos += oldIdLength;
+					if (bitbuf->bitpos > 8)
+					{	
+						// Go to the right byte and bit position
+						bitbuf->bytePos -= bitbuf->bitpos / 8;
+						bitbuf->bitpos = bitbuf->bitpos % 8;
+					}
+				
+					EncodeUnsignedExpGolombCode(bitbuf, newSPSId);
+				}
+				else if ( oldIdLength < newIdLength )
+				{
+					diff = newIdLength - oldIdLength;
+			
+					// Adjust the SPS length
+					if (diff >= 8)
+					{
+						// Add as many extra bytes as is required
+						sps->SPSlength += (diff / 8);
+					}
+				
+					if ( trailingBits < (diff % 8) )
+					{
+						// Add one byte since there aren't enough trailing bits for the extra bits
+						sps->SPSlength += 1;
+					}
+			
+					ShiftBufferRight(bitbuf, diff, trailingBits, oldIdLength);
+	
+					// After shifting, encode the new value to the bit buffer
+					EncodeUnsignedExpGolombCode(bitbuf, newSPSId);
+				}
+				else
+				{
+					// New id's length is smaller than old id's length
+					diff = oldIdLength - newIdLength;
+			
+					if (diff >= 8)
+					{
+						// Adjust the SPS length
+						sps->SPSlength -= (diff / 8);
+					}
+			
+					ShiftBufferLeft(bitbuf, diff, oldIdLength);
+			
+					// After shifting, encode the new value to the bit buffer
+					EncodeUnsignedExpGolombCode(bitbuf, newSPSId);
+				}
+	  		}
+	  	}
+	  	else	// Use one SPS for both
+	  	{
+	  		// Reset indexChanged to false 
+	  		spsList[seq_parameter_set_id]->indexChanged = 0;
+	  		
+	  		// Check if the frame numbering or POC numbering has to be changed
+	  		if (spsList[seq_parameter_set_id]->log2_max_frame_num_minus4 != sps->log2_max_frame_num_minus4)
+	  		{
+	  			spsList[seq_parameter_set_id]->maxFrameNumChanged = 1;
+	  		
+	  			if (aFrameFromEncoder)
+			  		spsList[seq_parameter_set_id]->encMaxFrameNum = sps->log2_max_frame_num_minus4;
+				else
+		  			spsList[seq_parameter_set_id]->origMaxFrameNum = sps->log2_max_frame_num_minus4;
+	  		}
+	  		else
+	  		{
+	  			// Reset the value in case it was changed for another clip earlier
+	  			spsList[seq_parameter_set_id]->maxFrameNumChanged = 0;
+	  		}
+
+	  		if (spsList[seq_parameter_set_id]->log2_max_pic_order_cnt_lsb_minus4 != sps->log2_max_pic_order_cnt_lsb_minus4)
+	  		{
+	  			spsList[seq_parameter_set_id]->maxPOCNumChanged = 1;
+	  		
+	  			if (aFrameFromEncoder)
+			  		spsList[seq_parameter_set_id]->encMaxPOCNum = sps->log2_max_pic_order_cnt_lsb_minus4;
+				else
+		  			spsList[seq_parameter_set_id]->origMaxPOCNum = sps->log2_max_pic_order_cnt_lsb_minus4;
+	  		}
+	  		else
+	  		{
+	  			// Reset the value in case it was changed for another clip earlier
+	  			spsList[seq_parameter_set_id]->maxPOCNumChanged = 0;
+	  		}
+	  	}
+  	}
+
+  	if ( IsSPSSupported(sps) == KErrNotSupported )
+  		return KErrNotSupported;
+  	
+
+  	// Store the buffer containing the SPS set in order to later pass it to the 3gpmp4library
+  	// If we use the same sps for both, don't allocate, otherwise allocate
+  	if ( !useOneSPS )
+  	{
+  		
+		// Store the buffer containing the SPS set in order to later pass it to the 3gpmp4library
+  		sps->codedSPSBuffer = (TUint8*) User::Alloc(sps->SPSlength);    
+
+		if (sps->codedSPSBuffer == 0)
+			return PS_ERR_MEM_ALLOC;
+  
+  		for (i=0; i<sps->SPSlength; i++)
+  		{
+  			sps->codedSPSBuffer[i] = bitbuf->data[i];
+  		}
+  	}
+  	else if (possibleIdConflict)
+  	{
+  		// Free the SPS since we will use only one which has been already allocated earlier
+	  	User::Free(sps);
+  	}
+
+
+  	return PS_OK;
+}
+
+
+// ComparePPSSets
+// Compares two input PPS sets to see if a single PPS set could be used for both. 
+// Returns ETrue if the sets are similar enough, EFalse otherwise.
+TInt ComparePPSSets( pic_parameter_set_s *aPPSSet1, pic_parameter_set_s *aPPSSet2 )
+{
+	TUint i;
+
+	// This is the most likely parameter to differ, thus check it first
+	if ( aPPSSet1->pic_init_qp_minus26 != aPPSSet2->pic_init_qp_minus26 ||
+		 aPPSSet1->pic_init_qs_minus26 != aPPSSet2->pic_init_qs_minus26 )
+	{
+		return EFalse;
+	}
+
+	if ( aPPSSet1->entropy_coding_mode_flag != aPPSSet2->entropy_coding_mode_flag )
+	{
+		return EFalse;
+	}
+
+	if ( aPPSSet1->pic_order_present_flag != aPPSSet2->pic_order_present_flag )
+	{
+		return EFalse;
+	}
+
+	if ( aPPSSet1->num_slice_groups_minus1 != aPPSSet2->num_slice_groups_minus1 )
+	{
+		return EFalse;
+	}
+	else
+	{
+	  	if ( aPPSSet1->num_slice_groups_minus1 > 0 ) 
+  		{
+			if ( aPPSSet1->slice_group_map_type != aPPSSet2->slice_group_map_type ) 
+			{
+				return EFalse;
+			}
+			
+	    	switch ( aPPSSet1->slice_group_map_type ) 
+   	 		{
+
+	      		case PS_SLICE_GROUP_MAP_TYPE_INTERLEAVED:
+    	    		for (i = 0; i <= aPPSSet1->num_slice_groups_minus1; i++) 
+        			{
+						if ( aPPSSet1->run_length_minus1[i] != aPPSSet2->run_length_minus1[i] ) 
+						{
+							return EFalse;
+						}
+	        		}
+    	    		break;
+
+      			case PS_SLICE_GROUP_MAP_TYPE_DISPERSED:
+        			break;
+
+	      		case PS_SLICE_GROUP_MAP_TYPE_FOREGROUND:
+    	    		for (i = 0; i < aPPSSet1->num_slice_groups_minus1; i++) 
+        			{
+						if ( aPPSSet1->top_left[i] != aPPSSet2->top_left[i] ||
+						     aPPSSet1->bottom_right[i] != aPPSSet2->bottom_right[i] ) 
+						{
+							return EFalse;
+						}
+	        		}
+    	    		break;
+
+	      		case PS_SLICE_GROUP_MAP_TYPE_CHANGING_3:
+    	  		case PS_SLICE_GROUP_MAP_TYPE_CHANGING_4:
+      			case PS_SLICE_GROUP_MAP_TYPE_CHANGING_5:
+					if ( aPPSSet1->slice_group_change_direction_flag != aPPSSet2->slice_group_change_direction_flag ||
+					     aPPSSet1->slice_group_change_rate_minus1 != aPPSSet2->slice_group_change_rate_minus1 ) 
+					{
+						return EFalse;
+					}
+        			break;
+
+	      		case PS_SLICE_GROUP_MAP_TYPE_EXPLICIT:
+					if ( aPPSSet1->pic_size_in_map_units_minus1 != aPPSSet2->pic_size_in_map_units_minus1 ) 
+					{
+						return EFalse;
+					}
+
+	        		for( i = 0; i <= aPPSSet1->pic_size_in_map_units_minus1; i++ ) 
+    	    		{
+						if ( aPPSSet1->slice_group_id[i] != aPPSSet2->slice_group_id[i] ) 
+						{
+							return EFalse;
+						}
+        			}
+
+	        		break;
+
+    	  		default:
+        			// Cannnot happen 
+        			break;
+  			}
+  		}
+	}
+
+	if ( aPPSSet1->num_ref_idx_l0_active_minus1 != aPPSSet2->num_ref_idx_l0_active_minus1 ||
+		 aPPSSet1->num_ref_idx_l1_active_minus1 != aPPSSet2->num_ref_idx_l1_active_minus1 )
+	{
+		return EFalse;
+	}
+
+	if ( aPPSSet1->weighted_pred_flag != aPPSSet2->weighted_pred_flag ||
+		 aPPSSet1->weighted_bipred_idc != aPPSSet2->weighted_bipred_idc )
+	{
+		return EFalse;
+	}
+
+	if ( aPPSSet1->chroma_qp_index_offset != aPPSSet2->chroma_qp_index_offset )
+	{
+		return EFalse;
+	}
+
+	if ( aPPSSet1->deblocking_filter_parameters_present_flag != aPPSSet2->deblocking_filter_parameters_present_flag )
+	{
+		return EFalse;
+	}
+
+	if ( aPPSSet1->constrained_intra_pred_flag != aPPSSet2->constrained_intra_pred_flag )
+	{
+		return EFalse;
+	}
+
+	if ( aPPSSet1->redundant_pic_cnt_present_flag != aPPSSet2->redundant_pic_cnt_present_flag )
+	{
+		return EFalse;
+	}
+
+	return ETrue;
+}
+
+
+// GetNumTrailingBits
+// Returns the number of trailing (zero) bits in the input bit buffer.
+TInt GetNumTrailingBits(bitbuffer_s *aBitBuffer)
+{
+	TInt i;
+	TUint bit = 0;
+
+	for (i=0; i<8; i++)
+	{
+		// Get the i'th bit from the end
+		bit = (aBitBuffer->data[aBitBuffer->dataLen - 1] & (1 << i)) >> i;
+		if (bit)
+		{
+			return (i);		// Return the number of trailing bits here
+		}
+	}
+	
+	// Return 9 for cases when there are one or more zero byte at the end
+	return (9);
+}
+
+
+// ReturnUnsignedExpGolombCodeLength
+// Returns the amount of bits required for encoding the input aValue with unsigned Exp-Golomb codes.
+TInt ReturnUnsignedExpGolombCodeLength(TUint aValue)
+{
+	TUint codeNumLength;
+	
+	codeNumLength = 0;
+	
+	aValue++;
+	
+	while ( aValue > 1 )
+	{
+		aValue >>= 1;
+		codeNumLength++;
+	}
+
+	// The required code length is codeNumLength*2+1
+	return ((codeNumLength << 1) + 1);
+}
+
+
+// EncodeUnsignedExpGolombCode
+// Encodes the input aValue to the bit buffer with unsigned Exp-Golomb codes.
+void EncodeUnsignedExpGolombCode(bitbuffer_s *aBitBuffer, TUint aValue)
+{
+	TUint codeLength;
+	TUint tempValue = aValue;
+	TInt i;
+	TUint8 byteValue;
+	 
+	// First, compute the required code length
+	codeLength = ReturnUnsignedExpGolombCodeLength(aValue);
+
+	// The Exp-Golomb coded value is the same as value+1 with the prefix zero bits,
+	// thus it can be simply coded by coding value+1 with the number of bits computed 
+	// by the above function.
+	aValue++;	
+
+	// Then write the bits to the bit buffer one bit at a time
+	for (i=codeLength-1; i>=0; i--)
+	{
+		tempValue = (aValue & (1 << i)) >> i;
+		
+		// Zero out the bitpos bit
+		byteValue = aBitBuffer->data[aBitBuffer->bytePos-1] & ~(1<<(aBitBuffer->bitpos-1));
+
+		// Add the bit from the value to be coded and store the result back to bit buffer
+		byteValue |= tempValue << (aBitBuffer->bitpos-1);
+		aBitBuffer->data[aBitBuffer->bytePos-1] = byteValue;
+		aBitBuffer->bitpos--;
+		
+		if(aBitBuffer->bitpos == 0)
+		{
+			aBitBuffer->bytePos++;
+			aBitBuffer->bitpos = 8;
+		}
+	}
+
+ 	// Update the currentBits value 
+ 	aBitBuffer->currentBits = aBitBuffer->data[aBitBuffer->bytePos-1];
+}
+
+
+// ShiftBitBufferBitsRight
+// This function shifts bits right by aDiff in the aBitBuffer, note that if 
+// the shift is more than 8 bits, full bytes should be shifted before calling this function.
+// The gap between unmodified and shofted part of the buffer is filled with zero bits
+void ShiftBitBufferBitsRight(bitbuffer_s *aBitBuffer, TInt aDiff)
+{
+	TUint8 byteValue;
+	TUint8 tempValue;
+	TUint8 bitMask;
+	TInt i;
+	
+ 	// Start from the end, shift bits in each byte until the current byte
+ 	for (i=aBitBuffer->dataLen-1; i>=aBitBuffer->bytePos; i--)
+ 	{
+		bitMask = (1 << aDiff) - 1;	// The aDiff lowest bits
+		
+		// Shift the bits in this byte right by aDiff
+ 		byteValue = aBitBuffer->data[i];
+ 		byteValue >>= aDiff;
+ 		
+ 		// The aDiff lowest bits from the next byte (to the left)
+ 		tempValue = aBitBuffer->data[i-1] & bitMask;
+ 		
+ 		tempValue <<= (8 - aDiff);
+ 		aBitBuffer->data[i] = byteValue | tempValue;
+ 	}
+ 	
+ 	// Take care of the first byte separately
+	bitMask = (1 << aBitBuffer->bitpos) - 1;	// The bitPos lowest bits
+	byteValue = aBitBuffer->data[aBitBuffer->bytePos-1] & bitMask;
+	byteValue >>= aDiff;		// Shift right by aDiff bits
+		
+	bitMask = 255 << (aBitBuffer->bitpos);	// Mask the 8-bitPos upper bits
+		
+	// Write the shifted value back to bit buffer
+	aBitBuffer->data[aBitBuffer->bytePos-1] = (bitMask & aBitBuffer->data[aBitBuffer->bytePos-1]) | byteValue;
+ 	
+ 	// Update the currentBits value 
+ 	aBitBuffer->currentBits = aBitBuffer->data[aBitBuffer->bytePos-1];
+}
+
+
+// ShiftBitBufferBitsLeft
+// This function shifts bits left by aDiff in the aBitBuffer, note that if 
+// the shift is more than 8 bits, full bytes should be shifted before calling this function.
+void ShiftBitBufferBitsLeft(bitbuffer_s *aBitBuffer, TInt aDiff)
+{
+	TUint8 byteValue;
+	TUint8 tempValue;
+	TUint8 bitMask;
+	TInt i;
+	
+	
+ 	// Take care of the first byte separately
+ 	if ( aBitBuffer->bitpos > aDiff )
+ 	{
+		bitMask = (1 << aBitBuffer->bitpos) - 1;	// The aBitBuf->bitpos lowest bits
+		byteValue = aBitBuffer->currentBits & bitMask;
+		
+		// Shift the byteValue left by aDiff
+		byteValue <<= aDiff;
+		// Take only the bitpos lowest bits from this value
+		byteValue &= bitMask;
+		
+		bitMask = 255 << (aBitBuffer->bitpos);	// Mask the 8-bitPos upper bits, i.e. the bits to the left from the start of the shift
+		byteValue = byteValue | (aBitBuffer->currentBits & bitMask);
+		aBitBuffer->data[aBitBuffer->bytePos-1] = byteValue;
+		
+		bitMask = 255 << (8 - aDiff);	// Mask the aDiff upper bits
+		byteValue = aBitBuffer->data[aBitBuffer->bytePos] & bitMask;
+		byteValue >>= (8 - aDiff);
+		
+		// "Add" the aDiff bits from the next byte (msb) to this byte (lsb)
+ 		aBitBuffer->data[aBitBuffer->bytePos-1] |= byteValue;
+ 	}
+ 	else
+ 	{
+		bitMask = 255 << (aBitBuffer->bitpos);	// Mask the 8-bitPos upper bits, i.e. the bits to the left from the start of the shift
+		aBitBuffer->data[aBitBuffer->bytePos-1] = aBitBuffer->currentBits & bitMask;
+		
+		bitMask = (1 << (8-aDiff+aBitBuffer->bitpos)) - 1;	// The 8-diff+aBitBuf->bitpos lowest bits
+		tempValue = aBitBuffer->data[aBitBuffer->bytePos] & bitMask;
+		
+		// Shift tempValue right by 8 - diff bits, resulting in bitpos lowest bits 
+		tempValue >>= (8 - aDiff);
+
+ 		aBitBuffer->data[aBitBuffer->bytePos-1] |= tempValue;
+ 	}
+ 	
+ 	
+ 	// Start from the current byte, shift bits in each byte until the end
+ 	for (i=aBitBuffer->bytePos; i<(aBitBuffer->dataLen-1); i++)
+ 	{
+ 	
+		bitMask = 255 << (8 - aDiff);	// Mask the 8-aDiff upper bits
+		byteValue = aBitBuffer->data[i+1] & bitMask;
+		byteValue >>= (8 - aDiff);
+		
+ 		tempValue = aBitBuffer->data[i];
+ 		tempValue <<= aDiff;
+
+ 		aBitBuffer->data[i] = byteValue | tempValue;
+ 	}
+ 	
+ 	// Take care of the last byte separately, just shift to the left
+	aBitBuffer->data[aBitBuffer->dataLen-1] <<= aDiff;
+ 	
+ 	// Update the currentBits value 
+ 	aBitBuffer->currentBits = aBitBuffer->data[aBitBuffer->bytePos-1];
+}
+
+
+// ShiftBufferLeftByOneByte
+// Shifts the bytes left in the bit buffer by one position starting from the current byte position.
+void ShiftBufferLeftByOneByte(bitbuffer_s *aBitBuffer)
+{
+	TInt i;
+	TUint8 byteValue;
+	TUint8 bitMask;
+
+	
+	// For the current byte, take 8-bitpos upper bits from this byte and bitpos lowest bits from the next 
+	// byte (this is ok since we are shift at least 8 bits when this function is called)
+	bitMask = 255 << (aBitBuffer->bitpos);	// Mask the 8-bitPos upper bits
+	aBitBuffer->data[aBitBuffer->bytePos] &= bitMask;
+
+	bitMask = (1 << aBitBuffer->bitpos) - 1;	// The aBitBuf->bitpos lowest bits
+	byteValue = aBitBuffer->data[aBitBuffer->bytePos+1] & bitMask;
+	aBitBuffer->data[aBitBuffer->bytePos] |= byteValue;
+	
+	// Start from the next byte position, and go through the whole buffer
+ 	for (i=aBitBuffer->bytePos+1; i<(aBitBuffer->dataLen-1); i++)
+ 	{
+ 		// Copy the next byte to here
+		aBitBuffer->data[i] =  	aBitBuffer->data[i+1];
+ 	}
+ 	
+ 	// Adjust the bit buffer length
+ 	aBitBuffer->dataLen--;
+}
+
+
+// ShiftBufferRightByOneByte
+// Shifts the bytes right in the bit buffer by one position starting from the current byte position.
+void ShiftBufferRightByOneByte(bitbuffer_s *aBitBuffer)
+{
+	TInt i;
+	
+	// Start from the last byte position, and go through the whole buffer until the current byte position
+	// Note: also the current byte can be shifted, since the bits that should not be shifted from that byte
+	// will be written over by the new value coded later, thus no error will be there.
+ 	for (i=aBitBuffer->dataLen-1; i>=aBitBuffer->bytePos; i--)
+ 	{
+ 		// Copy the next byte to here
+		aBitBuffer->data[i] =  	aBitBuffer->data[i-1];
+	}
+}
+
+
+// ShiftBufferRight
+// Shifts bits right in the input bit buffer by aDiff value, the bit buffer length is modified if required.
+void ShiftBufferRight(bitbuffer_s *aBitBuffer, TInt aDiff, TUint aTrailingBits, TUint aOldIdLength)
+{
+	TInt i;
+	
+	if ( aDiff >= 8 )
+	{
+		TUint bytesToShift = aDiff / 8;
+				
+		// Add byte(s) to the bit buffer
+		aBitBuffer->dataLen += bytesToShift;
+				
+		// Shift full bytes to right
+		for (i=0; i<bytesToShift; i++)
+		{
+			ShiftBufferRightByOneByte(aBitBuffer);
+			aDiff -= 8;
+		}
+				
+		aDiff = aDiff % 8;
+	}
+	
+	// If there are less trailing bits than we need to shift then we have to add one byte to the buffer		
+	if ( aTrailingBits < aDiff )	
+	{
+		// Have to add byte to the SPS set
+		aBitBuffer->dataLen += 1;
+	}
+
+	if (aDiff != 0)
+	{
+		// Shift the bits in the bit buffer to the right
+		ShiftBitBufferBitsRight(aBitBuffer, aDiff);
+	}
+				
+	// Adjust the bitbuffer bitpos value
+	aBitBuffer->bitpos += aOldIdLength;
+	if ( aBitBuffer->bitpos > 8 )
+	{
+		aBitBuffer->bitpos -= 8;
+		aBitBuffer->bytePos--;
+	}
+}
+
+
+// ShiftBufferLeft
+// Shifts bits left in the input bit buffer by aDiff value.
+void ShiftBufferLeft(bitbuffer_s *aBitBuffer, TInt aDiff, TUint aOldIdLength)
+{
+	TInt i;
+	
+	if (aDiff >= 8)
+	{
+		// Shift full bytes to the left before shifting bits
+		TUint bytesToShift = aDiff / 8;
+
+		// First, adjust the byte position to be correct
+		aBitBuffer->bytePos -= bytesToShift;
+				
+		for (i=0; i<bytesToShift; i++)
+		{
+			ShiftBufferLeftByOneByte(aBitBuffer);
+			aDiff -= 8;
+		}
+	}
+			
+	// Adjust the bit position of the bit buffer
+	aBitBuffer->bitpos += aOldIdLength;
+	if ( aBitBuffer->bitpos > 8 )
+	{
+		aBitBuffer->bitpos -= 8;
+		aBitBuffer->bytePos--;
+					
+		aBitBuffer->currentBits = aBitBuffer->data[aBitBuffer->bytePos-1];
+	}
+			
+	if ( aDiff != 0 )
+	{
+		// Shift the bits in the bit buffer to the left
+		ShiftBitBufferBitsLeft(aBitBuffer, aDiff);
+	}
+	
+}
+
+
+// psParsePPS
+// Parses the input PPS set, the PPS and SPS id's are modified if necessary 
+// and the modified data is stored in codedPPSBuffer.
+TInt psParsePPS( bitbuffer_s *bitbuf, pic_parameter_set_s **ppsList, seq_parameter_set_s **spsList, 
+				 TUint aFrameFromEncoder, TUint *aNumPPS )
+{
+  	pic_parameter_set_s *pps;
+  	TUint i, tmp;
+  	TInt len;
+  	TUint pic_parameter_set_id;
+  	TInt retCode;
+  	TUint pic_size_in_map_units_minus1;
+  	TUint newPPSId = 0;
+  	TUint possibleIdConflict = 0;
+  	TUint modifySPSId = 0;
+  	TUint bitPosit = 0;
+  	TUint bytePosit = 0;
+  	TInt bitSPSPosit = 0;
+  	TUint byteSPSPosit = 0;
+  	TUint useOnePPS = 0;
+
+  	// Parse pps id 
+  	if ((retCode = ue_v(bitbuf, &pic_parameter_set_id, PS_MAX_NUM_OF_PPS-1)) < 0)
+    	return retCode;
+
+  	// Allocate memory for pps if not already allocated
+  	pps = ppsList[pic_parameter_set_id];
+
+  	if (!pps) 
+  	{
+    	pps = (pic_parameter_set_s *) User::Alloc(sizeof(pic_parameter_set_s));
+    	
+    	if (pps == 0) 
+    	{
+      		PRINT((_L("Error while allocating memory for PPS.\n")));
+      		return PS_ERR_MEM_ALLOC;
+    	}
+    
+    	memset( pps, 0, sizeof(pic_parameter_set_s));
+    	ppsList[pic_parameter_set_id] = pps;
+    	
+    	(*aNumPPS)++;
+  	}
+  	else
+  	{
+  		// There might be a conflicting Id with an existing PPS set
+  		// Give the new SPS set the next free PPS Id
+  		possibleIdConflict = 1;
+  		useOnePPS = 1;
+  		newPPSId = 0;
+  	
+  		while (ppsList[newPPSId])
+  		{
+  			newPPSId++;
+  		}
+  	
+  		// Allocate memory for the PPS
+    	pps = (pic_parameter_set_s *) User::Alloc(sizeof(pic_parameter_set_s));
+    	
+    	if (pps == 0) 
+    	{
+      		PRINT((_L("Error while allocating memory for PPS.\n")));
+      		return PS_ERR_MEM_ALLOC;
+    	}
+    
+    	memset( pps, 0, sizeof(pic_parameter_set_s));
+    	pps->pic_parameter_set_id = newPPSId;
+    
+  		// Store the position of the bit buffer
+  		bitPosit = bitbuf->bitpos;
+  		bytePosit = bitbuf->bytePos;
+  	}
+
+
+  	// Parse the rest of the picture parameter set syntax
+  	if ((retCode = ue_v( bitbuf, &pps->seq_parameter_set_id, PS_MAX_NUM_OF_SPS-1)) < 0)
+    	return retCode;
+  
+  	// Check if the Id of the SPS that this PPS refers to has changed (and that 
+  	// the frame originated form the encoder)
+  	if( spsList[pps->seq_parameter_set_id]->indexChanged)
+  	{
+  		if ( !aFrameFromEncoder )
+  		{
+  			if (pps->seq_parameter_set_id != spsList[pps->seq_parameter_set_id]->origSPSId)
+  			{
+		  		// Indicate a changed SPS Id, perform the change at the end (when we know the size of the PPS set)
+  				modifySPSId = ETrue;
+  	
+  				// Store the position of the bit buffer
+  				bitSPSPosit = bitbuf->bitpos;
+  				byteSPSPosit = bitbuf->bytePos;
+  			}
+  		}
+  		else
+  		{
+	  		// Indicate a changed SPS Id, perform the change at the end (when we know the size of the PPS set)
+  			modifySPSId = ETrue;
+	  	
+  			// Store the position of the bit buffer
+  			bitSPSPosit = bitbuf->bitpos;
+  			byteSPSPosit = bitbuf->bytePos;
+  		}
+  	}
+
+  	// Fetch entropy coding mode. Mode is 0 for CAVLC and 1 for CABAC 
+  	if ((retCode = u_n( bitbuf, 1, &pps->entropy_coding_mode_flag)) < 0)
+    	return retCode;
+
+  	// If this flag is 1, POC related syntax elements are present in slice header 
+  	if ((retCode = u_n( bitbuf, 1, &pps->pic_order_present_flag)) < 0)
+    	return retCode;
+
+  	// Fetch the number of slice groups minus 1 
+  	if ((retCode = ue_v( bitbuf, &pps->num_slice_groups_minus1, PS_MAX_NUM_SLICE_GROUPS-1)) < 0)
+    	return retCode;
+
+  	if(pps->num_slice_groups_minus1 > 0 ) 
+  	{
+
+    	if ((retCode = ue_v( bitbuf, &pps->slice_group_map_type, 6)) < 0)
+      		return retCode;
+
+    	switch (pps->slice_group_map_type) 
+    	{
+
+      		case PS_SLICE_GROUP_MAP_TYPE_INTERLEAVED:
+        		for (i = 0; i <= pps->num_slice_groups_minus1; i++) 
+        		{
+          			if ((retCode = ue_v( bitbuf, &pps->run_length_minus1[i], MAX_PIC_SIZE_IN_MBS-1 )) < 0)
+            			return retCode;
+        		}
+        		break;
+
+      		case PS_SLICE_GROUP_MAP_TYPE_DISPERSED:
+        		break;
+
+      		case PS_SLICE_GROUP_MAP_TYPE_FOREGROUND:
+        		for (i = 0; i < pps->num_slice_groups_minus1; i++) 
+        		{
+          			// Fetch MB address of the top-left corner 
+          			if ((retCode = ue_v( bitbuf, &pps->top_left[i], MAX_PIC_SIZE_IN_MBS-1)) < 0)
+            			return retCode;
+          			// Fetch MB address of the bottom-right corner (top-left address must 
+          			// be smaller than or equal to bottom-right address)                  
+          			if ((retCode = ue_v( bitbuf, &pps->bottom_right[i], MAX_PIC_SIZE_IN_MBS-1)) < 0)
+            			return retCode;
+
+          			if (pps->top_left[i] > pps->bottom_right[i])
+            			return PS_ERR_ILLEGAL_VALUE;
+        		}
+        		break;
+
+      		case PS_SLICE_GROUP_MAP_TYPE_CHANGING_3:
+      		case PS_SLICE_GROUP_MAP_TYPE_CHANGING_4:
+      		case PS_SLICE_GROUP_MAP_TYPE_CHANGING_5:
+        		if ((retCode = u_n( bitbuf, 1, &pps->slice_group_change_direction_flag)) < 0)
+          			return retCode;
+        		if ((retCode = ue_v( bitbuf, &pps->slice_group_change_rate_minus1, MAX_PIC_SIZE_IN_MBS-1)) < 0)
+          			return retCode;
+        		break;
+
+      		case PS_SLICE_GROUP_MAP_TYPE_EXPLICIT:
+
+        		if ((retCode = ue_v( bitbuf, &pic_size_in_map_units_minus1, MAX_PIC_SIZE_IN_MBS-1 )) < 0)
+          			return retCode;
+
+        		// Allocate array for slice group ids if not already allocated 
+        		if (pic_size_in_map_units_minus1 != pps->pic_size_in_map_units_minus1) 
+        		{
+          			User::Free(pps->slice_group_id);
+
+          			pps->slice_group_id = (unsigned int *)User::Alloc( (pic_size_in_map_units_minus1+1) * sizeof(int));
+
+					if (pps->slice_group_id == 0)
+                        return PS_ERR_MEM_ALLOC;
+
+          			pps->pic_size_in_map_units_minus1 = pic_size_in_map_units_minus1;
+        		}
+
+        		// Calculate len = ceil( Log2( num_slice_groups_minus1 + 1 ) )
+        		tmp = pps->num_slice_groups_minus1 + 1;
+        		tmp = tmp >> 1;
+        		for( len = 0; len < 16 && tmp != 0; len++ )
+          			tmp >>= 1;
+        		
+        		if ( (((unsigned)1)<<len) < (pps->num_slice_groups_minus1 + 1) )
+          			len++;
+
+        		for( i = 0; i <= pps->pic_size_in_map_units_minus1; i++ ) 
+        		{
+          			if ((retCode = u_n( bitbuf, len, &pps->slice_group_id[i])) < 0)
+            			return retCode;
+        		}
+
+        		break;
+
+      		default:
+        		// Cannnot happen 
+        		break;
+    		}
+  	}
+
+  	if ((retCode = ue_v( bitbuf, &pps->num_ref_idx_l0_active_minus1, 31 )) < 0)
+    	return retCode;
+
+  	if ((retCode = ue_v( bitbuf, &pps->num_ref_idx_l1_active_minus1, 31 )) < 0)
+    	return retCode;
+
+  	if ((retCode = u_n( bitbuf, 1, &pps->weighted_pred_flag)) < 0)
+    	return retCode;
+
+  	if ((retCode = u_n( bitbuf, 2, &pps->weighted_bipred_idc)) < 0)
+    	return retCode;
+
+  	if (pps->weighted_bipred_idc > 2)
+    	return PS_ERR_ILLEGAL_VALUE;
+
+  	if ((retCode = se_v( bitbuf, &pps->pic_init_qp_minus26, -26, 25 )) < 0)
+    	return retCode;
+
+  	if ((retCode = se_v( bitbuf, &pps->pic_init_qs_minus26, -26, 25  )) < 0)
+    	return retCode;
+
+  	if ((retCode = se_v( bitbuf, &pps->chroma_qp_index_offset, -12, 12 )) < 0)
+    	return retCode;
+
+  	pps->chroma_qp_index_offset = clip(MIN_CHROMA_QP_INDEX, MAX_CHROMA_QP_INDEX, pps->chroma_qp_index_offset);
+
+  	if ((retCode = u_n( bitbuf, 1, &pps->deblocking_filter_parameters_present_flag )) < 0)
+    	return retCode;
+
+  	if ((retCode = u_n( bitbuf, 1, &pps->constrained_intra_pred_flag )) < 0)
+    	return retCode;
+
+  	if ((retCode = u_n( bitbuf, 1, &pps->redundant_pic_cnt_present_flag )) < 0)
+    	return retCode;
+
+  	if (bibSkipTrailingBits(bitbuf) < 0)
+    	return PS_ERROR;
+
+  	// Store the size of the PPS set
+  	pps->PPSlength = bitbuf->bytePos;
+  
+	syncBitBufferBitpos(bitbuf);
+	
+  	// If we had a possible conflict, compare the PPS sets with the same id to see if only one PPS set can be used.
+  	if (possibleIdConflict)
+  	{
+		useOnePPS = ComparePPSSets(ppsList[pic_parameter_set_id],pps);
+
+	  	if (!useOnePPS)
+	  	{
+  			TUint trailingBits = GetNumTrailingBits(bitbuf);
+  			TInt diff = 0;
+			TUint oldPPSId = pic_parameter_set_id;
+			TUint oldIdLength = ReturnUnsignedExpGolombCodeLength(oldPPSId);
+			TUint newIdLength = ReturnUnsignedExpGolombCodeLength(newPPSId);
+
+	  		for (i=0; i<PS_MAX_NUM_OF_PPS; i++)
+  			{
+  				// Compared if a previously stored PPS might be used
+  				if (ppsList[i])
+					useOnePPS = ComparePPSSets(ppsList[i],pps);
+  			
+	  			if (useOnePPS)
+  				{
+  					// Check also that the SPS id's match
+				  	if ( modifySPSId )
+				  	{
+						if (spsList[pps->seq_parameter_set_id]->newSPSId != ppsList[i]->seq_parameter_set_id)
+							useOnePPS = 0;
+						else
+						{
+	  						// We can use this previously generated PPSId here also
+  							newPPSId = i;
+  							break;	
+						}
+				  	}
+				  	else
+				  	{
+						if (pps->seq_parameter_set_id != ppsList[i]->seq_parameter_set_id)
+							useOnePPS = 0;
+						else
+						{
+	  						// We can use this previously generated PPSId here also
+  							newPPSId = i;
+  							break;	
+						}
+				  	}
+  				}
+  			}
+		
+	  		if ( newPPSId > PS_MAX_NUM_OF_PPS )
+	  		{
+	  			// We have reached maximum number of PPS, return an error
+	  			return PS_ERROR;
+	  		}	
+	  	
+	    	(*aNumPPS)++;
+
+	  		// Set indexChanged to true and give the new index to old PPS, so that (new) slices can refer to the new PPS
+	  		ppsList[pic_parameter_set_id]->indexChanged = 1;
+	  		ppsList[pic_parameter_set_id]->newPPSId = newPPSId;	// The new Id
+	  	
+	  		if (aFrameFromEncoder)
+		  		ppsList[pic_parameter_set_id]->encPPSId = newPPSId;		// The new Id
+			else
+		  		ppsList[pic_parameter_set_id]->origPPSId = newPPSId;	// The new Id
+		  	
+	  		// Store the new PPS at the new index, unless we are using a previously stored PPS
+			if (!ppsList[newPPSId])
+		  		ppsList[newPPSId] = pps;
+  		
+			// Restore the bit buffer position at the PPS Id
+			bitbuf->bitpos = bitPosit;
+			bitbuf->bytePos = bytePosit;
+		
+			if(trailingBits > 8)
+			{	
+				trailingBits = 8;
+			}
+		
+			if ( oldIdLength == newIdLength )
+			{	
+				// Just encode the new Id on top of the old Id
+				bitbuf->bitpos += oldIdLength;
+				if (bitbuf->bitpos > 8)
+				{	
+					// Go to the right byte and bit position
+					bitbuf->bytePos -= bitbuf->bitpos / 8;
+					bitbuf->bitpos = bitbuf->bitpos % 8;
+				}
+				
+				EncodeUnsignedExpGolombCode(bitbuf, newPPSId);
+			}
+			else if ( oldIdLength < newIdLength )
+			{
+				diff = newIdLength - oldIdLength;
+			
+				// Adjust the PPS length
+				if (diff >= 8)
+				{
+					// Add as many extra bytes as is required
+					pps->PPSlength += (diff / 8);
+				}
+			
+				if ( trailingBits < (diff % 8) )
+				{
+					// Add one byte since there aren't enough trailing bits for the extra bits
+					pps->PPSlength += 1;
+				}
+			
+				ShiftBufferRight(bitbuf, diff, trailingBits, oldIdLength);
+
+				// After shifting, encode the new value to the bit buffer
+				EncodeUnsignedExpGolombCode(bitbuf, newPPSId);
+			}
+			else
+			{
+				// New id's length is smaller than old id's length
+				diff = oldIdLength - newIdLength;
+			
+				if (diff >= 8)
+				{
+					// Adjust the PPS length
+					pps->PPSlength -= (diff / 8);
+				}
+			
+				ShiftBufferLeft(bitbuf, diff, oldIdLength);
+			
+				// After shifting, encode the new value to the bit buffer
+				EncodeUnsignedExpGolombCode(bitbuf, newPPSId);
+			}
+
+	  		// Store the position of the bit buffer for possible SPS id modification
+  			// The right bit position is the current minus the size of the SPS id length
+  			bitSPSPosit = bitbuf->bitpos - ReturnUnsignedExpGolombCodeLength(pps->seq_parameter_set_id);
+  			byteSPSPosit = bitbuf->bytePos;
+  		
+  			if(bitSPSPosit < 1)
+  			{
+	  			byteSPSPosit++;
+  				bitSPSPosit += 8;
+  			}
+		}
+		else
+		{
+	  		// In case the index was changed for some earlier PPS, 
+	  		// reset the index changed value back to zero
+	  		ppsList[pic_parameter_set_id]->indexChanged = 0;
+		}
+  	}
+  
+  	if ( modifySPSId )
+  	{
+  		TUint trailingBits = GetNumTrailingBits(bitbuf);
+  		TInt diff = 0;
+
+		TUint oldSPSId = pps->seq_parameter_set_id;
+		TUint newSPSId = spsList[pps->seq_parameter_set_id]->newSPSId;
+		
+		TUint oldIdLength = ReturnUnsignedExpGolombCodeLength(oldSPSId);
+		TUint newIdLength = ReturnUnsignedExpGolombCodeLength(newSPSId);
+		
+		
+		// Restore the bit buffer position at the SPS Id
+		bitbuf->bitpos = bitSPSPosit;
+		bitbuf->bytePos = byteSPSPosit;
+		
+		if(trailingBits > 8)
+		{
+			trailingBits = 8;
+		}
+		
+		if ( oldIdLength == newIdLength )
+		{
+			// Just encode the new Id on top of the old Id
+			bitbuf->bitpos += oldIdLength;
+			if(bitbuf->bitpos > 8)
+			{	
+				// Go to the right byte and bit position
+				bitbuf->bytePos -= bitbuf->bitpos / 8;
+				bitbuf->bitpos = bitbuf->bitpos % 8;
+			}
+		
+			EncodeUnsignedExpGolombCode(bitbuf, newSPSId);
+		}
+		else if ( oldIdLength < newIdLength )
+		{
+			diff = newIdLength - oldIdLength;
+			
+			// Adjust the PPS length
+			if (diff >= 8)
+			{
+				// Add as many extra bytes as is required
+				pps->PPSlength += (diff / 8);
+			}
+		
+			if ( trailingBits < (diff % 8) )
+			{
+				// Add one byte since there aren't enough trailing bits for the extra bits
+				pps->PPSlength += 1;
+			}
+			
+			ShiftBufferRight(bitbuf, diff, trailingBits, oldIdLength);
+
+			// After shifting, encode the new value to the bit buffer
+			EncodeUnsignedExpGolombCode(bitbuf, newSPSId);
+			
+		}
+		else
+		{
+			// New id's length is smaller than old id's length
+			diff = oldIdLength - newIdLength;
+			
+			if (diff >= 8)
+			{
+				// Adjust the PPS length
+				pps->PPSlength -= (diff / 8);
+			}
+			
+			ShiftBufferLeft(bitbuf, diff, oldIdLength);
+			
+			// After shifting, encode the new value to the bit buffer
+			EncodeUnsignedExpGolombCode(bitbuf, newSPSId);
+		}
+  
+  		// Modify the SPS id in the pps
+  		pps->seq_parameter_set_id = newSPSId;	
+  	}
+  
+	if ( IsPPSSupported(pps) == KErrNotSupported )
+  		return KErrNotSupported;
+  
+  	
+  	// Allocate memory for the encoded PPS data in case we have a new PPS (i.e. a new original PPS or a PPS with a new index)  
+  	if ( !useOnePPS )
+  	{
+		// Store the buffer containing the PPS set in order to later pass it to the 3gpmp4library
+  		pps->codedPPSBuffer = (TUint8*) User::Alloc(pps->PPSlength);    
+
+		if (pps->codedPPSBuffer == 0)
+		    return PS_ERR_MEM_ALLOC;
+  
+  		for (i=0; i<pps->PPSlength; i++)
+  		{
+  			pps->codedPPSBuffer[i] = bitbuf->data[i];
+  		}
+  	}
+  	else if (possibleIdConflict)
+  	{
+  		// In case of conflicting id and one PPS, free the PPS allocated here
+	  	User::Free(pps);
+  	}
+
+  	return PS_OK;
+}
+
+#endif  // VIDEOEDITORENGINE_AVC_EDITING
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/sequence.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,2074 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "globals.h"
+#include "bitbuffer.h"
+#include "vld.h"
+#include "framebuffer.h"
+#include "avcdapi.h"
+#include "parameterset.h"
+#include "dpb.h"
+#include "sequence.h"
+
+
+#define SEQ_OK                      0
+#define SEQ_ERROR                  -1
+#define SEQ_ERR_MEM                -2
+#define SEQ_ERR_GAPS_IN_FRAME_NUM  -3
+#define SEQ_ERR_DPB_CORRUPTED      -4
+
+// Definitions of SEI types
+#define SEI_TYPE_SCENE_INFO       9
+
+
+#ifdef CHECK_MV_RANGE
+int maxVerticalMvRange;
+#endif
+
+
+void GenerateEmptyFrame(sequence_s *seq, bitbuffer_s *bitbuf, TUint aFrameNumber);
+
+
+
+/*
+ * setLower4Bits:
+ *
+ * Parameters:
+ *      value               the destination to store the 4 bits
+ *      bits                the 4 bits to be copied
+ *
+ * Function:
+ *      Assign the value to the lowest 4 bits
+ *
+ *  Return:
+ *      -
+ */
+#define setLower4Bits(value, bits) (value) = ((value) & ~0xF) | ((bits))
+
+
+/*
+ *
+ * avcdOpen:
+ *
+ * Parameters:
+ *      -
+ *
+ * Function:
+ *      Open AVC decoder.
+ *      
+ * Returns:
+ *      Pointer to initialized avcdDecoder_t object
+ */
+avcdDecoder_t *avcdOpen()
+{
+  sequence_s *seq;
+
+
+  // Allocate sequence object
+  if ((seq = (sequence_s *)User::Alloc(sizeof(sequence_s))) == NULL)
+    return NULL;
+
+  memset(seq, 0, sizeof(sequence_s));
+  
+  // Open bitbuffer
+  if ((seq->bitbuf = bibOpen()) == NULL)
+    return NULL;
+
+  seq->isFirstSliceOfSeq       = 1;
+  seq->unusedShortTermFrameNum = -1;
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+  // Open slices
+  if ((seq->currSlice = sliceOpen()) == NULL)
+    return NULL;
+
+  if ((seq->nextSlice = sliceOpen()) == NULL)
+    return NULL;
+
+  // Open dpb
+  if ((seq->dpb = dpbOpen()) == NULL)
+    return NULL;
+
+	seq->iFrameNumber = 0;
+	seq->iFromEncoder = 0;
+	seq->iEncodeUntilIDR = 0;
+	seq->iBitShiftInSlice = 0;
+	seq->iPreviousPPSId = 0;
+	seq->iNumSPS = 0;
+	seq->iNumPPS = 0;
+
+	seq->iTotalFrameNumber = 0;
+
+#endif  // VIDEOEDITORENGINE_AVC_EDITING
+	
+  return seq;
+}
+
+
+/*
+ *
+ * avcdClose:
+ *
+ * Parameters:
+ *      seq                   Sequence object
+ *
+ * Function:
+ *      Close sequence.
+ *      
+ * Returns:
+ *      -
+ */
+void avcdClose(avcdDecoder_t *dec)
+{
+  sequence_s *seq = (sequence_s *)dec;
+  
+  /* Close bitbuffer */
+  bibClose(seq->bitbuf);
+  
+  /* Close parameter sets */
+  psCloseParametersSets(seq->spsList, seq->ppsList);
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+  /* Close current frame */
+  frmClose(seq->recoBuf, seq->mbData);
+
+  /* Close decoded picture buffer */
+  dpbClose(seq->dpb);
+
+  /* Close slices */
+  sliceClose(seq->currSlice);
+  sliceClose(seq->nextSlice);
+
+#endif  // VIDEOEDITORENGINE_AVC_EDITING
+
+  User::Free(seq);
+}
+
+
+/*
+ *
+ * initSPSParsing
+ *
+ * Parameters:
+ *      dec                   Sequence object
+ *      nauUnitBits           Buffer containing SPS NAL unit
+ *      nalUnitLen            Length of buffer
+ *
+ * Function:
+ *      Initialises bit buffer for parsing, checks
+ *      nal_unit_type
+ *      
+ * Returns:
+ *      KErrNone for no error, negative value for error
+ */
+TInt initSPSParsing(avcdDecoder_t *dec, void *nalUnitBits, TUint* nalUnitLen)
+{
+    sequence_s *seq = (sequence_s *)dec;
+
+    TInt nalHeaderByte;
+    TInt nalType;
+    TUint nalUnitLength = *nalUnitLen;
+    
+    // tempData allocation
+    TUint8* tempData = (TUint8*) User::Alloc(nalUnitLength);
+  	
+  	if (!tempData)
+  	    return KErrNoMemory;
+  	
+  	Mem::Copy(tempData, nalUnitBits, nalUnitLength);  	  	
+
+    if (bibInit(seq->bitbuf, tempData, nalUnitLength) < 0)
+    {
+        User::Free(seq->bitbuf->data);
+        return AVCD_ERROR;
+    }
+    
+    if (bibGetByte(seq->bitbuf, &nalHeaderByte))
+    {
+        User::Free(seq->bitbuf->data);
+        return AVCD_ERROR;
+    }
+    
+    // Decode NAL unit type
+    nalType   = nalHeaderByte & 0x1F;    
+    
+    if (nalType != NAL_TYPE_SPS)
+    {
+        User::Free(seq->bitbuf->data);
+        return AVCD_ERROR;
+    }
+    
+    return KErrNone;
+}
+
+/*
+ *
+ * avcdParseLevel
+ *
+ * Parameters:
+ *      dec                   Sequence object
+ *      nauUnitBits           Buffer containing SPS NAL unit
+ *      nalUnitLen            Length of buffer
+ *      aLevel                [output]Parsed level
+ *
+ * Function:
+ *      Parses AVC level from SPS
+ *      
+ * Returns:
+ *      KErrNone for no error, negative value for error
+ */
+TInt avcdParseLevel(avcdDecoder_t *dec, void *nalUnitBits, TUint* nalUnitLen, TInt& aLevel)                    
+{
+
+    TInt error = initSPSParsing(dec, nalUnitBits, nalUnitLen);
+    
+    if (error < 0)
+    	return AVCD_ERROR;
+
+    sequence_s *seq = (sequence_s *)dec;
+
+    error = psParseLevelFromSPS(seq->bitbuf, aLevel);
+
+    User::Free(seq->bitbuf->data);
+    
+    if (error < 0)
+    	return AVCD_ERROR;
+    
+    return KErrNone;    	    
+
+}
+
+/*
+ *
+ * avcdParseResolution
+ *
+ * Parameters:
+ *      dec                   Sequence object
+ *      nauUnitBits           Buffer containing SPS NAL unit
+ *      nalUnitLen            Length of buffer
+ *      aResolution           [output]Parsed resolution
+ *
+ * Function:
+ *      Parses resolution from SPS
+ *      
+ * Returns:
+ *      KErrNone for no error, negative value for error
+ */
+TInt avcdParseResolution(avcdDecoder_t *dec, void *nalUnitBits, TUint* nalUnitLen, 
+                         TInt& aWidth, TInt& aHeight)
+{
+
+    TInt error = initSPSParsing(dec, nalUnitBits, nalUnitLen);
+    
+    if (error < 0)
+    	return AVCD_ERROR;
+
+    sequence_s *seq = (sequence_s *)dec;
+
+    error = psDecodeSPS(seq->bitbuf, seq->spsList, aWidth, aHeight);
+
+    User::Free(seq->bitbuf->data);
+    
+    if (error < 0)
+    	return AVCD_ERROR;
+    
+    return KErrNone;    	    
+    
+}
+
+
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+
+/*
+ *
+ * slidingWindowDecRefPicMarking:
+ *
+ * Parameters:
+ *      seq                   Sequence object
+ *
+ * Function:
+ *      Sliding window decoded reference picture marking. Reference pictures
+ *      in dpb are marked based on first in first out principle.
+ *      
+ * Returns:
+ *      SEQ_OK for no error, negative value for error
+ */
+static int slidingWindowDecRefPicMarking(sequence_s *seq)
+{
+  dpb_s *dpb;
+  int numRefPics;
+
+  dpb = seq->dpb;
+
+  numRefPics = dpb->numShortTermPics + dpb->numLongTermPics;
+
+  /* If dpb contains maximum number of reference pitures allowed, short */
+  /*  term reference picture with lowest picture number is removed.     */
+  if (numRefPics == dpb->maxNumRefFrames) {
+    if (dpb->numShortTermPics == 0) {
+      PRINT((_L("numShortTerm must be greater than zero\n")));
+      return SEQ_ERR_DPB_CORRUPTED;
+    }
+
+    dpbMarkLowestShortTermPicAsNonRef(dpb);
+  }
+
+  return SEQ_OK;
+}
+
+
+/*
+ *
+ * adaptiveDecRefPicMarking:
+ *
+ * Parameters:
+ *      seq                   Sequence object
+ *
+ * Function:
+ *      Adaptive decoded reference picture marking. Reference pictures in dpb
+ *      are marked based on memory management command operations that were
+ *      decoded in slice header earlier.
+ *      
+ * Returns:
+ *      SEQ_OK for no error, SEQ_ERR_DPB_CORRUPTED for error in DPB
+ */
+static int adaptiveDecRefPicMarking(sequence_s *seq)
+{
+  dpb_s *dpb;
+  sliceMMCO_s *mmcoCmdList;
+  int32 currPicNum, picNumX;
+  int i;
+
+  dpb = seq->dpb;
+  currPicNum = seq->currSlice->frame_num;
+  mmcoCmdList = seq->currSlice->mmcoCmdList;
+
+  i = 0;
+  do {
+    switch (mmcoCmdList[i].memory_management_control_operation) {
+      case 1:
+        picNumX = currPicNum - (mmcoCmdList[i].difference_of_pic_nums_minus1 + 1);
+        if (dpbMarkShortTermPicAsNonRef(dpb, picNumX) < 0)
+          return SEQ_ERR_DPB_CORRUPTED;
+        break;
+      case 2:
+        if (dpbMarkLongTermPicAsNonRef(dpb, mmcoCmdList[i].long_term_pic_num) < 0)
+          return SEQ_ERR_DPB_CORRUPTED;
+        break;
+      case 3:
+        picNumX = currPicNum - (mmcoCmdList[i].difference_of_pic_nums_minus1 + 1);
+        if (dpbMarkShortTermPicAsLongTerm(dpb, picNumX, mmcoCmdList[i].long_term_frame_idx) < 0)
+          return SEQ_ERR_DPB_CORRUPTED;
+        break;
+      case 4:
+        dpbSetMaxLongTermFrameIdx(dpb, mmcoCmdList[i].max_long_term_frame_idx_plus1);
+        break;
+      case 5:
+        dpbMarkAllPicsAsNonRef(dpb);
+        dpb->maxLongTermFrameIdx = -1;
+        break;
+      case 6:
+        /* To avoid duplicate of longTermFrmIdx */
+        dpbVerifyLongTermFrmIdx(dpb, mmcoCmdList[i].long_term_frame_idx);
+
+        seq->recoBuf->refType        = FRM_LONG_TERM_PIC;
+        seq->recoBuf->longTermFrmIdx = mmcoCmdList[i].long_term_frame_idx;
+        break;
+    }
+    i++;
+  } while (mmcoCmdList[i].memory_management_control_operation != 0 && i < MAX_NUM_OF_MMCO_OPS);
+
+  return SEQ_OK;
+}
+
+
+/*
+ *
+ * decRefPicMarking:
+ *
+ * Parameters:
+ *      seq                   Sequence object
+ *
+ * Function:
+ *      Decoded reference picture marking. Reference pictures in dpb are marked
+ *      differently depending on whether current picture is IDR picture or not
+ *      and whether it is reference picture or non-reference picture.
+ *      If current picture is non-IDR reference picture, reference pictures are
+ *      marked with either sliding window marking process or adaptive marking
+ *      process depending on the adaptiveRefPicMarkingModeFlag flag.
+ *      
+ * Returns:
+ *      -
+ */
+static int decRefPicMarking(sequence_s *seq)
+{
+  slice_s *slice;
+  frmBuf_s *recoBuf;
+
+  slice = seq->currSlice;
+  recoBuf = seq->recoBuf;
+
+  recoBuf->refType  = FRM_SHORT_TERM_PIC;
+  recoBuf->frameNum = slice->frame_num;
+  recoBuf->hasMMCO5 = slice->picHasMMCO5;
+  recoBuf->isIDR    = slice->isIDR;
+
+  if (slice->isIDR) {
+    recoBuf->idrPicID = slice->idr_pic_id;
+
+    /* All reference frames are marked as non-reference frames */
+    dpbMarkAllPicsAsNonRef(seq->dpb);
+
+    /* Set reference type for current picture */
+    if (!slice->long_term_reference_flag) {
+      seq->dpb->maxLongTermFrameIdx = -1;
+    }
+    else {
+      recoBuf->refType         = FRM_LONG_TERM_PIC;
+      recoBuf->longTermFrmIdx  = 0;
+      seq->dpb->maxLongTermFrameIdx = 0;
+    }
+  }
+  else if (slice->nalRefIdc != 0) {
+    if (!slice->adaptive_ref_pic_marking_mode_flag)
+      return slidingWindowDecRefPicMarking(seq);
+    else
+      return adaptiveDecRefPicMarking(seq);
+  }
+  else
+    recoBuf->refType  = FRM_NON_REF_PIC;
+
+  return SEQ_OK;
+} 
+
+
+/*
+ *
+ * buildSliceGroups:
+ *
+ * Parameters:
+ *      seq                   Sequence object
+ *      slice                 Slice object
+ *      sps                   Sequence parameter set
+ *      pps                   Picture parameter set
+ *
+ * Function:
+ *      Build slice group map. Syntax elements for slice groups are
+ *      in active picture parameter set.
+ *      
+ * Returns:
+ *      -
+ *
+ */
+static void buildSliceGroups(sequence_s* seq, slice_s *slice,
+                             seq_parameter_set_s *sps, pic_parameter_set_s *pps)
+{
+  int xTopLeft, yTopLeft;
+  int xBottomRight, yBottomRight;
+  int x, y;
+  int leftBound, topBound;
+  int rightBound, bottomBound;
+  int xDir, yDir;
+  int mapUnitsInSliceGroup0;
+  int mapUnitVacant;
+  int sizeOfUpperLeftGroup;
+  int iGroup, picSizeInMapUnits;
+  int picWidthInMbs, picHeightInMapUnits;
+  int i, j, k;
+  int *sliceMap;
+
+  sliceMap = seq->mbData->sliceMap;
+
+  picWidthInMbs = sps->pic_width_in_mbs_minus1+1;
+  picHeightInMapUnits = sps->pic_height_in_map_units_minus1+1;
+
+  picSizeInMapUnits = picWidthInMbs * picHeightInMapUnits;
+
+  if (pps->num_slice_groups_minus1 == 0) {
+    /* Only one slice group */
+    for (i = 0; i < picSizeInMapUnits; i++)
+      sliceMap[i] = 0;
+  }
+  else {
+    /* There are more than one slice groups in this picture */
+
+    switch (pps->slice_group_map_type) {
+
+    case PS_SLICE_GROUP_MAP_TYPE_INTERLEAVED:
+      i = 0;
+      do {
+        for (iGroup = 0; iGroup <= (int)pps->num_slice_groups_minus1 && i < picSizeInMapUnits;
+          i += pps->run_length_minus1[iGroup++] + 1)
+        {
+          for (j = 0; j <= (int)pps->run_length_minus1[iGroup] && i+j < picSizeInMapUnits; j++)
+            sliceMap[i+j] = iGroup;   /* Only the group number */
+        }
+      } while (i < picSizeInMapUnits);
+      break;
+
+    case PS_SLICE_GROUP_MAP_TYPE_DISPERSED:
+      for ( i = 0; i < picSizeInMapUnits; i++ )
+        sliceMap[i] = ( ( i % picWidthInMbs ) + 
+        ( ( ( i / picWidthInMbs ) * ( pps->num_slice_groups_minus1 + 1 ) ) / 2 ) )
+        % ( pps->num_slice_groups_minus1 + 1 );
+      break;
+
+    case PS_SLICE_GROUP_MAP_TYPE_FOREGROUND:
+      for (i = 0; i < picSizeInMapUnits; i++)
+        setLower4Bits(sliceMap[i], pps->num_slice_groups_minus1);
+      for (iGroup = pps->num_slice_groups_minus1 - 1; iGroup >= 0; iGroup--) {
+        yTopLeft = pps->top_left[iGroup] / picWidthInMbs;
+        xTopLeft = pps->top_left[iGroup] % picWidthInMbs;
+        yBottomRight = pps->bottom_right[iGroup] / picWidthInMbs;
+        xBottomRight = pps->bottom_right[iGroup] % picWidthInMbs;
+        for (y = yTopLeft; y <= yBottomRight; y++)
+          for (x = xTopLeft; x <= xBottomRight; x++)
+            sliceMap[y * picWidthInMbs + x] = iGroup;
+      }
+      break;
+
+    case PS_SLICE_GROUP_MAP_TYPE_CHANGING_3:
+      /* mapUnitsInSliceGroup0 */
+      mapUnitsInSliceGroup0 =	min((int)(slice->slice_group_change_cycle * (pps->slice_group_change_rate_minus1+1)), picSizeInMapUnits);
+
+      for (i = 0; i < picSizeInMapUnits; i++)
+        sliceMap[i] = 1; // mapUnitToSliceGroupMap[ i ] = 1;
+
+      x = (picWidthInMbs - pps->slice_group_change_direction_flag) / 2;
+      y = (picHeightInMapUnits - pps->slice_group_change_direction_flag ) / 2;
+      // ( leftBound, topBound ) = ( x, y )
+      leftBound = x; 
+      topBound = y;
+      // ( rightBound, bottomBound ) = ( x, y )
+      rightBound = x; 
+      bottomBound = y;
+      // ( xDir, yDir ) = ( slice_group_change_direction_flag - 1, slice_group_change_direction_flag )
+      xDir = pps->slice_group_change_direction_flag - 1;
+      yDir = pps->slice_group_change_direction_flag;
+      for (i = 0; i < mapUnitsInSliceGroup0; i += mapUnitVacant) {
+        mapUnitVacant = ( (sliceMap[y * picWidthInMbs + x] & 0xF) == 1);
+        if (mapUnitVacant)
+          setLower4Bits(sliceMap[y * picWidthInMbs + x], 0);
+        if (xDir == -1 && x == leftBound) {
+          leftBound = max(leftBound - 1, 0);
+          x = leftBound;
+          //( xDir, yDir ) = ( 0, 2 * slice_group_change_direction_flag - 1 )
+          xDir = 0;
+          yDir = 2 * pps->slice_group_change_direction_flag - 1;
+        } 
+        else if (xDir == 1 && x == rightBound) {
+          rightBound = min(rightBound + 1, picWidthInMbs - 1);
+          x = rightBound;
+          //( xDir, yDir ) = ( 0, 1 - 2 * slice_group_change_direction_flag )
+          xDir = 0;
+          yDir = 1 - 2 * pps->slice_group_change_direction_flag;
+        } 
+        else if (yDir == -1 && y == topBound) {
+          topBound = max(topBound - 1, 0);
+          y = topBound;
+          //( xDir, yDir ) = ( 1 - 2 * slice_group_change_direction_flag, 0 )
+          xDir = 1 - 2 * pps->slice_group_change_direction_flag;
+          yDir = 0;
+        } 
+        else if (yDir == 1 && y == bottomBound) {
+          bottomBound = min(bottomBound + 1, picHeightInMapUnits - 1);
+          y = bottomBound;
+          //( xDir, yDir ) = ( 2 * slice_group_change_direction_flag - 1, 0 )
+          xDir = 2 * pps->slice_group_change_direction_flag - 1;
+          yDir = 0;
+        } 
+        else {
+          //( x, y ) = ( x + xDir, y + yDir )
+          x = x + xDir;
+          y = y + yDir;
+        }
+      }
+      break;
+
+    case PS_SLICE_GROUP_MAP_TYPE_CHANGING_4:
+      /* mapUnitsInSliceGroup0 */
+      mapUnitsInSliceGroup0 =	min((int)(slice->slice_group_change_cycle * (pps->slice_group_change_rate_minus1+1)), picSizeInMapUnits);
+
+      sizeOfUpperLeftGroup = ( pps->slice_group_change_direction_flag ? 
+			                        ( picSizeInMapUnits - mapUnitsInSliceGroup0 ) : mapUnitsInSliceGroup0 );
+
+      for( i = 0; i < picSizeInMapUnits; i++ )
+        if( i < sizeOfUpperLeftGroup )
+          sliceMap[ i ] = pps->slice_group_change_direction_flag;
+        else
+          sliceMap[ i ] = 1 - pps->slice_group_change_direction_flag;
+      break;
+
+    case PS_SLICE_GROUP_MAP_TYPE_CHANGING_5:
+      /* mapUnitsInSliceGroup0 */
+      mapUnitsInSliceGroup0 =	min((int)(slice->slice_group_change_cycle * (pps->slice_group_change_rate_minus1+1)), picSizeInMapUnits);
+
+      sizeOfUpperLeftGroup = ( pps->slice_group_change_direction_flag ? 
+			                        ( picSizeInMapUnits - mapUnitsInSliceGroup0 ) : mapUnitsInSliceGroup0 );
+
+      k = 0;
+      for( j = 0; j < picWidthInMbs; j++ )
+        for( i = 0; i < picHeightInMapUnits; i++ )
+          if( k++ < sizeOfUpperLeftGroup )
+            sliceMap[ i * picWidthInMbs + j ] = pps->slice_group_change_direction_flag;
+          else
+            sliceMap[ i * picWidthInMbs + j ] = 1 - pps->slice_group_change_direction_flag;
+      break;
+
+    case PS_SLICE_GROUP_MAP_TYPE_EXPLICIT:
+      for (i = 0; i < picSizeInMapUnits; i++)
+        sliceMap[i] = pps->slice_group_id[i];
+      break;
+
+    default:
+      break;
+    }
+  }
+
+}
+
+
+/*
+ *
+ * isPicBoundary:
+ *
+ * Parameters:
+ *      seq                   Sequence object
+ *
+ * Function:
+ *      Check if current slice and next slice belong to different pictures.
+ *      
+ * Returns:
+ *      1: slices belong to different pictures (picture boundary detected)
+ *      0: slices belong to the same picture
+ *
+ */
+static int isPicBoundary(sequence_s *seq)
+{
+  slice_s *currSlice, *nextSlice;
+  seq_parameter_set_s *prevSps, *currSps;
+
+  currSlice = seq->currSlice;
+  nextSlice = seq->nextSlice;
+
+  /* frame_num differs in value. */
+  if (currSlice->frame_num != nextSlice->frame_num)
+    return 1;
+
+  /* nal_ref_idc differs in value with one of the nal_ref_idc values being equal to 0. */
+  if ((currSlice->nalRefIdc != nextSlice->nalRefIdc) &&
+      (currSlice->nalRefIdc == 0 || nextSlice->nalRefIdc == 0))
+    return 1;
+
+  /* nal_unit_type is equal to 5 for one coded slice NAL unit and */
+  /* is not equal to 5 in the other coded slice NAL unit */
+  if ((currSlice->nalType == NAL_TYPE_CODED_SLICE_IDR || nextSlice->nalType == NAL_TYPE_CODED_SLICE_IDR) &&
+      (currSlice->nalType != nextSlice->nalType))
+    return 1;
+
+  /* nal_unit_type is equal to 5 for both and idr_pic_id differs in value. */
+  if (currSlice->nalType == NAL_TYPE_CODED_SLICE_IDR &&
+      nextSlice->nalType == NAL_TYPE_CODED_SLICE_IDR &&
+      (currSlice->idr_pic_id != nextSlice->idr_pic_id))
+    return 1;
+
+  prevSps = seq->spsList[seq->ppsList[currSlice->pic_parameter_set_id]->seq_parameter_set_id];
+  currSps = seq->spsList[seq->ppsList[nextSlice->pic_parameter_set_id]->seq_parameter_set_id];
+
+  /* pic_order_cnt_type is equal to 0 for both and */
+  /* either pic_order_cnt_lsb differs in value, or delta_pic_order_cnt_bottom differs in value. */
+  if ((prevSps->pic_order_cnt_type == 0 && currSps->pic_order_cnt_type == 0) &&
+    ((currSlice->pic_order_cnt_lsb != nextSlice->pic_order_cnt_lsb) ||
+    (currSlice->delta_pic_order_cnt_bottom != nextSlice->delta_pic_order_cnt_bottom)))
+    return 1;
+
+  /* pic_order_cnt_type is equal to 1 for both and */
+  /* either delta_pic_order_cnt[ 0 ] differs in value, or delta_pic_order_cnt[ 1 ] differs in value. */
+  if ((prevSps->pic_order_cnt_type == 1 && currSps->pic_order_cnt_type == 1) &&
+      ((currSlice->delta_pic_order_cnt_0 != nextSlice->delta_pic_order_cnt_0) ||
+       (currSlice->delta_pic_order_cnt_1 != nextSlice->delta_pic_order_cnt_1)))
+    return 1;
+
+  return 0;
+}
+
+
+/*
+ *
+ * decodePictureOrderCount:
+ *
+ * Parameters:
+ *      seq                   Sequence object
+ *      slice                 Slice object
+ *      sps                   Sequence parameter set
+ *
+ * Function:
+ *      Decode picture order count using syntax elements in slice object.
+ *      
+ * Returns:
+ *      poc
+ *
+ */
+static int decodePictureOrderCount(sequence_s* seq, slice_s *slice,
+                                   seq_parameter_set_s *sps)
+{
+  int i;
+  int32 maxPocLsb;
+  int32 expectedPicOrderCnt, picOrderCntCycleCnt = 0;
+  int32 expectedDeltaPerPicOrderCntCycle, frameNumInPicOrderCntCycle = 0, absFrameNum;
+  int32 tempPicOrderCnt;
+  int32 poc = 0;
+
+  /* POC */
+  if (sps->pic_order_cnt_type == 0) {
+    /* Reset prevPocMsb, prevPocLsb if needed */
+    if (slice->isIDR || seq->prevPicHasMMCO5) {
+      seq->prevPocMsb = seq->prevPocLsb = 0;
+    }
+    /* PicOrderCntMsb is derived: */
+    maxPocLsb = (u_int32)1 << (sps->log2_max_pic_order_cnt_lsb_minus4 + 4);
+    if ( (int32)slice->pic_order_cnt_lsb < seq->prevPocLsb &&  (seq->prevPocLsb - (int32)slice->pic_order_cnt_lsb ) >= (maxPocLsb / 2) )
+      seq->pocMsb = seq->prevPocMsb + maxPocLsb;
+    else if ( (int32)slice->pic_order_cnt_lsb > seq->prevPocLsb && ((int32)slice->pic_order_cnt_lsb - seq->prevPocLsb) > (maxPocLsb / 2) )
+      seq->pocMsb = seq->prevPocMsb - maxPocLsb;
+    else
+      seq->pocMsb = seq->prevPocMsb;
+    /* poc */
+    poc = seq->pocMsb + slice->pic_order_cnt_lsb;
+  }
+
+  else if (sps->pic_order_cnt_type == 1) {
+    /* Reset prevFrameNumOffset if needed */
+    if (!slice->isIDR && seq->prevPicHasMMCO5)  /* : prevPicHasMMCO5 has not been tested. */
+      seq->prevFrameNumOffset = 0;
+
+    /* frameNumOffset is derived as follows: */
+    if (slice->isIDR)
+      seq->frameNumOffset = 0;
+    else if (seq->prevFrameNum > (int32)slice->frame_num)
+      seq->frameNumOffset = seq->prevFrameNumOffset + slice->maxFrameNum;
+    else
+      seq->frameNumOffset = seq->prevFrameNumOffset;
+
+    /* absFrameNum is derived as follows: */
+    if (sps->num_ref_frames_in_pic_order_cnt_cycle != 0)
+      absFrameNum = seq->frameNumOffset + slice->frame_num;
+    else
+      absFrameNum = 0;
+    if (slice->nalRefIdc == 0 && absFrameNum > 0)
+      absFrameNum = absFrameNum - 1;
+
+    /* When absFrameNum > 0, picOrderCntCycleCnt and frameNumInPicOrderCntCycle are derived as follows */
+    if (absFrameNum > 0) {
+      picOrderCntCycleCnt = (absFrameNum - 1) / sps->num_ref_frames_in_pic_order_cnt_cycle;
+      frameNumInPicOrderCntCycle = (absFrameNum - 1) % sps->num_ref_frames_in_pic_order_cnt_cycle;
+    }
+
+    /* expectedDeltaPerPicOrderCntCycle */
+    expectedDeltaPerPicOrderCntCycle = 0;
+    for (i = 0; i < (int)sps->num_ref_frames_in_pic_order_cnt_cycle; i++)
+      expectedDeltaPerPicOrderCntCycle += sps->offset_for_ref_frame[i];
+
+    /* expectedPicOrderCnt */
+    if (absFrameNum > 0) {
+      expectedPicOrderCnt = picOrderCntCycleCnt * expectedDeltaPerPicOrderCntCycle;
+      for (i = 0; i <= frameNumInPicOrderCntCycle; i++)
+        expectedPicOrderCnt = expectedPicOrderCnt + sps->offset_for_ref_frame[i];
+    }
+    else
+      expectedPicOrderCnt = 0;
+    if (slice->nalRefIdc == 0)
+      expectedPicOrderCnt = expectedPicOrderCnt + sps->offset_for_non_ref_pic;
+
+    /* poc */
+    poc = expectedPicOrderCnt + slice->delta_pic_order_cnt_0;
+  }
+
+  else if (sps->pic_order_cnt_type == 2) {
+    /* prevFrameNumOffset is derived as follows */
+    if (!slice->isIDR && seq->prevPicHasMMCO5)
+      seq->prevFrameNumOffset = 0;
+
+    /* FrameNumOffset is derived as follows. */
+    if (slice->isIDR)
+      seq->frameNumOffset = 0;
+    else if (seq->prevFrameNum > (int32)slice->frame_num)
+      seq->frameNumOffset = seq->prevFrameNumOffset + slice->maxFrameNum;
+    else
+      seq->frameNumOffset = seq->prevFrameNumOffset;
+
+    /* tempPicOrderCnt is derived as follows */
+    if (slice->isIDR)
+      tempPicOrderCnt = 0;
+    else if (slice->nalRefIdc == 0)
+      tempPicOrderCnt = 2 * (seq->frameNumOffset + slice->frame_num) - 1;
+    else
+      tempPicOrderCnt = 2 * (seq->frameNumOffset + slice->frame_num);
+
+    /* poc */
+    poc = tempPicOrderCnt;
+  }
+
+  return poc;
+}
+
+
+/*
+ *
+ * getOutputPic:
+ *
+ * Parameters:
+ *      seq                   Sequence object
+ *
+ * Function:
+ *      Get one output picture. Pictures are output from output queue and
+ *      if queue is empty pictures are ouput from dpb. Ouput from dpb can only
+ *      happen if sequence is finished (i.e there are not more bits to decode).
+ *
+ * Returns:
+ *      1: output picture is available
+ *      0: output picture is not available
+ */
+static int getOutputPic(sequence_s *seq)
+{
+  frmBuf_s *srcBuf;
+  seq_parameter_set_s *sps;
+
+  /* If no slices have been decoded, there are no pictures available */
+  if (seq->isFirstSliceOfSeq)
+    return 0;
+
+  /* Check if there are pictures in output queue */
+  if (seq->numQueuedOutputPics == 0) 
+  {
+
+    /* Get active sequence parameter set */
+    sps = seq->spsList[seq->ppsList[seq->currSlice->pic_parameter_set_id]->seq_parameter_set_id];
+
+    /*
+     * There are no queued pictures, but we can still output a picture if
+     * at least one of the following conditions is true:
+     * - we have decoded all NAL units
+     * - num_reorder_frames in VUI parameters is zero
+     * - POC type is 2
+     */
+    if (seq->isSeqFinished ||
+        sps->vui_parameters.num_reorder_frames == 0 ||
+        sps->pic_order_cnt_type == 2)
+    {
+      int dummy;
+
+      /* Check if there are pictures in dpb */
+      srcBuf = dpbGetNextOutputPic(seq->dpb, &dummy);
+      if (!srcBuf)
+        return 0;   /* There were no pictures to output */
+    }
+    else
+      return 0;   /* None of the conditions were true */
+  }
+  else 
+  {
+    /* Take next picture from queue. */
+    srcBuf = seq->outputQueue[seq->outputQueuePos];
+
+    seq->numQueuedOutputPics--;
+    if (seq->numQueuedOutputPics == 0)
+      seq->outputQueuePos = 0;
+    else
+      seq->outputQueuePos++;
+  }
+
+  srcBuf->forOutput          = 0;
+
+  return 1;
+}
+
+
+/*
+ *
+ * finishCurrentPic:
+ *
+ * Parameters:
+ *      seq                   Sequence object
+ *
+ * Function:
+ *      Finish decoding of current picture. Call loopfilter for the picture
+ *      and try to store picture in dpb. Function also updates variables
+ *      for previous decoded frame and previous decoded reference frame.
+ *
+ * Returns:
+ *       0 : no frames were output
+ *      >0 : the number of frames output
+ *      <0 : error
+ */
+static int finishCurrentPic(sequence_s *seq)
+{
+  slice_s *slice;
+  frmBuf_s *currPic;
+  int numOutput;
+  int retVal;
+
+  slice   = seq->currSlice;
+  currPic = seq->recoBuf;
+
+  if ((retVal = decRefPicMarking(seq)) < 0)
+    return retVal;
+
+  /* After the decoding of the current picture and the processing of the     */
+  /* memory management control operations a picture including                */
+  /* a memory_management_control_operation equal to 5 shall be inferred      */
+  /* to have had frame_num equal to 0 for all subsequent use in the decoding */
+  /* process.                                                                */
+  if (slice->picHasMMCO5)
+    currPic->frameNum = slice->frame_num = 0;
+
+  /* Try to store current picture to dpb */
+  numOutput = dpbStorePicture(seq->dpb, currPic, seq->outputQueue);
+  /* If numOutput != 0, picture was not stored */
+
+  if (numOutput != 0) 
+  {
+
+    /* numOutput != 0 implies that pictures were output from dpb */
+    seq->outputQueuePos      = 0;
+    seq->numQueuedOutputPics = numOutput;
+
+    /* Picture was not stored so we have to store it later */
+    seq->isDpbStorePending   = 1;
+  }
+  else
+    seq->isDpbStorePending = 0;
+
+  seq->prevFrameNum       = slice->frame_num;
+  seq->prevFrameNumOffset = seq->frameNumOffset;
+
+  seq->prevPicHasMMCO5 = slice->picHasMMCO5;
+
+  /* prevRefFrameNum, prevPocLsb and prevPocMsb for latest reference picture */
+  if (slice->nalRefIdc != 0) 
+  {
+    seq->prevRefFrameNum = slice->frame_num;
+    seq->prevPocLsb      = slice->pic_order_cnt_lsb;
+    seq->prevPocMsb      = seq->pocMsb;
+  }
+
+  seq->isCurrPicFinished = 1;
+
+  return numOutput;
+}
+
+
+/*
+ *
+ * generateNonExistingFrames:
+ *
+ * Parameters:
+ *      seq                   Sequence object
+ *
+ * Function:
+ *      Generate non-existing frame for each unused frame number between
+ *      two closest existing frames in decoding order. Generated frames
+ *      are stored to dpb in finishCurrentPic function.
+ *
+ * Returns:
+ *       0 : no frames were output
+ *      >0 : the number of frames output
+ *      <0 : error
+ */
+static int generateNonExistingFrames(sequence_s *seq)
+{
+  slice_s *slice;
+  frmBuf_s *currPic;
+  int32 nextFrameNum;
+  int numOutput;
+
+  slice   = seq->currSlice;
+  currPic = seq->recoBuf;
+
+  slice->picHasMMCO5                        = 0;
+  slice->isIDR                              = 0;
+  slice->adaptive_ref_pic_marking_mode_flag = 0;
+  slice->nalType                            = NAL_TYPE_CODED_SLICE;
+  slice->nalRefIdc                          = 1;
+
+  currPic->forOutput   = 0;
+  currPic->nonExisting = 1;
+
+  do {
+    slice->frame_num = seq->unusedShortTermFrameNum;
+
+    dpbUpdatePicNums(seq->dpb, slice->frame_num, slice->maxFrameNum);
+
+    numOutput = finishCurrentPic(seq);
+
+    nextFrameNum = (seq->unusedShortTermFrameNum + 1) % seq->nextSlice->maxFrameNum;
+
+    if (nextFrameNum == (int)seq->nextSlice->frame_num)
+      seq->unusedShortTermFrameNum = -1;
+    else
+      seq->unusedShortTermFrameNum = nextFrameNum;
+
+  } while (numOutput == 0 && seq->unusedShortTermFrameNum >= 0);
+
+  return numOutput;
+}
+
+
+/*
+ *
+ * initializeCurrentPicture:
+ *
+ * Parameters:
+ *      seq                   Sequence object
+ *      sps                   Active sequence parameter set
+ *      pps                   Active picture parameter set
+ *      width                 Picture width
+ *      height                Picture height
+ *
+ * Function:
+ *      Current frame and dpb are initialized according to active
+ *      parameter sets.
+ *
+ * Returns:
+ *      SEQ_OK for no error, negative value for error
+ */
+static int initializeCurrentPicture(sequence_s *seq, seq_parameter_set_s *sps,
+                                    pic_parameter_set_s *pps,
+                                    int width, int height)
+
+{
+  frmBuf_s *currPic;
+  slice_s *slice;
+  int i;
+
+#ifdef CHECK_MV_RANGE
+  if (sps->level_idc <= 10)
+    maxVerticalMvRange = 64;
+  else if (sps->level_idc <= 20)
+    maxVerticalMvRange = 128;
+  else if (sps->level_idc <= 30)
+    maxVerticalMvRange = 256;
+  else
+    maxVerticalMvRange = 512;
+#endif
+
+  currPic = seq->recoBuf;
+  slice   = seq->currSlice;
+
+  /*
+    * (Re)initialize frame buffer for current picture if picture size has changed
+    */
+
+  if (!currPic || width != currPic->width || height != currPic->height) {
+    frmClose(currPic, seq->mbData);
+    if ((currPic = frmOpen(&seq->mbData, width, height)) == NULL)
+      return SEQ_ERR_MEM;
+    seq->recoBuf = currPic;
+  }
+
+  for (i = 0; i < MAX_SLICE_GROUP_NUM; i++)
+    seq->sliceNums[i] = 0;
+
+  /* Build slice group map */
+  buildSliceGroups(seq, slice, sps, pps);
+
+  /* Parameter from SPS */
+  currPic->constraintSet0flag = sps->constraint_set0_flag;
+  currPic->constraintSet1flag = sps->constraint_set1_flag;
+  currPic->constraintSet2flag = sps->constraint_set2_flag;
+  currPic->profile            = sps->profile_idc;
+  currPic->level              = sps->level_idc;
+  currPic->maxFrameNum        = slice->maxFrameNum;
+
+  /* Parameter from PPS */
+  currPic->qp = pps->pic_init_qp_minus26 + 26;
+
+  /* By default picture will be output */
+  currPic->forOutput   = 1;
+  currPic->nonExisting = 0;
+  currPic->picType     = slice->slice_type;
+  currPic->isIDR       = slice->isIDR;
+
+  psGetAspectRatio(sps, &currPic->aspectRatioNum, &currPic->aspectRatioDenom);
+  currPic->overscanInfo        = sps->vui_parameters.overscan_appropriate_flag;
+  currPic->videoFormat         = sps->vui_parameters.video_format;
+  currPic->videoFullRangeFlag  = sps->vui_parameters.video_full_range_flag;
+  currPic->matrixCoefficients  = sps->vui_parameters.matrix_coefficients;
+  currPic->chromaSampleLocType = sps->vui_parameters.chroma_sample_loc_type_top_field;
+  currPic->numReorderFrames    = sps->vui_parameters.num_reorder_frames;
+
+  if (sps->frame_cropping_flag) {
+    currPic->cropLeftOff   = sps->frame_crop_left_offset;
+    currPic->cropRightOff  = sps->frame_crop_right_offset;
+    currPic->cropTopOff    = sps->frame_crop_top_offset;
+    currPic->cropBottomOff = sps->frame_crop_bottom_offset;
+  }
+  else {
+    currPic->cropLeftOff   = 0;
+    currPic->cropRightOff  = 0;
+    currPic->cropTopOff    = 0;
+    currPic->cropBottomOff = 0;
+  }
+
+  if (sps->vui_parameters_present_flag &&
+      sps->vui_parameters.timing_info_present_flag &&
+      sps->vui_parameters.num_units_in_tick != 0)
+    currPic->frameRate = (float)(0.5 * (float)sps->vui_parameters.time_scale/(float)sps->vui_parameters.num_units_in_tick);
+  else
+    currPic->frameRate = 0.0;
+
+  /* Get poc for current picture */
+  currPic->poc = decodePictureOrderCount(seq, slice, sps);
+
+  /* Set chroma qp index offset */
+  currPic->chromaQpIndexOffset = pps->chroma_qp_index_offset;
+
+  currPic->pictureStructure = 0;
+
+  currPic->lossy = 0;
+  seq->isCurrPicFinished = 0;
+  seq->redundantPicCnt = slice->redundant_pic_cnt;
+
+  return SEQ_OK;
+}
+
+// parseSliceData
+// Reads and parses slice data
+static TInt parseSliceData(sequence_s *seq)
+{
+  	slice_s *slice;
+  	pic_parameter_set_s *pps;
+  	seq_parameter_set_s *sps;
+  	TInt width, height;
+  	TInt sliceGroupNum, sliceID;
+  	TInt retCode;
+
+  	// New slice becomes current slice 
+  	slice = seq->nextSlice;
+  	seq->nextSlice = seq->currSlice;
+  	seq->currSlice = slice;
+
+  	// Get current parameter sets 
+  	pps = seq->ppsList[slice->pic_parameter_set_id];
+  	sps = seq->spsList[pps->seq_parameter_set_id];
+
+  	// Get picture size 
+  	width  = (sps->pic_width_in_mbs_minus1+1)*16;
+  	height = (sps->pic_height_in_map_units_minus1+1)*16;
+
+  	// If this is the first slice of a picture, initialize picture 
+  	if (seq->isFirstSliceOfSeq || seq->isPicBoundary) 
+  	{
+
+    	if (slice->isIDR || seq->isFirstSliceOfSeq) 
+    	{
+
+      		// Set dpb according to level
+      		dpbSetSize(seq->dpb, sps->vui_parameters.max_dec_frame_buffering);
+
+      		seq->dpb->maxNumRefFrames = sps->num_ref_frames;
+    	}
+
+    	retCode = initializeCurrentPicture(seq, sps, pps, width, height);
+
+    	if (retCode < 0)
+      		return retCode;
+  	}
+  	else 
+  	{
+    	if (IS_SLICE_P(slice->slice_type))
+      	// If there is a P-slice in the picture, mark picture as P-picture 
+      		seq->recoBuf->picType = slice->slice_type;
+  	}
+
+  	// Compute picture numbers for all reference frames 
+  	if (!slice->isIDR)
+    	dpbUpdatePicNums(seq->dpb, slice->frame_num, slice->maxFrameNum);
+
+  	// Get slice group number if there are more than 1 slice groups 
+  	if (pps->num_slice_groups_minus1 == 0)
+    	sliceGroupNum = 0;
+  	else
+    	sliceGroupNum = seq->mbData->sliceMap[slice->first_mb_in_slice] & 0xF;
+
+  	// Increment slice number for current slice group (slice numbers start from 1) 
+  	seq->sliceNums[sliceGroupNum]++;
+
+  	// sliceID for current slice 
+  	sliceID = seq->sliceNums[sliceGroupNum]*16 | sliceGroupNum;
+
+
+  	// Parse the macroblocks in the slice
+  	retCode = sliceParseMacroblocks(slice, seq->recoBuf, seq->dpb,
+    	                            pps, seq->mbData, sliceID, seq->bitbuf, 
+                                    seq->iBitShiftInSlice);
+
+  	// Update sequence variables 
+  	seq->isFirstSliceOfSeq        = 0;
+  	seq->isPicBoundary            = 0;
+
+  	if (retCode < 0)
+    	return SEQ_ERROR;
+  	else
+    	return SEQ_OK;
+}
+
+
+// parseSlice
+// Parses the slice header and calls parseSliceData to parse the slice data if necessary
+static TInt parseSlice(sequence_s *seq, int nalType, int nalRefIdc)
+{
+  	slice_s *slice;
+  	TInt nextFrameNum;
+  	TInt numOutput;
+  	TInt retCode;
+  
+
+  	slice = seq->nextSlice;
+
+  	slice->nalType   = nalType;
+  	slice->nalRefIdc = nalRefIdc;
+  	slice->isIDR     = (nalType == NAL_TYPE_CODED_SLICE_IDR);
+  
+  	slice->sliceDataModified = 0;
+  
+  	// Reset the bit shift flag
+  	seq->iBitShiftInSlice = EFalse;
+
+	// Parse the slice header
+  	retCode = ParseSliceHeader(slice, seq->spsList, seq->ppsList, seq->bitbuf, &seq->iFrameNumber, seq->iFromEncoder);
+  
+  	if (slice->sliceDataModified)
+  		seq->sliceDataModified = 1;
+  
+  	if ( retCode != SLICE_STOP_PARSING )
+  		seq->iBitShiftInSlice = ETrue;
+
+  	if (retCode < 0)
+    	return SEQ_ERROR;
+
+  	// Check if next slice belongs to next picture 
+  	if (seq->isFirstSliceOfSeq)
+    	seq->isPicBoundary = 0;
+  	else
+    	seq->isPicBoundary = isPicBoundary(seq);
+
+  	if (!seq->isPicBoundary) 
+  	{	
+    	// There is no picture boundary. Decode new slice if redundant 
+    	// picture count is same as in previous slice                  
+    	if (seq->isFirstSliceOfSeq || slice->redundant_pic_cnt == seq->redundantPicCnt)
+      		return parseSliceData(seq);
+    	else
+      		return SEQ_OK;
+  	}
+  	else 
+  	{
+    	// Picture boundary reached or all MBs of current picture were decoded. 
+    	if (!seq->isCurrPicFinished) 
+    	{
+      		// Finish decoding of current picture 
+      		numOutput = finishCurrentPic(seq);
+
+      		// numOutput is the number of pictures in output queue 
+      		// If numOutput < 0, error occured 
+      		if (numOutput < 0)
+        		return numOutput;
+    	}
+    	else
+      		numOutput = 0;
+
+    	// Compute expected next frame number 
+    	nextFrameNum = (seq->prevRefFrameNum + 1) % slice->maxFrameNum;
+
+    	// Check if there is a gap in frame numbers 
+    	if (!slice->isIDR && (TInt)slice->frame_num != seq->prevRefFrameNum &&
+        	(TInt)slice->frame_num != nextFrameNum)
+    	{
+       		// Start filling in gaps in frame numbers 
+       		seq->unusedShortTermFrameNum = nextFrameNum;
+
+	        // If dpb was not full (i.e. we did not have to output any pictures), 
+       		// we can generate non-existing frames.                               
+       		if (numOutput == 0) 
+       			numOutput = generateNonExistingFrames(seq);
+    	}
+
+    	if (numOutput == 0)
+    	{
+      		// If there are no pictures in output queue we can decode next slice 
+      		return parseSliceData(seq);
+    	}
+    	else 
+    	{
+      		// Don't decode slice since it belongs to next picture 
+      		return SEQ_OK;
+    	}
+  	}
+}
+
+
+// avcdParseParameterSet
+// Parses SPS / PPS parameter sets from the input NAL unit
+TInt avcdParseParameterSet(avcdDecoder_t *dec, void *nalUnitBits, TUint* nalUnitLen)
+{
+    sequence_s *seq = (sequence_s *)dec;
+    TInt nalHeaderByte;
+    TInt nalType;
+//    TInt nalRefIdc;
+    TInt retCode;
+    TUint nalUnitLength = *nalUnitLen;
+    
+		
+	PRINT((_L("Sequence::avcdParseParameterSet() in, frame # %d, total # %d"), seq->iFrameNumber, seq->iTotalFrameNumber));
+
+  	// Check for end of stream 
+  	if (nalUnitBits == 0 || nalUnitLen == 0) 
+  	{
+  		return AVCD_OK;
+  	}
+
+  	// Allocate memory for the bitbuffer data, add 10 to nal length in case SPS/PPS sets are modified
+  	seq->bitbuf->data = (TUint8*) User::Alloc(nalUnitLength+10);
+  	
+  	if (seq->bitbuf->data == 0)
+  	    return KErrNoMemory;
+  	
+	Mem::FillZ(seq->bitbuf->data, (nalUnitLength+10)*sizeof(TUint8) );
+	
+  	TUint8* tpD = (TUint8*)nalUnitBits;
+  	 
+	Mem::Copy(seq->bitbuf->data, tpD, nalUnitLength*sizeof(TUint8));
+
+  	// Initialize bitbuffer and get first byte containing NAL type and NAL ref idc 
+  	if (bibInit(seq->bitbuf, seq->bitbuf->data, nalUnitLength) < 0)
+  	{
+		User::Free(seq->bitbuf->data);
+    
+    	return AVCD_ERROR;
+  	}
+
+  	if (bibGetByte(seq->bitbuf, &nalHeaderByte))
+  	{
+		User::Free(seq->bitbuf->data);
+    
+    	return AVCD_ERROR;
+  	}
+  
+  	// Decode NAL unit type and reference indicator 
+  	nalType   = nalHeaderByte & 0x1F;
+//  	nalRefIdc = (nalHeaderByte & 0x60) >> 5;
+
+  	// Decode NAL unit data 
+  	switch (nalType)
+  	{
+  		case NAL_TYPE_SPS:              // 7
+			retCode = psParseSPS(seq->bitbuf, seq->spsList, seq->iFromEncoder, &seq->iEncodeUntilIDR, &seq->iNumSPS);
+    		if ( retCode == KErrNotSupported)
+    		{
+				User::Free(seq->bitbuf->data);
+      		
+      			return KErrNotSupported;
+    		}
+    		else if (retCode < 0)
+		  	{
+				User::Free(seq->bitbuf->data);
+    		
+    			return AVCD_ERROR;
+  			}
+    		break;
+  		case NAL_TYPE_PPS:              // 8
+			retCode = psParsePPS(seq->bitbuf, seq->ppsList, seq->spsList, seq->iFromEncoder, &seq->iNumPPS);
+    		if (retCode == KErrNotSupported)
+    		{
+				User::Free(seq->bitbuf->data);
+      		
+      			return KErrNotSupported;
+    		}
+    		else if (retCode < 0)
+	  		{
+				User::Free(seq->bitbuf->data);
+    		
+    			return AVCD_ERROR;
+  			}
+    		break;
+  		default:
+   			PRINT((_L("Not a parameter set NAL type: (%i)\n"), nalType));    
+    		break;
+  		}
+
+	// Take care of emulation prevention bytes
+	int error = bibEnd(seq->bitbuf);	
+
+	// Free the bitbuffer data
+	User::Free(seq->bitbuf->data);
+
+	if (error != 0)
+        return error;
+
+	return AVCD_OK;  
+}
+
+
+// avcdParseOneNal
+// Parses one input NAL unit
+TInt avcdParseOneNal(avcdDecoder_t *dec, void *nalUnitBits, TUint* nalUnitLen)
+{
+    sequence_s *seq = (sequence_s *)dec;
+    TInt nalHeaderByte;
+    TInt nalType;
+    TInt nalRefIdc;
+    TInt retCode;
+    TUint nalUnitLength = *nalUnitLen;
+		
+	PRINT((_L("Sequence::avcdParseOneNal() in, frame # %d, total # %d"), seq->iFrameNumber, seq->iTotalFrameNumber));
+	
+  /*
+   * The following conditions are tested to see what is the current decoder state
+   * and to act upon that state:
+   *
+   * - Check if picture can be output from output queue without further decoding.
+   * - Check if dpb store is pending (i.e current picture was not be
+   *   stored to dpb during previous call because dpb was full).
+   * - Check any non-existing frames should be generated (i.e there were gaps in
+   *   frame number). If non-existing frame(s) were generated, check output
+   *   queue again.
+   * - Check for end of stream. If end of stream was reached then current picture
+   *   is finished if not yet finished. Check again whether picture can be output
+   *   from either output queue or dpb (check is internal to getOutputPic(...)).
+   * - Check if slice decode is pending (i.e only header of the latest slice was
+   *   decoded during previous call and we now need to decode slice data) and if
+   *   so, decode slice data.
+   * - Check any lost frames being recovered (i.e there were ref frames lost)
+   *   If lost frames were rescued, check output queue again.
+   */
+
+  	// We can return immediately if there are queued output pics 
+  	if (seq->numQueuedOutputPics > 0) 
+  	{
+  		// "Flush" all output pictures 
+  		while (seq->numQueuedOutputPics > 0)
+  		{
+	    	getOutputPic(seq);
+  		}
+  	}
+
+  	// Is current picture waiting to be moved to DPB? 
+  	if (seq->isDpbStorePending) 
+  	{
+    	if (dpbStorePicture(seq->dpb, seq->recoBuf, seq->outputQueue) != 0) 
+    	{
+      		PRINT((_L("Error: dpb store failed\n")));
+      		return AVCD_ERROR;
+    	}
+    	
+    	seq->isDpbStorePending = 0;
+  	}
+
+  	// Check for end of stream 
+  	if (nalUnitBits == 0 || nalUnitLen == 0) 
+  	{
+    	if (!seq->isSeqFinished && !seq->isCurrPicFinished && seq->recoBuf != NULL) 
+    	{
+      		if (finishCurrentPic(seq) < 0)
+        		return AVCD_ERROR;
+    	}
+    	
+    	seq->isSeqFinished = 1;
+      	
+		getOutputPic(seq);
+      	return AVCD_OK;
+  	}
+
+  	// Reset the sliceDataModified flag
+  	seq->sliceDataModified = 0;
+
+	// Initialize bitbuffer and get first byte containing NAL type and NAL ref idc 
+  	if (bibInit(seq->bitbuf, (TUint8 *)nalUnitBits, nalUnitLength) < 0)
+    	return AVCD_ERROR;
+
+  	if (bibGetByte(seq->bitbuf, &nalHeaderByte))
+    	return AVCD_ERROR;
+
+  	// Decode NAL unit type and reference indicator 
+  	nalType   = nalHeaderByte & 0x1F;
+  	nalRefIdc = (nalHeaderByte & 0x60) >> 5;
+
+  	// Decode NAL unit data 
+  	switch (nalType)
+  	{
+  		case NAL_TYPE_CODED_SLICE:      // 1
+    		parseSlice(seq, nalType, nalRefIdc);
+			seq->iTotalFrameNumber++;
+    		break;
+  		case NAL_TYPE_CODED_SLICE_P_A:  // 2
+  		case NAL_TYPE_CODED_SLICE_P_B:  // 3
+  		case NAL_TYPE_CODED_SLICE_P_C:  // 4
+    		PRINT((_L("Slice data partition NAL type (%i) not supported.\n"), nalType));    
+    		break;
+  		case NAL_TYPE_CODED_SLICE_IDR:  // 5
+    		parseSlice(seq, nalType, nalRefIdc);
+			seq->iTotalFrameNumber++;
+    		break;
+  		case NAL_TYPE_SEI:              // 6
+    		PRINT((_L("SEI NAL unit (6) skipped.\n")));
+    		break;
+  		case NAL_TYPE_SPS:              // 7
+			retCode = psParseSPS(seq->bitbuf, seq->spsList, seq->iFromEncoder, &seq->iEncodeUntilIDR, &seq->iNumSPS);
+    		if ( retCode == KErrNotSupported)
+      			return KErrNotSupported;
+    		else if (retCode < 0)
+    			return AVCD_ERROR;
+    		break;
+  		case NAL_TYPE_PPS:              // 8
+			retCode = psParsePPS(seq->bitbuf, seq->ppsList, seq->spsList, seq->iFromEncoder, &seq->iNumPPS);
+    		if (retCode == KErrNotSupported)
+      			return KErrNotSupported;
+    		else if (retCode < 0)
+      			return AVCD_ERROR;
+    		break;
+  		case NAL_TYPE_PIC_DELIMITER:    // 9
+    		PRINT((_L("Picture Delimiter NAL unit (9) skipped.\n")));
+    		break;
+  		case NAL_TYPE_END_SEQ:          // 10
+    		PRINT((_L("End of Sequence NAL unit (10) skipped.\n")));
+    		break;
+  		case NAL_TYPE_END_STREAM:       // 11
+    		PRINT((_L("End of Stream NAL unit (11) skipped.\n")));
+    		break;
+  		case NAL_TYPE_FILLER_DATA:      // 12
+    		PRINT((_L("Filler Data NAL unit (12) skipped.\n")));
+    		break;
+  		default:
+    		// Unspecied NAL types 0 and 24-31 
+    		if (nalType == 0 || (nalType >= 24 && nalType <= 31))
+    		{
+      			PRINT((_L("Unspecified NAL type: (%i)\n"), nalType));    
+    		}
+    		// Reserved NAL types 13-23 
+    		else
+    		{
+      			PRINT((_L("Reserved NAL type (%i)\n"), nalType));    
+    		}
+    		break;
+  	}
+
+
+  	// Check the output queue once again
+  	if (getOutputPic(seq)) 
+  	{
+  		// If current slice has not been parsed yet, parse it not
+    	if (seq->isPicBoundary)
+    	{
+			parseSliceData(seq);
+    		getOutputPic(seq);
+    	}
+  	}
+
+	// Take care of emulation prevention bytes
+	bibEndSlice(seq->bitbuf);
+
+	// If slice data was modified, copy the modified data back to the nal data buffer
+	if (seq->sliceDataModified)
+	{
+		// If buffer length has been modified, change nalUnitLen
+		if (seq->bitbuf->dataLen != nalUnitLength)
+		{	
+			(*nalUnitLen) = seq->bitbuf->dataLen;
+		}
+	}
+
+	return AVCD_OK;  
+}
+
+
+// FrameIsFromEncoder
+// Stores information about the origin of next frame (if it is generated by the encoder)
+void FrameIsFromEncoder(avcdDecoder_t *dec, TUint aFromEncoder)
+{
+    sequence_s *seq = (sequence_s *)dec;
+	
+	seq->iFromEncoder = aFromEncoder;
+}
+
+
+// ReturnPPSSet
+// This function returns the aIndex'th PPS set stored
+TUint8* ReturnPPSSet(avcdDecoder_t *dec, TUint aIndex, TUint* aPPSLength)
+{
+	TUint i=0;
+	TUint j;
+    sequence_s *seq = (sequence_s *)dec;
+	
+	for (j=0; j<PS_MAX_NUM_OF_PPS; j++)
+	{
+		if (seq->ppsList[j])
+		{
+			if ( i == aIndex )
+			{
+				*aPPSLength = seq->ppsList[j]->PPSlength;			
+				return seq->ppsList[j]->codedPPSBuffer;
+			}
+			
+			i++;
+		}
+	}
+	
+	// No PPS set found with that index
+	return NULL;
+}
+
+
+// ReturnNumPPS
+// Returns the number of PPS units stored 
+TUint ReturnNumPPS(avcdDecoder_t *dec)
+{
+	TUint i=0;
+	TUint j;
+    sequence_s *seq = (sequence_s *)dec;
+	
+	for (j=0; j<PS_MAX_NUM_OF_PPS; j++)
+	{
+		if (seq->ppsList[j])
+		{
+			i++;
+		}
+	}
+	
+	return i;
+}
+
+
+// ReturnSPSSet
+// This function returns the aIndex'th PPS set stored
+TUint8* ReturnSPSSet(avcdDecoder_t *dec, TUint aIndex, TUint* aSPSLength)
+{
+	TUint i=0;
+	TUint j;
+    sequence_s *seq = (sequence_s *)dec;
+	
+	for (j=0; j<PS_MAX_NUM_OF_SPS; j++)
+	{
+		if (seq->spsList[j])
+		{
+			if ( i == aIndex )
+			{
+				*aSPSLength = seq->spsList[j]->SPSlength;			
+				return seq->spsList[j]->codedSPSBuffer;
+			}
+			
+			i++;
+		}
+		
+	}
+	
+	// No SPS set found with that index
+	return NULL;
+}
+
+
+// ReturnNumSPS
+// Returns the number of SPS units stored 
+TUint ReturnNumSPS(avcdDecoder_t *dec)
+{
+	TUint i=0;
+	TUint j;
+    sequence_s *seq = (sequence_s *)dec;
+	
+	for (j=0; j<PS_MAX_NUM_OF_SPS; j++)
+	{
+		if (seq->spsList[j])
+		{
+			i++;
+		}
+	}
+	
+	return i;
+}
+
+
+// ReturnEncodeUntilIDR
+// Returns information whether frames should be encoded until the next IDR
+TBool ReturnEncodeUntilIDR(avcdDecoder_t *dec)
+{
+    sequence_s *seq = (sequence_s *)dec;
+
+	return (seq->iEncodeUntilIDR);
+}
+
+
+// EncodeZeroValueWithVariableLength
+// Encodes zero (which is encoded with a single one bit) to the bitbuffer
+void EncodeZeroValueWithVariableLength(bitbuffer_s *aBitBuffer)
+{
+	// If bit position is zero, move to next byte
+	if(aBitBuffer->bitpos == 0)
+	{
+		// Get the next byte
+		aBitBuffer->currentBits = aBitBuffer->data[aBitBuffer->bytePos];
+		aBitBuffer->bytePos++;
+		aBitBuffer->bitpos = 8;
+	}
+		
+	// Change the bitpos bit's value to one
+	aBitBuffer->data[aBitBuffer->bytePos-1] |= 1 << (aBitBuffer->bitpos-1);
+	aBitBuffer->bitpos--;
+		
+	if(aBitBuffer->bitpos == 0)
+	{
+		// Get the next byte
+		aBitBuffer->currentBits = aBitBuffer->data[aBitBuffer->bytePos];
+		aBitBuffer->bytePos++;
+		aBitBuffer->bitpos = 8;
+	}
+	
+	// Make sure the bit buffer currentBits is up-to-date
+	aBitBuffer->currentBits = aBitBuffer->data[aBitBuffer->bytePos-1];
+}
+
+
+// GenerateEmptyFrame
+// Generates an empty frame (a not coded frame) by generating the slice header and slice body
+// Slice body contains only a value to skip all the macroblocks in the slice.
+void GenerateEmptyFrame(sequence_s *seq, bitbuffer_s *bitbuf, TUint aFrameNumber)
+{
+  	seq_parameter_set_s *sps;
+  	pic_parameter_set_s *pps;
+	TUint8 bitMask;
+	TUint picSizeInMapUnits;
+	TUint ppsId;
+  	
+  	
+  	pps = seq->ppsList[seq->iPreviousPPSId];
+
+  	if (pps->indexChanged)
+  	{
+	  	// Since we generate empty frames for original clips only, 
+	  	// find out what is the original PPS id
+  		ppsId = pps->origPPSId;
+  		
+  		pps = seq->ppsList[ppsId];
+  	}
+  		
+  	sps = seq->spsList[pps->seq_parameter_set_id];
+  	
+  	// Compute the number of macroblocks
+	picSizeInMapUnits = (sps->pic_width_in_mbs_minus1+1) * (sps->pic_height_in_map_units_minus1+1);
+
+	// Generate the not coded frame
+	// Set the first byte as zero
+	bitbuf->bytePos = 0;
+	bitbuf->data[bitbuf->bytePos] = 0;
+	bitbuf->bitpos = 8;
+	
+	// Generate the NAL header, with nal type as 1 and nal_ref_idc as 1
+	bitbuf->data[0] = 0x21;
+	bitbuf->bytePos = 1;
+
+	// Set the first_mb_in_slice & slice_type to be zero (coded as 1), advance bitpos by two
+	bitbuf->data[bitbuf->bytePos] = 0xc0;	// First two bits == 1
+	bitbuf->bitpos -= 2;
+	bitbuf->bytePos = 2;
+	
+	// Encode the PPS index
+	EncodeUnsignedExpGolombCode(bitbuf, 0);
+	
+ 	// Encode the new frame number here
+ 	// If the max frame num was changed use original value since empty clips are generated for original clips
+  	if (sps->maxFrameNumChanged)
+	  	EncodeUnsignedNBits(bitbuf, aFrameNumber, sps->origMaxFrameNum+4);
+  	else
+	  	EncodeUnsignedNBits(bitbuf, aFrameNumber, sps->log2_max_frame_num_minus4+4);
+  
+  	// POC parameters 
+	if (sps->pic_order_cnt_type == 0) 
+  	{
+	  	// For now encode the POC as the frame number
+ 		// If the max frame num was changed use original value since empty clips are generated 
+ 		// for original clips
+	  	if (sps->maxPOCNumChanged)
+	  		EncodeUnsignedNBits(bitbuf, aFrameNumber, sps->origMaxPOCNum+4);
+	  	else
+	  		EncodeUnsignedNBits(bitbuf, aFrameNumber, sps->log2_max_pic_order_cnt_lsb_minus4+4);
+  	}
+  	else if (sps->pic_order_cnt_type == 1) 
+  	{
+    	if (!sps->delta_pic_order_always_zero_flag) 
+    	{
+      		EncodeZeroValueWithVariableLength(bitbuf);
+      		if (pps->pic_order_present_flag) 
+      		{
+	      		EncodeZeroValueWithVariableLength(bitbuf);
+      		}
+    	}
+  	}
+  	
+  	// Redundant picture count
+  	if (pps->redundant_pic_cnt_present_flag) 
+  	{
+  		EncodeZeroValueWithVariableLength(bitbuf);
+  	}
+  	
+  	// Encode num_ref_idx_active:override_flag with zero value
+	EncodeUnsignedNBits(bitbuf, 0, 1);
+	
+  	// Encode reference picture list reordering with single zero value
+	EncodeUnsignedNBits(bitbuf, 0, 1);
+	
+	// Since nal_ref_idc == 1, encode zero value for decoded reference picture marking
+	EncodeUnsignedNBits(bitbuf, 0, 1);
+  	
+  	// Encode slice_qp_delta with zero value
+	EncodeZeroValueWithVariableLength(bitbuf);
+	
+  	if (pps->deblocking_filter_parameters_present_flag == 1) 
+  	{
+  		// Encode value of 1 which is 010, i.e. two with three bits
+  		EncodeUnsignedNBits(bitbuf, 2, 3);
+  	}
+
+  	if (pps->num_slice_groups_minus1 > 0 && pps->slice_group_map_type >= 3 &&
+        pps->slice_group_map_type <= 5)
+  	{
+  		TUint temp, temp2, len1;
+  		
+    	// len = Ceil( Log2( PicSizeInMapUnits / SliceGroupChangeRate + 1 ) ) 
+	    // PicSizeInMapUnits / SliceGroupChangeRate 
+    	temp = picSizeInMapUnits / (pps->slice_group_change_rate_minus1+1);
+
+    	// Calculate Log2 
+    	temp2 = (temp + 1) >> 1;
+    	for (len1 = 0; len1 < 16 && temp2 != 0; len1++)
+      		temp2 >>= 1;
+
+    	// Calculate Ceil 
+    	if ( (((unsigned)1) << len1) < (temp + 1) )
+      		len1++;
+    	
+		// Encode zero value with len1 bits
+		EncodeUnsignedNBits(bitbuf, 0, len1);
+  	}
+  	
+  	// Now encode the slice data
+  	// Encode the mb_skip_run to indicate all macroblocks to be skipped
+  	// For example in CIF we have 22x18 = 396 macroblocks
+  	// 396 = 00000000 1 10001101
+	EncodeUnsignedExpGolombCode(bitbuf, picSizeInMapUnits);
+  	
+  	// Take care of the trailing bits, i.e. encode the rest of the bits in this byte to zero
+  	bitMask = 1 << (bitbuf->bitpos - 1);
+	bitbuf->data[bitbuf->bytePos-1] = bitbuf->data[bitbuf->bytePos-1] | bitMask;
+	
+	bitbuf->bitpos--;
+	if(bitbuf->bitpos != 0)
+	{
+		bitMask = 255 << (bitbuf->bitpos);	// Mask the 8-bitPos upper bits
+		bitbuf->data[bitbuf->bytePos-1] = bitbuf->data[bitbuf->bytePos-1] & bitMask;
+	}
+  	
+  	bitbuf->dataLen = bitbuf->bytePos;
+}
+
+
+// avcdGenerateNotCodedFrame
+// Generates an empty frame
+TInt avcdGenerateNotCodedFrame(avcdDecoder_t *dec, void *aNalUnitBits, TUint aNalUnitLen, TUint aFrameNumber)
+{
+    sequence_s *seq = (sequence_s *)dec;
+	
+	// Initialize bitbuffer
+  	if (bibInit(seq->bitbuf, (TUint8 *)aNalUnitBits, aNalUnitLen) < 0)
+    	return AVCD_ERROR;
+  	
+  	GenerateEmptyFrame(seq, seq->bitbuf, aFrameNumber);
+
+  	return (seq->bitbuf->dataLen);
+}
+
+
+// avcdStoreCurrentPPSId
+// Stores the value of PPS Id from the input NAL unit (if that unit is a coded slice). 
+// The Id value is used in the generation of an empty frame. 
+TInt avcdStoreCurrentPPSId(avcdDecoder_t *dec, TUint8 *nalUnitBits, TUint aNalUnitLen)
+{
+    sequence_s *seq = (sequence_s *)dec;
+    TInt nalHeaderByte;
+    TInt nalType;
+//    TInt nalRefIdc;
+//    TUint temp;
+		
+	// Initialize bitbuffer and get first byte containing NAL type and NAL ref idc 
+  	if (bibInit(seq->bitbuf, nalUnitBits, aNalUnitLen) < 0)
+    	return AVCD_ERROR;
+
+  	if (bibGetByte(seq->bitbuf, &nalHeaderByte))
+    	return AVCD_ERROR;
+
+  	// Decode NAL unit type and reference indicator 
+  	nalType   = nalHeaderByte & 0x1F;
+//  	nalRefIdc = (nalHeaderByte & 0x60) >> 5;
+
+  	// Decode NAL unit data 
+  	if (nalType == NAL_TYPE_CODED_SLICE || nalType == NAL_TYPE_CODED_SLICE_IDR)
+  	{
+  		// Parse the slice haeder until the PPS id
+  		// First macroblock in slice 
+//  		temp = vldGetUVLC(seq->bitbuf);
+	  		
+	  	// Slice type 
+//  		temp = vldGetUVLC(seq->bitbuf);
+
+		// PPS id 
+  		seq->iPreviousPPSId = vldGetUVLC(seq->bitbuf);
+  	}
+
+	return AVCD_OK;  
+}
+
+
+// ue_v
+// Returns unsigned UVLC code from the bitbuffer
+static int ue_v(bitbuffer_s *bitbuf, unsigned int *val, unsigned int maxVal)
+{
+  *val = vldGetUVLC(bitbuf);
+
+  if (bibGetStatus(bitbuf) < 0)
+    return SLICE_ERROR;
+
+  if (*val > maxVal)
+    return SLICE_ERR_ILLEGAL_VALUE;
+
+  return SLICE_OK;
+}
+
+
+// ModifyFrameNumber
+// Modifies the frame numbering from the input bit buffer. The bit buffer must be positioned 
+// at the start of the slice header when this function is called.
+void ModifyFrameNumber(sequence_s *seq, bitbuffer_s *bitbuf, TUint aFrameNumber, TInt aNalType)
+{
+  	seq_parameter_set_s *sps;
+  	pic_parameter_set_s *pps;
+	TUint tempValue;
+	TUint firstMbInSlice;
+	TUint ppsId;
+//	TInt spsId;
+  	
+  	
+  	// First macroblock in slice 
+  	ue_v(bitbuf, &firstMbInSlice, 65535);
+
+  	// Slice type 
+  	ue_v(bitbuf, &tempValue, SLICE_MAX);
+
+  	// PPS id 
+  	ue_v(bitbuf, &ppsId, PS_MAX_NUM_OF_PPS-1);
+  
+  	pps = seq->ppsList[ppsId];
+
+  	if (pps->indexChanged)
+  	{
+	  	// Since we generate empty frames for original clips only, 
+	  	// find out what is the original PPS id
+  		ppsId = pps->origPPSId;
+  		
+  		pps = seq->ppsList[ppsId];
+  	}
+  		
+/*
+  	if (pps == NULL) 
+  	{
+		// Use zero for SPS id
+		spsId = 0;
+  	}
+  	else
+  	{
+	  	spsId = pps->seq_parameter_set_id;
+  	}
+*/
+
+	syncBitBufferBitpos(bitbuf);
+	
+  	sps = seq->spsList[pps->seq_parameter_set_id];
+  	
+  	if (sps == NULL) 
+  	{
+    	PRINT((_L("Error: referring to non-existing SPS.\n")));     
+		return;
+  	}
+
+  	if (sps->maxFrameNumChanged)
+  	{
+	  	// Encode the new frame number here
+  		EncodeUnsignedNBits(bitbuf, aFrameNumber, sps->origMaxFrameNum+4);
+  	}
+  	else
+  	{
+	  	// Encode the new frame number here
+  		EncodeUnsignedNBits(bitbuf, aFrameNumber, sps->log2_max_frame_num_minus4+4);
+  	}
+  	
+  	// IDR picture 
+  	if (aNalType == NAL_TYPE_CODED_SLICE_IDR) 
+  	{
+    	ue_v(bitbuf, &tempValue, 65535);
+  	}
+
+	syncBitBufferBitpos(bitbuf);
+	
+  	// POC parameters 
+	if (sps->pic_order_cnt_type == 0) 
+  	{
+	  	if (sps->maxPOCNumChanged)
+  		{
+		  	// For now encode the POC as the frame number
+	  		EncodeUnsignedNBits(bitbuf, aFrameNumber, sps->origMaxPOCNum+4);
+  		}
+  		else
+  		{
+		  	// For now encode the POC as the frame number
+	  		EncodeUnsignedNBits(bitbuf, aFrameNumber, sps->log2_max_pic_order_cnt_lsb_minus4+4);
+  		}
+  	}
+}
+
+
+// avcdModifyFrameNumber
+// Modifies the input NAL unit's frame numbering
+void avcdModifyFrameNumber(avcdDecoder_t *dec, void *aNalUnitBits, TUint aNalUnitLen, TUint aFrameNumber)
+{
+    sequence_s *seq = (sequence_s *)dec;
+    TInt nalHeaderByte;
+    TInt nalType;
+	
+	// Initialize bitbuffer
+  	bibInit(seq->bitbuf, (TUint8 *)aNalUnitBits, aNalUnitLen);
+  	
+  	// Read the nalHeaderByte
+  	bibGetByte(seq->bitbuf, &nalHeaderByte);
+  	
+  	nalType   = nalHeaderByte & 0x1F;
+
+  	if (nalType == NAL_TYPE_CODED_SLICE || nalType == NAL_TYPE_CODED_SLICE_IDR)
+	  	ModifyFrameNumber(seq, seq->bitbuf, aFrameNumber, nalType);
+}
+
+
+#endif  // VIDEOEDITORENGINE_AVC_EDITING
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/slice.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1124 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include <string.h>
+#include "globals.h"
+#include "bitbuffer.h"
+#include "vld.h"
+#include "macroblock.h"
+#include "parameterset.h"
+#include "framebuffer.h"
+#include "dpb.h"
+#include "slice.h"
+#include "sequence.h"
+
+
+#define MIN_ALPHA_BETA_OFFSET   -6
+#define MAX_ALPHA_BETA_OFFSET   6
+
+/*
+ * AVC syntax functions as specified in specification
+ */
+
+
+/*
+ * Static functions
+ */
+
+static int getRefPicListReorderingCmds(slice_s *slice, unsigned int numRefFrames,
+                                       bitbuffer_s *bitbuf);
+
+static int getDecRefPicMarkingCmds(slice_s *slice, unsigned int numRefFrames,
+                                   bitbuffer_s *bitbuf);
+
+static int refPicListReordering(slice_s *slice, dpb_s *dpb,
+                                 frmBuf_s *refPicList[], int numRefPicActive,
+                                 sliceRefPicListReorderCmd_s reorderCmdList[]);
+
+
+
+/*
+ * AVC syntax functions as specified in specification
+ */
+
+/* Return fixed length code */
+static int u_n(bitbuffer_s *bitbuf, int len, unsigned int *val)
+{
+  *val = vldGetFLC(bitbuf, len);
+
+  if (bibGetStatus(bitbuf) < 0)
+    return SLICE_ERROR;
+
+  return SLICE_OK;
+}
+
+/* Return unsigned UVLC code */
+static int ue_v(bitbuffer_s *bitbuf, unsigned int *val, unsigned int maxVal)
+{
+  *val = vldGetUVLC(bitbuf);
+
+  if (bibGetStatus(bitbuf) < 0)
+    return SLICE_ERROR;
+
+  if (*val > maxVal)
+    return SLICE_ERR_ILLEGAL_VALUE;
+
+  return SLICE_OK;
+}
+
+/* Return signed UVLC code */
+static int se_v(bitbuffer_s *bitbuf, int *val, int minVal, int maxVal)
+{
+  *val = vldGetSignedUVLC(bitbuf);
+
+  if (bibGetStatus(bitbuf) < 0)
+    return SLICE_ERROR;
+
+  if (*val < minVal || *val > maxVal)
+    return SLICE_ERR_ILLEGAL_VALUE;
+
+  return SLICE_OK;
+}
+
+/* Return long signed UVLC code */
+static int se_v_long(bitbuffer_s *bitbuf, int32 *val)
+{
+  *val = vldGetSignedUVLClong(bitbuf);
+
+  if (bibGetStatus(bitbuf) < 0)
+    return SLICE_ERROR;
+
+  return SLICE_OK;
+}
+
+
+/*
+ *
+ * sliceOpen:
+ *
+ * Parameters:
+ *
+ * Function:
+ *      Allocate and initialize a slice.
+ *
+ * Returns:
+ *      Pointer to slice
+ *
+ */
+slice_s *sliceOpen()
+{
+  slice_s *slice;
+
+  slice = (slice_s *)User::Alloc(sizeof(slice_s));
+
+  if (slice != NULL)
+    memset(slice, 0, sizeof(slice_s));
+
+  return slice;
+}
+
+
+/*
+ *
+ * sliceClose:
+ *
+ * Parameters:
+ *      slice                 Slice object
+ *
+ * Function:
+ *      Deallocate slice
+ *
+ * Returns:
+ *      Nothing
+ *
+ */
+void sliceClose(slice_s *slice)
+{
+  User::Free(slice);
+}
+
+
+/*
+ * getRefPicListReorderingCmds:
+ *
+ * Parameters:
+ *     slice               Slice object
+ *     bitbuf              Bitbuffer object
+ *     numRefFrames        Number of reference frames in used
+ *
+ * Function:
+ *     Parse and store the ref pic reordering commands
+ *
+ * Return:
+ *     The number of bits being parsed
+ */
+static int getRefPicListReorderingCmds(slice_s *slice, unsigned int numRefFrames,
+                                       bitbuffer_s *bitbuf)
+{
+  int i;
+  unsigned int reordering_of_pic_nums_idc;
+  int retCode;
+
+  if (!IS_SLICE_I(slice->slice_type)) {
+
+    if ((retCode = u_n(bitbuf, 1, &slice->ref_pic_list_reordering_flag0)) < 0)
+      return retCode;
+
+    if (slice->ref_pic_list_reordering_flag0) {
+
+      i = 0;
+      do {
+        /* Get command */
+        if ((retCode = ue_v(bitbuf, &reordering_of_pic_nums_idc, 3)) < 0)
+          return retCode;
+
+        slice->reorderCmdList[i].reordering_of_pic_nums_idc = reordering_of_pic_nums_idc;
+
+        /* Get command parameters */
+        if (reordering_of_pic_nums_idc == 0 || reordering_of_pic_nums_idc == 1) {
+          unsigned int maxDiff = slice->maxFrameNum/2-1;
+          if (reordering_of_pic_nums_idc == 1)
+            maxDiff = maxDiff - 1;
+          if ((retCode = ue_v(bitbuf, &slice->reorderCmdList[i].abs_diff_pic_num_minus1, maxDiff)) < 0)
+            return retCode;
+        }
+        else if (reordering_of_pic_nums_idc == 2) {
+          /* longTermPicNum be in the range of 0 to num_ref_frames, inclusive. */
+          if ((retCode = ue_v(bitbuf, &slice->reorderCmdList[i].long_term_pic_num, numRefFrames)) < 0)
+            return retCode;
+        }
+
+        i++;
+      } while (reordering_of_pic_nums_idc != 3 && i < MAX_NUM_OF_REORDER_CMDS);
+    }
+  }
+
+  return SLICE_OK;
+}
+
+
+/*
+ * getDecRefPicMarkingCmds:
+ *
+ * Parameters:
+ *     slice               Slice object
+ *     bitbuf              Bitbuffer object
+ *     numRefFrames        Number of reference frames in used
+ *
+ * Function:
+ *     Parse and store the MMCO commands
+ *
+ * Return:
+ *     The number of bits being parsed
+ */
+static int getDecRefPicMarkingCmds(slice_s *slice, unsigned int numRefFrames,
+                                   bitbuffer_s *bitbuf)
+{
+  int i;
+  unsigned int mmco;
+  int retCode;
+
+  /* MMCO commands can exist only in slice header of a reference picture */
+  if (slice->nalRefIdc != 0) {
+    if (slice->isIDR) {
+      if ((retCode = u_n(bitbuf, 1, &slice->no_output_of_prior_pics_flag)) < 0)
+        return retCode;
+      if ((retCode = u_n(bitbuf, 1, &slice->long_term_reference_flag)) < 0)
+        return retCode;
+    }
+    else {
+      if ((retCode = u_n(bitbuf, 1, &slice->adaptive_ref_pic_marking_mode_flag)) < 0)
+        return retCode;
+
+      if (slice->adaptive_ref_pic_marking_mode_flag) {
+
+        i = 0;
+        do {
+          /* Get MMCO command */
+          if ((retCode = ue_v(bitbuf, &mmco, 6)) < 0)
+            return retCode;
+
+          slice->mmcoCmdList[i].memory_management_control_operation = mmco;
+
+          /* Get command parameter (if any) */
+          if (mmco == 1 || mmco == 3) {
+            if ((retCode = ue_v(bitbuf, &slice->mmcoCmdList[i].difference_of_pic_nums_minus1, 65535)) < 0)
+              return retCode;
+          }
+          if (mmco == 2) {
+            if ((retCode = ue_v(bitbuf, &slice->mmcoCmdList[i].long_term_pic_num, numRefFrames)) < 0)
+              return retCode;
+          }
+          if (mmco == 3 || mmco == 6) {
+            if ((retCode = ue_v(bitbuf, &slice->mmcoCmdList[i].long_term_frame_idx, numRefFrames)) < 0)
+              return retCode;
+          }
+          if (mmco == 4) {
+            if ((retCode = ue_v(bitbuf, &slice->mmcoCmdList[i].max_long_term_frame_idx_plus1, numRefFrames)) < 0)
+              return retCode;
+          }
+          if (mmco == 5) {
+            slice->picHasMMCO5 = 1;
+          }
+
+          i++;
+        } while (mmco != 0 && i < MAX_NUM_OF_MMCO_OPS);
+      }
+    }
+  }
+  else
+    slice->adaptive_ref_pic_marking_mode_flag = 0;
+
+  return 1;
+}
+
+
+/*
+ * sliceInitRefPicList:
+ *
+ * Parameters:
+ *     dpb                  DPB buffer
+ *     refPicList           Reference picture list (output)
+ *
+ * Fucntion:
+ *     Initialize reference picture list.
+ *
+ * Return:
+ *     Number of reference frames in the list
+ */
+int sliceInitRefPicList(dpb_s *dpb, frmBuf_s *refPicList[])
+{
+  int numRef, numShort;
+  frmBuf_s *refTmp;
+  int i, j;
+
+  /*
+   * Select the reference pictures from the DPB
+   */
+  j = 0;
+  /* Put short term pictures first in the list */
+  for (i = 0; i < dpb->fullness; i++) {
+    if (dpb->buffers[i]->refType == FRM_SHORT_TERM_PIC) 
+      refPicList[j++] = dpb->buffers[i];
+  }
+  numShort = j;
+  /* Put long term pictures after the short term pictures */
+  for (i = 0; i < dpb->fullness; i++) {
+    if (dpb->buffers[i]->refType == FRM_LONG_TERM_PIC) 
+      refPicList[j++] = dpb->buffers[i];
+  }
+  numRef = j;
+  /* numLong = numRef - numShort; */
+
+  /*
+   * Initialisation process for reference picture lists
+   */
+  /* Sort short term pictures in the order of descending picNum */
+  for (i = 0; i < numShort; i++) {
+    for (j = i+1; j < numShort; j++) {
+      if (refPicList[i]->picNum < refPicList[j]->picNum) {
+        /* exchange refPicList[i] and refPicList[j] */
+        refTmp = refPicList[i];
+        refPicList[i] = refPicList[j];
+        refPicList[j] = refTmp;
+      }
+    }
+  }
+  /* Sort long term pictures in the order of ascending longTermPicNum */
+  for (i = numShort; i < numRef; i++) {
+    for (j = i+1; j < numRef; j++) {
+      if (refPicList[i]->longTermPicNum > refPicList[j]->longTermPicNum) {
+        /* exchange refPicList[i] and refPicList[j] */
+        refTmp = refPicList[i];
+        refPicList[i] = refPicList[j];
+        refPicList[j] = refTmp;
+      }
+    }
+  }
+
+  return numRef;
+}
+
+
+/*
+ * sliceFixRefPicList:
+ *
+ * Parameters:
+ *     dpb                  DPB buffer
+ *     refPicList           Reference picture list (output)
+ *     numRefPicActive      Number of active reference frames
+ *     numExistingRefFrames Number of reference frames in refPicList
+ *
+ * Fucntion:
+ *     If numExistingRefFrames < numRefPicActive, try to fill up the
+ *     reference frame list
+ *
+ * Return:
+ *     0 for no pictures exist in reference frame list
+ *     1 for pictures exist in reference frame list
+ */
+int sliceFixRefPicList(dpb_s *dpb, frmBuf_s *refPicList[],
+                       int numRefPicActive, int numExistingRefFrames,
+                       int width, int height)
+{
+  int i;
+
+  if (numExistingRefFrames == 0) {
+    /* Try to find any picture in DPB, even non-reference frame */
+    for (i = 0; i < dpb->size; i++) {
+      if (dpb->buffers[i] != NULL && dpb->buffers[i]->width == width && dpb->buffers[i]->height == height)
+        break;
+    }
+
+    if (i < dpb->size) {
+      refPicList[0] = dpb->buffers[i];
+      numExistingRefFrames = 1;
+    }
+    else
+      return 0;
+  }
+
+  /* Duplicate last extry of the reference frame list so that list becomes full */
+  for (i = numExistingRefFrames; i < numRefPicActive; i++)
+    refPicList[i] = refPicList[numExistingRefFrames-1];
+
+  return 1;
+}
+
+/*
+ * refPicListReordering:
+ *
+ * Parameters:
+ *     slice                Current slice object
+ *     dpb                  DPB buffer
+ *     refPicList           Reference picture list (modified by this function)
+ *     numRefPicActive      Number of active reference frames
+ *     reorderCmdList       Reordering command list
+ *
+ * Fucntion:
+ *     Reorder the reference picture list for current slice
+ *
+ * Return:
+ *     SLICE_OK for no error and negative value for error
+ */
+static int refPicListReordering(slice_s *slice, dpb_s *dpb,
+                                frmBuf_s *refPicList[], int numRefPicActive,
+                                sliceRefPicListReorderCmd_s reorderCmdList[])
+{
+  int i;
+  int reordering_of_pic_nums_idc, longTermPicNum;
+  int32 absDiffPicNum;
+  int refIdx;
+  int32 currPicNum, picNumPred, picNumNoWrap;
+  int32 maxPicNum, picNum;
+  int cmdNum;
+  int cIdx, nIdx;
+
+  /*
+   * 3. Reordering process for reference picture list
+   */
+
+  maxPicNum = slice->maxFrameNum;   /* for frame coding only */
+  currPicNum = slice->frame_num;
+  picNumPred = currPicNum;
+  refIdx = 0;
+  cmdNum = 0;
+
+  do {
+    reordering_of_pic_nums_idc = reorderCmdList[cmdNum].reordering_of_pic_nums_idc;
+
+    if (reordering_of_pic_nums_idc == 0 || reordering_of_pic_nums_idc == 1) {
+
+      /*
+       * reorder short-term ref pic  -subclause 8.2.4.3.1
+       */
+
+      absDiffPicNum = reorderCmdList[cmdNum].abs_diff_pic_num_minus1 + 1;
+
+      /* Derive picNumNoWrap */
+      if (reordering_of_pic_nums_idc == 0) {
+        if (picNumPred - absDiffPicNum < 0)
+          picNumNoWrap = picNumPred - absDiffPicNum + maxPicNum;
+        else
+          picNumNoWrap = picNumPred - absDiffPicNum;
+      }
+      else { /* reordering_of_pic_nums_idc == 1 */
+        if (picNumPred + absDiffPicNum >= maxPicNum) 
+          picNumNoWrap = picNumPred + absDiffPicNum - maxPicNum;
+        else
+          picNumNoWrap = picNumPred + absDiffPicNum;
+      }
+
+      /* Derive picNum */
+      if (picNumNoWrap > currPicNum)
+        picNum = picNumNoWrap - maxPicNum;
+      else
+        picNum = picNumNoWrap;
+
+      /* Find short term picture with picture number picNum */
+      for (i = 0; i < dpb->fullness; i++) {
+        if (!dpb->buffers[i]->nonExisting &&
+            dpb->buffers[i]->refType == FRM_SHORT_TERM_PIC &&
+            dpb->buffers[i]->picNum == picNum)
+          break;
+      }
+
+      /* If picNum was not found */
+      if (i == dpb->fullness) {
+        PRINT((_L("The short term ref pic(%d) is not found!\n"), picNum));
+        return SLICE_ERR_ILLEGAL_VALUE;
+      }
+
+      /* Shift remaining pictures later in the list */
+      for (cIdx = numRefPicActive; cIdx > refIdx; cIdx--)
+        refPicList[cIdx] = refPicList[cIdx - 1];
+
+      /* Place picture with number picNum into the index position refIdx */
+      refPicList[refIdx++] = dpb->buffers[i];
+
+      /* Remove duplicate of the inserted picture */
+      nIdx = refIdx;
+      for (cIdx = refIdx; cIdx <= numRefPicActive; cIdx++)
+        if (refPicList[cIdx]->refType == FRM_LONG_TERM_PIC || refPicList[cIdx]->picNum != picNum)
+          refPicList[nIdx++] = refPicList[cIdx];
+
+      picNumPred = picNumNoWrap;
+    }
+
+    else if (reordering_of_pic_nums_idc == 2) {
+
+      /*
+       * reorder long-term ref pic  -subclause 8.2.4.3.2
+       */
+
+      /* Get long-term picture number */
+      longTermPicNum = reorderCmdList[cmdNum].long_term_pic_num;
+
+      /* Find long-term picture with picture number longTermPicNum */
+      for (i = 0; i < dpb->fullness; i++)
+        if (dpb->buffers[i]->refType == FRM_LONG_TERM_PIC &&
+            dpb->buffers[i]->longTermPicNum == longTermPicNum)
+          break;
+
+      if (i == dpb->fullness) {
+        // something wrong !
+        PRINT((_L("The long term ref pic(%d) is not found!\n"), longTermPicNum));
+        return SLICE_ERR_ILLEGAL_VALUE;
+      }
+
+      /* Shift remaining pictures later in the list */
+      for (cIdx = numRefPicActive; cIdx > refIdx; cIdx--)
+        refPicList[cIdx] = refPicList[cIdx - 1];
+
+      /* Place picture with number longTermPicNum into the index position refIdx */
+      refPicList[refIdx++] = dpb->buffers[i];
+
+      /* Remove duplicate of the inserted picture */
+      nIdx = refIdx;
+      for (cIdx = refIdx; cIdx <= numRefPicActive; cIdx++)
+        if (refPicList[cIdx]->refType == FRM_SHORT_TERM_PIC ||
+            refPicList[cIdx]->longTermPicNum != longTermPicNum)
+        {
+          refPicList[nIdx++] = refPicList[cIdx];
+        }
+    }
+
+    cmdNum++;
+
+  } while (reordering_of_pic_nums_idc != 3 && cmdNum < MAX_NUM_OF_REORDER_CMDS);
+
+
+  refPicList[numRefPicActive] = 0;
+
+  return SLICE_OK;
+}
+
+
+// sliceParseMacroblocks
+// Parses the macroblocks one by one in the input slice. 
+TInt sliceParseMacroblocks(slice_s *slice, frmBuf_s *recoBuf, dpb_s *dpb,
+                           pic_parameter_set_s *pps,
+                           mbAttributes_s *mbData, TInt sliceID,
+                           bitbuffer_s *bitbuf,
+                           TBool aBitShiftInSlice)
+{
+  	frmBuf_s *refPicList0[DPB_MAX_SIZE+1];
+  	macroblock_s mb;
+  	TInt numRefFrames;
+  	TInt numExistingRefFrames;
+//  	TInt refFramesExist;
+  	TInt mbIdxY;
+  	TInt mbIdxX;
+  	TInt mbksPerLine;
+  	TInt mbksPerCol;
+  	TInt picSizeInMbs;
+  	TInt currMbAddr;
+  	TInt sliceGroupNum;
+  	void *stream;
+  	TInt retCode;
+
+  	// Choose number of reference frames and build reference picture list 
+  	numRefFrames   = 0;
+//  	refFramesExist = 0;
+  	if (!IS_SLICE_I(slice->slice_type)) 
+  	{	
+    	if (slice->num_ref_idx_active_override_flag)
+      		numRefFrames = slice->num_ref_idx_l0_active_minus1 + 1;
+    	else
+      		numRefFrames = pps->num_ref_idx_l0_active_minus1 + 1;
+
+    	numExistingRefFrames = sliceInitRefPicList(dpb, refPicList0);
+
+    	if (numExistingRefFrames < numRefFrames) 
+    	{
+//      		refFramesExist = sliceFixRefPicList(dpb, refPicList0, numRefFrames, numExistingRefFrames,
+//            	                                recoBuf->width, recoBuf->height);
+    	}
+    	else
+//      		refFramesExist = 1;
+
+    	if (slice->ref_pic_list_reordering_flag0 && numExistingRefFrames > 0) 
+    	{
+      		retCode = refPicListReordering(slice, dpb, refPicList0, numRefFrames, slice->reorderCmdList);
+      		
+      		if (retCode < 0)
+        		return retCode;
+    	}
+  	}
+
+  	mbksPerLine = recoBuf->width/MBK_SIZE;
+  	mbksPerCol  = recoBuf->height/MBK_SIZE;
+  	picSizeInMbs = mbksPerLine*mbksPerCol;
+
+  	currMbAddr = slice->first_mb_in_slice;
+  	sliceGroupNum = sliceID & 0xF;
+
+  	mbIdxY = currMbAddr / mbksPerLine;
+  	mbIdxX = currMbAddr - mbIdxY*mbksPerLine;
+
+  	mbkSetInitialQP(&mb, slice->qp, pps->chroma_qp_index_offset);
+
+  	stream = bitbuf;
+
+  	// Loop until all macroblocks in current slice have been decoded 
+  	// If there has been a bitshift in the slice, we must go through 
+  	// the macroblocks to see if any PCM coded MB are used.
+  	if(aBitShiftInSlice)
+  	{
+  	
+  		do 
+  		{
+
+    		// Store slice ID for current macroblock 
+    		mbData->sliceMap[currMbAddr] = sliceID;
+
+    		// Store loopfilter mode 
+    		mbData->filterModeTab[currMbAddr] = (int8) slice->disable_deblocking_filter_idc;
+    		mbData->alphaOffset[currMbAddr]   = (int8) (slice->slice_alpha_c0_offset_div2*2);
+    		mbData->betaOffset[currMbAddr]    = (int8) (slice->slice_beta_offset_div2*2);
+
+    		retCode = mbkParse(&mb, numRefFrames,
+            		           mbData, recoBuf->width, 
+                    		   slice->slice_type, pps->constrained_intra_pred_flag,
+                       		   pps->chroma_qp_index_offset,
+		                       mbIdxX, mbIdxY, stream, slice->bitOffset);
+
+			if (retCode == MBK_PCM_FOUND)
+			{
+				// We can stop parsing this slice
+				// Check later if this is the case also if we have slices in more than one NAL (is it even possible?)!!!
+				return SLICE_OK;
+			}
+	
+    		if (retCode < 0)
+      			return SLICE_ERROR;
+
+      		// If end of slice data has been reached and there are no 
+      		// skipped macroblocks left, stop decoding slice.         
+      		if (!bibMoreRbspData(bitbuf) && mb.numSkipped <= 0)
+        		break;
+
+    		// Find next mb address in the current slice group 
+    		do 
+    		{
+      			// Next mb address 
+      			currMbAddr++;
+
+      			// If end of frame was reached, stop search 
+      			if (currMbAddr == picSizeInMbs)
+        			break;
+
+      			// Update mb location 
+      			mbIdxX++;
+      			if (mbIdxX == mbksPerLine) 
+      			{
+        			mbIdxX = 0;
+        			mbIdxY++;
+      			}
+
+    		} while ((mbData->sliceMap[currMbAddr] & 0xF) != sliceGroupNum);
+
+    	// If end of frame was reached, stop decoding slice 
+  		} while (currMbAddr < picSizeInMbs);
+  	}
+
+  	return SLICE_OK;
+}
+
+
+// EncodeUnsignedNBits
+// Encodes the input aValue to the bit buffer with aLength bits.
+void EncodeUnsignedNBits(bitbuffer_s *aBitBuffer, TUint aValue, TUint aLength)
+{
+	TUint tempValue;
+	TInt i;
+	TUint8 byteValue;
+	 
+	if(aBitBuffer->bitpos == 0)
+	{
+		// Get the next byte
+		aBitBuffer->currentBits = aBitBuffer->data[aBitBuffer->bytePos];
+		aBitBuffer->bytePos++;
+		aBitBuffer->bitpos = 8;
+	}
+		
+	// Write aValue bit by bit to the bit buffer
+	for (i=aLength-1; i>=0; i--)
+	{
+		// Get the ith bit from aValue
+		tempValue = (aValue & (1 << i)) >> i;
+		
+		// Zero out the bitpos bit
+		byteValue = aBitBuffer->data[aBitBuffer->bytePos-1] & ~(1<<(aBitBuffer->bitpos-1));
+		byteValue |= tempValue << (aBitBuffer->bitpos-1);
+		
+		aBitBuffer->data[aBitBuffer->bytePos-1] = byteValue;
+		aBitBuffer->bitpos--;
+		
+		if(aBitBuffer->bitpos == 0)
+		{
+			// Get the next byte
+			aBitBuffer->currentBits = aBitBuffer->data[aBitBuffer->bytePos];
+
+			aBitBuffer->bytePos++;
+			aBitBuffer->bitpos = 8;
+		}
+	}
+	
+	// Make sure the bit buffer currentBits is up-to-date
+	aBitBuffer->currentBits = aBitBuffer->data[aBitBuffer->bytePos-1];
+}
+
+
+// ParseSliceHeader
+// Parses the input slice header. PPS Id, frame numbering and POC LSB are modified if required.
+TInt ParseSliceHeader(slice_s *slice, seq_parameter_set_s *spsList[],
+                      pic_parameter_set_s *ppsList[], bitbuffer_s *bitbuf, 
+                      TUint* aFrameNumber, TUint aFrameFromEncoder)
+{
+  	seq_parameter_set_s *sps;
+  	pic_parameter_set_s *pps;
+  	TUint picSizeInMapUnits;
+  	TUint temp, temp2;
+  	TInt sliceQp, len1;
+  	TInt retCode;
+  	TInt shiftedBits = 0;
+
+
+  	slice->picHasMMCO5 = 0;
+  
+  	// Initialize the bit offset to zero
+  	slice->bitOffset = 0;
+
+  	// First macroblock in slice 
+  	if ((retCode = ue_v(bitbuf, &slice->first_mb_in_slice, 65535)) < 0)
+    	return retCode;
+
+  	// Slice type 
+  	if ((retCode = ue_v(bitbuf, &slice->slice_type, SLICE_MAX)) < 0)
+    	return retCode;
+
+  	// PPS id 
+  	if ((retCode = ue_v(bitbuf, &slice->pic_parameter_set_id, PS_MAX_NUM_OF_PPS-1)) < 0)
+    	return retCode;
+  
+  	pps = ppsList[slice->pic_parameter_set_id];
+
+  	if (pps == NULL) 
+  	{
+    	PRINT((_L("Error: referring to non-existing PPS.\n")));     
+    		return SLICE_ERR_NON_EXISTING_PPS;
+  	}
+
+	syncBitBufferBitpos(bitbuf);
+	
+  	// If the index has been changed the new index must be coded instead of 
+  	// the old one to the slice header
+  	if (pps->indexChanged)
+  	{
+  		// We have to encode the new PPS Id to the bitbuffer
+  		TUint oldPPSId = slice->pic_parameter_set_id;
+  		TUint newPPSId;
+  	
+  		if ( aFrameFromEncoder )
+  			newPPSId = pps->encPPSId;
+  		else
+  			newPPSId = pps->origPPSId;
+  	
+		TUint trailingBits = GetNumTrailingBits(bitbuf);
+		TInt diff = 0;
+	
+		TUint oldIdLength = ReturnUnsignedExpGolombCodeLength(oldPPSId);
+		TUint newIdLength = ReturnUnsignedExpGolombCodeLength(newPPSId);
+	
+		// Signal that the slice data has been modified
+		slice->sliceDataModified = 1;    
+    
+		// Get the new pps
+		pps = ppsList[newPPSId];
+		
+		if(trailingBits > 8)
+		{
+			trailingBits = 8;
+		}
+		
+		if ( oldIdLength == newIdLength )	
+		{
+			// Just encode the new Id on top of the old Id
+			bitbuf->bitpos += oldIdLength;
+			
+			if(bitbuf->bitpos > 8)
+			{	
+				// Go to the right byte and bit position
+				bitbuf->bytePos -= bitbuf->bitpos / 8;
+				bitbuf->bitpos = bitbuf->bitpos % 8;
+			}
+			
+			EncodeUnsignedExpGolombCode(bitbuf, newPPSId);
+		}
+		else if ( oldIdLength < newIdLength )
+		{
+			diff = newIdLength - oldIdLength;
+		
+			// Positive bit offset indicates bit-wise shift to right
+			slice->bitOffset = (diff % 8);
+		
+			ShiftBufferRight(bitbuf, diff, trailingBits, oldIdLength);
+		
+			// After shifting, encode the new value to the bit buffer
+			EncodeUnsignedExpGolombCode(bitbuf, newPPSId);
+		}
+		else
+		{
+			// New id's length is smaller than old id's length
+			diff = oldIdLength - newIdLength;
+	
+			// Negative bit offset indicates bit-wise shift to left
+			slice->bitOffset = -(diff % 8);
+		
+			ShiftBufferLeft(bitbuf, diff, oldIdLength);
+		
+			// After shifting, encode the new value to the bit buffer
+			EncodeUnsignedExpGolombCode(bitbuf, newPPSId);
+		}
+	
+		shiftedBits = diff;
+  	}
+
+  	sps = spsList[pps->seq_parameter_set_id];
+  	
+  	if (sps == NULL) 
+  	{
+    	PRINT((_L("Error: referring to non-existing SPS.\n")));     
+    	return SLICE_ERR_NON_EXISTING_SPS;
+  	}
+
+  	picSizeInMapUnits = (sps->pic_width_in_mbs_minus1+1) * (sps->pic_height_in_map_units_minus1+1);
+
+  	if (slice->first_mb_in_slice >= picSizeInMapUnits)
+    	return SLICE_ERR_ILLEGAL_VALUE;
+
+  	// Maximum frame number 
+  	slice->maxFrameNum = (TUint)1 << (sps->log2_max_frame_num_minus4+4);
+  
+  	// IDR type NAL unit shall have frame number as zero
+	if ( slice->nalType == NAL_TYPE_CODED_SLICE_IDR )
+	{
+		// Reset frame number for an IDR slice
+	 	*aFrameNumber = 0;	
+	}
+	else if ( *aFrameNumber == (slice->maxFrameNum - 1 ) )
+	{
+		// Reset frame number if maximum frame number has been reached
+	 	*aFrameNumber = 0;	
+	}
+	else if( !slice->first_mb_in_slice )
+	{
+	    (*aFrameNumber)++;	// Increment frame number only if this is the first mb in slice
+	}
+	
+
+  	if (sps->maxFrameNumChanged)
+  	{
+  		// Frame number field size
+  		TUint oldFrameNum;
+  		TUint newFrameNum = sps->log2_max_frame_num_minus4+4;
+  	
+  		if ( aFrameFromEncoder )
+  			oldFrameNum = sps->encMaxFrameNum+4;
+  		else
+  			oldFrameNum = sps->origMaxFrameNum+4;
+  	
+		TUint trailingBits = GetNumTrailingBits(bitbuf);
+		TInt diff = 0;
+	
+		// Signal that the slice data has been modified
+		slice->sliceDataModified = 1;    
+    
+		if(trailingBits > 8)
+		{
+			trailingBits = 8;
+		}
+		
+		// If the size of the frame number field has changed then shift bits in the buffer
+		if ( oldFrameNum < newFrameNum )
+		{
+			diff = newFrameNum - oldFrameNum;
+		
+			// Positive bit offset indicates bit-wise shift to right
+			slice->bitOffset += (diff % 8);
+		
+			ShiftBufferRight(bitbuf, diff, trailingBits, 0);
+		}
+		else if ( oldFrameNum > newFrameNum )
+		{
+			// New id's length is smaller than old id's length
+			diff = oldFrameNum - newFrameNum;
+	
+			// Negative bit offset indicates bit-wise shift to left
+			slice->bitOffset -= (diff % 8);
+		
+			ShiftBufferLeft(bitbuf, diff, 0);
+		}
+	
+		shiftedBits += diff;
+  	}
+  
+  	// Encode the new frame number here
+  	EncodeUnsignedNBits(bitbuf, *aFrameNumber, sps->log2_max_frame_num_minus4+4);
+  
+  	slice->frame_num = *aFrameNumber;
+
+  	// IDR picture 
+  	if (slice->isIDR) 
+  	{
+    	if ((retCode = ue_v(bitbuf, &slice->idr_pic_id, 65535)) < 0)
+      		return retCode;
+  	}
+
+	syncBitBufferBitpos(bitbuf);
+	
+  	// POC parameters 
+	if (sps->pic_order_cnt_type == 0) 
+  	{
+	  	if (sps->maxPOCNumChanged)
+  		{
+  			// POC lsb number 
+  			TUint oldPOCNum;
+  			TUint newPOCNum = sps->log2_max_pic_order_cnt_lsb_minus4+4;
+  	
+  			if ( aFrameFromEncoder )
+  				oldPOCNum = sps->encMaxPOCNum+4;
+  			else
+  				oldPOCNum = sps->origMaxPOCNum+4;
+  	
+			TUint trailingBits = GetNumTrailingBits(bitbuf);
+			TInt diff = 0;
+	
+			// Signal that the slice data has been modified
+			slice->sliceDataModified = 1;    
+    
+			if (trailingBits > 8)
+			{
+				trailingBits = 8;
+			}
+		
+			// If the size of the POC lsb field has changed then shift bits in the buffer
+			if ( oldPOCNum < newPOCNum )
+			{	
+				diff = newPOCNum - oldPOCNum;
+		
+				// Positive bit offset indicates bit-wise shift to right
+				slice->bitOffset += (diff % 8);
+		
+				ShiftBufferRight(bitbuf, diff, trailingBits, 0);
+
+			}
+			else if ( oldPOCNum > newPOCNum )
+			{
+				// New id's length is smaller than old id's length
+				diff = oldPOCNum - newPOCNum;
+	
+				// Negative bit offset indicates bit-wise shift to left
+				slice->bitOffset -= (diff % 8);
+		
+				ShiftBufferLeft(bitbuf, diff, 0);
+			
+			}
+	
+			shiftedBits += diff;
+  		}
+  
+	  	// For now encode the POC as the frame number
+  		EncodeUnsignedNBits(bitbuf, *aFrameNumber, sps->log2_max_pic_order_cnt_lsb_minus4+4);
+  
+   		slice->delta_pic_order_cnt_bottom = 0;
+    	
+    	if (pps->pic_order_present_flag) 
+    	{ //  && !field_pic_flag 
+      		if ((retCode = se_v_long(bitbuf, &slice->delta_pic_order_cnt_bottom)) < 0)
+        		return retCode;
+    	}
+  	}
+  	else if (sps->pic_order_cnt_type == 1) 
+  	{
+    	slice->delta_pic_order_cnt_0 = 0;
+    	slice->delta_pic_order_cnt_1 = 0;
+    	// Read delta_pic_order_cnt[ 0 ] and delta_pic_order_cnt[ 1 ]
+    	if (!sps->delta_pic_order_always_zero_flag) 
+    	{
+      		// delta_pic_order_cnt[ 0 ] 
+      		if ((retCode = se_v_long(bitbuf, &slice->delta_pic_order_cnt_0)) < 0)
+        		return retCode;
+      		if (pps->pic_order_present_flag) 
+      		{ //  delta_pic_order_cnt[ 1 ] 
+        		if ((retCode = se_v_long(bitbuf, &slice->delta_pic_order_cnt_1)) < 0)
+          			return retCode;
+      		}
+    	}
+  	}
+
+	// If we don't have to do any bit shifting (left or right) with the slice header, 
+	// we can just stop parsing the header and return.
+	if (shiftedBits == 0)
+	{
+		return SLICE_STOP_PARSING;
+	}
+	
+  	// Redundant picture count
+  	if (pps->redundant_pic_cnt_present_flag) 
+  	{
+    	if ((retCode = ue_v(bitbuf, &slice->redundant_pic_cnt, 127)) < 0)
+      		return retCode;
+  	}
+  	else
+    	slice->redundant_pic_cnt = 0;
+
+  	// Reference picture management 
+  	if (IS_SLICE_P(slice->slice_type)) 
+  	{
+    	if ((retCode = u_n(bitbuf, 1, &slice->num_ref_idx_active_override_flag)) < 0)
+      		return retCode;
+    	if (slice->num_ref_idx_active_override_flag) 
+    	{
+      		if ((retCode = ue_v(bitbuf, &slice->num_ref_idx_l0_active_minus1, DPB_MAX_SIZE-1)) < 0)
+        		return retCode;
+    	}
+  	}
+
+  	// Reordering the reference picture list 
+  	retCode = getRefPicListReorderingCmds(slice, sps->num_ref_frames, bitbuf);
+
+	if (retCode < 0)
+    	return retCode;
+
+  	// Read the MMCO commands, but not do the operations until all the slices in current picture are decoded 
+  	if (slice->nalRefIdc) 
+  	{
+    	retCode = getDecRefPicMarkingCmds(slice, sps->num_ref_frames, bitbuf);
+    	if (retCode < 0)
+      		return retCode;
+  	}
+
+  	// Slice quant 
+  	if ((retCode = se_v(bitbuf, &slice->slice_qp_delta, -MAX_QP, MAX_QP)) < 0)
+    	return retCode;
+
+  	sliceQp = pps->pic_init_qp_minus26 + 26 + slice->slice_qp_delta;
+  	if (sliceQp < MIN_QP || sliceQp > MAX_QP) 
+  	{
+    	PRINT((_L("Error: illegal slice quant.\n")));     
+    	return SLICE_ERR_ILLEGAL_VALUE;
+  	}
+  	
+  	slice->qp = sliceQp;
+
+  	// Deblocking filter 
+  	slice->disable_deblocking_filter_idc = 0;
+  	slice->slice_alpha_c0_offset_div2    = 0;
+  	slice->slice_beta_offset_div2        = 0;
+
+  	if (pps->deblocking_filter_parameters_present_flag == 1) 
+  	{
+
+    	if ((retCode = ue_v(bitbuf, &slice->disable_deblocking_filter_idc, 2)) < 0)
+      		return retCode;
+
+    	if (slice->disable_deblocking_filter_idc != 1) 
+    	{
+      		if ((retCode = se_v(bitbuf, &slice->slice_alpha_c0_offset_div2, MIN_ALPHA_BETA_OFFSET, MAX_ALPHA_BETA_OFFSET)) < 0)
+        		return retCode;
+      		if ((retCode = se_v(bitbuf, &slice->slice_beta_offset_div2, MIN_ALPHA_BETA_OFFSET, MAX_ALPHA_BETA_OFFSET)) < 0)
+        		return retCode;
+    	}
+  	}
+
+  	// Read slice_group_change_cycle 
+  	if (pps->num_slice_groups_minus1 > 0 && pps->slice_group_map_type >= 3 &&
+        pps->slice_group_map_type <= 5)
+  	{
+    	// len = Ceil( Log2( PicSizeInMapUnits / SliceGroupChangeRate + 1 ) ) 
+	    // PicSizeInMapUnits / SliceGroupChangeRate 
+    	temp = picSizeInMapUnits / (pps->slice_group_change_rate_minus1+1);
+
+    	// Calculate Log2 
+    	temp2 = (temp + 1) >> 1;
+    	for (len1 = 0; len1 < 16 && temp2 != 0; len1++)
+      		temp2 >>= 1;
+
+    	// Calculate Ceil 
+    	if ( (((unsigned)1) << len1) < (temp + 1) )
+      		len1++;
+
+    	if ((retCode = u_n(bitbuf, len1, &slice->slice_group_change_cycle)) < 0)
+      		return retCode;
+
+    	// Ceil( PicSizeInMapUnits/SliceGroupChangeRate ) 
+    	if (temp * (pps->slice_group_change_rate_minus1+1) != picSizeInMapUnits)
+      		temp++;
+
+    	// The value of slice_group_change_cycle shall be in the range of  
+    	// 0 to Ceil( PicSizeInMapUnits/SliceGroupChangeRate ), inclusive. 
+    	if (slice->slice_group_change_cycle > temp)
+      		return SLICE_ERR_ILLEGAL_VALUE;
+  	}
+
+  	return SLICE_OK;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/vedavcedit.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* API class for avc editing module.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "vedavcedit.h"
+#include "vedavceditimp.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTRTranscoder::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVedAVCEdit* CVedAVCEdit::NewL()
+    {
+    CVedAVCEditImp* self = CVedAVCEditImp::NewL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CTRTranscoder::~CTRTranscoder()
+// Destructor
+// ---------------------------------------------------------
+//
+CVedAVCEdit::~CVedAVCEdit()
+    {
+    }
+
+
+
+#ifndef EKA2
+
+// -----------------------------------------------------------------------------
+// E32Dll DLL Entry point
+// -----------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
+    {
+    return(KErrNone);
+    }
+
+#endif
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/vedavceditimp.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1005 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation class for AVC editing operations.
+*
+*/
+
+
+#include <e32svr.h>  
+#include <mmf/devVideo/avc.h>
+
+#include "biblin.h"
+#include "bitbuffer.h"
+#include "vld.h"
+#include "vedavceditimp.h"
+
+// Debug print macro
+#ifdef _DEBUG   
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+// An assertion macro wrapper to clean up the code a bit
+#define VPASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CVedAVCEdit"), -10000))
+
+// ================= MEMBER FUNCTIONS =======================
+
+// Two-phased constructor
+CVedAVCEditImp* CVedAVCEditImp::NewL()
+{
+    CVedAVCEditImp* self = new (ELeave) CVedAVCEditImp();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();    
+    return self;    
+}
+
+// C++ default constructor
+CVedAVCEditImp::CVedAVCEditImp()
+    {    
+    }
+
+// Symbian OS default constructor can leave
+void CVedAVCEditImp::ConstructL()
+    {
+    
+    iAvcDecoder = avcdOpen();
+    
+    if (!iAvcDecoder)
+        {
+        User::Leave(KErrNoMemory);
+        }
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+	iNalLengthSize = 4;
+	iOutputLevel = 10;
+#endif
+    
+    }
+
+// Destructor
+CVedAVCEditImp::~CVedAVCEditImp()
+    {
+    avcdClose(iAvcDecoder);
+    }
+
+
+// ---------------------------------------------------------7
+// AVCEditParser::ProcessAVCBitStream
+// Process one input AVC frame, i.e., convert to MDF NAL unit
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//				
+void CVedAVCEditImp::ProcessAVCBitStreamL(TDes8& aBuf, TInt& aFrameLen, TInt aDecInfoSize, TBool aFirstFrame)
+    {
+    
+    TUint8* dataBuffer = (TUint8*)(aBuf.Ptr());        
+
+    // Calculate NAL header start offset
+    TInt offset = (((aFrameLen - 1) / 4) + 1) * 4;     // Align at 32-bit boundrary
+    TInt numNALUnits = 0;        
+
+    if (aFirstFrame)    // There are several NAL units: decoder info and the frame
+        {
+        // how many bytes used for length
+        iFrameLengthBytes = ( dataBuffer[4] & 0x3 ) + 1;
+        
+        // Index where to read configuration data
+        TInt index = 5;     // Skip version and length information                        
+        
+        TInt numOfSPS = dataBuffer[index] & 0x1f;
+        index++;
+        
+        // Loop all SPS units
+        for (TInt i = 0; i < numOfSPS; ++i)
+            {
+            TInt SPSSize = (dataBuffer[index] << 8) + dataBuffer[index + 1];
+            index += 2;
+            
+            // Set NAL start offset
+            dataBuffer[offset + 0] = TUint8(index & 0xff);
+            dataBuffer[offset + 1] = TUint8((index >> 8) & 0xff);
+            dataBuffer[offset + 2] = TUint8((index >> 16) & 0xff);
+            dataBuffer[offset + 3] = TUint8((index >> 24) & 0xff);
+            
+            // Set NAL size
+            dataBuffer[offset + 4] = TUint8(SPSSize & 0xff);
+            dataBuffer[offset + 5] = TUint8((SPSSize >> 8) & 0xff);
+            dataBuffer[offset + 6] = TUint8((SPSSize >> 16) & 0xff);
+            dataBuffer[offset + 7] = TUint8((SPSSize >> 24) & 0xff);
+            
+            offset += 8;
+            index += SPSSize;
+            numNALUnits++;
+            }
+            
+        TInt numOfPPS = dataBuffer[index];
+        index++;
+        
+        // Loop all PPS units
+        for (TInt i = 0; i < numOfPPS; ++i)
+            {
+            TInt PPSSize = (dataBuffer[index] << 8) + dataBuffer[index + 1];
+            index += 2;
+            
+            // Set NAL start offset
+            dataBuffer[offset + 0] = TUint8(index & 0xff);
+            dataBuffer[offset + 1] = TUint8((index >> 8) & 0xff);
+            dataBuffer[offset + 2] = TUint8((index >> 16) & 0xff);
+            dataBuffer[offset + 3] = TUint8((index >> 24) & 0xff);
+            
+            // Set NAL size
+            dataBuffer[offset + 4] = TUint8(PPSSize & 0xff);
+            dataBuffer[offset + 5] = TUint8((PPSSize >> 8) & 0xff);
+            dataBuffer[offset + 6] = TUint8((PPSSize >> 16) & 0xff);
+            dataBuffer[offset + 7] = TUint8((PPSSize >> 24) & 0xff);
+            
+            offset += 8;
+            index += PPSSize;
+            numNALUnits++;
+            }
+        
+        TInt totalFrameSize = aFrameLen;
+        TInt currentProcessed = aDecInfoSize + 4; // skip DCR & length
+        TUint8* frameLenPtr = const_cast<TUint8*>(aBuf.Ptr()) + aDecInfoSize;
+        
+        TInt frameSize = 0;
+        
+        // loop all slice NAL units
+        while (currentProcessed < totalFrameSize)
+            {                                        
+                
+            // Set the NAL start offset
+            dataBuffer[offset + 0] = TUint8(currentProcessed & 0xff);
+            dataBuffer[offset + 1] = TUint8((currentProcessed >> 8) & 0xff);
+            dataBuffer[offset + 2] = TUint8((currentProcessed >> 16) & 0xff);
+            dataBuffer[offset + 3] = TUint8((currentProcessed >> 24) & 0xff);
+            
+            frameSize = (frameLenPtr[0] << 24) + (frameLenPtr[1] << 16) +
+                        (frameLenPtr[2] << 8) + frameLenPtr[3];
+            
+            // Set the NAL size
+            dataBuffer[offset + 4] = TUint8(frameSize & 0xff);
+            dataBuffer[offset + 5] = TUint8((frameSize >> 8) & 0xff);
+            dataBuffer[offset + 6] = TUint8((frameSize >> 16) & 0xff);
+            dataBuffer[offset + 7] = TUint8((frameSize >> 24) & 0xff);
+            
+            frameLenPtr += (4 + frameSize);
+            currentProcessed += (4 + frameSize);
+            offset += 8;    
+            numNALUnits++;
+            
+            }
+        
+        // Set Number of NAL units
+        dataBuffer[offset + 0] = TUint8(numNALUnits & 0xff);
+        dataBuffer[offset + 1] = TUint8((numNALUnits >> 8) & 0xff);
+        dataBuffer[offset + 2] = TUint8((numNALUnits >> 16) & 0xff);
+        dataBuffer[offset + 3] = TUint8((numNALUnits >> 24) & 0xff);
+        
+        aFrameLen = offset + 4;
+        }
+    else
+        {  // process just the frame
+
+        TInt totalFrameSize = aFrameLen;
+        TInt currentProcessed = 4;  // skip length
+        TUint8* frameLenPtr = const_cast<TUint8*>(aBuf.Ptr());
+        
+        TInt frameSize = 0;
+        
+        // loop all slice NAL units
+        while (currentProcessed < totalFrameSize)
+            {
+            // Set the NAL start offset
+            dataBuffer[offset + 0] = TUint8(currentProcessed & 0xff);
+            dataBuffer[offset + 1] = TUint8((currentProcessed >> 8) & 0xff);
+            dataBuffer[offset + 2] = TUint8((currentProcessed >> 16) & 0xff);
+            dataBuffer[offset + 3] = TUint8((currentProcessed >> 24) & 0xff);
+            
+            frameSize = (frameLenPtr[0] << 24) + (frameLenPtr[1] << 16) +
+                        (frameLenPtr[2] << 8) + frameLenPtr[3];
+            
+            // Set the NAL size
+            dataBuffer[offset + 4] = TUint8(frameSize & 0xff);
+            dataBuffer[offset + 5] = TUint8((frameSize >> 8) & 0xff);
+            dataBuffer[offset + 6] = TUint8((frameSize >> 16) & 0xff);
+            dataBuffer[offset + 7] = TUint8((frameSize >> 24) & 0xff);
+            
+            frameLenPtr += (4 + frameSize);
+            currentProcessed += (4 + frameSize);
+            offset += 8;    
+            numNALUnits++;
+            }
+               
+        // Number of NAL units
+        dataBuffer[offset + 0] = TUint8(numNALUnits & 0xff);
+        dataBuffer[offset + 1] = TUint8((numNALUnits >> 8) & 0xff);
+        dataBuffer[offset + 2] = TUint8((numNALUnits >> 16) & 0xff);
+        dataBuffer[offset + 3] = TUint8((numNALUnits >> 24) & 0xff);
+        
+        aFrameLen = offset + 4;
+        }
+    //iDataLength = iCurrentFrameLength;
+    }
+    
+// ---------------------------------------------------------
+// CVedAVCEditImp::GetMaxAVCFrameBuffering
+// Calculate maximum amount of buffered AVC frames 
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//				
+TInt CVedAVCEditImp::GetMaxAVCFrameBuffering(TInt aLevel, TSize aResolution)
+    {
+
+    TReal maxDPB = 0.0;    
+    switch (aLevel)
+        {
+        case 11:        
+            maxDPB = 337.5;        
+            break;
+                        
+        case 12:
+            maxDPB = 891.0;
+            break;
+        
+        case 10:
+        case 101:
+        default:
+            maxDPB = 148.5;
+            break;
+        }
+    
+    TInt mbWidth = aResolution.iWidth / 16;
+    TInt mbHeight = aResolution.iHeight / 16;
+    
+    TInt maxDPBSize = TInt( ( TReal(1024.0) * maxDPB ) / ( TReal(mbWidth*mbHeight*384.0) ) );
+ 
+    maxDPBSize = min(maxDPBSize, 16);
+ 
+    return maxDPBSize;
+    }
+    
+// ---------------------------------------------------------
+// CVedAVCEditImp::GetLevel   
+// Get input bitstream level from SPS
+// ---------------------------------------------------------
+//
+TInt CVedAVCEditImp::GetLevel(TDesC8& aBuf, TInt& aLevel)
+    {
+    TUint8* buffer = (TUint8*)(aBuf.Ptr());
+
+    TInt index = 5;     // Skip version and length information                        
+    
+#ifdef _DEBUG
+    TInt numOfSPS = buffer[index] & 0x1f;
+    VPASSERT(numOfSPS == 1);
+#endif
+    
+    index++;
+    
+    TUint SPSSize = (buffer[index] << 8) + buffer[index + 1];
+    index += 2;
+    
+    TInt error = avcdParseLevel(iAvcDecoder, (void*)&buffer[index], &SPSSize, aLevel);
+    
+    if (error != KErrNone)
+        return error;
+
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------
+// CVedAVCEditImp::GetResolution   
+// Get input bitstream resolution from SPS
+// ---------------------------------------------------------
+//
+TInt CVedAVCEditImp::GetResolution(TDesC8& aBuf, TSize& aResolution)
+{
+
+    TUint8* buffer = (TUint8*)(aBuf.Ptr());
+
+    TInt index = 5;     // Skip version and length information                        
+    
+#ifdef _DEBUG
+    TInt numOfSPS = buffer[index] & 0x1f;
+    VPASSERT(numOfSPS == 1);
+#endif
+    
+    index++;
+    
+    TUint SPSSize = (buffer[index] << 8) + buffer[index + 1];
+    index += 2;
+    
+    TInt error = avcdParseResolution(iAvcDecoder, (void*)&buffer[index], &SPSSize, 
+                                     aResolution.iWidth, aResolution.iHeight);
+    
+    if (error != KErrNone)
+        return error;
+
+    return KErrNone;
+}
+
+
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+// ---------------------------------------------------------
+// AVCEditParser::SaveAVCDecoderConfigurationRecordL
+// Saves SPS/PPS Nal units from AVCDecoderConfigurationRecord
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVedAVCEditImp::SaveAVCDecoderConfigurationRecordL(TDes8& aBuf, TBool aFromEncoder)
+    {
+
+    TUint8* buffer = (TUint8*)(aBuf.Ptr());
+
+    TInt index = 5;     // Skip version and length information                        
+    
+    TInt numOfSPS = buffer[index] & 0x1f;
+    index++;
+    
+    // Loop all SPS units
+    for (TInt i = 0; i < numOfSPS; ++i)
+        {
+        TUint SPSSize = (buffer[index] << 8) + buffer[index + 1];
+        index += 2;
+        
+        // feed NAL for saving to ParseParameterSet()        
+        User::LeaveIfError( ParseParameterSet( (void*)&buffer[index], &SPSSize, aFromEncoder ) );
+        index += SPSSize;                        
+        
+        }
+        
+    TInt numOfPPS = buffer[index];
+    index++;
+    
+    // Loop all PPS units
+    for (TInt i = 0; i < numOfPPS; ++i)
+        {
+        TUint PPSSize = (buffer[index] << 8) + buffer[index + 1];
+        index += 2;
+        
+        // feed NAL for saving to ParseParameterSet()        
+        User::LeaveIfError( ParseParameterSet( (void*)&buffer[index], &PPSSize, aFromEncoder ) );
+        index += PPSSize;
+        
+        }
+  
+    }
+
+// ---------------------------------------------------------
+// CVedAVCEditImp::ConvertAVCHeader  
+// Convert AVC specific decoder config info to 
+// AVCDecoderConfigurationRecord -format
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//				
+void CVedAVCEditImp::ConvertAVCHeaderL( TDesC8& aSrcBuf, TDes8& aDstBuf )
+    {
+    
+	TUint8* inputPtr = (TUint8*)(aSrcBuf.Ptr());
+    TUint8* outputPtr = (TUint8*)(aDstBuf.Ptr());
+    TUint8* spsPtr;
+    TUint8* ppsPtr;
+    
+    TUint numSPS = 0;
+    TUint numPPS = 0;
+    
+    TUint totalSPSLength = 0;
+    TUint totalPPSLength = 0;
+    
+    TUint headerLength = aSrcBuf.Length();
+    TUint endIndex = headerLength;
+    
+   	TInt nalType = 0;
+   	TUint nalLength;
+   	TUint nalIndex;
+    TUint nalOffset;        
+
+   	// Allocate memory for the temporary buffers
+   	HBufC8* temp1 = (HBufC8*) HBufC8::NewLC(1000);
+   	HBufC8* temp2 = (HBufC8*) HBufC8::NewLC(5000);
+
+    spsPtr = const_cast<TUint8*>( temp1->Des().Ptr() );
+    ppsPtr = const_cast<TUint8*>( temp2->Des().Ptr() );
+
+    TUint numNalUnits = inputPtr[endIndex-4] + (inputPtr[endIndex-3]<<8) + (inputPtr[endIndex-2]<<16) + (inputPtr[endIndex-1]<<24);
+
+	// Move endIndex to point to the first NAL unit's offset information    
+    endIndex = headerLength - numNalUnits*8 - 4;
+    
+	nalIndex = 0;    
+	
+	TUint8* copyPtr = inputPtr;
+
+	while (nalIndex < numNalUnits)
+        {
+    	nalIndex++;
+    	
+    	TInt tmp1 = inputPtr[endIndex++];
+        TInt tmp2 = inputPtr[endIndex++]<<8;
+        TInt tmp3 = inputPtr[endIndex++]<<16;
+        TInt tmp4 = inputPtr[endIndex++]<<24;    	    	
+
+    	nalOffset = tmp1 + tmp2 + tmp3 + tmp4;
+    	
+    	tmp1 = inputPtr[endIndex++];
+        tmp2 = inputPtr[endIndex++]<<8;
+        tmp3 = inputPtr[endIndex++]<<16;
+        tmp4 = inputPtr[endIndex++]<<24;
+    	
+    	nalLength = tmp1 + tmp2 + tmp3 + tmp4;    	
+
+	   	nalType = inputPtr[nalOffset] & 0x1F;
+  			
+	   	if(nalType == 7)
+		    {
+	   		numSPS++;	   			   			   		
+
+		    // First store the SPS unit length with two bytes
+   			spsPtr[totalSPSLength] = (nalLength >> 8) & 0xFF;
+    		spsPtr[totalSPSLength+1] = nalLength & 0xFF;	    			    		    		    		
+			
+			// Copy the SPS unit to the buffer    
+			Mem::Copy(&spsPtr[totalSPSLength+2], copyPtr , nalLength);
+										
+			totalSPSLength += nalLength + 2;	// Two more for the size
+		    }
+  		else if(nalType == 8)
+   		    {
+			numPPS++;
+
+		    // First store the SPS unit length with two bytes
+   			ppsPtr[totalPPSLength] = (nalLength >> 8) & 0xFF;
+    		ppsPtr[totalPPSLength+1] = nalLength & 0xFF;
+	
+			// Copy the SPS unit to the buffer    
+			Mem::Copy(&ppsPtr[totalPPSLength+2], copyPtr , nalLength);
+	
+			totalPPSLength += nalLength + 2;	// Two more for the size
+	   	    }
+		else
+   		    {
+			// [KW]: Check later if this is an error!!!
+   		    }
+   		
+   		copyPtr += nalLength;
+        }
+    
+	// When the header has been parsed, form the AVCDecoderConfigurationRecord
+	outputPtr[0] = 0x01;	// configurationVersion 
+	outputPtr[1] = 0x42;	// Profile indicator
+	// Profile compatibility, i.e. all 4 constrain set flags + reserved 4 zero bits
+	outputPtr[2] = 0x80;	// Bitstream obeys all baseline constraints
+	if ( iOutputLevel == 101 )
+	{
+		// For level 1b, the 4th bit shall be == 1, otherwise it must be zero
+		outputPtr[2] |= 0x10;
+	} 
+	else
+	{
+	    outputPtr[2] &= 0xEF;   
+	}
+	
+	outputPtr[3] = (iOutputLevel == 101) ? 11 : iOutputLevel;  // level
+		
+	outputPtr[4] = 0x03;	// lengthSizeMinusOne		
+    outputPtr[4] |= 0x0FC; // 6 reserved bits (all 1)	
+		
+	outputPtr[5] = numSPS;		
+    outputPtr[5] |= 0xE0;  // 3 reserved bits (all 1)
+
+	TInt len = 6;
+	
+	// Copy the SPS unit(s) to the buffer    
+	Mem::Copy(&outputPtr[6], spsPtr , totalSPSLength);
+	
+	len += totalSPSLength;
+
+	outputPtr[6+totalSPSLength] = numPPS;
+	
+	len += 1;
+		
+	// Copy the PPS unit(s) to the buffer    
+	Mem::Copy(&outputPtr[6+totalSPSLength+1], ppsPtr , totalPPSLength);
+	
+	len += totalPPSLength;	
+	
+	aDstBuf.SetLength(len);
+	
+	CleanupStack::Pop(2);
+	
+	// Free the temporary buffers
+	delete temp1;
+	delete temp2;	
+}
+
+
+// ---------------------------------------------------------
+// CVedAVCEditImp::ParseOneNAL  
+// Saves one SPS/PPS NAL unit for later use
+// ---------------------------------------------------------
+//				
+TInt CVedAVCEditImp::ParseParameterSet(void *aNalUnitData, TUint* aNalUnitLength, TBool aFromEncoder)
+    {
+    	TInt retCode;
+    	
+		// Pass the information about the frame origin to the decoder 
+		FrameIsFromEncoder(iAvcDecoder, aFromEncoder);
+		// Just call the decoder's parser function
+		retCode = avcdParseParameterSet(iAvcDecoder, aNalUnitData, aNalUnitLength);
+		
+		return retCode;
+    }
+
+TInt CVedAVCEditImp::ParseOneNAL(void *aNalUnitData, TUint* aNalUnitLength, TBool aFromEncoder)
+    {
+    	TInt retCode;
+    	
+		// Pass the information about the frame origin to the decoder 
+		FrameIsFromEncoder(iAvcDecoder, aFromEncoder);
+		// Just call the decoder's parser function
+		retCode = avcdParseOneNal(iAvcDecoder, aNalUnitData, aNalUnitLength);
+		
+		return retCode;
+    }
+
+// ---------------------------------------------------------
+// CVedAVCEditImp::ParseFrame  
+// Update slice header information
+// ---------------------------------------------------------
+//				
+TInt CVedAVCEditImp::ParseFrame(HBufC8*& aBuf, TBool aContainsDCR, TBool aFromEncoder)
+{
+    TUint nalSize;
+    TUint nalOrigSize = 0;
+	TUint nalLengthSize = 0;
+//	TInt nalType;
+//	TInt nalRefIdc;
+	TInt skip = 0;
+	TUint bufferLength = aBuf->Length();
+    TPtr8 bufferPtr(aBuf->Des());    
+	TUint8* srcPtr = (TUint8*)(bufferPtr.Ptr());
+	
+	TInt error;
+	HBufC8* temp1 = 0;
+  	TRAP( error, temp1 = (HBufC8*) HBufC8::NewL(10) );
+  	
+  	if (error != KErrNone)
+  	    return error;
+  	  	  	
+  	TPtr8 tempPtr(temp1->Des());
+//	TUint tmpLength1;
+//	TUint tmpLength2;
+    TUint8* tempData1;	
+
+  	tempPtr.Append(5);
+
+	// Jump over the AVC decoder information if it's included
+    if(aContainsDCR)
+    {
+		// skip 4 bytes for 
+		// configVersion, profile, profile compatibility and Level
+		skip += 4;
+	
+		// skip 1 byte for lengthSizeMinusOne
+		skip += 1;
+	
+		// skip 1 byte for number of sequence parameter sets
+		TInt numOfSSP = 0x1F & srcPtr[skip];
+		skip += 1;
+	
+		for (TInt i = 0; i < numOfSSP; i++)
+	    {
+	      	TInt sspSize = srcPtr[skip]*256 + srcPtr[skip+1];
+   			skip += 2;
+	        skip += sspSize;
+	    }
+
+		TInt numOfPSP = srcPtr[skip];
+		skip += 1;
+
+		for (TInt i = 0; i < numOfPSP; i++)
+	    {
+   			TInt pspSize = srcPtr[skip]*256 + srcPtr[skip+1];
+	       	skip += 2;
+       		skip += pspSize;
+	    }
+    }
+
+ 	while (skip < bufferLength)
+ 	{
+ 	   
+ 	    TInt retVal = 0; 			    
+
+		nalLengthSize = iNalLengthSize;
+		switch (nalLengthSize)
+		{
+			case 1:
+				nalOrigSize = nalSize = srcPtr[skip];
+				skip += 1;
+				break;
+			case 2:
+				nalOrigSize = nalSize = (srcPtr[skip] << 8)  + srcPtr[skip+1];
+				skip += 2;
+				break;
+			case 4:
+				nalOrigSize = nalSize = (srcPtr[skip] << 24) + (srcPtr[skip+1] << 16) + 
+                          (srcPtr[skip+2] << 8) + srcPtr[skip+3];  
+				
+				skip += 4;
+				break;
+		}
+		
+//	   	nalType   = srcPtr[skip] & 0x1F;
+//		nalRefIdc = srcPtr[skip] & 0x60;	
+
+		// [KW]: Alloc memory here instead of sequence.cpp
+	  	tempData1 = (TUint8*) User::Alloc(nalOrigSize+100);   
+
+		if (tempData1 == 0)
+		{
+		    User::Free(temp1);
+			return KErrNoMemory;
+		}
+
+		Mem::Copy(tempData1, &srcPtr[skip], nalOrigSize*sizeof(TUint8));
+
+		Mem::FillZ(&tempData1[nalOrigSize], 100*sizeof(TUint8));
+
+		// Call ParseOneNaL function
+		retVal = ParseOneNAL(tempData1, &nalSize, aFromEncoder);
+		
+		if (retVal != KErrNone)
+		{
+            User::Free(tempData1);
+        	User::Free(temp1);
+		    return retVal;   
+		}
+		
+		// Copy data back to the srcPtr
+		Mem::Copy(&srcPtr[skip],tempData1,nalOrigSize*sizeof(TUint8));
+		
+//		tmpLength1 = aBuf->Length();
+		if(nalSize > nalOrigSize)
+		{
+			TUint diff = nalSize - nalOrigSize;
+		
+			for (TInt i=0; i<diff; i++)
+			{
+				tempPtr.Delete(0,1);
+				tempPtr.Append(tempData1[nalOrigSize+i]);
+//				tmpLength2 = tempPtr.Length();
+
+				// Insert byte(s) into the buffer
+    			if((bufferPtr.Length() + 1) > bufferPtr.MaxLength()) 
+    			{
+        			// extend buffer size
+		        	TUint newSize = bufferPtr.Length() + 1;
+		        	
+        			// round up to the next full kilobyte       
+        			newSize = (newSize + 1023) & (~1023);
+        			TRAP(error, (aBuf = aBuf->ReAllocL(newSize)) );
+        
+        			if (error != KErrNone)
+        			{
+        				User::Free(tempData1);
+        				User::Free(temp1);
+            			return error;
+        			}
+        
+        			bufferPtr.Set(aBuf->Des());
+    			}        
+    			
+				bufferPtr.Insert(skip+nalOrigSize+i,tempPtr);
+//				tmpLength1 = aBuf->Length();
+			}
+			bufferLength += diff;
+		}
+		else if(nalSize < nalOrigSize)
+		{
+			TUint diff = nalOrigSize - nalSize;
+		
+			// Delete diff bytes from the buffer
+			bufferPtr.Delete(skip+nalOrigSize-diff,diff);
+			
+			bufferLength -= diff;
+		}
+		
+		// Update the NAL unit's size information in the buffer
+        srcPtr[skip-4] = TUint8((nalSize >> 24) & 0xff);
+        srcPtr[skip-3] = TUint8((nalSize >> 16) & 0xff);
+        srcPtr[skip-2] = TUint8((nalSize >> 8) & 0xff);
+        srcPtr[skip-1] = TUint8(nalSize & 0xff);
+
+		// Free the temporary data        
+        User::Free(tempData1);
+		
+		skip += nalSize;
+    }
+    
+    User::Free(temp1);
+    
+    return KErrNone;
+}
+
+// ---------------------------------------------------------
+// CVedAVCEditImp::ConstructAVCDecoderConfigurationRecordL   
+// Constructs AVCDecoderConfigurationRecord for output
+// ---------------------------------------------------------
+//				
+void CVedAVCEditImp::ConstructAVCDecoderConfigurationRecordL( TDes8& aDstBuf )
+    {
+    
+    TUint8* outputPtr = (TUint8*)(aDstBuf.Ptr());
+    TUint8* spsPtr;
+    TUint8* ppsPtr;
+    
+    TUint numSPS = 0;
+    TUint numPPS = 0;
+    
+    TUint totalSPSLength = 0;
+    TUint totalPPSLength = 0;
+    
+    TInt i;
+    TUint spsLength;
+    TUint ppsLength;
+	TInt len = 6;
+	TUint8* copyPtr;
+         
+
+   	// Allocate memory for the temporary buffers
+   	HBufC8* temp1 = (HBufC8*) HBufC8::NewLC(1000);
+   	HBufC8* temp2 = (HBufC8*) HBufC8::NewLC(5000);
+
+    spsPtr = const_cast<TUint8*>( temp1->Des().Ptr() );
+    ppsPtr = const_cast<TUint8*>( temp2->Des().Ptr() );        
+
+    numSPS = ReturnNumSPS(iAvcDecoder);
+    numPPS = ReturnNumPPS(iAvcDecoder);
+    
+    for (i=0; i<numSPS; i++)
+    {
+    	copyPtr = ReturnSPSSet(iAvcDecoder,i,&spsLength);
+
+	    // First store the SPS unit length with two bytes
+		spsPtr[totalSPSLength] = (spsLength >> 8) & 0xFF;
+  		spsPtr[totalSPSLength+1] = spsLength & 0xFF;
+
+		// Copy the SPS unit to the buffer    
+		Mem::Copy(&spsPtr[totalSPSLength+2], copyPtr , spsLength);
+		
+		totalSPSLength += spsLength + 2;	// Two more for the size
+    }
+    
+    
+    for (i=0; i<numPPS; i++)
+    {
+    	copyPtr = ReturnPPSSet(iAvcDecoder,i,&ppsLength);
+
+	    // First store the PPS unit length with two bytes
+		ppsPtr[totalPPSLength] = (ppsLength >> 8) & 0xFF;
+  		ppsPtr[totalPPSLength+1] = ppsLength & 0xFF;
+
+		// Copy the PPS unit to the buffer    
+		Mem::Copy(&ppsPtr[totalPPSLength+2], copyPtr , ppsLength);
+
+		totalPPSLength += ppsLength + 2;	// Two more for the size
+    }
+    
+    
+    
+	// When the header has been parsed, form the AVCDecoderConfigurationRecord
+	outputPtr[0] = 0x01;	
+	outputPtr[1] = 0x42;	// Profile indicator, baseline profile
+	
+	// Profile compatibility, i.e. all 4 constrain set flags + reserved 4 zero bits
+	outputPtr[2] = 0x80;	// Bitstream obeys all baseline constraints
+	if ( iOutputLevel == 101 )
+	{
+		// For level 1b, the 4th bit shall be == 1, otherwise it must be zero
+		outputPtr[2] |= 0x10;		
+	} 
+	else
+	{
+	    outputPtr[2] &= 0xEF;
+	}
+	
+	outputPtr[3] = (iOutputLevel == 101) ? 11 : iOutputLevel;  // level
+	outputPtr[4] = 0x03;	// lengthSizeMinusOne		
+	outputPtr[5] = numSPS;		
+
+	
+	// Copy the SPS unit(s) to the buffer    
+	Mem::Copy(&outputPtr[6], spsPtr , totalSPSLength);
+	
+	len += totalSPSLength;
+
+	outputPtr[6+totalSPSLength] = numPPS;
+	
+	len += 1;
+		
+	// Copy the PPS unit(s) to the buffer    
+	Mem::Copy(&outputPtr[6+totalSPSLength+1], ppsPtr , totalPPSLength);
+	
+	len += totalPPSLength;	
+	
+	aDstBuf.SetLength(len);
+	
+	CleanupStack::Pop(2);
+	// Free the temporary buffers
+	delete temp1;
+	delete temp2;	
+    }
+    
+
+// ---------------------------------------------------------
+// CVedAVCEditImp::EncodeUntilIDR   
+// Returns whether frames have to be encoded until next IDR frame
+// ---------------------------------------------------------
+//	
+TBool CVedAVCEditImp::EncodeUntilIDR()
+{
+    if (iAvcDecoder)
+    {
+		return (ReturnEncodeUntilIDR(iAvcDecoder));
+    }
+    else
+    {
+    	return EFalse;
+    }
+}
+
+
+// ---------------------------------------------------------
+// CVedAVCEditImp::IsNALUnitIDR   
+// Returns whether passed frame is an IDR frame
+// ---------------------------------------------------------
+//
+TBool CVedAVCEditImp::IsNALUnitIDR( TDes8& aNalBuf )
+{
+    TUint8* bufferPtr = (TUint8*)(aNalBuf.Ptr());
+	
+	// skip 4 bytes of length information
+	if((bufferPtr[4] & 0x1F) == 5)
+		return ETrue;
+	else
+		return EFalse;
+}
+
+// ---------------------------------------------------------
+// CVedAVCEditImp::StoreCurrentPPSId
+// Stores the PPS id of passed frame for later use
+// ---------------------------------------------------------
+//
+void CVedAVCEditImp::StoreCurrentPPSId( TDes8& aNalBuf )
+{
+    TUint8* bufferPtr = (TUint8*)(aNalBuf.Ptr());
+    TUint bufferLength = aNalBuf.Length();
+
+	switch (iNalLengthSize)
+	{
+		case 1:
+			bufferLength = bufferPtr[0];
+			bufferPtr += 1;
+			break;
+		case 2:
+			bufferLength = (bufferPtr[0] << 8)  + bufferPtr[1];
+			bufferPtr += 2;
+			break;
+		case 4:
+			bufferLength = (bufferPtr[0] << 24) + (bufferPtr[1] << 16) + 
+                         (bufferPtr[2] << 8) + bufferPtr[3];  
+			
+			bufferPtr += 4;
+			break;
+	}
+	avcdStoreCurrentPPSId(iAvcDecoder, bufferPtr, bufferLength);
+}
+
+// ---------------------------------------------------------
+// CVedAVCEditImp::GenerateNotCodedFrame
+// Generates a not coded (empty) frame
+// ---------------------------------------------------------
+//
+TInt CVedAVCEditImp::GenerateNotCodedFrame( TDes8& aNalBuf, TUint aFrameNumber )
+{
+    TUint8* bufferPtr = (TUint8*)(aNalBuf.Ptr());
+    TUint bufferLength = aNalBuf.Length();
+    TInt frameLength = 0;
+	
+  	frameLength = avcdGenerateNotCodedFrame(iAvcDecoder, bufferPtr, bufferLength, aFrameNumber);
+	
+	if(frameLength > 0)	
+	{
+    	TInt i;
+    
+  		// Make room for iNalLengthSize bytes of length information to the start
+  		for (i=frameLength-1; i>=0; i--)
+  		{
+  			bufferPtr[i+iNalLengthSize] = bufferPtr[i];
+  		}
+
+		// Add the NAL size information to the buffer
+		switch (iNalLengthSize)
+		{
+			case 1:
+    			bufferPtr[0] = TUint8(frameLength & 0xff);
+    			frameLength++;
+				break;
+			case 2:
+		    	bufferPtr[0] = TUint8((frameLength >> 8) & 0xff);
+    			bufferPtr[1] = TUint8(frameLength & 0xff);
+    			frameLength += 2;
+				break;
+			case 4:
+		    	bufferPtr[0] = TUint8((frameLength >> 24) & 0xff);
+    			bufferPtr[1] = TUint8((frameLength >> 16) & 0xff);
+    			bufferPtr[2] = TUint8((frameLength >> 8) & 0xff);
+    			bufferPtr[3] = TUint8(frameLength & 0xff);
+    			frameLength += 4;
+				break;
+		}
+		
+	  	return frameLength;
+	}
+	else
+		return 0;
+}
+
+// ---------------------------------------------------------
+// CVedAVCEditImp::ModifyFrameNumber
+// Modifies the frame number of input NAL unit
+// ---------------------------------------------------------
+//
+void CVedAVCEditImp::ModifyFrameNumber( TDes8& aNalBuf, TUint aFrameNumber )
+{
+    TUint8* bufferPtr = (TUint8*)(aNalBuf.Ptr());
+    TUint bufferLength = aNalBuf.Length();
+
+	switch (iNalLengthSize)
+	{
+		case 1:
+			bufferLength = bufferPtr[0];
+			bufferPtr += 1;
+			break;
+		case 2:
+			bufferLength = (bufferPtr[0] << 8)  + bufferPtr[1];
+			bufferPtr += 2;
+			break;
+		case 4:
+			bufferLength = (bufferPtr[0] << 24) + (bufferPtr[1] << 16) + 
+                         (bufferPtr[2] << 8) + bufferPtr[3];  
+			
+			bufferPtr += 4;
+			break;
+	}
+	
+	if (bufferPtr[0]==0x01 && bufferPtr[1]==0x42)
+		return;
+	
+	avcdModifyFrameNumber(iAvcDecoder, bufferPtr, bufferLength, aFrameNumber);
+}
+
+#endif
+
+// End of file   
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/avcedit/src/vld.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1796 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+//#include "epoclib.h"
+#include "globals.h"
+#include "bitbuffer.h"
+#include "vld.h"
+
+
+#define VLD_MAX_CW_LEN              33
+#define VLD_MAX_LONG_CW_LEN         65
+
+#define VLD_MAX_UVLC_CODE_NUM       65535         /* 2^16-1 */
+#define VLD_MAX_LONG_UVLC_CODE_NUM  4294967295U    /* 2^32-1 */
+
+#define VLD_NUM_MB_CODES_INTRA      (1+4*3*2+1)   /* 1 4x4, 24 16x16, 1 PCM */
+#define VLD_NUM_MB_CODES_INTER      (5+1+4*3*2+1) /* 5 inter, 1 4x4, 24 16x16, 1 PCM */
+
+#define VLD_MAX_SUB_MB_MODE         3
+
+#define VLD_MAX_IPR_CHROMA_MODE     3
+
+#define VLD_MAX_CBP_CODE            47
+#define VLD_MAX_DELTA_QP_CODE       52
+
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+/*
+ * Static tables for VLD decoder
+ */
+
+
+/* gives CBP value from codeword number, both for intra and inter */
+static const int8 code2cbp[VLD_MAX_CBP_CODE+1][2] = {  
+  {47, 0},{31,16},{15, 1},{ 0, 2},{23, 4},{27, 8},{29,32},{30, 3},{ 7, 5},{11,10},{13,12},{14,15}, 
+  {39,47},{43, 7},{45,11},{46,13},{16,14},{ 3, 6},{ 5, 9},{10,31},{12,35},{19,37},{21,42},{26,44},
+  {28,33},{35,34},{37,36},{42,40},{44,39},{ 1,43},{ 2,45},{ 4,46},{ 8,17},{17,18},{18,20},{20,24},
+  {24,19},{ 6,21},{ 9,26},{22,28},{25,23},{32,27},{33,29},{34,30},{36,22},{40,25},{38,38},{41,41}    
+};
+
+static const int numRefIndices[5] = {
+  0, 1, 2, 2, 4
+};
+
+/* Look-up table for determining the number of leading zero bits in a 7-bit bumber */
+static const int8 numLeadZerosTab[128] = {
+  7,6,5,5,4,4,4,4,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
+
+
+/*
+ * Structure of the code is XXYYYYZZ, where XX is the length of the code
+ * minus (number of leading zero bits plus 1), YYYY is totalCoef-1 and
+ * ZZ is numTrailingOnes. Code xx000010 means that there are no coefficients.
+ * 0 is illegal.
+ */
+static const u_int8 numCoefTrailTab[3][16][8] = {
+  {
+    {  2,  2,  2,  2,  2,  2,  2,  2}, {  1,  1,  1,  1,  1,  1,  1,  1},
+    {  6,  6,  6,  6,  6,  6,  6,  6}, {133,133,128,128, 75, 75, 75, 75},
+    {147,147,138,138, 79, 79, 79, 79}, {151,151,142,142,137,137,132,132},
+    {155,155,146,146,141,141,136,136}, {159,159,150,150,145,145,140,140},
+    {163,163,154,154,149,149,144,144}, {220,226,221,216,231,222,217,212},
+    {239,234,229,228,235,230,225,224}, {247,242,237,236,243,238,233,232},
+    {255,250,249,244,251,246,245,240}, {188,188,190,190,189,189,184,184},
+    { 49, 49, 49, 49, 49, 49, 49, 49}, {  0,  0,  0,  0,  0,  0,  0,  0}
+  },
+  {
+    { 65, 65, 65, 65, 66, 66, 66, 66}, {143,143,139,139, 70, 70, 70, 70},
+    {215,202,201,192,147,147,133,133}, {155,155,142,142,141,141,132,132},
+    {159,159,146,146,145,145,136,136}, {144,144,150,150,149,149,140,140},
+    {163,163,154,154,153,153,148,148}, {235,226,225,220,231,222,221,216},
+    {232,234,233,228,239,230,229,224}, {247,242,241,240,243,238,237,236},
+    {249,248,250,245,182,182,180,180}, {191,191,190,190,189,189,188,188},
+    { 59, 59, 59, 59, 59, 59, 59, 59}, {  0,  0,  0,  0,  0,  0,  0,  0},
+    {  0,  0,  0,  0,  0,  0,  0,  0}, {  0,  0,  0,  0,  0,  0,  0,  0}
+  },
+  {
+    {219,215,211,207,203,198,193,194}, {209,210,205,206,201,223,202,197},
+    {200,218,217,196,227,214,213,192}, {216,212,226,208,231,222,221,204},
+    {239,234,229,224,235,230,225,220}, {236,242,237,232,243,238,233,228},
+    {249,244,247,246,245,240,177,177}, {189,189,184,184,187,187,186,186},
+    {127,127,127,127,126,126,126,126}, { 60, 60, 60, 60, 60, 60, 60, 60},
+    {  0,  0,  0,  0,  0,  0,  0,  0}, {  0,  0,  0,  0,  0,  0,  0,  0},
+    {  0,  0,  0,  0,  0,  0,  0,  0}, {  0,  0,  0,  0,  0,  0,  0,  0},
+    {  0,  0,  0,  0,  0,  0,  0,  0}, {  0,  0,  0,  0,  0,  0,  0,  0}
+  }
+};
+
+
+/*
+ * The structure of the code is XXXYYYXX where XXX is the length of the code
+ * minus 1, YYY is total number of non-zero coefficients and XX is
+ * the number of trailing ones.
+ */
+static const u_int8 numCoefTrailTabChroma[8][4] = {
+  {  5,  5,  5,  5},
+  { 32, 32, 32, 32},
+  { 74, 74, 74, 74},
+  {168,175,169,164},
+  {176,176,172,172},
+  {206,206,205,205},
+  {242,242,241,241},
+  {211,211,211,211}
+};
+
+
+/* Offsets for 15 Huffman tables in totalZerosTab */
+static const int totalZerosTabOffset[15] = {
+  0, 40, 72, 104, 136, 168,
+  184, 200, 216, 232, 248, 264, 280,
+  288, 296
+};
+
+/*
+ * The meaning of the code in the table is the following:
+ *  If (code > 0xc0) then (code - 0xc0) is an offset to the next position 
+ *  in the Huffman tree
+ *  Otherwise, code structure is XXXXYYYY where XXXX is the length of the code
+ *  and YYYY is the number of zero coefficients.
+ */
+static const u_int8 totalZerosTab[304] = {
+  0xC8, 0xD0, 0x32, 0x31, 0x10, 0x10, 0x10, 0x10,  /* totalCoef==1 */
+  0xD8, 0xE0, 0x68, 0x67, 0x56, 0x56, 0x55, 0x55,  /* prefix 000 */
+  0x44, 0x44, 0x44, 0x44, 0x43, 0x43, 0x43, 0x43,  /* prefix 001 */
+  0x00, 0x9f, 0x9e, 0x9d, 0x8c, 0x8c, 0x8b, 0x8b,  /* prefix 000000 */
+  0x7a, 0x7a, 0x7a, 0x7a, 0x79, 0x79, 0x79, 0x79,  /* prefix 000001 */
+  0xC8, 0xD0, 0xD8, 0x34, 0x33, 0x32, 0x31, 0x30,  /* totalCoef==2 */
+  0x6e, 0x6d, 0x6c, 0x6b, 0x5a, 0x5a, 0x59, 0x59,  /* prefix 000 */
+  0x48, 0x48, 0x48, 0x48, 0x47, 0x47, 0x47, 0x47,  /* prefix 001 */
+  0x46, 0x46, 0x46, 0x46, 0x45, 0x45, 0x45, 0x45,  /* prefix 010 */
+  0xC8, 0xD0, 0xD8, 0x37, 0x36, 0x33, 0x32, 0x31,  /* totalCoef==3 */
+  0x6d, 0x6b, 0x5c, 0x5c, 0x5a, 0x5a, 0x59, 0x59,  /* prefix 000 */
+  0x48, 0x48, 0x48, 0x48, 0x45, 0x45, 0x45, 0x45,  /* prefix 001 */
+  0x44, 0x44, 0x44, 0x44, 0x40, 0x40, 0x40, 0x40,  /* prefix 010 */
+  0xC8, 0xD0, 0xD8, 0x38, 0x36, 0x35, 0x34, 0x31,  /* totalCoef==4 */
+  0x5c, 0x5c, 0x5b, 0x5b, 0x5a, 0x5a, 0x50, 0x50,  /* prefix 000 */
+  0x49, 0x49, 0x49, 0x49, 0x47, 0x47, 0x47, 0x47,  /* prefix 001 */
+  0x43, 0x43, 0x43, 0x43, 0x42, 0x42, 0x42, 0x42,  /* prefix 010 */
+  0xC8, 0xD0, 0xD8, 0x37, 0x36, 0x35, 0x34, 0x33,  /* totalCoef==5 */
+  0x5b, 0x5b, 0x59, 0x59, 0x4a, 0x4a, 0x4a, 0x4a,  /* prefix 000 */
+  0x48, 0x48, 0x48, 0x48, 0x42, 0x42, 0x42, 0x42,  /* prefix 001 */
+  0x41, 0x41, 0x41, 0x41, 0x40, 0x40, 0x40, 0x40,  /* prefix 010 */
+  0xC8, 0x39, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32,  /* totalCoef==6 */
+  0x6a, 0x60, 0x51, 0x51, 0x48, 0x48, 0x48, 0x48,  /* prefix 000 */
+  0xC8, 0x38, 0x36, 0x34, 0x33, 0x32, 0x25, 0x25,  /* totalCoef==7 */
+  0x69, 0x60, 0x51, 0x51, 0x47, 0x47, 0x47, 0x47,  /* prefix 000 */
+  0xC8, 0x37, 0x36, 0x33, 0x25, 0x25, 0x24, 0x24,  /* totalCoef==8 */
+  0x68, 0x60, 0x52, 0x52, 0x41, 0x41, 0x41, 0x41,  /* prefix 000 */
+  0xC8, 0x35, 0x26, 0x26, 0x24, 0x24, 0x23, 0x23,  /* totalCoef==9 */
+  0x61, 0x60, 0x57, 0x57, 0x42, 0x42, 0x42, 0x42,  /* prefix 000 */
+  0xC8, 0x32, 0x25, 0x25, 0x24, 0x24, 0x23, 0x23,  /* totalCoef==10 */
+  0x51, 0x51, 0x50, 0x50, 0x46, 0x46, 0x46, 0x46,  /* prefix 000 */
+  0xC8, 0x32, 0x33, 0x35, 0x14, 0x14, 0x14, 0x14,  /* totalCoef==11 */
+  0x40, 0x40, 0x40, 0x40, 0x41, 0x41, 0x41, 0x41,  /* prefix 000 */
+  0xC8, 0x34, 0x22, 0x22, 0x13, 0x13, 0x13, 0x13,  /* totalCoef==12 */
+  0x40, 0x40, 0x40, 0x40, 0x41, 0x41, 0x41, 0x41,  /* prefix 000 */
+  0x30, 0x31, 0x23, 0x23, 0x12, 0x12, 0x12, 0x12,  /* totalCoef==13 */
+  0x20, 0x20, 0x21, 0x21, 0x12, 0x12, 0x12, 0x12,  /* totalCoef==14 */
+  0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11,  /* totalCoef==15 */
+};
+
+
+/*
+ * The structure of the code is XXXXYYYY where XXXX is the length of the code
+ * and YYYY is the number of zero coefficients.
+ */
+static const u_int8 totalZerosTabChroma[3][8] = {
+  {0x33, 0x32, 0x21, 0x21, 0x10, 0x10, 0x10, 0x10},
+  {0x22, 0x22, 0x21, 0x21, 0x10, 0x10, 0x10, 0x10},
+  {0x11, 0x11, 0x11, 0x11, 0x10, 0x10, 0x10, 0x10}
+};
+
+
+/*
+ * The structure of the code is XXXXYYYY where XXXX is the length of the code
+ * and YYYY is run length.
+ */
+static const u_int8 runBeforeTab[7][8] = {
+  {0x11, 0x11, 0x11, 0x11, 0x10, 0x10, 0x10, 0x10},
+  {0x22, 0x22, 0x21, 0x21, 0x10, 0x10, 0x10, 0x10},
+  {0x23, 0x23, 0x22, 0x22, 0x21, 0x21, 0x20, 0x20},
+  {0x34, 0x33, 0x22, 0x22, 0x21, 0x21, 0x20, 0x20},
+  {0x35, 0x34, 0x33, 0x32, 0x21, 0x21, 0x20, 0x20},
+  {0x31, 0x32, 0x34, 0x33, 0x36, 0x35, 0x20, 0x20},
+  {0x00, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30},
+};
+
+
+
+/*
+ * Static function prototypes
+ */
+
+static int getCoefLevelVLC0(bitbuffer_s *bitbuf);
+
+static int getCoefLevelVLCN(bitbuffer_s *bitbuf, int tabNum);
+
+static int get4x4coefs(bitbuffer_s *bitbuf, int coef[4][4],
+                       int blkIdxX, int blkIdxY, int8 *numCoefUpPred,
+                       int8 *numCoefLeftPred, int mbAvailbits, int dcSkip);
+
+static int get2x2coefsCDC(bitbuffer_s *bitbuf, int coef[4], int *numCoef);
+
+#endif  // VIDEOEDITORENGINE_AVC_EDITING
+
+/*
+ * Functions begin here
+ */
+
+/*
+ *
+ * vldGetFLC:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      len                   Length of the code
+ *
+ * Function:
+ *      Get Fixed Length Code (max length 16 bits).
+ *
+ * Returns:
+ *      Code
+ *
+ */
+unsigned int vldGetFLC(bitbuffer_s *bitbuf, int len)
+{
+  u_int32 code;
+
+  bibGetMax16bits(bitbuf, len, &code);
+
+  return (unsigned int)code;
+}
+
+/*
+ *
+ * vldGetUVLC:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Decode an UVLC codeword, UVLC codeword is of the form:
+ *      code          codeword
+ *      0                1
+ *      1               010
+ *      2               011
+ *      3              00100
+ *      4              00101
+ *      5              00110
+ *      6              00111
+ *      7             0001000
+ *      8             0001001
+ *      ...             ...
+ *
+ * Returns:
+ *      Codenumber in the range [0, 65535]
+ *
+ */
+#if 1
+unsigned int vldGetUVLC(bitbuffer_s *bitbuf)
+{
+  u_int32 c;
+  int prefixLen;
+  int bit;
+
+  bibGetBit(bitbuf, &bit);
+
+  if (bit == 1)
+    return 0;
+
+  prefixLen = 0;
+
+  do {
+    bibGetBit(bitbuf, &bit);
+    prefixLen += 1;
+
+    /* Maximum prefix length is VLD_MAX_CW_LEN/2 */
+    if (prefixLen == VLD_MAX_CW_LEN/2) {
+      bibGetMax16bits(bitbuf, VLD_MAX_CW_LEN/2, &c);
+      if (bit != 1 || c != 0) {
+        /* We encoutered overlong codeword or we encoutered too big code */
+        bibRaiseError(bitbuf, BIB_ERR_BIT_ERROR);
+        return 0;
+      }
+      else
+        return VLD_MAX_UVLC_CODE_NUM;  /* Otherwise, return maximum 16-bit code number */
+    }
+
+  } while (bit == 0);
+
+  bibGetMax16bits(bitbuf, prefixLen, &c);
+
+  return (unsigned int)(c + (1<<prefixLen)-1);
+}
+#else
+unsigned int vldGetUVLC(bitbuffer_s *bitbuf)
+{
+  int prefixLen, len;
+  u_int32 bits;
+
+  bibShowMax16bits(bitbuf, 16, &bits);
+
+  if (bits >= 0x0100) {
+    prefixLen = numLeadZerosTab[bits>>9];
+    len = 2*prefixLen+1;
+    bibSkipBits(bitbuf, len);
+    return (unsigned int)((bits >> (16-len)) - 1);
+  }
+  else {
+    if (bits >= 0x0001)
+      prefixLen = 8 + numLeadZerosTab[bits>>1];
+    else
+      prefixLen = 16;
+
+    bibSkipBits(bitbuf, prefixLen);
+    bibGetBits(bitbuf, prefixLen+1, &bits);
+    return (unsigned int)(bits - 1);
+  }
+}
+#endif
+
+/*
+ *
+ * vldGetSignedUVLClong:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Decode an UVLC codeword and produce signed 32-bit integer
+ *
+ * Returns:
+ *      Code in the range [-2^31, 2^31-1]
+ *
+ */
+int32 vldGetSignedUVLClong(bitbuffer_s *bitbuf)
+{
+  u_int32 codeNum;
+  int32 code;
+
+  codeNum = vldGetUVLClong(bitbuf);
+
+  /* Decode magnitude */
+  code = (int32)((codeNum >> 1) + (codeNum & 1));
+
+  /* Decode sign */
+  if ((codeNum & 1) == 0)
+    code = -code;
+
+  return code;
+}
+
+/*
+ *
+ * vldGetUVLClong:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      code                  Return pointer for code
+ *
+ * Function:
+ *      Decode long UVLC codeword.
+ *
+ * Returns:
+ *      Codenumber in the range [0, 2^32-1]
+ *
+ */
+u_int32 vldGetUVLClong(bitbuffer_s *bitbuf)
+{
+  u_int32 c, cLo;
+  int prefixLen, len0;
+  int bits;
+
+  prefixLen = -1;
+
+  do {
+    bibGetBit(bitbuf, &bits);
+    prefixLen += 1;
+
+    /* Is codeword too long? */
+    if (prefixLen > VLD_MAX_LONG_CW_LEN/2) {
+      bibRaiseError(bitbuf, BIB_ERR_BIT_ERROR);
+      return 0;
+    }
+
+  } while (bits == 0);
+
+  len0 = min(24, prefixLen);
+  bibGetBits(bitbuf, len0, &c);
+
+  if (prefixLen > 24) {
+    /* We have to read bits in two pieces because bibGetBits can only fetch */
+    /* max. 24 bits */
+    bibGetMax16bits(bitbuf, prefixLen-24, &cLo);
+    c = (c << (prefixLen-24)) | cLo;  /* Combine two pieces */
+
+    if (prefixLen == VLD_MAX_LONG_CW_LEN/2) {
+      /* Is codeword too big? */
+      if (c != 0) {
+        bibRaiseError(bitbuf, BIB_ERR_BIT_ERROR);
+        return 0;
+      }
+      else
+        return (u_int32)VLD_MAX_LONG_UVLC_CODE_NUM;  /* Otherwise, return maximum 32-bit code number */
+    }
+  }
+
+  return (c + (1<<prefixLen)-1);
+}
+    
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+
+/*
+ *
+ * vldGetSignedUVLC:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Decode an UVLC codeword and produce signed integer.
+ *
+ * Returns:
+ *      Code is in the range [-32768,32767].
+ *
+ */
+int vldGetSignedUVLC(bitbuffer_s *bitbuf)
+{
+  unsigned int codeNum;
+  int code;
+
+  codeNum = vldGetUVLC(bitbuf);
+
+  /* Decode magnitude */
+  code = (int)(((int32)codeNum+1)>>1);
+
+  /* Decode sign */
+  if ((codeNum & 1) == 0)
+    code = -code;
+
+  return code;
+}
+
+/*
+ *
+ * setChromaCbp:
+ *
+ * Parameters:
+ *      nc                    If 0, all CBP are zero
+ *      cbpDC                 Coded Bit Pattern for chroma DC
+ *      cbp                   Coded Bit Pattern for chroma AC
+ *
+ * Function:
+ *      Set chroma DC and AC CBP values
+ *      nc = 0:   No coefficients
+ *      nc = 1:   Only nonzero DC coefficients
+ *      nc = 2:   Nonzero AC and DC coefficients
+ *
+ * Returns:
+ *      -
+ */
+void setChromaCbp(int nc, int *cbpDC, int *cbp)
+{
+  if (nc == 0)
+    *cbpDC = *cbp = 0;
+  else if (nc == 1)
+    *cbpDC = 3, *cbp = 0;
+  else
+    *cbpDC = 3, *cbp = (1<<2*BLK_PER_MB/2*BLK_PER_MB/2)-1;
+}
+
+
+/*
+ *
+ * getLumaBlkCbp:
+ *
+ * Parameters:
+ *      cbpY                  CBP for 8x8 blocks
+ *
+ * Function:
+ *      Convert Codec Block Pattern of 8x8 blocks to Codec Block Pattern for
+ *      4x4 blocks. If 8x8 block has nonzero coefficients then all 4x4 blocks
+ *      within that 8x8 block are marked nonzero.
+ *
+ * Returns:
+ *      CBP for 4x4 blocks
+ *
+ */
+int getLumaBlkCbp(int cbpY)
+{
+  int cbp;
+
+  cbp  = (cbpY & (1<<0)) == 0 ? 0 : 0x0033;
+  cbp |= (cbpY & (1<<1)) == 0 ? 0 : 0x00cc;
+  cbp |= (cbpY & (1<<2)) == 0 ? 0 : 0x3300;
+  cbp |= (cbpY & (1<<3)) == 0 ? 0 : 0xcc00;
+
+  return cbp;
+}
+
+
+/*
+ *
+ * vldGetRunIndicator:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Get the amount of copy macroblocks.
+ *
+ * Returns:
+ *      The number of copy MBs
+ *
+ */
+unsigned int vldGetRunIndicator(bitbuffer_s *bitbuf)
+{
+  return vldGetUVLC(bitbuf);
+}
+
+
+/*
+ *
+ * vldGetMBtype:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      hdr                   Return pointer for MB params
+ *      picType               Type of current picture (intra/inter)
+ *
+ * Function:
+ *      Get macroblock type. If MB is 16x16 intra then form cbp. Subblock
+ *      mode are also fetched if main mode is 8x8 inter.
+ *
+ * Returns:
+ *      VLD_OK for no error and VLD_ERROR for error.
+ *
+ */
+int vldGetMBtype(bitbuffer_s *bitbuf, vldMBtype_s *hdr, int picType)
+{
+  unsigned int code;
+  int nc;
+  int i;
+
+  /* Get macroblock mode */
+  code = vldGetUVLC(bitbuf);
+
+  if (IS_SLICE_I(picType)) {
+    /* INTRA macroblock in INTRA slice */
+    if (code >= VLD_NUM_MB_CODES_INTRA)
+      return VLD_ERROR;
+
+    hdr->type = MBK_INTRA;
+  }
+  else {
+    if (code >= VLD_NUM_MB_CODES_INTER)
+      return VLD_ERROR;
+
+    if (code >= 5) {
+      /* INTRA macroblock in INTER slice */
+      hdr->type = MBK_INTRA;
+      code -= 5;
+    }
+    else {
+      /* INTER macroblock in INTER slice */
+      hdr->type = MBK_INTER;
+      hdr->interMode = code+1;
+
+      if (hdr->interMode >= 4) {
+
+        /*
+         * Get sub-macroblock mode modes
+         */
+
+        for (i = 0; i < 4; i++) {
+          code = vldGetUVLC(bitbuf);
+
+          if (code > VLD_MAX_SUB_MB_MODE)
+            return VLD_ERROR;
+
+          hdr->inter8x8modes[i] = code;
+        }
+
+      }
+
+      if (bibGetStatus(bitbuf) < 0)
+        return VLD_ERROR;
+
+      return VLD_OK;
+    }
+  }
+
+  if (bibGetStatus(bitbuf) < 0)
+    return VLD_ERROR;
+
+  /*
+   * This is INTRA macroblock, find out INTRA type
+   */
+
+  if (code == 0)
+    hdr->intraType = MBK_INTRA_TYPE1;
+  else if (code != VLD_NUM_MB_CODES_INTRA-1) {
+    /* 16x16 INTRA - compose cbp value */
+    hdr->intraType = MBK_INTRA_TYPE2;
+    code -= 1;
+    hdr->intraMode = code & 3;
+    code >>= 2;
+    if (code < 3) {
+      nc = code;
+      hdr->cbpY = 0;
+    }
+    else {
+      nc = code-3;
+      hdr->cbpY = 0xffff;
+    }
+    setChromaCbp(nc, &hdr->cbpChromaDC, &hdr->cbpC);
+  }
+  else {
+    hdr->intraType = MBK_INTRA_TYPE_PCM;
+    hdr->cbpY = 0xffff;
+    hdr->cbpC = 0xff;
+    hdr->cbpChromaDC = 0x3;
+  }
+
+
+  return VLD_OK;
+}
+
+
+/*
+ *
+ * vldGetIntraPred:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      ipTab                 Return pointer for intra pred. modes
+ *
+ * Function:
+ *      Get 4x4 intra prediction modes. First a one bit flag is read. If flag
+ *      is 1, mode is predicted from neighborin blocks. If flag is 0,
+ *      additional 3 bit mode code is read. Process is repeated for 16 blocks.
+ *
+ * Returns:
+ *      VLD_OK for no error and VLD_ERROR for error.
+ *
+ */
+int vldGetIntraPred(bitbuffer_s *bitbuf, int8 *ipTab)
+{
+  int i, j, k, l;
+  int bit;
+  int modeCode;
+
+  for (j = 0; j < BLK_PER_MB; j+=2) {
+    for (i = 0; i < BLK_PER_MB; i+=2) {
+      for (k = 0; k < 2; k++) {
+        for (l = 0; l < 2; l++) {
+          bibGetBit(bitbuf, &bit);    /* Read flag */
+          if (bit == 1)               /* If 1, predict from neighbors */
+            ipTab[(j+k)*4+i+l] = -1;
+          else {                      /* If 0, read mode code */
+            bibGetMax8bits(bitbuf, 3, &modeCode);
+            ipTab[(j+k)*4+i+l] = (int8)modeCode;
+          }
+        }
+      }
+    }
+  }
+
+  /* Check if error occured */
+  if (bibGetStatus(bitbuf) < 0)
+    return VLD_ERROR;
+  else
+    return VLD_OK;
+}
+
+
+/*
+ *
+ * vldGetChromaIntraPred:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Get chroma intra prediction mode.
+ *
+ * Returns:
+ *      Prediction mode.
+ *
+ */
+int vldGetChromaIntraPred(bitbuffer_s *bitbuf)
+{
+  unsigned int mode;
+
+  mode = vldGetUVLC(bitbuf);
+
+  if (bibGetStatus(bitbuf) < 0 || mode > VLD_MAX_IPR_CHROMA_MODE)
+    return VLD_ERROR;
+
+  return (int)mode;
+}
+
+
+/*
+ *
+ * vldGetMotVecs:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      interMode             Motion mode (16x16, 8x16, ...)
+ *      hasRef                Flag for multiple ref. frames
+ *      refNum                Return pointer for ref. indices
+ *      predVecs              Return pointer for delta vectors
+ *      numVecs               Number of vectors to read
+ *
+ * Function:
+ *      Get reference indices and delta motion vectors for MB
+ *
+ * Returns:
+ *      VLD_OK for no error and VLD_ERROR for error
+ *
+ */
+int vldGetMotVecs(bitbuffer_s *bitbuf, int interMode, int numRefFrames,
+                  int *refNum, int predVecs[][2], int numVecs)
+{
+  int i, j;
+  int code;
+  int refIdx;
+
+  if (numRefFrames > 1 && interMode < 5) {
+    if (numRefFrames == 2) {
+      for (i = 0; i < numRefIndices[interMode]; i++) {
+        bibGetBit(bitbuf, &refIdx);
+        refNum[i] = 1 - refIdx;
+      }
+    }
+    else {
+      for (i = 0; i < numRefIndices[interMode]; i++) {
+        if ((refNum[i] = (int)vldGetUVLC(bitbuf)) >= numRefFrames)
+          return VLD_ERROR;
+      }
+    }
+  }
+  else
+    refNum[0] = 0;
+
+  for(j = 0; j < numVecs; j++) {
+    for(i = 0; i < 2; i++) {
+      code = vldGetUVLC(bitbuf);
+      predVecs[j][i] = (code+1)>>1;
+      if ((code & 1) == 0)
+        predVecs[j][i] = -predVecs[j][i];
+    }
+  }
+
+  if (bibGetStatus(bitbuf) < 0)
+    return VLD_ERROR;
+  else
+    return VLD_OK;
+}
+
+
+/*
+ *
+ * vldGetCBP:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      mbType                Macroblock type (intra/inter)
+ *      cbpY                  Return pointer for luma CBP
+ *      cbpChromaDC           Return pointer for chroma DC CBP
+ *      cbpC                  Return pointer for chroma CBP
+ *
+ * Function:
+ *      Get Coded Block Patterns for both luma and chroma
+ *
+ * Returns:
+ *      VLD_OK for no error and VLD_ERROR for error
+ *
+ */
+int vldGetCBP(bitbuffer_s *bitbuf, int mbType,
+              int *cbpY, int *cbpChromaDC, int *cbpC)
+{
+  unsigned int code;
+  int cbp;
+
+  code = vldGetUVLC(bitbuf);
+
+  if (bibGetStatus(bitbuf) < 0 || code > VLD_MAX_CBP_CODE)
+    return VLD_ERROR;
+
+  if (mbType ==  MBK_INTRA)
+    cbp = code2cbp[code][0];
+  else
+    cbp = code2cbp[code][1];
+
+  *cbpY = getLumaBlkCbp(cbp%16);
+  setChromaCbp(cbp>>4, cbpChromaDC, cbpC);
+
+  return VLD_OK;
+}
+
+
+/*
+ *
+ * vldGetDeltaqp:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      delta_qp              Return pointer for delta QP
+ *
+ * Function:
+ *      Get macroblock delta QP
+ *
+ * Returns:
+ *      VLD_OK for no error and VLD_ERROR for error
+ *
+ */
+int vldGetDeltaqp(bitbuffer_s *bitbuf, int *delta_qp)
+{
+  unsigned int code;
+
+  code = vldGetUVLC(bitbuf);
+
+  if (bibGetStatus(bitbuf) < 0 || code > VLD_MAX_DELTA_QP_CODE)
+    return VLD_ERROR;
+
+  *delta_qp = (code+1)>>1;
+
+  if ((code & 1) == 0)
+    *delta_qp = -(*delta_qp);
+
+  return VLD_OK;
+}
+
+
+/*
+ *
+ * getCoefLevelVLC0:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *
+ * Function:
+ *      Get CAVLC coefficient level for VLC0 code format
+ *
+ * Returns:
+ *      Coefficient level
+ *
+ */
+static int getCoefLevelVLC0(bitbuffer_s *bitbuf)
+{
+  int numLeadingZeroBits;
+  u_int32 bits;
+  int len;
+  int coef;
+
+  bibShowMax16bits(bitbuf, 16, &bits);
+
+  if (bits > 0x0003) {
+    if (bits > 0x00ff)
+      numLeadingZeroBits = numLeadZerosTab[(int)(bits>>(16-7))];
+    else
+      numLeadingZeroBits = 7 + numLeadZerosTab[(int)(bits>>(16-7-7))];
+
+    coef = (numLeadingZeroBits >> 1) + 1;
+    if (numLeadingZeroBits & 1)
+      coef = -coef;
+
+    len = numLeadingZeroBits + 1;
+    bibSkipBits(bitbuf, len);
+  }
+  else if (bits > 0x0001) {
+    bibGetBits(bitbuf, 19, &bits);
+    coef = 8 + (((int)bits & 15) >> 1);
+    if (bits & 1)
+      coef = -coef;
+  }
+  else if (bits == 0x0001) {
+    bibSkipBits(bitbuf, 16);
+    bibGetMax16bits(bitbuf, 12, &bits);
+    coef = 16 + ((int)bits >> 1);
+    if (bits & 1)
+      coef = -coef;
+  }
+  else {
+    bibRaiseError(bitbuf, BIB_ERR_BIT_ERROR);
+    coef = 0;
+  }
+
+  return coef;
+}
+
+/*
+ *
+ * getCoefLevelVLCN:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      tabNum                VLC table number to be used
+ *
+ * Function:
+ *      Get CAVLC coefficient level for VLC1-6 code format
+ *
+ * Returns:
+ *      Coefficient level
+ *
+ */
+static int getCoefLevelVLCN(bitbuffer_s *bitbuf, int tabNum)
+{
+  int numLeadingZeroBits;
+  u_int32 bits;
+  int len;
+  int coef;
+
+  bibShowBits(bitbuf, 21, &bits);
+
+  if (bits > 0x00003f) {
+    if (bits > 0x001fff)
+      numLeadingZeroBits = numLeadZerosTab[(int)(bits>>(21-7))];
+    else
+      numLeadingZeroBits = 7 + numLeadZerosTab[(int)(bits>>(21-7-7))];
+
+    len = numLeadingZeroBits + 1 + tabNum;
+    bits = (bits >> (21 - len)) & ((1 << tabNum) - 1);
+    coef = (int)((numLeadingZeroBits << (tabNum - 1)) + (bits >> 1) +  1);
+    if (bits & 1)
+      coef = -coef;
+
+    bibSkipBits(bitbuf, len);
+  }
+  else if (bits > 0x00001f) {
+    bibSkipBits(bitbuf, 16);
+    bibGetMax16bits(bitbuf, 12, &bits);
+    coef = (15 << (tabNum - 1)) + ((int)bits >> 1) + 1;
+    if (bits & 1)
+      coef = -coef;
+  }
+  else {
+    bibRaiseError(bitbuf, BIB_ERR_BIT_ERROR);
+    coef = 0;
+  }
+
+  return coef;
+}
+
+
+/*
+ *
+ * get4x4coefs:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      coef                  Return pointer for 4x4 coefficients
+ *      blkIdxX               Horizontal block pos. within MB
+ *      blkIdxY               Vertical block pos. within MB
+ *      numCoefUpPred         Block coefficients counts of upper block
+ *      numCoefLeftPred       Block coefficients counts of left block
+ *      mbAvailBits           Macroblock availability flags
+ *      dcSkip                if 1, there's no DC coefficient
+ *
+ * Function:
+ *      Decode coefficients for 4x4 block.
+ *
+ * Returns:
+ *      VLD_OK for no error, VLD_ERROR for error
+ *
+ */
+static int get4x4coefs(bitbuffer_s *bitbuf, int coef[4][4],
+                       int blkIdxX, int blkIdxY, int8 *numCoefUpPred,
+                       int8 *numCoefLeftPred, int mbAvailBits, int dcSkip)
+{
+  int numCoefPred;
+  int tabNum;
+  u_int32 bits;
+  int code;
+  int numTrailingOnes;
+  int numLeadingZeroBits;
+  int totalCoef;
+  int numBits;
+  u_int32 flc;
+  int tmpLevel[16];
+  int level;
+  int numBigCoef;
+  u_int32 signs;
+  int s;
+  int i;
+  const u_int8 *totalZerosPtr;
+  int offset;
+  int totalZeros;
+  int zerosLeft;
+  int run;
+  int coefPos;
+  int coefNum;
+
+  static const int vlcNumTab[8] = {
+    0, 0, 1, 1, 2, 2, 2, 2
+  };
+
+  static const unsigned int incVlc[7] = {
+    0,3,6,12,24,48,32768          /* maximum vlc = 6 */
+  };
+
+  static const int zigZagPos[16] = {
+    0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
+  };
+
+  /*
+   * Decode number of coefficients and number of trailing ones
+   */
+
+  /* Predict number of coefficients from neighboring blocks */
+  if (blkIdxX || (mbAvailBits & 1)) {
+    numCoefPred = numCoefLeftPred[0];
+    if (blkIdxY || (mbAvailBits & 2))
+      numCoefPred = (numCoefPred + numCoefUpPred[0] + 1) >> 1;
+  }
+  else
+    numCoefPred = (blkIdxY || (mbAvailBits & 2)) ? numCoefUpPred[0] : 0;
+
+  /* Select variable length code or fixed length decoding */
+  if (numCoefPred < 8) {
+
+    /* Use variable length code  */
+
+    /* Select table number based on the prediction */
+    tabNum = vlcNumTab[numCoefPred];
+
+    bibShowBits(bitbuf, 18, &bits);
+
+    /* Compute number of leading zeros using look-up table */
+    if (bits >= 0x00400)
+      numLeadingZeroBits = numLeadZerosTab[(int)(bits>>(18-7))];
+    else
+      numLeadingZeroBits = 7 + numLeadZerosTab[(int)(bits>>(18-7-7))];
+
+    /* Shift excess bits away */
+    bits >>= 18-4-numLeadingZeroBits;
+
+    /* numTrailingOnes, totalCoef and length of the codeword are codec in one code */
+    code = numCoefTrailTab[tabNum][numLeadingZeroBits][(int)bits&7];
+
+    /* Total number of bits in codeword is sum of the number of leading zero bits,     */
+    /* 1 one bit and the number of bits in postfix. We know the number of leading zero */
+    /* bits. Postfix length is extracted from 2 highest bits of code.                  */
+    numBits = numLeadingZeroBits + 1 + (code >> 6);
+
+    bibSkipBits(bitbuf, numBits);
+
+    if ((code & 0x3f) == 2) {
+      /* All coefficients are zero */
+      numCoefUpPred[0] = numCoefLeftPred[0] = 0;
+      return VLD_OK;
+    }
+    else {
+      /* 2 lowest bits contains number of trailing ones */
+      numTrailingOnes = code & 3;
+      /* 4 middle bits contain total number of coefficients minus 1 */
+      totalCoef = ((code >> 2) & 15) + 1;
+    }
+  }
+  else {
+
+    /* Use fixed length code  */
+
+    bibGetMax8bits(bitbuf, 6, &flc);
+
+    if (flc != 3) {
+      /* 2 lowest bits contains number of trailing ones */
+      numTrailingOnes = (int)flc & 0x03;
+      /* high bits contain total number of coefficients minus 1 */
+      totalCoef = ((int)flc >> 2) + 1;
+      if (totalCoef < numTrailingOnes)
+        return VLD_ERROR;
+    }
+    else {
+      /* All coefficients are zero */
+      numCoefUpPred[0] = numCoefLeftPred[0] = 0;
+      return VLD_OK;
+    }
+  }
+
+  numCoefUpPred[0] = numCoefLeftPred[0] = (int8) totalCoef;
+
+
+  /*
+   * Decode signs for trailing ones and store trailing ones in tmpLevel.
+   */
+
+  numBigCoef = totalCoef - numTrailingOnes; 
+
+  if (numTrailingOnes != 0) {
+
+    /* Get signs for trailing ones. There can be maximum of 3 of them */
+    bibGetMax8bits(bitbuf, numTrailingOnes, &signs);
+
+    for (i = numTrailingOnes-1; i >= 0; i--) {
+      s = ((int)signs >> i) & 1;
+      tmpLevel[numBigCoef+i] = 1 - 2*s;
+    }
+  }
+
+  if (numBigCoef != 0) {
+
+    /*
+     * Decode first "big" level
+     */
+
+    if (totalCoef > 10 && numTrailingOnes < 3)
+      level = getCoefLevelVLCN(bitbuf, 1);
+    else
+      level = getCoefLevelVLC0(bitbuf);
+
+    if (numTrailingOnes < 3)
+      level += (level > 0) ? 1 : -1;
+
+    tmpLevel[numBigCoef-1] = level;
+
+    tabNum = (Abs((int32)level) > 3) ? 2 : 1;
+
+    /*
+     * Decode rest of the "big" levels
+     */
+
+    for (i = numBigCoef - 2; i >= 0; i--) {
+
+      level = getCoefLevelVLCN(bitbuf, tabNum);
+
+      tmpLevel[i] = level;
+
+      /* update VLC table number */
+      if (Abs((int32)level) > (int32)incVlc[tabNum])
+        tabNum++;
+    }
+
+  }
+
+  /*
+   * Get total number of zero coefficients
+   */
+
+  if (totalCoef < 16-dcSkip) {
+
+    bibShowMax16bits(bitbuf, 9, &bits);
+
+    totalZerosPtr = &totalZerosTab[totalZerosTabOffset[totalCoef-1]];
+    code = totalZerosPtr[(int)bits>>6];
+
+    if (code > 0xc0) {
+      offset = code - 0xc0;
+      code = totalZerosPtr[offset+(((int)bits>>3)&7)];
+      if (code > 0xc0) {
+        offset = code - 0xc0;
+        code = totalZerosPtr[offset+((int)bits&7)];
+      }
+    }
+
+    totalZeros = code & 15;
+
+    numBits = code >> 4;
+    bibSkipBits(bitbuf, numBits);
+  }
+  else
+    totalZeros = 0;
+
+  if (dcSkip + totalCoef + totalZeros > 16)
+    return VLD_ERROR;
+
+  /* All coefficients are initially zero */
+  for (i = 0; i < 4; i++) {
+    coef[i][0] = 0;
+    coef[i][1] = 0;
+    coef[i][2] = 0;
+    coef[i][3] = 0;
+  }
+
+  /*
+   * Get run of zeros before each coefficient and store coeffs. in tmpCoef
+   */
+
+  zerosLeft = totalZeros;
+  coefPos = dcSkip + totalCoef + totalZeros - 1;
+  coefNum = totalCoef - 1;
+
+  while (zerosLeft > 0 && coefNum > 0) {
+
+    coef[0][zigZagPos[coefPos]] = tmpLevel[coefNum];
+
+    // select VLC for runbefore
+    tabNum = zerosLeft <= 7 ? zerosLeft-1 : 6;
+
+    bibShowMax8bits(bitbuf, 3, &bits);
+
+    if (tabNum == 6 && bits == 0) {
+      bibShowMax16bits(bitbuf, 11, &bits);
+      if (bits == 0)
+        return VLD_ERROR;
+      numLeadingZeroBits = numLeadZerosTab[(int)bits>>1];
+      run = 7 + numLeadingZeroBits;
+      if (run > zerosLeft)
+        return VLD_ERROR;
+      numBits = 4 + numLeadingZeroBits;
+    }
+    else {
+      code = runBeforeTab[tabNum][(int)bits];
+      run = code & 15;
+      numBits = code >> 4;
+    }
+
+    bibSkipBits(bitbuf, numBits);
+
+    zerosLeft -= run;
+    coefPos -= run + 1;
+    coefNum--;
+  }
+
+  do {
+    coef[0][zigZagPos[coefPos]] = tmpLevel[coefNum];
+    coefPos--;
+    coefNum--;
+  } while (coefNum >= 0);
+
+  return VLD_OK;
+}
+
+
+/*
+ *
+ * get2x2coefsCDC:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      coef                  Return pointer for 2x2 coefficients
+ *      numCoef               Return pointer number of nonzero cefficients
+ *
+ * Function:
+ *      Decode coefficients for 2x2 DC block.
+ *
+ * Returns:
+ *      VLD_OK for no error, VLD_ERROR for error
+ *
+ */
+static int get2x2coefsCDC(bitbuffer_s *bitbuf, int coef[4], int *numCoef)
+{
+  int tabNum;
+  u_int32 bits;
+  int code;
+  int numTrailingOnes;
+  int numLeadingZeroBits;
+  int totalCoef;
+  int numBits;
+  int tmpLevel[4];
+  int level;
+  int numBigCoef;
+  u_int32 signs;
+  int s;
+  int i;
+  int totalZeros;
+  int zerosLeft;
+  int run;
+  int coefPos;
+  int coefNum;
+
+  static const unsigned int incVlc[7] = {
+    0,3,6,12,24,48,32768          /* maximum vlc = 6 */
+  };
+
+
+  /*
+   * Decode number of coefficients and number of trailing ones
+   */
+
+  bibShowMax16bits(bitbuf, 10, &bits);
+
+  /* Compute number of leading zeros using look-up table */
+  numLeadingZeroBits = numLeadZerosTab[(int)bits>>(10-7)];
+
+  /* Shift excess bits away */
+  bits >>= 10-3-numLeadingZeroBits;
+
+  /* Fetch numTrailingOnes and totalCoef */
+  code = numCoefTrailTabChroma[numLeadingZeroBits][(int)bits&3];
+
+  numTrailingOnes = code & 3;
+  totalCoef = (code >> 2) & 7;
+
+  numBits = (code >> 5) + 1;
+
+  bibSkipBits(bitbuf, numBits);
+
+  *numCoef = totalCoef;
+
+  if (totalCoef == 0)
+    return VLD_OK;
+
+
+  /*
+   * Decode signs for trailing ones
+   */
+
+  numBigCoef = totalCoef - numTrailingOnes; 
+
+  if (numTrailingOnes != 0) {
+
+    /* Get signs for trailing ones. There can be maximum of 3 of them */
+    bibGetMax8bits(bitbuf, numTrailingOnes, &signs);
+
+    for (i = numTrailingOnes-1; i >= 0; i--) {
+      s = ((int)signs >> i) & 1;
+      tmpLevel[numBigCoef+i] = 1 - 2*s;
+    }
+  }
+
+  if (numBigCoef != 0) {
+
+    /*
+     * Decode first level
+     */
+
+    level = getCoefLevelVLC0(bitbuf);
+
+    if (numTrailingOnes < 3)
+      level += (level > 0) ? 1 : -1;
+
+    tmpLevel[numBigCoef-1] = level;
+
+    tabNum = (Abs((int32)level) > 3) ? 2 : 1;
+
+    /*
+     * Decode rest of the levels
+     */
+
+    for (i = numBigCoef - 2; i >= 0; i--) {
+
+      level = getCoefLevelVLCN(bitbuf, tabNum);
+
+      tmpLevel[i] = level;
+
+      /* update VLC table number */
+      if (Abs((int32)level) > (int32)incVlc[tabNum])
+        tabNum++;
+    }
+
+  }
+
+  /*
+   * Get total zeros
+   */
+
+  if (totalCoef < 4) {
+    bibShowMax8bits(bitbuf, 3, &bits);
+    code = totalZerosTabChroma[totalCoef-1][(int)bits];
+    totalZeros = code & 15;
+    numBits = code >> 4;
+    bibSkipBits(bitbuf, numBits);
+  }
+  else
+    totalZeros = 0;
+
+  /* All coefficients are initially zero */
+  coef[0] = 0;
+  coef[1] = 0;
+  coef[2] = 0;
+  coef[3] = 0;
+
+  /*
+   * Get run before each coefficient
+   */
+
+  zerosLeft = totalZeros;
+  coefPos = totalCoef + totalZeros - 1;
+  coefNum = totalCoef - 1;
+
+  while (zerosLeft > 0 && coefNum > 0) {
+
+    coef[coefPos] = tmpLevel[coefNum];
+
+    bibShowMax8bits(bitbuf, 3, &bits);
+
+    code = runBeforeTab[zerosLeft-1][(int)bits];
+    run = code & 15;
+    numBits = code >> 4;
+
+    bibSkipBits(bitbuf, numBits);
+
+    zerosLeft -= run;
+    coefPos -= run + 1;
+    coefNum--;
+  }
+
+  do {
+    coef[coefPos] = tmpLevel[coefNum];
+    coefPos--;
+    coefNum--;
+  } while (coefNum >= 0);
+
+
+  return VLD_OK;
+}
+
+
+/*
+ *
+ * vldGetLumaDCcoeffs:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      coef                  Return pointer for 4x4 coefficients
+ *      numCoefUpPred         Block coefficients counts of upper block
+ *      numCoefLeftPred       Block coefficient counts of blocks to the left
+ *      mbAvailBits           Macroblock availability flags
+ *
+ * Function:
+ *      Decode coefficients for 4x4 luma DC block.
+ *
+ * Returns:
+ *      VLD_OK for no error, negative value for error
+ *
+ */
+int vldGetLumaDCcoeffs(bitbuffer_s *bitbuf, int coef[4][4],
+                       int8 *numCoefUpPred, int8 *numCoefLeftPred,
+                       int mbAvailBits)
+{
+  int j;
+  int8 numCoef   = *numCoefUpPred;
+  int8 numCoefLP = *numCoefLeftPred;
+  int retCode;
+
+  retCode = get4x4coefs(bitbuf, coef, 0, 0, &numCoef, &numCoefLP, mbAvailBits, 0);
+
+  if (retCode < 0)
+    return retCode;
+
+  if (numCoef == 0) {
+    for (j = 0; j < 4; j++) {
+      coef[j][0] = 0;
+      coef[j][1] = 0;
+      coef[j][2] = 0;
+      coef[j][3] = 0;
+    }
+  }
+
+  if (bibGetStatus(bitbuf) < 0)
+    return VLD_ERROR;
+  else
+    return VLD_OK;
+}
+
+
+/*
+ *
+ * vldGetLumaCoeffs:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      mbType                Macroblock type (intra/inter)
+ *      intraType             Intra type (16x16 or 4x4 intra pred)
+ *      cbpY                  Return pointer coded block pattern
+ *      coef                  Return pointer for 16x4x4 coefficients
+ *      numCoefUpPred         Block coefficients counts of upper block
+ *      numCoefLeftPred       Block coefficient counts of blocks to the left
+ *      mbAvailBits           Macroblock availability flags
+ *
+ * Function:
+ *      Decode coefficients for 16 4x4 luma blocks.
+ *
+ * Returns:
+ *      VLD_OK for no error, negative value for error
+ *
+ */
+int vldGetLumaCoeffs(bitbuffer_s *bitbuf, int mbType, int intraType,
+                     int *cbpY, int coef[4][4][4][4], int8 *numCoefUpPred,
+                     int8 *numCoefLeftPred, int mbAvailBits)
+{
+  int bx, by;
+  int blkIdxX, blkIdxY;
+  int i, j;
+  int cbp, cbpTemp;
+  int dcSkip;
+  int retCode;
+
+  dcSkip = mbType == MBK_INTRA && intraType == MBK_INTRA_TYPE2 ? 1 : 0;
+
+  cbp = cbpTemp = *cbpY;
+
+  for (by = 0; by < 4; by+=2) {
+    for (bx = 0; bx < 4; bx+=2) {
+
+      /* Check if any of the blocks in the current 8x8 block is codec */
+      if ((cbpTemp & 33) != 0) {
+        for (j = 0; j < 2; j++) {
+          for (i = 0; i < 2; i++) {
+
+            blkIdxX = bx + i;
+            blkIdxY = by + j;
+
+            retCode = get4x4coefs(bitbuf, coef[blkIdxY][blkIdxX], blkIdxX, blkIdxY,
+                                  &numCoefUpPred[blkIdxX], &numCoefLeftPred[blkIdxY],
+                                  mbAvailBits, dcSkip);
+
+            if (retCode < 0)
+              return retCode;
+
+            if (numCoefUpPred[blkIdxX] == 0)
+              cbp &= ~(1<<(blkIdxY*BLK_PER_MB+blkIdxX));
+          }
+
+        }
+      }
+      else {
+        numCoefUpPred[bx]   = 0;
+        numCoefUpPred[bx+1] = 0;
+        numCoefLeftPred[by]   = 0;
+        numCoefLeftPred[by+1] = 0;
+      }
+
+      cbpTemp >>= 2;
+    }
+    cbpTemp >>= 4;
+  }
+
+  *cbpY = cbp;
+
+  if (bibGetStatus(bitbuf) < 0)
+    return VLD_ERROR;
+  else
+    return VLD_OK;
+}
+
+
+/*
+ *
+ * vldGetChromaDCcoeffs:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      coef                  Return pointer for 2x2x2 coefficients
+ *      cbpYDC                Return pointer chroma DC coded block pattern
+ *
+ * Function:
+ *      Decode coefficients for 2 2x2 chroma DC blocks.
+ *
+ * Returns:
+ *      VLD_OK for no error, negative value for error
+ *
+ */
+int vldGetChromaDCcoeffs(bitbuffer_s *bitbuf, int coef[2][2][2], int *cbpDC)
+{
+  int comp;
+  int numCoef;
+  int retCode;
+
+  for (comp = 0; comp < 2; comp++) {
+
+    retCode = get2x2coefsCDC(bitbuf, &coef[comp][0][0], &numCoef);
+
+    if (retCode < 0)
+      return retCode;
+      
+    if (numCoef == 0)
+      *cbpDC &= ~(1<<comp);
+  }
+
+  if (bibGetStatus(bitbuf) < 0)
+    return VLD_ERROR;
+  else
+    return VLD_OK;
+}
+
+
+/*
+ *
+ * vldGetChromaCoeffs:
+ *
+ * Parameters:
+ *      bitbuf                Bitbuffer object
+ *      coef                  Return pointer for 2x2x2x4x4 coefficients
+ *      cbp                   Return pointer chroma coded block pattern
+ *      numCoefUpPred         Block coefficients counts of upper block for U frame
+ *      numCoefUpPredV        Block coefficients counts of upper block for V frame
+ *      numCoefLeftPred       Block coefficient counts of blocks to the left for U frame
+ *      numCoefLeftPredV      Block coefficient counts of blocks to the left for V frame
+ *      mbAvailBits           Macroblock availability flags
+ *
+ * Function:
+ *      Decode coefficients for 8 4x4 chroma blocks.
+ *
+ * Returns:
+ *      VLD_OK for no error, negative value for error
+ *
+ */
+int vldGetChromaCoeffs(bitbuffer_s *bitbuf, int coef[2][2][2][4][4], int *cbp,
+                       int8 *numCoefUpPred, int8 *numCoefUpPredV,
+                       int8 *numCoefLeftPred, int8 *numCoefLeftPredV,
+                       int mbAvailBits)
+{
+  int comp;
+  int i, j;
+  int retCode;
+
+  for (comp = 0; comp < 2; comp++) {
+
+    for (j = 0; j < 2; j++) {
+      for (i = 0; i < 2; i++) {
+
+        retCode = get4x4coefs(bitbuf, coef[comp][j][i], i, j, &numCoefUpPred[i],
+                              &numCoefLeftPred[j], mbAvailBits, 1);
+
+        if (retCode < 0)
+          return retCode;
+
+        if (numCoefUpPred[i] == 0)
+          *cbp &= ~(1<<(comp*4+j*2+i));
+      }
+
+    }
+
+    /* Switch to V frame */
+    numCoefUpPred = numCoefUpPredV;
+    numCoefLeftPred = numCoefLeftPredV;
+  }
+
+  if (bibGetStatus(bitbuf) < 0)
+    return VLD_ERROR;
+  else
+    return VLD_OK;
+}
+
+
+/*
+ *
+ * vldGetZeroLumaCoeffs:
+ *
+ * Parameters:
+ *      numCoefUpPred         Block coefficient counts of upper block
+ *      numCoefLeftPred       Block coefficient counts of blocks to the left
+ *
+ * Function:
+ *      Called when there are no luma coefficients.
+ *      Sets luma cefficient counts to zero for current MB.
+ *
+ * Returns:
+ *      -
+ */
+void vldGetZeroLumaCoeffs(int8 *numCoefUpPred, int8 *numCoefLeftPred)
+{
+  int i;
+
+  for (i = 0; i < 4; i++) {
+    numCoefUpPred[i] = 0;
+    numCoefLeftPred[i] = 0;
+  }
+}
+
+
+/*
+ *
+ * vldGetZeroChromaCoeffs:
+ *
+ * Parameters:
+ *      numCoefUpPredU        Block coefficient counts of upper block for U frame
+ *      numCoefUpPredV        Block coefficient counts of upper block for V frame
+ *      numCoefLeftPred       Block coefficient counts of blocks to the left
+ *
+ * Function:
+ *      Called when there are no chroma coefficients.
+ *      Sets chroma cefficient counts to zero for current MB.
+ *
+ * Returns:
+ *      -
+ */
+void vldGetZeroChromaCoeffs(int8 *numCoefUpPredU, int8 *numCoefUpPredV,
+                            int8 numCoefLeftPred[2][2])
+{
+  int i;
+
+  for (i = 0; i < 2; i++) {
+    numCoefUpPredU[i] = 0;
+    numCoefUpPredV[i] = 0;
+    numCoefLeftPred[0][i] = 0;
+    numCoefLeftPred[1][i] = 0;
+  }
+}
+
+
+/*
+ *
+ * vldGetAllCoeffs:
+ *
+ * Parameters:
+ *      numCoefUpPredY        Block coefficient counts for Y frame
+ *      numCoefUpPredU        Block coefficient counts for U frame
+ *      numCoefUpPredV        Block coefficient counts for V frame
+ *      numCoefLeftPredY      Luma block coefficient counts of blocks to the left
+ *      numCoefLeftPredC      Chroma block coefficient counts of blocks to the left
+ *
+ * Function:
+ *      Called when all coefficients are non-zero (e.g. PCM mactroblock).
+ *      Sets cefficient counts to "all coded".
+ *
+ * Returns:
+ *      -
+ */
+void vldGetAllCoeffs(int8 *numCoefUpPredY, int8 *numCoefUpPredU,
+                     int8 *numCoefUpPredV, int8 *numCoefLeftPredY,
+                     int8 numCoefLeftPredC[2][2])
+{
+  int i;
+
+  for (i = 0; i < 4; i++) {
+    numCoefUpPredY[i] = 16;
+    numCoefLeftPredY[i] = 16;
+  }
+
+  for (i = 0; i < 2; i++) {
+    numCoefUpPredU[i] = 16;
+    numCoefUpPredV[i] = 16;
+    numCoefLeftPredC[0][i] = 16;
+    numCoefLeftPredC[1][i] = 16;
+  }
+}
+
+
+/*
+ *
+ * vldSetUVLC:
+ *
+ * Parameters:
+ *      codeNumber         value to encode - range [0, 65535]
+ *      codeword           output codeword
+ *      codewordLength     length of output codeword
+ *
+ * Function:
+ *      Encode a value to an UVLC codeword, UVLC codeword is of the form:
+ *      code          codeword
+ *      0                1
+ *      1               010
+ *      2               011
+ *      3              00100
+ *      4              00101
+ *      5              00110
+ *      6              00111
+ *      7             0001000
+ *      8             0001001
+ *      ...             ...
+ *
+ * Returns:
+ *      1 on error, 0 on none    
+ *
+ */
+int vldSetUVLC(int codeNumber, int* codeword, int* codewordLength)
+{
+  int c;
+  int bits;
+
+  if (codeNumber < 0 || codeNumber > 65535)
+  	return 1; 
+  	
+  c = codeNumber+1; 
+  bits = 0;
+  
+  do 
+  {
+    c >>= 1;
+    bits++;
+  }
+  while (c);
+  
+  *codeword = codeNumber + 1;
+  *codewordLength = (bits << 1) - 1;
+  
+  return 0;
+}
+ 
+#endif  //VIDEOEDITORENGINE_AVC_EDITING
Binary file videoeditorengine/cenrep/keys_videoeditorengine.xls has changed
Binary file videoeditorengine/conf/videoeditorengine.confml has changed
Binary file videoeditorengine/conf/videoeditorengine_10204C07.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/data/VideoEditorEngine.pkg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,37 @@
+;
+; Copyright (c) 2010 Ixonos Plc.
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - Initial contribution
+;
+; Contributors:
+; Ixonos Plc
+;
+; Description:
+;
+; Languages
+&EN
+
+; Header
+#{"Video Editor Engine"}, (0x10204bf4), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Engine dll's
+; -----------
+""-"z:\sys\bin\aedmp3aaclib.dll"
+""-"z:\sys\bin\aedengine.dll"
+""-"z:\sys\bin\vedtranscoder.dll"
+""-"z:\sys\bin\vedh263d.dll"
+""-"z:\sys\bin\vedengine.dll"
+""-"z:\sys\bin\vedavcedit.dll"
+
Binary file videoeditorengine/data/VideoEditorEngineStub.sis has changed
Binary file videoeditorengine/data/VideoEditorEngine_stub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/data/VideoEditorEngine_stub.pkg	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,37 @@
+;
+; Copyright (c) 2010 Ixonos Plc.
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - Initial contribution
+;
+; Contributors:
+; Ixonos Plc
+;
+; Description:
+;
+; Languages
+&EN
+
+; Header
+#{"Video Editor Engine"}, (0x10204bf4), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Engine dll's
+; -----------
+""-"z:\sys\bin\aedmp3aaclib.dll"
+""-"z:\sys\bin\aedengine.dll"
+""-"z:\sys\bin\vedtranscoder.dll"
+""-"z:\sys\bin\vedh263d.dll"
+""-"z:\sys\bin\vedengine.dll"
+""-"z:\sys\bin\vedavcedit.dll"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/data/buildsis.bat	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,18 @@
+rem
+rem Copyright (c) 2010 Ixonos Plc.
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - Initial contribution
+rem
+rem Contributors:
+rem Ixonos Plc
+rem
+rem Description:
+rem
+
+makesis -s VideoEditorEngine.pkg VideoEditorEngineStub.sis
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+// ROM build files
+PRJ_MMPFILES
+
+#include "../audioeditorengine/group/bld.inf"
+#include "../avcedit/group/bld.inf"
+#include "../h263decoder/group/bld.inf"
+#include "../mp3aacManipLib/group/bld.inf"
+#include "../vedtranscoder/group/bld.inf"
+#include "../vedengine/group/bld.inf"
+
+// Exported files
+PRJ_EXPORTS
+../conf/videoeditorengine.confml        MW_LAYER_CONFML(videoeditorengine.confml)
+../conf/videoeditorengine_10204C07.crml MW_LAYER_CRML(videoeditorengine_10204C07.crml)
+
+//sis stubb
+../data/VideoEditorEngineStub.sis	/epoc32/data/z/system/install/VideoEditorEngineStub.sis
+
+// Export iby
+../rom/VideoEditorEngine.iby  		CORE_MW_LAYER_IBY_EXPORT_PATH(VideoEditorEngine.iby)
+
+PRJ_TESTMMPFILES
+
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/bwins/vedh263du.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,11 @@
+EXPORTS
+	?NewL@CVedH263Dec@@SAPAV1@VTSize@@H@Z @ 1 NONAME ; class CVedH263Dec * CVedH263Dec::NewL(class TSize, int)
+	?BitstreamMode@CVedVolReader@@QBE?AW4TVedVideoBitstreamMode@@XZ @ 2 NONAME ; public: enum TVedVideoBitstreamMode  __thiscall CVedVolReader::BitstreamMode(void)const 
+	?Height@CVedVolReader@@QBEHXZ @ 3 NONAME ; public: int __thiscall CVedVolReader::Height(void)const 
+	?NewL@CVedVolReader@@SAPAV1@XZ @ 4 NONAME ; public: static class CVedVolReader * __cdecl CVedVolReader::NewL(void)
+	?ParseVolHeaderL@CVedVolReader@@QAEHAAVTDesC8@@@Z @ 5 NONAME ; public: int __thiscall CVedVolReader::ParseVolHeaderL(class TDesC8 &)
+	?TimeIncrementResolution@CVedVolReader@@QBEHXZ @ 6 NONAME ; public: int __thiscall CVedVolReader::TimeIncrementResolution(void)const 
+	?Width@CVedVolReader@@QBEHXZ @ 7 NONAME ; public: int __thiscall CVedVolReader::Width(void)const 
+	?HeaderSize@CVedVolReader@@QBEHXZ @ 8 NONAME ; int CVedVolReader::HeaderSize(void) const
+	?ProfileLevelId@CVedVolReader@@QBEHXZ @ 9 NONAME ; int CVedVolReader::ProfileLevelId(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/eabi/vedh263du.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,13 @@
+EXPORTS
+	_ZN11CVedH263Dec4NewLE5TSizei @ 1 NONAME
+	_ZN13CVedVolReader15ParseVolHeaderLER6TDesC8 @ 2 NONAME
+	_ZN13CVedVolReader4NewLEv @ 3 NONAME
+	_ZNK13CVedVolReader13BitstreamModeEv @ 4 NONAME
+	_ZNK13CVedVolReader23TimeIncrementResolutionEv @ 5 NONAME
+	_ZNK13CVedVolReader5WidthEv @ 6 NONAME
+	_ZNK13CVedVolReader6HeightEv @ 7 NONAME
+	_ZTI13CVedVolReader @ 8 NONAME ; #<TI>#
+	_ZTV13CVedVolReader @ 9 NONAME ; #<VT>#
+	_ZNK13CVedVolReader10HeaderSizeEv @ 10 NONAME
+	_ZNK13CVedVolReader14ProfileLevelIdEv @ 11 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+vedh263d.mmp
+vedh263dLib.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/group/vedh263d.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+
+NOEXPORTLIBRARY
+
+TARGET          vedh263d.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10204bf5
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../videoeditor_plat/video_editor_engine_api/inc
+
+LIBRARY         euser.lib
+
+SOURCEPATH      ../src
+
+SOURCE	        vedh263dimp.cpp
+SOURCE          VedVolReader.cpp
+SOURCE          MPEG4Transcoder.cpp
+SOURCE          h263dntc.cpp
+SOURCE          vdefrt.cpp
+SOURCE          vdeimb.cpp
+SOURCE          vdeims.cpp
+SOURCE          vdemain.cpp
+SOURCE          vdeti.cpp
+SOURCE          vdeti_mpeg.cpp
+SOURCE          block.cpp
+SOURCE          core.cpp
+SOURCE          decblock.cpp
+SOURCE          decgob.cpp
+SOURCE          decmb.cpp
+SOURCE          decmbdct.cpp
+SOURCE          decmbs.cpp
+SOURCE          decpich.cpp
+SOURCE          idctiforepoc.cpp
+SOURCE          sync.cpp
+SOURCE          vdcmvc.cpp
+SOURCE          viddemux.cpp
+SOURCE          biblin.cpp
+SOURCE          dlist.cpp
+SOURCE          list.cpp
+SOURCE          rendri.cpp
+SOURCE          epoclib.cpp
+SOURCE          decmbdct_mpeg.cpp
+SOURCE          decmbs_dp_mpeg.cpp
+SOURCE          core_mpeg.cpp
+SOURCE          sync_mpeg.cpp
+SOURCE          vdcaic.cpp
+SOURCE          decpich_mpeg.cpp
+SOURCE          decvp_mpeg.cpp
+SOURCE          viddemux_mpeg.cpp
+SOURCE          vlb.cpp
+SOURCE          bma.cpp
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/group/vedh263dLib.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+TARGET          vedh263d.lib
+TARGETTYPE      IMPLIB
+UID             0x1000008d 0x10204bf5
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/Common.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for definitions and common structures for 
+* compressed domain transcoding.
+*
+*/
+
+
+#ifndef INCLUDE_COMMON
+#define INCLUDE_COMMON
+
+/*
+ * Includes
+ */
+# include "epoclib.h"
+
+/*
+ * Defines
+ */
+
+/* General */
+#define E_SUCCESS            0
+#define E_FAILURE         (-1)
+#define NULL                 0
+
+/* Data */
+#define MB_SIZE 16
+#define BLOCK_SIZE 8
+#define LOG_BLOCK_WIDTH 3
+#define BLOCK_COEFF_SIZE 64
+ 
+/* Bit stream formating */
+#define MOTION_MARKER 0x1F001
+#define DC_MARKER     0x6B001
+#define DC_MARKER_LENGTH 19
+#define MOTION_MARKER_LENGTH 17 
+
+/* Codes */
+#define VISUAL_OBJECT_SEQUENCE_START_CODE 0x1B0
+#define VISUAL_OBJECT_SEQUENCE_END_CODE   0x1B1
+#define VIDEO_OBJECT_START_CODE           0x0100
+#define VIDEO_OBJECT_LAYER_START_CODE     0x120
+#define USER_DATA_START_CODE              0x1B2
+#define GROUP_OF_VOP_START_CODE           0x1B3
+#define VISUAL_OBJECT_START_CODE          0x1B5
+#define VOP_START_CODE                    0x1B6
+#define PROFILE_LEVEL                     0x3
+#define VISUAL_OBJECT                     0x1
+#define SIMPLE_OBJECT                     0x1
+#define ASPECT_RATIO_INFO                 0x1
+#define CHROMA_FORMAT                     0x1
+#define RECTANGULAR                       0x0
+#define MARKER_BIT                          1
+#define SHORT_VIDEO_START_MARKER          0x20
+#define SHORT_VIDEO_END_MARKER            0x3F
+#define GOB_RESYNC_MARKER                 0x01
+
+/* Quantization */
+#define	MAX_SAT_VAL_SVH		127
+#define	MIN_SAT_VAL_SVH		-127
+#define	FIXED_PT_BITS		16
+
+/* Variable length encoding */
+#define NOT_VALID 65535
+#define ESCAPE_CODE_VLC  0x03
+#define ESCAPE_CODE_LENGTH_VLC 7
+
+/* Constant multipliers */
+#define TAN_PI_BY_8     27145
+#define TAN_PI_BY_16    13036
+#define TAN_3PI_BY_16   43789
+#define COS_PI_BY_4     46340 
+#define COS_PI_BY_8     60546 
+#define COS_PI_BY_16    64276 
+#define COS_3PI_BY_16   54490
+
+/* Shift amount and corresponding rounding constants for DCT */
+#define DCT_PRECISION            16
+#define DCT_ROUND                0      /*32768*/   /* 2^(DCT_PRECISION - 1) */ 
+#define DCT_KEPT_PRECISION       1
+#define DCT_PRECISION_PLUS_KEPT  19      /* DCT_PRECISION + 2 + DCT_KEPT_PRECISION */
+#define DCT_ROUND_PLUS_KEPT       0 /*262144*/  /* 2^(DCT_PRECISION_PLUS_KEPT - 1) */ 
+
+
+/* Macros */
+#define ABS(x)   ((x) >= 0   ? (x) :-(x))
+
+/* 
+ * Enumerations 
+ */
+enum {
+	INTRA,
+	INTER
+};
+
+enum {
+	ONEMV, 
+	FOURMV
+};
+
+enum {
+	I_VOP,
+	P_VOP
+};
+
+enum {
+	H263,
+	MPEG4
+};
+
+enum {
+	OFF, 
+	ON
+};
+
+enum {
+	CODE_FOUND, 
+	CODE_NOT_FOUND
+};
+
+
+/*
+ * Structs and typedefs
+ */
+typedef unsigned char        tBool;
+/* Typedef for 8 bit pixel */
+typedef  u_int8   tPixel;
+
+/* Macroblock position in yuv frame data */
+typedef struct{
+	tPixel *yFrame;
+	u_int32 yFrameWidth;
+	tPixel *uFrame;
+	u_int32 uFrameWidth;
+	tPixel *vFrame;
+	u_int32 vFrameWidth;
+} tMBPosInYUVFrame;
+
+/* Motion vector information */
+typedef struct{
+    int16   mvx;
+    int16   mvy;
+    u_int32  SAD;
+} tMotionVector;
+
+/* Macroblock information */
+typedef struct
+{
+    int16   MV[4][2];
+    u_int32  SAD;
+    int16   QuantScale;
+    int16   CodedBlockPattern;
+	int16   dQuant;
+    int16   SkippedMB;
+} tMBInfo;
+
+/* Macroblock position */
+typedef struct{
+    u_int32  x;
+    u_int32  y;
+    int32   LeftBound;
+    int32   RightBound;
+    int32   TopBound;
+    int32   BottomBound;
+} tMBPosition;
+
+/* Macroblock data (16x16 Y, 8x8 UV) */
+typedef struct{
+    int16   Data[384];
+} tMacroblockData;
+
+#endif  /* INCLUDE_COMMON */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/MPEG4Transcoder.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,366 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Definition for CMPEG4Transcoder, a class for MPEG4 transcoder 
+* working at video packet level or MB level.
+*
+*/
+
+
+
+#ifndef     __VMPEG4TRANSCODER_H__
+#define     __VMPEG4TRANSCODER_H__
+
+
+/* 
+ * Includes (header files are copied from core_mpeg.cpp)
+ */
+#include <e32base.h>
+
+#include <vedcommon.h>
+#include "h263dConfig.h"
+#include "vdc263.h"
+#include "core.h"
+#include "debug.h"
+#include "decblock.h" /* for dblFree and dblLoad */
+#include "decvp_mpeg.h"
+#include "h263dapi.h" /* for H263D_BC_MUX_MODE_SEPARATE_CHANNEL and H263D_ERD_ */
+#include "vdeimb.h"
+#include "viddemux.h"
+#include "vdxint.h"
+#include "vde.h"
+#include "vdemain.h"
+#include "biblin.h"
+#include "mpegcons.h"
+#include "h263dmai.h"
+#include "decpich.h"
+#include "decmbdct.h"
+#include "common.h"
+#include "sync.h"
+#include "vdcaic.h"
+#include "zigzag.h"
+#include "debug.h"
+
+#ifndef VDTASSERT
+// An assertion macro wrapper to clean up the code a bit
+#define VDTASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CMPEG4Transcoder"), EInternalAssertionFailure)) 
+#endif
+
+
+
+/* Get information about video bitstream */
+int vdtGetVideoBitstreamInfo(bibBuffer_t *inBuffer, vdeDecodeParamters_t *aInfoOut, int *aByteIndex, int *aBitIndex);
+
+/* Finds the error resilience bit in MPEG-4 VOL and change it, if necessary, to make it Regular Resynchronization mode */
+TBool vdtChangeVosHeaderRegResyncL(TPtrC8& aInputBuffer, TUint aBufferSize);
+
+
+#define DefaultTimeIncResolution 3000/1001
+
+// unify error codes
+#define TX_OK H263D_OK
+#define TX_ERR H263D_ERROR
+
+/*
+* CopyEditVop
+*    
+*
+* Parameters:
+*    hInstance                  instance handle
+*
+* Function:
+* This function copies the VOP header with edited time stamps of the VOP.
+*
+* Params
+*   @param hInstance is handle instance  itself  
+*   @param aNrBytesToSkip  number of bytes to jump over in the beginning of output buffer (e.g. MPEG4 VOS header)
+*   @param inBuffer is the input buffer
+*   @param aDecoderInfo structure with decode params
+*/
+
+int CopyEditVop(vdeHInstance_t hInstance, int aNrOfBytesToSkip, bibBuffer_t * inBuffer, vdeDecodeParamters_t *aDecoderInfo);
+
+
+
+
+/*
+* CopyEditVideoPacket
+*    
+*
+* Parameters:
+*
+* Function:
+*    This function copies the video packet with edited time stamps, if HEC is enabled
+*
+* Returns:
+*    Success or failure
+*/
+int CopyEditVideoPacket(bibBuffer_t* inBuffer, 
+                        bibBuffer_t* outBuffer, 
+                        bibBufferEdit_t* aBufEdit, 
+                        vdcInstance_t * vdcTemp,
+                        vdeDecodeParamters_t *aDecoderInfo, 
+                        vdxVopHeader_t* vopheader, 
+                        int* aSncCode, 
+                        int* startByteIndex, 
+                        int* startBitIndex);
+
+
+
+
+
+/*
+ * Classes
+ */
+
+/* General transcoding class
+ *   contains all necessary transcoding information
+ *   accessible from various points in the decoder module 
+ */
+class CMPEG4Transcoder : public CBase
+{
+public:
+    
+  static CMPEG4Transcoder* NewL (const vdeInstance_t *aVDEInstance, bibBuffer_t *aInBuffer, bibBuffer_t *aOutBuffer);
+
+  /* Destructor */
+    ~CMPEG4Transcoder();
+
+    /* Indicates whether we need to do  MPEG4 bitstream transcoding */
+    int SetTranscoding(vdeDecodeParamters_t *aDecoderInfo);
+
+    /* Copy the VOP Header to output buffer */
+    void VOPHeaderEnded(int aStartByteIndex, int aStartBitIndex, 
+      int aQuant, int aPicType, int aFrameNum, int aVOPNotCoded);
+  /* One VOP ended */
+    void VOPEnded();
+  /* Record the position before one video packet is processed */
+    void BeginOneVideoPacket(dvpVPInParam_t *aVPin);
+    /* Record the position before the content of the video packet is processed (called after retreiving the video packet) */
+    void AfterVideoPacketHeader(dvpVPInOutParam_t *aVPInfo);
+    /* Called after one video packet's contents are retrieved */
+    void OneVPEnded();
+  /* Add one IMB instance for I macroblock */
+    void OneIMBDataStartedDataPartitioned(vdxIMBListItem_t *aMBInstance, dlst_t *aMBList, int aCurrMBNumInVP, int aMBNum);
+    /* Add one PMB instance for P macroblock */
+    void OnePMBDataStartedDataPartitioned(vdxPMBListItem_t *aMBInstance, dlst_t *aMBList, int aCurrMBNumInVP, int aMBNum);
+    /* Records the position of vop_time_increment_resolution bit */
+    void MPEG4TimerResolution(int aStartByteIndex, int aStartBitIndex);
+    /* Creates a new H263 macroblock */
+    int ConstructH263MBData(dmdPParam_t *aParam, int aNewMCBPCLen, int aNewMCBPC);
+    /* Transcode one H263 MB to one MPEG4 MB */
+    void H263ToMPEG4MBData(int aNewMCBPCLen, int aNewMCBPC);
+    /* fills the reconstructed DCAC values for INTRA block */
+    void AddOneBlockDCACrecon(int aIndex, int *aDCAC);
+    /* Record MB parameters before the content of the MB is processed (called after retreiving the MB layer) */
+    void AfterMBLayer(int aUpdatedQp);
+    /* returns first frame QP */
+    inline int GetRefQP() { return iRefQuant; }
+
+
+    /* returns 1 if we need the decoded frame */
+    int  NeedDecodedYUVFrame();
+    /* Record the position before one MB is processed */
+    void BeginOneMB(int aMBNum);
+    /* Record the position before one block in MB is processed */
+    void BeginOneBlock(int aIndex);
+  /* Start one IMB (called after the MB header is read) */
+    void OneIMBDataStarted(vdxIMBListItem_t *aMBInstance);
+  /* Start one PMB (called after the MB header is read) */
+    void OnePMBDataStarted(vdxPMBListItem_t *aMBInstance);
+  /* Input one block data to current MB */
+    void AddOneBlockDataToMB(int aBlockIndex, int *aBlockData);
+    /* Indicates if escape vlc coding is used in one block */
+    void H263EscapeCoding(int aIndex, int fEscapeCodeUsed);
+  /* Records the position of resnc_marker_disable bit */
+    void ErrorResilienceInfo(vdxVolHeader_t *header, int aByte, int aBit);
+  /* Constructs the VOS header */
+    void ConstructVOSHeader(int aMPEG4, vdeDecodeParamters_t *aDecoderInfo);
+  /* Called after one H263 GOB or slice header is parsed */
+    void H263GOBSliceHeaderEnded(vdxGOBHeader_t *aH263GOBHeader, vdxSliceHeader_t *aH263SliceHeader);   
+  /* Called after one H263 picture header is parsed */
+    int H263PictureHeaderEnded(dphOutParam_t *aH263PicHeader, dphInOutParam_t *aInfo);
+  /* Called before one H.63 GOB or slice header is parsed */
+    void H263GOBSliceHeaderBegin();
+  /* Called after one H263 GOB or Slice ends */
+    void H263OneGOBSliceEnded(int nextExpectedMBNum);
+  /* Called after one GOB (slice) that has GOB header (except the first GOB) ends */
+    void H263OneGOBSliceWithHeaderEnded();
+    /* Transcodes one macroblock (may include dequantization, requantization, and re-encoding) */
+    int TranscodingOneMB(dmdPParam_t *aParam);
+
+private:
+		/* Constructors */
+    CMPEG4Transcoder(const vdeInstance_t *aVDEInstance, bibBuffer_t *aInBuffer, bibBuffer_t *aOutBuffer);
+
+        /*Constructl to allocate necessary resources*/
+        void ConstructL();
+
+    // main functions to perform  transcoding for one macroblock
+    /* Transcode MB - rearranges data partitioned bitstream data to regular */
+    void ConstructRegularMPEG4MBData(int aNewMCBPCLen, int aNewMCBPC);
+  /* Resets the DCs for U/V blocks in intra MB */
+    void ResetMPEG4IntraDcUV();
+  /* Recontruct IMB partitions for color effect when we are not doing format transcoding */
+    void ReconstructIMBPartitions();
+  /* Recontruct PMB partitions for color effect when we are not doing format transcoding */
+    void ReconstructPMBPartitions();
+  /* Evaluate Chrominance DC Scaler from QP for MPEG4 */
+    int GetMpeg4DcScalerUV(int aQP);
+  /* Evaluate IntraDC Coefficients for U,V blocks for MPEG4 */
+    void GetMPEG4IntraDcCoeffUV(TInt aValue, TInt& aSize, TInt& aSizeCode, 
+      TInt& aSizeCodeLength, TInt& aValueCode, TInt& aValueCodeLength);
+
+
+
+private:
+
+	    /* Output data buffer */
+    bibBuffer_t *iOutBuffer;
+    /* Operation modes */
+    TVedVideoBitstreamMode iBitStreamMode;
+
+    /* 
+    When we do mode translation for MPEG4, the target mode may be MPEG4Resyn or H263
+       but for H263, when we do mode translation, the target mode is always MPG4Resyn
+    */
+
+/* Member variables */
+
+    /* Indicates the direction for MPEG4 mode translation */
+    int iTargetFormat; 
+
+    /* Input data buffer */
+    bibBuffer_t *iInBuffer;
+
+    /* Indicates if we need to do transcoding for current MB */
+    int iDoTranscoding;
+
+    /* Indicates if we need to do MPEG4 bitstream conversion */
+    int iDoModeTranscoding;
+
+    /* Special Effect (Black and White) paramter */
+    int iColorEffect;
+    
+    /* color tone U,V value parameter */
+    TInt iColorToneU;
+    TInt iColorToneV;
+
+    /* Information we know about this frame and MB */
+
+    /* current VOP coding type */
+    int iVopCodingType;
+
+    /* number of MBs in one VOP */
+    int iNumMBsInOneVOP;
+
+    /* indicates if stuffing bits have been used */  
+    int8 iStuffingBitsUsed;
+
+
+    /* Only valid with resync_marker
+       Information includes:
+            MB number, quant_scale, StartByteIndex, StartBitIndex ...
+    */
+    /* Contains CurMBNum, quant, frame number, etc */
+    dvpVPInOutParam_t *iCurVPInOut; 
+    /* Contains picture type, etc */
+    dvpVPInParam_t *iCurVPIn; 
+    /* VOL header */
+    vdxVolHeader_t iVOLHeader;
+
+    /* position pointers at different levels */
+    int iVPStartByteIndex, iVPStartBitIndex;
+    int iVPHeaderEndByteIndex, iVPHeaderEndBitIndex;
+    int iTimeResolutionByteIndex, iTimeResolutionBitIndex;
+    /* Array to store the DCT data */
+    int iDCTBlockData[BLOCK_COEFF_SIZE * 6];                 /* YUV components */
+    int **iH263DCData;           /* Intra DC matrix for H263 -> MPEG4 transcoding */
+
+    dlst_t *iMBList;
+    tMBInfo* h263mbi;     /* one frame MB information for MPEG4 to H263 transcoding */
+    int iPreQuant;        /* last QUANT, used in MPEG4 to H263 transcoding */
+    
+    /* used for color toning for MPEG4 */
+    u_char *iMBType;       /* array indicating MB type for all MBs in VOP */
+    int iRefQuant;         /* reference QP derived from 1st VOP of MPEG4 */
+    int iCurQuant;         /* current QP */
+    int iDcScaler;         /* DC Scaler for iRefQuant */
+                        
+
+    int *iH263MBVPNum;    /* matrix recording the video packet number for each MB */
+
+    int iShortHeaderEndByteIndex ,  iShortHeaderEndBitIndex;
+
+    /* iMBStartByteIndex, iMBStartBitIndex also record the postion 
+       right after the VP header when video packet is used
+    */
+    int iMBStartByteIndex, iMBStartBitIndex;
+
+    /* Positions of each block data including INTRA DC if it exists 
+       except for data partioning, in which it only indicates the ACs or DCTs
+    */
+    int iBlockStartByteIndex[6], iBlockStartBitIndex[6];
+    int iBlockEndByteIndex[6], iBlockEndBitIndex[6];
+    int iErrorResilienceStartByteIndex, iErrorResilienceStartBitIndex;
+
+    /*Added for Time Res 30000 */
+    int iOutputMpeg4TimeIncResolution;
+
+    /* Processing data member */
+    const vdeInstance_t *iVDEInstance;
+
+    /* Instance for current processing MB */
+    vdxIMBListItem_t *iCurIMBinstance;
+    vdxPMBListItem_t *iCurPMBinstance; 
+    
+    /* Temporary edit buffer */
+    bibBufferEdit_t      bufEdit;
+    
+    /* Current and last processed MB */
+    int iCurMBNum;
+
+    /* Last output MB number */
+    int iLastMBNum;
+
+    /* current MB number in current video packet */
+    int iCurMBNumInVP;
+
+    /* MB coding type: INTRA or INTER */
+    int iMBCodingType;
+
+  /* Specific members only for H.263! */
+    int iGOBSliceStartByteIndex;
+    int iGOBSliceStartBitIndex;
+    int iGOBSliceHeaderEndByteIndex;
+    int iGOBSliceHeaderEndBitIndex;
+
+  /* Index of video packet in MPEG4 */
+    int iVideoPacketNumInMPEG4;  
+  /* Number of MBs in picture width */
+    int iMBsinWidth;  
+  /* Number of MBs in one GOB */
+    int iNumMBsInGOB; 
+  /* Indicates if its the first frame */
+    unsigned char fFirstFrameInH263;
+  /* Indicates if escape vlc coding is used */
+  int iEscapeCodeUsed[6]; 
+
+};
+
+
+
+#endif      /* __VMPEG4TRANSCODER_H__ */
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/VedVolReader.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for VOL header parser.
+*
+*/
+
+
+
+#ifndef __VEDVOLREADER_H__
+#define __VEDVOLREADER_H__
+
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <vedcommon.h>
+
+
+
+
+
+// DATA TYPES
+
+/**
+ * Structure for the Video Object Layer header data
+ */ 
+struct TVolHeader
+    {
+    TInt iProfileLevelId;     // Indicates the Level Id (0,1,2,3,4,8 or 9) of the Simple
+                              // Profile the Video Object conforms to
+    TInt iVoPriority;         // Priority assigned to the Video Object 
+                              // a value between 1(lowest)-7(highest).
+                              // If not in the bitstream, set to zero
+   
+    TInt iVoId;               // id of the Video Object 
+    TInt iVolId;              // id of the Video Object Layer 
+    TInt iRandomAccessibleVol;// set to 1 if all the VOPs in the stream are I-VOP.
+    TInt iPixelAspectRatio;   // see MPEG-4 visual spec. pp. 71
+
+    TInt iTimeIncrementResolution;
+                              // Resolution to interpret the time_increment 
+                              // fields in the VOP headers 
+
+    TInt iLumWidth;           // Frame width of the Y component in pixels 
+    TInt iLumHeight;          // Frame height of the Y component in pixels 
+
+    TUint8 iErrorResDisable;  // Flag ON if no resynchronization markers are
+                              // used inside frames. 
+                              // When OFF it doesn't mean they ARE used.
+    TUint8 iDataPartitioned;  // Flag indicating if data partitioning inside 
+                              // a VP is used or not.
+    TUint8 iReversibleVlc;    // flag indicating the usage of reversible 
+                              // VLC codes
+
+    // the following parameters concern the input video signal,
+    // see MPEG-4 visual spec. pp. 66-70, and "Note" in viddemux_mpeg.c 
+    // Not used in the current implementatnion.
+    TInt iVideoFormat;
+    TInt iVideoRange;
+    TInt iColourPrimaries;    
+    TInt iTransferCharacteristics;
+    TInt iMatrixCoefficients;
+
+    // the following parameters are used in the Video Buffering Verifier
+    // (Annex D) to monitor the input bit buffer, complexity, memory buffer
+    // used in the decoding process. The conformance of a stream can be checked
+    // using these parameters. 
+    // Not used in the current implementatnion. 
+    TUint32 iBitRate;
+    TUint32 iVbvBufferSize;
+    TUint32 iVbvOccupancy;
+
+    HBufC8* iUserData;        // User Data if available
+    };
+    
+
+
+// CLASS DECLARATION
+
+/**
+ * A class for parsing the Video Object Layer header
+ */
+class CVedVolReader : public CBase
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CVedVolReader* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVedVolReader();
+    
+    /**
+     * Parses given Video Object Layer header
+     * @param aData Buffer from where to parse the header
+     * @return error code
+     */
+    IMPORT_C TInt ParseVolHeaderL(TDesC8& aData);
+    
+    /**
+     * Returns the time increment resolution that was read from the VOL header
+     * @return time increment resolution
+     */    
+    IMPORT_C TInt TimeIncrementResolution() const;
+    
+    /**
+     * Returns the width of the video that was read from the VOL header
+     * @return width
+     */  
+    IMPORT_C TInt Width() const;
+    
+    /**
+     * Returns the height of the video that was read from the VOL header
+     * @return height
+     */  
+    IMPORT_C TInt Height() const;
+    
+    /**
+     * Returns the Level Id of the Simple Profile the Video Object conforms to
+     * @return profile level Id
+     */  
+    IMPORT_C TInt ProfileLevelId() const;
+    
+    /**
+     * Returns the bitstream mode of the video
+     * @return bitstream mode
+     */  
+    IMPORT_C TVedVideoBitstreamMode BitstreamMode() const;
+    
+    /**
+     * Returns the size of the VOL header
+     * @return size of the header
+     */  
+    IMPORT_C TInt HeaderSize() const;
+
+private:
+
+    /**
+     * Structure for internal buffer of the header sequence
+     */
+    struct TSeqHeaderBuffer
+        {
+        TDesC8& iData;           // The actual data of the buffer
+        TInt    iGetIndex;       // Index of getting from the buffer 
+        TInt    iBitInOctet;	 // Bit index in the buffer
+        
+        TSeqHeaderBuffer(TDesC8& aData, TInt aGetIndex, TInt aBitInOctet) :
+            iData(aData), iGetIndex(aGetIndex), iBitInOctet(aBitInOctet) {}
+        };
+    
+    /**
+     * C++ default constructor.
+     */
+    CVedVolReader();
+    
+    /**
+     * By default Symbian OS constructor is private.
+     */
+    void ConstructL();
+    
+    /**
+     * Reads requested bits from given buffer
+     * @param aBuffer Buffer from where to read the bits
+     * @param aNumBits Amount of bits to read
+     * @param aFlush Discard the bits that were read
+     * @return The bits that were read
+     */
+    TUint32 ReadSeqHeaderBits(TSeqHeaderBuffer& aBuffer, TInt aNumBits, TBool aFlush);
+    
+    /**
+     * Reads user data from given buffer
+     * @param aBuffer Buffer from where to read the user data
+     */
+    void ReadUserDataL(TSeqHeaderBuffer& aBuffer);
+    
+    /**
+     * Checks what is the bit stream mode the video
+     * @param aErd Flag error resilience disable used
+     * @param aDp Flag data partitioned used
+     * @param aRvlc Flag reversible vlc used
+     * @return The bit stream mode
+     */
+    TVedVideoBitstreamMode CheckBitstreamMode(TUint8 aErd, TUint8 aDp, TUint8 aRvlc);
+
+private:
+
+    // Member variables
+    
+    static const TInt KMaxUserDataLength;       // The maximum allocated memory for 
+                                                // user data (UD). Only this much of the UD
+                                                // from the bitstream is stored
+                                                
+    static const TUint8 KMsbMask[8];            // Mask for extracting the needed bits
+    static const TUint8 KLsbMask[9];
+    
+    TVolHeader iHeader;                         // For storing the header data
+    
+    TVedVideoBitstreamMode iBitstreamMode;
+    TInt iHeaderSize;
+
+    };
+
+#endif // __VEDVOLREADER_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/biblin.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,230 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for Bit Buffer module. 
+*
+*/
+
+
+#ifndef _BIBLIN_H_
+#define _BIBLIN_H_
+
+#include "epoclib.h"
+
+/*
+ * Defines
+ */
+
+/* Error codes */
+/* Obsolete error codes are not used anymore and are defined only to maintain
+   backwards compatibility with older versions of the file. */
+#define ERR_BIB_STRUCT_ALLOC 1000      /* If a structure allocation failed */
+#define ERR_BIB_BUFFER_ALLOC 1001      /* Obsolete */
+#define ERR_BIB_FILE_READ 1002         /* Obsolete */
+#define ERR_BIB_NOT_ENOUGH_DATA 1003   /* If the number of bits requested from
+                                          the buffer is greater than the number
+                                          of bits available in the buffer */
+#define ERR_BIB_ALREADY_OPENED 1004    /* Obsolete */
+#define ERR_BIB_FILE_OPEN 1005         /* Obsolete */
+#define ERR_BIB_ALREADY_CLOSED 1006    /* Obsolete */
+#define ERR_BIB_FILE_CLOSE 1007        /* Obsolete */
+#define ERR_BIB_NUM_BITS 1008          /* Obsolete */
+#define ERR_BIB_FILE_NOT_OPEN 1009     /* Obsolete */
+#define ERR_BIB_ILLEGAL_SIZE 1010      /* Obsolete */
+#define ERR_BIB_CANNOT_REWIND 1011     /* If the number of bits requested to be
+                                          rewinded is greater than the number
+                                          of bits available in the buffer */
+#define ERR_BIB_BUFLIST 1012           /* If the internal buffer list has
+                                          been corrupted */
+#define ERR_BIB_TOO_SMALL_BUFFER 1013  /* Obsolete */
+#define ERR_BIB_FEC_RELOCK 1050        /* Obsolete */
+#define ERR_BIB_PSC_FOUND 1060         /* Obsolete */
+
+
+/*
+ * Structs and typedefs
+ */
+
+
+
+/* {{-output"bibBuffer_t_info.txt" -ignore"*" -noCR}}
+ * The bibBuffer_t data type is a structure containing all the necessary data
+ * for a bit buffer instance (except for the actual data buffer). This
+ * structure is passed to all of the bit buffer functions.
+ * {{-output"bibBuffer_t_info.txt"}}
+ */
+
+/* {{-output"bibBuffer_t.txt"}} */
+
+
+
+enum CopyMode {
+     CopyNone        = 0,
+     CopyWhole       = 1,
+     CopyWithEdit    = 2,
+     EditOnly        = 3
+};
+
+typedef struct bibEditParams_s {
+
+   int StartByteIndex;      // start byte position where data is to be written 
+   int StartBitIndex;       // start bit position where data is to be written 
+   int curNumBits;      // number of bits that need to be replaced 
+   int newNumBits;      // number of bits to be written 
+   int newValue;      // the value to be written 
+
+} bibEditParams_t; 
+
+typedef struct bibBufferEdit_s {
+
+    CopyMode copyMode; 
+    int numChanges; 
+    bibEditParams_t *editParams;
+
+} bibBufferEdit_t; 
+
+
+
+
+typedef struct bibBuffer_s {
+   u_char *baseAddr;       /* the start address of the buffer */
+
+   unsigned size;          /* the size of the buffer in bytes */
+
+   unsigned getIndex;      /* an index to the buffer where data was last got */
+
+   int bitIndex;           /* an index to the byte pointed by getIndex + 1 */
+
+   u_int32 bitsLeft;       /* the number of bits currently in the buffer */
+
+   u_int32 numBytesRead;   /* the total number of bytes read */
+
+   int error;               /* stores possible error code */
+
+} bibBuffer_t;
+/* {{-output"bibBuffer_t.txt"}} */
+
+#ifdef DEBUG_OUTPUT
+extern bibBuffer_t * buffer_global;
+#endif
+
+/* typedefs for bibFlushBits, bibGetBits, and bibShowBits function types */
+typedef void (*bibFlushBits_t) (int, bibBuffer_t *, int *, int *, int16 *);
+typedef u_int32 (*bibGetBits_t) (int, bibBuffer_t *, int *, int *, int16 *);
+typedef u_int32 (*bibShowBits_t) (int, bibBuffer_t *, int *, int *, int16 *);
+
+/*
+ * External macros
+ */
+
+/*
+    * bibNumberOfBitsLeft
+    *
+    * Parameters:
+    *    bibBuffer_t *buffer        input bit buffer instance
+    *
+    * Function:
+    *    This macro returns the number of bits which are left to be read
+    *    from the current position.
+    *
+    * Returns:
+    *    See above.
+    */
+
+   #define bibNumberOfBitsLeft(buffer) \
+      ((buffer)->bitsLeft)
+
+/*
+ * External function prototypes
+ */
+
+bibBuffer_t *bibCreate(void *srcBuffer, unsigned srcBufferLength,
+   int16 *errorCode);
+
+void bibDelete(bibBuffer_t *buffer, int16 *errorCode);
+
+u_int32 bibNumberOfFlushedBits(bibBuffer_t *buffer);
+
+u_int32 bibNumberOfFlushedBytes(bibBuffer_t *buffer);
+
+u_int32 bibNumberOfRewBits(bibBuffer_t *buffer);
+
+void bibRewindBits(u_int32 numberOfBits, bibBuffer_t *buffer, int16 *errorCode);
+
+
+/* 
+ * Prototypes for bibFlushBits/bibGetBits/bibShowBits 
+ */
+
+void bibFlushBits(int numberOfBits, bibBuffer_t *buffer);
+u_int32 bibGetBits(int numberOfBits, bibBuffer_t *buffer);
+u_int32 bibShowBits(int numberOfBits, bibBuffer_t *buffer);
+
+inline void bibFlushBits(int numberOfBits, bibBuffer_t *buffer, int *numberOfBitsGot, int * /*bitErrorIndication*/, int16 * /*errorCode*/)
+{
+    *numberOfBitsGot = numberOfBits;
+    bibFlushBits(numberOfBits, buffer);
+}
+
+inline u_int32 bibGetBits(int numberOfBits, bibBuffer_t *buffer, int *numberOfBitsGot, int * /*bitErrorIndication*/, int16 * /*errorCode*/)
+{
+    *numberOfBitsGot = numberOfBits;
+    return bibGetBits(numberOfBits, buffer);
+}
+
+inline u_int32 bibShowBits(int numberOfBits, bibBuffer_t *buffer, int *numberOfBitsGot, int * /*bitErrorIndication*/, int16 * /*errorCode*/)
+{
+    *numberOfBitsGot = numberOfBits;
+    return bibShowBits(numberOfBits, buffer);
+}
+
+#define bibFlushBitsFromBuffer bibFlushBits
+#define bibGetBitsFromBuffer bibGetBits
+#define bibShowBitsFromBuffer bibShowBits
+
+
+bibBufferEdit_t *bibBufferEditCreate(int16 *errorCode);
+void bibBufEditDelete(bibBufferEdit_t *bufEdit, int16 *errorCode);
+
+// copy from input buffer to output buffer in various copy modes (with or without editing)
+void CopyStream(bibBuffer_t *SrcBuffer,bibBuffer_t *DestBuffer,bibBufferEdit_t *bufEdit, 
+								int ByteStart,int BitStart);
+// copy from input buffer to output buffer (without editing)
+void CopyBuffer(bibBuffer_t *SrcBuffer,bibBuffer_t *DestBuffer, 
+								int ByteStart,int BitStart, int ByteEnd, int BitEnd);
+// copy from BufferEdit to output buffer (no copying; rather, inserting code into output buffer)
+void CopyBufferEdit(bibBuffer_t *SrcBuffer, bibBuffer_t *DestBuffer, 
+										bibEditParams_t *edParam, int updateSrcBufferStats=1);
+// insert correct IntraDC values for H.263 chrominance blocks in output buffer
+void ResetH263IntraDcUV(bibBuffer_t *DestBuffer, int uValue, int vValue); 
+// insert correct IntraDC values for MPEG-4 chrominance blocks in output buffer
+void ResetMPEG4IntraDcUV(bibBuffer_t *DestBuffer, int IntraDC_size); 
+
+	/* 
+			SrcValue		the source value from which bits are to be extacted 
+			MaxNumBits	the length in bits of the source value
+			StartBit		the index of the starting bit form where data is to be retrieved
+			getBits			the number of bits to be retrieved 
+	*/
+u_int32 bibGetBitsFromWord(u_int32 SrcValue, u_int32 getBits, u_int32 *StartBit, 
+												u_int32 MaxNumBits);
+void bibForwardBits(u_int32 numberOfBits, bibBuffer_t *buffer);
+void bibStuffBits(bibBuffer_t *buffer);
+void bibStuffBitsMPEG4(bibBuffer_t *inBuffer, bibBuffer_t *outBuffer, bibBufferEdit_t *bufEdit, 
+											 int *StartByteIndex, int *StartBitIndex, int updateSrcBufferStats);
+
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/blkfunc.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for block handling functions.
+*
+*/
+
+
+
+#ifndef __BLKFUNC_H
+#define __BLKFUNC_H
+
+#include "epoclib.h"
+
+// General-purpose clip tables for signed and unsigned chars.
+// Both of these tables range from -2048 to +2047.
+
+extern const u_char unsignedCharClip[];
+extern const char signedCharClip[]; // MH
+
+/*
+ *
+ * blcAddBlock
+ *
+ * Parameters:
+ *    block                block array
+ *    frame_p              pointer to present frame in the place,
+ *                         where the block is added
+ *    xSize                X size of the frame.
+ *    mbPlace              flag that indicates the place for the current
+ *                         macroblock inside the macroblock row:
+ *                            -1 beginning of row
+ *                             0 middle of row
+ *                             1 end of row
+ *    fourMVs              1 if Advanced Prediction Mode is used, otherwise 0
+ *    prevDiffBlock        if fourMVs == 1 and mbPlace <= 0 the difference
+ *                         block is stored to prevDiffBlock for later use
+ *
+ * Function:
+ *    This function sums the given block into block being currently decoded in
+ *    present frame. Parameters are the table consisting a block, a pointer to
+ *    the frame at the correct place and the width of the frame.
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+void __cdecl blcAddBlockAsm(int *block, u_char *frame_p, int xSize,
+   int mbPlace, u_char fourMVs, int *prevDiffBlock);
+
+/*
+ *
+ * blcMixBlocks
+ *
+ * Parameters:
+ *    dest        Destination pointer
+ *    src         Source pointer
+ *    yn          Y size of the block
+ *    xn          X size of the block (0-16)
+ *    ydiff       X line length of the destination block
+ *    sydiff      X line length of the source block
+ *
+ * Function:
+ *    This function replaces all the pixels in the destination block with
+ *    an average calculated from the corresponding source and destination
+ *    block pixels.
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+void __cdecl blcMixBlocks( u_char *dest, u_char *src, int yn, int xn,
+   int ydiff, int sydiff );
+
+/*
+ *
+ * blcMixOverlapped
+ *
+ * Parameters:
+ *    blkBuf      Source blocks:
+ *                64b whole, 32b left, 32b right, 32b up, 32b down
+ *    dest        Destination pointer
+ *    ddelta      Delta for destination lines
+ *
+ * Function:
+ *    Calculates weighted averages of several macroblock pieces - see
+ *    function blcOverlappedMC in block.c for more detailed description.
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+void __cdecl blcMixOverlapped( u_char *blkBuf, u_char *dest, int ddelta );
+
+/*
+ *
+ * blcInvQuant
+ *
+ * Parameters:
+ *    block       Block pointer
+ *    quant       Quantization value
+ *    count       Number of values to process
+ *
+ * Function:
+ *    Does inverse quantization for a block for idct.
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+void __cdecl blcInvQuant( int *block, int quant, int count );
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/block.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Block handling.
+*
+*/
+
+
+#ifndef _BLOCK_H_
+#define _BLOCK_H_
+
+#include "epoclib.h"
+#include "vdcmvc.h"
+
+/*
+ * Definitions
+ */
+
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* {{-output"blcDiffMB_t_info.txt" -ignore"*" -noCR}}
+   blcDiffMB_t is used as a temporary storage for the previous difference 
+   (INTER) macroblock. This storage is needed for the Advanced Prediction
+   mode because the previous prediction macroblock cannot be constructed
+   until the motion vectors of the current macroblock have been fetched
+   from the bitstream. (The previous difference macroblock cannot be stored
+   directly to the current frame either, because the difference block data
+   is signed and the frame data is unsigned.)
+   {{-output"blcDiffMB_t_info.txt"}} */
+
+/* {{-output"blcDiffMB_t.txt"}} */
+typedef struct {
+   int block[4][64];    /* luminance blocks for P frame */
+   int cbpy;            /* coded block pattern for luminance */
+} blcDiffMB_t;
+/* {{-output"blcDiffMB_t.txt"}} */
+
+
+/* {{-output"BLC_COPY_PREDICTION_MB_PARAM_info.txt" -ignore"*" -noCR}}
+   This C preprocessor definition is used to store the parameters needed
+   for the blcCopyPredictionMB function (and therefore also for
+   the blcCopyPredictionMBParam_t data type). These parameters may also be used
+   in other modules than the Block Tools and in other data structures than
+   blcCopyPredictionMBParam_t. When these parameters are introduced with this
+   preprocessor definition in the other data structures, one does not need
+   the "extra" reference step which would be needed if the parameters
+   would have been introduced directly and only in
+   the blcCopyPredictionMBParam_t structure. For example, if otherStructA
+   has been typedefd as {BLC_COPY_PREDICTION_MB_PARAM} and otherStructB as
+   {blcCopyPredictionMBParam_t predPar;}, to access e.g. refY one has to use
+   either otherStructA.refY or otherStructB.predPar.refY.
+   {{-output"BLC_COPY_PREDICTION_MB_PARAM_info.txt"}} */
+
+/* {{-output"BLC_COPY_PREDICTION_MB_PARAM.txt"}} */
+#define BLC_COPY_PREDICTION_MB_PARAM \
+   u_char *refY;              /* Reference frame */ \
+   u_char *refU; \
+   u_char *refV; \
+\
+   u_char *currYMBInFrame;    /* Pointer to current macroblock in frame */ \
+   u_char *currUBlkInFrame; \
+   u_char *currVBlkInFrame; \
+\
+   int uvBlkXCoord;           /* X coord of MB in chrominance pixels */ \
+   int uvBlkYCoord;           /* Y coord of MB (top-left corner) in */ \
+                              /* chrominance pixels */ \
+\
+   int uvWidth;               /* Width of the picture in chro pixels */ \
+   int uvHeight;              /* Height of the picture in chro pixels */ \
+\
+   mvcData_t *mvcData;        /* Motion Vector Count module instance data */ \
+\
+   int *mvx;                  /* Array of 4 x-components of motion vectors */ \
+   int *mvy;                  /* Array of 4 y-components of motion vectors */ \
+                              /* If not in 4-MVs-mode, only the first entry */ \
+                              /* of the both arrays is used. */ \
+\
+   int mbPlace;               /* Indicates the place of the current */ \
+                              /* macroblock inside the macroblock row: */ \
+                              /*    -1 beginning of row */ \
+                              /*    0 middle of row */ \
+                              /*    1 end of row */ \
+                              /* If Annex K is in use */ \
+                              /*    -1 beginning of row or slice */ \
+                              /*    0 middle of slice */ \
+                              /*    1 end of row(if not the beginning of */ \
+                              /*      the slice)  or slice */ \
+                              /*    2  end of row and the beginning of slice */ \
+\
+   int fAdvancedPrediction;   /* Non-zero if Advanced Prediction is used */ \
+\
+   int fMVsOverPictureBoundaries; \
+                              /* Non-zero if MVs are allowed to point */ \
+                              /* outside picture boundaries */ \
+\
+   blcDiffMB_t *diffMB;       /* Prediction error for the previous MB */ \
+\
+   int rcontrol;              /* RCONTROL (section 6.1.2 of H.263) */ \
+\
+   int fourMVs;               /* Flag to indicate if there is four motion
+                                 vectors per macroblock */
+/* {{-output"BLC_COPY_PREDICTION_MB_PARAM.txt"}} */
+
+
+/* {{-output"blcCopyPredictionMBParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass parameters into the blcCopyPredictionMB
+   function.
+   {{-output"blcCopyPredictionMBParam_t_info.txt"}} */
+
+/* {{-output"blcCopyPredictionMBParam_t.txt"}} */
+typedef struct {
+   BLC_COPY_PREDICTION_MB_PARAM
+} blcCopyPredictionMBParam_t;
+/* {{-output"blcCopyPredictionMBParam_t.txt"}} */
+
+
+
+
+/*
+ * Function prototypes
+ */
+
+void blcAddBlock(int *block, 
+								 u_char HUGE *frame_p, 
+								 int xSize, 
+   int mbPlace, u_char fourMVs, int *prevDiffBlock);
+
+void blcBlockToFrame(int *block, 
+										 u_char HUGE *frame_p, 
+										 int xSize);
+
+int blcCopyPredictionMB(blcCopyPredictionMBParam_t *param);
+
+
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/core.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,265 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Internal header for the core module of the Video Decoder Core.
+*
+*/
+
+
+#ifndef _CORE_H_
+#define _CORE_H_
+
+#include "vdcmvc.h"
+#include "vdcaic.h"
+#include "vdeims.h"
+#include "viddemux.h"
+
+#include "biblin.h"
+
+
+/*
+ * Defines
+ */
+
+#define vdcMalloc malloc
+#define vdcCalloc calloc
+#define vdcRealloc realloc
+#define vdcDealloc free
+
+#ifndef vdcAssert
+#define vdcAssert(exp) assert(exp);
+#endif
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* {{-output"vdcPictureParam_t_info.txt" -ignore"*" -noCR}}
+   vdcPictureParam_t is used to store the attributes for one picture.
+   {{-output"vdcPictureParam_t_info.txt"}} */
+
+/* {{-output"vdcPictureParam_t.txt"}} */
+typedef struct {
+   int tr;                    /* the TR field or a combination of ETR and TR
+                                 if ETR is used */
+
+   int trd;                   /* Difference between present and previous tr */
+
+   int prevTR;                /* TR of the previous frame */
+
+   /* The following three fields correspond to the flags in the PTYPE field */
+   int fSplitScreenIndicator;
+   int fDocumentCameraIndicator;
+   int fFullPictureFreezeRelease;
+
+   int pictureType;           /* Picture type is one of the following:
+                                    VDX_PIC_TYPE_I       INTRA
+                                    VDX_PIC_TYPE_P       INTER
+                                    VDX_PIC_TYPE_PB      PB (Annex G)
+                                    VDX_PIC_TYPE_IPB     Improved PB
+                                    VDX_PIC_TYPE_B       B (Annex O)
+                                    VDX_PIC_TYPE_EI      EI (Annex O)
+                                    VDX_PIC_TYPE_EP      EP (Annex O) */
+
+   int fPLUSPTYPE;            /* 0 = no PLUSPTYPE, 1 = PLUSPTYPE exists */
+
+   int cpm;                   /* The CPM field */
+   int psbi;                  /* The PSBI field, valid only if cpm == 1 */
+
+   /* The following two fields are relevant if picture type indicates
+      a PB frame */
+   int trb;                   /* The TRB field */
+   int dbquant;               /* The DBQUANT field */
+
+   int lumWidth;              /* the width and height of the luminance */
+   int lumHeight;             /* image to display (divisible with 4) */
+
+   int lumMemWidth;           /* the width and height of the luminance */
+   int lumMemHeight;          /* image in memory (divisible with 16) */
+
+   /* The following six fields are relevant only if fSS is off */
+   int numGOBs;               /* Number of GOBs in picture */
+   int fLastGOBSizeDifferent; /* Flag indicating different size of last GOB */
+   int numMBsInGOB;           /* Number of macroblocks in other GOBs than 
+                                 the last one */
+   int numMBsInLastGOB;       /* Number of macroblocks in last GOB */
+   int numMBLinesInGOB;       /* Number of macroblock lines in one GOB */
+   int numMBsInMBLine;        /* Number of macroblocks in macroblock line */
+
+   /* The following six fields are relevant only if fSS is on */
+   int mbaFieldWidth;         /* MBA Field width */
+   int mbaMaxValue;           /* MBA maximum value. See Table K.2/H.263 */
+   int swiFieldWidth;         /* SWI Field width */
+   int swiMaxValue;           /* SWI maximum value. See Table K.3/H.263 */
+
+   int fUMV;                  /* Unrestricted Motion Vector Mode */
+   int fSAC;                  /* Syntax-based Arithmetic Coding Mode */
+   int fAP;                   /* Advanced Prediction Mode */
+
+   int fRPR;                  /* Reference Picture Resampling Mode */
+   int fRRU;                  /* Reduced-Resolution Update Mode */
+   int rtype;                 /* Rounding type (RTYPE) */
+
+   int elnum;                 /* Enhancement layer number */
+
+   int fCustomSourceFormat;   /* Flag indicating if custom source format 
+                                 is used */
+
+   int fAIC;                  /* Advanced INTRA Coding Mode */
+   int fDF;                   /* Deblocking Filter Mode */
+   int fSS;                   /* Slice Structured Mode */
+   int fRPS;                  /* Reference Picture Selection Mode,
+                                 Note: always valid and therefore should be
+                                 the same as instance->fRPS after decoding
+                                 the first picture header. */
+   int fISD;                  /* Independent Segment Decoding Mode */
+   int fAIV;                  /* Alternate INTER VLC Mode */
+   int fMQ;                   /* Modified Quantization Mode */
+
+                              /* Picture Clock Frequence (PCF) fields */
+   int fCustomPCF;            /* 0 = CIF PCF, 1 = custom PCF */
+   int pcfRate;               /* PCF = pcfRate / pcfScale Hz */
+   int pcfScale;
+
+   /* The following field is relevant only if fUMV is on with fPLUSPTYPE */
+   int fUMVLimited;           /* 0 = motion vector range is not limited,
+                                 1 = motion vector range is limited
+                                    according to Annex D */
+
+   int fMVsOverPictureBoundaries;
+                              /* 0 = prediction over picture boundaries is 
+                                     disallowed,
+                                 1 = prediction over picture boundaries is
+                                     allowed */
+
+   /* The MPEG-4 Video Object Layer (VOL) parameters */
+/*** MPEG-4 REVISION ***/
+
+   int vo_id;                 /* VO Id */
+   int vol_id;                /* VO Id */
+
+   u_char error_res_disable;  /* VOL disable error resilence mode */
+   u_char reversible_vlc;     /* VOL reversible VLCs */
+   u_char data_partitioned;   /* VOL data partitioning */
+
+   int time_increment_resolution; /* resolution of the time increment
+                                     in the VOP header */
+
+   /* The in H.263 not existing MPEG-4 Video Object Plane (VOP) parameters */
+   
+   int mod_time_base;         /* VOP modulo time base (absolute) */
+   int time_base_incr;        /* time base increment of the current VOP
+                                 (used in HEC of Video Packet Header,
+                                 when time_base_incr of the VOP is
+                                 retransmitted */
+   int time_inc;              /* VOP time increment 
+                                 (relative to last mod_time_base) */ 
+   int intra_dc_vlc_thr;
+   int fcode_forward;
+   u_char fixed_vop_rate;       /* fixed vop rate indication, added for transcoding */
+/*** End MPEG-4 REVISION ***/
+
+} vdcPictureParam_t;
+/* {{-output"vdcPictureParam_t.txt"}} */
+
+
+/* {{-output"vdcInstance_t_info.txt" -ignore"*" -noCR}}
+   vdcInstance_t holds the instance data for a Video Decoder Core instance.
+   This structure is used to keep track of the internal state of
+   a VDC instance.
+   {{-output"vdcInstance_t_info.txt"}} */
+
+/* {{-output"vdcInstance_t.txt"}} */
+typedef struct {
+   vdeImsItem_t *currFrame;   /* Current P/I frame (image store item) */
+   vdeImsItem_t *bFrame;      /* Current B frame (of PB, image store item) */
+                              /* NULL pointer indicates that the frames are
+                                 not valid. */
+
+   vdcPictureParam_t pictureParam;
+                              /* Picture parameters for the current picture */
+
+   int32 frameNum;            /* Frame number */
+   int32 frameNumForBFrame;   /* Frame number for B frame */
+
+   int gfid;                  /* GOB Frame ID */
+   vdxPictureHeader_t *prevPicHeader;  /* Header of the previous picture */
+   int fPrevPicHeaderReliable;	/* if header is not 100% reliable, it is better not to compare it with the next header */
+
+   mvcData_t mvcData;         /* Storage for motion vector data */
+
+/*** MPEG-4 REVISION ***/
+
+   aicData_t aicData;         /* Storage AC/DC reconstruction*/
+
+   char *user_data;           /* User Data */
+   int user_data_length; 
+
+/*** End MPEG-4 REVISION ***/
+
+   u_int32 nOfDecodedFrames;  /* Counter for (partially) successfully decoded frames */
+   u_char fIntraGot;          /* non-zero = INTRA frame has been decoded */
+   u_char fEOS;               /* 1 if EOS has been reached, 0 otherwise */
+
+   int fRPS;                  /* Reference Picture Selection in use? 
+                                 At first, set to zero in vdcOpen.
+                                 Then, modified according to the bitstream. */
+
+   int rpsMode;               /* both/either/neither ACK and/or/nor NACK, 
+                                 VDX_RPS_MODE_XXX */
+
+   int fIgnoreRPSBufferUpdate;/* 0 = segment buffering in FIFO mode as normally
+                                 1 = decoded pictures are not put into
+                                     reference segment buffers */
+
+   int numAnnexNScalabilityLayers;
+                              /* -1  = no frames decoded yet,
+                                 0   = Nokia-proprietary Annex N scalability 
+                                       layers not in use,
+                                 2.. = number of scalability layers */
+
+   int fGFIDShouldChange;     /* 1, if GFID should change, 0 otherwise */
+
+   vdeIms_t *imageStore;      /* Pointer to image store */
+
+   void *hParent;             /* typeless handle to vdeInstance_t */
+
+   u_int32 snapshotStartCallback;  /* function pointer to a function informing   w
+                                      the beginning of a snapshot */
+
+   u_int32 snapshotEndCallback;  /* function pointer to a function informing
+                                      the end of a snapshot */
+
+   int snapshotStatus;           /* snapshot transmission status */
+
+   u_int32 reportPictureSizeCallback; /* callback function for informing
+                                         frame size */
+
+} vdcInstance_t;
+/* {{-output"vdcInstance_t.txt"}} */
+
+
+/*
+ * Function prototypes
+ */
+
+VDC_INLINE int VDC_MIN(int a, int b) {return a < b ? a : b;}
+VDC_INLINE int VDC_MAX(int a, int b) {return a > b ? a : b;}
+
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/debug.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* A header for debug output functions.
+*
+*/
+
+
+#ifndef _DEBUG_H_
+#define _DEBUG_H_
+
+#if defined(DEB_FILE) || defined(DEB_STDOUT) || defined(DEB_DEBUGGER)
+   /* Debug output wanted */
+
+   #include <stdio.h>
+   #include "nrctypes.h"
+
+   #ifdef DEBUG_OUTPUT
+   #include "biblin.h"
+   #endif
+
+   #ifdef __cplusplus
+   extern "C" {
+   #endif
+
+   /*
+    * Function prototypes
+    */
+
+   int debFree(void);
+   int debLoad(const char *fileName);
+
+   #ifdef DEB_PERF
+      #define deb(dummy) 0
+      #define debp(dummy) 0
+      #define debPrintf(dummy) 0
+      #define deb0p(format) 0
+      #define deb1p(format, p1) 0
+      #define deb2p(format, p1, p2) 0
+      #define deb3p(format, p1, p2, p3) 0
+      #define deb4p(format, p1, p2, p3, p4) 0
+      #define deb5p(format, p1, p2, p3, p4, p5) 0
+      #define deb0f(stream, format) 0
+      #define deb1f(stream, format, p1) 0
+      #define deb2f(stream, format, p1, p2) 0
+      #define deb3f(stream, format, p1, p2, p3) 0
+      #define deb4f(stream, format, p1, p2, p3, p4) 0
+      #define deb5f(stream, format, p1, p2, p3, p4, p5) 0
+
+      #ifdef DEB_STDOUT
+         #define debPerf printf
+      #else
+         int debPerf(const char *format, ...);
+      #endif
+
+   #else
+      #ifdef DEB_STDOUT
+         #define deb printf
+      #else
+      #ifdef DEBUG_OUTPUT
+         int deb_core(const char *format, ...);
+         #define deb deb_core("%08lu: ", bibNumberOfFlushedBits(buffer_global)), deb_core
+      #else
+         int deb(const char *format, ...);
+      #endif
+      #endif
+
+      #define debp deb
+
+      #ifdef DEB_FILELINE
+         #define debPrintf deb("%s, line %d. ", __FILE__, __LINE__), deb
+      #else
+         #define debPrintf deb
+      #endif
+
+      #define deb0p debPrintf
+      #define deb1p debPrintf
+      #define deb2p debPrintf
+      #define deb3p debPrintf
+      #define deb4p debPrintf
+      #define deb5p debPrintf
+
+      /* Internal defines to enable DEB_FILELINE */
+      #ifdef DEB_STDOUT
+         #define deb0ff(stream, format) fprintf(stream, format)
+         #define deb1ff(stream, format, p1) fprintf(stream, format, p1)
+         #define deb2ff(stream, format, p1, p2) fprintf(stream, format, p1, p2)
+         #define deb3ff(stream, format, p1, p2, p3) fprintf(stream, format, p1, p2, p3)
+         #define deb4ff(stream, format, p1, p2, p3, p4) fprintf(stream, format, p1, p2, p3, p4)
+         #define deb5ff(stream, format, p1, p2, p3, p4, p5) fprintf(stream, format, p1, p2, p3, p4, p5)
+      #else
+         #define deb0ff(stream, format) deb(format)
+         #define deb1ff(stream, format, p1) deb(format, p1)
+         #define deb2ff(stream, format, p1, p2) deb(format, p1, p2)
+         #define deb3ff(stream, format, p1, p2, p3) deb(format, p1, p2, p3)
+         #define deb4ff(stream, format, p1, p2, p3, p4) deb(format, p1, p2, p3, p4)
+         #define deb5ff(stream, format, p1, p2, p3, p4, p5) deb(format, p1, p2, p3, p4, p5)
+      #endif
+
+      #ifdef DEB_FILELINE
+         #define deb0f(stream, format) \
+            deb2ff(stream, "%s, line %d. ", __FILE__, __LINE__), \
+            deb0ff(stream, format)
+
+         #define deb1f(stream, format, p1) \
+            deb2ff(stream, "%s, line %d. ", __FILE__, __LINE__), \
+            deb1ff(stream, format, p1)
+
+         #define deb2f(stream, format, p1, p2) \
+            deb2ff(stream, "%s, line %d. ", __FILE__, __LINE__), \
+            deb2ff(stream, format, p1, p2)
+
+         #define deb3f(stream, format, p1, p2, p3) \
+            deb2ff(stream, "%s, line %d. ", __FILE__, __LINE__), \
+            deb3ff(stream, format, p1, p2, p3)
+
+         #define deb4f(stream, format, p1, p2, p3, p4) \
+            deb2ff(stream, "%s, line %d. ", __FILE__, __LINE__), \
+            deb4ff(stream, format, p1, p2, p3, p4)
+
+         #define deb5f(stream, format, p1, p2, p3, p4, p5) \
+            deb2ff(stream, "%s, line %d. ", __FILE__, __LINE__), \
+            deb4ff(stream, format, p1, p2, p3, p4, p5)
+
+      #else
+         #define deb0f(stream, format) deb0ff(stream, format)
+         #define deb1f(stream, format, p1) deb1ff(stream, format, p1)
+         #define deb2f(stream, format, p1, p2) deb2ff(stream, format, p1, p2)
+         #define deb3f(stream, format, p1, p2, p3) deb3ff(stream, format, p1, p2, p3)
+         #define deb4f(stream, format, p1, p2, p3, p4) deb4ff(stream, format, p1, p2, p3, p4)
+         #define deb5f(stream, format, p1, p2, p3, p4, p5) deb5ff(stream, format, p1, p2, p3, p4, p5)
+      #endif
+
+      #define debPerf deb
+   #endif
+
+   #ifdef __cplusplus
+   };
+   #endif
+
+#else /* no debug output wanted */
+
+   #define deb(dummy) 
+   #define debp(dummy) 
+   #define debPrintf(dummy) 
+   #define deb0p(format) 
+   #define deb1p(format, p1) 
+   #define deb2p(format, p1, p2) 
+   #define deb3p(format, p1, p2, p3) 
+   #define deb4p(format, p1, p2, p3, p4) 
+   #define deb5p(format, p1, p2, p3, p4, p5) 
+   #define deb0f(stream, format) 
+   #define deb1f(stream, format, p1) 
+   #define deb2f(stream, format, p1, p2) 
+   #define deb3f(stream, format, p1, p2, p3) 
+   #define deb4f(stream, format, p1, p2, p3, p4) 
+   #define deb5f(stream, format, p1, p2, p3, p4, p5) 
+   #define debPerf(dummy) 
+   #define debFree() 
+   #define debLoad(dummy) 
+
+#endif
+
+   #define debLogOutput(a,b,c) 
+
+#endif /* !defined(_DEBUG_H_) */
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/decblock.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for block layer decoding module.
+*
+*/
+
+
+#ifndef _DECBLOCK_H_
+#define _DECBLOCK_H_
+
+#include "h263dext.h"
+
+/*
+ * Defines
+ */
+
+// unify error codes
+#define DBL_OK H263D_OK
+#define DBL_ERR H263D_ERROR
+
+
+/*
+ * Function prototypes
+ */
+
+int dblFree(void);
+
+int dblLoad(void);
+
+void dblIdctAndDequant(int *block, int quant, int skip);
+
+void dblIdct(int *block);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/decgob.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for GOB segment decoding module.
+*
+*/
+
+
+#ifndef _DECGOB_H_
+#define _DECGOB_H_
+
+#include "core.h"
+#include "vdcmvc.h"
+#include "vdeims.h"
+#include "MPEG4Transcoder.h"
+class CMPEG4Transcoder;
+/*
+ * Defines
+ */
+ 
+// unify error codes
+#define DGOB_OK_BUT_BIT_ERROR H263D_OK_BUT_BIT_ERROR           /* Bit errors detected */
+#define DGOB_OK H263D_OK
+#define DGOB_ERR H263D_ERROR
+
+/*
+ * Structs and typedefs
+ */
+
+/* {{-output"dgobGOBSegmentInParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the dgobGetAndDecodeGOBSegment and dgobGetAndDecodeGOBSegmentContents
+   functions.
+   {{-output"dgobGOBSegmentInParam_t_info.txt"}} */
+
+/* {{-output"dgobGOBSegmentInParam_t.txt"}} */
+typedef struct {
+   int numStuffBits;             /* Number of stuffing bits before GBSC */
+
+   vdcPictureParam_t *pictParam; /* Picture attributes */
+
+   bibBuffer_t *inBuffer;        /* Bit Buffer instance */
+
+
+   bibBuffer_t *outBuffer;        /* output Bit Buffer instance */
+   bibBufferEdit_t *bufEdit; 
+   int iColorEffect; 
+   TBool iGetDecodedFrame;
+
+
+   int fGFIDShouldChange;        /* If non-zero, the gfid parameter passed in 
+                                    the dgobGOBSegmentInOutParam_t structure
+                                    should be different from the value got
+                                    from the bitstream. Otherwise, the values
+                                    should be equal. */
+
+} dgobGOBSegmentInParam_t;
+/* {{-output"dgobGOBSegmentInParam_t.txt"}} */
+
+
+
+/* {{-output"dgobGOBSegmentInOutParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the dgobGetAndDecodeGOBSegment and dgobGetAndDecodeGOBSegmentContents
+   functions. The functions may modify the parameters (or the structures
+   pointed by the parameters).
+   {{-output"dgobGOBSegmentInOutParam_t_info.txt"}} */
+
+/* {{-output"dgobGOBSegmentInOutParam_t.txt"}} */
+typedef struct {
+   int prevGNWithHeader;         /* GN of the latest decoded GOB with header */
+
+   int prevGN;                   /* GN of the latest decoded GOB */
+
+   int gfid;                     /* GFID of the latest GOB header,
+                                    specify -1 if this is the 1st GOB of
+                                    the sequence */
+
+   u_char *fCodedMBs;            /* array for coded macroblock flags in
+                                    scan-order, 1 = coded, 0 = not coded */
+
+   int numOfCodedMBs;            /* number of coded macroblocks */
+
+   int *quantParams;             /* array of quantization parameters for
+                                    macroblocks in scan-order */
+
+   mvcData_t *mvcData;           /* Motion Vector Count module instance data */
+
+   vdeIms_t *imageStore;         /* VDE Image Store instance data */
+
+   int trp;                      /* Temporal Reference for Prediction,
+                                    -1 if not indicated in the bitstream */
+
+   int rtr;                      /* Real TR of the referenced image */
+
+   u_char *refY;                 /* Reference frame */
+   u_char *refU;
+   u_char *refV;
+
+   u_char *currPY;               /* Current P (or I) frame */
+   u_char *currPU;
+   u_char *currPV;
+
+   int StartByteIndex;
+   int StartBitIndex;
+
+
+} dgobGOBSegmentInOutParam_t;
+/* {{-output"dgobGOBSegmentInOutParam_t.txt"}} */
+
+
+/* {{-output"dgobGOBCheckParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the dgobCheckNextGob function.
+   {{-output"dgobGOBCheckParam_t_info.txt"}} */
+
+/* {{-output"dgobGOBCheckParam_t.txt"}} */
+typedef struct {
+   bibBuffer_t *inBuffer;        /* Bit Buffer instance */
+
+   bibBuffer_t *outBuffer;        /* Out Bit Buffer instance data */
+	 int StartByteIndex;
+	 int StartBitIndex;
+
+   vdcPictureParam_t *pictParam; /* Picture attributes */
+   int numStuffBits;             /* Number of stuffing bits before GBSC */
+   int prevGN;                   /* GN of the latest GOB */
+   int gfid;                     /* GFID of the frame */
+} dgobCheckParam_t;
+/* {{-output"dgobGOBCheckParam_t.txt"}} */
+
+
+/*
+ * Functions prototypes
+ */
+
+int dgobGetAndDecodeGOBSegment(
+   const dgobGOBSegmentInParam_t *inParam,
+   dgobGOBSegmentInOutParam_t *inOutParam, CMPEG4Transcoder *hTranscoder);
+
+int dgobGetAndDecodeGOBSegmentContents(
+   const dgobGOBSegmentInParam_t *inParam,
+   int fGetNewReferenceFrame,
+   int quant,
+   dgobGOBSegmentInOutParam_t *inOutParam, CMPEG4Transcoder *hTranscoder);
+
+int dgobCheckNextGob( 
+   dgobCheckParam_t *param , CMPEG4Transcoder *hTranscoder);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/decmb.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,232 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for macroblock decoding functions.
+*
+*/
+
+
+
+#ifndef _DECMB_H_
+#define _DECMB_H_
+
+/*
+ * Includes
+ */
+
+#include "epoclib.h"
+
+#include "biblin.h"
+
+#include "block.h"
+#include "core.h"
+#include "vdcmvc.h"
+
+
+/*
+ * Defines
+ */
+
+// unify error codes
+#define DMB_BIT_ERR  H263D_OK_BUT_BIT_ERROR
+#define DMB_OK H263D_OK
+#define DMB_ERR H263D_ERROR
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* {{-output"dmbIFrameMBInParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the dmbGetAndDecodeIFrameMB function.
+   {{-output"dmbIFrameMBInParam_t_info.txt"}} */
+
+/* {{-output"dmbIFrameMBInParam_t.txt"}} */
+typedef struct {
+   bibBuffer_t *inBuffer;        /* Bit Buffer instance data */
+
+
+   bibBuffer_t *outBuffer;        /* Out Bit Buffer instance data */
+   bibBufferEdit_t *bufEdit;
+   int iColorEffect; 
+   TBool iGetDecodedFrame; //Do we need to get decoded data.
+   int StartByteIndex;
+   int StartBitIndex;
+
+
+   int xPosInMBs;                /* Horizontal position of the macroblock
+                                    (in macroblocks), 
+                                    0 .. (numMBsInMBLine - 1) */
+
+   int yPosInMBs;                /* Vertical position of the macroblock,
+                                    (in macroblocks), 0 .. */
+
+   vdcPictureParam_t *pictParam; /* Picture attributes */
+
+   int fGOBHeaderPresent;        /* 1 if GOB header present */
+
+   int numMBsInSegment;          /* Number of MBs in either GOB or Slice Segment */
+   int sliceStartMB;             /* MB address of starting MB of the slice */
+
+
+} dmbIFrameMBInParam_t;
+/* {{-output"dmbIFrameMBInParam_t.txt"}} */
+
+
+/* {{-output"dmbIFrameMBInOutParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the dmbGetAndDecodeIFrameMB function. The function may also modify
+   these parameters (or the structures pointed by the parameters).
+   {{-output"dmbIFrameMBInOutParam_t_info.txt"}} */
+
+/* {{-output"dmbIFrameMBInOutParam_t.txt"}} */
+typedef struct {
+   u_char *fCodedMBs;            /* Array for coded macroblock flags in
+                                    scan-order, 1 = coded, 0 = not coded */
+
+   int numOfCodedMBs;            /* Number of coded macroblocks */
+
+/*** MPEG-4 REVISION ***/
+   int currMBNum;                /* current MB number */
+   int currMBNumInVP;            /* current MB in VP */
+   
+   aicData_t *aicData;           /* MPEG-4 Advanced Intra Coding module 
+                                    instance data */
+/*** End MPEG-4 REVISION ***/
+
+   int quant;                    /* Current quantizer */
+
+   u_char *yMBInFrame;           /* Pointer to the top-left corner of
+                                    the current macroblock in a frame */
+   u_char *uBlockInFrame;
+   u_char *vBlockInFrame;
+
+   int StartByteIndex;
+   int StartBitIndex;
+
+} dmbIFrameMBInOutParam_t;
+/* {{-output"dmbIFrameMBInOutParam_t.txt"}} */
+
+
+/* {{-output"dmbPFrameMBInParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the dmbGetAndDecodePFrameMB function.
+   {{-output"dmbPFrameMBInParam_t_info.txt"}} */
+
+/* {{-output"dmbPFrameMBInParam_t.txt"}} */
+typedef struct {
+   bibBuffer_t *inBuffer;        /* Bit Buffer instance data */
+
+   bibBuffer_t *outBuffer;        /* Out Bit Buffer instance data */
+   bibBufferEdit_t *bufEdit;
+   int iColorEffect; 
+   TBool iGetDecodedFrame;
+   int StartByteIndex;
+   int StartBitIndex;
+
+
+   int xPosInMBs;                /* Horizontal position of the macroblock
+                                    (in macroblocks), 
+                                    0 .. (numMBsInMBLine - 1) */
+
+   int yPosInMBs;                /* Vertical position of the macroblock,
+                                    (in macroblocks), 0 .. */
+
+   vdcPictureParam_t *pictParam; /* Picture attributes */
+
+   int fGOBHeaderPresent;        /* Non-zero indicates that the GOB header
+                                    is present in the GOB to which the current
+                                    macroblock belongs */
+
+   u_char *refY;                 /* Reference frame */
+   u_char *refU;
+   u_char *refV;
+
+   u_char *currPY;               /* Current P (or I) frame */
+   u_char *currPU;
+   u_char *currPV;
+
+
+   int numMBsInSegment;          /* Number of MBs in either GOB or Slice Segment */
+   int sliceStartMB;             /* MB address of starting MB of the slice */
+
+   int mbOnRightOfBorder;
+   int mbOnOfBottomBorder;
+   int mbOnLeftOfBorder;
+
+} dmbPFrameMBInParam_t;
+/* {{-output"dmbPFrameMBInParam_t.txt"}} */
+
+
+/* {{-output"dmbPFrameMBInOutParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the dmbGetAndDecodePFrameMB function. The function may also modify
+   these parameters (or the structures pointed by the parameters).
+   {{-output"dmbPFrameMBInOutParam_t_info.txt"}} */
+
+/* {{-output"dmbPFrameMBInOutParam_t.txt"}} */
+typedef struct {
+
+
+   bibBuffer_t *outBuffer;        /* Out Bit Buffer instance data */
+   int StartByteIndex;
+   int StartBitIndex;
+
+
+   u_char *fCodedMBs;            /* Array for coded macroblock flags in
+                                    scan-order, 1 = coded, 0 = not coded */
+
+   int numOfCodedMBs;            /* Number of coded macroblocks */
+
+/*** MPEG-4 REVISION ***/
+   int currMBNum;                /* current MB number */
+   int currMBNumInVP;            /* current MB in VP */
+
+   aicData_t *aicData;           /* Advanced Intra Coding module instance data */
+/*** End MPEG-4 REVISION ***/
+
+   int quant;                    /* Current quantizer */
+
+   u_char *yMBInFrame;           /* Pointer to the top-left corner of
+                                    the current macroblock in a frame */
+   u_char *uBlockInFrame;
+   u_char *vBlockInFrame;
+
+   mvcData_t *mvcData;           /* Motion Vector Count module instance data */
+
+   blcDiffMB_t *diffMB;          /* Storage for the previous prediction error
+                                    blocks */
+
+} dmbPFrameMBInOutParam_t;
+/* {{-output"dmbPFrameMBInOutParam_t.txt"}} */
+
+
+/*
+ * Function prototypes
+ */
+
+int dmbGetAndDecodeIFrameMB(
+   const dmbIFrameMBInParam_t *inParam,
+   dmbIFrameMBInOutParam_t *inOutParam,
+   u_char fMPEG4, CMPEG4Transcoder *hTranscoder);
+
+int dmbGetAndDecodePFrameMB(
+   const dmbPFrameMBInParam_t *inParam,
+   dmbPFrameMBInOutParam_t *inOutParam,
+   u_char fMPEG4, CMPEG4Transcoder *hTranscoder);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/decmbdct.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for macroblock content blocks decoding functions.
+*
+*/
+
+
+
+
+#ifndef _DECMBDCT_H_
+#define _DECMBDCT_H_
+
+/*
+ * Includes
+ */
+
+#include "block.h"
+#include "vdcaic.h"
+
+#include "biblin.h"
+
+class CMPEG4Transcoder;
+
+/*
+ * Defines
+ */
+
+// unify error codes
+#define DMD_BIT_ERR H263D_OK_BUT_BIT_ERROR
+#define DMD_OK H263D_OK
+#define DMD_ERR H263D_ERROR
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* {{-output"dmdBOfPBParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass parameters to
+   the dmdGetAndDecodeBOfPBMBBlocks function.
+   {{-output"dmdBOfPBParam_t_info.txt"}} */
+
+/* {{-output"dmdBOfPBParam_t.txt"}} */
+typedef struct {
+   bibBuffer_t *inBuffer;        /* Bit Buffer instance data */
+
+
+   bibBuffer_t *outBuffer;        /* Out Bit Buffer instance data */
+   int StartByteIndex;
+   int StartBitIndex;
+
+   int cbpb;                     /* Coded block pattern for B-blocks */
+   
+   int quant;                    /* Current quantizer */
+
+   BLC_COPY_PREDICTION_MB_PARAM  /* See block.h */
+
+   int fMQ;                      /* Modified Quantization Mode flag */
+
+} dmdBOfPBParam_t;
+/* {{-output"dmdBOfPBParam_t.txt"}} */
+
+
+/* {{-output"dmdIParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass parameters to
+   the dmdGetAndDecodeIMBBlocks function.
+   {{-output"dmdIParam_t_info.txt"}} */
+
+/* {{-output"dmdIParam_t.txt"}} */
+typedef struct {
+   bibBuffer_t *inBuffer;        /* Bit Buffer instance data */
+
+
+   bibBuffer_t *outBuffer;        /* Out Bit Buffer instance data */
+   bibBufferEdit_t *bufEdit; 
+   int iColorEffect; 
+   TBool iGetDecodedFrame;
+   int StartByteIndex;
+   int StartBitIndex;
+
+
+   int cbpy;                     /* Coded block pattern for luminance */
+
+   int cbpc;                     /* Coded block pattern for chrominance */
+
+   int quant;                    /* Current quantizer */
+
+   int yWidth;                   /* Picture width in luminance pixels */
+
+   u_char *yMBInFrame;           /* Current macroblock in frame */
+   u_char *uBlockInFrame; 
+   u_char *vBlockInFrame;
+
+   int xPosInMBs;                /* Horizontal position of the macroblock
+                                    (in macroblocks), 
+                                    0 .. (numMBsInMBLine - 1) */
+
+   int yPosInMBs;                /* Vertical position of the macroblock,
+                                    (in macroblocks), 0 .. */
+
+   int numMBLinesInGOB;          /* Number of macroblock lines in GOB */
+
+   int pictureType;              /* Picture type is one of the following:
+                                       VDX_PIC_TYPE_I       INTRA
+                                       VDX_PIC_TYPE_P       INTER
+                                       VDX_PIC_TYPE_PB      PB (Annex G)
+                                       VDX_PIC_TYPE_IPB     Improved PB
+                                       VDX_PIC_TYPE_B       B (Annex O)
+                                       VDX_PIC_TYPE_EI      EI (Annex O)
+                                       VDX_PIC_TYPE_EP      EP (Annex O) */
+
+   int numMBsInMBLine;           /* Number of MBs in one MB Line */
+   
+   int fGOBHeaderPresent;        /* 1 if GOB header is present.*/
+   
+   int predMode;                 /* prediction mode given by INTRA_MODE field */
+
+   int fMQ;                      /* Modified Quantization Mode flag */
+
+   int sumBEI;                   /* Sum (bit-wise OR) of bit error indications for the whole MB */
+
+   int rightOfBorder;            /* There is a border on the left of the current MB */
+   
+   int downOfBorder;             /* There is a border on top of the current MB */
+
+} dmdIParam_t;
+/* {{-output"dmdIParam_t.txt"}} */
+
+/* {{-output"dmdMPEGIParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass parameters to
+   the dmdGetAndDecodeMPEGIMBBlocks function.
+   {{-output"dmdMPEGIParam_t_info.txt"}} */
+
+/* {{-output"dmdMPEGIParam_t.txt"}} */
+typedef struct {
+   bibBuffer_t *inBuffer;        /* Bit Buffer instance data */
+
+
+   bibBuffer_t *outBuffer;        /* Out Bit Buffer instance data */
+   bibBufferEdit_t *bufEdit; 
+   int iColorEffect; 
+   TBool iGetDecodedFrame;
+   int StartByteIndex;
+   int StartBitIndex;
+
+   int cbpy;                     /* Coded block pattern for luminance */
+
+   int cbpc;                     /* Coded block pattern for chrominance */
+
+   int quant;                    /* Current quantizer */
+
+   int yWidth;                   /* Picture width in luminance pixels */
+
+   int switched;                 /* if TRUE instead of optimized IntraDC
+                                    decoding IntraAC VLC table is used for
+                                    DC coefficient coding */
+
+   int currMBNum;                /* current MB Number */
+
+   u_char fTopOfVP;              /* The current Macroblock is in the top row
+                                    of the current Video Packet */
+   u_char fLeftOfVP;             /* The current Macroblock is the first
+                                    (on the left) of the current Video Packet */
+   u_char fBBlockOut;            /* The "B" AC/DC prediction block for the 
+                                    current Macroblock is outside of the
+                                    current Video Packet */
+
+   aicData_t *aicData;           /* storage for the intra prediction (AIC) data */
+
+   u_char data_partitioned;
+   int *DC;                      /* if data_partitioned, this is the array of
+                                    the DC coefficients decoded in the previous
+                                    partition of the VP */
+
+   u_char reversible_vlc;        /* TRUE if reversible VLC is used */
+   u_char vlc_dec_direction;     /* 0: forward, 1: backward decoding of RVLC */
+
+   u_char *yMBInFrame;           /* Current macroblock in frame */
+   u_char *uBlockInFrame; 
+   u_char *vBlockInFrame;
+
+   int xPosInMBs;                /* Horizontal position of the macroblock
+                                    (in macroblocks), 
+                                    0 .. (numMBsInMBLine - 1) */
+
+   int yPosInMBs;                /* Vertical position of the macroblock,
+                                    (in macroblocks), 0 .. */
+
+   int numMBsInMBLine;           /* Number of macroblocks in one line */
+
+   int numMBLinesInGOB;          /* Number of macroblock lines in GOB */
+
+   int pictureType;              /* Picture type is one of the following:
+                                       VDX_PIC_TYPE_I       INTRA
+                                       VDX_PIC_TYPE_P       INTER
+                                       VDX_PIC_TYPE_PB      PB (Annex G)
+                                       VDX_PIC_TYPE_IPB     Improved PB
+                                       VDX_PIC_TYPE_B       B (Annex O)
+                                       VDX_PIC_TYPE_EI      EI (Annex O)
+                                       VDX_PIC_TYPE_EP      EP (Annex O) */
+
+   int fMQ;
+   int fAIC;
+
+} dmdMPEGIParam_t;
+/* {{-output"dmdMPEGIParam_t.txt"}} */
+
+/* {{-output"dmdPParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass parameters to
+   the dmdGetAndDecodeIMBBlocks function.
+   {{-output"dmdPParam_t_info.txt"}} */
+
+/* {{-output"dmdPParam_t.txt"}} */
+typedef struct {
+   bibBuffer_t *inBuffer;        /* Bit Buffer instance data */
+
+
+   bibBuffer_t *outBuffer;        /* Out Bit Buffer instance data */
+   bibBufferEdit_t *bufEdit; 
+   int iColorEffect;
+   TBool iGetDecodedFrame;
+   int StartByteIndex;
+   int StartBitIndex;
+
+   int cbpy;                     /* Coded block pattern for luminance */
+
+   int cbpc;                     /* Coded block pattern for chrominance */
+
+   int quant;                    /* Current quantizer */
+
+   BLC_COPY_PREDICTION_MB_PARAM  /* See block.h */
+
+/*** MPEG-4 REVISION ***/
+   u_char reversible_vlc;        /* TRUE if reversible VLC is used */
+   u_char vlc_dec_direction;     /* 0: forward, 1: backward decoding of RVLC */
+/*** End MPEG-4 REVISION ***/
+
+   int xPosInMBs;                /* Horizontal position of the macroblock
+                                    (in macroblocks), 
+                                    0 .. (numMBsInMBLine - 1) */
+
+   int yPosInMBs;                /* Vertical position of the macroblock,
+                                    (in macroblocks), 0 .. */
+   
+   int numMBsInMBLine;           /* Number of MBs in one MB Line */
+   
+   int fGOBHeaderPresent;        /* 1 if GOB header is present.*/
+   
+   int mbType;
+
+
+} dmdPParam_t;
+/* {{-output"dmdPParam_t.txt"}} */
+
+
+/*
+ * Function prototypes
+ */
+
+int dmdGetAndDecodeBOfPBMBBlocks(
+   dmdBOfPBParam_t *param);
+
+int dmdGetAndDecodeIMBBlocks(
+   dmdIParam_t *param, CMPEG4Transcoder *hTranscoder);
+
+int dmdGetAndDecodePMBBlocks(
+   dmdPParam_t *param, CMPEG4Transcoder *hTranscoder);
+
+int dmdGetAndDecodeAdvIMBBlocks(
+   dmdIParam_t *inpParam);
+
+/*** MPEG-4 REVISION ***/
+int dmdGetAndDecodeMPEGPMBBlocks(
+   dmdPParam_t *param, CMPEG4Transcoder *hTranscoder);
+
+int dmdGetAndDecodeMPEGIMBBlocks(
+   dmdMPEGIParam_t *param, CMPEG4Transcoder *hTranscoder);
+/*** End MPEG-4 REVISION ***/
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/decmbs.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for multiple macroblock decoding module.
+*
+*/
+
+
+
+#ifndef _DECMBS_H_
+#define _DECMBS_H_
+
+/*
+ * Includes
+ */
+
+#include "decmb.h"
+
+
+/*
+ * Defines
+ */
+
+// unify error codes
+#define DMBS_OK H263D_OK
+#define DMBS_ERR H263D_ERROR
+
+
+/*
+ * Function prototypes
+ */
+
+int dmbsGetAndDecodeIMBsInScanOrder(
+   const dmbIFrameMBInParam_t *inParam,
+   dmbIFrameMBInOutParam_t *inOutParam,
+   int *quant, CMPEG4Transcoder *hTranscoder);
+
+int dmbsGetAndDecodePMBsInScanOrder(
+   const dmbPFrameMBInParam_t *inParam,
+   dmbPFrameMBInOutParam_t *inOutParam,
+   int *quant, CMPEG4Transcoder *hTranscoder);
+
+int dmbsGetAndDecodeIMBsDataPartitioned(
+   dmbIFrameMBInParam_t *inParam,
+   dmbIFrameMBInOutParam_t *inOutParam,
+   int *quantParams, CMPEG4Transcoder *hTranscoder);
+
+int dmbsGetAndDecodePMBsDataPartitioned(
+   const dmbPFrameMBInParam_t *inParam,
+   dmbPFrameMBInOutParam_t *inOutParam,
+   int *quantParams, CMPEG4Transcoder *hTranscoder);
+   
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/decpich.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for picture header decoding functions.
+*
+*/
+
+
+
+
+#ifndef _DECPICH_H_
+#define _DECPICH_H_
+
+/*
+ * Includes
+ */
+
+#include "core.h"
+
+#include "biblin.h"
+
+
+/*
+ * Defines
+ */
+
+// unify error codes
+#define DPH_OK            H263D_OK  /* everything ok */
+
+#define DPH_OK_BUT_BIT_ERROR     H263D_OK_BUT_BIT_ERROR  /* bitstream corruption was detected */
+#define DPH_OK_BUT_NOT_CODED     H263D_OK_BUT_NOT_CODED  /* the VOP is not_coded: no video data sent, 
+                                       only the timestamp -> skip the frame */
+#define DPH_ERR         H263D_ERROR /* a general error */
+#define DPH_ERR_NO_INTRA H263D_ERROR_NO_INTRA /* no INTRA frame has been received */
+#define DPH_ERR_FORMAT_CHANGE H263D_ERROR /* picture size change in bitstream */
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* {{-output"dphInParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the dphGetPictureHeader function.
+   {{-output"dphInParam_t_info.txt"}} */
+
+/* {{-output"dphInParam_t.txt"}} */
+typedef struct {
+   int numStuffBits;             /* Number of stuffing bits before PSC */
+   int fReadBits;                /* 0, if picture header should not be read (use previous 
+                                    picture header but decode it using dphGetPictureHeader) */
+   int fNeedDecodedFrame;                                    
+} dphInParam_t;
+/* {{-output"dphInParam_t.txt"}} */
+
+
+/* {{-output"dphInOutParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the dphGetPictureHeader function. The function may modify
+   the parameters (or the structures pointed by the parameters).
+   {{-output"dphInOutParam_t_info.txt"}} */
+
+/* {{-output"dphInOutParam_t.txt"}} */
+typedef struct {
+   vdcInstance_t *vdcInstance;   /* Video Decoder Core instance */
+   bibBuffer_t *inBuffer;        /* Bit Buffer instance */
+   bibBuffer_t *outBuffer;        /* Out Bit Buffer instance data */
+
+
+} dphInOutParam_t;
+/* {{-output"dphInOutParam_t.txt"}} */
+
+
+/* {{-output"dphOutParam_t_info.txt" -ignore"*" -noCR}}
+   The dphGetPictureHeader function uses this structure to return
+   output parameters.
+   {{-output"dphOutParam_t_info.txt"}} */
+
+/* {{-output"dphOutParam_t.txt"}} */
+typedef struct {
+   int pquant;                   /* Initial quantizer */
+   int trp;                      /* Temporal Reference for Prediction,
+                                    -1 if not indicated in the bitstream */
+   u_char *currYFrame;           /* Memory buffer for new Y frame */
+   u_char *currUFrame;           /* Memory buffer for new U frame */
+   u_char *currVFrame;           /* Memory buffer for new V frame */
+   u_char *currYBFrame;          /* New Y frame of B part of PB-frame */
+   u_char *currUBFrame;          /* New U frame of B part of PB-frame */
+   u_char *currVBFrame;          /* New V frame of B part of PB-frame */
+} dphOutParam_t;
+/* {{-output"dphOutParam_t.txt"}} */
+
+
+/*
+ * Function prototypes
+ */
+
+int dphGetPictureHeader(
+   const dphInParam_t *inParam,
+   dphInOutParam_t *inOutParam,
+   dphOutParam_t *outParam,
+   int *bitErrorIndication);
+
+int dphGetSEI(
+   vdcInstance_t *vdcInstance,   /* Video Decoder Core instance */
+   bibBuffer_t *inBuffer,        /* Bit Buffer instance */
+   int *bitErrorIndication);
+
+class CMPEG4Transcoder;
+int dphGetMPEGVolHeader(dphInOutParam_t *inOutParam, CMPEG4Transcoder *hTranscoder);
+
+int dphGetMPEGVopHeader(
+   const dphInParam_t *inParam,
+   dphInOutParam_t *inOutParam,
+   dphOutParam_t *outParam,
+   int *bitErrorIndication);
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/decvp_mpeg.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for Video packet decoding module.
+*
+*/
+
+
+
+#ifndef _DECVP_MPEG_H_
+#define _DECVP_MPEG_H_
+
+#include "core.h"
+#include "vdcmvc.h"
+#include "vdeims.h"
+
+
+/*
+ * Defines
+ */
+
+// unify error codes
+#define DGOB_OK_BUT_FRAME_USELESS H263D_OK_BUT_FRAME_USELESS
+#define DGOB_OK_BUT_BIT_ERROR H263D_OK_BUT_BIT_ERROR
+#define DGOB_OK     H263D_OK
+#define DGOB_ERR    H263D_ERROR
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* {{-output"dvpMarkVPCompleted_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass parameters to
+   the dvpMarkVPCompleted function.
+   {{-output"dvpMarkVPCompleted_t_info.txt"}} */
+
+/* {{-output"dvpMarkVPCompleted_t.txt"}} */
+typedef struct {
+   int numMBsInVP;               /* Number of macroblocks within the VP */
+
+   int xPosInMBs;                /* x position of the first MB in the VP */
+
+   int yPosInMBs;                /* y position of the first MB in the VP */
+
+   int widthInMBs;               /* Image width in macroblocks */
+
+   int fSegmentCorrupted;        /* Non-zero if the reported GOBs are 
+                                    corrupted. Otherwise zero. */
+
+
+} dvpMarkVPCompleted_t;
+/* {{-output"dvpMarkVPCompleted_t.txt"}} */
+
+
+/* {{-output"dvpVPInParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the dvpGetAndDecodeVideoPacketHeader and 
+   dvpGetAndDecodeVideoPacketContents functions.
+   {{-output"dvpVPInParam_t_info.txt"}} */
+
+/* {{-output"dvpVPInParam_t.txt"}} */
+typedef struct {
+
+   vdcPictureParam_t *pictParam; /* Picture attributes */
+
+   bibBuffer_t *inBuffer;        /* Bit Buffer instance */
+
+   bibBuffer_t *outBuffer;        /* Out Bit Buffer instance data */
+
+   bibBufferEdit_t *bufEdit; 
+   int iColorEffect; 
+   TBool iGetDecodedFrame;
+
+   u_char fVOPHeaderCorrupted;   /* If non-zero, the VOP header was detected
+                                    to be erronous and the HEC information is
+                                    used for updating */
+
+} dvpVPInParam_t;
+/* {{-output"dvpVPInParam_t.txt"}} */
+
+
+/* {{-output"dvpVPInOutParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the dvpGetAndDecodeVideoPacketHeader and dvpGetAndDecodeVideoPacketContents
+   functions. The functions may modify the parameters (or the structures
+   pointed by the parameters).
+   {{-output"dvpVPInOutParam_t_info.txt"}} */
+
+/* {{-output"dvpVPInOutParam_t.txt"}} */
+typedef struct {
+    
+   int currMBNum;                /* the number of the next expected MB to decode */
+
+   int frameNum;                 /* the calculated frame number */
+
+   int quant;                    /* QP for the next MB */
+
+   u_char *fCodedMBs;            /* array for coded macroblock flags in
+                                    scan-order, 1 = coded, 0 = not coded */
+
+   int numOfCodedMBs;            /* number of coded macroblocks */
+
+   int *quantParams;             /* array of quantization parameters for
+                                    macroblocks in scan-order */
+
+   mvcData_t *mvcData;           /* Motion Vector Count module instance data */
+
+   aicData_t *aicData;           /* Advanced Intra Coding module instance data */
+
+   vdeIms_t *imageStore;         /* VDE Image Store instance data */
+
+   u_char *refY;                 /* Reference frame */
+   u_char *refU;
+   u_char *refV;
+
+   u_char *currPY;               /* Current P (or I) frame */
+   u_char *currPU;
+   u_char *currPV;
+
+	 /* MVE */
+   int StartByteIndex;
+	 int StartBitIndex;
+
+} dvpVPInOutParam_t;
+/* {{-output"dvpVPInOutParam_t.txt"}} */
+
+/*
+ * Functions prototypes
+ */
+
+int dvpGetAndDecodeVideoPacketHeader(
+   const dvpVPInParam_t *inParam,
+   dvpVPInOutParam_t *inOutParam);
+
+int dvpGetAndDecodeVideoPacketContents(
+   const dvpVPInParam_t *inParam,
+   int fGetNewReferenceFrame,
+   dvpVPInOutParam_t *inOutParam, CMPEG4Transcoder *hTranscoder);
+
+int dvpMarkVPCompleted(dvpMarkVPCompleted_t *inParam);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/dlist.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for generic list handling services
+* for doubly linked lists.
+*
+*/
+
+
+#ifndef _DLIST_H_
+#define _DLIST_H_
+
+/*
+ * Includes
+ */
+
+#include "list.h"
+
+
+/*
+ * Defines
+ */
+
+#define DLST_ITEM_SKELETON \
+   LST_ITEM_SKELETON \
+   void *prev;
+
+
+/*
+ * Typedefs
+ */
+
+/* A skeleton of a list item type. 
+   Each real list item type must include these definitions in the beginning 
+   of the structure. This structure has no use as such outside this module. */
+typedef struct dlstListItem_s {
+   DLST_ITEM_SKELETON
+} dlstListItem_t;
+
+/* Doubly-linked list */
+typedef struct {
+   dlstListItem_t *head;
+   dlstListItem_t *curr;
+   dlstListItem_t *tail;
+   int numItems;
+} dlst_t;
+
+
+/*
+ * Function prototypes
+ */
+
+/* Double-linked list functions */
+int dlstOpen(dlst_t *list);
+int dlstClose(dlst_t *list);
+int dlstHead(dlst_t *list, void **item);
+int dlstTail(dlst_t *list, void **item);
+int dlstNext(dlst_t *list, void **item);
+int dlstPrev(dlst_t *list, void **item);
+int dlstCurr(dlst_t *list, void **item);
+int dlstNextExists(dlst_t *list);
+int dlstAddAfterCurr(dlst_t *list, void *item);
+int dlstAddBeforeCurr(dlst_t *list, void *item);
+int dlstRemove(dlst_t *list, void **item);
+#define dlstNumItems(list) ((list)->numItems)
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/epoclib.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for epoclib.cpp.
+*
+*/
+
+
+#ifndef _EPOC_LIB
+#define _EPOC_LIB
+
+#include <e32base.h>
+#include <s32file.h>
+
+#ifdef _DEBUG
+#define MALLOC_DEBUG
+#endif
+
+#define EPOCLIB_DS
+
+//#define FILE RFile
+//#define void TAny
+
+//specific to this program
+//#define HANDLE void *
+
+typedef TUint8   Byte;
+typedef TUint8   u_char;
+typedef TInt8    int8;
+typedef TUint8   u_int8;
+typedef TInt16   int16;
+typedef TUint16  u_int16;
+typedef TInt32   int32;
+typedef TUint32  u_int32;
+typedef TReal32  float32;
+typedef TReal64  float64;
+
+
+typedef unsigned int size_t;  
+
+
+#define max(a,b)            (((a) > (b)) ? (a) : (b))
+#define min(a,b)            (((a) < (b)) ? (a) : (b))
+
+#define abs     Abs
+#define labs    Abs
+
+
+EPOCLIB_DS void free(TAny *ptr);
+
+#ifdef MALLOC_DEBUG
+#define malloc(size) debugMalloc(size, __FILE__, __LINE__)
+EPOCLIB_DS TAny *debugMalloc(u_int32 size, char *file, int line);
+#else
+EPOCLIB_DS TAny *malloc(u_int32 size);
+#endif
+EPOCLIB_DS TAny *realloc(void *memblock, u_int32 size);
+#ifdef MALLOC_DEBUG
+#define calloc(num, size) debugCalloc(num, size, __FILE__, __LINE__)
+EPOCLIB_DS TAny *debugCalloc(u_int32 num, u_int32 size, char *file, int line);
+#else
+EPOCLIB_DS TAny *calloc(u_int32 num, u_int32 size);
+#endif
+EPOCLIB_DS TAny *memset(TAny *dest, TInt c, TInt size); 
+EPOCLIB_DS TAny *memcpy(TAny *dest, const TAny *src, TInt size);
+EPOCLIB_DS TAny *memmove(TAny *dest, const TAny *src, u_int32 count);
+
+#define assert(expr) __ASSERT_DEBUG(expr, User::Panic(_L("assert"), 1));
+EPOCLIB_DS int atoi(const char *nptr);
+
+
+EPOCLIB_DS u_int32 fwrite(const TAny *buffer, u_int32 size, u_int32 count, RFile stream);
+
+#endif
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/errcodes.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Error code definitions.
+*
+*/
+
+
+#ifndef _ERRCODES_H_
+#define _ERRCODES_H_
+
+/*
+ * Defines
+ */
+
+/*
+ * Common errors for VDC and FCC
+ */
+
+#define ERR_COM_NULL_POINTER 100
+
+
+/* 
+ * Bit buffer module errors 
+ */
+
+#define ERR_BIB_STRUCT_ALLOC 1000
+#define ERR_BIB_BUFFER_ALLOC 1001
+#define ERR_BIB_FILE_READ 1002
+#define ERR_BIB_NOT_ENOUGH_DATA 1003
+#define ERR_BIB_ALREADY_OPENED 1004
+#define ERR_BIB_FILE_OPEN 1005
+#define ERR_BIB_ALREADY_CLOSED 1006
+#define ERR_BIB_FILE_CLOSE 1007
+#define ERR_BIB_NUM_BITS 1008
+#define ERR_BIB_FILE_NOT_OPEN 1009
+#define ERR_BIB_ILLEGAL_SIZE 1010
+#define ERR_BIB_CANNOT_REWIND 1011
+#define ERR_BIB_FEC_RELOCK 1050
+
+
+/* 
+ * Variable length code module errors 
+ */
+
+#define ERR_VLC_MCBPC_INTRA 8500
+#define ERR_VLC_CBPY 8501
+#define ERR_VLC_MCBPC_INTER 8502
+#define ERR_VLC_MVD 8503
+
+
+/* 
+ * Motion vector count module errors 
+ */
+
+#define ERR_MVC_ALLOC1 1200
+#define ERR_MVC_ALLOC2 1201
+#define ERR_MVC_NO_PREV_MB 1202
+#define ERR_MVC_NEIGHBOUR_NOT_VALID 1203
+#define ERR_MVC_PREV_NOT_VALID 1204
+#define ERR_MVC_PREV_NOT_CODED 1205
+#define ERR_MVC_PREV_INTRA 1206
+#define ERR_MVC_CURR_NOT_VALID 1207
+#define ERR_MVC_CURR_NOT_CODED 1208
+#define ERR_MVC_CURR_INTRA 1209
+#define ERR_MVC_MVDX_ILLEGAL 1250
+#define ERR_MVC_MODE_ILLEGAL 1251
+#define ERR_MVC_X_ILLEGAL 1252
+#define ERR_MVC_Y_ILLEGAL 1253
+#define ERR_MVC_MAX_X_ILLEGAL 1254
+#define ERR_MVC_TIME_ILLEGAL 1255
+#define ERR_MVC_MVX_ILLEGAL 1256
+#define ERR_MVC_MVY_ILLEGAL 1257
+#define ERR_MVC_MVDY_ILLEGAL 1258
+#define ERR_MVC_MVPTR 1260
+
+
+
+/* 
+ * Block module errors 
+ */
+
+#define ERR_BLC_TCOEF 8504
+#define ERR_BLC_LEVEL 5001
+#define ERR_BLC_TOO_MANY_COEFS 5002
+#define ERR_BLC_MV_OUTSIDE_PICT 5003
+
+
+/* 
+ * Core module errors 
+ */
+
+/* General errors */
+#define ERR_VDC_MEMORY_ALLOC 2080
+#define ERR_VDC_NO_INTRA 2081
+#define ERR_VDC_INITIALIZE 2082
+#define ERR_VDC_CORRUPTED_INTRA 2083
+#define ERR_VDC_UNEXPECTED_FATAL_ERROR 2084
+
+/* Picture Layer errors */
+#define ERR_VDC_PTYPE_BIT1 2048
+#define ERR_VDC_PTYPE_BIT2 2049
+#define ERR_VDC_PTYPE_BIT9_AND_BIT13_MISMATCH 2050
+#define ERR_VDC_SOURCE_FORMAT 2051
+#define ERR_VDC_NO_SIZE 2052
+#define ERR_VDC_ILLEGAL_PQUANT 2053
+#define ERR_VDC_ILLEGAL_TRB 2054
+#define ERR_VDC_ILLEGAL_PSPARE 2055
+#define ERR_VDC_NO_PSC 2056
+#define ERR_VDC_FORMAT_CHANGE 2057
+
+/* Group of Blocks Layer errors */
+#define ERR_VDC_ILLEGAL_GN 2112
+#define ERR_VDC_ILLEGAL_GFID 2113
+#define ERR_VDC_ILLEGAL_GQUANT 2114
+
+
+/* 
+ * Format Conversion Core errors 
+ */
+
+#define ERR_CON_UNKNOWN_MODE 3000
+#define ERR_CON_CLIP_ALLOC 3001
+#define ERR_CON_Y_TOO_LARGE 3002
+#define ERR_CON_DITH_INDEX_ILLEGAL 3003
+#define ERR_CON_GREY256_INDEX_ILLEGAL 3004
+#define ERR_CON_UNKNOWN_BIT_DEPTH 3005
+#define ERR_CON_NULL_PALETTE 3006
+#define ERR_CON_PALETTE_EXISTS 3007
+#define ERR_CON_ALLOC 3008
+#define ERR_CON_NO_CUSTOM_PALETTE 3009
+#define ERR_CON_WIN32_ERROR 3010
+
+#define ERR_CON_OCT_ALLOC 3100
+#define ERR_CON_OCT_NULL_PTR 3101
+#define ERR_CON_OCT_INDEX_EXISTS 3102
+
+#endif
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/h263dapi.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for external usage of the services provided by 
+* the Video Decoder Engine.
+*
+*/
+
+
+#ifndef _H263DAPI_H_
+#define _H263DAPI_H_
+
+#include <e32base.h>
+
+#include "h263dconfig.h"
+#include "h263dext.h"
+#include "h263dntc.h"
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/h263dconfig.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Definitions to port vedh263d to Symbian.
+*
+*/
+
+
+#ifndef _H263DCONFIG_H_
+#define _H263DCONFIG_H_
+
+#include "h263dext.h"
+
+#if !defined(_DEBUG) && !defined(NDEBUG)
+   #define _DEBUG
+#endif
+
+
+
+/* C standard libraries 
+
+   header file    functions/macros/identifiers used
+   ---------------------------------------------------------------------------
+   assert.h       assert
+   string.h       memcpy, memset
+   stdlib.h       NULL, free, malloc, calloc, abs
+   */
+
+#if defined(__SYMBIAN32__)
+#define __EPOC__
+#include "epoclib.h"
+#else
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#endif
+
+/* Memory allocation wrappers for large (> 64 kB) memory chunks.
+   Used in core, block and convert. Needed when compiling in
+   systems with segmented memory (DOS, Windows 3.1) */
+#define HUGE
+#define MEMCPY memcpy
+#define MEMSET memset
+#define MALLOC malloc
+#define FREE free
+
+
+/* core.h */
+#define VDC_INLINE __inline
+
+/* debug */
+/* Controlled from the project settings or makefile */
+
+/* msgwrap etc. */
+#ifndef BUF_DS
+   #define BUF_DS
+#endif
+
+#ifdef __MARM__
+   #define __cdecl
+   #define __stdcall
+#endif
+
+#endif 
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/h263dext.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,278 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* A header file for external usage of the services provided by
+* the Video Decoder Engine.
+*
+*/
+
+
+#ifndef _H263DEXT_H_
+#define _H263DEXT_H_
+
+
+/*
+ * Includes
+ */
+
+//#include "renapi.h"
+#include "epoclib.h"
+
+/*
+ * Defines
+ */
+
+/* _WIN32_EXPLICIT has to be defined before anything else. */
+
+/* Return codes */
+#define H263D_OK_BUT_NOT_CODED   4     /* not coded frame, 
+                                          copied to output as is, 
+                                          no decoded output generated */  
+#define H263D_OK_BUT_BIT_ERROR   3     /* Bit errors detected but frame decoded */
+#define H263D_OK_BUT_FRAME_USELESS \
+                                 2     /* function behaved normally, but no output
+                                          was produced due to too corrupted frame */
+#define H263D_OK_EOS             1     /* End-of-Stream has been reached */
+#define H263D_OK                 0     /* the function was successful */
+#define H263D_ERROR             -1     /* indicates a general error */
+#define H263D_ERROR_NO_INTRA    -2     /* No INTRA frame has been decoded, 
+                                          decoding cannot be started */
+#define H263D_ERROR_HALTED      -3     /* no further decoding possible */
+/* Note: In practice, there is no difference between H263D_ERROR and 
+   H263D_ERROR_HALTED. The caller should react to both error messages
+   in the same way. They both exist due to compatibility with older
+   versions of the decoder. */
+
+
+/* Frame type scope. See h263dFrameType_t (in this file) for descriptions. */
+#define H263D_FTYPE_ALL       0xffffffff
+#define H263D_FTYPE_NDEF      0xffffffff
+#define H263D_FTYPE_DEF       0
+#define H263D_FTYPE_SIZE      0x00000001
+#define H263D_FTYPE_SNAPSHOT  0x00000002
+
+
+/* Mode values used in h263dSetStartOrEndCallback to select if the function
+   scope is in the start of the frame (H263D_CB_START) 
+   or in the end the frame (H263D_CB_END),
+   or both (H263D_CB_START | H263D_CB_END). */
+#define H263D_CB_START     0x00000001
+#define H263D_CB_END       0x00000002
+
+
+/* H.263 Annex N submodes */
+#define H263D_BC_MUX_MODE_SEPARATE_CHANNEL   1  /* Separate Logical Channel 
+                                                   submode*/
+#define H263D_BC_MUX_MODE_VIDEO              2  /* VideoMux submode */
+
+
+/* Error resilience features, see h263dSetErrorResilience for details */
+#define H263D_ERD_FEATURE_STATUS 1
+#define H263D_ERD_FEATURE_CHECK_ALL 2
+#define H263D_ERD_FEATURE_DISCARD_CORRUPTED 3
+
+#define H263D_ERD_INTRA_DCT_DOMAIN 0
+#define H263D_ERD_INTRA_PIXEL_DOMAIN 1
+
+#define H263D_ERD_INTER_NO_MOTION_COMPENSATION 0
+#define H263D_ERD_INTER_MOTION_COMPENSATION 1
+
+
+/* Output types, see h263dSetOutputFile for more information */
+#define H263D_OUT_FILE_MODE_FRAME_BY_FRAME      1
+#define H263D_OUT_FILE_MODE_ONE_PER_COMPONENT   2
+#define H263D_OUT_FILE_MODE_ONE_FOR_ALL         3
+
+
+
+/* Temporal/computational scalability levels, 
+   see h263dSetTemporalScalabilityLevel for more details */
+#define H263D_LEVEL_ALL_FRAMES   0
+#define H263D_LEVEL_INTRA_FRAMES 1
+
+
+/* Calling convention for exported functions */
+#ifndef H263D_CC
+   #define H263D_CC   
+#endif
+
+
+/* Calling convention for callback functions declared in the decoder */
+#ifndef H263D_CALLBACK   
+   #define H263D_CALLBACK
+#endif
+
+
+/* Declaration specifier for exported functions */
+#ifndef H263D_DS
+   #define H263D_DS
+#endif
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* size_t */
+   typedef unsigned int size_t;
+
+
+/* {{-output"h263dHInstance_t_info.txt" -ignore"*" -noCR}}
+   h263dHInstance_t is used as a unique identifier of a H.263 Video Decoder
+   instance.
+   The type can be casted to u_int32 or void pointer and then back to
+   h263dHInstance_t without any problems.
+   {{-output"h263dHInstance_t_info.txt"}} */
+
+/* {{-output"h263dHInstance_t.txt"}} */
+typedef void * h263dHInstance_t;
+/* {{-output"h263dHInstance_t.txt"}} */
+
+
+/* {{-output"h263dFrameType_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to define a frame type scope for some setting
+   functions.
+   Currently, there are three scopes: the default scope (H263D_FTYPE_DEF),
+   the frame size scope (H263D_FTYPE_SIZE) and the snapshot scope 
+   (H263D_FTYPE_SNAPSHOT). If a setting is defined for a particular size, 
+   all frames having that size will be handled according to the setting, 
+   i.e. the frame size scope overrides the default scope. Later on, it may 
+   be possible to add more frame types scopes, like the enchancement layer 
+   number or the snapshot tag (Annex L.8. of the H.263 recommendation). 
+   Then, the scope order must also be defined. For example, if there are 
+   two settings, one for a particular size and one for a particular enhancement 
+   layer. If a frame fulfills both scopes, one has to know which scope has 
+   the priority, e.g. that the frame has to be handled according to the 
+   enchancement layer setting. There can also be a combination of scopes, 
+   e.g. some setting may be defined for a particular frame size and 
+   enhancement layer.
+   {{-output"h263dFrameType_t_info.txt"}} */
+
+/* {{-output"h263dFrameType_t.txt"}} */
+typedef struct {
+   u_int32 scope;       /* the scope of the frame type setting:
+                           H263D_FTYPE_ALL
+                              This setting overrides all previous settings,
+                              i.e. it is valid for all frame types.
+                           H263D_FTYPE_DEF
+                              is used to define a setting for frame types
+                              which do not have a specific setting of their
+                              own.
+                           H263D_FTYPE_SIZE
+                              is used to define a setting for a particular
+                              frame size.
+
+                           H263D_FTYPE_SNAPSHOT
+                              is used to define a setting for snapshot
+                              frames.
+
+                           For internal use only:
+                           H263D_FTYPE_NDEF
+                              is used in querying functions to solve the scope
+                              depending on the parameters which are used.
+                              All parameters must be set.
+                        */
+
+   int width;
+   int height;          /* width and height of the frame which is in the scope
+                           of the setting. These parameters are valid
+                           only if scope indicates H263D_FTYPE_SIZE. */
+   u_char fSnapshot;    /* snapshot flag, valid only if scope is 
+                           H263D_FTYPE_SNAPSHOT */
+} h263dFrameType_t;
+/* {{-output"h263dFrameType_t.txt"}} */
+
+
+/* Used in h263dOpen_t to pass a callback function to call when decoding
+   has to stopped. */
+typedef void (H263D_CALLBACK *h263dDecodingFinishedCallback_t) (void *);
+
+
+
+/* Prototype for callback function related to h263dSetStartOrEndCallback.
+   See the function description for more details. */
+typedef void (H263D_CALLBACK *h263dStartOrEndCallback_t) 
+   (u_int32, u_int32, void *);
+
+/* Prototype for callback function related to h263dSetStartOrEndSnapshotCallback.
+   See the function description for more details. */
+typedef void (H263D_CALLBACK *h263dStartOrEndSnapshotCallback_t) (u_int32, u_int32, void *);
+
+/* Prototype for callback function related to h263dSetReportPictureSizeCallback.
+   See the function description for more details. */
+typedef void (H263D_CALLBACK *h263dReportPictureSizeCallback_t) (void *, int, int);
+                              
+typedef struct {
+   int fExist;          /* 1 or 0 */
+   u_int8 data[255];    /* header data */
+   int length;          /* length of header data */
+} h263dMPEG4Header_t;
+
+/* {{-output"h263dOpen_t_info.txt" -ignore"*" -noCR}}
+   This structure is used with the h263dOpen function to give the necessary
+   data for opening a new H.263 Video Decoder Engine instance.
+   {{-output"h263dOpen_t_info.txt"}} */
+
+/* {{-output"h263dOpen_t.txt"}} */
+typedef struct {
+   int numPreallocatedFrames;    /* Number of preallocated frame memories */
+
+   int lumWidth;                 /* Size of preallocated frame memories */
+   int lumHeight;
+
+   int fRPS;                     /* 1 = Reference Picture Selection mode in use */
+
+   int numReferenceFrames;       /* number of reference frames in RPS mode */
+
+   h263dDecodingFinishedCallback_t decodingFinishedCallback;
+                                 /* callback function to call when no data has
+                                    been decoded for a while */
+
+   int decodingFinishedIdleTimeInMSec;
+                                 /* number of milliseconds to go by until
+                                    decodingFinishedCallback is called */
+
+   h263dMPEG4Header_t mpeg4Header;
+                                 /* MPEG-4 header received via H.245 */
+
+   size_t freeSpace;             /* Used internally */
+} h263dOpen_t;
+/* {{-output"h263dOpen_t.txt"}} */
+
+
+/*
+ * Function prototypes
+ */
+
+H263D_DS int H263D_CC h263dFree(
+   void);
+
+H263D_DS int H263D_CC h263dLoad(
+   void);
+
+H263D_DS int H263D_CC h263dSetStartOrEndCallback(
+   h263dHInstance_t hInstance,
+   u_int32 mode, 
+   h263dFrameType_t *frameType,
+   h263dStartOrEndCallback_t callback, 
+   u_int32 param);
+
+
+H263D_DS int H263D_CC h263dSetReportPictureSizeCallback(
+   h263dHInstance_t hInstance, 
+   h263dReportPictureSizeCallback_t callback);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/h263dmai.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* A header file defining the h.263 decoder API.               
+*
+*/
+
+
+#ifndef H263DMAIN_H
+#define H263DMAIN_H
+
+#include <e32base.h>
+
+
+/*
+ * Structs and typedefs
+ */
+/* This structure is used to indicate the operating mode. */
+
+/* Time change for merging MPEG-4 clips */
+typedef struct MPEG4TimeParameter
+{
+    int modulo_time_base;       /* the time base of the video clip representing one second of duration */
+    int time_inc;           /* the time increment from the synchronization point marked by modulo_time_base */
+} tMPEG4TimeParameter;
+
+/* Editing parameters passed to decoder for compressed domain editing */
+typedef struct 
+{
+  TInt aColorEffect;	  /* special color effect (None/B&W/ColorTone) */
+  TInt aColorToneU;       /* color tone value for U */
+  TInt aColorToneV;       /* color tone value for V */
+  TBool aGetVideoMode;    /* true if we need to get mode information from VOL */
+  TBool fModeChanged;     /* true if bitstream mode needs to be changed (transcoding needed within MPEG-4) */ 
+  TBool fHaveDifferentModes;  /* true if different MPEG-4 modes exist within movie */
+  TBool aGetDecodedFrame; /* true if we need to return fully decoded frame */
+  TInt aFrameOperation;   /* type of decoding operation neded: 1=EDecodeAndWrite,2=EDecodeNoWrite, 3=EWriteNoDecode */
+  TInt aVideoClipNumber;  /* the index number of the video clip that this frame is part of */
+  TInt aSMSpeed;          /* slow motion speed (25-100) */
+
+  TInt *aTrP;             /* time increment value of previous frame */
+  TInt *aTrD;             /* time duration of previous frame */
+  tMPEG4TimeParameter * aMPEG4TimeStamp; /* time stamp of MPEG-4 frame */
+  TInt aMPEG4DurationInMs;               /* time duration of MPEG-4 frame in millisec */
+  TInt *aMPEG4TargetTimeResolution; /* time increment resolution of output video - returned from the decoder */
+  TInt aFirstFrameQp;       /* QP of first frame, used for MPEG4 color toning */
+
+  TInt aOutputVideoFormat;  /* video format of output movie */
+  TInt iTimeIncrementResolution;  /* time increment resolution for current frame, if MPEG-4 */
+  TInt vosHeaderSize;       /* VOS header size for current clip, if MPEG-4 */
+  TInt streamMode;          /* current bitstream mode (data partition, regular, etc.) */
+
+}vdeDecodeParamters_t;
+
+/*
+ * Classes 
+ */
+class MVideoRenderer;
+
+/**
+*  CVedH263Dec abstract class for H.263 decoder
+*
+*  @lib vedh263d
+*  @since
+*/
+class CVedH263Dec : public CBase
+    {
+
+    public:  // Constants
+
+        // post-filter type
+        enum TPostFilter
+        {
+            ENoFilter = 0,
+            EH263AnnexJFilter,
+            EH263TMNFilter,
+            ENokiaFilter
+        };
+        
+        // color effect
+        enum TColorEffect
+        {
+            EColorEffectNone = 0,
+            EColorEffectBlackAndWhite = 1,
+            EColorEffectToning = 2        // ColorToning feature
+        }; 
+
+        // error codes
+        enum TErrorCode
+        {
+            EInternalAssertionFailure = -10000,
+            EDecoderFailure = -10001,
+            EDecoderNoIntra = -10002,
+            EDecoderCorrupted = -10003
+        };
+
+
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @aFrameSize Indicates the size of the input frames which will be decoded
+        * @aNumReferencePictures indicates the number of reference pictures 
+        */
+
+        IMPORT_C static CVedH263Dec* NewL(const TSize aFrameSize, const TInt aNumReferencePictures);
+
+    public:  // new functions        
+
+        /**
+        * Sets the renderer object to be used
+        * @since
+        * @param aRenderer Pointer to the renderer object
+        * @return void
+        */
+        virtual void SetRendererL(MVideoRenderer* aRenderer) = 0;
+
+        /**
+        * Sets the post-filter to be used in decoding
+        * @since
+        * @param aFilter filter to be used
+        * @return void
+        */
+        virtual void SetPostFilterL(const TPostFilter aFilter) = 0;
+
+        /**
+        * Checks if the given frame contains valid data which can be displayed
+        * @since
+        * @param aFrame Frame to be checked
+        * @return TBool ETrue if frame is valid
+        */
+        virtual TBool FrameValid(const TAny* aFrame) = 0;
+
+        /**
+        * Retrieves pointers to Y/U/V data for the given frame
+        * @since
+        * @param aFrame Pointer to the frame
+        * @param aYFrame top-left corner of the Y frame 
+        * @param aUFrame top-left corner of the U frame
+        * @param aVFrame top-left corner of the V frame
+        * @param aFrameSize
+        * @return TInt error code
+        */
+        virtual TInt GetYUVBuffers(const TAny* aFrame, TUint8*& aYFrame, TUint8*& aUFrame,          
+            TUint8*& aVFrame, TSize& aFrameSize) = 0;
+
+        /**
+        * Returns the given output frame to the decoder after it is not needed
+        * @since
+        * @param aFrame Frame to be returned
+        * @return void
+        */
+        virtual void FrameRendered(const TAny* aFrame) = 0;
+
+        /**
+        * Gets a pointer the latest decoded frame (YUV concatenated)
+        * @since
+        * @param aFrame Frame to be returned
+        * @return TUint8* pointer to the frame
+        */
+        virtual TUint8* GetYUVFrame() = 0;
+
+        /**
+        * Decodes / transcodes a compressed frame
+        * @since
+        * @param aInputBuffer Descriptor for the input bitstream buffer
+        * @param aOutputBuffer Descriptor for the output bitstream buffer
+        * @param aFirstFrame Flag (input/output) for the first frame, non-zero if the first frame is being decoded
+        * @param aBytesDecoded Number of bytes that were decoded to produce the output frame                
+        * @param aColorEffect Color effect to be applied 
+        * @param aGetDecodedFrame ETrue if the output frame needs to be retrieved from the decoder later
+        * @param aFrameOperation Operation to be performed: 1=EDecodeAndWrite,2=EDecodeNoWrite, 3=EWriteNoDecode
+        * @param aTrP 
+        * @param aTrD
+        * @param aVideoClipNumber Number of the video clip
+        * @param aSMSpeed Slow motion speed, max = 1000
+        * @param aDecoderInfo pointer to editing param struct
+		* @param aDataFormat Format of input/output data: 1 = H.263, 2 = MPEG-4
+        * @return void
+        */
+
+        virtual void DecodeFrameL(const TPtrC8& aInputBuffer, TPtr8& aOutputBuffer,
+                                  TBool& aFirstFrame, TInt& aBytesDecoded, 
+                                  vdeDecodeParamters_t *aDecoderInfo) = 0;      
+
+        virtual void DecodeFrameL(const TPtrC8& aInputBuffer, TPtr8& aOutputBuffer,
+                                  TBool& aFirstFrame, TInt& aBytesDecoded, 
+                                  const TColorEffect aColorEffect,
+                                  const TBool aGetDecodedFrame, TInt aFrameOperation,
+                                  TInt* aTrP, TInt* aTrD, TInt aVideoClipNumber, TInt aSMSpeed, 
+                                  TInt aDataFormat) = 0;
+        
+        
+        /**
+        * Decodes a compressed frame
+        * @since
+        * @param aInputBuffer Descriptor for the input bitstream buffer
+        * @param aFirstFrame Flag for the first frame, non-zero if the first frame is being decoded
+        * @param aBytesDecoded Number of bytes that were decoded to produce the output frame        
+		* @param aDataFormat Format of input/output data: 1 = H.263, 2 = MPEG-4
+        * @return void
+        */
+        virtual void DecodeFrameL(const TPtrC8& aInputBuffer, TBool& aFirstFrame, TInt& aBytesDecoded, 
+                    TInt aDataFormat) = 0;
+
+        /**
+        * Check the VOS header of one frame
+        * @since
+        * @param aInputBuffer Descriptor for the input bitstream buffer
+        * @return TBool ETrue the buffer is changed
+        */
+        virtual TBool CheckVOSHeaderL(TPtrC8& aInputBuffer) = 0;
+
+};
+
+/**
+*  MVideoRenderer Renderer interface for the H.263 decoder
+*
+*  @lib vedh263d
+*  @since
+*/
+
+class MVideoRenderer
+{
+
+public:    
+    virtual TInt RenderFrame(TAny* aFrame) = 0;
+
+};
+
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/h263dntc.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Header for control interface for threadless video decoder.
+*
+*/
+
+
+
+#ifndef _H263DNTC_H_
+#define _H263DNTC_H_
+
+
+/* 
+ * Includes
+ */
+
+#include "h263dext.h"
+#include "h263dmai.h"
+
+/*
+ * Function prototypes
+ */
+
+H263D_DS void H263D_CC h263dClose(h263dHInstance_t hInstance);
+
+H263D_DS int H263D_CC h263dDecodeFrameL(
+   h263dHInstance_t hInstance,
+   void *pStreamBuffer,
+   void *pOutStreamBuffer,
+   unsigned streamBufferSize,
+   u_char *fFirstFrame,
+   TInt *frameSize,
+   TInt *outframeSize,   
+   vdeDecodeParamters_t *aDecoderInfo);
+
+int H263D_CC h263dGetLatestFrame(
+   h263dHInstance_t hInstance,
+   u_char **ppy, u_char **ppu, u_char **ppv,
+   int *pLumWidth, int *pLumHeight,
+   int *pFrameNum);
+
+H263D_DS int H263D_CC h263dIsPB(
+   h263dHInstance_t hInstance,
+   void *frameStart,
+   unsigned frameLength);
+
+H263D_DS int H263D_CC h263dIsIntra(
+   h263dHInstance_t hInstance,
+   void *frameStart,
+   unsigned frameLength);
+
+H263D_DS h263dHInstance_t H263D_CC h263dOpen(h263dOpen_t *openParam);
+
+int GetNewTrValue(int aTrCurOrig, int* aTrPrevNew, int* aTrPrevOrig, int aSMSpeed);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/idct.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Inverse Discrete Cosine Transform (IDCT) module header.
+*
+*/
+
+
+#ifndef _IDCT_H_
+#define _IDCT_H_
+
+/*
+ * Function prototypes
+ */
+
+void init_idct(void);
+void idct(int *block);
+
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/list.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for list.cpp.
+*
+*/
+
+
+#ifndef _LIST_H_
+#define _LIST_H_
+
+
+/*
+ * Defines
+ */
+
+#define LST_ITEM_SKELETON \
+   void *next;
+
+/*
+ * Typedefs
+ */
+
+/* A skeleton of a list item type. 
+   Each real list item type must include these definitions in the beginning 
+   of the structure. This structure has no use as such outside this module. */
+typedef struct lstListItem_s {
+   void *next;
+} lstListItem_t;
+
+/* FIFO list */
+typedef struct {
+   lstListItem_t *head;
+   lstListItem_t *tail;
+   int numItems;
+} fifo_t;
+
+/* LIFO list (stack) */
+typedef struct {
+   lstListItem_t *head;
+} lifo_t;
+
+/* General linked list */
+typedef struct {
+   lstListItem_t *head;
+   lstListItem_t *prev;
+   lstListItem_t *curr;
+   int numItems;
+} lst_t;
+
+
+/*
+ * Function prototypes
+ */
+
+/* FIFO list functions */
+int fifoOpen(fifo_t *list);
+int fifoClose(fifo_t *list);
+int fifoPut(fifo_t *list, void *item);
+int fifoGet(fifo_t *list, void **item);
+int fifoPeek(fifo_t *list, void **item);
+#define fifoNumItems(list) ((list)->numItems)
+
+/* LIFO list functions */
+int lifoOpen(lifo_t *list);
+int lifoClose(lifo_t *list);
+int lifoPut(lifo_t *list, void *item);
+int lifoGet(lifo_t *list, void **item);
+
+/* General linked list functions */
+int lstOpen(lst_t *list);
+int lstClose(lst_t *list);
+int lstHead(lst_t *list, void **item);
+int lstTail(lst_t *list, void **item);
+int lstEnd(lst_t *list);
+int lstCurr(lst_t *list, void **item);
+int lstNext(lst_t *list, void **item);
+int lstNextExists(lst_t *list);
+int lstAdd(lst_t *list, void *item);
+int lstRemove(lst_t *list, void **item);
+#define lstNumItems(list) ((list)->numItems)
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/mpegcons.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Definition of constants used in MPEG-4 bitstream decoding.
+*
+*/
+
+
+#ifndef _MPEGCONS_H_
+#define _MPEGCONS_H_
+
+#include "epoclib.h"
+
+/*
+ * Defines
+ */
+
+/* end of bitstream code 
+   inserted by the decoder if no new input buffer is got (bibNewBuffer()) */
+ 
+#define MP4_EOB_CODE                0x1B1
+#define MP4_EOB_CODE_LENGTH         32
+
+/* session layer and vop layer start codes */
+ 
+#define MP4_VOS_START_CODE          0x1B0
+#define MP4_VOS_START_CODE_LENGTH   32
+
+#define MP4_VO_START_CODE           0x1B5
+#define MP4_VO_START_CODE_LENGTH    32
+
+#define MP4_VID_START_CODE          0x8
+#define MP4_VID_START_CODE_LENGTH   27
+#define MP4_VID_ID_CODE_LENGTH      5
+ 
+#define MP4_VOL_START_CODE          0x12  
+#define MP4_VOL_START_CODE_LENGTH   28
+#define MP4_VOL_ID_CODE_LENGTH      4
+ 
+#define MP4_GROUP_START_CODE        0x1B3
+#define MP4_GROUP_START_CODE_LENGTH 32     
+ 
+#define MP4_VOP_START_CODE          0x1B6 
+#define MP4_VOP_START_CODE_LENGTH   32
+
+#define MP4_USER_DATA_START_CODE    0x1B2
+ 
+/* motion and resync markers used in error resilient mode  */
+ 
+#define MP4_DC_MARKER                 438273
+#define MP4_DC_MARKER_LENGTH          19
+ 
+#define MP4_MOTION_MARKER_COMB        126977
+#define MP4_MOTION_MARKER_COMB_LENGTH 17
+ 
+#define MP4_RESYNC_MARKER             1
+#define MP4_RESYNC_MARKER_LENGTH      17
+ 
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/renapi.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* A header file for external usage of the services provided by
+* the Video Renderer engine.
+*
+*/
+
+
+#ifndef _RENAPI_H_
+#define _RENAPI_H_
+
+/*
+ * Includes
+ */
+
+
+
+
+/*
+ * Defines
+ */
+
+/* Return values */
+#define REN_ERROR_BAD_IMAGE_SIZE -4
+#define REN_ERROR_BAD_FORMAT -3
+#define REN_ERROR_HALTED -2
+#define REN_ERROR -1
+#define REN_OK 1
+#define REN_OK_PLAYING_COMPLETE 2
+#define REN_OK_RESOURCE_LEAK 3
+
+/* Defines for the flags member of renExtDrawParam_t */
+#define REN_EXTDRAW_NEW_SOURCE 1
+#define REN_EXTDRAW_COPY_NOT_CODED 2
+#define REN_EXTDRAW_NO_STATUS_CALLBACK 32
+
+
+
+/*
+ * Structs and typedefs
+ */
+
+
+
+
+/* {{-output"renbmihi.txt" -ignore"*" -noCR}}
+   renBitmapInfoHeader_t is used to store the header information of
+   (device-independent) bitmaps such as individual video frames.
+   {{-output"renbmihi.txt"}} */
+
+/* {{-output"renbmiht.txt"}} */
+
+typedef struct {
+   u_int32 biSize;
+   int32 biWidth;
+   int32 biHeight;
+   u_int32 biSizeImage;
+} renBitmapInfoHeader_t;
+/* {{-output"renbmiht.txt"}} */
+
+
+
+
+/* {{-output"renExtDrawParam_t_info.txt" -ignore"*" -noCR}}
+   renExtDrawParam_t is used in a renDrawItem_t structure to provide
+   additional information which cannot be included in a renDrawParam_t
+   structure.
+   {{-output"renExtDrawParam_t_info.txt"}} */
+
+/* {{-output"renExtDrawParam_t.txt"}} */
+typedef struct {
+   u_int32 size;        /* The size of this structure in bytes,
+                           if 0, no macroblock information is used
+                           and the whole frame is converted */
+
+   u_int32 flags;       /* REN_EXTDRAW_NEW_SOURCE = use this frame as
+                           a new source for macroblock copying
+                           (for subsequent frames until a new source
+                           frame appears),
+                           REN_EXTDRAW_COPY_NOT_CODED = use copying of
+                           not coded macroblocks from the source frame,
+                           REN_EXTDRAW_SNAPSHOT = mark this frame as
+                           a snapshot
+                           REN_EXTDRAW_NO_STATUS_CALLBACK = no status callback
+                           function is called after this frame has been
+                           processed
+                           */
+
+   u_int32 rate;        /* Frames / second = rate / scale, */
+   u_int32 scale;       /* These values replace the current values and affect
+                           the subsequent frames. */
+
+   /* The values in this section are valid only if
+      the REN_EXTDRAW_COPY_NOT_CODED flag is on. */
+   int numOfMBs;        /* The number of macroblocks (16 x 16 blocks) in the
+                           frame. */
+   int numOfCodedMBs;   /* The number of coded macroblocks in the frame
+                           (compared to the previous reference frame) */
+   u_char *fCodedMBs;   /* one-dimensional array of u_char
+                           flags indicating if the corresponding macroblock
+                           in the normal scan-order is coded (1) or not (0) */
+
+} renExtDrawParam_t;
+/* {{-output"renExtDrawParam_t.txt"}} */
+
+
+#define RENDRAWPARAM_NOSTATUSCALLBACK 0x00000001L
+                           /* Do not call the status callback function after
+                              the processing of this frame */
+
+/* {{-output"renDrawParam_t_info.txt" -ignore"*" -noCR}}
+   renDrawParam_t contains parameters for drawing video data to the screen.
+   This structure is used with the renDraw function.
+   renDrawParam_t is compatible with the ICDRAW type introduced by
+   the Win32 Video Compression Manager. The lpData member of renBasicDrawParam_t
+   must point to an address where the upper-left corner pixel of the Y frame
+   to be shown lies. The Y frame data must be in scanning order. The U frame
+   data must follow the Y frame data in scanning order, and similarly
+   the V frame data must follow the U frame data.
+   {{-output"renDrawParam_t_info.txt"}} */
+
+/* {{-output"renDrawParam_t.txt"}} */
+typedef struct {
+   u_int32 dwFlags;     /* Flags */
+   void *lpFormat;      /* Pointer to a renBitmapInfoHeader_t structure */
+   void *lpData;        /* Address of the data to render */
+   u_int32 cbData;      /* Ignored */
+   int32 lTime;         /* The frame number telling the time when this frame
+                           should be drawn */
+} renDrawParam_t;
+/* {{-output"renDrawParam_t.txt"}} */
+
+
+
+/* {{-output"renDrawItem_t_info.txt" -ignore"*" -noCR}}
+   renDrawItem_t contains parameters for drawing video image to the screen.
+   In addition, it holds the returning information for the image.
+   This structure is used with the renDraw function.
+   {{-output"renDrawItem_t_info.txt"}} */
+
+/* {{-output"renDrawItem_t.txt"}} */
+typedef struct {
+   renDrawParam_t param;
+                        /* Basic, ICDRAW compatible parameters */
+
+   renExtDrawParam_t extParam;
+                        /* Extended parameters */
+
+} renDrawItem_t;
+/* {{-output"renDrawItem_t.txt"}} */
+
+
+
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/rendri.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* A header file for the draw item abstract data type.
+*
+*/
+
+
+#ifndef _RENDRI_H_
+#define _RENDRI_H_
+
+
+/*
+ * Includes
+ */
+
+#include "renapi.h"
+
+
+/*
+ * Macros
+ */
+
+/* {{-output"renDriMacros.txt"}} */
+/*
+ * The following macros return a specific feature of the draw item
+ * passed as a parameter.
+ *
+ *
+ * renDriNewSourceFlag
+ *    returns 1, if the draw item is a new source for macroblock copying,
+ *    otherwise, it returns 0,
+ *    see REN_EXTDRAW_NEW_SOURCE in renExtDrawParam_t
+ *
+ * renDriCopyNotCodedFlag
+ *    returns 1, if the draw item contains not-coded macroblock info,
+ *    otherwise, it returns 0,
+ *    see REN_EXTDRAW_COPY_NOT_CODED in renExtDrawParam_t
+ *
+ * renDriSnapshotFlag
+ *    returns 1, if the draw item is marked as a snapshot,
+ *    otherwise, it returns 0,
+ *    see REN_EXTDRAW_SNAPSHOT in renExtDrawParam_t
+ *
+ * renDriFreezeReleaseFlag
+ *    returns 1, if the draw item ends picture freezing,
+ *    otherwise, it returns 0,
+ *    see REN_EXTDRAW_SNAPSHOT in renExtDrawParam_t
+ *
+ * renDriNoStatusCallbackFlag
+ *    returns 1, if no status callback is called after this draw item is,
+ *    processed, 
+ *    otherwise, it returns 0,
+ *    see REN_EXTDRAW_NO_STATUS_CALLBACK in renExtDrawParam_t
+ *
+ * renDriRate
+ *    returns the rate parameter of renExtDrawParam_t
+ *
+ * renDriScale
+ *    returns the scale parameter of renExtDrawParam_t
+ *
+ * renDriCodedMBs
+ *    returns a pointer to an unsigned char array of flags of coded MBs,
+ *    the array is indexed by scan-ordered macroblock index,
+ *    1 means that the corresponding macroblock is coded,
+ *    0 means that the corresponding macroblock is not coded
+ *
+ * renDriNumOfMBs
+ *    returns the number of macroblocks in the draw item
+ *
+ * renDriNumOfCodedMBs
+ *    returns the number of coded macroblocks in the draw item
+ *
+ * renDriBitmapWidth
+ *    returns the width of the bitmap to be displayed (in pixels)
+ *
+ * renDriBitmapHeight
+ *    returns the height of the bitmap to be displayed (in pixels)
+ *
+ * renDriBitmapImageSize
+ *    returns the size of the bitmap to be displayed (in bytes)
+ *
+ * renDriBitmapCompression
+ *    returns the compression ID number of the draw item
+ *
+ * renDriFrameNumber
+ *    returns the frame number of the draw item 
+ *    (the lTime Parameter of renDrawParam_t)
+ *
+ * renDriRetFrame
+ *    returns the pointer to the function where to return the processed draw
+ *    item (the retFrame param of renDrawItem_t)
+ *
+ * renDriRetFrameParam
+ *    returns the parameter to pass to the function where to return
+ *    the processed draw item (the retFrameParam of renDrawItem_t)
+ *
+ */
+
+#define renDriNewSourceFlag(drawItem) \
+   (((drawItem)->extParam.flags & REN_EXTDRAW_NEW_SOURCE) > 0)
+
+#define renDriCopyNotCodedFlag(drawItem) \
+   (((drawItem)->extParam.flags & REN_EXTDRAW_COPY_NOT_CODED) > 0)
+
+#define renDriRate(drawItem) \
+   ((drawItem)->extParam.rate)
+
+#define renDriCodedMBs(drawItem) \
+   ((drawItem)->extParam.fCodedMBs)
+
+#define renDriNumOfMBs(drawItem) \
+   ((drawItem)->extParam.numOfMBs)
+
+#define renDriNumOfCodedMBs(drawItem) \
+   ((drawItem)->extParam.numOfCodedMBs)
+
+#define renDriBitmapWidth(drawItem) \
+   (((renBitmapInfoHeader_t *) ((drawItem)->param.lpFormat))->biWidth)
+
+#define renDriBitmapHeight(drawItem) \
+   (labs(((renBitmapInfoHeader_t *) ((drawItem)->param.lpFormat))->biHeight))
+
+#define renDriBitmapImageSize(drawItem) \
+    (((renBitmapInfoHeader_t *) ((drawItem)->param.lpFormat))->biSizeImage)
+
+#define renDriFrameNumber(drawItem) \
+   ((drawItem)->param.lTime)
+
+
+/*
+ * Function prototypes
+ */
+
+renDrawItem_t * renDriAlloc(int width, int height, int fYuvNeeded);
+
+void renDriCopyParameters(
+   renDrawItem_t *dstDrawItem, 
+   const renDrawItem_t *srcDrawItem);
+
+void renDriCopyFrameData(
+   renDrawItem_t *dstDrawItem, 
+   const renDrawItem_t *srcDrawItem);
+
+void renDriFree(renDrawItem_t *drawItem);
+
+int renDriYUV(renDrawItem_t *drawItem,
+   u_char **y, u_char **u, u_char **v, int *width, int *height);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/stckheap.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Macros for stack/heap allocation.
+*
+*/
+
+
+#ifndef _STCKHEAP_H_
+#define _STCKHEAP_H_
+
+/*
+ * Include files
+ */
+
+
+/*
+ * Internal macros
+ * (Not supposed to be used in any other file)
+ */
+
+/* Concatenates two strings */
+#define SOH_CAT_STRINGS(item1, item2) item1 ## item2
+
+/* Concatenates two macros */
+#define SOH_CAT_MACROS(macro1, macro2) SOH_CAT_STRINGS(macro1, macro2)
+
+
+/* 
+ * Public macros
+ */
+
+/*
+ * SOH_DEFINE
+ *
+ * Parameters:
+ *    type_t                     type name
+ *    varName                    variable name
+ *
+ * Function:
+ *    This macro defines a variable called varName of type type_t *.
+ *
+ * Example:
+ *    SOH_DEFINE(int, pValue); defines a variable called pValue of type int *.
+ */
+
+/*
+ * SOH_ALLOC
+ *
+ * Parameters:
+ *    type_t                     type name
+ *    varName                    variable name
+ *
+ * Function:
+ *    This macro allocates and initializes a variable previously created
+ *    with SOH_DEFINE.
+ *
+ * Example:
+ *    SOH_ALLOC(int, pValue); allocates an int variable and sets pValue to
+ *    point to it.
+ */
+
+/*
+ * SOH_DEALLOC
+ *
+ * Parameters:
+ *    varName                    variable name
+ *
+ * Function:
+ *    This macro deallocates a variable previously created
+ *    with SOH_DEFINE and SOH_ALLOC.
+ *
+ * Example:
+ *    SOH_DEALLOC(pValue); deallocates pValue.
+ */
+
+
+/* Set the pointer to NULL in order to allow safe usage of SOH_DEALLOC
+   without a call to SOH_ALLOC first. */
+#define SOH_DEFINE(type_t, varName) \
+   type_t *varName = NULL
+  
+#define SOH_ALLOC(type_t, varName) \
+   varName = (type_t *) malloc(sizeof(type_t))
+   
+#define SOH_DEALLOC(varName) \
+   free(varName)
+
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/sync.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Sync codes.
+*
+*/
+
+
+#ifndef _SYNC_H_
+#define _SYNC_H_
+
+
+#include "epoclib.h"
+
+#include "biblin.h"
+
+
+/*
+ * Defines
+ */
+
+/* Return values */
+#define SNC_NO_SYNC  0        /* No synchronization code found */
+#define SNC_PSC      1        /* Picture Start Code */
+#define SNC_GBSC     2        /* GOB Start Code */
+#define SNC_EOS      4        /* End of Sequence */
+
+/*** MPEG-4 REVISION ***/
+#define SNC_VIDPACK  5        /* Video Packet resynchronization marker */
+#define SNC_VOS      6        /* Video Object Sequence (VOS) Start Code */
+#define SNC_VOP      7        /* Video Object Plane (VOP) Start Code */
+#define SNC_GOV      8        /* Group of VOPs (GOV) Start Code */
+#define SNC_USERDATA 9        /* User Data Start Code */
+#define SNC_EOB      10       /* Visual Sequence End Code */
+#define SNC_VID      11       /* Other Video Object Header Start Codes */
+#define SNC_PATTERN  12       /* The search pattern in sncSeekBitPattern */
+/*** End MPEG-4 REVISION ***/
+
+#define SNC_STUFFING 13       /* Stuffing in the end of a buffer containing
+                                 one frame */
+
+/* See sncRewindAndSeekNewSync for description. */
+#define SNC_DEFAULT_REWIND -1
+
+
+/*
+ * Function prototypes
+ */
+
+int sncCheckSync(bibBuffer_t *buffer, int *numStuffBits, int16 *error);
+
+int sncRewindAndSeekNewSync(u_int32 numBitsToRewind, bibBuffer_t *buffer, 
+   int16 *error);
+
+int sncSeekFrameSync(bibBuffer_t *buffer, int16 *error);
+
+int sncSeekSync(bibBuffer_t *buffer, int16 *error);
+
+   int sncCheckMpegVOP(bibBuffer_t *buffer, int16 *error);
+   int sncCheckMpegSync(bibBuffer_t *buffer, int f_code, int16 *error);
+   int sncRewindAndSeekNewMPEGSync(int earliestBitPos, bibBuffer_t *buffer,
+                                   int f_code, int16 *error);
+   int sncSeekMPEGSync(bibBuffer_t *buffer, int f_code, int16 *error);
+   int sncSeekMPEGStartCode(bibBuffer_t *buffer, int f_code, int skipVPSync, int checkUD, int16 *error);
+   int sncSeekBitPattern(bibBuffer_t *buffer, u_int32 BitPattern, 
+      int BitPatternLength, int16 *error);
+   int sncRewindStuffing(bibBuffer_t *buffer, int16 *error);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/vdc263.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,351 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* An application programming interface for core functions of
+* video decoder.
+*
+*/
+
+
+#ifndef _VDC263_H_
+#define _VDC263_H_
+
+
+/*
+ * Includes
+ */ 
+
+
+#include "biblin.h"
+#include "vdeims.h"
+
+
+/*
+ * Defines
+ */
+
+/* Return values */
+// unify error codes
+#define VDC_OK_BUT_NOT_CODED H263D_OK_BUT_NOT_CODED 
+                                    /* not coded frame, 
+                                       copied to output as is, 
+                                       no decoded output generated */  
+#define VDC_OK_BUT_FRAME_USELESS H263D_OK_BUT_FRAME_USELESS  
+                                    /* Decoder behaved normally the decoded
+                                       frame(s) should not be displayed since
+                                       it is too heavily corrupted. */
+
+#define VDC_OK_BUT_BIT_ERROR H263D_OK_BUT_BIT_ERROR  
+                                    /* The decoded frame(s) are degraded due
+                                       to transmission errors but can be
+                                       displayed due to successful error
+                                       concealment. */
+
+#define VDC_OK            H263D_OK  /* Everything ok. */
+
+#define VDC_ERR         H263D_ERROR /* An unexpected processing error 
+                                       occured. */
+#define VDC_ERR_NO_INTRA H263D_ERROR_NO_INTRA /* No INTRA frame has been decoded
+                                       and the current frame is INTER  */
+
+/* vdcPictureHeader_t and vdxSEI_t related definitions */
+#define VDX_MAX_BYTES_IN_PIC_HEADER 44
+                                    /* Maximum number of bytes allowed in
+                                       SEI picture header repetition.
+
+                                       Picture headers not including
+                                       BCM (Annex N video-mux back-channel),
+                                       RPRP (Annex P warping parameters), and
+                                       Annex U 
+                                       allocate 152 bits = 19 bytes in 
+                                       the worst case.
+                                       Our decoder does not support the features
+                                       mentioned above. However, to ensure
+                                       that introduction of any of the mentioned
+                                       tools would not break this mechanism,
+                                       a relatively large buffer is allocated
+                                       for picture header copies. Note that
+                                       Annex U does not have an upper limit
+                                       for picture header lengths. */
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* {{-output"vdcHInstance_t_info.txt" -ignore"*" -noCR}}
+   vdcHInstance_t is used as a unique identifier of a VDC instance.
+   The type can be casted to u_int32 or void pointer and then back to
+   vdcHInstance_t without any problems.
+   {{-output"vdcHInstance_t_info.txt"}} */
+
+/* {{-output"vdcHInstance_t.txt"}} */
+typedef void * vdcHInstance_t;
+/* {{-output"vdcHInstance_t.txt"}} */
+
+
+/* The following vdx data types are defined here, because VDC exports
+   these structures (see vdcDecodePictureHeader). */
+
+/*
+ * vdxPictureHeader_t
+ */
+
+/* {{-output"vdxPictureHeader_t_info.txt" -ignore"*" -noCR}}
+   The vdxGetPictureHeader function uses this structure to return the picture
+   header parameters.
+   {{-output"vdxPictureHeader_t_info.txt"}} */
+
+/* {{-output"vdxPictureHeader_t.txt"}} */
+typedef struct {
+   /* The following fields are always set */
+      int numBits;               /* number of bits in the picture header,
+                                    including PSC, excluding PSTUFF, PSUPP and
+                                    PEI */
+
+      int tr;                    /* the TR field or a combination of ETR and TR
+                                    if ETR is used */
+
+      int fSplitScreen;
+      int fDocumentCamera;
+      int fFreezePictureRelease;
+
+      int pictureType;           /* Picture type is one of the following:
+                                       VDX_PIC_TYPE_I       INTRA
+                                       VDX_PIC_TYPE_P       INTER
+                                       VDX_PIC_TYPE_PB      PB (Annex G)
+                                       VDX_PIC_TYPE_IPB     Improved PB
+                                       VDX_PIC_TYPE_B       B (Annex O)
+                                       VDX_PIC_TYPE_EI      EI (Annex O)
+                                       VDX_PIC_TYPE_EP      EP (Annex O) */
+
+      int fPLUSPTYPE;            /* 0 = no PLUSPTYPE, 1 = PLUSPTYPE exists */
+
+      int cpm;                   /* The CPM field */
+      int psbi;                  /* The PSBI field, valid only if cpm == 1 */
+
+      int pquant;                /* The PQUANT field */
+      int pquantPosition;        /* Number of bits preceding the PQUANT field,
+                                    including PSC, excluding PSTUFF */
+
+   /* The following fields are set 
+      if pictureType == VDX_PIC_TYPE_PB || pictureType == VDX_PIC_TYPE_IPB */
+      int trb;                   /* The TRB field */
+      int dbquant;               /* The DBQUANT field */
+
+   /* The following fields are set if fPLUSPTYPE == 0 || ufep == 1 */
+      int lumWidth;              /* the width and height of the luminance */
+      int lumHeight;             /* image */
+
+      int fUMV;                  /* Unrestricted Motion Vector Mode */
+      int fSAC;                  /* Syntax-based Arithmetic Coding Mode */
+      int fAP;                   /* Advanced Prediction Mode */
+
+   /* The following fields are set if fPLUSPTYPE == 1 */
+      int ufep;                  /* The UFEP field */
+
+      int fRPR;                  /* Reference Picture Resampling Mode */
+      int fRRU;                  /* Reduced-Resolution Update Mode */
+      int rtype;                 /* Rounding type (RTYPE) */
+
+
+      /* If Annex O is in use */
+         int elnum;              /* Enhancement layer number */
+
+      /* If the Reference Picture Selection mode is in use */
+         int trpi;               /* 1 = trp is valid */
+         int trp;                /* Temporal reference for prediction */
+
+      /* The following fields are set if ufep == 1 */
+         int fCustomSourceFormat;
+   
+         int fAIC;               /* Advanced INTRA Coding Mode */
+         int fDF;                /* Deblocking Filter Mode */
+         int fSS;                /* Slice Structured Mode */
+         int fRPS;               /* Reference Picture Selection Mode */
+         int fISD;               /* Independent Segment Decoding Mode */
+         int fAIV;               /* Alternate INTER VLC Mode */
+         int fMQ;                /* Modified Quantization Mode */
+
+         int parWidth;           /* Pixel aspect ratio = parWidth : parHeight */
+         int parHeight;
+
+                                 /* Picture Clock Frequence (PCF) fields */
+         int fCustomPCF;         /* 0 = CIF PCF, 1 = custom PCF */
+         int pcfRate;            /* PCF = pcfRate / pcfScale Hz */
+         int pcfScale;
+
+         /* If fUMV == 1 */
+            int fUMVLimited;     /* 0 = motion vector range is not limited,
+                                    1 = motion vector range is limited
+                                        according to Annex D */
+
+         /* If fSS == 1 */
+            int fRectangularSlices;  
+                                 /* 0 = free-running slices, 
+                                    1 = rectangular slices */
+
+            int fArbitrarySliceOrdering;
+                                 /* 0 = sequential order */
+                                 /* 1 = arbitrary order */
+
+         /* If Annex O is in use */                                 
+            int rlnum;           /* Reference layer number */
+
+
+         /* If fRPS == 1 */
+            int rpsMode;         /* Reference Picture Selection Mode:
+                                       VDX_RPS_MODE_NO_MSGS
+                                       VDX_RPS_MODE_ACK
+                                       VDX_RPS_MODE_NACK
+                                       VDX_RPS_MODE_BOTH_MSGS */
+} vdxPictureHeader_t;
+/* {{-output"vdxPictureHeader_t.txt"}} */
+
+
+/*
+ * vdxSEI_t
+ */
+
+/* {{-output"vdxSEI_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to return parameters parsed from Supplemental
+   Enhancement Information.
+   {{-output"vdxSEI_t_info.txt"}} */
+
+/* {{-output"vdxSEI_t.txt"}} */
+typedef struct {
+   int fFullPictureFreezeRequest;   /* 1 = Full-picture freeze requested as in
+                                       section L.4 of H.263, 0 otherwise */
+
+   int fFullPictureSnapshot;        /* 1 = Full-picture snapshot tag as in
+                                        section L.8 of H.263, 0 otherwise */
+
+   u_int32 snapshotId;              /* Snapshot identification number */
+   
+   u_int8 snapshotStatus;           /* Snapshot transmission status */
+
+   int scalabilityLayer;            /* Annex N scalability layer for 
+                                       the picture, -1 if not defined */
+
+   int numScalabilityLayers;        /* Number of Annex N scalability layers,
+                                       value from 2 to 15, 
+                                       0 if no scalability layers in use. */
+
+   u_char prevPicHeader[VDX_MAX_BYTES_IN_PIC_HEADER];
+                                    /* Previous picture header repetition
+                                       in bit-stream syntax including
+                                       the first two bytes of PSC */
+
+   int numBytesInPrevPicHeader;     /* Number of bytes valid in prevPicHeader,
+                                       including the first two bytes of PSC
+                                       and the last byte of picture header
+                                       where the LSB bits are possibly not
+                                       belonging to the picture header copy */
+
+   int numBitsInLastByteOfPrevPicHeader;
+                                    /* Number of valid bits in the last byte
+                                       of prevPicHeader (1..8) */
+
+   int fPrevPicHeaderTooLarge;      /* 1 if the previous picture header copy 
+                                       did not fit into prevPicHeader,
+                                       0 otherwise */
+} vdxSEI_t;
+/* {{-output"vdxSEI_t.txt"}} */
+
+
+/*
+ * Function prototypes, core.c
+ */
+
+int vdcClose(vdcHInstance_t hInstance);
+
+class CMPEG4Transcoder;
+int vdcDecodeFrame(vdcHInstance_t hInstance, bibBuffer_t *inBuffer, bibBuffer_t *outBuffer,
+									 bibBufferEdit_t *bufEdit, int aColorEffect, TBool aGetDecodedFrame,
+									 CMPEG4Transcoder *hTranscoder);
+
+
+int vdcDecodePictureHeader(
+   vdcHInstance_t hInstance,
+   bibBuffer_t *inBuffer,
+   vdxPictureHeader_t *header,
+   vdxSEI_t *sei);
+
+int vdcFree(void);
+
+vdeImsItem_t *vdcGetImsItem(vdcHInstance_t hInstance, int index);
+
+int vdcGetNumberOfAnnexNScalabilityLayers(
+   vdcHInstance_t hInstance);
+
+int vdcGetNumberOfOutputFrames(vdcHInstance_t hInstance);
+
+void vdcGetTR(void *inpBuffer, u_int8 *tr);
+
+int vdcIsEOSReached(vdcHInstance_t hInstance);
+
+int vdcIsINTRA(
+   vdcHInstance_t hInstance,
+   void *frameStart,
+   unsigned frameLength);
+
+int vdcIsINTRAGot(vdcHInstance_t hInstance);
+
+int vdcIsPB(
+   vdcHInstance_t hInstance,
+   void *frameStart,
+   unsigned frameLength);
+
+int vdcLoad(void);
+
+vdcHInstance_t vdcOpen(
+   vdeIms_t *imageStore, 
+   int numReferenceFrames,
+   void *hParent);
+
+void vdcRestartVideo(vdcHInstance_t hInstance);
+
+int vdcSetBackChannelUsage(vdcHInstance_t hInstance, int fSendMessages);
+
+int vdcSetErrorResilience(vdcHInstance_t hInstance, int feature, int value);
+
+int vdcSetStartOrEndSnapshotCallback(
+   vdcHInstance_t hInstance, 
+   u_int32 mode,
+   u_int32 callback);
+
+int vdcGetSnapshotStatus(vdcHInstance_t hInstance);
+
+int vdcSetReportPictureSizeCallback(
+   vdcHInstance_t hInstance, 
+   u_int32 callback);
+
+/*
+ * Function prototypes, core_mpeg.c
+ */
+
+   int vdcDecodeMPEGVolHeader(vdcHInstance_t hInstance, bibBuffer_t *inBuffer, CMPEG4Transcoder *hTranscoder);
+
+   int vdcDecodeMPEGVop(vdcHInstance_t hInstance, bibBuffer_t *inBuffer, bibBuffer_t *outBuffer,
+                        bibBufferEdit_t *bufEdit, int aColorEffect, TBool aGetDecodedFrame, 
+						int aStartByteIndex, int aStartBitIndex, CMPEG4Transcoder *hTranscoder);
+
+   int vdcIsMPEGINTRA(
+      vdcHInstance_t hInstance,
+      void *frameStart,
+      unsigned frameLength);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/vdcaic.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for the aic (Advanced Intra Coding) module.
+*
+*/
+
+
+
+#ifndef _VDCAIC_H_
+#define _VDCAIC_H_
+
+#include "epoclib.h"
+
+/*
+ * Structs and typedefs
+ */
+
+typedef struct {
+   
+    int16 *qpStore;    /* storage place for the QP values of MBs in the 
+                           previous and current MB line */
+
+    int ***dcStore;    /* storage place for the DC and first horizontal 
+                           and vertical line of AC coefficients of the 
+                           4+1+1 blocks of the MBs in the previous and 
+                           current MB line */
+
+    int numMBsInMBLine; /* number of MBs in a MB line for the calculation 
+                           of the internal sorage index from currMBNum */
+
+    int Xpos[6];        /* indexed by block number (0..5) of an MB gives 
+                           relative MB index of left neighbor block */
+
+    int Ypos[6];        /* indexed by block number (0..5) of an MB gives 
+                           relative MB index of top neighbor block */
+
+    int Xtab[6];        /* indexed by block number (0..5) of an MB gives 
+                           block number of left neighbor block */
+
+    int Ytab[6];        /* indexed by block number (0..5) of an MB gives 
+                           block number of top neighbor block */
+
+    int Ztab[6];        /* indexed by block number (0..5) of an MB gives 
+                           block number of top-left neighbor block */
+
+    u_char ACpred_flag; /* ON(1): AC prediction is used, OFF(0): only DC */
+
+    int midGrey;       /* the grey value used for prediction direction
+                           decision if prediction block is not available */
+} aicData_t;
+
+
+/*
+ * Prototypes
+ */
+
+   void aicStart (aicData_t *aicData, int numMBsInMBLine, int16 *error);
+
+   void aicFree (aicData_t *aicData);
+
+   void aicBlockUpdate (aicData_t *aicData, int currMBNum, int blockNum, int *block,
+                        int pquant, int DC_coeff);
+
+   int aicIsBlockValid (aicData_t *aicData, int currMBNum);
+
+   void aicDCACrecon (aicData_t *aicData, int QP, u_char fTopMBMissing, u_char fLeftMBMissing,
+                      u_char fBBlockOut, int blockNum, int *qBlock, int currMBNum);
+
+   int aicDCScaler (int QP, int type);
+
+   u_char aicIntraDCSwitch (int intraDCVLCThr, int QP);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/vdcmvc.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Function prototypes for motion vector counting for H.263 decoder.
+*
+*/
+
+
+#ifndef _VDCMVC_H_
+#define _VDCMVC_H_
+
+
+#include "epoclib.h"
+
+/*
+ * Defines
+ */
+
+#define MVC_XM1_UP 0
+#define MVC_XM1_DOWN 1
+#define MVC_YM1_LEFT 2
+#define MVC_YM1_RIGHT 3
+#define MVC_XP1_UP 4
+#define MVC_XP1_DOWN 5
+
+#define MVC_MB_INTER 1
+#define MVC_MB_INTRA 2
+#define MVC_MB_NOT_CODED 3
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* {{-output"mvRowItem_t_info.txt" -ignore"*" -noCR}}
+   mvRowItem_t is capable of storing one P frame motion vector.
+   It is used internally within the MVC module.
+   {{-output"mvRowItem_t_info.txt"}} */
+
+/* {{-output"mvRowItem_t.txt"}} */
+typedef struct {
+   int mvx;          /* motion vector value or MVD_INTRA or MVD_NOT_CODED */
+   int mvy;
+   int y;            /* the y coordinate for motion vector in block units */
+   int time;         /* a relative time when motion vector was counted */
+   u_char fourMVs;   /* flag indicating four MBs per macroblock */
+   int type;         /* MVC_MB_INTER, MVC_MB_INTRA or MVC_MB_NOT_CODED */
+} mvRowItem_t;
+/* {{-output"mvRowItem_t.txt"}} */
+
+
+/* {{-output"mvBFBufItem_t_info.txt" -ignore"*" -noCR}}
+   mvBFBufItem_t is capable of storing one B frame motion vector.
+   It is used internally within the MVC module.
+   {{-output"mvBFBufItem_t_info.txt"}} */
+
+/* {{-output"mvBFBufItem_t.txt"}} */
+typedef struct {
+   int mvx;          /* motion vector value */
+   int mvy;
+   int x;            /* the x coordinate for mv in block units */
+   int y;            /* the y coordinate for mv in block units */
+   int time;         /* a relative time when mv was counted */
+   u_char fourMVs;   /* flag indicating four MBs per macroblock */
+} mvBFBufItem_t;
+/* {{-output"mvBFBufItem_t.txt"}} */
+
+
+/* {{-output"mvcData_t_info.txt" -ignore"*" -noCR}}
+   mvcData_t is used to store the instance data for one MVC module and
+   it is capable of keeping state of the motion vector decoding process
+   for one encoded H.263 bitstream.
+   {{-output"mvcData_t_info.txt"}} */
+
+/* {{-output"mvcData_t.txt"}} */
+typedef struct {
+   /* motion vector buffers
+    *
+    * mvRow contains three motion vector lines: mvRow0, mvRow1 and mvRow2
+    * mvRow0 is the lower block line in the previous macroblock line
+    * mvRow1 is the higher block line in the current macroblock line
+    * mvRow2 is the lower block line in the current macroblock line
+    */
+   mvRowItem_t *mvRow;
+   mvRowItem_t *mvRow0;
+   mvRowItem_t *mvRow1;
+   mvRowItem_t *mvRow2;
+
+   int currMaxX;     /* maxX, when mvcStart was last called */
+   int currX;        /* x for current macroblock being handled */
+   int currY;        /* y for current macroblock */
+   int currTime;     /* time for current macroblock */
+   int mvRowIndex;   /* the index of mvRow0 in mvRow array (0..2) */
+
+   mvBFBufItem_t mvFBufArray[2][4]; /* forward motion vectors for B frame 
+                                       for current and previous MB */
+   mvBFBufItem_t mvBBufArray[2][4]; /* backward motion vectors for B frame
+                                       for current and previous MB */
+   int mvBFBufIndex; /* the index of the current MB in mvFBufArray and 
+                        mvBBufArray. The index of the previous MB is generated
+                        by XORing 1 to this variable. */
+   int currLumWidth;
+   int currLumHeight;
+   int mvRangeLowX;  /* Lower boundary for horz. MV range */
+   int mvRangeHighX; /* Higher boundary for horz. MV range */
+   int mvRangeLowY;  /* Lower boundary for vert. MV range */
+   int mvRangeHighY; /* Higher boundary for vert. MV range */
+   int prevPredMode; /* Flag for prediction of forward prediction vector in IPB
+                        1  => MB to the left has a FWD MV
+                        0  => Otherwise   */
+   int rightOfBorder;      /* There is a border on the left of the current MB */
+   int downOfBorder;       /* There is a border on top of the current MB */
+   int leftOfBorder;   /* There is a border on the right of the previous MB */
+   int rightOfBorderPrev;  /* There is a border on the left of the previous MB */
+   int downOfBorderPrev;   /* There is a border on top of the previous MB */
+   int upRightMBIsStart;   /* The MB, on the previous line and next column is
+                              the starting MB of the slice. If Annex K is not 
+                              in use returns zero.*/
+   int fSS;                /* Annex K use flag */
+
+
+   int range;  /* allowed range of the MVs: low= -range; high= range-1 */
+   int f_code; /* f_code_forward for P-frames */
+
+} mvcData_t;
+/* {{-output"mvcData_t.txt"}} */
+
+
+/*
+ * Function prototypes
+ */
+
+void mvcCalcMV(mvcData_t *mvcData, int mvdx, int mvdy,
+   int *mvx, int *mvy, u_char predictorMode, u_char fourMVs,
+   u_char unrestrictedMV,  u_char nonEmptyGOBHeader, int x, 
+   int y, int time, int mbType, int16 *error, int fPLUSPTYPE, 
+   int fUMVLimited);
+
+void mvcSetBorders(
+      mvcData_t *mvcData, int x, int y, int mba, int numMBsInMBLine, 
+      int *rightOfBorder, int *downOfBorder);
+
+void mvcCalcMPEGMV(mvcData_t *mvcData,
+   int mvdx, int mvdy, int *mvx, int *mvy,
+   u_char predictorMode, u_char fourMVs,
+   u_char topOfVP, u_char leftOfVP, u_char fmv3_out,
+   int x, int y, int time, int mbType, int16 *error);
+
+void mvcCalcMVsForBFrame(mvcData_t *mvcData, int *mvfx, int *mvfy, 
+   int *mvbx, int *mvby, int *mvx, int *mvy, int mvdx, int mvdy, 
+   int trb, int trd, int numMVs, u_char unrestrictedMV, 
+   int x, int y, int time);
+
+void mvcCalcFwdMVsForImpBFrame(mvcData_t *mvcData, int *mvfx, int *mvfy,
+   int *mvbx, int *mvby, int mvdx, int mvdy, int x, int y, int fUMV);
+
+void mvcFree(mvcData_t *mvcData);
+
+void mvcGetCurrNeighbourMVs(mvcData_t *mvcData, int *nmvx, int *nmvy,
+   int16 *error);
+
+void mvcGetPrevNeighbourMVs(mvcData_t *mvcData, int *nmvx, int *nmvy,
+   int *pmvx, int *pmvy, u_char *fourMVs, int16 *error);
+
+void mvcGetPrevMVFsAndMVBs(mvcData_t *mvcData, int *mvfx, int *mvfy, 
+   int *mvbx, int *mvby, u_char *fourMVs, int16 *error);
+
+void mvcMarkMBIntra(mvcData_t *mvcData, int x, int y, int time);
+
+void mvcMarkMBNotCoded(mvcData_t *mvcData, int x, int y, int time);
+
+void mvcStart(mvcData_t *mvcData, int maxX, int lumWidth, 
+   int lumHeight, int16 *error);
+
+void mvcGetCurrentMVs(mvcData_t *mvcData, int *mvx, int *mvy,
+   int16 *error);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/vde.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* A header file for internal usage of the services provided by 
+* the Video Decoder Engine.
+*
+*/
+
+
+#ifndef _VDE_H_
+#define _VDE_H_
+
+
+/*
+ * Includes
+ */
+
+#include "vdefrt.h"
+#include "vdeims.h"
+
+#include "biblin.h"
+#include "vdc263.h"
+#include "h263dapi.h"
+
+
+/*
+ * Defines
+ */
+
+/* Aliased return values from h263dext.h.
+   (These values may also be exported outside the decoder.) */
+
+#define VDE_OK_BUT_NOT_CODED \
+                           H263D_OK_BUT_NOT_CODED
+#define VDE_OK_BUT_FRAME_USELESS \
+                           H263D_OK_BUT_FRAME_USELESS
+#define VDE_OK_EOS         H263D_OK_EOS
+#define VDE_OK             H263D_OK
+#define VDE_ERROR          H263D_ERROR
+#define VDE_ERROR_HALTED   H263D_ERROR_HALTED
+#define VDE_ERROR_NO_INTRA H263D_ERROR_NO_INTRA
+
+/* Internal return values.
+   See h263dext.h that they do not conflict with the exported ones. */
+#define VDE_OK_NOT_AVAILABLE 10  /* a requested item is not available,
+                                    see vdeFrtGetItem */
+#define VDE_OK_SEGMENTATION_CHANGED 11
+                                 /* image segmentation in the Reference
+                                    Picture Selection mode has changed,
+                                    see rsbGetLatest */
+
+/* VDE states */
+#define VDE_STATE_BEGIN 0        /* no frame data decoded */
+#define VDE_STATE_MIDDLE 1       /* decoding */
+#define VDE_STATE_EOS 2          /* End-of-Stream reached */
+#define VDE_STATE_HALTED 3       /* fatal error, halted */
+#define VDE_STATE_RESYNC 4       /* Resyncing to INTRA frame */
+
+/* Temporal scalability levels, aliased from h263dext.h */
+#define VDE_LEVEL_ALL_FRAMES        H263D_LEVEL_ALL_FRAMES
+#define VDE_LEVEL_INTRA_FRAMES      H263D_LEVEL_INTRA_FRAMES
+#define VDE_LEVEL_ANNEX_N_LEVEL_0   (VDE_LEVEL_INTRA_FRAMES + 1)
+
+
+/*
+ * Macros
+ */
+
+/* Memory allocation wrappers */
+
+#define vdeMalloc malloc
+#define vdeCalloc calloc
+#define vdeRealloc realloc
+#define vdeDealloc free
+
+/* Assertion wrapper */
+#ifndef vdeAssert
+   #define vdeAssert(exp) assert(exp);
+#endif
+
+
+/*
+ * Structures and typedefs
+ */
+
+/* {{-output"vdeInstance_t_info.txt" -ignore"*" -noCR}}
+   vdeInstance_t holds the instance data for a Video Decoder Engine instance.
+   This structure is used to keep track of the internal state of the VDE
+   instance.
+   {{-output"vdeInstance_t_info.txt"}} */
+
+   /* {{-output"vdeInstance_t.txt"}} */
+   typedef struct {
+      vdcHInstance_t vdcHInstance;        /* Video Decoder Core instance handle */
+
+      bibBuffer_t *inBuffer;              /* Bit Buffer instance data */
+
+
+      bibBuffer_t *outBuffer;              /* output stream Bit Buffer instance data */
+	  bibBufferEdit_t *bufEdit; 
+      int iColorEffect; 
+      int iColorToneU; 				             /* U color tone value to be used */
+      int iColorToneV; 				             /* V color tone value to be used */
+      int iRefQp;                          /* first frame QP for color toning */
+	  TBool iGetDecodedFrame;
+
+
+      vdeIms_t imageStore;                /* Image Store instance data */
+
+      vdeFrtStore_t renStore;             /* Frame type specific store for renderer 
+                                             handles */
+
+      vdeFrtStore_t startCallbackStore;   /* Frame type specific store for
+                                             "start frame decoding" callbacks */
+
+      vdeFrtStore_t endCallbackStore;     /* Frame type specific store for
+                                             "ended frame decoding" callbacks */
+
+      int state;                          /* current state of VDE, see 
+                                             VDE_STATE_XXX definitions for
+                                             possible values */
+
+      u_int32 creationTime;               /* the time returned by gtGetTime
+                                             when the instance was created */
+
+      u_char fMPEG4;                      /* this flag is used to signal the stream type 
+                                             "0" H.263, "1" MPEG-4. 
+                                             Set by calling vdeDetermineStreamType before 
+                                             the first frame of the stream */
+
+      int lumWidth;                       /* Expected size of the incoming */
+      int lumHeight;                      /* luminance pictures */
+
+      int requestedScalabilityLevel;      /* Requested temporal scalability 
+                                             level to decode.
+                                             See vdeSetTemporalScalability 
+                                             for further details. */
+
+      int fPrevFrameDecoded;              /* 0 if the previous frame was not
+                                             decoded because it did not belong
+                                             to requested temporal scalability
+                                             level,
+                                             1 otherwise */
+   } vdeInstance_t;
+   /* {{-output"vdeInstance_t.txt"}} */
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/vdefrt.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* A header file for vdefrt.c.
+*
+*/
+
+
+#ifndef _VDEFRT_H_
+#define _VDEFRT_H_
+
+
+/*
+ * Includes
+ */
+
+
+#include "h263dapi.h"
+#include "list.h"
+
+
+/*
+ * Defines
+ */
+
+/*
+ * Structures and typedefs
+ */
+
+/* {{-output"vdeFrtStore_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to store the internal state of one frame type
+   container instance. A pointer to this structure is passed to 
+   the VDE Frame Type Container module functions to indicate the container
+   instance which the functions should handle.
+   {{-output"vdeFrtStore_t_info.txt"}} */
+
+/* {{-output"vdeFrtStore_t.txt"}} */
+typedef struct {
+   lst_t sizeList;
+} vdeFrtStore_t;
+/* {{-output"vdeFrtStore_t.txt"}} */
+
+
+/*
+ * Function prototypes
+ */
+
+int vdeFrtClose(vdeFrtStore_t *store);
+
+int vdeFrtGetItem(vdeFrtStore_t *store, h263dFrameType_t *frameType, 
+   u_int32 *item);
+
+int vdeFrtOpen(vdeFrtStore_t *store);
+
+int vdeFrtPutItem(vdeFrtStore_t *store, h263dFrameType_t *frameType, 
+   u_int32 item, void (*removeItem) (void *));
+
+int vdeFrtRemoveItem(vdeFrtStore_t *store, h263dFrameType_t *frameType);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/vdeimb.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* A header file for the Video Decoder Engine Image Buffer abstract 
+* data type.
+*
+*/
+
+
+#ifndef _VDEIMB_H_
+#define _VDEIMB_H_
+
+
+
+/*
+ * Includes
+ */
+
+#include "renapi.h"
+#include "rendri.h"
+
+
+/*
+ * Defines
+ */
+
+/* Displaying status */
+#define VDEIMB_NO_DISPLAYING 1
+#define VDEIMB_WAITING 2
+#define VDEIMB_DISPLAYED 4
+
+/* Full-picture freeze status,
+   see vdeImb_t for description of the definitions */
+#define VDEIMB_FPF_REQUEST 2
+#define VDEIMB_FPF_RELEASE 1
+#define VDEIMB_FPF_NOT_SPECIFIED 0
+
+
+/*
+ * Structures and typedefs
+ */
+
+/* {{-output"vdeImb_t_info.txt" -ignore"*" -noCR}}
+   vdeImb_t defines the structure of a single image buffer which is capable
+   of storing one YUV 4:2:0 image and a number of paramaters as 
+   side-information. The YUV image as well as the YUV to RGB conversion and
+   displaying related parameters are kept in a renDrawItem_t structure.
+   Decoder related parameters are stored in the vdeImb_t itself.
+   One may directly refer to the member variables of the vdeImb_t structure.
+   However, one should use the functions and macros in the Renderer Draw Item
+   Interface for accessing the contents of the drawItem member of vdeImb_t.
+   {{-output"vdeImb_t_info.txt"}} */
+
+/* {{-output"vdeImb_t.txt"}} */
+typedef struct {
+   renDrawItem_t *drawItem;   /* renderer draw item which actually contains
+                                 the frame memory (and some parameters) */
+
+   int fReferenced;           /* non-zero if the image buffer is going to be
+                                 used as a reference frame. Otherwise, zero. */
+
+   int tr;                    /* the TR field of H.263 which is associated with
+                                 the image buffer */
+
+   
+   int trRef;                 /* Referenced for a TR prediction,
+                                 0 if the frame is a normal picture referenced
+                                   once at maximum (in the next picture),
+                                 1 if the frame is referenced multiple times
+                                   in the future frames.
+                                 This information is used to update reference
+                                 picture data structures. It is neede at least
+                                 in streaming applications. */
+
+   int *yQuantParams;      /* luminance quantizer parameter for each 
+                              macroblock in scan-order */
+                              
+   int *uvQuantParams;     /* chrominance quantizer parameter for each 
+                              macroblock in scan-order */
+
+} vdeImb_t;
+/* {{-output"vdeImb_t.txt"}} */
+
+
+/*
+ * Function prototypes
+ */
+
+vdeImb_t *vdeImbAlloc(int width, int height, int fYuvNeeded);
+
+int vdeImbCopyParameters(vdeImb_t *dstImb, const vdeImb_t *srcImb);
+
+void vdeImbDealloc(vdeImb_t *imb);
+
+
+/*
+ * Macros
+ */
+
+/* {{-output"vdeImbYUV.txt"}} */
+/*
+ * vdeImbYUV
+ *
+ * Parameters:
+ *    vdeImb_t *pimb             a pointer to image buffer
+ *    u_char **ppy, **ppu, **ppv used to return the pointers to the top-left
+ *                               corner of Y, U and V image buffers
+ *                               respectively
+ *    int *pWidth, *pHeight      used to return the width and height of
+ *                               the luminance image in pixels
+ *
+ * Function:
+ *    This function returns the Y, U and V pointers to the passed image buffer
+ *    as well as the dimensions of the luminance frame of the image buffer.
+ *
+ * Returns:
+ *    REN_OK                     if the function was successful
+ *    REN_ERROR                  indicating a general error
+ *
+ */
+
+#define vdeImbYUV(pimb, ppy, ppu, ppv, pWidth, pHeight) \
+   renDriYUV((pimb)->drawItem, (ppy), (ppu), (ppv), (pWidth), (pHeight))
+/* {{-output"vdeImbYUV.txt"}} */
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/vdeims.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for the Video Decoder Engine image buffer store.
+*
+*/
+
+
+#ifndef _VDEIMS_H_
+#define _VDEIMS_H_
+
+/*
+ * Includes
+ */
+
+#include "list.h"
+#include "vdeimb.h"
+
+/* 
+ * Defines
+ */
+
+/* for the mode parameter of vdeImsGetReference */
+#define VDEIMS_REF_TR      0
+#define VDEIMS_REF_LATEST  1
+#define VDEIMS_REF_OLDEST  2
+
+
+/*
+ * Typedefs
+ */
+
+/* {{-output"vdeImsItem_t_info.txt" -ignore"*" -noCR}}
+   The image store item structure is used throughout the Image Store
+   module to store individual image buffers.
+   {{-output"vdeImsItem_t_info.txt"}} */
+
+/* {{-output"vdeImsItem_t.txt"}} */
+typedef struct {
+   LST_ITEM_SKELETON
+
+   vdeImb_t *imb;             /* pointer to image buffer structure */
+} vdeImsItem_t;
+/* {{-output"vdeImsItem_t.txt"}} */
+
+
+/* {{-output"vdeIms_t_info.txt" -ignore"*" -noCR}}
+   vdeIms_t defines the structure of an image buffer store.
+   A pointer to this structure is passed to the VDE Image Store module
+   functions to indicate the image store instance which the functions should
+   handle. One should not access the members of this structure directly
+   but rather always use the provided access functions.
+   {{-output"vdeIms_t_info.txt"}} */
+
+/* {{-output"vdeIms_t.txt"}} */
+typedef struct {
+   lst_t freeStoreList;       /* a list of "Free" stores each of which is
+                                 carrying frames with a certain (unique) 
+                                 size */
+
+   vdeImsItem_t *refFrame;    /* refFrame is a pointer to
+                                 the latest reference (INTRA or INTER) frame */
+
+   lst_t idleStore;           /* a list of non-referenced but to-be-displayed
+                                 image store items */
+   int fYuvNeeded;
+
+} vdeIms_t;
+/* {{-output"vdeIms_t.txt"}} */
+
+
+/*
+ * Function prototypes
+ */
+
+int vdeImsChangeReference(vdeIms_t *store, vdeImsItem_t *newItem);
+
+int vdeImsClose(vdeIms_t *store);
+
+int vdeImsDebRefStore(vdeIms_t *store);
+
+int vdeImsFromRenderer(vdeIms_t *store, void *drawItem);
+
+int vdeImsGetFree(vdeIms_t *store, int lumWidth, int lumHeight, 
+   vdeImsItem_t **item);
+
+int vdeImsGetReference(vdeIms_t *store, int mode, int tr, vdeImsItem_t **item);
+
+int vdeImsOpen(vdeIms_t *store, int numFreeItems, int lumWidth, int lumHeight);
+
+void vdeImsSetYUVNeed(vdeIms_t *store, int fYuvNeeded);
+
+int vdeImsPut(vdeIms_t *store, vdeImsItem_t *item);
+
+int vdeImsPutFree(vdeIms_t *store, vdeImsItem_t *item);
+
+int vdeImsReleaseReference(vdeIms_t *store, vdeImsItem_t *item);
+
+
+
+/*
+ * Macros
+ */
+
+/* Note: vdeImsImageBufferToStoreItem and vdeImsStoreItemToImageBuffer
+   need not be used since it is considered that the vdeImsItem_t structure
+   is public and one can directly refer the image buffer to as pImsItem->imb.
+   However, these macros exist to provide compatibility to some "old" code. */
+
+/*
+ * vdeImsImageBufferToStoreItem
+ *
+ * Parameters:
+ *    vdeImb_t *buffer           a pointer to an image buffer
+ *    vdeImsItem_t *storeItem    a pointer to a image store item
+ *
+ * Function:
+ *    This macro associates the given image buffer with the given
+ *    image store item.
+ *
+ * Returns:
+ *    >= 0 if successful
+ *    < 0 indicating an error
+ *
+ */
+
+#define vdeImsImageBufferToStoreItem(buffer, storeItem) ((storeItem)->imb = (buffer), 0)
+
+
+/*
+ * vdeImsStoreItemToImageBuffer
+ *
+ * Parameters:
+ *    vdeImsItem_t *storeItem    a pointer to a image store item
+ *    vdeImb_t **buffer          a pointer to an image buffer pointer
+ *
+ * Function:
+ *    This macro returns the pointer to the image buffer associated with
+ *    the given image store item.
+ *
+ * Returns:
+ *    >= 0 if successful
+ *    < 0 indicating an error
+ *
+ */
+
+#define vdeImsStoreItemToImageBuffer(storeItem, buffer) (*(buffer) = (storeItem)->imb, 0)
+
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/vdemain.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for external usage of the services provided by 
+* the H.263 Video Decoder Engine.
+*
+*/
+
+
+#ifndef _VDEMAIN_H_
+#define _VDEMAIN_H_
+
+
+
+
+/*
+ * Includes
+ */
+
+#include "biblin.h"
+
+#include "epoclib.h"
+#include "vdefrt.h"
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* {{-output"vdeHInstance_t_info.txt" -ignore"*" -noCR}}
+   vdeHInstance_t is used as a unique identifier of a Video Decoder
+   Engine instance.
+   The type can be casted to u_int32 or void pointer and then back to 
+   vdeHInstance_t without any problems.
+   {{-output"vdeHInstance_t_info.txt"}} */
+
+/* {{-output"vdeHInstance_t.txt"}} */
+typedef void * vdeHInstance_t;
+/* {{-output"vdeHInstance_t.txt"}} */
+
+
+
+/*
+ * Function prototypes
+ */
+
+int vdeFree(void);
+
+int vdeGetLatestFrame(
+   vdeHInstance_t hInstance,
+   u_char **ppy, u_char **ppu, u_char **ppv,
+   int *pLumWidth, int *pLumHeight,
+   int *pFrameNum);
+
+vdeHInstance_t vdeInit(h263dOpen_t *param);
+
+int vdeIsINTRA(
+   vdeHInstance_t hInstance,
+   void *frameStart,
+   unsigned frameLength);
+
+int vdeLoad(const char *rendererFileName);
+
+int vdeReturnImageBuffer(vdeHInstance_t hInstance, u_int32 typelessParam);
+
+int vdeSetInputBuffer(vdeHInstance_t hInstance, bibBuffer_t *buffer);
+
+
+int vdeSetOutputBuffer(vdeHInstance_t hInstance, bibBuffer_t *buffer);
+
+int vdeSetBufferEdit(vdeHInstance_t hInstance, bibBufferEdit_t *bufEdit);
+
+int vdeSetVideoEditParams(vdeHInstance_t hInstance, int aColorEffect, 
+  TBool aGetDecodedFrame, TInt aColorToneU, TInt aColorToneV);
+
+int vdeShutDown(vdeHInstance_t hInstance);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/vdeti.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for the vdeti.c file.
+*
+*/
+
+
+#ifndef _VDETI_H_
+#define _VDETI_H_
+
+
+
+#include "vdemain.h"
+
+/*
+ * Structs and typedefs
+ */
+
+
+/* 
+ * Function prototypes
+ */
+
+class CMPEG4Transcoder;
+int vdeDetermineStreamType(vdeHInstance_t hInstance, CMPEG4Transcoder *hTranscoder);
+
+int vdeDecodeFrame(vdeHInstance_t hInstance, int aStartByteIndex, int aStartBitIndex,CMPEG4Transcoder *hTranscoder);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/vdxint.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Internal header for the video demultiplexer module.
+*
+*/
+
+
+
+#ifndef _VDXINT_H_
+#define _VDXINT_H_
+
+/*
+ * Defines
+ */
+
+#ifndef vdxAssert
+   #define vdxAssert(exp) assert(exp);
+#endif
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* type for VLC (variable length code) lookup tables */
+typedef struct {
+   int val; /* value for code, for example an index of the corresponding table
+               in the H.263 recommendation */
+   u_char len; /* actual length of code in bits */
+} vdxVLCTable_t;
+
+typedef struct{
+    int16 code;
+    int16 length;
+}tVLCTable;
+
+
+/*
+ * Functions defined in viddemux.c (and used from viddemux_mpeg.c)
+ */
+
+/* Macroblock Layer */
+
+int vdxGetCBPY(bibBuffer_t *inBuffer, int *index, 
+   int *bitErrorIndication);
+
+int vdxGetMCBPCInter(
+   bibBuffer_t *inBuffer, 
+   int fPLUSPTYPE,
+   int fFourMVsPossible,
+   int fFirstMBOfPicture,
+   int *index, 
+   int *bitErrorIndication);
+
+int vdxGetMCBPCIntra(bibBuffer_t *inBuffer, int *index, 
+   int *bitErrorIndication);
+
+int vdxGetMVD(bibBuffer_t *inBuffer, int *mvdx10, 
+   int *bitErrorIndication);
+
+int vdxUpdateQuant(
+   bibBuffer_t *inBuffer, 
+   int fMQ,
+   int quant,
+   int *newQuant,
+   int *bitErrorIndication);
+
+
+/*
+ * Functions defined in viddemux_mpeg.c (and used from viddemux.c)
+ */
+
+   int vdxGetScaledMVD(bibBuffer_t *inBuffer, int f_code, int *mvd10,
+      int *bitErrorIndication);
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/vedh263dimp.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for H.263 Decoder API implementation class.
+*
+*/
+
+
+#ifndef VEDH263DIMP_H
+#define VEDH263DIMP_H
+
+#include "h263dext.h"
+#include "h263dmai.h"  // CVedH263Dec defined here
+
+
+class CVedH263DecImp : public CVedH263Dec
+{
+
+    public:  // Constructors and destructor
+    
+        /**
+        * C++ default constructor.
+        */
+        CVedH263DecImp(TSize aFrameSize, TInt aNumReferencePictures);
+
+        /**
+        * Destructor.
+        */        
+        ~CVedH263DecImp();
+
+        /**
+        * 2nd phase constructor must be public since it is called from NewL of abstract base class.
+        */
+        void ConstructL();
+
+    public: // Functions from CVedH263Dec                    
+
+        /**
+        * From CVedH263Dec Sets the renderer to be used
+        */    
+        void SetRendererL(MVideoRenderer* aRenderer);
+        
+        /**
+        * From CVedH263Dec Sets the post-filter to be used
+        */ 
+        void SetPostFilterL(const TPostFilter aFilter);
+
+        /**
+        * From CVedH263Dec Returns the frame to the decoder subsystem
+        */ 
+        void FrameRendered(const TAny *aFrame);               
+
+        /**
+        * From CVedH263Dec Checks if the given frame is valid
+        */ 
+        TBool FrameValid(const TAny *aFrame);
+
+        /**
+        * From CVedH263Dec Retrieves Y/U/V pointers to the given frame
+        */ 
+        TInt GetYUVBuffers(const TAny *aFrame, TUint8*& aYFrame, TUint8*& aUFrame, 
+                           TUint8*& aVFrame, TSize& aFrameSize);
+
+        /**
+        * From CVedH263Dec Retrieves the latest decoded YUV frame
+        */ 
+        TUint8* GetYUVFrame();
+
+        /**
+        * From CVedH263Dec Decodes / transcodes a compressed frame
+        */ 
+        void DecodeFrameL(const TPtrC8& aInputBuffer, TPtr8& aOutputBuffer,
+                          TBool& aFirstFrame, TInt& aBytesDecoded,
+                          vdeDecodeParamters_t *aDecoderInfo);
+
+		void DecodeFrameL(const TPtrC8& aInputBuffer, TPtr8& aOutputBuffer,                                  TBool& aFirstFrame, TInt& aBytesDecoded, 
+			              const TColorEffect aColorEffect,
+						  const TBool aGetDecodedFrame, TInt aFrameOperation,
+						  TInt* aTrP, TInt* aTrD, TInt aVideoClipNumber, TInt aSMSpeed, 
+						  TInt aDataFormat);
+        
+        /**
+        * From CVedH263Dec Decodes a compressed frame
+        */ 
+        void DecodeFrameL(const TPtrC8& aInputBuffer, TBool& aFirstFrame, TInt& aBytesDecoded, 
+					TInt aDataFormat);
+
+        
+        /**
+        * From CVedH263Dec Check the VOS header
+        */ 
+		TBool CheckVOSHeaderL(TPtrC8& aInputBuffer);
+
+
+private:
+
+    // H.263 decoder instance handle
+    h263dHInstance_t iH263dHandle; 
+
+    // frame dimensions
+    TSize iFrameSize;  
+
+};
+
+
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/viddemux.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1068 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for the video demultiplexer module.
+*
+*/
+
+
+#ifndef _VIDDEMUX_H_
+#define _VIDDEMUX_H_
+
+#include "epoclib.h"
+
+#include "biblin.h"
+
+#include "dlist.h"
+#include "vdc263.h" /* for vdxPictureHeader_t and vdxSEI_t */
+class CMPEG4Transcoder;
+
+
+/*
+ * Defines
+ */
+
+/* General return values */
+// unify error codes
+#define VDX_OK_BUT_BIT_ERROR  H263D_OK_BUT_BIT_ERROR     /* Handled portion of the bistream
+                                       contains a bit error */
+#define VDX_OK         H263D_OK     /* Everything ok */
+#define VDX_ERR     H263D_ERROR     /* Everything ok */
+#define VDX_ERR_NOT_SUPPORTED H263D_ERROR    /* Some bit combination (in header)
+                                       occurs which is not supported by the 
+                                       implementetion */
+#define VDX_ERR_BIB  H263D_ERROR    /* Bit Buffer module returned an error */
+
+/* Picture types */
+#define VDX_PIC_TYPE_I     0
+#define VDX_PIC_TYPE_P     1
+#define VDX_PIC_TYPE_PB    8
+#define VDX_PIC_TYPE_IPB   2
+#define VDX_PIC_TYPE_B     3
+#define VDX_PIC_TYPE_EI    4
+#define VDX_PIC_TYPE_EP    5
+#define VDX_VOP_TYPE_I     0 /* MPEG-4 Intra Picture */
+#define VDX_VOP_TYPE_P     1 /* MPEG-4 Inter Picture */
+#define VDX_VOP_NOT_CODED -1 /* MPEG-4 Not Coded Picture 
+                                (only the time_increment is present) */
+
+/* Reference Picture Selection modes */
+#define VDX_RPS_MODE_NO_MSGS     0
+#define VDX_RPS_MODE_ACK         1
+#define VDX_RPS_MODE_NACK        2
+#define VDX_RPS_MODE_BOTH_MSGS   3
+
+/* Macroblock classes */
+#define VDX_MB_INTER    1
+#define VDX_MB_INTRA    2
+
+#define MAX_USER_DATA_LENGTH 512    /* The maximum allocated memory for 
+                                       user data (UD). Only this much of the UD
+                                       from the bitstream is stored */
+
+/*
+ * Typedefs
+ */
+
+/*
+ * vdxVolHeader_t
+ */
+
+/* {{-output"vdxVolHeader_t_info.txt" -ignore"*" -noCR}}
+   The vdxGetVolHeader function uses this structure to return VOL header data.
+   /MPEG-4/
+   {{-output"vdxVolHeader_t_info.txt"}} */
+
+/* {{-output"vdxVolHeader_t.txt"}} */
+typedef struct {
+
+   int profile_level;       /* Indicates the Level (1,2 or 3) of the Simple
+                               Profile the Video Object conforms to */
+   int vo_priority;         /* Priority assigned to the Video Object 
+                               a value between 1(lowest)-7(highest).
+                               If not in the bitstream, set to zero */
+   
+   int vo_id;               /* id of the Video Object */
+   int vol_id;              /* id of the Video Object Layer */
+   int random_accessible_vol; 
+                            /* set to 1 if all the VOPs in the stream are
+                                 I-VOP. */
+   int pixel_aspect_ratio;  /* see. MPEG-4 visual spec. pp. 71 */
+
+   int time_increment_resolution;
+                            /* Resolution to interpret the time_increment 
+                               fields in the VOP headers */
+
+   int lumWidth;            /* Frame width of the Y component in pixels */
+   int lumHeight;           /* Frame height of the Y component in pixels */
+
+   u_char error_res_disable;/* Flag ON if no resynchronization markers are
+                               used inside frames. 
+                               When OFF it doesn't mean they ARE used. */
+   u_char data_partitioned; /* Flag indicating if data partitioning inside 
+                               a VP is used or not. */
+   u_char reversible_vlc;   /* flag indicating the usage of reversible 
+                               VLC codes */
+
+   /* the following parameters concern the input video signal,
+      see MPEG-4 visual spec. pp. 66-70, and "Note" in viddemux_mpeg.c 
+      Not used in the current implementatnion. */
+   int video_format;
+   int video_range;
+   int colour_primaries;    
+   int transfer_characteristics;
+   int matrix_coefficients;
+
+   /* the following parameters are used in the Video Buffering Verifier
+      (Annex D) to monitor the input bit buffer, complexity, memory buffer
+      used in the decoding process. The conformance of a stream can be checked
+      using these parameters. 
+      Not used in the current implementatnion. */
+   u_int32 bit_rate;
+   u_int32 vbv_buffer_size;
+   u_int32 vbv_occupancy;
+
+   char *user_data;         /* User Data if available */
+   int user_data_length;    /* Length of the recieved user data */
+   u_char fixed_vop_rate;       /* fixed vop rate indication, added for transcoding */
+} vdxVolHeader_t;
+/* {{-output"vdxVolHeader_t.txt"}} */
+
+/*
+ * vdxGovHeader_t
+ */
+
+/* {{-output"vdxGovHeader_t_info.txt" -ignore"*" -noCR}}
+   The vdxGetGovHeader function uses this structure to return GOV header data.
+   /MPEG-4/
+   {{-output"vdxGovHeader_t_info.txt"}} */
+
+/* {{-output"vdxGovHeader_t.txt"}} */
+typedef struct {
+   int time_stamp;              /* The time stamp value in the GOV Header */
+
+   u_char closed_gov;           /* only important if B-VOPs can be in the stream */
+   u_char broken_link;          /* only important if B-VOPs can be in the stream */
+
+   char *user_data;             /* User Data if available */
+   int user_data_length;        /* Length of the recieved user data */
+} vdxGovHeader_t;
+/* {{-output"vdxGovHeader_t.txt"}} */
+
+
+/*
+ * vdxGetVopHeaderInputParam_t
+ */
+
+/* {{-output"vdxGetVopHeaderInputParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the vdxGetVopHeader function. /MPEG-4/
+   {{-output"vdxGetVopHeaderInputParam_t_info.txt"}} */
+
+/* {{-output"vdxGetVopHeaderInputParam_t.txt"}} */
+typedef struct {
+
+    int time_increment_resolution; /* resolution of the time increment field */
+
+} vdxGetVopHeaderInputParam_t;
+/* {{-output"vdxGetVopHeaderInputParam_t.txt"}} */
+
+
+/*
+ * vdxVopHeader_t
+ */
+
+/* {{-output"vdxVopHeader_t_info.txt" -ignore"*" -noCR}}
+   The vdxGetVopHeader function uses this structure to return the picture
+   header parameters. /MPEG-4/
+   {{-output"vdxVopHeader_t_info.txt"}} */
+
+/* {{-output"vdxVopHeader_t.txt"}} */
+typedef struct {
+    int time_base_incr;         /* Increment of the modulo time base from the
+                                   previous VOP or GOV header in seconds */
+    int time_inc;             /* Time increment value of the current VOP,
+                                   plus the modulo time base = absolute time */
+
+    u_char vop_coded;           /* Flag: 1 - VOP coded;
+                                         0 - VOP not coded/skipped */
+    int coding_type;            /* VOP coding type is one of the following:
+                                       VDX_VOP_TYPE_I       MPEG-4 INTRA
+                                       VDX_VOP_TYPE_P       MPEG-4 INTER */
+
+    int rounding_type;          /* Rounding of the sub-pixel predictor
+                                   calculations: 0 or 1. */
+
+    int intra_dc_vlc_thr;       /* QP dependent switch control of coding the
+                                   Intra DC coefficient as separate/optimized or
+                                   as the other Intra AC. (0..7) */
+    int quant;                  /* Initial Quantizer value */
+
+    int fcode_forward;          /* For P-VOPs Motion Vector range control
+                                   1: [-16,16] .. 7:[-1024,1024] */
+} vdxVopHeader_t;
+/* {{-output"vdxVopHeader_t.txt"}} */
+
+
+/*
+ * vdxGetVideoPacketHeaderInputParam_t
+ */
+
+/* {{-output"vdxGetVideoPacketHeaderInputParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the vdxGetVideoPacketHeader function. /MPEG-4/
+   {{-output"vdxGetVideoPacketHeaderInputParam_t_info.txt"}} */
+
+/* {{-output"vdxGetVideoPacketHeaderInputParam_t.txt"}} */
+typedef struct {
+
+    int fcode_forward;          /* used for determining the resync_marker
+                                   length */
+    int time_increment_resolution; /* resolution of the time increment field */
+
+    int numOfMBs;               /* Number of MBs in a VOP */
+
+} vdxGetVideoPacketHeaderInputParam_t;
+/* {{-output"vdxGetVideoPacketHeaderInputParam_t.txt"}} */
+
+
+/*
+ * vdxVideoPacketHeader_t
+ */
+
+/* {{-output"vdxVideoPacketHeader_t_info.txt" -ignore"*" -noCR}}
+   The vdxGetVideoPacketHeader function uses this structure to return the
+   Number of the immediately following MB in the VOP and optionally confirm
+   header parameters. /MPEG-4/
+   {{-output"vdxVideoPacketHeader_t_info.txt"}} */
+
+/* {{-output"vdxVideoPacketHeader_t.txt"}} */
+typedef struct {
+
+    int currMBNum;              /* Number of the immediately following MB */
+    int quant;                  /* Quantizer used for the following MB */
+
+    u_char fHEC;                /* Flag for header extension code */
+
+    int time_base_incr;         /* Increment of the modulo time base from the
+                                   previous VOP or GOV header in seconds */
+    int time_inc;             /* Time increment value of the current VOP,
+                                   plus the modulo time base = absolute time */
+
+    int coding_type;            /* VOP coding type is one of the following:
+                                       VDX_VOP_TYPE_I       MPEG-4 INTRA
+                                       VDX_VOP_TYPE_P       MPEG-4 INTER */
+
+    int intra_dc_vlc_thr;       /* QP dependent switch control of coding the
+                                   Intra DC coefficient as separate/optimized or
+                                   as the other Intra AC. (0..7) */
+
+    int fcode_forward;          /* For P-VOPs Motion Vector range control
+                                   1: [-16,16] .. 7:[-1024,1024] */
+} vdxVideoPacketHeader_t;
+/* {{-output"vdxVideoPacketHeader_t.txt"}} */
+
+
+/*
+ * vdxGetPictureHeaderInputParam_t
+ */
+
+/* {{-output"vdxGetPictureHeaderInputParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the vdxGetPictureHeader function.
+   {{-output"vdxGetPictureHeaderInputParam_t_info.txt"}} */
+
+/* {{-output"vdxGetPictureHeaderInputParam_t.txt"}} */
+typedef struct {
+   int numStuffBits;             /* Number of stuffing bits before PSC */
+
+   int fCustomPCF;               /* Non-zero if custom picture clock frequency
+                                    is allowed. Otherwise zero. */
+
+   int fScalabilityMode;         /* Non-zero if the Temporal, SNR, and Spatial
+                                    Scalability mode (Annex O) is in use.
+                                    Otherwise zero. */
+
+   int fRPS;                     /* Non-zero if the Refence Picture Selection
+                                    mode (Annex N) is in use. Otherwise zero. */
+
+   bibFlushBits_t flushBits;     /* Pointers for bit buffer functions. */
+   bibGetBits_t getBits;         /* Needed to provide a possibly different */
+   bibShowBits_t showBits;       /* input mechanism for normal reading from
+                                    incoming bit-stream and for parsing
+                                    a picture header copy */
+} vdxGetPictureHeaderInputParam_t;
+/* {{-output"vdxGetPictureHeaderInputParam_t.txt"}} */
+
+
+/*
+ * vdxPictureHeader_t
+ * Defined in vdc263.h because Video Decoder Core exports the data structure.
+ */
+
+
+/*
+ * vdxSEI_t
+ * Defined in vdc263.h because Video Decoder Core exports the data structure.
+ */
+
+
+/*
+ * vdxGetGOBHeaderInputParam_t
+ */
+
+/* {{-output"vdxGetGOBHeaderInputParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the vdxGetGOBHeader function.
+   {{-output"vdxGetGOBHeaderInputParam_t_info.txt"}} */
+
+/* {{-output"vdxGetGOBHeaderInputParam_t.txt"}} */
+typedef struct {
+   int numStuffBits;             /* Number of stuffing bits before PSC */
+
+   int fCustomPCF;               /* Non-zero if custom picture clock frequency
+                                    is allowed. Otherwise zero. */
+
+   int fCPM;                     /* Non-zero if the Continuous Presence
+                                    Multipoint feature (Annex C) is in use.
+                                    Otherwise zero. */
+
+   int fRPS;                     /* Non-zero if the Refence Picture Selection
+                                    mode (Annex N) is in use. Otherwise zero. */
+} vdxGetGOBHeaderInputParam_t;
+/* {{-output"vdxGetGOBHeaderInputParam_t.txt"}} */
+
+
+/*
+ * vdxGOBHeader_t
+ */
+
+/* {{-output"vdxGOBHeader_t_info.txt" -ignore"*" -noCR}}
+   The vdxGetGOBHeader function uses this structure to return the GOB
+   header parameters.
+   {{-output"vdxGOBHeader_t_info.txt"}} */
+
+/* {{-output"vdxGOBHeader_t.txt"}} */
+typedef struct {
+   int gn;                       /* Group Number (GN) field */
+
+   int gfid;                     /* GOB Frame ID (GFID) field */
+
+   int gquant;                   /* Quantizer Information (GQUANT) field */
+
+   /* If CPM (Annex C) is in use */
+      int gsbi;                  /* GOB Sub-Bitstream Indicator (GSBI) field */
+
+   /* If the Reference Picture Selection mode is in use */
+      int tri;                   /* Temporal Reference Indicator (TRI) field */
+      int trpi;                  /* Temporal Reference for Prediction
+                                    Indicator (TRPI) field */
+
+      /* If tri == 1 */
+         int tr;                 /* Temporal Reference (TR) field */
+
+      /* If trpi == 1 */
+         int trp;                /* Temporal Reference for Prediction (TRP) 
+                                    field */
+} vdxGOBHeader_t;
+/* {{-output"vdxGOBHeader_t.txt"}} */
+
+
+/*
+ * vdxGetSliceHeaderInputParam_t
+ */
+
+/* {{-output"vdxGetSliceHeaderInputParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the vdxGetSliceHeader function.
+   {{-output"vdxGetSliceHeaderInputParam_t_info.txt"}} */
+
+/* {{-output"vdxGetSliceHeaderInputParam_t.txt"}} */
+typedef struct {
+   int sliceHeaderAfterPSC;      /* If the slice follows a PSC, the value 
+                                    should be 1 */ 
+
+   int numStuffBits;             /* Number of stuffing bits before SSC */
+
+   int fCPM;                     /* Non-zero if the Continuous Presence
+                                    Multipoint feature (Annex C) is in use.
+                                    Otherwise zero. */
+
+   int fRPS;                     /* Non-zero if the Refence Picture Selection
+                                    mode (Annex N) is in use. Otherwise zero. */
+
+   int mbaFieldWidth;            /* MBA Field width */
+   int mbaMaxValue;              /* MBA maximum value. See Table K.2/H.263 */
+
+   int fRectangularSlices;       /* 0 = free-running slices, 
+                                    1 = rectangular slices */
+   
+   int swiFieldWidth;            /* SWI Field width */
+   int swiMaxValue;              /* SWI maximum value. See Table K.3/H.263 */
+} vdxGetSliceHeaderInputParam_t;
+/* {{-output"vdxGetSliceHeaderInputParam_t.txt"}} */
+
+/*
+ * vdxSliceHeader_t
+ */
+
+/* {{-output"vdxSliceHeader_t_info.txt" -ignore"*" -noCR}}
+   The vdxGetSliceHeader function uses this structure to return the Slice
+   header parameters.
+   {{-output"vdxSliceHeader_t_info.txt"}} */
+
+/* {{-output"vdxSliceHeader_t.txt"}} */
+typedef struct {
+   /* If CPM (Annex C) is in use */
+      int ssbi;                   /* Slice Sub-Bitstream Indicator (SSBI) */
+
+      int gn;                    /* Group Number (GN) field */
+
+      int sbn;                   /* Sub-Bitstream number */
+
+   int mba;                      /* Macroblock Address (MBA) */
+
+   /* If not the slice just after the PSC */
+      int squant;                /* Quantizer Inforation (SQUANT) */
+
+   /* If fRectangularSlices */
+      int swi;                   /* Slice Width Indication in Macroblocks (SWI)*/
+      
+   int gfid;                     /* GOB Frame ID (GFID) field */
+   /* If the Reference Picture Selection mode is in use */
+      int tri;                   /* Temporal Reference Indicator (TRI) field */
+      int trpi;                  /* Temporal Reference for Prediction
+                                    Indicator (TRPI) field */
+
+      /* If tri == 1 */
+         int tr;                 /* Temporal Reference (TR) field */
+
+      /* If trpi == 1 */
+         int trp;                /* Temporal Reference for Prediction (TRP) 
+                                    field */
+
+} vdxSliceHeader_t;
+/* {{-output"vdxSliceHeader_t.txt"}} */
+
+/*
+ * vdxGetIMBLayerInputParam_t
+ */
+
+/* {{-output"vdxGetIMBLayerInputParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the vdxGetIMBLayer function.
+   {{-output"vdxGetIMBLayerInputParam_t_info.txt"}} */
+
+/* {{-output"vdxGetIMBLayerInputParam_t.txt"}} */
+typedef struct {
+   int fMQ;                      /* Modified Quantization */
+   int quant;                    /* Current QUANT */
+   int fAIC;                     /* Advanced Intra Coding Flag */
+   int fSS;                      /* Slice Structured Mode Flag */
+   u_char fMPEG4;                /* MPEG4 or H.263 */
+} vdxGetIMBLayerInputParam_t;
+/* {{-output"vdxGetIMBLayerInputParam_t.txt"}} */
+
+
+/*
+ * vdxGetDataPartitionedIMBLayerInputParam_t
+ */
+
+/* {{-output"vdxGetDataPartitionedIMBLayerInputParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the vdxGetDataPartitionedIMBLayer function. /MPEG-4/
+   {{-output"vdxGetDataPartitionedIMBLayerInputParam_t_info.txt"}} */
+
+/* {{-output"vdxGetDataPartitionedIMBLayerInputParam_t.txt"}} */
+typedef struct {
+   int intra_dc_vlc_thr;
+   int quant;                    /* Current QUANT */
+} vdxGetDataPartitionedIMBLayerInputParam_t;
+/* {{-output"vdxGetDataPartitionedIMBLayerInputParam_t.txt"}} */
+
+
+/*
+ * vdxIMBLayer_t
+ */
+
+/* {{-output"vdxIMBLayer_t_info.txt" -ignore"*" -noCR}}
+   The vdxGetIMBLayer function uses this structure to return
+   the macroblock header parameters.
+   {{-output"vdxIMBLayer_t_info.txt"}} */
+
+/* {{-output"vdxIMBLayer_t.txt"}} */
+typedef struct {
+	int mcbpc;                     /* Macroblock type and the coded block 
+																    pattern for chrominance */
+
+   int cbpc;                     /* Coded Block Pattern for Chrominance,
+                                    bit 1 is for U and bit 0 is for V,
+                                    use vdxIsUCoded and vdxIsVCoded macros 
+                                    to access this value */
+
+   int cbpy;                     /* Coded Block Pattern for Luminance,
+                                    bit 3 is for block 1, ..., 
+                                    bit 0 is for block 4,
+                                    use vdxIsYCoded macro to access this 
+                                    value */
+
+/*** MPEG-4 REVISION ***/
+   u_char ac_pred_flag;          /* "1" AC prediction used, "0" not */
+/*** End MPEG-4 REVISION ***/
+
+   int quant;                    /* New (possibly updated) QUANT */
+
+   int predMode;                 /* Prediction Mode used in Annex I
+                                    0 (DC Only)
+                                    1 (Vertical DC&AC)
+                                    2 (Horizontal DC&AC) */
+   
+   int mbType;                   /* 0..5, see table 9/H.263 */
+
+} vdxIMBLayer_t;
+/* {{-output"vdxIMBLayer_t.txt"}} */
+
+
+/*
+ * vdxGetPPBMBLayerInputParam_t
+ */
+
+/* {{-output"vdxGetPPBMBLayerInputParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the vdxGetPPBMBLayer function.
+   {{-output"vdxGetPPBMBLayerInputParam_t_info.txt"}} */
+
+/* {{-output"vdxGetPPBMBLayerInputParam_t.txt"}} */
+typedef struct {  
+   int pictureType;              /* Picture type is one of the following:
+                                       VDX_PIC_TYPE_P       INTER
+                                       VDX_PIC_TYPE_PB      PB (Annex G)
+                                       VDX_PIC_TYPE_IPB     Improved PB */
+
+   /* See the description of vdxPictureHeader_t for the following flags. */
+   int fPLUSPTYPE;
+   int fUMV;
+   int fAP;
+   int fDF;
+   int fMQ;
+
+   int fCustomSourceFormat;      /* Flag indicating if custom source format 
+                                    is used */
+
+
+/*** MPEG-4 REVISION ***/
+   u_char fMPEG4;                /* MPEG4 or H.263 */
+   int f_code;
+/*** End MPEG-4 REVISION ***/
+
+   int quant;                    /* Current QUANT */
+
+   int fFirstMBOfPicture;        /* Non-zero if the macroblock is the first
+                                    (top-left) one of the picture */
+
+   int fAIC;                     /* Advanced Intra Coding Flag */
+} vdxGetPPBMBLayerInputParam_t;
+/* {{-output"vdxGetPPBMBLayerInputParam_t.txt"}} */
+
+
+/*
+ * vdxGetDataPartitionedPMBLayerInputParam_t
+ */
+
+/* {{-output"vdxGetDataPartitionedPMBLayerInputParam_t_info.txt" -ignore"*" -noCR}}
+   This structure is used to pass input parameters to
+   the vdxGetDataPartitionedPMBLayer function. /MPEG-4/
+   {{-output"vdxGetDataPartitionedPMBLayerInputParam_t_info.txt"}} */
+
+/* {{-output"vdxGetDataPartitionedPMBLayerInputParam_t.txt"}} */
+typedef struct {
+   int intra_dc_vlc_thr;
+   int quant;                    /* Current QUANT */
+   int f_code;
+} vdxGetDataPartitionedPMBLayerInputParam_t;
+/* {{-output"vdxGetDataPartitionedPMBLayerInputParam_t.txt"}} */
+
+
+/*
+ * vdxPPBMBLayer_t
+ */
+
+/* {{-output"vdxPPBMBLayer_t_info.txt" -ignore"*" -noCR}}
+   The vdxGetPPBMBLayer function uses this structure to return
+   the macroblock header parameters.
+   {{-output"vdxPPBMBLayer_t_info.txt"}} */
+
+/* {{-output"vdxPPBMBLayer_t.txt"}} */
+typedef struct {
+	 int mcbpc;                    /* Macroblock type and the coded block 
+																    pattern for chrominance */
+
+	 int fCodedMB;                 /* 1 if the macroblock is coded. 
+                                    Otherwise 0. */
+
+   int mbType;                   /* 0..5, see table 9/H.263 */
+
+   int mbClass;                  /* VDX_MB_INTRA or VDX_MB_INTER */
+
+   int cbpc;                     /* Coded Block Pattern for Chrominance,
+                                    bit 1 is for U and bit 0 is for V,
+                                    use vdxIsUCoded and vdxIsVCoded macros 
+                                    to access this value */
+
+   int cbpy;                     /* Coded Block Pattern for Luminance,
+                                    bit 3 is for block 1, ..., 
+                                    bit 0 is for block 4,
+                                    use vdxIsYCoded macro to access this 
+                                    value */
+
+   int cbpb;                     /* Coded Block Pattern for B-blocks,
+                                    bit 5 is for block 1, ..., 
+                                    bit 0 is for block 6 */
+
+/*** MPEG-4 REVISION ***/
+   u_char ac_pred_flag;          /* "1" AC prediction used, "0" not */
+/*** End MPEG-4 REVISION ***/
+
+   int quant;                    /* New (possibly updated) QUANT */
+                           
+   int numMVs;                   /* Number of motion vectors for the MB,
+                                    0 if MVD is not in the stream,
+                                    1 if MVD but not MVD2-4 is in the stream,
+                                    4 if MVD and MVD2-4 is in the stream */
+
+   /* Only the number of MVs indicated in the numMVs member is valid
+      in the following arrays. */
+   int mvdx[4];                  /* Horizontal components of MVD1-4,
+                                    index to table 14/H.263 */
+   int mvdy[4];                  /* Vertical components of MVD1-4,
+                                    index to table 14/H.263 */
+
+   int fMVDB;                    /* 1 = MVDB exists in the bitstream,
+                                    i.e. mvdbx and mvdby are valid */
+
+   int mvdbx;                    /* Horizontal components of MVDB,
+                                    index to table 14/H.263 */
+   int mvdby;                    /* Vertical components of MVDB,
+                                    index to table 14/H.263 */
+   int predMode;                 /* Prediction Mode used in Annex I
+                                    0 (DC Only)
+                                    1 (Vertical DC&AC)
+                                    2 (Horizontal DC&AC) */
+   int IPBPredMode;              /* Prediction Modes used in annex M
+                                    0  Bidirectional prediction
+                                    1  Forward prediction
+                                    2  Backward prediction  */
+} vdxPPBMBLayer_t;
+/* {{-output"vdxPPBMBLayer_t.txt"}} */
+
+
+/*
+ * vdxIMBListItem_t
+ */
+
+/* {{-output"vdxIMBListItem_t_info.txt" -ignore"*" -noCR}}
+   List Item which is used to build a queue of Intra MBs during the data
+   partitioned decoding of an I-VOP. /MPEG-4/
+   The vdxGetDataPartitionedIMBLayer function uses this structure.
+   {{-output"vdxIMBListItem_t_info.txt"}} */
+
+/* {{-output"vdxIMBListItem_t.txt"}} */
+
+
+/* Data item recording for data partitioned transcoding */
+#ifndef VDT_OPERATION
+#define VDT_OPERATION
+#define VDT_SET_START_POSITION(mb,item,byte,bit) \
+{\
+	(mb)->DataItemStartByteIndex[(item)] = (byte);\
+     (mb)->DataItemStartBitIndex[(item)] = (bit);\
+}
+
+#define VDT_SET_END_POSITION(mb,item,byte,bit) \
+{\
+	(mb)->DataItemEndByteIndex[(item)] = (byte);\
+     (mb)->DataItemEndBitIndex[(item)] = (bit);\
+}
+#endif
+
+
+
+typedef struct {
+   DLST_ITEM_SKELETON
+
+/* for data partitioned transcoding
+   array ordering: 0: mcbpc, 1: dquant, 2: cbpy, 3: ac_pred_flag, 4~9: intraDCs, 10: mv, 11: mb stuffing
+ */
+   int mcbpc;
+   int DataItemStartByteIndex[12];
+   int DataItemStartBitIndex[12];
+   int DataItemEndByteIndex[12];
+   int DataItemEndBitIndex[12];
+   int dquant;
+
+   int DC[6];                 /* DC component */
+   int quant;                 /* QUANT */
+   int cbpc;                  /* Coded Block Pattern for Chrominance */
+   int cbpy;                  /* Coded Block Pattern for Luminance */
+   u_char ac_pred_flag;       /* "1" AC prediction used, "0" not */
+   u_char switched;           /* intra_dc_vlc_thr indicated switch 
+                                 to Intra AC VLC coding of the DC coeff
+                                 intstead of the usual DC VLC coding 
+                                 at this QP */
+} vdxIMBListItem_t;
+/* {{-output"vdxIMBListItem_t.txt"}} */
+
+
+/*
+ * vdxPMBListItem_t
+ */
+
+/* {{-output"vdxPMBListItem_t_info.txt" -ignore"*" -noCR}}
+   List Item which is used to build a queue of Inter MBs during the data
+   partitioned decoding of a P-VOP. /MPEG-4/
+   The vdxGetDataPartitionedPMBLayer function uses this structure.
+   {{-output"vdxPMBListItem_t_info.txt"}} */
+
+/* {{-output"vdxPMBListItem_t.txt"}} */
+typedef struct {
+   DLST_ITEM_SKELETON
+/* for data partitioned transcoding
+   array ordering: 0: mcbpc, 1: dquant, 2: cbpy, 3: ac_pred_flag, 4~9: intraDCs, 10: mv, 11: mb stuffing
+ */
+   int mcbpc;
+   int DataItemStartByteIndex[12];
+   int DataItemStartBitIndex[12];
+   int DataItemEndByteIndex[12];
+   int DataItemEndBitIndex[12];
+   int dquant;
+   int mv_x[4];                /* horizontal componenet of 1-4 MVs */ 
+   int mv_y[4];                /* vertical componenet of 1-4 MVs */
+
+   u_char fCodedMB;           /* 1 if the macroblock is coded. 
+                                    Otherwise 0. */
+   int mbType;                /* 0..5, see table 9/H.263 */
+   int mbClass;               /* VDX_MB_INTRA or VDX_MB_INTER */
+   int DC[6];                 /* DC component */
+   int quant;                 /* QUANT */
+   int cbpc;                  /* Coded Block Pattern for Chrominance */
+   int cbpy;                  /* Coded Block Pattern for Luminance */
+   u_char ac_pred_flag;       /* "1" AC prediction used, "0" not */
+   u_char switched;           /* intra_dc_vlc_thr indicated switch 
+                                 to Intra AC VLC coding of the DC coeff
+                                 intstead of the usual DC VLC coding 
+                                 at this QP */
+   int numMVs;                /* Number of motion vectors for the MB */
+   int mvx[4];                /* horizontal componenet of 1-4 MVs */ // actually it is dMV
+   int mvy[4];                /* vertical componenet of 1-4 MVs */
+} vdxPMBListItem_t;
+/* {{-output"vdxPMBListItem_t.txt"}} */
+
+
+/*
+ * Macros
+ */
+
+/* These arrays are intialized in viddemux.c and needed in the vdxIsYXCoded 
+   macros. */
+extern const int vdxBlockIndexToCBPYMask[5];
+extern const int vdxYBlockIndexToCBPBMask[5];
+
+/* {{-output"vdxIsXCoded.txt"}} */
+/*
+ * vdxIsYCoded
+ * vdxIsUCoded
+ * vdxIsVCoded
+ * vdxIsYBCoded
+ * vdxIsUBCoded
+ * vdxIsVBCoded
+ *
+ * Parameters:
+ *    for vdxIsYCoded:
+ *       cbpy                    coded block for luminance
+ *       blockIndex              index for luminance block 1..4
+ *
+ *    for vdxIsUCoded and vdxIsVCoded:
+ *       cbpc                    coded block pattern for chrominance
+ *
+ *    for vdxIsXBCoded:
+ *       cbpb                    coded block pattern for B blocks
+ *       blockIndex              index for B luminance block 1..4
+ *
+ * Function:
+ *    This macros access the coded block bit patterns.
+ *
+ * Returns:
+ *    0 if the requested block is not coded
+ *    non-zero if the requested block is coded
+ *
+ */
+
+#define vdxIsYCoded(cbpy, blockIndex) \
+   ((cbpy) & vdxBlockIndexToCBPYMask[(blockIndex)])
+
+#define vdxIsUCoded(cbpc) ((cbpc) & 2)
+#define vdxIsVCoded(cbpc) ((cbpc) & 1)
+
+#define vdxIsYBCoded(cbpb, blockIndex) \
+   ((cbpb) & vdxYBlockIndexToCBPBMask[(blockIndex)])
+
+#define vdxIsUBCoded(cbpb) ((cbpb) & 2)
+#define vdxIsVBCoded(cbpb) ((cbpb) & 1)
+/* {{-output"vdxIsXCoded.txt"}} */
+
+
+/*
+ * Function prototypes
+ */
+
+/* Picture Layer Global Functions */
+class CMPEG4Transcoder;
+
+int vdxGetVolHeader(
+   bibBuffer_t *inBuffer,
+   vdxVolHeader_t *header,
+   int *bitErrorIndication,
+   int getInfo, int *aByteIndex, int *aBitIndex,
+   CMPEG4Transcoder *hTranscoder);
+
+int vdxGetGovHeader(
+   bibBuffer_t *inBuffer,
+   vdxGovHeader_t *header,
+   int *bitErrorIndication);
+
+int vdxGetVopHeader(
+   bibBuffer_t *inBuffer,
+   const vdxGetVopHeaderInputParam_t *inpParam,
+   vdxVopHeader_t *header,
+   int * ModuloByteIndex,
+   int * ModuloBitIndex,
+   int * TimeIncByteIndex,
+   int * TimeIncBitIndex,
+   int *bitErrorIndication);
+
+int vdxGetPictureHeader(
+   bibBuffer_t *inBuffer, 
+   const vdxGetPictureHeaderInputParam_t *inpParam,
+   vdxPictureHeader_t *header,
+   int *bitErrorIndication);
+
+int vdxFlushSEI(
+   bibBuffer_t *inBuffer,
+   int *bitErrorIndication);
+
+int vdxGetSEI(
+   bibBuffer_t *inBuffer,
+   int *ftype,
+   int *dsize,
+   u_char *parameterData,
+   int *fLast,
+   int *bitErrorIndication);
+
+int vdxGetAndParseSEI(
+   bibBuffer_t *inBuffer,
+   int fPLUSPTYPE,
+   int numScalabilityLayers,
+   vdxSEI_t *sei,
+   int *bitErrorIndication);
+
+int vdxGetUserData(bibBuffer_t *inBuffer,
+   char *user_data, int *user_data_length,
+   int *bitErrorIndication);
+
+/* GOB/Video Packet Layer Global Functions */
+
+int vdxGetGOBHeader(
+   bibBuffer_t *inBuffer, 
+   const vdxGetGOBHeaderInputParam_t *inpParam,
+   vdxGOBHeader_t *header,
+   int *bitErrorIndication,
+   int aColorEffect,
+   int* aStartByteIndex,
+   int* aStartBitIndex,
+   CMPEG4Transcoder *hTranscoder);
+
+int vdxGetVideoPacketHeader(
+   bibBuffer_t *inBuffer,
+   const vdxGetVideoPacketHeaderInputParam_t *inpParam,
+   vdxVideoPacketHeader_t *header,
+   int *bitErrorIndication);
+
+/* Slice Layer Global Functions*/
+
+int vdxGetSliceHeader(
+   bibBuffer_t *inBuffer, 
+   const vdxGetSliceHeaderInputParam_t *inpParam,
+   vdxSliceHeader_t *header,
+   int *bitErrorIndication);
+
+void vdxGetMBAandSWIValues(
+   int width,
+   int height,
+   int fRRU,
+   int *mbaFieldWidth,
+   int *mbaMaxValue,
+   int *swiFieldWidth,
+   int *swiMaxValue);
+
+/* Macroblock Layer Global Functions */
+
+
+int vdxGetIMBLayer(
+   bibBuffer_t *inBuffer, 
+	 bibBuffer_t *outBuffer, 
+   bibBufferEdit_t *bufEdit,
+   int aColorEffect, 
+	 int *StartByteIndex, 
+	 int *StartBitIndex, 
+   TBool aGetDecodedFrame, 
+   const vdxGetIMBLayerInputParam_t *inpParam,
+   vdxIMBLayer_t *outParam,
+   int *bitErrorIndication,
+   CMPEG4Transcoder *hTranscoder);
+
+
+int vdxGetPPBMBLayer(
+   bibBuffer_t *inBuffer, 
+   bibBuffer_t *outBuffer, 
+   bibBufferEdit_t *bufEdit,
+   int aColorEffect,
+	 int *aStartByteIndex, 
+	 int *aStartBitIndex, 
+   TBool aGetDecodedFrame, 
+   int *bwMBType, 
+   const vdxGetPPBMBLayerInputParam_t *inpParam,
+   vdxPPBMBLayer_t *outParam,
+   int *bitErrorIndication,
+   CMPEG4Transcoder *hTranscoder);
+
+
+int vdxGetDataPartitionedIMBLayer_Part1(
+   bibBuffer_t *inBuffer, bibBuffer_t *outBuffer, bibBufferEdit_t *bufEdit, 
+	 int aColorEffect, int *aStartByteIndex, int *aStartBitIndex, 
+	 CMPEG4Transcoder *hTranscoder, 
+   const vdxGetDataPartitionedIMBLayerInputParam_t *inpParam,
+   dlst_t *MBList,
+   int *bitErrorIndication);
+
+int vdxGetDataPartitionedIMBLayer_Part2(
+   bibBuffer_t *inBuffer, bibBuffer_t *outBuffer, bibBufferEdit_t *bufEdit, 
+	 int aColorEffect, int *aStartByteIndex, int *aStartBitIndex, 
+   dlst_t *MBList,
+   int numMBsInVP,
+   int *bitErrorIndication);
+
+int vdxGetDataPartitionedPMBLayer_Part1(
+   bibBuffer_t *inBuffer, bibBuffer_t *outBuffer, bibBufferEdit_t *bufEdit, 
+	 int aColorEffect, int *aStartByteIndex, int *aStartBitIndex, 
+   const vdxGetDataPartitionedPMBLayerInputParam_t *inpParam,
+   dlst_t *MBList,
+   int *bitErrorIndication);
+
+int vdxGetDataPartitionedPMBLayer_Part2(
+   bibBuffer_t *inBuffer,
+   bibBuffer_t *outBuffer, 
+   bibBufferEdit_t *bufEdit,
+   int aColorEffect, int *aStartByteIndex, int *aStartBitIndex, 
+   CMPEG4Transcoder *hTranscoder, 
+   const vdxGetDataPartitionedPMBLayerInputParam_t *inpParam,
+   dlst_t *MBList,
+   int *bitErrorIndication);
+
+/* Block Layer Global Functions */
+
+int vdxGetIntraDCTBlock(
+   bibBuffer_t *inBuffer, 
+   int fCodedBlock,
+   int *block,
+   int *bitErrorIndication,
+   int fMQ,
+   int qp);
+
+int vdxGetIntraDC(
+   bibBuffer_t *inBuffer,
+	 bibBuffer_t *outBuffer, 
+   bibBufferEdit_t *bufEdit,
+   int aColorEffect, 
+	 int *aStartByteIndex, 
+	 int *aStartBitIndex,    
+	 int compnum,
+	 int *IntraDCSize, 
+   int *IntraDCDelta, 
+	 int *bitErrorIndication);
+
+int vdxGetMPEGIntraDCTBlock(
+   bibBuffer_t *inBuffer, 
+   int startIndex,
+   int *block,
+   int *bitErrorIndication);
+
+int vdxGetDCTBlock(
+   bibBuffer_t *inBuffer,
+   int startIndex,
+   u_char fMPEG4EscapeCodes,
+   int *block,
+   int *bitErrorIndication,
+   int fMQ,
+   int qp,
+   int *fEscapeCodeUsed);
+
+int vdxGetAdvIntraDCTBlock(
+   bibBuffer_t *inBuffer, 
+   int fCodedBlock,
+   int *block,
+   int *bitErrorIndication,
+   int predMode,
+   int fMQ,
+   int qp);
+
+int vdxGetAdvDCTBlock(
+   bibBuffer_t *inBuffer, 
+   int startIndex,
+   int *block,
+   int *bitErrorIndication,
+   int predMode,
+   int fMQ,
+   int qp);
+
+int vdxGetRVLCDCTBlock(
+   bibBuffer_t *inBuffer, 
+   int startIndex,
+   int fIntraBlock,
+   int *block,
+   int *bitErrorIndication);
+
+int vdxGetRVLCDCTBlockBackwards(
+   bibBuffer_t *inBuffer, 
+   int startIndex,
+   int fIntraBlock,
+   int *block,
+   int *bitErrorIndication);
+
+
+
+int vdxChangeBlackAndWhiteHeaderIntraIMB(bibBufferEdit_t *bufEdit, 
+																				 int mcbpcIndex,
+																				 int StartByteIndex, 
+																				 int StartBitIndex);
+
+int vdxChangeBlackAndWhiteHeaderInterPMB(bibBufferEdit_t *bufEdit, 
+																				 int mcbpcIndex,
+																				 int StartByteIndex, 
+																				 int StartBitIndex);
+
+
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/inc/zigzag.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Definition of the zigzag tables.
+*
+*/
+
+
+#ifndef _ZIGZAG_H_
+#define _ZIGZAG_H_
+
+/*
+ * Structs and typedefs
+ */
+
+/* Normal zigzag */
+static const int zigzag[64] = {
+  0, 1, 5, 6,14,15,27,28,
+  2, 4, 7,13,16,26,29,42,
+  3, 8,12,17,25,30,41,43,
+  9,11,18,24,31,40,44,53,
+  10,19,23,32,39,45,52,54,
+  20,22,33,38,46,51,55,60,
+  21,34,37,47,50,56,59,61,
+  35,36,48,49,57,58,62,63
+};
+
+/* Horizontal zigzag */
+static const int zigzag_h[64] = {
+     0, 1, 2, 3,10,11,12,13,
+     4, 5, 8, 9,17,16,15,14,
+     6, 7,19,18,26,27,28,29,
+    20,21,24,25,30,31,32,33,
+    22,23,34,35,42,43,44,45,
+    36,37,40,41,46,47,48,49,
+    38,39,50,51,56,57,58,59,
+    52,53,54,55,60,61,62,63
+};
+
+/* Vertical zigzag */
+static const int zigzag_v[64] = {
+     0, 4, 6,20,22,36,38,52,
+     1, 5, 7,21,23,37,39,53,
+     2, 8,19,24,34,40,50,54,
+     3, 9,18,25,35,41,51,55,
+    10,17,26,30,42,46,56,60,
+    11,16,27,31,43,47,57,61,
+    12,15,28,32,44,48,58,62,
+    13,14,29,33,45,49,59,63
+};
+
+/* Inverse normal zigzag */
+static const int zigzag_i[64] =
+{
+     0, 1, 8,16, 9, 2, 3,10,
+    17,24,32,25,18,11, 4, 5,
+    12,19,26,33,40,48,41,34,
+    27,20,13, 6, 7,14,21,28,
+    35,42,49,56,57,50,43,36,
+    29,22,15,23,30,37,44,51,
+    58,59,52,45,38,31,39,46,
+    53,60,61,54,47,55,62,63
+};
+
+#endif /* ifndef _ZIGZAG_H_ */
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/MPEG4Transcoder.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,4335 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation for MPEG4(H263) video transcoder. Operations may include:
+* 1. Bitstream Copying 
+* 2. BlackAndWhite Effect
+* 3. MPEG4 to VDT_RESYN (Simple profile)
+* 4. H.263 -> MPEG4 (Open Loop structure, no MV refinement)
+* 5. MPEG4 -> H263, partial implemented 
+*
+* We call functions 2~5 as transcoding functions since they involve MB level data processing
+*    
+* Note:
+* When RVLC is used and errors occur during  forward decoding, 
+* We don't do backward transcoding, the rest of the data is discarded, 
+*
+*/
+
+
+
+/* 
+* Includes
+*/
+#include "MPEG4Transcoder.h"
+#include "debug.h"
+
+/* Print macro */
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+/* 
+* Defines and Typedefs
+*/
+typedef unsigned int         uint32;
+
+#define EInternalAssertionFailure 1000
+#define VDT_NO_DATA(a, b, c, d) ((a) == (c) && (b) == (d))
+
+const int KDataNotValid = -1; 
+const int KMpeg4VopTimeIncrementResolutionLength = 16; 
+const int KOutputMpeg4TimeIncResolution = 30000;
+const int KShortHeaderMpeg4VosSize = 14; 
+const int KH263ToMpeg4VosSize = 28; 
+
+
+
+/*Bit stream formating*/
+#define WRITE32(op, x) sPutBits((op), 16, ((uint32)(x)) >> 16);       \
+sPutBits((op), 16, (x) & 0x0000ffff)
+
+/* 
+* Constants 
+*/
+#ifdef _DEBUG
+const TUint KInitialBufferSize = 200000; /* MPEG4 Simple Visual Profile (Levels 0,1,2,3) initial frame data buffer size vga support */
+#endif
+                                                                                /* 
+                                                                                * Function Declarations 
+*/
+
+//Static Functions 
+
+static void sStuffBitsH263(bibBuffer_t *outBuffer);
+static TVedVideoBitstreamMode sGetMPEG4Mode(int error_resilience_disable, int dp, int rvlc);
+static int sFindCBP(int *mbdata, int fUseIntraDCVLC);
+
+
+
+void vdtPutInterMBCMT(bibBuffer_t *outBuffer, int coeffStart, int *coeff, int *numTextureBits, int svh);
+void vdtPutIntraMBCMT(bibBuffer_t *outBuffer, int *coeff, int *numTextureBits, int index,  int skipDC, int skipAC);
+void vbmEncodeMVDifferential(int32 mvdx, int32 mvdy, int32 fCode, bibBuffer_t *outBuffer);
+void vbmGetH263IMCBPC(int lDQuant, int vopCodingType, int colorEffect, int cbpy, int& mcbpcVal, int& len);
+void vbmGetH263PMCBPC(int lDQuant, int colorEffect, int cbpy, int& mcbpcVal, int& len);
+tBool vbmMVOutsideBound(tMBPosition *mbPos, tMotionVector* bestMV, tBool halfPixel);
+void vbmMvPrediction(tMBInfo *mbi, int32 mBCnt, tMotionVector *predMV,  int32 mbinWidth);
+void vbmPutInterMB(tMBPosition* mbPos, bibBuffer_t *outBuf, dmdPParam_t *paramMB, tMotionVector *initPred, 
+                                     int32 noOfPredictors, u_int32 vopWidth, u_int32 vopHeight, int32 searchRange, 
+                                     int32 mbNo, int32* numTextureBits, int16 colorEffect, tMBInfo *mbsinfo);
+
+void sPutBits (bibBuffer_t *buf, int numBits, unsigned int value);  //forward decl
+
+/* 
+* Function Definitions 
+*/
+
+/*
+* sStuffBitsH263
+*
+* Parameters: 
+*    outBuffer    output buffer
+*
+* Function:
+*    This function stuffs bits for H.263 format
+* Returns:
+*    None
+* Error codes:
+*    None.
+*
+*/
+static void sStuffBitsH263(bibBuffer_t *outBuffer)
+{
+    const int stuffingBits[8][2] = { {1,0}, {2,0}, {3,0}, {4,0}, {5,0}, {6,0}, {7,0}, {0,0} };
+    
+    VDTASSERT(outBuffer->baseAddr);
+    
+    /* find the number of stuffing bits to insert in the output buffer */
+    int bi = outBuffer->bitIndex;
+    int newNumBits = stuffingBits[bi][0]; 
+    int newValue = stuffingBits[bi][1]; 
+    sPutBits(outBuffer, newNumBits, newValue);
+        
+    return;
+}
+
+
+
+/*
+* sGetMPEG4Mode
+*
+* Parameters: 
+*    
+*
+* Function:
+*    This function gets the mode of the MPEG-4 bitstream
+* Returns:
+*    Nothing
+* Error codes:
+*    None.
+*
+*/
+static TVedVideoBitstreamMode sGetMPEG4Mode(int error_resilience_disable, int dp, int rvlc)
+{
+    TVedVideoBitstreamMode mode = EVedVideoBitstreamModeUnknown;
+    int combination = ((!error_resilience_disable) << 2) | (dp << 1) | rvlc;
+    switch (combination)
+    {
+        case 0:
+            mode = EVedVideoBitstreamModeMPEG4Regular;
+            break;
+        case 2:
+            mode = EVedVideoBitstreamModeMPEG4DP;
+            break;
+        case 3:
+            mode = EVedVideoBitstreamModeMPEG4DP_RVLC;
+            break;
+        case 4:
+            mode = EVedVideoBitstreamModeMPEG4Resyn;
+            break;
+        case 6:
+            mode = EVedVideoBitstreamModeMPEG4Resyn_DP;
+            break;
+        case 7:
+            mode = EVedVideoBitstreamModeMPEG4Resyn_DP_RVLC;
+            break;
+        default:
+            mode = EVedVideoBitstreamModeUnknown;
+    }
+    
+    return mode;
+}
+
+
+/* {{-output"vdtGetVideoBitstreamInfo.txt"}} */
+/*
+* sFindCBP
+*
+* Parameters: 
+*    mbdata          Contains the actual MB data to be quantized
+*    fUseIntraDCVLC  ON for INTRA, OFF for INTER
+*
+* Function:
+*    This function finds the coded bit pattern of the MB 
+* Returns:
+*    Coded Block Pattern.
+* Error codes:
+*    None.
+*
+*/
+static int sFindCBP(int *mbdata, int fUseIntraDCVLC)
+{
+    int coeffCnt;
+    int *block;
+    int blkCnt;
+    int cbpFlag = 0;
+    int codedBlockPattern = 0;
+
+    for (blkCnt = 0; blkCnt < 6; blkCnt++)
+    {   
+        cbpFlag = 0;
+        codedBlockPattern <<= 1;
+        block = &mbdata[blkCnt * BLOCK_COEFF_SIZE];
+        for (coeffCnt = fUseIntraDCVLC; coeffCnt < BLOCK_COEFF_SIZE;
+             coeffCnt++)
+             {
+                 if (block[coeffCnt])
+                 {
+                     cbpFlag = 1;
+                     codedBlockPattern |= cbpFlag;
+                     break;
+                 }
+             }
+    }
+    
+    return codedBlockPattern;
+}   
+
+
+
+
+
+
+/* {{-output"sPutBits.txt"}} */
+/*
+* sPutBits
+*
+* Parameters:
+*          outBuf           output buffer
+*           numBits         number of bits to output
+*           value           new value
+*
+* Function:
+*    This function puts some bits to the output buffer
+* Returns:
+*    Nothing.
+* Error codes:
+*    None.
+*
+*/
+void sPutBits (bibBuffer_t *buf, int numBits, unsigned int value)
+{
+    
+    bibEditParams_t edParam;
+    
+    edParam.curNumBits = edParam.newNumBits = numBits;
+    edParam.StartByteIndex = edParam.StartBitIndex = 0; /* used for source buffer only  */
+    edParam.newValue = value;                           /* use value 128, encoded as codeword "1111 1111" = 255 */
+    
+    CopyBufferEdit((bibBuffer_t*)NULL, buf, &edParam, 0); 
+}
+
+
+
+/*
+* GetTimeIncPosition
+*    
+*
+* Parameters:
+*    hInstance                  instance handle
+*
+* Function:
+*    Calculates the time increment position for the current VOP.
+*
+* Returns:
+*    VDX error codes
+*    
+*/
+
+int GetTimeIncPosition(
+   bibBuffer_t *inBuffer,
+   const vdxGetVopHeaderInputParam_t *inpParam,
+   vdxVopHeader_t *header,
+   int * ModuloByteIndex,
+   int * ModuloBitIndex,
+   int * ByteIndex,
+   int * BitIndex,
+   int *bitErrorIndication)
+/* {{-output"vdxGetVopHeader.txt"}} */
+{
+  /* Get VOP header */
+    int ret = vdxGetVopHeader(inBuffer, inpParam, header, 
+        ModuloByteIndex, ModuloBitIndex, ByteIndex, BitIndex,
+        bitErrorIndication);
+    
+    return ret;
+    
+}
+
+
+
+/*
+* CopyEditVop
+*    
+*
+* Parameters:
+*    hInstance                  instance handle
+*
+* Function:
+*    This function copies the VOP header with edited time stamps of the VOP.
+*
+* Returns:
+*    TX error codes
+*/
+
+int CopyEditVop(vdeHInstance_t hInstance, int aNrOfBytesToSkip, bibBuffer_t * inBuffer, 
+                 vdeDecodeParamters_t *aDecoderInfo)
+{
+    PRINT((_L("CopyEditVop() begin")));
+    int StartByteIndex = 0;
+    int StartBitIndex = 7;
+    int16 error;
+    int sncCode;
+    int timeIncByteIndex, timeIncBitIndex;
+    int moduloBaseByteIndex, moduloBaseBitIndex;
+    int vopheaderBitLeft;
+    int numBitChange = 0;
+    int increaseBytes = 0;
+    int stuffingLength = 0;
+
+    tMPEG4TimeParameter * timeStamp = aDecoderInfo->aMPEG4TimeStamp;
+    MPEG4TimeParameter CurNewTimeCode;
+
+    int outTirDecreased = 0;
+    int outputTimeResolution = *aDecoderInfo->aMPEG4TargetTimeResolution;
+    int numOutputTrBits;
+    for (numOutputTrBits = 1; ((outputTimeResolution-1) >> numOutputTrBits) != 0; numOutputTrBits++)
+        {
+        }
+
+    int num_bits;
+    vdxGetVopHeaderInputParam_t inpParam;
+    vdxVopHeader_t vopheader;
+    int bitErrorIndication;
+    vdeInstance_t * vdeTemp = (vdeInstance_t *)hInstance;
+    bibBuffer_t *outBuffer = vdeTemp->outBuffer;
+    bibBufferEdit_t * bufEdit = vdeTemp->bufEdit;
+    
+    int FrameSizeInByte = outBuffer->numBytesRead;
+    bibRewindBits(bibNumberOfFlushedBits(inBuffer),inBuffer,&error);
+    bibRewindBits(bibNumberOfFlushedBits(outBuffer),outBuffer,&error);
+    if ( aNrOfBytesToSkip > 0 )
+        {
+        // VOS header is already in the beginning of the output buffer
+        bibForwardBits(aNrOfBytesToSkip<<3, outBuffer);
+        // need to also skip the VOS header from input
+        }
+    bufEdit->copyMode = CopyWhole; /* CopyWhole - default */
+
+    /* record position */
+    StartByteIndex = inBuffer->numBytesRead;
+    StartBitIndex = inBuffer->bitIndex;
+
+    /* get time increment resolution */
+    vdcInstance_t * vdcTemp = (vdcInstance_t *)(vdeTemp->vdcHInstance);
+    int currentTimeIncResolution = vdcTemp->pictureParam.time_increment_resolution > 0? vdcTemp->pictureParam.time_increment_resolution : outputTimeResolution;
+    inpParam.time_increment_resolution = currentTimeIncResolution;
+
+    /* find the next vop start code */
+    do 
+    {
+        sncCode = sncSeekMPEGStartCode(inBuffer, vdcTemp->pictureParam.fcode_forward, vdcTemp->pictureParam.error_res_disable, 0, &error);
+        bibForwardBits(32,inBuffer); // one start code is found, move on  
+        if(inBuffer->bitsLeft <= 0) 
+        {
+            return TX_ERR;  // did not find any sync code --- vop is corrupted
+        }
+    }
+    while (sncCode != SNC_VOP);
+    bibRewindBits(32,inBuffer, &error);  // go back 
+
+    // if we have VOS header in the input, we are now just after it. If aNrOfBytesToSkip > 0, we should not copy it
+    // however, aNrOfBytesToSkip refers to output buffer, so we should not use it when skipping the input
+    if ( aNrOfBytesToSkip > 0 )
+        {
+        StartByteIndex = inBuffer->numBytesRead;
+        StartBitIndex = inBuffer->bitIndex;
+        }
+
+    /* read vop header */
+    GetTimeIncPosition(inBuffer, &inpParam, &vopheader, 
+        &moduloBaseByteIndex, &moduloBaseBitIndex, &timeIncByteIndex, 
+        &timeIncBitIndex, &bitErrorIndication);
+
+    /* record the header end; */
+    vopheaderBitLeft = inBuffer->bitsLeft;
+
+    /* copy-edit the part from the begin to the end of modulo base */
+    CurNewTimeCode = *timeStamp;
+
+    if (CurNewTimeCode.modulo_time_base != vopheader.time_base_incr)
+    {
+        if (!bufEdit->editParams)
+        {
+            bufEdit->editParams = (bibEditParams_t *) malloc(sizeof(bibEditParams_t));
+            if(!bufEdit->editParams)
+            {
+                //Memory not available 
+                return TX_ERR; //indicating error;
+            }
+            else
+            {
+                bufEdit->numChanges = 1;
+            }
+        }
+        bufEdit->copyMode = CopyWithEdit; /* CopyWithEdit */
+        bufEdit->editParams->curNumBits = vopheader.time_base_incr + 1;
+        bufEdit->editParams->newNumBits = CurNewTimeCode.modulo_time_base + 1;
+        bufEdit->editParams->newValue = ((1 << CurNewTimeCode.modulo_time_base) - 1) << 1;
+        bufEdit->editParams->StartByteIndex = moduloBaseByteIndex;
+        bufEdit->editParams->StartBitIndex = moduloBaseBitIndex;
+        numBitChange += bufEdit->editParams->newNumBits - bufEdit->editParams->curNumBits;
+    }
+    else
+    {
+        bufEdit->copyMode = CopyWhole; /* CopyWithEdit */
+    }
+    /* set the end of copy point */
+    bibRewindBits((inBuffer->numBytesRead<<3)+7-inBuffer->bitIndex,inBuffer,&error);
+    bibForwardBits((moduloBaseByteIndex<<3)+7-moduloBaseBitIndex+vopheader.time_base_incr+2, inBuffer);
+      
+    /* copy data */
+    CopyStream(inBuffer,outBuffer,bufEdit,StartByteIndex,StartBitIndex);
+    StartByteIndex=inBuffer->getIndex;
+    StartBitIndex=inBuffer->bitIndex;
+    bufEdit->copyMode = CopyWhole; /* CopyWhole */
+
+    /* copy and edit until the end of Vop header */
+    if (currentTimeIncResolution != outputTimeResolution /* && volheader.time_increment_resolution != 30 */
+        || vopheader.time_inc != CurNewTimeCode.time_inc)
+    {
+        for (num_bits = 1; ((currentTimeIncResolution-1) >> num_bits) != 0; num_bits++) 
+            {
+            }
+        /* prepare editing position */
+        if (!bufEdit->editParams)
+        {
+            bufEdit->editParams = (bibEditParams_t *) malloc(sizeof(bibEditParams_t));
+            if(!bufEdit->editParams)
+            {
+                //Memory not available 
+                return TX_ERR; //indicating error no memory;
+            }
+            else
+            {
+                bufEdit->numChanges = 1;
+            }
+            
+        }
+        bufEdit->copyMode = CopyWithEdit; /* CopyWithEdit */
+        bufEdit->editParams->StartByteIndex = timeIncByteIndex;
+        bufEdit->editParams->StartBitIndex = timeIncBitIndex;
+        bufEdit->editParams->curNumBits = num_bits;
+        bufEdit->editParams->newNumBits = numOutputTrBits;
+        bufEdit->editParams->newValue = vopheader.time_inc;
+
+        /* update time increment */
+        if (vopheader.time_inc != CurNewTimeCode.time_inc)
+        {
+            /*bufEdit->editParams->newValue = (int)(vopheader.time_inc * (float)outputTimeResolution /
+            (float)currentTimeIncResolution + 0.5); //CurNewTimeCode.time_inc;
+            */
+            bufEdit->editParams->newValue = CurNewTimeCode.time_inc;
+        }
+        numBitChange += bufEdit->editParams->newNumBits - bufEdit->editParams->curNumBits;
+    }
+
+    /* set the copy end point to the end of vop header */
+    bibForwardBits(inBuffer->bitsLeft - vopheaderBitLeft, inBuffer);
+
+    /* copy data */
+    CopyStream(inBuffer,outBuffer,bufEdit,StartByteIndex,StartBitIndex);
+    StartByteIndex=inBuffer->getIndex;
+    StartBitIndex=inBuffer->bitIndex;
+    
+    if ( vdcTemp->pictureParam.error_res_disable && (inBuffer->bitsLeft > 40) )   // 40 as below to avoid negative values below
+        {
+        // there are no VP headers => no need to search for VP start codes => can jump to the end.
+        // 40 = 5 bytes; in the end there is a start code that has 4 bytes
+        bibForwardBits( inBuffer->bitsLeft-40 ,inBuffer);
+        }
+
+    PRINT((_L("CopyEditVop() seek sync")));
+    /* find the next resync marker */
+    sncCode = sncSeekMPEGStartCode(inBuffer, vopheader.fcode_forward, vdcTemp->pictureParam.error_res_disable, 0, &error);
+    if ( sncCode == SNC_NO_SYNC )
+        {
+        PRINT((_L("CopyEditVop() sync NOT found, interrupt the copying and return")));
+        return TX_ERR;
+        }
+    PRINT((_L("CopyEditVop() sync found")));
+
+    /* record next resync position */
+    int resyncBitsLeft = inBuffer->bitsLeft;
+        
+    /* rewind stuffing bits */
+    sncRewindStuffing(inBuffer, &error);        
+    
+    if (!bufEdit->editParams)
+    {
+        bufEdit->editParams = (bibEditParams_t *) malloc(sizeof(bibEditParams_t));
+        if(!bufEdit->editParams)
+        {
+            //Memory not available 
+            return TX_ERR; //indicating error no memory;
+        }
+        else
+        {
+            bufEdit->numChanges = 1;
+        }
+    }
+
+    /* record position */
+    bufEdit->editParams->StartByteIndex = inBuffer->getIndex;
+    bufEdit->editParams->StartBitIndex = inBuffer->bitIndex;
+
+    /* calculate new stuffing bits */
+    bufEdit->editParams->curNumBits = inBuffer->bitsLeft - resyncBitsLeft;
+    /* calculate number of bits/bytes changed */
+    if (numBitChange<0)
+    {
+        outTirDecreased = 1;
+        numBitChange = -numBitChange;
+    }
+    int numByteChange = numBitChange >> 3;
+
+    if (outTirDecreased)
+    {
+        increaseBytes -= numByteChange;
+        stuffingLength = bufEdit->editParams->curNumBits + (numBitChange - (numByteChange << 3));
+        if (stuffingLength > 8)
+        {
+            stuffingLength -= 8;
+            increaseBytes --;
+        }
+    }
+    else
+    {
+        increaseBytes += numByteChange;
+        stuffingLength = bufEdit->editParams->curNumBits - (numBitChange - (numByteChange << 3));
+        if (stuffingLength <= 0)
+        {
+            stuffingLength += 8;
+            increaseBytes ++;
+        }
+    }
+        
+    /* adjust the output buffer size */
+    if (increaseBytes != 0)
+    {
+        outBuffer->size += increaseBytes;
+        if (increaseBytes>=0)
+        {
+            outBuffer->bitsLeft += (increaseBytes << 3);
+        }
+        else
+        {
+            outBuffer->bitsLeft -= ((-increaseBytes) << 3);
+        }
+    }
+
+    /* update edit statistics */
+    bufEdit->editParams->newNumBits = stuffingLength;
+    bufEdit->editParams->newValue = stuffingLength>0?(1<<(stuffingLength-1))-1:0;
+    if (stuffingLength != bufEdit->editParams->curNumBits)
+    {
+        bufEdit->copyMode = CopyWithEdit;
+    }
+
+    bibForwardBits(bufEdit->editParams->curNumBits, inBuffer);
+    /* copy data */
+    CopyStream(inBuffer,outBuffer,bufEdit,StartByteIndex,StartBitIndex);
+    /* record position */
+    StartByteIndex = inBuffer->getIndex;
+    StartBitIndex = inBuffer->bitIndex;
+        
+    do
+    {
+        /* if it is the start of a video packet, copy it with edit */
+        if (sncCode == SNC_VIDPACK )
+        {
+            /* copy video packet with edit */
+            int retVal = CopyEditVideoPacket(inBuffer, outBuffer, bufEdit, vdcTemp, aDecoderInfo, &vopheader, 
+                &sncCode, &StartByteIndex, &StartBitIndex);
+            if(retVal<0)
+            {
+                //error inside function return error
+                return TX_ERR;
+            }
+        }
+        else if (sncCode == SNC_EOB || sncCode == SNC_EOS || sncCode == SNC_GOV)
+        {
+            // since it is EOB, so end of sequence has occurred, so no more data, so exit       
+            break;
+        }
+    } 
+    while(sncCode != SNC_VOP);
+
+    /* copy the rest of bits */
+    if ((int)inBuffer->numBytesRead < FrameSizeInByte)
+    {
+        bufEdit->copyMode = CopyWhole;
+        bibForwardBits((FrameSizeInByte-StartByteIndex)<<3, inBuffer);
+        CopyStream(inBuffer,outBuffer,bufEdit,StartByteIndex,StartBitIndex);
+    }
+
+    PRINT((_L("CopyEditVop() end")));
+    return TX_OK;
+    }
+
+
+/*
+* CopyEditVideoPacket
+*    
+*
+* Parameters:
+*
+* Function:
+*    This function copies the video packet with edited time stamps, if HEC is enabled
+*
+* Returns:
+*    TX error codes
+*/
+
+int CopyEditVideoPacket(bibBuffer_t* aInBuffer, 
+                        bibBuffer_t* aOutBuffer, 
+                        bibBufferEdit_t* aBufEdit, 
+                        vdcInstance_t * aVdcTemp,
+                        vdeDecodeParamters_t* aDecoderInfo, 
+                        vdxVopHeader_t* aVopheader, 
+                        int* aSncCode, 
+                        int* aStartByteIndex, 
+                        int* aStartBitIndex)
+{
+    int16 error = 0;
+    int value = 0;
+    int bitsGot = 0;
+    int num_bits = 0;
+    int *bitErrorIndication = 0;
+    int numOutputTrBits = 0;
+    int resyncMarkerLength = 0;
+    int numMBs = 0;
+    int mbNumberLength = 0;
+    int startByteIndex = *aStartByteIndex;
+    int startBitIndex  = *aStartBitIndex;
+    int currentTimeIncResolution = 0;
+    int outputTimeResolution = 0;
+    MPEG4TimeParameter curNewTimeCode;
+    MPEG4TimeParameter* timeStamp = aDecoderInfo->aMPEG4TimeStamp;
+
+    int numBitChange = 0;
+    int increaseBytes = 0;
+    int stuffingLength = 0;
+    int outTirDecreased = 0;
+
+    currentTimeIncResolution = aVdcTemp->pictureParam.time_increment_resolution > 0? aVdcTemp->pictureParam.time_increment_resolution : 30000;
+    outputTimeResolution = *aDecoderInfo->aMPEG4TargetTimeResolution;
+    for (numOutputTrBits=1; ((outputTimeResolution-1)>>numOutputTrBits)!=0; numOutputTrBits++)
+        {
+        }
+    /* evaluate resync marker length */
+    resyncMarkerLength = (aVopheader->coding_type == 0 ? 17 : 16+aVopheader->fcode_forward);
+    /* evaluate MB number length */
+    numMBs = ((aVdcTemp->pictureParam.lumWidth+15)>>4) * ((aVdcTemp->pictureParam.lumHeight+15)>>4);
+    for (mbNumberLength = 1; ((numMBs-1) >> mbNumberLength) != 0; mbNumberLength++)
+        {
+        }
+
+    value = bibGetBits(resyncMarkerLength, aInBuffer, &bitsGot, bitErrorIndication, &error);    // resync marker
+    value = bibGetBits(mbNumberLength, aInBuffer, &bitsGot, bitErrorIndication, &error);    // mb number
+    value = bibGetBits(5, aInBuffer, &bitsGot, bitErrorIndication, &error); // quant scale
+    value = bibGetBits(1, aInBuffer, &bitsGot, bitErrorIndication, &error); // header extension code
+    
+    /* if HEC enabled, copy edit time increment fields in the video packet */
+    if (value == 1) 
+    {
+        /* copy-edit the part from the begin to the end of modulo base */
+        curNewTimeCode = *timeStamp;
+        
+        if (curNewTimeCode.modulo_time_base != aVopheader->time_base_incr)
+        {
+            if (!aBufEdit->editParams)
+            {
+                aBufEdit->editParams = (bibEditParams_t *) malloc(sizeof(bibEditParams_t));
+                if(!aBufEdit->editParams)
+                {
+                    //Memory not available 
+                    return TX_ERR; //indicating error no memory;
+                }
+                else
+                {
+                    aBufEdit->numChanges = 1;
+                }
+            }
+            aBufEdit->copyMode = CopyWithEdit; /* CopyWithEdit */
+            aBufEdit->editParams->curNumBits = aVopheader->time_base_incr + 1;
+            aBufEdit->editParams->newNumBits = curNewTimeCode.modulo_time_base + 1;
+            aBufEdit->editParams->newValue = ((1 << curNewTimeCode.modulo_time_base) - 1) << 1;
+            aBufEdit->editParams->StartByteIndex = aInBuffer->getIndex;
+            aBufEdit->editParams->StartBitIndex = aInBuffer->bitIndex;
+            numBitChange += aBufEdit->editParams->newNumBits - aBufEdit->editParams->curNumBits;
+        } 
+        else
+        {
+            aBufEdit->copyMode = CopyWhole; /* CopyWithEdit */
+        }
+        /* set the end of copy point */
+        bibForwardBits(aVopheader->time_base_incr+2, aInBuffer); // includes one bit for Marker
+        
+        /* copy data */
+        CopyStream(aInBuffer,aOutBuffer,aBufEdit,startByteIndex,startBitIndex);
+        startByteIndex = aInBuffer->getIndex;
+        startBitIndex  = aInBuffer->bitIndex;
+        aBufEdit->copyMode = CopyWhole; /* CopyWhole */
+        
+        /* copy and edit 'time increment' field */
+        if (currentTimeIncResolution != outputTimeResolution /* && volheader.time_increment_resolution != 30 */
+            || aVopheader->time_inc != curNewTimeCode.time_inc)
+        {
+            for (num_bits = 1; ((currentTimeIncResolution-1) >> num_bits) != 0; num_bits++)
+                {
+                }
+            
+            /* prepare editing position */
+            if (!aBufEdit->editParams)
+            {
+                aBufEdit->editParams = (bibEditParams_t *) malloc(sizeof(bibEditParams_t));
+                if(!aBufEdit->editParams)
+                {
+                    //Memory not available 
+                    return TX_ERR; //indicating error no memory;
+                }
+                else
+                {
+                    aBufEdit->numChanges = 1;
+                } 
+            } 
+            aBufEdit->copyMode = CopyWithEdit; /* CopyWithEdit */
+            aBufEdit->editParams->StartByteIndex = aInBuffer->getIndex;
+            aBufEdit->editParams->StartBitIndex = aInBuffer->bitIndex;
+            aBufEdit->editParams->curNumBits = num_bits;
+            aBufEdit->editParams->newNumBits = numOutputTrBits;
+            aBufEdit->editParams->newValue = aDecoderInfo->aMPEG4TimeStamp->time_inc;
+    
+            /* move to end position of 'time increment' field */
+            bibForwardBits(num_bits, aInBuffer);    // move to end of 'time increment' field
+            /* update time increment */
+            if (aVopheader->time_inc != curNewTimeCode.time_inc)
+            {
+                aBufEdit->editParams->newValue = curNewTimeCode.time_inc;
+            }
+            numBitChange += aBufEdit->editParams->newNumBits - aBufEdit->editParams->curNumBits;
+        } 
+       
+        /* copy time increment field with edit */
+        CopyStream(aInBuffer,aOutBuffer,aBufEdit,startByteIndex,startBitIndex);
+        startByteIndex=aInBuffer->getIndex;
+        startBitIndex=aInBuffer->bitIndex;
+        
+    }
+
+    /* copy rest of video packet */
+    
+    /* find the next resync marker */
+    *aSncCode = sncSeekMPEGStartCode(aInBuffer, aVopheader->fcode_forward, 0 /* VPs used*/, 0, &error);
+
+    /* record next resync position */
+    int resyncBitsLeft = aInBuffer->bitsLeft;
+        
+    /* rewind stuffing bits */
+    sncRewindStuffing(aInBuffer, &error);       
+        
+    if (!aBufEdit->editParams)
+    {
+        aBufEdit->editParams = (bibEditParams_t *) malloc(sizeof(bibEditParams_t));
+        if(!aBufEdit->editParams)
+        { 
+            //Memory not available 
+            return TX_ERR; //indicating error no memory;
+        }
+        else
+        {
+            aBufEdit->numChanges = 1;
+        }
+    }
+
+    /* record position */
+    aBufEdit->editParams->StartByteIndex = aInBuffer->getIndex;
+    aBufEdit->editParams->StartBitIndex = aInBuffer->bitIndex;
+        
+    /* calculate new stuffing bits */
+    aBufEdit->editParams->curNumBits = aInBuffer->bitsLeft - resyncBitsLeft;
+
+    /* calculate number of bits/bytes changed */
+    if (numBitChange<0)
+    {
+        outTirDecreased = 1;
+        numBitChange = -numBitChange;
+    }
+    int numByteChange = numBitChange >> 3;
+        
+    /* evaluate change in buffer size */
+    if (outTirDecreased)
+    {
+        increaseBytes -= numByteChange;
+        stuffingLength = aBufEdit->editParams->curNumBits + (numBitChange - (numByteChange << 3));
+        if (stuffingLength > 8)
+        {
+            stuffingLength -= 8;
+            increaseBytes --;
+        }
+    }
+    else
+    {
+        increaseBytes += numByteChange;
+        stuffingLength = aBufEdit->editParams->curNumBits - (numBitChange - (numByteChange << 3));
+        if (stuffingLength <= 0)
+        {
+            stuffingLength += 8;
+            increaseBytes ++;
+        }
+    }
+        
+    /* adjust the output buffer size */
+    if (increaseBytes != 0)
+    {
+        aOutBuffer->size += increaseBytes;
+        if (increaseBytes>=0)
+        {
+            aOutBuffer->bitsLeft += (increaseBytes << 3);
+        }
+        else
+        {
+            aOutBuffer->bitsLeft -= ((-increaseBytes) << 3);
+        }
+    }
+    /* update edit statistics */
+    aBufEdit->editParams->newNumBits = stuffingLength;
+    aBufEdit->editParams->newValue = stuffingLength>0?(1<<(stuffingLength-1))-1:0;
+    if (stuffingLength != aBufEdit->editParams->curNumBits)
+    {
+        aBufEdit->copyMode = CopyWithEdit; // copy with edit
+    }
+    else 
+    {
+        aBufEdit->copyMode = CopyWhole; // copy whole 
+    }
+        
+    bibForwardBits(aBufEdit->editParams->curNumBits, aInBuffer);
+    /* copy video packet with stuffing bits edited */
+    CopyStream(aInBuffer, aOutBuffer, aBufEdit, startByteIndex, startBitIndex);
+    /* record position */
+    startByteIndex = aInBuffer->getIndex;
+    startBitIndex  = aInBuffer->bitIndex;
+        
+    /* update position for return */
+    *aStartByteIndex = startByteIndex;
+    *aStartBitIndex  = startBitIndex;
+
+    return TX_OK;
+}
+
+
+/*
+* sPutBits
+*
+* Parameters:
+*      outBuf           output buffer
+*           numBits         number of bits to output
+*           value           new value
+*
+* Function:
+*    Wrapper to sPutBits
+* Returns:
+*    None.
+* Error codes:
+*    None.
+*
+*/
+void vdtPutBits (void *buf,  int numBits, unsigned int value)
+{
+    /* must be in this type! "void" is used here only because of the interface with vlb.cpp */
+    sPutBits ((bibBuffer_t *)(buf),  numBits, value);
+}
+
+
+
+/* {{-output"vdtCopyBuffer.txt"}} */
+/*
+* vdtCopyBuffer
+*
+* Parameters:
+*
+* Function:
+*    This function copies some data from source buffer to destination buffer
+* Returns:
+*    None.
+* Error codes:
+*    None.
+*
+*/
+void vdtCopyBuffer(bibBuffer_t *SrcBuffer,bibBuffer_t *DestBuffer,
+                                     int ByteStart,int BitStart, int ByteEnd, int BitEnd)
+{
+    int startByteIndex = SrcBuffer->getIndex;
+    int startBitIndex  = SrcBuffer->bitIndex;
+    int bitsLeft = SrcBuffer->bitsLeft;
+    int numBytesRead = SrcBuffer->numBytesRead;
+    
+    CopyBuffer(SrcBuffer,DestBuffer, ByteStart, BitStart, ByteEnd, BitEnd);
+    
+    /* recover the postion */
+    SrcBuffer->getIndex = startByteIndex ;
+    SrcBuffer->bitIndex = startBitIndex;
+    SrcBuffer->bitsLeft = bitsLeft;
+    SrcBuffer->numBytesRead = numBytesRead;
+}
+
+
+
+
+/* {{-output"vdtStuffBitsMPEG4.txt"}} */
+/*
+* vdtStuffBitsMPEG4
+*
+* Parameters:
+*          outBuf           output buffer
+*
+* Function:
+*    This function puts some stuffing bits to the output buffer
+*   bits need to be stuffed in the output buffer at the end of vp in all cases (bw or not)
+* Returns:
+*    None.
+* Error codes:
+*    None.
+*
+*/
+void vdtStuffBitsMPEG4(bibBuffer_t *outBuffer)
+{
+    const int stuffingBits[8][2] = { {1,0}, {2,1}, {3,3}, {4,7}, {5,15}, {6,31}, {7,63}, {8,127} };
+  VDTASSERT(outBuffer->baseAddr);
+    
+    /* find the number of stuffing bits to insert in the output buffer */
+    int bi = outBuffer->bitIndex;
+    int newNumBits = stuffingBits[bi][0]; 
+    int newValue = stuffingBits[bi][1]; 
+    sPutBits(outBuffer, newNumBits, newValue);
+        
+    return;
+}
+
+
+/*************************************************************/
+
+
+/* {{-output"sResetH263IntraDcUV.txt"}} */
+/*
+* sResetH263IntraDcUV
+*
+* Parameters: output buffer
+*             uValue
+*             vValue
+*
+* Function:
+*    This function reset the chrominace INTRADC when black and white color effect is applied 
+* Returns:
+*    none
+* Error codes:
+*    None.
+*
+*/
+inline void sResetH263IntraDcUV(bibBuffer_t *DestBuffer, TInt uValue, TInt vValue)
+{
+    /* For the Color Effects Fill the U and V buffers with the 
+    corresponding color values */
+   
+    sPutBits(DestBuffer, 8, uValue);
+    sPutBits(DestBuffer, 8, vValue);
+}
+
+
+/* {{-output"vdtGetPMBBlackAndWhiteMCBPC.txt"}} */
+/*
+* vdtGetPMBBlackAndWhiteMCBPC
+*
+* Parameters: 
+*
+* Function:
+*    This function compute the new mcbpc for black and white effect *
+* Returns:
+*    the length of the input mcbpc.
+* Error codes:
+*    None.
+*
+*/
+int vdtGetPMBBlackAndWhiteMCBPC(int& new_len, int& new_val, int mcbpc)
+{
+    int cur_index, new_index, cur_len;
+        
+    const tVLCTable sCBPCPType[21] = 
+    {
+    {1, 1}, {3, 4}, {2, 4}, {5, 6},
+    {3, 3}, {7, 7}, {6, 7}, {5, 9}, 
+    {2, 3}, {5, 7}, {4, 7}, {5, 8},
+    {3, 5}, {4, 8}, {3, 8}, {3, 7},
+    {4, 6}, {4, 9}, {3, 9}, {2, 9}, 
+    {1, 9}
+    };
+    
+     /* evaluate MCBPC parameters */
+    int cur_cbpc = mcbpc & 3;       
+    int new_cbpc = 0;       // cpbc=0 indicates chroma is 0
+    int mbType; 
+    
+    mbType = mcbpc / 4;
+    /* evaluate indices in table */
+    cur_index = mbType * 4 + cur_cbpc;  
+    new_index = mbType * 4 + new_cbpc;  
+    
+    /* retrieve values */
+    cur_len = sCBPCPType[cur_index].length;
+    new_len = sCBPCPType[new_index].length;
+    new_val = sCBPCPType[new_index].code;
+    
+    return cur_len;
+}
+
+
+/* {{-output"vdtGetIMBBlackAndWhiteMCBPC.txt"}} */
+/*
+* vdtGetIMBBlackAndWhiteMCBPC
+*
+* Parameters: None
+*
+* Function:
+*    This function compute the new mcbpc for black and white effect
+* Returns:
+*    the length of the input mcbpc.
+* Error codes:
+*    None.
+*
+*/
+int vdtGetIMBBlackAndWhiteMCBPC(int& new_len, int& new_val, int mcbpc)
+{
+    int cur_index, new_index, cur_len;
+    
+    const tVLCTable sCBPCIType[9] = 
+    {
+    {1, 1}, {1, 3}, {2, 3}, {3, 3}, {1, 4},
+    {1, 6}, {2, 6}, {3, 6}, {1, 9}
+    };
+    
+    /* evaluate MCBPC parameters */
+    int cur_cbpc = mcbpc & 3;       
+    int new_cbpc = 0;       // cpbc=0 indicates chroma is 0
+    int mbType = (mcbpc <4)?3:4;
+    
+    /* evaluate indices in table */
+    cur_index = (mbType == 3 ? 0 : 4) + cur_cbpc;   
+    new_index = (mbType == 3 ? 0 : 4) + new_cbpc;   
+    
+    /* retrieve values */
+    cur_len = sCBPCIType[cur_index].length;
+    new_len = sCBPCIType[new_index].length;
+    new_val = sCBPCIType[new_index].code;
+    
+    return cur_len;
+}
+
+
+
+
+
+/* {{-output"vdtGetVideoBitstreamInfo.txt"}} */
+/*
+* vdtGetVideoBitstreamInfo
+*
+* Parameters: 
+*
+* Function:
+*    This function provides the bitstream info to the processor *
+* Returns:
+*    VDE error codes
+* Error codes:
+*    None.
+*
+*/
+int vdtGetVideoBitstreamInfo(bibBuffer_t *inBuffer, vdeDecodeParamters_t *aInfoOut, int *aByteIndex, int *aBitIndex)
+{
+    int numBitsGot,
+    bitErrorIndication = 0;
+    int16 error = 0;
+    u_int32 bits;
+    int timeResolution = 0;
+    TVedVideoBitstreamMode streamMode = EVedVideoBitstreamModeUnknown;
+    vdxVolHeader_t volHeader;  
+    volHeader.user_data = NULL;
+    
+    bits = bibShowBits(32, inBuffer, &numBitsGot, &bitErrorIndication, &error);
+    if (error)
+    {
+        streamMode = EVedVideoBitstreamModeUnknown;
+        goto exitFunction;
+    }
+    /* If PSC */
+    if ((bits >> 10) == 32) {
+        streamMode = EVedVideoBitstreamModeH263;
+    } 
+
+    /* Else check for Visual Sequence, Visual Object or Video Object start code */
+    else if ((bits == MP4_VOS_START_CODE) || 
+        (bits == MP4_VO_START_CODE) ||
+        ((bits >> MP4_VID_ID_CODE_LENGTH) == MP4_VID_START_CODE) ||
+        ((bits >> MP4_VOL_ID_CODE_LENGTH) == MP4_VOL_START_CODE)) 
+    {
+        
+        /* read the Stream headers from the bitstream */
+        if ((vdxGetVolHeader(inBuffer, &volHeader, &bitErrorIndication, 1, aByteIndex, aBitIndex, NULL) != 0) ||
+            (bitErrorIndication != 0)) 
+        {
+            goto exitFunction;
+        }   
+
+        timeResolution = volHeader.time_increment_resolution;
+        streamMode = sGetMPEG4Mode(volHeader.error_res_disable, volHeader.data_partitioned, volHeader.reversible_vlc);
+        bits = bibShowBits(22, inBuffer, &numBitsGot, &bitErrorIndication, &error);
+        if (error)
+            goto exitFunction;
+        
+      /* Check if H.263 PSC follows the VOL header, in which case this is 
+        MPEG-4 with short header and is decoded as H.263 */
+        if ( bits == 32 ) 
+        {
+            streamMode = EVedVideoBitstreamModeMPEG4ShortHeader;
+        }
+    }
+
+    /* Else no H.263 and no MPEG-4 start code detected  */
+    else {
+        streamMode = EVedVideoBitstreamModeUnknown;
+    }
+    
+exitFunction:
+    /* copy the got user data to the core data structure */
+    if (volHeader.user_data != NULL) 
+    {
+        free(volHeader.user_data);
+    }
+    
+    bibRewindBits( bibNumberOfFlushedBits( inBuffer ), inBuffer, &error );
+    aInfoOut->streamMode = streamMode;
+    aInfoOut->iTimeIncrementResolution = timeResolution;
+    return TX_OK;
+}
+
+
+
+
+
+/* {{-output"vdtGetVideoBitstreamInfo.txt"}} */
+/*
+* sQuantizeMB
+*
+* Parameters: 
+*    mbdata          Contains the actual MB data to be quantized
+*    oldQuant: 
+*    newQuant:
+*    intra
+*
+* Function:
+*    This function requantizes the AC/DCT data for one MB, used in MPEG4 -> H263 transcoding 
+* Returns:
+*    Coded Block Pattern.
+* Error codes:
+*    None.
+*
+*/
+static void sQuantizeMB(int *mbdata, int oldQuant, int newQuant, int intra, int colorEffect)
+{
+#define  SIGN(x)          (((x)<0) ? -1:1 )
+    int   coeffCnt;
+    int   *block;
+    int   blkCnt;
+    
+    for (blkCnt = 0; blkCnt < (colorEffect ? 4 : 6); blkCnt++)
+    {   
+        block = &mbdata[blkCnt * BLOCK_COEFF_SIZE];
+        for (coeffCnt = (intra == VDX_MB_INTRA); coeffCnt < BLOCK_COEFF_SIZE;
+             coeffCnt++)
+             {
+                 if (block[coeffCnt])
+                 {
+                     int level = abs(block[coeffCnt]);
+                     int sign = SIGN(block[coeffCnt]);
+                     int rcoeff;
+                     // dequantize 
+                     if ((oldQuant % 2) == 1)
+                         rcoeff = oldQuant * ((level << 1) + 1);
+                     else
+                         rcoeff = oldQuant * ((level << 1) + 1) - 1;
+                     
+                     rcoeff = min (2047, max (-2048, sign * rcoeff));
+                     
+                     // requantize
+                     if (intra == VDX_MB_INTRA)
+                     {
+                         level = (abs (rcoeff)) / (newQuant << 1);
+                     }
+                     else
+                     {
+                         level = (abs (rcoeff) - (newQuant >> 1)) / (newQuant << 1);
+                         /* clipping to [-127,+127] */
+                     }
+                     
+                     /* clipping to [-127,+127] */
+                     block[coeffCnt] = min (127, max (-127, sign * level));
+                 }
+                 else
+                 {
+                     /* Nothing */
+                 }
+             }
+    }
+    return ;
+}   
+
+
+
+
+/* {{-output"vdtGetVideoBitstreamInfo.txt"}} */
+/*
+* vdtChangeVosHeaderRegResyncL
+*
+* Parameters: 
+*
+* Function:
+*    This function finds the error resillence bit and change it if necessary
+*      to make it Regular Resynchronization mode 
+* Returns:
+*    ETrue if buffer changed.
+* Error codes:
+*    None
+*
+*/
+TBool vdtChangeVosHeaderRegResyncL(TPtrC8& aInputBuffer, TUint aBufferSize)
+{
+    int16   errorCode = 0;             /* return code for bib functions */
+    bibBuffer_t *buffer;                   /* input buffer */
+    
+    /* Create bit buffer */
+    buffer = bibCreate((TAny*)aInputBuffer.Ptr(), aBufferSize, &errorCode);
+    if (!buffer || errorCode)
+        return EFalse;
+     
+    int startByte = 0, startBit = 7;
+    vdeDecodeParamters_t decInfo; 
+    vdtGetVideoBitstreamInfo(buffer, &decInfo, &startByte, &startBit);
+     
+    if (decInfo.streamMode == EVedVideoBitstreamModeMPEG4Regular)
+    {
+        char *temp = (char *) (TAny*)aInputBuffer.Ptr();
+        unsigned char patern[8] = {0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F};
+        temp[startByte] &= patern[startBit]; // change the error resillence bit to 0;
+        
+        /* Delete bit buffer */
+        bibDelete(buffer, &errorCode);
+        return ETrue;
+    }
+    else
+    {
+      /* Delete bit buffer */
+        bibDelete(buffer, &errorCode);
+        return EFalse;
+    }
+}
+
+/*
+* CMPEG4Transcoder
+*
+* Parameters: 
+*
+* Function:
+*    Constructor
+*
+*/
+CMPEG4Transcoder::CMPEG4Transcoder(const vdeInstance_t *aVDEInstance, bibBuffer_t *aInBuffer, bibBuffer_t *aOutBuffer)
+{
+    VDTASSERT(aVDEInstance); 
+    VDTASSERT(aInBuffer);
+    VDTASSERT(aOutBuffer);
+    
+    /* passing the arguments */
+    iVDEInstance = aVDEInstance;
+    iInBuffer  = aInBuffer;
+    iOutBuffer = aOutBuffer;
+    
+    /* Color Toning */
+    iMBType      = NULL;
+    iCurQuant    = 0;
+    iColorEffect = aVDEInstance->iColorEffect;
+    iColorToneU  = aVDEInstance->iColorToneU;
+    iColorToneV  = aVDEInstance->iColorToneV;
+    iRefQuant    = aVDEInstance->iRefQp;
+    iDcScaler    = GetMpeg4DcScalerUV(iRefQuant);
+        
+    iDoModeTranscoding = EFalse;
+    iDoTranscoding = (iColorEffect || iDoModeTranscoding);
+    iTargetFormat = EVedVideoTypeMPEG4SimpleProfile;
+    iStuffingBitsUsed = 0;
+    
+    /* default values */
+    iLastMBNum = -1;
+    iCurMBNum = 0;
+
+    /* initialize here but will be changed later to proper value */
+    iOutputMpeg4TimeIncResolution = KOutputMpeg4TimeIncResolution;  
+
+    iNumMBsInOneVOP = (iVDEInstance->lumHeight * iVDEInstance->lumWidth) >> 8;  // /256
+    iMBsinWidth = iVDEInstance->lumWidth >> 4; 
+    iNumMBsInGOB = iVDEInstance->lumWidth >> 4; 
+    
+
+    iMBList = NULL;
+    iH263DCData = NULL;
+    h263mbi = NULL;
+
+    
+    iH263MBVPNum = NULL;
+    iErrorResilienceStartByteIndex = KDataNotValid;
+    iErrorResilienceStartBitIndex  = KDataNotValid;
+    
+    iVideoPacketNumInMPEG4 = 0; // the video packet number this MB belongs to, NOTE: the first GOB doesn't have a GOB header
+    iCurMBNumInVP = -1;
+    fFirstFrameInH263 = EFalse;
+    
+    return;
+}
+
+/*
+* ~CMPEG4Transcoder
+*
+* Parameters: 
+*
+* Function:
+*    Destructor
+*
+*/
+CMPEG4Transcoder::~CMPEG4Transcoder()
+{
+    if (iCurIMBinstance)
+    {
+        free(iCurIMBinstance);
+    }
+    if (iCurPMBinstance)
+    {
+        free(iCurPMBinstance);
+    }
+    if (bufEdit.editParams)
+    {
+        free(bufEdit.editParams);
+    }
+    
+    // for H263
+    if (iH263MBVPNum)
+    {
+        free(iH263MBVPNum);
+    }
+    
+    // for color toning
+    if (iMBType)
+    {
+        free(iMBType);
+    }
+
+
+    
+    if (iH263DCData)
+    {
+        for (int i = 0; i < iNumMBsInOneVOP; i++)
+        {
+            free(iH263DCData[i]);
+        }
+        free(iH263DCData);
+    }
+
+    if ( ( (iTargetFormat == EVedVideoTypeH263Profile0Level10) || 
+           (iTargetFormat == EVedVideoTypeH263Profile0Level45) ) &&
+           iBitStreamMode != EVedVideoBitstreamModeMPEG4ShortHeader &&
+           iBitStreamMode != EVedVideoBitstreamModeH263 &&
+           h263mbi)
+    {
+        free(h263mbi);
+    }
+    
+    if ( iOutBuffer )
+        {
+        
+        PRINT((_L("CMPEG4Transcoder: finish one frame successfully, buffer size %d"), 
+           iOutBuffer->getIndex));
+        }
+        
+#ifdef _DEBUG
+    if (iOutBuffer->getIndex > KInitialBufferSize)
+    {
+        PRINT((_L("CMPEG4Transcoder: Output buffer size from engine is not big enough! check KInitialBufferSize")));
+        
+    }
+#endif
+    if ( iOutBuffer )
+        {
+        VDTASSERT(iOutBuffer->getIndex < KInitialBufferSize);
+        }
+}
+
+/*
+* H263EscapeCoding
+*
+* Parameters: 
+*
+* Function:
+*    Indicates whether escape vlc coding is used in one block
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::H263EscapeCoding(int aIndex, int fEscapeCodeUsed)
+{
+    iEscapeCodeUsed[aIndex] = fEscapeCodeUsed;
+}
+
+/*
+* SetTranscoding
+*
+* Parameters: 
+*
+* Function:
+*    Indicates whether we need to do MPEG4 bitstream transcoding
+* Returns:
+*    TX error codes
+* Error codes:
+*    None
+*
+*/
+int CMPEG4Transcoder::SetTranscoding(vdeDecodeParamters_t *aDecoderInfo)
+{
+    iColorEffect = aDecoderInfo->aColorEffect;
+    iColorToneU = aDecoderInfo->aColorToneU; 
+    iColorToneV = aDecoderInfo->aColorToneV;
+    iBitStreamMode = (TVedVideoBitstreamMode)aDecoderInfo->streamMode;
+    
+    iTargetFormat = aDecoderInfo->aOutputVideoFormat; 
+    iDoModeTranscoding = aDecoderInfo->fModeChanged ? ETrue: EFalse;
+    iDoTranscoding = (iColorEffect || iDoModeTranscoding);
+
+    /* set to proper value */
+    iOutputMpeg4TimeIncResolution = *(aDecoderInfo->aMPEG4TargetTimeResolution); 
+
+    /* allocate buffer for MPEG4 - > H263 transcoding */
+    /* the following is used if spatial domain processing is not done */
+        
+    if ( ( (iTargetFormat == EVedVideoTypeH263Profile0Level10) ||
+           (iTargetFormat == EVedVideoTypeH263Profile0Level45) ) &&
+           iBitStreamMode != EVedVideoBitstreamModeMPEG4ShortHeader &&
+           iBitStreamMode != EVedVideoBitstreamModeH263)
+    {
+        h263mbi = (tMBInfo*) malloc (sizeof(tMBInfo) * iNumMBsInOneVOP);
+        if (!h263mbi) 
+        {
+            PRINT((_L("CMPEG4Transcoder::SetTranscoding - h263mbi creation failed")));
+            deb("CMPEG4Transcoder::SetTranscoding - h263mbi creation failed\n");
+
+            return TX_ERR;
+        }
+        memset(h263mbi, 0, sizeof(tMBInfo) * iNumMBsInOneVOP);
+    }
+    
+    return TX_OK;
+}
+
+
+
+
+/*
+* BeginOneVideoPacket
+*
+* Parameters: 
+*
+* Function:
+*    Records the position before one Video packet is processed
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::BeginOneVideoPacket(dvpVPInParam_t *aVPin)
+{
+    VDTASSERT(iInBuffer); 
+    VDTASSERT(aVPin);
+    
+    iCurVPIn = aVPin;
+    iVPStartByteIndex = iInBuffer->getIndex;
+    iVPStartBitIndex  = iInBuffer->bitIndex;
+    
+    iCurMBNumInVP = -1;
+
+    iStuffingBitsUsed = 0;
+    
+    iVopCodingType = aVPin->pictParam->pictureType;
+    iBitStreamMode = sGetMPEG4Mode(aVPin->pictParam->error_res_disable,
+        aVPin->pictParam->data_partitioned, aVPin->pictParam->reversible_vlc);
+}
+
+
+/*
+* sConstructH263PicHeader
+*
+* Parameters: 
+*        lBitOut                output buffer
+*        quant                quant value to be put in header
+*           picType             VDX_VOP_TYPE_P or VDX_VOP_TYPE_I
+*           tr                      time increament
+* Function:
+*    Writes the pic header into bit-stream for one MPEG4 frame
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void sConstructH263PicHeader(bibBuffer_t *lBitOut, int picType, int quant, int tr, int aVOPNotCoded, int aFormat)
+
+{
+    if (aVOPNotCoded)
+    {
+        return;
+    }
+    /* ShortVideoStartMarker */
+    sPutBits(lBitOut, 22, SHORT_VIDEO_START_MARKER);
+    /* TemporalReference */
+    sPutBits(lBitOut, 8, (tr & 0x000000ff));
+    /* Marker Bit */
+    sPutBits(lBitOut, 1, MARKER_BIT);
+    /* Zero Bit */
+    sPutBits(lBitOut, 1, 0);
+    /* SplitScreenIndicator = 0 */
+    sPutBits(lBitOut, 1, 0);
+    /* DocumentCameraIndicator = 0 */
+    sPutBits(lBitOut, 1, 0);
+    /* FullPictureFreezeRelease = 0 */
+    sPutBits(lBitOut, 1, 0);
+    /* Source Fromat */
+    sPutBits(lBitOut, 3, aFormat);
+    /* PictureCodingType 0 for intra, 1 for inter */
+    sPutBits(lBitOut, 1, picType == VDX_VOP_TYPE_P);
+    /* UMV= 0 */
+    sPutBits(lBitOut, 1, 0);
+    /* SAC = 0 */
+    sPutBits(lBitOut, 1, 0);
+    /* Advanced Prediction = 0 */
+    sPutBits(lBitOut, 1, 0);
+    /* PB frame = 0 */
+    sPutBits(lBitOut, 1, 0);
+    /* VOPQuant */
+    sPutBits(lBitOut, 5, quant);
+    /* ZeroBIt */
+    sPutBits(lBitOut, 1, 0);
+    /* Pei = 0 */
+    sPutBits(lBitOut, 1, 0);        
+}
+
+
+/*
+* VOPHeaderEnded
+*
+* Parameters: 
+*
+* Function:
+*    Copy the VOP Header to output buffer
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::VOPHeaderEnded(int aStartByteIndex, int aStartBitIndex, 
+    int aQuant, int aPicType, int aFrameNum, int aVOPNotCoded)
+{
+    const int KNumMbInSqcif = 48; 
+    const int KNumMbInQcif = 99; 
+    const int KNumMbInCif = 396; 
+
+    if (iTargetFormat == EVedVideoTypeH263Profile0Level10 || iTargetFormat == EVedVideoTypeH263Profile0Level45)
+    {
+        int sourceFormat = 2; // qcif
+        /* note: other formate not supported */
+        if (iNumMBsInOneVOP == KNumMbInSqcif)  /* sqcif */
+        {
+            sourceFormat = 1;  // sqcif
+        }
+        else if (iNumMBsInOneVOP == KNumMbInQcif) /* qcif */
+        {
+            sourceFormat = 2;  // qcif
+        }
+        else if (iNumMBsInOneVOP == KNumMbInCif) /* cif */
+        {
+            sourceFormat = 3;  // cif
+        }
+        sConstructH263PicHeader(iOutBuffer, aPicType, aQuant, 0, aVOPNotCoded, sourceFormat);
+        PRINT((_L("CMPEG4Transcoder: MPEG4 -> H263: picture header generated")));
+    }
+  /* Copy the VOP header */
+  else 
+    {
+        bufEdit.copyMode = CopyWhole; // whole
+        CopyStream(iInBuffer,iOutBuffer,&bufEdit,aStartByteIndex,aStartBitIndex);
+    }
+  iPreQuant = aQuant;
+  iStuffingBitsUsed = 0;
+
+  iCurQuant = aQuant;
+  /* Color Toning */
+  if (!aFrameNum || !iRefQuant)
+  {
+     iRefQuant = iCurQuant;
+     iDcScaler = GetMpeg4DcScalerUV(iRefQuant); 
+  }
+
+}
+
+
+/*
+* VOPEnded
+*
+* Parameters: 
+*
+* Function:
+*    This function is called when one VOP has ended
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::VOPEnded()
+{
+    /* check if MBs are lost */
+    int dataPartitioned = (iBitStreamMode == EVedVideoBitstreamModeMPEG4DP_RVLC || iBitStreamMode == EVedVideoBitstreamModeMPEG4Resyn_DP_RVLC 
+        || iBitStreamMode == EVedVideoBitstreamModeMPEG4DP ||  iBitStreamMode == EVedVideoBitstreamModeMPEG4Resyn_DP);
+    
+    if (iLastMBNum != iNumMBsInOneVOP - 1 && !(dataPartitioned && !iDoModeTranscoding))
+    {
+        for (int i = iLastMBNum+1; i < iNumMBsInOneVOP; i++)
+        {
+            /* output  1 bit COD */
+            sPutBits (iOutBuffer, 1, 1);
+        }
+    }
+    
+    iLastMBNum = iNumMBsInOneVOP - 1; 
+    /* bits need to be stuffed in the output buffer at the end VOP */
+    if (!dataPartitioned && iTargetFormat == EVedVideoTypeMPEG4SimpleProfile)
+    {
+        if (!iStuffingBitsUsed)
+        {
+            vdtStuffBitsMPEG4(iOutBuffer);
+        }
+        iStuffingBitsUsed = 1;
+    }
+    else if (iTargetFormat == EVedVideoTypeH263Profile0Level10 || iTargetFormat == EVedVideoTypeH263Profile0Level45)
+    {
+        sStuffBitsH263(iOutBuffer);
+    }
+    
+  PRINT((_L("CMPEG4Transcoder: VOPEnded. color effect: %d, format convert %d, do transcoding: %d streammode: %d, outputformat: %d "), 
+       iColorEffect, iDoModeTranscoding, iDoTranscoding, iBitStreamMode, iTargetFormat));
+}
+
+/*
+* AfterOneVideoPacketHeader
+*
+* Parameters: 
+*
+* Function:
+*    This function is called after retreiving the VP
+*    Records the position before the content of the video packet is processed
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::AfterVideoPacketHeader(dvpVPInOutParam_t *aVPInfo)
+{
+    VDTASSERT(aVPInfo); 
+    iCurVPInOut = aVPInfo;
+    
+    iVPHeaderEndByteIndex = iInBuffer->getIndex;
+    iVPHeaderEndBitIndex  = iInBuffer->bitIndex;
+    
+    /* Color Toning */
+    iCurQuant = aVPInfo->quant; 
+    
+    /* Copy the VP header to output stream. Note; the first VP does not have a VP header */
+    if (iTargetFormat == EVedVideoTypeMPEG4SimpleProfile)
+    {
+       bufEdit.copyMode = CopyWhole; /* whole */
+         CopyStream(iInBuffer,iOutBuffer,&bufEdit,iVPStartByteIndex,iVPStartBitIndex);
+    }
+}
+
+
+/*
+* OneVPEnded
+*
+* Parameters: 
+*
+* Function:
+*    This function is called after one VP  contents are retrieved
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::OneVPEnded()
+{
+    if (!iDoTranscoding)
+    {
+        /* no transcoding, copy whole content VP */
+        bufEdit.copyMode = CopyWhole; 
+        CopyStream(iInBuffer,iOutBuffer,&bufEdit,iVPHeaderEndByteIndex,iVPHeaderEndBitIndex);
+        iStuffingBitsUsed = 1;// also stuffing is copied
+    }
+    else
+    {
+        int dataPartitioned = (iBitStreamMode == EVedVideoBitstreamModeMPEG4DP_RVLC || iBitStreamMode == EVedVideoBitstreamModeMPEG4Resyn_DP_RVLC 
+            || iBitStreamMode == EVedVideoBitstreamModeMPEG4DP ||  iBitStreamMode == EVedVideoBitstreamModeMPEG4Resyn_DP);
+        int nextExpectedMBNum = iCurVPInOut->currMBNum;
+        
+        if (dataPartitioned && !iDoModeTranscoding)
+        {
+        /* if data is partitioned and we are not doing format transcoding,
+        not coded MBs info is already in data partition 1
+            */
+        }
+        else
+        {
+            /* MBs are lost or not coded,  */
+            for (int i = iLastMBNum+1; i < nextExpectedMBNum; i++)
+            {
+                /* output  1 bit COD */
+                sPutBits (iOutBuffer, 1, 1);
+            }
+        }
+        
+        iLastMBNum = nextExpectedMBNum - 1; 
+        /* bits need to be stuffed in the output buffer at the end of vp in all cases (bw or not) */
+        if (iTargetFormat == EVedVideoTypeMPEG4SimpleProfile) 
+        {
+            if (!iStuffingBitsUsed)
+            {
+                vdtStuffBitsMPEG4(iOutBuffer);
+            }
+            iStuffingBitsUsed = 1;
+        }
+    }
+}
+
+
+
+/*
+* BeginOneMB
+*
+* Parameters: 
+*
+* Function:
+*    Records the position before one MB is processed
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::BeginOneMB(int aMBNum)
+{
+    VDTASSERT(iInBuffer); 
+    
+    iMBStartByteIndex = iInBuffer->getIndex;
+    iMBStartBitIndex  = iInBuffer->bitIndex;
+    iCurMBNum = aMBNum;
+    
+    // Color Toning
+    iCurMBNumInVP++;
+    
+    if ((iBitStreamMode == EVedVideoBitstreamModeMPEG4ShortHeader || iBitStreamMode == EVedVideoBitstreamModeH263) && iDoModeTranscoding)
+    {
+       /* H263 -> MPEG4  */
+       VDTASSERT(iH263MBVPNum);
+         iH263MBVPNum[iCurMBNum]= iVideoPacketNumInMPEG4;
+    }
+}
+
+/*
+* BeginOneBlock
+*
+* Parameters: 
+*
+* Function:
+*    Records the position before one block in MB is processed
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::BeginOneBlock(int aBlockIndex)
+{
+    VDTASSERT(aBlockIndex >= 0 && aBlockIndex < 6); 
+    
+    iBlockStartByteIndex[aBlockIndex] = iInBuffer->getIndex;
+    iBlockStartBitIndex[aBlockIndex]  = iInBuffer->bitIndex;
+}
+
+
+/*
+* OneIMBDataStarted
+*
+* Parameters: 
+*
+* Function:
+*    This function is called after the MB header is read; start one IMB, 
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::OneIMBDataStarted(vdxIMBListItem_t *aMBInstance)
+{
+    VDTASSERT(aMBInstance); 
+    VDTASSERT(iCurIMBinstance);
+    iMBCodingType = VDX_MB_INTRA;
+    iVopCodingType = VDX_VOP_TYPE_I;
+    iMBType[iCurMBNum] = iMBCodingType;
+
+    
+    memcpy(iCurIMBinstance, aMBInstance, sizeof(vdxIMBListItem_t)); 
+}
+
+/*
+* OnePMBDataStarted
+*
+* Parameters: 
+*
+* Function:
+*    This function is called after the MB header is read; start one PMB, 
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::OnePMBDataStarted(vdxPMBListItem_t *aMBInstance)
+{
+    VDTASSERT(aMBInstance); 
+    VDTASSERT(iCurPMBinstance);
+    
+    iMBCodingType = aMBInstance->mbClass;
+    iVopCodingType = VDX_VOP_TYPE_P;
+    iMBType[iCurMBNum] = iMBCodingType;
+
+    memcpy(iCurPMBinstance, aMBInstance, sizeof(vdxPMBListItem_t)); 
+}
+
+
+
+/*
+* OneIMBDataStartedDataPartitioned
+*
+* Parameters: 
+*
+* Function:
+*    Add one IMB instance, It is done after parsing Part1 and Part2 before the block data for current MB
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::OneIMBDataStartedDataPartitioned(vdxIMBListItem_t *aMBInstance, dlst_t *aMBList, int aCurrMBNumInVP, int aMBNum)
+{
+    VDTASSERT(aMBInstance); // at this point, the instance should not be null
+    VDTASSERT(aMBList);
+    
+    memcpy(iCurIMBinstance, aMBInstance, sizeof(vdxIMBListItem_t)); 
+    iCurMBNumInVP = aCurrMBNumInVP;
+    iCurMBNum = aMBNum;
+    iMBList = aMBList;
+    iMBCodingType = VDX_MB_INTRA;
+    iVopCodingType = VDX_VOP_TYPE_I;
+    iMBType[iCurMBNum] = iMBCodingType;
+    
+    if (!iCurMBNumInVP && iDoTranscoding) 
+    {
+        if (!iDoModeTranscoding)
+        {
+          /* We are not doing bitstream transcoding,  
+            we have color effect here and need to reconstruct data partitions.
+            */
+            ReconstructIMBPartitions();
+        }
+    }
+}
+
+/*
+* OnePMBDataStartedDataPartitioned
+*
+* Parameters: 
+*
+* Function:
+*    Add one IMB instance, It is done after parsing Part1 and Part2 before the block data for current MB
+*    Note: PMB may be INTRA coded.
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::OnePMBDataStartedDataPartitioned(vdxPMBListItem_t *aMBInstance, dlst_t *aMBList, int aCurrMBNumInVP, int aMBNum)
+{
+    VDTASSERT(aMBInstance); /* at this point, the instance should not be null */
+    VDTASSERT(aMBList);
+    
+    memcpy(iCurPMBinstance, aMBInstance, sizeof(vdxPMBListItem_t)); 
+    iCurMBNumInVP = aCurrMBNumInVP;
+    iCurMBNum = aMBNum;
+    iMBList = aMBList;
+    iMBCodingType = aMBInstance->mbClass;
+    iVopCodingType = VDX_VOP_TYPE_P;
+    iMBType[iCurMBNum] = iMBCodingType;
+    
+    if (!aMBInstance->fCodedMB && iDoModeTranscoding)
+    {
+        /* this MB is not coded and need to be converted to target mode,
+        out put the possible MB stuffing bits and COD
+        */
+        /* MB stuffing bits if they exsit */
+        vdtCopyBuffer(iInBuffer, iOutBuffer,
+            aMBInstance->DataItemStartByteIndex[11], aMBInstance->DataItemStartBitIndex[11],
+            aMBInstance->DataItemEndByteIndex[11], aMBInstance->DataItemEndBitIndex[11]);
+        /* It is a not-coded MB, output  1 bit COD (it always exists in P frame) */
+        sPutBits (iOutBuffer, 1, 1);
+        iLastMBNum = iCurMBNum;
+    }
+    else if (!iCurMBNumInVP && iDoTranscoding) 
+    {
+        if (!iDoModeTranscoding)
+        {
+        /* We are not doing bitstream transcoding, 
+        we have color effect here and need to reconstruct data partitions.
+            */
+            ReconstructPMBPartitions();
+        }
+    }
+}
+
+
+
+/*
+* TranscodingOneMB
+*
+* Parameters: 
+*
+* Function:
+*    Transcoding one MB, which may include dequantization, requantization , and re-encoding
+* Returns:
+*    DMD error codes since called from decmbdct
+*
+*/
+int CMPEG4Transcoder::TranscodingOneMB(dmdPParam_t *aParam = NULL)
+{
+/* Because it has block data, this MB must be a coded MB,
+which means the position indicated by iMBStartByteIndex and iMBStartBitIndex starts with a MCBPC 
+    */
+    VDTASSERT(!(!iCurPMBinstance->fCodedMB && iMBCodingType == VDX_MB_INTER));
+    
+    if (!iDoTranscoding)
+        {
+        iLastMBNum = iCurMBNum; // need to update the variable to avoid marking this as noncoded MB
+        return TX_OK;
+        }
+    
+    int dataPartitioned = (iBitStreamMode == EVedVideoBitstreamModeMPEG4DP_RVLC || iBitStreamMode == EVedVideoBitstreamModeMPEG4Resyn_DP_RVLC 
+        || iBitStreamMode == EVedVideoBitstreamModeMPEG4DP ||  iBitStreamMode == EVedVideoBitstreamModeMPEG4Resyn_DP);
+    
+    if (dataPartitioned)
+    {
+        /* since we need to handle MB stuffing bits, which are handle outside the transcoder in other modes,
+        not coded MBs and MB stuffing bits are handled in OnePMBDataStartedDataPartitioned, 
+             ReconstuctI/PMBPartitios or ConstructRegularMPEG4MBData
+        */
+    }
+    else if(iCurMBNum != iLastMBNum + 1 )
+    {
+        /* if previous MBs are lost or not coded, we copy one MB with COD = 1; */
+        for (int i = 0 ; i < iCurMBNum - iLastMBNum - 1; i++)
+        {
+            /* output  1 bit COD */
+            sPutBits (iOutBuffer, 1, 1);
+        }
+    }
+    
+    int newMCBPCLen = 0;
+    int newMCBPC = 0;
+    int oldMCBPCLen = 0;
+    
+    /* determine whether to change mcbpc */
+    if (iColorEffect)
+    {
+        if (iVopCodingType == VDX_VOP_TYPE_P) 
+        {
+            oldMCBPCLen = vdtGetPMBBlackAndWhiteMCBPC(newMCBPCLen, newMCBPC, iCurPMBinstance->mcbpc);
+        }
+        else
+        {
+            oldMCBPCLen = vdtGetIMBBlackAndWhiteMCBPC(newMCBPCLen, newMCBPC, iCurIMBinstance->mcbpc);
+        }
+    }
+    
+
+    
+    if (iDoModeTranscoding && ( (iTargetFormat == EVedVideoTypeH263Profile0Level10) ||
+                                (iTargetFormat == EVedVideoTypeH263Profile0Level45) ) )
+    {
+        if ( ConstructH263MBData(aParam, newMCBPCLen, newMCBPC) != VDC_OK )
+            {
+            return TX_ERR;
+            }
+    }
+    else /* possible H263->MPEG4 transcoding */
+        
+    {
+        /* MPEG4 with VDT_RESYN and VDT_REGULAR, we only do bitstream copying */
+        if ( iBitStreamMode == EVedVideoBitstreamModeMPEG4Resyn || iBitStreamMode == EVedVideoBitstreamModeMPEG4Regular ||
+            ((iBitStreamMode ==EVedVideoBitstreamModeMPEG4ShortHeader || iBitStreamMode == EVedVideoBitstreamModeH263) && !iDoModeTranscoding) )
+        {
+        /* the MB stuffing is taken card of outside in file viddemux.cpp
+        we only need to output COD, MCBPC
+            */
+            int mcbpcStartByteIndex, mcbpcStartBitIndex;
+            
+            if (iVopCodingType == VDX_VOP_TYPE_I)
+            {
+                mcbpcStartByteIndex = iCurIMBinstance->DataItemStartByteIndex[0];
+                mcbpcStartBitIndex = iCurIMBinstance->DataItemStartBitIndex[0];
+            }
+            else
+            {
+                mcbpcStartByteIndex = iCurPMBinstance->DataItemStartByteIndex[0];
+                mcbpcStartBitIndex = iCurPMBinstance->DataItemStartBitIndex[0];
+                /* It is a coded MB, output  1 bit COD (it always exists in P frame) */
+                sPutBits (iOutBuffer, 1, 0);
+            }
+            
+            if (!iColorEffect)
+            {
+                bufEdit.copyMode = CopyWhole; /* whole */
+                CopyStream(iInBuffer,iOutBuffer,&bufEdit,mcbpcStartByteIndex,mcbpcStartBitIndex);
+            }
+            else
+            {
+                /* modify mcbpc and copy only the Y data */
+                bufEdit.copyMode = CopyWithEdit; // copy with edit
+                bufEdit.editParams[0].StartByteIndex = mcbpcStartByteIndex; 
+                bufEdit.editParams[0].StartBitIndex  = mcbpcStartBitIndex; 
+                bufEdit.editParams[0].curNumBits = oldMCBPCLen; 
+                bufEdit.editParams[0].newNumBits = newMCBPCLen; 
+                bufEdit.editParams[0].newValue = newMCBPC; 
+                CopyStream(iInBuffer,iOutBuffer,&bufEdit,mcbpcStartByteIndex,mcbpcStartBitIndex);
+                
+                /* disgard the UV data */
+                int16 errorCode = 0;
+                int bitsToRewind = ((iInBuffer->getIndex << 3) + 7  - iInBuffer->bitIndex) 
+                                     - ((iBlockStartByteIndex[4] << 3) + 7 - iBlockStartBitIndex[4]);
+                bibRewindBits(bitsToRewind, iOutBuffer, &errorCode );
+                
+                if (iMBCodingType == VDX_MB_INTRA)
+                {
+                    if (iBitStreamMode == EVedVideoBitstreamModeMPEG4ShortHeader || iBitStreamMode == EVedVideoBitstreamModeH263)
+                    {
+                        sResetH263IntraDcUV(iOutBuffer, iColorToneU, iColorToneV);                        
+                    }
+                    else
+                    {
+                        ResetMPEG4IntraDcUV();
+                    }
+                }
+            }
+        }
+
+        else if ((iBitStreamMode == EVedVideoBitstreamModeMPEG4ShortHeader || iBitStreamMode == EVedVideoBitstreamModeH263) && iDoModeTranscoding)
+        {
+            H263ToMPEG4MBData(newMCBPCLen, newMCBPC);
+        }
+        
+        else /* data partitioned */
+        {
+            if (iDoModeTranscoding)
+            {
+                /* for data partitioned bitstream, we do the bitstream rearrangement  */
+                ConstructRegularMPEG4MBData(newMCBPCLen, newMCBPC);
+            }
+            else
+            {
+                /* copy the ACs or DCTs */
+                bufEdit.copyMode = CopyWhole; // whole
+                CopyStream(iInBuffer,iOutBuffer,&bufEdit,iBlockStartByteIndex[0],iBlockStartBitIndex[0]);
+                if (iColorEffect)
+                {
+                    /* discard U V data */
+                    int16 errorCode = 0;
+                    int bitsToRewind = ((iInBuffer->getIndex << 3) + 7  - iInBuffer->bitIndex) 
+                                             - ((iBlockStartByteIndex[4] << 3) + 7 - iBlockStartBitIndex[4]);
+                    bibRewindBits(bitsToRewind, iOutBuffer, &errorCode );
+                }
+            }
+        }
+
+    }
+    iLastMBNum = iCurMBNum;
+    return TX_OK;
+}
+
+
+
+
+/*
+* ReconstructIMBPartitions
+*
+* Parameters: 
+*
+* Function:
+*    Recontruct the partitions for color effect when we are not doing format transcoding
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::ReconstructIMBPartitions()
+{
+    vdxIMBListItem_t *MBinstance;
+     int *dataItemStartByteIndex;
+     int *dataItemStartBitIndex;
+     int *dataItemEndByteIndex;
+     int *dataItemEndBitIndex;
+     int newMCBPCLen = 0;
+     int newMCBPC = 0;
+     
+     VDTASSERT(iMBList);
+     
+     for (dlstHead(iMBList, (void **) &MBinstance); 
+     MBinstance != NULL; 
+     dlstNext(iMBList, (void **) &MBinstance))
+      {
+         dataItemStartByteIndex = MBinstance->DataItemStartByteIndex;
+         dataItemStartBitIndex  = MBinstance->DataItemStartBitIndex;
+         dataItemEndByteIndex   = MBinstance->DataItemEndByteIndex;
+         dataItemEndBitIndex    = MBinstance->DataItemEndBitIndex;
+         // MB stuffing bits if they exsit
+         vdtCopyBuffer(iInBuffer, iOutBuffer, dataItemStartByteIndex[11], dataItemStartBitIndex[11],
+             dataItemEndByteIndex[11], dataItemEndBitIndex[11]);
+         
+         /* MCBPC    */
+         if (iColorEffect)
+         {
+             /* MCBPC Changed. Ignore the old value (not used) */
+             vdtGetIMBBlackAndWhiteMCBPC(newMCBPCLen, newMCBPC, MBinstance->mcbpc);
+             sPutBits(iOutBuffer, newMCBPCLen, newMCBPC);
+         }
+         else
+         {
+             vdtCopyBuffer(iInBuffer, iOutBuffer,
+                 dataItemStartByteIndex[0], dataItemStartBitIndex[0],
+                 dataItemEndByteIndex[0], dataItemEndBitIndex[0]);
+         }
+         
+         /* DQUANT, if it exsits */
+         vdtCopyBuffer(iInBuffer, iOutBuffer,
+                   dataItemStartByteIndex[1], dataItemStartBitIndex[1],
+                     dataItemEndByteIndex[1], dataItemEndBitIndex[1]);
+         
+         /* INTRA DCs */
+         if (!iColorEffect)
+         {
+             vdtCopyBuffer(iInBuffer, iOutBuffer,
+                 dataItemStartByteIndex[4], dataItemStartBitIndex[4],
+                 dataItemEndByteIndex[4], dataItemEndBitIndex[4]);
+         }
+         else
+         {
+             if (!(VDT_NO_DATA(dataItemStartByteIndex[4], dataItemStartBitIndex[4],
+                 dataItemEndByteIndex[4], dataItemEndBitIndex[4])))   
+             {
+                 vdtCopyBuffer(iInBuffer, iOutBuffer,
+                     dataItemStartByteIndex[4], dataItemStartBitIndex[4],
+                     dataItemStartByteIndex[8], dataItemStartBitIndex[8]);
+                 ResetMPEG4IntraDcUV();
+             }
+         }
+     }
+     
+     /* DC marker */
+     sPutBits(iOutBuffer, DC_MARKER_LENGTH, DC_MARKER);
+     
+   for (dlstHead(iMBList, (void **) &MBinstance); 
+     MBinstance != NULL; 
+     dlstNext(iMBList, (void **) &MBinstance))
+      {
+         dataItemStartByteIndex = MBinstance->DataItemStartByteIndex;
+         dataItemStartBitIndex  = MBinstance->DataItemStartBitIndex;
+         dataItemEndByteIndex   = MBinstance->DataItemEndByteIndex;
+         dataItemEndBitIndex    = MBinstance->DataItemEndBitIndex;
+         
+         /* ac_pred_flag */
+         vdtCopyBuffer(iInBuffer, iOutBuffer,
+                   dataItemStartByteIndex[3], dataItemStartBitIndex[3],
+                     dataItemEndByteIndex[3], dataItemEndBitIndex[3]);
+         
+         /* CBPY */
+         vdtCopyBuffer(iInBuffer, iOutBuffer,
+                   dataItemStartByteIndex[2], dataItemStartBitIndex[2],
+                     dataItemEndByteIndex[2], dataItemEndBitIndex[2]);
+      }
+     
+      /* make sure the head of the list is reset */
+      dlstHead(iMBList, (void **) &MBinstance);
+}
+
+/*
+* ReconstructPMBPartitions
+*
+* Parameters: 
+*
+* Function:
+*    Recontruct the partitions for color effect when we are not doing format transcoding
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::ReconstructPMBPartitions()
+{
+    vdxPMBListItem_t *MBinstance;
+    int *dataItemStartByteIndex;
+    int *dataItemStartBitIndex;
+    int *dataItemEndByteIndex;
+    int *dataItemEndBitIndex;
+    int newMCBPCLen = 0;
+    int newMCBPC = 0;
+     
+    VDTASSERT(iMBList);
+     
+  for (dlstHead(iMBList, (void **) &MBinstance); 
+    MBinstance != NULL; 
+    dlstNext(iMBList, (void **) &MBinstance))
+    {
+        dataItemStartByteIndex = MBinstance->DataItemStartByteIndex;
+        dataItemStartBitIndex  = MBinstance->DataItemStartBitIndex;
+        dataItemEndByteIndex   = MBinstance->DataItemEndByteIndex;
+        dataItemEndBitIndex    = MBinstance->DataItemEndBitIndex;
+        
+        /* MB stuffing bits if they exsit */
+        vdtCopyBuffer(iInBuffer, iOutBuffer, dataItemStartByteIndex[11], dataItemStartBitIndex[11],
+            dataItemEndByteIndex[11], dataItemEndBitIndex[11]);
+        
+        if (MBinstance->fCodedMB)
+        {
+            /* output  1 bit COD, coded */
+            sPutBits (iOutBuffer, 1, 0);
+            
+            /* MCBPC     */
+            if (iColorEffect)
+            {
+                /* MCBPC Changed, ignore the return value */
+                vdtGetPMBBlackAndWhiteMCBPC(newMCBPCLen, newMCBPC, MBinstance->mcbpc);
+                sPutBits(iOutBuffer, newMCBPCLen, newMCBPC);
+            }
+            else
+            {
+                vdtCopyBuffer(iInBuffer, iOutBuffer,
+                    dataItemStartByteIndex[0], dataItemStartBitIndex[0],
+                    dataItemEndByteIndex[0], dataItemEndBitIndex[0]);
+            }
+            
+            /* MVs, if they exist */
+            vdtCopyBuffer(iInBuffer, iOutBuffer,
+                dataItemStartByteIndex[10], dataItemStartBitIndex[10],
+                dataItemEndByteIndex[10], dataItemEndBitIndex[10]);
+        }
+        else
+        {
+            /* output  1 bit COD, not coded */
+            sPutBits (iOutBuffer, 1, 1);
+        }
+    }
+     
+    /* MM marker */
+    sPutBits(iOutBuffer, MOTION_MARKER_LENGTH, MOTION_MARKER);
+     
+    for (dlstHead(iMBList, (void **) &MBinstance); 
+    MBinstance != NULL; 
+    dlstNext(iMBList, (void **) &MBinstance))
+    {
+        if (MBinstance->fCodedMB)
+        {
+            dataItemStartByteIndex = MBinstance->DataItemStartByteIndex;
+            dataItemStartBitIndex  = MBinstance->DataItemStartBitIndex;
+            dataItemEndByteIndex   = MBinstance->DataItemEndByteIndex;
+            dataItemEndBitIndex    = MBinstance->DataItemEndBitIndex;
+            
+            /* ac_pred_flag, if it exsits */
+            vdtCopyBuffer(iInBuffer, iOutBuffer,
+                dataItemStartByteIndex[3], dataItemStartBitIndex[3],
+                dataItemEndByteIndex[3], dataItemEndBitIndex[3]);
+            
+            /* CBPY,  */
+            vdtCopyBuffer(iInBuffer, iOutBuffer,
+                dataItemStartByteIndex[2], dataItemStartBitIndex[2],
+                dataItemEndByteIndex[2], dataItemEndBitIndex[2]);
+            /* DQUANT, if it exsits */
+            vdtCopyBuffer(iInBuffer, iOutBuffer,
+                dataItemStartByteIndex[1], dataItemStartBitIndex[1],
+                dataItemEndByteIndex[1], dataItemEndBitIndex[1]);
+            
+            /* INTRA DCs, if they exsit */
+            if (!iColorEffect)
+            {
+                vdtCopyBuffer(iInBuffer, iOutBuffer,
+                    dataItemStartByteIndex[4], dataItemStartBitIndex[4],
+                    dataItemEndByteIndex[4], dataItemEndBitIndex[4]);
+            }
+            else
+            {
+                if (!(VDT_NO_DATA(dataItemStartByteIndex[4], dataItemStartBitIndex[4],
+                    dataItemEndByteIndex[4], dataItemEndBitIndex[4])))   
+                {
+                    vdtCopyBuffer(iInBuffer, iOutBuffer,
+                        dataItemStartByteIndex[4], dataItemStartBitIndex[4],
+                        dataItemStartByteIndex[8], dataItemStartBitIndex[8]);
+                    ResetMPEG4IntraDcUV();
+                }
+            }
+        }
+    }
+     
+    /* make sure the head of the list is reset */
+    dlstHead(iMBList, (void **) &MBinstance);
+}
+
+/*
+* ResetMPEG4IntraDcUV
+*
+* Parameters: 
+*
+* Function:
+*    This function resets the DCc for U V block in INTRA MB.
+*    Inputs are valid only with Color Effect
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::ResetMPEG4IntraDcUV()
+{
+    /* set INTRADC for u,v in the output buffer */
+    TInt sizeU, sizeCodeU, sizeCodeLengthU, valueU, valueCodeU, valueCodeLengthU;
+    TInt sizeV, sizeCodeV, sizeCodeLengthV, valueV, valueCodeV, valueCodeLengthV;
+    TInt curDcScaler, delta; 
+    TReal realDelta, realVal;
+    TInt mbh, mbv, mbd;  // previous MB in the horizontal, vertical and diagonal directions
+    TInt codeMB; 
+    
+    // initialize for codewords
+    sizeU = sizeCodeU = sizeCodeLengthU = valueCodeU = valueCodeLengthU = 0;
+    sizeV = sizeCodeV = sizeCodeLengthV = valueCodeV = valueCodeLengthV = 0;
+
+    // initialize for prediction
+    mbh = mbv = mbd = VDX_MB_INTER;
+    codeMB = 0;
+    
+    // NOTE: VDX_MB_INTER=1, VDX_MB_INTRA=2, NOT-CODED MB has a value of 0
+    if (iVopCodingType == VDX_VOP_TYPE_I)
+    {
+        /* encode intra DC coefficients for INTRA MBs of I-VOP if 
+           either of the following is true:
+            -
+            -
+            else, do not encode intra DC
+           (because rest of MBs have differential intra DC, which is zero)
+        */
+        if (!iCurMBNumInVP || 
+             (!(iCurMBNum%iMBsinWidth) && (iCurMBNumInVP<iMBsinWidth)))
+        {
+            codeMB = 1;
+        }
+    }
+    else if (iVopCodingType == VDX_VOP_TYPE_P)
+    {
+        if (iCurMBNumInVP>iMBsinWidth)
+        { 
+            if (iCurMBNum%iMBsinWidth)
+            {
+                mbh = iMBType[iCurMBNum-1];
+                mbd = iMBType[iCurMBNum-iMBsinWidth-1];
+            }
+            mbv = iMBType[iCurMBNum-iMBsinWidth];
+        }        
+        else if (iCurMBNumInVP==iMBsinWidth)
+        {
+            if (iCurMBNum%iMBsinWidth)
+            {
+                mbh = iMBType[iCurMBNum-1];
+            }
+            mbv = iMBType[iCurMBNum-iMBsinWidth];
+        }
+        else if (iCurMBNumInVP>0)
+        {
+            if (iCurMBNum%iMBsinWidth)
+            {
+                mbh = iMBType[iCurMBNum-1];
+            }
+        }
+      
+        // 
+        if ((mbh<VDX_MB_INTRA && mbv<VDX_MB_INTRA) ||
+            (mbd==VDX_MB_INTRA && ((mbh==VDX_MB_INTRA && mbv<VDX_MB_INTRA) || 
+            (mbh<VDX_MB_INTRA && mbv==VDX_MB_INTRA))))
+        {
+            codeMB = 1;
+        }
+    }
+
+    if (codeMB)  // if IntraDC need to be coded
+    {
+        // color-toned U,V values
+        valueU = iColorToneU;
+        valueV = iColorToneV;
+      
+        // compensate for different QP than original
+        if (iCurQuant != iRefQuant)  
+        {
+            // calculate change in dc value
+            curDcScaler = GetMpeg4DcScalerUV(iCurQuant);
+            realDelta = TReal(iDcScaler-curDcScaler)/TReal(curDcScaler);
+            if (realDelta != 0.0)
+            {
+                // U
+                realVal = realDelta*TReal(valueU);
+                delta = TInt(realVal + ((realVal<0) ? (-0.5) : (0.5)));
+                valueU += delta;
+                // V
+                realVal = realDelta*TReal(valueV);
+                delta = TInt(realVal + ((realVal<0) ? (-0.5) : (0.5)));
+                valueV += delta;
+            }
+        }
+         
+        // get codewords
+        GetMPEG4IntraDcCoeffUV(valueU, sizeU, sizeCodeU, sizeCodeLengthU, 
+        valueCodeU, valueCodeLengthU);
+        GetMPEG4IntraDcCoeffUV(valueV, sizeV, sizeCodeV, sizeCodeLengthV, 
+        valueCodeV, valueCodeLengthV);
+      
+        // code codewords
+        // U
+        sPutBits(iOutBuffer, sizeCodeLengthU, sizeCodeU); // dct_dc_coeff size
+        if (sizeCodeU != 3) // size=0
+        {
+            sPutBits(iOutBuffer, valueCodeLengthU, valueCodeU); // dct_dc_coeff differential
+            if (valueCodeLengthU>8)
+                sPutBits(iOutBuffer, 1, 1); // marker bit
+        }
+      
+        // V
+        sPutBits(iOutBuffer, sizeCodeLengthV, sizeCodeV); // dct_dc_coeff size
+        if (sizeCodeV != 3) // size=0
+        {
+            sPutBits(iOutBuffer, valueCodeLengthV, valueCodeV); // dct_dc_coeff differential
+            if (valueCodeLengthV>8)
+                sPutBits(iOutBuffer, 1, 1); // marker bit
+        }
+    }    
+    else
+    {        
+        sPutBits (iOutBuffer, 2, 3); /* U */
+        sPutBits (iOutBuffer, 2, 3); /* V */
+    }
+}
+
+
+/*
+* GetMPEG4IntraDcCoeffUV
+*
+* Parameters: 
+*     aValue   coefficient value
+*     aDCAC    pointer the reconstructed coefficients
+* Function:
+*    This function fills the reconstructed DCAC values for INTRA block.
+*    Inputs are valid only with Color Effect
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::GetMPEG4IntraDcCoeffUV(TInt aValue, TInt& aSize, 
+  TInt& aSizeCode, TInt& aSizeCodeLength, TInt& aValueCode, TInt& aValueCodeLength)
+{
+    int absVal = (aValue>=0 ? aValue : -aValue);
+    // size of aValueCode
+    for (aSize=0; absVal|0; absVal>>=1, aSize++) ;
+    if (aSize)
+    {
+        // codeword for aSize
+        if (aSize==1)
+        {
+            aSizeCode = 2;
+            aSizeCodeLength = 2;
+        }
+        else
+        {
+            aSizeCode = 1;
+            aSizeCodeLength = aSize;
+        }
+    
+        // codeword for aValue
+        aValueCode = aValue;
+        if (aValue<0)
+            aValueCode += ((1<<aSize)-1);
+        aValueCodeLength = aSize;
+    }
+    else 
+    {
+        // codeword for aSize
+        aSizeCode = 3;        // codeword for size=0
+        aSizeCodeLength = 2;
+        // no codeword for aValue
+        aValueCode = aValueCodeLength = 0;
+    }
+}
+
+
+/*
+* AddOneBlockDCACrecon
+*
+* Parameters: 
+*     aIndex   block index
+*     aDCAC    pointer the reconstructed coefficients
+* Function:
+*    This function fills the reconstructed DCAC values for INTRA block.
+*    Inputs are valid only with Color Effect
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::AddOneBlockDCACrecon(int aIndex, int *aDCAC)
+{
+    VDTASSERT(aIndex >= 0 && aIndex < 6); 
+    
+    if (aDCAC && iDoModeTranscoding && (iTargetFormat == EVedVideoTypeH263Profile0Level10 ||
+                                        iTargetFormat == EVedVideoTypeH263Profile0Level45))
+    {
+      /* we only need the reconstructed DCACs for MPEG4 -> H263 */
+      /* It is a coded block    */
+      memcpy(iDCTBlockData + (aIndex << 6), aDCAC, sizeof(int) * BLOCK_COEFF_SIZE);
+    }
+}
+
+/*
+* ConstructH263MBData
+*
+* Parameters: 
+*     aNewMCBPCLen     new length of mcbpc
+*     aNewMCBPC        new mcbpc
+* Function:
+*    This function creates a new H263 MB
+*    Inputs are valid only with Color Effect
+* Returns:
+*    VDC error codes
+*
+*/
+int CMPEG4Transcoder::ConstructH263MBData(dmdPParam_t *aParam, int /*aNewMCBPCLen*/, int /*aNewMCBPC*/)
+{
+    /* MB data part1: output MCBPC, CBPY, DQuant, MV, intra DC etc */
+    int *dataItemStartByteIndex;
+    int *dataItemStartBitIndex;
+    int *dataItemEndByteIndex;
+    int *dataItemEndBitIndex;
+    int quant, dquant;
+    int codedBlockPattern = 0;
+    
+    const unsigned int sDquant[5] = 
+    {
+        1, 0, (unsigned int)65536, 2, 3
+    };
+    
+  if (iVopCodingType == VDX_VOP_TYPE_P) 
+    {
+        dataItemStartByteIndex = iCurPMBinstance->DataItemStartByteIndex;
+        dataItemStartBitIndex  = iCurPMBinstance->DataItemStartBitIndex;
+        dataItemEndByteIndex   = iCurPMBinstance->DataItemEndByteIndex;
+        dataItemEndBitIndex    = iCurPMBinstance->DataItemEndBitIndex;
+        quant = iCurPMBinstance->quant;
+        dquant = iCurPMBinstance->dquant;
+    }
+    else
+    {
+        dataItemStartByteIndex = iCurIMBinstance->DataItemStartByteIndex;
+        dataItemStartBitIndex  = iCurIMBinstance->DataItemStartBitIndex;
+        dataItemEndByteIndex   = iCurIMBinstance->DataItemEndByteIndex;
+        dataItemEndBitIndex    = iCurIMBinstance->DataItemEndBitIndex;
+        quant = iCurIMBinstance->quant;
+        dquant = iCurIMBinstance->dquant;
+    }
+    
+    if (iPreQuant != quant - dquant)
+    {
+        /* last quant in MPEG4 and H263 is different, dquant and VLCs may not be reused */
+        if (abs(quant - iPreQuant) > 2)
+        {
+            /* VLCs cannot be reused, obtain the new ones */
+            sQuantizeMB(iDCTBlockData, quant, iPreQuant, 
+                iMBCodingType, iColorEffect);
+            quant = iPreQuant;
+            dquant = 0;
+        }
+        else
+        {
+            /* VLCs can be reused, but need to change dquant and MCBPC */
+            dquant = quant - iPreQuant;
+        }
+    }
+    
+    /* MB stuffing bits if they exsit */
+    vdtCopyBuffer(iInBuffer, iOutBuffer, dataItemStartByteIndex[11], dataItemStartBitIndex[11],
+        dataItemEndByteIndex[11], dataItemEndBitIndex[11]);
+    
+    if (iMBCodingType == VDX_MB_INTER) 
+    {
+        VDTASSERT(aParam);
+        tMBPosition mbPos;
+        tMotionVector mvTestOutside;
+        mbPos.x = aParam->xPosInMBs * 16; 
+        mbPos.y = aParam->yPosInMBs * 16;
+        mbPos.LeftBound = 0;
+        mbPos.RightBound = iVDEInstance->lumWidth << 1;
+        mbPos.TopBound = 0;
+        mbPos.BottomBound = iVDEInstance->lumHeight << 1;
+        mvTestOutside.mvx = (int16) ((aParam->mvx[0] << 1) / 10);
+        mvTestOutside.mvy = (int16) ((aParam->mvy[0] << 1) / 10);
+        
+        /* Three cases for MVs. 1): 4MVs -> need mapping 2). 1 outside frame MV 3) rounding type = 1 */
+        vdcInstance_t * vdcTemp = (vdcInstance_t *)(iVDEInstance->vdcHInstance);
+        
+        /* Two cases for MVs. 1): 4MVs -> need mapping 2). 1 outside frame MV */
+        if (iCurPMBinstance->numMVs == 4 || (iCurPMBinstance->numMVs == 1 && 
+            vbmMVOutsideBound(&mbPos, &mvTestOutside, 1)) || vdcTemp->pictureParam.rtype)
+        {
+            int32 numTextureBits;
+            int32 searchRange = 16;
+            tMotionVector   *initPred; 
+            (h263mbi+iCurMBNum)->QuantScale = (int16) quant;
+            (h263mbi+iCurMBNum)->dQuant = (int16) dquant;
+            
+            /* note: this buffer is also used in the diamond search and half-pixel search !!!!! 
+               which needs at least 8 points
+            */
+            initPred = (tMotionVector*) malloc(8 * sizeof (tMotionVector));
+            if(!initPred)
+            {
+                //Memory not available 
+                return TX_ERR;
+            }
+
+                        
+            for (int i = 0; i < iCurPMBinstance->numMVs ; i++)
+            {
+                (initPred + i)->mvx = (int16) (aParam->mvx[i] / 10); /* the recorded mv is multipied by 10, */
+                (initPred + i)->mvy = (int16) (aParam->mvy[i] / 10); /* the recorded mv is multipied by 10, */
+            }
+            int32 noOfPredictors = iCurPMBinstance->numMVs;
+            
+            /* perform the 4MVs -> 1MV mapping, and output this MB */
+            vbmPutInterMB(&mbPos,
+                iOutBuffer,aParam,
+                initPred, noOfPredictors,
+                (u_int32) iVDEInstance->lumWidth, (u_int32) iVDEInstance->lumHeight,
+                searchRange, iCurMBNum, &numTextureBits, 
+                (int16)iColorEffect, h263mbi);
+            /*  the MVs buffer is updated inside vbmPutInterMB */
+            
+            if (initPred)
+                free(initPred);
+        }
+        else
+        {
+            /* Here, for Inter MB with One inside Frame MV, we simply reuse the DCTs */
+            VDTASSERT(iCurPMBinstance->numMVs == 1);
+            
+            /* It is a coded MB, output 1 bit COD (it always exists in P frame) */
+            sPutBits (iOutBuffer, 1, 0);
+            int         cbpy;
+            int         mcbpcVal;
+            int         len;
+            
+            codedBlockPattern = sFindCBP(iDCTBlockData, OFF);
+            mcbpcVal = iColorEffect? 0 : (codedBlockPattern & 3);
+            cbpy = ((codedBlockPattern >> 2) & 0xf);
+            vbmGetH263PMCBPC(dquant, iColorEffect, cbpy, mcbpcVal, len);
+            sPutBits(iOutBuffer, len, mcbpcVal); //MCBPC, CBPY
+            
+            /* DQUANT, if it exsits */
+            if (dquant)
+            {
+                sPutBits(iOutBuffer, 2, sDquant[dquant + 2]);
+            }
+            /* recode MVs, one more indice exists in the MV VLC table in MPEG4
+               moreover, vop_fcode can be larger than 1 (although it may rarely happens), 
+                 so it is better to redo the VLC coding
+      */
+            /* the recorded mv is multipied by 10, in pixel unit */
+            int16 mvx = (int16) ((aParam->mvx[0] << 1) / 10); 
+            int16 mvy = (int16) ((aParam->mvy[0] << 1) / 10);
+            
+            tMotionVector   lPredMV[4];
+            tMBInfo *mbi = h263mbi + iCurMBNum;
+            
+            /* get the new predicted MV */
+            vbmMvPrediction(mbi, iCurMBNum, lPredMV, (u_int32)iMBsinWidth);
+            
+            vbmEncodeMVDifferential(mvx - lPredMV[0].mvx, mvy - lPredMV[0].mvy, 1, iOutBuffer);
+            cbpy = 32;
+            /* following is the block level data */
+            for (int i = 0; i < (iColorEffect? 4 : 6); i++)
+            {
+                int fBlockCoded = cbpy & codedBlockPattern;
+                if (fBlockCoded)
+                {
+                    /* here we do the VLC coding again */ 
+                    int numTextureBits = 0;
+                    vdtPutInterMBCMT(iOutBuffer,0, iDCTBlockData + i * BLOCK_COEFF_SIZE, &numTextureBits, ON);
+                }
+                cbpy >>= 1;
+            } 
+            
+            /* update the MVs buffer */
+            (h263mbi + iCurMBNum)->MV[0][0] = (int16) ((aParam->mvx[0] << 1) / 10); /* the recorded mv is multipied by 10 */
+            (h263mbi + iCurMBNum)->MV[0][1] = (int16) ((aParam->mvy[0] << 1) / 10); /* the recorded mv is multipied by 10 */
+            
+        }  /* end of if 4MVs */
+    }
+    else /* INTRA MB */
+    {
+        /* update the MVs buffer */
+        (h263mbi + iCurMBNum)->MV[0][0] = 0;
+        (h263mbi + iCurMBNum)->MV[0][1] = 0;
+        /* MPEG4 and H263 use different methods for INTRA MB, redo the VLC coding */
+        int         cbpy;
+        int         mcbpcVal;
+        int         len;
+        
+        codedBlockPattern = sFindCBP(iDCTBlockData, ON);
+        mcbpcVal = iColorEffect? 0 : (codedBlockPattern & 3);
+        cbpy = ((codedBlockPattern >> 2) & 0xf);
+        vbmGetH263IMCBPC(dquant, (iVopCodingType == VDX_VOP_TYPE_P), iColorEffect, cbpy, mcbpcVal, len);
+        sPutBits(iOutBuffer, len, mcbpcVal); //COD, MCBPC, CBPY
+        
+        /* DQUANT, if it exsits */
+        if (dquant)
+        {
+            sPutBits(iOutBuffer, 2, sDquant[dquant + 2]);
+        }
+        cbpy = 32;
+        
+        /* following is the block level data */
+        for (int i = 0; i < (iColorEffect? 4 : 6); i++)
+        {
+            /* requantize INTRA DC */
+            /* DC Quantization */
+            int coeff = (iDCTBlockData + i * BLOCK_COEFF_SIZE)[0] >> 3;
+            
+            if(coeff < 1) coeff = 1;
+            if(coeff > 254) coeff = 254;
+            if(coeff == 128)
+            {
+                sPutBits(iOutBuffer, 8, 255);
+            }
+            else
+            {
+                sPutBits(iOutBuffer, 8, coeff);
+            }
+            
+            (iDCTBlockData + i * BLOCK_COEFF_SIZE)[0] = coeff;
+            if(cbpy & codedBlockPattern)
+            {
+                int numTextureBits = 0;
+                vdtPutInterMBCMT(iOutBuffer,1, iDCTBlockData + i * BLOCK_COEFF_SIZE, &numTextureBits, ON);
+            }
+            cbpy >>= 1;
+        }
+    }
+    
+  if (iColorEffect && (iMBCodingType == VDX_MB_INTRA))
+    {
+        ResetH263IntraDcUV(iOutBuffer, iColorToneU, iColorToneV);        
+    }
+  iPreQuant = quant;
+  
+  return TX_OK;
+}
+
+/*
+* ConstructRegularMPEG4MBData
+*
+* Parameters: 
+*     aNewMCBPCLen     new length of mcbpc
+*     aNewMCBPC        new mcbpc
+* Function:
+*    This function rearranges the data for bitstream with data partitioning
+*    Only valid in Data Partitioned mode
+*    Inputs are valid only with Color Effect
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::ConstructRegularMPEG4MBData(int aNewMCBPCLen, int aNewMCBPC)
+{
+  /* MB data part1: output MCBPC, CBPY, DQuant, MV, intra DC etc */
+    int *dataItemStartByteIndex;
+    int *dataItemStartBitIndex;
+    int *dataItemEndByteIndex;
+    int *dataItemEndBitIndex;
+    
+    if (iVopCodingType == VDX_VOP_TYPE_P) 
+    {
+        dataItemStartByteIndex = iCurPMBinstance->DataItemStartByteIndex;
+        dataItemStartBitIndex  = iCurPMBinstance->DataItemStartBitIndex;
+        dataItemEndByteIndex   = iCurPMBinstance->DataItemEndByteIndex;
+        dataItemEndBitIndex    = iCurPMBinstance->DataItemEndBitIndex;
+    }
+    else
+    {
+        dataItemStartByteIndex = iCurIMBinstance->DataItemStartByteIndex;
+        dataItemStartBitIndex  = iCurIMBinstance->DataItemStartBitIndex;
+        dataItemEndByteIndex   = iCurIMBinstance->DataItemEndByteIndex;
+        dataItemEndBitIndex    = iCurIMBinstance->DataItemEndBitIndex;
+    }
+    
+    /* MB stuffing bits if they exsit */
+    vdtCopyBuffer(iInBuffer, iOutBuffer, dataItemStartByteIndex[11], dataItemStartBitIndex[11],
+        dataItemEndByteIndex[11], dataItemEndBitIndex[11]);
+    
+    if (iVopCodingType == VDX_VOP_TYPE_P)
+    {
+        /* It is a coded MB, output  1 bit COD (it always exists in P frame) */
+        sPutBits (iOutBuffer, 1, 0);
+    }
+    
+    /* MCBPC. NOTE: the positions do not include MCBPC stuffing bits !! */
+    if (iColorEffect)
+    {
+        /* MCBPC Changed */
+        sPutBits(iOutBuffer, aNewMCBPCLen, aNewMCBPC);
+    }
+    else
+    {
+        vdtCopyBuffer(iInBuffer, iOutBuffer, dataItemStartByteIndex[0], dataItemStartBitIndex[0],
+            dataItemEndByteIndex[0], dataItemEndBitIndex[0]);
+    }
+    /* ac_pred_flag, if it exsits */
+    vdtCopyBuffer(iInBuffer, iOutBuffer, dataItemStartByteIndex[3], dataItemStartBitIndex[3],
+        dataItemEndByteIndex[3], dataItemEndBitIndex[3]);
+    
+    /* CBPY */
+    vdtCopyBuffer(iInBuffer, iOutBuffer, dataItemStartByteIndex[2], dataItemStartBitIndex[2],
+        dataItemEndByteIndex[2], dataItemEndBitIndex[2]);
+    
+    /* DQUANT, if it exsits */
+    vdtCopyBuffer(iInBuffer, iOutBuffer, dataItemStartByteIndex[1], dataItemStartBitIndex[1],
+        dataItemEndByteIndex[1], dataItemEndBitIndex[1]);
+    
+    if (iMBCodingType == VDX_MB_INTER) 
+    {
+        /* MVs, if they exsit */
+        vdtCopyBuffer(iInBuffer, iOutBuffer, dataItemStartByteIndex[10], dataItemStartBitIndex[10],
+            dataItemEndByteIndex[10], dataItemEndBitIndex[10]);
+    }
+    
+    /* following is the block level data */
+    for (int i = 0; i < (iColorEffect? 4 : 6); i++)
+    {
+        /* INTRA DC, if it exsits */
+        vdtCopyBuffer(iInBuffer, iOutBuffer, dataItemStartByteIndex[i + 4], dataItemStartBitIndex[i + 4],
+            dataItemEndByteIndex[i + 4], dataItemEndBitIndex[i + 4]);
+        
+        /* block data part2, AC or DCT coefficients */
+        if (iBitStreamMode == EVedVideoBitstreamModeMPEG4DP_RVLC || iBitStreamMode == EVedVideoBitstreamModeMPEG4Resyn_DP_RVLC)
+        {
+        /* remember for data partitioning, the positions only indicate the  
+        AC or DCTs coefficients
+            */
+            if (VDT_NO_DATA(iBlockStartByteIndex[i], iBlockStartBitIndex[i],
+                iBlockEndByteIndex[i], iBlockEndBitIndex[i]))  
+            {
+                /* no coefficients,skip this block */
+                continue;
+            }
+            else
+            {
+                /* for RVLC coding, we transform the block data back to VLC */
+                int numTextureBits = 0;
+                /* redo the entropy coding, RVLC -> VLC 
+                only for AC (IMB) or DCT (PMB) coefficients
+                */
+                if (iMBCodingType == VDX_MB_INTRA)
+                {
+                    vdtPutIntraMBCMT(iOutBuffer,iDCTBlockData + i * BLOCK_COEFF_SIZE, &numTextureBits, i, 1, 0);
+                }
+                else
+                {
+                    vdtPutInterMBCMT(iOutBuffer,0, iDCTBlockData + i * BLOCK_COEFF_SIZE, &numTextureBits, OFF);
+                }
+            }
+        }
+        else /* ouput the AC or DCT coefficients */
+        {
+            bufEdit.copyMode = CopyWhole; /* CopyWhole */
+            vdtCopyBuffer(iInBuffer,iOutBuffer,
+                iBlockStartByteIndex[i],iBlockStartBitIndex[i],
+                iBlockEndByteIndex[i],iBlockEndBitIndex[i]);
+        }
+    }
+  if (iColorEffect && (iMBCodingType == VDX_MB_INTRA))
+    {
+        ResetMPEG4IntraDcUV();
+    }
+}
+
+
+
+/*
+* AddOneBlockDataToMB
+*
+* Parameters: 
+*     blockData        block data before VLC coding, in ZigZag order
+* Function:
+*    This function input one block data to current MB
+*    only here the whole MB data is retrieved (COD=0)
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::AddOneBlockDataToMB(int aBlockIndex, int *aBlockData)
+{
+    VDTASSERT(aBlockIndex >= 0 && aBlockIndex < 6); 
+    
+    
+    if (aBlockData && iDoModeTranscoding)
+    {
+      /* iDCTBlockData is only used when we need to convert the bitstream to MPEG4_RESYN
+      It is a coded block   
+        */
+      if (iMBCodingType == VDX_MB_INTRA && (iTargetFormat == EVedVideoTypeH263Profile0Level10 ||
+                                            iTargetFormat == EVedVideoTypeH263Profile0Level45))
+        {
+          /* we only need the reconstructed DCACs, skipped */
+        }
+        else
+        {
+          memcpy(iDCTBlockData + (aBlockIndex << 6), aBlockData, sizeof(int) * BLOCK_COEFF_SIZE);
+        }
+    }
+    else 
+    {
+      memset(iDCTBlockData + (aBlockIndex << 6), 0, sizeof(int) * BLOCK_COEFF_SIZE);
+    }
+    
+
+    
+    iBlockEndByteIndex[aBlockIndex] = iInBuffer->getIndex;
+    iBlockEndBitIndex[aBlockIndex] = iInBuffer->bitIndex;
+}
+
+/*
+* ErrorResilienceInfo
+*
+* Parameters: 
+*     header        VOL Header data
+* Function:
+*    This function records the position of resnc_marker_disable bit
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::ErrorResilienceInfo(vdxVolHeader_t *header, int aByte, int aBit)
+{
+    if (header)
+    {
+                
+        memcpy(&iVOLHeader, header, sizeof(vdxVolHeader_t));  // save the header info
+
+    }
+    else
+    {
+        iErrorResilienceStartByteIndex = aByte;  /* save the bits position */
+        iErrorResilienceStartBitIndex  = aBit;
+    }
+}
+
+
+
+/*
+* MPEG4TimerResolution
+*
+* Parameters: 
+*     
+* Function:
+*    This function records the position of vop_time_increment_resolution bit
+* Returns:
+*    None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::MPEG4TimerResolution(int aStartByteIndex, int aStartBitIndex)
+{
+    iTimeResolutionByteIndex = aStartByteIndex;
+    iTimeResolutionBitIndex  = aStartBitIndex;
+}
+
+
+
+void CMPEG4Transcoder::ConstructVOSHeader(int aMPEG4, vdeDecodeParamters_t *aDecoderInfo)
+{
+  if (!aMPEG4 )
+  {
+    /* for H263 and MPEG4 shortheader, no vos generated */
+    if (iErrorResilienceStartByteIndex == KDataNotValid && 
+      iErrorResilienceStartBitIndex == KDataNotValid)
+    {
+      iBitStreamMode = EVedVideoBitstreamModeH263; // pure H.263
+      aDecoderInfo->vosHeaderSize = aDecoderInfo->fModeChanged? KH263ToMpeg4VosSize : 0; 
+    }
+    else
+    {
+      /* we went into the VOL layer. It is a MPEG4 bitstream with short header */
+      iBitStreamMode = EVedVideoBitstreamModeMPEG4ShortHeader; /* MPEG4 shortheader */
+      iShortHeaderEndByteIndex = iInBuffer->getIndex;
+      iShortHeaderEndBitIndex  = iInBuffer->bitIndex;
+      aDecoderInfo->vosHeaderSize = aDecoderInfo->fModeChanged? KH263ToMpeg4VosSize : KShortHeaderMpeg4VosSize; 
+    }
+    fFirstFrameInH263 = ETrue;
+  }
+  else 
+  {
+    iNumMBsInOneVOP = (iVDEInstance->lumHeight * iVDEInstance->lumWidth) / 256;
+    
+    /* even iBitStreamMode is given outside, we renew it here anyway */
+    iBitStreamMode = sGetMPEG4Mode(iVOLHeader.error_res_disable,
+      iVOLHeader.data_partitioned, iVOLHeader.reversible_vlc);
+    
+    if (iTargetFormat != EVedVideoTypeH263Profile0Level10 &&
+      iTargetFormat != EVedVideoTypeH263Profile0Level45) /* EVedVideoTypeMPEG4SimpleProfile or None */
+    {
+      /* copy from the begining of the input buffer */
+      vdtCopyBuffer(iInBuffer,iOutBuffer,0,7, iTimeResolutionByteIndex, iTimeResolutionBitIndex); 
+      /* it is 16 bits */
+      sPutBits (iOutBuffer, KMpeg4VopTimeIncrementResolutionLength, *aDecoderInfo->aMPEG4TargetTimeResolution); 
+      
+      int startByteIndex, startBitIndex;
+      startByteIndex = iTimeResolutionByteIndex + 2;
+      startBitIndex  = iTimeResolutionBitIndex;
+      
+      sPutBits(iOutBuffer, 1, MARKER_BIT);
+      /* close fixed_vop_rate */
+      sPutBits (iOutBuffer, 1, 0); /* it is 1 bit */
+      
+      int num_bits = 0;
+      vdcInstance_t * vdcTemp = (vdcInstance_t *)(iVDEInstance->vdcHInstance);
+      if (vdcTemp->pictureParam.fixed_vop_rate)
+      {
+        for (num_bits = 1; ((vdcTemp->pictureParam.time_increment_resolution-1) >> num_bits) != 0; num_bits++)
+            {
+            }
+      }
+      num_bits += 2;
+      
+      /* following is to skip the fixed_vop_rate */
+      int bitsRemain, bitShift = 0;
+      int bitsToMove = 0 ;
+      /* complete the byte */
+      if (startBitIndex != 7)
+      {
+        bitShift = startBitIndex + 1;
+        bitsToMove = (num_bits < bitShift) ? num_bits : bitShift; 
+        /* update statistics to take care of bit addition or byte completion  */
+        if (num_bits < bitShift)
+        {
+          /* bits skipped but byte not completed */
+          startBitIndex -= bitsToMove;
+        }
+        else
+        {
+          /* byte completed */
+          startByteIndex ++;
+          startBitIndex = 7;
+        }
+      }
+      /* full bytes to skip */
+      startByteIndex += ((num_bits - bitsToMove) >> 3);
+      bitsRemain = (num_bits - bitsToMove) % 8;
+      
+      /* the remaining bits */
+      startBitIndex = ( bitsRemain != 0) ? 7 - bitsRemain : startBitIndex;
+
+      
+      /* check if we have user data in the end of VOL; it cannot be copied as such but needs to be byte aligned */
+      /* first need to rewind the input buffer to be able to seek in it */
+      int16 error = 0;
+      int curByteIndex = iInBuffer->getIndex;
+      int curBitIndex = iInBuffer->bitIndex;
+      int bits = ((curByteIndex - iTimeResolutionByteIndex)<<3) + (7-curBitIndex);
+      bibRewindBits(bits, iInBuffer, &error);
+      int sncCode = sncSeekMPEGStartCode(iInBuffer, 
+          vdcTemp->pictureParam.fcode_forward, 1 /* don't check VOPs */, 1 /* check for user data*/, &error);
+        
+      /* record next resync position */
+      int resyncByteIndex = iInBuffer->getIndex;
+        
+      int stuffBits = 0;
+      int userDataExists = 0;
+      if ( sncCode == SNC_USERDATA )
+      {
+        /* copy only until this sync code, and copy the rest separately in the end. */
+        userDataExists = 1;
+      }
+      else
+      {
+        /* No UD */
+        /* restore the original pointers in iInBuffer */
+        iInBuffer->getIndex = curByteIndex;
+        iInBuffer->bitIndex = curBitIndex;
+      }
+      
+      if (iDoModeTranscoding || aDecoderInfo->fHaveDifferentModes)
+      {
+        /* close the error resilience tools, change the bitstream to regular MPEG4 with resyn marker */
+        int numBits = iVOLHeader.data_partitioned ? 3 : 2;
+        
+        bufEdit.copyMode = CopyWithEdit; 
+        bufEdit.editParams[0].StartByteIndex = iErrorResilienceStartByteIndex; 
+        bufEdit.editParams[0].StartBitIndex = iErrorResilienceStartBitIndex; 
+        bufEdit.editParams[0].curNumBits = numBits; 
+        bufEdit.editParams[0].newNumBits = 2;  
+        bufEdit.editParams[0].newValue = 0;  /* new codeword: resyn, no dp, no rvlc */
+        CopyStream(iInBuffer,iOutBuffer,&bufEdit, startByteIndex,startBitIndex); /* copy from vop_time_increment_resolution */
+
+        /* rewind stuffing bits */
+        int16 error;
+        sncRewindStuffing(iOutBuffer, &error);        
+
+        // stuff bits in outbuffer for next start code   
+        vdtStuffBitsMPEG4(iOutBuffer);
+      }
+      else
+      {
+      
+        /* rewind stuffing bits */
+        sncRewindStuffing(iInBuffer, &error);        
+        
+        /* record the number of bits rewinded - can be from 0 to 8 */
+        /* note that iInBuffer must be byte aligned before rewinding */
+        if (iInBuffer->bitIndex == 7) // full byte rewind
+        { 
+          stuffBits = ( (int)(iInBuffer->getIndex) < resyncByteIndex) ? 8 : 0;
+        }
+        else 
+        {
+          stuffBits = iInBuffer->bitIndex + 1;
+        }
+          
+        /* copy the rest of VOS until the first VOP (or UD) */
+        bufEdit.copyMode = CopyWhole; 
+        vdtCopyBuffer(iInBuffer,iOutBuffer, startByteIndex,startBitIndex,
+          resyncByteIndex, iInBuffer->bitIndex); 
+        
+        // stuff bits in outbuffer for next start code   
+        vdtStuffBitsMPEG4(iOutBuffer);
+        
+        // move inbuffer pointer back to original value
+        bibForwardBits(stuffBits, iInBuffer);
+      }
+      
+      
+      if ( userDataExists )
+      {
+        /* seek for VOP start code */
+        int sncCode = sncSeekMPEGStartCode(iInBuffer, 
+          vdcTemp->pictureParam.fcode_forward, vdcTemp->pictureParam.error_res_disable, 0, &error);
+        
+        /* rewind stuffing bits */
+        sncRewindStuffing(iInBuffer, &error);        
+        
+        // record the number of bits rewinded - can be from 0 to 8
+        // note that iInBuffer must be byte aligned before rewinding
+        if (iInBuffer->bitIndex == 7) // full byte rewind
+        { 
+          stuffBits = ( (int)(iInBuffer->getIndex) < resyncByteIndex) ? 8 : 0;
+        }
+        else 
+        {
+          stuffBits = iInBuffer->bitIndex + 1;
+        }
+        
+        bufEdit.copyMode = CopyWhole; 
+        vdtCopyBuffer(iInBuffer,iOutBuffer, resyncByteIndex, 7,
+          iInBuffer->getIndex, iInBuffer->bitIndex); 
+        
+        // stuff bits in outbuffer for next start code   
+        vdtStuffBitsMPEG4(iOutBuffer);
+        
+        // move inbuffer pointer back to original value
+        bibForwardBits(stuffBits, iInBuffer);
+        
+        
+        
+      }
+      
+      aDecoderInfo->vosHeaderSize = iOutBuffer->getIndex;
+    }
+        
+    PRINT((_L("CMPEG4Transcoder: ConstructVOSHeader. resyn: %d, data partitioned: %d, rvlc: %d, resolution: %d"),
+      iVOLHeader.error_res_disable, iVOLHeader.data_partitioned, iVOLHeader.reversible_vlc,
+      aDecoderInfo->iTimeIncrementResolution));
+  }
+  PRINT((_L("CMPEG4Transcoder:  streammode: %d, outputformat: %d, vos size : %d"), 
+    iBitStreamMode, iTargetFormat, aDecoderInfo->vosHeaderSize));
+}
+
+
+
+
+/****************************************************************
+*                                                               *
+*    Functions for H.263, or H.263 -> MPEG4 (only baseline H.263) *
+*                                                               *
+*****************************************************************/
+
+
+/* Luminance block dc-scaler value corresponding to QP values of 0-31 */
+const u_int8 sLumDCScalerTbl[32] = 
+{   
+       0,  8,  8,  8,  8, 10, 12, 14, 
+    16, 17, 18, 19, 20, 21, 22, 23, 
+    24, 25, 26, 27, 28, 29, 30, 31, 
+    32, 34, 36, 38, 40, 42, 44, 46 
+};
+
+/* Chrominance block dc-scaler value corresponding to QP values of 0-31 */
+const u_int8 sChrDCScalerTbl[32] = 
+{   
+       0,  8,  8,  8,  8,  9,  9, 10, 
+    10, 11, 11, 12, 12, 13, 13, 14, 
+    14, 15, 15, 16, 16, 17, 17, 18, 
+    18, 19, 20, 21, 22, 23, 24, 25 
+};
+
+/*
+* sGetMPEG4INTRADCValue
+*
+* Parameters: 
+*     intraDC      reconstructed intra DC from H263
+*     QP           quantion factor
+*     blockNum     block number (0 to 5)
+*     currMBNum    current MB number
+*     mbinWidth    number of MBs in picure width
+*     dcData       matrix to store the INTRA DC values
+*     mbVPNumber   matrix recording the video packet number for each MB
+*     
+* Function:
+*    This function gets the new intra DC for MPEG4
+* Returns:
+*     INTRA DC to put into MPEG4 bitstream
+* Error codes:
+*    None
+*
+*/
+int sGetMPEG4INTRADCValue(int intraDC, int blockNum, int currMBNum,
+                                                    int32 QP, int32 mbinWidth, int **dcData, int *mbVPNumber)
+{
+    int tempDCScaler;
+    int blockA = 0, blockB = 0, blockC = 0;
+    int gradHor, gradVer, predDC;
+    
+    VDTASSERT(currMBNum >= 0);
+    VDTASSERT(QP <= 31);
+    
+  /* Prediction blocks A (left), B (above-left), and C (above) */
+    switch (blockNum)
+    {
+        case 0:
+        case 4:
+        case 5:
+      /* Y0, U, and V blocks */
+            if (((currMBNum % mbinWidth) == 0) || /* Left edge */
+                (mbVPNumber[currMBNum - 1] != mbVPNumber[currMBNum]))
+            {
+                blockA = 1024; /* fixed value for H263 */
+            }
+            else
+            {
+                blockA = dcData[currMBNum - 1][blockNum > 3? blockNum : 1];
+            }
+            
+            if (((currMBNum / mbinWidth) == 0) || /* Top Edge */
+                ((currMBNum % mbinWidth) == 0) || /* Left Edge */
+                (mbVPNumber[currMBNum - mbinWidth - 1] != mbVPNumber[currMBNum]))
+            {
+                blockB = 1024;
+            }
+            else
+            {
+                blockB = dcData[currMBNum - mbinWidth - 1][blockNum > 3? blockNum : 3];
+            }
+            
+            if (((currMBNum / mbinWidth) == 0) || /* Top Edge */
+                (mbVPNumber[currMBNum - mbinWidth] != mbVPNumber[currMBNum]))
+            {
+                blockC = 1024;
+            }
+            else
+            {
+                blockC = dcData[currMBNum - mbinWidth][blockNum > 3? blockNum : 2];
+            }
+            break;
+            
+        case 1:
+            /* Y1 block */
+            blockA = dcData[currMBNum][0];
+            
+            if (((currMBNum / mbinWidth) == 0) || /* Top Edge */
+                (mbVPNumber[currMBNum - mbinWidth] != mbVPNumber[currMBNum]))
+            {
+                blockB = 1024;
+                blockC = 1024;
+            }
+            else
+            {
+                blockB = dcData[currMBNum - mbinWidth][2];
+                blockC = dcData[currMBNum - mbinWidth][3];
+            }
+            break;
+            
+        case 2:
+            /* Y2 block */
+            
+            if (((currMBNum % mbinWidth) == 0) || /* Left Edge */
+                (mbVPNumber[currMBNum - 1] != mbVPNumber[currMBNum]))
+            {
+                blockA = 1024;
+                blockB = 1024;
+            }
+            else
+            {
+                blockA = dcData[currMBNum  - 1][3];
+                blockB = dcData[currMBNum  - 1][1];
+            }
+            
+            blockC = dcData[currMBNum][0];
+            break;
+            
+        case 3:
+            /* Y3 block */
+            
+            blockA = dcData[currMBNum][2];
+            blockB = dcData[currMBNum][0];
+            blockC = dcData[currMBNum][1];
+            break;
+
+        default:
+            break;
+    }
+    
+    gradHor = blockB - blockC;
+    gradVer = blockA - blockB;
+    
+    if ((abs(gradVer)) < (abs(gradHor))) 
+    {
+        /* Vertical prediction (from C) */
+        predDC = blockC;
+    }
+    else 
+    {
+        /* Horizontal prediction (from A) */
+        predDC = blockA;
+    }
+    
+  /* DC quantization */
+  if (blockNum < 4) /* Luminance Block */
+  {
+        intraDC += (sLumDCScalerTbl[QP] >> 1);
+        intraDC /= sLumDCScalerTbl[QP];
+        
+        /* update the DC data matrix
+        note: for INTER MB, the entry is already preset to 1024!!
+        */
+        dcData[currMBNum][blockNum] = intraDC * sLumDCScalerTbl[QP];
+  }
+  else            /* Chrominance block */
+  {
+        intraDC += (sChrDCScalerTbl[QP] >> 1);
+        intraDC /= sChrDCScalerTbl[QP];
+        /* update the DC data matrix
+        note: for INTER MB, the entry is already preset to 1024!!
+        */
+        dcData[currMBNum][blockNum] = intraDC * sChrDCScalerTbl[QP];
+  }
+    /* DC prediction */
+  tempDCScaler = (blockNum<4)? sLumDCScalerTbl[QP] : sChrDCScalerTbl[QP];
+    
+  return (intraDC - ((predDC + tempDCScaler/2) / tempDCScaler));
+}
+
+/*
+* sPutVOLHeader
+*
+* Parameters: 
+*     bitOut       pointer to the output buffer
+*     aWidth       picture width
+*     aHeight      picture height
+*     aTimerResolution timer resolution for MPEG4
+*     
+* Function:
+*    This function writes the VOL header into bit-stream
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+inline void sPutVOLHeader(bibBuffer_t* bitOut, int aWidth, int aHeight, int aTimerResolution)
+{
+    bibBuffer_t     *lBitOut;
+    uint32          vop_time_increment_resolution;
+    
+    lBitOut = bitOut;
+    WRITE32(lBitOut, (uint32)VIDEO_OBJECT_LAYER_START_CODE);
+    /* RandomAccessibleVol == 1 means all VOP's can be decoded independently */
+    sPutBits(lBitOut, 1, 0);
+    /* VideoObjectTypeIndication = SIMPLE OBJECT */
+    sPutBits(lBitOut, 8, SIMPLE_OBJECT);
+    /* IsObjectLayerIdentifier */
+    sPutBits(lBitOut, 1, 0);
+    /* AspectRatioInfo */
+    sPutBits(lBitOut, 4, ASPECT_RATIO_INFO);
+    /* vol_control_parameters = 1 */
+    sPutBits(lBitOut, 1, 1);
+    /* Chroma Format */
+    sPutBits(lBitOut, 2, CHROMA_FORMAT);
+    /* LowDelay = 1; */
+    sPutBits(lBitOut, 1, 1);
+    /* vbvParameters = 0; */
+    sPutBits(lBitOut, 1, 0);
+    /* VideoObjectLayerShape == RECTANGULAR */
+    sPutBits(lBitOut, 2, RECTANGULAR);
+    /* Marker Bit */
+    sPutBits(lBitOut, 1, MARKER_BIT);
+    /* VopTimeIncrementResolution */
+    vop_time_increment_resolution = aTimerResolution;
+    sPutBits(lBitOut, 16, vop_time_increment_resolution);
+    /* Marker Bit */
+    sPutBits(lBitOut, 1, MARKER_BIT);    
+    /* FixedVOPRate = 0, not fixed */
+    sPutBits(lBitOut, 1, 0);    
+    /* Marker Bit */
+    sPutBits(lBitOut, 1, MARKER_BIT);
+    /* VideoObjectLayerWidth */
+    sPutBits(lBitOut, 13, aWidth);
+    /* Marker Bit */
+    sPutBits(lBitOut, 1, MARKER_BIT);
+    /* VideoObjectLayerHeight */
+    sPutBits(lBitOut, 13, aHeight);
+    /* Marker Bit */
+    sPutBits(lBitOut, 1, MARKER_BIT);
+    /* Interlaced = 0 */
+    sPutBits(lBitOut, 1, 0);
+    /* ObmcDisable= 1 */
+    sPutBits(lBitOut, 1, 1);
+    /* SpriteEnable = 0 */
+    sPutBits(lBitOut, 1, 0);
+    /* Not8Bit = 0 */
+    sPutBits(lBitOut, 1, 0);
+    /* QuantType = H263 (0) */
+    sPutBits(lBitOut, 1, H263);
+    /* Complexity Estimation Disable = 1 */
+    sPutBits(lBitOut, 1, 1);
+    /* ResyncMarkerDisable */
+    sPutBits(lBitOut, 1, 0); /* H263 is converted to resyn_marker MPEG4 in video editor */
+    /* DataPartioned */
+    sPutBits(lBitOut, 1, 0); /* always 0 for H263 */
+    /* Reversible VLC  closed */
+    /* Scalability = 0 */
+    sPutBits(lBitOut, 1, 0);
+    vdtStuffBitsMPEG4(lBitOut);
+    
+    return;
+}
+
+
+/*
+* sPutGOVHeader
+*
+* Parameters: 
+*     bitOut       pointer to the output buffer
+*     aModuloTimeBase  time base for MPEG4
+*     
+* Function:
+*    This function writes the group of VOP(GOV) header into bit-stream
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+inline void sPutGOVHeader(bibBuffer_t *bitOut, int aModuloTimeBase)
+{
+    int32 time_code_hours;
+    int32 time_code_minutes;
+    int32 time_code_seconds;
+    
+    WRITE32(bitOut, (uint32)GROUP_OF_VOP_START_CODE);
+    time_code_seconds = aModuloTimeBase;
+    time_code_minutes = time_code_seconds / 60;
+    time_code_hours   = time_code_minutes / 60;    
+    time_code_minutes = time_code_minutes - (time_code_hours * 60);
+    time_code_seconds = time_code_seconds - (time_code_minutes * 60)
+        - (time_code_hours * 3600);
+    
+    sPutBits(bitOut, 5, time_code_hours);
+    sPutBits(bitOut, 6, time_code_minutes);
+    sPutBits(bitOut, 1, MARKER_BIT);
+    sPutBits(bitOut, 6, time_code_seconds);
+    
+    /* ClosedGov */
+    sPutBits(bitOut, 1, 0);
+    /* Broken Link */
+    sPutBits(bitOut, 1, 0);
+    
+    /* Stuff bits */
+    vdtStuffBitsMPEG4(bitOut);
+    
+    return;
+}
+
+/*
+* sConstructMPEG4VOSHeaderForH263
+*
+* Parameters: 
+*     bitOut       pointer to the output buffer
+*     aWidth       picture width
+*     aHeight      picture height
+*     
+* Function:
+*    This function writes the MPEG4 VOS header into bit-stream
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+void sConstructMPEG4VOSHeaderForH263(bibBuffer_t *bitOut, int aWidth, int aHeight, int aOutputMpeg4TimeRes)
+{
+    /* visual object sequence header */
+    WRITE32(bitOut, (uint32)VISUAL_OBJECT_SEQUENCE_START_CODE);
+    
+    /* This is for testing for level 0,3 */
+    uint32 level = 8;   /* level 0 for QCIF or less */
+    if(aWidth > 176 || aHeight > 144)   /* level 2 for greater than QCIF */
+        level = 2;
+    sPutBits(bitOut, 8, level); /* simple profile, level 0 for H263 */
+    
+    /* visual object header begins */
+    WRITE32(bitOut, (uint32)VISUAL_OBJECT_START_CODE);
+    /* IsVisualObjectIdentifier = 0 */
+    sPutBits(bitOut, 1, 0);
+    /* VisualObjectType = VIDEO_OBJECT */
+    sPutBits(bitOut, 4, VISUAL_OBJECT);
+    /* VideoSignalType = 0 */
+    sPutBits(bitOut, 1, 0);
+    
+    vdtStuffBitsMPEG4(bitOut);
+    WRITE32(bitOut, (uint32)VIDEO_OBJECT_START_CODE);
+    
+    /* Writes the VOL header into bit-stream , for baseline H263 TR is marked with 29.97fps. ->? */
+    sPutVOLHeader(bitOut, aWidth, aHeight, aOutputMpeg4TimeRes);
+    
+    /* Writes GOV , time base is 0 */
+    sPutGOVHeader(bitOut, 0);
+    
+    return;
+}
+
+
+/*
+* sPutVideoPacketHeader
+*
+* Parameters: 
+*     lBitOut      output buffer
+*     mbNo         Macroblock number
+*     quantiserScale quant value to be put in header
+*     aMBsInVOP    # of MBs in one VOP
+*     
+* Function:
+*    This function writes the video packet header information into bit-stream
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+inline void sPutVideoPacketHeader(bibBuffer_t *lBitOut, int32 mbNo, 
+                                                                    int16 quantiserScale,
+                                                                    int aMBsInVOP)
+{
+    int32   lResyncMarkerLength = 17;
+    int32   lMBNoResolution;
+    
+    /* ResyncMarker */
+    int fCode = 1; /*always 1 for H263 */
+    lResyncMarkerLength = 16 + fCode; 
+    sPutBits(lBitOut, lResyncMarkerLength, 1);
+    
+    --aMBsInVOP;
+    lMBNoResolution = 1;
+    while( (aMBsInVOP =
+        aMBsInVOP >> 1) > 0 )
+    {
+        lMBNoResolution++;
+    }
+    sPutBits(lBitOut, lMBNoResolution, mbNo);
+    
+    /* QuantScale */ 
+    sPutBits(lBitOut, 5, quantiserScale);
+    /* HEC */
+    sPutBits(lBitOut, 1, 0); /* always 0 for H263 */
+    
+    return;
+}
+
+/*
+* sConstructVOPHeaderForH263
+*
+* Parameters: 
+*     lBitOut      output buffer
+*     prevQuant    quant value to be put in header
+*     aVOPType     picture coding type
+*     aVOPTimeIncrement  time increament
+*     
+* Function:
+*    This function writes the VOP header into bit-stream for one H263 frame
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+
+void sConstructVOPHeaderForH263(bibBuffer_t *lBitOut, int prevQuant, int aVOPType, int aVOPTimeIncrement,int aOutputMpeg4TimeRes)
+{
+    WRITE32(lBitOut, (uint32)VOP_START_CODE);
+    /* VOPType, 0 for Intra and 1 for inter */
+    sPutBits(lBitOut, 2, aVOPType);
+    
+    /* H263 TR is marked with 29.97fps */
+    /* Modulo Time Base */
+    int outputTimerResolution = aOutputMpeg4TimeRes;
+    while ((unsigned)aVOPTimeIncrement >= (unsigned) outputTimerResolution)
+    {
+        sPutBits(lBitOut, 1, 1);
+        aVOPTimeIncrement -= outputTimerResolution; 
+    }
+    sPutBits(lBitOut, 1, 0);
+    /* Marker Bit */
+    sPutBits(lBitOut, 1, MARKER_BIT);   
+    /* VopTimeIncrement */
+    int numOutputTrBits;
+    for (numOutputTrBits = 1; ((outputTimerResolution-1) >> numOutputTrBits) != 0; numOutputTrBits++)
+        {
+        }
+    int VOPIncrementResolutionLength = numOutputTrBits;
+    sPutBits(lBitOut, VOPIncrementResolutionLength, aVOPTimeIncrement);
+    /* Marker Bit */
+    sPutBits(lBitOut, 1, MARKER_BIT);
+    /* VOPCoded */
+    sPutBits(lBitOut, 1, 1); /* always 1 for H263 */
+    /* VOPRoundingType */
+    if(aVOPType == P_VOP)
+    {
+        sPutBits(lBitOut, 1, 0); /* always 0 for H263 */
+    }
+    /* IntraDCVLCThreshold */
+    sPutBits(lBitOut, 3, 0); /* always 0 for H263 */
+    /* VOPQuant */
+    sPutBits(lBitOut, 5, prevQuant);
+    /* VOPFcodeForwad */
+    if(aVOPType == P_VOP)
+    {
+        sPutBits(lBitOut, 3, 1); /* always 1 for H263 */
+    }
+    
+    return;
+}
+
+
+
+/*
+* H263PictureHeaderEndedL
+*
+* Parameters: 
+*     
+* Function:
+*    This function is called after one H263 picture header is parsed
+*    Note: the input header is only valid inside this function
+* Returns:
+*    VDC error codes
+* Error codes:
+*    None
+*
+*/
+int CMPEG4Transcoder::H263PictureHeaderEnded(dphOutParam_t *aH263PicHeader, dphInOutParam_t *aInfo)
+{
+    VDTASSERT(aH263PicHeader);  
+    
+    // asad
+    if (!aInfo->vdcInstance->frameNum || !iRefQuant)
+    {
+        iRefQuant = aH263PicHeader->pquant;
+        iDcScaler = GetMpeg4DcScalerUV(iRefQuant); 
+    }
+    
+    if (!iDoModeTranscoding )
+    {
+        
+       /* Copy the header to output stream */
+       bufEdit.copyMode = CopyWhole; /* CopyWhole */
+         
+         if ( (iTargetFormat == EVedVideoTypeH263Profile0Level10 || iTargetFormat == EVedVideoTypeH263Profile0Level45) && 
+               fFirstFrameInH263 && iBitStreamMode == EVedVideoBitstreamModeMPEG4ShortHeader)
+         {
+             /* we don't need the VOS header, remove it */
+             PRINT((_L("CMPEG4Transcoder: MPEG4 shortheader VOS removed")));
+             
+             CopyStream(iInBuffer,iOutBuffer,&bufEdit,iShortHeaderEndByteIndex,iShortHeaderEndBitIndex);
+             fFirstFrameInH263 = EFalse;
+         }
+         else
+         {
+           /* copy from the begining of the input buffer, 
+              including the VOS header for MPEG4 shortheader if its mode is not being changed
+             */
+             CopyStream(iInBuffer,iOutBuffer,&bufEdit,0,7);
+         }
+    }
+    
+
+    
+    else
+    {
+        /* H263 Picture Header -> MPEG4 VOP Header mapping
+           information about this frame
+        */
+        iMBsinWidth = aInfo->vdcInstance->pictureParam.lumWidth >> 4;
+        
+        iNumMBsInOneVOP = (aInfo->vdcInstance->pictureParam.lumWidth >> 4) *
+            (aInfo->vdcInstance->pictureParam.lumHeight >> 4);
+        
+        iNumMBsInGOB = aInfo->vdcInstance->pictureParam.numMBsInGOB;
+        
+        /* create the intraDC matrix for DC prediction */
+        VDTASSERT(!iH263DCData);
+        VDTASSERT(!iH263MBVPNum);
+        
+        iH263DCData = (int **)malloc(iNumMBsInOneVOP * sizeof(int));
+        if (!iH263DCData) 
+        {
+            deb("CMPEG4Transcoder::ERROR - iH263DCData creation failed\n");
+            return TX_ERR;
+        }
+        
+        for (int i = 0; i < iNumMBsInOneVOP; i++)
+        {
+            iH263DCData[i] = (int *) malloc(6 * sizeof(int)); /* six blocks in one MB */
+            VDTASSERT(iH263DCData[i]);
+            if (!iH263DCData[i]) 
+            {
+                deb("CMPEG4Transcoder::ERROR - iH263DCData[i] creation failed\n");
+
+                for(int k=0; k<i; k++)
+                {
+                    free (iH263DCData[k]); 
+                }
+                if (iH263DCData) 
+                {
+                    free(iH263DCData);
+                }
+
+                return TX_ERR;
+            }
+
+            
+            /* initialize each entry to 1024 for DC prediction */
+            for (int j = 0; j < 6; j++)
+            {
+                iH263DCData[i][j] = 1024;
+            }
+        }
+        
+        iH263MBVPNum = (int *) malloc(iNumMBsInOneVOP * sizeof(int));
+        if (!iH263MBVPNum) 
+        {
+            deb("CMPEG4Transcoder::ERROR - iH263MBVPNum creation failed\n");
+            return TX_ERR;
+        }
+        
+        memset(iH263MBVPNum, 0, iNumMBsInOneVOP * sizeof(int));
+        int pictureType = aInfo->vdcInstance->pictureParam.pictureType == VDX_PIC_TYPE_I? I_VOP : P_VOP;
+        
+        if (fFirstFrameInH263)
+        {
+            /* first frame, construct the VOS header */
+            sConstructMPEG4VOSHeaderForH263(iOutBuffer,
+                aInfo->vdcInstance->pictureParam.lumWidth,
+                aInfo->vdcInstance->pictureParam.lumHeight, 
+                iOutputMpeg4TimeIncResolution);
+            fFirstFrameInH263 = EFalse;
+            
+            PRINT((_L("CMPEG4Transcoder: H263 -> MPEG VOS generated")));
+        }
+        sConstructVOPHeaderForH263(iOutBuffer, aH263PicHeader->pquant, pictureType, aH263PicHeader->trp == -1 ? 0 : aH263PicHeader->trp,iOutputMpeg4TimeIncResolution);
+
+        
+    PRINT((_L("CMPEG4Transcoder: H263 -> MPEG4: transcoding one picture")));
+    }
+    
+    
+    PRINT((_L("CMPEG4Transcoder: H263PictureHeaderEndedL. color effect: %d, format convert %d, do transcoding: %d streammode: %d, outputformat: %d "), 
+       iColorEffect, iDoModeTranscoding, iDoTranscoding,
+         iBitStreamMode, iTargetFormat));
+    
+    return TX_OK;
+}
+
+/*
+* H263GOBSliceHeaderEnded
+*
+* Parameters: 
+*     
+* Function:
+*    This function is called after one H263 GOB or Slice header is parsed
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::H263GOBSliceHeaderEnded(vdxGOBHeader_t *aH263GOBHeader, vdxSliceHeader_t */*aH263SliceHeader*/)
+{
+    iGOBSliceHeaderEndByteIndex = iInBuffer->getIndex;
+    iGOBSliceHeaderEndBitIndex  = iInBuffer->bitIndex;  
+    
+    if (aH263GOBHeader)
+    {
+        /* not the first GOB (no header), we have stuffing bits ahead
+        since we only store the position of GBSC not including 
+        the stuffing bits, we may need to insert the stuffing bits here
+        if we have color effect, we have done the stuffing at the end of last GOB
+        see functin: H263OneGOBSliceWithHeaderEnded
+        */
+        sStuffBitsH263(iOutBuffer); 
+    }
+    
+    if (!iDoModeTranscoding)
+    {
+       /* Copy the header to output stream */
+       bufEdit.copyMode = CopyWhole; // whole
+         CopyStream(iInBuffer,iOutBuffer,&bufEdit,iGOBSliceStartByteIndex,iGOBSliceStartBitIndex);
+         
+    }
+
+    else
+    {
+        /* H263 GOB (Slice) Header -> MPEG4 VP Header mapping */
+        if (!VDT_NO_DATA((int)iInBuffer->getIndex, iInBuffer->bitIndex, iGOBSliceStartByteIndex, iGOBSliceStartBitIndex) &&
+            aH263GOBHeader)
+        {
+            /* sPutVideoPacketHeader */
+            sPutVideoPacketHeader(iOutBuffer, aH263GOBHeader->gn * iNumMBsInGOB, (short)aH263GOBHeader->gquant, iNumMBsInOneVOP);
+        }
+    }
+        
+    // one slice ended, new video packet starting
+    iCurMBNumInVP = -1;
+    
+}
+
+
+/*
+* H263GOBSliceHeaderBegin
+*
+* Parameters: 
+*     
+* Function:
+*    This function is called before one H263 GOB or Slice header is parsed
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::H263GOBSliceHeaderBegin()
+{
+    /* position not include the stuffing bits ahead of the GBSC ! */
+    iGOBSliceStartByteIndex = iInBuffer->getIndex;
+    iGOBSliceStartBitIndex  = iInBuffer->bitIndex;
+    iStuffingBitsUsed = 0;
+}
+
+
+/*
+* H263GOBSliceHeaderBegin
+*
+* Parameters: 
+*     
+* Function:
+*    This function is called after one H263 GOB or Slice ends
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::H263OneGOBSliceEnded(int nextExpectedMBNum)
+{
+    if (iDoTranscoding)
+    {
+        /* MBs are lost or not coded, for H263 and H263->MPEG4 both */
+        for (int i = iLastMBNum+1; i < nextExpectedMBNum; i++)
+        {
+            /* output  1 bit COD */
+            sPutBits (iOutBuffer, 1, 1);
+        }
+        iLastMBNum = nextExpectedMBNum - 1; 
+    }
+}
+
+
+/*
+* H263OneGOBSliceWithHeaderEnded
+*
+* Parameters: 
+*     
+* Function:
+*    This function is called after GOB (Slice) that has GOB header (except the first GOB) ends
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::H263OneGOBSliceWithHeaderEnded()
+{
+    if (!iDoTranscoding)
+    {
+       bufEdit.copyMode = CopyWhole; /* CopyWhole */
+         CopyStream(iInBuffer,iOutBuffer,&bufEdit,
+             iGOBSliceHeaderEndByteIndex,iGOBSliceHeaderEndBitIndex);
+    }
+    else
+    {
+
+        if (iDoModeTranscoding)
+        {
+            /* for H263 to MPEG4, it implies that one video packet is finished */
+            vdtStuffBitsMPEG4(iOutBuffer);
+        }
+        else
+
+        {
+            /* stuffing occurs outside at the end of one GOB/slice withe header or end of frame, check in file core.cpp */
+            sStuffBitsH263(iOutBuffer); 
+        }
+        iVideoPacketNumInMPEG4 ++;
+    }
+
+    // one slice ended, new video packet starting
+    iCurMBNumInVP = -1; // 0
+
+}
+
+
+
+/*
+* H263ToMPEG4MBData
+*
+* Parameters: 
+*     
+* Function:
+*    This function transcodes one H263 MB to one MPEG4 MB
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::H263ToMPEG4MBData(int aNewMCBPCLen, int aNewMCBPC)
+{
+    /* MB data part1: output MCBPC, CBPY, DQuant, MV, intra DC etc */
+    int *dataItemStartByteIndex;
+    int *dataItemStartBitIndex;
+    int *dataItemEndByteIndex;
+    int *dataItemEndBitIndex;
+    int quant, cbpy, cbpc;
+    
+    if (iVopCodingType == VDX_VOP_TYPE_P) 
+    {
+        dataItemStartByteIndex = iCurPMBinstance->DataItemStartByteIndex;
+        dataItemStartBitIndex  = iCurPMBinstance->DataItemStartBitIndex;
+        dataItemEndByteIndex   = iCurPMBinstance->DataItemEndByteIndex;
+        dataItemEndBitIndex    = iCurPMBinstance->DataItemEndBitIndex;
+        quant = iCurPMBinstance->quant;
+        cbpy  = iCurPMBinstance->cbpy;
+        cbpc  = iCurPMBinstance->cbpc;
+    }
+    else
+    {
+        dataItemStartByteIndex = iCurIMBinstance->DataItemStartByteIndex;
+        dataItemStartBitIndex  = iCurIMBinstance->DataItemStartBitIndex;
+        dataItemEndByteIndex   = iCurIMBinstance->DataItemEndByteIndex;
+        dataItemEndBitIndex    = iCurIMBinstance->DataItemEndBitIndex;
+        quant = iCurIMBinstance->quant;
+        cbpy  = iCurIMBinstance->cbpy;
+        cbpc  = iCurIMBinstance->cbpc;
+    }
+    
+    /* COD and MCBPC, (for I frame, it is MCBPC, for P frame it is COD and MCBPC) */
+    if (iVopCodingType == VDX_VOP_TYPE_P)
+    {
+        /* It is a coded MB, output  1 bit COD (it always exists in P frame) */
+        sPutBits (iOutBuffer, 1, 0);
+    }
+    
+    if (iColorEffect)
+    {
+        /* MCBPC Changed */
+        sPutBits(iOutBuffer, aNewMCBPCLen, aNewMCBPC);
+    }
+    else
+    {
+        /* remember the positions do not include the possible stuffing MCBPC bits */
+        vdtCopyBuffer(iInBuffer, iOutBuffer,
+            dataItemStartByteIndex[0], dataItemStartBitIndex[0],
+            dataItemEndByteIndex[0], dataItemEndBitIndex[0]);
+    }
+    
+    /* ac_pred_flag  */
+    if (iMBCodingType == VDX_MB_INTRA) 
+    {
+        sPutBits(iOutBuffer, 1, 0);// it is closed for H263 INTRA MB
+    }
+    
+    /* CBPY */
+    vdtCopyBuffer(iInBuffer, iOutBuffer,
+        dataItemStartByteIndex[2], dataItemStartBitIndex[2],
+        dataItemEndByteIndex[2], dataItemEndBitIndex[2]);
+    
+    /* DQUANT, if it exsits */
+    vdtCopyBuffer(iInBuffer, iOutBuffer,
+        dataItemStartByteIndex[1], dataItemStartBitIndex[1],
+        dataItemEndByteIndex[1], dataItemEndBitIndex[1]);
+    
+    if (iMBCodingType == VDX_MB_INTER) 
+    {
+        /* MVs, if they exsit */
+        vdtCopyBuffer(iInBuffer, iOutBuffer,
+            dataItemStartByteIndex[10], dataItemStartBitIndex[10],
+            dataItemEndByteIndex[10], dataItemEndBitIndex[10]);
+    }
+    
+    /* following is the block level data */
+    for (int i = 0; i < (iColorEffect? 4 : 6); i++)
+    {
+        if (iMBCodingType == VDX_MB_INTRA) 
+        {
+            int fBlockCoded = 0;
+            if (i < 4)
+            {
+                fBlockCoded = vdxIsYCoded(cbpy, i + 1);
+            }
+            else if (i == 4)
+            {
+                fBlockCoded = vdxIsUCoded(cbpc);
+            }
+            else 
+            {
+                fBlockCoded = vdxIsVCoded(cbpc);
+            }
+            
+            /* Difference between H263 and MPEG4 :
+               0. DC quantization is different, DC need to be dequantized and requantized
+                  Note:  for ACs, here we only support H263 quantization in MPEG4, we can copy them
+                        1. DC prediction is used in MPEG4
+                        2. They use different VLC table for INTRA AC coefficient
+            */
+            /* reconstuct INTRA DC */
+            int intraDC = (iDCTBlockData + i * BLOCK_COEFF_SIZE)[0]; /* it is already dequantized in funcion vdxGetIntraDCTBlock */
+            
+            /* INTRA quantization and prediction */
+            (iDCTBlockData + i * BLOCK_COEFF_SIZE)[0] = sGetMPEG4INTRADCValue(intraDC,
+                i, iCurMBNum, quant, iMBsinWidth,iH263DCData, iH263MBVPNum);
+            
+            /* recoding the INTRA block */
+            int numTextureBits = 0;
+            
+            vdtPutIntraMBCMT(iOutBuffer,iDCTBlockData + i * BLOCK_COEFF_SIZE, &numTextureBits, i, 0, 1); /* DC coding */
+            
+            if (fBlockCoded)
+            {
+                vdtPutIntraMBCMT(iOutBuffer,iDCTBlockData + i * BLOCK_COEFF_SIZE, &numTextureBits, i, 1, 0); /*encode ACs */
+            }
+            
+        }
+        
+        else if (!(VDT_NO_DATA(iBlockStartByteIndex[i], iBlockStartBitIndex[i],
+            iBlockEndByteIndex[i], iBlockEndBitIndex[i])))
+        {
+            
+        /* 4. same VLC table for DCTs in H263 and MPEG4, but with different Escape Coding type. 
+        see 7.4.1.3. in MPEG4 draft
+            */
+            if (iEscapeCodeUsed[i])
+            {
+                int numTextureBits = 0;
+                vdtPutInterMBCMT(iOutBuffer,0, iDCTBlockData + i * BLOCK_COEFF_SIZE, &numTextureBits, OFF);
+            }
+            else
+            {
+                bufEdit.copyMode = CopyWhole; /* CopyWhole */
+                vdtCopyBuffer(iInBuffer,iOutBuffer,
+                    iBlockStartByteIndex[i],iBlockStartBitIndex[i],
+                    iBlockEndByteIndex[i],iBlockEndBitIndex[i]);
+            }
+        }
+    }
+    
+  if (iColorEffect && (iMBCodingType == VDX_MB_INTRA))
+    {
+        ResetMPEG4IntraDcUV();
+    }
+}
+
+
+
+/*
+* NeedDecodedYUVFrame
+*
+* Parameters: 
+*     
+* Function:
+*    This function indicates if whether we need the decoded frame 
+* Returns:
+*     ETrue if we need the decoded frame
+* Error codes:
+*    None
+*
+*/
+int CMPEG4Transcoder::NeedDecodedYUVFrame()
+{
+    if ( (iTargetFormat == EVedVideoTypeH263Profile0Level10 || iTargetFormat == EVedVideoTypeH263Profile0Level45) &&
+        iBitStreamMode !=EVedVideoBitstreamModeMPEG4ShortHeader && iBitStreamMode != EVedVideoBitstreamModeH263)
+        return ETrue;
+    else
+        return EFalse;
+}
+
+/*
+* NewL
+*
+* Parameters: 
+*     
+* Function:
+*    Symbian two-phased constructor 
+* Returns:
+*     pointer to constructed object, or NULL
+* Error codes:
+*    None
+*
+*/
+CMPEG4Transcoder* CMPEG4Transcoder::NewL(const vdeInstance_t *aVDEInstance, bibBuffer_t *aInBuffer, bibBuffer_t *aOutBuffer)
+{
+    CMPEG4Transcoder *self = new (ELeave) CMPEG4Transcoder(aVDEInstance, aInBuffer, aOutBuffer);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    
+    return self;
+}
+
+
+/*
+* ConstructL
+*
+* Parameters: 
+*     
+* Function:
+*    Symbian 2nd phase constructor (can leave)
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Transcoder::ConstructL()
+{
+    
+    /* Create one IMB Instance  */
+    iCurIMBinstance = (vdxIMBListItem_t *) malloc(sizeof(vdxIMBListItem_t));
+    if (!iCurIMBinstance) 
+    {
+        deb("CMPEG4Transcoder::ERROR - iCurIMBinstance creation failed\n");
+        User::Leave(KErrNoMemory);
+       
+    }
+    memset(iCurIMBinstance, 0, sizeof(vdxIMBListItem_t));
+    
+    /* Create one PMBInstance */
+    iCurPMBinstance = (vdxPMBListItem_t *) malloc(sizeof(vdxPMBListItem_t));
+    if (!iCurPMBinstance) 
+    {
+        deb("CMPEG4Transcoder::ERROR - iCurPMBinstance creation failed\n");
+        User::Leave(KErrNoMemory);
+       
+    }
+    memset(iCurPMBinstance, 0, sizeof(vdxPMBListItem_t));
+    
+    /* initialize the edit buffer */
+    bufEdit.editParams = (bibEditParams_t *) malloc(sizeof(bibEditParams_t));
+    VDTASSERT(bufEdit.editParams);
+    if (!bufEdit.editParams) 
+    {
+        deb("CMPEG4Transcoder::ERROR - bufEdit.editParams creation failed\n");
+        User::Leave(KErrNoMemory);
+       
+    }else{
+        bufEdit.numChanges = 1;
+    }
+    
+    if (!iMBType)
+    {
+        iMBType = (u_char *) malloc(iNumMBsInOneVOP * sizeof(u_char));
+        if (!iMBType) 
+        {
+            deb("CMPEG4Transcoder::ERROR - iMBType creation failed\n");
+            User::Leave(KErrNoMemory);
+        }
+        memset(iMBType, VDX_MB_INTER, iNumMBsInOneVOP * sizeof(u_char));
+    }    
+    
+}
+
+
+/*
+* GetMpeg4DcScaler
+*
+* Parameters: 
+*     
+*  aQP            Quantization parameter
+*
+* Function:
+*    Evaluates Chrominance DC Scaler from QP for MPEG4
+* Returns:
+*    int DC scaler value
+* Error codes:
+*    None
+*
+*/
+int CMPEG4Transcoder::GetMpeg4DcScalerUV(int aQP)
+{
+    if (aQP>=1 && aQP<=4)
+        return (8);
+    else if (aQP>=5 && aQP<=24)
+        return ((aQP+13)/2);
+    else if (aQP>=25 && aQP<=31)
+        return (aQP-6);
+    else 
+        return (0);  // error 
+}
+
+
+void CMPEG4Transcoder::AfterMBLayer(int aUpdatedQp)
+{
+  iCurQuant = aUpdatedQp;
+}
+
+
+
+
+/* End of File */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/VedVolReader.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,889 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* MPEG-4 VOL header parsing.
+*
+*/
+
+
+// INCLUDE FILES
+#include "mpegcons.h"
+#include "VedVolReader.h"
+
+
+
+// MACROS
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+
+
+// CONSTANTS
+const TUint8 CVedVolReader::KMsbMask[] = {1, 3, 7, 15, 31, 63, 127, 255};
+const TUint8 CVedVolReader::KLsbMask[] = {255, 254, 252, 248, 240, 224, 192, 128, 0};
+
+const TInt CVedVolReader::KMaxUserDataLength = 512;
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// Two-phased constructor
+EXPORT_C CVedVolReader* CVedVolReader::NewL()
+    {
+    CVedVolReader* self = new (ELeave) CVedVolReader();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+// C++ default constructor
+CVedVolReader::CVedVolReader() : iBitstreamMode(EVedVideoBitstreamModeUnknown)
+    {
+    // Reset the header data to zeroes
+    Mem::FillZ(&iHeader, sizeof(TVolHeader));
+    }
+
+// Symbian OS default constructor can leave
+void CVedVolReader::ConstructL()
+    {
+    }
+
+// Destructor
+CVedVolReader::~CVedVolReader()
+    {
+    if (iHeader.iUserData != 0)
+        {
+        delete iHeader.iUserData;
+        }
+    }
+    
+// ---------------------------------------------------------
+// CVedVolReader::ParseVolHeaderL
+// Parses given Video Object Layer header
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CVedVolReader::ParseVolHeaderL(TDesC8& aData)
+    {
+    TInt useDefaultVBVParams = 0;
+    TInt numBits;
+    TUint32 bits;
+    
+    // Reset the header data
+    if (iHeader.iUserData != 0)
+        {
+        delete iHeader.iUserData;
+        iHeader.iUserData = 0;
+        }
+    Mem::FillZ(&iHeader, sizeof(TVolHeader));
+    iBitstreamMode = EVedVideoBitstreamModeUnknown;
+    iHeaderSize = 0;
+    
+    // Check that we have something to parse
+    if (aData.Length() == 0)
+        {
+        User::Leave(KErrNotFound);
+        }
+    
+    TSeqHeaderBuffer buffer(aData, 0, 7);   // Bit 7 is the first bit in a byte   
+    
+    // if H.263 PSC is present
+    bits = ReadSeqHeaderBits(buffer, 22, EFalse);
+    if (bits == 32)
+        {
+        // This is H.263 so there are no VOL headers
+        iBitstreamMode = EVedVideoBitstreamModeH263;
+        return KErrNone;
+        }
+
+    // if Visual Object Sequence Start Code is present 
+    bits = ReadSeqHeaderBits(buffer, MP4_VOS_START_CODE_LENGTH, EFalse);
+    if (bits == MP4_VOS_START_CODE)
+        {
+        // vos_start_code
+        ReadSeqHeaderBits(buffer, MP4_VOS_START_CODE_LENGTH, ETrue);
+
+        // profile_and_level_indication (8 bits) 
+        bits = ReadSeqHeaderBits(buffer, 8, ETrue);      
+        //   8: Simple Profile Level 0 (from ISO/IEC 14496-2:1999/FPDAM4 [N3670] October 2000)
+        //   9: Simple Profile Level 0b
+        //   1: Simple Profile Level 1
+        //   2: Simple Profile Level 2
+        //   3: Simple Profile Level 3
+        //   4: Simple Profile Level 4a
+        if (bits != 1 && bits != 2 && bits != 3 && bits != 4 && bits != 8 && bits != 9)
+            {
+            // Profile level id was not recognized so take a guess
+            // This is changed later if resolution does not match
+            bits = 9;
+            }
+            
+        iHeader.iProfileLevelId = (TInt) bits;
+            
+        ReadUserDataL(buffer);
+        }
+
+    // if Visual Object Start Code is present 
+    bits = ReadSeqHeaderBits(buffer, MP4_VO_START_CODE_LENGTH, EFalse);
+    if (bits == MP4_VO_START_CODE)
+        {
+        // visual_object_start_code
+        ReadSeqHeaderBits(buffer, MP4_VO_START_CODE_LENGTH, ETrue);
+
+        // is_visual_object_identifier (1 bit)
+        bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+        if (bits)
+            {
+            // visual_object_ver_id (4 bits)
+            bits = ReadSeqHeaderBits(buffer, 4, ETrue);
+            if (bits != 1 && bits != 2)
+                {
+                // this is not an MPEG-4 version 1 or 2 stream
+                PRINT((_L("CVedVolReader: ERROR - This is not an MPEG-4 version 1 or 2 stream")))
+                User::Leave(KErrNotSupported);
+                }
+
+            // visual_object_priority (3 bits) 
+            bits = ReadSeqHeaderBits(buffer, 3, ETrue);
+            iHeader.iVoPriority = (TInt) bits;
+            } 
+        else
+            {
+            iHeader.iVoPriority = 0;
+            }
+
+        // visual_object_type (4 bits)
+        bits = ReadSeqHeaderBits(buffer, 4, ETrue);
+        if (bits != 1)
+            {
+            // this is not a video object
+            PRINT((_L("CVedVolReader: ERROR - This is not a video object")))
+            User::Leave(KErrNotSupported);
+            }
+
+        // is_video_signal_type (1 bit)
+        bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+        if (bits)
+            {
+            /* Note: The following fields in the bitstream give information about the 
+               video signal type before encoding. These parameters don't influence the 
+               decoding algorithm, but the composition at the output of the video decoder.
+               Until a way to utilize them is found, these fields are just dummyly read,
+               but not interpreted.
+               For interpretation see the MPEG-4 Visual standard page 66-70. */
+
+            // video_format (3 bits)
+            bits = ReadSeqHeaderBits(buffer, 3, ETrue);
+            iHeader.iVideoFormat = (TInt) bits;
+
+            // video_range (1 bit)
+            bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+            iHeader.iVideoRange = (TInt) bits;
+
+            // colour_description (1 bit)
+            bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+            if (bits)
+                {          
+                // colour_primaries (8 bits)
+                bits = ReadSeqHeaderBits(buffer, 8, ETrue);
+                iHeader.iColourPrimaries = (TInt) bits;
+
+                // transfer_characteristics (8 bits)
+                bits = ReadSeqHeaderBits(buffer, 8, ETrue);
+                iHeader.iTransferCharacteristics = (TInt) bits;
+
+                // matrix_coefficients (8 bits)
+                bits = ReadSeqHeaderBits(buffer, 8, ETrue);
+                iHeader.iMatrixCoefficients = (TInt) bits;
+                }
+            else
+                {
+                iHeader.iColourPrimaries = 1;         // default: ITU-R BT.709 
+                iHeader.iTransferCharacteristics = 1; // default: ITU-R BT.709 
+                iHeader.iMatrixCoefficients = 1;      // default: ITU-R BT.709 
+                }
+            } 
+        else
+            {
+            // default values
+            iHeader.iVideoFormat = 5;             // Unspecified video format 
+            iHeader.iVideoRange = 0;              // Y range 16-235 pixel values 
+            iHeader.iColourPrimaries = 1;         // ITU-R BT.709 
+            iHeader.iTransferCharacteristics = 1; // ITU-R BT.709 
+            iHeader.iMatrixCoefficients = 1;      // ITU-R BT.709 
+            }
+
+        // check the next start code
+        ReadSeqHeaderBits(buffer, 1, ETrue);
+        if (buffer.iBitInOctet != 7)
+            {
+            numBits = buffer.iBitInOctet + 1;
+
+            bits = ReadSeqHeaderBits(buffer, numBits, ETrue);
+            if (bits != (TUint32) ((1 << numBits)-1))
+                {
+                // stuffing error in VO
+                PRINT((_L("CVedVolReader: ERROR - Stuffing error")))
+                User::Leave(KErrNotSupported);
+                }
+            }
+
+        ReadUserDataL(buffer);
+        }
+   
+    // if Video Object Start Code is present
+    bits = ReadSeqHeaderBits(buffer, MP4_VID_START_CODE_LENGTH, EFalse);
+    if (bits == MP4_VID_START_CODE)
+        {
+        // video_object_start_code 
+        ReadSeqHeaderBits(buffer, MP4_VID_START_CODE_LENGTH, ETrue);
+
+        // video_object_id
+        bits = ReadSeqHeaderBits(buffer, MP4_VID_ID_CODE_LENGTH, ETrue);
+        iHeader.iVoId = (TInt) bits;
+        }
+        
+    // Check if H.263 PSC follows the VO header, in which case this is MPEG-4 with short header
+    bits = ReadSeqHeaderBits(buffer, 22, EFalse);
+    if (bits == 32 || buffer.iData.Length() <= buffer.iGetIndex)
+        {
+        iBitstreamMode = EVedVideoBitstreamModeMPEG4ShortHeader;
+        
+        // Calculate the header size in bytes
+        if (buffer.iBitInOctet == 7)
+            {
+            // The size is a multiple of 8 bits so the size is the number of bytes we've read so far
+            iHeaderSize = buffer.iGetIndex;
+            }
+        else
+            {
+            // Round up to the next full byte
+            iHeaderSize = buffer.iGetIndex + 1;
+            }
+        
+        // We no longer support short header clips    
+        User::Leave(KErrNotSupported);
+        }
+
+    // vol_start_code 
+    bits = ReadSeqHeaderBits(buffer, MP4_VOL_START_CODE_LENGTH, ETrue);
+    if(bits != MP4_VOL_START_CODE)
+    {
+        PRINT((_L("CVedVolReader: ERROR - Bitstream does not start with MP4_VOL_START_CODE")))
+        User::Leave(KErrCorrupt);
+    }
+
+    // vol_id
+    bits = ReadSeqHeaderBits(buffer, MP4_VOL_ID_CODE_LENGTH, ETrue);
+    iHeader.iVolId = (TInt) bits;
+
+    // random_accessible_vol (1 bit)
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    iHeader.iRandomAccessibleVol = (TUint8) bits;
+
+    // video_object_type_indication (8 bits)
+    bits = ReadSeqHeaderBits(buffer, 8, ETrue);
+    if (bits != 1)
+        {
+        // this is not a simple video object stream 
+        PRINT((_L("CVedVolReader: ERROR - This is not a simple video object stream")))
+        User::Leave(KErrNotSupported);
+        }
+
+    // is_object_layer_identifier (1 bit)
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    if (bits)
+        {
+        // visual_object_ver_id (4 bits)
+        bits = ReadSeqHeaderBits(buffer, 4, ETrue);
+        if (bits != 1 && bits != 2)
+            {
+            // this is not an MPEG-4 version 1 or 2 stream
+            PRINT((_L("CVedVolReader: ERROR - This is not an MPEG-4 version 1 or 2 stream")))
+            User::Leave(KErrNotSupported);
+            }
+
+        // video_object_layer_priority (3 bits)
+        bits = ReadSeqHeaderBits(buffer, 3, ETrue);
+        iHeader.iVoPriority = (TInt) bits;
+        } 
+
+    // aspect_ratio_info: `0010`- 12:11 (625-type for 4:3 picture)
+    bits = ReadSeqHeaderBits(buffer, 4, ETrue);
+    iHeader.iPixelAspectRatio = (TInt) bits;
+
+    // extended par 
+    if (bits == 15)
+        { 
+        // par_width 
+        bits = ReadSeqHeaderBits(buffer, 8, ETrue);
+        // par_height 
+        bits = ReadSeqHeaderBits(buffer, 8, ETrue);
+        }
+   
+    // vol_control_parameters flag 
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    if (bits)
+        {
+        // chroma_format (2 bits)
+        bits = ReadSeqHeaderBits(buffer, 2, ETrue);
+        if (bits != 1)
+            {
+            PRINT((_L("CVedVolReader: ERROR - Not supported chroma format")))
+            User::Leave(KErrNotSupported);
+            }
+
+        // low_delay (1 bits)
+        bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+
+        // vbv_parameters (1 bits)
+        bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+        if (bits)
+            {
+            // first_half_bitrate (15 bits) 
+            bits = ReadSeqHeaderBits(buffer, 15, ETrue);
+            iHeader.iBitRate = (bits << 15);
+          
+            // marker_bit
+            if (!ReadSeqHeaderBits(buffer, 1, ETrue))
+                {
+                User::Leave(KErrCorrupt);
+                }
+           
+            // latter_half_bitrate (15 bits)
+            bits = ReadSeqHeaderBits(buffer, 15, ETrue);
+            iHeader.iBitRate += bits;
+            iHeader.iBitRate *= 400;
+           
+            // marker_bit
+            if (!ReadSeqHeaderBits(buffer, 1, ETrue))
+                {
+                User::Leave(KErrCorrupt);
+                }
+           
+            // first_half_vbv_buffer_size (15 bits)
+            bits = ReadSeqHeaderBits(buffer, 15, ETrue);
+            iHeader.iVbvBufferSize = (bits << 3);
+           
+            // marker_bit
+            if (!ReadSeqHeaderBits(buffer, 1, ETrue))
+                {
+                User::Leave(KErrCorrupt);
+                }
+           
+            // latter_half_vbv_buffer_size (3 bits)
+            bits = ReadSeqHeaderBits(buffer, 3, ETrue);
+            iHeader.iVbvBufferSize += bits;
+            iHeader.iVbvBufferSize *= 16384;
+           
+            // first_half_vbv_occupancy (11 bits)
+            bits = ReadSeqHeaderBits(buffer, 11, ETrue);
+            iHeader.iVbvOccupancy = (bits << 15);
+           
+            // marker_bit
+            if (!ReadSeqHeaderBits(buffer, 1, ETrue))
+                {
+                User::Leave(KErrCorrupt);
+                }
+           
+            // latter_half_vbv_occupancy (15 bits) 
+            bits = ReadSeqHeaderBits(buffer, 15, ETrue);
+            iHeader.iVbvOccupancy += bits;
+            iHeader.iVbvOccupancy *= 64;
+           
+            // marker_bit
+            if (!ReadSeqHeaderBits(buffer, 1, ETrue))
+                {
+                User::Leave(KErrCorrupt);
+                }
+            }
+        else
+            {
+            useDefaultVBVParams = 1;
+            }
+        }     
+    else
+        {
+        useDefaultVBVParams = 1;
+        }
+
+    // vol_shape (2 bits) 
+    bits = ReadSeqHeaderBits(buffer, 2, ETrue);
+    // rectangular_shape = '00'
+    if (bits != 0)
+        {
+        PRINT((_L("CVedVolReader: ERROR - Not rectangular shape is not supported")))
+        User::Leave(KErrNotSupported);
+        }
+
+    // marker_bit
+    if (!ReadSeqHeaderBits(buffer, 1, ETrue))
+        {
+        User::Leave(KErrCorrupt);
+        }
+    
+    // time_increment_resolution 
+    bits = ReadSeqHeaderBits(buffer, 16, ETrue);
+    iHeader.iTimeIncrementResolution = (TInt) bits;
+ 
+    // marker_bit
+    if (!ReadSeqHeaderBits(buffer, 1, ETrue))
+        {
+        User::Leave(KErrCorrupt);
+        }
+    
+    // fixed_vop_rate 
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+
+    // fixed_vop_time_increment (1-15 bits)
+    if (bits)
+        {
+        for (numBits = 1; ((iHeader.iTimeIncrementResolution-1) >> numBits) != 0; numBits++) 
+            {
+            }
+
+        bits = ReadSeqHeaderBits(buffer, numBits, ETrue);
+        }
+
+    // marker_bit
+    if (!ReadSeqHeaderBits(buffer, 1, ETrue))
+        {
+        User::Leave(KErrCorrupt);
+        }
+    
+    // vol_width (13 bits) 
+    bits = ReadSeqHeaderBits(buffer, 13, ETrue);
+    iHeader.iLumWidth = (TInt) bits;
+
+    // marker_bit
+    if (!ReadSeqHeaderBits(buffer, 1, ETrue))
+        {
+        User::Leave(KErrCorrupt);
+        }
+    
+    // vol_height (13 bits) 
+    bits = ReadSeqHeaderBits(buffer, 13, ETrue);
+    iHeader.iLumHeight = (TInt) bits;
+    
+    // Accept only resolutions that are divisible by 16
+    if ( ((iHeader.iLumWidth & 0x0000000f) != 0) ||
+        ((iHeader.iLumHeight & 0x0000000f) != 0) )
+        {
+        PRINT((_L("CVedVolReader: ERROR - Unsupported resolution")))
+        User::Leave(KErrNotSupported);
+        }
+        
+    TInt macroBlocks = iHeader.iLumWidth * iHeader.iLumHeight / (16 * 16);
+    
+    // Check that we don't have too many macro blocks (ie resolution is not too big)
+    if( macroBlocks > 1200 )
+        {
+        PRINT((_L("CVedVolReader: ERROR - Unsupported resolution")))
+        User::Leave(KErrNotSupported);
+        }
+        
+    // Check that profile level id matches with the number of macro blocks
+    if( macroBlocks > 396 )
+        {
+        // Resolution is higher than CIF => level must be 4a
+        if( iHeader.iProfileLevelId != 4 )
+            {
+            iHeader.iProfileLevelId = 4;
+            useDefaultVBVParams = 1;
+            }
+        }
+    else if( macroBlocks > 99 )
+        {
+        // Resolution is higher than QCIF => level must be atleast 2
+        if( iHeader.iProfileLevelId < 2 || iHeader.iProfileLevelId > 4 )
+            {
+            iHeader.iProfileLevelId = 3;    // QVGA/CIF @ 30fps
+            useDefaultVBVParams = 1;
+            }
+        }
+    
+    // Set default VBV params if not set already  
+    if (useDefaultVBVParams)
+        {
+        switch (iHeader.iProfileLevelId)
+            {
+            case 1:
+                iHeader.iVbvBufferSize = 10;
+                iHeader.iBitRate = 64;
+                break;
+            case 2:
+                iHeader.iVbvBufferSize = 20;
+                iHeader.iBitRate = 128;
+                break;
+            case 4:
+                iHeader.iVbvBufferSize = 80;
+                iHeader.iBitRate = 4000;
+                break;
+            case 8:
+                iHeader.iVbvBufferSize = 10;
+                iHeader.iBitRate = 64;
+                break;
+            case 9:
+                iHeader.iVbvBufferSize = 20;
+                iHeader.iBitRate = 128;
+                break;
+            default:
+                iHeader.iVbvBufferSize = 20;
+                iHeader.iBitRate = 384;
+                break;
+            }
+        
+        iHeader.iVbvOccupancy = iHeader.iVbvBufferSize * 170;
+       
+        iHeader.iVbvOccupancy *= 64;
+        iHeader.iVbvBufferSize *= 16384;
+        iHeader.iBitRate *= 1024;
+        }
+    
+    // marker_bit
+    if (!ReadSeqHeaderBits(buffer, 1, ETrue))
+        {
+        User::Leave(KErrCorrupt);
+        }
+    
+    // interlaced (1 bit)
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    if (bits)
+        {
+        PRINT((_L("CVedVolReader: ERROR - Interlaced VOP not supported")))
+        User::Leave(KErrNotSupported);
+        }
+
+    // OBMC_disable
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    if (!bits)
+        {
+        PRINT((_L("CVedVolReader: ERROR - Overlapped motion compensation not supported")))
+        User::Leave(KErrNotSupported);
+        }
+
+    // sprite_enable (1 bit) 
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    if (bits)
+        {
+        PRINT((_L("CVedVolReader: ERROR - Sprites not supported")))
+        User::Leave(KErrNotSupported);
+        }
+
+    // not_8_bit (1 bit) 
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    if (bits)
+        {
+        PRINT((_L("CVedVolReader: ERROR - Not 8 bits/pixel not supported")))
+        User::Leave(KErrNotSupported);
+        }
+
+    // quant_type (1 bit) 
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    if (bits)
+        {
+        PRINT((_L("CVedVolReader: ERROR - H.263/MPEG-2 Quant Table switch not supported")))
+        User::Leave(KErrNotSupported);
+        }
+
+    // complexity_estimation_disable (1 bit) 
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    if (!bits)
+        {
+        PRINT((_L("CVedVolReader: ERROR - Complexity estimation header not supported")))
+        User::Leave(KErrNotSupported);
+        }
+  
+    // resync_marker_disable (1 bit)
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    iHeader.iErrorResDisable = (TUint8) bits;
+
+    // data_partitioned (1 bit) 
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    iHeader.iDataPartitioned = (TUint8) bits;
+
+    if (iHeader.iDataPartitioned)
+        {
+        // reversible_vlc (1 bit)
+        bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+        iHeader.iReversibleVlc = (TUint8) bits;
+        }
+
+    // scalability (1 bit)
+    bits = ReadSeqHeaderBits(buffer, 1, ETrue);
+    if (bits)
+        {
+        PRINT((_L("CVedVolReader: ERROR - Scalability not supported")))
+        User::Leave(KErrNotSupported);
+        }
+
+    // check the next start code
+    ReadSeqHeaderBits(buffer, 1, ETrue);
+    if (buffer.iBitInOctet != 7)
+        {
+        numBits = buffer.iBitInOctet + 1;
+       
+        bits = ReadSeqHeaderBits(buffer, numBits, ETrue);
+        
+        /* Removed temporarily
+        if (bits != (TUint32) ((1 << numBits)-1))
+            {
+            // this is not a video object
+            PRINT((_L("CVedVolReader: ERROR - Stuffing error")))
+            User::Leave(KErrNotSupported);
+            }*/
+        }
+
+    ReadUserDataL(buffer);
+        
+    // Calculate the header size in bytes
+    if (buffer.iBitInOctet == 7)
+        {
+        // The size is a multiple of 8 bits so the size is the number of bytes we've read so far
+        iHeaderSize = buffer.iGetIndex;
+        }
+    else
+        {
+        // Round up to the next full byte
+        iHeaderSize = buffer.iGetIndex + 1;
+        }
+     
+    // Determine the bitstream mode  
+    iBitstreamMode = CheckBitstreamMode(iHeader.iErrorResDisable, iHeader.iDataPartitioned, iHeader.iReversibleVlc);
+
+    // If no error in bit buffer functions
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------
+// CVedVolReader::ReadSeqHeaderBits
+// Reads requested bits from given buffer
+// ---------------------------------------------------------
+//  
+TUint32 CVedVolReader::ReadSeqHeaderBits(TSeqHeaderBuffer& aBuffer, TInt aNumBits, TBool aFlush)
+    {      
+    TUint startIndex;       // the index of the first byte to read 
+    TUint startMask;        // the mask for the first byte 
+    TUint endIndex;         // the index of the last byte to read 
+    TUint endMask;          // the mask for the last byte 
+    TUint endShift;         // the number of shifts after masking the last byte 
+    TUint endNumberOfBits;  // the number of bits in the last byte 
+    TUint newBitIndex;      // bitIndex after getting the bits 
+    TUint newGetIndex;      // getIndex after getting the bits 
+    
+    TUint32 returnValue = 0;
+
+    startIndex = aBuffer.iGetIndex;
+    startMask = KMsbMask[aBuffer.iBitInOctet];
+
+    // Check that there are enough bits left
+    if (startIndex * 8 + aNumBits > aBuffer.iData.Length() * 8)
+        {
+	    return 0;
+        }
+
+    if (aBuffer.iBitInOctet + 1 >= aNumBits)
+        {
+        // The bits are within one byte. 
+        endShift = aBuffer.iBitInOctet - aNumBits + 1;
+        endMask = KLsbMask[endShift];
+        returnValue = (aBuffer.iData[startIndex] & startMask & endMask) >> endShift;
+        if (endShift > 0)
+            {
+            newBitIndex = aBuffer.iBitInOctet - aNumBits;
+            newGetIndex = aBuffer.iGetIndex;
+            }
+        else
+            {
+            newBitIndex = 7;
+            newGetIndex = aBuffer.iGetIndex + 1;
+            }
+        } 
+    else
+        {
+        // The bits are in multiple bytes. 
+        aNumBits -= aBuffer.iBitInOctet + 1;
+        endNumberOfBits = aNumBits & 7;
+
+        newBitIndex = 7 - endNumberOfBits;
+        newGetIndex = aBuffer.iGetIndex + (aNumBits >> 3) + 1;
+      
+        // Calculate the return value. 
+        endIndex = newGetIndex;
+        endShift = 8 - (aNumBits & 7);
+        endMask = KLsbMask[endShift];
+      
+        returnValue = aBuffer.iData[startIndex] & startMask;
+        startIndex++;
+      
+        while (startIndex != endIndex)
+            {
+            returnValue <<= 8;
+            returnValue += (TUint8) aBuffer.iData[startIndex];
+            startIndex++;
+            }
+        
+        if (endNumberOfBits != 0)
+            {
+            returnValue <<= endNumberOfBits;
+            returnValue += (aBuffer.iData[startIndex] & endMask) >> endShift;
+            }
+        }
+
+    if (aFlush)
+        {
+        // Update indexes. 
+        aBuffer.iGetIndex = newGetIndex;
+        aBuffer.iBitInOctet = newBitIndex;
+        }
+
+    return returnValue;
+    }
+
+// ---------------------------------------------------------
+// CVedVolReader::ReadUserDataL
+// Reads user data from given buffer
+// ---------------------------------------------------------
+//    
+void CVedVolReader::ReadUserDataL(TSeqHeaderBuffer& aBuffer)
+    {
+    TUint32 bits;
+    
+    // Check if User data is available 
+    bits = ReadSeqHeaderBits(aBuffer, 32, EFalse);
+    if (bits == MP4_USER_DATA_START_CODE)
+        {
+        if (iHeader.iUserData == 0)
+            {
+            iHeader.iUserData = HBufC8::NewL(KMaxUserDataLength);
+            }
+            
+        TInt i = iHeader.iUserData->Length();    
+        do 
+            {
+            bits = ReadSeqHeaderBits(aBuffer, 8, ETrue);
+            if (i++ < KMaxUserDataLength)
+                {
+                (iHeader.iUserData->Des()).Append(TChar(bits));
+                }
+            }
+        while (aBuffer.iData.Length() > aBuffer.iGetIndex &&
+               ReadSeqHeaderBits(aBuffer, 24, EFalse) != 0x1);
+        }
+    }
+     
+// ---------------------------------------------------------
+// CVedVolReader::CheckBitstreamMode
+// Checks what is the bit stream mode the video
+// ---------------------------------------------------------
+//
+TVedVideoBitstreamMode CVedVolReader::CheckBitstreamMode(TUint8 aErd, TUint8 aDp, TUint8 aRvlc)
+    {
+    TVedVideoBitstreamMode mode = EVedVideoBitstreamModeUnknown;
+    int combination = ((!aErd) << 2) | (aDp << 1) | aRvlc;
+                      
+    switch (combination)
+        {
+        case 0:
+            mode = EVedVideoBitstreamModeMPEG4Regular;
+            break;
+        case 2:
+            mode = EVedVideoBitstreamModeMPEG4DP;
+            break;
+        case 3:
+            mode = EVedVideoBitstreamModeMPEG4DP_RVLC;
+            break;
+        case 4:
+            mode = EVedVideoBitstreamModeMPEG4Resyn;
+            break;
+        case 6:
+            mode = EVedVideoBitstreamModeMPEG4Resyn_DP;
+            break;
+        case 7:
+            mode = EVedVideoBitstreamModeMPEG4Resyn_DP_RVLC;
+            break;
+        default:
+            break;
+        }
+        
+    return mode;
+    }
+    
+// ---------------------------------------------------------
+// CVedVolReader::TimeIncrementResolution
+// Returns the time increment resolution that was read from the VOL header
+// ---------------------------------------------------------
+//     
+EXPORT_C TInt CVedVolReader::TimeIncrementResolution() const
+    {
+    return iHeader.iTimeIncrementResolution;
+    }
+       
+// ---------------------------------------------------------
+// CVedVolReader::Width
+// Returns the width of the video that was read from the VOL header
+// ---------------------------------------------------------
+// 
+EXPORT_C TInt CVedVolReader::Width() const
+    {
+    return iHeader.iLumWidth;
+    }
+      
+// ---------------------------------------------------------
+// CVedVolReader::Height
+// Returns the height of the video that was read from the VOL header
+// ---------------------------------------------------------
+// 
+EXPORT_C TInt CVedVolReader::Height() const
+    {
+    return iHeader.iLumHeight;
+    }
+    
+// ---------------------------------------------------------
+// CVedVolReader::ProfileLevelId
+// Returns the Level Id of the Simple Profile the Video Object conforms to
+// ---------------------------------------------------------
+// 
+EXPORT_C TInt CVedVolReader::ProfileLevelId() const
+    {
+    return iHeader.iProfileLevelId;
+    }
+    
+// ---------------------------------------------------------
+// CVedVolReader::BitstreamMode
+// Returns the bitstream mode of the video
+// ---------------------------------------------------------
+//  
+EXPORT_C TVedVideoBitstreamMode CVedVolReader::BitstreamMode() const
+    {
+    return iBitstreamMode;
+    }
+    
+// ---------------------------------------------------------
+// CVedVolReader::HeaderSize
+// Returns the bitstream mode of the video
+// ---------------------------------------------------------
+//  
+EXPORT_C TInt CVedVolReader::HeaderSize() const
+    {
+    return iHeaderSize;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/biblin.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1127 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Bit buffer reading operations.
+*
+*/
+
+
+
+
+/*
+* Includes
+*/
+
+#include "h263dConfig.h"
+#include "Biblin.h"
+#include "debug.h"
+
+#ifdef DEBUG_OUTPUT
+bibBuffer_t * buffer_global;
+#endif
+
+
+/*
+* Definitions
+*/
+
+#define bibMalloc malloc
+#define bibCalloc calloc
+#define bibRealloc realloc
+#define bibDealloc free
+
+#ifndef bibAssert
+#define bibAssert(exp) assert(exp);
+#endif
+
+
+/*
+* Local function prototypes
+*/
+
+static void bibInitialize(
+                                                    bibBuffer_t *bibBuffer,
+                                                    void *srcBuffer,
+                                                    unsigned srcBufferLength,
+                                                    int16 *errorCode);
+
+
+
+
+/*
+* Imported variables
+*/
+
+
+
+/*
+* Global functions
+*/
+
+/* {{-output"bibCreate.txt"}} */
+/*
+*
+* bibCreate
+*    
+*
+* Parameters:
+*    srcBuffer                  buffer containing the data
+*    srcBufferLength            the length of the buffer
+*    errorCode                  error code
+*
+* Function:
+*    This function creates a bit buffer from a buffer given as a parameter.
+*
+* Returns:
+*    The bibCreate function returns a pointer to a bibBuffer_t
+*    structure. If the function is unsuccessful NULL is returned.
+*
+* Error codes:
+*    ERR_BIB_STRUCT_ALLOC       if the bit buffer structure could not be
+*                               allocated
+*
+*/
+
+bibBuffer_t *bibCreate(void *srcBuffer, unsigned srcBufferLength, int16 *errorCode)
+/* {{-output"bibCreate.txt"}} */
+{
+    bibBuffer_t *bibBuffer = NULL;
+    int16 tmpError = 0;
+    
+    bibBuffer = (bibBuffer_t *) bibMalloc(sizeof(bibBuffer_t));
+    if (bibBuffer == NULL) {
+        *errorCode = ERR_BIB_STRUCT_ALLOC;
+        deb("bibCreate: ERROR - bibMalloc failed.\n");
+        return NULL;
+    }
+    
+    bibInitialize(bibBuffer, srcBuffer, srcBufferLength, &tmpError);
+    if (tmpError) {
+        bibDealloc(bibBuffer);
+        return NULL;
+    }
+    
+#ifdef DEBUG_OUTPUT
+    debLoad("deb_dec.log");
+    buffer_global = bibBuffer;
+#endif
+    
+    return bibBuffer;
+}
+
+
+
+
+bibBufferEdit_t *bibBufferEditCreate(int16 *errorCode)
+/* {{-output"bibCreate.txt"}} */
+{
+    bibBufferEdit_t *bufEdit = NULL;    
+    
+    bufEdit = (bibBufferEdit_t *) bibMalloc(sizeof(bibBufferEdit_t));
+    if (bufEdit == NULL) {
+        *errorCode = ERR_BIB_STRUCT_ALLOC;
+        deb("bibBufferEditCreate: ERROR - bibMalloc failed.\n");
+        return NULL;
+    }
+     bufEdit->copyMode = CopyWhole/*CopyWhole*/;
+     bufEdit->numChanges=0;
+     bufEdit->editParams=NULL;
+     
+   return bufEdit;
+}
+
+
+
+
+/* {{-output"bibDelete.txt"}} */
+/*
+*
+* bibDelete
+*    
+*
+* Parameters:
+*    buffer                     a pointer to a bit buffer structure
+*    errorCode                  error code
+*
+* Function:
+*    The bibDelete function frees the memory allocated for the buffer.
+*
+* Returns:
+*    Nothing
+*
+* Error codes:
+*    None
+*
+*/
+
+void bibDelete(bibBuffer_t *buffer, int16 * /*errorCode*/)
+/* {{-output"bibDelete.txt"}} */
+{
+    if (buffer) {
+        // note that the BaseAddr is just a reference to memory allocated elsewhere
+        // and there is no other dynamic allocations inside buffer
+        bibDealloc((void *) buffer);
+    }
+}
+
+
+
+void bibBufEditDelete(bibBufferEdit_t *bufEdit, int16 * /*errorCode*/)
+{
+     int i;
+   if (bufEdit) {
+         for(i=0; i<bufEdit->numChanges; i++)
+             bibDealloc((void *) bufEdit->editParams);
+         bibDealloc((void *) bufEdit);
+   }
+}
+
+
+/*
+*
+* bibFlushBits
+* bibGetBits
+* bibShowBits
+*    
+*
+* Parameters:
+*    numberOfBits               the number of bits wanted (1..32)
+*    buffer                     a pointer to a bit buffer structure
+*    numberOfBitsGot            the number of bits actually got
+*    syncStartIndex             the number of the first bit belonging to 
+*                               a synchronization code (1 .. numberOfBits).
+*                               Bits are numbered starting from 1 given to
+*                               the most significant bit of the returned code.
+*                               Thus, syncStartIndex - 1 most significant bits
+*                               of the returned code are valid coding
+*                               parameters (do not belong to a sync code).
+*                               0 is returned if the returned code does not
+*                               contain any part of a synchronization code.
+*    bitErrorIndication         indication code for bit errors,
+*                               see biterr.h for the possible values
+*    errorCode                  error code
+*
+* Function:
+*    The bibFlushBits function removes the next numberOfBits bits from
+*    the buffer.
+*
+*    The bibGetBits function gets the next numberOfBits bits from the buffer.
+*    The returned bits are removed.
+*
+*    The bibShowBits function gets the next numberOfBits bits from the
+*    buffer. The returned bits are not removed from the buffer.
+*
+* Returns:
+*   bibGetBits and bibShowBits:
+*       the next numberOfBits bits / the rest of the buffer if the end of
+*       the input file has been reached
+*
+* Error codes:
+*    ERR_BIB_NOT_ENOUGH_DATA    if one tries to get more bits from the buffer
+*                               than there is left
+*
+*/
+
+void bibFlushBits(int numberOfBits, bibBuffer_t *buffer)
+{
+    bibAssert(buffer != NULL);
+    bibAssert(numberOfBits > 0 && numberOfBits <= 32);
+    
+    /* Check if enough bits are available. */
+    if (buffer->bitsLeft < (u_int32) numberOfBits) {
+        goto flush_underflow;
+    }
+    buffer->bitsLeft -= numberOfBits;
+    
+    if ( buffer->bitIndex >= numberOfBits ) {
+        /* All in the current byte, bits still left */
+        buffer->bitIndex -= numberOfBits;
+    }
+    else if ( buffer->bitIndex == (numberOfBits-1) ) {
+        /* Current byte used completely */
+        buffer->bitIndex = 7;
+        buffer->getIndex++;
+        buffer->numBytesRead++;
+    }
+    else {
+        /* Current byte plus then some */
+        numberOfBits -= buffer->bitIndex + 1; /* this many bits after current byte */
+        buffer->getIndex += ((numberOfBits>>3) + 1);
+        buffer->numBytesRead += ((numberOfBits>>3) + 1);
+        buffer->bitIndex = 7 - (numberOfBits&7); 
+    }
+    return;
+flush_underflow:
+    buffer->error = ERR_BIB_NOT_ENOUGH_DATA;
+}
+
+
+
+/*
+*
+* bibGetAlignedByte
+*    
+*
+* A fast function to get one byte from byte-boundary.
+*
+*/
+inline u_int8 bibGetAlignedByte(bibBuffer_t *buffer)   
+    {
+    return buffer->baseAddr[buffer->getIndex++];
+    }
+
+
+/*
+*
+* bibGetBits
+*    
+*
+* See bibFlushBits.
+*
+*/
+
+u_int32 bibGetBits(int numberOfBits, bibBuffer_t *buffer)   
+{
+    static const u_char
+        msbMask[8] = {1, 3, 7, 15, 31, 63, 127, 255},
+        lsbMask[9] = {255, 254, 252, 248, 240, 224, 192, 128, 0};
+    u_char
+        *startAddr;
+    int32
+        bitIndex;
+    u_int32
+        endShift;         /* the number of shifts after masking the last byte */
+    u_int32
+        numBytesFlushed;  /* the number of bytes flushed from the buffer */
+    u_int32
+        returnValue = 0;
+    
+    bibAssert(buffer != NULL);
+    bibAssert(numberOfBits > 0 && numberOfBits <= 32);
+    
+    startAddr = buffer->baseAddr + buffer->getIndex;
+    bitIndex = buffer->bitIndex;
+    
+    /* Check if enough bits are available. */
+    if (buffer->bitsLeft < (u_int32) numberOfBits) {
+        goto get_underflow;
+    }
+    
+    buffer->bitsLeft -= numberOfBits;
+    
+    if ( bitIndex >= numberOfBits ) {
+        /* All in the current byte, bits still left */
+        endShift = bitIndex - numberOfBits + 1;
+        buffer->bitIndex -= numberOfBits;
+        return ((startAddr[0] & msbMask[bitIndex] & lsbMask[endShift]) >> endShift);
+    }
+    else if ( bitIndex == (numberOfBits-1) ) {
+        /* Current byte used completely */
+        buffer->bitIndex = 7;
+        buffer->getIndex++;
+        buffer->numBytesRead++;
+        return startAddr[0] & msbMask[bitIndex];
+    }
+    else {
+        /* Current byte plus then some */
+        
+        /* Remainder of this byte */
+        returnValue = *(startAddr++) & msbMask[bitIndex];
+        numberOfBits -= bitIndex + 1;
+        numBytesFlushed = 1 + (numberOfBits >> 3);
+        
+        /* Get full bytes */
+        while ( numberOfBits >= 8 ) {
+            returnValue = (returnValue << 8) | *(startAddr++);
+            numberOfBits -= 8;
+        }
+        
+        /* Get bits from last byte */
+        endShift = 8 - numberOfBits;
+        returnValue = (returnValue << numberOfBits) | ((startAddr[0] & lsbMask[endShift]) >> endShift);
+        /* (safe, since lsbMask[8]==0) */
+        
+        /* Update position in buffer */
+        buffer->bitIndex = 7 - numberOfBits;
+        buffer->getIndex += numBytesFlushed;
+        buffer->numBytesRead += numBytesFlushed;
+    }
+    
+    return returnValue;
+get_underflow:
+    buffer->error = ERR_BIB_NOT_ENOUGH_DATA;
+    return 0;
+}
+
+
+/* {{-output"bibNumberOfFlushedBits.txt"}} */
+/*
+*
+* bibNumberOfFlushedBits
+*    
+*
+* Parameters:
+*    buffer                     a pointer to a bit buffer structure
+*
+* Function:
+*    The bibNumberOfFlushedBytes returns the number of bits which
+*    are got (bibGetBits) or flushed (bibFlushBits) from the buffer since
+*    the buffer was created
+*
+* Returns:
+*    See above.
+*
+* Error codes:
+*    None.
+*
+*/
+
+u_int32 bibNumberOfFlushedBits(bibBuffer_t *buffer)
+/* {{-output"bibNumberOfFlushedBits.txt"}} */
+{
+    bibAssert(buffer != NULL);
+    
+    return ((buffer->numBytesRead<<3) + (7-buffer->bitIndex));
+}
+
+
+/* {{-output"bibNumberOfFlushedBytes.txt"}} */
+/*
+*
+* bibNumberOfFlushedBytes
+*    
+*
+* Parameters:
+*    buffer                     a pointer to a bit buffer structure
+*
+* Function:
+*    The bibNumberOfFlushedBytes returns the number of whole bytes which
+*    are got (bibGetBits) or flushed (bibFlushBits) from the buffer since
+*    bibCreate was called.
+*
+* Returns:
+*    See above.
+*
+* Error codes:
+*    None.
+*
+*/
+
+u_int32 bibNumberOfFlushedBytes(bibBuffer_t *buffer)
+/* {{-output"bibNumberOfFlushedBytes.txt"}} */
+{
+    bibAssert(buffer != NULL);
+    
+    return buffer->numBytesRead;
+}
+
+
+/* {{-output"bibNumberOfRewBits.txt"}} */
+/*
+*
+* bibNumberOfRewBits
+*    
+*
+* Parameters:
+*    buffer                     a pointer to a bit buffer structure
+*
+* Function:
+*    The bibNumberOfRewBits returns the number of bits which can be
+*    successfully rewinded.
+*
+* Returns:
+*    See above.
+*
+* Error codes:
+*    None.
+*
+*/
+
+u_int32 bibNumberOfRewBits(bibBuffer_t *buffer)
+/* {{-output"bibNumberOfRewBits.txt"}} */
+{
+    bibAssert(buffer != NULL);
+    
+    return ((buffer->numBytesRead<<3) + (7-buffer->bitIndex));
+}
+
+
+/* {{-output"bibRewindBits.txt"}} */
+/*
+*
+* bibRewindBits
+*    
+*
+* Parameters:
+*    numberOfBits               the number of bits to rewind
+*    buffer                     a pointer to a bit buffer structure
+*    errorCode                  error code
+*
+* Function:
+*    This function rewinds the pointers to the buffer
+*    so that already flushed or got bits can be read
+*    again.
+*
+* Returns:
+*    Nothing.
+*
+* Error codes:
+*    ERR_BIB_CANNOT_REWIND      if numberOfBits is larger than which is
+*                               possible to get (see also bibNumberOfRewBits).
+*
+*    ERR_BIB_BUFLIST            if there was a fatal error when handling
+*                               buffer lists
+*
+*/
+
+void bibRewindBits(u_int32 numberOfBits, bibBuffer_t *buffer, int16 *errorCode)
+/* {{-output"bibRewindBits.txt"}} */
+{
+    bibAssert(buffer != NULL);
+    
+    /* All bits to rewind are in the latest byte */
+    if (numberOfBits <= (u_int32) (7 - buffer->bitIndex)) {
+        buffer->bitIndex += numberOfBits;
+    }
+    /* Bits to rewind are within several bytes */
+    else {
+        u_int32
+            numBitsWithoutFirstByte = numberOfBits - (7 - buffer->bitIndex),
+            numWholeBytes = (numBitsWithoutFirstByte>>3),
+            numBitsInLastByte = numBitsWithoutFirstByte - (numWholeBytes<<3);
+        
+        if (numBitsInLastByte) {
+            if (buffer->getIndex >= numWholeBytes + 1) {
+                buffer->getIndex -= numWholeBytes + 1;
+                buffer->bitIndex = numBitsInLastByte - 1;
+                buffer->numBytesRead -= numWholeBytes + 1;
+            }
+            else {
+                *errorCode = ERR_BIB_CANNOT_REWIND;
+                deb("bibRewindBits: ERROR - cannot rewind.\n");
+            }
+        }
+        else {
+            if (buffer->getIndex >= numWholeBytes) {
+                buffer->getIndex -= numWholeBytes;
+                buffer->bitIndex = 7;
+                buffer->numBytesRead -= numWholeBytes;
+            }
+            else {
+                *errorCode = ERR_BIB_CANNOT_REWIND;
+                deb("bibRewindBits: ERROR - cannot rewind.\n");
+            }
+        }
+    }
+    buffer->bitsLeft += numberOfBits;
+}
+
+
+/* {{-output"bibShowBits.txt"}} */
+/*
+*
+* bibShowBits
+*    
+*
+* See bibFlushBits.
+*
+*/
+
+u_int32 bibShowBits(int numberOfBits, bibBuffer_t *buffer)  
+/* {{-output"bibShowBits.txt"}} */
+{
+    static const u_char
+        msbMask[8] = {1, 3, 7, 15, 31, 63, 127, 255},
+        lsbMask[9] = {255, 254, 252, 248, 240, 224, 192, 128, 0};
+    u_char
+        *startAddr;
+    int32
+        bitIndex;
+    u_int32
+        endShift;         /* the number of shifts after masking the last byte */
+    u_int32
+        returnValue = 0;
+    
+    bibAssert(buffer != NULL);
+    bibAssert(numberOfBits > 0 && numberOfBits <= 32);
+    
+    startAddr = buffer->baseAddr + buffer->getIndex;
+    bitIndex = buffer->bitIndex;
+    
+    /* Check if enough bits are available. */
+    if (buffer->bitsLeft < (u_int32) numberOfBits) {
+        goto show_underflow;
+    }
+    
+    if ( bitIndex >= numberOfBits ) {
+        /* All in the current byte, bits still left */
+        endShift = bitIndex - numberOfBits + 1;
+        return ((startAddr[0] & msbMask[bitIndex] & lsbMask[endShift]) >> endShift);
+    }
+    else if ( bitIndex == (numberOfBits-1) ) {
+        /* Current byte used completely */
+        return startAddr[0] & msbMask[bitIndex];
+    }
+    else {
+        /* Current byte plus then some */
+        
+        /* Remainder of this byte */
+        returnValue = *(startAddr++) & msbMask[bitIndex];
+        numberOfBits -= bitIndex + 1;
+        
+        /* Get full bytes */
+        while ( numberOfBits >= 8 )
+        {
+            returnValue = (returnValue << 8) | *(startAddr++);
+            numberOfBits -= 8;
+        }
+        
+        /* Get bits from last byte */
+        endShift = 8 - numberOfBits;
+        returnValue = (returnValue << numberOfBits) | ((startAddr[0] & lsbMask[endShift]) >> endShift);
+        /* (safe, since lsbMask[8]==0) */
+    }
+    
+    return returnValue;
+show_underflow:
+    buffer->error = ERR_BIB_NOT_ENOUGH_DATA;
+    return 0;
+}
+
+
+/*
+* Local functions
+*/
+
+/*
+*
+* bibInitialize
+*    
+*
+* Parameters:
+*    bibBuffer                  input bit buffer instance
+*    srcBuffer                  buffer containing the data
+*    srcBufferLength            the length of the buffer
+*    errorCode                  error code
+*
+* Function:
+*    This function initializes the values of the bibBuffer structure.
+*
+* Returns:
+*    Nothing.
+*
+* Error codes:
+*    ERR_BIB_BUFLIST            if the internal buffer list has been corrupted
+*
+*/
+
+static void bibInitialize(
+                            bibBuffer_t *bibBuffer,
+                            void *srcBuffer,
+                            unsigned srcBufferLength,
+                            int16 */*errorCode*/)
+{
+    bibBuffer->baseAddr = (u_char *) srcBuffer;
+    bibBuffer->size = srcBufferLength;
+    bibBuffer->getIndex = 0;
+    bibBuffer->bitIndex = 7;
+    bibBuffer->bitsLeft = (u_int32) (srcBufferLength<<3);
+    bibBuffer->numBytesRead = 0;
+    bibBuffer->error = 0;
+    
+    
+}
+
+
+
+/*
+*
+* CopyStream
+*    
+*
+* Function to copy stream from SrcBuffer to DestBuffer based on settings in bufEdit and ByteStart & BitStart
+*    
+*    
+*/
+
+void CopyStream(bibBuffer_t *SrcBuffer,bibBuffer_t *DestBuffer,bibBufferEdit_t *bufEdit, 
+                                int ByteStart, int BitStart)
+{
+    int32 temp;
+    unsigned tgetIndex;  
+    int tbitIndex;
+    u_int32 tbitsLeft;
+    u_int32 tnumBytesRead;
+    int tByteStart; 
+    int tBitStart;  
+    
+    bibEditParams_t *edParam;
+    
+    //Add assertions and checks here !!
+    bibAssert(SrcBuffer->baseAddr);
+    bibAssert(DestBuffer->baseAddr);
+    bibAssert(bufEdit);
+    
+    //Save the params of SrcBuffer to recover them later:
+    tgetIndex=SrcBuffer->getIndex;
+    tbitIndex=SrcBuffer->bitIndex;
+    tbitsLeft=SrcBuffer->bitsLeft;
+    tnumBytesRead=SrcBuffer->numBytesRead;
+    
+    
+    
+    // check to see if we need to change some header parameter
+    if(bufEdit->copyMode == CopyWithEdit/*CopyWithEdit*/)
+    {
+        bibAssert(bufEdit->editParams);
+        edParam = &(bufEdit->editParams[0]); 
+        
+        // check if the editing position is in the current range of bit data
+        temp=((SrcBuffer->getIndex<<3) + (7-SrcBuffer->bitIndex))-
+            ((edParam->StartByteIndex<<3) + 7-(edParam->StartBitIndex));
+        if (temp>=0)    // yes, it is
+        {
+            // copy upto the editing point
+            CopyBuffer(SrcBuffer, DestBuffer, ByteStart, BitStart, edParam->StartByteIndex, 
+                edParam->StartBitIndex);
+            
+            CopyBufferEdit(SrcBuffer, DestBuffer, &(bufEdit->editParams[0]));
+            
+            // store new starting copy position 
+            tByteStart = SrcBuffer->getIndex; 
+            tBitStart  = SrcBuffer->bitIndex; 
+            // restore original stop copy position 
+            SrcBuffer->getIndex=tgetIndex;
+            SrcBuffer->bitIndex=tbitIndex;
+            SrcBuffer->bitsLeft=tbitsLeft;
+            SrcBuffer->numBytesRead=tnumBytesRead;
+            
+            CopyBuffer(SrcBuffer, DestBuffer, tByteStart, tBitStart, tgetIndex, tbitIndex);
+
+        }
+        else                    // no
+        {
+            // put panic here !
+            return;
+        }
+    }
+    else if (bufEdit->copyMode == CopyWhole/*CopyWhole*/)
+    {
+        CopyBuffer(SrcBuffer, DestBuffer, ByteStart, BitStart, 
+            SrcBuffer->getIndex, SrcBuffer->bitIndex);
+    }
+    else if (bufEdit->copyMode == EditOnly /*EditOnly*/)
+    {
+        CopyBufferEdit(SrcBuffer, DestBuffer, &(bufEdit->editParams[0]));
+    }
+    else if(bufEdit->copyMode == CopyNone/*CopyNone*/)
+    {
+        return; 
+    }
+
+    
+  //4- Retrieve the original Srcbuffer params.
+    // Using getbits it should be equal to where we started
+    SrcBuffer->getIndex=tgetIndex;
+    SrcBuffer->bitIndex=tbitIndex;
+    SrcBuffer->bitsLeft=tbitsLeft;
+    SrcBuffer->numBytesRead=tnumBytesRead;
+    
+    //5- Update the destbuffer statistics:
+    DestBuffer->getIndex=DestBuffer->numBytesRead;
+
+    DestBuffer->bitsLeft -= (DestBuffer->getIndex<<3);
+
+}
+
+/*
+*
+* CopyBuffer
+*    
+*
+* Function to copy data from SrcBuffer to DestBuffer from ByteStart & BitStart to ByteEnd & BitEnd
+*    
+*    
+*/
+
+void CopyBuffer(bibBuffer_t *SrcBuffer,bibBuffer_t *DestBuffer,
+                                int ByteStart,int BitStart, int ByteEnd, int BitEnd)
+{
+    u_char *DestStartAddr;
+    u_int32 i;
+    u_int32 temp;
+    u_int32 BitsToRewind;
+    u_int32 BitsToCopy;
+    u_int32 BytesToCopy;
+    u_int32 Bytes4ToCopy;
+    u_int32 BitsRemaining;
+    int16 errorCode;
+    u_int32 bitshift;
+    u_int32 bitstoget;
+    static const u_char msbMask[8] = {1, 3, 7, 15, 31, 63, 127, 255};
+    
+    DestStartAddr = DestBuffer->baseAddr + DestBuffer->getIndex;
+    
+    //Rewind the src buffer to the start address(ByteStart,BitStart)
+    BitsToRewind=((SrcBuffer->getIndex<<3) + (7-SrcBuffer->bitIndex))-
+        ((ByteStart<<3) + (7-BitStart));
+    bibRewindBits(BitsToRewind,SrcBuffer, &errorCode);
+    
+    // evaluate the number of bits to copy
+    BitsToCopy = ((ByteEnd<<3) + (7-BitEnd))-((ByteStart<<3) + (7-BitStart));
+    if (BitsToCopy<=0)
+        return; 
+    else if (BitsToCopy > BitsToRewind) 
+        BitsToCopy = BitsToRewind;      // or else provide a panic here !!!
+    
+    //1- Fill the remaining of the byte in destination:
+    bitshift=0;
+    bitstoget=0;
+    if(DestBuffer->bitIndex!=7)
+        {
+        bitshift = DestBuffer->bitIndex+1;
+        bitstoget = ((BitsToCopy < bitshift) ? BitsToCopy : bitshift); 
+        temp = bibGetBits(bitstoget,SrcBuffer);
+        
+        // update statistics to take care of bit addition or byte completion 
+        if (BitsToCopy < bitshift)
+        {
+            // bits added but byte not completed
+            *(DestStartAddr)=(unsigned char)((((*DestStartAddr)>>bitshift)<<bitshift) |
+                ((temp << (bitshift-BitsToCopy)  ) & msbMask[bitshift-1]));
+            DestBuffer->bitIndex -= BitsToCopy;
+            bibAssert(DestBuffer->bitIndex >= 0)
+        }
+        else
+        {
+            // byte completed
+            *(DestStartAddr)=(unsigned char)((((*DestStartAddr)>>bitshift)<<(bitshift)) | 
+                (temp & msbMask[bitshift-1]));
+            DestStartAddr+=1; 
+            DestBuffer->numBytesRead++;
+            DestBuffer->bitIndex=7;
+        }
+    }
+    
+    //2- Extract all bytes (in 8 bits) from src to destination.
+    //Checks for BytesToCopy. 
+    BytesToCopy=(BitsToCopy-bitstoget)>>3;
+    if ( BytesToCopy > 0 )
+    {
+
+        if ( SrcBuffer->bitIndex == 7 )
+        {
+            // we can copy the data from src in full bytes, utilize faster inline method 
+            // and try to utilize pipelining in the for-loop
+            // truncate it to 4-byte-boundary
+            Bytes4ToCopy = BytesToCopy>>2;
+            for(i=0; i<Bytes4ToCopy; i++)
+            {
+                *(DestStartAddr++) = bibGetAlignedByte(SrcBuffer);
+                *(DestStartAddr++) = bibGetAlignedByte(SrcBuffer);
+                *(DestStartAddr++) = bibGetAlignedByte(SrcBuffer);
+                *(DestStartAddr++) = bibGetAlignedByte(SrcBuffer);
+            }
+            i <<= 2;
+            if ( BytesToCopy > i )
+            {
+                // copy the leftovers
+                for(;i<BytesToCopy;i++)
+                {
+                    *(DestStartAddr++) = bibGetAlignedByte(SrcBuffer);
+                }
+            }
+            SrcBuffer->numBytesRead+=i;
+        }
+        else
+        {
+            for(i=0;i<BytesToCopy;i++)
+            {
+                *(DestStartAddr++) = (unsigned char)bibGetBits(8,SrcBuffer);
+            }
+            
+        }
+    }
+    DestBuffer->numBytesRead+=BytesToCopy;
+    
+    //3- Fill the last byte:
+    BitsRemaining=((BitsToCopy-bitstoget))%8;
+    if(BitsRemaining!=0)
+    {
+        temp = bibGetBits(BitsRemaining,SrcBuffer);
+        *(DestStartAddr++)=(u_char)(temp<<(8-BitsRemaining)); 
+        DestBuffer->bitIndex=7-BitsRemaining;
+    }
+    
+    //5- Update the destbuffer statistics:
+    DestBuffer->getIndex=DestBuffer->numBytesRead;
+}
+
+/*
+*
+* CopyBufferEdit
+*    
+*
+* Function to copy data with editing from SrcBuffer to DestBuffer with settings in edParam
+*    
+*    
+*/
+
+void CopyBufferEdit(bibBuffer_t *SrcBuffer, bibBuffer_t *DestBuffer, 
+                                        bibEditParams_t *edParam, int updateSrcBufferStats)
+{
+    u_char *DestStartAddr;
+    u_int32 i;
+    u_int32 temp;
+    u_int32 BitsToSkip;
+    u_int32 BitsToEdit;
+    u_int32 BytesToSkip;
+    u_int32 BitsRemaining;
+    u_int32 BytesToEdit;
+    unsigned bitshift;
+    unsigned bitstoget;
+    unsigned bitstomove;
+    u_int32 StartBitPosition; 
+    static const u_char msbMask[8] = {1, 3, 7, 15, 31, 63, 127, 255};
+    
+    DestStartAddr = DestBuffer->baseAddr + DestBuffer->getIndex;
+    
+    // evaluate the number of bits to copy
+    BitsToEdit = edParam->newNumBits; 
+    StartBitPosition = edParam->newNumBits-1;
+    
+    //1- Fill the remaining of the byte in destination:
+    bitshift=0;
+    bitstoget=0;
+    if(DestBuffer->bitIndex!=7)
+    {
+        bitshift=DestBuffer->bitIndex+1;
+        bitstoget = ((BitsToEdit < bitshift) ? BitsToEdit : bitshift); 
+        
+        temp = bibGetBitsFromWord(edParam->newValue, bitstoget, &StartBitPosition, 
+            edParam->newNumBits); 
+        
+        // update statistics to take care of bit addition or byte completion 
+        if (BitsToEdit < bitshift)
+        {
+            // bits added but byte not completed
+            *(DestStartAddr)=(unsigned char)((((*DestStartAddr)>>bitshift)<<(bitshift)) |
+                ((temp << (bitshift-BitsToEdit)  ) & msbMask[bitshift-1]));
+            DestBuffer->bitIndex -= BitsToEdit;
+            bibAssert(DestBuffer->bitIndex >= 0)
+        }
+        else
+        {
+            // byte completed
+            *(DestStartAddr)=(unsigned char)((((*DestStartAddr)>>bitshift)<<(bitshift)) | 
+                (temp & msbMask[bitshift-1]));
+            DestStartAddr++; 
+            DestBuffer->numBytesRead++;
+            DestBuffer->bitIndex=7;
+        }
+    }
+    
+    
+    //2- Extract all bytes (in 8 bits) from src to destination.
+    //Checks for BytesToCopy
+    BytesToEdit=(BitsToEdit-bitstoget)>>3;
+    for(i=0;i<BytesToEdit;i++)
+    {
+        *(DestStartAddr++)=(unsigned char)bibGetBitsFromWord(edParam->newValue, 8, &StartBitPosition, edParam->newNumBits);
+    }
+    DestBuffer->numBytesRead+=BytesToEdit;
+    
+    //3- Fill the last byte:
+    BitsRemaining=((BitsToEdit-bitstoget))%8;
+    if(BitsRemaining!=0)
+    {
+        temp = bibGetBitsFromWord(edParam->newValue, BitsRemaining, &StartBitPosition, 
+            edParam->newNumBits); 
+        *(DestStartAddr++)=(u_char)(temp<<(8-BitsRemaining)); 
+        DestBuffer->bitIndex=7-BitsRemaining;
+    }
+    
+    //5- Update the destbuffer statistics:
+    DestBuffer->getIndex=DestBuffer->numBytesRead;
+    
+    
+    // update the src buffer statistics to reflect skipping of the value 
+    if(updateSrcBufferStats)
+    {
+        BitsToSkip = edParam->curNumBits; 
+        bitshift=0;
+        bitstomove=0;
+        if (SrcBuffer->bitIndex!=7)
+        {
+            bitshift=SrcBuffer->bitIndex+1;
+            bitstomove = ((BitsToSkip < bitshift) ? BitsToSkip : bitshift); 
+            // update statistics to take care of bit addition or byte completion 
+            if (BitsToSkip < bitshift)
+            {
+                // bits skipped but byte not completed
+                SrcBuffer->bitIndex -= bitstomove;
+                bibAssert(SrcBuffer->bitIndex >= 0)
+            }
+            else
+            {
+                // byte completed
+                SrcBuffer->numBytesRead++;
+                SrcBuffer->bitIndex=7;
+            }
+        }
+        // full bytes to skip
+        BytesToSkip=(BitsToSkip-bitstomove)>>3;
+        SrcBuffer->numBytesRead+=BytesToSkip;
+        
+        // skip the remaining bits
+        BitsRemaining=((BitsToSkip-bitstomove))%8;
+        if(BitsRemaining!=0)
+        {
+            SrcBuffer->bitIndex=7-BitsRemaining;
+        }
+        SrcBuffer->bitsLeft -= BitsToSkip;
+        SrcBuffer->getIndex=SrcBuffer->numBytesRead;
+    }
+}
+
+void ResetH263IntraDcUV(bibBuffer_t *DestBuffer, int uValue, int vValue)
+{
+    bibEditParams_t edParam;
+
+    edParam.curNumBits = edParam.newNumBits = 8;
+    edParam.StartByteIndex = edParam.StartBitIndex = 0; // used for source buffer only 
+
+  // u
+    edParam.newValue = uValue; 
+    CopyBufferEdit((bibBuffer_t*)NULL, DestBuffer, &edParam, 0); 
+    // v
+    edParam.newValue = vValue; 
+    CopyBufferEdit((bibBuffer_t*)NULL, DestBuffer, &edParam, 0); 
+}
+
+void ResetMPEG4IntraDcUV(bibBuffer_t *DestBuffer, int IntraDC_size)
+{
+    int i;
+    bibEditParams_t edParam;
+    const int DctDcSizeChrominanceNumBits[13] = { 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; 
+
+    // u,v
+    for(i=0; i<2; i++)
+    {
+        // change dct dc size chrominance - IntraDC for U.V is 0 (codeword '11')
+        edParam.curNumBits = DctDcSizeChrominanceNumBits[IntraDC_size]; 
+        edParam.newNumBits = 2;  
+        edParam.StartByteIndex = edParam.StartBitIndex = 0; // used or source buffer only 
+        edParam.newValue = 3; 
+        CopyBufferEdit((bibBuffer_t*)NULL, DestBuffer, &edParam, 0);    
+    }
+}
+
+// assume SrcValue is max 32 bits 
+u_int32 bibGetBitsFromWord(u_int32 SrcValue, u_int32 getBits, u_int32 *StartBit, 
+                                                     u_int32 MaxNumBits)
+{
+    int val;
+    u_int32 bitshift; 
+    static const u_int32 mask[32] = 
+            {0x00000001, 0x00000003, 0x00000007, 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, 
+             0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
+             0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff, 
+             0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff};
+
+    bibAssert(MaxNumBits <= 32);
+    bibAssert(*StartBit < MaxNumBits);
+    bibAssert(getBits-1 <= *StartBit);
+    bibAssert(getBits > 0);
+    
+    bitshift = *StartBit - getBits + 1; 
+    val = (SrcValue>>bitshift) & mask[getBits-1]; 
+    if ( getBits > *StartBit )
+        {
+        // taking the last bits of the word; *StartBit is uint32, so it goes to max uint32 unless this special handling
+        // other cases asserted already above
+        *StartBit = 31;
+        }
+    else
+        {
+        *StartBit -= getBits; 
+        }
+
+    return val;
+}
+
+void bibForwardBits(u_int32 numberOfBits, bibBuffer_t *buffer)
+{
+    u_int32 BitsToForward;
+    u_int32 BytesToForward;
+    u_int32 BitsRemaining;
+    unsigned bitshift;
+    unsigned bitstomove;
+        
+    BitsToForward = numberOfBits; 
+    bitshift=0;
+    bitstomove=0;
+        
+    bibAssert(buffer != NULL);
+        
+        // complete the byte
+    if (buffer->bitIndex!=7)
+    {
+        bitshift=buffer->bitIndex+1;
+        bitstomove = ((BitsToForward < bitshift) ? BitsToForward : bitshift); 
+        // update statistics to take care of bit addition or byte completion 
+        if (BitsToForward < bitshift)
+        {
+            // bits skipped but byte not completed
+            buffer->bitIndex -= bitstomove;
+            bibAssert(buffer->bitIndex >= 0)
+        }
+        else
+        {
+            // byte completed
+            buffer->numBytesRead++;
+            buffer->bitIndex=7;
+        }
+    }
+        // full bytes to skip
+    BytesToForward=(BitsToForward-bitstomove)>>3;
+    buffer->numBytesRead+=BytesToForward;
+        
+        // skip the remaining bits
+    BitsRemaining=((BitsToForward-bitstomove))%8;
+    if(BitsRemaining!=0)
+    {
+        buffer->bitIndex=7-BitsRemaining;
+    }
+    buffer->bitsLeft -= BitsToForward;
+    buffer->getIndex=buffer->numBytesRead;
+}
+
+void bibStuffBits(bibBuffer_t *buffer)
+{
+    // the extra bits are already set to zero 
+    bibAssert(buffer->baseAddr);
+    if(buffer->bitIndex!=7)
+    {
+        buffer->bitIndex=7;
+        buffer->getIndex++;
+        buffer->numBytesRead++;
+    }
+}
+
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/blcllcpy.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1065 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Block copying functions.
+*
+*/
+
+
+
+
+#include "h263dconfig.h"
+
+
+/*
+ *
+ * blcMemSetIncBuf
+ *
+ * Parameters:
+ *    void HUGE *buf    destination buffer
+ *    int ch            input value
+ *    size_t count      the number of values to put into the buffer
+ *
+ * Function:
+ *    This macro sets count bytes of buf into the low-order byte of ch
+ *    and increases buf by count.
+ *
+ * Changes:
+ *    buf
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcMemSetIncBuf(buf, ch, count) \
+   MEMSET(buf, ch, count); \
+   buf += count
+
+
+/*
+ *
+ * blcCopyRowNBC           copy a row without border checking
+ *
+ * Parameters:
+ *    u_char HUGE *srcMem  source row
+ *    u_char HUGE *dstMem  destination row
+ *
+ *    int xlt0             ignored
+ *    int xNormal          See blcCopyBlockBC.
+ *    int xgtmax           ignored
+ *
+ * Function:
+ *    This macro copies a row of pixels and assumes that
+ *       - all pixels are within the image area
+ *       - the pixels are in integer positions
+ *
+ *    dstMem is increased by xNormal
+ *    srcMem is increased by xNormal - 1
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcCopyRowNBC(srcMem, dstMem, xlt0, xNormal, xgtmax, roundIncNotUsed) \
+{ \
+   MEMCPY(dstMem, srcMem, xNormal); \
+   dstMem += xNormal; \
+   srcMem += xNormal - 1; \
+}
+
+
+/*
+ *
+ * blcCopyRowBC            copy a row with border checking
+ *
+ * Parameters:
+ *    u_char HUGE *srcMem  source row
+ *    u_char HUGE *dstMem  destination row
+ *
+ *    int xlt0             See blcCopyBlockBC.
+ *    int xNormal          See blcCopyBlockBC.
+ *    int xgtmax           See blcCopyBlockBC.
+ *
+ * Function:
+ *    This macro copies a row of pixels and assumes that
+ *       - xlt0 pixels are in the left side of the image area and
+ *       - xgtmax pixels are in the right side of the image area and
+ *       - the pixels are in integer positions
+ *
+ *    dstMem is increased by xlt0 + xNormal + xgtmax
+ *    srcMem is increased by xNormal - 1 if xNormal > 0
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcCopyRowBC(srcMem, dstMem, xlt0, xNormal, xgtmax, roundIncNotUsed) \
+{ \
+   if (xlt0) MEMSET(dstMem, *srcMem, xlt0); \
+   dstMem += xlt0; \
+   if (xNormal) blcCopyRowNBC(srcMem, dstMem, xlt0, xNormal, xgtmax, roundIncNotUsed); \
+   if (xgtmax) MEMSET(dstMem, *srcMem, xgtmax); \
+   dstMem += xgtmax; \
+}
+
+
+/*
+ *
+ * blcCopyRowSubXNBC
+ *
+ * Parameters:
+ *    u_char HUGE *srcMem  source row
+ *    u_char HUGE *dstMem  destination row
+ *
+ *    int xlt0             ignored
+ *    int xNormal          See blcCopyBlockBC.
+ *    int xgtmax           ignored
+ *
+ *    roundInc             See blcCopyBlockSub*.
+ *
+ * Function:
+ *    This macro copies a row of pixels and assumes that
+ *       - all pixels are within the image area
+ *       - the pixels are in integer pixel position in vertical direction
+ *       - the pixels are in half pixel position in horizontal direction
+ *
+ *    dstMem is increased by xNormal
+ *    srcMem is increased by xNormal
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *    loopVar
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcCopyRowSubXNBC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, roundInc) \
+for (loopVar = xNormal; loopVar; loopVar--, srcMem++) \
+   *dstMem++ = (u_char) ((*srcMem + *(srcMem + 1) + roundInc) >> 1)
+
+
+/*
+ *
+ * blcCopyRowSubXBC
+ *
+ * Parameters:
+ *    u_char HUGE *srcMem  source row
+ *    u_char HUGE *dstMem  destination row
+ *
+ *    int xlt0             See blcCopyBlockBC.
+ *    int xNormal          See blcCopyBlockBC.
+ *    int xgtmax           See blcCopyBlockBC.
+ *
+ *    roundInc             See blcCopyBlockSub*.
+ *
+ * Function:
+ *    This macro copies a row of pixels and assumes that
+ *       - xlt0 pixels are in the left side of the image area and
+ *       - xgtmax pixels are in the right side of the image area and
+ *       - the pixels are in integer pixel position in vertical direction
+ *       - the pixels are in half pixel position in horizontal direction
+ *
+ *    dstMem is increased by xlt0 + xNormal + xgtmax
+ *    srcMem is increased by xlt0 + xNormal + xgtmax
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *    loopVar
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcCopyRowSubXBC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, roundInc) \
+{ \
+   if (xlt0) \
+      blcMemSetIncBuf(dstMem, *srcMem, xlt0); \
+   blcCopyRowSubXNBC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, roundInc); \
+   if (xgtmax) blcMemSetIncBuf(dstMem, *srcMem, xgtmax); \
+}
+
+
+/*
+ *
+ * blcCopyRowSubYNBC
+ *
+ * Parameters:
+ *    u_char HUGE *srcMem  source row
+ *    u_char HUGE *dstMem  destination row
+ *
+ *    int xlt0             ignored
+ *    int xNormal          See blcCopyBlockBC.
+ *    int xgtmax           ignored
+ *
+ *    roundInc             See blcCopyBlockSub*.
+ *
+ * Function:
+ *    This macro copies a row of pixels and assumes that
+ *       - all pixels are within the image area
+ *       - the pixels are in half pixel position in vertical direction
+ *       - the pixels are in integer pixel position in horizontal direction
+ *
+ *    dstMem is increased by xNormal
+ *    srcMem is increased by xNormal - 1 if xNormal > 0
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *    loopVar
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcCopyRowSubYNBC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, \
+   srcXSize, roundInc) \
+{ \
+   for (loopVar = xNormal; loopVar; loopVar--, srcMem++) \
+      *dstMem++ = (u_char) ((*srcMem + *(srcMem + srcXSize) + roundInc) >> 1); \
+   if (xNormal) srcMem--; \
+}
+
+
+/*
+ *
+ * blcCopyRowSubYBC
+ *
+ * Parameters:
+ *    u_char HUGE *srcMem  source row
+ *    u_char HUGE *dstMem  destination row
+ *
+ *    int xlt0             See blcCopyBlockBC.
+ *    int xNormal          See blcCopyBlockBC.
+ *    int xgtmax           See blcCopyBlockBC.
+ *
+ *    roundInc             See blcCopyBlockSub*.
+ *
+ * Function:
+ *    This macro copies a row of pixels and assumes that
+ *       - xlt0 pixels are in the left side of the image area and
+ *       - xgtmax pixels are in the right side of the image area and
+ *       - the pixels are in half pixel position in vertical direction
+ *       - the pixels are in integer pixel position in horizontal direction
+ *
+ *    dstMem is increased by xlt0 + xNormal + xgtmax
+ *    srcMem is increased by xNormal - 1 if xNormal > 0
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *    loopVar
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcCopyRowSubYBC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, \
+   srcXSize, roundInc) \
+{ \
+   if (xlt0) { \
+      *dstMem++ = (u_char) ((*srcMem + *(srcMem + srcXSize) + roundInc) >> 1); \
+      if (xlt0 > 1) blcMemSetIncBuf(dstMem, *(dstMem - 1), xlt0 - 1); \
+   } \
+   blcCopyRowSubYNBC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, \
+      srcXSize, roundInc); \
+   if (xgtmax) { \
+      if (xNormal) { \
+         blcMemSetIncBuf(dstMem, *(dstMem - 1), xgtmax); \
+      } \
+      else { \
+         *dstMem++ = (u_char) ((*srcMem + *(srcMem + srcXSize) + roundInc) >> 1); \
+         if (xgtmax > 1) blcMemSetIncBuf(dstMem, *(dstMem - 1), xgtmax - 1); \
+      } \
+   } \
+}
+
+
+/*
+ *
+ * blcCopyRowSubXYNBC
+ *
+ * Parameters:
+ *    u_char HUGE *srcMem  source row
+ *    u_char HUGE *dstMem  destination row
+ *
+ *    int xlt0             ignored
+ *    int xNormal          See blcCopyBlockBC.
+ *    int xgtmax           ignored
+ *
+ *    roundInc             See blcCopyBlockSub*.
+ *
+ * Function:
+ *    This macro copies a row of pixels and assumes that
+ *       - all pixels are within the image area
+ *       - the pixels are in half pixel position in vertical direction
+ *       - the pixels are in half pixel position in horizontal direction
+ *
+ *    dstMem is increased by xNormal
+ *    srcMem is increased by xNormal
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *    loopVar
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcCopyRowSubXYNBC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, \
+   srcXSize, roundInc) \
+for (loopVar = xNormal; loopVar; loopVar--, srcMem++) \
+   *dstMem++ = (u_char) ((*srcMem + *(srcMem + 1) + *(srcMem + srcXSize) + \
+      *(srcMem + srcXSize + 1) + roundInc) >> 2)
+
+
+/*
+ *
+ * blcCopyOutPicXPixelSubXYRoundInc1
+ * blcCopyOutPicXPixelSubXYRoundInc2
+ *
+ * Parameters:
+ *    u_char HUGE *srcMem  source row
+ *    u_char HUGE *dstMem  destination row
+ *    srcXSize             number of pixels (bytes) in source row
+ *
+ * Function:
+ *    These macros copy one pixel which lies horizontally outside the picture
+ *    area assuming that
+ *       - the pixels are in half pixel position in vertical direction
+ *       - the pixels are in half pixel position in horizontal direction
+ *
+ *    If roundInc is 2, the macro takes advantage of the fact that
+ *       (A + B + C + D + roundInc) / 4 = (A + A + C + C + 2) / 4 = 
+ *       (A + C + 1) / 2
+ *    when using the notation of section 6.1.2 of the H.263 recommendation.
+ *
+ *    dstMem is increased by 1
+ *
+ * Changes:
+ *    dstMem
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcCopyOutPicXPixelSubXYRoundInc2(srcMem, dstMem, srcXSize) \
+   *dstMem++ = (u_char) ((*srcMem + *(srcMem + srcXSize) + 1) >> 1)
+
+#define blcCopyOutPicXPixelSubXYRoundInc1(srcMem, dstMem, srcXSize) \
+   *dstMem++ = (u_char) ((((*srcMem) << 1) + ((*(srcMem + srcXSize)) << 1) + 1) >> 2)
+
+
+/*
+ *
+ * blcCopyRowSubXYBC
+ *
+ * Parameters:
+ *    u_char HUGE *srcMem  source row
+ *    u_char HUGE *dstMem  destination row
+ *
+ *    int xlt0             ignored
+ *    int xNormal          See blcCopyBlockBC.
+ *    int xgtmax           ignored
+ *
+ *    roundInc             See blcCopyBlockSub*.
+ *
+ * Function:
+ *    This macro copies a row of pixels and assumes that
+ *       - xlt0 pixels are in the left side of the image area and
+ *       - xgtmax pixels are in the right side of the image area and
+ *       - the pixels are in half pixel position in vertical direction
+ *       - the pixels are in half pixel position in horizontal direction
+ *
+ *    dstMem is increased by xNormal
+ *    srcMem is increased by xNormal
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *    loopVar
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcCopyRowSubXYBC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, \
+   srcXSize, roundInc) \
+{ \
+   if (xlt0) { \
+      blcCopyOutPicXPixelSubXYRoundInc ## roundInc(srcMem, dstMem, srcXSize); \
+      if (xlt0 > 1) blcMemSetIncBuf(dstMem, *(dstMem - 1), xlt0 - 1); \
+   } \
+   blcCopyRowSubXYNBC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, \
+      srcXSize, roundInc); \
+   if (xgtmax) { \
+      blcCopyOutPicXPixelSubXYRoundInc ## roundInc(srcMem, dstMem, srcXSize); \
+      if (xgtmax > 1) blcMemSetIncBuf(dstMem, *(dstMem - 1), xgtmax - 1); \
+   } \
+}
+
+
+/*
+ *
+ * blcCopyOutPicRowSubXYRoundInc1
+ * blcCopyOutPicRowSubXYRoundInc2
+ *
+ * Parameters:
+ *    u_char HUGE *srcMem  source row
+ *    u_char HUGE *dstMem  destination row
+ *    srcXSize             number of pixels (bytes) in source row
+ *
+ * Function:
+ *    These macros copy one row which lies vertically outside the picture
+ *    area assuming that
+ *       - the pixels are in half pixel position in vertical direction
+ *       - the pixels are in half pixel position in horizontal direction
+ *
+ *    If roundInc is 2, the macro takes advantage of the fact that
+ *       (A + B + C + D + roundInc) / 4 = (A + A + B + B + 2) / 4 = 
+ *       (A + B + 1) / 2
+ *    when using the notation of section 6.1.2 of the H.263 recommendation.
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *    loopVar
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcCopyOutPicRowSubXYRoundInc2(borderCheck, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, loopVar, srcXSize) \
+   blcCopyRowSubX ## borderCheck(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, 1)
+
+#define blcCopyOutPicRowSubXYRoundInc1NBC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, srcXSize) \
+   for (loopVar = xNormal; loopVar; loopVar--, srcMem++) \
+      *dstMem++ = (u_char) ((((*srcMem) << 1) + ((*(srcMem + 1)) << 1) + 1) >> 2)
+
+#define blcCopyOutPicRowSubXYRoundInc1BC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, srcXSize) \
+{ \
+   if (xlt0) {\
+      blcMemSetIncBuf(dstMem, *(srcMem), xlt0); \
+   } \
+   blcCopyOutPicRowSubXYRoundInc1NBC(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar, srcXSize); \
+   if (xgtmax) { \
+      blcMemSetIncBuf(dstMem, *(srcMem), xgtmax); \
+   } \
+}
+
+#define blcCopyOutPicRowSubXYRoundInc1(borderCheck, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, loopVar, srcXSize) \
+   blcCopyOutPicRowSubXYRoundInc1 ## borderCheck(srcMem, dstMem, \
+      xlt0, xNormal, xgtmax, loopVar, srcXSize)
+
+
+/*
+ *
+ * Integer pixel position (x and y picture boundary checks respectively):
+ *    blcCopyBlockNoSubNBCBC
+ *    blcCopyBlockNoSubBCNBC
+ *    blcCopyBlockNoSubNBCNBC
+ *    blcCopyBlockNoSubBCBC
+ *
+ * Half pixel position in horizontal direction:
+ *    blcCopyBlockSubXNBC
+ *    blcCopyBlockSubXBC
+ *
+ * Half pixel position in vertical direction:
+ *    blcCopyBlockSubYNBC
+ *    blcCopyBlockSubYBC
+ *
+ * Half pixel position in horizontal and vertical direction:
+ *    blcCopyBlockSubXYNBC
+ *    blcCopyBlockSubXYBC
+ *
+ * NBC means that all pixels are within the vertical range of the image area.
+ * BC means that ylt0 pixels are above the image area and ygtmax pixels are
+ * below the image area.
+ *
+ * Parameters:
+ *    Note that some parameters are not included into every macro.
+ *
+ *    routineName          corresponding row copying macro name
+ *
+ *    u_char HUGE *srcMem  source block
+ *    u_char HUGE *dstMem  destination block
+ *
+ *    int xlt0             See blcCopyBlockBC.
+ *    int xNormal          See blcCopyBlockBC.
+ *    int xgtmax           See blcCopyBlockBC.
+ *
+ *    int ylt0             See blcCopyBlockBC.
+ *    int yNormal          See blcCopyBlockBC.
+ *    int ygtmax           See blcCopyBlockBC.
+ *
+ *    loopVar1, loopVar2   loop variables
+ *
+ *    srcXSize             the horizontal size of the source image
+ *    dstXSize             the horizontal size of the destination image
+ *    blkXSize             the horizontal size of the block to be copied,
+ *                         should be equal to xlt0 + xNormal + xgtmax
+ *
+ *    srcInc               increment to srcMem (after row copying)
+ *                         to get the next row
+ *    dstInc               increment to dstMem (after row copying)
+ *                         to get the next row
+ *
+ *    roundInc             for subpixel functions only:
+ *                         for interpolation in X or Y  directions:
+ *                            roundInc = 1 - RCONTROL, i.e.
+ *                            1 if RCONTROL == 0,
+ *                            0 if RCONTROL == 1,
+ *                         for interpolation in X and Y directions:
+ *                            roundInc = 2 - RCONTROL, i.e.
+ *                            2 if RCONTROL == 0,
+ *                            1 if RCONTROL == 1
+ *
+ * Function:
+ *    These macros copy a block of pixels.
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *    loopVar1
+ *    loopVar2
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+
+#define blcCopyBlockNoSubNBC(routineName, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+   loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc) \
+for (loopVar1 = yNormal; loopVar1; loopVar1--) { \
+   routineName(srcMem, dstMem, xlt0, xNormal, xgtmax, 0); \
+   srcMem += srcInc; \
+   dstMem += dstInc; \
+}
+
+#define blcCopyBlockNoSubNBCBC(routineName, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+   loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc) \
+blcCopyBlockNoSubNBC(routineName, srcMem, dstMem, xlt0, xNormal, xgtmax, \
+   ylt0, yNormal, ygtmax, loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, \
+   srcInc, dstInc)
+
+#define blcCopyBlockNoSubBCNBC(routineName, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+   loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc) \
+{ \
+   if (ylt0) { \
+      for (loopVar2 = ylt0; loopVar2; loopVar2--, dstMem += dstXSize) \
+         MEMCPY(dstMem, srcMem, blkXSize); \
+   } \
+\
+   blcCopyBlockNoSubNBC(routineName, srcMem, dstMem, \
+      xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+      loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc); \
+\
+   if (ygtmax) { \
+      if (yNormal) srcMem -= srcXSize; \
+      for (loopVar2 = ygtmax; loopVar2; loopVar2--, dstMem += dstXSize) \
+         MEMCPY(dstMem, srcMem, blkXSize); \
+   } \
+}
+
+#define blcCopyBlockNoSubNBCNBC(routineName, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+   loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc) \
+for (loopVar1 = yNormal; loopVar1; loopVar1--) { \
+   MEMCPY(dstMem, srcMem, xNormal); \
+   dstMem += dstXSize; \
+   srcMem += srcXSize; \
+}
+   
+#define blcCopyBlockNoSubBCBC(routineName, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+   loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc) \
+{ \
+   if (ylt0) { \
+      routineName(srcMem, dstMem, xlt0, xNormal, xgtmax, 0); \
+      dstMem += dstInc; \
+      for (loopVar2 = ylt0 - 1; loopVar2; loopVar2--, dstMem += dstXSize) \
+         MEMCPY(dstMem, dstMem - dstXSize, blkXSize); \
+      if (xNormal) srcMem -= (xNormal - 1); \
+   } \
+\
+   blcCopyBlockNoSubNBC(routineName, srcMem, dstMem, \
+      xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+      loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc); \
+\
+   if (ygtmax) { \
+      if (yNormal) srcMem -= srcXSize; \
+      routineName(srcMem, dstMem, xlt0, xNormal, xgtmax, 0); \
+      dstMem += dstInc; \
+      for (loopVar2 = ygtmax - 1; loopVar2; loopVar2--, dstMem += dstXSize) \
+         MEMCPY(dstMem, dstMem - dstXSize, blkXSize); \
+   } \
+}
+
+#define blcCopyBlockSubXNBC(routineName, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+   loopVar1, loopVar2, dstXSize, blkXSize, srcInc, dstInc, roundInc) \
+for (loopVar1 = yNormal; loopVar1; loopVar1--) { \
+   routineName(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar2, roundInc); \
+   srcMem += srcInc; \
+   dstMem += dstInc; \
+}
+
+#define blcCopyBlockSubXBC(routineName, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+   loopVar1, loopVar2, dstXSize, blkXSize, srcInc, dstInc, roundInc) \
+{ \
+   if (ylt0) { \
+      routineName(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar2, roundInc); \
+      dstMem += dstInc; \
+      for (loopVar2 = ylt0 - 1; loopVar2; loopVar2--, dstMem += dstXSize) \
+         MEMCPY(dstMem, dstMem - dstXSize, blkXSize); \
+      srcMem -= xNormal; \
+   } \
+\
+   blcCopyBlockSubXNBC(routineName, srcMem, dstMem, xlt0, xNormal, xgtmax, \
+      ylt0, yNormal, ygtmax, loopVar1, loopVar2, dstXSize, blkXSize, \
+      srcInc, dstInc, roundInc); \
+\
+   if (ygtmax) { \
+      if (!yNormal) { \
+         routineName(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar2, roundInc); \
+         dstMem += dstInc; \
+      } \
+      for (loopVar2 = ygtmax - !yNormal; loopVar2; loopVar2--, \
+         dstMem += dstXSize) \
+         MEMCPY(dstMem, dstMem - dstXSize, blkXSize); \
+   } \
+}
+
+#define blcCopyBlockSubYNBC(routineName, yoffRoutine, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+   loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc, roundInc) \
+for (loopVar1 = yNormal; loopVar1; loopVar1--) { \
+   routineName(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar2, srcXSize, roundInc); \
+   srcMem += srcInc; \
+   dstMem += dstInc; \
+} \
+
+#define blcCopyBlockSubYBC(normRoutine, yoffRoutine, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+   loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc, roundInc) \
+{ \
+   if (ylt0) { \
+      yoffRoutine(srcMem, dstMem, xlt0, xNormal, xgtmax, roundInc); \
+      dstMem += dstInc; \
+      for (loopVar2 = ylt0 - 1; loopVar2; loopVar2--, dstMem += dstXSize) \
+         MEMCPY(dstMem, dstMem - dstXSize, blkXSize); \
+      if (xNormal) srcMem -= (xNormal - 1); \
+   } \
+\
+   blcCopyBlockSubYNBC(normRoutine, yoffRoutine, srcMem, dstMem, \
+      xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+      loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc, roundInc); \
+\
+   if (ygtmax) { \
+      yoffRoutine(srcMem, dstMem, xlt0, xNormal, xgtmax, roundInc); \
+      dstMem += dstInc; \
+      for (loopVar2 = ygtmax - 1; loopVar2; loopVar2--, dstMem += dstXSize) \
+         MEMCPY(dstMem, dstMem - dstXSize, blkXSize); \
+   } \
+}
+
+#define blcCopyBlockSubXYNBC(routineName, notUsed, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+   loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc, roundInc) \
+for (loopVar1 = yNormal; loopVar1; loopVar1--) { \
+   routineName(srcMem, dstMem, xlt0, xNormal, xgtmax, loopVar2, \
+      srcXSize, roundInc); \
+   srcMem += srcInc; \
+   dstMem += dstInc; \
+} \
+
+#define blcCopyBlockSubXYBC(normRoutine, xoffBorderCheck, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+   loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc, roundInc) \
+{ \
+   if (ylt0) { \
+      blcCopyOutPicRowSubXYRoundInc ## roundInc(xoffBorderCheck, srcMem, dstMem, \
+         xlt0, xNormal, xgtmax, loopVar2, srcXSize); \
+      dstMem += dstInc; \
+      for (loopVar2 = ylt0 - 1; loopVar2; loopVar2--, dstMem += dstXSize) \
+         MEMCPY(dstMem, dstMem - dstXSize, blkXSize); \
+      srcMem -= xNormal; \
+   } \
+\
+   blcCopyBlockSubXYNBC(normRoutine, yoffRoutine, srcMem, dstMem, \
+      xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+      loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc, roundInc); \
+\
+   if (ygtmax) { \
+      blcCopyOutPicRowSubXYRoundInc ## roundInc(xoffBorderCheck, srcMem, dstMem, \
+         xlt0, xNormal, xgtmax, loopVar2, srcXSize); \
+      dstMem += dstInc; \
+      for (loopVar2 = ygtmax - 1; loopVar2; loopVar2--, dstMem += dstXSize) \
+         MEMCPY(dstMem, dstMem - dstXSize, blkXSize); \
+   } \
+}
+
+
+/*
+ *
+ * blcCopyBlockBCVar
+ *
+ * Parameters:
+ *    xoffBorderCheck      NBC if all the pixels of the block are within
+ *                         the horizontal range of the image area
+ *                         BC otherwise
+ *    yoffBorderCheck      NBC if all the pixels of the block are within
+ *                         the vertical range of the image area
+ *                         BC otherwise
+ *
+ *    u_char HUGE *srcMem  source block
+ *    u_char HUGE *dstMem  destination block
+ *
+ *    int xlt0             See blcCopyBlockBC.
+ *    int xNormal          See blcCopyBlockBC.
+ *    int xgtmax           See blcCopyBlockBC.
+ *    int ylt0             See blcCopyBlockBC.
+ *    int yNormal          See blcCopyBlockBC.
+ *    int ygtmax           See blcCopyBlockBC.
+ *    int subpixelX        See blcCopyBlockBC.
+ *    int subpixelY        See blcCopyBlockBC.
+ *
+ *    loopVar1, loopVar2   loop variables
+ *
+ *    srcXSize             the horizontal size of the source image
+ *    dstXSize             the horizontal size of the destination image
+ *
+ *    blkXSize             the horizontal size of the block to be copied,
+ *                         should be equal to xlt0 + xNormal + xgtmax
+ *    blkYSize             the vertical size of the block to be copied,
+ *                         should be equal to ylt0 + yNormal + ygtmax
+ *
+ *    dstInc               increment to dstMem (after row copying)
+ *                         to get the next row
+ *
+ *    rcontrol             See blcCopyBlockBC.
+ *
+ * Function:
+ *    This macro copies a block with appropriate image border crossing
+ *    checkings.
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *    loopVar1
+ *    loopVar2
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+#define blcCopyBlockBCVar(xoffBorderCheck, yoffBorderCheck, srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY, \
+   loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, blkYSize, dstInc, \
+   rcontrol) \
+{ \
+   if (subpixelX) { \
+      if (subpixelY) { \
+         int srcInc = srcXSize - xNormal; \
+         if (rcontrol) { \
+            blcCopyBlockSubXY ## yoffBorderCheck( \
+               blcCopyRowSubXY ## xoffBorderCheck, \
+               xoffBorderCheck, srcMem, \
+               dstMem, xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+               loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc, 1); \
+         } \
+         else { \
+            blcCopyBlockSubXY ## yoffBorderCheck( \
+               blcCopyRowSubXY ## xoffBorderCheck, \
+               xoffBorderCheck, srcMem, \
+               dstMem, xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+               loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc, 2); \
+         } \
+      } \
+      else /* !subPixelY */ { \
+         int srcInc = srcXSize - xNormal; \
+         if (rcontrol) { \
+            blcCopyBlockSubX ## yoffBorderCheck( \
+               blcCopyRowSubX ## xoffBorderCheck, srcMem, dstMem, \
+               xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+               loopVar1, loopVar2, dstXSize, blkXSize, srcInc, dstInc, 0) \
+         } \
+         else { \
+            blcCopyBlockSubX ## yoffBorderCheck( \
+               blcCopyRowSubX ## xoffBorderCheck, srcMem, dstMem, \
+               xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+               loopVar1, loopVar2, dstXSize, blkXSize, srcInc, dstInc, 1) \
+         } \
+      } \
+   } \
+\
+   else /* !subpixelX */ { \
+      if (subpixelY) { \
+         int srcInc = srcXSize - xNormal + ((xNormal) ? 1 : 0); \
+         if (rcontrol) { \
+            blcCopyBlockSubY ## yoffBorderCheck( \
+               blcCopyRowSubY ## xoffBorderCheck, \
+               blcCopyRow ## yoffBorderCheck, srcMem, dstMem, \
+               xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+               loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc, 0); \
+         } \
+         else { \
+            blcCopyBlockSubY ## yoffBorderCheck( \
+               blcCopyRowSubY ## xoffBorderCheck, \
+               blcCopyRow ## yoffBorderCheck, srcMem, dstMem, \
+               xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+               loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc, 1); \
+         } \
+      } \
+      else /* !subpixelY */ { \
+         int srcInc = srcXSize - xNormal + ((xNormal) ? 1 : 0); \
+         blcCopyBlockNoSub ## yoffBorderCheck ## xoffBorderCheck ( \
+            blcCopyRow ## xoffBorderCheck, srcMem, dstMem, \
+            xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, \
+            loopVar1, loopVar2, srcXSize, dstXSize, blkXSize, srcInc, dstInc); \
+      } \
+   } \
+}
+
+
+/*
+ *
+ * blcCopyBlockBC
+ * blcCopyBlockNBC
+ *
+ * Parameters:
+ *    u_char HUGE *srcMem  source block
+ *    u_char HUGE *dstMem  destination block
+ *
+ *    The next parameters describe a row of source pixels.
+ *    int xlt0             the number of the source pixels in the left of
+ *                         the image area
+ *    int xNormal          the number of the source pixels within the image
+ *                         area
+ *    int xgtmax           the number of the source pixels in the right of
+ *                         the image area
+ *
+ *    The next parameters describe a column of source pixels.
+ *    int ylt0             the number of the source pixels above the image area
+ *    int yNormal          the number of the source pixels withing the image
+ *                         area
+ *    int ygtmax           the number of the source pixels below the image area
+ *
+ *    int subpixelX        1 if source pixels are in half pixel position in
+ *                         horizontal direction, 0 otherwise
+ *    int subpixelY        1 if source pixels are in half pixel position in
+ *                         vertical direction, 0 otherwise
+ *
+ *    srcXSize             the horizontal size of the source image
+ *    dstXSize             the horizontal size of the destination image
+ *
+ *    blkXSize             the horizontal size of the block to be copied,
+ *                         should be equal to xlt0 + xNormal + xgtmax
+ *    blkYSize             the vertical size of the block to be copied,
+ *                         should be equal to ylt0 + yNormal + ygtmax
+ *    rcontrol             0 or 1, RCONTROL as in section 6.1.2. of H.263 
+ *                         version 2
+ *
+ * Function:
+ *    blcCopyBlockBC macro copies a block according to unrestricted motion
+ *    vector mode, i.e. it checks if the motion vector points outside the
+ *    image area, i.e. xlt0, xgtmax, ylt0 or ygtmax != 0.
+ *    blcCopyBlockNBC macro copies a block assuming that the whole block is
+ *    inside the image area. blcCopyBlockNBC is used in normal prediction
+ *    mode (no options are used).
+ *
+ * Changes:
+ *    srcMem
+ *    dstMem
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+/*#define BLC_COPY_BLOCK_MACROS*/
+#ifdef BLC_COPY_BLOCK_MACROS
+#define blcCopyBlockBC(srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY, \
+   srcXSize, dstXSize, blkXSize, blkYSize, rcontrol) \
+{ \
+   int \
+      dstInc = dstXSize - blkXSize, \
+      i, j; \
+\
+   if (xNormal == blkXSize) { \
+      if (yNormal == blkYSize) { \
+         blcCopyBlockBCVar(NBC, NBC, srcMem, dstMem, \
+            xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY, \
+            j, i, srcXSize, dstXSize, blkXSize, blkYSize, dstInc, rcontrol); \
+      } \
+      else { \
+         blcCopyBlockBCVar(NBC, BC, srcMem, dstMem, \
+            xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY, \
+            j, i, srcXSize, dstXSize, blkXSize, blkYSize, dstInc, rcontrol); \
+      } \
+   } \
+   else { \
+      if (yNormal == blkYSize) { \
+         blcCopyBlockBCVar(BC, NBC, srcMem, dstMem, \
+            xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY, \
+            j, i, srcXSize, dstXSize, blkXSize, blkYSize, dstInc, rcontrol); \
+      } \
+      else { \
+         blcCopyBlockBCVar(BC, BC, srcMem, dstMem, \
+            xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY, \
+            j, i, srcXSize, dstXSize, blkXSize, blkYSize, dstInc, rcontrol); \
+      } \
+   } \
+}
+
+#define blcCopyBlockNBC(srcMem, dstMem, \
+   xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY, \
+   srcXSize, dstXSize, blkXSize, blkYSize, rcontrol) \
+{ \
+   int \
+      dstInc = dstXSize - blkXSize, \
+      i, j; \
+\
+   blcCopyBlockBCVar(NBC, NBC, srcMem, dstMem, \
+      xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY, \
+      j, i, srcXSize, dstXSize, blkXSize, blkYSize, dstInc, rcontrol); \
+}
+
+#else
+static void blcCopyBlockBC(u_char HUGE *srcMem, u_char HUGE *dstMem,
+   int xlt0, int xNormal, int xgtmax, int ylt0, int yNormal, int ygtmax,
+   int subpixelX, int subpixelY,
+   int srcXSize, int dstXSize, int blkXSize, int blkYSize, int rcontrol)
+{
+   int
+      dstInc = dstXSize - blkXSize,
+      i, j;
+
+   if (xNormal == blkXSize) {
+      if (yNormal == blkYSize) {
+         blcCopyBlockBCVar(NBC, NBC, srcMem, dstMem,
+            xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY,
+            j, i, srcXSize, dstXSize, blkXSize, blkYSize, dstInc, rcontrol);
+      }
+      else {
+         blcCopyBlockBCVar(NBC, BC, srcMem, dstMem,
+            xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY,
+            j, i, srcXSize, dstXSize, blkXSize, blkYSize, dstInc, rcontrol);
+      }
+   }
+   else {
+      if (yNormal == blkYSize) {
+         blcCopyBlockBCVar(BC, NBC, srcMem, dstMem,
+            xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY,
+            j, i, srcXSize, dstXSize, blkXSize, blkYSize, dstInc, rcontrol);
+      }
+      else {
+         blcCopyBlockBCVar(BC, BC, srcMem, dstMem,
+            xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY,
+            j, i, srcXSize, dstXSize, blkXSize, blkYSize, dstInc, rcontrol);
+      }
+   }
+}
+
+static void blcCopyBlockNBC(u_char HUGE *srcMem, u_char HUGE *dstMem,
+   int xlt0, int xNormal, int xgtmax, int ylt0, int yNormal, int ygtmax,
+   int subpixelX, int subpixelY,
+   int srcXSize, int dstXSize, int blkXSize, int blkYSize, int rcontrol)
+{
+   int
+      dstInc = dstXSize - blkXSize,
+      i, j;
+
+   blcCopyBlockBCVar(NBC, NBC, srcMem, dstMem,
+      xlt0, xNormal, xgtmax, ylt0, yNormal, ygtmax, subpixelX, subpixelY,
+      j, i, srcXSize, dstXSize, blkXSize, blkYSize, dstInc, rcontrol);
+}
+#endif
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/block.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1094 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Motion compensation functions.
+*
+*/
+
+
+#include "h263dConfig.h"
+
+#include "block.h"
+
+#include "errcodes.h"
+#include "vdcmvc.h"
+#include "debug.h"
+
+#ifndef blcAssert
+   #define blcAssert assert
+#endif
+#include "blcllcpy.cpp"
+
+/* See the description above. */
+typedef void (* blcCopyBlock_t) (u_char *, u_char *,
+    int, int, int, int, int, int, int, int, int, int, int, int, int);
+
+/* This structure is used to pass a pointer either to blcUVCountRefXY1MV or
+   blcUVCountRefXY4MVs. */
+typedef void (* blcUVCountRefXY_t) 
+   (int, int, int *, int *, int *, int *, int *, int *);
+
+
+/*
+ * Local function prototypes
+ */
+
+static int blcCopyNormalYPredictionMBWith1MV(
+   blcCopyBlock_t copyBlock,
+   int *mvxArray, int *mvyArray, 
+   u_char *dstYBlk,
+   u_char *srcYFrame,
+   int dstYXPos, int dstYYPos, 
+   int dstYXSize,
+   int srcYXSize, int srcYYSize,
+   int fMVsOverPictureBoundaries, 
+   int rcontrol);
+
+static int blcCopyNormalYPredictionMBWith4MVs(
+   blcCopyBlock_t copyBlock,
+   int *mvxArray, int *mvyArray, 
+   u_char *dstYBlk,
+   u_char *srcYFrame,
+   int dstYXPos, int dstYYPos, 
+   int dstYXSize,
+   int srcYXSize, int srcYYSize,
+   int fMVsOverPictureBoundaries, 
+   int rcontrol);
+
+static int blcCopyUVPredictionBlocks(
+   blcUVCountRefXY_t uvCountSourceXY,
+   blcCopyBlock_t copyBlock,
+   int *mvxArray, int *mvyArray, 
+   u_char *dstUBlk, u_char *dstVBlk,
+   u_char *srcUFrame, u_char *srcVFrame, 
+   int dstUVXPos, int dstUVYPos, 
+   int dstUVXSize,
+   int srcUVXSize, int srcUVYSize,
+   int fMVsOverPictureBoundaries, 
+   int rcontrol);
+
+static void blcHandleRefOverPictBoundariesBC(
+   int xBlkSize, int yBlkSize,
+   int xSize, int ySize, 
+   int subpixelX, int subpixelY, 
+   int *sourceX, int *sourceY,
+   int *xlt0, int *xNormal, int *xgtmax, 
+   int *ylt0, int *yNormal, int *ygtmax);
+
+static int blcIsRefOverPictBoundaries(
+   int xBlkSize, int yBlkSize,
+   int xSize, int ySize, 
+   int subpixelX, int subpixelY, 
+   int sourceX, int sourceY);
+
+static void blcUVCountMVOffset4MVs(
+   int *mvxArray, int *mvyArray,
+   int *offsetX, int *offsetY,
+   int *subpixelX, int *subpixelY);
+
+static void blcUVCountRefXY1MV(
+   int origoX, int origoY,
+   int *mvxArray, int *mvyArray, 
+   int *sourceX, int *sourceY,
+   int *subpixelX, int *subpixelY);
+
+static void blcUVCountRefXY4MVs(
+   int origoX, int origoY,
+   int *mvxArray, int *mvyArray, 
+   int *sourceX, int *sourceY,
+   int *subpixelX, int *subpixelY);
+
+static void blcYCountRefXY(
+   int mvxVal, int mvyVal,
+   int destX, int destY, 
+   int *sourceX, int *sourceY,
+   int *subpixelX, int *subpixelY);
+
+
+/*
+ * Module-scope constants
+ */
+
+/* Clipping table to sature values to range 0..255 */
+static const u_char wholeClippingTable[4*256] = {
+        0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+        0,   0,   0,   0,   0,   0,   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, 209, 210, 211, 212, 213, 214,
+      215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+      225, 226, 227, 228, 229, 230, 231, 232, 233, 234,
+      235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
+      245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+      255, 255, 255, 255, 255, 255, 255};
+
+static const u_char * const clippingTable = &wholeClippingTable[512];
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"blcAddBlock.txt"}} */
+/*
+ * blcAddBlock
+ *    
+ *
+ * Parameters:
+ *    block                block array (of 64 pixels)
+ *    dstBlk               pointer to present frame in the place,
+ *                         where the block is added
+ *    xSize                X size of the frame.
+ *    mbPlace              flag that indicates the place for the current
+ *                         macroblock inside the macroblock row:
+ *                            -1 beginning of row
+ *                             0 middle of row
+ *                             1 end of row
+ *    fourMVs              1 if Advanced Prediction Mode is used, otherwise 0
+ *    prevDiffBlock        if fourMVs == 1 and mbPlace <= 0 the difference
+ *                         block is stored to prevDiffBlock for later use
+ *
+ * Function:
+ *    This function sums the given block into block being currently decoded in
+ *    present frame. Parameters are the table consisting a block, a pointer to
+ *    the frame at the correct place and the width of the frame.
+ *
+ * Returns:
+ *    Nothing.
+ *
+ */
+
+void blcAddBlock(int *block, u_char *dstBlk, int xSize,
+   int mbPlace, u_char fourMVs, int *prevDiffBlock)
+/* {{-output"blcAddBlock.txt"}} */
+{
+   int i;
+
+   if (fourMVs && mbPlace <= 0) {
+       MEMCPY(prevDiffBlock, block, 64 * sizeof(int));
+   }
+   else {
+      for(i = 8; i; i--) {
+         *dstBlk++ = clippingTable[*dstBlk + *block++];
+         *dstBlk++ = clippingTable[*dstBlk + *block++];
+         *dstBlk++ = clippingTable[*dstBlk + *block++];
+         *dstBlk++ = clippingTable[*dstBlk + *block++];
+         *dstBlk++ = clippingTable[*dstBlk + *block++];
+         *dstBlk++ = clippingTable[*dstBlk + *block++];
+         *dstBlk++ = clippingTable[*dstBlk + *block++];
+         *dstBlk++ = clippingTable[*dstBlk + *block++];
+         dstBlk += xSize - 8;
+      }
+   }
+}
+
+
+/* {{-output"blcBlockToFrame.txt"}} */
+/*
+ * blcBlockToFrame
+ *    
+ *
+ * Parameters:
+ *    block        block array (of 64 pixels)
+ *    dstBlk       pointer to present frame in the place, where the block is
+ *                 written
+ *    xSize        X size of the frame.
+ *
+ * Function:
+ *    This function writes the given block into block being currently decoded
+ *    in present frame. Parameters are the table consisting a block, a pointer
+ *    to the frame at the correct place and the width of the frame.
+ *
+ * Returns:
+ *      Nothing.
+ *
+ */
+
+void blcBlockToFrame(int *block, u_char *dstBlk, int xSize)
+/* {{-output"blcBlockToFrame.txt"}} */
+{
+   int i;
+
+   for( i = 0; i < 8; i++ )
+   {
+     *dstBlk = clippingTable[ *block ];
+     *(dstBlk+1) = clippingTable[ *(block+1) ];
+     *(dstBlk+2) = clippingTable[ *(block+2) ];
+     *(dstBlk+3) = clippingTable[ *(block+3) ];
+     *(dstBlk+4) = clippingTable[ *(block+4) ];
+     *(dstBlk+5) = clippingTable[ *(block+5) ];
+     *(dstBlk+6) = clippingTable[ *(block+6) ];
+     *(dstBlk+7) = clippingTable[ *(block+7) ];
+     dstBlk += xSize;
+     block += 8;
+   }
+}
+
+
+/* {{-output"blcCopyPredictionMB.txt"}} */
+/*
+ * blcCopyPredictionMB
+ *    
+ *
+ * Parameters:
+ *    param                      input and output parameters
+ *
+ * Function:
+ *    This function copies one macroblock from previous frame into present
+ *    frame at the location of macroblock being currently decoded. 
+ *    The location where the macroblock is read is the location of 
+ *    the current block changed with motion vectors.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured
+ *
+ */
+
+int blcCopyPredictionMB(blcCopyPredictionMBParam_t *param)
+/* {{-output"blcCopyPredictionMB.txt"}} */
+{
+   int
+      uvWidth = param->uvWidth,
+      uvHeight = param->uvHeight,
+      yWidth = uvWidth * 2,
+      yHeight = uvHeight * 2,
+      uvDstX = param->uvBlkXCoord,
+      uvDstY = param->uvBlkYCoord,
+      yDstX = uvDstX * 2,
+      yDstY = uvDstY * 2,
+      *mvx = param->mvx, 
+      *mvy = param->mvy,
+      status;
+
+   u_char
+      *dstYBlk = param->currYMBInFrame,
+      *dstUBlk = param->currUBlkInFrame,
+      *dstVBlk = param->currVBlkInFrame,
+      *srcYFrame = param->refY,
+      *srcUFrame = param->refU,
+      *srcVFrame = param->refV;
+
+   blcCopyBlock_t copyBlock = (param->fMVsOverPictureBoundaries) ?
+      blcCopyBlockBC : blcCopyBlockNBC;
+
+   blcAssert(param != NULL);
+   blcAssert(param->rcontrol == 0 || param->rcontrol == 1);
+
+   /* Copy UV prediction blocks */
+   status = blcCopyUVPredictionBlocks(
+      (param->fourMVs) ? 
+         blcUVCountRefXY4MVs : blcUVCountRefXY1MV,
+      copyBlock,
+      mvx, mvy,
+      dstUBlk, dstVBlk,
+      srcUFrame, srcVFrame,
+      uvDstX, uvDstY,
+      uvWidth,
+      uvWidth, uvHeight,
+      param->fMVsOverPictureBoundaries,
+      param->rcontrol);
+
+   if (status < 0) 
+      return status;
+
+   /* If Advanced Prediction is in use */
+   if (param->fAdvancedPrediction) {
+
+        // not supported
+        
+   }
+
+   /* Else normal prediction mode is in use */
+   else { 
+
+      /* Copy Y prediction MB */
+      if(param->fourMVs)
+         status = blcCopyNormalYPredictionMBWith4MVs(
+            copyBlock,
+            mvx, mvy,
+            dstYBlk,
+            srcYFrame,
+            yDstX, yDstY,
+            yWidth,
+            yWidth, yHeight,
+            param->fMVsOverPictureBoundaries,
+            param->rcontrol);
+      else
+         status = blcCopyNormalYPredictionMBWith1MV(
+            copyBlock,
+            mvx, mvy,
+            dstYBlk,
+            srcYFrame,
+            yDstX, yDstY,
+            yWidth,
+            yWidth, yHeight,
+            param->fMVsOverPictureBoundaries,
+            param->rcontrol);
+      if (status < 0)
+         return status;
+   }
+
+   return 0;
+}
+
+
+
+
+
+/*
+ *    Local functions
+ */
+
+
+
+
+
+/*
+ * blcCopyNormalYPredictionMBWith1MV
+ *    
+ *
+ * Parameters:
+ *    copyBlock                  a pointer to either blcCopyBlockBC or
+ *                               blcCopyBlockNBC (or their Assembler versions)
+ *
+ *    mvxArray                   an array of four for x component of MVs
+ *    mvyArray                   an array of four for y component of MVs
+ *                               (Only the first entry of the array is used.)
+ *
+ *    dstYBlk                    a pointer to the current Y macroblock
+ *                               in the destination Y frame
+ *
+ *    srcYFrame                  the top-left corner of the source Y frame
+ *
+ *    dstYXPos                   the x coordinate of dstYBlk (in pixels)
+ *    dstYYPos                   the y coordinate of dstYBlk (in pixels)
+ *
+ *    dstYXSize                  the width of the Y destination frame
+ *    srcYXSize                  the width of the Y source frame
+ *    srcYYSize                  the height of the Y source frame
+ *
+ *    fMVsOverPictureBoundaries  non-zero if motion vectors may point outside
+ *                               picture boundaries, zero otherwise
+ *
+ *    rcontrol                   RCONTROL (section 6.1.2 of the H.263 standard)
+ *
+ * Function:
+ *    This function copies a luminance prediction macroblock from the given
+ *    source frame to the given position of the destination frame.
+ *    The prediction macroblock is associated with one motion vector.
+ *
+ * Returns:
+ *    >= 0 if everything is ok
+ *    < 0 if an error occured
+ *
+ */
+
+static int blcCopyNormalYPredictionMBWith1MV(
+   blcCopyBlock_t copyBlock,
+   int *mvxArray, int *mvyArray, 
+   u_char *dstYBlk,
+   u_char *srcYFrame,
+   int dstYXPos, int dstYYPos, 
+   int dstYXSize,
+   int srcYXSize, int srcYYSize,
+   int fMVsOverPictureBoundaries, 
+   int rcontrol)
+{
+   int 
+      mvxVal = *mvxArray, mvyVal = *mvyArray,
+      subpixelX, subpixelY,
+      xlt0, xNormal, xgtmax,
+      ylt0, yNormal, ygtmax,
+      srcXPos, srcYPos;
+   u_char *srcBlk;
+
+   blcYCountRefXY(mvxVal, mvyVal, dstYXPos, dstYYPos, &srcXPos, &srcYPos,
+      &subpixelX, &subpixelY);
+
+   if (fMVsOverPictureBoundaries)
+      blcHandleRefOverPictBoundariesBC(
+         16, 16,
+         srcYXSize, srcYYSize, 
+         subpixelX, subpixelY, 
+         &srcXPos, &srcYPos,
+         &xlt0, &xNormal, &xgtmax, 
+         &ylt0, &yNormal, &ygtmax);
+
+   else {
+      if (blcIsRefOverPictBoundaries(
+         16, 16,
+         srcYXSize, srcYYSize, 
+         subpixelX, subpixelY, 
+         srcXPos, srcYPos))
+         return -1;
+      xlt0 = xgtmax = ylt0 = ygtmax = 0;
+      xNormal = yNormal = 16;
+   }
+
+   srcBlk = srcYFrame + srcYPos * srcYXSize + srcXPos;
+
+   copyBlock(srcBlk, dstYBlk, xlt0, xNormal, xgtmax,
+      ylt0, yNormal, ygtmax, subpixelX, subpixelY,
+      srcYXSize, dstYXSize, 16, 16, rcontrol);
+
+   return 0;
+}
+
+
+/*
+ * blcCopyNormalYPredictionMBWith4MVs
+ *    
+ *
+ * Parameters:
+ *    See blcCopyNormalYPredictionMBWith1MV.
+ *    All 4 entries of mvxArray and mvyArray are used.
+ *
+ * Function:
+ *    This function copies a luminance prediction macroblock from the given
+ *    source frame to the given position of the destination frame.
+ *    The prediction macroblock is associated with four motion vectors.
+ *
+ * Returns:
+ *    >= 0 if everything is ok
+ *    < 0 if an error occured
+ *
+ */
+
+static int blcCopyNormalYPredictionMBWith4MVs(
+   blcCopyBlock_t copyBlock,
+   int *mvxArray, int *mvyArray, 
+   u_char *dstYBlk,
+   u_char *srcYFrame,
+   int dstYXPos, int dstYYPos, 
+   int dstYXSize,
+   int srcYXSize, int srcYYSize,
+   int fMVsOverPictureBoundaries, 
+   int rcontrol)
+{
+   int 
+      nh, nv, 
+      mvi = 0, 
+      mvxVal, mvyVal,
+      subpixelX, subpixelY,
+      xlt0, xNormal, xgtmax,
+      ylt0, yNormal, ygtmax,
+      srcXPos, srcYPos;
+
+   u_char 
+      *srcBlk, 
+      *origDest; 
+
+   origDest = dstYBlk; 
+   for (nv = 0; nv <= 1; nv++, dstYYPos += 8,
+      origDest += (dstYXSize << 3) - 16, dstYXPos -= 16) {
+      for (nh = 0; nh <= 1; nh++, dstYXPos += 8, origDest += 8, mvi++) { 
+         dstYBlk = origDest; 
+         mvxVal = mvxArray[mvi];
+         mvyVal = mvyArray[mvi];
+
+         blcYCountRefXY(mvxVal, mvyVal, dstYXPos, dstYYPos, &srcXPos, &srcYPos,
+            &subpixelX, &subpixelY);
+
+         if (fMVsOverPictureBoundaries)
+            blcHandleRefOverPictBoundariesBC(
+               8, 8,
+               srcYXSize, srcYYSize, 
+               subpixelX, subpixelY, 
+               &srcXPos, &srcYPos,
+               &xlt0, &xNormal, &xgtmax, 
+               &ylt0, &yNormal, &ygtmax);
+
+         else {
+            if (blcIsRefOverPictBoundaries(
+               8, 8,
+               srcYXSize, srcYYSize, 
+               subpixelX, subpixelY, 
+               srcXPos, srcYPos))
+               return -1;
+            xlt0 = xgtmax = ylt0 = ygtmax = 0;
+            xNormal = yNormal = 8;
+         }
+
+         srcBlk = srcYFrame + srcYPos * srcYXSize + srcXPos; 
+
+         copyBlock(srcBlk, dstYBlk, xlt0, xNormal, xgtmax, 
+            ylt0, yNormal, ygtmax, subpixelX, subpixelY, srcYXSize, 
+            dstYXSize, 8, 8, rcontrol); 
+      } 
+   } 
+
+   return 0;
+}
+
+
+
+/*
+ * blcCopyUVPredictionBlocks
+ *    
+ *
+ * Parameters:
+ *    uvCountSourceXY            a pointer to either blcUVCountRefXY1MV or 
+ *                               blcUVCountRefXY4MVs
+ *
+ *    copyBlock                  a pointer to either blcCopyBlockBC or
+ *                               blcCopyBlockNBC (or their Assembler versions)
+ *
+ *    mvxArray                   an array of four for x component of MVs
+ *    mvyArray                   an array of four for y component of MVs
+ *
+ *    dstUBlk                    a pointer to the current U block
+ *                               in the destination U frame
+ *    dstVBlk                    a pointer to the current V block
+ *                               in the destination V frame
+ *
+ *    srcUFrame                  the top-left corner of the source U frame
+ *    srcVFrame                  the top-left corner of the source V frame
+ *
+ *    dstUVXPos                  the x coordinate of dstUBlk
+ *    dstUVYPos                  the y coordinate of dstUBlk
+ *
+ *    dstUVXSize                 the width of the U and V destination frame
+ *    srcUVXSize                 the width of the U and V source frame
+ *    srcUVYSize                 the height of the U and V source frame
+ *
+ *    fMVsOverPictureBoundaries  non-zero if motion vectors may point outside
+ *                               picture boundaries, zero otherwise
+ *
+ *    rcontrol                   RCONTROL (section 6.1.2 of the H.263 standard)
+ *
+ * Function:
+ *    This function copies chrominance prediction blocks from the given
+ *    source frames to the given positions of the destination frames.
+ *
+ * Returns:
+ *    >= 0 if everything is ok
+ *    < 0 if an error occured
+ *
+ */
+
+static int blcCopyUVPredictionBlocks(
+   blcUVCountRefXY_t uvCountSourceXY,
+   blcCopyBlock_t copyBlock,
+   int *mvxArray, int *mvyArray, 
+   u_char *dstUBlk, u_char *dstVBlk,
+   u_char *srcUFrame, u_char *srcVFrame, 
+   int dstUVXPos, int dstUVYPos, 
+   int dstUVXSize,
+   int srcUVXSize, int srcUVYSize,
+   int fMVsOverPictureBoundaries, 
+   int rcontrol)
+{
+   int
+      srcXPos,
+      srcYPos,
+      subpixelX,
+      subpixelY,
+      xlt0,
+      xNormal,
+      xgtmax,
+      ylt0,
+      yNormal,
+      ygtmax;
+
+   u_char *srcBlk;
+
+   uvCountSourceXY(dstUVXPos, dstUVYPos, mvxArray, mvyArray, 
+       &srcXPos, &srcYPos, &subpixelX, &subpixelY);
+
+   if (fMVsOverPictureBoundaries)
+      blcHandleRefOverPictBoundariesBC(
+         8, 8,
+         srcUVXSize, srcUVYSize, 
+         subpixelX, subpixelY, 
+         &srcXPos, &srcYPos,
+         &xlt0, &xNormal, &xgtmax, 
+         &ylt0, &yNormal, &ygtmax);
+
+   else {
+      if (blcIsRefOverPictBoundaries(
+         8, 8,
+         srcUVXSize, srcUVYSize, 
+         subpixelX, subpixelY, 
+         srcXPos, srcYPos))
+         return -1;
+      xlt0 = xgtmax = ylt0 = ygtmax = 0;
+      xNormal = yNormal = 8;
+   }
+
+   /* U block */ \
+   srcBlk = srcUFrame + srcYPos * srcUVXSize + srcXPos;
+
+   /*deb0p("Copy U block\n");
+   deb1p("srcBlk %x\n", srcBlk);
+   deb1p("dstUBlk %x\n", dstUBlk);
+   deb1p("xlt0 %d\n", xlt0);
+   deb1p("xNormal %d\n", xNormal);
+   deb1p("xgtmax %d\n", xgtmax);
+   deb1p("ylt0 %d\n", ylt0);
+   deb1p("yNormal %d\n", yNormal);
+   deb1p("ygtmax %d\n", ygtmax);
+   deb1p("subpixelX %d\n", subpixelX);
+   deb1p("subpixelY %d\n", subpixelY);
+   deb1p("srcUVXSize %d\n", srcUVXSize);
+   deb1p("dstUVXSize %d\n", dstUVXSize);
+   deb1p("rcontrol %d\n", rcontrol);*/
+
+   copyBlock(srcBlk, dstUBlk, xlt0, xNormal, xgtmax,
+      ylt0, yNormal, ygtmax, subpixelX, subpixelY,
+      srcUVXSize, dstUVXSize, 8, 8, rcontrol);
+
+   /* V block */ \
+   srcBlk = srcVFrame + srcYPos * srcUVXSize + srcXPos;
+
+   copyBlock(srcBlk, dstVBlk, xlt0, xNormal, xgtmax,
+      ylt0, yNormal, ygtmax, subpixelX, subpixelY,
+      srcUVXSize, dstUVXSize, 8, 8, rcontrol);
+
+   return 0;
+}
+
+
+/*
+ * blcHandleRefOverPictBoundariesBC
+ *    
+ *
+ * Input parameters:
+ *    xBlkSize                   the width of the block to copy
+ *    yBlkSize                   the height of the block to copy
+ *    xSize                      the width of the frame
+ *    ySize                      the height of the frame
+ *
+ *    subpixelX                  1 if half pixel position is used in X direction
+ *    subpixelY                  1 if half pixel position is used in Y direction
+ *
+ * Input/output parameters:
+ *    sourceX                    input: the absolute position of the source
+ *    sourceY                    block (may be negative, half-pixel values are
+ *                               truncated to the next smaller integer)
+ *                               output: the coordinates of the first valid
+ *                               pixel in the source block
+ *
+ * Output parameters:
+ *    The next parameters describe a row of source pixels.
+ *    xlt0                       the number of the source pixels in the left of
+ *                               the image area
+ *    xNormal                    the number of the source pixels within 
+ *                               the image area
+ *    xgtmax                     the number of the source pixels in the right of
+ *                               the image area
+ *
+ *    The next parameters describe a column of source pixels.
+ *    ylt0                       the number of the source pixels above 
+ *                               the image area
+ *    yNormal                    the number of the source pixels withing 
+ *                               the image area
+ *    ygtmax                     the number of the source pixels below 
+ *                               the image area
+ *
+ * Function:
+ *    This function counts how many pixels are outside the picture area
+ *    and the coordinates of the first valid pixel in the source block.
+ *
+ * Returns:
+ *    See output parameters.
+ *
+ */
+
+static void blcHandleRefOverPictBoundariesBC(
+   int xBlkSize, int yBlkSize,
+   int xSize, int ySize, 
+   int subpixelX, int subpixelY, 
+   int *sourceX, int *sourceY,
+   int *xlt0, int *xNormal, int *xgtmax, 
+   int *ylt0, int *yNormal, int *ygtmax)
+{
+   int
+      xSizeMinus = xSize - xBlkSize,
+      ySizeMinus = ySize - yBlkSize;
+
+   if (*sourceX < 0) {
+      *xlt0 = (-(*sourceX) < xBlkSize) ? -(*sourceX) : xBlkSize;
+      *sourceX = 0;
+   }
+   else *xlt0 = 0;
+
+   if (*sourceY < 0) {
+      *ylt0 = (-(*sourceY) < yBlkSize) ? -(*sourceY) : yBlkSize;
+      *sourceY = 0;
+   }
+   else *ylt0 = 0;
+
+   if (*sourceX + subpixelX > xSizeMinus) {
+      if (*sourceX + subpixelX < xSize)
+         *xgtmax = *sourceX + subpixelX - xSizeMinus;
+      else {
+         *xgtmax = xBlkSize;
+         *sourceX = xSize - 1;
+      }
+   }
+   else *xgtmax = 0;
+
+   if (*sourceY + subpixelY > ySizeMinus) {
+      if (*sourceY + subpixelY < ySize)
+         *ygtmax = *sourceY + subpixelY - ySizeMinus;
+      else {
+         *ygtmax = yBlkSize;
+         *sourceY = ySize - 1;
+      }
+   }
+   else *ygtmax = 0;
+
+   *xNormal = xBlkSize - *xgtmax - *xlt0;
+   *yNormal = yBlkSize - *ygtmax - *ylt0;
+}
+
+
+/*
+ * blcIsRefOverPictBoundaries
+ *    
+ *
+ * Input parameters:
+ *    xBlkSize                   the width of the block to copy
+ *    yBlkSize                   the height of the block to copy
+ *    xSize                      the width of the frame
+ *    ySize                      the height of the frame
+ *
+ *    subpixelX                  1 if half pixel position is used in X direction
+ *    subpixelY                  1 if half pixel position is used in Y direction
+ *
+ *    sourceX                    the absolute position of the source
+ *    sourceY                    block (may be negative, half-pixel values are
+ *                               truncated to the next smaller integer)
+ *
+ * Function:
+ *    This function checks if the reference (source, prediction) block
+ *    is (partly) outside the picture area.
+ *
+ * Returns:
+ *    1 if the reference block is (partly) outside the picture area
+ *    0 if the whole reference block is inside the picture area
+ *
+ */
+
+static int blcIsRefOverPictBoundaries(
+   int xBlkSize, int yBlkSize,
+   int xSize, int ySize, 
+   int subpixelX, int subpixelY, 
+   int sourceX, int sourceY)
+{
+   if (sourceX < 0)
+      return 1;
+
+   if (sourceY < 0)
+      return 1;
+
+   if (sourceX + subpixelX > xSize - xBlkSize)
+      return 1;
+
+   if (sourceY + subpixelY > ySize - yBlkSize)
+      return 1;
+
+   return 0;
+}
+
+
+
+/*
+ * blcUVCountMVOffset4MVs
+ *    
+ *
+ * Input parameters:
+ *    mvxArray                   an array of the four horizontal components of
+ *                               the motion vectors for a particular macroblock
+ *    mvyArray                   an array of the four vertical components of
+ *                               the motion vectors for a particular macroblock
+ *
+ * Output parameters:
+ *    offsetX                    the relative position of the source
+ *    offsetY                    block (the origo is the destination block, 
+ *                               half-pixel values are truncated to the next 
+ *                               smaller integer)
+ *
+ *    subpixelX                  1 if half pixel position is used in X direction
+ *    subpixelY                  1 if half pixel position is used in Y direction
+ *
+ * Function:
+ *    This function counts the relative position of the chrominance source block
+ *    when it is given the motion vectors for the destination block. The macro
+ *    uses interpolation of four motion vectors described in Annex F of H.263
+ *    Recommendation.
+ *
+ * Returns:
+ *    See output parameters.
+ *
+ *    
+ *
+ */
+
+static void blcUVCountMVOffset4MVs(
+   int *mvxArray, int *mvyArray,
+   int *offsetX, int *offsetY,
+   int *subpixelX, int *subpixelY)
+{
+   /* These arrays define the table 16 in H.263 recommendation which is used
+      for interpolating chrominance motion vectors when four motion vectors
+      per macroblock is used. */
+   static const int
+      halfPixelOrig16[31] =
+         {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
+          0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
+      * const halfPixel16 = &halfPixelOrig16[15],
+      fullPixelOrig16[31] =
+         {-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+           0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1},
+      * const fullPixel16 = &fullPixelOrig16[15];
+
+   int mvSum, pixelPos;
+
+   mvSum = mvxArray[0] + mvxArray[1] + mvxArray[2] + mvxArray[3];
+   pixelPos = (mvSum % 80) / 5;
+   *subpixelX = halfPixel16[pixelPos];
+   *offsetX = (mvSum / 80) + fullPixel16[pixelPos];
+   if (mvSum < 0 && *subpixelX)
+      (*offsetX)--;
+
+   mvSum = mvyArray[0] + mvyArray[1] + mvyArray[2] + mvyArray[3];
+   pixelPos = (mvSum % 80) / 5;
+   *subpixelY = halfPixel16[pixelPos];
+   *offsetY = (mvSum / 80) + fullPixel16[pixelPos];
+   if (mvSum < 0 && *subpixelY)
+      (*offsetY)--;
+}
+
+
+/*
+ * blcUVCountRefXY1MV
+ * blcUVCountRefXY4MVs
+ *    
+ *
+ * Input parameters:
+ *    origoX                     the coordinates of the destination block
+ *    origoY
+ *
+ *    mvxArray                   an array of the four horizontal components of
+ *                               the motion vectors for a particular macroblock
+ *    mvyArray                   an array of the four vertical components of
+ *                               the motion vectors for a particular macroblock
+ *                               In blcUVCountRefXY1MV, only the first entry of
+ *                               the array is used.
+ *
+ * Output parameters:
+ *    sourceX                    the absolute position of the source
+ *    sourceY                    block (may be negative, half-pixel values are
+ *                               truncated to the next smaller integer)
+ *
+ *    subpixelX                  1 if half pixel position is used in X direction
+ *    subpixelY                  1 if half pixel position is used in Y direction
+ *
+ * Function:
+ *    These macros count the absolute position of the chrominance source block 
+ *    (and sets sourceX, sourceY, subpixelX and subpixelY according to it) 
+ *    when it is given the position of the destination block and 
+ *    the motion vectors for the destination block. blcUVCountRefXY4MVs
+ *    uses interpolation of four motion vectors described in Annex F of H.263
+ *    Recommendation. blcUVCountRefXY1MV uses only the first motion vector
+ *    of the array as described in chapter 6.1.1 of H.263 Recommendation.
+ *
+ * Returns:
+ *    See output parameters.
+ *
+ *    
+ *
+ */
+
+static void blcUVCountRefXY1MV(
+   int origoX, int origoY,
+   int *mvxArray, int *mvyArray, 
+   int *sourceX, int *sourceY,
+   int *subpixelX, int *subpixelY)
+{
+   int mvxVal = *mvxArray, mvyVal = *mvyArray;
+
+   *sourceX = origoX + mvxVal / 20;
+   *sourceY = origoY + mvyVal / 20;
+
+   *subpixelX = (mvxVal % 20) != 0;
+   *subpixelY = (mvyVal % 20) != 0;
+
+   if (mvxVal < 0 && *subpixelX)
+      *sourceX -= 1;
+   if (mvyVal < 0 && *subpixelY)
+      *sourceY -= 1;
+}
+
+
+static void blcUVCountRefXY4MVs(
+   int origoX, int origoY,
+   int *mvxArray, int *mvyArray, 
+   int *sourceX, int *sourceY,
+   int *subpixelX, int *subpixelY)
+{
+   int offX, offY;
+
+   blcUVCountMVOffset4MVs(mvxArray, mvyArray, &offX, &offY, subpixelX, subpixelY);
+   *sourceX = origoX + offX;
+   *sourceY = origoY + offY;
+}
+
+
+/*
+ * blcYCountRefXY
+ *    
+ *
+ * Input parameters:
+ *    mvxVal                     motion vector components for the block
+ *    mvyVal
+ *
+ *    destX                      the coordinates of the destination block
+ *    destY
+ *
+ * Output parameters:
+ *    sourceX                    the absolute position of the source
+ *    sourceY                    block (may be negative, half-pixel values are
+ *                               truncated to the next smaller integer)
+ *
+ *    subpixelX                  1 if half pixel position is used in X direction
+ *    subpixelY                  1 if half pixel position is used in Y direction
+ *
+ * Function:
+ *    This function counts the absolute position of the luminance source block (and
+ *    sets sourceX, sourceY, subpixelX and subpixelY according to it) when it is
+ *    given the position of the destination block and a motion vector pointing
+ *    to the source block.
+ *
+ * Returns:
+ *    See output parameters.
+ *
+ *    
+ *
+ */
+
+static void blcYCountRefXY(
+   int mvxVal, int mvyVal,
+   int destX, int destY, 
+   int *sourceX, int *sourceY,
+   int *subpixelX, int *subpixelY)
+{
+   *sourceX = destX + mvxVal / 10;
+   *sourceY = destY + mvyVal / 10;
+
+   *subpixelX = mvxVal & 1;
+   *subpixelY = mvyVal & 1;
+
+   if (mvxVal < 0 && *subpixelX)
+      *sourceX -= 1;
+   if (mvyVal < 0 && *subpixelY)
+      *sourceY -= 1;
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/bma.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1846 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation for MPEG4(H263) video transcoder. 
+* Block matching algorithms for MPEG4(H263) video transcoder.
+*
+*/
+
+
+
+#include "biblin.h"
+#include "common.h"
+#include "h263dconfig.h"
+#include "decmbdct.h"
+#include "vdxint.h"
+
+/* 
+ * Constants/definitions 
+ */
+
+#define DIAMOND_SEARCH_NUMBER 2
+
+
+const tVLCTable sCBPCIType[9] = 
+{
+    {0x01,0x01}, {0x01,0x03}, {0x02,0x03}, {0x03,0x03}, 
+        {0x01,0x04}, {0x01,0x06}, {0x02,0x06}, {0x03,0x06}, 
+        {0x01,0x09}
+};
+
+const tVLCTable sCBPCPType[21] = 
+{
+    {0x01,0x01}, {0x03,0x04}, {0x02,0x04}, {0x05,0x06},
+    {0x03,0x03}, {0x07,0x07}, {0x06,0x07}, {0x05,0x09}, 
+    {0x02,0x03}, {0x05,0x07}, {0x04,0x07}, {0x05,0x08},
+    {0x03,0x05}, {0x04,0x08}, {0x03,0x08}, {0x03,0x07},
+    {0x04,0x06}, {0x04,0x09}, {0x03,0x09}, {0x02,0x09}, 
+    {0x01,0x09}
+};
+
+const tVLCTable sCBPY[16] = 
+{
+    {0x03,0x04}, {0x05,0x05}, {0x04,0x05}, {0x09,0x04},
+    {0x03,0x05}, {0x07,0x04}, {0x02,0x06}, {0x0b,0x04},
+    {0x02,0x05}, {0x03,0x06}, {0x05,0x04}, {0x0a,0x04},
+    {0x04,0x04}, {0x08,0x04}, {0x06,0x04}, {0x03,0x02}
+};
+
+const unsigned int sDquant[5] = 
+{
+    0x01, 0x00, (unsigned int)NOT_VALID, 0x02, 0x03
+};
+
+const tVLCTable sMVTab[33] =
+{
+        {0x01,0x01}, {0x02,0x03}, {0x02,0x04}, {0x02,0x05}, 
+        {0x06,0x07}, {0x0a,0x08}, {0x08,0x08}, {0x06,0x08},
+        {0x16,0x0a}, {0x14,0x0a}, {0x12,0x0a}, {0x22,0x0b},
+        {0x20,0x0b}, {0x1e,0x0b}, {0x1c,0x0b}, {0x1a,0x0b},
+        {0x18,0x0b}, {0x16,0x0b}, {0x14,0x0b}, {0x12,0x0b},
+        {0x10,0x0b}, {0x0e,0x0b}, {0x0c,0x0b}, {0x0a,0x0b},
+        {0x08,0x0b}, {0x0e,0x0c}, {0x0c,0x0c}, {0x0a,0x0c}, 
+        {0x08,0x0c}, {0x06,0x0c}, {0x04,0x0c}, {0x06,0x0d},
+        {0x04,0x0d}
+}; 
+
+const int32  sFixedQuantScale1[32]=
+{
+      0x0000, 0x7fff, 0x3fff, 0x2aaa, 
+        0x1fff, 0x1999, 0x1555, 0x1249, 
+        0x0fff, 0x0e38, 0x0ccc, 0x0ba2,  
+        0x0aaa, 0x09d8, 0x0924, 0x0888,  
+        0x07ff, 0x0787, 0x071c, 0x06bc,  
+        0x0666, 0x0618, 0x05d1, 0x1590,  
+        0x0555, 0x051e, 0x04ec, 0x04bd,  
+        0x0492, 0x0469, 0x0444, 0x0421  
+};  
+
+const u_int16 sPrePostMult[64] = 
+{ 
+      0x8000, 0xb18a, 0xa73d, 0x9683,  
+        0x8000, 0x9683, 0xa73d, 0xb18a, 
+      0xb18a, 0xf641, 0xe7f7, 0xd0c3,  
+        0xb18a, 0xd0c3, 0xe7f7, 0xf641, 
+      0xa73d, 0xe7f7, 0xda82, 0xc4a7,  
+        0xa73d, 0xc4a7, 0xda82, 0xe7f7, 
+      0x9683, 0xd0c3, 0xc4a7, 0xb0fb,  
+        0x9683, 0xb0fb, 0xc4a7, 0xd0c3, 
+      0x8000, 0xb18a, 0xa73d, 0x9683,  
+        0x8000, 0x9683, 0xa73d, 0xb18a, 
+      0x9683, 0xd0c3, 0xc4a7, 0xb0fb,  
+        0x9683, 0xb0fb, 0xc4a7, 0xd0c3, 
+      0xa73d, 0xe7f7, 0xda82, 0xc4a7,  
+        0xa73d, 0xc4a7, 0xda82, 0xe7f7, 
+      0xb18a, 0xf641, 0xe7f7, 0xd0c3,  
+        0xb18a, 0xd0c3, 0xe7f7, 0xf641
+};
+
+
+
+/* 
+ * Function Declarations 
+ */
+int32 vlbCodeACCoeffsSVHWithZigZag(int32 coeffStart, int16* block, bibBuffer_t * outBuf,
+                                 int32 svh, int32 lastPos);
+void vlbPutBits(bibBuffer_t *base, int32 numBits, u_int32 value);
+
+
+
+/* 
+ * Function Definitions 
+ */
+
+/* {{-output"vbmGetH263IMCBPC.txt"}} */
+/*
+* vbmGetH263IMCBPC
+*
+* Parameters:
+*     vopCodingType            coding type (INTER/INTRA) for the VOP
+*           dQuant                   quantization parameter
+*           colorEffect              indicates color effect to be aplpied (e.g., black & white)
+*           cbpy                       cbpy value for the macro block
+*           mcbpcVal                   computed mcbpc value for the macro block
+*           length                   length of the computed mcbpc value codeword
+*
+* Function:
+*     This function evaluates the mcpbc codeword for INTRA macro block
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmGetH263IMCBPC(int dQuant, int vopCodingType, int /*colorEffect*/, 
+                                     int cbpy, int& mcbpcVal, int& length)
+{
+    int index;
+    int len, mcbpc;
+
+    if(vopCodingType == 1 /* VDX_VOP_TYPE_P */)
+    {
+        index = (dQuant == 0 ? 12 : 16) + mcbpcVal;
+        len = sCBPCPType[index].length + sCBPY[cbpy].length + 1;
+        mcbpc = (sCBPCPType[index].code << sCBPY[cbpy].length) | sCBPY[cbpy].code;
+        mcbpcVal = mcbpc;
+        length = len;
+    }
+    else
+    {
+        index = (dQuant == 0 ? 0 : 4) + mcbpcVal;
+        len = sCBPCIType[index].length + sCBPY[cbpy].length ;
+        mcbpc = (sCBPCIType[index].code << sCBPY[cbpy].length) | sCBPY[cbpy].code;
+        mcbpcVal = mcbpc;
+        length = len;
+    }
+}
+
+
+
+/* {{-output"vbmGetH263PMCBPC.txt"}} */
+/*
+* vbmGetH263PMCBPC
+*
+* Parameters:
+*           dQuant                   quantization parameter
+*           colorEffect              indicates color effect to be aplpied (e.g., black & white)
+*           cbpy                       cbpy value for the macro block
+*           mcbpcVal                   computed mcbpc value for the macro block
+*           length                   length of the computed mcbpc value codeword
+*
+* Function:
+*     This function evaluates the mcpbc codeword for INTER macro block
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmGetH263PMCBPC(int dQuant, int /*colorEffect*/, int cbpy, int& mcbpcVal, int& length)
+{
+    int index;
+    int len, mcbpc;
+    cbpy = (~cbpy) & 0xf;
+    
+    /* only ONE MV in baseline H263 */
+    index = (dQuant == 0 ? 0 : 4) + mcbpcVal;
+    len = sCBPCPType[index].length + sCBPY[cbpy].length;
+    mcbpc = (sCBPCPType[index].code << sCBPY[cbpy].length) | sCBPY[cbpy].code;
+    mcbpcVal = mcbpc;
+    length = len;
+}
+
+
+
+/* {{-output"vbmEncodeMVDifferential.txt"}} */
+/*
+* vbmEncodeMVDifferential
+*
+* Parameters:
+*     outBuf                     output buffer
+*           mvdx                     motion vector difference value in horizontal direction, in half-pixel unit
+*           mvdy                     motion vector difference value in vertical direction, in half-pixel unit
+*           fCode                      Fcode value
+*
+* Function:
+*     This function encodes the MV difference after prediction into the bitstream
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmEncodeMVDifferential(int32 mvdx, int32 mvdy, int32 fCode, 
+                           bibBuffer_t * outBuf)
+{
+    int32   mvd[2];
+    u_int32 i;
+    int32   temp;
+    int32   motioncode;
+    int32   motionresidual;
+    int32   rsize = fCode - 1;
+    u_int32 f     = 1 << rsize;
+    int32   high  = 32 * f - 1;
+    int32   low   = -32 * (int32) f;
+    int32   range = 64 *f;
+    
+    mvd[0] = mvdx;
+    mvd[1] = mvdy;
+    
+    for(i = 0; i < 2; i++)    
+    {
+        if (mvd[i] < low)
+        {
+            mvd[i] += range;
+        }
+        else
+        {
+            if (mvd[i] > high)
+            {
+                mvd[i] -= range;
+            }
+        }
+        temp = ABS(mvd[i]) -1 + f;
+        motioncode = temp >> rsize;    
+        if(mvd[i] >= 0)
+        {
+            vlbPutBits(outBuf, sMVTab[motioncode].length, sMVTab[motioncode].code);
+        }
+        else
+        {
+            vlbPutBits(outBuf, sMVTab[motioncode].length, (sMVTab[motioncode].code) ^ 1);
+        }        
+        if (rsize != 0 && motioncode != 0)
+        {
+            motionresidual = temp & (f - 1);
+            vlbPutBits(outBuf, rsize, motionresidual);
+        }   
+    }
+    return;
+}
+
+
+
+
+/* {{-output"vbmMedian3.txt"}} */
+/*
+* vbmMedian3
+*
+* Parameters:
+*     s1                         pointer to the first vector
+*     s2                         pointer to the second vector
+*     s3                         pointer to the third vector
+*     med                        pointer to store the median vector
+*
+* Function:
+*     This function finds the median of three vectors
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmMedian3(int16 *s1, int16 *s2, int16 *s3, tMotionVector *med)
+{
+    int32 temp1;
+    int32 temp2;
+    int32 temp3;
+    
+    temp1 = s1[0];
+    temp2 = s2[0];
+    temp3 = s3[0];
+    
+    if (temp1 > temp2)
+    {
+        temp1 += temp2;
+        temp2 = temp1 - temp2;
+        temp1 -= temp2;
+    }
+    if (temp2 > temp3)
+    {
+        temp2 += temp3;
+        temp3 = temp2 - temp3;
+        temp2 -= temp3;
+    }
+    if (temp1 > temp2)
+    {
+        temp1 += temp2;
+        temp2 = temp1 - temp2;
+        temp1 -= temp2;
+    }
+    
+    med->mvx = (int16) temp2;
+    temp1 = s1[1];
+    temp2 = s2[1];
+    temp3 = s3[1];
+    
+    if (temp1 > temp2)
+    {
+        temp1 += temp2;
+        temp2 = temp1 - temp2;
+        temp1 -= temp2;
+    }
+    if (temp2 > temp3)
+    {
+        temp2 += temp3;
+        temp3 = temp2 - temp3;
+        temp2 -= temp3;
+    }
+    if (temp1 > temp2)
+    {
+        temp1 += temp2;
+        temp2 = temp1 - temp2;
+        temp1 -= temp2;
+    }
+    med->mvy = (int16) temp2;
+    
+    return;
+}
+
+
+
+/* {{-output"vbmMvPrediction.txt"}} */
+/*
+* vbmMvPrediction
+*
+* Parameters:
+*     mbi                  macro block info needed for processing
+*     predMV               pointer to motion vector predictors
+*     mbinWidth            number of MBs per row
+*     mBCnt                    mecro block number
+*
+* Function:
+*     This function performs prediction of MV based on adjacent blocks
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmMvPrediction(tMBInfo *mbi, int32 mBCnt, tMotionVector *predMV, int32 mbinWidth)
+{
+    int16    p[3][2];
+    int32    zeroFound = 0;
+    int32    zeroPredictors = 0;
+    
+    if (mBCnt % mbinWidth == 0)
+    {
+        p[0][0] = 0;
+        p[0][1] = 0;
+        zeroPredictors++;
+    }
+    else
+    {
+        p[0][0] = (mbi - 1)->MV[0][0];
+        p[0][1] = (mbi - 1)->MV[0][1];
+    }
+    
+    if (mBCnt / mbinWidth == 0) 
+    {
+        p[1][0] = 0;
+        p[1][1] = 0;
+        zeroPredictors++;
+        zeroFound += 1;
+    }
+    else
+    {
+        p[1][0] = (mbi - mbinWidth)->MV[0][0];
+        p[1][1] = (mbi - mbinWidth)->MV[0][1];
+    }
+    
+    if ((mBCnt / mbinWidth == 0) ||
+        ((mBCnt % mbinWidth) == (mbinWidth - 1)))
+    {
+        p[2][0] = 0;
+        p[2][1] = 0;
+        zeroPredictors++;
+        zeroFound += 2;
+    }
+    else
+    {
+        p[2][0] = (mbi - mbinWidth + 1)->MV[0][0];
+        p[2][1] = (mbi - mbinWidth + 1)->MV[0][1];
+    }
+    
+    if (zeroPredictors == 3)
+    {
+        predMV->mvx = 0;
+        predMV->mvy = 0;
+    }
+    else if (zeroPredictors == 2)
+    {
+        predMV->mvx = p[zeroFound^3][0];
+        predMV->mvy = p[zeroFound^3][1];
+    }
+    else
+    {
+        vbmMedian3(p[0], p[1], p[2], predMV);
+    }
+    return;
+}
+
+
+
+/* {{-output"vbmMBSAD.txt"}} */
+/*
+* vbmMBSAD
+*
+* Parameters:
+*     refFrame             pointer to reference frame
+*     currMB               pointer to current MB
+*     mv                   pointer to store the SAD and having motion vector
+*     mbPos                pointer to macroblock position structure
+*     vopWidth             width of frame/VOP
+*     yWidth               width of luminance frame 
+*
+* Function:
+*     This function computes the SAD (Sum of Absolute Difference) 
+*     for a macroblock for integer motion vector
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmMBSAD(tPixel* refFrame, u_int32 vopWidth, tPixel* currMB, u_int32 yWidth,
+                            tMotionVector* mv, const tMBPosition* mbPos)
+{
+    u_int32     sad = 0;
+    tPixel*     refPos;
+    tPixel*     currPos;
+    int32       row;
+    int32       col;
+    
+    refPos = refFrame + (mbPos->y + mv->mvy) * vopWidth + (mbPos->x + mv->mvx); 
+    currPos = currMB; 
+    
+    for(row = 0; row < MB_SIZE; row++)
+    {
+        col = row & 0x1;
+        for(; col < MB_SIZE; col+= 2)
+        {
+            sad += ABS(*(refPos + col) - *(currPos + col));
+        }
+        refPos += vopWidth;
+        currPos += yWidth;
+    }
+    mv->SAD = (sad << 1);
+    return;
+}
+
+
+
+/* {{-output"vbmMVOutsideBound.txt"}} */
+/*
+* vbmMVOutsideBound
+*
+* Parameters:
+*     mbPos                pointer to macroblock position structure
+*     bestMV               pointer to store the best match motion vector
+*     halfPixel            flag to indicate whether half pel search is needed
+*
+* Function:
+*     This function checks whether the MV is within valid range
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+tBool vbmMVOutsideBound(tMBPosition *mbPos, tMotionVector* bestMV, tBool halfPixel)
+{
+    int32   xLeft;
+    int32   xRight;
+    int32   yTop;
+    int32   yBottom;
+    
+    xLeft = (mbPos->x << halfPixel) + bestMV->mvx;
+    xRight = (mbPos->x << halfPixel) + (MB_SIZE << halfPixel) + bestMV->mvx;
+    yTop = (mbPos->y << halfPixel) + bestMV->mvy;
+    yBottom = (mbPos->y << halfPixel) + (MB_SIZE << halfPixel) + bestMV->mvy;
+    
+    if (halfPixel)
+    {
+        return ((xLeft < mbPos->LeftBound) ||
+            (xRight > mbPos->RightBound) ||
+            (yTop < mbPos->TopBound) ||
+            (yBottom > mbPos->BottomBound) ||
+            ((bestMV->mvx) < -32  || (bestMV->mvx) > 31) ||
+            ((bestMV->mvy) < -32  || (bestMV->mvy) > 31)
+            );
+    }
+    else
+    {
+        return ((xLeft < mbPos->LeftBound) ||
+            (xRight > mbPos->RightBound) ||
+            (yTop < mbPos->TopBound) ||
+            (yBottom > mbPos->BottomBound)||
+            ((bestMV->mvx) < -16  || (bestMV->mvx) > 15) ||
+            ((bestMV->mvy) < -16  || (bestMV->mvy) > 15)
+            );
+    }
+}
+
+
+
+/* {{-output"vbmEstimateBestPredictor.txt"}} */
+/*
+* vbmEstimateBestPredictor
+*
+* Parameters:
+*     refFrame             pointer to reference frame
+*     currMB               pointer to current MB
+*     initPred             pointer to predictor motion vectors, pixel unit
+*     mbPos                pointer to macroblock position structure
+*     vopWidth             width of frame/VOP
+*     yWidth               width of luminance frame 
+*     bestMV               pointer to store the best match motion vector
+*     noofPredictors       number of predictors
+*
+* Function:
+*     This function estimates the best predictor among the set
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmEstimateBestPredictor(tPixel* refFrame, u_int32 vopWidth, tPixel* currMB, u_int32 yWidth, 
+                              tMotionVector* initPred, tMBPosition* mbPos,
+                              int32 noOfPredictors, tMotionVector* bestMV)
+{
+    int32 i;
+    bestMV->SAD = 65535;
+    for(i = 0; i < noOfPredictors; i++)
+    {
+        if (vbmMVOutsideBound(mbPos, (initPred + i), 0))
+        {
+            initPred[i].SAD = 65535;
+        }
+        else
+        {
+            vbmMBSAD(refFrame, vopWidth, currMB, yWidth, (initPred + i), mbPos);
+        }
+        if(initPred[i].SAD < bestMV->SAD)
+        {
+            bestMV->SAD = initPred[i].SAD;
+            bestMV->mvx = initPred[i].mvx;
+            bestMV->mvy = initPred[i].mvy;
+        }
+    }
+    
+    return;
+}       
+
+
+
+/* {{-output"vbmEstimateBound.txt"}} */
+/*
+* vbmEstimateBound
+*
+* Parameters:
+*     mbPos                pointer to macroblock position structure
+*     vopWidth             width of frame/VOP
+*     vopHeight            height of frame/VOP
+*     searchRange          search range
+*
+* Function:
+*     This function evaluates the bounds for a macroblock BM search
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmEstimateBound(tMBPosition *mbPos,u_int32 vopWidth, u_int32 vopHeight, int32 searchRange)
+{
+    mbPos->LeftBound = mbPos->x - searchRange;
+    mbPos->RightBound = mbPos->x + 16 + searchRange;
+    mbPos->TopBound = mbPos->y - searchRange;
+    mbPos->BottomBound = mbPos->y + 16 + searchRange;
+    
+    if(mbPos->LeftBound < 0)
+    {
+        mbPos->LeftBound = 0;
+    }
+    if(mbPos->RightBound > (int32)vopWidth)
+    {
+        mbPos->RightBound = vopWidth;
+    }
+    if(mbPos->TopBound < 0 )
+    {
+        mbPos->TopBound = 0;
+    }
+    if(mbPos->BottomBound > (int32)vopHeight)
+    {
+        mbPos->BottomBound = vopHeight;
+    }
+    
+    return;
+}
+
+
+
+/* {{-output"vbmEstimateBoundHalfPel.txt"}} */
+/*
+* vbmEstimateBoundHalfPel
+*
+* Parameters:
+*     mbPos                pointer to macroblock position structure
+*     vopWidth             width of frame/VOP
+*     vopHeight            height of frame/VOP
+*
+* Function:
+*     This function evaluates the bounds for a macroblock BM search in half pel accuracy
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmEstimateBoundHalfPel(tMBPosition *mbPos, u_int32 vopWidth, u_int32 vopHeight)
+{
+    mbPos->LeftBound = 0;
+    mbPos->RightBound = (vopWidth << 1);
+    mbPos->TopBound = 0;
+    mbPos->BottomBound = (vopHeight << 1);
+    return;
+}
+
+
+
+/* {{-output"vbmSmallDiamondSearch.txt"}} */
+/*
+* vbmSmallDiamondSearch
+*
+* Parameters:
+*     refFrame             pointer to reference frame
+*     currMB               pointer to current MB
+*     initPred             pointer to predictor motion vectors, pixel unit
+*     mbPos                pointer to macroblock position structure
+*     vopWidth             width of frame/VOP
+*     yWidth               width of luminance frame 
+*     bestMV               pointer to store the best match motion vector
+* Function:
+*     This function performs motion estimation for a macroblock using small diamond search
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmSmallDiamondSearch(tPixel* refFrame, tPixel* currMB, tMotionVector *initPred, 
+                                                     tMotionVector* bestMV, u_int32 vopWidth, tMBPosition* mbPos, 
+                                                     u_int32 yWidth)
+{
+    u_int8 locateSDS[5][5] =
+    {
+        {0,0,0,0,0},
+        {0,1,1,0,1},
+        {0,1,1,1,0},
+        {0,0,1,1,1},
+        {0,1,0,1,1}
+    };
+    u_int32  i;
+    int32   stepCount;
+    int32   flag=1;
+    int32   position=0;
+    
+    //form the diamond shap search pattern
+    stepCount = 1;
+    initPred[0].SAD = bestMV->SAD;
+    initPred[1].mvx = (int16)(bestMV->mvx + 1);
+    initPred[1].mvy = bestMV->mvy;
+    initPred[2].mvx = bestMV->mvx;
+    initPred[2].mvy = (int16)(bestMV->mvy - 1);
+    initPred[3].mvx = (int16)(bestMV->mvx - 1);
+    initPred[3].mvy = bestMV->mvy;
+    initPred[4].mvx = bestMV->mvx;
+    initPred[4].mvy = (int16)(bestMV->mvy + 1);
+    
+    for(i = 1; i < 5; i++)
+    {
+        if(vbmMVOutsideBound(mbPos, &initPred[i], 0) )
+        {
+            initPred[i].SAD = 65535;
+        }
+        else
+        {
+            vbmMBSAD(refFrame, vopWidth, currMB, yWidth, (initPred + i), mbPos);
+        }
+        if(initPred[i].SAD < bestMV->SAD)
+        {
+            bestMV->SAD = initPred[i].SAD;
+            bestMV->mvx = initPred[i].mvx;
+            bestMV->mvy = initPred[i].mvy;
+            position = i;
+        }
+    }
+    
+    /* the minimum SAD falls in the center */
+    if(bestMV->SAD == initPred[0].SAD)
+    {
+        return;
+    }
+    
+    while(flag)
+    {
+        stepCount++;
+        initPred[0].SAD = bestMV->SAD;
+        initPred[1].mvx = (int16)(bestMV->mvx + 1);
+        initPred[1].mvy = bestMV->mvy;
+        initPred[2].mvx = bestMV->mvx;
+        initPred[2].mvy = (int16)(bestMV->mvy - 1);
+        initPred[3].mvx = (int16)(bestMV->mvx - 1);
+        initPred[3].mvy = bestMV->mvy;
+        initPred[4].mvx = bestMV->mvx;
+        initPred[4].mvy = (int16)(bestMV->mvy + 1);
+        
+        for(i = 1; i < 5; i++)
+        {
+            if(locateSDS[position][i] != 0)
+            {
+                if(vbmMVOutsideBound(mbPos, &initPred[i],0))
+                {
+                    initPred[i].SAD = 65535;
+                }
+                else
+                {
+                    vbmMBSAD(refFrame, vopWidth, currMB, yWidth, (initPred + i), mbPos);
+                    if(initPred[i].SAD < bestMV->SAD)
+                    {
+                        bestMV->mvx = initPred[i].mvx;
+                        bestMV->mvy = initPred[i].mvy;
+                        bestMV->SAD = initPred[i].SAD;
+                        position = i;
+                    }
+                }
+            }
+        }
+        if(bestMV->SAD == initPred[0].SAD)
+        {
+            break;
+        }
+        if(stepCount > DIAMOND_SEARCH_NUMBER) // we only do 2 diamond search here
+        {
+            break;
+        }
+    }
+    
+    return;
+}
+
+
+                                                     
+/* {{-output"vbmSADHalfPel.txt"}} */
+/*
+* vbmSADHalfPel
+*
+* Parameters:
+*     refFrame             pointer to reference frame
+*     currMB               pointer to current MB
+*     mbPos                pointer to macroblock position structure
+*     vopWidth             width of frame/VOP
+*     yWidth               width of luminance frame 
+*     mv                   pointer to motion vector
+*     roundingControl      rounding control value
+*     blockSize            block size
+* Function:
+*     This function evaluates SAD for a macroblock/block for half pel motion vector
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmSADHalfPel(tPixel* refFrame, u_int32 vopWidth, tPixel* currMB, u_int32 yWidth,
+                                     tMotionVector* mv, const tMBPosition* mbPos, tBool roundingControl, 
+                   int32 blockSize)
+{
+    u_int32      sad = 0;
+    tPixel*     refPos;
+    tPixel*     currPos;
+    int32       row;
+    int32       col;
+    int32       extendedVOPWidth;
+    int32       temp;
+    
+    extendedVOPWidth = vopWidth ;
+    refPos = refFrame + (mbPos->y + (mv->mvy >> 1)) * extendedVOPWidth + 
+        (mbPos->x + (mv->mvx >> 1)); 
+    currPos = currMB; 
+    
+    if(mv->mvy & 1)
+    {
+        if(mv->mvx & 1)
+        {
+            /* Both horizontal and vertical components are having half pel */
+            for(row = 0; row < blockSize; row++)
+            {
+                col = row & 0x1;
+                for(; col < blockSize; col += 2)
+                {
+                    temp = (refPos[col] + refPos[col + 1] + 
+                        refPos[col + extendedVOPWidth] +
+                        refPos[col + extendedVOPWidth + 1] +
+                        2 -roundingControl) >> 2;
+                    sad += ABS(temp - currPos[col]);
+                }
+                refPos += extendedVOPWidth;
+                currPos += yWidth;
+            }
+            mv->SAD = (sad << 1);
+        }
+        else
+        {
+            /* Vertical component is having half pel */
+            for(row = 0; row < blockSize; row++)
+            {
+                col = row & 0x1;
+                for(; col < blockSize; col += 2)
+                {
+                    temp = (refPos[col] + refPos[col + extendedVOPWidth]+
+                        1 -roundingControl) >> 1;
+                    sad += ABS(temp - currPos[col]);
+                }
+                refPos += extendedVOPWidth;
+                currPos += yWidth;
+            }
+            mv->SAD = (sad << 1);
+        }
+    }
+    else
+    {
+        if(mv->mvx & 1)
+        {
+            /* Horizontal component is having half pel */
+            for(row = 0; row < blockSize; row++)
+            {
+                col = row & 0x1;
+                for(; col < blockSize; col += 2)
+                {
+                    temp = (refPos[col] + refPos[col + 1] + 
+                        1 -roundingControl) >> 1;
+                    sad += ABS(temp - currPos[col]);
+                }
+                refPos += extendedVOPWidth;
+                currPos += yWidth;
+            }
+            mv->SAD = (sad << 1);
+        }
+        else
+        {
+            /* Both horizontal and vertical components are integer pel */
+            for(row = 0; row < blockSize; row++)
+            {
+                col = row & 0x1;
+                for(; col < blockSize; col += 2)
+                {
+                    sad += ABS(refPos[col] - currPos[col]);
+                }
+                refPos += extendedVOPWidth;
+                currPos += yWidth;
+            }
+            mv->SAD = (sad << 1);
+        }
+    }
+    
+    return;
+}
+
+
+
+
+/* {{-output"vbmHalfPelSearchMB.txt"}} */
+/*
+* vbmHalfPelSearchMB
+*
+* Parameters:
+*     refFrame             pointer to reference frame
+*     currMB               pointer to current MB
+*     mbPos                pointer to macroblock position structure
+*     vopWidth             width of frame/VOP
+*     yWidth               width of luminance frame 
+*     initPred             pointer to predictor motion vectors, pixel unit
+*     bestMV               pointer to store the best match motion vector
+* Function:
+*     This function evaluates the half pel motion vector for a 16x16 block using 
+*     the integer pel motion vector
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmHalfPelSearchMB(tPixel* refFrame, u_int32 vopWidth, tPixel* currMB, 
+                                                u_int32 yWidth, tMotionVector* initPred,
+                                                tMotionVector* bestMV, tMBPosition* mbPos)
+{
+    int32 i;
+    int32 position=0;
+    
+    initPred[0].SAD = bestMV->SAD;
+    initPred[1].mvx = (int16)(bestMV->mvx + 1);
+    initPred[1].mvy = bestMV->mvy;
+    initPred[2].mvx = bestMV->mvx;
+    initPred[2].mvy = (int16)(bestMV->mvy - 1);
+    initPred[3].mvx = (int16)(bestMV->mvx - 1);
+    initPred[3].mvy = bestMV->mvy;
+    initPred[4].mvx = bestMV->mvx;
+    initPred[4].mvy = (int16)(bestMV->mvy + 1);
+    
+    for(i = 1; i < 5; i++)
+    {
+        if(vbmMVOutsideBound(mbPos, &initPred[i], 1))
+        {
+            initPred[i].SAD = 65535;
+        }
+        else
+        {
+            vbmSADHalfPel(refFrame, vopWidth, currMB, yWidth, 
+                (initPred + i), mbPos,(tBool)(0), 16);
+        }
+        
+        if(initPred[i].SAD < bestMV->SAD)
+        {
+            bestMV->mvx = initPred[i].mvx;
+            bestMV->mvy = initPred[i].mvy;
+            bestMV->SAD = initPred[i].SAD;
+            position = i;
+        }
+    }
+    
+    if(1)
+    {
+        if(bestMV->SAD == initPred[0].SAD)
+        {
+            return;
+        }
+        else
+        {
+            switch(position)
+            {
+            case 1: case 3:
+                initPred[5].mvx = bestMV->mvx;
+                initPred[5].mvy = (int16)(bestMV->mvy - 1);
+                initPred[6].mvx = bestMV->mvx;
+                initPred[6].mvy = (int16)(bestMV->mvy + 1);
+                break;
+                
+            case 2: case 4:
+                initPred[5].mvx = (int16)(bestMV->mvx - 1);
+                initPred[5].mvy = bestMV->mvy;
+                initPred[6].mvx = (int16)(bestMV->mvx + 1);
+                initPred[6].mvy = bestMV->mvy;
+                break;
+                
+            default:
+                break;
+            }
+            
+            for(i = 5; i < 7; i++)
+            {
+                
+                if(vbmMVOutsideBound(mbPos, &initPred[i],1))
+                {
+                    initPred[i].SAD = 65535;
+                }
+                else
+                {
+                    vbmSADHalfPel(refFrame, vopWidth, currMB, yWidth,
+                        (initPred + i), mbPos, (tBool)0, 16);
+                }
+                if(initPred[i].SAD < bestMV->SAD)
+                {
+                    bestMV->mvx = initPred[i].mvx;
+                    bestMV->mvy = initPred[i].mvy;
+                    bestMV->SAD = initPred[i].SAD;
+                }
+            }
+        }
+    }
+    
+    return;
+}
+
+
+
+/* {{-output"vbmMEMBSpatioTemporalSearch.txt"}} */
+/*
+* vbmMEMBSpatioTemporalSearch
+*
+* Parameters:
+*     refFrame             pointer to reference frame
+*     currMB               pointer to current MB
+*     mbPos                pointer to macroblock position structure
+*     vopWidth             width of frame/VOP
+*     vopHeight            height of frame/VOP
+*     yWidth               width of luminance frame 
+*     initPred             pointer to predictor motion vectors, pixel unit
+*     bestMV               pointer to store the best match motion vector
+*     noOfPredictors       number of MV predictors
+*     searchRange          search range
+*     minSAD               minimum SAD
+* Function:
+*     This function performs motion estimation for a macroblock using 
+*     spatio-temporal correlation based search
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+int32 vbmMEMBSpatioTemporalSearch(tPixel* refFrame, u_int32 vopWidth, u_int32 vopHeight, 
+                                                                    tPixel* currMB, u_int32 yWidth, tMBPosition* mbPos,
+                                                                    tMotionVector   *initPred, int32 noOfPredictors,
+                                                                    tMotionVector* bestMV, int32 searchRange, u_int32 minSAD)
+{
+    /* estimate the bound of MV for current MB */
+    vbmEstimateBound(mbPos, vopWidth, vopHeight, searchRange);
+    
+    /* get the best MV predictor from the candidates set */
+    vbmEstimateBestPredictor(refFrame, vopWidth, currMB, yWidth, initPred, mbPos, noOfPredictors, bestMV);
+    
+    if(bestMV->SAD >= minSAD)
+    {
+        /* from the MV predictor, starts the small diamond search    */
+        vbmSmallDiamondSearch(refFrame, currMB, initPred, bestMV, vopWidth, mbPos, yWidth);
+    }
+    
+    /* adjustment for half-pixel search */
+    bestMV->mvx <<= 1;
+    bestMV->mvy <<= 1;
+    
+    /* MV bound in half-pixel  */
+    vbmEstimateBoundHalfPel(mbPos,vopWidth, vopHeight);
+    
+    /* starts the half-pixel search around the integer-pixel MV */
+    vbmHalfPelSearchMB(refFrame, vopWidth, currMB, yWidth, 
+        initPred, bestMV, mbPos);
+    
+    return bestMV->SAD;
+}
+
+
+
+/* {{-output"vbmRowDCT.txt"}} */
+/*
+* vbmRowDCT
+*
+* Parameters:
+*     block                array of 64 block coefficients 
+* Function:
+*     This function performs row DCT of 8x8 block of data elements
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmRowDCT(int16 *block)
+{
+    int32  coeff0, coeff1, coeff2, coeff3;
+    int32  coeff4, coeff5, coeff6, coeff7;
+    int32  temp;
+    u_int16 count;
+    int32  rowStartIndex;
+    
+    for(count = 0; count < BLOCK_SIZE; count++)
+    {
+        rowStartIndex = count << LOG_BLOCK_WIDTH;
+        
+        /* Stage 1 and up scaling of the input data to improve precision */
+        coeff0 = (block[rowStartIndex] + block[rowStartIndex + 7]) <<
+            DCT_KEPT_PRECISION;
+        coeff7 = (block[rowStartIndex] - block[rowStartIndex + 7]) <<
+            DCT_KEPT_PRECISION;
+        
+        coeff1 = (block[rowStartIndex + 1] + block[rowStartIndex + 6]) <<
+            DCT_KEPT_PRECISION;
+        coeff6 = (block[rowStartIndex + 1] - block[rowStartIndex + 6]) <<
+            DCT_KEPT_PRECISION;
+        
+        coeff2 = (block[rowStartIndex + 2] + block[rowStartIndex + 5]) <<
+            DCT_KEPT_PRECISION;
+        coeff5 = (block[rowStartIndex + 2] - block[rowStartIndex + 5]) <<
+            DCT_KEPT_PRECISION;
+        
+        coeff3 = (block[rowStartIndex + 3] + block[rowStartIndex + 4]) <<
+            DCT_KEPT_PRECISION;
+        coeff4 = (block[rowStartIndex + 3] - block[rowStartIndex + 4]) <<
+            DCT_KEPT_PRECISION;
+        
+        /* Stage 2 */
+        temp =   coeff0 + coeff3;
+        coeff3 = coeff0 - coeff3;
+        coeff0 = temp;
+        
+        temp =   coeff1 + coeff2;
+        coeff2 = coeff1 - coeff2;
+        coeff1 = temp;
+        
+        temp =   ((coeff6 - coeff5) * COS_PI_BY_4 + DCT_ROUND) >> DCT_PRECISION;
+        coeff6 = ((coeff6 + coeff5) * COS_PI_BY_4 + DCT_ROUND) >> DCT_PRECISION;
+        coeff5 = temp;
+        
+        /* Stage 3 */
+        temp =   coeff0 + coeff1;
+        coeff1 = coeff0 - coeff1;
+        coeff0 = temp;
+        
+        temp =   ((coeff2 * TAN_PI_BY_8 + DCT_ROUND) >> DCT_PRECISION) + coeff3;
+        coeff3 = ((coeff3 * TAN_PI_BY_8 + DCT_ROUND) >> DCT_PRECISION) - coeff2;
+        coeff2 = temp;
+        
+        temp =   coeff4 + coeff5;
+        coeff5 = coeff4 - coeff5;
+        coeff4 = temp;
+        
+        temp =   coeff7 - coeff6;
+        coeff7 = coeff7 + coeff6;
+        coeff6 = temp;
+        
+        /* Stage 4 */
+        temp =   ((coeff4 * TAN_PI_BY_16 + DCT_ROUND) >> DCT_PRECISION) + coeff7;
+        coeff7 = ((coeff7 * TAN_PI_BY_16 + DCT_ROUND) >> DCT_PRECISION) - coeff4;
+        coeff4 = temp;
+        
+        temp =   coeff5 + ((coeff6 * TAN_3PI_BY_16 + DCT_ROUND) >> DCT_PRECISION);
+        coeff6 = coeff6 - ((coeff5 * TAN_3PI_BY_16 + DCT_ROUND) >> DCT_PRECISION);
+        coeff5 = temp;
+        
+        block[rowStartIndex] =     (int16)coeff0;
+        block[rowStartIndex + 4] = (int16)coeff1;
+        block[rowStartIndex + 2] = (int16)coeff2;
+        block[rowStartIndex + 6] = (int16)coeff3;
+        block[rowStartIndex + 1] = (int16)coeff4;
+        block[rowStartIndex + 5] = (int16)coeff5;
+        block[rowStartIndex + 3] = (int16)coeff6;
+        block[rowStartIndex + 7] = (int16)coeff7;
+    }
+    
+    return;
+}
+
+
+
+/* {{-output"vbmDCTQuantInterSVH.txt"}} */
+/*
+* vbmDCTQuantInterSVH
+*
+* Parameters:
+*     block                array of 64 block coefficients 
+*     mbi                  contains info about MB quantization scale and coding type
+*     lastPosition         indicates last non zero coefficient
+* Function:
+*     This function performs DCT of a 8x8 block of data elements and 
+*     quantizes the DCT coefficients with short video header flag set
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmDCTQuantInterSVH(int16 *block, tMBInfo *mbi, int32* lastPosition)
+{
+    int32  coeff0, coeff1, coeff2, coeff3;
+    int32  coeff4, coeff5, coeff6, coeff7;
+    int32  temp;
+    u_int16 count;
+    int32   sign;
+    
+    vbmRowDCT(block);
+    
+    for(count = 0; count < BLOCK_SIZE; count++)
+    {
+        /* Stage 1 */
+        coeff0 = block[count] + block[count + 56];
+        coeff7 = block[count] - block[count + 56];
+        
+        coeff1 = block[count + 8] + block[count + 48];
+        coeff6 = block[count + 8] - block[count + 48];
+        
+        coeff2 = block[count + 16] + block[count + 40];
+        coeff5 = block[count + 16] - block[count + 40];
+        
+        coeff3 = block[count + 24] + block[count + 32];
+        coeff4 = block[count + 24] - block[count + 32];
+        
+        /* Stage 2 */
+        temp =   coeff0 + coeff3;
+        coeff3 = coeff0 - coeff3;
+        coeff0 = temp;
+        
+        temp =   coeff1 + coeff2;
+        coeff2 = coeff1 - coeff2;
+        coeff1 = temp;
+        
+        temp =   ((coeff6 - coeff5) * COS_PI_BY_4 + DCT_ROUND) >> DCT_PRECISION;
+        coeff6 = ((coeff6 + coeff5) * COS_PI_BY_4 + DCT_ROUND) >> DCT_PRECISION;
+        coeff5 = temp;
+        
+        /* Stage 3 */
+        temp =   coeff0 + coeff1;
+        coeff1 = coeff0 - coeff1;
+        coeff0 = temp;
+        
+        temp =   ((coeff2 * TAN_PI_BY_8 + DCT_ROUND) >> DCT_PRECISION) + coeff3;
+        coeff3 = ((coeff3 * TAN_PI_BY_8 + DCT_ROUND) >> DCT_PRECISION) - coeff2;
+        coeff2 = temp;
+        
+        temp =   coeff4 + coeff5;
+        coeff5 = coeff4 - coeff5;
+        coeff4 = temp;
+        
+        temp =   coeff7 - coeff6;
+        coeff7 = coeff7 + coeff6;
+        coeff6 = temp;
+        
+        /* Stage 4 */
+        temp =   ((coeff4 * TAN_PI_BY_16 + DCT_ROUND) >> DCT_PRECISION) + coeff7;
+        coeff7 = ((coeff7 * TAN_PI_BY_16 + DCT_ROUND) >> DCT_PRECISION) - coeff4;
+        coeff4 = temp;
+        
+        temp =   coeff5 + ((coeff6 * TAN_3PI_BY_16 + DCT_ROUND) >> DCT_PRECISION);
+        coeff6 = coeff6 - ((coeff5 * TAN_3PI_BY_16 + DCT_ROUND) >> DCT_PRECISION);
+        coeff5 = temp;
+        
+        block[count] =     (int16) ( (coeff0* sPrePostMult[count] + 
+            DCT_ROUND_PLUS_KEPT) >> DCT_PRECISION_PLUS_KEPT);
+        block[count + 32] = (int16) ((coeff1* sPrePostMult[count+32] + 
+            DCT_ROUND_PLUS_KEPT) >> DCT_PRECISION_PLUS_KEPT);
+        block[count + 16] = (int16) ((coeff2* sPrePostMult[count+16] + 
+            DCT_ROUND_PLUS_KEPT) >> DCT_PRECISION_PLUS_KEPT);
+        block[count + 48] = (int16) ((coeff3* sPrePostMult[count+48] + 
+            DCT_ROUND_PLUS_KEPT) >> DCT_PRECISION_PLUS_KEPT);
+        block[count + 8] =  (int16) ((coeff4* sPrePostMult[count+8] + 
+            DCT_ROUND_PLUS_KEPT) >> DCT_PRECISION_PLUS_KEPT);
+        block[count + 40] = (int16) ((coeff5* sPrePostMult[count+40] + 
+            DCT_ROUND_PLUS_KEPT) >> DCT_PRECISION_PLUS_KEPT);
+        block[count + 24] = (int16) ((coeff6* sPrePostMult[count+24] + 
+            DCT_ROUND_PLUS_KEPT) >> DCT_PRECISION_PLUS_KEPT);
+        block[count + 56] = (int16) ((coeff7* sPrePostMult[count+56] + 
+            DCT_ROUND_PLUS_KEPT) >> DCT_PRECISION_PLUS_KEPT);    
+        
+        coeff1 = mbi->QuantScale;
+        temp= count;
+        while(temp<64)
+        {
+            coeff0 = (int32) block[temp];   
+            if (coeff0 >= 0) {
+                sign = 1;
+            }
+            else{
+                sign = -1;
+            }
+            coeff0 = sign * coeff0;
+            
+            if (coeff0 < ((coeff1 * 5 ) >> 1))
+            {
+                block[temp] = 0;
+            } 
+            else
+            {
+                coeff0 -= (coeff1 >> 1);
+                coeff0 += 1;
+                coeff0 *= sFixedQuantScale1[coeff1];
+                coeff0 >>= FIXED_PT_BITS;
+                coeff0 *= sign;
+                
+                if (coeff0 > MAX_SAT_VAL_SVH)
+                {
+                    coeff0 = MAX_SAT_VAL_SVH;
+                }
+                else if (coeff0 < MIN_SAT_VAL_SVH)
+                {
+                    coeff0 = MIN_SAT_VAL_SVH;
+                }
+                
+                block[temp] = (int16) coeff0;       
+                if( temp > (*lastPosition)) *lastPosition = temp;
+            }
+            temp = temp+8;
+        }
+    }
+        
+    return;
+}
+
+
+
+/* {{-output"vbmCBPYInter.txt"}} */
+/*
+* vbmCBPYInter
+*
+* Parameters:
+*     mbi                  contains info about MB quantization scale and coding type
+*     lastPosition         indicates last non zero coefficient
+* Function:
+*     This function evaluates the coded bit pattern of the Inter MB
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmCBPYInter(tMBInfo *mbi, int32* lastPosition)
+{
+    int32 blkCnt;
+    
+    mbi->CodedBlockPattern = 0;
+    for (blkCnt = 0; blkCnt < 6; blkCnt++)
+    {   
+        mbi->CodedBlockPattern <<= 1;
+        
+        if(lastPosition[blkCnt] != -1)
+        {
+            mbi->CodedBlockPattern |= 1;
+        }
+    }
+    
+    return;
+}   
+
+
+
+/* {{-output"vbmCBPYInter.txt"}} */
+/*
+* vbmCBPYInter
+*
+* Parameters:
+*     refFrame             reference frame
+*     currBlockPos         current block
+*     block                block for storing the difference between predicted and
+*                          actual pixel values.
+*     mv                   motion vector for the block in half pixel unit
+*     x                    x-coordinate for the first pixel of block
+*     y                    y-coordinate for the first pixel of block
+*     refFrameWidth        width of the reference frame
+*     curFrameWidth        width of current Frame
+*     extendVopSize        extension of the frame width
+* Function:
+*     This function finds the predicted block from the reference frame and 
+*     copies the predicted frame into the current frame
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+int32 vbmPredictBlock(tPixel *refFrame, int32 refFrameWidth, u_int32 extendVopSize,
+                                            tPixel *currBlockPos, int32 curFrameWidth,
+                                            int16 *block, tMotionVector *mv, int32 x, int32 y)
+{
+    int32 count1, count2;
+    u_int8 *tempFrame, *tempFrame1, *tempFrame2;
+    int32 tempVal, sad;
+    int32 extframeWidth;
+    extframeWidth = refFrameWidth + 2 * extendVopSize; /* Because of padding */
+    
+                                                                                                         /* 
+                                                                                                         * Since the frame is appended by 8 rows and 8 colums on all sides
+                                                                                                         * 0,0 of referenceframe will now be frameStartPoint
+     */
+        
+    tempFrame = refFrame + extframeWidth * extendVopSize + extendVopSize
+        + ((y + (mv->mvy >> 1)) * extframeWidth) + x + (mv->mvx >> 1);
+    tempFrame2 = currBlockPos;
+    
+    if (mv->mvy & 1) /* Motion vector of y has half pel accuracy */
+    {
+        if (mv->mvx & 1) /* MV has half pel value in both coordinates */
+        {
+            tempFrame1 = tempFrame + extframeWidth;
+            sad=0;
+            for (count1 = 0; count1 < BLOCK_SIZE; count1++)
+            {
+                count2 = 0;
+                tempVal = (tempFrame[count2]
+                    + tempFrame[count2 + 1]
+                    + tempFrame1[count2]
+                    + tempFrame1[count2 + 1]+ 2) >> 2;
+                
+                block[count2] = (int16)(tempFrame2[count2] - tempVal);
+                sad+=ABS(block[count2]);
+                tempVal = (tempFrame[count2 + 1]
+                    + tempFrame[count2 + 2]
+                    + tempFrame1[count2 + 1]
+                    + tempFrame1[count2 + 2]+ 2) >> 2;
+                
+                block[count2 + 1] = (int16)(tempFrame2[count2 + 1] - tempVal);
+                sad+=ABS(block[count2+1]);
+                tempVal = (tempFrame[count2 + 2]
+                    + tempFrame[count2 + 3]
+                    + tempFrame1[count2 + 2]
+                    + tempFrame1[count2 + 3]+ 2) >> 2;
+                
+                block[count2 + 2] = (int16)(tempFrame2[count2 + 2] - tempVal);
+                sad+=ABS(block[count2+2]);
+                tempVal = (tempFrame[count2 + 3]
+                    + tempFrame[count2 + 4]
+                    + tempFrame1[count2 + 3]
+                    + tempFrame1[count2 + 4]+ 2) >> 2;
+                
+                block[count2 + 3] = (int16)(tempFrame2[count2 + 3] - tempVal);
+                sad+=ABS(block[count2+3]);
+                tempVal = (tempFrame[count2 + 4]
+                    + tempFrame[count2 + 5]
+                    + tempFrame1[count2 + 4]
+                    + tempFrame1[count2 + 5]+ 2) >> 2;
+                
+                block[count2 + 4] = (int16)(tempFrame2[count2 + 4] - tempVal);
+                sad+=ABS(block[count2+4]);
+                tempVal = (tempFrame[count2 + 5]
+                    + tempFrame[count2 + 6]
+                    + tempFrame1[count2 + 5]
+                    + tempFrame1[count2 + 6]+ 2) >> 2;
+                
+                block[count2 + 5] = (int16)(tempFrame2[count2 + 5] - tempVal);
+                sad+=ABS(block[count2+5]);
+                tempVal = (tempFrame[count2+ 6]
+                    + tempFrame[count2 + 7]
+                    + tempFrame1[count2 + 6]
+                    + tempFrame1[count2 + 7]+ 2) >> 2;
+                
+                block[count2 + 6] = (int16)(tempFrame2[count2 + 6] - tempVal);
+                sad+=ABS(block[count2+6]);
+                tempVal = (tempFrame[count2 + 7]
+                    + tempFrame[count2 + 8]
+                    + tempFrame1[count2 + 7]
+                    + tempFrame1[count2 + 8]+ 2) >> 2;
+                
+                block[count2 + 7] = (int16)(tempFrame2[count2 + 7] - tempVal);
+                sad+=ABS(block[count2+7]);
+                block += BLOCK_SIZE;
+                tempFrame += extframeWidth;
+                tempFrame1 += extframeWidth;
+                tempFrame2 += curFrameWidth;
+            }
+        }
+        else  /* MV has half pel only in y direction */
+        {
+            tempFrame1 = tempFrame + extframeWidth;
+            sad=0;
+            for (count1 = 0; count1 < BLOCK_SIZE; count1++)
+            {
+                count2 = 0;
+                tempVal = (tempFrame[count2]
+                    + tempFrame1[count2]+ 1) >> 1;
+                
+                block[count2] = (int16)(tempFrame2[count2] - tempVal);
+                sad+=ABS(block[count2]);
+                tempVal = (tempFrame[count2 + 1]
+                    + tempFrame1[count2 + 1]+ 1) >> 1;
+                
+                block[count2 + 1] = (int16)(tempFrame2[count2 + 1] - tempVal);
+                sad+=ABS(block[count2+1]);
+                tempVal = (tempFrame[count2 + 2]
+                    + tempFrame1[count2 + 2]+ 1) >> 1;
+                
+                block[count2 + 2] = (int16)(tempFrame2[count2 + 2] - tempVal);
+                sad+=ABS(block[count2+2]);
+                tempVal = (tempFrame[count2 + 3]+ tempFrame1[count2 + 3]+1) >> 1;
+                
+                block[count2 + 3] = (int16)(tempFrame2[count2 + 3] - tempVal);
+                sad+=ABS(block[count2+3]);
+                tempVal = (tempFrame[count2 + 4]
+                    + tempFrame1[count2 + 4]+ 1) >> 1;
+                
+                block[count2 + 4] = (int16)(tempFrame2[count2 + 4] - tempVal);
+                sad+=ABS(block[count2+4]);
+                tempVal = (tempFrame[count2 + 5]
+                    + tempFrame1[count2 + 5]+ 1) >> 1;
+                
+                block[count2 + 5] = (int16)(tempFrame2[count2 + 5] - tempVal);
+                sad+=ABS(block[count2+5]);
+                tempVal = (tempFrame[count2+ 6]
+                    + tempFrame1[count2 + 6]+ 1) >> 1;
+                
+                block[count2 + 6] = (int16)(tempFrame2[count2 + 6] - tempVal);
+                sad+=ABS(block[count2+6]);
+                tempVal = (tempFrame[count2 + 7]
+                    + tempFrame1[count2 + 7]+ 1) >> 1;
+                
+                block[count2 + 7] = (int16)(tempFrame2[count2 + 7] - tempVal);
+                sad+=ABS(block[count2+7]);
+                block += BLOCK_SIZE;
+                tempFrame += extframeWidth;
+                tempFrame1 += extframeWidth;
+                tempFrame2 += curFrameWidth;
+            }
+        }
+    }
+    else
+    {
+        if (mv->mvx & 1) /* MV has half pel only in x direction */
+        {
+            sad=0;
+            for (count1 = 0; count1 < BLOCK_SIZE; count1++)
+            {
+                count2 = 0;
+                tempVal = (tempFrame[count2]
+                    + tempFrame[count2 + 1]+1) >> 1;
+                
+                block[count2] = (int16)(tempFrame2[count2] - tempVal);
+                sad+=ABS(block[count2]);
+                tempVal = (tempFrame[count2 + 1]
+                    + tempFrame[count2 + 2]+ 1) >> 1;
+                
+                block[count2 + 1] = (int16)(tempFrame2[count2 + 1] - tempVal);
+                sad+=ABS(block[count2+1]);
+                tempVal = (tempFrame[count2 + 2]
+                    + tempFrame[count2 + 3]+ 1) >> 1;
+                
+                block[count2 + 2] = (int16)(tempFrame2[count2 + 2] - tempVal);
+                sad+=ABS(block[count2+2]);
+                tempVal = (tempFrame[count2 + 3]
+                    + tempFrame[count2 + 4]+1) >> 1;
+                
+                block[count2 + 3] = (int16)(tempFrame2[count2 + 3] - tempVal);
+                sad+=ABS(block[count2+3]);
+                tempVal = (tempFrame[count2 + 4]
+                    + tempFrame[count2 + 5]+ 1) >> 1;
+                
+                block[count2 + 4] = (int16)(tempFrame2[count2 + 4] - tempVal);
+                sad+=ABS(block[count2+4]);
+                tempVal = (tempFrame[count2 + 5]
+                    + tempFrame[count2 + 6]+ 1) >> 1;
+                
+                block[count2 + 5] = (int16)(tempFrame2[count2 + 5] - tempVal);
+                sad+=ABS(block[count2+5]);
+                tempVal = (tempFrame[count2+ 6]
+                    + tempFrame[count2 + 7]
+                    + 1) >> 1;
+                
+                block[count2 + 6] = (int16)(tempFrame2[count2 + 6] - tempVal);
+                sad+=ABS(block[count2+6]);
+                tempVal = (tempFrame[count2 + 7]
+                    + tempFrame[count2 + 8]+ 1) >> 1;
+                
+                block[count2 + 7] = (int16)(tempFrame2[count2 + 7] - tempVal);
+                sad+=ABS(block[count2+7]);
+                block += BLOCK_SIZE;
+                tempFrame += extframeWidth;
+                tempFrame2 += curFrameWidth;
+            }
+        }
+        else    /* MV has full pel accuracy in both coordinates */
+        {
+            sad=0;
+            for (count1 = 0; count1 < BLOCK_SIZE; count1++)
+            {
+                for (count2 = 0; count2 < BLOCK_SIZE; count2++)
+                {
+                    block[count2] = (int16)(tempFrame2[count2]- tempFrame[count2]);
+                    sad+=ABS(block[count2]);
+                }
+                block += BLOCK_SIZE;
+                tempFrame += extframeWidth;
+                tempFrame2 += curFrameWidth;
+            }
+        }
+    }
+    return sad;
+}
+
+
+
+
+/* {{-output"vbmPutInterMBSVH.txt"}} */
+/*
+* vbmPutInterMBSVH
+*
+* Parameters:
+*     outBuf               pointer to the output bit-stream buffer structure
+*     mbData               pointer to the macro block data structure
+*     mbi                  pointer to macro block information structure.
+*     numTextureBits       pointer to store the number of bits needed to encode macro block
+*     predMV               pointer to the predicted motion vector data
+*     lastPos              pointer to last non-zero position of each block in the macro block
+*     colorEffect          color effect applied
+* Function:
+*     This function encodes INTER macroblock in SVH mode
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmPutInterMBSVH(tMacroblockData* mbData, tMBInfo* mbi, bibBuffer_t *outBuf, 
+                                            int32 *numTextureBits, tMotionVector* predMV, int32* lastPos, 
+                                            int16 colorEffect)
+{
+  int32  dQuant;
+    int32    mcbpcVal;
+    int32    index;
+    int32    cbpy;
+    int32    textureBits;
+    int16* coeff;
+    int32    len;
+    
+    vlbPutBits(outBuf, 1, mbi->SkippedMB);
+    if(mbi->SkippedMB == ON)
+    {
+        *numTextureBits = 0;
+        return;
+    }
+    
+    dQuant = mbi->dQuant;
+    mcbpcVal = colorEffect? 0 : (mbi->CodedBlockPattern & 3);
+    cbpy = (~((mbi->CodedBlockPattern >> 2) & 0xf)) & 0xf;
+    
+    /* only ONE MV in baseline H263 */
+    index = (dQuant == 0 ? 0 : 4) + mcbpcVal;
+    len = sCBPCPType[index].length + sCBPY[cbpy].length;
+    mcbpcVal = (sCBPCPType[index].code << sCBPY[cbpy].length) | sCBPY[cbpy].code;
+    
+    vlbPutBits(outBuf, len, mcbpcVal);
+    
+    if(dQuant != 0)
+    {
+        vlbPutBits(outBuf, 2, sDquant[dQuant + 2]);
+    }
+    
+    /* encode motion vectors */
+    {
+        vbmEncodeMVDifferential(mbi->MV[0][0] - predMV[0].mvx,
+            mbi->MV[0][1] - predMV[0].mvy,
+            1, outBuf);
+    }
+    
+    /* encode texture coefficents */
+    textureBits = 0;
+    cbpy = 32;
+    for (index = 0; index < (colorEffect ? 4 : 6); index++)
+    {
+        if(cbpy & mbi->CodedBlockPattern)
+        {
+            coeff = mbData->Data + index * 64;
+            textureBits += vlbCodeACCoeffsSVHWithZigZag(0, coeff, outBuf, ON, lastPos[index]);
+        }
+        cbpy >>= 1;
+    }
+    *numTextureBits = textureBits;
+    
+    return;
+}
+
+/*
+*******************************************************************************
+Name            : vbmPutInterMB
+Description     : INTER macroblock is encoded here.
+Parameter       : 
+    mbData: Pointer to the macro block data structure
+    mbi:        Pointer to the macro block information structure.
+    vopData:    Pointer to the VOP data structure.
+    currFrame:  Pointer to the current frame data
+    mbNo:       The number macro block being encoded.
+    numTextureBits:Pointer to store the number of bits taken to encode the macro block.
+    prevQuant:  Pointer to the quantization sacle.
+    blockSAD:   Pointer to store the block SAD values.                  
+    outBuf:     Pointer to the output bit-stream buffer structure
+    mvi:        Pointer to the MV array
+Return Value    : void
+*******************************************************************************
+*/
+/* {{-output"vbmPutInterMB.txt"}} */
+/*
+* vbmPutInterMB
+*
+* Parameters:
+*     outBuf               pointer to the output bit-stream buffer structure
+*     mbPos                pointer to macroblock position structure
+*     paramMB              pointer to macroblock parameters structure
+*     initPred             pointer to predictor motion vectors, pixel unit
+*     noOfPredictors       number of MV predictors
+*     numTextureBits       pointer to store the number of bits needed to encode macro block
+*     colorEffect          color effect applied
+*     vopWidth             width of frame/VOP
+*     vopHeight            height of frame/VOP
+*     mbsinfo              pointer to macro block information structure
+*     searchRange          search range
+* Function:
+*     This function encodes INTER macroblock
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vbmPutInterMB(tMBPosition* mbPos, bibBuffer_t *outBuf, dmdPParam_t *paramMB,
+                                     tMotionVector *initPred, int32 noOfPredictors, u_int32 vopWidth, 
+                                     u_int32 vopHeight,int32 searchRange, int32 mbNo, 
+                                     int32* numTextureBits, int16 colorEffect, tMBInfo *mbsinfo)
+{
+    int32           blkCnt;
+    tMotionVector   predMV[4];
+    int32           lastPosition[6] = {-1,-1,-1,-1,-1,-1};
+    tPixel *currBlockPos = NULL; 
+    tMotionVector bestMV; 
+    tMacroblockData mbData;
+    tMBInfo *mbi = mbsinfo + mbNo;
+    mbi->SkippedMB = OFF;
+    u_int32 yWidth = paramMB->uvWidth * 2;
+    
+    bestMV.mvx = 0;
+    bestMV.mvy = 0;
+    bestMV.SAD = MB_SIZE * MB_SIZE / 2; // quich search stop threshold
+    
+    vbmMEMBSpatioTemporalSearch(paramMB->refY, vopWidth,vopHeight,paramMB->currYMBInFrame, yWidth, 
+        mbPos, initPred, noOfPredictors, &bestMV,
+        searchRange, bestMV.SAD);
+    
+    /* update MV buffer */
+    mbi->MV[0][0] = bestMV.mvx;
+    mbi->MV[0][1] = bestMV.mvy;
+    mbi->SAD      = bestMV.SAD;
+    currBlockPos = paramMB->currYMBInFrame;
+    
+    for (blkCnt= 0; blkCnt < 4; blkCnt++)
+    {
+        int blkPosX, blkPosY;
+        blkPosX = (blkCnt & 1) ? mbPos->x + 8 : mbPos->x;
+        blkPosY = (blkCnt & 2) ? mbPos->y + 8 : mbPos->y;
+        
+        vbmPredictBlock(paramMB->refY, vopWidth, 0, currBlockPos, yWidth,
+            &mbData.Data[blkCnt * BLOCK_COEFF_SIZE], 
+            &bestMV, blkPosX, blkPosY);
+        vbmDCTQuantInterSVH(&mbData.Data[blkCnt * BLOCK_COEFF_SIZE], 
+            mbi, &(lastPosition[blkCnt]));
+        currBlockPos += 8;
+        if (blkCnt & 1)
+            currBlockPos += 8 * yWidth - 16;
+    }
+    
+    if (!colorEffect)
+    {
+        /* Find the Chrominance Block Motion vectors */
+        tMotionVector lChrMv;
+        
+        lChrMv.mvx = (int16)(bestMV.mvx % 4 == 0 ? bestMV.mvx >> 1 : (bestMV.mvx >> 1) | 1);
+        lChrMv.mvy = (int16)(bestMV.mvy % 4 == 0 ? bestMV.mvy >> 1 : (bestMV.mvy >> 1) | 1);
+        blkCnt = 4; /* U */
+        vbmPredictBlock(paramMB->refU, paramMB->uvWidth, 0, paramMB->currUBlkInFrame, paramMB->uvWidth,
+            &mbData.Data[blkCnt * BLOCK_COEFF_SIZE], 
+            &lChrMv, mbPos->x >> 1, mbPos->y >> 1);
+        vbmDCTQuantInterSVH(&mbData.Data[blkCnt * BLOCK_COEFF_SIZE], 
+            mbi, &(lastPosition[blkCnt]));
+        blkCnt = 5; /* V */
+        vbmPredictBlock(paramMB->refV, paramMB->uvWidth, 0, paramMB->currVBlkInFrame, paramMB->uvWidth,
+            &mbData.Data[blkCnt * BLOCK_COEFF_SIZE], 
+            &lChrMv, mbPos->x >> 1, mbPos->y >> 1);
+        vbmDCTQuantInterSVH(&mbData.Data[blkCnt * BLOCK_COEFF_SIZE], 
+            mbi, &(lastPosition[blkCnt]));
+    }
+    
+    vbmCBPYInter(mbi, lastPosition);
+    if((mbi->CodedBlockPattern == 0) &&
+        (mbi->MV[0][0] == 0) && (mbi->MV[0][1] == 0))
+    {
+        mbi->SkippedMB = ON;
+    }
+    else //(mbi->SkippedMB == OFF)
+    {
+        vbmMvPrediction(mbi, mbNo, predMV, vopWidth / MB_SIZE);
+    }
+    vbmPutInterMBSVH(&mbData, mbi, outBuf,
+        numTextureBits, predMV, lastPosition, colorEffect);
+    
+    return;
+}
+
+
+/* End of bma.cpp */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/core.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1357 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* H.263 decoder core functions.
+*
+*/
+
+
+/* 
+ * Includes 
+ */
+#include "h263dConfig.h"
+#include "vdc263.h"
+#include "core.h"
+#include "debug.h"
+#include "decblock.h" /* for dblFree and dblLoad */
+#include "decgob.h"
+#include "decpich.h"
+#include "h263dapi.h" /* for H263D_BC_MUX_MODE_SEPARATE_CHANNEL and H263D_ERD_ */
+#include "stckheap.h"
+#include "sync.h"
+#include "vdeims.h"
+#include "vdeimb.h"
+#include "viddemux.h"
+#include "biblin.h"
+#include "MPEG4Transcoder.h"
+
+
+/*
+ * Typedefs and structs
+ */
+
+/* This structure is used to indicate the expected decoding position. */
+typedef enum {
+   EDP_START_OF_FRAME,
+   EDP_START_OF_GOB_SEGMENT,
+   EDP_START_OF_SLICE_SEGMENT,
+   EDP_END_OF_FRAME
+} vdcExpectedDecodingPosition_t;
+
+
+/*
+ * Local function prototypes
+ */ 
+
+int vdcFillImageBuffers(
+   vdcInstance_t *instance,
+   int numOfCodedMBs,
+   vdeImb_t *imbP);
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"vdcClose.txt"}} */
+/*
+ * vdcClose
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *
+ * Function:
+ *    This function closes the instance. The function frees all the resources
+ *    allocated for the instance. The instance handle is no longer valid
+ *    after calling this function.
+ *
+ * Returns:
+ *    >= 0                       if the function was successful
+ *    < 0                        if an error occured
+ *
+ */
+
+int vdcClose(vdcHInstance_t hInstance)
+/* {{-output"vdcClose.txt"}} */
+{
+   vdcInstance_t *instance = (vdcInstance_t *) hInstance;
+   int retValue = VDC_OK;
+
+   if (instance == NULL)
+      return retValue;
+
+   mvcFree(&instance->mvcData);
+
+   if ( instance->prevPicHeader != NULL )
+      free( instance->prevPicHeader );
+
+   aicFree(&instance->aicData);
+
+              
+   if ( instance->user_data != NULL )
+      free( instance->user_data );
+
+
+   vdcDealloc(instance);
+
+   return retValue;
+}
+
+
+/* {{-output"vdcDecodeFrame.txt"}} */
+/*
+ * vdcDecodeFrame
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *
+ *    inBuffer                   pointer to bit buffer, the current position
+ *                               of the buffer must start with a PSC
+ *
+ * Function:
+ *    The vdcDecodeFrame function implements the decoding process described
+ *    in the H.263 recommendation (version 2). However, it does not support
+ *    the following features of the recommendation:
+ *       decoding using the H.261 standard (bit 2 in PTYPE),
+ *       source format changes during a video sequence.
+ *
+ *    The function decodes the next frame in
+ *    the buffer (inBuffer) meaning that the decoding continues until the next
+ *    PSC or EOS is found or until the end of the buffer is not reached.
+ *
+ * Returns:
+ *    VDC_OK                     if the function was succesful
+ *    VDC_OK_BUT_BIT_ERROR       if bit errors were detected but
+ *                               decoded frames are provided by concealing
+ *                               the errors
+ *    VDC_OK_BUT_FRAME_USELESS   if severe bit errors were detected
+ *                               (no concealment was possible) or
+ *                               the bitstream ended unexpectedly
+ *    VDC_ERR                    if a processing error occured,
+ *                               the instance should be closed
+ *
+ */
+
+
+int vdcDecodeFrame(vdcHInstance_t hInstance, bibBuffer_t *inBuffer, bibBuffer_t *outBuffer,
+                   bibBufferEdit_t *bufEdit, int aColorEffect, TBool aGetDecodedFrame,
+                   CMPEG4Transcoder *hTranscoder)
+
+/* {{-output"vdcDecodeFrame.txt"}} */
+{
+   int prevGN = -1;           /* GOB number of the latest decoded GOB */
+   int prevGNWithHeader = -1; /* GOB number of the latest decoded GOB with
+                                 a GOB header */
+
+   int numStuffBits;          /* Number of stuffing bits before the sync code */
+
+   int sncCode;               /* the latest synchronization code, see 
+                                 sncCheckSync for the possible values */
+
+   int rtr = -1;              /* reference tr, 0.. */
+   int trp = -1;              /* tr for prediction, -1 if not indicated in 
+                                 the bitstream */
+
+   int retValue = VDC_OK;     /* return value of this function */
+
+
+   int16 error = 0;           /* Used to pass error codes from the sync module */
+
+   u_char
+      *currYFrame = NULL,     /* current P frame */
+      *currUFrame = NULL,
+      *currVFrame = NULL,
+      *refYFrame = NULL,      /* reference frame */
+      *refUFrame = NULL,
+      *refVFrame = NULL;
+
+   u_char *fCodedMBs = NULL;  /* Pointer to table, which indicates coded \
+                                 macroblocks by non-zero value */
+   int numOfCodedMBs = 0;     /* The number of coded macroblocks */
+
+   int *quantParams = NULL;   /* Pointer to table, in which the quantization
+                                 parameter for each macroblock is stored */
+
+   int decStatus = 0;         /* Decoding status, returned from decgob.c */
+   int corruptedSegments = 0; /* counter for corrupted segments */
+   int decodedSegments = 0;   /* counter for decoded segments (used in slice mode) */
+   int headerSuccess = 0;     /* success of picture header */
+   int numDecodedMBs = 0;     /* Total number of decoded MBs */
+   int numMBsInFrame = 0;     /* Number of MBs in frame */
+
+
+   vdcExpectedDecodingPosition_t expectedDecodingPosition;
+                              /* Tells in which part of the bitstream
+                                 the decoding should be */
+
+   vdcInstance_t *instance = (vdcInstance_t *) hInstance;
+                              /* instance data */
+      
+   vdcAssert(instance != NULL);
+
+   /* Initializations */
+
+   instance->currFrame = NULL;
+   expectedDecodingPosition = EDP_START_OF_FRAME;
+   instance->pictureParam.prevTR = instance->pictureParam.tr;
+
+   /* Main loop */
+   for (;;) {
+      int bitErrorIndication = 0;
+
+      sncCode = sncCheckSync(inBuffer, &numStuffBits, &error);
+
+      /* If sncCheckSync failed */
+      if (error && error != ERR_BIB_NOT_ENOUGH_DATA) {
+         deb1p("vdcDecodeFrame: ERROR - sncCheckSync returned %d.\n", error);
+         retValue = VDC_ERR;
+         goto exitFunction;
+      }
+
+      /* If EOS was got */
+      if (sncCode == SNC_EOS)
+         instance->fEOS = 1;
+
+      /* If frame ends appropriately */
+      if (expectedDecodingPosition == EDP_END_OF_FRAME &&
+         (sncCode == SNC_PSC || sncCode == SNC_EOS || 
+          sncCode == SNC_STUFFING || error == ERR_BIB_NOT_ENOUGH_DATA )) {
+         goto exitFunction;
+      }
+
+      /* Else if frame (or stream) data ends suddenly */
+      else if (error == ERR_BIB_NOT_ENOUGH_DATA) {
+         retValue = VDC_OK_BUT_BIT_ERROR;
+         goto exitFunction;
+      }
+
+      /* Else if EOS was reached */
+      else if (sncCode == SNC_EOS) {
+         /* The current frame is useless since it ends before it is complete.
+            On the other hand, there is no point in concealing it since
+            it is the last frame of the sequence. */
+         retValue = VDC_OK_BUT_FRAME_USELESS;
+         goto exitFunction;
+      }
+
+      /* Else if frame starts as expected */
+      else if (expectedDecodingPosition == EDP_START_OF_FRAME &&
+         sncCode == SNC_PSC) {
+
+         dphInParam_t pichIn;
+         dphInOutParam_t pichInOut;
+         dphOutParam_t pichOut;
+
+         pichIn.numStuffBits = numStuffBits;
+         pichIn.fNeedDecodedFrame = aGetDecodedFrame | hTranscoder->NeedDecodedYUVFrame();
+
+         pichIn.fReadBits = 1;
+         pichInOut.vdcInstance = instance;
+         pichInOut.inBuffer = inBuffer;
+
+         if ( instance->fRPS ) {
+            /* Store the previous TR for VRC needs */
+            if ( instance->nOfDecodedFrames > 0 )
+               trp = instance->pictureParam.tr;
+            else
+               trp = -1;
+         }
+         /* Get picture header */
+         headerSuccess = dphGetPictureHeader(&pichIn, &pichInOut, &pichOut, &bitErrorIndication);
+
+         if (headerSuccess != DPH_OK) {
+            
+            deb("vdcDecodeFrame: Header decoding unsuccessful due to errors, picture will be discarded.\n");
+            retValue = VDC_OK_BUT_FRAME_USELESS;
+            goto exitFunction;
+         }
+
+         numMBsInFrame = renDriNumOfMBs(instance->currFrame->imb->drawItem);
+
+         currYFrame = pichOut.currYFrame;
+         currUFrame = pichOut.currUFrame;
+         currVFrame = pichOut.currVFrame;
+
+         numOfCodedMBs = 0;
+         fCodedMBs = renDriCodedMBs(instance->currFrame->imb->drawItem);
+         memset(fCodedMBs, 0, numMBsInFrame * sizeof(u_char));
+
+         /* Initialize quantization parameter array */
+         quantParams = instance->currFrame->imb->yQuantParams;
+         memset(quantParams, 0, numMBsInFrame * sizeof(int));
+
+         /* If this is the first frame and callback function has been set, report frame size */ 
+         if (instance->nOfDecodedFrames == 0 && instance->reportPictureSizeCallback) {
+            h263dReportPictureSizeCallback_t cb = 
+               (h263dReportPictureSizeCallback_t)instance->reportPictureSizeCallback;
+            cb(instance->hParent, instance->pictureParam.lumWidth, instance->pictureParam.lumHeight);
+         }
+
+         /* If picture header was ok */
+         if (headerSuccess == DPH_OK)
+         {
+            /* Get and decode Supplemental Enhancement Information */
+            int seiSuccess = dphGetSEI(instance, inBuffer, &bitErrorIndication);
+
+            /* If fatal error while reading SEI */
+            if (seiSuccess < 0) {
+               retValue = VDC_ERR;
+               deb("vdcDecodeFrame: dphGetSEI failed.\n");
+               goto exitFunction;
+            }
+
+            /* Else if bit error while reading SEI */
+            else if (seiSuccess == DPH_OK_BUT_BIT_ERROR) {
+               /* We can't trust that the 1st segment can be decoded.
+                  Thus, let's continue with the 2nd segment. */
+               if ( instance->pictureParam.fSS )
+                  expectedDecodingPosition = EDP_START_OF_SLICE_SEGMENT;
+               else
+                  expectedDecodingPosition = EDP_START_OF_GOB_SEGMENT;
+               sncCode = sncSeekSync(inBuffer, &error);
+               if (error && error != ERR_BIB_NOT_ENOUGH_DATA) {
+                  retValue = VDC_ERR;
+                  deb("vdcDecodeFrame: sncSeekSync failed.\n");
+                  goto exitFunction;
+               }
+               continue;
+            }
+
+
+         }
+
+         if ( hTranscoder->H263PictureHeaderEnded(&pichOut, &pichInOut) != VDC_OK )
+            {
+              retValue = VDC_ERR;
+              goto exitFunction;
+            }
+
+         if (instance->pictureParam.fSS)
+         /* Decode the 1st Slice segment - not supported */
+         {
+             retValue = VDC_OK_BUT_FRAME_USELESS;
+             goto exitFunction;
+         }
+         else
+         /* Decode the 1st GOB segment */
+         {
+            dgobGOBSegmentInParam_t dgobi;
+            dgobGOBSegmentInOutParam_t dgobio;
+
+            dgobi.numStuffBits = 0;
+            dgobi.pictParam = &instance->pictureParam;
+            dgobi.inBuffer = inBuffer;
+
+            dgobi.outBuffer = outBuffer;
+            dgobi.bufEdit = bufEdit;
+
+            dgobi.iColorEffect = aColorEffect; 
+            dgobi.iGetDecodedFrame=aGetDecodedFrame;
+            dgobio.StartByteIndex=0;
+            dgobio.StartBitIndex=7;
+
+            /* fGFIDShouldChange not relevant here */
+
+            dgobio.prevGNWithHeader = 0;
+            dgobio.prevGN = 0;
+            /* dgobio.gfid, not relevant here */
+            dgobio.fCodedMBs = fCodedMBs;
+            dgobio.numOfCodedMBs = numOfCodedMBs;
+            dgobio.quantParams = quantParams;
+            dgobio.mvcData = &instance->mvcData;
+            dgobio.imageStore = instance->imageStore;
+            dgobio.trp = pichOut.trp;
+            dgobio.rtr = 0; /* not relevant since no reference frame exists yet */
+            dgobio.refY = refYFrame;
+            dgobio.refU = refUFrame;
+            dgobio.refV = refVFrame;
+            dgobio.currPY = currYFrame;
+            dgobio.currPU = currUFrame;
+            dgobio.currPV = currVFrame;
+
+            /* the first GOB doesn't have a header */
+            hTranscoder->H263GOBSliceHeaderBegin();
+            hTranscoder->H263GOBSliceHeaderEnded(NULL, NULL);
+
+            decStatus = dgobGetAndDecodeGOBSegmentContents(&dgobi, 
+               instance->pictureParam.pictureType != VDX_PIC_TYPE_I,
+               pichOut.pquant, &dgobio, hTranscoder);
+
+            if (decStatus < 0) {
+               retValue = VDC_ERR;
+               goto exitFunction;
+            }
+
+            hTranscoder->H263OneGOBSliceWithHeaderEnded();
+
+            prevGNWithHeader = dgobio.prevGNWithHeader;
+            prevGN = dgobio.prevGN;
+            numOfCodedMBs = dgobio.numOfCodedMBs;
+            trp = dgobio.trp;
+            rtr = dgobio.rtr;
+            refYFrame = dgobio.refY;
+            refUFrame = dgobio.refU;
+            refVFrame = dgobio.refV;
+            if (prevGN == instance->pictureParam.numGOBs - 1)
+               expectedDecodingPosition = EDP_END_OF_FRAME;
+            else
+               expectedDecodingPosition = EDP_START_OF_GOB_SEGMENT;
+         }
+      }
+   
+      /* Else if GOB segment starts as expected */
+      else if (expectedDecodingPosition == EDP_START_OF_GOB_SEGMENT &&
+         sncCode == SNC_GBSC) {
+
+         dgobGOBSegmentInParam_t dgobi;
+         dgobGOBSegmentInOutParam_t dgobio;
+
+         dgobi.numStuffBits = numStuffBits;
+         dgobi.pictParam = &instance->pictureParam;
+         dgobi.inBuffer = inBuffer;
+
+         dgobi.outBuffer = outBuffer;
+         dgobi.bufEdit = bufEdit;
+
+         dgobi.iColorEffect = aColorEffect; 
+         dgobi.iGetDecodedFrame= aGetDecodedFrame;
+         if(prevGN==-1)
+         {
+             dgobio.StartByteIndex=0;
+             dgobio.StartBitIndex=7;
+         }
+         else
+         {
+             dgobio.StartByteIndex=dgobi.inBuffer->getIndex;
+             dgobio.StartBitIndex=dgobi.inBuffer->bitIndex;
+         }
+
+
+         /* fGFIDShouldChange, see below */
+
+         dgobio.prevGNWithHeader = prevGNWithHeader;
+         dgobio.prevGN = prevGN;
+         /* dgobio.gfid, see below */
+         dgobio.fCodedMBs = fCodedMBs;
+         dgobio.numOfCodedMBs = numOfCodedMBs;
+         dgobio.quantParams = quantParams;
+         dgobio.mvcData = &instance->mvcData;
+         dgobio.imageStore = instance->imageStore;
+         dgobio.trp = trp;
+         dgobio.rtr = rtr;
+         dgobio.refY = refYFrame;
+         dgobio.refU = refUFrame;
+         dgobio.refV = refVFrame;
+         dgobio.currPY = currYFrame;
+         dgobio.currPU = currUFrame;
+         dgobio.currPV = currVFrame;
+
+         dgobi.fGFIDShouldChange = instance->fGFIDShouldChange;
+         dgobio.gfid = instance->gfid;
+
+         /* Get and decode GOB segment */
+         decStatus = dgobGetAndDecodeGOBSegment(&dgobi, &dgobio, hTranscoder);
+
+         if (decStatus == DGOB_ERR) {
+            retValue = VDC_ERR;
+            goto exitFunction;
+         }
+         if ( instance->fGFIDShouldChange ) {
+            instance->gfid = dgobio.gfid;
+            instance->fGFIDShouldChange = 0;
+         }
+
+         prevGNWithHeader = dgobio.prevGNWithHeader;
+         prevGN = dgobio.prevGN;
+         numOfCodedMBs = dgobio.numOfCodedMBs;
+         trp = dgobio.trp;
+
+
+         rtr = dgobio.rtr;
+
+         refYFrame = dgobio.refY;
+         refUFrame = dgobio.refU;
+         refVFrame = dgobio.refV;
+
+         if (prevGN == instance->pictureParam.numGOBs - 1)
+            expectedDecodingPosition = EDP_END_OF_FRAME;
+         else
+            expectedDecodingPosition = EDP_START_OF_GOB_SEGMENT;
+      }
+
+      /* Else if Slice segment starts as expected */
+      else if (expectedDecodingPosition == EDP_START_OF_SLICE_SEGMENT &&
+         sncCode == SNC_GBSC) {
+         /* slides not supported */
+         retValue = VDC_OK_BUT_FRAME_USELESS;
+         goto exitFunction;
+
+      }
+
+      /* Else decoding is out of sync */
+      else {
+         switch (expectedDecodingPosition) {
+
+            case EDP_START_OF_FRAME:
+               /* No PSC */
+               /* Check if GFID could be used to recover the picture header */
+               {
+                  dphInParam_t pichIn;
+                  dphInOutParam_t pichInOut;
+                  dphOutParam_t pichOut;
+
+                  pichIn.numStuffBits = numStuffBits;
+                  pichIn.fReadBits = 0;
+
+                  pichInOut.vdcInstance = instance;
+                  pichInOut.inBuffer = inBuffer;
+
+                  headerSuccess = dphGetPictureHeader(&pichIn, &pichInOut, &pichOut, &bitErrorIndication);
+                  if ( headerSuccess == DPH_OK) {
+                     /* Header recovery was successful, start decoding from the next GOB available */
+                     if ( instance->pictureParam.fSS ) {
+                        expectedDecodingPosition = EDP_START_OF_SLICE_SEGMENT;
+                        /* decSlice does not increment these */
+                        decodedSegments++;
+                        corruptedSegments++;
+                     }
+                     else
+                        expectedDecodingPosition = EDP_START_OF_GOB_SEGMENT;
+                     deb1p("vdcDecodeFrame: Header successfully recovered after PSC loss. FrameNum %d\n",instance->frameNum);
+                     currYFrame = pichOut.currYFrame;
+                     currUFrame = pichOut.currUFrame;
+                     currVFrame = pichOut.currVFrame;
+                     numMBsInFrame = renDriNumOfMBs(instance->currFrame->imb->drawItem);
+                     numOfCodedMBs = 0;
+                     numDecodedMBs = 0;
+                     fCodedMBs = renDriCodedMBs(instance->currFrame->imb->drawItem);
+                     memset(fCodedMBs, 0, numMBsInFrame * sizeof(u_char));
+
+                     /* Initialize quantization parameter array */
+                     quantParams = instance->currFrame->imb->yQuantParams;
+                     memset(quantParams, 0, numMBsInFrame * sizeof(int));
+
+                     /* If this is the first frame and callback function has been set, report frame size */ 
+                     if (instance->nOfDecodedFrames == 0 && instance->reportPictureSizeCallback) {
+                        h263dReportPictureSizeCallback_t cb = 
+                           (h263dReportPictureSizeCallback_t)instance->reportPictureSizeCallback;
+                        cb(instance->hParent, instance->pictureParam.lumWidth, instance->pictureParam.lumHeight);
+                     }
+
+                     continue;
+                  }
+                  else {
+                     retValue = VDC_OK_BUT_FRAME_USELESS;
+                     deb1p("vdcDecodeFrame: Header recovery unsuccessful after PSC loss. FrameNum %d\n",instance->frameNum);
+                     goto exitFunction;
+                  }
+               }
+            case EDP_START_OF_GOB_SEGMENT:
+               if ( sncCode == SNC_PSC ) {
+                  retValue = VDC_OK_BUT_BIT_ERROR;
+                  goto exitFunction;
+               }
+               else {
+                  /* 
+                   * Picture header recovery used next picture header 
+                   * => we are not at the position of GBSC => search the next one 
+                   * This is caused by a erdRestorePictureHeader that does not synchronize 
+                   * bit buffer to GOB headers that have bitErrorIndication != 0.
+                   * This may be considered as a , and it might be good to change it later on.
+                   * This seeking should solve the problem, although maybe not in the most elegant way
+                   */
+                  sncSeekSync( inBuffer, &error );
+                  continue;
+               }
+           default :
+            {
+            
+                retValue = VDC_OK_BUT_FRAME_USELESS;
+                 goto exitFunction;
+            }
+
+         }
+      }
+   }
+
+   exitFunction:
+
+
+   /* If frame(s) not useless */
+   if (retValue == VDC_OK || retValue == VDC_OK_BUT_BIT_ERROR) {
+
+      if (!corruptedSegments && (numDecodedMBs > 0 || prevGN > 0 || instance->pictureParam.numGOBs == 1))
+         retValue = VDC_OK;
+      else {
+         retValue = VDC_OK_BUT_FRAME_USELESS;
+         deb1p("vdcDecodeFrame: Frame useless, too many corrupted segments. FrameNum %d\n",instance->frameNum);
+      }
+   }
+
+   /* If decoding ok and frame not useless */
+   if ( retValue == VDC_OK || retValue == VDC_OK_BUT_BIT_ERROR ) {
+
+
+       /* stuff bits here 'END OF FRAME' -->*/
+         bibStuffBits(outBuffer); 
+       /* <-- */
+
+      if ( instance->nOfDecodedFrames < 0xffffffff )
+         instance->nOfDecodedFrames++;
+
+      if (vdcFillImageBuffers(
+         instance, 
+         numOfCodedMBs, 
+         instance->currFrame->imb) < 0)
+         retValue = VDC_ERR;
+
+
+
+   }
+   if ( retValue == VDC_OK_BUT_FRAME_USELESS ) {
+      /* GFID of the next frame can be whatever, since this frame was useless */
+      instance->gfid = -1; 
+   }
+   if ( instance->fGFIDShouldChange
+        && (    (instance->pictureParam.fSS && decodedSegments == 1) 
+             || (!instance->pictureParam.fSS && prevGNWithHeader <= 0) 
+           )
+      ) 
+   {
+      /* GFID of the next frame can be whatever, since this frame didn't have any GFID's and GFID was supposed to change */
+      instance->gfid = -1; 
+   }
+
+   /* If a fatal error occurred */
+   if (retValue < 0) {
+      /* Return frame buffers for decoded output images,
+         as they are useless for the caller and 
+         as the caller cannot get a handle to return them */
+      if (instance->currFrame)
+         vdeImsPutFree(instance->imageStore, instance->currFrame);
+   }
+
+   return retValue;
+}
+
+
+/* {{-output"vdcDecodePictureHeader.txt"}} */
+/*
+ * vdcDecodePictureHeader
+ *
+ * Parameters:
+ *    hInstance                  I: handle of instance data
+ *                               (May set instance->errorVar if bit errors.)
+ *
+ * Function:
+ *    
+ *
+ * Note:
+ *    This function does not recover corrupted picture headers (by means of
+ *    GFID or redundant picture header copies).
+ *
+ * Returns:
+ *    See above.
+ */
+
+int vdcDecodePictureHeader(
+   vdcHInstance_t hInstance,
+   bibBuffer_t *inBuffer,
+   vdxPictureHeader_t *header,
+   vdxSEI_t *sei)
+{
+   int
+      retValue = VDC_OK, 
+      sncCode,
+      numStuffBits,
+      bitErrorIndication = 0;
+
+   int16
+      error = 0;
+
+   u_int32
+      pictureStartPosition;
+
+   vdcInstance_t 
+      *instance = (vdcInstance_t *) hInstance;
+
+   /* The function is implemented by calling stateless Video Demultiplexer
+      (vdx) functions. Consequently, the function does not have sophisticated
+      logic to track illegal/corrupted parameters based on the previous
+      picture header. It cannot recover corrupted picture headers either.
+
+      Alternatively, the function could have been implemented by creating
+      an identical copy of the Video Decoder Core instance and by using
+      "Decode Picture Header" (dph) module functions. However, as there is
+      no instance copying functions implemented, the former alternative
+      was chosen.
+
+      This function was targeted for getting the picture type and 
+      Nokia-proprietary Annex N scalability layer information encapsulated
+      in Supplemental Enhancement Information in an error-free situation.
+      For this purpose, the former and simpler solution is more than 
+      adequate. */
+
+   pictureStartPosition = bibNumberOfFlushedBits(inBuffer);
+   sncCode = sncCheckSync(inBuffer, &numStuffBits, &error);
+
+   /* If sncCheckSync failed */
+   if (error) {
+      deb1p("vdcDecodeFrame: ERROR - sncCheckSync returned %d.\n", error);
+      retValue = VDC_ERR;
+      goto exitFunction;
+   }
+
+   /* Else if EOS was got */
+   else if (sncCode == SNC_EOS) {
+      retValue = VDC_OK_BUT_FRAME_USELESS;
+      goto exitFunction;
+   }
+
+   /* Else if frame starts as expected */
+   else if (sncCode == SNC_PSC) {
+      int
+         picHdrStatus,
+         seiStatus;
+
+      vdxGetPictureHeaderInputParam_t
+         picHdrIn;
+
+      picHdrIn.numStuffBits = numStuffBits;
+      picHdrIn.fCustomPCF = 0;
+      picHdrIn.fScalabilityMode = 0;
+      picHdrIn.fRPS = instance->fRPS;
+      picHdrIn.flushBits = bibFlushBits;
+      picHdrIn.getBits = bibGetBits;
+      picHdrIn.showBits = bibShowBits;
+
+      /* Get picture header */
+      picHdrStatus = vdxGetPictureHeader(
+         inBuffer, 
+         &picHdrIn,
+         header,
+         &bitErrorIndication);
+
+      /* If the header was not successfully retrieved */
+      if (picHdrStatus < 0) {
+         retValue = VDC_ERR;
+         goto exitFunction;
+      }
+      else if (picHdrStatus != VDX_OK) {
+         retValue = VDC_OK_BUT_BIT_ERROR;
+         goto exitFunction;
+      }
+
+      /* Get and decode Supplemental Enhancement Information */
+      seiStatus = vdxGetAndParseSEI(
+         inBuffer,
+         instance->pictureParam.fPLUSPTYPE,
+         instance->numAnnexNScalabilityLayers,
+         sei,
+         &bitErrorIndication);
+
+      /* If error while reading SEI */
+      if (seiStatus < 0) {
+         retValue = VDC_ERR;
+         goto exitFunction;
+      }
+      else if (seiStatus != VDX_OK) {
+         retValue = VDC_OK_BUT_BIT_ERROR;
+         goto exitFunction;
+      }
+   }
+
+   /* Else no valid frame start */
+   else
+      retValue = VDC_OK_BUT_FRAME_USELESS;
+
+   exitFunction:
+
+   /* Reset the bit buffer to its original position */
+   bibRewindBits(
+      bibNumberOfFlushedBits(inBuffer) - pictureStartPosition,
+      inBuffer, &error);
+
+   if (error)
+      retValue = VDC_ERR;
+
+   return retValue;
+}
+
+
+/* {{-output"vdcFree.txt"}} */
+/*
+ * vdcFree
+ *    
+ *
+ * Parameters:
+ *    None.
+ *
+ * Function:
+ *    This function deinitializes the Video Decoder Core module.
+ *    Any functions of this module must not be called after vdcFree (except 
+ *    vdcLoad).
+ *
+ * Returns:
+ *    >= 0  if succeeded
+ *    < 0   if failed
+ *
+ *    
+ */
+
+int vdcFree(void)
+/* {{-output"vdcFree.txt"}} */
+{
+   if (dblFree() < 0)
+      return VDC_ERR;
+
+   return VDC_OK;
+}
+
+
+/* {{-output"vdcGetImsItem.txt"}} */
+/*
+ * vdcGetImsItem
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *    index                      output frame number,
+ *                               should be 0 for I and P frames
+ *
+ * Function:
+ *    This function returns a pointer to the requested output frame.
+ *
+ * Returns:
+ *    a pointer to a image store item which corresponds to the passed output
+ *    frame index, or
+ *    NULL if the function fails
+ *
+ */
+
+vdeImsItem_t *vdcGetImsItem(vdcHInstance_t hInstance, int index)
+/* {{-output"vdcGetImsItem.txt"}} */
+{
+   vdcInstance_t *instance = (vdcInstance_t *) hInstance;
+   int numOutputFrames = vdcGetNumberOfOutputFrames(hInstance);
+
+   vdcAssert(instance);
+   vdcAssert(index >= 0);
+
+   if (index >= numOutputFrames)
+      return NULL;
+
+   return instance->currFrame;
+}
+
+   
+/* {{-output"vdcGetNumberOfAnnexNScalabilityLayers.txt"}} */
+/*
+ * vdcGetNumberOfAnnexNScalabilityLayers
+ *
+ * Parameters:
+ *    hInstance                  I: handle of instance data
+ *
+ * Function:
+ *    Returns the number of Nokia-proprietary Annex N temporal scalability
+ *    layers.
+ *
+ * Returns:
+ *    See above.
+ */
+
+int vdcGetNumberOfAnnexNScalabilityLayers(
+   vdcHInstance_t hInstance)
+/* {{-output"vdcGetNumberOfAnnexNScalabilityLayers.txt"}} */
+{
+   vdcInstance_t *instance = (vdcInstance_t *) hInstance;
+
+   vdcAssert(instance);
+
+   return instance->numAnnexNScalabilityLayers;
+}
+
+
+/* {{-output"vdcGetNumberOfOutputFrames.txt"}} */
+/*
+ * vdcGetNumberOfOutputFrames
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *
+ * Function:
+ *    This function returns the number of output frames which were produced
+ *    during the latest vdcDecodeFrame. 
+ *
+ * Returns:
+ *    0 if vdcDecodeFrame failed to produce any output frames
+ *    1 for I and P frames
+ *
+ */
+
+int vdcGetNumberOfOutputFrames(vdcHInstance_t hInstance)
+/* {{-output"vdcGetNumberOfOutputFrames.txt"}} */
+{
+   vdcInstance_t *instance = (vdcInstance_t *) hInstance;
+
+   vdcAssert(instance);
+
+   return ((instance->currFrame) ? 1 : 0);
+}
+
+
+/* {{-output"vdcGetTR.txt"}} */
+/*
+ * vdcGetTR
+ *    
+ *
+ * Parameters:
+ *    inpBuffer                  buffer containing the frame data,
+ *                               must start with a PSC
+ *    tr                         temporal reference
+ *
+ * Function:
+ *    Gets the temporal reference field from the input buffer.
+ *    Notice that the validity of the bitstream is not checked.
+ *    This function does not support enhanced temporal reference
+ *    (ETR) defined in section 5.1.8 of the H.263 recommendation.
+ *
+ * Returns:
+ *    Nothing
+ *
+ *    
+ */
+
+void vdcGetTR(void *inpBuffer, u_int8 *tr)
+/* {{-output"vdcGetTR.txt"}} */
+{
+   const u_char 
+      *tmpBuffer = (u_char *) inpBuffer;
+
+   *tr = (u_int8) (((tmpBuffer[2] & 2) << 6) | ((tmpBuffer[3] & 252) >> 2));
+}
+
+
+/* {{-output"vdcIsEOSReached.txt"}} */
+/*
+ * vdcIsEOSReached
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *
+ * Function:
+ *    This function returns 1 if the EOS code has been reached during
+ *    the decoding. Otherwise, it returns 0.
+ *
+ * Returns:
+ *    See above.
+ *
+ */
+
+int vdcIsEOSReached(vdcHInstance_t hInstance)
+/* {{-output"vdcIsEOSReached.txt"}} */
+{
+   vdcInstance_t *instance = (vdcInstance_t *) hInstance;
+
+   vdcAssert(instance);
+
+   return instance->fEOS;
+}
+
+
+/* {{-output"vdcIsINTRA.txt"}} */
+/*
+ * vdcIsINTRA
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *    frameStart                 pointer to memory chunk containing a frame
+ *    frameLength                number of bytes in frame
+ *
+ * Function:
+ *    This function returns 1 if the passed frame is an INTRA frame.
+ *    Otherwise the function returns 0.
+ *
+ * Returns:
+ *    See above.
+ *
+ *    
+ */
+
+int vdcIsINTRA(
+   vdcHInstance_t hInstance,
+   void *frameStart,
+   unsigned frameLength)
+/* {{-output"vdcIsINTRA.txt"}} */
+{
+   bibBuffer_t *tmpBitBuffer;
+   int fINTRA = 0, bitErrorIndication, syncCode, vdxStatus;
+   int16 error = 0;
+   vdcInstance_t *instance = (vdcInstance_t *) hInstance;
+   vdxGetPictureHeaderInputParam_t vdxIn;
+   vdxPictureHeader_t vdxOut;
+
+   vdcAssert(instance);
+
+   tmpBitBuffer = bibCreate(frameStart, frameLength, &error);
+   if (!tmpBitBuffer || error)
+      return 0;
+
+   syncCode = sncCheckSync(tmpBitBuffer, &(vdxIn.numStuffBits), &error);
+
+   if (syncCode == SNC_PSC && error == 0) {
+
+      /* Note: Needs to be changed when support for custom PCF or scalability mode
+         is added */
+      vdxIn.fCustomPCF = 0; 
+      vdxIn.fScalabilityMode = 0;
+      vdxIn.fRPS = instance->fRPS;
+      vdxIn.flushBits = bibFlushBits;
+      vdxIn.getBits = bibGetBits;
+      vdxIn.showBits = bibShowBits;
+
+      vdxStatus = vdxGetPictureHeader(tmpBitBuffer, &vdxIn, &vdxOut, 
+         &bitErrorIndication);
+
+      if (vdxStatus >= 0 && bitErrorIndication == 0)
+         fINTRA = (vdxOut.pictureType == VDX_PIC_TYPE_I);
+   }
+
+   bibDelete(tmpBitBuffer, &error);
+
+   return fINTRA;
+}
+
+
+/* {{-output"vdcIsINTRAGot.txt"}} */
+/*
+ * vdcIsINTRAGot
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *
+ * Function:
+ *    This function returns 1 if the an INTRA frame has been decoded
+ *    during the lifetime of the instance. Otherwise, it returns 0.
+ *
+ * Returns:
+ *    See above.
+ *
+ *    
+ */
+
+int vdcIsINTRAGot(vdcHInstance_t hInstance)
+/* {{-output"vdcIsEOSReached.txt"}} */
+{
+   vdcInstance_t *instance = (vdcInstance_t *) hInstance;
+
+   vdcAssert(instance);
+
+   return instance->fIntraGot;
+}
+
+
+/* {{-output"vdcLoad.txt"}} */
+/*
+ * vdcLoad
+ *    
+ *
+ * Parameters:
+ *    None.
+ *
+ * Function:
+ *    This function initializes the Video Decoder Core module meaning
+ *    all the data common to all Video Decoder Core instances.
+ *    vdcLoad has to be called before any other function of this module
+ *    is used.
+ *
+ * Returns:
+ *    >= 0  if succeeded
+ *    < 0   if failed
+ *
+ *    
+ */
+
+int vdcLoad(void)
+/* {{-output"vdcLoad.txt"}} */
+{
+   if (dblLoad() < 0)
+      return VDC_ERR;
+
+   return VDC_OK;
+}
+
+
+/* {{-output"vdcOpen.txt"}} */
+/*
+ * vdcOpen
+ *    
+ *
+ * Parameters:
+ *    imageStore                 pointer to image store instance
+ *    numReferenceFrames         1 if the Reference Picture Selection (RPS)
+ *                               mode (Annex N) should not be used,
+ *                               >1 tells how many reference images
+ *                               are stored in the RPS mode
+ *    fudInstance                pointer to Fast Update module instance
+ *    hParent                    handle of Video Decoder Engine instance
+ *                               that created this VDC instance
+ *
+ * Function:
+ *    This function creates and initializes a new Video Decoder Core instance.
+ *
+ * Returns:
+ *    a handle to the created instance,
+ *    or NULL if the function fails
+ *
+ *    
+ */
+
+vdcHInstance_t vdcOpen(
+   vdeIms_t *imageStore, 
+   int numReferenceFrames,
+   void *hParent)
+{
+   vdcInstance_t *instance;
+
+   vdcAssert(numReferenceFrames >= 1);
+
+   instance = (vdcInstance_t *) vdcMalloc(sizeof(vdcInstance_t));
+   if (!instance)
+      return NULL;
+   memset(instance, 0, sizeof(vdcInstance_t));
+
+   instance->prevPicHeader = (vdxPictureHeader_t *)vdcMalloc( sizeof( vdxPictureHeader_t ));
+   if ( instance->prevPicHeader == NULL ) {
+      deb("vdcOpen, MALLOC for prevPicHeader failed.\n");
+      goto errPHOpen;
+   }
+   instance->fPrevPicHeaderReliable = 1;
+
+   instance->imageStore = imageStore;
+
+   instance->numAnnexNScalabilityLayers = -1; /* Indicates no decoded frames */
+
+   instance->fGFIDShouldChange = 0;
+   instance->gfid = -1;
+
+   instance->nOfDecodedFrames = 0;
+
+   instance->hParent = hParent;
+   instance->snapshotStatus = -1;
+
+   return (vdcHInstance_t) instance;
+
+   /* Error cases: release everything in reverse order */
+   errPHOpen:
+
+   vdcDealloc(instance);
+   return NULL;
+}
+/* {{-output"vdcOpen.txt"}} */
+
+
+/* {{-output"vdcRestartVideo.txt"}} */
+/*
+ * vdcRestartVideo
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *
+ * Function:
+ *    Resets the instance data but does not deallocate the allocated buffers.
+ *    After this function vdcDecodeFrame can be called as if no data for this
+ *    instance has been decoded.
+ *
+ * Note:
+ *    This function is obsolete and not used anymore. If it is needed again,
+ *    it should be re-implemented.
+ *
+ * Returns:
+ *    Nothing
+ *
+ *    
+ */
+
+void vdcRestartVideo(vdcHInstance_t hInstance)
+/* {{-output"vdcRestartVideo.txt"}} */
+{
+   vdcInstance_t *instance = (vdcInstance_t *) hInstance;
+
+   if (instance)
+      memset(instance, 0, sizeof(vdcInstance_t));
+}
+
+
+
+
+
+/*
+ * Local functions
+ */
+
+/*
+ * vdcFillCommonPartsOfImb
+ *    
+ *
+ * Parameters:
+ *    instance                   instance data
+ *    numOfCodedMBs              number of coded macroblocks
+ *    imb                        pointer to image buffer to fill
+ *
+ * Function:
+ *    This function fills the passed image buffer according to the latest
+ *    decoding results. Only those parts of the image buffer are filled
+ *    which can be composed with the presence of another image buffer,
+ *    e.g. the P image buffer corresponding to the B image buffer.
+ *
+ * Returns:
+ *    Nothing
+ *
+ *    
+ */
+
+static void vdcFillCommonPartsOfImb(
+   vdcInstance_t *instance, 
+   int numOfCodedMBs,
+   vdeImb_t *imb)
+{
+   vdcAssert(imb);
+   vdcAssert(instance);
+
+   imb->drawItem->param.dwFlags = 0;
+   imb->drawItem->param.lTime = instance->frameNum;
+
+   /* Note: for now, convert whole frame */
+   imb->drawItem->extParam.flags = 0;
+   /* Else one could convert just coded MBs as follows: */
+      /* imb->drawItem->extParam.flags = (fBPart) ? 0 : REN_EXTDRAW_NEW_SOURCE; */
+
+   imb->drawItem->extParam.rate = 30000;
+   imb->drawItem->extParam.scale = 1001;
+   imb->drawItem->extParam.numOfCodedMBs = numOfCodedMBs;
+
+   /* imb->drawItem->retFrame and imb->drawItem->retFrameParam are set by
+      the caller */
+
+   imb->fReferenced = 1;
+   imb->tr = instance->pictureParam.tr;
+}
+
+
+/*
+ * vdcFillImageBuffers
+ *    
+ *
+ * Parameters:
+ *    instance                   instance data
+ *    numOfCodedMBs              number of coded macroblocks
+ *    imbP                       pointer to image buffer of P or I frame
+ *
+ * Function:
+ *    This function fills the passed image buffers according to the latest
+ *    decoding results.
+ *
+ * Returns:
+ *    >= 0                       if the function was successful
+ *    < 0                        if an error occured
+ *
+ *    
+ */
+
+/* Codec and renderer dependent */
+int vdcFillImageBuffers(
+   vdcInstance_t *instance, 
+   int numOfCodedMBs,
+   vdeImb_t *imbP)
+{
+   /* Table to convert from lumiance quantization parameter to chrominance
+      quantization parameter if Modified Quantization (Annex T) is in use. */
+   static const int yToUVQuantizer[32] = 
+      {0,1,2,3,4,5,6,6,7,8,9,9,10,10,11,11,12,
+       12,12,13,13,13,14,14,14,14,14,15,15,15,
+       15,15};
+
+   int
+      firstQPIndex,        /* the index of the first non-zero quantizer */
+
+      *yQuantParams = imbP->yQuantParams,
+                           /* array of Y quantizers in scan-order */
+
+      *uvQuantParams = imbP->uvQuantParams,
+                           /* array of UV quantizers in scan-order */
+
+      numMBsInPicture,     /* number of macroblocks in the image */
+
+      i;                   /* loop variable */
+
+   vdcAssert(imbP);
+   vdcAssert(instance);
+
+   /*
+    * Fill basic stuff
+    */
+
+   vdcFillCommonPartsOfImb(instance, numOfCodedMBs, imbP);
+
+   /*
+    * Calculate quantizer arrays for loop/post-filtering
+    */
+
+   numMBsInPicture = instance->pictureParam.lumMemWidth * 
+      instance->pictureParam.lumMemHeight / 256;
+
+   /* Get the index of the first non-zero quantizer in scan-order */
+   for (firstQPIndex = 0; firstQPIndex < numMBsInPicture; firstQPIndex++) {
+      if (yQuantParams[firstQPIndex] > 0)
+         break;
+   }
+
+   /* Assert that at least one macroblock is decoded successfully */
+   vdcAssert(firstQPIndex < numMBsInPicture);
+
+   /* Replace the first zero quantizers with the first non-zero quantizer
+      (in scan-order) */
+   for (i = 0; i < firstQPIndex; i++)
+      yQuantParams[i] = yQuantParams[firstQPIndex];
+
+   /* Replace all other zero quantizers with the predecessor (in scan-order) */
+   for (i = firstQPIndex; i < numMBsInPicture; i++) {
+      if (yQuantParams[i] == 0)
+         yQuantParams[i] = yQuantParams[i - 1];
+   }
+
+   /* If Modified Quantization is in use */
+   if (instance->pictureParam.fMQ) {
+      /* Convert Y quantizers to UV quantizers */
+      for (i = 0; i < numMBsInPicture; i++)
+         uvQuantParams[i] = yToUVQuantizer[yQuantParams[i]];
+   }
+   else
+      /* Copy Y quantizers to UV quantizers */
+      memcpy(uvQuantParams, yQuantParams, numMBsInPicture * sizeof(int));
+
+
+   return VDC_OK;
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/core_mpeg.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,671 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* MPEG-4 decoder core functions.
+*
+*/
+
+
+/* 
+ * Includes
+ */
+#include "h263dConfig.h"
+#include "vdc263.h"
+#include "core.h"
+#include "debug.h"
+#include "decblock.h" /* for dblFree and dblLoad */
+#include "decvp_mpeg.h"
+#include "decpich.h"
+#include "h263dapi.h" /* for H263D_BC_MUX_MODE_SEPARATE_CHANNEL and H263D_ERD_ */
+#include "stckheap.h"
+#include "sync.h"
+#include "vdeims.h"
+#include "vdeimb.h"
+#include "viddemux.h"
+#include "biblin.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+
+
+/*
+ * Typedefs and structs
+ */
+
+/* This structure is used to indicate the expected decoding position. */
+typedef enum {
+   EDP_START_OF_FRAME,
+   EDP_START_OF_VIDEO_PACKET,
+   EDP_END_OF_FRAME
+} vdcExpectedDecodingPosition_t;
+
+
+/*
+ * Local function prototypes
+ */ 
+
+extern int vdcFillImageBuffers(
+   vdcInstance_t *instance,
+   int numOfCodedMBs,
+   vdeImb_t *imbP);
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"vdcDecodeMPEGVolHeader.txt"}} */
+/*
+ * vdcDecodeMPEGVolHeader
+ *    
+ *
+ * Parameters:
+ *    None.
+ *
+ * Function:
+ *    This function reads the VOL Header and updates the instance data
+ *    with the read parameters.
+ *
+ * Returns:
+ *    >= 0  if succeeded
+ *    < 0   if failed
+ *
+ */
+
+int vdcDecodeMPEGVolHeader(vdcHInstance_t hInstance, bibBuffer_t *inBuffer, CMPEG4Transcoder *hTranscoder)
+/* {{-output"vdcDecodeMPEGVolHeader.txt"}} */
+{
+    dphInOutParam_t pichInOut;
+    int headerSuccess = 0;
+
+    pichInOut.vdcInstance = (vdcInstance_t *) hInstance;
+    pichInOut.inBuffer = inBuffer;
+
+    headerSuccess = dphGetMPEGVolHeader(&pichInOut, hTranscoder);
+    if (headerSuccess != 0)
+        return VDC_ERR;
+    else 
+        return VDC_OK;
+}
+
+
+/* {{-output"vdcDecodeMPEGVop.txt"}} */
+/*
+ * vdcDecodeMPEGVop
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *
+ *    inBuffer                   pointer to bit buffer, the current position
+ *                               of the buffer must start with a PSC
+ *
+ * Function:
+ *    The vdcDecodeMPEGVop function implements the decoding process of the MPEG-4
+ *    Simple Video Object described in ISO/IEC 14496-2. 
+ *
+ *    The function decodes the next frame in the buffer (inBuffer) meaning that
+ *    the decoding continues until the next VOP start code or EOB is found or
+ *    until the end of the buffer is not reached.
+ *
+ * Returns:
+ *    VDC_OK                     if the function was succesful
+ *    VDC_OK_BUT_BIT_ERROR       if bit errors were detected but
+ *                               decoded frames are provided by concealing
+ *                               the errors
+ *    VDC_OK_BUT_FRAME_USELESS   if severe bit errors were detected
+ *                               (no concealment was possible) or
+ *                               the bitstream ended unexpectedly
+ *    VDC_ERR                    if a processing error occured,
+ *                               the instance should be closed
+ *
+ */
+int vdcDecodeMPEGVop(vdcHInstance_t hInstance, bibBuffer_t *inBuffer, bibBuffer_t *outBuffer,
+                     bibBufferEdit_t *bufEdit, int aColorEffect, TBool aGetDecodedFrame, 
+                     int aStartByteIndex, int aStartBitIndex,
+                     CMPEG4Transcoder *hTranscoder)
+/* {{-output"vdcDecodeMPEGVop.txt"}} */
+{
+   int sncCode;               /* the latest synchronization code, see 
+                                 sncCheckSync for the possible values */
+
+   int retValue = VDC_OK;     /* return value of this function */
+
+   int16 error = 0;
+
+   u_char
+      *currYFrame = NULL,     /* current P frame */
+      *currUFrame = NULL,
+      *currVFrame = NULL,
+      *refYFrame = NULL,      /* reference frame */
+      *refUFrame = NULL,
+      *refVFrame = NULL;
+
+   u_char *fCodedMBs = NULL;  /* Pointer to table, which indicates coded \
+                                 macroblocks by non-zero value */
+   int numOfCodedMBs = 0;     /* The number of coded macroblocks */
+
+   int *quantParams = NULL;   /* Pointer to table, in which the quantization
+                                 parameter for each macroblock is stored */
+
+   int currMBNum = 0;       /* Current macro block */
+
+   int decStatus = 0;
+   int corruptedVPs = 0;
+   int numberOfVPs = 1;
+   int headerSuccess = 0;
+   u_char fVOPHeaderCorrupted = 0, fVOPHeaderLost = 0;
+
+   vdcExpectedDecodingPosition_t expectedDecodingPosition;
+                              /* Tells in which part of the bitstream
+                                 the decoding should be */
+
+   vdcInstance_t *instance = (vdcInstance_t *) hInstance;
+                              /* instance data */
+      
+   vdcAssert(instance != NULL);
+
+   /* Initializations */
+
+   instance->currFrame = NULL;
+   expectedDecodingPosition = EDP_START_OF_FRAME;
+
+   /* Main loop */
+   for (;;) {
+      int bitErrorIndication = 0;
+
+      sncCode = sncCheckMpegSync(inBuffer, instance->pictureParam.fcode_forward, &error);
+
+      /* If sncCheckSync failed */
+      if (error && error != ERR_BIB_NOT_ENOUGH_DATA) {
+         deb1p("vdcDecodeMPEGVop: ERROR - sncCheckSync returned %d.\n", error);
+         retValue = VDC_ERR;
+         goto exitFunction;
+      }
+
+      /* If EOS was got */
+      if (sncCode == SNC_EOB)
+         instance->fEOS = 1;
+
+      /* If frame ends appropriately */
+      if (expectedDecodingPosition == EDP_END_OF_FRAME &&
+         (sncCode == SNC_VOP || sncCode == SNC_GOV || sncCode == SNC_EOB || 
+          sncCode == SNC_STUFFING || error == ERR_BIB_NOT_ENOUGH_DATA))
+         goto exitFunction;
+
+      /* Else if frame (or stream) data ends suddenly */
+      else if (error == ERR_BIB_NOT_ENOUGH_DATA) {
+         retValue = VDC_OK_BUT_BIT_ERROR;
+         goto exitFunction;
+      }
+
+      /* Else if EOS was reached */
+      else if (sncCode == SNC_EOB) {
+         /* The current frame is useless since it ends before it is complete.
+            On the other hand, there is no point in concealing it since
+            it is the last frame of the sequence. */
+         goto exitFunction;
+      }
+
+      /* Else if frame starts as expected */
+      else if (expectedDecodingPosition == EDP_START_OF_FRAME &&
+         ((sncCode == SNC_GOV) || (sncCode == SNC_VOP) || fVOPHeaderLost)) {
+
+         dphInParam_t pichIn;
+         dphInOutParam_t pichInOut;
+         dphOutParam_t pichOut;
+
+         if (sncCode == SNC_GOV) {
+              vdxGovHeader_t govHeader;
+
+              headerSuccess = vdxGetGovHeader(inBuffer, &govHeader, &bitErrorIndication);
+              if ( headerSuccess < 0) {
+                  retValue = VDC_ERR;
+                  goto exitFunction;
+              } else if (( headerSuccess > 0 ) || 
+                  (govHeader.time_stamp < instance->pictureParam.mod_time_base) || 
+                  (govHeader.time_stamp - instance->pictureParam.mod_time_base > 60)) {
+                  
+                  if(sncCheckMpegVOP(inBuffer, &error) != SNC_PSC) {
+                      retValue = VDC_OK_BUT_FRAME_USELESS;
+                      goto exitFunction;
+                  }
+
+              } else {
+                  instance->pictureParam.mod_time_base = govHeader.time_stamp;
+
+                  /* copying the user data */
+                  if (govHeader.user_data != NULL) {
+
+                      if (!instance->user_data)
+                          instance->user_data = (char *) vdcMalloc(
+                              MAX_USER_DATA_LENGTH);
+
+                      govHeader.user_data_length = 
+                          ((instance->user_data_length + govHeader.user_data_length) >= MAX_USER_DATA_LENGTH) ?
+                          (MAX_USER_DATA_LENGTH - instance->user_data_length) : govHeader.user_data_length;
+                      memcpy(
+                          instance->user_data + instance->user_data_length, 
+                          govHeader.user_data, 
+                          govHeader.user_data_length);
+                      instance->user_data_length += govHeader.user_data_length;
+
+                      vdcDealloc(govHeader.user_data);
+                  }
+
+              }
+         }
+
+         /* Start VOP decoding */
+         pichIn.fReadBits = (fVOPHeaderLost ? 0 : 1);
+         pichIn.fNeedDecodedFrame = aGetDecodedFrame | hTranscoder->NeedDecodedYUVFrame();
+         pichInOut.vdcInstance = instance;
+         pichInOut.inBuffer = inBuffer;
+
+         /* Get VOP header */
+         headerSuccess = dphGetMPEGVopHeader(&pichIn, &pichInOut, &pichOut, &bitErrorIndication);
+         
+         deb1p("vdcDecodeMPEGVop: frameNum %d.\n", instance->frameNum);
+         if ( headerSuccess < 0) {
+             retValue = VDC_ERR;
+             goto exitFunction;
+         } else if ( headerSuccess > 0 ) {
+
+             if (headerSuccess == DPH_OK_BUT_BIT_ERROR) {
+                 /* find the next resync marker, to get the number of MBs in the current VP */
+                 sncCode = sncRewindAndSeekNewMPEGSync(-1, inBuffer, instance->pictureParam.fcode_forward, &error);
+                 if (error && error != ERR_BIB_NOT_ENOUGH_DATA) {
+                     retValue = VDC_ERR;
+                     goto exitFunction;
+                 }
+
+                 if (sncCode == SNC_VIDPACK) {
+                     fVOPHeaderCorrupted = 1;
+                 } else {
+                     retValue = VDC_OK_BUT_FRAME_USELESS;
+                     goto exitFunction;
+                 }
+
+             } else if (headerSuccess == DPH_OK_BUT_NOT_CODED) {
+                             
+                /* MVE */
+                /* copy VOP header to output buffer in case VOP is not coded, including the GOV */
+                bufEdit->copyMode = CopyWhole; /* copyWhole */
+                CopyStream(inBuffer,outBuffer,bufEdit, aStartByteIndex, aStartBitIndex);
+                             
+                /* behaves the same as if the frame was useless, but it's just not coded */
+                retValue = VDC_OK_BUT_NOT_CODED;
+                goto exitFunction;
+             }
+         }
+
+
+         currYFrame = pichOut.currYFrame;
+         currUFrame = pichOut.currUFrame;
+         currVFrame = pichOut.currVFrame;
+
+         currMBNum = 0;
+
+         numOfCodedMBs = 0;
+         fCodedMBs = renDriCodedMBs(instance->currFrame->imb->drawItem);
+         memset(fCodedMBs, 0, renDriNumOfMBs(
+            instance->currFrame->imb->drawItem) * sizeof(u_char));
+
+         /* Initialize quantization parameter array */
+         quantParams = instance->currFrame->imb->yQuantParams;
+         memset(quantParams, 0, renDriNumOfMBs(
+            instance->currFrame->imb->drawItem) * sizeof(int));
+
+         /* If this is the first frame and callback function has been set, report frame size */ 
+         if (instance->nOfDecodedFrames == 0 && instance->reportPictureSizeCallback) {
+            h263dReportPictureSizeCallback_t cb = 
+               (h263dReportPictureSizeCallback_t)instance->reportPictureSizeCallback;
+            cb(instance->hParent, instance->pictureParam.lumWidth, instance->pictureParam.lumHeight);
+         }
+
+         /* Decode the 1st VP segment */
+         {
+            dvpVPInParam_t dvpi;
+            dvpVPInOutParam_t dvpio;
+
+            dvpi.pictParam = &instance->pictureParam;
+            dvpi.inBuffer = inBuffer;
+            dvpi.outBuffer = outBuffer;
+            dvpi.bufEdit = bufEdit;
+            dvpi.iColorEffect = aColorEffect;
+            dvpi.iGetDecodedFrame = aGetDecodedFrame;
+
+            if (fVOPHeaderLost) fVOPHeaderCorrupted = 1;
+            dvpi.fVOPHeaderCorrupted = fVOPHeaderCorrupted;
+            
+            dvpio.currMBNum = 0;
+            dvpio.quant = pichOut.pquant;
+            dvpio.fCodedMBs = fCodedMBs;
+            dvpio.numOfCodedMBs = numOfCodedMBs;
+            dvpio.quantParams = quantParams;
+            dvpio.mvcData = &instance->mvcData;
+            dvpio.aicData = &instance->aicData;
+            dvpio.imageStore = instance->imageStore;
+            dvpio.frameNum = instance->frameNum;
+    
+            dvpio.refY = refYFrame;
+            dvpio.refU = refUFrame;
+            dvpio.refV = refVFrame;
+            dvpio.currPY = currYFrame;
+            dvpio.currPU = currUFrame;
+            dvpio.currPV = currVFrame;
+            
+            /* MVE */
+            hTranscoder->VOPHeaderEnded(aStartByteIndex, aStartBitIndex,
+                pichOut.pquant, instance->pictureParam.pictureType,
+                instance->frameNum, headerSuccess == DPH_OK_BUT_NOT_CODED);
+            /* VOP header parsing success, begin on VP */
+            hTranscoder->BeginOneVideoPacket(&dvpi);
+            hTranscoder->AfterVideoPacketHeader(&dvpio); // the first VP does not have VPHeader
+
+            decStatus = dvpGetAndDecodeVideoPacketContents(&dvpi,
+                instance->pictureParam.pictureType != VDX_PIC_TYPE_I,
+                &dvpio, hTranscoder);
+
+            if (decStatus < 0) {
+                retValue = VDC_ERR;
+                goto exitFunction;
+            } else if (decStatus > 0 ) {
+                if (decStatus == DGOB_OK_BUT_FRAME_USELESS) {
+                    retValue = VDC_OK_BUT_FRAME_USELESS;
+                    goto exitFunction;
+                }
+                corruptedVPs ++;
+            }
+                        
+            /* MVE */
+            /* the first VP ends */
+            hTranscoder->OneVPEnded();
+
+            currMBNum = dvpio.currMBNum;
+            numOfCodedMBs = dvpio.numOfCodedMBs;
+            refYFrame = dvpio.refY;
+            refUFrame = dvpio.refU;
+            refVFrame = dvpio.refV;
+            
+
+            if ((decStatus == DGOB_OK && currMBNum == instance->pictureParam.numMBsInGOB) || 
+                (decStatus == DGOB_OK_BUT_BIT_ERROR && sncCheckMpegVOP(inBuffer, &error) == SNC_PSC))
+                expectedDecodingPosition = EDP_END_OF_FRAME;
+            else
+                expectedDecodingPosition = EDP_START_OF_VIDEO_PACKET;
+         }
+      }
+   
+      /* Else if Video Packet starts as expected */
+      else if (expectedDecodingPosition == EDP_START_OF_VIDEO_PACKET &&
+         sncCode == SNC_VIDPACK) {
+
+            dvpVPInParam_t dvpi;
+            dvpVPInOutParam_t dvpio;
+
+            dvpi.pictParam = &instance->pictureParam;
+            dvpi.inBuffer = inBuffer;
+            dvpi.outBuffer = outBuffer;
+            dvpi.bufEdit = bufEdit;
+            dvpi.iColorEffect = aColorEffect;
+            dvpi.iGetDecodedFrame = aGetDecodedFrame;
+            dvpi.fVOPHeaderCorrupted = fVOPHeaderCorrupted;
+            
+            dvpio.currMBNum = currMBNum;
+            dvpio.fCodedMBs = fCodedMBs;
+            dvpio.numOfCodedMBs = numOfCodedMBs;
+            dvpio.quantParams = quantParams;
+            dvpio.mvcData = &instance->mvcData;
+            dvpio.aicData = &instance->aicData;
+            dvpio.imageStore = instance->imageStore;
+
+            dvpio.refY = refYFrame;
+            dvpio.refU = refUFrame;
+            dvpio.refV = refVFrame;
+            dvpio.currPY = currYFrame;
+            dvpio.currPU = currUFrame;
+            dvpio.currPV = currVFrame;
+            
+            /* MVE */
+            /* VOP header parsing success, begin on VP */
+            hTranscoder->BeginOneVideoPacket(&dvpi);
+
+            /* if the VOP header data needs to be corrected from the HEC codes set
+            inParam->fVOPHeaderCorrupted and pictParam values will be set + read
+            inOutParam->frameNum into instance->frameNum */
+            decStatus = dvpGetAndDecodeVideoPacketHeader(&dvpi, &dvpio);
+                        
+            /* MVE */
+            /* After parsing the VP header */
+            hTranscoder->AfterVideoPacketHeader(&dvpio);
+                        
+            if (decStatus < 0) {
+                retValue = VDC_ERR;
+                goto exitFunction;
+            } else if (decStatus > 0) {
+                
+                if (fVOPHeaderCorrupted) {
+                    /* this is also true when the whole packet with the VOP header is lost */
+
+                    if (dvpio.frameNum <= instance->frameNum) {
+                        /* VOP header could not be recovered from HEC (there was no HEC)
+                           or there was an error in the VP header: in this case should we try to recover 
+                           VOP header from the next VP instead of the exiting here? */
+                        retValue = VDC_OK_BUT_FRAME_USELESS;
+                        goto exitFunction;
+
+                    } else {
+                        /* VOP header was succesfully recovered from HEC, 
+                           the first VP is treated as corrupted or lost */
+                        instance->frameNum = dvpio.frameNum;
+
+                    }
+                } else if (currMBNum < dvpio.currMBNum) {
+                    /* when there was no bit-error in the VP header and the MB counter shows difference 
+                       we know, that a whole VP was lost */
+                    
+                    corruptedVPs++;
+                    numberOfVPs++;
+                    
+
+                }
+            }
+            
+            numberOfVPs++;
+
+            if (!decStatus) {
+
+           
+                decStatus = dvpGetAndDecodeVideoPacketContents(&dvpi,0,&dvpio, hTranscoder);
+                if (decStatus < 0) {
+                    retValue = VDC_ERR;
+                    goto exitFunction;
+                } else if (decStatus > 0 ) {
+                    if (decStatus == DGOB_OK_BUT_FRAME_USELESS) {
+                        retValue = VDC_OK_BUT_FRAME_USELESS;
+                        goto exitFunction;
+                    }
+                    corruptedVPs++;
+                }
+                
+            }
+                        
+            /* MVE */
+            hTranscoder->OneVPEnded();
+
+            currMBNum = dvpio.currMBNum;
+            numOfCodedMBs = dvpio.numOfCodedMBs;
+                        
+            if ((decStatus == DGOB_OK && currMBNum == instance->pictureParam.numMBsInGOB) || 
+                            (decStatus == DGOB_OK_BUT_BIT_ERROR && sncCheckMpegVOP(inBuffer, &error) == SNC_PSC))
+                expectedDecodingPosition = EDP_END_OF_FRAME;
+            else {
+                expectedDecodingPosition = EDP_START_OF_VIDEO_PACKET;
+                if (fVOPHeaderCorrupted) fVOPHeaderCorrupted=0;
+            }
+      }
+            
+      /* Else decoding is out of sync */
+      else {
+         switch (expectedDecodingPosition) {
+
+            case EDP_START_OF_FRAME:
+                if (sncCode == SNC_VIDPACK) {
+                    /* VP start code instead of VOP start code -> 
+                       packet including VOP header is lost */                    
+                    fVOPHeaderLost = 1;
+                    continue;                    
+                } else {
+                    /* No start code */
+                    retValue = VDC_OK_BUT_FRAME_USELESS;
+                    goto exitFunction;
+                }
+
+            case EDP_START_OF_VIDEO_PACKET:
+               /* If the decoding gets out of sync, the next sync code is
+                  seeked in dvpGetAndDecodeVideoPacketContents. Then, if 
+                  the frame ends instead of a new VP header, we are here. */
+
+                /* Mark the missing VP corrupted */
+                {
+                    numberOfVPs++;
+                    corruptedVPs++;
+                    
+                }
+
+                retValue = VDC_OK_BUT_BIT_ERROR;
+                goto exitFunction;
+
+            case EDP_END_OF_FRAME:
+               /* Too much data */
+               retValue = VDC_OK_BUT_BIT_ERROR;
+               goto exitFunction;
+         }
+      }
+   }
+
+
+     
+exitFunction:
+     
+    /* MVE */
+    hTranscoder->VOPEnded();
+
+    if (sncCheckMpegSync(inBuffer, instance->pictureParam.fcode_forward, &error) == SNC_EOB) {
+        instance->fEOS = 1;
+    }
+
+   /* If frame(s) not useless */
+   if (retValue == VDC_OK || retValue == VDC_OK_BUT_BIT_ERROR) {
+
+       /* If bit errors */  
+       if (corruptedVPs) {
+           retValue = VDC_OK_BUT_FRAME_USELESS;
+       }
+
+       if ( retValue != VDC_OK_BUT_FRAME_USELESS ) {
+
+           if ( instance->nOfDecodedFrames < 0xffffffff )
+              instance->nOfDecodedFrames++;
+           if (vdcFillImageBuffers(instance, numOfCodedMBs, 
+               instance->currFrame->imb) < 0)
+               retValue = VDC_ERR;
+
+       }
+   }
+
+   /* If a fatal error occurred */
+   if (retValue < 0) {
+      /* Return frame buffers for decoded output images,
+         as they are useless for the caller and 
+         as the caller cannot get a handle to return them */
+      if (instance->currFrame)
+         vdeImsPutFree(instance->imageStore, instance->currFrame);
+   }
+
+   return retValue;
+}
+
+
+/* {{-output"vdcIsMPEGINTRA.txt"}} */
+/*
+ * vdcIsMPEGINTRA
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *    frameStart                 pointer to memory chunk containing a frame
+ *    frameLength                number of bytes in frame
+ *
+ * Function:
+ *    This function returns 1 if the passed frame is an INTRA frame.
+ *    Otherwise the function returns 0.
+ *
+ * Returns:
+ *    See above.
+ *
+ *        
+ */
+
+int vdcIsMPEGINTRA(
+   vdcHInstance_t hInstance,
+   void *frameStart,
+   unsigned frameLength)
+/* {{-output"vdcIsINTRA.txt"}} */
+{
+   bibBuffer_t *tmpBitBuffer;
+   int fINTRA = 0, bitErrorIndication, syncCode, vdxStatus;
+   int16 error = 0;
+   vdcInstance_t *instance = (vdcInstance_t *) hInstance;
+   vdxGovHeader_t govHeader;
+
+   vdcAssert(instance);
+
+   tmpBitBuffer = bibCreate(frameStart, frameLength, &error);
+   if (!tmpBitBuffer || error)
+      return 0;
+
+   syncCode = sncCheckMpegSync(tmpBitBuffer, instance->pictureParam.fcode_forward, &error);
+
+   if ((syncCode == SNC_GOV || syncCode == SNC_VOP) && error == 0) {
+      vdxGetVopHeaderInputParam_t vopIn;
+      vdxVopHeader_t vopOut;
+
+      if (syncCode == SNC_GOV) {
+         vdxStatus = vdxGetGovHeader(tmpBitBuffer, &govHeader, 
+            &bitErrorIndication);
+
+         if (vdxStatus < 0 || bitErrorIndication != 0) 
+            return fINTRA;
+      }
+
+      /* MVE */
+      int dummy1, dummy2, dummy3, dummy4; /* not used for any processing */
+      /* Get VOP header */
+      vopIn.time_increment_resolution = instance->pictureParam.time_increment_resolution;
+      vdxStatus = vdxGetVopHeader(tmpBitBuffer, &vopIn, &vopOut, 
+                &dummy1, &dummy2, &dummy3, &dummy4,
+                &bitErrorIndication);
+
+
+      if (vdxStatus >= 0 && bitErrorIndication == 0)
+         fINTRA = (vopOut.coding_type == VDX_VOP_TYPE_I);
+   }
+   
+   bibDelete(tmpBitBuffer, &error);
+
+   return fINTRA;
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/decblock.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Block decoding functions.
+*
+*/
+
+
+
+#include "h263dConfig.h"
+
+#include "decblock.h"
+#include "blkfunc.h"
+#include "viddemux.h"
+#include "idct.h"   
+
+
+/* {{-output"dblfree.txt"}} */
+/*
+ * dblFree
+ *    
+ *
+ * Parameters:
+ *    None.
+ *
+ * Function:
+ *    This function deinitializes the module.
+ *    Any functions of this module must not be called after dblFree (except 
+ *    for dblLoad).
+ *
+ * Returns:
+ *    >= 0  if succeeded
+ *    < 0   if failed
+ *
+ */
+
+int dblFree(void)
+/* {{-output"dblfree.txt"}} */
+{
+   return 0;
+}
+
+
+/* {{-output"dblload.txt"}} */
+/*
+ * dblLoad
+ *    
+ *
+ * Parameters:
+ *    None.
+ *
+ * Function:
+ *    This function initializes the module.
+ *    dblLoad has to be called before any other function of this module
+ *    is used.
+ *
+ * Returns:
+ *    >= 0  if succeeded
+ *    < 0   if failed
+ *
+ */
+
+int dblLoad(void)
+/* {{-output"dblload.txt"}} */
+{    
+   return 0;
+}
+
+
+/* {{-output"dblIdctAndDequant.txt"}} */
+/*
+ * dblIdctAndDequant
+ *
+ * Parameters:
+ *    block          block array (length 64)
+ *    quant          quantization information
+ *    skip           must be 1 if INTRADC is in the block, otherwise 0
+ *
+ * Function:
+ *    This function makes the dequantization, the clipping and the inverse
+ *    cosine transform for the given block.
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+void dblIdctAndDequant(int *block, int quant, int skip)
+/* {{-output"dblIdctAndDequant.txt"}} */
+{
+
+   int rec, i, *tmpBlock, level;
+
+   /* See section 6.2.1 of H.263 Recommendation for Inverse Quantization
+      formulas. */
+
+   /* If odd quantization parameter */
+   if (quant & 1) {
+
+      for (i = 64 - skip, tmpBlock = block + skip; i; i--, tmpBlock++) {
+
+         if (!(*tmpBlock))
+            continue;
+
+         level = *tmpBlock;
+
+         if (level > 0) {
+            rec = quant * ((level << 1) + 1);
+            *tmpBlock = (rec < 2048) ? rec : 2047;
+         }
+
+         else {
+            rec = -(quant * (((-level) << 1) + 1));
+            *tmpBlock = (rec < -2048) ? -2048 : rec;
+         }
+      }
+   }
+
+   /* Else even quantization parameter */
+   else {
+
+      /* For loop copy-pasted from the previous case due to speed 
+         optimization */
+      for (i = 64 - skip, tmpBlock = block + skip; i; i--, tmpBlock++) {
+
+         if (!(*tmpBlock))
+            continue;
+
+         level = *tmpBlock;
+
+         if (level > 0) {
+            rec = quant * ((level << 1) + 1) - 1;
+            *tmpBlock = (rec < 2048) ? rec : 2047;
+         }
+
+         else {
+            rec = -(quant * (((-level) << 1) + 1) - 1);
+            *tmpBlock = (rec < -2048) ? -2048 : rec;
+         }
+      }
+   }
+   idct(block);
+}
+
+
+/*
+ * dblIdct
+ *
+ * Parameters:
+ *    block          block array (length 64)
+ *
+ * Function:
+ *    This function makes the inverse
+ *    cosine transform for the given block.
+ *
+ * Returns:
+ *    Nothing.
+ *
+ * Error codes:
+ *    None.
+ *
+ */
+
+void dblIdct(int *block)
+
+{
+   idct(block);
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/decgob.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,508 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* GOB decoding functions.
+*
+*/
+
+
+/* 
+ * Includes 
+ */
+#include "h263dConfig.h"
+#include "decgob.h"
+#include "block.h"
+#include "debug.h"
+#include "decmbs.h"
+#include "stckheap.h"
+#include "sync.h"
+#include "viddemux.h"
+#include "biblin.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"dgobGetAndDecodeGOBSegment.txt"}} */
+/*
+ * dgobGetAndDecodeGOBSegment
+ *    
+ *
+ * Parameters:
+ *    inParam                    input parameters
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *
+ * Function:
+ *    This function gets and decodes a GOB segment which should start
+ *    with a GBSC at the current position of the bit buffer.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured
+ *
+ */
+
+int dgobGetAndDecodeGOBSegment(
+   const dgobGOBSegmentInParam_t *inParam,
+   dgobGOBSegmentInOutParam_t *inOutParam,
+   CMPEG4Transcoder *hTranscoder)
+/* {{-output"dgobGetAndDecodeGOBSegment.txt"}} */
+{
+   bibBuffer_t 
+      *inBuffer;        /* Input bit buffer instance */
+
+   int 
+      retValue,         /* Value returned from this function */
+      
+      fGetNewReferenceFrame,
+                        /* 1 if the reference picture has changed from
+                           the previous one */
+      
+      bitErrorIndication = 0, 
+                        /* Carries bit error indication information returned
+                           by the video demultiplexer module */
+      
+      intraGobsMissing = 0;
+                        /* Flag to indicate if INTRA coded GOBs are missing */
+      
+   u_int32
+      segmStart = bibNumberOfFlushedBits( inParam->inBuffer );
+                        /* Start bit buffer position of the GOB segment */
+
+   vdxGetGOBHeaderInputParam_t 
+      vdxParam;         /* Input parameters for vdxGetGOBHeader */
+
+   vdxGOBHeader_t 
+      header;           /* GOB header data */
+
+   inBuffer = inParam->inBuffer;
+
+   /* 
+    * Get GOB header 
+    */
+
+   vdxParam.numStuffBits = inParam->numStuffBits;
+   vdxParam.fCustomPCF = inParam->pictParam->fCustomPCF;
+   vdxParam.fCPM = inParam->pictParam->cpm;
+   vdxParam.fRPS = inParam->pictParam->fRPS;
+
+   if (vdxGetGOBHeader(inBuffer, &vdxParam, &header, &bitErrorIndication, 
+       inParam->iColorEffect, &inOutParam->StartByteIndex, &inOutParam->StartBitIndex, hTranscoder) < 0) {
+
+      deb("dgobGetAndDecodeGOBSegment: ERROR - vdxGetGOBHeader failed.\n");
+      goto unexpectedError;
+   }
+
+   /*
+    * Check header validity
+    */
+
+   if (header.gn >= inParam->pictParam->numGOBs) {
+      deb("dgobGetAndDecodeGOBSegment: ERROR - too big GN.\n");
+      goto unexpectedError;
+   }
+
+   /* If TRP present and TRP is not 8-bit if only 8-bit TRs have existed.
+      Note: The following condition assumes that only 8-bit TRs are allowed. */
+   if (header.trpi && header.trp > 255) {
+      deb("dgobGetAndDecodeGOBSegment: ERROR - too big TRP.\n");
+      goto unexpectedError;
+   }
+
+   /* If GFID is not as expected */
+   if (inOutParam->gfid >= 0 && bitErrorIndication != 0 && 
+      ((inParam->fGFIDShouldChange && inOutParam->gfid == header.gfid) ||
+      (!inParam->fGFIDShouldChange && inOutParam->gfid != header.gfid))) {
+      deb("dgobGetAndDecodeGOBSegment: ERROR - illegal GFID.\n");
+      goto unexpectedError;
+   }
+
+   inOutParam->prevGN = inOutParam->prevGNWithHeader = header.gn;
+   /* GFID was valid, and in the next GOB the gfidShouldChange flag should be 0 and GFID should be
+      the same as the current one */
+   inOutParam->gfid = header.gfid;
+
+   fGetNewReferenceFrame = 0;
+   if (inParam->pictParam->fRPS) {
+      /* If TRP has changed */
+      if ((header.trpi && header.trp != inOutParam->trp) ||
+         (!header.trpi && inOutParam->trp >= 0))
+         fGetNewReferenceFrame = 1;
+
+      if (header.trpi)
+         inOutParam->trp = header.trp;
+      else
+         inOutParam->trp = -1;
+   }
+
+  /* MVE */
+     hTranscoder->H263GOBSliceHeaderEnded(&header, NULL);
+   
+
+   /*
+    * Decode GOB contents
+    */
+
+   retValue = dgobGetAndDecodeGOBSegmentContents(inParam, fGetNewReferenceFrame, 
+      header.gquant, inOutParam, hTranscoder);
+
+  /* MVE */
+    hTranscoder->H263OneGOBSliceWithHeaderEnded();
+
+
+   if ( intraGobsMissing && retValue == 0 )
+      return DGOB_OK_BUT_BIT_ERROR;
+   else
+      return retValue;
+
+   unexpectedError:
+      return DGOB_ERR;
+}
+
+
+/* {{-output"dgobGetAndDecodeGOBSegmentContents.txt"}} */
+/*
+ * dgobGetAndDecodeGOBSegmentContents
+ *    
+ *
+ * Parameters:
+ *    inParam                    input parameters
+ *    fGetNewReferenceFrame      non-zero if a new reference frame must be
+ *                               requested from the image store, otherwise 0
+ *    quant                      initial quantization parameter
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *
+ * Function:
+ *    This function gets and decodes the contents of a GOB segment
+ *    meaning that the header of the GOB (either GOB header or picture
+ *    header) is already got and processed and the macroblocks belonging
+ *    to the GOB segment are decoded.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured
+ *
+ */
+
+int dgobGetAndDecodeGOBSegmentContents(
+   const dgobGOBSegmentInParam_t *inParam,
+   int fGetNewReferenceFrame,
+   int quant,
+   dgobGOBSegmentInOutParam_t *inOutParam,
+   CMPEG4Transcoder *hTranscoder)
+/* {{-output"dgobGetAndDecodeGOBSegmentContents.txt"}} */
+{
+   bibBuffer_t 
+      *inBuffer;        /* Input bit buffer instance */
+
+
+   bibBuffer_t 
+       *outBuffer;        /* Output bit buffer instance */
+   
+   bibBufferEdit_t              
+       *bufEdit; 
+   
+   int colorEffect; 
+   TBool getDecodedFrame;
+
+
+   /* decmbs input and output parameters */
+   dmbPFrameMBInParam_t dpmbi;
+   dmbPFrameMBInOutParam_t dpmbio;
+   dmbIFrameMBInParam_t dimbi;
+   dmbIFrameMBInOutParam_t dimbio;
+
+   int 
+      *pYPosInMBs,      /* Pointer to variable containing the y-position
+                           of the current macroblock in macroblocks
+                           (starting from zero in the top row) */
+      fSegmentCorrupted = 0;
+                        /* Flag to indicate if the current GOB segment
+                           is corrupted */
+
+   int16 
+      error = 0;        /* Used to pass error codes from snc and erd modules */
+
+   /* Pointers to pointers pointing to the top-left corner of the current 
+      GOB (inside the current frame) */
+   u_char **pYGOB, **pUGOB, **pVGOB;
+
+   SOH_DEFINE(blcDiffMB_t, pDiffMB);
+                        /* Storage for the previous difference blocks */
+
+   inBuffer = inParam->inBuffer;
+
+   outBuffer = inParam->outBuffer;
+   bufEdit = inParam->bufEdit;
+   colorEffect = inParam->iColorEffect;
+   getDecodedFrame = inParam->iGetDecodedFrame;
+
+
+   SOH_ALLOC(blcDiffMB_t, pDiffMB);
+
+   if (pDiffMB == NULL) {
+      deb("dgobGetAndDecodeGOBSegmentContents: SOH_ALLOC failed.\n");
+      goto unexpectedError;
+   }
+
+   pDiffMB->cbpy = 0;
+
+   /* If the reference frame changed */
+   if (fGetNewReferenceFrame) {
+      vdeIms_t *store = inOutParam->imageStore;
+      vdeImsItem_t *imsItem;
+      vdeImb_t *imb;
+      int width, height;
+
+      /* Get the reference frame */
+      if (inOutParam->trp >= 0) {
+         if (vdeImsGetReference(store, VDEIMS_REF_TR, inOutParam->trp, &imsItem) < 0) {
+            deb("dgobGetAndDecodeGOBSegment: ERROR - vdeImsGetReference "
+               "failed.\n");
+            goto unexpectedError;
+         }
+      }
+
+      else {
+         if (vdeImsGetReference(store, VDEIMS_REF_LATEST, 0, &imsItem) < 0) {
+            deb("dgobGetAndDecodeGOBSegment: ERROR - vdeImsGetReference "
+               "failed.\n");
+            goto unexpectedError;
+         }
+      }
+
+      /* If no reference frame available */
+      if (!imsItem) {
+
+         /* Treat the situation like a decoding error.
+            This should cause error concealment and
+            a NACK message if Annex N is used. */
+         deb("dgobGetAndDecodeGOBSegment: Warning - no reference frame "
+            "available.\n");
+
+         goto unexpectedError;
+      }
+
+      if (vdeImsStoreItemToImageBuffer(imsItem, &imb) < 0) {
+         deb("dgobGetAndDecodeGOBSegment: ERROR - vdeImsStoreItemToImageBuffer "
+            "failed.\n");
+         goto unexpectedError;
+      }
+
+      inOutParam->rtr = imb->tr;
+
+      if (vdeImbYUV(imb, &inOutParam->refY, &inOutParam->refU, 
+         &inOutParam->refV, &width, &height) < 0) {
+         deb("dgobGetAndDecodeGOBSegment: ERROR - vdeImbYUV "
+            "failed.\n");
+         goto unexpectedError;
+      }
+   }
+
+   /* Preset structures for multiple macroblock decoding */
+   if (inParam->pictParam->pictureType == VDX_PIC_TYPE_I) {
+      dimbi.inBuffer = inBuffer;
+
+
+      dimbi.outBuffer = outBuffer;
+      dimbi.bufEdit = bufEdit;
+      dimbi.iColorEffect = colorEffect; 
+      dimbi.iGetDecodedFrame = getDecodedFrame; 
+      dimbio.StartByteIndex = inOutParam->StartByteIndex;
+      dimbio.StartBitIndex = inOutParam->StartBitIndex;
+
+
+      dimbi.xPosInMBs = 0;
+      /* yPosInMBs set inside the loop (below) */
+      dimbi.pictParam = inParam->pictParam;
+      dimbi.fGOBHeaderPresent = 1;
+
+      dimbio.fCodedMBs = inOutParam->fCodedMBs;
+      dimbio.numOfCodedMBs = inOutParam->numOfCodedMBs;
+      dimbio.quant = quant;
+
+      /* YUV pointers set iside the loop (below) */
+
+      pYPosInMBs = &dimbi.yPosInMBs;
+      pYGOB = &dimbio.yMBInFrame;
+      pUGOB = &dimbio.uBlockInFrame;
+      pVGOB = &dimbio.vBlockInFrame;
+   }
+
+   else {
+      dpmbi.inBuffer = inBuffer;
+
+      
+      dpmbi.outBuffer = outBuffer;
+      dpmbi.bufEdit = bufEdit;
+      dpmbi.iColorEffect = colorEffect; 
+      dpmbi.iGetDecodedFrame = getDecodedFrame;
+      dpmbio.StartByteIndex = inOutParam->StartByteIndex;
+      dpmbio.StartBitIndex = inOutParam->StartBitIndex;
+
+
+      dpmbi.xPosInMBs = 0;
+      /* yPosInMBs set inside the loop (below) */
+      dpmbi.pictParam = inParam->pictParam;
+      dpmbi.fGOBHeaderPresent = 1;
+      dpmbi.refY = inOutParam->refY;
+      dpmbi.refU = inOutParam->refU;
+      dpmbi.refV = inOutParam->refV;
+      dpmbi.currPY = inOutParam->currPY;
+      dpmbi.currPU = inOutParam->currPU;
+      dpmbi.currPV = inOutParam->currPV;
+
+      dpmbio.fCodedMBs = inOutParam->fCodedMBs;
+      dpmbio.numOfCodedMBs = inOutParam->numOfCodedMBs;
+      dpmbio.quant = quant;
+
+      /* YUV pointers set iside the loop (below) */
+      dpmbio.mvcData = inOutParam->mvcData;
+      dpmbio.diffMB = pDiffMB;
+
+      pYPosInMBs = &dpmbi.yPosInMBs;
+      pYGOB = &dpmbio.yMBInFrame;
+      pUGOB = &dpmbio.uBlockInFrame;
+      pVGOB = &dpmbio.vBlockInFrame;
+   }
+
+   /* Loop forever (until the GOB segment ends) */
+   for (;;) {
+      int dmbsRetValue;
+      int numMBsInCurrGOB;
+      int sncCode;
+      int numStuffBits;
+      int mbNumberInScanOrder;
+
+      if ((inOutParam->prevGN == inParam->pictParam->numGOBs - 1) && 
+         (inParam->pictParam->fLastGOBSizeDifferent))
+         numMBsInCurrGOB = inParam->pictParam->numMBsInLastGOB;
+      else
+         numMBsInCurrGOB = inParam->pictParam->numMBsInGOB;
+
+      *pYPosInMBs = inOutParam->prevGN * inParam->pictParam->numMBLinesInGOB;
+
+      mbNumberInScanOrder = *pYPosInMBs * inParam->pictParam->numMBsInMBLine;
+      
+      /* Set pointers for the GOB (inside frame(s)) */
+      if ( inOutParam->currPY != NULL )
+      {
+         int32 yOffset, uvOffset;
+
+         yOffset = *pYPosInMBs * 16 * inParam->pictParam->lumMemWidth;
+            
+         *pYGOB = inOutParam->currPY + yOffset;
+
+         uvOffset = yOffset / 4;
+         *pUGOB = inOutParam->currPU + uvOffset;
+         *pVGOB = inOutParam->currPV + uvOffset;
+
+      }
+      else
+        {
+        *pYGOB = NULL;
+        *pUGOB = NULL;
+        *pVGOB = NULL;
+        }
+
+      /* Decode macroblocks of the current GOB */
+      if (inParam->pictParam->pictureType == VDX_PIC_TYPE_I)   {
+         dimbi.numMBsInSegment = numMBsInCurrGOB;
+         dmbsRetValue = dmbsGetAndDecodeIMBsInScanOrder(&dimbi, 
+            &dimbio, &inOutParam->quantParams[mbNumberInScanOrder], hTranscoder);
+         
+         inOutParam->StartByteIndex = dimbio.StartByteIndex;
+         inOutParam->StartBitIndex  = dimbio.StartBitIndex;
+
+
+      }
+      else  {
+         dpmbi.numMBsInSegment = numMBsInCurrGOB;
+         dmbsRetValue = dmbsGetAndDecodePMBsInScanOrder(&dpmbi,
+            &dpmbio, &inOutParam->quantParams[mbNumberInScanOrder], hTranscoder);
+         
+         inOutParam->StartByteIndex = dpmbio.StartByteIndex;
+         inOutParam->StartBitIndex  = dpmbio.StartBitIndex;
+      }
+
+      if (dmbsRetValue < 0)
+         goto unexpectedError;
+
+      /* Some bit errors were found inside the segment 
+         (dpmbi/dimbi fSegmentCorrupted have the same address as fSegmentCorrupted)
+         Note that if no suspicious/corrupted blocks was found, but there was crc-error, 
+         this flag is not set. However, that case will be checked if no sync code is found */
+      if ( fSegmentCorrupted )
+         break;
+
+      /* Check if there is a synchronization code in the current bitstream
+         position */
+      sncCode = sncCheckSync(inBuffer, &numStuffBits, &error);
+
+      /* If buffer ends (in one-frame-per-one-buffer case) */
+      if (error == ERR_BIB_NOT_ENOUGH_DATA)
+         break;
+
+      if (error)
+         goto unexpectedError;
+
+      /* If there is a synchronization code */
+      if (sncCode != SNC_NO_SYNC )
+         break;
+
+
+      if (inOutParam->prevGN + 1 < inParam->pictParam->numGOBs) 
+         inOutParam->prevGN++;
+
+      else {
+         deb("dgobGetAndDecodeGOBSegment: ERROR - too much frame data.\n");
+         fSegmentCorrupted = 1;
+         break;
+      }
+
+      dpmbi.fGOBHeaderPresent = 0;
+      dimbi.fGOBHeaderPresent = 0;
+   }
+
+   /* Update coded macroblock counter */
+   if (inParam->pictParam->pictureType == VDX_PIC_TYPE_I)
+      inOutParam->numOfCodedMBs = dimbio.numOfCodedMBs;
+   else
+      inOutParam->numOfCodedMBs = dpmbio.numOfCodedMBs;
+
+   if (!fSegmentCorrupted) {
+      SOH_DEALLOC(pDiffMB);
+      if (inOutParam->trp >= 0) {
+      }
+
+      return DGOB_OK;
+   }
+   else {
+
+      return DGOB_OK_BUT_BIT_ERROR;
+   }
+
+   unexpectedError:
+      SOH_DEALLOC(pDiffMB);
+      return DGOB_ERR;
+}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/decmb.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,731 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Macroblock decoding functions.
+*
+*/
+
+
+/* 
+ * Includes 
+ */
+#include "h263dConfig.h"
+#include "decmb.h"
+#include "viddemux.h"
+#include "decmbdct.h"
+#include "errcodes.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+
+/*
+ * Global functions
+ */
+
+/* {{-output"dmbGetAndDecodeIFrameMB.txt"}} */
+/*
+ * dmbGetAndDecodeIFrameMB
+ *    
+ *
+ * Parameters:
+ *    inParam                    input parameters
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *    fMPEG4                     flag indicating if H.263 ("0") or MPEG-4 ("1")
+ *                               specific block decoding should be used
+ *
+ * Function:
+ *    This function gets the coding parameters of a macroblock belonging
+ *    to an INTRA frame (from the bitstream) and decodes the macroblock.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured when accessing bit buffer
+ *
+ */
+    
+int dmbGetAndDecodeIFrameMB(
+   const dmbIFrameMBInParam_t *inParam,
+   dmbIFrameMBInOutParam_t *inOutParam,
+   u_char fMPEG4, CMPEG4Transcoder *hTranscoder)
+/* {{-output"dmbGetAndDecodeIFrameMB.txt"}} */
+{
+   int
+      bitErrorIndication = 0, 
+                        /* Carries bit error indication information returned
+                           by the video demultiplexer module */
+      ret = 0;          /* Used to check return values of function calls */
+
+   vdxGetIMBLayerInputParam_t 
+      vdxIn;            /* Input parameters for vdxGetIMBLayer */
+
+   vdxIMBLayer_t 
+      mbLayer;          /* Macroblock layer data */
+
+   int
+      rightOfBorder,    /* There is a border on the left of the current MB */
+      downOfBorder;     /* There is a border on top of the current MB */
+
+   int StartByteIndex = inOutParam->StartByteIndex;
+   int StartBitIndex  = inOutParam->StartBitIndex;
+
+   inOutParam->fCodedMBs[inParam->yPosInMBs * 
+      inParam->pictParam->numMBsInMBLine + inParam->xPosInMBs] = 1;
+   inOutParam->numOfCodedMBs++;
+
+   /* Get MB layer parameters */
+   
+   vdxIn.fMQ = inParam->pictParam->fMQ;
+   vdxIn.quant = inOutParam->quant;
+   vdxIn.fAIC = inParam->pictParam->fAIC;
+   vdxIn.fMPEG4 = fMPEG4;
+
+   ret = vdxGetIMBLayer(inParam->inBuffer, inParam->outBuffer, inParam->bufEdit, inParam->iColorEffect,&StartByteIndex, &StartBitIndex, 
+            inParam->iGetDecodedFrame, &vdxIn, &mbLayer, 
+            &bitErrorIndication, hTranscoder);
+
+   if ( ret <0 )
+      goto error;
+   else if ( ret == VDX_OK_BUT_BIT_ERROR )
+      goto bitError;
+   
+   /* Store output parameters */
+   inOutParam->quant = mbLayer.quant;
+   
+   /* Get block layer parameters and decode them */
+
+
+   if(fMPEG4) {
+       dmdMPEGIParam_t dmdIn;
+
+   
+       dmdIn.inBuffer = inParam->inBuffer;
+       dmdIn.outBuffer = inParam->outBuffer;
+       dmdIn.bufEdit = inParam->bufEdit;
+       dmdIn.iColorEffect = inParam->iColorEffect;
+       dmdIn.iGetDecodedFrame = inParam->iGetDecodedFrame;
+
+       dmdIn.cbpy = mbLayer.cbpy;
+       dmdIn.cbpc = mbLayer.cbpc;
+       dmdIn.quant = mbLayer.quant;
+       dmdIn.yWidth = inParam->pictParam->lumMemWidth;
+       dmdIn.yMBInFrame = inOutParam->yMBInFrame;
+       dmdIn.uBlockInFrame = inOutParam->uBlockInFrame;
+       dmdIn.vBlockInFrame = inOutParam->vBlockInFrame;
+
+       dmdIn.xPosInMBs = inParam->xPosInMBs;
+       dmdIn.yPosInMBs = inParam->yPosInMBs;
+       dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+       dmdIn.numMBLinesInGOB = inParam->pictParam->numMBLinesInGOB;
+       dmdIn.pictureType = inParam->pictParam->pictureType;
+
+       inOutParam->aicData->ACpred_flag = mbLayer.ac_pred_flag;
+       dmdIn.aicData = inOutParam->aicData;
+  
+       dmdIn.switched = 
+           aicIntraDCSwitch(inParam->pictParam->intra_dc_vlc_thr,mbLayer.quant);
+  
+       dmdIn.data_partitioned = 0;
+       dmdIn.reversible_vlc = 0;
+  
+       dmdIn.currMBNum = inOutParam->currMBNum;
+  
+       dmdIn.fTopOfVP = (u_char) (inOutParam->currMBNumInVP < inParam->pictParam->numMBsInMBLine);
+       dmdIn.fLeftOfVP = (u_char) (inOutParam->currMBNumInVP == 0);
+       dmdIn.fBBlockOut = (u_char) (inOutParam->currMBNumInVP <= inParam->pictParam->numMBsInMBLine);
+  
+       ret = dmdGetAndDecodeMPEGIMBBlocks(&dmdIn, hTranscoder);
+
+       if ( ret < 0 )
+         goto error;
+       else if ( ret == DMD_BIT_ERR )
+         goto bitError;
+  
+   } else 
+
+   {
+      dmdIParam_t dmdIn;
+              
+      /* Store the coding type of the MB*/
+      if ( inParam->pictParam->fAIC )  {
+         mvcSetBorders(
+            NULL, 
+            inParam->xPosInMBs,
+            inParam->yPosInMBs,
+            (inParam->pictParam->fSS)?inParam->sliceStartMB:-1,  /* If Annex K is not in use, set to -1 */
+            inParam->pictParam->numMBsInMBLine, 
+            &rightOfBorder, 
+            &downOfBorder);
+      }
+         
+  
+      dmdIn.inBuffer = inParam->inBuffer;
+
+
+      dmdIn.outBuffer = inParam->outBuffer;
+      dmdIn.bufEdit = inParam->bufEdit;
+      dmdIn.iColorEffect = inParam->iColorEffect;
+      dmdIn.iGetDecodedFrame = inParam->iGetDecodedFrame;
+      dmdIn.StartByteIndex = inOutParam->StartByteIndex;
+      dmdIn.StartBitIndex  = inOutParam->StartBitIndex;
+
+
+      dmdIn.cbpy = mbLayer.cbpy;
+      dmdIn.cbpc = mbLayer.cbpc;
+      dmdIn.quant = mbLayer.quant;
+      dmdIn.yWidth = inParam->pictParam->lumMemWidth;
+      dmdIn.yMBInFrame = inOutParam->yMBInFrame;
+      dmdIn.uBlockInFrame = inOutParam->uBlockInFrame;
+      dmdIn.vBlockInFrame = inOutParam->vBlockInFrame;
+
+      dmdIn.xPosInMBs = inParam->xPosInMBs;
+      dmdIn.yPosInMBs = inParam->yPosInMBs;
+      dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+      dmdIn.numMBLinesInGOB = inParam->pictParam->numMBLinesInGOB;
+      dmdIn.pictureType = inParam->pictParam->pictureType;
+
+      dmdIn.predMode = mbLayer.predMode;
+      dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+      dmdIn.fGOBHeaderPresent = inParam->fGOBHeaderPresent;
+      dmdIn.rightOfBorder = rightOfBorder;
+      dmdIn.downOfBorder = downOfBorder;
+      dmdIn.sumBEI = 0;
+
+      if (!inParam->pictParam->fAIC) 
+         ret = dmdGetAndDecodeIMBBlocks(&dmdIn, hTranscoder);
+      else
+        {
+        // not supported
+        goto error;
+        }
+
+      inOutParam->StartByteIndex = dmdIn.StartByteIndex;
+      inOutParam->StartBitIndex = dmdIn.StartBitIndex;
+
+
+      if ( ret < 0 )
+         goto error;
+      else if ( ret == DMD_BIT_ERR )
+         goto bitError;
+   }
+
+   return DMB_OK;
+
+bitError:
+
+   inOutParam->fCodedMBs[inParam->yPosInMBs * 
+      inParam->pictParam->numMBsInMBLine + inParam->xPosInMBs] = 0;
+   inOutParam->numOfCodedMBs--;
+   return DMB_BIT_ERR;
+
+error:
+   return DMB_ERR;
+}
+    
+    
+/* {{-output"dmbGetAndDecodePFrameMB.txt"}} */
+/*
+ * dmbGetAndDecodePFrameMB
+ *    
+ *
+ * Parameters:
+ *    inParam                    input parameters
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *    fMPEG4                     flag indicating if H.263 ("0") or MPEG-4 ("1")
+ *                               specific block decoding should be used
+ *
+ * Function:
+ *    This function gets the coding parameters of a macroblock belonging
+ *    to an INTER frame (from the bitstream) and decodes the macroblock.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured when accessing bit buffer
+ *
+ */
+
+int dmbGetAndDecodePFrameMB(
+   const dmbPFrameMBInParam_t *inParam,
+   dmbPFrameMBInOutParam_t *inOutParam,
+   u_char fMPEG4, CMPEG4Transcoder *hTranscoder)
+/* {{-output"dmbGetAndDecodePFrameMB.txt"}} */
+{
+   int
+      bitErrorIndication = 0, 
+                        /* Carries bit error indication information returned
+                           by the video demultiplexer module */
+      sumBEI = 0,       /* Sum (bit-wise OR) of bit error indications for the whole MB */
+      ret,              /* Used to check return values of function calls */
+      mbPos,            /* the position of the current macroblock, 
+                           -1 = the leftmost MB of the image, 
+                           0 = MB is not in the border of the image, 
+                           1 = rightmost MB of the image */
+      cbpy,             /* Coced block pattern for luminance */
+      xPosInMBs,        /* Current macroblock position in x-direction 
+                           in units of macroblocks starting from zero */
+      yPosInMBs,        /* Current macroblock position in y-direction 
+                           in units of macroblocks starting from zero */
+      numMBsInMBLine,   /* The number of macroblocks in one line */
+      yHeight,          /* Luminance image height in pixels */
+      uvHeight,         /* Chrominance image height in pixels */
+      yWidth,           /* Luminance image width in pixels */
+      uvWidth,          /* Chrominance image width in pixels */
+      mbNum,            /* Macroblock number within a picture starting
+                           from zero in the top-left corner and
+                           increasing in scan-order */
+      quant;            /* Current quantization parameter */
+
+   /* Motion vectors for P-macroblock */
+   int mvx[4];
+   int mvy[4];
+
+
+   /* MVE */
+   int StartByteIndex = inOutParam->StartByteIndex;
+   int StartBitIndex  = inOutParam->StartBitIndex;
+
+   int16 
+      error = 0;        /* Used for return value of vdcmvc module */
+
+   u_char 
+      fourMVs,          /* Flag which tells if four motion vectors is
+                           present in the current macroblock */
+      mbNotCoded;       /* == 1 if current macro block is not coded */
+
+   vdxGetPPBMBLayerInputParam_t 
+      vdxIn;            /* Input parameters for vdxGetPPBMBLayer */
+
+   vdxPPBMBLayer_t 
+      mbLayer;          /* Macroblock layer data */
+   int
+      rightOfBorder,    /* There is a border on the left of the current MB */
+      downOfBorder;     /* There is a border on top of the current MB */
+
+   /* Add assertions here */
+
+   xPosInMBs = inParam->xPosInMBs;
+   yPosInMBs = inParam->yPosInMBs;
+   numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+   mbNum = yPosInMBs * numMBsInMBLine + xPosInMBs;
+   yHeight = inParam->pictParam->lumMemHeight;
+   uvHeight = (yHeight >>1 /*/ 2*/);
+   yWidth = inParam->pictParam->lumMemWidth;
+   uvWidth = (yWidth >>1 /*/ 2*/);
+
+   /* mbPos, needed in blcCopyPredictionMB */
+   if (inParam->pictParam->fSS) {
+      if (xPosInMBs == numMBsInMBLine - 1)
+         if (mbNum == inParam->sliceStartMB)
+            mbPos = 2;
+         else
+            mbPos = 1;
+      else if (mbNum == inParam->sliceStartMB) 
+         /* if this is the first MB of the slice but not the last MB of the MB line */
+         mbPos = -1;
+      else if (xPosInMBs == 0)
+         mbPos = -1;
+      else
+         mbPos = 0;  
+   }
+   else  {
+      if (xPosInMBs == 0)
+         mbPos = -1;
+      else if (xPosInMBs == numMBsInMBLine - 1)
+         mbPos = 1;
+      else
+         mbPos = 0;
+   }
+
+   /* Get MB layer parameters */
+   vdxIn.pictureType = inParam->pictParam->pictureType;
+   vdxIn.fPLUSPTYPE = inParam->pictParam->fPLUSPTYPE;
+   vdxIn.fUMV = inParam->pictParam->fUMV;
+   vdxIn.fDF = inParam->pictParam->fDF;
+   vdxIn.fMQ = inParam->pictParam->fMQ;
+   vdxIn.fCustomSourceFormat = inParam->pictParam->fCustomSourceFormat;
+   vdxIn.fAIC = inParam->pictParam->fAIC;
+   vdxIn.quant = inOutParam->quant;
+   vdxIn.fFirstMBOfPicture = (yPosInMBs == 0 && xPosInMBs == 0);
+
+   vdxIn.fMPEG4 = fMPEG4;
+
+   if (fMPEG4) {
+       vdxIn.fAP = 1;
+       vdxIn.f_code = inParam->pictParam->fcode_forward;
+   } else 
+
+   {
+       vdxIn.fAP = inParam->pictParam->fAP;
+   }
+
+
+   int mbType=3;    // default
+   ret = vdxGetPPBMBLayer(inParam->inBuffer, inParam->outBuffer, inParam->bufEdit, inParam->iColorEffect,&StartByteIndex, &StartBitIndex,
+         inParam->iGetDecodedFrame, &mbType, &vdxIn, &mbLayer, &bitErrorIndication,
+         hTranscoder);
+
+   if ( ret < 0 )
+      goto error;
+   else if ( ret == VDX_OK_BUT_BIT_ERROR ) {
+      goto bitError;
+   }
+   /* PB macroblock */
+   if  ((inParam->pictParam->pictureType == VDX_PIC_TYPE_PB) ||
+         (inParam->pictParam->pictureType == VDX_PIC_TYPE_IPB)) {
+
+        // PB not supported
+        goto error;
+   }  /* if (PB macroblock) */
+
+   sumBEI |= bitErrorIndication;
+
+   inOutParam->quant = quant = mbLayer.quant;
+
+   cbpy = mbLayer.cbpy;
+   fourMVs = (u_char) (mbLayer.numMVs == 4);
+
+   if(!fMPEG4) {
+      mvcSetBorders(
+         inOutParam->mvcData, 
+         xPosInMBs,
+         yPosInMBs,
+         (inParam->pictParam->fSS)?inParam->sliceStartMB:-1,  /* If Annex K is not in use, set to -1 */
+         numMBsInMBLine, 
+         &rightOfBorder, 
+         &downOfBorder);
+   }
+
+   if (mbLayer.fCodedMB) {
+      int currMVNum;
+
+      /* Decode motion vectors */
+      mbNotCoded = 0;
+      inOutParam->fCodedMBs[mbNum] = 1;
+      inOutParam->numOfCodedMBs++;
+
+      for (currMVNum = 0; currMVNum < mbLayer.numMVs; currMVNum++) {
+
+          if(fMPEG4)
+              mvcCalcMPEGMV(
+                  inOutParam->mvcData,
+                  mbLayer.mvdx[currMVNum], mbLayer.mvdy[currMVNum],
+                  &mvx[currMVNum], &mvy[currMVNum],
+                  (u_char) currMVNum, fourMVs,
+                  (u_char) (inOutParam->currMBNumInVP < inParam->pictParam->numMBsInMBLine),
+                  (u_char) (inOutParam->currMBNumInVP == 0), 
+                  (u_char) (inOutParam->currMBNumInVP < (inParam->pictParam->numMBsInMBLine-1)),
+                  xPosInMBs,
+                  yPosInMBs,
+                  inParam->pictParam->tr,
+                  (mbLayer.mbClass == VDX_MB_INTRA) ? MVC_MB_INTRA : MVC_MB_INTER,
+                  &error);    
+          else {
+             mvcCalcMV(
+                  inOutParam->mvcData, 
+                  mbLayer.mvdx[currMVNum], mbLayer.mvdy[currMVNum],
+                  &mvx[currMVNum], &mvy[currMVNum],
+                  (u_char) currMVNum, 
+                  (u_char) (mbLayer.numMVs == 4),
+                  (u_char) inParam->pictParam->fUMV,
+                  (u_char) ((inParam->pictParam->fSS)?1:inParam->fGOBHeaderPresent),
+                  xPosInMBs,
+                  yPosInMBs,
+                  inParam->pictParam->tr,
+                  (mbLayer.mbClass == VDX_MB_INTRA) ? 
+                        MVC_MB_INTRA : MVC_MB_INTER,
+                  &error,
+                  inParam->pictParam->fPLUSPTYPE,
+                  inParam->pictParam->fUMVLimited);
+          }
+
+          /* If motion vector points illegally outside the picture,
+             there may be two reasons for it:
+             1) bit error has occured and corrupted MVD, or
+             2) encoder (e.g. /UBC) does not follow the standard.
+             Since we assume that encoders may violate this feature relatively
+             frequently, the decoder considers these cases as bit errors
+             only if the demultiplexer indicates a similar condition.
+             Note that there may be a very improbable situation where
+             the demultiplexer error indication has failed (it reports
+             no errors even though there are errors), and these bit errors
+             would cause an illegal motion vector. Now, we won't detect
+             these cases. */
+          if (error == ERR_MVC_MVPTR && bitErrorIndication)
+               goto bitError;
+          else if (error && error != ERR_MVC_MVPTR)
+               goto error;
+      }
+
+      if (mbLayer.numMVs == 1) {
+         mvx[1] = mvx[2] = mvx[3] = mvx[0];
+         mvy[1] = mvy[2] = mvy[3] = mvy[0];
+      }
+   }
+
+   else {
+      mbNotCoded = 1;
+      /* Motion vectors to 0 */
+      mvx[0] = mvx[1] = mvx[2] = mvx[3] =
+         mvy[0] = mvy[1] = mvy[2] = mvy[3] = 0;
+      mvcMarkMBNotCoded(
+         inOutParam->mvcData, 
+         xPosInMBs,
+         yPosInMBs,
+         inParam->pictParam->tr);
+      inOutParam->fCodedMBs[mbNum] = 0;
+      cbpy = 0;
+      fourMVs = (u_char) (fMPEG4 ? fourMVs : inParam->pictParam->fAP);
+   }
+  
+   
+  
+   /* If INTER MB */
+   if (mbNotCoded || mbLayer.mbClass == VDX_MB_INTER) {
+       dmdPParam_t dmdIn;
+       blcCopyPredictionMBParam_t blcCopyParam;
+       
+       dmdIn.inBuffer = inParam->inBuffer;
+
+
+       dmdIn.outBuffer = inParam->outBuffer;
+       dmdIn.bufEdit = inParam->bufEdit;
+       dmdIn.iColorEffect = inParam->iColorEffect;
+       dmdIn.iGetDecodedFrame = inParam->iGetDecodedFrame;
+       dmdIn.StartByteIndex = inOutParam->StartByteIndex;
+       dmdIn.StartBitIndex  = inOutParam->StartBitIndex;
+       dmdIn.mbType = mbType; 
+
+       dmdIn.cbpy = cbpy;
+       dmdIn.cbpc = mbLayer.cbpc;
+       dmdIn.quant = quant;
+       dmdIn.refY = inParam->refY;
+       dmdIn.refU = inParam->refU;
+       dmdIn.refV = inParam->refV;
+       dmdIn.currYMBInFrame = inOutParam->yMBInFrame;
+       dmdIn.currUBlkInFrame = inOutParam->uBlockInFrame;
+       dmdIn.currVBlkInFrame = inOutParam->vBlockInFrame;
+       dmdIn.uvBlkXCoord = xPosInMBs * 8;
+       dmdIn.uvBlkYCoord = yPosInMBs * 8;
+       dmdIn.uvWidth = uvWidth;
+       dmdIn.uvHeight = uvHeight;
+       dmdIn.mvcData = inOutParam->mvcData;
+       dmdIn.mvx = mvx;
+       dmdIn.mvy = mvy;
+       dmdIn.mbPlace = mbPos;
+       dmdIn.fAdvancedPrediction = inParam->pictParam->fAP;
+       dmdIn.fMVsOverPictureBoundaries =
+           inParam->pictParam->fMVsOverPictureBoundaries;
+       dmdIn.diffMB = inOutParam->diffMB;
+       dmdIn.rcontrol = inParam->pictParam->rtype;
+
+      dmdIn.fourMVs = fourMVs;
+      dmdIn.reversible_vlc = 0;
+
+      dmdIn.xPosInMBs = xPosInMBs;
+      dmdIn.yPosInMBs = yPosInMBs;
+      dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+
+      /* Copy blcCopyPredictionMB parameters from input parameters */
+      memcpy(&blcCopyParam, &(dmdIn.refY), sizeof(blcCopyPredictionMBParam_t));
+      /* Note: In order to operate properly, this memcpy requires that
+            the structure members are in the same order and allocate the same
+            amount of space. This is not guaranteed in C! */
+            
+      if (inParam->iGetDecodedFrame || hTranscoder->NeedDecodedYUVFrame())
+      {
+           /* Do motion compensation */
+           if (blcCopyPredictionMB(&blcCopyParam) < 0) {
+               /* MV was illegal => caused by bitError */
+               goto bitError;
+           }
+      }
+
+
+      if (fMPEG4) {
+        /* Update the AIC module data, marking the MB as Inter (quant=0) */
+        aicBlockUpdate (inOutParam->aicData, inOutParam->currMBNum, 0, NULL, 0, 0);
+      }
+
+
+      /* Store new CBPY */
+      inOutParam->diffMB->cbpy = cbpy;
+
+      /* If some prediction error blocks are coded */
+      if (mbLayer.fCodedMB) {
+          /* Decode prediction error blocks */
+
+          if (fMPEG4) {
+              ret = dmdGetAndDecodeMPEGPMBBlocks(&dmdIn, hTranscoder);
+          } else 
+
+          {
+              ret = dmdGetAndDecodePMBBlocks(&dmdIn, hTranscoder);
+          }
+
+          
+          inOutParam->StartByteIndex = dmdIn.StartByteIndex;
+          inOutParam->StartBitIndex = dmdIn.StartBitIndex;
+
+
+          if ( ret < 0)
+               goto error;
+          else if ( ret == DMD_BIT_ERR ) {
+               goto bitError;
+          }
+      }
+
+      else  // for the case when the MB is not coded 
+      {
+        /* nothing here */
+      }
+
+
+   }  /* if (INTER block ) */
+   
+   /* Else block layer decoding of INTRA macroblock */
+   else {
+        
+       if (inParam->pictParam->pictureType != VDX_PIC_TYPE_PB) 
+           mvcMarkMBIntra(inOutParam->mvcData, xPosInMBs, yPosInMBs, 
+           inParam->pictParam->tr);
+       
+       inOutParam->diffMB->cbpy = 0;
+       
+       /* Get block layer parameters and decode them */
+       
+       if(fMPEG4) {
+             dmdMPEGIParam_t dmdIn;
+             
+             dmdIn.inBuffer = inParam->inBuffer;
+
+             /* MVE */
+             dmdIn.outBuffer = inParam->outBuffer;
+             dmdIn.bufEdit = inParam->bufEdit;
+             dmdIn.iColorEffect = inParam->iColorEffect;
+             dmdIn.iGetDecodedFrame = inParam->iGetDecodedFrame;
+
+             dmdIn.cbpy = cbpy;
+             dmdIn.cbpc = mbLayer.cbpc;
+             dmdIn.quant = quant;
+             dmdIn.yWidth = yWidth;
+             dmdIn.yMBInFrame = inOutParam->yMBInFrame;
+             dmdIn.uBlockInFrame = inOutParam->uBlockInFrame;
+             dmdIn.vBlockInFrame = inOutParam->vBlockInFrame;
+             
+             dmdIn.xPosInMBs = inParam->xPosInMBs;
+             dmdIn.yPosInMBs = inParam->yPosInMBs;
+             dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+             dmdIn.numMBLinesInGOB = inParam->pictParam->numMBLinesInGOB;
+             dmdIn.pictureType = inParam->pictParam->pictureType;
+             
+             
+             inOutParam->aicData->ACpred_flag = mbLayer.ac_pred_flag;
+             dmdIn.aicData = inOutParam->aicData;
+             
+             dmdIn.switched = 
+                 aicIntraDCSwitch(inParam->pictParam->intra_dc_vlc_thr,mbLayer.quant);
+             
+             dmdIn.data_partitioned = 0;
+             dmdIn.reversible_vlc = 0;
+             
+             dmdIn.currMBNum = inOutParam->currMBNum;
+             
+             dmdIn.fTopOfVP = (u_char) 
+                 (inOutParam->currMBNumInVP < inParam->pictParam->numMBsInMBLine ||
+                 !aicIsBlockValid(inOutParam->aicData, inOutParam->currMBNum-inParam->pictParam->numMBsInMBLine));
+             dmdIn.fLeftOfVP = (u_char)
+                 (inOutParam->currMBNumInVP == 0 || 
+                 inParam->xPosInMBs == 0 ||
+                 !aicIsBlockValid(inOutParam->aicData, inOutParam->currMBNum-1));
+             dmdIn.fBBlockOut = (u_char) 
+                 (inOutParam->currMBNumInVP <= inParam->pictParam->numMBsInMBLine ||
+                 inParam->xPosInMBs == 0 ||
+                 !aicIsBlockValid(inOutParam->aicData, inOutParam->currMBNum-inParam->pictParam->numMBsInMBLine-1));
+         
+             ret = dmdGetAndDecodeMPEGIMBBlocks(&dmdIn, hTranscoder);
+             
+             if ( ret < 0 )
+                 goto error;
+             else if ( ret == DMD_BIT_ERR )
+                 goto bitError;
+                 
+       } else 
+
+       {
+             dmdIParam_t dmdIn;
+             
+             dmdIn.inBuffer = inParam->inBuffer;           
+             
+             dmdIn.outBuffer = inParam->outBuffer;
+             dmdIn.bufEdit = inParam->bufEdit;
+             dmdIn.iColorEffect = inParam->iColorEffect; 
+             dmdIn.iGetDecodedFrame = inParam->iGetDecodedFrame;
+             dmdIn.StartByteIndex = inOutParam->StartByteIndex;
+             dmdIn.StartBitIndex  = inOutParam->StartBitIndex;
+             
+             dmdIn.cbpy = cbpy;
+             dmdIn.cbpc = mbLayer.cbpc;
+             dmdIn.quant = quant;
+             dmdIn.yWidth = yWidth;
+             dmdIn.yMBInFrame = inOutParam->yMBInFrame;
+             dmdIn.uBlockInFrame = inOutParam->uBlockInFrame;
+             dmdIn.vBlockInFrame = inOutParam->vBlockInFrame;
+             
+             dmdIn.xPosInMBs = inParam->xPosInMBs;
+             dmdIn.yPosInMBs = inParam->yPosInMBs;
+             dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+             dmdIn.numMBLinesInGOB = inParam->pictParam->numMBLinesInGOB;
+             dmdIn.pictureType = inParam->pictParam->pictureType;
+             
+             dmdIn.predMode = mbLayer.predMode;
+             dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+             dmdIn.fGOBHeaderPresent = (inParam->pictParam->fSS)?1:inParam->fGOBHeaderPresent;
+             dmdIn.rightOfBorder = rightOfBorder;
+             dmdIn.downOfBorder = downOfBorder;
+             
+             if (!inParam->pictParam->fAIC)
+                 ret = dmdGetAndDecodeIMBBlocks(&dmdIn, hTranscoder);
+             else
+                {
+                // not supported
+                goto error;
+                }
+             
+             inOutParam->StartByteIndex = dmdIn.StartByteIndex;
+             inOutParam->StartBitIndex = dmdIn.StartBitIndex;
+             
+             if ( ret < 0 )
+                 goto error;
+             else if ( ret == DMD_BIT_ERR )
+                 goto bitError;
+       }
+   }
+   
+   
+   
+   return DMB_OK;
+
+bitError:
+   if ( inOutParam->fCodedMBs[mbNum] ) {
+      inOutParam->fCodedMBs[mbNum] = 0;
+      inOutParam->numOfCodedMBs--;
+   }
+   return DMB_BIT_ERR;
+
+error:
+   return DMB_ERR;
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/decmbdct.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,352 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Prediction error block decoding functions.
+*
+*/
+
+
+
+/*
+ * Includes 
+ */
+#include "h263dConfig.h"
+#include "decmbdct.h"
+#include "decblock.h"
+#include "block.h"
+#include "viddemux.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+
+/*
+ * Globals
+ */
+
+/* New chroma QP values in MQ mode. See Table T.1/H.263 */
+static const u_char dmdMQChromaTab[32] = {0,1,2,3,4,5,6,6,7,8,9,9,10,10,
+                                          11,11,12,12,12,13,13,13,14,14,
+                                          14,14,14,15,15,15,15,15};
+
+
+/*
+ * Global functions
+ */
+
+
+/* {{-output"dmdGetAndDecodeIMBBlocks.txt"}} */
+/*
+ * dmdGetAndDecodeIMBBlocks
+ *    
+ *
+ * Parameters:
+ *    param                   parameters needed in this function
+ *
+ * Function:
+ *    This function gets the DCT coefficients of an INTRA macroblock
+ *    from the bitstream, reconstructs the corresponding
+ *    pixel-domain blocks and puts the blocks to the output frame.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured when accessing bit buffer
+ *
+ */
+
+int dmdGetAndDecodeIMBBlocks(
+   dmdIParam_t *param, CMPEG4Transcoder *hTranscoder)
+/* {{-output"dmdGetAndDecodeIMBBlocks.txt"}} */
+{
+   bibBuffer_t 
+      *inBuffer;        /* Input bit buffer instance */
+
+   TBool getDecodedFrame;
+
+
+   int 
+      cWidth,           /* Chrominance image width in pixels */
+      block[64],        /* Temporal 8 x 8 block of pixels */
+      i,                /* Loop variable */
+      chrQuant,         /* Quantization parameter for chroma */
+      bitErrorIndication = 0, 
+                        /* Carries bit error indication information returned
+                           by the video demultiplexer module */
+      ret = 0;          /* Used to check return values of function calls */
+
+   u_char 
+      *yBlockInFrame;   /* Points to top-left corner of the current block
+                           inside the current frame */
+
+   inBuffer = param->inBuffer;
+
+   getDecodedFrame = param->iGetDecodedFrame;
+
+
+   yBlockInFrame = param->yMBInFrame;
+   cWidth = param->yWidth / 2;
+
+
+   /* Luminance blocks */
+   for (i=0; i<4; i++) 
+     {
+         /* MVE */
+        hTranscoder->BeginOneBlock(i);
+         
+        bitErrorIndication = 0;
+         
+         /* Get DCT coefficients */
+         ret = vdxGetIntraDCTBlock(inBuffer, vdxIsYCoded(param->cbpy, i + 1), 
+             block, &bitErrorIndication, param->fMQ, param->quant);
+         if ( ret < 0 )
+             return DMD_ERR;
+         else if ( ret == VDX_OK_BUT_BIT_ERROR )
+             goto corruptedMB;
+         
+         /* MVE */
+         hTranscoder->AddOneBlockDataToMB(i, block);             
+         if(getDecodedFrame || hTranscoder->NeedDecodedYUVFrame()) // we need the YUV frames.
+         {
+
+             dblIdctAndDequant(block, param->quant, 1);
+             blcBlockToFrame(block, yBlockInFrame, param->yWidth);
+             yBlockInFrame += 8;
+             if (i & 1)
+                 yBlockInFrame += 8 * param->yWidth - 16;
+         }
+
+   } /* for (y blocks) */
+
+    /* MVE */
+    hTranscoder->BeginOneBlock(4);
+
+   /* Chrominance blocks (U) */
+   bitErrorIndication = 0;
+   /* Find out the value of QP for chrominance block. */
+   chrQuant = (param->fMQ)?dmdMQChromaTab[param->quant]:param->quant;
+
+   /* Get DCT coefficients */
+   ret = vdxGetIntraDCTBlock(inBuffer, vdxIsUCoded(param->cbpc), 
+     block, &bitErrorIndication, param->fMQ, chrQuant);
+   if ( ret < 0 )
+     return DMD_ERR;
+   else if ( ret == VDX_OK_BUT_BIT_ERROR )
+     goto corruptedMB;
+
+    /* MVE */
+    hTranscoder->AddOneBlockDataToMB(4, block);          
+    hTranscoder->BeginOneBlock(5);
+   if(getDecodedFrame || hTranscoder->NeedDecodedYUVFrame()) 
+     {
+         dblIdctAndDequant(block, chrQuant, 1);
+         blcBlockToFrame(block, param->uBlockInFrame, cWidth);
+     }
+
+   /* (V) */
+   bitErrorIndication = 0;
+   /* Get DCT coefficients */
+   ret = vdxGetIntraDCTBlock(inBuffer, vdxIsVCoded(param->cbpc),
+     block, &bitErrorIndication, param->fMQ, chrQuant);
+   if ( ret < 0 )
+     return DMD_ERR;
+   else if ( ret == VDX_OK_BUT_BIT_ERROR )
+     goto corruptedMB;
+
+    /* MVE */
+    hTranscoder->AddOneBlockDataToMB(5, block);          
+    if ( hTranscoder->TranscodingOneMB(NULL) != DMD_OK )
+        {
+        return DMD_ERR;
+        }
+    if(getDecodedFrame || hTranscoder->NeedDecodedYUVFrame())
+     {
+         
+         dblIdctAndDequant(block, chrQuant, 1);
+         blcBlockToFrame(block, param->vBlockInFrame, cWidth);
+         
+     }
+
+   return DMD_OK;
+
+corruptedMB:
+
+   return DMD_BIT_ERR;
+}
+
+
+/* {{-output"dmdGetAndDecodePMBBlocks.txt"}} */
+/*
+ * dmdGetAndDecodePMBBlocks
+ *    
+ *
+ * Parameters:
+ *    param                      parameters needed in this function
+ *
+ * Function:
+ *    This function gets the DCT coefficients of an INTER macroblock
+ *    from the bitstream, reconstructs the corresponding
+ *    pixel-domain blocks and adds the blocks to the prediction frame.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured when accessing bit buffer
+ *
+ */
+
+int dmdGetAndDecodePMBBlocks(
+   dmdPParam_t *param, CMPEG4Transcoder *hTranscoder)
+/* {{-output"dmdGetAndDecodePMBBlocks.txt"}} */
+{
+   bibBuffer_t 
+      *inBuffer;        /* Input bit buffer instance */
+
+
+     TBool getDecodedFrame;
+
+        int 
+      yWidth,           /* Luminance image width in pixels */
+      block[64],        /* Temporal 8 x 8 block of pixels */
+      i,                /* Loop variable */
+      chrQuant,         /* Quantization parameter for chroma */
+      bitErrorIndication = 0, 
+                        /* Carries bit error indication information returned
+                           by the video demultiplexer module */
+      ret = 0;          /* Used to check return values of function calls */
+
+   u_char 
+      *yBlockInFrame;   /* Points to top-left corner of the current block
+                           inside the current frame */
+
+   inBuffer = param->inBuffer;
+
+
+   getDecodedFrame = param->iGetDecodedFrame;
+
+
+   yWidth = param->uvWidth * 2;
+   yBlockInFrame = param->currYMBInFrame;
+
+
+   int fEscapeCodeUsed = 0;
+
+   /* Luminance blocks */
+   for (i = 0; i < 4; i++) {
+   
+         hTranscoder->BeginOneBlock(i);
+
+         if (vdxIsYCoded(param->cbpy, i + 1)) 
+         {
+             /* Get DCT coefficients */
+             ret = vdxGetDCTBlock(inBuffer, 0, 0, block, 
+                 &bitErrorIndication, 0, param->quant, &fEscapeCodeUsed);
+             if ( ret < 0 )
+                 return DMD_ERR;
+             else if ( ret == VDX_OK_BUT_BIT_ERROR )
+                 return DMD_BIT_ERR;
+             
+             /* MVE */
+             hTranscoder->H263EscapeCoding(i, fEscapeCodeUsed);
+             hTranscoder->AddOneBlockDataToMB(i, block);             
+             if(getDecodedFrame || hTranscoder->NeedDecodedYUVFrame())
+             {
+                 
+                 dblIdctAndDequant(block, param->quant, 0);
+                 
+                 blcAddBlock(block, yBlockInFrame,
+                     yWidth, param->mbPlace,
+                     (u_char) param->fAdvancedPrediction, param->diffMB->block[i]);        
+             }
+         }
+
+         /* MVE */
+         else
+         {
+             hTranscoder->H263EscapeCoding(i, fEscapeCodeUsed);
+             hTranscoder->AddOneBlockDataToMB(i, NULL);          
+         }
+
+     yBlockInFrame += 8;
+     if (i & 1)
+       yBlockInFrame += ((/*8 **/ yWidth<<3) - 16);
+   } /* for (y blocks) */
+
+   /* Find out the value of QP for chrominance block. */
+   chrQuant = param->quant;
+
+   hTranscoder->BeginOneBlock(4);
+
+   /* Chrominance blocks (U) */
+   if (vdxIsUCoded(param->cbpc)) 
+     {
+     /* Get DCT coefficients */
+     ret = vdxGetDCTBlock(inBuffer, 0, 0, block, 
+             &bitErrorIndication, 0, param->quant, &fEscapeCodeUsed);
+         if ( ret < 0 )
+             return DMD_ERR;
+         else if ( ret == VDX_OK_BUT_BIT_ERROR )
+             return DMD_BIT_ERR;
+         
+         hTranscoder->H263EscapeCoding(4, fEscapeCodeUsed);
+         hTranscoder->AddOneBlockDataToMB(4, block);             
+         if(getDecodedFrame || hTranscoder->NeedDecodedYUVFrame())
+         {  
+             
+             dblIdctAndDequant(block, chrQuant,0);
+             blcAddBlock(block, param->currUBlkInFrame, param->uvWidth, 0, 0, 0);
+         }
+   }
+
+   else
+   {
+         hTranscoder->H263EscapeCoding(4, fEscapeCodeUsed);
+         hTranscoder->AddOneBlockDataToMB(4, NULL);          
+   }
+
+   hTranscoder->BeginOneBlock(5);
+
+   /* (V) */
+   if (vdxIsVCoded(param->cbpc)) 
+     {
+         /* Get DCT coefficients */
+         ret = vdxGetDCTBlock(inBuffer, 0, 0, block, 
+             &bitErrorIndication, 0, param->quant, &fEscapeCodeUsed);
+         if ( ret < 0 )
+             return DMD_ERR;
+         else if ( ret == VDX_OK_BUT_BIT_ERROR )
+             return DMD_BIT_ERR;
+         
+         /* MVE */
+         hTranscoder->H263EscapeCoding(5, fEscapeCodeUsed);
+         hTranscoder->AddOneBlockDataToMB(5, block);             
+         if(getDecodedFrame || hTranscoder->NeedDecodedYUVFrame())
+         {
+         
+             dblIdctAndDequant(block, chrQuant,0);
+             blcAddBlock(block, param->currVBlkInFrame, param->uvWidth, 0, 0, 0);
+         }
+   }
+   else
+   {
+         hTranscoder->H263EscapeCoding(5, fEscapeCodeUsed);
+         hTranscoder->AddOneBlockDataToMB(5, NULL);          
+   }
+
+   if ( hTranscoder->TranscodingOneMB(param) != TX_OK )
+    {
+    return DMD_ERR;
+    }
+   return DMD_OK;
+   
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/decmbdct_mpeg.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,381 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Prediction error block decoding functions (MPEG-4).
+*
+*/
+
+
+
+/* 
+ * Includes 
+ */
+#include "h263dConfig.h"
+#include "decmbdct.h"
+#include "decblock.h"
+#include "block.h"
+#include "viddemux.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+
+/*
+ * Global functions
+ */
+
+/* {{-output"dmdGetAndDecodeMPEGIMBBlocks.txt"}} */
+/*
+ * dmdGetAndDecodeMPEGIMBBlocks
+ *    
+ *
+ * Parameters:
+ *    param                   parameters needed in this function
+ *
+ * Function:
+ *    This function gets the DCT coefficients of an INTRA macroblock
+ *    from the bitstream, reconstructs the corresponding
+ *    pixel-domain blocks and puts the blocks to the output frame.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured when accessing bit buffer
+ *
+ */
+
+int dmdGetAndDecodeMPEGIMBBlocks(
+   dmdMPEGIParam_t *param, CMPEG4Transcoder *hTranscoder)
+/* {{-output"dmdGetAndDecodeMPEGIMBBlocks.txt"}} */
+{
+   bibBuffer_t *inBuffer;
+
+   bibBuffer_t 
+      *outBuffer;        /* Output bit buffer instance */
+
+   bibBufferEdit_t 
+      *bufEdit; 
+
+   int colorEffect;
+   TBool getDecodedFrame;
+
+   int i, j,
+      block[64], cWidth, bitErrorIndication = 0, ret = 0;
+   u_char *yBlockInFrame;
+   int IntraDC_size, 
+        IntraDC_delta,
+        DC_coeff;
+
+   inBuffer = param->inBuffer;
+   outBuffer = param->outBuffer;
+   bufEdit = param->bufEdit;
+   colorEffect = param->iColorEffect; 
+   getDecodedFrame = param->iGetDecodedFrame;
+
+   if ( param->yMBInFrame )
+    {
+        yBlockInFrame = param->yMBInFrame +
+            ((param->reversible_vlc && param->vlc_dec_direction) ? ((/*8 **/ param->yWidth<<3) + 8) : 0);
+    }
+   else
+    {
+        yBlockInFrame = NULL;
+    }
+   cWidth = (param->yWidth >>1 /*/ 2*/);
+   
+
+    /* Loop through the 4 Luminance and the 2 Chrominance blocks */
+   for (j=0; j<=5; j++) 
+   {
+
+      /* if reversible decoding, the block numbering is reverse */
+      if (param->reversible_vlc && param->vlc_dec_direction) 
+      {
+         i = 5-j;
+      }
+      else 
+      {
+         i=j;
+      }
+
+      /* MVE */
+      hTranscoder->BeginOneBlock(i);
+
+      bitErrorIndication = 0;
+
+      /* Get Intra DC if not switched */
+      if(!param->switched) {
+         if (param->data_partitioned)
+            IntraDC_delta = param->DC[i];
+         else {
+            ret = vdxGetIntraDC(inBuffer, outBuffer, bufEdit, colorEffect, &(param->StartByteIndex), &(param->StartBitIndex), 
+                            i, &IntraDC_size, &IntraDC_delta, &bitErrorIndication);
+
+            if ( ret < 0 )
+               return DMD_ERR;
+            else if ( ret == VDX_OK_BUT_BIT_ERROR )
+               goto corruptedMB;
+         }
+         block[0] = IntraDC_delta;
+      }
+
+      /* Get DCT coefficients */
+      if (((i<4) && (vdxIsYCoded(param->cbpy, i + 1))) ||
+         ((i==4) && (vdxIsUCoded(param->cbpc))) ||
+         ((i==5) && (vdxIsVCoded(param->cbpc))))
+      {
+         /* if reversible VLC, also the direction of decoding is relevant */
+         if (param->reversible_vlc) 
+         {
+            if (!param->vlc_dec_direction)
+               ret = vdxGetRVLCDCTBlock(inBuffer, (!param->switched), 1, block,
+                                 &bitErrorIndication);
+            else
+               ret = vdxGetRVLCDCTBlockBackwards(inBuffer, (!param->switched), 1, block,
+                                        &bitErrorIndication);
+         } 
+         else 
+         {
+            ret = vdxGetMPEGIntraDCTBlock(inBuffer, (!param->switched), block,
+                                  &bitErrorIndication);
+         }
+         
+         if ( ret < 0 )
+            return DMD_ERR;
+         else if ( ret == VDX_OK_BUT_BIT_ERROR )
+            goto corruptedMB;
+
+      } 
+      /* if block is not coded */
+      else 
+      {
+         memset(block + (!param->switched), 0, (63 + (param->switched))* sizeof(int));
+      }
+
+      /* MVE */
+      hTranscoder->AddOneBlockDataToMB(i, block);            
+
+      /* DC/AC prediction: reconstruct the Intra coefficients */
+      aicDCACrecon(param->aicData, param->quant,
+         param->fTopOfVP, param->fLeftOfVP, param->fBBlockOut,
+         i, block, param->currMBNum);
+
+      /* optimized nonlinear inverse quantization for Intra DC */
+      DC_coeff = (block[0] *= aicDCScaler(param->quant,(i<4)?1:2));
+
+      hTranscoder->AddOneBlockDCACrecon(i, block);           
+
+      /* Update the AIC module data, with the current MB */
+      aicBlockUpdate (param->aicData, param->currMBNum, i, block, 
+         param->quant, DC_coeff);
+      
+
+      if(getDecodedFrame || hTranscoder->NeedDecodedYUVFrame())
+      {
+         /* inverse quantization and IDCT */
+         dblIdctAndDequant(block, param->quant, 1);
+            
+          if (i<4)
+          {
+               blcBlockToFrame(block, yBlockInFrame, param->yWidth);
+               if (param->reversible_vlc && param->vlc_dec_direction) 
+               {
+                   yBlockInFrame -= 8;
+                   if (i == 2)
+                       yBlockInFrame -= ((/*8 **/ param->yWidth<<3) - 16);
+               } 
+               else 
+               {
+                   yBlockInFrame += 8;
+                   if (i & 1)
+                       yBlockInFrame += ((/*8 **/ param->yWidth<<3) - 16);
+               }
+          }
+          else
+          {
+              blcBlockToFrame(block, ((i==4)? param->uBlockInFrame : param->vBlockInFrame) , cWidth);   
+          }
+          
+      }
+            
+   }
+   /* for blocks */
+   
+   if ( hTranscoder->TranscodingOneMB(NULL) != TX_OK )
+   {
+      return DMD_ERR;
+   }
+    
+   return DMD_OK;
+   
+corruptedMB:
+
+   return DMD_BIT_ERR;
+}
+
+/* {{-output"dmdGetAndDecodeMPEGPMBBlocks.txt"}} */
+
+/* without the possibility to decode only Y component (#ifdef H263D_LUMINANCE_ONLY) */
+/*
+ * dmdGetAndDecodeMPEGPMBBlocks
+ *    
+ *
+ * Parameters:
+ *    param                      parameters needed in this function
+ *
+ * Function:
+ *    This function gets the DCT coefficients of an INTER macroblock
+ *    from the bitstream, reconstructs the corresponding
+ *    pixel-domain blocks and adds the blocks to the prediction frame.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured when accessing bit buffer
+ *
+ */
+
+int dmdGetAndDecodeMPEGPMBBlocks(
+   dmdPParam_t *param, CMPEG4Transcoder *hTranscoder)
+/* {{-output"dmdGetAndDecodeMPEGPMBBlocks.txt"}} */
+{
+   int i, j, 
+      bitErrorIndication = 0, /* Carries bit error indication information returned
+                                 by the video demultiplexer module */
+      ret = 0;
+      
+   bibBuffer_t *inBuffer;
+
+   TBool getDecodedFrame;
+
+   inBuffer = param->inBuffer;
+   getDecodedFrame = param->iGetDecodedFrame;
+
+   int yWidth, block[64];
+   u_char *yBlockInFrame;
+   int chrQuant;
+
+   int fEscapeCodeUsed = 0;
+
+   /* Find out the value of QP for chrominance block. */
+   chrQuant = param->quant;
+
+   yWidth = param->uvWidth <<1 /** 2*/;
+   if ( param->currYMBInFrame )
+    {
+        yBlockInFrame = param->currYMBInFrame + 
+            ((param->reversible_vlc && param->vlc_dec_direction) ? ((/*8 **/ yWidth<<3) + 8) : 0);
+    }
+   else
+    {
+        yBlockInFrame = NULL;
+    }
+
+   /* Loop through the 4 Luminance and the 2 Chrominance blocks */
+   for (j=0; j<=5; j++) {
+         
+         /* if reversible decoding, the block numbering is reverse */
+         if (param->reversible_vlc && param->vlc_dec_direction) 
+         {
+            i = 5-j;
+         }
+         else 
+         {
+            i=j;
+         }
+         
+     /* MVE */
+         hTranscoder->BeginOneBlock(i);
+         
+         if (((i<4) && (vdxIsYCoded(param->cbpy, i + 1))) ||
+             ((i==4) && (vdxIsUCoded(param->cbpc))) ||
+             ((i==5) && (vdxIsVCoded(param->cbpc))))
+         {
+             
+             /* Get DCT coefficients */
+             if (param->reversible_vlc) 
+             {
+                if (!param->vlc_dec_direction)
+                    ret = vdxGetRVLCDCTBlock(inBuffer, 0, 0, block,
+                    &bitErrorIndication);
+                else
+                    ret = vdxGetRVLCDCTBlockBackwards(inBuffer, 0, 0, block,
+                    &bitErrorIndication);
+             } 
+             else 
+             {
+                ret = vdxGetDCTBlock(inBuffer, 0, 1, block, 
+                     &bitErrorIndication, 0, param->quant, &fEscapeCodeUsed);
+             }
+             if ( ret < 0 )
+                return DMD_ERR;
+             else if ( ret == VDX_OK_BUT_BIT_ERROR )
+                return DMD_BIT_ERR;
+             
+            hTranscoder->AddOneBlockDataToMB(i, block);          
+            if(getDecodedFrame || hTranscoder->NeedDecodedYUVFrame()) // we need the YUV frames.
+            {
+                 
+                /* IDCT & dequant */
+                dblIdctAndDequant(block, ((i<4)?param->quant:chrQuant), 0);
+
+                if (i<4)
+                {
+                     
+                    blcAddBlock(block, yBlockInFrame,
+                        yWidth, 0, 0, 0);
+                } 
+                else 
+                {
+                    /* U or V component */
+
+                    blcAddBlock(block, ((i==4)? param->currUBlkInFrame : param->currVBlkInFrame), param->uvWidth, 0, 0, 0);
+                }
+            }
+             
+        }
+         
+         /* MVE */
+         else
+         {
+             /* this block is not coded */
+             hTranscoder->AddOneBlockDataToMB(i, NULL);          
+         }
+
+         
+         if ((i<4) && yBlockInFrame)
+         {
+             if (param->reversible_vlc && param->vlc_dec_direction) {
+                 yBlockInFrame -= 8;
+                 if (i == 2)
+                     yBlockInFrame -= ((/*8 **/ yWidth<<3) - 16);
+             } else {
+                 yBlockInFrame += 8;
+                 if (i & 1)
+                     yBlockInFrame += ((/*8 **/ yWidth<<3) - 16);
+             }
+             
+         }
+         else   //u,v
+         {
+             /* nothing here */
+         }
+   }
+
+     
+     /* MVE */
+   if ( hTranscoder->TranscodingOneMB(param) != TX_OK )
+    {
+    return DMD_ERR;
+    }
+   return DMD_OK;
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/decmbs.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Multiple scan-order macroblock decoding functions.
+*
+*/
+
+
+/*
+ * Includes
+ */
+#include "h263dConfig.h"
+#include "decmbs.h"
+#include "viddemux.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"dmbsGetAndDecodeIMBsInScanOrder.txt"}} */
+/*
+ * dmbsGetAndDecodeIMBsInScanOrder
+ *
+ * Parameters:
+ *    numMBsToDecode             the number of macroblocks to decode
+ *    inParam                    input parameters
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *    quant                      array for storing quantization parameters
+ *
+ * Function:
+ *    This function gets and decodes a requested number of INTRA frame
+ *    macroblocks in scan order.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured
+ *
+ */
+
+int dmbsGetAndDecodeIMBsInScanOrder(
+   const dmbIFrameMBInParam_t *inParam,
+   dmbIFrameMBInOutParam_t *inOutParam,
+   int *quant, CMPEG4Transcoder *hTranscoder)
+/* {{-output"dmbsGetAndDecodeIMBsInScanOrder.txt"}} */
+{
+   int currMBNum;
+   int yWidth = inParam->pictParam->lumMemWidth;
+   int uvWidth = yWidth / 2;
+   int ret = 0;
+   dmbIFrameMBInParam_t dmbi;
+
+   memcpy(&dmbi, inParam, sizeof(dmbIFrameMBInParam_t));
+
+   for (currMBNum = 0; currMBNum < inParam->numMBsInSegment; currMBNum++) {
+
+      hTranscoder->BeginOneMB(currMBNum + inParam->numMBsInSegment * inParam->yPosInMBs);
+
+      ret = dmbGetAndDecodeIFrameMB(&dmbi, inOutParam, 0, hTranscoder);
+      if ( ret < 0)
+         return DMBS_ERR;
+      else if ( ret == DMB_BIT_ERR ) {
+         break;
+      }
+
+      /* Store quantizer and increment array index */
+      *quant = inOutParam->quant;
+      quant++;
+
+      if ( inOutParam->yMBInFrame != NULL )
+        {
+          inOutParam->yMBInFrame += 16;
+          inOutParam->uBlockInFrame += 8;
+          inOutParam->vBlockInFrame += 8;
+        }
+      dmbi.xPosInMBs++;
+
+      if (dmbi.xPosInMBs == inParam->pictParam->numMBsInMBLine) {
+          if ( inOutParam->yMBInFrame != NULL )
+            {
+                inOutParam->yMBInFrame += 15 * yWidth;
+                inOutParam->uBlockInFrame += 7 * uvWidth;
+                inOutParam->vBlockInFrame += 7 * uvWidth;
+            }
+         dmbi.xPosInMBs = 0;
+         dmbi.yPosInMBs++;
+      }
+   }
+     
+   hTranscoder->H263OneGOBSliceEnded(dmbi.yPosInMBs * inParam->numMBsInSegment);
+   
+   return DMBS_OK;
+}
+
+
+/* {{-output"dmbsGetAndDecodePMBsInScanOrder.txt"}} */
+/*
+ * dmbsGetAndDecodePMBsInScanOrder
+ *
+ * Parameters:
+ *    numMBsToDecode             the number of macroblocks to decode
+ *    inParam                    input parameters
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *    quant                      array for storing quantization parameters
+ *
+ * Function:
+ *    This function gets and decodes a requested number of INTER frame
+ *    macroblocks in scan order.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured
+ *
+ */
+
+int dmbsGetAndDecodePMBsInScanOrder(
+   const dmbPFrameMBInParam_t *inParam,
+   dmbPFrameMBInOutParam_t *inOutParam,
+   int *quant, CMPEG4Transcoder *hTranscoder)
+/* {{-output"dmbsGetAndDecodePMBsInScanOrder.txt"}} */
+{
+   int currMBNum;
+   int yWidth = inParam->pictParam->lumMemWidth;
+   int uvWidth = yWidth / 2;
+   int ret = 0;
+   dmbPFrameMBInParam_t dmbi;
+
+   memcpy(&dmbi, inParam, sizeof(dmbPFrameMBInParam_t));
+
+   for (currMBNum = 0; currMBNum < inParam->numMBsInSegment; currMBNum++) {
+         
+      hTranscoder->BeginOneMB(currMBNum + inParam->numMBsInSegment * inParam->yPosInMBs);
+
+      ret = dmbGetAndDecodePFrameMB(&dmbi, inOutParam, 0, hTranscoder);
+      if (ret < 0)
+        return DMBS_ERR;
+      else if ( ret == DMB_BIT_ERR ) {
+        break;
+      }
+         
+      /* Store quantizer and increment array index */
+      *quant = inOutParam->quant;
+      quant++;
+      
+      if ( inOutParam->yMBInFrame != NULL )
+        {
+          inOutParam->yMBInFrame += 16;
+          inOutParam->uBlockInFrame += 8;
+          inOutParam->vBlockInFrame += 8;
+        }
+      dmbi.xPosInMBs++;
+
+      if (dmbi.xPosInMBs == inParam->pictParam->numMBsInMBLine) {
+          if ( inOutParam->yMBInFrame != NULL )
+            {
+             inOutParam->yMBInFrame += 15 * yWidth;
+             inOutParam->uBlockInFrame += 7 * uvWidth;
+             inOutParam->vBlockInFrame += 7 * uvWidth;
+            }
+         dmbi.xPosInMBs = 0;
+         dmbi.yPosInMBs++;
+      }
+   }
+     
+   hTranscoder->H263OneGOBSliceEnded(dmbi.yPosInMBs * inParam->numMBsInSegment);
+   
+   return DMBS_OK;
+     
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/decmbs_dp_mpeg.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1766 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* MB decoding in data partitioned mode (MPEG-4).
+*
+*/
+
+
+
+/*
+ * Includes 
+ */
+#include "h263dConfig.h"
+#include "decmbs.h"
+#include "decmbdct.h"
+#include "viddemux.h"
+#include "errcodes.h"
+#include "sync.h"
+#include "mpegcons.h"
+#include "debug.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+
+/*
+ * Local functions
+ */
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"dmbsGetAndDecodeIMBsDataPartitioned.txt"}} */
+/*
+ * dmbsGetAndDecodeIMBsDataPartitioned
+ *    
+ *
+ * Parameters:
+ *    inParam                    input parameters
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *
+ * Function:
+ *    This function gets and decodes the MBs of a data partitioned 
+ *    Video Packet in an Intra Frame.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured
+ *
+ */
+
+int dmbsGetAndDecodeIMBsDataPartitioned(
+   dmbIFrameMBInParam_t *inParam,
+   dmbIFrameMBInOutParam_t *inOutParam,
+   int *quantParams, CMPEG4Transcoder *hTranscoder)
+/* {{-output"dmbsGetAndDecodeIMBsDataPartitioned.txt"}} */
+{
+   int retValue = DMBS_OK;
+
+   int currMBNumInVP, lastMBNum, numMBsInVP, numCorrectMBs;
+   int yWidth = inParam->pictParam->lumMemWidth;
+   int uvWidth = yWidth / 2;
+   int bitErrorIndication = 0, ret = 0, sncCode, bitsGot, bitErrorsInPart1 = 0;
+   u_int32 startVPBitPos = 0, 
+         errorBitPos = 0,
+         backwards_errorBitPos = 0,
+         nextVPBitPos = 0,
+         startBlockDataBitPos = 0,
+         DCMarkerBitPos = 0;
+   u_char fPart1Error=0, fPart2Error=0, fBlockError=0;
+   int16 error = 0;
+#ifdef DEBUG_OUTPUT
+   FILE *rvlc_stat;
+#endif
+
+   dlst_t MBList;
+   vdxIMBListItem_t *MBinstance;
+
+   vdxGetDataPartitionedIMBLayerInputParam_t vdxDPIn;
+   dmdMPEGIParam_t dmdIn;
+   
+   if (dlstOpen(&MBList) < 0)
+      return DMBS_ERR;
+
+   /* mark the bit position at the beginning of the VP */
+   startVPBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+
+   /* 
+    * read the first partition: DC coefficients, etc. 
+    */
+
+   vdxDPIn.intra_dc_vlc_thr = inParam->pictParam->intra_dc_vlc_thr;
+   vdxDPIn.quant = inOutParam->quant;
+
+   /* MVE */
+   ret = vdxGetDataPartitionedIMBLayer_Part1(inParam->inBuffer, inParam->outBuffer, 
+         inParam->bufEdit, inParam->iColorEffect, &(inOutParam->StartByteIndex), 
+         &(inOutParam->StartBitIndex), hTranscoder, &vdxDPIn, &MBList, 
+         &bitErrorIndication);
+
+   bitErrorsInPart1 = bitErrorIndication;
+   if (ret < 0) {
+       retValue = DMBS_ERR;
+       goto exitFunction;
+   }
+   else if (ret == VDX_OK_BUT_BIT_ERROR) {
+
+      fPart1Error = 1;
+      bitErrorIndication = 0;
+      deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - DC partition error.\n");
+   } else {
+      DCMarkerBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+   }
+
+   /* read the next VP header to determine the number of MBs in this VP */
+   if ( fPart1Error ) {
+       /* Stop decoding this segment */
+      goto exitFunction;
+   }
+   else {
+      sncCode = sncRewindAndSeekNewMPEGSync( 1,
+          inParam->inBuffer, inParam->pictParam->fcode_forward, &error);
+   }
+   if (error) {
+      if (error == ERR_BIB_NOT_ENOUGH_DATA) error = 0;
+      else { 
+          retValue = DMBS_ERR;
+          goto exitFunction;          
+      }
+   }
+   
+   nextVPBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+   
+   if (sncCode == SNC_VIDPACK) {
+      
+      vdxVideoPacketHeader_t header;
+      vdxGetVideoPacketHeaderInputParam_t vdxParam;
+      int retValue;
+      
+      vdxParam.fcode_forward = inParam->pictParam->fcode_forward;
+      vdxParam.time_increment_resolution = inParam->pictParam->time_increment_resolution;
+      vdxParam.numOfMBs = inParam->pictParam->numMBsInGOB;
+      
+      retValue = vdxGetVideoPacketHeader(inParam->inBuffer, &vdxParam, &header, &bitErrorIndication);
+      if (retValue < 0) {
+          retValue = DMBS_ERR;
+          goto exitFunction;      
+      } else if (retValue == VDX_OK_BUT_BIT_ERROR) {
+         /* If bit error occurred */
+         deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - VP Header error.\n");
+         bitErrorIndication = 0;
+         lastMBNum = 0;
+      } else {    
+         lastMBNum = header.currMBNum;
+      }
+   } else {
+      lastMBNum = inParam->pictParam->numMBsInGOB;
+   }
+
+   /* rewind the bits to the beginning of the current VP data */
+   bibRewindBits(bibNumberOfFlushedBits(inParam->inBuffer) - (fPart1Error ? errorBitPos : DCMarkerBitPos),
+      inParam->inBuffer, &error);
+      
+   if (fPart1Error) {
+      /* Seek the DC_MARKER */
+      if ((sncSeekBitPattern(inParam->inBuffer, MP4_DC_MARKER, MP4_DC_MARKER_LENGTH, &error) != SNC_PATTERN) ||
+         (bibNumberOfFlushedBits(inParam->inBuffer) >= nextVPBitPos)) {
+         
+         /* rewind the bits to the beginning of the current VP data */
+         bibRewindBits( VDC_MIN(bibNumberOfRewBits(inParam->inBuffer), (bibNumberOfFlushedBits(inParam->inBuffer) - startVPBitPos)),
+            inParam->inBuffer, &error);
+
+         deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - Part1Error && No DC marker found.\n");
+         goto exitFunction;
+      }
+   } 
+
+   if ((lastMBNum <= inOutParam->currMBNum) ||
+      (lastMBNum > inParam->pictParam->numMBsInGOB) ||
+      (sncCode == SNC_EOB)) {
+      numMBsInVP = MBList.numItems;
+      if (fPart1Error) fPart2Error = 1;
+   } else 
+      numMBsInVP = lastMBNum - inOutParam->currMBNum;
+
+   if (numMBsInVP != MBList.numItems || fPart1Error) {
+      deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - MB list length != num MBs.\n");
+      if ( fPart1Error || bitErrorsInPart1 ) {
+         /* Discard few MBs from the end of the list, 
+            since there are errors somewhere in the bitstream. 
+            If the list is short due to the missing packet, 
+            all the read MBs are likely to be OK and there is no
+            need to discard them */
+         dlstTail(&MBList, (void **) &MBinstance);
+         dlstRemove(&MBList, (void **) &MBinstance);
+         free( MBinstance );
+         if (numMBsInVP > MBList.numItems ) {
+            /* Take still one away */
+            dlstTail(&MBList, (void **) &MBinstance);
+            dlstRemove(&MBList, (void **) &MBinstance);
+            free( MBinstance );
+         }
+      }
+      if (numMBsInVP < MBList.numItems ) {
+         /* Discard all the extra MBs from the end of the list + 2 just to be sure, 
+            since there are errors somewhere in the bitstream */
+         while ( MBList.numItems > VDC_MAX(numMBsInVP-2,0) ) {
+            dlstTail(&MBList, (void **) &MBinstance);
+            dlstRemove(&MBList, (void **) &MBinstance);
+            free( MBinstance );
+         }
+      }
+      fPart1Error = 1;
+      errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+   }
+
+   /* Flush the DC_Marker */
+   bibFlushBits(MP4_DC_MARKER_LENGTH, inParam->inBuffer, &bitsGot, &bitErrorIndication, &error);
+   if (error)
+   {
+       retValue = DMBS_ERR;
+       goto exitFunction;        
+   }
+
+   /*
+    * Read the second partition header: cpby, ac_pred_flag 
+    */
+
+   ret = vdxGetDataPartitionedIMBLayer_Part2(inParam->inBuffer, inParam->outBuffer, 
+         inParam->bufEdit, inParam->iColorEffect, &(inOutParam->StartByteIndex), &(inOutParam->StartBitIndex),
+         &MBList, numMBsInVP, &bitErrorIndication);
+   if (ret < 0) {
+      retValue = DMBS_ERR;
+      goto exitFunction;
+   }
+   else if (ret == VDX_OK_BUT_BIT_ERROR) {
+        fPart2Error = 1;
+        deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - Part2Error.\n");
+        /* Stop decoding this segment */
+        goto exitFunction;
+   }
+
+   /* common input parameters for all blocks */
+   dmdIn.aicData = inOutParam->aicData;
+
+   /* MVE */
+   dmdIn.inBuffer = inParam->inBuffer;
+   dmdIn.outBuffer = inParam->outBuffer;
+   dmdIn.bufEdit = inParam->bufEdit;
+   dmdIn.iColorEffect = inParam->iColorEffect;
+   dmdIn.iGetDecodedFrame = inParam->iGetDecodedFrame;
+
+   dmdIn.yWidth = inParam->pictParam->lumMemWidth;
+   dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+   dmdIn.pictureType = inParam->pictParam->pictureType;
+
+   /*
+    * Read block data partition in forward direction 
+    */
+
+   startBlockDataBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+
+   /* set block pointers to the beginning of the VP */   
+   dmdIn.yMBInFrame = inOutParam->yMBInFrame;
+   dmdIn.uBlockInFrame = inOutParam->uBlockInFrame;
+   dmdIn.vBlockInFrame = inOutParam->vBlockInFrame;
+
+   dmdIn.xPosInMBs = inParam->xPosInMBs;
+   dmdIn.yPosInMBs = inParam->yPosInMBs;
+
+   dmdIn.currMBNum = inOutParam->currMBNum;
+
+   /* get the first MB of the list */
+   dlstHead(&MBList, (void **) &MBinstance);
+
+   for (currMBNumInVP = 0; currMBNumInVP < numMBsInVP; currMBNumInVP++) {
+         
+         /* if MBList is shorter then the number of MBs in the VP */
+         if (MBinstance == NULL) {
+             deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - MB list < num MBs.\n");
+             goto exitFunction;
+         }
+         
+         /* header params. If partition 2 or AC partition contains errors, no bits are read any more 
+         from the bitstream, but the blocks are reconstructed based only on DC values */
+         dmdIn.cbpy = (fPart2Error || fBlockError) ? 0 : MBinstance->cbpy;
+         dmdIn.cbpc = (fPart2Error || fBlockError) ? 0 : MBinstance->cbpc;
+         dmdIn.quant = MBinstance->quant;
+         
+         /* AC/DC prediction params */
+         dmdIn.switched = MBinstance->switched;
+         
+         dmdIn.fTopOfVP = (u_char) (currMBNumInVP < inParam->pictParam->numMBsInMBLine);
+         dmdIn.fLeftOfVP = (u_char) (currMBNumInVP == 0);
+         dmdIn.fBBlockOut = (u_char) (currMBNumInVP <= inParam->pictParam->numMBsInMBLine);
+         
+         inOutParam->aicData->ACpred_flag = (u_char) ((fPart2Error || fBlockError) ? 0 : MBinstance->ac_pred_flag);
+         
+         /* error resilience params */
+         dmdIn.data_partitioned = 1;
+         dmdIn.DC = MBinstance->DC;
+         
+         dmdIn.reversible_vlc = inParam->pictParam->reversible_vlc;
+         dmdIn.vlc_dec_direction = 0;
+         
+         /* MVE */
+         hTranscoder->OneIMBDataStartedDataPartitioned(MBinstance, &MBList, currMBNumInVP, dmdIn.currMBNum);
+         
+         /* get the next macroblock data */
+         ret = dmdGetAndDecodeMPEGIMBBlocks(&dmdIn, hTranscoder);
+         
+         if ( ret < 0 ) {
+             retValue = DMBS_ERR;
+             goto exitFunction;         
+         }
+      else if ( ret == DMD_BIT_ERR ) {
+         if (fPart1Error) {
+            deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - IMB Blocks decoding error && Part1Error.\n");
+            goto exitFunction;
+         } else {
+            deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - IMB Blocks decoding error. Using DCs only.\n");
+            fBlockError = 1;
+         }
+      }
+
+      /* Store quantizer */
+      quantParams[dmdIn.currMBNum] = MBinstance->quant;
+
+      /* increment the block pointers and counters */
+      dmdIn.currMBNum++;
+      if ( dmdIn.yMBInFrame != NULL )
+        {
+            dmdIn.yMBInFrame += 16;
+            dmdIn.uBlockInFrame += 8;
+            dmdIn.vBlockInFrame += 8;
+        }
+      dmdIn.xPosInMBs++;
+
+      if (dmdIn.xPosInMBs == inParam->pictParam->numMBsInMBLine) {
+         if ( dmdIn.yMBInFrame )
+            {
+             dmdIn.yMBInFrame += 15 * yWidth;
+             dmdIn.uBlockInFrame += 7 * uvWidth;
+             dmdIn.vBlockInFrame += 7 * uvWidth;
+            }
+         dmdIn.xPosInMBs = 0;
+         dmdIn.yPosInMBs++;
+         if (dmdIn.yPosInMBs >= inParam->pictParam->numMBLinesInGOB)
+            break;
+      }
+      
+      dlstNext(&MBList, (void **) &MBinstance);
+   }
+
+   if (!fPart1Error && !fPart2Error && !fBlockError) {
+         if (sncCode == SNC_EOB) {
+             inOutParam->currMBNum += numMBsInVP;
+             goto exitFunction;
+         } else {
+             
+             sncCode = sncCheckMpegSync(inParam->inBuffer, inParam->pictParam->fcode_forward, &error);
+             if (sncCode == SNC_NO_SYNC) {
+                 deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - After block data no start code found.\n");
+                 if (lastMBNum != 0) 
+                     fBlockError = 1;
+             }
+         }
+   }
+
+   /*
+    * In case of error, read block data partition in backward direction 
+    */
+
+   /* WARNING: backwards decoding of INTRA frame RVLC is disabled by setting the VP size
+      higher then 10. The useful VP sizes used in low bitrates allow max. 8-10 MBs per
+     VP, but in average 3-5 MBs. With this small amount the backwards decoding always
+     causes overlap of the MB counter, and the overlapped MBs must be discarded. So the
+     RVLC doesn't have any use. */
+
+   if (!fPart2Error && fBlockError && inParam->pictParam->reversible_vlc && (numMBsInVP >= 10)) {
+      numCorrectMBs = currMBNumInVP;
+
+#ifdef DEBUG_OUTPUT
+      {
+         int bitPos[6], xpos, ypos, mbnum;
+         
+         rvlc_stat = fopen("rvlc.log", "a+t");
+         
+         fprintf(rvlc_stat, "I-VOP: (frame)(MB_first):%3d  (MB_last):%3d\n", 
+            inOutParam->currMBNum, (inOutParam->currMBNum + numMBsInVP-1));
+         
+         for (xpos = inParam->xPosInMBs, ypos = inParam->yPosInMBs, mbnum = 0; mbnum < numCorrectMBs; mbnum++, xpos++) {
+            
+            if (xpos / inParam->pictParam->numMBsInMBLine)
+               xpos = 0, ypos++;
+
+            fprintf(rvlc_stat, "fw: MB#%3d\tY0: %8d | Y1: %8d | Y2: %8d | Y3: %8d | U: %8d | V: %8d\n", 
+               inOutParam->currMBNum+mbnum, bitPos[0], bitPos[1], bitPos[2], bitPos[3], bitPos[4], bitPos[5]); 
+         }
+      }
+#endif
+
+         /* find next VP header (end of MB block data of this VP) */
+      sncCode = sncRewindAndSeekNewMPEGSync(errorBitPos-startBlockDataBitPos, inParam->inBuffer,
+         inParam->pictParam->fcode_forward, &error);      
+      if (error) {
+          if (error == ERR_BIB_NOT_ENOUGH_DATA) error = 0;
+          else { 
+              retValue = DMBS_ERR;
+              goto exitFunction;              
+          }
+      }
+
+      if (sncCode == SNC_EOB) {
+         inOutParam->currMBNum += numMBsInVP;
+         goto exitFunction;
+      }
+
+      nextVPBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+
+      backwards_errorBitPos = startBlockDataBitPos;
+
+      /* rewind the stuffing bits */
+      if (sncCode != SNC_NO_SYNC || !(nextVPBitPos % 8)) {
+         if(sncRewindStuffing(inParam->inBuffer, &error) != SNC_PATTERN) {
+            deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - Backwards decoding, stuffing not found.\n");
+            inOutParam->currMBNum = dmdIn.currMBNum;
+            goto exitFunction;
+         }
+      }
+
+      /* set the block pointers and counters to the end of the VP */
+      if ( dmdIn.yMBInFrame != NULL )
+        {
+          dmdIn.yMBInFrame = inOutParam->yMBInFrame + 16 * (numMBsInVP-1);
+          dmdIn.uBlockInFrame = inOutParam->uBlockInFrame + 8 * (numMBsInVP-1);
+          dmdIn.vBlockInFrame = inOutParam->vBlockInFrame + 8 * (numMBsInVP-1);
+        }
+      else
+        {
+            dmdIn.yMBInFrame = dmdIn.uBlockInFrame = dmdIn.vBlockInFrame = NULL;
+        }
+      dmdIn.xPosInMBs = inParam->xPosInMBs + (numMBsInVP-1);
+      dmdIn.yPosInMBs = inParam->yPosInMBs;
+
+      if (dmdIn.xPosInMBs / inParam->pictParam->numMBsInMBLine) {
+
+         int numFullLines = dmdIn.xPosInMBs / inParam->pictParam->numMBsInMBLine;
+
+         if ( dmdIn.yMBInFrame != NULL )
+            {
+                dmdIn.yMBInFrame += 15 * yWidth * numFullLines;
+                dmdIn.uBlockInFrame += 7 * uvWidth * numFullLines;
+                dmdIn.vBlockInFrame += 7 * uvWidth * numFullLines;
+            }
+         dmdIn.xPosInMBs = dmdIn.xPosInMBs % inParam->pictParam->numMBsInMBLine;
+         dmdIn.yPosInMBs+=numFullLines;
+      }
+
+      dmdIn.currMBNum = inOutParam->currMBNum + (numMBsInVP-1);
+
+      /* get the last MB of the list */
+      dlstTail(&MBList, (void **) &MBinstance);
+
+      for (currMBNumInVP = numMBsInVP-1; currMBNumInVP >= 0; currMBNumInVP--) {
+
+         /* header params */
+         dmdIn.cbpy = MBinstance->cbpy;
+         dmdIn.cbpc = MBinstance->cbpc;
+         dmdIn.quant = MBinstance->quant;
+
+         /* AC/DC prediction params */
+         dmdIn.switched = MBinstance->switched;
+
+         dmdIn.fTopOfVP = (u_char) (currMBNumInVP < inParam->pictParam->numMBsInMBLine);
+         dmdIn.fLeftOfVP = (u_char) (currMBNumInVP == 0);
+         dmdIn.fBBlockOut = (u_char) (currMBNumInVP <= inParam->pictParam->numMBsInMBLine);
+
+         inOutParam->aicData->ACpred_flag = MBinstance->ac_pred_flag;
+
+         /* error resilience params */
+         dmdIn.data_partitioned = 1;
+         dmdIn.DC = MBinstance->DC;
+
+         dmdIn.reversible_vlc = 1;
+         dmdIn.vlc_dec_direction = 1;
+                 
+         /* get the next macroblock data */
+         ret = dmdGetAndDecodeMPEGIMBBlocks(&dmdIn, hTranscoder);
+                 
+         if ( ret < 0 ) {
+             retValue = DMBS_ERR;
+             goto exitFunction;                      
+         }
+         else if ( ret == DMD_BIT_ERR ) {
+            backwards_errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+            deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - Backwards decoding, IMB Blocks error.\n");
+            break;
+         }
+
+
+         if (bibNumberOfFlushedBits(inParam->inBuffer) <= startBlockDataBitPos) {
+            deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - Backwards decoding, block data start position reached.\n");
+            break;
+         }
+
+         /* deincrement the block pointers and counters */
+         dmdIn.xPosInMBs--;
+         if (dmdIn.xPosInMBs < 0) {
+            if (dmdIn.yPosInMBs > 0) {
+               if ( dmdIn.yMBInFrame != NULL )
+                {
+                   dmdIn.yMBInFrame -= 15 * yWidth;
+                   dmdIn.uBlockInFrame -= 7 * uvWidth;
+                   dmdIn.vBlockInFrame -= 7 * uvWidth;
+                }
+               dmdIn.xPosInMBs = inParam->pictParam->numMBsInMBLine -1;
+               dmdIn.yPosInMBs--;
+            } else {
+               dmdIn.xPosInMBs = 0;
+               backwards_errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+               break;
+            }
+         }
+         if ( dmdIn.yMBInFrame != NULL )
+         {
+             dmdIn.yMBInFrame -= 16;
+             dmdIn.uBlockInFrame -= 8;
+             dmdIn.vBlockInFrame -= 8;
+         }
+
+         dmdIn.currMBNum--;
+         dlstPrev(&MBList, (void **) &MBinstance);
+      }
+
+      if (currMBNumInVP < 0) {
+         currMBNumInVP = 0;
+         backwards_errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+         deb("dmbsGetAndDecodeIMBsDataPartitioned:ERROR - Backwards decoding, all MBs decoded without detected error.\n");
+      }
+
+#ifdef DEBUG_OUTPUT
+      {
+         int bitPos[6], xpos, ypos, mbnum;
+         
+         for (xpos = dmdIn.xPosInMBs, ypos = dmdIn.yPosInMBs, mbnum = currMBNumInVP; mbnum < numMBsInVP; mbnum++, xpos++) {
+            
+            if (xpos / inParam->pictParam->numMBsInMBLine)
+               xpos = 0, ypos++;
+            
+            fprintf(rvlc_stat, "bw: MB#%3d\tY0: %8d | Y1: %8d | Y2: %8d | Y3: %8d | U: %8d | V: %8d\n", 
+               inOutParam->currMBNum+mbnum, bitPos[0], bitPos[1], bitPos[2], bitPos[3], bitPos[4], bitPos[5]); 
+         }
+
+         fprintf(rvlc_stat, "(blk_st):%8u (fw_det):%8u (bw_det):%8u (nxt_vp):%8u\n", 
+            startBlockDataBitPos, errorBitPos, backwards_errorBitPos, nextVPBitPos);
+      }
+#endif
+
+      /* strategy 1 */
+      if ((backwards_errorBitPos > errorBitPos) && 
+         (currMBNumInVP + 1 > numCorrectMBs)) {
+#ifdef DEBUG_OUTPUT
+         fprintf(rvlc_stat, "I-VOP: strategy 1!\n\n");
+#endif
+      
+      }
+      /* strategy 2 */
+      else if ((backwards_errorBitPos > errorBitPos) && 
+            (currMBNumInVP + 1 <= numCorrectMBs)) {
+         numCorrectMBs = VDC_MAX(currMBNumInVP-1,0);
+      }
+      /* strategy 3 */
+      else if ((backwards_errorBitPos <= errorBitPos) && 
+            (currMBNumInVP + 1 > numCorrectMBs)) {
+#ifdef DEBUG_OUTPUT
+         fprintf(rvlc_stat, "I-VOP: strategy 3!\n\n");
+#endif
+         
+      }
+      /* strategy 4 */
+      else if ((backwards_errorBitPos <= errorBitPos) && 
+            (currMBNumInVP + 1 <= numCorrectMBs)) {
+         numCorrectMBs = VDC_MAX(currMBNumInVP,0);
+      }
+         
+#ifdef DEBUG_OUTPUT
+      fclose (rvlc_stat);
+#endif
+
+      /* if backward decoding, set the currentMB to the first MB of the next VP */
+      inOutParam->currMBNum += numMBsInVP;
+
+    } else {   
+      /* if no error or no backward decoding, set the currentMB */
+      inOutParam->currMBNum = dmdIn.currMBNum;
+   }
+
+#ifdef DEBUG_OUTPUT
+   if (errorBitPos)
+   deb_core("%08lu: MB#%3d VP Data Starts\n%08lu: DC Marker\n%08lu: DCT data starts\n%08lu: MB#%3d Next VP/VOP Header\n%08lu: Fw Error Detected\n%08lu: Bw Error Detected\n", 
+      startVPBitPos, (inParam->yPosInMBs*inParam->pictParam->numMBsInMBLine + inParam->xPosInMBs),
+      DCMarkerBitPos, startBlockDataBitPos, nextVPBitPos, lastMBNum, 
+      errorBitPos,backwards_errorBitPos);
+#endif
+
+exitFunction:
+
+   deb1p("dmbsGetAndDecodeIMBsDataPartitioned:Finished.\n",inOutParam->currMBNum);
+   /* Free the MB list */
+   if (MBList.numItems != 0)
+   {     
+      dlstHead(&MBList, (void **) &MBinstance);
+      dlstRemove(&MBList, (void **) &MBinstance);
+      while (MBinstance != NULL) {
+         free(MBinstance);
+         dlstRemove(&MBList, (void **) &MBinstance);
+      }
+      dlstClose(&MBList);
+   }
+
+   return retValue;   
+}
+
+
+/* {{-output"dmbsGetAndDecodePMBsDataPartitioned.txt"}} */
+/*
+ * dmbsGetAndDecodePMBsDataPartitioned
+ *    
+ *
+ * Parameters:
+ *    inParam                    input parameters
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *
+ * Function:
+ *    This function gets and decodes the MBs of a data partitioned 
+ *    Video Packet in an Inter Frame.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured
+ *
+ */
+
+int dmbsGetAndDecodePMBsDataPartitioned(
+   const dmbPFrameMBInParam_t *inParam,
+   dmbPFrameMBInOutParam_t *inOutParam,
+   int *quantParams, CMPEG4Transcoder *hTranscoder)
+/* {{-output"dmbsGetAndDecodePMBsDataPartitioned.txt"}} */
+{
+   int currMBNumInVP, currMBNum, numMBsInVP, lastMBNum, numCorrectMBs, numCorrectBackwardsMBs = 0;
+   int xPosInMBs, yPosInMBs;
+   int yWidth = inParam->pictParam->lumMemWidth;
+   int uvWidth = yWidth / 2;
+   int bitErrorIndication = 0, 
+      ret = 0, sncCode, bitsGot,
+      bitErrorsInPart1 = 0;
+   u_int32 errorBitPos = 0,
+         backwards_errorBitPos = 0,
+         nextVPBitPos = 0,
+         startBlockDataBitPos = 0,
+         motionMarkerBitPos = 0;
+   u_char fPart1Error=0, fPart2Error=0, fBlockError=0;
+   u_char *currYMBInFrame, *currUBlkInFrame, *currVBlkInFrame;
+   u_char fourMVs = 0;
+#ifdef DEBUG_OUTPUT
+   FILE *rvlc_stat;
+#endif
+
+   int16 error = 0;
+
+   dlst_t MBList;
+   vdxPMBListItem_t *MBinstance;
+
+   vdxGetDataPartitionedPMBLayerInputParam_t vdxDPIn;
+   
+   if (dlstOpen(&MBList) < 0)
+      return DMBS_ERR;
+
+   currMBNum = inParam->yPosInMBs*inParam->pictParam->numMBsInMBLine + inParam->xPosInMBs;
+
+   /* Store initial quantizer */
+   quantParams[currMBNum] = inOutParam->quant;
+
+   /* 
+    * read the first partition: DC coefficients, etc. 
+    */
+
+   vdxDPIn.intra_dc_vlc_thr = inParam->pictParam->intra_dc_vlc_thr;
+   vdxDPIn.quant = inOutParam->quant;
+   vdxDPIn.f_code = inParam->pictParam->fcode_forward;
+
+   ret = vdxGetDataPartitionedPMBLayer_Part1(inParam->inBuffer, inParam->outBuffer, 
+         inParam->bufEdit, inParam->iColorEffect, &(inOutParam->StartByteIndex), &(inOutParam->StartBitIndex),
+         &vdxDPIn, &MBList, &bitErrorIndication);
+   bitErrorsInPart1 = bitErrorIndication;
+   if (ret < 0)
+      return DMBS_ERR;
+   else if (ret == VDX_OK_BUT_BIT_ERROR) {
+
+      /* Must break down decoding, because even if we know the number of MBs 
+         in the 2nd partition, the content (quant, ac_pred_flag) is dependent
+        on "not_coded" and the type of MB (I-vop or P-vop), which information
+        is derived from the 1st !currupted! partition. */
+      
+      deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - Part 1 Error.\n");
+      fPart1Error = 1;
+      bitErrorIndication = 0;
+      errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+   } else {
+      motionMarkerBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+   }
+
+   /* read the next VP header to determine the number of MBs in this VP */
+   if ( fPart1Error ) {
+       /* Stop decoding this segment */
+      goto exitFunction;
+   }
+   else {
+      sncCode = sncRewindAndSeekNewMPEGSync( 1,
+          inParam->inBuffer, inParam->pictParam->fcode_forward, &error);
+   }
+   if (error) {
+      if (error == ERR_BIB_NOT_ENOUGH_DATA) error = 0;
+      else 
+          return DMBS_ERR;
+   }
+   
+   nextVPBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+   
+   if (sncCode == SNC_VIDPACK) {
+      
+      vdxVideoPacketHeader_t header;
+      vdxGetVideoPacketHeaderInputParam_t vdxParam;
+      int retValue = 0;
+      
+      vdxParam.fcode_forward = inParam->pictParam->fcode_forward;
+      vdxParam.time_increment_resolution = inParam->pictParam->time_increment_resolution;
+      vdxParam.numOfMBs = inParam->pictParam->numMBsInGOB;
+      
+      retValue = vdxGetVideoPacketHeader(inParam->inBuffer, &vdxParam, &header, &bitErrorIndication);
+      if (retValue < 0) {
+         return DMBS_ERR;
+      } else if (retValue == VDX_OK_BUT_BIT_ERROR) {
+         /* If bit error occurred */
+         deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - Reading Next VP Header error.\n");
+         lastMBNum = 0;
+      } else {
+         lastMBNum = header.currMBNum;
+      }
+   } else {
+      lastMBNum = inParam->pictParam->numMBsInGOB;
+   }
+
+   /* signaling to the caller function, that the Next VP header has been read */
+   inOutParam->currMBNumInVP = lastMBNum;
+      
+   /* rewind the bits before the next resync_marker */
+   bibRewindBits(bibNumberOfFlushedBits(inParam->inBuffer) - (fPart1Error ? nextVPBitPos: motionMarkerBitPos),
+      inParam->inBuffer, &error);
+   
+   if ((bitErrorIndication && !fPart1Error) || 
+      (lastMBNum <= currMBNum || lastMBNum > inParam->pictParam->numMBsInGOB) ||
+      (sncCode == SNC_EOB)) {
+      bitErrorIndication = 0;
+      numMBsInVP = MBList.numItems;
+   } else
+      numMBsInVP = lastMBNum - currMBNum;
+
+   if (numMBsInVP != MBList.numItems || fPart1Error) {
+      deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - MB list length != num MBs.\n");
+      if ( fPart1Error || bitErrorsInPart1 ) {
+         /* Discard few MBs from the end of the list, 
+            since there are errors somewhere in the bitstream. 
+            If the list is short due to the missing packet, 
+            all the read MBs are likely to be OK and there is no
+            need to discard them */
+         dlstTail(&MBList, (void **) &MBinstance);
+         dlstRemove(&MBList, (void **) &MBinstance);
+         free( MBinstance );
+         if (numMBsInVP > MBList.numItems ) {
+            /* Take still one away */
+            dlstTail(&MBList, (void **) &MBinstance);
+            dlstRemove(&MBList, (void **) &MBinstance);
+            free( MBinstance );
+         }
+      }
+      if (numMBsInVP < MBList.numItems ) {
+         /* Discard all the extra MBs from the end of the list + 2 just to be sure, 
+            since there are errors somewhere in the bitstream */
+         while ( MBList.numItems > VDC_MAX(numMBsInVP-2,0) ) {
+            dlstTail(&MBList, (void **) &MBinstance);
+            dlstRemove(&MBList, (void **) &MBinstance);
+            free( MBinstance );
+         }
+      }
+      fPart1Error = 1;
+      errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+   }
+
+   if (currMBNum + numMBsInVP > inParam->pictParam->numMBsInGOB) {
+      deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - Determined numMBsInVP overrun numMBsInFrame.\n");
+      fPart1Error = 1;
+      errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+      numMBsInVP = inParam->pictParam->numMBsInGOB - currMBNum;
+   }
+
+   if (!fPart1Error) {
+      
+      /* Flush the Motion_Marker */
+      bibFlushBits(MP4_MOTION_MARKER_COMB_LENGTH, inParam->inBuffer, &bitsGot, &bitErrorIndication, &error);
+      if (error)
+         return DMBS_ERR;
+      
+      /*
+       * Read the second partition header: cpby, ac_pred_flag 
+       */
+
+      ret = vdxGetDataPartitionedPMBLayer_Part2(inParam->inBuffer, inParam->outBuffer, 
+                inParam->bufEdit, inParam->iColorEffect, &(inOutParam->StartByteIndex), 
+                &(inOutParam->StartBitIndex), hTranscoder, 
+                &vdxDPIn, &MBList, &bitErrorIndication);
+      if (ret < 0)
+         return DMBS_ERR;
+      else if (ret == VDX_OK_BUT_BIT_ERROR) {
+         deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - Part 2 Error.\n");
+         fPart2Error = 1;
+         /* Stop decoding this segment */
+         goto exitFunction;
+      }
+   }
+
+   /*
+    * Count the motion vectors and copy the prediction blocks 
+    */
+   
+   xPosInMBs = inParam->xPosInMBs;
+   yPosInMBs = inParam->yPosInMBs;
+   currYMBInFrame = inOutParam->yMBInFrame;
+   currUBlkInFrame = inOutParam->uBlockInFrame;
+   currVBlkInFrame = inOutParam->vBlockInFrame;
+
+   /* get the first MB of the list */
+   dlstHead(&MBList, (void **) &MBinstance);
+
+   for (currMBNumInVP = 0; currMBNumInVP < numMBsInVP; currMBNumInVP++) {
+
+      /* Motion vectors for P-macroblock */
+      int mvx[4];
+      int mvy[4];
+       int mbPos;       /* the position of the current macroblock, 
+                           -1 = the leftmost MB of the image, 
+                           0 = MB is not in the border of the image, 
+                           1 = rightmost MB of the image */
+
+      blcCopyPredictionMBParam_t blcParam;
+      
+      /* if MBList is shorter then the number of MBs in the VP */
+      if (MBinstance == NULL) {
+         deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - MB list < num MBs.\n");
+         inOutParam->currMBNum = currMBNum;
+         goto exitFunction;
+      }
+
+      if (!MBinstance->fCodedMB) {
+         
+         inOutParam->fCodedMBs[currMBNum] = 0;
+         /* Motion vectors to 0 */ 
+         mvx[0] = mvx[1] = mvx[2] = mvx[3] = 0;
+         mvy[0] = mvy[1] = mvy[2] = mvy[3] = 0;
+         mvcMarkMBNotCoded(
+            inOutParam->mvcData, 
+            xPosInMBs,
+            yPosInMBs,
+            inParam->pictParam->tr);
+         MBinstance->cbpy = 0;
+         fourMVs = 0;
+
+      } else {
+
+         inOutParam->fCodedMBs[currMBNum] = 1;
+         inOutParam->numOfCodedMBs++;
+         
+         if(MBinstance->mbClass == VDX_MB_INTER) {
+            int currMVNum;
+
+            fourMVs = (u_char) (MBinstance->numMVs == 4);
+         
+            for (currMVNum = 0; currMVNum < MBinstance->numMVs; currMVNum++) {
+
+               mvcCalcMPEGMV(
+                  inOutParam->mvcData,
+                  MBinstance->mvx[currMVNum], MBinstance->mvy[currMVNum],
+                  &mvx[currMVNum], &mvy[currMVNum],
+                  (u_char) currMVNum, fourMVs,
+                  (u_char) (currMBNumInVP < inParam->pictParam->numMBsInMBLine),
+                  (u_char) (currMBNumInVP == 0), 
+                  (u_char) (currMBNumInVP < (inParam->pictParam->numMBsInMBLine-1)),
+                  xPosInMBs,
+                  yPosInMBs,
+                  inParam->pictParam->tr,
+                  (MBinstance->mbClass == VDX_MB_INTRA) ? MVC_MB_INTRA : MVC_MB_INTER,
+                  &error);   
+
+                if (error == ERR_MVC_MVPTR)
+                     return DMB_BIT_ERR;
+                else if (error)
+                     return DMB_ERR;
+            }
+            
+            if (MBinstance->numMVs == 1) {
+               mvx[1] = mvx[2] = mvx[3] = mvx[0];
+               mvy[1] = mvy[2] = mvy[3] = mvy[0];
+            }
+
+         } else { /* VDX_MB_INTRA */
+            mvcMarkMBIntra(inOutParam->mvcData, xPosInMBs, yPosInMBs, 
+               inParam->pictParam->tr);
+
+         }
+      }
+
+      /* mbPos, needed in blcCopyPredictionMB */
+      if (xPosInMBs == 0)
+         mbPos = -1;
+      else if (xPosInMBs == inParam->pictParam->numMBsInMBLine - 1)
+         mbPos = 1;
+      else
+         mbPos = 0;
+
+      if (!MBinstance->fCodedMB || MBinstance->mbClass == VDX_MB_INTER) {
+                blcParam.refY = inParam->refY;
+                blcParam.refU = inParam->refU;
+                blcParam.refV = inParam->refV;
+                blcParam.currYMBInFrame = currYMBInFrame;
+                blcParam.currUBlkInFrame = currUBlkInFrame;
+                blcParam.currVBlkInFrame = currVBlkInFrame;
+                blcParam.uvBlkXCoord = xPosInMBs * 8;
+                blcParam.uvBlkYCoord = yPosInMBs * 8;
+                blcParam.uvWidth = uvWidth;
+                blcParam.uvHeight = inParam->pictParam->lumMemHeight / 2;
+                blcParam.mvcData = inOutParam->mvcData;
+                blcParam.mvx = mvx;
+                blcParam.mvy = mvy;
+                blcParam.mbPlace = mbPos;
+                blcParam.fAdvancedPrediction = inParam->pictParam->fAP;
+                blcParam.fMVsOverPictureBoundaries =
+                    inParam->pictParam->fMVsOverPictureBoundaries;
+                blcParam.diffMB = inOutParam->diffMB;
+                blcParam.rcontrol = inParam->pictParam->rtype;
+                blcParam.fourMVs = fourMVs;
+                
+                /* MVE */
+                if (inParam->iGetDecodedFrame || hTranscoder->NeedDecodedYUVFrame())
+                {
+                    
+                    /* Do motion compensation */
+                    if (blcCopyPredictionMB(&blcParam) < 0) {
+                        deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - Block copying failed, illegal MV.\n");
+                        inOutParam->currMBNum = currMBNum;
+                        goto exitFunction;
+                        /* MV was illegal => caused by bitError */
+                    }
+                }
+      }
+            
+      currMBNum++;
+
+      /* increment the block pointers and counters */
+      if ( currYMBInFrame != NULL )
+        {
+          currYMBInFrame += 16;
+          currUBlkInFrame += 8;
+          currVBlkInFrame += 8;
+        }
+      xPosInMBs++;
+
+      if (xPosInMBs == inParam->pictParam->numMBsInMBLine) {
+          if ( currYMBInFrame != NULL )
+            {
+                currYMBInFrame += 15 * yWidth;
+                currUBlkInFrame += 7 * uvWidth;
+                currVBlkInFrame += 7 * uvWidth;
+            }
+            xPosInMBs = 0;
+            yPosInMBs++;
+            if (yPosInMBs >= inParam->pictParam->numMBLinesInGOB)
+                break;
+      }
+            
+      /* MVE */
+      MBinstance->mv_x[0] = mvx[0]; MBinstance->mv_x[1] = mvx[1]; MBinstance->mv_x[2] = mvx[2]; MBinstance->mv_x[3] = mvx[3];
+      MBinstance->mv_y[0] = mvy[0]; MBinstance->mv_y[1] = mvy[1]; MBinstance->mv_y[2] = mvy[2]; MBinstance->mv_y[3] = mvy[3];
+            
+      dlstNext(&MBList, (void **) &MBinstance);
+   }
+     
+   /* if error occured in the first 2 MV&header partitions, then stop decoding */
+   if (fPart1Error || fPart2Error) {
+
+#ifdef DEBUG_OUTPUT
+      deb_core("%08lu: MB#%3d VP Data Starts\n%08lu: Motion Marker\n%08lu: DCT data starts\n%08lu: MB#%3d Next VP/VOP Header\n%08lu: Fw Error Detected\n", 
+         startVPBitPos, (inParam->yPosInMBs*inParam->pictParam->numMBsInMBLine + inParam->xPosInMBs),
+         motionMarkerBitPos, startBlockDataBitPos, nextVPBitPos, lastMBNum, 
+         errorBitPos);
+#endif
+      
+      inOutParam->currMBNum = currMBNum;
+      goto exitFunction;
+   }
+
+   /*
+    * Read block data partition in forward direction 
+    */
+
+   xPosInMBs = inParam->xPosInMBs;
+   yPosInMBs = inParam->yPosInMBs;
+   currMBNumInVP = 0;
+   currMBNum = inParam->yPosInMBs*inParam->pictParam->numMBsInMBLine + inParam->xPosInMBs;
+   currYMBInFrame = inOutParam->yMBInFrame;
+   currUBlkInFrame = inOutParam->uBlockInFrame;
+   currVBlkInFrame = inOutParam->vBlockInFrame;
+
+   startBlockDataBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+
+   for (dlstHead(&MBList, (void **) &MBinstance); 
+     MBinstance != NULL; 
+     dlstNext(&MBList, (void **) &MBinstance))
+   {
+        /* MVE */
+        hTranscoder->OnePMBDataStartedDataPartitioned(MBinstance, &MBList, currMBNumInVP, currMBNum);
+         
+        if (MBinstance->fCodedMB) {
+             
+            /* If INTER MB */
+            if (MBinstance->mbClass == VDX_MB_INTER) {
+                dmdPParam_t dmdIn;
+                     
+                dmdIn.inBuffer = inParam->inBuffer;
+                dmdIn.outBuffer = inParam->outBuffer;
+                dmdIn.bufEdit = inParam->bufEdit;
+                dmdIn.iColorEffect = inParam->iColorEffect;
+                dmdIn.iGetDecodedFrame = inParam->iGetDecodedFrame;
+                dmdIn.cbpy = MBinstance->cbpy;
+                dmdIn.cbpc = MBinstance->cbpc;
+                dmdIn.quant = MBinstance->quant;
+                     
+                /* MVE */
+                dmdIn.refY = inParam->refY;
+                dmdIn.refU = inParam->refU;
+                dmdIn.refV = inParam->refV;
+                dmdIn.mvx  = MBinstance->mv_x;
+                dmdIn.mvy  = MBinstance->mv_y;
+
+                dmdIn.currYMBInFrame = currYMBInFrame;
+                dmdIn.currUBlkInFrame = currUBlkInFrame;
+                dmdIn.currVBlkInFrame = currVBlkInFrame;
+                dmdIn.uvWidth = uvWidth;
+                dmdIn.reversible_vlc = inParam->pictParam->reversible_vlc;     
+                dmdIn.vlc_dec_direction = 0;
+
+                dmdIn.xPosInMBs = xPosInMBs;
+                dmdIn.yPosInMBs = yPosInMBs;
+                dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+                     
+                /* Store quantizer */
+                quantParams[currMBNum] = MBinstance->quant;
+                     
+                /* Update the AIC module data, marking the MB as Inter (quant=0) */
+                aicBlockUpdate (inOutParam->aicData, currMBNum, 0, NULL, 0, 0);
+                     
+                /* Decode prediction error blocks */
+                ret = dmdGetAndDecodeMPEGPMBBlocks(&dmdIn, hTranscoder);
+                     
+                if ( ret < 0)
+                    return DMBS_ERR;
+                else if ( ret == DMD_BIT_ERR ) {
+                    deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - PMB Blocks decoding failed.\n");
+                    fBlockError = 1;
+                    errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+                    break;
+                }
+
+            }
+            /* Else block layer decoding of INTRA macroblock */
+            else {
+                dmdMPEGIParam_t dmdIn;
+                     
+                /* Get block layer parameters and decode them */
+                dmdIn.inBuffer = inParam->inBuffer;
+                dmdIn.outBuffer = inParam->outBuffer;
+                dmdIn.bufEdit = inParam->bufEdit;
+                dmdIn.iColorEffect = inParam->iColorEffect;
+                dmdIn.iGetDecodedFrame = inParam->iGetDecodedFrame;
+                     
+                dmdIn.cbpy = MBinstance->cbpy;
+                dmdIn.cbpc = MBinstance->cbpc;
+                dmdIn.quant = MBinstance->quant;
+                dmdIn.yWidth = yWidth;
+                dmdIn.yMBInFrame = currYMBInFrame;
+                dmdIn.uBlockInFrame = currUBlkInFrame;
+                dmdIn.vBlockInFrame = currVBlkInFrame;
+                     
+                dmdIn.xPosInMBs = xPosInMBs;
+                dmdIn.yPosInMBs = yPosInMBs;
+                dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+                dmdIn.numMBLinesInGOB = inParam->pictParam->numMBLinesInGOB;
+                dmdIn.pictureType = inParam->pictParam->pictureType;
+                     
+                inOutParam->aicData->ACpred_flag = MBinstance->ac_pred_flag;
+                dmdIn.aicData = inOutParam->aicData;
+                     
+                dmdIn.data_partitioned = 1;
+                dmdIn.switched = MBinstance->switched;
+                dmdIn.DC = MBinstance->DC;
+                     
+                dmdIn.reversible_vlc = inParam->pictParam->reversible_vlc;
+                dmdIn.vlc_dec_direction = 0;
+                     
+                dmdIn.currMBNum = currMBNum;
+                     
+                dmdIn.fTopOfVP = (u_char) 
+                        (currMBNumInVP < inParam->pictParam->numMBsInMBLine ||
+                         !aicIsBlockValid(inOutParam->aicData, currMBNum-inParam->pictParam->numMBsInMBLine));
+                dmdIn.fLeftOfVP = (u_char)
+                        (currMBNumInVP == 0 || 
+                         xPosInMBs == 0 ||
+                         !aicIsBlockValid(inOutParam->aicData, currMBNum-1));
+                dmdIn.fBBlockOut = (u_char) 
+                        (currMBNumInVP <= inParam->pictParam->numMBsInMBLine ||
+                         xPosInMBs == 0 ||
+                         !aicIsBlockValid(inOutParam->aicData, currMBNum-inParam->pictParam->numMBsInMBLine-1));
+                     
+                ret = dmdGetAndDecodeMPEGIMBBlocks(&dmdIn, hTranscoder);
+                     
+                if ( ret < 0 )
+                    return DMBS_ERR;
+                else if ( ret == DMD_BIT_ERR ) {
+                    deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - IMB Blocks decoding failed.\n");
+                    fBlockError = 1;
+                    errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+                    break;
+                }
+            }
+                 
+        } else {  /* end of if coded MB */
+                     
+            /* Update the AIC module data, marking the MB as Not Coded (quant=0) */
+            aicBlockUpdate (inOutParam->aicData, currMBNum, 0, NULL, 0, 0);
+        }
+                 
+        currMBNumInVP++;
+        currMBNum++;
+
+        /* increment the block pointers and counters */
+        if ( currYMBInFrame != NULL )
+         {
+            currYMBInFrame += 16;
+            currUBlkInFrame += 8;
+            currVBlkInFrame += 8;
+         }
+        xPosInMBs++;
+
+        if (xPosInMBs == inParam->pictParam->numMBsInMBLine) {
+          if ( currYMBInFrame != NULL )
+            {
+                currYMBInFrame += 15 * yWidth;
+                currUBlkInFrame += 7 * uvWidth;
+                currVBlkInFrame += 7 * uvWidth;
+            }
+            xPosInMBs = 0;
+            yPosInMBs++;
+            if (yPosInMBs >= inParam->pictParam->numMBLinesInGOB)
+                 break;
+        }
+   } // end of for-loop
+   
+   if (!fPart1Error && !fPart2Error && !fBlockError) {
+      if (sncCode == SNC_EOB) {
+         inOutParam->currMBNum += numMBsInVP;
+         goto exitFunction;
+      } else {
+         sncCode = sncCheckMpegSync(inParam->inBuffer, inParam->pictParam->fcode_forward, &error);
+         if (sncCode == SNC_NO_SYNC) {
+            deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - After block data no start code found.\n");
+            if (lastMBNum != 0) 
+               fBlockError = 1;
+            errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+         }
+      }
+   }
+
+   /*
+    * In case of error, read block data partition in backward direction 
+   */
+
+   if (fBlockError && inParam->pictParam->reversible_vlc) {
+      numCorrectMBs = currMBNumInVP;
+
+#ifdef DEBUG_OUTPUT
+      {
+         int bitPos[6], xpos, ypos, mbnum;
+         
+         rvlc_stat = fopen("rvlc.log", "a+t");
+         
+         fprintf(rvlc_stat, "P-VOP: (MB_first):%3d  (MB_last):%3d\n", 
+            inOutParam->currMBNum, (inOutParam->currMBNum + numMBsInVP-1));
+         
+         for (xpos = inParam->xPosInMBs, ypos = inParam->yPosInMBs, mbnum = 0; mbnum < numCorrectMBs; mbnum++, xpos++) {
+            
+            if (xpos / inParam->pictParam->numMBsInMBLine)
+               xpos = 0, ypos++;
+
+            fprintf(rvlc_stat, "fw: MB#%3d\tY0: %8d | Y1: %8d | Y2: %8d | Y3: %8d | U: %8d | V: %8d\n", 
+               inOutParam->currMBNum+mbnum, bitPos[0], bitPos[1], bitPos[2], bitPos[3], bitPos[4], bitPos[5]); 
+         }
+      }
+#endif
+
+         /* find next VP header (end of MB block data of this VP) */
+      sncCode = sncRewindAndSeekNewMPEGSync(errorBitPos-startBlockDataBitPos, inParam->inBuffer,
+         inParam->pictParam->fcode_forward, &error);      
+      if (error) {
+          if (error == ERR_BIB_NOT_ENOUGH_DATA) error = 0;
+          else 
+              return DMBS_ERR;
+      }
+
+      if (sncCode == SNC_EOB) {
+         inOutParam->currMBNum += numMBsInVP;
+         goto exitFunction;
+      }
+
+      nextVPBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+   
+      backwards_errorBitPos = startBlockDataBitPos;
+
+      /* rewind the stuffing bits */
+      if (sncCode != SNC_NO_SYNC || !(nextVPBitPos % 8)) {
+         if(sncRewindStuffing(inParam->inBuffer, &error) != SNC_PATTERN) {
+            deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - Backwards decoding, stuffing not found.\n");
+            goto exitFunction;
+         }
+      }
+
+      /* set the block pointers and counters to the end of the VP */
+      if ( currYMBInFrame != NULL )
+        {
+          currYMBInFrame = inOutParam->yMBInFrame + 16 * (numMBsInVP-1);
+          currUBlkInFrame = inOutParam->uBlockInFrame + 8 * (numMBsInVP-1);
+          currVBlkInFrame = inOutParam->vBlockInFrame + 8 * (numMBsInVP-1);
+        }
+
+      xPosInMBs = inParam->xPosInMBs + (numMBsInVP-1);
+      yPosInMBs = inParam->yPosInMBs;
+
+      if (xPosInMBs / inParam->pictParam->numMBsInMBLine) {
+
+         int numFullLines = xPosInMBs / inParam->pictParam->numMBsInMBLine;
+
+         if ( currYMBInFrame != NULL )
+            {
+             currYMBInFrame += 15 * yWidth * numFullLines;
+             currUBlkInFrame += 7 * uvWidth * numFullLines;
+             currVBlkInFrame += 7 * uvWidth * numFullLines;
+            }
+         xPosInMBs = xPosInMBs % inParam->pictParam->numMBsInMBLine;
+         yPosInMBs+=numFullLines;
+      }
+
+      currMBNum = inParam->yPosInMBs*inParam->pictParam->numMBsInMBLine +
+               inParam->xPosInMBs + (numMBsInVP-1);
+      currMBNumInVP = numMBsInVP-1;
+
+      for (dlstTail(&MBList, (void **) &MBinstance); 
+         MBinstance != NULL; 
+         dlstPrev(&MBList, (void **) &MBinstance))
+      {
+         if (MBinstance->fCodedMB) 
+         {
+
+             /* If INTER MB */
+             if (MBinstance->mbClass == VDX_MB_INTER) 
+             {
+                dmdPParam_t dmdIn;
+
+                dmdIn.inBuffer = inParam->inBuffer;
+                dmdIn.outBuffer = inParam->outBuffer;
+                dmdIn.bufEdit = inParam->bufEdit;
+                dmdIn.iColorEffect = inParam->iColorEffect;
+                dmdIn.iGetDecodedFrame = inParam->iGetDecodedFrame;
+                dmdIn.cbpy = MBinstance->cbpy;
+                dmdIn.cbpc = MBinstance->cbpc;
+                dmdIn.quant = MBinstance->quant;
+                            
+                /* MVE */
+                dmdIn.refY = inParam->refY;
+                dmdIn.refU = inParam->refU;
+                dmdIn.refV = inParam->refV;
+                dmdIn.mvx  = MBinstance->mv_x;
+                dmdIn.mvy  = MBinstance->mv_y;
+                            
+                dmdIn.currYMBInFrame = currYMBInFrame;
+                dmdIn.currUBlkInFrame = currUBlkInFrame;
+                dmdIn.currVBlkInFrame = currVBlkInFrame;
+                dmdIn.uvWidth = uvWidth;
+                
+                dmdIn.reversible_vlc = inParam->pictParam->reversible_vlc;     
+                dmdIn.vlc_dec_direction = 1;
+                
+                dmdIn.xPosInMBs = xPosInMBs;
+                dmdIn.yPosInMBs = yPosInMBs;
+                dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+
+                /* Update the AIC module data, marking the MB as Inter (quant=0) */
+                aicBlockUpdate (inOutParam->aicData, currMBNum, 0, NULL, 0, 0);
+                
+                /* Decode prediction error blocks */
+                ret = dmdGetAndDecodeMPEGPMBBlocks(&dmdIn, hTranscoder);
+
+                if ( ret < 0)
+                   return DMBS_ERR;
+                else if ( ret == DMD_BIT_ERR ) {
+                   deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - Backwards decoding, PMB Blocks decoding failed.\n");
+                   backwards_errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+                   break;
+                }
+
+             }
+             /* Else block layer decoding of INTRA macroblock */
+             else 
+             {
+                dmdMPEGIParam_t dmdIn;
+
+                /* Get block layer parameters and decode them */
+                dmdIn.inBuffer = inParam->inBuffer;
+                dmdIn.outBuffer = inParam->outBuffer;
+                dmdIn.bufEdit = inParam->bufEdit;
+                dmdIn.iColorEffect = inParam->iColorEffect;
+                dmdIn.iGetDecodedFrame = inParam->iGetDecodedFrame;
+
+                dmdIn.cbpy = MBinstance->cbpy;
+                dmdIn.cbpc = MBinstance->cbpc;
+                dmdIn.quant = MBinstance->quant;
+                dmdIn.yWidth = yWidth;
+                dmdIn.yMBInFrame = currYMBInFrame;
+                dmdIn.uBlockInFrame = currUBlkInFrame;
+                dmdIn.vBlockInFrame = currVBlkInFrame;
+
+                dmdIn.xPosInMBs = xPosInMBs;
+                dmdIn.yPosInMBs = yPosInMBs;
+                dmdIn.numMBsInMBLine = inParam->pictParam->numMBsInMBLine;
+                dmdIn.numMBLinesInGOB = inParam->pictParam->numMBLinesInGOB;
+                dmdIn.pictureType = inParam->pictParam->pictureType;
+
+                inOutParam->aicData->ACpred_flag = MBinstance->ac_pred_flag;
+                dmdIn.aicData = inOutParam->aicData;
+
+                dmdIn.data_partitioned = inParam->pictParam->data_partitioned;
+                dmdIn.switched = MBinstance->switched;
+                dmdIn.DC = MBinstance->DC;
+
+                dmdIn.reversible_vlc = inParam->pictParam->reversible_vlc;
+                dmdIn.vlc_dec_direction = 1;
+
+                dmdIn.currMBNum = currMBNum;
+
+                dmdIn.fTopOfVP = (u_char) 
+                   (currMBNumInVP < inParam->pictParam->numMBsInMBLine ||
+                    !aicIsBlockValid(inOutParam->aicData, currMBNum-inParam->pictParam->numMBsInMBLine));
+                dmdIn.fLeftOfVP = (u_char)
+                   (currMBNumInVP == 0 || 
+                    xPosInMBs == 0 ||
+                    !aicIsBlockValid(inOutParam->aicData, currMBNum-1));
+                dmdIn.fBBlockOut = (u_char) 
+                   (currMBNumInVP <= inParam->pictParam->numMBsInMBLine ||
+                    xPosInMBs == 0 ||
+                    !aicIsBlockValid(inOutParam->aicData, currMBNum-inParam->pictParam->numMBsInMBLine-1));
+                
+                ret = dmdGetAndDecodeMPEGIMBBlocks(&dmdIn, hTranscoder);
+
+                if ( ret < 0 )
+                   return DMBS_ERR;
+                else if ( ret == DMD_BIT_ERR ) {
+                   deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - Backwards decoding, IMB Blocks decoding failed.\n");
+                   backwards_errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+
+                   break;
+                }
+             } // end of else
+
+         } /* end of if coded MB */
+         else 
+         {  
+       
+            /* Update the AIC module data, marking the MB as Not Coded (quant=0) */
+            aicBlockUpdate (inOutParam->aicData, currMBNum, 0, NULL, 0, 0);
+         }
+
+         if (bibNumberOfFlushedBits(inParam->inBuffer) <= startBlockDataBitPos) {
+            deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - Backwards decoding, block data start position reached.\n");
+            break;
+         }
+
+         /* deincrement the block pointers and counters */
+         xPosInMBs--;
+         if (xPosInMBs < 0) {
+            if (yPosInMBs > 0) {
+              if ( currYMBInFrame != NULL )
+                {
+                   currYMBInFrame -= 15 * yWidth;
+                   currUBlkInFrame -= 7 * uvWidth;
+                   currVBlkInFrame -= 7 * uvWidth;
+                }
+               xPosInMBs = inParam->pictParam->numMBsInMBLine -1;
+               yPosInMBs--;
+            } else {
+               xPosInMBs = 0;
+               backwards_errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+               break;
+            }
+         }
+          if ( currYMBInFrame != NULL )
+            {
+             currYMBInFrame -= 16;
+             currUBlkInFrame -= 8;
+             currVBlkInFrame -= 8;
+            }
+
+         currMBNumInVP--;
+         currMBNum--;
+      }
+
+      if (currMBNumInVP < 0) {
+         currMBNumInVP = 0;
+         backwards_errorBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+         deb("dmbsGetAndDecodePMBsDataPartitioned:ERROR - Backwards decoding, all MBs decoded without detected error.\n");
+      }
+
+#ifdef DEBUG_OUTPUT
+      {
+         int bitPos[6], xpos, ypos, mbnum;
+
+         xPosInMBs++;
+         if (xPosInMBs >= inParam->pictParam->numMBsInMBLine) {
+            xPosInMBs = 0;
+            if (yPosInMBs < (inParam->pictParam->numMBLinesInGOB-1))
+               yPosInMBs++;
+         }
+
+         for (xpos = xPosInMBs, ypos = yPosInMBs, mbnum = (currMBNumInVP+1); mbnum < numMBsInVP; mbnum++, xpos++) {
+            
+            if (xpos / inParam->pictParam->numMBsInMBLine)
+               xpos = 0, ypos++;
+            
+            fprintf(rvlc_stat, "bw: MB#%3d\tY0: %8d | Y1: %8d | Y2: %8d | Y3: %8d | U: %8d | V: %8d\n", 
+               inOutParam->currMBNum+mbnum, bitPos[0], bitPos[1], bitPos[2], bitPos[3], bitPos[4], bitPos[5]); 
+         }
+         
+         fprintf(rvlc_stat, "(blk_st):%8u (fw_det):%8u (bw_det):%8u (nxt_vp):%8u\n", 
+            startBlockDataBitPos, errorBitPos, backwards_errorBitPos, nextVPBitPos);
+      }
+#endif
+      
+      /* 
+       * Based on the decoder MB counters forwards and backwards, 
+       * recopy the "to be discarded" blocks 
+       */
+
+      /* strategy 1 */
+      if ((backwards_errorBitPos > errorBitPos) && 
+         (currMBNumInVP + 1 > numCorrectMBs)) {
+         numCorrectBackwardsMBs = VDC_MIN(currMBNumInVP + 2,numMBsInVP);       
+         numCorrectMBs = VDC_MAX(numCorrectMBs-2,0);
+#ifdef DEBUG_OUTPUT
+         fprintf(rvlc_stat, "P-VOP strategy 1: MBs %3d-%3d concealed\n\n", inOutParam->currMBNum+numCorrectMBs, inOutParam->currMBNum+numCorrectBackwardsMBs-1);
+#endif
+      }
+      /* strategy 2 */
+      else if ((backwards_errorBitPos > errorBitPos) && 
+             (currMBNumInVP + 1 <= numCorrectMBs)) {
+         numCorrectBackwardsMBs = VDC_MIN(numCorrectMBs + 1,numMBsInVP);
+         numCorrectMBs = VDC_MAX(currMBNumInVP-1,0);
+#ifdef DEBUG_OUTPUT
+         fprintf(rvlc_stat, "P-VOP strategy 2: MBs %3d-%3d concealed\n\n", inOutParam->currMBNum+numCorrectMBs, inOutParam->currMBNum+numCorrectBackwardsMBs-1);
+#endif
+      }
+      /* strategy 3 */
+      else if ((backwards_errorBitPos <= errorBitPos) && 
+             (currMBNumInVP + 1 > numCorrectMBs)) {
+         numCorrectBackwardsMBs = VDC_MIN(currMBNumInVP + 2,numMBsInVP);       
+         numCorrectMBs = VDC_MAX(numCorrectMBs-2,0);
+#ifdef DEBUG_OUTPUT
+         fprintf(rvlc_stat, "P-VOP strategy 3: MBs %3d-%3d concealed\n\n", inOutParam->currMBNum+numCorrectMBs, inOutParam->currMBNum+numCorrectBackwardsMBs-1);
+#endif
+      }
+      /* strategy 4 */
+      else if ((backwards_errorBitPos <= errorBitPos) && 
+             (currMBNumInVP + 1 <= numCorrectMBs)) {
+         numCorrectBackwardsMBs = VDC_MIN(numCorrectMBs + 1,numMBsInVP);       
+         numCorrectMBs = VDC_MAX(currMBNumInVP-1,0);
+#ifdef DEBUG_OUTPUT
+         fprintf(rvlc_stat, "P-VOP strategy 4: MBs %3d-%3d concealed\n\n", inOutParam->currMBNum+numCorrectMBs, inOutParam->currMBNum+numCorrectBackwardsMBs-1);
+#endif
+      }
+
+#ifdef DEBUG_OUTPUT
+      fclose (rvlc_stat);
+#endif
+
+
+      /* set the block pointers and counters to the end of the VP */
+      if ( currYMBInFrame != NULL )
+        {
+          currYMBInFrame = inOutParam->yMBInFrame + 16 * numCorrectMBs;
+          currUBlkInFrame = inOutParam->uBlockInFrame + 8 * numCorrectMBs;
+          currVBlkInFrame = inOutParam->vBlockInFrame + 8 * numCorrectMBs;
+        }
+      
+      xPosInMBs = inParam->xPosInMBs + numCorrectMBs;
+      yPosInMBs = inParam->yPosInMBs;
+      
+      if (xPosInMBs / inParam->pictParam->numMBsInMBLine) {
+         
+         int numFullLines = xPosInMBs / inParam->pictParam->numMBsInMBLine;
+         
+         if ( currYMBInFrame != NULL )
+            {
+             currYMBInFrame += 15 * yWidth * numFullLines;
+             currUBlkInFrame += 7 * uvWidth * numFullLines;
+             currVBlkInFrame += 7 * uvWidth * numFullLines;
+            }
+         xPosInMBs = xPosInMBs % inParam->pictParam->numMBsInMBLine;
+         yPosInMBs+=numFullLines;
+      }
+      
+      /* get the first MB of the list */
+      for (currMBNumInVP = 0, dlstHead(&MBList, (void **) &MBinstance); 
+         currMBNumInVP < numCorrectMBs; currMBNumInVP++) 
+         dlstNext(&MBList, (void **) &MBinstance);
+      
+      for (currMBNumInVP = numCorrectMBs; currMBNumInVP < numCorrectBackwardsMBs; currMBNumInVP++) {
+         /* The blocks whose DCT are missing, will be reconstructed (possibly again => clear effects of corrupted DCT) here,
+            using the MVs decoded from 1st partition */         
+         /* Motion vectors for P-macroblock */
+         int mvx[4];
+         int mvy[4];
+         int mbPos;       /* the position of the current macroblock, 
+                      -1 = the leftmost MB of the image, 
+                      0 = MB is not in the border of the image,
+                      1 = rightmost MB of the image */
+         
+         blcCopyPredictionMBParam_t blcParam;
+         
+         if (MBinstance == NULL) {
+            break;
+         }
+         
+         if (!MBinstance->fCodedMB) {           
+            /* Motion vectors to 0 */ 
+            mvx[0] = mvx[1] = mvx[2] = mvx[3] = 0;
+            mvy[0] = mvy[1] = mvy[2] = mvy[3] = 0;
+            mvcMarkMBNotCoded(
+               inOutParam->mvcData, 
+               xPosInMBs,
+               yPosInMBs,
+               inParam->pictParam->tr);
+            MBinstance->cbpy = 0;
+            fourMVs = 0;
+            
+         } else {
+            
+            if(MBinstance->mbClass == VDX_MB_INTER) {
+               int currMVNum;
+               
+               fourMVs = (u_char) (MBinstance->numMVs == 4);
+               
+               for (currMVNum = 0; currMVNum < MBinstance->numMVs; currMVNum++) {
+                  
+                  mvcCalcMPEGMV(
+                     inOutParam->mvcData,
+                     MBinstance->mvx[currMVNum], MBinstance->mvy[currMVNum],
+                     &mvx[currMVNum], &mvy[currMVNum],
+                     (u_char) currMVNum, fourMVs,
+                     (u_char) (currMBNumInVP < inParam->pictParam->numMBsInMBLine),
+                     (u_char) (currMBNumInVP == 0), 
+                     (u_char) (currMBNumInVP < (inParam->pictParam->numMBsInMBLine-1)),
+                     xPosInMBs,
+                     yPosInMBs,
+                     inParam->pictParam->tr,
+                     (MBinstance->mbClass == VDX_MB_INTRA) ? MVC_MB_INTRA : MVC_MB_INTER,
+                     &error);   
+                  
+                if (error == ERR_MVC_MVPTR)
+                     return DMB_BIT_ERR;
+                else if (error)
+                     return DMB_ERR;
+                        
+                  /* if MVs over VOP boundaries are not allowed */
+                  if ((xPosInMBs == 0 && mvx[currMVNum] < 0) ||
+                      (xPosInMBs == inParam->pictParam->numMBsInMBLine-1 && mvx[currMVNum] > 0) ||
+                      (yPosInMBs == 0 && mvy[currMVNum] < 0) ||
+                      (yPosInMBs == inParam->pictParam->numMBLinesInGOB-1 && mvy[currMVNum] > 0)) {
+                      mvx[currMVNum] = 0;
+                      mvy[currMVNum] = 0;
+                  }
+               }
+               
+               if (MBinstance->numMVs == 1) {
+                  mvx[1] = mvx[2] = mvx[3] = mvx[0];
+                  mvy[1] = mvy[2] = mvy[3] = mvy[0];
+               }
+                                 
+            } else { /* VDX_MB_INTRA */
+
+               /*int predBlocks[8] = {0,0,0,0,0,0,0,0};*/
+
+               mvcMarkMBIntra(inOutParam->mvcData, xPosInMBs, yPosInMBs, 
+                  inParam->pictParam->tr);
+                    
+
+                    /* Conceal the MB in intra mode (use top and left predictor only)
+                    if (xPosInMBs > 0) predBlocks[5] = 1;
+                    if (yPosInMBs > 0) predBlocks[4] = 1;
+                    epixConcealMB( inParam->currPY, yPosInMBs<<1, xPosInMBs<<1, predBlocks, yWidth, 2 );
+                    epixConcealMB( inParam->currPU, yPosInMBs, xPosInMBs, predBlocks, uvWidth, 1 );
+                    epixConcealMB( inParam->currPV, yPosInMBs, xPosInMBs, predBlocks, uvWidth, 1 ); */
+
+               mvcCalcMPEGMV(
+                  inOutParam->mvcData,
+                  0, 0,
+                  &mvx[0], &mvy[0],
+                  (u_char) 0, 0,
+                  (u_char) (currMBNumInVP < inParam->pictParam->numMBsInMBLine),
+                  (u_char) (currMBNumInVP == 0), 
+                  (u_char) (currMBNumInVP < (inParam->pictParam->numMBsInMBLine-1)),
+                  xPosInMBs,
+                  yPosInMBs,
+                  inParam->pictParam->tr,
+                  MVC_MB_INTRA,
+                  &error);   
+               
+                if (error == ERR_MVC_MVPTR)
+                     return DMB_BIT_ERR;
+                else if (error)
+                     return DMB_ERR;
+               
+               /* if MVs over VOP boundaries are not allowed */
+               if ((xPosInMBs == 0 && mvx[0] < 0) ||
+                  (xPosInMBs == inParam->pictParam->numMBsInMBLine-1 && mvx[0] > 0) ||
+                  (yPosInMBs == 0 && mvy[0] < 0) ||
+                  (yPosInMBs == inParam->pictParam->numMBLinesInGOB-1 && mvy[0] > 0)) {
+                  mvx[0] = 0;
+                  mvy[0] = 0;
+               }
+
+               mvx[1] = mvx[2] = mvx[3] = mvx[0];
+               mvy[1] = mvy[2] = mvy[3] = mvy[0];        
+            }
+         }
+         
+         /* mbPos, needed in blcCopyPredictionMB */
+         if (xPosInMBs == 0)
+            mbPos = -1;
+         else if (xPosInMBs == inParam->pictParam->numMBsInMBLine - 1)
+            mbPos = 1;
+         else
+            mbPos = 0;
+         
+/*         if (!MBinstance->fCodedMB || MBinstance->mbClass == VDX_MB_INTER) {*/
+            blcParam.refY = inParam->refY;
+            blcParam.refU = inParam->refU;
+            blcParam.refV = inParam->refV;
+            blcParam.currYMBInFrame = currYMBInFrame;
+            blcParam.currUBlkInFrame = currUBlkInFrame;
+            blcParam.currVBlkInFrame = currVBlkInFrame;
+            blcParam.uvBlkXCoord = xPosInMBs * 8;
+            blcParam.uvBlkYCoord = yPosInMBs * 8;
+            blcParam.uvWidth = uvWidth;
+            blcParam.uvHeight = inParam->pictParam->lumMemHeight / 2;
+            blcParam.mvcData = inOutParam->mvcData;
+            blcParam.mvx = mvx;
+            blcParam.mvy = mvy;
+            blcParam.mbPlace = mbPos;
+            blcParam.fAdvancedPrediction = inParam->pictParam->fAP;
+            blcParam.fMVsOverPictureBoundaries =
+               inParam->pictParam->fMVsOverPictureBoundaries;
+            blcParam.diffMB = inOutParam->diffMB;
+            blcParam.rcontrol = inParam->pictParam->rtype;
+            blcParam.fourMVs = fourMVs;
+            
+            /* Do motion compensation */
+            if (blcCopyPredictionMB(&blcParam) < 0) {
+               goto exitFunction;
+            }
+/*         }*/
+         
+         /* increment the block pointers and counters */
+         if ( currYMBInFrame != NULL )
+            {
+             currYMBInFrame += 16;
+             currUBlkInFrame += 8;
+             currVBlkInFrame += 8;
+            }
+         xPosInMBs++;
+         
+         if (xPosInMBs == inParam->pictParam->numMBsInMBLine) {
+          if ( currYMBInFrame != NULL )
+            {
+                currYMBInFrame += 15 * yWidth;
+                currUBlkInFrame += 7 * uvWidth;
+                currVBlkInFrame += 7 * uvWidth;
+            }
+            xPosInMBs = 0;
+            yPosInMBs++;
+            if (yPosInMBs >= inParam->pictParam->numMBLinesInGOB)
+               break;
+         }
+         
+         dlstNext(&MBList, (void **) &MBinstance);
+      }
+    } 
+
+#ifdef DEBUG_OUTPUT
+   if (errorBitPos)
+   deb_core("%08lu: MB#%3d VP Data Starts\n%08lu: Motion Marker\n%08lu: DCT data starts\n%08lu: MB#%3d Next VP/VOP Header\n%08lu: Fw Error Detected\n%08lu: Bw Error Detected\n", 
+      startVPBitPos, (inParam->yPosInMBs*inParam->pictParam->numMBsInMBLine + inParam->xPosInMBs),
+      motionMarkerBitPos, startBlockDataBitPos, nextVPBitPos, lastMBNum, 
+      errorBitPos,backwards_errorBitPos);
+#endif
+
+   /* if no error in Part1 and Part2, set the currentMB to the first MB of the next VP */
+   inOutParam->currMBNum += numMBsInVP;
+
+exitFunction:
+
+   deb1p("dmbsGetAndDecodePMBsDataPartitioned:Finished.\n",inOutParam->currMBNum);
+   /* Free the MB list */
+   if (MBList.numItems != 0)
+   {     
+      dlstHead(&MBList, (void **) &MBinstance);
+      dlstRemove(&MBList, (void **) &MBinstance);
+      while (MBinstance != NULL) {
+         free(MBinstance);
+         dlstRemove(&MBList, (void **) &MBinstance);
+      }
+      dlstClose(&MBList);
+   }
+
+   return DMBS_OK;
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/decpich.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,699 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Picture header decoding functions.
+*
+*/
+
+
+
+#include "h263dConfig.h"
+
+#include "decpich.h"
+#include "debug.h"
+#include "vdeims.h"
+#include "vdeimb.h"
+#include "viddemux.h"
+#include "sync.h"
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"dphGetPictureHeader.txt"}} */
+/*
+ * dphGetPictureHeader
+ *    
+ *
+ * Parameters:
+ *    inParam                    input parameters
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *    outParam                   output parameters
+ *    bitErrorIndication         bit error indication, see biterr.h for
+ *                               the possible values
+ *
+ * Function:
+ *    This function gets and decodes a picture header which should start
+ *    with a PSC at the current position of the bit buffer. At first,
+ *    the function reads the picture header fields from the bitstream.
+ *    Then, it checks whether the values of the fields are supported.
+ *    An unsupported value is interpreted as a bit error. Finally,
+ *    the function updates VDC instance data and output parameters
+ *    (according to the new picture header).
+ *
+ * Returns:
+ *    DPH_OK
+ *    DPH_OK_BUT_BIT_ERROR
+ *    DPH_ERR
+ *    DPH_ERR_NO_INTRA
+ *    DPH_ERR_FORMAT_CHANGE
+ *
+ */
+
+int dphGetPictureHeader(
+   const dphInParam_t *inParam,
+   dphInOutParam_t *inOutParam,
+   dphOutParam_t *outParam,
+   int *bitErrorIndication)
+/* {{-output"dphGetPictureHeader.txt"}} */
+{
+   bibBuffer_t *inBuffer = inOutParam->inBuffer;
+   u_char fPrevIntraGot;         /* Non-zero if an INTRA frame has been decoded
+                           before the current frame */
+   vdxGetPictureHeaderInputParam_t picHdrIn;
+   vdxPictureHeader_t picHeader;
+   vdcInstance_t *instance = inOutParam->vdcInstance;
+   vdcPictureParam_t *pictureParam = &instance->pictureParam;
+   vdcPictureParam_t prevPictParam;
+   int trd;                      /* Difference between present and previous tr */
+   int fInterFrame;              /* non-zero = INTER frame, 0 = INTRA frame */
+   int fPBFrame;                 /* Flag indicating a PB-frame */
+   int fRPS;                     /* 1 = RPS used, 0 = RPS not used */
+   int ret = 0;                  /* temporary variable to carry return values */
+   int retVal = DPH_OK;          /* return value if everything as expected,
+                                    either DPH_OK or DPH_OK_BUT_SKIP */
+   int16 error = 0;              /* snc and mvc module error code */
+
+
+   /* 
+    * Get picture header 
+    */
+
+   picHdrIn.numStuffBits = inParam->numStuffBits;
+   picHdrIn.fCustomPCF = 0;
+   picHdrIn.fScalabilityMode = 0;
+   picHdrIn.fRPS = instance->fRPS;
+   picHdrIn.flushBits = bibFlushBits;
+   picHdrIn.getBits = bibGetBits;
+   picHdrIn.showBits = bibShowBits;
+   
+    /* Used to recover the 1st picture segment */
+    u_int32 picHeaderStartPos = bibNumberOfFlushedBits(inBuffer);
+
+    if ( inParam->numStuffBits ) {
+     bibFlushBits(inParam->numStuffBits, inBuffer, &picHdrIn.numStuffBits, bitErrorIndication, &error);
+     picHdrIn.numStuffBits = 0;
+    }
+
+    // Read header bits normally from the bitstream
+    ret = vdxGetPictureHeader(inBuffer, &picHdrIn, &picHeader, 
+            bitErrorIndication);      
+
+    if ( ret < 0 )
+        return DPH_ERR;
+    else if ( ret == VDX_OK_BUT_BIT_ERROR ) 
+    {
+        // Bit error exists.
+        return DPH_OK_BUT_BIT_ERROR;
+    } // end of if ( ret == VDX_OK_BUT_BIT_ERROR ) 
+
+
+   /* 
+    * Check picture header validity 
+    */
+
+   /* Local parameters needed in validity check (and possibly afterwards) */
+   fPrevIntraGot = instance->fIntraGot;
+   fInterFrame = (picHeader.pictureType == VDX_PIC_TYPE_P ||
+      picHeader.pictureType == VDX_PIC_TYPE_PB ||
+      picHeader.pictureType == VDX_PIC_TYPE_IPB);
+   fPBFrame = ((picHeader.pictureType == VDX_PIC_TYPE_PB)||
+      (picHeader.pictureType == VDX_PIC_TYPE_IPB));
+
+   /* TR with the same value as in the previous picture can be interpreted
+      two ways:
+         - if Reference Picture Selection is enabled, it means
+           a synchronization frame
+         - if Reference Picture Selection is not used, it means the maximum
+           difference between two frames.
+           However, at least VDOPhone uses TR equal to zero always, which
+           in practice should be interpreted that TR field is not used in
+           display timing. */
+
+   /* At first, check if RPS is used */
+   if (picHeader.fPLUSPTYPE && picHeader.ufep)
+      fRPS = picHeader.fRPS;
+   else
+      fRPS = instance->fRPS;
+
+   /* Calculate temporal reference difference (from the previous frame) */
+   trd = picHeader.tr - instance->pictureParam.tr;
+   if (trd < 0)
+      trd += 256; /* Note: Add ETR support */
+
+   /* If TR is the same as in the previous frame and Reference Picture Selection
+      is not used and not the very first frame (in which case previous tr == 0), 
+      the temporal reference difference is the maximum one. */
+   if (trd == 0 && !fRPS && instance->frameNum > 0)
+      trd = 256; /* Note: Add ETR support */
+
+   /* If unsupported picture type */
+   if (picHeader.pictureType != VDX_PIC_TYPE_I
+      && picHeader.pictureType != VDX_PIC_TYPE_P
+      && picHeader.pictureType != VDX_PIC_TYPE_PB
+      && picHeader.pictureType != VDX_PIC_TYPE_IPB
+      ) {
+      return DPH_OK_BUT_BIT_ERROR;
+   }
+
+   if (picHeader.pictureType == VDX_PIC_TYPE_PB ||
+      picHeader.pictureType == VDX_PIC_TYPE_IPB) {
+      return DPH_OK_BUT_BIT_ERROR;
+   }
+   
+   if (picHeader.cpm) {
+      /* No CPM support */
+      return DPH_OK_BUT_BIT_ERROR;
+   }
+
+   if (picHeader.fPLUSPTYPE) {
+      /* If unsupported modes (and UFEP is whatever) */
+      if (picHeader.fRPR ||
+         picHeader.fRRU) {
+         return DPH_OK_BUT_BIT_ERROR;
+      }
+
+      if (picHeader.ufep == 1) {
+         /* If unsupported mode */
+         if (picHeader.fISD ||
+            picHeader.fSAC ||
+            picHeader.fAIV ||
+            picHeader.fCustomPCF) {
+            return DPH_OK_BUT_BIT_ERROR;
+         }
+
+         if (picHeader.fUMV) {
+            return DPH_OK_BUT_BIT_ERROR;
+         }
+
+         if (picHeader.fAP) {
+            return DPH_OK_BUT_BIT_ERROR;
+         }
+         
+         if (picHeader.fAIC) {
+            return DPH_OK_BUT_BIT_ERROR;
+         }
+         
+         
+         
+         if (picHeader.fDF) {
+            return DPH_OK_BUT_BIT_ERROR;
+         }
+         
+         
+         
+         if (picHeader.fSS) {
+            return DPH_OK_BUT_BIT_ERROR;
+         }
+         
+         
+         
+         if (picHeader.fMQ) {
+            return DPH_OK_BUT_BIT_ERROR;
+         }
+         
+      }
+
+      /* Note: Add check for "The Indenpenent Segment Decoding mode shall not
+         be used with the Reference Picture Resampling mode"
+         from section 5.1.4.6 of the H.263 recommendation whenever both of
+         the modes in question are supported. 
+         Note that this check cannot reside in vdxGetPictureHeader since
+         ISD and RPR can be turned on in different pictures. */
+   }
+
+   /* Else no PLUSPTYPE */
+   else {
+      /* If unsupported modes */
+      if (picHeader.fSAC) {
+         return DPH_OK_BUT_BIT_ERROR;
+      }
+
+         if (picHeader.fUMV) {
+            return DPH_OK_BUT_BIT_ERROR;
+         }
+
+         if (picHeader.fAP) {
+            return DPH_OK_BUT_BIT_ERROR;
+         }
+   }
+
+   /* If no INTRA frame has ever been decoded and the current frame is INTER */
+   if (!fPrevIntraGot && fInterFrame)
+      return DPH_ERR_NO_INTRA;
+
+   if (fPrevIntraGot) {
+
+      /* If width and height are indicated in the header and
+         they are different from the previous */
+      if ((picHeader.fPLUSPTYPE == 0 || picHeader.ufep == 1) &&
+         (instance->pictureParam.lumWidth != picHeader.lumWidth ||
+         instance->pictureParam.lumHeight != picHeader.lumHeight)) {
+
+         if (fInterFrame) {
+            /* INTER frame, check that the source format has not changed */
+            deb("vdcDecodeFrame: ERROR - Source format has changed "
+               "(INTER frame)\n");
+            return DPH_OK_BUT_BIT_ERROR;
+         }
+         else if ( *bitErrorIndication ) {
+            deb("vdcDecodeFrame: ERROR - Frame size changing during "
+               "the sequence, cause: bitError\n");
+            return DPH_OK_BUT_BIT_ERROR;
+         }
+         else {
+            /* At the moment do NOT allow source format changes during
+               the sequence. */
+            deb("vdcDecodeFrame: ERROR - Frame size changing during "
+               "the sequence\n");
+            return DPH_ERR_FORMAT_CHANGE;
+         }
+      }
+   }
+
+   /* If the temporal reference of B points after P */
+   if (fPBFrame && trd <= picHeader.trb) {
+      deb("vdcDecodeFrame: ERROR - TRB illegal.\n");
+      return DPH_OK_BUT_BIT_ERROR;
+   }
+
+
+   /* Now, the picture header is considered to be error-free,
+      and its contents are used to manipulate instance data */
+
+   /*
+    * Update instance data and output parameters
+    */
+
+   /* Update frame numbers */
+   {
+      int32 oldFrameNum = instance->frameNum;
+
+      instance->frameNum += trd;
+      if (instance->frameNum < 0)
+         /* Wrap from 0x7fffffff to 0 instead of the largest negative number */
+         instance->frameNum += 0x80000000;
+
+      if (fPBFrame) {
+         instance->frameNumForBFrame = oldFrameNum + picHeader.trb;
+         if (instance->frameNumForBFrame < 0)
+            /* Wrap from 0x7fffffff to 0 instead of the largest negative number */
+            instance->frameNumForBFrame += 0x80000000;
+      }
+      else
+         instance->frameNumForBFrame = -1;
+   }
+
+   /* Note: If no INTRA has been got the function has already returned */
+   instance->fIntraGot = 1;
+
+   outParam->pquant = picHeader.pquant;
+
+   instance->fRPS = fRPS;
+
+   if (instance->fRPS && picHeader.trpi)
+      outParam->trp = picHeader.trp;
+   else
+      outParam->trp = -1;
+
+   if (instance->fRPS && picHeader.fPLUSPTYPE && picHeader.ufep)
+      instance->rpsMode = picHeader.rpsMode;
+   
+   /* Store previous picture parameters temporarily */
+   memcpy(&prevPictParam, pictureParam, sizeof(vdcPictureParam_t));
+
+   /* Update picture parameters */
+   pictureParam->tr = picHeader.tr;
+   pictureParam->trd = trd;
+   pictureParam->fSplitScreenIndicator = picHeader.fSplitScreen;
+   pictureParam->fDocumentCameraIndicator = picHeader.fDocumentCamera;
+   pictureParam->fFullPictureFreezeRelease = picHeader.fFreezePictureRelease;
+   pictureParam->pictureType = picHeader.pictureType;
+   pictureParam->fPLUSPTYPE = picHeader.fPLUSPTYPE;
+   pictureParam->cpm = picHeader.cpm;
+   pictureParam->psbi = picHeader.psbi;
+
+   if (fPBFrame) {
+      pictureParam->trb = picHeader.trb;
+      pictureParam->dbquant = picHeader.dbquant;
+   }
+
+   if (!picHeader.fPLUSPTYPE || picHeader.ufep) {
+      pictureParam->lumWidth = picHeader.lumWidth;
+      pictureParam->lumHeight = picHeader.lumHeight;
+      pictureParam->fUMV = picHeader.fUMV;
+      pictureParam->fSAC = picHeader.fSAC;
+      pictureParam->fAP = picHeader.fAP;
+
+      if (pictureParam->lumWidth % 16)
+         pictureParam->lumMemWidth = 
+            (pictureParam->lumWidth / 16 + 1) * 16;
+      else
+         pictureParam->lumMemWidth = pictureParam->lumWidth;
+
+      if (pictureParam->lumHeight % 16)
+         pictureParam->lumMemHeight = (pictureParam->lumHeight / 16 + 1) * 16;
+      else
+         pictureParam->lumMemHeight = pictureParam->lumHeight;
+
+      if (picHeader.lumHeight <= 400)
+         pictureParam->numMBLinesInGOB = 1;
+      else if (picHeader.lumHeight <= 800)
+         pictureParam->numMBLinesInGOB = 2;
+      else
+         pictureParam->numMBLinesInGOB = 4;
+
+      pictureParam->numMBsInMBLine = pictureParam->lumMemWidth / 16;
+
+      {
+         int 
+            numMBLines = pictureParam->lumMemHeight / 16,
+            numMBLinesInLastGOB = 
+               numMBLines % pictureParam->numMBLinesInGOB;
+
+         if (numMBLinesInLastGOB) {
+            pictureParam->numGOBs = 
+               numMBLines / pictureParam->numMBLinesInGOB + 1;
+            pictureParam->fLastGOBSizeDifferent = 1;
+            pictureParam->numMBsInLastGOB = 
+               numMBLinesInLastGOB * pictureParam->numMBsInMBLine;
+         }
+         else {
+            pictureParam->numGOBs = 
+               numMBLines / pictureParam->numMBLinesInGOB ;
+            pictureParam->fLastGOBSizeDifferent = 0;
+            pictureParam->numMBsInLastGOB = 
+               pictureParam->numMBLinesInGOB * pictureParam->numMBsInMBLine;
+         }
+      }
+
+      pictureParam->numMBsInGOB = 
+         pictureParam->numMBsInMBLine * pictureParam->numMBLinesInGOB;
+   }
+
+   else {
+      pictureParam->lumWidth = prevPictParam.lumWidth;
+      pictureParam->lumHeight = prevPictParam.lumHeight;
+      pictureParam->lumMemWidth = prevPictParam.lumMemWidth;
+      pictureParam->lumMemHeight = prevPictParam.lumMemHeight;
+      pictureParam->fUMV = prevPictParam.fUMV;
+      pictureParam->fSAC = prevPictParam.fSAC;
+      pictureParam->fAP = prevPictParam.fAP;
+   }
+
+   /* Note: Mode inference rules defined in section 5.1.4.5 of
+      the H.263 recommendation are (in most cases) not reflected to members
+      of pictureParam due to the fact that they are implicitly turned
+      off or irrelevant in the current implementation. (This is particularly
+      true when assigning inferred state "off".) */
+
+   if (picHeader.fPLUSPTYPE) {
+      pictureParam->fRPR = picHeader.fRPR;
+      pictureParam->fRRU = picHeader.fRRU;
+      pictureParam->rtype = picHeader.rtype;
+
+      /* Note: irrelevant if Annex O is not in use */
+      pictureParam->elnum = picHeader.elnum;
+
+      if (picHeader.ufep) {
+         pictureParam->fCustomSourceFormat = picHeader.fCustomSourceFormat;
+         pictureParam->fAIC = picHeader.fAIC;
+         pictureParam->fDF = picHeader.fDF;
+         pictureParam->fSS = picHeader.fSS;
+         pictureParam->fRPS = picHeader.fRPS;
+         pictureParam->fISD = picHeader.fISD;
+         pictureParam->fAIV = picHeader.fAIV;
+         pictureParam->fMQ = picHeader.fMQ;
+      
+         pictureParam->fUMVLimited = picHeader.fUMVLimited;
+
+      }
+
+      /* Else no UFEP */
+      else {
+         pictureParam->fCustomSourceFormat = 
+            prevPictParam.fCustomSourceFormat;
+         pictureParam->fAIC = prevPictParam.fAIC;
+         pictureParam->fDF = prevPictParam.fDF;
+         pictureParam->fSS = prevPictParam.fSS;
+         pictureParam->fRPS = prevPictParam.fRPS;
+         pictureParam->fISD = prevPictParam.fISD;
+         pictureParam->fAIV = prevPictParam.fAIV;
+         pictureParam->fMQ = prevPictParam.fMQ;
+      
+         pictureParam->fUMVLimited = prevPictParam.fUMVLimited;
+
+      }
+   }
+
+   /* Else no PLUSPTYPE */
+   else {
+      /* Section 5.1.4.5 of the H.263 recommendation states:
+         "If a picture is sent which does not contain (PLUSPTYPE),
+         a state "off" shall be assigned to all modes not explicitly set to
+         "on" in the PTYPE filed, and all modes shall continue to have 
+         an inferred state of "off" until a new picture containing
+         the optional part of PLUSPTYPE is sent." */
+
+      /* Fields occuring in mandatory part of PLUSPTYPE are copied from
+         the previous picture. */
+      pictureParam->fRPR = prevPictParam.fRPR;
+      pictureParam->fRRU = prevPictParam.fRRU;
+
+      /* RTYPE is set to zero according to section 6.1.2 of 
+         the H.263 recommendation */
+      pictureParam->rtype = 0;
+
+      /* Modes occuring in the optional part of PLUSPTYPE are turned off
+         (unless occuring in PTYPE field too, like Advanced Prediction). */
+      pictureParam->fCustomSourceFormat = 0;
+      pictureParam->fCustomPCF = 0;
+      pictureParam->fAIC = 0;
+      pictureParam->fDF = 0;
+      pictureParam->fSS = 0;
+      pictureParam->fRPS = 0;
+      pictureParam->fISD = 0;
+      pictureParam->fAIV = 0;
+      pictureParam->fMQ = 0;
+   
+      /* Other related settings turned off just to be sure that they are
+         not misused. */
+      pictureParam->fUMVLimited = 0;
+   }
+
+   pictureParam->fMVsOverPictureBoundaries =
+      (pictureParam->fUMV || pictureParam->fAP || 
+      pictureParam->fDF);
+
+   /* Initialize motion vector count module */
+    mvcStart(   &instance->mvcData, 
+               instance->pictureParam.lumMemWidth / 16 - 1, 
+               pictureParam->lumMemWidth, 
+               pictureParam->lumMemHeight, &error);
+   /* Note: This assumes that the memory for frame->mvcData is filled with 0
+      in the first time the function is called.
+      (This is ensured by setting the instance data to zero when it is
+      initialized in vdcOpen.) */
+   instance->mvcData.fSS = pictureParam->fSS;
+
+   if (error) {
+      deb("mvcStart failed.\n");
+      return DPH_ERR;
+   }
+
+   /* Get image buffers */
+   {
+      vdeIms_t *store = instance->imageStore;
+      vdeImsItem_t *imsItem;
+      vdeImb_t *imb;
+      int width, height;
+      
+      vdeImsSetYUVNeed(store, inParam->fNeedDecodedFrame);
+
+      if (vdeImsGetFree(store, instance->pictureParam.lumMemWidth, 
+         instance->pictureParam.lumMemHeight, 
+         &instance->currFrame) < 0)
+         goto errGetFreeP;
+      imsItem = instance->currFrame;
+
+
+      if (vdeImsStoreItemToImageBuffer(imsItem, &imb) < 0)
+         goto errAfterGetFreeP;
+
+      if (vdeImbYUV(imb, &outParam->currYFrame, 
+         &outParam->currUFrame, &outParam->currVFrame,
+         &width, &height) < 0)
+         goto errAfterGetFreeP;
+
+   }
+
+   /* Initialize the parameters for the advanced intra coding structure. */
+   if (pictureParam->fAIC)
+    {
+    // not supported
+    }
+
+   /* Initialize the parameters for Slice Structured Mode. */
+   if (pictureParam->fSS)
+    {
+    // not supported
+    }
+    
+
+   /* If picture header successfully decoded or reliably recovered */
+   if ( inParam->fReadBits && ret == VDX_OK ) {
+
+      /* In the beginning, tr is set to -1 */
+      if ( instance->fPrevPicHeaderReliable
+         && instance->prevPicHeader->tr >= 0
+         && ( picHeader.pictureType != instance->prevPicHeader->pictureType 
+            || picHeader.fUMV != instance->prevPicHeader->fUMV 
+            || picHeader.fAP != instance->prevPicHeader->fAP
+            || picHeader.fPLUSPTYPE != instance->prevPicHeader->fPLUSPTYPE
+            || ( ( picHeader.fPLUSPTYPE == 0 || picHeader.ufep == 1 ) 
+               && ( picHeader.lumWidth != instance->prevPicHeader->lumWidth 
+                    || picHeader.lumHeight != instance->prevPicHeader->lumHeight )
+                  )
+            || ( picHeader.fPLUSPTYPE == 1 && picHeader.ufep == 1
+               && ( picHeader.fAIC != instance->prevPicHeader->fAIC
+                  || picHeader.fDF != instance->prevPicHeader->fDF
+                  || picHeader.fMQ != instance->prevPicHeader->fMQ
+                  || picHeader.fUMVLimited != instance->prevPicHeader->fUMVLimited
+                     )
+                  )
+               )
+            || ( picHeader.fPLUSPTYPE == 1 
+               && picHeader.rtype != instance->prevPicHeader->rtype )
+            ) {
+
+         /* Some parameter in PTYPE/PLUSPTYPE has changed, GFID should change also */
+         /* Note that some parameters, such as SAC, are not checked since they have not been implemented */
+
+         instance->fGFIDShouldChange = 1;
+      }
+      else if ( !instance->fPrevPicHeaderReliable ) {
+         /* Previous picture header was not reliable, don't check GFID */
+         instance->fGFIDShouldChange = 1;
+         instance->gfid = -1;
+      }
+      else if ( instance->gfid == -1 ) {
+         /* The very first frame, or a frame after a lost frame, GFID can be whatever */
+         /* Note: instance->gfid == -1 is used to indicate that previous GFID
+            is not available as in the first picture in first GOB header. 
+            If there is a picture without GOB headers and having a different
+            picture header than the surrounding pictures, instance->gfid is
+            reset to -1 in vdcDecodeFrame()! (Otherwise, a wrong GFID may be
+            used in GFID correctness check.) */
+         instance->fGFIDShouldChange = 1;
+      }
+      else {
+         /* No changes in PTYPE => the same GFID.
+          * It is better not to change the value of this flag here, since
+          * if there are no GOB or slice headers where GFID can change, the next
+          * read GFID in some other frame than the one with the different PTYPE 
+          * will be considered illegal 
+          */
+         /* instance->fGFIDShouldChange = 0; */
+      }
+
+      /* Header was reliable and can be used when checking the next header */
+      instance->fPrevPicHeaderReliable = 1;
+
+      /* Copy the read header to be used if the next header is corrupted or lost */
+      memcpy( instance->prevPicHeader, &picHeader, sizeof( vdxPictureHeader_t ) );
+   }
+
+   /* Else picture header unreliable */
+   else {
+      /* Since we cannot trust that picture header is reliable, 
+         we cannot detect errors based on GFID.
+         Thus, let's disable GFID checking in GOB level. */
+      instance->fPrevPicHeaderReliable = 0;
+      instance->fGFIDShouldChange = 1;
+      instance->gfid = -1;
+   }
+
+   return retVal;
+
+   /* Error condition handling,
+      release everything in reverse order */
+//   errAfterGetFreeB:
+
+//   vdeImsPutFree(instance->imageStore, instance->bFrame);
+//   errGetFreeB:
+
+   errAfterGetFreeP:
+
+   vdeImsPutFree(instance->imageStore, instance->currFrame);
+   errGetFreeP:
+
+   instance->currFrame = NULL;
+   instance->bFrame = NULL;
+
+   return DPH_ERR;
+}
+
+
+/* {{-output"dphGetSEI.txt"}} */
+/*
+ * dphGetSEI
+ *    
+ *
+ * Parameters:
+ *    vdcInstance                Video Decoder Core instance
+ *    inBuffer                   Bit Buffer instance
+ *    bitErrorIndication         bit error indication, see biterr.h for
+ *                               the possible values
+ *
+ * Function:
+ *    This function gets and decodes Supplemental Enhancement
+ *    Information.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured
+ *
+ */
+
+int dphGetSEI(
+   vdcInstance_t *vdcInstance,   /* Video Decoder Core instance */
+   bibBuffer_t *inBuffer,        /* Bit Buffer instance */
+   int *bitErrorIndication)
+{
+/* {{-output"dphGetSEI.txt"}} */
+   int
+      vdxStatus;
+
+   vdxSEI_t
+      sei;
+
+   vdxStatus = vdxGetAndParseSEI(
+      inBuffer,
+      vdcInstance->pictureParam.fPLUSPTYPE,
+      vdcInstance->numAnnexNScalabilityLayers,
+      &sei,
+      bitErrorIndication);
+
+   if (vdxStatus < 0)
+      return DPH_ERR;
+   else if (vdxStatus == VDX_OK_BUT_BIT_ERROR)
+      return DPH_OK_BUT_BIT_ERROR;
+
+      
+   return DPH_OK;
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/decpich_mpeg.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,417 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Picture header decoding functions (MPEG-4).
+*
+*/
+
+
+
+#include "h263dConfig.h"
+#include "mpegcons.h"
+#include "sync.h"
+#include "decpich.h"
+#include "debug.h"
+#include "vdeims.h"
+#include "vdeimb.h"
+#include "viddemux.h"
+
+
+/*
+ * Global functions
+ */
+
+/*
+ * dphGetMPEGVolHeader
+ *    
+ *
+ * Parameters:
+ *    hInstance                  instance data
+ *
+ * Function:
+ *   This function decodes the Video Object Header and the VOL Header
+ *   and initializes the fields of vdcInstance which are set in these
+ *   headers. Check and reports (generating error messages) if the header
+ *   shows a configuration on feature which is not supported by the
+ *   Simple Video Object Profile of MPEG4
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if a fatal error, from which the decoder
+ *                               cannot be restored, has occured
+ *
+ */
+
+int dphGetMPEGVolHeader(dphInOutParam_t *inOutParam, CMPEG4Transcoder *hTranscoder)
+{
+   vdcInstance_t *instance = inOutParam->vdcInstance;
+   bibBuffer_t *inBuffer = inOutParam->inBuffer;
+   int bitErrorIndication = 0;
+   vdxVolHeader_t volHeader;   
+
+   /* read the Stream headers from the bitstream */
+   if ((vdxGetVolHeader(inBuffer, &volHeader, &bitErrorIndication, 0, 0, 0, hTranscoder) != VDX_OK) ||
+       (bitErrorIndication != 0)) {
+      return DPH_ERR;
+   }   
+
+   /* copy the useful VOL parameters to pictureParam or the core data structure */
+   instance->pictureParam.vo_id = volHeader.vo_id;
+   instance->pictureParam.vol_id = volHeader.vol_id;
+   instance->pictureParam.time_increment_resolution = volHeader.time_increment_resolution;
+
+     /* MVE */
+   instance->pictureParam.fixed_vop_rate = volHeader.fixed_vop_rate;
+
+   instance->pictureParam.lumWidth = volHeader.lumWidth;
+   instance->pictureParam.lumHeight = volHeader.lumHeight;
+
+   if (volHeader.lumWidth%16)
+       instance->pictureParam.lumMemWidth = (((volHeader.lumWidth >>4/*/16*/) + 1) <<4/** 16*/);
+   else
+       instance->pictureParam.lumMemWidth = volHeader.lumWidth;
+   
+   if (volHeader.lumHeight%16)
+       instance->pictureParam.lumMemHeight = (((volHeader.lumHeight >>4/*/16*/) + 1) <<4/** 16*/);
+   else
+       instance->pictureParam.lumMemHeight = volHeader.lumHeight;
+   
+   instance->pictureParam.error_res_disable = volHeader.error_res_disable;
+   instance->pictureParam.data_partitioned = volHeader.data_partitioned;
+   instance->pictureParam.reversible_vlc = volHeader.reversible_vlc;
+
+   /* copy the got user data to the core data structure */
+   if (volHeader.user_data != NULL) {
+       instance->user_data = (char *) malloc(MAX_USER_DATA_LENGTH);
+   
+       volHeader.user_data_length = 
+           ((instance->user_data_length + volHeader.user_data_length) >= MAX_USER_DATA_LENGTH) ?
+           (MAX_USER_DATA_LENGTH - instance->user_data_length) : volHeader.user_data_length;
+       
+       memcpy(
+           instance->user_data + instance->user_data_length, 
+           volHeader.user_data, 
+           volHeader.user_data_length);
+
+       instance->user_data_length += volHeader.user_data_length;
+
+       free(volHeader.user_data);
+   }
+
+   return DPH_OK;
+}
+
+/* {{-output"dphGetMPEGVopHeader.txt"}} */
+/*
+ * dphGetMPEGVopHeader
+ *    
+ *
+ * Parameters:
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *    outParam                   output parameters
+ *    bitErrorIndication         bit error indication, see biterr.h for
+ *                               the possible values
+ *
+ * Function:
+ *    This function gets and decodes an MPEG Vop header which should start
+ *    with a VOP start_code at the current position of the bit buffer.
+ *    At first, the function reads the picture header fields from the bitstream.
+ *    Then, it checks whether the values of the fields are supported.
+ *    An unsupported value is interpreted as a bit error. Finally,
+ *    the function updates VDC instance data and output parameters
+ *    (according to the new picture header).
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured
+ *
+ */
+
+int dphGetMPEGVopHeader(
+   const dphInParam_t *inParam,
+   dphInOutParam_t *inOutParam,
+   dphOutParam_t *outParam,
+   int *bitErrorIndication)
+/* {{-output"dphGetMPEGVopHeader.txt"}} */
+{
+   bibBuffer_t *inBuffer = inOutParam->inBuffer;
+   u_char fPrevIntraGot;         /* Non-zero if an INTRA frame has been decoded
+                                    before the current frame */
+   vdxGetVopHeaderInputParam_t picHdrIn;
+   vdxVopHeader_t picHeader;
+   vdcInstance_t *instance = inOutParam->vdcInstance;
+   vdcPictureParam_t *pictureParam = &instance->pictureParam;
+   int fInterFrame;              /* non-zero = INTER frame, 0 = INTRA frame */
+   int ret = DPH_OK, curr_mod_time_base=0;
+   int16 error = 0;
+   int32 currFrameNum=0;
+
+   /* In normal case read the picture header from the bitstream. 
+      This function can be also called just to initialize the default 
+      picture header parameters and allocate image buffers, but not read
+      the picture header from bitstream. This is used when the picture
+      header has been lost (e.g. packet loss) but decoding is continued */
+      
+   if (inParam->fReadBits) {
+
+   /* 
+    * Get picture header 
+    */
+
+   picHdrIn.time_increment_resolution = pictureParam->time_increment_resolution;
+
+     /* MVE */
+   int dummy1, dummy2, dummy3, dummy4; /* not used for processing */
+   ret = vdxGetVopHeader(inBuffer, &picHdrIn, &picHeader, 
+         &dummy1, &dummy2, &dummy3, &dummy4,
+         bitErrorIndication);
+
+   if ( ret < 0 )
+      return DPH_ERR;
+   else if ( ret > 0 ) {
+     ret = DPH_OK_BUT_BIT_ERROR;
+     goto updateInstanceData;
+   } else {
+     ret = DPH_OK;
+   }
+
+   /* 
+    * Check picture header validity 
+    */
+
+   /* Local parameters needed in validity check (and possibly afterwards) */
+   fPrevIntraGot = instance->fIntraGot;
+   fInterFrame = (picHeader.coding_type == VDX_VOP_TYPE_P);
+
+
+   if (picHeader.time_base_incr < 0 || picHeader.time_base_incr > 60) {
+      if ( *bitErrorIndication ) {
+         ret = DPH_OK_BUT_BIT_ERROR;
+         goto updateInstanceData;
+      }
+   }
+
+   curr_mod_time_base = pictureParam->mod_time_base + picHeader.time_base_incr;
+
+   currFrameNum = (int) ((curr_mod_time_base + 
+      ((double) picHeader.time_inc) / ((double) pictureParam->time_increment_resolution)) *
+      30.0 + 0.001);
+
+   if ((currFrameNum <= instance->frameNum) && 
+      (instance->frameNum > 0)) {
+      if (*bitErrorIndication) {
+         ret = DPH_OK_BUT_BIT_ERROR;
+         goto updateInstanceData;
+      } else {
+         /* this can happen if a previous picture header is lost and it had
+            mod_time_base increase information. */
+         int i;
+         int32 tryFrameNum=0;
+         for (i=1;i<5;i++) {
+            tryFrameNum = (int) (((curr_mod_time_base+i) + 
+               ((double) picHeader.time_inc) / ((double) pictureParam->time_increment_resolution)) *
+               30.0 + 0.001);
+            if (tryFrameNum > instance->frameNum) {
+               currFrameNum = tryFrameNum;
+               curr_mod_time_base += i;
+               ret = DPH_OK;
+               break;
+            }
+         }
+         if (i==5) {
+            ret = DPH_OK_BUT_BIT_ERROR;
+            goto updateInstanceData;
+         }
+      }
+   }
+
+   /* If no INTRA frame has ever been decoded and the current frame is INTER */
+   if (!fPrevIntraGot && fInterFrame) {
+      deb("ERROR. No I-vop before a P-vop\n");
+      return DPH_ERR_NO_INTRA;
+
+   }
+
+   /* fcode can have only the valid values 1..7 */
+   if(picHeader.fcode_forward == 0) {
+      ret = DPH_OK_BUT_BIT_ERROR;
+      goto updateInstanceData;
+   }
+
+   /* quant can not be zero */
+   if(picHeader.quant == 0) {
+      ret = DPH_OK_BUT_BIT_ERROR;
+      goto updateInstanceData;
+   }
+
+   } /* end fReadBits */
+
+   /* Now, the picture header is considered to be error-free,
+      and its contents are used to manipulate instance data */
+
+updateInstanceData:
+
+   /*
+    * Update instance data and output parameters
+    */
+
+   /* some parameters need to be set if error has been detected, for initializing */
+   if (!inParam->fReadBits || (ret == DPH_OK_BUT_BIT_ERROR)) {
+      picHeader.rounding_type = 0;
+      picHeader.fcode_forward = 1;
+      picHeader.coding_type = 1;
+   } else {    
+      /* Update frame numbers */
+      pictureParam->time_base_incr = picHeader.time_base_incr;
+      pictureParam->mod_time_base = curr_mod_time_base;
+      pictureParam->time_inc = picHeader.time_inc;
+      instance->frameNum = currFrameNum;
+   }
+
+   /* Update picture parameters */
+   pictureParam->trd = (instance->frameNum % 256) - pictureParam->tr;
+   pictureParam->tr = instance->frameNum % 256;
+
+   pictureParam->pictureType = picHeader.coding_type;
+
+   if (!picHeader.vop_coded) {
+     return DPH_OK_BUT_NOT_CODED;
+   }
+
+   /* NO reference picture selection */
+   outParam->trp = -1;
+
+   /* No PB Frames allowed */
+   instance->frameNumForBFrame = -1;
+
+   /* Note: If no INTRA has been got the function has already returned */
+   instance->fIntraGot = 1;
+
+   pictureParam->intra_dc_vlc_thr = picHeader.intra_dc_vlc_thr;
+   pictureParam->fcode_forward = picHeader.fcode_forward;
+   
+   outParam->pquant = picHeader.quant;
+
+   /* Initialize for only 1 GOB */
+   pictureParam->numMBLinesInGOB = pictureParam->lumMemHeight / 16;
+   pictureParam->numMBsInMBLine = pictureParam->lumMemWidth / 16;
+
+   pictureParam->numGOBs = 1;
+   pictureParam->fLastGOBSizeDifferent = 0;
+   pictureParam->numMBsInGOB = 
+      pictureParam->numMBsInMBLine * pictureParam->numMBLinesInGOB;
+   pictureParam->numMBsInLastGOB = pictureParam->numMBsInGOB;
+
+   /* Rounding type */
+   pictureParam->rtype = picHeader.rounding_type;
+
+   /* NO channel Multiplexing */
+   pictureParam->fSplitScreenIndicator = 0;
+   pictureParam->fDocumentCameraIndicator = 0;
+   pictureParam->fFullPictureFreezeRelease = 0;
+   pictureParam->fPLUSPTYPE = 0;
+   pictureParam->cpm = 0;
+
+   /* All the Annexes are switched off */
+   pictureParam->fSAC = 0;
+   pictureParam->fRPR = 0;
+   pictureParam->fRRU = 0;
+   pictureParam->fCustomSourceFormat = 0;
+   pictureParam->fAIC = 0;
+   pictureParam->fDF = 0;
+   pictureParam->fSS = 0;
+   pictureParam->fRPS = 0;
+   pictureParam->fISD = 0;
+   pictureParam->fAIV = 0;
+   pictureParam->fMQ = 0;
+   pictureParam->fUMVLimited = 0;
+
+   /* Unrestricted MV allowed
+      OBMC NOT allowed */
+   pictureParam->fUMV = 1;
+   pictureParam->fAP = 0;
+   pictureParam->fMVsOverPictureBoundaries = 1;
+
+   /* Initialize motion vector count module */
+   mvcStart(   &instance->mvcData, 
+               ((instance->pictureParam.lumMemWidth >>4 /*/ 16*/) - 1), 
+               pictureParam->lumWidth, 
+               pictureParam->lumHeight, &error);
+   /* Note: This assumes that the memory for frame->mvcData is filled with 0
+      in the first time the function is called.
+      (This is ensured by setting the instance data to zero when it is
+      initialized in vdcOpen.) */
+   if (error) {
+      deb("mvcStart failed.\n");
+      return DPH_ERR;
+   }
+
+   /* Initialize once to count parameters for the mvc module */
+   {
+   int r_size, scale_factor;
+ 
+   instance->mvcData.f_code = pictureParam->fcode_forward;
+   r_size = pictureParam->fcode_forward - 1;
+   scale_factor = (1 << r_size);
+   instance->mvcData.range = 160 * scale_factor;
+   }
+
+   /* Start, initialize the Advanced Intra Coding module */
+   aicStart(&instance->aicData, pictureParam->numMBsInMBLine, &error);
+   if (error) {
+      deb("aicStart failed.\n");
+      return DPH_ERR;
+   }
+
+   /* Get image buffers */
+   {
+      vdeIms_t *store = instance->imageStore;
+      vdeImsItem_t *imsItem;
+      vdeImb_t *imb;
+      int width, height;
+
+      vdeImsSetYUVNeed(store, inParam->fNeedDecodedFrame);
+
+      if (vdeImsGetFree(store, instance->pictureParam.lumMemWidth, 
+         instance->pictureParam.lumMemHeight, 
+         &instance->currFrame) < 0)
+         goto errGetFreeP;
+      imsItem = instance->currFrame;
+
+      if (vdeImsStoreItemToImageBuffer(imsItem, &imb) < 0)
+         goto errAfterGetFreeP;
+
+      if (vdeImbYUV(imb, &outParam->currYFrame, 
+         &outParam->currUFrame, &outParam->currVFrame,
+         &width, &height) < 0)
+         goto errAfterGetFreeP;
+   }
+
+   return ret;
+
+   /* Error condition handling,
+      release everything in reverse order */
+   errAfterGetFreeP:
+
+   vdeImsPutFree(instance->imageStore, instance->currFrame);
+   errGetFreeP:
+
+   instance->currFrame = NULL;
+   instance->bFrame = NULL;
+
+   return DPH_ERR;
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/decvp_mpeg.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,653 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Video packet decoding module (MPEG-4).
+*
+*/
+
+
+/*
+ * Includes
+ */
+#include "h263dConfig.h"
+#include "decvp_mpeg.h"
+#include "block.h"
+#include "debug.h"
+#include "decmbs.h"
+#include "stckheap.h"
+#include "sync.h"
+#include "viddemux.h"
+#include "biblin.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+
+/*
+ * Global functions
+ */
+
+/* {{-output"dvpGetAndDecodeVideoPacketHeader.txt"}} */
+/*
+ * dvpGetAndDecodeVideoPacketHeader
+ *    
+ *
+ * Parameters:
+ *    inParam                    input parameters
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *
+ * Function:
+ *    This function gets and decodes a Video Packet header at the 
+ *    current position of the bit buffer. It checks its correctness and 
+ *    if it fits to the sequence of VPs, and does the necessary actions for 
+ *    correction.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured
+ *
+ */
+
+int dvpGetAndDecodeVideoPacketHeader(
+   const dvpVPInParam_t *inParam,
+   dvpVPInOutParam_t *inOutParam)
+/* {{-output"dvpGetAndDecodeVideoPacketHeader.txt"}} */
+{
+   int16 error = 0;
+   vdxGetVideoPacketHeaderInputParam_t vdxParam;
+   vdxVideoPacketHeader_t header;
+   bibBuffer_t *inBuffer = inParam->inBuffer;
+   int bitErrorIndication = 0, retVal, fLostSegment = FALSE;
+
+   /* 
+    * Get VP header 
+    */
+
+   vdxParam.fcode_forward = inParam->pictParam->fcode_forward;
+   vdxParam.time_increment_resolution = inParam->pictParam->time_increment_resolution;
+   vdxParam.numOfMBs = inParam->pictParam->numMBsInGOB;
+
+   retVal = vdxGetVideoPacketHeader(inBuffer, &vdxParam, &header, &bitErrorIndication);
+   if (retVal < 0) {
+     return DGOB_ERR;
+   } else if (retVal > 0) {
+      deb("dvpGetAndDecodeVideoPacketHeader: ERROR - vdxGetVideoPacketHeader failed.\n");
+      goto headerFailure;
+   }
+
+
+   /*
+    * Check header validity
+    */
+
+   if (header.currMBNum == 0 || header.currMBNum >= inParam->pictParam->numMBsInGOB) {
+      deb("dvpGetAndDecodeVideoPacketHeader: ERROR - too big currMBNum.\n");
+      goto headerFailure;
+   }
+   
+   /* quant can not be zero */
+   if(header.quant == 0) {
+      goto headerFailure;
+   }
+
+   if (header.fHEC) {
+
+      if (header.time_base_incr < 0 || header.time_base_incr > 60) {
+         if (bitErrorIndication) {
+            goto headerFailure;
+         }
+      }
+
+      /* fcode can have only the valid values 1..7 */
+      if (header.coding_type == VDX_VOP_TYPE_P) 
+         if (header.fcode_forward == 0) {
+            goto headerFailure;
+         }
+
+      if (!inParam->fVOPHeaderCorrupted) {
+
+         if ((inParam->pictParam->pictureType != header.coding_type) ||
+            (inParam->pictParam->time_base_incr != header.time_base_incr) ||
+            (inParam->pictParam->time_inc != header.time_inc)) {
+            deb("dvpGetAndDecodeVideoPacketHeader: ERROR - Parameter change VOP<->VP header.\n");
+            goto headerFailure;
+         }
+      }
+   }
+   if (inParam->fVOPHeaderCorrupted) {
+      /* Get the coding type parameter since it is needed in the concealment before the other updates */
+      if (header.fHEC) {
+         inParam->pictParam->pictureType = header.coding_type;
+      }
+   }
+   if (header.currMBNum != inOutParam->currMBNum) {
+      if ( header.currMBNum > inOutParam->currMBNum && bitErrorIndication == 0) {
+
+         fLostSegment = TRUE;
+         goto headerFailure;
+
+      } else if (header.currMBNum < inOutParam->currMBNum) {
+         deb("dvpGetAndDecodeVideoPacketHeader: ERROR - MB counting is out of sync.\n");
+         goto headerFailure;
+      }
+   }
+
+   /*
+    * Update parameters
+    */
+
+   inOutParam->currMBNum = header.currMBNum;
+   inOutParam->quant = header.quant;
+
+   if (inParam->fVOPHeaderCorrupted) {
+      if (header.fHEC) {
+         inParam->pictParam->mod_time_base += inParam->pictParam->time_base_incr = header.time_base_incr;
+         
+         inParam->pictParam->time_inc = header.time_inc;
+
+         inOutParam->frameNum = (int) ((inParam->pictParam->mod_time_base + 
+            ((double) header.time_inc) / ((double) inParam->pictParam->time_increment_resolution)) *
+            30.0 + 0.001);
+
+         inParam->pictParam->tr = inOutParam->frameNum % 256;
+         inParam->pictParam->pictureType = header.coding_type;
+
+         inParam->pictParam->intra_dc_vlc_thr = header.intra_dc_vlc_thr;
+
+         if (header.coding_type == VDX_VOP_TYPE_P)
+             if (inParam->pictParam->fcode_forward != header.fcode_forward) {
+                 /* Initialize once to count parameters for the mvc module */
+                 int r_size, scale_factor;
+                 
+                 inParam->pictParam->fcode_forward = header.fcode_forward;
+
+                 inOutParam->mvcData->f_code = inParam->pictParam->fcode_forward;
+                 r_size = inParam->pictParam->fcode_forward - 1;
+                 scale_factor = (1 << r_size);
+                 inOutParam->mvcData->range = 160 * scale_factor;
+             }
+      } else {
+         /* seek next PSC, VP start code is not good enough */
+         sncRewindAndSeekNewMPEGSync(-1, inBuffer, 0, &error);
+         return DGOB_OK_BUT_BIT_ERROR;
+      }
+   }
+   
+   if (fLostSegment)
+       return DGOB_OK_BUT_BIT_ERROR;
+   else
+       return DGOB_OK;
+
+   headerFailure:
+      sncRewindAndSeekNewMPEGSync(-1, inBuffer, inParam->pictParam->fcode_forward, &error);
+     
+     if (error && error != ERR_BIB_NOT_ENOUGH_DATA)
+         return DGOB_ERR;
+      return DGOB_OK_BUT_BIT_ERROR;
+}
+
+
+/* {{-output"dvpGetAndDecodeVideoPacketContents.txt"}} */
+/*
+ * dvpGetAndDecodeVideoPacketContents
+ *    
+ *
+ * Parameters:
+ *    inParam                    input parameters
+ *    fGetNewReferenceFrame      non-zero if a new reference frame must be
+ *                               requested from the image store, otherwise 0
+ *    inOutParam                 input/output parameters, these parameters
+ *                               may be modified in the function
+ *
+ * Function:
+ *    This function gets and decodes the contents of a Video Packet
+ *    after the header of the VP (either VP header or picture
+ *    header) is already got and processed. It works MB-by-MB or if VP
+ *    is data partitioned calls the corresponding decoding functions.
+ *    Error concealment for the missing (not decodable) MBs in a P-frame
+ *    is called.
+ *
+ * Returns:
+ *    >= 0                       the function was successful
+ *    < 0                        an error occured
+ *
+ */
+
+int dvpGetAndDecodeVideoPacketContents(
+   const dvpVPInParam_t *inParam,
+   int fGetNewReferenceFrame,
+   dvpVPInOutParam_t *inOutParam, CMPEG4Transcoder *hTranscoder)
+/* {{-output"dvpGetAndDecodeVideoPacketContents.txt"}} */
+{
+   int16 error = 0;
+   int bitErrorIndication = 0;
+   dmbPFrameMBInParam_t dpmbi;
+   dmbPFrameMBInOutParam_t dpmbio;
+   dmbIFrameMBInParam_t dimbi;
+   dmbIFrameMBInOutParam_t dimbio;
+   int yPosInMBs, xPosInMBs = 0;
+   bibBuffer_t *inBuffer;
+   bibBuffer_t 
+       *outBuffer;        /* Output bit buffer instance */
+   
+   bibBufferEdit_t              
+       *bufEdit; 
+   
+   int colorEffect; 
+   TBool getDecodedFrame;
+
+
+   int fSegmentCorrupted = 0;
+
+   int dmbRetValue;
+   int sncCode = SNC_NO_SYNC;
+   int lastMBNumInVP = 0;
+   int startMB = inOutParam->currMBNum;
+
+   SOH_DEFINE(blcDiffMB_t, pDiffMB); /* Storage for the previous difference blocks */
+  
+   SOH_ALLOC(blcDiffMB_t, pDiffMB);
+
+   if (pDiffMB == NULL) {
+      deb("dvpGetAndDecodeVideoPacketContents: SOH_ALLOC failed.\n");
+      goto unexpectedError;
+   }
+
+   pDiffMB->cbpy = 0;
+
+   inBuffer = inParam->inBuffer;
+   outBuffer = inParam->outBuffer;
+   bufEdit = inParam->bufEdit;
+   colorEffect = inParam->iColorEffect;
+   getDecodedFrame = inParam->iGetDecodedFrame;
+
+   /* If the reference frame changed */
+   if (fGetNewReferenceFrame) {
+      vdeIms_t *store = inOutParam->imageStore;
+      vdeImsItem_t *imsItem;
+      vdeImb_t *imb;
+      int width, height;
+
+     if (vdeImsGetReference(store, VDEIMS_REF_LATEST, 0, &imsItem) < 0) {
+        deb("dvpGetAndDecodeVideoPacketContents: ERROR - vdeImsGetReference "
+           "failed.\n");
+        goto unexpectedError;
+     }
+
+      /* If no reference frame available */
+      if (!imsItem) {
+         /* Treat the situation like a decoding error.*/
+         deb("dvpGetAndDecodeVideoPacketContents: Warning - no reference frame "
+            "available.\n");
+         goto headerFailure;
+      }
+
+      if (vdeImsStoreItemToImageBuffer(imsItem, &imb) < 0) {
+         deb("dvpGetAndDecodeVideoPacketContents: ERROR - vdeImsStoreItemToImageBuffer "
+            "failed.\n");
+         goto unexpectedError;
+      }
+
+      if (vdeImbYUV(imb, &inOutParam->refY, &inOutParam->refU, 
+         &inOutParam->refV, &width, &height) < 0) {
+         deb("dvpGetAndDecodeVideoPacketContents: ERROR - vdeImbYUV "
+            "failed.\n");
+         goto unexpectedError;
+      }
+   }
+
+   xPosInMBs = (inOutParam->currMBNum % inParam->pictParam->numMBsInMBLine);
+   yPosInMBs = (inOutParam->currMBNum / inParam->pictParam->numMBsInMBLine);
+
+   /* if VOP header corrupted and first VP -> exit */
+   if(inParam->fVOPHeaderCorrupted && inOutParam->currMBNum==0) {
+      fSegmentCorrupted = 1;
+      goto exitWhenVOPHeaderCorrupted;
+   }
+
+   /* in case of an I-VOP */
+   if (inParam->pictParam->pictureType == VDX_VOP_TYPE_I) {
+      dimbi.inBuffer = inBuffer;
+      dimbi.outBuffer = outBuffer;
+      dimbi.bufEdit = bufEdit;
+      dimbi.iColorEffect = colorEffect;
+      dimbi.iGetDecodedFrame = getDecodedFrame;
+
+      dimbi.pictParam = inParam->pictParam;
+
+      dimbi.xPosInMBs = xPosInMBs;
+      dimbi.yPosInMBs = yPosInMBs;
+
+      dimbio.currMBNum = inOutParam->currMBNum;
+      dimbio.currMBNumInVP = 0;
+
+     dimbio.aicData = inOutParam->aicData;
+
+      dimbio.fCodedMBs = inOutParam->fCodedMBs;
+      dimbio.numOfCodedMBs = inOutParam->numOfCodedMBs;
+      dimbio.quant = inOutParam->quant;
+     
+      /* YUV pointers */
+     {
+      int32 yOffset, uvOffset;
+   
+      yOffset = inParam->pictParam->lumMemWidth * dimbi.yPosInMBs + dimbi.xPosInMBs;
+      uvOffset = (inParam->pictParam->lumMemWidth >> 1) * dimbi.yPosInMBs + dimbi.xPosInMBs;
+
+      if ( inOutParam->currPY != NULL )
+        {
+          dimbio.yMBInFrame = inOutParam->currPY + (yOffset << 4);
+          dimbio.uBlockInFrame = inOutParam->currPU + (uvOffset << 3);
+          dimbio.vBlockInFrame = inOutParam->currPV + (uvOffset << 3);
+        }
+      else
+        {
+          dimbio.yMBInFrame = NULL;
+          dimbio.uBlockInFrame = NULL;
+          dimbio.vBlockInFrame = NULL;
+        }
+     }
+   }
+   /* in case of a P-VOP */
+   else {
+      dpmbi.inBuffer = inBuffer;
+      dpmbi.outBuffer = outBuffer;
+      dpmbi.bufEdit = bufEdit;
+      dpmbi.iColorEffect = colorEffect;
+      dpmbi.iGetDecodedFrame = getDecodedFrame;
+
+      dpmbi.pictParam = inParam->pictParam;
+
+      dpmbi.xPosInMBs = xPosInMBs;
+      dpmbi.yPosInMBs = yPosInMBs;
+
+      dpmbi.refY = inOutParam->refY;
+      dpmbi.refU = inOutParam->refU;
+      dpmbi.refV = inOutParam->refV;
+      dpmbi.currPY = inOutParam->currPY;
+      dpmbi.currPU = inOutParam->currPU;
+      dpmbi.currPV = inOutParam->currPV;
+
+      dpmbio.currMBNum = inOutParam->currMBNum;
+      dpmbio.currMBNumInVP = 0;
+
+      dpmbio.fCodedMBs = inOutParam->fCodedMBs;
+      dpmbio.numOfCodedMBs = inOutParam->numOfCodedMBs;
+      dpmbio.quant = inOutParam->quant;
+
+     dpmbio.aicData = inOutParam->aicData;
+
+     dpmbio.mvcData = inOutParam->mvcData;
+      dpmbio.diffMB = pDiffMB;
+
+      /* YUV pointers */
+     {
+      int32 yOffset, uvOffset;
+   
+      yOffset = inParam->pictParam->lumMemWidth * dpmbi.yPosInMBs + dpmbi.xPosInMBs;
+      uvOffset = (inParam->pictParam->lumMemWidth >> 1) * dpmbi.yPosInMBs + dpmbi.xPosInMBs;
+
+      if ( inOutParam->currPY != NULL )
+        {
+          dpmbio.yMBInFrame = inOutParam->currPY + (yOffset << 4);
+          dpmbio.uBlockInFrame = inOutParam->currPU + (uvOffset << 3);
+          dpmbio.vBlockInFrame = inOutParam->currPV + (uvOffset << 3);
+        }
+      else
+        {
+          dimbio.yMBInFrame = NULL;
+          dimbio.uBlockInFrame = NULL;
+          dimbio.vBlockInFrame = NULL;
+        }
+     }
+   }
+
+   /* Decode multiple Macroblocks until a resync_marker is found or error occurs */
+   while (inParam->pictParam->numMBsInGOB != inOutParam->currMBNum && 
+         sncCode != SNC_VIDPACK && sncCode != SNC_VOP) {
+
+       /* MVE */
+       hTranscoder->BeginOneMB((inParam->pictParam->pictureType == VDX_VOP_TYPE_I) ? dimbio.currMBNum : dpmbio.currMBNum );
+       
+     /* decode an I-frame MB */
+      if (inParam->pictParam->pictureType == VDX_VOP_TYPE_I) {
+         
+         if(inParam->pictParam->data_partitioned) {
+
+            dmbRetValue = dmbsGetAndDecodeIMBsDataPartitioned(&dimbi, &dimbio,
+               inOutParam->quantParams, hTranscoder);
+
+            if (dmbRetValue < 0)
+               goto unexpectedError;
+            
+            inOutParam->currMBNum = dimbio.currMBNum;
+
+            /* Video Packet corrupted */
+            if ( fSegmentCorrupted )
+               break;
+
+         } else {
+
+            dmbRetValue = dmbGetAndDecodeIFrameMB(&dimbi, &dimbio, 1, hTranscoder);
+            
+            if (dmbRetValue < 0)
+               goto unexpectedError;
+            else if (dmbRetValue == DMB_BIT_ERR ) {
+               /* Video Packet corrupted */
+               fSegmentCorrupted = 1;
+               break;
+            }
+
+            /* Store quantizer */
+            inOutParam->quantParams[dimbio.currMBNum] = dimbio.quant;
+
+            /* increment the frame pointers and MB counters */
+            dimbio.currMBNum++;
+            dimbio.currMBNumInVP++;
+
+            if ( dimbio.yMBInFrame != NULL )
+            {
+                dimbio.yMBInFrame += 16;
+                dimbio.uBlockInFrame += 8;
+                dimbio.vBlockInFrame += 8;
+            }
+            dimbi.xPosInMBs++;
+
+            if (dimbi.xPosInMBs == inParam->pictParam->numMBsInMBLine) {
+              if ( dimbio.yMBInFrame != NULL )
+                {
+                   dimbio.yMBInFrame += 15 * inParam->pictParam->lumMemWidth;
+                   dimbio.uBlockInFrame += 7 * (inParam->pictParam->lumMemWidth >> 1);
+                   dimbio.vBlockInFrame += 7 * (inParam->pictParam->lumMemWidth >> 1);
+                }
+               dimbi.xPosInMBs = 0;
+               dimbi.yPosInMBs++;
+            }
+
+            inOutParam->currMBNum = dimbio.currMBNum;
+         }
+
+         /* decode a P-frame MB */
+     } else {
+
+         if(inParam->pictParam->data_partitioned) {
+
+            dmbRetValue = dmbsGetAndDecodePMBsDataPartitioned(&dpmbi, &dpmbio,
+               inOutParam->quantParams, hTranscoder);
+
+            if (dmbRetValue < 0)
+               goto unexpectedError;
+
+            inOutParam->currMBNum = dpmbio.currMBNum;
+            lastMBNumInVP = dpmbio.currMBNumInVP;
+
+            /* Video Packet corrupted */
+            if ( fSegmentCorrupted )
+               break;
+
+         } else {
+
+            dmbRetValue = dmbGetAndDecodePFrameMB(&dpmbi, &dpmbio, 1, hTranscoder);
+            
+            if (dmbRetValue < 0)
+               goto unexpectedError;
+            else if (dmbRetValue == DMB_BIT_ERR ) {
+               /* Video Packet corrupted */
+               fSegmentCorrupted = 1;
+               break;
+            }
+            
+            /* Store quantizer */
+            inOutParam->quantParams[dpmbio.currMBNum] = dpmbio.quant;
+
+            /* increment the frame pointers and MB counters */
+            dpmbio.currMBNum++;
+            dpmbio.currMBNumInVP++;
+
+            if ( dpmbio.yMBInFrame != NULL )
+              {
+                dpmbio.yMBInFrame += 16;
+                dpmbio.uBlockInFrame += 8;
+                dpmbio.vBlockInFrame += 8;
+              }
+            dpmbi.xPosInMBs++;
+
+            if (dpmbi.xPosInMBs == inParam->pictParam->numMBsInMBLine) {
+                if ( dpmbio.yMBInFrame != NULL )
+                  {
+                   dpmbio.yMBInFrame += 15 * inParam->pictParam->lumMemWidth;
+                   dpmbio.uBlockInFrame += 7 * (inParam->pictParam->lumMemWidth >> 1);
+                   dpmbio.vBlockInFrame += 7 * (inParam->pictParam->lumMemWidth >> 1);
+                  }
+               dpmbi.xPosInMBs = 0;
+               dpmbi.yPosInMBs++;
+            }
+
+            inOutParam->currMBNum = dpmbio.currMBNum;
+         }
+     }
+
+     /* check for a resync_marker */
+     sncCode = sncCheckMpegSync(inBuffer, inParam->pictParam->fcode_forward, &error);
+     
+     /* If sncCheckMpegSync failed */
+     if (error && error != ERR_BIB_NOT_ENOUGH_DATA) {
+         deb1p("dvpGetAndDecodeVideoPacketContents: ERROR - sncCheckSync returned %d.\n", error);
+         goto unexpectedError;
+         
+     } else 
+         /* If buffer ends (in one-frame-per-one-buffer case) */
+         if (sncCode == SNC_EOB ||
+             sncCode == SNC_STUFFING ||
+             error == ERR_BIB_NOT_ENOUGH_DATA) {
+             break; 
+         }
+     
+   }
+
+
+// <--
+
+   inOutParam->numOfCodedMBs = (inParam->pictParam->pictureType != VDX_VOP_TYPE_I) ? 
+        dpmbio.numOfCodedMBs : dimbio.numOfCodedMBs;
+   
+   if (fSegmentCorrupted) {
+      u_int32 nextVPBitPos;
+
+      /* find the next resync marker, to get the number of MBs in the current VP */
+      sncCode = sncRewindAndSeekNewMPEGSync(-1, inBuffer, inParam->pictParam->fcode_forward, &error);
+      if (error && error != ERR_BIB_NOT_ENOUGH_DATA) {
+         goto unexpectedError;
+      } else if (sncCode == SNC_EOB) {
+         goto exitFunction;
+      }
+
+      nextVPBitPos = bibNumberOfFlushedBits(inParam->inBuffer);
+
+      /* if the lastMBNumInVP was not yet read */
+      if (inParam->pictParam->pictureType == VDX_VOP_TYPE_I || 
+         !inParam->pictParam->data_partitioned || 
+         lastMBNumInVP == 0) { 
+
+         /* if VP header is found: read it, and get last MB number in current vop */
+         if (sncCode == SNC_VIDPACK) {
+            vdxVideoPacketHeader_t header;
+            vdxGetVideoPacketHeaderInputParam_t vdxParam;
+            int retValue;
+            
+            vdxParam.fcode_forward = inParam->pictParam->fcode_forward;
+            vdxParam.time_increment_resolution = inParam->pictParam->time_increment_resolution;
+            vdxParam.numOfMBs = inParam->pictParam->numMBsInGOB;
+            
+            retValue = vdxGetVideoPacketHeader(inParam->inBuffer, &vdxParam, &header, &bitErrorIndication);
+            if (retValue < 0) {
+               goto unexpectedError;
+            } else if (retValue == VDX_OK_BUT_BIT_ERROR) {
+               /* If bit error occurred */
+               goto headerFailure;
+            }
+            
+            /* rewind the bits to the beginning of the VP header */
+            bibRewindBits(bibNumberOfFlushedBits(inParam->inBuffer) - nextVPBitPos,
+               inParam->inBuffer, &error);
+            
+            lastMBNumInVP = header.currMBNum;
+            
+         } else {
+            lastMBNumInVP = inParam->pictParam->numMBsInGOB;
+         }
+      }
+
+      /* if possibly the next VP header is damaged (it gives MB index which is smaller than the start of the current one */
+      if (lastMBNumInVP <= startMB || lastMBNumInVP > inParam->pictParam->numMBsInGOB)
+         goto exitFunction;
+
+      /* if the MB counting due to error overran the next VP header's value */
+      if (inOutParam->currMBNum > lastMBNumInVP)
+         inOutParam->currMBNum = VDC_MAX(lastMBNumInVP-3,startMB);
+      
+      /* if not all the MBs have been predicted due to error */
+      else if (inOutParam->currMBNum < lastMBNumInVP)
+         inOutParam->currMBNum = VDC_MAX(inOutParam->currMBNum-1,startMB);
+
+      
+      inOutParam->currMBNum = lastMBNumInVP;
+   }
+
+   exitFunction:
+
+
+   exitWhenVOPHeaderCorrupted:
+
+   if (!fSegmentCorrupted) {
+      SOH_DEALLOC(pDiffMB);
+      return DGOB_OK;
+   }
+   else {
+      SOH_DEALLOC(pDiffMB);
+      return DGOB_OK_BUT_BIT_ERROR;
+   }
+
+   headerFailure:
+      SOH_DEALLOC(pDiffMB);
+      sncRewindAndSeekNewMPEGSync(-1, inBuffer, 0, &error);
+      if (error && error != ERR_BIB_NOT_ENOUGH_DATA)
+         return DGOB_ERR;
+      return DGOB_OK_BUT_BIT_ERROR;
+
+   unexpectedError:
+      SOH_DEALLOC(pDiffMB);
+      return DGOB_ERR;
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/dlist.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,384 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Doubly linked list module.
+*
+*/
+
+
+/*
+ * dlist.c
+ *
+ *    
+ *
+ * Project:
+ *    Mobile Videophone Demonstrator
+ *    H.263 Video Decoder
+ *
+ * Contains:
+ *    This module contains generic list handling functions for doubly linked 
+ *    lists, i.e. one can use the same set of functions regardless of the type 
+ *    of list items.
+ *    The list item type has a constraint that it must begin with the skeleton
+ *    of a list item (see the definition of DLST_ITEM_SKELETON in dlist.h).
+ *
+ *    The prefix ddlst is used in common names defined in this module.
+ *
+ *
+ *
+ */
+
+
+#include "dlist.h"
+
+
+#ifndef NULL
+   #define NULL 0
+#endif
+
+
+/*
+ * dlstClose
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a list
+ *
+ * Function:
+ *    This function deinitializes the given list. Notice that no dynamic
+ *    allocation for the list is done. This function must be called when
+ *    the list is no longer used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int dlstClose(dlst_t *list)
+{
+   list->head = list->tail = list->curr = NULL;
+   list->numItems = 0;
+
+   return 0;
+}
+
+
+/*
+ * dlstRemove
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a list
+ *    item                       used to return a pointer to the removed
+ *                               list item
+ *
+ * Function:
+ *    This function removes an item from the list. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ *    If there are no items left in the list, NULL will be returned in
+ *    the item parameter.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int dlstRemove(dlst_t *list, void **item)
+{
+   if (list->curr) {
+      dlstListItem_t 
+         *curr = list->curr, 
+         *prev = (dlstListItem_t *) (list->curr->prev),
+         *next = (dlstListItem_t *) (list->curr->next);
+
+      *item = (void *) curr;
+
+      if (prev)
+         prev->next = curr->next;
+      else
+         list->head = (dlstListItem_t *) curr->next;
+
+      if (next)
+         next->prev = curr->prev;
+
+      curr->next = NULL;
+      curr->prev = NULL;
+
+      if (curr == list->tail) {
+         list->tail = prev;
+         list->curr = prev;
+      }
+      else
+         list->curr = next;
+
+      list->numItems--;
+   }
+
+   else
+      *item = NULL;
+
+   return 0;
+}
+
+
+/*
+ * dlstOpen
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a list
+ *
+ * Function:
+ *    This function initializes the given list. Notice that no dynamic
+ *    allocation for the list is done. This function must be called before
+ *    the list is used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int dlstOpen(dlst_t *list)
+{
+   list->head = list->tail = list->curr = NULL;
+   list->numItems = 0;
+
+   return 0;
+}
+
+
+/*
+ * dlstHead
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a dlst list
+ *    item                       used to return a pointer to the head item
+ *                               of the list
+ *
+ * Function:
+ *    This function sets the current access point to the head of the list and
+ *    returns a pointer to the head item. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ *    If there are no items left in the list, NULL will be returned in
+ *    the item parameter.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int dlstHead(dlst_t *list, void **item)
+{
+   if (list->head)
+      *item = (void *) list->head;
+
+   else
+      *item = NULL;
+
+   list->curr = list->head;
+
+   return 0;
+}
+
+
+/*
+ * dlstTail
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a dlst list
+ *
+ * Function:
+ *    This function sets the current access point to the tail of the list
+ *    enabling the item addition to the end of the list.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int dlstTail(dlst_t *list, void **item)
+{
+
+   if (list->tail)
+      *item = (void *) list->tail;
+
+   else
+      *item = NULL;
+
+   list->curr = list->tail;
+
+   return 0;
+}
+
+
+/*
+ * dlstNext
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a dlst list
+ *    item                       used to return a pointer to the next item
+ *                               of the list
+ *
+ * Function:
+ *    This function sets the current access point to the next item of the list
+ *    and returns a pointer to the item. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ *    If there are no items left in the list, NULL will be returned in
+ *    the item parameter and the current access point shall be left as it is.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int dlstNext(dlst_t *list, void **item)
+{
+   if (list->curr && list->curr->next) {
+      list->curr = (dlstListItem_t *) (list->curr->next);
+      *item = (void *) list->curr;
+   }
+
+   else
+      *item = NULL;
+
+   return 0;
+}
+
+
+int dlstPrev(dlst_t *list, void **item)
+{
+   if (list->curr && list->curr->prev) {
+      list->curr = (dlstListItem_t *) (list->curr->prev);
+      *item = (void *) list->curr;
+   }
+
+   else
+      *item = NULL;
+
+   return 0;
+}
+
+
+int dlstCurr(dlst_t *list, void **item)
+{
+   *item = (void *) list->curr;
+
+   return 0;
+}
+
+
+int dlstNextExists(dlst_t *list)
+{
+   return (list->curr && list->curr->next) ? 1 : 0;
+}
+
+/*
+ * dlstAdd
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a dlst list
+ *    item                       an item to add to the list
+ *
+ * Function:
+ *    This function adds an item into the list. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int dlstAddBeforeCurr(dlst_t *list, void *item)
+{
+   dlstListItem_t
+      *curr, *prev, *listItem = (dlstListItem_t *) item;
+
+   if (list->curr) {
+      curr = (dlstListItem_t *) list->curr, 
+      prev = (dlstListItem_t *) list->curr->prev;
+
+      if (prev)
+         prev->next = item;
+      else
+         list->head = (dlstListItem_t *) item;
+      listItem->prev = prev;
+
+      curr->prev = item;
+      listItem->next = curr;
+
+      list->curr = (dlstListItem_t *) item;
+   }
+
+   else {
+      list->head = list->tail = list->curr = (dlstListItem_t *) item;
+      listItem->next = NULL;
+      listItem->prev = NULL;
+   }
+
+   list->numItems++;
+
+   return 0;
+}
+
+int dlstAddAfterCurr(dlst_t *list, void *item)
+{
+   dlstListItem_t
+      *curr, *next, *listItem = (dlstListItem_t *) item;
+
+   if (list->curr) {
+      curr = list->curr, 
+      next = (dlstListItem_t *) (list->curr->next);
+
+      curr->next = item;
+      listItem->prev = curr;
+
+      if (next)
+         next->prev = item;
+      else
+         list->tail = (dlstListItem_t *) item;
+      listItem->next = next;
+
+      list->curr = (dlstListItem_t *) item;
+   }
+
+   else {
+      list->head = list->tail = list->curr = (dlstListItem_t *) item;
+      listItem->next = NULL;
+      listItem->prev = NULL;
+   }
+
+   list->numItems++;
+
+   return 0;
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/epoclib.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,245 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Wrappers for Symbian OS -specific system functions.
+*
+*/
+
+
+#include <e32base.h>
+#include <s32file.h>
+#include "epoclib.h"
+
+#define NAMELEN 120
+#define EL_EXPORT
+
+
+EL_EXPORT void free(TAny *ptr)
+
+    {
+#ifdef MALLOC_DEBUG        
+    if ( !ptr )
+        return;
+
+    unsigned *p32 = (unsigned*) (((unsigned) ptr) - (NAMELEN+8));
+
+    if ( p32[0] != 0xdaded1d0 )
+        User::Panic(_L("BadFree"), 1);
+
+    ptr = (TAny*) p32;
+#endif
+    
+    //  Dangling pointer check
+    unsigned count = (unsigned) User::AllocLen(ptr);
+    TUint8 *p;
+    
+    p = (TUint8*) ptr;
+    while ( count >> 2 )
+    {
+        *((TUint32*)p) = 0xfeedf1d0;
+        p += 4;
+        count -= 4;
+    }
+    while ( count )
+    {
+        *(p++) = 0x17;
+        count--;
+    }
+
+    User::Free(ptr);
+    }
+
+#ifdef MALLOC_DEBUG
+EL_EXPORT TAny *debugMalloc(u_int32 size, char *file, int line)
+#else    
+EL_EXPORT TAny *malloc(u_int32 size)
+#endif    
+    {
+    // Uninit checks        
+    TAny *ptr;
+    unsigned count = size;
+    TUint8 *p;
+
+#ifdef MALLOC_DEBUG
+    ptr = User::Alloc(size + NAMELEN+8);
+    if ( !ptr )
+        return 0;    
+    p = ((TUint8*) ptr) + NAMELEN+8;
+#else
+    ptr = User::Alloc(size);
+    if ( !ptr )
+        return 0;
+    p = (TUint8*) ptr;
+#endif       
+
+    while ( count >> 2 )
+    {
+        *((TUint32*)p) = 0xdeadbeef;
+        p += 4;
+        count -= 4;
+    }
+    while ( count )
+    {
+        *(p++) = 0x42;
+        count--;
+    }
+
+#ifdef MALLOC_DEBUG
+    unsigned *p32 = (unsigned*) ptr;
+    p32[0] = 0xdaded1d0;
+    p32[1] = (unsigned) line;
+    char *c = (char*) &p32[2];
+    int n = NAMELEN;
+    while ( (*file != 0) && n )
+    {
+        *(c++) = *(file++);
+        n--;
+    }
+    return (TAny*) (((unsigned) p32) + NAMELEN + 8);
+#else  
+    return ptr;
+#endif    
+    }
+
+EL_EXPORT TAny *realloc(void *memblock, u_int32 size)
+    {
+    // realloc not used at least currently, skip the debug-branch
+    return User::ReAlloc(memblock, size);
+    }
+
+
+#ifdef MALLOC_DEBUG
+EL_EXPORT TAny *debugCalloc(u_int32 num, u_int32 size, char *file, int line)
+{
+    TAny *ptr;
+    TUint8 *p;
+
+    ptr = User::Alloc(num*size + NAMELEN+8);
+    if ( !ptr )
+        return 0;
+    p = ((TUint8*) ptr) + NAMELEN+8;
+    
+    Mem::Fill(p, size*num, 0);
+
+    unsigned *p32 = (unsigned*) ptr;
+    p32[0] = 0xdaded1d0;
+    p32[1] = (unsigned) line;
+    char *c = (char*) &p32[2];
+    int n = NAMELEN;
+    while ( (*file != 0) && n )
+    {
+        *(c++) = *(file++);
+        n--;
+    }
+    return (TAny*) p;
+}
+#else    
+EL_EXPORT TAny *calloc(u_int32 num, u_int32 size)
+
+    {
+    TAny *dest = User::Alloc(size*num);
+    Mem::Fill(dest, size*num, 0);
+    return dest;
+    }
+#endif
+
+EL_EXPORT TAny *memset(TAny *dest, TInt c, TInt size)
+    {
+    Mem::Fill(dest, size, c);
+    return dest; //returning the value of dest as in windows
+    }
+EL_EXPORT TAny *memcpy(TAny *dest, const TAny *src, TInt size)
+    {
+    Mem::Copy(dest, src, size);
+    return dest;
+    }
+
+EL_EXPORT TAny *memmove(TAny *dest, const TAny *src, u_int32 count)
+    {
+    Mem::Copy(dest,src,count);
+    return dest;
+    }
+
+long atol(
+        const char *nptr
+        )
+{
+        int c;              // current char 
+        long total;         // current total 
+        int sign;           // if '-', then negative, otherwise positive 
+
+        TLex8 string((unsigned char *)nptr);
+        // skip whitespace 
+        string.SkipSpace();
+        
+        //prendre un caratere dans string lui faire le sign
+        c = (int)string.Peek();
+        string.Inc();
+
+        sign = c;           // save sign indication 
+        if (c == '-' || c == '+')
+        // skip sign 
+            {c = (int)string.Peek();
+              string.Inc();
+            }
+        else //If c is not a sign, it is necessary to go increment back into the descriptors to get the right
+             //number 
+            {
+            string.UnGet();
+            }
+
+        total = 0;
+
+        while (string.Peek().IsDigit())
+            {
+            total = 10 * total + (c - '0');
+            string.Inc();
+            c = (int)string.Peek();
+            
+            }
+
+        if (sign == '-')
+            return -total;
+        else
+            return total;   /* return result, negated if necessary */
+}
+
+
+/*
+*int atoi(char *nptr) - Convert string to long
+*
+*Purpose:
+*       Converts ASCII string pointed to by nptr to binary.
+*       Overflow is not detected.  Because of this, we can just use
+*       atol().
+*
+*Entry:
+*       nptr = ptr to string to convert
+*
+*Exit:
+*       return int value of the string
+*
+*Exceptions:
+*       None - overflow is not detected.
+*
+*******************************************************************************/
+
+EL_EXPORT int atoi(
+        const char *nptr
+        )
+{
+        return (int)atol(nptr);
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/h263dntc.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,750 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Video decoder control interface.
+*
+*/
+
+
+
+/*
+ * Includes
+ */
+
+/* Include the definition header for the active build target */
+#include "h263dConfig.h"
+/* Include the header for this file */
+#include "h263dntc.h"
+/* All other inclusions */
+#include "biblin.h"
+#include "h263dapi.h"
+#include "vde.h"
+#include "vdemain.h"
+#include "vdeti.h"
+#include "biblin.h"
+/* MVE */
+//#include "InnerTranscoder.h"
+#include "core.h"
+#include "MPEG4Transcoder.h"
+
+/* 
+ * Constants 
+ */
+const TUint KH263StartCodeLength = 3;  // H.263 picture start code length
+const TUint KMPEG4StartCodeLength = 4; // MPEG4 picture start code length
+
+/*
+* Global functions
+*/
+
+/* {{-output"h263dClose.txt"}} */
+/*
+* h263dClose
+*    
+*
+* Parameters:
+*    hInstance                  instance handle
+*
+* Function:
+*    This function closes an H.263 decoder instance.
+*
+* Returns:
+*    Nothing
+*/
+
+void H263D_CC h263dClose(h263dHInstance_t hInstance)
+/* {{-output"h263dClose.txt"}} */
+{
+    if (hInstance)
+        vdeShutDown(hInstance);
+}
+
+
+/* {{-output"h263dDecodeFrame.txt"}} */
+/*
+* h263dDecodeFrameL
+*    
+*
+* Parameters:
+*    hInstance                  instance data
+*    pStreamBuffer              pointer to input data (>= 1 video frames)
+*    streamBufferSize           size of pStreamBuffer
+*    fFirstFrame                pointer to flag telling if the very first
+*                               frame is being decoded
+*    frameSize                  If non-NULL, frameSize is used to return 
+*                               the number of bytes that were decoded 
+*                               to produce the reconstructed output frame.
+*
+* Function:
+*    This function decodes the bitstream until it gets at least one decoded
+*    frame. It also shows the resulting frames. 
+*    In addition, the function handles the parameter updating synchronization.
+*
+* Returns:
+*    H263D_OK                   if the function was successful
+*    H263D_OK_EOS               if the end of stream has been reached
+*    H263D_ERROR                if a fatal error, from which the decoder
+*                               cannot be restored, has occured
+*    H263D_ERROR_HALTED         the instance is halted, it should be closed
+*/
+
+int H263D_CC h263dDecodeFrameL(h263dHInstance_t hInstance,
+                               void *pStreamBuffer,
+                               void *pOutStreamBuffer,
+                               unsigned streamBufferSize,
+                               u_char *fFirstFrame,
+                               TInt *frameSize,
+                               TInt *outframeSize, 
+                               vdeDecodeParamters_t *aDecoderInfo
+                               )
+                                                            
+/* {{-output"h263dDecodeFrame.txt"}} */
+{
+    TInt colorEffect = aDecoderInfo->aColorEffect;
+    TInt colorToneU  = aDecoderInfo->aColorToneU;
+    TInt colorToneV  = aDecoderInfo->aColorToneV;
+    TInt frameOperation = aDecoderInfo->aFrameOperation;
+    TInt* trP = aDecoderInfo->aTrP;
+    TInt* trD = aDecoderInfo->aTrD; 
+    TInt videoClipNumber = aDecoderInfo->aVideoClipNumber; 
+    TInt smSpeed = aDecoderInfo->aSMSpeed;
+    TInt getDecodedFrame = aDecoderInfo->aGetDecodedFrame; 
+    
+    bibBuffer_t 
+        *buffer = 0;                   /* input buffer */
+    
+    bibBuffer_t 
+        *outbuffer = 0;               /* output buffer */
+
+    bibBuffer_t 
+        *tmpbuffer = 0;                /* temporary buffer */
+
+    u_char* tmpbuf=0;
+
+    bibBufferEdit_t
+        *bufEdit = 0;
+     
+    int StartByteIndex=0;
+    int StartBitIndex=7;
+
+    int tr = 0;
+    int newtr = 0;
+    int efftr;
+    int numBitsGot;
+    int bitsErrorIndication;
+    int16 bibError;
+    
+    int retValue;                  /* return value for vde functions */
+
+    int leaveError = 0;
+     
+    int16
+        errorCode = 0;             /* return code for bib functions */
+
+  /* MVE */
+    int startCodeLen = 0;
+    CMPEG4Transcoder *hTranscoder = NULL;
+
+    TBool modifyMPEG4Afterwards = EFalse;
+
+    vdeAssert(hInstance);
+    vdeAssert(pStreamBuffer);
+    vdeAssert(pOutStreamBuffer);
+    vdeAssert(streamBufferSize);
+    vdeAssert(fFirstFrame);
+
+    vdeInstance_t *vdeinstance = (vdeInstance_t *) hInstance;
+    
+    /* Create bit buffer */
+    buffer = bibCreate(pStreamBuffer, streamBufferSize, &errorCode);
+     if (!buffer || errorCode)
+         return H263D_ERROR;
+     
+     /* MVE */
+
+     if ((aDecoderInfo->streamMode==EVedVideoBitstreamModeMPEG4ShortHeader) || (aDecoderInfo->streamMode == EVedVideoBitstreamModeH263) )
+         outbuffer = bibCreate(pOutStreamBuffer, streamBufferSize-3, &errorCode);
+     else
+         outbuffer = bibCreate(pOutStreamBuffer, streamBufferSize-4-3, &errorCode);
+
+     if (!outbuffer || errorCode)
+     {
+         bibDelete(buffer, &errorCode);
+         return H263D_ERROR;
+     }
+     
+     bufEdit = bibBufferEditCreate(&errorCode);
+     if (!bufEdit || errorCode)
+     {
+         bibDelete(outbuffer, &errorCode);
+         bibDelete(buffer, &errorCode);
+         return H263D_ERROR;
+     }   
+     
+     if(frameOperation==4 /*ENoDecodeNoWrite*/)
+     {
+         bufEdit->copyMode = CopyNone;
+     }
+     
+     if(colorEffect==1 || colorEffect==2)
+     {
+         outbuffer->numBytesRead=0;
+         outbuffer->size=0;
+     }
+     
+   /* Associate bit buffer with the VDE instance */
+     retValue = vdeSetInputBuffer(hInstance, buffer);
+     if (retValue < 0)
+         goto freeBufferAndReturn;
+     
+     /* Associate output bit buffer with the VDE instance */
+     retValue = vdeSetOutputBuffer(hInstance, outbuffer);
+     if (retValue < 0)
+         goto freeBufferAndReturn;
+     
+     retValue = vdeSetBufferEdit(hInstance, bufEdit);
+     if (retValue < 0)
+         goto freeBufferAndReturn;
+     
+     retValue = vdeSetVideoEditParams(hInstance, colorEffect,
+       getDecodedFrame, colorToneU, colorToneV);
+     if (retValue < 0)
+         goto freeBufferAndReturn;
+     
+   /* MVE */
+     if (aDecoderInfo->streamMode == EVedVideoBitstreamModeH263 /*H.263*/)
+     {
+         /* read current TR */
+         bibForwardBits(22,buffer); // streamBufferSize is in bytes
+         tr = bibGetBits(8,buffer,&numBitsGot, &bitsErrorIndication, &bibError);    
+         bibRewindBits(30,buffer,&bibError);
+     }
+
+  /* get first frame's QP */
+  if (!(*fFirstFrame))
+  {
+    vdeinstance->iRefQp = aDecoderInfo->aFirstFrameQp;
+  }
+  vdeinstance->iColorEffect = aDecoderInfo->aColorEffect;
+  vdeinstance->iColorToneU = aDecoderInfo->aColorToneU;
+  vdeinstance->iColorToneV = aDecoderInfo->aColorToneV;
+  
+  /* MVE */
+  /* one frame is ready, initialize the transcoder */
+    TRAP( leaveError, (hTranscoder = CMPEG4Transcoder::NewL(vdeinstance, vdeinstance->inBuffer, vdeinstance->outBuffer)) );
+    if ( leaveError != 0 )
+    {
+        retValue = leaveError;
+        goto freeBufferAndReturn;
+    }
+
+    if (aDecoderInfo->aGetVideoMode)
+    {
+        /* we are to determine the bitstream mode */
+        aDecoderInfo->aOutputVideoFormat = EVedVideoTypeNoVideo;
+        int dummy1, dummy2; // position of the error resillence bit,not used here
+        vdtGetVideoBitstreamInfo(buffer, aDecoderInfo, &dummy1, &dummy2);
+    }
+
+    /* set transcoding information */
+    retValue = hTranscoder->SetTranscoding(aDecoderInfo);
+    if ( retValue != TX_OK )
+    {
+        goto freeBufferAndReturn;
+    }
+    
+    /* before the first frame is decoded, determine the stream type */
+    if (*fFirstFrame) {
+        retValue = vdeDetermineStreamType(hInstance, hTranscoder);
+        if (retValue < 0)
+            goto freeBufferAndReturn;
+        
+    /* MVE */
+        /* for the first frame of the bitstream, we may need to construct a new VOS */
+        hTranscoder->ConstructVOSHeader(vdeinstance->fMPEG4, aDecoderInfo);
+        
+        if (vdeinstance->fMPEG4 == 1 )
+        {
+            StartByteIndex = buffer->getIndex;
+            StartBitIndex  = buffer->bitIndex;
+            
+            /* for MPEG4 (not including shortheader) stuffing bits are inserted at the end of the VOS
+            but the index here indicates the position of the stuffing bits
+            */
+            if (StartBitIndex != 7)
+            {
+                StartByteIndex += 1;
+                StartBitIndex = 7;
+            }
+            
+            // update the output stream size by removing VOS size
+            streamBufferSize -= StartByteIndex; 
+        }
+        
+        else if (aDecoderInfo->streamMode == EVedVideoBitstreamModeMPEG4ShortHeader)
+        {
+            if (aDecoderInfo->aOutputVideoFormat == EVedVideoTypeH263Profile0Level10 ||
+                aDecoderInfo->aOutputVideoFormat == EVedVideoTypeH263Profile0Level45)
+            {
+                // we don't need the VOS header
+                StartByteIndex = buffer->getIndex;
+                StartBitIndex  = buffer->bitIndex;
+                // update the output stream size by removing VOS size
+                streamBufferSize -= StartByteIndex; 
+            }
+            else if (aDecoderInfo->aOutputVideoFormat == EVedVideoTypeMPEG4SimpleProfile &&
+                aDecoderInfo->fModeChanged == EFalse)
+            {
+                // update the output stream size by removing VOS size
+                // but we need the original MPEG4 shortheader VOS, which is not yet copied to the output buffer
+                streamBufferSize -= buffer->getIndex;
+                
+            }
+        }
+        
+    }
+
+    /* This may produce multiple output frames, and that is why it is commented
+     out. However, it may be useful if the bitstream is corrupted and picture
+     start codes are lost
+     while (buffer->bitsLeft > 8) { */
+     /* Decode frame */
+
+  /* MVE */
+  /* The buffer size is changed in h263decoder.cpp
+    In the old version, it is fixed to 3, which may be incorrect 
+    */
+    startCodeLen = (aDecoderInfo->streamMode == EVedVideoBitstreamModeH263)? KH263StartCodeLength : KMPEG4StartCodeLength;
+    
+    
+    
+    if ( ((aDecoderInfo->aOutputVideoFormat == EVedVideoTypeMPEG4SimpleProfile) 
+            && !(aDecoderInfo->streamMode == EVedVideoBitstreamModeMPEG4ShortHeader))
+        || ((aDecoderInfo->streamMode == EVedVideoBitstreamModeMPEG4ShortHeader) && aDecoderInfo->fModeChanged) )
+        {
+        modifyMPEG4Afterwards = ETrue;
+        }
+
+    if (frameOperation==1/*EDecodeAndWrite*/ || frameOperation==2/*EDecodeNoWrite*/)
+        {
+        if ( vdeinstance->fMPEG4 == 1 )
+            {
+            buffer->size -= startCodeLen;
+            buffer->bitsLeft -= ( startCodeLen << 3 );
+            }
+        retValue = vdeDecodeFrame(hInstance, StartByteIndex, StartBitIndex, hTranscoder);
+        if ( retValue < VDE_OK )
+            {
+            // negative means fatal error
+            goto freeBufferAndReturn;
+            }
+         // get first frame QP for possible color toning
+         if (*fFirstFrame)
+         {
+           aDecoderInfo->aFirstFrameQp = hTranscoder->GetRefQP();
+        }
+     }
+     else if (frameOperation==3/*EWriteNoDecode*/) 
+        {
+        /* first reset bit counter to beginning of buffer */
+        /* copy input frame as it is */
+        bibForwardBits((streamBufferSize-startCodeLen)<<3,buffer); // streamBufferSize is in bytes
+         
+        if (aDecoderInfo->streamMode == EVedVideoBitstreamModeMPEG4ShortHeader &&
+            aDecoderInfo->aOutputVideoFormat == EVedVideoTypeMPEG4SimpleProfile &&
+            !(aDecoderInfo->fModeChanged))
+            {
+            bibRewindBits(32,buffer,&bibError);
+            }
+         
+        /* reset buffer edit to CopyWhole mode */
+        bufEdit->copyMode = CopyWhole/*CopyWhole*/;
+         
+        if ( vdeinstance->fMPEG4 == 1 )
+            {
+            if (*fFirstFrame)
+                {
+                buffer->getIndex = buffer->size - startCodeLen;
+                buffer->bitIndex = 7;
+                buffer->bitsLeft = 24;
+                buffer->numBytesRead = buffer->size - startCodeLen;
+                }
+             
+            if ( buffer->numBytesRead > 4 )
+                {
+                buffer->numBytesRead -= 4;
+                buffer->getIndex = buffer->numBytesRead;
+                }
+            }
+         // Reassign pointers so that outbuffer actually has the pointer to (in)buffer's data, 
+         // if we have MPEG4 output (not short header) and we need to change e.g. timestamps
+         // This eliminates 2 memory copies - otherwise we would copy from buffer to outbuffer to tmpbuffer to outbuffer; 
+         // the content is modified when copying from tmpbuffer to outbuffer. 
+         // tmpbuffer is needed since we can't modify the content directly in the outbuffer.
+         // Now we can copy directly from buffer to outbuffer.
+         // In this branch we don't call vdeDecodeFrame at all, but use either CopyEditVopL for MPEG-4 or
+         // CopyStream for H.263
+         if ( modifyMPEG4Afterwards )
+             {
+             tmpbuffer = buffer;
+             }
+         else
+             {
+             /* copy from buffer to outbuffer. This simulates vdeDecodeFrame with EDecodeAndWrite */
+             CopyStream(buffer,outbuffer,bufEdit,StartByteIndex,StartBitIndex);
+             }
+         retValue=0;
+     }
+     
+     outbuffer->size = outbuffer->getIndex;
+     outbuffer->bitsLeft = 0;
+
+     if ( !tmpbuffer )
+        {
+         /* if tr values are changes, need another buffer */
+         /* first create temp buffer in memory */
+         tmpbuf = (u_char*) malloc(outbuffer->size + 4);
+         if (tmpbuf == NULL) 
+         {
+             bibDelete(outbuffer, &errorCode);
+             bibDelete(buffer, &errorCode);
+             bibBufEditDelete(bufEdit, &errorCode);
+             return H263D_ERROR;
+         }
+         tmpbuffer = bibCreate((void*)tmpbuf, outbuffer->size + 4, &errorCode);
+         if (!tmpbuffer || errorCode)
+         {
+            free(tmpbuf);
+            bibDelete(outbuffer, &errorCode);
+            bibDelete(buffer, &errorCode);
+            bibBufEditDelete(bufEdit, &errorCode);
+            return H263D_ERROR;
+         }
+        }
+     
+   /* MVE */
+     if (aDecoderInfo->aOutputVideoFormat != EVedVideoTypeNoVideo)
+        {
+
+        if ( modifyMPEG4Afterwards )
+            {
+            if ( tmpbuffer != buffer )
+                {
+                // the bitstream was decoded too, need to copy it temporarily from outbuffer to tmpbuffer since it needs to be modified
+                bibRewindBits(bibNumberOfFlushedBits(tmpbuffer),tmpbuffer,&bibError);
+                bibRewindBits(bibNumberOfFlushedBits(outbuffer),outbuffer,&bibError);
+                bibForwardBits(((outbuffer->size)<<3),outbuffer);
+                outbuffer->bitsLeft = 0;
+
+                StartByteIndex = 0;
+                StartBitIndex = 7;
+                
+                CopyStream(outbuffer,tmpbuffer,bufEdit,StartByteIndex,StartBitIndex);
+                tmpbuffer->baseAddr[tmpbuffer->getIndex] = 0x0;
+                tmpbuffer->baseAddr[tmpbuffer->getIndex+1] = 0x0;
+                tmpbuffer->baseAddr[tmpbuffer->getIndex+2] = 0x01;
+                tmpbuffer->baseAddr[tmpbuffer->getIndex+3] = 0xb6;
+                }
+             else
+                {
+                // the tmpbuffer was used as a shortcut to the buffer, no need to copy anything here. 
+                tmpbuffer->bitsLeft = 32;
+                // the following ones are probably not needed
+                tmpbuffer->baseAddr[tmpbuffer->getIndex+4] = 0x0;
+                tmpbuffer->baseAddr[tmpbuffer->getIndex+5] = 0x0;
+                tmpbuffer->baseAddr[tmpbuffer->getIndex+6] = 0x01;
+                tmpbuffer->baseAddr[tmpbuffer->getIndex+7] = 0xb6;
+                }
+                
+           
+            bibForwardBits(32,tmpbuffer);
+            
+            // Copy bitstream part-by-part, possibly modifying it, from tmp to output. 
+            // StartByteIndex may be > 0 if there is VOS header in tmpbuffer already. It is always byte-aligned so no need to have StartBitIndex
+            TInt skip = 0;
+            if ( StartByteIndex > 0 )
+                {
+                // startByteIndex refers to input buffer. 
+                // The skip however should refer to the output buffer. The output header size is in aDecoderInfo
+                skip = aDecoderInfo->vosHeaderSize;
+                }
+            int retVal= CopyEditVop(hInstance, skip, tmpbuffer, aDecoderInfo);
+            if(retVal<0)
+                {
+                retValue = retVal;  //will be handled later
+                }
+            }
+        else
+            {
+            /* copy input frame while changing TR */
+            if((videoClipNumber>0) || (smSpeed!=1000))
+                {
+                if ((frameOperation==1) || ((frameOperation==2) && !getDecodedFrame))
+                    {
+                    /* if the output buffer will not be use, leave it as it is! */
+                    }
+                else
+                    {
+
+                    /* get new TR */
+                    StartByteIndex = 0;
+                    StartBitIndex = 7;
+                    outbuffer->bitsLeft = 0;
+                    newtr = GetNewTrValue(tr, trP, trD, smSpeed);
+                    /* change TR value in output bitstream */
+                    /* prepare editing position */
+                    if (!bufEdit->editParams)
+                        {
+                        bufEdit->editParams = (bibEditParams_t *) malloc(sizeof(bibEditParams_t));
+                        if (bufEdit->editParams == NULL)
+                            {
+                            retValue = H263D_ERROR;
+                            goto freeBufferAndReturn;
+                            }
+                        
+                        bufEdit->numChanges=1;
+                        bufEdit->copyMode = CopyWithEdit; // CopyWithEdit
+                        }
+                    bufEdit->editParams->curNumBits = bufEdit->editParams->newNumBits = 8; 
+                    bufEdit->editParams->StartByteIndex=2; //2;     // starting position for the TR marker 
+                    bufEdit->editParams->StartBitIndex=1; //1;          // starting position for the TR marker 
+                    bufEdit->editParams->newValue=newtr; 
+                    /* copy the input buffer to the output buffer with TR changes */
+                    CopyStream(outbuffer,tmpbuffer,bufEdit,StartByteIndex,StartBitIndex);
+                    bibRewindBits((streamBufferSize)<<3,buffer,&bibError);
+                    /* copy the changed bitstream from tmpbuffer back to buffer */
+                    bufEdit->copyMode = CopyWhole; // CopyWhole
+                    bibRewindBits(bibNumberOfFlushedBits(outbuffer),outbuffer,&bibError);
+                    CopyStream(tmpbuffer,outbuffer,bufEdit,StartByteIndex,StartBitIndex);
+                    bibRewindBits((streamBufferSize)<<3,buffer,&bibError);
+                    }
+                }
+            /* update TR values */
+            efftr = (videoClipNumber>0 || smSpeed!=1000) ? newtr : tr; 
+            *trP = efftr;
+            *trD = tr; 
+        }
+    }
+    
+    *fFirstFrame = 0;
+
+    if (retValue < 0)
+        goto freeBufferAndReturn;   
+        /* See the comment above.
+        else if (retValue == H263D_OK_EOS)
+        break;
+   } */
+
+    if (frameSize)
+        *frameSize = bibNumberOfFlushedBytes(buffer) + 
+        ((bibNumberOfFlushedBits(buffer) % 8 > 0) ? 1 : 0);
+
+    *outframeSize = outbuffer->numBytesRead; 
+
+        
+freeBufferAndReturn:
+
+    int bitError = buffer->error;
+
+    if (hTranscoder)
+    {
+        delete hTranscoder;
+        hTranscoder = NULL;
+    }
+     
+    if ( tmpbuffer == buffer )
+        {
+        // tmpbuffer was a shortcut to inbuffer, set it to NULL to avoid deleting it
+        tmpbuffer = NULL;
+        }
+
+    int16 deleteError = 0;
+    /* Delete bit buffer */
+    bibDelete(buffer, &errorCode);
+    if ( errorCode )
+        {
+        deleteError = errorCode;
+        }
+    
+    /* Delete output bit buffer */
+    bibDelete(outbuffer, &errorCode);
+    if ( errorCode )
+        {
+        deleteError = errorCode;
+        }
+
+    /* Delete tmp bit buffer, if it was used */
+    if ( tmpbuffer )
+        {
+        bibDelete(tmpbuffer, &errorCode);
+        if ( errorCode )
+            {
+            deleteError = errorCode;
+            }
+        }
+    if(tmpbuf)
+        free(tmpbuf);
+    
+    /* Delete bufEdit */
+    bibBufEditDelete(bufEdit, &errorCode);
+    if ( errorCode )
+        {
+        deleteError = errorCode;
+        }
+    if (deleteError || errorCode)
+        return H263D_ERROR;
+
+    if ( bitError )
+        {
+        return H263D_OK_BUT_FRAME_USELESS;
+        }
+
+    return retValue;
+}
+
+
+/* {{-output"h263dGetLatestFrame.txt"}} */
+/*
+* h263dGetLatestFrame
+*    
+*
+* Parameters:
+*    hInstance                  instance data
+*    
+*    ppy, ppu, ppv              used to return Y, U and V frame pointers
+*
+*    pLumWidth, pLumHeight      used to return luminance image width and height
+*
+*    pFrameNum                  used to return frame number
+*
+* Function:
+*    This function returns the latest correctly decoded frame
+*    (and some side-information).
+*
+* Returns:
+*    H263D_OK                   if the function was successful
+*    H263D_ERROR                if a fatal error, from which the decoder
+*                               cannot be restored, has occured
+*    H263D_ERROR_HALTED         the instance is halted, it should be closed
+*/
+
+
+int H263D_CC h263dGetLatestFrame(
+                                                                 h263dHInstance_t hInstance,
+                                                                 u_char **ppy, u_char **ppu, u_char **ppv,
+                                                                 int *pLumWidth, int *pLumHeight,
+                                                                 int *pFrameNum)
+                                                                 /* {{-output"h263dGetLatestFrame.txt"}} */
+{
+    vdeAssert(hInstance);
+    vdeAssert(ppy);
+    vdeAssert(ppu);
+    vdeAssert(ppv);
+    vdeAssert(pLumWidth);
+    vdeAssert(pLumHeight);
+    vdeAssert(pFrameNum);
+    
+    return vdeGetLatestFrame(hInstance, ppy, ppu, ppv, pLumWidth, pLumHeight,
+        pFrameNum);
+}
+
+
+
+/* {{-output"h263dIsIntra.txt"}} */
+/*
+* h263dIsIntra
+*    
+*
+* Parameters:
+*    hInstance                  handle of instance data
+*    frameStart                 pointer to memory chunk containing a frame
+*    frameLength                number of bytes in frame
+*
+* Function:
+*    This function returns 1 if the passed frame is an INTRA frame.
+*    Otherwise the function returns 0.
+*
+* Returns:
+*    See above.
+*/
+
+int h263dIsIntra(
+                                 h263dHInstance_t hInstance,
+                                 void *frameStart,
+                                 unsigned frameLength)
+                                 /* {{-output"h263dIsIntra.txt"}} */
+{
+    vdeAssert(hInstance);
+    vdeAssert(frameStart);
+    vdeAssert(frameLength);
+    
+    return vdeIsINTRA(hInstance, frameStart, frameLength);
+}
+
+/* {{-output"h263dOpen.txt"}} */
+/*
+* h263dOpen
+*    
+*
+* Parameters:
+*    openParam                  initialization parameters
+*
+* Function:
+*    This function creates and initializes a new H.263 decoder instance.
+*
+* Returns:
+*    an instance handle if the function was successful
+*    NULL if an error occured
+*/
+
+h263dHInstance_t H263D_CC h263dOpen(h263dOpen_t *openParam)
+/* {{-output"h263dOpen.txt"}} */
+{
+    vdeAssert(openParam);
+    
+    /* No extra space needs to be allocated after the VDE instance data
+    (of type vdeInstance_t) due to the fact that no thread specific
+    data is needed. */
+    openParam->freeSpace = 0;
+    
+    return vdeInit(openParam);
+}
+
+
+
+int GetNewTrValue(int aTrCurOrig, int* aTrPrevNew, int* aTrPrevOrig, int aSMSpeed)
+{
+    int trCurNew=0;
+    int trDiff=0;
+    TReal speedFactor = (TReal)aSMSpeed/1000.0;
+
+    trDiff = aTrCurOrig - *aTrPrevOrig;
+    if(trDiff==0)  // if corrupt TR values
+        trDiff=1;  
+    else if(trDiff<0)  // jump in TR values (change of clip or end of limit)
+        trDiff = 3;    // arbitrary, for 10 fps default
+    // check for slow motion 
+    vdeAssert(aSMSpeed);
+    if(aSMSpeed!=1000)
+        trDiff = (int)((TReal)trDiff/speedFactor + 0.5);
+    trCurNew = *aTrPrevNew + trDiff; 
+    if(trCurNew>255)
+        trCurNew = trCurNew%256;
+    return trCurNew;
+}
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/idctiforepoc.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,641 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Symbian OS -specific IDCT routines.
+*
+*/
+
+
+
+/*
+
+    1  ABSTRACT
+
+
+    1.1 Module Type
+
+    type  subroutine
+
+
+    1.2 Functional Description
+
+    Fixed point arithmetic for fast calculation of IDCT for 8x8 size image
+    blocks. The full calculation of the IDCT takes 208 multiplications and
+    400 additions.
+
+    The routine optionally checks if AC coefficients are all zero and in that
+    case makes a shortcut in IDCT, thus making the calculation faster. This
+    feature is activated by defining CHECK_ZERO_AC_COEFFICIENTS_0,
+    CHECK_ZERO_AC_COEFFICIENTS_1 or CHECK_ZERO_AC_COEFFICIENTS_2 in envdef.h.
+
+
+    1.3 Specification/Design Reference
+
+    The algorithm used is the fast algorithm introduced in W.-H. Chen, C. H.
+    Smith, and S. C. Fralick, "A fast computational algorithm for the
+    Discrete Cosine Transform," IEEE Transactions on Communications, vol.
+    COM-25, pp. 1004-1009, 1977.
+
+    This IDCT routine conforms to the accuracy requirements specified in the
+    H.261 and H.263 recommendations.
+
+    NRC documentation: Moments: H.263 Decoder - Functional Definition
+    Specification
+
+    NRC documentation: Moments: H.263 Decoder - Implementation Design
+    Specification
+
+
+    1.4 Module Test Specification Reference
+
+    TRABANT:h263_test_spec.BASE-TEST
+
+
+    1.5 Compilation Information
+
+        Compiler:      RISC OS ARM C compiler (Acorn Computers Ltd.)
+        Version:       5.05
+        Activation:    cc -DBUILD_TARGET=ACORNDEC idcti.c
+
+
+    1.6 Notes
+
+    This source code can be used in both 16-bit and 32-bit application.
+
+    PREC defines the precision for the fixed point numbers. The best value
+    for it depends on several things: You should always have enough room for
+    the integer part of the number, and in 386s/486s smaller PREC values are
+    faster, but the smaller it is, the poorer is the accuracy.
+
+    The TMPPRECDEC is another adjustable constant. It tells how many bits are
+    ripped off the number for the temporary storage. This way the accuracy
+    for the multiplications can be better. TMPPREC can be zero. This speeds
+    the code up a bit.
+
+    To determine the maximum values for PREC and TMPPRECDEC, count bits you
+    need for the integer part anywhere during the calculation, substract that
+    from 32, and divide the remaining number by two. This number should be
+    >= (2*PREC-TMPPRECDEC)/2, otherwise the results may be corrupted due to
+    lost bits.
+
+    For example, if you know that your data will vary from -2048 - 2047, you
+    need twelve bits for the integer part. 32-12 = 20, 20 / 2 = 10, so good
+    example values for PREC and TMPPRECDEC would be 12 and 4. Also 11 and 2
+    would be legal, as would 11 and 3, but 12 and 3 would not ((2*12-3)/2 =
+    10.5 > 10).
+
+    NOTE: Several PREC and TMPPRECDEC values were tried in order to meet
+    the .
+    The requirements could not be met. PREC = 13, TMPPRECDEC = 5 was 
+    the closest combination to meet the requirements violating only 
+    the overall mean square error requirement.     
+
+    Both the input and output tables are assumed to be normal C ints. Thus,
+    in the 16-bit version they are 16-bit integers and in the 32-bit version
+    32-bit ones.
+
+
+    Define CHECK_ZERO_AC_COEFFICIENTS_0, CHECK_ZERO_AC_COEFFICIENTS_1 and
+    CHECK_ZERO_AC_COEFFICIENTS_2 in envdef.h if zero AC coefficients checking
+    for the whole block, for current row or for current column is desired,
+    respectively.
+        
+
+*/
+
+
+/*  2  CONTENTS
+
+
+        1  ABSTRACT
+
+        2  CONTENTS
+
+        3  GLOSSARY
+
+        4  EXTERNAL RESOURCES
+        4.1  Include Files
+        4.2  External Data Structures
+        4.3  External Function Prototypes
+
+        5  LOCAL CONSTANTS AND MACROS
+
+        6  MODULE DATA STRUCTURES
+        6.1  Local Data Structures
+        6.2  Local Function Prototypes
+
+        7  MODULE CODE
+        7.1  idct
+        7.2  firstPass
+        7.3  secondPass
+
+*/
+
+
+/*  3  GLOSSARY
+
+    IDCT        Inverse discrete cosine transform
+
+*/
+
+
+/*  4  EXTERNAL RESOURCES  */
+
+
+/*  4.1  Include Files  */
+
+#include "h263dconfig.h"
+
+/*  4.2 External Data Structures  */
+
+    /* None */
+
+
+/*  4.3 External Function Prototypes  */
+
+    /* None */
+
+
+/*  5  LOCAL CONSTANTS AND MACROS  */
+
+#define PREC        13      /* Fixed point precision */
+#define TMPPRECDEC  5      /* Temporary precision decrease */
+
+    /* See note about PREC and TMPPRECDEC above. */
+
+#define TMPPREC     ( PREC - TMPPRECDEC )
+#define CDIV        ( 1 << ( 16 - PREC ))
+#define ROUNDER     ( 1 << ( PREC - 1 ))
+
+#define f0  (int32)(0xb504 / CDIV)  /* .7071068 = cos( pi / 4 )         */
+#define f1  (int32)(0x7d8a / CDIV)  /* .4903926 = 0.5 * cos( 7pi / 16 ) */
+#define f2  (int32)(0x7641 / CDIV)  /* .4619398 = 0.5 * cos( 6pi / 16 ) */
+#define f3  (int32)(0x6a6d / CDIV)  /* .4157348 = 0.5 * cos( 5pi / 16 ) */
+#define f4  (int32)(0x5a82 / CDIV)  /* .3535534 = 0.5 * cos( 4pi / 16 ) */
+#define f5  (int32)(0x471c / CDIV)  /* .2777851 = 0.5 * cos( 3pi / 16 ) */
+#define f6  (int32)(0x30fb / CDIV)  /* .1913417 = 0.5 * cos( 2pi / 16 ) */
+#define f7  (int32)(0x18f8 / CDIV)  /* .0975452 = 0.5 * cos(  pi / 16 ) */
+
+#define f0TMP   (int32)(0xb504 / (1 << (16 - TMPPREC)))
+
+
+
+/*  6  MODULE DATA STRUCTURES  */
+
+
+/*  6.1 Local Data Structures  */
+
+#ifdef _WIN32_EXPLICIT  /* EPOC32_PORT  static data */
+
+static const int    idctZigzag[64] =    /* array of zig-zag positioning */
+{  0,  1,  5,  6, 14, 15, 27, 28,       /* of transform coefficients    */
+   2,  4,  7, 13, 16, 26, 29, 42,
+   3,  8, 12, 17, 25, 30, 41, 43,
+   9, 11, 18, 24, 31, 40, 44, 53,
+  10, 19, 23, 32, 39, 45, 52, 54,
+  20, 22, 33, 38, 46, 51, 55, 60,
+  21, 34, 37, 47, 50, 56, 59, 61,
+  35, 36, 48, 49, 57, 58, 62, 63 };
+
+static int32    idctTmpbuf1[64];        /* array for temporary storage of
+                                        transform results */
+#endif
+
+/*  6.2 Local Function Prototypes  */
+
+static void firstPass   (int *buffer,
+                         int32 *tmpbuf);
+
+static void secondPass  (int32 *tmpbuf,
+                         int *dest);
+
+
+
+/*  7 MODULE CODE  */
+
+/*
+=============================================================================
+*/
+
+/*  7.1  */
+
+void idct
+       (int     *block)
+
+    {
+
+
+/*  Functional Description
+
+    Fixed point arithmetic for fast calculation of IDCT for 8x8 size image
+    blocks.
+
+
+    Activation
+
+    by function call
+
+    Reentrancy: no
+
+
+    Inputs
+
+    Parameters:
+
+    *block:         8x8 source block of zigzagged cosine transform
+                    coefficients
+
+    Externals:
+
+    None
+
+
+    Outputs
+
+    Parameters:
+
+    *block:         8x8 destination block of pixel values
+
+    Externals:
+
+    None
+
+    Return Values:
+
+    None
+
+
+    Exceptional Conditions
+
+    None
+
+-----------------------------------------------------------------------------
+*/
+
+
+
+/*  Pseudocode
+
+    Calculate 1D-IDCT by rows.
+    Calculate 1D-IDCT by columns.
+
+*/
+
+
+
+/*  Data Structures  */
+
+
+/* These are only needed if checking the AC coefficients of the whole block
+   is desired. */
+
+    int i = 1;          /* Loop variable */
+    int result;         /* Calculation result */
+
+
+#ifndef _WIN32_EXPLICIT  /* EPOC32_PORT  static data */
+    int32     idctTmpbuf1[64];
+#endif
+
+/*  Code  */
+
+
+    /*
+     *  Check if the AC coefficients of the whole block are all zero.
+     *  In that case the inverse transform is equal to the DC
+     *  coefficient with a scale factor.
+     */
+
+        while (i < 64 && !block[i++]) {}
+        if (i == 64) {
+            int *blk = block;
+            result = (block[0] + 4) >> 3;
+            i = 8;
+            while ( i-- )
+            {
+                blk[0] = result; blk[1] = result; blk[2] = result; blk[3] = result;
+                blk[4] = result; blk[5] = result; blk[6] = result; blk[7] = result;
+                blk += 8;
+            }
+            /*
+            for (i = 0; i < 64; i++)
+            {
+                block[i] = result;
+            }
+            */
+        }
+        else
+        {
+            firstPass(block, idctTmpbuf1);
+            secondPass(idctTmpbuf1, block);
+        }
+
+
+    }
+
+/*
+=============================================================================
+*/
+
+
+
+/*  7.2  */
+
+static void firstPass
+        (int     *buffer,
+         int32   *tmpbuf)
+
+    {
+
+
+/*  Functional Description
+
+    Local function: Calculate 1D-IDCT for the rows of the 8x8 block.
+
+
+    Activation
+
+    by function call
+
+    Reentrancy: no
+
+
+    Inputs
+
+    Parameters:
+
+    *block:         8x8 block of cosine transform coefficients
+
+    Externals:
+
+    None
+
+
+    Outputs
+
+    Parameters:
+
+    *tmpbuf         Temporary storage for the results of the first pass.
+
+    Externals:
+
+    None
+
+    Return Values:
+
+    None
+
+
+    Exceptional Conditions
+
+    None
+
+-----------------------------------------------------------------------------
+*/
+
+
+
+/*  Pseudocode
+
+    Calculate 1D-IDCT by rows.
+
+*/
+
+
+
+/*  Data Structures  */
+
+    int     row;                    /* Loop variable */
+    int32   e, f, g, h;             /* Temporary storage */
+    int32   t0, t1, t2, t3, t5, t6; /* Temporary storage */
+    int32   bd2, bd3;               /* Temporary storage */
+
+#ifndef _WIN32_EXPLICIT  /* EPOC32_PORT  static data */
+    static const int     idctZigzag[64] =
+{  0,  1,  5,  6, 14, 15, 27, 28,
+   2,  4,  7, 13, 16, 26, 29, 42,
+   3,  8, 12, 17, 25, 30, 41, 43,
+   9, 11, 18, 24, 31, 40, 44, 53,
+  10, 19, 23, 32, 39, 45, 52, 54,
+  20, 22, 33, 38, 46, 51, 55, 60,
+  21, 34, 37, 47, 50, 56, 59, 61,
+  35, 36, 48, 49, 57, 58, 62, 63 };
+
+    const int *zz = idctZigzag;
+#else
+    int     *zz = idctZigzag;
+#endif
+
+
+/*  Code  */
+
+#define ZZ(x) ((int32)buffer[zz[x]])
+
+        for( row = 0; row < 8; row++ )
+        {
+
+
+        /*
+         *  Check if the AC coefficients on the current row are all zero.
+         *  In that case the inverse transform is equal to the DC
+         *  coefficient with a scale factor.
+         */
+
+            if ((ZZ(1) | ZZ(2) | ZZ(3) | ZZ(4) | ZZ(5) | ZZ(6) | ZZ(7)) == 0)
+            {
+                tmpbuf[7] =
+                tmpbuf[6] =
+                tmpbuf[5] =
+                tmpbuf[4] =
+                tmpbuf[3] =
+                tmpbuf[2] =
+                tmpbuf[1] =
+                tmpbuf[0] = (ZZ(0) * f4) >> TMPPRECDEC;
+
+                tmpbuf += 8;
+                zz += 8;
+                continue;
+            }
+
+            t0 = t3 = (ZZ(0) + ZZ(4)) * f4;
+            bd3 = ZZ(6) * f6 + ZZ(2) * f2;
+            t0 += bd3;
+            t3 -= bd3;
+
+            t1 = t2 = (ZZ(0) - ZZ(4)) * f4;
+            bd2 = ZZ(2) * f6 - ZZ(6) * f2;
+            t1 += bd2;
+            t2 -= bd2;
+
+            e = h = (ZZ(1) + ZZ(7)) * f7;
+            h += ZZ(1) * ( -f7+f1 );
+            f = g = (ZZ(5) + ZZ(3)) * f3;
+            g += ZZ(5) * ( -f3+f5 );
+
+            tmpbuf[0] = ( t0 + ( h + g )) >> TMPPRECDEC;
+            tmpbuf[7] = ( t0 - ( h + g )) >> TMPPRECDEC;
+
+            f += ZZ(3) * ( -f3-f5 );
+            e += ZZ(7) * ( -f7-f1 );
+
+            tmpbuf[3] = ( t3 + ( e + f )) >> TMPPRECDEC;
+            tmpbuf[4] = ( t3 - ( e + f )) >> TMPPRECDEC;
+
+            t6 = ( h - g + e - f ) * f0TMP >> TMPPREC;
+            t5 = ( h - g - e + f ) * f0TMP >> TMPPREC;
+
+            tmpbuf[1] = ( t1 + t6 ) >> TMPPRECDEC;
+            tmpbuf[6] = ( t1 - t6 ) >> TMPPRECDEC;
+            tmpbuf[2] = ( t2 + t5 ) >> TMPPRECDEC;
+            tmpbuf[5] = ( t2 - t5 ) >> TMPPRECDEC;
+
+            tmpbuf += 8;
+            zz += 8;
+        }
+    }
+
+#undef  ZZ
+
+
+/*
+=============================================================================
+*/
+
+
+
+/*  7.3  */
+
+static void secondPass
+        (int32   *tmpbuf,
+         int     *dest)
+
+    {
+
+
+/*  Functional Description
+
+    Local function: Calculate 1D-IDCT for the columns of the 8x8 block.
+
+
+    Activation
+
+    by function call
+
+    Reentrancy: no
+
+
+    Inputs
+
+    Parameters:
+
+    *tmpbuf         Temporary storage for the results of the first pass.
+
+    Externals:
+
+    None
+
+
+    Outputs
+
+    Parameters:
+
+    *block:         8x8 block of pixel values
+
+    Externals:
+
+    None
+
+    Return Values:
+
+    None
+
+
+    Exceptional Conditions
+
+    None
+
+-----------------------------------------------------------------------------
+*/
+
+
+/*  Pseudocode
+
+    Calculate 1D-IDCT by columns.
+
+*/
+
+
+/*  Data Structures  */
+
+    int     col;                    /* Loop variable */
+    int32   e, f, g, h;             /* Temporary storage */
+    int32   t0, t1, t2, t3, t5, t6; /* Temporary storage */
+    int32   bd2, bd3;               /* Temporary storage */
+
+
+/*  Code  */
+
+#define ZZ(x) tmpbuf[x * 8]
+
+        for( col = 0; col < 8; col++ )
+        {
+
+            t0 = t3 = ((ZZ(0) + ZZ(4)) * f4 ) >> TMPPREC;
+            bd3 = ( ZZ(6) * f6 + ZZ(2) * f2 ) >> TMPPREC;
+            t0 += bd3;
+            t3 -= bd3;
+
+            t1 = t2 = ((ZZ(0) - ZZ(4)) * f4 ) >> TMPPREC;
+            bd2 = ( ZZ(2) * f6 - ZZ(6) * f2 ) >> TMPPREC;
+            t1 += bd2;
+            t2 -= bd2;
+
+            e = h = (ZZ(1) + ZZ(7)) * f7;
+            h += (ZZ(1) * ( -f7+f1 ));
+            h >>= TMPPREC;
+            f = g = (ZZ(5) + ZZ(3)) * f3;
+            g += (ZZ(5) * ( -f3+f5 ));
+            g >>= TMPPREC;
+
+            dest[0*8] = (int) (( t0 + ( h + g ) + ROUNDER ) >> PREC);
+            dest[7*8] = (int) (( t0 - ( h + g ) + ROUNDER ) >> PREC);
+
+            f += ZZ(3) * ( -f3-f5 );
+            f >>= TMPPREC;
+            e += ZZ(7) * ( -f7-f1 );
+            e >>= TMPPREC;
+
+            dest[3*8] = (int) (( t3 + ( e + f ) + ROUNDER ) >> PREC);
+            dest[4*8] = (int) (( t3 - ( e + f ) + ROUNDER ) >> PREC);
+
+            t6 = ( h - g + e - f ) * f0TMP >> TMPPREC;
+            t5 = ( h - g - e + f ) * f0TMP >> TMPPREC;
+
+            dest[1*8] = (int) (( t1 + t6 + ROUNDER ) >> PREC);
+            dest[6*8] = (int) (( t1 - t6 + ROUNDER ) >> PREC);
+            dest[2*8] = (int) (( t2 + t5 + ROUNDER ) >> PREC);
+            dest[5*8] = (int) (( t2 - t5 + ROUNDER ) >> PREC);
+
+            tmpbuf++;
+            dest++;
+        }
+    }
+
+
+/*
+=============================================================================
+*/
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/list.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,627 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* List handling functions.
+*
+*/
+
+
+
+#include "h263dconfig.h"
+#include "list.h"
+
+#ifndef NULL
+   #define NULL 0
+#endif
+
+
+/*
+ * fifoClose
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a FIFO list
+ *
+ * Function:
+ *    This function deinitializes the given FIFO list. Notice that no dynamic
+ *    allocation for the list is done. This function must be called when
+ *    the list is no longer used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int fifoClose(fifo_t *list)
+{
+   list->head = list->tail = NULL;
+   list->numItems = 0;
+
+   return 0;
+}
+
+
+/*
+ * fifoGet
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a FIFO list
+ *    item                       used to return a pointer to the removed
+ *                               list item
+ *
+ * Function:
+ *    This function removes an item from the list. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ *    If there are no items left in the list, NULL will be returned in
+ *    the item parameter.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int fifoGet(fifo_t *list, void **item)
+{
+   if (list->head) {
+      *item = (void *) list->head;
+      list->head = (lstListItem_t *) list->head->next;
+      if (list->head == NULL)
+         list->tail = NULL;
+      list->numItems--;
+   }
+
+   else
+      *item = NULL;
+
+   return 0;
+}
+
+
+/*
+ * fifoOpen
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a FIFO list
+ *
+ * Function:
+ *    This function initializes the given FIFO list. Notice that no dynamic
+ *    allocation for the list is done. This function must be called before
+ *    the list is used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int fifoOpen(fifo_t *list)
+{
+   list->head = list->tail = NULL;
+   list->numItems = 0;
+
+   return 0;
+}
+
+
+/*
+ * fifoPeek
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a FIFO list
+ *    item                       used to return a pointer to the removed
+ *                               list item
+ *
+ * Function:
+ *    This function returns a pointer to the next in the list but does not
+ *    remove the item from the list. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ *    If there are no items left in the list, NULL will be returned in
+ *    the item parameter.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int fifoPeek(fifo_t *list, void **item)
+{
+   if (list->head)
+      *item = (void *) list->head;
+
+   else
+      *item = NULL;
+
+   return 0;
+}
+
+
+/*
+ * fifoPut
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a FIFO list
+ *    item                       an item to add to the list
+ *
+ * Function:
+ *    This function adds an item into the list. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int fifoPut(fifo_t *list, void *item)
+{
+   ((lstListItem_t *) item)->next = NULL;
+
+   if (list->tail) {
+      list->tail->next = item;
+      list->tail = (lstListItem_t *) (item);
+   }
+
+   else
+      list->head = list->tail = (lstListItem_t *) item;
+
+   list->numItems++;
+
+   return 0;
+}
+
+
+/*
+ * lifoClose
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a LIFO list
+ *
+ * Function:
+ *    This function deinitializes the given LIFO list. Notice that no dynamic
+ *    allocation for the list is done. This function must be called when
+ *    the list is no longer used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lifoClose(lifo_t *list)
+{
+   list->head = NULL;
+
+   return 0;
+}
+
+
+/*
+ * lifoGet
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a LIFO list
+ *    item                       used to return a pointer to the removed
+ *                               list item
+ *
+ * Function:
+ *    This function removes an item from the list. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ *    If there are no items left in the list, NULL will be returned in
+ *    the item parameter.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lifoGet(lifo_t *list, void **item)
+{
+   if (list->head) {
+      *item = list->head;
+      list->head = (lstListItem_t *) list->head->next;
+   }
+   else
+      *item = NULL;
+
+   return 0;
+}
+
+
+/*
+ * lifoOpen
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a LIFO list
+ *
+ * Function:
+ *    This function initializes the given LIFO list. Notice that no dynamic
+ *    allocation for the list is done. This function must be called before
+ *    the list is used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lifoOpen(lifo_t *list)
+{
+   list->head = NULL;
+
+   return 0;
+}
+
+
+/*
+ * lifoPut
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a LIFO list
+ *    item                       an item to add to the list
+ *
+ * Function:
+ *    This function adds an item into the list. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lifoPut(lifo_t *list, void *item)
+{
+   ((lstListItem_t *) item)->next = list->head;
+   list->head = (lstListItem_t *) item;
+
+   return 0;
+}
+
+
+/*
+ * lstClose
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a list
+ *
+ * Function:
+ *    This function deinitializes the given list. Notice that no dynamic
+ *    allocation for the list is done. This function must be called when
+ *    the list is no longer used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lstClose(lst_t *list)
+{
+   list->head = list->prev = list->curr = NULL;
+   list->numItems = 0;
+
+   return 0;
+}
+
+
+/*
+ * lstRemove
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a lst list
+ *    item                       used to return a pointer to the removed
+ *                               list item
+ *
+ * Function:
+ *    This function removes an item from the list. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ *    If there are no items left in the list, NULL will be returned in
+ *    the item parameter.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lstRemove(lst_t *list, void **item)
+{
+   if (list->curr) {
+      *item = (void *) list->curr;
+      if (list->prev)
+         list->prev->next = list->curr->next;
+      else
+         list->head = (lstListItem_t *) (list->curr->next);
+      list->curr = (lstListItem_t *) (list->curr->next);
+      ((lstListItem_t *) *item)->next = NULL;
+      list->numItems--;
+   }
+
+   else
+      *item = NULL;
+
+   return 0;
+}
+
+
+/*
+ * lstOpen
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a list
+ *
+ * Function:
+ *    This function initializes the given list. Notice that no dynamic
+ *    allocation for the list is done. This function must be called before
+ *    the list is used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lstOpen(lst_t *list)
+{
+   list->head = list->prev = list->curr = NULL;
+   list->numItems = 0;
+
+   return 0;
+}
+
+
+/*
+ * lstHead
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a lst list
+ *    item                       used to return a pointer to the head item
+ *                               of the list
+ *
+ * Function:
+ *    This function sets the current access point to the head of the list and
+ *    returns a pointer to the head item. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ *    If there are no items left in the list, NULL will be returned in
+ *    the item parameter.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lstHead(lst_t *list, void **item)
+{
+   if (list->head)
+      *item = (void *) list->head;
+
+   else
+      *item = NULL;
+
+   list->curr = list->head;
+   list->prev = NULL;
+
+   return 0;
+}
+
+
+/*
+ * lstEnd
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a lst list
+ *
+ * Function:
+ *    This function sets the current access point to the tail of the list
+ *    enabling the item addition to the end of the list.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lstEnd(lst_t *list)
+{
+   while (list->curr) {
+      list->prev = list->curr;
+      list->curr = (lstListItem_t *) (list->curr->next);
+   }
+
+   return 0;
+}
+
+
+/*
+ * lstTail
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a lst list
+ *
+ * Function:
+ *    This function sets the current access point to the tail of the list
+ *    enabling the item addition to the end of the list.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lstTail(lst_t *list, void **item)
+{
+   if (!list->curr) {
+      list->curr = list->head;
+      list->prev = NULL;
+   }
+
+   if (!list->curr) {
+      *item = NULL;
+      return 0;
+   }
+
+   while (list->curr->next) {
+      list->prev = list->curr;
+      list->curr = (lstListItem_t *) (list->curr->next);
+   }
+
+   *item = list->curr;
+   return 0;
+}
+
+
+/*
+ * lstCurr
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a lst list
+ *    item                       used to return a pointer to the current item
+ *                               of the list
+ *
+ * Function:
+ *    This returns a pointer to the current item of the list. 
+ *    Notice that no copying of contents of the given item is done, 
+ *    i.e. only the pointer to the item is used.
+ *
+ *    If there are no items left in the list, NULL will be returned in
+ *    the item parameter.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lstCurr(lst_t *list, void **item)
+{
+   *item = list->curr;
+   return 0;
+}
+
+
+/*
+ * lstNext
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a lst list
+ *    item                       used to return a pointer to the next item
+ *                               of the list
+ *
+ * Function:
+ *    This function sets the current access point to the next item of the list
+ *    and returns a pointer to the item. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ *    If there are no items left in the list, NULL will be returned in
+ *    the item parameter.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lstNext(lst_t *list, void **item)
+{
+   if (list->curr) {
+      list->prev = list->curr;
+      list->curr = (lstListItem_t *) (list->curr->next);
+      *item = (void *) list->curr;
+   }
+
+   else
+      *item = NULL;
+
+   return 0;
+}
+
+
+int lstNextExists(lst_t *list)
+{
+   return (list->curr && list->curr->next) ? 1 : 0;
+}
+
+/*
+ * lstAdd
+ *    
+ *
+ * Parameters:
+ *    list                       a pointer to a lst list
+ *    item                       an item to add to the list
+ *
+ * Function:
+ *    This function adds an item into the list. Notice that no copying of
+ *    contents of the given item is done, i.e. only the pointer to the item
+ *    is used.
+ *
+ * Returns:
+ *    >= 0 if the function was successful
+ *    < 0  indicating an error
+ *
+ */
+
+int lstAdd(lst_t *list, void *item)
+{
+   ((lstListItem_t *) item)->next = list->curr;
+
+   if (list->prev)
+      list->prev->next = item;
+
+   else
+      list->head = (lstListItem_t *) item;
+
+   list->curr = (lstListItem_t *) item;
+
+   list->numItems++;
+
+   return 0;
+}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/rendri.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,409 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Renderer Draw Item Interface.
+*
+*/
+
+
+
+#include "h263dconfig.h"
+#include "rendri.h"
+#include "debug.h"
+
+
+/*
+ * Preprocessor definitions
+ */
+
+
+#define renDriMalloc malloc
+#define renDriCalloc calloc
+#define renDriRealloc realloc
+#define renDriDealloc free
+
+#ifndef renAssert
+   #ifndef assert
+      #include <assert.h>
+   #endif
+   #define renAssert(exp) assert(exp)
+#endif
+
+
+/*
+ * Local function prototypes
+ */
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"renDriAlloc.txt"}} */
+/*
+ * renDriAlloc
+ *    
+ *
+ * Parameters:
+ *    width                      luminance image width in pixels
+ *    height                     luminance image height in pixels
+ *
+ * Function:
+ *    This function creates and initializes a new draw item.
+ *
+ *    When passed to the renderer the following members of the draw item
+ *    must be explicitly set (i.e. these members are not set by this 
+ *    function):
+ *       drawItem->param.dwFlags
+ *       drawItem->param.lTime
+ *       drawItem->extParam.flags
+ *       drawItem->extParam.rate
+ *       drawItem->extParam.scale
+ *       drawItem->extParam.numOfCodedMBs
+ *       drawItem->extParam.snapshotRect
+ *       drawItem->extParam.ckInfo
+ *       drawItem->retFrame
+ *       drawItem->retFrameParam
+ *
+ * Returns:
+ *    a pointer to the created 
+ *    draw item                  if the function was successful
+ *    NULL                       indicating a general error
+ *
+ *    
+ */
+
+renDrawItem_t * renDriAlloc(int width, int height, int fYuvNeeded)
+/* {{-output"renDriAlloc.txt"}} */
+{
+   renDrawItem_t *drawItem;
+   renBitmapInfoHeader_t *bmi;
+   void *data;
+
+   /* Allocate draw item */
+   drawItem = (renDrawItem_t *) renDriMalloc(sizeof(renDrawItem_t));
+   if (drawItem == NULL)
+      return NULL;
+   memset(drawItem, 0, sizeof(renDrawItem_t));
+
+   /* Allocate bitmap info header */
+   bmi = (renBitmapInfoHeader_t *) renDriMalloc(sizeof(renBitmapInfoHeader_t));
+   if (bmi == NULL) {
+      renDriDealloc(drawItem);
+      return NULL;
+   }
+
+   /* Initialize bitmap info header */
+   bmi->biSize = sizeof(renBitmapInfoHeader_t);
+   bmi->biWidth = width;
+   bmi->biHeight = height;
+   if ( fYuvNeeded )
+    {
+       bmi->biSizeImage = (u_int32) width * (u_int32) height * 3 / 2;
+       /* Allocate room for frame data */
+       data = renDriMalloc(bmi->biSizeImage);
+       if (data == NULL) {   
+          renDriDealloc(bmi);
+          renDriDealloc(drawItem);
+          return NULL;
+       }
+    }
+   else
+    {
+        bmi->biSizeImage = 0;
+        data = NULL;
+    }
+
+
+   /* Initialize renDrawParam_t member of draw item */
+   /* dwFlags set by application */
+   drawItem->param.lpFormat = bmi;
+   drawItem->param.lpData = data;
+   drawItem->param.cbData = bmi->biSizeImage;
+   /* lTime set by application */
+
+   drawItem->extParam.size = sizeof(renExtDrawParam_t);
+   /* flags set by application */
+   /* rate set by application */
+   /* scale set by application */
+   drawItem->extParam.numOfMBs = (width / 16) * (height / 16);
+   /* numOfCodedMBs set by application */
+   drawItem->extParam.fCodedMBs = (u_char *) renDriMalloc(
+      drawItem->extParam.numOfMBs * sizeof(u_char));
+   if (drawItem->extParam.fCodedMBs == NULL) {
+      renDriDealloc(data);
+      renDriDealloc(bmi);
+      renDriDealloc(drawItem);
+      return NULL;
+   }
+   /* snapshotRect set by application */
+   /* ckInfo set by application */
+
+   /* retFrame and retFrameParam members of draw item are set by application */
+
+   return drawItem;
+}
+
+
+/* {{-output"renDriCopyParameters.txt"}} */
+/*
+ * renDriCopyParameters
+ *    
+ *
+ * Parameters:
+ *    dstDrawItem                destination draw item
+ *    srcDrawItem                source draw item
+ *
+ * Function:
+ *    This function copies the srcDrawItem structure to the dstDrawItem 
+ *    structure. All other parameters are copied but the actual picture 
+ *    contents. The function handles nested structures correctly.
+ *    No pointers are overwritten but rather the contents corresponding
+ *    to a pointer are copied from the source to the destionation structure.
+ *
+ * Returns:
+ *    Nothing
+ *
+ *    
+ */
+
+void renDriCopyParameters(
+   renDrawItem_t *dstDrawItem, 
+   const renDrawItem_t *srcDrawItem)
+/* {{-output"renDriCopyParameters.txt"}} */
+{
+   /* param */
+   {
+      renDrawParam_t *dstDrawParam = &(dstDrawItem->param);
+      const renDrawParam_t *srcDrawParam = &(srcDrawItem->param);
+
+      /* dwFlags */
+      dstDrawParam->dwFlags = srcDrawParam->dwFlags;
+
+      /* lpFormat */
+      {
+         const renBitmapInfoHeader_t *srcBitmapInfoHeader = 
+            (renBitmapInfoHeader_t *) srcDrawParam->lpFormat;
+
+         /* biSize indicates the size of the bitmap info header.
+            Thus, copy biSize bytes from source to destination bitmap info
+            header. 
+            Note: it is assumed that biSize (and the amount of allocated
+            memory) is the same in both structures. */
+         MEMCPY(
+            dstDrawParam->lpFormat,
+            srcDrawParam->lpFormat,
+            (TInt)srcBitmapInfoHeader->biSize);
+      }
+
+      /* lpData */
+      /* Not copied since contains a pointer to actual picture contents.
+         Set to NULL for clarity. */
+
+      /* cbData */
+      dstDrawParam->cbData = srcDrawParam->cbData;
+
+      /* lTime */
+      dstDrawParam->lTime = srcDrawParam->lTime;
+   }
+
+   /* extParam */
+   {
+      renExtDrawParam_t *dstExtDrawParam = &(dstDrawItem->extParam);
+      const renExtDrawParam_t *srcExtDrawParam = &(srcDrawItem->extParam);
+      u_char *dstFCodedMBs = dstExtDrawParam->fCodedMBs;
+
+      /* fCodedMBs is the only pointer in the structure. Thus, it is easier
+         to temporally save the destionation fCodedMBs, then overwrite each
+         member of the destination structure by corresponding member of
+         the source structure and finally restore fCodedMBs in the destination
+         structure. */
+
+      /* "size" member indicates the size of the structure.
+         Thus, copy size bytes from source to destination structure.
+         Note: it is assumed that size (and the amount of allocated
+         memory) is the same in both structures. */
+      MEMCPY(
+         (void *) dstExtDrawParam,
+         (void *) srcExtDrawParam,
+         (TInt)srcExtDrawParam->size);
+
+      /* Restore destination fCodedMBs. */
+      dstExtDrawParam->fCodedMBs = dstFCodedMBs;
+
+      /* Copy coded MBs array */
+      MEMCPY(
+         (void *) dstFCodedMBs,
+         (void *) srcExtDrawParam->fCodedMBs,
+         (TInt)srcExtDrawParam->numOfMBs);
+   }
+
+}
+
+/* {{-output"renDriCopyFrameData.txt"}} */
+/*
+ * renDriCopyFrameData
+ *
+ * Parameters:
+ *    dstDrawItem                destination draw item
+ *    srcDrawItem                source draw item
+ *
+ * Function:
+ *    This function copies the actual picture data contents from srcDrawItem 
+ *    structure to the dstDrawItem structure. No pointers are overwritten 
+ *    but rather the contents corresponding to a pointer are copied from 
+ *    the source to the destination structure.
+ *
+ * Returns:
+ *    Nothing
+ *
+ */
+
+void renDriCopyFrameData(
+   renDrawItem_t *dstDrawItem, 
+   const renDrawItem_t *srcDrawItem) 
+/* {{-output"renDriCopyFrameData.txt"}} */
+{
+
+   renDrawParam_t *dstDrawParam = &(dstDrawItem->param);
+   const renDrawParam_t *srcDrawParam = &(srcDrawItem->param);
+   const renBitmapInfoHeader_t *srcBitmapInfoHeader = 
+      (renBitmapInfoHeader_t *) srcDrawParam->lpFormat;
+
+   /* biSizeImage indicates the size of the image data in bytes.
+      Copy biSizeImage bytes from source to destination frame data.
+      Note: it is assumed that size (and the amount of allocated
+            memory) is the same in both structures. */
+
+   renAssert(((renBitmapInfoHeader_t *) dstDrawParam->lpFormat)->biSizeImage == srcBitmapInfoHeader->biSizeImage);
+
+   MEMCPY(dstDrawParam->lpData,
+          srcDrawParam->lpData,
+          (TInt)srcBitmapInfoHeader->biSizeImage);  
+
+}
+
+/* {{-output"renDriFree.txt"}} */
+/*
+ * renDriFree
+ *    
+ *
+ * Parameters:
+ *    drawItem                   a pointer to the draw item to free
+ *
+ * Function:
+ *    This function destroys the passed draw item.
+ *
+ * Returns:
+ *    Nothing.
+ *
+ *    
+ */
+
+void renDriFree(renDrawItem_t *drawItem)
+/* {{-output"renDriFree.txt"}} */
+{
+   renDrawParam_t *param;
+   renExtDrawParam_t *extParam;
+
+   if (!drawItem)
+      return;
+
+   param = &drawItem->param;
+   extParam = &drawItem->extParam;
+
+   if (param) {
+      if (param->lpFormat)
+         renDriDealloc(param->lpFormat);
+      if (param->lpData)
+         renDriDealloc(param->lpData);
+   }
+
+   if (extParam) {
+      if (extParam->fCodedMBs)
+         renDriDealloc(extParam->fCodedMBs);
+   }
+
+   renDriDealloc(drawItem);
+}
+
+
+
+
+
+/* {{-output"renDriYUV.txt"}} */
+/*
+ * renDriYUV
+ *    
+ *
+ * Parameters:
+ *    drawItem                   a pointer to a draw item
+ *    y, u, v                    top-left corners of the Y, U and V frames
+ *                               corresponding to the passed draw item
+ *    width, height              the dimensions of the luminance frame of 
+ *                               the passed draw item
+ *
+ * Function:
+ *    This function returns the Y, U and V pointers to the passed draw item
+ *    as well as the dimensions of the luminance frame of the draw item.
+ *
+ * Returns:
+ *    REN_OK                     if the function was successful
+ *    REN_ERROR                  indicating a general error
+ *
+ */
+
+int renDriYUV(renDrawItem_t *drawItem,
+   u_char **y, u_char **u, u_char **v, int *width, int *height)
+/* {{-output"renDriYUV.txt"}} */
+{
+   renBitmapInfoHeader_t *bmi;
+   int32 ySize, uvSize;
+   
+   /* If invalid arguments */
+   if (!drawItem || !drawItem->param.lpFormat || 
+      !y || !u || !v || !width || !height) {
+      /* Return error */
+      debPrintf("renGetYUVFromDrawParam: ERROR - null pointer.\n");
+      return REN_ERROR;
+   }
+
+
+   bmi = (renBitmapInfoHeader_t *) drawItem->param.lpFormat;
+
+   *width = bmi->biWidth;
+   *height = labs(bmi->biHeight);
+
+   if ( drawItem->param.lpData == NULL )
+    {
+        // no YUV buffer, parsing-only instance
+        *y = NULL,
+        *u = NULL;
+        *v = NULL;
+        
+        return REN_OK;
+    }
+
+   ySize = (*width) * (*height) * sizeof(u_char);
+   uvSize = ySize / 4;
+
+   *y = (u_char *) drawItem->param.lpData;
+   *u = *y + ySize;
+   *v = *u + uvSize;
+
+   return REN_OK;
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/sync.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,311 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* H.263 sync code functions.
+*
+*/
+
+
+
+
+#include "h263dConfig.h"
+
+#include "sync.h"
+#include "errcodes.h"
+#include "debug.h"
+#include "biblin.h"
+
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"sncCheckSync.txt"}} */
+/*
+ * sncCheckSync
+ *    
+ *
+ * Parameters:
+ *    buffer                     a pointer to a bit buffer structure
+ *    numStuffBits               the number of stuffing bits
+ *    error                      error code
+ *
+ * Function:
+ *    This function checks if the Picture Start Code (PSC),
+ *    the End Of Sequence code (EOS) or the GOB synchronization code (GBSC)
+ *    are the next codes in the bit buffer.
+ *    Stuffing (PSTUF, ESTUF or GSTUF) is allowed before the code and
+ *    the number of stuffing bits is returned in numStuffBits parameter.
+ *    The code is not flushed from the buffer.
+ *
+ * Returns:
+ *    SNC_NO_SYNC                if no sync code is found
+ *    SNC_PSC                    if PSC is found
+ *    SNC_GBSC                   if GBSC is found
+ *    SNC_EOS                    if EOS is found
+ *    SNC_STUFFING               if there are less than 8 zeros starting from 
+ *                               the current position and after 
+ *                               them the buffer ends
+ *
+ * Error codes:
+ *    Error codes returned by bibFlushBits/bibGetBits/bibShowBits.
+ *
+ */
+
+int sncCheckSync(bibBuffer_t *buffer, int *numStuffBits, int16 *error)
+/* {{-output"sncCheckSync.txt"}} */
+{
+   u_int32 result;
+   int numBitsGot, i;
+   int16 newError = 0;
+   int bitErrorIndication = 0;
+
+   for(i = 0; i < 8; i++) {
+      bitErrorIndication = 0;
+      result = bibShowBits(i + 22, buffer, &numBitsGot, &bitErrorIndication, 
+         &newError);
+      if (result == 32) {
+         /* PSC */
+         *numStuffBits = i;
+         return SNC_PSC;
+      }
+
+      else if (result == 63) {
+        /* EOS */
+        *numStuffBits = i;
+        return SNC_EOS;
+      }
+
+      else if (result > 32 && result < 63) {
+         /* GBSC */
+         /* Notice that the allowed Group Numbers are listed in section 5.2.3
+            of the H.263 recommendation. They are not checked here but rather
+            they are assumed to be checked in the corresponding header reading
+            function, e.g. vdxGetGOBHeader. */
+         *numStuffBits = i;
+         return SNC_GBSC;
+      }
+
+      else if (result >= 64) {
+         return SNC_NO_SYNC;
+      }
+      else if ( buffer->error )
+          {
+          // out of bits
+          *error = (int16)buffer->error;
+          return SNC_NO_SYNC;
+          }
+   }
+
+   return SNC_NO_SYNC;
+}
+
+
+/* {{-output"sncRewindAndSeekNewSync.txt"}} */
+/*
+ * sncRewindAndSeekNewSync
+ *    
+ *
+ * Parameters:
+ *    earliestBitPos             location of previously found sync code
+ *                               so no sense to rewind over it
+ *    buffer                     a pointer to a bit buffer structure
+ *    error                      error code
+ *
+ * Function:
+ *    This function is intended to be called after GOB header is corrupted.
+ *    It rewinds some (already read) bits in order not to miss any sync code.
+ *    Then, this function finds the next Picture Start Code (PSC),
+ *    End Of Sequence code (EOS) or Group of Blocks Start Code (GBSC)
+ *    The function discards the bits before the synchronization code 
+ *    but does not remove the found code from the buffer.
+ *
+ * Returns:
+ *    SNC_NO_SYNC                if no PSC, EOS either GBSC was found and 
+ *                               no more bits are available
+ *    SNC_PSC                    if PSC is found
+ *    SNC_GBSC                   if GBSC is found
+ *    SNC_EOS                    if EOS is found
+ *
+ * Error codes:
+ *    Error codes returned by bibFlushBits/bibGetBits/bibShowBits.
+ *
+ */
+
+int sncRewindAndSeekNewSync(u_int32 earliestBitPos, bibBuffer_t *buffer, 
+   int16 *error)
+/* {{-output"sncRewindAndSeekNewSync.txt"}} */
+{
+   int sncCode;                     /* found sync code */
+   u_int32 numRewindableBits;       /* number of bits which can be rewinded */
+   u_int32 bitPosBeforeRewinding;   /* initial buffer bit index */
+   u_int32 numBitsToRewind;         /* number of bits to rewind before seeking the sync code */
+
+   *error = 0;
+
+   bitPosBeforeRewinding = bibNumberOfFlushedBits(buffer);
+
+   if ( bitPosBeforeRewinding > earliestBitPos+17 ) {
+      numBitsToRewind = bitPosBeforeRewinding - earliestBitPos - 17; 
+      /* 17 is the sync code length, and one sync code exists in earliestBitPos => do not read it again */
+   }
+   else if ( bitPosBeforeRewinding > earliestBitPos ) {
+      /* This might be possible in slice mode */
+      numBitsToRewind = bitPosBeforeRewinding - earliestBitPos; 
+   }
+   else {
+      /* Bit counter overrun? */
+      numBitsToRewind = bitPosBeforeRewinding + (0xffffffff - earliestBitPos) - 17; 
+   }
+   numRewindableBits = bibNumberOfRewBits(buffer);
+
+   if (numRewindableBits < (u_int32) numBitsToRewind)
+      numBitsToRewind = (int) numRewindableBits;
+
+   bibRewindBits(numBitsToRewind, buffer, error);
+   if (*error)
+      return SNC_NO_SYNC;
+
+   /* Seek the next synchronization code */
+   sncCode = sncSeekSync(buffer, error);
+   if (*error)
+      return sncCode;
+
+   return sncCode;
+}
+
+
+/* {{-output"sncSeekFrameSync.txt"}} */
+/*
+ * sncSeekFrameSync
+ *    
+ *
+ * Parameters:
+ *    buffer                     a pointer to a bit buffer structure
+ *    error                      error code
+ *
+ * Function:
+ *    This function finds the next Picture Start Code (PSC) or
+ *    End Of Sequence code (EOS) from the bit buffer. The function skips
+ *    any other codes. It discards the bits before the found synchronization
+ *    code but does not remove the found code from the buffer.
+ *
+ * Returns:
+ *    SNC_NO_SYNC                if no PSC or EOS was found and 
+ *                               no more bits are available
+ *    SNC_PSC                    if PSC is found
+ *    SNC_EOS                    if EOS is found
+ *
+ * Error codes:
+ *    Error codes returned by bibFlushBits/bibGetBits/bibShowBits.
+ *
+ */
+
+int sncSeekFrameSync(bibBuffer_t *buffer, int16 *error)
+/* {{-output"sncSeekFrameSync.txt"}} */
+{
+   int numBitsGot, syncCode, bitErrorIndication = 0;
+   int16 newError = 0;
+
+   for (;;) {
+      syncCode = sncSeekSync(buffer, &newError);
+
+      if (newError) {
+         *error = newError;
+         return SNC_NO_SYNC;
+      }
+
+      if (syncCode == SNC_GBSC) {
+         bibFlushBits(17, buffer, &numBitsGot, &bitErrorIndication, &newError);
+      }
+
+      else
+         return syncCode;
+   }
+}
+
+
+/* {{-output"sncSeekSync.txt"}} */
+/*
+ * sncSeekSync
+ *    
+ *
+ * Parameters:
+ *    buffer                     a pointer to a bit buffer structure
+ *    error                      error code
+ *
+ * Function:
+ *    This function finds the next Picture Start Code (PSC),
+ *    End Of Sequence code (EOS) or Group of Blocks Start Code (GBSC)
+ *    from the bit buffer. It discards the bits before the synchronization
+ *    code but does not remove the found code from the buffer.
+ *
+ * Returns:
+ *    SNC_NO_SYNC                if no PSC, EOS either GBSC was found and 
+ *                               no more bits are available
+ *    SNC_PSC                    if PSC is found
+ *    SNC_GBSC                   if GBSC is found
+ *    SNC_EOS                    if EOS is found
+ *
+ * Error codes:
+ *    Error codes returned by bibFlushBits/bibGetBits/bibShowBits.
+ *
+ */
+
+int sncSeekSync(bibBuffer_t *buffer, int16 *error)
+/* {{-output"sncSeekSync.txt"}} */
+{
+   u_int32 result;
+   int numBitsGot;
+   int16 newError = 0;
+   int bitErrorIndication = 0;
+
+   for (;;) {
+      bitErrorIndication = 0;
+      result = bibShowBits(22, buffer, &numBitsGot, &bitErrorIndication, 
+         &newError);
+
+
+      if (result == 32) {
+         /* PSC */
+         return SNC_PSC;
+      }
+
+      else if (result == 63) {
+            /* EOS */
+            return SNC_EOS;
+      }
+
+      else if (result > 32 && result < 63) {
+         /* GBSC */
+         /* Notice that the allowed Group Numbers are listed in section 5.2.3
+            of the H.263 recommendation. They are not checked here but rather
+            they are assumed to be checked in the corresponding header reading
+            function, e.g. vdxGetGOBHeader. */
+         return SNC_GBSC;
+      }
+      else if ( buffer->error )
+          {
+          // out of bits
+          *error = (int16)buffer->error;
+          return SNC_NO_SYNC;
+          }
+
+      bibFlushBits(1, buffer, &numBitsGot, &bitErrorIndication, error);
+   }
+}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/sync_mpeg.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,648 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* MPEG-4 sync code functions.
+*
+*/
+
+
+#include "h263dConfig.h"
+
+#include "sync.h"
+#include "errcodes.h"
+#include "debug.h"
+#include "mpegcons.h"
+#include "biblin.h"
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"sncCheckMpegVOP.txt"}} */
+/*
+ *
+ * sncCheckMpegVOP
+ *
+ * Parameters:
+ *    buffer                     a pointer to a bit buffer structure
+ *    error                      error code
+ *
+ * Function:
+ *    This function checks if the GOV, VOP start codes
+ *    are the next codes in the bit buffer.
+ *    NO stuffing is allowed before the code, the routine checks from the
+ *    current position in the buffer-
+ *    The code is not flushed from the buffer.
+ *
+ * Returns:
+ *    SNC_NO_SYNC                if no sync code is found
+ *    SNC_PSC                    if GOV or VOP start code is found
+ *
+ * Error codes:
+ *    Error codes returned by bibFlushBits/bibGetBits/bibShowBits.
+ *
+ *    
+ *    
+ */
+
+int sncCheckMpegVOP(bibBuffer_t *buffer, int16 *error)
+/* {{-output"sncCheckMpegVOP.txt"}} */
+{
+   u_int32 bits;
+   int16 newError = 0;
+   int numBitsGot, bitErrorIndication = 0;
+
+   bits = bibShowBits(32, buffer, &numBitsGot, &bitErrorIndication, &newError);
+   
+   if ((newError == ERR_BIB_NOT_ENOUGH_DATA) && (numBitsGot > 0 )) {
+       /* Still bits in the buffer */
+       deb("sncCheckSync: bibShowReturned not enough data but there are "
+           "still bits in the buffer --> error cleared.\n");
+       return SNC_NO_SYNC;
+   } else if (newError) {
+       *error = newError;
+       return SNC_NO_SYNC;
+   }
+
+   if (bits == MP4_GROUP_START_CODE || bits == MP4_VOP_START_CODE || bits == MP4_EOB_CODE)
+        return SNC_PSC;
+   else 
+        return SNC_NO_SYNC;
+}
+
+/* {{-output"sncCheckMpegSync.txt"}} */
+/*
+ *
+ * sncCheckMpegSync
+ *
+ * Parameters:
+ *    buffer                     a pointer to a bit buffer structure
+ *    f_code                     f_code of the last P-vop
+ *    error                      error code
+ *
+ * Function:
+ *    This function checks if the GOV, VOP or Video Pcaket start codes
+ *    are the next codes in the bit buffer.
+ *    Stuffing is needed before the code and the number of stuffing bits
+ *    is returned in numStuffBits parameter.
+ *    The code is not flushed from the buffer.
+ *
+ * Returns:
+ *    SNC_NO_SYNC                if no sync code is found
+ *    SNC_GOV                    if GOV start code is found
+ *    SNC_VOP                    if VOP start code is found
+ *    SNC_VOS                    if VOS start code is found
+ *    SNC_VIDPACK                if Video Packet start code is found
+ *    SNC_STUFFING               if there is a bit with the value zero 
+ *                               followed by less than 7 bits with the 
+ *                               value one starting from the current position 
+ *                               and after them the buffer (picture segment) ends
+ *
+ * Error codes:
+ *    Error codes returned by bibFlushBits/bibGetBits/bibShowBits.
+ *
+ *    
+ *    
+ *    
+ *    
+ *    
+ */
+
+int sncCheckMpegSync(bibBuffer_t *buffer, int f_code, int16 *error)
+/* {{-output"sncCheckMpegSync.txt"}} */
+{
+   u_int32 result, bits, start_code_val;
+   int numBitsGot, i, shift_bits;
+   int16 newError = 0;
+   int bitErrorIndication = 0;
+
+   shift_bits = 32-(16+f_code);
+
+   bits = bibShowBits(32, buffer, &numBitsGot, &bitErrorIndication, &newError);
+   
+   if ( buffer->error )
+      {
+      // out of bits
+      *error = (int16)buffer->error;
+      return SNC_NO_SYNC;
+      }
+
+
+   for(i = 0; i <= 8; i++) {
+
+       /* if stuffing is correct */
+       if ( (i==0) || ((bits >> (32-i)) == (u_int32) ((1 << (i-1))-1)) ) {
+
+           result = bits << i;
+
+           if ((result >> 8) == 1) {
+
+               /* Stuff start code */
+               if (i != 0) {
+                   bibFlushBits(i, buffer, &numBitsGot, &bitErrorIndication, &newError);
+                   if (newError) {
+                       *error = newError;
+                       return SNC_NO_SYNC;
+                   }
+               }
+
+               /* Check start code */
+               start_code_val = 
+                   bibShowBits(32, buffer, &numBitsGot, &bitErrorIndication, &newError);
+               if ((newError == ERR_BIB_NOT_ENOUGH_DATA) && (numBitsGot > 0 )) {
+                       /* Still bits in the buffer */
+                       deb("sncCheckSync: bibShowReturned not enough data but there are "
+                           "still bits in the buffer --> error cleared.\n");
+                       if (i) bibRewindBits(i, buffer, &newError);
+                       return SNC_NO_SYNC;
+               } else if (newError) {
+                   *error = newError;
+                   if (i) bibRewindBits(i, buffer, &newError);
+                   return SNC_NO_SYNC;
+               }
+
+               if (start_code_val == MP4_VOP_START_CODE) {
+                   return SNC_VOP;
+               } else if (start_code_val == MP4_VOS_START_CODE) {
+                   return SNC_VOS;
+               } else if (start_code_val == MP4_GROUP_START_CODE) {
+                   return SNC_GOV;
+               } else if (start_code_val == MP4_USER_DATA_START_CODE) {
+                   return SNC_USERDATA;
+               } else if (start_code_val == MP4_EOB_CODE) {
+                   return SNC_EOB;
+               } else if (((start_code_val >> (32-MP4_VID_START_CODE_LENGTH)) == MP4_VID_START_CODE) ||
+                          ((start_code_val >> (32-MP4_VOL_START_CODE_LENGTH)) == MP4_VOL_START_CODE)) {
+                   return SNC_VID;
+               } else {
+                   if (i) bibRewindBits(i, buffer, &newError);
+                   continue;               
+               }
+
+           } else if (f_code && ((result >> shift_bits) == 1)) {
+               if (i != 0) {
+                   /* Stuff start code */
+                   bibFlushBits(i, buffer, &numBitsGot, &bitErrorIndication, &newError);
+                   if (newError) {
+                       *error = newError;
+                       return SNC_NO_SYNC;
+                   }
+               }
+               return SNC_VIDPACK;
+           }
+       }
+   }
+
+   return SNC_NO_SYNC;
+}
+
+
+/* {{-output"sncRewindAndSeekNewMPEGSync.txt"}} */
+/*
+ * sncRewindAndSeekNewMPEGSync
+ *    
+ *
+ * Parameters:
+ *    numBitsToRewind            the number of bits to rewind before seeking
+ *                               the synchronization code,
+ *                               if negative, a default number of bits is
+ *                               rewinded. It is recommended to use 
+ *                               the SNC_DEFAULT_REWIND definition to represent
+ *                               negative values in order to increase code 
+ *                               readability.
+ *    buffer                     a pointer to a bit buffer structure
+ *    f_code                     f_code of the last P-vop
+ *    error                      error code
+ *
+ * Function:
+ *    This function is intended to be called after bit error detection.
+ *    It rewinds some (already read) bits in order not to miss any sync code.
+ *    Then, this function finds the next GOV, VOP or Video Packet start code
+ *    which is not within the rewinded bits. The function discards the bits 
+ *    before the synchronization code but does not remove the found code from 
+ *    the buffer.
+ *
+ *
+ * Returns:
+ *    SNC_NO_SYNC                if no sync code was found and 
+ *                               no more bits are available
+ *    SNC_GOV                    if GOV start code is found
+ *    SNC_VOP                    if VOP start code is found
+ *    SNC_VIDPACK                if Video Packet start code is found
+ *
+ * Error codes:
+ *    Error codes returned by bibFlushBits/bibGetBits/bibShowBits.
+ *
+ *    
+ *    
+ */
+
+int sncRewindAndSeekNewMPEGSync(int numBitsToRewind, bibBuffer_t *buffer,
+                                int f_code, int16 *error)
+/* {{-output"sncRewindAndSeekNewMPEGSync.txt"}} */
+{
+   int sncCode;                     /* found sync code */
+   u_int32 numRewindableBits;       /* number of bits which can be rewinded */
+   u_int32 bitPosBeforeRewinding;   /* initial buffer bit index */
+   u_int32 syncStartBitPos;         /* 1st bit index in found sync code */
+   u_int32 syncEndBitPos;
+    int nb = 0;
+    int bei = 0;
+
+   *error = 0;
+
+   /* If default number of rewinded bits requested */
+   if (numBitsToRewind < 0)
+      /* 32 bits is considered to be enough */
+      numBitsToRewind = 32;
+
+   numRewindableBits = bibNumberOfRewBits(buffer);
+
+   if (numRewindableBits < (u_int32) numBitsToRewind)
+      numBitsToRewind = (int) numRewindableBits;
+
+   bitPosBeforeRewinding = bibNumberOfFlushedBits(buffer);
+
+   if (numBitsToRewind) bibRewindBits(numBitsToRewind, buffer, error);
+   if (*error)
+      return SNC_NO_SYNC;
+
+   /* Loop */
+   do {
+
+      /* Seek the next synchronization code */
+      sncCode = sncSeekMPEGStartCode (buffer, f_code, 0 /* this method used with DP and VP => VP resync is relevant */, 0, error);
+      if (*error)
+         return sncCode;
+
+      syncStartBitPos = bibNumberOfFlushedBits(buffer);
+
+      syncEndBitPos = syncStartBitPos + 
+                      (u_int32) ((sncCode == SNC_VIDPACK) ? (16 + f_code) : 32);
+
+      if (syncEndBitPos <= bitPosBeforeRewinding)
+          bibFlushBits( 1, buffer, &nb, &bei, error );
+
+   /* While the found sync code has been previously read */
+   } while (syncEndBitPos <= bitPosBeforeRewinding);
+
+   return sncCode;
+}
+
+/* {{-output"sncSeekMPEGSync.txt"}} */
+/*
+ * sncSeekMPEGSync
+ *    
+ *
+ * Parameters:
+ *    buffer                     a pointer to a bit buffer structure
+ *    f_code                     f_code of the last P-vop
+ *    error                      error code
+ *
+ * Function:
+ *    Then, this function finds the next GOV, VOP or Video Packet start code
+ *    from the buffer. The function discards the bits before the sync code
+ *    but does not remove the found code from the buffer.
+ *
+ * Returns:
+ *    SNC_NO_SYNC                if no sync code was found and 
+ *                               no more bits are available
+ *    SNC_GOV                    if GOV start code is found
+ *    SNC_VOP                    if VOP start code is found
+ *    SNC_VOS                    if VOS start code is found
+ *    SNC_VIDPACK                if Video Packet start code is found
+ *
+ * Error codes:
+ *    Error codes returned by bibFlushBits/bibGetBits/bibShowBits.
+ *
+ *    
+ */
+
+int sncSeekMPEGSync(bibBuffer_t *buffer, int f_code, int16 *error)
+/* {{-output"sncSeekMPEGSync.txt"}} */
+{
+   u_int32 result;
+   int numBitsGot, shift_bits;
+   int16 newError = 0;
+   int bitErrorIndication = 0;
+
+   shift_bits = 32-(16+f_code);
+
+   for (;;) {
+       
+       bitErrorIndication = 0;
+
+       result = bibShowBits(32, buffer, &numBitsGot, &bitErrorIndication, &newError);
+
+      
+       if (newError == ERR_BIB_NOT_ENOUGH_DATA && numBitsGot) {
+           /* Use the available bits */
+           result <<= (32 - numBitsGot);
+           newError = 0;
+       } else if (newError) {
+           deb("sncSeekSync: ERROR - bibShowBits failed.\n");
+           *error = newError;
+           return SNC_NO_SYNC;
+       }
+
+       if (result == MP4_GROUP_START_CODE)
+           return SNC_GOV;
+       else if (result == MP4_VOP_START_CODE)
+           return SNC_VOP;
+       else if (result == MP4_VOS_START_CODE)
+           return SNC_VOS;
+       else if (result == MP4_EOB_CODE)
+           return SNC_EOB;
+       else if (f_code && ((result >> shift_bits) == 1))
+           return SNC_VIDPACK;
+       else if ( buffer->error )
+          {
+          // out of bits
+          *error = (int16)buffer->error;
+          return SNC_NO_SYNC;
+          }
+
+       
+       bibFlushBits(1, buffer, &numBitsGot, &bitErrorIndication, error);
+   }
+}
+
+   /* {{-output"sncSeekMPEGStartCode.txt"}} */
+/*
+ * sncSeekMPEGStartCode
+ *    
+ *
+ * Parameters:
+ *    buffer                     a pointer to a bit buffer structure
+ *    f_code                     f_code of the last P-vop
+ *    skipVPSync                 nonzero if Video Packet sync codes can be skipped
+ *    error                      error code
+ *
+ * Function:
+ *    This function finds the next GOV, VOP or Video Packet start code
+ *    from the buffer in byte-aligned positions. The function discards the bits before the sync code
+ *    but does not remove the found code from the buffer.
+ *
+ * Returns:
+ *    SNC_NO_SYNC                if no sync code was found and 
+ *                               no more bits are available
+ *    SNC_GOV                    if GOV start code is found
+ *    SNC_VOP                    if VOP start code is found
+ *    SNC_VOS                    if VOS start code is found
+ *    SNC_VIDPACK                if Video Packet start code is found
+ *
+ * Error codes:
+ *    Error codes returned by bibFlushBits/bibGetBits/bibShowBits.
+ *
+ *    
+ */
+
+int sncSeekMPEGStartCode(bibBuffer_t *buffer, int f_code, int skipVPSync, int checkUD, int16 *error)
+/* {{-output"sncSeekMPEGSync.txt"}} */
+{
+  u_int32 result;
+  int numBitsGot, shift_bits;
+  int16 newError = 0;
+  int bitErrorIndication = 0;
+  int flush = 8;
+  const u_int32 MAX_MPEG4_START_CODE = 0x000001ff;
+  shift_bits = 32-(16+f_code);
+  
+  /* start codes are always byte aligned */
+  /* move to the next byte aligned position, if not already there */
+  if (buffer->bitIndex != 7)
+  {
+    bibForwardBits(buffer->bitIndex + 1, buffer); 
+  }
+  
+  for (;;) 
+  {
+    bitErrorIndication = 0;
+    result = bibShowBits(32, buffer, &numBitsGot, &bitErrorIndication, &newError);
+    
+
+    if ( buffer->error )
+      {
+      // out of bits
+      *error = (int16)buffer->error;
+      return SNC_NO_SYNC;
+      }
+
+    /* don't check all start codes, if it is not one of them */
+    if (result <= MAX_MPEG4_START_CODE)
+    {
+      if (result == MP4_GROUP_START_CODE)
+        return SNC_GOV;
+      else if (result == MP4_VOP_START_CODE)
+        return SNC_VOP;
+      else if (result == MP4_VOS_START_CODE)
+        return SNC_VOS;
+      else if (result == MP4_EOB_CODE)
+        return SNC_EOB;
+      else if ( checkUD && (result == MP4_USER_DATA_START_CODE) )
+      	return SNC_USERDATA;
+      
+    }
+    else if (!skipVPSync && f_code && ((result >> shift_bits) == 1))
+        {
+        return SNC_VIDPACK;
+        }
+
+    // we continue here after either if all the if-else's inside the if above are false or if the last else-if is false
+
+    // Note! the following optimization is based on MPEG-4 sync code prefix 0x000001. It doesn't work with any other prefixes.
+    if ( !skipVPSync )
+        {
+        flush = 8;
+        // a small optimization could be reached also with video packet sync markers, but is probably not worth the effort since 
+        // it seems that it could be used to shift at most 16 bits at least in cases with typical f_code values
+        // idea:
+        //  at least if fcode == 15, possible vp resync markers are in the form
+        //  00008xxx, 00009xxx, 0000axxx, 0000bxxx, 0000cxxx, 0000dxxx, 0000exxx, 0000fxxx
+        //  the shifting above already removes the 15 lowest bits => 16th bit must be 1 and 16 highest bits
+        //  should be 0
+        //  in the old way, the sync code from 00008xxx is found in the following steps
+        //  8xxxyyyy, 008xxxyy, => match
+        //  hence we can skip 16 bits (or f-code dependent nr of bits) if 
+        //    a) 32nd bit is 1
+        //  If 32nd bit is 0, we can skip the 16-(nr of successive 0-MSB bits)
+        }
+        
+    // then check for the other sync codes
+    
+    // the 1st check here is needed to optimize the checking: in hopeless cases only a single check is needed
+    else if ( (result & 0x000000ff) <= 1 )
+        {
+        // the 1st check is needed to optimize the checking: in hopeless cases only a single check is needed
+        if ( ((result & 0x000000ff ) == 1) && ((result & 0x00ffff00 ) > 0))
+            {
+            // yyxxxx01, where one of the x != 0 => hopeless
+            flush = 32;
+            }
+        else if ( (result & 0x0000ffff ) == 0 )
+            {
+            // xxxx0000 => could be the 1st 2 bytes of sync code
+            flush = 16;
+            }
+        else if ( (result & 0x000000ff) == 0 )
+            {
+            // yyyyxx00, where xx != 00 (checked above), could be the 1st byte of sync code
+            flush = 24;
+            }
+        else if ( (result & 0x00ffffff) == 1 )
+            {
+            // xx000001 => shift 1 byte
+            flush = 8;
+            }
+        else
+            {
+            // this looks duplicate to the 1st one, but is kept here for simplicity. The 1st one is there since it is the most probable and
+            // hence most cases fall under it. If it was not there, then in most cases all the if's were evaluated and that means extra processing
+            flush = 32;
+            }
+        }
+    else
+        {
+        // hopeless
+        flush = 32;
+        }
+
+    // flush bits
+    bibFlushBits(flush, buffer, &numBitsGot, &bitErrorIndication, error);
+    }
+}
+
+
+/* {{-output"sncSeekBitPattern.txt"}} */
+/*
+ * sncSeekBitPattern
+ *    
+ *
+ * Parameters:
+ *    buffer                     a pointer to a bit buffer structure
+ *    error                      error code
+ *    BitPattern                 to bit pattern to be found
+ *    BitPatternLength           length of the bit pattern to be found
+ *
+ * Function:
+ *    This function finds the next occurance of the given BitPattern 
+ *    from the buffer. The function discards the bits before the BitPattern
+ *    but does not remove the found code from the buffer.
+ *
+ * Returns:
+ *    SNC_NO_SYNC                if the bit pattern was not found and 
+ *                               no more bits are available
+ *    SNC_PATTERN                if the BitPattern is found
+ *
+ * Error codes:
+ *    Error codes returned by bibFlushBits/bibGetBits/bibShowBits.
+ *
+ *    
+ */
+
+int sncSeekBitPattern(bibBuffer_t *buffer, u_int32 BitPattern, int BitPatternLength, int16 *error)
+/* {{-output"sncSeekBitPattern.txt"}} */
+{
+   u_int32 result;
+   int numBitsGot;
+   int16 newError = 0;
+   int bitErrorIndication = 0;
+
+   for (;;) {
+       
+       bitErrorIndication = 0;
+
+       result = bibShowBits(32, buffer, &numBitsGot, &bitErrorIndication, &newError);
+
+       if (newError == ERR_BIB_NOT_ENOUGH_DATA && numBitsGot >= BitPatternLength) {
+           /* Use the available bits */
+           result <<= (32 - numBitsGot);
+           newError = 0;
+       } else if (newError) {
+           deb("sncSeekBitPattern: ERROR - bibShowBits failed.\n");
+           *error = newError;
+           return SNC_NO_SYNC;
+       }
+
+       if ((result >> (32 - BitPatternLength)) == BitPattern)
+           return SNC_PATTERN;
+       else if (result == MP4_GROUP_START_CODE)
+           return SNC_GOV;
+       else if (result == MP4_VOP_START_CODE)
+           return SNC_VOP;
+       else if (result == MP4_EOB_CODE)
+           return SNC_EOB;
+       else if ( buffer->error )
+          {
+          // out of bits
+          *error = (int16)buffer->error;
+          return SNC_NO_SYNC;
+          }
+       
+       bibFlushBits(1, buffer, &numBitsGot, &bitErrorIndication, error);
+   }
+}
+
+/* {{-output"sncRewindStuffing.txt"}} */
+/*
+ * sncRewindStuffing
+ *    
+ *
+ * Parameters:
+ *    buffer                     a pointer to a bit buffer structure
+ *    error                      error code
+ *
+ * Function:
+ *    This function recognizes and rewinds the stuffing bits (1..8) from
+ *    the current position of the buffer.
+ *
+ * Returns:
+ *    SNC_NO_SYNC                if the stuffing was not found
+ *    SNC_PATTERN                if the stuffing has been rewinded successfully
+ *
+ * Error codes:
+ *    Error codes returned by bibFlushBits/bibGetBits/bibShowBits.
+ *
+ *    
+ */
+
+int sncRewindStuffing(bibBuffer_t *buffer, int16 *error)
+/* {{-output"sncRewindStuffing.txt"}} */
+{
+   u_int32 result;
+   int numBitsGot, i;
+   int16 newError = 0;
+   int bitErrorIndication = 0;
+
+   bibRewindBits(8, buffer, &newError);
+   result = bibGetBits(8, buffer, &numBitsGot, &bitErrorIndication, &newError);
+   if (newError) {
+       deb("sncRewindStuffing: ERROR - bibShowBits failed.\n");
+       *error = newError;
+       return SNC_NO_SYNC;
+   }
+
+   for(i = 1; i <= 8; i++) {       
+       /* if stuffing is correct */
+       if ((result & (1 << (i-1))) == 0) {
+           bibRewindBits(i, buffer, &newError);
+           return SNC_PATTERN;
+       }
+   }
+
+   return SNC_NO_SYNC;
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/vdcaic.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,627 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Advanced Intra Coding functions (MPEG-4).
+*
+*/
+
+
+
+
+#include "h263dConfig.h"
+
+#include "vdcaic.h"
+
+#include "errcodes.h"
+#include "debug.h"
+
+#include "zigzag.h"
+
+/*
+ *
+ * aicIntraDCSwitch
+ *
+ * Parameters:
+ *    intraDCVLCThr  VOP-header field for QP dependent switching between 
+ *                   MPEG-4 IntraDC coding and IntraAC VLC coding of the 
+ *                   Intra DC coefficients
+ *    QP             quantization parameter
+ *
+ * Function:
+ *    This function decides based on the input parameters if the Intra DC
+ *    should be decoded as MPEG-4 IntraDC (switched=0) or switched to  
+ *    IntraAC VLC (switched=1)
+ *
+ * Returns:
+ *    switched value
+ *
+ *
+ *
+ */
+
+u_char aicIntraDCSwitch(int intraDCVLCThr, int QP) {
+
+   if ( intraDCVLCThr == 0 ) {
+      return 0;
+   }
+   else if ( intraDCVLCThr == 7 ) {
+      return 1;
+   }
+   else if ( QP >= intraDCVLCThr*2+11 ) {
+      return 1;
+   }
+   else {
+      return 0;
+   }
+}
+
+/*
+ *
+ * aicDCScaler
+ *
+ * Parameters:
+ *    QP       quantization parameter
+ *    type     type of Block "1" Luminance "2" Chrominance
+ *
+ * Function:
+ *    Calculation of DC quantization scale according
+ *    to the incoming QP and block type
+ *
+ * Returns:
+ *    dcScaler value
+ *
+ *
+ *
+ */
+
+int aicDCScaler (int QP, int type) {
+
+   int dcScaler;
+   if (type == 1) {
+      if (QP > 0 && QP < 5) {
+         dcScaler = 8;
+      }
+      else if (QP > 4 && QP < 9) {
+         dcScaler = 2 * QP;
+      }
+      else if (QP > 8 && QP < 25) {
+         dcScaler = QP + 8;
+      }
+      else {
+         dcScaler = 2 * QP - 16;
+      }
+   }
+   else {
+      if (QP > 0 && QP < 5) {
+         dcScaler = 8;
+      }
+      else if (QP > 4 && QP < 25) {
+         dcScaler = (QP + 13) / 2;
+      }
+      else {
+         dcScaler = QP - 6;
+      }
+   }
+   return dcScaler;
+}
+
+/**
+ * Small routine to compensate the QP value differences between the
+ * predictor and current block AC coefficients
+ *
+ **/
+
+static int compensateQPDiff(int val, int QP) {
+
+   if (val<0) {
+      return (val-(QP>>1))/QP;
+   }
+   else {
+      return (val+(QP>>1))/QP;
+   }
+}
+
+/**
+ * Small routine to fill default prediction values into a dcStore entry
+ *
+ */
+
+static void resetPredRow(int pred[])
+{
+   memset (pred, 0, 7 * sizeof(int));
+}    
+
+/*
+ *
+ * aicStart
+ *
+ * Parameters:
+ *    aicData     aicData_t structure
+ *    instance    pointer to vdcInstance_t structure
+ *
+ * Function:
+ *    This function initialises dcStore and qpStore buffers.
+ *    One should call aicStart in the beginning of each VOP.
+ *
+ * Returns:
+ *    Nothing
+ *
+ * Error codes:
+ *
+ *
+ */
+
+void aicStart(aicData_t *aicData, int numMBsInMBLine, int16 *error)
+{
+
+   int i,j, numStoreUnits;
+   int initXpos[6] = {-1, 0, -1, 0, -1, -1};
+   int initYpos[6] = {-1, -1, 0, 0, -1, -1};
+   int initXtab[6] = {1, 0, 3, 2, 4, 5};
+   int initYtab[6] = {2, 3, 0, 1, 4, 5};
+   int initZtab[6] = {3, 2, 1, 0, 4, 5};
+
+   numStoreUnits = numMBsInMBLine*2;
+
+   if (!aicData->qpStore || !aicData->dcStore) {
+      aicData->qpStore = (int16 *) calloc(numStoreUnits, sizeof(int16));
+      if (!aicData->qpStore)
+      {
+          *error = ERR_VDC_MEMORY_ALLOC;
+          return;
+      }
+      
+      /* allocate space for 3D matrix to keep track of prediction values
+      for DC/AC prediction */
+      
+      aicData->dcStore = (int ***)calloc(numStoreUnits, sizeof(int **));
+      if (!aicData->dcStore)
+      {
+          *error = ERR_VDC_MEMORY_ALLOC;
+          return;
+      }
+
+      for (i = 0; i < numStoreUnits; i++)
+      {
+         aicData->dcStore[i] = (int **)calloc(6, sizeof(int *));
+         if (!aicData->dcStore[i])
+         {
+             *error = ERR_VDC_MEMORY_ALLOC;
+             return;
+         }
+
+         for (j = 0; j < 6; j++)
+         {
+            aicData->dcStore[i][j] = (int *)calloc(15, sizeof(int));
+            if ( !(aicData->dcStore[i][j]) )
+            {
+                *error = ERR_VDC_MEMORY_ALLOC;
+                return;
+            }
+         }
+      }
+      
+      aicData->numMBsInMBLine = numMBsInMBLine;
+
+      for (i= 0; i < 6; i++)
+      {
+         aicData->Xpos[i] = initXpos[i];
+         aicData->Ypos[i] = initYpos[i];
+         aicData->Xtab[i] = initXtab[i];
+         aicData->Ytab[i] = initYtab[i];
+         aicData->Ztab[i] = initZtab[i];
+      }
+
+      /* 1 << (instance->bits_per_pixel - 1) */
+      aicData->midGrey = 1 << 7; 
+
+      aicData->ACpred_flag = 1;
+   } else {
+      memset(aicData->qpStore, 0, numStoreUnits * sizeof(int16));
+   }
+
+}
+
+/*
+ * Clip the reconstructed coefficient when it is stored for prediction 
+ *
+ */
+
+#define aicClip(rec) \
+   ((rec < -2048) ? -2048 : ((rec > 2047) ? 2047 : rec))
+   
+/*
+ *
+ * aicBlockUpdate
+ *
+ * Parameters:
+ *    aicData        aicData_t structure
+ *    currMBNum      Current Macroblocks Number
+ *
+ * Function:
+ *    This function fills up the dcStore and qpStore of current MB.
+ *
+ * Returns:
+ *    Nothing
+ *
+ * Error codes:
+ *    None
+ *
+ *
+ */
+
+void aicBlockUpdate (aicData_t *aicData, int currMBNum, int blockNum, int *block,
+                int pquant, int DC_coeff)
+{
+
+   int n, currDCStoreIndex;
+   assert(currMBNum >= 0);
+
+   currDCStoreIndex = ((currMBNum / aicData->numMBsInMBLine) % 2) * aicData->numMBsInMBLine +
+                  (currMBNum % aicData->numMBsInMBLine);
+
+   if (block != NULL) {
+      
+      aicData->dcStore[currDCStoreIndex][blockNum][0] = aicClip(DC_coeff);
+      block[0] = aicClip(block[0]);
+
+      for (n = 1; n < 8; n++)
+      {
+         aicData->dcStore[currDCStoreIndex][blockNum][n] = block[zigzag[n]] = aicClip(block[zigzag[n]]);
+         aicData->dcStore[currDCStoreIndex][blockNum][n+7] = block[zigzag[n<<3 /**8*/]] = aicClip(block[zigzag[n<<3 /**8*/]]);
+      }
+   }
+
+   if (blockNum == 0) 
+      aicData->qpStore[currDCStoreIndex]= (int16) pquant;
+}
+
+/*
+ *
+ * aicIsBlockValid
+ *
+ * Parameters:
+ *    aicData        aicData_t structure
+ *    currMBNum      Current Macroblocks Number
+ *
+ * Function:
+ *    This function checks if the current MB has a valid entry in the 
+ *    dcStore and qpStore (needed in predictor validation of I-MBs in a P-VOP).
+ *
+ * Returns:
+ *    1 if MB has a valid entry
+ *    0 if MB doesn't have a valid entry
+ *
+ * Error codes:
+ *    None
+ *
+ *
+ */
+
+int aicIsBlockValid (aicData_t *aicData, int currMBNum)
+{
+   int currDCStoreIndex;
+   assert(currMBNum >= 0);
+
+   currDCStoreIndex = ((currMBNum / aicData->numMBsInMBLine) % 2) * aicData->numMBsInMBLine +
+                  (currMBNum % aicData->numMBsInMBLine);
+
+   if (aicData->qpStore[currDCStoreIndex] > 0 && aicData->qpStore[currDCStoreIndex] < 32)
+      return 1;
+   else
+      return 0;
+}
+
+/*
+ *
+ * aicFree
+ *
+ * Parameters:
+ *    aicData        aicData_t structure
+ *    numOfMBs      Number of Macroblocks in VOP
+ *
+ * Function:
+ *    This function frees the dynamic memory allocated by aicStart.
+ *    aicFree should be called at least when exiting the main program.
+ *    Alternatively it can be called whenever the playing a video has
+ *    ended.
+ *
+ * Returns:
+ *    Nothing
+ *
+ * Error codes:
+ *    None
+ *
+ *
+ */
+
+void aicFree(aicData_t *aicData)
+{
+   int i,j;
+
+   /* Free allocated memory for 3D matrix */
+   if (aicData->dcStore) {
+      for (i = 0; i < (aicData->numMBsInMBLine*2); i++)
+      {
+         for (j = 0; j < 6; j++)
+            free((char *)aicData->dcStore[i][j]);
+         free((char *)aicData->dcStore[i]);
+      }
+      free((char *)aicData->dcStore);
+   }
+
+   /* Free allocated memory for qpStore matrix */
+   if (aicData->qpStore) {
+      free((char *)aicData->qpStore);
+   }
+}
+
+/*
+ *
+ * aicDCACrecon
+ *
+ * Parameters:
+ *   aicData         aicData_t structure
+ *   QP              QP of the current MB
+ *   fTopMBMissing   flag indicating if the block above the current block
+ *                   is outside of the current Video Packet or not a valid 
+ *                   Intra block (in case of P-VOP decoding)
+ *   fLeftMBMissing  flag indicating if the block left to the current block
+ *                   is outside of the current Video Packet or not a valid 
+ *                   Intra block (in case of P-VOP decoding)
+ *   fBBlockOut      flag indicating if the top-left neighbour block of the
+ *                   current block is outside of the current Video Packet
+ *                   or not a valid Intra block (in case of P-VOP decoding)
+ *   blockNum        number of the current block in the MB 
+ *                   (0..3 luminance, 4..5 chrominance)
+ *   qBlock          block of coefficients
+ *   currMBNum       number of the current macroblocks in the VOP
+ *
+ * Function:
+ *   This function reconstructs the DC and AC (first column or first row or none)
+ *   coefficients of the current block by selecting the predictor from the 
+ *   neighbouring blocks (or default values), and adding these predictor 
+ *   values to qBlock. Its output is the quantized coefficient matrix in 
+ *   normal zigzag order.
+ *
+ * Returns:
+ *    Nothing
+ *
+ * Error codes:
+ *    None
+ *
+ *
+ */
+
+void aicDCACrecon(aicData_t *aicData, int QP, u_char fTopMBMissing, u_char fLeftMBMissing,
+              u_char fBBlockOut,  int blockNum, int *qBlock, int currMBNum)
+{
+   int m, n, tempDCScaler;
+   int xCoordMB, yCoordMB, mbWidth, currDCStoreIndex;
+   int blockA = 0, blockB = 0, blockC = 0, fBlockAExist = 0, fBlockCExist = 0;
+   int gradHor, gradVer, predDC;
+   int fVertical;
+   int predA[7], predC[7];
+   int pcoeff[64];
+   assert(currMBNum >= 0);
+   assert(qBlock != NULL);
+
+   xCoordMB = currMBNum % aicData->numMBsInMBLine;
+   yCoordMB = currMBNum / aicData->numMBsInMBLine;
+   currDCStoreIndex = (yCoordMB % 2)*aicData->numMBsInMBLine + xCoordMB;
+   mbWidth = aicData->numMBsInMBLine * ((currDCStoreIndex < aicData->numMBsInMBLine) ? -1 : 1);
+
+
+   /* Find the direction of prediction and the DC prediction */
+   switch ( blockNum ) {
+   case 0 :
+   case 4 :
+   case 5 :
+      /* Y0, U, and V blocks */
+
+
+      /* Prediction blocks A (left), B (above-left), and C (above) */
+      if ( ( yCoordMB == 0 && xCoordMB == 0) || (fTopMBMissing && fLeftMBMissing) || (xCoordMB == 0 && fTopMBMissing) || (yCoordMB == 0 && fLeftMBMissing) ) {
+         /* top-left edge of VOP or VP */
+         blockA = aicData->midGrey<<3 /**8*/;
+         blockB = aicData->midGrey<<3 /**8*/;
+         blockC = aicData->midGrey<<3 /**8*/;
+         fBlockAExist = fBlockCExist = 0;
+      }
+      else if ( yCoordMB == 0 || fTopMBMissing ) {
+         /* top row of VOP or VP, or MB on top not valid */
+         blockA = aicData->dcStore[currDCStoreIndex+aicData->Xpos[blockNum]][aicData->Xtab[blockNum]][0];
+         fBlockAExist = 1;
+         if ( yCoordMB == 0 || fBBlockOut ) {
+            /* B MB is out of this VP */
+            blockB = aicData->midGrey<<3 /**8*/;
+         }
+         else {
+            blockB = aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth+aicData->Xpos[blockNum]][aicData->Ztab[blockNum]][0];
+         }
+         blockC = aicData->midGrey<<3 /**8*/;
+         fBlockCExist = 0;
+      }
+      else if ( xCoordMB == 0 || fLeftMBMissing ) {
+         /* left edge of VOP or VP, or MB on left not valid */
+         blockA = aicData->midGrey<<3 /**8*/;
+         fBlockAExist = 0;
+         if ( xCoordMB == 0 || fBBlockOut ) {
+            /* B MB is out of this VP */
+            blockB = aicData->midGrey<<3 /**8*/;
+         }
+         else {
+            blockB = aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth+aicData->Xpos[blockNum]][aicData->Ztab[blockNum]][0];
+         }
+         blockC = aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth][aicData->Ytab[blockNum]][0];
+         fBlockCExist = 1;
+      }
+      else {
+         /* Something else */
+         blockA = aicData->dcStore[currDCStoreIndex+aicData->Xpos[blockNum]][aicData->Xtab[blockNum]][0];
+         if ( fBBlockOut ) {
+            /* B MB is out of this VP */
+            blockB = aicData->midGrey<<3 /**8*/;
+         }
+         else {
+            blockB = aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth+aicData->Xpos[blockNum]][aicData->Ztab[blockNum]][0];
+         }
+         blockC = aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth][aicData->Ytab[blockNum]][0];
+         fBlockAExist = fBlockCExist = 1;
+      }
+      break;
+   case 1 : 
+      /* Y1 block */
+
+      /* Prediction block A (left) always available */
+      blockA = aicData->dcStore[currDCStoreIndex+aicData->Xpos[blockNum]][aicData->Xtab[blockNum]][0];
+      fBlockAExist = 1;
+      /* Prediction blocks B (above-left) and C (above) */
+      if ( yCoordMB == 0 || fTopMBMissing ) {
+         /* top row of VOP or VP */
+         blockB = aicData->midGrey<<3 /**8*/;
+         blockC = aicData->midGrey<<3 /**8*/;
+         fBlockCExist = 0;
+      }
+      else {
+         blockB = aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth+aicData->Xpos[blockNum]][aicData->Ztab[blockNum]][0];
+         blockC = aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth][aicData->Ytab[blockNum]][0];
+         fBlockCExist = 1;
+      }
+      break;
+   case 2 :
+      /* Y2 block */
+
+      /* Prediction blocks A (left) and B (above-left) */
+      if ( xCoordMB == 0 || fLeftMBMissing ) {
+         /* left edge or first MB in VP */
+         blockA = aicData->midGrey<<3 /**8*/;
+         blockB = aicData->midGrey<<3 /**8*/;
+         fBlockAExist = 0;
+      }
+      else {
+         blockA = aicData->dcStore[currDCStoreIndex+aicData->Xpos[blockNum]][aicData->Xtab[blockNum]][0];
+         blockB = aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth+aicData->Xpos[blockNum]][aicData->Ztab[blockNum]][0];
+         fBlockAExist = 1;
+      }
+      /* Prediction block C (above) always available */
+      blockC = aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth][aicData->Ytab[blockNum]][0];
+      fBlockCExist = 1;
+      break;
+   case 3 :
+      /* Y3 block */
+
+      /* Prediction block A (left) always available */
+      blockA = aicData->dcStore[currDCStoreIndex+aicData->Xpos[blockNum]][aicData->Xtab[blockNum]][0];
+      /* Prediction block B (above-left) always available */
+      blockB = aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth+aicData->Xpos[blockNum]][aicData->Ztab[blockNum]][0];
+      /* Prediction block C (above) always available */
+      blockC = aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth][aicData->Ytab[blockNum]][0];
+      fBlockAExist = fBlockCExist = 1;
+      break;
+   }
+
+
+
+
+   gradHor = blockB - blockC;
+   gradVer = blockA - blockB;
+
+   if ((abs(gradVer)) < (abs(gradHor))) {
+      /* Vertical prediction (from C) */
+      predDC = blockC;
+      fVertical = 1;
+   }
+   else {
+      /* Horizontal prediction (from A) */
+      predDC = blockA;
+      fVertical = 0;
+   }
+
+   /* Now reconstruct the DC coefficient */
+   tempDCScaler = aicDCScaler(QP,(blockNum<4)?1:2);
+   qBlock[0] = (u_int8) (qBlock[0] + (predDC + tempDCScaler/2) / tempDCScaler);
+
+   /* Do AC prediction if required */
+   if (aicData->ACpred_flag == 1) {
+
+      /* Do inverse zigzag-scanning */
+      if (fVertical) {
+         for (m = 0; m < 64; m++) {
+            pcoeff[m] = qBlock[zigzag_h[m]];
+         }
+      }
+      else { /* horizontal prediction */
+         for (m = 0; m < 64; m++) {
+            pcoeff[m] = qBlock[zigzag_v[m]];
+         }
+      }
+   
+
+
+      /* AC predictions */
+      if ( !fVertical && fBlockAExist ) {
+         /* prediction from A */
+         for (m = 8; m < 15; m++) {
+            predA[m-8] = compensateQPDiff(((aicData->dcStore[currDCStoreIndex+aicData->Xpos[blockNum]][aicData->Xtab[blockNum]][m]) * 2 * (aicData->qpStore[currDCStoreIndex+aicData->Xpos[blockNum]])), (QP<<1));
+         }
+      }
+      else if ( fVertical && fBlockCExist ) {
+         /* prediction from C */
+         for (m = 1; m < 8; m++) {
+            predC[m-1] = compensateQPDiff(((aicData->dcStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth][aicData->Ytab[blockNum]][m]) * 2 * (aicData->qpStore[currDCStoreIndex+(aicData->Ypos[blockNum])*mbWidth])), (QP<<1));
+         }
+      }
+      else {
+         /* Prediction not possible */
+         if ( fVertical ) {
+            resetPredRow(predC);
+         }
+         else {
+            resetPredRow(predA);
+         }
+      }
+
+
+
+      /* AC coefficients reconstruction*/
+      if (fVertical) { /* Vertical, top row of block C */
+         for (m = 0; m < 7; m++) {
+            qBlock[zigzag[(m+1)*8]] = pcoeff[(m+1)*8];
+         }
+         for (m = 1; m < 8; m++) {
+            qBlock[zigzag[m]] = pcoeff[m] + predC[m-1];
+         }
+      }
+      else { /* Horizontal, left column of block A */
+         for (m = 0; m < 7; m++) {
+            qBlock[zigzag[(m+1)*8]] = pcoeff[(m+1)*8] + predA[m];
+         }
+         for (m = 1; m < 8; m++) {
+            qBlock[zigzag[m]] = pcoeff[m];
+         }
+      }
+
+      /* Copy the rest of the coefficients back to qBlock */
+      for (m = 1; m < 8; m++) {
+         for (n = 1; n < 8; n++) {
+            qBlock[zigzag[m*8+n]] = pcoeff[m*8+n];
+         }
+      }
+   }
+
+}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/vdcmvc.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1701 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Motion vector calculations and storage.
+*
+*/
+
+
+
+
+#include "h263dConfig.h"
+
+#include "vdcmvc.h"
+
+#include "core.h"
+#include "errcodes.h"
+#include "debug.h"
+
+
+/* 
+ * Defines 
+ */
+
+#define NEIGHBOUR_SIZE 2      /* The size for neighbour array */
+#define MVD_NOT_CODED -32767  /* Macroblock is not coded in mvcTable_t */
+#define MVD_INTRA -32765      /* Marks intra macroblock in mvcTable_t */
+
+#define MVD_UMIN_MPEG4 -10240
+
+#define MVD_MIN -160          /* The minimum for mvd. */
+#define MVD_MAX 155           /* The maximum for mvd. */
+#define MVD_UMIN_V1 -315      /* The minimum for MV in unrestricted mode (v1) */
+#define MVD_UMAX_V1 315       /* The maximum for MV in unrestricted mode (v1) */
+#define MVD_UMIN_V2 -32000    /* The minimum for MV in unrestricted mode (v2)
+                                 Note: this value is used to check the validity
+                                 of MVs. If there is no MV for a MB 
+                                 MVD_NOT_CODED or MVD_INTRA are used, and
+                                 therefore any value bigger than those
+                                 suits for this definition. In H.263 v2 
+                                 unlimited submode, MVs can have any length
+                                 within a picture (plus 15-pixel border),
+                                 and therefore this definition is set to small
+                                 enough value. */
+#define MVD_155 155           /* MV for 15.5 */
+#define MVD_160 160           /* MV for 16 */
+#define MVD_320 320           /* MV for 32 */
+/* It is assumed that motion vector values are signed and in order
+   (for example MV for 15.5 < MV for 16).
+   No other assumptions are made. */
+
+
+/* 
+ * Macros 
+ */
+
+/* mvValid checks if the specified item is a valid motion vector */
+/* Note: MVD_NOT_CODED and MVD_INTRA are very small negative numbers.
+         Thus, we can use the minimum MV for H.263 Annex D unlimited
+         submode to check the validity of a passed item. Actually,
+         we could use any value larger than MVD_NOT_CODED and MVD_INTRA
+         and smaller than or equal to the minimum MV. */
+#define mvValid(d1item, d1y, d1time) \
+   (d1item.mvx >= MVD_UMIN_V2 \
+      && d1item.y == (d1y) && d1item.time == (d1time))
+
+
+#define mvValidMPEG(d1item, d1y, d1time) \
+   (d1item.mvx >= MVD_UMIN_MPEG4 \
+      && d1item.y == (d1y) && d1item.time == (d1time))
+
+/* mvLegal cheks if the specified item has been updated to either contain
+   a motion vector or not coded / intra information */
+#define mvLegal(d5item, d5y, d5time) \
+   (d5item.y == (d5y) && d5item.time == (d5time))
+
+/* mvStore puts given arguments into the motion vector array
+   Used from: mvcCalcMV */
+#define mvStore(d2row, d2x, d2y, d2mvx, d2mvy, d2time, d2type) \
+   d2row[d2x].mvx = d2mvx; d2row[d2x].mvy = d2mvy; \
+   d2row[d2x].y = d2y; d2row[d2x].time = d2time; d2row[d2x].fourMVs = 1; \
+   d2row[d2x].type = d2type
+
+/* mvStoreMB puts given arguments into the motion vector array for the
+   whole macroblock
+   Used from: mvcCalcMV, mvcMarkMBIntra, mvcMarkMBNotCoded */
+#define mvStoreMB(d4row1, d4row2, d4x, d4y, d4mvx, d4mvy, d4time, d4type) \
+   d4row1[d4x].mvx = d4row1[d4x + 1].mvx = \
+      d4row2[d4x].mvx = d4row2[d4x + 1].mvx = d4mvx; \
+   d4row1[d4x].mvy = d4row1[d4x + 1].mvy = \
+      d4row2[d4x].mvy = d4row2[d4x + 1].mvy = d4mvy; \
+   d4row1[d4x].y = d4row1[d4x + 1].y = d4y; \
+   d4row2[d4x].y = d4row2[d4x + 1].y = d4y + 1; \
+   d4row1[d4x].time = d4row1[d4x + 1].time = \
+      d4row2[d4x].time = d4row2[d4x + 1].time = time; \
+   d4row1[d4x].fourMVs = d4row1[d4x + 1].fourMVs = \
+      d4row2[d4x].fourMVs = d4row2[d4x + 1].fourMVs = 0; \
+   d4row1[d4x].type = d4row1[d4x + 1].type = \
+      d4row2[d4x].type = d4row2[d4x + 1].type = (d4type)
+
+/* updateRowPointers checks if currX, currY or currTime have changed
+   and updates them. It also updates mvRow0, mvRow1 and mvRow2.
+   Used from: mvcCalcMV, mvcMarkMBIntra, mvcMarkMBNotCoded */
+#define updateRowPointers(d3x, d3y, d3time) \
+   if (d3x != mvcData->currX) \
+      mvcData->currX = d3x; \
+   if (d3y != mvcData->currY) { \
+      int \
+         mvRowIndex, \
+         currMaxX = mvcData->currMaxX; \
+      mvRowItem_t *mvRow = mvcData->mvRow; \
+      mvcData->currY = d3y; \
+      mvcData->mvRowIndex = mvRowIndex = (mvcData->mvRowIndex + 2) % 3; \
+      mvcData->mvRow0 = &mvRow[(currMaxX + 1) * 2 * mvRowIndex]; \
+      mvcData->mvRow1 = &mvRow[(currMaxX + 1) * 2 * ((mvRowIndex + 1) % 3)]; \
+      mvcData->mvRow2 = &mvRow[(currMaxX + 1) * 2 * ((mvRowIndex + 2) % 3)]; \
+   } \
+   if (d3time != mvcData->currTime) \
+      mvcData->currTime = d3time 
+
+/* mvcInvMVD takes the other one of the possible MVD values defined in
+   H.263 Recommendation */
+#define mvcInvMVD(invMv) \
+   (invMv < 0) ? \
+      MVD_320 + invMv : \
+      -MVD_320 + invMv
+
+/* sign123(x) returns
+      1 if x < 0,
+      2 if x > 0,
+      3 if x == 0 
+   In other words,
+      bit 0 = 1 if x <= 0, 
+      bit 1 = 1 if x >= 0 */
+#define sign123(x) ((x == 0) ? 3 : (x < 0) ? 1 : 2)
+
+
+/* 
+ * Local prototypes
+ */
+
+static void mvcGetNeighbourMVs(mvcData_t *mvcData, int x, int y, int time,
+   int *nmvx, int *nmvy, int prevFlag, int16 *error);
+
+__inline static void mvcCheckAndSet( 
+      mvRowItem_t *mvRowPtr, int xind, int yind, int time, int nind, 
+      int *nmvx, int *nmvy, mvRowItem_t *cmvRowPtr, int cxind, int cyind,
+      int16 *error);
+
+__inline static void mvcSetToCurrent( 
+      mvRowItem_t *mvRowPtr, int xind, int yind, int time, int nind,
+      int *nmvx, int *nmvy, int16 *error);
+
+
+/*
+ * Global functions
+ */
+
+
+/* {{-output"mvcSetBorders.txt"}} */
+/*
+ *
+ * mvcSetBorders
+ *
+ * Parameters:
+ *    mvcData        mvcData_t structure
+ *    x              the x coordinate of the MB (0 .. maxX)
+ *    y              the y coordinate of the MB
+ *                   (0 .. macroblock rows in frame - 1)
+ *    mba            Macroblock address of starting MB of the slice. This 
+ *                   value SHOULD be set to -1 if Annex K is not in use.
+ *    numMBsInMBLine    Number of MBs in MB line    
+ *    rightOfBorder     There is a border on the left of the current MB
+ *    downOfBorder      There is a border on top of the current MB
+ *
+ * Function:
+ *    This function calculates the borders of GOBs and Slices..This function 
+ *    SHOULD be called before mvcCalcMV.....
+ *
+ * Returns:
+ *    Nothing
+ *
+ * Error codes:
+ *    None
+ *
+ */
+
+void mvcSetBorders(
+      mvcData_t *mvcData, int x, int y, int mba, int numMBsInMBLine, 
+      int *rightOfBorder, int *downOfBorder 
+)
+{
+   int
+      upRightMBIsStart;
+
+   if (mvcData)   {
+      mvcData->rightOfBorderPrev = mvcData->rightOfBorder;
+      mvcData->downOfBorderPrev = mvcData->downOfBorder;
+   }
+
+   if (mba == -1) {
+      if (x == 0) {
+         *rightOfBorder = 1;
+      }
+      else  {
+         *rightOfBorder = 0;
+      }
+      
+      /* Always downOfBorder is set to 1, since in QCIF and CIF every GOB
+         has only 1 MB line. If larger images are supported, numMBLinesInGOB
+         should be passed here. Also number of starting MB of the GOB may be
+         needed...*/
+      *downOfBorder = 1;
+      upRightMBIsStart = 0;
+   }
+   else  {
+      int
+         xs,   /* x coordinate of start MB */
+         ys;   /* y coordinate of start MB */
+      xs = mba % numMBsInMBLine;
+      ys = mba / numMBsInMBLine;
+
+      /* slice structured mode*/
+      /* Check if there is slice border on top of the  current MB:
+         For that, check either current MB should be on the same MB line 
+         with the starting MB of slice or current MB should not be on the
+         left of the starting MB if the MB is on the second line of the 
+         slice. */
+      
+      if ((y == ys) || ((x < xs) && (ys+1 == y)))  {
+         *downOfBorder = 1;
+      }
+      else  {
+         *downOfBorder = 0;
+      }   
+      /* Check if there is a slice border on the left of the current MB.*/
+      if (((x == xs) && (y == ys)) || (x == 0))  {
+         *rightOfBorder = 1;
+      }
+      else  {
+         *rightOfBorder = 0;
+      }
+
+      /* Test the situation of MV2 is in another slice but MV3 in in the
+         same slice... i.e:
+         MB1 MB1 MB1 MB2 MB2 .........MB2
+         MB2 MB2 MB2 MB2 MB2..........MB2
+                  *                        
+         The MB marked with * is an exmaple. MB on top of it is in another slice
+         but the MB which MV3 will come from is in the same slice...*/
+      if ((x+1 == xs) && (y-1 == ys))
+         upRightMBIsStart = 1;
+      else
+         upRightMBIsStart = 0;
+   }   
+
+   if (mvcData)   {
+      mvcData->upRightMBIsStart = upRightMBIsStart;
+      mvcData->downOfBorder = *downOfBorder;
+      mvcData->rightOfBorder = *rightOfBorder;
+      mvcData->leftOfBorder = 0;
+   }
+}
+
+/* {{-output"mvcCalcMV.txt"}} */
+/*
+ *
+ * mvcCalcMV
+ *
+ * Parameters:
+ *       mvcData        mvcData_t structure
+ *
+ *       mvdx           motion vector data returned by vlcGetMVD
+ *       mvdy
+ *
+ *       *mvx           the resulting motion vector is placed to *mvx and *mvy
+ *       *mvy
+ *
+ *       predictorMode  0, 1, 2 or 3. See H.263 recommendation, Annex F, Figure
+ *                      15, where modes are in the following order:
+ *                         0  1
+ *                         2  3
+ *
+ *                      Advanced Prediction mode: It is assumed that this
+ *                      function is called by setting predictorMode 0, 1, 2
+ *                      and 3 in this order for a particular macroblock.
+ *
+ *                      Normal: This function should be called by setting
+ *                      predictorMode to 0.
+ *
+ *       fourMVs        if != 0, four motion vectors for current macroblock
+ *                      is assumed
+ *
+ *       unrestrictedMV       if != 0, unrestricted motion vector mode is used
+ *
+ *       topOfGOB             if != 0, the current MB is assumed to be in the
+ *                            first line of the current GOB
+ *
+ *       nonEmptyGOBHeader    if != 0, the GOB header of the current GOB is
+ *                            is assumed to be non-empty, and MV2 and MV3 are
+ *                            set to MV1 if they are outside the GOB. If Annex K
+ *                            is in use set this value to 1......
+ *
+ *       x              the x coordinate of the MB (0 .. maxX)
+ *       y              the y coordinate of the MB
+ *                      (0 .. macroblock rows in frame - 1)
+ *
+ *       time           a value which is related to the time when the current
+ *                      frame must be shown. This value should be unique
+ *                      among a relatively small group of consecutive frames.
+ *
+ *       mbType         must be MVC_MB_INTER or MVC_MB_INTRA. MVC_MB_INTRA 
+ *                      should be used only in PB frames mode.
+ *
+ *       error          error code
+ *
+ *       fPLUSPTYPE     PLUSTYPE flag
+ *
+ *       fUMVLimited    Annex D v2 flag
+ *                      1  => Limited MVs    (UUI = 1)
+ *                      0  => Unlimited MVs  (UUI = 01)
+ *
+ * Function:
+ *       This function counts the motion vector value for given macroblock.
+ *       See H.263 Recommendation 6.1.1 Differential Motion Vectors and
+ *       Annex F. Advanced Prediction Mode.
+ *
+ * Returns:
+ *       Changes *mvx, *mvy and possibly *error.
+ *
+ * Error codes:
+ *       ERR_MVC_MVDX_ILLEGAL    mvdx illegal
+ *       ERR_MVC_MVDY_ILLEGAL    mvdy illegal
+ *       ERR_MVC_MVX_ILLEGAL     mvx is NULL
+ *       ERR_MVC_MVY_ILLEGAL     mvy is NULL
+ *       ERR_MVC_MODE_ILLEGAL    predictorMode illegal
+ *       ERR_MVC_X_ILLEGAL       x < 0 or x > maxX
+ *       ERR_MVC_Y_ILLEGAL       y < 0
+ *       ERR_MVC_TIME_ILLEGAL    time < 0
+ *       ERR_MVC_MVPTR           result is not legal
+ *
+ */
+
+void mvcCalcMV(mvcData_t *mvcData, int mvdx, int mvdy,
+   int *mvx, int *mvy, u_char predictorMode, u_char fourMVs,
+   u_char unrestrictedMV,  u_char nonEmptyGOBHeader, int x, 
+   int y, int time, int mbType, int16 *error, int fPLUSPTYPE, 
+   int fUMVLimited)
+/* {{-output"mvcCalcMV.txt"}} */
+{
+
+   int 
+      i, j,    /* loop variables */
+      mvcx[3], /* Candidates: mv[0] = MV1, mv[1] = MV2, mv[2] = MV3 */
+      mvcy[3],
+      *mv,     /* mvcx or mvcy */
+      *mvptr,  /* == mvx or mvy */
+      mvd,     /* mvdx or mvdy */
+      xx2,     /* x * 2 */
+      yx2,     /* y * 2 */
+      xmv1,    /* index for MV1 */
+      xmv2,    /* index for MV2 */
+      xmv3,    /* index for MV3 */
+      ymv1,
+      ymv2,
+      ymv3,
+      mvRangeLow,    /* Lower boundary for MV Range  
+                        Look H.263+ Rec. Table D.1, D.2 */
+      mvRangeHigh,   /* Higher boundary for MV Range  
+                        Look H.263+ Rec. Table D.1, D.2 */
+      picDim,        /* Temporary variable for luminance width or height */
+      mbCorner,      /* Temporary variable for MB's topleft corner's 
+                        coordinate (x or y)*/
+      mvRes;         /* MB's rightmost or bottommost pixel plus MV
+                        for checking restriction D.1.1 */
+   mvRowItem_t
+      *currMvRow,
+      *prevMvRow,
+      *mvRow0,
+      *mvRow1,
+      *mvRow2;
+
+   /* Check parameters */
+    if ((!fPLUSPTYPE) || (!unrestrictedMV))
+   {
+      if (mvdx < MVD_MIN || mvdx > MVD_MAX) {
+         *error = ERR_MVC_MVDX_ILLEGAL;
+         return;
+      }
+
+      if (mvdy < MVD_MIN || mvdy > MVD_MAX) {
+         *error = ERR_MVC_MVDY_ILLEGAL;
+         return;
+      }
+   }
+
+   if (!mvx) {
+      *error = ERR_MVC_MVX_ILLEGAL;
+      return;
+   }
+
+   if (!mvy) {
+      *error = ERR_MVC_MVY_ILLEGAL;
+      return;
+   }
+
+   if ((fourMVs && predictorMode > 3) ||
+      (!fourMVs && predictorMode > 0)) {
+      *error = ERR_MVC_MODE_ILLEGAL;
+      return;
+   }
+
+   if (x < 0 || x > mvcData->currMaxX) {
+      *error = ERR_MVC_X_ILLEGAL;
+      return;
+   }
+
+   if (y < 0) {
+      *error = ERR_MVC_Y_ILLEGAL;
+      return;
+   }
+
+   if (time < 0) {
+      *error = ERR_MVC_TIME_ILLEGAL;
+      return;
+   }
+
+   updateRowPointers(x, y, time);
+   mvRow0 = mvcData->mvRow0;
+   mvRow1 = mvcData->mvRow1;
+   mvRow2 = mvcData->mvRow2;
+
+   /* Seek candidate predictors */
+
+   xx2 = x << 1; /* xx2 = x * 2 */
+   yx2 = y << 1;
+
+   xmv1 = xx2 - 1 + (predictorMode & 1);
+   xmv2 = xx2 + (predictorMode == 1);
+   xmv3 = xx2 + 2 - (predictorMode > 1);
+   ymv1 = yx2 + (predictorMode > 1);
+   ymv2 = ymv3 = yx2 - 1 + (predictorMode > 1);
+
+   if (predictorMode <= 1) {
+      currMvRow = mvRow1;
+      prevMvRow = mvRow0;
+   }
+   else {
+      currMvRow = mvRow2;
+      prevMvRow = mvRow1;
+   }
+
+   if ( (predictorMode & 1) || /* right column of the MB */
+      ( !mvcData->rightOfBorder && mvValid(currMvRow[xmv1], ymv1, time) ) ) {
+      mvcx[0] = currMvRow[xmv1].mvx;
+      mvcy[0] = currMvRow[xmv1].mvy;
+   }
+   else
+      /* if (x == 0 || motion vector for previous MB does not exist ||
+             the previous MB belongs to a different slice) */
+      mvcx[0] = mvcy[0] = 0;
+
+   if ((y == 0 || (mvcData->downOfBorder && nonEmptyGOBHeader)) && predictorMode <= 1) {
+      /* mv2 and mv3 are outside the picture or GOB
+         (if non-empty GOB header) or outside the slice*/
+      mvcx[1] = mvcx[0];
+      mvcy[1] = mvcy[0];
+      /* Check if the MB ont the previous line and on the next column
+         in in the same slice (means start MBof the slice).. */
+      if (!mvcData->upRightMBIsStart)   {
+         mvcx[2] = mvcx[0];
+         mvcy[2] = mvcy[0];
+      }
+      if (x == mvcData->currMaxX)
+         mvcx[2] = mvcy[2] = 0;
+   }
+   else {
+      if (mvValid(prevMvRow[xmv2], ymv2, time)) {
+         mvcx[1] = prevMvRow[xmv2].mvx;
+         mvcy[1] = prevMvRow[xmv2].mvy;
+      }
+      else 
+         mvcx[1] = mvcy[1] = 0;
+
+      if (mvValid(prevMvRow[xmv3], ymv3, time)) {
+         mvcx[2] = prevMvRow[xmv3].mvx;
+         mvcy[2] = prevMvRow[xmv3].mvy;
+      }
+      else
+         mvcx[2] = mvcy[2] = 0;
+   }
+
+    for (j = 0, mv = mvcx, mvd = mvdx, mvptr = mvx,
+         picDim = mvcData->currLumWidth, mbCorner = x,
+         mvRangeLow = mvcData->mvRangeLowX,
+         mvRangeHigh = mvcData->mvRangeHighX;
+         j < 2;
+         j++, mv = mvcy, mvd = mvdy, mvptr = mvy, 
+         picDim = mvcData->currLumHeight, mbCorner = y,
+         mvRangeLow = mvcData->mvRangeLowY,
+         mvRangeHigh = mvcData->mvRangeHighY) {
+
+      int choice1, min, predictor;
+
+      /* Find the median of the candidates */
+
+      min = mv[0];
+      predictor = 32767;
+
+      for (i = 1; i < 3; i++) {
+         if (mv[i] <= min) {
+            predictor = min;
+            min = mv[i];
+            continue;
+         }
+         if (mv[i] < predictor)
+            predictor = mv[i];
+      }
+
+      /* Count the new motion vector value */
+
+      if (!unrestrictedMV) {
+         /* Default prediction mode.
+            Count the legal [-16..15.5] motion vector */
+
+         choice1 = predictor + mvd;
+
+         *mvptr = (MVD_MIN <= choice1 && choice1 <= MVD_MAX) ?
+            choice1 :
+            /*(mvd == 0) ?
+               predictor :*/ /* index 32, should never happen?! */
+               (mvd < 0) ?
+                  MVD_320 + choice1 : /* index 0..31: 32 + mvd + predictor */
+                  -MVD_320 + choice1; /* index 33..63: -32 + mvd + predictor */
+
+         /* Check that the result is [-16..15.5] */
+         if (*mvptr < MVD_MIN || *mvptr > MVD_MAX) {
+            *error = ERR_MVC_MVPTR;
+            return;
+         }
+      }
+
+      else if ((-MVD_155 <= predictor && predictor <= MVD_160) && (!fPLUSPTYPE))
+         /* Unrestricted motion vector mode && -15.5 <= predictor <= 16.
+            mvd is always valid. */
+         *mvptr = predictor + mvd;
+
+       else if (!fPLUSPTYPE)
+       {
+         /* Unrestricted motion vector mode && predictor not in [-15.5, 16]
+            Result in [-31.5, 31.5] and has the same sign as predictor */
+         choice1 = predictor + mvd;
+         *mvptr = (MVD_UMIN_V1 <= choice1 && choice1 <= MVD_UMAX_V1 &&
+            (sign123(choice1) & sign123(predictor))) ?
+            choice1 :
+            /*(mvd == 0) ?
+               predictor :*/ /* index 32, should never happen!? */
+               (mvd < 0) ?
+                  MVD_320 + choice1 : /* index 0..31: 32 + mvd + predictor */
+                  -MVD_320 + choice1; /* index 33..63: -32 + mvd + predictor */
+
+         /* Check that the result is in the appropriate range. */
+         if ((predictor < -MVD_155 && *mvptr > 0) ||
+            (predictor > MVD_160 && *mvptr < 0)) {
+            *error = ERR_MVC_MVPTR;
+            return;
+         }
+
+      }
+       else if (fUMVLimited)  
+      /* fPlusType==1 && UUI == 1*/
+      {
+         *mvptr = predictor + mvd;
+
+         if ( *mvptr > 0 )
+            /* mvRes is the leftmost/topmost pixels coordinate of next
+               macroblock plus 2 times MV */
+              mvRes = (mbCorner+1)*32 + (*mvptr)/5 ;
+           else
+             /* mvRes is the leftmost/topmost pixels coordinate of current
+               macroblock plus 2 times MV,
+            half a pixel corresponds to 1 in integer scale */
+               mvRes = mbCorner*32 + (*mvptr)/5 ;
+
+         if ((mvRes < -30) || (mvRes > picDim * 2 + 30))
+         /* Restriction D.1.1 */
+         {
+            *error = ERR_MVC_MVPTR;
+            deb("Restriction D.1.1\n");
+            return;
+         }
+      
+         if ((*mvptr < mvRangeLow) || (*mvptr > mvRangeHigh))
+         /* Restriction D.2 */
+         {
+            *error = ERR_MVC_MVPTR;
+            deb("Restriction D.2 \n");
+            return;
+         }
+      }
+      else  /* fPlusType==1 && UUI == 01 */
+      {
+         *mvptr = predictor + mvd;
+         if ( *mvptr > 0 )
+               mvRes = (mbCorner+1)*32 + (*mvptr)/5;
+           else
+               mvRes = mbCorner*32 + (*mvptr)/5;
+         if ((mvRes < -30) || (mvRes > picDim * 2 + 30))
+         /* Restriction D.1.1 */
+         {
+            *error = ERR_MVC_MVPTR;
+            deb("Restriction D.1.1\n");
+            return;
+         }
+      }
+   }
+
+   /* Update motion vector buffer arrays */
+   switch (predictorMode) {
+      case 0:
+         if (fourMVs) {
+            mvStore(mvRow1, xx2, yx2, *mvx, *mvy, time, mbType);
+         }
+         else {
+            mvStoreMB(mvRow1, mvRow2, xx2, yx2, *mvx, *mvy, time, mbType);
+         }
+         break;
+      case 1:
+         mvStore(mvRow1, xx2 + 1, yx2, *mvx, *mvy, time, mbType);
+         break;
+      case 2:
+         mvStore(mvRow2, xx2, yx2 + 1, *mvx, *mvy, time, mbType);
+         break;
+      case 3:
+         mvStore(mvRow2, xx2 + 1, yx2 + 1, *mvx, *mvy, time, mbType);
+         break;
+   }
+}
+
+
+/* {{-output"mvcCalcMPEGMV.txt"}} */
+/*
+ *
+ * mvcCalcMPEGMV
+ *
+ * Parameters:
+ *       mvcData        mvcData_t structure
+ *
+ *       mvdx           motion vector data returned by vlcGetMVD
+ *       mvdy
+ *
+ *       *mvx           the resulting motion vector is placed to *mvx and *mvy
+ *       *mvy
+ *
+ *       predictorMode  0, 1, 2 or 3. See H.263 recommendation, Annex F, Figure
+ *                      15, where modes are in the following order:
+ *                         0  1
+ *                         2  3
+ *
+ *                      Advanced Prediction mode: It is assumed that this
+ *                      function is called by setting predictorMode 0, 1, 2
+ *                      and 3 in this order for a particular macroblock.
+ *
+ *                      Normal: This function should be called by setting
+ *                      predictorMode to 0.
+ *
+ *       fourMVs        if != 0, four motion vectors for current macroblock
+ *                      is assumed
+ *
+ *       topOfVP        if != 0, the current MB is assumed to be in the
+ *                      first line of the current VideoPacket
+ *
+ *       leftOfVP       if != 0, the current MB is assumed to be the
+ *                      first in the VideoPacket
+ *
+ *       fmv3_out       if != 0, the 3rd MB (top, right) used as MV predictor
+ *                      is outside of the current VideoPacket
+ *
+ *       x              the x coordinate of the MB (0 .. maxX)
+ *       y              the y coordinate of the MB
+ *                      (0 .. macroblock rows in frame - 1)
+ *
+ *       time           a value which is related to the time when the current
+ *                      frame must be shown. This value should be unique
+ *                      among a relatively small group of consecutive frames.
+ *
+ *       mbType         must be MVC_MB_INTER or MVC_MB_INTRA. MVC_MB_INTRA 
+ *                      should be used only in PB frames mode.
+ *
+ *       error          error code
+ *
+ * Function:
+ *       This function counts the motion vector value for given macroblock.
+ *       See H.263 Recommendation 6.1.1 Differential Motion Vectors and
+ *       Annex F. Advanced Prediction Mode.
+ *
+ * Returns:
+ *       Changes *mvx, *mvy and possibly *error.
+ *
+ * Error codes:
+ *       The following codes are assertion-like checks:
+ *       ERR_MVC_MVDX_ILLEGAL    mvdx illegal
+ *       ERR_MVC_MVDY_ILLEGAL    mvdy illegal
+ *       ERR_MVC_MVX_ILLEGAL     mvx is NULL
+ *       ERR_MVC_MVY_ILLEGAL     mvy is NULL
+ *       ERR_MVC_MODE_ILLEGAL    predictorMode illegal
+ *       ERR_MVC_X_ILLEGAL       x < 0 or x > maxX
+ *       ERR_MVC_Y_ILLEGAL       y < 0
+ *       ERR_MVC_TIME_ILLEGAL    time < 0
+ *
+ *       The following code may also be caused by a bit error:
+ *       ERR_MVC_MVPTR           result is not legal
+ *
+ */
+
+void mvcCalcMPEGMV(mvcData_t *mvcData,
+   int mvdx, int mvdy, int *mvx, int *mvy,
+   u_char predictorMode, u_char fourMVs,
+   u_char topOfVP, u_char leftOfVP, u_char fmv3_out,
+   int x, int y, int time, int mbType, int16 *error)
+/* {{-output"mvccalc.txt"}} */
+{
+   int 
+      i, j,    /* loop variables */
+      mvcx[3], /* Candidates: mv[0] = MV1, mv[1] = MV2, mv[2] = MV3 */
+      mvcy[3],
+      mvc1_out = 0, mvc2_out = 0, mvc3_out = 0,
+      *mv,     /* mvcx or mvcy */
+      *mvptr,  /* == mvx or mvy */
+      mvd,     /* mvdx or mvdy */
+      xx2,     /* x * 2 */
+      yx2,     /* y * 2 */
+      xmv1,    /* index for MV1 */
+      xmv2,    /* index for MV2 */
+      xmv3,    /* index for MV3 */
+      ymv1,
+      ymv2,
+      ymv3;
+   mvRowItem_t
+      *currMvRow,
+      *prevMvRow,
+      *mvRow0,
+      *mvRow1,
+      *mvRow2;
+
+
+   if (!mvx) {
+      *error = ERR_MVC_MVX_ILLEGAL;
+      return;
+   }
+
+   if (!mvy) {
+      *error = ERR_MVC_MVY_ILLEGAL;
+      return;
+   }
+
+   if ((fourMVs && predictorMode > 3) ||
+      (!fourMVs && predictorMode > 0)) {
+      *error = ERR_MVC_MODE_ILLEGAL;
+      return;
+   }
+
+   if (x < 0 || x > mvcData->currMaxX) {
+      *error = ERR_MVC_X_ILLEGAL;
+      return;
+   }
+
+   if (y < 0) {
+      *error = ERR_MVC_Y_ILLEGAL;
+      return;
+   }
+
+   if (time < 0) {
+      *error = ERR_MVC_TIME_ILLEGAL;
+      return;
+   }
+
+   updateRowPointers(x, y, time);
+   mvRow0 = mvcData->mvRow0;
+   mvRow1 = mvcData->mvRow1;
+   mvRow2 = mvcData->mvRow2;
+
+   /* Seek candidate predictors */
+
+   xx2 = x << 1; /* xx2 = x * 2 */
+   yx2 = y << 1;
+
+   xmv1 = xx2 - 1 + (predictorMode & 1);
+   xmv2 = xx2 + (predictorMode == 1);
+   xmv3 = xx2 + 2 - (predictorMode > 1);
+   ymv1 = yx2 + (predictorMode > 1);
+   ymv2 = ymv3 = yx2 - 1 + (predictorMode > 1);
+
+   if (predictorMode <= 1) {
+      currMvRow = mvRow1;
+      prevMvRow = mvRow0;
+   }
+   else {
+      currMvRow = mvRow2;
+      prevMvRow = mvRow1;
+   }
+
+   if ((x == 0 || leftOfVP) && !(predictorMode & 1)) {
+      /* mv1 is outside the VP or VOP */
+      mvcx[0] = mvcy[0] = 0;
+      mvc1_out = 1;
+   }
+   else {
+      if (mvValidMPEG(currMvRow[xmv1], ymv1, time)) {
+          mvcx[0] = currMvRow[xmv1].mvx;
+          mvcy[0] = currMvRow[xmv1].mvy;
+      }
+      else mvcx[0] = mvcy[0] = 0;
+   }
+
+   if ((y == 0 || topOfVP) && predictorMode <= 1) {
+      /* mv2 is outside the VP or VOP */
+      mvcx[1] = mvcy[1] = 0;
+      mvc2_out = 1;
+   }
+   else {
+      if (mvValidMPEG(prevMvRow[xmv2], ymv2, time)) {
+         mvcx[1] = prevMvRow[xmv2].mvx;
+         mvcy[1] = prevMvRow[xmv2].mvy;
+      }
+      else mvcx[1] = mvcy[1] = 0;
+   }
+
+   if ((y == 0 || fmv3_out || x == mvcData->currMaxX) && predictorMode <= 1) {
+      /* mv3 is outside the VP or VOP */
+      mvcx[2] = mvcy[2] = 0;
+      mvc3_out = 1;
+   }
+   else {
+      if (mvValidMPEG(prevMvRow[xmv3], ymv3, time)) {
+         mvcx[2] = prevMvRow[xmv3].mvx;
+         mvcy[2] = prevMvRow[xmv3].mvy;
+      }
+      else
+         mvcx[2] = mvcy[2] = 0;
+   }
+
+   for (j = 0, mv = mvcx, mvd = mvdx, mvptr = mvx;
+      j < 2;
+      j++, mv = mvcy, mvd = mvdy, mvptr = mvy) {
+
+      int min, predictor;
+
+      switch (mvc1_out + mvc2_out + mvc3_out)
+      {
+         case 3:
+             predictor = 0;
+             break;
+         case 2:
+             predictor = mv[0] + mv[1] + mv[2];
+             break;
+         case 1:
+         case 0:
+             /* Find the median of the candidates */
+             min = mv[0];
+             predictor = 32767;
+
+             for (i = 1; i < 3; i++) {
+                 if (mv[i] <= min) {
+                     predictor = min;
+                     min = mv[i];
+                     continue;
+                 }
+                 if (mv[i] < predictor)
+                     predictor = mv[i];
+             }
+             break;
+         default:
+            /* Should never happen */
+            vdcAssert(0);
+            predictor = 0;
+            break;
+      }
+
+      /* Count the new motion vector value */
+      *mvptr = predictor + mvd;
+
+      if (*mvptr < -(mvcData->range))
+        *mvptr += 2*(mvcData->range);
+      else if (*mvptr > (mvcData->range)-5)
+        *mvptr -= 2*(mvcData->range);
+   }
+
+   /* Update motion vector buffer arrays */
+   switch (predictorMode) {
+      case 0:
+         if (fourMVs) {
+            mvStore(mvRow1, xx2, yx2, *mvx, *mvy, time, mbType);
+         }
+         else {
+            mvStoreMB(mvRow1, mvRow2, xx2, yx2, *mvx, *mvy, time, mbType);
+         }
+         break;
+      case 1:
+         mvStore(mvRow1, xx2 + 1, yx2, *mvx, *mvy, time, mbType);
+         break;
+      case 2:
+         mvStore(mvRow2, xx2, yx2 + 1, *mvx, *mvy, time, mbType);
+         break;
+      case 3:
+         mvStore(mvRow2, xx2 + 1, yx2 + 1, *mvx, *mvy, time, mbType);
+         break;
+   }
+}
+
+/* {{-output"mvcFree.txt"}} */
+/*
+ *
+ * mvcFree
+ *
+ * Parameters:
+ *    mvcData        mvcData_t structure
+ *
+ * Function:
+ *    This function frees the dynamic memory allocated by mvcStart.
+ *    mvcFree should be called at least when exiting the main program.
+ *    Alternatively it can be called whenever the playing a video has
+ *    ended.
+ *
+ * Returns:
+ *    Nothing
+ *
+ * Error codes:
+ *    None
+ *
+ *    
+ *    
+ *    
+ */
+
+void mvcFree(mvcData_t *mvcData)
+/* {{-output"mvcFree.txt"}} */
+{
+   if (mvcData) {
+      if (mvcData->mvRow) free(mvcData->mvRow);
+      mvcData->currMaxX = -1;
+   }
+}
+
+
+/* {{-output"mvcGetCurrentMVs.txt"}} */
+/*
+ *
+ * mvcGetCurrentMVs
+ *
+ * Parameters:
+ *       mvcData  mvcData_t structure
+ *       mvx
+ *       mvy
+ *       error    error code
+ *
+ * Function:
+ *       These functions return the motion vectors of the current 
+ *       blocks.
+ *
+ * Returns:
+ *       Changes mvx, mvy and possibly error.
+ *
+ * Error codes:
+ *
+ *    ERR_MVC_CURR_NOT_VALID        if the motion vectors for the current
+ *                                  macroblock do not exist
+ *
+ *    ERR_MVC_CURR_NOT_CODED        if the current macroblock was not coded
+ *
+ *    ERR_MVC_CURR_INTRA            if the current macroblock was coded in
+ *                                  INTRA mode
+ *
+ */
+void mvcGetCurrentMVs(mvcData_t *mvcData, int *mvx, int *mvy,
+   int16 *error)
+{
+   int
+      xx2 = mvcData->currX << 1,
+      yx2 = mvcData->currY << 1;
+   mvRowItem_t
+      *mvRow1 = mvcData->mvRow1,
+      *mvRow2 = mvcData->mvRow2;
+   if (mvValid(mvRow1[xx2], yx2, mvcData->currTime) &&
+         mvRow1[xx2].type == MVC_MB_INTER) {
+      mvx[0] = mvRow1[xx2].mvx;
+      mvx[1] = mvRow1[xx2 + 1].mvx;
+      mvx[2] = mvRow2[xx2].mvx;
+      mvx[3] = mvRow2[xx2 + 1].mvx;
+      mvy[0] = mvRow1[xx2].mvy;
+      mvy[1] = mvRow1[xx2 + 1].mvy;
+      mvy[2] = mvRow2[xx2].mvy;
+      mvy[3] = mvRow2[xx2 + 1].mvy;
+   }
+   else  {
+      mvx[0] = mvx[1] = mvx[2] = mvx[3] =
+      mvy[0] = mvy[1] = mvy[2] = mvy[3] = 0;
+      if mvLegal(mvRow1[xx2], yx2, mvcData->currTime) {
+         if (mvRow1[xx2].type == MVC_MB_NOT_CODED) {
+            /*deb("mvcGetCurrentMVs: ERROR - macroblock not coded.\n");*/
+            *error = ERR_MVC_CURR_NOT_CODED;
+         }
+         else if (mvRow1[xx2].type == MVC_MB_INTRA) {
+            /*deb("mvcGetCurrentMVs: ERROR - INTRA macroblock.\n");*/
+            *error = ERR_MVC_CURR_INTRA;
+         }
+         else {
+            /*deb("mvcGetCurrentMVs: ERROR - macroblock not valid.\n");*/
+            *error = ERR_MVC_CURR_NOT_VALID;
+         }
+      }
+      else {
+         /*deb("mvcGetCurrentMVs: ERROR - macroblock not valid.\n");*/
+         *error = ERR_MVC_CURR_NOT_VALID;
+      }
+   }
+}
+
+/* {{-output"mvcGetNeighbourMVs.txt"}} */
+/*
+ *
+ * mvcGetCurrNeighbourMVs
+ * mvcGetPrevNeighbourMVs
+ *
+ * Parameters:
+ *       mvcData  mvcData_t structure
+ *
+ *       nmvx     pointer to motion vector x component array
+ *       nmvy     pointer to motion vector y component array
+ *                The size of the array must be 6. The indexing of the
+ *                neighboring motion vectors goes like this:
+ *                (X = the motion vector which is investigated, i.e.
+ *                the last one decoded (mvcGetCurrNeighbourMVs) or
+ *                the one before the last one (mvcGetPrevNeighbourMVs))
+ *                     2 3
+ *                   0 X X 4
+ *                   1 X X 5
+ *                It is suggested that the following defines are used
+ *                instead of values:
+ *                   MVC_XM1_UP (0)
+ *                   MVC_XM1_DOWN (1)
+ *                   MVC_YM1_LEFT (2)
+ *                   MVC_YM1_RIGHT (3)
+ *                   MVC_XP1_UP (4)
+ *                   MVC_XP1_DOWN (5)
+ *                (M stand for minus and P for plus)
+ *
+ *       pmvx and pmvy are for mvcGetPrevNeighbourMVs only:
+ *       pmvx     pointer to the motion vector x component array of the
+ *                previous macroblock
+ *       pmvy     pointer to the motion vector y component array of the
+ *                previous macroblock
+ *                The size of the array must be 4. The indexing is similar
+ *                to normal block indexing inside a macroblock:
+ *                     0 1
+ *                     2 3
+ *
+ *       error    error code
+ *
+ * Function:
+ *       These functions return the motion vectors of the neighboring
+ *       blocks (on the left side, above or on the right side) of the
+ *       macroblock which is investigated, i.e.
+ *          - the last one decoded (mvcGetCurrNeighbourMVs) or
+ *          - the one before the last one (mvcGetPrevNeighbourMVs))
+ *
+ *       The H.263 standard for Overlapped motion compensation for luminance
+ *       (Annex F.3) is followed, that is:
+ *       If one of the surrounding macroblocks was not coded, the
+ *       corresponding remote motion vector is set to zero. If one of the
+ *       surrounding (macro)blocks was coded in INTRA mode, the corresponding
+ *       remote motion vector is replaced by the motion vector for the
+ *       current block expect when in PB-frames mode. In this case (INTRA
+ *       block in PB-frame mode), the INTRA block's motion vector is used.
+ *       If the current block is at the border of the picture and therefore
+ *       a surrounding block is not present, the corresponding remote motion
+ *       vector is replaced by the current motion vector.
+ *
+ *       mvcGetPrevNeighbourMVs also returns the motion vector for the
+ *       previous macroblock.
+ *
+ * Returns:
+ *       Changes nmvx, nmvy, pmvx, pmvy and possibly error.
+ *
+ * Error codes:
+ *    ERR_MVC_NO_PREV_MB            if the current MB has x coordinate 0 and
+ *                                  mvcGetPrevNeighbourMVs is called
+ *
+ *    ERR_MVC_NEIGHBOUR_NOT_VALID   if one of the neighboring MVs is not
+ *                                  valid, i.e. it has not been updated
+ *                                  for this frame. The MV in nmvx and nmvy
+ *                                  is set to zero.
+ *
+ *    for mvcGetPrevNeighbourMVs only:
+ *    ERR_MVC_PREV_NOT_VALID        if the motion vectors for the previous
+ *                                  macroblock do not exist
+ *
+ *    ERR_MVC_PREV_NOT_CODED        if the previous macroblock was not coded
+ *
+ *    ERR_MVC_PREV_INTRA            if the previous macroblock was coded in
+ *                                  INTRA mode
+ *
+ *    
+ *    
+ *    
+ *    
+ *    
+ *    
+ */
+
+void mvcGetCurrNeighbourMVs(mvcData_t *mvcData, int *nmvx, int *nmvy,
+   int16 *error)
+/* {{-output"mvcGetNeighbourMVs.txt"}} */
+{
+   mvRowItem_t
+      *mvRow1 = mvcData->mvRow1;
+   int xx2 = mvcData->currX << 1;
+
+   mvcGetNeighbourMVs(mvcData, mvcData->currX, mvcData->currY,
+      mvcData->currTime, nmvx, nmvy, 0, error);
+   if (*error)   {
+      if mvLegal(mvRow1[xx2], mvcData->currY << 1, mvcData->currTime) {
+         if (mvRow1[xx2].type == MVC_MB_NOT_CODED) {
+            /*deb("mvcGetPrevNeighbourMVs: ERROR - macroblock not coded.\n");*/
+            *error = ERR_MVC_CURR_NOT_CODED;
+         }
+         else if (mvRow1[xx2].type == MVC_MB_INTRA) {
+            /*deb("mvcGetPrevNeighbourMVs: ERROR - INTRA macroblock.\n");*/
+            *error = ERR_MVC_CURR_INTRA;
+         }
+         else {
+            /*deb("mvcGetPrevNeighbourMVs: ERROR - macroblock not valid.\n");*/
+            *error = ERR_MVC_CURR_NOT_VALID;
+         }
+      }
+      else {
+         /*deb("mvcGetPrevNeighbourMVs: ERROR - macroblock not valid.\n");*/
+         *error = ERR_MVC_CURR_NOT_VALID;
+      }
+   }
+}
+
+/* {{-output"mvcGetPrevNeighbourMVs.txt"}} */
+void mvcGetPrevNeighbourMVs(mvcData_t *mvcData, int *nmvx, int *nmvy,
+   int *pmvx, int *pmvy, u_char *fourMVs, int16 *error)
+/* {{-output"mvcGetPrevNeighbourMVs.txt"}} */
+{
+   int
+      currX = mvcData->currX,
+      currY = mvcData->currY;
+   mvRowItem_t
+      *mvRow1 = mvcData->mvRow1,
+      *mvRow2 = mvcData->mvRow2;
+
+   if (currX > 0) {
+      int xx2 = (currX - 1) << 1;
+      mvcGetNeighbourMVs(mvcData, currX - 1, currY,
+         mvcData->currTime, nmvx, nmvy, 1, error);
+      if (mvValid(mvRow1[xx2], currY << 1, mvcData->currTime) &&
+         mvRow1[xx2].type == MVC_MB_INTER) {
+         pmvx[0] = mvRow1[xx2].mvx;
+         pmvx[1] = mvRow1[xx2 + 1].mvx;
+         pmvx[2] = mvRow2[xx2].mvx;
+         pmvx[3] = mvRow2[xx2 + 1].mvx;
+         pmvy[0] = mvRow1[xx2].mvy;
+         pmvy[1] = mvRow1[xx2 + 1].mvy;
+         pmvy[2] = mvRow2[xx2].mvy;
+         pmvy[3] = mvRow2[xx2 + 1].mvy;
+         *fourMVs = mvRow1[xx2].fourMVs;
+      }
+      else {
+         pmvx[0] = pmvx[1] = pmvx[2] = pmvx[3] =
+         pmvy[0] = pmvy[1] = pmvy[2] = pmvy[3] = 0;
+         *fourMVs = 0;
+         if mvLegal(mvRow1[xx2], currY << 1, mvcData->currTime) {
+            if (mvRow1[xx2].type == MVC_MB_NOT_CODED) {
+               /*deb("mvcGetPrevNeighbourMVs: ERROR - macroblock not coded.\n");*/
+               *error = ERR_MVC_PREV_NOT_CODED;
+            }
+            else if (mvRow1[xx2].type == MVC_MB_INTRA) {
+               /*deb("mvcGetPrevNeighbourMVs: ERROR - INTRA macroblock.\n");*/
+               *error = ERR_MVC_PREV_INTRA;
+            }
+            else {
+               /*deb("mvcGetPrevNeighbourMVs: ERROR - macroblock not valid.\n");*/
+               *error = ERR_MVC_PREV_NOT_VALID;
+            }
+         }
+         else {
+            /*deb("mvcGetPrevNeighbourMVs: ERROR - macroblock not valid.\n");*/
+            *error = ERR_MVC_PREV_NOT_VALID;
+         }
+      }
+   }
+   else {
+      /*deb("mvcGetPrevNeighbourMVs: ERROR - no previous macroblock.\n");*/
+      *error = ERR_MVC_NO_PREV_MB;
+   }
+}
+
+
+/* {{-output"mvcGetPrevMVFsAndMVBs.txt"}} */
+/*
+ *
+ * mvcGetPrevMVFsAndMVBs
+ *
+ * Parameters:
+ *    mvcData           mvcData_t structure
+ *
+ *    mvfx              the resulting forward motion vector
+ *    mvfy
+ *
+ *    mvbx              the resulting backward motion vector
+ *    mvby
+ *
+ *    fourMVs           1 if there is four motion vectors per macroblock
+ *                      0 otherwise
+ *
+ * Function:
+ *    This function gets the forward and backward motion vectors for the
+ *    previous B macroblock.
+ *
+ * Returns:
+ *    Changes *mvfx, *mvfy, *mvbx, *mvby and *fourMVs.
+ *
+ * Error codes:
+ *    ERR_MVC_NO_PREV_MB            if the current MB has x coordinate 0 and
+ *                                  mvcGetPrevNeighbourMVs is called
+ *
+ *    ERR_MVC_PREV_NOT_VALID        if the motion vectors for the previous
+ *                                  macroblock do not exist
+ *
+ *    
+ */
+
+void mvcGetPrevMVFsAndMVBs(mvcData_t *mvcData, int *mvfx, int *mvfy,
+   int *mvbx, int *mvby, u_char *fourMVs, int16 *error)
+/* {{-output"mvcGetPrevMVFsAndMVBs.txt"}} */
+{
+   mvBFBufItem_t
+      *mvFBuf = mvcData->mvFBufArray[mvcData->mvBFBufIndex ^ 1],
+      *mvBBuf = mvcData->mvBBufArray[mvcData->mvBFBufIndex ^ 1];
+   int i;
+
+   if (mvcData->currX > 0) {
+      if (mvBBuf[0].x == mvcData->currX - 1 &&
+         mvValid(mvBBuf[0], mvcData->currY, mvcData->currTime)) {
+         *fourMVs = mvBBuf[0].fourMVs;
+         for (i = 0; i < 4; i++) {
+            mvfx[i] = mvFBuf[i].mvx;
+            mvfy[i] = mvFBuf[i].mvy;
+            mvbx[i] = mvBBuf[i].mvx;
+            mvby[i] = mvBBuf[i].mvy;
+         }
+      }
+      else {
+         /*deb("mvcGetPrevMVFsAndMVBs: ERROR - PREV_NOT_VALID.\n");*/
+         *error = ERR_MVC_PREV_NOT_VALID;
+      }
+   }
+   else {
+      /*deb("mvcGetPrevMVFsAndMVBs: ERROR - NO_PREV_MB.\n");*/
+      *error = ERR_MVC_NO_PREV_MB;
+   }
+}
+
+
+/* {{-output"mvcMarkMB.txt"}} */
+/*
+ *
+ * mvcMarkMBIntra
+ * mvcMarkMBNotCoded
+ *
+ * Parameters:
+ *    mvcData        mvcData_t structure
+ *    x              the x coordinate of the MB (0 .. maxX)
+ *    y              the y coordinate of the MB
+ *                   (0 .. macroblock rows in frame - 1)
+ *
+ *    time           a value which is related to the time when the current
+ *                   frame must be shown. This value should be unique
+ *                   among a relatively small group of consecutive frames.
+ *
+ * Function:
+ *    These functions are used to mark that the macroblock is either
+ *    intra coded or not coded at all. The information is used when
+ *    deciding the neighboring motion vectors of a macroblock in
+ *    mvcGetPrevNeighbourMVs and mvcGetCurrNeighbourMVs.
+ *    Note that mvcMarkMBIntra should not be called in case of
+ *    INTRA block in PB-frame mode. Instead mvcCalcMV should be used.
+ *
+ * Returns:
+ *    Nothing
+ *
+ * Error codes:
+ *    None
+ *
+ *    
+ *    
+ */
+
+void mvcMarkMBIntra(mvcData_t *mvcData, int x, int y, int time)
+/* {{-output"mvcMarkMB.txt"}} */
+{
+   int
+      xx2 = x << 1,
+      yx2 = y << 1;
+   mvRowItem_t
+      *mvRow1,
+      *mvRow2;
+
+   updateRowPointers(x, y, time);
+   mvRow1 = mvcData->mvRow1;
+   mvRow2 = mvcData->mvRow2;
+   mvStoreMB(mvRow1, mvRow2, xx2, yx2, MVD_INTRA, MVD_INTRA, time, MVC_MB_INTRA);
+}
+
+/* {{-output"mvcMarkMBNotCoded.txt"}} */
+void mvcMarkMBNotCoded(mvcData_t *mvcData, int x, int y, int time)
+/* {{-output"mvcMarkMBNotCoded.txt"}} */
+{
+   int
+      xx2 = x << 1,
+      yx2 = y << 1;
+   mvRowItem_t
+      *mvRow1,
+      *mvRow2;
+
+   updateRowPointers(x, y, time);
+   mvRow1 = mvcData->mvRow1;
+   mvRow2 = mvcData->mvRow2;
+   mvStoreMB(mvRow1, mvRow2, xx2, yx2, MVD_NOT_CODED,
+      MVD_NOT_CODED, time, MVC_MB_NOT_CODED);
+}
+
+
+/* {{-output"mvcStart.txt"}} */
+/*
+ *
+ * mvcStart
+ *
+ * Parameters:
+ *       mvcData        mvcData_t structure
+ *
+ *       maxX           the largest x coordinate possible for a macroblock
+ *                      If maxX if different from maxX when the function was
+ *                      last called, a new dynamic memory allocation is made.
+ *
+ *       lumWidth       Luminance width
+ *
+ *       lumHeight      Luminance height
+ *
+ *       error          error code
+ *
+ * Function:
+ *       This function initialises motion vector buffers. It also allocates
+ *       buffer memory if needed.
+ *       One should call mvcStart in the beginning of each video sequence.
+ *
+ * Returns:
+ *       Nothing
+ *
+ * Error codes:
+ *       ERR_MVC_ALLOC1          dynamic allocation error
+ *       ERR_MVC_MAX_X_ILLEGAL   maxX <= 0
+ *
+ *      
+ *      
+ *  
+ */
+
+void mvcStart(mvcData_t *mvcData, int maxX, int lumWidth, int lumHeight, int16 *error)
+/* {{-output"mvcStart.txt"}} */
+{
+   int
+      i, j, /* loop variables */
+      rowSize; /* the number of items in prevMV?Row */
+
+   if (maxX < 0) {
+      *error = ERR_MVC_MAX_X_ILLEGAL;
+      return;
+   }
+
+   rowSize = (maxX + 1) << 1;
+
+   if (mvcData->currMaxX != maxX || mvcData->mvRow == NULL) {
+      /* frame size changed */
+
+      if (mvcData->mvRow) free(mvcData->mvRow);
+
+      mvcData->mvRow = (mvRowItem_t *) vdcMalloc(
+         rowSize * 3 * sizeof(mvRowItem_t));
+      if (mvcData->mvRow == NULL) {
+         deb("mvcStart: ERROR - memory allocation failed.\n");
+         *error = ERR_MVC_ALLOC1;
+         return;
+      }
+
+      mvcData->currMaxX = maxX;
+   }
+   
+   /* Horizontal motion vector range when PLUSTYPE present and UUI = 1
+      See Table D.1/H.263 */
+   if (mvcData->currLumHeight != lumHeight)
+   {
+      mvcData->currLumHeight = lumHeight;
+      if ((lumHeight>=4)&&(lumHeight<=288))
+      {
+         mvcData->mvRangeLowY = -320;
+         mvcData->mvRangeHighY = 315;
+      }
+      else if ((lumHeight>=292)&&(lumHeight<=576))
+      {
+         mvcData->mvRangeLowY = -640;
+         mvcData->mvRangeHighY = 635;
+      }
+      else if ((lumHeight>=580)&&(lumHeight<=1152))
+      {
+         mvcData->mvRangeLowY = -1280;
+         mvcData->mvRangeHighY = 1275;
+      }
+   }
+
+   /* Vertical motion vector range when PLUSTYPE present and UUI = 1
+      See Table D.2/H.263 */
+   if (mvcData->currLumWidth != lumWidth)
+   {
+      mvcData->currLumWidth = lumWidth;
+      if ((lumWidth>=4)&&(lumWidth<=352))
+      {
+         mvcData->mvRangeLowX = -320;
+         mvcData->mvRangeHighX = 315;
+      }
+      else if ((lumWidth>=356)&&(lumWidth<=704))
+      {
+         mvcData->mvRangeLowX = -640;
+         mvcData->mvRangeHighX = 635;
+      }
+      else if ((lumWidth>=708)&&(lumWidth<=1408))
+      {
+         mvcData->mvRangeLowX = -1280;
+         mvcData->mvRangeHighX = 1275;
+      }
+      else if ((lumWidth>=1412)&&(lumWidth<=2048))
+      {
+         mvcData->mvRangeLowX = -2560;
+         mvcData->mvRangeHighX = 2555;
+      }
+   }
+   /* Set time to be impossible */
+   for (i = 0; i < 3 * rowSize; i++) {
+      mvcData->mvRow[i].time = -2;
+   }
+
+   for (j = 0; j < 2; j++) {
+      for (i = 0; i < 4; i++) {
+         mvcData->mvFBufArray[j][i].time = -2;
+         mvcData->mvBBufArray[j][i].time = -2;
+      }
+   }
+
+   mvcData->currX = -1;
+   mvcData->currY = -1;
+   mvcData->currTime = -2;
+   mvcData->mvRowIndex = 0;
+   mvcData->mvBFBufIndex = 0;
+   mvcData->prevPredMode = 3;
+}
+
+
+/* Local functions */
+
+
+
+/*
+ *
+ * mvcGetNeighbourMVs
+ *
+ * Parameters:
+ *       mvcData  mvcData_t structure
+ *       x
+ *       y        macroblock coordinates
+ *       time     time reference
+ *       nmvx     pointer to motion vector x component array
+ *       nmvy     pointer to motion vector y component array
+ *                See mvcGetCurrNeighbourMVs/mvcGetPrevNeighbourMVs for
+ *                description.
+ *       prevFlag If this flag is set, the previous border values should
+ *                be used.
+ *       error    error code
+ *
+ * Function:
+ *       This function return the motion vectors of the neighboring
+ *       blocks (on the left side, above or on the right side) of the
+ *       macroblock which is investigated. mvcGetNeighbourMVs is used
+ *       by mvcGetCurrNeighbourMVs and mvcGetPrevNeighbourMVs.
+ *       See also the functional description for these functions.
+ *
+ * Returns:
+ *       Changes nmvx and nmvy and possibly error.
+ *
+ * Error codes:
+ *    ERR_MVC_NEIGHBOUR_NOT_VALID   if one of the neighboring MVs is not
+ *                                  valid, i.e. it has not been updated
+ *                                  for this frame. The MV in nmvx and nmvy
+ *                                  is set to zero.
+ *
+ *    
+ */
+
+static void mvcGetNeighbourMVs(mvcData_t *mvcData, int x, int y, int time,
+   int *nmvx, int *nmvy, int prevFlag, int16 *error)
+{
+   int
+      xx2 = x << 1,
+      yx2 = y << 1,
+      xtmp,
+      ytmp,
+      rightOfBorder,
+      downOfBorder,
+      leftOfBorder;
+   mvRowItem_t
+      *mvRow0 = mvcData->mvRow0,
+      *mvRow1 = mvcData->mvRow1,
+      *mvRow2 = mvcData->mvRow2;
+
+   if (prevFlag)  {
+      rightOfBorder = mvcData->rightOfBorderPrev;
+      downOfBorder = (mvcData->fSS)?mvcData->downOfBorderPrev:(y==0);
+      leftOfBorder = 0;
+   }
+   else  {
+      rightOfBorder = mvcData->rightOfBorder;
+      downOfBorder = (mvcData->fSS)?mvcData->downOfBorder:(y==0);
+      leftOfBorder = (mvcData->fSS)?(x == mvcData->currMaxX)||(mvcData->leftOfBorder):(x == mvcData->currMaxX);
+   }
+   //if (x > 0) {
+   if (!rightOfBorder)  {
+      xtmp = xx2 - 1;
+      mvcCheckAndSet(mvRow1, xtmp, yx2, time, MVC_XM1_UP, nmvx, nmvy, 
+         mvRow1, xx2, yx2, error);
+      mvcCheckAndSet(mvRow2, xtmp, yx2 + 1, time, MVC_XM1_DOWN, nmvx, nmvy, 
+         mvRow2, xx2, yx2 + 1, error);
+   }
+   else {
+      mvcSetToCurrent(mvRow1, xx2, yx2, time, MVC_XM1_UP, nmvx, nmvy, 
+         error);
+      mvcSetToCurrent(mvRow2, xx2, yx2 + 1, time, MVC_XM1_DOWN, nmvx, nmvy, 
+         error);
+   }
+
+   //if (y > 0) {
+   if (!downOfBorder)   {
+      ytmp = yx2 - 1;
+      mvcCheckAndSet(mvRow0, xx2, ytmp, time, MVC_YM1_LEFT, nmvx, nmvy, 
+         mvRow1, xx2, yx2, error);
+      mvcCheckAndSet(mvRow0, xx2 + 1, ytmp, time, MVC_YM1_RIGHT, nmvx, nmvy,
+         mvRow1, xx2 + 1, yx2, error);
+   }
+   else {
+      mvcSetToCurrent(mvRow1, xx2, yx2, time, MVC_YM1_LEFT, nmvx, nmvy, 
+         error);
+      mvcSetToCurrent(mvRow1, xx2 + 1, yx2, time, MVC_YM1_RIGHT, nmvx, nmvy, 
+         error);
+   }
+
+   //if (x < mvcData->currMaxX) {
+   if (!leftOfBorder) {
+      xtmp = xx2 + 2;
+      mvcCheckAndSet(mvRow1, xtmp, yx2, time, MVC_XP1_UP, nmvx, nmvy, 
+         mvRow1, xtmp - 1, yx2, error);
+      mvcCheckAndSet(mvRow2, xtmp, yx2 + 1, time, MVC_XP1_DOWN, nmvx, nmvy,
+         mvRow2, xtmp -1, yx2 + 1, error);
+   }
+   else {
+      xtmp = xx2 + 1;
+      mvcSetToCurrent(mvRow1, xtmp, yx2, time, MVC_XP1_UP, nmvx, nmvy, 
+         error);
+      mvcSetToCurrent(mvRow2, xtmp, yx2 + 1, time, MVC_XP1_DOWN, nmvx, nmvy, 
+         error);
+   }
+}
+
+
+
+/*
+ * mvcCheckAndSet
+ *
+ * Parameters:
+ *    mvRowPtr    Source row item pointer
+ *    xind        x index of the source block
+ *    yind        y index of the source block
+ *    timeref     time reference
+ *    nind        index to motion vector arrays ( x and y)
+ *    nmvx        pointer to motion vector x component array
+ *    nmvy        pointer to motion vector y component array
+ *    cmvRowPtr   Target row item pointer
+ *    cxind       x index of the target block
+ *    cyind       y index of the target block
+ *    error       error code
+ *
+ * Function:
+ *       Sets the correct value for neighboring motion vector
+ *       used from: mvcGetNeighbourMVs 
+ *
+ * Returns:
+ *       Nothing
+ *
+ * Error codes:
+ *
+ */
+
+__inline static void mvcCheckAndSet( 
+      mvRowItem_t *mvRowPtr, int xind, int yind, int timeref, int nind, 
+      int *nmvx, int *nmvy, mvRowItem_t *cmvRowPtr, int cxind, int cyind,
+      int16 *error)
+{
+
+   if (mvLegal(mvRowPtr[xind], yind, timeref))  {
+      if (mvRowPtr[xind].mvx >= MVD_UMIN_V2) {
+         nmvx[nind] = mvRowPtr[xind].mvx; 
+         nmvy[nind] = mvRowPtr[xind].mvy; 
+      } 
+      else if (mvRowPtr[xind].mvx == MVD_INTRA) { 
+         if (mvLegal(cmvRowPtr[cxind], cyind, timeref)) { 
+            if (mvValid(cmvRowPtr[cxind], cyind, timeref)) { 
+               nmvx[nind] = cmvRowPtr[cxind].mvx; 
+               nmvy[nind] = cmvRowPtr[cxind].mvy; 
+            } 
+            else /* Not coded macroblock */ 
+               nmvx[nind] = nmvy[nind] = 0; 
+         } 
+         else { 
+            deb("mvcCheckAndSet: ERROR - neighbour not valid.\n"); 
+            *error = ERR_MVC_NEIGHBOUR_NOT_VALID; 
+            nmvx[nind] = nmvy[nind] = 0; 
+         } 
+      } 
+      else { /* MVD_NOT_CODED */ 
+         nmvx[nind] = nmvy[nind] = 0; 
+      } 
+   } 
+   else { 
+      deb("mvcCheckAndSet: ERROR - neighbour not valid.\n"); 
+      *error = ERR_MVC_NEIGHBOUR_NOT_VALID; 
+      nmvx[nind] = nmvy[nind] = 0; 
+   }
+}
+
+/*
+ * mvcSetToCurrent
+ *
+ * Parameters:
+ *    mvRowPtr    Current row item pointer
+ *    xind        x index of the block
+ *    yind        y index of the block
+ *    timeref     time reference
+ *    nind        index to motion vector arrays ( x and y)
+ *    nmvx        pointer to motion vector x component array
+ *    nmvy        pointer to motion vector y component array
+ *    error       error code
+ *
+ * Function:
+ *       Sets the correct value for neighboring motion vector using current
+ *       motion vector, used in cases of border used from: mvcGetNeighbourMVs
+ *
+ * Returns:
+ *       Nothing
+ *
+ * Error codes:
+ *
+ * History
+ */
+
+__inline static void mvcSetToCurrent( 
+      mvRowItem_t *mvRowPtr, int xind, int yind, int timeref, int nind,
+      int *nmvx, int *nmvy, int16 *error)
+{
+   if (mvValid(mvRowPtr[xind], yind, timeref)) { 
+      nmvx[nind] = mvRowPtr[xind].mvx; 
+      nmvy[nind] = mvRowPtr[xind].mvy; 
+   } 
+   else { 
+      deb("mvcSetToCurrent: ERROR - neighbour not valid.\n"); 
+      *error = ERR_MVC_NEIGHBOUR_NOT_VALID; 
+      nmvx[nind] = nmvy[nind] = 0; 
+   }
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/vdefrt.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,666 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Frame type -dependent settings.
+*
+*/
+
+
+
+
+/*
+ * Includes
+ */
+
+
+#include "h263dConfig.h"
+
+#include "vdefrt.h"
+#include "vde.h"
+#include "h263dapi.h"
+
+
+
+/*
+ * Defines
+ */
+
+/* The following two definitions are used to indicate that all image 
+   widths/heights belong to the scope of the correponding setting. */
+#define VDEFRT_ALL_WIDTHS 0
+#define VDEFRT_ALL_HEIGHTS 0
+
+
+/*
+ * Structures and typedefs
+ */
+
+/* Size list item */
+typedef struct {
+   LST_ITEM_SKELETON
+
+   int width;                    /* image width associated with this item */
+   int height;                   /* image height associated with this item */
+   u_char fSnapshot;             /* snapshot flag associated with this item */
+
+   u_int32 dataHandle;           /* handle to generic data */
+   void (*dealloc) (void *);     /* function for dataHandle dealloction */
+} vdeFrtSizeListItem_t;
+
+/* NOTE: Currently the snapshot scope must be used together with the frame 
+         size scope. It is not possible to store or retrieve an item based 
+         on the snapshot flag only. */
+
+/*
+ * Local function prototypes
+ */
+
+static int vdeFrtRemoveAll(vdeFrtStore_t *store);
+
+static int vdeFrtSeekSize(lst_t *sizeList, int width, int height, 
+   vdeFrtSizeListItem_t **seekHit);
+
+static int vdeFrtSeekItem(lst_t *sizeList, int width, int height, 
+   u_char fSnapshot, vdeFrtSizeListItem_t **seekHit);
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"vdeFrtClose.txt"}} */
+/*
+ * vdeFrtClose
+ *
+ * Parameters:
+ *    store                      a pointer to a frame type store
+ *
+ * Function:
+ *    This function closes the given frame type store.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeFrtClose(vdeFrtStore_t *store)
+/* {{-output"vdeFrtClose.txt"}} */
+{
+   int retValue;
+
+   retValue = vdeFrtRemoveAll(store);
+   if (retValue < 0)
+      return retValue;
+
+   if (lstClose(&store->sizeList) < 0)
+      return VDE_ERROR;
+
+   return VDE_OK;
+}
+
+
+/* {{-output"vdeFrtGetItem.txt"}} */
+/*
+ * vdeFrtGetItem
+ *
+ * Parameters:
+ *    store                      a pointer to a frame type store
+ *    frameType                  specifies the frame type for the wanted item
+ *    item                       used to return an item from the store
+ *
+ * Function:
+ *    This function fetches the item from the given store which corresponds
+ *    to the given frame type.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeFrtGetItem(vdeFrtStore_t *store, h263dFrameType_t *frameType, u_int32 *item)
+/* {{-output"vdeFrtGetItem.txt"}} */
+{
+   switch (frameType->scope) {
+      case H263D_FTYPE_NDEF:
+      case H263D_FTYPE_SIZE + H263D_FTYPE_SNAPSHOT:
+         {
+            int retValue;
+            vdeFrtSizeListItem_t *listItem;
+
+            /* seek item with matching size and snapshot flag */
+            retValue = vdeFrtSeekItem(&store->sizeList, frameType->width, 
+               frameType->height, frameType->fSnapshot, &listItem);
+            if (retValue < 0)
+               return retValue;
+
+            if (listItem)
+               *item = listItem->dataHandle;
+
+            else {
+               if (lstTail(&store->sizeList, (void **) &listItem) < 0)
+                  return VDE_ERROR;
+
+               /* If a default item exists */
+               if (listItem &&
+                  listItem->width == VDEFRT_ALL_WIDTHS && 
+                  listItem->height == VDEFRT_ALL_HEIGHTS)
+                  *item = listItem->dataHandle;
+
+               else {
+                  *item = 0;
+                  return VDE_OK_NOT_AVAILABLE;
+               }
+            }
+
+            return VDE_OK;
+
+         }
+
+      case H263D_FTYPE_SIZE:
+         {
+            int retValue;
+            vdeFrtSizeListItem_t *listItem;
+
+            retValue = vdeFrtSeekSize(&store->sizeList, frameType->width, 
+               frameType->height, &listItem);
+            if (retValue < 0)
+               return retValue;
+
+            if (listItem)
+               *item = listItem->dataHandle;
+
+            else {
+               if (lstTail(&store->sizeList, (void **) &listItem) < 0)
+                  return VDE_ERROR;
+
+               /* If a default item exists */
+               if (listItem &&
+                  listItem->width == VDEFRT_ALL_WIDTHS && 
+                  listItem->height == VDEFRT_ALL_HEIGHTS)
+                  *item = listItem->dataHandle;
+
+               else {
+                  *item = 0;
+                  return VDE_OK_NOT_AVAILABLE;
+               }
+            }
+
+            return VDE_OK;
+         }
+
+      case H263D_FTYPE_DEF:
+         {
+            vdeFrtSizeListItem_t *tailItem;
+
+            if (lstTail(&store->sizeList, (void **) &tailItem) < 0)
+               return VDE_ERROR;
+
+            /* If a default item exists */
+            if (tailItem->width == VDEFRT_ALL_WIDTHS && 
+               tailItem->height == VDEFRT_ALL_HEIGHTS) {
+               *item = tailItem->dataHandle;
+               return VDE_OK;
+            }
+
+            else {
+               *item = 0;
+               return VDE_OK_NOT_AVAILABLE;
+            }
+         }
+
+      default:
+         return VDE_ERROR;
+   }
+}
+
+
+/* {{-output"vdeFrtOpen.txt"}} */
+/*
+ * vdeFrtOpen
+ *
+ * Parameters:
+ *    store                      a pointer to a frame type store
+ *
+ * Function:
+ *    This function initializes the given frame type store.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeFrtOpen(vdeFrtStore_t *store)
+/* {{-output"vdeFrtOpen.txt"}} */
+{
+   if (lstOpen(&store->sizeList) < 0)
+      return VDE_ERROR;
+
+   return VDE_OK;
+}
+
+
+/* {{-output"vdeFrtPutItem.txt"}} */
+/*
+ * vdeFrtPutItem
+ *
+ * Parameters:
+ *    store                      a pointer to a frame type store
+ *    frameType                  specifies the frame type for the given item
+ *    item                       a data handle to store
+ *    removeItem                 a function which is used to deallocate
+ *                               the data handle when it is removed from
+ *                               the store. NULL may be given if no
+ *                               deallocation is needed.
+ *
+ * Function:
+ *    This function puts a data handle to the frame type store.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeFrtPutItem(vdeFrtStore_t *store, h263dFrameType_t *frameType, 
+   u_int32 item, void (*removeItem) (void *))
+/* {{-output"vdeFrtPutItem.txt"}} */
+{
+   switch (frameType->scope) {
+      case H263D_FTYPE_ALL:
+         {
+            int retValue;
+            vdeFrtSizeListItem_t *newItem;
+
+            retValue = vdeFrtRemoveAll(store);
+            if (retValue < 0)
+               return retValue;
+
+            newItem = (vdeFrtSizeListItem_t *) 
+               vdeMalloc(sizeof(vdeFrtSizeListItem_t));
+            if (!newItem)
+               return VDE_ERROR;
+
+            newItem->width = VDEFRT_ALL_WIDTHS;
+            newItem->height = VDEFRT_ALL_HEIGHTS;
+            newItem->fSnapshot = 0;
+            newItem->dataHandle = item;
+            newItem->dealloc = removeItem;
+
+            if (lstAdd(&store->sizeList, newItem) < 0) {
+               vdeDealloc(newItem);
+               return VDE_ERROR;
+            }
+
+            return VDE_OK;
+         }
+
+      case H263D_FTYPE_DEF:
+         {
+            vdeFrtSizeListItem_t *tailItem;
+
+            if (lstTail(&store->sizeList, (void **) &tailItem) < 0)
+               return VDE_ERROR;
+
+            /* If a default item exists */
+            if (tailItem->width == VDEFRT_ALL_WIDTHS && 
+               tailItem->height == VDEFRT_ALL_HEIGHTS) {
+
+               if (tailItem->dealloc)
+                  tailItem->dealloc((void *) tailItem->dataHandle);
+
+               /* Overwrite its data handle */
+               tailItem->dataHandle = item;
+            }
+
+            else {
+               vdeFrtSizeListItem_t *newItem;
+
+               newItem = (vdeFrtSizeListItem_t *) 
+                  vdeMalloc(sizeof(vdeFrtSizeListItem_t));
+               if (!newItem)
+                  return VDE_ERROR;
+
+               newItem->width = VDEFRT_ALL_WIDTHS;
+               newItem->height = VDEFRT_ALL_HEIGHTS;
+               newItem->fSnapshot = 0;
+               newItem->dataHandle = item;
+               newItem->dealloc = removeItem;
+
+               if (lstEnd(&store->sizeList) < 0) {
+                  vdeDealloc(newItem);
+                  return VDE_ERROR;
+               }
+
+               if (lstAdd(&store->sizeList, newItem) < 0) {
+                  vdeDealloc(newItem);
+                  return VDE_ERROR;
+               }
+            }
+
+            return VDE_OK;
+         }
+
+      case H263D_FTYPE_SIZE:
+         {
+            int retValue;
+            vdeFrtSizeListItem_t *listItem;
+
+            retValue = vdeFrtSeekSize(&store->sizeList, frameType->width, 
+               frameType->height, &listItem);
+            if (retValue < 0)
+               return retValue;
+
+            /* If a setting with the same size already exists */
+            if (listItem) {
+
+               if (listItem->dealloc)
+                  listItem->dealloc((void *) listItem->dataHandle);
+ 
+               /* Overwrite its data handle */
+               listItem->dataHandle = item;
+            }
+
+            else {
+               vdeFrtSizeListItem_t *newItem;
+
+               if (lstHead(&store->sizeList, (void **) &listItem) < 0)
+                  return VDE_ERROR;
+
+               newItem = (vdeFrtSizeListItem_t *) 
+                  vdeMalloc(sizeof(vdeFrtSizeListItem_t));
+               if (!newItem)
+                  return VDE_ERROR;
+
+               newItem->width = frameType->width;
+               newItem->height = frameType->height;
+               newItem->fSnapshot = 0;
+               newItem->dataHandle = item;
+               newItem->dealloc = removeItem;
+
+               if (lstAdd(&store->sizeList, newItem) < 0) {
+                  vdeDealloc(newItem);
+                  return VDE_ERROR;
+               }
+            }
+
+            return VDE_OK;
+         }
+
+      case H263D_FTYPE_SIZE + H263D_FTYPE_SNAPSHOT:
+         { 
+            int retValue;
+            vdeFrtSizeListItem_t *listItem;
+
+            retValue = vdeFrtSeekItem(&store->sizeList, frameType->width, 
+               frameType->height, frameType->fSnapshot, &listItem);
+            if (retValue < 0)
+               return retValue;
+
+            /* If a setting with the same parameters already exists */
+            if (listItem) {
+
+               if (listItem->dealloc)
+                  listItem->dealloc((void *) listItem->dataHandle);
+ 
+               /* Overwrite its data handle */
+               listItem->dataHandle = item;
+            }
+
+            else {
+               vdeFrtSizeListItem_t *newItem;
+
+               if (lstHead(&store->sizeList, (void **) &listItem) < 0)
+                  return VDE_ERROR;
+
+               newItem = (vdeFrtSizeListItem_t *) 
+                  vdeMalloc(sizeof(vdeFrtSizeListItem_t));
+               if (!newItem)
+                  return VDE_ERROR;
+
+               newItem->width = frameType->width;
+               newItem->height = frameType->height;
+               newItem->fSnapshot = frameType->fSnapshot;
+               newItem->dataHandle = item;
+               newItem->dealloc = removeItem;
+
+               if (lstAdd(&store->sizeList, newItem) < 0) {
+                  vdeDealloc(newItem);
+                  return VDE_ERROR;
+               }
+            }
+
+            return VDE_OK;           
+
+         }
+      default:
+         return VDE_ERROR;
+   }
+}
+
+
+/* {{-output"vdeFrtRemoveItem.txt"}} */
+/*
+ * vdeFrtRemoveItem
+ *
+ * Parameters:
+ *    store                      a pointer to a frame type store
+ *    frameType                  specifies the frame type for the item to remove
+ *
+ * Function:
+ *    This function removes an entry from the given frame type store.
+ *    The entry corresponds to the given frame type.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeFrtRemoveItem(vdeFrtStore_t *store, h263dFrameType_t *frameType)
+/* {{-output"vdeFrtRemoveItem.txt"}} */
+{
+   switch (frameType->scope) {
+      case H263D_FTYPE_ALL:
+         {
+            int retValue;
+
+            retValue = vdeFrtRemoveAll(store);
+            if (retValue < 0)
+               return retValue;
+
+            return VDE_OK;
+         }
+
+      case H263D_FTYPE_DEF:
+         {
+            vdeFrtSizeListItem_t *tailItem;
+
+            if (lstTail(&store->sizeList, (void **) &tailItem) < 0)
+               return VDE_ERROR;
+
+            /* If a default item exists */
+            if (tailItem && tailItem->width == VDEFRT_ALL_WIDTHS && 
+               tailItem->height == VDEFRT_ALL_HEIGHTS) {
+
+               /* Remove it */
+               if (lstRemove(&store->sizeList, (void **) &tailItem) < 0)
+                  return VDE_ERROR;
+
+               if (tailItem->dealloc)
+                  tailItem->dealloc((void *) tailItem->dataHandle);
+                  
+               vdeDealloc(tailItem); 
+            }
+
+            return VDE_OK;
+         }
+
+      case H263D_FTYPE_SIZE:
+         {
+            int retValue;
+            vdeFrtSizeListItem_t *listItem;
+
+            retValue = vdeFrtSeekSize(&store->sizeList, frameType->width, 
+               frameType->height, &listItem);
+            if (retValue < 0)
+               return retValue;
+
+            /* If an item with the same size already exists */
+            if (listItem) {
+
+               /* Remove it */
+               if (lstRemove(&store->sizeList, (void **) &listItem) < 0)
+                  return VDE_ERROR;
+
+               if (listItem->dealloc)
+                  listItem->dealloc((void *) listItem->dataHandle);
+                  
+               vdeDealloc(listItem); 
+            }
+
+            return VDE_OK;
+         }
+
+      case H263D_FTYPE_SIZE + H263D_FTYPE_SNAPSHOT:
+         {
+            int retValue;
+            vdeFrtSizeListItem_t *listItem;
+
+            retValue = vdeFrtSeekItem(&store->sizeList, frameType->width, 
+               frameType->height, frameType->fSnapshot, &listItem);
+            if (retValue < 0)
+               return retValue;
+
+            /* If an item with the same parameters already exists */
+            if (listItem) {
+
+               /* Remove it */
+               if (lstRemove(&store->sizeList, (void **) &listItem) < 0)
+                  return VDE_ERROR;
+
+               if (listItem->dealloc)
+                  listItem->dealloc((void *) listItem->dataHandle);
+                  
+               vdeDealloc(listItem); 
+            }
+            return VDE_OK;
+
+         }
+
+      default:
+         return VDE_ERROR;
+   }
+}
+
+
+/*
+ * Local functions
+ */
+
+/*
+ * vdeFrtRemoveAll
+ *    This function removes all items from the given store.
+ */
+
+static int vdeFrtRemoveAll(vdeFrtStore_t *store)
+{
+   vdeFrtSizeListItem_t *listItem;
+
+   if (lstHead(&store->sizeList, (void **) &listItem) < 0)
+      return VDE_ERROR;
+
+   do {
+      if (lstRemove(&store->sizeList, (void **) &listItem) < 0)
+         return VDE_ERROR;
+
+      if (listItem) {
+         if (listItem->dealloc)
+            listItem->dealloc((void *) listItem->dataHandle);      
+         vdeDealloc(listItem);
+      }
+   } while (listItem);
+
+   return VDE_OK;
+}
+
+
+/*
+ * vdeFrtSeekSize
+ *    This function seeks for the given width and height from the given 
+ *    size list. It returns the matching size list item (if there is one).
+ */
+
+static int vdeFrtSeekSize(lst_t *sizeList, int width, int height, 
+   vdeFrtSizeListItem_t **seekHit)
+{
+   vdeFrtSizeListItem_t *listItem;
+
+   *seekHit = NULL;
+
+   if (lstHead(sizeList, (void **) &listItem) < 0)
+      return VDE_ERROR;
+
+   while (listItem) {
+      if (lstNext(sizeList, (void **) &listItem) < 0)
+         return VDE_ERROR;
+
+      if (listItem && listItem->width == width && listItem->height == height) {
+         *seekHit = listItem;
+         break;
+      }
+   }
+
+   return VDE_OK;
+}
+
+/*
+ * vdeFrtSeekItem
+ *    This function seeks for an item with the given parameters from the 
+ *    size list. It returns the matching list item (if there is one).
+ */
+
+static int vdeFrtSeekItem(lst_t *sizeList, int width, int height, 
+   u_char fSnapshot, vdeFrtSizeListItem_t **seekHit)
+{
+   vdeFrtSizeListItem_t *listItem;
+
+   *seekHit = NULL;
+
+   if (lstHead(sizeList, (void **) &listItem) < 0)
+      return VDE_ERROR;
+
+   while (listItem) {
+
+      if (listItem && listItem->width == width && listItem->height == height &&
+          listItem->fSnapshot == fSnapshot) {
+         *seekHit = listItem;
+         break;
+      }
+      if (lstNext(sizeList, (void **) &listItem) < 0)
+        return VDE_ERROR;
+   }
+
+   return VDE_OK;
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/vdeimb.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Individual image buffer handling.
+*
+*/
+
+
+/*
+ * Includes
+ */
+
+
+#include "h263dConfig.h"
+#include "vdeimb.h"
+
+#include "vde.h"
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"vdeImbAlloc.txt"}} */
+/*
+ * vdeImbAlloc
+ *
+ * Parameters:
+ *    width                      width of the luminance image in pixels
+ *    height                     height of the luminance image in pixels
+ *
+ * Function:
+ *    This function allocates and initializes a new image buffer of
+ *    requested size.
+ *
+ * Returns:
+ *    a pointer to the created image buffer,
+ *    or NULL if the function failed
+ *
+ *    
+ */
+
+vdeImb_t *vdeImbAlloc(int width, int height, int fYuvNeeded)
+/* {{-output"vdeImbAlloc.txt"}} */
+{
+   vdeImb_t *imb;
+
+   imb = (vdeImb_t *) vdeMalloc(sizeof(vdeImb_t));
+   if (imb == NULL)
+      return NULL;
+   memset(imb, 0, sizeof(vdeImb_t));
+
+
+   imb->drawItem = renDriAlloc(width, height, fYuvNeeded);
+   if (imb->drawItem == NULL)
+      goto errRenDriAlloc;
+   {
+      int numMBsInPicture;
+      
+      numMBsInPicture = width * height / 256;
+
+      imb->yQuantParams = (int *) vdeMalloc(numMBsInPicture * sizeof(int));
+      if (imb->yQuantParams == NULL)
+         goto errYQuantParams;
+
+      imb->uvQuantParams = (int *) vdeMalloc(numMBsInPicture * sizeof(int));
+      if (imb->uvQuantParams == NULL)
+         goto errUVQuantParams;
+
+   }
+
+   return imb;
+
+   /* Error situations: release everything in reverse order */
+
+errUVQuantParams:
+
+      vdeDealloc(imb->yQuantParams);
+errYQuantParams:
+
+      renDriFree(imb->drawItem);
+
+errRenDriAlloc:
+
+   vdeDealloc(imb);
+
+   return NULL;
+}
+
+
+/* {{-output"vdeImbCopyParameters.txt"}} */
+/*
+ * vdeImbCopyParameters
+ *
+ * Parameters:
+ *    dstImb                     destination image buffer
+ *    srcImb                     source image buffer
+ *
+ * Function:
+ *    This function copies the srcImb structure to the dstImb structure.
+ *    All other parameters are copied but the actual picture contents.
+ *    The function handles nested structures correctly.
+ *
+ * Returns:
+ *    (See vde.h for descriptions of return values.)
+ *    VDE_OK
+ *    VDE_ERROR
+ *
+ *    
+ */
+
+int vdeImbCopyParameters(vdeImb_t *dstImb, const vdeImb_t *srcImb)
+/* {{-output"vdeImbCopyParameters.txt"}} */
+{
+   /* drawItem */
+   renDriCopyParameters(dstImb->drawItem, srcImb->drawItem);
+
+   dstImb->fReferenced = srcImb->fReferenced;
+   dstImb->tr = srcImb->tr;
+   dstImb->trRef = srcImb->trRef;
+
+   {
+      int numOfMBs = renDriNumOfMBs(srcImb->drawItem);
+
+      /* yQuantParams */
+      memcpy(
+         dstImb->yQuantParams, 
+         srcImb->yQuantParams, 
+         numOfMBs * sizeof(int));
+      
+      /* uvQuantParams */
+      memcpy(
+         dstImb->uvQuantParams, 
+         srcImb->uvQuantParams, 
+         numOfMBs * sizeof(int));
+
+   }
+
+   return VDE_OK;
+}
+
+
+/* {{-output"vdeImbDealloc.txt"}} */
+/*
+ * vdeImbDealloc
+ *
+ * Parameters:
+ *    imb                        a pointer to image buffer to destroy
+ *
+ * Function:
+ *    This function deallocates the given image buffer.
+ *
+ * Returns:
+ *    Nothing
+ *
+ *    
+ */
+
+void vdeImbDealloc(vdeImb_t *imb)
+/* {{-output"vdeImbDealloc.txt"}} */
+{
+   if (!imb)
+      return;
+
+   if (imb->drawItem)
+      renDriFree(imb->drawItem);
+
+    vdeDealloc(imb->yQuantParams);
+    vdeDealloc(imb->uvQuantParams);
+
+   vdeDealloc(imb);
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/vdeims.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,643 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Frame memory organization module.
+*
+*/
+
+
+
+
+/*
+ * Includes
+ */
+
+
+#include "h263dConfig.h"
+#include "vdeims.h"
+
+#include "debug.h"
+#include "vde.h"
+#include "vdeimb.h"
+
+
+/*
+ * Structs and typedefs
+ */
+
+/* Structure for a single "Free" store */
+typedef struct {
+   LST_ITEM_SKELETON
+
+   lifo_t freeStore;    /* a stack of free image store items */
+   int lumWidth;        /* width of the items in freeStore */
+   int lumHeight;       /* height of the items in freeStore
+                           (in luminance pixels) */
+   int fYuvNeeded;                            
+} vdeImsFreeStore_t;
+
+
+/*
+ * Local function prototypes
+ */
+
+static vdeImsItem_t *vdeImsAllocItem(int lumWidth, int lumHeight, int fYuvNeeded);
+
+static vdeImsFreeStore_t *vdeImsAllocFreeStore(int numFreeItems, 
+   int lumWidth, int lumHeight, int fYuvNeeded);
+
+static int vdeImsDeallocFreeStore(vdeImsFreeStore_t *store);
+
+static int vdeImsGetFreeStore(lst_t *freeStoreList, int lumWidth, int lumHeight,
+   vdeImsFreeStore_t **freeStore);
+
+
+/*
+ * Global functions
+ */
+
+/* {{-output"vdeImsChangeReference.txt"}} */
+/*
+ * vdeImsChangeReference
+ *    
+ *
+ * Parameters:
+ *    store                      a pointer to an image store
+ *    newItem                    new reference frame to replace a corresponding
+ *                               reference frame in the image store
+ *
+ * Function:
+ *    This function is used to change a reference frame in the image store.
+ *    The function is passed a new reference frame. Then, the function
+ *    searches for a reference frame with the same TR as the passed frame
+ *    (from the image store). If such a frame is found, the function
+ *    takes the old referece frame away from the reference store and puts
+ *    it to the free or idle store depending on whether the frame has already
+ *    been displayed or not. The new reference frame is placed into 
+ *    the reference store. If a corresponding reference frame is not found
+ *    from the image store, the function returns VDE_OK_NOT_AVAILABLE.
+ *
+ *    This function is intended to be used together with error concealment
+ *    methods capable of repairing past frames.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_OK_NOT_AVAILABLE       the function behaved as expected but
+ *                               a requested frame was not found
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeImsChangeReference(vdeIms_t *store, vdeImsItem_t *newItem)
+/* {{-output"vdeImsChangeReference.txt"}} */
+{
+   vdeImsItem_t *oldItem; /* old reference frame */
+
+    /* Note: This case may not be ever used, but it is supported for 
+     consistency */
+
+    /* If the TRs of the reference frames do not match */
+    if (store->refFrame->imb->tr == newItem->imb->tr)
+     /* Return with not found indication */
+     return VDE_OK_NOT_AVAILABLE;
+
+    /* Store the new reference to the image store */
+    oldItem = store->refFrame;
+    store->refFrame = newItem;
+
+    /* Add the old reference to the "Free" store */
+    if (vdeImsPutFree(store, oldItem) < 0)
+         return VDE_ERROR;
+
+   return VDE_OK;
+}
+
+
+/* {{-output"vdeImsClose.txt"}} */
+/*
+ * vdeImsClose
+ *    
+ *
+ * Parameters:
+ *    store                      a pointer to an image store
+ *
+ * Function:
+ *    This function closes the given image store.
+ *    Notice that the memory pointed by the given image store pointer is not
+ *    deallocated but rather it is assumed that this memory is either static
+ *    or externally deallocated.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeImsClose(vdeIms_t *store)
+/* {{-output"vdeImsClose.txt"}} */
+{
+   vdeImb_t *imb;
+   vdeImsFreeStore_t *freeStore;
+   vdeImsItem_t *pItem;
+
+   /* freeStoreList */
+   if (lstHead(&store->freeStoreList, (void **) &freeStore) < 0)
+      return VDE_ERROR;
+
+   do {
+      if (lstRemove(&store->freeStoreList, (void **) &freeStore) < 0)
+         return VDE_ERROR;
+      
+      if (freeStore) {
+         if (vdeImsDeallocFreeStore(freeStore) < 0)
+            return VDE_ERROR;
+      }
+   } while (freeStore);
+
+   if (lstClose(&store->freeStoreList) < 0)
+      return VDE_ERROR;
+
+   if (store->refFrame) {
+     vdeImbDealloc(store->refFrame->imb);
+     vdeDealloc(store->refFrame);
+   }
+
+   /* idleStore */
+   if (lstHead(&store->idleStore, (void **) &pItem) < 0)
+      return VDE_ERROR;
+
+   do {
+      if (lstRemove(&store->idleStore, (void **) &pItem) < 0)
+         return VDE_ERROR;
+
+      if (pItem) {
+         imb = pItem->imb;
+         vdeDealloc(pItem);
+         vdeImbDealloc(imb);
+      }
+   } while (pItem);
+
+   if (lstClose(&store->idleStore) < 0)
+      return VDE_ERROR;
+
+   return VDE_OK;
+}
+
+
+
+/* {{-output"vdeImsGetFree.txt"}} */
+/*
+ * vdeImsGetFree
+ *    
+ *
+ * Parameters:
+ *    store                      a pointer to an image store
+ *    lumWidth                   width of the luminance image (in pixels)
+ *    lumHeight                  height of the luminance image (in pixels)
+ *    item                       a free image store item
+ *
+ * Function:
+ *    This function is used to get a free frame memory (of requested size).
+ *    If a free frame memory (image store item) does not exist, a new one
+ *    is allocated and initialized.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeImsGetFree(vdeIms_t *store, int lumWidth, int lumHeight, 
+   vdeImsItem_t **item)
+/* {{-output"vdeImsGetFree.txt"}} */
+{
+   vdeImsFreeStore_t *freeStore, *tmpFreeStore;
+   vdeImsItem_t *pItem;
+
+   if (vdeImsGetFreeStore(&store->freeStoreList, lumWidth, lumHeight, 
+      &freeStore) < 0)
+      return VDE_ERROR;
+
+   if (freeStore) {
+      if (lifoGet(&freeStore->freeStore, (void **) &pItem) < 0)
+         return VDE_ERROR;
+      if (pItem) {
+         *item = pItem;
+         return VDE_OK;
+      }
+      else {
+         *item = vdeImsAllocItem(lumWidth, lumHeight, store->fYuvNeeded);
+         return VDE_OK;
+      }
+   }
+
+   else {
+      freeStore = vdeImsAllocFreeStore(0, lumWidth, lumHeight, store->fYuvNeeded);
+      if (freeStore == NULL)
+         return VDE_ERROR;
+
+      if (lstHead(&store->freeStoreList, (void **) &tmpFreeStore) < 0) {
+         vdeImsDeallocFreeStore(freeStore);
+         return VDE_ERROR;
+      }
+
+      if (lstAdd(&store->freeStoreList, freeStore) < 0) {
+         vdeImsDeallocFreeStore(freeStore);
+         return VDE_ERROR;
+      }
+
+      *item = vdeImsAllocItem(lumWidth, lumHeight, store->fYuvNeeded);
+      return VDE_OK;
+   }
+}
+
+
+/* {{-output"vdeImsGetReference.txt"}} */
+/*
+ * vdeImsGetReference
+ *    
+ *
+ * Parameters:
+ *    store                      a pointer to an image store
+ *    mode                       VDEIMS_REF_LATEST = latest reference frame
+ *                               VDEIMS_REF_OLDEST = oldest reference frame
+ *                               VDEIMS_REF_TR = frame specified by tr,
+ *                                  see also the explation for
+ *                                  VDEIMS_GET_CLOSEST_REFERENCE
+ *                                  in the module description at the beginning
+ *                                  of this file
+ *    tr                         if mode is equal to VDEIMS_REF_TR,
+ *                               this parameter specifies the TR (temporal
+ *                               reference) of the reference frame
+ *    item                       used to return the specified reference frame
+ *
+ * Function:
+ *    This function is used to get a reference frame memory (image store item).
+ *    One can either query for the latest reference frame or for a frame
+ *    having a certain temporal reference value.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeImsGetReference(vdeIms_t *store, int mode, int tr, vdeImsItem_t **item)
+/* {{-output"vdeImsGetReference.txt"}} */
+{
+   vdeAssert(
+      mode == VDEIMS_REF_LATEST || 
+      mode == VDEIMS_REF_OLDEST || 
+      mode == VDEIMS_REF_TR);
+
+   switch (mode) {
+      case VDEIMS_REF_LATEST:
+         *item = store->refFrame;
+         break;
+
+      case VDEIMS_REF_OLDEST:
+         *item = store->refFrame;
+         break;
+
+      case VDEIMS_REF_TR:
+         /* This section of code returns the reference frame having the same
+            TR as requested. If there is no such TR, the code returns a NULL
+            frame. */
+         if (store->refFrame->imb->tr == tr)
+             *item = store->refFrame;
+         else
+             *item = NULL;
+         break;
+   }        
+
+   return VDE_OK;
+}
+
+
+/* {{-output"vdeImsOpen.txt"}} */
+/*
+ * vdeImsOpen
+ *    
+ *
+ * Parameters:
+ *    store                      a pointer to an image store
+ *    numFreeItems               number of initial free image store items
+ *    lumWidth                   width of the luminance image (in pixels)
+ *                               for free items
+ *    lumHeight                  height of the luminance image (in pixels)
+ *                               for free items
+ *
+ * Function:
+ *    This function initializes the given image store. The function allocates
+ *    and initializes a given number of free image store items of given size.
+ *    The Reference image store is initialized to carry multiple image store
+ *    items, if the Reference Picture Selection mode is indicated. Otherwise,
+ *    the Reference image store carries only one image store item at a time.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeImsOpen(vdeIms_t *store, int /*numFreeItems*/, int /*lumWidth*/, int /*lumHeight*/)
+{
+   vdeImsFreeStore_t *freeStore;
+
+   store->refFrame = 0;
+
+   if (lstOpen(&store->idleStore) < 0)
+      goto errIdleStore;
+   
+// not ready to open freeStore yet
+    freeStore = NULL;
+
+   if (lstOpen(&store->freeStoreList) < 0)
+      goto errOpenFreeStoreList;
+
+
+   return VDE_OK;
+
+   /* Error cases */
+   errOpenFreeStoreList:
+
+   vdeImsDeallocFreeStore(freeStore);
+
+   lstClose(&store->idleStore);
+   errIdleStore:
+
+   return VDE_ERROR;
+}
+
+void vdeImsSetYUVNeed(vdeIms_t *store, int fYuvNeeded)
+{
+    store->fYuvNeeded = fYuvNeeded;
+}
+    
+/* {{-output"vdeImsPut.txt"}} */
+/*
+ * vdeImsPut
+ *    
+ *
+ * Parameters:
+ *    store                      a pointer to an image store
+ *    item                       image store item to put into the image store
+ *
+ * Function:
+ *    This function is used to return a filled image store item into
+ *    the image store. If the item is possibly referenced later on, it is
+ *    stored into the Reference store. If the item is not referenced but
+ *    it is going to be displayed, it is put into the Idle store.
+ *    Otherwise, the item is put into the Free store. 
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeImsPut(vdeIms_t *store, vdeImsItem_t *item)
+/* {{-output"vdeImsPut.txt"}} */
+{
+   vdeImb_t *imb;
+
+   imb = item->imb;
+
+   /* If the item is referenced */
+   if (imb->fReferenced) {
+
+     /* If an old reference exists */
+     if (store->refFrame) {
+       /* Add the old reference to the "Free" store */
+       if (vdeImsPutFree(store, store->refFrame) < 0)
+          return VDE_ERROR;
+     }
+
+     store->refFrame = item;
+   }
+
+   /* Else (the item is not referenced) */
+   else {
+     /* Add the item to the "Free" store */
+     if (vdeImsPutFree(store, item) < 0)
+        return VDE_ERROR;
+   }
+
+   return VDE_OK;
+}
+
+
+/* {{-output"vdeImsPutFree.txt"}} */
+/*
+ * vdeImsPutFree
+ *    
+ *
+ * Parameters:
+ *    store                      a pointer to an image store
+ *    item                       image store item to put into the Free store
+ *
+ * Function:
+ *    This function puts an image store item to a suitable Free store
+ *    of the passed image store. It selects the Free store according to 
+ *    the image size or creates a new Free store if a suitable Free store 
+ *    does not already exist.
+ *
+ *    One can use this function instead of vdeImsPut to explicitly discard
+ *    an image store item (whereas for vdeImsPut, one would have to set
+ *    the correct flags and pass a NULL renderer handle to get the same
+ *    effect).
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  if an error occured
+ *
+ *    
+ */
+
+int vdeImsPutFree(vdeIms_t *store, vdeImsItem_t *item)
+/* {{-output"vdeImsPutFree.txt"}} */
+{
+   vdeImsFreeStore_t *freeStore, *tmpFreeStore;
+   int 
+      lumWidth = renDriBitmapWidth(item->imb->drawItem),
+      lumHeight = renDriBitmapHeight(item->imb->drawItem);
+
+   if (vdeImsGetFreeStore(&store->freeStoreList, lumWidth, 
+      lumHeight, &freeStore) < 0)
+      return VDE_ERROR;
+
+   if (freeStore == NULL) {
+      /* The same algorithm as in vdeImsGetFree */
+      freeStore = vdeImsAllocFreeStore(0, lumWidth, lumHeight, store->fYuvNeeded);
+      if (freeStore == NULL)
+         return VDE_ERROR;
+
+      if (lstHead(&store->freeStoreList, (void **) &tmpFreeStore) < 0) {
+         vdeImsDeallocFreeStore(freeStore);
+         return VDE_ERROR;
+      }
+
+      if (lstAdd(&store->freeStoreList, freeStore) < 0) {
+         vdeImsDeallocFreeStore(freeStore);
+         return VDE_ERROR;
+      }
+   }
+
+   if (lifoPut(&freeStore->freeStore, item) < 0)
+      return VDE_ERROR;
+
+   return VDE_OK;
+}
+
+
+
+
+/*
+ * Local functions
+ */
+
+/*
+ * vdeImsAllocItem
+ *    This function allocates and initializes a new image store item
+ *    of given size.
+ */
+
+static vdeImsItem_t *vdeImsAllocItem(int lumWidth, int lumHeight, int fYuvNeeded)
+{
+   vdeImb_t *imb;
+   vdeImsItem_t *pItem;
+
+   imb = vdeImbAlloc(lumWidth, lumHeight, fYuvNeeded);
+   if (imb == NULL)
+      return NULL;
+
+   pItem = (vdeImsItem_t *) vdeMalloc(sizeof(vdeImsItem_t));
+   if (pItem == NULL) {
+      vdeImbDealloc(imb);
+      return NULL;
+   }
+
+   pItem->imb = imb;
+
+   return pItem;
+}
+
+
+/*
+ * vdeImsAllocFreeStore
+ *    This function allocates and initializes a new Free store.
+ *    In addition, it allocates a given number of free image store items
+ *    of given size and puts these items into the created Free store.
+ */
+
+static vdeImsFreeStore_t *vdeImsAllocFreeStore(int numFreeItems, 
+   int lumWidth, int lumHeight, int fYuvNeeded)
+{
+   int i;
+   vdeImsFreeStore_t *store;
+   vdeImsItem_t *pItem;
+
+   store = (vdeImsFreeStore_t *) vdeMalloc(sizeof(vdeImsFreeStore_t));
+   if (store == NULL)
+      return NULL;
+
+   store->lumWidth = lumWidth;
+   store->lumHeight = lumHeight;
+   store->fYuvNeeded = fYuvNeeded;
+
+   if (lifoOpen(&store->freeStore) < 0) {
+      vdeDealloc(store);
+      return NULL;
+   }
+
+   for (i = 0; i < numFreeItems; i++) {
+      pItem = vdeImsAllocItem(lumWidth, lumHeight, fYuvNeeded);
+      if (pItem == NULL)
+         goto error;
+
+      if (lifoPut(&store->freeStore, pItem) < 0)
+         goto error;
+   }
+
+   return store;
+
+   error:
+   if (pItem)
+      vdeDealloc(pItem);
+   vdeImsDeallocFreeStore(store);
+   return NULL;
+}
+
+
+/*
+ * vdeImsDeallocFreeStore
+ *    This function deallocates a given Free store and all image store items
+ *    which were in the store.
+ */
+
+static int vdeImsDeallocFreeStore(vdeImsFreeStore_t *store)
+{
+   vdeImb_t *imb;
+   vdeImsItem_t *pItem;
+
+   do {
+      if (lifoGet(&store->freeStore, (void **) &pItem) < 0)
+         return VDE_ERROR;
+      
+      if (pItem) {
+         imb = pItem->imb;
+         vdeDealloc(pItem);
+         vdeImbDealloc(imb);
+      }
+   } while (pItem);
+
+   if (lifoClose(&store->freeStore) < 0)
+      return VDE_ERROR;
+
+   vdeDealloc(store);
+
+   return VDE_OK;
+}
+
+
+
+
+/*
+ * vdeImsGetFreeStore
+ *    This function returns a pointer to a Free store which contains frames of
+ *    requested size. The Free store is searched from a list of Free stores.
+ */
+
+static int vdeImsGetFreeStore(lst_t *freeStoreList, int lumWidth, int lumHeight,
+   vdeImsFreeStore_t **freeStore)
+{
+   if (lstHead(freeStoreList, (void **) freeStore) < 0)
+      return VDE_ERROR;
+
+   while (*freeStore && 
+      ((*freeStore)->lumWidth != lumWidth || (*freeStore)->lumHeight != lumHeight)) {
+      if (lstNext(freeStoreList, (void **) freeStore) < 0)
+         return VDE_ERROR;
+   }
+
+   return VDE_OK;
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/vdemain.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,448 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Video decoder engine main module.
+*
+*/
+
+
+
+
+/*
+ * Includes
+ */
+
+#include "h263dConfig.h"
+
+#include "vdemain.h"
+#include "renapi.h"
+#include "rendri.h"
+#include "h263dext.h"
+#include "vde.h"
+
+#include "biblin.h"
+
+
+/*
+ * Global functions
+ */
+  
+/* {{-output"vdeFree.txt"}} */
+/*
+ * vdeFree
+ *    
+ *
+ * Parameters:
+ *    Nothing
+ *
+ * Function:
+ *    This function deinitializes this module.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  indicating a general error
+ *
+ *    
+ */
+
+int vdeFree(void)
+/* {{-output"vdeFree.txt"}} */
+{
+   if (vdcFree() < 0)
+      return VDE_ERROR;
+
+   return VDE_OK;
+}
+
+
+/* {{-output"vdeGetLatestFrame.txt"}} */
+/*
+ * vdeGetLatestFrame
+ *    
+ *
+ * Parameters:
+ *    hInstance                  instance data
+ *    
+ *    ppy, ppu, ppv              used to return Y, U and V frame pointers
+ *
+ *    pLumWidth, pLumHeight      used to return luminance image width and height
+ *                               Note these values can be counted on even if
+ *                               the function returns an error.
+ *
+ *    pFrameNum                  used to return frame number
+ *
+ * Function:
+ *    This function returns the latest correctly decoded frame
+ *    (and some side-information).
+ *
+ *    Note that no thread synchronization is used since the function
+ *    is used only from the mobidntc.c and it is very likely that
+ *    the same decoder instance is used only from a single calling
+ *    thread at the same time.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  indicating a general error
+ */
+
+
+int vdeGetLatestFrame(
+   vdeHInstance_t hInstance,
+   u_char **ppy, u_char **ppu, u_char **ppv,
+   int *pLumWidth, int *pLumHeight,
+   int *pFrameNum)
+/* {{-output"vdeGetLatestFrame.txt"}} */
+{
+   int
+      retValue;
+
+   vdeImb_t
+      *pImb;
+
+   vdeImsItem_t 
+      *pImsItem;
+
+   vdeInstance_t 
+      *instance = (vdeInstance_t *) hInstance;
+
+
+   vdeAssert(instance != NULL);
+
+   /* Ensure that image width and height are returned anyway */
+   *pLumWidth = instance->lumWidth;
+   *pLumHeight = instance->lumHeight;
+
+   retValue = vdeImsGetReference(
+      &instance->imageStore, 
+      VDEIMS_REF_LATEST, 0, 
+      &pImsItem);
+   if (retValue < 0)
+      return retValue;
+
+   if (!pImsItem)
+      return VDE_ERROR;
+
+   pImb = pImsItem->imb;
+
+   if (vdeImbYUV(pImb, ppy, ppu, ppv, pLumWidth, pLumHeight) < 0)
+      return VDE_ERROR;
+
+   *pFrameNum = renDriFrameNumber(pImb->drawItem);
+
+   return VDE_OK;
+}
+
+
+
+/* {{-output"vdeInit.txt"}} */
+/*
+ * vdeInit
+ *    
+ *
+ * Parameters:
+ *    param                      a h263dOpen_t structure containing
+ *                               the initialization parameters
+ *
+ * Function:
+ *    This function allocates and initializes an H.263 video decoder engine
+ *    (VDE) instance.
+ *
+ * Returns:
+ *    a handle to the new instance or
+ *    NULL if the initialization fails
+ *
+ *    
+ */
+
+vdeHInstance_t vdeInit(h263dOpen_t *param)
+/* {{-output"vdeInit.txt"}} */
+{
+   vdeInstance_t *instance;
+
+   vdeAssert(param);
+   vdeAssert(!param->fRPS || (param->fRPS && param->numReferenceFrames > 1));
+
+   instance = (vdeInstance_t *) 
+      vdeMalloc(sizeof(vdeInstance_t) + param->freeSpace);
+   if (instance == NULL)
+      goto errInstanceAllocation;
+   memset(instance, 0, sizeof(vdeInstance_t));
+
+   if (param->lumWidth % 16)
+      param->lumWidth = (param->lumWidth / 16 + 1) * 16;
+   
+   if (param->lumHeight % 16)
+      param->lumHeight = (param->lumHeight / 16 + 1) * 16;
+
+   if (vdeImsOpen(&instance->imageStore, param->numPreallocatedFrames, 
+      param->lumWidth, param->lumHeight) < 0)
+      goto errVdeImsOpen;
+
+   instance->vdcHInstance = vdcOpen(&instance->imageStore, 
+      param->fRPS ? param->numReferenceFrames : 1,
+      (void *) instance);
+   if (!instance->vdcHInstance)
+      goto errVdcOpen;
+
+   if (vdeFrtOpen(&instance->renStore) < 0)
+      goto errRenStore;
+
+   if (vdeFrtOpen(&instance->startCallbackStore) < 0)
+      goto errStartCallbackStore;
+
+   if (vdeFrtOpen(&instance->endCallbackStore) < 0)
+      goto errEndCallbackStore;
+
+
+   instance->lumWidth = param->lumWidth;
+   instance->lumHeight = param->lumHeight;
+
+   return (vdeHInstance_t) instance;
+
+   /* Error cases (release resources in reverse order) */
+
+errEndCallbackStore:
+    
+   vdeFrtClose(&instance->startCallbackStore);
+errStartCallbackStore:
+
+   vdeFrtClose(&instance->renStore);
+errRenStore:
+
+   vdcClose(instance->vdcHInstance);
+errVdcOpen:
+
+   vdeImsClose(&instance->imageStore);
+errVdeImsOpen:
+
+   vdeDealloc(instance);
+errInstanceAllocation:
+
+   return NULL;
+}
+
+
+/* {{-output"vdeIsINTRA.txt"}} */
+/*
+ * vdeIsINTRA
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *    frameStart                 pointer to memory chunk containing a frame
+ *    frameLength                number of bytes in frame
+ *
+ * Function:
+ *    This function returns 1 if the passed frame is an INTRA frame.
+ *    Otherwise the function returns 0.
+ *
+ * Note:
+ *    This function does not use vdeque services since it is intended to be
+ *    used in non-thread version of the codec only.
+ *
+ * Returns:
+ *    See above.
+ */
+
+int vdeIsINTRA(
+   vdeHInstance_t hInstance,
+   void *frameStart,
+   unsigned frameLength)
+/* {{-output"vdeIsINTRA.txt"}} */
+{
+   vdeInstance_t *instance = (vdeInstance_t *) hInstance;
+
+   vdeAssert(instance != NULL);
+
+   /* Note: We assume that vdeDetermineStreamType has been called to
+      decide whether the stream is MPEG-4 or H.263 */
+      
+   if (instance->fMPEG4)
+      return vdcIsMPEGINTRA(instance->vdcHInstance, frameStart, frameLength);
+   else
+      return vdcIsINTRA(instance->vdcHInstance, frameStart, frameLength);
+}
+
+
+/* {{-output"vdeLoad.txt"}} */
+/*
+ * vdeLoad
+ *    
+ *
+ * Parameters:
+ *    rendererFileName           file from which to get renderer functions
+ *
+ * Function:
+ *    This function initializes this module.
+ *
+ *    Renderer functions are dynamically loaded from the given file.
+ *    If rendererFileName is NULL, renderer functions are expected to be
+ *    statically linked.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  indicating a general error
+ *
+ *    
+ */
+
+int vdeLoad(const char * /*rendererFileName*/)
+/* {{-output"vdeLoad.txt"}} */
+{
+
+   if (vdcLoad() < 0)
+      return VDE_ERROR;
+
+   return VDE_OK;
+}
+
+
+
+
+/* {{-output"vdeSetInputBuffer.txt"}} */
+/*
+ * vdeSetInputBuffer
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *    buffer                     a new bit buffer to use
+ *
+ * Function:
+ *    This function sets the bit buffer to use for decoding.
+ *    It is intended that this function is used mainly in applications
+ *    where frames are provided one by one from applications.
+ *    Some upper level function must create a bit buffer for each frame,
+ *    pass a pointer to the created bit buffer to the decoder using this
+ *    function and then decode the frame.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_ERROR                  indicating a general error
+ *
+ *    
+ */
+
+int vdeSetInputBuffer(vdeHInstance_t hInstance, bibBuffer_t *buffer)
+/* {{-output"vdeSetInputBuffer.txt"}} */
+{
+   vdeInstance_t *instance = (vdeInstance_t *) hInstance;
+
+   if (instance == NULL)
+      return VDE_ERROR;
+
+   instance->inBuffer = buffer;
+
+   return VDE_OK;
+}
+
+
+
+int vdeSetOutputBuffer(vdeHInstance_t hInstance, bibBuffer_t *buffer)
+/* {{-output"vdeSetOutputBuffer.txt"}} */
+{
+   vdeInstance_t *instance = (vdeInstance_t *) hInstance;
+
+   if (instance == NULL)
+      return VDE_ERROR;
+
+   instance->outBuffer = buffer;
+
+   return VDE_OK;
+}
+
+int vdeSetBufferEdit(vdeHInstance_t hInstance, bibBufferEdit_t *bufEdit)
+/* {{-output"vdeSetOutputBuffer.txt"}} */
+{
+   vdeInstance_t *instance = (vdeInstance_t *) hInstance;
+
+   if (instance == NULL)
+      return VDE_ERROR;
+
+   instance->bufEdit = bufEdit;
+
+   return VDE_OK;
+}
+
+int vdeSetVideoEditParams(vdeHInstance_t hInstance, int aColorEffect, TBool aGetDecodedFrame, 
+                          TInt aColorToneU, TInt aColorToneV)
+{
+   vdeInstance_t *instance = (vdeInstance_t *) hInstance;
+
+   if (instance == NULL)
+      return VDE_ERROR;
+
+   instance->iColorEffect = aColorEffect;
+   instance->iGetDecodedFrame = aGetDecodedFrame;
+   instance->iColorToneU = aColorToneU;
+   instance->iColorToneV = aColorToneV;
+
+   return VDE_OK;
+}
+
+
+
+
+
+
+
+
+
+/* {{-output"vdeShutDown.txt"}} */
+/*
+ * vdeShutDown
+ *    
+ *
+ * Parameters:
+ *    hInstance                  handle of instance data
+ *
+ * Function:
+ *    This function has to be called in the end of each video sequence.
+ *    It frees the resources (the VDE instance) allocated by vdeInit.
+ *
+ * Returns:
+ *    VDE_OK                     if the closing was successful
+ *    VDE_ERROR                  indicating a general error
+ *
+ *    
+ */
+
+int vdeShutDown(vdeHInstance_t hInstance)
+/* {{-output"vdeShutDown.txt"}} */
+{
+   int retValue = VDE_OK;
+   vdeInstance_t *instance = (vdeInstance_t *) hInstance;
+
+   if (vdcClose(instance->vdcHInstance) < 0)
+      retValue = VDE_ERROR;
+
+   if (vdeFrtClose(&instance->endCallbackStore) < 0)
+      retValue = VDE_ERROR;
+
+   if (vdeFrtClose(&instance->startCallbackStore) < 0)
+      retValue = VDE_ERROR;
+
+   if (vdeFrtClose(&instance->renStore) < 0)
+      retValue = VDE_ERROR;
+
+   if (vdeImsClose(&instance->imageStore) < 0)
+      retValue = VDE_ERROR;
+
+   vdeDealloc(instance);
+
+   return retValue;
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/vdeti.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,445 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Frame decoding function.
+*
+*/
+
+
+
+/*
+ * Includes
+ */
+
+#include "h263dconfig.h"
+#include "vdeti.h"
+#include "debug.h"
+#include "sync.h"
+#include "vde.h"
+#include "vdemain.h"
+#include "core.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+
+/*
+ * Local function prototype
+ */
+
+static int vdeSeekNextValidDecodingStartPosition(
+   vdeInstance_t *instance, CMPEG4Transcoder *hTranscoder);
+
+
+/*
+ * Functions visible outside this module
+ */
+
+/* {{-output"vdeDecodeFrame.txt"}} */
+/*
+ * vdeDecodeFrame
+ *
+ * Parameters:
+ *    hInstance                  instance data
+ *
+ * Function:
+ *    This function decodes the bitstream by using
+ *    vdcDecodeFrame until it gets at least one decoded frame. It also shows 
+ *    the resulting frames (by calling renDraw). 
+ *    In addition, the function handles the parameter updating synchronization
+ *    by calling the VDE Queue module.
+ *
+ *    This function is intended to be called from the thread main function.
+ *    It won't return until it gets a new decoded frame. If the bitstream
+ *    is totally corrupted, this feature might cause a considerable delay
+ *    in the execution of the thread main function.
+ *
+ * Returns:
+ *    VDE_OK                     if the function was successful
+ *    VDE_OK_EOS                 if the end of stream has been reached
+ *    VDE_OK_BUT_FRAME_USELESS   if the function behaved normally, but no 
+ *                               decoding output was produced due to too
+ *                               corrupted input frame
+ *    VDE_ERROR                  if a fatal error, from which the decoder
+ *                               cannot be restored, has occured
+ *    VDE_ERROR_HALTED           the instance is halted, it should be closed
+ *
+ *    
+ */
+
+
+int vdeDecodeFrame(vdeHInstance_t hInstance, int /*aStartByteIndex*/, int /*aStartBitIndex*/, CMPEG4Transcoder *hTranscoder)
+/* {{-output"vdeDecodeFrame.txt"}} */
+{
+   int
+      sncCode,                   /* sync code from which to start decoding */
+      numOutputFrames,           /* number of output frames, 2 for PB-frames,
+                                    1 otherwise */
+      fOutputUseless,            /* 1 if frame(s) too corrupted to display,
+                                    0 otherwise */
+      i,                         /* loop variable */
+      vdcStatus,                 /* return value of vdcDecodeFrame or 
+                                    vdcDecodeMPEGVop */
+      fFullPictureFreeze = 0;    /* set to 1 if full-picture freeze is
+                                    going on as described in section L.4
+                                    of the H.263 recommendation */
+
+   vdeInstance_t 
+      *instance = (vdeInstance_t *) hInstance;
+                                 /* pointer to instance structure */
+
+    /* MVE */
+     int StartByteIndex ;
+     int StartBitIndex ;
+
+   instance->fPrevFrameDecoded = 0;
+
+   /* If the instance is in the EOS state */
+   if (instance->state == VDE_STATE_EOS) {
+
+      /* If MPEG-4 stream, visual_object_sequence_end_code terminates
+         a visual session, and therefore we return.
+         If H.263 stream, EOS (End of Sequence) has no semantics, and
+         therefore we return only if MoVi buffers wrapper indicates so. */
+      if (instance->fMPEG4)
+         /* Return an indication that the stream has ended */
+         return VDE_OK_EOS;
+   }
+
+   /* If the instance is in the "Halted" state */
+   if (instance->state == VDE_STATE_HALTED) {
+
+      /* If the current frame is INTRA */
+      if (vdcIsINTRA(instance->vdcHInstance, instance->inBuffer->baseAddr, 20)) {
+         /* Reset the state and try to decode */
+         instance->state = VDE_STATE_MIDDLE;
+         deb("vdeDecodeFrame: Trying to recover from halted state.\n");
+      }
+
+      else {
+         deb("vdeDecodeFrame: ERROR - already halted.\n");
+         /* Return an indication that the stream cannot be decoded further */
+         return VDE_ERROR_HALTED;
+      }
+   }
+
+   /* If the instance state indicates that we should resynchronize to INTRA
+      frame */
+   if (instance->state == VDE_STATE_RESYNC) {
+
+      /* If the current frame is INTRA */
+      if (vdcIsINTRA(instance->vdcHInstance, instance->inBuffer->baseAddr, 20)) {
+         /* Reset the state and continue decoding */
+         instance->state = VDE_STATE_MIDDLE;
+      }
+
+      else
+         return VDE_OK;
+   }
+
+   /* Read a synchronization code from the current position of the 
+   bitstream or seek the next valid sync code to start decoding */
+   sncCode = vdeSeekNextValidDecodingStartPosition(instance, hTranscoder);
+
+   /* If error in seeking sync code */
+   if (sncCode < 0)
+      /* Return error */
+      return sncCode;
+
+   /* Else if sync code not found 
+      Note: Can only happen in "one frame per one input bit buffer" case, 
+      i.e. not in videophone */
+   else if (sncCode == SNC_NO_SYNC)
+      /* Note: One could send a INTRA picture request if such a service is
+         available. However, it is assumed that the service is not available
+         in this non-videophone application, and therefore no update is
+         requested. */
+
+      /* Return indication of useless (too corrupted) frame */
+      return VDE_OK_BUT_FRAME_USELESS;
+
+   /* Set the instance to the "Middle" state */
+   instance->state = VDE_STATE_MIDDLE;
+
+   /* If the synchronization code == EOS */
+   if (sncCode == SNC_EOS) {
+
+      /* Set the instance to the EOS state */
+      instance->state = VDE_STATE_EOS;
+
+      /* Return an indication that the stream ended */
+      return VDE_OK_EOS;
+   }
+      
+   /* MVE */
+     StartByteIndex = instance->inBuffer->getIndex;
+     StartBitIndex  = instance->inBuffer->bitIndex;
+
+
+
+
+   /* Decode a frame */
+
+   if (instance->fMPEG4) {
+
+      vdcStatus = vdcDecodeMPEGVop(instance->vdcHInstance, instance->inBuffer,
+          instance->outBuffer, instance->bufEdit, instance->iColorEffect, instance->iGetDecodedFrame,
+          StartByteIndex, StartBitIndex, hTranscoder);
+   } 
+   else 
+   {
+
+
+       vdcStatus = vdcDecodeFrame(instance->vdcHInstance, instance->inBuffer, 
+           instance->outBuffer, instance->bufEdit, instance->iColorEffect,instance->iGetDecodedFrame, hTranscoder);
+
+   }
+
+
+   if (vdcStatus < 0) {
+      deb("vdeDecodeFrame: ERROR - vdcDecodeFrame failed.\n");
+
+      instance->state = VDE_STATE_HALTED;
+
+      if (vdcStatus == VDC_ERR_NO_INTRA)
+          return VDE_ERROR_NO_INTRA;
+      
+      return VDE_ERROR_HALTED;
+   }
+
+   /* If EOS occured */
+   if (vdcIsEOSReached(instance->vdcHInstance))
+      instance->state = VDE_STATE_EOS;
+
+   /* If the decoded frame is totally corrupted */
+   if ((vdcStatus == VDC_OK_BUT_FRAME_USELESS) || (vdcStatus == VDC_OK_BUT_NOT_CODED)) {
+
+      /* If continuous input buffer */
+
+      fOutputUseless = 1;
+   }
+
+   else {
+      fOutputUseless = 0;
+      instance->fPrevFrameDecoded = 1;
+   }
+
+
+   /* If H.263 bitstream and decoding (partially) successful */
+   if (!instance->fMPEG4 && !fOutputUseless) {
+   }
+
+   /*
+    * Return decoded images to the image store and 
+    * send them to Video Renderer if needed
+    */
+
+   numOutputFrames = vdcGetNumberOfOutputFrames(instance->vdcHInstance);
+
+   /* Loop to handle each output frame separately */
+   for (i = 0; i < numOutputFrames; i++) {
+      vdeImsItem_t *imsItem;
+
+      imsItem = vdcGetImsItem(instance->vdcHInstance, i);
+
+      vdeAssert(imsItem);
+
+      /* If the frame is useless */
+      if (fOutputUseless) {
+
+         /* Return the image buffer to the "Free" store */
+         if (vdeImsPutFree(&instance->imageStore, imsItem) < 0) {
+           deb("vdeDecodeFrame: ERROR - vdeImsPutFree failed.\n");
+           instance->state = VDE_STATE_HALTED;
+           return VDE_ERROR_HALTED;
+         }
+      }
+
+      /* Else the frame is ok */
+      else {
+
+         vdeImb_t *imb;
+
+         vdeImsStoreItemToImageBuffer(imsItem, &imb);
+
+
+         /* If full-picture freeze requested */
+         if (fFullPictureFreeze) {
+
+            /* Return the image buffer to the image buffer store
+               but don't send it to the renderer */
+            if (vdeImsPut(&instance->imageStore, imsItem) < 0) {
+               deb("vdeDecodeFrame: ERROR - vdeImsPut failed.\n");
+               instance->state = VDE_STATE_HALTED;
+               return VDE_ERROR_HALTED;
+            }
+         }
+
+         /* Else normal displaying */
+         else {
+            h263dFrameType_t frameType;
+            int renStatus;
+            u_int32 renHandle;
+
+            /* Get renderer for the output frame */
+            frameType.scope = H263D_FTYPE_NDEF;
+            frameType.width = renDriBitmapWidth(imb->drawItem);
+            frameType.height = renDriBitmapHeight(imb->drawItem);
+       
+            renStatus = vdeFrtGetItem(&instance->renStore, &frameType, &renHandle);
+
+            if (renStatus == VDE_OK_NOT_AVAILABLE)
+               renHandle = 0;
+
+
+            if (renStatus >= 0) {
+               /* Return the image buffer to the image buffer store
+                  and send it to the renderer (if possible) */
+               if (vdeImsPut(&instance->imageStore, imsItem) < 0) {
+                  deb("vdeDecodeFrame: ERROR - vdeImsPut failed.\n");
+                  instance->state = VDE_STATE_HALTED;
+                  return VDE_ERROR_HALTED;
+               }
+            }
+
+            else {
+               deb("vdeDecodeFrame: ERROR - vdeFrtGetItem failed.\n");
+               instance->state = VDE_STATE_HALTED;
+               return VDE_ERROR_HALTED;
+            }
+         }
+
+      }
+   }
+   
+   // fatal errors were returned already earlier
+   switch ( vdcStatus )
+    {
+    case VDC_OK_BUT_FRAME_USELESS:
+        {
+        return VDE_OK_BUT_FRAME_USELESS;
+        }
+//        break;
+    case VDC_OK_BUT_NOT_CODED:
+        {
+        return VDE_OK_BUT_NOT_CODED;
+        }
+//        break;
+    default:
+      {
+        break;
+//      return VDE_OK;
+      }
+    }
+    
+return VDE_OK;
+}
+
+
+/*
+ * Local functions
+ */
+
+/*
+ * vdeSeekNextValidDecodingStartPosition
+ *
+ * Parameters:
+ *    instance                   instance data
+ *
+ * Function:
+ *    This function seeks the next synchronization position from the bitstream
+ *    (starting from the current position) from which the decoder can start
+ *    decoding.
+ *
+ * Returns:
+ *    VDE_ERROR                  if a fatal error, from which the decoder
+ *                               cannot be restored, has occured
+ *
+ *    SNC_NO_SYNC                if no suitable sync code was found
+ *                               (can happen only in non-videophone case
+ *                               where only one frame is in one bit input
+ *                               buffer)
+ *
+ *    SNC_PSC                    H.263 Picture Start Code found
+ *
+ *    SNC_EOS                    H.263 End of Sequence found or
+ *                               MPEG-4 EOB found
+ *
+ *    SNC_GBSC                   H.263 GBSC found
+ *
+ *    SNC_VOP                    MPEG-4 VOP
+ *    SNC_GOV                    MPEG-4 GOV
+ *
+ *    
+ */
+
+static int vdeSeekNextValidDecodingStartPosition(
+   vdeInstance_t *instance, CMPEG4Transcoder *hTranscoder)
+{
+   int
+      sncCode = SNC_NO_SYNC;  /* sync code in current position */
+   int16 
+      error = 0;              /* error code returned from sync module */
+
+   /* Note: For the first INTRA of the stream,
+   do the H.263 vs. non-H.263 stream decision in a higher level,
+   now assume that there has simply been a bit error in the header,
+   and one should try from the next PSC */
+
+   if (instance->fMPEG4) {
+      vdcInstance_t* vdcinst = (vdcInstance_t *) instance->vdcHInstance;
+      int fcode = vdcinst->pictureParam.fcode_forward;
+
+      while (sncCode != SNC_VOP && 
+             sncCode != SNC_GOV && 
+             sncCode != SNC_EOB &&
+             sncCode != SNC_VIDPACK) {
+
+         sncCode = sncSeekMPEGStartCode(instance->inBuffer, (fcode ? fcode : 1), 1 /* VPs not relevant at this stage */, 0, &error);
+         if (error == ERR_BIB_NOT_ENOUGH_DATA)
+            return SNC_NO_SYNC;
+         else if (error)
+            return VDE_ERROR;
+         else if (sncCode == SNC_VOS)
+         {            
+            /* Visual Object Sequence start code found, VOS + VO + VOL headers have to be parsed now.. */
+            /* (The bitstream may contain multiple instances of VOS start codes before Visual
+                Object Sequence end code) */
+            if (vdcDecodeMPEGVolHeader(vdcinst, instance->inBuffer, hTranscoder) != 0)
+               return VDE_ERROR;
+         }
+      }
+
+      if (sncCode == SNC_EOB)
+         sncCode = SNC_EOS;
+   }
+   else 
+   {
+      while (
+         sncCode != SNC_PSC && 
+         sncCode != SNC_EOS &&
+         sncCode != SNC_GBSC ) {
+
+         sncCode = sncSeekSync(instance->inBuffer, &error);
+         if (error == ERR_BIB_NOT_ENOUGH_DATA)
+            return SNC_NO_SYNC;
+         else if (error)
+            return VDE_ERROR;
+      }
+   }
+
+   return sncCode;
+}
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/vdeti_mpeg.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Input stream type determination.
+*
+*/
+
+
+
+
+/*
+ * Includes
+ */
+
+#include "h263dConfig.h"
+
+#include "debug.h"
+#include "sync.h"
+#include "vde.h"
+#include "vdemain.h" 
+#include "mpegcons.h"
+
+#include "core.h"
+
+
+/*
+ * Functions visible outside this module
+ */
+
+/*
+ * vdeDetermineStreamType
+ *
+ * Parameters:
+ *    hInstance                  instance data
+ *
+ * Function:
+ *   This function detects the stream type, looking at the start code
+ *   (h.263 vs. MPEG-4) and sets the flag "fMPEG4" which is
+ *   used for the configuration of the decoder. 
+ *   In case of an MPEG-4 stream calls the Video Object Header and the VOL Header
+ *   decoding function to set initial parameters.
+ *
+ * Returns:
+ *    VDE_OK                     if the stream type could be detected and 
+ *                               it is supported
+ *    VDE_ERROR_HALTED           if the stream type couldn't be detected or
+ *                               the configuration is not supported
+ *    VDE_ERROR                  if unrecoverable bitbuffer error occered
+ *
+ */
+int vdeDetermineStreamType(vdeHInstance_t hInstance, CMPEG4Transcoder *hTranscoder)
+{
+   vdeInstance_t *vdeinstance = (vdeInstance_t *) hInstance;
+   bibBuffer_t *inBuffer = vdeinstance->inBuffer;
+
+   int numBitsGot,
+      bitErrorIndication = 0;
+   int16 error = 0;
+   u_int32 bits;
+
+   bits = bibShowBits(32, inBuffer, &numBitsGot, &bitErrorIndication, &error);
+   if (error)
+      return VDE_ERROR;
+
+   /* If PSC */
+   if ((bits >> 10) == 32) {
+      vdeinstance->fMPEG4 = 0;
+   } 
+
+   /* Else check for Visual Sequence, Visual Object or Video Object start code */
+   else if ((bits == MP4_VOS_START_CODE) || 
+            (bits == MP4_VO_START_CODE) ||
+            ((bits >> MP4_VID_ID_CODE_LENGTH) == MP4_VID_START_CODE) ||
+            ((bits >> MP4_VOL_ID_CODE_LENGTH) == MP4_VOL_START_CODE)) {
+
+      vdeinstance->fMPEG4 = 1;
+
+      if (vdcDecodeMPEGVolHeader(vdeinstance->vdcHInstance, inBuffer, hTranscoder) != 0)
+         return VDE_ERROR;
+
+      bits = bibShowBits(22, inBuffer, &numBitsGot, &bitErrorIndication, &error);
+      if (error)
+         return VDE_ERROR;
+
+      /* Check if H.263 PSC follows the VOL header, in which case this is 
+         MPEG-4 with short header and is decoded as H.263 */
+      if ( bits == 32 ) {
+         vdeinstance->fMPEG4 = 0;
+      }
+
+   }
+
+   /* Else no H.263 and no MPEG-4 start code detected -> let's try H.263,
+      since MPEG-4 cannot anyway be decoded without starting header */
+   else {
+      vdeinstance->fMPEG4 = 0;
+   }
+
+   return VDE_OK;
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/vedh263dimp.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* H.263 Decoder API implementation class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "vde.h"
+#include "h263dapi.h"
+#include "vedh263dimp.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+
+// An assertion macro wrapper to clean up the code a bit
+#define DLASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CVedH263Dec"), EInternalAssertionFailure))
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::CVedH263DecImp
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVedH263DecImp::CVedH263DecImp(TSize aFrameSize, TInt /*aNumReferencePictures*/)
+{
+    iH263dHandle = 0;
+    iFrameSize = aFrameSize;
+}
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVedH263DecImp::ConstructL()
+{
+
+    // Open a decoder instance
+    h263dOpen_t openParams;
+    openParams.numPreallocatedFrames = 1;
+    openParams.lumWidth = iFrameSize.iWidth;
+    openParams.lumHeight = iFrameSize.iHeight;
+
+    openParams.fRPS = 0; // reference picture selection mode not in use
+    openParams.numReferenceFrames = 1;
+    openParams.freeSpace = 0;
+    iH263dHandle = h263dOpen(&openParams);
+    if (!iH263dHandle)
+        User::Leave(KErrGeneral);
+
+}
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVedH263Dec* CVedH263Dec::NewL(const TSize aFrameSize, const TInt aNumReferencePictures)
+{
+
+    CVedH263DecImp* self = new (ELeave) CVedH263DecImp(aFrameSize, aNumReferencePictures);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);    
+    return self;    
+}
+
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::~CVedH263DecImp
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CVedH263DecImp::~CVedH263DecImp()
+{
+    // Close the decoder instance if one has been opened
+    if (iH263dHandle)
+    {
+        h263dClose(iH263dHandle);
+        iH263dHandle = 0;
+    }
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::SetRendererL
+// Sets the renderer object which the decoder will use
+// -----------------------------------------------------------------------------
+//
+void CVedH263DecImp::SetRendererL(MVideoRenderer* /*aRenderer*/)
+{
+    // this method is not supported any more
+    User::Panic(_L("CVedH263Dec - method not supported"), EInternalAssertionFailure);
+}
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::SetPostFilterL
+// Sets the post-filter to be used in decoding
+// -----------------------------------------------------------------------------
+//
+void CVedH263DecImp::SetPostFilterL(const TPostFilter /*aFilter*/)
+{
+    // this method is not supported any more
+    User::Panic(_L("CVedH263Dec - method not supported"), EInternalAssertionFailure);
+}
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::GetYUVFrame
+// Retrieves the YUV buffer for the last decoded frame
+// -----------------------------------------------------------------------------
+//
+TUint8* CVedH263DecImp::GetYUVFrame()
+{
+    // this method is not supported any more
+    User::Panic(_L("CVedH263Dec - method not supported"), EInternalAssertionFailure);
+
+    return NULL; 
+
+}
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::GetYUVBuffers
+// Retrieves the Y/U/V buffers for the given frame
+// -----------------------------------------------------------------------------
+//
+TInt CVedH263DecImp::GetYUVBuffers(const TAny */*aFrame*/, TUint8*& /*aYFrame*/, TUint8*& /*aUFrame*/, 
+                                   TUint8*& /*aVFrame*/, TSize& /*aFrameSize*/)
+{
+    // this method is not supported any more
+    User::Panic(_L("CVedH263Dec - method not supported"), EInternalAssertionFailure);
+    return KErrNotSupported;
+}
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::DecodeFrameL
+// Decodes / Transcodes a compressed frame
+// -----------------------------------------------------------------------------
+//
+
+void CVedH263DecImp::DecodeFrameL(const TPtrC8& aInputBuffer, TPtr8& aOutputBuffer,
+                                  TBool& aFirstFrame, TInt& aBytesDecoded,
+                                  vdeDecodeParamters_t *aDecoderInfo)
+{
+        
+    TInt error = KErrNone;
+    
+    TInt bytesProduced = 0;
+
+    error = h263dDecodeFrameL(iH263dHandle, (TAny*)aInputBuffer.Ptr(), (TAny*)aOutputBuffer.Ptr(), 
+                             aInputBuffer.Length(), (TUint8*)&aFirstFrame, &aBytesDecoded, 
+                             &bytesProduced, aDecoderInfo);    
+
+    aOutputBuffer.SetLength(bytesProduced);
+    
+    switch ( error )
+        {
+        case H263D_ERROR_NO_INTRA:
+            {
+            User::Leave( EDecoderNoIntra );
+            }
+            break;
+        case H263D_OK_BUT_FRAME_USELESS:
+        case H263D_OK_BUT_BIT_ERROR:
+            {
+            User::Leave( EDecoderCorrupted );
+            }
+            break;
+        case H263D_OK:
+        case H263D_OK_EOS:
+        case H263D_OK_BUT_NOT_CODED:
+            {
+            // ok
+            return;
+            }
+        default:
+            {
+            User::Leave(EDecoderFailure);
+            }
+            break;
+
+        }
+    
+}
+
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::DecodeFrameL
+// Decodes / Transcodes a compressed frame
+// -----------------------------------------------------------------------------
+//
+void CVedH263DecImp::DecodeFrameL(const TPtrC8& /*aInputBuffer*/, TPtr8& /*aOutputBuffer*/,
+                                  TBool& /*aFirstFrame*/, TInt& /*aBytesDecoded*/, 
+                                  const TColorEffect /*aColorEffect*/,
+                                  const TBool /*aGetDecodedFrame*/, TInt /*aFrameOperation*/,
+                                  TInt* /*aTrP*/, TInt* /*aTrD*/, TInt /*aVideoClipNumber*/, TInt /*aSMSpeed*/, 
+                                  TInt /*aDataFormat*/)
+{
+    // this method is not supported any more
+    User::Panic(_L("CVedH263Dec - method not supported"), EInternalAssertionFailure);
+}
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::DecodeFrameL
+// Decodes a compressed frame
+// -----------------------------------------------------------------------------
+//      
+void CVedH263DecImp::DecodeFrameL(const TPtrC8& /*aInputBuffer*/, TBool& /*aFirstFrame*/, TInt& /*aBytesDecoded*/, 
+                                                                    TInt /*aDataFormat*/)
+{    
+    // this method is not supported any more
+    User::Panic(_L("CVedH263Dec - method not supported"), EInternalAssertionFailure);
+}
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::FrameValid
+// Checks if the given frame is valid
+// -----------------------------------------------------------------------------
+//
+TBool CVedH263DecImp::FrameValid(const TAny */*aFrame*/)
+{
+    return ETrue;
+
+}
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::FrameRendered
+// Returns the given frame to the decoder after it is no longer needed
+// -----------------------------------------------------------------------------
+//
+void CVedH263DecImp::FrameRendered(const TAny */*aFrame*/)
+{
+    // Return frame to the decoder rendering subsystem
+}
+
+// -----------------------------------------------------------------------------
+// CVedH263DecImp::CheckVOSHeaderL
+// Check and change the VOS header (resync marker bit needs to be set) 
+// -----------------------------------------------------------------------------
+//
+TBool CVedH263DecImp::CheckVOSHeaderL(TPtrC8& aInputBuffer)
+{
+   return vdtChangeVosHeaderRegResyncL(aInputBuffer, aInputBuffer.Length());
+
+}
+
+
+
+
+
+// End of file
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/viddemux.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,4111 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* H.263 bitstream parsing.
+*
+*/
+
+
+
+/*
+ * Includes
+ */
+
+#include "h263dConfig.h"
+#include "viddemux.h"
+#include "vdxint.h"
+#include "debug.h"
+#include "biblin.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+
+/*
+ * Defines
+ */
+
+#ifdef DEB_STDOUT
+/* Use back-channel debug output file when printing back-channel related 
+   messages. */
+#include <stdio.h>
+extern FILE *bcmDebFile;
+#endif
+
+ 
+/*
+ * Module-scope typedefs
+ */
+
+/* Another type for VLC (variable length code) lookup tables used in 
+   Annex I implementation.*/
+typedef struct {
+   u_char LAST;   /* see section 5.4.2 of the H.263 recommendation */
+   u_char RUN;    /* to understand LAST, RUN and LEVEL */
+   u_char LEVEL;
+   u_char len;    /* actual length of code in bits */
+} vdxVLCTableNew_t;
+
+
+/*
+ * Global constants
+ */
+
+/* Used to convert a luminance block index defined in section 4.2.1
+   of the H.263 recommendation to a coded block pattern mask (see sections
+   5.3.4 and 5.3.5 of the H.263 recommendation. 
+   See also macros section in viddemux.h. */
+const int vdxBlockIndexToCBPYMask[5] = {0, 8, 4, 2, 1};
+const int vdxYBlockIndexToCBPBMask[5] = {0, 32, 16, 8, 4};
+
+
+/*
+ * Local function prototypes
+ */
+
+/* Picture Layer */
+
+static int vdxActAfterIncorrectSEI(
+   bibBuffer_t *inBuffer,
+   int fPLUSPTYPE,
+   int *fLast,
+   int *bitErrorIndication);
+
+static void vdxStandardSourceFormatToFrameSize(int sourceFormat, int *width, int *height);
+
+/* Slice Layer */
+int vdxFrameSizeToPictureFormat(int width, int height);
+
+/* Macroblock Layer */
+
+static int vdxGetIntraMode(bibBuffer_t *inBuffer,int *index,
+   int *bitErrorIndication);
+
+static int vdxUMVGetMVD(bibBuffer_t *inBuffer,int *mvdx10,
+   int *bitErrorIndication);
+
+static int vdxGetNormalMODB(bibBuffer_t *inBuffer, int *index, 
+   int *bitErrorIndication);
+
+static int vdxGetImpPBMODB(bibBuffer_t *inBuffer, int *index,
+   int *bitErrorIndication);
+
+
+
+
+/*
+ * Picture Layer Global Functions
+ */
+
+/* {{-output"vdxGetPictureHeader.txt"}} */
+/*
+ * vdxGetPictureHeader
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    inpParam                   input parameters
+ *    header                     output parameters: picture header
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the H.263 picture header.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+int vdxGetPictureHeader(
+   bibBuffer_t *inBuffer, 
+   const vdxGetPictureHeaderInputParam_t *inpParam,
+   vdxPictureHeader_t *header,
+   int *bitErrorIndication)
+/* {{-output"vdxGetPictureHeader.txt"}} */
+{
+   bibFlushBits_t
+      flushBits;
+   bibGetBits_t
+      getBits;
+   int
+      numBitsGot,
+      bits1To5OfPTYPE,
+      sourceFormat;
+   int16
+      bibError = 0;
+   u_int32 tmp = 0;          /* temporary variable for reading some redundant bits */
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(inpParam != NULL);
+   vdxAssert(inpParam->flushBits != NULL);
+   vdxAssert(inpParam->getBits != NULL);
+   vdxAssert(header != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   flushBits = inpParam->flushBits;
+   getBits = inpParam->getBits;
+
+   memset(header, 0, sizeof(vdxPictureHeader_t));
+   *bitErrorIndication = 0;
+
+   /* Assume that the existence of a PSC has been checked,
+      it is the next code in the buffer, and
+      its byte alignment has been checked */
+
+   /* Flush stuffing (PSTUF) */
+   if (inpParam->numStuffBits) {
+      flushBits(inpParam->numStuffBits, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+   }
+
+   /* Flush PSC */
+   flushBits(22, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+   /* PSC cannot contain fatal bit errors (checked earlier) */
+   header->numBits += 22;
+
+   *bitErrorIndication = 0;   
+
+   /* TR */
+   header->tr = (int) getBits(8, inBuffer, &numBitsGot, bitErrorIndication,
+      &bibError);
+   header->numBits += 8;
+
+
+   #ifdef DEB_STDOUT
+      if (bcmDebFile)
+         deb1f(bcmDebFile, "TR %d\n", header->tr);
+   #endif
+
+   /* The first 5 bits from PTYPE */
+   bits1To5OfPTYPE = (int) getBits(5, inBuffer, &numBitsGot,
+      bitErrorIndication, &bibError);
+   header->numBits += 5;
+
+
+   /* PTYPE bit 1 should be 1 */
+   if ((bits1To5OfPTYPE & 16) == 0 ) {
+      deb0p("ERROR. PTYPE bit 1 invalid.\n");
+      goto exitAfterBitError;
+   }
+
+   /* PTYPE bit 2 should be 0 for distinction with H.261 */
+   if (bits1To5OfPTYPE & 8) {
+      deb0p("ERROR. PTYPE bit 2 indicates H.261.\n");
+      goto exitAfterBitError;
+   }
+
+   /* PTYPE bit 3, Split Screen Indicator */
+   header->fSplitScreen = ((bits1To5OfPTYPE & 4) > 0);
+
+   /* PTYPE bit 4, Document camera indicator */
+   header->fDocumentCamera = ((bits1To5OfPTYPE & 2) > 0);
+
+   /* PTYPE bit 5, Freeze Picture Release */
+   header->fFreezePictureRelease = (bits1To5OfPTYPE & 1);
+
+   /* PTYPE bits 6 - 8, Source Format */
+   sourceFormat = (int) getBits(3, inBuffer, &numBitsGot,
+      bitErrorIndication, &bibError);
+   header->numBits += 3;
+
+
+   /* If H.263 version 1 */
+   if (sourceFormat >= 1 && sourceFormat <= 5) {
+      int bits9To13OfPTYPE;
+
+      header->fPLUSPTYPE = 0;
+
+      vdxStandardSourceFormatToFrameSize(sourceFormat, &header->lumWidth, &header->lumHeight);
+
+      /* PTYPE bits 9 - 13 */
+      bits9To13OfPTYPE = (int) getBits(5, inBuffer, &numBitsGot,
+         bitErrorIndication, &bibError);
+      header->numBits += 5;
+
+
+      /* PTYPE bit 9, Picture coding type */
+      header->pictureType = ((bits9To13OfPTYPE & 16) > 0);
+
+      /* PTYPE bit 10, Unrestricted motion vector mode */
+      header->fUMV = ((bits9To13OfPTYPE & 8) > 0);
+
+      /* PTYPE bit 11, Syntax-based Arithmetic Coding mode */
+      header->fSAC = ((bits9To13OfPTYPE & 4) > 0);
+
+      /* PTYPE bit 12, Advanced prediction mode */
+      header->fAP = ((bits9To13OfPTYPE & 2) > 0);
+
+      /* PTYPE bit 13, PB-frames mode */
+
+      /* If PTYPE bit 9 indicates a P-picture */
+      if (header->pictureType) {
+         /* Check if it is actually a PB-picture */
+         if (bits9To13OfPTYPE & 1)
+            header->pictureType = VDX_PIC_TYPE_PB;
+      }
+
+      /* Else PTYPE bit 9 indicates an I-picture */
+      else {
+         /* Check that bit 13 is 0 */
+         if (bits9To13OfPTYPE & 1) {
+            deb0p("ERROR. PTYPE bit 9 and 13 mismatch.\n");
+            goto exitAfterBitError;
+         }
+      }
+   }
+
+   /* Else if H.263 version 2 (PLUSPTYPE) */
+   else if (sourceFormat == 7) {
+      int bits4To9OfMPPTYPE;
+
+      header->fPLUSPTYPE = 1;
+
+      /* UFEP */
+      header->ufep = (int) getBits(3, inBuffer, &numBitsGot,
+         bitErrorIndication, &bibError);
+      header->numBits += 3;
+
+
+      if (header->ufep > 1) {
+         deb0p("ERROR. UFEP illegal.\n");
+         goto exitAfterBitError;
+      }
+
+      /* If UFEP = '001' */
+      if (header->ufep) {
+         int bits4To18OfOPPTYPE;
+
+         /* OPPTYPE bits 1 - 3, Source format */
+         sourceFormat = (int) getBits(3, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 3;
+
+
+
+         if (sourceFormat >= 1 && sourceFormat <= 5) {
+            header->fCustomSourceFormat = 0;
+            vdxStandardSourceFormatToFrameSize(sourceFormat, 
+               &header->lumWidth, &header->lumHeight);
+         }
+
+         else if (sourceFormat == 6)
+            header->fCustomSourceFormat = 1;
+
+         else {
+            deb0p("ERROR. Source format illegal.\n");
+            goto exitAfterBitError;
+         }
+
+         /* OPPTYPE bits 4 - 18 */
+         bits4To18OfOPPTYPE = (int) getBits(15, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 15;
+
+
+         /* OPPTYPE bit 4, Custom PCF */
+         header->fCustomPCF = ((bits4To18OfOPPTYPE & 0x4000) > 0);
+
+         /* OPPTYPE bit 5, Unrestricted Motion Vector mode */
+         header->fUMV = ((bits4To18OfOPPTYPE & 0x2000) > 0);
+
+         /* OPPTYPE bit 6, Syntax-based Arithmetic Coding mode */
+         header->fSAC = ((bits4To18OfOPPTYPE & 0x1000) > 0);
+
+         /* OPPTYPE bit 7, Advanced Prediction mode */
+         header->fAP = ((bits4To18OfOPPTYPE & 0x0800) > 0);
+
+         /* OPPTYPE bit 8, Advanced INTRA Coding mode */
+         header->fAIC = ((bits4To18OfOPPTYPE & 0x0400) > 0);
+
+         /* OPPTYPE bit 9, Deblocking filter mode */
+         header->fDF = ((bits4To18OfOPPTYPE & 0x0200) > 0);
+
+         /* OPPTYPE bit 10, Slice Structured mode */
+         header->fSS = ((bits4To18OfOPPTYPE & 0x0100) > 0);
+
+         /* OPPTYPE bit 11, Reference Picture Selection mode */
+         header->fRPS = ((bits4To18OfOPPTYPE & 0x0080) > 0);
+
+         /* OPPTYPE bit 12, Independent Segment Decoding mode */
+         header->fISD = ((bits4To18OfOPPTYPE & 0x0040) > 0);
+
+         /* OPPTYPE bit 13, Alternative Inter VLC mode */
+         header->fAIV = ((bits4To18OfOPPTYPE & 0x0020) > 0);
+
+         /* OPPTYPE bit 14, Modified Quantization mode */
+         header->fMQ = ((bits4To18OfOPPTYPE & 0x0010) > 0);
+
+         /* OPPTYPE bits 15 - 18 must be '1000' */
+         if ((bits4To18OfOPPTYPE & 0x000F) != 8) {
+            deb0p("ERROR. OPPTYPE bits 15 - 18 illegal.\n");
+            goto exitAfterBitError;
+         }
+
+         /* Mode interaction restrictions, see section 5.1.4.6 of 
+            the H.263 recommendation */
+         if (header->fSAC && (header->fAIV || header->fMQ || header->fUMV)) {
+            deb0p("ERROR. Illegal bit pattern (section 5.1.4.6).\n");
+            goto exitAfterBitError;
+         }
+      }
+
+      /* MPPTYPE, bits 1 - 3, Picture type code */
+      header->pictureType = (int) getBits(3, inBuffer, &numBitsGot,
+         bitErrorIndication, &bibError);
+      header->numBits += 3;
+
+
+      if (header->pictureType >= 6) {
+         deb0p("ERROR. Picture type code illegal.\n");
+         goto exitAfterBitError;
+      }
+
+      /* MPPTYPE, bits 4 - 9 */
+      bits4To9OfMPPTYPE = (int) getBits(6, inBuffer, &numBitsGot,
+         bitErrorIndication, &bibError);
+      header->numBits += 6;
+
+
+      /* MPPTYPE bit 4, Reference Picture Resampling mode */
+      header->fRPR = ((bits4To9OfMPPTYPE & 32) > 0);
+
+      /* MPPTYPE bit 5, Reduced-Resolution Update mode */
+      header->fRRU = ((bits4To9OfMPPTYPE & 16) > 0);
+
+      /* RPR/RRU must not be set for I or EI-pictures.
+         (See section 5.1.4.5 of the H.263 recommendation.) */
+      if ((header->fRPR || header->fRRU) &&
+         (header->pictureType == VDX_PIC_TYPE_I || 
+            header->pictureType == VDX_PIC_TYPE_EI)) {
+         deb0p("ERROR. RPR or RRU is set for I or EI.\n");
+         goto exitAfterBitError;
+      }
+
+      /* MPPTYPE bit 6, Rounding type */
+      header->rtype = ((bits4To9OfMPPTYPE & 8) > 0);
+
+      /* RTYPE must be 0 if other than P, Improved PB or EP picture
+         (see section 5.1.4.3 of the H.263 recommendation */
+
+      /* MPPTYPE bits 7 - 9, must be '001' */
+      if ((bits4To9OfMPPTYPE & 7) != 1) {
+         deb0p("ERROR. MPPTYPE bits 7 - 9 illegal.\n");
+         goto exitAfterBitError;
+      }
+
+      /* CPM */
+      header->cpm = (int) getBits(1, inBuffer, &numBitsGot,
+         bitErrorIndication, &bibError);
+      header->numBits += 1;
+
+
+      if (header->cpm) {
+         /* PSBI */
+         header->psbi = (int) getBits(2, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 2;
+
+
+      }
+
+      if (header->fCustomSourceFormat) {
+         int parCode, fExtendedPAR = 0, pwi, phi;
+
+         /* CPFMT bits 1 - 4, Pixel Aspect Ratio code */
+         parCode = (int) getBits(4, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 4;
+
+
+
+         switch (parCode) {
+
+            case 1: /* Square */
+               header->parWidth = 1;
+               header->parHeight = 1;
+               break;
+
+            case 2: /* CIF for 4:3 picture */
+               header->parWidth = 12;
+               header->parHeight = 11;
+               break;
+
+            case 3: /* 525-type for 4:3 picture */
+               header->parWidth = 10;
+               header->parHeight = 11;
+               break;
+
+            case 4: /* CIF stretched for 16:9 picture */
+               header->parWidth = 16;
+               header->parHeight = 11;
+               break;
+
+            case 5: /* 525-type stretched for 16:9 picture */
+               header->parWidth = 40;
+               header->parHeight = 33;
+               break;
+
+            case 15: /* extended PAR */
+               fExtendedPAR = 1;
+               break;
+
+            default:
+               deb0p("ERROR. PAR code illegal.\n");
+               goto exitAfterBitError;
+         }
+
+         /* CPFMT bits 5 - 13, picture width indication */
+         pwi = (int) getBits(9, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 9;
+
+
+         header->lumWidth = ((pwi + 1) <<2 /** 4*/);
+
+         /* CPFMT bit 14 must be 1 */
+         tmp = getBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         header->numBits += 1;
+
+
+         if ( tmp == 0 ) {
+            deb0p("ERROR. CPFMT bit 14 is 0.\n");
+            goto exitAfterBitError;
+         }
+
+         /* CPFMT bits 15 - 23, picture height indication */
+         phi = (int) getBits(9, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 9;
+
+
+         if (phi == 0 || phi > 288) {
+            deb0p("ERROR. PHI illegal.\n");
+            goto exitAfterBitError;
+         }
+         header->lumHeight = (phi <<2 /** 4*/);
+
+         if (fExtendedPAR) {
+            /* EPAR bits 1 - 8, PAR Width */
+            header->parWidth = (int) getBits(8, inBuffer, &numBitsGot,
+               bitErrorIndication, &bibError);
+            header->numBits += 8;
+
+
+            if (header->parWidth == 0) {
+               deb0p("ERROR. PAR width illegal.\n");
+               goto exitAfterBitError;
+            }
+
+            /* EPAR bits 9 - 16, PAR Height */
+            header->parHeight = (int) getBits(8, inBuffer, &numBitsGot,
+               bitErrorIndication, &bibError);
+            header->numBits += 8;
+
+
+            if (header->parHeight == 0) {
+               deb0p("ERROR. PAR height illegal.\n");
+               goto exitAfterBitError;
+            }
+         }
+      } /* endif (customSourceFormat) */
+
+      if (header->fCustomPCF) {
+         int clockConversionCode;
+         u_int32 clockDivisor, conversionFactor;
+
+         /* CPCFC bit 1, Clock conversion code */
+         clockConversionCode = (int) getBits(1, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 1;
+
+
+         if (clockConversionCode)
+            conversionFactor = 1001;
+         else
+            conversionFactor = 1000;
+
+         /* CPCFC bits 2 - 8, Clock divisor */
+         clockDivisor = getBits(7, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 7;
+
+
+         if (clockDivisor == 0) {
+            deb0p("ERROR. Illegal clock divisor.\n");
+            goto exitAfterBitError;
+         }
+ 
+         header->pcfRate = 1800000LU;
+         header->pcfScale = clockDivisor * conversionFactor;
+      }
+
+      else {
+         /* CIF clock frequency */
+         header->pcfRate = 2997;
+         header->pcfScale = 100;
+      }
+
+      if (header->fCustomPCF || (!header->ufep && inpParam->fCustomPCF)) {
+         int etr;
+
+         /* ETR */
+         etr = (int) getBits(2, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 2;
+
+
+
+         header->tr |= (etr << 8);
+      }
+
+      if (header->fUMV) {
+         /* UUI */
+         tmp = getBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         header->numBits += 1;
+
+
+         if ( tmp )
+            header->fUMVLimited = 1;
+
+         else {
+            tmp = getBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+            header->numBits += 1;
+
+
+            if ( tmp )
+               header->fUMVLimited = 0;
+            else {
+               /* '00' forbidden */
+               deb0p("ERROR. Illegal UUI.\n");
+               goto exitAfterBitError;
+            }
+         }
+
+
+      }
+
+      if (header->fSS) {
+         /* SSS */
+         tmp = (int) getBits(1, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+
+         header->fRectangularSlices = tmp;
+         header->numBits += 1;
+
+         header->fArbitrarySliceOrdering = (int) getBits(1, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 1;
+
+
+         /* Mode interaction restriction, see section 5.1.4.6 of 
+            the H.263 recommendation */
+         if (header->fISD && !header->fRectangularSlices) {
+            deb0p("ERROR. Illegal bit pattern (section 5.1.4.6).\n");
+            goto exitAfterBitError;
+         }
+      }
+
+      if (inpParam->fScalabilityMode) {
+         /* ELNUM */
+         header->elnum = (int) getBits(4, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 4;
+
+      }
+
+      if (inpParam->fScalabilityMode && header->ufep) {
+         /* RLNUM */
+         header->rlnum = (int) getBits(4, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 4;
+
+      }
+
+      if (header->fRPS) {
+         /* RPSMF */
+         header->rpsMode = (int) getBits(3, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 3;
+
+
+         if (header->rpsMode < 4) {
+            deb0p("ERROR. Illegal RPSMF.\n");
+            goto exitAfterBitError;
+         }
+
+         header->rpsMode -= 4; /* 4..7 --> 0..3 */
+      }
+
+      /* If no OPPTYPE but RPS was previously on or RPS signaled in OPPTYPE */
+      if ((inpParam->fRPS && header->ufep == 0) || header->fRPS) {
+         /* TRPI */
+         header->trpi = (int) getBits(1, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 1;
+
+
+         if (header->trpi) {
+            /* TRP */
+            header->trp = (int) getBits(10, inBuffer, &numBitsGot,
+               bitErrorIndication, &bibError);
+            header->numBits += 10;
+
+
+            deb2f(bcmDebFile, "TRPI in picture header. TR = %d, TRP = %d.\n", 
+               header->tr, header->trp);            
+         }
+
+            /* Code following the standard */
+
+            /* BCI */
+            tmp = getBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+            header->numBits += 1;
+
+
+            if ( tmp ) {
+               /* BCM not supported */
+               deb0p("ERROR. BCM not supported.\n");
+               goto exitAfterBitError;
+            }
+
+            else {
+               tmp = getBits(1, inBuffer, &numBitsGot,bitErrorIndication, &bibError);
+               header->numBits += 1;
+
+
+               if ( !tmp ) {
+                  /* BCI '00' is illegal */
+                  deb0p("ERROR. Illegal BCI.\n");
+                  goto exitAfterBitError;
+               }
+            }
+
+      }
+
+      if (header->fRPR) {
+         /* RPRP not supported */
+         deb0p("ERROR. RPRP not supported.\n");
+         goto exitAfterBitError;
+      }
+   }
+
+   else {
+      deb0p("ERROR. Source format illegal.\n");
+      goto exitAfterBitError;
+   }
+
+   /* PQUANT */
+   header->pquantPosition = header->numBits;
+   header->pquant = (int) getBits(5, inBuffer, &numBitsGot,
+      bitErrorIndication, &bibError);
+   header->numBits += 5;
+
+
+   if (header->pquant == 0) {
+      deb0p("ERROR. PQUANT illegal.\n");
+      goto exitAfterBitError;
+   }
+
+   if (!header->fPLUSPTYPE) {
+      /* CPM */
+      header->cpm = (int) getBits(1, inBuffer, &numBitsGot,
+         bitErrorIndication, &bibError);
+      header->numBits += 1;
+
+
+      if (header->cpm) {
+         /* PSBI */
+         header->psbi = (int) getBits(2, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError); 
+         header->numBits += 2;
+
+
+      }
+   }
+
+   /* If PB-frame */
+   if (header->pictureType == VDX_PIC_TYPE_PB || 
+      header->pictureType == VDX_PIC_TYPE_IPB) {
+
+      /* TRB */
+
+      /* If custom picture clock frequence is used */
+      if (header->fCustomPCF || inpParam->fCustomPCF) {
+         header->trb = (int) getBits(5, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 5;
+
+
+      }
+
+      else {
+         header->trb = (int) getBits(3, inBuffer, &numBitsGot,
+            bitErrorIndication, &bibError);
+         header->numBits += 3;
+
+
+      }
+
+      if (header->trb == 0) {
+         deb0p("ERROR. TRB illegal.\n");
+         goto exitAfterBitError;
+      }
+
+      /* DBQUANT */
+      header->dbquant = (int) getBits(2, inBuffer, &numBitsGot,
+         bitErrorIndication, &bibError);
+      header->numBits += 2;
+
+
+   }
+
+
+   /* Check success and return */
+
+
+
+   /* If no error in bit buffer functions */
+   if (!bibError)
+      return VDX_OK;
+
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else other error in bit buffer functions */
+   else
+      return VDX_ERR_BIB;
+
+   exitAfterBitError:
+      if (bibError && bibError != ERR_BIB_NOT_ENOUGH_DATA)
+         return VDX_ERR_BIB;
+      return VDX_OK_BUT_BIT_ERROR;
+}
+
+
+/* {{-output"vdxFlushSEI.txt"}} */
+/*
+ * vdxFlushSEI
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function discards (flushes) all consequent PEI/PSUPP pairs.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+int vdxFlushSEI(
+   bibBuffer_t *inBuffer,
+   int *bitErrorIndication )
+/* {{-output"vdxFlushSEI.txt"}} */
+{
+   int
+      numBitsGot;
+   int16
+      bibError = 0;
+   u_int32 
+      pei,
+      psupp;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   do {
+      /* PEI */
+      pei = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+      if (pei) {
+         /* PSUPP */
+         psupp = bibGetBits(8, inBuffer, &numBitsGot, bitErrorIndication, 
+            &bibError);
+         // ignore the value of psupp; this is flush-function
+         if ( psupp )
+            {
+            }
+
+
+      }
+   } while (pei);   
+
+   return VDX_OK;
+
+}
+
+
+/* {{-output"vdxGetSEI.txt"}} */
+/*
+ * vdxGetSEI
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *
+ *    ftype                      FTYPE field as defined in table L.1 of H.263,
+ *                               -1 if the value is not valid
+ *
+ *    dsize                      DSIZE as defined in section L.2 of H.263
+ *
+ *    parameterData              an array of (min) 16 entries,
+ *                               filled with dsize octets of parameter data
+ *
+ *    fLast                      set to 1 if the first PEI indicates that
+ *                               no PSUPPs follow. Otherwise 0.
+ *
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function gets supplemental enhancement information as defined
+ *    in Annex L of H.263.
+ *
+ * Note:
+ *    The start code emulation prevention necessity using "Do Nothing" function
+ *    is not checked. See section L.3 of H.263 for more details.
+ *    
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+int vdxGetSEI(
+   bibBuffer_t *inBuffer,
+   int *ftype,
+   int *dsize,
+   u_char *parameterData,
+   int *fLast,
+   int *bitErrorIndication)
+/* {{-output"vdxGetSEI.txt"}} */
+{
+   int
+      numBitsGot,
+      paramNum,
+      lftype, /* local FTYPE */
+      ldsize; /* local DSZIE */
+   int16
+      bibError = 0;
+   u_int32 
+      pei;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(ftype != NULL);
+   vdxAssert(dsize != NULL);
+   vdxAssert(parameterData != NULL);
+   vdxAssert(fLast != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   *ftype = -1;
+   *dsize = 0;   
+
+   /* PEI */
+   pei = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+   if (pei) {
+      *fLast = 0;
+
+      /* FTYPE */
+      lftype = (int) bibGetBits(4, inBuffer, &numBitsGot, bitErrorIndication, 
+         &bibError);
+
+
+      /* DSIZE */
+      ldsize = (int) bibGetBits(4, inBuffer, &numBitsGot, bitErrorIndication, 
+         &bibError);
+
+   }
+
+   else {
+      *fLast = 1;
+      return VDX_OK;
+   }
+
+   for (paramNum = 0; paramNum < ldsize; paramNum++) {
+      /* PEI */
+      pei = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+      if (!pei) {
+         deb0p("ERROR. DSIZE does not match with PEI.\n");
+         *fLast = 1;
+         return VDX_OK_BUT_BIT_ERROR;
+      }
+
+      /* PSUPP containing parameter data */
+      parameterData[paramNum] = (u_char) bibGetBits(8, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+
+   }
+
+   *ftype = lftype;
+   *dsize = ldsize;
+     
+   return VDX_OK;
+
+}
+
+
+/* {{-output"vdxGetAndParseSEI.txt"}} */
+/*
+ * vdxGetAndParseSEI
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *
+ *    fPLUSPTYPE                 indicates if PLUSPTYPE is in use
+ *
+ *    numScalabilityLayers       -1 if the very first picture,
+ *                               0 if Annex N scalability layers not in use,
+ *                               2..15 if Annex N scalability layers in use
+ *
+ *    sei                        parsed SEI data
+ *
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function gets supplemental enhancement information as defined
+ *    in Annex L and W of H.263 and returns the parsed data.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ */
+
+int vdxGetAndParseSEI(
+   bibBuffer_t *inBuffer,
+   int fPLUSPTYPE,
+   int numScalabilityLayers,
+   vdxSEI_t *sei,
+   int *bitErrorIndication)
+/* {{-output"vdxGetAndParseSEI.txt"}} */
+{
+   int 
+       ret = VDX_OK,              /* Temporary variable to carry return values */
+      fSecondFTYPESet = 0,       /* 1 = Extended FTYPE in use, 
+                                    0 = Annex L/W FTYPE in use,
+                                    see L.15 for further details */
+      ftype,                     /* FTYPE as in section L.2 of H.263 */
+      dsize,                     /* DSIZE as in section L.2 of H.263 */
+      fLast,                     /* 1 if PEI is zero, 0 otherwise */
+      cont = 0,                  /* CONT as in section W.6 of H.263 */ 
+      ebit,                      /* EBIT as in section W.6 of H.263 */
+      mtype,                     /* MTYPE as in section W.6 of H.263 */
+      prevCONT = 0,              /* CONT field in the previous picture msg */
+      prevMTYPE = -1;            /* MTYPE in the previous picture msg */
+      
+   u_char
+      parameterData[16];
+
+   /* Initialize output data */
+   sei->fFullPictureFreezeRequest = 0;
+   sei->fFullPictureSnapshot = 0;
+   sei->snapshotId = 0;
+   sei->snapshotStatus = 255;
+   sei->scalabilityLayer = -1;
+   sei->numScalabilityLayers = 0;
+   memset(sei->prevPicHeader, 0, VDX_MAX_BYTES_IN_PIC_HEADER);
+   sei->numBytesInPrevPicHeader = 0;
+   sei->numBitsInLastByteOfPrevPicHeader = 0;
+   sei->fPrevPicHeaderTooLarge = 0;
+
+   do {
+      /* Get supplemental enhancement information */
+      ret = vdxGetSEI(inBuffer, &ftype, &dsize, parameterData, &fLast, 
+         bitErrorIndication);
+
+      /* If fatal error or bit error */
+      if (ret != VDX_OK)
+         return ret;
+
+      /* If the previous FTYPE indicated Extended Function Type */
+      if (fSecondFTYPESet) {
+
+         /* Let's discard FTYPE/DSIZE and parameters as suggested in 
+            section L.15 of H.263 Recommendation to allow backward
+            compatibility to to-be-defined set of extended FTYPEs. */
+            
+         /* The next expected FTYPE is a normal one defined in Annex L/W. */
+         fSecondFTYPESet = 0;
+
+         continue;
+      }
+
+      switch (ftype) {
+
+         /* If "Reserved" */
+         case 0:
+            ret = vdxActAfterIncorrectSEI(
+               inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            break;
+
+         /* If "Do Nothing" */
+         case 1:
+
+            if (dsize != 0) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            break;
+
+         /* If Full-Picture Freeze Request */
+         case 2:
+            if (dsize != 0) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            else
+               sei->fFullPictureFreezeRequest = 1;
+
+            break;
+
+         /* If Partial-Picture Freeze Request */
+         case 3:
+            if (dsize != 4) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            break;
+
+         /* If Resizing Partial-Picture Freeze Request */
+         case 4:
+            if (dsize != 8) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            break;
+
+         /* If Partial-Picture Freeze-Release Request */
+         case 5:
+            if (dsize != 4) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            break;
+
+         /* If Full-Picture Snapshot Tag */
+         case 6:
+            if (dsize != 4) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            else {
+               int i;
+               sei->fFullPictureSnapshot = 1;
+               /* store 32-bit snapshot ID, first byte is the least significant */
+               for (i = 0; i < 4; i++)
+                  sei->snapshotId |= (parameterData[i] << (i<<3 /**8*/));
+            }
+
+            break;
+
+         /* If Partial-Picture Snapshot Tag */
+         case 7:
+            if (dsize != 8) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            break;
+
+         /* If Video Time Segment Start Tag */
+         case 8:
+            if (dsize != 4) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            break;
+
+         /* If Video Time Segment End Tag */
+         case 9:
+            if (dsize != 4) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            break;
+
+         /* If Progressive Refinement Segment Start Tag */
+         case 10:
+            if (dsize != 4) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            break;
+
+         /* If Progressive Refinement Segment End Tag */
+         case 11:
+            if (dsize != 4) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            break;
+
+         /* If Chroma Keying Information */
+         case 12:
+            if (dsize < 1 || dsize > 9) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            break;
+
+         /* If Fixed-Point IDCT */
+         case 13:
+            if (dsize != 1) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            break;
+
+         /* If Picture Message */
+         case 14:
+            /* DSIZE shall be at least 1 to carry CONT, EBIT, and MTYPE */
+            if (dsize < 1) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            else {
+               cont = ( (parameterData[0] & 0x80) >> 7 ); 
+               ebit = ( (parameterData[0] & 0x70) >> 4 ); 
+               mtype = (parameterData[0] & 0x0f);
+
+               if (mtype < 1 || mtype > 5) {
+                  /* Non-text message, check restriction in W.6.2 */
+                  if (ebit != 0 && (cont == 1 || dsize == 1)) {
+                     ret = vdxActAfterIncorrectSEI(
+                        inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+                     break;
+                  }
+               }
+
+               /* If the previous picture message indicated that the data
+                  continues in the next picture message, but the current
+                  message type differs from the previous one
+                  (restricted in section W.6.1 of the H.263 Recommendation */
+               if (prevCONT && mtype != prevMTYPE) {
+                  ret = vdxActAfterIncorrectSEI(
+                     inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+                  break;
+               }
+            
+               /* If arbitrary binary data */
+               if (mtype == 0) {
+
+                  /* Proprietary snapshot status indication */
+                  if (parameterData[1] == 83 && parameterData[2] == 115) {
+                     if (dsize != 4) {
+                        ret = vdxActAfterIncorrectSEI(
+                           inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+                        break;
+                     }
+                     sei->snapshotStatus = parameterData[3];
+                  }
+
+                  /* Proprietary Annex N scalability layer 
+                     indication */
+                  else if (parameterData[1] == 83 && parameterData[2] == 108) {
+                     if (dsize != 4) {
+                        ret = vdxActAfterIncorrectSEI(
+                           inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+                        break;
+                     }
+                     sei->scalabilityLayer = parameterData[3] >> 4;
+                     sei->numScalabilityLayers = parameterData[3] & 15;
+
+                     /* If less than two scalability layers or
+                        max number of scalability layers changes during
+                        the sequence */
+                     if (sei->numScalabilityLayers < 2 ||
+                        (numScalabilityLayers >= 0 &&
+                           sei->numScalabilityLayers != 
+                           numScalabilityLayers)) {
+
+                        ret = vdxActAfterIncorrectSEI(
+                           inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+                        break;
+                     } 
+                  }
+               }
+
+               /* Else if Previous Picture Header Repetition */
+               else if (mtype == 7) {
+                  int
+                     firstIndexToWrite,
+                     numBytesToWrite;
+                  
+                  if (sei->numBytesInPrevPicHeader == 0)
+                     /* The first two bytes of PSC = 0x00 0x00 */
+                     sei->numBytesInPrevPicHeader = 2;
+                     
+                  firstIndexToWrite = sei->numBytesInPrevPicHeader;
+                  numBytesToWrite = dsize - 1;
+                  sei->numBitsInLastByteOfPrevPicHeader = 8 - ebit;
+
+                  /* If buffer would overflow */
+                  if (firstIndexToWrite + numBytesToWrite > 
+                     VDX_MAX_BYTES_IN_PIC_HEADER) {
+                     numBytesToWrite = 
+                        VDX_MAX_BYTES_IN_PIC_HEADER - firstIndexToWrite;
+                     sei->numBitsInLastByteOfPrevPicHeader = 8;
+                     sei->fPrevPicHeaderTooLarge = 1;
+                  }
+
+                  if (numBytesToWrite) {
+                     memcpy(
+                        &sei->prevPicHeader[firstIndexToWrite], 
+                        &parameterData[1],
+                        numBytesToWrite);
+
+                     sei->numBytesInPrevPicHeader += numBytesToWrite;
+                  }
+               }
+
+               prevCONT = cont;
+               prevMTYPE = mtype;
+            }
+            break;
+
+         /* If Extended Function Type */
+         case 15:
+            if (dsize != 0) {
+               ret = vdxActAfterIncorrectSEI(
+                  inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+            }
+
+            fSecondFTYPESet = 1;
+
+            break;
+      }
+   } while (!fLast && ret == VDX_OK);
+
+   /* If a picture message was not completed and the fault has not been
+      tracked earlier */
+   if (prevCONT && ret == VDX_OK) {
+      ret = vdxActAfterIncorrectSEI(
+         inBuffer, fPLUSPTYPE, &fLast, bitErrorIndication);
+   }
+
+   return ret;
+}
+
+
+/*
+ * GOB Layer Global Functions
+ */
+
+/* {{-output"vdxGetGOBHeader.txt"}} */
+/*
+ * vdxGetGOBHeader
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    inpParam                   input parameters
+ *    header                     output parameters: GOB header
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ * Function:
+ *    This function reads the H.263 GOB header.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+int vdxGetGOBHeader(
+   bibBuffer_t *inBuffer, 
+   const vdxGetGOBHeaderInputParam_t *inpParam,
+   vdxGOBHeader_t *header,
+   int *bitErrorIndication,
+   int aColorEffect,
+   int* aStartByteIndex,
+   int* aStartBitIndex, CMPEG4Transcoder *hTranscoder)
+/* {{-output"vdxGetGOBHeader.txt"}} */
+{
+   int
+      numBitsGot;
+   int16
+      bibError = 0;
+   u_int32 
+      tmp = 0;          /* temporary variable for reading some redundant bits */
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(inpParam != NULL);
+   vdxAssert(header != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   memset(header, 0, sizeof(vdxGOBHeader_t));
+   *bitErrorIndication = 0;
+
+   /* Assume that the existence of a GBSC has been checked, and
+      it is the next code in the buffer */
+
+   /* Flush stuffing (GSTUF) */
+   if (inpParam->numStuffBits)
+   {
+      bibFlushBits(inpParam->numStuffBits, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+      // if chroma has been removed and GSTUF is there, skip GSTUF bits to point to byte-aligned GBSC
+      if(aColorEffect==1 || aColorEffect==2)
+      {
+         (*aStartByteIndex)++;
+         *aStartBitIndex = 7;
+      }
+   }
+
+   /* MVE */
+     hTranscoder->H263GOBSliceHeaderBegin();
+
+    /* Flush GBSC */
+   bibFlushBits(17, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+   /* GBSC cannot contain fatal bit errors (checked earlier) */
+
+   /* GN */
+   header->gn = (int) bibGetBits(5, inBuffer, &numBitsGot, 
+      bitErrorIndication, &bibError);
+
+
+   /* If the GN field contains a fatal bit error or
+      the value of GN is not in the valid range 1..24.
+      This range is defined in section 5.2.3 of the standard.
+
+      Notice that in general case one cannot assume that the maximum GN
+      of the picture is the same as in the previous picture (GOB) since
+      a picture header may have been lost and the header could have contained
+      an indication of a picture format change. Therefore we have to stick
+      to the overall maximum GN, equal to 24, here. */
+
+   if ( header->gn == 0 /* PSC */ || 
+      header->gn > 24) {
+      deb0p("ERROR. GN illegal.\n");
+      goto exitAfterBitError;
+   }
+
+   if (inpParam->fCPM) {
+      /* GSBI */
+      header->gsbi = (int) bibGetBits(2, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+
+
+   }
+   /* GFID */
+   header->gfid = (int) bibGetBits(2, inBuffer, &numBitsGot, 
+      bitErrorIndication, &bibError);
+
+
+   /* GQUANT */
+   header->gquant = (int) bibGetBits(5, inBuffer, &numBitsGot, 
+      bitErrorIndication, &bibError);
+
+
+   if (header->gquant == 0) {
+      deb0p("ERROR. Illegal GQUANT.\n");
+      goto exitAfterBitError;
+   }
+
+   if (inpParam->fRPS) {
+      /* TRI */
+      header->tri = (int) bibGetBits(1, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+
+
+      /* If TR present */
+      if (header->tri) {
+         /* TR */
+         if (inpParam->fCustomPCF)
+            header->tr = (int) bibGetBits(10, inBuffer, &numBitsGot, 
+               bitErrorIndication, &bibError);
+         else
+            header->tr = (int) bibGetBits(8, inBuffer, &numBitsGot, 
+               bitErrorIndication, &bibError);
+
+
+      }
+
+      /* TRPI */
+      header->trpi = (int) bibGetBits(1, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+
+
+      /* If TRP present */
+      if (header->trpi) {
+         /* TRP */
+         header->trp = (int) bibGetBits(10, inBuffer, &numBitsGot, 
+            bitErrorIndication, &bibError);
+
+
+         deb2f(bcmDebFile, "TRPI in GOB header. GN = %d, TRP = %d.\n", 
+            header->gn, header->trp);         
+      }
+
+      /* BCI */
+         /* Code following the standard */
+
+         /* BCI */
+         tmp = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+         if ( tmp ) {
+            /* BCM not supported */
+            deb0p("ERROR. BCM not supported.\n");
+            goto exitAfterBitError;
+         }
+
+         else {
+            tmp = bibGetBits(1, inBuffer, &numBitsGot,bitErrorIndication, &bibError);
+
+
+            if ( !tmp ) {
+               /* BCI '00' is illegal */
+               deb0p("ERROR. Illegal BCI.\n");
+               goto exitAfterBitError;
+            }
+         }
+
+
+   }
+
+   /* Check success and return */
+
+
+   /* If no error in bit buffer functions */
+   if (!bibError)
+      return VDX_OK;
+
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else other error in bit buffer functions */
+   else
+      return VDX_ERR_BIB;
+
+   exitAfterBitError:
+      if (bibError && bibError != ERR_BIB_NOT_ENOUGH_DATA)
+         return VDX_ERR_BIB;
+
+      return VDX_OK_BUT_BIT_ERROR;
+}
+
+/*
+ * Slice Layer Global Functions
+ */
+
+/* {{-output"vdxGetSliceHeader.txt"}} */
+/*
+ * vdxGetSliceHeader
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    inpParam                   input parameters
+ *    header                     output parameters: Slice header
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ * Function:
+ *    This function reads the H.263 Slice header.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ */
+
+int vdxGetSliceHeader(
+   bibBuffer_t *inBuffer, 
+   const vdxGetSliceHeaderInputParam_t *inpParam,
+   vdxSliceHeader_t *header,
+   int *bitErrorIndication)
+/* {{-output"vdxGetSliceHeader.txt"}} */
+{
+   int
+      numBitsGot;
+   int16
+      bibError = 0;
+   u_int32 
+      tmp = 0;          /* temporary variable for reading some redundant bits */
+
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(inpParam != NULL);
+   vdxAssert(header != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   memset(header, 0, sizeof(vdxSliceHeader_t));
+   *bitErrorIndication = 0;
+
+   if (!inpParam->sliceHeaderAfterPSC)  {
+      /* Flush stuffing (GSTUF) */
+      if (inpParam->numStuffBits)
+         bibFlushBits(inpParam->numStuffBits, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+      /* Flush SSC */
+      /* Assume that the existence of a SSC has been checked, and
+         it is the next code in the buffer */
+
+      bibFlushBits(17, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+      /* SSC cannot contain fatal bit errors (checked earlier) */
+   }
+
+   /* Read SEPB1 (K.2.3) */
+   tmp = (int) bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+                           &bibError);
+   
+
+   if (tmp != 1)  {
+      deb0p("ERROR. SEPB1 illegal.\n");
+      goto exitAfterBitError;
+   }
+
+   /* SSBI */
+   if ((inpParam->fCPM) && (!inpParam->sliceHeaderAfterPSC))  {
+      header->ssbi = (int) bibGetBits(4, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+
+
+      /* If the SSBI field contains a fatal bit error or
+      the value of SSBI is not in the valid range 9..12.
+      This range is defined in Table K.1/H.263 */
+      if ( tmp < 9  || 
+         tmp > 12) {
+         deb0p("ERROR. SSBI illegal.\n");
+         goto exitAfterBitError;
+      }
+      /* Set emulated GN value */
+      header->gn = header->ssbi + 16;
+      /* Set sub-bitstream number */
+      if (header->gn < 29) 
+         header->sbn = header->ssbi - 9;
+      else
+         header->sbn = 3;
+   }
+
+
+   /* MBA */
+   header->mba = (int) bibGetBits(inpParam->mbaFieldWidth, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+
+
+   /* If the MBA field contains a fatal bit error or
+      the value of MBA is larger than Max Value defined in Table K.2/H.263 */
+   if ( header->mba > inpParam->mbaMaxValue) {
+      deb0p("ERROR. MBA illegal.\n");
+      goto exitAfterBitError;
+   }
+
+   /* SEPB2 */
+   if (inpParam->sliceHeaderAfterPSC)  {
+      if (inpParam->fRectangularSlices)   {
+         tmp = (int) bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+                              &bibError);
+
+
+         if (tmp != 1)  {
+            deb0p("ERROR. SEPB1 illegal.\n");
+            goto exitAfterBitError;
+         }
+      }
+   }
+   else  {
+      if (inpParam->fCPM)  {
+         if (inpParam->mbaFieldWidth > 9) {
+            tmp = (int) bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+                              &bibError);
+
+
+            if (tmp != 1)  {
+               deb0p("ERROR. SEPB1 illegal.\n");
+               goto exitAfterBitError;
+            }
+         }
+      }
+      else  {
+         if (inpParam->mbaFieldWidth > 11) {
+            tmp = (int) bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+                              &bibError);
+
+
+            if (tmp != 1)  {
+               deb0p("ERROR. SEPB1 illegal.\n");
+               goto exitAfterBitError;
+            }
+         }
+      }
+   }
+
+   /* SQUANT */
+   if (!inpParam->sliceHeaderAfterPSC)  {
+      header->squant = (int) bibGetBits(5, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+      if ( bibError )
+            return VDX_ERR_BIB;
+
+      /* If the SQUANT field contains a fatal bit error or
+         the value of SQUANT is between 1 and 31 */
+      if ( header->squant == 0) {
+         deb0p("ERROR. SQUANT illegal.\n");
+         goto exitAfterBitError;
+      }
+   }
+
+   /* SWI */
+   if (inpParam->fRectangularSlices)   {
+      header->swi = (int) bibGetBits(inpParam->swiFieldWidth, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+
+
+      /* If the MBA field contains a fatal bit error or
+         the value of MBA is larger than Max Value defined in Table K.2/H.263 */
+      if ( header->swi > inpParam->swiMaxValue) {
+         deb0p("ERROR. SWI illegal.\n");
+         goto exitAfterBitError;
+      }
+   }
+
+   /* Read SEPB3 */
+   tmp = (int) bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+                           &bibError);
+
+
+   if (tmp != 1)  {
+      deb0p("ERROR. SEPB3 illegal.\n");
+      goto exitAfterBitError;
+   }
+
+   /* GFID */
+   if (!inpParam->sliceHeaderAfterPSC)  {
+      header->gfid = (int) bibGetBits(2, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+
+
+   }
+
+   if (!inpParam->sliceHeaderAfterPSC && inpParam->fRPS) {
+      /* TRI */
+      header->tri = (int) bibGetBits(1, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+
+
+      /* If TR present */
+      if (header->tri) {
+         /* TR */
+/*         if (inpParam->fCustomPCF)
+            header->tr = (int) bibGetBits(10, inBuffer, &numBitsGot, 
+               bitErrorIndication, &bibError);
+         else*/
+            header->tr = (int) bibGetBits(8, inBuffer, &numBitsGot, 
+               bitErrorIndication, &bibError);
+
+
+      }
+
+      /* TRPI */
+      header->trpi = (int) bibGetBits(1, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+
+
+      /* If TRP present */
+      if (header->trpi) {
+         /* TRP */
+         header->trp = (int) bibGetBits(10, inBuffer, &numBitsGot, 
+            bitErrorIndication, &bibError);
+
+
+         deb2f(bcmDebFile, "TRPI in GOB header. GN = %d, TRP = %d.\n", 
+            header->gn, header->trp);         
+      }
+
+      /* BCI */
+         /* Code following the standard */
+
+         /* BCI */
+         tmp = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+         if ( tmp ) {
+            /* BCM not supported */
+            deb0p("ERROR. BCM not supported.\n");
+            goto exitAfterBitError;
+         }
+
+         else {
+            tmp = bibGetBits(1, inBuffer, &numBitsGot,bitErrorIndication, &bibError);
+
+
+            if ( !tmp ) {
+               /* BCI '00' is illegal */
+               deb0p("ERROR. Illegal BCI.\n");
+               goto exitAfterBitError;
+            }
+         }
+
+
+   }
+
+   /* Check success and return */
+
+
+   /* If no error in bit buffer functions */
+   if (!bibError)
+      return VDX_OK;
+
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else other error in bit buffer functions */
+   else
+      return VDX_ERR_BIB;
+   exitAfterBitError:
+      if (bibError && bibError != ERR_BIB_NOT_ENOUGH_DATA)
+         return VDX_ERR_BIB;
+
+      return VDX_OK_BUT_BIT_ERROR;
+}
+/* {{-output"vdxGetMBAandSWIValues.txt"}} */
+/*
+ * vdxGetIMBLayer
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    inpParam                   input parameters
+ *    outParam                   output parameters
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ * Function:
+ *    This function reads the macroblock layer data of an INTRA macroblock.
+ *
+ * Returns:
+ *    Nothing
+ *
+ */
+
+void vdxGetMBAandSWIValues(
+   int width,
+   int height,
+   int fRRU,
+   int *mbaFieldWidth,
+   int *mbaMaxValue,
+   int *swiFieldWidth,
+   int *swiMaxValue
+   )
+{
+   int 
+      pictureFormat;
+
+   pictureFormat = vdxFrameSizeToPictureFormat(width, height);
+ 
+   if (fRRU)  {
+      switch (pictureFormat)  {
+      case 0:
+         /* sub-QCIF */
+         *mbaFieldWidth = 5;
+         *mbaMaxValue = 11;
+         *swiFieldWidth = 3;
+         *swiMaxValue = 3;
+         break;
+      case 1:
+         /* QCIF */
+         *mbaFieldWidth = 6;
+         *mbaMaxValue = 29;
+         *swiFieldWidth = 3;
+         *swiMaxValue = 5;
+         break;
+      case 2:
+         /* CIF */
+         *mbaFieldWidth = 7;
+         *mbaMaxValue = 98;
+         *swiFieldWidth = 4;
+         *swiMaxValue = 10;
+         break;
+      case 3:
+         /* 4CIF */
+         *mbaFieldWidth = 9;
+         *mbaMaxValue = 395;
+         *swiFieldWidth = 5;
+         *swiMaxValue = 21;
+         break;
+      case 4:
+         /* 16CIF */
+         *mbaFieldWidth = 11;
+         *mbaMaxValue = 1583;
+         *swiFieldWidth = 6;
+         *swiMaxValue = 43;
+         break;
+      case 5:
+         /* 2048x1152 */
+         *mbaFieldWidth = 12;
+         *mbaMaxValue = 2303;
+         *swiFieldWidth = 6;
+         *swiMaxValue = 63;
+         break;
+      }
+   }
+   else  {
+      switch (pictureFormat)  {
+      case 0:
+         /* sub-QCIF */
+         *mbaFieldWidth = 6;
+         *mbaMaxValue = 47;
+         *swiFieldWidth = 4;
+         *swiMaxValue = 7;
+         break;
+      case 1:
+         /* QCIF */
+         *mbaFieldWidth = 7;
+         *mbaMaxValue = 98;
+         *swiFieldWidth = 4;
+         *swiMaxValue = 10;
+         break;
+      case 2:
+         /* CIF */
+         *mbaFieldWidth = 9;
+         *mbaMaxValue = 395;
+         *swiFieldWidth = 5;
+         *swiMaxValue = 21;
+         break;
+      case 3:
+         /* 4CIF */
+         *mbaFieldWidth = 11;
+         *mbaMaxValue = 1583;
+         *swiFieldWidth = 6;
+         *swiMaxValue = 43;
+         break;
+      case 4:
+         /* 16CIF */
+         *mbaFieldWidth = 13;
+         *mbaMaxValue = 6335;
+         *swiFieldWidth = 7;
+         *swiMaxValue = 87;
+         break;
+      case 5:
+         /* 2048x1152 */
+         *mbaFieldWidth = 14;
+         *mbaMaxValue = 9215;
+         *swiFieldWidth = 7;
+         *swiMaxValue = 127;
+         break;
+      }
+   }
+}
+
+/*
+ * Macroblock Layer Global Functions
+ */
+
+/* {{-output"vdxGetIMBLayer.txt"}} */
+/*
+ * vdxGetIMBLayer
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    inpParam                   input parameters
+ *    outParam                   output parameters
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ * Function:
+ *    This function reads the macroblock layer data of an INTRA macroblock.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+   
+int vdxGetIMBLayer(
+   bibBuffer_t *inBuffer, 
+   bibBuffer_t *outBuffer, 
+   bibBufferEdit_t *bufEdit,
+   int /*aColorEffect*/, 
+   int * /*aStartByteIndex*/, 
+   int * /*aStartBitIndex*/, 
+   TBool /*aGetDecodedFrame*/,
+   const vdxGetIMBLayerInputParam_t *inpParam,
+   vdxIMBLayer_t *outParam,
+   int *bitErrorIndication, CMPEG4Transcoder *hTranscoder)
+
+/* {{-output"vdxGetIMBLayer.txt"}} */
+{
+   int
+      mcbpcIndex,
+      cbpyIndex,
+      retValue = VDX_OK,
+      fDQUANT = 0,
+      fINTRAMODE,
+      bitsGot = 0;
+   int16 bibError = 0;
+
+   int StartByteIndex; 
+   int StartBitIndex;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(inpParam != NULL);
+   vdxAssert(outParam != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+     
+   /* MVE */
+     vdxIMBListItem_t *MBinstance;
+     // Create new MBInstance for the next MB 
+     MBinstance = (vdxIMBListItem_t *) malloc(sizeof(vdxIMBListItem_t));
+     if (!MBinstance)
+     {
+         deb("ERROR - vdxGetIMBLayer::MBinstance creation failed\n");
+         return H263D_ERROR;         
+     }
+     memset(MBinstance, 0, sizeof(vdxIMBListItem_t));
+     
+   /* Loop while MCBPC indicates stuffing */
+   do {
+     
+        StartByteIndex = inBuffer->getIndex; 
+        StartBitIndex  = inBuffer->bitIndex;
+         
+        /* MVE */
+        VDT_SET_START_POSITION(MBinstance,0,inBuffer->getIndex,inBuffer->bitIndex); // 0: mcbpc
+         
+        retValue = vdxGetMCBPCIntra(inBuffer, &mcbpcIndex, bitErrorIndication);
+        if (retValue != VDX_OK)
+             goto exitFunction;
+         
+        /* MVE */
+        /* remember to output the MB stufffing bits!! */
+        if (mcbpcIndex == 8) 
+        {
+            /* copy data from inbuffer to outbuffer  */
+            bufEdit->copyMode = CopyWhole; // copy whole
+            CopyStream(inBuffer,outBuffer,bufEdit,StartByteIndex,StartBitIndex);
+        }
+   } while (mcbpcIndex == 8);
+     
+    /* MVE */
+    VDT_SET_END_POSITION(MBinstance,0,inBuffer->getIndex,inBuffer->bitIndex); // 0: mcbpc
+     
+   /* CBPC (2 LSBs of MCBPC) */
+   outParam->cbpc = mcbpcIndex & 3;
+
+   /* DQUANT is given for MCBPC indexes 4..7 */
+   fDQUANT = mcbpcIndex & 4;
+
+   /* MB Type*/
+   outParam->mbType = (mcbpcIndex <4)?3:4;
+   
+   /* INTRA_MODE */
+   if (inpParam->fAIC)
+   {
+      retValue = vdxGetIntraMode(inBuffer,&fINTRAMODE,bitErrorIndication);
+      if (retValue != VDX_OK)
+         goto exitFunction;
+      outParam->predMode = fINTRAMODE;
+   }
+
+   /* ac_pred_flag (1 bit) */
+   if (inpParam->fMPEG4) {
+      outParam->ac_pred_flag = (u_char) bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+
+   }
+
+     /* MVE */
+   VDT_SET_START_POSITION(MBinstance,2,inBuffer->getIndex,inBuffer->bitIndex); // 2: cbpy
+
+   /* CBPY */
+   retValue = vdxGetCBPY(inBuffer, &cbpyIndex, bitErrorIndication);
+   if (retValue != VDX_OK)
+      goto exitFunction;
+   outParam->cbpy = cbpyIndex;
+
+     /* MVE */
+   VDT_SET_END_POSITION(MBinstance,2,inBuffer->getIndex,inBuffer->bitIndex); // 2: cbpy
+   VDT_SET_START_POSITION(MBinstance,1,inBuffer->getIndex,inBuffer->bitIndex); // 1: dquant
+     
+   if (fDQUANT) {
+         retValue = vdxUpdateQuant(inBuffer, inpParam->fMQ, inpParam->quant,
+             &outParam->quant, bitErrorIndication);
+         if (retValue != VDX_OK)
+             goto exitFunction;
+   }
+     
+   /* Else no DQUANT */
+   else
+         outParam->quant = inpParam->quant;
+   
+   /* Color Toning */
+   hTranscoder->AfterMBLayer(outParam->quant);
+     
+exitFunction:
+     
+     /* MVE */
+   VDT_SET_END_POSITION(MBinstance,1,inBuffer->getIndex,inBuffer->bitIndex); // 1: dquant
+   outParam->mcbpc = mcbpcIndex;
+     
+   MBinstance->mcbpc = mcbpcIndex;
+   MBinstance->quant = outParam->quant;
+   MBinstance->cbpc  = outParam->cbpc;
+   MBinstance->cbpy  = outParam->cbpy;
+   MBinstance->ac_pred_flag = outParam->ac_pred_flag; 
+   MBinstance->dquant       = fDQUANT ?  outParam->quant - inpParam->quant : 0;
+     
+   hTranscoder->OneIMBDataStarted(MBinstance);
+   free(MBinstance);
+     
+   return retValue;
+}
+
+
+/* {{-output"vdxGetPPBMBLayer.txt"}} */
+/*
+ * vdxGetPPBMBLayer
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    inpParam                   input parameters
+ *    outParam                   output parameters
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ * Function:
+ *    This function reads the macroblock layer data of an INTER macroblock.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+
+int vdxGetPPBMBLayer(
+   bibBuffer_t *inBuffer, 
+   bibBuffer_t *outBuffer, 
+   bibBufferEdit_t *bufEdit,
+   int /*aColorEffect*/,
+   int */*aStartByteIndex*/, 
+   int */*aStartBitIndex*/, 
+   TBool /*aGetDecodedFrame*/, 
+   int * /*bwMBType*/, 
+   const vdxGetPPBMBLayerInputParam_t *inpParam,
+   vdxPPBMBLayer_t *outParam,
+   int *bitErrorIndication, CMPEG4Transcoder *hTranscoder)
+
+/* {{-output"vdxGetPPBMBLayer.txt"}} */
+{
+   static const int mbTypeToMBClass[6] = 
+      {VDX_MB_INTER, VDX_MB_INTER, VDX_MB_INTER, 
+       VDX_MB_INTRA, VDX_MB_INTRA, VDX_MB_INTER};
+
+   static const int mbTypeToDQUANTI[6] =
+      {0, 1, 0, 0, 1, 1};
+
+   int
+      numBitsGot,
+      retValue = VDX_OK,
+      mcbpc,
+      mbType,
+      mbClass,
+      fDQUANT = 0,
+      fMVD,
+      numMVs,
+      fCBPB,
+      fMVDB,
+      cbpyIndex,
+      fINTRAMODE;
+   int16
+      bibError = 0;
+   u_int32 
+      bits;
+
+   int StartByteIndex; 
+   int StartBitIndex;
+
+    vdxAssert(inBuffer != NULL);
+    vdxAssert(inpParam != NULL);
+    vdxAssert(inpParam->pictureType == VDX_PIC_TYPE_P ||
+        inpParam->pictureType == VDX_PIC_TYPE_PB||
+        inpParam->pictureType == VDX_PIC_TYPE_IPB);
+    vdxAssert(outParam != NULL);
+    vdxAssert(bitErrorIndication != NULL);
+     
+    /* MVE */
+//    int startByteIndex = inBuffer->getIndex;
+//    int startBitIndex  = inBuffer->bitIndex;
+     
+    vdxPMBListItem_t *MBinstance;
+     // Create new MBInstance for the next MB 
+     MBinstance = (vdxPMBListItem_t *) malloc(sizeof(vdxPMBListItem_t));
+     if (!MBinstance)
+     {
+         deb("ERROR - vdxGetPMBLayer::MBinstance creation failed\n");
+         goto exitFunction;
+     }
+     memset(MBinstance, 0, sizeof(vdxPMBListItem_t));
+     VDT_SET_START_POSITION(MBinstance,11,0,7); // 11: MB stuffing bits
+     VDT_SET_END_POSITION(MBinstance,11,0,7); // 11: MB stuffing bits
+     
+   /* Set default output values */
+   memset(outParam, 0, sizeof(vdxPPBMBLayer_t));
+   outParam->quant = inpParam->quant;
+     
+   /* Loop while MCBPC indicates stuffing */
+   do {
+         
+         // note: stufffing includes COD+MCBPC in P frames
+         StartByteIndex = inBuffer->getIndex; 
+         StartBitIndex  = inBuffer->bitIndex;
+         
+         /* COD */
+         bits = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+             &bibError);
+         
+         
+         outParam->fCodedMB = (int) bits ^ 1;
+         
+         /* If not coded (i.e. if COD == 1) */
+         if (bits)
+             goto exitFunction;
+         
+         /* Else coded (i.e. if COD == 0) */
+         else {
+            /* MCBPC */
+
+            /* MVE */
+            VDT_SET_START_POSITION(MBinstance,0,inBuffer->getIndex,inBuffer->bitIndex); // 0: mcbpc
+
+            retValue = vdxGetMCBPCInter(
+                 inBuffer, 
+                 inpParam->fPLUSPTYPE,
+                 inpParam->fAP || inpParam->fDF,
+                 inpParam->fFirstMBOfPicture,
+                 &mcbpc, 
+                 bitErrorIndication);
+
+            if (retValue != VDX_OK)
+                 goto exitFunction;
+
+            /* See section 5.3.2 of the H.263 recommendation to find out 
+            the details of this illegal codeword check. */
+            if (mcbpc == 20 &&
+                 inpParam->pictureType == VDX_PIC_TYPE_IPB &&
+                 inpParam->fCustomSourceFormat &&
+                 inpParam->fFirstMBOfPicture) 
+            {
+                 deb0p("ERROR. Illegal MCBPC stuffing.\n");
+                 retValue = VDX_OK_BUT_BIT_ERROR;
+                 goto exitFunction;
+            }
+
+            /* MVE */
+            /* remember to output the MB stufffing bits!! */
+            if (mcbpc == 20) 
+            {
+                 // copy data from inbuffer to outbuffer 
+                 bufEdit->copyMode = CopyWhole; // copy whole
+                 CopyStream(inBuffer,outBuffer,bufEdit,StartByteIndex,StartBitIndex);
+            }
+         }
+   } while (mcbpc == 20);
+
+   /* Decrease indexes > 20 to enable consistent MCBPC handling */
+   if (mcbpc > 20)
+         mcbpc--;
+     
+    /* MVE */
+    VDT_SET_END_POSITION(MBinstance,0,inBuffer->getIndex,inBuffer->bitIndex); // 0: mcbpc
+   
+   /* CBPC (2 LSBs of MCBPC) */
+   outParam->cbpc = mcbpc & 3;
+     
+   /* MCBPC --> MB type & included data elements */
+   mbType = outParam->mbType = mcbpc / 4;
+   mbClass = outParam->mbClass = mbTypeToMBClass[mbType];
+   fDQUANT = mbTypeToDQUANTI[mbType];
+   /* MVD is included always for PB-frames and always if MB type is INTER */
+   fMVD = inpParam->pictureType != VDX_PIC_TYPE_P || mbClass == VDX_MB_INTER;
+   numMVs = outParam->numMVs = 
+      (fMVD) ?
+         ((mbType == 2 || mbType == 5) ? 4 : 1) :
+         0;
+
+   /* 4 MVs can be present only when in Advanced Prediction or Deblocking 
+      Filter mode */
+   if (numMVs == 4 && !inpParam->fAP && !inpParam->fDF) {
+      deb0p("ERROR. Illegal MCBPC.\n");
+      retValue = VDX_OK_BUT_BIT_ERROR;
+      goto exitFunction;
+   }
+
+   /* INTRA_MODE */
+   if ((inpParam->fAIC)&&((mbType == 3) || (mbType == 4)))
+   {
+      retValue = vdxGetIntraMode(inBuffer,&fINTRAMODE,bitErrorIndication);
+      if (retValue != VDX_OK)
+         goto exitFunction;
+      outParam->predMode = fINTRAMODE;
+   }
+
+   if (inpParam->pictureType == VDX_PIC_TYPE_PB) {
+      int modbIndex;
+      /* MODB */
+      retValue = vdxGetNormalMODB(inBuffer, &modbIndex, bitErrorIndication);
+      if (retValue != VDX_OK)
+         goto exitFunction;
+      fCBPB = (int) (modbIndex & 2);
+      fMVDB = outParam->fMVDB = (int) (modbIndex > 0);
+   }
+   else if (inpParam->pictureType == VDX_PIC_TYPE_IPB)
+   {
+      int modbIndex;
+      /* MODB in Improved PB mode */
+      retValue = vdxGetImpPBMODB(inBuffer,&modbIndex,bitErrorIndication);
+      fCBPB = (int) (modbIndex & 1);
+      fMVDB = outParam->fMVDB = (int) ((modbIndex & 2)>>1);
+      outParam->IPBPredMode = (int) (modbIndex / 2);
+   }
+   else {
+      fCBPB = 0;
+      fMVDB = outParam->fMVDB = 0;
+   }
+
+   if (fCBPB) {
+      /* CBPB */
+      outParam->cbpb = (int) bibGetBits(6, inBuffer, &numBitsGot, 
+         bitErrorIndication, &bibError);
+
+
+   }
+   else
+      outParam->cbpb = 0;
+
+   /* ac_pred_flag (1 bit) */
+   if (inpParam->fMPEG4) {
+      if (mbClass == VDX_MB_INTRA) {
+         outParam->ac_pred_flag = (u_char) bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+      }
+   }
+
+   /* MVE */
+   VDT_SET_START_POSITION(MBinstance,2,inBuffer->getIndex,inBuffer->bitIndex); // 2: cbpy
+
+   /* CBPY */
+   retValue = vdxGetCBPY(inBuffer, &cbpyIndex, bitErrorIndication);
+   if (retValue != VDX_OK)
+      goto exitFunction;
+
+   if (mbClass == VDX_MB_INTER)
+      /* Convert index to INTER CBPY */
+      outParam->cbpy = 15 - cbpyIndex;
+
+   else
+      outParam->cbpy = cbpyIndex;
+
+   /* MVE */
+   VDT_SET_END_POSITION(MBinstance,2,inBuffer->getIndex,inBuffer->bitIndex); // 2: cbpy
+   VDT_SET_START_POSITION(MBinstance,1,inBuffer->getIndex,inBuffer->bitIndex); // 1: dquant
+
+   if (fDQUANT) {
+      /* Get DQUANT and update QUANT */
+      retValue = vdxUpdateQuant(inBuffer, inpParam->fMQ, inpParam->quant,
+         &outParam->quant, bitErrorIndication);
+      if (retValue != VDX_OK)
+         goto exitFunction;
+   }
+
+   /* MVE */
+   VDT_SET_END_POSITION(MBinstance,1,inBuffer->getIndex,inBuffer->bitIndex); // 1: dquant
+   VDT_SET_START_POSITION(MBinstance,10,inBuffer->getIndex,inBuffer->bitIndex); // 10: mv
+
+   /* Color Toning */
+   hTranscoder->AfterMBLayer(outParam->quant);
+     
+
+   if (fMVD) {
+         int i;
+         
+         /* If no new Annex D is in use */
+         if (!inpParam->fPLUSPTYPE || !inpParam->fUMV) {
+             
+             if (inpParam->fMPEG4) {
+                 for (i = 0; i < numMVs; i++) {
+                     retValue = vdxGetScaledMVD(inBuffer,inpParam->f_code,&outParam->mvdx[i],bitErrorIndication);
+                     if (retValue != VDX_OK)
+                         goto exitFunction;
+                     
+                     retValue = vdxGetScaledMVD(inBuffer,inpParam->f_code,&outParam->mvdy[i],bitErrorIndication);
+                     if (retValue != VDX_OK)
+                         goto exitFunction;
+                 }
+             } else {
+                 for (i = 0; i < numMVs; i++) {
+                     retValue = vdxGetMVD(inBuffer, &outParam->mvdx[i], bitErrorIndication);
+                     if (retValue != VDX_OK)
+                         goto exitFunction;
+                     
+                     retValue = vdxGetMVD(inBuffer, &outParam->mvdy[i], bitErrorIndication);
+                     if (retValue != VDX_OK)
+                         goto exitFunction;
+                 }
+             }
+         }
+         
+         else if (inpParam->fPLUSPTYPE && inpParam->fUMV)   /* Annex D */
+         {
+             for (i = 0; i < numMVs; i++)
+             {
+                 retValue = vdxUMVGetMVD(inBuffer,&outParam->mvdx[i],bitErrorIndication);
+                 if (retValue != VDX_OK)
+                     goto exitFunction;
+                 
+                 retValue = vdxUMVGetMVD(inBuffer,&outParam->mvdy[i],bitErrorIndication);
+                 if (retValue != VDX_OK)
+                     goto exitFunction;
+                 
+                 if ((outParam->mvdx[i] == 5) && (outParam->mvdy[i] == 5))
+                     /* Read "Prevent Start Code Emulation bit" if 000000 occurs */
+                 {
+                     bits = bibGetBits(1,inBuffer,&numBitsGot,bitErrorIndication,
+                         &bibError);
+                     
+                     
+                     if (!bits) {
+                         retValue = VDX_OK_BUT_BIT_ERROR;
+                         goto exitFunction;
+                     }
+                 }
+             }
+         }
+   }
+     
+   if (fMVDB) {
+         int i;
+         if (!inpParam->fPLUSPTYPE || !inpParam->fUMV) 
+         {
+             retValue = vdxGetMVD(inBuffer,&outParam->mvdbx,bitErrorIndication);
+             if (retValue != VDX_OK)
+                 goto exitFunction;
+             
+             retValue = vdxGetMVD(inBuffer,&outParam->mvdby,bitErrorIndication);
+             if (retValue != VDX_OK)
+                 goto exitFunction;
+         }
+         else if (inpParam->fPLUSPTYPE && inpParam->fUMV)   /* Annex D */
+         {
+             for (i = 0; i < numMVs; i++)
+             {
+                 retValue = vdxUMVGetMVD(inBuffer,&outParam->mvdbx,bitErrorIndication);
+                 if (retValue != VDX_OK)
+                     goto exitFunction;
+                 
+                 retValue = vdxUMVGetMVD(inBuffer,&outParam->mvdby,bitErrorIndication);
+                 if (retValue != VDX_OK)
+                     goto exitFunction;
+                 
+                 if ((outParam->mvdbx == 5) && (outParam->mvdby == 5))
+                     /* Read "Prevent Start Code Emulation bit" if 000000 occurs */
+                 {
+                     bits = bibGetBits(1,inBuffer,&numBitsGot,bitErrorIndication,
+                         &bibError);
+                     
+                     if (!bits) {
+                         retValue = VDX_OK_BUT_BIT_ERROR;
+                         goto exitFunction;
+                     }
+                 }
+             }
+         }
+   }
+     
+     
+     
+exitFunction:
+     
+   /* MVE */
+   /* PB frame is not allowed !!! */
+   VDT_SET_END_POSITION(MBinstance,10,inBuffer->getIndex,inBuffer->bitIndex); // 10: mv
+   outParam->mcbpc = mcbpc;   
+
+   for (int i = 0; i < outParam->numMVs; i++)
+   {
+         MBinstance->mvx[i] = outParam->mvdx[i];
+         MBinstance->mvy[i] = outParam->mvdy[i];
+   }
+     
+   MBinstance->mcbpc        = outParam->mcbpc;
+   MBinstance->fCodedMB     = (unsigned char)outParam->fCodedMB ;           
+   MBinstance->mbType       = outParam->mbType;              
+   MBinstance->mbClass      = outParam->mbClass;             
+   MBinstance->quant        = outParam->quant;               
+   MBinstance->cbpc         = outParam->cbpc;                
+   MBinstance->cbpy         = outParam->cbpy;                
+   MBinstance->ac_pred_flag = outParam->ac_pred_flag;
+   MBinstance->numMVs       = outParam->numMVs; 
+   MBinstance->dquant       = fDQUANT ?  outParam->quant - inpParam->quant : 0;
+     
+   hTranscoder->OnePMBDataStarted(MBinstance);
+   free(MBinstance);
+     
+   return retValue;
+}
+
+
+/*
+ * Block Layer Global Functions
+ */
+
+/* {{-output"vdxGetIntraDCTBlock.txt"}} */
+/*
+ * vdxGetIntraDCTBlock
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    fCodedBlock                0 if COD is 1, 1 if COD is 0
+ *    block                      DCT coefficients of the block 
+ *                               in zigzag order
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *    fMQ                        flag for Modified Quantization
+ *    qp                         quantization parameter
+ *
+ * Function:
+ *    This function gets the DCT coefficients for one INTRA block.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+int vdxGetIntraDCTBlock(
+   bibBuffer_t *inBuffer, 
+   int fCodedBlock,
+   int *block,
+   int *bitErrorIndication,
+   int fMQ,
+   int qp)
+/* {{-output"vdxGetIntraDCTBlock.txt"}} */
+{
+   int
+      numBitsGot,
+      retValue = VDX_OK;
+   int16
+      bibError = 0;
+   u_int32 
+      bits;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(block != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   /* MVE */
+   int fEscapeCodeUsed = 0;
+
+   /* INTRADC */
+   bits = bibGetBits(8, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+   block[0] = (int) (bits << 3);
+
+   /* If (FLC == 1111 1111) */
+   if (block[0] == 2040)
+      block[0] = 1024;
+
+   
+   if (fCodedBlock)
+      retValue = vdxGetDCTBlock(inBuffer, 1, 0, block, bitErrorIndication, fMQ,qp, &fEscapeCodeUsed);
+
+   else
+      memset(block + 1, 0, 63 * sizeof(int));
+
+   return retValue;
+
+
+}
+
+
+/* {{-output"vdxGetDCTBlock.txt"}} */
+/*
+ * vdxGetDCTBlock
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    startIndex                 the first index in block where to put data
+ *    fMPEG4EscapeCodes          use MPEG-4 escape codes (3 alternatives)
+ *    block                      array for block (length 64)
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *    fMQ
+ *    qp
+ *    fEscapeCodeUsed            
+ * Function:
+ *    This function reads a block from bit buffer using Huffman codes listed
+ *    in TCOEF table. The place, where the block is read is given as a
+ *    pointer parameter.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ *
+ */
+
+int vdxGetDCTBlock(
+   bibBuffer_t *inBuffer, 
+   int startIndex,
+   u_char fMPEG4EscapeCodes,
+   int *block,
+   int *bitErrorIndication,
+   int fMQ,
+   int qp,
+   int *fEscapeCodeUsed)
+/* {{-output"vdxGetDCTBlock.txt"}} */
+{
+   /* Lookup tables: val field contains
+      1 bit for LAST, 8 bits for RUN and 4 bits for LEVEL */
+   static const vdxVLCTable_t tcoefTab0[] = {
+      {4225,7}, {4209,7}, {4193,7}, {4177,7}, {193,7}, {177,7},
+      {161,7}, {4,7}, {4161,6}, {4161,6}, {4145,6}, {4145,6},
+      {4129,6}, {4129,6}, {4113,6}, {4113,6}, {145,6}, {145,6},
+      {129,6}, {129,6}, {113,6}, {113,6}, {97,6}, {97,6},
+      {18,6}, {18,6}, {3,6}, {3,6}, {81,5}, {81,5},
+      {81,5}, {81,5}, {65,5}, {65,5}, {65,5}, {65,5},
+      {49,5}, {49,5}, {49,5}, {49,5}, {4097,4}, {4097,4},
+      {4097,4}, {4097,4}, {4097,4}, {4097,4}, {4097,4}, {4097,4},
+      {1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2},
+      {1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2},
+      {1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2},
+      {1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2},
+      {1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2},
+      {1,2}, {1,2}, {17,3}, {17,3}, {17,3}, {17,3},
+      {17,3}, {17,3}, {17,3}, {17,3}, {17,3}, {17,3},
+      {17,3}, {17,3}, {17,3}, {17,3}, {17,3}, {17,3},
+      {33,4}, {33,4}, {33,4}, {33,4}, {33,4}, {33,4},
+      {33,4}, {33,4}, {2,4}, {2,4}, {2,4}, {2,4},
+      {2,4}, {2,4}, {2,4}, {2,4}
+   };
+
+   static const vdxVLCTable_t tcoefTab1[] = {
+      {9,10}, {8,10}, {4481,9}, {4481,9}, {4465,9}, {4465,9},
+      {4449,9}, {4449,9}, {4433,9}, {4433,9}, {4417,9}, {4417,9},
+      {4401,9}, {4401,9}, {4385,9}, {4385,9}, {4369,9}, {4369,9},
+      {4098,9}, {4098,9}, {353,9}, {353,9}, {337,9}, {337,9},
+      {321,9}, {321,9}, {305,9}, {305,9}, {289,9}, {289,9},
+      {273,9}, {273,9}, {257,9}, {257,9}, {241,9}, {241,9},
+      {66,9}, {66,9}, {50,9}, {50,9}, {7,9}, {7,9},
+      {6,9}, {6,9}, {4353,8}, {4353,8}, {4353,8}, {4353,8},
+      {4337,8}, {4337,8}, {4337,8}, {4337,8}, {4321,8}, {4321,8},
+      {4321,8}, {4321,8}, {4305,8}, {4305,8}, {4305,8}, {4305,8},
+      {4289,8}, {4289,8}, {4289,8}, {4289,8}, {4273,8}, {4273,8},
+      {4273,8}, {4273,8}, {4257,8}, {4257,8}, {4257,8}, {4257,8},
+      {4241,8}, {4241,8}, {4241,8}, {4241,8}, {225,8}, {225,8},
+      {225,8}, {225,8}, {209,8}, {209,8}, {209,8}, {209,8},
+      {34,8}, {34,8}, {34,8}, {34,8}, {19,8}, {19,8},
+      {19,8}, {19,8}, {5,8}, {5,8}, {5,8}, {5,8}
+   };
+
+   static const vdxVLCTable_t tcoefTab2[] = {
+      {4114,11}, {4114,11}, {4099,11}, {4099,11}, {11,11}, {11,11},
+      {10,11}, {10,11}, {4545,10}, {4545,10}, {4545,10}, {4545,10},
+      {4529,10}, {4529,10}, {4529,10}, {4529,10}, {4513,10}, {4513,10},
+      {4513,10}, {4513,10}, {4497,10}, {4497,10}, {4497,10}, {4497,10},
+      {146,10}, {146,10}, {146,10}, {146,10}, {130,10}, {130,10},
+      {130,10}, {130,10}, {114,10}, {114,10}, {114,10}, {114,10},
+      {98,10}, {98,10}, {98,10}, {98,10}, {82,10}, {82,10},
+      {82,10}, {82,10}, {51,10}, {51,10}, {51,10}, {51,10},
+      {35,10}, {35,10}, {35,10}, {35,10}, {20,10}, {20,10},
+      {20,10}, {20,10}, {12,11}, {12,11}, {21,11}, {21,11},
+      {369,11}, {369,11}, {385,11}, {385,11}, {4561,11}, {4561,11},
+      {4577,11}, {4577,11}, {4593,11}, {4593,11}, {4609,11}, {4609,11},
+      {22,12}, {36,12}, {67,12}, {83,12}, {99,12}, {162,12},
+      {401,12}, {417,12}, {4625,12}, {4641,12}, {4657,12}, {4673,12},
+      {4689,12}, {4705,12}, {4721,12}, {4737,12}, {7167,7},
+      {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},
+      {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},
+      {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},
+      {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},
+      {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7}, {7167,7},
+      {7167,7}
+   };
+
+   static const int inter_max_level[2][64] = {
+                                     {12,  6,  4,  3,  3,  3,  3,  2,
+                                       2,  2,  2,  1,  1,  1,  1,  1,
+                                       1,  1,  1,  1,  1,  1,  1,  1,
+                                       1,  1,  1,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0},
+ 
+                                      {3,  2,  1,  1,  1,  1,  1,  1,
+                                       1,  1,  1,  1,  1,  1,  1,  1,
+                                       1,  1,  1,  1,  1,  1,  1,  1,
+                                       1,  1,  1,  1,  1,  1,  1,  1,
+                                       1,  1,  1,  1,  1,  1,  1,  1,
+                                       1,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0}
+                                    };
+
+   static const int inter_max_run0[13] = { 999,
+                                   26, 10,  6,  2,  1,  1,
+                                    0,  0,  0,  0,  0,  0
+                                };
+  
+   static const int inter_max_run1[4] = { 999, 40,  1,  0 };
+
+   int
+      numBitsGot, /* number of bits got from bit buffer */
+      retValue = VDX_OK,
+      code,       /* bits got from bit buffer */
+      index,      /* index to zigzag table running from 1 to 63 */
+      run,        /* RUN code */
+      level;      /* LEVEL code */
+
+   int16
+      bibError = 0;
+
+   u_int32 
+      last,       /* LAST code (see standard) */
+      sign,       /* sign for level */
+      tmp;        /* temporary variable for reading some redundant bits */
+
+   vdxVLCTable_t const *tab; /* pointer to lookup table */
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(startIndex == 0 || startIndex == 1);
+   vdxAssert(block != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   /* Reset all coefficients to zero in order to avoid writing
+      zeros one by one during run-length decoding */
+   memset(&block[startIndex], 0, (64 - startIndex) * sizeof(int));
+
+   index = startIndex;
+
+   /* MVE */
+   *fEscapeCodeUsed = 0;
+
+   do {
+      /* Read next codeword */
+      code = (int) bibShowBits(12, inBuffer, &numBitsGot, bitErrorIndication,
+         &bibError);
+
+
+      /* Select the right table and index for the codeword */
+      if (code >= 512)
+         tab = &tcoefTab0[(code >> 5) - 16];
+      else if (code >= 128)
+         tab = &tcoefTab1[(code >> 2) - 32];
+      else if (code >= 8)
+         tab = &tcoefTab2[code - 8];
+      else {
+         deb("ERROR - illegal TCOEF\n");
+         retValue = VDX_OK_BUT_BIT_ERROR;
+         goto exitFunction;
+      }
+
+      /* Flush the codeword from the buffer */
+      bibFlushBits(tab->len, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+      if (tab->val == 7167)     /* ESCAPE */
+      {
+
+          
+        /* the following is modified for 3-mode escape */
+        if(fMPEG4EscapeCodes) {
+
+          int run_offset=0,
+              level_offset=0;
+
+          code = (int) bibShowBits(2, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+          if (code<=2) {
+
+              /* escape modes: level or run is offset */
+              if (code==2) run_offset=1;
+              else level_offset=1;
+
+              /* Flush the escape code from the buffer */
+              if (run_offset)
+                  bibFlushBits(2, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+              else
+                  bibFlushBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+              /* Read next codeword */
+              code = (int) bibShowBits(12, inBuffer, &numBitsGot, bitErrorIndication,
+                  &bibError);
+
+
+
+              /* Select the right table and index for the codeword */
+              if (code >= 512)
+                  tab = &tcoefTab0[(code >> 5) - 16];
+              else if (code >= 128)
+                  tab = &tcoefTab1[(code >> 2) - 32];
+              else if (code >= 8)
+                  tab = &tcoefTab2[code - 8];
+              else {
+                  deb("ERROR - illegal TCOEF\n");
+                  retValue = VDX_OK_BUT_BIT_ERROR;
+                  goto exitFunction;
+              }
+
+              bibFlushBits(tab->len, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+              run = (tab->val >> 4) & 255;
+              level = tab->val & 15;
+              last = (tab->val >> 12) & 1;
+
+              /* need to add back the max level */
+              if (level_offset)
+                  level = level + inter_max_level[last][run];
+              else if (last)
+                  run = run + inter_max_run1[level]+1;
+              else
+                  run = run + inter_max_run0[level]+1;
+
+              sign = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication,
+                  &bibError);
+
+
+              
+              if (sign)
+                  level = -level;
+
+          } else {
+              
+              /* Flush the codeword from the buffer */
+              bibFlushBits(2, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+
+              /* LAST */
+              last = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+                  &bibError);
+
+
+
+              /* RUN */
+              run = (int) bibGetBits(6, inBuffer, &numBitsGot, bitErrorIndication, 
+                  &bibError);
+
+
+              /* MARKER BIT */
+              tmp = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication,&bibError);
+
+
+              if(!tmp) {
+                  retValue = VDX_OK_BUT_BIT_ERROR;
+                  goto exitFunction;
+              }
+              /* LEVEL */
+              level = (int) bibGetBits(12, inBuffer, &numBitsGot, bitErrorIndication, 
+                  &bibError);
+
+
+              /* MARKER BIT */
+              tmp = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication,&bibError);
+
+
+              if ( !tmp ) {
+                  retValue = VDX_OK_BUT_BIT_ERROR;
+                  goto exitFunction;
+              }
+
+              /* 0000 0000 0000 and 1000 0000 0000 is forbidden unless in MQ mode */
+              if (level == 0 || level == 2048) {
+                  deb("ERROR - illegal level.\n");
+                  retValue = VDX_OK_BUT_BIT_ERROR;
+                  goto exitFunction;
+              }
+
+              /* Codes 1000 0000 0001 .. 1111 1111 1111 */
+              if (level > 2048)
+                  level -= 4096;
+              
+          } /* flc */
+
+        } else { /* !fMPEG4EscapeCodes */
+
+            /* MVE */
+            *fEscapeCodeUsed = 1;
+            
+            /* LAST */
+            last = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+                &bibError);
+
+
+            /* RUN */
+            run = (int) bibGetBits(6, inBuffer, &numBitsGot, bitErrorIndication, 
+                &bibError);
+
+
+            /* LEVEL */
+            level = (int) bibGetBits(8, inBuffer, &numBitsGot, bitErrorIndication, 
+                &bibError);
+            
+
+            /* Codes 1000 0001 .. 1111 1111 */
+            if (level > 128)
+                level -= 256;
+
+
+            /* 0000 0000 is forbidden, 1000 0000 is forbidden unless in MQ mode */
+            if (level == 0) {
+                deb("ERROR - illegal level.\n");
+                retValue = VDX_OK_BUT_BIT_ERROR;
+                goto exitFunction;
+            }
+            if (level == 128)
+            {
+               if (fMQ)
+               {
+                  level = (int) bibGetBits(11,inBuffer,&numBitsGot,
+                     bitErrorIndication,&bibError);
+
+
+                  level = ((level&0x003F) <<5) | (level >> 6);
+                  if (level>1023) level -= 2048;
+
+                  /* See section T.5 of the H.263 recommendation to understand
+                     this restriction. */
+                    if (((level > -127) && (level < 127)) || (qp >= 8))
+                    {
+                        deb("ERROR - illegal extended level.\n");
+                        retValue = VDX_OK_BUT_BIT_ERROR;
+                        goto exitFunction;
+                    }
+                }
+                else
+                {
+                    deb("ERROR - illegal level.\n");
+                    retValue = VDX_OK_BUT_BIT_ERROR;
+                    goto exitFunction;
+                }
+            }
+        } /* End fMPEG4EscapeCodes switch */        
+      }
+
+      else {
+         run = (tab->val >> 4) & 255;
+         level = tab->val & 15;
+         last = (tab->val >> 12) & 1;
+
+         sign = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication,
+            &bibError);
+
+
+         if (sign)
+            level = -level;
+      }
+
+      /* If too many coefficients */
+      if (index + run > 63) {
+         deb("ERROR - too many TCOEFs.\n");
+         retValue = VDX_OK_BUT_BIT_ERROR;
+         goto exitFunction;
+      }
+
+      /* Do run-length decoding */
+
+      /* Note: No need to set coeffs to zero since they are already reset
+         in the beginning of the function */
+      index += run;
+
+         block[index++] = level;
+
+   } while (!last);
+
+   exitFunction:
+
+   /* Note: No need to set the rest of the coefficients to zero since
+      they are already reset in the beginning of the function */
+
+   if (!bibError)
+      return retValue;
+
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+   else if ( *bitErrorIndication ) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+   else
+      return VDX_ERR_BIB;
+}
+
+
+
+/*
+ * Picture Layer Local Functions
+ */
+
+/*
+ * vdxActAfterIncorrectSEI
+ *
+ * Parameters:
+ *    inBuffer                   B: Bit Buffer instance
+ *    fPLUSPTYPE                 I: signals the existence of PLUSPTYPE
+ *    fLast                      B: set to 1 if SEI flushed, 
+ *                                  otherwise not changed
+ *    bitErrorIndication         B: bit error indication, see biterr.h for
+ *                                  the possible values
+ *
+ * Function:
+ *    Problem: H.263 v1 did not specify FTYPE/DSIZE values, but rather
+ *    any data can be transfered in PSUPP. Section 5.1.3 of 
+ *    H.263 Recommendation specifies that Annex L and Annex W supplemental
+ *    enhancement functions can be used also if PLUSPTYPE is not in use.
+ *    Consequently, if PLUSPTYPE is not in use and if the bit-stream
+ *    violates FTYPE/DSIZE (or any other) rules defined in Annex L or 
+ *    Annex W, we do not know if the far-end encoder is transmitting
+ *    proprietary PSUPP values (allowed in H.263 v1) or if a bit error 
+ *    has hit the SEI data that actually follows Annex L/W. 
+ *
+ *    This function is called after an illegal Annex L/W parameter has
+ *    been detected. The function acts as follows:
+ *    - If PLUSPTYPE is in use, there must be
+ *      a bit error, and the function signals the error.
+ *    - If PLUSPTYPE is not in use, there is
+ *      a bit error or the far-end encoder uses proprietary PSUPP values.
+ *      The function flushes all PSUPP fields and returns without error
+ *      indication.
+ *      NOTE: This scheme could be improved if the decoder knows that
+ *      the far-end encoder is always following Annex L/W.
+ *
+ * Returns:
+ *    VDX_OK
+ *    VDX_OK_BUT_BIT_ERROR
+ *    VDX_ERR
+ */
+
+static int vdxActAfterIncorrectSEI(
+   bibBuffer_t *inBuffer,
+   int fPLUSPTYPE,
+   int *fLast,
+   int *bitErrorIndication)
+{
+   /* If Annex L/W is in use for sure */
+   if (fPLUSPTYPE) {
+
+      /* Return indication of bit error */
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else Annex L/W is not necessarily on */
+   else {
+      
+      /* We are out of sync due to bit error or 
+         do not understand the non-standard PEI/PSUPP syntax
+         --> flush the rest of PEI/PSUPP pairs */
+
+      *fLast = 1;
+
+      return vdxFlushSEI(inBuffer, bitErrorIndication);
+   }
+}
+
+
+/*
+ * vdxStandardSourceFormatToFrameSize
+ *    
+ *
+ * Parameters:
+ *    sourceFormat               the three source format bits
+ *    width                      luminance image width
+ *    height                     luminance image height
+ *
+ * Function:
+ *    This function converts the source format bits to luminance image size.
+ *
+ * Returns:
+ *    Nothing.
+ *
+ *    
+ *
+ */
+
+static void vdxStandardSourceFormatToFrameSize(int sourceFormat, int *width, int *height)
+{
+   vdxAssert(sourceFormat >= 1 && sourceFormat <= 5);
+
+   switch (sourceFormat) {
+      case 1:  /* sub-QCIF */
+         *width = 128;
+         *height = 96;
+         break;
+      case 2:  /* QCIF */
+         *width = 176;
+         *height = 144;
+         break;
+      case 3:  /* CIF */
+         *width = 352;
+         *height = 288;
+         break;
+      case 4:  /* 4CIF */
+         *width = 704;
+         *height = 576;
+         break;
+      case 5:  /* 16 CIF */
+         *width = 1408;
+         *height = 1152;
+         break;
+   }
+}
+
+
+/*
+ * Slice Layer Local Functions
+ */
+
+/*
+ * vdxFrameSizeToPictureFormat
+ *    
+ *
+ * Parameters:
+ *    width                      luminance image width
+ *    height                     luminance image height
+ *
+ * Function:
+ *    This function converts luminance image size to picture format.
+ *
+ * Returns:
+ *    Source format
+ *
+ *
+ */
+
+int vdxFrameSizeToPictureFormat(int width, int /*height*/)
+{
+   if (width <= 128) 
+      return 0;   /* sub-QCIF */
+   else if (width <= 176)
+      return 1;   /* QCIF */
+   else if (width <= 352)
+      return 2;   /* CIF */
+   else if (width <= 704)
+      return 3;   /* 4CIF */
+   else if (width <= 1408)
+      return 4;   /* 16CIF */
+   else if (width <= 2048)
+      return 5;   /* 2048x1152 */
+   else
+      return -1;  /* Should never happen */
+}
+
+/*
+ * Macroblock Layer Local Functions
+ */
+
+/*
+ * vdxGetCBPY
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    index                      index to the CBPY table of H.263
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the CBPY code.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+int vdxGetCBPY(bibBuffer_t *inBuffer, int *index, 
+   int *bitErrorIndication)
+{
+   static const vdxVLCTable_t tabCBPY[48] = {
+      {-1,0}, {-1,0}, {6,6}, {9,6}, {8,5}, {8,5}, {4,5}, {4,5},
+      {2,5}, {2,5}, {1,5}, {1,5}, {0,4}, {0,4}, {0,4}, {0,4},
+      {12,4}, {12,4}, {12,4}, {12,4}, {10,4},{10,4},{10,4},{10,4},
+      {14,4}, {14,4}, {14,4}, {14,4}, {5,4}, {5,4}, {5,4}, {5,4},
+      {13,4}, {13,4}, {13,4}, {13,4}, {3,4}, {3,4}, {3,4}, {3,4},
+      {11,4}, {11,4}, {11,4}, {11,4}, {7,4}, {7,4}, {7,4}, {7,4}
+   };
+
+   int bitsGot, code;
+   int16 ownError = 0;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(index != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   code = (int) bibShowBits(6, inBuffer, &bitsGot, bitErrorIndication, 
+      &ownError);
+
+
+   if (code >= 48) {
+      /* bit pattern = 11xxxx */
+      bibFlushBits(2, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+      *index = 15;
+      return VDX_OK;
+   }
+
+   if (code < 2) {
+      deb("vlcGetCBPY: ERROR - illegal code.\n");
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   bibFlushBits(tabCBPY[code].len, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+
+   *index = tabCBPY[code].val;
+
+   if (ownError)
+      return VDX_ERR_BIB;
+
+   return VDX_OK;
+}
+
+
+/*
+ * vdxGetMCBPCInter
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    fPLUSPTYPE                 flag to indicate if PLUSPTYPE is present
+ *    fFourMVsPossible           flag to indicate if four motion vectors per
+ *                               macroblock is allowed
+ *    fFirstMBOfPicture          flag to indicate if the current macroblock
+ *                               is the first one of the picture in scan-order
+ *    index                      index to the MCBPC table for P-pictures
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the MCBPC code for P-pictures.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ *    
+ */
+
+int vdxGetMCBPCInter(
+   bibBuffer_t *inBuffer, 
+   int fPLUSPTYPE,
+   int fFourMVsPossible,
+   int fFirstMBOfPicture,
+   int *index, 
+   int *bitErrorIndication)
+{
+   static const vdxVLCTable_t tabMCBPCInter[256] = {
+      {-1,0}, /* 0 = illegal */
+      {20,9}, /* 1 = 0000 0000 1 = stuffing */
+      {19,9}, /* 2 = 0000 0001 0 */
+      {18,9}, /* 3 = 0000 0001 1 */
+      {17,9}, /* 4 = 0000 0010 0 */
+      {7,9},  /* 5 = 0000 0010 1 */
+      {14,8}, {14,8}, /* 6..7 = 0000 0011 x */
+      {13,8}, {13,8}, /* 8..9 = 0000 0100 x */
+      {11,8}, {11,8}, /* 10..11 = 0000 0101 x */
+      {15,7}, {15,7}, {15,7}, {15,7}, /* 12..15 = 0000 011x x */
+      {10,7}, {10,7}, {10,7}, {10,7}, /* 16..19 = 0000 100x x */
+      { 9,7}, { 9,7}, { 9,7}, { 9,7}, /* 20..23 = 0000 101x x */
+      { 6,7}, { 6,7}, { 6,7}, { 6,7}, /* 24..27 = 0000 110x x */
+      { 5,7}, { 5,7}, { 5,7}, { 5,7}, /* 28..31 = 0000 111x x */
+      {16,6}, {16,6}, {16,6}, {16,6},
+      {16,6}, {16,6}, {16,6}, {16,6}, /* 32..39 = 0001 00xx x */
+      { 3,6}, { 3,6}, { 3,6}, { 3,6},
+      { 3,6}, { 3,6}, { 3,6}, { 3,6}, /* 40..47 = 0001 01xx x */
+      {12,5}, {12,5}, {12,5}, {12,5}, {12,5}, {12,5},
+      {12,5}, {12,5}, {12,5}, {12,5}, {12,5}, {12,5},
+      {12,5}, {12,5}, {12,5}, {12,5}, /* 48..63 = 0001 1xxx x */
+      { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4},
+      { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4},
+      { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4},
+      { 2,4}, { 2,4}, { 2,4}, { 2,4}, { 2,4}, /* 64..95 = 0010 xxxx x */
+      { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4},
+      { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4},
+      { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4},
+      { 1,4}, { 1,4}, { 1,4}, { 1,4}, { 1,4}, /* 96..127 = 0011 xxxx x */
+      {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3},
+      {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3},
+      {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3},
+      {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3},
+      {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3},
+      {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3},
+      {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3}, {8,3},
+      {8,3}, {8,3}, /* 128..191 = 010x xxxx x */
+      {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3},
+      {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3},
+      {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3},
+      {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3},
+      {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3},
+      {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3},
+      {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3}, {4,3},
+      {4,3}, {4,3}, {4,3} /* 192..255 = 011x xxxx x */
+   };
+
+   /* Indices 21 - 24 of the MCBPC table for P-pictures,
+      4 least significant bits from the maximum of 13 are used for indexing */
+   static const vdxVLCTable_t tabMCBPCInterIndices21To24[16] = {
+      {-1,0}, {-1,0}, {-1,0}, {-1,0}, 
+      {-1,0}, {-1,0}, {-1,0}, {-1,0},        /* 0000 0000 00xx x, illegal */
+      {21,11}, {21,11}, {21,11}, {21,11},    /* 0000 0000 010x x */
+      {22,13},                               /* 0000 0000 0110 0 */
+      {-1,0},                                /* 0000 0000 0110 1, illegal */
+      {23,13},                               /* 0000 0000 0111 0 */
+      {24,13}                                /* 0000 0000 0111 1 */
+   };
+
+   int bitsGot, code;
+   int16 ownError = 0;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(index != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   code = (int) bibShowBits(9, inBuffer, &bitsGot, bitErrorIndication, 
+      &ownError);
+
+
+   /* If index == 0 */
+   if (code >= 256) {
+      /* bit pattern = 1xxx xxxx x */
+      bibFlushBits(1, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+      *index = 0;
+      return VDX_OK;
+   }
+
+   /* If illegal code or indices 21 - 24 */
+   if (code == 0) {
+      /* 0000 0000 0 (indices 21 - 24 in MCBPC table for P-pictures)
+         can only be present if the conditions listed in  section 5.3.2 of 
+         the H.263 recommendation are fulfilled. Otherwise, the bit pattern
+         is considered an illegal codeword. */
+
+      /* If indices 21 - 24 */
+      if (fPLUSPTYPE && fFourMVsPossible && !fFirstMBOfPicture) {
+
+         /* Note: The following restriction is given in section 5.3.2 of 
+            the H.263 recommendation: "Also, encoders shall not allow an MCBPC
+            code for macroblock type 5 to immediately follow seven consecutive 
+            zeros in the bitstream (as can be caused by particular INTRADC codes
+            followed by COD=0), in order to prevent start code emulation."
+            This condition is not checked in the decoder, since it would require
+            relatively complex code structure and it is considered relatively
+            improbable. */
+
+         /* Read 13 bits */
+         code = (int) bibShowBits(13, inBuffer, &bitsGot, bitErrorIndication, 
+            &ownError);
+
+
+         /* Note: We already know that the first 9 bits are zero, thus code
+            cannot be larger than 15. */
+
+         *index = tabMCBPCInterIndices21To24[code].val;
+
+         /* If illegal bit pattern */
+         if (*index == -1) {
+            deb("vlcGetMCBPCInter: ERROR - illegal code.\n");
+            return VDX_OK_BUT_BIT_ERROR;
+         }
+
+         bibFlushBits(tabMCBPCInterIndices21To24[code].len, inBuffer, &bitsGot, 
+            bitErrorIndication, &ownError);
+      }
+
+      /* Else illegal code */
+      else {
+         deb("vlcGetMCBPCInter: ERROR - illegal code.\n");
+         return VDX_OK_BUT_BIT_ERROR;
+      }
+   }
+
+   /* Else indices 1 - 20 */
+   else {
+      bibFlushBits(tabMCBPCInter[code].len, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+   
+      *index = tabMCBPCInter[code].val;
+   }
+
+
+   if (ownError)
+      return VDX_ERR_BIB;
+
+   return VDX_OK;
+}
+
+
+/*
+ * vdxGetMCBPCIntra
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    index                      index to the MCBPC table for I-pictures
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the MCBPC code for I-pictures.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+int vdxGetMCBPCIntra(bibBuffer_t *inBuffer, int *index, 
+   int *bitErrorIndication)
+{
+   static const vdxVLCTable_t tabMCBPCIntra[64] = {
+      {-1,0}, /* illegal */
+      {5,6},
+      {6,6},
+      {7,6},
+      {4,4}, {4,4}, {4,4}, {4,4},
+      {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3}, {1,3},
+      {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3}, {2,3},
+      {3,3}, {3,3}, {3,3}, {3,3}, {3,3}, {3,3}, {3,3}, {3,3}
+   };
+
+   int bitsGot, code;
+   int16 ownError = 0;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(index != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   code = (int) bibShowBits(9, inBuffer, &bitsGot, bitErrorIndication, 
+      &ownError);
+
+
+   if (code == 1) {
+      /* macroblock stuffing */
+      bibFlushBits(9, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+      *index = 8;
+      return VDX_OK;
+   }
+
+   code >>= 3; /* remove unnecessary bits */
+
+   if (code == 0) {
+      deb("vlcGetMCBPCIntra: ERROR - illegal code.\n");
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   if (code >= 32) {
+      /* bit pattern = 1xxxxx */
+      bibFlushBits(1, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+      *index = 0;
+      return VDX_OK;
+   }
+
+   bibFlushBits(tabMCBPCIntra[code].len, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+
+   *index = tabMCBPCIntra[code].val;
+
+   if (ownError)
+      return VDX_ERR_BIB;
+
+   return VDX_OK;
+}
+
+
+/*
+ * vdxGetMVD
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    mvdx10                     the leftmost vector value from the motion
+ *                               vector VLC table multiplied by 10 to avoid 
+ *                               non-integer numbers.
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the MVD code.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+int vdxGetMVD(bibBuffer_t *inBuffer, int *mvdx10, 
+   int *bitErrorIndication)
+{
+   static const vdxVLCTable_t tabMVD0[14] = {
+      {15,4},  /* 0001 0 */
+      {-15,4}, /* 0001 1 */
+      {10,3}, {10,3},   /* 0010 */
+      {-10,3}, {-10,3}, /* 0011 */
+      {5,2}, {5,2}, {5,2}, {5,2},    /* 010 */
+      {-5,2}, {-5,2}, {-5,2}, {-5,2} /* 011 */
+   };
+
+   static const vdxVLCTable_t tabMVD1[96] = {
+      {60,10}, {-60,10},
+      {55,10}, {-55,10},
+      {50,9}, {50,9}, {-50,9}, {-50,9},
+      {45,9}, {45,9}, {-45,9}, {-45,9},
+      {40,9}, {40,9}, {-40,9}, {-40,9},
+      {35,7}, {35,7}, {35,7}, {35,7}, {35,7}, {35,7}, {35,7}, {35,7},
+      {-35,7}, {-35,7}, {-35,7}, {-35,7}, {-35,7}, {-35,7}, {-35,7}, {-35,7},
+      {30,7}, {30,7}, {30,7}, {30,7}, {30,7}, {30,7}, {30,7}, {30,7},
+      {-30,7}, {-30,7}, {-30,7}, {-30,7}, {-30,7}, {-30,7}, {-30,7}, {-30,7},
+      {25,7}, {25,7}, {25,7}, {25,7}, {25,7}, {25,7}, {25,7}, {25,7},
+      {-25,7}, {-25,7}, {-25,7}, {-25,7}, {-25,7}, {-25,7}, {-25,7}, {-25,7},
+      {20,6}, {20,6}, {20,6}, {20,6}, {20,6}, {20,6}, {20,6}, {20,6},
+      {20,6}, {20,6}, {20,6}, {20,6}, {20,6}, {20,6}, {20,6}, {20,6},
+      {-20,6}, {-20,6}, {-20,6}, {-20,6}, {-20,6}, {-20,6}, {-20,6}, {-20,6},
+      {-20,6}, {-20,6}, {-20,6}, {-20,6}, {-20,6}, {-20,6}, {-20,6}, {-20,6}
+   };
+
+   static const vdxVLCTable_t tabMVD2[] = {
+      {160,12}, {-160,12}, {155,12}, {-155,12},
+      {150,11}, {150,11}, {-150,11}, {-150,11},
+      {145,11}, {145,11}, {-145,11}, {-145,11},
+      {140,11}, {140,11}, {-140,11}, {-140,11},
+      {135,11}, {135,11}, {-135,11}, {-135,11},
+      {130,11}, {130,11}, {-130,11}, {-130,11},
+      {125,11}, {125,11}, {-125,11}, {-125,11},
+      {120,10}, {120,10}, {120,10}, {120,10},
+      {-120,10}, {-120,10}, {-120,10}, {-120,10},
+      {115,10}, {115,10}, {115,10}, {115,10},
+      {-115,10}, {-115,10}, {-115,10}, {-115,10},
+      {110,10}, {110,10}, {110,10}, {110,10},
+      {-110,10}, {-110,10}, {-110,10}, {-110,10},
+      {105,10}, {105,10}, {105,10}, {105,10},
+      {-105,10}, {-105,10}, {-105,10}, {-105,10},
+      {100,10}, {100,10}, {100,10}, {100,10},
+      {-100,10}, {-100,10}, {-100,10}, {-100,10},
+      {95,10}, {95,10}, {95,10}, {95,10},
+      {-95,10}, {-95,10}, {-95,10}, {-95,10},
+      {90,10}, {90,10}, {90,10}, {90,10},
+      {-90,10}, {-90,10}, {-90,10}, {-90,10},
+      {85,10}, {85,10}, {85,10}, {85,10},
+      {-85,10}, {-85,10}, {-85,10}, {-85,10},
+      {80,10}, {80,10}, {80,10}, {80,10},
+      {-80,10}, {-80,10}, {-80,10}, {-80,10},
+      {75,10}, {75,10}, {75,10}, {75,10},
+      {-75,10}, {-75,10}, {-75,10}, {-75,10},
+      {70,10}, {70,10}, {70,10}, {70,10},
+      {-70,10}, {-70,10}, {-70,10}, {-70,10},
+      {65,10}, {65,10}, {65,10}, {65,10},
+      {-65,10}, {-65,10}, {-65,10}, {-65,10}
+   };
+   int code, bitsGot;
+   int16 ownError = 0;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(mvdx10 != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   code = (int) bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+
+
+   if (code) {
+      *mvdx10 = 0;
+      return VDX_OK;
+   }
+
+   code = (int) bibShowBits(12, inBuffer, &bitsGot, bitErrorIndication, 
+      &ownError);
+
+   
+   if (code >= 512) {
+      code = (code >> 8) - 2;
+      bibFlushBits(tabMVD0[code].len, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+
+      *mvdx10 = tabMVD0[code].val;
+      return VDX_OK;
+   }
+
+   if (code >= 128) {
+      code = (code >> 2) - 32;
+      bibFlushBits(tabMVD1[code].len, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+
+
+      *mvdx10 = tabMVD1[code].val;
+      return VDX_OK;
+   }
+
+   /* If illegal code, return bit error.
+      In Table 14/H.263, the illegal codes are 0000 0000 000x x and 0000 0000 0010 0.
+      In Table B-12/MPEG-4 Visual, Section B.1.3, 0000 0000 0010 0 is legal.
+      To simplify the source code, 0000 0000 0010 0 is considered legal in  H.263 too */
+   if ((code -= 4) < 0) {
+      deb("vlcGetMVD: ERROR - illegal code.\n");
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   bibFlushBits(tabMVD2[code].len, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+
+
+   *mvdx10 = tabMVD2[code].val;
+   return VDX_OK;
+}
+
+
+/*
+ * vdxUMVGetMVD
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    mvdx10                     the leftmost vector value from the motion
+ *                               vector VLC table multiplied by 10 to avoid 
+ *                               non-integer numbers.
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the MVD code when unrestricted motion vector mode
+ *    is in use and PLUSTYPE is present.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally,but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ */
+
+static int vdxUMVGetMVD(bibBuffer_t *inBuffer,int *mvdx10,
+   int *bitErrorIndication)
+{
+   int code,bitsGot;
+   int16 ownError = 0;
+   int sign;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(mvdx10 != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   code = (int) bibGetBits(1,inBuffer,&bitsGot,bitErrorIndication,&ownError);
+
+
+   if (code) {
+      *mvdx10 = 0;
+      return VDX_OK;
+   }
+
+   code = (int) bibGetBits(1,inBuffer,&bitsGot,bitErrorIndication,&ownError);
+
+   code += 2;
+
+   while (bibGetBits(1,inBuffer,&bitsGot,bitErrorIndication,&ownError) 
+   )
+   {
+      code <<=1;
+      code = code + bibGetBits(1,inBuffer,&bitsGot,bitErrorIndication,&ownError);
+   }
+
+   
+   sign = (code & 0x0001)?-5:5;
+   code >>=1;
+   *mvdx10 = sign*code;
+   return VDX_OK;
+}
+
+/*
+ * vdxGetNormalMODB
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    index                      index to the MODB table
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the MODB code. The function should be used
+ *    in PB-frames mode (Annex G).
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+static int vdxGetNormalMODB(bibBuffer_t *inBuffer, int *index, 
+   int *bitErrorIndication)
+{
+   int bitsGot, code;
+   int16 ownError = 0;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(index != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   code = (int) bibShowBits(2, inBuffer, &bitsGot, bitErrorIndication, 
+      &ownError);
+
+
+   if (code < 2) {
+      /* code = 0 */
+      bibFlushBits(1, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+      *index = 0;
+      return VDX_OK;
+   }
+   else {
+      /* code = 10 or 11 */
+      bibFlushBits(2, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+      *index = code - 1;
+      return VDX_OK;
+   }
+}
+
+/*
+ * vdxGetImpPBMODB
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    index                      index to the MODB table
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the MODB code. This function should be used
+ *    in improved PB-frames mode (Annex M).
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally,but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ */
+
+static int vdxGetImpPBMODB(bibBuffer_t *inBuffer,int *index,
+   int *bitErrorIndication)
+{
+   int bitsGot,code;
+   int16 ownError = 0;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(index != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   code = (int) bibGetBits(1,inBuffer,&bitsGot,bitErrorIndication,
+      &ownError);
+
+
+   
+   if (code == 0)
+   {
+      /* Bidirectional Prediction: code = 0 */
+      *index = 0;
+      return VDX_OK;      
+   }
+   else
+   {
+      code = (int) bibGetBits(1,inBuffer,&bitsGot,bitErrorIndication,
+         &ownError);
+
+      if (code == 0)
+      {
+         /* Bidirectional Prediction: code = 10 */
+         *index = 1;
+         return VDX_OK;
+      }
+      else
+      {
+         code = (int) bibGetBits(1,inBuffer,&bitsGot,bitErrorIndication,
+            &ownError);
+
+
+         if (code == 0)
+         {
+            /* Forward Prediction: code = 110 */
+            *index = 2;
+            return VDX_OK;
+         }
+         else
+         {
+            code = (int) bibGetBits(1,inBuffer,&bitsGot,bitErrorIndication,
+               &ownError);
+
+
+            if (code == 0)
+            {
+               /* Forward Prediction: code = 1110 */
+               *index = 3;
+               return VDX_OK;
+            }
+            else
+            {
+               code = (int) bibGetBits(1,inBuffer,&bitsGot,bitErrorIndication,
+                  &ownError);
+
+
+               /* Backward Prediction: code = 11110 or 11111 */
+               *index = 4+code;
+               return VDX_OK;
+            }
+         }
+      }
+    }
+}
+
+/*
+ * vdxUpdateQuant
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    fMQ                        non-zero if the Modified Quantization mode
+ *                               (Annex T) is in use, otherwise zero
+ *    quant                      the quantization parameter for the previous
+ *                               macroblock
+ *    newQuant                   the updated quantization parameter for
+ *                               the current macroblock
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the DQUANT field and updated the current quantization
+ *    parameter appropriately.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ *
+ */
+
+int vdxUpdateQuant(
+   bibBuffer_t *inBuffer, 
+   int fMQ,
+   int quant,
+   int *newQuant,
+   int *bitErrorIndication)
+{
+   int
+      numBitsGot;
+   int16
+      bibError = 0;
+   u_int32 
+      bits;
+   static const int changeOfQuant[2][32] = 
+      {{0,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,-2,
+        -2,-2,-2,-2,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3},
+       {0,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,2,1,-5}};
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(newQuant != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   /* DQUANT */
+   if (!fMQ) {
+      bits = bibGetBits(2, inBuffer, &numBitsGot, bitErrorIndication, 
+         &bibError);
+
+
+      switch (bits) {
+         case 0: *newQuant = quant - 1; break;
+         case 1: *newQuant = quant - 2; break;
+         case 2: *newQuant = quant + 1; break;
+         case 3: *newQuant = quant + 2; break;
+      }
+
+      /* Clip QUANT to legal range */
+      if (*newQuant < 1)
+         *newQuant = 1;
+      else if (*newQuant > 31)
+         *newQuant = 31;
+   }
+   else
+   {
+      bits = bibGetBits(1,inBuffer,&numBitsGot,bitErrorIndication,
+         &bibError);
+
+
+      if (bits)
+      {
+         bits = bibGetBits(1,inBuffer,&numBitsGot,bitErrorIndication,
+            &bibError);
+
+         *newQuant = quant + changeOfQuant[bits][quant];
+      }
+      else
+      {
+         bits = bibGetBits(5,inBuffer,&numBitsGot,bitErrorIndication,
+            &bibError);
+
+         *newQuant = bits;
+      }
+   }
+
+   return VDX_OK;
+}
+
+
+/*
+ * vdxGetIntraMode
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    index                      index to the INTRA_MODE parameter for I-pictures
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the INTRA_MODE field from the MB header..
+ *    This field exists iff annex I is in use..
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally,but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ */
+
+
+static int vdxGetIntraMode(bibBuffer_t *inBuffer,int *index,
+   int *bitErrorIndication)
+
+{
+   int bitsGot,code;
+   int16 ownError = 0;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(index != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   code = (int) bibShowBits(2,inBuffer,&bitsGot,bitErrorIndication,
+      &ownError);
+
+
+   if (code > 1) {
+      /* Bitpattern 1x */
+      bibFlushBits(2,inBuffer,&bitsGot,bitErrorIndication,&ownError);
+      *index = code - 1;
+      return VDX_OK;
+   }
+
+   bibFlushBits(1,inBuffer,&bitsGot,bitErrorIndication,&ownError);
+   *index = 0;
+   return VDX_OK;
+}
+
+
+/*
+ * Block Layer Local Functions
+ */
+
+
+
+
+
+int vdxChangeBlackAndWhiteHeaderIntraIMB(bibBufferEdit_t *bufEdit, 
+                                                 int mcbpcIndex,
+                                                 int StartByteIndex, 
+                                                 int StartBitIndex)
+{
+    int k, cur_index, new_index, cur_len, new_len, new_val;
+    
+    const tVLCTable sCBPCIType[9] = 
+    {
+    {1, 1}, {1, 3}, {2, 3}, {3, 3}, {1, 4},
+    {1, 6}, {2, 6}, {3, 6}, {1, 9}
+    };
+    
+     // evaluate MCBPC parameters
+    int cur_cbpc = mcbpcIndex & 3;      
+    int new_cbpc = 0;       // cpbc=0 indicates chroma is 0
+    int mbType = (mcbpcIndex <4)?3:4;
+
+    // evaluate indices in table
+    cur_index = (mbType == 3 ? 0 : 4) + cur_cbpc;   
+    new_index = (mbType == 3 ? 0 : 4) + new_cbpc;   
+    
+    // retrieve values
+    cur_len = sCBPCIType[cur_index].length;
+    new_len = sCBPCIType[new_index].length;
+    new_val = sCBPCIType[new_index].code;
+    
+    // allocate memory for storing the parameters
+    if (!bufEdit->editParams)
+    {
+                bufEdit->editParams = (bibEditParams_t *) malloc(sizeof(bibEditParams_t));
+                bufEdit->numChanges=1;
+                bufEdit->copyMode = CopyWithEdit/*CopyWithEdit*/;
+    }
+    k=bufEdit->numChanges-1;
+    bufEdit->copyMode = CopyWithEdit; 
+    // store the new parameters
+    bufEdit->editParams[k].StartByteIndex = StartByteIndex; 
+    bufEdit->editParams[k].StartBitIndex = StartBitIndex; 
+    bufEdit->editParams[k].curNumBits = cur_len; 
+    bufEdit->editParams[k].newNumBits = new_len; 
+    bufEdit->editParams[k].newValue = new_val; 
+
+    return 0;
+}
+
+int vdxChangeBlackAndWhiteHeaderInterPMB(bibBufferEdit_t *bufEdit, 
+                                                 int mcbpcIndex,
+                                                 int StartByteIndex, 
+                                                 int StartBitIndex)
+{
+    int k, cur_index, new_index, cur_len, new_len, new_val;
+        
+    const tVLCTable sCBPCPType[21] = 
+    {
+    {1, 1}, {3, 4}, {2, 4}, {5, 6},
+    {3, 3}, {7, 7}, {6, 7}, {5, 9}, 
+    {2, 3}, {5, 7}, {4, 7}, {5, 8},
+    {3, 5}, {4, 8}, {3, 8}, {3, 7},
+    {4, 6}, {4, 9}, {3, 9}, {2, 9}, 
+    {1, 9}
+    };
+    
+     // evaluate MCBPC parameters
+    int cur_cbpc = mcbpcIndex & 3;      
+    int new_cbpc = 0;       // cpbc=0 indicates chroma is 0
+    int mbType; 
+
+    mbType = mcbpcIndex / 4;
+     
+    // evaluate indices in table
+    cur_index = mbType * 4 + cur_cbpc;  
+    new_index = mbType * 4 + new_cbpc;  
+    
+    // retrieve values
+    cur_len = sCBPCPType[cur_index].length;
+    new_len = sCBPCPType[new_index].length;
+    new_val = sCBPCPType[new_index].code;
+    
+    // allocate memory for storing the parameters
+    if (!bufEdit->editParams)
+    {
+                bufEdit->editParams = (bibEditParams_t *) malloc(sizeof(bibEditParams_t));
+                bufEdit->numChanges=1;
+                bufEdit->copyMode = CopyWithEdit/*CopyWithEdit*/; 
+    }
+    k=bufEdit->numChanges-1;
+    bufEdit->copyMode = CopyWithEdit/*CopyWithEdit*/; 
+    // store the new parameters
+    bufEdit->editParams[k].StartByteIndex = StartByteIndex; 
+    bufEdit->editParams[k].StartBitIndex = StartBitIndex; 
+    bufEdit->editParams[k].curNumBits = cur_len; 
+    bufEdit->editParams[k].newNumBits = new_len; 
+    bufEdit->editParams[k].newValue = new_val; 
+
+    return mbType;
+}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/viddemux_mpeg.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,4687 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* MPEG-4 bitstream parsing.
+*
+*/
+
+
+/*
+ * Includes
+ */
+
+#include "h263dConfig.h"
+#include "viddemux.h"
+#include "vdxint.h"
+#include "mpegcons.h"
+#include "sync.h"
+#include "vdcaic.h"
+#include "zigzag.h"
+#include "debug.h"
+#include "biblin.h"
+/* MVE */
+#include "MPEG4Transcoder.h"
+// <--
+
+/*
+ * Local function prototypes
+ */
+
+/* Macroblock Layer */
+
+static int vdxGetIntraDCSize(bibBuffer_t *inBuffer, int compnum, int *IntraDCSize, 
+   int *bitErrorIndication);
+
+static int vdxGetRVLCIndex(u_int32 bits, u_int32 *index, int *length, int intra_luma,
+   int *bitErrorIndication);
+
+
+/*
+ * Picture Layer Global Functions
+ */
+
+
+/*
+ *
+ * vdxGetVolHeader
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    header                     output parameters: VOL header
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the VO and VOL header from inBuffer.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *    VDX_ERR_NO_START_CODE      if start code is not found
+ *    VDX_ERR_NOT_SUPPORTED      if VOL header 
+ *
+ *    
+ */
+
+int vdxGetVolHeader(
+   bibBuffer_t *inBuffer,
+   vdxVolHeader_t *header,
+   int *bitErrorIndication,
+   int getInfo, int *aByteIndex, int *aBitIndex, CMPEG4Transcoder *hTranscoder)
+{
+   int bitsGot, sncCode, fUseDefaultVBVParams = 0, num_bits;
+   int16 bibError = 0;
+   u_int32 bits;
+
+   memset(header, 0, sizeof(vdxVolHeader_t));
+   *bitErrorIndication = 0;
+
+   /* if Visual Object Sequence Start Code is present */
+   bits = bibShowBits(MP4_VOS_START_CODE_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (bits == MP4_VOS_START_CODE) {
+
+      /* vos_start_code */
+      bibFlushBits(MP4_VOS_START_CODE_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+
+      /* profile_and_level_indication (8 bits) */
+      bits = bibGetBits(8, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      /* If fatal bit error occurred (lost segment/packet etc.) */
+      /*   
+           1: Simple Profile Level 1   (from ISO/IEC 14496-2:1999/FPDAM4 [N4350] July 2001)
+           2: Simple Profile Level 2   (from ISO/IEC 14496-2:1999/FPDAM4 [N4350] July 2001) 
+           3: Simple Profile Level 3   (from ISO/IEC 14496-2:1999/FPDAM4 [N4350] July 2001) 
+           8: Simple Profile Level 0   (from ISO/IEC 14496-2:1999/FPDAM4 [N5743] July 2003)
+           9: Simple Profile Level 0b  (from ISO/IEC 14496-2:1999/FPDAM4 [N5743] July 2003)
+      */
+#if 0
+      // Disabled since some clips have this set incorrectly, and this is not used for anything important.
+      // Only simple profile clips seem to be available so this should not cause any harm.
+      // Further, it is still checked in vedVolReader which is always used before editing. It is not checked only when creating thumbnails
+      
+      
+      if (bits != 1 && bits != 2 && bits != 3 && bits != 8 && bits != 9) {
+         /* this is not a supported simple profile stream */
+         deb("vdxGetMPEGVolHeader: ERROR - This is not a supported simple profile stream\n");
+         goto notSupported;
+      }
+#endif
+      if (bits != 8 && bits != 9) 
+        header->profile_level = (int) bits;
+      else
+        header->profile_level = 0;
+
+      /* User data if available */
+      bits = bibShowBits(32, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if (bits == MP4_USER_DATA_START_CODE)
+      {
+           if (!header->user_data) {
+               header->user_data = (char *) malloc(MAX_USER_DATA_LENGTH);
+               header->user_data_length = 0;
+           }
+
+           if (vdxGetUserData(inBuffer, header->user_data, &(header->user_data_length), bitErrorIndication) != VDX_OK)
+               /* also bibError will be handled in exitAfterBitError */
+               goto exitAfterBitError;               
+       }
+   }
+
+   /* if Visual Object Start Code is present */
+   bits = bibShowBits(MP4_VO_START_CODE_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (bits == MP4_VO_START_CODE) {
+
+      /* visual_object_start_code */
+      bibFlushBits(MP4_VO_START_CODE_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+
+      /* is_visual_object_identifier (1 bit) */
+      bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if (bits) {
+
+         /* visual_object_ver_id (4 bits) */
+         bits = bibGetBits(4, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         if (bits != 1) {
+            /* this is not an MPEG-4 version 1 stream */
+            deb("vdxGetMPEGVolHeader: ERROR - This is not an MPEG-4 version 1 stream\n");
+            goto notSupported;
+         }
+
+         /* visual_object_priority (3 bits) */
+         bits = bibGetBits(3, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         header->vo_priority = (int) bits;
+
+      } else {
+         header->vo_priority = 0;
+      }
+
+      /* visual_object_type (4 bits) */
+      bits = bibGetBits(4, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if (bits != 1) {
+         /* this is not a video object */
+         deb("vdxGetMPEGVolHeader: ERROR - This is not a video object\n");
+         goto notSupported;
+      }
+
+      /* is_video_signal_type (1 bit) */
+      bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if (bits) {
+
+           /* Note: The following fields in the bitstream give information about the 
+              video signal type before encoding. These parameters don't influence the 
+              decoding algorithm, but the composition at the output of the video decoder.
+              There is no normative requirement however to utilize this information 
+              during composition, therefore until a way to utilize them is found in
+              MoViDe, these fields are just dummyly read, but not interpreted.
+              For interpretation see the MPEG-4 Visual standard */
+
+         /* video_format (3 bits) */
+         bits = bibGetBits(3, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         header->video_format = (int) bits;
+
+         /* video_range (1 bit) */
+         bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         header->video_range = (int) bits;
+
+         /* colour_description (1 bit) */
+         bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         if (bits) {
+             
+            /* colour_primaries (8 bits) */
+            bits = bibGetBits(8, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+            header->colour_primaries = (int) bits;
+
+            /* transfer_characteristics (8 bits) */
+            bits = bibGetBits(8, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+            header->transfer_characteristics = (int) bits;
+
+            /* matrix_coefficients (8 bits) */
+            bits = bibGetBits(8, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+            header->matrix_coefficients = (int) bits;
+         } else {
+
+            header->colour_primaries = 1; /* default: ITU-R BT.709 */
+            header->transfer_characteristics = 1; /* default: ITU-R BT.709 */
+            header->matrix_coefficients = 1; /* default: ITU-R BT.709 */
+         }
+
+      } else {
+
+         /* default values */
+         header->video_format = 5; /* Unspecified video format */
+         header->video_range = 0; /* Y range 16-235 pixel values */
+         header->colour_primaries = 1; /* ITU-R BT.709 */
+         header->transfer_characteristics = 1; /* ITU-R BT.709 */
+         header->matrix_coefficients = 1; /* ITU-R BT.709 */
+      }
+
+      /* check the next start code */
+      sncCode = sncCheckMpegSync(inBuffer, 0, &bibError);
+       
+      /* If User data is available */
+      if (sncCode == SNC_USERDATA)
+      {
+         if (!header->user_data) {
+            header->user_data = (char *) malloc(MAX_USER_DATA_LENGTH);
+            header->user_data_length = 0;
+         }
+
+         if (vdxGetUserData(inBuffer, header->user_data, &(header->user_data_length), bitErrorIndication) != VDX_OK)
+            /* also bibError will be handled in exitAfterBitError */
+            goto exitAfterBitError;      
+           
+      } else if (sncCode != SNC_VID) {
+
+         deb("vdxGetMPEGVolHeader: ERROR. No Start code after VO header\n");
+         goto exitAfterBitError;
+      }
+   }
+   
+   /* if Video Object Start Code is present */
+   bits = bibShowBits(MP4_VID_START_CODE_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (bits == MP4_VID_START_CODE) {
+       /* video_object_start_code */
+      bibFlushBits(MP4_VID_START_CODE_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+
+      /* video_object_id */
+      bits = bibGetBits(MP4_VID_ID_CODE_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      header->vo_id = (int) bits;
+   }
+
+   /* MVE */
+   /* dummy indication of the position before VOL start code, only for recoginition of shortheader */
+   if (!getInfo)
+   {
+       hTranscoder->ErrorResilienceInfo(NULL, inBuffer->getIndex, inBuffer->bitIndex);
+   }
+
+   /* vol_start_code */
+   bits = bibShowBits(MP4_VOL_START_CODE_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if(bits != MP4_VOL_START_CODE)
+   {
+      /* If H.263 PSC, this is a short header stream, i.e. H.263 baseline */
+      if ( (bits >> 6) == 32 ) {
+         return VDX_OK;
+      } else {      
+         deb("vdxGetMPEGVolHeader: ERROR - Bitstream does not start with MP4_VOL_START_CODE\n");
+         goto exitAfterBitError;
+      }  
+   }
+
+   bibFlushBits(MP4_VOL_START_CODE_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+
+   /* vol_id */
+   bits = bibGetBits(MP4_VOL_ID_CODE_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   header->vol_id = (int) bits;
+
+   /* random_accessible_vol (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   header->random_accessible_vol = (u_char) bits;
+
+   /* video_object_type_indication (8 bits) */
+   bits = bibGetBits(8, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (bits != 1) {
+       /* this is not a simple video object stream */
+       deb("vdxGetMPEGVolHeader: ERROR - This is not a simple video object stream\n");
+       goto notSupported;
+   }
+
+   /* is_object_layer_identifier (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (bits) {
+      /* video_object_layer_verid (4 bits) */
+      bits = bibGetBits(4, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if (bits != 1) {
+         /* this is not an MPEG-4 version 1 stream */
+         deb("vdxGetMPEGVolHeader: ERROR - This is not an MPEG-4 version 1 stream\n");
+         goto notSupported;
+      }
+
+      /* video_object_layer_priority (3 bits) */
+      bits = bibGetBits(3, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      header->vo_priority = (int) bits;
+   } 
+
+   /* aspect_ratio_info: `0010`- 12:11 (625-type for 4:3 picture) */
+   bits = bibGetBits(4, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   header->pixel_aspect_ratio = (int) bits;
+
+   /* extended par */
+   if (bits == 15) { 
+      /* par_width */
+      bits = bibGetBits(8, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      /* par_height */
+      bits = bibGetBits(8, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   }
+   
+   /* vol_control_parameters flag */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (bits) {
+
+      /* chroma_format (2 bits) */
+      bits = bibGetBits(2, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if (bits != 1) {
+         goto exitAfterBitError;
+      }
+
+      /* low_delay (1 bits) */
+      bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+
+      /* vbv_parameters (1 bits) */
+      bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if (bits) {
+
+         /* first_half_bitrate (15 bits) */
+         bits = bibGetBits(15, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         header->bit_rate = (bits << 15);
+          
+         /* marker_bit */
+         if (!bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError))
+            goto exitAfterBitError;
+           
+         /* latter_half_bitrate (15 bits) */
+         bits = bibGetBits(15, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         header->bit_rate += bits;
+         header->bit_rate *= 400;
+           
+         /* marker_bit */
+         if (!bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError))
+            goto exitAfterBitError;
+
+         /* first_half_vbv_buffer_size (15 bits) */
+         bits = bibGetBits(15, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         header->vbv_buffer_size = (bits << 3);
+           
+         /* marker_bit */
+         if (!bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError))
+            goto exitAfterBitError;
+           
+         /* latter_half_vbv_buffer_size (3 bits) */
+         bits = bibGetBits(3, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         header->vbv_buffer_size += bits;
+         header->vbv_buffer_size <<= 14 /**= 16384*/;
+           
+         /* first_half_vbv_occupancy (11 bits) */
+         bits = bibGetBits(11, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         header->vbv_occupancy = (bits << 15);
+           
+         /* marker_bit */
+         if (!bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError))
+            goto exitAfterBitError;
+           
+         /* latter_half_vbv_occupancy (15 bits) */
+         bits = bibGetBits(15, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         header->vbv_occupancy += bits;
+         header->vbv_occupancy <<= 6 /**= 64*/;
+           
+         /* marker_bit */
+         if (!bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError))
+            goto exitAfterBitError;
+
+      } else {
+         fUseDefaultVBVParams = 1;
+      }
+   } else {
+      fUseDefaultVBVParams = 1;
+   }
+
+   if (fUseDefaultVBVParams) {
+
+      /* default values */
+      header->vbv_buffer_size = 
+        ((header->profile_level == 0 || header->profile_level == 1) ? 5 : 20);
+      header->vbv_occupancy = header->vbv_buffer_size*170;
+      header->bit_rate = 
+        ((header->profile_level == 0 || header->profile_level == 1) ? 64 : 
+        ((header->profile_level == 2) ? 128 : 384));
+       
+      header->vbv_occupancy <<= 6 /**= 64*/;
+      header->vbv_buffer_size <<= 14 /**= 16384*/;
+      header->bit_rate <<= 10 /**= 1024*/;
+   }
+
+   /* vol_shape (2 bits) */
+   bits = bibGetBits(2, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   /* rectangular_shape = '00' */
+   if (bits != 0) {
+      deb("vdxGetMPEGVolHeader: ERROR - Not rectangular shape is not supported\n");
+      goto notSupported;
+   }
+
+   /* marker_bit */
+   if (!bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError))
+      goto exitAfterBitError;
+    
+   /* MVE */
+   if (!getInfo)
+   {
+       hTranscoder->MPEG4TimerResolution(inBuffer->getIndex, inBuffer->bitIndex);
+   }
+   
+   /* time_increment_resolution */
+   bits = bibGetBits(16, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   header->time_increment_resolution = (int) bits;
+ 
+   /* marker_bit */
+   if (!bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError))
+      goto exitAfterBitError;
+    
+   /* fixed_vop_rate */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+
+   /* MVE */
+   header->fixed_vop_rate = (u_char)bits;
+
+   /* fixed_vop_time_increment (1-15 bits) */
+   if (bits) {
+      for (num_bits = 1; ((header->time_increment_resolution-1) >> num_bits) != 0; num_bits++)
+        {
+        }
+ 
+      bits = bibGetBits(num_bits, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   }
+
+   /* if rectangular_shape !always! */
+
+   /* marker_bit */
+   if (!bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError))
+      goto exitAfterBitError;
+    
+   /* vol_width (13 bits) */
+   bits = bibGetBits(13, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   header->lumWidth = (int) bits;
+
+   /* marker_bit */
+   if (!bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError))
+      goto exitAfterBitError;
+    
+   /* vol_height (13 bits) */
+   bits = bibGetBits(13, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   header->lumHeight = (int) bits;
+
+   /* endif rectangular_shape */
+
+   /* marker_bit */
+   if (!bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError))
+      goto exitAfterBitError;
+    
+   /* interlaced (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (bits)
+   {
+      deb("vdxGetMPEGVolHeader: ERROR - Interlaced VOP not supported\n");
+      goto notSupported;
+   }
+
+   /* OBMC_disable */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (!bits) {
+     deb("vdxGetMPEGVolHeader: ERROR - Overlapped motion compensation not supported\n");
+     goto notSupported;
+   }
+
+   /* sprite_enable (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (bits) {
+     deb("vdxGetMPEGVolHeader: ERROR - Sprites not supported\n");
+     goto notSupported;
+   }
+
+   /* not_8_bit (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (bits) {
+     deb("vdxGetMPEGVolHeader: ERROR - Not 8 bits/pixel not supported\n");
+     goto notSupported;
+   }
+
+   /* quant_type (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (bits) {
+     deb("vdxGetMPEGVolHeader: ERROR - H.263/MPEG-2 Quant Table switch not supported\n");
+     goto notSupported;
+   }
+
+   /* complexity_estimation_disable (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (!bits) {
+     deb("vdxGetMPEGVolHeader: ERROR - Complexity estimation header not supported\n");
+     goto notSupported;
+   }
+  
+   /* MVE */
+   if (!getInfo)
+   {
+       hTranscoder->ErrorResilienceInfo(NULL, inBuffer->getIndex, inBuffer->bitIndex);
+   }
+   else
+   {
+        *aByteIndex = inBuffer->getIndex;
+        *aBitIndex = inBuffer->bitIndex;
+   }
+
+   /* resync_marker_disable (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   header->error_res_disable = (u_char) bits;
+
+   /* data_partitioned (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   header->data_partitioned = (u_char) bits;
+
+   if (header->data_partitioned) {
+      /* reversible_vlc (1 bit) */
+      bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      header->reversible_vlc = (u_char) bits;
+   }
+
+   /* MVE */
+   if (!getInfo)
+   {
+       hTranscoder->ErrorResilienceInfo(header, 0, 0);
+   }
+
+   /* scalability (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if (bits) {
+     deb("vdxGetMPEGVolHeader: ERROR - Scalability not supported\n");
+     goto notSupported;
+   }
+
+   /* check the next start code */
+   sncCode = sncCheckMpegSync(inBuffer, 0, &bibError);
+
+   /* Removed since the VOL header may be followed by another header (H.245 & MPEG-4 signaling)
+      and sncCheckMpegSync does not recognize VOS start code
+   if (sncCode == SNC_NO_SYNC || bibError)
+   {
+      deb("vdxGetMPEGVolHeader: ERROR. No Start code after VOL header\n");
+      goto exitAfterBitError;
+   } 
+   */
+   /* If User data is available */
+   if (sncCode == SNC_USERDATA && !bibError)
+   {
+      if (!header->user_data) {
+         header->user_data = (char *) malloc(MAX_USER_DATA_LENGTH);
+         header->user_data_length = 0;
+      }
+       
+      if (vdxGetUserData(inBuffer, header->user_data, &(header->user_data_length), bitErrorIndication) != VDX_OK)
+         /* also bibError will be handled in exitAfterBitError */
+         goto exitAfterBitError;       
+   }
+
+   /* If no error in bit buffer functions */
+   if (!bibError)
+      return VDX_OK;
+
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else other error in bit buffer functions */
+   else
+      return VDX_ERR_BIB;
+
+   exitAfterBitError:
+   if (bibError && bibError != ERR_BIB_NOT_ENOUGH_DATA)
+       return VDX_ERR_BIB;
+
+   return VDX_OK_BUT_BIT_ERROR;
+
+   notSupported:
+   return VDX_ERR_NOT_SUPPORTED;
+}
+
+/* {{-output"vdxGetGovHeader.txt"}} */
+/*
+ *
+ * vdxGetGovHeader
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    header                     output parameters: picture header
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the GOV header from inBuffer.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *    VDX_ERR_NO_START_CODE      if start code is not found
+ *    VDX_ERR_NOT_SUPPORTED      if broken_link and closed_gov conflict
+ *
+ */
+
+int vdxGetGovHeader(
+   bibBuffer_t *inBuffer,
+   vdxGovHeader_t *header,
+   int *bitErrorIndication)
+/* {{-output"vdxGetGovHeader.txt"}} */
+{
+   int tmpvar;
+   u_int32 bits;
+   int time_s;
+   int bitsGot, sncCode;
+   int16 bibError = 0;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(header != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   memset(header, 0, sizeof(vdxGovHeader_t));
+   *bitErrorIndication = 0;
+
+   /* group_start_code (32 bits) */
+   bits = bibGetBits(32, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+
+   if ( bibError )
+       goto exitAfterBitError;
+   if( bits != MP4_GROUP_START_CODE )
+   {
+      deb0p("ERROR. Bitstream does not start with MP4_GROUP_START_CODE\n");
+      goto exitAfterBitError;
+   }
+
+   /* time_code_hours (5 bits) */
+   tmpvar = (int) bibGetBits(5, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+
+   if ( bibError )
+       goto exitAfterBitError;
+
+   time_s= tmpvar*3600;
+ 
+   /* time_code_minutes (6 bits) */
+   tmpvar = (int) bibGetBits(6, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+
+   if ( bibError )
+       goto exitAfterBitError;
+
+   time_s += tmpvar*60;
+
+   /* marker_bit (1 bit) */
+   tmpvar = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+   if ( !tmpvar )
+      goto exitAfterBitError;
+
+   /* time_code_seconds (6 bits) */
+   tmpvar = (int) bibGetBits(6, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+    
+   time_s += tmpvar;
+
+   /* closed_gov (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+
+   header->closed_gov= (u_char) bits;
+
+   /* broken_link (1 bit) */
+   bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+   
+   header->broken_link = (u_char) bits;   
+
+   if ( (header->closed_gov == 0)&&(header->broken_link == 1) )
+   {
+      deb0p("ERROR. GOVHeader: closed_gov = 0\tbroken_link = 1\n");
+      goto exitAfterBitError;
+   }
+
+   /* Stuff the bits before the next start code */
+   sncCode = sncCheckMpegSync(inBuffer, 1, &bibError);
+   if ((sncCode == SNC_NO_SYNC) || bibError)
+   {
+      deb0p("ERROR. No VOP Start code after GOV header\n");
+      /* also bibError will be handled in exitAfterBitError */
+      goto exitAfterBitError;
+   }
+
+    /* If User data is available */
+   if (sncCode == SNC_USERDATA)
+   {
+      if (!header->user_data) {
+         header->user_data = (char *) malloc(MAX_USER_DATA_LENGTH);
+         header->user_data_length = 0;
+      }
+       
+      if (vdxGetUserData(inBuffer, header->user_data, &(header->user_data_length), bitErrorIndication) != VDX_OK)
+          /* also bibError will be handled in exitAfterBitError */
+          goto exitAfterBitError;       
+   }
+
+   header->time_stamp = time_s;
+
+   /* If no error in bit buffer functions */
+   if (!bibError)
+      return VDX_OK;
+
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else other error in bit buffer functions */
+   else
+      return VDX_ERR_BIB;
+
+   exitAfterBitError:
+      if (bibError && bibError != ERR_BIB_NOT_ENOUGH_DATA)
+         return VDX_ERR_BIB;
+
+   return VDX_OK_BUT_BIT_ERROR;
+
+} 
+
+/* {{-output"vdxGetVopHeader.txt"}} */
+/*
+ *
+ * vdxGetVopHeader
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    inParam                    input parameters
+ *    header                     output parameters: picture header
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the VOP header from inBuffer.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *    VDX_ERR_NO_START_CODE      if start code is not found
+ *    VDX_ERR_NOT_SUPPORTED      if broken_link and closed_gov conflict
+ *
+ *    
+ */
+
+int vdxGetVopHeader(
+   bibBuffer_t *inBuffer,
+   const vdxGetVopHeaderInputParam_t *inpParam,
+   vdxVopHeader_t *header,
+   int * ModuloByteIndex,
+   int * ModuloBitIndex,
+   int * ByteIndex,
+   int * BitIndex,
+   int *bitErrorIndication)
+/* {{-output"vdxGetVopHeader.txt"}} */
+{
+
+   int tmpvar;
+   u_int32 bits;
+   int bitsGot;
+   int time_base_incr = 0,
+      num_bits;
+   int16
+      bibError = 0;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(header != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   memset(header, 0, sizeof(vdxVopHeader_t));
+   *bitErrorIndication = 0;
+
+   /* vop_start_code (32 bits) */
+   bits = bibGetBits(MP4_VOP_START_CODE_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+      goto exitFunction;
+ 
+   if( bits != MP4_VOP_START_CODE  )
+   {
+      deb0p("ERROR. Bitstream does not start with MP4_VOP_START_CODE\n");
+      goto exitAfterBitError;
+   }
+
+   *bitErrorIndication = 0;   
+
+   /* vop_prediction_type (2 bits) */
+   bits = bibGetBits(2, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+
+   if ( (bits != VDX_VOP_TYPE_P && bits != VDX_VOP_TYPE_I) )
+   {
+      deb("ERROR. Not supported VOP prediction type\n");
+      goto exitAfterBitError;
+   }
+  
+   header->coding_type = (u_char) bits;
+
+   /* MVE */
+   *ModuloByteIndex = inBuffer->numBytesRead;
+   *ModuloBitIndex = inBuffer->bitIndex;
+
+   /* modulo_time_base (? bits) */
+   tmpvar = (int) bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+
+   while( tmpvar == 1 && !bibError )
+   {
+      tmpvar = (int) bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      time_base_incr++;
+   }
+   if ( bibError )
+       goto exitAfterBitError;
+
+   header->time_base_incr = time_base_incr;
+
+   /* marker_bit (1 bit) */
+   tmpvar = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+   if ( !tmpvar )
+      goto exitAfterBitError;
+
+   /* MVE */
+   *ByteIndex = inBuffer->numBytesRead;
+   *BitIndex = inBuffer->bitIndex;
+
+   /* vop_time_increment (1-16 bits) */
+   for (num_bits = 1; ((inpParam->time_increment_resolution-1) >> num_bits) != 0; num_bits++)
+    {
+    }
+ 
+   tmpvar = (int) bibGetBits(num_bits, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+
+   header->time_inc = tmpvar;
+
+   /* marker_bit (1 bit) */
+   tmpvar = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+   if ( !tmpvar )
+      goto exitAfterBitError;
+
+   /* vop_coded (1 bit) */
+   header->vop_coded = (u_char) bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+
+   if ( !header->vop_coded ) {
+      goto exitAfterBitError;
+   }
+   
+   /* vop_rounding_type (1 bit) */
+   if (header->coding_type == VDX_VOP_TYPE_P)
+   {
+      bits = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if ( bibError )
+          goto exitAfterBitError;
+      header->rounding_type = (int) bits;
+   } else
+      header->rounding_type = 0;
+
+   /* intra_dc_vlc_thr (3 bits) */
+   bits = bibGetBits(3, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+
+   header->intra_dc_vlc_thr = (int) bits;
+
+   /* vop_quant (5 bits) */
+   bits = bibGetBits(5, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+
+   header->quant = (int) bits;
+
+   /* vop_fcode_forward (3 bits) */
+   if (header->coding_type == VDX_VOP_TYPE_P)
+   {
+      bits = bibGetBits(3, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if ( bibError )
+          goto exitAfterBitError;
+      header->fcode_forward = (int) bits;
+   } else {
+      /* In case of an Intra Frame to calculate the length of the 
+         VP resynchronization marker later on fcode_forward should be 
+         assumed to have the value 1. */
+      header->fcode_forward = 1;
+   }
+
+   exitFunction:
+
+   /* If no error in bit buffer functions */
+   if (!bibError)
+      return VDX_OK;
+
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else other error in bit buffer functions */
+   else
+      return VDX_ERR_BIB;
+
+   exitAfterBitError:
+   
+   if (bibError && bibError != ERR_BIB_NOT_ENOUGH_DATA)
+      return VDX_ERR_BIB;
+
+   return VDX_OK_BUT_BIT_ERROR;
+
+}
+
+/*
+ * vdxGetUserData
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    user_data                  string of user data read byte-by-byte from
+ *                               the stream
+ *    user_data_length           number of bytes of user data
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads a string of bytes as user data from the bitsream
+ *    It is called from te VOL header or GOV header
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+int vdxGetUserData(bibBuffer_t *inBuffer,
+   char *user_data, int *user_data_length,
+   int *bitErrorIndication)
+{
+   int i;
+   u_int32 bits;
+   int bitsGot;
+   int16 ownError=0;
+
+   /* user_data_start_code (32 bits) */
+   bits = bibGetBits(32, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+   if ( ownError )
+      goto exitFunction;
+ 
+   if (bits != MP4_USER_DATA_START_CODE)
+   {
+      deb0p("ERROR. Bitstream does not start with MP4_USER_DATA_START_CODE\n");
+      goto exitFunction;
+   }
+
+   /* read until start_code 0x000001 */
+   for ( i=(*user_data_length);
+         (((bits = bibShowBits(24, inBuffer, &bitsGot, bitErrorIndication, &ownError)) != 0x000001)&&(ownError==0));
+         i++ )
+   {
+      bits = bibGetBits(8, inBuffer, &bitsGot, bitErrorIndication, &ownError);
+      if (ownError)
+         goto exitFunction;
+
+      if (i<MAX_USER_DATA_LENGTH) 
+      {
+          user_data[i] = (u_char) bits;
+      }
+      else
+      {
+          break;
+      }
+   }
+   
+
+   *user_data_length = (i>=MAX_USER_DATA_LENGTH) ? MAX_USER_DATA_LENGTH : i++;
+
+   exitFunction:
+
+   /* If no error in bit buffer functions */
+   if (!ownError)
+      return VDX_OK;
+
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (ownError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else other error in bit buffer functions */
+   else
+      return VDX_ERR_BIB;
+
+}
+
+/*
+ * Video Packet Layer Global Functions
+ */
+
+/* {{-output"vdxGetVideoPacketHeader.txt"}} */
+/*
+ *
+ * vdxGetVideoPacketHeader
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    header                     output parameters: picture header
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads the Video Packet header from inBuffer.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *    VDX_ERR_NO_START_CODE      if start code is not found
+ *    VDX_ERR_NOT_SUPPORTED      if broken_link and closed_gov conflict
+ *
+ *      
+ */
+
+int vdxGetVideoPacketHeader(
+   bibBuffer_t *inBuffer,
+   const vdxGetVideoPacketHeaderInputParam_t *inpParam,
+   vdxVideoPacketHeader_t *header,
+   int *bitErrorIndication)
+/* {{-output"vdxGetVideoPacketHeader.txt"}} */
+{
+   int tmpvar, num_bits, bitsGot;
+   u_int32 bits;
+   int MBNumLength,
+      time_base_incr = 0;
+   int16
+      bibError = 0;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(header != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   memset(header, 0, sizeof(vdxVideoPacketHeader_t));
+   *bitErrorIndication = 0;
+
+   /* resync marker */
+   tmpvar = bibGetBits(16 + inpParam->fcode_forward, inBuffer, &bitsGot,
+                   bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+   if ( (int) tmpvar != MP4_RESYNC_MARKER )
+   {
+      deb("ERROR. No Resync Marker found\n");
+      goto exitAfterBitError;
+   }
+
+   /* Macroblock Number */
+   for (MBNumLength = 1; ((inpParam->numOfMBs-1) >> MBNumLength) != 0; MBNumLength++)
+    {
+    }
+
+   header->currMBNum = (int) bibGetBits(MBNumLength, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+
+   /* quant_scale (5 bits) */
+   bits = bibGetBits(5, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+
+   header->quant = (int) bits;
+
+   /* header_extension_code (1 bit) */
+   header->fHEC = (u_char) bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+   if ( bibError )
+       goto exitAfterBitError;
+
+   if(header->fHEC) {
+      /* modulo_time_base (? bits) */
+      tmpvar = (int) bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if ( bibError )
+          goto exitAfterBitError;
+      
+      while (tmpvar == 1 && !bibError)
+      {
+         tmpvar = (int) bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         time_base_incr++;
+      }
+      if ( bibError )
+          goto exitAfterBitError;
+
+      header->time_base_incr = time_base_incr;
+
+      /* marker_bit (1 bit) */
+      tmpvar = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if ( bibError )
+          goto exitAfterBitError;
+      if ( !tmpvar )
+         goto exitAfterBitError;
+
+      /* vop_time_increment (1-15 bits) */
+      for (num_bits = 1; ((inpParam->time_increment_resolution-1) >> num_bits) != 0; num_bits++)
+        {
+        }
+      
+      tmpvar = (int) bibGetBits(num_bits, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if ( bibError )
+          goto exitAfterBitError;
+
+      header->time_inc = tmpvar;
+      
+      /* marker_bit (1 bit) */
+      tmpvar = bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if ( bibError )
+          goto exitAfterBitError;
+      if (!tmpvar)
+         goto exitAfterBitError;
+
+      /* vop_prediction_type (2 bits) */
+      bits = bibGetBits(2, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if ( bibError )
+          goto exitAfterBitError;
+
+      if ((bits != VDX_VOP_TYPE_P && bits != VDX_VOP_TYPE_I))
+      {
+         deb("ERROR. Not supported VOP prediction type\n");
+         goto exitAfterBitError;
+      }
+      
+      header->coding_type = (u_char) bits;
+
+      /* intra_dc_vlc_thr (3 bits) */
+      bits = bibGetBits(3, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+      if ( bibError )
+          goto exitAfterBitError;
+
+      header->intra_dc_vlc_thr = (int) bits;
+
+      /* vop_fcode_forward (3 bits) */
+      if (header->coding_type == VDX_VOP_TYPE_P)
+      {
+         bits = bibGetBits(3, inBuffer, &bitsGot, bitErrorIndication, &bibError);
+         if ( bibError )
+             goto exitAfterBitError;
+         header->fcode_forward = (int) bits;
+      } else
+         header->fcode_forward = 1;
+   }
+
+   /* Check success and return */
+
+   /* If no error in bit buffer functions */
+   if (!bibError)
+      return VDX_OK;
+
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else other error in bit buffer functions */
+   else
+      return VDX_ERR_BIB;
+
+   exitAfterBitError:
+      if (bibError && bibError != ERR_BIB_NOT_ENOUGH_DATA)
+         return VDX_ERR_BIB;
+
+      return VDX_OK_BUT_BIT_ERROR;
+}
+
+/*
+ * Macroblock Layer Global Functions
+ */
+
+/*
+ *
+ * vdxGetDataPartitionedIMBLayer_Part1
+ *
+ * Parameters:
+ *    inBuffer     input buffer
+ *    inpParam     input parameters
+ *    MBList       a double-linked list for soring 
+ *                 MB parameters + DC values in the VP
+ *    bitErrorIndication
+ *                 non-zero if a bit error has been detected
+ *                 within the bits accessed in this function,
+ *                 see biterr.h for possible values
+ *
+ * Function:
+ *    This function gets the first (DC) partition of a data
+ *    partitioned encoded Video Packet in an Intra-VOP. 
+ *    The parameters MCBPC, DQUANT and DC values of all the MBs
+ *    in the VP are read and stored in the linked list.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ * Error codes:
+ *    error codes returned by bibFlushBits/bibGetBits/bibShowBits
+ *
+ *
+ */
+
+int vdxGetDataPartitionedIMBLayer_Part1(
+   bibBuffer_t *inBuffer, bibBuffer_t *outBuffer, bibBufferEdit_t *bufEdit,
+     int aColorEffect, int *aStartByteIndex, int *aStartBitIndex, 
+     CMPEG4Transcoder *hTranscoder, 
+   const vdxGetDataPartitionedIMBLayerInputParam_t *inpParam,
+   dlst_t *MBList,
+   int *bitErrorIndication)
+{
+
+    int mcbpcIndex,
+        retValue = VDX_OK,
+        fDQUANT,
+        new_quant, previous_quant,
+        bitsGot,
+        i, 
+        IntraDC_size, 
+        IntraDC_delta;
+    
+    /* MVE */
+   int StartByteIndex;
+   int StartBitIndex;
+     
+   int16 error=0;
+   vdxIMBListItem_t *MBinstance = NULL;
+     
+     
+   vdxAssert(inpParam != NULL);
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+     
+   previous_quant = inpParam->quant;
+
+   /* MVE */
+   int stuffingStartByteIndex, stuffingStartBitIndex, stuffingEndByteIndex, stuffingEndBitIndex;
+   stuffingStartByteIndex = stuffingEndByteIndex = inBuffer->getIndex;
+   stuffingStartBitIndex  = stuffingEndBitIndex = inBuffer->bitIndex;
+
+   while (bibShowBits(MP4_DC_MARKER_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &error) != MP4_DC_MARKER && !error)
+   {
+         /* MVE */
+         StartByteIndex = inBuffer->getIndex; 
+         StartBitIndex = inBuffer->bitIndex;
+         
+         retValue = vdxGetMCBPCIntra(inBuffer, &mcbpcIndex, bitErrorIndication);
+         if (retValue != VDX_OK)
+             goto exitFunction;
+         
+     if (mcbpcIndex == 8)
+         {
+             /* MVE */
+             stuffingEndByteIndex = inBuffer->getIndex;
+             stuffingEndBitIndex = inBuffer->bitIndex;
+             
+             continue; /* skip stuffing */
+         }
+         
+         /* Create new MBInstance for the next MB */
+         MBinstance = (vdxIMBListItem_t *) malloc(sizeof(vdxIMBListItem_t));
+         if (!MBinstance)
+         {
+             deb("ERROR - MBinstance creation failed\n");
+             retValue = H263D_ERROR;
+             goto exitFunction;
+         }
+         memset(MBinstance, 0, sizeof(vdxIMBListItem_t));
+         
+         /* CBPC (2 LSBs of MCBPC) */
+         MBinstance->cbpc = mcbpcIndex & 3;
+         
+         /* MVE */
+         MBinstance->mcbpc = mcbpcIndex;
+         VDT_SET_START_POSITION(MBinstance,11,stuffingStartByteIndex,stuffingStartBitIndex); // 11: MB stuffing bits
+         VDT_SET_END_POSITION(MBinstance,11,stuffingEndByteIndex,stuffingEndBitIndex); // 11: MB stuffing bits
+         
+         VDT_SET_START_POSITION(MBinstance,0,StartByteIndex,StartBitIndex); // 0: mcbpc
+         VDT_SET_END_POSITION(MBinstance,0,inBuffer->getIndex,inBuffer->bitIndex); // 0: mcbpc
+         VDT_SET_START_POSITION(MBinstance,1,inBuffer->getIndex,inBuffer->bitIndex); // 1: dquant
+         
+         /* DQUANT is given for MCBPC indexes 4..7 */
+         fDQUANT = mcbpcIndex & 4;
+         
+         if (fDQUANT) {
+             retValue = vdxUpdateQuant(inBuffer, 0, previous_quant,
+                 &new_quant, bitErrorIndication);
+             if (retValue != VDX_OK)
+                 goto exitFunction;
+         }
+         /* Else no DQUANT */
+         else
+             new_quant = previous_quant;
+         
+         MBinstance->dquant       = fDQUANT ?  new_quant - previous_quant : 0;
+         MBinstance->quant = previous_quant = new_quant;
+         
+         /* MVE */
+         VDT_SET_END_POSITION(MBinstance,1,inBuffer->getIndex,inBuffer->bitIndex); // 1: dquant
+     VDT_SET_START_POSITION(MBinstance,4,inBuffer->getIndex,inBuffer->bitIndex); // 4: intraDC
+     VDT_SET_START_POSITION(MBinstance,5,inBuffer->getIndex,inBuffer->bitIndex); // 5: intraDC
+     VDT_SET_START_POSITION(MBinstance,6,inBuffer->getIndex,inBuffer->bitIndex); // 6: intraDC
+     VDT_SET_START_POSITION(MBinstance,7,inBuffer->getIndex,inBuffer->bitIndex); // 7: intraDC
+     VDT_SET_START_POSITION(MBinstance,8,inBuffer->getIndex,inBuffer->bitIndex); // 8: intraDC
+     VDT_SET_START_POSITION(MBinstance,9,inBuffer->getIndex,inBuffer->bitIndex); // 9: intraDC
+         
+     VDT_SET_END_POSITION(MBinstance,4,inBuffer->getIndex,inBuffer->bitIndex); // 4: intraDC
+     VDT_SET_END_POSITION(MBinstance,5,inBuffer->getIndex,inBuffer->bitIndex); // 5: intraDC
+     VDT_SET_END_POSITION(MBinstance,6,inBuffer->getIndex,inBuffer->bitIndex); // 6: intraDC
+     VDT_SET_END_POSITION(MBinstance,7,inBuffer->getIndex,inBuffer->bitIndex); // 7: intraDC
+     VDT_SET_END_POSITION(MBinstance,8,inBuffer->getIndex,inBuffer->bitIndex); // 8: intraDC
+     VDT_SET_END_POSITION(MBinstance,9,inBuffer->getIndex,inBuffer->bitIndex); // 9: intraDC
+
+         /* Color Toning */
+     hTranscoder->AfterMBLayer(new_quant);
+ 
+         
+         MBinstance->switched = aicIntraDCSwitch(inpParam->intra_dc_vlc_thr,new_quant);
+         
+         /* Intra_DC_Coeffs */
+         if(!MBinstance->switched) {
+             for (i=0; i<6; i++) {
+                 
+                 /* MVE */
+                 VDT_SET_START_POSITION(MBinstance,i+4,inBuffer->getIndex,inBuffer->bitIndex); // 6: intraDC,chrominance
+                 
+                 retValue = vdxGetIntraDC(inBuffer, outBuffer, bufEdit, aColorEffect, aStartByteIndex, aStartBitIndex, 
+                     i, &IntraDC_size, &IntraDC_delta, bitErrorIndication);
+                 
+                 /* MVE */
+                 VDT_SET_END_POSITION(MBinstance,i+4,inBuffer->getIndex,inBuffer->bitIndex); // 6: intraDC,chrominance
+                 
+                 if (retValue != VDX_OK)
+                     goto exitFunction;
+                 
+                 MBinstance->DC[i] = IntraDC_delta;
+             } 
+         } 
+         
+         
+         /* Put MBinstance into the queue */
+         dlstAddAfterCurr(MBList, MBinstance);
+         MBinstance = NULL;
+         
+     /* MVE */
+         // begin another MB, record the position of MB stuffing
+         stuffingStartByteIndex = stuffingEndByteIndex = inBuffer->getIndex;
+         stuffingStartBitIndex  = stuffingEndBitIndex = inBuffer->bitIndex;
+         
+   }
+     
+exitFunction:
+     
+   if (MBinstance)
+      free(MBinstance);
+
+
+   /* If no error in bit buffer functions */
+   if (!error)
+      return retValue;
+
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (error == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else other error in bit buffer functions */
+   else
+      return VDX_ERR_BIB;
+}
+
+/*
+ *
+ * vdxGetDataPartitionedIMBLayer_Part2
+ *
+ * Parameters:
+ *    inBuffer     input buffer
+ *    MBList       a double-linked list for soring 
+ *                 MB parameters + DC values in the VP
+ *    numMBsInVP   number of MBs in this VP
+ *    bitErrorIndication
+ *                 non-zero if a bit error has been detected
+ *                 within the bits accessed in this function,
+ *                 see biterr.h for possible values
+ *
+ * Function:
+ *    This function gets the second (CBPY) partition of a data
+ *    partitioned encoded Video Packet in an Intra-VOP. 
+ *    The parameters CBPY and ac_pred_flag of all the MBs
+ *    in the VP are read and stored in the linked list.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ * Error codes:
+ *      error codes returned by bibFlushBits/bibGetBits/bibShowBits
+ *
+ *      
+ *
+ */
+
+int vdxGetDataPartitionedIMBLayer_Part2(
+   bibBuffer_t *inBuffer, bibBuffer_t */*outBuffer*/, bibBufferEdit_t */*bufEdit*/, 
+   int /*aColorEffect*/, int */*aStartByteIndex*/, int */*aStartBitIndex*/, 
+   dlst_t *MBList,
+   int numMBsInVP,
+   int *bitErrorIndication)
+{
+
+   int cbpyIndex,
+      i,
+      retValue = VDX_OK,
+      bitsGot;
+
+   int16 error=0;
+   u_char code;
+   vdxIMBListItem_t *MBinstance;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   /* get the first MB of the list */
+   dlstHead(MBList, (void **) &MBinstance);
+
+   /* Get ac_pred_flag and cbpy of all MBs in VP */
+   for (i = 0; i < numMBsInVP; i++)
+   {    
+         if (!MBinstance)
+         {
+             retValue = H263D_ERROR;
+             goto exitFunction;
+         }
+
+         /* MVE */
+         VDT_SET_START_POSITION(MBinstance,3,inBuffer->getIndex,inBuffer->bitIndex); // 3: ac_pred_flag
+         
+         /* ac_pred_flag (1 bit) */
+         code = (u_char) bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &error);
+         if (error) 
+             goto exitFunction;
+         
+         /* MVE */
+         VDT_SET_END_POSITION(MBinstance,3,inBuffer->getIndex,inBuffer->bitIndex); // 3: ac_pred_flag
+         VDT_SET_START_POSITION(MBinstance,2,inBuffer->getIndex,inBuffer->bitIndex); //  2: cbpy
+         
+         /* CBPY */
+         retValue = vdxGetCBPY(inBuffer, &cbpyIndex, bitErrorIndication);
+         if (retValue != VDX_OK)
+             goto exitFunction;
+         
+         /* MVE */
+         VDT_SET_END_POSITION(MBinstance,2,inBuffer->getIndex,inBuffer->bitIndex); // 2: cbpy
+         
+                                                                                                                                                             /* add the information to the MB data item.
+                                                                                                                                                             If the Part1 of the VP was decoded without errors (all MBs were
+         attached to the list), MBinstance should always have a valid value. */ 
+         if (MBinstance != NULL) {
+             MBinstance->ac_pred_flag = code;
+             MBinstance->cbpy = cbpyIndex;
+             
+             dlstNext(MBList, (void **) &MBinstance);
+         }
+   }
+     
+exitFunction:
+     
+     
+   /* If no error in bit buffer functions */
+   if (!error)
+      return retValue;
+
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (error == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else other error in bit buffer functions */
+   else
+      return VDX_ERR_BIB;
+}
+
+/*
+ *
+ * vdxGetDataPartitionedPMBLayer_Part1
+ *
+ * Parameters:
+ *    inBuffer     input buffer
+ *    inpParam     input parameters
+ *    MBList       a double-linked list for soring 
+ *                 MB parameters + DC values in the VP
+ *    bitErrorIndication
+ *                 non-zero if a bit error has been detected
+ *                 within the bits accessed in this function,
+ *                 see biterr.h for possible values
+ *
+ * Function:
+ *    This function gets the first (Motion) partition of a data
+ *    partitioned encoded Video Packet in an Inter-VOP. 
+ *    The parameters COD, MCBPC and motion vectors of all the MBs
+ *    in the VP are read and stored in the linked list.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ * Error codes:
+ *      error codes returned by bibFlushBits/bibGetBits/bibShowBits
+ *
+ *      
+ *
+ */
+
+ int vdxGetDataPartitionedPMBLayer_Part1(
+   bibBuffer_t *inBuffer,
+   bibBuffer_t */*outBuffer*/, bibBufferEdit_t */*bufEdit*/, 
+   int /*aColorEffect*/, int */*aStartByteIndex*/, int */*aStartBitIndex*/, 
+   const vdxGetDataPartitionedPMBLayerInputParam_t *inpParam,
+   dlst_t *MBList,
+   int *bitErrorIndication)
+ {
+     
+   static const int mbTypeToMBClass[6] = 
+     {VDX_MB_INTER, VDX_MB_INTER, VDX_MB_INTER, 
+     VDX_MB_INTRA, VDX_MB_INTRA, VDX_MB_INTER};
+     
+   int mvdx, mvdy,
+         numMVs,
+         mcbpcIndex,
+         retValue = VDX_OK,
+         bitsGot;
+     
+   int16 error=0;
+   u_char code;
+   vdxPMBListItem_t *MBinstance = NULL;
+     
+     /* MVE */
+   int StartByteIndex = 0;
+   int StartBitIndex = 0;
+   int stuffingStartByteIndex, stuffingStartBitIndex, stuffingEndByteIndex, stuffingEndBitIndex;
+   
+   stuffingStartByteIndex = stuffingEndByteIndex = inBuffer->getIndex;
+   stuffingStartBitIndex  = stuffingEndBitIndex = inBuffer->bitIndex;
+     
+   vdxAssert(inpParam != NULL);
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+     
+   while (bibShowBits(MP4_MOTION_MARKER_COMB_LENGTH, inBuffer, &bitsGot, bitErrorIndication, &error) 
+         != MP4_MOTION_MARKER_COMB && !error)
+   {
+         /* COD */
+         code = (u_char) bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &error);
+         if (error) 
+             goto exitFunction;
+         
+         if (code == 0)
+         {
+             
+             /* MVE */
+             StartByteIndex = inBuffer->getIndex; 
+             StartBitIndex = inBuffer->bitIndex;
+             
+             /* MCBPC */
+             retValue = vdxGetMCBPCInter(
+                 inBuffer, 
+                 0, /* No PLUSPTYPE present in MPEG-4 */
+                 1, /* Four motion vectors always possible in MPEG-4 */
+            0, /* Flag to indicate if this is the first MB of a picture.
+                             Since this value is used only for checking if
+                             indices 21 - 24 are allowed in H.263, we don't have
+                             to set this correctly. (Indices 21 - 24 are not allowed
+                             in MPEG-4 at all.) */
+                             &mcbpcIndex, 
+                             bitErrorIndication);
+             
+             if (retValue != VDX_OK)
+                 goto exitFunction;
+             
+             if (mcbpcIndex == 20)
+             {
+                 /* MVE */
+                 stuffingEndByteIndex = inBuffer->getIndex;
+                 stuffingEndBitIndex = inBuffer->bitIndex;
+                 
+                 continue;  /* skip stuffing */
+             }
+             
+             /* Indices > 20 not allowed */
+             if (mcbpcIndex > 20) {
+                 deb0p("vdxGetDataPartitionedPMBLayer_Part1: ERROR - Illegal code.\n");
+                 retValue = VDX_OK_BUT_BIT_ERROR;              
+                 goto exitFunction;
+             }
+             
+             
+         }
+         
+         /* Create new MBInstance for the MB */
+         MBinstance = (vdxPMBListItem_t *) malloc(sizeof(vdxPMBListItem_t));
+         if (!MBinstance)
+         {
+             deb("ERROR - MBinstance creation failed\n");
+             goto exitFunction;
+         }
+         memset(MBinstance, 0, sizeof(vdxPMBListItem_t));
+         
+         MBinstance->fCodedMB = (u_char) (code ^ 1);      
+         
+         if (MBinstance->fCodedMB) 
+         {                   
+             /* MCBPC */
+             MBinstance->cbpc = mcbpcIndex;
+             
+             /* MCBPC --> MB type & included data elements */
+             MBinstance->mbType = mcbpcIndex / 4;
+             MBinstance->mbClass = mbTypeToMBClass[MBinstance->mbType];
+             
+             /* MVE */
+             MBinstance->mcbpc = mcbpcIndex;
+             VDT_SET_START_POSITION(MBinstance,11,stuffingStartByteIndex,stuffingStartBitIndex); // 11: MB stuffing bits
+             VDT_SET_END_POSITION(MBinstance,11,stuffingEndByteIndex,stuffingEndBitIndex); // 11: MB stuffing bits
+             VDT_SET_START_POSITION(MBinstance,0,StartByteIndex,StartBitIndex);  // MCBPC
+             VDT_SET_END_POSITION(MBinstance,0,inBuffer->getIndex,inBuffer->bitIndex);
+             
+             VDT_SET_START_POSITION(MBinstance,10,inBuffer->getIndex,inBuffer->bitIndex); // MVs
+             
+             /* MVD is included always for PB-frames and always if MB type is INTER */
+             numMVs = MBinstance->numMVs = 
+                 (MBinstance->mbClass == VDX_MB_INTER) ?
+                 ((MBinstance->mbType == 2 || MBinstance->mbType == 5) ? 4 : 1) : 0;
+             
+             if (numMVs) {
+                 int i;
+                 for (i = 0; i < numMVs; i++) {
+                     retValue = vdxGetScaledMVD(inBuffer,inpParam->f_code,&mvdx,bitErrorIndication);
+                     if (retValue != VDX_OK)
+                         goto exitFunction;
+                     retValue = vdxGetScaledMVD(inBuffer,inpParam->f_code,&mvdy,bitErrorIndication);
+                     if (retValue != VDX_OK)
+                         goto exitFunction;
+                     
+                     MBinstance->mvx[i] = mvdx;
+                     MBinstance->mvy[i] = mvdy;
+                 }
+             }
+             
+             /* MVE */
+             VDT_SET_END_POSITION(MBinstance,10,inBuffer->getIndex,inBuffer->bitIndex); // MVs
+             
+         }
+         
+       /* MVE */
+         // begin another MB, record the position of MB stuffing
+         stuffingStartByteIndex = stuffingEndByteIndex = inBuffer->getIndex;
+         stuffingStartBitIndex  = stuffingEndBitIndex = inBuffer->bitIndex;
+         
+         /* Put MBinstance into the queue */
+         dlstAddAfterCurr(MBList, MBinstance);
+         MBinstance = NULL;
+   }
+     
+exitFunction:
+     
+   if (MBinstance)
+         free(MBinstance);
+   
+     
+   /* If no error in bit buffer functions */
+   if (!error)
+         return retValue;
+     
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (error == ERR_BIB_NOT_ENOUGH_DATA) {
+         return VDX_OK_BUT_BIT_ERROR;
+   }
+     
+   /* Else other error in bit buffer functions */
+   else
+         return VDX_ERR_BIB;
+     
+}
+
+
+/*
+ *
+ * vdxGetDataPartitionedPMBLayer_Part2
+ *
+ * Parameters:
+ *    inBuffer     input buffer
+ *    inpParam     input parameters
+ *    MBList       a double-linked list for soring 
+ *                 MB parameters + DC values in the VP
+ *    bitErrorIndication
+ *                 non-zero if a bit error has been detected
+ *                 within the bits accessed in this function,
+ *                 see biterr.h for possible values
+ *
+ * Function:
+ *    This function gets the second (CBPY) partition of a data
+ *    partitioned encoded Video Packet in an Inter-VOP. 
+ *    The parameters CBPY, DQUANT and if Intra MB its DC coeffs
+ *    of all the MBs in the VP are read and stored in the linked list.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ * Error codes:
+ *      error codes returned by bibFlushBits/bibGetBits/bibShowBits
+ *
+ *      
+ *
+ */
+
+ int vdxGetDataPartitionedPMBLayer_Part2(
+   bibBuffer_t *inBuffer,
+   bibBuffer_t *outBuffer, 
+   bibBufferEdit_t *bufEdit,
+   int aColorEffect, int *aStartByteIndex, int *aStartBitIndex, 
+   CMPEG4Transcoder *hTranscoder, 
+   const vdxGetDataPartitionedPMBLayerInputParam_t *inpParam,
+   dlst_t *MBList,
+   int *bitErrorIndication)
+ {
+     
+   static const int mbTypeToDQUANTI[6] =
+     {0, 1, 0, 0, 1, 1};
+     
+   int fDQUANT,
+         cbpyIndex,
+         retValue = VDX_OK,
+         new_quant, previous_quant,
+         bitsGot,
+         i, 
+         IntraDC_size, 
+         IntraDC_delta;
+     
+   int16 error=0;
+   u_char code;
+   vdxPMBListItem_t *MBinstance;
+     
+   vdxAssert(inpParam != NULL);
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+     
+   previous_quant = inpParam->quant;
+     
+   /* Get ac_pred_flag and cbpy of all MBs in VP */
+   for (dlstHead(MBList, (void **) &MBinstance); 
+     MBinstance != NULL; 
+     dlstNext(MBList, (void **) &MBinstance))
+   {
+         
+         if (!MBinstance->fCodedMB) continue;
+         
+         /* MVE */
+         VDT_SET_START_POSITION(MBinstance,3,inBuffer->getIndex,inBuffer->bitIndex); // 3 ac_pred_flag
+         
+         if (MBinstance->mbClass == VDX_MB_INTRA) {
+             
+             /* ac_pred_flag (1 bit) */
+             code = (u_char) bibGetBits(1, inBuffer, &bitsGot, bitErrorIndication, &error);
+             if (error) 
+                 goto exitFunction;
+             
+             MBinstance->ac_pred_flag = code;
+         }
+         
+         /* MVE */
+         VDT_SET_END_POSITION(MBinstance,3,inBuffer->getIndex,inBuffer->bitIndex); // 3 ac_pred_flag
+         VDT_SET_START_POSITION(MBinstance,2,inBuffer->getIndex,inBuffer->bitIndex); // 2: cbpy
+         
+         /* CBPY */
+         retValue = vdxGetCBPY(inBuffer, &cbpyIndex, bitErrorIndication);
+         if (retValue != VDX_OK)
+             goto exitFunction;
+         
+         if (MBinstance->mbClass == VDX_MB_INTER)
+             /* Convert index to INTER CBPY */
+             cbpyIndex = 15 - cbpyIndex;
+         
+         MBinstance->cbpy = cbpyIndex;
+         
+         /* MVE */
+         VDT_SET_END_POSITION(MBinstance,2,inBuffer->getIndex,inBuffer->bitIndex); // 
+         VDT_SET_START_POSITION(MBinstance,1,inBuffer->getIndex,inBuffer->bitIndex); // 1: dquant
+         
+         /* DQUANT is given for MCBPC indexes 4..7 */
+         fDQUANT = mbTypeToDQUANTI[MBinstance->mbType];
+         
+         if (fDQUANT) {
+             retValue = vdxUpdateQuant(inBuffer, 0, previous_quant,
+                 &new_quant, bitErrorIndication);
+             if (retValue != VDX_OK)
+                 goto exitFunction;
+         }
+         /* Else no DQUANT */
+         else
+             new_quant = previous_quant;
+         
+         MBinstance->dquant       = fDQUANT ?  new_quant - previous_quant : 0;
+         MBinstance->quant = previous_quant = new_quant;
+         
+         /* MVE */
+         VDT_SET_END_POSITION(MBinstance,1,inBuffer->getIndex,inBuffer->bitIndex); // 1: dquant
+         VDT_SET_START_POSITION(MBinstance,4,inBuffer->getIndex,inBuffer->bitIndex); // 4: intraDC
+         VDT_SET_START_POSITION(MBinstance,5,inBuffer->getIndex,inBuffer->bitIndex); // 5: intraDC
+         VDT_SET_START_POSITION(MBinstance,6,inBuffer->getIndex,inBuffer->bitIndex); // 6: intraDC
+         VDT_SET_START_POSITION(MBinstance,7,inBuffer->getIndex,inBuffer->bitIndex); // 7: intraDC
+         VDT_SET_START_POSITION(MBinstance,8,inBuffer->getIndex,inBuffer->bitIndex); // 8: intraDC
+         VDT_SET_START_POSITION(MBinstance,9,inBuffer->getIndex,inBuffer->bitIndex); // 9: intraDC
+         
+         VDT_SET_END_POSITION(MBinstance,4,inBuffer->getIndex,inBuffer->bitIndex); // 4: intraDC
+         VDT_SET_END_POSITION(MBinstance,5,inBuffer->getIndex,inBuffer->bitIndex); // 5: intraDC
+         VDT_SET_END_POSITION(MBinstance,6,inBuffer->getIndex,inBuffer->bitIndex); // 6: intraDC
+         VDT_SET_END_POSITION(MBinstance,7,inBuffer->getIndex,inBuffer->bitIndex); // 7: intraDC
+         VDT_SET_END_POSITION(MBinstance,8,inBuffer->getIndex,inBuffer->bitIndex); // 8: intraDC
+         VDT_SET_END_POSITION(MBinstance,9,inBuffer->getIndex,inBuffer->bitIndex); // 9: intraDC
+         
+     /* Color Toning */
+     hTranscoder->AfterMBLayer(new_quant);
+     
+         if (MBinstance->mbClass == VDX_MB_INTRA) {
+             MBinstance->switched = aicIntraDCSwitch(inpParam->intra_dc_vlc_thr,new_quant);
+             
+             /* Intra_DC_Coeffs */
+             if(!MBinstance->switched) {
+                 for (i=0; i<6; i++) {
+                     
+                     /* MVE */
+                     VDT_SET_START_POSITION(MBinstance,i+4,inBuffer->getIndex,inBuffer->bitIndex); // 6: intraDC,chrominance
+                     
+                     retValue = vdxGetIntraDC(inBuffer, outBuffer, bufEdit, aColorEffect, aStartByteIndex, aStartBitIndex, 
+                         i, &IntraDC_size, &IntraDC_delta, bitErrorIndication);
+                     
+                     /* MVE */
+                     VDT_SET_END_POSITION(MBinstance,i+4,inBuffer->getIndex,inBuffer->bitIndex); // 6: intraDC,chrominance
+                     
+                     if (retValue != VDX_OK)
+                         goto exitFunction;
+                     MBinstance->DC[i] = IntraDC_delta;
+                 } 
+             }
+         }
+   }
+     
+exitFunction:
+   
+     
+   /* If no error in bit buffer functions */
+   if (!error)
+         return retValue;
+     
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (error == ERR_BIB_NOT_ENOUGH_DATA) {
+         return VDX_OK_BUT_BIT_ERROR;
+   }
+     
+   /* Else other error in bit buffer functions */
+   else
+         return VDX_ERR_BIB;
+     
+}
+
+/*
+ * Block Layer Global Functions
+ */
+
+/* {{-output"vdxGetMPEGIntraDCTBlock.txt"}} */
+/*
+ * vdxGetMPEGIntraDCTBlock
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    startIndex                 the first index in block where to put data
+ *    block                      DCT coefficients of the block 
+ *                               in zigzag order 
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function gets the DCT coefficients for one INTRA block.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ *    
+ */
+
+int vdxGetMPEGIntraDCTBlock(
+   bibBuffer_t *inBuffer, 
+   int startIndex,
+   int *block,
+   int *bitErrorIndication)
+/* {{-output"vdxGetMPEGIntraDCTBlock.txt"}} */
+{
+   int
+      numBitsGot,
+      retValue = VDX_OK,
+      tmpvar;
+   int16
+      bibError = 0;
+
+   static const vdxVLCTable_t Intra_tcoefTab0[] = {
+    {0x10401, 7}, {0x10301, 7}, {0x00601, 7}, {0x10501, 7},
+    {0x00701, 7}, {0x00202, 7}, {0x00103, 7}, {0x00009, 7},
+    {0x10002, 6}, {0x10002, 6}, {0x00501, 6}, {0x00501, 6}, 
+    {0x10201, 6}, {0x10201, 6}, {0x10101, 6}, {0x10101, 6},
+    {0x00401, 6}, {0x00401, 6}, {0x00301, 6}, {0x00301, 6},
+    {0x00008, 6}, {0x00008, 6}, {0x00007, 6}, {0x00007, 6}, 
+    {0x00102, 6}, {0x00102, 6}, {0x00006, 6}, {0x00006, 6},
+    {0x00201, 5}, {0x00201, 5}, {0x00201, 5}, {0x00201, 5},
+    {0x00005, 5}, {0x00005, 5}, {0x00005, 5}, {0x00005, 5}, 
+    {0x00004, 5}, {0x00004, 5}, {0x00004, 5}, {0x00004, 5}, 
+    {0x10001, 4}, {0x10001, 4}, {0x10001, 4}, {0x10001, 4},
+    {0x10001, 4}, {0x10001, 4}, {0x10001, 4}, {0x10001, 4},
+    {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
+    {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
+    {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, 
+    {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
+    {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
+    {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, 
+    {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
+    {0x00001, 2}, {0x00001, 2}, {0x00001, 2}, {0x00001, 2},
+    {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, 
+    {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3},
+    {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3},
+    {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, {0x00002, 3}, 
+    {0x00101, 4}, {0x00101, 4}, {0x00101, 4}, {0x00101, 4},
+    {0x00101, 4}, {0x00101, 4}, {0x00101, 4}, {0x00101, 4},
+    {0x00003, 4}, {0x00003, 4}, {0x00003, 4}, {0x00003, 4},
+    {0x00003, 4}, {0x00003, 4}, {0x00003, 4}, {0x00003, 4},
+   };
+
+
+   static const vdxVLCTable_t Intra_tcoefTab1[] = {
+    {0x00012,10}, {0x00011,10}, {0x10e01, 9}, {0x10e01, 9},
+    {0x10d01, 9}, {0x10d01, 9}, {0x10c01, 9}, {0x10c01, 9},
+    {0x10b01, 9}, {0x10b01, 9}, {0x10a01, 9}, {0x10a01, 9}, 
+    {0x10102, 9}, {0x10102, 9}, {0x10004, 9}, {0x10004, 9},
+    {0x00c01, 9}, {0x00c01, 9}, {0x00b01, 9}, {0x00b01, 9},
+    {0x00702, 9}, {0x00702, 9}, {0x00602, 9}, {0x00602, 9}, 
+    {0x00502, 9}, {0x00502, 9}, {0x00303, 9}, {0x00303, 9},
+    {0x00203, 9}, {0x00203, 9}, {0x00106, 9}, {0x00106, 9},
+    {0x00105, 9}, {0x00105, 9}, {0x00010, 9}, {0x00010, 9}, 
+    {0x00402, 9}, {0x00402, 9}, {0x0000f, 9}, {0x0000f, 9},
+    {0x0000e, 9}, {0x0000e, 9}, {0x0000d, 9}, {0x0000d, 9},
+    {0x10801, 8}, {0x10801, 8}, {0x10801, 8}, {0x10801, 8}, 
+    {0x10701, 8}, {0x10701, 8}, {0x10701, 8}, {0x10701, 8},
+    {0x10601, 8}, {0x10601, 8}, {0x10601, 8}, {0x10601, 8},
+    {0x10003, 8}, {0x10003, 8}, {0x10003, 8}, {0x10003, 8},  
+    {0x00a01, 8}, {0x00a01, 8}, {0x00a01, 8}, {0x00a01, 8},
+    {0x00901, 8}, {0x00901, 8}, {0x00901, 8}, {0x00901, 8},
+    {0x00801, 8}, {0x00801, 8}, {0x00801, 8}, {0x00801, 8},  
+    {0x10901, 8}, {0x10901, 8}, {0x10901, 8}, {0x10901, 8},
+    {0x00302, 8}, {0x00302, 8}, {0x00302, 8}, {0x00302, 8},
+    {0x00104, 8}, {0x00104, 8}, {0x00104, 8}, {0x00104, 8},  
+    {0x0000c, 8}, {0x0000c, 8}, {0x0000c, 8}, {0x0000c, 8},
+    {0x0000b, 8}, {0x0000b, 8}, {0x0000b, 8}, {0x0000b, 8},
+    {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}, {0x0000a, 8}, 
+   };
+
+   static const vdxVLCTable_t Intra_tcoefTab2[] = {
+    {0x10007,11}, {0x10007,11}, {0x10006,11}, {0x10006,11},
+    {0x00016,11}, {0x00016,11}, {0x00015,11}, {0x00015,11},
+    {0x10202,10}, {0x10202,10}, {0x10202,10}, {0x10202,10},  
+    {0x10103,10}, {0x10103,10}, {0x10103,10}, {0x10103,10},
+    {0x10005,10}, {0x10005,10}, {0x10005,10}, {0x10005,10},
+    {0x00d01,10}, {0x00d01,10}, {0x00d01,10}, {0x00d01,10},  
+    {0x00503,10}, {0x00503,10}, {0x00503,10}, {0x00503,10},
+    {0x00802,10}, {0x00802,10}, {0x00802,10}, {0x00802,10},
+    {0x00403,10}, {0x00403,10}, {0x00403,10}, {0x00403,10},  
+    {0x00304,10}, {0x00304,10}, {0x00304,10}, {0x00304,10},
+    {0x00204,10}, {0x00204,10}, {0x00204,10}, {0x00204,10},
+    {0x00107,10}, {0x00107,10}, {0x00107,10}, {0x00107,10}, 
+    {0x00014,10}, {0x00014,10}, {0x00014,10}, {0x00014,10},
+    {0x00013,10}, {0x00013,10}, {0x00013,10}, {0x00013,10},
+    {0x00017,11}, {0x00017,11}, {0x00018,11}, {0x00018,11}, 
+    {0x00108,11}, {0x00108,11}, {0x00902,11}, {0x00902,11},
+    {0x10302,11}, {0x10302,11}, {0x10402,11}, {0x10402,11},
+    {0x10f01,11}, {0x10f01,11}, {0x11001,11}, {0x11001,11}, 
+    {0x00019,12}, {0x0001a,12}, {0x0001b,12}, {0x00109,12},
+    {0x00603,12}, {0x0010a,12}, {0x00205,12}, {0x00703,12},
+    {0x00e01,12}, {0x10008,12}, {0x10502,12}, {0x10602,12}, 
+    {0x11101,12}, {0x11201,12}, {0x11301,12}, {0x11401,12},
+    {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
+    {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
+    {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
+    {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
+    {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
+    {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
+    {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
+    {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7}, {0x01bff, 7},
+   };
+
+   static const int intra_max_level[2][64] = {
+                                     {27, 10,  5,  4,  3,  3,  3,  3,
+                                       2,  2,  1,  1,  1,  1,  1,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                     },
+ 
+                                      {8,  3,  2,  2,  2,  2,  2,  1,
+                                       1,  1,  1,  1,  1,  1,  1,  1,
+                                       1,  1,  1,  1,  1,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0,
+                                       0,  0,  0,  0,  0,  0,  0,  0
+                                    }
+                                   };
+
+   static const int intra_max_run0[28] = { 999, 14,  9,  7,  3,  2,  1,
+                                    1,  1,  1,  1,  0,  0,  0,
+                                    0,  0,  0,  0,  0,  0,  0,
+                                    0,  0,  0,  0,  0,  0,  0
+                                };
+ 
+   static const int intra_max_run1[9] = { 999, 20,  6,
+                                   1,  0,  0,
+                                   0,  0,  0
+                               };
+
+   int
+      code,       /* bits got from bit buffer */
+      index,      /* index to zigzag table running from 1 to 63 */
+      run,        /* RUN code */
+      level;      /* LEVEL code */
+
+   u_int32
+     last,       /* LAST code (see standard) */
+      sign;       /* sign for level */
+
+   vdxVLCTable_t const *tab; /* pointer to lookup table */
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(startIndex == 0 || startIndex == 1);
+   vdxAssert(block != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   index = startIndex;
+
+   do {
+      code = (int) bibShowBits(12, inBuffer, &numBitsGot, bitErrorIndication,
+         &bibError);
+      if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+         deb("vdxGetDCTBlock: bibShowBits returned not enough data --> "
+            "try to use the data available.\n");
+         code <<= 12 - numBitsGot;
+         bibError = 0;
+      }
+      else if (bibError ) {
+         goto exitFunction;
+      }
+
+      /* Select the right table and index for the codeword */
+      if (code >= 512)
+         tab = &Intra_tcoefTab0[(code >> 5) - 16];
+      else if (code >= 128)
+         tab = &Intra_tcoefTab1[(code >> 2) - 32];
+      else if (code >= 8)
+         tab = &Intra_tcoefTab2[code - 8];
+      else {
+         deb("ERROR - illegal TCOEF\n");
+         retValue = VDX_OK_BUT_BIT_ERROR;
+         goto exitFunction;
+      }
+
+      /* Flush the codeword from the buffer */
+      bibFlushBits(tab->len, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+      if (bibError)
+        goto exitFunction;
+    
+      /* the following is modified for 3-mode escape */
+      if (tab->val == 7167)     /* ESCAPE */
+      {
+      
+         int run_offset=0,
+         level_offset=0;
+
+         code = (int) bibShowBits(2, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         if (bibError) {
+            goto exitFunction;
+         }
+
+         if (code<=2) {
+
+            /* escape modes: level or run is offset */
+            if (code==2) run_offset=1;
+            else level_offset=1;
+
+            /* Flush the escape code from the buffer */
+            if (run_offset)
+               bibFlushBits(2, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+            else
+               bibFlushBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+
+            if (bibError)
+               goto exitFunction;
+            /* Read next codeword */
+            code = (int) bibShowBits(12, inBuffer, &numBitsGot, bitErrorIndication,
+                     &bibError);
+            if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+               deb("vdxGetDCTBlock: bibShowBits returned not enough data --> "
+                  "try to use the data available.\n");
+               code <<= 12 - numBitsGot;
+               bibError = 0;
+            }
+            else if (bibError) {
+               goto exitFunction;
+            }
+
+            /* Select the right table and index for the codeword */
+            if (code >= 512)
+               tab = &Intra_tcoefTab0[(code >> 5) - 16];
+            else if (code >= 128)
+               tab = &Intra_tcoefTab1[(code >> 2) - 32];
+            else if (code >= 8)
+               tab = &Intra_tcoefTab2[code - 8];
+            else {
+               deb("ERROR - illegal TCOEF\n");
+               retValue = VDX_OK_BUT_BIT_ERROR;
+               goto exitFunction;
+            }
+
+            bibFlushBits(tab->len, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+            if (bibError)
+               goto exitFunction;
+
+            run = (tab->val >> 8) & 255;
+            level = tab->val & 255;
+            last = (tab->val >> 16) & 1;
+
+            /* need to add back the max level */
+            if (level_offset)
+               level = level + intra_max_level[last][run];
+            else if (last)
+               run = run + intra_max_run1[level]+1;
+            else
+               run = run + intra_max_run0[level]+1;
+
+            sign = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication,
+                     &bibError);
+
+            if ( bibError )
+               goto exitFunction;
+        
+            if (sign)
+               level = -level;
+
+         } else {
+       
+            /* Flush the codeword from the buffer */
+            bibFlushBits(2, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+            if (bibError)
+               goto exitFunction;
+
+            /* LAST */
+            last = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+                     &bibError);
+            if ( bibError )
+               goto exitFunction;
+            /* RUN */
+            run = (int) bibGetBits(6, inBuffer, &numBitsGot, bitErrorIndication, 
+                     &bibError);
+            if ( bibError )
+               goto exitFunction;
+            /* MARKER BIT */
+            tmpvar = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication,&bibError);
+            if ( bibError )
+               goto exitFunction;
+            if (!tmpvar) {
+
+               retValue = VDX_OK_BUT_BIT_ERROR;
+               goto exitFunction;
+            }
+            /* LEVEL */
+            level = (int) bibGetBits(12, inBuffer, &numBitsGot, bitErrorIndication, 
+                        &bibError);
+            if ( bibError )
+               goto exitFunction;
+            /* MARKER BIT */
+            tmpvar = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication,&bibError);
+            if ( bibError )
+               goto exitFunction;
+            if(!tmpvar) {
+
+               retValue = VDX_OK_BUT_BIT_ERROR;
+               goto exitFunction;
+            }
+
+            /* 0000 0000 0000 and 1000 0000 0000 is forbidden unless in MQ mode */
+            if (level == 0 || level == 2048) {
+               deb("ERROR - illegal level.\n");
+               retValue = VDX_OK_BUT_BIT_ERROR;
+               goto exitFunction;
+            }
+
+            /* Codes 1000 0000 0001 .. 1111 1111 1111 */
+            if (level > 2048)
+               level -= 4096;
+      
+         } /* flc */
+      }
+      else {
+   
+         run = (tab->val >> 8) & 255;
+         level = tab->val & 255;
+         last = (tab->val >> 16) & 1;
+
+         sign = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         if ( bibError )
+            goto exitFunction;
+
+         if (sign)
+            level = -level;
+      }
+
+      /* If too many coefficients */
+      if (index + run > 63) {
+         deb("ERROR - too many TCOEFs.\n");
+         retValue = VDX_OK_BUT_BIT_ERROR;
+         goto exitFunction;
+      }
+
+      /* Do run-length decoding */
+         while (run--)
+            block[index++] = 0;
+
+         block[index++] = level;
+
+   } while (!last);
+
+   exitFunction:
+
+   /* Set the rest of the coefficients to zero */
+   while (index <= 63) {
+      block[index++] = 0;
+   }
+
+   if (!bibError)
+      return retValue;
+
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   else
+      return VDX_ERR_BIB;
+}
+
+/*
+ * Macroblock Layer Local Functions
+ */
+
+/*
+ *
+ * vdxGetScaledMVD
+ *    
+ *
+ * Parameters:
+ *    inBuffer     input buffer
+ *    f_code       f_code for current Vop
+ *    error        error code
+ *    *mvd10       returned MV value (10x)
+ *    *bitErrorIndication
+ *
+ * Function:
+ *      Calculates a component of a block (or MB) vector by decoding 
+ *      the magnitude & residual of the diff. vector, making the prediction, 
+ *      and combining the decoded diff. and the predicted values
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ */
+
+
+int vdxGetScaledMVD(bibBuffer_t *inBuffer, int f_code,
+            int *mvd10, int *bitErrorIndication)
+{
+
+   int   residual=0, vlc_code_mag=0; 
+   int   diff_vector,
+         retValue = VDX_OK,
+         numBitsGot;
+   int16 bibError = 0;
+
+   /* decode component */
+   retValue = vdxGetMVD(inBuffer,&vlc_code_mag,bitErrorIndication);
+   if (retValue < 0)
+      goto exitFunction;
+
+   if ((f_code > 1) && (vlc_code_mag != 0))
+   {
+      vlc_code_mag /= 5;
+
+      residual = (int) 
+         bibGetBits(f_code-1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+      if (bibError)
+         goto exitFunction;
+
+      diff_vector = ((abs(vlc_code_mag)-1)<<(f_code-1)) + residual + 1;
+      if (vlc_code_mag < 0)
+         diff_vector = -diff_vector;
+
+      *mvd10 = diff_vector * 5;
+   } else 
+      *mvd10 = vlc_code_mag;
+
+   exitFunction:
+   
+   if (bibError) {
+      if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+         return VDX_OK_BUT_BIT_ERROR;
+      }
+      return VDX_ERR_BIB;
+   }
+
+   return retValue;
+}
+
+/*
+ * vdxGetIntraDC
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    compnum                    number of the block component in the
+ *                       4:2:2 YUV scheme 
+ *                       (0..3) luma, (4..5) chroma
+ *    IntraDCDelta               the read Intra DC value (quantized)
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function gets the Intra DC value
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ *
+ */
+
+int vdxGetIntraDC(bibBuffer_t *inBuffer, bibBuffer_t */*outBuffer*/, bibBufferEdit_t */*bufEdit*/, int /*aColorEffect*/, 
+                                    int */*aStartByteIndex*/, int */*aStartBitIndex*/, int compnum, int *IntraDC_size, int *IntraDCDelta, 
+                                    int *bitErrorIndication)
+{
+   u_int32 code;
+   int16 bibError=0;
+   int first_bit,
+      numBitsGot,
+      retValue,
+      IntraDCSize=0,
+      tmpvar;
+  
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(IntraDCDelta != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   /* read DC size 2 - 8 bits */
+   retValue =  vdxGetIntraDCSize(inBuffer, compnum, &IntraDCSize, bitErrorIndication);
+   if (retValue != VDX_OK)
+      return retValue;
+  
+   *IntraDC_size = IntraDCSize;
+   if (IntraDCSize == 0) {
+
+      *IntraDCDelta = 0;
+
+   } else {
+
+      /* read delta DC 0 - 8 bits */
+      code = bibGetBits(IntraDCSize,inBuffer,&numBitsGot,bitErrorIndication, &bibError);
+
+      if (bibError) {
+         if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+            return VDX_OK_BUT_BIT_ERROR;
+         }
+         return VDX_ERR_BIB;
+      } 
+
+      first_bit = code >> (IntraDCSize-1);
+
+      if (first_bit == 0 )
+      { /* negative delta INTRA DC */
+         *IntraDCDelta = -1 * (int) (code ^ ((1 << IntraDCSize)-1));
+      }
+      else
+      { /* positive delta INTRA DC */
+         *IntraDCDelta = (int) code;
+      }
+
+      if (IntraDCSize > 8) {
+         /* Marker Bit */
+         tmpvar = bibGetBits(1,inBuffer,&numBitsGot,bitErrorIndication, &bibError);
+         if( !tmpvar ) {
+            return VDX_OK_BUT_BIT_ERROR;
+         }
+      }
+   }
+                        
+   return VDX_OK;
+}
+
+/*
+ * vdxGetIntraDCSize
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    compnum                    number of the block component in the
+ *                       4:2:2 YUV scheme 
+ *                       (0..3) luma, (4..5) chroma
+ *    IntraDCSize                Size of the following Intra DC FLC
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function gets the IntraDCSize VLC for luma or chroma
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *    
+ *
+ */
+
+static int vdxGetIntraDCSize(bibBuffer_t *inBuffer, int compnum, int *IntraDCSize, 
+   int *bitErrorIndication)
+{
+   u_int32  code;
+   int numBitsGot,
+      retValue = VDX_OK;
+   int16
+      bibError = 0;
+
+   if( compnum >=0 && compnum < 4 ) /* luminance block */
+   {
+      code = bibShowBits(11, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+      if (bibError && (bibError != ERR_BIB_NOT_ENOUGH_DATA)) {
+         return VDX_ERR_BIB;
+      }
+
+      if ((bibError == ERR_BIB_NOT_ENOUGH_DATA) && (numBitsGot != 0)) {
+         code <<= (11-numBitsGot);
+         bibError = 0;
+      }
+
+      if ( code == 1)
+      {
+         *IntraDCSize = 12;
+         bibFlushBits(11, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+      
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 11;
+         bibFlushBits(10, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 10;
+         bibFlushBits(9, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 9;
+         bibFlushBits(8, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 8;
+         bibFlushBits(7, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 7;
+         bibFlushBits(6, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 6;
+         bibFlushBits(5, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 5;
+         bibFlushBits(4, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 4;
+         bibFlushBits(3, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      } else if (code == 2) {
+         *IntraDCSize = 3;
+         bibFlushBits(3, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      } else if (code ==3) {
+         *IntraDCSize = 0;
+         bibFlushBits(3, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+      code >>= 1;
+      if ( code == 2)
+      {
+         *IntraDCSize = 2;
+         bibFlushBits(2, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      } else if (code == 3) {
+         *IntraDCSize = 1;
+         bibFlushBits(2, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }     
+
+   }
+   else /* chrominance block */
+   {
+      code = bibShowBits(12, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+      if (bibError && (bibError != ERR_BIB_NOT_ENOUGH_DATA)) {
+         return VDX_ERR_BIB;
+      }
+
+      if ((bibError == ERR_BIB_NOT_ENOUGH_DATA) && (numBitsGot != 0)) {
+         code <<= (12-numBitsGot);
+         bibError = 0;
+      }
+
+      if ( code == 1)
+      {
+         *IntraDCSize = 12;
+         bibFlushBits(12, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+      
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 11;
+         bibFlushBits(11, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 10;
+         bibFlushBits(10, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 9;
+         bibFlushBits(9, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 8;
+         bibFlushBits(8, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 7;
+         bibFlushBits(7, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 6;
+         bibFlushBits(6, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 5;
+         bibFlushBits(5, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      }
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 4;
+         bibFlushBits(4, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      } 
+      code >>= 1;
+      if ( code == 1)
+      {
+         *IntraDCSize = 3;
+         bibFlushBits(3, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      } 
+      code >>= 1;
+      {
+         *IntraDCSize = 3-code;
+         bibFlushBits(2, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         goto exitFunction;
+      } 
+   }
+
+exitFunction:
+
+   /* If no error in bit buffer functions */
+   if (!bibError)
+      return retValue;
+
+   /* Else if ran out of data (i.e. decoding out of sync) */
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   /* Else other error in bit buffer functions */
+   else
+      return VDX_ERR_BIB;
+}
+
+/*
+ * vdxGetRVLCIndex
+ *    
+ *
+ * Parameters:
+ *   bits                   input: the bits read from the stream
+ *   index                  output: the RVLC table index corresponding
+ *                       to "bits"
+ *   length              output: length of the codeword
+ *   intra_luma             indicates an intra "1" or inter "0" Block
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function finds the RVLC table index (LAST,RUN.LEVEL) and length
+ *   of the code belonging to the input codeword.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       no such codeword exists in the table
+ *
+ *
+ */
+
+int vdxGetRVLCIndex(
+   u_int32 bits,
+   u_int32 *index,
+   int *length,
+   int intra_luma,
+   int *bitErrorIndication)
+{
+
+   /* The indexes in the RVLC tables are written in equal RUN groups with
+      LEVEL increasing */
+   
+   /* Intra RVLC table */
+   static const vdxVLCTable_t RvlcTcoefTab0[] = {
+  /* [0] --> e.g.: RUN = 0; LEVEL = 1..27 */
+      {1,3},   {2,3},   {3,4},   {4,5},   {5,6},   {6,6},   {7,7},   {8,8},
+      {9,8},  {10,9},  {11,9}, {12,10}, {13,10}, {14,10}, {15,11}, {16,11},
+    {17,11}, {18,12}, {19,12}, {20,13}, {21,13}, {22,12}, {23,13}, {24,14},
+    {25,14}, {26,14}, {27,15},
+  /* [27] */
+    {257,4}, {258,5}, {259,7}, {260,8}, {261,8}, {262,9},{263,10},{264,11},
+   {265,11},{266,12},{267,13},{268,14},{269,14},
+  /* [40] */
+    {513,5}, {514,7}, {515,9},{516,10},{517,11},{518,11},{519,13},{520,13},
+   {521,13},{522,14},{523,14},
+  /* [51] */   
+    {769,5}, {770,8}, {771,9},{772,11},{773,12},{774,13},{775,14},{776,14},
+   {777,15},
+  /* [60] */   
+   {1025,6},{1026,8},{1027,10},{1028,12},{1029,12},{1030,14},
+  /* [66] */   
+   {1281,6},{1282,9},{1283,11},{1284,12},{1285,14},{1286,14},
+  /* [72] */     
+   {1537,7},{1538,10},{1539,11},{1540,12},{1541,15},
+  /* [77] */   
+   {1793,7},{1794,10},{1795,11},{1796,13},{1797,15},
+  /* [82] */
+   {2049,8},{2050,10},{2051,13},{2052,14},
+  /* [86] */   
+   {2305,8},{2306,11},{2307,13},{2308,15},
+  /* [90] */
+   {2561,9},{2562,12},
+  /* [92] */      
+   {2817,10},{2818,13},
+  /* [94] */      
+   {3073,10},{3074,15},
+  /* [96] */
+   {3329,11},
+   {3585,13},
+   {3841,13},
+   {4097,14},
+   {4353,14},  
+   {4609,14},
+   {4865,15},
+
+  /* [103] --> LAST = 1 */    
+   {65537,4},{65538,8},{65539,11},{65540,13},{65541,14},
+  /* [108] */     
+   {65793,5},{65794,9},{65795,12},{65796,14},{65797,15},
+  /* [113] */
+   {66049,5},{66050,11},{66051,15},
+  /* [116] */     
+   {66305,6},{66306,12},
+  /* [118] */
+   {66561,6},{66562,12},
+  /* [120] */
+   {66817,6},{66818,13},
+  /* [122] */
+   {67073,6},{67074,13},
+  /* [124] */
+   {67329,7},{67330,13},
+  /* [126] */
+   {67585,7},{67586,13},
+  /* [128] */
+   {67841,7},{67842,13},
+  /* [130] */
+   {68097,7},{68098,14},
+  /* [132] */
+   {68353,7},{68354,14},
+  /* [134] */
+   {68609,8},{68610,14},
+  /* [136] */
+   {68865,8},{68866,15},
+  /* [138] */
+   {69121,8},
+   {69377,9},
+   {69633,9},
+   {69889,9},
+   {70145,9},
+   {70401,9},
+   {70657,9},
+   {70913,10},
+   {71169,10},
+   {71425,10},
+   {71681,10},
+   {71937,10},
+   {72193,11},
+   {72449,11},
+   {72705,11},
+   {72961,12},
+   {73217,12},
+   {73473,12},
+   {73729,12},
+   {73985,12},
+   {74241,12},
+   {74497,12},
+   {74753,13},
+   {75009,13},
+   {75265,14},
+   {75521,14},
+   {75777,14},
+   {76033,15},
+   {76289,15},
+   {76545,15},
+   {76801,15},
+
+  /* [169] */
+     {7167,4}   /* last entry: escape code */
+  
+};
+
+   /* Inter RVLC table */
+   static const vdxVLCTable_t RvlcTcoefTab1[] = {
+  /* [0] */
+      {1,3},   {2,4},   {3,5},   {4,7},   {5,8},   {6,8},   {7,9},  {8,10},
+     {9,10}, {10,11}, {11,11}, {12,12}, {13,13}, {14,13}, {15,13}, {16,13},
+    {17,14}, {18,14}, {19,15},
+  /* [19] */
+    {257,3}, {258,6}, {259,8}, {260,9},{261,10},{262,11},{263,12},{264,13},
+   {265,14},{266,14},
+  /* [29] */
+    {513,4}, {514,7}, {515,9},{516,11},{517,12},{518,14},{519,14},
+  /* [36] */
+    {769,5}, {770,8},{771,10},{772,12},{773,13},{774,14},{775,15},
+  /* [43] */
+   {1025,5},{1026,8},{1027,11},{1028,13},{1029,15},
+  /* [48] */      
+   {1281,5},{1282,9},{1283,11},{1284,13},
+  /* [52] */      
+   {1537,6},{1538,10},{1539,12},{1540,14},
+  /* [56] */
+   {1793,6},{1794,10},{1795,12},{1796,15},
+  /* [60] */
+   {2049,6},{2050,10},{2051,13},
+  /* [63] */      
+   {2305,7},{2306,10},{2307,14},
+  /* [66] */
+   {2561,7},{2562,11},
+  /* [68] */
+    {2817,7},{2818,12},
+  /* [70] */
+    {3073,8},{3074,13},
+  /* [72] */
+   {3329,8},{3330,14},
+  /* [74] */
+    {3585,8},{3586,14},
+  /* [76] */
+    {3841,9},{3842,14},
+  /* [78] */
+    {4097,9},{4098,14},
+  /* [80] */
+   {4353,9},{4354,15},
+  /* [82] */
+   {4609,10},
+   {4865,10},
+   {5121,10},
+   {5377,11},
+   {5633,11},
+   {5889,11},
+   {6145,11},
+   {6401,11},
+   {6657,11},
+   {6913,12},
+   {7169,12},
+   {7425,12},
+   {7681,13},
+   {7937,13},
+   {8193,13},
+   {8449,13},
+   {8705,14},
+   {8961,14},
+   {9217,14},
+   {9473,15},
+   {9729,15},
+
+  /* [103] --> LAST = 1 */
+   {65537,4},{65538,8},{65539,11},{65540,13},{65541,14},
+  /* [108] */
+   {65793,5},{65794,9},{65795,12},{65796,14},{65797,15},
+  /* [113] */
+   {66049,5},{66050,11},{66051,15},
+  /* [116] */     
+   {66305,6},{66306,12},
+  /* [118] */
+   {66561,6},{66562,12},
+  /* [120] */
+   {66817,6},{66818,13},
+  /* [122] */
+   {67073,6},{67074,13},
+  /* [124] */
+   {67329,7},{67330,13},
+  /* [126] */
+   {67585,7},{67586,13},
+  /* [128] */
+   {67841,7},{67842,13},
+  /* [130] */
+   {68097,7},{68098,14},
+  /* [132] */
+   {68353,7},{68354,14},
+  /* [134] */
+   {68609,8},{68610,14},
+  /* [136] */
+   {68865,8},{68866,15},
+  /* [138] */
+   {69121,8},
+   {69377,9},
+   {69633,9},
+   {69889,9},
+   {70145,9},
+   {70401,9},
+   {70657,9},
+  {70913,10},
+  {71169,10},
+  {71425,10},
+  {71681,10},
+  {71937,10},
+  {72193,11},
+  {72449,11},
+  {72705,11},
+  {72961,12},
+  {73217,12},
+  {73473,12},
+  {73729,12},
+  {73985,12},
+  {74241,12},
+  {74497,12},
+  {74753,13},
+  {75009,13},
+  {75265,14},
+  {75521,14},
+  {75777,14},
+  {76033,15},
+  {76289,15},
+  {76545,15},
+  {76801,15},
+
+  /* [169] */
+   {7167,4}          /* last entry: escape code */
+};
+
+   vdxVLCTable_t const *tab; /* pointer to lookup table */
+
+   vdxAssert(bitErrorIndication != NULL);
+
+    switch(bits) {
+ 
+    case 0x0:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[169];
+      else
+        tab = &RvlcTcoefTab1[169];
+      break;
+      
+    case 0x1: 
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[27];
+      else
+        tab = &RvlcTcoefTab1[1];
+      break;
+    
+    case 0x4: 
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[40];
+      else
+        tab = &RvlcTcoefTab1[2];
+       break;
+    
+    case 0x5:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[51];
+      else
+        tab = &RvlcTcoefTab1[36];
+      break;
+      
+    case 0x6:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[0];
+      else
+        tab = &RvlcTcoefTab1[0];
+      break;
+      
+    case 0x7:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[1];
+      else
+        tab = &RvlcTcoefTab1[19];
+      break;
+      
+    case 0x8:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[28];
+      else
+        tab = &RvlcTcoefTab1[43];
+      break;
+      
+    case 0x9:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[3];
+      else
+        tab = &RvlcTcoefTab1[48];
+      break;
+      
+    case 0xa:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[2];
+      else
+        tab = &RvlcTcoefTab1[29];
+      break;
+      
+    case 0xb:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[103];
+      else
+        tab = &RvlcTcoefTab1[103];
+      break;
+      
+    case 0xc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[60];
+      else
+        tab = &RvlcTcoefTab1[20];
+      break;
+      
+    case 0xd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[66];
+      else
+        tab = &RvlcTcoefTab1[52];
+      break;
+      
+    case 0x12:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[108];
+      else
+        tab = &RvlcTcoefTab1[108];
+      break;
+      
+    case 0x13:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[113];
+      else
+        tab = &RvlcTcoefTab1[113];
+      break;
+      
+    case 0x14:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[4];
+      else
+        tab = &RvlcTcoefTab1[56];
+      break;
+      
+    case 0x15:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[5];
+      else
+        tab = &RvlcTcoefTab1[60];
+      break;
+      
+    case 0x18:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[116];
+      else
+        tab = &RvlcTcoefTab1[116];
+      break;
+      
+    case 0x19:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[118];
+      else
+        tab = &RvlcTcoefTab1[118];
+      break;
+      
+    case 0x1c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[72];
+      else
+        tab = &RvlcTcoefTab1[3];
+      break;
+      
+    case 0x1d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[77];
+      else
+        tab = &RvlcTcoefTab1[30];
+      break;
+      
+    case 0x22:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[120];
+      else
+        tab = &RvlcTcoefTab1[120];
+      break;
+      
+    case 0x23:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[122];
+      else
+        tab = &RvlcTcoefTab1[122];
+      break;
+      
+    case 0x2c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[41];
+      else
+        tab = &RvlcTcoefTab1[63];
+      break;
+      
+    case 0x2d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[29];
+      else
+        tab = &RvlcTcoefTab1[66];
+      break;
+      
+    case 0x34:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[6];
+      else
+        tab = &RvlcTcoefTab1[68];
+      break;
+      
+    case 0x35:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[124];
+      else
+        tab = &RvlcTcoefTab1[124];
+      break;
+      
+    case 0x38:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[126];
+      else
+        tab = &RvlcTcoefTab1[126];
+      break;
+      
+    case 0x39:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[128];
+      else
+        tab = &RvlcTcoefTab1[128];
+      break;
+      
+    case 0x3c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[82];
+      else
+        tab = &RvlcTcoefTab1[4];
+      break;
+      
+    case 0x3d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[86];
+      else
+        tab = &RvlcTcoefTab1[5];
+      break;
+      
+    case 0x42:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[130];
+      else
+        tab = &RvlcTcoefTab1[130];
+      break;
+      
+    case 0x43:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[132];
+      else
+        tab = &RvlcTcoefTab1[132];
+      break;
+      
+    case 0x5c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[52];
+      else
+        tab = &RvlcTcoefTab1[21];
+      break;
+      
+    case 0x5d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[61];
+      else
+        tab = &RvlcTcoefTab1[37];
+      break;
+      
+    case 0x6c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[30];
+      else
+        tab = &RvlcTcoefTab1[44];
+      break;
+      
+    case 0x6d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[31];
+      else
+        tab = &RvlcTcoefTab1[70];
+      break;
+      
+    case 0x74:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[7];
+      else
+        tab = &RvlcTcoefTab1[72];
+      break;
+      
+    case 0x75:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[8];
+      else
+        tab = &RvlcTcoefTab1[74];
+      break;
+      
+    case 0x78:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[104];
+      else
+        tab = &RvlcTcoefTab1[104];
+      break;
+      
+    case 0x79:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[134];
+      else
+        tab = &RvlcTcoefTab1[134];
+      break;
+      
+    case 0x7c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[90];
+      else
+        tab = &RvlcTcoefTab1[6];
+      break;
+      
+    case 0x7d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[67];
+      else
+        tab = &RvlcTcoefTab1[22];
+      break;
+      
+    case 0x82:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[136];
+      else
+        tab = &RvlcTcoefTab1[136];
+      break;
+      
+    case 0x83:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[138];
+      else
+        tab = &RvlcTcoefTab1[138];
+      break;
+      
+    case 0xbc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[42];
+      else
+        tab = &RvlcTcoefTab1[31];
+      break;
+      
+    case 0xbd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[53];
+      else
+        tab = &RvlcTcoefTab1[49];
+      break;
+      
+    case 0xdc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[32];
+      else
+        tab = &RvlcTcoefTab1[76];
+      break;
+      
+    case 0xdd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[9];
+      else
+        tab = &RvlcTcoefTab1[78];
+      break;
+      
+    case 0xec:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[10];
+      else
+        tab = &RvlcTcoefTab1[80];
+      break;
+      
+    case 0xed:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[109];
+      else
+        tab = &RvlcTcoefTab1[109];
+      break;
+      
+    case 0xf4:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[139];
+      else
+        tab = &RvlcTcoefTab1[139];
+      break;
+      
+    case 0xf5:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[140];
+      else
+        tab = &RvlcTcoefTab1[140];
+      break;
+      
+    case 0xf8:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[141];
+      else
+        tab = &RvlcTcoefTab1[141];
+      break;
+      
+    case 0xf9:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[142];
+      else
+        tab = &RvlcTcoefTab1[142];
+      break;
+      
+    case 0xfc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[92];
+      else
+        tab = &RvlcTcoefTab1[7];
+      break;
+      
+    case 0xfd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[94];
+      else
+        tab = &RvlcTcoefTab1[8];
+      break;
+      
+    case 0x102:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[143];
+      else
+        tab = &RvlcTcoefTab1[143];
+      break;
+      
+    case 0x103:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[144];
+      else
+        tab = &RvlcTcoefTab1[144];
+      break;
+      
+    case 0x17c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[73];
+      else
+        tab = &RvlcTcoefTab1[23];
+      break;
+      
+    case 0x17d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[78];
+      else
+        tab = &RvlcTcoefTab1[38];
+      break;
+      
+    case 0x1bc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[83];
+      else
+        tab = &RvlcTcoefTab1[53];
+      break;
+      
+    case 0x1bd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[62];
+      else
+        tab = &RvlcTcoefTab1[57];
+      break;
+      
+    case 0x1dc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[43];
+      else
+        tab = &RvlcTcoefTab1[61];
+      break;
+      
+    case 0x1dd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[33];
+      else
+        tab = &RvlcTcoefTab1[64];
+      break;
+      
+    case 0x1ec:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[11];
+      else
+        tab = &RvlcTcoefTab1[82];
+      break;
+      
+    case 0x1ed:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[12];
+      else
+        tab = &RvlcTcoefTab1[83];
+      break;
+      
+    case 0x1f4:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[13];
+      else
+        tab = &RvlcTcoefTab1[84];
+      break;
+      
+    case 0x1f5:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[145];
+      else
+        tab = &RvlcTcoefTab1[145];
+      break;
+      
+    case 0x1f8:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[146];
+      else
+        tab = &RvlcTcoefTab1[146];
+      break;
+      
+    case 0x1f9:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[147];
+      else
+        tab = &RvlcTcoefTab1[147];
+      break;
+      
+    case 0x1fc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[96];
+      else
+        tab = &RvlcTcoefTab1[9];
+      break;
+      
+    case 0x1fd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[87];
+      else
+        tab = &RvlcTcoefTab1[10];
+      break;
+      
+    case 0x202:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[148];
+      else
+        tab = &RvlcTcoefTab1[148];
+      break;
+      
+    case 0x203:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[149];
+      else
+        tab = &RvlcTcoefTab1[149];
+      break;
+      
+    case 0x2fc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[68];
+      else
+        tab = &RvlcTcoefTab1[24];
+      break;
+      
+    case 0x2fd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[74];
+      else
+        tab = &RvlcTcoefTab1[32];
+      break;
+      
+    case 0x37c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[79];
+      else
+        tab = &RvlcTcoefTab1[45];
+      break;
+      
+    case 0x37d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[54];
+      else
+        tab = &RvlcTcoefTab1[50];
+      break;
+      
+    case 0x3bc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[44];
+      else
+        tab = &RvlcTcoefTab1[67];
+      break;
+      
+    case 0x3bd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[45];
+      else
+        tab = &RvlcTcoefTab1[85];
+      break;
+      
+    case 0x3dc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[34];
+      else
+        tab = &RvlcTcoefTab1[86];
+      break;
+      
+    case 0x3dd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[35];
+      else
+        tab = &RvlcTcoefTab1[87];
+      break;
+      
+    case 0x3ec:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[14];
+      else
+        tab = &RvlcTcoefTab1[88];
+      break;
+      
+    case 0x3ed:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[15];
+      else
+        tab = &RvlcTcoefTab1[89];
+      break;
+      
+    case 0x3f4:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[16];
+      else
+        tab = &RvlcTcoefTab1[90];
+      break;
+      
+    case 0x3f5:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[105];
+      else
+        tab = &RvlcTcoefTab1[105];
+      break;
+      
+    case 0x3f8:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[114];
+      else
+        tab = &RvlcTcoefTab1[114];
+      break;
+      
+    case 0x3f9:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[150];
+      else
+        tab = &RvlcTcoefTab1[150];
+      break;
+      
+    case 0x3fc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[91];
+      else
+        tab = &RvlcTcoefTab1[11];
+      break;
+      
+    case 0x3fd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[63];
+      else
+        tab = &RvlcTcoefTab1[25];
+      break;
+      
+    case 0x402:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[151];
+      else
+        tab = &RvlcTcoefTab1[151];
+      break;
+      
+    case 0x403:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[152];
+      else
+        tab = &RvlcTcoefTab1[152];
+      break;
+      
+    case 0x5fc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[69];
+      else
+        tab = &RvlcTcoefTab1[33];
+      break;
+      
+    case 0x5fd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[75];
+      else
+        tab = &RvlcTcoefTab1[39];
+      break;
+      
+    case 0x6fc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[55];
+      else
+        tab = &RvlcTcoefTab1[54];
+      break;
+      
+    case 0x6fd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[64];
+      else
+        tab = &RvlcTcoefTab1[58];
+      break;
+      
+    case 0x77c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[36];
+      else
+        tab = &RvlcTcoefTab1[69];
+      break;
+      
+    case 0x77d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[17];
+      else
+        tab = &RvlcTcoefTab1[91];
+      break;
+      
+    case 0x7bc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[18];
+      else
+        tab = &RvlcTcoefTab1[92];
+      break;
+      
+    case 0x7bd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[21];
+      else
+        tab = &RvlcTcoefTab1[93];
+      break;
+      
+    case 0x7dc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[110];
+      else
+        tab = &RvlcTcoefTab1[110];
+      break;
+      
+    case 0x7dd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[117];
+      else
+        tab = &RvlcTcoefTab1[117];
+      break;
+      
+    case 0x7ec:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[119];
+      else
+        tab = &RvlcTcoefTab1[119];
+      break;
+      
+    case 0x7ed:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[153];
+      else
+        tab = &RvlcTcoefTab1[153];
+      break;
+      
+    case 0x7f4:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[154];
+      else
+        tab = &RvlcTcoefTab1[154];
+      break;
+      
+    case 0x7f5:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[155];
+      else
+        tab = &RvlcTcoefTab1[155];
+      break;
+      
+    case 0x7f8:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[156];
+      else
+        tab = &RvlcTcoefTab1[156];
+      break;
+      
+    case 0x7f9:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[157];
+      else
+        tab = &RvlcTcoefTab1[157];
+      break;
+      
+    case 0x7fc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[97];
+      else
+        tab = &RvlcTcoefTab1[12];
+      break;
+      
+    case 0x7fd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[98];
+      else
+        tab = &RvlcTcoefTab1[13];
+      break;
+      
+    case 0x802:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[158];
+      else
+        tab = &RvlcTcoefTab1[158];
+      break;
+      
+    case 0x803:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[159];
+      else
+        tab = &RvlcTcoefTab1[159];
+      break;
+      
+    case 0xbfc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[93];
+      else
+        tab = &RvlcTcoefTab1[14];
+      break;
+      
+    case 0xbfd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[84];
+      else
+        tab = &RvlcTcoefTab1[15];
+      break;
+      
+    case 0xdfc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[88];
+      else
+        tab = &RvlcTcoefTab1[26];
+      break;
+      
+    case 0xdfd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[80];
+      else
+        tab = &RvlcTcoefTab1[40];
+      break;
+      
+    case 0xefc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[56];
+      else
+        tab = &RvlcTcoefTab1[46];
+      break;
+      
+    case 0xefd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[46];
+      else
+        tab = &RvlcTcoefTab1[51];
+      break;
+      
+    case 0xf7c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[47];
+      else
+        tab = &RvlcTcoefTab1[62];
+      break;
+      
+    case 0xf7d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[48];
+      else
+        tab = &RvlcTcoefTab1[71];
+      break;
+      
+    case 0xfbc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[37];
+      else
+        tab = &RvlcTcoefTab1[94];
+      break;
+      
+    case 0xfbd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[19];
+      else
+        tab = &RvlcTcoefTab1[95];
+      break;
+      
+    case 0xfdc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[20];
+      else
+        tab = &RvlcTcoefTab1[96];
+      break;
+      
+    case 0xfdd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[22];
+      else
+        tab = &RvlcTcoefTab1[97];
+      break;
+      
+    case 0xfec:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[106];
+      else
+        tab = &RvlcTcoefTab1[106];
+      break;
+      
+    case 0xfed:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[121];
+      else
+        tab = &RvlcTcoefTab1[121];
+      break;
+      
+    case 0xff4:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[123];
+      else
+        tab = &RvlcTcoefTab1[123];
+      break;
+      
+    case 0xff5:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[125];
+      else
+        tab = &RvlcTcoefTab1[125];
+      break;
+      
+    case 0xff8:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[127];
+      else
+        tab = &RvlcTcoefTab1[127];
+      break;
+      
+    case 0xff9:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[129];
+      else
+        tab = &RvlcTcoefTab1[129];
+      break;
+      
+    case 0xffc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[99];
+      else
+        tab = &RvlcTcoefTab1[16];
+      break;
+      
+    case 0xffd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[100];
+      else
+        tab = &RvlcTcoefTab1[17];
+      break;
+      
+    case 0x1002:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[160];
+      else
+        tab = &RvlcTcoefTab1[160];
+      break;
+      
+    case 0x1003:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[161];
+      else
+        tab = &RvlcTcoefTab1[161];
+      break;
+      
+    case 0x17fc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[101];
+      else
+        tab = &RvlcTcoefTab1[27];
+      break;
+      
+    case 0x17fd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[85];
+      else
+        tab = &RvlcTcoefTab1[28];
+      break;
+      
+    case 0x1bfc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[70];
+      else
+        tab = &RvlcTcoefTab1[34];
+      break;
+      
+    case 0x1bfd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[65];
+      else
+        tab = &RvlcTcoefTab1[35];
+      break;
+      
+    case 0x1dfc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[71];
+      else
+        tab = &RvlcTcoefTab1[41];
+      break;
+      
+    case 0x1dfd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[57];
+      else
+        tab = &RvlcTcoefTab1[55];
+      break;
+      
+    case 0x1efc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[58];
+      else
+        tab = &RvlcTcoefTab1[65];
+      break;
+      
+    case 0x1efd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[49];
+      else
+        tab = &RvlcTcoefTab1[73];
+      break;
+      
+    case 0x1f7c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[50];
+      else
+        tab = &RvlcTcoefTab1[75];
+      break;
+      
+    case 0x1f7d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[38];
+      else
+        tab = &RvlcTcoefTab1[77];
+      break;
+      
+    case 0x1fbc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[39];
+      else
+        tab = &RvlcTcoefTab1[79];
+      break;
+      
+    case 0x1fbd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[23];
+      else
+        tab = &RvlcTcoefTab1[98];
+      break;
+      
+    case 0x1fdc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[24];
+      else
+        tab = &RvlcTcoefTab1[99];
+      break;
+      
+    case 0x1fdd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[25];
+      else
+        tab = &RvlcTcoefTab1[100];
+      break;
+      
+    case 0x1fec:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[107];
+      else
+        tab = &RvlcTcoefTab1[107];
+      break;
+      
+    case 0x1fed:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[111];
+      else
+        tab = &RvlcTcoefTab1[111];
+      break;
+      
+    case 0x1ff4:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[131];
+      else
+        tab = &RvlcTcoefTab1[131];
+      break;
+      
+    case 0x1ff5:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[133];
+      else
+        tab = &RvlcTcoefTab1[133];
+      break;
+      
+    case 0x1ff8:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[135];
+      else
+        tab = &RvlcTcoefTab1[135];
+      break;
+      
+    case 0x1ff9:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[162];
+      else
+        tab = &RvlcTcoefTab1[162];
+      break;
+      
+    case 0x1ffc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[26];
+      else
+        tab = &RvlcTcoefTab1[18];
+      break;
+      
+    case 0x1ffd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[59];
+      else
+        tab = &RvlcTcoefTab1[42];
+      break;
+      
+    case 0x2002:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[163];
+      else
+        tab = &RvlcTcoefTab1[163];
+      break;
+      
+    case 0x2003:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[164];
+      else
+        tab = &RvlcTcoefTab1[164];
+      break;
+      
+    case 0x2ffc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[76];
+      else
+        tab = &RvlcTcoefTab1[47];
+      break;
+      
+    case 0x2ffd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[81];
+      else
+        tab = &RvlcTcoefTab1[59];
+      break;
+      
+    case 0x37fc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[89];
+      else
+        tab = &RvlcTcoefTab1[81];
+      break;
+      
+    case 0x37fd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[95];
+      else
+        tab = &RvlcTcoefTab1[101];
+      break;
+      
+    case 0x3bfc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[102];
+      else
+        tab = &RvlcTcoefTab1[102];
+      break;
+      
+    case 0x3bfd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[112];
+      else
+        tab = &RvlcTcoefTab1[112];
+      break;
+      
+    case 0x3dfc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[115];
+      else
+        tab = &RvlcTcoefTab1[115];
+      break;
+      
+    case 0x3dfd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[137];
+      else
+        tab = &RvlcTcoefTab1[137];
+      break;
+      
+    case 0x3efc:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[165];
+      else
+        tab = &RvlcTcoefTab1[165];
+      break;
+      
+    case 0x3efd:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[166];
+      else
+        tab = &RvlcTcoefTab1[166];
+      break;
+      
+    case 0x3f7c:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[167];
+      else
+        tab = &RvlcTcoefTab1[167];
+      break;
+      
+    case 0x3f7d:
+      if (intra_luma)
+        tab = &RvlcTcoefTab0[168];
+      else
+        tab = &RvlcTcoefTab1[168];
+      break;
+
+    default:
+      deb("ERROR - illegal RVLC TCOEF\n");
+      return VDX_OK_BUT_BIT_ERROR;
+    }
+
+   *index = tab->val;
+   *length = tab->len;
+   
+   return VDX_OK;
+}
+
+/*
+ * vdxGetRVLCDCTBlock
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    startIndex                 the first index in block where to put data
+ *    block                      array for block (length 64)
+ *   fIntraBlock            indicates an intra "1" or inter "0" Block
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *    This function reads a block from bit buffer using Huffman codes listed
+ *    in RVLC TCOEF table. The place, where the block is read is given as a
+ *    pointer parameter.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *   
+ *
+ */
+
+int vdxGetRVLCDCTBlock(
+   bibBuffer_t *inBuffer, 
+   int startIndex,
+   int fIntraBlock,
+   int *block,
+   int *bitErrorIndication)
+{
+    int numBitsGot,
+      retValue = VDX_OK,
+      index = startIndex,  /* index to zigzag table running from 1 to 63 */
+      tmpvar;
+   u_int32
+      bits,
+      RVLCIndex = 0,
+      RVLCLength = 0;
+   int16
+      bibError = 0;
+
+   int run,    /* RUN code */
+      level;      /* LEVEL code */
+   u_int32 
+      last,       /* LAST code (see standard) */
+      sign;       /* sign for level */
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(startIndex == 0 || startIndex == 1);
+   vdxAssert(block != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   do {
+
+      /* Read next codeword */
+      bits = (int) bibShowBits(15, inBuffer, &numBitsGot, bitErrorIndication,
+         &bibError);
+      if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+         deb("vdxGetRVLCDCTBlock: bibShowBits returned not enough data --> "
+            "try to use the data available.\n");
+         bits <<= (15 - numBitsGot);
+         bibError = 0;
+      }
+      else if (bibError ) {
+         deb("vdxGetRVLCDCTBlock: ERROR - bibShowBits failed.\n");
+         goto exitFunction;
+      }
+
+      /* Identifying the codeword in the read bits */
+      {
+         int count, len = 1;
+         u_int32 mask = 0x4000; /* mask  100000000000000   */
+         
+         if (bits & mask) {
+            count = 1;
+            for (len = 1; count > 0 && len < 15; len++) {
+               mask = mask >> 1;
+               if (bits & mask) 
+                  count--;
+            }
+         } else {
+            count = 2;
+            for (len = 1; count > 0 && len < 15; len++) {
+               mask = mask >> 1;
+               if (!(bits & mask))
+                  count--;
+            }
+         }
+
+         if (len >= 15) {
+            deb("vdxGetRVLCDCTBlock:ERROR - illegal RVLC codeword.\n");
+            retValue = VDX_OK_BUT_BIT_ERROR;
+            goto exitFunction;
+         }
+
+         bits = bits & 0x7fff;
+         bits = bits >> (15 - (len + 1));
+      }
+
+      /* Get the RVLC table Index and length belonging to the codeword */
+      if (vdxGetRVLCIndex(bits, &RVLCIndex, (int *) &RVLCLength, fIntraBlock, bitErrorIndication) != VDX_OK)
+         goto exitFunction;
+
+      /* Flush the codeword from the buffer */
+      bibFlushBits(RVLCLength, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+      if (bibError)
+         goto exitFunction;
+
+      if (RVLCIndex == 7167)     /* ESCAPE */
+      {  
+         /* Flush the rest of the ESCAPE code from the buffer */
+         bibFlushBits(1, inBuffer, &numBitsGot, bitErrorIndication, &bibError);
+         if (bibError)
+            goto exitFunction;
+
+         /* LAST */
+         last = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+            &bibError);
+         if (bibError)
+            goto exitFunction;
+         /* RUN */
+         run = (int) bibGetBits(6, inBuffer, &numBitsGot, bitErrorIndication, 
+            &bibError);
+         if (bibError)
+            goto exitFunction;
+         /* MARKER BIT */
+         tmpvar = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication,&bibError);
+         if (bibError)
+            goto exitFunction;
+         if (!tmpvar) {
+            deb("vdxGetRVLCDCTBlock:ERROR - Wrong marker bit.\n");
+            retValue = VDX_OK_BUT_BIT_ERROR;
+            goto exitFunction;
+         }
+         /* LEVEL */
+         level = (int) bibGetBits(11, inBuffer, &numBitsGot, bitErrorIndication, 
+            &bibError);
+         if (bibError)
+            goto exitFunction;
+         if (level == 0) {
+            deb("vdxGetRVLCDCTBlock:ERROR - Escape level invalid.\n");
+            retValue = VDX_OK_BUT_BIT_ERROR;
+            goto exitFunction;
+         }
+         /* MARKER BIT */
+         tmpvar = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication,&bibError);
+         if (bibError)
+            goto exitFunction;
+         if (!tmpvar) {
+            deb("vdxGetRVLCDCTBlock:ERROR - Wrong marker bit.\n");
+            retValue = VDX_OK_BUT_BIT_ERROR;
+            goto exitFunction;
+         }
+         /* SIGN */
+         sign = bibGetBits(5, inBuffer, &numBitsGot, bitErrorIndication, 
+            &bibError);
+         if (bibError)
+            goto exitFunction;
+
+         if (sign == 1) {
+            level = -level;
+         } else if (sign != 0) {
+            deb("vdxGetRVLCDCTBlock:ERROR - illegal sign.\n");
+            retValue = VDX_OK_BUT_BIT_ERROR;
+            goto exitFunction;
+         }
+
+      } else {
+
+         last = (RVLCIndex >> 16) & 1;
+         run = (RVLCIndex >> 8) & 255;
+         level = RVLCIndex & 255;
+
+         sign = bibGetBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+            &bibError);
+         if (bibError)
+            goto exitFunction;
+
+         if (sign)
+            level = -level;
+      }
+
+      /* If too many coefficients */
+      if (index + run > 63) {
+         deb("vdxGetRVLCDCTBlock:ERROR - too many TCOEFs.\n");
+         retValue = VDX_OK_BUT_BIT_ERROR;
+         goto exitFunction;
+      }
+
+      /* Do run-length decoding */
+      while (run--)
+         block[index++] = 0;
+
+      block[index++] = level;
+
+   } while (!last);
+
+   exitFunction:
+
+   /* Set the rest of the coefficients to zero */
+   while (index <= 63) {
+      block[index++] = 0;
+   }
+
+   if (!bibError)
+      return retValue;
+
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   }
+
+   else
+      return VDX_ERR_BIB;
+}
+
+/*
+ * vdxGetRVLCDCTBlockBackwards
+ *    
+ *
+ * Parameters:
+ *    inBuffer                   pointer to bit buffer instance
+ *    startIndex                 the first index in block where to put data
+ *    fIntraBlock                indicates an intra "1" or inter "0" Block
+ *    BitPosBeforeRVLC           bit position of inBuffer before the RVLC block,
+ *                               indicates the point to stop decoding backwards
+ *    block                      array for block (length 64)
+ *    bitErrorIndication         non-zero if a bit error has been detected
+ *                               within the bits accessed in this function,
+ *                               see biterr.h for possible values
+ *
+ * Function:
+ *   This function reads a block in backwards direction from the bit buffer
+ *   using Huffman codes listed in RVLC TCOEF table. The bit position of the 
+ *   buffer at return from the function is where the DCT data of the current 
+ *   block starts.
+ *
+ * Returns:
+ *    VDX_OK                     the function was successful
+ *    VDX_OK_BUT_BIT_ERROR       the function behaved normally, but a bit error
+ *                               occured
+ *    VDX_ERR_BIB                an error occured when accessing bit buffer
+ *
+ *   
+ *
+ */
+
+int vdxGetRVLCDCTBlockBackwards(
+   bibBuffer_t *inBuffer, 
+   int startIndex,
+   int fIntraBlock,
+//   u_int32 BitPosBeforeRVLC,
+   int *block,
+   int *bitErrorIndication)
+{
+    int numBitsGot,
+      retValue = VDX_OK,
+      index = 63; /* index to zigzag table running from 1 to 63 */
+   u_int32
+      bits,
+      RVLCIndex = 0,
+      RVLCLength = 0;
+   int16
+      bibError = 0;
+
+   int run,    /* RUN code */
+      level;      /* LEVEL code */
+   u_int32 
+      last,       /* LAST code (see standard) */
+      sign,       /* sign for level */
+       escape;
+
+   vdxAssert(inBuffer != NULL);
+   vdxAssert(startIndex == 0 || startIndex == 1);
+   vdxAssert(block != NULL);
+   vdxAssert(bitErrorIndication != NULL);
+
+   do {
+      /* SIGN */
+      bibRewindBits(1, inBuffer, &bibError);
+      if (bibError)
+         goto exitFunction;
+      sign = bibShowBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+         &bibError);
+      if (bibError) {
+         goto exitFunction;
+      }
+      
+      /* Read next codeword */
+      bibRewindBits(15, inBuffer, &bibError);
+      if (bibError)
+         goto exitFunction;
+      bits = (int) bibGetBits(15, inBuffer, &numBitsGot, bitErrorIndication,
+         &bibError);
+      if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+         deb("vdxGetRVLCDCTBlockBackwards: bibShowBits returned not enough data --> "
+            "try to use the data available.\n");
+         bits <<= (15 - numBitsGot);
+         bibError = 0;
+      }
+      else if (bibError) {
+         deb("vdxGetRVLCDCTBlockBackwards: ERROR - bibGetBits failed.\n");
+         goto exitFunction;
+      }
+
+      /* Identifying the codeword in the read bits */
+      {
+         int count, len = 1;
+         u_int32 mask = 2; /* mask  000000000000010   */
+         
+         if (bits & mask) {
+            count = 1;
+            for (len = 1; count > 0 && len < 15; len++) {
+               mask = mask << 1;
+               if (bits & mask) 
+                  count--;
+            }
+         } else {
+            count = 2;
+            for (len = 1; count > 0 && len < 15; len++) {
+               mask = mask << 1;
+               if (!(bits & mask))
+                  count--;
+            }
+         }
+         
+         if (len >= 15) {
+            deb("vdxGetRVLCDCTBlockBackwards:ERROR - illegal RVLC codeword.\n");
+            retValue = VDX_OK_BUT_BIT_ERROR;
+            goto exitFunction;
+         }
+
+         bits = bits & (0x7fff >> (15 - (len + 1)));
+      }
+
+      /* Get the RVLC table Index and length belonging to the codeword */
+      if (vdxGetRVLCIndex(bits, &RVLCIndex, (int *) &RVLCLength, fIntraBlock, bitErrorIndication) != VDX_OK)
+         goto exitFunction;
+
+      /* Flush the codeword from the buffer */
+      bibRewindBits(RVLCLength, inBuffer, &bibError);
+      if (bibError)
+         goto exitFunction;
+
+      if (RVLCIndex == 7167)     /* ESCAPE */
+      {  
+         /* MARKER BIT */
+         bibRewindBits(1, inBuffer, &bibError);
+         if (bibError)
+            goto exitFunction;
+         if(!bibShowBits(1, inBuffer, &numBitsGot, bitErrorIndication,&bibError) 
+            || bibError ) {
+            deb("vdxGetRVLCDCTBlockBackwards:ERROR - Wrong marker bit.\n");
+            if ( !bibError )
+               retValue = VDX_OK_BUT_BIT_ERROR;
+            goto exitFunction;
+         }
+         /* LEVEL */
+         bibRewindBits(11, inBuffer, &bibError);
+         if (bibError)
+            goto exitFunction;
+         level = (int) bibShowBits(11, inBuffer, &numBitsGot, bitErrorIndication, 
+            &bibError);
+         if (level == 0 || bibError ) {
+            if (!bibError) {
+               deb("vdxGetRVLCDCTBlockBackwards:ERROR - Invalid Level.\n");
+               retValue = VDX_OK_BUT_BIT_ERROR;
+            }
+            goto exitFunction;
+         }
+         /* MARKER BIT */
+         bibRewindBits(1, inBuffer, &bibError);
+         if (bibError)
+            goto exitFunction;
+         if(!bibShowBits(1, inBuffer, &numBitsGot, bitErrorIndication,&bibError) 
+            || bibError ) {
+            if ( !bibError ) {
+               deb("vdxGetRVLCDCTBlockBackwards:ERROR - Wrong marker bit.\n");
+               retValue = VDX_OK_BUT_BIT_ERROR;
+            }
+            goto exitFunction;
+         }
+         /* RUN */
+         bibRewindBits(6, inBuffer, &bibError);
+         if (bibError)
+            goto exitFunction;
+         run = (int) bibShowBits(6, inBuffer, &numBitsGot, bitErrorIndication, 
+            &bibError);
+         if (bibError) {
+            goto exitFunction;
+         }
+         /* LAST */
+         bibRewindBits(1, inBuffer, &bibError);
+         if (bibError)
+            goto exitFunction;
+         last = bibShowBits(1, inBuffer, &numBitsGot, bitErrorIndication, 
+            &bibError);
+         if (bibError) {
+            goto exitFunction;
+         }
+
+         /* Get the first ESCAPE code from the buffer */
+         bibRewindBits(5, inBuffer, &bibError);
+         if (bibError)
+            goto exitFunction;
+         escape = bibShowBits(5, inBuffer, &numBitsGot, bitErrorIndication, 
+            &bibError);
+         if (bibError) {
+            goto exitFunction;
+         }
+
+         if (escape != 1) {
+            deb("vdxGetRVLCDCTBlockBackwards:ERROR - illegal escape code.\n");
+            retValue = VDX_OK_BUT_BIT_ERROR;
+            goto exitFunction;
+         }
+
+         RVLCLength += 25;
+
+      } else {
+
+         last = (RVLCIndex >> 16) & 1;
+         run = (RVLCIndex >> 8) & 255;
+         level = RVLCIndex & 255;
+      }
+
+      if (sign)
+         level = -level;
+
+      if (index == 63) {
+         if (!last) {
+            deb("vdxGetRVLCDCTBlockBackwards:ERROR - last TCOEFF problem.\n");
+            retValue = VDX_OK_BUT_BIT_ERROR;
+            goto exitFunction;
+         } else 
+            last = 0;
+      }
+      
+      if (last) {
+         bibFlushBits((RVLCLength + 1), inBuffer, &numBitsGot, bitErrorIndication, 
+            &bibError);
+         if (bibError)
+            goto exitFunction;
+
+      } else if (index - run < startIndex) {
+         deb("vdxGetRVLCDCTBlockBackwards:ERROR - too many TCOEFFs.\n");
+         retValue = VDX_OK_BUT_BIT_ERROR;
+         goto exitFunction;
+
+      } else {
+         /* Do run-length decoding. Since we are decoding backwards, level has to be inserted first */
+         block[index--] = level;
+
+         while (run--)
+            block[index--] = 0;
+         
+      }
+
+   } while (!last); 
+
+   exitFunction:
+
+   {
+      int i;   
+      for(i=startIndex,index++; i<=63; i++,index++)
+         block[i]= (index <= 63) ? block[index] : 0;
+   }
+
+
+   if (!bibError)
+      return retValue;
+   else if (bibError == ERR_BIB_NOT_ENOUGH_DATA) {
+      return VDX_OK_BUT_BIT_ERROR;
+   } else
+      return VDX_ERR_BIB;
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/h263decoder/src/vlb.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1434 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation for MPEG4(H263) video transcoder. 
+* VLC encoding for RVLC -> VLC  AC/DCT coeficients in the transcoder.
+*
+*/
+
+
+#include "biblin.h"
+#include "common.h"
+
+
+/* Run-length coding */
+typedef struct{
+    int16 run;
+    int level;
+    int16 last;
+} tEvent;
+
+/* Variable length coding */
+typedef struct{
+    u_int16 code;
+    u_int16 length;
+} tVLCTable;
+
+
+/* 
+ * Function Declarations 
+ */
+int32 vlbPutACCoeffSVH(int32 coeffStart, int16* block, bibBuffer_t * outBuf,
+                       int32 svh, int32 lastPos);
+int32 vlbPutACVLCCoeff(bibBuffer_t *outBuf, tEvent *event, int32 svh);
+int32 vlbPutDCCoeffCMT(int val, bibBuffer_t * outBuf, int32  blkCnt);
+int32 vlbPutIntraACCoeffCMTDP(bibBuffer_t *outBuf, tEvent *event);
+int32 vlbPutIntraACCoeffCMT(int32 coeffStart, int* block, bibBuffer_t * outBuf);
+void  vdtPutBits (void *outBuf,  int numBits, unsigned int value);
+
+
+/* 
+ * Function Definitions 
+ */
+
+
+/* {{-output"vlbPutBits.txt"}} */
+/*
+* vlbPutBits
+*
+* Parameters:
+*     outBuf            output buffer
+*           numBits         number of bits to write
+*           value             value to write
+*
+* Function:
+*     This function puts some bits to the output buffer
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vlbPutBits (bibBuffer_t *outBuf,
+                 int32        numBits,
+                 u_int32      value)
+{
+    // To be compatible with the old codes, I don't change the interface
+    vdtPutBits((void *)outBuf, numBits, value);
+}
+
+
+/* 
+ * Look-up tables 
+ */
+
+/* INTRA VLC tables */
+
+/* run == 0 && level < 28 */
+const tVLCTable vlbVLCTable1IntraAC[28] =
+{
+    {NOT_VALID,NOT_VALID},    {0x04,0x03}, {0x0c,0x04}, 
+        {0x1e,0x05}, {0x1a,0x06}, {0x18,0x06}, {0x2a,0x07}, 
+        {0x26,0x07}, {0x24,0x07}, {0x2e,0x08}, {0x3e,0x09}, 
+        {0x3c,0x09}, {0x3a,0x09}, {0x4a,0x0a}, {0x48,0x0a},
+        {0x46,0x0a}, {0x42,0x0a}, {0x42,0x0b}, {0x40,0x0b},
+        {0x1e,0x0b}, {0x1c,0x0b}, {0x0e,0x0c}, {0x0c,0x0c},
+        {0x40,0x0c}, {0x42,0x0c}, {0xa0,0x0d}, {0xa2,0x0d},
+        {0xa4,0x0d}
+};
+
+/* run == 1 && level < 11 */
+const tVLCTable vlbVLCTable2IntraAC[11] =
+{
+    {NOT_VALID, NOT_VALID},   {0x1c,0x05}, {0x28,0x07}, 
+        {0x2c,0x08}, {0x38,0x09}, {0x40,0x0a}, {0x3e,0x0a}, 
+        {0x1a,0x0b}, {0x44,0x0c}, {0xa6,0x0d}, {0xaa,0x0d}
+};
+
+/* run == 2 && level < 6 */
+const tVLCTable vlbVLCTable3IntraAC[6] =
+{
+    {NOT_VALID, NOT_VALID},   {0x16,0x06}, {0x2a,0x08}, 
+        {0x3c,0x0a}, {0x18,0x0b}, {0xac,0x0d}
+};
+
+/* run == 3 && level < 5 */
+const tVLCTable vlbVLCTable4IntraAC[5] = 
+{
+    {NOT_VALID, NOT_VALID},   {0x22,0x07}, {0x36,0x09}, 
+        {0x3a,0x0a}, {0x16,0x0b}
+};
+
+/* 4 <= run < 8 && level < 4 */
+const tVLCTable vlbVLCTable5IntraAC[4][4] =
+{
+  {
+        {NOT_VALID, NOT_VALID},   {0x20,0x07}, {0x44,0x0a}, 
+        {0x14,0x0b}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x1a,0x07}, {0x38,0x0a}, 
+        {0x10,0x0b}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x24,0x08}, {0x36,0x0a}, 
+        {0xa8,0x0d}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x28,0x08}, {0x34,0x0a}, 
+        {0xae,0x0d}
+  }
+};
+
+/* 8 <= run < 10 && level < 3 */
+const tVLCTable vlbVLCTable6IntraAC[2][3] =
+{
+  {
+        {NOT_VALID, NOT_VALID},   {0x32,0x09}, {0x12,0x0b}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x30,0x09}, {0x46,0x0c}
+  }
+};
+
+/* 10 <= run < 15 && level < 2 */
+const tVLCTable vlbVLCTable7IntraAC[5][2] = 
+{
+  {
+    {NOT_VALID, NOT_VALID},   {0x2e,0x09}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x32,0x0a}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x30,0x0a}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x0e,0x0b}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0xb0,0x0d}
+  }
+};
+
+/* run == 0 && level < 9 */
+const tVLCTable vlbVLCTable8IntraAC[9] = 
+{
+    {NOT_VALID, NOT_VALID},   {0x0e,0x05}, {0x18,0x07}, 
+        {0x2c,0x09}, {0x2e,0x0a}, {0x0c,0x0b}, {0x0a,0x0c},
+        {0x08,0x0c}, {0xb2,0x0d}
+};
+
+/* run == 1 && level < 4 */
+const tVLCTable vlbVLCTable9IntraAC[4] =
+{
+    {NOT_VALID, NOT_VALID},   {0x1e,0x07}, {0x2c,0x0a}, 
+        {0x0a,0x0b}
+};
+
+/* 2 <= run < 7 && level < 3 */
+const tVLCTable vlbVLCTable10IntraAC[5][3] =
+{
+  {
+    {NOT_VALID, NOT_VALID},   {0x1c,0x07}, {0x08,0x0b}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x22,0x08}, {0x48,0x0c}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x20,0x08}, {0x4a,0x0c}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x26,0x08}, {0xb4,0x0d}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x2a,0x09}, {0xb6,0x0d}
+  }
+};
+
+/* 7 <= run < 21 && level == 1 */
+const tVLCTable vlbVLCTable11IntraAC[14][2] =
+{
+  {
+    {NOT_VALID, NOT_VALID},   {0x28,0x09}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x26,0x09}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x34,0x09}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x2a,0x0a}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x28,0x0a}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x26,0x0a}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x24,0x0a}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x22,0x0a}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x4c,0x0c}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x4e,0x0c}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0xb8,0x0d}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0xba,0x0d}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0xbc,0x0d}
+  },
+  { 
+    {NOT_VALID, NOT_VALID},   {0xbe,0x0d}
+  }
+};
+
+
+/* Inter AC VLC tables */
+
+const tVLCTable vlbVLCTable1InterAC[13] =
+{
+    {NOT_VALID, NOT_VALID},
+    {0x04,0x03}, {0x1e,0x05}, {0x2a,0x07}, {0x2e,0x08},
+    {0x3e,0x09}, {0x4a,0x0a}, {0x48,0x0a}, {0x42,0x0b},
+    {0x40,0x0b}, {0x0e,0x0c}, {0x0c,0x0c}, {0x40,0x0c}
+};
+
+const tVLCTable vlbVLCTable2InterAC[7] =
+{
+    {NOT_VALID, NOT_VALID},   {0x0c,0x04}, {0x28,0x07}, 
+        {0x3c,0x09}, {0x1e,0x0b}, {0x42,0x0c}, {0xa0,0x0d}
+};
+
+const tVLCTable vlbVLCTable3InterAC[5] =
+{
+    {NOT_VALID, NOT_VALID},   {0x1c,0x05}, {0x3a,0x09}, 
+        {0x1c,0x0b}, {0xa2,0x0d}
+};
+
+const tVLCTable vlbVLCTable4InterAC[4][4] = 
+{
+  {
+    {NOT_VALID, NOT_VALID},   {0x1a,0x06}, {0x46,0x0a}, 
+        {0x1a,0x0b}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x18,0x06}, {0x44,0x0a}, 
+        {0xa4,0x0d}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x16,0x06}, {0x18,0x0b}, 
+        {0xa6,0x0d}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x26,0x07}, {0x16,0x0b}, 
+        {0xa8,0x0d}
+  }
+};
+
+const tVLCTable vlbVLCTable5InterAC[4][3] =
+{
+  {
+    {NOT_VALID, NOT_VALID},   {0x24,0x07}, {0x14,0x0b}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x22,0x07}, {0x12,0x0b}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x20,0x07}, {0x10,0x0b}
+  },
+  {
+    {NOT_VALID, NOT_VALID},   {0x2c,0x08}, {0xaa,0x0d}
+  }
+};
+
+const tVLCTable vlbVLCTable6InterAC[16] =
+{
+    {0x2a,0x08}, {0x28,0x08}, {0x38,0x09}, {0x36,0x09},
+    {0x42,0x0a}, {0x40,0x0a}, {0x3e,0x0a}, {0x3c,0x0a}, 
+        {0x3a,0x0a}, {0x38,0x0a}, {0x36,0x0a}, {0x34,0x0a}, 
+        {0x44,0x0c}, {0x46,0x0c}, {0xac,0x0d}, {0xae,0x0d}
+};
+
+const tVLCTable vlbVLCTable7InterAc[4] =
+{
+    {NOT_VALID, NOT_VALID},   {0x0e,0x05}, {0x32,0x0a}, 
+        {0x0a,0x0c}
+};
+
+const tVLCTable vlbVLCTable8InterAC[3] =
+{
+    {NOT_VALID, NOT_VALID},   {0x1e,0x07}, {0x08,0x0c}
+};
+
+const tVLCTable vlbVLCTable9InterAC[39] =
+{
+    {0x1c,0x07}, {0x1a,0x07}, {0x18,0x07}, {0x26,0x08},
+    {0x24,0x08}, {0x22,0x08}, {0x20,0x08}, {0x34,0x09},
+    {0x32,0x09}, {0x30,0x09}, {0x2e,0x09}, {0x2c,0x09},
+    {0x2a,0x09}, {0x28,0x09}, {0x26,0x09}, {0x30,0x0a},
+    {0x2e,0x0a}, {0x2c,0x0a}, {0x2a,0x0a}, {0x28,0x0a},
+    {0x26,0x0a}, {0x24,0x0a}, {0x22,0x0a}, {0x0e,0x0b},
+    {0x0c,0x0b}, {0x0a,0x0b}, {0x08,0x0b}, {0x48,0x0c},
+    {0x4a,0x0c}, {0x4c,0x0c}, {0x4e,0x0c}, {0xb0,0x0d}, 
+        {0xb2,0x0d}, {0xb4,0x0d}, {0xb6,0x0d}, {0xb8,0x0d}, 
+        {0xba,0x0d}, {0xbc,0x0d}, {0xbe,0x0d}
+};
+
+
+const int8 vlbVLCRun0InterAC[64] =
+{
+    0x0d, 0x07, 0x05, 0x04, 0x04, 0x04, 0x04, 0x03, 
+      0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 
+      0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 
+      0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const int8 vlbVLCRun1InterAC[64] =
+{
+      0x04, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 
+      0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 
+      0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 
+      0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 
+      0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 
+      0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 
+};
+
+/* other tables */
+const int8 vlbLMaxTableIntra[36] =
+{
+    0x1b, 0x0a, 0x05, 0x04, 0x03, 0x03, 
+        0x03, 0x03, 0x02, 0x02, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x08, 0x03, 0x02, 
+        0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x01, 0x01, 0x01
+};
+
+const int8 vlbLMaxTableInter[68] =
+{
+    0x0c, 0x06, 0x04, 0x03, 0x03, 0x03, 
+        0x03, 0x02, 0x02, 0x02, 0x02, 0x01, 
+        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x03, 0x02, 0x01, 
+        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+        0x01, 0x01
+};
+
+const int8 vlbRMaxTableIntra[35] =
+{
+    0x0f, 0x0a, 0x08, 0x04, 0x03, 0x02, 
+        0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 
+        0x01, 0x01, 0x01, 0x15, 0x07, 0x02,
+    0x01, 0x01, 0x01, 0x01, 0x01
+};
+
+const int8 vlbRMaxTableInter[15] =
+{
+    0x1b, 0x0b, 0x07, 0x03, 0x02, 0x02,
+    0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+    0x29, 0x02, 0x01
+};
+
+
+const u_int32 vlbZigzagScan[64] = 
+{
+    0x00, 0x01, 0x08, 0x10, 0x09, 0x02, 0x03, 0x0a,
+    0x11, 0x18, 0x20, 0x19, 0x12, 0x0b, 0x04, 0x05,
+    0x0c, 0x13, 0x1a, 0x21, 0x28, 0x30, 0x29, 0x22,
+    0x1b, 0x14, 0x0d, 0x06, 0x07, 0x0e, 0x15, 0x1c,
+    0x23, 0x2a, 0x31, 0x38, 0x39, 0x32, 0x2b, 0x24,
+    0x1d, 0x16, 0x0f, 0x17, 0x1e, 0x25, 0x2c, 0x33,
+    0x3a, 0x3b, 0x34, 0x2d, 0x26, 0x1f, 0x27, 0x2e,
+    0x35, 0x3c, 0x3d, 0x36, 0x2f, 0x37, 0x3e, 0x3f
+};
+
+const u_int32 vlbInvZigzagScan[64] = 
+{
+    0x00, 0x01, 0x05, 0x06, 0x0e, 0x0f, 0x1b, 0x1c,
+    0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1d, 0x2a,
+    0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2b,
+    0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2c, 0x35,
+    0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x36,
+    0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x3c,
+    0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3d,
+    0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3e, 0x3f
+};
+
+
+const tVLCTable vlbLumaTableIntraDC[13] = 
+{
+    {0x03,0x03}, {0x03,0x02}, {0x02,0x02}, {0x02,0x03}, 
+        {0x01,0x03}, {0x01,0x04}, {0x01,0x05}, {0x01,0x06}, 
+        {0x01,0x07}, {0x01,0x08}, {0x01,0x09}, {0x01,0x0a}, 
+        {0x01,0x0b}
+};
+
+const tVLCTable vlbChromaTableIntraDC[13] =
+{
+    {0x03,0x02}, {0x02,0x02}, {0x01,0x02}, {0x01,0x03}, 
+        {0x01,0x04}, {0x01,0x05}, {0x01,0x06}, {0x01,0x07}, 
+        {0x01,0x08}, {0x01,0x09}, {0x01,0x0a}, {0x01,0x0b}
+};
+
+/* Array of pointers for AC VLC (INTER)tables */
+const tVLCTable * const vlbVLCTablePointer0[27] =
+{
+    vlbVLCTable1InterAC,
+    vlbVLCTable2InterAC,
+    vlbVLCTable3InterAC,
+    vlbVLCTable4InterAC[0],
+    vlbVLCTable4InterAC[1],
+    vlbVLCTable4InterAC[2],
+    vlbVLCTable4InterAC[3],
+    vlbVLCTable5InterAC[0],
+    vlbVLCTable5InterAC[1],
+    vlbVLCTable5InterAC[2],
+    vlbVLCTable5InterAC[3],
+    vlbVLCTable6InterAC - 0x01, // this pointer is going outside the range, but it is used only with condition (level < vlbVLCRun0InterAC[run]) which results having indexes > 0 and hence the array is never indexed below its base address
+    vlbVLCTable6InterAC ,
+    vlbVLCTable6InterAC + 0x01,
+    vlbVLCTable6InterAC + 0x02,
+    vlbVLCTable6InterAC + 0x03,
+    vlbVLCTable6InterAC + 0x04,
+    vlbVLCTable6InterAC + 0x05,
+    vlbVLCTable6InterAC + 0x06,
+    vlbVLCTable6InterAC + 0x07,
+    vlbVLCTable6InterAC + 0x08,
+    vlbVLCTable6InterAC + 0x09,
+    vlbVLCTable6InterAC + 0x0a,
+    vlbVLCTable6InterAC + 0x0b,
+    vlbVLCTable6InterAC + 0x0c,
+    vlbVLCTable6InterAC + 0x0d,
+    vlbVLCTable6InterAC + 0x0e
+
+};
+
+const tVLCTable * const vlbVLCTablePointer1[41] =
+{
+    vlbVLCTable7InterAc,
+    vlbVLCTable8InterAC,
+    vlbVLCTable9InterAC - 0x01, // this pointer is going outside the range, but it is used only with condition (level < vlbVLCRun1InterAC[run]) which results having indexes > 0 and hence the array is never indexed below its base address
+    vlbVLCTable9InterAC ,
+    vlbVLCTable9InterAC + 0x01,
+    vlbVLCTable9InterAC + 0x02,
+    vlbVLCTable9InterAC + 0x03,
+    vlbVLCTable9InterAC + 0x04,
+    vlbVLCTable9InterAC + 0x05,
+    vlbVLCTable9InterAC + 0x06,
+    vlbVLCTable9InterAC + 0x07,
+    vlbVLCTable9InterAC + 0x08,
+    vlbVLCTable9InterAC + 0x09,
+    vlbVLCTable9InterAC + 0x0a,
+    vlbVLCTable9InterAC + 0x0b,
+    vlbVLCTable9InterAC + 0x0c,
+    vlbVLCTable9InterAC + 0x0d,
+    vlbVLCTable9InterAC + 0x0e,
+    vlbVLCTable9InterAC + 0x0f,
+    vlbVLCTable9InterAC + 0x10,
+    vlbVLCTable9InterAC + 0x11,
+    vlbVLCTable9InterAC + 0x12,
+    vlbVLCTable9InterAC + 0x13,
+    vlbVLCTable9InterAC + 0x14,
+    vlbVLCTable9InterAC + 0x15,
+    vlbVLCTable9InterAC + 0x16,
+    vlbVLCTable9InterAC + 0x17,
+    vlbVLCTable9InterAC + 0x18,
+    vlbVLCTable9InterAC + 0x19,
+    vlbVLCTable9InterAC + 0x1a,
+    vlbVLCTable9InterAC + 0x1b,
+    vlbVLCTable9InterAC + 0x1c,
+    vlbVLCTable9InterAC + 0x1d,
+    vlbVLCTable9InterAC + 0x1e,
+    vlbVLCTable9InterAC + 0x1f,
+    vlbVLCTable9InterAC + 0x20,
+    vlbVLCTable9InterAC + 0x21,
+    vlbVLCTable9InterAC + 0x22,
+    vlbVLCTable9InterAC + 0x23,
+    vlbVLCTable9InterAC + 0x24,
+    vlbVLCTable9InterAC + 0x25,
+};
+
+const int8 vlbVLCRun0IntraAC[64] =
+{
+    0x1c, 0x0b, 0x06, 0x05, 0x04, 0x04, 0x04, 0x04, 
+      0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 
+};
+
+const int8 vlbVLCRun1IntraAC[64] =
+{
+    0x09, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 
+    0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 
+      0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 
+};
+
+/* array of table pointers for AC VLC INTRA tables*/
+
+const tVLCTable * const vlbVLCTableIntraPointer0[15] =
+{
+    vlbVLCTable1IntraAC,
+    vlbVLCTable2IntraAC,
+    vlbVLCTable3IntraAC,
+    vlbVLCTable4IntraAC,
+    vlbVLCTable5IntraAC[0],
+    vlbVLCTable5IntraAC[1],
+    vlbVLCTable5IntraAC[2],
+    vlbVLCTable5IntraAC[3],
+    vlbVLCTable6IntraAC[0],
+    vlbVLCTable6IntraAC[1],
+    vlbVLCTable7IntraAC[0],
+    vlbVLCTable7IntraAC[1],
+    vlbVLCTable7IntraAC[2],
+    vlbVLCTable7IntraAC[3],
+    vlbVLCTable7IntraAC[4],
+};
+
+const tVLCTable * const vlbVLCTableIntraPointer1[21] =
+{
+    vlbVLCTable8IntraAC,
+    vlbVLCTable9IntraAC,
+    vlbVLCTable10IntraAC[0],
+    vlbVLCTable10IntraAC[1],
+    vlbVLCTable10IntraAC[2],
+    vlbVLCTable10IntraAC[3],
+    vlbVLCTable10IntraAC[4],
+    vlbVLCTable11IntraAC[0],
+    vlbVLCTable11IntraAC[1],
+    vlbVLCTable11IntraAC[2],
+    vlbVLCTable11IntraAC[3],
+    vlbVLCTable11IntraAC[4],
+    vlbVLCTable11IntraAC[5],
+    vlbVLCTable11IntraAC[6],
+    vlbVLCTable11IntraAC[7],
+    vlbVLCTable11IntraAC[8],
+    vlbVLCTable11IntraAC[9],
+    vlbVLCTable11IntraAC[10],
+    vlbVLCTable11IntraAC[11],
+    vlbVLCTable11IntraAC[12],
+    vlbVLCTable11IntraAC[13],
+};
+
+
+/* {{-output"vdtPutIntraMBCMT.txt"}} */
+/*
+* vdtPutIntraMBCMT
+*
+* Parameters:
+*     outBuf                output buffer
+*       coeff           pointer to the coefficients that must be in scanned order
+*       numTextureBits  pointer to store the number of bits taken to encode the macro block.
+*       index           block Index
+*       skipDC          whether to skip INTRA DC
+*       skipAC          whether to skip INTRA AC
+*
+* Function:
+*     This function forms the bitstream for INTRA macroblock in combined motion and 
+*     texture mode for the transcoding module
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vdtPutIntraMBCMT(bibBuffer_t *outBuf, int *coeff, int *numTextureBits, int index, int skipDC, int skipAC)
+{
+    int32   textureBits;
+    textureBits = 0;
+    
+    // DC coefficient VLC
+    if (!skipDC)
+    {
+       textureBits += vlbPutDCCoeffCMT(coeff[0], outBuf, index);
+    }
+    
+    //AC coefficient VLC
+    if (!skipAC)
+    {
+        textureBits += vlbPutIntraACCoeffCMT(1, coeff, outBuf);
+        *numTextureBits = textureBits;
+    }
+    
+    return;
+}
+
+
+/* {{-output"vdtPutInterMBCMT.txt"}} */
+/*
+* vdtPutInterMBCMT
+*
+* Parameters:
+*     outBuf                output buffer
+*       coeff           pointer to the coefficients that must be in scanned order
+*       numTextureBits  pointer to store the number of bits taken to encode the macro block.
+*       svh             flag to indicate short video header
+*
+* Function:
+*     This function forms the bitstream for INTER macroblock in combined motion and 
+*     texture mode for the transcoding module
+*
+* Returns:
+*     Nothing.
+*
+* Error codes:
+*     None.
+*
+*/
+void vdtPutInterMBCMT(bibBuffer_t *outBuf, int coeffStart, int *coeff, int *numTextureBits, int svh)
+{
+    int32   textureBits;
+    int16 coeffInt16[64];
+
+    /* encode texture coefficients */
+    textureBits = 0;
+    /* find out the last nonzero coeficients */
+    int nonZeroDCT = 0;
+    for (int i = 0; i < 64; i++)
+    {
+        nonZeroDCT = coeff[i] != 0 ? i : nonZeroDCT;
+        coeffInt16[i] = (int16)coeff[i];
+    }
+    textureBits += vlbPutACCoeffSVH(coeffStart, coeffInt16, outBuf, svh, nonZeroDCT);
+    *numTextureBits = textureBits;
+    
+    return;
+}
+
+
+
+/* {{-output"vlbPutDCCoeffCMT.txt"}} */
+/*
+* vlbPutDCCoeffCMT
+*
+* Parameters:
+*     outBuf                output buffer
+*       val             value of the DC coefficient
+*       blkCnt          block number in the macro block
+*
+* Function:
+*     This function puts DC coefficient in CMT mode into the bitstream
+*
+* Returns:
+*     number of bits outputted.
+*
+* Error codes:
+*     None.
+*
+*/
+int32 vlbPutDCCoeffCMT(int val, bibBuffer_t * outBuf, int32  blkCnt)
+{
+    int32   absVal;
+    int32   numBits;
+    int32   size;
+    
+    absVal = ABS(val);
+    size = 0;
+    
+    while(absVal > 0)
+    {
+        size++;
+        absVal >>= 1;
+    }
+    
+    numBits = size;
+    if(blkCnt < 4)
+    {
+        vlbPutBits(outBuf, vlbLumaTableIntraDC[size].length, vlbLumaTableIntraDC[size].code); 
+        numBits += vlbLumaTableIntraDC[size].length;
+    }
+    else
+    {
+        vlbPutBits(outBuf, vlbChromaTableIntraDC[size].length, vlbChromaTableIntraDC[size].code); 
+        numBits += vlbChromaTableIntraDC[size].length;
+    }
+    
+    if(size)
+    {
+        if(val > 0)
+        {
+            vlbPutBits(outBuf, size, val); 
+        }
+        else
+        {
+            absVal = ((1 << size) - 1);
+            vlbPutBits(outBuf, size, (absVal + val)); 
+        }
+    }
+    
+    if(size > 8)
+    {
+        vlbPutBits(outBuf, 1, 1);
+        numBits++;
+    }
+    
+    return numBits;
+}
+
+
+
+/* {{-output"vlbPutIntraACCoeffCMT.txt"}} */
+/*
+* vlbPutIntraACCoeffCMT
+*
+* Parameters:
+*     outBuf                output buffer
+*       coeffStart      coefficient number from where the coding is to start
+*       block           pointer to the texture block data
+*
+* Function:
+*     This function puts AC coefficients in CMT mode into the bitstream
+*
+* Returns:
+*     number of bits outputted.
+*
+* Error codes:
+*     None.
+*
+*/
+int32 vlbPutIntraACCoeffCMT(int32 coeffStart, int* block, bibBuffer_t * outBuf) 
+{
+    tEvent      prevEvent;
+    tEvent      currEvent;
+    int32       i;
+    int32       numBits;
+    tEvent      *prev = &prevEvent;
+    tEvent      *curr = &currEvent;
+    int     level;
+    
+    curr->run  = 0;
+    prev->last = 0;
+    numBits    = 0;
+    
+    for(i = coeffStart; i < 64; i++)
+    {
+        level = block[i]; 
+        if(level == 0)
+        {
+            curr->run++;
+        }
+        else
+        {
+            prev->level = level;
+            prev->run = curr->run;
+            curr->run  = 0;
+            break;
+        }
+    }
+    
+    for(i = i+1; i < 64; i++)
+    {
+        level = block[i]; 
+        if(level == 0)
+        {
+            curr->run++;
+        }
+        else
+        {
+            numBits  += vlbPutIntraACCoeffCMTDP(outBuf, &prevEvent);
+            prev->level = level;
+            prev->run = curr->run;
+            curr->run = 0;
+        }
+    }
+    
+    prev->last = 1;
+    numBits  += vlbPutIntraACCoeffCMTDP(outBuf, &prevEvent);
+    
+    return numBits;
+}
+
+
+
+/* {{-output"vlbFindRMax.txt"}} */
+/*
+* vlbFindRMax
+*
+* Parameters:
+*     event           pointer to the event being coded
+*       mbType          macro block encoding type (INTER/INTRA)
+*
+* Function:
+*     This function finds RMAX value to subtract from run for escape coding 
+*     when reversible VLC is OFF
+*
+* Returns:
+*     RMAX value
+*
+* Error codes:
+*     None.
+*
+*/
+int32 vlbFindRMax(tEvent *event, int16 mbType)
+{
+    int32 level;
+    
+    level = ABS(event->level);
+    
+    if(mbType == INTRA)
+    {
+        if(event->last == 0)
+        {
+            return level <= 27 ? vlbRMaxTableIntra[level - 1] : 
+            NOT_VALID;
+        }
+        else
+        {
+            return level <= 8 ? vlbRMaxTableIntra[level + 26] :
+            NOT_VALID;
+        }
+    }
+    else
+    {
+        if (event->last == 0)
+        {
+            return level <= 12 ? vlbRMaxTableInter[level - 1] : 
+            NOT_VALID;
+        }
+        else
+        {
+            return level <= 3 ? vlbRMaxTableInter[level + 11]
+                : NOT_VALID; 
+        }
+    }
+}
+
+
+
+/* {{-output"vlbFindLMax.txt"}} */
+/*
+* vlbFindLMax
+*
+* Parameters:
+*     event           pointer to the event being coded
+*       mbType          macro block encoding type (INTER/INTRA)
+*
+* Function:
+*     This function finds LMAX value to subtract from run for escape coding 
+*     when reversible VLC is OFF
+*
+* Returns:
+*     LMAX value
+*
+* Error codes:
+*     None.
+*
+*/
+int32 vlbFindLMax(tEvent *event, int16 mbType)
+{
+    if (mbType == INTRA)
+    {
+        if (event->last == 0)
+        {
+            if (event->run <= 14)
+            {
+                return vlbLMaxTableIntra[event->run];
+            }
+            else
+            {
+                return NOT_VALID;
+            }
+        }
+        else
+        {
+            if (event->run <= 20)
+            {
+                return vlbLMaxTableIntra[event->run + 15];
+            }
+            else
+            {
+                return NOT_VALID;
+            }
+        }
+    }
+    else
+    {
+        if (event->last == 0)
+        {
+            return event->run <= 26 ? vlbLMaxTableInter[event->run] : 
+            NOT_VALID;
+        }
+        else
+        {
+            return event->run <= 40 ? vlbLMaxTableInter[event->run + 27] :
+            NOT_VALID;
+        }
+    }
+}
+
+
+
+/* {{-output"vlbPutIntraACCoeffCMTDP.txt"}} */
+/*
+* vlbPutIntraACCoeffCMTDP
+*
+* Parameters:
+*     outBuf                output buffer
+*       event           pointer to the event being coded
+*
+* Function:
+*     This function encodes AC coefficient for Intra blocks in combined motion texture 
+                    mode and data partitioned mode
+*
+* Returns:
+*     number of bits outputted.
+*
+* Error codes:
+*     None.
+*
+*/
+int32 vlbPutIntraACCoeffCMTDP(bibBuffer_t *outBuf, tEvent *event)
+{
+    int32       sign;
+    int32       level;
+    int32       run;
+    int32       status;
+    int32       count;
+    const tVLCTable   *vlcTable=NULL;
+    int32       lmax;
+    int32       rmax;
+    
+    sign  = (event->level >> 15) & (0x1);
+    level =  ABS(event->level);
+    run   = event->run;
+    count = 0;
+    
+    do
+    {
+        status = CODE_FOUND;
+        if(event->last == 0)
+        {
+            if(level < vlbVLCRun0IntraAC[run] )
+            {
+                vlcTable = vlbVLCTableIntraPointer0[run];
+            }           
+            else 
+            {
+                status = CODE_NOT_FOUND;
+            }
+        }
+        else
+        {
+            if(level < vlbVLCRun1IntraAC[run] )
+            {
+                vlcTable = vlbVLCTableIntraPointer1[run];
+            }           
+            else 
+            {
+                status = CODE_NOT_FOUND;
+            }
+        }
+        
+        if (status == CODE_NOT_FOUND)
+        {
+            switch (++count)
+            {
+            case 1:
+                {
+                    lmax = vlbFindLMax(event, INTRA);
+                    if (lmax == NOT_VALID)
+                    {
+                        count = 2;
+                    }
+                    else
+                    {
+                        level -= lmax;
+                        break;
+                    }
+                }
+            case 2:
+                {
+                    rmax = vlbFindRMax(event, INTRA);
+                    if (rmax != NOT_VALID)
+                    {
+                        level = ABS(event->level);
+                        run   = event->run - rmax;
+                        break;
+                    }
+                    else
+                    {
+                        count = 3;
+                    }
+                }
+            case 3:
+                {
+                    status = CODE_FOUND;
+                }
+            }
+        }
+        
+    } while (status != CODE_FOUND);
+    
+    switch (count)
+    {
+    case 0:
+        vlbPutBits(outBuf, vlcTable[level].length, vlcTable[level].code | sign);
+        return vlcTable[level].length;
+        
+    case 1:
+        vlbPutBits(outBuf, ESCAPE_CODE_LENGTH_VLC, ESCAPE_CODE_VLC);
+        vlbPutBits(outBuf, 1, 0);
+        vlbPutBits(outBuf, vlcTable[level].length, vlcTable[level].code | sign);
+        return vlcTable[level].length + 1 + ESCAPE_CODE_LENGTH_VLC;
+        
+    case 2:
+        vlbPutBits(outBuf, ESCAPE_CODE_LENGTH_VLC, ESCAPE_CODE_VLC);
+        vlbPutBits(outBuf, 2, 0x2);
+        vlbPutBits(outBuf, vlcTable[level].length, vlcTable[level].code | sign);
+        return vlcTable[level].length + 2 + ESCAPE_CODE_LENGTH_VLC;
+        
+    case 3:
+        vlbPutBits(outBuf, ESCAPE_CODE_LENGTH_VLC, ESCAPE_CODE_VLC);
+        vlbPutBits(outBuf, 2, 0x3);
+        vlbPutBits(outBuf, 8, (event->last << 7) | (event->run << 1) | 1);
+        vlbPutBits(outBuf, 13, ((event->level & 0x0fff) << 1) | 1);
+        return 23 + ESCAPE_CODE_LENGTH_VLC;
+        
+    default:
+        return E_FAILURE;
+    }
+}
+
+
+
+/* {{-output"vlbPutACCoeffSVH.txt"}} */
+/*
+* vlbPutACCoeffSVH
+*
+* Parameters:
+*     outBuf                output buffer
+*       coeffStart      coefficient number from where the coding to be started
+*       block           pointer to the texture block data. Coeficients must be in zigzag order
+*       svh             flag indicating whether short video header mode is ON
+*       lastPos         value of last non-zero position of block
+*
+* Function:
+*     This function puts AC coefficients in SVH mode into the bitstream
+*
+* Returns:
+*     number of bits outputted.
+*
+* Error codes:
+*     None.
+*
+*/
+int32 vlbPutACCoeffSVH(int32 coeffStart, int16* block, bibBuffer_t * outBuf,
+                       int32 svh, int32 lastPos)
+                                             
+{
+    tEvent  prevEvent;
+    tEvent  currEvent;
+    int32   i;
+    int32   numBits;
+    tEvent  *prev ;
+    tEvent  *curr ;
+    int32       level;
+    int32   lastPosition = lastPos;
+    
+    prev = &prevEvent;
+    curr = &currEvent;
+    curr->run  = 0;
+    prev->last = 0;
+    numBits = 0;
+    
+    for(i = coeffStart; i <= lastPosition; i++)
+    {
+        level = (int16)block[i];
+        if(level == 0)
+        {
+            curr->run++;
+        }
+        else
+        {
+            // clip the coeff (MPEG-4 has larger range than H.263) requantization of the whole block is too complicated for this minor use case
+            if ( level < -127 )
+                {
+                level = -127;
+                }
+            else if ( level > 127 )
+                {
+                level = 127;
+                }
+            prev->level = level;
+            prev->run = curr->run;
+            curr->run  = 0;
+            break;
+        }
+    }
+    
+    for(i = i+1; i <= lastPosition; i++)
+    {
+        level = (int16)block[i];
+        if(level == 0)
+        {
+            curr->run++;
+        }
+        else
+        {
+            numBits  += vlbPutACVLCCoeff(outBuf, &prevEvent,svh);
+            
+            // clip the coeff (MPEG-4 has larger range than H.263) requantization of the whole block is too complicated for this minor use case
+            if ( level < -127 )
+                {
+                level = -127;
+                }
+            else if ( level > 127 )
+                {
+                level = 127;
+                }
+            prev->level = level;
+            prev->run = curr->run;
+            curr->run = 0;
+        }
+    }
+    
+    prev->last = 1;
+    numBits  += vlbPutACVLCCoeff(outBuf, &prevEvent,svh);
+    
+    return numBits;
+}
+
+
+
+/* {{-output"vlbCodeACCoeffsSVHWithZigZag.txt"}} */
+/*
+* vlbCodeACCoeffsSVHWithZigZag
+*
+* Parameters:
+*     outBuf                output buffer
+*       coeffStart      coefficient number from where the coding to be started
+*       block           pointer to the texture block data. Coeficients must be in zigzag order
+*       svh             flag indicating whether short video header mode is ON
+*       lastPos         value of last non-zero position of block
+*
+* Function:
+*     This function puts AC coefficients in SVH mode with zigzag into the bitstream
+*
+* Returns:
+*     number of bits outputted.
+*
+* Error codes:
+*     None.
+*
+*/
+int32 vlbCodeACCoeffsSVHWithZigZag(int32 coeffStart, int16* block, bibBuffer_t * outBuf,
+                                                                 int32 svh, int32 lastPos)
+                                                                 
+{
+    tEvent      prevEvent;
+    tEvent      currEvent;
+    int32       i;
+    int32       numBits;
+    tEvent      *prev ;
+    tEvent      *curr ;
+    int32       level;
+    int32       lastPosition = vlbInvZigzagScan[lastPos];
+    
+    prev = &prevEvent;
+    curr = &currEvent;
+    curr->run  = 0;
+    prev->last = 0;
+    numBits = 0;
+    
+    for(i = coeffStart; i <= lastPosition; i++)
+    {
+        level = block[vlbZigzagScan[i]]; 
+        if(level == 0)
+        {
+            curr->run++;
+        }
+        else
+        {
+            prev->level = level;
+            prev->run = curr->run;
+            curr->run  = 0;
+            break;
+        }
+    }
+    
+    for(i = i+1; i <= lastPosition; i++)
+    {
+        level = block[vlbZigzagScan[i]]; 
+        if(level == 0)
+        {
+            curr->run++;
+        }
+        else
+        {
+            numBits  += vlbPutACVLCCoeff(outBuf, &prevEvent,svh);
+            prev->level = level;
+            prev->run = curr->run;
+            curr->run = 0;
+        }
+    }
+    
+    prev->last = 1;
+    numBits  += vlbPutACVLCCoeff(outBuf, &prevEvent,svh);
+    
+    return numBits;
+}
+
+
+
+
+/* {{-output"vlbPutACVLCCoeff.txt"}} */
+/*
+* vlbPutACVLCCoeff
+*
+* Parameters:
+*     outBuf                output buffer
+*       event           pointer to the event being coded
+*       svh             flag indicating whether short video header mode is ON
+*
+* Function:
+*     This function encodes AC coefficients for Inter and Intra blocks in SVH mode and 
+*     inter blocks in non-SVH mode
+*
+* Returns:
+*     number of bits outputted.
+*
+* Error codes:
+*     None.
+*
+*/
+int32 vlbPutACVLCCoeff(bibBuffer_t *outBuf, tEvent *event, int32 svh)
+{
+    int32       sign;
+    int32       run;
+    int32       level;
+    int32       status;
+    int32       count;
+    const tVLCTable   *vlcTable= NULL;
+    int32       lmax;
+    int32       rmax;
+    
+    sign  = (event->level >> 15) & (0x1);
+    level = ABS(event->level);
+    run   = event->run;
+    count = 0;
+    
+    do
+    {
+        status = CODE_FOUND;
+        if(event->last == 0)
+        {
+            if(level < vlbVLCRun0InterAC[run] )
+            {
+                vlcTable = vlbVLCTablePointer0[run];
+            }           
+            else 
+            {
+                status = CODE_NOT_FOUND;
+            }
+        }
+        else
+        {
+            if(level < vlbVLCRun1InterAC[run] )
+            {
+                vlcTable = vlbVLCTablePointer1[run];
+            }           
+            else 
+            {
+                status = CODE_NOT_FOUND;
+            }
+        }
+        
+        if (status == CODE_NOT_FOUND)
+        {
+            if (svh == ON)
+            {
+                count  = 4;
+                status = CODE_FOUND;
+            }
+            else
+            {
+                switch (++count)
+                {
+                case 1:
+                    {
+                        lmax = vlbFindLMax(event, INTER);
+                        if (lmax == NOT_VALID)
+                        {
+                            count = 2;
+                        }
+                        else
+                        {
+                            level = ABS(event->level) - lmax;
+                            break;
+                        }
+                    }
+                case 2:
+                    {
+                        rmax = vlbFindRMax(event, INTER);
+                        if (rmax != NOT_VALID)
+                        {
+                            level = ABS(event->level);
+                            run   = event->run - rmax;
+                            break;
+                        }
+                        else
+                        {
+                            count = 3;
+                        }
+                    }
+                case 3:
+                    {
+                        status = CODE_FOUND;
+                        break;
+                    }
+                default:
+                    {
+                        return E_FAILURE;
+                    }
+                }
+            }
+        }
+        
+    } while (status != CODE_FOUND);
+    
+    switch (count)
+    {
+    case 0:
+        {
+            vlbPutBits(outBuf, vlcTable[level].length, vlcTable[level].code | sign);
+            return vlcTable[level].length;
+        }
+    case 1:
+        {
+            vlbPutBits(outBuf, ESCAPE_CODE_LENGTH_VLC, ESCAPE_CODE_VLC);
+            vlbPutBits(outBuf, 1, 0);
+            vlbPutBits(outBuf, vlcTable[level].length, vlcTable[level].code | sign);
+            return vlcTable[level].length + 1 + ESCAPE_CODE_LENGTH_VLC;
+        }
+    case 2:
+        {
+            vlbPutBits(outBuf, ESCAPE_CODE_LENGTH_VLC, ESCAPE_CODE_VLC);
+            vlbPutBits(outBuf, 2, 0x2);
+            vlbPutBits(outBuf, vlcTable[level].length, vlcTable[level].code | sign);
+            return vlcTable[level].length + 2 + ESCAPE_CODE_LENGTH_VLC;
+        }
+    case 3:
+        {
+            vlbPutBits(outBuf, ESCAPE_CODE_LENGTH_VLC, ESCAPE_CODE_VLC);
+            vlbPutBits(outBuf, 2, 0x3);
+            /* Fixed Length Coding of Events */
+            vlbPutBits(outBuf, 8, (event->last << 7) | (event->run << 1) | 1);
+            vlbPutBits(outBuf, 13, ((event->level & 0x0fff) << 1) | 1);
+            return 23 + ESCAPE_CODE_LENGTH_VLC;
+        }
+    case 4:
+        {
+            vlbPutBits(outBuf, ESCAPE_CODE_LENGTH_VLC, ESCAPE_CODE_VLC);
+            vlbPutBits(outBuf, 7, (event->last << 6) | event->run);
+            vlbPutBits(outBuf, 8, event->level & 0x0ff);
+            return 15 + ESCAPE_CODE_LENGTH_VLC;
+        }
+    default:
+        {
+            return E_FAILURE;
+        }
+    }
+}
+
+/* End of vlb.cpp */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/AACConstants.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef AACCONSTANTS_H
+#define AACCONSTANTS_H
+
+
+// length of a silent mono AAC frame
+const TInt KSilentMonoAACFrameLenght = 6;
+
+// silent mono AAC frame
+const TUint8 KSilentMonoAACFrame[KSilentMonoAACFrameLenght] =
+    {
+    0,
+    0,
+    0,
+    128,
+    35,
+    222
+    };
+
+// length of a silent stereo AAC frame
+const TInt KSilentStereoAACFrameLenght = 8;
+
+// silent stereo AAC frame
+const TUint8 KSilentStereoAACFrame[KSilentStereoAACFrameLenght] =
+    {
+    33,
+    0,
+    64,
+    0,
+    4,
+    0,
+    0,
+    71
+    };
+
+
+// a class to encapsule info needed by AAC frame handler
+class TAACFrameHandlerInfo
+    {
+
+public:
+
+    TUint8    iNumChannels; 
+    TUint8    iNumCouplingChannels;
+    TUint8    iSampleRateID;
+    TUint8    iProfileID;
+    TUint8    iIs960;
+    TUint8  isSBR;
+    TUint8    iIsParametricStereo;
+    };
+
+
+// AAC specific constants
+enum
+{
+  SCE_ELEMENT = 0,
+  CPE_ELEMENT = 1,
+  LFE_ELEMENT = 3,
+
+  LC_OBJECT   = 1,
+ 
+  LTP_OBJECT  = 3,
+
+
+
+  AAC_ADIF    = 0,
+
+
+  AAC_ADTS    = 1,
+
+  AAC_MP4     = 2,
+
+  TNS_TOOL    = 1,
+ 
+  LTP_TOOL    = 2,
+
+  PNS_TOOL    = 4,
+
+  MS_TOOL     = 8,
+  IS_TOOL     = 16,
+
+  SBR_TOOL    = 32,
+
+  LAST_TOOL   = 32768
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/aac_tool.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  aac_tool.h - Interface to AAC tools.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2000-2004 by Nokia Research Center, Audio-Visual Systems.
+  *************************************************************************/
+
+#ifndef    AAC_TOOLS_H_
+#define AAC_TOOLS_H_
+
+/*-- Project Headers. --*/
+#include "defines.h"
+#include "nok_bits.h"
+#include "chandefs.h"
+
+#endif    /*-- AAC_TOOLS_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/aacaud.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  aacaud.h - Interface to AAC decoder.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2001-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef    AACAUD_H_
+#define AACAUD_H_
+
+/*-- Project Headers. --*/
+#include "tool.h"
+#include "AACAPI.h"
+
+#endif    /*-- AACAUD_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/aacdef.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  aacdef.h - Interface to AAC core structures.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2000-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef AACDEF_H_
+#define AACDEF_H_
+
+/*-- Project Headers. --*/
+#include "chandefs.h"
+#include "defines.h"
+#include "dec_huf.h"
+
+/*
+   Purpose:     Structure interface for window parameters.
+   Explanation: - */
+class CWindowInfo : public CBase
+{
+public:
+
+    static CWindowInfo* NewL();
+    ~CWindowInfo();
+    uint8 wnd;
+    uint8 max_sfb;
+    uint8 hasmask;
+    uint8 predBands;
+    PredType predType;
+    int16 prstflag[2];
+    Wnd_Shape wshape[2];
+    uint8* group;//[NSHORT];
+    uint8* mask;//[MAXBANDS];
+    int16* sfac;//[MAXBANDS];
+    uint8* cb_map;//[MAXBANDS];
+    int16* lpflag;//[MAXBANDS];
+
+private:
+
+    void ConstructL();
+    CWindowInfo();
+
+};
+
+/*
+   Purpose:     Information about the audio channel.
+   Explanation: - */
+class TCh_Info
+{
+public:
+
+    int16 present;         /* Channel present.                              */
+    int16 num_bins;        /* # of active (i.e., nonzero) bins for this ch. */
+    int16 tag;             /* Element tag.                                  */
+    int16 cpe;             /* 0 if single channel, 1 if channel pair.       */
+    int16 paired_ch;       /* Index of paired channel in cpe.               */
+    int16 widx;            /* Window element index for this channel.        */
+    
+    BOOL is_present;       /* Intensity stereo is used.                     */
+    BOOL pns_present;      /* PNS is used.                                  */
+    BOOL tns_present;      /* TNS is used.                                  */
+    BOOL parseCh;          /* TRUE if channel only parsed not decoded.      */
+    
+    int16 ncch;            /* Number of coupling channels for this ch.      */
+    int16 cch[CChansD];    /* Coupling channel idx.                         */
+    int16 cc_dom[CChansD]; /* Coupling channel domain.                      */
+    int16 cc_ind[CChansD]; /* Independently switched coupling channel flag. */
+    CInfo *info;            /* Block parameters for this channel.            */
+    
+    /*-- Huffman tables. --*/
+    Huffman_DecInfo **huf;
+    Huffman_DecSfInfo *sf_huf;
+    
+};
+
+
+/*
+   Purpose:     Channel mapping information.
+   Explanation: - */
+class CMC_Info : public CBase
+{
+public:
+
+    static CMC_Info* NewL();
+    ~CMC_Info();
+    /*
+    * Max number of supported main and coulping channels.
+    */
+    int16 maxnCh;
+    int16 maxnCCh;
+
+    /*
+    * Audio channels (LFE, SCE, and CPE) up to 'maxnCh' will be decoded.
+    * All the other channels will be only parsed. 'dummyCh' is therefore
+    * the channel index into 'ch_info' structure which is used for the unused
+    * audio channels. 'dummyCCh' identifies the channel index for unused CCE
+    * channels.
+    */
+    int16 dummyCh;
+    int16 dummyCCh;
+    
+    /*
+    * This will be set to 1 when the channel limit has been reached.
+    */
+    int16 dummyAlways;
+    
+    /*
+    * These members identify how many audio channels (LFE, SCE, CPE, CCE)
+    * were found from the bitstream on a frame-by-frame basis.
+    */
+    int16 nch;
+    int16 ncch;
+
+    int16 cc_tag[1 << LEN_TAG]; /* Tags of valid CCE's.                           */
+    int16 cc_ind[1 << LEN_TAG]; /* Independently switched CCE's.                  */
+    uint8 profile;
+    uint8 sfreq_idx;
+    
+    int16 cur_prog;
+    int16 default_config;
+    
+    CSfb_Info* sfbInfo;
+    
+    TCh_Info ch_info[ChansD];
+
+private:
+
+    void ConstructL();
+    CMC_Info();
+
+
+};
+
+/*
+   Purpose:     Pulse noiseless coding.
+   Explanation: - */
+typedef struct PulseInfoStr
+{
+  int16 number_pulse;
+  int16 pulse_start_sfb;
+  int16 pulse_data_present;
+  int16 pulse_amp[NUM_PULSE_LINES];
+  int16 pulse_offset[NUM_PULSE_LINES];
+  int16 pulse_position[NUM_PULSE_LINES];
+
+} PulseInfo;
+
+#endif /*-- AACDEF_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/chandefs.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,410 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  chandefs.h - Constants for AAC coder.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Audio-Visual Systems.
+  *************************************************************************/
+
+#ifndef AAC_CHANDEFS_H_
+#define AAC_CHANDEFS_H_
+
+/*-- Project Headers. --*/
+#include "defines.h"
+
+#define GAIN_START                  (40)
+#define MAGIC_NUMBER                (0.4054)
+#define MAGIC_NUMBER2               (1.0f - MAGIC_NUMBER)
+#define MAGIC_NUMBER3               (0.5f * MAGIC_NUMBER)
+#define QSTEP_SIZE                  (7)
+#define GAIN_FACTOR                 (1.0f / -0.25f)
+#define IMAX_QUANT                  (1.0f / MAX_AAC_QUANT)
+#define POWRAISE43                  (4.0f / 3.0f)
+#define ILOG2                       (1.0f / log10(2.0f))
+#define LOG34                       (log10(0.75f) * ILOG2)
+#define SFCGAIN                     (16.0f / 3.0f)
+#define QROUND_ERROR LOG2           (5.5f)
+#define MAXCOEF_LOG2_16_3_MINUS_TWO (67.33239402f)
+#define ILOG2_16_3                  (17.71694984f)
+#define LOG2(x)                     (log10(x) * ILOG2)
+
+enum
+{
+  /*
+   * Channels for 5.1 main profile configuration 
+   * (modify for any desired decoder configuration)
+   */
+
+  /*-- Front channels: left, center, right --*/
+  FChansD                = 2,
+
+  /*-- 1 if decoder has front center channel. --*/
+  FCenterD               = 0,
+
+  /*-- Side channels: --*/
+  SChansD                = 0,
+
+  /*-- Back channels: left surround, right surround. --*/
+  BChansD                = 0,
+
+  /*-- 1 if decoder has back center channel. --*/
+  BCenterD               = 0,
+
+  /*-- LFE channels. --*/
+  LChansD                = 0,
+
+  /*-- Scratch space for parsing unused channels. --*/
+  XChansD                = 2,
+  
+  /*-- Total number of supported channels. --*/
+  ChansD                 = FChansD + SChansD + BChansD + LChansD + XChansD,
+
+  /*-- Independently switched coupling channels. --*/
+  ICChansD               = 0,
+
+  /*-- Dependently switched coupling channels. --*/
+  DCChansD               = 0,
+
+  /*-- Scratch space index for parsing unused coupling channels. --*/
+  XCChansD               = 1,
+
+  /*-- Total number of supported CC channels. --*/
+  CChansD                = (ICChansD + DCChansD + XCChansD),
+
+
+  /*-- Block switching. --*/
+  LN                     = 2048,
+  SN                     = 256,
+  LN2_960                = 960,
+  SN2_120                = 120,
+  LN2                    = LN / 2,
+  SN2                    = SN / 2,
+  NSHORT                 = LN / SN,
+  MAX_SBK                = NSHORT,
+  NUM_WIN_SEQ            = 4,
+
+  /*-- Max number of scale factor bands. --*/
+  MAXBANDS               = 16 * NSHORT,
+  MAXLONGSFBBANDS        = 51,
+  MAXSHORTSFBBANDS       = 15,
+
+  /*-- Maximum scale factor. --*/
+  SFACBOOK_SIZE          = 121,
+  MIDFAC                 = (SFACBOOK_SIZE - 1) / 2,
+  
+  /*-- Global gain must be positive. --*/
+  SF_OFFSET              = 100,
+  /*-- Quantization constants. --*/
+  MAX_QUANT_VALUE        = 8191,
+  
+  /*-- Huffman parameters. --*/
+  ZERO_HCB               = 0,
+  ESCBOOK                = 11,
+  NSPECBOOKS             = ESCBOOK + 1,
+  BOOKSCL                = NSPECBOOKS,
+  NBOOKS                 = NSPECBOOKS + 1,
+  INTENSITY_HCB2         = 14,
+  INTENSITY_HCB          = 15,
+  NOISE_HCB              = 13,
+  NOISE_PCM_BITS         = 9,
+  NOISE_PCM_OFFSET       = (1 << (NOISE_PCM_BITS - 1)),
+  NOISE_OFFSET           = 90,
+  RESERVED_HCB           = 13,
+  SF_INDEX_OFFSET        = 60, /*-- Offset for Huffman table indices of scalefactors. --*/
+  
+  LONG_SECT_BITS         = 5, 
+  SHORT_SECT_BITS        = 3, 
+  
+  /*-- Program Configuration. --*/
+  Main_Object            = 0, 
+  LC_Object              = 1, 
+  SSR_Object             = 2,
+  LTP_Object             = 3,
+  Scalable_Object        = 4,
+  
+  Fs_48                  = 3,
+  Fs_44                  = 4, 
+  Fs_32                  = 5, 
+ 
+  /*-- Raw bitstream constants. --*/
+  LEN_SE_ID              = 3,
+  LEN_TAG                = 4,
+  LEN_COM_WIN            = 1,
+  LEN_ICS_RESERV         = 1, 
+  LEN_WIN_SEQ            = 2,
+  LEN_WIN_SH             = 1,
+  LEN_MAX_SFBL           = 6, 
+  LEN_MAX_SFBS           = 4, 
+  LEN_CB                 = 4,
+  LEN_SCL_PCM            = 8,
+  LEN_SCL_PCM_MASK       = (1 << LEN_SCL_PCM) - 1,
+  LEN_PRED_PRES          = 1,
+  LEN_PRED_RST           = 1,
+  LEN_PRED_RSTGRP        = 5,
+  LEN_PRED_ENAB          = 1,
+  LEN_MASK_PRES          = 2,
+  LEN_MASK               = 1,
+  
+  LEN_PULSE_NPULSE       = 2, 
+  LEN_PULSE_ST_SFB       = 6, 
+  LEN_PULSE_POFF         = 5, 
+  LEN_PULSE_PAMP         = 4, 
+  NUM_PULSE_LINES        = 4, 
+  PULSE_OFFSET_AMP       = 4, 
+  
+  LEN_IND_CCE_FLG        = 1,  
+  LEN_NCC                = 3,
+  LEN_IS_CPE             = 1, 
+  LEN_CC_LR              = 1,
+  LEN_CC_DOM             = 1,
+  LEN_CC_SGN             = 1,
+  LEN_CCH_GES            = 2,
+  LEN_CCH_CGP            = 1,
+  
+  LEN_D_ALIGN            = 1,
+  LEN_D_CNT              = 8,
+  LEN_D_ESC              = 8,
+  LEN_F_CNT              = 4,
+  LEN_F_ESC              = 8,
+  LEN_NIBBLE             = 4,
+  LEN_BYTE               = 8,
+  LEN_PAD_DATA           = 8,
+  
+  LEN_PC_COMM            = 8, 
+  
+  /*-- FILL --*/
+  LEN_EX_TYPE            = 4,
+  EX_FILL                = 0, 
+  EX_FILL_DATA           = 1, 
+  EX_DRC                 = 11, 
+  
+  /*-- DRC --*/
+  LEN_DRC_PL             = 7, 
+  LEN_DRC_PL_RESV        = 1, 
+  LEN_DRC_PCE_RESV       = (8 - LEN_TAG),
+  LEN_DRC_BAND_INCR      = 4, 
+  LEN_DRC_BAND_RESV      = 4, 
+  LEN_DRC_BAND_TOP       = 8, 
+  LEN_DRC_SGN            = 1, 
+  LEN_DRC_MAG            = 7, 
+  DRC_BAND_MULT          = 4,
+
+  /*-- Channel elements. --*/
+  ID_SCE                 = 0,
+  ID_CPE,
+  ID_CCE,
+  ID_LFE,
+  ID_DSE,
+  ID_PCE,
+  ID_FIL,
+  ID_END,
+
+  FILL_VALUE             = 0x55,
+
+  /*-- Bit reservoir. --*/
+  BIT_RESERVOIR_SIZE     = 6144,
+  
+  /*-- Program configuration element --*/
+  LEN_PROFILE            = 2, 
+  LEN_SAMP_IDX           = 4, 
+  LEN_NUM_ELE            = 4, 
+  LEN_NUM_LFE            = 2, 
+  LEN_NUM_DAT            = 3, 
+  LEN_NUM_CCE            = 4, 
+  LEN_MMIX_IDX           = 2, 
+  LEN_PSUR_ENAB          = 1, 
+  LEN_ELE_IS_CPE         = 1,
+  LEN_IND_SW_CCE         = 1,  
+  LEN_COMMENT_BYTES      = 8,
+
+  /*-- LTP constants. --*/
+  LTP_MAX_PRED_BANDS     = 40,
+  LTP_COEF_BITS          = 3,
+  LTP_LAG_BITS           = 11,
+
+  /*-- TNS constants. --*/
+  TNS_MAX_FILT           = 3,
+  TNS_MAX_COEFF_RES      = 2,
+  TNS_MAX_COEFF          = 32,
+
+  TNS_MAX_ORDER          = 12,
+  TNS_COEFF_RES_OFFSET   = 3,
+
+  /*-- BWP constants. --*/
+  MAX_PGRAD              = 2,
+  MINVAR                 = 1,
+  Q_ZERO                 = 0x0000,
+  Q_ONE                  = 0x3F80,
+
+  /*-- PNS parameters. --*/
+  MAX_DCT_LEN            = 64,
+  NOISE_FREE_BANDS       = 3,
+  NOISE_FREE_MASK        = (1 << NOISE_FREE_BANDS) - 1,
+  /*-- Max length of DSE, bytes. --*/
+  MAX_DBYTES             = ((1 << LEN_D_CNT) + (1 << LEN_D_ESC)),
+  
+  /*-- size of exp cache table. --*/
+  TEXP                   = 256,
+  TEXP_MASK              = (TEXP - 1),
+
+  /*-- Size of inv quant table. --*/
+  MAX_AAC_QUANT          = 255,
+  MAX_IQ_TBL             = MAX_AAC_QUANT + 1,
+  IQ_MASK                = (MAX_IQ_TBL - 1)
+};
+
+/*
+   Purpose:     Mixing modes for CCE (coupling channel element).
+   Explanation: - */
+typedef enum CCmixMode
+{
+  CC_BEFORE_TNS, /* Dependently switched.   */
+  CC_AFTER_TNS,  /* Dependently switched.   */
+  CC_TIME_MIX    /* Independently switched. */
+
+} CCmixMode;
+
+/*
+   Purpose:     Window shapes.
+   Explanation: - */
+typedef enum WindowShape
+{
+  WS_SIN = 0, /* Sine window.                  */
+  WS_KBD      /* Kaiser-Bessel Derived window. */
+  
+} WindowShape;
+
+/*
+   Purpose:     AAC predictor type.
+   Explanation: - */
+typedef enum PredType
+{
+  NO_PRED = 0,
+  BWAP_PRED,
+  LTP_PRED
+
+} PredType;
+
+/*
+   Purpose:     Block types for transform coders using block switching. 
+   Explanation: The first four describe the actual block type for each subband,
+                the rest of the declarations describe the block type for the
+                whole frame. */
+typedef enum AAC_WINDOW_TYPE
+{
+  ONLY_LONG_WND,
+  LONG_SHORT_WND,
+  ONLY_SHORT_WND,
+  SHORT_LONG_WND
+
+} AAC_WINDOW_TYPE, AacWindowType;
+
+/*
+   Purpose:     Block sequence (long and short) parameters.
+   Explanation: - */
+class CInfo : public CBase
+    {
+
+public:
+
+    static CInfo* NewL();
+    ~CInfo();
+
+    int16 islong;
+    int16 nsbk;
+    int16 bins_per_bk;
+    int16 sfb_per_bk;
+    int16* bins_per_sbk;
+    int16* sfb_per_sbk;
+    const int16 *sbk_sfb_top[MAX_SBK];
+    int16 *sfb_width_128;
+    int16* bk_sfb_top;
+    int16 num_groups;
+    int16* group_len;
+    int16* group_offs;
+  
+private:
+    void ConstructL();
+    CInfo();
+
+};
+
+/*
+   Purpose:     Sampling rate dependent parameters.
+   Explanation: - */
+typedef struct Sr_InfoStr
+{
+  int32 samp_rate;
+
+  int16 nsfb1024;
+  const int16 *SFbands1024;
+
+  int16 nsfb128;
+  const int16 *SFbands128;
+
+  int16 nsfb960;
+  const int16 *SFbands960;
+
+  int16 nsfb120;
+  const int16 *SFbands120;
+  
+} SR_Info;
+
+/*
+   Purpose:     Sfb related information.
+   Explanation: - */
+class CSfb_Info : public CBase
+{  
+
+public:
+
+    static CSfb_Info* NewL(uint8 isEncoder = FALSE);
+    ~CSfb_Info();
+
+    CInfo *only_long_info;
+    CInfo *eight_short_info;
+    
+    CInfo *winmap[NUM_WIN_SEQ];
+    int16 sfbwidth128[1 << LEN_MAX_SFBS];
+    
+    /*-- Scalefactor offsets. --*/
+    int16 *sect_sfb_offsetL;
+    int16 *sect_sfb_offsetS;
+    int16 *sfbOffsetTablePtr[2];
+    int16 *sect_sfb_offsetS2[NSHORT];
+
+private:
+    void ConstructL(uint8 isEncoder);
+    CSfb_Info();
+
+};
+
+/*
+   Purpose:     Window shapes for this and previous frame.
+   Explanation: - */
+typedef struct Wnd_ShapeStr
+{
+  uint8 this_bk;
+  uint8 prev_bk;
+  
+} Wnd_Shape;
+
+#endif /*-- AAC_CHANDEFS_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/dec_const.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,375 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef DEC_CONST_H
+#define DEC_CONST_H
+
+
+#include "dec_huf.h"
+#include "defines.h"
+
+const int16 cb_len[] = {81, 81, 81, 81, 81, 81, 64, 64, 169, 169, 289, 121};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #1.
+   Explanation:  - */
+const Huffman_DecCode dec_hftable1[] = {
+{1, 0}, {6148, 17}, {1536, 23}, {384, 21}, {96, 18}, 
+{32, 20}, {128, 22}, {512, 19}, {2048, 16}, {7682, 104}, 
+{6528, 114}, {6240, 116}, {6176, 118}, {6272, 108}, {6656, 97}, 
+{1920, 105}, {1632, 119}, {1568, 111}, {1664, 100}, {480, 103}, 
+{416, 98}, {224, 101}, {160, 109}, {896, 99}, {608, 107}, 
+{544, 113}, {640, 112}, {3584, 96}, {2432, 106}, {2144, 117}, 
+{2080, 115}, {2176, 110}, {2560, 102}, {8066, 497}, {7808, 492}, 
+{6368, 491}, {7040, 481}, {6752, 496}, {6688, 502}, {6784, 490}, 
+{2016, 498}, {1952, 493}, {1760, 486}, {1696, 485}, {992, 489}, 
+{928, 484}, {736, 483}, {672, 499}, {3968, 487}, {3680, 495}, 
+{3616, 494}, {3712, 482}, {2464, 488}, {2272, 500}, {2944, 480}, 
+{2592, 501}, {2688, 503}, {7777, 1013}, {7712, 1008}, {6624, 1009}, 
+{6560, 1012}, {6304, 1014}, {2528, 1011}, {2208, 1015}, {2656, 1010}, 
+{8161, 2040}, {8096, 2045}, {7904, 2039}, {7840, 2037}, {7136, 2044}, 
+{7072, 2033}, {6880, 2034}, {6816, 2043}, {4064, 2046}, {4000, 2035}, 
+{3808, 2032}, {3744, 2042}, {3040, 2038}, {2976, 2041}, {2784, 2047}, 
+{2720, 2036}};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #2.
+   Explanation:  - */
+const Huffman_DecCode dec_hftable2[] = {
+{3, 0}, {2049, 2}, {6145, 6}, {1536, 10}, {384, 8}, 
+{96, 9}, {32, 7}, {128, 11}, {512, 12}, {7681, 35}, 
+{6528, 45}, {6240, 32}, {6176, 43}, {6272, 40}, {6656, 27}, 
+{1920, 42}, {1632, 44}, {1568, 39}, {1664, 26}, {480, 36}, 
+{416, 31}, {224, 29}, {160, 48}, {896, 28}, {608, 30}, 
+{544, 41}, {640, 47}, {3584, 33}, {2432, 34}, {2144, 49}, 
+{2080, 38}, {2176, 37}, {2560, 46}, {8065, 111}, {6560, 112}, 
+{6368, 110}, {7040, 102}, {6784, 107}, {1952, 108}, {1760, 103}, 
+{928, 100}, {3968, 113}, {3712, 104}, {2464, 101}, {2208, 106}, 
+{2944, 114}, {2656, 105}, {2688, 109}, {7777, 235}, {7712, 234}, 
+{7808, 232}, {6624, 242}, {6304, 233}, {7072, 248}, {6752, 231}, 
+{6688, 241}, {2016, 236}, {1696, 245}, {992, 239}, {736, 243}, 
+{672, 240}, {3680, 244}, {3616, 230}, {3808, 247}, {2528, 238}, 
+{2272, 237}, {2592, 246}, {8161, 499}, {8096, 509}, {7904, 503}, 
+{7840, 506}, {7136, 505}, {6880, 500}, {6816, 501}, {4064, 508}, 
+{4000, 498}, {3744, 504}, {3040, 507}, {2976, 510}, {2784, 511}, 
+{2720, 502}};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #3.
+   Explanation:  - */
+const Huffman_DecCode dec_hftable3[] = {
+{1, 0}, {35, 9}, {128, 11}, {512, 10}, {2048, 8}, 
+{161, 25}, {2560, 24}, {545, 53}, {640, 52}, {672, 55}, 
+{2080, 56}, {2176, 54}, {2688, 57}, {2209, 117}, {2592, 118}, 
+{2720, 116}, {65, 239}, {192, 240}, {3200, 242}, {4096, 238}, 
+{4608, 241}, {257, 491}, {288, 486}, {576, 495}, {704, 489}, 
+{768, 493}, {800, 487}, {1024, 494}, {1152, 492}, {1184, 498}, 
+{2816, 499}, {2848, 500}, {3072, 488}, {3232, 497}, {4224, 496}, 
+{4736, 490}, {321, 1010}, {832, 1011}, {1056, 1005}, {1312, 1016}, 
+{2112, 1014}, {2240, 1009}, {2304, 1003}, {2336, 1004}, {2752, 1007}, 
+{3104, 1002}, {3328, 1013}, {4128, 1015}, {4640, 1008}, {4768, 1006}, 
+{5248, 1012}, {1217, 2041}, {1280, 2040}, {2624, 2036}, {2880, 2038}, 
+{3360, 2035}, {4256, 2037}, {5120, 2034}, {5280, 2039}, {1345, 4088}, 
+{2368, 4084}, {3264, 4091}, {3392, 4092}, {4864, 4086}, {4896, 4090}, 
+{5152, 4085}, {5376, 4087}, {5408, 4089}, {1089, 8186}, {3136, 8188}, 
+{4352, 8187}, {4385, 16378}, {4672, 16380}, {4800, 16379}, {4161, 32766}, 
+{4288, 32765}, {4928, 32764}, {5312, 32763}, {5440, 32762}, {4417, 65535}, 
+{5184, 65534}};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #4.
+   Explanation:  - */
+const Huffman_DecCode dec_hftable4[] = {
+{4, 7}, {160, 8}, {672, 1}, {2048, 5}, {2176, 9}, 
+{2208, 4}, {2560, 6}, {2592, 2}, {2688, 3}, {2720, 0}, 
+{33, 22}, {128, 24}, {512, 25}, {544, 23}, {640, 21}, 
+{2080, 20}, {802, 112}, {2752, 107}, {2848, 105}, {3200, 110}, 
+{3232, 106}, {4256, 111}, {4640, 109}, {4736, 108}, {4768, 104}, 
+{65, 246}, {192, 239}, {288, 243}, {576, 237}, {704, 226}, 
+{768, 240}, {1056, 241}, {1152, 238}, {1184, 228}, {2112, 242}, 
+{2240, 229}, {2304, 244}, {2336, 232}, {2624, 231}, {2816, 227}, 
+{3072, 235}, {3104, 230}, {4096, 245}, {4128, 236}, {4224, 234}, 
+{4608, 233}, {257, 495}, {1024, 494}, {2880, 499}, {3264, 500}, 
+{3360, 496}, {4800, 501}, {4896, 498}, {5280, 497}, {833, 1008}, 
+{1216, 1010}, {1312, 1007}, {2368, 1012}, {3136, 1014}, {3328, 1004}, 
+{3392, 1017}, {4288, 1015}, {4384, 1011}, {4672, 1016}, {4864, 1006}, 
+{5152, 1009}, {5248, 1005}, {5408, 1013}, {321, 2040}, {1088, 2042}, 
+{1280, 2038}, {1344, 2045}, {4160, 2043}, {4352, 2041}, {4928, 2036}, 
+{5120, 2039}, {5312, 2037}, {5376, 2046}, {5440, 2044}, {4417, 4095}, 
+{5184, 4094}};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #5.
+   Explanation:  - */
+const Huffman_DecCode dec_hftable5[] = {
+{1, 0}, {4611, 8}, {288, 11}, {32, 10}, {512, 9}, 
+{4897, 26}, {4640, 25}, {800, 24}, {544, 27}, {5122, 112}, 
+{320, 115}, {64, 113}, {1024, 114}, {5633, 240}, {5408, 232}, 
+{5152, 236}, {4928, 234}, {4672, 238}, {352, 242}, {96, 243}, 
+{832, 239}, {576, 235}, {1312, 237}, {1056, 233}, {1536, 241}, 
+{5921, 488}, {5664, 492}, {5440, 498}, {5184, 496}, {4960, 491}, 
+{4704, 495}, {864, 494}, {608, 489}, {1344, 499}, {1088, 497}, 
+{1824, 493}, {1568, 490}, {6145, 1009}, {5952, 1000}, {5696, 1006}, 
+{5472, 1007}, {5216, 1002}, {384, 1008}, {1376, 1003}, {1120, 1005}, 
+{1856, 1001}, {1600, 1004}, {2048, 1011}, {2080, 1010}, {6465, 2036}, 
+{6432, 2024}, {6176, 2030}, {6208, 2041}, {5984, 2033}, {5728, 2034}, 
+{5248, 2035}, {4992, 2027}, {4736, 2029}, {128, 2025}, {896, 2031}, 
+{640, 2028}, {1408, 2038}, {1152, 2039}, {1888, 2032}, {1632, 2040}, 
+{2336, 2026}, {2112, 2037}, {6497, 4087}, {6240, 4088}, {6016, 4093}, 
+{5760, 4090}, {5504, 4084}, {1920, 4086}, {1664, 4089}, {2400, 4092}, 
+{2368, 4085}, {2144, 4091}, {6529, 8191}, {6272, 8189}, {2432, 8188}, 
+{2176, 8190}};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #6.
+   Explanation:  - */
+const Huffman_DecCode dec_hftable6[] = {
+{4900, 8}, {4608, 4}, {4640, 6}, {288, 2}, {0, 0}, 
+{32, 3}, {800, 7}, {512, 1}, {544, 5}, {5442, 50}, 
+{5408, 39}, {5120, 40}, {5152, 38}, {5184, 49}, {4928, 46}, 
+{4672, 41}, {320, 45}, {64, 47}, {832, 43}, {576, 44}, 
+{1344, 48}, {1312, 36}, {1024, 42}, {1056, 37}, {1088, 51}, 
+{5921, 108}, {5632, 113}, {5664, 104}, {4960, 111}, {4704, 107}, 
+{352, 114}, {96, 115}, {864, 110}, {608, 109}, {1824, 106}, 
+{1536, 112}, {1568, 105}, {1600, 116}, {5953, 234}, {5696, 240}, 
+{5472, 239}, {5216, 235}, {1376, 238}, {1120, 236}, {1856, 237}, 
+{1632, 241}, {6465, 497}, {6432, 491}, {6144, 500}, {6176, 490}, 
+{6208, 496}, {5984, 485}, {5728, 486}, {5504, 499}, {5248, 503}, 
+{4992, 488}, {4736, 494}, {384, 495}, {128, 506}, {896, 487}, 
+{640, 492}, {1408, 505}, {1152, 498}, {1888, 484}, {2368, 502}, 
+{2336, 493}, {2048, 504}, {2080, 489}, {2112, 501}, {6497, 1021}, 
+{6240, 1020}, {6016, 1014}, {5760, 1015}, {1920, 1016}, {1664, 1018}, 
+{2400, 1017}, {2144, 1019}, {6529, 2046}, {6272, 2045}, {2432, 2047}, 
+{2176, 2044}};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #7.
+   Explanation:  - */
+const Huffman_DecCode dec_hftable7[] = {
+{1, 0}, {34, 5}, {1024, 4}, {1057, 12}, {66, 55}, 
+{1088, 53}, {2048, 54}, {2080, 52}, {97, 116}, {1120, 113}, 
+{2112, 114}, {3072, 115}, {3104, 112}, {129, 242}, {1152, 236}, 
+{1184, 238}, {2144, 234}, {2176, 241}, {3136, 235}, {3168, 240}, 
+{4096, 243}, {4128, 237}, {5152, 239}, {161, 491}, {1216, 494}, 
+{1248, 501}, {2208, 489}, {2240, 499}, {3200, 497}, {3232, 496}, 
+{4160, 488}, {4192, 495}, {5120, 493}, {5184, 490}, {5216, 498}, 
+{6176, 492}, {6208, 500}, {193, 1005}, {2272, 1013}, {3264, 1004}, 
+{3296, 1018}, {4224, 1007}, {4256, 1009}, {4288, 1017}, {5248, 1011}, 
+{5280, 1016}, {6144, 1006}, {6240, 1012}, {6272, 1015}, {7200, 1008}, 
+{7232, 1010}, {7264, 1014}, {225, 2039}, {4320, 2043}, {5312, 2041}, 
+{5344, 2044}, {6304, 2040}, {7168, 2038}, {7296, 2042}, {7328, 2045}, 
+{6337, 4093}, {6368, 4094}, {7360, 4092}, {7392, 4095}};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #8.
+   Explanation:  - */
+const Huffman_DecCode dec_hftable8[] = {
+{1059, 0}, {33, 5}, {1024, 3}, {1088, 4}, {2080, 2}, 
+{2112, 6}, {1, 14}, {64, 16}, {1120, 18}, {2048, 15}, 
+{2144, 20}, {3104, 17}, {3136, 19}, {97, 48}, {1152, 44}, 
+{2176, 46}, {3072, 47}, {3168, 42}, {3200, 50}, {4128, 43}, 
+{4160, 45}, {4192, 49}, {5184, 51}, {129, 111}, {1184, 106}, 
+{1216, 117}, {2208, 105}, {2240, 114}, {3232, 108}, {4096, 113}, 
+{4224, 109}, {4256, 112}, {5152, 104}, {5216, 107}, {5248, 110}, 
+{6176, 116}, {6208, 115}, {161, 241}, {1248, 248}, {2272, 245}, 
+{3264, 236}, {3296, 250}, {4288, 242}, {5120, 239}, {5280, 238}, 
+{5312, 249}, {6240, 237}, {6272, 240}, {6304, 246}, {7200, 243}, 
+{7232, 244}, {7264, 247}, {193, 506}, {4320, 505}, {6144, 504}, 
+{6336, 502}, {6368, 509}, {7296, 503}, {7328, 507}, {7360, 508}, 
+{225, 1022}, {5344, 1020}, {7168, 1021}, {7392, 1023}};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #9.
+   Explanation:  - */
+const Huffman_DecCode dec_hftable9[] = {
+{1, 0}, {34, 5}, {1024, 4}, {1057, 12}, {66, 55}, 
+{1088, 53}, {2048, 54}, {2080, 52}, {1121, 114}, {2112, 113}, 
+{3104, 112}, {97, 231}, {1152, 234}, {1184, 237}, {2144, 232}, 
+{2176, 236}, {3072, 230}, {3136, 233}, {4128, 235}, {129, 478}, 
+{1216, 482}, {2208, 481}, {3168, 477}, {3200, 483}, {4096, 479}, 
+{4160, 476}, {4192, 486}, {5152, 480}, {5184, 484}, {6176, 485}, 
+{161, 974}, {192, 985}, {1248, 977}, {1280, 979}, {1312, 992}, 
+{2240, 975}, {2272, 989}, {2304, 987}, {3232, 978}, {3264, 988}, 
+{4224, 981}, {4256, 990}, {5120, 976}, {5216, 982}, {6208, 983}, 
+{7200, 984}, {7232, 993}, {8224, 980}, {8256, 986}, {9248, 991}, 
+{225, 1992}, {256, 1997}, {1344, 2008}, {2336, 2000}, {3296, 1996}, 
+{3328, 1994}, {3360, 2014}, {4288, 1995}, {4320, 2013}, {4352, 2012}, 
+{5248, 1989}, {5280, 2001}, {5312, 2011}, {5376, 2016}, {6144, 1988}, 
+{6240, 1990}, {6272, 1999}, {6304, 2010}, {7168, 2003}, {7264, 2004}, 
+{7296, 2009}, {8192, 2002}, {8288, 1991}, {8320, 2007}, {8352, 2018}, 
+{9216, 2017}, {9280, 1993}, {9312, 2006}, {10272, 1998}, {10304, 2005}, 
+{11296, 2015}, {289, 4040}, {320, 4061}, {1376, 4047}, {1408, 4053}, 
+{2368, 4039}, {2400, 4052}, {2432, 4068}, {3392, 4056}, {3424, 4074}, 
+{4384, 4045}, {4416, 4066}, {4448, 4071}, {5344, 4050}, {5408, 4057}, 
+{5440, 4075}, {6336, 4043}, {6368, 4058}, {6400, 4067}, {6432, 4073}, 
+{7328, 4051}, {7360, 4062}, {8384, 4046}, {8416, 4059}, {9344, 4042}, 
+{9376, 4048}, {9408, 4069}, {9440, 4070}, {10240, 4064}, {10336, 4038}, 
+{10368, 4049}, {10400, 4065}, {11264, 4072}, {11328, 4041}, {11360, 4055}, 
+{11392, 4060}, {12320, 4044}, {12352, 4054}, {12384, 4063}, {353, 8164}, 
+{384, 8172}, {3456, 8155}, {4480, 8161}, {5472, 8163}, {5504, 8169}, 
+{6464, 8166}, {6496, 8179}, {6528, 8183}, {7392, 8157}, {7424, 8153}, 
+{7456, 8162}, {7488, 8170}, {7520, 8177}, {7552, 8182}, {8448, 8152}, 
+{8480, 8174}, {8544, 8180}, {9472, 8171}, {9504, 8175}, {10432, 8160}, 
+{10464, 8168}, {10496, 8176}, {11424, 8156}, {11456, 8159}, {11488, 8173}, 
+{11520, 8181}, {12288, 8167}, {12416, 8158}, {12448, 8154}, {12480, 8165}, 
+{12512, 8178}, {8513, 16368}, {8576, 16370}, {9536, 16371}, {9568, 16372}, 
+{9600, 16373}, {10528, 16369}, {10560, 16376}, {10592, 16374}, {11552, 16377}, 
+{11584, 16379}, {12544, 16378}, {12576, 16375}, {12608, 16380}, {12640, 16381}, 
+{10625, 32764}, {11616, 32765}, {11648, 32766}, {12672, 32767}};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #10.
+   Explanation:  - */
+const Huffman_DecCode dec_hftable10[] = {
+{1060, 0}, {1088, 1}, {2080, 2}, {33, 8}, {1024, 7}, 
+{1120, 9}, {2112, 6}, {2144, 12}, {3104, 11}, {3136, 10}, 
+{3168, 13}, {1, 34}, {64, 29}, {96, 38}, {1152, 32}, 
+{2048, 28}, {2176, 30}, {2208, 40}, {3072, 37}, {3200, 36}, 
+{4128, 33}, {4160, 31}, {4192, 35}, {4224, 39}, {5184, 41}, 
+{129, 95}, {1184, 84}, {1216, 96}, {2240, 91}, {3232, 87}, 
+{3264, 97}, {4096, 93}, {4256, 89}, {4288, 100}, {5152, 85}, 
+{5216, 86}, {5248, 88}, {5280, 98}, {6176, 94}, {6208, 90}, 
+{6240, 92}, {6272, 99}, {161, 211}, {1248, 213}, {1280, 220}, 
+{2272, 205}, {2304, 217}, {3296, 204}, {3328, 221}, {4320, 216}, 
+{4352, 223}, {5120, 209}, {5312, 206}, {5344, 224}, {5376, 226}, 
+{6304, 202}, {6336, 218}, {7200, 210}, {7232, 203}, {7264, 208}, 
+{7296, 215}, {7328, 219}, {8224, 212}, {8256, 207}, {8288, 214}, 
+{8320, 222}, {8352, 225}, {193, 463}, {1312, 468}, {2336, 462}, 
+{2368, 476}, {3360, 460}, {3392, 478}, {4384, 466}, {4416, 482}, 
+{5408, 474}, {6144, 457}, {6368, 455}, {6400, 458}, {6432, 480}, 
+{7168, 483}, {7360, 454}, {7392, 469}, {7424, 472}, {8192, 481}, 
+{8384, 464}, {8416, 470}, {9248, 461}, {9280, 456}, {9312, 459}, 
+{9344, 465}, {9376, 471}, {9408, 479}, {10272, 477}, {10304, 467}, 
+{10336, 473}, {10368, 475}, {11328, 484}, {225, 976}, {256, 983}, 
+{288, 1005}, {1344, 973}, {1376, 990}, {2400, 985}, {2432, 1009}, 
+{3424, 979}, {3456, 999}, {4448, 989}, {4480, 1006}, {5440, 980}, 
+{5472, 995}, {6464, 987}, {6496, 1000}, {7456, 970}, {7488, 986}, 
+{8448, 977}, {8480, 981}, {8512, 1010}, {9216, 1001}, {9440, 975}, 
+{9472, 992}, {9504, 1007}, {10240, 1003}, {10400, 978}, {10432, 972}, 
+{10464, 988}, {10496, 1002}, {11296, 974}, {11360, 971}, {11392, 984}, 
+{11424, 982}, {11456, 994}, {11488, 997}, {12320, 1004}, {12352, 991}, 
+{12384, 993}, {12416, 996}, {12448, 998}, {12480, 1008}, {321, 2032}, 
+{352, 2038}, {1408, 2023}, {5504, 2027}, {6528, 2028}, {7520, 2026}, 
+{7552, 2033}, {8544, 2030}, {8576, 2043}, {9536, 2022}, {9568, 2040}, 
+{10528, 2029}, {10560, 2035}, {10592, 2041}, {11264, 2034}, {11520, 2024}, 
+{11552, 2036}, {11584, 2037}, {11616, 2039}, {12288, 2042}, {12512, 2025}, 
+{12544, 2031}, {385, 4093}, {9600, 4090}, {10624, 4089}, {11648, 4091}, 
+{12576, 4088}, {12608, 4094}, {12640, 4092}, {12672, 4095}};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #11.
+   Explanation:  - */
+const Huffman_DecCode dec_hftable11[] = {
+{4, 0}, {1056, 1}, {33, 6}, {1024, 5}, {1088, 8}, 
+{2080, 7}, {2112, 9}, {16896, 4}, {65, 25}, {1120, 20}, 
+{2048, 23}, {2144, 24}, {3104, 21}, {3136, 22}, {3168, 26}, 
+{97, 61}, {1152, 55}, {1184, 66}, {2176, 57}, {2208, 64}, 
+{3072, 60}, {3200, 59}, {3232, 68}, {4128, 54}, {4160, 56}, 
+{4192, 58}, {4224, 65}, {5152, 62}, {5184, 63}, {5216, 67}, 
+{5248, 69}, {129, 156}, {160, 198}, {1216, 146}, {1248, 175}, 
+{1536, 174}, {2240, 142}, {2272, 163}, {2304, 184}, {2560, 157}, 
+{3264, 145}, {3296, 165}, {3328, 190}, {3584, 148}, {4096, 154}, 
+{4256, 140}, {4288, 155}, {4320, 176}, {4352, 195}, {4608, 147}, 
+{5120, 191}, {5280, 158}, {5312, 167}, {5344, 185}, {5632, 159}, 
+{6176, 143}, {6208, 141}, {6240, 144}, {6272, 152}, {6304, 166}, 
+{6336, 182}, {6368, 196}, {6656, 168}, {7200, 171}, {7232, 164}, 
+{7264, 170}, {7296, 178}, {7328, 194}, {7360, 197}, {7680, 173}, 
+{8256, 189}, {8288, 188}, {8704, 180}, {9728, 183}, {10752, 186}, 
+{11776, 193}, {16416, 181}, {16448, 161}, {16480, 150}, {16512, 151}, 
+{16544, 149}, {16576, 153}, {16608, 160}, {16640, 162}, {16672, 172}, 
+{16704, 169}, {16736, 177}, {16768, 179}, {16800, 187}, {16832, 192}, 
+{193, 423}, {1280, 401}, {1312, 421}, {1344, 437}, {2336, 409}, 
+{2368, 428}, {2400, 449}, {3360, 406}, {3392, 430}, {3424, 441}, 
+{4384, 414}, {4416, 427}, {4448, 444}, {5376, 404}, {5408, 418}, 
+{5440, 442}, {5472, 451}, {6144, 416}, {6400, 415}, {6432, 431}, 
+{6464, 447}, {7168, 438}, {7392, 408}, {7424, 420}, {7456, 440}, 
+{8224, 402}, {8320, 398}, {8352, 407}, {8384, 410}, {8416, 419}, 
+{8448, 433}, {9248, 425}, {9280, 411}, {9312, 412}, {9344, 417}, 
+{9376, 426}, {9408, 429}, {9440, 435}, {10272, 443}, {10304, 424}, 
+{10336, 422}, {10368, 432}, {10400, 434}, {10432, 439}, {11328, 445}, 
+{11360, 436}, {11424, 452}, {12800, 400}, {13376, 446}, {13408, 448}, 
+{13824, 405}, {14848, 403}, {15872, 413}, {16384, 450}, {16864, 399}, 
+{225, 912}, {256, 962}, {288, 991}, {512, 910}, {1376, 926}, 
+{1408, 960}, {1440, 930}, {1472, 973}, {2432, 945}, {2464, 918}, 
+{2496, 958}, {2528, 970}, {3456, 929}, {3488, 913}, {3520, 933}, 
+{3552, 981}, {4480, 927}, {4512, 911}, {4544, 937}, {4576, 975}, 
+{5504, 934}, {5536, 935}, {5568, 955}, {5600, 980}, {6496, 921}, 
+{6528, 959}, {6560, 948}, {6592, 969}, {6624, 999}, {7488, 908}, 
+{7520, 932}, {7552, 964}, {7584, 966}, {7616, 989}, {7648, 1000}, 
+{8192, 943}, {8480, 909}, {8512, 920}, {8544, 951}, {8576, 979}, 
+{8608, 977}, {8640, 987}, {9216, 990}, {9472, 907}, {9504, 946}, 
+{9536, 952}, {9568, 974}, {9600, 993}, {9632, 992}, {10464, 923}, 
+{10496, 922}, {10528, 954}, {10560, 949}, {10592, 982}, {10656, 996}, 
+{11296, 928}, {11392, 906}, {11456, 914}, {11488, 938}, {11520, 944}, 
+{11552, 956}, {11584, 983}, {12320, 968}, {12352, 931}, {12384, 917}, 
+{12416, 925}, {12448, 940}, {12480, 942}, {12512, 965}, {12544, 984}, 
+{12576, 994}, {12608, 998}, {13344, 915}, {13440, 916}, {13472, 919}, 
+{13504, 941}, {13536, 963}, {13568, 961}, {13600, 978}, {14368, 957}, 
+{14400, 924}, {14432, 939}, {14464, 936}, {14496, 947}, {14528, 953}, 
+{14560, 976}, {14592, 995}, {14624, 997}, {15392, 988}, {15424, 950}, 
+{15456, 967}, {15488, 972}, {15520, 971}, {15552, 985}, {15584, 986}, 
+{321, 2022}, {352, 2035}, {416, 2028}, {1504, 2006}, {8672, 2013}, 
+{9664, 2002}, {9696, 2021}, {10240, 2019}, {10624, 2007}, {10688, 2008}, 
+{10720, 2026}, {11264, 2024}, {11616, 2004}, {11648, 2012}, {11680, 2011}, 
+{11712, 2005}, {11744, 2032}, {12288, 2043}, {12640, 2020}, {12672, 2023}, 
+{12704, 2016}, {12736, 2025}, {12768, 2039}, {13312, 2034}, {13632, 2010}, 
+{13664, 2009}, {13696, 2015}, {13728, 2027}, {13760, 2036}, {13792, 2042}, 
+{14336, 2040}, {14656, 2018}, {14688, 2014}, {14720, 2029}, {14752, 2033}, 
+{14784, 2041}, {14816, 2044}, {15616, 2003}, {15648, 2017}, {15680, 2030}, 
+{15712, 2031}, {15744, 2037}, {15776, 2038}, {385, 4091}, {448, 4090}, 
+{480, 4094}, {15360, 4093}, {15808, 4092}, {15840, 4095}};
+
+/*
+   Purpose:      AAC Huffman decoding codebook #12.
+   Explanation:  Used for decoding of scalefactors. */
+const uint32 dec_hftable12[] = {
+1006632961,  989855874,  973078881, 1023410496, 1040187776,  956302145, 
+1056965472,  922748737,  939525888, 1073743648, 1090520928,  905973537, 
+1107300096, 1124077376,  855646017,  872423168,  889200320, 1140858592, 
+1157635872,  822099713,  838876896, 1174421184, 1191198496,  771784481, 
+ 788561632,  805338784, 1207991936, 1224769216, 1241546496,  721485601, 
+ 755040000, 1258356384, 1275133568, 1291910848, 1308688096,  671219489, 
+ 687996640,  704773824,  738328192, 1325530784, 1342308096,  637796065, 
+ 654573216, 1359216256, 1375993536, 1392770816,  537394977,  554172064, 
+ 570949344,  587726432,  604503744,  621280832, 1409810176, 1426587264, 
+ 504364737,  521141984, 1460665984, 1494220448,  404749985,  438304320, 
+ 455081568,  471858816,  488635936, 1444937216, 1478491840,  373292513, 
+ 390069760,  423624128,    8387841,   25164992,   41942240,   58719392, 
+ 327154816,  360709216, 1518337088,   83885729,  100662816,  117439904, 
+ 134217408,  150994368,  167771616,  184548864,  201326464,  218103712, 
+ 234880992,  251658176,  268435168,  285212416,  301989728,  318766880, 
+ 352321344, 1543502624, 1560279872, 1577057120, 1593834368, 1610611616, 
+1627388864, 1644165888, 1660942912, 1677720160, 1694497408, 1711274656, 
+1728051904, 1744830016, 1761606624, 1778384096, 1795161344, 1811938592, 
+1828715840, 1845493088, 1862270144, 1879047168, 1895824416, 1912601664, 
+1929378912, 1946156160, 1962933408, 1979710176, 1996488064, 2013265536, 
+2030042720};
+
+/*
+  Purpose:      Array holding the AAC Huffman decoding codebooks.
+  Explanation:  - 
+const Huffman_DecCode *dec_huffman_tables[] = {
+  dec_hftable1, dec_hftable2, dec_hftable3, dec_hftable4, dec_hftable5, 
+  dec_hftable6, dec_hftable7, dec_hftable8, dec_hftable9, dec_hftable10, 
+  dec_hftable11
+};
+*/
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/dec_huf.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  dec_huf.h - AAC Huffman decoding declarations.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2000-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef DEC_HUFFMAN_H_
+#define DEC_HUFFMAN_H_
+
+/*-- Project Headers. --*/
+#include "defines.h"
+
+#define MAX_AAC_QHUFTABLES (11)
+
+/*
+  Purpose:      Structure defining Huffman codeword values for
+                quantized spectral coefficients.
+  Explanation:  - */
+
+typedef struct Huffman_DecCodeStr
+{
+  uint16 huf_param;  /* Quantized spectral coefficients. */
+  uint16 codeword;   /* Huffman codeword.                */
+    
+} Huffman_DecCode;
+
+/*
+  Purpose:      Structure defining Huffman codebook parameters for
+                quantized spectral coefficients.
+  Explanation:  - */
+typedef struct Huffman_DecInfoStr
+{
+  int16 cb_len;               /* Codebook size.                         */
+  const Huffman_DecCode *huf; /* Codeword parameters for this codebook. */
+    
+} Huffman_DecInfo;
+
+/*
+  Purpose:      Structure defining Huffman codebook parameters for
+                scalefactors.
+  Explanation:  - */
+typedef struct Huffman_DecSfInfoStr
+{
+  int16 cb_len;           /* Codebook size.       */
+  const uint32 *sf_param; /* Codeword parameters. */
+    
+} Huffman_DecSfInfo;
+
+
+
+/*-- Following functions are implemented in module 'dec_huftables.c'. --*/
+Huffman_DecInfo **LoadHuffmanDecTablesL(void);
+void CloseHuffmanDecTables(Huffman_DecInfo **);
+Huffman_DecSfInfo *LoadSfHuffmanTableL(void);
+void CloseSfHuffmanTable(Huffman_DecSfInfo *sfHuf);
+
+#endif /*-- DEC_HUFFMAN_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/env_extr.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/*
+  \file
+  \brief  Envelope extraction prototypes $Revision: 1.2.4.1 $
+*/
+
+/**************************************************************************
+  env_extr.h - SBR bitstream demultiplexer interface + constants.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2004 by Nokia Research Center, Multimedia Technologies.
+  *************************************************************************/
+
+#ifndef SBR_BITDEMUX_H_
+#define SBR_BITDEMUX_H_
+
+/*-- Project Headers. --*/
+#include "sbr_codec.h"
+
+#define SBR_FREQ_SCALE_DEF       (2)
+#define SBR_ALTER_SCALE_DEF      (1)
+#define SBR_NOISE_BANDS_DEF      (2)
+
+#define SBR_LIMITER_BANDS_DEF    (2)
+#define SBR_LIMITER_GAINS_DEF    (2)
+#define SBR_INTERPOL_FREQ_DEF    (1)
+#define SBR_SMOOTHING_LENGTH_DEF (1)
+
+#define SBR_AMP_RES_1_5          (0)
+#define SBR_AMP_RES_3_0          (1)
+
+#define FIXFIX                   (0)
+#define FIXVAR                   (1)
+#define VARFIX                   (2)
+#define VARVAR                   (3)
+
+#define SBR_UPSAMPLE_FAC         (2)
+#define NO_SYNTHESIS_CHANNELS    (64)
+#define NO_ANALYSIS_CHANNELS     (NO_SYNTHESIS_CHANNELS / SBR_UPSAMPLE_FAC)
+#define MAX_NOISE_ENVELOPES      (2)
+#define MAX_NOISE_COEFFS         (8)
+#define MAX_NUM_NOISE_VALUES     (MAX_NOISE_ENVELOPES * MAX_NOISE_COEFFS)
+#define MAX_NUM_LIMITERS         (12)
+#define MAX_ENVELOPES            (8)
+#define MAX_FREQ_COEFFS          (48)
+#define MAX_FREQ_COEFFS_FS44100  (35)
+#define MAX_FREQ_COEFFS_FS48000  (32)
+#define MAX_NUM_ENVELOPE_VALUES  (MAX_ENVELOPES * MAX_FREQ_COEFFS)
+#define MAX_INVF_BANDS           (MAX_NOISE_COEFFS)
+#define SBR_PARAMETRIC_STEREO_ID (2)
+
+/**
+ * SBR header status.
+ */
+typedef enum
+{
+  HEADER_OK,
+  HEADER_RESET,
+  CONCEALMENT,
+  HEADER_NOT_INITIALIZED
+
+} SBR_HEADER_STATUS;
+
+/**
+ * SBR codec status.
+ */
+typedef enum
+{
+  SBR_NOT_INITIALIZED,
+  UPSAMPLING,
+  SBR_ACTIVE
+
+} SBR_SYNC_STATE;
+
+/**
+ * SBR coupling modes.
+ */
+typedef enum
+{
+  COUPLING_OFF,
+  COUPLING_LEVEL,
+  COUPLING_BAL
+
+} COUPLING_MODE;
+
+/**
+ * Frequency scale tables for SBR.
+ */
+typedef struct FreqBandDataStr
+{
+  uint8 nSfb[2];
+  uint8 nNfb;
+  uint8 numMaster;
+  uint8 noLimiterBands;
+  uint8 nInvfBands;
+  uint8 v_k_master[MAX_FREQ_COEFFS + 1];
+
+} FreqBandData;
+
+/**
+ * SBR header element.
+ */
+typedef struct SbrHeaderDataStr
+{
+  SBR_SYNC_STATE syncState;
+  uint8 numberTimeSlots;
+  uint8 timeStep;
+  uint16 codecFrameSize;
+  int32 outSampleRate;
+
+  uint8 ampResolution;
+
+  uint8 startFreq;
+  uint8 stopFreq;
+  uint8 xover_band;
+  uint8 freqScale;
+  uint8 alterScale;
+  uint8 noise_bands;
+
+  uint8 limiterBands;
+  uint8 limiterGains;
+  uint8 interpolFreq;
+  uint8 smoothingLength;
+
+  FreqBandData *hFreqBandData;
+
+} SbrHeaderData;
+
+/**
+ * SBR frame info element.
+ */
+typedef struct FRAME_INFOStr
+{
+  uint8 frameClass;
+  uint8 nEnvelopes;
+  uint8 freqRes;
+  uint8 nNoiseEnvelopes;
+
+} FRAME_INFO;
+
+/**
+ * SBR grid info element.
+ */
+typedef struct SbrGridInfoStr
+{
+  uint8 bs_num_env;
+
+  uint8 bs_pointer;
+  uint8 bs_num_rel[2];
+  uint8 bs_var_board[2];
+  uint8 bs_rel_board_0[4];
+  uint8 bs_rel_board_1[4];
+
+} SbrGridInfo;
+
+/**
+ * SBR frame data element.
+ */
+typedef struct SbrFrameDataStr
+{
+  uint8 dataPresent;
+
+  FRAME_INFO frameInfo;
+  SbrGridInfo sbrGridInfo;
+
+  uint8 domain_vec;
+  uint8 domain_vec_noise;
+
+  uint16 sbr_invf_mode;
+  COUPLING_MODE coupling;
+
+  uint8 isSinesPresent;
+  uint32 addHarmonics[2];
+
+  int8 iEnvelope[MAX_NUM_ENVELOPE_VALUES];
+  int8 sbrNoiseFloorLevel[MAX_NUM_NOISE_VALUES];
+
+} SbrFrameData;
+
+/**
+ * SBR extension data element.
+ */
+typedef struct SbrExtensionDataStr
+{
+  uint8 writePsData;
+  uint8 extensionDataPresent;
+  int16 byteCount;
+  uint8 extension_id;
+  int16 extDataBufLen;
+  uint8 *extensioData;
+
+} SbrExtensionData;
+
+/**
+    * Reads SBR single channel element.
+    *
+  * @param hHeaderData  Handle to SBR header data
+  * @param hFrameData   Handle to SBR frame data
+  * @param sbrExtData   Handle to SBR extension data
+  * @param bs           Input bitstream
+  * @param decVal       Volume level adjustment factor
+  * @param isMono       1 if mono SBR bitstream, 0 otherwise
+  * @return             Error code, 0 on success
+    * 
+    */
+int16
+sbrGetSCE(SbrHeaderData *hHeaderData,
+          SbrFrameData  *hFrameData,
+          SbrExtensionData *sbrExtData,
+          TBitStream *bs,
+          int16 decVal,
+          uint8 isMono);
+
+/**
+    * Reads SBR channel pair element.
+    *
+  * @param hHeaderData     Handle to SBR header data
+  * @param hFrameDataLeft  Handle to left channel SBR frame data
+  * @param hFrameDataRight Handle to right channel SBR frame data
+  * @param sbrExtData      Handle to SBR extension data
+  * @param bs              Input bitstream
+  * @param decVal          Volume level adjustment factor
+  * @return                Error code, 0 on success
+    * 
+    */
+int16 
+sbrGetCPE(SbrHeaderData *hHeaderData,
+          SbrFrameData *hFrameDataLeft,
+          SbrFrameData *hFrameDataRight,
+          SbrExtensionData *sbrExtData,
+          TBitStream *bs,
+          int16 decVal);
+
+/**
+    * Reads SBR header element.
+    *
+  * @param hHeaderData  Handle to SBR header data
+  * @param bs           Input bitstream
+  * @return             Status of header processing, see status codes
+    * 
+    */
+SBR_HEADER_STATUS
+sbrGetHeaderData(SbrHeaderData *h_sbr_header,
+                 TBitStream *bs);
+
+/**
+    * Initalizes SBR header element.
+    *
+  * @param hHeaderData     Handle to SBR header data
+  * @param FreqBandData    Handle to SBR frequency scale data
+  * @param sampleRate      Sampling rate of AAC bitstream
+  * @param samplesPerFrame Number of samples in a frame (1024 or 960)
+    * 
+    */
+void
+initHeaderData(SbrHeaderData *headerData, 
+               FreqBandData *FreqBandData,
+               int32 sampleRate, 
+               int16 samplesPerFrame);
+
+/**
+    * Initalizes SBR frequency scale tables.
+    *
+  * @param hHeaderData     Handle to SBR header data
+  * @return                Error code, 0 on success
+    * 
+    */
+int16
+resetFreqBandTables(SbrHeaderData *hHeaderData);
+
+FLOAT 
+FloatFR_logDualis(int16 a);
+
+FLOAT 
+FloatFR_getNumOctaves(int16 a, int16 b);
+
+#endif /*-- SBR_BITDEMUX_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/sbr_bitmux.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/*
+  \file
+  \brief SBR bitstream multiplexer interface $Revision: 1.1.1.1 $
+*/
+
+/**************************************************************************
+  sbr_bitmux.cpp - TBitStream definitions for SBR encoder.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2004 by Nokia Research Center, Multimedia Technologies.
+  *************************************************************************/
+
+#ifndef SBR_BITMUX_H_
+#define SBR_BITMUX_H_
+
+/*-- Project Headers. --*/
+#include "env_extr.h"
+
+int16
+SBR_WriteHeaderData(SbrHeaderData *headerData, 
+                    TBitStream *bs, 
+                    uint8 writeFlag);
+
+int16
+SBR_WriteSCE(SbrHeaderData *headerData,
+             SbrFrameData *frameData,
+             SbrExtensionData *sbrExtData,
+             TBitStream *bs,
+             uint8 isMono,
+             uint8 writeFlag);
+
+int16
+SBR_WriteCPE(SbrHeaderData *headerData,
+             SbrFrameData *frameDataLeft,
+             SbrFrameData *frameDataRight,
+             SbrExtensionData *sbrExtData,
+             TBitStream *bs,
+             uint8 writeFlag);
+
+#endif /*-- SBR_BITMUX_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/sbr_codec.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/*
+  \file
+  \brief SBR codec interface $Revision: 1.1.1.1.4.1 $
+*/
+
+/**************************************************************************
+  sbr_codec.h - SBR codec interface.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2004 by Nokia Research Center, Multimedia Technologies.
+  *************************************************************************/
+
+#ifndef SBR_CODEC_H_
+#define SBR_CODEC_H_
+
+/*-- Project Headers. --*/
+#include "nok_bits.h"
+#include "defines.h"
+
+#pragma warning( disable : 4244)
+
+#define SBR_EXTENSION     (13)  /*-- 1101 --*/
+#define SBR_EXTENSION_CRC (14)  /*-- 1110 --*/
+#define MAX_NR_ELEMENTS   (2)
+#define MAX_SBR_BYTES     (128)
+
+/**
+ * Error codes for SBR processing.
+ */
+typedef enum
+{
+  SBRDEC_OK = 0,
+  SBRDEC_CONCEAL,
+  SBRDEC_NOSYNCH,
+  SBRDEC_ILLEGAL_PROGRAM,
+  SBRDEC_ILLEGAL_TAG,
+  SBRDEC_ILLEGAL_CHN_CONFIG,
+  SBRDEC_ILLEGAL_SECTION,
+  SBRDEC_ILLEGAL_SCFACTORS,
+  SBRDEC_ILLEGAL_PULSE_DATA,
+  SBRDEC_MAIN_PROFILE_NOT_IMPLEMENTED,
+  SBRDEC_GC_NOT_IMPLEMENTED,
+  SBRDEC_ILLEGAL_PLUS_ELE_ID,
+  SBRDEC_CREATE_ERROR,
+  SBRDEC_NOT_INITIALIZED
+
+} SBR_ERROR;
+
+/**
+ * SBR element tags, these are the same as used in AAC also.
+ */
+typedef enum
+{
+  SBR_ID_SCE = 0,
+  SBR_ID_CPE,
+  SBR_ID_CCE,
+  SBR_ID_LFE,
+  SBR_ID_DSE,
+  SBR_ID_PCE,
+  SBR_ID_FIL,
+  SBR_ID_END
+
+} SBR_ELEMENT_ID;
+
+/**
+ * Bitstream element for SBR payload data. 
+ */
+typedef struct
+{
+  /**
+   * Length of payload data.
+   */
+  int16 Payload;
+
+  /**
+   * Channel element ID for the associated SBR data.
+   */
+  int16 ElementID;
+
+  /**
+   * Offset to the start of the channel element, in bits.
+   */
+  int32 elementOffset;
+
+  /**
+   * Length of the channel element, in bits.
+   */
+  int32 chElementLen;
+
+  /**
+   * Decoding status of SBR header.
+   */
+  uint8 headerStatus;
+
+  /**
+   * Type of SBR element (with or without CRC codeword).
+   */
+  int16 ExtensionType;
+
+  /**
+   * SBR bitstream data.
+   */
+  uint8 *Data;
+
+} SbrElementStream;
+
+typedef struct
+{
+  int16 NrElements;
+  SbrElementStream sbrElement[MAX_NR_ELEMENTS];
+
+} SbrBitStream;
+
+/**
+ * SBR handle.
+ */
+typedef struct SBR_Decoder_Instance SBR_Decoder;
+
+/**
+    * Creates SBR bitstream handle.
+    * 
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *
+  * @return  Handle to SBR bitstream handle
+    *
+    */
+SbrBitStream *
+OpenSBRBitStreamL(void);
+
+/**
+    * Closes SBR bitstream handle.
+  *
+    * @param Bitstr  Handle to SBR bitstream to be deleted
+  * @return        NULL
+    *
+    */
+SbrBitStream *
+CloseSBRBitStream(SbrBitStream *Bitstr);
+
+/**
+    * Creates SBR decoding/parsing handle.
+    * 
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *
+  * @param sampleRate      Sample rate of the AAC bitstream
+  * @param samplesPerFrame Frame length of the AAC stream (1024 or 960)
+  * @param isStereo        1 if stereo AAC stream, 0 otherwise (=mono)
+  * @param isDualMono      1 if two single channel elements present in the AAC bistream, 0 otherwise
+  * @return                Handle to SBR decoding/parsing handle
+    * 
+    */
+SBR_Decoder *
+OpenSBRDecoderL(int32 sampleRate, 
+                int16 samplesPerFrame, 
+                uint8 isStereo, 
+                uint8 isDualMono);
+
+/**
+    * Closes SBR decoding handle.
+  *
+    * @param Bitstr  Handle to SBR decoding/parsing to be deleted
+  * @return        NULL
+    *
+    */
+SBR_Decoder *
+CloseSBR(SBR_Decoder *self);
+
+/**
+    * Parses the SBR payload data and writes the modified bitstream element(s)
+  * to output AAC bitstream.
+    *
+  * @param bsIn    Handle to AAC input bitstream
+  * @param bsOut   Handle to AAC output bitstream
+  * @param self    Handle to SBR parser
+  * @param Bitstr  Handle to SBR bitstream element(s)
+  * @param decVal  Volume level adjustment factor  
+  * @return        Number of bytes written to output bitstream
+    * 
+    */
+int16
+ParseSBR(TBitStream *bsIn, 
+         TBitStream *bsOut, 
+         SBR_Decoder *self, 
+         SbrBitStream *Bitstr,
+         int16 decVal);
+
+/**
+    * Chacks whether parametric stereo tool is enabled in the SBR elements.
+    *
+  * @param self    Handle to SBR parser
+  * @param Bitstr  Handle to SBR bitstream element(s)
+  * @return        1 if parametric stereo found, 0 otherwise
+    * 
+    */
+uint8
+IsSBRParametricStereoEnabled(SBR_Decoder *self, SbrBitStream *Bitstr);
+
+/**
+    * Chacks whether SBR elements present in the bistream.
+    *
+  * @param Bitstr  Handle to SBR bitstream element(s)
+  * @return        1 if SBR elements found, 0 otherwise
+    * 
+    */
+uint8
+IsSBREnabled(SbrBitStream *Bitstr);
+
+/**
+    * Reads SBR payload data from AAC bitstream into SBR bitstream handle.
+    *
+  * @param bs             Handle to AAC bitstream
+  * @param streamSBR      Handle to SBR bitstream handle
+  * @param extension_type SBR payload type
+  * @param prev_element   Channel element type prior the fill element
+  * @param dataCount      Length of SBR payload data, in bytes
+  * @return               1 if SBR read, 0 otherwise (in which case the callee should read the data)
+    * 
+    */
+int16
+ReadSBRExtensionData(TBitStream *bs, 
+                     SbrBitStream *streamSBR, 
+                     int16 extension_type, 
+                     int16 prev_element, 
+                     int16 dataCount);
+
+/**
+    * Initializes SBR handle for silence data generation.
+    *
+  * @param sbrDec             Handle to SBR decoder
+  * @param isStereo           1 if stereo AAC stream, 0 otherwise (=mono)
+  * @param isParametricStereo 1 if parametric stereo should be included in the SBR data
+    * 
+    */
+void
+InitSBRSilenceData(SBR_Decoder *sbrDec, uint8 isStereo, uint8 isParametricStereo);
+
+/**
+    * Writes silence to SBR channel element. Please note that this method is supposed
+  * to be called inside AAC bitstream multiplexer and is therefore part of encoding. 
+  * If you want to upgrade plain AAC bitstream to eAAC+, use 'GenerateSBRSilenceDataL()' 
+  * first to generate the silence bits for SBR, then parse the AAC bitstream (so that the 
+  * channel element positions and their length are known) and finally call 
+  * 'WriteSBRSilence()' to write the output eAAC+ bitstream. 
+    *
+  * @param sbrDecoder  Handle to SBR codec
+  * @param bsOut       Handle to output (AAC) bitstream
+  * @param isStereo    1 if stereo AAC stream, 0 otherwise (=mono)
+  * @return            Length of SBR silence data, in bits
+    * 
+    */
+int16
+WriteSBRSilenceElement(SBR_Decoder *sbrDecoder, TBitStream *bsOut, uint8 isStereo);
+
+/**
+    * Generates silence bits for SBR bitstream.
+    * 
+    * Possible leave codes:
+    *    - <code>KErrNoMemory</code> if memory allocation fails
+    *
+  * @param OutBuffer          Output buffer receiving silence data bits
+  * @param OutBufferSize      Size of output buffer
+  * @param sampleRate         Sample rate of the AAC bitstream
+  * @param isStereo           1 if stereo AAC stream, 0 otherwise (=mono)
+  * @param isParametricStereo 1 if parametric stereo should be included in the SBR data
+  * @return                   Length of SBR silence data, in bits
+    * 
+    */
+int16
+GenerateSBRSilenceDataL(uint8 *OutBuffer, 
+                        int16 OutBufferSize, 
+                        int32 sampleRate, 
+                        uint8 isStereo, 
+                        uint8 isParametricStereo);
+
+/**
+    * Writes silence to the SBR part of the AAC bitstream.
+    *
+  * @param bsIn      AAC input bitstream
+  * @param bsOut     Output bitstream (AAC + SBR)
+  * @param streamSBR Handle to SBR bitstream element
+  * @param SbrBuffer Payload data to generate SBR silence
+  * @param SbrBits   Length of SBR silence, in bits
+  * @return          Length of AAC + SBR bitstream, in bytes
+    * 
+    */
+int16
+WriteSBRSilence(TBitStream *bsIn, 
+                TBitStream *bsOut,
+                SbrBitStream *streamSBR,
+                uint8 *SbrBuffer, 
+                int16 SbrBits);
+
+#endif /*-- SBR_CODEC_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/sbr_rom.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/*
+  \file
+  \brief SBR ROM tables interface $Revision: 1.1.1.1.4.1 $
+*/
+
+/**************************************************************************
+  sbr_rom.h - SBR ROM tables interface.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2004 by Nokia Research Center, Multimedia Technologies.
+  *************************************************************************/
+
+#ifndef SBR_ROM_H_
+#define SBR_ROM_H_
+
+/*-- Project Headers. --*/
+#include "env_extr.h"
+
+#define INV_INT_TABLE_SIZE    (55)
+#define LOG_DUALIS_TABLE_SIZE (65)
+#define SBR_BIT_ARRAY_SIZE    (8)
+
+extern const uint32 bitArray[SBR_BIT_ARRAY_SIZE];
+
+extern const uint8 sbr_start_freq_16[16];
+extern const uint8 sbr_start_freq_22[16];
+extern const uint8 sbr_start_freq_24[16];
+extern const uint8 sbr_start_freq_32[16];
+extern const uint8 sbr_start_freq_44[16];
+extern const uint8 sbr_start_freq_48[16];
+extern const uint8 sbr_start_freq_64[16];
+extern const uint8 sbr_start_freq_88[16];
+
+extern const FLOAT sbr_invIntTable[INV_INT_TABLE_SIZE];
+extern const FLOAT logDualisTable[LOG_DUALIS_TABLE_SIZE];
+
+extern const FRAME_INFO sbr_staticFrameInfo[3];
+
+extern const SbrHeaderData sbr_defaultHeader;
+
+extern const int8 sbr_huffBook_EnvLevel10T[120][2];
+extern const int8 sbr_huffBook_EnvLevel10F[120][2];
+extern const int8 sbr_huffBook_EnvBalance10T[48][2];
+extern const int8 sbr_huffBook_EnvBalance10F[48][2];
+extern const int8 sbr_huffBook_EnvLevel11T[62][2];
+extern const int8 sbr_huffBook_EnvLevel11F[62][2];
+extern const int8 sbr_huffBook_EnvBalance11T[24][2];
+extern const int8 sbr_huffBook_EnvBalance11F[24][2];
+extern const int8 sbr_huffBook_NoiseLevel11T[62][2];
+extern const int8 sbr_huffBook_NoiseBalance11T[24][2];
+
+extern const int32 v_Huff_envelopeLevelC10T[121];
+extern const uint8 v_Huff_envelopeLevelL10T[121];
+extern const int32 v_Huff_envelopeLevelC10F[121];
+extern const uint8 v_Huff_envelopeLevelL10F[121];
+extern const int32 bookSbrEnvBalanceC10T[49];
+extern const uint8 bookSbrEnvBalanceL10T[49];
+extern const int32 bookSbrEnvBalanceC10F[49];
+extern const uint8 bookSbrEnvBalanceL10F[49];
+extern const int32 v_Huff_envelopeLevelC11T[63];
+extern const uint8 v_Huff_envelopeLevelL11T[63];
+extern const int32 v_Huff_envelopeLevelC11F[63];
+extern const uint8 v_Huff_envelopeLevelL11F[63];
+extern const uint16 bookSbrEnvBalanceC11T[25];
+extern const uint8 bookSbrEnvBalanceL11T[25];
+extern const uint16 bookSbrEnvBalanceC11F[25];
+extern const uint8 bookSbrEnvBalanceL11F[25];
+extern const uint16 v_Huff_NoiseLevelC11T[63];
+extern const uint8 v_Huff_NoiseLevelL11T[63];
+extern const uint16 bookSbrNoiseBalanceC11T[25];
+extern const uint8 bookSbrNoiseBalanceL11T[25];
+
+#endif /*-- SBR_ROM_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/tool.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  tool.h - Interface to AAC core structures.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2000-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef    AACTOOL_H_
+#define AACTOOL_H_
+
+/*-- Project Headers. --*/
+#include "nok_bits.h"
+#include "dec_huf.h"
+#include "aacdef.h"
+
+/*
+   Purpose:     LTP parameters for MPEG AAC.
+   Explanation: - */
+class CLTP_Info : public CBase
+{
+
+public:
+
+    static CLTP_Info* NewL();
+    ~CLTP_Info();
+
+    /*-- Max. sfb's used for this channel. --*/
+    int16 max_sfb;
+
+    /*-- Codebook index. --*/
+    uint8 cbIdx;
+
+    /*-- Boolean flag to indicate the presence of LTP. --*/
+    int16 ltp_present;
+
+    /*-- LTP lag. --*/
+    int16* delay;
+
+    /*-- Prediction status for each sfb. --*/
+    uint32 sfbflags[2];
+
+private:
+
+    CLTP_Info();
+    void ConstructL();
+
+};
+
+/*
+   Purpose:     Structure interface for AAC decoding tools.
+   Explanation: - */
+class CToolInfo : public CBase
+{
+public:
+
+    static CToolInfo* NewL();
+    ~CToolInfo();
+    CLTP_Info *ltp;
+    int16* quant;
+ 
+private:
+
+    void ConstructL();
+    CToolInfo();
+
+};
+
+/*
+   Purpose:     Structure interface for coupling channel.
+   Explanation: - */
+class CCInfo : public CBase
+{
+
+public:
+    static CCInfo* NewL();
+    ~CCInfo();
+
+    CToolInfo* tool;
+    CWindowInfo* winInfo;
+
+private:
+    CCInfo();
+    void ConstructL();
+  
+};
+
+/*
+   Purpose:     Information about the audio channel.
+   Explanation: - */
+class TEleList
+{
+public:
+  int16 num_ele;
+  int16 ele_is_cpe[1 << LEN_TAG];
+  int16 ele_tag[1 << LEN_TAG];
+
+};
+
+/*
+   Purpose:     Mixing information for downmixing multichannel input
+                into two-channel output.
+   Explanation: - */
+class TMIXdown
+{
+public:
+  int16 present;
+  int16 ele_tag;
+  int16 pseudo_enab;
+
+};
+
+
+/*
+   Purpose:     Program configuration element.
+   Explanation: - */
+class TProgConfig
+{
+public:
+  int16 tag;
+  int16 profile;
+  int16 sample_rate_idx;
+
+  BOOL pce_present;
+
+  TEleList front;
+  TEleList side;
+  TEleList back;
+  TEleList lfe;
+  TEleList data;
+  TEleList coupling;
+
+  TMIXdown mono_mix;
+  TMIXdown stereo_mix;
+  TMIXdown matrix_mix;
+
+  int16 num_comment_bytes;
+
+};
+
+#endif    /*-- AACTOOL_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/inc/tool2.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  tool2.h - Interface to AAC decoding functions.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2003-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef    AAC_FUNC_H_
+#define AAC_FUNC_H_
+
+/*-- Project Headers. --*/
+#include "aacaud.h"
+#include "tool.h"
+
+/*
+ * Sfb initialization. 
+ */
+void
+AACSfbInfoInit(CSfb_Info *sfb, uint8 sIndex, uint8 is960);
+
+int32
+AACSampleRate(uint8 sampleRateIdx);
+
+
+/*
+ * Control of channel configuration. 
+ */
+int16
+CCChIndex(CMC_Info *mip, int16 cpe, int16 tag);
+
+int16
+ChIndex(int16 nch, int16 tag, int16 wnd, CMC_Info *mip);
+
+
+/*
+ * AAC syntactic channel elements. 
+ */
+int16 
+GetSCE(CAACAudDec *aac, TBitStream *bs, CMC_Info *mip, uint8 *gains, 
+       uint32 *gainPos, uint32 bufBitOffset);
+
+int16 
+GetCPE(CAACAudDec *aac, TBitStream *bs, CMC_Info *mip, uint8 *gains, 
+       uint32 *gainPos, uint32 bufBitOffset);
+
+int16 
+GetCCE(CAACAudDec *aac, TBitStream *bs, CMC_Info *mip, CCInfo **ccInfo);
+
+int16 
+GetICS(TBitStream *bs, TCh_Info *cip, uint8 *group, uint8 max_sfb, 
+       uint8 *cb_map, int16 *quant, int16 global_gain, 
+       int16 *factors);
+
+int16
+GetICSInfo(TBitStream *bs, CWindowInfo *winInfo, CLTP_Info *ltp_left, CLTP_Info *ltp_right);
+
+
+/*
+ * Huffman decoding interfaces. 
+ */
+uint32 
+GetHcb(Huffman_DecSfInfo *huf_info, TBitStream *bs);
+
+int16
+huf_sfac(TBitStream *bs, TCh_Info *cip, uint8 *group, uint8 *cb_map,
+         int16 global_gain, int16 *factors, uint8 max_sfb);
+
+int16
+huf_spec(TBitStream *bs, CInfo *info, int16 nsect, uint8 *sect, 
+         int16 *quant, Huffman_DecInfo **huf, uint8 parseOnly);
+
+
+/*
+ * Global gain element extraction and storage.
+ */
+int16
+GetSCEGain(CAACAudDec *aac, TBitStream *bs, uint8 *gains, 
+           uint32 *gainPos, uint32 bufBitOffset);
+
+int16
+GetCPEGain(CAACAudDec *aac, TBitStream *bs, uint8 *gains, 
+           uint32 *gainPos, uint32 bufBitOffset);
+
+#endif    /*-- AAC_FUNC_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/Tool.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#include "Tool.h"
+
+CLTP_Info* CLTP_Info::NewL()
+    {
+    
+    CLTP_Info* self = new (ELeave) CLTP_Info();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;    
+
+    }
+
+
+CLTP_Info::~CLTP_Info()
+    {
+    if (delay != 0)
+        delete[] delay;
+    }
+
+CLTP_Info::CLTP_Info()
+    {
+
+    }
+
+void CLTP_Info::ConstructL()
+    {
+    delay = new (ELeave) int16[NSHORT];
+
+    }
+
+
+
+CToolInfo* CToolInfo::NewL()
+    {
+
+    CToolInfo* self = new (ELeave) CToolInfo();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+
+void CToolInfo::ConstructL()
+    {
+    quant = new (ELeave) int16[LN2];
+    ltp = CLTP_Info::NewL();
+
+    }
+
+CToolInfo::CToolInfo()
+    {
+
+    }
+
+CToolInfo::~CToolInfo()
+    {
+
+    if (quant != 0)
+        {
+        delete [] quant;
+        }
+
+    if (ltp != 0)
+        delete ltp;
+
+    }
+
+
+CCInfo* CCInfo::NewL()
+    {
+    CCInfo* self = new (ELeave) CCInfo();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+
+
+    }
+
+CCInfo::CCInfo()
+    {
+
+    }
+
+CCInfo::~CCInfo()
+    {
+    if (tool != 0) delete tool;
+    if (winInfo != 0) delete winInfo;
+    }
+
+void CCInfo::ConstructL()
+    {
+
+    tool = CToolInfo::NewL();
+    winInfo = CWindowInfo::NewL();
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/aacaud.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,973 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  aacaud.cpp - High level interface implementations for AAC decoder.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2000-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/*-- System Headers. --*/
+#include <math.h>
+
+/*-- Project Headers. --*/
+#include "aacaud.h"
+#include "dec_huf.h"
+#include "tool2.h"
+
+CAACAudDec* CAACAudDec::NewL(int16 aNumCh, int16 aNumCCh)
+    {
+    CAACAudDec* self = new (ELeave) CAACAudDec();
+    CleanupStack::PushL(self);
+    self->ConstructL(aNumCh, aNumCCh);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CAACAudDec::ConstructL(int16 aNumCh, int16 aNumCCh)
+    {
+
+    //----------------->
+
+    int16 i, tmp;
+
+    numCh = aNumCh;
+    numCCh = aNumCCh;
+
+    /*-- Set the limit for the number of decoded audio elements. --*/
+    if(numCh > ChansD - XChansD)
+        numCh = ChansD - XChansD;
+
+    /*-- How many coupling channels are accepted ? --*/
+    if(numCCh > CChansD - XCChansD)
+        numCCh = CChansD - XCChansD;
+
+    /*-- # of channels outputted. --*/
+    numOutCh = numCh;
+
+    /*-- Allocate main channel elements. --*/
+    tmp = (int16) (numCh + XChansD);
+    
+    winInfo = new (ELeave) CWindowInfo*[tmp];
+    tool = new (ELeave) CToolInfo*[tmp];
+
+    windowAmount = tmp;
+
+    for(i = 0; i < tmp; i++)
+        {
+        winInfo[i] = CWindowInfo::NewL();
+        tool[i] = CToolInfo::NewL();
+        }
+
+    /*-- Allocate coupling channel elements. --*/
+    tmp = (int16) (numCCh + XCChansD);
+    ccInfo = new (ELeave) CCInfo*[tmp];
+  
+    for(i = 0; i < tmp; i++)
+        {
+        ccInfo[i] = CCInfo::NewL();
+        }
+
+    /*-- Get spectral codebooks parameters. --*/
+    huf = LoadHuffmanDecTablesL();
+  
+    /*-- Get scalefactor codebook parameters. --*/
+    sf_huf = LoadSfHuffmanTableL();
+
+    mc_info = CMC_Info::NewL();
+  
+    for(i = 0; i < ChansD; i++)
+        {
+        mc_info->ch_info[i].huf = huf;
+        mc_info->ch_info[i].sf_huf = sf_huf;
+        }
+
+    //<------------------
+
+    }
+
+CAACAudDec::CAACAudDec() : tool(0), mc_info(0), ccInfo(0), winInfo(0),
+                           huf(0), sf_huf(0)
+    {
+#ifdef EAACPLUS_DECODER
+    sbrStream = NULL;
+    sbrDecInfo = NULL;
+#endif /*-- EAACPLUS_DECODER --*/
+    }
+
+CAACAudDec::~CAACAudDec()
+    {
+
+    /*-- Allocate main channel elements. --*/
+    TInt tmp = (int16) (numCh + XChansD);
+    TInt i = 0;
+    if (winInfo != 0)
+        {
+        for(i = 0; i < tmp; i++)
+            {
+            if (winInfo[i] != 0) delete winInfo[i];
+            if (tool[i] != 0) delete tool[i];
+            }
+
+        delete[] winInfo;
+        }
+    
+    if (tool != 0) delete[] tool;
+
+
+    /*-- Allocate coupling channel elements. --*/
+    tmp = (int16) (numCCh + XCChansD);
+    
+    if (ccInfo != 0)
+        {
+        for(i = 0; i < tmp; i++)
+            {
+            if (ccInfo[i] != 0) delete ccInfo[i];
+            }
+        }
+
+    if (ccInfo != 0) delete[] ccInfo;
+  
+    CloseHuffmanDecTables(huf); huf = NULL;
+    CloseSfHuffmanTable(sf_huf); sf_huf = NULL;
+
+    if (mc_info != 0) delete mc_info;
+
+
+  sbrStream = CloseSBRBitStream(sbrStream);
+  sbrDecInfo = CloseSBR(sbrDecInfo);
+
+  }
+
+/*
+ * Prepares Ch_Info structure for given audio element. The return value is
+ * channel index into 'mip->ch_into' structure.
+ */
+static INLINE int16
+enter_chn(int16 nch, int16 tag, int16 common_window, CMC_Info *mip)
+{
+  TCh_Info *cip;
+  BOOL parseCh;
+  int16 cidx = 0;
+
+  /*-- Build configuration. --*/
+  if(mip->nch + nch > (mip->maxnCh + 1) || mip->dummyAlways)
+  {
+    parseCh = FALSE;
+    cidx = mip->dummyCh;
+    mip->dummyAlways = TRUE;
+  }
+  else
+  {
+    parseCh = TRUE;
+    cidx = mip->nch;
+    mip->nch = (int16) (mip->nch + nch);
+  }
+
+  if(nch == 1) /*-- SCE. --*/
+  {
+    cip = &mip->ch_info[cidx];
+
+    cip->cpe = 0;
+    cip->ncch = 0;
+    cip->tag = tag;
+    cip->widx = cidx;
+    cip->present = 1;
+    cip->paired_ch = cidx;
+    cip->parseCh = parseCh;
+  }
+  else         /*-- CPE. --*/
+  {
+    /*-- Left. --*/
+    cip = &mip->ch_info[cidx];
+    cip->cpe = 1;
+    cip->ncch = 0;
+    cip->tag = tag;
+    cip->widx = cidx;
+    cip->present = 1;
+    cip->parseCh = parseCh;
+    cip->paired_ch = (int16) (cidx + 1);
+
+    /*-- Right. ---*/
+    cip = &mip->ch_info[cidx + 1];
+    cip->cpe = 1;
+    cip->ncch = 0;
+    cip->tag = tag;
+    cip->present = 1;
+    cip->paired_ch = cidx;
+    cip->parseCh = parseCh;
+    cip->widx = (common_window) ? (int16) cidx : (int16) (cidx + 1);
+  }
+
+  return (cidx);
+}
+
+/*
+ * Retrieve appropriate channel index for the program and decoder configuration.
+ */
+int16
+ChIndex(int16 nch, int16 tag, int16 wnd, CMC_Info *mip)
+{
+  /*
+   * Channel index to position mapping for 5.1 configuration is :
+   *  0 center
+   *  1 left  front
+   *  2 right front
+   *  3 left surround
+   *  4 right surround
+   *  5 lfe
+   */
+  return (enter_chn(nch, tag, wnd, mip));
+}
+
+/*
+ * Given cpe and tag, returns channel index of SCE or left channel in CPE.
+ */
+int16
+CCChIndex(CMC_Info *mip, int16 cpe, int16 tag)
+{
+  int16 ch;
+  TCh_Info *cip = &mip->ch_info[0];
+
+  for(ch = 0; ch < mip->nch; ch++, cip++)
+    if(cip->cpe == cpe && cip->tag == tag)
+      return (ch);
+
+  /*
+   * No match, so channel is not in this program. Just parse the channel(s).
+   */
+  cip = &mip->ch_info[mip->dummyCh];
+  cip->cpe = cpe;
+  cip->widx = mip->dummyCh;
+  cip->parseCh = TRUE;
+
+  return (mip->dummyCh);
+}
+
+/* 
+ * Checks continuity of configuration from one block to next.
+ */
+static INLINE void
+ResetMCInfo(CMC_Info *mip)
+{
+  /*-- Reset channels counts. --*/
+  mip->nch = 0;
+  mip->ncch = 0;
+  mip->dummyAlways = 0;
+}
+
+/*
+ * Deletes resources allocated to the specified AAC decoder.
+ */
+EXPORT_C CAACAudDec *
+DeleteAACAudDec(CAACAudDec *aac)
+{ 
+  if(aac)
+  {
+    delete (aac);
+    aac = 0;
+  }
+  
+  return (NULL);
+}
+
+/*
+ * Creates handle to AAC decoder core. The input parameters are
+ * the number of main ('numCh') and coupling ('numCCh') channels 
+ * to be supported.
+ *
+ * Return AAC decoder handle on success, NULL on failure.
+ */
+EXPORT_C void
+CreateAACAudDecL(CAACAudDec*& aDecHandle, int16 numCh, int16 numCCh)
+{
+    aDecHandle = CAACAudDec::NewL(numCh, numCCh);
+
+    return;
+}
+
+/*
+ * Creates handle to eAAC+ decoder.
+ */
+EXPORT_C uint8
+CreateAACPlusAudDecL(CAACAudDec *aDecHandle, int16 sampleRateIdx, uint8 isStereo, uint8 isDualMono)
+{
+
+  int32 sampleRate = AACSampleRate(sampleRateIdx);
+
+  aDecHandle->sbrStream = OpenSBRBitStreamL();
+  aDecHandle->sbrDecInfo = OpenSBRDecoderL(sampleRate, 1024, isStereo, isDualMono);
+
+  return (1);
+
+
+}
+
+/*
+ * Prepares AAC core engine for decoding. The input parameters are the 
+ * AAC profile ID (or object type in case MPEG-4 AAC) and the sampling 
+ * rate index.
+ */
+EXPORT_C void
+InitAACAudDec(CAACAudDec *aac, int16 profile, int16 sampleRateIdx, uint8 is960)
+{
+  int16 i, j;
+  CMC_Info *mip;
+  PredType predType;
+
+  mip = aac->mc_info;
+
+  mip->profile = (uint8) profile;
+  mip->sfreq_idx = (uint8) sampleRateIdx;
+  
+  mip->cur_prog = -1;
+  mip->default_config = 1;
+
+  /*
+   * Set channel restrictions so that we know how to handle 
+   * unused channel elements.
+   */
+  mip->maxnCh = aac->numCh;
+  mip->dummyCh = mip->maxnCh;
+  mip->maxnCCh = aac->numCCh;
+  mip->dummyCCh = mip->maxnCCh;
+
+  /*-- Initialize sfb parameters. --*/
+  AACSfbInfoInit(mip->sfbInfo, mip->sfreq_idx, is960);
+
+  ResetAACAudDec(aac);
+
+  /*-- How many bands used for prediction (BWAP or LTP). --*/
+  if(profile == LTP_Object)
+  {
+    predType = LTP_PRED;
+    j = LTP_MAX_PRED_BANDS;
+  }
+  else
+  {
+    j = 0;
+    predType = NO_PRED;
+  }
+  
+  for(i = 0; i < aac->numCh + XChansD; i++)
+  {
+    aac->winInfo[i]->predBands = (uint8) j;
+    aac->winInfo[i]->predType = predType;
+  }
+  for(i = 0; i < aac->numCCh + XCChansD; i++)
+  {
+    aac->ccInfo[i]->winInfo->predBands = (uint8) j;
+    aac->ccInfo[i]->winInfo->predType = predType;
+  }
+
+  aac->samplesPerFrame = (is960) ? (int16) LN2_960 : (int16) LN2;
+}
+
+/*
+ * Resets internal members from the specified AAC decoder core.
+ */
+EXPORT_C void
+ResetAACAudDec(CAACAudDec *aac)
+{
+  int16 i;
+  CMC_Info *mip;
+  CWindowInfo *winInfo;
+
+  mip = aac->mc_info;
+
+  /*-- Reset some modules. --*/
+  ResetMCInfo(mip);
+
+  /*
+   * Assume that the first window shape is of type Kaiser-Bessel
+   * Derived (KBD). If not, then we use it anyway. The mismatch
+   * in the first frame is not of prime importance.
+   */
+
+  for(i = 0; i < aac->numCh; i++)
+  {    
+    //tool = aac->tool[i];
+    winInfo = aac->winInfo[i];
+
+    winInfo->wshape[0].prev_bk = WS_KBD;
+    winInfo->wshape[1].prev_bk = WS_KBD;
+  }
+
+  for(i = 0; i < aac->numCCh; i++)
+  {
+    //tool = aac->ccInfo[i]->tool;
+
+    aac->ccInfo[i]->winInfo->wshape[0].prev_bk = WS_KBD;
+    aac->ccInfo[i]->winInfo->wshape[1].prev_bk = WS_KBD;
+  }
+}
+
+/*
+ * Reads data stream element from the specified bitstream.
+ * 
+ * Returns # of read bits.
+ */
+static INLINE int16
+GetDSE(TBitStream *bs)
+{
+  int16 align_flag, cnt, bitsRead;
+  
+  bitsRead = (int16) BsGetBitsRead(bs);
+  
+  // read tag
+  BsGetBits(bs, LEN_TAG);
+  align_flag = (int16) BsGetBits(bs, LEN_D_ALIGN);
+  cnt = (int16) BsGetBits(bs, LEN_D_CNT);
+
+  if(cnt == (1 << LEN_D_CNT) - 1)
+    cnt = (int16) (cnt + BsGetBits(bs, LEN_D_ESC));
+  
+  if(align_flag) BsByteAlign(bs);
+
+  BsSkipNBits(bs, cnt << 3);
+
+  bitsRead = (int16) (BsGetBitsRead(bs) - bitsRead);
+
+  return (bitsRead);
+}
+
+/*
+ * Reads fill element from the bitstream.
+ */
+int32
+CAACAudDec::extension_payload(TBitStream *bs, int32 cnt, uint32 prevEleID)
+{  
+  uint8 extType = (uint8) BsGetBits(bs, LEN_EX_TYPE);
+
+  switch(extType)
+  {
+    case EX_FILL_DATA:
+    default:
+      if(sbrStream && !ReadSBRExtensionData(bs, sbrStream, extType, prevEleID, cnt))
+      {
+
+      BsGetBits(bs, LEN_NIBBLE);
+      BsSkipNBits(bs, (cnt - 1) << 3); 
+      break;  
+
+      }
+      else if (!sbrStream)
+      {
+      BsGetBits(bs, LEN_NIBBLE);
+      BsSkipNBits(bs, (cnt - 1) << 3); 
+      break;
+          
+      }
+      
+      
+      
+  }
+
+  return (cnt);
+}
+
+/*
+ * Reads fill data from the bitstream.
+ */
+void
+CAACAudDec::GetFIL(TBitStream *bs, uint32 prevEleID)
+{
+  int32 cnt;
+  
+  cnt = BsGetBits(bs, LEN_F_CNT);
+  if(cnt == (1 << LEN_F_CNT) - 1)
+    cnt += BsGetBits(bs, LEN_F_ESC) - 1;
+
+  while(cnt > 0)
+    cnt -= extension_payload(bs, cnt, prevEleID);
+}
+
+/*
+ * Reads program configuration element from the specified bitstream.
+ */
+int16
+GetPCE(TBitStream *bs, TProgConfig *p)
+{
+  int16 i;
+
+  p->pce_present = TRUE;
+  p->tag = (int16) BsGetBits(bs, LEN_TAG);
+  p->profile = (int16) BsGetBits(bs, LEN_PROFILE);
+  p->sample_rate_idx = (int16) BsGetBits(bs, LEN_SAMP_IDX);
+  p->front.num_ele = (int16) BsGetBits(bs, LEN_NUM_ELE);
+  p->side.num_ele = (int16) BsGetBits(bs, LEN_NUM_ELE);
+  p->back.num_ele = (int16) BsGetBits(bs, LEN_NUM_ELE);
+  p->lfe.num_ele = (int16) BsGetBits(bs, LEN_NUM_LFE);
+  p->data.num_ele = (int16) BsGetBits(bs, LEN_NUM_DAT);
+  p->coupling.num_ele = (int16) BsGetBits(bs, LEN_NUM_CCE);
+
+  p->mono_mix.present = (int16) BsGetBits(bs, 1);
+  if(p->mono_mix.present == 1)
+    p->mono_mix.ele_tag = (int16) BsGetBits(bs, LEN_TAG);
+
+  p->stereo_mix.present = (int16) BsGetBits(bs, 1);
+  if(p->stereo_mix.present == 1)
+    p->stereo_mix.ele_tag = (int16) BsGetBits(bs, LEN_TAG);
+
+  p->matrix_mix.present = (int16) BsGetBits(bs, 1);
+  if(p->matrix_mix.present == 1)
+  {
+    p->matrix_mix.ele_tag = (int16) BsGetBits(bs, LEN_MMIX_IDX);
+    p->matrix_mix.pseudo_enab = (int16) BsGetBits(bs, LEN_PSUR_ENAB);
+  }
+
+  for(i = 0; i < p->front.num_ele; i++)
+  {
+    p->front.ele_is_cpe[i] = (int16) BsGetBits(bs, LEN_ELE_IS_CPE);
+    p->front.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+  }
+
+  for(i = 0; i < p->side.num_ele; i++)
+  {
+    p->side.ele_is_cpe[i] = (int16) BsGetBits(bs, LEN_ELE_IS_CPE);
+    p->side.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+  }
+
+  for(i = 0; i < p->back.num_ele; i++)
+  {
+    p->back.ele_is_cpe[i] = (int16) BsGetBits(bs, LEN_ELE_IS_CPE);
+    p->back.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+  }
+
+  for(i = 0; i < p->lfe.num_ele; i++)
+  {
+    p->lfe.ele_is_cpe[i] = 0;
+    p->lfe.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+  }
+
+  for(i = 0; i < p->data.num_ele; i++)
+  {
+    p->data.ele_is_cpe[i] = 0;
+    p->data.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+  }
+
+  for(i = 0; i < p->coupling.num_ele; i++)
+  {
+    p->coupling.ele_is_cpe[i] = (int16) BsGetBits(bs, LEN_ELE_IS_CPE);
+    p->coupling.ele_tag[i] = (int16) BsGetBits(bs, LEN_TAG);
+  }
+
+  BsByteAlign(bs);
+
+  p->num_comment_bytes = (int16) BsGetBits(bs, LEN_COMMENT_BYTES);
+  BsSkipNBits(bs, p->num_comment_bytes << 3);
+
+  return (p->tag);
+}
+
+/**
+ * Saves the start position of the channel element within the AAC frame.
+ */
+static void
+SaveSBRChannelElementPos(SbrBitStream *sbrStream, uint32 bitOffset, uint32 ele_id)
+{
+  if(sbrStream->NrElements < MAX_NR_ELEMENTS)
+  {
+    /*-- Save starting position of the channel element. --*/
+    sbrStream->sbrElement[sbrStream->NrElements].elementOffset = bitOffset - 3;  
+    sbrStream->sbrElement[sbrStream->NrElements].ElementID = ele_id;
+  }
+}
+
+/**
+ * Saves the length of the channel element within the AAC frame.
+ */
+static void
+SaveSBRChannelElementLen(SbrBitStream *sbrStream, uint32 presentPos)
+{
+  if(sbrStream->NrElements < MAX_NR_ELEMENTS)
+  {
+    /*-- Save length of the channel element. --*/
+    sbrStream->sbrElement[sbrStream->NrElements].chElementLen = 
+      presentPos - sbrStream->sbrElement[sbrStream->NrElements].elementOffset;
+  }
+}
+/**************************************************************************
+  Title        : CountAACChunkLength
+
+  Purpose      : Counts the number of bytes reserved for the payload part of
+                 current AAC frame. This functions should only be called if
+                 no other methods exist to determine the payload legth
+                 (e.g., ADIF does not include this kind of information).
+
+  Usage        : y = CountAACChunkLength(bs, aac, bytesInFrame)
+
+  Input        : bs           - input bitstream
+                 aac          - AAC decoder parameters
+  
+  Output       : y            - status of operation
+                 bytesInFrame - # of bytes reserved for this frame
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C int16
+CountAACChunkLength(TBitStream *bs, CAACAudDec *aac, int16 *bytesInFrame)
+{
+  uint32 bitsRead;
+  int16 frameStatus;
+
+  /*-- Save the status of input bitstream. --*/
+  bitsRead = BsGetBitsRead(bs);
+
+  /*-- Parse the frame. --*/
+  frameStatus = (!GetAACGlobalGains(bs, aac, 15, NULL, NULL)) ? (int16) 0 : (int16) 1;
+  ResetMCInfo(aac->mc_info);
+
+  /*-- Determine the # of bytes for this frame. --*/
+  bitsRead = BsGetBitsRead(bs) - bitsRead;
+  *bytesInFrame = (int16) ((bitsRead >> 3) + ((bitsRead & 0x7) ? 1 : 0));
+
+  return (frameStatus);
+}
+
+/**************************************************************************
+  Title        : GetAACGlobalGains
+
+  Purpose      : Extracts 'global_gain' bitstream elements from the specified
+                 AAC data buffer.
+
+  Usage        : y = GetAACGlobalGains(bs, aac, nBufs, globalGain, globalGainPos)
+
+  Input        : bs            - input bitstream
+                 aac           - AAC decoder handle
+                 nBufs         - # of gain buffers present
+  
+  Output       : y             - # of gain elements extracted
+                 globalGain    - 'global_gain' elements
+                 globalGainPos - position location (in bits) of each gain value.
+                                 This information is used when storing the gain 
+                                 elements back to bitstream.
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C uint8
+GetAACGlobalGains(TBitStream* bs, CAACAudDec *aac, uint8 nBufs, uint8 *globalGain, uint32 *globalGainPos)
+{
+  uint8 numGains;
+  uint8 loopControl;
+  TProgConfig progCfg;
+  CMC_Info *mip = aac->mc_info;
+  uint32 ele_id, prevEleID, bufBitOffset;
+
+  numGains = 0;
+  loopControl = 0;
+  prevEleID = ID_END;
+  bufBitOffset = BsGetBitsRead(bs);
+
+  /*-- Reset some modules. --*/
+  ResetMCInfo(mip);
+
+  /*-- No SBR elements present by default. --*/
+  if(aac->sbrStream)
+    aac->sbrStream->NrElements = 0;
+
+  /*-- Loop until termination code found. --*/
+  while((ele_id = BsGetBits(bs, LEN_SE_ID)) != ID_END)
+  {
+    int16 parserErr;
+
+    if(loopControl > 64) break;
+
+    /*-- Get audio syntactic element. --*/
+    switch(ele_id)
+    {
+      /*-- Single and lfe channel. --*/
+      case ID_SCE:
+      case ID_LFE:
+        if((numGains + 1) > nBufs) break;
+
+        if(aac->sbrStream)
+          SaveSBRChannelElementPos(aac->sbrStream, BsGetBitsRead(bs) - bufBitOffset, ele_id);
+
+        if(globalGain)
+          parserErr = GetSCEGain(aac, bs, &globalGain[numGains], &globalGainPos[numGains], bufBitOffset);
+        else
+          parserErr = GetSCE(aac, bs, mip, NULL, NULL, 0);
+
+        if(parserErr < 0)
+          goto f_out;
+        numGains += 1;
+
+        if(aac->sbrStream)
+          SaveSBRChannelElementLen(aac->sbrStream, BsGetBitsRead(bs));
+        break;
+
+      /*-- Channel pair element. --*/
+      case ID_CPE:
+        if((numGains + 2) > nBufs) break;
+        if(aac->sbrStream)
+          SaveSBRChannelElementPos(aac->sbrStream, BsGetBitsRead(bs) - bufBitOffset, ele_id);
+
+        if(globalGain)
+          parserErr = GetCPEGain(aac, bs, &globalGain[numGains], &globalGainPos[numGains], bufBitOffset);
+        else
+          parserErr = GetCPE(aac, bs, mip, NULL, NULL, 0);
+
+        if(parserErr < 0)
+          goto f_out;
+        numGains += 2;
+
+        if(aac->sbrStream)
+          SaveSBRChannelElementLen(aac->sbrStream, BsGetBitsRead(bs));
+        break;
+
+      /*-- Coupling channel. --*/
+      case ID_CCE:
+        if(GetCCE(aac, bs, mip, aac->ccInfo) < 0)
+          goto f_out;
+        break;
+
+      /*-- Data element. --*/
+      case ID_DSE:
+        loopControl++;
+        GetDSE(bs);
+        break;
+
+      /*-- Program config element. --*/
+      case ID_PCE:
+        loopControl++;
+        GetPCE(bs, &progCfg);
+        break;
+
+      /*-- Fill element. --*/
+      case ID_FIL:
+        loopControl++;
+        TInt error;
+        TRAP( error, aac->GetFIL(bs, prevEleID) );
+        if (error != KErrNone)
+            goto f_out;
+        break;
+    
+      default:
+        goto f_out;
+    }
+
+    prevEleID = ele_id;
+
+    bufBitOffset = BsGetBitsRead(bs) - bufBitOffset;
+  }
+
+  BsByteAlign(bs);
+
+f_out:
+  
+  return (numGains);
+}
+
+/*
+ * Stores 'global_gain' bitstream elements to AAC data buffer.
+ */
+INLINE void 
+SetAACGain(TBitStream* bs, uint32 gainPos, uint8 globalGains)
+{  
+  BsSkipNBits(bs, gainPos); 
+  BsPutBits(bs, LEN_SCL_PCM, globalGains); 
+}
+
+/*
+ * Saves modified 'global_gain' bitstream elements to specified AAC data buffer.
+ */
+EXPORT_C void
+SetAACGlobalGains(TBitStream* bs, uint8 numGains, uint8 *globalGain, uint32 *globalGainPos)
+{
+  int16 i;
+  TBitStream bsIn;
+
+  BsSaveBufState(bs, &bsIn);
+
+  /*-- Store the gain element back to bitstream. --*/ 
+  for(i = 0; i < numGains; i++)
+    SetAACGain(bs, globalGainPos[i], globalGain[i]);
+
+  
+}
+
+/*
+ * Retrieves sample rate index corresponding to the specified sample rate.
+ */
+INLINE uint8
+GetSampleRateIndex(int32 sampleRate)
+{
+  uint8 sIndex = 0xF;
+
+  switch(sampleRate)
+  {
+    case 96000:
+      sIndex = 0x0;
+      break;
+
+    case 88200:
+      sIndex = 0x1;
+      break;
+
+    case 64000:
+      sIndex = 0x2;
+      break;
+
+    case 48000:
+      sIndex = 0x3;
+      break;
+
+    case 44100:
+      sIndex = 0x4;
+      break;
+
+    case 32000:
+      sIndex = 0x5;
+      break;
+
+    case 24000:
+      sIndex = 0x6;
+      break;
+
+    case 22050:
+      sIndex = 0x7;
+      break;
+
+    case 16000:
+      sIndex = 0x8;
+      break;
+
+    case 12000:
+      sIndex = 0x9;
+      break;
+
+    case 11025:
+      sIndex = 0xa;
+      break;
+
+    case 8000:
+      sIndex = 0xb;
+      break;
+  }
+
+  return (sIndex);
+}
+
+INLINE int16
+WriteGASpecificConfig(TBitStream *bsOut, int16 bitsWritten, int16 frameLen)
+{ 
+  /*-- Frame length flag (1024-point or 960-point MDCT). --*/
+  bitsWritten += 1;
+  BsPutBits(bsOut, 1, (frameLen == LN2) ? 0 : 1);
+  
+  /*-- No core coder. --*/
+  bitsWritten += 1;
+  BsPutBits(bsOut, 1, 0);
+  
+  /*-- No extension flag. --*/
+  bitsWritten += 1;
+  BsPutBits(bsOut, 1, 0);
+  
+  return (bitsWritten);
+}
+
+
+
+EXPORT_C int16
+AACGetMP4ConfigInfo(int32 sampleRate, uint8 profile, uint8 nChannels, 
+                    int16 frameLen, uint8 *pBuf, uint8 nBytesInBuf)
+{
+  TBitStream bsOut;
+  int16 nConfigBytes, bitsWritten;
+
+  BsInit(&bsOut, pBuf, nBytesInBuf);
+
+  /*-- Object type. --*/
+  bitsWritten = 5;
+  BsPutBits(&bsOut, 5, profile + 1);
+
+  /*-- Sample rate index. --*/
+  bitsWritten += 4;
+  BsPutBits(&bsOut, 4, GetSampleRateIndex(sampleRate));
+  if(GetSampleRateIndex(sampleRate) == 0xF)
+  {
+    bitsWritten += 24;
+    BsPutBits(&bsOut, 24, sampleRate);
+  }
+  
+  /*-- # of channels. --*/
+  bitsWritten += 4;
+  BsPutBits(&bsOut, 4, nChannels);
+
+  /*-- Write GA specific info. --*/
+  bitsWritten = WriteGASpecificConfig(&bsOut, bitsWritten, frameLen);
+
+  nConfigBytes = int16 ((bitsWritten & 7) ? (bitsWritten >> 3) + 1 : (bitsWritten >> 3));
+
+  return (nConfigBytes);
+}
+
+/*
+ * Saves modified 'global_gain' bitstream elements to specified AAC data buffer.
+ */
+EXPORT_C void
+SetAACPlusGlobalGains(TBitStream* bs, TBitStream* bsOut, CAACAudDec *aac, int16 gainChangeValue, 
+                  uint8 numGains, uint8 *globalGain, uint32 *globalGainPos)
+    {
+    int16 i;
+    TBitStream bsIn;
+
+    BsSaveBufState(bs, &bsIn);
+
+    /*-- Store the gain element back to bitstream. --*/ 
+    for(i = 0; i < numGains; i++)
+        {
+        SetAACGain(bs, globalGainPos[i], globalGain[i]);
+        }
+        
+
+    if(aac->sbrStream && aac->sbrDecInfo)
+          {
+    
+        if(aac->sbrStream->NrElements)
+            {
+              ParseSBR(&bsIn, bsOut, aac->sbrDecInfo, aac->sbrStream, gainChangeValue);
+            }
+      
+      
+        }
+
+      }
+
+
+EXPORT_C uint8
+IsAACParametricStereoEnabled(CAACAudDec *aac)
+    {
+
+    return (IsSBRParametricStereoEnabled(aac->sbrDecInfo, aac->sbrStream));
+
+    }
+
+EXPORT_C uint8
+IsAACSBREnabled(CAACAudDec *aac)
+    {
+
+    return (IsSBREnabled(aac->sbrStream));
+
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/aacdef.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#include "aacdef.h"
+
+CWindowInfo* CWindowInfo::NewL()
+    {
+
+    CWindowInfo* self = new (ELeave) CWindowInfo();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+CWindowInfo::~CWindowInfo()
+    {
+    if (group != 0) delete[] group;
+    if (mask != 0) delete[] mask;
+    if (sfac != 0) delete[] sfac;
+    if (cb_map != 0) delete[] cb_map;
+    if (lpflag != 0) delete[] lpflag;
+
+    }
+
+CWindowInfo::CWindowInfo()
+    {
+
+    }
+
+void CWindowInfo::ConstructL()
+    {
+
+    group = new (ELeave) uint8[NSHORT];
+    mask = new (ELeave) uint8[MAXBANDS];
+    sfac = new (ELeave) int16[MAXBANDS];
+    cb_map = new (ELeave) uint8[MAXBANDS];
+    lpflag= new (ELeave) int16[MAXBANDS];
+
+    }
+
+CMC_Info* CMC_Info::NewL()
+    {
+
+    CMC_Info* self = new (ELeave) CMC_Info();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+CMC_Info::~CMC_Info()
+    {
+    if (sfbInfo != 0) delete sfbInfo;
+    }
+
+CMC_Info::CMC_Info()
+    {
+
+    }
+
+void CMC_Info::ConstructL()
+    {
+    sfbInfo = CSfb_Info::NewL();
+
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/chandefs.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "chandefs.h"
+
+CInfo* CInfo::NewL()
+    {
+
+    CInfo* self = new (ELeave) CInfo();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+
+void CInfo::ConstructL()
+    {
+
+    bins_per_sbk = new (ELeave) int16[MAX_SBK];
+    sfb_per_sbk = new (ELeave) int16[MAX_SBK];
+    bk_sfb_top = new (ELeave) int16[200];
+    group_len = new (ELeave) int16[NSHORT];
+    group_offs = new (ELeave) int16[NSHORT];
+
+    }
+
+CInfo::CInfo()
+    {
+
+    }
+
+CInfo::~CInfo()
+    {
+
+    if (bins_per_sbk != 0) delete[] bins_per_sbk;
+    if (sfb_per_sbk != 0) delete[] sfb_per_sbk;
+    if (bk_sfb_top != 0) delete[] bk_sfb_top;
+    if (group_len != 0) delete[] group_len;
+    if (group_offs != 0) delete[] group_offs;
+
+    }
+
+
+CSfb_Info* CSfb_Info::NewL(uint8 isEncoder)
+    {
+
+    CSfb_Info* self = new (ELeave) CSfb_Info();
+    CleanupStack::PushL(self);
+    self->ConstructL(isEncoder);
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+
+void CSfb_Info::ConstructL(uint8 isEncoder)
+    {
+
+    only_long_info = CInfo::NewL();
+    eight_short_info = CInfo::NewL();
+
+    if(isEncoder)
+        {
+        int16 i;
+
+        /*-- Allocate SFB data. --*/
+        sect_sfb_offsetL = (int16 *) new (ELeave) int16[MAXLONGSFBBANDS];
+
+        sect_sfb_offsetS = (int16 *) new (ELeave) int16[MAXSHORTSFBBANDS];
+
+        for(i = 0; i < NSHORT; i++)
+            {
+            sect_sfb_offsetS2[i] = (int16 *) new (ELeave) int16[MAXSHORTSFBBANDS];    
+            }
+      
+          }
+
+    }
+
+CSfb_Info::CSfb_Info()
+    {
+    int16 i;
+
+    only_long_info = 0;
+    eight_short_info = 0;
+    
+    /*-- Scalefactor offsets. --*/
+    sect_sfb_offsetL = 0;
+    sect_sfb_offsetS = 0;
+    sfbOffsetTablePtr[0] = sfbOffsetTablePtr[1] = 0;
+  
+    for(i = 0; i < NSHORT; i++)
+        {
+        sect_sfb_offsetS2[i] = 0;
+        }
+        
+
+    }
+
+CSfb_Info::~CSfb_Info()
+
+    {
+      int16 i;
+
+    if (only_long_info != 0) 
+        {
+        delete only_long_info;
+          only_long_info = 0;
+        
+        }
+    
+    if (eight_short_info != 0) 
+        {
+        delete eight_short_info;
+        eight_short_info = 0;
+        
+        }
+    
+    if(sect_sfb_offsetL != 0)
+        {
+        delete[] sect_sfb_offsetL;
+          sect_sfb_offsetL = 0;
+        
+        }
+    
+    if(sect_sfb_offsetS != 0)
+        {
+        delete[] sect_sfb_offsetS;
+        sect_sfb_offsetS = 0;
+        
+        }
+    
+    for(i = 0; i < NSHORT; i++)
+        {
+        if(sect_sfb_offsetS2[i] != 0)
+            {
+            delete[] sect_sfb_offsetS2[i];
+            sect_sfb_offsetS2[i] = 0;
+
+            }
+          }
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/coupling.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  coupling.cpp - Coupling channel implementations (parsing only!).
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2000-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/*-- System Headers. --*/
+#include <math.h>
+
+/*-- Project Headers. --*/
+#include "tool2.h"
+#include "defines.h"
+
+int16
+GetCCE(CAACAudDec *aac, TBitStream *bs, CMC_Info *mip, CCInfo **ccInfo)
+{
+  TCh_Info cip;
+  CToolInfo *tool;
+  CWindowInfo *ccWin;
+  int16 i, j, tag, cidx, ch, nele, nch;
+  int16 shared[2 * ((LEN_NCC << 3) + 1)], global_gain;
+
+  ZERO_MEMORY(&cip, sizeof(TCh_Info));
+
+  /*-- Get (dummy) channel index for this coupling channel. --*/
+  cidx = mip->dummyCCh;
+
+  tool = ccInfo[cidx]->tool;
+  ccWin = ccInfo[cidx]->winInfo;
+
+  tag = (int16) BsGetBits(bs, LEN_TAG);
+  mip->cc_ind[cidx] = (int16) BsGetBits(bs, LEN_IND_SW_CCE);
+
+  /*-- Coupled (target) elements. --*/
+  ZERO_MEMORY(shared, sizeof(shared));
+  nele = (int16) BsGetBits(bs, LEN_NCC);
+  for(i = 0, nch = 0; i < nele + 1; i++)
+  {
+    int16 cpe;
+    
+    cpe = (int16) BsGetBits(bs, LEN_IS_CPE);
+    tag = (int16) BsGetBits(bs, LEN_TAG);
+    ch = CCChIndex(mip, cpe, tag);
+
+    if(!cpe)
+      shared[nch++] = 0;
+    else
+    {
+      int16 cc_l = (int16) BsGetBits(bs, LEN_CC_LR);
+      int16 cc_r = (int16) BsGetBits(bs, LEN_CC_LR);
+      j = (int16) ((cc_l << 1) | cc_r);
+
+      switch(j)
+      {
+        /*-- Shared gain list. --*/
+        case 0:
+          shared[nch] = 1;
+          shared[nch + 1] = 1;
+          nch += 2;
+          break;
+ 
+        /*-- Left channel gain list. --*/
+        case 1:
+          shared[nch] = 0;
+          nch += 1;
+          break;
+
+        /*-- Right channel gain list. --*/
+        case 2:
+          shared[nch] = 0;
+          nch += 1;
+          break;
+
+        /*-- Two gain lists. --*/
+        case 3:
+          shared[nch] = 0;
+          shared[nch + 1] = 0;
+          nch += 2;
+          break;
+      
+        default:
+          shared[nch] = 0;
+          shared[nch + 1] = 0;
+          break;
+      }
+    }
+  }
+  
+  int16 cc_dom = (int16) BsGetBits(bs, LEN_CC_DOM);
+  int16 cc_gain_ele_sign = (int16) BsGetBits(bs, LEN_CC_SGN);
+  int16 scl_idx = (int16) BsGetBits(bs, LEN_CCH_GES);
+
+  /*-- Global gain. --*/
+  global_gain = (int16) BsGetBits(bs, LEN_SCL_PCM);
+
+  /*-- Side information. --*/
+  if(!GetICSInfo(bs, ccWin, tool->ltp, NULL))
+    return (-1);
+  
+  cip.info = mip->sfbInfo->winmap[ccWin->wnd];
+  
+  /*-- Channel parameters. --*/
+  if (cip.sf_huf == 0) return (-1);
+  if(!GetICS(bs, &cip, ccWin->group, ccWin->max_sfb, ccWin->cb_map, 
+             tool->quant, global_gain, ccWin->sfac))
+    return (-1);
+  
+  /*-- Coupling for first target channel(s) is already at correct scale. --*/
+  ch = shared[0] ? (int16) 2 : (int16) 1;
+
+  /*-- Bitstreams for target channel scale factors. --*/
+  for( ; ch < nch; ch++)
+  {
+    /*-- If needed, get common gain elment present. --*/
+    int16 cgep = (mip->cc_ind[cidx]) ? (int16) 1 : (int16) BsGetBits(bs, LEN_CCH_CGP);
+
+    if(cgep) 
+      int16 fac = (int16) (GetHcb(aac->sf_huf, bs) - MIDFAC);
+    
+    /*-- Must be dependently switched CCE. --*/
+    else
+      if(!huf_sfac(bs, &cip, ccWin->group, ccWin->cb_map, 0, ccWin->sfac, ccWin->max_sfb))
+        return (-1);
+  }
+
+  return (TRUE);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/dec_huftables.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  dec_huftables.cpp - Huffman tables for AAC decoder.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2000-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/*-- Project Headers. --*/
+#include "dec_huf.h"
+#include "defines.h"
+#include "dec_const.h"
+
+/**************************************************************************
+   Internal Objects
+  *************************************************************************/
+
+/*
+   Purpose:      Number of Huffman items within each codebook.
+   Explanation:  - */
+
+
+/*
+ * Deletes resources allocated to the Huffman codebooks.
+ */
+void
+CloseHuffmanDecTables(Huffman_DecInfo **huf)
+{
+  if(huf)
+  {
+    int16 i;
+    
+    for(i = 0; i < MAX_AAC_QHUFTABLES; i++)
+    {
+      if(huf[i] != 0)
+        delete huf[i];
+      huf[i] = NULL;
+    }
+    
+    delete[] huf;
+    huf = NULL;
+  }
+}
+
+/**************************************************************************
+  Title:      LoadHuffmanDecTablesL
+
+  Purpose:    Loads Huffman spectral codebooks for AAC decoder.
+
+  Usage:      y = LoadHuffmanDecTablesL()
+
+  Output:     y - spectral codebooks
+
+  Author(s):  Juha Ojanpera
+  *************************************************************************/
+
+Huffman_DecInfo **
+LoadHuffmanDecTablesL(void)
+{
+
+    /*
+  Purpose:      Array holding the AAC Huffman decoding codebooks.
+  Explanation:  - */
+const Huffman_DecCode *dec_huffman_tables[] = {
+  dec_hftable1, dec_hftable2, dec_hftable3, dec_hftable4, dec_hftable5, 
+  dec_hftable6, dec_hftable7, dec_hftable8, dec_hftable9, dec_hftable10, 
+  dec_hftable11
+};
+
+
+  int16 i;
+  Huffman_DecInfo **huf;
+  const Huffman_DecCode **hf_code;
+
+  huf = (Huffman_DecInfo **) new (ELeave) Huffman_DecInfo*[MAX_AAC_QHUFTABLES];
+  CleanupStack::PushL(huf);
+
+  ZERO_MEMORY(huf, MAX_AAC_QHUFTABLES * sizeof(Huffman_DecInfo *));
+  
+  hf_code = dec_huffman_tables;
+  for(i = 0; i < MAX_AAC_QHUFTABLES; i++)
+  {
+    huf[i] = (Huffman_DecInfo *) new (ELeave) Huffman_DecInfo[1];
+    CleanupStack::PushL(huf[i]);
+
+    ZERO_MEMORY(huf[i], sizeof(Huffman_DecInfo));
+    
+    huf[i]->huf = hf_code[i];
+    
+    huf[i]->cb_len = cb_len[i];
+  }
+
+  CleanupStack::Pop(MAX_AAC_QHUFTABLES + 1);
+  
+  return (huf);
+}
+
+/*
+ * Deletes resources allocated to the Huffman scalefactor codebook.
+ */
+void
+CloseSfHuffmanTable(Huffman_DecSfInfo *sfHuf)
+{
+  if(sfHuf)
+  {
+    delete sfHuf;
+    sfHuf = NULL;
+  }
+}
+
+/**************************************************************************
+  Title:      LoadSfHuffmanTableL
+
+  Purpose:    Loads Huffman scalefactor codebook for AAC decoder.
+
+  Usage:      y = LoadSfHuffmanTableL()
+
+  Output:     y - scalefactor codebook
+
+  Author(s):  Juha Ojanpera
+  *************************************************************************/
+
+Huffman_DecSfInfo *
+LoadSfHuffmanTableL(void)
+{
+  Huffman_DecSfInfo *huf;
+
+  huf = (Huffman_DecSfInfo *) new (ELeave) Huffman_DecSfInfo[1];
+
+  ZERO_MEMORY(huf, sizeof(Huffman_DecSfInfo));
+
+  huf->cb_len = cb_len[11];
+
+  huf->sf_param = dec_hftable12;
+
+  return (huf);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/huffdec1.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,454 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  huffdec1.cpp - Bit parsing routines for decoding LFE, SCE and CPE audio elements.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2000-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/*-- Project Headers. --*/
+#include "tool.h"
+#include "tool2.h"
+
+#define SCE_START_BITS (LEN_TAG + LEN_SCL_PCM)
+#define CPE_START_BITS (LEN_TAG + LEN_COM_WIN)
+
+/**************************************************************************
+  Title:        getmask
+
+  Purpose:      Reads MS mask and MS flag bits from the bitstream.
+
+  Usage:        y = getmask(bs, info, group, max_sfb, mask)
+
+  Input:        bs      - bitstream parameters
+                info    - block (long/short) parameters
+                group   - grouping info for short blocks
+                max_sfb - # of sfb's present in the channel pair
+
+  Output:       y       - value of MS mask in the bitstream
+                mask    - flag bit for each sfb (only if y == 1)
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+INLINE int16
+getmask(TBitStream *bs, CInfo *info, uint8 *group, uint8 max_sfb, uint8 *mask)
+{
+  int16 b, i, mp;
+  
+  mp = (int16) BsGetBits(bs, LEN_MASK_PRES);
+  
+  /*--Get mask. --*/
+  if(mp == 1)
+  {
+    for(b = 0; b < info->nsbk; b = *group++)
+    {
+      int16 sfb;
+      uint32 tmp, flag;
+
+#if 1
+      /*
+       * Speed up the reading of the flags.
+       */
+      sfb = max_sfb;
+      if(sfb > 32) sfb = 32;
+      flag = 1 << (sfb - 1);
+      tmp = BsGetBits(bs, sfb);
+      
+      for(i = 0; i < sfb; i++, mask++, flag >>= 1)
+        *mask = (tmp & flag) ? (uint8) 1 : (uint8) 0;
+
+      if(sfb == 32)
+      {
+        sfb = int16(max_sfb - 32);
+        flag = 1 << (sfb - 1);
+        tmp = BsGetBits(bs, sfb);
+
+        for( ; i < max_sfb; i++, mask++, flag >>= 1)
+          *mask = (tmp & flag) ? (uint8) 1 : (uint8) 0;
+      }
+
+#else
+      for(i = 0; i < max_sfb; i++, mask++)
+        *mask = (uint8) BsGetBits(bs, LEN_MASK);
+      mask += info->sfb_per_sbk[0] - i;
+#endif
+    }
+  }
+  else if(mp == 2)
+  {
+    for(b = 0; b < info->nsbk; b = *group++)
+    {
+      SET_MEMORY(mask, max_sfb, 1);
+      mask += info->sfb_per_sbk[0];
+    }
+  }
+  else
+  {
+    for(b = 0; b < info->nsbk; b = *group++)
+    {
+      ZERO_MEMORY(mask, max_sfb);
+      mask += info->sfb_per_sbk[0];
+    }
+  }
+  
+  return (mp);
+}
+
+/**************************************************************************
+  Object Definitions
+  *************************************************************************/
+
+/**************************************************************************
+  Title:        GetSCE
+
+  Purpose:      Decodes LFE/SCE audio element from the bitstream.
+
+  Usage:        y = GetSCE(aac, bs, mip, gains, gainPos, bufBitOffset)
+
+  Input:        bs           - bitstream parameters
+                bufBitOffset - # of bits read read so far
+
+  Output:       y            - 0 on success, -1 otherwise
+                mip
+                  ch_info    - channel mapping parameters
+                aac
+                  winInfo    - block/window parameters for each channel
+                  toolInfo
+                    quant    - quantized spectral coefficients
+                gains        - 'global_gain' bitstream element
+                gainPos      - location of 'global_gain' within the bitstream
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+int16
+GetSCE(CAACAudDec *aac, TBitStream *bs, CMC_Info *mip, uint8 *gains, 
+       uint32 *gainPos, uint32 bufBitOffset)
+{
+  int16 ch, global_gain;
+  CWindowInfo **winInfo;
+  CToolInfo **toolInfo;
+  CWindowInfo *win;
+  CToolInfo *tool;
+  TCh_Info *cip;
+  uint32 tmp;
+
+  toolInfo = aac->tool;
+  winInfo = aac->winInfo;
+
+  tmp = BsGetBits(bs, SCE_START_BITS);
+  
+  ch = ChIndex(1, (int16) (tmp >> LEN_SCL_PCM), 0, mip);
+  cip = &mip->ch_info[ch];
+  tool = toolInfo[ch];
+  win = winInfo[ch];
+
+  /*-- Global gain. --*/
+  global_gain = (int16) (tmp & 0xFF);
+
+  /*-- Save global gain element and its position. --*/
+  if(gainPos)
+  {
+    gains[0] = (uint8) global_gain;
+    gainPos[0] = BsGetBitsRead(bs) - bufBitOffset - LEN_SCL_PCM;
+  }
+
+  if(!GetICSInfo(bs, win, tool->ltp, NULL)) return (-1);
+  
+  cip->info = mip->sfbInfo->winmap[win->wnd];
+
+  win->hasmask = 0;
+  tool = toolInfo[ch];
+
+  if(!GetICS(bs, cip, win->group, win->max_sfb, win->cb_map,
+             tool->quant, global_gain, win->sfac))
+    return (-1);
+
+  return (0);
+}
+
+/**************************************************************************
+  Title:        GetCPE
+
+  Purpose:      Decodes CPE audio element from the bitstream.
+
+  Usage:        y = GetCPE(aac, bs, mip, gains, gainPos, bufBitOffset
+
+  Input:        bs           - bitstream parameters
+                bufBitOffset - # of bits read read so far
+
+  Output:       y            - 0 on success, -1 otherwise
+                mip
+                  ch_info    - channel mapping parameters
+                aac
+                  winInfo    - block/window parameters for each channel
+                  toolInfo
+                    quant    - quantized spectral coefficients
+                gains        - 'global_gain' bitstream element
+                gainPos      - location of 'global_gain' within the bitstream
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+int16
+GetCPE(CAACAudDec *aac, TBitStream *bs, CMC_Info *mip, uint8 *gains, 
+       uint32 *gainPos, uint32 bufBitOffset)
+{
+  int16 i, common_window, ch;
+  CWindowInfo **winInfo;
+  CToolInfo **toolInfo;
+  int16 global_gain;
+  CWindowInfo *win;
+  CToolInfo **tool;
+  TCh_Info *cip;
+
+  toolInfo = aac->tool;
+  winInfo = aac->winInfo;
+
+  uint16 tmp = (uint16) BsGetBits(bs, CPE_START_BITS);
+  
+  common_window = (int16) (tmp & 0x1);
+  
+  ch = ChIndex(2, (int16) (tmp >> 1), common_window, mip);
+  
+  if(common_window)
+  {
+    win = winInfo[ch];
+    
+    if(!GetICSInfo(bs, win, toolInfo[ch]->ltp, toolInfo[ch + 1]->ltp))
+      return (-1);
+    
+    win->hasmask = (uint8) getmask(bs, mip->sfbInfo->winmap[win->wnd], win->group, win->max_sfb, win->mask);
+  }
+  else
+    winInfo[ch]->hasmask = winInfo[ch + 1]->hasmask = 0;
+
+  tool = toolInfo + ch;
+  cip = &mip->ch_info[ch];
+  for(i = ch; i < ch + 2; i++, cip++, tool++)
+  {
+    CWindowInfo *wi = winInfo[i];
+
+    win = winInfo[cip->widx];
+    
+    /*-- Global gain. --*/
+    global_gain = (int16) BsGetBits(bs, LEN_SCL_PCM);
+
+    /*-- Save global gain element and its position. --*/
+    if(gainPos)
+    {
+      gains[i - ch] = (uint8) global_gain;
+      gainPos[i - ch] = BsGetBitsRead(bs) - bufBitOffset - LEN_SCL_PCM;
+      bufBitOffset = BsGetBitsRead(bs);
+    }
+
+    if(!common_window)
+      if(!GetICSInfo(bs, win, (*tool)->ltp, NULL))
+        return (-1);
+
+    cip->info = mip->sfbInfo->winmap[win->wnd];
+
+    if(!GetICS(bs, cip, win->group, win->max_sfb, wi->cb_map, 
+               (*tool)->quant, global_gain, wi->sfac))
+      return (-1);
+  }
+  
+  return (0);
+}
+
+/**************************************************************************
+  Title       : LTP_Decode
+
+  Purpose     :    Decodes the bitstream elements for LTP tool.
+
+  Usage       : LTP_Decode(bs, ltp_info, max_sfb)
+
+  Input       : bs       - input bitstream
+                max_sfb  - # scalefactor bands to be used for current frame
+
+  Output      : ltp_info - LTP parameters for this channel
+
+  Author(s)   : Juha Ojanpera
+  *************************************************************************/
+
+INLINE void
+LTP_Decode(TBitStream *bs, CLTP_Info *ltp_info, int16 max_sfb)
+{
+  /*
+  Purpose:    1 bits is used to indicate the presence of LTP. */
+#define    LEN_LTP_DATA_PRESENT 1
+
+/*
+  Purpose:    # of bits used for the pitch lag. */
+#define    LEN_LTP_LAG 11
+
+/*
+  Purpose:    # of bits used for the gain value. */
+#define    LEN_LTP_COEF 3
+
+  ltp_info->ltp_present = (uint8) BsGetBits(bs, LEN_LTP_DATA_PRESENT);
+  if(ltp_info->ltp_present)
+  {
+    uint32 bits = BsGetBits(bs, LEN_LTP_LAG + LEN_LTP_COEF);
+
+    /*-- LTP lag. --*/
+    ltp_info->delay[0] = (int16) (bits >> LEN_LTP_COEF);
+    
+    /*-- LTP gain. --*/
+    ltp_info->cbIdx = (uint8) (bits & 0x7);
+
+    /*-- Sfb flags. --*/
+    ltp_info->max_sfb = max_sfb;
+    if(max_sfb < 33)
+      ltp_info->sfbflags[0] = BsGetBits(bs, max_sfb);
+    else
+    {
+      ltp_info->sfbflags[0] = BsGetBits(bs, 32);
+      ltp_info->sfbflags[1] = BsGetBits(bs, (int16) (max_sfb - 32));
+    }
+  }
+}
+
+/**************************************************************************
+  Title:        GetICSInfo
+
+  Purpose:      Reads side information for individual channel element.
+                Individual channel elements within channel pair element may 
+                share this information.
+
+  Usage:        y = GetICSInfo(bs, winInfo, ltp_left, ltp_right)
+
+  Input:        bs         - bitstream parameters
+
+  Output:       y          - # of sfb's present in this channel
+                winInfo :
+                 wnd       - window type for this channel
+                 wshape    - window shape for this channel
+                 group     - grouping of short blocks
+                 lpflag    - BWAP prediction flags for each sfb
+                 prstflag  - reset flags for BWAP
+                ltp_left   - LTP parameters for left channel of the audio element
+                ltp_right  - LTP parameters for right channel of the audio element
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+int16
+GetICSInfo(TBitStream *bs, CWindowInfo *winInfo, CLTP_Info *ltp_left, CLTP_Info *ltp_right)
+{
+#define INFO_BITS (LEN_ICS_RESERV + LEN_WIN_SEQ + LEN_WIN_SH + LEN_MAX_SFBL + LEN_PRED_PRES)
+  int16 i, j;
+  uint32 tmp;
+
+  tmp =  BsGetBits(bs, INFO_BITS);
+  winInfo->wnd = (uint8) ((tmp >> 8) & 0x3);
+  winInfo->wshape[0].this_bk = (uint8) ((tmp >> 7) & 0x1);
+
+  /*-- Max scalefactor, scalefactor grouping and prediction flags. --*/
+  winInfo->prstflag[0] = 0;
+  if(winInfo->wnd == 2)
+  {
+    tmp <<= 4;
+    tmp |= BsGetBits(bs, 4);
+    winInfo->max_sfb = (uint8) ((tmp >> 7) & 0xF);
+    if(winInfo->max_sfb > MAXLONGSFBBANDS) return (FALSE);
+
+    /*-- Get grouping info for short blocks. --*/
+    j = 0;
+    if(!(tmp & 64)) winInfo->group[j++] = 1;
+    if(!(tmp & 32)) winInfo->group[j++] = 2;
+    if(!(tmp & 16)) winInfo->group[j++] = 3;
+    if(!(tmp & 8))  winInfo->group[j++] = 4;
+    if(!(tmp & 4))  winInfo->group[j++] = 5;
+    if(!(tmp & 2))  winInfo->group[j++] = 6;
+    if(!(tmp & 1))  winInfo->group[j++] = 7;
+    winInfo->group[j] = NSHORT;
+
+    /*-- Prediction (BWAP) is disabled. --*/
+    winInfo->lpflag[0] = 0;
+  }
+  else
+  {    
+    winInfo->group[0] = 1;
+    winInfo->max_sfb = (uint8) ((tmp >> 1) & 0x3F);
+    if(winInfo->max_sfb > MAXLONGSFBBANDS) return (FALSE);
+
+    if(winInfo->predType == BWAP_PRED)
+    {
+      /*-- Read BWAP predictor parameters. --*/
+      winInfo->lpflag[0] = (uint8) (tmp & 0x1);
+      if(winInfo->lpflag[0])
+      {
+        /*-- Predictor reset pattern. --*/
+        winInfo->prstflag[0] = (uint8) BsGetBits(bs, LEN_PRED_RST);
+        if(winInfo->prstflag[0])
+          winInfo->prstflag[1] = (uint8) BsGetBits(bs, LEN_PRED_RSTGRP);
+    
+        /*-- Sfb flags for each predictor band. --*/
+        j = (winInfo->max_sfb < winInfo->predBands) ? winInfo->max_sfb : winInfo->predBands;
+    
+        for(i = 1; i < j + 1; i++)
+          winInfo->lpflag[i] = (uint8) BsGetBits(bs, LEN_PRED_ENAB);
+
+        for(; i < winInfo->predBands + 1; i++)
+          winInfo->lpflag[i] = 0;
+      }
+    }
+
+    else if(winInfo->predType == LTP_PRED)
+    {
+      /*-- Is LTP used in this channel ? --*/
+      ltp_left->ltp_present = (uint8) (tmp & 1);
+      if(ltp_left->ltp_present)
+      {
+        int16 nbands = MIN(winInfo->max_sfb, winInfo->predBands);
+        LTP_Decode(bs, ltp_left, nbands);
+        if(ltp_right)
+          LTP_Decode(bs, ltp_right, nbands);
+      }
+      else if(ltp_right) ltp_right->ltp_present = 0;
+    }
+    
+    /*-- Bitstream syntax error. --*/
+    else if(tmp & 0x1) return (FALSE);
+  }
+
+  return (TRUE);
+}
+
+/*
+ * Retrieves 'global_gain' bitstream elements from single channel element.
+ */
+int16
+GetSCEGain(CAACAudDec *aac, TBitStream *bs, uint8 *gains, uint32 *gainPos, uint32 bufBitOffset)
+{ 
+  return GetSCE(aac, bs, aac->mc_info, gains, gainPos, bufBitOffset);
+}
+
+/*
+ * Retrieves 'global_gain' bitstream elements from channel pair element.
+ */
+int16 
+GetCPEGain(CAACAudDec *aac, TBitStream *bs, uint8 *gains, uint32 *gainPos, uint32 bufBitOffset)
+{
+  return GetCPE(aac, bs, aac->mc_info, gains, gainPos, bufBitOffset);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/huffdec2.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,320 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  huffdec2.cpp - Bit parsing routines for decoding individual channel elements.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2000-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/*-- Project Headers. --*/
+#include "tool2.h"
+
+/**************************************************************************
+  Title:        calc_gsfb_table
+
+  Purpose:      Calculates reordering parameters for short blocks.
+
+  Usage:        calc_gsfb_table(info, group)
+
+  Input:        info  - block (long/short) parameters
+                group - grouping info for short blocks
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+INLINE void
+calc_gsfb_table(CInfo *info, uint8 *group)
+{
+  int16 group_offset, group_idx, offset;
+  int16 sfb, len, *group_offset_p;
+
+  /*-- First calc the group length. --*/
+  group_offset = 0;
+  group_idx = 0;
+  do
+  {
+    info->group_len[group_idx] = (int16) (group[group_idx] - group_offset);
+    group_offset = group[group_idx];
+    group_idx++;
+  }
+  while(group_offset < NSHORT);
+  
+  info->num_groups = group_idx;
+  group_offset_p = info->bk_sfb_top;
+  offset = 0;
+  for(group_idx = 0; group_idx < info->num_groups; group_idx++)
+  {
+    len = info->group_len[group_idx];
+    for(sfb = 0; sfb < info->sfb_per_sbk[group_idx]; sfb++)
+    {
+      offset += info->sfb_width_128[sfb] * len;
+      *group_offset_p++ = offset;
+    }
+  }
+}
+
+/**************************************************************************
+  Title:        get_pulse_nc
+
+  Purpose:      Reads pulse data from the bitstream.
+
+  Usage:        get_pulse_nc(bs, pulse_info)
+
+  Input:        bs - bitstream parameters
+
+  Output:       pulse_info - pulse data parameters for this channel
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+INLINE void
+get_pulse_nc(TBitStream *bs, PulseInfo *pulse_info)
+{
+  int16 i, mask;
+
+  mask = (1 << LEN_PULSE_PAMP) - 1;
+  pulse_info->number_pulse = (int16) BsGetBits(bs, LEN_PULSE_NPULSE);
+  pulse_info->pulse_start_sfb = (int16) BsGetBits(bs, LEN_PULSE_ST_SFB);
+
+  for(i = 0; i < pulse_info->number_pulse + 1; i++)
+  {
+    uint32 codeword;
+
+    codeword = BsGetBits(bs, LEN_PULSE_POFF + LEN_PULSE_PAMP);
+
+    pulse_info->pulse_offset[i] = (int16) (codeword >> LEN_PULSE_PAMP);
+    pulse_info->pulse_amp[i] = (int16) (codeword & mask);
+  }
+}
+
+/**************************************************************************
+  Title:        huf_cb
+
+  Purpose:      Reads the Huffman codebook number and boundaries for each section.
+
+  Usage:        y = huf_cb(bs, sect, info, tot_sfb, max_sfb, cb_map)
+
+  Input:        bs      - bitstream parameters
+                info    - block (long/short) parameters
+                tot_sfb - total # of sfb's present
+                max_sfb - max # of sfb's per block present
+
+  Output:       y      - # of sections
+                sect   - sectioning info (cb, cb_length; cb, cb_length; ...)
+                cb_map - Huffman codebook number for each sfb
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+INLINE int16
+huf_cb(TBitStream *bs, uint8 *sect, CInfo *info, int16 tot_sfb, uint8 max_sfb, uint8 *cb_map)
+{
+  int16 nsect, n, base, bits, len, cb, diff, cb_len, bot;
+
+  bits = (info->islong) ? (int16) LONG_SECT_BITS : (int16) SHORT_SECT_BITS;
+
+  nsect = 0;
+  len = (int16) ((1 << bits) - 1);
+  diff = info->sfb_per_sbk[0] - max_sfb;
+
+  for(bot = base = 0; base < tot_sfb && nsect < tot_sfb; )
+  {
+    *sect++ = uint8(cb = BsGetBits(bs, LEN_CB));
+
+    n = BsGetBits(bs, bits);
+    while(n == len && base < tot_sfb)
+    {
+      base += len;
+      n = BsGetBits(bs, bits);
+    }
+    base += n; 
+    *sect++ = uint8(base); 
+    nsect++;
+
+    cb_len = base - bot; SET_MEMORY(cb_map, cb_len, cb); cb_map += cb_len;
+    
+    if(base == max_sfb)
+    {
+      base += diff;
+      if(info->islong) break;
+
+      if(diff)
+      {
+        *sect++ = 0; *sect++ = uint8(base);
+        ZERO_MEMORY(cb_map, diff); cb_map += diff;
+        nsect++;
+      }
+      max_sfb += info->sfb_per_sbk[0];
+    }
+    bot = base;
+  }
+  
+  if(base != tot_sfb || nsect > tot_sfb)
+    nsect = -1;
+  
+  return (nsect);
+}
+
+/**************************************************************************
+  Title:        TNS_Decode
+
+  Purpose:      Reads TNS bitstream elements.
+
+  Usage:        TNS_Decode(bs, info)
+
+  Input:        bs   - bitstream parameters
+                info - block (long/short) parameters
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+INLINE void
+TNS_Decode(TBitStream *bs, CInfo *info)
+{
+  int16 f, s, res, res2, nBlockBits, nOrderBits, nOrderBitsMask;
+
+  nBlockBits = (!info->islong) ? (int16) 4 : (int16) 6;
+  nOrderBits = (!info->islong) ? (int16) 3 : (int16) 5;
+  nOrderBitsMask = (int16) ((1 << nOrderBits) - 1);
+
+  for(s = 0; s < info->nsbk; s++)
+  {
+    int16 nTnsFilt;
+    
+    nTnsFilt = (int16) BsGetBits(bs, (!info->islong) ? (int16) 1 : (int16) 2);
+    if(!nTnsFilt)
+      continue;
+    
+    res = (int16) (BsGetBits(bs, 1) + 3);
+    for(f = nTnsFilt; f > 0; f--)
+    {
+      int16 t, order;
+
+      t = (int16) BsGetBits(bs, (int16) (nBlockBits + nOrderBits));
+      order = (int16) (t & nOrderBitsMask);
+      
+      if(order)
+      {
+        t = (int16) BsGetBits(bs, 2);
+        res2 = (int16) (res - (t & 0x1));
+        
+        BsSkipNBits(bs, res2 * order);
+      }
+    }
+  }
+}
+
+/**************************************************************************
+  Title:        GetICS
+
+  Purpose:      Decodes individual channel elements.
+
+  Usage:        y = GetICS(bs, cip, group, max_sfb, cb_map, coef, gain, factors)
+
+  Input:        bs           - bitstream parameters
+                cip :
+                 info        - block (long/short) parameters
+                group        - grouping info for short blocks
+                max_sfb      - max # of sfb's present
+                gain         - start value for scalefactor decoding
+
+  Output:       y            - TRUE on success, FALSE otherwise
+                cb_map       - Huffman codebook number for each sfb
+                factors      - scalefactors for this channel
+                cip :
+                 is_present  - TRUE if IS is used, FALSE otherwise
+                 tns_present - TRUE if TNS is used, FALSE otherwise
+
+  Author(s):    Juha Ojanpera
+*************************************************************************/
+
+int16
+GetICS(TBitStream *bs, TCh_Info *cip, uint8 *group, uint8 max_sfb, uint8 *cb_map, 
+       int16 *quant, int16 gain, int16 *factors)
+{
+  CInfo *info;
+  int16 nsect;
+  PulseInfo pulse_info;
+  uint8 sect[(MAXBANDS + 1) << 1];
+
+  info = cip->info;
+  
+  /*-- Calculate total number of sfb for this grouping. --*/
+  if(max_sfb == 0)
+  {
+    nsect = 0;
+    ZERO_MEMORY(cb_map, MAXBANDS);
+    ZERO_MEMORY(factors, MAXBANDS * sizeof(int16));
+  }
+  else
+  {    
+    int16 tot_sfb = info->sfb_per_sbk[0];
+    if(!info->islong)
+    {
+      int16 i = 0;
+      while(group[i++] < info->nsbk)
+        tot_sfb += info->sfb_per_sbk[0];
+
+      /*-- Calculate band offsets. --*/
+      calc_gsfb_table(info, group);
+    }
+
+    /*-- Section data. --*/
+    nsect = huf_cb(bs, sect, info, tot_sfb, max_sfb, cb_map);
+    if(nsect < 0) return (FALSE);
+
+    /*-- Scalefactor data. --*/
+    if(!huf_sfac(bs, cip, group, cb_map, gain, factors, max_sfb))
+      return (FALSE);
+  }
+
+  cip->tns_present = FALSE;
+  pulse_info.pulse_data_present = FALSE;
+
+  /*-- PULSE noiseless coding. --*/
+  pulse_info.pulse_data_present = (BOOL) BsGetBits(bs, 1);
+  if(pulse_info.pulse_data_present)
+  {
+    if(info->islong)
+      get_pulse_nc(bs, &pulse_info);
+    else
+      return (FALSE);
+  }
+
+  /*-- TNS data. --*/
+  if(BsGetBits(bs, 1))
+  {
+    cip->tns_present = TRUE;
+    TNS_Decode(bs, info);
+  }
+
+  /*-- Gain control. --*/
+  if(BsGetBits(bs, 1))
+    return (FALSE);
+    
+  /*-- Quantized spectral data. --*/
+  if(!(!nsect && max_sfb))
+    cip->num_bins = huf_spec(bs, info, nsect, sect, quant, cip->huf, 1);
+  else 
+    return (FALSE);
+  
+  return (TRUE);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/huffdec3.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,491 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  huffdec3.cpp - Huffman decoding and inverse scaling routines for AAC decoder.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2000-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/*-- Projetc Headers. --*/
+#include "tool2.h"
+#include "dec_huf.h"
+
+/**************************************************************************
+  Title:       DecodeSpectralCodeword
+
+  Purpose:     Decodes one spectral Huffman codeword from the bitstream.
+
+  Usage:       y = DecodeSpectralCodeword(huf_info, bs)
+
+  Input:       huf_info - Huffman codebook parameters
+               bs       - bitstream parameters
+
+  Output:      y        - decoded Huffman index
+
+  Author(s):   Juha Ojanpera
+  *************************************************************************/
+
+INLINE uint32
+DecodeSpectralCodeword(Huffman_DecInfo *huf_info, TBitStream *bs)
+{
+  int16 len;
+  int32 codeword, items;
+  const Huffman_DecCode *huf_code;
+  
+  items = 1;
+  huf_code = huf_info->huf;
+
+  /*-- The first 5 LSB bits contain the length of codeword. --*/
+  codeword = (int32) BsGetBits(bs, (int16)(huf_code->huf_param & 31));
+  
+  while(items < huf_info->cb_len && codeword != huf_code->codeword)
+  {
+    items++;
+    huf_code++;
+    
+    len = (int16) (huf_code->huf_param & 31);
+    if(len)
+    {
+      codeword <<= len;
+      codeword |= BsGetBits(bs, len);
+    }
+  }
+
+  /*-- Remove the length part from the decoded symbol. --*/
+  return (huf_code->huf_param >> 5);
+}
+
+const uint32 hCbBitMask[20] =
+{0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF,
+0x1FFFL, 0x3FFFL, 0x7FFFL, 0xFFFFL, 0x1FFFFL, 0x3FFFFL, 0x7FFFFL};
+
+/**************************************************************************
+  Title:        DecodeSfCodeword
+
+  Purpose:      Decodes one scalefactor Huffman codeword from the bitstream.
+
+  Usage:        y = DecodeCodeword(huf_info, bs)
+
+  Input:        huf_info - Huffman codebook parameters
+                bs       - bitstream parameters
+
+  Output:       y        - decoded Huffman index
+
+  Explanation:  The Huffman parameters are packed as follows :
+
+                bits 0  -  4 : Length of codeword
+                     5  - 23 : Huffman codeword
+                     24 - 31 : Huffman symbol
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+INLINE uint32
+DecodeSfCodeword(Huffman_DecSfInfo *huf_info, TBitStream *bs)
+{
+#define SFCW_MASK ((1 << 19) - 1)
+#define EXTRACT_SFCW(x) ((x >> 5) & SFCW_MASK)
+  int16 bitsLeft;
+  uint32 lookaheadBits;
+  int32 codeword, len, items;
+  const uint32 *sf_param = huf_info->sf_param;
+  
+  items = 1;
+
+  /*-- Maximum codeword length is 19 bits! --*/
+  lookaheadBits = BsLookAhead(bs, 19);
+  bitsLeft = (int16) (19 - (*sf_param & 31));
+  codeword = lookaheadBits >> bitsLeft;
+  
+  while(items < huf_info->cb_len && codeword != (int32) EXTRACT_SFCW(*sf_param))
+  {
+    items++;
+    sf_param++;
+    
+    len = (int16) (*sf_param & 31);
+    if(len)
+    {
+      bitsLeft -= len;
+      codeword <<= len;
+      codeword |= (lookaheadBits >> bitsLeft) & hCbBitMask[len];
+    }
+  }
+
+  BsSkipNBits(bs, 19 - bitsLeft);
+  
+  return (*sf_param >> 24);
+}
+
+uint32 
+GetHcb(Huffman_DecSfInfo *huf_info, TBitStream *bs)
+{
+  return (DecodeSfCodeword(huf_info, bs));
+}
+
+/**************************************************************************
+  Title:        huf_sfac
+
+  Purpose:      Reads scalefactors from the bitstream.
+
+  Usage:        y = huf_sfac(bs, cip, group, cb_map, global_gain, factors, max_sfb)
+
+  Input:        bs          - bitstream parameters
+                cip :
+                 info       - block (long/short) parameters
+                group       - grouping info
+                cb_map      - codebook for each sfb
+                global_gain - start value for the difference decoding of scalefactors
+                max_sfb     - max # of sfb's present in this channel
+
+  Output:       y           - TRUE on success, FALSE otherwise
+                cip :
+                 is_present - TRUE if IS stereo is used, FALSE otherwise
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+int16
+huf_sfac(TBitStream *bs, TCh_Info *cip, uint8 *group, uint8 *cb_map,
+         int16 global_gain, int16 *factors, uint8 max_sfb)
+{
+  Huffman_DecSfInfo *sf_huf;
+  int16 i, b, bb, n, is_pos;
+  int16 noise_pcm_flag, noise_nrg;
+
+  sf_huf = cip->sf_huf;
+  
+  noise_pcm_flag = 1;
+
+  /* 
+   * Scale factors are dpcm relative to global gain,
+   * intensity positions are dpcm relative to zero
+   */
+  is_pos = 0;
+  noise_nrg = (int16) (global_gain - NOISE_OFFSET);
+  cip->is_present = cip->pns_present = FALSE;
+
+  /*-- Get scale factors. --*/
+  n = cip->info->sfb_per_sbk[0];
+  for(b = 0, bb = 0; b < cip->info->nsbk; )
+  {
+    b = *group++;
+    for(i = 0; i < max_sfb; i++)
+    {
+      switch(cb_map[i])
+      {
+        /*-- Zero book. --*/
+        case ZERO_HCB:
+          factors[i] = 0;
+          break;
+
+        /*-- Invalid books. --*/
+        case BOOKSCL:
+          return (FALSE);
+  
+        /*-- Intensity books. --*/
+        case INTENSITY_HCB:
+        case INTENSITY_HCB2:
+          cip->is_present = TRUE;
+          is_pos = (int16) (is_pos + DecodeSfCodeword(sf_huf, bs) - MIDFAC);
+          factors[i] = is_pos;          
+          break;
+
+        /*-- Noise books. --*/
+        case NOISE_HCB:
+          cip->pns_present = TRUE;
+          if(noise_pcm_flag)
+          {
+            noise_pcm_flag = 0;
+            noise_nrg = (int16) (noise_nrg + BsGetBits(bs, NOISE_PCM_BITS) - NOISE_PCM_OFFSET);
+          }
+          else
+            noise_nrg = (int16) (noise_nrg + DecodeSfCodeword(sf_huf, bs) - MIDFAC);
+
+          factors[i] = noise_nrg;
+          break;
+
+        /*-- Spectral books. --*/
+        default:
+          global_gain = (int16) (global_gain + DecodeSfCodeword(sf_huf, bs) - MIDFAC);
+          factors[i] = (int16) (global_gain & TEXP_MASK);
+          break;
+      }
+    }
+    
+    /*-- Expand short block grouping. --*/
+    if(!cip->info->islong)
+      for(bb++; bb < b; bb++)
+      {
+        COPY_MEMORY(factors + n, factors, n * sizeof(int16));
+        factors += n;
+      }
+    cb_map += n; factors += n;
+  }
+
+  return (TRUE);
+}
+
+/**************************************************************************
+  Title:        unpack_index...
+
+  Purpose:      Translates Huffman index into n-tuple spectral values.
+
+  Usage:        unpack_index(index, quant)
+
+  Input:        index - decoded Huffman index
+
+  Output:       quant - quantized spectral values
+
+  Explanation:  The index contains already the translated n-tuple spectral 
+                values due to computational reasons. The unpacking routines
+                will only extract the codebook dependent bit fields within
+                'index' to obtain the quantized values. 
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+/*
+ * 2-tuple, quantized values are unsigned.
+ */
+INLINE void
+unpack_index2noOff(uint32 index, int16 *quant)
+{
+  quant[0] = (index >> 5) & 31; quant[1] = index & 31;
+}
+
+/*
+ * 2-tuple, quantized values are signed.
+ */
+INLINE void
+unpack_index2Off(uint32 index, int16 *quant)
+{
+  quant[0] = (index >> 4) & 7; if(index & 128) quant[0] = -quant[0];
+  quant[1] = index & 7;        if(index & 8)   quant[1] = -quant[1];
+}
+
+/*
+ * 4-tuple, quantized values are unsigned.
+ */
+INLINE void
+unpack_index4noOff(uint32 index, int16 *quant)
+{
+  quant[0] = (index >> 6) & 3; quant[1] = (index >> 4) & 3;
+  quant[2] = (index >> 2) & 3; quant[3] = index & 3;
+}
+
+/*
+ * 4-tuple, quantized values are signed.
+ */
+INLINE void
+unpack_index4Off(uint32 index, int16 *quant)
+{
+  quant[0] = (index >> 6) & 1; if(index & 128) quant[0] = -quant[0];
+  quant[1] = (index >> 4) & 1; if(index & 32)  quant[1] = -quant[1];
+  quant[2] = (index >> 2) & 1; if(index & 8)   quant[2] = -quant[2];
+  quant[3] = index & 1;        if(index & 2)   quant[3] = -quant[3];
+}
+
+/*
+ * Reads, at maximum, 2 sign bits from the bitstream.
+ */
+INLINE void
+get_sign_bits2(int16 *q, TBitStream *bs)
+{
+  /*-- 1 signals negative, as in 2's complement. --*/
+  if(q[0]) { if(BsGetBits(bs, 1)) q[0] = -q[0]; }
+  if(q[1]) { if(BsGetBits(bs, 1)) q[1] = -q[1]; }
+}
+
+/*
+ * Reads, at maximum, 4 sign bits from the bitstream.
+ */
+INLINE void
+get_sign_bits4(int16 *q, TBitStream *bs)
+{
+  /*-- 1 signals negative, as in 2's complement. --*/
+  if(q[0]) { if(BsGetBits(bs, 1)) q[0] = -q[0]; }
+  if(q[1]) { if(BsGetBits(bs, 1)) q[1] = -q[1]; }
+  if(q[2]) { if(BsGetBits(bs, 1)) q[2] = -q[2]; }
+  if(q[3]) { if(BsGetBits(bs, 1)) q[3] = -q[3]; }
+}
+
+/**************************************************************************
+  Title:        getescape
+
+  Purpose:      Decodes escape sequences for codebook 11.
+
+  Usage:        y = getescape(bs, q)
+
+  Input:        bs - bitstream parameters
+                q  - decoded quantized value (0-16)
+
+  Output:       y - actual quantized value
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+INLINE int16
+getescape(TBitStream *bs, int16 q)
+{
+  int16 i;
+  
+  i = q;
+
+  /*-- Value 16 is used to indicate that the actual value is escape coded. --*/
+  if(q == 16 || q == -16)
+  {
+    /*
+     * The length of escape sequence, according to the AAC standard,
+     * is less than 24 bits.
+     */
+    for(i = 4; i < 24; i++)
+      if(BsGetBits(bs, 1) == 0)
+        break;
+    
+    i = (int16) (BsGetBits(bs, i) + (1 << i));
+    if(q < 0)
+      i = -i;
+  }
+  
+  return (i);
+}
+
+/**************************************************************************
+  Title:        huf_spec
+
+  Purpose:      Huffman decodes and inverse scales quantized spectral values.
+
+  Usage:        y = huf_spec(bs, info, nsect, sect, quant, huf, parseOnly)
+
+  Input:        bs         - bitstream parameters
+                info       - block (long/short) parameters
+                nsect      - # of sections present in this channel
+                sect       - sectioning (codebook and length of section) info        
+                huf        - Spectral Huffman tables
+                parseOnly  - 1 if bitstream need to be only parsed, 0 otherwise
+
+  Output:       y          - # of spectral bins decoded
+                quant      - quantized spectral coefficients
+
+  Author(s):    Juha Ojanpera
+  *************************************************************************/
+
+int16
+huf_spec(TBitStream *bs, CInfo *info, int16 nsect, uint8 *sect, int16 *quant, 
+         Huffman_DecInfo **huf, uint8 parseOnly)
+{
+  uint32 temp;
+  int16 i, j, k, stop, *qp;
+
+  qp = quant;
+  for(k = 0, i = nsect; i; i--, sect += 2)
+  {
+    register Huffman_DecInfo *huf_info;
+    int16 table = sect[0];
+    int16 top = sect[1];
+
+    if(top > 200 || top < 1) goto error_exit;
+
+    stop = info->bk_sfb_top[top - 1];
+
+    switch(table)
+    {
+      /*-- 4-tuple signed quantized coefficients. --*/
+      case 1:
+      case 2:
+        huf_info = huf[table - 1];
+        for (j = k; j < stop; j += 4, qp += 4)
+        {
+          temp = DecodeSpectralCodeword(huf_info, bs);
+          if(!parseOnly) unpack_index4Off(temp, qp);
+        }
+        break;
+
+      /*-- 4-tuple unsigned quantized coefficients. --*/
+      case 3:
+      case 4:
+        huf_info = huf[table - 1];    
+        for (j = k; j < stop; j += 4, qp += 4)
+        {
+          temp = DecodeSpectralCodeword(huf_info, bs);
+          unpack_index4noOff(temp, qp);
+          get_sign_bits4(qp, bs);
+        }
+        break;
+    
+      /*-- 2-tuple unsigned quantized coefficients. --*/
+      case 5:
+      case 6:
+        huf_info = huf[table - 1];
+        for (j = k; j < stop; j += 2, qp += 2)
+        {
+          temp = DecodeSpectralCodeword(huf_info, bs);
+          if(!parseOnly) unpack_index2Off(temp, qp);
+        }
+        break;
+    
+      /*-- 2-tuple signed quantized coefficients. --*/
+      case 7:
+      case 8:
+      case 9:
+      case 10:
+        huf_info = huf[table - 1];
+        for (j = k; j < stop; j += 2, qp += 2)
+        {
+          temp = DecodeSpectralCodeword(huf_info, bs);
+          unpack_index2noOff(temp, qp);
+          get_sign_bits2(qp, bs);
+        }
+        break;
+    
+      /*-- 2-tuple signed quantized coefficients (escape codebook). --*/
+      case 11:
+        huf_info = huf[table - 1];
+        for (j = k; j < stop; j += 2, qp += 2)
+        {
+          temp = DecodeSpectralCodeword(huf_info, bs);
+          unpack_index2noOff(temp, qp);
+          get_sign_bits2(qp, bs);
+          qp[0] = getescape(bs, qp[0]);
+          qp[1] = getescape(bs, qp[1]);
+        }
+        break;
+    
+      default:
+        if(stop > k)
+        {
+          if(!parseOnly) ZERO_MEMORY(qp, (stop - k) * sizeof(int16));
+          qp = quant + stop;
+        } 
+        else goto error_exit;
+        break;
+    }
+    k = stop;
+  }
+
+  if(!parseOnly) if(k < LN2) ZERO_MEMORY(quant + k, (LN2 - k) * sizeof(int16));
+
+  return (k);
+
+ error_exit:
+
+  return (0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/nok_bits2.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,677 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  nok_bits2.c - Bitstream subroutines.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2003 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/**************************************************************************
+  External Objects Needed
+  *************************************************************************/
+
+/*-- Project Headers --*/
+#include "nok_bits.h"
+
+/**************************************************************************
+  Internal Objects
+  *************************************************************************/
+
+#ifdef USE_ASSERT
+#define BITSASSERT(x) { \
+  MY_ASSERT(UpdateBufIdx(bs) == 1); \
+}
+#else
+#define BITSASSERT(x) { \
+  UpdateBufIdx(bs); \
+}
+#endif
+
+//typedef uint32 (*GETBITS_FUNCTION)(BitStream *bs, int16 n);
+
+const uint32 bitMask[] =
+{0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF,
+ 0x1FFFL, 0x3FFFL, 0x7FFFL, 0xFFFFL, 0x1FFFFL, 0x3FFFFL, 0x7FFFFL, 0xFFFFFL,
+ 0x1FFFFFL, 0x3FFFFFL, 0x7FFFFFL, 0xFFFFFFL, 0x1FFFFFFL, 0x3FFFFFFL, 0x7FFFFFFL,
+ 0xFFFFFFFL, 0x1FFFFFFFL, 0x3FFFFFFFL, 0x7FFFFFFFL, 0xFFFFFFFFL};
+
+
+
+/*
+ * Updates the read index of the bit buffer.
+ */
+static INLINE int16
+UpdateBufIdx(TBitStream *bs)
+{
+  bs->buf_index++;
+  bs->buf_index = MOD_OPCODE(bs->buf_index, bs->buf_mask);
+  bs->slots_read++;
+#if 0
+  if(bs->slots_read == bs->buf_len)
+    return (0);
+#endif
+  
+  return (1);
+}
+
+/*
+ * Writes at most 8 bits to the bit buffer.
+ */
+void
+PutBits(TBitStream *bs, uint16 n, uint32 word)
+{ 
+  uint8 *buf = (bs->mode == BIT8) ? bs->bit_buffer : bs->dsp_buffer;
+  /*
+   * The number of bits left in the current buffer slot is too low. 
+   * Therefore, the input word needs to be splitted into two parts. 
+   * Each part is stored separately.
+   */
+  int16 tmp = bs->bit_counter - n;
+  if(tmp < 0)
+  {
+    /*-- Zero those bits that are to be modified. --*/
+    buf[bs->buf_index] &= ~bitMask[bs->bit_counter];
+  
+    /*-- Store the upper (MSB) part to the bitstream buffer. --*/
+    tmp = -tmp;
+    buf[bs->buf_index] |= (word >> tmp);
+
+    /*
+     * Explicitly update the bitstream buffer index. No need to 
+     * test whether the bit counter is zero since it is known
+     * to be zero at this point.
+     */
+    BITSASSERT(bs);
+    bs->bit_counter = bs->slotBits;
+
+    /*-- Store the lower (LSB) part to the bitstream buffer. --*/
+    bs->bit_counter =  int16(bs->bit_counter  - tmp);
+    buf[bs->buf_index] &= bitMask[bs->bit_counter];
+    buf[bs->buf_index] |= ((word & bitMask[tmp]) << bs->bit_counter);
+  }
+  else
+  {
+    /*
+     * Obtain the bit mask for the part that is to be modified. For example,
+     * 'bit_counter' = 5
+     * 'n' = 3,
+     * 'tmp' = 2
+     *
+     * x x x m m m x x (x = ignore, m = bits to be modified)
+     *
+     * mask :
+     *
+     * 1 1 1 0 0 0 1 1
+     *
+     */
+    buf[bs->buf_index] &= (~bitMask[bs->bit_counter]) | bitMask[tmp];
+    bs->bit_counter = tmp;
+    buf[bs->buf_index] |= (word << bs->bit_counter);
+  }
+
+  /*-- Update the bitstream buffer index. --*/
+  if(bs->bit_counter == 0)
+  {
+    BITSASSERT(bs);
+    bs->bit_counter = bs->slotBits;
+  }
+}
+
+/*
+ * Reads at most 8 bits from the bit buffer.
+ */
+uint32
+GetBits(TBitStream *bs, int16 n)
+{
+  int16 idx;
+  uint32 tmp;
+
+  idx = bs->bit_counter - n;
+  if(idx < 0)
+  {
+    /* Mask the unwanted bits to zero. */
+    tmp = (bs->bit_buffer[bs->buf_index] & bitMask[bs->bit_counter]) << -idx;
+
+    /* Update the bitstream buffer. */
+    BITSASSERT(bs);
+    bs->bit_counter = bs->slotBits + idx;
+    tmp |= (bs->bit_buffer[bs->buf_index] >> bs->bit_counter) & bitMask[-idx];
+  }
+  else
+  {
+    bs->bit_counter = idx;
+    tmp = (bs->bit_buffer[bs->buf_index] >> bs->bit_counter) & bitMask[n];
+  }
+
+  /* Update the bitstream buffer index. */
+  if(bs->bit_counter == 0)
+  {
+    BITSASSERT(bs);
+    bs->bit_counter = bs->slotBits;
+  }
+
+  return (tmp);
+}
+
+/*
+ * Reads at most 16 bits from the bit buffer.
+ */
+uint32
+GetBitsDSP(TBitStream *bs, int16 n)
+{
+  int16 idx;
+  uint32 tmp;
+
+  idx = bs->bit_counter - n;
+  if(idx < 0)
+  {
+    /* Mask the unwanted bits to zero. */
+    tmp = (bs->dsp_buffer[bs->buf_index] & bitMask[bs->bit_counter]) << -idx;
+
+    /* Update the bitstream buffer. */
+    BITSASSERT(bs);
+    bs->bit_counter = bs->slotBits + idx;
+    tmp |= (bs->dsp_buffer[bs->buf_index] >> bs->bit_counter) & bitMask[-idx];
+  }
+  else
+  {
+    bs->bit_counter = idx;
+    tmp = (bs->dsp_buffer[bs->buf_index] >> bs->bit_counter) & bitMask[n];
+  }
+
+  /* Update the bitstream buffer index. */
+  if(bs->bit_counter == 0)
+  {
+    BITSASSERT(bs);
+    bs->bit_counter = bs->slotBits;
+  }
+
+  return (tmp);
+}
+
+//typedef uint32 (*GETBITS_FUNCTION)(BitStream *bs, int16 n);
+//static GETBITS_FUNCTION GetFunc[2] = {GetBits, GetBitsDSP};
+
+/*
+ * Returns the size of the buffer.
+ */
+EXPORT_C uint32 BsGetBufSize(TBitStream *bs)
+{ return (bs->buf_len); }
+
+/*
+ * Returns the size of the original buffer. Note that it is 
+ * possible that the update procedure of the bit buffer 
+ * (which is up to the implementor to specify), reduces the size 
+ * temporarily for some reasons.
+ */
+EXPORT_C uint32 BsGetBufOriginalSize(TBitStream *bs)
+{
+#ifndef BITSMODULO_BUFFER
+  return (bs->buf_mask + 1);
+#else
+  return (bs->buf_mask);
+#endif 
+}
+
+/*
+ * Returns the number of bits read.
+ */
+EXPORT_C uint32 BsGetBitsRead(TBitStream *bs)
+{ return (bs->bits_read); }
+
+/*
+ * Increments the value that describes how many 
+ * bits are read from the bitstream.
+ */
+EXPORT_C void BsSetBitsRead(TBitStream *bs, uint32 bits_read) 
+{ bs->bits_read += bits_read; }
+
+/*
+ * Clears the value that describes how many 
+ * bits are read from the bitstream.
+ */
+EXPORT_C void BsClearBitsRead(TBitStream *bs)  
+{ bs->bits_read = 0; }
+
+/*
+ * Returns the number of unread elements in the bit buffer.
+ */
+EXPORT_C uint32 BsSlotsLeft(TBitStream *bs)
+{ return ((bs->buf_len < bs->slots_read) ? 0 : bs->buf_len - bs->slots_read); }
+
+/*
+ * Resets the bitstream.
+ */
+EXPORT_C void BsReset(TBitStream *bs)
+{
+  bs->buf_index = 0;
+  bs->buf_writeIndex = 0;
+  bs->bit_counter = bs->slotBits;
+  bs->slots_read = 0;
+  bs->bits_read = 0;
+}
+
+/*
+ * Updates the bitstream values according to the given input parameter.
+ */
+EXPORT_C void BsBufferUpdate(TBitStream *bs, int32 bytesRead)
+{
+  int32 diff = bs->bits_read - (bytesRead << 3);
+  
+  bs->buf_len = (bs->buf_len - bs->slots_read) + bytesRead;
+  bs->slots_read = 0;
+  
+  if(diff < 0)
+    bs->bits_read = -diff;
+  else
+    bs->bits_read = diff;
+}
+
+/**************************************************************************
+  Title       : BsInit
+
+  Purpose     : Initializes the bit buffer.
+
+  Usage       : BsInit(bs, bit_buffer, size)
+
+  Input       : bs         - bitstream structure
+                bit_buffer - address of bit buffer
+                size       - size of buffer
+
+  Author(s)   : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C void
+BsInit(TBitStream *bs, uint8 *bit_buffer, uint32 size)
+{
+  bs->dsp_buffer = NULL;
+  bs->bit_buffer = bit_buffer;
+  bs->mode = BIT8;
+#ifndef BITSMODULO_BUFFER
+  bs->buf_mask = size - 1;
+#else
+  bs->buf_mask = size;
+#endif
+  bs->buf_len = size;
+  bs->slotBits = sizeof(uint8) << 3;
+  BsReset(bs);
+}
+
+void
+BsInit2(TBitStream *bs, DSP_BYTE *dsp_buffer, uint32 size)
+{
+  bs->dsp_buffer = dsp_buffer;
+  bs->bit_buffer = NULL;
+  bs->mode = BIT16;
+#ifndef BITSMODULO_BUFFER
+  bs->buf_mask = size - 1;
+#else
+  bs->buf_mask = size;
+#endif
+  bs->buf_len = size;
+  bs->slotBits = sizeof(DSP_BYTE) << 3;
+  BsReset(bs);
+}
+
+/**************************************************************************
+  Title        : BsByteAlign
+
+  Purpose      : Byte aligns the bit counter of the buffer.
+
+  Usage        : y = BsByteAlign(bs)
+
+  Input        : bs - bitstream parameters
+
+  Output       : y  - # of bits read
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C int16
+BsByteAlign(TBitStream *bs)
+{
+  int16 bits_to_byte_align;
+
+  bits_to_byte_align = bs->bit_counter & 7;
+  if(bits_to_byte_align)
+    BsSkipBits(bs, bits_to_byte_align);
+
+  return (bits_to_byte_align);
+}
+
+/**************************************************************************
+  Title        : BsLookAhead
+
+  Purpose      : Looks ahead for the next 'n' bits from the bit buffer and
+                 returns the read 'n' bits.
+
+  Usage        : y = BsLookAhead(bs, n)
+
+  Input        : bs - bitstream parameters
+                 n  - number of bits to be read from the bit buffer
+
+  Output       : y  - bits read
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C uint32
+BsLookAhead(TBitStream *bs, int16 n)
+{
+  TBitStream bs_tmp;
+  uint32 dword;
+  
+  /*-- Save the current state. --*/
+  COPY_MEMORY(&bs_tmp, bs, sizeof(TBitStream));
+
+  dword = BsGetBits(bs, n);
+
+  /*-- Restore the original state. --*/
+  COPY_MEMORY(bs, &bs_tmp, sizeof(TBitStream));
+
+  return (dword);
+}
+
+/**************************************************************************
+  Title        : BsPutBits
+
+  Purpose      : Writes bits to the bit buffer.
+
+  Usage        : BsPutBits(bs, n, word);
+
+  Input        : bs   - bitstream parameters
+                 n    - number of bits to write
+                 word - bits to write
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C void
+BsPutBits(TBitStream *bs, int16 n, uint32 word)
+{
+  int16 rbits;
+
+  BsSetBitsRead(bs, n);
+
+  /*-- Mask the unwanted bits to zero, just for safety. --*/
+  word &= bitMask[n];
+
+  while(n)
+  {
+    rbits = (n > (int16)bs->slotBits) ? bs->slotBits : n;
+    n -= rbits;
+    PutBits(bs, rbits, ((word >> n) & bitMask[rbits]));
+  }
+}
+
+/**************************************************************************
+  Title        : BsPutBitsByteAlign
+
+  Purpose      : Byte aligns the write buffer.
+
+  Usage        : y = BsPutBitsByteAlign(bs)
+
+  Input        : bs - bitstream parameters
+
+  Output       : y  - # of bits written
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C int16
+BsPutBitsByteAlign(TBitStream *bs)
+{
+  int16 bits_to_byte_align;
+
+  bits_to_byte_align = bs->bit_counter & 7;
+  if(bits_to_byte_align)
+    BsPutBits(bs, bits_to_byte_align, 0);
+
+  return (bits_to_byte_align);
+}
+
+/**************************************************************************
+  Title        : BsGetBits
+
+  Purpose      : Reads bits from the bit buffer.
+
+  Usage        : y = BsGetBits(bs, n);
+
+  Input        : bs - bitstream parameters
+                 n  - number of bits to be read
+
+  Output       : y  - bits read
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C uint32
+BsGetBits(TBitStream *bs, int16 n)
+{
+  int16 rbits = 0;
+  uint32 value = 0;
+
+  BsSetBitsRead(bs, n);
+
+  while(n)
+  {
+    rbits = (n > (int16)bs->slotBits) ? bs->slotBits : n;
+    value <<= rbits;
+
+    // modified by Ali Ahmaniemi 7.6.04
+
+    if (bs->mode == BIT8)
+        {
+        value |= GetBits(bs, rbits);
+        }
+    else
+        {
+        value |= GetBitsDSP(bs, rbits);
+        }
+
+    //value |= GetFunc[bs->mode](bs, rbits);
+    n -= rbits;
+  }
+
+  return (value);
+}
+
+/**************************************************************************
+  Title        : BsSkipBits
+
+  Purpose      : Advances the bit buffer index.
+
+  Usage        : BsSkipBits(bs, n);
+
+  Input        : bs - bitstream parameters
+                 n  - number of bits to be discarded
+
+  Explanation  : The maximum number of bits that can be discarded is 'bs->slotBits'.
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C void
+BsSkipBits(TBitStream *bs, int16 n)
+{
+  int16 idx;
+
+#ifdef USE_ASSERT
+  MY_ASSERT(n < ((int16)bs->slotBits + 1));
+#endif
+
+  BsSetBitsRead(bs, n);
+
+  idx = bs->bit_counter - n;
+  if(idx < 0)
+  {
+    BITSASSERT(bs);
+    bs->bit_counter = bs->slotBits + idx;
+  }
+  else
+    bs->bit_counter = idx;
+
+  if(bs->bit_counter == 0)
+  {
+    BITSASSERT(bs);
+    bs->bit_counter = bs->slotBits;
+  }
+}
+
+/**************************************************************************
+  Title        : BsSkipNbits
+
+  Purpose      : Same as 'BsSkipBits' with the exception that the number 
+                 of bits to be discarded can be of any value.
+
+  Usage        : BsSkipNbits(bs, n);
+
+  Input        : bs - bitstream parameters
+                 n  - number of bits to be discarded
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C void
+BsSkipNBits(TBitStream *bs, int32 n)
+{
+  int32 slots, bits_left, scale;
+
+#ifdef BYTE_16bit
+  scale = (bs->mode == BIT8) ? 3 : 4;
+#else
+  scale = 3;
+#endif  
+  slots = (n >> scale);
+  BsSetBitsRead(bs, slots << scale);
+  bs->buf_index += slots;
+  bs->buf_index = MOD_OPCODE(bs->buf_index, bs->buf_mask);
+  bs->slots_read += slots;
+  bits_left = n - (slots << scale);
+  if(bits_left)
+    BsSkipBits(bs, (int16) bits_left);
+}
+
+/**************************************************************************
+  Title        : BsCopyBytes
+
+  Purpose      : Copies 'bytesToCopy' bytes from the bit buffer (starting from
+                 the current read index) to the specified output buffer.
+  
+  Usage        : y = BsCopyBytes(bs, outBuf, bytesToCopy)
+
+  Input        : bs          - bitstream to be copied
+                 bytesToCopy - # of bytes to copy
+
+  Output       : y           - # of bytes copied
+                 outBuf      - copied bytes
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C uint32
+BsCopyBytes(TBitStream *bs, uint8 *outBuf, uint32 bytesToCopy)
+{
+  uint32 i;
+  uint8 *buf0 = (bs->mode == BIT8) ? bs->bit_buffer : bs->dsp_buffer;
+  
+  for(i = bs->buf_index; i < (bytesToCopy + bs->buf_index); i++, outBuf++)
+    *outBuf = buf0[MOD_OPCODE(i, bs->buf_mask)];
+  
+  return (i - bs->buf_index);
+}
+
+/**************************************************************************
+  Title        : BsCopyBits
+
+  Purpose      : Copies 'bitsToCopy' bits from the source bit buffer (starting from
+                 the current read index) to the specified destination bit buffer.
+  
+  Usage        : y = BsCopyBits(bsSrc, bsDst, bitsToCopy)
+
+  Input        : bsSrc       - source bit buffer
+                 bytesToCopy - # of bits to copy
+
+  Output       : bsDst       - destination bit buffer
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C void 
+BsCopyBits(TBitStream *bsSrc, TBitStream *bsDst, int32 bitsToCopy)
+{
+  int32 i, nBytes;
+
+  nBytes = bitsToCopy >> 3;
+
+  for(i = 0; i < nBytes; i++)
+    BsPutBits(bsDst, 8, BsGetBits(bsSrc, 8));
+
+  i = bitsToCopy - (i << 3);
+  if(i > 0) BsPutBits(bsDst, (int16) i, BsGetBits(bsSrc, (uint16) i));
+}
+
+/**************************************************************************
+  Title        : BsRewindNBits
+
+  Purpose      : Rewinds the bit buffer 'nBits' bits.
+
+  Usage        : BsRewindNbits(br, nBits)
+
+  Input        : br    - bitstream parameters
+                 nBits - number of bits to rewind
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+EXPORT_C void
+BsRewindNBits(TBitStream *bs, uint32 nBits)
+{
+  int32 tmp;
+  int16 new_buf_idx, new_bit_idx;  
+
+  new_buf_idx = (int16) (nBits / bs->slotBits);
+  new_bit_idx = (int16) (nBits % bs->slotBits);
+
+  tmp = bs->bit_counter + new_bit_idx;
+  if(tmp > (int16)bs->slotBits)
+  {
+    new_buf_idx++;
+    bs->bit_counter = tmp - bs->slotBits;
+  }
+  else
+    bs->bit_counter += new_bit_idx;
+
+  bs->buf_index = MOD_OPCODE(bs->buf_index, bs->buf_mask);
+  tmp = bs->buf_index - new_buf_idx;
+  if(tmp > 0)
+    bs->buf_index = tmp;
+  else
+    bs->buf_index = MOD_OPCODE(bs->buf_len + tmp, bs->buf_mask);
+
+  bs->bits_read -= nBits;
+}
+
+EXPORT_C void 
+BsSaveBufState(TBitStream *bsSrc, TBitStream *bsDst)
+{
+  COPY_MEMORY(bsDst, bsSrc, sizeof(TBitStream));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/sbr_bitmux.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,749 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/*
+  \file
+  \brief SBR bitstream multiplexer implementation $Revision: 1.1.1.1 $
+*/
+
+/**************************************************************************
+  sbr_bitmux.cpp - Bitstream implementations for SBR encoder.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2004 by Nokia Research Center, Multimedia Technologies.
+  *************************************************************************/
+
+/*-- Project Headers. --*/
+#include "sbr_rom.h"
+#include "sbr_bitmux.h"
+
+#define CODE_BOOK_SCF_LAV10         (60)
+#define CODE_BOOK_SCF_LAV11         (31)
+#define CODE_BOOK_SCF_LAV_BALANCE11 (12)
+#define CODE_BOOK_SCF_LAV_BALANCE10 (24)
+
+/**
+ * Writes SBR header data.
+ */
+int16
+SBR_WriteHeaderData(SbrHeaderData *h_sbr_header, TBitStream *bs, uint8 writeFlag)
+{
+  int16 bitsWritten;
+  uint8 headerExtra1, headerExtra2;
+
+  bitsWritten = 1 + 4 + 4 + 3 + 2 + 2;
+
+  if(writeFlag)
+  {
+    BsPutBits(bs, 1, h_sbr_header->ampResolution);
+    BsPutBits(bs, 4, h_sbr_header->startFreq);
+    BsPutBits(bs, 4, h_sbr_header->stopFreq); 
+    BsPutBits(bs, 3, h_sbr_header->xover_band);
+    BsPutBits(bs, 2, 0);
+  }
+
+  headerExtra1 = 0;
+  if(h_sbr_header->freqScale   != SBR_FREQ_SCALE_DEF ||
+     h_sbr_header->alterScale  != SBR_ALTER_SCALE_DEF ||
+     h_sbr_header->noise_bands != SBR_NOISE_BANDS_DEF)
+   headerExtra1 = 1;
+
+  headerExtra2 = 0;
+  if(h_sbr_header->limiterBands    != SBR_LIMITER_BANDS_DEF ||
+     h_sbr_header->limiterGains    != SBR_LIMITER_GAINS_DEF ||
+     h_sbr_header->interpolFreq    != SBR_INTERPOL_FREQ_DEF ||
+     h_sbr_header->smoothingLength != SBR_SMOOTHING_LENGTH_DEF)
+   headerExtra2 = 1;
+
+  if(writeFlag)
+  {
+    BsPutBits(bs, 1, headerExtra1);
+    BsPutBits(bs, 1, headerExtra2);
+  }
+
+  if(headerExtra1)
+  {
+    bitsWritten += 5;
+
+    if(writeFlag)
+    {
+      BsPutBits(bs, 2, h_sbr_header->freqScale);
+      BsPutBits(bs, 1, h_sbr_header->alterScale);
+      BsPutBits(bs, 2, h_sbr_header->noise_bands);
+    }
+  }
+
+  if(headerExtra2)
+  {
+    bitsWritten += 6;
+
+    if(writeFlag)
+    {
+      BsPutBits(bs, 2, h_sbr_header->limiterBands);
+      BsPutBits(bs, 2, h_sbr_header->limiterGains);
+      BsPutBits(bs, 1, h_sbr_header->interpolFreq);
+      BsPutBits(bs, 1, h_sbr_header->smoothingLength);
+    }
+  }
+
+  return (bitsWritten);
+}
+
+/**
+ * Writes additional sinusoidal data for SBR.
+ */
+int16
+SBR_WriteSinusoidalData(SbrFrameData *hFrameData, TBitStream *bs, int16 nSfb, uint8 writeFlag)
+{
+  int16 bitsWritten;
+
+  bitsWritten = 1;
+  if(writeFlag)
+  {
+    if(hFrameData->isSinesPresent)
+      BsPutBits(bs, 1, 1);
+    else
+      BsPutBits(bs, 1, 0);
+  }
+
+  if(hFrameData->isSinesPresent)
+  {
+    bitsWritten += nSfb;
+
+    if(writeFlag)
+    {
+      int16 wSfb;
+
+      wSfb = (nSfb > 32) ? 32 : nSfb;
+
+      BsPutBits(bs, wSfb, hFrameData->addHarmonics[0]);
+      if(nSfb > 32)
+      {
+        wSfb = nSfb - 32;
+        BsPutBits(bs, wSfb, hFrameData->addHarmonics[1]);
+      }
+    }
+  }
+
+
+  return (bitsWritten);
+}
+
+/**
+ * Writes envelope direction coding data.
+ */
+int16
+SBR_WriteDTDFData(SbrFrameData *frameData, TBitStream *bs, uint8 writeFlag)
+{
+  int16 bitsWritten;
+
+  bitsWritten = frameData->frameInfo.nEnvelopes + frameData->frameInfo.nNoiseEnvelopes;
+
+  if(writeFlag)
+  {
+    BsPutBits(bs, frameData->frameInfo.nEnvelopes, frameData->domain_vec);
+    BsPutBits(bs, frameData->frameInfo.nNoiseEnvelopes, frameData->domain_vec_noise);
+  }
+
+  return (bitsWritten);
+}
+
+/**
+ * Writes envelope data for SBR.
+ */
+int16
+SBR_WriteEnvelopeData(SbrHeaderData *hHeaderData, SbrFrameData *frameData,
+                      TBitStream *bs, uint8 writeFlag)
+{
+  const uint8 *hCbBits_f, *hCbBits_t;
+  const int32 *hCb_f = 0, *hCb_t = 0;
+  const uint16 *hCb_f0 = 0, *hCb_t0 = 0;
+  uint8 no_band[MAX_ENVELOPES], hCbIndexOffset;
+  int16 i, j, k, offset, start_bits, bitsWritten, start_bits_balance, ampRes;
+
+  ampRes = hHeaderData->ampResolution;
+  if(frameData->frameInfo.frameClass == FIXFIX && frameData->frameInfo.nEnvelopes == 1)
+    ampRes = SBR_AMP_RES_1_5;
+
+  if(ampRes == SBR_AMP_RES_3_0)
+  {
+    start_bits = 6;
+    start_bits_balance = 5;
+  }
+  else
+  {
+    start_bits = 7;
+    start_bits_balance = 6;
+  }
+
+  k = SBR_BIT_ARRAY_SIZE - frameData->frameInfo.nEnvelopes;
+  for(i = 0; i < frameData->frameInfo.nEnvelopes; i++, k++)
+  {
+    uint8 resValue = (frameData->frameInfo.freqRes & bitArray[k]) ? 1 : 0;
+
+    no_band[i] = hHeaderData->hFreqBandData->nSfb[resValue];
+  }
+
+  /*
+   * Indexing of the codebooks needs some effort in order to same ROM memory...
+   */
+  if(frameData->coupling == COUPLING_BAL) 
+  {
+    if(ampRes == SBR_AMP_RES_1_5) 
+    {
+      hCb_f = bookSbrEnvBalanceC10F;
+      hCbBits_f = bookSbrEnvBalanceL10F;
+
+      hCb_t = bookSbrEnvBalanceC10T;
+      hCbBits_t = bookSbrEnvBalanceL10T;
+
+      hCbIndexOffset = CODE_BOOK_SCF_LAV_BALANCE10; 
+    }
+    else 
+    {
+      hCb_f0 = bookSbrEnvBalanceC11F;
+      hCbBits_f = bookSbrEnvBalanceL11F;
+
+      hCb_t0 = bookSbrEnvBalanceC11T;
+      hCbBits_t = bookSbrEnvBalanceL11T;
+
+      hCbIndexOffset = CODE_BOOK_SCF_LAV_BALANCE11;
+    }
+  }
+  else 
+  {
+    if(ampRes == SBR_AMP_RES_1_5) 
+    {
+      hCb_f = v_Huff_envelopeLevelC10F;
+      hCbBits_f = v_Huff_envelopeLevelL10F;
+
+      hCb_t = v_Huff_envelopeLevelC10T;
+      hCbBits_t = v_Huff_envelopeLevelL10T;
+
+      hCbIndexOffset = CODE_BOOK_SCF_LAV10;
+    }
+    else 
+    {
+      hCb_f = v_Huff_envelopeLevelC11F;
+      hCbBits_f = v_Huff_envelopeLevelL11F;
+
+      hCb_t = v_Huff_envelopeLevelC11T;
+      hCbBits_t = v_Huff_envelopeLevelL11T;
+
+      hCbIndexOffset = CODE_BOOK_SCF_LAV11;
+    }
+  }
+
+  k = SBR_BIT_ARRAY_SIZE - frameData->frameInfo.nEnvelopes;
+  for(j = 0, offset = 0, bitsWritten = 0; j < frameData->frameInfo.nEnvelopes; j++, k++) 
+  {
+    int16 index;
+    uint8 codValue;
+
+    codValue = frameData->domain_vec & bitArray[k];
+
+    if(!codValue) 
+    {
+      index = frameData->iEnvelope[offset];
+      index = MAX(0, index);
+
+      if(frameData->coupling == COUPLING_BAL) 
+      {
+        index = MIN(index, (1 << start_bits_balance) - 1);
+
+        bitsWritten += start_bits_balance;
+        if(writeFlag) BsPutBits(bs, start_bits_balance, index);
+      }
+      else 
+      {
+        index = MIN(index, (1 << start_bits) - 1);
+
+        bitsWritten += start_bits;
+        if(writeFlag) BsPutBits(bs, start_bits, index);
+      }
+    }
+
+    for(i = (1 - ((codValue) ? 1 : 0)); i < no_band[j]; i++)
+    {
+      uint32 codeWord;
+
+      index  = frameData->iEnvelope[offset + i];
+      index  = (index < 0) ? MAX(index, -hCbIndexOffset) : MIN(index, hCbIndexOffset);
+      index += hCbIndexOffset;
+
+      if(!codValue)
+      {
+        bitsWritten += hCbBits_f[index];
+        if(writeFlag) 
+        {
+          if(frameData->coupling == COUPLING_BAL && ampRes != SBR_AMP_RES_1_5)
+            codeWord = hCb_f0[index];
+          else
+            codeWord = hCb_f[index];
+
+          BsPutBits(bs, hCbBits_f[index], codeWord);
+        }
+      }
+      else
+      {
+        bitsWritten += hCbBits_t[index];
+        if(writeFlag) 
+        {
+          if(frameData->coupling == COUPLING_BAL && ampRes != SBR_AMP_RES_1_5)
+            codeWord = hCb_t0[index];
+          else
+            codeWord = hCb_t[index];
+
+          BsPutBits(bs, hCbBits_t[index], codeWord);
+        }
+      }
+    }
+
+    offset += no_band[j];
+  }
+
+  return (bitsWritten);
+}
+
+/**
+ * Writes noise data for SBR.
+ */
+int16
+SBR_WriteNoiseData(SbrHeaderData *hHeaderData, SbrFrameData *frameData,
+                   TBitStream *bs, uint8 writeFlag)
+{
+  uint8 hCbIndexOffset;
+  const int32 *hCb_f = 0;
+  const uint16 *hCb_f0 = 0, *hCb_t = 0;
+  const uint8 *hCbBits_f, *hCbBits_t;
+  int16 i, k, noNoiseBands, bitsWritten;
+
+  noNoiseBands = hHeaderData->hFreqBandData->nNfb;
+
+  if(frameData->coupling == COUPLING_BAL) 
+  {
+    hCb_f0 = bookSbrEnvBalanceC11F;
+    hCbBits_f = bookSbrEnvBalanceL11F;
+
+    hCb_t = bookSbrNoiseBalanceC11T;
+    hCbBits_t = bookSbrNoiseBalanceL11T;
+
+    hCbIndexOffset = CODE_BOOK_SCF_LAV_BALANCE11;
+  }
+  else 
+  {
+    hCb_f = v_Huff_envelopeLevelC11F;
+    hCbBits_f = v_Huff_envelopeLevelL11F;
+
+    hCb_t = v_Huff_NoiseLevelC11T;
+    hCbBits_t = v_Huff_NoiseLevelL11T;
+
+    hCbIndexOffset = CODE_BOOK_SCF_LAV11;
+  }
+
+  k = SBR_BIT_ARRAY_SIZE - frameData->frameInfo.nNoiseEnvelopes;
+  for(i = 0, bitsWritten = 0; i < frameData->frameInfo.nNoiseEnvelopes; i++, k++) 
+  {
+    int16 j, index;
+    uint8 codValue;
+
+    codValue = frameData->domain_vec_noise & bitArray[k];
+
+    if(!codValue) 
+    {      
+      bitsWritten += 5;
+      if(writeFlag) 
+        BsPutBits(bs, 5, frameData->sbrNoiseFloorLevel[i * noNoiseBands]);
+
+      for(j = 1; j < noNoiseBands; j++) 
+      {
+        index  = frameData->sbrNoiseFloorLevel[i * noNoiseBands + j];
+        index  = (index < 0) ? MAX(index, -hCbIndexOffset) : MIN(index, hCbIndexOffset);
+        index += hCbIndexOffset;
+
+        bitsWritten += hCbBits_f[index];
+        if(writeFlag) 
+        {
+          uint32 codeWord = (frameData->coupling == COUPLING_BAL) ? hCb_f0[index] : hCb_f[index];
+          BsPutBits(bs, hCbBits_f[index], codeWord);
+        }
+      }
+    }
+    else 
+    {
+      for(j = 0; j < noNoiseBands; j++) 
+      {
+        index  = frameData->sbrNoiseFloorLevel[i * noNoiseBands + j];
+        index  = (index < 0) ? MAX(index, -hCbIndexOffset) : MIN(index, hCbIndexOffset);
+        index += hCbIndexOffset;
+
+        bitsWritten += hCbBits_t[index];
+        if(writeFlag) BsPutBits(bs, hCbBits_t[index], hCb_t[index]);
+      }
+    }
+  }
+
+  return (bitsWritten);
+}
+
+/**
+ * Writes dummy (=silence) data for parametric stereo part of SBR.
+ */
+int16
+SBR_WriteParametricStereoData(TBitStream *bs, uint8 writeFlag)
+{
+  int16 bitsWritten = 0;
+
+  /*-- Write header flag. --*/
+  bitsWritten += 1;
+  if(writeFlag) BsPutBits(bs, 1, 1);
+
+  /*-- Write 'enable_iid' element. --*/
+  bitsWritten += 1;
+  if(writeFlag) BsPutBits(bs, 1, 0);
+
+  /*-- Write 'enable_icc' element. --*/
+  bitsWritten += 1;
+  if(writeFlag) BsPutBits(bs, 1, 0);
+
+  /*-- Write 'enable_ext' element. --*/
+  bitsWritten += 1;
+  if(writeFlag) BsPutBits(bs, 1, 0);
+
+  /*-- Write frame class. --*/
+  bitsWritten += 1;
+  if(writeFlag) BsPutBits(bs, 1, 0);
+
+  /*-- Write envelope index. --*/
+  bitsWritten += 2;
+  if(writeFlag) BsPutBits(bs, 2, 0);
+
+  return (bitsWritten);
+}
+
+/**
+ * Writes extension data for SBR.
+ */
+int16 
+SBR_WritetExtendedData(TBitStream *bs, SbrExtensionData *extData, uint8 writeFlag)
+{
+  uint8 writeExt;
+  int16 bitsWritten = 0;
+
+  writeExt = (extData->writePsData || extData->extensionDataPresent) ? 1 : 0;
+
+  bitsWritten += 1;
+  if(writeFlag) BsPutBits(bs, 1, writeExt);
+
+  if(writeExt) 
+  {
+    int16 i, nBitsLeft, cnt, byteCount;
+
+    byteCount = (extData->writePsData) ? 2 : extData->byteCount;
+    cnt = (byteCount >= 15) ? 15 : byteCount;
+
+    bitsWritten += 4;
+    if(writeFlag) BsPutBits(bs, 4, cnt);
+
+    if(cnt == 15)
+    {
+      int16 diff;
+
+      diff = byteCount - 15;
+
+      bitsWritten += 8;
+      if(writeFlag) BsPutBits(bs, 8, diff);
+    }
+
+    nBitsLeft = byteCount << 3;
+
+    while(nBitsLeft > 7) 
+    {
+      nBitsLeft -= 2;
+      bitsWritten += 2;
+      if(writeFlag) BsPutBits(bs, 2, (extData->writePsData) ? 2 : extData->extension_id);
+
+      cnt = nBitsLeft >> 3;
+      bitsWritten += cnt << 3;
+      if(writeFlag)
+      {
+        if(extData->writePsData)
+        {
+          SBR_WriteParametricStereoData(bs, writeFlag);
+          BsPutBits(bs, 1, 0); /*-- This will byte align the data. --*/
+        }
+        else
+          for(i = 0; i < cnt; i++)
+            BsPutBits(bs, 8, extData->extensioData[i]);
+      }
+
+      nBitsLeft -= cnt << 3;
+    }
+
+    bitsWritten += nBitsLeft;
+    if(writeFlag) BsPutBits(bs, nBitsLeft, 0);
+  }
+
+  return (bitsWritten);
+}
+
+/**
+ * Writes envelope coding grid for SBR.
+ */
+int16
+SBR_WriteGridInfo(TBitStream *bs, SbrFrameData *frameData, uint8 writeFlag)
+{
+  FRAME_INFO *frameInfo;
+  SbrGridInfo *sbrGridInfo;
+  int16 pointer_bits, nEnv, bitsWritten, k;
+
+  nEnv = 0;
+  bitsWritten = 0;
+  frameInfo = &frameData->frameInfo;
+  sbrGridInfo = &frameData->sbrGridInfo;
+
+  bitsWritten += 2;
+  if(writeFlag) BsPutBits(bs, 2, frameInfo->frameClass);
+
+  switch(frameInfo->frameClass) 
+  {
+    case FIXFIX:
+      bitsWritten += 2;
+      if(writeFlag) BsPutBits(bs, 2, sbrGridInfo->bs_num_env);
+
+      bitsWritten += 1;
+      if(writeFlag) 
+        BsPutBits(bs, 1, frameInfo->freqRes & 0x1);
+      break;
+      
+    case FIXVAR:
+    case VARFIX:
+      bitsWritten += 2;
+      if(writeFlag) BsPutBits(bs, 2, sbrGridInfo->bs_var_board[0]);
+
+      bitsWritten += 2;
+      if(writeFlag) BsPutBits(bs, 2, sbrGridInfo->bs_num_env);
+
+      bitsWritten += sbrGridInfo->bs_num_env << 1;
+      if(writeFlag)
+        for(k = 0; k < sbrGridInfo->bs_num_env; k++) 
+          BsPutBits(bs, 2, sbrGridInfo->bs_rel_board_0[k]);
+
+      pointer_bits = (int16) (FloatFR_logDualis(sbrGridInfo->bs_num_env + 2) + 0.992188f);
+
+      bitsWritten += pointer_bits;
+      if(writeFlag) BsPutBits(bs, pointer_bits, sbrGridInfo->bs_pointer);
+
+      bitsWritten += sbrGridInfo->bs_num_env + 1;
+      break;
+  }
+
+  switch(frameInfo->frameClass) 
+  {
+    case FIXVAR:
+      if(writeFlag)
+      {
+        uint8 tmp = 0, tmp2 = frameInfo->freqRes;
+        for(k = sbrGridInfo->bs_num_env; k >= 0; k--)
+        {
+          tmp <<= 1;
+          tmp  |= tmp2 & 0x1;
+          tmp2 >>= 1;
+        }
+        BsPutBits(bs, sbrGridInfo->bs_num_env + 1, tmp);
+      }
+      break;
+
+    case VARFIX:
+      if(writeFlag)
+        BsPutBits(bs, sbrGridInfo->bs_num_env + 1, frameInfo->freqRes);
+      break;
+
+    case VARVAR:
+      bitsWritten += 8;
+      if(writeFlag)
+      {
+        BsPutBits(bs, 2, sbrGridInfo->bs_var_board[0]);
+        BsPutBits(bs, 2, sbrGridInfo->bs_var_board[1]);
+        BsPutBits(bs, 2, sbrGridInfo->bs_num_rel[0]);
+        BsPutBits(bs, 2, sbrGridInfo->bs_num_rel[1]);
+      }
+      
+      nEnv = sbrGridInfo->bs_num_rel[0] + sbrGridInfo->bs_num_rel[1] + 1;
+
+      bitsWritten += sbrGridInfo->bs_num_rel[0] << 1;
+      if(writeFlag)
+        for(k = 0; k < sbrGridInfo->bs_num_rel[0]; k++)
+          BsPutBits(bs, 2, sbrGridInfo->bs_rel_board_0[k]);
+
+      bitsWritten += sbrGridInfo->bs_num_rel[1] << 1;
+      if(writeFlag)
+        for(k = 0; k < sbrGridInfo->bs_num_rel[1]; k++) 
+          BsPutBits(bs, 2, sbrGridInfo->bs_rel_board_1[k]);
+
+      pointer_bits = (int16) (FloatFR_logDualis(nEnv + 1) + 0.992188f);
+
+      bitsWritten += pointer_bits;
+      if(writeFlag) BsPutBits(bs, pointer_bits, sbrGridInfo->bs_pointer);
+
+      bitsWritten += nEnv;
+      if(writeFlag)
+        BsPutBits(bs, nEnv, frameInfo->freqRes);
+      break;
+  }
+
+  return (bitsWritten);
+}
+
+int16
+SBR_WriteSCE(SbrHeaderData *hHeaderData, SbrFrameData  *hFrameData,
+             SbrExtensionData *sbrExtData, TBitStream *bs,
+             uint8 isMono, uint8 writeFlag)
+{
+  int16 bitsWritten;
+
+  /*-- No reserved bits. --*/
+  bitsWritten = 1;
+  if(writeFlag) BsPutBits(bs, 1, hFrameData->dataPresent);
+
+  bitsWritten += (hFrameData->dataPresent) ? 4 : 0;
+  if(hFrameData->dataPresent)
+    if(writeFlag) BsPutBits(bs, 4, 0);
+
+  /*-- Write grid info. --*/
+  bitsWritten += SBR_WriteGridInfo(bs, hFrameData, writeFlag);
+
+  /*-- Write direction info for the envelope coding. --*/
+  bitsWritten += SBR_WriteDTDFData(hFrameData, bs, writeFlag);
+
+  /*-- Write inverse filtering modes. --*/
+  bitsWritten += hHeaderData->hFreqBandData->nInvfBands << 1;
+  if(writeFlag)
+    BsPutBits(bs, hHeaderData->hFreqBandData->nInvfBands << 1, hFrameData->sbr_invf_mode);
+
+  /*-- Write envelope values. --*/
+  bitsWritten += SBR_WriteEnvelopeData(hHeaderData, hFrameData, bs, writeFlag);
+
+  /*-- Write noise floor values. --*/
+  bitsWritten += SBR_WriteNoiseData(hHeaderData, hFrameData, bs, writeFlag);
+
+  /*-- Write additional sinusoidals, if any. --*/
+  bitsWritten += SBR_WriteSinusoidalData(hFrameData, bs, hHeaderData->hFreqBandData->nSfb[1], writeFlag);
+
+  /*
+   * Write extended data info, this is only in case of mono since parameters
+   * for parametric stereo are decoded via the data extension. In case of stereo
+   * do nothing.
+   */
+  if(!isMono)
+  {
+    bitsWritten += 1;
+    if(writeFlag) BsPutBits(bs, 1, 0);
+  }
+  else
+    bitsWritten += SBR_WritetExtendedData(bs, sbrExtData, writeFlag);
+
+  return (bitsWritten);
+}
+
+int16
+SBR_WriteCPE(SbrHeaderData *hHeaderData, SbrFrameData *hFrameDataLeft,
+             SbrFrameData *hFrameDataRight, SbrExtensionData *sbrExtData,
+             TBitStream *bs, uint8 writeFlag)
+{
+  int16 bitsWritten;
+
+  /*-- No reserved bits. --*/
+  bitsWritten = 1;
+  if(writeFlag) BsPutBits(bs, 1, 0);
+  bitsWritten += (hFrameDataLeft->dataPresent) ? 8 : 0;
+  if(hFrameDataLeft->dataPresent)
+    if(writeFlag) BsPutBits(bs, 8, 0);
+
+  bitsWritten += 1;
+  if(writeFlag)
+  {
+    if(hFrameDataLeft->coupling) 
+      BsPutBits(bs, 1, 1);
+    else
+      BsPutBits(bs, 1, 0);
+  }
+
+  /*-- Write grid info (left channel). --*/
+  bitsWritten += SBR_WriteGridInfo(bs, hFrameDataLeft, writeFlag);
+
+  /*-- Write grid info (right channel). --*/
+  if(!hFrameDataLeft->coupling)
+    bitsWritten += SBR_WriteGridInfo(bs, hFrameDataRight, writeFlag);
+
+  /*-- Write direction info for the envelope coding (left channel). --*/
+  bitsWritten += SBR_WriteDTDFData(hFrameDataLeft, bs, writeFlag);
+
+  /*-- Write direction info for the envelope coding (right channel). --*/
+  bitsWritten += SBR_WriteDTDFData(hFrameDataRight, bs, writeFlag);
+
+  /*-- Write inverse filtering modes. --*/
+  bitsWritten += hHeaderData->hFreqBandData->nInvfBands << 1;
+  if(writeFlag)
+    BsPutBits(bs, hHeaderData->hFreqBandData->nInvfBands << 1, hFrameDataLeft->sbr_invf_mode);
+
+  if(hFrameDataLeft->coupling) 
+  {
+    /*-- Write envelope values. --*/
+    bitsWritten += SBR_WriteEnvelopeData(hHeaderData, hFrameDataLeft, bs, writeFlag);
+
+    /*-- Write noise floor values. --*/
+    bitsWritten += SBR_WriteNoiseData(hHeaderData, hFrameDataLeft, bs, writeFlag);
+
+    /*-- Write envelope values. --*/
+    bitsWritten += SBR_WriteEnvelopeData(hHeaderData, hFrameDataRight, bs, writeFlag);
+  }
+  else 
+  {
+    bitsWritten += hHeaderData->hFreqBandData->nInvfBands << 1;
+    if(writeFlag)
+      BsPutBits(bs, hHeaderData->hFreqBandData->nInvfBands << 1, hFrameDataRight->sbr_invf_mode);
+
+    /*-- Write envelope values. --*/
+    bitsWritten += SBR_WriteEnvelopeData(hHeaderData, hFrameDataLeft, bs, writeFlag);
+
+    /*-- Write envelope values. --*/
+    bitsWritten += SBR_WriteEnvelopeData(hHeaderData, hFrameDataRight, bs, writeFlag);
+
+    /*-- Write noise floor values. --*/
+    bitsWritten += SBR_WriteNoiseData(hHeaderData, hFrameDataLeft, bs, writeFlag);
+  }
+
+  /*-- Write noise floor values. --*/
+  bitsWritten += SBR_WriteNoiseData(hHeaderData, hFrameDataRight, bs, writeFlag);
+
+  /*-- Write additional sinusoidals, if any. --*/
+  bitsWritten += SBR_WriteSinusoidalData(hFrameDataLeft, bs, hHeaderData->hFreqBandData->nSfb[1], writeFlag);
+  bitsWritten += SBR_WriteSinusoidalData(hFrameDataRight, bs, hHeaderData->hFreqBandData->nSfb[1], writeFlag);
+
+  /*-- No extended data. --*/
+#if 0
+  bitsWritten += 1;
+  if(writeFlag) BsPutBits(bs, 1, 0);
+#else
+  bitsWritten += SBR_WritetExtendedData(bs, sbrExtData, writeFlag);
+#endif /*-- 0 --*/
+
+  return (bitsWritten);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/sbr_codec.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,748 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/*
+  \file
+  \brief SBR codec implementation $Revision: 1.1.1.1.4.1 $
+*/
+
+/**************************************************************************
+  sbr_codec.cpp - SBR codec implementation.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2004 by Nokia Research Center, Multimedia Technologies.
+  *************************************************************************/
+
+/*-- Project Headers. --*/
+#include "sbr_codec.h"
+#include "env_extr.h"
+#include "sbr_rom.h"
+#include "sbr_bitmux.h"
+
+struct SBR_Decoder_Instance
+{
+  SbrFrameData *frameData[2];
+  SbrHeaderData *sbrHeader[2];
+  FreqBandData *freqBandData[2];
+
+  SbrExtensionData *sbrExtData;
+
+};
+
+
+FLOAT 
+FloatFR_logDualis(int16 a) 
+{ 
+  return (logDualisTable[a]); 
+}
+
+FLOAT 
+FloatFR_getNumOctaves(int16 a, int16 b) 
+{
+  return (FloatFR_logDualis(b) - FloatFR_logDualis(a));
+}
+
+int16
+ReadSBRExtensionData(TBitStream *bs, SbrBitStream *streamSBR, 
+                     int16 extension_type, int16 prev_element, 
+                     int16 dataCount)
+{
+  int16 i, sbrPresent;
+
+  sbrPresent = 0;
+  if(!(prev_element == SBR_ID_SCE || prev_element == SBR_ID_CPE))
+    return (sbrPresent);
+
+  if(!(extension_type == SBR_EXTENSION || extension_type == SBR_EXTENSION_CRC))
+    return (sbrPresent);
+
+  if(dataCount < MAX_SBR_BYTES && streamSBR->NrElements < MAX_NR_ELEMENTS)
+  {
+    streamSBR->sbrElement[streamSBR->NrElements].Data[0] = (uint8) BsGetBits(bs, 4);
+
+    for(i = 1; i < dataCount; i++)
+      streamSBR->sbrElement[streamSBR->NrElements].Data[i] = (uint8) BsGetBits(bs, 8);
+
+    streamSBR->sbrElement[streamSBR->NrElements].ExtensionType = extension_type;
+    streamSBR->sbrElement[streamSBR->NrElements].Payload = dataCount;
+    streamSBR->NrElements += 1;
+    sbrPresent = 1;
+  }
+
+  return (sbrPresent);
+}
+
+SbrBitStream *
+CloseSBRBitStream(SbrBitStream *Bitstr)
+{
+  if(Bitstr)
+  {
+    int16 i;
+
+    for(i = 0; i < MAX_NR_ELEMENTS; i++)
+    {
+      if(Bitstr->sbrElement[i].Data != 0)
+        delete[] Bitstr->sbrElement[i].Data;
+      Bitstr->sbrElement[i].Data = NULL;
+    }
+
+    
+    delete Bitstr;
+    Bitstr = NULL;
+  }
+
+  return (NULL);
+}
+
+SbrBitStream *
+OpenSBRBitStreamL(void)
+{
+  int16 i;
+  SbrBitStream *Bitstr;
+
+  /*-- Create SBR bitstream handle. --*/
+  Bitstr = (SbrBitStream *) new (ELeave) SbrBitStream[1];
+  CleanupStack::PushL(Bitstr);
+
+  ZERO_MEMORY(Bitstr, sizeof(SbrBitStream));
+
+  /*-- Create payload handle for each supported element. --*/
+  for(i = 0; i < MAX_NR_ELEMENTS; i++)
+  {
+    Bitstr->sbrElement[i].Data = (uint8 *) new (ELeave) uint8[MAX_SBR_BYTES];
+    CleanupStack::PushL(Bitstr->sbrElement[i].Data);
+
+    ZERO_MEMORY(Bitstr->sbrElement[i].Data, MAX_SBR_BYTES);
+  }
+
+  CleanupStack::Pop(MAX_NR_ELEMENTS + 1); /*-- 'Bitstr->sbrElement[i].Data' + 'Bitstr' --*/
+
+  return (Bitstr);
+}
+
+/*!
+  \brief     Set up SBR decoder
+
+  \return    Handle
+*/
+SBR_Decoder *
+OpenSBRDecoderL(int32 sampleRate, int16 samplesPerFrame, uint8 isStereo, uint8 isDualMono)
+{
+  uint8 nPops;
+  SBR_Decoder *sbrDecoder;
+
+  /*-- Create main handle. --*/
+  sbrDecoder = (SBR_Decoder *) new (ELeave) SBR_Decoder[1];
+  CleanupStack::PushL(sbrDecoder); nPops = 1;
+
+  ZERO_MEMORY(sbrDecoder, sizeof(SBR_Decoder));
+
+  /*-- Create frame data for mono or left channel. --*/
+  sbrDecoder->frameData[0] = (SbrFrameData *) new (ELeave) SbrFrameData[1];
+  CleanupStack::PushL(sbrDecoder->frameData[0]); nPops++;
+
+  ZERO_MEMORY(sbrDecoder->frameData[0], sizeof(SbrFrameData));
+
+  /*-- Create frame data for right channel. --*/
+  if(isStereo)
+  {
+    sbrDecoder->frameData[1] = (SbrFrameData *) new (ELeave) SbrFrameData[1];
+    CleanupStack::PushL(sbrDecoder->frameData[1]); nPops++;
+
+    ZERO_MEMORY(sbrDecoder->frameData[1], sizeof(SbrFrameData));
+  }
+
+  /*-- Create header data. --*/
+  sbrDecoder->sbrHeader[0] = (SbrHeaderData *) new (ELeave) SbrHeaderData[1];
+  CleanupStack::PushL(sbrDecoder->sbrHeader[0]); nPops++;
+
+  ZERO_MEMORY(sbrDecoder->sbrHeader[0], sizeof(SbrHeaderData));
+
+  /*
+   * Create header data for dual channel if so needed. Remember that in
+   * dual channel mode individual channels are not jointly coded,
+   * each channel element is coded separately. Thus, also header data 
+   * can change between frames of the individual channels.
+   */
+  if(isDualMono)
+  {
+    sbrDecoder->sbrHeader[1] = (SbrHeaderData *) new (ELeave) SbrHeaderData[1];
+    CleanupStack::PushL(sbrDecoder->sbrHeader[1]); nPops++;
+
+    ZERO_MEMORY(sbrDecoder->sbrHeader[1], sizeof(SbrHeaderData));
+  }
+
+  /*-- Create frequency band tables for mono or left channel. --*/
+  sbrDecoder->freqBandData[0] = (FreqBandData *) new (ELeave) FreqBandData[1];
+  CleanupStack::PushL(sbrDecoder->freqBandData[0]); nPops++;
+
+  ZERO_MEMORY(sbrDecoder->freqBandData[0], sizeof(FreqBandData));
+
+  /*-- Create frequency band data for dual channel. --*/
+  if(isDualMono)
+  {
+    sbrDecoder->freqBandData[1] = (FreqBandData *) new (ELeave) FreqBandData[1];
+    CleanupStack::PushL(sbrDecoder->freqBandData[1]); nPops++;
+
+    ZERO_MEMORY(sbrDecoder->sbrHeader[1], sizeof(FreqBandData));
+  }
+
+  /*-- Create extension data handle. --*/
+  sbrDecoder->sbrExtData = (SbrExtensionData *) new (ELeave) SbrExtensionData[1];
+  CleanupStack::PushL(sbrDecoder->sbrExtData); nPops++;
+
+  ZERO_MEMORY(sbrDecoder->sbrExtData, sizeof(SbrExtensionData));
+
+  /*
+   * Create data buffer for extension data. Data for parametric stereo 
+   * will be stored here. Can exist only in mono mode.
+   */
+  if(!isStereo && !isDualMono)
+  {
+    sbrDecoder->sbrExtData->extDataBufLen = 128;
+    sbrDecoder->sbrExtData->extensioData = (uint8 *) new (ELeave) uint8[sbrDecoder->sbrExtData->extDataBufLen];
+    CleanupStack::PushL(sbrDecoder->sbrExtData->extensioData); nPops++;
+
+    ZERO_MEMORY(sbrDecoder->sbrExtData->extensioData, sbrDecoder->sbrExtData->extDataBufLen);
+  }
+
+  /*-- Initialize header(s) with default values. --*/
+  initHeaderData(sbrDecoder->sbrHeader[0], sbrDecoder->freqBandData[0], sampleRate, samplesPerFrame);
+  if(isDualMono)
+    initHeaderData(sbrDecoder->sbrHeader[1], sbrDecoder->freqBandData[1], sampleRate, samplesPerFrame);
+
+  CleanupStack::Pop(nPops);
+
+  return (sbrDecoder);
+}
+
+/*!
+  \brief     Close SBR decoder resources
+
+  \return    NULL
+*/
+
+SBR_Decoder *
+CloseSBR(SBR_Decoder *sbrDecoder)
+{
+  if(sbrDecoder)
+  {
+    if(sbrDecoder->frameData[0] != 0)
+      delete sbrDecoder->frameData[0];
+    sbrDecoder->frameData[0] = NULL;
+
+    if(sbrDecoder->frameData[1] != 0)
+      delete sbrDecoder->frameData[1];
+    sbrDecoder->frameData[1] = NULL;
+
+    if(sbrDecoder->sbrHeader[0] != 0)
+      delete sbrDecoder->sbrHeader[0];
+    sbrDecoder->sbrHeader[0] = NULL;
+
+    if(sbrDecoder->sbrHeader[1] != 0)
+      delete sbrDecoder->sbrHeader[1];
+    sbrDecoder->sbrHeader[1] = NULL;
+
+    if(sbrDecoder->freqBandData[0] != 0)
+      delete sbrDecoder->freqBandData[0];
+    sbrDecoder->freqBandData[0] = NULL;
+
+    if(sbrDecoder->freqBandData[1] != 0)
+      delete sbrDecoder->freqBandData[1];
+    sbrDecoder->freqBandData[1] = NULL;
+
+    if(sbrDecoder->sbrExtData != 0)
+    {      
+      if(sbrDecoder->sbrExtData->extensioData != 0)
+        delete[] sbrDecoder->sbrExtData->extensioData;
+      sbrDecoder->sbrExtData->extensioData = NULL;
+     
+      delete sbrDecoder->sbrExtData;
+    }
+    sbrDecoder->sbrExtData = NULL;
+
+    delete sbrDecoder;
+    sbrDecoder = NULL;
+  }
+
+  return (NULL);
+}
+
+int32
+SBR_WritePayload(TBitStream *bs, SbrFrameData *frameData[2], 
+                 SbrHeaderData *hHeaderData, SbrExtensionData *sbrExtData,
+                 uint8 headerStatus, uint8 isStereo, uint8 writeFlag)
+{
+  int32 bitsWritten;
+
+  /*-- Write header flag. --*/
+  bitsWritten = 1;
+  if(writeFlag) BsPutBits(bs, 1, headerStatus);
+
+  /*-- Write header data. --*/
+  if(headerStatus)
+    bitsWritten += SBR_WriteHeaderData(hHeaderData, bs, writeFlag);
+
+  /*-- Write payload data. --*/
+  if(hHeaderData->syncState == SBR_ACTIVE)
+  {
+    if(isStereo)
+      bitsWritten += SBR_WriteCPE(hHeaderData, frameData[0], frameData[1], sbrExtData, bs, writeFlag);
+    else
+      bitsWritten += SBR_WriteSCE(hHeaderData, frameData[0], sbrExtData, bs, 1, writeFlag);
+  }
+
+  return (bitsWritten);
+}
+
+INLINE int32
+WriteSBR(TBitStream *bs, SbrFrameData *frameData[2], SbrHeaderData *hHeaderData, 
+         SbrExtensionData *sbrExtData, uint8 isStereo, uint8 headerPresent, 
+         uint8 writeFlag)
+{
+  int32 bitsWritten;
+
+  bitsWritten = 0;
+
+  /*-- Write extension tag. --*/
+  bitsWritten += 4;
+  if(writeFlag) BsPutBits(bs, 4, SBR_EXTENSION);
+
+  /*-- Write actual SBR payload. --*/
+  bitsWritten += SBR_WritePayload(bs, frameData, hHeaderData, sbrExtData, headerPresent, isStereo, writeFlag);
+
+  /*-- Byte align. --*/
+  if(bitsWritten & 0x7)
+  {
+    uint8 bitsLeft = (uint8) (8 - (bitsWritten & 0x7));
+
+    bitsWritten += bitsLeft;      
+    if(writeFlag) BsPutBits(bs, bitsLeft, 0);
+  }
+
+  return (bitsWritten);
+}
+
+/*
+ * Writes dummy payload data.
+ */
+INLINE int32 
+WriteDummyPayload(TBitStream *bs, int32 nDummyBytes)
+{
+  int32 i, nBitsWritten;
+
+  nBitsWritten = 4;
+  BsPutBits(bs, 4, 0);
+
+  nBitsWritten += 4;
+  BsPutBits(bs, 4, 0);
+  for(i = 0; i < (nDummyBytes - 1); i++)
+  {
+    nBitsWritten += 8;
+    BsPutBits(bs, 8, 0xA5);
+  }
+
+  return (nBitsWritten);
+}
+
+/*
+ * Writes the length of AAC Fill Element (FIL) as specified in the standard.
+ */
+INLINE int32 
+WriteAACFilLength(TBitStream *bs, int32 nFilBytes)
+{
+  int32 cnt, nBitsWritten;
+
+  nBitsWritten = 0;
+  cnt = (nFilBytes >= 15) ? 15 : nFilBytes;
+
+  nBitsWritten += 4;
+  BsPutBits(bs, 4, cnt);
+  if(cnt == 15)
+  {
+    int32 diff;
+
+    diff = nFilBytes - 15 + 1;
+
+    nBitsWritten += 8;
+    BsPutBits(bs, 8, diff);
+  }
+
+  return (nBitsWritten);
+}
+
+int32
+WriteSBRExtensionData2(TBitStream *bsOut, SbrFrameData *frameData[2], 
+                       SbrHeaderData *hHeaderData, SbrExtensionData *sbrExtData, 
+                       uint8 isStereo, uint8 headerPresent)
+{
+  int32 bitsWritten, nFilBytes;
+
+  /*-- Write fill element code. --*/
+  BsPutBits(bsOut, 3, 0x6);
+
+  /*-- Count SBR part. --*/
+  bitsWritten = WriteSBR(NULL, frameData, hHeaderData, sbrExtData, isStereo, headerPresent, 0);
+  nFilBytes = bitsWritten >> 3;
+
+  /*-- Write length of FIL element. --*/
+  WriteAACFilLength(bsOut, nFilBytes);
+
+  /*-- Write SBR data. --*/
+  if(nFilBytes > 0)
+  {
+    bitsWritten = WriteSBR(bsOut, frameData, hHeaderData, sbrExtData, isStereo, headerPresent, 1);
+    nFilBytes -= bitsWritten >> 3;
+  }
+
+  /*-- Write dummy data if needed. --*/
+  if(nFilBytes > 0)
+  {
+    /*-- Write fill element code. --*/
+    BsPutBits(bsOut, 3, 0x6);
+
+    /*-- Write length of FIL element. --*/
+    bitsWritten += WriteAACFilLength(bsOut, nFilBytes);
+
+    WriteDummyPayload(bsOut, nFilBytes);
+  }
+
+  return (BsGetBitsRead(bsOut));
+}
+
+int32
+WriteSBRExtensionData(TBitStream *bsIn, TBitStream *bsOut, int16 bitOffset,
+                      SBR_Decoder *sbrDecoder, 
+                      SbrHeaderData *hHeaderData,
+                      uint8 isStereo, 
+                      uint8 headerPresent)
+{
+  int32 bitsWritten; 
+
+  /*-- Locate start position for SBR data within the buffer. --*/
+  BsCopyBits(bsIn, bsOut, bitOffset);
+
+  bitsWritten = BsGetBitsRead(bsOut);
+
+  WriteSBRExtensionData2(bsOut, sbrDecoder->frameData, hHeaderData, sbrDecoder->sbrExtData, isStereo, headerPresent);
+
+  bitsWritten = BsGetBitsRead(bsOut) - bitsWritten;
+
+  return (bitsWritten);
+}
+
+int16
+WriteSBRSilenceElement(SBR_Decoder *sbrDecoder, TBitStream *bsOut, uint8 isStereo)
+{
+  int32 bitsWritten;
+
+  bitsWritten = BsGetBitsRead(bsOut);
+
+  WriteSBRExtensionData2(bsOut, sbrDecoder->frameData, sbrDecoder->sbrHeader[0], sbrDecoder->sbrExtData, isStereo, 1);
+
+  bitsWritten = BsGetBitsRead(bsOut) - bitsWritten;
+
+  return (bitsWritten);
+}
+
+void
+InitSBRSilenceData(SBR_Decoder *sbrDecoder, uint8 isStereo, uint8 isParametricStereo)
+{
+  sbrDecoder->sbrHeader[0]->startFreq = 15;
+  sbrDecoder->sbrHeader[0]->stopFreq = 14;
+
+  sbrDecoder->frameData[0]->frameInfo.nEnvelopes = 1;
+  sbrDecoder->frameData[0]->frameInfo.nNoiseEnvelopes = 1;
+  if(isStereo)
+  {
+    sbrDecoder->frameData[1]->frameInfo.nEnvelopes = 1;
+    sbrDecoder->frameData[1]->frameInfo.nNoiseEnvelopes = 1;
+  }
+
+  sbrDecoder->sbrExtData->writePsData = (uint8) ((isParametricStereo) ? 1 : 0);
+
+  resetFreqBandTables(sbrDecoder->sbrHeader[0]);
+  sbrDecoder->sbrHeader[0]->syncState = SBR_ACTIVE;
+}
+
+int16
+GenerateSBRSilenceDataL(uint8 *OutBuffer, int16 OutBufferSize, int32 sampleRate, 
+                        uint8 isStereo, uint8 isParametricStereo)
+{
+  int16 sbrBits;
+  TBitStream bsOut;
+  SBR_Decoder *sbrDecoder;
+
+  sbrDecoder = OpenSBRDecoderL(sampleRate, 1024, isStereo, 0);
+
+  InitSBRSilenceData(sbrDecoder, isStereo, isParametricStereo);
+
+  BsInit(&bsOut, OutBuffer, OutBufferSize);
+
+  sbrBits = (int16) WriteSBRExtensionData2(&bsOut, sbrDecoder->frameData, sbrDecoder->sbrHeader[0], sbrDecoder->sbrExtData, isStereo, 1);
+
+  return (sbrBits);
+}
+
+int16
+WriteSBRExtensionSilenceData(TBitStream *bsOut, uint8 *SbrBuffer, 
+                             int16 SbrBits, uint8 writeTerminationCode)
+{
+  TBitStream bsSbr;
+  int16 bitsWritten;
+
+  /*-- Initialize bitstream parser. --*/
+  BsInit(&bsSbr, SbrBuffer, (SbrBits + 8) >> 3);
+
+  /*-- Write the silence data. --*/
+  BsCopyBits(&bsSbr, bsOut, SbrBits);
+
+  /*-- Write termination code. --*/
+  if(writeTerminationCode)
+    BsPutBits(bsOut, 3, 0x7);
+
+  bitsWritten = BsGetBitsRead(bsOut);
+
+  if(writeTerminationCode)
+  {
+    /*-- Byte align. --*/
+    if(bitsWritten & 0x7)
+    {
+      int16 bitsLeft = 8 - (bitsWritten & 0x7);
+
+      bitsWritten += bitsLeft;
+      BsPutBits(bsOut, bitsLeft, 0);
+    }
+  }
+
+  return (bitsWritten);
+}
+
+uint8
+ParseSBRPayload(SBR_Decoder *self, SbrHeaderData *hHeaderData, 
+                SbrElementStream *sbrElement, int16 decVal,
+                uint8 isStereo)
+{
+  TBitStream bs;
+
+  /*-- Initialize bitstream. --*/
+  BsInit(&bs, sbrElement->Data, sbrElement->Payload);
+
+  /*-- Remove invalid data from bit buffer. --*/
+  BsGetBits(&bs, 4);
+
+  /*-- CRC codeword present? --*/
+  if(sbrElement->ExtensionType == SBR_EXTENSION_CRC)
+    BsGetBits(&bs, 10);
+
+  /*-- Header present? --*/
+  sbrElement->headerStatus = (uint8) BsGetBits(&bs, 1);
+
+  /*-- Read header data. --*/
+  if(sbrElement->headerStatus) 
+  {
+    SBR_HEADER_STATUS headerStatus;
+    
+    headerStatus = sbrGetHeaderData(hHeaderData, &bs);
+    if(headerStatus == HEADER_RESET) 
+    {
+      int16 err;
+
+      /*-- Reset values. --*/
+      err = resetFreqBandTables(hHeaderData);
+      if(err == 0) hHeaderData->syncState = SBR_ACTIVE;
+    }
+  }
+
+  /*-- Read payload data. --*/
+  if(hHeaderData->syncState == SBR_ACTIVE) 
+  {
+    /*-- Read channel pair element related data. --*/
+    if(isStereo)
+      sbrGetCPE(hHeaderData, self->frameData[0], self->frameData[1], self->sbrExtData, &bs, decVal);
+
+    /*-- Read mono data. --*/
+    else
+      sbrGetSCE(hHeaderData, self->frameData[0], self->sbrExtData, &bs, decVal, 1);
+  }
+
+  return (1);
+}
+
+/*!
+  \brief     SBR bitstream parsing
+
+  \return    Number of bytes written to output bitstream
+*/
+int16
+ParseSBR(TBitStream *bsIn, TBitStream *bsOut, SBR_Decoder *self, 
+         SbrBitStream *Bitstr, int16 decVal)
+{
+  int32 i, bitsWritten = BsGetBitsRead(bsOut);
+
+  /*
+   * Write frame bits from the start of frame till 
+   * the start of 1st channel element. 
+   */
+  BsCopyBits(bsIn, bsOut, Bitstr->sbrElement[0].elementOffset);
+
+  if(Bitstr->NrElements) 
+  {
+    int16 SbrFrameOK, dualMono;
+
+    SbrFrameOK = 1;
+    dualMono = (Bitstr->NrElements == 2) ? 1 : 0;
+
+    for(i = 0; i < Bitstr->NrElements; i++) 
+    {
+      uint8 stereo;
+      SbrElementStream *sbrElement;
+
+      sbrElement = &Bitstr->sbrElement[i];
+      
+      if(sbrElement->Payload < 1)
+        continue;
+
+      stereo = 0;
+
+      switch(sbrElement->ElementID) 
+      {
+        case SBR_ID_SCE:
+          stereo = 0;
+          break;
+
+        case SBR_ID_CPE:
+          stereo = 1;
+          break;
+
+        default:
+          SbrFrameOK = 0;
+          break;
+      }
+
+      if(SbrFrameOK) 
+      {
+        ParseSBRPayload(self, self->sbrHeader[dualMono ? i : 0], sbrElement, decVal, stereo);
+
+        WriteSBRExtensionData(bsIn, bsOut, sbrElement->chElementLen, self,
+                              self->sbrHeader[dualMono ? i : 0],
+                              stereo, sbrElement->headerStatus);
+
+        if(i < (Bitstr->NrElements - 1))
+        {
+          int32 endElement, startNextElement;
+
+          endElement = sbrElement->elementOffset + sbrElement->chElementLen;
+          startNextElement = Bitstr->sbrElement[i + 1].elementOffset;
+
+          BsSkipNBits(bsIn, startNextElement - endElement);
+        }
+      }
+    }
+
+    /*-- Write termination code. --*/
+    BsPutBits(bsOut, 3, 0x7);
+
+    bitsWritten = BsGetBitsRead(bsOut) - bitsWritten;
+
+    /*-- Byte align. --*/
+    if(bitsWritten & 0x7)
+    {
+      uint8 bitsLeft = (uint8) (8 - (bitsWritten & 0x7));
+      
+      bitsWritten += bitsLeft;
+      BsPutBits(bsOut, bitsLeft, 0);
+    }
+  }
+
+  return (int16) (bitsWritten >> 3);
+}
+
+uint8
+IsSBRParametricStereoEnabled(SBR_Decoder *self, SbrBitStream *Bitstr)
+{
+  uint8 isParamStereoPresent;
+
+  isParamStereoPresent = 0;
+
+  if(self && Bitstr->NrElements == 1) 
+  {
+    SbrElementStream *sbrElement;
+
+    sbrElement = &Bitstr->sbrElement[0];
+
+    if(sbrElement->Payload > 0 && sbrElement->ElementID == SBR_ID_SCE)
+    {
+      ParseSBRPayload(self, self->sbrHeader[0], sbrElement, 0, 0);
+
+      if(self->sbrExtData->extensionDataPresent)
+        if(self->sbrExtData->extension_id == SBR_PARAMETRIC_STEREO_ID)
+          isParamStereoPresent = 1;
+    }
+  }
+
+  return (isParamStereoPresent);
+}
+
+uint8
+IsSBREnabled(SbrBitStream *Bitstr)
+{
+  uint8 isSBR;
+
+  isSBR = (Bitstr && Bitstr->NrElements) ? 1 : 0;
+
+  return (isSBR);
+}
+
+int16
+WriteSBRSilence(TBitStream *bsIn, TBitStream *bsOut, SbrBitStream *streamSBR,
+                uint8 *SbrBuffer, int16 SbrBits)
+{
+  int32 i;
+
+  /*
+   * Write frame bits from the start of frame till 
+   * the start of 1st channel element. 
+   */
+  BsCopyBits(bsIn, bsOut, streamSBR->sbrElement[0].elementOffset);
+
+  /*-- Write channel element. --*/
+  BsCopyBits(bsIn, bsOut, streamSBR->sbrElement[0].chElementLen);
+
+  for(i = 0; i < streamSBR->NrElements; i++)
+  {
+    uint8 writeEndCode = (i == (streamSBR->NrElements - 1)) ? 1 : 0;
+
+    WriteSBRExtensionSilenceData(bsOut, SbrBuffer, SbrBits, writeEndCode);
+
+    if(i < (streamSBR->NrElements - 1))
+    {
+      int32 endElement, startNextElement;
+      
+      endElement = streamSBR->sbrElement[i].elementOffset + streamSBR->sbrElement[i].chElementLen;
+      startNextElement = streamSBR->sbrElement[i + 1].elementOffset;
+
+      BsSkipNBits(bsIn, startNextElement - endElement);
+
+      BsCopyBits(bsIn, bsOut, streamSBR->sbrElement[i + 1].chElementLen);
+    }
+  }
+
+  return (int16) (BsGetBitsRead(bsOut) >> 3);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/sbr_demux.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,594 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/*
+  \file
+  \brief SBR codec implementation $Revision: 1.1.1.1.4.1 $
+*/
+
+/**************************************************************************
+  sbr_demux.cpp - SBR bitstream demultiplexer implementations.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2004 by Nokia Research Center, Multimedia Technologies.
+  *************************************************************************/
+
+/*-- Project Headers. --*/
+#include "sbr_rom.h"
+#include "env_extr.h"
+
+typedef const int8 (*Huffman)[2];
+
+/*
+  \brief   Decodes Huffman codeword from TBitStream
+
+  \return  Decoded Huffman value.
+*/
+int16
+DecodeHuffmanCW(Huffman h, TBitStream *bs)
+{
+  int16 value, bit, index = 0;
+
+  while(index >= 0) 
+  {
+    bit = (int16) BsGetBits(bs, 1);
+    index = h[index][bit];
+  }
+
+  value = index + 64;
+
+  return (value);
+}
+
+/*
+  \brief   Reads direction control data from TBitStream
+*/
+void
+sbrGetDTDFData(SbrFrameData *frameData, TBitStream *bs)
+{
+  frameData->domain_vec = (uint8) BsGetBits(bs, frameData->frameInfo.nEnvelopes);
+  frameData->domain_vec_noise = (uint8) BsGetBits(bs, frameData->frameInfo.nNoiseEnvelopes);
+}
+
+/*
+  \brief   Reads noise-floor-level data from TBitStream
+*/
+void
+sbrGetNoiseFloorData(SbrHeaderData *headerData, SbrFrameData *frameData, TBitStream *bs)
+{
+  int16 i, j, k, noNoiseBands;
+  Huffman hcb_noiseF, hcb_noise;
+
+  noNoiseBands = headerData->hFreqBandData->nNfb;
+
+  if(frameData->coupling == COUPLING_BAL) 
+  {
+    hcb_noise = (Huffman) &sbr_huffBook_NoiseBalance11T;
+    hcb_noiseF = (Huffman) &sbr_huffBook_EnvBalance11F;
+  }
+  else 
+  {
+    hcb_noise = (Huffman) &sbr_huffBook_NoiseLevel11T;
+    hcb_noiseF = (Huffman) &sbr_huffBook_EnvLevel11F;
+  }
+
+  k = SBR_BIT_ARRAY_SIZE - frameData->frameInfo.nNoiseEnvelopes;
+  for(i = 0; i < frameData->frameInfo.nNoiseEnvelopes; i++, k++) 
+  {
+    uint8 codValue;
+    int16 index = i * noNoiseBands;
+
+    codValue = frameData->domain_vec_noise & bitArray[k];
+
+    if(!codValue) 
+    {
+      frameData->sbrNoiseFloorLevel[index++] = (int16) BsGetBits(bs, 5);
+
+      for(j = 1; j < noNoiseBands; j++, index++) 
+        frameData->sbrNoiseFloorLevel[index] = DecodeHuffmanCW(hcb_noiseF, bs);
+    }
+    else 
+    {
+      for(j = 0; j < noNoiseBands; j++, index++)
+        frameData->sbrNoiseFloorLevel[index] = DecodeHuffmanCW(hcb_noise, bs);
+    }
+  }
+}
+
+/*
+  \brief   Reads envelope data from TBitStream
+
+  \return  One on success.
+*/
+int16
+sbrGetEnvelope(SbrHeaderData *headerData, SbrFrameData *frameData, TBitStream *bs, int16 decVal)
+{
+  Huffman hcb_t, hcb_f;
+  uint8 no_band[MAX_ENVELOPES];
+  int16 i, j, k, delta, offset, ampRes;
+  int16 start_bits, start_bits_balance;
+
+  ampRes = headerData->ampResolution;
+  if(frameData->frameInfo.frameClass == FIXFIX && frameData->frameInfo.nEnvelopes == 1)
+    ampRes = SBR_AMP_RES_1_5;
+
+  if(ampRes == SBR_AMP_RES_3_0)
+  {
+    start_bits = 6;
+    start_bits_balance = 5;
+  }
+  else
+  {
+    start_bits = 7;
+    start_bits_balance = 6;
+  }
+
+  k = SBR_BIT_ARRAY_SIZE - frameData->frameInfo.nEnvelopes;
+  for(i = 0; i < frameData->frameInfo.nEnvelopes; i++, k++) 
+  {
+    uint8 resValue = (frameData->frameInfo.freqRes & bitArray[k]) ? 1 : 0;
+
+    no_band[i] = headerData->hFreqBandData->nSfb[resValue];
+  }
+
+  if(frameData->coupling == COUPLING_BAL) 
+  {
+    if(ampRes == SBR_AMP_RES_1_5) 
+    {
+      hcb_t = (Huffman) &sbr_huffBook_EnvBalance10T;
+      hcb_f = (Huffman) &sbr_huffBook_EnvBalance10F;
+    }
+    else 
+    {
+      hcb_t = (Huffman) &sbr_huffBook_EnvBalance11T;
+      hcb_f = (Huffman) &sbr_huffBook_EnvBalance11F;
+    }
+  }
+  else 
+  {
+    if(ampRes == SBR_AMP_RES_1_5) 
+    {
+      hcb_t = (Huffman) &sbr_huffBook_EnvLevel10T;
+      hcb_f = (Huffman) &sbr_huffBook_EnvLevel10F;
+    }
+    else 
+    {
+      hcb_t = (Huffman) &sbr_huffBook_EnvLevel11T;
+      hcb_f = (Huffman) &sbr_huffBook_EnvLevel11F;
+    }
+  }
+
+  decVal = (ampRes) ? decVal : decVal << 1;
+
+  k = SBR_BIT_ARRAY_SIZE - frameData->frameInfo.nEnvelopes;
+  for(j = 0, offset = 0; j < frameData->frameInfo.nEnvelopes; j++, k++) 
+  {
+    uint8 codValue = frameData->domain_vec & bitArray[k];
+
+    if(!codValue) 
+    {
+      if(frameData->coupling == COUPLING_BAL)
+        frameData->iEnvelope[offset] = (int16) BsGetBits(bs, start_bits_balance);
+      else 
+      {
+        frameData->iEnvelope[offset] = (int16) BsGetBits(bs, start_bits);
+        
+        frameData->iEnvelope[offset] -= decVal;
+        if(frameData->iEnvelope[offset] < 0)
+          frameData->iEnvelope[offset] = 0;          
+      }
+    }
+
+    for(i = (1 - ((codValue) ? 1 : 0)); i < no_band[j]; i++) 
+    {
+      if(!codValue) 
+        delta = DecodeHuffmanCW(hcb_f, bs);
+      else 
+      {
+        delta = DecodeHuffmanCW(hcb_t, bs);
+
+        if(i == 0)
+          delta -= decVal;
+      }
+
+      frameData->iEnvelope[offset + i] = delta;
+    }
+
+    offset += no_band[j];
+  }
+
+  return (1);
+}
+
+/*
+  \brief   Extracts the frame information from the TBitStream
+
+  \return  One on success
+*/
+int16
+sbrReadGridInfo(TBitStream *bs, SbrHeaderData *headerData, SbrFrameData *frameData)
+{
+  uint8 tmp;
+  FRAME_INFO *frameInfo;
+  SbrGridInfo *sbrGridInfo;
+  int16 pointer_bits, nEnv, k, staticFreqRes;
+
+  nEnv = 0;
+  frameInfo = &frameData->frameInfo;
+  sbrGridInfo = &frameData->sbrGridInfo;
+
+  frameInfo->frameClass = (uint8) BsGetBits(bs, 2);
+
+  switch(frameInfo->frameClass) 
+  {
+    case FIXFIX:
+      sbrGridInfo->bs_num_env = (uint8) BsGetBits(bs, 2);
+      staticFreqRes = (int16) BsGetBits(bs, 1);
+      nEnv = (int16) (1 << sbrGridInfo->bs_num_env);
+
+      if(sbrGridInfo->bs_num_env < 3 && headerData->numberTimeSlots == 16)
+        COPY_MEMORY(frameInfo, &(sbr_staticFrameInfo[sbrGridInfo->bs_num_env]), sizeof(FRAME_INFO));
+
+      if(!staticFreqRes)
+        frameInfo->freqRes = 0;
+      break;
+      
+    case FIXVAR:
+    case VARFIX:
+      sbrGridInfo->bs_var_board[0] = (uint8) BsGetBits(bs, 2);
+      sbrGridInfo->bs_num_env = (uint8) BsGetBits(bs, 2);
+      nEnv = sbrGridInfo->bs_num_env + 1;
+
+      for(k = 0; k < sbrGridInfo->bs_num_env; k++) 
+        sbrGridInfo->bs_rel_board_0[k] = (uint8) BsGetBits(bs, 2);
+
+      pointer_bits = (int16) (FloatFR_logDualis(sbrGridInfo->bs_num_env + 2) + 0.992188f);
+      sbrGridInfo->bs_pointer = (uint8) BsGetBits(bs, pointer_bits);
+      break;
+  }
+
+  switch(frameInfo->frameClass) 
+  {
+    case FIXVAR:
+      frameInfo->freqRes = 0;
+      tmp = (uint8) BsGetBits(bs, sbrGridInfo->bs_num_env + 1);
+      for(k = sbrGridInfo->bs_num_env; k >= 0; k--)
+      {
+        frameInfo->freqRes <<= 1;
+        frameInfo->freqRes  |= tmp & 0x1;
+        tmp >>= 1;
+      }
+      break;
+
+    case VARFIX:
+      frameInfo->freqRes = (uint8) BsGetBits(bs, sbrGridInfo->bs_num_env + 1);
+      break;
+
+    case VARVAR:
+      sbrGridInfo->bs_var_board[0] = (uint8) BsGetBits(bs, 2);
+      sbrGridInfo->bs_var_board[1] = (uint8) BsGetBits(bs, 2);
+      sbrGridInfo->bs_num_rel[0] = (uint8) BsGetBits(bs, 2);
+      sbrGridInfo->bs_num_rel[1] = (uint8) BsGetBits(bs, 2);
+      
+      nEnv = sbrGridInfo->bs_num_rel[0] + sbrGridInfo->bs_num_rel[1] + 1;
+
+      for(k = 0; k < sbrGridInfo->bs_num_rel[0]; k++)
+        sbrGridInfo->bs_rel_board_0[k] = (uint8) BsGetBits(bs, 2);
+
+      for(k = 0; k < sbrGridInfo->bs_num_rel[1]; k++) 
+        sbrGridInfo->bs_rel_board_1[k] = (uint8) BsGetBits(bs, 2);
+
+      pointer_bits = (int16) (FloatFR_logDualis(nEnv + 1) + 0.992188f);
+      sbrGridInfo->bs_pointer = (int16) BsGetBits(bs, pointer_bits);
+
+      frameInfo->freqRes = (uint8) BsGetBits(bs, nEnv);
+      break;
+  }
+
+  frameInfo->nEnvelopes = (uint8) nEnv;
+  frameInfo->nNoiseEnvelopes = (nEnv == 1) ? 1 : 2;
+
+  return (1);
+}
+
+/*
+  \brief     Initializes SBR header data
+*/
+void
+initHeaderData(SbrHeaderData *headerData, FreqBandData *freqBandData,
+               int32 sampleRate, int16 samplesPerFrame)
+{
+  FreqBandData *hFreq = freqBandData;
+
+  COPY_MEMORY(headerData, &sbr_defaultHeader, sizeof(SbrHeaderData));
+
+  headerData->hFreqBandData = hFreq;
+  headerData->codecFrameSize = samplesPerFrame;
+  headerData->outSampleRate = SBR_UPSAMPLE_FAC * sampleRate;
+  headerData->numberTimeSlots = samplesPerFrame >> (4 + headerData->timeStep);
+}
+
+/*
+  \brief   Reads header data from TBitStream
+
+  \return  Processing status - HEADER_RESET or HEADER_OK
+*/
+SBR_HEADER_STATUS
+sbrGetHeaderData(SbrHeaderData *h_sbr_header, TBitStream *bs)
+{
+  SbrHeaderData lastHeader;
+  uint8 headerExtra1, headerExtra2;
+
+  COPY_MEMORY(&lastHeader, h_sbr_header, sizeof(SbrHeaderData));
+
+  h_sbr_header->ampResolution = (uint8) BsGetBits(bs, 1);
+  h_sbr_header->startFreq = (uint8) BsGetBits(bs, 4);
+  h_sbr_header->stopFreq = (uint8) BsGetBits(bs, 4);
+  h_sbr_header->xover_band = (uint8) BsGetBits(bs, 3);
+
+  BsGetBits(bs, 2);
+
+  headerExtra1 = (uint8) BsGetBits(bs, 1);
+  headerExtra2 = (uint8) BsGetBits(bs, 1);
+
+  if(headerExtra1) 
+  {
+    h_sbr_header->freqScale = (uint8) BsGetBits(bs, 2);
+    h_sbr_header->alterScale = (uint8) BsGetBits(bs, 1);
+    h_sbr_header->noise_bands = (uint8) BsGetBits(bs, 2);
+  }
+  else 
+  {
+    h_sbr_header->freqScale   = SBR_FREQ_SCALE_DEF;
+    h_sbr_header->alterScale  = SBR_ALTER_SCALE_DEF;
+    h_sbr_header->noise_bands = SBR_NOISE_BANDS_DEF;
+  }
+
+  if(headerExtra2) 
+  {
+    h_sbr_header->limiterBands = (uint8) BsGetBits(bs, 2);
+    h_sbr_header->limiterGains = (uint8) BsGetBits(bs, 2);
+    h_sbr_header->interpolFreq = (uint8) BsGetBits(bs, 1);
+    h_sbr_header->smoothingLength = (uint8) BsGetBits(bs, 1);
+  }
+  else 
+  {
+    h_sbr_header->limiterBands    = SBR_LIMITER_BANDS_DEF;
+    h_sbr_header->limiterGains    = SBR_LIMITER_GAINS_DEF;
+    h_sbr_header->interpolFreq    = SBR_INTERPOL_FREQ_DEF;
+    h_sbr_header->smoothingLength = SBR_SMOOTHING_LENGTH_DEF;
+  }
+
+  if(h_sbr_header->syncState != SBR_ACTIVE                ||
+     lastHeader.startFreq    != h_sbr_header->startFreq   ||
+     lastHeader.stopFreq     != h_sbr_header->stopFreq    ||
+     lastHeader.xover_band   != h_sbr_header->xover_band  ||
+     lastHeader.freqScale    != h_sbr_header->freqScale   ||
+     lastHeader.alterScale   != h_sbr_header->alterScale  ||
+     lastHeader.noise_bands  != h_sbr_header->noise_bands) 
+    return (HEADER_RESET); /*-- New settings --*/
+
+  return (HEADER_OK);
+}
+
+/*
+  \brief   Reads additional harmonics parameters
+
+  \return  Number of bits read
+*/
+static int16
+sbrGetSineData(SbrHeaderData *headerData, SbrFrameData *frameData, TBitStream *bs)
+{
+  int16 bitsRead;
+
+  bitsRead = 1;
+  frameData->isSinesPresent = (uint8) BsGetBits(bs, 1);
+
+  if(frameData->isSinesPresent)
+  {
+    int16 rSfb;
+
+    bitsRead += headerData->hFreqBandData->nSfb[1];
+
+    rSfb = (headerData->hFreqBandData->nSfb[1] > 32) ? 32 : headerData->hFreqBandData->nSfb[1];
+
+    frameData->addHarmonics[0] = (uint8) BsGetBits(bs, rSfb);
+
+    if(headerData->hFreqBandData->nSfb[1] > 32)
+    {
+      rSfb = headerData->hFreqBandData->nSfb[1] - 32;
+      frameData->addHarmonics[1] = (uint8) BsGetBits(bs, rSfb);
+    }
+  }
+
+  return (bitsRead);
+}
+
+/*
+  \brief      Reads extension data from the TBitStream
+*/
+static void 
+sbrReadExtensionData(TBitStream *bs, SbrExtensionData *sbrExtData, uint8 isMono)
+{
+  sbrExtData->writePsData = 0;
+  sbrExtData->extensionDataPresent = (uint8) BsGetBits(bs, 1);
+
+  if(sbrExtData->extensionDataPresent) 
+  {
+    int16 i, nBitsLeft, cnt;
+
+    cnt = (int16) BsGetBits(bs, 4);
+    if(cnt == 15)
+      cnt += (int16) BsGetBits(bs, 8);
+
+    sbrExtData->byteCount = MIN(cnt, sbrExtData->extDataBufLen);
+
+    nBitsLeft = cnt << 3;
+
+    while(nBitsLeft > 7) 
+    {
+      sbrExtData->extension_id = (uint8) BsGetBits(bs, 2);
+
+      if(!(sbrExtData->extension_id == SBR_PARAMETRIC_STEREO_ID && isMono))
+        sbrExtData->extension_id = 0;
+      else
+        sbrExtData->writePsData = 1;
+
+      nBitsLeft -= 2;
+
+      cnt = (int16) ((uint16) nBitsLeft >> 3);
+
+      if(sbrExtData->extDataBufLen)
+      {
+        for(i = 0; i < MIN(cnt, sbrExtData->extDataBufLen); i++)
+          sbrExtData->extensioData[i] = (uint8) BsGetBits(bs, 8);
+
+        for( ; i < cnt; i++)
+          BsGetBits(bs, 8);
+      }
+      else
+        for(i = 0; i < cnt; i++)
+          BsGetBits(bs, 8);
+
+      nBitsLeft -= cnt << 3;
+    }
+
+    BsGetBits(bs, nBitsLeft);
+  }
+}
+
+/*
+  \brief   Reads TBitStream elements of one channel
+
+  \return  One on success
+*/
+int16
+sbrGetSCE(SbrHeaderData *headerData, SbrFrameData *frameData,
+          SbrExtensionData *sbrExtData, TBitStream *bs, 
+          int16 decVal, uint8 isMono)
+{
+  frameData->coupling = COUPLING_OFF;
+
+  /*-- Data present. --*/
+  frameData->dataPresent = (int16) BsGetBits(bs, 1);
+  if(frameData->dataPresent) BsGetBits(bs, 4);
+
+  /*-- Read grid info. --*/
+  sbrReadGridInfo(bs, headerData, frameData);
+
+  /*-- Read direction info for envelope decoding. --*/
+  sbrGetDTDFData(frameData, bs);
+
+  /*-- Read inverse filtering modes. --*/
+  frameData->sbr_invf_mode = (uint8) BsGetBits(bs, headerData->hFreqBandData->nInvfBands << 1);
+
+  /*-- Read Huffman coded envelope values. --*/
+  sbrGetEnvelope(headerData, frameData, bs, decVal);
+
+  /*-- Read noise data. --*/
+  sbrGetNoiseFloorData(headerData, frameData, bs);
+
+  /*-- Read sine data, if any. --*/
+  sbrGetSineData(headerData, frameData, bs);
+
+  /*-- Read extension data, if any. --*/
+  sbrReadExtensionData(bs, sbrExtData, isMono);
+
+  return (1);
+}
+
+/*
+  \brief      Reads TBitStream elements of a channel pair
+
+  \return     One on success
+*/
+int16
+sbrGetCPE(SbrHeaderData *headerData, SbrFrameData *frameDataLeft,
+          SbrFrameData *frameDataRight, SbrExtensionData *sbrExtData,
+          TBitStream *bs, int16 decVal)
+{
+  /*-- Data present. -*/
+  frameDataLeft->dataPresent = (uint8) BsGetBits(bs, 1);
+  if(frameDataLeft->dataPresent)
+    BsGetBits(bs, 8);
+
+  /*-- Coupling mode. --*/
+  if(BsGetBits(bs, 1)) 
+  {
+    frameDataLeft->coupling = COUPLING_LEVEL;
+    frameDataRight->coupling = COUPLING_BAL;
+  }
+  else 
+  {
+    frameDataLeft->coupling = COUPLING_OFF;
+    frameDataRight->coupling = COUPLING_OFF;
+  }
+
+  /*-- Read grid info (left channel). --*/
+  sbrReadGridInfo(bs, headerData, frameDataLeft);
+
+  /*-- Read grid info (right channel). --*/
+  if(frameDataLeft->coupling) 
+    COPY_MEMORY(&frameDataRight->frameInfo, &frameDataLeft->frameInfo, sizeof(FRAME_INFO));
+  else 
+    sbrReadGridInfo(bs, headerData, frameDataRight);
+
+  /*-- Read direction info for envelope decoding. --*/
+  sbrGetDTDFData(frameDataLeft, bs);
+  sbrGetDTDFData(frameDataRight, bs);
+
+  /*-- Read inverse filtering modes for left channel. --*/
+  frameDataLeft->sbr_invf_mode = (uint8) BsGetBits(bs, headerData->hFreqBandData->nInvfBands << 1);
+
+  if(frameDataLeft->coupling) 
+  {
+    frameDataRight->sbr_invf_mode = frameDataLeft->sbr_invf_mode;
+
+    /*-- Read Huffman coded envelope + noise values for left channel. --*/
+    sbrGetEnvelope(headerData, frameDataLeft, bs, decVal);
+    sbrGetNoiseFloorData(headerData, frameDataLeft, bs);
+
+    /*-- Read Huffman coded envelope for right channel. --*/
+    sbrGetEnvelope(headerData, frameDataRight, bs, decVal);
+  }
+  else 
+  {
+    /*-- Read inverse filtering modes for right channel. --*/
+    frameDataRight->sbr_invf_mode = (uint8) BsGetBits(bs, headerData->hFreqBandData->nInvfBands << 1);
+ 
+    /*-- Read Huffman coded envelope values. --*/
+    sbrGetEnvelope(headerData, frameDataLeft, bs, decVal);
+    sbrGetEnvelope(headerData, frameDataRight, bs, decVal);
+
+    /*-- Read noise data for left channel. --*/
+    sbrGetNoiseFloorData(headerData, frameDataLeft, bs);
+  }
+
+  /*-- Read noise data for right channel. --*/
+  sbrGetNoiseFloorData(headerData, frameDataRight, bs);
+
+  /*-- Read additional sines, if any. --*/
+  sbrGetSineData(headerData, frameDataLeft, bs);
+  sbrGetSineData(headerData, frameDataRight, bs);
+
+  /*-- Read extension data, if any. --*/
+  sbrReadExtensionData(bs, sbrExtData, 0);
+
+  return (1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/sbr_freq_sca.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,443 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/*
+  \file
+  \brief  Frequency scale calculation $Revision: 1.2.4.1 $
+*/
+
+/**************************************************************************
+  sbr_freq_sca.cpp - SBR frequency scale calculations.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2004 by Nokia Research Center, Multimedia Technologies.
+  *************************************************************************/
+
+/*-- System Headers. --*/
+#include <e32math.h>
+
+/*-- Project Headers. --*/
+#include "sbr_rom.h"
+
+const int16 MAX_OCTAVE = 29;
+const int16 MAX_SECOND_REGION = 50;
+const FLOAT WARP_FACTOR = 25200.0f / 32768.0f;
+
+/*!
+  \brief   Sorting routine
+*/
+void 
+shellsort(uint8 *in, uint8 n)
+{
+  int16 i, j, v, w, inc = 1;
+
+  do
+  {
+    inc = 3 * inc + 1;
+
+  } while (inc <= n);
+
+  do 
+  {
+    inc = inc / 3;
+
+    for(i = inc; i < n; i++) 
+    {
+      v = in[i];
+      j = i;
+
+      while((w = in[j - inc]) > v) 
+      {
+        in[j] = w;
+        j -= inc;
+        if(j < inc)
+          break;
+      }
+      in[j] = v;
+    }
+
+  } while(inc > 1);
+}
+
+/*!
+  \brief     Calculate number of SBR bands between start and stop band
+
+  \return    number of bands
+*/
+static int16
+numberOfBands(FLOAT bpo, int16 start, int16 stop, int16 warpFlag)
+{
+  int16 num_bands;
+  FLOAT num_bands_div2;
+
+  num_bands_div2 = 0.5f * FloatFR_getNumOctaves(start, stop) * bpo;
+  if(warpFlag) num_bands_div2 *= WARP_FACTOR;
+
+  num_bands_div2 += 0.5f;
+  num_bands = (int16) num_bands_div2;
+  num_bands <<= 1;
+
+  return (num_bands);
+}
+
+/*!
+  \brief     Calculate width of SBR bands
+
+*/
+static void
+CalcBands(uint8 *diff, uint8 start, uint8 stop, uint8 num_bands)
+{
+  FLOAT exact, bandfactor;
+  int16 i, previous, current;
+ 
+  previous = start;
+  exact = (FLOAT) start;
+
+  Math::Pow(bandfactor, stop * sbr_invIntTable[start], sbr_invIntTable[num_bands]);
+
+  for(i = 1; i <= num_bands; i++)  
+  {
+    exact *= bandfactor;
+    current = (int16) (exact + 0.5f);
+    diff[i - 1] = current - previous;
+    previous = current;
+  }
+}
+
+/*!
+  \brief     Calculate cumulated sum vector from delta vector
+*/
+static void
+cumSum(uint8 start_value, uint8* diff, uint8 length, uint8 *start_adress)
+{
+  int16 i;
+
+  start_adress[0] = start_value;
+  for(i = 1; i <= length; i++)
+    start_adress[i] = start_adress[i - 1] + diff[i - 1];
+}
+
+/*!
+  \brief     Adapt width of frequency bands in the second region
+*/
+static int16
+modifyBands(uint8 max_band_previous, uint8 * diff, uint8 length)
+{
+  int16 change = max_band_previous - diff[0];
+
+  if(change > (diff[length - 1] - diff[0]) / 2)
+    change = (diff[length - 1] - diff[0]) / 2;
+
+  diff[0] += change;
+  diff[length - 1] -= change;
+  shellsort(diff, length);
+
+  return (0);
+}
+
+/*!
+  \brief     Retrieve QMF-band where the SBR range starts
+
+  \return  Number of start band
+*/
+static int16
+getStartBand(int32 fs, uint8 startFreq)
+{
+  int16 band;
+
+  switch(fs) 
+  {
+    case 96000:
+    case 88200:
+      band = sbr_start_freq_88[startFreq];
+      break;
+
+    case 64000:
+      band = sbr_start_freq_64[startFreq];
+      break;
+
+    case 48000:
+      band = sbr_start_freq_48[startFreq];
+      break;
+
+    case 44100:
+      band = sbr_start_freq_44[startFreq];
+      break;
+
+    case 32000:
+      band = sbr_start_freq_32[startFreq];
+      break;
+
+    case 24000:
+      band = sbr_start_freq_24[startFreq];
+      break;
+
+    case 22050:
+      band = sbr_start_freq_22[startFreq];
+      break;
+
+    case 16000:
+      band = sbr_start_freq_16[startFreq];
+      break;
+
+    default:
+      band = -1;
+      break;
+   }
+
+  return (band);
+}
+
+/*!
+  \brief   Generates master frequency tables
+
+  \return  errorCode, 0 if successful
+*/
+int16
+sbrdecUpdateFreqScale(uint8 * v_k_master, uint8 *numMaster, SbrHeaderData *hHeaderData)
+{
+  int32 fs;
+  FLOAT bpo;
+  int16 err, dk, k2_achived, k2_diff, incr;
+  uint8 k0, k2, k1, i, num_bands0, num_bands1;
+  uint8 diff_tot[MAX_OCTAVE + MAX_SECOND_REGION], *diff0, *diff1;
+
+  diff0 = diff_tot;
+  diff1 = diff_tot + MAX_OCTAVE;
+
+  incr = k1 = dk = err = 0;
+  fs = hHeaderData->outSampleRate;
+
+  k0 = getStartBand(fs, hHeaderData->startFreq);
+
+  if(hHeaderData->stopFreq < 14) 
+  {
+    switch(fs) 
+    {
+      case 48000:
+        k1 = 21;
+        break;
+      
+      case 44100:
+        k1 = 23;
+        break;
+      
+      case 32000:
+      case 24000:
+        k1 = 32;
+        break;
+      
+      case 22050:
+        k1 = 35;
+        break;
+      
+      case 16000:
+        k1 = 48;
+        break;
+      
+      default:
+        return (1);
+    }
+
+    CalcBands(diff0, k1, 64, 13);
+    shellsort(diff0, 13);
+    cumSum(k1, diff0, 13, diff1);
+    k2 = diff1[hHeaderData->stopFreq];
+  }
+  else 
+  {
+    if(hHeaderData->stopFreq == 14) 
+      k2 = 2 * k0;
+    else
+      k2 = 3 * k0;
+  }
+
+  if(k2 > NO_SYNTHESIS_CHANNELS)
+    k2 = NO_SYNTHESIS_CHANNELS;
+
+  if(((k2 - k0) > MAX_FREQ_COEFFS) || (k2 <= k0) ) 
+    return (2);
+
+  if(fs == 44100 && ((k2 - k0) > MAX_FREQ_COEFFS_FS44100)) 
+    return (3);
+
+  if(fs >= 48000 && ((k2 - k0) > MAX_FREQ_COEFFS_FS48000)) 
+    return (4);
+
+  if(hHeaderData->freqScale>0) 
+  {
+    if(hHeaderData->freqScale == 1)
+      bpo = 12.0f;
+    else 
+    {
+      if(hHeaderData->freqScale == 2)
+        bpo = 10.0f;
+      else
+        bpo =  8.0f;
+    }
+
+    if(1000 * k2 > 2245 * k0) 
+    {
+      k1 = 2 * k0;
+      num_bands0 = numberOfBands(bpo, k0, k1, 0);
+      num_bands1 = numberOfBands(bpo, k1, k2, hHeaderData->alterScale);
+
+      if(num_bands0 < 1)
+        return (5);
+
+      if(num_bands1 < 1)
+        return (6);
+
+      CalcBands(diff0, k0, k1, num_bands0);
+      shellsort(diff0, num_bands0);
+
+      if(diff0[0] == 0) 
+        return (7);
+
+      cumSum(k0, diff0, num_bands0, v_k_master);
+      CalcBands(diff1, k1, k2, num_bands1);
+      shellsort(diff1, num_bands1);
+
+      if(diff0[num_bands0-1] > diff1[0]) 
+      {
+        err = modifyBands(diff0[num_bands0 - 1], diff1, num_bands1);
+        if(err) return (8);
+      }
+
+      cumSum(k1, diff1, num_bands1, &v_k_master[num_bands0]);
+      *numMaster = num_bands0 + num_bands1;
+    }
+    else 
+    {
+      k1 = k2;
+
+      num_bands0 = numberOfBands(bpo, k0, k1, 0);
+      if(num_bands0 < 1) 
+        return (9);
+
+      CalcBands(diff0, k0, k1, num_bands0);
+      shellsort(diff0, num_bands0);
+      if(diff0[0] == 0)
+        return (10);
+
+      cumSum(k0, diff0, num_bands0, v_k_master);
+      *numMaster = num_bands0;
+    }
+  }
+  else 
+  {
+    if(hHeaderData->alterScale == 0) 
+    {
+      dk = 1;
+      num_bands0 = (k2 - k0) & 254;
+    } 
+    else 
+    {
+      dk = 2;
+      num_bands0 = (((k2 - k0) >> 1) + 1) & 254;
+    }
+    
+    if(num_bands0 < 1) 
+      return (11);
+
+    k2_achived = k0 + num_bands0 * dk;
+    k2_diff = k2 - k2_achived;
+    
+    for(i = 0;i < num_bands0; i++)
+      diff_tot[i] = dk;
+    
+    if(k2_diff < 0) 
+    {
+      incr = 1;
+      i = 0;
+    }
+
+    if(k2_diff > 0) 
+    {
+      incr = -1;
+      i = num_bands0 - 1;
+    }
+    
+    while(k2_diff != 0) 
+    {
+      diff_tot[i] = diff_tot[i] - incr;
+      i = i + incr;
+      k2_diff = k2_diff + incr;
+    }
+    
+    cumSum(k0, diff_tot, num_bands0, v_k_master);
+
+    *numMaster = num_bands0;
+  }
+
+  if(*numMaster < 1) 
+    return (12);
+
+  return (0);
+}
+
+/*!
+  \brief   Reset frequency band tables
+
+  \return  error code, 0 on success
+*/
+int16
+resetFreqBandTables(SbrHeaderData *hHeaderData)
+{
+  uint8 nBandsHi;
+  int16 err, k2, kx, intTemp;
+  FreqBandData *hFreq = hHeaderData->hFreqBandData;
+
+  err = sbrdecUpdateFreqScale(hFreq->v_k_master, &hFreq->numMaster, hHeaderData);
+  if(err) return (err);
+
+  if(hHeaderData->xover_band > hFreq->numMaster)
+    return (13);
+
+  nBandsHi = hFreq->numMaster - hHeaderData->xover_band;
+
+  hFreq->nSfb[0] = ((nBandsHi & 1) == 0) ? nBandsHi >> 1 : (nBandsHi + 1) >> 1;
+  hFreq->nSfb[1] = nBandsHi;
+
+  k2 = hFreq->v_k_master[nBandsHi - hHeaderData->xover_band];
+  kx = hFreq->v_k_master[hHeaderData->xover_band];
+
+  if(hHeaderData->noise_bands == 0)
+    hFreq->nNfb = 1;
+  else
+  {
+    FLOAT temp;
+
+    temp = FloatFR_getNumOctaves(kx,k2);
+    temp = temp * (FLOAT) hHeaderData->noise_bands;
+    intTemp = (int16) (temp + 0.5f);
+
+    if(intTemp == 0)
+      intTemp = 1;
+
+    hFreq->nNfb = intTemp;
+  }
+
+  hFreq->nInvfBands = hFreq->nNfb;
+
+  if(hFreq->nNfb > MAX_NOISE_COEFFS)
+    return (14);
+
+  return (0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/sbr_rom.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,621 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/*
+  \file
+  \brief SBR ROM tables (constant data) $Revision: 1.1.1.1.4.3 $
+*/
+
+/**************************************************************************
+  sbr_rom.cpp - SBR ROM tables (constant data).
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2004 by Nokia Research Center, Multimedia Technologies.
+  *************************************************************************/
+
+/*-- System Headers. --*/
+#include "sbr_rom.h"
+
+const uint32 bitArray[SBR_BIT_ARRAY_SIZE] = {128, 64, 32, 16, 8, 4, 2, 1};
+
+const uint8 sbr_start_freq_16[16] = {16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
+const uint8 sbr_start_freq_22[16] = {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 30};
+const uint8 sbr_start_freq_24[16] = {11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 27, 29, 32};
+const uint8 sbr_start_freq_32[16] = {10, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 27, 29, 32};
+const uint8 sbr_start_freq_44[16] = { 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 23, 25, 28, 32};
+const uint8 sbr_start_freq_48[16] = { 7,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 27, 31};
+const uint8 sbr_start_freq_64[16] = { 6,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 23, 26, 30};
+const uint8 sbr_start_freq_88[16] = { 5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 16, 18, 20, 23, 27, 31};
+
+
+/* Lookup-table for inverse of integers */
+const FLOAT sbr_invIntTable[INV_INT_TABLE_SIZE] = {
+  0.0f,
+  1.0f,
+  1.0f / 2.0f,
+  1.0f / 3.0f,
+  1.0f / 4.0f,
+  1.0f / 5.0f,
+  1.0f / 6.0f,
+  1.0f / 7.0f,
+  1.0f / 8.0f,
+  1.0f / 9.0f,
+  1.0f / 10.0f,
+  1.0f / 11.0f,
+  1.0f / 12.0f,
+  1.0f / 13.0f,
+  1.0f / 14.0f,
+  1.0f / 15.0f,
+  1.0f / 16.0f,
+  1.0f / 17.0f,
+  1.0f / 18.0f,
+  1.0f / 19.0f,
+  1.0f / 20.0f,
+  1.0f / 21.0f,
+  1.0f / 22.0f,
+  1.0f / 23.0f,
+  1.0f / 24.0f,
+  1.0f / 25.0f,
+  1.0f / 26.0f,
+  1.0f / 27.0f,
+  1.0f / 28.0f,
+  1.0f / 29.0f,
+  1.0f / 30.0f,
+  1.0f / 31.0f,
+  1.0f / 32.0f,
+  1.0f / 33.0f,
+  1.0f / 34.0f,
+  1.0f / 35.0f,
+  1.0f / 36.0f,
+  1.0f / 37.0f,
+  1.0f / 38.0f,
+  1.0f / 39.0f,
+  1.0f / 40.0f,
+  1.0f / 41.0f,
+  1.0f / 42.0f,
+  1.0f / 43.0f,
+  1.0f / 44.0f,
+  1.0f / 45.0f,
+  1.0f / 46.0f,
+  1.0f / 47.0f,
+  1.0f / 48.0f,
+  1.0f / 49.0f,
+  1.0f / 50.0f,
+  1.0f / 51.0f,
+  1.0f / 52.0f,
+  1.0f / 53.0f,
+  1.0f / 54.0f
+};
+
+const FLOAT logDualisTable[LOG_DUALIS_TABLE_SIZE] = {
+ -1.0f,               0.000000000000000f, 1.000000000000000f,
+  1.584962500721156f, 2.000000000000000f, 2.321928094887363f,
+  2.584962500721156f, 2.807354922057604f, 3.000000000000000f,
+  3.169925001442313f, 3.321928094887363f, 3.459431618637297f,
+  3.584962500721157f, 3.700439718141092f, 3.807354922057604f,
+  3.906890595608519f, 4.000000000000000f, 4.087462841250340f,
+  4.169925001442312f, 4.247927513443585f, 4.321928094887363f,
+  4.392317422778761f, 4.459431618637297f, 4.523561956057013f,
+  4.584962500721156f, 4.643856189774725f, 4.700439718141093f,
+  4.754887502163469f, 4.807354922057605f, 4.857980995127572f,
+  4.906890595608519f, 4.954196310386876f, 5.000000000000000f,
+  5.044394119358453f, 5.087462841250340f, 5.129283016944966f,
+  5.169925001442312f, 5.209453365628950f, 5.247927513443586f,
+  5.285402218862249f, 5.321928094887363f, 5.357552004618084f,
+  5.392317422778761f, 5.426264754702098f, 5.459431618637297f,
+  5.491853096329675f, 5.523561956057013f, 5.554588851677638f,
+  5.584962500721156f, 5.614709844115208f, 5.643856189774725f,
+  5.672425341971496f, 5.700439718141093f, 5.727920454563200f,
+  5.754887502163469f, 5.781359713524660f, 5.807354922057605f,
+  5.832890014164742f, 5.857980995127573f, 5.882643049361842f,
+  5.906890595608519f, 5.930737337562887f, 5.954196310386876f,
+  5.977279923499917f, 6.000000000000000f,
+};
+
+
+/*
+  \name FrameInfoDefaults
+
+  Predefined envelope positions for the FIX-FIX case (static framing)
+*/
+//@{
+//const FRAME_INFO sbr_frame_info1_16 = {0, 1, 1, 1};
+//const FRAME_INFO sbr_frame_info2_16 = {0, 2, 3, 2};
+//const FRAME_INFO sbr_frame_info4_16 = {0, 4, 15, 2};
+//const FRAME_INFO *sbr_staticFrameInfo[3] = 
+//{&sbr_frame_info1_16, &sbr_frame_info2_16, &sbr_frame_info4_16};
+const FRAME_INFO sbr_staticFrameInfo[3] = 
+{
+    {0, 1, 1, 1},
+    {0, 2, 3, 2},
+    {0, 4, 15, 2}
+};
+
+
+//@}
+
+/*
+  Default values for the time before the first SBR header is read
+*/
+const SbrHeaderData sbr_defaultHeader =
+{
+  SBR_NOT_INITIALIZED,
+  16,
+  2,
+  1024,
+  44100,
+  SBR_AMP_RES_3_0,
+  5,
+  0,
+  0,
+  SBR_FREQ_SCALE_DEF,
+  SBR_ALTER_SCALE_DEF,
+  SBR_NOISE_BANDS_DEF,
+  SBR_LIMITER_BANDS_DEF,
+  SBR_LIMITER_GAINS_DEF,
+  SBR_INTERPOL_FREQ_DEF,
+  SBR_SMOOTHING_LENGTH_DEF,
+
+  NULL
+};
+
+
+/*
+  \name SBR_HuffmanTables
+
+  SBR Huffman Table Overview:        \n
+                                     \n
+ o envelope level,   1.5 dB:         \n
+    1)  sbr_huffBook_EnvLevel10T[120][2]   \n
+    2)  sbr_huffBook_EnvLevel10F[120][2]   \n
+                                     \n
+ o envelope balance, 1.5 dB:         \n
+    3)  sbr_huffBook_EnvBalance10T[48][2]  \n
+    4)  sbr_huffBook_EnvBalance10F[48][2]  \n
+                                     \n
+ o envelope level,   3.0 dB:         \n
+    5)  sbr_huffBook_EnvLevel11T[62][2]    \n
+    6)  sbr_huffBook_EnvLevel11F[62][2]    \n
+                                     \n
+ o envelope balance, 3.0 dB:         \n
+    7)  sbr_huffBook_EnvBalance11T[24][2]  \n
+    8)  sbr_huffBook_EnvBalance11F[24][2]  \n
+                                     \n
+ o noise level,      3.0 dB:         \n
+    9)  sbr_huffBook_NoiseLevel11T[62][2]  \n
+    -) (sbr_huffBook_EnvLevel11F[62][2] is used for freq dir)\n
+                                     \n
+ o noise balance,    3.0 dB:         \n
+   10)  sbr_huffBook_NoiseBalance11T[24][2]\n
+    -) (sbr_huffBook_EnvBalance11F[24][2] is used for freq dir)\n
+                                     \n
+  (1.5 dB is never used for noise)
+
+*/
+//@{
+const int8 sbr_huffBook_EnvLevel10T[120][2] = {
+  {   1,   2 },    { -64, -65 },    {   3,   4 },    { -63, -66 },
+  {   5,   6 },    { -62, -67 },    {   7,   8 },    { -61, -68 },
+  {   9,  10 },    { -60, -69 },    {  11,  12 },    { -59, -70 },
+  {  13,  14 },    { -58, -71 },    {  15,  16 },    { -57, -72 },
+  {  17,  18 },    { -73, -56 },    {  19,  21 },    { -74,  20 },
+  { -55, -75 },    {  22,  26 },    {  23,  24 },    { -54, -76 },
+  { -77,  25 },    { -53, -78 },    {  27,  34 },    {  28,  29 },
+  { -52, -79 },    {  30,  31 },    { -80, -51 },    {  32,  33 },
+  { -83, -82 },    { -81, -50 },    {  35,  57 },    {  36,  40 },
+  {  37,  38 },    { -88, -84 },    { -48,  39 },    { -90, -85 },
+  {  41,  46 },    {  42,  43 },    { -49, -87 },    {  44,  45 },
+  { -89, -86 },    {-124,-123 },    {  47,  50 },    {  48,  49 },
+  {-122,-121 },    {-120,-119 },    {  51,  54 },    {  52,  53 },
+  {-118,-117 },    {-116,-115 },    {  55,  56 },    {-114,-113 },
+  {-112,-111 },    {  58,  89 },    {  59,  74 },    {  60,  67 },
+  {  61,  64 },    {  62,  63 },    {-110,-109 },    {-108,-107 },
+  {  65,  66 },    {-106,-105 },    {-104,-103 },    {  68,  71 },
+  {  69,  70 },    {-102,-101 },    {-100, -99 },    {  72,  73 },
+  { -98, -97 },    { -96, -95 },    {  75,  82 },    {  76,  79 },
+  {  77,  78 },    { -94, -93 },    { -92, -91 },    {  80,  81 },
+  { -47, -46 },    { -45, -44 },    {  83,  86 },    {  84,  85 },
+  { -43, -42 },    { -41, -40 },    {  87,  88 },    { -39, -38 },
+  { -37, -36 },    {  90, 105 },    {  91,  98 },    {  92,  95 },
+  {  93,  94 },    { -35, -34 },    { -33, -32 },    {  96,  97 },
+  { -31, -30 },    { -29, -28 },    {  99, 102 },    { 100, 101 },
+  { -27, -26 },    { -25, -24 },    { 103, 104 },    { -23, -22 },
+  { -21, -20 },    { 106, 113 },    { 107, 110 },    { 108, 109 },
+  { -19, -18 },    { -17, -16 },    { 111, 112 },    { -15, -14 },
+  { -13, -12 },    { 114, 117 },    { 115, 116 },    { -11, -10 },
+  {  -9,  -8 },    { 118, 119 },    {  -7,  -6 },    {  -5,  -4 }
+};
+
+const int8 sbr_huffBook_EnvLevel10F[120][2] = {
+  {   1,   2 },    { -64, -65 },    {   3,   4 },    { -63, -66 },
+  {   5,   6 },    { -67, -62 },    {   7,   8 },    { -68, -61 },
+  {   9,  10 },    { -69, -60 },    {  11,  13 },    { -70,  12 },
+  { -59, -71 },    {  14,  16 },    { -58,  15 },    { -72, -57 },
+  {  17,  19 },    { -73,  18 },    { -56, -74 },    {  20,  23 },
+  {  21,  22 },    { -55, -75 },    { -54, -53 },    {  24,  27 },
+  {  25,  26 },    { -76, -52 },    { -77, -51 },    {  28,  31 },
+  {  29,  30 },    { -50, -78 },    { -79, -49 },    {  32,  36 },
+  {  33,  34 },    { -48, -47 },    { -80,  35 },    { -81, -82 },
+  {  37,  47 },    {  38,  41 },    {  39,  40 },    { -83, -46 },
+  { -45, -84 },    {  42,  44 },    { -85,  43 },    { -44, -43 },
+  {  45,  46 },    { -88, -87 },    { -86, -90 },    {  48,  66 },
+  {  49,  56 },    {  50,  53 },    {  51,  52 },    { -92, -42 },
+  { -41, -39 },    {  54,  55 },    {-105, -89 },    { -38, -37 },
+  {  57,  60 },    {  58,  59 },    { -94, -91 },    { -40, -36 },
+  {  61,  63 },    { -20,  62 },    {-115,-110 },    {  64,  65 },
+  {-108,-107 },    {-101, -97 },    {  67,  89 },    {  68,  75 },
+  {  69,  72 },    {  70,  71 },    { -95, -93 },    { -34, -27 },
+  {  73,  74 },    { -22, -17 },    { -16,-124 },    {  76,  82 },
+  {  77,  79 },    {-123,  78 },    {-122,-121 },    {  80,  81 },
+  {-120,-119 },    {-118,-117 },    {  83,  86 },    {  84,  85 },
+  {-116,-114 },    {-113,-112 },    {  87,  88 },    {-111,-109 },
+  {-106,-104 },    {  90, 105 },    {  91,  98 },    {  92,  95 },
+  {  93,  94 },    {-103,-102 },    {-100, -99 },    {  96,  97 },
+  { -98, -96 },    { -35, -33 },    {  99, 102 },    { 100, 101 },
+  { -32, -31 },    { -30, -29 },    { 103, 104 },    { -28, -26 },
+  { -25, -24 },    { 106, 113 },    { 107, 110 },    { 108, 109 },
+  { -23, -21 },    { -19, -18 },    { 111, 112 },    { -15, -14 },
+  { -13, -12 },    { 114, 117 },    { 115, 116 },    { -11, -10 },
+  {  -9,  -8 },    { 118, 119 },    {  -7,  -6 },    {  -5,  -4 }
+};
+
+const int8 sbr_huffBook_EnvBalance10T[48][2] = {
+  { -64,   1 },    { -63,   2 },    { -65,   3 },    { -62,   4 },
+  { -66,   5 },    { -61,   6 },    { -67,   7 },    { -60,   8 },
+  { -68,   9 },    {  10,  11 },    { -69, -59 },    {  12,  13 },
+  { -70, -58 },    {  14,  28 },    {  15,  21 },    {  16,  18 },
+  { -57,  17 },    { -71, -56 },    {  19,  20 },    { -88, -87 },
+  { -86, -85 },    {  22,  25 },    {  23,  24 },    { -84, -83 },
+  { -82, -81 },    {  26,  27 },    { -80, -79 },    { -78, -77 },
+  {  29,  36 },    {  30,  33 },    {  31,  32 },    { -76, -75 },
+  { -74, -73 },    {  34,  35 },    { -72, -55 },    { -54, -53 },
+  {  37,  41 },    {  38,  39 },    { -52, -51 },    { -50,  40 },
+  { -49, -48 },    {  42,  45 },    {  43,  44 },    { -47, -46 },
+  { -45, -44 },    {  46,  47 },    { -43, -42 },    { -41, -40 }
+};
+
+const int8 sbr_huffBook_EnvBalance10F[48][2] = {
+  { -64,   1 },    { -65,   2 },    { -63,   3 },    { -66,   4 },
+  { -62,   5 },    { -61,   6 },    { -67,   7 },    { -68,   8 },
+  { -60,   9 },    {  10,  11 },    { -69, -59 },    { -70,  12 },
+  { -58,  13 },    {  14,  17 },    { -71,  15 },    { -57,  16 },
+  { -56, -73 },    {  18,  32 },    {  19,  25 },    {  20,  22 },
+  { -72,  21 },    { -88, -87 },    {  23,  24 },    { -86, -85 },
+  { -84, -83 },    {  26,  29 },    {  27,  28 },    { -82, -81 },
+  { -80, -79 },    {  30,  31 },    { -78, -77 },    { -76, -75 },
+  {  33,  40 },    {  34,  37 },    {  35,  36 },    { -74, -55 },
+  { -54, -53 },    {  38,  39 },    { -52, -51 },    { -50, -49 },
+  {  41,  44 },    {  42,  43 },    { -48, -47 },    { -46, -45 },
+  {  45,  46 },    { -44, -43 },    { -42,  47 },    { -41, -40 }
+};
+
+const int8 sbr_huffBook_EnvLevel11T[62][2] = {
+  { -64,   1 },    { -65,   2 },    { -63,   3 },    { -66,   4 },
+  { -62,   5 },    { -67,   6 },    { -61,   7 },    { -68,   8 },
+  { -60,   9 },    {  10,  11 },    { -69, -59 },    {  12,  14 },
+  { -70,  13 },    { -71, -58 },    {  15,  18 },    {  16,  17 },
+  { -72, -57 },    { -73, -74 },    {  19,  22 },    { -56,  20 },
+  { -55,  21 },    { -54, -77 },    {  23,  31 },    {  24,  25 },
+  { -75, -76 },    {  26,  27 },    { -78, -53 },    {  28,  29 },
+  { -52, -95 },    { -94,  30 },    { -93, -92 },    {  32,  47 },
+  {  33,  40 },    {  34,  37 },    {  35,  36 },    { -91, -90 },
+  { -89, -88 },    {  38,  39 },    { -87, -86 },    { -85, -84 },
+  {  41,  44 },    {  42,  43 },    { -83, -82 },    { -81, -80 },
+  {  45,  46 },    { -79, -51 },    { -50, -49 },    {  48,  55 },
+  {  49,  52 },    {  50,  51 },    { -48, -47 },    { -46, -45 },
+  {  53,  54 },    { -44, -43 },    { -42, -41 },    {  56,  59 },
+  {  57,  58 },    { -40, -39 },    { -38, -37 },    {  60,  61 },
+  { -36, -35 },    { -34, -33 }
+};
+
+const int8 sbr_huffBook_EnvLevel11F[62][2] = {
+  { -64,   1 },    { -65,   2 },    { -63,   3 },    { -66,   4 },
+  { -62,   5 },    { -67,   6 },    {   7,   8 },    { -61, -68 },
+  {   9,  10 },    { -60, -69 },    {  11,  12 },    { -59, -70 },
+  {  13,  14 },    { -58, -71 },    {  15,  16 },    { -57, -72 },
+  {  17,  19 },    { -56,  18 },    { -55, -73 },    {  20,  24 },
+  {  21,  22 },    { -74, -54 },    { -53,  23 },    { -75, -76 },
+  {  25,  30 },    {  26,  27 },    { -52, -51 },    {  28,  29 },
+  { -77, -79 },    { -50, -49 },    {  31,  39 },    {  32,  35 },
+  {  33,  34 },    { -78, -46 },    { -82, -88 },    {  36,  37 },
+  { -83, -48 },    { -47,  38 },    { -86, -85 },    {  40,  47 },
+  {  41,  44 },    {  42,  43 },    { -80, -44 },    { -43, -42 },
+  {  45,  46 },    { -39, -87 },    { -84, -40 },    {  48,  55 },
+  {  49,  52 },    {  50,  51 },    { -95, -94 },    { -93, -92 },
+  {  53,  54 },    { -91, -90 },    { -89, -81 },    {  56,  59 },
+  {  57,  58 },    { -45, -41 },    { -38, -37 },    {  60,  61 },
+  { -36, -35 },    { -34, -33 }
+};
+
+const int8 sbr_huffBook_EnvBalance11T[24][2] = {
+  { -64,   1 },    { -63,   2 },    { -65,   3 },    { -66,   4 },
+  { -62,   5 },    { -61,   6 },    { -67,   7 },    { -68,   8 },
+  { -60,   9 },    {  10,  16 },    {  11,  13 },    { -69,  12 },
+  { -76, -75 },    {  14,  15 },    { -74, -73 },    { -72, -71 },
+  {  17,  20 },    {  18,  19 },    { -70, -59 },    { -58, -57 },
+  {  21,  22 },    { -56, -55 },    { -54,  23 },    { -53, -52 }
+};
+
+const int8 sbr_huffBook_EnvBalance11F[24][2] = {
+  { -64,   1 },    { -65,   2 },    { -63,   3 },    { -66,   4 },
+  { -62,   5 },    { -61,   6 },    { -67,   7 },    { -68,   8 },
+  { -60,   9 },    {  10,  13 },    { -69,  11 },    { -59,  12 },
+  { -58, -76 },    {  14,  17 },    {  15,  16 },    { -75, -74 },
+  { -73, -72 },    {  18,  21 },    {  19,  20 },    { -71, -70 },
+  { -57, -56 },    {  22,  23 },    { -55, -54 },    { -53, -52 }
+};
+
+const int8 sbr_huffBook_NoiseLevel11T[62][2] = {
+  { -64,   1 },    { -63,   2 },    { -65,   3 },    { -66,   4 },
+  { -62,   5 },    { -67,   6 },    {   7,   8 },    { -61, -68 },
+  {   9,  30 },    {  10,  15 },    { -60,  11 },    { -69,  12 },
+  {  13,  14 },    { -59, -53 },    { -95, -94 },    {  16,  23 },
+  {  17,  20 },    {  18,  19 },    { -93, -92 },    { -91, -90 },
+  {  21,  22 },    { -89, -88 },    { -87, -86 },    {  24,  27 },
+  {  25,  26 },    { -85, -84 },    { -83, -82 },    {  28,  29 },
+  { -81, -80 },    { -79, -78 },    {  31,  46 },    {  32,  39 },
+  {  33,  36 },    {  34,  35 },    { -77, -76 },    { -75, -74 },
+  {  37,  38 },    { -73, -72 },    { -71, -70 },    {  40,  43 },
+  {  41,  42 },    { -58, -57 },    { -56, -55 },    {  44,  45 },
+  { -54, -52 },    { -51, -50 },    {  47,  54 },    {  48,  51 },
+  {  49,  50 },    { -49, -48 },    { -47, -46 },    {  52,  53 },
+  { -45, -44 },    { -43, -42 },    {  55,  58 },    {  56,  57 },
+  { -41, -40 },    { -39, -38 },    {  59,  60 },    { -37, -36 },
+  { -35,  61 },    { -34, -33 }
+};
+
+const int8 sbr_huffBook_NoiseBalance11T[24][2] = {
+  { -64,   1 },    { -65,   2 },    { -63,   3 },    {   4,   9 },
+  { -66,   5 },    { -62,   6 },    {   7,   8 },    { -76, -75 },
+  { -74, -73 },    {  10,  17 },    {  11,  14 },    {  12,  13 },
+  { -72, -71 },    { -70, -69 },    {  15,  16 },    { -68, -67 },
+  { -61, -60 },    {  18,  21 },    {  19,  20 },    { -59, -58 },
+  { -57, -56 },    {  22,  23 },    { -55, -54 },    { -53, -52 }
+};
+//@}
+
+const int32 v_Huff_envelopeLevelC10T[121] = {
+  0x0003FFD6, 0x0003FFD7, 0x0003FFD8, 0x0003FFD9, 0x0003FFDA, 0x0003FFDB, 0x0007FFB8, 0x0007FFB9,
+  0x0007FFBA, 0x0007FFBB, 0x0007FFBC, 0x0007FFBD, 0x0007FFBE, 0x0007FFBF, 0x0007FFC0, 0x0007FFC1,
+  0x0007FFC2, 0x0007FFC3, 0x0007FFC4, 0x0007FFC5, 0x0007FFC6, 0x0007FFC7, 0x0007FFC8, 0x0007FFC9,
+  0x0007FFCA, 0x0007FFCB, 0x0007FFCC, 0x0007FFCD, 0x0007FFCE, 0x0007FFCF, 0x0007FFD0, 0x0007FFD1,
+  0x0007FFD2, 0x0007FFD3, 0x0001FFE6, 0x0003FFD4, 0x0000FFF0, 0x0001FFE9, 0x0003FFD5, 0x0001FFE7,
+  0x0000FFF1, 0x0000FFEC, 0x0000FFED, 0x0000FFEE, 0x00007FF4, 0x00003FF9, 0x00003FF7, 0x00001FFA,
+  0x00001FF9, 0x00000FFB, 0x000007FC, 0x000003FC, 0x000001FD, 0x000000FD, 0x0000007D, 0x0000003D,
+  0x0000001D, 0x0000000D, 0x00000005, 0x00000001, 0x00000000, 0x00000004, 0x0000000C, 0x0000001C,
+  0x0000003C, 0x0000007C, 0x000000FC, 0x000001FC, 0x000003FD, 0x00000FFA, 0x00001FF8, 0x00003FF6,
+  0x00003FF8, 0x00007FF5, 0x0000FFEF, 0x0001FFE8, 0x0000FFF2, 0x0007FFD4, 0x0007FFD5, 0x0007FFD6,
+  0x0007FFD7, 0x0007FFD8, 0x0007FFD9, 0x0007FFDA, 0x0007FFDB, 0x0007FFDC, 0x0007FFDD, 0x0007FFDE,
+  0x0007FFDF, 0x0007FFE0, 0x0007FFE1, 0x0007FFE2, 0x0007FFE3, 0x0007FFE4, 0x0007FFE5, 0x0007FFE6,
+  0x0007FFE7, 0x0007FFE8, 0x0007FFE9, 0x0007FFEA, 0x0007FFEB, 0x0007FFEC, 0x0007FFED, 0x0007FFEE,
+  0x0007FFEF, 0x0007FFF0, 0x0007FFF1, 0x0007FFF2, 0x0007FFF3, 0x0007FFF4, 0x0007FFF5, 0x0007FFF6,
+  0x0007FFF7, 0x0007FFF8, 0x0007FFF9, 0x0007FFFA, 0x0007FFFB, 0x0007FFFC, 0x0007FFFD, 0x0007FFFE,
+  0x0007FFFF
+};
+
+const uint8 v_Huff_envelopeLevelL10T[121] = {
+  0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000011, 0x00000012, 0x00000010, 0x00000011, 0x00000012, 0x00000011,
+  0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x0000000F, 0x0000000E, 0x0000000E, 0x0000000D,
+  0x0000000D, 0x0000000C, 0x0000000B, 0x0000000A, 0x00000009, 0x00000008, 0x00000007, 0x00000006,
+  0x00000005, 0x00000004, 0x00000003, 0x00000002, 0x00000002, 0x00000003, 0x00000004, 0x00000005,
+  0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000C, 0x0000000D, 0x0000000E,
+  0x0000000E, 0x0000000F, 0x00000010, 0x00000011, 0x00000010, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013
+};
+
+const int32 v_Huff_envelopeLevelC10F[121] = {
+  0x0007FFE7, 0x0007FFE8, 0x000FFFD2, 0x000FFFD3, 0x000FFFD4, 0x000FFFD5, 0x000FFFD6, 0x000FFFD7,
+  0x000FFFD8, 0x0007FFDA, 0x000FFFD9, 0x000FFFDA, 0x000FFFDB, 0x000FFFDC, 0x0007FFDB, 0x000FFFDD,
+  0x0007FFDC, 0x0007FFDD, 0x000FFFDE, 0x0003FFE4, 0x000FFFDF, 0x000FFFE0, 0x000FFFE1, 0x0007FFDE,
+  0x000FFFE2, 0x000FFFE3, 0x000FFFE4, 0x0007FFDF, 0x000FFFE5, 0x0007FFE0, 0x0003FFE8, 0x0007FFE1,
+  0x0003FFE0, 0x0003FFE9, 0x0001FFEF, 0x0003FFE5, 0x0001FFEC, 0x0001FFED, 0x0001FFEE, 0x0000FFF4,
+  0x0000FFF3, 0x0000FFF0, 0x00007FF7, 0x00007FF6, 0x00003FFA, 0x00001FFA, 0x00001FF9, 0x00000FFA,
+  0x00000FF8, 0x000007F9, 0x000003FB, 0x000001FC, 0x000001FA, 0x000000FB, 0x0000007C, 0x0000003C,
+  0x0000001C, 0x0000000C, 0x00000005, 0x00000001, 0x00000000, 0x00000004, 0x0000000D, 0x0000001D,
+  0x0000003D, 0x000000FA, 0x000000FC, 0x000001FB, 0x000003FA, 0x000007F8, 0x000007FA, 0x000007FB,
+  0x00000FF9, 0x00000FFB, 0x00001FF8, 0x00001FFB, 0x00003FF8, 0x00003FF9, 0x0000FFF1, 0x0000FFF2,
+  0x0001FFEA, 0x0001FFEB, 0x0003FFE1, 0x0003FFE2, 0x0003FFEA, 0x0003FFE3, 0x0003FFE6, 0x0003FFE7,
+  0x0003FFEB, 0x000FFFE6, 0x0007FFE2, 0x000FFFE7, 0x000FFFE8, 0x000FFFE9, 0x000FFFEA, 0x000FFFEB,
+  0x000FFFEC, 0x0007FFE3, 0x000FFFED, 0x000FFFEE, 0x000FFFEF, 0x000FFFF0, 0x0007FFE4, 0x000FFFF1,
+  0x0003FFEC, 0x000FFFF2, 0x000FFFF3, 0x0007FFE5, 0x0007FFE6, 0x000FFFF4, 0x000FFFF5, 0x000FFFF6,
+  0x000FFFF7, 0x000FFFF8, 0x000FFFF9, 0x000FFFFA, 0x000FFFFB, 0x000FFFFC, 0x000FFFFD, 0x000FFFFE,
+  0x000FFFFF
+};
+
+const uint8 v_Huff_envelopeLevelL10F[121] = {
+  0x00000013, 0x00000013, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014,
+  0x00000014, 0x00000013, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000013, 0x00000014,
+  0x00000013, 0x00000013, 0x00000014, 0x00000012, 0x00000014, 0x00000014, 0x00000014, 0x00000013,
+  0x00000014, 0x00000014, 0x00000014, 0x00000013, 0x00000014, 0x00000013, 0x00000012, 0x00000013,
+  0x00000012, 0x00000012, 0x00000011, 0x00000012, 0x00000011, 0x00000011, 0x00000011, 0x00000010,
+  0x00000010, 0x00000010, 0x0000000F, 0x0000000F, 0x0000000E, 0x0000000D, 0x0000000D, 0x0000000C,
+  0x0000000C, 0x0000000B, 0x0000000A, 0x00000009, 0x00000009, 0x00000008, 0x00000007, 0x00000006,
+  0x00000005, 0x00000004, 0x00000003, 0x00000002, 0x00000002, 0x00000003, 0x00000004, 0x00000005,
+  0x00000006, 0x00000008, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000B, 0x0000000B,
+  0x0000000C, 0x0000000C, 0x0000000D, 0x0000000D, 0x0000000E, 0x0000000E, 0x00000010, 0x00000010,
+  0x00000011, 0x00000011, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012,
+  0x00000012, 0x00000014, 0x00000013, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014,
+  0x00000014, 0x00000013, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000013, 0x00000014,
+  0x00000012, 0x00000014, 0x00000014, 0x00000013, 0x00000013, 0x00000014, 0x00000014, 0x00000014,
+  0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014,
+  0x00000014
+};
+
+const int32 bookSbrEnvBalanceC10T[49] = {
+  0x0000FFE4, 0x0000FFE5, 0x0000FFE6, 0x0000FFE7, 0x0000FFE8, 0x0000FFE9, 0x0000FFEA,
+  0x0000FFEB, 0x0000FFEC, 0x0000FFED, 0x0000FFEE, 0x0000FFEF, 0x0000FFF0, 0x0000FFF1,
+  0x0000FFF2, 0x0000FFF3, 0x0000FFF4, 0x0000FFE2, 0x00000FFC, 0x000007FC, 0x000001FE,
+  0x0000007E, 0x0000001E, 0x00000006, 0x00000000, 0x00000002, 0x0000000E, 0x0000003E,
+  0x000000FE, 0x000007FD, 0x00000FFD, 0x00007FF0, 0x0000FFE3, 0x0000FFF5, 0x0000FFF6,
+  0x0000FFF7, 0x0000FFF8, 0x0000FFF9, 0x0000FFFA, 0x0001FFF6, 0x0001FFF7, 0x0001FFF8,
+  0x0001FFF9, 0x0001FFFA, 0x0001FFFB, 0x0001FFFC, 0x0001FFFD, 0x0001FFFE, 0x0001FFFF
+};
+
+const uint8 bookSbrEnvBalanceL10T[49] = {
+  0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010, 
+  0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+  0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x0000000C, 0x0000000B, 0x00000009,
+  0x00000007, 0x00000005, 0x00000003, 0x00000001, 0x00000002, 0x00000004, 0x00000006,
+  0x00000008, 0x0000000B, 0x0000000C, 0x0000000F, 0x00000010, 0x00000010, 0x00000010,
+  0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000011, 0x00000011, 0x00000011,
+  0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011
+};
+
+const int32 bookSbrEnvBalanceC10F[49] = {
+  0x0003FFE2, 0x0003FFE3, 0x0003FFE4, 0x0003FFE5, 0x0003FFE6, 0x0003FFE7,0x0003FFE8,
+  0x0003FFE9, 0x0003FFEA, 0x0003FFEB, 0x0003FFEC, 0x0003FFED, 0x0003FFEE, 0x0003FFEF,
+  0x0003FFF0, 0x0000FFF7, 0x0001FFF0, 0x00003FFC, 0x000007FE, 0x000007FC, 0x000000FE,
+  0x0000007E, 0x0000000E, 0x00000002, 0x00000000, 0x00000006, 0x0000001E, 0x0000003E,
+  0x000001FE, 0x000007FD, 0x00000FFE, 0x00007FFA, 0x0000FFF6, 0x0003FFF1, 0x0003FFF2,
+  0x0003FFF3, 0x0003FFF4, 0x0003FFF5, 0x0003FFF6, 0x0003FFF7, 0x0003FFF8, 0x0003FFF9,
+  0x0003FFFA, 0x0003FFFB, 0x0003FFFC, 0x0003FFFD, 0x0003FFFE, 0x0007FFFE, 0x0007FFFF
+};
+
+const uint8 bookSbrEnvBalanceL10F[49] = {
+  0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012,
+  0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012,
+  0x00000012, 0x00000010, 0x00000011, 0x0000000E, 0x0000000B, 0x0000000B, 0x00000008,
+  0x00000007, 0x00000004, 0x00000002, 0x00000001, 0x00000003, 0x00000005, 0x00000006,
+  0x00000009, 0x0000000B, 0x0000000C, 0x0000000F, 0x00000010, 0x00000012, 0x00000012,
+  0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012,
+  0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000013, 0x00000013
+};
+
+const int32 v_Huff_envelopeLevelC11T[63] = {
+  0x0003FFED, 0x0003FFEE, 0x0007FFDE, 0x0007FFDF, 0x0007FFE0, 0x0007FFE1, 0x0007FFE2,
+  0x0007FFE3, 0x0007FFE4, 0x0007FFE5, 0x0007FFE6, 0x0007FFE7, 0x0007FFE8, 0x0007FFE9,
+  0x0007FFEA, 0x0007FFEB, 0x0007FFEC, 0x0001FFF4, 0x0000FFF7, 0x0000FFF9, 0x0000FFF8,
+  0x00003FFB, 0x00003FFA, 0x00003FF8, 0x00001FFA, 0x00000FFC, 0x000007FC, 0x000000FE,
+  0x0000003E, 0x0000000E, 0x00000002, 0x00000000, 0x00000006, 0x0000001E, 0x0000007E,
+  0x000001FE, 0x000007FD, 0x00001FFB, 0x00003FF9, 0x00003FFC, 0x00007FFA, 0x0000FFF6,
+  0x0001FFF5, 0x0003FFEC, 0x0007FFED, 0x0007FFEE, 0x0007FFEF, 0x0007FFF0, 0x0007FFF1,
+  0x0007FFF2, 0x0007FFF3, 0x0007FFF4, 0x0007FFF5, 0x0007FFF6, 0x0007FFF7, 0x0007FFF8,
+  0x0007FFF9, 0x0007FFFA, 0x0007FFFB, 0x0007FFFC, 0x0007FFFD, 0x0007FFFE, 0x0007FFFF
+};
+
+const uint8 v_Huff_envelopeLevelL11T[63] = {
+  0x00000012, 0x00000012, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000011, 0x00000010, 0x00000010, 0x00000010,
+  0x0000000E, 0x0000000E, 0x0000000E, 0x0000000D, 0x0000000C, 0x0000000B, 0x00000008,
+  0x00000006, 0x00000004, 0x00000002, 0x00000001, 0x00000003, 0x00000005, 0x00000007,
+  0x00000009, 0x0000000B, 0x0000000D, 0x0000000E, 0x0000000E, 0x0000000F, 0x00000010,
+  0x00000011, 0x00000012, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013,
+  0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013
+};
+
+const int32 v_Huff_envelopeLevelC11F[63] = {
+  0x000FFFF0, 0x000FFFF1, 0x000FFFF2, 0x000FFFF3, 0x000FFFF4, 0x000FFFF5, 0x000FFFF6,
+  0x0003FFF3, 0x0007FFF5, 0x0007FFEE, 0x0007FFEF, 0x0007FFF6, 0x0003FFF4, 0x0003FFF2,
+  0x000FFFF7, 0x0007FFF0, 0x0001FFF5, 0x0003FFF0, 0x0001FFF4, 0x0000FFF7, 0x0000FFF6,
+  0x00007FF8, 0x00003FFB, 0x00000FFD, 0x000007FD, 0x000003FD, 0x000001FD, 0x000000FD,
+  0x0000003E, 0x0000000E, 0x00000002, 0x00000000, 0x00000006, 0x0000001E, 0x000000FC,
+  0x000001FC, 0x000003FC, 0x000007FC, 0x00000FFC, 0x00001FFC, 0x00003FFA, 0x00007FF9,
+  0x00007FFA, 0x0000FFF8, 0x0000FFF9, 0x0001FFF6, 0x0001FFF7, 0x0003FFF5, 0x0003FFF6,
+  0x0003FFF1, 0x000FFFF8, 0x0007FFF1, 0x0007FFF2, 0x0007FFF3, 0x000FFFF9, 0x0007FFF7,
+  0x0007FFF4, 0x000FFFFA, 0x000FFFFB, 0x000FFFFC, 0x000FFFFD, 0x000FFFFE, 0x000FFFFF
+};
+
+const uint8 v_Huff_envelopeLevelL11F[63] = {
+  0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014,
+  0x00000012, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000012, 0x00000012,
+  0x00000014, 0x00000013, 0x00000011, 0x00000012, 0x00000011, 0x00000010, 0x00000010,
+  0x0000000F, 0x0000000E, 0x0000000C, 0x0000000B, 0x0000000A, 0x00000009, 0x00000008,
+  0x00000006, 0x00000004, 0x00000002, 0x00000001, 0x00000003, 0x00000005, 0x00000008,
+  0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
+  0x0000000F, 0x00000010, 0x00000010, 0x00000011, 0x00000011, 0x00000012, 0x00000012,
+  0x00000012, 0x00000014, 0x00000013, 0x00000013, 0x00000013, 0x00000014, 0x00000013,
+  0x00000013, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014
+};
+
+const uint16 bookSbrEnvBalanceC11T[25] = {
+  0x00001FF2, 0x00001FF3, 0x00001FF4, 0x00001FF5, 0x00001FF6, 0x00001FF7, 0x00001FF8,
+  0x00000FF8, 0x000000FE, 0x0000007E, 0x0000000E, 0x00000006, 0x00000000, 0x00000002,
+  0x0000001E, 0x0000003E, 0x000001FE, 0x00001FF9, 0x00001FFA, 0x00001FFB, 0x00001FFC,
+  0x00001FFD, 0x00001FFE, 0x00003FFE, 0x00003FFF
+};
+
+const uint8 bookSbrEnvBalanceL11T[25] = {
+  0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D,
+  0x0000000C, 0x00000008, 0x00000007, 0x00000004, 0x00000003, 0x00000001, 0x00000002,
+  0x00000005, 0x00000006, 0x00000009, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D,
+  0x0000000D, 0x0000000D, 0x0000000E, 0x0000000E
+};
+
+const uint16 bookSbrEnvBalanceC11F[25] = {
+  0x00001FF7, 0x00001FF8, 0x00001FF9, 0x00001FFA, 0x00001FFB, 0x00003FF8, 0x00003FF9,
+  0x000007FC, 0x000000FE, 0x0000007E, 0x0000000E, 0x00000002, 0x00000000, 0x00000006,
+  0x0000001E, 0x0000003E, 0x000001FE, 0x00000FFA, 0x00001FF6, 0x00003FFA, 0x00003FFB,
+  0x00003FFC, 0x00003FFD, 0x00003FFE, 0x00003FFF
+};
+
+const uint8 bookSbrEnvBalanceL11F[25] = {
+  0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000E, 0x0000000E,
+  0x0000000B, 0x00000008, 0x00000007, 0x00000004, 0x00000002, 0x00000001, 0x00000003,
+  0x00000005, 0x00000006, 0x00000009, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000E,
+  0x0000000E, 0x0000000E, 0x0000000E, 0x0000000E
+};
+
+const uint16 v_Huff_NoiseLevelC11T[63] = {
+  0x00001FCE, 0x00001FCF, 0x00001FD0, 0x00001FD1, 0x00001FD2, 0x00001FD3, 0x00001FD4,
+  0x00001FD5, 0x00001FD6, 0x00001FD7, 0x00001FD8, 0x00001FD9, 0x00001FDA, 0x00001FDB,
+  0x00001FDC, 0x00001FDD, 0x00001FDE, 0x00001FDF, 0x00001FE0, 0x00001FE1, 0x00001FE2,
+  0x00001FE3, 0x00001FE4, 0x00001FE5, 0x00001FE6, 0x00001FE7, 0x000007F2, 0x000000FD,
+  0x0000003E, 0x0000000E, 0x00000006, 0x00000000, 0x00000002, 0x0000001E, 0x000000FC,
+  0x000003F8, 0x00001FCC, 0x00001FE8, 0x00001FE9, 0x00001FEA, 0x00001FEB, 0x00001FEC,
+  0x00001FCD, 0x00001FED, 0x00001FEE, 0x00001FEF, 0x00001FF0, 0x00001FF1, 0x00001FF2,
+  0x00001FF3, 0x00001FF4, 0x00001FF5, 0x00001FF6, 0x00001FF7, 0x00001FF8, 0x00001FF9,
+  0x00001FFA, 0x00001FFB, 0x00001FFC, 0x00001FFD, 0x00001FFE, 0x00003FFE, 0x00003FFF
+};
+
+const uint8 v_Huff_NoiseLevelL11T[63] = {
+  0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D,
+  0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D,
+  0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D,
+  0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000B, 0x00000008,
+  0x00000006, 0x00000004, 0x00000003, 0x00000001, 0x00000002, 0x00000005, 0x00000008,
+  0x0000000A, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 
+  0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 
+  0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 
+  0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000D, 0x0000000E, 0x0000000E
+};
+
+const uint16 bookSbrNoiseBalanceC11T[25] = {
+  0x000000EC, 0x000000ED, 0x000000EE, 0x000000EF, 0x000000F0, 0x000000F1, 0x000000F2,
+  0x000000F3, 0x000000F4, 0x000000F5, 0x0000001C, 0x00000002, 0x00000000, 0x00000006,
+  0x0000003A, 0x000000F6, 0x000000F7, 0x000000F8, 0x000000F9, 0x000000FA, 0x000000FB,
+  0x000000FC, 0x000000FD, 0x000000FE, 0x000000FF
+};
+
+const uint8 bookSbrNoiseBalanceL11T[25] = {
+  0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008,
+  0x00000008, 0x00000008, 0x00000008, 0x00000005, 0x00000002, 0x00000001, 0x00000003,
+  0x00000006, 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008,
+  0x00000008, 0x00000008, 0x00000008, 0x00000008
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/AACGain/src/sfbdata.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,265 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  sfbdata.cpp - Sfb table definitions for AAC.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2000-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/*-- Project Headers. --*/
+#include "aacdef.h"
+
+/*
+   Purpose:     Sfb widths (long and short block) for each sampling rate.
+   Explanation: Supports frame lengths 1024 and 960. */
+
+const int16 sfb_96_1024[] = {
+  4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 96, 
+  108, 120, 132, 144, 156, 172, 188, 212, 240, 276, 320, 384, 448, 512, 576, 
+  640, 704, 768, 832, 896, 960, 1024};
+
+const int16 sfb_96_128[] = {4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128};
+const int16 sfb_96_120[] = {4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 120};
+
+const int16 sfb_64_1024[] = {
+  4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 100, 
+  112, 124, 140, 156, 172, 192, 216, 240, 268, 304, 344, 384, 424, 464, 504, 
+  544, 584, 624, 664, 704, 744, 784, 824, 864, 904, 944, 984, 1024};
+const int16 sfb_64_960[] = { 
+  4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 100, 
+  112, 124, 140, 156, 172, 192, 216, 240, 268, 304, 344, 384, 424, 464, 504, 
+  544, 584, 624, 664, 704, 744, 784, 824, 864, 904, 944, 960};
+
+const int16 sfb_64_128[] = {4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128};
+const int16 sfb_64_120[] = {4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 120};
+
+const int16 sfb_48_1024[] = {
+  4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 
+  132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 
+  512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 1024};
+const int16 sfb_48_960[] = { 
+  4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 
+  132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 
+  512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 960, 0};
+
+const int16 sfb_48_128[] = 
+{4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 128};
+const int16 sfb_48_120[] =
+{4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 120};
+
+const int16 sfb_32_1024[] = {
+  4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 
+  132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 
+  512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 960,
+  992, 1024};
+const int16 sfb_32_960[] =
+{ 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 
+  132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 
+  512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 960, 0};
+
+const int16 sfb_24_1024[] = {
+  4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 76, 84, 92, 100, 108, 
+  116, 124, 136, 148, 160, 172, 188, 204, 220, 240, 260, 284, 308, 336, 364, 
+  396, 432, 468, 508, 552, 600, 652, 704, 768, 832, 896, 960, 1024};
+
+const int16 sfb_24_128[] =
+{ 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 128};
+const int16 sfb_24_120[] =
+{ 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 120};
+
+const int16 sfb_16_1024[] = {
+  8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124, 136, 148, 160, 
+  172, 184, 196, 212, 228, 244, 260, 280, 300, 320, 344, 368, 396, 424, 456, 
+  492, 532, 572, 616, 664, 716, 772, 832, 896, 960, 1024};
+
+const int16 sfb_16_128[] = 
+{ 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 128};
+const int16 sfb_16_120[] =
+{ 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 120};
+
+const int16 sfb_8_1024[] = {
+  12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 172, 188, 204, 220, 
+  236, 252, 268, 288, 308, 328, 348, 372, 396, 420, 448, 476, 508, 544, 580, 
+  620, 664, 712, 764, 820, 880, 944, 1024};
+const int16 sfb_8_960[] =
+{ 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 172, 188, 204, 
+  220, 236, 252, 268, 288, 308, 328, 348, 372, 396, 420, 448, 476, 508, 544, 
+  580, 620, 664, 712, 764, 820, 880, 944, 960};
+
+const int16 sfb_8_128[] = 
+{ 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 128};
+const int16 sfb_8_120[] =
+{ 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 120};
+
+/*
+   Purpose:     Block parameters for each sampling rate.
+   Explanation: - */
+const SR_Info AAC_sampleRateInfo[(1 << LEN_SAMP_IDX)] = {
+
+  /* 96000 */
+  {96000, 41, sfb_96_1024, 12, sfb_96_128, 40, sfb_96_1024, 12, sfb_96_120},
+
+  /* 88200 */
+  {88200, 41, sfb_96_1024, 12, sfb_96_128, 40, sfb_96_1024, 12, sfb_96_120},
+
+  /* 64000 */
+  {64000, 47, sfb_64_1024, 12, sfb_64_128, 46, sfb_64_960,  12, sfb_64_120},
+
+  /* 48000 */
+  {48000, 49, sfb_48_1024, 14, sfb_48_128, 49, sfb_48_960,  14, sfb_48_120},
+
+  /* 44100 */
+  {44100, 49, sfb_48_1024, 14, sfb_48_128, 49, sfb_48_960,  14, sfb_48_120},
+
+  /* 32000 */
+  {32000, 51, sfb_32_1024, 14, sfb_48_128, 49, sfb_32_960,  14, sfb_48_120}, 
+
+  /* 24000 */
+  {24000, 47, sfb_24_1024, 15, sfb_24_128, 46, sfb_24_1024, 15, sfb_24_120},
+
+  /* 22050 */
+  {22050, 47, sfb_24_1024, 15, sfb_24_128, 46, sfb_24_1024, 15, sfb_24_120},
+
+  /* 16000 */
+  {16000, 43, sfb_16_1024, 15, sfb_16_128, 42, sfb_16_1024, 15, sfb_16_120},
+
+  /* 12000 */
+  {12000, 43, sfb_16_1024, 15, sfb_16_128, 42, sfb_16_1024, 15, sfb_16_120},
+
+  /* 11025 */
+  {11025, 43, sfb_16_1024, 15, sfb_16_128, 42, sfb_16_1024, 15, sfb_16_120},
+
+  /* 8000  */
+  { 8000, 40,  sfb_8_1024, 15, sfb_8_128,  40, sfb_8_960,   15, sfb_8_120},
+
+  {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0}};
+
+/*
+ * Retrieves AAC sample rate corresponding to the specified sample rate index.
+ */
+int32
+AACSampleRate(uint8 sampleRateIdx)
+{
+  int32 sampleRate = 0;
+
+  if(sampleRateIdx > 0 && sampleRateIdx < 12)
+    sampleRate = AAC_sampleRateInfo[sampleRateIdx].samp_rate;
+
+  return (sampleRate);
+}
+
+/*
+ * Initializes SFB and sample rate tables for the specified AAC encoder.
+ */
+void
+AACSfbInfoInit(CSfb_Info *sfb, uint8 sIndex, uint8 is960)
+{
+  CInfo *ip;
+  const SR_Info *sip;
+  const int16 *sfbands;
+  int16 i, j, k, n, ws;
+
+  sip = &AAC_sampleRateInfo[sIndex];
+
+  /*-- Long block info. --*/
+  ip = sfb->only_long_info;
+  sfb->winmap[ONLY_LONG_WND] = ip;
+
+  ip->nsbk = 1;
+  ip->islong = 1;
+  ip->bins_per_bk = (int16) ((is960) ? LN2_960 : LN2);
+  for(i = 0; i < ip->nsbk; i++)
+  {
+    if(is960)
+    {
+      ip->sfb_per_sbk[i] = sip->nsfb960;
+      ip->sbk_sfb_top[i] = sip->SFbands960;
+    }
+    else
+    {
+      ip->sfb_per_sbk[i] = sip->nsfb1024;
+      ip->sbk_sfb_top[i] = sip->SFbands1024;
+    }
+  }
+  ip->sfb_width_128 = NULL;
+  ip->num_groups = 1;
+  ip->group_len[0] = 1;
+  ip->group_offs[0] = 0;
+
+  /*-- Short block info. --*/
+  ip = sfb->eight_short_info;
+  sfb->winmap[ONLY_SHORT_WND] = ip;
+
+  ip->islong = 0;
+  ip->nsbk = NSHORT;
+  ip->bins_per_bk = (int16) ((is960) ? LN2_960 : LN2);
+  for(i = 0; i < ip->nsbk; i++)
+  {
+    if(is960)
+    {
+      ip->sfb_per_sbk[i] = sip->nsfb120;
+      ip->sbk_sfb_top[i] = sip->SFbands120;
+    }
+    else
+    {
+      ip->sfb_per_sbk[i] = sip->nsfb128;
+      ip->sbk_sfb_top[i] = sip->SFbands128;
+    }
+  }
+  
+  /*-- Construct sfb width table. --*/
+  ip->sfb_width_128 = sfb->sfbwidth128;
+  for(i = 0, j = 0, n = ip->sfb_per_sbk[0]; i < n; i++)
+  {
+    k = ip->sbk_sfb_top[0][i];
+    ip->sfb_width_128[i] = (int16) (k - j);
+    j = k;
+  }
+
+  /*-- Common to long and short. --*/
+  for(ws = 0; ws < NUM_WIN_SEQ; ws++)
+  {
+    if(ws == 1 || ws == 3)
+      continue;
+
+    ip = sfb->winmap[ws];
+    ip->sfb_per_bk = 0;
+    for(i = 0, k= 0, n = 0; i < ip->nsbk; i++)
+    {
+      /*-- Compute bins_per_sbk. --*/
+      ip->bins_per_sbk[i] = (int16) (ip->bins_per_bk / ip->nsbk);
+
+      /*-- Compute sfb_per_bk. --*/
+      ip->sfb_per_bk = (int16) (ip->sfb_per_bk + ip->sfb_per_sbk[i]);
+
+      /*-- Construct default (non-interleaved) bk_sfb_top[]. --*/
+      sfbands = ip->sbk_sfb_top[i];
+      for(j = 0; j < ip->sfb_per_sbk[i]; j++)
+        ip->bk_sfb_top[j + k] = (int16) (sfbands[j] + n);
+
+      n = (int16) (n + ip->bins_per_sbk[i]);
+      k = (int16) (k + ip->sfb_per_sbk[i]);
+    }
+  }
+
+  sfb->winmap[1] = sfb->winmap[ONLY_LONG_WND];
+  sfb->winmap[3] = sfb->winmap[ONLY_LONG_WND];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/MP3Gain/inc/mp3tables.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,388 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  mp3tables.cpp - Tables for layer III.
+
+  Author(s): Juha Ojanpera
+  Modified: Ali Ahmaniemi
+  Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef MP3TABLES_H
+#define MP3TABLES_H
+
+/*-- Project Headers. --*/
+#include "mpaud.h"
+
+/*
+   Purpose:     Grouping of the scalefactors of long and short blocks.
+   Explanation: - */
+const SFBITS_DATA sfbtable = {{0, 6, 11, 16, 21}, {0, 6, 12} };
+
+/*
+   Purpose:     Number of bits used for the scalefactors.
+   Explanation: - */
+const int16 slen[2][16] = {
+{0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4},
+{0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3}};
+
+/*
+   Purpose:     Number of scalefactor bands for MPEG-2 LSF and MPEG-2.5
+                bit streams.
+   Explanation: - */
+const uint8 nr_of_sfb_block[6][3][4] = {
+{{ 6,  5, 5, 5}, { 9,  9,  9, 9}, { 6,  9,  9, 9}},
+{{ 6,  5, 7, 3}, { 9,  9, 12, 6}, { 6,  9, 12, 6}},
+{{11, 10, 0, 0}, {18, 18,  0, 0}, {15, 18,  0, 0}},
+{{ 7,  7, 7, 0}, {12, 12, 12, 0}, { 6, 15, 12, 0}},
+{{ 6,  6, 6, 3}, {12,  9,  9, 6}, { 6, 12,  9, 6}},
+{{ 8,  8, 5, 0}, {15, 12,  9, 0}, { 6, 18,  9, 0}}};
+
+/*
+   Purpose:     Length of each Huffman table.
+   Explanation: - */
+const int16 huf_tree_len[] =
+{0, 4, 9, 9, 0, 16, 16, 36, 36, 36, 64, 64, 64, 256, 0, 256, 256, 256, 256, 256,
+ 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 16};
+
+/*
+   Purpose:     Number of extra bits for each Huffman table.
+   Explanation: - */
+const int16 linbits[] =
+{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 8, 10, 13, 4, 5,
+ 6, 7, 8, 9, 11, 13, 0, 0};
+
+
+/*
+  The following tables contain all the necessary information needed for
+  Huffman decoding of MPEG-1/MPEG-2 Layer III compliant stream.
+
+  Tables 'huff_symbolsxx' contain the x and y values and the length of the
+  corresponding Huffman codewords. The first 5 bits hold the length of the
+  Huffman codeword. Next 4 bits hold y-value and the remaining bits hold the
+  x-value. The length is actually the difference between the current and the
+  previous length.
+
+  Tables 'huff_cwordsxx' hold the Huffman codewords. Note these values are
+  sorted according to their length.
+
+  For more information see function 'decode_codeword()'.
+*/
+
+/* Table 1 */
+const int16 huff_symbols1[] = {1, 513, 33, 544};
+const int16 huff_cwords1[] = {1, 1, 1, 0};
+
+/* Table 2 */
+const int16 huff_symbols2[] = {1, 34, 512, 544, 578, 1024, 1056, 65, 1088};
+const int16 huff_cwords2[] = {1, 2, 3, 1, 1, 3, 2, 1, 0};
+
+/* Table 3 */
+const int16 huff_symbols3[] = {2, 32, 544, 513, 578, 1024, 1056, 65, 1088};
+const int16 huff_cwords3[] = {3, 2, 1, 1, 1, 3, 2, 1, 0};
+
+/* Table 5 */
+const int16 huff_symbols5[] = {1, 34, 512, 544, 67, 576, 1024, 1056, 1568, 97,
+                   608, 1088, 1536, 1600, 1121, 1632};
+const int16 huff_cwords5[] = {1, 2, 3, 1, 6, 4, 7, 5, 1, 5, 4, 7, 6, 1, 1, 0};
+
+/* Table 6 */
+const int16 huff_symbols6[] = {546, 1, 32, 512, 577, 1024, 1056, 65, 608, 1088,
+                   1568, 1121, 1536, 1600, 97, 1632};
+const int16 huff_cwords6[] = {2, 7, 3, 6, 3, 5, 4, 5, 2, 4, 3, 1, 3, 2, 1, 0};
+
+/* Table 7 */
+const int16 huff_symbols7[] =
+{1, 34, 512, 545, 1057, 65,576, 1024, 609, 640, 1088, 1536, 1568, 2048, 2080,
+ 97, 128, 672, 1120, 1152, 1600, 2112, 2560, 2592, 161, 1184, 1632, 1664, 1696,
+ 2144, 2176, 2624, 2209, 2656, 2688, 2720};
+const int16 huff_cwords7[] =
+{1, 2, 3, 3, 4, 10, 7, 11, 10, 5, 13, 12, 11, 7, 6, 19, 16, 3, 17, 8, 18, 9, 6,
+ 4, 10, 4, 15, 11, 2, 14, 3, 5, 1, 3, 2, 0};
+
+/* Table 8 */
+const int16 huff_symbols8[] =
+{2, 544, 33, 512, 577, 1056, 66, 1024, 1088, 2081, 97, 128, 608, 640, 672, 1120,
+ 1152, 1536, 1568, 1600, 2048, 2112, 2592, 161, 1184, 1632, 1664, 2144, 2560,
+ 2624, 2656, 1697, 2176, 2208, 2689, 2720};
+const int16 huff_cwords8[] =
+{3, 1, 4, 5, 2, 3, 6, 7, 5, 5, 18, 12, 16, 9, 3, 14, 7, 19, 17, 15, 13, 8, 4, 5,
+ 3, 13, 10, 11, 12, 4, 1, 4, 5, 1, 1, 0};
+
+/* Table 9 */
+const int16 huff_symbols9[] =
+{3, 32, 512, 544, 577, 1024, 1056, 65, 608, 1088, 1568, 97, 640, 1120, 1536,
+ 1600, 2080, 1153, 1632, 1664, 2048, 2112, 2144, 2592, 129, 672, 1184, 1696,
+ 2176, 2560, 2624, 2656, 161, 2208, 2688, 2720};
+const int16 huff_cwords9[] =
+{7, 5, 6, 4, 5, 7, 6, 9, 5, 8, 6, 14, 6, 8, 15, 9, 7, 8, 10, 5, 11, 9, 6, 4, 15,
+ 7, 5, 1, 4, 14, 6, 2, 7, 1, 6, 0};
+
+/* Table 10 */
+const int16 huff_symbols10[] =
+{1, 34, 512, 545, 66, 576, 1024, 1056, 609, 1088, 1536, 1568, 97, 640, 704, 736,
+ 1120, 1600, 2048, 2080, 3072, 3104, 3616, 129, 160, 192, 672, 1152, 1216, 1248,
+ 1632, 1728, 2112, 2560, 2592, 3136, 3584, 3648, 225, 1184, 1664, 1696, 1760,
+ 2144, 2176, 2208, 2240, 2272, 2624, 2656, 2752, 3168, 3200, 3232, 3680, 3712,
+ 2689, 2720, 2784, 3264, 3296, 3744, 3776, 3808};
+const int16 huff_cwords10[] =
+{1, 2, 3, 3, 10, 8, 11, 9, 12, 15, 14, 13, 23, 18, 12, 7, 21, 22, 20, 19, 14,
+ 13, 8, 35, 30, 12, 21, 32, 19, 6, 34, 18, 33, 31, 22, 10, 9, 7, 17, 40, 46, 23,
+ 7, 47, 27, 22, 9, 3, 41, 26, 5, 11, 16, 6, 8, 4, 21, 20, 3, 5, 1, 4, 2, 0};
+
+/* Table 11 */
+const int16 huff_symbols11[] =
+{2, 33, 512, 544, 577, 65, 1024, 1056, 609, 1088, 1568, 97, 704, 1120, 1536,
+ 1600, 3104, 3136, 3616, 129, 192, 640, 672, 736, 1152, 1216, 1248, 1664, 1728,
+ 2048, 2080, 2112, 2560, 2592, 3072, 3168, 3584, 3648, 161, 224, 1184, 1632,
+ 1760, 2144, 2176, 2240, 2624, 3200, 3680, 1697, 2208, 2272, 2656, 2688, 2752,
+ 3232, 3264, 3296, 3712, 3744, 3776, 3808, 2721, 2784};
+const int16 huff_cwords11[] =
+{3, 4, 5, 3, 4, 10, 11, 7, 10, 13, 11, 24, 11, 18, 25, 19, 12, 9, 4, 34, 21, 32,
+ 17, 10, 30, 20, 5, 27, 12, 35, 33, 31, 28, 26, 14, 13, 11, 6, 33, 15, 31, 59,
+ 5, 58, 30, 7, 32, 14, 6, 18, 16, 5, 19, 17, 8, 9, 4, 1, 6, 3, 2, 0, 15, 14};
+
+/* Table 12 */
+const int16 huff_symbols12[] =
+{35, 512, 544, 1, 576, 1056, 65, 608, 1024, 1088, 1568, 1121, 1536, 1600, 1632,
+ 2080, 97, 640, 672, 1152, 1216, 1664, 2048, 2112, 2144, 2592, 3104, 3136, 129,
+ 704, 736, 1184, 1248, 1696, 1728, 1760, 2176, 2208, 2240, 2560, 2624, 2656,
+ 2688, 2752, 3072, 3168, 3200, 3616, 3648, 161, 192, 224, 2272, 2720, 2784,
+ 3232, 3264, 3584, 3680, 3712, 3744, 3776, 3297, 3808};
+const int16 huff_cwords12[] =
+{6, 7,  5,  9,  6, 7, 16, 9, 17, 11, 10, 14, 17, 15, 12, 13, 33, 23, 16, 21, 10,
+ 18, 32, 22, 19, 17, 12, 11, 41, 26, 11, 30, 7,  28, 14, 5, 18, 16, 9, 40, 31,
+ 29, 17, 4, 27, 15, 10, 12, 8, 39, 38, 26, 5, 13, 2, 7, 4, 27, 12, 6, 3, 1, 1,
+ 0};
+
+/* Table 13 */
+const int16 huff_symbols13[] =
+{1, 514, 33, 544, 66, 576, 1024, 1056, 97, 608, 1088, 1536, 1568, 2080, 129,
+ 640, 672, 1120, 1600, 2048, 2592, 4128, 161, 192, 256, 704, 736, 768, 800,
+ 1152, 1184, 1280, 1632, 1664, 2112, 2144, 2560, 2624, 3072, 3104, 3616, 4096,
+ 4160, 4640, 225, 288, 832, 864, 1216, 1248, 1312, 1344, 1696, 1728, 1760, 1792,
+ 2176, 2208, 2304, 2656, 2688, 2720, 3136, 3168, 3584, 3648, 4192, 4224, 4608,
+ 4672, 4704, 5120, 5152, 5184, 5664, 5696, 321, 352, 896, 1376, 1408, 1824,
+ 1856, 1888, 1920, 2240, 2272, 2336, 2368, 2752, 2784, 2816, 2848, 2912, 3200,
+ 3232, 3264, 3296, 3328, 3680, 3712, 3744, 4256, 4288, 4736, 4768, 4800, 5216,
+ 5248, 5632, 5728, 6144, 6176, 6208, 6688, 385, 416, 928, 960, 992, 1440, 1952,
+ 2400, 2432, 2880, 3360, 3392, 3424, 3776, 3808, 3840, 3872, 4320, 4352, 4384,
+ 4416, 4864, 5280, 5312, 5376, 5760, 5792, 5824, 5856, 6240, 6272, 6336, 6656,
+ 6720, 7200, 7232, 7680, 7712, 449, 480, 1472, 1504, 1984, 2016, 2464, 2496,
+ 2944, 2976, 3456, 3488, 3904, 3936, 3968, 4448, 4480, 4832, 4896, 4928, 5344,
+ 5408, 5472, 5888, 5920, 5952, 6304, 6368, 6752, 6784, 6816, 7168, 7264, 7296,
+ 7328, 7744, 2529, 3008, 3040, 3520, 3552, 4000, 4512, 4960, 4992, 5024, 5440,
+ 5504, 5984, 6400, 6432, 6848, 6880, 6912, 6944, 6976, 7392, 7424, 7776, 7808,
+ 7840, 7904, 4545, 4576, 5088, 5536, 6016, 6048, 6080, 6464, 6496, 6528, 7008,
+ 7072, 7360, 7488, 7520, 7552, 7872, 7936, 7968, 4033, 4064, 5056, 5568, 6112,
+ 6560, 6592, 6624, 7040, 7104, 7136, 7616, 7648, 8000, 8032, 8160, 5601, 7456,
+ 7584, 8097, 8065, 8128};
+const int16 huff_cwords13[] =
+{1, 3, 5, 4, 14, 12, 15, 13, 21, 19, 23, 22, 20, 16, 34, 31, 26, 36, 37, 35, 27,
+ 20, 51, 46, 42, 44, 33, 31, 24, 59, 49, 29, 61, 56, 60, 57, 58, 50, 47, 45, 34,
+ 43, 30, 25, 71, 52, 32, 24, 77, 65, 40, 30, 79, 73, 64, 43, 97, 75, 54, 96, 76,
+ 70, 78, 74, 72, 56, 44, 55, 53, 41, 37, 35, 33, 31, 25, 23, 68, 52, 31, 40, 27,
+ 76, 56, 37, 26, 114, 91, 73, 55, 93, 84, 77, 58, 29, 115, 94, 90, 79, 69, 95,
+ 92, 85, 78, 72, 44, 59, 54, 57, 42, 53, 38, 34, 32, 28, 21, 67, 44, 35, 22, 14,
+ 33, 31, 41, 48, 79, 83, 71, 50, 91, 90, 86, 73, 87, 78, 61, 46, 66, 82, 72, 47,
+ 70, 60, 51, 36, 39, 49, 30, 45, 34, 23, 20, 16, 15, 43, 19, 42, 16, 25, 14, 53,
+ 23, 74, 49, 59, 38, 77, 65, 51, 54, 37, 81, 76, 57, 80, 58, 21, 55, 26, 34, 75,
+ 52, 64, 56, 50, 48, 39, 36, 35, 17, 24, 41, 17, 36, 15, 44, 30, 54, 37, 18, 55,
+ 22, 23, 48, 40, 49, 45, 31, 19, 12, 21, 16, 27, 25, 20, 11, 20, 16, 11, 26, 27,
+ 14, 9, 52, 28, 18, 15, 7, 53, 13, 10, 6, 29, 17, 12, 43, 42, 39, 38, 7, 17, 9,
+ 5, 10, 6, 3, 4, 2, 16, 8, 1, 22, 23, 1, 1, 1, 0};
+
+/* Table 15 */
+const int16 huff_symbols15[] =
+{3, 544, 33, 512, 65, 576, 1024, 1056, 1088, 609, 1120, 1536, 1568, 1600, 2080,
+ 97, 128, 640, 672, 1152, 1184, 1632, 1664, 2048, 2112, 2144, 2592, 2624, 3104,
+ 161, 704, 736, 768, 1216, 1248, 1280, 1696, 1728, 2176, 2208, 2560, 2656, 2688,
+ 2720, 3136, 3168, 3200, 3616, 3648, 4128, 4160, 4640, 193, 224, 256, 800, 832,
+ 1312, 1344, 1760, 1792, 1824, 2240, 2272, 2304, 2336, 2752, 2784, 2816, 2848,
+ 3072, 3232, 3264, 3296, 3328, 3584, 3680, 3712, 3744, 3776, 4096, 4192, 4224,
+ 4256, 4288, 4608, 4672, 4704, 4736, 4768, 5152, 5184, 5216, 5664, 5696, 5728,
+ 6208,  289, 320, 864, 896, 928, 1376, 1408, 1856, 1888, 1920, 2368, 2400, 2432,
+ 2880, 2912, 3360, 3392, 3424, 3808, 3840, 3872, 3904, 3936, 4320, 4352, 4384,
+ 4416, 4800, 4832, 4864, 5120, 5248, 5280, 5312, 5344, 5376, 5632, 5760, 5792,
+ 5824, 5856, 6176, 6240, 6272, 6304, 6688, 6720, 6752, 6784, 353, 384, 416, 960,
+ 992, 1440, 1472, 1504, 1952, 1984, 2016, 2464, 2496, 2528, 2944, 2976, 3008,
+ 3456, 3488, 3968, 4000, 4032, 4448, 4480, 4896, 4928, 4960, 4992, 5408, 5440,
+ 5472, 5504, 5888, 5920, 5952, 5984, 6144, 6336, 6368, 6400, 6432, 6464, 6496,
+ 6656, 6816, 6848, 6880, 6912, 7200, 7232, 7264, 7296, 7328, 7360, 7392, 7712,
+ 7744, 7776, 7808, 7840, 7872, 449, 3040, 3520, 3552, 4064, 4512, 4544, 4576,
+ 5024, 5056, 5088, 5536, 5600, 6016, 6048, 6080, 6528, 6560, 6944, 6976, 7008,
+ 7040, 7072, 7168, 7424, 7456, 7488, 7520, 7616, 7680, 7904, 7936, 7968, 8000,
+ 8032, 481, 5568, 6112, 6592, 6624, 7104, 7136, 7552, 7584, 7648, 8064, 8096,
+ 8128, 8160};
+const int16 huff_cwords15[] =
+{7, 5, 12, 13, 18, 16, 19, 17, 15, 27, 24, 29, 28, 25, 22, 53, 47, 46, 36, 41,
+ 34, 43, 39, 52, 42, 40, 37, 35, 32, 76, 61, 51, 42, 59, 48, 40, 63, 55, 67, 57,
+ 77, 66, 58, 52, 60, 56, 50, 53, 49, 43, 41, 34, 124, 108, 89, 70, 52, 64, 50,
+ 93, 76, 59, 95, 79, 72, 57, 91, 74, 62, 48, 125, 92, 78, 65, 55, 109, 94, 88,
+ 75, 66, 90, 77, 73, 63, 56, 71, 67, 60, 58, 49, 53, 51, 47, 42, 40, 37,  30,
+ 123, 108, 83, 65, 41, 78, 62, 93, 72, 54, 89, 69, 49, 79, 63, 87, 71, 51, 122,
+ 91, 73, 56, 42, 92, 77, 66, 47, 88, 76,  67,  109, 90, 82, 58, 57, 48, 86, 70,
+ 64, 52, 43, 68, 55, 50, 46, 44, 39, 38, 34, 119, 107, 81, 59, 36, 80, 56, 33,
+ 75, 50, 29, 66, 46, 27, 90, 62, 40, 73, 51, 64, 44, 21, 67, 48, 106, 71, 54,
+ 38, 72, 57, 41, 23, 70, 55, 42, 25, 118, 74, 65, 49, 39, 24, 16, 91, 63, 52,
+ 45, 31, 60, 58, 53, 47, 43, 32, 22, 37, 34, 30, 28, 20, 17, 122, 38, 70, 30,
+ 25, 53, 36, 20, 39, 23, 15, 27, 9, 29, 18, 11, 22, 13, 52, 28, 19, 14, 8, 123,
+ 37, 24, 17, 12, 2, 71, 26, 21, 16, 10, 6, 63, 62, 11, 14, 7, 9, 3, 15, 10, 1,
+ 8, 6, 2, 0};
+
+/* Table 16 */
+const int16 huff_symbols16[] =
+{1, 514, 33, 544, 66, 576, 1024, 1056, 609, 1088, 1568, 97, 640, 992, 1120,
+ 1536, 1600, 2080, 2592, 7712, 7744, 8160, 129, 160, 480, 672, 704, 736, 1152,
+ 1184, 1504, 1632, 1664, 2048, 2112, 2144, 2528, 2560, 2624, 2656, 3104, 3136,
+ 3616, 7680, 7776, 7808, 193, 224, 768, 800, 832, 1216, 1248, 1312, 1696, 1728,
+ 1760, 2016, 2176, 2208, 2688, 3040, 3072, 3168, 3552, 3584, 3648, 3680, 4064,
+ 4096, 4128, 4160, 4576, 4640, 4672, 5184, 5600, 7840, 7872, 7904, 257, 288,
+ 320, 864, 928, 1280, 1344, 1376, 1408, 1792, 1824, 2240, 2272, 2304, 2720,
+ 2752, 2816, 3200, 3232, 3264, 3296, 3712, 3744, 3776, 4192, 4224, 4256, 4608,
+ 4704, 4736, 5088, 5120, 5152, 5216, 5664, 5696, 5728, 6112, 6624, 7136, 7232,
+ 7648, 7936, 7968, 8000, 8032, 8064, 8096, 8128, 353, 384, 416, 896, 960, 1440,
+ 1472, 1856, 1888, 1920, 2336, 2368, 2400, 2784, 2848, 2880, 3328, 3360, 3392,
+ 3424, 3808, 3840, 4288, 4320, 4768, 4800, 5248, 5280, 5312, 5344, 5632, 5760,
+ 5792, 6144, 6176, 6208, 6240, 6272, 6688, 6720, 6752, 7264, 449, 1952, 1984,
+ 2432, 2464, 2496, 2912, 2944, 2976, 3456, 3488, 3872, 3904, 3936, 3968, 4352,
+ 4384, 4416, 4448, 4832, 4864, 4896, 4928, 4992, 5056, 5376, 5824, 6048, 6304,
+ 6336, 6368, 6400, 6784, 6816, 7168, 7200, 7360, 3009, 3520, 4480, 4512, 4544,
+ 4960, 5024, 5408, 5440, 5472, 5568, 5856, 5888, 5920, 5952, 5984, 6016, 6080,
+ 6464, 6496, 6528, 6560, 6656, 6848, 6880, 6912, 7296, 7328, 7392, 7424, 7616,
+ 4001, 4032, 5504, 5536, 6432, 6976, 7008, 7040, 7104, 7456, 7520, 7584, 6593,
+ 6944, 7488, 7073, 7552};
+const int16 huff_cwords16[] =
+{1, 3, 5, 4, 14, 12, 15, 13, 20, 23, 21, 44, 35, 9, 38, 45, 39, 36, 30, 10, 7,
+ 3, 74, 63, 17, 62, 53, 47, 67, 58, 16, 69, 64, 75, 68, 65, 9, 66, 59, 56, 54,
+ 52, 48, 12, 11, 10, 110, 93, 83, 75, 68, 103, 90, 72, 114, 99, 87, 26, 115,
+ 101, 102, 16, 111, 100, 10, 98, 91, 88, 8, 85, 84, 81, 7, 76, 73, 67, 4, 17,
+ 11, 9, 172, 149, 138, 119, 107, 161, 127, 117, 110, 158, 140, 179, 164, 155,
+ 185, 173, 142, 184, 178, 160, 133, 165, 157, 148, 159, 156, 143, 154, 141, 131,
+ 11, 139, 129, 125, 120, 118, 115, 6, 4, 2, 102, 0, 13, 12, 10, 7, 5, 3, 1, 242,
+ 225, 195, 201, 207, 209, 206, 252, 212, 199, 264, 246, 226, 265, 253, 232, 257,
+ 244, 228, 217, 261, 248, 260, 249, 256, 245, 247, 233, 229, 219, 243, 227, 223,
+ 202, 224, 222, 218, 216, 211, 210, 208, 187, 376, 387, 365, 395, 382, 362, 400,
+ 388, 378, 385, 366, 407, 397, 372, 380, 427, 401, 392, 383, 426, 406, 394, 384,
+ 359, 352, 393, 396, 223, 389, 386, 381, 364, 370, 379, 377, 369, 358, 445, 715,
+ 727, 713, 708, 735, 710, 743, 737, 720, 439, 746, 742, 736, 721, 712, 706, 436,
+ 443, 707, 440, 437, 747, 734, 723, 714, 726, 722, 711, 709, 434, 889, 884, 885,
+ 882, 888, 883, 877, 876, 865, 866, 871, 870, 1728, 1735, 1734, 3459, 3458};
+
+/* Table 24 */
+const int16 huff_symbols24[] =
+{4, 32, 512, 544, 8160, 577, 1056, 65, 608, 1024, 1088, 1568, 97, 640, 1120,
+ 1152, 1504, 1536, 1600, 1632, 2016, 2080, 2112, 2528, 2592, 3040, 3552, 7712,
+ 7744, 7776, 7808, 7840, 7872, 7904, 7936, 7968, 8000, 129, 672, 704, 992, 1184,
+ 1216, 1664, 1696, 1728, 2048, 2144, 2176, 2208, 2240, 2624, 2656, 2688, 2720,
+ 3104, 3136, 3168, 3200, 3616, 3648, 3680, 4064, 4576, 5088, 5600, 6112, 6624,
+ 7136, 7648, 7680, 8032, 8064, 8096, 8128, 161, 192, 480, 736, 768, 800, 1248,
+ 1280, 1312, 1344, 1760, 1792, 1824, 1856, 2272, 2304, 2336, 2560, 2752, 2784,
+ 2816, 2848, 3072, 3232, 3264, 3296, 3328, 3712, 3744, 3776, 3808, 4128, 4160,
+ 4192, 4224, 4256, 4288, 4320, 4352, 4640, 4672, 4704, 4736, 4768, 4800, 5152,
+ 5184, 5216, 5248, 5696, 5728, 5760, 225, 256, 832, 864, 896, 928, 960, 1376,
+ 1408, 1440, 1888, 1920, 1952, 1984, 2368, 2400, 2432, 2464, 2880, 2912, 2944,
+ 2976, 3008, 3360, 3392, 3424, 3456, 3488, 3584, 3840, 3872, 3904, 3936, 3968,
+ 4096, 4384, 4416, 4448, 4480, 4608, 4832, 4864, 4896, 4928, 4960, 5280, 5312,
+ 5344, 5376, 5408, 5440, 5664, 5792, 5824, 5856, 5888, 5920, 5952, 6176, 6208,
+ 6240, 6272, 6304, 6336, 6368, 6400, 6432, 6688, 6720, 6752, 6784, 6816, 6848,
+ 6880, 7200, 7232, 7264, 7296, 7328, 7360, 289, 320, 352, 384, 416,  1472, 2496,
+ 3520, 4000, 4032, 4512, 4544, 4992, 5024, 5056, 5120, 5472, 5504, 5536, 5568,
+ 5632, 5984, 6016, 6048, 6080, 6144, 6464, 6496, 6528, 6560, 6592, 6656, 6912,
+ 6944, 6976, 7008, 7040, 7072, 7104, 7392, 7424, 7456, 7488, 7520, 7552, 7584,
+ 7616, 449, 7168};
+const int16 huff_cwords24[] =
+{15, 13, 14, 12, 3, 21, 22, 46, 38, 47, 41, 39, 80, 71, 74, 68, 18, 81, 75, 70,
+ 16, 72, 69, 14, 66, 12, 10, 20, 19, 17, 15, 13, 11, 9, 7, 6, 4, 146, 130, 122,
+ 42, 128, 120, 134, 125, 116, 147, 135, 127, 118, 112, 129, 126, 119, 114, 123,
+ 121, 117, 113, 115, 111, 109, 17, 16, 11, 10, 6, 4, 2, 0, 43, 7, 5, 3, 1, 262,
+ 248, 88, 216, 209, 198, 221, 207, 194, 182, 220, 204, 190, 178, 210, 200, 188,
+ 263, 214, 202, 192, 180, 249, 215, 206, 195, 185, 211, 203, 196, 187, 212, 208,
+ 205, 201, 193, 186, 177, 169, 199, 197, 191, 189, 181, 174, 184, 183, 179, 175,
+ 171, 168, 164, 434, 426, 327, 345, 319, 297, 279, 340, 315, 295, 325, 311, 293,
+ 271, 352, 323, 306, 285, 341, 317, 301, 281, 262, 347, 330, 308, 291, 272, 435,
+ 353, 332, 313, 298, 283, 427, 320, 303, 286, 268, 335, 333, 321, 305, 289, 275,
+ 344, 331, 314, 304, 290, 277, 346, 318, 309, 299, 287, 276, 263, 322, 316, 312,
+ 307, 302, 292, 284, 269, 261, 300, 296, 294, 288, 282, 273, 266, 280, 278, 274,
+ 267, 264, 259, 669, 653, 649, 621, 517, 541, 540, 520, 531, 381, 514, 377, 521,
+ 379, 371, 668, 530, 383, 373, 366, 652, 513, 375, 368, 362, 648, 512, 376, 370,
+ 364, 359, 620, 515, 380, 374, 369, 365, 361, 357, 382, 378, 372, 367, 363, 360,
+ 358, 356, 1032, 1033};
+
+/* Table 32 */
+const int16 huff_symbols32[] =
+{1, 35, 64,  128, 256, 97, 192, 288, 320, 384, 161, 224, 352, 416, 448, 480};
+const int16 huff_cwords32[] = {1, 5, 4, 6, 7, 5, 4, 3, 6, 7, 5, 4, 0, 2, 3, 1};
+
+/*
+   Purpose:     Pre-emphasis table.
+   Explanation: - */
+const uint8 pretab[22] = {0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0};
+
+/*
+   Purpose:     Scalefactor band boundaries.
+   Explanation: - */
+const SFBAND_DATA sfBandIndex[9] = {{
+  /* MPEG-2 LSF */
+{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576},
+{0,4,8,12,18,24,32,42,56,74,100,132,174,192}}, /* 22050 Hz */
+{
+{0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,330,394,464,540,576},
+{0,4,8,12,18,26,36,48,62,80,104,136,180,192}}, /* 24000 Hz */
+{
+{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576},
+{0,4,8,12,18,26,36,48,62,80,104,134,174,192}}, /* 16000 Hz */
+{
+  /* MPEG-1 */
+{0,4,8,12,16,20,24,30,36,44,52,62,74,90,110,134,162,196,238,288,342,418,576},
+{0,4,8,12,16,22,30,40,52,66,84,106,136,192}}, /* 44100 Hz */
+{
+{0,4,8,12,16,20,24,30,36,42,50,60,72,88,106,128,156,190,230,276,330,384,576},
+  {0,4,8,12,16,22,28,38,50,64,80,100,126,192}}, /* 48000 Hz */
+{
+{0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576},
+  {0,4,8,12,16,22,30,42,58,78,104,138,180,192}}, /* 32000 Hz */
+{
+  /* MPEG-2.5 */
+{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576},
+{0,4,8,12,18,26,36,48,62,80,104,134,174,192}}, /* 11025 Hz */
+{
+{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576},
+  {0,4,8,12,18,26,36,48,62,80,104,134,174,192}}, /* 12000 Hz */
+{
+{0,12,24,36,48,60,72,88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576},
+  {0,8,16,24,36,52,72,96,124,160,162,164,166,192}}}; /* 8000 Hz */
+
+/* Frame length of each sampling frequency. */
+const int32 framelength[6] = {26, 24, 36, 52, 48, 72};
+
+const int32 s_freq[3][4] = { {22050, 24000, 16000, 0},  {44100L, 48000L, 32000, 0},
+               {11025, 12000, 8000, 0}};
+
+const int16 bitrate[2][15] = {
+/* Bit rates for MPEG-2 LSF. */
+{  0,   8,  16,  24,  32,  40,  48,  56,  64,  80,  96, 112, 128, 144, 160},
+/* Bit rates for MPEG-1. */
+{  0,  32,  40,  48,  56,  64,  80,  96, 112, 128, 160, 192, 224, 256, 320}
+};
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/MP3Gain/inc/mp3tool.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  mp3tool.h - Interface to MP3 core structures.
+ 
+  Author(s): Juha Ojanpera
+  Copyright (c) 2004 by Nokia Research Center, Audio-Visual Systems.
+  *************************************************************************/
+
+#ifndef    MP3TOOL_H_
+#define MP3TOOL_H_
+
+/*-- Project Headers. --*/
+#include "nok_bits.h"
+#include "mpaud.h"
+
+/*
+ * Low level implementations for the mp3 engine. 
+ */
+
+/*-- Implementations defined in module 'layer3.cpp'. --*/
+BOOL III_get_side_info(CMPAudDec *mp, TBitStream *bs);
+void III_get_scale_factors(CMP_Stream *mp, int16 gr, int16 ch);
+void L3WriteSideInfo(TBitStream *bs, CIII_Side_Info *sideInfo, TMPEG_Header *header);
+
+/*-- Implementations defined in module 'l3huffman.cpp'. */ 
+void InitL3Huffman(CHuffman *huf);
+int16 III_huffman_decode(CMPAudDec *mp, int16 gr, int16 ch, int32 part2);
+
+/*-- Implementations defined in module 'l3sfb.cpp'. */ 
+void III_SfbDataInit(CIII_SfbData *sfbData, TMPEG_Header *header);
+
+#endif    /*-- MP3TOOL_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/MP3Gain/inc/mpaud.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  mpaud.h - Interface for the mp3 decoder core.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef MP_AUD_H_
+#define MP_AUD_H_
+
+/**************************************************************************
+  External Objects Needed
+  *************************************************************************/
+
+/*-- Project Headers --*/
+#include "nok_bits.h"
+#include "defines.h"
+#include "auddef.h"
+#include "mpif.h"
+#include "Mp3API.h"
+
+/**************************************************************************
+  External Objects Provided
+  *************************************************************************/
+
+/**************************************************************************
+                Common structure definitions for all layers
+  *************************************************************************/
+
+/*
+   Purpose:     Parent Structure for mp1, mp2, and mp3 frames.
+   Explanation: - */
+class CMPAudDec;
+class TMpTransportHandle;
+
+int16
+L3BitReservoir(CMPAudDec *mp);
+
+uint8
+GetLayer3Version(TMpTransportHandle *tHandle);
+
+#endif /*-- MP_AUD_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/MP3Gain/inc/mpheader.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  mpheader.h - MPEG-1 and MPEG-2 bit field (header) parsing functions.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef MPHEADER_H_
+#define MPHEADER_H_
+
+/*-- Project Headers. --*/
+#include "mpaud.h"
+#include "mp3tables.h"
+#include "defines.h"
+
+/* Checks whether window switching is used in layer III. */
+inline BOOL win_switch(TGranule_Info *gr_info)
+{ return ((BOOL)(gr_info->flags & WINDOW_SWITCHING_FLAG)); }
+
+/* Checks whether short blocks are used in layer III. */
+inline BOOL short_block(TGranule_Info *gr_info)
+{ return ((gr_info->flags & 3) == 2); }
+
+/* Checks whether mixed blocks are present in layer III. */
+inline BOOL mixed_block(TGranule_Info *gr_info)
+{ return ((BOOL)(gr_info->flags & MIXED_BLOCK_FLAG)); }
+
+/* Checks whether 'scalefac_scale' bit is set in layer III. */
+inline BOOL scalefac_scale(TGranule_Info *gr_info)
+{ return ((BOOL)((gr_info->flags & SCALEFAC_SCALE) ? 1 : 0)); }
+
+/* Returns the status of 'pre_flag' bit of layer III. */
+inline BOOL pre_flag(TGranule_Info *gr_info)
+{ return ((BOOL)((gr_info->flags & PRE_FLAG) ? 1 : 0)); }
+
+/*-- Common header parsing functions. --*/
+
+/* MPEG-1 or MPEG-2 */
+inline int16 version(TMPEG_Header *mpheader)
+{return ((BOOL)((mpheader->header >> 19) & 1));}
+
+/* Checks whether the current stream is of type MPEG-2.5. */
+inline BOOL mp25version(TMPEG_Header *mpheader)
+{ return ((BOOL)((mpheader->header & 0x100000) ? FALSE : TRUE)); }
+
+/* Layer (1, 2 or 3) */
+inline int16 layer_number(TMPEG_Header *mpheader)
+{ return (int16)((4 - (mpheader->header >> 17) & 3)); }
+
+/* Checks if error protection is used in the bitstream. */
+inline BOOL error_protection(TMPEG_Header *mpheader)
+{ return (!((mpheader->header >> 16) & 1)); }
+
+/* Sampling frequency index */
+inline int16 sfreq(TMPEG_Header *mpheader)
+{ return (int16)((mpheader->header >> 10) & 3);}
+
+/* Checks whether padding bit is set. */
+inline BOOL padding(TMPEG_Header *mpheader)
+{ return (BOOL)((mpheader->header >> 9) & 1); }
+  
+/* Checks if private bit is set. */
+inline BOOL private_bit(TMPEG_Header *mpheader)
+{ return (BOOL)((mpheader->header >> 8) & 1); }
+  
+/* Mono, stereo, joint or dual */
+inline int16 mode(TMPEG_Header *mpheader)
+{ return (int16)((mpheader->header >> 6) & 3); }
+
+/* Value of mode extension field */
+inline int16 mode_extension(TMPEG_Header *mpheader)
+{ return (int16)((mpheader->header >> 4) & 3); }
+
+/* Checks whether copyright bit is set. */
+inline BOOL copyright(TMPEG_Header *mpheader)
+{ return (BOOL)((mpheader->header >> 3) & 1); }
+  
+/* Checks whether original bit. */
+inline BOOL original(TMPEG_Header *mpheader)
+{ return (BOOL)((mpheader->header >> 2) & 1); }
+
+/* Value of bitrate field */
+inline int16 bit_rate_idx(TMPEG_Header *mpheader) 
+{ return ((int16)((mpheader->header >> 12) & 0xF)); }
+
+/* Bitrate */
+inline int16 bit_rate(TMPEG_Header *mpheader)
+{ return (bitrate[version(mpheader)][(int16)((mpheader->header >> 12) & 0xF)]); }
+
+/* Number of channels; 1 for mono, 2 for stereo */
+inline int16 channels(TMPEG_Header *mpheader)
+{ return ((int16)((mode(mpheader) == MPG_MD_MONO) ? (int16)1 : (int16)2));}
+
+inline const int16 *GetBitRateTable(TMPEG_Header *mpheader)
+{ return (&bitrate[version(mpheader)][0]); }
+
+/* Sampling frequency */
+inline int32 frequency(TMPEG_Header *mpheader)
+{ return (s_freq[(mpheader->header & 0x100000) ? version(mpheader):2][sfreq(mpheader)]); }
+
+/* Frame length in milliseconds */
+inline int32 GetFrameTime(TMPEG_Header *mpheader)
+{ return (framelength[sfreq(mpheader) + (mp25version(mpheader)) * 3]); }
+
+#endif /* MPHEADER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/MP3Gain/inc/mpif.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  mpif.h - Interchange format interface for MPEG Layer I/II/III.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef MP_AIF_H_
+#define MP_AIF_H_
+
+/*-- Project Headers. --*/
+#include "defines.h"
+#include "auddef.h"
+#include "mstream.h"
+#include "MP3API.h"
+#include "AACAPI.h"
+
+
+/*
+   Purpose:     Parent structure for error checking.
+   Explanation: The number of bits that are protected varies between different 
+                versions (MPEG-1, MPEG-2). */
+/*
+typedef struct CRC_Check
+{
+  uint8 bufLen;                       // Length of 'crc_payload' 
+  int16 crc;                          // CRC error-check word.   
+
+} CRC_Check;
+*/
+
+
+
+/*
+ * Implemented interfaces.
+ */
+class TMpTransportHandle;
+
+void
+mpInitTransport(TMpTransportHandle *tHandle);
+
+SEEK_STATUS
+mpSyncTransport(TMpTransportHandle *tHandle, uint8 *syncBuf, 
+                uint32 syncBufLen, uint32 *readBits);
+
+int16
+GetSideInfoSlots(TMpTransportHandle *tHandle);
+
+int16
+GetSideInfoSlots(TMPEG_Header *header);
+
+int16
+MP_SeekSync(TMpTransportHandle *tHandle, uint8 *syncBuf, 
+            uint32 syncBufLen, int16 *readBytes, 
+            int16 *frameBytes, int16 *headerBytes,
+            uint8 initMode);
+
+int16
+MP_FreeMode(TMpTransportHandle *tHandle, uint8 *syncBuf, 
+            uint32 syncBufLen, int16 *readBytes, 
+            int16 *frameBytes, int16 *headerBytes);
+
+int16
+MP_EstimateBitrate(TMpTransportHandle *tHandle, uint8 isVbr);
+
+uint32
+MP_FileLengthInMs(TMpTransportHandle *tHandle, int32 fileSize);
+
+int32
+MP_GetSeekOffset(TMpTransportHandle *tHandle, int32 seekPos);
+
+int32
+MP_GetFrameTime(TMpTransportHandle *tHandle);
+
+
+
+#endif /*-- MP_AIF_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/MP3Gain/inc/param.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef DECPARAM_H_
+#define DECPARAM_H_
+
+/*-- Project Headers --*/
+#include "defines.h"
+
+/*
+   Purpose:     The # of filter branches of the polyphase filterbank
+                to be discarded. By default 2 lowest and highest branches
+        will be discarded.
+   Explanation: - */
+#define WINDOW_PRUNING_START_IDX 2
+
+/*
+   Purpose:     Parameters that control the decoding complexity.
+   Explanation: - */
+typedef struct Out_ComplexityStr
+{
+  BOOL no_antialias;    /* If TRUE, no alias-reduction is performed. */
+  int16 subband_pairs;  /* # of subband pairs for alias-reduction.   */
+  int16 imdct_subbands; /* # of IMDCT subbands.                      */
+
+} Out_Complexity;
+
+/*
+   Purpose:     Parameters that control the output stream.
+   Explanation: - */
+typedef struct Out_ParamStr
+{
+  int32 sampling_frequency; /* Output sampling frequency.           */
+  int16 num_out_channels;   /* # of output channels.                */
+  int16 decim_factor;       /* Decimation factor.                   */
+  int16 num_samples;        /* # of output samples per subband.     */
+  int16 num_out_samples;    /* Total # of output samples per frame. */
+
+  /*
+   * Specifies how many window coefficients are discarded from the synthesis
+   * window. In units of 'SBLIMIT' samples. The start index can vary
+   * between 0 and 'NUM_SUBWIN', but if you don't want to reduce the overall
+   * audio quality, the default value 2 (or 0) should be used.
+   */
+  int16 window_pruning_idx;
+  int16 num_subwindows;
+  int16 window_offset;
+
+} Out_Param;
+
+/*
+   Purpose:     Mapping of above structures into one common structure.
+   Explanation: - */
+typedef struct Out_InfoStr
+{
+  Out_Param *out_param;
+  Out_Complexity *out_complex;
+
+} Out_Info;
+
+#endif /* DECPARAM_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/MP3Gain/src/l3huffman.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,378 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  l3huffman.cpp - Huffman decoding subroutines for layer III.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/**************************************************************************
+  External Objects Needed
+  *************************************************************************/
+
+/*-- Project Headers --*/
+#include "mpaud.h"
+#include "mp3tables.h"
+
+/**************************************************************************
+  Internal Objects
+  *************************************************************************/
+
+/*
+   Purpose:     Table to hold the Huffman symbol codebooks.
+   Explanation: - 
+const int16 *huff_symbols_tbl[] = {
+NULL, huff_symbols1, huff_symbols2, huff_symbols3, NULL, huff_symbols5,
+huff_symbols6, huff_symbols7, huff_symbols8, huff_symbols9, huff_symbols10,
+huff_symbols11, huff_symbols12, huff_symbols13, NULL, huff_symbols15,
+huff_symbols16, huff_symbols24, huff_symbols32};
+
+
+   Purpose:     Table to hold the Huffman codeword codebooks.
+   Explanation: - 
+   
+const int16 *huff_cwords_tbl[] = {
+NULL, huff_cwords1, huff_cwords2, huff_cwords3, NULL, huff_cwords5,
+huff_cwords6, huff_cwords7, huff_cwords8, huff_cwords9, huff_cwords10,
+huff_cwords11, huff_cwords12, huff_cwords13, NULL, huff_cwords15, huff_cwords16,
+huff_cwords24, huff_cwords32};
+*/
+
+/**************************************************************************
+  Title        : InitL3Huffman
+
+  Purpose      : Allocates resources for layer III Huffman decoding.
+
+  Usage        : InitL3Huffman(huf)
+
+  Output       : huf - Huffman tables
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+void
+InitL3Huffman(CHuffman *huf)
+{
+  int16 i, j;
+
+
+  /*
+   Purpose:     Table to hold the Huffman symbol codebooks.
+   Explanation: - */
+const int16 *huff_symbols_tbl[] = {
+NULL, huff_symbols1, huff_symbols2, huff_symbols3, NULL, huff_symbols5,
+huff_symbols6, huff_symbols7, huff_symbols8, huff_symbols9, huff_symbols10,
+huff_symbols11, huff_symbols12, huff_symbols13, NULL, huff_symbols15,
+huff_symbols16, huff_symbols24, huff_symbols32};
+
+/*
+   Purpose:     Table to hold the Huffman codeword codebooks.
+   Explanation: - */
+const int16 *huff_cwords_tbl[] = {
+NULL, huff_cwords1, huff_cwords2, huff_cwords3, NULL, huff_cwords5,
+huff_cwords6, huff_cwords7, huff_cwords8, huff_cwords9, huff_cwords10,
+huff_cwords11, huff_cwords12, huff_cwords13, NULL, huff_cwords15, huff_cwords16,
+huff_cwords24, huff_cwords32};
+
+
+  for(i = 0; i < 33; i++)
+  {
+    huf[i].tree_len = huf_tree_len[i];
+    huf[i].linbits = linbits[i];
+  }
+
+  for(i = 0; i < 16; i++)
+  {
+    huf[i].codeword = huff_cwords_tbl[i];
+    huf[i].packed_symbols = huff_symbols_tbl[i];
+  }
+
+  j = i;
+  while(j < 24)
+  {
+    huf[j].codeword = huff_cwords_tbl[i];
+    huf[j].packed_symbols = huff_symbols_tbl[i];
+    j++;
+  }
+
+  i++;
+  while(j < 32)
+  {
+    huf[j].codeword = huff_cwords_tbl[i];
+    huf[j].packed_symbols = huff_symbols_tbl[i];
+    j++;
+  }
+
+  i++;
+  huf[j].codeword = huff_cwords_tbl[i];
+  huf[j].packed_symbols = huff_symbols_tbl[i];
+}
+
+
+/**************************************************************************
+  Title        : L3decode_codeword
+
+  Purpose      : Decodes one Huffman codeword from the bitstream and returns
+                 the corresponding symbol.
+
+  Usage        : L3decode_codeword(br, h)
+
+  Input        : br - bitstream parameters
+                 h  - Huffman table to be utilized
+
+  Explanation  : This decoding routine works only if the codewords are
+                 sorted according to their length, i.e, the codeword that has
+                 the minimum length appears first in the Huffman table, the
+                 length of the second codeword in the table is either greater
+                 or equal than the first one and so on.
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+INLINE int16
+L3decode_codeword(TBitStream *br, CHuffman *h)
+{
+  const int16 *h_len = h->packed_symbols;
+  const int16 *h_codeword = h->codeword;
+  uint16 clen, items;
+  uint16 shift, N = 19; /* N = 19 maximum codeword length */
+  uint32 cand_codeword;
+  uint32 codeword;
+
+  /* Read the maximum codeword. */
+  cand_codeword = BsLookAhead(br, N);
+
+  /*
+   * Length of the codeword that has the
+   * highest probability.
+   */
+  shift = N - (*h_len & 31);
+
+  /* Candidate codeword for the first codebook entry. */
+  codeword = cand_codeword >> shift;
+
+  /*
+   * Sequentially goes through the whole Huffman table
+   * until a match has been found.
+   */
+  items = 1;
+  while(items < h->tree_len && codeword != (uint16)*h_codeword)
+  {
+    h_len++;
+    h_codeword++;
+    items++;
+
+    /* How many bits the codeword need to be updated. */
+    clen = *h_len & 31;
+    if(clen)
+    {
+      shift -= clen;
+
+      /* New candidate codeword. */
+      codeword = cand_codeword >> shift;
+    }
+  }
+
+  /* # of bits actually read. */
+  BsSkipNBits(br, N - shift);
+
+  /* Decoded Huffman symbol. */
+  return (*h_len >> 5);
+}
+
+/**************************************************************************
+  Layer III subroutines for decoding spectral samples.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+int16
+III_huffman_decode(CMP_Stream *mp, int16 gr, int16 ch, int32 part2)
+{
+  int16 i, x, region1Start, region2Start, table_num, limit;
+  int16 *quant, count1Len;
+  TGranule_Info *gr_info;
+
+  /* Quantized spectral samples. */
+  quant = mp->frame->ch_quant[ch];
+
+  /* Granule info for this frame. */
+  gr_info = mp->side_info->ch_info[ch]->gr_info[gr];
+
+  /* Find region boundaries. */
+  region1Start = mp->side_info->sfbData->sfbLong[gr_info->region0_count + 1];
+  region2Start = mp->side_info->sfbData->sfbLong[gr_info->region0_count +
+                            gr_info->region1_count + 2];
+
+  /*
+   * How many samples actually need to be Huffman decoded.
+   */
+  limit = mp->side_info->sfbData->bandLimit;
+  if(gr_info->big_values > limit)
+    gr_info->big_values = limit;
+
+  /* Read bigvalues area. */
+  int16 section1 = MIN(gr_info->big_values, region1Start);
+  if(section1 > 0)
+  {
+    pairtable(mp, section1, gr_info->table_select[0], quant);
+    quant += section1;
+  }
+
+  int16 section2 = MIN(gr_info->big_values, region2Start) - region1Start;
+  if(section2 > 0)
+  {
+    pairtable(mp, section2, gr_info->table_select[1], quant);
+    quant += section2;
+  }
+
+  int16 section3 = gr_info->big_values - region2Start;
+  if(section3 > 0)
+  {
+    pairtable(mp, section3, gr_info->table_select[2], quant);
+    quant += section3;
+  }
+
+  count1Len = 0;
+  i = gr_info->big_values;
+  part2 += gr_info->part2_3_length;
+
+  /* Check whether the samples between -1,...,1 need to be Huffman decoded. */
+  if(i < limit)
+  {
+    /* Read count1 area. */
+    table_num = 32 + ((gr_info->flags & COUNT_1_TABLE_SELECT) ? 1 : 0);
+
+    x = quadtable(mp, i, part2, table_num, quant, limit);
+    count1Len = x - i;
+    quant += count1Len;
+    count1Len >>= 2;
+    i = x;
+  }
+
+  if(BsGetBitsRead(mp->br) > (uint32)part2)
+  {
+    count1Len--;
+    quant -= 4; i -= 4;
+    BsRewindNBits(mp->br, BsGetBitsRead(mp->br) - part2);
+  }
+
+  /* Dismiss stuffing Bits */
+  if(BsGetBitsRead(mp->br) < (uint32)part2)
+    BsSkipNBits(mp->br, part2 - BsGetBitsRead(mp->br));
+
+  gr_info->zero_part_start = (i < limit) ? i : limit;
+
+  return (count1Len);
+}
+
+void
+pairtable(CMP_Stream *mp, int16 section_length, int16 table_num, int16 *quant)
+{
+  register CHuffman *h = &mp->huffman[table_num];
+
+  if(h->tree_len == 0)
+      Mem::Fill(quant, section_length << 1 /** sizeof(int16)*/, 0);
+  else
+  {
+    if(h->linbits)
+    {
+      register int16 *q = quant;
+
+      for(int16 i = 0; i < section_length; i += 2, q += 2)
+      {
+        uint32 codeword = L3decode_codeword(mp->br, h);
+
+        /* Unpack coefficients. */
+        *q = codeword >> 4;
+        q[1] = codeword & 15;
+
+        /* Read extra bits (if needed) and sign bits (if needed). */
+        if(*q == 15)
+          *q += BsGetBits(mp->br, h->linbits);
+        if(*q)
+          *q = (BsGetBits(mp->br, 1)) ? -*q : *q;
+
+        if(q[1] == 15)
+          q[1] += BsGetBits(mp->br, h->linbits);
+        if(q[1])
+          q[1] = (BsGetBits(mp->br, 1)) ? -q[1] : q[1];
+      }
+    }
+    else /* no linbits */
+    {
+      register int16 *q = quant;
+
+      for(int16 i = 0; i < section_length; i += 2, q += 2)
+      {
+        uint32 codeword = L3decode_codeword(mp->br, h);
+
+        /* Unpack coefficients. */
+        *q = codeword >> 4;
+        q[1] = codeword & 15;
+
+        /* Read extra bits (not needed) and sign bits (if needed). */
+        if(*q)
+          *q = (BsGetBits(mp->br, 1)) ? -*q : *q;
+
+        if(q[1])
+          q[1] = (BsGetBits(mp->br, 1)) ? -q[1] : q[1];
+      }
+    }
+  }
+}
+
+int16
+quadtable(CMP_Stream *mp, int16 start, int16 part2, int16 table_num, int16 *quant,
+          int16 max_sfb_bins)
+{
+  int16 i;
+  register int16 *q = quant;
+
+  for(i = start; (BsGetBitsRead(mp->br) < (uint32)part2 && i < max_sfb_bins);
+      i += 4, q += 4)
+  {
+    uint32 codeword;
+    uint16 mask = 8, sbits = 0;
+
+    if(table_num == 33)
+      codeword = 15 - BsGetBits(mp->br, 4);
+    else
+      codeword = L3decode_codeword(mp->br, &mp->huffman[table_num]);
+
+    /* Unpack coefficients. */
+    *q = (codeword >> 3) & 1;
+    q[1] = (codeword >> 2) & 1;
+    q[2] = (codeword >> 1) & 1;
+    q[3] = codeword & 1;
+
+    /* Sign bits. */
+    codeword = BsLookAhead(mp->br, 4);
+    if(*q)   { sbits++;   *q = (codeword & mask) ?   -*q : *q;   mask >>= 1; }  
+    if(q[1]) { sbits++; q[1] = (codeword & mask) ? -q[1] : q[1]; mask >>= 1; }
+    if(q[2]) { sbits++; q[2] = (codeword & mask) ? -q[2] : q[2]; mask >>= 1; }
+    if(q[3]) { sbits++; q[3] = (codeword & mask) ? -q[3] : q[3]; mask >>= 1; }
+    if(sbits) BsSkipBits(mp->br, sbits);
+  }
+
+  return (i);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/MP3Gain/src/l3sfb.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  l3sfb.cpp - Scalefactor band (sfb) implementations for layer III.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/*-- Project Headers. --*/
+#include "mp3tables.h"
+#include "mpaud.h"
+#include "mpheader.h"
+
+/**************************************************************************
+  External Objects Needed
+  *************************************************************************/
+
+/**************************************************************************
+  Internal Objects
+  *************************************************************************/
+
+static const int16 *III_sfbOffsetLong(TMPEG_Header *header);
+
+static const int16 *III_sfbOffsetShort(TMPEG_Header *header);
+
+static const int16 *III_sfbWidthTblShort(int16 *sfb_offset, int16 *sfb_width);
+
+/**************************************************************************
+  Title        : III_SfbDataInit
+
+  Purpose      : Initializes the sfb parameters.
+
+  Usage        : III_SfbDataInit(sfbData, header)
+
+  Input        : sfbData - sfb parameters
+                 header  - mp3 header parameters
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+void
+III_SfbDataInit(CIII_SfbData *sfbData, TMPEG_Header *header)
+{
+  COPY_MEMORY(sfbData->sfbOffsetLong, III_sfbOffsetLong(header),
+              (MAX_LONG_SFB_BANDS + 1) * sizeof(int16));
+
+  sfbData->sfbLong = sfbData->sfbOffsetLong;
+
+  COPY_MEMORY(sfbData->sfbOffsetShort, III_sfbOffsetShort(header),
+              (MAX_SHORT_SFB_BANDS + 1) * sizeof(int16));
+
+  sfbData->sfbShort = sfbData->sfbOffsetShort;
+
+  COPY_MEMORY(sfbData->sfbWidthShort, 
+              III_sfbWidthTblShort(sfbData->sfbShort, sfbData->sfbWidthShort),
+              (MAX_SHORT_SFB_BANDS + 1) * sizeof(int16));
+
+  sfbData->sfbWidth = sfbData->sfbWidthShort;
+
+  sfbData->bandLimit = MAX_MONO_SAMPLES;
+}
+
+/**************************************************************************
+  Title        : III_BandLimit
+
+  Purpose      : Saves the bandlimit value for Huffman decoding.
+
+  Usage        : III_BandLimit(sfbData, decim_factor)
+
+  Input        : sfbData  - sfb parameters
+                 binLimit - number of spectral bins to be decoded from each channel
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+void
+III_BandLimit(CIII_SfbData *sfbData, uint16 binLimit)
+{
+  sfbData->bandLimit = binLimit;
+}
+
+
+/**************************************************************************
+  Title        : III_sfbOffsetLong
+
+  Purpose      : Obtains the scalefactor table for long blocks.
+
+  Usage        : y = III_sfbOffsetLong(header)
+
+  Input        : header - mp3 header parameters
+
+  Output       : y - scalefactor boundaries for long blocks
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+const int16 *
+III_sfbOffsetLong(TMPEG_Header *header)
+{
+  int16 fidx, mp25idx = (int16) (6 * mp25version(header));
+  
+  fidx = (int16) (mp25idx + 3 * version(header) + sfreq(header));
+
+  return (&sfBandIndex[fidx].l[0]);
+}
+
+
+/**************************************************************************
+  Title        : III_sfbOffsetShort
+
+  Purpose      : Obtains the scalefactor table for short blocks.
+
+  Usage        : y = III_sfbOffsetShort(header)
+
+  Input        : header - mp3 header parameters
+
+  Output       : y - scalefactor boundaries for short blocks
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+const int16 *
+III_sfbOffsetShort(TMPEG_Header *header)
+{
+  int16 mp25idx = (int16) (6 * mp25version(header));
+
+  return (&sfBandIndex[mp25idx + 3 * version(header) + sfreq(header)].s[0]);
+}
+
+
+/**************************************************************************
+  Title        : III_sfbWidthTblShort
+
+  Purpose      : Obtains the scalefactor width table for short blocks.
+
+  Usage        : y = III_sfbWidthTblShort(sfb_offset, sfb_width)
+
+  Input        : sfb_offset - offset table of short blocks
+                 sfb_width  - address of buffer to receive the sfb widths
+
+  Output       : y - sfb width table for short blocks
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+const int16 *
+III_sfbWidthTblShort(int16 *sfb_offset, int16 *sfb_width)
+{
+  for(int16 i = 0; i < MAX_SHORT_SFB_BANDS; i++)
+    sfb_width[i] = (int16) (sfb_offset[i + 1] - sfb_offset[i]);
+
+  return (sfb_width);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/MP3Gain/src/layer3.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,733 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+layer3.cpp - MPEG-1, MPEG-2 LSF and MPEG-2.5 layer III bitstream parsing.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
+*************************************************************************/
+
+/**************************************************************************
+External Objects Needed
+*************************************************************************/
+
+/*-- Project Headers --*/
+#include "mpaud.h"
+#include "mpheader.h"
+#include "mp3tables.h"
+
+
+
+//uint8 scalefac_buffer[54];
+
+/**************************************************************************
+Title        : III_get_side_info
+
+  Purpose      : Reads Layer III side information from the bitstream.
+  
+    Usage        : y = III_get_side_info(mp, bs)
+    
+      Input        : mp - MP3 decoder handle
+      bs - input bitstream
+      
+        Output       : y - TRUE on success, FALSE otherwise
+        
+          Author(s)    : Juha Ojanpera
+*************************************************************************/
+
+
+BOOL
+III_get_side_info(CMP_Stream *mp, TBitStream *bs)
+{
+    uint16 i, j, k, flag;
+    TGranule_Info *gr_info;
+    
+    /*-- Get the protected bits for the crc error checking. --*/
+    if(bs->dsp_buffer)
+    {
+        int16 sideLen = (GetSideInfoSlots(mp->header) >> 1) + 1;
+        
+        if(bs->bit_counter == 8) 
+            for(i = bs->buf_index, j = 0; j < sideLen; i++, j++)
+            {
+                DSP_BYTE wTmp = bs->dsp_buffer[MOD_OPCODE(i, bs->buf_mask)] << 8;
+                wTmp |= (bs->dsp_buffer[MOD_OPCODE((i + 1), bs->buf_mask)] >> 8) & 255;
+                mp->mp3_crc.crc_payload[j + 2] = wTmp;
+            }
+            else
+                for(i = bs->buf_index, j = 0; j < sideLen; i++, j++)
+                    mp->mp3_crc.crc_payload[j + 2] = bs->dsp_buffer[MOD_OPCODE(i, bs->buf_mask)];
+    }
+    
+    if(version(mp->header) == MPEG_AUDIO_ID) /* MPEG-1 */
+    {
+        mp->side_info->main_data_begin = BsGetBits(bs, 9);
+        if(channels(mp->header) == 1)
+        {
+            mp->side_info->private_bits = BsGetBits(bs, 5);
+            for(i = 0; i < 4; i++)
+                mp->side_info->scfsi[0][i] = BsGetBits(bs, 1);
+        }
+        else
+        {
+            mp->side_info->private_bits = BsGetBits(bs, 3);
+            for(i = 0; i < 2; i++)
+                for(j = 0; j < 4; j++)
+                    mp->side_info->scfsi[i][j] = int16(BsGetBits(bs, 1));
+        }
+        
+        for(i = 0; i < 2; i++)
+        {
+            for(j = 0; j < channels(mp->header); j++)
+            {
+                gr_info = mp->side_info->ch_info[j]->gr_info[i];
+                
+                gr_info->part2_3_length = BsGetBits(bs, 12);
+                gr_info->big_values = BsGetBits(bs, 9) << 1;
+                gr_info->global_gain = BsGetBits(bs, 8);
+                gr_info->scalefac_compress = BsGetBits(bs, 4);
+                
+                gr_info->flags = 0;
+                gr_info->flags |= (BsGetBits(bs, 1)) ? WINDOW_SWITCHING_FLAG : 0;
+                
+                if(win_switch(gr_info))
+                {
+                    /* block_type */
+                    gr_info->flags |= BsGetBits(bs, 2);
+                    
+                    /* mixed_block_flag */
+                    flag = BsGetBits(bs, 1);
+                    gr_info->flags |= (flag) ? MIXED_BLOCK_FLAG : 0;
+                    
+                    for(k = 0; k < 2; k++)
+                        gr_info->table_select[k] = BsGetBits(bs, 5);
+                    
+                    for(k = 0; k < 3; k++)
+                        gr_info->subblock_gain[k] = BsGetBits(bs, 3);
+                    
+                    /* Set region_count parameters since they are implicit in this case. */
+                    if((gr_info->flags & 3) == 0)
+                        return (FALSE); /* This will trigger resync */
+                    else
+                        if(short_block(gr_info) && !mixed_block(gr_info))
+                        {
+                            gr_info->block_mode = SHORT_BLOCK_MODE;
+                            gr_info->region0_count = 7;
+                        }
+                        else
+                        {
+                            if(short_block(gr_info) && mixed_block(gr_info))
+                                return (FALSE); /* mixed block are not allowed => resync */
+                            else
+                                gr_info->block_mode = LONG_BLOCK_MODE;
+                            
+                            gr_info->region0_count = 7;
+                        }
+                        
+                    gr_info->region1_count = 20 - gr_info->region0_count;
+                }
+                else
+                {
+                    gr_info->block_mode = LONG_BLOCK_MODE;
+                    for(k = 0; k < 3; k++)
+                        gr_info->table_select[k] = BsGetBits(bs, 5);
+                    gr_info->region0_count = BsGetBits(bs, 4);
+                    gr_info->region1_count = BsGetBits(bs, 3);
+                    
+                    gr_info->flags &= ~(uint32)3; /* block_type == 0 (LONG) */
+                }
+                
+                flag = BsGetBits(bs, 3);
+                gr_info->flags |= (flag & 4) ? PRE_FLAG : 0;
+                gr_info->flags |= (flag & 2) ? SCALEFAC_SCALE : 0;
+                gr_info->flags |= (flag & 1) ? COUNT_1_TABLE_SELECT : 0;
+            }
+        }
+    }
+    else /* MPEG-2 LSF and MPEG-2.5 */
+    {
+        mp->side_info->main_data_begin = BsGetBits(bs, 8);
+        
+        if(channels(mp->header) == 1)
+            mp->side_info->private_bits = BsGetBits(bs, 1);
+        else
+            mp->side_info->private_bits = BsGetBits(bs, 2);
+        
+        for(i = 0; i < channels(mp->header); i++)
+        {
+            gr_info = mp->side_info->ch_info[i]->gr_info[0];
+            
+            gr_info->part2_3_length = BsGetBits(bs, 12);
+            gr_info->big_values = BsGetBits(bs, 9) << 1;
+            gr_info->global_gain = BsGetBits(bs, 8);
+            gr_info->scalefac_compress = BsGetBits(bs, 9);
+            gr_info->flags = 0;
+            gr_info->flags |= (BsGetBits(bs, 1)) ? WINDOW_SWITCHING_FLAG : 0;
+            
+            if(win_switch(gr_info))
+            {
+                /* block_type */
+                gr_info->flags |= BsGetBits(bs, 2);
+                
+                /* mixed_block_flag */
+                flag = BsGetBits(bs, 1);
+                gr_info->flags |= (flag) ? MIXED_BLOCK_FLAG : 0;
+                
+                for(k = 0; k < 2; k++)
+                    gr_info->table_select[k] = BsGetBits(bs, 5);
+                
+                for(k = 0; k < 3; k++)
+                    gr_info->subblock_gain[k] = BsGetBits(bs, 3);
+                
+                /* Set region_count parameters since they are implicit in this case. */
+                if((gr_info->flags & 3) == 0)
+                    return (FALSE);
+                else
+                    if(short_block(gr_info) && !mixed_block(gr_info))
+                    {
+                        gr_info->block_mode = SHORT_BLOCK_MODE;
+                        gr_info->region0_count = 5;
+                    }
+                    else
+                    {
+                        if(short_block(gr_info) && mixed_block(gr_info))
+                            return (FALSE);
+                        else
+                            gr_info->block_mode = LONG_BLOCK_MODE;
+                        
+                        gr_info->region0_count = 7;
+                    }
+                    
+                gr_info->region1_count = 20 - gr_info->region0_count;
+            }
+            else
+            {
+                gr_info->block_mode = LONG_BLOCK_MODE;
+                for(k = 0; k < 3; k++)
+                    gr_info->table_select[k] = BsGetBits(bs, 5);
+                gr_info->region0_count = BsGetBits(bs, 4);
+                gr_info->region1_count = BsGetBits(bs, 3);
+                
+                gr_info->flags &= ~(uint32)3; /* block_type == 0 (LONG) */
+            }
+            
+            flag = BsGetBits(bs, 2);
+            gr_info->flags |= (flag & 2) ? SCALEFAC_SCALE : 0;
+            gr_info->flags |= (flag & 1) ? COUNT_1_TABLE_SELECT : 0;
+        }
+    }
+    
+    return (TRUE);
+}
+
+/*
+* Writes layer 3 side information (excluding granule specific info) 
+* to the specified bitstream. For writing granule specific 
+* parameters 'L3WriteGranule()' function should be used.
+*/
+INLINE void
+L3WriteCommonSideInfo(TBitStream *bs, CIII_Side_Info *sideInfo, TMPEG_Header *header)
+{
+    int16 bits;
+    uint32 dWord;
+    
+    bits = 9;
+    dWord = sideInfo->main_data_begin;
+    
+    /*-- MPEG-1. --*/
+    if(version(header) == MPEG_AUDIO_ID)
+    {
+        if(channels(header) == 1)
+        {
+            bits = 18;
+            dWord <<= 5; dWord |= sideInfo->private_bits;
+            dWord <<= 1; dWord |= sideInfo->scfsi[0][0];
+            dWord <<= 1; dWord |= sideInfo->scfsi[0][1];
+            dWord <<= 1; dWord |= sideInfo->scfsi[0][2];
+            dWord <<= 1; dWord |= sideInfo->scfsi[0][3];
+        }
+        else
+        {
+            bits = 20;
+            dWord <<= 3; dWord |= sideInfo->private_bits;
+            dWord <<= 1; dWord |= sideInfo->scfsi[0][0];
+            dWord <<= 1; dWord |= sideInfo->scfsi[0][1];
+            dWord <<= 1; dWord |= sideInfo->scfsi[0][2];
+            dWord <<= 1; dWord |= sideInfo->scfsi[0][3];
+            dWord <<= 1; dWord |= sideInfo->scfsi[1][0];
+            dWord <<= 1; dWord |= sideInfo->scfsi[1][1];
+            dWord <<= 1; dWord |= sideInfo->scfsi[1][2];
+            dWord <<= 1; dWord |= sideInfo->scfsi[1][3];
+        }
+    }
+    
+    /*-- MPEG-2 LSF, MPEG-2.5. --*/
+    else
+    {
+        if(channels(header) == 1)
+        { bits = 9;  dWord <<= 1; }
+        else 
+        { bits = 10; dWord <<= 2; }
+        
+        dWord |= sideInfo->private_bits;
+    }
+    
+    BsPutBits(bs, bits, dWord);
+}
+
+/*
+* Writes granule specific parameters to the specified bitstream.
+* Please note that the MPEG frame may contain more than one granule
+* depending on the number of channels and version. So this function
+* may need to be called multiple times.
+*/
+INLINE void
+L3WriteGranule(TBitStream *bs, TGranule_Info *gr_info, BOOL mpeg1)
+{
+    uint32 dWord;
+    
+    dWord = gr_info->part2_3_length << 9;
+    dWord |= gr_info->big_values >> 1;
+    dWord <<= 8; dWord |= gr_info->global_gain;
+    
+    BsPutBits(bs, 29, dWord);
+    
+    dWord = gr_info->scalefac_compress << 1;
+    if(win_switch(gr_info))
+    {
+        dWord |= 1;
+        dWord <<= 2; dWord |= (gr_info->flags & 3);
+        dWord <<= 1; if(mixed_block(gr_info)) dWord |= 1;
+        dWord <<= 5; dWord |= gr_info->table_select[0];
+        dWord <<= 5; dWord |= gr_info->table_select[1];
+        dWord <<= 3; dWord |= gr_info->subblock_gain[0];
+        dWord <<= 3; dWord |= gr_info->subblock_gain[1];
+        dWord <<= 3; dWord |= gr_info->subblock_gain[2];
+    }
+    else
+    {
+        dWord <<= 5; dWord |= gr_info->table_select[0];
+        dWord <<= 5; dWord |= gr_info->table_select[1];
+        dWord <<= 5; dWord |= gr_info->table_select[2];
+        dWord <<= 4; dWord |= gr_info->region0_count; 
+        dWord <<= 3; dWord |= gr_info->region1_count;
+    }
+    
+    if(mpeg1) { dWord <<= 1; if(pre_flag(gr_info)) dWord |= 1; }
+    else      { BsPutBits(bs, 32, dWord); dWord = 0; }
+    
+    dWord <<= 1; if(scalefac_scale(gr_info)) dWord |= 1;
+    dWord <<= 1; if(gr_info->flags & COUNT_1_TABLE_SELECT) dWord |= 1;
+    
+    BsPutBits(bs, (mpeg1) ? 30 : 2, dWord);
+}
+
+/*
+* Writes layer 3 side info to the specified bitstream. The side info
+* in this context includes the header and the actual side info
+* parameters.
+*/
+void
+L3WriteSideInfo(TBitStream *bs, CIII_Side_Info *sideInfo, TMPEG_Header *header)
+{
+    BOOL mpeg1;
+    int16 i, j, max_gr;
+    
+    mpeg1 = (version(header) == MPEG_AUDIO_ID) ? TRUE : FALSE;
+    max_gr = (mpeg1) ? 2 : 1;
+    
+    /*-- Write common side info. --*/
+    L3WriteCommonSideInfo(bs, sideInfo, header);
+    
+    /*-- Write granule parameters. --*/
+    for(i = 0; i < max_gr; i++)
+        for(j = 0; j < channels(header); j++)
+        {
+            TGranule_Info *gr_info = sideInfo->ch_info[j]->gr_info[i];
+            L3WriteGranule(bs, gr_info, mpeg1);
+        }
+}
+
+/**************************************************************************
+Title        : III_get_LSF_scale_data
+
+  Purpose      : Decodes scalafactors of MPEG-2 LSF and MPEG-2.5 bitstreams.
+  
+    Usage        : III_get_LSF_scale_data(mp, gr, ch)
+    
+      Input        : mp - MP3 stream parameters
+      gr - granule number
+      ch - channel number (left or right)
+      
+        Explanation  : -
+        
+          Author(s)    : Juha Ojanpera
+*************************************************************************/
+
+static void
+III_get_LSF_scale_data(CMP_Stream *mp, int16 gr, int16 ch, uint8* scalefac_buffer)
+{
+    int16 i, j, k, m = 0;
+    int16 blocktypenumber = 0, blocknumber = 0;
+    int16 scalefac_comp, int_scalefac_comp, new_slen[4] = {0, 0, 0, 0};
+    TGranule_Info *gr_info;
+    
+    gr_info = mp->side_info->ch_info[ch]->gr_info[gr];
+    scalefac_comp = gr_info->scalefac_compress;
+    
+    switch(gr_info->block_mode)
+    {
+    case SHORT_BLOCK_MODE:
+        blocktypenumber = 1;
+        break;
+        
+    case LONG_BLOCK_MODE:
+        blocktypenumber = 0;
+        break;
+        
+    default:
+        break;
+    }
+    
+    if(!((mode_extension(mp->header) == 1 || 
+        mode_extension(mp->header) == 3) && ch == 1))
+    {    
+        
+        if(scalefac_comp < 400)
+        {
+            new_slen[0] = (scalefac_comp >> 4) / 5;
+            new_slen[1] = (scalefac_comp >> 4) % 5;
+            new_slen[2] = (scalefac_comp & 15) >> 2;
+            new_slen[3] = (scalefac_comp & 3);
+            
+            blocknumber = 0;
+            m = 4;
+        }
+        else if(scalefac_comp < 500)
+        {
+            scalefac_comp -= 400;
+            
+            new_slen[0] = (scalefac_comp >> 2) / 5;
+            new_slen[1] = (scalefac_comp >> 2) % 5;
+            new_slen[2] = scalefac_comp & 3;
+            
+            blocknumber = 1;
+            m = 3;
+        }
+        else /*if(scalefac_comp < 512)*/
+        {
+            scalefac_comp -= 500;
+            
+            new_slen[0] = scalefac_comp / 3;
+            new_slen[1] = scalefac_comp % 3;
+            
+            gr_info->flags |= (uint32)PRE_FLAG; /* pre_flag = 1 */
+            
+            blocknumber = 2;
+            m = 2;
+        }
+    }
+    
+    if(((mode_extension(mp->header) == 1 || 
+        mode_extension(mp->header) == 3) && ch == 1))
+    {
+        
+        int_scalefac_comp = scalefac_comp >> 1;
+        
+        if(int_scalefac_comp < 180)
+        {
+            int16 tmp = int_scalefac_comp % 36;
+            
+            new_slen[0] = int_scalefac_comp / 36;
+            new_slen[1] = tmp / 6;
+            new_slen[2] = tmp % 6;
+            
+            blocknumber = 3;
+            m = 3;
+        }
+        else if(int_scalefac_comp < 244)
+        {
+            int_scalefac_comp -= 180;
+            
+            new_slen[0] = (int_scalefac_comp & 63) >> 4;
+            new_slen[1] = (int_scalefac_comp & 15) >> 2;
+            new_slen[2] = int_scalefac_comp & 3;
+            
+            blocknumber = 4;
+            m = 3;
+        }
+        else /*if(int_scalefac_comp < 255)*/
+        {
+            int_scalefac_comp -= 244;
+            
+            new_slen[0] = int_scalefac_comp / 3;
+            new_slen[1] = int_scalefac_comp % 3;
+            
+            blocknumber = 5;
+            m = 2;
+        }
+        
+        TIS_Info *is_info = &mp->side_info->is_info;
+        is_info->is_len[0] = (1 << new_slen[0]) - 1;
+        is_info->is_len[1] = (1 << new_slen[1]) - 1;
+        is_info->is_len[2] = (1 << new_slen[2]) - 1;
+        is_info->nr_sfb[0] = nr_of_sfb_block[blocknumber][blocktypenumber][0];
+        is_info->nr_sfb[1] = nr_of_sfb_block[blocknumber][blocktypenumber][1];
+        is_info->nr_sfb[2] = nr_of_sfb_block[blocknumber][blocktypenumber][2];
+        
+    }
+    
+    
+    Mem::Fill(scalefac_buffer, 54, 0);
+    
+    
+    for(i = k = 0; i < m; i++)
+    {
+        
+        if(new_slen[i] != 0)
+            for(j = 0; j < nr_of_sfb_block[blocknumber][blocktypenumber][i]; j++, k++)
+            {
+                
+                
+                
+                scalefac_buffer[k] = BsGetBits(mp->br, new_slen[i]);
+                
+                
+            }
+            else
+            {
+                
+                
+                if (i < 4)
+                {
+                    k += nr_of_sfb_block[blocknumber][blocktypenumber][i];
+                }
+                else
+                {
+                    k +=  0;
+                }            
+                
+            }      
+            
+    }
+    
+}
+
+/**************************************************************************
+Title        : III_get_scale_factors
+
+Purpose      : Reads the scale factors of layer III.
+  
+Usage        : III_get_scale_factors(mp, gr, ch)
+    
+Input        : mp - MP3 stream parameters
+gr - granule number
+ch - channel number (left or right)
+      
+Author(s)    : Juha Ojanpera
+*************************************************************************/
+        
+void III_get_scale_factors(CMP_Stream *mp, int16 gr, int16 ch)
+    {
+    uint8 *sf[3];
+    int16 i, sfb, bits, idx;
+    TGranule_Info *gr_info;
+    CIII_Scale_Factors *scale_fac;
+    
+    uint8* scalefac_buffer = NULL;
+    TRAPD(error, scalefac_buffer = new (ELeave) uint8[54]);
+    if (error != KErrNone)
+        return;
+    
+    Mem::Fill(scalefac_buffer, 54, 0);
+    
+    gr_info = mp->side_info->ch_info[ch]->gr_info[gr];
+    
+    scale_fac = mp->side_info->ch_info[ch]->scale_fac;
+    
+    idx = 0;
+    if(mp->side_info->lsf)
+        {
+        III_get_LSF_scale_data(mp, gr, ch, scalefac_buffer);
+        }
+        
+    
+    switch(gr_info->block_mode)
+    {
+    case SHORT_BLOCK_MODE:
+        sf[0] = scale_fac->scalefac_short[0];
+        sf[1] = scale_fac->scalefac_short[1];
+        sf[2] = scale_fac->scalefac_short[2];
+        if(mp->side_info->lsf)
+            for(sfb = 0; sfb < 12; sfb++)
+            {
+                *sf[0]++ = scalefac_buffer[idx++];
+                *sf[1]++ = scalefac_buffer[idx++];
+                *sf[2]++ = scalefac_buffer[idx++];
+            }
+            else
+                for(i = 0; i < 2; i++)
+                {
+                    bits = slen[i][gr_info->scalefac_compress];
+                    if(bits)
+                        for(sfb = sfbtable.s[i]; sfb < sfbtable.s[i + 1]; sfb++)
+                        {
+                            *sf[0]++ = BsGetBits(mp->br, bits);
+                            *sf[1]++ = BsGetBits(mp->br, bits);
+                            *sf[2]++ = BsGetBits(mp->br, bits);
+                        }
+                        else
+                            for(sfb = sfbtable.s[i]; sfb < sfbtable.s[i + 1]; sfb++)
+                            {
+                                *sf[0]++ = 0; *sf[1]++ = 0; *sf[2]++ = 0;
+                            }
+                }
+            break;
+                
+    case LONG_BLOCK_MODE:
+        sf[0] = scale_fac->scalefac_long;
+        
+        
+        if(mp->side_info->lsf)
+            for(i = 0; i < 21; i++)
+                *sf[0]++ = scalefac_buffer[idx++];
+            else
+                for(i = 0; i < 4; i++)
+                {
+                    
+                    if(mp->side_info->scfsi[ch][i] == 0 || gr == 0)
+                    {
+                        bits = slen[i >> 1][gr_info->scalefac_compress];
+                        if(bits)
+                            for(sfb = sfbtable.l[i]; sfb < sfbtable.l[i + 1]; sfb++)
+                            {
+                                
+                                *sf[0]++ = BsGetBits(mp->br, bits);
+                                
+                            }
+                            else
+                                for(sfb = sfbtable.l[i]; sfb < sfbtable.l[i + 1]; sfb++)
+                                    *sf[0]++ = 0;
+                    }
+                    else
+                        sf[0] += sfbtable.l[i + 1] - sfbtable.l[i];
+                }
+            break;
+                
+    default:
+        break;
+    }
+    
+    delete[] scalefac_buffer;
+    
+}
+
+
+void
+    init_III_reorder(int16 reorder_idx[2][MAX_MONO_SAMPLES], int16 *sfb_table, 
+    int16 *sfb_width_table)
+{
+    int32 sfb, sfb_start, i;
+    int32 window, freq, src_line, des_line;
+    
+    for(i = sfb = 0; sfb < MAX_SHORT_SFB_BANDS; sfb++)
+    {
+        sfb_start = sfb_table[sfb];
+        
+        for(window = 0; window < 3; window++)
+            for(freq = 0; freq < sfb_width_table[sfb]; freq++)
+            {
+                src_line = sfb_start * 3 + window * sfb_width_table[sfb] + freq;
+                des_line = (sfb_start * 3) + window + (freq * 3);
+                
+                reorder_idx[0][i] =
+                    ((des_line / SSLIMIT) * SSLIMIT) + (des_line % SSLIMIT);
+                
+                reorder_idx[1][i++] =
+                    ((src_line / SSLIMIT) * SSLIMIT) + (src_line % SSLIMIT);
+            }
+    }
+}
+
+
+
+/**************************************************************************
+Title        : III_reorder
+
+  Purpose      : Re-orders the input frame if short blocks are present.
+  
+    Usage        : III_reorder(mp, gr, ch)
+    
+      Input        : mp - MP3 stream parameters
+      ch - channel number (left or right)
+      gr - granule number
+      
+        Explanation  : -
+        
+          Author(s)    : Juha Ojanpera
+*************************************************************************/
+
+void
+    III_reorder(CMP_Stream *mp, int16 ch, int16 gr)
+{
+    int16 i, sb_start;
+    register int16 *id1, *id2;
+    
+    FLOAT* xr = NULL;
+    TRAPD(error, xr = new (ELeave) FLOAT[MAX_MONO_SAMPLES]);
+    if (error != KErrNone)
+        return;
+    
+    register FLOAT *src, *dst;
+    
+    if(mp->side_info->ch_info[ch]->gr_info[gr]->block_mode == LONG_BLOCK_MODE)
+    {
+        delete[] xr;
+        return;
+        
+    }
+    
+    sb_start = 0;
+    
+    id1 = &mp->reorder_idx[0][sb_start];
+    id2 = &mp->reorder_idx[1][sb_start];
+    
+    /*
+    * First re-order the short block to a temporary buffer
+    * and then copy back to the input buffer. Not fully optimal,
+    * a better way would be perhaps to do the re-ordering during the
+    * dequantization but to my opinion that would complicate the code
+    * too much. We also have to remember that short blocks do not occur
+    * very frequently, so the penalty of having a separate re-ordering
+    * routine is not so time consuming from the overall decoder complexity
+    * point of view.
+    */
+    src = &mp->buffer->ch_reconstructed[ch][0];
+    dst = &xr[0];
+    
+    for(i = sb_start; i < MAX_MONO_SAMPLES; i++)
+        dst[*id1++] = src[*id2++];
+    
+    /* Copy back. */
+    for(i = sb_start; i < MAX_MONO_SAMPLES; i++)
+        src[i] = dst[i];
+    
+    delete[] xr;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/MP3Gain/src/mpaud.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  mpaud.cpp - MPEG-1, MPEG-2 LSF and MPEG-2.5 layer III bitstream decoder.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/*-- project headers --*/
+#include "mpaud.h"
+#include "mpheader.h"
+#include "mp3tool.h"
+
+/**************************************************************************
+  Internal Objects
+  *************************************************************************/
+
+/**************************************************************************
+  Title        : L3BitReservoir
+
+  Purpose      : Layer III bit reservoir subroutine.
+
+  Usage        : y = L3BitReservoir(mp)
+
+  Input        : mp - mp3 stream parameters
+
+  Output       : y - # of bytes discarded from the bit reservoir buffer.
+                     Value -1 indicates that an error has occured during
+                     decoding (invalid bitstream syntax found)
+
+  Explanation  : Return value -1 should be regarded as a fatal error in the
+                 sense that decoding of current frame should not be continued.
+                 Instead, the decoder should be re-initialized.
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+INLINE int16
+L3BitReservoir(CMPAudDec *mp)
+{
+  int16 bytes_to_discard;
+  int16 flush_main;
+  int32 bits_read;
+  TBitStream *br;
+
+  br = &mp->br;
+
+  /*------------ Start of bit reservoir processing. ------------------*/
+
+  if(mp->WasSeeking == FALSE)
+  {
+    /*-- Byte alignment. --*/
+    bits_read = BsGetBitsRead(br);
+    flush_main = (int16) (bits_read & 7);
+    if(flush_main)
+      BsSkipBits(br, (int16) (8 - flush_main));
+
+    /*
+     * Determine how many bits were left from the previous frame.
+     */
+    if(mp->SkipBr == FALSE)
+    {
+      BsClearBitsRead(br);
+      BsSetBitsRead(br, (mp->PrevSlots << 3) - bits_read);
+    }
+
+    /*
+     * Determine how many bytes need to be discarded from the previous
+     * frame to find the start of next frame.
+     */
+    bytes_to_discard = (int16) ((BsGetBitsRead(br) >> 3) - mp->side_info->main_data_begin);
+    
+    /*-- Reset the bit reservoir bit counter. --*/
+    BsClearBitsRead(br);
+    
+    /*-- # of slots available for this frame. --*/
+    mp->PrevSlots = (int16) (mp->mpFileFormat->mainDataSlots + mp->side_info->main_data_begin);
+    
+    if(bytes_to_discard < 0)
+    {
+      BsClearBitsRead(br);
+      BsSetBitsRead(br, mp->mpFileFormat->mainDataSlots << 3);
+      mp->SkipBr = TRUE;
+      return (-1);
+    }
+
+    mp->SkipBr = FALSE;
+
+    if(bytes_to_discard)
+    {
+      mp->PrevSlots = (int16) (mp->PrevSlots + bytes_to_discard);
+      BsSkipNBits(br, bytes_to_discard << 3);
+    }
+  }
+  else
+  {
+    bytes_to_discard = 0;
+
+    /*-- # of slots available for this frame. --*/
+    mp->PrevSlots = (int16) (mp->mpFileFormat->mainDataSlots + mp->side_info->main_data_begin);
+
+    mp->SkipBr = FALSE;
+    mp->WasSeeking = FALSE;
+    
+    if(mp->side_info->main_data_begin)
+      BsRewindNBits(br, mp->side_info->main_data_begin << 3);
+
+    /*-- Reset the bit reservoir bit counter. --*/
+    BsClearBitsRead(br);
+  }
+  /*-------------- End of bit reservoir processing. ------------------*/
+
+  return (bytes_to_discard);
+}
+
+/**************************************************************************
+  Title        : DeleteMPAudDec
+
+  Purpose      : Releases resources allocated to the mp3 decoder core.
+
+  Usage        : y = DeleteMPAudDec(mpAud)
+
+  Input        : mpAud - Layer I/II/III decoder core
+
+  Output       : y     - NULL
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+
+INLINE uint8
+GetLayer3Version(TMpTransportHandle *tHandle)
+{
+  uint8 mp_version;
+  
+  /*
+   * Which version of mp3 ?
+   */
+  if(version(&tHandle->header))
+    mp_version = 1; /*-- MPEG-1   --*/
+  else if(!mp25version(&tHandle->header))
+    mp_version = 2; /*-- MPEG-2   --*/
+  else
+    mp_version = 3; /*-- MPEG-2.5 --*/
+
+  return (mp_version);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/MP3Gain/src/mpif.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,909 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  mpif.cpp - MPEG-1, MPEG-2 LSF and MPEG-2.5 file format implementations.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+/*-- project headers --*/
+#include "mpif.h"
+//#include "auddef.h"
+#include "mpheader.h"
+#include "nok_bits.h"
+#include "mstream.h"
+
+
+/**************************************************************************
+  Internal Objects
+  *************************************************************************/
+
+/*
+   Purpose:     Sync lost after 16384 bytes.
+   Explanation: - */
+#define SYNC_THRESHOLD (16384 << 3)
+
+/**************************************************************************
+  Title        : main_data_slots
+
+  Purpose      : Computes the number of bytes for the layer III payload. The
+                 payload consists of the scalefactors and quantized data of
+                 the channel(s).
+
+  Usage        : y = main_data_slots(mp)
+
+  Input        : mp - mp3 file format parameters
+
+  Output       : y  - # of payload bytes for this frame
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+INLINE int32
+main_data_slots(TMpTransportHandle *tHandle)
+{
+  int16 nSlots;
+
+  if(bit_rate(&tHandle->header))
+  {
+    nSlots = tHandle->SlotTable[bit_rate_idx(&tHandle->header)];
+
+    if(padding(&tHandle->header))
+      nSlots++;
+    if(error_protection(&tHandle->header))
+      nSlots -= 2;
+  }
+  else
+  {
+    nSlots = tHandle->FreeFormatSlots;
+
+    if(padding(&tHandle->header))
+      nSlots++;
+  }
+
+  return(nSlots);
+}
+
+/*
+ * Maximum # of bits needed for the header. Note that only
+ * 20 bits are read since 12 bits were read already when 
+ * locating the start of frame. 16 bits are needed for
+ * the optional CRC codeword.
+ */
+#define MAX_MP_HEADER_SIZE (20 + 16)
+
+/**************************************************************************
+  Title        : decode_header
+
+  Purpose      : Reads header information (excluding syncword) from the bitstream.
+
+  Usage        : decode_header(tHandle, bs)
+
+  Input        : tHandle - file format parser
+                 bs      - input bitstream
+
+  Explanation  : Header information is commmon to all layers. Note also that
+                 this function doesn't interprete the fields of the header.
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+INLINE SEEK_STATUS
+decode_header(TMpTransportHandle *tHandle, TBitStream *bs)
+{
+  uint32 header, bitsLeft;
+
+  bitsLeft = (BsGetBufSize(bs) << 3) - BsGetBitsRead(bs);
+  if(bitsLeft < MAX_MP_HEADER_SIZE)
+    return (SYNC_BITS_OUT);
+
+  /*-- Read rest of the header bits. --*/
+  tHandle->headerOld.header = tHandle->header.header;
+  header = (!tHandle->mpeg25) << HEADER_BITS;
+  header |= BsGetBits(bs, HEADER_BITS);
+  tHandle->header.header = header;
+
+  /*-- Read CRC codeword. --*/
+  if(error_protection(&tHandle->header))
+    tHandle->crc.crc = (int16) BsGetBits(bs, 16);
+
+  return (SYNC_FOUND);
+}
+
+/**************************************************************************
+  Title        : GetSideInfoSlots
+
+  Purpose      : Retrieves the amount of side info for layer III stream.
+
+  Usage        : y = GetSideInfoSlots(tHandle)
+
+  Input        : tHandle - file format parser
+
+  Output       : y       - # of side info bytes
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+int16
+GetSideInfoSlots(TMpTransportHandle *tHandle)
+{
+  int16 nSlots = 0;
+
+  if(version(&tHandle->header) != MPEG_PHASE2_LSF)
+    nSlots = (channels(&tHandle->header) == 1) ? (int16) 17 : (int16) 32;
+  else
+    nSlots = (channels(&tHandle->header) == 1) ? (int16) 9 : (int16) 17;
+
+  return (nSlots);
+}
+
+int16
+GetSideInfoSlots(TMPEG_Header *header)
+{
+  int16 nSlots = 0;
+
+  if(version(header) != MPEG_PHASE2_LSF)
+    nSlots = (channels(header) == 1) ? 17 : 32;
+  else
+    nSlots = (channels(header) == 1) ? 9 : 17;
+
+  return (nSlots);
+}
+
+/**************************************************************************
+  Title        : GetSlotSize
+
+  Purpose      : Retrieves the amount of frame data for layer III stream.
+
+  Usage        : y = GetSlotSize(tHandle)
+
+  Input        : tHandle - file format parser
+
+  Output       : y       - # of frame data bytes
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+static INLINE int16
+GetSlotSize(TMpTransportHandle *tHandle)
+{
+  int16 ave_slots;
+  
+  if(bit_rate(&tHandle->header))
+    ave_slots = (int16) tHandle->aveFrameLen;
+  else
+  {
+    ave_slots = (int16) (tHandle->FreeFormatSlots + GetSideInfoSlots(tHandle));
+    if(error_protection(&tHandle->header))
+      ave_slots += 2;
+    ave_slots += 4;
+  }
+
+  return (ave_slots);
+}
+
+INLINE int32 *
+GetSeekOffset(TMpTransportHandle *tHandle, int32 *seekValues)
+{
+  int16 main_data;
+  int32 frameOffset, byte_offset;
+  
+  /*
+   * Some reinitialization need to be performed after file pointer has been
+   * moved to the new postion. For this reason, the total number of frames
+   * to be skipped does not correspond exactly to the given time offset.
+   * However, after reinitialization the playback position should be the correct.
+   */
+  byte_offset = GetSlotSize(tHandle);
+  main_data = (int16) ((version(&tHandle->header) == MPEG_PHASE2_LSF) ? 256 : 512);
+  frameOffset = (byte_offset) ? main_data / byte_offset : 0;
+
+  if(byte_offset)
+    if(main_data % byte_offset)
+      frameOffset++;
+
+  seekValues[0] = frameOffset;
+  seekValues[1] = byte_offset;
+
+  return (seekValues);
+}
+
+/*
+ * Estimates the bitrate of the mp3 stream from the size of the 
+ * payload + side info + header. The accuracy of the computed 
+ * bitrate depends very much on the accuracy of the average frame 
+ * size.
+ */
+int16
+MP_EstimateBitrate(TMpTransportHandle *tHandle, uint8 isVbr)
+{
+  int16 bitRate;
+
+  if(!bit_rate(&tHandle->header) || isVbr)
+  {
+    FLOAT div;
+
+    div = (FLOAT) ((version(&tHandle->header) == MPEG_PHASE2_LSF) ? 72 : 144);
+    bitRate = (int16) (((frequency(&tHandle->header) / 1000.0f) * GetSlotSize(tHandle) / div) + 0.5f);
+  }
+  else
+    bitRate = bit_rate(&tHandle->header);
+
+  return (bitRate);
+}
+
+/*
+ * Returns the length of the track in milliseconds.
+ */
+uint32
+MP_FileLengthInMs(TMpTransportHandle *tHandle, int32 fileSize)
+{
+  FLOAT frames = fileSize / (FLOAT) GetSlotSize(tHandle);
+
+  return (uint32) (frames * GetFrameTime(&tHandle->header) + 0.5f);
+}
+
+/*
+ * Returns the byte offset corresponding to the specified seeking position.
+ */
+int32
+MP_GetSeekOffset(TMpTransportHandle *tHandle, int32 seekPos)
+{
+  FLOAT numFrames;
+  int32 seekValues[2], frameOffset, byte_offset;
+
+  GetSeekOffset(tHandle, seekValues);
+
+  frameOffset = seekValues[0];
+  byte_offset = seekValues[1];
+  
+  numFrames = seekPos / (FLOAT) GetFrameTime(&tHandle->header);
+  if(numFrames < frameOffset)
+    frameOffset = 0;
+
+  /*-- Total offset. --*/
+  byte_offset = (int32) ((byte_offset * (numFrames - frameOffset)) + 0.5f);
+
+  return (byte_offset);
+}
+
+/*
+ * Returns the duration of each frame in milliseconds.
+ */
+int32
+MP_GetFrameTime(TMpTransportHandle *tHandle)
+{
+  return (GetFrameTime(&tHandle->header));
+}
+
+/*
+ * Checks if the specified mp3 stream is using free format 
+ * i.e., bitrate is not specified in the header part
+ * of the frame.
+ *
+ * Return TRUE if bitrate not specified, FALSE otherwise
+ */
+BOOL
+IsMP3FreeFormat(TMpTransportHandle *tHandle)
+{  
+  return (bit_rate(&tHandle->header) == 0);
+}
+
+/**************************************************************************
+  Title        : FillDataSlotTable
+
+  Purpose      : Pre-computes (to avoid division operation during decoding) 
+                 the payload size of layer III for all bitrates. This function
+                 should be called once the start of 1st frame has been located.
+
+  Usage        : y = FillDataSlotTable(tHandle)
+
+  Input        : tHandle - file format parser
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+INLINE void
+FillDataSlotTable(TMpTransportHandle *tHandle)
+{
+  int16 nSlots;
+  const int16 *brTbl;
+  
+  brTbl = GetBitRateTable(&tHandle->header);
+
+  /*
+   * index 0 is free format and index 14 illegal bitrate.
+   */
+  for(int16 i = 1; i < 15; i++)
+  {
+    nSlots = (int16)((144 * brTbl[i]) / (frequency(&tHandle->header) / 1000.0f));
+
+    if(version(&tHandle->header) == MPEG_PHASE2_LSF)
+      nSlots >>= 1;
+
+    nSlots = (int16) (nSlots - GetSideInfoSlots(tHandle) - 4);
+    tHandle->SlotTable[i] = nSlots;
+  }
+}
+
+/**************************************************************************
+  Title        : SeekSync
+
+  Purpose      : Seeks for a byte aligned sync word in the bitstream and
+                 places the bitstream pointer right after the sync word.
+
+  Usage        : y = SeekSync(mp, bs_mcu, bufMapper, execState)
+
+  Input        : mp             - mp3 stream parameters
+                 bs_mcu         - bitstream parameters
+                 execState      - exec status of this function
+
+  Output       : y :
+                  SYNC_BITS_OUT - bit buffer need to be updated
+                  SYNC_LOST     - start of next frame was not found
+                  SYNC_FOUND    - OK to decode next frame
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+INLINE SEEK_STATUS
+SeekSync(TMpTransportHandle *tHandle, TBitStream *bs_mcu, ExecState *execState)
+{
+#define PRESYNCBITS  (MP_SYNC_WORD_LENGTH + 8)
+#define POSTSYNCBITS (MAX_MP_HEADER_SIZE + 1)
+
+  uint32 hdr, bits_left;
+  BOOL exitCheck = TRUE;
+  int32 sync_cand, bits_read;
+
+  bits_left = (BsSlotsLeft(bs_mcu) - 1) << 3;
+  
+  if(execState->execMode == GLITCH_FREE && bits_left > PRESYNCBITS)
+  {
+    bits_left -= (BsByteAlign(bs_mcu) + (bits_read = tHandle->syncInfo.sync_length));
+    sync_cand = BsGetBits(bs_mcu, tHandle->syncInfo.sync_length);
+  }
+  else if(execState->execMode == GLITCH_FREE)
+  {
+    execState->execMode = GLITCH_FREE;
+
+    return (SYNC_BITS_OUT);
+  }
+  else
+  {
+    sync_cand = (int32)execState->a0_u32[0];
+    bits_read = (int32)execState->a0_u32[1];
+  }
+  
+  while(exitCheck)
+  {
+    while(sync_cand != tHandle->syncInfo.sync_word && 
+      bits_read < SYNC_THRESHOLD && bits_left)
+    {
+      bits_read++;
+      bits_left--;
+      sync_cand = (sync_cand << 1) & tHandle->syncInfo.sync_mask;
+      sync_cand |= (int16) BsGetBits(bs_mcu, 1);
+    }
+    
+    if(bits_read > SYNC_THRESHOLD)
+      return (SYNC_LOST);
+    else if(bits_left < POSTSYNCBITS)
+    {
+      execState->execMode = GLITCH0;
+      execState->a0_u32[0] = sync_cand;
+      execState->a0_u32[1] = bits_read;
+
+      return (SYNC_BITS_OUT);
+    }
+    else
+    {
+      bits_read++;
+      bits_left--;
+      sync_cand = (sync_cand << 1) & tHandle->syncInfo.sync_mask;
+      sync_cand |= (int16) BsGetBits(bs_mcu, 1);
+      
+      tHandle->mpeg25 = !(sync_cand & 0x1);
+      
+      /* Check the next frame header. */
+      hdr = (!tHandle->mpeg25) << HEADER_BITS;
+      tHandle->header.header = hdr | BsLookAhead(bs_mcu, HEADER_BITS);
+      
+      /* Detect false frame boundaries. */
+      switch(tHandle->syncInfo.sync_status)
+      {
+        case LAYER3_STREAM:
+          if(HEADER_MASK(tHandle->header.header) == HEADER_MASK(tHandle->headerOld.header) &&
+            sfreq(&tHandle->header) != 3 && LAYER_MASK(tHandle->header.header) == 0x1)
+          {
+            if(tHandle->FreeFormatSlots == 0)
+            {
+              if(bit_rate(&tHandle->header))
+                exitCheck = FALSE;
+            }
+            else exitCheck = FALSE;
+          }
+          break;
+      
+        case INIT_LAYER3_STREAM:
+          if(!(version(&tHandle->header) && mp25version(&tHandle->header)))
+          {
+            if(sfreq(&tHandle->header) != 3 && LAYER_MASK(tHandle->header.header) == 0x1 && bit_rate_idx(&tHandle->header) != 15)
+            {
+              tHandle->headerOld.header = tHandle->header.header;
+              tHandle->syncInfo.sync_status = LAYER3_STREAM;
+              exitCheck = FALSE;
+            }
+          }
+          break;
+
+        default:
+          break;
+      }
+    }
+  }  
+
+  execState->execMode = GLITCH_FREE;
+
+  return (SYNC_FOUND);
+}
+
+/**************************************************************************
+  Title        : FindFreeFormatSlotCount
+
+  Purpose      : Determines the size of the payload of a free format stream.
+
+  Usage        : y = FindFreeFormatSlotCount(mpDec, bs_mcu, execState)
+
+  Input        : mpDec     - mp3 stream parameters
+                 bs_mcu    - bitstream parameters
+                 execState - exec status of this function
+
+  Output       : y :
+                  SYNC_BITS_OUT - bit buffer need to be updated
+                  SYNC_LOST     - stream is undecodable
+                  SYNC_FOUND    - OK to start playback
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+INLINE SEEK_STATUS
+FreeFormat(TMpTransportHandle *tHandle, TBitStream *bs_mcu, ExecState *execState)
+{
+  int16 exitCheck;
+  TMPEG_Header oldHeader;
+  uint16 sync_cand;
+  uint32 bits_read, bits_left;
+
+  tHandle->FreeFormatSlots = 0;
+  
+  if(execState->execMode == GLITCH_FREE)
+  {
+    int16 nSlots, minBytes;
+
+    nSlots = GetSideInfoSlots(tHandle);
+    minBytes = (uint16) (nSlots + 7);
+    if((BsSlotsLeft(bs_mcu) - 1) < (uint16) minBytes)
+    {
+      execState->execMode = GLITCH_FREE;
+      return (SYNC_BITS_OUT);
+    }
+
+    /*-- Read 1st header. --*/
+    decode_header(tHandle, bs_mcu);
+    oldHeader.header = tHandle->header.header;
+
+    /*-- Skip side info part. --*/
+    BsSkipNBits(bs_mcu, nSlots << 3);
+
+    sync_cand = (uint16) BsGetBits(bs_mcu, tHandle->syncInfo.sync_length);
+    bits_read = tHandle->syncInfo.sync_length;
+  }
+  else
+  {
+    sync_cand = (uint16) execState->a0_u32[0];
+    bits_read = (uint32) execState->a0_u32[1];
+    oldHeader.header = (uint32)execState->a0_u32[2];
+  }
+
+  exitCheck = 1;
+  bits_left = (BsSlotsLeft(bs_mcu) - 1) << 3;
+  //mask = (uint16) ((1 << (tHandle->syncInfo.sync_length - 1)) - 1);
+    
+  while(exitCheck)
+  {
+    while(sync_cand != tHandle->syncInfo.sync_word && bits_left)
+    {
+      bits_read++;
+      bits_left--;
+      sync_cand = (uint16) ((sync_cand << 1) & tHandle->syncInfo.sync_mask);
+      sync_cand |= (uint16) BsGetBits(bs_mcu, 1);
+    }
+
+    if(bits_left < (HEADER_BITS + 1))
+    {
+      execState->a0_u32[0] = sync_cand;
+      execState->a0_u32[1] = bits_read;
+      execState->a0_u32[2] = oldHeader.header;
+      execState->execMode = GLITCH0;
+
+      return (SYNC_BITS_OUT);
+    }
+    else
+    {
+      uint32 hdr;
+
+      bits_read++;
+      bits_left--;
+      sync_cand = (sync_cand << 1) & tHandle->syncInfo.sync_mask;
+      sync_cand |= (int16) BsGetBits(bs_mcu, 1);
+      
+      tHandle->mpeg25 = !(sync_cand & 0x1);
+      
+      /* Check the next frame header. */
+      hdr = (!tHandle->mpeg25) << HEADER_BITS;
+      tHandle->header.header = hdr | BsLookAhead(bs_mcu, HEADER_BITS);
+      
+      /* 
+       * Detect false frame boundraries. We could use header macros here
+       * to speed up the comparison but since this function is called only
+       * once (before playback/editing starts) the advantages of macros are
+       * negligible.
+       */
+      if(channels(&tHandle->header)         == channels(&oldHeader) &&
+         sfreq(&tHandle->header)            == sfreq(&oldHeader) &&
+         bit_rate(&tHandle->header)         == bit_rate(&oldHeader) &&
+         layer_number(&tHandle->header)     == layer_number(&oldHeader) &&
+         version(&tHandle->header)          == version(&oldHeader) &&
+         mode(&tHandle->header)             == mode(&oldHeader) &&
+         error_protection(&tHandle->header) == error_protection(&oldHeader))
+         exitCheck = 0;
+
+      /* The payload size cannot be determined. */
+      else if(bits_read > SYNC_THRESHOLD)     
+        return (SYNC_LOST);
+    }
+  }
+    
+  /*-- Determine the size of the payload data. --*/
+  if(bits_read != 0)
+  {
+    bits_read -= (tHandle->syncInfo.sync_length + 1);
+    tHandle->FreeFormatSlots = (int16) (bits_read >> 3);
+
+    if(padding(&oldHeader))
+      tHandle->FreeFormatSlots -= 1;
+  }
+  else
+  {
+    tHandle->FreeFormatSlots = -1;
+
+    return (SYNC_LOST);
+  }
+  
+  execState->execMode = GLITCH_FREE;
+  tHandle->transportType = GET_MPSYNC_STREAM;
+  tHandle->syncInfo.sync_status = INIT_LAYER3_STREAM;
+
+  return (SYNC_FOUND);
+}
+
+/**************************************************************************
+  Title        : mpSyncTransport
+
+  Purpose      : Sync layer interface for MPEG Layer I/II/III file formats.
+
+  Usage        : y = mpSyncTransport(tHandle, syncBuf, syncBufLen, readBits)
+
+  Input        : tHandle        - handle to MPEG Layer I/II/III parser
+                 syncBuf        - handle to sync layer buffer
+                 syncBufLen     - # of bytes present in sync layer buffer
+  
+  Output       : y              - status of operation
+                  SYNC_BITS_OUT - the sync layer buffer needs to be updated
+                  SYNC_LOST     - function failed
+                  SYNC_FOUND    - sync layer processing successfull
+                 readBits       - # of bits read from sync layer buffer
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+
+SEEK_STATUS
+mpSyncTransport(TMpTransportHandle *tHandle, uint8 *syncBuf, 
+                uint32 syncBufLen, uint32 *readBits)
+{
+  BOOL hitExit;
+  ExecState *execState;
+  TBitStream m_Bitstream;
+  SEEK_STATUS frameStatus;
+
+  *readBits = 0;
+  hitExit = FALSE;
+  frameStatus = SYNC_LOST;
+  execState = &tHandle->execState;
+
+  BsInit(&m_Bitstream, syncBuf, syncBufLen);
+
+  if(tHandle->offsetBits)
+    BsSkipNBits(&m_Bitstream, tHandle->offsetBits);
+  tHandle->offsetBits = 0;
+
+  while(hitExit == FALSE)
+  {
+    uint32 tmp;
+    uint8 syncByte(0);
+
+    switch(tHandle->transportType)
+    {
+      case INIT_MP_STREAM:
+        frameStatus = SYNC_LOST;
+        tHandle->transportType = GET_1ST_MPSYNC_STREAM;
+        break;
+
+      case GET_1ST_MPSYNC_STREAM:
+        /*
+         * Locate sync and on succes, switch to read
+         * the headers values.
+         */
+        frameStatus = SeekSync(tHandle, &m_Bitstream, execState);
+        if((frameStatus == SYNC_FOUND) && IsMP3FreeFormat(tHandle))
+        {
+          hitExit = TRUE;
+          frameStatus = SYNC_MP3_FREE;
+          tHandle->offsetBits = (int16) (BsGetBitsRead(&m_Bitstream) & 0x7);
+        }
+        else if(frameStatus == SYNC_FOUND)
+          tHandle->transportType = GET_MPHEADER_STREAM;
+        else
+        {
+          hitExit = TRUE;
+          if(frameStatus != SYNC_LOST)
+          {
+            /*
+             * The sync search locates the syncword which is at the
+             * start of the header (1st 12 bits). Also in order to 
+             * make the search reliable, the rest of the header bits
+             * are also checked via lookahead by the sync routine.
+             * Because of this it is possible that the input buffer
+             * may run out of bits in the lookahead part. In that case
+             * the input buffer needs to be updated. The number of bytes
+             * to be updated are calculated based on the number of read 
+             * bits. Thus, in the worst case, the update process will 
+             * throw away the 1st 8 bits from the syncword. This is 
+             * something we don't want to experience since subsequent 
+             * processing relies on the fact that the whole header can 
+             * be read from the input buffer once the start of the frame 
+             * has been found. That's why we reduce the update size of the 
+             * input buffer (shown below).
+             */
+            tmp = BsGetBitsRead(&m_Bitstream);
+            syncByte = syncBuf[MAX(0, ((int32) (tmp >> 3) - 1))];
+            if((tmp & 0x7) && syncByte == 0xFF)
+            {
+              /*-- Keep the previous byte in the buffer as it may be part of header. --*/  
+              tHandle->offsetBits = (int16) (8 + (tmp & 0x7));
+
+              tmp -= 8;
+              BsClearBitsRead(&m_Bitstream);
+              BsSetBitsRead(&m_Bitstream, tmp);
+            }
+            else tHandle->offsetBits = (int16) (tmp & 0x7);
+          }
+        }
+        break;
+    
+      case GET_MPSYNC_STREAM:
+        /*
+         * Locate sync and on succes, switch to read
+         * the headers values.
+         */
+        frameStatus = SeekSync(tHandle, &m_Bitstream, execState);
+        if(frameStatus == SYNC_FOUND)
+          tHandle->transportType = GET_MPHEADER_STREAM;
+        else
+        {
+          hitExit = TRUE;
+          if(frameStatus != SYNC_LOST)
+          {
+            /*-- See explanation above. --*/
+            tmp = BsGetBitsRead(&m_Bitstream);
+            syncByte = syncBuf[MAX(0, ((int32) (tmp >> 3) - 1))];
+            if((tmp & 0x7) && syncByte == 0xFF)
+            {
+              /*-- Keep the previous byte in the buffer as it may be part of header. --*/
+              tHandle->offsetBits = (int16) (8 + (tmp & 0x7));
+
+              tmp -= 8;
+              BsClearBitsRead(&m_Bitstream);
+              BsSetBitsRead(&m_Bitstream, tmp);
+            }
+            else tHandle->offsetBits = (int16) (tmp & 0x7);
+          }
+        }
+        break;
+    
+      case GET_MPHEADER_STREAM:
+        /*
+         * Read headers values and on success, switch the state back
+         * to sync search for next frame.
+         */
+        hitExit = TRUE;
+        frameStatus = decode_header(tHandle, &m_Bitstream);
+        if(frameStatus == SYNC_FOUND)
+          tHandle->transportType = GET_MPSYNC_STREAM;
+        else if(frameStatus != SYNC_LOST)
+        {
+          /*-- Don't loose the syncword... --*/
+          tmp = BsGetBitsRead(&m_Bitstream);
+          syncByte = syncBuf[MAX(0, ((int32) (tmp >> 3) - 1))];
+          if((tmp & 0x7) && syncByte == 0xFF)
+          {
+            /*-- Keep the previous byte in the buffer as it may be part of header. --*/
+            tHandle->offsetBits = (int16) (8 + (tmp & 0x7));
+
+            tmp -= 8;
+            BsClearBitsRead(&m_Bitstream);
+            BsSetBitsRead(&m_Bitstream, tmp);
+          }
+          else tHandle->offsetBits = (int16) (tmp & 0x7);
+        }
+        break;
+    
+      default:
+        hitExit = TRUE;
+        frameStatus = SYNC_LOST;
+        break;
+    }
+  }
+
+  *readBits = BsGetBitsRead(&m_Bitstream);
+  
+  return (frameStatus);
+}
+
+/*
+ * Returns the # of bytes reserved for the Layer I/II/III payload part of current frame.
+ */
+INLINE int16
+mpGetTranportFrameLength(TMpTransportHandle *tHandle)
+{
+  int16 frameBytes;
+
+  tHandle->mainDataSlots = 0;
+
+  switch(tHandle->transportType)
+  {
+    case GET_MPSYNC_STREAM:
+    case GET_MPHEADER_STREAM:
+      tHandle->mainDataSlots = (int16) main_data_slots(tHandle);
+      frameBytes = (int16) (tHandle->mainDataSlots + GetSideInfoSlots(tHandle));
+      break;
+      
+    default:
+      frameBytes = 0;
+      break;
+  }
+  
+  return (frameBytes);
+}
+
+/*
+ * Initializes MPEG Layer I/II/III transport handle.
+ */
+void
+mpInitTransport(TMpTransportHandle *tHandle)
+{
+  ZERO_MEMORY(tHandle, sizeof(TMpTransportHandle));
+
+  tHandle->syncInfo.sync_word = (int16) SYNC_WORD;
+  tHandle->syncInfo.sync_length = (int16) MP_SYNC_WORD_LENGTH;
+  tHandle->syncInfo.sync_mask = (uint16) ((1 << tHandle->syncInfo.sync_length) - 1);
+  tHandle->syncInfo.sync_status = INIT_LAYER3_STREAM;
+  tHandle->transportType = INIT_MP_STREAM;
+  tHandle->execState.execMode = GLITCH_FREE;
+  tHandle->offsetBits = 0;
+}
+
+/**************************************************************************
+  Title        : MP_SeekSync
+
+  Purpose      : Interface to layer I/II/III frame search implementation.
+
+  Usage        : y = MP_SeekSync(tHandle, syncBuf, syncBufLen, readBytes, 
+                                 frameBytes, headerBytes, initMode)
+
+  Input        : tHandle     - layer I/II/III transport handle
+                 syncBuf     - input buffer
+                 syncBufLen  - length of 'sync_buf'
+                 initMode    - '1' when searching the 1st frame, '0' otherwise
+
+  Output       : y           - status of operation
+                 frameBytes  - # of bytes reserved for the payload part of the frame
+                 readBytes   - # of bytes read from the buffer
+                 headerBytes - # of bytes reserved for the header part of the frame
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+int16
+MP_SeekSync(TMpTransportHandle *tHandle, uint8 *syncBuf, uint32 syncBufLen, 
+            int16 *readBytes, int16 *frameBytes, int16 *headerBytes,
+            uint8 initMode)
+{
+  uint32 readBits;
+  SEEK_STATUS syncSeekStatus;
+ 
+  syncSeekStatus = mpSyncTransport(tHandle, syncBuf, syncBufLen, &readBits);
+  if(initMode && syncSeekStatus == SYNC_FOUND)
+    FillDataSlotTable(tHandle);
+
+  *readBytes = (int16) (readBits >> 3);
+  *frameBytes = (int16) mpGetTranportFrameLength(tHandle);
+  *headerBytes = (int16) ((error_protection(&tHandle->header) ? 2 : 0) + 4);
+
+  return (int16) (syncSeekStatus);
+}
+
+/**************************************************************************
+  Title        : MP_FreeMode
+
+  Purpose      : Interface for determining the frame/payload size of free format
+                 layer III bitstream.
+
+  Usage        : y = MP_FreeMode(tHandle, syncBuf, syncBufLen, readBytes, 
+                                 frameBytes, headerBytes)
+
+  Input        : tHandle     - layer I/II/III transport handle
+                 syncBuf     - input buffer
+                 syncBufLen  - length of 'sync_buf'
+
+  Output       : y           - status of operation
+                 frameBytes  - # of bytes reserved for the payload part of the frames
+                 readBytes   - # of bytes read from the buffer
+                 headerBytes - # of bytes reserved for the header part of the frame
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+int16
+MP_FreeMode(TMpTransportHandle *tHandle, uint8 *syncBuf, uint32 syncBufLen, 
+            int16 *readBytes, int16 *frameBytes, int16 *headerBytes)
+{
+  TBitStream m_Bitstream;
+  SEEK_STATUS syncSeekStatus;
+
+  BsInit(&m_Bitstream, syncBuf, syncBufLen);
+
+  if(tHandle->offsetBits)
+    BsSkipNBits(&m_Bitstream, tHandle->offsetBits);
+  tHandle->offsetBits = 0;
+ 
+  syncSeekStatus = FreeFormat(tHandle, &m_Bitstream, &tHandle->execState);
+  if(syncSeekStatus == SYNC_BITS_OUT)
+    tHandle->offsetBits = (int16) (BsGetBitsRead(&m_Bitstream) & 0x7);
+
+  *readBytes = (int16) (BsGetBitsRead(&m_Bitstream) >> 3);
+  *frameBytes = (int16) mpGetTranportFrameLength(tHandle);
+  *headerBytes = (int16) ((error_protection(&tHandle->header) ? 2 : 0) + 4);
+
+  return (int16) (syncSeekStatus);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/bwins/aedmp3aaclibu.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,49 @@
+EXPORTS
+	??1CMPAudDec@@UAE@XZ @ 1 NONAME ; CMPAudDec::~CMPAudDec(void)
+	??1CMp3Edit@@UAE@XZ @ 2 NONAME ; CMp3Edit::~CMp3Edit(void)
+	?AACGetMP4ConfigInfo@@YAFHEEFPAEE@Z @ 3 NONAME ; short AACGetMP4ConfigInfo(int, unsigned char, unsigned char, short, unsigned char *, unsigned char)
+	?BsBufferUpdate@@YAXPAVTBitStream@@H@Z @ 4 NONAME ; void BsBufferUpdate(class TBitStream *, int)
+	?BsByteAlign@@YAFPAVTBitStream@@@Z @ 5 NONAME ; short BsByteAlign(class TBitStream *)
+	?BsClearBitsRead@@YAXPAVTBitStream@@@Z @ 6 NONAME ; void BsClearBitsRead(class TBitStream *)
+	?BsCopyBits@@YAXPAVTBitStream@@0H@Z @ 7 NONAME ; void BsCopyBits(class TBitStream *, class TBitStream *, int)
+	?BsCopyBytes@@YAIPAVTBitStream@@PAEI@Z @ 8 NONAME ; unsigned int BsCopyBytes(class TBitStream *, unsigned char *, unsigned int)
+	?BsGetBits@@YAIPAVTBitStream@@F@Z @ 9 NONAME ; unsigned int BsGetBits(class TBitStream *, short)
+	?BsGetBitsRead@@YAIPAVTBitStream@@@Z @ 10 NONAME ; unsigned int BsGetBitsRead(class TBitStream *)
+	?BsGetBufOriginalSize@@YAIPAVTBitStream@@@Z @ 11 NONAME ; unsigned int BsGetBufOriginalSize(class TBitStream *)
+	?BsGetBufSize@@YAIPAVTBitStream@@@Z @ 12 NONAME ; unsigned int BsGetBufSize(class TBitStream *)
+	?BsInit2@@YAXPAVTBitStream@@PAEI@Z @ 13 NONAME ; void BsInit2(class TBitStream *, unsigned char *, unsigned int)
+	?BsInit@@YAXPAVTBitStream@@PAEI@Z @ 14 NONAME ; void BsInit(class TBitStream *, unsigned char *, unsigned int)
+	?BsLookAhead@@YAIPAVTBitStream@@F@Z @ 15 NONAME ; unsigned int BsLookAhead(class TBitStream *, short)
+	?BsPutBits@@YAXPAVTBitStream@@FI@Z @ 16 NONAME ; void BsPutBits(class TBitStream *, short, unsigned int)
+	?BsPutBitsByteAlign@@YAFPAVTBitStream@@@Z @ 17 NONAME ; short BsPutBitsByteAlign(class TBitStream *)
+	?BsReset@@YAXPAVTBitStream@@@Z @ 18 NONAME ; void BsReset(class TBitStream *)
+	?BsRewindNBits@@YAXPAVTBitStream@@I@Z @ 19 NONAME ; void BsRewindNBits(class TBitStream *, unsigned int)
+	?BsSaveBufState@@YAXPAVTBitStream@@0@Z @ 20 NONAME ; void BsSaveBufState(class TBitStream *, class TBitStream *)
+	?BsSetBitsRead@@YAXPAVTBitStream@@I@Z @ 21 NONAME ; void BsSetBitsRead(class TBitStream *, unsigned int)
+	?BsSkipBits@@YAXPAVTBitStream@@F@Z @ 22 NONAME ; void BsSkipBits(class TBitStream *, short)
+	?BsSkipNBits@@YAXPAVTBitStream@@H@Z @ 23 NONAME ; void BsSkipNBits(class TBitStream *, int)
+	?BsSlotsLeft@@YAIPAVTBitStream@@@Z @ 24 NONAME ; unsigned int BsSlotsLeft(class TBitStream *)
+	?CountAACChunkLength@@YAFPAVTBitStream@@PAVCAACAudDec@@PAF@Z @ 25 NONAME ; short CountAACChunkLength(class TBitStream *, class CAACAudDec *, short *)
+	?CreateAACAudDecL@@YAXAAPAVCAACAudDec@@FF@Z @ 26 NONAME ; void CreateAACAudDecL(class CAACAudDec * &, short, short)
+	?CreateAACPlusAudDecL@@YAEPAVCAACAudDec@@FEE@Z @ 27 NONAME ; unsigned char CreateAACPlusAudDecL(class CAACAudDec *, short, unsigned char, unsigned char)
+	?DeleteAACAudDec@@YAPAVCAACAudDec@@PAV1@@Z @ 28 NONAME ; class CAACAudDec * DeleteAACAudDec(class CAACAudDec *)
+	?EstimateBitrate@CMp3Edit@@QBEFPAVTMpTransportHandle@@E@Z @ 29 NONAME ; short CMp3Edit::EstimateBitrate(class TMpTransportHandle *, unsigned char) const
+	?FileLengthInMs@CMp3Edit@@QBEIPAVTMpTransportHandle@@H@Z @ 30 NONAME ; unsigned int CMp3Edit::FileLengthInMs(class TMpTransportHandle *, int) const
+	?FreeMode@CMp3Edit@@QBEFPAVTMpTransportHandle@@PAEIPAF22@Z @ 31 NONAME ; short CMp3Edit::FreeMode(class TMpTransportHandle *, unsigned char *, unsigned int, short *, short *, short *) const
+	?GetAACGlobalGains@@YAEPAVTBitStream@@PAVCAACAudDec@@EPAEPAI@Z @ 32 NONAME ; unsigned char GetAACGlobalGains(class TBitStream *, class CAACAudDec *, unsigned char, unsigned char *, unsigned int *)
+	?GetFrameTime@CMp3Edit@@QBEHPAVTMpTransportHandle@@@Z @ 33 NONAME ; int CMp3Edit::GetFrameTime(class TMpTransportHandle *) const
+	?GetMPGlobalGains@CMp3Edit@@QAEEPAVTBitStream@@PAVTMpTransportHandle@@PAEPAI@Z @ 34 NONAME ; unsigned char CMp3Edit::GetMPGlobalGains(class TBitStream *, class TMpTransportHandle *, unsigned char *, unsigned int *)
+	?GetSeekOffset@CMp3Edit@@QBEHPAVTMpTransportHandle@@H@Z @ 35 NONAME ; int CMp3Edit::GetSeekOffset(class TMpTransportHandle *, int) const
+	?Init@CMPAudDec@@QAEXPAVTMpTransportHandle@@@Z @ 36 NONAME ; void CMPAudDec::Init(class TMpTransportHandle *)
+	?InitAACAudDec@@YAXPAVCAACAudDec@@FFE@Z @ 37 NONAME ; void InitAACAudDec(class CAACAudDec *, short, short, unsigned char)
+	?InitTransport@CMp3Edit@@QBEXPAVTMpTransportHandle@@@Z @ 38 NONAME ; void CMp3Edit::InitTransport(class TMpTransportHandle *) const
+	?IsAACParametricStereoEnabled@@YAEPAVCAACAudDec@@@Z @ 39 NONAME ; unsigned char IsAACParametricStereoEnabled(class CAACAudDec *)
+	?IsAACSBREnabled@@YAEPAVCAACAudDec@@@Z @ 40 NONAME ; unsigned char IsAACSBREnabled(class CAACAudDec *)
+	?NewL@CMPAudDec@@SAPAV1@XZ @ 41 NONAME ; class CMPAudDec * CMPAudDec::NewL(void)
+	?NewL@CMp3Edit@@SAPAV1@XZ @ 42 NONAME ; class CMp3Edit * CMp3Edit::NewL(void)
+	?ResetAACAudDec@@YAXPAVCAACAudDec@@@Z @ 43 NONAME ; void ResetAACAudDec(class CAACAudDec *)
+	?SeekSync@CMp3Edit@@QBEFPAVTMpTransportHandle@@PAEIPAF22E@Z @ 44 NONAME ; short CMp3Edit::SeekSync(class TMpTransportHandle *, unsigned char *, unsigned int, short *, short *, short *, unsigned char) const
+	?SetAACGlobalGains@@YAXPAVTBitStream@@EPAEPAI@Z @ 45 NONAME ; void SetAACGlobalGains(class TBitStream *, unsigned char, unsigned char *, unsigned int *)
+	?SetAACPlusGlobalGains@@YAXPAVTBitStream@@0PAVCAACAudDec@@FEPAEPAI@Z @ 46 NONAME ; void SetAACPlusGlobalGains(class TBitStream *, class TBitStream *, class CAACAudDec *, short, unsigned char, unsigned char *, unsigned int *)
+	?SetMPGlobalGains@CMp3Edit@@QAEXPAVTBitStream@@EPAEPAI@Z @ 47 NONAME ; void CMp3Edit::SetMPGlobalGains(class TBitStream *, unsigned char, unsigned char *, unsigned int *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/eabi/aedmp3aaclibu.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,52 @@
+EXPORTS
+	_Z10BsCopyBitsP10TBitStreamS0_i @ 1 NONAME
+	_Z10BsSkipBitsP10TBitStreams @ 2 NONAME
+	_Z11BsByteAlignP10TBitStream @ 3 NONAME
+	_Z11BsCopyBytesP10TBitStreamPhj @ 4 NONAME
+	_Z11BsLookAheadP10TBitStreams @ 5 NONAME
+	_Z11BsSkipNBitsP10TBitStreami @ 6 NONAME
+	_Z11BsSlotsLeftP10TBitStream @ 7 NONAME
+	_Z12BsGetBufSizeP10TBitStream @ 8 NONAME
+	_Z13BsGetBitsReadP10TBitStream @ 9 NONAME
+	_Z13BsRewindNBitsP10TBitStreamj @ 10 NONAME
+	_Z13BsSetBitsReadP10TBitStreamj @ 11 NONAME
+	_Z13InitAACAudDecP10CAACAudDecssh @ 12 NONAME
+	_Z14BsBufferUpdateP10TBitStreami @ 13 NONAME
+	_Z14BsSaveBufStateP10TBitStreamS0_ @ 14 NONAME
+	_Z14ResetAACAudDecP10CAACAudDec @ 15 NONAME
+	_Z15BsClearBitsReadP10TBitStream @ 16 NONAME
+	_Z15DeleteAACAudDecP10CAACAudDec @ 17 NONAME
+	_Z15IsAACSBREnabledP10CAACAudDec @ 18 NONAME
+	_Z16CreateAACAudDecLRP10CAACAudDecss @ 19 NONAME
+	_Z17GetAACGlobalGainsP10TBitStreamP10CAACAudDechPhPj @ 20 NONAME
+	_Z17SetAACGlobalGainsP10TBitStreamhPhPj @ 21 NONAME
+	_Z18BsPutBitsByteAlignP10TBitStream @ 22 NONAME
+	_Z19AACGetMP4ConfigInfoihhsPhh @ 23 NONAME
+	_Z19CountAACChunkLengthP10TBitStreamP10CAACAudDecPs @ 24 NONAME
+	_Z20BsGetBufOriginalSizeP10TBitStream @ 25 NONAME
+	_Z20CreateAACPlusAudDecLP10CAACAudDecshh @ 26 NONAME
+	_Z21SetAACPlusGlobalGainsP10TBitStreamS0_P10CAACAudDecshPhPj @ 27 NONAME
+	_Z28IsAACParametricStereoEnabledP10CAACAudDec @ 28 NONAME
+	_Z6BsInitP10TBitStreamPhj @ 29 NONAME
+	_Z7BsResetP10TBitStream @ 30 NONAME
+	_Z9BsGetBitsP10TBitStreams @ 31 NONAME
+	_Z9BsPutBitsP10TBitStreamsj @ 32 NONAME
+	_ZN8CMp3Edit16GetMPGlobalGainsEP10TBitStreamP18TMpTransportHandlePhPj @ 33 NONAME
+	_ZN8CMp3Edit16SetMPGlobalGainsEP10TBitStreamhPhPj @ 34 NONAME
+	_ZN8CMp3Edit4NewLEv @ 35 NONAME
+	_ZN8CMp3EditD0Ev @ 36 NONAME
+	_ZN8CMp3EditD1Ev @ 37 NONAME
+	_ZN8CMp3EditD2Ev @ 38 NONAME
+	_ZN9CMPAudDec4InitEP18TMpTransportHandle @ 39 NONAME
+	_ZN9CMPAudDec4NewLEv @ 40 NONAME
+	_ZN9CMPAudDecD0Ev @ 41 NONAME
+	_ZN9CMPAudDecD1Ev @ 42 NONAME
+	_ZN9CMPAudDecD2Ev @ 43 NONAME
+	_ZNK8CMp3Edit12GetFrameTimeEP18TMpTransportHandle @ 44 NONAME
+	_ZNK8CMp3Edit13GetSeekOffsetEP18TMpTransportHandlei @ 45 NONAME
+	_ZNK8CMp3Edit13InitTransportEP18TMpTransportHandle @ 46 NONAME
+	_ZNK8CMp3Edit14FileLengthInMsEP18TMpTransportHandlei @ 47 NONAME
+	_ZNK8CMp3Edit15EstimateBitrateEP18TMpTransportHandleh @ 48 NONAME
+	_ZNK8CMp3Edit8FreeModeEP18TMpTransportHandlePhjPsS3_S3_ @ 49 NONAME
+	_ZNK8CMp3Edit8SeekSyncEP18TMpTransportHandlePhjPsS3_S3_h @ 50 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/group/aedmp3aacLib.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+
+TARGET          aedmp3aaclib.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10204BF3
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+NOEXPORTLIBRARY
+
+SOURCEPATH     ../src
+
+SOURCE		AudPanic.cpp
+SOURCE		mp3API.cpp
+SOURCE		mstream.cpp
+
+SOURCEPATH     ../AACGain/src
+
+SOURCE		aacaud.cpp
+SOURCE		dec_huftables.cpp
+SOURCE		huffdec1.cpp
+SOURCE		huffdec2.cpp
+SOURCE		huffdec3.cpp
+SOURCE		coupling.cpp
+SOURCE		sfbdata.cpp
+SOURCE		nok_bits2.cpp
+SOURCE		Tool.cpp
+SOURCE		aacdef.cpp
+SOURCE		chandefs.cpp
+SOURCE		sbr_bitmux.cpp
+SOURCE		sbr_demux.cpp
+SOURCE		sbr_codec.cpp
+SOURCE		sbr_freq_sca.cpp
+SOURCE		sbr_rom.cpp
+
+SOURCEPATH		../MP3Gain/src
+
+SOURCE		mpif.cpp
+SOURCE		l3huffman.cpp
+SOURCE		l3sfb.cpp
+SOURCE		layer3.cpp
+SOURCE		mpaud.cpp
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE	/epoc32/include/libc
+
+USERINCLUDE		../inc
+USERINCLUDE		../AACGain/inc
+USERINCLUDE		../MP3Gain/inc
+USERINCLUDE		../../AudioEditorEngine/Inc
+
+LIBRARY         euser.lib
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/group/aedmp3aacLibLib.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+TARGET          aedmp3aaclib.lib
+TARGETTYPE      IMPLIB
+UID             0x1000008d 0x10204BF3
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+aedmp3aacLib.mmp
+aedmp3aacLibLib.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/inc/AACAPI.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef _MP3AACMANIPLIB_H_
+#define _MP3AACMANIPLIB_H_
+
+#include "tool.h"
+#include "sbr_codec.h"
+
+/*
+  Purpose:     AAC decoder core.
+  Explanation: - 
+
+    Implemented in aacaud.cpp
+*/
+
+class CAACAudDec : public CBase
+{
+    
+public:
+    
+    static CAACAudDec* NewL(int16 aNumCh, int16 aNumCCh);
+    ~CAACAudDec();
+    
+    void GetFIL(TBitStream *bs, uint32 prevEleID);
+    int32 extension_payload(TBitStream *bs, int32 cnt, uint32 prevEleID);
+    
+    int16 numCh;
+    int16 numCCh;
+    int16 numOutCh;
+    int16 samplesPerFrame;
+    
+    CToolInfo **tool;
+    CMC_Info* mc_info;
+    CCInfo **ccInfo;
+    CWindowInfo **winInfo;
+    
+    /*-- Huffman tables. --*/
+    Huffman_DecInfo **huf;
+    Huffman_DecSfInfo *sf_huf;
+    
+    SbrBitStream *sbrStream;
+    SBR_Decoder *sbrDecInfo;
+    
+private:
+    void ConstructL(int16 aNumCh, int16 aNumCCh);
+    CAACAudDec();
+    
+    TInt windowAmount;
+    
+};
+
+/*
+*    Methods for AAC gain manipulation -------------->
+*/
+
+/*-- Closes AAC decoder handle. --*/
+IMPORT_C CAACAudDec *
+DeleteAACAudDec(CAACAudDec *aac);
+
+/*-- Creates AAC decoder handle. --*/
+IMPORT_C void
+CreateAACAudDecL(CAACAudDec*& aDecHandle, int16 numCh, int16 numCCh);
+
+
+/*-- Creates (e)AAC+ decoder handle. --*/
+IMPORT_C uint8
+CreateAACPlusAudDecL(CAACAudDec *aDecHandle, int16 sampleRateIdx, uint8 isStereo, uint8 isDualMono);
+
+
+/*-- Initializes AAC decoder handle. --*/
+IMPORT_C void
+InitAACAudDec(CAACAudDec *aac, int16 profile, int16 sampleRateIdx, uint8 is960);
+
+/*-- Resets AAC decoder handle. --*/
+IMPORT_C void
+ResetAACAudDec(CAACAudDec *aac);
+
+/*-- Counts AAC frame length (and parses the frame at same cost). --*/
+IMPORT_C int16
+CountAACChunkLength(TBitStream *bs, CAACAudDec *aac, int16 *bytesInFrame);
+
+/*-- Stores global gain values. --*/
+IMPORT_C void
+SetAACGlobalGains(TBitStream* bs,
+                  uint8 numGains, uint8 *globalGain, uint32 *globalGainPos);
+
+
+IMPORT_C void
+SetAACPlusGlobalGains(TBitStream* bs, TBitStream* bsOut, CAACAudDec *aac, int16 gainChangeValue,
+                  uint8 numGains, uint8 *globalGain, uint32 *globalGainPos);
+
+
+/*-- Extracts global gain values. --*/
+IMPORT_C uint8
+GetAACGlobalGains(TBitStream* bs, CAACAudDec *aac, uint8 nBufs, uint8 *globalGain, uint32 *globalGainPos);
+
+/**
+ *
+ * Retrieves decoder specific information for the
+ * specified AAC encoder configuration. This information should be
+ * placed in the MP4/3GP header to describe the encoder
+ * parameters for the AAC decoder at the receiving end.
+ *
+ * @param aacInfo     Handle to AAC configuration information
+ * @param pBuf        Pointer to decoder specific information buffer
+ * @param nBytesInBuf Size of 'pBuf'
+ *
+ * @return          Number of bytes in 'pBuf'
+ */
+IMPORT_C int16
+AACGetMP4ConfigInfo(int32 sampleRate, uint8 profile, uint8 nChannels, int16 frameLen,
+                    uint8 *pBuf, uint8 nBytesInBuf);
+
+
+/*-- Checks whether parametric stereo enabled in the AAC bitstream. --*/
+IMPORT_C uint8
+IsAACParametricStereoEnabled(CAACAudDec *aac);
+
+
+
+/*-- Checks whether SBR enabled in the AAC bitstream. --*/
+IMPORT_C uint8
+IsAACSBREnabled(CAACAudDec *aac);
+
+
+/*
+* <-------    Methods for AAC gain manipulation
+*/
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/inc/Mp3API.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+
+#ifndef _MP3API_
+#define    _MP3API_
+
+
+#include "defines.h"
+#include "mstream.h"
+
+
+
+
+
+/*
+   Purpose:     Structure interface for MP1/2/3 transport stream.
+   Explanation: - */
+class TMpTransportHandle
+{
+public:
+
+  TMPEG_Header header;
+  TMPEG_Header headerOld;
+
+  int16 SlotTable[15];
+  int16 FreeFormatSlots;      /*-- Number of bytes in free format frame.     */
+
+  int16 mainDataSlots;        /*-- Payload size.                             */
+
+  BOOL ms_stereo;             /* MS (Mid/Side) stereo used.                  */
+  BOOL is_stereo;             /* Intensity stereo used.                      */
+  BOOL lsf;                   /* MPEG-2 LSF stream present.                  */
+  BOOL mpeg25;                /* MPEG-2.5 stream present.                    */
+
+  /*-- Transport stream to be used/in use. --*/
+  SYNC_STATUS transportType;
+  SyncInfo syncInfo;
+
+  /*-- Exec state when seeking next MPx frame. --*/
+  int16 offsetBits;
+  ExecState execState;
+
+  /*-- CRC codeword. --*/
+  TCRC_Check crc;
+
+  /*-- Average number of bytes reserved for each frame. --*/
+  int32 aveFrameLen;
+  
+};
+
+
+/**
+ * Data structure for mp3 frame search.
+ */
+class TMpFrameState
+{
+public:
+  /**
+   * Number of read bytes when searching start of frame. 
+   * This value is within the input buffer and also the header
+   * is read after start of frame has been found.
+   */
+  int16 readBytes;
+
+  /**
+   * Number of header bytes present for current MP3 frame.
+   */
+  int16 headerBytes;
+
+  /**
+   * Number of payload bytes for current MP3 frame. The total frame
+   * size is 'headerBytes' + 'frameBytes'.
+   */
+  int16 frameBytes;
+
+  /**
+   * Total number of bytes read when searching the start of frame.
+   */
+  int32 totalReadBytes;
+
+};
+
+
+
+
+/*
+   Purpose:     Parameters of core engine.
+   Explanation: - */
+class CMPAudDec : public CBase
+{
+public:
+
+    IMPORT_C static CMPAudDec* NewL();
+    IMPORT_C ~CMPAudDec();
+    IMPORT_C void Init(TMpTransportHandle *aMpFileFormat);
+
+    /*-- Common to all layers. --*/
+    uint8 *bitReserv;
+    TMPEG_Frame *frame;
+
+    /*-- Layer III specific parameters. --*/
+    TBitStream br;
+    CHuffman *huffman;
+    CIII_Side_Info *side_info;
+
+    int16 PrevSlots;
+    //int32 FrameStart;
+    BOOL SkipBr;
+    BOOL WasSeeking;
+
+    /*-- Transport handle. --*/
+    TMpTransportHandle *mpFileFormat;
+
+  
+private:
+
+    CMPAudDec();
+    void ConstructL();
+
+};
+
+class CMp3Edit : public CBase
+    {
+
+public:
+
+    IMPORT_C static CMp3Edit* NewL();
+    IMPORT_C ~CMp3Edit();
+
+    IMPORT_C uint32
+    FileLengthInMs(TMpTransportHandle *tHandle, int32 fileSize) const;
+
+    IMPORT_C int32
+    GetSeekOffset(TMpTransportHandle *tHandle, int32 seekPos) const;
+
+    IMPORT_C int32
+    GetFrameTime(TMpTransportHandle *tHandle) const;
+
+    IMPORT_C void 
+    InitTransport(TMpTransportHandle *tHandle) const;
+
+    IMPORT_C int16
+    SeekSync(TMpTransportHandle *tHandle, uint8 *syncBuf, 
+            uint32 syncBufLen, int16 *readBytes, 
+            int16 *frameBytes, int16 *headerBytes,
+            uint8 initMode) const;
+
+    IMPORT_C int16
+        FreeMode(TMpTransportHandle *tHandle, uint8 *syncBuf, 
+        uint32 syncBufLen, int16 *readBytes, 
+        int16 *frameBytes, int16 *headerBytes) const;
+    
+    IMPORT_C int16
+        EstimateBitrate(TMpTransportHandle *tHandle, uint8 isVbr) const;
+    
+
+
+
+    /*-- Closes MPEG Layer I/II/III decoder handle. --*/
+    IMPORT_C CMPAudDec *
+        DeleteMPAudDec(CMPAudDec *mpAud);
+    
+    /*-- Creates MPEG Layer I/II/III decoder handle. --*/
+    IMPORT_C CMPAudDec *
+        CreateMPAudDec(void);
+    
+    /*-- Initializes MPEG Layer I/II/III decoder handle. --*/
+    IMPORT_C void
+        InitMPAudDec(CMPAudDec *mpAud, TMpTransportHandle *mpFileFormat);
+    
+    /*-- Resets MPEG Layer I/II/III decoder handle. --*/
+    IMPORT_C void
+        ResetMPAudDec(CMPAudDec *mpAud);
+    
+    /*-- Stores global gain values. --*/
+    IMPORT_C void
+        SetMPGlobalGains(TBitStream *bs, uint8 numGains, uint8 *globalGain, uint32 *gainPos);
+    
+    /*-- Extracts global gain values. --*/
+    IMPORT_C uint8
+        GetMPGlobalGains(TBitStream *bs, TMpTransportHandle *tHandle, uint8 *globalGain, uint32 *gainPos);
+
+private:
+    
+    void ConstructL();
+    CMp3Edit();
+
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/inc/Mp3MixAPI.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef MP3MIXAPI__H
+#define MP3MIXAPI__H
+
+#include "ProcInFileHandler.h"
+#include "ProcOutFileHandler.h"
+#include "imdct2.h"
+#include "editdef.h"
+
+
+class CImdct2;
+
+class CMp3Mix : public CBase
+    {
+
+public:
+
+    IMPORT_C static CMp3Mix* NewL();
+    IMPORT_C ~CMp3Mix();
+    
+    IMPORT_C TBool StartMixingL(CProcInFileHandler* aMP3InFileHandler1, 
+                                TInt aStartPosMilli1,
+                                CProcInFileHandler* aMP3InFileHandler2,
+                                TInt aStartPosMilli2,
+                                CProcOutFileHandler* aMP3OutFileHandler,
+                                TInt aBitrateShort,
+                                TInt aBitrateLong,
+                                   TInt& aMixingDuration);
+
+    IMPORT_C TBool MixFrameL(HBufC8* aMP3InBuffer1, HBufC8* aMP3InBuffer2, TInt& aFramesProcessed);
+
+    IMPORT_C TBool StopMixing();
+
+
+    static TBool WriteL(TDesC& aMessage);
+    TBool WriteFloatsL(FLOAT* aArray, TInt aLen) const;
+    TBool WriteIntsL(TInt16* aArray, TInt aLen);
+
+
+
+private:
+
+    void ConstructL();
+    CMp3Mix();
+
+    CProcInFileHandler* iIn1;
+    CProcInFileHandler* iIn2;
+    CProcOutFileHandler* iOut1;
+    TAudioMixerInputInfo* iInfo;
+    CEditorAPIHandle* iEditorAPIHandle1;
+    CEditorAPIHandle* iEditorAPIHandle2;
+    TUint iFrameCount1;
+    TUint iFrameCount2;
+
+    CEditorChunk* iChunk1;
+    CEditorChunk* iChunk2;
+
+
+    TUint iFramesMixed;
+
+    CL3MixerHelper* iL3Mix;
+    CImdct2* imdct2; 
+
+    TInt iMixingDuration;
+
+    RFile* iFile;
+    RFs* iFs;
+    TBool iFileOpened;
+    HBufC8* iWriteBuffer; 
+
+
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/inc/ProcConstants.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,964 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/* Copyright (C) 2004 Nokia Corporation. */
+
+#ifndef __PROCCONSTANTS_H__
+#define __PROCCONSTANTS_H__
+
+#include <e32std.h>
+
+const TInt KAmrBitRates[] = 
+    {
+    4750,
+    5150,
+    5900,
+    6700,
+    7400,
+    7950,
+    10200,
+    12200
+    };
+
+// bit locations for fixed codebook gains
+
+// subframe 1, bitrate 12.2 kBit/s
+const TUint8 KAmrGains122_1[] = {59+8,63+8,67+8,92+8,104+8};
+// subframe 2, bitrate 12.2 kBit/s
+const TUint8 KAmrGains122_2[] = {60+8,64+8,68+8,93+8,105+8};
+// subframe 3, bitrate 12.2 kBit/s
+const TUint8 KAmrGains122_3[] = {61+8,65+8,69+8,94+8,106+8};
+// subframe 4, bitrate 12.2 kBit/s
+const TUint8 KAmrGains122_4[] = {62+8,66+8,70+8,95+8,107+8};
+
+// subframe 1, bitrate 7.95 kBit/s
+const TUint8 KAmrGains795_1[] = {23+8,27+8,31+8,59+8,83+8};
+// subframe 2, bitrate 7.95 kBit/s
+const TUint8 KAmrGains795_2[] = {24+8,28+8,32+8,60+8,84+8};
+// subframe 3, bitrate 7.95 kBit/s
+const TUint8 KAmrGains795_3[] = {25+8,29+8,33+8,61+8,85+8};
+// subframe 4, bitrate 7.95 kBit/s
+const TUint8 KAmrGains795_4[] = {26+8,30+8,34+8,62+8,86+8};
+
+
+// subframe 1, bitrate 10.2 kBit/s
+const TUint8 KAmrGains102_1[] = {33+8,53+8,83+8,34+8,35+8,82+8,84+8};
+// subframe 2, bitrate 10.2 kBit/s
+const TUint8 KAmrGains102_2[] = {36+8,54+8,86+8,37+8,38+8,85+8,87+8};
+// subframe 3, bitrate 10.2 kBit/s
+const TUint8 KAmrGains102_3[] = {39+8,55+8,89+8,40+8,41+8,88+8,90+8};
+// subframe 4, bitrate 10.2 kBit/s
+const TUint8 KAmrGains102_4[] = {42+8,56+8,92+8,43+8,44+8,91+8,93+8};
+
+
+// subframe 1, bitrate 7.4 kBit/s
+const TUint8 KAmrGains740_1[] = {27+8,31+8,78+8,35+8,39+8,57+8,68+8};
+// subframe 2, bitrate 7.4 kBit/s
+const TUint8 KAmrGains740_2[] = {28+8,32+8,79+8,36+8,40+8,58+8,69+8};
+// subframe 3, bitrate 7.4 kBit/s
+const TUint8 KAmrGains740_3[] = {29+8,33+8,80+8,37+8,41+8,59+8,70+8};
+// subframe 4, bitrate 7.4 kBit/s
+const TUint8 KAmrGains740_4[] = {30+8,34+8,81+8,38+8,42+8,60+8,71+8};
+
+
+// subframe 1, bitrate 6.7 kBit/s
+const TUint8 KAmrGains670_1[] = {35+8,85+8,66+8,41+8,45+8,55+8,74+8};
+// subframe 2, bitrate 6.7 kBit/s
+const TUint8 KAmrGains670_2[] = {36+8,84+8,67+8,42+8,46+8,56+8,75+8};
+// subframe 3, bitrate 6.7 kBit/s
+const TUint8 KAmrGains670_3[] = {37+8,83+8,68+8,43+8,47+8,57+8,76+8};
+// subframe 4, bitrate 6.7 kBit/s
+const TUint8 KAmrGains670_4[] = {38+8,82+8,69+8,44+8,48+8,58+8,77+8};
+
+
+// subframe 1, bitrate 5.9 kBit/s
+const TUint8 KAmrGains590_1[] = {76+8,55+8,51+8,47+8,37+8,29+8};
+// subframe 2, bitrate 5.9 kBit/s
+const TUint8 KAmrGains590_2[] = {77+8,56+8,52+8,48+8,38+8,30+8};
+// subframe 3, bitrate 5.9 kBit/s
+const TUint8 KAmrGains590_3[] = {78+8,57+8,53+8,49+8,39+8,31+8};
+// subframe 4, bitrate 5.9 kBit/s
+const TUint8 KAmrGains590_4[] = {79+8,58+8,54+8,50+8,40+8,32+8};
+
+
+
+// subframe 1, bitrate 5.15 kBit/s
+const TUint8 KAmrGains515_1[] = {55+8,45+8,36+8,26+8,25+8,24+8};
+// subframe 2, bitrate 5.15 kBit/s
+const TUint8 KAmrGains515_2[] = {56+8,46+8,37+8,29+8,28+8,27+8};
+// subframe 3, bitrate 5.15 kBit/s
+const TUint8 KAmrGains515_3[] = {57+8,47+8,38+8,32+8,31+8,30+8};
+// subframe 4, bitrate 5.15 kBit/s
+const TUint8 KAmrGains515_4[] = {58+8,48+8,39+8,35+8,34+8,33+8};
+
+
+//subframes 1 & s, bitrate 4.75 kBit/s
+const TUint8 KAmrGains475_1_2[] = {49+8,48+8,47+8,46+8,31+8,30+8,29+8,28+8};
+const TUint8 KAmrGains475_3_4[] = {43+8,42+8,41+8,40+8,35+8,34+8,33+8,32+8};
+
+
+// Gain table 12.2 kBit/s and 7.95 kBit/s, scalar quantized
+const TInt KAmrGainTable122[] = 
+    {
+    159,
+    206,
+    268,
+    349,
+    419,
+    482,
+    554,
+    637,
+    733,
+    842,
+    969,
+    1114,
+    1281,
+    1473,
+    1694,
+    1948,
+    2241,
+    2577,
+    2963,
+    3408,
+    3919,
+    4507,
+    5183,
+    5960,
+    6855,
+    7883,
+    9065,
+    10425,
+    12510,
+    16263,
+    21142,
+    27485
+    };
+
+const TInt KAmrLargestGain122 = 27485;
+
+// Gain table, 10.2, 6.70 and 7.40 kBit/s vector quantized
+
+// index = 0...127
+// KAmrGainTable[2*index] = g_pitch
+// KAmrGainTable[2*index+1] = g_fac (fixed codebook gain)
+
+const TInt KAmrGainTable102[] =
+    {
+//g_pit,    g_fac 
+    577,      662,        
+    806,     1836,           
+   3109,     1052,   
+   4181,     1387,           
+   2373,     1425,           
+   3248,     1985,           
+   1827,     2320,           
+    941,     3314,           
+   2351,     2977,           
+   3616,     2420,           
+   3451,     3096,           
+   2955,     4301,           
+   1848,     4500,           
+   3884,     5416,           
+   1187,     7210,           
+   3083,     9000,           
+   7384,      883,           
+   5962,     1506,           
+   5155,     2134,           
+   7944,     2009,           
+   6507,     2250,           
+   7670,     2752,           
+   5952,     3016,           
+   4898,     3764,           
+   6989,     3588,           
+   8174,     3978,           
+   6064,     4404,           
+   7709,     5087,           
+   5523,     6021,           
+   7769,     7126,           
+   6060,     7938,           
+   5594,    11487,           
+  10581,     1356,           
+   9049,     1597,           
+   9794,     2035,           
+   8946,     2415,            
+  10296,     2584,         
+   9407,     2734,            
+   8700,     3218,            
+   9757,     3395,            
+  10177,     3892,             
+   9170,     4528,            
+  10152,     5004,            
+   9114,     5735,            
+  10500,     6266,           
+  10110,     7631,            
+   8844,     8727,            
+   8956,    12496,          
+  12924,      976,          
+  11435,     1755,           
+  12138,     2328,            
+  11388,     2368,            
+  10700,     3064,            
+  12332,     2861,            
+  11722,     3327,            
+  11270,     3700,            
+  10861,     4413,           
+  12082,     4533,             
+  11283,     5205,            
+  11960,     6305,            
+  11167,     7534,             
+  12128,     8329,            
+  10969,    10777,            
+  10300,    17376,            
+  13899,     1681,           
+  12580,     2045,          
+  13265,     2439,           
+  14033,     2989,            
+  13452,     3098,           
+  12396,     3658,           
+  13510,     3780,            
+  12880,     4272,             
+  13533,     4861,           
+  12667,     5457,             
+  13854,     6106,             
+  13031,     6483,           
+  13557,     7721,             
+  12957,     9311,           
+  13714,    11551,            
+  12591,    15206,           
+  15113,     1540,           
+  15072,     2333,            
+  14527,     2511,           
+  14692,     3199,            
+  15382,     3560,           
+  14133,     3960,             
+  15102,     4236,             
+  14332,     4824,            
+  14846,     5451,           
+  15306,     6083,            
+  14329,     6888,           
+  15060,     7689,             
+  14406,     9426,           
+  15387,     9741,           
+  14824,    14271,           
+  13600,    24939,          
+  16396,     1969,           
+  16817,     2832,           
+  15713,     2843,            
+  16104,     3336,            
+  16384,     3963,            
+  16940,     4579,             
+  15711,     4599,            
+  16222,     5448,             
+  16832,     6382,            
+  15745,     7141,            
+  16326,     7469,           
+  16611,     8624,          
+  17028,    10418,           
+  15905,    11817,            
+  16878,    14690,            
+  16515,    20870,            
+  18142,     2083,            
+  19401,     3178,           
+  17508,     3426,            
+  20054,     4027,            
+  18069,     4249,             
+  18952,     5066,             
+  17711,     5402,             
+  19835,     6192,             
+  17950,     7014,            
+  21318,     7877,             
+  17910,     9289,           
+  19144,     9290,           
+  20517,    11381,           
+  18075,    14485,            
+  19999,    17882,            
+  18842,    32764
+  };
+
+const TInt KAmrLargestGain102 = 32764;
+
+
+// Gain table, 5.9 and 5.15 kBit/s vector quantized
+
+// index = 0...127
+// KAmrGainTable[2*index] = g_pitch
+// KAmrGainTable[2*index+1] = g_fac (fixed codebook gain)
+
+const TInt KAmrGainTable590[] =
+    {
+//g_pit,    g_fac  
+  10813,    28753,            
+  20480,     2785,          
+  18841,     6594,           
+   6225,     7413,           
+  17203,    10444,           
+  21626,     1269,           
+  21135,     4423,           
+  11304,     1556,           
+  19005,    12820,            
+  17367,     2498,           
+  17858,     4833,            
+   9994,     2498,           
+  17530,     7864,            
+  14254,     1884,          
+  15892,     3153,            
+   6717,     1802,           
+  18186,    20193,            
+  18022,     3031,            
+  16711,     5857,             
+   8847,     4014,            
+  15892,     8970,            
+  18022,     1392,           
+  16711,     4096,              
+   8192,      655,           
+  15237,    13926,            
+  14254,     3112,            
+  14090,     4669,            
+   5406,     2703,            
+  13434,     6553,             
+  12451,      901,           
+  12451,     2662,           
+   3768,      655,           
+  14745,    23511,            
+  19169,     2457,            
+  20152,     5079,            
+   6881,     4096,               
+  20480,     8560,           
+  19660,      737,           
+  19005,     4259,             
+   7864,     2088,            
+  11468,    12288,           
+  15892,     1474,           
+  15728,     4628,            
+   9175,     1433,           
+  16056,     7004,           
+  14827,      737,          
+  15073,     2252,           
+   5079,     1228,           
+  13271,    17326,           
+  16547,     2334,            
+  15073,     5816,             
+   3932,     3686,           
+  14254,     8601,           
+  16875,      778,           
+  15073,     3809,           
+   6062,      614,           
+   9338,     9256,            
+  13271,     1761,           
+  13271,     3522,           
+   2457,     1966,           
+  11468,     5529,            
+  10485,      737,           
+  11632,     3194,           
+   1474,      778           
+    };
+
+const TInt KAmrLargestGain590 = 23511;
+
+
+// index = 0...127
+// KAmrGainTable[4*index] = g_pitch(even frame)
+// KAmrGainTable[4*index+1] = g_fac(even frame)
+// KAmrGainTable[4*index+2] = g_pitch(odd frame)
+// KAmrGainTable[4*index+3] = g_fac(odd frame)
+
+
+const TInt KAmrGainTable475[] = 
+    {
+//g_pit(0),    g_fac(0),      g_pit(1),    g_fac(1)      
+   812,          128,           542,      140,
+  2873,         1135,          2266,     3402,
+  2067,          563,         12677,      647,
+  4132,         1798,          5601,     5285,
+  7689,          374,          3735,      441,
+ 10912,         2638,         11807,     2494,
+ 20490,          797,          5218,      675,
+  6724,         8354,          5282,     1696,
+  1488,          428,          5882,      452,
+  5332,         4072,          3583,     1268,
+  2469,          901,         15894,     1005,
+ 14982,         3271,         10331,     4858,
+  3635,         2021,          2596,      835,
+ 12360,         4892,         12206,     1704,
+ 13432,         1604,          9118,     2341,
+  3968,         1538,          5479,     9936,
+  3795,          417,          1359,      414,
+  3640,         1569,          7995,     3541,
+ 11405,          645,          8552,      635,
+  4056,         1377,         16608,     6124,
+ 11420,          700,          2007,      607,
+ 12415,         1578,         11119,     4654,
+ 13680,         1708,         11990,     1229,
+  7996,         7297,         13231,     5715,
+  2428,         1159,          2073,     1941,
+  6218,         6121,          3546,     1804,
+  8925,         1802,          8679,     1580,
+ 13935,         3576,         13313,     6237,
+  6142,         1130,          5994,     1734,
+ 14141,         4662,         11271,     3321,
+ 12226,         1551,         13931,     3015,
+  5081,        10464,          9444,     6706,
+  1689,          683,          1436,     1306,
+  7212,         3933,          4082,     2713,
+  7793,          704,         15070,      802,
+  6299,         5212,          4337,     5357,
+  6676,          541,          6062,      626,
+ 13651,         3700,         11498,     2408,
+ 16156,          716,         12177,      751,
+  8065,        11489,          6314,     2256,
+  4466,          496,          7293,      523,
+ 10213,         3833,          8394,     3037,
+  8403,          966,         14228,     1880,
+  8703,         5409,         16395,     4863,
+  7420,         1979,          6089,     1230,
+  9371,         4398,         14558,     3363,
+ 13559,         2873,         13163,     1465,
+  5534,         1678,         13138,    14771,
+  7338,          600,          1318,      548,
+  4252,         3539,         10044,     2364,
+ 10587,          622,         13088,      669,
+ 14126,         3526,          5039,     9784,
+ 15338,          619,          3115,      590,
+ 16442,         3013,         15542,     4168,
+ 15537,         1611,         15405,     1228,
+ 16023,         9299,          7534,     4976,
+  1990,         1213,         11447,     1157,
+ 12512,         5519,          9475,     2644,
+  7716,         2034,         13280,     2239,
+ 16011,         5093,          8066,     6761,
+ 10083,         1413,          5002,     2347,
+ 12523,         5975,         15126,     2899,
+ 18264,         2289,         15827,     2527,
+ 16265,        10254,         14651,    11319,
+  1797,          337,          3115,      397,
+  3510,         2928,          4592,     2670,
+  7519,          628,         11415,      656,
+  5946,         2435,          6544,     7367,
+  8238,          829,          4000,      863,
+ 10032,         2492,         16057,     3551,
+ 18204,         1054,          6103,     1454,
+  5884,         7900,         18752,     3468,
+  1864,          544,          9198,      683,
+ 11623,         4160,          4594,     1644,
+  3158,         1157,         15953,     2560,
+ 12349,         3733,         17420,     5260,
+  6106,         2004,          2917,     1742,
+ 16467,         5257,         16787,     1680,
+ 17205,         1759,          4773,     3231,
+  7386,         6035,         14342,    10012,
+  4035,          442,          4194,      458,
+  9214,         2242,          7427,     4217,
+ 12860,          801,         11186,      825,
+ 12648,         2084,         12956,     6554,
+  9505,          996,          6629,      985,
+ 10537,         2502,         15289,     5006,
+ 12602,         2055,         15484,     1653,
+ 16194,         6921,         14231,     5790,
+  2626,          828,          5615,     1686,
+ 13663,         5778,          3668,     1554,
+ 11313,         2633,          9770,     1459,
+ 14003,         4733,         15897,     6291,
+  6278,         1870,          7910,     2285,
+ 16978,         4571,         16576,     3849,
+ 15248,         2311,         16023,     3244,
+ 14459,        17808,         11847,     2763,
+  1981,         1407,          1400,      876,
+  4335,         3547,          4391,     4210,
+  5405,          680,         17461,      781,
+  6501,         5118,          8091,     7677,
+  7355,          794,          8333,     1182,
+ 15041,         3160,         14928,     3039,
+ 20421,          880,         14545,      852,
+ 12337,        14708,          6904,     1920,
+  4225,          933,          8218,     1087,
+ 10659,         4084,         10082,     4533,
+  2735,          840,         20657,     1081,
+ 16711,         5966,         15873,     4578,
+ 10871,         2574,          3773,     1166,
+ 14519,         4044,         20699,     2627,
+ 15219,         2734,         15274,     2186,
+  6257,         3226,         13125,    19480,
+  7196,          930,          2462,     1618,
+  4515,         3092,         13852,     4277,
+ 10460,          833,         17339,      810,
+ 16891,         2289,         15546,     8217,
+ 13603,         1684,          3197,     1834,
+ 15948,         2820,         15812,     5327,
+ 17006,         2438,         16788,     1326,
+ 15671,         8156,         11726,     8556,
+  3762,         2053,          9563,     1317,
+ 13561,         6790,         12227,     1936,
+  8180,         3550,         13287,     1778,
+ 16299,         6599,         16291,     7758,
+  8521,         2551,          7225,     2645,
+ 18269,         7489,         16885,     2248,
+ 17882,         2884,         17265,     3328,
+  9417,        20162,         11042,     8320,
+  1286,          620,          1431,      583,
+  5993,         2289,          3978,     3626,
+  5144,          752,         13409,      830,
+  5553,         2860,         11764,     5908,
+ 10737,          560,          5446,      564,
+ 13321,         3008,         11946,     3683,
+ 19887,          798,          9825,      728,
+ 13663,         8748,          7391,     3053,
+  2515,          778,          6050,      833,
+  6469,         5074,          8305,     2463,
+  6141,         1865,         15308,     1262,
+ 14408,         4547,         13663,     4515,
+  3137,         2983,          2479,     1259,
+ 15088,         4647,         15382,     2607,
+ 14492,         2392,         12462,     2537,
+  7539,         2949,         12909,    12060,
+  5468,          684,          3141,      722,
+  5081,         1274,         12732,     4200,
+ 15302,          681,          7819,      592,
+  6534,         2021,         16478,     8737,
+ 13364,          882,          5397,      899,
+ 14656,         2178,         14741,     4227,
+ 14270,         1298,         13929,     2029,
+ 15477,         7482,         15815,     4572,
+  2521,         2013,          5062,     1804,
+  5159,         6582,          7130,     3597,
+ 10920,         1611,         11729,     1708,
+ 16903,         3455,         16268,     6640,
+  9306,         1007,          9369,     2106,
+ 19182,         5037,         12441,     4269,
+ 15919,         1332,         15357,     3512,
+ 11898,        14141,         16101,     6854,
+  2010,          737,          3779,      861,
+ 11454,         2880,          3564,     3540,
+  9057,         1241,         12391,      896,
+  8546,         4629,         11561,     5776,
+  8129,          589,          8218,      588,
+ 18728,         3755,         12973,     3149,
+ 15729,          758,         16634,      754,
+ 15222,        11138,         15871,     2208,
+  4673,          610,         10218,      678,
+ 15257,         4146,          5729,     3327,
+  8377,         1670,         19862,     2321,
+ 15450,         5511,         14054,     5481,
+  5728,         2888,          7580,     1346,
+ 14384,         5325,         16236,     3950,
+ 15118,         3744,         15306,     1435,
+ 14597,         4070,         12301,    15696,
+  7617,         1699,          2170,      884,
+  4459,         4567,         18094,     3306,
+ 12742,          815,         14926,      907,
+ 15016,         4281,         15518,     8368,
+ 17994,         1087,          2358,      865,
+ 16281,         3787,         15679,     4596,
+ 16356,         1534,         16584,     2210,
+ 16833,         9697,         15929,     4513,
+  3277,         1085,          9643,     2187,
+ 11973,         6068,          9199,     4462,
+  8955,         1629,         10289,     3062,
+ 16481,         5155,         15466,     7066,
+ 13678,         2543,          5273,     2277,
+ 16746,         6213,         16655,     3408,
+ 20304,         3363,         18688,     1985,
+ 14172,        12867,         15154,    15703,
+  4473,         1020,          1681,      886,
+  4311,         4301,          8952,     3657,
+  5893,         1147,         11647,     1452,
+ 15886,         2227,          4582,     6644,
+  6929,         1205,          6220,      799,
+ 12415,         3409,         15968,     3877,
+ 19859,         2109,          9689,     2141,
+ 14742,         8830,         14480,     2599,
+  1817,         1238,          7771,      813,
+ 19079,         4410,          5554,     2064,
+  3687,         2844,         17435,     2256,
+ 16697,         4486,         16199,     5388,
+  8028,         2763,          3405,     2119,
+ 17426,         5477,         13698,     2786,
+ 19879,         2720,          9098,     3880,
+ 18172,         4833,         17336,    12207,
+  5116,          996,          4935,      988,
+  9888,         3081,          6014,     5371,
+ 15881,         1667,          8405,     1183,
+ 15087,         2366,         19777,     7002,
+ 11963,         1562,          7279,     1128,
+ 16859,         1532,         15762,     5381,
+ 14708,         2065,         20105,     2155,
+ 17158,         8245,         17911,     6318,
+  5467,         1504,          4100,     2574,
+ 17421,         6810,          5673,     2888,
+ 16636,         3382,          8975,     1831,
+ 20159,         4737,         19550,     7294,
+  6658,         2781,         11472,     3321,
+ 19397,         5054,         18878,     4722,
+ 16439,         2373,         20430,     4386,
+ 11353,        26526,         11593,     3068,
+  2866,         1566,          5108,     1070,
+  9614,         4915,          4939,     3536,
+  7541,          878,         20717,      851,
+  6938,         4395,         16799,     7733,
+ 10137,         1019,          9845,      964,
+ 15494,         3955,         15459,     3430,
+ 18863,          982,         20120,      963,
+ 16876,        12887,         14334,     4200,
+  6599,         1220,          9222,      814,
+ 16942,         5134,          5661,     4898,
+  5488,         1798,         20258,     3962,
+ 17005,         6178,         17929,     5929,
+  9365,         3420,          7474,     1971,
+ 19537,         5177,         19003,     3006,
+ 16454,         3788,         16070,     2367,
+  8664,         2743,          9445,    26358,
+ 10856,         1287,          3555,     1009,
+  5606,         3622,         19453,     5512,
+ 12453,          797,         20634,      911,
+ 15427,         3066,         17037,    10275,
+ 18883,         2633,          3913,     1268,
+ 19519,         3371,         18052,     5230,
+ 19291,         1678,         19508,     3172,
+ 18072,        10754,         16625,     6845,
+  3134,         2298,         10869,     2437,
+ 15580,         6913,         12597,     3381,
+ 11116,         3297,         16762,     2424,
+ 18853,         6715,         17171,     9887,
+ 12743,         2605,          8937,     3140,
+ 19033,         7764,         18347,     3880,
+ 20475,         3682,         19602,     3380,
+ 13044,        19373,         10526,    23124
+};
+
+const TInt KAmrLargestGain475 = 26526;
+
+
+// KAmrGaindB2Gamma[0] is gamma*10000 at -127 dB
+// KAmrGaindB2Gamma[1] is gamma*10000 at -126 dB
+// KAmrGaindB2Gamma[127] is gamma*10000 at 0 dB
+// KAmrGaindB2Gamma[128] is gamma*10000 at 1 dB
+// KAmrGaindB2Gamma[255] is gamma*10000 at 128 dB
+
+const TInt KAmrGain_dB2Gamma[] = 
+
+    {
+53,
+55,
+58,
+60,
+62,
+65,
+68,
+71,
+74,
+77,
+80,
+83,
+87,
+91,
+94,
+98,
+103,
+107,
+111,
+116,
+121,
+126,
+131,
+137,
+143,
+149,
+155,
+161,
+168,
+175,
+183,
+190,
+198,
+207,
+215,
+225,
+234,
+244,
+254,
+265,
+276,
+288,
+300,
+312,
+325,
+339,
+353,
+368,
+384,
+400,
+417,
+435,
+453,
+472,
+492,
+512,
+534,
+557,
+580,
+604,
+630,
+656,
+684,
+713,
+743,
+774,
+807,
+841,
+876,
+913,
+952,
+992,
+1034,
+1077,
+1122,
+1170,
+1219,
+1270,
+1324,
+1380,
+1438,
+1498,
+1562,
+1627,
+1696,
+1767,
+1842,
+1919,
+2000,
+2084,
+2172,
+2264,
+2359,
+2459,
+2562,
+2670,
+2783,
+2900,
+3022,
+3149,
+3282,
+3420,
+3564,
+3714,
+3871,
+4034,
+4204,
+4381,
+4566,
+4758,
+4958,
+5167,
+5385,
+5612,
+5848,
+6095,
+6351,
+6619,
+6898,
+7188,
+7491,
+7807,
+8136,
+8478,
+8836,
+9208,
+9596,
+10000,
+10421,
+10860,
+11318,
+11795,
+12292,
+12809,
+13349,
+13911,
+14497,
+15108,
+15745,
+16408,
+17099,
+17820,
+18570,
+19353,
+20168,
+21017,
+21903,
+22826,
+23787,
+24789,
+25834,
+26922,
+28056,
+29238,
+30470,
+31754,
+33091,
+34485,
+35938,
+37452,
+39030,
+40674,
+42388,
+44173,
+46034,
+47974,
+49995,
+52101,
+54296,
+56583,
+58967,
+61451,
+64040,
+66738,
+69549,
+72479,
+75533,
+78715,
+82031,
+85487,
+89088,
+92841,
+96753,
+100829,
+105076,
+109503,
+114116,
+118924,
+123934,
+129155,
+134596,
+140266,
+146175,
+152334,
+158751,
+165439,
+172409,
+179672,
+187241,
+195129,
+203350,
+211917,
+220844,
+230148,
+239844,
+249948,
+260478,
+271451,
+282887,
+294804,
+307224,
+320167,
+333655,
+347711,
+362360,
+377625,
+393534,
+410113,
+427390,
+445395,
+464159,
+483713,
+504091,
+525327,
+547459,
+570522,
+594557,
+619605,
+645708,
+672910,
+701258,
+730801,
+761589,
+793673,
+827109,
+861954,
+898266,
+936108,
+975545,
+1016643,
+1059472,
+1104106,
+1150620,
+1199093,
+1249609,
+1302253,
+1357114,
+1414287,
+1473869,
+1535960,
+1600667,
+1668101,
+1738375,
+1811609,
+1887929,
+    };
+
+
+
+
+/*
+ * definition of modes for decoder
+ */
+enum Mode 
+    { 
+    MR475 = 0,
+    MR515,
+    MR59,
+    MR67,
+    MR74,
+    MR795,
+    MR102,
+    MR122,
+    MRDTX,
+    N_MODES     /* number of (SPC) modes */
+    };
+
+
+
+class TProcessingEvent 
+    {
+
+public:
+
+    RArray<TInt> iAllIndexes; // -1 = silence
+    TInt32 iPosition; //global position in milliseconds
+    TBool iCutIn; //true = cutIn, false = cutOut
+    TInt iChangedClipIndex;
+    
+    static TInt TProcessingEvent::Compare(const TProcessingEvent& c1, const TProcessingEvent& c2) 
+        {
+                
+        if (c1.iPosition > c2.iPosition) 
+            {
+            return 1;
+            }
+        else if (c1.iPosition < c2.iPosition) 
+            {
+            return -1;
+            }
+        else 
+            {
+            return 0;
+            }
+        }
+    
+    };
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/inc/auddef.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,354 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  auddef.h - Constants and general declarations for MPEG type of audio formats.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef MPAUD_DEF_H_
+#define MPAUD_DEF_H_
+
+/*- Project Headers. --*/
+#include "defines.h"
+
+
+/**************************************************************************
+  External Objects Provided
+  *************************************************************************/
+
+/*-- General MPx Definitions. --*/
+/*
+#ifndef PI
+#define PI                   (3.14159265358979)
+#endif
+#define MPEG_AUDIO_ID        (1)
+#define MPEG_PHASE2_LSF      (0)
+#define SBLIMIT              (32)
+#define SSLIMIT              (18)
+#define MAX_MONO_SAMPLES     (SBLIMIT * SSLIMIT)
+#define HAN_SIZE             (512)
+#define NUM_SUBWIN           (16)
+#define SCALE                (32768L)
+#define SYNC_WORD            ((long) 0x7ff)
+
+#define HEADER_BITS          (20)
+#define MAX_LONG_SFB_BANDS   (22)
+#define MAX_SHORT_SFB_BANDS  (13)
+#define MAX_BITRESER_SIZE    (512)
+#define CRC_MAX_PAYLOAD      (34)
+*/
+#define MP_SYNC_WORD_LENGTH  (11)
+/*-- MPEG Header Definitions - Mode Values --*/
+#define MPG_MD_STEREO        (0)
+#define MPG_MD_JOINT_STEREO  (1)
+#define MPG_MD_DUAL_CHANNEL  (2)
+#define MPG_MD_MONO          (3)
+
+/*-- Channel definitions. --*/
+#define MONO_CHAN            (0)
+#define MAX_CHANNELS         (2)
+#define LEFT_CHANNEL         (MONO_CHAN)
+#define RIGHT_CHANNEL        (MONO_CHAN + 1)
+
+/*
+   Purpose:     Masks those bit fields from the header to zero that
+                do not remain fixed from frame to frame.
+   Explanation: Following fields are assumed to be fixed :
+                 * 12th bit from the sync word
+                 * version
+                 * layer description
+                 * sampling rate
+                 * channel mode (layer 3 only)
+                 * copyright bit
+                 * original bit
+                 * de-emphasis
+
+                Following fields can vary from frame to frame :
+                 * protection bit
+                 * bit rate
+                 * padding bit
+                 * private bit
+                 * channel mode extension
+                */
+#define HEADER_MASK(header) ((uint32)header & 0x001E0CCF)
+
+/*
+   Purpose:     Macro to extract layer description.
+   Explanation: This is the bit value, use MP_Header::layer_number method
+                to interpret this value. */
+#define LAYER_MASK(header) (((uint32)header >> 17) & 3)
+
+/*
+   Purpose:     Frame detection status.
+   Explanation: - */
+typedef enum SEEK_STATUS
+{
+  SYNC_FOUND = 0,
+  SYNC_LOST,
+  SYNC_BITS_OUT,
+  SYNC_MP3_FREE
+
+} SEEK_STATUS;
+
+/*
+   Purpose:     Sync layer codes.
+   Explanation: - */
+typedef enum SYNC_STATUS
+{
+  LAYER1_STREAM,
+  LAYER2_STREAM,
+  LAYER3_STREAM,
+
+  INIT_LAYER1_STREAM,
+  INIT_LAYER2_STREAM,
+  INIT_LAYER3_STREAM,
+
+  INIT_MP_STREAM,
+  GET_1ST_MPSYNC_STREAM,
+  GET_MPSYNC_STREAM,
+  GET_MPHEADER_STREAM,
+
+  INIT_AAC_STREAM,
+  ADTS_STREAM,
+  GET_ADTSSYNC_STREAM,
+  GET_ADTSHEADER_STREAM
+
+} SYNC_STATUS;
+
+/*
+   Purpose:     Bitrate modes.
+   Explanation: - */
+/*
+typedef enum BrType
+{
+  UNKNOWN,
+  CBR,
+  VBR,
+  FREE
+
+} BrType;
+*/
+/*
+   Purpose:     
+   Explanation: - */
+typedef enum GLITCH
+{
+  GLITCH_FREE,
+  GLITCH0,
+  GLITCH1
+
+} GLITCH;
+
+/*
+   Purpose:     Message definitions.
+   Explanation: - */
+typedef enum MsgType
+{
+  NO_MESSAGES,
+  UPDATE_BUFFER,
+  SEEK_BUFFER,
+  GET_POSITION,
+  GET_SIZE
+  
+} MsgType;
+
+
+/*
+   Purpose:     Definition of generic message parameter.
+   Explanation: - */
+typedef uint32 MsgParam;
+
+/*
+   Purpose:     Message structure of the decoder and/or player.
+   Explanation: - */
+typedef struct MsgStr
+{
+  MsgType msgType;
+  MsgParam msgInParam;
+  MsgParam msgOutParam;
+  
+} Msg;
+
+/*
+   Purpose:     Execution state for user specified functions.
+   Explanation: - */
+typedef struct ExecStateStr
+{
+  GLITCH execMode;
+  int16 a0_s16[3];
+  uint32 a0_u32[3];
+  Msg *msg;
+
+} ExecState;
+
+/*
+   Purpose:     Parent structure for sync layer processing.
+   Explanation: - */
+typedef struct SyncInfoStr
+{
+  int16 sync_length;       /* Length of sync word.                    */
+  int16 sync_word;         /* Synchronization word.                   */
+  int16 sync_mask;         /* Bitmask for sync word detection.        */
+  SYNC_STATUS sync_status; /* Which layer we supposed to be decoding. */
+
+} SyncInfo;
+
+enum
+{
+  VBR_MODE = 1,
+  FILE_SIZE_KNOWN = 2
+};
+
+/*
+   Purpose:     Frame detection status.
+   Explanation: - */
+/*
+
+CAN BE FOUND IN auddef.h
+typedef enum SEEK_STATUS
+{
+  SYNC_FOUND,
+  SYNC_LOST,
+  SYNC_BITS_OUT
+
+} SEEK_STATUS;
+*/
+/*
+   Purpose:     State of the decoder.
+   Explanation: - */
+typedef enum DecState
+{
+  STATE_UNDEFINED,
+  DEC_INIT,
+  DEC_INIT_COMPLETE,
+  FIND_FIRST_FRAME,
+  FIND_FRAME,
+  FIND_PAYLOAD,
+  FIND_AVERAGE_BR,
+  DECODE_FRAME,
+  CORRUPTED_FRAME,
+  GET_PAYLOAD,
+  RESTART_AFTER_VBR,
+  DECODE_FRAME_CORRUPTED
+
+} DecState;
+
+/*
+   Purpose:     Supported UI features.
+   Explanation: - */
+typedef enum UIMode
+{
+  UI_UNDEFINED,
+  UI_PLAY,
+  UI_STOP,
+  UI_WIND_FORWARD,
+  UI_WIND_BACKWARD,
+  UI_REPEAT_LOOP
+
+} UIMode;
+
+/*
+   Purpose:     A-B repeat.
+   Explanation: - */
+typedef enum MARKER_ID
+{
+  RESET_MARKERS = -1,
+  A_MARKER,
+  B_MARKER
+
+} MARKER_ID;
+
+/*
+   Purpose:     Bitrate modes.
+   Explanation: - */
+
+typedef enum BrType
+{
+  UNKNOWN,
+  CBR,
+  VBR,
+  FREE
+
+} BrType;
+
+
+/*
+   Purpose:     Playback quality mappings.
+   Explanation: - */
+typedef enum QUALITY
+{
+  FULL_QUALITY,
+  HALF_QUALITY,
+  QUARTER_QUALITY
+
+} QUALITY;
+
+/*
+   Purpose:     Error codes of the player.
+   Explanation: - */
+typedef enum MP3_ERROR
+{
+  AUDIO_OK = 0,
+  AUDIO_ERROR_CRC,
+  AUDIO_INVALID_LAYER,
+  AUDIO_INVALID_SYNTAX,
+  AUDIO_FREE_FORMAT_ERROR,
+  AUDIO_FREE_FORMAT_BR_ERROR,
+  AUDIO_BUFFER_TOO_SMALL
+
+} MP3_Error;
+
+/*
+   Purpose:     General info about the file/stream.
+   Explanation: - */
+typedef struct TrackInfoStr
+{
+  int32 frequency;
+  int16 bitRate;
+  int16 numChannels;
+  int32 lengthInms;
+  uint32 numFrames;
+  BrType brType;
+
+} TrackInfo;
+
+/*
+   Purpose:     Playback quality parameters and general init info.
+   Explanation: - */
+typedef struct InitParamStr
+{
+  uint8 out_channels;
+  uint8 decim_factor;
+  uint8 window_pruning;
+  uint8 alias_subbands;
+  uint8 imdct_subbands;
+  uint32 specFreqBinLimit;
+
+  int16 bitrate;
+  int32 VBRframesLimit;
+
+} InitParam;
+
+
+
+
+#endif /*-- MPAUD_DEF_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/inc/defines.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  defines.h - Global data prototypes, compile switches etc.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2003 by Nokia Research Center, Speech and Audio Systems.
+  *************************************************************************/
+
+#ifndef DEFINES_H_
+#define DEFINES_H_
+
+#ifdef NOT_SYMBIAN_OS
+
+/*-- Header files to be included. --*/
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*-- Data types. --*/
+typedef short int16;
+typedef unsigned short uint16;
+typedef float FLOAT;
+#ifdef NATIVE64
+typedef unsigned int uint32;
+typedef int int32;
+#else
+typedef unsigned long uint32;
+typedef long int32;
+#endif
+typedef int BOOL;
+typedef unsigned char uint8;
+
+#ifdef HAS_INLINE
+#define INLINE inline
+#else
+#ifdef HAS_C_INLINE
+#define INLINE __inline
+#else
+#define INLINE
+#endif
+#endif
+
+#define GET_CHUNK(x) (memset(malloc(x), 0, x))
+#define SWAP_INT16(x) ((((uint32)x >> 8) & 0xFF) | ((uint32)x << 8))
+#define SAFE_DELETE(x) if(x) free(x); x = NULL
+#define IS_ERROR(x) if(x == NULL) goto error_exit;
+#define ZERO_MEMORY(x, y)    memset(x, 0, y)
+#define COPY_MEMORY(x, y, z) memcpy(x, y, z)
+#define SET_MEMORY(x, y, z)  memset(x, z, y)
+
+#else
+
+/*-- System Headers. --*/
+#include <e32def.h>
+#include <e32std.h>
+#include <e32base.h>
+
+//#include <stdlib.h>
+//#include <stdio.h>
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+/*-- Data types. --*/
+typedef TInt8             int8;
+typedef TUint8            uint8;
+typedef TInt16            int16;
+typedef TUint16           uint16;
+typedef TInt              int32;
+typedef TUint             uint32;
+typedef TUint8            BOOL;
+typedef TReal           FLOAT;
+
+#define INLINE inline
+
+#define GET_CHUNK(x)         User::LeaveIfNull(User::Alloc(x))
+#define GET_SYMBIAN_CHUNK(x)    x::NewL()
+
+#define IS_ERROR(x)
+#define SAFE_DELETE(x)       if(x) User::Free(x); x = NULL
+#define SAFE_SYMBIAN_DELETE(x)    if(x != 0) delete x; x = 0
+
+#define ZERO_MEMORY(x, y)    Mem::FillZ(x, y)
+#define COPY_MEMORY(x, y, z) Mem::Copy(x, y, z)
+#define SET_MEMORY(x, y, z)  Mem::Fill(x, y, TChar((TUint) z))
+
+
+/*-- AAC definitions. --*/
+#define LTP_PROFILE
+#define MONO_VERSION
+#define STEREO_VERSION
+#define AAC_ADIF_FORMAT
+#define AAC_ADTS_FORMAT
+#define AAC_INDEX_TABLES
+
+#define FAST_MIX
+
+
+#endif /*-- NOT_SYMBIAN_OS --*/
+
+#ifndef TRUE
+#define TRUE  (1)
+#endif
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+/*-- Some Useful Macros. --*/
+#ifdef MIN
+#undef MIN
+#endif
+#define MIN(A, B)            ((A) < (B) ? (A) : (B))
+
+#ifdef MAX
+#undef MAX
+#endif
+#define MAX(A, B)            ((A) > (B) ? (A) : (B))
+
+#endif /*-- DEFINES_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/inc/mp3def.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef MP3_DEF_H_
+#define MP3_DEF_H_
+
+/*- Project Headers. --*/
+#include "defines.h"
+
+/**************************************************************************
+  External Objects Provided
+  *************************************************************************/
+
+/*-- General MPx Definitions. --*/
+#ifndef PI
+#define PI                   (3.14159265358979)
+#endif
+#define MPEG_AUDIO_ID        (1)
+#define MPEG_PHASE2_LSF      (0)
+#define SBLIMIT              (32)
+#define SSLIMIT              (18)
+#define MAX_MONO_SAMPLES     (SBLIMIT * SSLIMIT)
+#define HAN_SIZE             (512)
+#define NUM_SUBWIN           (16)
+#define SCALE                (32768L)
+#define SYNC_WORD            ((long) 0x7ff)
+#define SYNC_WORD_LENGTH     (11)
+#define HEADER_BITS          (20)
+#define MAX_LONG_SFB_BANDS   (22)
+#define MAX_SHORT_SFB_BANDS  (13)
+#define MIN_MP3FRAMELEN      (1440)
+#define MAX_BITRESER_SIZE    (512)
+#define CRC_MAX_PAYLOAD      (34)
+
+/*-- MPEG Header Definitions - Mode Values --*/
+#define MPG_MD_STEREO        (0)
+#define MPG_MD_JOINT_STEREO  (1)
+#define MPG_MD_DUAL_CHANNEL  (2)
+#define MPG_MD_MONO          (3)
+
+/*-- Some Useful Macros. --*/
+#ifdef MIN
+#undef MIN
+#endif
+#define MIN(A, B)            ((A) < (B) ? (A) : (B))
+
+#ifdef MAX
+#undef MAX
+#endif
+#define MAX(A, B)            ((A) > (B) ? (A) : (B))
+
+/*-- Channel definitions. --*/
+#define MONO_CHAN            (0)
+//#define MAX_CHANNELS         (2)
+#define LEFT_CHANNEL         (MONO_CHAN)
+#define RIGHT_CHANNEL        (MONO_CHAN + 1)
+
+/*
+   Purpose:     Masks those bit fields from the header to zero that
+                do not remain fixed from frame to frame.
+   Explanation: Following fields are assumed to be fixed :
+                 * 12th bit from the sync word
+                 * version
+                 * layer description
+                 * sampling rate
+         * channel mode (layer 3 only)
+         * copyright bit
+                 * original bit
+                 * de-emphasis
+
+                Following fields can vary from frame to frame :
+         * protection bit
+                 * bit rate
+                 * padding bit
+                 * private bit
+                 * channel mode extension
+                */
+#define HEADER_MASK(header) ((uint32)header & 0x001E0CCF)
+
+/*
+   Purpose:     Macro to extract layer description.
+   Explanation: This is the bit value, use MP_Header::layer_number method
+                to interpret this value. */
+#define LAYER_MASK(header) (((uint32)header >> 17) & 3)
+
+/*
+   Purpose:     Layer III flags.
+   Explanation: - */
+typedef enum LayerIIIFlags
+{
+  WINDOW_SWITCHING_FLAG = 4,
+  MIXED_BLOCK_FLAG = 8,
+  PRE_FLAG = 16,
+  SCALEFAC_SCALE = 32,
+  COUNT_1_TABLE_SELECT = 64
+
+} Layer_III_Flags;
+
+/*
+   Purpose:     Stereo modes for layer III.
+   Explanation: - */
+typedef enum StereoMode
+{
+  ONLY_MONO,
+  ONLY_STEREO,
+  MS_STEREO,
+  IS_STEREO,
+  LSF_IS_STEREO
+
+} StereoMode;
+
+/*
+   Purpose:     Block types for layer III.
+   Explanation: The first four describe the actual block type for each subband,
+                the rest of the declarations describe the block type for the
+                whole frame. */
+
+typedef enum MP3_WINDOW_TYPE
+{
+  ONLY_LONG_WINDOW,
+  LONG_SHORT_WINDOW,
+  ONLY_SHORT_WINDOW,
+  SHORT_LONG_WINDOW,
+  MIXED_BLOCK_MODE,
+  SHORT_BLOCK_MODE,
+  LONG_BLOCK_MODE
+
+} MP3_WINDOW_TYPE, MP3WindowType;
+
+/*
+   Purpose:     Structure to hold scalefactor band parameters.
+   Explanation: - */
+typedef struct SFBAND_DATA_STR
+{
+  int16 l[23]; /* long block.  */
+  int16 s[14]; /* short block. */
+
+} SFBAND_DATA;
+
+/*
+   Purpose:     Number of bits reserved for decoding each group
+                of scalefactors.
+   Explanation: - */
+typedef struct SFBITS_DATA_STR
+{
+  int16 l[5];
+  int16 s[3];
+  
+} SFBITS_DATA;
+
+/*
+   Purpose:     Sync seek code.
+   Explanation: - */
+typedef enum MIX_SYNC_STATUS
+{
+  LAYER1_STREAM_MIX,
+  LAYER2_STREAM_MIX,
+  LAYER3_STREAM_MIX,
+  FIRST_FRAME_WITH_LAYER1,
+  FIRST_FRAME_WITH_LAYER2,
+  FIRST_FRAME_WITH_LAYER3
+
+} MIX_SYNC_STATUS;
+
+#endif /* MP3_DEF_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/inc/mstream.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,666 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#ifndef MP_STREAM_H_
+#define MP_STREAM_H_
+
+/**************************************************************************
+  External Objects Needed
+  *************************************************************************/
+
+/*-- Project Headers --*/
+#include "nok_bits.h"
+#include "defines.h"
+#include "param.h"
+#include "mp3def.h"
+#include "auddef.h"
+#include <e32base.h>
+
+
+
+/**************************************************************************
+  External Objects Provided
+  *************************************************************************/
+
+/**************************************************************************
+                Common structure definitions for all layers
+  *************************************************************************/
+
+/*
+   Purpose:     Parent structure for error checking.
+   Explanation: The number of bits that are protected varies between different 
+                versions (MPEG-1, MPEG-2). */
+class TCRC_Check
+{
+public:
+  uint8 crc_payload[CRC_MAX_PAYLOAD]; /* Protected bits.         */
+  uint16 bufLen;                       /* Length of 'crc_payload' */
+  int16 crc;                         /* CRC error-check word.   */
+
+};
+
+/*
+   Purpose:     Parent structure for mp1, mp2, and mp3 header.
+   Explanation: - */
+
+class TMPEG_Header
+{
+public:
+  uint32 header; // Header bits. 
+
+};
+
+/*
+   Purpose:     Parent Structure for mp1, mp2, and mp3 frames.
+   Explanation: - */
+class TMPEG_Frame
+{
+public:
+  uint8 *scale_factors;           /* Scale factor of each subband and group. */
+  int16 *quant;                  /* Quantized spectral data for this frame. */
+  int16 *ch_quant[MAX_CHANNELS]; /* Channel pointers.                       */
+
+};
+
+ /*
+   Purpose:     Parent Structure for mp1, mp2, and mp3 buffer.
+   Explanation: - */
+class TMPEG_Buffer
+{
+public:
+  FLOAT *synthesis_buffer[MAX_CHANNELS]; /* Samples for windowing.     */
+  int16 buf_idx[MAX_CHANNELS];           /* Start index for windowing. */
+  int16 dct_idx[MAX_CHANNELS];           /* DCT buffer index.          */
+  FLOAT *reconstructed;                  /* Dequantized samples.       */
+  FLOAT *ch_reconstructed[MAX_CHANNELS]; /* Channel pointers.          */
+
+};
+
+ /*
+   Purpose:     Parent Structure for frame detection.
+   Explanation: - */
+class TSyncInfoMix
+{
+public:
+  int16 sync_length;       /* Length of sync word.                    */
+  int16 sync_word;         /* Synchronization word.                   */
+  int16 sync_mask;         /* Bitmask for sync word detection.        */
+  MIX_SYNC_STATUS sync_status; /* Which layer we supposed to be decoding. */
+
+};
+
+/**************************************************************************
+               Structure definitions applicable only to layer III
+  *************************************************************************/
+/*
+   Purpose:     Parent Structure for layer III Granule Info.
+   Explanation: - */
+class TGranule_Info
+{
+public:
+  uint8 global_gain;
+  uint8 flags;
+  uint8 table_select[3];
+  uint8 subblock_gain[3];
+  uint8 region0_count;
+  uint8 region1_count;
+  int32 part2_3_length;
+  int32 big_values;
+  int32 scalefac_compress;
+  MP3_WINDOW_TYPE block_mode;
+  int16 zero_part_start;
+
+};
+
+/*
+   Purpose:     Parent Structure for layer III Scale Factors.
+   Explanation: - */
+class CIII_Scale_Factors : public CBase
+{
+
+public:
+
+  uint8 *scalefac_long;     /* Scalefactors for long blocks.  */
+  uint8 *scalefac_short[3]; /* Scalefactors for short blocks. */
+
+
+};
+
+/*
+   Purpose:     Parent Structure for layer III Channel Info.
+   Explanation: - */
+class CIII_Channel_Info : public CBase
+{
+public:
+
+  static CIII_Channel_Info* NewL();
+  ~CIII_Channel_Info();
+  TGranule_Info *gr_info[2];     /* Granule info for this channel. */
+  CIII_Scale_Factors *scale_fac; /* Scalefactors for this channel. */
+
+private:
+   void ConstructL();
+   CIII_Channel_Info();
+
+};
+
+/*
+   Purpose:     Structure to hold MPEG-2 IS stereo positions.
+   Explanation: - */
+class TIS_Info
+{
+public:
+  int16 is_len[3];
+  int16 nr_sfb[3];
+
+};
+
+/*
+   Purpose:     Structure to hold scalefactor band tables
+                and related parameters.
+   Explanation: - */
+class CIII_SfbData : public CBase
+{
+public:
+
+  static CIII_SfbData* NewL();
+  ~CIII_SfbData();
+
+  /* Scalefactor band boundaries for long and short blocks. */
+  int16* sfbOffsetLong;
+  int16* sfbOffsetShort;
+
+  /* Scalefactor band widths for short blocks. */
+  int16* sfbWidthShort;
+
+  int16 *sfbLong;  /* Pointer to long sfb offset table.  */
+  int16 *sfbShort; /* Pointer to short sfb offset table. */
+  int16 *sfbWidth; /* Pointer to short sfb width table.  */
+  int16 bandLimit; /* # of spectral bins to be decoded.  */ 
+
+private:
+    void ConstructL();
+    CIII_SfbData();
+
+};
+
+/*
+   Purpose:     Structure to map the file parameters into
+                total length, average bitrate, etc.
+   Explanation: - */
+class TMP_BrInfo
+{
+public:
+  BOOL vbr;          /* TRUE for VBR files, FALSE otherwise.        */
+  BOOL tmp;          /* Used for counting the verage bitrate.       */
+  BOOL true_br;      /* The 'start_br' represents the true bitrate. */
+  BOOL free_br;      /* Free format flag.                           */
+  uint32 cum_br;     /* Cumulative bitrate.                         */
+  uint32 cum_frames; /* Cumulative # of frames.                     */
+  uint16 start_br;   /* Initial and/or average bitrate.             */
+  
+};
+
+/*
+   Purpose:     Parent Structure for Layer III Side Information.
+   Explanation: - */
+class CIII_Side_Info : public CBase
+{
+public:
+
+  static CIII_Side_Info* NewL();
+  ~CIII_Side_Info();
+
+  /*-- Side information read from the bit stream. --*/
+  uint8 private_bits;
+  uint8 scfsi[2][4];
+  int32 main_data_begin;
+  CIII_Channel_Info *ch_info[MAX_CHANNELS];
+
+  /*-- General side information. --*/
+  StereoMode *s_mode_long;    /* Stereo modes for long blocks.               */
+  StereoMode *s_mode_short[3];/* Stereo modes for short blocks.              */
+  
+  int16 max_gr;               /* Number of granules within each stream frame.*/
+  BOOL ms_stereo;             /* MS (Mid/Side) stereo used.                  */
+  BOOL is_stereo;             /* Intensity stereo used.                      */
+  BOOL lsf;                   /* MPEG-2 LSF stream present.                  */
+  BOOL mpeg25;                /* MPEG-2.5 stream present.                    */
+  int16 sb_limit;
+  TIS_Info is_info;
+  CIII_SfbData* sfbData;
+
+private:
+  void ConstructL();
+  CIII_Side_Info();
+
+};
+
+/*
+   Purpose:     Parent Structure for Huffman Decoding.
+   Explanation: This structure can be used if dynamic memory allocation
+                is not available or if memory consumption is important.
+                At worst we have to process the number of codewords equal to
+                the size of the codebook. */
+class CHuffman : public CBase
+{
+public:
+  int16 tree_len;        /* Size of the Huffman tree.                      */
+  int16 linbits;         /* Number of extra bits.                          */
+  const int16 *codeword;       /* Huffman codewords.                             */
+  const int16 *packed_symbols; /* x, y and length of the corresponding codeword. */
+
+};
+
+/*
+   Purpose:     Structure for buffer handling.
+   Explanation: - */
+class CMCUBuf : public CBase
+{
+public:
+
+   static CMCUBuf* NewL(TInt aBufLen);
+  ~CMCUBuf();
+
+  TBitStream *bs;      /* Bitstream parser.                 */
+  uint32 bufOffset;   /* Current file or buffer offset.    */
+  uint32 bufLen;      /* Length of 'mcuBufbits', in bytes. */
+  uint32 writeIdx;    /* Write index of the buffer.        */
+  uint32 readSlots;   /* Bytes read from the buffer.       */
+  uint8 *mcuBufbits;  /* Buffer for the compressed bits.   */
+
+private:
+    
+    void ConstructL(TInt aBufLen);
+    CMCUBuf();
+
+};
+
+/*
+   Purpose:     More definitions for the buffer handling.
+   Explanation: - */
+typedef enum StreamMode
+{
+  IS_UNKNOWN,
+  IS_FILE,
+  IS_STREAM,
+  READ_MODE,
+  WRITE_MODE,
+  APPEND_MODE
+
+} StreamMode;
+
+
+/*
+   Purpose:     Structure implementing ring buffer.
+   Explanation: - */
+class CRingBuffer : public CBase
+{
+public:
+  TBitStream *bs;    /* Bit parser for the 'bitBuffer'.  */
+  uint32 bufLen;    /* Length of 'bitBuffer', in bytes. */
+  uint32 readIdx;   /* Read index.                      */
+  uint8 *bitBuffer; /* Buffer holding encoded data.     */
+
+};
+
+/*
+   Purpose:     Layer 3 bitstream formatter (encoder side).
+                The header+side info and payload are in separate
+        buffers. The output mp3 frames are a combination
+        of these two buffers.
+   Explanation: - */
+class CL3FormatBitstream : public CBase
+{
+public:
+    static CL3FormatBitstream* NewL(uint16 sideInfoEntries, 
+            uint16 sideInfoBytes, uint32 dataBytesBuffer);
+
+
+    ~CL3FormatBitstream();
+
+    void L3FormatBitstreamAddMainDataEntry(uint16 dataBytes);
+    void L3FormatBitstreamAddMainDataBits(uint32 dataBits);
+    uint32 L3WriteOutFrame(uint8 *outBuf);
+  /* Number of bits present in 'frameData'. */
+  uint32 numDataBits;
+
+  /* Number of bytes reserved for payload part of the frame. */
+  uint16 *payloadBytes;
+
+  /* Read index to field 'payloadBytes'. */
+  uint16 payloadReadIdx;
+
+  /* Write index to field 'payloadBytes'. */
+  uint16 payloadWriteIdx;
+
+  /* Number of items in field 'payloadBytes'. */
+  uint16 numPayloads;
+
+  /* Payload data for layer 3 frames. */
+  CRingBuffer *frameData;
+
+
+  /* Number of frames present in 'frameHeader'. */
+  uint32 framesPresent;
+
+  /* Number of bytes reserved for side info per frame (fixed value). */
+  uint16 sideInfoBytes;
+
+  /* Buffer holding header and side info frames. */
+  CRingBuffer *frameHeader;
+  
+private:
+    
+    void ConstructL(uint16 sideInfoEntries, uint16 sideInfoBytes, uint32 dataBytesBuffer);
+    CL3FormatBitstream();
+};
+
+/*
+   Purpose:     Bitrate of the mixer.
+   Explanation: - */
+class TL3BitRate
+{
+public:
+  /*-- Bitrate of mixed stream and index of the rate. --*/
+  uint16 bitRate;
+  uint8 bitRateIdx;
+
+  /*-- Status of padding bit in frame header. --*/
+  uint8 padding;
+  
+  /*-- Number of bytes available for a frame. --*/
+  uint16 frameBytes;
+  
+  /*-- Fractional part of the bytes reserved for each frame. --*/
+  FLOAT frac_SpF;
+  FLOAT slot_lag;
+
+};
+
+class THuffmanData
+{
+public:
+  /* # of bits reserved for 'hufWord'. */
+  uint8 hufBits;
+  /* total # of bits reserved for codeword + sign bits + linbits. */
+  uint8 hufBitsCount;
+  /* Huffman codeword. */
+  uint16 hufWord;
+
+};
+
+/*
+   Purpose:     Huffman table parameters for layer 3.
+   Explanation: - */
+class CHuffmanCodTab : public CBase
+{
+public:
+  uint8 xlen;
+  uint8 ylen;
+  uint8 linbits;
+  uint8 xoffset;
+  uint16 linmax;
+  THuffmanData *hData;
+
+};
+
+/*
+   Purpose:     # of pair and quadruple tables.
+   Explanation: - */
+#define L3HUFPAIRTBLS  (31)
+#define L3HUFFQUADTBLS ( 2)
+
+/*
+   Purpose:     Parent structure to hold layer 3 Huffman 
+                coding parameters.
+   Explanation: - */
+class CL3HuffmanTab : public CBase
+{
+public:
+
+    static CL3HuffmanTab* NewL();
+    ~CL3HuffmanTab();
+
+    THuffmanData *quadTable[L3HUFFQUADTBLS];  // Tables 32 - 33. 
+    CHuffmanCodTab *pairTable[L3HUFPAIRTBLS]; // Tables 1 - 31.  
+
+    CHuffmanCodTab* tree;
+
+private:
+    CL3HuffmanTab();
+    void ConstructL();
+
+};
+
+/*
+   Purpose:     Helper parameters for mp3 mixer.
+   Explanation: - */
+class CL3MixerHelper : public CBase
+{
+public:
+  /*-------- Encoding related parameters. --------*/
+
+  /*-- Scalefactor encoding patterns for LSF streams. --*/
+  uint8 blkNum;
+  uint8 slen[4];
+  uint8 blkTypeNum;
+  int16 numRegions;
+
+  /*-- Huffman tables for layer 3. --*/
+  CL3HuffmanTab *l3Huf;
+  
+  /*-- Bitstream formatter for layer 3 encoder. --*/
+  CL3FormatBitstream *l3bs;
+  
+  /*-- Window sequence of previous frame. --*/
+  MP3_WINDOW_TYPE winTypeOld[MAX_CHANNELS];
+  
+  /*-- Window sequence of previous frame (source stream). --*/
+  uint32 winTypeIdx;
+  MP3_WINDOW_TYPE *winTypeCurrentFrame;
+  MP3_WINDOW_TYPE *winTypePreviousFrame;
+  MP3_WINDOW_TYPE *winTypePrt[MAX_CHANNELS];
+  MP3_WINDOW_TYPE _winTypeOld1[2 * MAX_CHANNELS];
+  MP3_WINDOW_TYPE _winTypeOld2[2 * MAX_CHANNELS];
+
+  /*-- Overlap buffer for MDCT. --*/
+  FLOAT** L3EncOverlapBuf;//[MAX_CHANNELS][MAX_MONO_SAMPLES];
+  FLOAT* L3EncOverlapBufMem;
+
+  /*-- Granule parameters of previous frame. --*/
+  TGranule_Info *grInfoSave[MAX_CHANNELS];
+
+  
+  /*-- Scalefactors of previous frame. --*/
+  CIII_Scale_Factors *scaleFacSave[MAX_CHANNELS];
+
+  /*-- Spectrum limit of previous frame. --*/
+  int16 specBinsPresent;
+
+  /*-- Scalefactor selection information of previous frame. --*/
+  BOOL IsScfsi;
+  uint8 scfsi[2][4];
+  
+  /*-- Number of bits unused (bit reservoir). --*/
+  uint32 bitPool;
+ 
+  /*-- Level adjustment for the spectrum to be mixed. --*/
+  FLOAT mixGain;
+  
+  /*-- Level adjustment for the mixed spectrum. --*/
+  FLOAT overallGain;
+
+  /*-- Level adjustment for the global gain. --*/
+  int16 gainDec;
+
+  /*-- Number of spectral bins to be mixed. --*/
+  int16 mixSpectralBins;
+
+
+  /*-------- Bitrate related parameters. --------*/
+  
+  /*-- Bytes reserved for side info. --*/
+  int16 sideInfoBytes;
+
+  /*-- Bitrate mappings. --*/
+  BOOL needVBR;
+  uint32 brIdx;
+  TL3BitRate *l3br;
+  TL3BitRate *_l3br[2];
+  TL3BitRate l3brLong;
+  TL3BitRate l3brShort;
+  uint32 numFramesLong;
+  uint32 numFramesShort;
+
+  /*-- # of bytes reserved for the payload part of current frame. --*/
+  int16 nSlots;
+  
+  /*-- 'main_data_begin' for next frame. --*/
+  int16 main_data_begin;
+  
+  /*-- Max value of 'main_data_begin'. --*/
+  int16 max_br_value;
+  
+};
+
+
+/*
+   Purpose:     Stream seeking constants.
+   Explanation: - */
+typedef enum StreamPos
+{
+  CURRENT_POS,
+  START_POS,
+  END_POS
+
+} StreamPos;
+
+/*
+   Purpose:     Parameters of core engine.
+   Explanation: - */
+class CMP_Stream : public CBase
+{
+
+public:
+  /*-- Common to all layers. --*/
+  TBitStream *bs;
+  TMPEG_Header *header;
+  TMPEG_Header headerOld;
+  TMPEG_Frame *frame;
+  TMPEG_Buffer *buffer;
+  TSyncInfoMix syncInfo;
+  TMP_BrInfo brInfo;
+  TCRC_Check mp3_crc;
+
+  /*-- Layer III specific parameters. --*/
+  TBitStream *br;
+  CIII_Side_Info *side_info;
+  CHuffman *huffman;
+  FLOAT *spectrum[MAX_CHANNELS][SBLIMIT];
+  uint16 OverlapBufPtr[MAX_CHANNELS];
+  FLOAT OverlapBlck[2][MAX_CHANNELS][MAX_MONO_SAMPLES];
+  /*
+    Purpose:     Indices for reordering the short blocks.
+    Explanation: First row describes the destination and second row 
+                 the source index. */
+  int16 reorder_idx[2][MAX_MONO_SAMPLES];
+  
+  /*-- Common complexity reduction and output stream parameters. --*/
+  Out_Complexity *complex;
+  Out_Param *out_param;
+
+  int16 idx_increment;
+  int16 FreeFormatSlots;
+  int16 PrevSlots;
+  int32 FrameStart;
+  BOOL SkipBr;
+  BOOL WasSeeking;
+  int16 SlotTable[15];
+  int16 FrameTable[15];
+  int32 PrevStreamInfo[2];
+
+  
+};
+
+
+BOOL InitBrInfo(CMP_Stream *mp, TMP_BrInfo *brInfo);
+inline void SetBitrate(CMP_Stream *mp, int16 br)
+{ mp->brInfo.cum_br += br; mp->brInfo.cum_frames++; }
+BOOL CountAveBr(CMP_Stream *mp, TBitStream *bs_mcu, TMP_BrInfo *brInfo);
+void FinishAveBr(TMP_BrInfo *brInfo, BOOL FullCount);
+
+/* Implementations defined in module 'mstream.cpp'. */
+CMP_Stream *GetMP3HandleL(void);
+void ReleaseMP3Decoder(CMP_Stream *mp);
+int32 main_data_slots(CMP_Stream *mp);
+void decode_header(CMP_Stream *mp, TBitStream *bs);
+void  MP3DecPrepareInit(CMP_Stream *mp, Out_Param *out_param, 
+            Out_Complexity *complex, DSP_BYTE *br_buffer, 
+            uint32 br_size);
+void MP3DecCompleteInit(CMP_Stream *mp, int16 *frameBytes);
+
+/* Implementations defined in module 'mp3.cpp'. */
+SEEK_STATUS FreeFormat(CMP_Stream *mp, TBitStream *bs_mcu, 
+               ExecState *execState, int16 *nSlots);
+SEEK_STATUS SeekSync(CMP_Stream *mp, TBitStream *bs_mcu, 
+             ExecState *execState, int16 *frameBytes);
+void ReInitEngine(CMP_Stream *mp);
+void ResetEngine(CMP_Stream *mp);
+MP3_Error DecodeFrame(CMP_Stream *mp, int16 *pcm_sample, int16 idx_increment);
+int16 L3BitReservoir(CMP_Stream *mp);
+
+/* Implementations defined in module 'sfb.cpp'. */
+void III_SfbDataInit(CIII_SfbData *sfbData, TMPEG_Header *header);
+void III_BandLimit(CIII_SfbData *sfbData, uint16 binLimit);
+
+
+/*
+ * Low level implementations for the mp3 engine. 
+ */
+
+/* Implementations defined in module 'layer3.cpp'. */
+BOOL III_get_side_info(CMP_Stream *mp, TBitStream *bs);
+void III_get_scale_factors(CMP_Stream *mp, int16 gr, int16 ch);
+void init_III_reorder(int16 reorder_idx[2][MAX_MONO_SAMPLES],
+              int16 *sfb_table, int16 *sfb_width_table);
+void III_reorder(CMP_Stream *mp, int16 ch, int16 gr);
+
+/* Implementations defined in module 'mp3_q.cpp'. */
+void III_dequantize(CMP_Stream *mp, int16 gr);
+
+/* Implementations defined in module 'stereo.cpp'. */
+void III_stereo_mode(CMP_Stream *mp, int16 gr);
+
+/* Implementations defined in module 'huffman.cpp'. */
+int16 III_huffman_decode(CMP_Stream *mp, int16 gr, int16 ch, int32 part2);
+void
+pairtable(CMP_Stream *mp, int16 section_length, int16 table_num, int16 *quant);
+int16
+quadtable(CMP_Stream *mp, int16 start, int16 part2, int16 table_num, int16 *quant,
+          int16 max_sfb_bins);
+
+void init_huffman(CHuffman *h);
+
+/*-- Include encoder interface. --*/
+#ifdef L3ENC
+//#include "l3enc.h"
+#endif /*-- L3ENC --*/
+
+#endif /* MP_STREAM_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/inc/nok_bits.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  nok_bits.h - Interface for bitstream handling.
+
+  Author(s): Juha Ojanpera
+  Copyright (c) 1999-2004 by Nokia Research Center, Audio-Visual Systems.
+  *************************************************************************/
+
+#ifndef NOKBITSTREAM_H_
+#define NOKBITSTREAM_H_
+
+/*-- Project Headers. --*/
+#include "defines.h"
+
+/*-- Bitstream supports any length... --*/
+#define BITSMODULO_BUFFER
+
+#ifndef BITSMODULO_BUFFER
+#define MOD_OPCODE(x, y) (x & y)
+#else
+#define MOD_OPCODE(x, y) (x % y)
+#endif /*-- MODULO_BUFFER --*/
+
+const uint32 bsBitMask[] =
+{0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF,
+ 0x1FFFL, 0x3FFFL, 0x7FFFL, 0xFFFFL, 0x1FFFFL, 0x3FFFFL, 0x7FFFFL, 0xFFFFFL,
+ 0x1FFFFFL, 0x3FFFFFL, 0x7FFFFFL, 0xFFFFFFL, 0x1FFFFFFL, 0x3FFFFFFL, 0x7FFFFFFL,
+ 0xFFFFFFFL, 0x1FFFFFFFL, 0x3FFFFFFFL, 0x7FFFFFFFL, 0xFFFFFFFFL};
+
+#ifdef BYTE_16bit
+typedef uint16 DSP_BYTE;
+#else
+typedef uint8 DSP_BYTE;
+#endif
+
+/**
+ * Data structure for accessing bits from input bitstram.
+ */
+typedef enum BYTE_MODE
+{
+  BIT8 = 0,
+  BIT16
+  
+} BYTE_MODE;
+
+#define MAX_BUFS (1)
+ 
+typedef struct BufMapperStr
+{
+  uint8 numBufs;
+  uint8 **bsBuf;
+  uint32 *bsBufLen;
+  uint32 *bytesRead;
+
+} BufMapper;
+ 
+class TBitStream
+{
+public:
+
+
+  /** 
+   * Bitstream (modulo/ring) buffer. */
+  DSP_BYTE *dsp_buffer;
+  uint8 *bit_buffer;
+
+  /** 
+   * Number of bits in the data type. 
+   */
+  int16 slotBits;
+
+  /* Which bit buffer is to be used. */
+  BYTE_MODE mode;
+
+  /** 
+   * Size of the buffer. 
+   */
+  uint32 buf_len;
+
+  /** 
+   * Bit counter. 
+   */
+  int16 bit_counter;
+
+  /** 
+   * Read index. 
+   */
+  uint32 buf_index;
+
+  /** 
+   * Write index. 
+   */
+  uint32 buf_writeIndex;
+
+  /** 
+   * Bitmask for 'buf_index'. 
+   */
+  uint32 buf_mask;
+
+  /** 
+   * Number of bytes read from the buffer. This field will be used to check
+   * whether there are enough bits in the buffer to result a successfull
+   * decoding of current frame.
+   */
+  uint32 slots_read;
+
+  /** 
+   * Number of bits read from the buffer. This will be resetted on a call-by-call
+   * basis and therefore gives the number of bits that each call read from
+   * the buffer. The buffer is updated according to this value.
+   */
+  uint32 bits_read;
+
+};
+
+/**
+ * Bitstream manipulation methods. 
+ */
+
+
+/**
+ * Initializes input bitstream.
+ *
+ * @param   bs         Bitstream handle
+ * @param   bit_buffer Input bitstream
+ * @param   size       Size of input bitstream in bytes
+ */
+IMPORT_C void BsInit(TBitStream *bs, uint8 *bit_buffer, uint32 size);
+
+IMPORT_C void BsInit1(TBitStream *bs, uint8 *bit_buffer, uint32 size);
+
+IMPORT_C void BsInit2(TBitStream *bs, DSP_BYTE *dsp_buffer, uint32 size);
+
+
+/**
+ * Retrieves size of bitstream in bytes.
+ *
+ * @param   bs   Bitstream handle
+ *
+ * @return       Size of bitstream      
+ */
+IMPORT_C uint32 BsGetBufSize(TBitStream *bs);
+
+IMPORT_C uint32 BsGetBufOriginalSize(TBitStream *bs);
+
+/**
+ * Retrieves number of bits read from the bitstream.
+ *
+ * @param   bs   Bitstream handle
+ */
+IMPORT_C uint32 BsGetBitsRead(TBitStream *bs);
+
+IMPORT_C void BsSetBitsRead(TBitStream *bs, uint32 bits_read);
+IMPORT_C void BsClearBitsRead(TBitStream *bs);
+
+/**
+ * Resets bitstream.
+ *
+ * @param   bs   Bitstream handle
+ */
+IMPORT_C void BsReset(TBitStream *bs);
+
+/**
+ * Retrieves the number of bytes left in the bitstream.
+ *
+ * @param   bs     Bitstream handle
+ *
+ * @return  Number of bytes left in the bitstream
+ */
+IMPORT_C uint32 BsSlotsLeft(TBitStream *bs);
+
+/**
+ * Appends bits from one bitstream to another bitstream.
+ *
+ * @param   bs     Source btstream handle
+ * @param   br     Destination btstream handle
+ * @param   n      Number of bytes to copy
+ */
+IMPORT_C void BsMoveBytes(TBitStream *bs, TBitStream *br, int16 n);
+
+/**
+ * Appends bits from one specified buffer to bitstream.
+ *
+ * @param   bs           Destination btstream handle
+ * @param   outBuf       Source buffer
+ * @param   bytesToCopy  Number of bytes to copy
+ *
+ * @return  Number of bytes appended
+ */
+IMPORT_C uint32 BsCopyBytes(TBitStream *bs, uint8 *outBuf, uint32 bytesToCopy);
+
+/**
+ * Appends bits from one source to destination bitstream.
+ *
+ * @param   bs          Destination btstream handle
+ * @param   outBuf      Source bitstream handle
+ * @param   bitsToCopy  Number of bits to copy
+ */
+IMPORT_C void 
+BsCopyBits(TBitStream *bsSrc, TBitStream *bsDst, int32 bitsToCopy);
+
+/**
+ * Rewinds the read index of the bitstream.
+ *
+ * @param   bs     Bitstream handle
+ * @param   n      Number of bits to rewind
+ */
+IMPORT_C void BsRewindNBits(TBitStream *bs, uint32 nBits);
+
+IMPORT_C void BsBufferUpdate(TBitStream *bs, int32 bytesRead);
+
+IMPORT_C void BsSaveBufState(TBitStream *bsSrc, TBitStream *bsDst);
+
+/**
+ * Writes bits to bitstream.
+ *
+ * @param   bs     Bitstream handle
+ * @param   n      Number of bits to write
+ * @param   word   Data bits to write
+ */
+IMPORT_C void BsPutBits(TBitStream *bs, int16 n, uint32 word);
+
+/**
+ * Byte aligns bitstream by writing '0' bits.
+ *
+ * @param   bs  Bitstream handle
+ *
+ * @return  Number of bits written
+ */
+IMPORT_C int16 BsPutBitsByteAlign(TBitStream *bs);
+
+/**
+ * Reads bits from bitstream.
+ *
+ * @param   bs     Bitstream handle
+ * @param   n      Number of bits to read
+ *
+ * @return  Read data bits
+ */
+IMPORT_C uint32 BsGetBits(TBitStream *bs, int16 n);
+
+/**
+ * Byte aligns bitstream by advanding read index.
+ *
+ * @param   bs  Bitstream handle
+ *
+ * @return  Number of bits skipped
+ */
+IMPORT_C int16 BsByteAlign(TBitStream *bs);
+
+/**
+ * Reads bits from bitstream without updating read index.
+ *
+ * @param   bs  Bitstream handle
+ * @param   n   Number of bits to lookahead
+ *
+ * @return  Read data bits
+ */
+IMPORT_C uint32 BsLookAhead(TBitStream *bs, int16 n);
+
+/**
+ * Advances bitstream read index (8 bits at maximum!).
+ *
+ * @param   bs  Bitstream handle
+ * @param   n   Number of bits to skip. Note that this can at maximum be 8 bits!
+ */
+IMPORT_C void BsSkipBits(TBitStream *bs, int16 n);
+
+/**
+ * Advances bitstream read index.
+ *
+ * @param   bs  Bitstream handle
+ * @param   n   Number of bits to skip
+ */
+IMPORT_C void BsSkipNBits(TBitStream *bs, int32 n);
+
+#endif /*-- BITSTREAM_H_ --*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/src/AudPanic.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/* Copyright (C) 2004 Nokia Corporation. */
+
+#include "AudPanic.h"
+
+
+void TAudPanic::Panic(TCode aCode)
+    {
+    User::Panic(_L("Audio Editor Eng"), aCode);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/src/Mp3API.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,409 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "Mp3API.h"
+#include "mpif.h"
+#include "mpaud.h"
+#include "mpheader.h"
+#include "mp3tool.h"
+
+
+
+
+// Exception handler for FLOATS
+void handler(TExcType /*aType*/)
+{
+#ifndef __WINS__
+//    CMp3Mix::WriteL(_L("Exception cought!!!"));
+#endif
+
+}
+
+//const int16 Kmp3BufSize = 8;
+
+EXPORT_C CMp3Edit* CMp3Edit::NewL()
+    {
+
+    CMp3Edit* self = new (ELeave) CMp3Edit();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+
+void CMp3Edit::ConstructL()
+    {
+    
+      }
+
+
+EXPORT_C CMp3Edit::~CMp3Edit()
+    {
+
+    }
+
+CMp3Edit::CMp3Edit()
+    {
+
+    }
+
+
+EXPORT_C uint32
+CMp3Edit::FileLengthInMs(TMpTransportHandle *tHandle, int32 fileSize) const
+    {
+    return MP_FileLengthInMs(tHandle, fileSize);
+    }
+
+EXPORT_C int32
+CMp3Edit::GetSeekOffset(TMpTransportHandle *tHandle, int32 seekPos) const
+    {
+    return MP_GetSeekOffset(tHandle, seekPos);
+    }
+
+EXPORT_C int32
+CMp3Edit::GetFrameTime(TMpTransportHandle *tHandle) const
+    {
+    return MP_GetFrameTime(tHandle);
+    }
+
+EXPORT_C void 
+CMp3Edit::InitTransport(TMpTransportHandle *tHandle) const
+    {
+
+    mpInitTransport(tHandle);
+    }
+
+EXPORT_C int16
+CMp3Edit::SeekSync(TMpTransportHandle *tHandle, uint8 *syncBuf, 
+            uint32 syncBufLen, int16 *readBytes, 
+            int16 *frameBytes, int16 *headerBytes,
+            uint8 initMode) const
+
+    {
+
+    return MP_SeekSync(tHandle, syncBuf, 
+            syncBufLen, readBytes, 
+            frameBytes, headerBytes,
+            initMode);
+    }
+
+EXPORT_C int16
+CMp3Edit::FreeMode(TMpTransportHandle *tHandle, uint8 *syncBuf, 
+            uint32 syncBufLen, int16 *readBytes, 
+            int16 *frameBytes, int16 *headerBytes) const
+    {
+    return MP_FreeMode(tHandle, syncBuf, 
+            syncBufLen, readBytes, 
+            frameBytes, headerBytes);
+    }
+
+EXPORT_C int16
+CMp3Edit::EstimateBitrate(TMpTransportHandle *tHandle, uint8 isVbr) const
+    {
+    return MP_EstimateBitrate(tHandle, isVbr) ;
+
+    }
+
+
+
+/*
+ * Saves modified 'global_gain' bitstream elements to specified layer I/II/III data buffer.
+ */
+EXPORT_C void
+CMp3Edit::SetMPGlobalGains(TBitStream *bs, uint8 numGains, uint8 *globalGain, uint32 *gainPos)
+{
+  int16 i;
+
+  /*-- Store the gain element back to bitstream. --*/
+  for(i = 0; i < numGains; i++)
+  {
+    BsSkipNBits(bs, gainPos[i]); 
+    BsPutBits(bs, 8, globalGain[i]);
+  }
+}
+
+
+
+EXPORT_C uint8
+CMp3Edit::GetMPGlobalGains(TBitStream *bs, TMpTransportHandle *tHandle, uint8 *globalGain, uint32 *gainPos)
+{
+  uint32 bufBitOffset;
+  uint8 numGains, nVersion, nChannels;
+
+  numGains = 0;
+  nVersion = (uint8) version(&tHandle->header);
+  nChannels =(uint8)  channels(&tHandle->header);
+
+  bufBitOffset = BsGetBitsRead(bs);
+
+  /*-- Get the gain for each channel and granule. --*/
+  switch(nVersion)
+  {
+    /*-- MPEG-1. --*/
+    case 1:
+      switch(nChannels)
+      {
+        /*
+         * Mono frame consists of 2 granules.
+         */
+        case 1:
+          numGains = 2;
+
+          /*-- Left channel, granules 0 and granule 1. --*/
+          BsSkipNBits(bs, 0x27);
+          gainPos[0] = BsGetBitsRead(bs) - bufBitOffset;
+          globalGain[0] = (uint8) BsGetBits(bs, 8);
+          BsSkipNBits(bs, 0x33);
+          gainPos[1] = 0x33;
+          globalGain[1] = (uint8) BsGetBits(bs, 8);
+          break;
+
+        /*
+         * Two channels, 2 granules.
+         */
+        case 2:
+          numGains = 4;
+
+          /*-- Left and right channel, granule 0. --*/
+          BsSkipNBits(bs, 0x29);
+          gainPos[0] = BsGetBitsRead(bs) - bufBitOffset;
+          globalGain[0] = (uint8) BsGetBits(bs, 8);
+          BsSkipNBits(bs, 0x33); 
+          gainPos[1] = 0x33;
+          globalGain[1] = (uint8) BsGetBits(bs, 8);
+
+          /*-- Left and right channel, granule 1. --*/
+          BsSkipNBits(bs, 0x33); 
+          gainPos[2] = 0x33;
+          globalGain[2] = (uint8) BsGetBits(bs, 8);
+          BsSkipNBits(bs, 0x33); 
+          gainPos[3] = 0x33;
+          globalGain[3] = (uint8) BsGetBits(bs, 8);
+          break;
+      }
+      break;
+
+    /*-- MPEG-2 LSF and MPEG-2.5. --*/
+    default:
+      switch(nChannels)
+      {
+        /*
+         * Mono channel, 1 granule.
+         */
+        case 1:
+          numGains = 1;
+          BsSkipNBits(bs, 0x1E); 
+          gainPos[0] = BsGetBitsRead(bs) - bufBitOffset;
+          globalGain[0] = (uint8) BsGetBits(bs, 8);
+          break;
+
+        /*
+         * Two channels, 1 granule.
+         */
+        case 2:
+          numGains = 2;
+          BsSkipNBits(bs, 0x1F); 
+          gainPos[0] = BsGetBitsRead(bs) - bufBitOffset;
+          globalGain[0] = (uint8) BsGetBits(bs, 8);
+          BsSkipNBits(bs, 0x37); 
+          gainPos[1] = 0x37;
+          globalGain[1] = (uint8) BsGetBits(bs, 8);
+          break;
+      }
+      break;
+  }
+
+
+  return (numGains);
+}
+
+EXPORT_C CMPAudDec* CMPAudDec::NewL()
+    {
+    CMPAudDec* self = new (ELeave) CMPAudDec();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+
+
+    }
+    
+CMPAudDec::CMPAudDec()
+    {
+
+
+    }
+
+EXPORT_C CMPAudDec::~CMPAudDec()
+    {
+
+  
+    int16 i;
+
+    /* --Scalefactors. --*/
+    if (frame->scale_factors != 0) delete[] frame->scale_factors;
+    
+    /*-- Quantized samples. --*/
+    if (frame->quant != 0) delete[] frame->quant;
+
+    /*-- Huffman codebooks. --*/
+    if (huffman != 0) delete[] huffman;
+
+    /*-- Layer III side info. --*/
+    if(side_info)
+        {
+        for(i = 0; i < MAX_CHANNELS; i++)
+            {
+            int16 j;
+
+            if(side_info->ch_info[i])
+                {
+                if (side_info->ch_info[i]->scale_fac != 0) delete side_info->ch_info[i]->scale_fac;
+          
+                for(j = 0; j < 2; j++)
+                    if (side_info->ch_info[i]->gr_info[j] != 0) delete side_info->ch_info[i]->gr_info[j];
+                }      
+            if (side_info->ch_info[i] != 0) delete side_info->ch_info[i];
+            }
+    
+        if (side_info->s_mode_long != 0) delete[] side_info->s_mode_long;
+    
+        for(i = 0; i < 3; i++)
+            if (side_info->s_mode_short[i] != 0) delete[] side_info->s_mode_short[i];
+    
+        if (side_info != 0) delete side_info;
+        }
+  
+    if (frame != 0) delete frame;
+    if (bitReserv != 0) delete[] bitReserv;
+
+    
+
+    }
+
+void CMPAudDec::ConstructL()
+    {
+     
+    int16 i, j, groups;
+
+    /*-- Create handle. --*/
+    
+    /*-- Create bit reservoir buffer. --*/
+    bitReserv = new (ELeave) uint8[4 * MAX_BITRESER_SIZE];
+    ZERO_MEMORY(bitReserv, 4 * MAX_BITRESER_SIZE * sizeof(uint8));
+
+    BsInit(&br, bitReserv, 4 * MAX_BITRESER_SIZE);
+  
+    /*-- Create frame parameters. --*/
+    frame = new (ELeave) TMPEG_Frame;
+  
+    /*-- Create side info parameters. --*/
+    side_info = CIII_Side_Info::NewL();
+  
+    /*-- Create scalefactors. --*/
+    frame->scale_factors = new (ELeave) uint8[MAX_CHANNELS * SBLIMIT * 3];
+    ZERO_MEMORY(frame->scale_factors, MAX_CHANNELS * SBLIMIT * 3 * sizeof(uint8)); 
+
+
+    /*-- Create L3 side info. --*/
+    for(i = 0; i < MAX_CHANNELS; i++)
+        {
+    
+        side_info->ch_info[i] = CIII_Channel_Info::NewL();
+    
+        for(j = 0; j < 2; j++)
+            {
+                side_info->ch_info[i]->gr_info[j] = new (ELeave) TGranule_Info;
+      
+            }
+        }
+  
+    side_info->s_mode_long = new (ELeave) StereoMode[22];
+    
+    ZERO_MEMORY(side_info->s_mode_long, 22 * sizeof(StereoMode));
+
+    for(i = 0; i < 3; i++)
+        {
+        side_info->s_mode_short[i] =  new (ELeave) StereoMode[13]; //GET_CHUNK(13 * sizeof(StereoMode));
+        ZERO_MEMORY(side_info->s_mode_short[i], 13 * sizeof(StereoMode));
+        }
+  
+    /*-- Initialize scalefactors. --*/
+    for(i = j = 0; i < MAX_CHANNELS; i++)
+        {
+        uint8 idx[] = {0, 23, 36, 49, 62, 85, 98, 111};
+
+        CIII_Scale_Factors *scale_fac;
+
+        side_info->ch_info[i]->scale_fac = new (ELeave) CIII_Scale_Factors();
+      
+        scale_fac = side_info->ch_info[i]->scale_fac;
+
+        scale_fac->scalefac_long     = frame->scale_factors + idx[j++];
+        scale_fac->scalefac_short[0] = frame->scale_factors + idx[j++];
+        scale_fac->scalefac_short[1] = frame->scale_factors + idx[j++];
+        scale_fac->scalefac_short[2] = frame->scale_factors + idx[j++];
+    }
+
+    groups = MAX_MONO_SAMPLES * MAX_CHANNELS;
+
+    /*-- Create buffer for quantized samples. --*/
+    frame->quant = new (ELeave) int16[groups + 10];//(int16 *) GET_CHUNK((groups + 10) * sizeof(int16));
+
+    ZERO_MEMORY(frame->quant, (groups + 10) * sizeof(int16));
+
+    for(i = 0; i < MAX_CHANNELS; i++)
+        frame->ch_quant[i] = frame->quant + i * MAX_MONO_SAMPLES;
+
+    /*-- Create Huffman handle. --*/
+    huffman = new (ELeave) CHuffman[33];// *) GET_CHUNK(33 * sizeof(CHuffman)); 
+    
+    /*-- Get the Huffman codebooks. --*/
+    InitL3Huffman(huffman);
+
+    }
+
+    /*-- Initializes MPEG Layer I/II/III decoder handle. --*/
+EXPORT_C void
+CMPAudDec::Init(TMpTransportHandle *aMpFileFormat)
+{
+  mpFileFormat = aMpFileFormat;
+
+  /*-- MPEG-1 --*/
+  if(version(&mpFileFormat->header) == MPEG_AUDIO_ID)
+    {
+    side_info->lsf = FALSE;
+    side_info->max_gr = 2;
+    }
+
+    /*-- MPEG-2 LSF or MPEG-2.5 --*/
+    else
+    {
+        side_info->lsf = TRUE;
+        side_info->max_gr = 1;
+    }
+
+    /*-- Get the scalefactor band related parameters. --*/
+    III_SfbDataInit(side_info->sfbData, &mpFileFormat->header);
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/src/mp3aacManip.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/* Copyright (C) 2004 Nokia Corporation. */
+
+#include <e32std.h>
+
+
+EXPORT_C TInt E32Dll(TDllReason)
+    {
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/mp3aacManipLib/src/mstream.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,565 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+/**************************************************************************
+  External Objects Needed
+  *************************************************************************/
+
+/*-- Project Headers --*/
+#include "mstream.h"
+#include "mpheader.h" 
+#include "mp3Tool.h"
+
+
+
+CIII_Channel_Info* CIII_Channel_Info::NewL() 
+    {
+
+
+    CIII_Channel_Info* self = new (ELeave) CIII_Channel_Info();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CIII_Channel_Info::ConstructL()
+    {
+    
+    }
+
+CIII_Channel_Info::CIII_Channel_Info()
+    {
+
+
+    }
+
+CIII_Channel_Info::~CIII_Channel_Info()
+    {
+
+
+    }
+
+
+CIII_SfbData* CIII_SfbData::NewL() 
+    {
+
+    CIII_SfbData* self = new (ELeave) CIII_SfbData();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CIII_SfbData::ConstructL()
+    {
+    sfbOffsetLong = new (ELeave) int16[MAX_LONG_SFB_BANDS + 1];
+    sfbOffsetShort = new (ELeave) int16[MAX_SHORT_SFB_BANDS + 1];
+    sfbWidthShort = new (ELeave) int16[MAX_SHORT_SFB_BANDS + 1];
+    }
+
+CIII_SfbData::CIII_SfbData()
+    {
+
+
+    }
+
+CIII_SfbData::~CIII_SfbData()
+    {
+    if (sfbOffsetLong != 0) delete[] sfbOffsetLong;
+    if (sfbOffsetShort != 0) delete[] sfbOffsetShort;
+    if (sfbWidthShort != 0) delete[] sfbWidthShort;
+
+    }
+
+CIII_Side_Info* CIII_Side_Info::NewL() 
+    {
+
+    CIII_Side_Info* self = new (ELeave) CIII_Side_Info();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CIII_Side_Info::ConstructL()
+    {
+    sfbData = GET_SYMBIAN_CHUNK(CIII_SfbData);
+
+    }
+
+CIII_Side_Info::CIII_Side_Info()
+    {
+
+    }
+
+CIII_Side_Info::~CIII_Side_Info()
+    {
+    if (sfbData != 0) SAFE_SYMBIAN_DELETE(sfbData);
+
+    }
+
+CMCUBuf* CMCUBuf::NewL(TInt aBufLen) 
+    {
+
+    CMCUBuf* self = new (ELeave) CMCUBuf();
+    CleanupStack::PushL(self);
+    self->ConstructL(aBufLen);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CMCUBuf::ConstructL(TInt aBufLen)
+    {
+    
+    bs = new (ELeave) TBitStream();
+
+    mcuBufbits = new (ELeave) uint8[aBufLen];  
+
+
+    }
+
+CMCUBuf::CMCUBuf()
+    {
+
+    }
+
+CMCUBuf::~CMCUBuf()
+    {
+
+    if (bs != 0) delete bs;
+    if (mcuBufbits != 0) 
+        {
+        delete[] mcuBufbits;
+        mcuBufbits = 0;
+        }
+
+    }
+
+/**************************************************************************
+  Title        : decode_header
+
+  Purpose      : Reads header information (excluding syncword) from the bitstream.
+
+  Usage        : decode_header(mp)
+
+  Input        : mp - mp3 bitstream parameters
+
+  Explanation  : Header information is commmon to all layers. Note also that
+                 this function doesn't interprete the fields of the header.
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+void
+decode_header(CMP_Stream *mp, TBitStream *bs)
+{
+  uint32 header;
+
+  mp->headerOld.header = mp->header->header;
+  header = (!mp->side_info->mpeg25) << HEADER_BITS;
+  header |= BsGetBits(bs, HEADER_BITS);
+  mp->header->header = header;
+
+  /*-- Store the header bits 16-31 for CRC error checking. --*/
+  mp->mp3_crc.crc_payload[0] = (uint8)((header >> 8) & 255);
+  mp->mp3_crc.crc_payload[1] = (uint8) (header & 255);
+
+  if(error_protection(mp->header))
+    mp->mp3_crc.crc = (int16)(BsGetBits(bs, 16));
+}
+
+/**************************************************************************
+  Title        : FillDataSlotTable
+
+  Purpose      : Pre-computes (to avoid division operation during decoding) 
+                 the payload size of layer III for all bitrates.
+
+  Usage        : y = FillDataSlotTable(mp)
+
+  Input        : mp - mp3 stream parameters
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+void
+FillDataSlotTable(CMP_Stream *mp)
+{
+  const int16 *brTbl;
+  int16 nSlots;
+  
+  brTbl = GetBitRateTable(mp->header);
+  /*
+   * index 0 is free format and index 14 illegal bitrate.
+   */
+  for(int16 i = 1; i < 15; i++)
+  {
+    nSlots = (int16)((144 * brTbl[i]) / (frequency(mp->header) / 1000.0f));
+
+    if(version(mp->header) == MPEG_PHASE2_LSF)
+      nSlots >>= 1;
+
+    mp->FrameTable[i] = nSlots;
+
+    nSlots = (int16)(nSlots - (GetSideInfoSlots(mp->header) + 4));
+    mp->SlotTable[i] = nSlots;
+  }
+}
+
+/**************************************************************************
+  Title        : main_data_slots
+
+  Purpose      : Computes the number of bytes for the layer III payload. The
+                 payload consists of the scalefactors and quantized data of
+                 the channel(s).
+
+  Usage        : y = main_data_slots(mp)
+
+  Input        : mp - mp3 stream parameters
+
+  Output       : y - # of payload bytes for this frame
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+int32
+main_data_slots(CMP_Stream *mp)
+{
+  int16 nSlots;
+
+  if(bit_rate(mp->header))
+  {
+    nSlots = mp->SlotTable[bit_rate_idx(mp->header)];
+
+    if(padding(mp->header))
+      nSlots++;
+    if(error_protection(mp->header))
+      nSlots -= 2;
+  }
+  else
+  {
+    nSlots = mp->FreeFormatSlots;
+
+    if(padding(mp->header))
+      nSlots++;
+  }
+
+  return(nSlots);
+}
+
+/**************************************************************************
+  Title        : ReleaseMP3Decoder
+
+  Purpose      : Releases resources allocated to the mp3 decoder core.
+
+  Usage        : ReleaseMP3Decoder(mp)
+
+  Input        : mp - mp3 decoder core
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+void
+ReleaseMP3Decoder(CMP_Stream *mp)
+    {
+    int16 i, j;
+  
+    if(mp)
+        {
+        /* Scalefactors. */
+        SAFE_DELETE(mp->frame->scale_factors);
+        
+        /* Quantized samples. */
+        SAFE_DELETE(mp->frame->quant);
+
+        /* Synthesis buffer. */
+        for(i = 0; i < MAX_CHANNELS; i++)
+            {
+            SAFE_DELETE(mp->buffer->synthesis_buffer[i]);    
+            }
+          
+        
+        /* Dequantized samples. */
+        SAFE_DELETE(mp->buffer->reconstructed);
+
+        /* Huffman codebooks. */
+        SAFE_DELETE(mp->huffman);
+        
+        if(mp->side_info)
+            {
+              for(i = 0; i < MAX_CHANNELS; i++)
+                  {
+                SAFE_DELETE(mp->side_info->ch_info[i]->scale_fac);
+      
+                for(j = 0; j < 2; j++)
+                    {
+                    SAFE_DELETE(mp->side_info->ch_info[i]->gr_info[j]);    
+                    }
+      
+      
+                SAFE_SYMBIAN_DELETE(mp->side_info->ch_info[i]);
+                  }
+    
+            SAFE_DELETE(mp->side_info->s_mode_long);
+    
+            for(i = 0; i < 3; i++)
+                {
+                SAFE_DELETE(mp->side_info->s_mode_short[i]);    
+                }
+                
+    
+            SAFE_SYMBIAN_DELETE(mp->side_info);
+            }
+  
+        SAFE_DELETE(mp->header);
+        SAFE_DELETE(mp->frame);
+        SAFE_DELETE(mp->buffer);
+        SAFE_DELETE(mp->br);
+//    SAFE_DELETE(mp->bs);
+          }
+    }
+
+/**************************************************************************
+  Title        : GetMP3Handle
+
+  Purpose      : Returns mp3 decoder core handle to the callee.
+
+  Usage        : GetMP3Handle()
+
+  Output       : mp - handle of mp3 decoder core
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+CMP_Stream *
+GetMP3HandleL(void)
+{
+  int16 i, j, groups, idx[] = {0, 23, 36, 49, 62, 85, 98, 111};
+  CIII_Scale_Factors *scale_fac;
+  CMP_Stream *mp;
+
+  //mp = (CMP_Stream *) GET_CHUNK(sizeof(CMP_Stream));
+  
+  mp = new (ELeave) CMP_Stream();
+  IS_ERROR(mp);
+
+
+
+  //mp->bs = (TBitStream *) GET_CHUNK(sizeof(TBitStream));
+  //IS_ERROR(mp->bs);
+
+  mp->header = (TMPEG_Header *) GET_CHUNK(sizeof(TMPEG_Header));
+  IS_ERROR(mp->header);
+
+  mp->frame = (TMPEG_Frame *) GET_CHUNK(sizeof(TMPEG_Frame));
+  IS_ERROR(mp->frame);
+
+  mp->buffer = (TMPEG_Buffer *) GET_CHUNK(sizeof(TMPEG_Buffer)); 
+  IS_ERROR(mp->buffer);
+
+  mp->side_info = (CIII_Side_Info *) GET_SYMBIAN_CHUNK(CIII_Side_Info);
+  IS_ERROR(mp->side_info);
+
+  mp->frame->scale_factors = (uint8 *) GET_CHUNK(MAX_CHANNELS * SBLIMIT * 3 * sizeof(uint8));
+  Mem::FillZ    (mp->frame->scale_factors, MAX_CHANNELS * SBLIMIT * 3 * sizeof(uint8));
+
+  IS_ERROR(mp->frame->scale_factors);
+
+  mp->huffman = (CHuffman *) GET_CHUNK(33 * sizeof(CHuffman)); 
+  IS_ERROR(mp->huffman);
+
+  mp->br = (TBitStream *) GET_CHUNK(sizeof(TBitStream)); 
+  IS_ERROR(mp->br);
+
+  Mem::Fill(mp->PrevStreamInfo, sizeof(uint32) * 2, 0);
+
+  for(i = 0; i < MAX_CHANNELS; i++)
+  {
+    //mp->side_info->ch_info[i] = (CIII_Channel_Info *) GET_CHUNK(sizeof(CIII_Channel_Info));
+      mp->side_info->ch_info[i] = GET_SYMBIAN_CHUNK(CIII_Channel_Info);
+    IS_ERROR(mp->side_info->ch_info[i]);
+    for(j = 0; j < 2; j++)
+    {
+      mp->side_info->ch_info[i]->gr_info[j] = (TGranule_Info *) GET_CHUNK(sizeof(TGranule_Info));
+      IS_ERROR(mp->side_info->ch_info[i]->gr_info[j]);
+    }
+  }
+  
+  mp->side_info->s_mode_long = (StereoMode *) GET_CHUNK(22 * sizeof(StereoMode));
+  IS_ERROR(mp->side_info->s_mode_long);
+  for(i = 0; i < 3; i++)
+  {
+    mp->side_info->s_mode_short[i] =  (StereoMode *) GET_CHUNK(13 * sizeof(StereoMode));
+    IS_ERROR(mp->side_info->s_mode_short[i]);
+  }
+  
+  for(i = j = 0; i < MAX_CHANNELS; i++)
+  {
+    mp->side_info->ch_info[i]->scale_fac = (CIII_Scale_Factors *) GET_CHUNK(sizeof(CIII_Scale_Factors));
+    IS_ERROR(mp->side_info->ch_info[i]->scale_fac);
+    scale_fac = mp->side_info->ch_info[i]->scale_fac;
+    
+    scale_fac->scalefac_long = mp->frame->scale_factors + idx[j++];
+    scale_fac->scalefac_short[0] = mp->frame->scale_factors + idx[j++];
+    scale_fac->scalefac_short[1] = mp->frame->scale_factors + idx[j++];
+    scale_fac->scalefac_short[2] = mp->frame->scale_factors + idx[j++];
+  }
+
+  groups = MAX_MONO_SAMPLES * MAX_CHANNELS;
+
+  TInt a = 0;
+  mp->frame->quant = (int16 *) GET_CHUNK((groups + 10) * sizeof(int16));
+    for (a = 0 ; a < groups ; a++) mp->frame->quant[a] = 0;
+
+  IS_ERROR(mp->frame->quant);
+
+  mp->buffer->reconstructed = (FLOAT *) GET_CHUNK(groups * sizeof(FLOAT));
+  IS_ERROR(mp->buffer->reconstructed);
+  for (a = 0 ; a < groups ; a++) mp->buffer->reconstructed[a] = 0;
+
+  for(i = 0; i < MAX_CHANNELS; i++)
+  {
+    mp->frame->ch_quant[i] = mp->frame->quant + i * MAX_MONO_SAMPLES;
+    mp->buffer->ch_reconstructed[i] = mp->buffer->reconstructed + i * MAX_MONO_SAMPLES;
+    for(j = 0; j < SBLIMIT; j++)
+      mp->spectrum[i][j] = &mp->buffer->ch_reconstructed[i][j * SSLIMIT];
+  }
+
+  for(i = 0; i < MAX_CHANNELS; i++)
+  {
+    mp->buffer->buf_idx[i] = mp->buffer->dct_idx[i] = 0;
+    mp->buffer->synthesis_buffer[i] = (FLOAT *) GET_CHUNK((HAN_SIZE << 1) * sizeof(FLOAT));
+    IS_ERROR(mp->buffer->synthesis_buffer[i]);
+  }
+
+  //-- Get the Huffman codebooks. --
+  //init_huffman(mp->huffman);
+  InitL3Huffman(mp->huffman);
+  return (mp);
+
+// error_exit:
+  
+  //ReleaseMP3Decoder(mp);
+  
+  //return (NULL);
+}
+
+/**************************************************************************
+  Title        : MP3DecPrepareInit
+
+  Purpose      : Prepares the core engine parameters for the search of 
+                 first mp3 frame.
+
+  Usage        : MP3DecPrepareInit(mp, out_param, complex, br_buffer, br_size)
+
+  Input        : mp        - handle of mp3 decoder core
+                 out_param - output parameters of current track
+         complex   - decoding complexity parameters
+         br_buffer - address of bit reservoir buffer
+         br_size   - size of bit reservoir buffer
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+void
+MP3DecPrepareInit(CMP_Stream *mp, Out_Param *out_param, Out_Complexity *complex,
+          DSP_BYTE *br_buffer, uint32 br_size)
+{
+  mp->complex = complex;
+  mp->out_param = out_param;
+
+  BsInit2(mp->br, br_buffer, br_size);
+  
+  mp->mp3_crc.crc = 0;
+  
+  mp->header->header = 0;
+  
+  mp->syncInfo.sync_word = (int16)SYNC_WORD;
+  mp->syncInfo.sync_length = (int16)SYNC_WORD_LENGTH;
+  mp->syncInfo.sync_mask = (int16)((1 << mp->syncInfo.sync_length) - 1);
+  mp->syncInfo.sync_status = FIRST_FRAME_WITH_LAYER3;
+
+  mp->FreeFormatSlots = 0;
+  mp->idx_increment = 0;
+  mp->PrevSlots = 0;
+  mp->FrameStart = 0;
+  mp->SkipBr = FALSE;
+  mp->WasSeeking = FALSE;
+  mp->OverlapBufPtr[0] = mp->OverlapBufPtr[1] = 0;
+}
+
+/**************************************************************************
+  Title        : MP3DecCompleteInit
+
+  Purpose      : Completes the initialization of the core engine parameters.
+
+  Usage        : MP3DecPrepareInit(mp, frameBytes)
+
+  Input        : mp - handle of mp3 decoder core
+
+  Output       : frameBytes - # of bytes for the first frame
+
+  Author(s)    : Juha Ojanpera
+  *************************************************************************/
+
+void
+MP3DecCompleteInit(CMP_Stream *mp, int16 *frameBytes)
+{
+  //-- Fixed size (unit is bytes !!). --
+  mp->mp3_crc.bufLen = (uint16)(2 + GetSideInfoSlots(mp->header));
+
+  //-- MPEG-1 --/
+  if(version(mp->header) == MPEG_AUDIO_ID)
+  {
+    mp->side_info->lsf = FALSE;
+    mp->side_info->max_gr = 2;
+  }
+  //-- MPEG-2 LSF or MPEG-2.5 --
+  else
+  {
+    mp->side_info->lsf = TRUE;
+    mp->side_info->max_gr = 1;
+  }
+
+  //-- Determine the size of the payload only when necessary. --/
+  if(bit_rate(mp->header))
+  {
+    mp->FreeFormatSlots = 0;
+
+    if((int32)(frequency(mp->header) != mp->PrevStreamInfo[0]) ||
+       (int32)(channels(mp->header) != mp->PrevStreamInfo[1]))
+      FillDataSlotTable(mp);
+  }
+  else FillDataSlotTable(mp);
+  
+  mp->PrevStreamInfo[0] = frequency(mp->header);
+  mp->PrevStreamInfo[1] = channels(mp->header);
+
+  //-- Get the scalefactor band related parameters. --/
+  III_SfbDataInit(mp->side_info->sfbData, mp->header);
+  
+  //-- Init re-ordering table. --//
+  init_III_reorder(mp->reorder_idx, mp->side_info->sfbData->sfbShort, 
+           mp->side_info->sfbData->sfbWidth);
+
+  //-- Number of bytes for next frame. --/
+  *frameBytes = (int16)(main_data_slots(mp) + GetSideInfoSlots(mp->header) + 3);
+  if(error_protection(mp->header))
+    *frameBytes += 2;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/rom/VideoEditorEngine.iby	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifdef RD_S60_SIMPLE_VIDEO_EDITOR
+
+#ifndef __VIDEOEDITORENGINE_IBY__
+#define __VIDEOEDITORENGINE_IBY__
+
+// Utilizing constants from data_caging_paths_for_iby.hrh, included in higher level
+
+file=ABI_DIR\BUILD_DIR\aedmp3aaclib.dll 		SHARED_LIB_DIR\aedmp3aaclib.dll
+file=ABI_DIR\BUILD_DIR\aedengine.dll			SHARED_LIB_DIR\aedengine.dll
+file=ABI_DIR\BUILD_DIR\vedtranscoder.dll 		SHARED_LIB_DIR\vedtranscoder.dll
+file=ABI_DIR\BUILD_DIR\vedh263d.dll      		SHARED_LIB_DIR\vedh263d.dll
+file=ABI_DIR\BUILD_DIR\vedengine.dll     		SHARED_LIB_DIR\vedengine.dll
+file=ABI_DIR\BUILD_DIR\vedavcedit.dll     		SHARED_LIB_DIR\vedavcedit.dll
+
+// sis stub
+//data=ZSYSTEM\install\VideoEditorEngineStub.sis    System\Install\VideoEditorEngineStub.sis
+
+#endif	//__VIDEOEDITORENGINE_IBY__
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/inc/DCColorManagement.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//DCColorManagement.h
+//
+//Version 1.00
+//
+//Contains:
+//	CDCCDM 
+//		Simple color management approach consisting
+//		of 3xLUT + 3x3 Matrix + 3xLUT for compensating
+//		display specific features.
+//	
+//History:
+//	19.08.2003 version 1.00 created using existing IMAAMI algorithms	
+//*************************************************************************
+
+
+#ifndef __DCColorManagement_H
+#define __DCColorManagement_H
+
+#include <e32std.h> // for Fundamental Types
+#include <e32base.h> // for Fundamental Types
+#include <e32math.h> //for the calculation of exponents
+
+//Class definition
+class CDCColorManagement : public CBase
+{
+
+public:
+
+	//Parameter struct definition
+	struct DCColorManagementParams
+	{
+		//Gamma de-correction (linearization) LUTs
+		//Pointers to actual data
+		TInt *GammaR;
+		TInt *GammaG;
+		TInt *GammaB;
+		
+		//3x3 color space modification matrix
+		//Pointer to actual data
+		TInt *Matrix;
+		
+		//Tone rendering curves = display compensation LUTs
+		//Pointers to actual data
+		TInt *TRCR;
+		TInt *TRCG;
+		TInt *TRCB;
+	};
+
+	//Gamma de-correction (linearization) LUTs
+	TInt iGammaR[256];
+	TInt iGammaG[256];
+	TInt iGammaB[256];
+	
+	//3x3 color space modification matrix
+	TInt iMatrix[9];
+
+	//Tone rendering curves = display compensation LUTs
+	TInt iTRCR[256];
+	TInt iTRCG[256];
+	TInt iTRCB[256];
+
+	//Standard class member functions
+	CDCColorManagement();
+	static CDCColorManagement* NewL();
+	static CDCColorManagement* NewLC();
+	~CDCColorManagement();
+	void ConstructL();
+	
+	//Process original image and store result
+	void ProcessL(CFbsBitmap* aBPtr);
+
+	//Set processing parameters
+	void SetParameters(DCColorManagementParams* params);
+	
+	//Get current processing parameters
+	void GetParameters(DCColorManagementParams* params);
+
+	//Limit integer value to byte [0,255]
+	static inline TUint8 Limit255(TInt i) {return (TUint8)(i<0?0:(i>255?255:i));}
+	
+private:
+	
+	// Line Buffer and pointer
+	HBufC8*	iScanLine;
+	
+	//Processing parameters
+	DCColorManagementParams iParams;
+
+};
+
+#endif // ifndef __DCColorManagement_H
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/inc/DCDefines.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//DCDefines.h
+//
+//Version 1.00
+//
+//Contains:
+//	_Defines_H 
+//		Defines the parameter values used in the IMAAMI algorithms.
+//			
+//History:
+//	19.08.2003 version 1.00 created using existing IMAAMI algorithms	
+//*************************************************************************
+
+
+
+#ifndef _Defines_H
+#define _Defines_H
+
+#define EXPO_SHIFT			13			// Accuracy in exponent table
+#define EXPO_MULTI			(1 << EXPO_SHIFT)	// Multiplier for exponent
+#define EXPO_SIZE			(3 * EXPO_MULTI)	// Size of exponent table
+#define EXPO_ACCU			12			// Accuracy of weight value
+#define EXPO_MULT			(1 << EXPO_ACCU)
+#define EXPO_DIFF			(2 * SHIFT_PLACE - EXPO_SHIFT)
+
+#define SHIFT_COEFF			(16)	// Accuracy of float to integer (coeff)
+#define SHIFT_PLACE			( 8)	// Accuracy of float to integer (place)
+#define SHIFT_DIFF			( 8)	// Accuracy reduction		(SHIFT_COEFF - SHIFT_PLACE)
+
+#define EXPO_SIZE2			(384)	// Size of exponent table	((3 * (1 << EXPO_SHIFT2)) >> 1)
+#define EXPO_DIFF2			(  8)	// Reduction of accuracy	(SHIFT_COEFF - EXPO_SHIFT2)
+
+
+#endif // ifndef _Defines_H
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/inc/DCDigitalZoom.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//
+//Version 1.00
+//
+//Contains:
+//	CDCDCDigitalZoom 
+//		Scaling of image to display size & zooming.
+//		Includes support for different scaling and crop sizes with pan&scan.
+//		Pan can use previously computed scaled data when changing.
+//		Based on IMAAMI scaling algorithm.
+//	
+//History:
+//	19.08.2003 version 1.00 created using existing IMAAMI algorithms	
+//*************************************************************************
+
+
+#ifndef __DIGITAL_ZOOM_H
+#define __DIGITAL_ZOOM_H
+
+#include <e32std.h> // for Fundamental Types
+#include <e32base.h> // for Fundamental Types
+#include <eikenv.h>
+#include "DCDefines.h"
+
+//Const tables for computation speed-up
+const TUint16 KDivTable[4 * 256] =
+{
+				  32768, 21845, 16384, 13107, 10923,  9362,  8192,  7282,
+     6554,  5958,  5461,  5041,  4681,  4369,  4096,  3855,  3641,  3449,
+     3277,  3121,  2979,  2849,  2731,  2621,  2521,  2427,  2341,  2260,
+     2185,  2114,  2048,  1986,  1928,  1872,  1820,  1771,  1725,  1680,
+     1638,  1598,  1560,  1524,  1489,  1456,  1425,  1394,  1365,  1337,
+     1311,  1285,  1260,  1237,  1214,  1192,  1170,  1150,  1130,  1111,
+     1092,  1074,  1057,  1040,  1024,  1008,   993,   978,   964,   950,
+      936,   923,   910,   898,   886,   874,   862,   851,   840,   830,
+      819,   809,   799,   790,   780,   771,   762,   753,   745,   736,
+      728,   720,   712,   705,   697,   690,   683,   676,   669,   662,
+      655,   649,   643,   636,   630,   624,   618,   612,   607,   601,
+      596,   590,   585,   580,   575,   570,   565,   560,   555,   551,
+      546,   542,   537,   533,   529,   524,   520,   516,   512,   508,
+      504,   500,   496,   493,   489,   485,   482,   478,   475,   471,
+      468,   465,   462,   458,   455,   452,   449,   446,   443,   440,
+      437,   434,   431,   428,   426,   423,   420,   417,   415,   412,
+      410,   407,   405,   402,   400,   397,   395,   392,   390,   388,
+      386,   383,   381,   379,   377,   374,   372,   370,   368,   366,
+      364,   362,   360,   358,   356,   354,   352,   350,   349,   347,
+      345,   343,   341,   340,   338,   336,   334,   333,   331,   329,
+      328,   326,   324,   323,   321,   320,   318,   317,   315,   314,
+      312,   311,   309,   308,   306,   305,   303,   302,   301,   299,
+      298,   297,   295,   294,   293,   291,   290,   289,   287,   286,
+      285,   284,   282,   281,   280,   279,   278,   277,   275,   274,
+      273,   272,   271,   270,   269,   267,   266,   265,   264,   263,
+      262,   261,   260,   259,   258,   257,   256,   255,   254,   253,
+      252,   251,   250,   249,   248,   247,   246,   245,   245,   244,
+      243,   242,   241,   240,   239,   238,   237,   237,   236,   235,
+      234,   233,   232,   232,   231,   230,   229,   228,   228,   227,
+      226,   225,   224,   224,   223,   222,   221,   221,   220,   219,
+      218,   218,   217,   216,   216,   215,   214,   213,   213,   212,
+      211,   211,   210,   209,   209,   208,   207,   207,   206,   205,
+      205,   204,   204,   203,   202,   202,   201,   200,   200,   199,
+      199,   198,   197,   197,   196,   196,   195,   194,   194,   193,
+      193,   192,   192,   191,   191,   190,   189,   189,   188,   188,
+      187,   187,   186,   186,   185,   185,   184,   184,   183,   183,
+      182,   182,   181,   181,   180,   180,   179,   179,   178,   178,
+      177,   177,   176,   176,   175,   175,   174,   174,   173,   173,
+      172,   172,   172,   171,   171,   170,   170,   169,   169,   168,
+      168,   168,   167,   167,   166,   166,   165,   165,   165,   164,
+      164,   163,   163,   163,   162,   162,   161,   161,   161,   160,
+      160,   159,   159,   159,   158,   158,   158,   157,   157,   156,
+      156,   156,   155,   155,   155,   154,   154,   153,   153,   153,
+      152,   152,   152,   151,   151,   151,   150,   150,   150,   149,
+      149,   149,   148,   148,   148,   147,   147,   147,   146,   146,
+      146,   145,   145,   145,   144,   144,   144,   143,   143,   143,
+      142,   142,   142,   142,   141,   141,   141,   140,   140,   140,
+      139,   139,   139,   139,   138,   138,   138,   137,   137,   137,
+      137,   136,   136,   136,   135,   135,   135,   135,   134,   134,
+      134,   133,   133,   133,   133,   132,   132,   132,   132,   131,
+      131,   131,   131,   130,   130,   130,   130,   129,   129,   129,
+      129,   128,   128,   128,   128,   127,   127,   127,   127,   126,
+      126,   126,   126,   125,   125,   125,   125,   124,   124,   124,
+      124,   123,   123,   123,   123,   122,   122,   122,   122,   122,
+      121,   121,   121,   121,   120,   120,   120,   120,   120,   119,
+      119,   119,   119,   119,   118,   118,   118,   118,   117,   117,
+      117,   117,   117,   116,   116,   116,   116,   116,   115,   115,
+      115,   115,   115,   114,   114,   114,   114,   114,   113,   113,
+      113,   113,   113,   112,   112,   112,   112,   112,   111,   111,
+      111,   111,   111,   111,   110,   110,   110,   110,   110,   109,
+      109,   109,   109,   109,   109,   108,   108,   108,   108,   108,
+      107,   107,   107,   107,   107,   107,   106,   106,   106,   106,
+      106,   106,   105,   105,   105,   105,   105,   105,   104,   104,
+      104,   104,   104,   104,   103,   103,   103,   103,   103,   103,
+      102,   102,   102,   102,   102,   102,   101,   101,   101,   101,
+      101,   101,   101,   100,   100,   100,   100,   100,   100,    99,
+       99,    99,    99,    99,    99,    99,    98,    98,    98,    98,
+       98,    98,    98,    97,    97,    97,    97,    97,    97,    97,
+       96,    96,    96,    96,    96,    96,    96,    95,    95,    95,
+       95,    95,    95,    95,    94,    94,    94,    94,    94,    94,
+       94,    93,    93,    93,    93,    93,    93,    93,    93,    92,
+       92,    92,    92,    92,    92,    92,    92,    91,    91,    91,
+       91,    91,    91,    91,    91,    90,    90,    90,    90,    90,
+       90,    90,    90,    89,    89,    89,    89,    89,    89,    89,
+       89,    88,    88,    88,    88,    88,    88,    88,    88,    87,
+       87,    87,    87,    87,    87,    87,    87,    87,    86,    86,
+       86,    86,    86,    86,    86,    86,    86,    85,    85,    85,
+       85,    85,    85,    85,    85,    85,    84,    84,    84,    84,
+       84,    84,    84,    84,    84,    83,    83,    83,    83,    83,
+       83,    83,    83,    83,    83,    82,    82,    82,    82,    82,
+       82,    82,    82,    82,    82,    81,    81,    81,    81,    81,
+       81,    81,    81,    81,    81,    80,    80,    80,    80,    80,
+       80,    80,    80,    80,    80,    79,    79,    79,    79,    79,
+       79,    79,    79,    79,    79,    78,    78,    78,    78,    78,
+       78,    78,    78,    78,    78,    78,    77,    77,    77,    77,
+       77,    77,    77,    77,    77,    77,    77,    76,    76,    76,
+       76,    76,    76,    76,    76,    76,    76,    76,    76,    75,
+       75,    75,    75,    75,    75,    75,    75,    75,    75,    75,
+       74,    74,    74,    74,    74,    74,    74,    74,    74,    74,
+       74,    74,    73,    73,    73,    73,    73,    73,    73,    73,
+       73,    73,    73,    73,    72,    72,    72,    72,    72,    72,
+       72,    72,    72,    72,    72,    72,    72,    71,    71,    71,
+       71,    71,    71,    71,    71,    71,    71,    71,    71,    71,
+       70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
+       70,    70,    70,    69,    69,    69,    69,    69,    69,    69,
+       69,    69,    69,    69,    69,    69,    69,    68,    68,    68,
+       68,    68,    68,    68,    68,    68,    68,    68,    68,    68,
+       68,    67,    67,    67,    67,    67,    67,    67,    67,    67,
+       67,    67,    67,    67,    67,    67,    66,    66,    66,    66,
+       66,    66,    66,    66,    66,    66,    66,    66,    66,    66,
+       66,    65,    65,    65,    65,    65,    65,    65,    65,    65,
+       65,    65,    65,    65,    65,    65,    65,    64,    64,    64,
+       64,    64,    64,    64,    64,    64
+};
+
+
+
+
+// Class definition
+class CDCDigitalZoom : public CBase
+{
+public:
+	
+	// Struct definition
+	struct DCDigitalZoomParams
+	{
+		TInt sizeX;		//Output size
+		TInt sizeY;
+		TReal scaleX;	//Scaling factors
+		TReal scaleY;
+		TInt allShiftX;	//Pan location
+		TInt allShiftY;
+		TInt newShiftX;	//Change in pan (used for speed-up)
+		TInt newShiftY;	//only one value at time can be >0
+	};
+	
+	//Standard class functions
+	CDCDigitalZoom();
+	void ConstructL();	
+	static CDCDigitalZoom* NewL();
+	static CDCDigitalZoom* NewLC();
+	~CDCDigitalZoom();
+
+	// Process original image and store output image (main function)
+	void ProcessL(const CFbsBitmap* aOriPtr, CFbsBitmap* aOutPtr);
+
+	//Set processing parameters
+	void SetParameters(DCDigitalZoomParams* params);
+	
+	//Get current processing parameters
+	void GetParameters(DCDigitalZoomParams* params);
+	
+protected:
+
+	//Parameters
+	DCDigitalZoomParams iParams;
+
+private:
+
+	//Do actual resizing	
+	void DecimateL(const CFbsBitmap* aOriPtr, CFbsBitmap* aOutPtr,
+						   TInt aOutSizeX, TInt aOutSizeY,
+						   TInt aOriSizeX, TInt aOriSizeY,
+						   TReal aZoomX, TReal aZoomY,
+						   TInt allShiftX, TInt allShiftY,
+						   TInt newShiftX, TInt newShiftY);
+};
+#endif // ifndef __DIGITAL_ZOOM_H
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/inc/DCDithering.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//DCDithering.h
+//
+//Version 1.00
+//
+//Contains:
+//	CDCDithering 
+//		Dithering by H263 algorithm developed in /.
+//			
+//History:
+//	19.08.2003 version 1.00 created using existing algorithms	
+//*************************************************************************
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    Defines the dithering class.
+
+-----------------------------------------------------------------------------
+*/
+
+#ifndef  __DCDithering_H__
+#define  __DCDithering_H__
+
+
+
+//  INCLUDES
+#ifndef   __E32STD_H__
+#include  <e32std.h>   // for Fundamental Types
+#endif // __E32STD_H__
+#ifndef   __E32BASE_H__
+#include  <e32base.h>  // for CBase
+#endif // __E32BASE_H__
+
+
+
+//Class definition
+class CDCDithering : public CBase
+{
+public:
+
+	CDCDithering();					// Constructor
+	static CDCDithering* NewL();	// Factory function
+	static CDCDithering* NewLC();	// Factory function
+	~CDCDithering();				// Destructor
+	void ConstructL();				// Second Phase contructor (may leave)
+	
+	// Process and store image referenced by aBPtr
+	void ProcessL(CFbsBitmap& aBPtr);
+	
+private:
+
+	// Limit integer value to byte [0,255]
+	static inline TUint8 Limit255(TInt i) {return (TUint8)(i<0?0:(i>255?255:i));}
+
+	// Scan line buffer
+	HBufC8*  iScanLineBuffer;
+};
+
+#endif // __DCDithering_H__
+// End of File
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/inc/DCIetd.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//CDCIETD.h
+//
+//Version 2.00
+//
+//Contains:
+//	CDCIETD 
+//		Display specific color contrast enhancement, 
+//		Image Enhancement for Transflective Displays version 2,
+//		IETD 2.
+//
+// The class implements the following image enhancements algorithms:
+//	    - Histogram guided contrast stretch
+//	    - Color saturation increase
+//
+// Usage:
+//  	- First an instance of this class is created by factory functions NewL() or NewLC.
+//		- All settings and configurations can be done by calling function SetParams().
+//		  Current parameters can be checked by calling function GetParams().
+//		- Then the The Analyze() function is called with CFbsBitmap as an argumet.
+//		  This function have to be called at least once before ProcessL().  
+//		- Then the The ProcessL() function is called with CFbsBitmap as an argumet.
+//		  The bitmap is handled in place so this function modifies the given bitmap.
+//
+//History:
+//	23.10.2003 version 2.00 created using existing IMAAMI IETD	
+//*************************************************************************
+
+#ifndef  __DCIetd_H__
+#define  __DCIetd_H__
+
+//  INCLUDES
+
+#ifndef   __E32STD_H__
+#include  <e32std.h>   // for Fundamental Types
+#endif // __E32STD_H__
+
+#ifndef   __E32BASE_H__
+#include  <e32base.h>  // for CBase
+#endif // __E32BASE_H__
+
+//Default parameters
+#include "DCInit.h"
+
+
+//-------------------
+//  CLASS DEFINITIONS 
+// CDCIetd - The one and ony class to contain all required methods
+// to implement DCIetd functionality.
+class CDCIetd : public CBase
+    {
+    public:     
+
+		//Parameter struct
+		struct DCIetdParameters
+		{
+			TUint8 aWhitePixels; 	//Percentage of pixels stretched to maximum value
+			TUint8 aBlackPixels;	//Percentage of pixels stretched to minimum value
+			TUint8 aStretchLimit;	//Narrowest histogram to be stretched to full range
+			TUint8 aSaturationGain;	//Saturation increase gain
+			TUint8 aBitLimit;		//Minimum number of color values for full gain		
+			TUint8 aWBC;			//White balance correction limit
+			TUint8 aDBC;			//Dark balance correction limit
+		};
+
+        CDCIetd();				// Constructor
+        static CDCIetd* NewL();	// Factory function NewL
+        static CDCIetd* NewLC();// Factory function NewLC
+        ~CDCIetd();				// Destructor
+        void ConstructL();		// Second Phase contructor (may leave)
+        
+		// Analyze image referenced by aBPtr
+		void Analyze(CFbsBitmap& aBPtr);
+
+		// Process and store image referenced by aBPtr
+		void ProcessL(CFbsBitmap& aBPtr);
+
+		// Parameter exchange
+		void SetParams(DCIetdParameters* parameters);
+		void GetParams(DCIetdParameters* parameters);
+        
+    private:
+
+		void GatherHistograms(const CFbsBitmap& aBPtr); // Construct the R, G, and B Histograms
+        void MakeMappings();                            // Calculate the mapping LUTs
+
+        // Limit integer value to byte [0,255]
+        static inline TUint8 Limit255(TInt i) {return (TUint8)(i<0?0:(i>255?255:i));}
+
+        TUint    iHistogram[3][256];  // Histogram data
+        TUint8   iMap[3][256];        // Color component mapping funtions
+        HBufC8*  iScanLineBuffer;     // Scan line buffer
+
+        TUint8 iReducedStretchLimit[3]; //Stretch limits for each component
+
+		DCIetdParameters iParameters; //Parameters
+    };
+
+#endif // __DCIetd_H__
+            
+// End of File
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/inc/DCInit.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//DCInit.h
+//
+//Version 1.00
+//
+//Contains:
+//	_Init_H 
+//		Defines all the default parameter values used in the IMAAMI algorithms.
+//			
+//History:
+//	19.08.2003 version 1.00 created using existing IMAAMI algorithms	
+//*************************************************************************
+
+
+#ifndef _Init_H
+#define _Init_H
+
+#define DEBUG				1
+
+//DigitalZoom
+#define DZ					ETrue
+#define DZsizeX				176
+#define DZsizeY				144 //132
+#define DZscaleX			1.0 //0.25
+#define DZscaleY			1.0 //0.25
+#define DZallX				0
+#define DZallY				0
+#define DZnewX				0
+#define DZnewY				0		
+
+//IETD
+#define IETD				ETrue
+#define StretchLimit		175
+#define BlackPixels			3
+#define WhitePixels			7	
+#define SaturationGain		3
+#define BitLimit			32
+#define WBC					25
+#define DBC					10			
+
+//Sharpening
+#define SHARP				ETrue
+#define SharpGain			0.25
+#define SharpDZone			7
+#define SharpOver			15
+
+//Dithering
+#define DITHER				ETrue
+
+//Color Management
+#define CM					ETrue //EFalse	
+
+
+const TInt CMGammaR[256] = {0, 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, 209, 210, 211, 212, 213, 214,
+	215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+	240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
+
+const TInt CMGammaG[256] = {0, 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, 209, 210, 211, 212, 213, 214,
+	215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+	240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
+
+const TInt CMGammaB[256] = {0, 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, 209, 210, 211, 212, 213, 214,
+	215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+	240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
+
+const TInt CMMatrix[9] = {65536,	0,	0,	
+						0,	65536,	0,	
+						0,	0,	65536};
+
+const TInt CMTRCR[256] = {0, 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, 209, 210, 211, 212, 213, 214,
+	215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+	240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
+
+const TInt CMTRCG[256] = {0, 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, 209, 210, 211, 212, 213, 214,
+	215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+	240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
+
+const TInt CMTRCB[256] = {0, 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, 209, 210, 211, 212, 213, 214,
+	215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+	240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
+
+
+#endif // ifndef _Defines_H
+
+//---IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/inc/DCSharpening.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//DCSharpening.h
+//
+//Version 1.00
+//
+//Contains:
+//	DCSharpening 
+//		Sharpening using IMAAMI algorithm.
+//			
+//History:
+//	19.08.2003 version 1.00 created using existing IMAAMI algorithms	
+//*************************************************************************
+
+#ifndef __DCSharpening_H
+#define __DCSharpening_H
+
+#include <e32std.h> // for Fundamental Types
+#include <e32base.h> // for Fundamental Types
+#include "DCInit.h"
+
+//Adjust to proper signal range (10 bits)
+#define ADJUST_RANGE_TO_10BITS(value) ((value) < 0) ? 0 : ((value) > 1023) ? 1023 : (value)
+
+
+//Class definition
+class DCSharpening : public CBase
+{
+public:
+
+	//parameters
+	struct DCSharpeningParams
+	{
+		TUint SHARP_OVER;
+		TUint SHARP_DZONE;
+		TReal SHARP_GAIN;
+	};
+
+	DCSharpening();
+	static DCSharpening* NewL();
+	static DCSharpening* NewLC();
+	~DCSharpening();
+	
+	// Second Phase contructor (may leave)
+	void ConstructL();
+	
+	//Process original image and store result
+	void ProcessL(CFbsBitmap* aBPtr);
+	
+	//Set processing parameters
+	void SetParameters(DCSharpeningParams* params);
+
+	//Get current processing parameters
+	void GetParameters(DCSharpeningParams* params);
+
+	
+	//Limit integer value to byte [0,255]
+	static inline TUint8 Limit255(TInt i) {
+		return (TUint8)(i<0?0:(i>255?255:i));
+	}
+	
+	
+private:
+	
+	//Processing parameters
+	DCSharpeningParams iParameters;
+
+	//Line Buffer and pointer
+	HBufC8*	iScanLine;
+	HBufC8*	iPrevScanLine;
+	HBufC8*	iPrevPrevScanLine;
+	HBufC8*	iNextScanLine;
+	HBufC8*	iNextNextScanLine;
+
+	//Sharpening functions from IMAAMI
+	TInt Peak(TInt aA, TInt aB, TInt aC, TInt aD, TInt aE, TInt aF, TInt aG, TInt aH, TInt aO);
+	TInt Median3(TInt aA, TInt aB, TInt aC);
+	void findMinMax4(TInt A, TInt B, TInt C, TInt D, TInt *min, TInt *max);
+
+	//Processing parameters for stretch
+	TInt iGain;
+};
+
+#endif // ifndef __DCSharpening_H
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/inc/DisplayChain.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//DisplayChain.cpp
+//
+//Version 1.00
+//
+//Contains:
+//	CDisplayChain 
+//		Image processing class implementing
+//		display specific image processing:
+//			- Scaling to display size with pan support
+//			- IETD - display specific color contrast enhancement
+//			- Sharpening 
+//			- Display feature compensation by simple color management
+//			- Dithering 
+//			
+//History:
+//	30.10.2003 version 1.00 created using existing IMAAMI algorithms	
+//*************************************************************************
+
+#ifndef __DisplayChain_H
+#define __DisplayChain_H
+
+#include <e32std.h> // for Fundamental Types
+#include <e32base.h> // for Fundamental Types
+#include <e32math.h> //for the calculation of exponents
+#include <stdio.h>
+
+#include "DCDigitalZoom.h"
+#include "DCSharpening.h"
+#include "DCIetd.h"
+#include "DCDithering.h"
+#include "DCColorManagement.h"
+#include "DCDefines.h"
+#include "DCInit.h"
+
+
+//Class definition
+class CDisplayChain : public CBase
+{
+public:
+
+	//Standard functions
+	CDisplayChain();
+	static CDisplayChain* NewL();
+	static CDisplayChain* NewLC();
+	~CDisplayChain();
+	
+	// Second Phase contructor (may leave)
+	void ConstructL();
+	
+	//Process original image and store result
+	void ProcessL(const CFbsBitmap* InBitmap, CFbsBitmap* aTargetBitmap);
+
+	//Processing parameters
+	struct DisplayChainParams
+	{
+		TBool FirstOpening;
+
+		TBool IetdON;				//IETD ON/OFF
+		TBool SharpeningON;			//Sharpening ON/OFF
+		TBool ColorManagementON;	//Color Management ON/OFF
+		TBool DitheringON;			//Dithering ON/OFF
+		TBool DigitalZoomON;		//Scaling ON/OFF
+
+		//Parameters for each processing algorithm
+		//See processing algorithm classes for details.
+		CDCIetd::DCIetdParameters IETDParameters;
+		DCSharpening::DCSharpeningParams SharpeningParameters;
+		CDCColorManagement::DCColorManagementParams ColorManagementParameters;
+		CDCDigitalZoom::DCDigitalZoomParams DZParameters;
+	};	
+	
+	//Parameter excange
+	void SetParameters(DisplayChainParams* Parameters);
+	void GetParameters(DisplayChainParams* Parameters);
+	
+	//Limit integer value to byte [0,255]
+	static inline TUint8 Limit255(TInt i) {return (TUint8)(i<0?0:(i>255?255:i));}
+	
+private:
+
+
+	//PArameters
+	DisplayChainParams Parameters;
+
+	//Processing objects
+	CDCIetd* IetdPtr;
+	DCSharpening* SharpeningPtr;
+	CDCColorManagement* ColorManagementPtr;
+	CDCDithering* DitheringPtr;
+	CDCDigitalZoom* DigitalZoomPtr;
+};
+
+#endif // ifndef __DisplayChain_H
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/src/DCColorManagement.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,265 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//DCColorManagement.cpp
+//
+//Version 1.00
+//
+//Contains:
+//	CDCCDM 
+//		Simple color management approach consisting
+//		of 3xLUT + 3x3 Matrix + 3xLUT for compensating
+//		display specific features.
+//	
+//History:
+//	19.08.2003 version 1.00 created using existing IMAAMI algorithms	
+//*************************************************************************
+
+#include <fbs.h>
+#include <s32file.h>
+#include <stdio.h>
+#include "DCColorManagement.h"
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCColorManagement
+  
+  Constructor
+	
+  Default constructor, initializes member variables to initial values
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+CDCColorManagement::CDCColorManagement()
+{
+	//Set default values for parameters
+	//Set pointer to internal data (LUTs and matrix memory locations)
+	iParams.GammaR = iGammaR;
+	iParams.GammaG = iGammaG;
+	iParams.GammaB = iGammaB;
+	iParams.Matrix = iMatrix;
+	iParams.TRCR = iTRCR;
+	iParams.TRCG = iTRCG;
+	iParams.TRCB = iTRCB;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+	
+  NewLC
+	
+  Factory function to instantiate the class.
+  This function leaves the class pointer to the cleanup stack
+  May leave with KErrNoMemory if no memory available
+  
+  Return Values:  CDCColorManagement* self:  pointer to the class instance
+
+-----------------------------------------------------------------------------
+*/
+CDCColorManagement* CDCColorManagement::NewLC()
+{
+	CDCColorManagement* self = new (ELeave) CDCColorManagement();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  NewL
+	
+  Factory function to instantiate the class.
+  May leave with KErrNoMemory if no memory available
+	  
+  Return Values:  CDCColorManagement* self:  pointer to the class instance
+	
+-----------------------------------------------------------------------------
+*/
+CDCColorManagement* CDCColorManagement::NewL()
+{
+	CDCColorManagement* self = CDCColorManagement::NewLC();
+	CleanupStack::Pop();
+	return self;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  ConstructL
+	
+  Second phase constructor. Does nothing at the moment
+	  
+  Return Values:  none
+		
+ -----------------------------------------------------------------------------
+*/
+void CDCColorManagement::ConstructL()
+{
+	// This function is intentionally left blank.
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  Destructor
+	
+  Deletes the scanline buffer
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+CDCColorManagement::~CDCColorManagement()
+{
+	// This function is intentionally left blank.
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  ProcessL
+	
+  Process image referenced by aBPtr (modify aBPtr).
+  May leave with KErrNoMemory if no memory available
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDCColorManagement::ProcessL(CFbsBitmap* aBPtr)
+{
+
+	TInt	r, g, b, rr, gg, bb;	// Color components
+	TUint8* DataPtr;	// Pointer to image data
+	
+	//Check image mode
+	if (aBPtr->DisplayMode() != EColor16M) 
+		return;
+	
+	// Line Buffer and pointer to the data
+	TUint LineLength = aBPtr->SizeInPixels().iWidth;
+	iScanLine = HBufC8::NewMaxL(LineLength*3);
+	TPtr8 LinePtr((TUint8*)iScanLine->Des().Ptr(), LineLength*3);
+	
+	// Step through image lines
+	for (TInt LineNo=0; LineNo<aBPtr->SizeInPixels().iHeight; ++LineNo)
+	{
+		//Get line from image and set data pointer
+		aBPtr->GetScanLine(LinePtr, TPoint(0, LineNo), aBPtr->SizeInPixels().iWidth, aBPtr->DisplayMode());
+		DataPtr = (TUint8 *)iScanLine->Des().Ptr();
+
+		//Step through image pixels
+		for (TUint x=aBPtr->SizeInPixels().iWidth; x != 0; --x)
+		{
+			//Get the color components and map them using linearization LUTs
+			b=iParams.GammaR[*DataPtr];
+			g=iParams.GammaG[*(DataPtr+1)];
+			r=iParams.GammaB[*(DataPtr+2)];
+
+			//Process with 3x3 matrix
+			rr=(r*iParams.Matrix[0] + g*iParams.Matrix[3*0+1] + b*iParams.Matrix[3*0+2])>>16;
+			gg=(r*iParams.Matrix[3*1+0] + g*iParams.Matrix[3*1+1] + b*iParams.Matrix[3*1+2])>>16;
+			bb=(r*iParams.Matrix[3*2+0] + g*iParams.Matrix[3*2+1] + b*iParams.Matrix[3*2+2])>>16;
+
+			//Limit between 0...255
+			if (rr<0) rr=0; if (rr>255) rr=255;
+			if (gg<0) gg=0; if (gg>255) gg=255;
+			if (bb<0) bb=0; if (bb>255) bb=255;
+
+			//Process with TRC LUTs
+			rr=iParams.TRCR[rr];
+			gg=iParams.TRCG[gg];
+			bb=iParams.TRCB[bb];
+
+			//Set color components
+			*DataPtr = (TUint8)bb;
+			++DataPtr;
+			*DataPtr = (TUint8)gg;
+			++DataPtr;
+			*DataPtr = (TUint8)rr;
+			++DataPtr;
+		}
+
+		//Set processed line
+		aBPtr->SetScanLine(LinePtr, LineNo);
+	}
+
+	//Free memory
+	delete(iScanLine);
+	iScanLine = 0;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  SetParams
+	
+  Set processing parameters
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDCColorManagement::SetParameters(DCColorManagementParams* params)
+{
+	iParams = *params;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  GetParams
+	
+  Get current processing parameters
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDCColorManagement::GetParameters(DCColorManagementParams* params)
+{
+	*params = iParams;
+}
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/src/DCDigitalZoom.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1059 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//DCDCDigitalZoom.h
+//
+//Version 1.00
+//
+//Contains:
+//	CDCDCDigitalZoom 
+//		Scaling of image to display size & zooming.
+//		Includes support for different scaling and crop sizes with pan&scan.
+//		Pan can use previously computed scaled data when changing.
+//		Based on IMAAMI scaling algorithm.
+//	
+//History:
+//	19.08.2003 version 1.00 created using existing IMAAMI algorithms	
+//*************************************************************************
+
+
+
+#include <fbs.h>
+#include "DCDigitalZoom.h"
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDCDigitalZoom::CDCDigitalZoom
+
+	C++ constructor.
+
+	Initialises set of member parameters.
+
+-----------------------------------------------------------------------------
+*/
+CDCDigitalZoom::CDCDigitalZoom()
+{
+
+	iParams.sizeX      = 176; //640;	// Size of VGA image for X
+	iParams.sizeY      = 144; //480;	// Size of VGA image for Y
+	iParams.scaleX     = 1.0f;	// No Scaling for X
+	iParams.scaleY     = 1.0f;	// No scaling for Y
+	iParams.allShiftX  = 0;		// No pan
+	iParams.allShiftY  = 0;		// 
+	iParams.newShiftX  = 0;		// No pan
+	iParams.newShiftY  = 0;		//
+
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDCDigitalZoom::ConstructL
+
+	Second phase constructor.
+
+	Construct the object. (not used, may leave)
+
+-----------------------------------------------------------------------------
+*/
+
+void CDCDigitalZoom::ConstructL()
+{
+	// This function is intentionally left blank.
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDCDigitalZoom::NewLC
+
+	Allocate the memory and construct the object.
+	Pushs pointer to a new instance to Cleanupstack.
+
+    Return value:
+		CDCDigitalZoom* self		Pointer to a new instance
+
+-----------------------------------------------------------------------------
+*/
+
+CDCDigitalZoom* CDCDigitalZoom::NewLC()
+{
+	CDCDigitalZoom* self = new (ELeave) CDCDigitalZoom();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+
+	return self;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDCDigitalZoom::NewL
+
+	Allocate the memory and construct the object.
+
+    Return value:
+		CDCDigitalZoom* self		Pointer to a new instance
+
+-----------------------------------------------------------------------------
+*/
+
+CDCDigitalZoom* CDCDigitalZoom::NewL()
+{
+	CDCDigitalZoom* self = CDCDigitalZoom::NewLC();
+	CleanupStack::Pop();
+
+	return self;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDCDigitalZoom::~CDCDigitalZoom
+
+	C++ destructor.
+
+-----------------------------------------------------------------------------
+*/
+
+CDCDigitalZoom::~CDCDigitalZoom()
+{
+	// This function is intentionally left blank.
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDCDigitalZoom::ProcessL
+
+	Main function of digital zoom. (public)
+	Calls processing function (zoomImage).
+
+	NOTE:
+		ImageZoomParams iParams have to be set before calling
+		this function, so that the wanted processing is done.
+
+    Parameters in:
+		CFbsBitmap* aOriPtr		Pointer to source image bitmap
+
+	Parameters out:
+		CFbsBitmap* aOutPtr		Pointer to destination image bitmap
+
+    Return value: None
+
+-----------------------------------------------------------------------------
+*/
+
+void CDCDigitalZoom::ProcessL(const CFbsBitmap *aOriPtr, CFbsBitmap *aOutPtr)
+{
+	//EColor16M image is needed
+	if(aOutPtr->DisplayMode() != EColor16M)
+	{
+		return;
+	}
+
+	if(aOriPtr->DisplayMode() != EColor16M)
+	{
+		return;
+	}
+
+	// Find size of original image
+	TInt oriSizeX = aOriPtr->SizeInPixels().iWidth;
+	TInt oriSizeY = aOriPtr->SizeInPixels().iHeight;
+
+	//Do scaling
+	DecimateL(aOriPtr, aOutPtr,
+			iParams.sizeX, iParams.sizeY,
+			oriSizeX, oriSizeY,
+			iParams.scaleX, iParams.scaleY,
+			iParams.allShiftX, iParams.allShiftY,
+			iParams.newShiftX, iParams.newShiftY);
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  DecimateL
+
+  IMAAMI scaling core function
+		
+-----------------------------------------------------------------------------
+*/
+void CDCDigitalZoom::DecimateL(const CFbsBitmap* aOriPtr, CFbsBitmap* aOutPtr,
+									 TInt aOutSizeX, TInt aOutSizeY,
+									 TInt aOriSizeX, TInt aOriSizeY,
+									 TReal aZoomX, TReal aZoomY,
+									 TInt allShiftX, TInt allShiftY,
+									 TInt newShiftX, TInt newShiftY)
+{
+	TInt32
+		divider,
+		xPos, yPos, tmpline,
+		xAver, yAver,
+		xStep, yStep,
+		tmpEnd, tmpSta,
+		sumB, sumG, sumR,
+		tmpB, tmpG, tmpR;
+
+	TInt32
+		x, y,
+		i, j,
+		LastLine,
+		xInt, yInt,
+		xStaInt, yStaInt,
+		xEndInt, yEndInt,
+		xFirstInt, yFirstInt;
+
+	TUint32
+		LineNum,
+		outFlag,
+		xRem, yRem,
+		xStaRem, yStaRem,
+		xEndRem, yEndRem,
+		xStaWei, yStaWei,
+		xEndWei, yEndWei,
+		xAllWei, yAllWei,
+		xMaxWei, yMaxWei,
+		xLoopSta, yLoopSta,
+		xLoopEnd, yLoopEnd,
+		xFirstRem, yFirstRem;
+
+	TUint32
+		PIX_BITS	= 13,						// 13
+		PIXEL		= (TUint32)(1 << PIX_BITS),
+		HALF_PIX	= (TUint32)(1 << (PIX_BITS - 1)),
+		REMAINDER	= (TUint32)(PIXEL - 1),
+		WEI_BITS	= 4,						// 4
+		HALF_WEI	= (TUint32)(1 << (WEI_BITS - 1)),
+		DIF1_BITS	= (TUint32)(PIX_BITS - WEI_BITS),
+		HALF_DIF1	= (TUint32)(1 << (DIF1_BITS - 1)),
+		REM_HDIF1	= (TUint32)(HALF_DIF1 - 1),
+		RED_BITS	= 4,						// 4
+		HALF_RED	= (TUint32)(1 << (RED_BITS - 1));
+
+
+	if(aZoomX < 0.20 || aZoomY < 0.20)
+	{
+		RED_BITS = 5;
+		HALF_RED = (TUint32)(1 << (RED_BITS - 1));
+	}
+
+	// Allocate local temporal input0 line buffer and push its pointer to CleanupStack
+	HBufC8* oriLine0 = HBufC8::NewMaxL(3 * aOriSizeX);	// BGRBGR...
+	CleanupStack::PushL(oriLine0);
+	
+	// Allocate local temporal input1 line buffer and push its pointer to CleanupStack
+	HBufC8* oriLine1 = HBufC8::NewMaxL(3 * aOriSizeX);	// BGRBGR...
+	CleanupStack::PushL(oriLine1);
+
+	// Allocate local temporal input2 line buffer and push its pointer to CleanupStack
+	HBufC8* oriLine2 = HBufC8::NewMaxL(3 * aOriSizeX);	// BGRBGR...
+	CleanupStack::PushL(oriLine2);
+
+	// Allocate local temporal input3 line buffer and push its pointer to CleanupStack
+	HBufC8* oriLine3 = HBufC8::NewMaxL(3 * aOriSizeX);	// BGRBGR...
+	CleanupStack::PushL(oriLine3);
+
+	// Allocate local temporal input4 line buffer and push its pointer to CleanupStack
+	HBufC8* oriLine4 = HBufC8::NewMaxL(3 * aOriSizeX);	// BGRBGR...
+	CleanupStack::PushL(oriLine4);
+
+	// Allocate local temporal input5 line buffer and push its pointer to CleanupStack
+	HBufC8* oriLine5 = HBufC8::NewMaxL(3 * aOriSizeX);	// BGRBGR...
+	CleanupStack::PushL(oriLine5);
+	
+	// Allocate local temporal input6 line buffer and push its pointer to CleanupStack
+	HBufC8* oriLine6 = HBufC8::NewMaxL(3 * aOriSizeX);	// BGRBGR...
+	CleanupStack::PushL(oriLine6);
+
+	// Allocate local temporal input7 line buffer and push its pointer to CleanupStack
+	HBufC8* oriLine7 = HBufC8::NewMaxL(3 * aOriSizeX);	// BGRBGR...
+	CleanupStack::PushL(oriLine7);
+
+	// Allocate local temporal input8 line buffer and push its pointer to CleanupStack
+	HBufC8* oriLine8 = HBufC8::NewMaxL(3 * aOriSizeX);	// BGRBGR...
+	CleanupStack::PushL(oriLine8);
+
+	// Allocate local temporal input9 line buffer and push its pointer to CleanupStack
+	HBufC8* oriLine9 = HBufC8::NewMaxL(3 * aOriSizeX);	// BGRBGR...
+	CleanupStack::PushL(oriLine9);
+
+	// Allocate local temporal input10 line buffer and push its pointer to CleanupStack
+	HBufC8* oriLine10 = HBufC8::NewMaxL(3 * aOriSizeX);	// BGRBGR...
+	CleanupStack::PushL(oriLine10);
+	
+	// Set pointers of input lines
+	TUint8* line0Ptr = (TUint8*)oriLine0->Des().Ptr();
+	TUint8* line1Ptr = (TUint8*)oriLine1->Des().Ptr();
+	TUint8* line2Ptr = (TUint8*)oriLine2->Des().Ptr();
+	TUint8* line3Ptr = (TUint8*)oriLine3->Des().Ptr();
+	TUint8* line4Ptr = (TUint8*)oriLine4->Des().Ptr();
+	TUint8* line5Ptr = (TUint8*)oriLine5->Des().Ptr();
+	TUint8* line6Ptr = (TUint8*)oriLine6->Des().Ptr();
+	TUint8* line7Ptr = (TUint8*)oriLine7->Des().Ptr();
+	TUint8* line8Ptr = (TUint8*)oriLine8->Des().Ptr();
+	TUint8* line9Ptr = (TUint8*)oriLine9->Des().Ptr();
+	TUint8* line10Ptr = (TUint8*)oriLine10->Des().Ptr();
+	TUint8* linePtrs[11] = {line0Ptr, line1Ptr, line2Ptr, line3Ptr, line4Ptr,
+							line5Ptr, line6Ptr, line7Ptr, line8Ptr, line9Ptr, line10Ptr};
+
+	TUint8* tmpPtr;
+	TUint8* tempPtr;
+	
+	// Set TPtr8s of input lines
+	TPtr8 Ptr0(line0Ptr, 3 * aOriSizeX, 3 * aOriSizeX);
+	TPtr8 Ptr1(line1Ptr, 3 * aOriSizeX, 3 * aOriSizeX);
+	TPtr8 Ptr2(line2Ptr, 3 * aOriSizeX, 3 * aOriSizeX);
+	TPtr8 Ptr3(line3Ptr, 3 * aOriSizeX, 3 * aOriSizeX);
+	TPtr8 Ptr4(line4Ptr, 3 * aOriSizeX, 3 * aOriSizeX);
+	TPtr8 Ptr5(line5Ptr, 3 * aOriSizeX, 3 * aOriSizeX);
+	TPtr8 Ptr6(line6Ptr, 3 * aOriSizeX, 3 * aOriSizeX);
+	TPtr8 Ptr7(line7Ptr, 3 * aOriSizeX, 3 * aOriSizeX);
+	TPtr8 Ptr8(line8Ptr, 3 * aOriSizeX, 3 * aOriSizeX);
+	TPtr8 Ptr9(line9Ptr, 3 * aOriSizeX, 3 * aOriSizeX);
+	TPtr8 Ptr10(line10Ptr, 3 * aOriSizeX, 3 * aOriSizeX);
+	TPtr8 Ptrs[11] = {Ptr0, Ptr1, Ptr2, Ptr3, Ptr4, Ptr5, Ptr6, Ptr7, Ptr8, Ptr9, Ptr10};
+	
+	// Set indicator for order of input lines
+	TInt lines[11] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+	
+	// Allocate local temporal output line buffer and push its pointer to CleanupStack
+	HBufC8* scanLine = HBufC8::NewMaxL(3 * aOutSizeX);
+	CleanupStack::PushL(scanLine);
+	
+	// Set pointer of output line
+	TUint8* DataPtr = (TUint8*)scanLine->Des().Ptr();
+	
+	// Set TPtr8 of output line
+	TPtr8 linePtr(DataPtr, 3 * aOutSizeX, 3 * aOutSizeX);
+
+	
+	// Calculate step between output pixels in original image
+	xStep = (TInt)(PIXEL / aZoomX + 0.5);
+	yStep = (TInt)(PIXEL / aZoomY + 0.5);
+	
+	// Calculate First output pixel position in original image
+	xPos = ((aOriSizeX - 1) << (PIX_BITS - 1)) - (((aOutSizeX - 1 - (allShiftX << 1)) * xStep) >> 1);
+	yPos = ((aOriSizeY - 1) << (PIX_BITS - 1)) - (((aOutSizeY - 1 - (allShiftY << 1)) * yStep) >> 1);
+	
+	xFirstInt = (TInt32)(xPos >> PIX_BITS);
+	if(xPos < 0) xFirstRem = (TUint32)((xPos + ((-xFirstInt) << PIX_BITS)) & REMAINDER);
+	else		 xFirstRem = (TUint32)(xPos & REMAINDER);
+	
+	yFirstInt = (TInt32)(yPos >> PIX_BITS);
+	if(yPos < 0) yFirstRem = (TUint32)((yPos + ((-yFirstInt) << PIX_BITS)) & REMAINDER);
+	else		 yFirstRem = (TUint32)(yPos & REMAINDER);
+	
+	// Calculate averaging area around the original pixel position
+	xAver = (TInt)(xStep >> 1);
+	yAver = (TInt)(yStep >> 1);
+	
+	// For bilinear interpolation at least 1 pixel have to be used
+	if(aZoomX > 1 && xAver < (TInt32)(HALF_PIX)) xAver = HALF_PIX;
+	if(aZoomY > 1 && yAver < (TInt32)(HALF_PIX)) yAver = HALF_PIX;
+	
+	// Calculate maximum weight sum
+	yMaxWei = (TUint32)(((yAver << 1) + HALF_DIF1) >> DIF1_BITS);
+	xMaxWei = (TUint32)(((xAver << 1) + HALF_DIF1) >> DIF1_BITS);
+	
+	// Calculate filter divider for filter window
+	divider = (TInt)((xMaxWei * yMaxWei + HALF_RED) >> RED_BITS);
+	
+	while(divider <= 256 && WEI_BITS < PIX_BITS)
+	{
+		WEI_BITS++;
+		HALF_WEI  = (TUint32)(1 << (WEI_BITS - 1));
+		DIF1_BITS = (TUint32)(PIX_BITS - WEI_BITS);
+		HALF_DIF1 = (TUint32)(1 << (DIF1_BITS - 1));
+		REM_HDIF1 = (TUint32)(HALF_DIF1 - 1);
+		
+		// Calculate maximum weight sum
+		yMaxWei = (TUint32)(((yAver << 1) + HALF_DIF1) >> DIF1_BITS);
+		xMaxWei = (TUint32)(((xAver << 1) + HALF_DIF1) >> DIF1_BITS);
+		
+		// Calculate filter divider for filter window
+		divider = (TInt)((xMaxWei * yMaxWei + HALF_RED) >> RED_BITS);
+	}
+	
+	if(divider > 1024)
+	{
+		WEI_BITS--;
+		HALF_WEI  = (TUint32)(1 << (WEI_BITS - 1));
+		DIF1_BITS = (TUint32)(PIX_BITS - WEI_BITS);
+		HALF_DIF1 = (TUint32)(1 << (DIF1_BITS - 1));
+		REM_HDIF1 = (TUint32)(HALF_DIF1 - 1);
+		
+		// Calculate maximum weight sum
+		yMaxWei = (TUint32)(((yAver << 1) + HALF_DIF1) >> DIF1_BITS);
+		xMaxWei = (TUint32)(((xAver << 1) + HALF_DIF1) >> DIF1_BITS);
+		
+		// Calculate filter divider for filter window
+		divider = (TInt)((xMaxWei * yMaxWei + HALF_RED) >> RED_BITS);
+	}
+	
+	while(divider <= 512 && RED_BITS > 0)
+	{
+		RED_BITS--;
+		HALF_RED = (TUint32)(1 << (RED_BITS - 1));
+		
+		divider = (TInt)((xMaxWei * yMaxWei + HALF_RED) >> RED_BITS);
+	}
+	
+	if(divider > 1024)
+	{
+		RED_BITS++;
+		HALF_RED = (TUint32)(1 << (RED_BITS - 1));
+	}
+	
+	// Initialise y loop limiters
+	yLoopSta = 0;
+	yLoopEnd = (TUint32)(aOutSizeY);
+	
+	// Initialise x loop limiters
+	xLoopSta = 0;
+	xLoopEnd = (TUint32)(aOutSizeX);
+
+	// Calculate only the panned image
+		if(newShiftY > 0)
+		{
+			// Update y loop start
+			yLoopSta = (TUint32)(aOutSizeY - newShiftY);
+
+			// Initialise y position
+			yInt = yFirstInt;
+			yRem = yFirstRem;
+
+			// Copy available image and change y position
+			for(y = 0; y < (TInt32)yLoopSta; y++)
+			{
+				// Read output line from source image
+				aOriPtr->GetScanLine(Ptrs[lines[0]], TPoint(0, y+newShiftY), aOriSizeX, aOriPtr->DisplayMode());
+
+				//Set the line to destination image
+				aOutPtr->SetScanLine(linePtr, y);
+
+				// Update y position
+				tmpEnd = (TInt)(yRem + yStep);
+				yInt = (TInt32)(yInt + (tmpEnd >> PIX_BITS));
+				yRem = (TUint32)(tmpEnd & REMAINDER);
+			}
+
+			// Update y position of first pixel
+			yFirstInt = yInt;
+			yFirstRem = yRem;
+		}
+		else if(newShiftY < 0)
+		{
+			// Update y loop end
+			yLoopEnd = (TUint32)(-newShiftY);
+
+			// Copy available image
+			for(y = (TInt32)(aOutSizeY - 1); y >= (TInt32)yLoopEnd; y--)
+			{
+				// Read output line from source image
+				aOriPtr->GetScanLine(Ptrs[lines[0]], TPoint(0, y+newShiftY), aOriSizeX, aOriPtr->DisplayMode());
+
+				//Set the line to destination image
+				aOutPtr->SetScanLine(linePtr, y);
+			}
+		}
+
+		// Calculate only the panned image
+		if(newShiftX > 0)
+		{
+			// Update x loop start
+			xLoopSta = (TUint32)(aOutSizeX - newShiftX);
+
+			// Initialise x position
+			xInt = xFirstInt;
+			xRem = xFirstRem;
+
+			// Change x position
+			for(x = 0; x < (TInt32)xLoopSta; x++)
+			{
+				// Update x position
+				tmpSta = (TInt)(xRem + xStep);
+				xInt = (TInt32)(xInt + (tmpSta >> PIX_BITS));
+				xRem = (TUint32)(tmpSta & REMAINDER);
+			}
+
+			// Update x position of first pixel
+			xFirstInt = xInt;
+			xFirstRem = xRem;
+		}
+		else if(newShiftX < 0)
+		{
+			// Update loop end
+			xLoopEnd = (TUint32)(-newShiftX);
+		}
+
+		// Initialise y position
+		yInt = yFirstInt;
+		yRem = yFirstRem;
+
+		tmpEnd = (TInt)(yRem + yAver + HALF_PIX + HALF_WEI);
+		yEndInt = (TInt32)((tmpEnd >> PIX_BITS) + yInt);
+		yEndRem = (TUint32)(tmpEnd & REMAINDER);
+
+		//Read 11 lines from the source image
+		if (yEndInt >= 10)
+		{
+			aOriPtr->GetScanLine(Ptrs[lines[0]], TPoint(0, yEndInt-10), aOriSizeX, aOriPtr->DisplayMode());
+			aOriPtr->GetScanLine(Ptrs[lines[1]], TPoint(0, yEndInt-9), aOriSizeX, aOriPtr->DisplayMode());
+			aOriPtr->GetScanLine(Ptrs[lines[2]], TPoint(0, yEndInt-8), aOriSizeX, aOriPtr->DisplayMode());
+			aOriPtr->GetScanLine(Ptrs[lines[3]], TPoint(0, yEndInt-7), aOriSizeX, aOriPtr->DisplayMode());
+			aOriPtr->GetScanLine(Ptrs[lines[4]], TPoint(0, yEndInt-6), aOriSizeX, aOriPtr->DisplayMode());
+			aOriPtr->GetScanLine(Ptrs[lines[5]], TPoint(0, yEndInt-5), aOriSizeX, aOriPtr->DisplayMode());
+			aOriPtr->GetScanLine(Ptrs[lines[6]], TPoint(0, yEndInt-4), aOriSizeX, aOriPtr->DisplayMode());
+			aOriPtr->GetScanLine(Ptrs[lines[7]], TPoint(0, yEndInt-3), aOriSizeX, aOriPtr->DisplayMode());
+			aOriPtr->GetScanLine(Ptrs[lines[8]], TPoint(0, yEndInt-2), aOriSizeX, aOriPtr->DisplayMode());
+			aOriPtr->GetScanLine(Ptrs[lines[9]], TPoint(0, yEndInt-1), aOriSizeX, aOriPtr->DisplayMode());
+			aOriPtr->GetScanLine(Ptrs[lines[10]], TPoint(0, yEndInt  ), aOriSizeX, aOriPtr->DisplayMode());
+		}
+		else
+		{
+			if(yEndInt >= 0)
+				aOriPtr->GetScanLine(Ptrs[lines[10]], TPoint(0, yEndInt  ), aOriSizeX, aOriPtr->DisplayMode());
+			if(yEndInt >= 1)
+				aOriPtr->GetScanLine(Ptrs[lines[9]], TPoint(0, yEndInt-1), aOriSizeX, aOriPtr->DisplayMode());
+			if(yEndInt >= 2)
+				aOriPtr->GetScanLine(Ptrs[lines[8]], TPoint(0, yEndInt-2), aOriSizeX, aOriPtr->DisplayMode());
+			if(yEndInt >= 3)
+				aOriPtr->GetScanLine(Ptrs[lines[7]], TPoint(0, yEndInt-3), aOriSizeX, aOriPtr->DisplayMode());
+			if(yEndInt >= 4)
+				aOriPtr->GetScanLine(Ptrs[lines[6]], TPoint(0, yEndInt-4), aOriSizeX, aOriPtr->DisplayMode());
+			if(yEndInt >= 5)
+				aOriPtr->GetScanLine(Ptrs[lines[5]], TPoint(0, yEndInt-5), aOriSizeX, aOriPtr->DisplayMode());
+			if(yEndInt >= 6)
+				aOriPtr->GetScanLine(Ptrs[lines[4]], TPoint(0, yEndInt-6), aOriSizeX, aOriPtr->DisplayMode());
+			if(yEndInt >= 7)
+				aOriPtr->GetScanLine(Ptrs[lines[3]], TPoint(0, yEndInt-7), aOriSizeX, aOriPtr->DisplayMode());
+			if(yEndInt >= 8)
+				aOriPtr->GetScanLine(Ptrs[lines[2]], TPoint(0, yEndInt-8), aOriSizeX, aOriPtr->DisplayMode());
+			if(yEndInt >= 9)
+				aOriPtr->GetScanLine(Ptrs[lines[1]], TPoint(0, yEndInt-9), aOriSizeX, aOriPtr->DisplayMode());
+			if(yEndInt >= 10)
+				aOriPtr->GetScanLine(Ptrs[lines[0]], TPoint(0, yEndInt-10), aOriSizeX, aOriPtr->DisplayMode());
+		}
+		LastLine = (TInt32)(yEndInt);
+
+		// Loop y for result image
+		for(y = (TInt32)yLoopSta; y < (TInt32)yLoopEnd; y++)
+		{
+			// Calculate used y pixels
+			tmpSta = (TInt)(yRem - yAver + HALF_PIX + HALF_WEI);
+			yStaInt = (TInt32)((tmpSta >> PIX_BITS) + yInt);
+			yStaRem = (TUint32)(tmpSta & REMAINDER);
+
+			tmpEnd = (TInt)(yRem + yAver + HALF_PIX + HALF_WEI);
+			yEndInt = (TInt32)((tmpEnd >> PIX_BITS) + yInt);
+			yEndRem = (TUint32)(tmpEnd & REMAINDER);
+
+			//Read a new line from the source image if needed
+			while (yEndInt > LastLine && LastLine < aOriSizeY-1)
+			{
+				LastLine++;
+				tmpline = lines[0];
+				lines[0] = lines[1];
+				lines[1] = lines[2];
+				lines[2] = lines[3];
+				lines[3] = lines[4];
+				lines[4] = lines[5];
+				lines[5] = lines[6];
+				lines[6] = lines[7];
+				lines[7] = lines[8];
+				lines[8] = lines[9];
+				lines[9] = lines[10];
+				lines[10] = tmpline;
+
+				if(LastLine >= 0)
+					aOriPtr->GetScanLine(Ptrs[lines[10]], TPoint(0, LastLine), aOriSizeX, aOriPtr->DisplayMode());
+			}
+
+			//Set pixel pointer to beginning of destination line
+			DataPtr = (TUint8*)scanLine->Des().Ptr();
+
+			// Calculate column weights and weight sum
+			yStaWei = (TUint32)((PIXEL - yStaRem - 1) >> DIF1_BITS);
+			yEndWei = (TUint32)((yEndRem) >> DIF1_BITS);
+			yAllWei = (TUint32)(yStaWei + ((yEndInt - yStaInt - 1) << WEI_BITS) + yEndWei);
+
+			// Check that the weight sum is not too big
+			if(yAllWei > yMaxWei)
+			{
+				if(((yEndRem) & REM_HDIF1) > ((PIXEL - yStaRem) & REM_HDIF1))
+				{
+					yStaWei -= 1;
+				}
+				else
+				{
+					yEndWei -= 1;
+				}
+				yAllWei -= 1;
+			}
+
+			// Initialise x position
+			xInt = xFirstInt;
+			xRem = xFirstRem;
+
+			// Calculate only the panned image
+			if(newShiftX > 0)
+			{
+				tmpPtr = DataPtr;	
+				tempPtr = tmpPtr + newShiftX * 3;
+
+				// Copy available image to the beginning of line
+				for(x = 0; x < (TInt32)xLoopSta; x++)
+				{
+					*tmpPtr++ = *tempPtr++;
+					*tmpPtr++ = *tempPtr++;
+					*tmpPtr++ = *tempPtr++;	
+				}
+			}
+			else if(newShiftX < 0)
+			{
+				tmpPtr = DataPtr + 3 * aOutSizeX - 1;	
+				tempPtr = tmpPtr + newShiftX * 3;
+
+				// Copy available image to the end of line
+				for(x = (TInt32)(aOutSizeX - 1); x >= (TInt32)xLoopEnd; x--)
+				{
+					*tmpPtr-- = *tempPtr--;
+					*tmpPtr-- = *tempPtr--;
+					*tmpPtr-- = *tempPtr--;	
+				}
+			}
+
+				LineNum = (TUint32)((yStaInt - LastLine + 10) % 11);
+
+			// Loop x for result image
+			for(x = (TInt32)xLoopSta; x < (TInt32)xLoopEnd; x++)
+			{
+				// Calculate used x pixels
+				tmpSta = (TInt)(xRem - xAver + HALF_PIX + HALF_WEI);
+				xStaInt = (TInt32)((tmpSta >> PIX_BITS) + xInt);
+				xStaRem = (TUint32)((tmpSta & REMAINDER));
+
+				tmpEnd = (TInt)(xRem + xAver + HALF_PIX + HALF_WEI);
+				xEndInt = (TInt32)((tmpEnd >> PIX_BITS) + xInt);
+				xEndRem = (TUint32)(tmpEnd & REMAINDER);
+
+				// Calculate line weights and weight sum
+				xStaWei = (TUint32)((PIXEL - xStaRem - 1) >> DIF1_BITS);
+				xEndWei = (TUint32)((xEndRem) >> DIF1_BITS);
+				xAllWei = (TUint32)(xStaWei + ((xEndInt - xStaInt - 1) << WEI_BITS) + xEndWei);
+
+				// Check that the weight sum is not too big
+				if(xAllWei > xMaxWei)
+				{
+					if(((xEndRem) & REM_HDIF1) > ((PIXEL - xStaRem) & REM_HDIF1))
+					{
+						xStaWei -= 1;
+					}
+					else
+					{
+						xEndWei -= 1;
+					}
+					xAllWei -= 1;
+				}
+
+				// Calculate filter divider for filter window
+				divider = (TInt)((xAllWei * yAllWei + HALF_RED) >> RED_BITS);
+
+				// Calculate pixel values
+				outFlag = 0;
+
+				// Initialise block result
+				sumB = 0;
+				sumG = 0;
+				sumR = 0;
+
+				LineNum = (TUint32)((yStaInt - LastLine + 10) % 11);
+
+				// Accumulate first line
+				if(yStaWei != 0)
+				{
+					// Line number
+					if(yStaInt < 0)		   		 outFlag = 1;
+					else if(yStaInt >= aOriSizeY) outFlag = 1;
+					else
+					{
+						// Initialise line result
+						tmpB = 0;
+						tmpG = 0;
+						tmpR = 0;
+
+						// First pixel in first line
+						if(xStaWei != 0)
+						{
+							// Column number
+							if(xStaInt < 0)				 outFlag = 1;
+							else if(xStaInt >= aOriSizeX) outFlag = 1;
+							else
+							{
+								// Pixel weighting to line result
+								tmpB = (TInt)(tmpB + (*(linePtrs[lines[LineNum]] + 3 * xStaInt))     * xStaWei);
+								tmpG = (TInt)(tmpG + (*(linePtrs[lines[LineNum]] + 3 * xStaInt + 1)) * xStaWei);
+								tmpR = (TInt)(tmpR + (*(linePtrs[lines[LineNum]] + 3 * xStaInt + 2)) * xStaWei);
+							}
+						}
+
+						// Middle pixels in first line
+						for(i = (TInt32)(xStaInt + 1); i < xEndInt; i++)
+						{
+							// Column number
+							if(i < 0)			   outFlag = 1;
+							else if(i >= aOriSizeX) outFlag = 1;
+							else
+							{
+								// Pixel weighting to line result
+								tmpB = (TInt)(tmpB + ((*(linePtrs[lines[LineNum]] + 3 * i    )) << WEI_BITS));
+								tmpG = (TInt)(tmpG + ((*(linePtrs[lines[LineNum]] + 3 * i + 1)) << WEI_BITS));
+								tmpR = (TInt)(tmpR + ((*(linePtrs[lines[LineNum]] + 3 * i + 2)) << WEI_BITS));
+							}
+						}
+
+						// Last pixel in first line
+						if(xEndWei != 0)
+						{
+							// Column number
+							if(xEndInt < 0)				 outFlag = 1;
+							else if(xEndInt >= aOriSizeX) outFlag = 1;
+							else
+							{
+								// Pixel weighting to line result
+								tmpB = (TInt)(tmpB + (*(linePtrs[lines[LineNum]] + 3 * xEndInt    )) * xEndWei);
+								tmpG = (TInt)(tmpG + (*(linePtrs[lines[LineNum]] + 3 * xEndInt + 1)) * xEndWei);
+								tmpR = (TInt)(tmpR + (*(linePtrs[lines[LineNum]] + 3 * xEndInt + 2)) * xEndWei);
+							}
+						}
+
+						// Pixel weighting to block result
+						sumB = (TInt)(sumB + ((yStaWei * tmpB + HALF_RED) >> RED_BITS));
+						sumG = (TInt)(sumG + ((yStaWei * tmpG + HALF_RED) >> RED_BITS));
+						sumR = (TInt)(sumR + ((yStaWei * tmpR + HALF_RED) >> RED_BITS));
+					}
+				}
+				LineNum++;
+
+				// Accumulate middle lines
+				for(j = (TInt32)(yStaInt + 1); j < yEndInt; j++)
+				{
+					// Line number 
+					if(j < 0)			   outFlag = 1;
+					else if(j >= aOriSizeY) outFlag = 1;
+					else
+					{
+						// Initialise line result
+						tmpB = 0;
+						tmpG = 0;
+						tmpR = 0;
+
+						// First pixel in middle lines
+						if(xStaWei != 0)
+						{
+							// Column number
+							if(xStaInt < 0)				 outFlag = 1;
+							else if(xStaInt >= aOriSizeX) outFlag = 1;
+							else
+							{
+								// Pixel weighting to line result
+								tmpB = (TInt)(tmpB + (*(linePtrs[lines[LineNum]] + 3 * xStaInt    )) * xStaWei);
+								tmpG = (TInt)(tmpG + (*(linePtrs[lines[LineNum]] + 3 * xStaInt + 1)) * xStaWei);
+								tmpR = (TInt)(tmpR + (*(linePtrs[lines[LineNum]] + 3 * xStaInt + 2)) * xStaWei);
+							}
+						}
+
+						// Middle pixels in middle lines
+						for(i = (TInt32)(xStaInt + 1); i < xEndInt; i++)
+						{
+							// Column number
+							if(i < 0)			   outFlag = 1;
+							else if(i >= aOriSizeX) outFlag = 1;
+							else
+							{
+								// Pixel weighting to line result
+								tmpB = (TInt)(tmpB + ((*(linePtrs[lines[LineNum]] + 3 * i    )) << WEI_BITS));
+								tmpG = (TInt)(tmpG + ((*(linePtrs[lines[LineNum]] + 3 * i + 1)) << WEI_BITS));
+								tmpR = (TInt)(tmpR + ((*(linePtrs[lines[LineNum]] + 3 * i + 2)) << WEI_BITS));
+							}
+						}
+
+						// Last pixel in middle lines
+						if(xEndWei != 0)
+						{
+							// Column number
+							if(xEndInt < 0)				 outFlag = 1;
+							else if(xEndInt >= aOriSizeX) outFlag = 1;
+							else
+							{
+								// Pixel weighting to line result
+								tmpB = (TInt)(tmpB + (*(linePtrs[lines[LineNum]] + 3 * xEndInt    )) * xEndWei);
+								tmpG = (TInt)(tmpG + (*(linePtrs[lines[LineNum]] + 3 * xEndInt + 1)) * xEndWei);
+								tmpR = (TInt)(tmpR + (*(linePtrs[lines[LineNum]] + 3 * xEndInt + 2)) * xEndWei);
+							}
+						}
+
+						// Pixel weighting to block result
+						sumB = (TInt)(sumB + (((tmpB << WEI_BITS) + HALF_RED) >> RED_BITS));
+						sumG = (TInt)(sumG + (((tmpG << WEI_BITS) + HALF_RED) >> RED_BITS));
+						sumR = (TInt)(sumR + (((tmpR << WEI_BITS) + HALF_RED) >> RED_BITS));
+					}
+					LineNum++;
+				}
+
+
+				// Accumulate last line
+				if(yEndWei != 0)
+				{
+					// Line number 
+					if(yEndInt < 0)				 outFlag = 1;
+					else if(yEndInt >= aOriSizeY) outFlag = 1;
+					else
+					{
+						// Initialise line result
+						tmpB = 0;
+						tmpG = 0;
+						tmpR = 0;
+
+						// First pixel in last line
+						if(xStaWei != 0)
+						{
+							// Column number
+							if(xStaInt < 0)				 outFlag = 1;
+							else if(xStaInt >= aOriSizeX) outFlag = 1;
+							else
+							{
+								tmpB = (TInt)(tmpB + (*(linePtrs[lines[LineNum]] + 3 * xStaInt    )) * xStaWei);
+								tmpG = (TInt)(tmpG + (*(linePtrs[lines[LineNum]] + 3 * xStaInt + 1)) * xStaWei);
+								tmpR = (TInt)(tmpR + (*(linePtrs[lines[LineNum]] + 3 * xStaInt + 2)) * xStaWei);
+							}
+						}
+
+						// Middle pixels in last line
+						for(i = (TInt32)(xStaInt + 1); i < xEndInt; i++)
+						{
+							// Column number
+							if(i < 0)			   outFlag = 1;
+							else if(i >= aOriSizeX) outFlag = 1;
+							else
+							{
+								tmpB = (TInt)(tmpB + ((*(linePtrs[lines[LineNum]] + 3 * i    )) << WEI_BITS));
+								tmpG = (TInt)(tmpG + ((*(linePtrs[lines[LineNum]] + 3 * i + 1)) << WEI_BITS));
+								tmpR = (TInt)(tmpR + ((*(linePtrs[lines[LineNum]] + 3 * i + 2)) << WEI_BITS));
+							}
+						}
+
+						// Last pixel in last line
+						if(xEndWei != 0)
+						{
+							// Column number
+							if(xEndInt < 0)				 outFlag = 1;
+							else if(xEndInt >= aOriSizeX) outFlag = 1;
+							else
+							{
+								tmpB = (TInt)(tmpB + (*(linePtrs[lines[LineNum]] + 3 * xEndInt    )) * xEndWei);
+								tmpG = (TInt)(tmpG + (*(linePtrs[lines[LineNum]] + 3 * xEndInt + 1)) * xEndWei);
+								tmpR = (TInt)(tmpR + (*(linePtrs[lines[LineNum]] + 3 * xEndInt + 2)) * xEndWei);
+							}
+						}
+
+						// Pixel weighting to block result
+						sumB = (TInt)(sumB + ((yEndWei * tmpB + HALF_RED) >> RED_BITS));
+						sumG = (TInt)(sumG + ((yEndWei * tmpG + HALF_RED) >> RED_BITS));
+						sumR = (TInt)(sumR + ((yEndWei * tmpR + HALF_RED) >> RED_BITS));
+					}
+				}
+				LineNum++;
+
+
+				// Pixels outside the original image are needed
+				if(outFlag > 0 || divider == 0)
+				{
+					// Save output values
+					*(DataPtr + x * 3    ) = 255;
+					*(DataPtr + x * 3 + 1) = 255;
+					*(DataPtr + x * 3 + 2) = 255;
+				}
+
+				// Pixels are inside the original image
+				else
+				{
+					if(divider == 1)
+					{
+						tmpB = sumB;
+						tmpG = sumG;
+						tmpR = sumR;
+					}
+					else if(divider == 2)
+					{
+						tmpB = (TInt)((sumB + 1) >> 1);
+						tmpG = (TInt)((sumG + 1) >> 1);
+						tmpR = (TInt)((sumR + 1) >> 1);
+					}
+					else if(divider == 4)
+					{
+						tmpB = (TInt)((sumB + 2) >> 2);
+						tmpG = (TInt)((sumG + 2) >> 2);
+						tmpR = (TInt)((sumR + 2) >> 2);
+					}
+					else if(divider == 8)
+					{
+						tmpB = (TInt)((sumB + 4) >> 3);
+						tmpG = (TInt)((sumG + 4) >> 3);
+						tmpR = (TInt)((sumR + 4) >> 3);
+					}
+					else if(divider == 16)
+					{
+						tmpB = (TInt)((sumB + 8) >> 4);
+						tmpG = (TInt)((sumG + 8) >> 4);
+						tmpR = (TInt)((sumR + 8) >> 4);
+					}
+					else if(divider == 32)
+					{
+						tmpB = (TInt)((sumB + 16) >> 5);
+						tmpG = (TInt)((sumG + 16) >> 5);
+						tmpR = (TInt)((sumR + 16) >> 5);
+					}
+					else if(divider == 64)
+					{
+						tmpB = (TInt)((sumB + 32) >> 6);
+						tmpG = (TInt)((sumG + 32) >> 6);
+						tmpR = (TInt)((sumR + 32) >> 6);
+					}
+					else if(divider == 128)
+					{
+						tmpB = (TInt)((sumB + 64) >> 7);
+						tmpG = (TInt)((sumG + 64) >> 7);
+						tmpR = (TInt)((sumR + 64) >> 7);
+					}
+					else if(divider == 256)
+					{
+						tmpB = (TInt)((sumB + 128) >> 8);
+						tmpG = (TInt)((sumG + 128) >> 8);
+						tmpR = (TInt)((sumR + 128) >> 8);
+					}
+					else if(divider == 512)
+					{
+						tmpB = (TInt)((sumB + 256) >> 9);
+						tmpG = (TInt)((sumG + 256) >> 9);
+						tmpR = (TInt)((sumR + 256) >> 9);
+					}
+					else if(divider == 1024)
+					{
+						tmpB = (TInt)((sumB + 512) >> 10);
+						tmpG = (TInt)((sumG + 512) >> 10);
+						tmpR = (TInt)((sumR + 512) >> 10);
+					}
+					else
+					{
+						tmpB = (TInt)(((sumB * KDivTable[divider - 2]) + 32768) >> 16);
+						tmpG = (TInt)(((sumG * KDivTable[divider - 2]) + 32768) >> 16);
+						tmpR = (TInt)(((sumR * KDivTable[divider - 2]) + 32768) >> 16);
+					}
+
+					// Save output values
+					if(tmpB > 255) 
+						*(DataPtr + x * 3    ) = 255;
+					else           
+						*(DataPtr + x * 3    ) = (TUint8)(tmpB);
+					if(tmpG > 255) 
+						*(DataPtr + x * 3 + 1) = 255;
+					else           
+						*(DataPtr + x * 3 + 1) = (TUint8)(tmpG);
+					if(tmpR > 255) 
+						*(DataPtr + x * 3 + 2) = 255;
+					else           
+						*(DataPtr + x * 3 + 2) = (TUint8)(tmpR);
+				}
+
+				// Update x position
+				tmpEnd = (TInt)(xRem + xStep);
+				xInt = (TInt32)(xInt + (tmpEnd >> PIX_BITS));
+				xRem = (TUint32)(tmpEnd & REMAINDER);
+			}
+
+			//Set processed line
+			aOutPtr->SetScanLine(linePtr, y);
+
+			// Update y position
+			tmpEnd = (TInt)(yRem + yStep);
+			yInt = (TInt32)(yInt + (tmpEnd >> PIX_BITS));
+			yRem = (TUint32)(tmpEnd & REMAINDER);
+		}
+		
+	// Delete local temporal line buffers (pop from CleanupStack)
+	CleanupStack::PopAndDestroy(12);	// scanLine, oriLine0 and oriLine1
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  SetParams
+	
+  Set processing parameters
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDCDigitalZoom::SetParameters(DCDigitalZoomParams* params)
+{
+	iParams = *params;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  GetParams
+	
+  Get current processing parameters
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDCDigitalZoom::GetParameters(DCDigitalZoomParams* params)
+{
+	*params = iParams;
+}
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/src/DCDithering.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,241 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//DCDithering.cpp
+//
+//Version 1.00
+//
+//Contains:
+//	CDCDithering 
+//			
+//History:
+//	19.08.2003 version 1.00 created using existing IMAAMI algorithms	
+//*************************************************************************
+
+//  Include Files  
+#include <e32std.h>   // The basic definitions
+#include <fbs.h>      // For FBS bitmap
+#include "DCDithering.h"     // The DCDithering class
+
+
+
+//  MEMBER FUNCTIONS
+//=============================================================================
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDCDithering
+
+    Constructor
+
+    Default constructor
+
+    Return Values:  none
+
+-----------------------------------------------------------------------------
+*/
+CDCDithering::CDCDithering()
+{
+	// This function is intentionally left blank.
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDCDithering
+
+    NewLC
+
+    Factory function to instantiate the class.
+    This function leaves the class pointer to the cleanup stack
+    May leave with KErrNoMemory if no memory available
+
+    Return Values:  CDCDithering* self:  pointer to the class instance
+
+-----------------------------------------------------------------------------
+*/
+CDCDithering* CDCDithering::NewLC()
+{
+    CDCDithering* self = new (ELeave) CDCDithering();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDCDithering
+
+    NewL
+
+    Factory function to instantiate the class.
+    May leave with KErrNoMemory if no memory available
+
+    Return Values:  CDCDithering* self:  pointer to the class instance
+
+-----------------------------------------------------------------------------
+*/
+CDCDithering* CDCDithering::NewL()
+{
+    CDCDithering* self = CDCDithering::NewLC();
+    CleanupStack::Pop();
+    return self;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDCDithering
+
+    ConstructL
+
+    Second phase constructor. Does nothing at the moment
+
+    Return Values:  none
+
+-----------------------------------------------------------------------------
+*/
+void CDCDithering::ConstructL()
+{
+    // This function is intentionally left blank.
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDCDithering
+
+    Destructor
+
+    Return Values:  none
+
+-----------------------------------------------------------------------------
+*/
+CDCDithering::~CDCDithering()
+{
+	// This function is intentionally left blank.
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  ProcessL
+	
+  Process image referenced by aImage (modify aImage).
+  May leave with KErrNoMemory if no memory available
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDCDithering::ProcessL(CFbsBitmap& aImage)
+{
+	TUint	r, g, b;	// Color components
+	TUint8*	dataPtr;	// Pointer to data
+
+	//Dithering variables, init to 0
+	TInt	count=0;	
+	TInt16	dither=0;
+	
+	//EColor16M image is needed
+	if (aImage.DisplayMode() != EColor16M || aImage.DisplayMode() != EColor16M)
+		return;
+	
+	// Line Buffer and pointer to the data
+	TUint imageWidth = aImage.SizeInPixels().iWidth;
+	TUint scanLineLengthInBytes = aImage.ScanLineLength(imageWidth, aImage.DisplayMode());
+	
+	//Allocate buffer for scanline
+	iScanLineBuffer = HBufC8::NewMaxL(scanLineLengthInBytes);
+	//Pointer to scanline
+	TPtr8 linePtr = iScanLineBuffer->Des();
+	
+	//Step through image lines
+	for (TInt lineNo=0; lineNo<aImage.SizeInPixels().iHeight; ++lineNo)
+	{
+		//Get line
+		aImage.GetScanLine(linePtr, TPoint(0, lineNo), imageWidth, aImage.DisplayMode());
+		//CHECK! CONST_CAST not used in every algorithm which way is better?
+		dataPtr = CONST_CAST(TUint8*, linePtr.Ptr());
+
+		//Step through image pixels
+		for (TUint x=0; x < imageWidth; ++x)
+		{
+			// Get original values
+			b = *dataPtr++;
+			g = *dataPtr++;
+			r = *dataPtr++;
+			
+			//Compute DCDithering factor from base count
+			switch (count&1)
+			{
+			case 0:
+				dither = (TInt16)(dither*0x7ffd);
+				break;
+			case 1:
+				dither = (TInt16)(dither+0x7f21);
+				break;
+			}
+			
+			//Add DCDithering factor, adjust gain according to quantization factors.
+			r = Limit255((TInt)r + (dither>>13));
+			g = Limit255((TInt)g - (dither>>14));
+			b = Limit255((TInt)b + (dither>>13));
+			
+			//Move to the previous pixel
+			dataPtr -= 3;
+			
+			/* Set the result */
+			*dataPtr++ = (TUint8)b;
+			*dataPtr++ = (TUint8)g;
+			*dataPtr++ = (TUint8)r;
+		
+			//Increase bae count
+			count++;
+		}
+		
+		//Set scan line
+		aImage.SetScanLine(linePtr, lineNo);
+	}
+
+	//Free allocated memory
+	delete(iScanLineBuffer);
+	iScanLineBuffer = 0;
+}
+//  End of File  
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/src/DCIetd.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,519 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//CDCIETD.cpp
+//Version 2.00
+//
+//Contains:
+//	CDCIETD 
+//		Display specific color contrast enhancement, 
+//		Image Enhancement for Transflective Displays version 2,
+//		IETD 2.
+//
+//History:
+//	23.10.2003 version 2.00 created using existing IMAAMI IETD	
+//*************************************************************************
+
+//  Include Files  
+#include <e32std.h>	// The basic definitions
+#include <fbs.h>	// For FBS bitmap
+#include "DCIetd.h"	// The DCIetd class
+
+
+//  MEMBER FUNCTIONS
+//=============================================================================
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  Constructor
+	
+  Default constructor, initializes member variables to initial values
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+CDCIetd::CDCIetd()
+{
+	// Set default values for parameters (from init file)
+	iParameters.aWhitePixels = WhitePixels;
+	iParameters.aBlackPixels = BlackPixels;
+	iParameters.aStretchLimit = StretchLimit;
+	iParameters.aSaturationGain = SaturationGain;
+	iParameters.aBitLimit = BitLimit;
+	iParameters.aWBC = WBC;
+	iParameters.aDBC = DBC;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  NewLC
+	
+  Factory function to instantiate the class.
+  This function leaves the class pointer to the cleanup stack
+  May leave with KErrNoMemory if no memory available
+  
+  Return Values:  CDCIetd* self:  pointer to the class instance
+
+-----------------------------------------------------------------------------
+*/
+CDCIetd* CDCIetd::NewLC()
+{
+    CDCIetd* self = new (ELeave) CDCIetd();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  NewL
+	
+  Factory function to instantiate the class.
+  May leave with KErrNoMemory if no memory available
+	  
+  Return Values:  CDCIetd* self:  pointer to the class instance
+	
+-----------------------------------------------------------------------------
+*/
+CDCIetd* CDCIetd::NewL()
+{
+    CDCIetd* self = CDCIetd::NewLC();
+    CleanupStack::Pop();
+    return self;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  ConstructL
+	
+  Second phase constructor. Does nothing at the moment
+	  
+  Return Values:  none
+		
+ -----------------------------------------------------------------------------
+*/
+void CDCIetd::ConstructL()
+{
+    // This function is intentionally left blank.
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  Destructor
+	
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+CDCIetd::~CDCIetd()
+{
+    // This function is intentionally left blank.
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  Analyze
+	
+  Analyze image referenced by aBPtr 
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+// Analyze image referenced by aBPtr
+void CDCIetd::Analyze(CFbsBitmap& aBPtr)
+{
+
+	//EColor16M image is needed
+	if (aBPtr.DisplayMode() != EColor16M) return;
+	
+	//Do analysis
+	GatherHistograms(aBPtr);
+	MakeMappings();
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  ProcessL
+	
+  Process image referenced by aImage (modify aImage).
+  May leave with KErrNoMemory if no memory available
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDCIetd::ProcessL (CFbsBitmap& aImage)  // image reference
+{
+	TUint	r, g, b;	// Color components
+	TUint	lum;		// Brightness estimate
+	TInt	dr, dg, db;	// Differences to brightness
+	TUint8*	dataPtr;	// Pointer to data
+	
+	//EColor16M image is needed
+	if (aImage.DisplayMode() != EColor16M) return;
+	
+	//Line Buffer and pointer to the data
+	TUint imageWidth = aImage.SizeInPixels().iWidth;
+	TUint scanLineLengthInBytes = aImage.ScanLineLength(imageWidth, aImage.DisplayMode());
+
+	//Allocate buffer for scanline
+	iScanLineBuffer = HBufC8::NewMaxL(scanLineLengthInBytes);
+	//Pointer to scanline
+	TPtr8 linePtr = iScanLineBuffer->Des();
+	
+	//Step through image pixels and do stretching
+	//and saturation increase
+	//---------------------------------------------
+
+	//Read all lines
+	for (TInt lineNo=0; lineNo<aImage.SizeInPixels().iHeight; ++lineNo)
+	{
+		//Get line
+		aImage.GetScanLine(linePtr, TPoint(0, lineNo), imageWidth, aImage.DisplayMode());
+		//CHECK! CONST_CAST not used in every algorithm which way is better?
+		dataPtr = CONST_CAST(TUint8*, linePtr.Ptr());
+	
+		//Step through pixels in line
+		for (TUint x=0; x < imageWidth; ++x)
+		{
+			// Map color componets according to mapping LUTs
+			b = iMap[2][*dataPtr++];
+			g = iMap[1][*dataPtr++];
+			r = iMap[0][*dataPtr++];
+			
+			//Compute brightness estimate
+			//lum=0.299r+0.587g+0.114b; //true Y
+			//lum=(32768+19595*r+38470*g+7471*b)>>16; //Y
+			//lum = (r+g+b)/3; //Simple approximation
+			lum=(r+(g<<1)+b)>>2; //More effective simple approximation
+			
+			//Compute componentwise differences to luminance
+			dr = r-lum;
+			dg = g-lum;
+			db = b-lum;
+			
+			//Increase differences => saturation increases.
+			//Use gain parameter for adjusting the strength of the effect.
+			b += iParameters.aSaturationGain*db/32;
+			g += iParameters.aSaturationGain*dg/32;
+			r += iParameters.aSaturationGain*dr/32;
+			
+			//Save data to same image & same pixels
+			dataPtr -= 3;
+						
+			//Limit to available dynamic range [0,255].
+			*dataPtr++ = Limit255(b);
+			*dataPtr++ = Limit255(g);
+			*dataPtr++ = Limit255(r);
+		}
+		
+		//Save line
+		aImage.SetScanLine(linePtr, lineNo);
+	}
+
+	//Free memory
+	delete(iScanLineBuffer);
+	iScanLineBuffer = 0;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  GatherHistograms
+	
+  Gather histograms and make cumulative histogram.
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDCIetd::GatherHistograms (const CFbsBitmap& aImage)  // Pointer to the image bitmap
+{
+	const TUint8* dataPtr; //Pointer to data
+	TInt lineNo; //Line number
+	TUint x;	 //Pixel index	
+	TUint color; //Color index
+	TUint count; // Number of colors in each component
+
+	//Compute image width & allocate scan line memory
+	TUint imageWidth = aImage.SizeInPixels().iWidth;
+	TUint histScanLineLengthInBytes = aImage.ScanLineLength(imageWidth, aImage.DisplayMode());
+	iScanLineBuffer = HBufC8::NewMaxL(histScanLineLengthInBytes);
+	
+	//Pointer to line
+	TPtr8 linePtr = iScanLineBuffer->Des();
+
+	//Clear histograms
+	Mem::FillZ(iHistogram, sizeof(iHistogram));
+
+	// Read all lines and gather histograms
+	for (lineNo=0; lineNo<aImage.SizeInPixels().iHeight; lineNo++)
+	{
+		//Get line
+		aImage.GetScanLine(linePtr, TPoint(0, lineNo), imageWidth, aImage.DisplayMode());
+		dataPtr = linePtr.Ptr();
+
+		//Step through pixels
+		for (x=imageWidth; x != 0; --x)
+		{
+			++iHistogram[2][*dataPtr++]; // Increase Blue bin value
+			++iHistogram[1][*dataPtr++]; // Increase Green bin value
+			++iHistogram[0][*dataPtr++]; // Increase Red bin value
+		}
+	}
+	
+	//Make cumulative histograms & count colors in each histogram
+	for (color=0; color<3; ++color)
+	{
+		 // Count used colors
+		count=0;
+		for (x=0; x<256; ++x)
+		{
+			if (iHistogram[color][x]>0) count++;
+		}
+		
+		// Compute increased stretch limit if a color component has less colors than iBitLimit.
+		// Otherwise use predetermined stretch limit.
+		if (count<iParameters.aBitLimit)
+			iReducedStretchLimit[color] = (TUint8)(iParameters.aStretchLimit*count/iParameters.aBitLimit+255-255*count/iParameters.aBitLimit);
+		else
+			iReducedStretchLimit[color] = iParameters.aStretchLimit;
+		
+		//Make cumulative histogram
+		for (x=1; x<256; ++x)
+			iHistogram[color][x] += iHistogram[color][x-1];
+		
+	}
+	
+	//Free memory
+	delete(iScanLineBuffer);
+	iScanLineBuffer = 0;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  MakeMappings
+	
+  Make mapping function look-up table (LUT).
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDCIetd::MakeMappings()
+{
+	TInt    MinBins[3];// Smallest existing values in histogram
+	TInt    MaxBins[3];// Largest existing values in histogram
+	TUint    minBin;    // Minimum of smallest existing values
+	TUint    maxBin;    // Maximum of largest existing values
+	TUint    x;         // Index
+	
+	// Stretching limit variables
+	TUint    minShift;
+	TUint    maxShift;
+	TUint    totalShift;
+	
+	TUint    color; //Color index
+	
+	//Step through colors
+	for (color=0; color<3; ++color)
+	{
+		// Find smallest existing values in histograms, discard darkest pixels
+		// according to blackpixels parameter
+		x = 0; // Start from fist bin
+		MinBins[color] = iParameters.aBlackPixels * iHistogram[color][255]/1000; // Compute value to be found
+		while (x < 255 && (TUint)iHistogram[color][x] < MinBins[color])
+			++x; // Find from histogram
+		
+		MinBins[color] = x; // Save bin index = start of stretching part of LUT
+		
+		// Find largest existing values in histograms, discard brightest pixels
+		// according to whitepixels parameter
+		x = 255;  // Start from last bin
+		//Compute value to be found
+		MaxBins[color] = iHistogram[color][255] - iParameters.aWhitePixels * iHistogram[color][255]/1000;
+		while (x > 0 && (TUint)iHistogram[color][x] > MaxBins[color])
+			--x; // Find from histogram
+		
+		MaxBins[color] = x; // Save bin index = end of stretching part of LUT
+	}
+	
+	//Find minimum of all colors
+	minBin=255;
+	for (color=0; color<3; color++)
+	{
+		if (minBin>MinBins[color]) minBin=MinBins[color];
+	}
+	
+	//Find maximum of all colors
+	maxBin=0;
+	for (color=0; color<3; color++)
+	{
+		if (maxBin<MaxBins[color]) maxBin=MaxBins[color];
+	}
+	
+	//Adjust white and dark balance within limits given in parameters (maximum correction).
+	//0 means that largest(or smallest) of all values is used => no WBC(or DBC).
+	for (color=0; color<3; color++)
+	{
+		if(maxBin-MaxBins[color]>iParameters.aWBC) MaxBins[color]=maxBin-iParameters.aWBC;
+		if((MinBins[color]-minBin) > iParameters.aDBC) MinBins[color]=minBin+iParameters.aDBC;
+	}
+	
+	//Step through color components
+	for (color=0; color<3; color++)
+	{
+		// If histogram has only one nonzero bin maxBin can be less than minBin.
+		// In that case change maxBin value to minBin.
+		if(MaxBins[color]<MinBins[color]) MaxBins[color]=MinBins[color];
+		
+		// Limit stretching to narrovest histogram that can be stretched
+		if (MaxBins[color]-MinBins[color] < iReducedStretchLimit[color])
+		{
+			// Compute limiting shifts to measured values.
+			// Compute shifts for dark and bright end in relation
+			// to coresponding available space in dynamic range.
+			totalShift = iReducedStretchLimit[color]-(MaxBins[color]-MinBins[color]);
+			maxShift = totalShift*(255-MaxBins[color])/(255-(MaxBins[color]-MinBins[color]));
+			minShift = totalShift*MinBins[color]/(255-(MaxBins[color]-MinBins[color]));
+			
+			// Shift measured values, so that stretching is limited 
+			MinBins[color] -= minShift;
+			MaxBins[color] += maxShift;
+			
+			// Check that dynamic range is not exceeded
+			// (Should happen only with faulty parameter values)
+			if (MinBins[color]<0)
+				MinBins[color]=0;
+			if (MaxBins[color]>255)
+				MaxBins[color]=255;
+		}
+		
+		// Set 0 mapping part of the LUT
+		for (x=0; x<=MinBins[color]; ++x)
+			iMap[color][x] = 0;
+		
+		// Set 255 mapping part of the LUT
+		for (x=MaxBins[color]; x<=255; ++x)
+			iMap[color][x] = 255;
+		
+		// Compute linear stretching part of the LUT
+		for (x=MinBins[color]+1; x<MaxBins[color]; x++)
+			iMap[color][x] = (TUint8)(255*(x-MinBins[color])/(MaxBins[color]-MinBins[color]));
+	}
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  SetParams
+	
+  Set processing parameters
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDCIetd::SetParams(DCIetdParameters* params)
+{
+	iParameters = *params;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  GetParams
+	
+  Get current processing parameters
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDCIetd::GetParams(DCIetdParameters* params)
+{
+	*params = iParameters;
+}
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/src/DCSharpening.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,683 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//DCSharpening.cpp
+//
+//Version 1.00
+//
+//Contains:
+//	CDCSharpening 
+//		Sharpening using IMAAMI algorithm.
+//			
+//History:
+//	19.08.2003 version 1.00 created using existing IMAAMI algorithms	
+//*************************************************************************
+
+#include <fbs.h>
+#include <e32math.h> 
+#include "DCSharpening.h"
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  Constructor
+	
+  Default constructor, initializes member variables to initial values
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+DCSharpening::DCSharpening()
+{
+	// Set default values for parameters
+	iParameters.SHARP_OVER = SharpOver;
+	iParameters.SHARP_DZONE = SharpDZone;
+	iParameters.SHARP_GAIN = SharpGain;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  NewLC
+	
+  Factory function to instantiate the class.
+  This function leaves the class pointer to the cleanup stack
+  May leave with KErrNoMemory if no memory available
+  
+  Return Values:  DCSharpening* self:  pointer to the class instance
+
+-----------------------------------------------------------------------------
+*/
+DCSharpening* DCSharpening::NewLC()
+{
+	DCSharpening* self = new (ELeave) DCSharpening();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  NewL
+	
+  Factory function to instantiate the class.
+  May leave with KErrNoMemory if no memory available
+	  
+  Return Values:  DCSharpening* self:  pointer to the class instance
+	
+-----------------------------------------------------------------------------
+*/
+DCSharpening* DCSharpening::NewL()
+{
+	DCSharpening* self = DCSharpening::NewLC();
+	CleanupStack::Pop();
+	return self;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  ConstructL
+	
+  Second phase constructor. Does nothing at the moment
+	  
+  Return Values:  none
+		
+ -----------------------------------------------------------------------------
+*/
+void DCSharpening::ConstructL()
+{
+	// This function is intentionally left blank.
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  Destructor
+	
+  Deletes the scanline buffer
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+DCSharpening::~DCSharpening()
+{
+	// This function is intentionally left blank.
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  ProcessL
+	
+  Process image referenced by aSrcBmpPtr (modify aSrcBmpPtr).
+  May leave with KErrNoMemory if no memory available
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void DCSharpening::ProcessL(CFbsBitmap* aSrcBmpPtr)
+{
+	
+	HBufC8*	iSrcDataBuffer; //Local memory for source data
+	HBufC8*	iDstDataBuffer;	//Local memory for destination data
+	TUint8* SrcDataPtr[3];	//Pointers to source image pixels in 3 successive lines  
+	TUint8* DstDataPtr;		//Pointer to destianation pixels
+	TInt y,u,v, out;		//Color components
+	TUint x;				//Pixel indes
+	TInt LineNo;			//Line index
+	TUint LineLength;		//Image width
+	TUint8 TmpLineIdx;		//Temporary line index used for line swapping
+	TInt a, b, c, d, e, f, g, h, o;
+	
+	//Get image width
+	LineLength=aSrcBmpPtr->SizeInPixels().iWidth;
+	
+	//Allocate local memory for 3 source lines.
+	//Each line contains RGB triplets in BGRBGRBGR... format
+	//(VUYVUYVUY... after conversion).
+	//Descriptor HBufC8 is used.
+	iSrcDataBuffer=HBufC8::NewMaxL(3*LineLength*3);
+	CleanupStack::PushL(iSrcDataBuffer);
+	
+	//Set line pointers to point into beginnings of lines in allocated memory.
+	//Lines are stored consecutively.
+	//SrcLinePtrs[0] points to 1st line, [1] to 2nd, etc...
+	//Use descriptor TPtr8 instead of c++ pointer, because
+	//Set- and GetScanLine functions require it.
+	//Set also descriptor lengths.
+	TPtr8 SrcLinePtrs[3]={
+		TPtr8((TUint8*)iSrcDataBuffer->Des().Ptr(),LineLength*3,LineLength*3),
+			TPtr8((TUint8*)iSrcDataBuffer->Des().Ptr()+LineLength*3,LineLength*3,LineLength*3),
+			TPtr8((TUint8*)iSrcDataBuffer->Des().Ptr()+2*LineLength*3,LineLength*3,LineLength*3)
+	};
+	
+	//Set source line indexes. 
+	//Line indexes are used to select proper line pointer.
+	//SrcLineIndex[0] selects first line under filter window, [1] second, etc...
+	//Indexes are needed because lines are swapped so that only one new line is
+	//read from bitmap when filtering window moves down.
+	//TPtr8 cannot be swapped (operator = copies data). Therefore swapping is
+	//done through indexing.
+	TUint8 SrcLineIndex[3]={0,1,2};
+	
+	//Allocate local memory for destination data.
+	//Descriptor HBufC8 is used.
+	iDstDataBuffer=HBufC8::NewMaxL(LineLength*3);
+	CleanupStack::PushL(iDstDataBuffer);
+	
+	//Set destination line pointer to beginning of allocated memory.
+	//Use descriptor TPtr8 instead of c++ pointer, because
+	//Set- and GetScanline require it.
+	//Set also descriptor length.
+	TPtr8 DstLinePtr((TUint8*)iDstDataBuffer->Des().Ptr(),LineLength*3,LineLength*3);
+	
+	
+	//Get 1st line from source image to 1st line in local memory buffer.
+	LineNo=0;
+	aSrcBmpPtr->GetScanLine(SrcLinePtrs[SrcLineIndex[0]],TPoint(0,LineNo),LineLength,aSrcBmpPtr->DisplayMode());
+	
+	//Get 2nd line from source image to 2nd line in local memory buffer.
+	LineNo=1;
+	aSrcBmpPtr->GetScanLine(SrcLinePtrs[SrcLineIndex[1]],TPoint(0,LineNo),LineLength,aSrcBmpPtr->DisplayMode());
+	
+	// Step through image lines, do not process 1st and last line (3x3 filter mask).
+	for (LineNo=1;LineNo<aSrcBmpPtr->SizeInPixels().iHeight-1;++LineNo)
+	{
+		//Get next line from image to 3rd line of the filtering window
+		aSrcBmpPtr->GetScanLine(SrcLinePtrs[SrcLineIndex[2]],TPoint(0,LineNo+1),LineLength,aSrcBmpPtr->DisplayMode());
+		
+		//Set destination pixel pointer to 2nd pixel of line (1st pixel is not processed (3x3 filter))
+		DstDataPtr=(TUint8*)iDstDataBuffer->Des().Ptr()+3;
+		
+		//Set source pixel pointers to beginnings of lines in filtering window
+		SrcDataPtr[0]=(TUint8*)iSrcDataBuffer->Des().Ptr()+SrcLineIndex[0]*LineLength*3;
+		SrcDataPtr[1]=(TUint8*)iSrcDataBuffer->Des().Ptr()+SrcLineIndex[1]*LineLength*3;
+		SrcDataPtr[2]=(TUint8*)iSrcDataBuffer->Des().Ptr()+SrcLineIndex[2]*LineLength*3;
+		
+		//Copy the first and the last pixels from the original image
+		*(DstDataPtr-3)=*(SrcDataPtr[1]);
+		*(DstDataPtr+1-3)=*(SrcDataPtr[1]+1);
+		*(DstDataPtr+2-3)=*(SrcDataPtr[1]+2);
+		*(DstDataPtr+3*(LineLength-1)-3)=*(SrcDataPtr[1]+3*(LineLength-1));
+		*(DstDataPtr+1+3*(LineLength-1)-3)=*(SrcDataPtr[1]+1+3*(LineLength-1));
+		*(DstDataPtr+2+3*(LineLength-1)-3)=*(SrcDataPtr[1]+2+3*(LineLength-1));
+		
+		//Step through image pixels, do not process 1st and last pixel (3x3 filter).
+		for (x=LineLength-2;x!=0;--x)
+		{
+			
+			//Compute filter output
+			//Get input values from luminance component
+			//.....abc.... o=processed pixel
+			//.....doe.... 
+			//.....fgh.... 
+			//a,b,c,d come from saved previous values
+			//pppppPPPpppp
+			//.....Po..... 
+			//............ 
+			a = *(SrcDataPtr[0]+1);
+			b = *(SrcDataPtr[0]+1+3);
+			c = *(SrcDataPtr[0]+1+6);
+			d = *(SrcDataPtr[1]+1);
+			o = *(SrcDataPtr[1]+1+3);
+			e = *(SrcDataPtr[1]+1+6);
+			f = *(SrcDataPtr[2]+1);
+			g = *(SrcDataPtr[2]+1+3);
+			h = *(SrcDataPtr[2]+1+6);
+			
+			//Sharpen green component with IMAAMI sharpening algorithm
+			out=Peak(a, b, c, d, e, f, g, h, o);
+			
+			//Scale result and limit to available dynamic range.
+			y=Limit255(out);
+			
+			//Get B and R components
+			v=*(SrcDataPtr[1]+3);	//blue
+			u=*(SrcDataPtr[1]+2+3);	//red
+			
+			//Compute difference in green component due to sharpening and add it to B and R 
+			v=Limit255(v+(out-o));			//blue
+			u=Limit255(u+(out-o));			//red
+			
+			//Set destination color components
+			*DstDataPtr=(TUint8)v ;		//blue
+			*(DstDataPtr+1)=(TUint8)y;  //green
+			*(DstDataPtr+2)=(TUint8)u;	//red	
+			
+			//Move to next VUY/RGB triplet in line
+			DstDataPtr+=3;
+			SrcDataPtr[0]+=3;
+			SrcDataPtr[1]+=3;
+			SrcDataPtr[2]+=3;
+		}
+		
+		//Set processed line
+		aSrcBmpPtr->SetScanLine(DstLinePtr,LineNo);
+		
+		//Swap source line indexes: 0<-1<-2<-0.
+		//Now [0] is indexing the previous [1] data, [1] previous [2], etc...
+		//When filtering window is moved down the new line is read to index [2],
+		//so previous [0] data (i.e. 1st line in filtering window) is discarded.
+		TmpLineIdx=SrcLineIndex[0];
+		SrcLineIndex[0]=SrcLineIndex[1];
+		SrcLineIndex[1]=SrcLineIndex[2];
+		SrcLineIndex[2]=TmpLineIdx;
+	}
+	
+	//Free memory
+	CleanupStack::PopAndDestroy(2); //free iSrcDataBuffer and iDstDataBuffer
+} 
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  Peak
+	
+  IMAAMI sharpening function
+	  
+  Return Values:  TInt pixel sharpening data
+		
+-----------------------------------------------------------------------------
+*/
+TInt DCSharpening::Peak(TInt aA, TInt aB, TInt aC, TInt aD, TInt aE, TInt aF, TInt aG, TInt aH, TInt aO)
+{
+	TInt out, tmp;
+	TInt lim  = 0;
+	TInt sign = 1;
+	TInt over = (iParameters.SHARP_OVER << 2);
+	TInt gain = (TInt)(iParameters.SHARP_GAIN * (TReal)(1 << 16) + 0.5);
+	TInt gradHor, gradVer;
+	TInt gradDip, gradDin;
+	TInt max, min;
+	TInt add, weig;
+	TInt tmp1, tmp2;
+	TInt SHARP_LIM2 = ((1 << 15) + (1 << 14));
+
+
+	gradHor = (aO << 1) - aD - aE;
+	gradVer = (aO << 1) - aB - aG;
+	gradDip = ((((aO << 1) - aA - aH) * 3) >> 2);
+	gradDin = ((((aO << 1) - aC - aF) * 3) >> 2);
+
+	findMinMax4(gradHor, gradVer, gradDip, gradDin, &min, &max);
+
+	if(min < 0)
+	{
+		tmp = -min;
+
+		if(tmp > max)
+		{
+			sign = -1;
+			lim  = tmp;
+			tmp2 = tmp;
+			if(max < 0) tmp1 = -max;
+			else        tmp1 =  max;
+		}
+		else
+		{
+			lim  = max;
+			tmp2 = max;
+			tmp1 = tmp;
+		}
+	}
+	else if(max == 0)
+	{
+		tmp2 = 1;
+		tmp1 = 1;
+	}
+	else
+	{
+		lim  = max;
+		tmp2 = max;
+		tmp1 = min;
+	}
+
+	if((tmp1 << 2) > 3 * tmp2)
+	{
+		out = aO;
+	}
+	else if((tmp1 << 2) < tmp2)
+	{
+		add = sign * ((lim * gain) >> 16);
+		if(lim < (TInt)(iParameters.SHARP_DZONE)) out = aO;
+		else				  out = ADJUST_RANGE_TO_10BITS(aO + add);
+	}
+	else
+	{
+		tmp = (tmp1 << 16) / tmp2;
+		weig = (SHARP_LIM2 - tmp);
+		if(lim < (TInt)(iParameters.SHARP_DZONE)) out = aO;
+		else
+		{
+			add = sign * ((((weig * lim) >> 16) * gain) >> 16);
+			out = ADJUST_RANGE_TO_10BITS(aO + add);
+		}
+	}
+
+	if(sign < 0)
+	{
+		tmp = aO - over;
+
+		if(out < tmp)
+		{
+			lim = -lim;
+
+			if(gradHor == lim)
+			{
+				if(aD < aE)
+				{
+					if(aD < aO)
+					{
+						tmp = aD - over;
+					}
+				}
+				else
+				{
+					if(aE < aO)
+					{
+						tmp = aE - over;
+					}
+				}
+			}
+			else if(gradVer == lim)
+			{
+				if(aB < aG)
+				{
+					if(aB < aO)
+					{
+						tmp = aB - over;
+					}
+				}
+				else
+				{
+					if(aG < aO)
+					{
+						tmp = aG - over;
+					}
+				}
+			}
+			else if(gradDip == lim)
+			{
+				if(aA < aH)
+				{
+					if(aA < aO)
+					{
+						tmp = aA - over;
+					}
+				}
+				else
+				{
+					if(aH < aO)
+					{
+						tmp = aH - over;
+					}
+				}
+			}
+			else
+			{
+				if(aC < aF)
+				{
+					if(aC < aO)
+					{
+						tmp = aC - over;
+					}
+				}
+				else
+				{
+					if(aF < aO)
+					{
+						tmp = aF - over;
+					}
+				}
+			}
+
+			if(out < tmp)
+			{
+				out = tmp;
+			}
+		}
+	}
+	else
+	{
+		tmp = aO + over;
+		if(out > tmp)
+		{
+			if(gradHor == lim)
+			{
+				if(aD > aE)
+				{
+					if(aD > aO)
+					{
+						tmp = aD + over;
+					}
+				}
+				else
+				{
+					if(aE > aO)
+					{
+						tmp = aE + over;
+					}
+				}
+			}
+			else if(gradVer == lim)
+			{
+				if(aB > aG)
+				{
+					if(aB > aO)
+					{
+						tmp = aB + over;
+					}
+				}
+				else
+				{
+					if(aG > aO)
+					{
+						tmp = aG + over;
+					}
+				}
+			}
+			else if(gradDip == lim)
+			{
+				if(aA > aH)
+				{
+					if(aA > aO)
+					{
+						tmp = aA + over;
+					}
+				}
+				else
+				{
+					if(aH > aO)
+					{
+						tmp = aH + over;
+					}
+				}
+			}
+			else
+			{
+				if(aC > aF)
+				{
+					if(aC > aO)
+					{
+						tmp = aC + over;
+					}
+				}
+				else
+				{
+					if(aF > aO)
+					{
+						tmp = aF + over;
+					}
+				}
+			}
+
+			if(out > tmp)
+			{
+				out = tmp;
+			}
+		}
+	}
+
+	return(out);
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  Median3
+	
+  IMAAMI sharpening help function
+	  
+  Return Values:  TInt median of input values
+		
+-----------------------------------------------------------------------------
+*/
+TInt DCSharpening::Median3(TInt aA, TInt aB, TInt aC)
+{
+	if(aA < aB)
+	{
+		if(aA > aC)		 return aA;
+		else if(aB < aC) return aB;
+		else             return aC;
+	}
+	else
+	{
+		if(aA < aC)		 return aA;
+		else if(aB > aC) return aB;
+		else             return aC;
+	}
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  findMinMax4
+	
+  IMAAMI sharpening help function
+
+  Finds minimum and maximum of A,B,C & D. Modifies min & max arguments
+	  
+  Return Values:  None
+		
+-----------------------------------------------------------------------------
+*/
+void DCSharpening::findMinMax4(TInt A, TInt B, TInt C, TInt D, TInt *min, TInt *max)
+{
+	if(A < B)
+	{
+		if(C < D)
+		{
+			if(A < C) *min = A;
+			else      *min = C;
+			if(B > D) *max = B;
+			else      *max = D;
+		}
+		else
+		{
+			if(A < D) *min = A;
+			else      *min = D;
+			if(B > C) *max = B;
+			else      *max = C;
+		}
+	}
+	else
+	{
+		if(C < D)
+		{
+			if(B < C) *min = B;
+			else      *min = C;
+			if(A > D) *max = A;
+			else      *max = D;
+		}
+		else
+		{
+			if(B < D) *min = B;
+			else      *min = D;
+			if(A > C) *max = A;
+			else      *max = C;
+		}
+	}
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  SetParams
+	
+  Set processing parameters
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void DCSharpening::SetParameters(DCSharpeningParams* params)
+{
+	iParameters = *params;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  GetParams
+	
+  Get current processing parameters
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void DCSharpening::GetParameters(DCSharpeningParams* params)
+{
+	*params = iParameters;
+}
+//----IMAAMI----
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/GenManip/src/DisplayChain.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,530 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+//----IMAAMI----
+//*************************************************************************
+//
+//Version 1.00
+//
+//Contains:
+//	CDisplayChain 
+//		Image processing class implementing
+//		display specific image processing:
+//			- Scaling to display size with pan support
+//			- IETD - display specific color contrast enhancement
+//			- Sharpening 
+//			- Display feature compensation by simple color management
+//			- Dithering 
+//			
+//History:
+//	30.10.2003 version 1.00 created using existing IMAAMI algorithms	
+//*************************************************************************
+
+#include <fbs.h>
+#include "DisplayChain.h"
+
+
+/*
+-----------------------------------------------------------------------------
+
+  Constructor
+	
+  Default constructor, initializes member variables to initial values
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+CDisplayChain::CDisplayChain()
+{
+	// This function is intentionally left blank.
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  NewLC
+	
+  Factory function to instantiate the class.
+  This function leaves the class pointer to the cleanup stack
+  May leave with KErrNoMemory if no memory available
+  
+  Return Values:  CDisplayChain* self:  pointer to the class instance
+
+-----------------------------------------------------------------------------
+*/
+CDisplayChain* CDisplayChain::NewLC()
+{
+	CDisplayChain* self = new (ELeave) CDisplayChain();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  NewL
+	
+  Factory function to instantiate the class.
+  May leave with KErrNoMemory if no memory available
+	  
+  Return Values:  CDisplayChain* self:  pointer to the class instance
+	
+-----------------------------------------------------------------------------
+*/
+CDisplayChain* CDisplayChain::NewL()
+{
+	CDisplayChain* self = CDisplayChain::NewLC();
+	CleanupStack::Pop();
+	return self;
+}
+
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  ConstructL
+	
+  Second phase constructor. Does nothing at the moment
+	  
+  Return Values:  none
+		
+ -----------------------------------------------------------------------------
+*/
+void CDisplayChain::ConstructL()
+{
+	// Create objects for ImaamiImageChain
+	DigitalZoomPtr = CDCDigitalZoom::NewL();
+	CleanupStack::PushL(DigitalZoomPtr);
+
+	SharpeningPtr = DCSharpening::NewL();
+	CleanupStack::PushL(SharpeningPtr);
+
+	DitheringPtr = CDCDithering::NewL();
+	CleanupStack::PushL(DitheringPtr);
+
+	IetdPtr = CDCIetd::NewL();
+	CleanupStack::PushL(IetdPtr);
+
+	ColorManagementPtr = CDCColorManagement::NewL();
+	CleanupStack::PushL(ColorManagementPtr);
+
+
+	TInt i; //Index
+
+	//As default image is just opened to be processed
+	Parameters.FirstOpening = ETrue;
+
+	//Get current processing parameters from processing objects
+	DigitalZoomPtr->GetParameters(&Parameters.DZParameters);
+	IetdPtr->GetParams(&Parameters.IETDParameters);
+	SharpeningPtr->GetParameters(&Parameters.SharpeningParameters);
+	ColorManagementPtr->GetParameters(&Parameters.ColorManagementParameters);
+
+	//Here the parameters can be read for example from a text file or from the registers, etc.
+	//if (!ReadFileL())
+	{			
+		//Set default parameter values
+		//(Defined in DCInit.h)
+		//----------------------------
+		
+		//Set each processing ON/OFF
+		Parameters.DigitalZoomON = DZ;
+		Parameters.DitheringON = DITHER;
+		Parameters.ColorManagementON = ETrue; //CM;
+		Parameters.IetdON = IETD;
+		Parameters.SharpeningON = SHARP;
+		
+		//DigitalZoom
+		DigitalZoomPtr->GetParameters(&Parameters.DZParameters);
+		Parameters.DZParameters.sizeX = DZsizeX;
+		Parameters.DZParameters.sizeY = DZsizeY;
+		Parameters.DZParameters.scaleX = DZscaleX;
+		Parameters.DZParameters.scaleY = DZscaleY;
+		Parameters.DZParameters.allShiftX = DZallX;
+		Parameters.DZParameters.allShiftY = DZallY;
+		Parameters.DZParameters.newShiftX = DZnewX;
+		Parameters.DZParameters.newShiftY = DZnewY;
+		
+		//IETD
+		Parameters.IETDParameters.aStretchLimit = StretchLimit;
+		Parameters.IETDParameters.aBlackPixels = BlackPixels;
+		Parameters.IETDParameters.aWhitePixels = WhitePixels;
+		Parameters.IETDParameters.aSaturationGain = SaturationGain;
+		Parameters.IETDParameters.aBitLimit = BitLimit;
+		Parameters.IETDParameters.aWBC = WBC;
+		Parameters.IETDParameters.aDBC = DBC;
+		
+		//Sharpening
+		Parameters.SharpeningParameters.SHARP_GAIN = SharpGain;
+		Parameters.SharpeningParameters.SHARP_DZONE = SharpDZone;
+		Parameters.SharpeningParameters.SHARP_OVER = SharpOver;
+		
+		//Color Management (fill LUTs and matrix)
+		for(i=0;i<256;i++)
+		{
+			Parameters.ColorManagementParameters.GammaR[i] = CMGammaR[i];
+		}
+		
+		for(i=0;i<256;i++)
+		{
+			Parameters.ColorManagementParameters.GammaG[i] = CMGammaG[i];
+		}
+		
+		for(i=0;i<256;i++)
+		{
+			Parameters.ColorManagementParameters.GammaB[i] = CMGammaB[i];
+		}
+		
+		for(i=0;i<256;i++)
+		{
+			Parameters.ColorManagementParameters.TRCR[i] = CMTRCR[i];
+		}
+		
+		for(i=0;i<256;i++)
+		{
+			Parameters.ColorManagementParameters.TRCG[i] = CMTRCG[i];
+		}
+		
+		for(i=0;i<256;i++)
+		{
+			Parameters.ColorManagementParameters.TRCB[i] = CMTRCB[i];
+		}
+
+		for(i=0;i<9;i++)
+		{
+			Parameters.ColorManagementParameters.Matrix[i] = CMMatrix[i];
+		}
+		
+	}
+
+	//Set the default parameters
+	IetdPtr->SetParams(&Parameters.IETDParameters);
+	SharpeningPtr->SetParameters(&Parameters.SharpeningParameters);
+	ColorManagementPtr->SetParameters(&Parameters.ColorManagementParameters);
+
+	CleanupStack::Pop(5); //Processing objects
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  CDCIetd
+  
+  Destructor
+	
+  Deletes the allocated memory
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+CDisplayChain::~CDisplayChain()
+{
+	//Delete processing objects
+	delete DigitalZoomPtr;
+	delete SharpeningPtr;
+	delete DitheringPtr;
+	delete IetdPtr;
+	delete ColorManagementPtr;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  ProcessL
+	
+  Process image referenced by InBitmap (modify aTargetBitmap).
+  If scaling is not used aTargetBitmap is processed directly.
+ 
+  May leave with KErrNoMemory if no memory available
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDisplayChain::ProcessL(const CFbsBitmap* InBitmap, CFbsBitmap* aTargetBitmap)
+{
+
+	//CHECK! pan check needed only when DZ is ON
+	//Scaling
+	if (Parameters.DigitalZoomON)
+	{
+		// refine the zooming parameters based on input data
+		TSize inSize = InBitmap->SizeInPixels();
+		TSize outSize = aTargetBitmap->SizeInPixels();
+		Parameters.DZParameters.sizeX = outSize.iWidth;
+		Parameters.DZParameters.sizeY = outSize.iHeight;
+		Parameters.DZParameters.scaleX = (TReal)outSize.iWidth/(TReal)inSize.iWidth;
+		Parameters.DZParameters.scaleY = (TReal)outSize.iHeight/(TReal)inSize.iHeight;
+
+		//If the image is tried to pan over the image borders, bound to the borders
+		if (Parameters.DZParameters.allShiftX < (-InBitmap->SizeInPixels().iWidth/2 * Parameters.DZParameters.scaleX + aTargetBitmap->SizeInPixels().iWidth/2))
+		{
+			Parameters.DZParameters.allShiftX = (TInt)((-InBitmap->SizeInPixels().iWidth/2)*Parameters.DZParameters.scaleX + aTargetBitmap->SizeInPixels().iWidth/2);
+		}
+		
+		if (Parameters.DZParameters.allShiftX > (InBitmap->SizeInPixels().iWidth/2 * Parameters.DZParameters.scaleX - aTargetBitmap->SizeInPixels().iWidth/2))
+		{
+			Parameters.DZParameters.allShiftX = (TInt)((InBitmap->SizeInPixels().iWidth/2)*Parameters.DZParameters.scaleX - aTargetBitmap->SizeInPixels().iWidth/2);
+		}
+		
+		if (Parameters.DZParameters.allShiftY < (-InBitmap->SizeInPixels().iHeight/2 * Parameters.DZParameters.scaleY + aTargetBitmap->SizeInPixels().iHeight/2))
+		{
+			Parameters.DZParameters.allShiftY = (TInt)((-InBitmap->SizeInPixels().iHeight/2)*Parameters.DZParameters.scaleY + aTargetBitmap->SizeInPixels().iHeight/2);
+		}
+		
+		if (Parameters.DZParameters.allShiftY > (InBitmap->SizeInPixels().iHeight/2 * Parameters.DZParameters.scaleY - aTargetBitmap->SizeInPixels().iHeight/2))
+		{
+			Parameters.DZParameters.allShiftY = (TInt)((InBitmap->SizeInPixels().iHeight/2)*Parameters.DZParameters.scaleY - aTargetBitmap->SizeInPixels().iHeight/2);
+		}
+			
+		DigitalZoomPtr->SetParameters(&Parameters.DZParameters);
+		DigitalZoomPtr->ProcessL(InBitmap, aTargetBitmap);
+	}
+	
+	//IETD 
+	if (Parameters.IetdON)
+	{
+ 		if (Parameters.FirstOpening)
+		{
+			IetdPtr->Analyze(*aTargetBitmap);
+			Parameters.FirstOpening = EFalse;
+		}
+		//Set parameters is needed if default values can change (read from file etc.)
+		//IetdPtr->SetParams(&Parameters.IETDParameters);
+		IetdPtr->ProcessL(*aTargetBitmap);
+	}
+	
+	//Sharpening
+	if (Parameters.SharpeningON)
+	{
+		//Set parameters is needed if default values can change (read from file etc.)
+		//SharpeningPtr->SetParameters(&Parameters.SharpeningParameters);
+		SharpeningPtr->ProcessL(aTargetBitmap);
+	}
+	
+	//ColorManagement
+	if (Parameters.ColorManagementON)
+	{
+		//Set parameters is needed if default values can change (read from file etc.)
+		//ColorManagementPtr->SetParameters(&Parameters.ColorManagementParameters);
+		ColorManagementPtr->ProcessL(aTargetBitmap);
+	}
+
+	//Dithering
+	if (Parameters.DitheringON)
+	{
+		DitheringPtr->ProcessL(*aTargetBitmap);
+	}
+}
+
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  SetParams
+	
+  Set processing parameters
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDisplayChain::SetParameters(DisplayChainParams* params)
+{
+	//Copy parameter struct
+	Parameters = *params;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+  GetParams
+	
+  Get current processing parameters
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+*/
+void CDisplayChain::GetParameters(DisplayChainParams* params)
+{
+	//Copy parameter struct
+	*params = Parameters;
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+  ReadFileL
+	
+  Example function for reading processing parameters from file
+	  
+  Return Values:  none
+		
+-----------------------------------------------------------------------------
+TBool CDisplayChain::ReadFileL()
+{
+	
+	FILE *fp;
+	TInt i,j,data;
+	TUint8 data_uchar;
+	TReal data_real;
+	
+	// Open for read (will fail if file does not exist) 
+	if((fp = fopen("e:\\DisplayChain.txt","r"))==NULL )
+	{
+		if((fp = fopen("c:\\DisplayChain.txt","r"))==NULL )
+		{
+			//AfxMessageBox("CMData.txt was not opened");
+			return EFalse;
+		}
+	}
+	
+	//Digital Zoom
+	fscanf(fp,"%d",&data);
+	Parameters.DigitalZoomON = data;
+
+	//Ietd
+	fscanf(fp,"%d",&data);
+	Parameters.IetdON = data;
+	
+	fscanf(fp,"%d",&data_uchar);
+	Parameters.IETDParameters.aWhitePixels = data_uchar;
+	
+	fscanf(fp,"%d",&data_uchar);
+	Parameters.IETDParameters.aBlackPixels = data_uchar;
+	
+	fscanf(fp,"%d",&data_uchar);
+	Parameters.IETDParameters.aStretchLimit = data_uchar;
+	
+	fscanf(fp,"%d",&data_uchar);
+	Parameters.IETDParameters.aSaturationGain = data_uchar;
+
+	fscanf(fp,"%d",&data_uchar);
+	Parameters.IETDParameters.aBitLimit = data_uchar;
+
+	fscanf(fp,"%d",&data_uchar);
+	Parameters.IETDParameters.aWBC = data_uchar;
+
+	fscanf(fp,"%d",&data_uchar);
+	Parameters.IETDParameters.aDBC = data_uchar;
+	
+	//Sharpening
+	fscanf(fp,"%d",&data);
+	Parameters.SharpeningON = data;
+	
+	fscanf(fp,"%d",&data);
+	Parameters.SharpeningParameters.SHARP_OVER = data;
+	
+	fscanf(fp,"%d",&data);
+	Parameters.SharpeningParameters.SHARP_DZONE = data;
+	
+	//fscanf(fp,"%f",&data_real);
+	fscanf(fp,"%d",&data);
+	data_real = ((TReal)data)/65536;
+	Parameters.SharpeningParameters.SHARP_GAIN = data_real;
+
+	//Dithering
+	fscanf(fp,"%d",&data);
+	Parameters.DitheringON = data;
+
+	//ColorManagement
+	fscanf(fp,"%d",&data);
+	Parameters.ColorManagementON = data;
+	
+	for(i=0;i<256;i++)
+	{
+		fscanf(fp,"%d",&data);
+		Parameters.ColorManagementParameters.GammaR[i]=data;
+	}
+	
+	for(i=0;i<256;i++)
+	{
+		fscanf(fp,"%d",&data);
+		Parameters.ColorManagementParameters.GammaG[i]=data;
+	}
+	
+	for(i=0;i<256;i++)
+	{
+		fscanf(fp,"%d",&data);
+		Parameters.ColorManagementParameters.GammaB[i]=data;
+	}
+	
+	for(i=0;i<256;i++)
+	{
+		fscanf(fp,"%d",&data);
+		Parameters.ColorManagementParameters.TRCR[i]=data;
+	}
+	
+	for(i=0;i<256;i++)
+	{
+		fscanf(fp,"%d",&data);
+		Parameters.ColorManagementParameters.TRCG[i]=data;
+	}
+	
+	for(i=0;i<256;i++)
+	{
+		fscanf(fp,"%d",&data);
+		Parameters.ColorManagementParameters.TRCB[i]=data;
+	}
+	
+	
+	for(i=0;i<3;i++)
+	{
+		for(j=0;j<3;j++)
+		{
+			fscanf(fp,"%d",&data);
+			Parameters.ColorManagementParameters.Matrix [3*i+j]=data;
+		}
+	}
+
+	
+	// Close stream 
+	fclose(fp);
+
+	return ETrue;	
+}
+*/
+//----IMAAMI----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/bwins/VedEngineu.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,22 @@
+EXPORTS
+	??0CVedVideoClipGenerator@@IAE@XZ @ 1 NONAME ; CVedVideoClipGenerator::CVedVideoClipGenerator(void)
+	??1CVedVideoClipGenerator@@UAE@XZ @ 2 NONAME ; CVedVideoClipGenerator::~CVedVideoClipGenerator(void)
+	?CalculateFrameComplexityFactor@CVedVideoClipGenerator@@IBEHPAVCFbsBitmap@@@Z @ 3 NONAME ; int CVedVideoClipGenerator::CalculateFrameComplexityFactor(class CFbsBitmap *) const
+	?IsInserted@CVedVideoClipGenerator@@QBEHXZ @ 4 NONAME ; int CVedVideoClipGenerator::IsInserted(void) const
+	?IsOwnedByVideoClip@CVedVideoClipGenerator@@QBEHXZ @ 5 NONAME ; int CVedVideoClipGenerator::IsOwnedByVideoClip(void) const
+	?Movie@CVedVideoClipGenerator@@QBEPAVCVedMovie@@XZ @ 6 NONAME ; class CVedMovie * CVedVideoClipGenerator::Movie(void) const
+	?NewL@CVedAudioClipInfo@@SAPAV1@ABVTDesC16@@AAVMVedAudioClipInfoObserver@@@Z @ 7 NONAME ; class CVedAudioClipInfo * CVedAudioClipInfo::NewL(class TDesC16 const &, class MVedAudioClipInfoObserver &)
+	?NewL@CVedMovie@@SAPAV1@PAVRFs@@@Z @ 8 NONAME ; class CVedMovie * CVedMovie::NewL(class RFs *)
+	?NewL@CVedVideoClipInfo@@SAPAV1@ABVTDesC16@@AAVMVedVideoClipInfoObserver@@@Z @ 9 NONAME ; class CVedVideoClipInfo * CVedVideoClipInfo::NewL(class TDesC16 const &, class MVedVideoClipInfoObserver &)
+	?NewLC@CVedAudioClipInfo@@SAPAV1@ABVTDesC16@@AAVMVedAudioClipInfoObserver@@@Z @ 10 NONAME ; class CVedAudioClipInfo * CVedAudioClipInfo::NewLC(class TDesC16 const &, class MVedAudioClipInfoObserver &)
+	?NewLC@CVedMovie@@SAPAV1@PAVRFs@@@Z @ 11 NONAME ; class CVedMovie * CVedMovie::NewLC(class RFs *)
+	?NewLC@CVedVideoClipInfo@@SAPAV1@ABVTDesC16@@AAVMVedVideoClipInfoObserver@@@Z @ 12 NONAME ; class CVedVideoClipInfo * CVedVideoClipInfo::NewLC(class TDesC16 const &, class MVedVideoClipInfoObserver &)
+	?ReportDescriptiveNameChanged@CVedVideoClipGenerator@@IBEXXZ @ 13 NONAME ; void CVedVideoClipGenerator::ReportDescriptiveNameChanged(void) const
+	?ReportDurationChanged@CVedVideoClipGenerator@@IBEXXZ @ 14 NONAME ; void CVedVideoClipGenerator::ReportDurationChanged(void) const
+	?ReportSettingsChanged@CVedVideoClipGenerator@@IBEXXZ @ 15 NONAME ; void CVedVideoClipGenerator::ReportSettingsChanged(void) const
+	?VideoClipIndex@CVedVideoClipGenerator@@QBEHXZ @ 16 NONAME ; int CVedVideoClipGenerator::VideoClipIndex(void) const
+	?NewL@CVedAudioClipInfo@@SAPAV1@PAVRFile@@AAVMVedAudioClipInfoObserver@@@Z @ 17 NONAME ; class CVedAudioClipInfo * CVedAudioClipInfo::NewL(class RFile *, class MVedAudioClipInfoObserver &)
+	?NewL@CVedVideoClipInfo@@SAPAV1@PAVRFile@@AAVMVedVideoClipInfoObserver@@@Z @ 18 NONAME ; class CVedVideoClipInfo * CVedVideoClipInfo::NewL(class RFile *, class MVedVideoClipInfoObserver &)
+	?NewLC@CVedAudioClipInfo@@SAPAV1@PAVRFile@@AAVMVedAudioClipInfoObserver@@@Z @ 19 NONAME ; class CVedAudioClipInfo * CVedAudioClipInfo::NewLC(class RFile *, class MVedAudioClipInfoObserver &)
+	?NewLC@CVedVideoClipInfo@@SAPAV1@PAVRFile@@AAVMVedVideoClipInfoObserver@@@Z @ 20 NONAME ; class CVedVideoClipInfo * CVedVideoClipInfo::NewLC(class RFile *, class MVedVideoClipInfoObserver &)
+
Binary file videoeditorengine/vedengine/cenrep/videoeditorengine_cenrep_keys.xls has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/eabi/VedEngineu.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,26 @@
+EXPORTS
+	_ZN17CVedAudioClipInfo4NewLERK7TDesC16R25MVedAudioClipInfoObserver @ 1 NONAME
+	_ZN17CVedAudioClipInfo5NewLCERK7TDesC16R25MVedAudioClipInfoObserver @ 2 NONAME
+	_ZN17CVedVideoClipInfo4NewLERK7TDesC16R25MVedVideoClipInfoObserver @ 3 NONAME
+	_ZN17CVedVideoClipInfo5NewLCERK7TDesC16R25MVedVideoClipInfoObserver @ 4 NONAME
+	_ZN22CVedVideoClipGeneratorC2Ev @ 5 NONAME
+	_ZN22CVedVideoClipGeneratorD0Ev @ 6 NONAME
+	_ZN22CVedVideoClipGeneratorD1Ev @ 7 NONAME
+	_ZN22CVedVideoClipGeneratorD2Ev @ 8 NONAME
+	_ZN9CVedMovie4NewLEP3RFs @ 9 NONAME
+	_ZN9CVedMovie5NewLCEP3RFs @ 10 NONAME
+	_ZNK22CVedVideoClipGenerator10IsInsertedEv @ 11 NONAME
+	_ZNK22CVedVideoClipGenerator14VideoClipIndexEv @ 12 NONAME
+	_ZNK22CVedVideoClipGenerator18IsOwnedByVideoClipEv @ 13 NONAME
+	_ZNK22CVedVideoClipGenerator21ReportDurationChangedEv @ 14 NONAME
+	_ZNK22CVedVideoClipGenerator21ReportSettingsChangedEv @ 15 NONAME
+	_ZNK22CVedVideoClipGenerator28ReportDescriptiveNameChangedEv @ 16 NONAME
+	_ZNK22CVedVideoClipGenerator30CalculateFrameComplexityFactorEP10CFbsBitmap @ 17 NONAME
+	_ZNK22CVedVideoClipGenerator5MovieEv @ 18 NONAME
+	_ZTI22CVedVideoClipGenerator @ 19 NONAME ; #<TI>#
+	_ZTV22CVedVideoClipGenerator @ 20 NONAME ; #<VT>#
+	_ZN17CVedAudioClipInfo4NewLEP5RFileR25MVedAudioClipInfoObserver @ 21 NONAME
+	_ZN17CVedAudioClipInfo5NewLCEP5RFileR25MVedAudioClipInfoObserver @ 22 NONAME
+	_ZN17CVedVideoClipInfo4NewLEP5RFileR25MVedVideoClipInfoObserver @ 23 NONAME
+	_ZN17CVedVideoClipInfo5NewLCEP5RFileR25MVedVideoClipInfoObserver @ 24 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/group/VedEngine.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+
+NOEXPORTLIBRARY
+
+TARGET          VedEngine.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10204bf4
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+MACRO VIDEOEDITORENGINE_AVC_EDITING
+#define VIDEOEDITORENGINE_AVC_EDITING
+
+MACRO     __VIDEOEDIT__ 
+#define 	__VIDEOEDIT__
+
+SOURCEPATH      ../src
+SOURCE          VedVideoClipInfoImp.cpp
+SOURCE          VedAudioClipInfoImp.cpp
+SOURCE          VedMovieImp.cpp
+SOURCE          VedVideoClip.cpp
+SOURCE          VedVideoClipGenerator.cpp
+SOURCE          VedVideoClipInfoGeneratedImp.cpp
+SOURCE          vedcodecchecker.cpp
+SOURCE          vedqualitysettingsapi.cpp
+
+SOURCEPATH      ../VideoProcessor/Src
+SOURCE          movieprocessor.cpp
+SOURCE          movieprocessorimpl.cpp
+SOURCE          audioprocessor.cpp
+SOURCE          videoprocessor.cpp
+SOURCE          activequeue.cpp
+SOURCE          statusmonitor.cpp
+SOURCE          mp4demux.cpp
+SOURCE          mp4parser.cpp
+SOURCE          mp4composer.cpp 
+SOURCE          yuv2rgb12.cpp
+SOURCE          yuv2rgb16.cpp
+SOURCE          yuv2rgb24.cpp
+SOURCE          dataprocessor.cpp
+SOURCE          VedRgb2YuvConverter.cpp
+SOURCE          mpeg4timer.cpp
+SOURCE          VideoEncoderMDF.cpp
+SOURCE          SizeEstimate.cpp
+
+SOURCEPATH      ../GenManip/src
+SOURCE          DCColorManagement.cpp
+SOURCE          DCDigitalZoom.cpp
+SOURCE          DCDithering.cpp
+SOURCE          DCIetd.cpp
+SOURCE          DCSharpening.cpp
+SOURCE          DisplayChain.cpp
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE   /epoc32/include/libc 
+
+USERINCLUDE     ../../../videoeditor_plat/video_editor_engine_api/inc
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../VideoProcessor/inc
+USERINCLUDE     ../GenManip/inc
+
+USERINCLUDE     ../../H263Decoder/inc
+USERINCLUDE     ../../vedtranscoder/inc
+USERINCLUDE     ../../AudioEditorEngine/inc
+USERINCLUDE     ../../avcedit/inc
+
+LIBRARY         euser.lib efsrv.lib
+LIBRARY         fbscli.lib
+LIBRARY		      gdi.lib
+
+LIBRARY         3GPMP4Lib.lib
+LIBRARY         ImagingConfigManager.lib
+LIBRARY         ecom.lib
+
+LIBRARY         vedh263d.lib
+LIBRARY         vedtranscoder.lib
+LIBRARY         aedengine.lib
+
+LIBRARY         vedavcedit.lib
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/group/VedEngineLib.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+TARGET          VedEngine.lib
+TARGETTYPE      IMPLIB
+UID             0x1000008d 0x10204bf4
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+VedEngine.mmp
+VedEngineLib.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/VedAudioClipInfoImp.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,253 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __VEDAUDIOCLIPINFOIMP_H__
+#define __VEDAUDIOCLIPINFOIMP_H__
+
+
+#include <e32base.h>
+#include "VedCommon.h"
+#include "VedAudioClipInfo.h"
+
+#include "AudClip.h"
+#include "AudObservers.h"
+
+/*
+ *  Forward declarations.
+ */
+class CVedAudioClipInfo;
+class CVedAudioClipInfoOperation;
+
+/**
+ * Utility class for getting information about audio clip files.
+ *
+ */
+class CVedAudioClipInfoImp : public CVedAudioClipInfo, public MAudClipInfoObserver,
+                             public MAudVisualizationObserver
+    {
+public:
+    /* Constuctor */
+    CVedAudioClipInfoImp();
+
+    /* Symbian two phased constructor. */
+    void ConstructL(const TDesC& aFileName,
+                    MVedAudioClipInfoObserver& aObserver);
+                    
+    /* Symbian two phased constructor. */
+    void ConstructL(RFile* aFileHandle,
+                    MVedAudioClipInfoObserver& aObserver);
+
+    /* Two-phased constructor variant for use within a movie. */
+    void ConstructL(CAudClip* aAudClip,
+                    MVedAudioClipInfoObserver& aObserver);
+
+    /**
+     * Destroys the object and releases all resources.
+     */    
+    ~CVedAudioClipInfoImp();
+
+
+    /* Property methods. */
+
+    /**
+     * Returns the file name of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  file name
+     */
+    TPtrC FileName() const;
+
+    /**
+     * Returns the audio format of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  audio format of the clip
+     */
+    TVedAudioFormat Format() const;
+
+    /**
+     * Returns the audio type of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  audio type
+     */
+    TVedAudioType Type() const;
+
+    /**
+     * Returns the duration of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  duration in microseconds
+     */
+    TTimeIntervalMicroSeconds Duration() const;
+
+    /**
+     * Returns the channel mode of the audio if applicable.
+     *
+     * @return  channel mode
+     */
+    TVedAudioChannelMode ChannelMode() const;
+
+    /**
+     * Returns the sampling rate.
+     *
+     * @return  sampling rate in hertz
+     */
+    TInt SamplingRate() const;
+
+    /**
+     * Returns the bitrate mode.
+     *
+     * @return  bitrate mode
+     */
+    TVedBitrateMode BitrateMode() const;
+
+    /**
+     * Returns the bitrate.
+     *
+     * @return  bitrate in bits per second
+     */
+    TInt Bitrate() const;
+
+
+    /**
+     * Comparison method for sorting arrays of audio clip infos.
+     *
+     * @param c1  first info to compare
+     * @param c2  second info to compare
+     *
+     * @return 
+     */
+    static TInt Compare(const CVedAudioClipInfoImp& c1, const CVedAudioClipInfoImp& c2);
+
+    /* Visualization methods. */
+
+    /**
+     * Generates a visualization of the audio clip. The visualization consists
+     * of an array of values with the specified resolution. This method is 
+     * asynchronous. The visualization is generated in background and the observer 
+     * is notified when the visualization is complete. This method panics if info 
+     * is not yet ready for reading or the resolution is illegal.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aObserver    observer to be notified when the visualization is completed
+     * @param aResolution  resolution of the visualization (i.e., the number of values
+     *                     in the visualization array)
+     * @param aPriority    priority of the visualization
+     */
+    void GetVisualizationL(MVedAudioClipVisualizationObserver& aObserver,
+                           TInt aResolution, TInt aPriority);
+    
+    /**
+     * Cancels visualization generation. If no visualization is currently being 
+     * generated, the function does nothing.
+     */
+    void CancelVisualizationL();
+    
+
+    /**
+     * Factory constructor for constucting the info without creating an audio clip
+     * info object, using the supplied audio clip pointer instead.This variant is for
+     * use in movie.
+     * 
+     * @param aAudClip   audio clip instance
+     * @param aObserver  observer to notify when clip info is ready
+     */
+    static CVedAudioClipInfoImp* NewL(CAudClip* aAudClip, MVedAudioClipInfoObserver& aObserver);
+
+    /**
+     * Factory constructor for constucting the info without creating an audio clip
+     * info object, using the supplied audio clip pointer instead.This variant is for
+     * use in movie. Leaves the created instance on the cleanup stack.
+     * 
+     * @param aAudClip   audio clip instance
+     * @param aObserver  observer to notify when clip info is ready
+     */
+    static CVedAudioClipInfoImp* NewLC(CAudClip* aAudClip, MVedAudioClipInfoObserver& aObserver);
+    
+    /**
+     * Returns the file handle of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  file name
+     */
+    RFile* FileHandle() const;
+
+private: // Functions from base classes
+
+    /* From base class MAudVisualizationObserver */
+    
+    void NotifyClipInfoVisualizationCompleted(const CAudClipInfo& aClipInfo, 
+        TInt aError, TInt8* aVisualization, TInt aSize);
+    
+    void NotifyClipInfoVisualizationStarted(const CAudClipInfo& aClipInfo, 
+        TInt aError);
+
+    void NotifyClipInfoVisualizationProgressed(const CAudClipInfo& aClipInfo, 
+        TInt aPercentage);
+
+    /* From base class MAudClipInfoObserver */
+    void NotifyClipInfoReady(CAudClipInfo& aInfo, TInt aError);
+
+private:
+
+    // Audio clip info from Audio Engine
+    CAudClipInfo* iAudClipInfo;
+
+    // Audio clip if this clip info is included in a song
+    CAudClip* iAudClip;
+
+    // Operation class
+    CVedAudioClipInfoOperation* iOperation;
+
+    // Audio properties
+    TAudFileProperties iAudioProperties;
+
+    // Whether we are ready to return info.
+    TBool iReady;
+
+    MVedAudioClipInfoObserver* iObserver;
+    
+    // Visualization observer
+    MVedAudioClipVisualizationObserver* iVisualizationObserver;
+    friend class CVedAudioClip;
+    friend class CVedMovieImp;
+    };
+
+class CVedAudioClipInfoOperation : public CActive
+    {
+public:
+    static CVedAudioClipInfoOperation* NewL(CVedAudioClipInfoImp* aInfo, MVedAudioClipInfoObserver& aObserver);
+    ~CVedAudioClipInfoOperation();
+
+protected:
+    TInt RunError(TInt aError);
+    void RunL();
+    void DoCancel();
+    CVedAudioClipInfoOperation(CVedAudioClipInfoImp* aInfo,MVedAudioClipInfoObserver& aObserver);
+    void ConstructL();
+
+private:
+    MVedAudioClipInfoObserver& iObserver;
+    CVedAudioClipInfoImp* iInfo;
+    };
+#endif // __VEDAUDIOCLIPINFOIMP_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/VedMovieImp.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1419 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#ifndef __VEDMOVIEIMP_H__
+#define __VEDMOVIEIMP_H__
+
+
+#include <e32base.h>
+#include <f32file.h>
+#include "VedMovie.h"
+#include "VedVideoClip.h"
+#include "VedAudioClipInfoImp.h"
+#include "AudObservers.h"
+#include "AudCommon.h"
+#include "Vedqualitysettingsapi.h"
+#include "ctrtranscoder.h"
+
+
+#if ( defined (__WINS__) || defined (__WINSCW__) )
+const TInt KVEdMaxFrameRate = 10;
+#else 
+const TInt KVEdMaxFrameRate = 15;
+#endif
+
+
+/*
+ *  Forward declarations.
+ */
+class CMovieProcessor;
+class CVedMovie;
+class CVedMovieImp;
+class CVedMovieAddClipOperation;
+class CVedMovieProcessOperation;
+class CAudSong;
+class CVedCodecChecker;
+
+
+/**
+ * Video movie, which consists of zero or more video clips and zero or more audio clips.
+ *
+ * @see  CVedVideoClip
+ * @see  CVedAudioClip
+ */
+class CVedMovieImp : public CVedMovie, MAudSongObserver, MVedAudioClipInfoObserver
+    {
+public:
+    /* Constructors. */
+
+    CVedMovieImp(RFs *aFs);
+
+    void ConstructL();
+
+    /**
+     * Destroys the object and releases all resources.
+     */
+    ~CVedMovieImp();
+
+
+    /* Property methods. */
+    
+    /**
+     * Returns the quality setting of this movie.
+     *
+     * @return  quality setting of this movie
+     */
+    TVedMovieQuality Quality() const;
+
+    /**
+     * Sets the quality setting of this movie.
+     *
+     * @param aQuality  quality setting
+     */
+    void SetQuality(TVedMovieQuality aQuality);
+
+    /**
+     * Returns the video format of this movie. 
+     * 
+     * @return  video format of this movie
+     */
+    TVedVideoFormat Format() const;
+
+    /**
+     * Returns the video type of this movie. 
+     * 
+     * @return  video type of this movie
+     */
+    TVedVideoType VideoType() const;
+
+    /**
+     * Returns the resolution of this movie. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no clips 
+     * in the movie.
+     * 
+     * @return  resolution of the movie
+     */
+    TSize Resolution() const;
+
+    /**
+     * Returns the recommended maximum framerate of this movie..
+     * <p>
+     * Note that the returned maximum framerate is a recommendation,
+     * not a guarantee. For example, the video clip generators inserted
+     * in this movie should not generate frames at higher framerates 
+     * than the recommendation. The movie may, however, exceed this
+     * recommendation. For example, the framerate may be higher if the 
+     * framerates of some of the video clips are higher than the 
+     * recommendation and it is not possible to transcode them to reduce 
+     * the framerate.
+     *
+     * @return  maximum framerate in frames per second
+     */
+    TInt MaximumFramerate() const;
+
+    /**
+     * Returns the audio type of the movie audio track.
+     * 
+     * @return  audio type of the movie audio track
+     */
+    TVedAudioType AudioType() const;
+
+    /**
+     * Returns the audio sampling rate of the movie audio track.
+     *
+     * @return  audio sampling rate of the movie audio track.
+     */
+    TInt AudioSamplingRate() const;
+
+    /**
+     * Sets the output parameters for the movie. Leaves
+     * with KErrNotSupported if a parameter is illegal,
+     * e.g., target bitrate is too high for the given 
+     * codec. This method overrides the SetQuality method
+     *
+     * Possible leave codes:
+     *  - <code>KErrNotSupported</code> if setting is not valid
+     *
+     * @param Output parameters
+     */
+    virtual void SetOutputParametersL(TVedOutputParameters& aOutputParams);
+
+    /**
+     * Returns the audio channel mode of the movie audio track.
+     * 
+     * @return  audio channel mode of the movie audio track.
+     */
+    TVedAudioChannelMode AudioChannelMode() const;
+    
+    /**
+     * Returns the audio bitrate mode of the movie audio track.
+     *
+     * @return audio bitrate mode
+     */
+    TVedBitrateMode AudioBitrateMode() const;
+
+    /**
+     * Returns the target bitrate of the movie audio track.
+     * 
+     * @return  target bitrate of the movie audio track.
+     */
+    TInt AudioBitrate() const;
+
+    /**
+     * Returns the required bitrate of the movie video track.
+     * If nonzero, indicates real target bitrate => requires transcoding
+     * 
+     * @return  Requested bitrate of the movie video track.
+     */
+    TInt VideoBitrate() const;
+    
+    /**
+     * Returns the "standard" or default bitrate of the movie video track.
+     * If input is something else, no transcoding is needed, but new content 
+     * is encoded using this rate. If there is also requested bitrate, the values 
+     * should be the same. The "standard" does not necessarily mean the bitrate
+     * is from video coding standard, it can be, but it can be also something else,
+     * depending on the product variant.
+     * 
+     * @return  Standard bitrate of the movie video track.
+     */
+    TInt VideoStandardBitrate() const;
+
+    /**
+     * Returns the target framerate of the movie video track.
+     * 
+     * @return  target framerate of the movie video track.
+     */
+    TReal VideoFrameRate() const;
+
+    /**
+     * Returns the total duration of this movie.
+     * 
+     * @return  duration in microseconds
+     */
+    inline TTimeIntervalMicroSeconds Duration() const;
+
+    /**
+     * Returns an estimate of the total size of this movie.
+     * 
+     * @return  size estimate in bytes
+     */
+    TInt GetSizeEstimateL() const;
+
+    /**
+     * Estimates end cutpoint with given target size and start cutpoint for current movie.
+     *
+     * @param aTargetSize  Target filesize for section indicated by aStartTime and aEndTime.
+     * @param aStartTime   Start time for first frame included in cutted section. 
+     * @param aEndTime     On return contains estimated end time with given start time and section target filesize.
+     */
+    void GetDurationEstimateL(TInt aTargetSize, TTimeIntervalMicroSeconds aStartTime, TTimeIntervalMicroSeconds& aEndTime);
+
+    /**
+     * Returns whether movie properties meet MMS compatibility
+     * 
+     * @return  ETrue if MMS compatible, else EFalse
+     */
+    TBool IsMovieMMSCompatible() const;
+
+
+    /* Video clip management methods. */
+
+    /**
+     * Returns the number of video clips in this movie.
+     *
+     * @return  number of video clips
+     */
+    inline TInt VideoClipCount() const;
+
+    /** 
+     * Returns the video clip at the specified index. 
+     * Used by underlying modules and friend classes. Not part of public API.
+     * Panics with code <code>USER-130</code> if the clip index is invalid.
+     *
+     * @param aIndex  index
+     *
+     * @return  clip at the specified index.
+     */ 
+    CVedVideoClip* VideoClip(TInt aIndex) const;
+
+    /** 
+     * Inserts the specified video clip to the specified index in this movie. 
+     * The observers are notified when the clip has been added or adding clip 
+     * has failed. Panics with <code>EMovieAddOperationAlreadyRunning</code> 
+     * if another add video or audio clip operation is already running.
+     * Panics with code <code>USER-130</code> if the clip index is invalid.
+     *
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFileName  file name of the clip to add
+     * @param aIndex     index the clip should be inserted at
+     */
+    void InsertVideoClipL(const TDesC& aFileName, TInt aIndex);
+
+
+    void InsertVideoClipL(CVedVideoClipGenerator& aGenerator, TBool aIsOwnedByVideoClip,
+                          TInt aIndex);
+
+    /** 
+     * Removes the video clip at the specified index from this movie.
+     * Panics with code <code>USER-130</code> if the clip index is invalid.
+     *
+     * @param aIndex  index of the clip to be removed
+     */
+    void RemoveVideoClip(TInt aIndex);
+
+
+    /* Transition effect management methods. */
+
+    /** 
+     * Returns the start transition effect of this movie. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
+     * in the movie.
+     *
+     * @return  start transition effect
+     */ 
+    TVedStartTransitionEffect StartTransitionEffect() const;
+
+    /** 
+     * Sets the start transition effect of this movie. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
+     * in the movie.
+     *
+     * @param aEffect  start transition effect
+     */ 
+    void SetStartTransitionEffect(TVedStartTransitionEffect aEffect);
+
+    /**
+     * Returns the number of middle transition effects in this movie.
+     * Note that this is the same as the number of video clips minus one.
+     *
+     * @return  number of middle transition effects
+     */
+    TInt MiddleTransitionEffectCount() const;
+
+    /** 
+     * Returns the middle transition effect at the specified index. 
+     * Panics with code <code>USER-130</code> if the index is invalid.
+     *
+     * @param aIndex  index
+     *
+     * @return  middle transition effect at the specified index
+     */ 
+    TVedMiddleTransitionEffect MiddleTransitionEffect(TInt aIndex) const;
+
+    /** 
+     * Sets the middle transition effect at the specified index. 
+     * Panics with code <code>USER-130</code> if the index is invalid.
+     *
+     * @param aEffect  middle transition effect
+     * @param aIndex   index
+     */ 
+    void SetMiddleTransitionEffect(TVedMiddleTransitionEffect aEffect, TInt aIndex);
+
+    /** 
+     * Returns the end transition effect of this movie. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
+     * in the movie.
+     *
+     * @return  end transition effect
+     */ 
+    TVedEndTransitionEffect EndTransitionEffect() const;
+
+    /** 
+     * Sets the end transition effect of this movie. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no video clips 
+     * in the movie.
+     *
+     * @param aEffect  end transition effect
+     */ 
+    void SetEndTransitionEffect(TVedEndTransitionEffect aEffect);
+    
+
+    /* Audio clip management methods. */
+
+    /**
+     * Returns the number of audio clips in this movie.
+     *
+     * @return  number of audio clips
+     */
+    TInt AudioClipCount() const;    
+
+    /** 
+     * Adds the specified audio clip to this movie. The observers are notified
+     * when the clip has been added or adding clip has failed. Panics with 
+     * <code>EMovieAddOperationAlreadyRunning</code> if another add video or
+     * audio clip operation is already running.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFileName   file name of the clip to add
+     * @param aStartTime  start time of the clip in movie timebase
+     * @param aCutInTime  cut in time of the clip
+     * @param aCutOutTime cut out time of the clip; or 
+     *                    <code>KVedAudioClipOriginalDuration</code> to specify
+     *                    that the original duration of the clip should be used
+     */
+    void AddAudioClipL(const TDesC& aFileName,
+            TTimeIntervalMicroSeconds aStartTime,
+            TTimeIntervalMicroSeconds aCutInTime,
+            TTimeIntervalMicroSeconds aCutOutTime);
+
+    /** 
+     * Removes the audio clip at the specified index from this movie.
+     * Panics with code <code>USER-130</code> if the clip index is invalid.
+     *
+     * @param aIndex  index of the clip to be removed
+     */
+    void RemoveAudioClip(TInt aIndex);
+    
+    
+    /* Whole movie management methods. */
+    
+    /** 
+     * Removes all video and audio clips and clears all transitions.
+     */
+    void Reset();
+
+
+    /* Processing methods. */
+
+    /**
+     * Starts a video processing operation. This method is asynchronous and 
+     * returns immediately. The processing will happen in the background and
+     * the observer will be notified about the progress of the operation.
+     * Processed data is written into the specified file. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no clips 
+     * in the movie.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *  - <code>KErrAccessDenied</code> if the file access is denied
+     *  - <code>KErrDiskFull</code> if the disk is full
+     *  - <code>KErrWrite</code> if not all data could be written
+     *  - <code>KErrBadName</code> if the filename is bad
+     *  - <code>KErrDirFull</code> if the directory is full
+     * 
+     * @param aObserver  observer to be notified of the processing status
+     * @param aFileName  name of the file to be written
+     */
+    void ProcessL(const TDesC& aFileName,
+                           MVedMovieProcessingObserver& aObserver);
+
+    /**
+     * Cancels the current video processing operation. If there is no 
+     * operation in progress, the function does nothing.
+     */
+    void CancelProcessing();
+
+
+    /* Observer methods. */
+
+    /**
+     * Registers a movie observer. Panics with panic code 
+     * <code>EMovieObserverAlreadyRegistered</code> if the movie observer is 
+     * already registered.
+     *
+     * @param aObserver  observer that will receive the events
+     */
+    void RegisterMovieObserverL(MVedMovieObserver* aObserver);
+
+    /**
+     * Unregisters a movie observer.
+     *
+     * @param aObserver  observer to be unregistered
+     */
+    void UnregisterMovieObserver(MVedMovieObserver* aObserver);
+
+    /* Video Clip Methods */
+    /**
+     * Returns a video clip info object to get detailed information about
+     * the original video clip. Note that the specified editing operations 
+     * (for example, cutting or muting audio) do <em>not</em>
+     * affect the values returned by the info object.
+     * 
+     * @param aIndex  index of video clip in movie
+     * @return  pointer to a video clip info instance
+     */
+    CVedVideoClipInfo* VideoClipInfo(TInt aIndex) const;
+
+    /**
+     * Returns whether this video clip with the specified editing operations 
+     * applied (for example, changing speed or muting) has an audio track or not.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  <code>ETrue</code> if clip has an audio track;
+     *          <code>EFalse</code> otherwise
+     */
+    TBool VideoClipEditedHasAudio(TInt aIndex) const;
+
+    /**
+     * Sets the index of this video clip in the movie. 
+     * Panics with code <code>EVideoClipIllegalIndex</code> 
+     * if the clip index is invalid.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aNewIndex  new index of this clip
+     */
+    void VideoClipSetIndex(TInt aOldIndex, TInt aNewIndex);
+
+    /**
+     * Returns the playback speed of this video clip. Playback speed is
+     * specified as parts per thousand of the normal playback speed. For example.
+     * 1000 means the normal speed, 750 means 75% of the normal speed, and so on.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  playback speed
+     */
+    TInt VideoClipSpeed(TInt aIndex) const;
+
+    /**
+     * Sets the playback speed of this video clip. Playback speed is
+     * specified as parts per thousand of the normal playback speed. For example.
+     * 1000 means the normal speed, 750 means 75% of the normal speed, and so on.
+     * Panics with <code>EVideoClipIllegalSpeed</code> if playback speed is
+     * illegal.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aSpeed  playback speed; must be between 1 and 1000
+     */
+    void VideoClipSetSpeed(TInt aIndex, TInt aSpeed);
+
+    /**
+     * Returns the color effect of this video clip.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  color effect
+     */
+    TVedColorEffect VideoClipColorEffect(TInt aIndex) const;
+    
+    /**
+     * Sets the color effect of this video clip.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aColorEffect  color effect
+     */
+    void VideoClipSetColorEffect(TInt aIndex, TVedColorEffect aColorEffect);
+
+    /**
+     * Returns whether this video clip can be muted or not (that is,
+     * whether the mute setting has any effect). For example, if
+     * this video clip has no audio track, it can never have audio
+     * even if the mute setting is false.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  <code>ETrue</code> if this video clip can be muted;
+     *          <code>EFalse</code> otherwise
+     */
+    TBool VideoClipIsMuteable(TInt aIndex) const;
+
+    /**
+     * Returns whether the audio track of this video clip is muted or not.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  <code>ETrue</code> if the audio track is muted;
+     *          <code>EFalse</code> otherwise
+     */
+    TBool VideoClipIsMuted(TInt aIndex) const;
+
+    /**
+     * Sets whether the audio track of this video clip is muted or not.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aVolume  <code>ETrue</code> to mute the audio track;
+     *                 <code>EFalse</code> not to mute the audio track
+     */
+    void VideoClipSetMuted(TInt aIndex, TBool aMuted);
+
+    /**
+     * Returns whether the audio track of this video clip is normalized or not.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  <code>ETrue</code> if the audio track is normalized;
+     *          <code>EFalse</code> otherwise
+     */
+    TBool VideoClipNormalizing(TInt aIndex) const;
+
+    /**
+     * Sets whether the audio track of this video clip is normalized or not.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aVolume  <code>ETrue</code> to normalize the audio track;
+     *                 <code>EFalse</code> not to normalize the audio track
+     */
+    void VideoClipSetNormalizing(TInt aIndex, TBool aNormalizing);
+
+    /**
+     * Inserts a new dynamic level mark to the video clip. The mark timing
+     * must be within the time boundaries of the video clip.
+     *
+     * @param aIndex  index of the video clip
+     * @param aMark   dynamic level mark to be inserted
+     */
+    void VideoClipInsertDynamicLevelMarkL(TInt aIndex, TVedDynamicLevelMark aMark);
+    
+    /**
+     * Removes the specified dynamic level mark from the specified video clip.
+     * The mark index must be between 0 and number of dynamic level marks in the clip.
+     *
+     * @param aClipIndex  index of the video clip
+     * @param aMarkIndex  index of the mark to be removed
+     */
+    void VideoClipRemoveDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex);
+
+    /**
+     * Returns the number of dynamic level marks in the specified video clip.
+     * 
+     * @param aIndex  index of the video clip
+     */
+    TInt VideoClipDynamicLevelMarkCount(TInt aIndex) const;
+
+    /**
+     * Returns the specified dynamic level mark from the specified video clip.
+     * 
+     * @param aClipIndex  index of the video clip
+     * @param aMarkIndex  index of the dynamic level mark
+     */    
+    TVedDynamicLevelMark VideoClipDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex);
+
+    /**
+     * Returns the cut in time of this video clip in clip timebase.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  cut in time in microseconds in clip timebase
+     */
+    TTimeIntervalMicroSeconds VideoClipCutInTime(TInt aIndex) const;
+
+    /**
+     * Sets the cut in time of this video clip in clip timebase.
+     * Panics with <code>EVideoClipIllegalCutInTime</code> if
+     * cut in time is illegal.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aCutInTime  cut in time in microseconds in clip timebase
+     */
+    void VideoClipSetCutInTime(TInt aIndex, TTimeIntervalMicroSeconds aCutInTime);
+
+    /**
+     * Returns the cut out time of this video clip in clip timebase.
+     *
+     * @return  cut out time in microseconds in clip timebase
+     */
+    TTimeIntervalMicroSeconds VideoClipCutOutTime(TInt aIndex) const;
+
+    /**
+     * Sets the cut out time of this video clip in clip timebase. 
+     * Panics with <code>EVideoClipIllegalCutOutTime</code> if
+     * cut out time is illegal.
+     *
+     * @param aIndex  index of video clip in movie
+     * @param aCutOutTime  cut out time in microseconds in clip timebase
+     */
+    void VideoClipSetCutOutTime(TInt aIndex, TTimeIntervalMicroSeconds aCutOutTime);
+
+    /**
+     * Returns the start time of this video clip in movie timebase.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  start time in microseconds in movie timebase
+     */
+    TTimeIntervalMicroSeconds VideoClipStartTime(TInt aIndex) const;
+
+    /**
+     * Returns the end time of this video clip in movie timebase.
+     *
+     * @param aIndex  index of video clip in movie
+     * @return  end time in microseconds in movie timebase
+     */
+    TTimeIntervalMicroSeconds VideoClipEndTime(TInt aIndex) const;
+
+    /**
+     * Returns the duration of this video clip with the specified
+     * editing operations applied (for example, cutting 
+     * and changing speed)
+     * 
+     * @param aIndex  index of video clip in movie
+     * @return  duration in microseconds
+     */
+    TTimeIntervalMicroSeconds VideoClipEditedDuration(TInt aIndex) const;
+
+    /* Audio Clip Methods */
+    /**
+     * Returns an audio clip info object to get detailed information about
+     * the original audio clip. Note that the specified editing operations 
+     * (for example, changing duration) do <em>not</em>
+     * affect the values returned by the info object.
+     * 
+     * @param aIndex  index of audio clip in movie
+     * @return  pointer to an audio clip info instance
+     */
+    CVedAudioClipInfo* AudioClipInfo(TInt aIndex) const;
+
+    /**
+     * Returns the start time of this audio clip in movie timebase.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @return  start time in microseconds in movie timebase
+     */
+    TTimeIntervalMicroSeconds AudioClipStartTime(TInt aIndex) const;
+
+    /**
+     * Sets the start time of this audio clip in movie timebase. 
+     * Also updates the end time. Duration remains unchanged.
+     * Note that since the audio clips are ordered based on their
+     * start times, the index of the clip may change as a result
+     * of changing the start time.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @param aStartTime  start time in microseconds in movie timebase
+     */
+    void AudioClipSetStartTime(TInt aIndex, TTimeIntervalMicroSeconds aStartTime);
+
+    /**
+     * Returns the end time of this audio clip in movie timebase.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @return  end time in microseconds in movie timebase
+     */
+    TTimeIntervalMicroSeconds AudioClipEndTime(TInt aIndex) const;
+
+    /**
+     * Returns the duration of the selected part of this clip.
+     * 
+     * @param aIndex  index of audio clip in movie
+     * @return  duration in microseconds
+     */
+    TTimeIntervalMicroSeconds AudioClipEditedDuration(TInt aIndex) const;
+
+    /**
+     * Returns the cut in time of this audio clip in clip timebase.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @return  cut in time in microseconds in clip timebase
+     */
+    TTimeIntervalMicroSeconds AudioClipCutInTime(TInt aIndex) const;
+
+    /**
+     * Sets the cut in time of this audio clip in clip timebase.
+     * Panics with <code>EAudioClipIllegalCutInTime</code> if
+     * cut in time is illegal.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @param aCutInTime  cut in time in microseconds in clip timebase
+     */
+    void AudioClipSetCutInTime(TInt aIndex, TTimeIntervalMicroSeconds aCutInTime);
+
+    /**
+     * Returns the cut out time of this audio clip in clip timebase.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @return  cut out time in microseconds in clip timebase
+     */
+    TTimeIntervalMicroSeconds AudioClipCutOutTime(TInt aIndex) const;
+
+    /**
+     * Sets the cut out time of this audio clip in clip timebase.
+     * Panics with <code>EAudioClipIllegalCutOutTime</code> if
+     * cut in time is illegal.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @param aCutOutTime  cut out time in microseconds in clip timebase
+     */
+    void AudioClipSetCutOutTime(TInt aIndex, TTimeIntervalMicroSeconds aCutOutTime);
+
+    /**
+     * Returns whether this audio clip is normalized or not.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @return  <code>ETrue</code> if the audio clip is normalized;
+     *          <code>EFalse</code> otherwise
+     */
+    TBool AudioClipNormalizing(TInt aIndex) const;
+
+    /**
+     * Sets whether this audio clip is normalized or not.
+     *
+     * @param aIndex  index of audio clip in movie
+     * @param aVolume  <code>ETrue</code> to normalize the audio clip;
+     *                 <code>EFalse</code> not to normalize the audio clip
+     */
+    void AudioClipSetNormalizing(TInt aIndex, TBool aNormalizing);
+    
+    /**
+     * Inserts a new dynamic level mark to the audio clip. The mark timing
+     * must be within the time boundaries of the audio clip.
+     *
+     * @param aIndex  index of the audio clip
+     * @param aMark   dynamic level mark to be inserted
+     */
+    void AudioClipInsertDynamicLevelMarkL(TInt aIndex, TVedDynamicLevelMark aMark);
+    
+    /**
+     * Removes the specified dynamic level mark from the specified audio clip.
+     * The mark index must be between 0 and number of dynamic level marks in the clip.
+     *
+     * @param aClipIndex  index of the audio clip
+     * @param aMarkIndex  index of the mark to be removed
+     */
+    void AudioClipRemoveDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex);
+
+    /**
+     * Returns the number of dynamic level marks in the specified audio clip.
+     * 
+     * @param aIndex  index of the audio clip
+     */
+    TInt AudioClipDynamicLevelMarkCount(TInt aIndex) const;
+
+    /**
+     * Returns the specified dynamic level mark from the specified audio clip.
+     * 
+     * @param aClipIndex  index of the audio clip
+     * @param aMarkIndex  index of the dynamic level mark
+     */    
+    TVedDynamicLevelMark AudioClipDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex);
+    
+    /**
+     * Returns the color tone of the specified clip.
+     *
+     * @return color tone
+     */
+    TRgb VideoClipColorTone(TInt aVideoCLipIndex) const;
+    
+    /**
+     * Sets the color tone of the specified clip.
+     *
+     * @param aColorTone  color tone
+     */
+    void VideoClipSetColorTone(TInt aVideoClipIndex, TRgb aColorTone);
+    
+    /**
+     * Returns a pointer to the audio song used as the sound provider for
+     * this movie.
+     * 
+     * @return  song
+     */
+    CAudSong* Song();
+    
+    /**
+     * Sets the maximum size for the movie
+     * 
+     * @param aLimit Maximum size in bytes
+     */
+    virtual void SetMovieSizeLimit(TInt aLimit);
+    
+    /**
+     * Returns an estimate for total processing time
+     * 
+     * @return processing time
+     */
+    TTimeIntervalMicroSeconds GetProcessingTimeEstimateL();
+    
+    /**
+     * Returns the MIME-type for the video in the movie
+     * 
+     * @return Video codec MIME-type
+     */
+    TPtrC8& VideoCodecMimeType();
+    /**
+    * Gets the sync interval in picture (H.263 GOB frequency)
+    * 
+    * @return sync interval 
+    */
+    TInt SyncIntervalInPicture();
+    
+    /**
+    * Gets the random access rate
+    * 
+    * @return random access rate in pictures per second
+    */
+    TReal RandomAccessRate();
+    
+    /**
+     * Checks if a movie observer is registered.
+     *
+     * @param aObserver observer to be checked
+     * @return <code>ETrue</code> if the observer is registered
+     *         <code>EFalse</code> otherwise
+     */
+    TBool MovieObserverIsRegistered(MVedMovieObserver* aObserver);
+
+    /**
+    * Set volume gain for the given video clip or all the video clips
+    * @param aClipIndex    index of the clip; KVedClipIndexAll if applied for all the clips
+    * @param aVolumeGain   Volume gain in +0.1 or -0.5 decibel steps
+    * 
+    */
+    void SetVideoClipVolumeGainL(TInt aClipIndex, TInt aVolumeGain);
+
+    /**
+    * Get volume gain of the given video clip or all the video clips
+    * @param aClipIndex    index of the clip; KVedClipIndexAll if applied for all the clips
+    *
+    * @return Volume gain in +0.1 or -0.5 decibel steps
+    */
+    TInt GetVideoClipVolumeGainL(TInt aClipIndex);
+
+    /**
+    * Set volume gain for the given audio clip or all the audio clips
+    * @param aClipIndex    index of the clip; KVedClipIndexAll if applied for all the clips
+    * @param aVolumeGain   Volume gain in +0.1 or -0.5 decibel steps 
+    * 
+    */
+    void SetAudioClipVolumeGainL(TInt aClipIndex, TInt aVolumeGain);
+
+    /**
+    * Get volume gain of the given audio clip or all the audio clips
+    * @param aClipIndex    index of the clip; KVedClipIndexAll if applied for all the clips
+    *
+    * @return Volume gain in +0.1 or -0.5 decibel steps
+    */
+    TInt GetAudioClipVolumeGainL(TInt aClipIndex);
+    
+    /** 
+     * Inserts a video clip from the specified file to the specified index 
+     * in this movie. The observers are notified when the clip has been added 
+     * or adding clip has failed. Panics with <code>EMovieAddOperationAlreadyRunning</code> 
+     * if another add video or audio clip operation is already running.
+     * Panics with code <code>USER-130</code> if the clip index is invalid.
+     * The file will be opened in EFileShareReadersOnly mode by default, 
+     * and the same mode should be used by the client too if it need to open
+     * the file at the same time.
+     *  
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFileHandle  file handle of the clip to add
+     * @param aIndex     index the clip should be inserted at
+     */    
+    void InsertVideoClipL(RFile* aFileHandle, TInt aIndex);
+    
+    /** 
+     * Adds the specified audio clip to this movie. The observers are notified
+     * when the clip has been added or adding clip has failed. Panics with 
+     * <code>EMovieAddOperationAlreadyRunning</code> if another add video or
+     * audio clip operation is already running.
+     * The file will be opened in EFileShareReadersOnly mode by default, 
+     * and the same mode should be used by the client too if it need to open
+     * the file at the same time.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param aFilehandle   file handle of the clip to add
+     * @param aStartTime  start time of the clip in movie timebase
+     * @param aCutInTime  cut in time of the clip
+     * @param aCutOutTime cut out time of the clip; or 
+     *                    <code>KVedAudioClipOriginalDuration</code> to specify
+     *                    that the original duration of the clip should be used
+     */    
+    void AddAudioClipL(RFile* aFileHandle,
+            TTimeIntervalMicroSeconds aStartTime,
+            TTimeIntervalMicroSeconds aCutInTime = TTimeIntervalMicroSeconds(0),
+            TTimeIntervalMicroSeconds aCutOutTime = KVedAudioClipOriginalDuration);
+    
+     
+    /**
+     * Starts a video processing operation. This method is asynchronous and 
+     * returns immediately. The processing will happen in the background and
+     * the observer will be notified about the progress of the operation.
+     * Processed data is written into the specified file. Panics with 
+     * <code>TVedPanic::EMovieEmpty</code> if there are no clips 
+     * in the movie. Note that calling <code>ProcessL</code> may cause
+     * changes in the maximum frame rates of generated clips.
+     * 
+     * Possible leave codes:
+     *  - <code>KErrNoMemory</code> if memory allocation fails
+     *  - <code>KErrAccessDenied</code> if the file access is denied
+     *  - <code>KErrDiskFull</code> if the disk is full
+     *  - <code>KErrWrite</code> if not all data could be written
+     *  - <code>KErrBadName</code> if the filename is bad
+     *  - <code>KErrDirFull</code> if the directory is full
+     * 
+     * @param aObserver  observer to be notified of the processing status
+     * @param aFileHandle  handle of the file to be written
+     */
+    void ProcessL(RFile* aFileHandle,
+                           MVedMovieProcessingObserver& aObserver);
+
+private:
+    /* Movie editing methods. */
+
+    /**
+     * Match the selected audio properties with input. This is used with automatic
+     * quality to avoid useless transcoding of audio. 
+     */
+    TBool MatchAudioPropertiesWithInput( TAudFileProperties& aAudioProperties );
+
+    /**
+     * Calculates the format, video type, resolution and audio type of 
+     * this movie. 
+     */
+    void CalculatePropertiesL();
+
+    /**
+     * Determines the output format based on input and sets up the movie accordingly
+     */
+    void ApplyAutomaticPropertiesL(TAudFileProperties &aAudioProperties);
+    
+    /**
+     * Sets up the movie according to requested properties
+     */
+    void ApplyRequestedPropertiesL(TAudFileProperties &aAudioProperties);
+    
+    /**
+     * Get properties for QCIF/subQCIF from quality set and sets up video
+     */
+    TInt GetQCIFPropertiesL(SVideoQualitySet& aLocalQualitySet);
+    
+    /**
+     * Get properties for CIF/QVGA from quality set and sets up video
+     */
+    TInt GetCIFQVGAPropertiesL(TSize aSize, TReal aFrameRate, SVideoQualitySet& aLocalQualitySet);
+    
+    /**
+     * Get properties for VGA from quality set and sets up video
+     */
+    TInt GetVGAPropertiesL(SVideoQualitySet& aLocalQualitySet);
+    
+    /**
+     * Get properties for VGA 16:9 from quality set and sets up video
+     */
+    TInt GetVGA16By9PropertiesL(SVideoQualitySet& aLocalQualitySet);
+    
+    /**
+    * Get properties for VGA from quality set and sets up video
+    */
+    TInt GetWVGAPropertiesL(SVideoQualitySet& aLocalQualitySet);
+    
+    /**
+     * Get properties for high quality from quality set
+     */
+    TInt GetHighPropertiesL(SVideoQualitySet& aLocalQualitySet);
+    
+    /**
+     * Creates temporary instance of CTRTranscoder and asks for complexity factor estimate
+     * when converting given video clip to movie with set parameters.
+     * The estimate represents how long processing of 1 sec input takes.
+     */
+    TReal AskComplexityFactorFromTranscoderL(CVedVideoClipInfo* aInfo, CTRTranscoder::TTROperationalMode aMode, TReal aInputFrameRate);
+    
+    /**
+     * Checks whether the specified video clip can be inserted to this movie.
+     *
+     * @param aClip  video clip
+     *
+     * @return  <code>KErrNone</code>, if the clip can be inserted; 
+     *          one of the system wide error codes, otherwise
+     */
+    TInt CheckVideoClipInsertable(CVedVideoClip *aClip) const;
+
+    /**
+     * Calculates the maximum and minimum resolution supported by this movie.
+     *
+     * @param aMaxRes       initial upper limit for the maximum resolution; 
+     *                      after the method returns, contains the calculated
+     *                      maximum resolution supported by this movie
+     * @param aMinRes       initial lower limit for the minimum resolution; 
+     *                      after the method returns, contains the calculated
+     *                      minimum resolution supported by this movie
+     * @param aDoFullCheck  <code>ETrue</code>, if all clips should be
+     *                      checked to verify that they can be combined
+     *                      (not necessary but useful for detecting internal 
+     *                      errors); <code>EFalse</code>, if extra checks 
+     *                      should be skipped to minimize execution time
+     */
+    void CalculateMaxAndMinResolution(TSize& aMaxRes, TSize& aMinRes,
+                                      TBool aDoFullCheck) const;
+
+    /**
+     * Recalculates video clip timings.
+     *
+     * @param aVideoClip  Video clip
+     */
+    void RecalculateVideoClipTimings(CVedVideoClip* aVideoClip);    
+
+    /**
+     * Reset the movie. 
+     */
+    void DoReset();
+    
+    /**
+     * Set audio fade in/out on clip boundaries
+     */
+    void SetAudioFadingL();
+    
+    /**
+     * Internal helper function to set iVideoCodecMimeType to given value
+     */
+    void SetVideoCodecMimeType(const TText8* aVideoCodecType);
+
+    /* Notification methods. */
+
+    /**
+     * Notify observers that the video clip has been added to movie.
+     *
+     * @param aMovie This movie.
+     * @param aClip Added video clip.
+     */
+    void FireVideoClipAdded(CVedMovie* aMovie, CVedVideoClip* aClip);
+
+    /**
+     * Notify observers that the adding of video clip failed.
+     *
+     * @param 
+     */
+    void FireVideoClipAddingFailed(CVedMovie* aMovie, TInt aError);
+
+    /**
+     * Notify observers that the video clip has been removed from movie.
+     *
+     * @param aMovie This movie.
+     * @param aIndex Index of removed video clip.
+     */
+    void FireVideoClipRemoved(CVedMovie* aMovie, TInt aIndex);
+
+    /**
+     * Notify observers that the video clip indices has changes.
+     *
+     * @param aMovie This movie.
+     * @param aOldIndex Old index of video clip.
+     * @param aNewIndex New index of video clip.
+     */
+    void FireVideoClipIndicesChanged(CVedMovie* aMovie, TInt aOldIndex, 
+                                     TInt aNewIndex);
+
+    /**
+     * Notify observers that the video clip timings has been changed.
+     *
+     * @param aMovie This movie.
+     * @param aClip The video clip.
+     */
+    void FireVideoClipTimingsChanged(CVedMovie* aMovie, CVedVideoClip* aClip);
+
+    /**
+     * Notify observers that the color effect of video clip has been changed.
+     *
+     * @param aMovie This movie.
+     * @param aClip Video clip that was changed.
+     */
+    void FireVideoClipColorEffectChanged(CVedMovie* aMovie, CVedVideoClip* aClip);
+
+    /**
+     * Notify observers that the audio settings of video clip has been changed.
+     *
+     * @param aMovie This movie.
+     * @param aClip Video clip that audio settings has been changed.
+     */
+    void FireVideoClipAudioSettingsChanged(CVedMovie* aMovie, CVedVideoClip* aClip);
+
+    /**
+     * Notify observers that the generator settings of video clip has been changed.
+     *
+     * @param aMovie This movie.
+     * @param aClip  Video clip whose settings has been changed
+     */
+    void FireVideoClipGeneratorSettingsChanged(CVedMovie* aMovie, CVedVideoClip* aClip);
+
+    /**
+     * Notify observers that the descriptive name of video clip has been changed.
+     *
+     * @param aMovie  This movie
+     * @param aClip   Video clip whose settings has been changed
+     */
+    void FireVideoClipDescriptiveNameChanged(CVedMovie* aMovie, CVedVideoClip* aClip);
+
+
+    /**
+     * Notify observers that the start transition effect of the movie has been changed.
+     *
+     * @param aMovie This movie.
+     */
+    void FireStartTransitionEffectChanged(CVedMovie* aMovie);
+
+    /**
+     * Notify observers that the middle transition effect of video clip has been changed.
+     *
+     * @param aMovie This movie.
+     * @param aClip Video clip that was changed.
+     */
+    void FireMiddleTransitionEffectChanged(CVedMovie* aMovie, TInt aIndex);
+
+    /**
+     * Notify observers that the end transition effect of the movie has been changed.
+     *
+     * @param aMovie This movie.
+     */
+    void FireEndTransitionEffectChanged(CVedMovie* aMovie);
+
+    /**
+     * Notify observers that an audio clip has been added to movie.
+     *
+     * @param aMovie This movie.
+     * @param aIndex index of added clip.
+     */
+    void FireAudioClipAdded(CVedMovie* aMovie, TInt aIndex);
+
+    /**
+     * Notify observers that the adding of audio clip has failed.
+     *
+     * @param aMovie This movie.
+     * @param aError Error code.
+     */
+    void FireAudioClipAddingFailed(CVedMovie* aMovie, TInt aError);
+
+    /**
+     * Notify observers that the audio clip has been removed from movie. 
+     *
+     * @param aMovie This movie.
+     * @param aInder Index of removed audio clip.
+     */
+    void FireAudioClipRemoved(CVedMovie* aMovie, TInt aIndex);
+
+    /**
+     * Notify observers that the audio clip indices has been changed.
+     *
+     * @param aMovie This movie.
+     * @param aOldIndex Old index of the audio clip.
+     * @param aNewIndex New index of the audio clip.
+     */
+    void FireAudioClipIndicesChanged(CVedMovie* aMovie, TInt aOldIndex, TInt aNewIndex);
+
+    /**
+     * Notify observers that the audio clip timings has been changed.
+     *
+     * @param aMovie This movie.
+     * @param aClip The audio clip that timings has been changed.
+     */
+    void FireAudioClipTimingsChanged(CVedMovie* aMovie, CAudClip* aClip);
+
+    /**
+     * Notify observers that output parameters has been changed.
+     *
+     * @param aMovie This movie.
+     * @param aClip The audio clip that timings has been changed.
+     */
+    void FireMovieOutputParametersChanged(CVedMovie* aMovie);
+
+    /**
+     * Notify observers that an audio or video clip dynamic level
+     * mark has been removed.
+     *
+     * @param aClip   The audio clip that timings has been changed.
+     * @param aIndex  Index of the removed dynamic level mark
+     */
+    void FireDynamicLevelMarkRemoved(CAudClip& aClip, TInt aIndex);
+
+    /**
+     * Notify observers that an audio or video clip dynamic level
+     * mark has been inserted.
+     *
+     * @param aClip   The audio clip that timings has been changed.
+     * @param aMark   Dynamic level mark that was inserted
+     * @param aIndex  Index of the removed dynamic level mark
+     */
+    void FireDynamicLevelMarkInserted(CAudClip& aClip, TAudDynamicLevelMark& aMark, TInt aIndex);
+
+    /**
+     * Notify observers that the quality setting of the movie has been
+     * changed.
+     *
+     * @param aMovie This movie.
+     */
+    void FireMovieQualityChanged(CVedMovie* aMovie);
+
+    /**
+     * Notify observers that the movie has been reseted.
+     *
+     * @param aMovie This movie.
+     */
+    void FireMovieReseted(CVedMovie* aMovie);    
+
+private: // methods from base classes
+    void NotifyClipAdded(CAudSong& aSong, CAudClip& aClip, 
+        TInt aIndex, TInt aTrackIndex);
+    void NotifyClipAddingFailed(CAudSong& aSong, TInt aError, TInt aTrackIndex);
+    void NotifyClipRemoved(CAudSong& aSong, TInt aIndex, TInt aTrackIndex);
+    void NotifyClipTimingsChanged(CAudSong& aSong, CAudClip& aClip);
+    void NotifyClipIndicesChanged(CAudSong& aSong, TInt aOldIndex, 
+        TInt aNewIndex, TInt aTrackIndex);
+    void NotifySongReseted(CAudSong& aSong);
+    void NotifyClipReseted(CAudClip& aClip);
+    void NotifyDynamicLevelMarkInserted(CAudClip& aClip, 
+        TAudDynamicLevelMark& aMark, TInt aIndex);
+    void NotifyDynamicLevelMarkRemoved(CAudClip& aClip, TInt aIndex);
+    
+    void NotifyAudioClipInfoReady(CVedAudioClipInfo& aInfo, TInt aError);
+
+private:
+    // Member variables
+
+    // File server session.
+    RFs* iFs;
+    // Video clip array.
+    RPointerArray<CVedVideoClip> iVideoClipArray;
+    // Audio clip array.
+    RPointerArray<CVedAudioClipInfoImp> iAudioClipInfoArray;
+    // Observer array of the movie class.
+    RPointerArray<MVedMovieObserver> iObserverArray;
+
+    // Start transition effect of the movie.
+    TVedStartTransitionEffect iStartTransitionEffect;
+    // End transition effect of the movie.
+    TVedEndTransitionEffect iEndTransitionEffect;
+    
+    // Add clip operation for movie.    
+    CVedMovieAddClipOperation* iAddOperation;
+    // Video editor processor.
+    CMovieProcessor* iProcessor;
+
+    // Quality
+    TVedMovieQuality iQuality;
+    // Format.
+    TVedVideoFormat iFormat;
+    // Quality set assigned for the movie
+    SVideoQualitySet iQualitySet;
+    // Video type, both internal enum and MIME-type.
+    TVedVideoType iVideoType;
+    TPtrC8 iVideoCodecMimeType;
+    // Resolution.
+    TSize iResolution;
+    // Maximum framerate.
+    TInt iMaximumFramerate;
+    // Random access point rate, in pictures per second.
+    TReal iRandomAccessRate;
+    // Standard video bitrate; can be used when encoding, but doesn't force to transcode input to this bitrate
+    TInt iVideoStandardBitrate;
+        
+    // Used when non-zero
+    TInt iVideoRestrictedBitrate;    
+    TReal iVideoFrameRate;    
+    // Segment interval in picture. In H.263 baseline this means number of non-empty GOB headers (1=every GOB has a header), 
+    // in MB-based systems number of MBs per segment. Default is 0 == no segments inside picture
+    // Coding standard & used profile etc. limit the value.
+    TInt iSyncIntervalInPicture;
+    // Latest estimate for processing time of the movie
+    TTimeIntervalMicroSeconds iEstimatedProcessingTime;
+        
+    // Song
+    CAudSong* iAudSong;
+    
+    // Whether output parameters have been set using SetOutputParametersL
+    TBool iOutputParamsSet;
+    
+    // Video clip index stored for inserting video clip first to AudSong, then to Movie
+    TInt iAddedVideoClipIndex;
+    
+    // File name of the added clip
+    HBufC* iAddedVideoClipFilename;            
+    
+    RFile* iAddedVideoClipFileHandle;
+    
+    // whether to notify observer about dynamic
+    // level marker changes
+    TBool iNotifyObserver;
+    
+    // Codec availability checker 
+    CVedCodecChecker* iCodecChecker;
+
+    // Volume gains for all video and audio clips
+    TInt iVolumeGainForAllVideoClips;
+    TInt iVolumeGainForAllAudioClips;
+    
+    // ETrue if specific dynamic level mark(s) or global volume settings should be applied (EFalse)
+    TBool iApplyDynamicLevelMark;
+    
+    // Quality settings manager
+    CVideoQualitySelector* iQualitySelector;
+    
+    MVedMovieProcessingObserver* iMovieProcessingObserver;
+    
+    friend class CVedMovieAddClipOperation;
+    friend class CVedVideoClip;
+    friend class CVedAudioClip;
+    friend class CVedVideoClipGenerator;
+    };
+
+
+/**
+ * Internal class for adding video and audio clips.
+ */
+class CVedMovieAddClipOperation : public CActive, 
+                                  public MVedVideoClipInfoObserver                                  
+    {
+public:
+    /* 
+    * Static constructor.
+    */
+    static CVedMovieAddClipOperation* NewL(CVedMovie* aMovie);
+
+    /*
+    * Notify that the video clip info is ready.
+    */
+    void NotifyVideoClipInfoReady(CVedVideoClipInfo& aInfo, 
+                                          TInt aError);    
+
+protected:
+    /*
+    * From CActive.
+    * Standard active object RunL function.
+    */
+    void RunL();
+ 
+    /*
+    * From CActive.
+    * Standard active object DoCancel function.
+    */
+    void DoCancel();
+
+private:
+    /* Default constructor */
+    CVedMovieAddClipOperation(CVedMovie* aMovie);
+    
+    /* Standard Symbian OS two phased contructor */
+    void ConstructL();
+
+    /* Destructor */
+    ~CVedMovieAddClipOperation();
+
+    /* Called when video add operation has been completed */
+    void CompleteAddVideoClipOperation();
+
+
+private:
+    // Pointer to movie class this operation is part of.
+    CVedMovieImp* iMovie;
+
+    // Video clip to be added.
+    CVedVideoClip* iVideoClip;
+    // Does the video clip to be added own the generator?
+    TBool iIsVideoGeneratorOwnedByVideoClip;
+
+    // Error code of add operation
+    TInt iError;
+
+    friend class CVedMovieImp;
+    };
+
+
+#endif // __VEDMOVIEIMP_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/VedVideoClip.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,410 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+
+#ifndef __VEDVIDEOCLIP_H__
+#define __VEDVIDEOCLIP_H__
+
+
+#include <e32base.h>
+#include <f32file.h>
+
+#include "VedCommon.h"
+#include "VedVideoClipInfo.h"
+
+
+/*
+ *  Forward declarations.
+ */
+class CVedMovieImp;
+class CAudClip;
+
+
+/**
+ * Individual video clip stored as a single bitstream.
+ *
+ * @see CVedMovie
+ */
+class CVedVideoClip : public CBase
+{
+public:
+
+    /* Constructors. */
+
+    static CVedVideoClip* NewL(CVedMovieImp* aMovie, const TDesC& aFileName,
+							   TInt aIndex, CAudClip* aAudioClip,
+							   MVedVideoClipInfoObserver& aObserver);
+
+    static CVedVideoClip* NewL(CVedMovieImp* aMovie, 
+                               CVedVideoClipGenerator& aGenerator, TInt aIndex, 
+                               MVedVideoClipInfoObserver& aObserver, TBool aIsOwnedByVideoClip);
+                               
+    static CVedVideoClip* NewL(CVedMovieImp* aMovie, RFile* aFileHandle,
+							   TInt aIndex, CAudClip* aAudioClip,
+							   MVedVideoClipInfoObserver& aObserver);                               
+
+    /* Destructor. */
+
+    /**
+     * Destroys the object and releases all resources.
+     */    
+    virtual ~CVedVideoClip();
+
+
+    /* Property methods. */
+    
+    /**
+     * Returns a video clip info object to get detailed information about
+     * the original video clip. Note that the specified editing operations 
+     * (for example, cutting or muting audio) do <em>not</em>
+     * affect the values returned by the info object.
+     * 
+     * @return  pointer to a video clip info instance
+     */
+    CVedVideoClipInfo* Info();
+
+    /**
+     * Returns whether this video clip with the specified editing operations 
+     * applied (for example, changing speed or muting) has an audio track or not.
+     *
+     * @return  <code>ETrue</code> if clip has an audio track;
+     *          <code>EFalse</code> otherwise
+     */
+    TBool EditedHasAudio() const;
+
+
+    /* Movie methods. */
+
+    /**
+     * Returns the movie that this video clip is part of.
+     * 
+     * @return  movie
+     */
+    CVedMovieImp* Movie();
+
+    /**
+     * Returns the index of this video clip in the movie.
+     * 
+     * @return  index of the clip
+     */
+     TInt Index() const;
+
+    /**
+     * Sets the index of this video clip in the movie. 
+     * Panics with code <code>EVideoClipIllegalIndex</code> 
+     * if the clip index is invalid.
+     *
+     * @param aIndex  new index of this clip
+     */
+    void SetIndex(TInt aIndex);
+
+
+    /* Effect methods. */
+
+    /**
+     * Returns the playback speed of this video clip. Playback speed is
+     * specified as parts per thousand of the normal playback speed. For example.
+     * 1000 means the normal speed, 750 means 75% of the normal speed, and so on.
+     *
+     * @return  playback speed
+     */
+    TInt Speed() const;
+
+    /**
+     * Sets the playback speed of this video clip. Playback speed is
+     * specified as parts per thousand of the normal playback speed. For example.
+     * 1000 means the normal speed, 750 means 75% of the normal speed, and so on.
+     * Panics with <code>EVideoClipIllegalSpeed</code> if playback speed is
+     * illegal.
+     *
+     * @param aSpeed  playback speed; must be between 1 and 1000
+     */
+    void SetSpeed(TInt aSpeed);
+    
+    /**
+     * Returns the color effect of this video clip.
+     *
+     * @return  color effect
+     */
+    TVedColorEffect ColorEffect() const;
+    
+    /**
+     * Sets the color effect of this video clip.
+     *
+     * @param aColorEffect  color effect
+     */
+    void SetColorEffect(TVedColorEffect aColorEffect);
+
+
+    /** 
+     * Returns the color tone.
+     *
+     * @return color tone
+     */
+    TRgb ColorTone() const;
+    
+    /**
+     * Sets the color tone.
+     *
+     * @param aColorTone  color tone
+     */
+    void SetColorTone(TRgb aColorTone);
+    
+    /* Audio methods. */
+    
+    /**
+     * Returns whether this video clip can be muted or not (that is,
+     * whether the mute setting has any effect). For example, if
+     * this video clip has no audio track, it can never have audio
+     * even if the mute setting is false.
+     *
+     * @return  <code>ETrue</code> if this video clip can be muted;
+     *          <code>EFalse</code> otherwise
+     */
+    TBool IsMuteable() const;
+
+    /**
+     * Returns whether the audio track of this video clip is mute or not.
+     * This covers all mute cases: user muted, automatically muted (slow motion), 
+     * and missing audio track.
+     *
+     * @return  <code>ETrue</code> if the audio track is muted;
+     *          <code>EFalse</code> otherwise
+     */
+    TBool Muting() const;
+    
+    /**
+     * Returns whether the audio track of this video clip is explicitly 
+     * muted by user or not. Returns ETrue also if there is no audio track at all.
+     *
+     * @return  <code>ETrue</code> if the audio track is muted;
+     *          <code>EFalse</code> otherwise
+     */
+    TBool IsMuted() const;
+    
+    /**
+     * Returns whether the audio track of this video clip is normalized or not.
+     *
+     * @return  <code>ETrue</code> if the audio track is normalized;
+     *          <code>EFalse</code> otherwise
+     */
+    TBool Normalizing() const;
+
+    
+    /**
+     * Sets whether the audio track of this video clip is muted or not.
+     *
+     * @param aVolume  <code>ETrue</code> to mute the audio track;
+     *                 <code>EFalse</code> not to mute the audio track
+     */
+    void SetMuted(TBool aMuted);
+    
+    /**
+     * Sets whether the audio track of this video clip is normalized or not.
+     *
+     * @param aNormalizing  <code>ETrue</code> to normalize the audio track,
+     *                      <code>EFalse</code> not to normalize 
+     */
+    void SetNormalizing(TBool aNormalizing);
+    
+    /**
+     * Inserts a dynamic level mark to a clip.
+     *
+     * Possible leave codes:
+     *	- <code>KErrNoMemory</code> if memory allocation fails
+     *
+     * @param	aMark mark to be added 
+     * @return  index of the mark inserted
+     */
+    TInt InsertDynamicLevelMarkL(const TVedDynamicLevelMark& aMark);
+	
+    /**
+     * Removes a dynamic level mark in a clip.
+     *
+     * @param	aIndex index of the removed mark in this clip
+     * @return  ETrue if mark was removed, EFalse otherwise
+     */
+    TBool RemoveDynamicLevelMark(TInt aIndex);
+    
+    /**
+     * Returns a dynamic level mark at the specified index
+     * If the index is illegal, the method panics with the code 
+     * <code>EIllegalDynamicLevelMarkIndex</code> 
+     *
+     * @return  A dynamic level mark
+     */
+    TVedDynamicLevelMark DynamicLevelMark(TInt aIndex) const;
+	
+    /**
+     * Returns the number of dynamic level marks
+     * 
+     * @return  The number of dynamic level mark
+     */
+    TInt DynamicLevelMarkCount() const;
+    
+    /**
+    * Sets common volume gain for the clip. It is used to store
+    * the gain; the actual processing will be based on dynamic level
+    * marks which are set based on the gain value just before processing.
+    * Since global gain setting may affect the dynamic level mark,
+    * we need different variable to store the clip-specific gain also after the processing.
+    * I.e. dynamic level marks do not have effect to this value.
+    *
+    * @param aVolumeGain
+    */
+    void SetVolumeGain(TInt aVolumeGain);
+    
+    /**
+    * Gets common volume gain for the clip. 
+    * Since global gain setting may affect the dynamic level mark,
+    * we need different variable to store the clip-specific gain also after the processing.
+    *
+    * @param aVolumeGain
+    */
+    TInt GetVolumeGain();
+
+    /* Timing methods. */
+
+    /**
+     * Returns the cut in time of this video clip in clip timebase.
+     *
+     * @return  cut in time in microseconds in clip timebase
+     */
+    TTimeIntervalMicroSeconds CutInTime() const;
+
+    /**
+     * Sets the cut in time of this video clip in clip timebase.
+     * Panics with <code>EVideoClipIllegalCutInTime</code> if
+     * cut in time is illegal.
+     *
+     * @param aCutInTime  cut in time in microseconds in clip timebase
+     */
+    void SetCutInTime(TTimeIntervalMicroSeconds aCutInTime);
+
+    /**
+     * Returns the cut out time of this video clip in clip timebase.
+     *
+     * @return  cut out time in microseconds in clip timebase
+     */
+    TTimeIntervalMicroSeconds CutOutTime() const;
+
+    /**
+     * Sets the cut out time of this video clip in clip timebase. 
+     * Panics with <code>EVideoClipIllegalCutOutTime</code> if
+     * cut out time is illegal.
+     *
+     * @param aCutOutTime  cut out time in microseconds in clip timebase
+     */
+    void SetCutOutTime(TTimeIntervalMicroSeconds aCutOutTime);
+
+    /**
+     * Returns the start time of this video clip in movie timebase.
+     *
+     * @return  start time in microseconds in movie timebase
+     */
+    TTimeIntervalMicroSeconds StartTime() const;
+
+    /**
+     * Returns the end time of this video clip in movie timebase.
+     *
+     * @return  end time in microseconds in movie timebase
+     */
+    TTimeIntervalMicroSeconds EndTime() const;
+
+    /**
+     * Returns the duration of this video clip with the specified
+     * editing operations applied (for example, cutting 
+     * and changing speed)
+     * 
+     * @return  duration in microseconds
+     */
+    TTimeIntervalMicroSeconds EditedDuration() const;
+
+    /**
+     * Update the audio clip timings.
+     */
+    void UpdateAudioClip();
+    
+protected: 
+
+
+private:
+    /* 
+    * Default contructor 
+    */
+    CVedVideoClip(CVedMovieImp* aMovie, CAudClip* aAudioClip);
+
+    /*
+    * Symbian OS two phased constructor.
+    */ 
+    void ConstructL(const TDesC& aFileName, TInt aIndex,
+                    MVedVideoClipInfoObserver& aObserver);
+
+    void ConstructL(CVedVideoClipGenerator& aGenerator, TInt aIndex, 
+                    MVedVideoClipInfoObserver& aObserver, TBool aIsOwnedByVideoClip);
+                    
+    void ConstructL(RFile* aFileHandle, TInt aIndex,
+                    MVedVideoClipInfoObserver& aObserver);                    
+
+
+private:
+    // Member variables
+    
+    // Movie class this clip is part of.
+    CVedMovieImp* iMovie;
+    // Index of this clip in movie.
+    TInt iIndex;
+    // File of the video clip.
+    RFile iLockFile;
+    // Info class of this video clip.
+    CVedVideoClipInfo* iInfo;
+
+    // Speed effect of this video clip.
+    TInt iSpeed;
+    // Color effect of this video clip.
+    TVedColorEffect iColorEffect;
+    // Transition effect of this video clip.
+    TVedMiddleTransitionEffect iMiddleTransitionEffect;
+    
+    // Cut in time of this video clip.
+    TTimeIntervalMicroSeconds iCutInTime;
+    // Cut out time of this video clip.
+    TTimeIntervalMicroSeconds iCutOutTime;
+    // Start time of this video clip.
+    TTimeIntervalMicroSeconds iStartTime;
+
+	// Audio track of this video clip
+	CAudClip* iAudClip;
+	// Audio track muting: slow motion mutes it automatically, but switching back to normal speed 
+	// should unmute it unless user has muted it on purpose.
+	TBool iUserMuted;
+	// color tone
+	TRgb iColorTone;
+	
+	TBool iLockFileOpened;
+	
+    friend class CVedMovieImp;
+    friend class CVedMovieAddClipOperation;
+};
+
+
+#endif // __VEDVIDEOCLIP_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/VedVideoClipInfoGeneratedImp.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/* Copyright (c) 2004, Nokia. All rights reserved. */
+
+#ifndef __VEDVIDEOCLIPINFOGENERATEDIMP_H__
+#define __VEDVIDEOCLIPINFOGENERATEDIMP_H__
+
+
+#include <e32base.h>
+
+#include "VedCommon.h"
+#include "VedVideoClipInfo.h"
+#include "VedVideoClipGenerator.h"
+
+/*
+ *  Forward declarations.
+ */
+class CVedVideoClipInfoGeneratedOperation;
+class CVedVideoClipGeneratedFrameToFrameAdapter;
+
+/**
+ * Utility class for getting information about generated video clips.
+ */
+class CVedVideoClipInfoGeneratedImp : public CVedVideoClipInfo
+    {
+public:
+    CVedVideoClipInfoGeneratedImp(CVedVideoClipGenerator& aGenerator, TBool aOwnsGenerator);
+
+    void ConstructL(MVedVideoClipInfoObserver& aObserver);
+
+    /**
+     * Destroys the object and releases all resources.
+     */    
+    ~CVedVideoClipInfoGeneratedImp();
+
+
+    /* General property methods. */
+
+    TPtrC DescriptiveName() const;
+
+    TPtrC FileName() const;
+    
+    RFile* FileHandle() const;
+
+    CVedVideoClipGenerator* Generator() const;
+
+    TVedVideoClipClass Class() const;
+
+    TVedVideoFormat Format() const;
+
+    TVedVideoType VideoType() const;
+
+    TSize Resolution() const;
+
+    TBool HasAudio() const;
+
+    TVedAudioType AudioType() const;
+
+    TVedAudioChannelMode AudioChannelMode() const;
+
+    TInt AudioSamplingRate() const;
+
+    TTimeIntervalMicroSeconds Duration() const;
+
+
+    /* Video frame property methods. */
+
+    TInt VideoFrameCount() const;
+
+    TTimeIntervalMicroSeconds VideoFrameStartTimeL(TInt aIndex);
+
+    TTimeIntervalMicroSeconds VideoFrameEndTimeL(TInt aIndex);
+
+    TTimeIntervalMicroSeconds VideoFrameDurationL(TInt aIndex);
+
+    TInt VideoFrameSizeL(TInt aIndex);
+
+    TBool VideoFrameIsIntraL(TInt aIndex);
+
+    TInt GetVideoFrameIndexL(TTimeIntervalMicroSeconds aTime);
+
+
+    void SetTranscodeFactor(TVedTranscodeFactor aFactor);
+
+    TVedTranscodeFactor TranscodeFactor();
+
+    TBool IsMMSCompatible();
+
+    /* Frame methods. */
+
+    void GetFrameL(MVedVideoClipFrameObserver& aObserver,
+                            TInt aIndex,
+                            TSize* const aResolution,
+                            TDisplayMode aDisplayMode,
+                            TBool aEnhance,
+                            TInt aPriority);
+    
+    void CancelFrame();
+
+private:
+    // Member variables
+
+    // Get audio info operation.
+    CVedVideoClipInfoGeneratedOperation* iInfoOperation;
+    // Flag to indicate then info is available
+    TBool iReady;
+    // Frame generator
+    CVedVideoClipGenerator* iGenerator;
+    TBool iOwnsGenerator;
+
+    CVedVideoClipGeneratedFrameToFrameAdapter* iAdapter;
+        
+    TVedTranscodeFactor iTFactor; 
+    friend class CVedVideoClipInfoGeneratedOperation;
+    };
+
+
+
+class CVedVideoClipGeneratedFrameToFrameAdapter : public CBase, public MVedVideoClipGeneratorFrameObserver
+    {
+public:
+    CVedVideoClipGeneratedFrameToFrameAdapter(CVedVideoClipInfo& aInfo);
+    void NotifyVideoClipGeneratorFrameCompleted(CVedVideoClipGenerator& aInfo, 
+                                                        TInt aError, 
+                                                        CFbsBitmap* aFrame);
+private:
+    MVedVideoClipFrameObserver* iFrameObserver;
+    CVedVideoClipInfo& iInfo;
+
+    friend class CVedVideoClipInfoGeneratedImp;
+    };
+
+
+/**
+ * Internal class for asynchronous construction of info class.
+ */
+class CVedVideoClipInfoGeneratedOperation : public CActive
+    {
+public:
+    /* Static constructor */
+    static CVedVideoClipInfoGeneratedOperation* NewL(CVedVideoClipInfoGeneratedImp* aInfo,
+                                                     MVedVideoClipInfoObserver& aObserver);
+protected:
+    /*
+    * From CActive
+    * Standard active object RunL 
+    */
+    void RunL();
+
+    /*
+    * From CActive
+    * Standard active object DoCancel
+    */
+    void DoCancel();
+
+private:
+    /* Default constructor */
+    CVedVideoClipInfoGeneratedOperation(CVedVideoClipInfoGeneratedImp* aInfo, 
+                                        MVedVideoClipInfoObserver& aObserver);
+    /* Standard Symbian OS two phased constructor */
+    void ConstructL();
+    /* Destructor */
+    ~CVedVideoClipInfoGeneratedOperation();
+
+private:
+    // Class to contain video clip info.
+    CVedVideoClipInfoGeneratedImp* iInfo;
+    // Observer of video clip info operation.
+    MVedVideoClipInfoObserver* iObserver;
+
+    friend class CVedVideoClipInfoGeneratedImp;
+    };
+
+
+#endif // __VEDVIDEOCLIPINFOGENERATEDIMP_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/VedVideoClipInfoImp.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,453 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __VEDVIDEOCLIPINFOIMP_H__
+#define __VEDVIDEOCLIPINFOIMP_H__
+
+
+#include <e32base.h>
+
+#include "movieprocessor.h"
+#include "VedCommon.h"
+#include "VedVideoClipInfo.h"
+
+#include "AudObservers.h"
+
+/*
+ *  Forward declarations.
+ */
+class CFbsBitmap;  // cannot include bitmap.h since video processor includes
+                   // this file and fails to compile due to a strange compiler error
+                   // "operator delete must return type void" if bitmap.h
+                   // is included
+
+class CVedVideoClipInfo;
+class TVedVideoFrameInfo;
+class CVedVideoClipInfoOperation;
+class CVedVideoClipFrameOperation;
+class CAudClipInfo;
+class CVedVideoClip;
+
+
+/**
+ * Utility class for getting information about video clip files.
+ */
+class CVedVideoClipInfoImp : public CVedVideoClipInfo
+    {
+public:
+
+    static CVedVideoClipInfo* NewL(CAudClipInfo* aAudClipInfo,
+                                   const TDesC& aFileName, MVedVideoClipInfoObserver& aObserver);
+    /**
+     * Destroys the object and releases all resources.
+     */    
+    ~CVedVideoClipInfoImp();
+
+
+    /* General property methods. */
+
+
+    TPtrC DescriptiveName() const;
+
+    /**
+     * Returns the file name of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  file name of the clip
+     */
+    TPtrC FileName() const;
+
+    CVedVideoClipGenerator* Generator() const;
+
+    TVedVideoClipClass Class() const;
+
+    /**
+     * Returns the video format of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  video format of the clip
+     */
+    TVedVideoFormat Format() const;
+
+    /**
+     * Returns the video type of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  video type of the clip
+     */
+    TVedVideoType VideoType() const;
+
+    /**
+     * Returns the resolution of the clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  resolution of the clip
+     */
+    TSize Resolution() const;
+
+    /**
+     * Returns whether this video clip has an audio track or not.
+     * Panics if info is not yet ready for reading.  
+     *
+     * @return  <code>ETrue</code> if clip has an audio track;
+     *          <code>EFalse</code> otherwise
+     */
+    TBool HasAudio() const;
+
+    /**
+     * Returns the audio type of the clip audio track. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  audio type of the clip audio track
+     */
+    TVedAudioType AudioType() const;
+
+    /**
+     * Returns the channel mode of the audio if applicable.
+     *
+     * @return  channel mode
+     */
+    TVedAudioChannelMode AudioChannelMode() const;
+
+    /**
+     * Returns the sampling rate in kilohertz.
+     *
+     * @return  sampling rate
+     */
+    TInt AudioSamplingRate() const;
+
+    /**
+     * Returns the duration of the clip in microseconds. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  duration of the clip
+     */
+    TTimeIntervalMicroSeconds Duration() const;
+
+
+    /* Video frame property methods. */
+
+    /**
+     * Returns the number of video frames in this clip. Panics if info
+     * is not yet ready for reading.
+     * 
+     * @return  number of video frames in this clip
+     */
+    TInt VideoFrameCount() const;
+
+    /** 
+     * Generates video frame info that is needed in VideoFrame API functions.
+     * 
+     * @return  error code
+     */ 
+    TInt GenerateVideoFrameInfoArrayL();    
+
+    /** 
+     * Returns the start time of the video frame at the specified index. 
+     * Panics if info is not yet ready for reading or the index is illegal.
+     *
+     * @param aIndex  index
+     *
+     * @return  start time of the video frame at the specified index in microseconds
+     */ 
+    TTimeIntervalMicroSeconds VideoFrameStartTimeL(TInt aIndex);
+
+    /** 
+     * Returns the end time of the video frame at the specified index. 
+     * Panics if info is not yet ready for reading or the index is illegal.
+     *
+     * @param aIndex  index
+     *
+     * @return  end time of the video frame at the specified index in microseconds
+     */ 
+    TTimeIntervalMicroSeconds VideoFrameEndTimeL(TInt aIndex);
+
+    /** 
+     * Returns the duration of the video frame at the specified index. 
+     * Panics if info is not yet ready for reading or the index is illegal.
+     *
+     * @param aIndex  index
+     *
+     * @return  duration of the video frame at the specified index in microseconds
+     */ 
+    TTimeIntervalMicroSeconds VideoFrameDurationL(TInt aIndex);
+
+    /** 
+     * Returns the size of the video frame at the specified index. 
+     * Panics if info is not yet ready for reading or the index is illegal.
+     *
+     * @param aIndex  index
+     *
+     * @return  size of the video frame at the specified index in bytes
+     */ 
+    TInt VideoFrameSizeL(TInt aIndex);
+
+    /** 
+     * Returns whether the video frame at the specified index is an intra
+     * frame or not. Panics if info is not yet ready for reading or 
+     * the index is illegal.
+     *
+     * @param aIndex  index
+     *
+     * @return  <code>ETrue</code>, if the video frame at the specified index is an
+     *          intra frame; <code>EFalse</code>, otherwise
+     */ 
+    TBool VideoFrameIsIntraL(TInt aIndex);
+
+    /**
+     * Returns the video frame index at the specified time. Panics if info is not yet 
+     * ready for reading or the time is illegal.
+     *
+     * @param aTime  time
+     *
+     * @return  video frame index at the specified time
+     */
+    TInt GetVideoFrameIndexL(TTimeIntervalMicroSeconds aTime);
+
+
+    /* Frame methods. */
+
+    void GetFrameL(MVedVideoClipFrameObserver& aObserver,
+                            TInt aIndex,
+                            TSize* const aResolution,
+                            TDisplayMode aDisplayMode,
+                            TBool aEnhance,
+                            TInt aPriority);
+    
+    void CancelFrame();
+
+    void SetTranscodeFactor(TVedTranscodeFactor aFactor);
+
+    TVedTranscodeFactor TranscodeFactor();
+
+    /**
+     * Returns whether video clip is MMSCompatible.
+     *
+     * @return  ETrue if compatible with MMS
+     */
+    TBool IsMMSCompatible();
+    
+    static CVedVideoClipInfo* NewL(CAudClipInfo* aAudClipInfo,
+                                   RFile* aFileHandle, MVedVideoClipInfoObserver& aObserver);
+                                   
+    RFile* FileHandle() const;
+
+private:
+    CVedVideoClipInfoImp(CAudClipInfo* aAudClipInfo);
+
+    void ConstructL(const TDesC& aFileName,
+                    MVedVideoClipInfoObserver& aObserver);
+                    
+    void ConstructL(RFile* aFileHandle,
+                    MVedVideoClipInfoObserver& aObserver);                    
+                    
+private:
+    // Member variables
+
+    // Get audio info operation.
+    CVedVideoClipInfoOperation* iInfoOperation;
+    // Flag to indicate then info is available
+    TBool iReady;
+    
+    // Filename of the video clip.
+    HBufC* iFileName;
+    
+    // File handle of the video clip
+    RFile* iFileHandle;
+    
+    // Vídeo format.
+    TVedVideoFormat iFormat;
+    // Video type/codec.
+    TVedVideoType iVideoType;
+    // Resolution of video clip.
+    TSize iResolution;    
+    // Duration of the video clip.
+    TTimeIntervalMicroSeconds iDuration;
+    // Frame count of video
+    TInt iVideoFrameCount;
+    // Array of frame information.
+    TVedVideoFrameInfo* iVideoFrameInfoArray;
+    
+    // Operation to retrieve thumbnail of video clip.
+    CVedVideoClipFrameOperation* iFrameOperation;
+
+    // Transcode factor
+    TVedTranscodeFactor iTimeFactor;
+
+    // Is the frame info array ready
+    TBool iVideoFrameInfoArrayReady;
+    
+    // Flag for audio clip info ownership
+    TBool iAudClipInfoOwnedByVideoClipInfo;
+
+    // Whether the video clip info is part of a video clip or just the info
+    TBool iVideoClipIsStandalone;        
+    
+    // Audio clip info.
+    CAudClipInfo* iAudClipInfo;
+    
+    // These are got from iAudClipInfo
+    
+    // Audio type/codec.
+    //TVedAudioType iAudioType;
+    // Following members are only used for AAC audio
+    // Channel mode
+    //TVedAudioChannelMode iAudioChannelMode;
+    // Sampling rate
+    //TInt iAudioSamplingRate;
+
+    friend class CVedVideoClipInfoOperation;
+    friend class CVedVideoClipFrameOperation;
+    friend class CVedVideoClipInfo;
+    };
+
+
+/**
+ * Internal class for storing information about video frames.
+ */
+class TVedVideoFrameInfo
+    {
+public:
+    /** Frame start time in MILLISECONDS (not microseconds). */
+    TInt iStartTime;
+
+    /** Frame size in bytes. */
+    TInt iSize;
+
+    /** Frame information flags. */
+    TInt8 iFlags;
+    };
+
+#define KVedVideoFrameInfoFlagIntra (1 << 0)
+
+
+/**
+ * Internal class for reading information from a video clip file.
+ * Also implements a simple active object to notify the video clip info 
+ * observer when reading has been completed.
+ */
+class CVedVideoClipInfoOperation : public CActive, MAudClipInfoObserver
+    {
+public:
+    /* Static constructor */
+    static CVedVideoClipInfoOperation* NewL(CVedVideoClipInfoImp* aInfo,
+                                        MVedVideoClipInfoObserver& aObserver);
+protected:
+    /*
+    * From CActive
+    * Standard active object RunL 
+    */
+    void RunL();
+
+    /*
+    * From CActive
+    * Standard active object DoCancel
+    */
+    void DoCancel();
+
+private:
+    /* Default constructor */
+    CVedVideoClipInfoOperation(CVedVideoClipInfoImp* aInfo, 
+                               MVedVideoClipInfoObserver& aObserver);
+    /* Standard Symbian OS two phased constructor */
+    void ConstructL();
+    /* Destructor */
+    ~CVedVideoClipInfoOperation();
+
+private: // functions from base classes
+
+    /* From MAudClipInfoObserver */
+    void NotifyClipInfoReady(CAudClipInfo& aInfo, TInt aError);
+private:
+    // Class to contain video clip info.
+    CVedVideoClipInfoImp* iInfo;
+    // Observer of video clip info operation.
+    MVedVideoClipInfoObserver* iObserver;
+    // Error code from prosessor.
+    TInt iMovieProcessorError;
+	// This flag tells us whether we're reading the audio clip info
+    TBool iGettingAudio;
+
+    friend class CVedVideoClipInfoImp;
+    };
+
+/**
+ * Internal class for generating a frame from a video clip file.
+ */
+class CVedVideoClipFrameOperation : public CActive
+    {
+public:
+    /* Static constructor */
+    static CVedVideoClipFrameOperation* NewL(CVedVideoClipInfoImp* iInfo);
+
+protected:
+    /*
+    * From CActive
+    * Standard active object RunL 
+    */
+    void RunL();
+
+    /*
+    * From CActive
+    * Standard active object DoCancel
+    */
+    void DoCancel();
+
+private:
+    /* Default constructor */
+    CVedVideoClipFrameOperation(CVedVideoClipInfoImp* iInfo);
+    /* Standard Symbian OS two phased constructor */
+    void ConstructL();
+    /* Destructor */
+    ~CVedVideoClipFrameOperation();
+
+    /*
+    * Start frame operation.
+    *
+    * @aparam aObserver Observer of thumbnail operation.
+    * @aparam aIndex Index of frame that is converted to thumbnail.
+    * @aparam aResolution Wanted resolution of thumbnail.
+    * @aparam aPriority Priority of active object.
+    */
+    void StartL(MVedVideoClipFrameObserver& aObserver,
+                TInt aIndex, TSize* const aResolution, 
+                TDisplayMode aDisplayMode, TBool aEnhance, TInt aPriority);
+
+private:
+    // Pointer to info class this thumbnail operation is part of.
+    
+    CVedVideoClipInfoImp* iInfo;
+    // Index of the wanted frame.
+    TInt iIndex;
+
+    // Observer of the thumbnail operation.
+    MVedVideoClipFrameObserver* iObserver;
+
+    TVedTranscodeFactor iFactor;
+    
+    TBool iThumbRequestPending;
+
+    CMovieProcessor* iProcessor;
+
+    friend class CVedVideoClipInfoImp;
+    };
+
+#endif // __VEDVIDEOCLIPINFOIMP_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/vedaudiosettings.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for audio related settings/constants.
+*
+*/
+
+
+#ifndef __VEDAUDIOSETTINGS_H__
+#define __VEDAUDIOSETTINGS_H__
+
+const TUint KVedAudioFramesInSample = 5;       // number of frames in one AMR audio sample
+const TUint KVedMinAMRFrameSize = 13;          // smallest AMR frame size
+const TUint KVedMaxAMRFrameSize = 32;          // largest AMR frame size
+const TUint KVedAMRConversionBitrate = 12200;  // default target bitrate when converting to AMR
+const TUint KVedAACConversionBitrate = 48000;  // default target bitrate when converting to AAC
+const TUint KVedSilentAACFrameSize = 6;        // silent AAC frame size
+const TUint KVedAverageAACFrameSize = 384;     // average AAC frame size
+
+// AMR bitrates
+#define KVedAMRBitrate4_75k  (4750)
+#define KVedAMRBitrate5_15k  (5150)
+#define KVedAMRBitrate5_90k  (5900)
+#define KVedAMRBitrate6_70k  (6700)
+#define KVedAMRBitrate7_40k  (7400)
+#define KVedAMRBitrate7_95k  (7950)
+#define KVedAMRBitrate10_2k (10200)
+#define KVedAMRBitrate12_2k (12200)
+
+// AAC samplerates
+#define KVedAudioSamplingRate8k       (8000)
+#define KVedAudioSamplingRate11_025k (11025)
+#define KVedAudioSamplingRate12k     (12000)
+#define KVedAudioSamplingRate16k     (16000)
+#define KVedAudioSamplingRate22_050k (22050)
+#define KVedAudioSamplingRate24k     (24000)
+#define KVedAudioSamplingRate32k     (32000)
+#define KVedAudioSamplingRate44_1k   (44100)
+#define KVedAudioSamplingRate48k     (48000)
+#define KVedAudioSamplingRate64k     (64000)
+#define KVedAudioSamplingRate88_2k   (88200)
+#define KVedAudioSamplingRate96k     (96000)
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/vedcodecchecker.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for vedcodecchecker.cpp.
+*
+*/
+
+
+#ifndef __VEDCODECCHECKER_H__
+#define __VEDCODECCHECKER_H__
+
+
+//  FORWARD DECLARATIONS
+class CVedVideoClip;
+
+//  CONSTANTS
+//WVGA task
+//const TInt KNumResolutions = 6;
+//const TInt KNumCodecs = 14;
+const TInt KNumResolutions = 7;
+const TInt KNumCodecs = 18;
+
+enum TResolution
+    {
+    EResolutionSubQCIF = 0,
+    EResolutionQCIF,
+    EResolutionCIF,
+    EResolutionQVGA,
+    EResolutionVGA16By9,
+    EResolutionVGA,
+    EResolutionWVGA,
+    EResolutionUnsupported
+    };
+    
+enum TCodec
+    {
+    ECodecH263BPLevel10 = 0,
+    ECodecH263BPLevel45,
+    ECodecMPEG4VSPLevel0,
+    ECodecMPEG4VSPLevel0B,
+    ECodecMPEG4VSPLevel1,
+    ECodecMPEG4VSPLevel2,   
+    ECodecMPEG4VSPLevel3,
+    ECodecMPEG4VSPLevel4,
+    ECodecAVCBPLevel1,
+    ECodecAVCBPLevel1B,
+    ECodecAVCBPLevel1_1,
+    ECodecAVCBPLevel1_2,    
+    ECodecAVCBPLevel1_3,    
+    ECodecAVCBPLevel2,
+    //WVGA task
+    ECodecAVCBPLevel2_1,
+    ECodecAVCBPLevel2_2,    
+    ECodecAVCBPLevel3,    
+    ECodecAVCBPLevel3_1,   
+    ECodecUnsupported
+    };    
+    
+class CVedCodecChecker : public CBase
+    {
+  
+public:  // New functions  
+
+    /* Constructors. */
+    static CVedCodecChecker* NewL();
+    static CVedCodecChecker* NewLC();
+	
+    /* Destructor. */
+    virtual ~CVedCodecChecker();
+
+    /**
+     * Returns whether the given input clip is supported, 
+     * i.e. if it can be decoded or not
+     *
+     * @param aClip Video clip
+     * @return TBool Is supported ?
+     */    
+    TBool IsSupportedInputClipL(CVedVideoClip *aClip);
+    
+    /**
+     * Returns whether the given output format is supported, 
+     * i.e. if it can be encoded or not
+     *
+     * @param aMimeType Codec MIME type
+     * @param aResolution Desired resolution
+     * @return TBool Is supported ?
+     */    
+    TBool IsSupportedOutputFormatL(const TPtrC8& aMimeType, TSize aResolution);        
+    
+private:  // Private methods
+
+    /**
+    * By default Symbian OS constructor is private.
+    */
+    void ConstructL();
+    
+    /**
+    * C++ default constructor
+    */
+    CVedCodecChecker();
+    
+    /**
+     * Determines supported input formats using CTRTranscoder     
+     */
+    void GetSupportedInputFormatsL();
+    
+    /**
+     * Determines supported output formats using CTRTranscoder     
+     */
+    void GetSupportedOutputFormatsL();
+       
+    /**
+     * Maps resolution from TSize to TResolution
+     *
+     * @param aResolution Resolution to map
+     * @return TResolution
+     */ 
+    TResolution MapResolution(TSize aResolution);
+    
+    /**
+     * Maps profile-level-id to TCodec
+     *
+     * @param aProfileLevelId id to map
+     * @return TCodec Codec
+     */
+    TCodec MapProfileLevelId(TInt aProfileLevelId);        
+    
+    /**
+     * Parse codec MIME type
+     *
+     * @param aMimeType MIME to parse
+     * @param aResolution resolution to be used
+     * @return TCodec Codec
+     */
+    TCodec ParseMimeType(const TPtrC8& aMimeType, TSize aResolution);
+    
+     /**
+     * Maps AVC level to TCodec
+     *
+     * @param aLevel Level to map
+     * @return TCodec Codec
+     */
+    TCodec MapAVCLevel(TInt aLevel);
+    
+private:  // Data
+    
+    // table of supported input resolutions for each codec
+    TBool* iInputCodecsAndResolutions[KNumCodecs];
+    
+    // table of supported output resolutions for each codec
+    TBool* iOutputCodecsAndResolutions[KNumCodecs];
+    
+    // have output formats been checked ??
+    TBool iOutputFormatsChecked;
+
+};
+
+#endif // __VEDCODECCHECKER_H__
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/vedproctimeestimate.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __VEDPROCTIME_H__
+#define __VEDPROCTIME_H__
+
+
+const TReal KVedBitstreamProcessingFactor = 0.065; // 64 kbps H.263
+const TInt KVedBitstreamProcessingFactorBitrate = 64000;
+const TReal KVedCompressedDomainTranscodingFactor = 0.4;// QCIF MPEG-4 64 kbps to H.263 64 kbps
+
+#endif // __VEDPROCTIME_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/vedqualitysettingsapi.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEDQUALITYSETTINGSAPI_H__
+#define __VEDQUALITYSETTINGSAPI_H__
+
+#include <e32base.h>
+#include "imagingconfigmanager.h"
+
+
+
+const TUint KQSMaxShortStringLength = 16;
+const TUint KQSMaxLongStringLength = 256;
+
+
+
+/*
+ * Video quality set structure
+ */
+struct SVideoQualitySet
+    {
+    public:
+        // Video aspect ratio: normal means one of the standard resolutions like QCIF, QVGA, CIF, VGA, if something else, like 16:9
+        TBool iVideoAspectRatioNormal;
+        // Video file format mime type, e.g. "video/3gpp"
+        TText8 iVideoFileMimeType[KQSMaxShortStringLength];
+        // Video codec mime type, e.g. "video/mp4v-es"
+        TText8 iVideoCodecMimeType[KQSMaxLongStringLength];
+        // Video picture width in pixels (luminance)
+        TInt iVideoWidth;
+        // Video picture height in pixels (luminance)
+        TInt iVideoHeight;
+        // Video framerate in fps
+        TReal iVideoFrameRate;
+        // Video bitrate in bps
+        TInt iVideoBitRate;
+        // Random access point rate, in pictures per second. For example, to request a random access point every ten seconds, set the value to 0.1
+        TReal iRandomAccessRate;
+        // Audio codec FourCC, e.g. " AMR"
+        TText8 iAudioFourCCType[KQSMaxShortStringLength];
+        // Audio bitrate in bps
+        TInt iAudioBitRate;
+        // Audio sampling rate in Hz
+        TInt iAudioSamplingRate;
+        // Number of audio channels; in practice mono(1) vs stereo(2)
+        TInt iAudioChannels;
+    };
+
+
+/*
+ * API class for getting a quality set for a given level or given resolution
+ */
+class CVideoQualitySelector : public CBase
+    {
+    public:
+        /*
+         * Enumeration for nominal video quality levels. Client must use these enumerations to get quality sets.
+         * However, if NumberOfQualityLevels() below indicates there are more than ENumberOfNominalLevels, client
+         * can use values in-between the nominal values to get set for some other quality level. 
+         * It is however up to the implementation of the API to map such intermediate values to actual levels
+         */
+        enum TVideoQualityLevels
+            {
+            // client can try asking values in between these but the class may round the values depending on the availability
+            EVideoQualityMin = 0,       // if there are several MMS compatible settings, EVideoQualityMMS is not the lowest. However level cannot go below this value
+            EVideoQualityMMS = 10,      // use this when MMS compatible settings are needed
+            EVideoQualityNormal = 20,   // use this when normal quality settings are needed, i.e. typically higher quality than MMS, but possibly not the highest still
+            EVideoQualityHigh = 30,     // use this when highest possible quality settings are needed
+            EVideoQualityNominalGranularity = 10,
+            ENumberOfNominalLevels = 3
+            };
+
+    public:
+        /*
+         * Create new CVideoQualitySelector object
+         */
+        static CVideoQualitySelector* NewL();
+
+        static CVideoQualitySelector* NewLC();
+        
+        /*
+         * Destructor
+         */
+        ~CVideoQualitySelector();   
+
+        /*
+         *  Get number of defined quality levels. This is always at least ENumberOfNominalLevels but can be higher
+         */
+        TInt NumberOfQualityLevels();
+        /*
+         *  Get quality set associated with the given level. The level should be between EVideoQualityHigh and EVideoQualityMin.
+         *  One the defined nominal levels should be used especially if NumberOfQualityLevels() == ENumberOfNominalLevels.
+         *  If there is no set associated with given intermediate level, then set from a nearest level is returned.
+         */
+        void GetVideoQualitySetL( SVideoQualitySet& aSet, TInt aLevel );
+        /*
+         *  Get quality set associated with the given level. Otherwise the same as above but if aAspectRatioWide == ETrue, 
+         *  tries to find 16:9 aspect ratio settings, otherwise returns a set from the normal aspect ratio as above.
+         */
+        void GetVideoQualitySetL( SVideoQualitySet& aSet, TInt aLevel, TBool aAspectRatioWide );
+        /*
+         *  Get quality set associated with the given video resolution. Leaves if there is no defined set for the resolution.
+         *  E.g. if product configuration prefers QVGA over CIF, but client asks for CIF, this function leaves. The CIF settings
+         *  can then be requested using the MIME-type
+         */
+        void GetVideoQualitySetL( SVideoQualitySet& aSet, const TSize& aVideoResolution );
+        /*
+         *  Get quality set associated with the given video codec MIME-type. Leaves if there is no defined set for the MIME-type.
+         */
+        void GetVideoQualitySetL( SVideoQualitySet& aSet, const TPtrC8& aVideoCodecMimeType );
+        
+    private:
+        /*
+         * Default constructor
+         */
+        CVideoQualitySelector();
+
+        /*
+         * Actual constructor
+         */
+        void ConstructL();
+        
+        /*
+         * Copies the values from the source set to the target set
+         */
+        void MapQualitySet( SVideoQualitySet& aTargetSet, TVideoQualitySet& aSourceSet );
+        
+    private: // Data
+    
+        CImagingConfigManager* iConfigManager;
+        
+        CArrayFixFlat<TUint>* iQualityLevels;
+
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/vedqualitysettingsapi.inl	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEDQUALITYSETTINGSAPI_INL__
+#define __VEDQUALITYSETTINGSAPI_INL__
+
+#include "vedqualitysettingsvariation.h"
+
+
+inline TInt TVideoQualitySelector::NumberOfQualityLevels()
+    {
+    return ENumberOfQualitySets;
+    }
+
+inline void TVideoQualitySelector::GetVideoQualitySetL( SVideoQualitySet& aSet, TInt aLevel, TBool aAspectRatioWide )
+    {
+    if ( !aAspectRatioWide )
+        {
+        GetVideoQualitySetL( aSet, aLevel );
+        }
+    else
+        {
+        // NOT READY
+        TInt nrOfWideSets = ENumberOfWideQualitySets;
+        if ( nrOfWideSets == 0 )
+            {
+            User::Leave( KErrNotSupported );
+            }
+
+        switch ( aLevel )
+            {
+            case EVideoQualityMMS :
+                {
+                aSet = KVideoQualitySetsWide[EQualityLow];
+                }
+                break;
+            case EVideoQualityNormal :
+                {
+                if ( nrOfWideSets > 1 )
+                    {
+                    aSet = KVideoQualitySetsWide[EQualityMedium];
+                    }
+                else
+                    {
+                    aSet = KVideoQualitySetsWide[EQualityLow];
+                    }
+                }
+                break;
+            case EVideoQualityHigh :
+                {
+                if ( nrOfWideSets > 2 )
+                    {
+                    aSet = KVideoQualitySetsWide[EQualityHigh];
+                    }
+                else if ( nrOfWideSets > 1 )
+                    {
+                    aSet = KVideoQualitySetsWide[EQualityMedium];
+                    }
+                else
+                    {
+                    aSet = KVideoQualitySetsWide[EQualityLow];
+                    }
+                }
+                break;
+            default:
+                aSet = KVideoQualitySetsWide[EQualityLow];
+            }        
+        }
+    }
+
+
+inline void TVideoQualitySelector::GetVideoQualitySetL( SVideoQualitySet& aSet, TInt aLevel )
+    {
+
+    switch ( aLevel )
+        {
+        case EVideoQualityMMS :
+            {
+            aSet = KVideoQualitySets[EQualityLow];
+            }
+            break;
+        case EVideoQualityNormal :
+            {
+            aSet = KVideoQualitySets[EQualityMedium];
+            }
+            break;
+        case EVideoQualityHigh :
+            {
+            aSet = KVideoQualitySets[EQualityHigh];
+            }
+            break;
+        default:
+            if ( (aLevel > EVideoQualityHigh) || (aLevel < EVideoQualityMin) )
+                {
+                User::Leave( KErrArgument );
+                }
+            TInt moreSetsThanNominal = ENumberOfQualitySets - ENumberOfNominalLevels;
+            if ( moreSetsThanNominal )
+                {
+                // there are also qualities in-between the nominal levels
+                if ( aLevel < EVideoQualityMMS )
+                    {
+                    // even lower than the default MMS; no more than 1 step granularity there (atm)
+                    aSet = KVideoQualitySets[EQualityLegacy];
+                    }
+                else if ( aLevel < EQualityMedium )
+                    {
+                    // between Low and Medium
+                    TInt nrSetsBetweenMediumAndLow = EQualityMedium - EQualityLow - 1;
+                    if ( nrSetsBetweenMediumAndLow > 0 )
+                        {
+                        // no better granularity yet
+                        aSet = KVideoQualitySets[EQualityMedium-1];
+                        }
+                    else
+                        {
+                        // there are no specified quality in that range, give medium
+                        aSet = KVideoQualitySets[EQualityMedium];
+                        }
+                    }
+                else 
+                    {
+                    // between Medium and High
+                    TInt nrSetsBetweenHighAndMedium = EQualityHigh - EQualityMedium - 1;
+                    if ( nrSetsBetweenHighAndMedium > 0 )
+                        {
+                        // no better granularity yet
+                        aSet = KVideoQualitySets[EQualityHigh-1];
+                        }
+                    else
+                        {
+                        // there are no specified quality in that range, give medium
+                        aSet = KVideoQualitySets[EQualityMedium];
+                        }
+                    }
+                }
+            else
+                {
+                // round to the closest nominal level
+                aSet = KVideoQualitySets[(aLevel-(EVideoQualityNominalGranularity/2))/EVideoQualityNominalGranularity];
+                }
+        }
+    }
+
+inline void TVideoQualitySelector::GetVideoQualitySetL( SVideoQualitySet& aSet, const TSize& aVideoResolution )
+    {
+    // go through the qualities until a match is found. If several matches, pick the 1st one
+    TInt candidate = -1;
+    TInt i;
+    for ( i = ENumberOfQualitySets-1; i >= 0; i-- ) // searches from up to down to find higher quality first
+        {
+        if ( (KVideoQualitySets[i].iVideoWidth == aVideoResolution.iWidth) && (KVideoQualitySets[i].iVideoHeight == aVideoResolution.iHeight) )
+            {
+            // we've found a set which matches with the requested size
+            candidate = i;
+            if ( (i == EQualityLow) || (i == EQualityMedium) || (i == EQualityHigh) )
+                {
+                // we've found a set which matches also with preferred qualities
+                break;
+                }
+            }
+        }
+    if ( candidate >= 0 ) 
+        {
+        aSet = KVideoQualitySets[candidate];
+        }
+    else
+        {
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+inline void TVideoQualitySelector::GetVideoQualitySetL( SVideoQualitySet& aSet, const TPtrC8& aVideoCodecMimeType )
+    {
+    TPtrC8 settingsMimeType;
+    
+    TInt i;
+    for ( i = ENumberOfQualitySets-1; i >= 0; i-- ) // searches from up to down to find higher quality first
+        {
+        settingsMimeType.Set(TPtrC8(KVideoQualitySets[i].iVideoCodecMimeType));
+        if ( settingsMimeType.MatchF( (const TDesC8& )aVideoCodecMimeType ) != KErrNotFound ) 
+            {
+            // found
+            aSet = KVideoQualitySets[i];
+            return;
+            }
+        }
+    User::Leave( KErrNotSupported );
+    }
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/vedqualitysettingsvariation.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEDQUALITYSETTINGSVARIATION_H__
+#define __VEDQUALITYSETTINGSVARIATION_H__
+
+
+#include "vedqualitysettingsapi.h"
+
+#if 0
+
+/*
+ *  This is a sample configuration
+ */
+
+/*
+ *  Enumerations for video levels.
+ *  Each configuration MUST have the following enumerations defined. They can be overlapping, but they must exist. Otherwise the compiling of
+ *  of video applications will fail.
+ */
+enum TVideoInternalQualityLevels
+    {
+    EQualityLegacy = 0,     // If a set exist that is lower than the default MMS, e.g. subQCIF
+    EQualityLow = 0,        // Low / MMS quality
+    EQualityMedium = 1,     // Medium/normal quality
+    EQualityHigh = 2,       // Highest quality
+    ENumberOfQualitySets = 3
+    };
+
+/*
+ *  Definition of video quality sets.
+ *  Each configuration MUST have the following variable with size ENumberOfQualitySets
+ *  For explanation of the members, please see vedqualitysettingsapi.h
+ */
+static const SVideoQualitySet KVideoQualitySets[ENumberOfQualitySets] =
+    {
+        //a sample set for MMS == EQualityLow
+        { ETrue, "video/3gpp", "video/H263-2000", 176, 144, 15.0, 60000, 0.2, " AMR", 12200, 8000, 1 },
+            // other sets for other levels
+    };
+
+
+#endif
+
+
+
+
+
+
+
+
+
+/*
+ *  Actual variations of video settings for different configurations
+ */
+ 
+#ifdef NCP_COMMON_TEFLON_FAMILY
+// Quality sets for 
+
+enum TVideoInternalQualityLevels
+    {
+    EQualityLegacy = 0,
+    EQualityLow = 1,
+    EQualityMedium = 2,
+    EQualityHigh = 6,
+    ENumberOfQualitySets = 7,
+    ENumberOfWideQualitySets = 0
+    };
+
+static const SVideoQualitySet KVideoQualitySets[ENumberOfQualitySets] =
+    {
+        // Legacy subQCIF support
+        { ETrue, "video/3gpp", "video/H263-2000", 128, 96, 15.0, 60000, 0.2, " AMR", 12200, 8000, 1 },
+        // MMS
+        { ETrue, "video/3gpp", "video/H263-2000", 176, 144, 15.0, 60000, 0.2, " AMR", 12200, 8000, 1 },
+        // Normal
+        { ETrue, "video/mp4", "video/mp4v-es; profile-level-id=2", 320, 240, 15.0, 512000, 0.5, " AAC", 48000, 16000, 1 },
+        // Normal+
+        { ETrue, "video/mp4", "video/mp4v-es; profile-level-id=3", 320, 240, 30.0, 1024000, 0.5, " AAC", 48000, 16000, 1 },
+        // CIF settings in case of CIF input is dominating, to avoid transcoding to QVGA
+        { ETrue, "video/mp4", "video/mp4v-es; profile-level-id=2", 352, 288, 15.0, 512000, 0.5, " AAC", 48000, 16000, 1 },
+        // HighMinus; level 4a
+        { ETrue, "video/mp4", "video/mp4v-es; profile-level-id=4", 640, 480, 15.0, 2048000, 1.0, " AAC", 96000, 48000, 1 },
+        // High; level 4a
+        { ETrue, "video/mp4", "video/mp4v-es; profile-level-id=4", 640, 480, 30.0, 3072000, 1.0, " AAC", 96000, 48000, 1 }
+    };
+
+static const SVideoQualitySet KVideoQualitySetsWide[1] = {{ EFalse, "", "", 0, 0, 0.0, 0, 0, "", 0, 0, 0 }};
+
+#else
+// Quality sets e.g. for , WINSCW
+
+#ifndef SPP_VSW_VIDEOEDITORENGINE_AVC_EDITING
+enum TVideoInternalQualityLevels
+    {
+    EQualityLegacy = 0,
+    EQualityLow = 1,
+    EQualityMedium = 2,
+    EQualityHigh = 3,
+    ENumberOfQualitySets = 5,
+    ENumberOfWideQualitySets = 4
+    };
+
+static const SVideoQualitySet KVideoQualitySets[ENumberOfQualitySets] =
+    {
+        // Legacy subQCIF support
+        { ETrue, "video/3gpp", "video/H263-2000", 128, 96, 15.0, 60000, 0.2, " AMR", 12200, 8000, 1 },
+        // MMS
+        { ETrue, "video/3gpp", "video/H263-2000", 176, 144, 15.0, 60000, 0.2, " AMR", 12200, 8000, 1 },
+        // Normal; H.263 level 45
+        { ETrue, "video/3gpp", "video/H263-2000; profile=0; level=45", 176, 144, 15.0, 124000, 0.2, " AMR", 12200, 8000, 1 },
+        // High
+        { ETrue, "video/mp4", "video/mp4v-es; profile-level-id=2", 320, 240, 15.0, 512000, 0.5, " AAC", 72000, 48000, 1 },
+        // High+
+        { ETrue, "video/mp4", "video/mp4v-es; profile-level-id=2", 352, 288, 15.0, 512000, 0.5, " AAC", 72000, 48000, 1 },
+    };
+    
+static const SVideoQualitySet KVideoQualitySetsWide[ENumberOfWideQualitySets] =
+    {
+        // Legacy 
+        { ETrue, "video/3gpp", "video/H263-2000", 128, 96, 15.0, 60000, 0.2, " AMR", 12200, 8000, 1 },        
+        // Low
+        { EFalse, "video/mp4", "video/mp4v-es; profile-level-id=4", 640, 352, 10.0, 256000, 1.0, " AAC", 72000, 48000, 1 },        
+        // Medium
+        { EFalse, "video/mp4", "video/mp4v-es; profile-level-id=4", 640, 352, 15.0, 1024000, 1.0, " AAC", 72000, 48000, 1 },        
+        // High
+        { EFalse, "video/mp4", "video/mp4v-es; profile-level-id=4", 640, 352, 15.0, 2048000, 1.0, " AAC", 72000, 48000, 1 },
+    };    
+
+    
+#else // AVC support
+
+enum TVideoInternalQualityLevels
+    {
+    EQualityLegacy = 0,
+    EQualityLow = 1,
+    EQualityMedium = 3,
+    EQualityHigh = 7,
+    ENumberOfQualitySets = 9,
+    ENumberOfWideQualitySets = 8
+    };
+
+static const SVideoQualitySet KVideoQualitySets[ENumberOfQualitySets] =
+    {
+    
+        // Legacy subQCIF support
+        { ETrue, "video/3gpp", "video/H263-2000", 128, 96, 15.0, 60000, 0.2, " AMR", 12200, 8000, 1 },
+        // MMS
+        { ETrue, "video/3gpp", "video/H263-2000", 176, 144, 15.0, 60000, 0.2, " AMR", 12200, 8000, 1 },
+        // MMS+1
+        { ETrue, "video/3gpp", "video/H264; profile-level-id=42900B", 176, 144, 15.0, 124000, 0.2, " AMR", 12200, 8000, 1 },
+        // Medium
+        { ETrue, "video/mp4", "video/mp4v-es; profile-level-id=2", 320, 240, 15.0, 512000, 0.5, " AAC", 72000, 48000, 1 },
+        // Medium+
+        { ETrue, "video/mp4", "video/H264; profile-level-id=42800C", 320, 240, 15.0, 384000, 0.5, " AAC", 72000, 48000, 1 },
+        // Medium++
+        { ETrue, "video/mp4", "video/mp4v-es; profile-level-id=2", 352, 288, 15.0, 512000, 0.5, " AAC", 72000, 48000, 1 },
+        // Medium+++
+        { ETrue, "video/mp4", "video/H264; profile-level-id=42800C", 352, 288, 15.0, 384000, 0.5, " AAC", 72000, 48000, 1 },
+        // High
+        { ETrue, "video/mp4", "video/mp4v-es; profile-level-id=4", 640, 480, 15.0, 2048000, 1.0, " AAC", 72000, 48000, 1 },
+        // High+
+        { ETrue, "video/mp4", "video/mp4v-es; profile-level-id=4", 640, 480, 30.0, 3072000, 1.0, " AAC", 72000, 48000, 1 },
+        
+    };
+    
+static const SVideoQualitySet KVideoQualitySetsWide[ENumberOfWideQualitySets] =
+    {        
+        
+        // Legacy 
+        { ETrue, "video/3gpp", "video/H263-2000", 128, 96, 15.0, 60000, 0.2, " AMR", 12200, 8000, 1 },        
+        // Low
+        { EFalse, "video/mp4", "video/mp4v-es; profile-level-id=4", 640, 352, 10.0, 256000, 1.0, " AAC", 72000, 48000, 1 },
+        // dummy       
+        { EFalse, "", "", 0, 0, 0.0, 0, 0, "", 0, 0, 0 },        
+        // Medium
+        { EFalse, "video/mp4", "video/mp4v-es; profile-level-id=4", 640, 352, 15.0, 1024000, 1.0, " AAC", 72000, 48000, 1 },
+        // dummy
+        { EFalse, "", "", 0, 0, 0.0, 0, 0, "", 0, 0, 0 },
+        // dummy
+        { EFalse, "", "", 0, 0, 0.0, 0, 0, "", 0, 0, 0 },
+        // dummy
+        { EFalse, "", "", 0, 0, 0.0, 0, 0, "", 0, 0, 0 },                
+        // High
+        { EFalse, "video/mp4", "video/mp4v-es; profile-level-id=4", 640, 352, 25.0, 2048000, 1.0, " AAC", 72000, 48000, 1 },                
+        
+    };    
+
+#endif
+
+
+//static const SVideoQualitySet KVideoQualitySetsWide[1] = {{ EFalse, "", "", 0, 0, 0.0, 0, 0, "", 0, 0, 0 }};
+
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/vedvideoconversion.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEDVIDEOCONVERSION_H__
+#define __VEDVIDEOCONVERSION_H__
+
+#include <e32base.h>
+#include <f32file.h>
+
+enum TMMSCompatibility
+{
+     ECompatible,
+     ECutNeeded,  // Only cut or also format conversion
+     EConversionNeeded,  // File small enough, format wrong
+     EIncompatible  // Wrong format, cannot convert
+};
+
+#define KVedOriginalDuration TTimeIntervalMicroSeconds(-1)
+
+class CVideoConverter;
+
+class MVideoConverterObserver
+{
+
+    public:
+    
+        virtual void MvcoFileInserted(CVideoConverter& aConverter) = 0;
+        
+        virtual void MvcoFileInsertionFailed(CVideoConverter& aConverter, TInt aError) = 0;
+
+        virtual void MvcoConversionStartedL(CVideoConverter& aConverter) = 0;
+    
+        virtual void MvcoConversionProgressed(CVideoConverter& aConverter, TInt aPercentage) = 0;
+    
+        virtual void MvcoConversionCompleted(CVideoConverter& aConverter, TInt aError) = 0;
+};
+
+
+class CVideoConverter : public CBase
+{
+
+    public:
+    
+        IMPORT_C static CVideoConverter* NewL(MVideoConverterObserver& aObserver);
+        
+        IMPORT_C static CVideoConverter* NewLC(MVideoConverterObserver& aObserver);
+        
+        // Insert file to be checked / converted
+        virtual void InsertFileL(RFile* aFile) = 0;
+
+        // check compatibility
+        virtual TMMSCompatibility CheckMMSCompatibilityL(TInt aMaxSize) = 0;
+                
+        // get estimate for end time based on start time and target size
+        virtual void GetDurationEstimateL(TInt aTargetSize, TTimeIntervalMicroSeconds aStartTime, 
+                                          TTimeIntervalMicroSeconds& aEndTime) = 0;
+        
+        // Start converting file
+        virtual void ConvertL(RFile* aOutputFile, TInt aSizeLimit,
+                              TTimeIntervalMicroSeconds aCutInTime = TTimeIntervalMicroSeconds(0),
+                              TTimeIntervalMicroSeconds aCutOutTime = KVedOriginalDuration) = 0;
+        
+        // Cancel
+        virtual TInt CancelConversion() = 0;
+        
+        // Reset converter, remove file etc.
+        virtual TInt Reset() = 0;
+
+};
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/vedvideoconversionimp.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef __VEDVIDEOCONVERSIONIMP_H__
+#define __VEDVIDEOCONVERSIONIMP_H__
+
+#include <vedmovie.h>
+#include "vedvideoconversion.h"
+
+class CVideoConverterImp : public CVideoConverter, public MVedMovieObserver,
+                           public MVedMovieProcessingObserver
+{
+
+    public:  // Functions from CVideoConverter 
+    
+        static CVideoConverterImp* NewL(MVideoConverterObserver& aObserver);
+        
+        static CVideoConverterImp* NewLC(MVideoConverterObserver& aObserver);
+        
+        ~CVideoConverterImp();
+        
+        void InsertFileL(RFile* aFile);
+
+        TMMSCompatibility CheckMMSCompatibilityL(TInt aMaxSize);
+                
+        void GetDurationEstimateL(TInt aTargetSize, TTimeIntervalMicroSeconds aStartTime, 
+                                  TTimeIntervalMicroSeconds& aEndTime);
+        
+        void ConvertL(RFile* aOutputFile, TInt aSizeLimit, 
+                      TTimeIntervalMicroSeconds aCutInTime, 
+                      TTimeIntervalMicroSeconds aCutOutTime);
+                    
+        TInt CancelConversion();
+        
+        TInt Reset();
+        
+    public:  // Functions from MVedMovieObserver
+    
+        //from observer
+    	void NotifyVideoClipAdded(CVedMovie& aMovie, TInt aIndex);
+    	void NotifyVideoClipAddingFailed(CVedMovie& aMovie, TInt aError);    	
+    	void NotifyVideoClipRemoved(CVedMovie& aMovie, TInt aIndex);
+    	void NotifyVideoClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, TInt aNewIndex);
+    	void NotifyVideoClipTimingsChanged(CVedMovie& aMovie, TInt aIndex);
+    	void NotifyVideoClipSettingsChanged(CVedMovie& aMovie, TInt aIndex);    	
+    	void NotifyStartTransitionEffectChanged(CVedMovie& aMovie);
+    	void NotifyMiddleTransitionEffectChanged(CVedMovie& aMovie, TInt aIndex);
+    	void NotifyEndTransitionEffectChanged(CVedMovie& aMovie);
+    	void NotifyAudioClipAdded(CVedMovie& aMovie, TInt aIndex);
+    	void NotifyAudioClipAddingFailed(CVedMovie& aMovie, TInt aError);
+    	void NotifyAudioClipRemoved(CVedMovie& aMovie, TInt aIndex);
+    	void NotifyAudioClipIndicesChanged(CVedMovie& aMovie, TInt aOldIndex, TInt aNewIndex);
+    	void NotifyAudioClipTimingsChanged(CVedMovie& aMovie, TInt aIndex);
+        void NotifyMovieReseted(CVedMovie& aMovie);
+        void NotifyVideoClipGeneratorSettingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/);
+        void NotifyMovieOutputParametersChanged(CVedMovie& aMovie);
+        void NotifyVideoClipColorEffectChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/);
+        void NotifyVideoClipAudioSettingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/);                
+        void NotifyMovieProcessingStartedL(CVedMovie& /*aMovie*/);
+        void NotifyMovieProcessingProgressed(CVedMovie& aMovie, TInt aPercentage);
+    	void NotifyMovieProcessingCompleted(CVedMovie& aMovie, TInt aError);    	
+        void NotifyVideoClipDescriptiveNameChanged(CVedMovie& aMovie, TInt aIndex);
+    	void NotifyMovieQualityChanged(CVedMovie& aMovie);        
+        void NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& aMovie, TInt aClipIndex, TInt aMarkIndex);
+        void NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& aMovie,TInt aClipIndex,TInt aMarkIndex);
+        void NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& aMovie, TInt aClipIndex, TInt aMarkIndex);
+        void NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& aMovie,TInt aClipIndex,TInt aMarkIndex);        
+    
+    private:
+    
+        /*
+        * C++ default constructor.
+        */
+        CVideoConverterImp(MVideoConverterObserver& aObserver);
+        
+        /**
+        * 2nd phase constructor 
+        */
+        void ConstructL();	    
+        
+    private:
+    
+        // Observer
+        MVideoConverterObserver& iObserver;
+    
+        // Movie
+        CVedMovie* iMovie;
+        
+        friend class CVideoConverter;
+};
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/inc/vedvideosettings.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for video related settings/constants.
+*
+*/
+
+
+#ifndef __VEDVIDEOSETTINGS_H__
+#define __VEDVIDEOSETTINGS_H__
+
+// VIDEO ENCODER RELATED SETTINGS / DEFAULTS
+
+// Maximum supported resolution
+//WVGA task
+const TUint KVedMaxVideoWidth = 864;
+//const TUint KVedMaxVideoWidth = 640;
+const TUint KVedMaxVideoHeight = 480;
+
+// Max duration for video frame in microseconds. This limits the slow motion effect.
+// This now limits the duration to 30 seconds which is already a very extreme case. This has impact to MPEG4's module_time_base variable 
+// which should not be longer than 32 bits since there are some variables e.g. in video decoder than can handle only 32-bit fields. 
+const TInt KVedMaxFrameDuration(30000000);
+
+// target/maximum bitrates  
+const TUint KVedBitRateH263Level10 = 64000;
+const TUint KVedBitRateH263Level20 = 512000;
+const TUint KVedBitRateH263Level45 = 128000;
+const TUint KVedBitRateMPEG4Level0 = 64000;
+const TUint KVedBitRateMPEG4Level0B = 128000;
+const TUint KVedBitRateMPEG4Level1 = 64000;
+const TUint KVedBitRateMPEG4Level2 = 512000;
+const TUint KVedBitRateMPEG4Level3 = 1024000;
+const TUint KVedBitRateMPEG4Level4A = 4000000;
+
+const TUint KVedBitRateAVCLevel1 = 64000;
+const TUint KVedBitRateAVCLevel1b = 128000;
+const TUint KVedBitRateAVCLevel1_1 = 192000;
+const TUint KVedBitRateAVCLevel1_2 = 384000;
+const TUint KVedBitRateAVCLevel1_3 = 768000;
+const TUint KVedBitRateAVCLevel2 = 2000000;
+//WVGA task
+const TUint KVedBitRateAVCLevel2_1 = 4000000;
+const TUint KVedBitRateAVCLevel2_2 = 4000000;
+const TUint KVedBitRateAVCLevel3 = 10000000;
+const TUint KVedBitRateAVCLevel3_1 = 14000000;
+
+
+const TReal KVedMaxVideoFrameRate = 15.0;
+
+// number of frames for transition effect - NOTE: This must be an even number !!!
+const TUint KNumTransitionFrames = 10; 
+
+#define KVedResolutionSubQCIF       (TSize(128,96))
+#define KVedResolutionQCIF          (TSize(176,144))
+#define KVedResolutionCIF           (TSize(352,288))
+#define KVedResolutionQVGA          (TSize(320,240))
+#define KVedResolutionVGA16By9      (TSize(640,352))
+#define KVedResolutionVGA           (TSize(640,480))
+//WVGA task
+#define KVedResolutionWVGA           (TSize(864,480))
+
+
+const TUint KMaxCodedPictureSizeQCIF = 16384; // QCIF and smaller
+const TUint KMaxCodedPictureSizeCIF = 65536; // CIF and smaller
+const TUint KMaxCodedPictureSizeMPEG4QCIF = 20480; // QCIF and smaller
+const TUint KMaxCodedPictureSizeMPEG4L0BQCIF = 40960; // QCIF and smaller
+const TUint KMaxCodedPictureSizeMPEG4CIF = 81920; // MPEG-4 CIF
+const TUint KMaxCodedPictureSizeVGA = 163840; // For vga support
+//WVGA task
+const TUint KMaxCodedPictureSizeWVGA = 327680; // For WVGA support
+
+const TUint KMaxCodedPictureSizeAVCLevel1 = 21875;
+const TUint KMaxCodedPictureSizeAVCLevel1B = 43750;
+const TUint KMaxCodedPictureSizeAVCLevel1_1 = 62500;
+const TUint KMaxCodedPictureSizeAVCLevel1_2 = 125000;
+const TUint KMaxCodedPictureSizeAVCLevel1_3 = 250000;
+const TUint KMaxCodedPictureSizeAVCLevel2 = 250000;
+//WVGA task
+const TUint KMaxCodedPictureSizeAVCLevel2_1 = 500000;
+const TUint KMaxCodedPictureSizeAVCLevel2_2 = 1000000;
+const TUint KMaxCodedPictureSizeAVCLevel3 = 2000000;
+const TUint KMaxCodedPictureSizeAVCLevel3_1 = 4000000;
+
+_LIT8(KVedMimeTypeH263, "video/H263-2000");
+_LIT8(KVedMimeTypeH263BaselineProfile, "video/H263-2000; profile=0");
+_LIT8(KVedMimeTypeH263Level10, "video/H263-2000; profile=0; level=10");
+_LIT8(KVedMimeTypeH263Level45, "video/H263-2000; profile=0; level=45");
+
+_LIT8(KVedMimeTypeMPEG4Visual, "video/mp4v-es");
+_LIT8(KVedMimeTypeMPEG4SimpleVisualProfile, "video/mp4v-es; profile-level-id=8");
+_LIT8(KVedMimeTypeMPEG4SimpleVisualProfileLevel2, "video/mp4v-es; profile-level-id=2");
+_LIT8(KVedMimeTypeMPEG4SimpleVisualProfileLevel3, "video/mp4v-es; profile-level-id=3");
+_LIT8(KVedMimeTypeMPEG4SimpleVisualProfileLevel4A, "video/mp4v-es; profile-level-id=4");
+
+_LIT8(KVedMimeTypeAVC, "video/H264");
+_LIT8(KVedMimeTypeAVCBaselineProfileLevel1, "video/H264; profile-level-id=42800A");
+_LIT8(KVedMimeTypeAVCBaselineProfileLevel1B, "video/H264; profile-level-id=42900B");
+_LIT8(KVedMimeTypeAVCBaselineProfileLevel1_1, "video/H264; profile-level-id=42800B");
+_LIT8(KVedMimeTypeAVCBaselineProfileLevel1_2, "video/H264; profile-level-id=42800C");
+_LIT8(KVedMimeTypeAVCBaselineProfileLevel1_3, "video/H264; profile-level-id=42800D");
+_LIT8(KVedMimeTypeAVCBaselineProfileLevel2, "video/H264; profile-level-id=428014");
+
+//WVGA task
+_LIT8(KVedMimeTypeAVCBaselineProfileLevel2_1, "video/H264; profile-level-id=428015");
+_LIT8(KVedMimeTypeAVCBaselineProfileLevel2_2, "video/H264; profile-level-id=428016");
+_LIT8(KVedMimeTypeAVCBaselineProfileLevel3, "video/H264; profile-level-id=42801E");
+_LIT8(KVedMimeTypeAVCBaselineProfileLevel3_1, "video/H264; profile-level-id=42801F");
+
+// 3gpmp4 buffer sizes
+const TInt K3gpMp4ComposerWriteBufferSize = 65536;
+const TInt K3gpMp4ComposerNrOfWriteBuffers = 10;
+const TInt K3gpMp4ParserReadBufferSize = 8192;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/src/VedAudioClipInfoImp.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,598 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "VedAudioClipInfoImp.h"
+#include "AudClip.h"
+#include "AudClipInfo.h"
+
+#include "movieprocessor.h"
+
+// Print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfo::NewL
+// Constructs a new CVedAudioClipInfo object
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVedAudioClipInfo* CVedAudioClipInfo::NewL(const TDesC& aFileName,
+                                                    MVedAudioClipInfoObserver& aObserver)
+    {
+    CVedAudioClipInfoImp* self = (CVedAudioClipInfoImp*)NewLC(aFileName, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+    
+EXPORT_C CVedAudioClipInfo* CVedAudioClipInfo::NewL(RFile* aFileHandle,
+                                                    MVedAudioClipInfoObserver& aObserver)
+    {
+    CVedAudioClipInfoImp* self = (CVedAudioClipInfoImp*)NewLC(aFileHandle, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfo::NewLC
+// Constructs a new CVedAudioClipInfo object, leaves it to cleanupstack
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVedAudioClipInfo* CVedAudioClipInfo::NewLC(const TDesC& aFileName,
+                                                     MVedAudioClipInfoObserver& aObserver)
+    {
+    CVedAudioClipInfoImp* self = new (ELeave) CVedAudioClipInfoImp();
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileName, aObserver);
+    return self;
+    }
+
+EXPORT_C CVedAudioClipInfo* CVedAudioClipInfo::NewLC(RFile* aFileHandle,
+                                                     MVedAudioClipInfoObserver& aObserver)
+    {
+    CVedAudioClipInfoImp* self = new (ELeave) CVedAudioClipInfoImp();
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileHandle, aObserver);
+    return self;
+    }
+
+
+CVedAudioClipInfoImp* CVedAudioClipInfoImp::NewL(CAudClip* aAudClip,
+                                                 MVedAudioClipInfoObserver& aObserver)
+    {
+    CVedAudioClipInfoImp* self = (CVedAudioClipInfoImp*)NewLC(aAudClip, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+CVedAudioClipInfoImp* CVedAudioClipInfoImp::NewLC(CAudClip* aAudClip,
+                                            MVedAudioClipInfoObserver& aObserver)
+    {
+    CVedAudioClipInfoImp* self = new (ELeave) CVedAudioClipInfoImp();
+    CleanupStack::PushL(self);
+    self->ConstructL(aAudClip, aObserver);
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfo::CVedAudioClipInfoImp
+// Constuctor 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVedAudioClipInfoImp::CVedAudioClipInfoImp()
+        : iReady(EFalse)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::ConstructL
+// Symbian two phased constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+    
+void CVedAudioClipInfoImp::ConstructL(CAudClip* aAudClip, 
+                                      MVedAudioClipInfoObserver& aObserver)
+    {
+    PRINT(_L("CVedAudioClipInfoImp::ConstructL in"));
+    iAudClip = aAudClip;
+    iAudClipInfo = iAudClip->Info();
+    iAudioProperties = iAudClipInfo->Properties();
+    iReady = ETrue;
+    iObserver = &aObserver;
+    iOperation = CVedAudioClipInfoOperation::NewL(this, aObserver);
+    PRINT(_L("CVedAudioClipInfoImp::ConstructL out"));
+    }
+    
+void CVedAudioClipInfoImp::ConstructL(const TDesC& aFileName, 
+                                     MVedAudioClipInfoObserver& aObserver)
+    {
+    
+    PRINT(_L("CVedAudioClipInfoImp::ConstructL in"));
+    iReady = EFalse;
+    iAudClipInfo = CAudClipInfo::NewL(aFileName, *this);
+    
+    iObserver = &aObserver;
+    PRINT(_L("CVedAudioClipInfoImp::ConstructL out"));
+    }
+    
+void CVedAudioClipInfoImp::ConstructL(RFile* aFileHandle, 
+                                     MVedAudioClipInfoObserver& aObserver)
+    {
+    
+    PRINT(_L("CVedAudioClipInfoImp::ConstructL in"));
+    iReady = EFalse;
+    iAudClipInfo = CAudClipInfo::NewL(aFileHandle, *this);
+    
+    iObserver = &aObserver;
+    PRINT(_L("CVedAudioClipInfoImp::ConstructL out"));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::~CVedAudioClipInfoImp
+// Destroys the object and releases all resources.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVedAudioClipInfoImp::~CVedAudioClipInfoImp()
+    {
+    
+    if (iAudClipInfo != 0 && !iAudClip) 
+    {
+    delete iAudClipInfo;
+    }
+    
+    delete iOperation;    
+    REComSession::FinalClose();
+    }
+
+
+void CVedAudioClipInfoImp::NotifyClipInfoReady(CAudClipInfo& aInfo, TInt aError)
+    {
+    if (aError == KErrNone)
+        {
+        iAudioProperties = aInfo.Properties();    
+        iReady = ETrue;
+        }
+
+    iObserver->NotifyAudioClipInfoReady(*this, aError);
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::ChannelMode
+// Returns the channel mode of the audio if applicable.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TVedAudioChannelMode CVedAudioClipInfoImp::ChannelMode() const
+    {
+    
+    __ASSERT_ALWAYS(iReady, TVedPanic::Panic(TVedPanic::EAudioClipInfoNotReady));
+    
+    TVedAudioChannelMode vedChannelMode = EVedAudioChannelModeUnrecognized;
+    if (iAudioProperties.iChannelMode == EAudStereo)
+        {
+        vedChannelMode = EVedAudioChannelModeStereo;
+        }
+    else if (iAudioProperties.iChannelMode == EAudSingleChannel)
+        {
+        vedChannelMode = EVedAudioChannelModeSingleChannel;
+        }
+    else if (iAudioProperties.iChannelMode == EAudDualChannel)
+        {
+        vedChannelMode = EVedAudioChannelModeDualChannel;
+        }
+
+    return vedChannelMode;   
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::SamplingRate
+// Returns the sampling rate in hertz.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CVedAudioClipInfoImp::SamplingRate() const
+    {
+    
+    __ASSERT_ALWAYS(iReady, TVedPanic::Panic(TVedPanic::EAudioClipInfoNotReady));
+    
+    return iAudioProperties.iSamplingRate;
+
+    }
+  
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::Format
+// Returns the audio format
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TVedAudioFormat CVedAudioClipInfoImp::Format() const 
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EAudioClipInfoNotReady));
+
+    TVedAudioFormat vedAudioFormat = EVedAudioFormatUnrecognized;
+
+    switch(iAudioProperties.iFileFormat) 
+        {
+    case EAudFormat3GPP:
+        vedAudioFormat = EVedAudioFormat3GPP;
+        break;
+    case EAudFormatMP4:
+        vedAudioFormat = EVedAudioFormatMP4;
+        break;
+    case EAudFormatAMR:
+        vedAudioFormat = EVedAudioFormatAMR;
+        break;
+    case EAudFormatAMRWB:
+        vedAudioFormat = EVedAudioFormatAMRWB;
+        break;
+    case EAudFormatMP3:
+        vedAudioFormat = EVedAudioFormatMP3;
+        break;
+    case EAudFormatAAC_ADIF:
+        vedAudioFormat = EVedAudioFormatAAC_ADIF;
+        break;
+    case EAudFormatAAC_ADTS:
+        vedAudioFormat = EVedAudioFormatAAC_ADTS;
+        break;
+    case EAudFormatWAV:
+        vedAudioFormat = EVedAudioFormatWAV;
+        break;
+    default:
+        TVedPanic::Panic(TVedPanic::EInternal);
+        }
+    
+    return vedAudioFormat;
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::BitrateMode
+// Returns the bitrate mode
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TVedBitrateMode CVedAudioClipInfoImp::BitrateMode() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EAudioClipInfoNotReady));
+    
+    TVedBitrateMode vedBitrateMode = EVedBitrateModeUnrecognized;
+    switch(iAudioProperties.iBitrateMode) 
+        {
+    case EAudConstant:
+        vedBitrateMode = EVedBitrateModeConstant;
+        break;
+    case EAudVariable:
+        vedBitrateMode = EVedBitrateModeVariable;
+        break;
+    default:
+        TVedPanic::Panic(TVedPanic::EInternal);
+        }
+    return vedBitrateMode;
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::Bitrate
+// Returns the bitrate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TInt CVedAudioClipInfoImp::Bitrate() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EAudioClipInfoNotReady));
+    return iAudioProperties.iBitrate;
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::GetVisualizationL
+// Generates a visualization of the audio clip
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CVedAudioClipInfoImp::GetVisualizationL(MVedAudioClipVisualizationObserver& aObserver, TInt aResolution, TInt aPriority)
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EAudioClipInfoNotReady));
+
+    iVisualizationObserver = &aObserver;
+    iAudClipInfo->GetVisualizationL(*this, aResolution, aPriority);
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::CancelVisualizationL
+// Cancels visualization generation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CVedAudioClipInfoImp::CancelVisualizationL()
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EAudioClipInfoNotReady));
+    
+    iAudClipInfo->CancelVisualization();
+    }
+    
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::NotifyClipInfoVisualizationCompleted
+// Callback for visualization complete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CVedAudioClipInfoImp::NotifyClipInfoVisualizationCompleted(const CAudClipInfo& /*aClipInfo*/, TInt aError, TInt8* aVisualization, TInt aSize)
+    {
+    iVisualizationObserver->NotifyAudioClipVisualizationCompleted(*this, aError, aVisualization, aSize);
+    iVisualizationObserver = 0;
+    }
+    
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::NotifyClipInfoVisualizationStarted
+// Callback for visualization started 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CVedAudioClipInfoImp::NotifyClipInfoVisualizationStarted(const CAudClipInfo& /*aClipInfo*/, TInt aError)
+    {
+    if (aError != KErrNone) 
+        {
+        iVisualizationObserver->NotifyAudioClipVisualizationCompleted(*this, aError, NULL, 0);
+        iVisualizationObserver = 0;
+        }
+    else
+        {
+        iVisualizationObserver->NotifyAudioClipVisualizationStarted(*this);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::NotifyClipInfoVisualizationProgressed
+// Callback for visualization progress
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CVedAudioClipInfoImp::NotifyClipInfoVisualizationProgressed(const CAudClipInfo& /*aClipInfo*/, TInt aPercentage)
+    {
+    iVisualizationObserver->NotifyAudioClipVisualizationProgressed(*this, aPercentage);
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::
+// Returns the audio clip filename
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TPtrC CVedAudioClipInfoImp::FileName() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EAudioClipInfoNotReady));
+
+    return iAudClipInfo->FileName();
+
+    }
+    
+RFile* CVedAudioClipInfoImp::FileHandle() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EAudioClipInfoNotReady));
+
+    return iAudClipInfo->FileHandle();
+
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::Type
+// Returns the audio type
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TVedAudioType CVedAudioClipInfoImp::Type() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EAudioClipInfoNotReady));
+
+    TVedAudioType vedAudioType = EVedAudioTypeUnrecognized;
+
+    if (iAudioProperties.iAudioType == EAudAMR)
+        {
+        vedAudioType = EVedAudioTypeAMR;
+        }
+    else if (iAudioProperties.iAudioType == EAudAMRWB)
+        {
+        vedAudioType = EVedAudioTypeAMRWB;
+        }
+    else if (iAudioProperties.iAudioType == EAudMP3)
+        {
+        vedAudioType = EVedAudioTypeMP3;
+        }
+    else if (iAudioProperties.iAudioType == EAudAAC_MPEG2 || iAudioProperties.iAudioType == EAudAAC_MPEG4 )
+        {
+        vedAudioType = EVedAudioTypeAAC_LC;
+        }
+    else if (iAudioProperties.iAudioType == EAudWAV)
+        {
+        vedAudioType = EVedAudioTypeWAV;
+        }
+
+    return vedAudioType;
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::Duration
+// Returns the audio clip duration
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TTimeIntervalMicroSeconds CVedAudioClipInfoImp::Duration() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EAudioClipInfoNotReady));
+
+    return iAudioProperties.iDuration;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoImp::Compare
+// Compares two audio clip info classes
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TInt CVedAudioClipInfoImp::Compare(const CVedAudioClipInfoImp& c1, 
+                                   const CVedAudioClipInfoImp& c2) 
+    {
+
+
+    if (c1.iAudClip == 0 || c2.iAudClip == 0)
+        {
+        return 0;
+        }
+    if (c1.iAudClip->StartTime() > c2.iAudClip->StartTime()) 
+        {
+        return 1;
+        }
+    else if (c1.iAudClip->StartTime() < c2.iAudClip->StartTime()) 
+        {
+        return -1;
+        }
+    else 
+        {
+        return 0;
+        }
+    }
+
+//////////////////////////////////////////////////////////////////////////
+
+
+// CVedAudioClipInfoOperation
+// 
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoOperation::NewL
+// Constructs a new CVedAudioClipInfoOperation object.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVedAudioClipInfoOperation* CVedAudioClipInfoOperation::NewL(CVedAudioClipInfoImp* aInfo,
+                                                             MVedAudioClipInfoObserver& aObserver)
+    {
+    CVedAudioClipInfoOperation* self = 
+        new (ELeave) CVedAudioClipInfoOperation(aInfo, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoOperation::CVedAudioClipInfoOperation
+// Constructor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVedAudioClipInfoOperation::CVedAudioClipInfoOperation(CVedAudioClipInfoImp* aInfo,
+                                                       MVedAudioClipInfoObserver& aObserver)
+        : CActive(EPriorityStandard), iObserver(aObserver), iInfo(aInfo)
+          
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoOperation::ConstructL
+// Symbian two phased constructor
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVedAudioClipInfoOperation::ConstructL()
+    {
+    PRINT(_L("CVedAudioClipInfoOperation::ConstructL in"));
+    
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+
+    PRINT(_L("CVedAudioClipInfoOperation::ConstructL out"));
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoOperation::~CVedAudioClipInfoOperation
+// Destructor
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVedAudioClipInfoOperation::~CVedAudioClipInfoOperation()
+    {
+    Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoOperation::RunError
+// Handle errors from RunL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CVedAudioClipInfoOperation::RunError( TInt aError )
+    {
+    iObserver.NotifyAudioClipInfoReady(*iInfo, aError);
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoOperation::RunL
+// Active objects RunL function ran when request completes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVedAudioClipInfoOperation::RunL()
+    {
+    PRINT(_L("CVedAudioClipInfoOperation::RunL in"));
+    
+    iObserver.NotifyAudioClipInfoReady(*iInfo, KErrNone);
+
+    PRINT(_L("CVedAudioClipInfoOperation::RunL out"));
+    }
+
+// -----------------------------------------------------------------------------
+// CVedAudioClipInfoOperation::DoCancel
+// Cancel ongoing request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVedAudioClipInfoOperation::DoCancel()
+    {
+    iObserver.NotifyAudioClipInfoReady(*iInfo, KErrCancel);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/src/VedMovieImp.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,3762 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "VedMovieImp.h"
+#include "VedVideoClipGenerator.h"
+#include "movieprocessor.h"
+#include "VedVideosettings.h"
+#include "VedAudiosettings.h"
+#include <ecom/ecom.h>
+#include "VedAudioClipInfoImp.h"
+#include "AudSong.h"
+#include "AudClip.h"
+#include "AudClipInfo.h"
+#include "Vedqualitysettingsapi.h"
+#include "ctrtranscoder.h"
+#include "ctrtranscoderobserver.h"
+#include "vedproctimeestimate.h"
+#include "vedcodecchecker.h"
+
+#include <vedcommon.h>
+
+const TInt KVedAudioTrackIndex = 1;
+
+// Print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+
+// Near-dummy observer class for temporary transcoder instance. In practice is only used to provide input framerate
+// to the transcoder
+class CTrObs : public CBase, public MTRTranscoderObserver
+    {
+public:
+    /* Constructor & destructor */
+    
+    inline CTrObs(TReal aFrameRate) : iInputFrameRate(aFrameRate) 
+        {
+        };
+    inline ~CTrObs()
+        {
+        };
+
+    // Dummy methods from MTRTranscoderObserver, just used to complete the observer class
+    inline void MtroInitializeComplete(TInt /*aError*/)
+        {
+        };
+    inline void MtroFatalError(TInt /*aError*/)
+        {
+        };
+    inline void MtroReturnCodedBuffer(CCMRMediaBuffer* /*aBuffer*/) 
+        {
+        };
+    // method to provide clip input framerate to transcoder
+    inline void MtroSetInputFrameRate(TReal& aRate)
+        {
+        aRate = iInputFrameRate;
+        };
+    inline void MtroAsyncStopComplete()
+        {
+        };
+        
+    inline void MtroSuspend()
+        {
+        };
+        
+    inline void MtroResume()
+        {
+        };
+        
+private:// data
+
+        // clip input framerate (fps)
+        TReal iInputFrameRate;
+    
+    };
+   
+    
+// -------- Local functions ---------
+
+// Map video format mimetype to editor's internal enumeration 
+static TVedVideoFormat MapVideoFormatTypes(const TText8* aVideoFormatType)
+    {
+    TPtrC8 mimeType(aVideoFormatType);
+    TBuf8<256> string;
+    string = _L8("video/3gpp");
+    
+    if ( mimeType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+        {
+        return EVedVideoFormat3GPP;
+        }
+    else
+        {
+        string = _L8("video/mp4");
+        if ( mimeType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+            {
+            return EVedVideoFormatMP4;
+            }
+        }
+
+    return EVedVideoFormatUnrecognized;
+    }
+
+// Map video codec mimetype to editor's internal enumeration 
+static TVedVideoType MapVideoCodecTypes(const TText8* aVideoCodecType)
+    {
+    TPtrC8 mimeType(aVideoCodecType);
+    TBuf8<256> string;
+    string = _L8("video/H263*");
+    
+    if ( mimeType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+        {
+        // H.263
+        string = _L8("*level*");
+        if ( mimeType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+            {
+            string = _L8("*level=10");
+            if ( mimeType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+                {
+                return EVedVideoTypeH263Profile0Level10;
+                }
+            string = _L8("*level=45");
+            if ( mimeType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+                {
+                return EVedVideoTypeH263Profile0Level45;
+                }
+            }
+        // no level specified => 10        
+        return EVedVideoTypeH263Profile0Level10;
+        }
+    else
+        {
+        string = _L8("video/mp4v-es*");
+        if ( mimeType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+            {
+            return EVedVideoTypeMPEG4SimpleProfile;
+            }
+            
+        else 
+            {
+            string = _L8("video/h264*");
+            if ( mimeType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+                {
+                return EVedVideoTypeAVCBaselineProfile;
+                }
+            }
+        }
+    return EVedVideoTypeUnrecognized;
+    }
+
+// Map editor's internal enumeration to video codec mimetype
+static void MapVideoCodecTypeToMime(TVedVideoType aType, TBufC8<255>& aMimeType)
+    {
+    switch ( aType )
+        {
+        case EVedVideoTypeH263Profile0Level10:
+            {
+            aMimeType =  KVedMimeTypeH263BaselineProfile;
+            }
+            break;
+        case EVedVideoTypeH263Profile0Level45:
+            {
+            aMimeType = KVedMimeTypeH263Level45;
+            }
+            break;
+        default:
+            {
+            //EVedVideoTypeMPEG4SimpleProfile
+            aMimeType = KVedMimeTypeMPEG4Visual;
+            }
+        }
+    }
+
+
+// Map audio codec fourcc to editor's internal enumeration 
+static TAudType MapAudioCodecTypes(const TText8* aAudioCodecType)
+    {
+    TPtrC8 fourCCType(aAudioCodecType);
+    TBuf8<256> string;
+    string = _L8(" AMR");
+    
+    if ( fourCCType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+        {
+        return EAudAMR;
+        }
+    else  
+        {
+        string = _L8(" AAC");
+        if ( fourCCType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+            {
+            return EAudAAC_MPEG4;
+            }
+        
+        }
+    return EAudTypeUnrecognized;
+    }
+
+// -------- Member functions ---------
+EXPORT_C CVedMovie* CVedMovie::NewL(RFs *aFs)
+    {
+    PRINT(_L("CVedMovie::NewL"));
+
+    CVedMovieImp* self = (CVedMovieImp*)NewLC(aFs);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+    
+EXPORT_C CVedMovie* CVedMovie::NewLC(RFs *aFs)
+    {
+    PRINT(_L("CVedMovie::NewLC"));
+
+    CVedMovieImp* self = new (ELeave) CVedMovieImp(aFs);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+
+CVedMovieImp::CVedMovieImp(RFs *aFs)
+        : iFs(aFs), 
+          iVideoClipArray(8), // Initial size of video clip array is 8
+          iAudioClipInfoArray(8), // Initial size of audio clip array is 8
+          iObserverArray(4), // Initial size of observer array is 4
+          iStartTransitionEffect(EVedStartTransitionEffectNone),
+          iEndTransitionEffect(EVedEndTransitionEffectNone),
+          iQuality(EQualityAutomatic),
+          iNotifyObserver(ETrue),
+          iMovieProcessingObserver(0)
+    {
+    }
+
+
+void CVedMovieImp::ConstructL()
+    {
+    iAudSong = CAudSong::NewL(iFs);
+    iAudSong->RegisterSongObserverL(this);
+    iAddOperation = CVedMovieAddClipOperation::NewL(this);
+    
+    iCodecChecker = CVedCodecChecker::NewL();
+    iProcessor = CMovieProcessor::NewL();
+    
+    PRINT((_L("CVedMovie::ConstructL() CVideoQualitySelector in use")));
+    iQualitySelector = CVideoQualitySelector::NewL();
+    
+    CalculatePropertiesL();
+    }
+
+
+CVedMovieImp::~CVedMovieImp()
+    {
+    DoReset();
+    iObserverArray.Reset();
+
+    delete iAddOperation;
+    delete iCodecChecker;    
+    delete iProcessor;
+
+    delete iAudSong;
+    delete iAddedVideoClipFilename;
+    
+    delete iQualitySelector;
+    
+    REComSession::FinalClose();
+    }
+
+CVedMovie::TVedMovieQuality CVedMovieImp::Quality() const
+    {
+    return iQuality;
+    }
+
+void CVedMovieImp::SetQuality(TVedMovieQuality aQuality)
+    {
+    __ASSERT_ALWAYS(aQuality >= EQualityAutomatic && aQuality < EQualityLast,
+        TVedPanic::Panic(TVedPanic::EMovieIllegalQuality));
+    if (aQuality != iQuality) 
+        {
+        iOutputParamsSet = EFalse;
+        TVedMovieQuality prevQuality = iQuality;
+        iQuality = aQuality;
+        TRAPD(err,CalculatePropertiesL());//should not leave with current implementation, but try to handle it anyway
+        if ( err == KErrNone )
+            {
+            // successful
+            FireMovieQualityChanged(this);
+            }
+        else
+            {
+            // setting was not successful, use the previous value
+            iQuality = prevQuality;
+            TRAP(err,CalculatePropertiesL());// previous should always succee
+            }
+            
+        }
+    }
+
+TVedVideoFormat CVedMovieImp::Format() const
+    {
+    return iFormat;
+    }
+
+TVedVideoType CVedMovieImp::VideoType() const
+    {
+    return iVideoType;
+    }
+
+TSize CVedMovieImp::Resolution() const
+    {
+    return iResolution;
+    }
+
+TInt CVedMovieImp::MaximumFramerate() const
+    {
+    return iMaximumFramerate;
+    }
+
+TVedAudioType CVedMovieImp::AudioType() const
+    {
+    TAudType audioType = iAudSong->OutputFileProperties().iAudioType;
+    TVedAudioType vedAudioType = EVedAudioTypeUnrecognized;
+    
+    if (iAudSong->ClipCount(KAllTrackIndices) == 0)
+        {
+        vedAudioType = EVedAudioTypeNoAudio;
+        }
+    else if (audioType == EAudAMR)
+        {
+        vedAudioType = EVedAudioTypeAMR;
+        }
+    else if (audioType == EAudAAC_MPEG4 )
+        {
+        vedAudioType = EVedAudioTypeAAC_LC;
+        }
+	else if (audioType == EAudNoAudio)
+		{
+		vedAudioType = EVedAudioTypeNoAudio;
+		}
+
+    return vedAudioType;
+    }
+
+TInt CVedMovieImp::AudioSamplingRate() const
+    {
+    return iAudSong->OutputFileProperties().iSamplingRate;
+    }
+
+TVedAudioChannelMode CVedMovieImp::AudioChannelMode() const
+    {
+    TVedAudioChannelMode vedChannelMode = EVedAudioChannelModeUnrecognized;
+    if (iAudSong->OutputFileProperties().iChannelMode == EAudStereo)
+        {
+        vedChannelMode = EVedAudioChannelModeStereo;
+        }
+    else if (iAudSong->OutputFileProperties().iChannelMode == EAudSingleChannel)
+        {
+        vedChannelMode = EVedAudioChannelModeSingleChannel;
+        }
+    else if (iAudSong->OutputFileProperties().iChannelMode == EAudDualChannel)
+        {
+        vedChannelMode = EVedAudioChannelModeDualChannel;
+        }
+    return vedChannelMode;    
+    }
+
+
+TVedBitrateMode CVedMovieImp::AudioBitrateMode() const
+    {
+    TVedBitrateMode vedBitrateMode = EVedBitrateModeUnrecognized;
+    switch(iAudSong->OutputFileProperties().iBitrateMode) 
+        {
+    case EAudConstant:
+        vedBitrateMode = EVedBitrateModeConstant;
+        break;
+    case EAudVariable:
+        vedBitrateMode = EVedBitrateModeVariable;
+        break;
+    default:
+        TVedPanic::Panic(TVedPanic::EInternal);
+        }
+    return vedBitrateMode;
+    }
+TInt CVedMovieImp::AudioBitrate() const
+    {
+    return iAudSong->OutputFileProperties().iBitrate;
+    }
+
+TInt CVedMovieImp::VideoBitrate() const
+    {
+    // restricted bitrate: forces transcoding of video content to this bitrate
+    return iVideoRestrictedBitrate;
+    }
+    
+TInt CVedMovieImp::VideoStandardBitrate() const
+    {
+    // the default bitrate to be used when encoding new content. This can be actually lower than the standard limit
+    // but it is not restricted bitrate that would trigger transcoding to happen
+    return iVideoStandardBitrate;
+    }
+
+TReal CVedMovieImp::VideoFrameRate() const
+    {
+    return iVideoFrameRate;
+    }
+
+// This must not be called for 3gp clips that should always have AMR audio
+// returns ETrue if aAudioProperties contain settings found in input (can be modified by this method)
+// and EFalse if client should decide what to do with them
+TBool CVedMovieImp::MatchAudioPropertiesWithInput( TAudFileProperties& aAudioProperties )
+    {
+    // If there are no audio clips
+    if (iAudSong->ClipCount(KAllTrackIndices) == 0)
+        {
+        return ETrue;
+        }
+        
+    // Go through the audio clips and select the best one
+    TAudFileProperties prop;
+    TAudFileProperties highestProp;
+    TBool highestPropFound = EFalse;
+    
+    for (TInt a = 0; a < iAudSong->ClipCount(KAllTrackIndices); a++)
+        {
+        CAudClip* clip = iAudSong->Clip(a, KAllTrackIndices);        
+        prop = clip->Info()->Properties();
+
+        if ( ( prop.iChannelMode == aAudioProperties.iChannelMode ) &&
+             ( prop.iSamplingRate == aAudioProperties.iSamplingRate ) )
+            {
+            // there is a match => keep the properties
+            PRINT((_L("CVedMovie::MatchAudioPropertiesWithInput() found preferred set from input, sampling rate & channels %d & %d"), prop.iSamplingRate, prop.iChannelMode));
+            return ETrue;
+            }
+        else
+            {
+            // need to stay within limits given by aAudioProperties (it has the highest preferred mode)
+            if ( ( prop.iAudioType == aAudioProperties.iAudioType ) &&
+                 ( prop.iSamplingRate <= aAudioProperties.iSamplingRate ) )
+                {
+                // take the highest channelmode & sampling rate from input. 
+                if ( !highestPropFound || 
+                    ( (prop.iSamplingRate > highestProp.iSamplingRate) ||
+                      ( (prop.iSamplingRate == highestProp.iSamplingRate) && (prop.iChannelMode > highestProp.iChannelMode) ) ) )
+                    {
+                    PRINT((_L("CVedMovie::MatchAudioPropertiesWithInput() found new highest prop from input, sampling rate & channels %d & %d"), prop.iSamplingRate, prop.iChannelMode));
+                    highestProp.iAudioType = prop.iAudioType;
+                    highestProp.iChannelMode = prop.iChannelMode;
+                    highestProp.iSamplingRate = prop.iSamplingRate;
+                    highestPropFound = ETrue;
+                    }
+                }
+            }
+        }
+
+    // if we come here, there was no exact match found. Use the best one, if found
+    if ( highestPropFound )
+        {
+        // take the sampling rate and channel mode from inProp. Currently we support only 16k and 48k output, but this should be changed
+        // once we know what we need to support; but requires synchronization with audio editor engine
+
+        if ( iAudSong->AreOutputPropertiesSupported(highestProp))
+            {
+            PRINT((_L("CVedMovie::MatchAudioPropertiesWithInput() selected audio parameters, sampling rate & channels %d & %d"), highestProp.iSamplingRate, highestProp.iChannelMode));
+            aAudioProperties.iChannelMode = highestProp.iChannelMode;
+            aAudioProperties.iSamplingRate = highestProp.iSamplingRate;
+            aAudioProperties.iBitrate = KAudBitRateDefault; //use default since we don't know the bitrate of the input.
+            return ETrue;
+            }
+        else
+            {
+            // We have some AAC in the input but it is not any of our supported sampling rates. 
+            // The aAudioProperties may have 48k here but since we don't have such high input, better to use 16k in output
+            PRINT((_L("CVedMovie::MatchAudioPropertiesWithInput() no good match with input")));
+            return EFalse;
+            }
+        }
+    else
+        {
+        // Not even a close match
+        PRINT((_L("CVedMovie::MatchAudioPropertiesWithInput() not even a close match with input")));
+        return EFalse;
+        }
+    
+    }
+
+
+// Set video codec mimetype member variable, and also max values that level defines (e.g. max framerate; actual values are taken from quality set)
+void CVedMovieImp::SetVideoCodecMimeType(const TText8* aVideoCodecType)
+    {
+    TPtrC8 mimeType(aVideoCodecType);
+    
+    if ( mimeType.MatchF( KVedMimeTypeH263 ) != KErrNotFound ) 
+        {
+        // H.263 baseline
+        iVideoCodecMimeType.Set(KVedMimeTypeH263BaselineProfile);
+        iMaximumFramerate = 15;
+        }
+    else if ( mimeType.MatchF( KVedMimeTypeH263BaselineProfile ) != KErrNotFound ) 
+        {
+        // H.263 baseline
+        iVideoCodecMimeType.Set(KVedMimeTypeH263BaselineProfile);
+        iMaximumFramerate = 15;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeH263Level45 ) != KErrNotFound )
+        {
+        // H.263 level 45
+        iVideoCodecMimeType.Set(KVedMimeTypeH263Level45);
+        iMaximumFramerate = 15;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeMPEG4SimpleVisualProfileLevel2 ) != KErrNotFound )
+        {
+        // MPEG-4 SP level 2
+        iVideoCodecMimeType.Set(KVedMimeTypeMPEG4SimpleVisualProfileLevel2);
+        iMaximumFramerate = 15;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeMPEG4SimpleVisualProfileLevel3 ) != KErrNotFound )
+        {
+        // MPEG-4 SP level 3
+        iVideoCodecMimeType.Set(KVedMimeTypeMPEG4SimpleVisualProfileLevel3);
+        iMaximumFramerate = 30;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeMPEG4SimpleVisualProfileLevel4A ) != KErrNotFound )
+        {
+        // MPEG-4 SP level 4a
+        iVideoCodecMimeType.Set(KVedMimeTypeMPEG4SimpleVisualProfileLevel4A);
+        iMaximumFramerate = 30;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeMPEG4Visual ) != KErrNotFound )                 
+        {
+        // MPEG-4 SP level 0
+        iVideoCodecMimeType.Set(KVedMimeTypeMPEG4SimpleVisualProfile);
+        iMaximumFramerate = 15;
+        }        
+    else if (mimeType.MatchF( KVedMimeTypeAVCBaselineProfileLevel1B ) != KErrNotFound )
+        {
+        // AVC level 1b
+        iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel1B);
+        iMaximumFramerate = 15;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeAVCBaselineProfileLevel1_1 ) != KErrNotFound )
+        {
+        // AVC level 1.1
+        iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel1_1);
+        iMaximumFramerate = 7.5;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeAVCBaselineProfileLevel1_2 ) != KErrNotFound )
+        {
+        // AVC level 1.2
+        iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel1_2);
+        iMaximumFramerate = 15;
+        } 
+    //WVGA task
+    else if (mimeType.MatchF( KVedMimeTypeAVCBaselineProfileLevel1_3 ) != KErrNotFound )
+        {
+        // AVC level 1.3
+        iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel1_3);
+        iMaximumFramerate = 15;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeAVCBaselineProfileLevel2 ) != KErrNotFound )
+        {
+        // AVC level 2
+        iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel2);
+        iMaximumFramerate = 15;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeAVCBaselineProfileLevel2_1 ) != KErrNotFound )
+        {
+        // AVC level 2.1
+        iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel2_1);
+        iMaximumFramerate = 15;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeAVCBaselineProfileLevel2_2 ) != KErrNotFound )
+        {
+        // AVC level 2.2
+        iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel2_2);
+        iMaximumFramerate = 15;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeAVCBaselineProfileLevel3 ) != KErrNotFound )
+        {
+        // AVC level 3
+        iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel3);
+        iMaximumFramerate = 15;
+        }
+    else if (mimeType.MatchF( KVedMimeTypeAVCBaselineProfileLevel3_1 ) != KErrNotFound )
+        {
+        // AVC level 3.1
+        iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel3_1);
+        iMaximumFramerate = 15;
+        }
+    else
+        {
+        // AVC level 1
+        iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel1);    
+        iMaximumFramerate = 15;
+        }
+        
+    }
+    
+   
+// -----------------------------------------------------------------------------
+// CVedMovieImp::GetQCIFPropertiesL
+// Get settings for QCIF or subQCIF resolution; H.263, H.264 or MPEG-4
+// This is a special case since it has also H.263 codec support.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CVedMovieImp::GetQCIFPropertiesL(SVideoQualitySet& aLocalQualitySet)
+    {
+    TInt foundQualitySetForLevelError = KErrNone;
+    
+    // QCIF and subQCIF are handled together, since they are covered by the same levels of the H.263, MPEG-4 and H.264.
+    // We have the preferred video codec in iVideoType (based on input clips)
+    
+    if ( iVideoType == EVedVideoTypeAVCBaselineProfile )
+        {
+        // first check if we support H.264 output
+        // level 1B
+        PRINT((_L("CVedMovie::GetQCIFPropertiesL() check H.264 level 1B")));
+        TRAP(foundQualitySetForLevelError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeAVCBaselineProfileLevel1B)));        
+
+        if ( foundQualitySetForLevelError == KErrNotSupported )
+            {
+            // check H.264 level 1 instead
+            PRINT((_L("CVedMovie::GetQCIFPropertiesL() check H.264 level 1")));
+            TRAP(foundQualitySetForLevelError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeAVCBaselineProfileLevel1)));
+            if ( foundQualitySetForLevelError == KErrNotSupported )
+                {
+                // H.264 @ QCIF is not supported. Fall back to H.263 (=> input is transcoded to H.263)
+                PRINT((_L("CVedMovie::getQCIFPropertiesL() no set for MPEG-4 level 0, switch to H.263")));
+                iVideoType = EVedVideoTypeH263Profile0Level45;  // use level 45 since it is better than 10, and we don't have bitrate restrictions here
+                foundQualitySetForLevelError = GetQCIFPropertiesL(aLocalQualitySet);
+                // keep H.263; H.264 may not be supported at all
+                }
+            }                    
+            
+        if ( foundQualitySetForLevelError == KErrNone )
+            {
+            SetVideoCodecMimeType(aLocalQualitySet.iVideoCodecMimeType);
+            }
+        }
+    else if ( iVideoType == EVedVideoTypeMPEG4SimpleProfile )
+        {
+        // MPEG-4 @ QCIF is an exceptional case; should not happen for locally recorded clips, but support is kept here for compatibility
+        PRINT((_L("CVedMovie::GetQCIFPropertiesL() check MPEG-4 level 0")));
+        TRAP(foundQualitySetForLevelError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeMPEG4SimpleVisualProfile)));
+        if ( foundQualitySetForLevelError == KErrNotSupported )
+            {
+            // MPEG-4 QCIF is not listed in the quality set. Use it with H.263 settings, except the codec type
+            PRINT((_L("CVedMovie::GetQCIFPropertiesL() no set for MPEG-4 level 0, take settings from H.263")));
+            iVideoType = EVedVideoTypeH263Profile0Level10;// level 10 is comparable to level 0 of MPEG-4; level 0b is not used
+            foundQualitySetForLevelError = GetQCIFPropertiesL(aLocalQualitySet);
+            // change back to MPEG-4
+            iVideoType = EVedVideoTypeMPEG4SimpleProfile;
+            }
+        if ( foundQualitySetForLevelError == KErrNone )
+            {
+            // set MPEG-4 MIME-type and other related settings;
+            // also if the quality set showed H.263; this way we can support mpeg-4 even if it is not any of the preferred ones, since we have supported it earlier too...
+            iVideoCodecMimeType.Set(KVedMimeTypeMPEG4SimpleVisualProfile);
+            iMaximumFramerate = 15;
+            }
+        }
+    else
+        {
+        // H.263
+        if ( iVideoType == EVedVideoTypeH263Profile0Level45 )
+            {
+            PRINT((_L("CVedMovie::GetQCIFPropertiesL() check H.263 level 45")));
+            TRAP(foundQualitySetForLevelError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeH263Level45)));
+            }
+        if ( (iVideoType == EVedVideoTypeH263Profile0Level10) || (foundQualitySetForLevelError == KErrNotSupported) )
+            {
+            PRINT((_L("CVedMovie::GetQCIFPropertiesL() check H.263 level 10")));
+            TRAP(foundQualitySetForLevelError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeH263)));
+            }
+            
+        if ( foundQualitySetForLevelError == KErrNone )
+            {
+            SetVideoCodecMimeType(aLocalQualitySet.iVideoCodecMimeType);
+            }
+        }
+    // assume subQCIF can use other QCIF settings except resolution
+    
+   
+    return foundQualitySetForLevelError;
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CVedMovieImp::GetCIFQVGAPropertiesL
+// Get settings for CIF or QVGA resolution; H.264 or MPEG-4
+// Some encoders may not support both, hence we may need to change the resolution here
+// and that's why this is treated as a special case.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CVedMovieImp::GetCIFQVGAPropertiesL(TSize aSize, TReal aFrameRate, SVideoQualitySet& aLocalQualitySet)
+    {
+    TInt foundQualitySetForLevelError = KErrNone;
+    
+    // CIF and QVGA are handled together, since they are covered by the same levels of the MPEG-4 and H.264;
+    // framerate brings a difference though.
+    // We have the preferred video codec in iVideoType (based on input clips), and framerate in aFrameRate
+    // so let's check the level first, and then additionally check if the resolution is supported.
+    
+    if ( iVideoType == EVedVideoTypeAVCBaselineProfile )
+        {
+        // first check if we support H.264 output
+        // try level 1.2; higher levels not supported yet, and hence aFrameRate has no impact; 
+        // level 1.1 is not seen relevant since it supports only 7.5 fps
+        PRINT((_L("CVedMovie::GetCIFQVGAPropertiesL() check H.264 level 1.2")));
+        TRAP(foundQualitySetForLevelError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeAVCBaselineProfileLevel1_2)));
+        if ( foundQualitySetForLevelError == KErrNotSupported )
+            {
+            // H.264 level 1.2 is not supported; switch to MPEG-4
+            iVideoType = EVedVideoTypeMPEG4SimpleProfile;
+            }
+        }
+
+    if ( iVideoType == EVedVideoTypeMPEG4SimpleProfile )         
+        {
+        // MPEG-4 was dominant in the input, OR H.264 is not supported in quality set. 
+        // The order is like this since MPEG-4 is generally more supported than H.264. 
+        // Hence this CANNOT handle the case where MPEG-4 CIF/QVGA is not in the quality set but H.264 is, but in that case it falls back to H.263 QCIF in the host method
+        if ( aFrameRate > 15.0 )
+            {
+            // check level 3
+            PRINT((_L("CVedMovie::GetCIFQVGAPropertiesL() check MPEG-4 level 3")));
+            TRAP(foundQualitySetForLevelError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeMPEG4SimpleVisualProfileLevel3)));
+            }
+        if ( (aFrameRate <= 15.0) || (foundQualitySetForLevelError == KErrNotSupported) )
+            {
+            // try level 2
+            PRINT((_L("CVedMovie::GetCIFQVGAPropertiesL() check MPEG-4 level 2")));
+            TRAP(foundQualitySetForLevelError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeMPEG4SimpleVisualProfileLevel2)));
+            }
+        }
+
+    if ( foundQualitySetForLevelError == KErrNotSupported )
+        {
+        // these resolutions are not supported! The default one will be taken into use in CalculatePropertiesL
+        PRINT((_L("CVedMovie::GetCIFQVGAPropertiesL() no support for CIF/QVGA found in quality set")));
+        return foundQualitySetForLevelError;
+        }
+        
+        
+
+    SVideoQualitySet tmpSet;
+    TRAPD(resolutionSupported, iQualitySelector->GetVideoQualitySetL( tmpSet, aSize));
+    if ( resolutionSupported == KErrNotSupported )
+        {
+        // the preferred resolution is not supported => must use the other one
+        // the level was supported already, so no need to check support for the other one
+        if ( aSize == KVedResolutionCIF )
+            {
+            PRINT((_L("CVedMovie::GetCIFQVGAPropertiesL() CIF support not available, must use QVGA instead")));
+            iResolution = KVedResolutionQVGA;
+            }
+        else
+            {
+            PRINT((_L("CVedMovie::GetCIFQVGAPropertiesL() QVGA support not available, must use CIF instead")));
+            iResolution = KVedResolutionCIF;
+            }
+        }
+    else
+        {
+        PRINT((_L("CVedMovie::GetCIFQVGAPropertiesL() resolution support ok")));
+        iResolution = aSize;
+        }
+
+    // at this point we must have found a suitable set
+    SetVideoCodecMimeType(aLocalQualitySet.iVideoCodecMimeType);
+    return foundQualitySetForLevelError;
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CVedMovieImp::GetVGAPropertiesL
+// Get settings for VGA resolution. If not supported, get High settings instead
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CVedMovieImp::GetVGAPropertiesL(SVideoQualitySet& aLocalQualitySet)
+    {
+    TInt foundQualitySetForResolutionError = KErrNone;
+    
+    if ( iVideoType == EVedVideoTypeAVCBaselineProfile )
+        {
+        PRINT((_L("CVedMovie::GetWVGAPropertiesL() check H.264 level 3.0")));
+        TRAP(foundQualitySetForResolutionError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeAVCBaselineProfileLevel3)));
+        if (foundQualitySetForResolutionError == KErrNotSupported )
+            {
+            PRINT((_L("CVedMovie::GetVGAPropertiesL() H.264 level 3.0 not supported")));
+            // H.264 level 3.0 is not supported; switch to MPEG-4
+            iVideoType = EVedVideoTypeMPEG4SimpleProfile;
+            }
+        else
+            {
+            PRINT((_L("CVedMovie::GetVGAPropertiesL() H.264 level 3.0 supported")));
+            iResolution = KVedResolutionVGA;
+            SetVideoCodecMimeType(aLocalQualitySet.iVideoCodecMimeType);
+            }
+        }
+    
+    if ( iVideoType == EVedVideoTypeMPEG4SimpleProfile )         
+        {
+        // VGA; check MPEG-4 level 4a
+        // Settings may not exist => trap the leave
+        TRAP(foundQualitySetForResolutionError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeMPEG4SimpleVisualProfileLevel4A)));
+        if ( foundQualitySetForResolutionError == KErrNotSupported )
+            {
+            PRINT((_L("CVedMovie::GetVGAPropertiesL() VGA not supported as output, try highest supported")));
+            // No VGA, try the highest instead
+            foundQualitySetForResolutionError = GetHighPropertiesL(aLocalQualitySet);
+            }
+        else
+            {
+            PRINT((_L("CVedMovie::GetVGAPropertiesL() VGA with MPEG-4 level 4a selected as output")));
+            iResolution = KVedResolutionVGA;
+            SetVideoCodecMimeType(aLocalQualitySet.iVideoCodecMimeType);
+            }
+        }
+    
+    return foundQualitySetForResolutionError;
+    }
+    
+// -----------------------------------------------------------------------------
+// CVedMovieImp::GetVGA16By9PropertiesL
+// Get settings for VGA 16:9 resolution. If not supported, get High settings instead
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CVedMovieImp::GetVGA16By9PropertiesL(SVideoQualitySet& aLocalQualitySet)
+    {
+    TInt foundQualitySetForResolutionError = KErrNone;
+    
+    if ( iVideoType != EVedVideoTypeMPEG4SimpleProfile )
+        {
+        // NOTE: max supported H.264/AVC level currently (1.2) allows only CIF 15 fps, no VGA. 
+        PRINT((_L("CVedMovie::GetVGA16By9PropertiesL() VGA & H.264 == NOT SUPPORTED")));
+        TVedPanic::Panic(TVedPanic::EInternal);
+        }
+         
+    // VGA; check MPEG-4 level 4a
+    // Settings may not exist => trap the leave    
+    TRAP(foundQualitySetForResolutionError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeMPEG4SimpleVisualProfileLevel4A)));
+    if ( foundQualitySetForResolutionError == KErrNotSupported )
+        {
+        PRINT((_L("CVedMovie::GetVGAPropertiesL() VGA 16:9 not supported as output, try highest supported")));
+        // No VGA, try the highest instead
+        foundQualitySetForResolutionError = GetHighPropertiesL(aLocalQualitySet);
+        }
+    else
+        {
+        PRINT((_L("CVedMovie::GetVGAPropertiesL() VGA 16:9 with MPEG-4 level 4a selected as output")));
+        iResolution = KVedResolutionVGA16By9;
+        SetVideoCodecMimeType(aLocalQualitySet.iVideoCodecMimeType);
+        }
+    return foundQualitySetForResolutionError;
+    }
+
+//WVGA task   
+// -----------------------------------------------------------------------------
+// CVedMovieImp::GetWVGAPropertiesL
+// -----------------------------------------------------------------------------
+//
+TInt CVedMovieImp::GetWVGAPropertiesL(SVideoQualitySet& aLocalQualitySet)
+    {
+    TInt foundQualitySetForResolutionError = KErrNone;;
+    
+    if ( iVideoType == EVedVideoTypeAVCBaselineProfile )
+        {
+        PRINT((_L("CVedMovie::GetWVGAPropertiesL() check H.264 level 3.1")));
+        TRAP(foundQualitySetForResolutionError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeAVCBaselineProfileLevel3)));
+        if (foundQualitySetForResolutionError == KErrNotSupported )
+            {
+            PRINT((_L("CVedMovie::GetWVGAPropertiesL() H.264 level 3.0 not supported")));
+            // H.264 level 3.0 is not supported; switch to MPEG-4
+            iVideoType = EVedVideoTypeMPEG4SimpleProfile;
+            }
+        else
+            {
+            PRINT((_L("CVedMovie::GetWVGAPropertiesL() H.264 level 3.0  supported")));
+            iResolution = KVedResolutionWVGA;
+            SetVideoCodecMimeType(aLocalQualitySet.iVideoCodecMimeType);
+            }
+        }
+
+    if ( iVideoType == EVedVideoTypeMPEG4SimpleProfile )         
+        {
+        // Settings may not exist => trap the leave
+        TRAP(foundQualitySetForResolutionError,iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, TPtrC8(KVedMimeTypeMPEG4SimpleVisualProfileLevel4A)));
+        if ( foundQualitySetForResolutionError == KErrNotSupported )
+            {
+            PRINT((_L("CVedMovie::GetWVGAPropertiesL() WVGA not supported as output, try highest supported")));
+            // No WVGA, try the highest instead
+            foundQualitySetForResolutionError = GetHighPropertiesL(aLocalQualitySet);
+            }
+        else
+            {
+            PRINT((_L("CVedMovie::GetWVGAPropertiesL() WVGA with MPEG-4 level 4a selected as output")));
+            iResolution = KVedResolutionWVGA;
+            SetVideoCodecMimeType(aLocalQualitySet.iVideoCodecMimeType);
+            }
+            
+        }
+    return foundQualitySetForResolutionError;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CVedMovieImp::GetHighPropertiesL
+// Get settings for High quality and apply relevant parts to member variables;
+// the rest are applied in common part
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CVedMovieImp::GetHighPropertiesL(SVideoQualitySet& aLocalQualitySet)
+    {
+    TInt foundQualitySetForResolutionError = KErrNone;
+    
+    PRINT((_L("CVedMovie::SetHighPropertiesL() use the highest supported")));
+    TRAP(foundQualitySetForResolutionError, iQualitySelector->GetVideoQualitySetL( aLocalQualitySet, CVideoQualitySelector::EVideoQualityHigh));
+    if ( foundQualitySetForResolutionError == KErrNone ) 
+        {
+        iResolution.iWidth = aLocalQualitySet.iVideoWidth;
+        iResolution.iHeight = aLocalQualitySet.iVideoHeight;
+        iVideoType = MapVideoCodecTypes(aLocalQualitySet.iVideoCodecMimeType);
+        SetVideoCodecMimeType(aLocalQualitySet.iVideoCodecMimeType);
+        }
+    else
+        {
+        // handled in the end of CalculatePropertiesL, but should not be possible to reach this since High should always exist
+        }
+    
+    return foundQualitySetForResolutionError;
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CVedMovieImp::ApplyAutomaticPropertiesL
+// Apply the settings based on properties of input clips
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVedMovieImp::ApplyAutomaticPropertiesL(TAudFileProperties &aAudioProperties)
+    {
+    // Automatic quality selection
+    
+    PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() automatic quality selected")));
+    TTimeIntervalMicroSeconds durationOfMP4MPEG4(0);
+    TTimeIntervalMicroSeconds durationOfMP4AVC(0);
+    
+    TTimeIntervalMicroSeconds durationOf3gppH263(0);
+    TTimeIntervalMicroSeconds durationOf3gppMPEG4(0);
+    TTimeIntervalMicroSeconds durationOf3gppAVC(0);
+    
+    TTimeIntervalMicroSeconds durationOfVGA(0);
+    TTimeIntervalMicroSeconds durationOfVGA16By9(0);
+    TTimeIntervalMicroSeconds durationOfQVGA(0);
+    TTimeIntervalMicroSeconds durationOfCIF(0);
+    TTimeIntervalMicroSeconds durationOfQCIF(0);
+    TTimeIntervalMicroSeconds durationOfSubQCIF(0);
+    TReal frameRateOfQVGA(0);
+    TReal frameRateOfCIF(0);
+    TReal framerate(0);
+    TBool audioOnlyMP4 = EFalse;
+    
+    //WVGA task
+    TTimeIntervalMicroSeconds durationOfWVGA(0);
+    TReal frameRateOfWVGA(0);
+
+    iVideoType = EVedVideoTypeH263Profile0Level10;
+    
+    for (TInt i = 0; i < VideoClipCount(); i++)
+        {
+        CVedVideoClipInfo* currentInfo = VideoClip(i)->Info();
+
+        if (currentInfo->Class() == EVedVideoClipClassFile)
+            {
+            // Add up the durations of different resolution video
+            if (currentInfo->Resolution() == KVedResolutionSubQCIF)
+                {
+                PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() subQCIF input")));
+                durationOfSubQCIF= durationOfSubQCIF.Int64() + VideoClip(i)->EditedDuration().Int64(); 
+                }
+            else if (currentInfo->Resolution() == KVedResolutionQCIF)
+                {
+                PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() QCIF input")));
+                durationOfQCIF= durationOfQCIF.Int64() + VideoClip(i)->EditedDuration().Int64();
+                }
+            else if (currentInfo->Resolution() == KVedResolutionCIF)
+                {
+                PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() CIF input")));
+                durationOfCIF= durationOfCIF.Int64() + VideoClip(i)->EditedDuration().Int64();
+                framerate = (1000*currentInfo->VideoFrameCount())/(currentInfo->Duration().Int64()/1000);
+                if ( framerate > frameRateOfCIF )
+                    {
+                    frameRateOfCIF = framerate;
+                    }
+                }
+            else if (currentInfo->Resolution() == KVedResolutionQVGA)
+                {
+                PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() QVGA input")));
+                durationOfQVGA= durationOfQVGA.Int64() + VideoClip(i)->EditedDuration().Int64();
+                framerate = (1000*currentInfo->VideoFrameCount())/(currentInfo->Duration().Int64()/1000);
+                if ( framerate > frameRateOfQVGA )
+                    {
+                    frameRateOfQVGA = framerate;
+                    }
+                }                 
+            else if (currentInfo->Resolution() == KVedResolutionVGA16By9)
+                {
+                PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() VGA 16:9 input")));
+                durationOfVGA16By9 = durationOfVGA16By9.Int64() + VideoClip(i)->EditedDuration().Int64();
+                }
+            
+            else if (currentInfo->Resolution() == KVedResolutionVGA)
+                {
+                PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() VGA input")));
+                durationOfVGA= durationOfVGA.Int64() + VideoClip(i)->EditedDuration().Int64();
+                }
+                //WVGA task
+            else if (currentInfo->Resolution() == KVedResolutionWVGA)
+                {
+                PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() WVGA input")));
+                durationOfWVGA= durationOfWVGA.Int64() + VideoClip(i)->EditedDuration().Int64();
+                }
+
+            
+            if (currentInfo->Format() == EVedVideoFormat3GPP) 
+                {
+                if ( currentInfo->VideoType() == EVedVideoTypeMPEG4SimpleProfile )
+                    {
+                    // 3gpp file with MPEG-4 video
+                    PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() 3gpp with MPEG-4 input")));
+                    durationOf3gppMPEG4 = durationOf3gppMPEG4.Int64() + VideoClip(i)->EditedDuration().Int64(); 
+                    }
+                else if ( currentInfo->VideoType() == EVedVideoTypeAVCBaselineProfile )
+                    {
+                    // 3gpp file with AVC video
+                    PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() 3gpp with AVC input")));
+                    durationOf3gppAVC = durationOf3gppAVC.Int64() + VideoClip(i)->EditedDuration().Int64(); 
+                    // NOTE: Level 1B is assumed always for QCIF AVC in automatic input case. 
+                    }	                	                
+                else
+                    {
+                    // 3gpp file with H.263 video
+                    PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() 3gpp with H.263 input")));
+                    durationOf3gppH263 = durationOf3gppH263.Int64() + VideoClip(i)->EditedDuration().Int64();
+                    if (currentInfo->VideoType() == EVedVideoTypeH263Profile0Level45)
+                        {
+                        PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() 3gpp with H.263 L45 input")));
+                        iVideoType = EVedVideoTypeH263Profile0Level45;
+                        }
+                    }
+                }
+                
+            else if (currentInfo->Format() == EVedVideoFormatMP4) 
+                {
+                
+                if ( currentInfo->VideoType() == EVedVideoTypeMPEG4SimpleProfile )
+                    {
+                    // MP4 file with MPEG-4 video
+                    PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() MP4 with MPEG-4 input")));
+                    durationOfMP4MPEG4 = durationOfMP4MPEG4.Int64() + VideoClip(i)->EditedDuration().Int64(); 
+                    }
+                    
+                else if ( currentInfo->VideoType() == EVedVideoTypeAVCBaselineProfile )
+                    {
+                    // MP4 file with AVC video
+                    PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() MP4 with AVC input")));
+                    durationOfMP4AVC = durationOfMP4AVC.Int64() + VideoClip(i)->EditedDuration().Int64(); 
+                    // NOTE: What about levels ?	                    
+                    } 
+                    
+                else
+                    {
+                    PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() MP4 with other input, not supported")));
+                    TVedPanic::Panic(TVedPanic::EInternal);
+                    }
+                
+                }
+            else
+                {
+                // Unknown format
+                PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() not 3gpp nor MP4 , not supported")));
+                TVedPanic::Panic(TVedPanic::EInternal);
+                }
+            }
+        } // end of for loop, all input has been checked now
+
+
+
+    //
+    // Decide the output format
+    //
+     
+    // First check if we had any video
+    if ( (durationOfMP4MPEG4.Int64() == 0) && (durationOfMP4AVC.Int64() == 0) && 
+         (durationOf3gppH263.Int64() == 0) && (durationOf3gppMPEG4.Int64() == 0) && (durationOf3gppAVC.Int64() == 0) 
+       )              
+        {
+        // no video, check audio
+        for ( TInt i = 0; i < iAudSong->ClipCount(KVedAudioTrackIndex); i++)
+            {
+            if ( iAudSong->Clip(i, KVedAudioTrackIndex)->Info()->Properties().iAudioType == EAudAMR )
+                {
+                // 3gpp
+                durationOf3gppH263 = durationOf3gppH263.Int64() + iAudSong->Clip(i, KVedAudioTrackIndex)->EditedDuration().Int64();
+                }
+            else
+                {
+                // mp4; mark audio-only as Mpeg4 video at this point
+                durationOfMP4MPEG4 = durationOfMP4MPEG4.Int64() + iAudSong->Clip(i, KVedAudioTrackIndex)->EditedDuration().Int64();
+                audioOnlyMP4 = ETrue;
+                }
+            }
+        }
+    
+    // Then decide the file format    
+    if ( ( durationOfMP4MPEG4.Int64() + durationOfMP4AVC.Int64() > 0 ) &&       
+         ( ( durationOfMP4MPEG4.Int64() + durationOfMP4AVC.Int64() ) >=
+           ( durationOf3gppH263.Int64() + durationOf3gppMPEG4.Int64() + durationOf3gppAVC.Int64() ) ) )
+        {
+        // majority of input is MP4
+        iFormat = EVedVideoFormatMP4;
+        if ( audioOnlyMP4 )
+            {
+            // no video, just audio, use highest quality; this branch is only used to skip the else-branches
+            PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() audio only with MP4")));    
+            // iVideoType is set in GetHighPropertiesL based on high quality level
+            }
+        else if ( durationOfMP4MPEG4 > durationOfMP4AVC )
+            {
+            // MP4, video is MPEG-4
+            iVideoType = EVedVideoTypeMPEG4SimpleProfile;
+            PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is MP4 with MPEG-4 video")));                
+            } 
+        else
+            {
+            // MP4, video is AVC
+            iVideoType = EVedVideoTypeAVCBaselineProfile;
+            PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is MP4 with AVC video")));
+            }
+        }
+    else        
+        {
+        // majority of input is 3gpp, or no video. Keep 3gpp as in previous versions
+        PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is 3gpp or no video")));
+        iFormat = EVedVideoFormat3GPP;
+        
+        if ((durationOf3gppMPEG4 > 0) &&
+            (durationOf3gppMPEG4 >= durationOf3gppAVC) &&
+            (durationOf3gppMPEG4 >= durationOf3gppH263))
+            {
+            iVideoType = EVedVideoTypeMPEG4SimpleProfile;
+            PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is 3gpp with MPEG-4 video")));
+            } 
+        
+        else if ((durationOf3gppAVC > 0) &&
+                 (durationOf3gppAVC >= durationOf3gppH263))
+            {
+            iVideoType = EVedVideoTypeAVCBaselineProfile;
+            PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is 3gpp with AVC video")));                
+            } 
+        
+        else
+            {
+            // H.263
+            PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is 3gpp with H.263 video")));
+            if ( iVideoType != EVedVideoTypeH263Profile0Level45 )
+                {
+                //use level 10 as used in previous versions
+                iVideoType = EVedVideoTypeH263Profile0Level10;
+                PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is 3gpp with H.263 L10 video")));
+                }
+            
+            }                        
+        }
+   
+   
+   
+   
+    // Then decide the resolution
+   
+   
+   
+    // cannot use the iQualitySet since it overrides the video settings. Use this mainly for checking audio settings
+    SVideoQualitySet localQualitySet;
+    TInt foundQualitySetForResolutionError = KErrNone;
+    
+    if ( audioOnlyMP4 )
+        {
+        // get video parameters for audio-only MP4 clip; audio-only 3gpp is handled as QCIF
+        foundQualitySetForResolutionError = GetHighPropertiesL(localQualitySet);
+        }
+    //WVGA task
+    else if ((durationOfWVGA > 0) &&
+    		(durationOfWVGA >= durationOfVGA) &&
+            (durationOfWVGA >= durationOfVGA16By9) &&
+            (durationOfWVGA >= durationOfQVGA) && 
+            (durationOfWVGA >= durationOfCIF) && 
+            (durationOfWVGA >= durationOfQCIF) && 
+            (durationOfWVGA >= durationOfSubQCIF))
+            {
+            // VGA
+            PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is WVGA")));
+            iResolution = KVedResolutionWVGA;
+            foundQualitySetForResolutionError = GetWVGAPropertiesL(localQualitySet);
+            } 
+    else if ((durationOfVGA > 0) &&
+        (durationOfVGA >= durationOfVGA16By9) &&
+        (durationOfVGA >= durationOfQVGA) && 
+        (durationOfVGA >= durationOfCIF) && 
+        (durationOfVGA >= durationOfQCIF) && 
+        (durationOfVGA >= durationOfSubQCIF))
+        {
+        // VGA
+        PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is VGA")));
+        iResolution = KVedResolutionVGA;
+        foundQualitySetForResolutionError = GetVGAPropertiesL(localQualitySet);
+        } 
+        
+    else if ((durationOfVGA16By9 > 0) &&
+             (durationOfVGA16By9 >= durationOfCIF) &&
+             (durationOfVGA16By9 >= durationOfQVGA) &&
+             (durationOfVGA16By9 >= durationOfQCIF) &&
+             (durationOfVGA16By9 >= durationOfSubQCIF))
+        {
+        // VGA 16:9
+        PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is VGA 16:9")));
+        iResolution = KVedResolutionVGA16By9;
+        foundQualitySetForResolutionError = GetVGA16By9PropertiesL(localQualitySet);
+        }
+        
+    else if ((durationOfCIF > 0) &&
+             (durationOfCIF >= durationOfQVGA) && 
+             (durationOfCIF >= durationOfQCIF) && 
+             (durationOfCIF >= durationOfSubQCIF))
+        {
+        // CIF, but may be translated to QVGA if CIF not supported as output
+        PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is CIF")));
+        iResolution = KVedResolutionCIF;
+        foundQualitySetForResolutionError = GetCIFQVGAPropertiesL(KVedResolutionCIF, frameRateOfCIF, localQualitySet);
+        // audio parameters set in the end
+        }
+    else if ((durationOfQVGA > 0) &&
+             (durationOfQVGA >= durationOfQCIF) && 
+             (durationOfQVGA >= durationOfSubQCIF))
+        {
+        // QVGA, but may be translated to CIF if QVGA not supported as output
+        PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is QVGA")));
+        iResolution = KVedResolutionQVGA;
+        foundQualitySetForResolutionError = GetCIFQVGAPropertiesL(KVedResolutionQVGA, frameRateOfQVGA, localQualitySet);
+        // audio parameters set in the end
+        }
+    else if ((durationOfSubQCIF > 0) &&
+             (durationOfSubQCIF > durationOfQCIF))    // keep the > and not >= since QCIF is better than subQCIF
+        {
+        // subQCIF is not that important but is kept here anyway
+        PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is subQCIF")));
+        iResolution = KVedResolutionSubQCIF;
+        foundQualitySetForResolutionError = GetQCIFPropertiesL(localQualitySet);
+        // audio parameters set in the end
+        }
+    else 
+        {
+        // QCIF
+        PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() majority of input is QCIF")));
+        iResolution = KVedResolutionQCIF;
+        foundQualitySetForResolutionError = GetQCIFPropertiesL(localQualitySet);
+        // audio parameters set in the end
+        }
+        
+    if ( foundQualitySetForResolutionError == KErrNone )
+        {
+        // iVideoType and MIME-type were set earlier. 
+        iVideoStandardBitrate = localQualitySet.iVideoBitRate;
+        iVideoFrameRate = localQualitySet.iVideoFrameRate;
+        iRandomAccessRate = localQualitySet.iRandomAccessRate;
+        // audio parameters set in the end
+        }
+        
+        
+    // Then handle cases where we didn't found suitable output format based on input resolution 
+    // (i.e. we can't generate output that matches with majority of input)            
+    if ( foundQualitySetForResolutionError == KErrNotSupported )
+        {
+        
+        PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() no suitable quality set found yet...")));
+        // did not get preferred set from qualityselector; use highest one; may be overruled in MatchAudioPropertiesWithInput
+        if (iFormat == EVedVideoFormatMP4 )
+            {
+            // MP4 => AAC
+            // High quality should be always present
+            
+            PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() try taking the high quality")));
+            TRAPD(err,iQualitySelector->GetVideoQualitySetL( localQualitySet, CVideoQualitySelector::EVideoQualityHigh));
+            if ( err )
+                {
+                // should not happen if the variation is done properly
+                PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() problem in getting high quality set, ERROR")));
+                User::Leave( err );
+                }
+            
+            aAudioProperties.iAudioType = MapAudioCodecTypes(localQualitySet.iAudioFourCCType);
+            aAudioProperties.iSamplingRate = localQualitySet.iAudioSamplingRate;    
+            if ( localQualitySet.iAudioChannels == 1 )
+                {
+                aAudioProperties.iChannelMode = EAudSingleChannel;
+                }
+            else
+                {
+                aAudioProperties.iChannelMode = EAudStereo;
+                }
+            aAudioProperties.iBitrate = localQualitySet.iAudioBitRate;
+            // take also video settings from the new set
+            iResolution.iWidth = localQualitySet.iVideoWidth;
+            iResolution.iHeight = localQualitySet.iVideoHeight;
+            // MIME-type and bitrate
+            SetVideoCodecMimeType(localQualitySet.iVideoCodecMimeType);
+            iVideoStandardBitrate = localQualitySet.iVideoBitRate;
+            }
+        else
+            {
+            PRINT((_L("CVedMovie::ApplyAutomaticPropertiesL() use 3gpp")));
+            // 3gp => use AMR
+            aAudioProperties.iAudioType = EAudAMR;
+            aAudioProperties.iSamplingRate = KVedAudioSamplingRate8k;
+            aAudioProperties.iChannelMode = EAudSingleChannel;
+            aAudioProperties.iBitrate = KAudBitRateDefault;  //use default. 
+            // set also video settings for 3gpp
+            iResolution = KVedResolutionQCIF;
+            // MIME-type and bitrate
+            iVideoCodecMimeType.Set(KVedMimeTypeH263);
+            iVideoStandardBitrate = KVedBitRateH263Level10;
+            }
+            
+        }
+    else
+        {
+        // preferred settings were got from quality set API without any error; take the audio settings too
+        
+        aAudioProperties.iAudioType = MapAudioCodecTypes(localQualitySet.iAudioFourCCType);
+        aAudioProperties.iSamplingRate = localQualitySet.iAudioSamplingRate;    
+        if ( localQualitySet.iAudioChannels == 1 )
+            {
+            aAudioProperties.iChannelMode = EAudSingleChannel;
+            }
+        else
+            {
+            aAudioProperties.iChannelMode = EAudStereo;
+            }
+        aAudioProperties.iBitrate = localQualitySet.iAudioBitRate;
+        }
+        
+        
+        
+    if ( aAudioProperties.iAudioType != EAudAMR )
+        {
+        // still check that we don't do unnecessary audio transcoding. AMR output is not changed to anything else
+        if ( !MatchAudioPropertiesWithInput( aAudioProperties ) )
+            {
+            // there was no input clip that matched the properties
+            
+            if ( foundQualitySetForResolutionError == KErrNotSupported )
+                {
+                // the properties were taken from highest quality set after not finding a suitable set; better to ensure we have 16k
+                aAudioProperties.iSamplingRate = KVedAudioSamplingRate16k;
+                aAudioProperties.iChannelMode = EAudSingleChannel;
+                aAudioProperties.iBitrate = KAudBitRateDefault;  //use default. 
+                }
+            // else the properties were taken from a suitable set; convert audio to match them
+            
+            }
+        }
+    
+    }
+    
+// -----------------------------------------------------------------------------
+// CVedMovieImp::ApplyRequestedPropertiesL
+// Apply the settings the client requested
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVedMovieImp::ApplyRequestedPropertiesL(TAudFileProperties &aAudioProperties)
+    {
+    TBool legacyMode = EFalse;
+    
+    if (iQuality == EQualityMMSInteroperability)
+        {
+        // MMS interoperability settings
+        PRINT((_L("CVedMovie::ApplyRequestedPropertiesL() MMS quality selected")));
+        // MMS interoperability should be always there => no leave
+        iQualitySelector->GetVideoQualitySetL( iQualitySet, CVideoQualitySelector::EVideoQualityMMS);
+        // map the set to member variables later
+        
+        }
+
+    else if (iQuality == EQualityResolutionQCIF)
+        {
+        // this is a legacy branch, used only with older editor UI
+        PRINT((_L("CVedMovie::ApplyRequestedPropertiesL() QCIF quality selected; check level 45 vs level 10")));
+        legacyMode = ETrue;
+
+        iResolution = KVedResolutionQCIF;
+        
+        // Start with MMS and upgrade based on input if needed
+        iQualitySelector->GetVideoQualitySetL( iQualitySet, CVideoQualitySelector::EVideoQualityMMS);
+        iFormat = MapVideoFormatTypes(iQualitySet.iVideoFileMimeType);
+        iVideoType = MapVideoCodecTypes(iQualitySet.iVideoCodecMimeType);
+        
+        aAudioProperties.iAudioType = MapAudioCodecTypes(iQualitySet.iAudioFourCCType);
+        aAudioProperties.iSamplingRate = iQualitySet.iAudioSamplingRate;    
+        if ( iQualitySet.iAudioChannels == 1 )
+            {
+            aAudioProperties.iChannelMode = EAudSingleChannel;
+            }
+        else
+            {
+            aAudioProperties.iChannelMode = EAudStereo;
+            }
+        aAudioProperties.iBitrate = iQualitySet.iAudioBitRate;
+        
+        
+        for (TInt i = 0; i < VideoClipCount(); i++)
+            {
+            CVedVideoClipInfo* currentInfo = VideoClip(i)->Info();
+
+            // Go through all files and check if any are H.263 Profile0 Level45
+            if (currentInfo->Class() == EVedVideoClipClassFile)
+                {
+                if (currentInfo->VideoType() == EVedVideoTypeH263Profile0Level45)
+                    {
+                    iVideoType = EVedVideoTypeH263Profile0Level45;
+                    }
+                }
+            }        
+            
+        
+        if ( iVideoType == EVedVideoTypeH263Profile0Level45 )
+            {
+            iVideoCodecMimeType.Set(KVedMimeTypeH263Level45);
+            iVideoStandardBitrate = KVedBitRateH263Level45;
+            }
+        else
+            {
+            iVideoCodecMimeType.Set(KVedMimeTypeH263);
+            iVideoStandardBitrate = KVedBitRateH263Level10;
+            }
+        }
+
+    else if (iQuality == EQualityResolutionCIF)
+        {
+        // this is a legacy branch, used only with older editor UI
+        PRINT((_L("CVedMovie::ApplyRequestedPropertiesL() CIF quality selected")));
+        legacyMode = ETrue;
+        iFormat = EVedVideoFormatMP4;
+        iVideoType = EVedVideoTypeMPEG4SimpleProfile;
+        iResolution = KVedResolutionCIF;
+        iVideoCodecMimeType.Set(KVedMimeTypeMPEG4SimpleVisualProfileLevel2);
+        iVideoStandardBitrate = KVedBitRateMPEG4Level2;
+        // use 16 kHz mono AAC, as used to be the selection with CIF in older editor versions
+        aAudioProperties.iAudioType = EAudAAC_MPEG4;
+        aAudioProperties.iSamplingRate = KVedAudioSamplingRate16k;
+        aAudioProperties.iChannelMode = EAudSingleChannel;
+        aAudioProperties.iBitrate = KAudBitRateDefault;  //use default.
+        }
+    else if (iQuality == EQualityResolutionMedium)
+        {
+        PRINT((_L("CVedMovie::ApplyRequestedPropertiesL() medium quality selected")));
+        // Medium quality should be always there => no leave
+        iQualitySelector->GetVideoQualitySetL( iQualitySet, CVideoQualitySelector::EVideoQualityNormal);
+        // map the set to member variables later
+        
+        }
+    else if (iQuality == EQualityResolutionHigh)
+        {
+        PRINT((_L("CVedMovie::ApplyRequestedPropertiesL() high quality selected")));
+        // High quality should be always there => no leave
+        iQualitySelector->GetVideoQualitySetL( iQualitySet, CVideoQualitySelector::EVideoQualityHigh);
+        // map the set to member variables later
+        
+        }
+
+    if ( !legacyMode )  // legacyMode is forced CIF or QCIF; their parameters were set already, this is for others
+        {
+        // set common video settings from the obtained iQualitySet. In automatic case they were taken from input
+        iFormat = MapVideoFormatTypes(iQualitySet.iVideoFileMimeType);
+        iVideoType = MapVideoCodecTypes(iQualitySet.iVideoCodecMimeType);
+        iResolution.iWidth = iQualitySet.iVideoWidth;
+        iResolution.iHeight = iQualitySet.iVideoHeight;
+        iVideoFrameRate = iQualitySet.iVideoFrameRate;
+        iVideoStandardBitrate = iQualitySet.iVideoBitRate;    // still not restricted => not necessary to transcode
+        SetVideoCodecMimeType(iQualitySet.iVideoCodecMimeType);
+        iRandomAccessRate = iQualitySet.iRandomAccessRate;
+        
+        aAudioProperties.iAudioType = MapAudioCodecTypes(iQualitySet.iAudioFourCCType);
+        aAudioProperties.iSamplingRate = iQualitySet.iAudioSamplingRate;    
+        if ( iQualitySet.iAudioChannels == 1 )
+            {
+            aAudioProperties.iChannelMode = EAudSingleChannel;
+            }
+        else
+            {
+            aAudioProperties.iChannelMode = EAudStereo;
+            }
+        aAudioProperties.iBitrate = iQualitySet.iAudioBitRate;
+        }
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CVedMovieImp::CalculatePropertiesL
+// Determine & apply the output properties for movie
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVedMovieImp::CalculatePropertiesL()
+    {
+    PRINT((_L("CVedMovie::CalculatePropertiesL() in")));
+
+    if (iOutputParamsSet)
+       return;  
+    
+    if ( (VideoClipCount() == 0) && (AudioClipCount() == 0) )
+        {
+        PRINT((_L("CVedMovie::CalculatePropertiesL() no clips in movie, out")));
+        return;
+        }
+        
+    
+    // set some default values. These will be updated if needed, in the two functions called below
+    // default video framerate is 15
+    iVideoFrameRate = iMaximumFramerate = 15.0;
+    // default random access rate is 1/5 fps
+    iRandomAccessRate = 0.2;
+
+    TAudFileProperties audioProperties;
+
+    if ( iQuality == EQualityAutomatic )
+        {
+        // Automatic quality selection based on input
+        ApplyAutomaticPropertiesL(audioProperties);   	    
+        }
+    else    
+        { 
+        // forced quality
+        ApplyRequestedPropertiesL(audioProperties);
+        } 
+        
+
+        
+    // Common finalization        
+        
+    PRINT((_L("CVedMovie::CalculatePropertiesL() fileformat: %d"), iFormat));
+    PRINT((_L("CVedMovie::CalculatePropertiesL() video codec, resolution, bitrate, framerate, random access rate: %d, (%d,%d), %d, %f, %f"), iVideoType, iResolution.iWidth, iResolution.iHeight, iVideoStandardBitrate, iVideoFrameRate, iRandomAccessRate));
+    PRINT((_L("CVedMovie::CalculatePropertiesL() audio codec, samplingrate, channels: %d, %d, %d"), audioProperties.iAudioType, audioProperties.iSamplingRate, audioProperties.iChannelMode));
+    
+    // Set the audio output properties here to the values specified above
+    if ( !iAudSong->SetOutputFileFormat(audioProperties.iAudioType, audioProperties.iSamplingRate,audioProperties.iChannelMode, audioProperties.iBitrate ) )
+        {
+        PRINT((_L("CVedMovie::CalculatePropertiesL() iAudSong->SetOutputFileFormat failed, try again with default settings")));
+        // something was wrong with the settings. Use default ones that should always work:
+        if ( audioProperties.iAudioType == EAudAMR )
+            {
+            audioProperties.iSamplingRate = KVedAudioSamplingRate8k;
+            audioProperties.iChannelMode = EAudSingleChannel;
+            }
+        else
+            {
+            audioProperties.iAudioType = EAudAAC_MPEG4;
+            audioProperties.iSamplingRate = KVedAudioSamplingRate16k;
+            audioProperties.iChannelMode = EAudSingleChannel;
+            }
+        // try again; bitrate is default 
+        iAudSong->SetOutputFileFormat(audioProperties.iAudioType, audioProperties.iSamplingRate, audioProperties.iChannelMode);
+        }
+                                                              
+    }
+
+
+void CVedMovieImp::SetAudioFadingL()
+    {
+    // Apply fading only if there are no specific dynamic level marks inserted. 
+    // I.e. this is used only if audio volume is set by SetxxVolumeGainL or not set at all
+    if ( !iApplyDynamicLevelMark )
+        {
+        
+        iNotifyObserver = EFalse;
+        for (TInt index = 0; index < VideoClipCount(); index++)
+        {
+            TBool fadeIn = EFalse;
+            TBool fadeOut = EFalse;
+            if ( index == 0 )
+                {
+                // first clip, allow fade in always
+                fadeIn = ETrue;
+                }
+            else if (iVideoClipArray[index-1]->iMiddleTransitionEffect != EVedMiddleTransitionEffectNone) 
+                {
+                // there is a transition effect before this clip, allow fade in
+                fadeIn = ETrue;
+                }
+            else
+                {
+                // no transition, no audio fading either
+                fadeIn = EFalse;
+                }
+            
+            if ( index == VideoClipCount()-1 )
+                {
+                // last clip, allow fade out always
+                fadeOut = ETrue;
+                }
+            else if (iVideoClipArray[index]->iMiddleTransitionEffect != EVedMiddleTransitionEffectNone) 
+                {
+                // there is a transition effect after this clip, allow fade out
+                fadeOut = ETrue;
+                }
+            else
+                {
+                // no transition, no audio fading either
+                fadeOut = EFalse;
+                }
+                
+            CVedVideoClip* clip = iVideoClipArray[index];
+            
+            if (clip->EditedHasAudio() && !clip->IsMuted() && (fadeIn || fadeOut))
+            {                                    
+
+                TTimeIntervalMicroSeconds clipLength = 
+                    TTimeIntervalMicroSeconds( clip->CutOutTime().Int64() - clip->CutInTime().Int64() );
+                    
+                // Do fading only if clip length is over 1 second
+                // Otherwise the original markers remain untouched
+                if ( clipLength > TTimeIntervalMicroSeconds(1000000) )
+                {
+                    // get normal level
+                    TInt normalLevel = 0;
+
+                    // get normal level 
+                
+                    // NOTE: This assumes that the client has set a constant 
+                    // gain value for the whole clip, i.e. two markers,
+                    // one at the beginning and other at the end        
+                    // iApplyDynamicLevelMark now controls that removing others is safe
+                    
+                    normalLevel = clip->GetVolumeGain();
+                    
+                    // remove all existing markers               
+                    while (clip->DynamicLevelMarkCount())
+                    {
+                        clip->RemoveDynamicLevelMark(0);
+                    }                        
+                     
+                    // add movie-level volume gain
+                    normalLevel += iVolumeGainForAllVideoClips;
+                    
+                    // use normal - 50dB as lower level; step in values is 0.5db
+                    TInt lowLevel = normalLevel - 100;
+                    if ( lowLevel < -127 )
+                        {
+                        lowLevel = -127;
+                        }
+
+                    // 0s: low
+                    TVedDynamicLevelMark mark1(clip->CutInTime(), lowLevel);
+                    
+                    // 0.5s: normal
+                    TTimeIntervalMicroSeconds time = 
+                        TTimeIntervalMicroSeconds(clip->CutInTime().Int64() + 
+                                                  TInt64(500000) );
+                    
+                    TVedDynamicLevelMark mark2(time, normalLevel);
+                    
+                    // clip length - 0.5s: normal
+                    time = TTimeIntervalMicroSeconds(clip->CutOutTime().Int64() -
+                                                     TInt64(500000) );
+
+                    TVedDynamicLevelMark mark3(time, normalLevel);                                    
+                    
+                    // clip length: low
+                    TVedDynamicLevelMark mark4(clip->CutOutTime(), lowLevel);
+                    
+                    if ( fadeIn )
+                        {
+                        clip->InsertDynamicLevelMarkL(mark1);
+                        clip->InsertDynamicLevelMarkL(mark2);
+                        }
+                    if ( fadeOut )
+                        {
+                        clip->InsertDynamicLevelMarkL(mark3);
+                        clip->InsertDynamicLevelMarkL(mark4);
+                        }
+                }
+            }
+        }
+        
+        for (TInt index = 0; index < AudioClipCount(); index++)
+        {
+            CAudClip* clip = iAudSong->Clip(index, KVedAudioTrackIndex);
+            
+            if (!clip->Muting())
+            {
+
+                TTimeIntervalMicroSeconds clipLength = 
+                    TTimeIntervalMicroSeconds( clip->CutOutTime().Int64() - clip->CutInTime().Int64() );
+                    
+                // Do fading only if clip length is over 1 second
+                // Otherwise the original markers remain untouched
+                if ( clipLength > TTimeIntervalMicroSeconds(1000000) )                
+                {
+                    // get normal level
+                    TInt normalLevel = 0;
+                    
+                    // get normal level 
+                
+                    // NOTE: This assumes that the client has set a constant 
+                    // gain value for the whole clip, i.e. two markers,
+                    // one at the beginning and other at the end        
+                    // iApplyDynamicLevelMark now controls that removing others is safe
+                
+                    normalLevel = clip->GetVolumeGain();
+                    
+                    // remove all existing markers               
+                    while (clip->DynamicLevelMarkCount())
+                    {                    
+                        clip->RemoveDynamicLevelMark(0);                 
+                    }
+                    // add movie-level volume gain
+                    normalLevel += iVolumeGainForAllAudioClips;
+                    
+                    // use normal - 50dB as lower level; step in values is 0.5db
+                    TInt lowLevel = normalLevel - 100;
+                    if ( lowLevel < -127 )
+                        {
+                        lowLevel = -127;
+                        }
+                
+                    // 0s: low
+                    TAudDynamicLevelMark mark1(clip->CutInTime(), lowLevel);
+                    
+                    // 0.5s: normal
+                    TTimeIntervalMicroSeconds time = 
+                        TTimeIntervalMicroSeconds(clip->CutInTime().Int64() + 
+                                                  TInt64(500000) );
+                                
+                    TAudDynamicLevelMark mark2(time, normalLevel);
+                    
+                    // clip length - 0.5s: normal
+                    time = TTimeIntervalMicroSeconds(clip->CutOutTime().Int64() -
+                                                     TInt64(500000) );
+                                                                                  
+                    TAudDynamicLevelMark mark3(time, normalLevel);                                    
+                    
+                    // clip length: low
+                    TAudDynamicLevelMark mark4(clip->CutOutTime(), lowLevel);
+                                              
+                    clip->InsertDynamicLevelMarkL(mark1);
+                    clip->InsertDynamicLevelMarkL(mark2);
+                    clip->InsertDynamicLevelMarkL(mark3);
+                    clip->InsertDynamicLevelMarkL(mark4);
+                }
+            }
+        }
+        
+        iNotifyObserver = ETrue;
+        }
+    }
+
+void CVedMovieImp::SetOutputParametersL(TVedOutputParameters& aOutputParams)
+{
+    PRINT((_L("CVedMovie::SetOutputParametersL(), aOutputParams: video %d, (%dx%d), %d bps, %ffps"), aOutputParams.iVideoType, aOutputParams.iVideoResolution.iWidth, aOutputParams.iVideoResolution.iHeight, aOutputParams.iVideoBitrate, aOutputParams.iVideoFrameRate));
+    PRINT((_L("CVedMovie::SetOutputParametersL(), aOutputParams: audio %d, %d bps, s/m: %d, %d Hz"), aOutputParams.iAudioType, aOutputParams.iAudioBitrate, aOutputParams.iAudioChannelMode, aOutputParams.iAudioSamplingRate));
+    PRINT((_L("CVedMovie::SetOutputParametersL(), aOutputParams: video segmentation: %d GOBs, %d bytes/segment"), aOutputParams.iSyncIntervalInPicture, aOutputParams.iSegmentSizeInBytes));
+    
+    if (aOutputParams.iVideoType != EVedVideoTypeUnrecognized && 
+        aOutputParams.iVideoType != EVedVideoTypeNoVideo)
+    {
+        iVideoType = aOutputParams.iVideoType;
+    }
+    
+    if ( (aOutputParams.iVideoResolution != TSize(0, 0)) &&
+         (aOutputParams.iVideoResolution != KVedResolutionSubQCIF) && 
+		 (aOutputParams.iVideoResolution != KVedResolutionQCIF) &&
+		 (aOutputParams.iVideoResolution != KVedResolutionCIF) && 
+		 (aOutputParams.iVideoResolution != KVedResolutionQVGA) &&
+		 (aOutputParams.iVideoResolution != KVedResolutionVGA16By9) &&
+		 (aOutputParams.iVideoResolution != KVedResolutionVGA) &&
+		 (aOutputParams.iVideoResolution != KVedResolutionWVGA) )
+	{
+        User::Leave(KErrNotSupported);
+    }
+    
+#ifndef VIDEOEDITORENGINE_AVC_EDITING   
+    if ( iVideoType == EVedVideoTypeAVCBaselineProfile )
+        User::Leave(KErrNotSupported);
+#endif
+
+    // Allow AVC & MPEG-4 QVGA/CIF
+    if ( ( aOutputParams.iVideoResolution == KVedResolutionCIF ) ||
+         ( aOutputParams.iVideoResolution == KVedResolutionQVGA ) )
+    {
+        if ( iVideoType == EVedVideoTypeH263Profile0Level10 ||
+             iVideoType == EVedVideoTypeH263Profile0Level45 )
+            User::Leave(KErrNotSupported);
+        
+    }
+    // Allow MPEG VGA
+    if ( aOutputParams.iVideoResolution == KVedResolutionVGA )
+    {
+        if ( iVideoType != EVedVideoTypeMPEG4SimpleProfile )
+            User::Leave(KErrNotSupported);        
+    }            
+
+    if (aOutputParams.iVideoResolution != TSize(0,0))
+        iResolution = aOutputParams.iVideoResolution;
+
+    switch (iVideoType)
+        {
+        case EVedVideoTypeH263Profile0Level10:
+
+            // check bitrate
+            if ( aOutputParams.iVideoBitrate > KVedBitRateH263Level10 )
+                User::Leave(KErrNotSupported);
+            iVideoCodecMimeType.Set(KVedMimeTypeH263);
+            break;
+
+        case EVedVideoTypeH263Profile0Level45:
+
+            // check bitrate
+            if ( aOutputParams.iVideoBitrate > KVedBitRateH263Level45 )
+                User::Leave(KErrNotSupported);                        
+            iVideoCodecMimeType.Set(KVedMimeTypeH263Level45);
+            break;
+
+        case EVedVideoTypeMPEG4SimpleProfile:
+
+            // check bitrate
+            if ( iResolution == KVedResolutionCIF || iResolution == KVedResolutionQVGA )
+                {
+                if ( aOutputParams.iVideoBitrate > KVedBitRateMPEG4Level2 )
+                    User::Leave(KErrNotSupported);
+                iVideoCodecMimeType.Set(KVedMimeTypeMPEG4SimpleVisualProfileLevel2);
+                }
+                
+           else if ( iResolution == KVedResolutionVGA || iResolution == KVedResolutionVGA16By9 )
+               {
+               if ( aOutputParams.iVideoBitrate > KVedBitRateMPEG4Level4A )
+                   User::Leave(KErrNotSupported);           	
+               iVideoCodecMimeType.Set(KVedMimeTypeMPEG4SimpleVisualProfileLevel4A);
+               }
+
+            else
+                {
+                if ( aOutputParams.iVideoBitrate > KVedBitRateMPEG4Level0 )
+                    User::Leave(KErrNotSupported);
+                iVideoCodecMimeType.Set(KVedMimeTypeMPEG4SimpleVisualProfile);
+                }
+            break;
+            
+        case EVedVideoTypeAVCBaselineProfile:
+
+            // check bitrate
+        	//WVGA task
+        	if ( iResolution == KVedResolutionWVGA )
+        	{
+        		iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel3_1);
+        	}
+        		
+        	else if ( iResolution == KVedResolutionCIF || iResolution == KVedResolutionQVGA )
+            {
+                if ( aOutputParams.iVideoBitrate > KVedBitRateAVCLevel1_2 )
+                    User::Leave(KErrNotSupported);
+                if ( aOutputParams.iVideoBitrate <= KVedBitRateAVCLevel1_1 )
+                    iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel1_1);
+                else
+                    iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel1_2);
+            }
+            else
+            {
+                if ( aOutputParams.iVideoBitrate > KVedBitRateAVCLevel1b )
+                    User::Leave(KErrNotSupported);
+                if ( aOutputParams.iVideoBitrate <= KVedBitRateAVCLevel1 )                
+                    iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel1);
+                else
+                    iVideoCodecMimeType.Set(KVedMimeTypeAVCBaselineProfileLevel1B);
+            }
+        break;
+
+        default:
+            User::Leave(KErrArgument);
+
+        }
+        
+    // check if the selected codec/resolution is a supported format
+    TBool supported = iCodecChecker->IsSupportedOutputFormatL(iVideoCodecMimeType, iResolution);    
+    if ( !supported )
+    {
+        PRINT(_L("CVedMovie::SetOutputParametersL(), format not supported"));        
+        User::Leave(KErrNotSupported);
+    }   
+    
+    // can be zero => not used 
+    iVideoStandardBitrate = iVideoRestrictedBitrate = aOutputParams.iVideoBitrate;
+
+    // check frame rate
+    if (aOutputParams.iVideoFrameRate > KVedMaxVideoFrameRate)
+        User::Leave(KErrNotSupported);
+
+    // default random access rate is 1/5 fps
+    iRandomAccessRate = 0.2;
+    
+    // can be zero => not used 
+    iVideoFrameRate = aOutputParams.iVideoFrameRate;
+    
+    if (aOutputParams.iAudioType == EVedAudioTypeNoAudio)
+        {
+        // use default audio for this video
+        switch (iVideoType)
+            {
+            case EVedVideoTypeH263Profile0Level10:
+            case EVedVideoTypeH263Profile0Level45:
+                aOutputParams.iAudioType = EVedAudioTypeAMR;
+            break;
+
+            case EVedVideoTypeMPEG4SimpleProfile:
+            case EVedVideoTypeAVCBaselineProfile:
+            default:
+                aOutputParams.iAudioType = EVedAudioTypeAAC_LC;
+            break;
+            }
+            
+        }
+
+    if (aOutputParams.iAudioType != EVedAudioTypeAMR &&
+        aOutputParams.iAudioType != EVedAudioTypeAAC_LC )
+        User::Leave(KErrNotSupported);        
+
+    if ( aOutputParams.iAudioChannelMode != EVedAudioChannelModeStereo && 
+         aOutputParams.iAudioChannelMode != EVedAudioChannelModeDualChannel && 
+         aOutputParams.iAudioChannelMode != EVedAudioChannelModeSingleChannel )
+         User::Leave(KErrArgument);    
+
+    if ( aOutputParams.iAudioType == EVedAudioTypeAMR )
+        {
+        if ( aOutputParams.iAudioBitrate != 0 &&
+             aOutputParams.iAudioBitrate != KVedAMRBitrate4_75k &&
+             aOutputParams.iAudioBitrate != KVedAMRBitrate5_15k &&
+             aOutputParams.iAudioBitrate != KVedAMRBitrate5_90k &&
+             aOutputParams.iAudioBitrate != KVedAMRBitrate6_70k &&
+             aOutputParams.iAudioBitrate != KVedAMRBitrate7_40k &&
+             aOutputParams.iAudioBitrate != KVedAMRBitrate7_95k &&
+             aOutputParams.iAudioBitrate != KVedAMRBitrate10_2k &&
+             aOutputParams.iAudioBitrate != KVedAMRBitrate12_2k ) 
+            {
+            User::Leave(KErrNotSupported);
+            }
+        
+        if ( aOutputParams.iAudioSamplingRate != 0 && 
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate8k )
+            User::Leave(KErrNotSupported);
+
+        if ( aOutputParams.iAudioChannelMode != EVedAudioChannelModeSingleChannel )
+            User::Leave(KErrNotSupported);
+
+        }
+
+    else if (aOutputParams.iAudioType == EVedAudioTypeAAC_LC)
+        {        
+        if ( aOutputParams.iAudioSamplingRate != 0 &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate8k &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate11_025k &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate12k &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate16k &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate22_050k &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate24k &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate32k &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate44_1k &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate48k &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate64k &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate88_2k &&
+             aOutputParams.iAudioSamplingRate != KVedAudioSamplingRate96k )
+            {
+            User::Leave(KErrNotSupported);
+            }
+
+        TInt numChannels = 1;
+        if ( aOutputParams.iAudioChannelMode == EVedAudioChannelModeStereo || 
+             aOutputParams.iAudioChannelMode == EVedAudioChannelModeDualChannel )
+             numChannels = 2;              
+
+        TInt samplingRate = (aOutputParams.iAudioSamplingRate != 0) ? aOutputParams.iAudioSamplingRate : KVedAudioSamplingRate16k;
+
+        TInt minBitrate = 1 * numChannels * samplingRate;
+        TInt maxBitrate = 6 * numChannels * samplingRate;        
+
+        if ( aOutputParams.iAudioBitrate > 0 && 
+            (aOutputParams.iAudioBitrate < minBitrate || aOutputParams.iAudioBitrate > maxBitrate) )
+            User::Leave(KErrNotSupported);
+
+        }
+    
+    if ( iVideoType == EVedVideoTypeH263Profile0Level10 ||
+        iVideoType == EVedVideoTypeH263Profile0Level45 )
+        {
+        // For H.263
+        iSyncIntervalInPicture = aOutputParams.iSyncIntervalInPicture;
+        
+        // Segment size not supported for H.263
+        if ( aOutputParams.iSegmentSizeInBytes != 0 )
+            User::Leave(KErrNotSupported);
+        }
+    else
+        {
+        // For H.264 and MPEG-4
+        iSyncIntervalInPicture = aOutputParams.iSegmentSizeInBytes;
+        
+        // Sync interval not supported for H.264 and MPEG-4
+        if ( aOutputParams.iSyncIntervalInPicture != 0 )
+            User::Leave(KErrNotSupported);
+        }
+
+    TAudFileProperties audioProperties;
+    
+    if (aOutputParams.iAudioType == EVedAudioTypeAMR)
+        audioProperties.iAudioType = EAudAMR;
+    
+    else if (aOutputParams.iAudioType == EVedAudioTypeAAC_LC)
+        audioProperties.iAudioType = EAudAAC_MPEG4;
+    
+    if (aOutputParams.iAudioBitrate > 0)
+        audioProperties.iBitrate = aOutputParams.iAudioBitrate;
+    
+    if (aOutputParams.iAudioSamplingRate > 0)
+        audioProperties.iSamplingRate = aOutputParams.iAudioSamplingRate;
+    
+    audioProperties.iChannelMode = EAudSingleChannel;
+           
+    if (aOutputParams.iAudioChannelMode == EVedAudioChannelModeStereo)
+        audioProperties.iChannelMode = EAudStereo;    
+    
+    else if (aOutputParams.iAudioChannelMode == EAudDualChannel)
+        audioProperties.iChannelMode = EAudDualChannel;
+    
+    // Set the audio output properties here to the values specified above
+    if ( iAudSong->SetOutputFileFormat(audioProperties.iAudioType, audioProperties.iSamplingRate,audioProperties.iChannelMode, audioProperties.iBitrate) )
+        {
+        iOutputParamsSet = ETrue;
+        FireMovieOutputParametersChanged(this);
+        }
+    else
+        {
+        // parameters didn't work
+        User::Leave( KErrArgument );
+        }
+}
+
+
+TInt CVedMovieImp::CheckVideoClipInsertable(CVedVideoClip *aClip) const
+    {
+    /* Check format and video and audio types of a file-based clip. */
+    if ( !aClip )
+        {
+        return KErrGeneral;
+        }
+
+    if (aClip->iInfo->Class() == EVedVideoClipClassFile)
+        {
+        if ( (aClip->iInfo->Format() != EVedVideoFormat3GPP) && 
+             (aClip->iInfo->Format() != EVedVideoFormatMP4)
+            )       
+            {
+            return KErrNotSupported;
+            }
+
+        if ( (aClip->iInfo->VideoType() != EVedVideoTypeH263Profile0Level10) && 
+             (aClip->iInfo->VideoType() != EVedVideoTypeH263Profile0Level45) && 
+             (aClip->iInfo->VideoType() != EVedVideoTypeMPEG4SimpleProfile) &&
+             (aClip->iInfo->VideoType() != EVedVideoTypeAVCBaselineProfile)             
+            )
+            {
+            return KErrNotSupported;
+            }
+
+        if ( (aClip->iInfo->AudioType() != EVedAudioTypeNoAudio) && 
+             (aClip->iInfo->AudioType() != EVedAudioTypeAMR) && 
+             (aClip->iInfo->AudioType() != EVedAudioTypeAMRWB) &&
+             (aClip->iInfo->AudioType() != EVedAudioTypeAAC_LC) )
+            {
+            return KErrNotSupported;
+            }
+
+        if ( (aClip->iInfo->AudioType() != EVedAudioTypeNoAudio) && aClip->iInfo->AudioChannelMode() == EVedAudioChannelModeUnrecognized )
+            {
+            return KErrNotSupported;
+            }
+        }
+
+    if (aClip->Info()->Class() == EVedVideoClipClassFile)
+    {
+        TInt error = KErrNone;
+        TBool supported = EFalse;
+        
+        // check if clip format / resolution is supported
+        TRAP( error, supported = iCodecChecker->IsSupportedInputClipL(aClip) );
+        
+        if ( error != KErrNone )
+        {
+            return error;
+        }
+        
+        if ( !supported )
+        {
+            PRINT(_L("CVedMovie::CheckVideoClipInsertable(), clip not supported"));
+            return KErrNotSupported;            
+        }
+    }            
+
+    return KErrNone;
+    }
+
+
+TInt CVedMovieImp::GetSizeEstimateL() const
+    {
+    PRINT(_L("CVedMovieImp::GetSizeEstimateL"));
+
+    if ((VideoClipCount() == 0) && (AudioClipCount() == 0)) 
+        {
+        return 0;
+        }
+
+    if ( iProcessor )
+        {
+        return iProcessor->GetMovieSizeEstimateL(this);
+        }
+    else
+        {
+        return 0;
+        }
+    }
+
+void CVedMovieImp::GetDurationEstimateL(TInt aTargetSize, 
+                                        TTimeIntervalMicroSeconds aStartTime, 
+                                        TTimeIntervalMicroSeconds& aEndTime)
+    {
+    if ((VideoClipCount() == 0) && (AudioClipCount() == 0)) 
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    if ( iProcessor )
+        {
+        User::LeaveIfError( iProcessor->GetMovieSizeEstimateForMMSL(this, 
+                                                                    aTargetSize,
+                                                                    aStartTime,
+                                                                    aEndTime) );
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+
+TBool CVedMovieImp::IsMovieMMSCompatible() const
+    {
+    return ( ( iFormat == EVedVideoFormat3GPP ) &&
+             ( iVideoType == EVedVideoTypeH263Profile0Level10 ) &&
+             ( AudioType() == EVedAudioTypeAMR ) );
+    }
+
+
+void CVedMovieImp::InsertVideoClipL(const TDesC& aFileName, TInt aIndex)
+    {
+    PRINT(_L("CVedMovieImp::InsertVideoClipL"));
+
+    __ASSERT_ALWAYS(iAddOperation->iVideoClip == 0, 
+                    TVedPanic::Panic(TVedPanic::EMovieAddOperationAlreadyRunning));
+    iAddedVideoClipIndex = aIndex;
+    
+    if (iAddedVideoClipFilename) 
+        {
+        delete iAddedVideoClipFilename;
+        iAddedVideoClipFilename = 0;
+        }
+
+    iAddedVideoClipFilename = HBufC::NewL(aFileName.Size());
+    *iAddedVideoClipFilename = aFileName;
+    iAddedVideoClipFileHandle = NULL;
+
+    // add audio clip
+    TTimeIntervalMicroSeconds startTime(0);
+
+    if (aIndex > 0) 
+        {
+        startTime = VideoClipEndTime(aIndex - 1);
+        }
+    iAudSong->AddClipL(aFileName, startTime);
+    }
+
+void CVedMovieImp::InsertVideoClipL(RFile* aFileHandle, TInt aIndex)
+    {
+    PRINT(_L("CVedMovieImp::InsertVideoClipL"));
+
+    __ASSERT_ALWAYS(iAddOperation->iVideoClip == 0, 
+                    TVedPanic::Panic(TVedPanic::EMovieAddOperationAlreadyRunning));
+    iAddedVideoClipIndex = aIndex;
+    
+    if (iAddedVideoClipFilename) 
+        {
+        delete iAddedVideoClipFilename;
+        iAddedVideoClipFilename = 0;
+        }
+
+    iAddedVideoClipFileHandle = aFileHandle;
+
+    // add audio clip
+    TTimeIntervalMicroSeconds startTime(0);
+
+    if (aIndex > 0) 
+        {
+        startTime = VideoClipEndTime(aIndex - 1);
+        }
+    iAudSong->AddClipL(aFileHandle, startTime);
+    }
+
+
+
+void CVedMovieImp::InsertVideoClipL(CVedVideoClipGenerator& aGenerator, 
+                                    TBool aIsOwnedByVideoClip, TInt aIndex)
+    {
+    PRINT(_L("CVedMovieImp::InsertVideoClipL"));
+
+    __ASSERT_ALWAYS(iAddOperation->iVideoClip == 0, 
+                    TVedPanic::Panic(TVedPanic::EMovieAddOperationAlreadyRunning));
+
+    iAddOperation->iVideoClip = CVedVideoClip::NewL(this, aGenerator, 
+                                                    aIndex, *iAddOperation, aIsOwnedByVideoClip);
+    iAddOperation->iIsVideoGeneratorOwnedByVideoClip = aIsOwnedByVideoClip;
+    }
+
+    
+void CVedMovieImp::RemoveVideoClip(TInt aIndex)
+    {
+    PRINT(_L("CVedMovieImp::RemoveVideoClip"));
+
+    if ( (aIndex > VideoClipCount()) || (aIndex < 0) )
+    {
+        return;    
+    }
+
+    CVedVideoClip* clip = iVideoClipArray[aIndex];
+    TBool hasAudio = clip->EditedHasAudio();
+    if (hasAudio)
+    	{
+    	iAudSong->RemoveClip(clip->iAudClip->IndexOnTrack(), 0);	
+    	}
+    
+    iVideoClipArray.Remove(aIndex);
+    delete clip;
+    
+    if (aIndex < VideoClipCount())
+        {
+        clip = iVideoClipArray[aIndex];
+        clip->iIndex = aIndex;
+        RecalculateVideoClipTimings(clip);
+        }
+    else if (VideoClipCount() > 0)
+        {
+        clip = iVideoClipArray[aIndex - 1];
+        RecalculateVideoClipTimings(clip);
+        }    
+
+    TRAPD(err,CalculatePropertiesL());// ignore error?
+    if (err != KErrNone) { }
+
+    FireVideoClipRemoved(this, aIndex);
+    }
+
+    
+void CVedMovieImp::RecalculateVideoClipTimings(CVedVideoClip* aVideoClip)
+    {
+    TInt index = aVideoClip->iIndex;
+
+    TInt64 startTime;
+    if (index == 0)
+        {
+        startTime = 0;
+        }
+    else
+        {
+        startTime = iVideoClipArray[index - 1]->EndTime().Int64();
+        }
+    
+    for (; index < VideoClipCount(); index++)
+        {
+        CVedVideoClip* clip = iVideoClipArray[index];
+        clip->iIndex = index;
+        clip->iStartTime = startTime;
+        clip->UpdateAudioClip();
+        startTime = clip->EndTime().Int64();
+        }
+    iAudSong->SetDuration(Duration());
+    }
+
+
+void CVedMovieImp::SetStartTransitionEffect(TVedStartTransitionEffect aEffect)
+    {
+    __ASSERT_ALWAYS(VideoClipCount() > 0, TVedPanic::Panic(TVedPanic::EMovieEmpty));
+    __ASSERT_ALWAYS((aEffect >= EVedStartTransitionEffectNone) 
+                    && (aEffect < EVedStartTransitionEffectLast), 
+                    TVedPanic::Panic(TVedPanic::EMovieIllegalStartTransitionEffect));
+
+    if (aEffect != iStartTransitionEffect)
+        {
+        iStartTransitionEffect = aEffect;
+        FireStartTransitionEffectChanged(this);
+        }
+    }
+
+
+void CVedMovieImp::SetMiddleTransitionEffect(TVedMiddleTransitionEffect aEffect,
+                                                   TInt aIndex)
+    {
+    __ASSERT_ALWAYS((aEffect >= EVedMiddleTransitionEffectNone) 
+                    && (aEffect < EVedMiddleTransitionEffectLast), 
+                    TVedPanic::Panic(TVedPanic::EMovieIllegalMiddleTransitionEffect));
+
+    if (aIndex == (iVideoClipArray.Count() - 1))
+        {
+        aIndex++;   // make aIndex out of range to cause panic
+        }
+
+    if (aEffect != iVideoClipArray[aIndex]->iMiddleTransitionEffect)
+        {
+        iVideoClipArray[aIndex]->iMiddleTransitionEffect = aEffect;
+        FireMiddleTransitionEffectChanged(this, aIndex);
+        }
+    }
+
+
+void CVedMovieImp::SetEndTransitionEffect(TVedEndTransitionEffect aEffect)
+    {
+    __ASSERT_ALWAYS(VideoClipCount() > 0, TVedPanic::Panic(TVedPanic::EMovieEmpty));
+    __ASSERT_ALWAYS((aEffect >= EVedEndTransitionEffectNone) 
+                    && (aEffect < EVedEndTransitionEffectLast), 
+                    TVedPanic::Panic(TVedPanic::EMovieIllegalEndTransitionEffect));
+
+    if (aEffect != iEndTransitionEffect)
+        {
+        iEndTransitionEffect = aEffect;
+        FireEndTransitionEffectChanged(this);
+        }
+    }
+
+
+void CVedMovieImp::AddAudioClipL(const TDesC& aFileName,
+                                 TTimeIntervalMicroSeconds aStartTime,
+                                 TTimeIntervalMicroSeconds aCutInTime,
+                                 TTimeIntervalMicroSeconds aCutOutTime)
+    {
+    __ASSERT_ALWAYS(iAddOperation->iVideoClip == 0, 
+                    TVedPanic::Panic(TVedPanic::EMovieAddOperationAlreadyRunning));
+
+    iAudSong->AddClipL(aFileName, aStartTime, KVedAudioTrackIndex, aCutInTime, aCutOutTime);
+    }
+    
+void CVedMovieImp::AddAudioClipL(RFile* aFileHandle,
+                                 TTimeIntervalMicroSeconds aStartTime,
+                                 TTimeIntervalMicroSeconds aCutInTime,
+                                 TTimeIntervalMicroSeconds aCutOutTime)
+    {
+    __ASSERT_ALWAYS(iAddOperation->iVideoClip == 0, 
+                    TVedPanic::Panic(TVedPanic::EMovieAddOperationAlreadyRunning));
+
+    iAudSong->AddClipL(aFileHandle, aStartTime, KVedAudioTrackIndex, aCutInTime, aCutOutTime);
+    }
+
+
+void CVedMovieImp::RemoveAudioClip(TInt aIndex)
+    {
+    iAudSong->RemoveClip(aIndex, KVedAudioTrackIndex);
+    }
+
+void CVedMovieImp::Reset()
+    {
+    DoReset();
+
+    FireMovieReseted(this);
+    }
+
+
+void CVedMovieImp::DoReset()
+    {
+    iVideoClipArray.ResetAndDestroy();
+    iAudioClipInfoArray.ResetAndDestroy();
+
+    iStartTransitionEffect = EVedStartTransitionEffectNone;
+    iEndTransitionEffect = EVedEndTransitionEffectNone;
+    
+    if (iAudSong != 0)
+        {
+        iAudSong->Reset(EFalse);
+        }
+    }
+
+
+void CVedMovieImp::RegisterMovieObserverL(MVedMovieObserver* aObserver)
+    {
+    PRINT(_L("CVedMovieImp::RegisterMovieObserverL"));
+
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        if (iObserverArray[i] == aObserver)
+            {
+            TVedPanic::Panic(TVedPanic::EMovieObserverAlreadyRegistered);
+            }
+        }
+
+    User::LeaveIfError(iObserverArray.Append(aObserver));
+    }
+
+
+void CVedMovieImp::UnregisterMovieObserver(MVedMovieObserver* aObserver)
+    {
+    PRINT(_L("CVedMovieImp::UnregisterMovieObserver"));
+
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        if (iObserverArray[i] == aObserver)
+            {
+            iObserverArray.Remove(i);
+            return;
+            }
+        }
+    }
+    
+TBool CVedMovieImp::MovieObserverIsRegistered(MVedMovieObserver* aObserver)
+    {
+    PRINT(_L("CVedMovieImp::MovieObserverIsRegistered"));
+
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        if (iObserverArray[i] == aObserver)
+            {
+            return ETrue;
+            }
+        }
+        
+    return EFalse;
+    }
+
+CVedVideoClipInfo* CVedMovieImp::VideoClipInfo(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->Info();
+    }
+
+TBool CVedMovieImp::VideoClipEditedHasAudio(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->EditedHasAudio();
+    }
+
+void CVedMovieImp::VideoClipSetIndex(TInt aOldIndex, TInt aNewIndex)
+    {
+    iVideoClipArray[aOldIndex]->SetIndex(aNewIndex);
+    }
+
+TInt CVedMovieImp::VideoClipSpeed(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->Speed();   
+    }
+
+void CVedMovieImp::VideoClipSetSpeed(TInt aIndex, TInt aSpeed)
+    {
+    iVideoClipArray[aIndex]->SetSpeed(aSpeed);
+    }
+
+TVedColorEffect CVedMovieImp::VideoClipColorEffect(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->ColorEffect();     
+    }
+
+void CVedMovieImp::VideoClipSetColorEffect(TInt aIndex, TVedColorEffect aColorEffect)
+    {
+    iVideoClipArray[aIndex]->SetColorEffect(aColorEffect);
+    }
+
+TBool CVedMovieImp::VideoClipIsMuteable(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->IsMuteable();
+    }
+
+TBool CVedMovieImp::VideoClipIsMuted(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->IsMuted();
+    }
+
+void CVedMovieImp::VideoClipSetMuted(TInt aIndex, TBool aMuted)
+    {
+    iVideoClipArray[aIndex]->SetMuted(aMuted);
+    }
+    
+TBool CVedMovieImp::VideoClipNormalizing(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->Normalizing();
+    }
+
+void CVedMovieImp::VideoClipSetNormalizing(TInt aIndex, TBool aNormalizing)
+    {
+    iVideoClipArray[aIndex]->SetNormalizing(aNormalizing);
+    }
+           
+void CVedMovieImp::VideoClipInsertDynamicLevelMarkL(TInt aIndex, TVedDynamicLevelMark aMark)
+    {
+    __ASSERT_ALWAYS(aIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+
+    iApplyDynamicLevelMark = ETrue;
+    iVideoClipArray[aIndex]->InsertDynamicLevelMarkL(aMark);
+    }
+
+void CVedMovieImp::VideoClipRemoveDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex)
+    {
+    __ASSERT_ALWAYS(aClipIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+    
+    iVideoClipArray[aClipIndex]->RemoveDynamicLevelMark(aMarkIndex);
+    }
+
+TInt CVedMovieImp::VideoClipDynamicLevelMarkCount(TInt aIndex) const
+    {
+    __ASSERT_ALWAYS(aIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+
+    return iVideoClipArray[aIndex]->DynamicLevelMarkCount();
+    }
+
+TVedDynamicLevelMark CVedMovieImp::VideoClipDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex)
+    {
+    __ASSERT_ALWAYS(aClipIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+
+    return iVideoClipArray[aClipIndex]->DynamicLevelMark(aMarkIndex);
+    }
+
+TTimeIntervalMicroSeconds CVedMovieImp::VideoClipCutInTime(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->CutInTime();
+    }
+
+void CVedMovieImp::VideoClipSetCutInTime(TInt aIndex, TTimeIntervalMicroSeconds aCutInTime)
+    {
+    iVideoClipArray[aIndex]->SetCutInTime(aCutInTime);
+    // basically we should call CalculatePropertiesL after this one, but since it is called in StartMovie, we can probably skip it
+    }
+
+TTimeIntervalMicroSeconds CVedMovieImp::VideoClipCutOutTime(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->CutOutTime();
+    }
+
+void CVedMovieImp::VideoClipSetCutOutTime(TInt aIndex, TTimeIntervalMicroSeconds aCutOutTime)
+    {
+    iVideoClipArray[aIndex]->SetCutOutTime(aCutOutTime);
+    // basically we should call CalculatePropertiesL after this one, but since it is called in StartMovie, we can probably skip it
+    }
+
+TTimeIntervalMicroSeconds CVedMovieImp::VideoClipStartTime(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->StartTime();
+    }
+
+TTimeIntervalMicroSeconds CVedMovieImp::VideoClipEndTime(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->EndTime();
+    }
+
+TTimeIntervalMicroSeconds CVedMovieImp::VideoClipEditedDuration(TInt aIndex) const
+    {
+    return iVideoClipArray[aIndex]->EditedDuration();
+    }
+
+CVedAudioClipInfo* CVedMovieImp::AudioClipInfo(TInt aIndex) const
+    {
+    return iAudioClipInfoArray[aIndex];
+    }
+
+TTimeIntervalMicroSeconds CVedMovieImp::AudioClipStartTime(TInt aIndex) const
+    {
+    return iAudSong->Clip(aIndex, KVedAudioTrackIndex)->StartTime();
+    }
+
+void CVedMovieImp::AudioClipSetStartTime(TInt aIndex, TTimeIntervalMicroSeconds aStartTime)
+    {
+    iAudSong->Clip(aIndex, KVedAudioTrackIndex)->SetStartTime(aStartTime);
+    }
+
+TTimeIntervalMicroSeconds CVedMovieImp::AudioClipEndTime(TInt aIndex) const
+    {
+    return iAudSong->Clip(aIndex, KVedAudioTrackIndex)->EndTime();
+    }
+
+TTimeIntervalMicroSeconds CVedMovieImp::AudioClipEditedDuration(TInt aIndex) const
+    {
+    return iAudSong->Clip(aIndex, KVedAudioTrackIndex)->EditedDuration();
+    }
+
+void CVedMovieImp::AudioClipSetCutInTime(TInt aIndex, TTimeIntervalMicroSeconds aCutInTime)
+    {
+    iAudSong->Clip(aIndex, KVedAudioTrackIndex)->SetCutInTime(aCutInTime);
+    }
+
+void CVedMovieImp::AudioClipSetCutOutTime(TInt aIndex, TTimeIntervalMicroSeconds aCutOutTime)
+    {
+    iAudSong->Clip(aIndex, KVedAudioTrackIndex)->SetCutOutTime(aCutOutTime);
+    }
+
+
+TBool CVedMovieImp::AudioClipNormalizing(TInt aIndex) const
+    {
+    return iAudSong->Clip(aIndex, KVedAudioTrackIndex)->Normalizing();
+    }
+
+void CVedMovieImp::AudioClipSetNormalizing(TInt aIndex, TBool aNormalizing)
+    {
+    iAudSong->Clip(aIndex, KVedAudioTrackIndex)->SetNormalizing(aNormalizing);
+    }
+
+
+void CVedMovieImp::AudioClipInsertDynamicLevelMarkL(TInt aIndex, TVedDynamicLevelMark aMark)
+    {
+    __ASSERT_ALWAYS(aMark.iTime.Int64() >= 0, 
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMark));
+    __ASSERT_ALWAYS(aMark.iTime.Int64() <= AudioClipCutOutTime(aIndex).Int64(),
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMark));
+    __ASSERT_ALWAYS(aIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+    
+    iApplyDynamicLevelMark = ETrue;
+    iAudSong->Clip(aIndex, KVedAudioTrackIndex)->InsertDynamicLevelMarkL(TAudDynamicLevelMark(aMark.iTime, aMark.iLevel));
+    }
+
+void CVedMovieImp::AudioClipRemoveDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex)
+    {
+    __ASSERT_ALWAYS(aMarkIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMarkIndex));
+    __ASSERT_ALWAYS(aMarkIndex < AudioClipDynamicLevelMarkCount(aClipIndex),
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMarkIndex));
+    __ASSERT_ALWAYS(aClipIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+
+    iAudSong->Clip(aClipIndex, KVedAudioTrackIndex)->RemoveDynamicLevelMark(aMarkIndex);
+    }
+
+TInt CVedMovieImp::AudioClipDynamicLevelMarkCount(TInt aIndex) const
+    {
+    __ASSERT_ALWAYS(aIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+    return iAudSong->Clip(aIndex, KVedAudioTrackIndex)->DynamicLevelMarkCount();
+    }
+
+TVedDynamicLevelMark CVedMovieImp::AudioClipDynamicLevelMark(TInt aClipIndex, TInt aMarkIndex)
+    {
+    __ASSERT_ALWAYS(aMarkIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMarkIndex));
+    __ASSERT_ALWAYS(aMarkIndex < AudioClipDynamicLevelMarkCount(aClipIndex),
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMarkIndex));
+    __ASSERT_ALWAYS(aClipIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+                   
+    CAudClip* clip = iAudSong->Clip(aClipIndex, KVedAudioTrackIndex);
+    TAudDynamicLevelMark mark(clip->DynamicLevelMark(aMarkIndex));
+    return TVedDynamicLevelMark(mark.iTime, mark.iLevel);
+    }
+
+
+void CVedMovieImp::SetVideoClipVolumeGainL(TInt aClipIndex, TInt aVolumeGain)
+    {
+    iApplyDynamicLevelMark = EFalse;
+    
+    TInt marks = 0;
+    if (aClipIndex == KVedClipIndexAll)
+        {
+        // whole movie, sum with clip values in SetAudioFadingL
+        iVolumeGainForAllVideoClips = aVolumeGain;
+        marks = 1;
+        }
+    else
+        {
+        __ASSERT_ALWAYS(aClipIndex >= 0, 
+                        TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+        __ASSERT_ALWAYS(aClipIndex <= VideoClipCount(), 
+                        TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+        // set volume gain to the clip
+        CVedVideoClip* clip = iVideoClipArray[aClipIndex];
+        clip->SetVolumeGain(aVolumeGain);
+        
+        // should also add/remove a dynamic level mark to have the observer calls more meaningful 
+        // and avoid problems if client assumes a mark was really added
+        // the actual mark is removed when starting to process
+        if ( aVolumeGain != 0 )
+            {
+            // add
+            clip->InsertDynamicLevelMarkL(TVedDynamicLevelMark(clip->CutInTime(),aVolumeGain));
+            clip->InsertDynamicLevelMarkL(TVedDynamicLevelMark(clip->CutOutTime(),aVolumeGain));
+            }
+        else
+            {
+            // gain == 0 => remove marks
+            while (clip->DynamicLevelMarkCount() > 0)
+                {
+                marks++;
+                clip->RemoveDynamicLevelMark(0);
+                }
+            }
+        }
+        
+    // inform observers
+    if ( aVolumeGain == 0 )
+        {
+        // volume gain was set to 0 => no gain ~= remove level mark
+        for (TInt i = 0; i < iObserverArray.Count(); i++)
+            {
+            for ( TInt j = 0; j < marks; j++ )
+                {
+                iObserverArray[i]->NotifyVideoClipDynamicLevelMarkRemoved(*this, aClipIndex,0);
+                }
+            }
+        }
+    else
+        {
+        // volume gain was set to nonzero => gain ~= insert level mark
+        for (TInt i = 0; i < iObserverArray.Count(); i++)
+            {
+            iObserverArray[i]->NotifyVideoClipDynamicLevelMarkInserted(*this, aClipIndex, 0);
+            iObserverArray[i]->NotifyVideoClipDynamicLevelMarkInserted(*this, aClipIndex, 1);
+            }
+        }
+    }
+
+TInt CVedMovieImp::GetVideoClipVolumeGainL(TInt aClipIndex)
+    {
+    if (aClipIndex == KVedClipIndexAll)
+        {
+        return iVolumeGainForAllVideoClips;
+        }
+    else
+        {
+        // get volume gain from the clip
+        __ASSERT_ALWAYS(aClipIndex >= 0, 
+                        TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+        __ASSERT_ALWAYS(aClipIndex <= VideoClipCount(), 
+                        TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+        return iVideoClipArray[aClipIndex]->GetVolumeGain();
+        }
+    }
+
+void CVedMovieImp::SetAudioClipVolumeGainL(TInt aClipIndex, TInt aVolumeGain)
+    {
+    iApplyDynamicLevelMark = EFalse;
+    TInt marks = 0;
+    if (aClipIndex == KVedClipIndexAll)
+        {
+        // whole movie, sum with clip values in SetAudioFading
+        iVolumeGainForAllAudioClips = aVolumeGain;
+        marks = 1;
+        }
+    else
+        {
+        // set volume gain to the clip; the clip asserts the index
+        CAudClip* clip = iAudSong->Clip(aClipIndex, KVedAudioTrackIndex);
+        clip->SetVolumeGain(aVolumeGain);
+        
+        // should also add/remove a dynamic level mark to have the observer calls more meaningful 
+        // and avoid problems if client assumes a mark was really added
+        // the actual mark is removed when starting to process
+        if ( aVolumeGain != 0 )
+            {
+            // add
+            clip->InsertDynamicLevelMarkL(TAudDynamicLevelMark(clip->CutInTime(),aVolumeGain));
+            clip->InsertDynamicLevelMarkL(TAudDynamicLevelMark(clip->CutOutTime(),aVolumeGain));
+            }
+        else
+            {
+            // gain == 0 => remove
+            while (clip->DynamicLevelMarkCount() > 0)
+                {
+                marks++;
+                clip->RemoveDynamicLevelMark(0);
+                }
+            }
+        }
+        
+    // inform observers
+    if ( aVolumeGain == 0 )
+        {
+        // volume gain was set to 0 => no gain ~= remove level mark
+        for (TInt i = 0; i < iObserverArray.Count(); i++)
+            {
+            for ( TInt j = 0; j < marks; j++ )
+                {
+                iObserverArray[i]->NotifyAudioClipDynamicLevelMarkRemoved(*this, aClipIndex,0);
+                }
+            }
+        }
+    else
+        {
+        // volume gain was set to nonzero => gain ~= insert level mark
+        for (TInt i = 0; i < iObserverArray.Count(); i++)
+            {
+            iObserverArray[i]->NotifyAudioClipDynamicLevelMarkInserted(*this, aClipIndex,0);
+            }
+        }
+    }
+
+TInt CVedMovieImp::GetAudioClipVolumeGainL(TInt aClipIndex)
+    {
+    if (aClipIndex == KVedClipIndexAll)
+        {
+        return iVolumeGainForAllAudioClips;
+        }
+    else
+        {
+        // get volume gain from the clip; the clip asserts the index
+        CAudClip* clip = iAudSong->Clip(aClipIndex, KVedAudioTrackIndex);
+        return clip->GetVolumeGain();
+        }
+    }
+
+
+TRgb CVedMovieImp::VideoClipColorTone(TInt aVideoClipIndex) const
+    {    
+    return iVideoClipArray[aVideoClipIndex]->ColorTone();            
+    }
+
+void CVedMovieImp::VideoClipSetColorTone(TInt aVideoClipIndex, TRgb aColorTone)   
+    {
+    iVideoClipArray[aVideoClipIndex]->SetColorTone(aColorTone);    
+    }
+    
+    
+TTimeIntervalMicroSeconds CVedMovieImp::Duration() const
+    {
+    TTimeIntervalMicroSeconds duration = TTimeIntervalMicroSeconds(0);
+
+    if (VideoClipCount() > 0)
+        {
+        duration = iVideoClipArray[VideoClipCount() - 1]->EndTime();
+        }
+
+    for (TInt i = 0; i < AudioClipCount(); i++)
+        {
+        TTimeIntervalMicroSeconds endTime = iAudSong->Clip(i, KVedAudioTrackIndex)->EndTime();
+        if (endTime > duration)
+            {
+            duration = endTime;
+            }
+        }
+
+    return duration;
+    }
+
+    
+TInt CVedMovieImp::VideoClipCount() const
+    {
+    return iVideoClipArray.Count();
+    }
+
+
+CVedVideoClip* CVedMovieImp::VideoClip(TInt aClipIndex) const
+    {
+    return iVideoClipArray[aClipIndex];
+    }
+
+
+TVedStartTransitionEffect CVedMovieImp::StartTransitionEffect() const
+    {
+    __ASSERT_ALWAYS(VideoClipCount() > 0, TVedPanic::Panic(TVedPanic::EMovieEmpty));
+    return iStartTransitionEffect;
+    }
+
+
+TInt CVedMovieImp::MiddleTransitionEffectCount() const
+    {
+    return Max(0, iVideoClipArray.Count() - 1);
+    }
+
+
+TVedMiddleTransitionEffect CVedMovieImp::MiddleTransitionEffect(TInt aIndex) const
+    {
+    if (aIndex == (iVideoClipArray.Count() - 1))
+        {
+        aIndex++;    // make aIndex out of range to cause panic
+        }
+        
+    return iVideoClipArray[aIndex]->iMiddleTransitionEffect;
+    }
+
+
+TVedEndTransitionEffect CVedMovieImp::EndTransitionEffect() const
+    {
+    __ASSERT_ALWAYS(VideoClipCount() > 0, TVedPanic::Panic(TVedPanic::EMovieEmpty));
+    return iEndTransitionEffect;
+    }
+
+
+TInt CVedMovieImp::AudioClipCount() const
+    {
+    return iAudSong->ClipCount(KVedAudioTrackIndex);
+    }
+
+TTimeIntervalMicroSeconds CVedMovieImp::AudioClipCutInTime(TInt aIndex) const
+    {
+    return iAudSong->Clip(aIndex, KVedAudioTrackIndex)->CutInTime();
+    }
+
+TTimeIntervalMicroSeconds CVedMovieImp::AudioClipCutOutTime(TInt aIndex) const
+    {
+    return iAudSong->Clip(aIndex, KVedAudioTrackIndex)->CutOutTime();
+    }
+
+
+
+void CVedMovieImp::FireVideoClipAdded(CVedMovie* aMovie, CVedVideoClip* aClip)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyVideoClipAdded(*aMovie, aClip->Index());
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+
+void CVedMovieImp::FireVideoClipAddingFailed(CVedMovie* aMovie, TInt aError)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyVideoClipAddingFailed(*aMovie, aError);
+        }
+    }
+
+
+void CVedMovieImp::FireVideoClipRemoved(CVedMovie* aMovie, TInt aIndex)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyVideoClipRemoved(*aMovie, aIndex);
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+
+void CVedMovieImp::FireVideoClipIndicesChanged(CVedMovie* aMovie, TInt aOldIndex, 
+                                            TInt aNewIndex)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyVideoClipIndicesChanged(*aMovie, aOldIndex, aNewIndex);
+        }
+    }
+
+
+void CVedMovieImp::FireVideoClipTimingsChanged(CVedMovie* aMovie, CVedVideoClip* aClip)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyVideoClipTimingsChanged(*aMovie, aClip->Index());
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+
+void CVedMovieImp::FireVideoClipColorEffectChanged(CVedMovie* aMovie, CVedVideoClip* aClip)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyVideoClipColorEffectChanged(*aMovie, aClip->Index());
+        }
+    }
+
+
+void CVedMovieImp::FireVideoClipAudioSettingsChanged(CVedMovie* aMovie, CVedVideoClip* aClip)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyVideoClipAudioSettingsChanged(*aMovie, aClip->Index());
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+
+void CVedMovieImp::FireVideoClipGeneratorSettingsChanged(CVedMovie* aMovie, CVedVideoClip* aClip)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyVideoClipGeneratorSettingsChanged(*aMovie, aClip->Index());
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+void CVedMovieImp::FireVideoClipDescriptiveNameChanged(CVedMovie* aMovie, CVedVideoClip* aClip)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyVideoClipDescriptiveNameChanged(*aMovie, aClip->Index());
+        }
+    }
+
+void CVedMovieImp::FireStartTransitionEffectChanged(CVedMovie* aMovie)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyStartTransitionEffectChanged(*aMovie);
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+
+void CVedMovieImp::FireMiddleTransitionEffectChanged(CVedMovie* aMovie, TInt aIndex)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyMiddleTransitionEffectChanged(*aMovie, aIndex);
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+
+void CVedMovieImp::FireEndTransitionEffectChanged(CVedMovie* aMovie)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyEndTransitionEffectChanged(*aMovie);
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+
+void CVedMovieImp::FireAudioClipAdded(CVedMovie* aMovie, TInt aIndex)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyAudioClipAdded(*aMovie, aIndex);
+        }
+        
+    TRAPD(err,CalculatePropertiesL());// ignore error?
+    if (err != KErrNone) { }
+
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+
+void CVedMovieImp::FireAudioClipAddingFailed(CVedMovie* aMovie, TInt aError)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyAudioClipAddingFailed(*aMovie, aError);
+        }
+    }
+
+
+void CVedMovieImp::FireAudioClipRemoved(CVedMovie* aMovie, TInt aIndex)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyAudioClipRemoved(*aMovie, aIndex);
+        }
+
+    TRAPD(err,CalculatePropertiesL());// ignore error?
+    if (err != KErrNone) { }
+
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+
+void CVedMovieImp::FireAudioClipIndicesChanged(CVedMovie* aMovie, TInt aOldIndex, TInt aNewIndex)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyAudioClipIndicesChanged(*aMovie, 
+                                                         aOldIndex, aNewIndex);
+        }
+    }
+
+
+void CVedMovieImp::FireAudioClipTimingsChanged(CVedMovie* aMovie, CAudClip* aClip)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyAudioClipTimingsChanged(*aMovie, aClip->IndexOnTrack());
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+
+void CVedMovieImp::FireDynamicLevelMarkRemoved(CAudClip& aClip, TInt aMarkIndex)
+    {
+    TInt trackIndex = aClip.TrackIndex();
+    TInt clipIndex = aClip.IndexOnTrack();
+    
+    if (!iNotifyObserver)
+        return;
+    
+    if (trackIndex == 0) 
+        {
+        for (TInt i = 0; i < iObserverArray.Count(); i++)
+            {
+            iObserverArray[i]->NotifyVideoClipDynamicLevelMarkRemoved(*this, clipIndex, aMarkIndex);
+            }
+        }
+    else if (trackIndex == 1)
+        {
+        for (TInt i = 0; i < iObserverArray.Count(); i++)
+            {
+            iObserverArray[i]->NotifyAudioClipDynamicLevelMarkRemoved(*this, clipIndex, aMarkIndex);
+            }
+        }
+    else
+        {
+        TVedPanic::Panic(TVedPanic::EInternal);
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+void CVedMovieImp::FireDynamicLevelMarkInserted(CAudClip& aClip, TAudDynamicLevelMark& /*aMark*/, TInt aMarkIndex)
+    {
+    TInt trackIndex = aClip.TrackIndex();
+    TInt clipIndex = aClip.IndexOnTrack();
+    
+    if (!iNotifyObserver)
+        return;
+    
+    if (trackIndex == 0) 
+        {
+        for (TInt i = 0; i < iObserverArray.Count(); i++)
+            {
+            iObserverArray[i]->NotifyVideoClipDynamicLevelMarkInserted(*this, clipIndex, aMarkIndex);
+            }
+        }
+    else if (trackIndex == 1)
+        {
+        for (TInt i = 0; i < iObserverArray.Count(); i++)
+            {
+            iObserverArray[i]->NotifyAudioClipDynamicLevelMarkInserted(*this, clipIndex, aMarkIndex);
+            }
+        }
+    else
+        {
+        TVedPanic::Panic(TVedPanic::EInternal);
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+
+void CVedMovieImp::FireMovieQualityChanged(CVedMovie* aMovie)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyMovieQualityChanged(*aMovie);
+        }
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+    
+    
+void CVedMovieImp::FireMovieOutputParametersChanged(CVedMovie* aMovie)
+    {
+
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyMovieOutputParametersChanged(*aMovie);
+        }    
+    // reset the estimated processing time
+    iEstimatedProcessingTime = TTimeIntervalMicroSeconds(0);
+    }
+
+void CVedMovieImp::FireMovieReseted(CVedMovie* aMovie)
+    {
+    for (TInt i = 0; i < iObserverArray.Count(); i++)
+        {
+        iObserverArray[i]->NotifyMovieReseted(*aMovie);
+        }
+    }
+
+
+void CVedMovieImp::ProcessL(const TDesC& aFileName,
+                                  MVedMovieProcessingObserver& aObserver)
+    {
+    __ASSERT_ALWAYS((VideoClipCount() > 0) || (AudioClipCount() > 0), 
+                    TVedPanic::Panic(TVedPanic::EMovieEmpty));    
+
+    CalculatePropertiesL();
+    iAudSong->SetDuration(Duration());
+    SetAudioFadingL();
+    
+    iMovieProcessingObserver = &aObserver;
+    
+    iProcessor->StartMovieL(this, aFileName, NULL, &aObserver);
+    }
+    
+void CVedMovieImp::ProcessL(RFile* aFileHandle,
+                            MVedMovieProcessingObserver& aObserver)
+    {
+    __ASSERT_ALWAYS((VideoClipCount() > 0) || (AudioClipCount() > 0), 
+                    TVedPanic::Panic(TVedPanic::EMovieEmpty));    
+
+    CalculatePropertiesL();
+    iAudSong->SetDuration(Duration());
+    SetAudioFadingL();
+    
+    iMovieProcessingObserver = &aObserver;
+    TFileName dummy;
+    
+    iProcessor->StartMovieL(this, dummy, aFileHandle, &aObserver);
+    }
+
+
+void CVedMovieImp::CancelProcessing()
+    {
+    TRAPD(error, iProcessor->CancelProcessingL());
+    
+    if (error != KErrNone)
+        iMovieProcessingObserver->NotifyMovieProcessingCompleted(*this, error);
+    
+    }
+    
+void CVedMovieImp::SetMovieSizeLimit(TInt aLimit)
+    {
+    iProcessor->SetMovieSizeLimit(aLimit);
+    }
+
+TInt CVedMovieImp::SyncIntervalInPicture()
+    {
+    return iSyncIntervalInPicture;
+    }
+    
+TReal CVedMovieImp::RandomAccessRate()
+    {
+    return iRandomAccessRate;
+    }
+
+// Create a temporary transcoder instance and ask for transcoding time factor for the given settings
+TReal CVedMovieImp::AskComplexityFactorFromTranscoderL(CVedVideoClipInfo* aInfo, CTRTranscoder::TTROperationalMode aMode, TReal aInputFrameRate)
+    {
+    PRINT((_L("CVedMovieImp::AskComplexityFactorFromTranscoderL() in")));
+    TReal complexityFactor;
+    CTRTranscoder *tmpTranscoder;
+    TTRVideoFormat formIn;
+    TTRVideoFormat formOut;
+    formIn.iSize = aInfo->Resolution();
+    formIn.iDataType = CTRTranscoder::ETRDuCodedPicture;
+    formOut.iSize = iResolution;
+    formOut.iDataType = CTRTranscoder::ETRDuCodedPicture;
+    TBufC8<255> inputMime;
+    MapVideoCodecTypeToMime(aInfo->VideoType(), inputMime);
+    
+    // create temporary transcoder observer object, with input framerate as parameter, since it is asked by the transcoder
+    CTrObs* tmpObs = new (ELeave) CTrObs(aInputFrameRate);
+    CleanupStack::PushL(tmpObs);
+    
+    // create temporary transcoder instance
+    tmpTranscoder = CTRTranscoder::NewL(*tmpObs);
+    CleanupStack::PushL(tmpTranscoder);
+    tmpTranscoder->OpenL(reinterpret_cast<MCMRMediaSink*>(1),//the sink will not be used, hence this is acceptable 
+                aMode,
+                inputMime,
+                iVideoCodecMimeType,
+                formIn, 
+                formOut, 
+                EFalse );
+
+    // ask complexity/time factor from the transcoder                
+    complexityFactor = tmpTranscoder->EstimateTranscodeTimeFactorL(formIn, formOut);
+
+    CleanupStack::PopAndDestroy(tmpTranscoder);
+    CleanupStack::PopAndDestroy(tmpObs);
+
+    PRINT((_L("CVedMovieImp::AskComplexityFactorFromTranscoderL() out, complexity factor %f"), complexityFactor));
+    return complexityFactor;
+    }
+
+
+TTimeIntervalMicroSeconds CVedMovieImp::GetProcessingTimeEstimateL()
+    {    
+    PRINT((_L("CVedMovieImp::GetProcessingTimeEstimateL() in")));
+    TInt64 estimatedTime = 0;
+    TReal complexityFactor;
+    TBool transcodingImpactIncluded = EFalse;
+
+    // Don't estimate the time if it has been asked already. 
+    // This also means the result is not the remaining time but the total processing time
+    if ( iEstimatedProcessingTime > 0 )
+        {
+        return iEstimatedProcessingTime;
+        }
+        
+        
+    // Loop through the clips in the movie and estimate the processing time for each of them
+    for (TInt i = 0; i < VideoClipCount(); i++)
+        {
+        CVedVideoClipInfo* currentInfo = VideoClip(i)->Info();
+        
+        complexityFactor = 0;
+        transcodingImpactIncluded = EFalse;
+        
+        if ( currentInfo->Class() == EVedVideoClipClassGenerated )
+            {
+            // only encoding for generated content. Framerate is low.
+            transcodingImpactIncluded = ETrue;
+            
+            // open transcoder in encoding mode & ask the factor. 
+            // This is in practice for generated content only. Tbd if it is worth opening the transcoder?
+            complexityFactor = AskComplexityFactorFromTranscoderL(currentInfo, CTRTranscoder::EEncoding, 1.0);
+            // the temporary clip is then processed like a normal input clip, add the impact
+            complexityFactor += (KVedBitstreamProcessingFactor*iVideoStandardBitrate) / KVedBitstreamProcessingFactorBitrate;
+            }
+        else
+            {
+            // check if transcoding is needed
+            
+            // If input and output resolutions don't match, transcoder knows it need to do resolution transcoding
+            // However, we need to check here in which mode we'd open the transcoder
+            if ((currentInfo->Resolution() != iResolution) || (iVideoRestrictedBitrate != 0) 
+                || ((currentInfo->VideoType() == EVedVideoTypeH263Profile0Level45) && (iVideoType == EVedVideoTypeH263Profile0Level10)))
+                {
+                // need to do resolution transcoding
+                transcodingImpactIncluded = ETrue;
+                
+                // open transcoder in full transcoding mode & ask for the factor.
+                TReal framerate = TReal(1000*currentInfo->VideoFrameCount())/(currentInfo->Duration().Int64()/1000);
+                complexityFactor = AskComplexityFactorFromTranscoderL(currentInfo, CTRTranscoder::EFullTranscoding, framerate);
+                }
+            else 
+                {
+                // no full transcoding
+                
+                if ( currentInfo->VideoType() != iVideoType )
+                    {
+                    // compressed domain transcoding between H.263 and MPEG-4. Assuming they are equally complex
+                    
+                    complexityFactor = (KVedCompressedDomainTranscodingFactor * iVideoStandardBitrate) / KVedBitstreamProcessingFactorBitrate;
+                    }
+                else 
+                    {
+                    // Only bitstream processing + possibly cut or some other simple operation. Transition effect is estimated later
+                    // It is assumed that pure decoding is needed only for such a short period of time that 
+                    // the impact can be estimated here without opening processor/transcoder.
+                    
+                    // Bitrate has impact here. MPEG-4 is more complex to process than H.263 but bitrate is dominant. E,g, H.263 128 kbps vs MPEG4 512 kbps: 1:5 complexity; 1:4 bitrate
+                    complexityFactor = (KVedBitstreamProcessingFactor*iVideoStandardBitrate) / KVedBitstreamProcessingFactorBitrate;
+                    }
+                    
+                }
+            }
+            
+        // Now we have the video complexity factor for the current clip. Add the contribution to the total time
+        estimatedTime = estimatedTime + TInt64(complexityFactor * I64INT(VideoClip(i)->EditedDuration().Int64()));
+        
+        if (!transcodingImpactIncluded && (VideoClip(i)->iMiddleTransitionEffect != EVedMiddleTransitionEffectNone))
+            {
+            // add impact of transition effect; need decoding + encoding for a short period
+            
+            // open transcoder in full transcoding mode & ask for the factor.
+            TReal framerate = TReal(1000*currentInfo->VideoFrameCount())/(currentInfo->Duration().Int64()/1000);
+            complexityFactor = this->AskComplexityFactorFromTranscoderL(currentInfo, CTRTranscoder::EFullTranscoding, framerate);
+            estimatedTime = estimatedTime + TInt64(complexityFactor * 1000000);//transition duration; 1 sec is accurate enough here
+            }
+        
+        }
+
+    PRINT((_L("CVedMovieImp::GetProcessingTimeEstimateL(), video part estimated to %d sec"),I64INT(estimatedTime)/1000000 ));
+        
+    // add audio processing time
+    estimatedTime = estimatedTime + iAudSong->GetTimeEstimateL().Int64();
+    
+    PRINT((_L("CVedMovieImp::GetProcessingTimeEstimateL(), audio included, before rounding the estimate is %d sec"),I64INT(estimatedTime)/1000000 ));
+    // estimate is not too accurate anyway; round it
+    if ( estimatedTime > 600000000 )
+        {
+        // more than 10 minutes => round to nearest 2 min
+        estimatedTime = ((estimatedTime+60000000) / 120000000) * 120000000;
+        }
+    else if (estimatedTime > 120000000 )
+        {
+        // more than 2 minutes => round to nearest 30 sec
+        estimatedTime = ((estimatedTime+30000000) / 30000000) * 30000000;
+        }
+    else if (estimatedTime > 30000000 )
+        {
+        // more than 30 secs => round to nearest 10 sec
+        estimatedTime = ((estimatedTime+5000000) / 10000000) * 10000000;
+        }
+    else
+        {
+        // less than 30 secs => round to nearest 2 sec
+        estimatedTime = ((estimatedTime+1000000) / 2000000) * 2000000;
+        }
+        
+    iEstimatedProcessingTime = estimatedTime;
+    PRINT((_L("CVedMovieImp::GetProcessingTimeEstimateL() out, estimate is %d sec"),I64INT(estimatedTime)/1000000 ));
+    return estimatedTime;
+    
+    }
+
+
+void CVedMovieImp::NotifyClipAdded(CAudSong& aSong, CAudClip& aClip, TInt aIndex, TInt aTrackIndex)
+    {
+    PRINT((_L("CVedMovieImp::NotifyClipAdded() in") ));
+    // Track index 0 means it's the video track - we need to create the video clip 
+    if (aTrackIndex == 0) 
+        {
+        PRINT((_L("CVedMovieImp::NotifyClipAdded() added audio track of video clip to song successfully") ));
+
+        TInt err;        
+        if (iAddedVideoClipFileHandle)
+            {            
+            TRAP(err, iAddOperation->iVideoClip = CVedVideoClip::NewL(this, aClip.Info()->FileHandle(), iAddedVideoClipIndex, &aClip, *iAddOperation));
+            }
+        else
+            {
+            TRAP(err, iAddOperation->iVideoClip = CVedVideoClip::NewL(this, aClip.Info()->FileName(), iAddedVideoClipIndex, &aClip, *iAddOperation));
+            }
+        
+        if (err != KErrNone) 
+            {
+            PRINT((_L("CVedMovieImp::NotifyClipAdded() creating video clip failed, removing also audio") ));
+            // delete the audio clip from song
+            aSong.RemoveClip(aIndex);
+            
+            FireVideoClipAddingFailed(this, err);
+            }
+        delete iAddedVideoClipFilename;
+        iAddedVideoClipFilename = 0;
+        iAddedVideoClipFileHandle = 0;
+        }
+    else if (aTrackIndex == KVedAudioTrackIndex) 
+        {
+        // We're on the audio track so we need to create an audio clip info
+        PRINT((_L("CVedMovieImp::NotifyClipAdded() added audio track of audio clip to song successfully") ));
+        CVedAudioClipInfoImp* audioClipInfo = 0;
+        TRAPD(err, audioClipInfo = CVedAudioClipInfoImp::NewL(&aClip, *this));
+        if (err != KErrNone) 
+            {
+            delete audioClipInfo;
+            FireAudioClipAddingFailed(this, err);
+            return;
+            }
+        err = iAudioClipInfoArray.Insert(audioClipInfo, aIndex);
+        if (err != KErrNone) 
+            {
+            delete audioClipInfo;
+            FireAudioClipAddingFailed(this, err);
+            }
+        }
+    PRINT((_L("CVedMovieImp::NotifyClipAdded() out") ));
+    }
+
+void CVedMovieImp::NotifyClipAddingFailed(CAudSong& /*aSong*/, TInt aError, TInt aTrackIndex)
+    {
+    if (aTrackIndex == 0) 
+        {
+        if (aError == KErrNoAudio) 
+            {
+            // We can have video clips that have no audio track
+            
+            TInt err;
+            if (iAddedVideoClipFileHandle)
+                {
+                TRAP(err, iAddOperation->iVideoClip = CVedVideoClip::NewL(this, iAddedVideoClipFileHandle, iAddedVideoClipIndex, NULL, *iAddOperation));
+                }
+            else
+                {                
+                TRAP(err, iAddOperation->iVideoClip = CVedVideoClip::NewL(this, *iAddedVideoClipFilename, iAddedVideoClipIndex, NULL, *iAddOperation));
+                }
+            if (err != KErrNone) 
+                {
+                FireAudioClipAddingFailed(this, aError);
+                }
+            }
+        else
+            {
+            FireVideoClipAddingFailed(this, aError);
+            }
+
+        delete iAddedVideoClipFilename;
+        iAddedVideoClipFilename = 0;
+        }
+    else if (aTrackIndex == KVedAudioTrackIndex) 
+        {
+        FireAudioClipAddingFailed(this, aError);
+        }
+    }
+
+void CVedMovieImp::NotifyClipRemoved(CAudSong& /*aSong*/, TInt aIndex, TInt aTrackIndex)
+    {
+    if (aTrackIndex == KVedAudioTrackIndex) 
+        {
+        CVedAudioClipInfoImp* info = iAudioClipInfoArray[aIndex];
+        delete info;
+        iAudioClipInfoArray.Remove(aIndex);
+        FireAudioClipRemoved(this, aIndex);
+        }
+    }
+
+void CVedMovieImp::NotifyClipTimingsChanged(CAudSong& /*aSong*/, CAudClip& aClip)
+    {
+    if (aClip.TrackIndex() == KVedAudioTrackIndex) 
+        {
+        FireAudioClipTimingsChanged(this, &aClip);
+        }
+    }
+
+void CVedMovieImp::NotifyClipIndicesChanged(CAudSong& /*aSong*/, TInt aOldIndex, TInt aNewIndex, TInt aTrackIndex)
+    {
+    if (aTrackIndex == KVedAudioTrackIndex) 
+        {
+        TLinearOrder<CVedAudioClipInfoImp> order(CVedAudioClipInfoImp::Compare);
+        iAudioClipInfoArray.Sort(order);
+        FireAudioClipIndicesChanged(this, aOldIndex, aNewIndex);
+        }
+    }
+
+void CVedMovieImp::NotifySongReseted(CAudSong& /*aSong*/)
+    {
+    // nothing to do here
+    }
+
+void CVedMovieImp::NotifyClipReseted(CAudClip& /*aClip*/)
+    {
+    // nothing to do here
+    }
+
+void CVedMovieImp::NotifyDynamicLevelMarkInserted(CAudClip& aClip, TAudDynamicLevelMark& aMark, TInt aIndex)
+    {
+    FireDynamicLevelMarkInserted(aClip, aMark, aIndex);
+    }
+
+void CVedMovieImp::NotifyDynamicLevelMarkRemoved(CAudClip& aClip, TInt aIndex)
+    {
+    FireDynamicLevelMarkRemoved(aClip, aIndex);
+    }
+
+
+void CVedMovieImp::NotifyAudioClipInfoReady(CVedAudioClipInfo& aInfo, TInt aError)
+    {
+    if (aError != KErrNone) 
+        {
+        iAudioClipInfoArray.Remove(iAudioClipInfoArray.Count() - 1);
+        FireAudioClipAddingFailed(this, aError);
+        }
+    else
+        {
+        CVedAudioClipInfoImp* infoImp = static_cast<CVedAudioClipInfoImp*> (&aInfo);
+        FireAudioClipAdded(this, infoImp->iAudClip->IndexOnTrack());
+        }
+    }
+
+CAudSong* CVedMovieImp::Song()
+	{
+	return iAudSong;
+	}
+
+TPtrC8& CVedMovieImp::VideoCodecMimeType()
+    {
+    return iVideoCodecMimeType;
+    }
+
+
+CVedMovieAddClipOperation* CVedMovieAddClipOperation::NewL(CVedMovie* aMovie)
+    {
+    PRINT(_L("CVedMovieAddClipOperation::NewL"));
+
+    CVedMovieAddClipOperation* self = 
+        new (ELeave) CVedMovieAddClipOperation(aMovie);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+CVedMovieAddClipOperation::CVedMovieAddClipOperation(CVedMovie* aMovie)
+        : CActive(EPriorityStandard), iMovie((CVedMovieImp*)aMovie)
+    {
+
+    CActiveScheduler::Add(this);
+    }
+
+
+void CVedMovieAddClipOperation::ConstructL()
+    {
+    }
+
+
+CVedMovieAddClipOperation::~CVedMovieAddClipOperation()
+    {
+    Cancel();
+    
+    if (iVideoClip)
+        {
+        delete iVideoClip;
+        iVideoClip = NULL;
+        }
+    }
+
+
+void CVedMovieAddClipOperation::NotifyVideoClipInfoReady(CVedVideoClipInfo& /*aInfo*/, 
+                                                         TInt aError)
+    {
+
+    // Cannot delete iVideoClip here, since we are in its callback function,
+    // so schedule the active object to complete the add operation and 
+    // delete iVideoClip if needed.
+
+    iError = aError;
+
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+    }
+void CVedMovieAddClipOperation::RunL()
+    {
+    __ASSERT_DEBUG((iVideoClip != 0),
+                   TVedPanic::Panic(TVedPanic::EInternal));
+
+    if (iVideoClip != 0)
+        {
+        CompleteAddVideoClipOperation();
+        }
+    
+    __ASSERT_DEBUG(iVideoClip == 0,
+                   TVedPanic::Panic(TVedPanic::EInternal));
+    }
+
+
+void CVedMovieAddClipOperation::DoCancel()
+    {
+    if (iVideoClip)
+        {
+        if (iVideoClip->EditedHasAudio())
+            {
+            TInt audioClipIndex = iVideoClip->iAudClip->IndexOnTrack();
+            iMovie->iAudSong->RemoveClip(audioClipIndex, 0);           
+            }
+        delete iVideoClip;
+        iVideoClip = NULL;
+        iMovie->FireVideoClipAddingFailed(iMovie, KErrCancel);
+        }
+    }
+
+
+void CVedMovieAddClipOperation::CompleteAddVideoClipOperation()
+    {
+    if (iError != KErrNone)
+        {
+        if (iVideoClip->EditedHasAudio())
+            {
+            TInt audioClipIndex = iVideoClip->iAudClip->IndexOnTrack();
+            iMovie->iAudSong->RemoveClip(audioClipIndex, 0);
+            }        
+        delete iVideoClip;
+        iVideoClip = 0;
+        iMovie->FireVideoClipAddingFailed(iMovie, iError);        
+        }
+    else 
+        {
+        TInt insertableError = iMovie->CheckVideoClipInsertable(iVideoClip);
+
+        if (insertableError != KErrNone)
+            {
+            if (iVideoClip->EditedHasAudio())
+                {
+                TInt audioClipIndex = iVideoClip->iAudClip->IndexOnTrack();
+                iMovie->iAudSong->RemoveClip(audioClipIndex, 0);
+                }
+            delete iVideoClip;
+            iVideoClip = 0;
+            iMovie->FireVideoClipAddingFailed(iMovie, insertableError);
+            }
+        else
+            {
+            iVideoClip->iMiddleTransitionEffect = EVedMiddleTransitionEffectNone;
+
+            if (iVideoClip->iInfo->Class() == EVedVideoClipClassFile)
+                {
+                iVideoClip->iCutOutTime = iVideoClip->iInfo->Duration();
+                }
+            else
+                {
+                iVideoClip->iCutOutTime = TTimeIntervalMicroSeconds(0);
+                }
+
+            TInt err = iMovie->iVideoClipArray.Insert(iVideoClip, iVideoClip->iIndex);
+            if (err != KErrNone)
+                {
+                if (iVideoClip->EditedHasAudio())
+                    {
+                    // delete corresponding audio clip from song
+                    TInt audioClipIndex = iVideoClip->iAudClip->IndexOnTrack();
+                    iMovie->iAudSong->RemoveClip(audioClipIndex, 0);
+                    }
+                delete iVideoClip;
+                iVideoClip = 0;
+                iMovie->FireVideoClipAddingFailed(iMovie, err);            
+                }
+            else
+                {
+                if (iVideoClip->iInfo->Class() == EVedVideoClipClassGenerated)
+                    {
+                    iVideoClip->iInfo->Generator()->SetVideoClip(*iVideoClip, 
+                        iIsVideoGeneratorOwnedByVideoClip);
+                    }
+                
+                iMovie->RecalculateVideoClipTimings(iVideoClip);
+                TRAPD(err,iMovie->CalculatePropertiesL());//ignore error, should not leave with current implementation
+                if (err != KErrNone) { }
+
+                CVedVideoClip* clip = iVideoClip;
+                iVideoClip = 0;
+                iMovie->FireVideoClipAdded(iMovie, clip);
+                }
+            }
+        }
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/src/VedVideoClip.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,523 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "VedVideoClip.h"
+#include "VedMovieImp.h"
+#include "VedVideoClipInfoGeneratedImp.h"
+#include "VedVideoClipInfoImp.h"
+#include "AudClip.h"
+#include "AudObservers.h"
+
+CVedVideoClip* CVedVideoClip::NewL(CVedMovieImp* aMovie, const TDesC& aFileName,
+                                   TInt aIndex, CAudClip* aAudioClip, 
+                                   MVedVideoClipInfoObserver& aObserver)
+    {
+    CVedVideoClip* self = new (ELeave) CVedVideoClip(aMovie, aAudioClip);
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileName, aIndex, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+CVedVideoClip* CVedVideoClip::NewL(CVedMovieImp* aMovie, CVedVideoClipGenerator& aGenerator, 
+                                   TInt aIndex, MVedVideoClipInfoObserver& aObserver, TBool aIsOwnedByVideoClip)
+    {
+    CVedVideoClip* self = new (ELeave) CVedVideoClip(aMovie, NULL /*CAudClip*/);
+    CleanupStack::PushL(self);
+    self->ConstructL(aGenerator, aIndex, aObserver, aIsOwnedByVideoClip);
+    CleanupStack::Pop(self);
+    return self;
+    }
+    
+CVedVideoClip* CVedVideoClip::NewL(CVedMovieImp* aMovie, RFile* aFileHandle,
+							       TInt aIndex, CAudClip* aAudioClip,
+							       MVedVideoClipInfoObserver& aObserver)
+    {
+    CVedVideoClip* self = new (ELeave) CVedVideoClip(aMovie, aAudioClip);
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileHandle, aIndex, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+CVedVideoClip::CVedVideoClip(CVedMovieImp* aMovie, CAudClip* aAudioClip)
+        : iMovie(aMovie), iSpeed(KVedNormalSpeed), iColorEffect(EVedColorEffectNone),
+          iCutInTime(0), iAudClip(aAudioClip)
+    {
+    }
+
+
+void CVedVideoClip::ConstructL(const TDesC& aFileName, TInt aIndex, 
+                               MVedVideoClipInfoObserver& aObserver)
+    {
+    __ASSERT_ALWAYS(aIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+    __ASSERT_ALWAYS(aIndex <= iMovie->VideoClipCount(), 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+    iIndex = aIndex;
+
+    if (iMovie->iFs)  // lock file against writing
+        {
+
+        TInt error = iLockFile.Open(*iMovie->iFs, aFileName, EFileShareReadersOnly | EFileStream | EFileRead);
+        
+        if (error != KErrNone)
+            {
+            User::LeaveIfError(iLockFile.Open(*iMovie->iFs, aFileName, 
+                EFileShareAny | EFileStream | EFileRead));
+            }
+        iLockFileOpened = ETrue;    
+        }
+        
+    if (iAudClip) 
+        {
+        iInfo = CVedVideoClipInfoImp::NewL(iAudClip->Info(), aFileName, aObserver);
+        }
+    else
+        {
+        iInfo = CVedVideoClipInfoImp::NewL(NULL, aFileName, aObserver);
+        }
+    }
+
+
+void CVedVideoClip::ConstructL(CVedVideoClipGenerator& aGenerator, TInt aIndex, 
+                               MVedVideoClipInfoObserver& aObserver, TBool aIsOwnedByVideoClip)
+    {
+    __ASSERT_ALWAYS(aIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+    __ASSERT_ALWAYS(aIndex <= iMovie->VideoClipCount(), 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+    iIndex = aIndex;
+
+    iInfo = new (ELeave) CVedVideoClipInfoGeneratedImp(aGenerator, aIsOwnedByVideoClip);
+    ((CVedVideoClipInfoGeneratedImp*) iInfo)->ConstructL(aObserver);
+    }
+
+
+void CVedVideoClip::ConstructL(RFile* aFileHandle, TInt aIndex, 
+                               MVedVideoClipInfoObserver& aObserver)
+    {
+    __ASSERT_ALWAYS(aIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+    __ASSERT_ALWAYS(aIndex <= iMovie->VideoClipCount(), 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+    iIndex = aIndex;
+
+    if (iAudClip) 
+        {
+        iInfo = CVedVideoClipInfoImp::NewL(iAudClip->Info(), aFileHandle, aObserver);
+        }
+    else
+        {
+        iInfo = CVedVideoClipInfoImp::NewL(NULL, aFileHandle, aObserver);
+        }
+    }
+
+
+CVedVideoClip::~CVedVideoClip()
+    {
+    delete iInfo;
+
+    if (iLockFileOpened)
+        iLockFile.Close();
+    
+    }
+
+
+void CVedVideoClip::SetIndex(TInt aIndex)
+    {
+    __ASSERT_ALWAYS(aIndex >= 0, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+    __ASSERT_ALWAYS(aIndex < iMovie->VideoClipCount(), 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalIndex));
+
+    if (aIndex != iIndex)
+        {
+        TInt oldIndex = iIndex;
+        iIndex = aIndex;
+
+        iMovie->iVideoClipArray.Remove(oldIndex);
+        TInt err = iMovie->iVideoClipArray.Insert(this, iIndex);
+        __ASSERT_DEBUG(err == KErrNone, 
+                       TVedPanic::Panic(TVedPanic::EInternal));
+
+        if (oldIndex < iIndex)
+            {
+            CVedVideoClip* clip = iMovie->iVideoClipArray[oldIndex];
+            clip->iIndex = oldIndex;
+            iMovie->RecalculateVideoClipTimings(clip);
+            }
+        else
+            {
+            iMovie->RecalculateVideoClipTimings(this);
+            }
+
+        iMovie->FireVideoClipIndicesChanged(iMovie, oldIndex, iIndex);
+        }
+    }
+
+    
+void CVedVideoClip::SetSpeed(TInt aSpeed)
+    {
+    __ASSERT_ALWAYS((aSpeed >= KVedMinSpeed) && (aSpeed <= KVedMaxSpeed), 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalSpeed));
+
+    if (aSpeed != KVedNormalSpeed )
+        {
+        // slow motion, mute the audio track
+        if (iAudClip) 
+            {
+            iAudClip->SetMuting(ETrue);
+            iMovie->FireVideoClipAudioSettingsChanged(iMovie, this);
+            }
+        }
+    else
+        {
+        // normal speed
+        if ( !iUserMuted )
+            {
+            // unmute the audio track unless user has muted the clip
+            if (iAudClip) 
+                {
+                iAudClip->SetMuting(EFalse);
+                iMovie->FireVideoClipAudioSettingsChanged(iMovie, this);
+                }
+            }
+        }
+
+    if (aSpeed != iSpeed)
+        {
+        iSpeed = aSpeed;
+        iMovie->RecalculateVideoClipTimings(this);
+        iMovie->FireVideoClipTimingsChanged(iMovie, this);
+        }
+    }
+
+    
+void CVedVideoClip::SetColorEffect(TVedColorEffect aColorEffect)
+    {
+    __ASSERT_ALWAYS((aColorEffect >= EVedColorEffectNone) 
+                    && (aColorEffect < EVedColorEffectLast), 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalColorEffect));
+
+    if (aColorEffect != iColorEffect)
+        {
+        iColorEffect = aColorEffect;
+        iMovie->FireVideoClipColorEffectChanged(iMovie, this);
+        }
+    }
+
+TRgb CVedVideoClip::ColorTone() const
+    {
+    return iColorTone;
+    }
+    
+void CVedVideoClip::SetColorTone(TRgb aColorTone)
+    {
+    if (aColorTone != iColorTone)
+        {
+        // any checks needed?
+        iColorTone = aColorTone;
+        // reuses the observer callback from color effect, since essentially it is about the same thing
+        iMovie->FireVideoClipColorEffectChanged(iMovie, this);
+        }
+    }
+
+void CVedVideoClip::SetMuted(TBool aMuted)
+    {
+    if (!iAudClip) 
+        {
+        return;
+        }
+    iUserMuted = aMuted; // store the mute-value (true/false) to be able to differentiate user and automatic mute
+    iAudClip->SetMuting(aMuted);
+    iMovie->FireVideoClipAudioSettingsChanged(iMovie, this);
+    }
+
+TInt CVedVideoClip::InsertDynamicLevelMarkL(const TVedDynamicLevelMark& aMark)
+    {
+    __ASSERT_ALWAYS(aMark.iTime.Int64() >= 0,
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMark));
+    __ASSERT_ALWAYS(aMark.iTime.Int64() <= CutOutTime().Int64(),
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMark));
+                    
+    if ( iAudClip )
+        {
+        return iAudClip->InsertDynamicLevelMarkL(TAudDynamicLevelMark(aMark.iTime, aMark.iLevel));
+        }
+    else
+        {
+        User::Leave(KErrNotFound);
+        return -1;//to make compiler happy
+        }
+    }
+    
+TBool CVedVideoClip::RemoveDynamicLevelMark(TInt aIndex)
+    {
+    __ASSERT_ALWAYS(aIndex >= 0,
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMarkIndex));
+    __ASSERT_ALWAYS(aIndex < DynamicLevelMarkCount(),
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMarkIndex));
+    if ( iAudClip )
+        {
+        return iAudClip->RemoveDynamicLevelMark(aIndex);
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+    
+TVedDynamicLevelMark CVedVideoClip::DynamicLevelMark(TInt aIndex) const
+    {
+    __ASSERT_ALWAYS(aIndex >= 0,
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMarkIndex));
+    __ASSERT_ALWAYS(aIndex < DynamicLevelMarkCount(),
+                    TVedPanic::Panic(TVedPanic::EIllegalDynamicLevelMarkIndex));
+                    
+    if ( iAudClip )
+        {
+        TAudDynamicLevelMark mark = iAudClip->DynamicLevelMark(aIndex);    
+        return TVedDynamicLevelMark(mark.iTime, mark.iLevel);
+        }
+    else
+        {
+        return TVedDynamicLevelMark(TTimeIntervalMicroSeconds(0), 0);
+        }
+    }
+    
+TInt CVedVideoClip::DynamicLevelMarkCount() const
+    {
+    if ( iAudClip )
+        {
+        return iAudClip->DynamicLevelMarkCount();
+        }
+    else
+        {
+        return 0;
+        }
+    }
+
+void CVedVideoClip::SetVolumeGain(TInt aVolumeGain)
+    {
+    if ( iAudClip )
+        {
+        iAudClip->SetVolumeGain(aVolumeGain);
+        }
+    }
+    
+TInt CVedVideoClip::GetVolumeGain()
+    {
+    if ( iAudClip )
+        {
+        return iAudClip->GetVolumeGain();
+        }
+    else
+        {
+        return 0;
+        }
+    }
+
+
+void CVedVideoClip::SetCutInTime(TTimeIntervalMicroSeconds aCutInTime)
+    {
+    __ASSERT_ALWAYS(aCutInTime >= TTimeIntervalMicroSeconds(0), 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalCutInTime));
+    __ASSERT_ALWAYS(aCutInTime <= iCutOutTime, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalCutInTime));
+    __ASSERT_ALWAYS(iInfo->Class() == EVedVideoClipClassFile, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipNoFileAssociated));
+
+    if (aCutInTime != iCutInTime)
+        {
+        iCutInTime = aCutInTime;
+        iMovie->RecalculateVideoClipTimings(this);
+        iMovie->FireVideoClipTimingsChanged(iMovie, this);
+        }   
+    }
+
+
+void CVedVideoClip::SetCutOutTime(TTimeIntervalMicroSeconds aCutOutTime)
+    {
+    __ASSERT_ALWAYS(aCutOutTime >= iCutInTime, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipIllegalCutOutTime));
+    __ASSERT_ALWAYS(iInfo->Class() == EVedVideoClipClassFile, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipNoFileAssociated));
+
+    if ( aCutOutTime > iInfo->Duration() )
+        {
+        aCutOutTime = iInfo->Duration();
+        }
+
+    if (aCutOutTime != iCutOutTime)
+        {
+        iCutOutTime = aCutOutTime;
+        iMovie->RecalculateVideoClipTimings(this);
+        iMovie->FireVideoClipTimingsChanged(iMovie, this);
+        }
+    }
+
+void CVedVideoClip::UpdateAudioClip()
+    {
+    if (!iAudClip) 
+        {
+        return;
+        }
+    iAudClip->SetStartTime(iStartTime);
+    iAudClip->SetCutInTime(iCutInTime);
+    iAudClip->SetCutOutTime(iCutOutTime);
+    }
+
+
+
+CVedVideoClipInfo* CVedVideoClip::Info()
+    {
+    return iInfo;
+    }
+
+ 
+TBool CVedVideoClip::EditedHasAudio() const
+    {
+    TInt speed = Speed();
+    TBool isMuted = IsMuted();
+    TBool hasAudio = iInfo->HasAudio();
+    TBool ret = hasAudio && (speed == KVedNormalSpeed);
+    ret = ret && !isMuted;
+    return ret;
+    }
+
+    
+CVedMovieImp* CVedVideoClip::Movie()
+    {
+    return iMovie;
+    }
+
+
+TInt CVedVideoClip::Index() const
+    {
+    return iIndex;
+    }
+
+ 
+TInt CVedVideoClip::Speed() const
+    {
+    return iSpeed;
+    }
+
+
+TVedColorEffect CVedVideoClip::ColorEffect() const
+    {
+    return iColorEffect;
+    }
+
+
+TBool CVedVideoClip::IsMuteable() const
+    {
+    return (iInfo->HasAudio() && (Speed() == KVedNormalSpeed));
+    }
+
+
+TBool CVedVideoClip::Muting() const
+    {
+    if (!iAudClip) 
+        {
+        return ETrue;
+        }
+    return iAudClip->Muting();
+    }
+
+TBool CVedVideoClip::IsMuted() const
+    {
+    if (!iAudClip) 
+        {
+        return ETrue;
+        }
+    if ( iUserMuted )
+        {   
+        return ETrue;
+        }
+    else
+        {
+        // automatic mute due to slow motion is not informed to client as muted 
+        // since it can cause some conflicts
+        return EFalse;
+        }
+    }
+
+void CVedVideoClip::SetNormalizing(TBool aNormalizing)
+    {
+    if (iAudClip) 
+        {
+        iAudClip->SetNormalizing(aNormalizing);     
+        }
+    }
+    
+TBool CVedVideoClip::Normalizing() const
+    {
+    return (iAudClip && iAudClip->Normalizing());
+    }
+    
+TTimeIntervalMicroSeconds CVedVideoClip::CutInTime() const
+    {
+    if (iInfo->Class() == EVedVideoClipClassFile) 
+        {
+        return iCutInTime;
+        }
+    else
+        {
+        return TTimeIntervalMicroSeconds(0);
+        }
+    }
+
+
+TTimeIntervalMicroSeconds CVedVideoClip::CutOutTime() const
+    {
+    if (iInfo->Class() == EVedVideoClipClassFile) 
+        {
+        return iCutOutTime;
+        }
+    else
+        {
+        return iInfo->Duration();
+        }
+    }
+
+ 
+TTimeIntervalMicroSeconds CVedVideoClip::StartTime() const
+    {
+    return iStartTime;
+    }
+
+
+TTimeIntervalMicroSeconds CVedVideoClip::EndTime() const
+    {
+    return TTimeIntervalMicroSeconds(iStartTime.Int64() + EditedDuration().Int64());
+    }
+
+
+TTimeIntervalMicroSeconds CVedVideoClip::EditedDuration() const
+    {
+    TInt64 editedDuration = CutOutTime().Int64() - CutInTime().Int64();
+    return TTimeIntervalMicroSeconds((TInt64(1000) * editedDuration) / TInt64(Speed()));
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/src/VedVideoClipGenerator.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#include "VedVideoClipGenerator.h"
+#include "VedMovieImp.h"
+#include "VedVideoClip.h"
+#include <e32std.h>
+
+EXPORT_C CVedVideoClipGenerator::CVedVideoClipGenerator()
+        : iVideoClip(0), iIsOwnedByVideoClip(EFalse), iMaximumFramerate(KVEdMaxFrameRate)
+    {
+    }
+
+
+EXPORT_C CVedVideoClipGenerator::~CVedVideoClipGenerator()
+    {
+    }
+
+
+EXPORT_C TBool CVedVideoClipGenerator::IsInserted() const
+    {
+    return (iVideoClip != 0);
+    }
+
+
+EXPORT_C CVedMovie* CVedVideoClipGenerator::Movie() const
+    {
+    __ASSERT_ALWAYS(iVideoClip != 0,
+                    TVedPanic::Panic(TVedPanic::EVideoClipGeneratorNotInserted));
+
+    return iVideoClip->Movie();
+    }
+
+
+EXPORT_C TInt CVedVideoClipGenerator::VideoClipIndex() const
+    {
+    __ASSERT_ALWAYS(iVideoClip != 0,
+                    TVedPanic::Panic(TVedPanic::EVideoClipGeneratorNotInserted));
+
+    return iVideoClip->Index();
+    }
+
+
+EXPORT_C TBool CVedVideoClipGenerator::IsOwnedByVideoClip() const
+    {
+    __ASSERT_ALWAYS(iVideoClip != 0,
+                    TVedPanic::Panic(TVedPanic::EVideoClipGeneratorNotInserted));
+
+    return iIsOwnedByVideoClip;
+    }
+
+
+void CVedVideoClipGenerator::SetVideoClip(CVedVideoClip& aVideoClip,
+                                          TBool aIsOwnedByVideoClip)
+    {
+    __ASSERT_ALWAYS(iVideoClip == 0,
+                    TVedPanic::Panic(TVedPanic::EVideoClipGeneratorAlreadyInserted));
+
+    iVideoClip = &aVideoClip;
+    iIsOwnedByVideoClip = aIsOwnedByVideoClip;
+    }
+
+
+EXPORT_C void CVedVideoClipGenerator::ReportDurationChanged() const
+    {
+    if (iVideoClip != 0)
+        {
+        iVideoClip->Movie()->RecalculateVideoClipTimings(iVideoClip);
+        iVideoClip->Movie()->FireVideoClipTimingsChanged(iVideoClip->Movie(), iVideoClip);
+        }
+    }
+
+
+EXPORT_C void CVedVideoClipGenerator::ReportSettingsChanged() const
+    {
+    if (iVideoClip != 0)
+        {
+        iVideoClip->Movie()->FireVideoClipGeneratorSettingsChanged(iVideoClip->Movie(), iVideoClip);
+        }
+    }
+
+EXPORT_C void CVedVideoClipGenerator::ReportDescriptiveNameChanged() const
+    {
+    if (iVideoClip != 0)
+        {
+        iVideoClip->Movie()->FireVideoClipDescriptiveNameChanged(iVideoClip->Movie(), iVideoClip);
+        }
+    }
+
+EXPORT_C TInt CVedVideoClipGenerator::CalculateFrameComplexityFactor(CFbsBitmap* /*aFrame*/) const
+    {
+    RDebug::Print(_L("CVedVideoClipGenerator::CalculateFrameComplexityFactor IN"));
+    
+    return 10;
+
+    // Disabled since the calculation takes too long and is not very accurate
+    /*if ( !aFrame ) 
+        {
+        return 0;
+        }
+
+    TInt height = aFrame->SizeInPixels().iHeight;
+    TInt width = aFrame->SizeInPixels().iWidth;
+    TInt numberOfPixels = height * width;
+
+    TInt mean = 0;
+
+    TInt y; 
+    TInt x;
+
+    for (y = 0; y < height; y++) 
+        {
+        for (x = 0; x < width; x++)
+            {
+            TRgb color;
+            TPoint point(x, y);
+            aFrame->GetPixel(color, point);
+            mean += color.Green();   
+            }
+        }
+    mean = (TInt)((TReal)mean/(TReal)numberOfPixels + 0.5);
+
+    TInt moment = 0;
+    TInt tmp;
+    for (y = 0; y < height; y++) 
+        {
+        for (x = 0; x < width; x++)
+            {
+            TRgb color;
+            TPoint point(x, y);
+            aFrame->GetPixel(color, point);
+            tmp = color.Green() - mean;
+            if (tmp<0)
+                tmp = -tmp;
+            moment += tmp;
+            }
+        }
+    moment = (TInt)((TReal)moment/(TReal)numberOfPixels + 0.5);
+    moment *= 10;
+
+    RDebug::Print(_L("CVedVideoClipGenerator::CalculateFrameComplexityFactor returning moment: %d"), moment);
+    return moment;*/
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/src/VedVideoClipInfoGeneratedImp.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,384 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "VedVideoClipInfoGeneratedImp.h"
+#include "VedMovieImp.h"
+#include "VedVideoClip.h"
+#include "VedVideoClipGenerator.h"
+
+#include <fbs.h>
+
+// Print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+CVedVideoClipInfoGeneratedImp::CVedVideoClipInfoGeneratedImp(CVedVideoClipGenerator& aGenerator, TBool aOwnsGenerator)
+        : iGenerator(&aGenerator), iOwnsGenerator(aOwnsGenerator)
+    {
+    }
+
+
+void CVedVideoClipInfoGeneratedImp::ConstructL(MVedVideoClipInfoObserver& aObserver)
+    {
+    PRINT(_L("CVedVideoClipInfoGeneratedImp::ConstructL in"));
+
+    iInfoOperation = CVedVideoClipInfoGeneratedOperation::NewL(this, aObserver);
+    iAdapter = new (ELeave) CVedVideoClipGeneratedFrameToFrameAdapter(*this);
+
+    PRINT(_L("CVedVideoClipInfoGeneratedImp::ConstructL out"));
+    }
+
+
+CVedVideoClipInfoGeneratedImp::~CVedVideoClipInfoGeneratedImp()
+    {
+    PRINT(_L("CVedVideoClipInfoGeneratedImp::~CVedVideoClipInfoGeneratedImp in"));
+
+    if ( iGenerator )
+        {
+        if ( (TInt)iOwnsGenerator == (TInt)ETrue )
+            {
+            delete iGenerator;
+            }
+            
+        iGenerator = 0;
+        }
+
+    delete iInfoOperation;
+    delete iAdapter;
+
+    PRINT(_L("CVedVideoClipInfoGeneratedImp::~CVedVideoClipInfoGeneratedImp out"));
+    }
+
+TPtrC CVedVideoClipInfoGeneratedImp::DescriptiveName() const 
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    return iGenerator->DescriptiveName();
+    }
+
+CVedVideoClipGenerator* CVedVideoClipInfoGeneratedImp::Generator() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    return iGenerator;
+    }
+
+
+TVedVideoClipClass CVedVideoClipInfoGeneratedImp::Class() const 
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    return EVedVideoClipClassGenerated;
+    }
+
+
+TInt CVedVideoClipInfoGeneratedImp::GetVideoFrameIndexL(TTimeIntervalMicroSeconds aTime)
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    return iGenerator->GetVideoFrameIndex(aTime);
+    }
+
+
+void CVedVideoClipInfoGeneratedImp::GetFrameL(MVedVideoClipFrameObserver& aObserver, 
+                                     TInt aIndex,
+                                     TSize* const aResolution,
+                                     TDisplayMode aDisplayMode,
+                                     TBool aEnhance,
+                                     TInt aPriority)
+    {
+    PRINT(_L("CVedVideoClipInfoGeneratedImp::GetFrameL in"));
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    iAdapter->iFrameObserver = &aObserver;
+    iGenerator->GetFrameL(*iAdapter, aIndex, aResolution, aDisplayMode, aEnhance, aPriority);
+    PRINT(_L("CVedVideoClipInfoGeneratedImp::GetFrameL out"));
+    }
+
+
+void CVedVideoClipInfoGeneratedImp::CancelFrame()
+    {
+    PRINT(_L("CVedVideoClipInfoGeneratedImp::CancelFrame in"));
+
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    iGenerator->CancelFrame();
+    PRINT(_L("CVedVideoClipInfoGeneratedImp::CancelFrame out"));
+    }
+
+TPtrC CVedVideoClipInfoGeneratedImp::FileName() const
+    {
+    // Always panic
+    TVedPanic::Panic(TVedPanic::EVideoClipInfoNoFileAssociated);
+    
+    // This will never be reached.
+    return NULL;
+    }
+    
+    
+RFile* CVedVideoClipInfoGeneratedImp::FileHandle() const
+    {
+    // Always panic
+    TVedPanic::Panic(TVedPanic::EVideoClipInfoNoFileAssociated);
+    
+    // This will never be reached.
+    return NULL;
+    }
+
+
+TVedVideoFormat CVedVideoClipInfoGeneratedImp::Format() const
+    {
+    // Always panic
+    TVedPanic::Panic(TVedPanic::EVideoClipInfoNoFileAssociated);
+    
+    // This will never be reached.
+    return EVedVideoFormatUnrecognized;
+    }
+
+
+TVedVideoType CVedVideoClipInfoGeneratedImp::VideoType() const
+    {
+    // Always panic
+    TVedPanic::Panic(TVedPanic::EVideoClipInfoNoFileAssociated);
+    
+    // This will never be reached.
+    return EVedVideoTypeUnrecognized;
+    }
+
+
+TSize CVedVideoClipInfoGeneratedImp::Resolution() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return iGenerator->Movie()->Resolution();
+    }
+
+
+TBool CVedVideoClipInfoGeneratedImp::HasAudio() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return EFalse;  
+    }
+
+
+TVedAudioType CVedVideoClipInfoGeneratedImp::AudioType() const
+    {
+    // Always panic
+    TVedPanic::Panic(TVedPanic::EVideoClipInfoNoFileAssociated);
+    
+    // This will never be reached.
+    return EVedAudioTypeUnrecognized;
+    }
+
+TVedAudioChannelMode CVedVideoClipInfoGeneratedImp::AudioChannelMode() const
+    {
+    // Always panic
+    TVedPanic::Panic(TVedPanic::EVideoClipInfoNoFileAssociated);
+    
+    // This will never be reached.
+    return EVedAudioChannelModeUnrecognized;
+    }
+
+TInt CVedVideoClipInfoGeneratedImp::AudioSamplingRate() const
+    {
+    // Always panic
+    TVedPanic::Panic(TVedPanic::EVideoClipInfoNoFileAssociated);
+    
+    // This will never be reached.
+    return -1;
+    }
+
+
+
+TTimeIntervalMicroSeconds CVedVideoClipInfoGeneratedImp::Duration() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return iGenerator->Duration();
+    }
+
+
+TInt CVedVideoClipInfoGeneratedImp::VideoFrameCount() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return iGenerator->VideoFrameCount();
+    }
+
+
+TTimeIntervalMicroSeconds CVedVideoClipInfoGeneratedImp::VideoFrameStartTimeL(TInt aIndex)
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return iGenerator->VideoFrameStartTime(aIndex);
+    }
+
+
+TTimeIntervalMicroSeconds CVedVideoClipInfoGeneratedImp::VideoFrameEndTimeL(TInt aIndex)
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    return iGenerator->VideoFrameEndTime(aIndex);
+    }
+
+
+TTimeIntervalMicroSeconds CVedVideoClipInfoGeneratedImp::VideoFrameDurationL(TInt aIndex)
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    return iGenerator->VideoFrameDuration(aIndex);
+    }
+
+
+TInt CVedVideoClipInfoGeneratedImp::VideoFrameSizeL(TInt /*aIndex*/) 
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    // always panic
+    TVedPanic::Panic(TVedPanic::EVideoClipInfoNoFileAssociated);
+
+    // will never be reached
+    return 0;
+    }
+
+
+TBool CVedVideoClipInfoGeneratedImp::VideoFrameIsIntraL(TInt aIndex) 
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    if (aIndex == 0) 
+        {
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+
+void CVedVideoClipInfoGeneratedImp::SetTranscodeFactor(TVedTranscodeFactor aFactor)
+    {
+    iTFactor.iStreamType =aFactor.iStreamType;
+    iTFactor.iTRes = aFactor.iTRes;
+    }
+
+TVedTranscodeFactor CVedVideoClipInfoGeneratedImp::TranscodeFactor()
+    {
+    return iTFactor;
+    }
+
+
+TBool CVedVideoClipInfoGeneratedImp::IsMMSCompatible()
+    {
+    // Always panic
+    TVedPanic::Panic(TVedPanic::EVideoClipInfoNoFileAssociated);
+    
+    // This will never be reached.
+    return ETrue;;
+    }
+
+
+CVedVideoClipInfoGeneratedOperation* CVedVideoClipInfoGeneratedOperation::NewL(CVedVideoClipInfoGeneratedImp* aInfo,
+                                                                               MVedVideoClipInfoObserver& aObserver)
+    {
+    PRINT(_L("CVedVideoClipInfoGeneratedOperation::NewL in"));
+
+    CVedVideoClipInfoGeneratedOperation* self = 
+        new (ELeave) CVedVideoClipInfoGeneratedOperation(aInfo, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+
+    PRINT(_L("CVedVideoClipInfoGeneratedOperation::NewL out"));
+    return self;
+    }
+
+
+CVedVideoClipInfoGeneratedOperation::CVedVideoClipInfoGeneratedOperation(CVedVideoClipInfoGeneratedImp* aInfo,
+                                                                         MVedVideoClipInfoObserver& aObserver)
+        : CActive(EPriorityStandard), iInfo(aInfo)
+    {
+    PRINT(_L("CVedVideoClipInfoGeneratedOperation::CVedVideoClipInfoGeneratedOperation in"));
+
+    iObserver = &aObserver;
+    CActiveScheduler::Add(this);
+
+    PRINT(_L("CVedVideoClipInfoGeneratedOperation::CVedVideoClipInfoGeneratedOperation out"));
+    }
+
+
+void CVedVideoClipInfoGeneratedOperation::ConstructL()
+    {
+    PRINT(_L("CVedVideoClipInfoGeneratedOperation::ConstructL in"));
+
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+
+    PRINT(_L("CVedVideoClipInfoGeneratedOperation::ConstructL out"));
+    }
+
+
+CVedVideoClipInfoGeneratedOperation::~CVedVideoClipInfoGeneratedOperation()
+    {
+    Cancel();
+    }
+
+
+void CVedVideoClipInfoGeneratedOperation::RunL()
+    {
+    PRINT(_L("CVedVideoClipInfoGeneratedOperation::RunL in"));
+
+    iInfo->iReady = ETrue;
+
+    iObserver->NotifyVideoClipInfoReady(*iInfo, KErrNone);
+
+    PRINT(_L("CVedVideoClipInfoGeneratedOperation::RunL out"));
+    }
+
+
+void CVedVideoClipInfoGeneratedOperation::DoCancel()
+    {
+    }
+
+
+
+CVedVideoClipGeneratedFrameToFrameAdapter::CVedVideoClipGeneratedFrameToFrameAdapter(CVedVideoClipInfo& aInfo)
+: iInfo(aInfo)
+    {
+    }
+
+void CVedVideoClipGeneratedFrameToFrameAdapter::NotifyVideoClipGeneratorFrameCompleted(
+                        CVedVideoClipGenerator& /*aInfo*/, TInt aError, CFbsBitmap* aFrame)
+    {
+    iFrameObserver->NotifyVideoClipFrameCompleted(iInfo, aError, aFrame);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/src/VedVideoClipInfoImp.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,911 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+
+#include "VedVideoClipInfoImp.h"
+#include "movieprocessor.h"
+#include <fbs.h>
+#include <ecom/ecom.h>
+#include "audclipinfo.h"
+#include "audcommon.h"
+#include "VedVideoClip.h"
+
+// Print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+EXPORT_C CVedVideoClipInfo* CVedVideoClipInfo::NewL(const TDesC& aFileName,
+                                                    MVedVideoClipInfoObserver& aObserver)
+    {
+    PRINT(_L("CVedVideoClipInfo::NewL"));
+
+    CVedVideoClipInfoImp* self = (CVedVideoClipInfoImp*)NewLC(aFileName, aObserver);
+    self->iVideoClipIsStandalone = ETrue;
+    CleanupStack::Pop(self);
+    PRINT(_L("CVedVideoClipInfo::NewL out"));
+    return self;
+    }
+    
+EXPORT_C CVedVideoClipInfo* CVedVideoClipInfo::NewLC(const TDesC& aFileName,
+                                                     MVedVideoClipInfoObserver& aObserver)
+    {
+    PRINT(_L("CVedVideoClipInfo::NewLC in"));
+
+    CVedVideoClipInfoImp* self = new (ELeave) CVedVideoClipInfoImp(NULL);
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileName, aObserver);
+
+    PRINT(_L("CVedVideoClipInfo::NewLC out"));
+    return self;
+    }
+
+EXPORT_C CVedVideoClipInfo* CVedVideoClipInfo::NewL(RFile* aFileHandle,
+                                                    MVedVideoClipInfoObserver& aObserver)
+    {
+    PRINT(_L("CVedVideoClipInfo::NewL"));
+
+    CVedVideoClipInfoImp* self = (CVedVideoClipInfoImp*)NewLC(aFileHandle, aObserver);
+    self->iVideoClipIsStandalone = ETrue;
+    CleanupStack::Pop(self);
+    PRINT(_L("CVedVideoClipInfo::NewL out"));
+    return self;
+    }
+    
+EXPORT_C CVedVideoClipInfo* CVedVideoClipInfo::NewLC(RFile* aFileHandle,
+                                                     MVedVideoClipInfoObserver& aObserver)
+    {
+    PRINT(_L("CVedVideoClipInfo::NewLC in"));
+
+    CVedVideoClipInfoImp* self = new (ELeave) CVedVideoClipInfoImp(NULL);
+    CleanupStack::PushL(self);
+    self->ConstructL(aFileHandle, aObserver);
+
+    PRINT(_L("CVedVideoClipInfo::NewLC out"));
+    return self;
+    }
+
+
+CVedVideoClipInfo* CVedVideoClipInfoImp::NewL(CAudClipInfo* aAudClipInfo, 
+                                              const TDesC& aFileName, MVedVideoClipInfoObserver& aObserver)
+    {
+    CVedVideoClipInfoImp* self = new (ELeave) CVedVideoClipInfoImp(aAudClipInfo);
+    CleanupStack::PushL(self);
+    if (aAudClipInfo) 
+        {
+        self->ConstructL(aAudClipInfo->FileName(), aObserver);
+        }
+    else
+        {
+        self->ConstructL(aFileName, aObserver);
+        }
+    self->iVideoClipIsStandalone = EFalse;
+    CleanupStack::Pop(self);
+    return self;
+    }
+    
+CVedVideoClipInfo* CVedVideoClipInfoImp::NewL(CAudClipInfo* aAudClipInfo, 
+                                              RFile* aFileHandle, MVedVideoClipInfoObserver& aObserver)
+    {
+    CVedVideoClipInfoImp* self = new (ELeave) CVedVideoClipInfoImp(aAudClipInfo);
+    CleanupStack::PushL(self);
+    if (aAudClipInfo) 
+        {
+        self->ConstructL(aAudClipInfo->FileHandle(), aObserver);
+        }
+    else
+        {
+        self->ConstructL(aFileHandle, aObserver);
+        }
+    self->iVideoClipIsStandalone = EFalse;
+    CleanupStack::Pop(self);
+    return self;
+    }
+    
+
+CVedVideoClipInfoImp::CVedVideoClipInfoImp(CAudClipInfo* aAudClipInfo)
+        : iReady(EFalse), iAudClipInfoOwnedByVideoClipInfo(EFalse), iAudClipInfo(aAudClipInfo)
+    {
+    }
+
+
+void CVedVideoClipInfoImp::ConstructL(const TDesC& aFileName,
+                                   MVedVideoClipInfoObserver& aObserver)
+    {
+    PRINT(_L("CVedVideoClipInfo::ConstructL in"));
+
+    iFileName = HBufC::NewL(aFileName.Length());
+    *iFileName = aFileName;
+
+    iFrameOperation = CVedVideoClipFrameOperation::NewL(this);
+
+    iInfoOperation = CVedVideoClipInfoOperation::NewL(this, aObserver);
+    
+    PRINT(_L("CVedVideoClipInfo::ConstructL out"));
+    }
+    
+void CVedVideoClipInfoImp::ConstructL(RFile* aFileHandle,
+                                   MVedVideoClipInfoObserver& aObserver)
+    {
+    PRINT(_L("CVedVideoClipInfo::ConstructL in"));
+
+    iFileName = HBufC::NewL(1);
+    iFileHandle = aFileHandle;
+
+    iFrameOperation = CVedVideoClipFrameOperation::NewL(this);
+
+    iInfoOperation = CVedVideoClipInfoOperation::NewL(this, aObserver);
+    
+    PRINT(_L("CVedVideoClipInfo::ConstructL out"));
+    }
+    
+
+CVedVideoClipInfoImp::~CVedVideoClipInfoImp()
+    {
+    PRINT(_L("CVedVideoClipInfo::~CVedVideoClipInfoImp in"));
+
+    delete iInfoOperation;
+    delete iFrameOperation;
+
+    User::Free(iVideoFrameInfoArray);
+    delete iFileName;
+
+    REComSession::FinalClose();
+
+    if (iAudClipInfoOwnedByVideoClipInfo) 
+        {
+        delete iAudClipInfo;
+        }
+
+    PRINT(_L("CVedVideoClipInfo::~CVedVideoClipInfoImp out"));
+    }
+
+
+TPtrC CVedVideoClipInfoImp::DescriptiveName() const 
+    {
+    return *iFileName;
+    }
+
+CVedVideoClipGenerator* CVedVideoClipInfoImp::Generator() const
+    {
+    // Always panic
+    TVedPanic::Panic(TVedPanic::EVideoClipInfoNoGeneratorAssociated);
+    
+    // This will never be reached.
+    return NULL;
+    }
+
+
+TVedVideoClipClass CVedVideoClipInfoImp::Class() const 
+    {
+    return EVedVideoClipClassFile;
+    }
+
+
+TInt CVedVideoClipInfoImp::GenerateVideoFrameInfoArrayL() 
+    {
+    PRINT(_L("CVedVideoClipInfoImp::GenerateVideoFrameInfoArrayL in"));
+
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    TInt error = KErrNone;
+
+    if ( !iVideoFrameInfoArrayReady )
+        {
+        CMovieProcessor* processor = CMovieProcessor::NewL();
+        CleanupStack::PushL(processor);
+        TRAP( error, processor->GenerateVideoFrameInfoArrayL(*iFileName, iFileHandle, iVideoFrameInfoArray));
+        CleanupStack::PopAndDestroy(processor);
+
+        if ( (error == KErrNone) && iVideoFrameInfoArray )
+            {
+            iVideoFrameInfoArrayReady = ETrue;            
+            }
+        else
+            {
+            PRINT((_L("CVedVideoClipInfoImp::GenerateVideoFrameInfoArrayL Error=%d"), error));
+            }
+        }
+
+    PRINT(_L("CVedVideoClipInfoImp::GenerateVideoFrameInfoArrayL out"));
+    return error;
+    }
+
+
+TInt CVedVideoClipInfoImp::GetVideoFrameIndexL(TTimeIntervalMicroSeconds aTime)
+    {
+    PRINT(_L("CVedVideoClipInfoImp::GetVideoFrameIndex in"));
+
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    __ASSERT_ALWAYS((aTime >= TTimeIntervalMicroSeconds(0)) && (aTime <= Duration()), 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalVideoFrameTime));
+
+    /* Use binary search to find the right frame. */
+
+    TInt start = 0;
+    TInt end = iVideoFrameCount - 1;
+    TInt index = -1;
+    TBool always = ETrue;
+
+    while( always )
+        {
+        index = start + ((end - start) / 2);
+
+        TTimeIntervalMicroSeconds startTime = VideoFrameStartTimeL(index);
+        TTimeIntervalMicroSeconds endTime = VideoFrameEndTimeL(index);
+        if (index < (VideoFrameCount() - 1))
+            {
+            endTime = TTimeIntervalMicroSeconds(endTime.Int64() - 1);
+            }
+
+        if (aTime < startTime)
+            {
+            end = index - 1;
+            }
+        else if (aTime > endTime)
+            {
+            start = index + 1;
+            }
+        else
+            {
+            always = EFalse;
+            }
+        }
+
+    PRINT(_L("CVedVideoClipInfoImp::GetVideoFrameIndex out"));
+    return index;
+    }
+
+
+void CVedVideoClipInfoImp::GetFrameL(MVedVideoClipFrameObserver& aObserver, 
+                                     TInt aIndex,
+                                     TSize* const aResolution,
+                                     TDisplayMode aDisplayMode,
+                                     TBool aEnhance,
+                                     TInt aPriority)
+    {
+    PRINT(_L("CVedVideoClipInfoImp::GetFrameL in"));
+
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    iFrameOperation->StartL(aObserver, aIndex, aResolution, aDisplayMode, aEnhance, aPriority);
+    
+    PRINT(_L("CVedVideoClipInfoImp::GetFrameL out"));
+    }
+
+
+void CVedVideoClipInfoImp::CancelFrame()
+    {
+    PRINT(_L("CVedVideoClipInfoImp::CancelFrame in"));
+
+    if ( !iReady )
+        {
+        PRINT(_L("CVedVideoClipInfoImp::CancelFrame not even info ready yet, cancel it and get out"));
+        iInfoOperation->Cancel();
+        return;
+        }
+
+    iFrameOperation->Cancel();
+
+    PRINT(_L("CVedVideoClipInfoImp::CancelFrame out"));
+    }
+
+
+
+
+TPtrC CVedVideoClipInfoImp::FileName() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return *iFileName;
+    }
+    
+RFile* CVedVideoClipInfoImp::FileHandle() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return iFileHandle;
+    }
+
+
+TVedVideoFormat CVedVideoClipInfoImp::Format() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return iFormat;
+    }
+
+
+TVedVideoType CVedVideoClipInfoImp::VideoType() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return iVideoType;
+    }
+
+
+TSize CVedVideoClipInfoImp::Resolution() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return iResolution;
+    }
+
+
+TBool CVedVideoClipInfoImp::HasAudio() const
+    {
+    
+    if (!iReady)  
+        {
+        if (iVideoClipIsStandalone)
+            return EFalse;
+        }
+
+    if (iAudClipInfo == 0) 
+        {
+        return EFalse;
+        }
+    return ((iAudClipInfo->Properties().iAudioType != EAudTypeUnrecognized)
+        && (iAudClipInfo->Properties().iAudioType != EAudNoAudio));
+    }
+
+
+TVedAudioType CVedVideoClipInfoImp::AudioType() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    if (iAudClipInfo == 0) 
+        {
+        return EVedAudioTypeNoAudio;
+        }
+
+    TVedAudioType vedAudioType = EVedAudioTypeUnrecognized;
+    if (iAudClipInfo->Properties().iAudioType == EAudAMR)
+        {
+        vedAudioType = EVedAudioTypeAMR;
+        }
+    else if (iAudClipInfo->Properties().iAudioType == EAudAMRWB)
+        {
+        vedAudioType = EVedAudioTypeAMRWB;
+        }
+    else if (iAudClipInfo->Properties().iAudioType == EAudMP3)
+        {
+        vedAudioType = EVedAudioTypeMP3;
+        }
+    else if (iAudClipInfo->Properties().iAudioType == EAudAAC_MPEG4 )
+        {
+        vedAudioType = EVedAudioTypeAAC_LC;
+        }
+    else if (iAudClipInfo->Properties().iAudioType == EAudWAV)
+        {
+        vedAudioType = EVedAudioTypeWAV;
+        }
+    else if (iAudClipInfo->Properties().iAudioType == EAudNoAudio)
+    	{
+    	vedAudioType = EVedAudioTypeNoAudio;
+    	}
+        
+    return vedAudioType;
+    }
+
+TVedAudioChannelMode CVedVideoClipInfoImp::AudioChannelMode() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    if (iAudClipInfo == 0) 
+        {
+        return EVedAudioChannelModeUnrecognized;
+        }
+
+    TVedAudioChannelMode vedChannelMode = EVedAudioChannelModeUnrecognized;
+    if (iAudClipInfo->Properties().iChannelMode == EAudStereo)
+        {
+        vedChannelMode = EVedAudioChannelModeStereo;
+        }
+    else if (iAudClipInfo->Properties().iChannelMode == EAudSingleChannel)
+        {
+        vedChannelMode = EVedAudioChannelModeSingleChannel;
+        }
+    else if (iAudClipInfo->Properties().iChannelMode == EAudDualChannel)
+        {
+        vedChannelMode = EVedAudioChannelModeDualChannel;
+        }
+
+    return vedChannelMode;
+    }
+
+TInt CVedVideoClipInfoImp::AudioSamplingRate() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    if (iAudClipInfo == 0) 
+        {
+        return 0;
+        }
+
+    return iAudClipInfo->Properties().iSamplingRate;
+    }
+
+
+TTimeIntervalMicroSeconds CVedVideoClipInfoImp::Duration() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return iDuration;
+    }
+
+
+TInt CVedVideoClipInfoImp::VideoFrameCount() const
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    return iVideoFrameCount;
+    }
+
+
+TTimeIntervalMicroSeconds CVedVideoClipInfoImp::VideoFrameStartTimeL(TInt aIndex)
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    __ASSERT_ALWAYS(((aIndex >= 0) && (aIndex < iVideoFrameCount)),
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalVideoFrameIndex));
+
+    if ( !iVideoFrameInfoArrayReady )
+        {
+        User::LeaveIfError(GenerateVideoFrameInfoArrayL());
+        }
+
+    TInt64 startTime = TInt64(iVideoFrameInfoArray[aIndex].iStartTime) * TInt64(1000);
+    return TTimeIntervalMicroSeconds(startTime);
+    }
+
+
+TTimeIntervalMicroSeconds CVedVideoClipInfoImp::VideoFrameEndTimeL(TInt aIndex)
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    __ASSERT_ALWAYS(((aIndex >= 0) && (aIndex < iVideoFrameCount)),
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalVideoFrameIndex));
+
+    if ( !iVideoFrameInfoArrayReady )
+        {
+        User::LeaveIfError(GenerateVideoFrameInfoArrayL());
+        }
+
+    if (aIndex < (iVideoFrameCount - 1))
+        {
+        return (TInt64(iVideoFrameInfoArray[aIndex + 1].iStartTime) * TInt64(1000));
+        }
+    else
+        {
+        return iDuration;
+        }
+    }
+
+
+TTimeIntervalMicroSeconds CVedVideoClipInfoImp::VideoFrameDurationL(TInt aIndex)
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    __ASSERT_ALWAYS(((aIndex >= 0) && (aIndex < iVideoFrameCount)),
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalVideoFrameIndex));
+
+    if ( !iVideoFrameInfoArrayReady )
+        {
+        User::LeaveIfError(GenerateVideoFrameInfoArrayL());
+        }
+
+
+    TInt64 duration = - (TInt64(iVideoFrameInfoArray[aIndex].iStartTime) * TInt64(1000));
+    if (aIndex < (iVideoFrameCount - 1))
+        {
+        duration += TInt64(iVideoFrameInfoArray[aIndex + 1].iStartTime) * TInt64(1000);
+        }
+    else
+        {
+        duration += iDuration.Int64();
+        }
+
+    return TTimeIntervalMicroSeconds(duration);
+    }
+
+
+TInt CVedVideoClipInfoImp::VideoFrameSizeL(TInt aIndex)
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    __ASSERT_ALWAYS(((aIndex >= 0) && (aIndex < iVideoFrameCount)),
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalVideoFrameIndex));
+
+    if ( !iVideoFrameInfoArrayReady )
+        {
+        User::LeaveIfError(GenerateVideoFrameInfoArrayL());
+        }
+
+
+    return iVideoFrameInfoArray[aIndex].iSize;
+    }
+
+
+TBool CVedVideoClipInfoImp::VideoFrameIsIntraL(TInt aIndex)
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+    __ASSERT_ALWAYS(((aIndex >= 0) && (aIndex < iVideoFrameCount)),
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalVideoFrameIndex));
+
+    if ( !iVideoFrameInfoArrayReady )
+        {
+        User::LeaveIfError(GenerateVideoFrameInfoArrayL());
+        }
+
+    if (iVideoFrameInfoArray[aIndex].iFlags & KVedVideoFrameInfoFlagIntra)
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+void CVedVideoClipInfoImp::SetTranscodeFactor(TVedTranscodeFactor aFactor)
+    {
+    iTimeFactor.iStreamType = aFactor.iStreamType;
+    iTimeFactor.iTRes = aFactor.iTRes;
+    }
+
+TVedTranscodeFactor CVedVideoClipInfoImp::TranscodeFactor()
+    {
+    return iTimeFactor;
+    }
+
+TBool CVedVideoClipInfoImp::IsMMSCompatible()
+    {
+    __ASSERT_ALWAYS(iReady, 
+                    TVedPanic::Panic(TVedPanic::EVideoClipInfoNotReady));
+
+    TAudType audioType;
+    if (iAudClipInfo == 0) 
+        {
+        audioType = EAudNoAudio;
+        }
+    else
+        {
+        audioType = iAudClipInfo->Properties().iAudioType;
+        }
+
+    return ( ( iFormat == EVedVideoFormat3GPP ) &&
+             ( iVideoType == EVedVideoTypeH263Profile0Level10 ) &&
+             ( audioType == EAudAMR ) );
+    }
+
+
+CVedVideoClipInfoOperation* CVedVideoClipInfoOperation::NewL(CVedVideoClipInfoImp* aInfo,
+                                                             MVedVideoClipInfoObserver& aObserver)
+    {
+    PRINT(_L("CVedVideoClipInfoOperation::NewL in"));
+
+    CVedVideoClipInfoOperation* self = 
+        new (ELeave) CVedVideoClipInfoOperation(aInfo, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+
+    PRINT(_L("CVedVideoClipInfoOperation::NewL out"));
+    return self;
+    }
+
+
+CVedVideoClipInfoOperation::CVedVideoClipInfoOperation(CVedVideoClipInfoImp* aInfo,
+                                                       MVedVideoClipInfoObserver& aObserver)
+        : CActive(EPriorityStandard), iInfo(aInfo), iMovieProcessorError(KErrNone)
+    {
+    PRINT(_L("CVedVideoClipInfoOperation::CVedVideoClipInfoOperation in"));
+
+    iObserver = &aObserver;
+    CActiveScheduler::Add(this);
+
+    PRINT(_L("CVedVideoClipInfoOperation::CVedVideoClipInfoOperation out"));
+    }
+
+
+void CVedVideoClipInfoOperation::ConstructL()
+    {
+    PRINT(_L("CVedVideoClipInfoOperation::ConstructL in"));
+
+    iGettingAudio = EFalse;
+
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+
+    PRINT(_L("CVedVideoClipInfoOperation::ConstructL out"));
+    }
+
+
+CVedVideoClipInfoOperation::~CVedVideoClipInfoOperation()
+    {
+    Cancel();
+    }
+
+
+void CVedVideoClipInfoOperation::RunL()
+    {
+    PRINT(_L("CVedVideoClipInfoOperation::RunL in"));    
+ 
+    if (iGettingAudio) 
+        {
+        if (iMovieProcessorError == KErrNone || iMovieProcessorError == KErrNoAudio) 
+            {
+            iInfo->iReady = ETrue;
+            iMovieProcessorError = KErrNone;
+            }
+        iObserver->NotifyVideoClipInfoReady(*iInfo, iMovieProcessorError);
+        }
+    else
+        {
+        CMovieProcessor* processor = CMovieProcessor::NewL();
+        TVedAudioType audioType = EVedAudioTypeUnrecognized;
+        TVedAudioChannelMode audioChannelMode = EVedAudioChannelModeUnrecognized;
+        TInt audioSamplingRate;
+        TRAP(iMovieProcessorError,
+             processor->GetVideoClipPropertiesL(*iInfo->iFileName, 
+                                                iInfo->iFileHandle,
+                                                iInfo->iFormat,
+                                                iInfo->iVideoType,
+                                                iInfo->iResolution,
+                                                audioType,
+                                                iInfo->iDuration,
+                                                iInfo->iVideoFrameCount,
+                                                audioSamplingRate,
+                                                audioChannelMode));    
+        delete processor;
+        processor = 0;                
+        
+        if (iMovieProcessorError != KErrNone) 
+            {
+            iObserver->NotifyVideoClipInfoReady(*iInfo, iMovieProcessorError);
+            }
+        else if (iInfo->iAudClipInfo || !iInfo->iVideoClipIsStandalone)
+            {
+            if (iMovieProcessorError == KErrNone) 
+                {
+                iInfo->iReady = ETrue;
+                }
+            iObserver->NotifyVideoClipInfoReady(*iInfo, iMovieProcessorError);
+            }
+        else
+            {
+            
+            if (iInfo->iFileHandle)
+                iInfo->iAudClipInfo = CAudClipInfo::NewL(iInfo->iFileHandle, *this);
+            else
+                iInfo->iAudClipInfo = CAudClipInfo::NewL(*iInfo->iFileName, *this);
+            
+            iInfo->iAudClipInfoOwnedByVideoClipInfo = ETrue;
+            iGettingAudio = ETrue;
+            }
+        }
+    PRINT(_L("CVedVideoClipInfoOperation::RunL out"));
+    }
+
+void CVedVideoClipInfoOperation::NotifyClipInfoReady(CAudClipInfo& /*aInfo*/, TInt aError)
+    {
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+    
+    iMovieProcessorError = aError;
+    }
+
+void CVedVideoClipInfoOperation::DoCancel()
+    {
+    }
+
+
+CVedVideoClipFrameOperation* CVedVideoClipFrameOperation::NewL(CVedVideoClipInfoImp* aInfo)
+    {
+    PRINT(_L("CVedVideoClipFrameOperation::NewL in"));
+
+    CVedVideoClipFrameOperation* self = 
+        new (ELeave) CVedVideoClipFrameOperation(aInfo);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+
+    PRINT(_L("CVedVideoClipFrameOperation::NewL out"));
+    return self;
+    }
+
+
+CVedVideoClipFrameOperation::CVedVideoClipFrameOperation(CVedVideoClipInfoImp* aInfo)
+        : CActive(EPriorityIdle), iInfo(aInfo)
+    {
+    PRINT(_L("CVedVideoClipFrameOperation::CVedVideoClipFrameOperation in"));
+    CActiveScheduler::Add(this);
+    PRINT(_L("CVedVideoClipFrameOperation::CVedVideoClipFrameOperation out"));
+    }
+
+
+void CVedVideoClipFrameOperation::ConstructL()
+    {
+    }
+
+
+CVedVideoClipFrameOperation::~CVedVideoClipFrameOperation()
+    {
+    Cancel();
+    }
+
+
+void CVedVideoClipFrameOperation::StartL(MVedVideoClipFrameObserver& aObserver,
+                                         TInt aIndex,
+                                         TSize* const aResolution, 
+                                         TDisplayMode aDisplayMode,
+                                         TBool aEnhance,
+                                         TInt aPriority)
+    {
+    PRINT(_L("CVedVideoClipFrameOperation::StartL in"));
+
+    __ASSERT_ALWAYS(!IsActive(), 
+        TVedPanic::Panic(TVedPanic::EVideoClipInfoFrameOperationAlreadyRunning));
+    __ASSERT_DEBUG(iProcessor == 0, TVedPanic::Panic(TVedPanic::EInternal));
+
+    TSize resolution;
+    if (aResolution != 0)
+        {
+        __ASSERT_ALWAYS(aResolution->iWidth > 0, 
+            TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalFrameResolution));
+        __ASSERT_ALWAYS(aResolution->iHeight > 0, 
+            TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalFrameResolution));
+
+        resolution = *aResolution;
+        }
+    else
+        {
+        resolution = iInfo->Resolution();
+        }
+
+    __ASSERT_ALWAYS(((aIndex >= 0) && (iInfo->VideoFrameCount() == 0) || 
+                                      (aIndex < iInfo->VideoFrameCount()) || 
+                                      (aIndex == KFrameIndexBestThumb) ), 
+            TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalVideoFrameIndex));
+
+    iIndex = aIndex;
+    
+    iFactor.iStreamType = EVedVideoBitstreamModeUnknown;
+    iFactor.iTRes = 0;
+
+    CMovieProcessor* processor = CMovieProcessor::NewLC();  
+
+    processor->StartThumbL(iInfo->FileName(), iInfo->FileHandle(), aIndex, resolution, aDisplayMode,
+                           aEnhance);
+
+    /* Initialization OK. This method cannot leave any more. Start processing. */
+
+    CleanupStack::Pop(processor);
+
+    iProcessor = processor;
+    iObserver = &aObserver;
+
+    SetPriority(aPriority);
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+
+    PRINT(_L("CVedVideoClipFrameOperation::StartL out"));
+    }
+
+
+void CVedVideoClipFrameOperation::RunL()
+    {
+    PRINT(_L("CVedVideoClipFrameOperation::RunL in"));
+
+    __ASSERT_DEBUG(iProcessor != 0, TVedPanic::Panic(TVedPanic::EInternal));
+    __ASSERT_DEBUG(iObserver != 0, TVedPanic::Panic(TVedPanic::EInternal));
+    
+    TInt err = KErrNone;
+    
+    if (!iThumbRequestPending)
+        TRAP(err, iProcessor->ProcessThumbL(iStatus, &iFactor));
+    
+    if (err != KErrNone)
+        {
+        delete iProcessor;
+        iProcessor = 0;
+        
+        MVedVideoClipFrameObserver* observer = iObserver;
+        iObserver = 0;
+        observer->NotifyVideoClipFrameCompleted(*iInfo, err, NULL);
+        return;
+        }
+        
+    if (!iThumbRequestPending)
+    {        
+        iInfo->SetTranscodeFactor(iFactor);
+        iThumbRequestPending = ETrue;
+        iStatus = KRequestPending;
+        SetActive();        
+        return;
+    }
+    else
+    {
+        MVedVideoClipFrameObserver* observer = iObserver;
+        iObserver = 0;
+                
+        if (iStatus == KErrNone)
+        {
+            CFbsBitmap* frame = 0;
+            iProcessor->FetchThumb(frame);
+            observer->NotifyVideoClipFrameCompleted(*iInfo, KErrNone, frame);            
+        }
+        else
+        {
+            observer->NotifyVideoClipFrameCompleted(*iInfo, iStatus.Int(), NULL);            
+        }
+        iThumbRequestPending = EFalse;
+        delete iProcessor;
+        iProcessor = 0;
+    }      
+        
+    PRINT(_L("CVedVideoClipFrameOperation::RunL out"));
+    }
+
+
+void CVedVideoClipFrameOperation::DoCancel()
+    {
+    if (iProcessor != 0)
+        {
+        delete iProcessor;
+        iProcessor = 0;
+        
+        // Cancel our internal request
+        if ( iStatus == KRequestPending )
+        {
+            PRINT((_L("CVedVideoClipFrameOperation::DoCancel() cancel request")));
+            TRequestStatus *status = &iStatus;
+            User::RequestComplete(status, KErrCancel);
+        }
+        iThumbRequestPending = EFalse;
+
+        MVedVideoClipFrameObserver* observer = iObserver;
+        iObserver = 0;
+        observer->NotifyVideoClipFrameCompleted(*iInfo, KErrCancel, NULL);
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/src/vedcodecchecker.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,962 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+// Include Files
+#include <mp4lib.h>
+#include "ctrtranscoder.h"
+#include "ctrtranscoderobserver.h"
+#include "VedVideoClip.h"
+#include "vedvideosettings.h"
+#include "vedvolreader.h"
+#include "vedcodecchecker.h"
+#include "vedavcedit.h"
+
+// Constants
+const TUint KVOLHeaderBufferSize = 256;
+const TUint KAVCDCRBufferSize = 16384;
+const TUint KSubQCIFWidth = 128;
+const TUint KQCIFWidth = 176;
+const TUint KCIFWidth = 352;
+const TUint KQVGAWidth = 320;
+const TUint KVGAWidth = 640;
+//WVGA task
+const TUint KWVGAWidth = 864;
+
+// An assertion macro wrapper to clean up the code a bit
+#define CCASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CVedCodecChecker"), -5000))
+
+// Print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// Near-dummy observer class for temporary transcoder instance. In practice is only used to provide input framerate
+// to the transcoder
+class CTrObs : public CBase, public MTRTranscoderObserver
+    {
+public:
+    /* Constructor & destructor */
+    
+    inline CTrObs(TReal aFrameRate) : iInputFrameRate(aFrameRate) 
+        {
+        };
+    inline ~CTrObs()
+        {
+        };
+
+    // Dummy methods from MTRTranscoderObserver, just used to complete the observer class
+    inline void MtroInitializeComplete(TInt /*aError*/)
+        {
+        };
+    inline void MtroFatalError(TInt /*aError*/)
+        {
+        };
+    inline void MtroReturnCodedBuffer(CCMRMediaBuffer* /*aBuffer*/) 
+        {
+        };
+    // method to provide clip input framerate to transcoder
+    inline void MtroSetInputFrameRate(TReal& aRate)
+        {
+        aRate = iInputFrameRate;
+        };
+    inline void MtroAsyncStopComplete()
+        {
+        };
+        
+    inline void MtroSuspend()
+        {
+        };
+        
+    inline void MtroResume()
+        {
+        };
+        
+private:// data
+
+        // clip input framerate (fps)
+        TReal iInputFrameRate;
+    
+    };
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CVedCodecChecker::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CVedCodecChecker* CVedCodecChecker::NewL() 
+    {
+    PRINT(_L("CVedCodecChecker::NewL in"));
+    
+    CVedCodecChecker* self = NewLC();
+    CleanupStack::Pop(self);
+    
+    PRINT(_L("CVedCodecChecker::NewL out"));
+    return self;
+    }
+
+CVedCodecChecker* CVedCodecChecker::NewLC()
+    {
+    PRINT(_L("CVedCodecChecker::NewLC in"));
+    
+    CVedCodecChecker* self = new (ELeave) CVedCodecChecker();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+
+    PRINT(_L("CVedCodecChecker::NewLC out"));
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// CVedCodecChecker::CVedCodecChecker
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVedCodecChecker::CVedCodecChecker() : iOutputFormatsChecked(EFalse)
+    {    
+    }
+    
+// -----------------------------------------------------------------------------
+// CSizeEstimate::~CSizeEstimate
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVedCodecChecker::~CVedCodecChecker()
+    {
+
+    // free all memory
+    for (TInt i = 0; i < KNumCodecs; i++)
+    {
+        if (iInputCodecsAndResolutions[i] != 0)
+            delete [] iInputCodecsAndResolutions[i];                    
+        
+        iInputCodecsAndResolutions[i] = 0;
+        
+        if (iOutputCodecsAndResolutions[i] !=  0)
+            delete [] iOutputCodecsAndResolutions[i];                    
+        
+        iOutputCodecsAndResolutions[i] = 0;
+    }
+    
+        
+    }
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CVedCodecChecker::ConstructL()
+    {
+    
+    PRINT(_L("CVedCodecChecker::ConstructL in"));
+    
+    TInt i;
+    
+    // reset pointer tables
+    for (i = 0; i < KNumCodecs; i++)
+    {
+        iInputCodecsAndResolutions[i] = 0;
+        iOutputCodecsAndResolutions[i] = 0;
+    }
+    
+    // allocate resolution tables
+    for (i = 0; i < KNumCodecs; i++)
+    {                        
+        TBool* temp =  new ( ELeave ) TBool[KNumResolutions];
+        for (TInt j = 0; j < KNumResolutions; j++)
+            temp[j] = 0;            
+        
+        iInputCodecsAndResolutions[i] = temp;        
+        
+        temp =  new ( ELeave ) TBool[KNumResolutions];
+        for (TInt j = 0; j < KNumResolutions; j++) 
+            temp[j] = 0;            
+        
+        iOutputCodecsAndResolutions[i] = temp;
+    }
+        
+    // check supported input codecs / resolutions
+    GetSupportedInputFormatsL();
+    
+    PRINT(_L("CVedCodecChecker::ConstructL out"));
+        
+    }
+
+// -----------------------------------------------------------------------------
+// CVedCodecChecker::GetSupportedInputFormatsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+void CVedCodecChecker::GetSupportedInputFormatsL()
+    {        
+
+    PRINT(_L("CVedCodecChecker::GetSupportedInputFormatsL in"));
+
+    const TSize KResolutions[KNumResolutions] = { KVedResolutionSubQCIF, 
+                                                  KVedResolutionQCIF, 
+                                                  KVedResolutionCIF, 
+                                                  KVedResolutionQVGA, 
+                                                  KVedResolutionVGA16By9,
+                                                  KVedResolutionVGA,
+                                                  //WVGA task
+                                                  KVedResolutionWVGA };
+
+    const TPtrC8 KCodecs[KNumCodecs] = { _L8("video/H263-2000; profile=0; level=10"),
+                                         _L8("video/H263-2000; profile=0; level=45"),
+                                         _L8("video/mp4v-es; profile-level-id=8"),
+                                         _L8("video/mp4v-es; profile-level-id=9"),
+                                         _L8("video/mp4v-es; profile-level-id=1"),
+                                         _L8("video/mp4v-es; profile-level-id=2"),
+                                         _L8("video/mp4v-es; profile-level-id=3"),
+                                         _L8("video/mp4v-es; profile-level-id=4"),                                         
+                                         _L8("video/H264; profile-level-id=42800A"),
+                                         _L8("video/H264; profile-level-id=42900B"),
+                                         _L8("video/H264; profile-level-id=42800B"),
+                                         _L8("video/H264; profile-level-id=42800C"), 
+                                         _L8("video/H264; profile-level-id=42800D"), 
+                                         _L8("video/H264; profile-level-id=428014"), 
+                                         //WVGA task
+                                         _L8("video/H264; profile-level-id=428015"),
+                                         _L8("video/H264; profile-level-id=428016"), 
+                                         _L8("video/H264; profile-level-id=42801E"), 
+                                         _L8("video/H264; profile-level-id=42801F")  };   
+
+    TTRVideoFormat inputFormat;
+    TTRVideoFormat outputFormat;      
+    
+    inputFormat.iDataType = CTRTranscoder::ETRDuCodedPicture;
+    outputFormat.iDataType = CTRTranscoder::ETRYuvRawData420;        
+    
+    for (TInt i = 0; i < KNumCodecs; i++)
+    {    
+    
+        PRINT((_L("GetSupportedInputFormatsL - testing codec %d"), i));
+    
+        // create temporary transcoder observer object, with input framerate as parameter, since it is asked by the transcoder
+        CTrObs* tmpObs = new (ELeave) CTrObs(15.0);
+        CleanupStack::PushL(tmpObs);
+    
+        // create temporary transcoder instance
+        CTRTranscoder* tmpTranscoder = CTRTranscoder::NewL(*tmpObs);
+        CleanupStack::PushL(tmpTranscoder);
+    
+        // check if codec supported at all    
+        if ( tmpTranscoder->SupportsInputVideoFormat(KCodecs[i]) )
+        {
+            TInt error = KErrNone;
+            // check all resolutions
+            for (TInt j = 0; j < KNumResolutions; j++)
+            {                            
+            
+                if ( (i < ECodecMPEG4VSPLevel0) && (j > EResolutionQCIF) )
+                {
+                    // Do not allow larger resolutions than QCIF for H.263
+                    CleanupStack::PopAndDestroy(tmpTranscoder);
+                    CleanupStack::PopAndDestroy(tmpObs);     
+                    PRINT((_L("GetSupportedInputFormatsL - break")));
+                    break;
+                }
+                
+                PRINT((_L("GetSupportedInputFormatsL - testing (%d, %d)"), i, j));
+
+                inputFormat.iSize = outputFormat.iSize = KResolutions[j];
+                
+                TRAP( error, tmpTranscoder->OpenL(reinterpret_cast<MCMRMediaSink*>(1),//the sink will not be used, hence this is acceptable 
+                                     CTRTranscoder::EDecoding,
+                                     KCodecs[i],
+                                     KNullDesC8,
+                                     inputFormat, 
+                                     outputFormat, 
+                                     EFalse ) );
+                                     
+                if (error == KErrNone)
+                {
+                    PRINT((_L("GetSupportedInputFormatsL - (%d, %d) supported"), i, j));
+                    iInputCodecsAndResolutions[i][j] = ETrue;
+                } 
+                else if (error == KErrNotSupported)
+                {
+                    PRINT((_L("GetSupportedInputFormatsL - (%d, %d) not supported"), i, j));
+                    iInputCodecsAndResolutions[i][j] = EFalse;                    
+                } 
+                else
+                    User::Leave(error);
+                
+                CleanupStack::PopAndDestroy(tmpTranscoder);
+                CleanupStack::PopAndDestroy(tmpObs);     
+                
+                if ( j < (KNumResolutions - 1) )
+                {                                    
+                    tmpObs = new (ELeave) CTrObs(15.0);
+                    CleanupStack::PushL(tmpObs);
+                                
+                    // create temporary transcoder instance
+                    tmpTranscoder = CTRTranscoder::NewL(*tmpObs);
+                    CleanupStack::PushL(tmpTranscoder);  
+                }
+            }
+        } 
+        else
+        {
+            // all resolutions unsupported
+            for (TInt j=0; j < KNumResolutions; j++)
+            {            
+                iInputCodecsAndResolutions[i][j] = EFalse;
+            }
+            
+            CleanupStack::PopAndDestroy(tmpTranscoder);
+            CleanupStack::PopAndDestroy(tmpObs);
+                 
+        }    
+    }   
+    
+    PRINT(_L("CVedCodecChecker::GetSupportedInputFormatsL out"));
+
+    }
+
+// -----------------------------------------------------------------------------
+// CVedCodecChecker::GetSupportedOutputFormatsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+void CVedCodecChecker::GetSupportedOutputFormatsL()
+    {        
+    
+    PRINT(_L("CVedCodecChecker::GetSupportedOutputFormatsL in"));
+
+    const TSize KResolutions[KNumResolutions] = { KVedResolutionSubQCIF, 
+                                                  KVedResolutionQCIF, 
+                                                  KVedResolutionCIF, 
+                                                  KVedResolutionQVGA, 
+                                                  KVedResolutionVGA16By9,
+                                                  KVedResolutionVGA };
+
+    const TPtrC8 KCodecs[KNumCodecs] = { _L8("video/H263-2000; profile=0; level=10"),
+                                         _L8("video/H263-2000; profile=0; level=45"),
+                                         _L8("video/mp4v-es; profile-level-id=8"),
+                                         _L8("video/mp4v-es; profile-level-id=9"),
+                                         _L8("video/mp4v-es; profile-level-id=1"),
+                                         _L8("video/mp4v-es; profile-level-id=2"),
+                                         _L8("video/mp4v-es; profile-level-id=3"),
+                                         _L8("video/mp4v-es; profile-level-id=4"),                                          
+                                         _L8("video/H264; profile-level-id=42800A"),
+                                         _L8("video/H264; profile-level-id=42900B"),
+                                         _L8("video/H264; profile-level-id=42800B"),
+                                         _L8("video/H264; profile-level-id=42800C"), 
+
+                                         //WVGA task
+                                         //(TPtrC8&)KNullDesC8,  // level 1.3 not supported in output
+                                         //(TPtrC8&)KNullDesC8,   // level 2 not supported in output  
+                                         _L8("video/H264; profile-level-id=42800D"),
+                                         _L8("video/H264; profile-level-id=428014"),                                          
+                                         _L8("video/H264; profile-level-id=428015"),
+                                         _L8("video/H264; profile-level-id=428016"), 
+                                         _L8("video/H264; profile-level-id=42801E"), 
+                                         _L8("video/H264; profile-level-id=42801F")                                      
+                                       }; 
+                                       
+                                       
+
+    TTRVideoFormat inputFormat;
+    TTRVideoFormat outputFormat;
+    
+    inputFormat.iDataType = CTRTranscoder::ETRYuvRawData420;
+    outputFormat.iDataType = CTRTranscoder::ETRDuCodedPicture;
+    
+    for (TInt i = 0; i < KNumCodecs; i++)
+    {        
+        PRINT((_L("GetSupportedOutputFormatsL - testing codec %d"), i));
+    
+        // create temporary transcoder observer object, with input framerate as parameter, since it is asked by the transcoder
+        CTrObs* tmpObs = new (ELeave) CTrObs(15.0);
+        CleanupStack::PushL(tmpObs);
+    
+        // create temporary transcoder instance
+        CTRTranscoder* tmpTranscoder = CTRTranscoder::NewL(*tmpObs);
+        CleanupStack::PushL(tmpTranscoder);
+        
+        //WVGA task
+        // AVC levels 3.1 and higher are not supported in output
+        if (i >= ECodecAVCBPLevel3_1)
+        {
+            CleanupStack::PopAndDestroy(tmpTranscoder);
+            CleanupStack::PopAndDestroy(tmpObs);
+            PRINT((_L("GetSupportedOutputFormatsL - break AVC check")));   
+            break;
+        }
+       
+    
+        // check if codec supported at all    
+        if ( tmpTranscoder->SupportsOutputVideoFormat(KCodecs[i]) )
+        {
+            TInt error = KErrNone;
+            // check all resolutions
+            for (TInt j = 0; j < KNumResolutions; j++)
+            {
+            
+                if ( (i < ECodecMPEG4VSPLevel0) && (j > EResolutionQCIF) )
+                {
+                    // Do not allow larger resolutions than QCIF for H.263
+                    CleanupStack::PopAndDestroy(tmpTranscoder);
+                    CleanupStack::PopAndDestroy(tmpObs);     
+                    PRINT((_L("GetSupportedOutputFormatsL - break")));
+                    break;
+                }
+                
+                PRINT((_L("GetSupportedOutputFormatsL - testing (%d, %d)"), i, j));            
+
+                inputFormat.iSize = outputFormat.iSize = KResolutions[j];
+                
+                TRAP( error, tmpTranscoder->OpenL(reinterpret_cast<MCMRMediaSink*>(1),//the sink will not be used, hence this is acceptable 
+                                     CTRTranscoder::EEncoding,
+                                     KNullDesC8,
+                                     KCodecs[i],                                     
+                                     inputFormat, 
+                                     outputFormat, 
+                                     EFalse ) );
+                                     
+                if (error == KErrNone)
+                {
+                    PRINT((_L("GetSupportedOutputFormatsL - (%d, %d) supported"), i, j));
+                    iOutputCodecsAndResolutions[i][j] = ETrue;
+                } 
+                else if (error == KErrNotSupported)
+                {
+                    PRINT((_L("GetSupportedOutputFormatsL - (%d, %d) not supported"), i, j));
+                    iOutputCodecsAndResolutions[i][j] = EFalse;                    
+                } 
+                else
+                    User::Leave(error);
+                
+                CleanupStack::PopAndDestroy(tmpTranscoder);
+                CleanupStack::PopAndDestroy(tmpObs);     
+                
+                if ( j < (KNumResolutions - 1) )
+                {                                    
+                    tmpObs = new (ELeave) CTrObs(15.0);
+                    CleanupStack::PushL(tmpObs);
+                                
+                    // create temporary transcoder instance
+                    tmpTranscoder = CTRTranscoder::NewL(*tmpObs);
+                    CleanupStack::PushL(tmpTranscoder);  
+                }
+            }
+        } 
+        else
+        {
+            // all resolutions unsupported
+            for (TInt j=0; j < KNumResolutions; j++)
+            {            
+                iOutputCodecsAndResolutions[i][j] = EFalse;
+            }
+            
+            CleanupStack::PopAndDestroy(tmpTranscoder);
+            CleanupStack::PopAndDestroy(tmpObs);
+                 
+        }    
+    }   
+    
+    PRINT(_L("CVedCodecChecker::GetSupportedOutputFormatsL out"));
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVedCodecChecker::IsSupportedInputClip
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+TBool CVedCodecChecker::IsSupportedInputClipL(CVedVideoClip* aClip)
+    {
+    
+    PRINT(_L("CVedCodecChecker::IsSupportedInputClipL in"));
+
+    if ( (aClip->Info()->VideoType() != EVedVideoTypeH263Profile0Level10) && 
+         (aClip->Info()->VideoType() != EVedVideoTypeH263Profile0Level45) && 
+         (aClip->Info()->VideoType() != EVedVideoTypeMPEG4SimpleProfile) &&
+         (aClip->Info()->VideoType() != EVedVideoTypeAVCBaselineProfile)
+        )
+    {
+        return KErrNotSupported;
+    }
+        
+    TResolution resolution = MapResolution( aClip->Info()->Resolution() );
+
+    if ( resolution == EResolutionUnsupported )
+        return EFalse;
+    
+    if ( aClip->Info()->VideoType() == EVedVideoTypeH263Profile0Level10 )
+    {
+        return iInputCodecsAndResolutions[ECodecH263BPLevel10][resolution];
+    } 
+    
+    if ( aClip->Info()->VideoType() == EVedVideoTypeH263Profile0Level45 )
+    {
+        return iInputCodecsAndResolutions[ECodecH263BPLevel45][resolution];
+    }        
+    
+#ifndef VIDEOEDITORENGINE_AVC_EDITING        
+    if ( aClip->Info()->VideoType() == EVedVideoTypeAVCBaselineProfile )
+    {
+        return EFalse;
+    }        
+#endif
+
+    // clip is MPEG-4 or AVC
+            
+    // create parser to fetch codec specific info    
+    MP4Handle mp4Handle = 0;
+    MP4Err mp4Error;
+    if (!aClip->Info()->FileHandle())
+    {        
+        TBuf<258> tempFileName(aClip->Info()->FileName());
+        tempFileName.ZeroTerminate();			
+                
+        MP4FileName name = reinterpret_cast<MP4FileName>( const_cast<TUint16*>(tempFileName.Ptr()) );
+        mp4Error = MP4ParseOpen(&mp4Handle, name);
+    } 
+    else
+    {
+        mp4Error = MP4ParseOpenFileHandle(&mp4Handle, aClip->Info()->FileHandle());
+    }
+    
+    if (mp4Error != MP4_OK)
+    {
+        if (mp4Handle)
+            MP4ParseClose(mp4Handle);
+        mp4Handle = 0;
+    
+        if (mp4Error == MP4_OUT_OF_MEMORY)
+            User::Leave(KErrNoMemory);
+        else
+            User::Leave(KErrGeneral);
+    }
+            
+    TInt bufSize = 0;
+    
+    if (aClip->Info()->VideoType() == EVedVideoTypeMPEG4SimpleProfile)
+        bufSize = KVOLHeaderBufferSize;
+    else
+        bufSize = KAVCDCRBufferSize;
+        
+    HBufC8* tmpBuffer = (HBufC8*) HBufC8::NewLC(bufSize);
+    
+    TPtr8 tmpPtr = tmpBuffer->Des();
+    mp4_u32 infoSize = 0;
+    
+    // get info
+    mp4Error = MP4ParseReadVideoDecoderSpecificInfo( mp4Handle, 
+                                                    (mp4_u8*)(tmpPtr.Ptr()),
+                                                    bufSize,
+                                                    &infoSize );
+                                                    
+    MP4ParseClose(mp4Handle);                                                    
+                                                    
+    if ( mp4Error != MP4_OK )
+    {
+        User::Leave(KErrGeneral);
+    }   
+
+    tmpPtr.SetLength(infoSize);
+    
+    TCodec codec = ECodecUnsupported;
+    
+    if (aClip->Info()->VideoType() == EVedVideoTypeMPEG4SimpleProfile)
+    {
+        // Parse profile-level-id
+        CVedVolReader* tmpVolReader = CVedVolReader::NewL();
+        CleanupStack::PushL(tmpVolReader);
+
+        tmpVolReader->ParseVolHeaderL(tmpPtr);
+
+        TInt profileLevelId = tmpVolReader->ProfileLevelId();
+        
+        codec = MapProfileLevelId(profileLevelId);
+    }     
+    
+#ifdef VIDEOEDITORENGINE_AVC_EDITING    
+    else    
+    {
+        CVedAVCEdit* tmpAvcEdit = CVedAVCEdit::NewL();
+        CleanupStack::PushL(tmpAvcEdit);
+    
+        // this leaves with KErrNotSupported if clip is not supported
+        tmpAvcEdit->SaveAVCDecoderConfigurationRecordL(tmpPtr, EFalse);
+    
+        // Parse level    
+        TInt level = 0;
+        User::LeaveIfError( tmpAvcEdit->GetLevel(tmpPtr, level) );
+        
+        codec = MapAVCLevel(level);
+    }
+#endif
+    
+    CleanupStack::PopAndDestroy(2);
+	
+    if (codec == ECodecUnsupported)
+        return EFalse;
+
+    PRINT(_L("CVedCodecChecker::IsSupportedInputClipL out"));
+
+    return iInputCodecsAndResolutions[codec][resolution];
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVedCodecChecker::IsSupportedOutputFormatL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//   
+TBool CVedCodecChecker::IsSupportedOutputFormatL(const TPtrC8& aMimeType, TSize aResolution)
+    {
+    
+    PRINT(_L("CVedCodecChecker::IsSupportedOutputFormatL in"));
+    
+    if (aMimeType == KNullDesC8)
+    {
+        User::Leave(KErrArgument);
+    }
+    
+    if ( !iOutputFormatsChecked )
+    {   
+        // check supported output formats
+        GetSupportedOutputFormatsL();
+        iOutputFormatsChecked = ETrue;
+    }        
+    
+    TResolution resolution = MapResolution(aResolution);
+    
+    if (resolution == EResolutionUnsupported)
+        return EFalse;
+    
+    TCodec codec = ParseMimeType(aMimeType, aResolution);
+    
+    if (codec == ECodecUnsupported)
+        return EFalse;    
+    
+    PRINT(_L("CVedCodecChecker::IsSupportedOutputFormatL out"));
+    
+    return iOutputCodecsAndResolutions[codec][resolution];
+    
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CVedCodecChecker::MapResolution
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//   
+TResolution CVedCodecChecker::MapResolution(TSize aResolution)
+    {
+
+    if ( aResolution == KVedResolutionSubQCIF )
+        return EResolutionSubQCIF;
+    
+    else if ( aResolution == KVedResolutionQCIF )
+        return EResolutionQCIF;
+    
+    else if ( aResolution == KVedResolutionCIF )
+        return EResolutionCIF;
+    
+    else if ( aResolution == KVedResolutionQVGA )
+        return EResolutionQVGA;
+    
+    else if ( aResolution == KVedResolutionVGA16By9 )
+        return EResolutionVGA16By9;
+    
+    else if ( aResolution == KVedResolutionVGA )
+        return EResolutionVGA;
+    //WVGA task       
+    else if ( aResolution == KVedResolutionWVGA )
+        return EResolutionWVGA;
+    
+    return EResolutionUnsupported;
+    }
+
+// -----------------------------------------------------------------------------
+// CVedCodecChecker::MapProfileLevelId
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//   
+TCodec CVedCodecChecker::MapProfileLevelId(TInt aProfileLevelId)
+    {
+
+    if ( aProfileLevelId == 8 )
+        return ECodecMPEG4VSPLevel0;
+    
+    if ( aProfileLevelId == 9 )
+        return ECodecMPEG4VSPLevel0B;
+    
+    if ( aProfileLevelId == 1 )
+        return ECodecMPEG4VSPLevel1;
+    
+    if ( aProfileLevelId == 2 )
+        return ECodecMPEG4VSPLevel3;
+    
+    if ( aProfileLevelId == 3 )
+        return ECodecMPEG4VSPLevel3;
+    
+    if ( aProfileLevelId == 4 )
+        return ECodecMPEG4VSPLevel4;
+    
+    return ECodecUnsupported;
+
+    }
+    
+// -----------------------------------------------------------------------------
+// CVedCodecChecker::MapAVCLevel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//   
+TCodec CVedCodecChecker::MapAVCLevel(TInt aLevel)
+    {
+    
+    if ( aLevel == 10 )
+        return ECodecAVCBPLevel1;
+    
+    if ( aLevel == 101 )
+        return ECodecAVCBPLevel1B;
+    
+    if ( aLevel == 11 )
+        return ECodecAVCBPLevel1_1;
+    
+    if ( aLevel == 12 )
+        return ECodecAVCBPLevel1_2;
+    
+    if ( aLevel == 13 )
+        return ECodecAVCBPLevel1_3;
+    
+    if ( aLevel == 20 )
+        return ECodecAVCBPLevel2;    
+    //WVGA task
+    if ( aLevel == 21 )
+        return ECodecAVCBPLevel2_1;
+    
+    if ( aLevel == 22 )
+        return ECodecAVCBPLevel2_2;
+    
+    if ( aLevel == 30 )
+        return ECodecAVCBPLevel3;
+    
+    if ( aLevel == 31 )
+        return ECodecAVCBPLevel3_1; 
+    
+    return ECodecUnsupported;
+    
+    }
+    
+// -----------------------------------------------------------------------------
+// CVedCodecChecker::ParseMimeType
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//   
+TCodec CVedCodecChecker::ParseMimeType(const TPtrC8& aMimeType, TSize aResolution)
+    {
+
+    // figure out codec
+    TCodec codec;
+    
+    if ( aMimeType.MatchF( _L8("*video/H263-2000*") ) != KErrNotFound )
+    {
+        codec = ECodecH263BPLevel10;
+        
+        if ( aMimeType.MatchF( _L8("*profile*") ) != KErrNotFound )
+        {
+            // Profile info is given, check it
+            if ( aMimeType.MatchF( _L8("*profile=0*") ) == KErrNotFound )
+            {
+                return ECodecUnsupported;
+            }
+        }
+        else 
+        {
+            // no profile given
+        }
+        
+        if ( aMimeType.MatchF( _L8("*level=10*") ) != KErrNotFound )
+        {
+            codec = ECodecH263BPLevel10;            
+        }
+            
+        else if ( aMimeType.MatchF( _L8("*level=45*") ) != KErrNotFound )
+        {            
+            codec = ECodecH263BPLevel45;                		
+        }
+        
+        else if ( aMimeType.MatchF( _L8("*level*") ) != KErrNotFound )
+        {
+            // no other levels supported
+            return ECodecUnsupported;
+        }
+        else
+        {
+            // if no level is given assume 10
+        }        
+    }
+    else if ( (aMimeType.MatchF( _L8("*video/mp4v-es*") ) != KErrNotFound) || 
+              (aMimeType.MatchF( _L8("*video/MP4V-ES*") ) != KErrNotFound) )
+    {
+    
+        codec = ECodecMPEG4VSPLevel0;
+        
+        // Check profile-level
+        if ( aMimeType.MatchF( _L8("*profile-level-id=*") ) != KErrNotFound )
+        {
+            if ( aMimeType.MatchF( _L8("*profile-level-id=8*") ) != KErrNotFound )
+            {
+                codec = ECodecMPEG4VSPLevel0;
+            }
+            else if( aMimeType.MatchF( _L8("*profile-level-id=1*") ) != KErrNotFound )
+            {
+                codec = ECodecMPEG4VSPLevel1;
+            }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=2*") ) != KErrNotFound )
+            {
+                codec = ECodecMPEG4VSPLevel2;                
+            }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=3*") ) != KErrNotFound )
+            {
+                codec = ECodecMPEG4VSPLevel3;            
+            }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=9*") ) != KErrNotFound )
+            {
+                codec = ECodecMPEG4VSPLevel0B;                
+            }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=4*") ) != KErrNotFound )
+            {
+                codec = ECodecMPEG4VSPLevel4;
+            }
+            else
+            {
+                return ECodecUnsupported;                
+            }
+        
+        } 
+        else
+        {   // no profile-level id
+            switch( aResolution.iWidth )
+            {                
+                case KSubQCIFWidth:
+                case KQCIFWidth:
+                {
+                    // Set profile-level-id=0
+                    codec = ECodecMPEG4VSPLevel0;
+                    break;
+                }
+                
+                case KCIFWidth:
+                case KQVGAWidth:
+                {                
+                    // Set profile-level-id=2
+                    codec = ECodecMPEG4VSPLevel2;
+                    break;
+                }
+
+                case KVGAWidth:
+                {
+                    // Set profile-level-id=4 (4a)
+                    codec = ECodecMPEG4VSPLevel4;                    
+                    break;
+                }
+
+                default:
+                {
+                    // Set profile-level-id=0
+                    codec = ECodecMPEG4VSPLevel0;
+                }                
+            }
+            
+        }
+    } 
+    
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+    else if ( (aMimeType.MatchF( _L8("*video/h264*") ) != KErrNotFound) || 
+              (aMimeType.MatchF( _L8("*video/H264*") ) != KErrNotFound) )
+    
+    {
+        codec = ECodecAVCBPLevel1;
+        
+        if ( aMimeType.MatchF( _L8("*profile-level-id=42800A*") ) != KErrNotFound )
+        {
+            codec = ECodecAVCBPLevel1;
+        }
+        else if( aMimeType.MatchF( _L8("*profile-level-id=42900B*") ) != KErrNotFound )
+        {
+            codec = ECodecAVCBPLevel1B;
+        }
+        else if ( aMimeType.MatchF( _L8("*profile-level-id=42800B*") ) != KErrNotFound )
+        {
+            codec = ECodecAVCBPLevel1_1;                
+        }
+        else if ( aMimeType.MatchF( _L8("*profile-level-id=42800C*") ) != KErrNotFound )
+        {
+            codec = ECodecAVCBPLevel1_2;
+        }    
+        //WVGA task
+        else if ( aMimeType.MatchF( _L8("*profile-level-id=42800D*") ) != KErrNotFound )
+        {
+            codec = ECodecAVCBPLevel1_3;
+        } 
+        else if ( aMimeType.MatchF( _L8("*profile-level-id=428014*") ) != KErrNotFound )
+        {
+            codec = ECodecAVCBPLevel2;
+        } 
+        else if ( aMimeType.MatchF( _L8("*profile-level-id=428015*") ) != KErrNotFound )
+        {
+            codec = ECodecAVCBPLevel2_1;
+        } 
+        else if ( aMimeType.MatchF( _L8("*profile-level-id=428016*") ) != KErrNotFound )
+        {
+            codec = ECodecAVCBPLevel2_2;
+        } 
+        else if ( aMimeType.MatchF( _L8("*profile-level-id=42801E*") ) != KErrNotFound )
+        {
+            codec = ECodecAVCBPLevel3;
+        } 
+        else if ( aMimeType.MatchF( _L8("*profile-level-id=42801F*") ) != KErrNotFound )
+        {
+            codec = ECodecAVCBPLevel3_1;
+        } 
+        else
+        {
+            return ECodecUnsupported;                
+        }        
+    }
+#endif
+
+    else 
+    {
+        return ECodecUnsupported;
+    }
+    
+    return codec;
+
+}
+            
+            
+// End of file
+        
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/src/vedqualitysettingsapi.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,307 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#include "vedqualitysettingsapi.h"
+
+const TUint KCameraDisplayID = 2;
+
+// ---------------------------------------------------------------------------
+// Constructor of CVideoQualitySelector
+// ---------------------------------------------------------------------------
+//
+CVideoQualitySelector::CVideoQualitySelector()
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// Destructor of CVideoQualitySelector
+// ---------------------------------------------------------------------------
+//
+CVideoQualitySelector::~CVideoQualitySelector()
+    {
+    if( iConfigManager )
+        {
+        delete iConfigManager;
+        iConfigManager = 0;
+        }
+        
+    if( iQualityLevels )
+        {
+        delete iQualityLevels;
+        iQualityLevels = 0;
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// ConstructL() of CVideoQualitySelector
+// ---------------------------------------------------------------------------
+//
+void CVideoQualitySelector::ConstructL()
+    {
+    iConfigManager = CImagingConfigManager::NewL();
+    
+    iQualityLevels = new (ELeave) CArrayFixFlat<TUint>(16);
+    
+    iConfigManager->GetVideoQualityLevelsL( *iQualityLevels, KCameraDisplayID );
+    }
+    
+// ---------------------------------------------------------------------------
+// NewL() of CVideoQualitySelector
+// ---------------------------------------------------------------------------
+//
+CVideoQualitySelector* CVideoQualitySelector::NewL()
+    {
+    CVideoQualitySelector* self = CVideoQualitySelector::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// NewLC() of CVideoQualitySelector
+// ---------------------------------------------------------------------------
+//
+CVideoQualitySelector* CVideoQualitySelector::NewLC()
+    {
+    CVideoQualitySelector* self = new( ELeave ) CVideoQualitySelector;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Get number of defined quality levels.
+// ---------------------------------------------------------------------------
+//
+TInt CVideoQualitySelector::NumberOfQualityLevels()
+    {
+    return iQualityLevels->Count();
+    }
+
+// ---------------------------------------------------------------------------
+// Get quality set associated with the given level.
+// ---------------------------------------------------------------------------
+//
+void CVideoQualitySelector::GetVideoQualitySetL( SVideoQualitySet& aSet, TInt aLevel, TBool aAspectRatioWide )
+    {
+    if ( !aAspectRatioWide )
+        {
+        GetVideoQualitySetL( aSet, aLevel );
+        }
+    else
+        {
+        // NOT READY
+        User::Leave( KErrNotSupported );     
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get quality set associated with the given level.
+// ---------------------------------------------------------------------------
+//
+void CVideoQualitySelector::GetVideoQualitySetL( SVideoQualitySet& aSet, TInt aLevel )
+    {
+    TVideoQualitySet currentSet;
+    
+    switch ( aLevel )
+        {
+        case EVideoQualityMMS :
+            {
+            iConfigManager->GetVideoQualitySet( currentSet, CImagingConfigManager::EQualityLow, KCameraDisplayID );
+            MapQualitySet( aSet, currentSet );
+            }
+            break;
+            
+        case EVideoQualityNormal :
+            {
+            iConfigManager->GetVideoQualitySet( currentSet, CImagingConfigManager::EQualityNormal, KCameraDisplayID );
+            MapQualitySet( aSet, currentSet );
+            }
+            break;
+            
+        case EVideoQualityHigh :
+            {
+            iConfigManager->GetVideoQualitySet( currentSet, CImagingConfigManager::EQualityHigh, KCameraDisplayID );
+            MapQualitySet( aSet, currentSet );
+            }
+            break;
+            
+        default:
+            {
+            if ( aLevel < EVideoQualityMin )
+                {
+                User::Leave( KErrArgument );
+                }
+            
+            // Map our quality level to config manager's quality level   
+            TInt configManagerLevel = aLevel * (CImagingConfigManager::EQualityHigh - CImagingConfigManager::EQualityMin);
+            configManagerLevel /= (EVideoQualityHigh - EVideoQualityMin);
+            
+            iConfigManager->GetVideoQualitySet( currentSet, configManagerLevel, KCameraDisplayID );
+            MapQualitySet( aSet, currentSet );
+            }
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get quality set associated with the given video resolution.
+// ---------------------------------------------------------------------------
+//
+void CVideoQualitySelector::GetVideoQualitySetL( SVideoQualitySet& aSet, const TSize& aVideoResolution )
+    {
+    TVideoQualitySet currentSet;
+    TInt candidate = -1;
+    TInt i;
+    
+    // Go through the qualities until a match is found. If several matches, pick the 1st one
+    for ( i = iQualityLevels->Count() - 1; i >= 0; i-- ) // Searches from up to down to find higher quality first
+        {
+        iConfigManager->GetVideoQualitySet( currentSet, iQualityLevels->At( i ), KCameraDisplayID );
+        
+        if ( (currentSet.iVideoWidth == aVideoResolution.iWidth) && (currentSet.iVideoHeight == aVideoResolution.iHeight) )
+            {
+            // We've found a set which matches with the requested size
+            
+            if ( candidate == -1 )  // Don't set to worse if already found
+                {
+                candidate = i;
+                }
+            
+            if ( (currentSet.iVideoQualitySetLevel == CImagingConfigManager::EQualityLow) ||
+                 (currentSet.iVideoQualitySetLevel == CImagingConfigManager::EQualityNormal) ||
+                 (currentSet.iVideoQualitySetLevel == CImagingConfigManager::EQualityHigh) )
+                {
+                // We've found a set which matches also with preferred qualities
+                MapQualitySet( aSet, currentSet );
+                return;
+                }
+            }
+        }
+    
+    if ( candidate >= 0 ) 
+        {
+        iConfigManager->GetVideoQualitySet( currentSet, iQualityLevels->At( candidate ), KCameraDisplayID );
+        MapQualitySet( aSet, currentSet );
+        }
+    else
+        {
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get quality set associated with the given video codec MIME-type.
+// ---------------------------------------------------------------------------
+//
+void CVideoQualitySelector::GetVideoQualitySetL( SVideoQualitySet& aSet, const TPtrC8& aVideoCodecMimeType )
+    {
+    TVideoQualitySet currentSet;
+    TPtrC8 settingsMimeType;
+    TInt i;
+    
+    for ( i = iQualityLevels->Count() - 1; i >= 0; i-- ) // searches from up to down to find higher quality first
+        {
+        iConfigManager->GetVideoQualitySet( currentSet, iQualityLevels->At( i ), KCameraDisplayID );
+        
+        settingsMimeType.Set(TPtrC8(currentSet.iVideoCodecMimeType));
+        if ( settingsMimeType.MatchF( (const TDesC8& )aVideoCodecMimeType ) != KErrNotFound ) 
+            {
+            // Found a match
+            MapQualitySet( aSet, currentSet );
+            return;
+            }
+        }
+        
+    User::Leave( KErrNotSupported );
+    }
+    
+// ---------------------------------------------------------------------------
+// Copies the values from the source set to the target set.
+// ---------------------------------------------------------------------------
+//
+void CVideoQualitySelector::MapQualitySet( SVideoQualitySet& aTargetSet, TVideoQualitySet& aSourceSet )
+    {
+    TInt i = 0;
+    
+    // Video aspect ratio
+    // We don't have wide screen quality sets yet so this is always true
+    aTargetSet.iVideoAspectRatioNormal = ETrue;
+    
+    // Video file format mime type    
+    for ( i = 0; (i < KQSMaxShortStringLength - 1) && (i < KMaxStringLength); i++ )
+        {
+        aTargetSet.iVideoFileMimeType[i] = aSourceSet.iVideoFileMimeType[i];
+        }
+    aTargetSet.iVideoFileMimeType[i] = '\0';    // Add null termination
+    
+    // Video codec mime type    
+    for ( i = 0; (i < KQSMaxLongStringLength - 1) && (i < KMaxStringLength); i++ )
+        {
+        aTargetSet.iVideoCodecMimeType[i] = aSourceSet.iVideoCodecMimeType[i];
+        }
+    aTargetSet.iVideoCodecMimeType[i] = '\0';   // Add null termination
+    
+    // Video picture width in pixels (luminance)
+    aTargetSet.iVideoWidth = aSourceSet.iVideoWidth;
+    
+    // Video picture height in pixels (luminance)
+    aTargetSet.iVideoHeight = aSourceSet.iVideoHeight;
+    
+    // Video framerate in fps
+    aTargetSet.iVideoFrameRate = aSourceSet.iVideoFrameRate;
+    
+    // Video bitrate in bps
+    aTargetSet.iVideoBitRate = aSourceSet.iVideoBitRate;
+    
+    // Random access point rate, in pictures per second
+    aTargetSet.iRandomAccessRate = aSourceSet.iRandomAccessRate;
+    
+    // Audio codec FourCC
+    if ( aSourceSet.iAudioFourCCType == TFourCC(' ', 'A', 'M', 'R') )
+    {
+        // AMR
+        aTargetSet.iAudioFourCCType[0] = ' ';
+        aTargetSet.iAudioFourCCType[1] = 'A';
+        aTargetSet.iAudioFourCCType[2] = 'M';
+        aTargetSet.iAudioFourCCType[3] = 'R';
+        aTargetSet.iAudioFourCCType[4] = '\0';
+    } 
+    
+    else if (aSourceSet.iAudioFourCCType == TFourCC(' ', 'A', 'A', 'C') )
+    {
+        // AAC
+        aTargetSet.iAudioFourCCType[0] = ' ';
+        aTargetSet.iAudioFourCCType[1] = 'A';
+        aTargetSet.iAudioFourCCType[2] = 'A';
+        aTargetSet.iAudioFourCCType[3] = 'C';
+        aTargetSet.iAudioFourCCType[4] = '\0';
+    } 
+    else 
+        aTargetSet.iAudioFourCCType[0] = '\0';
+
+    // Audio bitrate in bps
+    aTargetSet.iAudioBitRate = aSourceSet.iAudioBitRate;
+    
+    // Audio sampling rate in Hz
+    aTargetSet.iAudioSamplingRate = aSourceSet.iAudioSamplingRate;
+    
+    // Number of audio channels
+    aTargetSet.iAudioChannels = aSourceSet.iAudioChannels;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/src/vedvideoconversionimp.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#include "vedvideoclip.h"
+#include "vedvideoconversionimp.h"
+
+// Print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// An assertion macro wrapper to clean up the code a bit
+#define VCASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CVideoConverterImp"), -10000 ))
+
+
+// ---------------------------------------------------------------------------
+// NewL() of CVideoConverter
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVideoConverter* CVideoConverter::NewL(MVideoConverterObserver& aObserver) 
+    {
+    PRINT(_L("CVideoConverter::NewL in"));
+    
+    CVideoConverterImp* self = (CVideoConverterImp*)NewLC(aObserver);
+    CleanupStack::Pop(self);        
+    PRINT(_L("CVideoConverter::NewL out"));
+    
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// NewLC() of CVideoConverter
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVideoConverter* CVideoConverter::NewLC(MVideoConverterObserver& aObserver)
+    {
+    PRINT(_L("CVideoConverter::NewLC in"));
+    
+    CVideoConverterImp* self = new (ELeave) CVideoConverterImp(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+
+    PRINT(_L("CVideoConverter::NewLC out"));
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor of CVideoConverter
+// ---------------------------------------------------------------------------
+//
+CVideoConverterImp::CVideoConverterImp(MVideoConverterObserver& aObserver) : iObserver(aObserver)
+{    
+}
+
+    
+// ---------------------------------------------------------------------------
+// Destructor of CVideoConverter
+// ---------------------------------------------------------------------------
+//
+CVideoConverterImp::~CVideoConverterImp()
+{
+    delete iMovie;
+}
+
+// ---------------------------------------------------------------------------
+// ConstructL() of CVideoConverter
+// ---------------------------------------------------------------------------
+//
+void CVideoConverterImp::ConstructL()
+{   
+    iMovie = CVedMovie::NewL(NULL);
+ 
+    iMovie->RegisterMovieObserverL(this);
+ 
+    // set quality to MMS   
+    iMovie->SetQuality(CVedMovie::EQualityMMSInteroperability);
+}
+
+// ---------------------------------------------------------------------------
+// Insert file to be checked / converted
+// ---------------------------------------------------------------------------
+//
+void CVideoConverterImp::InsertFileL(RFile* aFile)
+{
+
+    if ( iMovie->VideoClipCount() != 0 )
+        User::Leave(KErrAlreadyExists);
+
+    iMovie->InsertVideoClipL(aFile, 0);
+}
+
+// ---------------------------------------------------------------------------
+// Check compatibility
+// ---------------------------------------------------------------------------
+//
+TMMSCompatibility CVideoConverterImp::CheckMMSCompatibilityL(TInt aMaxSize)
+{
+
+    VCASSERT( iMovie->VideoClipCount() == 1 );
+    
+    if ( iMovie->VideoClipCount() != 1 )
+        User::Leave(KErrNotFound);
+    
+    CVedVideoClipInfo* info = iMovie->VideoClipInfo(0);
+    
+    // check file size
+    RFile* file = info->FileHandle();
+    
+    TInt size = 0;
+    User::LeaveIfError( file->Size(size) );
+    
+    TBool sizeOK = ( size <= aMaxSize );
+    
+    // check format
+    TVedVideoFormat fileFormat = info->Format();
+    TVedVideoType videoCodec = info->VideoType();
+    TVedAudioType audioCodec = info->AudioType();
+
+    TBool formatOK = ( fileFormat == EVedVideoFormat3GPP ) &&
+                     ( videoCodec == EVedVideoTypeH263Profile0Level10 ) &&
+                     ( audioCodec == EVedAudioTypeNoAudio || 
+                       audioCodec == EVedAudioTypeAMR );
+
+    if ( formatOK && sizeOK )
+        return ECompatible;
+    
+    if ( sizeOK || (!sizeOK && !formatOK) )
+    { 
+         VCASSERT( !formatOK );
+         // check estimated size after conversion
+         // NOTE: This is checked also for sizeOK, because it's possible
+         //       that size increases in conversion
+        TInt sizeEstimate = iMovie->GetSizeEstimateL();
+        
+        if ( sizeEstimate <= aMaxSize )
+            return EConversionNeeded;
+        
+        else
+            return ECutNeeded;   
+    } 
+    
+    // size not ok, format ok
+    VCASSERT( !sizeOK && formatOK );
+
+    return ECutNeeded;    
+
+}
+
+// ---------------------------------------------------------------------------
+// Get end time estimate on basis of target size and start time
+// ---------------------------------------------------------------------------
+//
+void CVideoConverterImp::GetDurationEstimateL(TInt aTargetSize, TTimeIntervalMicroSeconds aStartTime, 
+                                           TTimeIntervalMicroSeconds& aEndTime)
+{
+ 
+    iMovie->GetDurationEstimateL(aTargetSize, aStartTime, aEndTime);
+
+}
+
+// ---------------------------------------------------------------------------
+// Start conversion
+// ---------------------------------------------------------------------------
+//
+void CVideoConverterImp::ConvertL(RFile* aOutputFile, TInt aSizeLimit,
+                                  TTimeIntervalMicroSeconds aCutInTime, 
+                                  TTimeIntervalMicroSeconds aCutOutTime)
+{
+
+    VCASSERT( iMovie && iMovie->VideoClipCount() == 1 );
+    
+    TTimeIntervalMicroSeconds temp = iMovie->VideoClipCutOutTime(0);
+    
+    iMovie->VideoClipSetCutInTime(0, aCutInTime);
+    
+    if ( aCutOutTime != KVedOriginalDuration )
+        iMovie->VideoClipSetCutOutTime(0, aCutOutTime);
+    
+    iMovie->SetMovieSizeLimit(aSizeLimit);
+    
+    iMovie->ProcessL(aOutputFile, *this);
+
+}
+
+// ---------------------------------------------------------------------------
+// Cancel conversion
+// ---------------------------------------------------------------------------
+//
+TInt CVideoConverterImp::CancelConversion()
+{
+    iMovie->CancelProcessing();
+    
+    return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+// Reset to initial state
+// ---------------------------------------------------------------------------
+//
+TInt CVideoConverterImp::Reset()
+{
+    if (iMovie)
+        iMovie->Reset();
+    
+    return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+// Implementation of clip added -callback
+// ---------------------------------------------------------------------------
+//
+void CVideoConverterImp::NotifyVideoClipAdded(CVedMovie& /*aMovie*/, TInt /*aIndex*/)
+{
+    iObserver.MvcoFileInserted(*this);
+}
+
+
+// ---------------------------------------------------------------------------
+// Implementation of clip adding failed -callback
+// ---------------------------------------------------------------------------
+//
+void CVideoConverterImp::NotifyVideoClipAddingFailed(CVedMovie& /*aMovie*/, TInt aError)
+{
+    iObserver.MvcoFileInsertionFailed(*this, aError);
+}
+
+// ---------------------------------------------------------------------------
+// Implementation of clip movie processing started -callback
+// ---------------------------------------------------------------------------
+//
+void CVideoConverterImp::NotifyMovieProcessingStartedL(CVedMovie& /*aMovie*/)
+{
+    iObserver.MvcoConversionStartedL(*this);
+}
+
+// ---------------------------------------------------------------------------
+// Implementation of clip movie processing progressed -callback
+// ---------------------------------------------------------------------------
+//
+void CVideoConverterImp::NotifyMovieProcessingProgressed(CVedMovie& /*aMovie*/, TInt aPercentage)
+{
+    iObserver.MvcoConversionProgressed(*this, aPercentage);
+}
+
+// ---------------------------------------------------------------------------
+// Implementation of clip movie processing completed -callback
+// ---------------------------------------------------------------------------
+//
+void CVideoConverterImp::NotifyMovieProcessingCompleted(CVedMovie& /*aMovie*/, TInt aError)
+{
+    iObserver.MvcoConversionCompleted(*this, aError);
+}
+
+void CVideoConverterImp::NotifyVideoClipRemoved(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CVideoConverterImp::NotifyAudioClipAdded(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CVideoConverterImp::NotifyAudioClipAddingFailed(CVedMovie& /*aMovie*/, TInt /*aError*/){}
+void CVideoConverterImp::NotifyVideoClipIndicesChanged(CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, TInt /*aNewIndex*/){}
+void CVideoConverterImp::NotifyVideoClipTimingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CVideoConverterImp::NotifyVideoClipSettingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CVideoConverterImp::NotifyStartTransitionEffectChanged(CVedMovie& /*aMovie*/){}
+void CVideoConverterImp::NotifyMiddleTransitionEffectChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CVideoConverterImp::NotifyEndTransitionEffectChanged(CVedMovie& /*aMovie*/){}
+void CVideoConverterImp::NotifyAudioClipRemoved(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CVideoConverterImp::NotifyAudioClipIndicesChanged(CVedMovie& /*aMovie*/, TInt /*aOldIndex*/, TInt /*aNewIndex*/){}
+void CVideoConverterImp::NotifyAudioClipTimingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CVideoConverterImp::NotifyMovieReseted(CVedMovie& /*aMovie*/){}
+void CVideoConverterImp::NotifyVideoClipGeneratorSettingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/) {} 
+void CVideoConverterImp::NotifyMovieOutputParametersChanged(CVedMovie& /*aMovie*/){}
+void CVideoConverterImp::NotifyVideoClipColorEffectChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CVideoConverterImp::NotifyVideoClipAudioSettingsChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CVideoConverterImp::NotifyVideoClipDescriptiveNameChanged(CVedMovie& /*aMovie*/, TInt /*aIndex*/){}
+void CVideoConverterImp::NotifyMovieQualityChanged(CVedMovie& /*aMovie*/){}
+void CVideoConverterImp::NotifyAudioClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/){}
+void CVideoConverterImp::NotifyAudioClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/){}
+void CVideoConverterImp::NotifyVideoClipDynamicLevelMarkInserted(CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/){}
+void CVideoConverterImp::NotifyVideoClipDynamicLevelMarkRemoved(CVedMovie& /*aMovie*/, TInt /*aClipIndex*/, TInt /*aMarkIndex*/){}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/Composer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef __COMPOSER_H__
+#define __COMPOSER_H__
+
+//  INCLUDES
+#ifndef __E32BASE_H__
+#include <e32base.h>
+#endif
+
+// CONSTANTS
+// MACROS
+// DATA TYPES
+// FUNCTION PROTOTYPES
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+/**
+*  Base class for file format parser
+*  ?other_description_lines
+*/
+class CComposer : public CBase
+    {
+
+    public: // Constants
+
+        enum TErrorCode 
+        {
+            EInternalAssertionFailure   = -2200,
+            EComposerNotEnoughData = -2201, //FC Can this happen?
+            EComposerEndOfStream = -2202,//FC Can this happen?
+            EComposerBufferTooSmall = -2203,//FC Can this happen?
+            EComposerUnsupportedFormat = -2204,//FC Can this happen?
+            EComposerStreamCorrupted = -2205,//FC Can this happen?
+            EComposerFailure = -2206
+        };
+
+		// file format
+		enum TFileFormat {
+			EFileFormatUnrecognized = 0,
+		    EFileFormat3GP,
+			EFileFormatMP4
+		};
+
+        // video format
+        enum TVideoFormat {
+            EVideoFormatNone = 0,
+            EVideoFormatH263Profile0Level10,
+			EVideoFormatH263Profile0Level45,
+            EVideoFormatMPEG4,
+            EVideoFormatAVCProfileBaseline
+        };
+
+        // audio format
+        enum TAudioFormat
+        {
+            EAudioFormatNone = 0,
+            EAudioFormatAMR,
+			EAudioFormatAAC
+        };               
+
+    public: // Data structures
+
+        // common stream parameters
+        struct TStreamParameters
+        {
+            TBool iHaveVideo;  // is there video in the stream ?
+            TBool iHaveAudio;  // is there audio in the stream ?
+            TUint iNumDemuxChannels;  // number of demux channels
+			TFileFormat iFileFormat;  // file format
+            TVideoFormat iVideoFormat;  // video format
+            TAudioFormat iAudioFormat;  // audio format
+
+            TUint iAudioFramesInSample; // audio frames per one sample (3GPP)
+
+            TUint iVideoWidth;  // width of a video frame
+            TUint iVideoHeight;   // height of a video frame
+            TInt64 iVideoPicturePeriodNsec;  // one PCF tick period in nanoseconds
+            TUint iVideoIntraFrequency;  // intra frame frequency in stream
+
+            TUint iStreamLength;  // stream length in milliseconds
+            TUint iVideoLength;
+            TUint iAudioLength;
+
+            TBool iCanSeek;   // TRUE if seeking in file is possible
+
+            TUint iStreamSize;  // stream size in bytes
+            TUint iStreamBitrate;  // stream average bitrate
+
+            TUint iMaxPacketSize; // The maximum media packet size
+            TUint iLogicalChannelNumberVideo; // Logical channel number for video data
+            TUint iLogicalChannelNumberAudio; // Logical channel number for audio data
+            TUint iReferencePicturesNeeded; // Number of reference pictures
+                                            // the video decoder needs to store.
+            TUint iNumScalabilityLayers; // The number of different scalability layers used
+            TUint iLayerFrameRates[8];  // Picture rate for each layer
+            
+            TReal iFrameRate;
+            TInt iVideoTimeScale;
+            TInt iAudioTimeScale;
+
+        };
+
+    public:  // Constructors and destructor
+
+    public: // New functions
+
+        /**
+        * Composer the stream header.
+        * @param aStreamParameters Stream parameters
+        */	        
+        virtual void ComposeHeaderL(CComposer::TStreamParameters& aStreamParameters, 
+            TInt aOutputVideoTimeScale, TInt aOutputAudioTimeScale, TInt aAudioFramesInSample) = 0;		
+
+        virtual TInt Close() = 0;
+                                
+        virtual TInt WriteFrames(TDesC8& aSrcBuffer, TInt aFrameSize,TInt aDuration,
+            TInt aKeyFrame,TInt aNumberOfFrames,TInt aFrameType) = 0;
+
+		virtual TInt WriteFrames(TDesC8& aSrcBuffer, TInt aFrameSize,TInt aDuration,
+            TInt aKeyFrame,TInt aNumberOfFrames,TInt aFrameType, TInt& aMP4Size,
+			TBool aModeChanged,TBool aFirstFrameOfClip,TInt aMode, TBool aFromEncoder) = 0;
+
+        virtual TUint8* GetComposedBuffer() = 0;  //Added for buffer support
+
+		virtual TUint GetComposedBufferSize() = 0;	//Added for buffer support
+
+        /**
+        * Calculate free space on the target output drive in bytes.
+        *
+        * @param None
+        * @return Free space in bytes
+        */
+        virtual TInt64 DriveFreeSpaceL() = 0;
+
+
+    };
+
+#endif      // __PARSER_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/MDFWrapper.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Definition file for MSL / MDF data types.
+*
+*/
+
+
+#ifndef MDFWRAPPER_H
+#define MDFWRAPPER_H
+
+
+// INCLUDES
+// Include Symbian MDF header files
+#include <devvideorecord.h>
+#include <DevVideoConstants.h>
+
+// MACROS
+// Redefine Symbian MDF types
+typedef CVideoEncoderInfo CDEVVRVideoEncoderInfo;
+typedef CMMFDevVideoRecord CDEVVRVideoRecord;
+typedef MMMFDevVideoRecordObserver MDEVVRVideoRecordObserver;
+
+// Cast operation
+#define CAST_OPTION(x) *(x)
+
+// CONSTANTS
+// Exact match specifier for searching available plugins
+const TBool KCMRMatch = EFalse;
+
+
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/Parser.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,254 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Definition of an abstract base class for file format parsers.
+*
+*/
+
+
+
+#ifndef __PARSER_H__
+#define __PARSER_H__
+
+//  INCLUDES
+#ifndef __E32BASE_H__
+#include <e32base.h>
+#endif
+
+// CONSTANTS
+// MACROS
+// DATA TYPES
+// FUNCTION PROTOTYPES
+// FORWARD DECLARATIONS
+// CLASS DECLARATION
+
+/**
+*  Base class for file format parser
+*  ?other_description_lines
+*/
+class CParser : public CBase
+{
+	
+public: // Constants
+	
+	enum TErrorCode 
+	{
+		EInternalAssertionFailure   = -2200,
+			EParserNotEnoughData = -2201,
+			EParserEndOfStream = -2202,
+			EParserBufferTooSmall = -2203,
+			EParserUnsupportedFormat = -2204,
+			EParserStreamCorrupted = -2205,
+			EParserFailure = -2206
+	};
+
+	// file format
+	enum TFileFormat {
+		EFileFormatUnrecognized = 0,
+	    EFileFormat3GP,
+		EFileFormatMP4
+	};
+	
+	// video format
+	enum TVideoFormat {
+		EVideoFormatNone = 0,
+		EVideoFormatH263Profile0Level10,
+		EVideoFormatH263Profile0Level45,        
+        EVideoFormatMPEG4,
+        EVideoFormatAVCProfileBaseline,
+        EVideoFormatAVCProfileMain,
+        EVideoFormatAVCProfileExtended 
+	};
+	
+	// audio format
+	enum TAudioFormat 
+	{
+		EAudioFormatNone = 0,            
+		EAudioFormatAMR,
+		EAudioFormatAAC
+	};
+	
+#ifdef __VIDEOEDIT__
+		enum TProcessingMode
+		{
+			EParseOnly = 1,
+				EParseAndDecode,
+				EDecodeOnly
+		};
+#endif
+		
+public: // Data structures
+	
+	// common stream parameters
+	struct TStreamParameters 
+	{
+		TBool iHaveVideo;  // is there video in the stream ?
+		TBool iHaveAudio;  // is there audio in the stream ?
+		TUint iNumDemuxChannels;  // number of demux channels
+		TFileFormat iFileFormat;  // file format
+		TVideoFormat iVideoFormat;  // video format
+		TAudioFormat iAudioFormat;  // audio format 
+		
+		TUint iAudioFramesInSample; // audio frames per one sample (3GPP)
+    
+		TUint iVideoWidth;  // width of a video frame
+		TUint iVideoHeight;   // height of a video frame
+		TInt64 iVideoPicturePeriodNsec;  // one PCF tick period in nanoseconds
+		TUint iVideoIntraFrequency;  // intra frame frequency in stream
+		
+		TUint iStreamLength;  // stream length in milliseconds
+		TUint iVideoLength;
+		TUint iAudioLength;
+		
+		TBool iCanSeek;   // TRUE if seeking in file is possible
+		
+		TUint iStreamSize;  // stream size in bytes
+		TUint iStreamBitrate;  // stream average bitrate            
+		
+		TUint iMaxPacketSize; // The maximum media packet size
+		TUint iLogicalChannelNumberVideo; // Logical channel number for video data
+		TUint iLogicalChannelNumberAudio; // Logical channel number for audio data
+		TUint iReferencePicturesNeeded; // Number of reference pictures
+		// the video decoder needs to store.
+		TUint iNumScalabilityLayers; // The number of different scalability layers used
+		TUint iLayerFrameRates[8];  // Picture rate for each layer
+		
+		TReal iFrameRate;
+		TUint iVideoTimeScale; 
+		TUint iAudioTimeScale;
+		
+	};
+		
+	public: // New functions
+		
+        /**
+		* Write a block of data to parser.
+		* @param aBlock Block to be written.
+		*/
+		virtual TInt WriteDataBlock(const TDes8& aBlock) = 0;
+		
+		/**
+		* Parses the stream header.
+		* @param aStreamParameters Stream parameters        
+		*/	
+        
+        virtual TInt ParseHeaderL(TStreamParameters& aStreamParameters) = 0;
+				
+        /**
+        * Resets the parser to initial state.
+        * => If input stream is in a file, rewinds it.
+        * => If input is written to parser, all buffered bytes are flushed
+        * @param aStreamParameters Stream parameters        
+        */
+        virtual TInt Reset() = 0; 				        
+
+        /**
+        * Gets the number of frames in the current clip
+        *
+        * @return Number of frames
+        */
+        inline TInt GetNumberOfFramesInClip() { return iNumberOfFrames; }
+        
+        virtual	TInt GetNumberOfVideoFrames() = 0; 
+
+        virtual TInt GetNumberOfFrames() = 0;
+
+        /**
+        * Seeks to intra frame before given time
+        *
+        * @param aStartTime Time in microseconds to seek
+        * @param aIndex Index of the frame at aStartTime, if known. 0 otherwise
+        *
+        * @return Number of frames
+        */
+		virtual	TInt SeekOptimalIntraFrame(TTimeIntervalMicroSeconds aStartTime, TInt aIndex, TBool aFirstTime) = 0; 
+
+        /**
+        * Gets the size of video frame at given index
+        *
+        * @param aIndex Index of the frame
+        *
+        * @return Size of frame in bytes
+        */
+        virtual	TInt GetVideoFrameSize(TInt aIndex) = 0;
+
+        /**
+        * Gets the timestamp of video frame at given index
+        *
+        * @param aIndex Index of the frame
+        * @param aTimeStamp Output: timestamp in ticks
+        *
+        * @return Timestamp in milliseconds
+        */
+        virtual	TInt GetVideoFrameStartTime(TInt aIndex, TInt* aTimeStampInTicks) = 0;
+
+        /**
+        * Gets the type of video frame at given index
+        *
+        * @param aIndex Index of the frame
+        *
+        * @return Frame type: 1 = INTRA, 0 = INTER
+        */
+        virtual	TInt8 GetVideoFrameType(TInt aIndex) = 0;			        
+        
+        /**
+        * Gets the start frame index of the current clip                
+        *
+        * @return Frame index
+        */
+        inline TInt GetStartFrameIndex() { return iStartFrameIndex; }
+
+        /**
+        * From CParser Parser the stream header.
+        * @param aAudioFrameSize average frame size of audio frame	
+        */
+        virtual TInt ParseAudioInfo(TInt& aAudioFrameSize) = 0;
+
+		virtual TInt GetMP4SpecificSize() = 0;  //Added for Mpeg-4 Support 
+
+        virtual TInt GetAudioBitrate(TInt& aBitrate) = 0;
+
+        virtual TInt GetVideoFrameRate(TReal& aFrameRate) = 0;
+        
+        virtual TInt GetDecoderSpecificInfoSize() = 0;
+        
+        virtual TInt ReadAVCDecoderSpecificInfo(TDes8& aBuf) = 0;
+        
+        virtual TInt GetVideoDuration(TInt& aDurationInMs) = 0;
+
+
+    public:  // Data
+
+        // stream parameters
+        TStreamParameters iStreamParameters;
+        // ETrue if parsing this clip for the first time
+        TBool iFirstTimeClipParsing;
+         // number of frames in output clip
+        TInt iOutputNumberOfFrames; 
+
+    protected:  // Data
+
+        // current frame number
+        TInt iFrameNumber;  
+        // number of frames in current clip
+        TInt iNumberOfFrames; 
+        // index of the first included frame
+        TInt iStartFrameIndex;
+		
+    };
+		
+#endif      // __PARSER_H__   
+		
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/SizeEstimate.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for size estimate.
+*
+*/
+
+
+#ifndef     __SIZEESTIMATE_H__
+#define     __SIZEESTIMATE_H__
+
+#include <e32base.h>
+
+
+//  FORWARD DECLARATIONS
+class CMovieProcessorImpl;
+class CVedMovie;
+class CVedMovieImp;
+class CVedVideoClip;
+
+
+
+// CONSTANTS
+
+const TInt KSEFixedSize = 148;
+const TReal KSEBWReductionFactor = 0.04;
+const TInt KSELowBitrateLimit = 128000;
+const TInt KSELowBitrateIncrement = 4000;
+const TInt KSEHighBitrateLimit = 1024000;
+const TInt KSEBlackFrameDuration = 1000000;
+const TInt KSEMaxFrameDuration = 1001000;
+const TInt KSEFadeTransitionFrames = 10;
+const TInt KSEWipeTransitionFrames = 5;
+const TInt KSEGeneratedIFrameFactorMPEG4 = 180;
+const TInt KSEGeneratedPFrameFactorMPEG4 = 6;
+const TInt KSEGeneratedIFrameFactorH264 = 400;
+const TInt KSEGeneratedPFrameFactorH264 = 11;
+const TInt KSEGeneratedIFrameFactorH263 = 212;
+const TInt KSEGeneratedPFrameFactorH263 = 35;
+const TInt KSEBlackIFrameFactor = 25;
+const TInt KSEBlackPFrameFactor = 3;
+const TInt KSEVideo3gpSizePerFrame1 = 40;
+const TInt KSEVideo3gpSizePerFrame2 = 25;
+const TInt KSEVideo3gpSizePerFrame3 = 15;
+const TInt KSEVideo3gpSizePerFrame4 = 13;
+const TInt KSEVideo3gpSizePerFrame5 = 12;
+const TInt KSEVideo3gpSizePerFrame6 = 11;
+const TInt KSEVideo3gpFramesLimit1 = 50;
+const TInt KSEVideo3gpFramesLimit2 = 75;
+const TInt KSEVideo3gpFramesLimit3 = 100;
+const TInt KSEVideo3gpFramesLimit4 = 200;
+const TInt KSEVideo3gpFramesLimit5 = 300;
+const TReal KSEAudio3gpSizePerSample1 = 15.0;
+const TReal KSEAudio3gpSizePerSample2 = 11.2;
+const TReal KSEAudio3gpSizePerSample3 = 9.8;
+const TReal KSEAudio3gpSizePerSample4 = 9.2;
+const TReal KSEAudio3gpSizePerSample5 = 9.0;
+const TReal KSEAudio3gpSizePerSample6 = 8.8;
+const TReal KSEAudio3gpSizePerSample7 = 8.6;
+const TReal KSEAudio3gpSizePerSample8 = 8.4;
+const TReal KSEAudio3gpSamplesLimit1 = 200.0;
+const TReal KSEAudio3gpSamplesLimit2 = 300.0;
+const TReal KSEAudio3gpSamplesLimit3 = 400.0;
+const TReal KSEAudio3gpSamplesLimit4 = 500.0;
+const TReal KSEAudio3gpSamplesLimit5 = 800.0;
+const TReal KSEAudio3gpSamplesLimit6 = 1600.0;
+const TReal KSEAudio3gpSamplesLimit7 = 2000.0;
+
+
+
+//  CLASS DEFINITIONS
+class CSizeEstimate : public CBase
+{
+public:  // New functions
+	
+    /* Constructors. */
+	static CSizeEstimate* NewL(CMovieProcessorImpl* aProcessor);
+	static CSizeEstimate* NewLC(CMovieProcessorImpl* aProcessor);
+	
+	/* Destructor. */
+	virtual ~CSizeEstimate();
+
+    /**
+     * Calculate movie size estimate
+     *          
+     * @param aMovie            Movie object 
+     * @param aFileSize         Size estimate in bytes
+     * @return Error code
+     */
+    TInt GetMovieSizeEstimateL(const CVedMovie* aMovie, TInt& aFileSize);  
+
+    /**
+     * Calculate movie size estimate for MMS
+     *          
+     * @param aMovie			Movie object 
+     * @param aTargetSize		Maximum size allowed
+     * @param aStartTime		Time of the first frame included in the MMS output
+     * @param aEndTime			Time of the last frame included in the MMS output
+     * @return Error code
+     */
+    TInt GetMovieSizeEstimateForMMSL(const CVedMovie* aMovie, TInt aTargetSize, 
+		TTimeIntervalMicroSeconds aStartTime, TTimeIntervalMicroSeconds& aEndTime);
+
+	
+private: // Private methods
+
+    /**
+    * By default Symbian OS constructor is private.
+	*/
+    void ConstructL();
+
+    /**
+    * c++ default constructor
+	*/
+    CSizeEstimate(CMovieProcessorImpl* aProcessor);
+    
+    /**
+    * Returns the number of start and end transition frames in given clip
+    *
+    * @param aMovie             Movie object
+    * @param aIndex             Index of the clip in the movie
+    * @param aStartTransitionFrames (out)   Number of start transition frames
+    * @param aEndTransitionFrames (out      Number of end transition frames
+    */
+    void GetTransitionFrames(const CVedMovieImp *aMovie, TInt aIndex,
+        TInt& aStartTransitionFrames, TInt& aEndTransitionFrames);
+    
+    /**
+    * Estimates the average generated frame size
+    *
+    * @param aMovie             Movie object
+    * @param aIntra             ETrue if the frame is intra
+    * @return                   Generated frame size in bytes
+    */  
+    TInt GetGeneratedFrameSize(const CVedMovieImp *aMovie, TBool aIntra);
+    
+    /**
+    * Estimates the average black frame size
+    *
+    * @param aMovie             Movie object
+    * @param aIntra             ETrue if the frame is intra
+    * @return                   Black frame size in bytes
+    */
+    TInt GetBlackFrameSize(const CVedMovieImp *aMovie, TBool aIntra);
+    
+    /**
+     * Returns the 3gp size for video based on number of video frames
+     *
+     * @param aNumberOfVideoFrames  The amount of frames in the video
+     * @return                      3gp size per frame for video
+     */
+    TInt GetVideo3gpSizePerFrame(TInt aNumberOfVideoFrames);
+    
+    /**
+     * Returns the 3gp size for audio based on number of audio samples
+     *
+     * @param aNumberOfAudioSamples The amount of samples in the audio
+     * @return                      3gp size per sample for audio
+     */                    
+    TReal GetAudio3gpSizePerSample(TReal aNumberOfAudioSamples);
+
+private:  // Data
+    
+    // handle to the processor instance
+    CMovieProcessorImpl* iProcessor;
+		
+};
+
+
+#endif      //  __SIZEESTIMATE_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/VedRgb2YuvConverter.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef VIDEOEDITORTESTIMAGECONVERTER_H
+#define VIDEOEDITORTESTIMAGECONVERTER_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <gdi.h>
+
+// CLASS FORWARDS
+class CFbsBitmap;
+
+// TYPEDEFS
+typedef TRgb ( *TVSColorReadFunc ) ( TAny*& );
+
+/**
+*  ?one_line_short_description.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class CVSFbsBitmapYUV420Converter : public CBase
+	{
+	public:
+		/**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+		static CVSFbsBitmapYUV420Converter* NewL( const CFbsBitmap& aBitmap );
+
+		/**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+		~CVSFbsBitmapYUV420Converter();
+
+		/**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+		void SetSourceL( const CFbsBitmap& aBitmap );
+
+		/**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+		void ProcessL();
+
+		/**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+		TPtrC8 YUVData() const;
+
+	private: // internal
+		/**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+		void ConstructL( const CFbsBitmap& aBitmap );
+
+		/**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+		void ReConstructL( const CFbsBitmap& aBitmap );
+
+		/**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+		void DoProcess( TVSColorReadFunc aReadFunction );
+
+	private:
+		// ?one_line_short_description_of_data
+		TSize iSize;
+
+		// ?one_line_short_description_of_data
+		CFbsBitmap* iSource; // owned, duplicate
+
+		// ?one_line_short_description_of_data
+		HBufC8* iYUVData; // owned
+
+		// ?one_line_short_description_of_data
+		TPtrC8 iY;
+
+		// ?one_line_short_description_of_data
+		TPtrC8 iU;
+		
+		// ?one_line_short_description_of_data
+		TPtrC8 iV;
+	};
+
+#endif      // CVTIMAGECONVERTER_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/VideoEncoder.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,401 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for video encoder class.
+*
+*/
+
+
+#ifndef VIDEOENCODER_H
+#define VIDEOENCODER_H
+
+// INCLUDES
+
+#include <CCMRMediaSink.h>
+#include "CTRTranscoderObserver.h"
+#include "CTRTranscoder.h"
+#include "CTRCommon.h"
+#include "CTRVideoPictureSink.h"
+#include "Vedcommon.h"
+
+// FORWARD DECLARATIONS
+
+class CStatusMonitor;
+class CVedVolReader;
+class CVedAVCEdit;
+
+class CVideoEncoder : public CActive, public MTRTranscoderObserver, 
+                      public MCMRMediaSink, public MTRVideoPictureSink
+    {
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+		static CVideoEncoder* NewL(CStatusMonitor *aMonitor, CVedAVCEdit* aAvcEdit, 
+		                           const TPtrC8& aVideoMimeType);
+        
+        /**
+        * Destructor.
+        */
+        
+        ~CVideoEncoder();               
+
+    public:   // Constants        
+        
+        enum TErrorCode
+            {
+            EInternalAssertionFailure = -10030,
+            };
+            
+    public: // Functions from base classes
+
+        /**
+        * From CActive Active object running method
+        */
+        void RunL();
+        
+        /**
+        * From CActive Active object error method
+        */
+        TInt RunError(TInt aError);
+        
+        /**
+        * From CActive Active object cancelling method
+        */
+        void DoCancel();  
+
+        /**
+        * From MTRTranscoderObserver
+        */
+        void MtroInitializeComplete(TInt aError);
+        
+        /**
+        * From MTRTranscoderObserver
+        */
+        void MtroFatalError(TInt aError);
+        
+        /**
+        * From MTRTranscoderObserver
+        */
+        void MtroReturnCodedBuffer(CCMRMediaBuffer* aBuffer);
+        
+        /**
+        * From MTRTranscoderObserver
+        */
+        void MtroSetInputFrameRate(TReal& aRate);
+        
+        /**
+        * From MTRTranscoderObserver
+        */
+        void MtroAsyncStopComplete();
+        
+        /**
+        * From MTRTranscoderObserver
+        */
+        inline void MtroSuspend() { };
+        
+        /**
+        * From MTRTranscoderObserver
+        */
+        inline void MtroResume() { };
+        
+        /**	
+        * From MCMRMediaSink
+        */        
+        void WriteBufferL(CCMRMediaBuffer* aBuffer);
+        
+        /**	
+        * From MCMRMediaSink
+        */  
+        TInt SetVideoFrameSize(TSize aSize);
+        
+        /**	
+        * From MCMRMediaSink
+        */  
+        TInt SetAverageVideoBitRate(TInt aBitRate);
+        
+        /**	
+        * From MCMRMediaSink
+        */  
+        TInt SetMaxVideoBitRate(TInt aBitRate);
+        
+        /**	
+        * From MCMRMediaSink
+        */  
+        TInt SetAverageAudioBitRate(TInt aBitRate);
+        
+        /**	
+        * From MTRVideoPictureSink
+        */  
+        void MtroPictureFromTranscoder(TTRVideoPicture* aPicture);
+
+    public:  // New functions
+
+        /**
+        * Sets the used frame size
+        * 
+        * @param aSize Frame size 
+        * @return Error codew
+        */
+        void SetFrameSizeL(const TSize& aSize);
+
+        /**
+        * Gets the current frame size
+        * 
+        * @param aSize Frame size 
+        * @return void
+        */
+        void FrameSize(TSize& aSize) const;
+
+        /**
+        * Sets the target frame rate
+        * 
+        * @param aFrameRate frame rate
+        * @return Error code
+        */
+        TInt SetFrameRate(const TReal aFrameRate);
+        
+        /**
+        * Sets the frame rate of input sequence
+        * 
+        * @param aFrameRate frame rate
+        * @return Error code
+        */
+        TInt SetInputFrameRate(const TReal aFrameRate);
+        
+        /**
+        * Sets the target random access rate
+        * 
+        * @param aRate random access rate
+        * @return Error code
+        */
+        TInt SetRandomAccessRate(const TReal aRate);
+
+        /**
+        * Sets the target bitrate
+        * 
+        * @param aBitrate Bitrate 
+        * @return Error code
+        */
+        TInt SetBitrate(const TInt aBitrate);
+        
+        /**
+        * Initializes the encoder
+        * 
+        * @param aStatus Status object for active object
+        * @return void
+        */        
+        void InitializeL(TRequestStatus &aStatus);
+               
+        /**
+        * Encodes a frame
+        * 
+        * @param aYUVFrame Frame to be encoded
+        * @param aStatus Status object for active object
+        * @param Timestamp of the frame
+        * @return void
+        */        
+        void EncodeFrameL(TPtr8 &aYUVFrame, TRequestStatus &aStatus, TTimeIntervalMicroSeconds aTimeStamp);
+        
+        /**
+        * Gets the encoded bitstream
+        *         
+        * @param aKeyFrame Keyframe flag, True if the frame is Intra
+        * @return Descriptor containing the output bitstream
+        */   
+        TPtrC8& GetBufferL(TBool& aKeyFrame);
+
+        /**
+        * Return used bitstream buffer
+        *         
+        * @return void
+        */         
+        void ReturnBuffer();        
+
+        /**
+        * Starts the encoder
+        *         
+        * @return void
+        */ 
+        void Start();
+
+        /**
+        * Stops the encoder
+        *         
+        * @return void
+        */ 
+        void Stop();
+
+        /**
+        * Resets the encoder
+        *         
+        * @param aStatus Status object for active object
+        * @return void
+        */ 
+        void Reset(TRequestStatus &aStatus);
+        
+        /**
+        * Resets the encoder synchronously
+        *        
+        * @return void
+        */ 
+        void Reset();
+
+		/**
+        * Gets status of whether encoding has been started
+        *                 
+        * @return ETrue if encoding has been started
+        */ 
+		inline TBool BeenStarted() const { return iStarted; }
+
+		/**
+        * Gets status of whether encoding request is pending
+        *                 
+        * @return ETrue if encode is pending
+        */ 
+		inline TBool IsEncodePending() const { return iEncodePending; }
+
+        /**
+        * Gets time increment resolution used in MPEG-4 
+        *                 
+        * @return Time increment resolution
+        */ 
+        TInt GetTimeIncrementResolution() const;
+        
+        /**
+        * Forces the next encoded frame to be Intra
+        *
+        */ 
+        void SetRandomAccessPoint();
+            
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVideoEncoder();
+
+        /**
+        * By default EPOC constructor is private.
+        */
+		void ConstructL(CStatusMonitor *aMonitor, CVedAVCEdit* aAvcEdit, 
+		                const TPtrC8& aVideoMimeType);
+
+        /**
+        * Interpret and store video codec MIME-type, used by ConstructL
+        * @return void
+        */
+        void SetVideoCodecL(const TPtrC8& aMimeType);
+        
+        /**
+        * Set encoding options
+        * @return void
+        */
+        void SetupEncoderL();
+        
+        /**
+        * Parses and writes codec specific information, i.e
+        * MPEG-4 VOL header and AVC decoder configuration record
+        * @return void
+        */
+        void HandleCodingStandardSpecificInfoL();
+
+    private:    // Data
+    
+        // Transcoder
+        CTRTranscoder* iTranscoder;
+
+		// is encode pending ?
+		TBool iEncodePending;
+
+		// has encoding been started ?
+		TBool iStarted;
+
+        // used & max frame size, and info if size can be arbitrary
+        TSize iFrameSize;
+        TSize iMaxResolution;
+        TBool iArbitrarySizeAllowed;
+
+        // target and max allowed frame rate
+        TReal32 iFrameRate;        
+        TReal32 iMaxFrameRate;
+        
+        // input frame rate
+        TReal32 iInputFrameRate;
+        
+        // target random access rate
+        TReal iRandomAccessRate;
+
+		// target and max allowed bit rate
+		TInt iBitRate;
+		TInt iMaxBitRate;
+
+        // Mime type for encoded data
+        TBuf8<256> iMimeType;        
+
+        // input picture         
+        TTRVideoPicture* iInputPicture;     
+        
+        // bitstream buffer
+        HBufC8* iDataBuffer;
+        
+        // keyframe flag for bitstream buffer
+        TBool iKeyFrame;
+        
+        TPtrC8 iReturnDes;
+
+        // External status info
+        TRequestStatus *iResetRequestStatus;
+
+		TRequestStatus *iEncodeRequestStatus;
+
+        TTimeIntervalMicroSeconds iPreviousTimeStamp;
+
+        // MPEG-4 time increment resolution
+        TInt iTimeIncrementResolution;        
+
+        // input YUV data
+        TPtr8 iInputBuffer;
+
+        // status monitor object
+        CStatusMonitor *iMonitor;
+        
+        // video object layer reader
+        CVedVolReader *iVolReader;
+
+        RTimer iTimer; // timer object
+        TBool iTimerCreated;
+        TBool iTimerRequestPending;
+        
+        // Timer timeout, depends on codec and resolution
+        TUint iMaxEncodingDelay;
+
+        // flag to check if devvideorec methods can be called or not; they can't be called after a fatal error 
+        TBool iFatalError;
+
+#ifdef _DEBUG
+        TTime iEncodeStartTime;
+#endif
+        
+        // AVC editing module
+        CVedAVCEdit* iAvcEdit;
+        
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/VideoProcessorAudioData.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+/* Copyright (c) 2003, Nokia. All rights reserved. */
+
+#ifndef __VIDEOPROCESSORAUDIODATA_H__
+#define __VIDEOPROCESSORAUDIODATA_H__
+
+
+#include <e32base.h>
+
+
+enum TVideoProcessorAudioType
+	{
+	EVideoProcessorAudioTypeSilence,
+	EVideoProcessorAudioTypeOriginal,
+	EVideoProcessorAudioTypeExternal
+	};
+
+
+class TVideoProcessorAudioData
+	{
+public:
+	TTimeIntervalMicroSeconds iStartTime;
+	TVideoProcessorAudioType iType;
+	CVedAudioClip* iClip;	
+	};
+
+
+#endif // __VIDEOPROCESSORAUDIODATA_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/Yuv2rgb16.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* YUV to EColor64K colorspace converter concrete classes. 
+*
+*/
+
+
+#ifndef     __YUV2RGB16_H__
+#define     __YUV2RGB16_H__
+
+//  INCLUDES
+
+#ifndef __YUVCONVERTER_H__
+#include "yuvconverter.h"
+#endif
+
+//  CLASS DEFINITIONS
+
+class CYuv2Rgb16 : public CYuvConverter
+{
+public: // CYuvConverter methods
+    // Constructors & destructor
+    CYuv2Rgb16();
+    ~CYuv2Rgb16();
+    void ConstructL(TUint aWidth, TUint aHeight, TUint aMaxWidth, TUint aMaxHeight);
+    
+    void Convert(const TUint8 *aYBuf, const TUint8 *aUBuf,
+                 const TUint8 *aVBuf,
+                 TUint aBufWidth, TUint aBufHeight,
+                 TUint8 *aTarget, TUint aTargetScanlineLength);
+
+    void SetGamma(TInt /*aGamma*/) {};
+
+protected: // Data
+    
+    TUint iWidth, iHeight;
+    
+};
+
+
+// The fixed point constants for YUV -> RGB conversion
+const TInt KYMult = 296;
+const TInt KCrToR = 408;
+const TInt KCbToG =  96;
+const TInt KCrToG = 204;
+const TInt KCbToB = 520;
+
+// -----------------------------------------------------------------------------
+// UvToRDiff
+// Calculate the red color difference from Cr by using fixed point values.
+// -----------------------------------------------------------------------------
+//
+inline TInt UvToRDiff(
+    TInt aCr,
+    TInt /*aCb*/)
+    {
+    return (KCrToR * aCr) / 256;
+    }
+
+// -----------------------------------------------------------------------------
+// UvToGDiff
+// Calculate the green color difference from Cr and Cb components
+// by using fixed point values.
+// -----------------------------------------------------------------------------
+//
+inline TInt UvToGDiff(
+    TInt aCr,
+    TInt aCb)
+    {
+    return (KCbToG * aCb + KCrToG * aCr) / 256;
+    }
+
+// -----------------------------------------------------------------------------
+// UvToBDiff
+// Calculate the blue color difference from Cb by using fixed point values.
+// -----------------------------------------------------------------------------
+//
+inline TInt UvToBDiff(
+    TInt /*aCr*/,
+    TInt aCb)
+    {
+    return (KCbToB * aCb) / 256;
+    }
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/activequeue.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+* Data buffering and queuing support definitions, class CActiveQueue.
+*
+*/
+
+
+#ifndef     __ACTIVEQUEUE_H__
+#define     __ACTIVEQUEUE_H__
+
+
+//  INCLUDES
+
+#ifndef __E32BASE_H__
+#include <e32base.h>
+#endif
+
+
+//  FORWARD DECLARATIONS
+
+class CDataProcessor;
+class CActiveQueue;
+
+
+//#define BLOCK_GUARD_AREA
+
+
+//  CLASS DEFINITIONS
+
+// Queue block class
+class TActiveQueueBlock : public TPtr8
+{
+    TActiveQueueBlock(TUint8 *aBuf, TInt aMaxLength) : TPtr8(aBuf, aMaxLength) {};
+protected:
+    friend class CActiveQueue;
+    TActiveQueueBlock *iNextBlock; // next block in the allocated block list
+    TActiveQueueBlock *iPrevBlock; // prev. block in the allocated block list
+    TActiveQueueBlock *iNextList; // next block in the data queue / free list
+};
+
+// The queue class
+class CActiveQueue : public CBase
+{
+public: // constants
+    enum TErrorCode
+    {
+        EInternalAssertionFailure = -1000,
+        ENoWriter = -1001, 
+        ENoReader = -1002,
+        EWriteAfterStreamEnd = -1003
+    };
+
+public: // interface functions
+    // Constructors and destructor
+    CActiveQueue(TUint aNumberOfBlocks, TUint aBlockLength);
+    ~CActiveQueue();
+    void ConstructL();
+
+    // Set/remove reader
+    void SetReader(CDataProcessor *aReader, TAny *aUserPointer);
+    void RemoveReader();
+
+    // Set/remove writer
+    void SetWriter(CDataProcessor *aWriter, TAny *aUserPointer);
+    void RemoveWriter();
+
+    void ResetStreamEnd();
+    
+    // Get the number of free blocks available for new data
+    TUint NumFreeBlocks();
+
+    // Get the number of blocks with data queued
+    TUint NumDataBlocks();
+
+    // Get a free block for writing data into the queue (writer)
+    TPtr8 *GetFreeBlockL(TUint aBlockLength);
+
+    // Add a data block to the queue (writer)
+    void WriteBlock(TPtr8 *aBlock);
+
+    // Read a data block from the queue (reader)
+    TPtr8 *ReadBlock();
+
+    // Return a read block back to the empty block list (reader)
+    void ReturnBlock(TPtr8 *aBlock);
+
+    // Notify that the stream has ended (writer)
+    void WriteStreamEnd();
+
+    // Check if the writer has notified that the stream has ended (reader)
+    TBool StreamEnded();
+
+    // Testing aid: get total number of blocks
+    TUint NumBlocks() { return iNumBlocks; };
+
+
+private: // Internal methods
+    TActiveQueueBlock *AllocateBlockL();
+    void FreeBlockL(TActiveQueueBlock *aBlock);
+    
+private: // Data
+    TUint iNewBlockLength; // length of new blocks that are allocated
+    TUint iInitialBlocks; // initial number of blocks to allocate
+    
+    CDataProcessor *iReader; // the reader
+    TAny *iReaderUserPointer;
+    CDataProcessor *iWriter; // the writer
+    TAny *iWriterUserPointer;
+
+    TActiveQueueBlock *iBlocks; // the list of all allocated blocks
+    TUint iNumBlocks; // total number of blocks
+    TActiveQueueBlock *iFreeList; // the free block list
+    TUint iNumFreeBlocks; // number of free blocks
+    TActiveQueueBlock *iDataQueueHead; // the data queue head (where blocks are
+                                       // read from)
+    TActiveQueueBlock *iDataQueueTail; // the data queue tail (where blocks are
+                                       // written to
+    TUint iNumDataBlocks; // number of data blocks
+
+    TBool iStreamEnd; // has the stream ended?
+};
+
+
+#endif      //  __ACTIVEQUEUE_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/audioprocessor.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Audio processor class.
+*
+*/
+
+
+#ifndef __AUDIOPROCESSOR_H__
+#define __AUDIOPROCESSOR_H__
+
+#ifndef __E32BASE_H__
+#include <e32base.h>
+#endif
+
+class CMovieProcessorImpl;
+class CAudSong;
+
+/**
+ * Audio processor.
+ */
+class CAudioProcessor : public CActive
+	{
+public:  // Constructors and destructor
+
+    /**
+    * Two-phased constructor
+    */
+
+    static CAudioProcessor* NewL(CMovieProcessorImpl *aMovieProcessor, CAudSong* aSong);
+    static CAudioProcessor* NewLC(CMovieProcessorImpl *aMovieProcessor, CAudSong* aSong);       
+
+    /**
+    * Destructor.
+    */
+
+    virtual ~CAudioProcessor();
+	
+public:  // Functions from base classes
+
+    /**
+    * From CActive Active object cancelling method
+    */
+    void DoCancel();
+
+    /**
+    * From CActive Active object running method
+    */
+    void RunL();
+
+    /**
+    * From CActive Active object error method
+    */
+    TInt RunError(TInt aError);
+
+public:  // New functions
+
+    /**
+    * Starts audio processing    
+    */      
+    void StartL();
+
+    /**
+    * Stops audio processing    
+    */          
+    void StopL();    
+    
+private:
+
+    /**
+    * Constructor
+    */
+    CAudioProcessor(CMovieProcessorImpl *aMovieProcessor, CAudSong* aSong);
+
+    /**
+    * By default EPOC constructor is private.
+    */
+    void ConstructL();
+    
+    /**
+    * Process a number of audio frames
+    */
+    void ProcessFramesL();
+    
+private:  // Data
+
+    // movie processor instance
+    CMovieProcessorImpl* iMovieProcessor; 
+
+    // song
+    CAudSong* iSong;
+        
+    TBool iProcessing;
+
+    };
+    
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/brightnesscontrast.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Const parameters for brightness/constrast enhancement
+* The tuning has 9 steps, each represented by 3 parameters.
+* The smaller indices in the table generate "lighter" pictures.
+*
+*/
+
+
+#ifndef     __BRIGHTNESSCONTRAST_H__
+#define     __BRIGHTNESSCONTRAST_H__
+
+
+const TInt KMinBrightnessContrastIndex = 0;
+const TInt KMedBrightnessContrastIndex = 10;
+const TInt KMaxBrightnessContrastIndex = 20;
+
+const TInt KMaxBCInputIndex = 100;
+
+struct SEnhParam {
+    TReal   a;
+    TReal   b;
+    TReal   g;
+};
+
+const struct SEnhParam KBrightnessContrastEnhParam[21] = {   
+   {2.35, -0.1215, 0.5},
+   {2.17, -0.0936, 0.55},
+   {2, -0.07, 0.6},
+   {1.84, -0.0504, 0.65},
+   {1.69, -0.0345, 0.7},
+   {1.55, -0.022, 0.75},
+   {1.42, -0.0126, 0.8},
+   {1.3, -0.006, 0.85},
+   {1.19, -0.0019, 0.9},
+   {1.09, 0, 0.95},
+   {1, 0, 1},
+   {1.04, -0.04, 1.05},
+   {1.09, -0.0891, 1.1},
+   {1.15, -0.147, 1.15},
+   {1.22, -0.2134, 1.2},
+   {1.3, -0.288, 1.25},
+   {1.39, -0.3705, 1.3},
+   {1.49, -0.4606, 1.35},
+   {1.6, -0.558, 1.4},
+   {1.72, -0.6624, 1.45},
+   {1.85, -0.7735, 1.5}
+};
+
+#endif      //  __BRIGHTNESSCONTRAST_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/dataprocessor.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Definition for CDataProcessor, the data processing object abstract
+* base class.
+*
+*/
+
+
+
+#ifndef     __DATAPROCESSOR_H__
+#define     __DATAPROCESSOR_H__
+
+
+//  INCLUDES
+
+#ifndef __E32BASE_H__
+#include <e32base.h>
+#endif
+
+
+//  FORWARD DECLARATIONS
+
+//class MVideoPlayerObserver;
+
+
+//  CLASS DEFINITIONS
+
+class CDataProcessor : public CActive
+{
+public: // constants
+    enum TErrorCode
+    {
+        EInternalAssertionFailure = -1100
+    };
+
+public: // new functions
+    // Constructors
+    CDataProcessor(TInt aPriority=EPriorityStandard);
+    void ConstructL();
+
+    // Destructor
+    virtual ~CDataProcessor();
+
+    // Called by CActiveQueue when input data is available
+    virtual void InputDataAvailable(TAny *aUserPointer);
+
+    // Called by CActiveQueue when output space is available
+    virtual void OutputSpaceAvailable(TAny *aUserPointer);
+
+    // Called by CActiveQeueue after all data has been read from a queue where
+    // stream end has been signaled
+    virtual void StreamEndReached(TAny *aUserPointer);
+
+    // Standard active object RunL() method, overridden by derived class
+    virtual void RunL() = 0;
+
+    // Cancels the internal request
+    virtual void DoCancel();
+};
+
+
+
+#endif      //  __DATAPROCESSOR_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/decoder.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Definition for CDecoder, an abstract base class for all decoders.
+*
+*/
+
+
+
+
+#ifndef     __DECODER_H__
+#define     __DECODER_H__
+
+
+//  INCLUDES
+
+#ifndef __DATAPROCESSOR_H__
+#include "dataprocessor.h"
+#endif
+
+
+//  CLASS DEFINITIONS
+
+// Decoder base class
+class CDecoder : public CDataProcessor
+{
+public:
+    CDecoder(TInt aPriority=EPriorityStandard) : CDataProcessor(aPriority) {};
+    // CDataProcessor provides a virtual destructor
+
+    // Start/stop decoding
+    virtual void Start() = 0;
+    virtual void Stop() = 0;
+};
+
+
+#endif      //  __DECODER_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/demultiplexer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Definition for CDemultiplexer, an abstract base class for all
+* demultiplexers.
+*
+*/
+
+
+#ifndef     __DEMULTIPLEXER_H__
+#define     __DEMULTIPLEXER_H__
+
+
+//  INCLUDES
+
+#ifndef __DATAPROCESSOR_H__
+#include "dataprocessor.h"
+#endif
+
+
+//  CLASS DEFINITIONS
+
+// Demultiplexer base class
+class CDemultiplexer : public CDataProcessor
+{
+public:
+    CDemultiplexer(TInt aPriority=EPriorityStandard) : CDataProcessor(aPriority) {};
+    // CDataProcessor provides a virtual destructor
+
+    // Start/stop demuxing
+    virtual void Start() = 0;
+    virtual void Stop() = 0;
+};
+
+
+#endif      //  __DEMULTIPLEXER_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/epoclib.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for epoclib.cpp.
+*
+*/
+
+
+#ifndef _EPOC_LIB
+#define _EPOC_LIB
+
+#include <e32base.h>
+#include <s32file.h>
+#include "nrctyp32.h"
+
+#ifdef _DEBUG
+#define MALLOC_DEBUG
+#endif
+
+#define EPOCLIB_DS
+
+//#define FILE RFile
+#define void TAny
+
+//specific to this program
+//#define HANDLE void *
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int	size_t;
+#endif //_SIZE_T_DEFINED
+
+#define max(a,b)            (((a) > (b)) ? (a) : (b))
+#define min(a,b)            (((a) < (b)) ? (a) : (b))
+
+#define abs     Abs
+#define labs    Abs
+
+
+EPOCLIB_DS void free(TAny *ptr);
+
+#ifdef MALLOC_DEBUG
+#define malloc(size) debugMalloc(size, __FILE__, __LINE__)
+EPOCLIB_DS TAny *debugMalloc(u_int32 size, char *file, int line);
+#else
+EPOCLIB_DS TAny *malloc(u_int32 size);
+#endif
+EPOCLIB_DS TAny *realloc(void *memblock, u_int32 size);
+#ifdef MALLOC_DEBUG
+#define calloc(num, size) debugCalloc(num, size, __FILE__, __LINE__)
+EPOCLIB_DS TAny *debugCalloc(u_int32 num, u_int32 size, char *file, int line);
+#else
+EPOCLIB_DS TAny *calloc(u_int32 num, u_int32 size);
+#endif
+EPOCLIB_DS TAny *memset(TAny *dest, TInt c, u_int32 size); 
+EPOCLIB_DS TAny *memcpy(TAny *dest, const TAny *src, u_int32 size);
+EPOCLIB_DS TAny *memmove(TAny *dest, const TAny *src, u_int32 count);
+
+#define assert(expr) __ASSERT_DEBUG(expr, User::Panic(_L("assert"), 1));
+EPOCLIB_DS int atoi(const char *nptr);
+
+
+EPOCLIB_DS u_int32 fwrite(const TAny *buffer, u_int32 size, u_int32 count, RFile stream);
+
+#endif
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/gettime.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for gettime.cpp.
+*
+*/
+
+#ifndef _GETTIME_H_
+#define _GETTIME_H_
+
+
+/*
+ * Includes
+ */
+
+#include "nrctyp32.h"
+#include "thdwrap.h"
+
+
+/*
+ * Definitions
+ */
+
+/* Number of output ticks (from gtGetTime) per second */
+#ifndef GT_NUM_OUT_TICKS_PER_SEC
+   #define GT_NUM_OUT_TICKS_PER_SEC 10000
+#endif
+
+/* Maximum value returned by gtGetTime */
+#define GT_TIME_MAX 0xffffffff
+
+/* If TMR_DS not defined, define it as nothing */
+#ifndef TMR_DS
+#ifdef __PSISOFT32__
+    #define TMR_DS
+#else
+   #define TMR_DS
+#endif
+#endif
+
+/*
+ * Function prototypes
+ */
+
+
+TMR_DS void gtInitialize( void );
+
+//TMR_DS TInt gtGetTime( array_t *array );
+TMR_DS unsigned int gtGetTime( void );
+
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/movieprocessor.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,248 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Movie processor interface class.
+*
+*/
+
+
+
+#ifndef __MOVIEPROCESSOR_H__
+#define __MOVIEPROCESSOR_H__
+
+
+#include <e32base.h>
+#include <e32std.h>
+#include <gdi.h>
+
+#include "VedCommon.h"
+
+/*
+ * Forward declarations.
+ */
+
+class CVedMovie;
+class CVedMovieImp;
+class CVedAudioClip;
+class TVedVideoFrameInfo;
+class TVideoProcessorAudioData;
+class CMovieProcessorImpl;
+
+class MVedMovieProcessingObserver;
+
+/**
+ * Movie processor.
+ */
+class CMovieProcessor : public CBase
+	{
+public:
+
+	/** 
+	 * Constructors for instantiating new movie processors.
+	 * Should reserve as little resources as possible at this point.
+	 */
+	static CMovieProcessor* NewL();
+	static CMovieProcessor* NewLC();
+
+	/** 
+	 * Destructor can be called at any time (i.e., also in the middle of a processing operation).
+	 * Should release all allocated resources, including releasing all allocated memory and 
+	 * *deleting* all output files that are currently being processed but not yet completed.
+	 */
+	virtual ~CMovieProcessor();
+
+    /**
+	 * Read the header from the specified video clip file and return its properties.
+	 * The file should be opened with EFileShareReadersOnly share mode.
+	 *
+	 * Possible leave codes:
+	 *	- <code>KErrNoMemory</code> if memory allocation fails
+	 *	- <code>KErrNotFound</code> if there is no file with the specified name
+	 *    in the specified directory (but the directory exists)
+	 *	- <code>KErrPathNotFound</code> if the specified directory
+	 *    does not exist
+	 *	- <code>KErrUnknown</code> if the specified file is of unknown format
+	 *
+	 * @param aFileName             name of the file to read
+	 * @aFileHandle                 handle of the file to read
+	 * @param aVideoFormat          for returning the video format
+	 * @param aVideoType            for returning the video type
+	 * @param aResolution           for returning the resolution
+	 * @param aAudioType            for returning the audio type
+	 * @param aDuration             for returning the duration
+	 * @param aVideoFrameCount      for returning the number of video frames
+	 * @param aSamplingRate			for returning the sampling rate
+	 * @param aChannelMode			for returning the channel mode	 
+	 */
+	void GetVideoClipPropertiesL(const TDesC& aFileName,
+	                             RFile* aFileHandle,
+		                         TVedVideoFormat& aFormat,
+								 TVedVideoType& aVideoType, 
+								 TSize& aResolution,
+								 TVedAudioType& aAudioType, 
+								 TTimeIntervalMicroSeconds& aDuration,
+								 TInt& aVideoFrameCount,
+								 TInt& aSamplingRate, 
+								 TVedAudioChannelMode& aChannelMode);
+	
+    /**
+	 * Read video frame information from the specified video clip file and fills array of info for 
+     * all frames in video.The file should be opened with EFileShareReadersOnly share mode. Video processor 
+	 * should not free the video frame info array after it has passed it on as a return value 
+	 * of this function. Returned array should be allocated with User::AllocL() and should be 
+	 * freed by the caller of this method with User::Free(). 
+	 *
+	 * Possible leave codes:
+	 *	- <code>KErrNoMemory</code> if memory allocation fails
+	 *	- <code>KErrNotFound</code> if there is no file with the specified name
+	 *    in the specified directory (but the directory exists)
+	 *	- <code>KErrPathNotFound</code> if the specified directory
+	 *    does not exist
+	 *	- <code>KErrUnknown</code> if the specified file is of unknown format
+	 *
+	 * @param aFileName             name of the file to read
+	 * @param aFileHandle            handle of the file to read
+	 * @param aVideoFrameInfoArray  Array for video frame parameters
+	 */
+    void GenerateVideoFrameInfoArrayL(const TDesC& aFileName, RFile* aFileHandle, TVedVideoFrameInfo*& aVideoFrameInfoArray);
+
+    /**
+	 * Returns an estimate of the total size of the specified movie.
+     * 
+	 * @return  size estimate in bytes
+	 */
+    TInt GetMovieSizeEstimateL(const CVedMovie* aMovie);
+
+	/**
+     * Calculate movie size estimate for MMS
+     *          
+     * @param aMovie			Movie object 
+     * @param aTargetSize		Maximum size allowed
+     * @param aStartTime		Time of the first frame included in the MMS output
+     * @param aEndTime			Time of the last frame included in the MMS output
+     * @return Error code
+     */
+    TInt GetMovieSizeEstimateForMMSL(const CVedMovie* aMovie, TInt aTargetSize, 
+		TTimeIntervalMicroSeconds aStartTime, TTimeIntervalMicroSeconds& aEndTime);
+
+	/**
+	 * Do all initializations necessary to start generating a thumbnail, e.g. open files, 
+	 * allocate memory. The video clip file should be opened with EFileShareReadersOnly 
+	 * share mode. The thumbnail should be scaled to the specified resolution and 
+	 * converted to the specified display mode. If this method leaves, destructor should be called to free 
+	 * allocated resources.
+	 * 
+	 * Possible leave codes:
+	 *	- <code>KErrNoMemory</code> if memory allocation fails
+	 *	- <code>KErrNotFound</code> if there is no file with the specified name
+	 *    in the specified directory (but the directory exists)
+	 *	- <code>KErrPathNotFound</code> if the specified directory
+	 *    does not exist
+	 *	- <code>KErrUnknown</code> if the specified file is of unknown format
+	 *  - <code>KErrNotSupported</code> if the specified combination of parameters
+	 *                                  is not supported
+	 *
+	 * @param aFileName  name of the file to generate thumbnail from
+	 * @param aFileHandle handle of the file to generate thumbnail from
+   * @param aIndex       Frame index for selecting the thumbnail frame
+   *                     -1 means the best thumbnail is retrieved
+ 	 * @param aResolution  resolution of the desired thumbnail bitmap, or
+	 *                     <code>NULL</code> if the thumbnail should be
+	 *                     in the original resolution
+	 * @param aDisplayMode desired display mode; or <code>ENone</code> if 
+	 *                     any display mode is acceptable
+	 * @param aEnhance	   apply image enhancement algorithms to improve
+	 *                     thumbnail quality; note that this may considerably
+	 *                     increase the processing time needed to prepare
+	 *                     the thumbnail
+	 */
+	void StartThumbL(const TDesC& aFileName, RFile* aFileHandle, TInt aIndex, TSize aResolution, 
+		TDisplayMode aDisplayMode, TBool aEnhance);	
+	
+     /**
+	 * Starts thumbnail generation. Thumbnail generation is an asynchronous operation,
+	 * and its completion is informed to the caller via Active object request completion;
+	 * the iStatus member of the caller is passed as a parameter to this method.
+	 *
+	 * This method may leave if an error occurs in initiating the thumbnail generation.	
+	 * If this method leaves, destructor should be called to free allocated resources.	
+	 * 
+	 * @param aStatus     Reference to caller's iStatus member variable
+	 * @param aFactor     Pointer to a TVedTranscodeFactor structure, which is updated by this method
+	 *
+	 * @return  
+	 *          
+	 */
+	void ProcessThumbL(TRequestStatus &aStatus, TVedTranscodeFactor* aFactor);
+	
+	/** 
+	 * Method for retrieving the completed thumbnail bitmap.
+	 * 
+	 * Video processor should not free the CFbsBitmap instance after it has passed it on 
+	 * as a return value of this function 
+	 *	 
+	 */
+	void FetchThumb(CFbsBitmap*& aThumb);
+
+	/**
+	 * Do all initializations necessary to start processing a movie, e.g. open files and
+	 * allocate memory. After initialization, processing is started and the observer
+     * is notified. The source video and audio files should be opened with 
+	 * EFileShareReadersOnly share mode. If this method leaves, destructor should be called 
+	 * to free allocated resources.
+	 *
+	 * Possible leave codes:
+	 *  .
+	 *
+	 * @param aMovie     movie to process
+	 * @param aFilename  output file name
+	 * @param aFilename  output file handle
+	 */
+	void StartMovieL(CVedMovieImp* aMovie, const TDesC& aFileName, RFile* aFileHandle,
+	                 MVedMovieProcessingObserver *aObserver);
+    
+    /**
+	 * Cancels the processing of a movie. The processor is reseted to an idle state.
+	 * The user must call StartMovieL again after this to start processing again.	      
+	 *
+	 * Possible leave codes:
+	 *  .
+	 *
+	 */
+    void CancelProcessingL();
+    
+    /**
+     * Sets the maximum size for the movie
+     * 
+     * @param aLimit Maximum size in bytes
+     */
+    void SetMovieSizeLimit(TInt aLimit);
+
+
+protected:
+	CMovieProcessor();
+
+	void ConstructL();
+
+private:
+	TInt iThumbProgress;
+	TInt iMovieProgress;
+    RPointerArray<TVideoProcessorAudioData> iAudioDataArray;
+	CMovieProcessorImpl* iMovieProcessor;
+	};
+
+
+#endif // __MEDIAPROCESSOR_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/movieprocessorimpl.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1589 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for movie processor implementation.
+*
+*/
+
+
+#ifndef     __MOVIEPROCESSORIMPL_H__
+#define     __MOVIEPROCESSORIMPL_H__
+
+#ifndef __E32BASE_H__
+#include <e32base.h>
+#endif
+
+#include "mp4demux.h"
+#include "parser.h"
+#include "videoprocessor.h"
+#include "VedCommon.h"
+#include "VedMovieImp.h"
+#include "VedVideoClipInfoImp.h"
+#include "VedVideoClipGenerator.h"
+#include "VedRgb2YuvConverter.h"
+
+//  FORWARD DECLARATIONS
+class CStatusMonitor;
+class CActiveQueue;
+class CVideoProcessor;
+class CDemultiplexer; 
+class CComposer; 
+class CVideoEncoder;
+class CVedMovie;
+class MVedMovieProcessingObserver;
+class CDisplayChain;
+class CTranscoder;
+class CAudioProcessor;
+class CSizeEstimate;
+class CVedAVCEdit;
+
+// audio operation
+enum TAudioOperation
+{
+	EAudioRetain = 0,
+	EAudioMute,
+	EAudioReplace
+};
+
+enum TVideoOperation  // used in image insertion
+{
+    EVideoEncodeFrame = 0,
+    EVideoWriteFrameToFile
+};
+		
+// video frame parameters
+struct TFrameParameters
+{	
+	TInt64 iTimeStamp;
+	TUint8 iType;	
+};
+
+// H.263 TR parameters
+struct TTrParameters
+{
+	TInt iTrPrevNew; 
+	TInt iTrPrevOrig; 
+};
+
+// video clip parameters
+struct TVideoClipParameters
+{
+	TInt64 iStartTime; 
+	TInt64 iEndTime; 
+}; 
+   
+
+//  CLASS DEFINITIONS
+class CMovieProcessorImpl : public CActive, public MVedVideoClipGeneratorFrameObserver,
+                            public MThumbnailObserver
+{
+public:
+
+    // Error codes
+    enum TErrorCode
+    {
+        EInvalidProcessorState = -1000,
+        EUnsupportedFormat = -1001,
+        EVideoTooLarge = -1002,                                
+        EStreamCorrupted = -1003,        
+        EInvalidStreamData = -1004,
+        EInvalidInternalState = -1050
+        // Also error codes <EInvalidInternalState may be returned, they can be
+        // considered fatal internal errors.
+    };
+
+    // Input data format
+    enum TDataFormat
+    {    
+        EData3GP,  // 3GP
+        EDataAutoDetect // autodetect type
+    };    
+
+
+public:  // Functions from base classes
+
+    /**
+    * From CActive Active object running method
+    */
+    void RunL();
+
+    /**
+    * From CActive Active object cancelling method
+    */    
+    void DoCancel();
+
+    /**
+    * From CActive Active Error handling method
+    */    
+    TInt RunError(TInt aError);
+
+    /** Frame insertion support 
+	 * From CVedVideoClipGenerator, this function is callback indicating image is ready
+	 * @param aError      <code>KErrNone</code>, if frame was completed successfully; 
+	 *                    one of the system wide error codes, if frame generation failed
+     * @param aFrame      pointer to frame, if it was completed successfully;
+	 *                    <code>NULL</code>, if frame generation failed
+	 */
+	void NotifyVideoClipGeneratorFrameCompleted(CVedVideoClipGenerator& aGenerator, 
+        TInt aError, CFbsBitmap* aFrame);    
+    
+    /**
+    * From MThumbnailObserver
+	* 
+	* Called when thumbnail generation is ready
+	*	
+    * @param aError error code
+    */ 
+    void NotifyThumbnailReady(TInt aError);
+
+public:  // New functions
+	
+    /** 
+     * Constructors for instantiating new video processors.
+     * Should reserve as little resources as possible at this point.
+	 */
+	static CMovieProcessorImpl* NewL();
+	static CMovieProcessorImpl* NewLC();
+	
+	/** 
+	 * Destructor can be called at any time (i.e., also in the middle of a processing operation)
+	 * Should release all allocated resources, including releasing all allocated memory and 
+	 * *deleting* all output files that are currently being processed but not yet completed.
+	 */
+	virtual ~CMovieProcessorImpl();
+		
+	/**
+	 * Do all initializations necessary to start processing a movie, e.g. open files, allocate memory.
+	 * If this method leaves, destructor should be called to free allocated resources. 
+     * Starts processing after initializations are done.
+     *
+	 * @param aMovie  movie to process
+	 * @param aFilename  output file name
+	 * @param aFileHandle output file handle
+     * @param aObserver observer object    
+     *
+	 */
+	void StartMovieL(CVedMovieImp* aMovie, const TDesC& aFileName, RFile* aFileHandle,
+	                 MVedMovieProcessingObserver *aObserver);			
+
+    /** Create 3gp generated clips 
+     * Create all the necessary 3gp files before inserting them into the actual movie
+     * If this method leaves, destructor should be called to free allocated resources. 
+     * Starts processing after initializations are done.
+     *
+     * @param aCreateMode mode of operation of the create image files function
+     */
+	TInt CreateImage3GPFilesL(TVideoOperation aCreateMode);
+
+	/** Prepare for 3gp generated clips
+	 * Create all the data structures necessary for 3gp files creation before calling create.
+	 * If this method leaves, destructor should be called to free allocated resources. 
+     * Starts processing after initializations are done.
+     *
+	 * @param aCreateMode        mode of operation of the create image files function
+	 */
+	TInt ProcessImageSetsL(TVideoOperation aCreateMode);
+
+	/** Encode raw frames for 3gp generated clips
+	 * This method is used to encode a raw frame for 3gp generated clips
+	 * If this method leaves, destructor should be called to free allocated resources. 
+     * VideEncoder should be created and initialized before using this function
+     * 
+	 */
+	TInt EncodeImageFrameL();
+
+	/** Process raw frames for 3gp generated clips
+	 * Decide what to do in this function - whether to call encoder or compose output
+	 * If this method leaves, destructor should be called to free allocated resources. 
+     * Starts processing after initializations are done.
+     *
+	 */
+	void DoImageSetProcessL();
+
+	
+	/**
+	 * Do all initializations necessary to start generating a thumbnail, e.g. open files, 
+	 * allocate memory. The video clip file should be opened with EFileShareReadersOnly 
+	 * share mode. The thumbnail should be scaled to the specified resolution and 
+	 * converted to the specified display mode. If this method leaves, destructor should be called to free 
+	 * allocated resources.
+	 * 
+	 * Possible leave codes:
+	 *	- <code>KErrNoMemory</code> if memory allocation fails
+	 *	- <code>KErrNotFound</code> if there is no file with the specified name
+	 *    in the specified directory (but the directory exists)
+	 *	- <code>KErrPathNotFound</code> if the specified directory
+	 *    does not exist
+	 *	- <code>KErrUnknown</code> if the specified file is of unknown format
+	 *  - <code>KErrNotSupported</code> if the specified combination of parameters
+	 *                                  is not supported
+	 *
+	 * @param aFileName  name of the file to generate thumbnail from
+	 * @param aFileHandle  handle of the file to generate thumbnail from
+     * @param aIndex       Frame index for selecting the thumbnail frame
+     *                     -1 means the best thumbnail is retrieved
+ 	 * @param aResolution  resolution of the desired thumbnail bitmap, or
+	 *                     <code>NULL</code> if the thumbnail should be
+	 *                     in the original resolution
+	 * @param aDisplayMode desired display mode; or <code>ENone</code> if 
+	 *                     any display mode is acceptable
+	 * @param aEnhance	   apply image enhancement algorithms to improve
+	 *                     thumbnail quality; note that this may considerably
+	 *                     increase the processing time needed to prepare
+	 *                     the thumbnail
+	 */
+	void StartThumbL(const TDesC& aFileName, RFile* aFileHandle, TInt aIndex, TSize aResolution, 
+		TDisplayMode aDisplayMode, TBool aEnhance);		
+	
+	/**
+	 * Starts thumbnail generation. Thumbnail generation is an asynchronous operation,
+	 * and its completion is informed to the caller via Active object request completion;
+	 * the iStatus member of the caller is passed as a parameter to this method.
+	 *
+	 * This method may leave if an error occurs in initiating the thumbnail generation.	
+	 * If this method leaves, destructor should be called to free allocated resources.	
+	 * 
+	 * @param aStatus     Reference to caller's iStatus member variable
+	 * @param aFactor     Pointer to a TVedTranscodeFactor structure, which is updated by this method
+	 *
+	 * @return  
+	 *          
+	 */
+	void ProcessThumbL(TRequestStatus &aStatus, TVedTranscodeFactor* aFactor);
+		
+	 /** 
+	 * Method for retrieving the completed thumbnail bitmap.
+	 * 
+	 * Video processor should not free the CFbsBitmap instance after it has passed it on 
+	 * as a return value of this function 
+	 *	 
+	 */
+	void FetchThumb(CFbsBitmap*& aThumb);
+	
+	/**
+	 * Read clip header from the specified file and return its properties.	 
+	 * This method should leave if clip is invalid, cannot be opened, etc.
+	 *
+	 * @param aFileName  name of the file to read
+	 * @param aFileHandle handle of file to read
+	 * @param aVideoFormat  for returning the video format
+     * @param aVideoType Type of video data
+	 * @param aResolution  for returning the resolution
+	 * @param aAudioType Type of audio data
+     * @param aDuration  for returning the duration
+     * @param aVideoFrameCount Number of video frames in the clip	 
+	 * @param aSamplingRate Audio sampling rate
+	 * @param aChannelMode Audio channel mode
+	 */
+	void GetClipPropertiesL(const TDesC& aFileName, RFile* aFileHandle, TVedVideoFormat& aFormat,
+		TVedVideoType& aVideoType, TSize& aResolution, TVedAudioType& aAudioType, 
+		TTimeIntervalMicroSeconds& aDuration, TInt& aVideoFrameCount,TInt& aSamplingRate, 
+		TVedAudioChannelMode& aChannelMode);	
+
+    /**
+	 * Read video frame information from the specified video clip file and fills array of info for 
+     * all frames in video.The file should be opened with EFileShareReadersOnly share mode. Video processor 
+	 * should not free the video frame info array after it has passed it on as a return value 
+	 * of this function. Returned array should be allocated with User::AllocL() and should be 
+	 * freed by the caller of this method with User::Free(). 
+	 *
+	 * Possible leave codes:
+	 *	- <code>KErrNoMemory</code> if memory allocation fails
+	 *	- <code>KErrNotFound</code> if there is no file with the specified name
+	 *    in the specified directory (but the directory exists)
+	 *	- <code>KErrPathNotFound</code> if the specified directory
+	 *    does not exist
+	 *	- <code>KErrUnknown</code> if the specified file is of unknown format
+	 *
+	 * @param aFileName             name of the file to read
+	 * @param aFileHandle           handle of the file to read
+	 * @param aVideoFrameInfoArray  Array for video frame parameters
+	 */
+    void GenerateVideoFrameInfoArrayL(const TDesC& aFileName, RFile* aFileHandle, TVedVideoFrameInfo*& aVideoFrameInfoArray);
+
+    /**
+     * Get movie size estimate
+     *
+     * @param aMovie Movie for which the estimate is done
+     * @return Movie size in bytes
+     */
+
+    TInt GetMovieSizeEstimateL(const CVedMovie* aMovie);    
+
+    /**
+     * Calculate movie size estimate for MMS
+     *          
+     * @param aMovie			Movie object 
+     * @param aTargetSize		Maximum size allowed
+     * @param aStartTime		Time of the first frame included in the MMS output
+     * @param aEndTime			Time of the last frame included in the MMS output
+     * @return Error code
+     */
+    TInt GetMovieSizeEstimateForMMSL(const CVedMovie* aMovie, TInt aTargetSize, 
+		TTimeIntervalMicroSeconds aStartTime, TTimeIntervalMicroSeconds& aEndTime);
+
+    /**
+	 *  Cancels the processing of a movie	 
+	 */
+    void CancelProcessingL();
+
+    /**
+     * Enhances the visual quality of the frame
+     *     
+     */				
+	void EnhanceThumbnailL(const CFbsBitmap* aInBitmap, CFbsBitmap* aTargetBitmap); 
+
+    /**
+     * Get number of frames in output movie
+     *     
+     * @return Number of output frames
+     */				
+	inline TInt GetOutputNumberOfFrames() const { return iOutputNumberOfFrames; }
+
+	/**
+	* Get the file name of the current clip
+	*     
+	* @return File name of the current clip
+	*/				
+	inline TFileName GetCurrentClipFileName() const { return iClipFileName; }
+
+    /**
+     * Get number of frames in current clip
+     *     
+     * @return Number of frames in clip
+     */
+    inline TInt GetClipNumberOfFrames() const { return iParser->GetNumberOfFramesInClip(); }	
+	
+	/**
+     * Get the timescale of the current video clip
+     *     
+     * @return Timescale
+     */
+	inline TInt GetVideoClipTimeScale() const { return iParser->iStreamParameters.iVideoTimeScale; }
+
+    /**
+     * Get color effect for the current clip
+     *     
+     * @return Color effect
+     */
+	inline TVedColorEffect GetColorEffect() const { return iColorEffect; } 
+	
+	inline void GetColorTone(TInt& aU, TInt& aV) { aU=iColorToneU; aV=iColorToneV; }
+
+    /**
+     * Get number of audio frames in one 3gp sample
+     *     
+     * @return Number of frames in sample
+     */
+    inline TInt GetAudioFramesInSample() const { return iAudioFramesInSample; }
+
+    /**
+     * Finalize processing a clip
+     *     
+     */
+    void FinalizeVideoClip();
+
+    /**
+     * Set frame type 
+     *
+     * @param aFrameIndex Index to the frame
+     * @param aType P frame = 0, I frame = 1
+     */    
+    void SetFrameType(TInt aFrameIndex, TUint8 aType);
+	
+    /**
+     * Get video timestamp in ms from timestamp in ticks
+     *
+     * @param aTimeStampInTicks Time in ticks
+     * @param aCommonTimeScale ETrue for using the output time scale
+     *                         EFalse for using the scale of current clip
+     * @return Timestamp in milliseconds
+     */        
+    TInt64 GetVideoTimeInMsFromTicks(TInt64 aTimeStampInTicks, TBool aCommonTimeScale) const;    
+    
+    /**
+     * Get video timestamp in ticks from timestamp in ms
+     *
+     * @param aTimeStampInMs Time in ms
+     * @param aCommonTimeScale ETrue for using the output time scale
+     *                         EFalse for using the scale of current clip
+     * @return Timestamp in ticks
+     */        
+    TInt64 GetVideoTimeInTicksFromMs(TInt64 aTimeStampInMs, TBool aCommonTimeScale) const;
+    
+    /**
+     * Get audio timestamp in ticks from timestamp in ms
+	 *
+	 * @param aTimeStampInMs Time in ms 		
+	 * @return Timestamp in ticks
+	 */ 	 
+	TUint GetAudioTimeInTicksFromMs(TUint aTimeStampInMs) const;        
+	
+	/**
+     * Get audio timestamp in ms from timestamp in ticks
+	 *
+	 * @param aTimeStampInTicks Time in ticks 		
+	 * @return Timestamp in milliseconds
+	 */ 	 
+	TUint GetAudioTimeInMsFromTicks(TUint aTimeStampInTicks) const;
+
+    /**
+     * Get video frame index based on timestamp
+     *
+     * @param aTime Frame timestamp in microseconds
+     * @return Frame index
+     */    
+    TInt GetVideoFrameIndex(TTimeIntervalMicroSeconds aTime) const;
+
+    /**
+     * Get frame index for the first frame in current clip
+     *
+     * @param aTime Timestamp in microseconds
+     * @return Frame index
+     */
+    inline TInt GetStartFrameIndex() const { return iStartFrameIndex; }
+
+    /**
+     * Get frame type at specified index
+     *
+     * @param aIndex Frame index
+     * @return Frame type
+     */
+    inline TInt8 GetVideoFrameType(TInt aIndex) const { return iParser->GetVideoFrameType(aIndex); };
+
+    inline TInt8 VideoFrameType(TInt aIndex) const
+        {
+        if (iThumbnailInProgress || (iFrameParameters == 0))
+            {
+            return iParser->GetVideoFrameType(iParser->GetStartFrameIndex() + aIndex);
+            }
+            
+        return (TInt8) iFrameParameters[aIndex].iType;
+        }
+
+     /**
+     * Get frame timestamp at specified index, in ticks
+     *
+     * @param aIndex Frame index
+     * @return timestamp in ticks
+     */
+    inline TInt64 VideoFrameTimeStamp(TInt aIndex)
+        {
+        if (iThumbnailInProgress || (iFrameParameters == 0))
+            {
+            TInt startTimeInTicks = 0;
+            iParser->GetVideoFrameStartTime(iParser->GetStartFrameIndex() + aIndex, &startTimeInTicks);
+            return startTimeInTicks;
+            }
+        
+        return (TInt64) iFrameParameters[aIndex].iTimeStamp;
+        }
+
+    inline void SetTrPrevNew(TInt aTr) { iTr.iTrPrevNew = aTr; }
+
+    inline void SetTrPrevOrig(TInt aTr) { iTr.iTrPrevOrig = aTr; }
+
+    inline TInt GetTrPrevNew() const { return iTr.iTrPrevNew; }
+
+    inline TInt GetTrPrevOrig() const { return iTr.iTrPrevOrig; }
+
+    /**
+     * Get pointer to demultiplexer object
+     *     
+     * @return demux pointer
+     */
+    inline CDemultiplexer* GetDemux() const { return iDemux; }
+	
+    /**
+     * Get the start time for the current clip
+     *     
+     * @return Time in microseconds
+     */
+	inline TTimeIntervalMicroSeconds GetStartCutTime() const { return iStartCutTime; }
+
+     /**
+     * Get thumbnail processing status
+     * 
+     * @return ETrue if thumbnail is being processed, EFalse otherwise
+     */
+    inline TBool IsThumbnailInProgress() const { return iThumbnailInProgress; }
+
+    /**
+     * Get the end time for the current clip
+     *     
+     * @return Time in microseconds
+     */
+	inline TTimeIntervalMicroSeconds GetEndCutTime() const { return iEndCutTime; }	
+
+	/**
+     * Get current metadata size
+     *     
+     * @return Metadata size in bytes
+     */
+	TUint CurrentMetadataSize();
+       
+    /**
+     * Write video frame to output 3gp file
+     * @param aBuf Descriptor containing the frame
+     * @param aTimeStampInTicks Time stamp of the frame in ticks
+     * @param aDurationInTicks Frame duration in ticks
+     * @param aKeyFrame ETrue if the frame is a keyframe     
+     * @param aCommonTimeScale if ETrue, output movie timescale will
+     *         be used, otherwise the current clip's timescale is used
+     * @param aColorTransitionFlag ETrue if writing frames from latter
+     *        clip in a color transition (wipe/crossfade)
+     * @return Error code
+     */
+    TInt WriteVideoFrameToFile(TDesC8& aBuf, TInt64 aTimeStampInTicks, 
+                               TInt aDurationInTicks, TBool aKeyFrame,
+                               TBool aCommonTimeScale, TBool aColorTransitionFlag,
+                               TBool aFromEncoder);
+
+	/**
+     * Save a video YUV frame to the tmp file
+     * @param aBuf Descriptor containing the YUV frame
+     * @param aDuration The frame duration
+     * @param aTimeStamp The frame timestamp
+     * @return Error code
+     */
+    TInt SaveVideoFrameToFile(TDesC8& aBuf, TInt aDuration, TInt64 aTimeStamp);
+
+	/**
+     * Retrieve a video YUV frame from the tmp file
+     * @param aBuf Descriptor containing the YUV frame
+     * @param aLength Length of the descriptor
+     * @param aDuration The frame duration
+     * @param aTimeStamp The frame timestamp
+     * @return Error code
+     */
+    TInt GetVideoFrameFromFile(TDes8& aBuf, TInt aLength, TInt& aDuration, TInt64& aTimeStamp);
+
+	/**
+     * Get the next frame duration and timestamp
+     * @param aDuration The frame duration
+     * @param aTimeStamp The frame timestamp
+     * @param aIndex Index of timestamp to get
+     * @param aTimeStampOffset Offset for timestamp
+     * @return Error code
+     */
+    void GetNextFrameDuration(TInt& aDuration, TInt64& aTimeStamp, TInt aIndex, TInt& aTimeStampOffset);
+
+    /**
+     * Append the next frame duration and timestamp
+     * @param aDuration The frame duration
+     * @param aTimeStamp The frame timestamp
+     * @return Error code
+     */
+    void AppendNextFrameDuration(TInt aDuration, TInt64 aTimeStamp);
+
+    /**
+     * Get the number of transition duration in the list
+     * @return Number of transition
+     */
+    TInt NumberOfTransition() { return iCurClipDurationList.Count(); }
+
+    /**
+     * Get the number of transition at the start of next clip
+     * @return Number of transition number
+     */
+    TInt NextClipStartTransitionNumber();
+
+    /**
+     * Get the transition duration of the current clip
+     * @return Transition duration
+     */
+    TInt TransitionDuration();
+
+    /**
+     * Release all internal data hold for transition effect
+     */
+    void CloseTransitionInfoL();
+
+	/**
+     * Update progress based on time processed so far
+     *          
+     */
+	void IncProgressBar();
+    
+     /**
+     * Get the number of the audio clip being processed
+     * 
+     * @return Clip number
+     */
+    inline TInt GetAudioClipNumber() const  { return iAudioClipNumber; }	
+	
+	/**
+	* Get the output type of audio in the movie
+	* 
+	* @return Audio type
+	*/
+	TVedAudioType GetOutputAudioType();		
+     
+    /**
+     * Get the number of the video clip being processed
+     *          
+     * @return Clip number
+     */
+	inline TInt GetVideoClipNumber() const { return iVideoClipNumber; }    
+
+    /**
+     * Get the total number of the video clips in movie
+     *          
+     * @return Number of clips
+     */
+    inline TInt GetNumberOfVideoClips() const { return iNumberOfVideoClips; }
+        
+    /**
+     * Get the starting transition effect for the current clip
+     *          
+     * @return Transition effect
+     */
+	inline TVedStartTransitionEffect GetStartTransitionEffect() const { return iStartTransitionEffect; }
+
+    /**
+     * Get the middle transition effect for the current clip
+     *          
+     * @return Transition effect
+     */
+	inline TVedMiddleTransitionEffect GetMiddleTransitionEffect() const { return iMiddleTransitionEffect; }
+
+    /**
+     * Get the middle transition effect for the previous clip
+     *          
+     * @return Transition effect
+     */
+	inline TVedMiddleTransitionEffect GetPreviousMiddleTransitionEffect() const { return iPreviousMiddleTransitionEffect; }
+
+    /**
+     * Get the ending transition effect for the current clip
+     *          
+     * @return Transition effect
+     */
+	inline TVedEndTransitionEffect GetEndTransitionEffect() const { return iEndTransitionEffect; }
+
+    /**
+     * Get the slow motion speed of the current clip
+     *          
+     * @return Speed
+     */
+    inline TInt GetSlowMotionSpeed() const { return iVideoClip->Speed(); }
+
+    /**
+     * Get the duration of the current video clip
+     *          
+     * @return duration
+     */
+    inline TInt64 GetVideoClipDuration() { return iVideoClipDuration; }
+
+	/**
+     * Get the resolution of the current video clip
+     *          
+     * @return resolution
+     */
+	TSize GetVideoClipResolution();
+	
+	/**
+     * Get the resolution of the output movie
+     *          
+     * @return resolution
+     */
+	TSize GetMovieResolution();
+
+    /**
+     * Get sync interval in picture setting from movie
+     *
+     * @return sync interval (H.263 GOB header frequency)
+     */
+    TInt GetSyncIntervalInPicture();
+    
+    /**
+     * Get random access rate setting from movie
+     *
+     * @return random access rate in pictures per second
+     */
+    TReal GetRandomAccessRate();
+
+	/**
+     * Get the format of the output video
+     *          
+     * @return format
+     */
+	TVedVideoType GetOutputVideoType();
+
+    /**
+     * Get the format of the current video clip
+     *          
+     * @return format
+     */
+	TVedVideoType GetCurrentClipVideoType();
+
+	/**	
+     * Get the transcoding information of the video clip being processed
+     *          
+	 * @param aNum         video clip number in the movie
+	 *
+     * @return pointer to TTrascodeFactor object
+     */
+	TVedTranscodeFactor GetVideoClipTranscodeFactor(TInt aNum);		
+
+	/** 
+     * Get the flag that indicates if mode translation is required for the MPEG-4 video clip
+     *          
+     * @return duration
+     */
+	inline TBool GetModeTranslationMpeg4() { return iModeTranslationRequired; }
+
+	/** 
+     * Set the flag to indicate that the clip was transcoded
+     *   
+     * @param aModeChanged         ETrue if mode is changed
+     */
+	inline void SetClipModeChanged(TBool aModeChanged) { iModeChanged = aModeChanged; }
+
+    /**
+     * Stops processing
+     *
+     * @return Error code
+     */
+	TInt Stop();    
+
+    /**
+     * Stops processing and closes all submodules except status monitor & video encoder
+     *
+     * @return Error code
+     */
+    TInt Close();
+
+    /**
+     * Gets the average frame rate of current video clip
+     *
+     * @return Frame rate
+     */
+    TReal GetVideoClipFrameRate();
+    
+    /**
+     * Gets the target movie frame rate
+     *
+     * @return Frame rate
+     */
+    TReal GetMovieFrameRate();
+    
+    /**
+     * Get the target video bitrate
+     *
+     * @return bitrate
+     */
+    TInt GetMovieVideoBitrate();
+    
+    TInt GetMovieStandardVideoBitrate();
+    
+    /**
+     * Sets the maximum size for the movie
+     * 
+     * @param aLimit Maximum size in bytes
+     */
+    void SetMovieSizeLimit(TInt aLimit);
+    
+     /**
+      * Get the ColorTone value in Rgb for the clip and convert to YUV
+	  *
+	  * @param aColorEffect 			 TVedColorEffect type (B&W or ColorTone)			
+	  * @param aColorToneRgb			 Rgb value for the colortone
+	  */													 
+	void ConvertColorToneRGBToYUV(TVedColorEffect aColorEffect,TRgb aColorToneRgb);
+	
+     /**
+      * Adjust the U,V color tone value for H.263 video format
+	  *
+	  * @param aValue The color to adjustTVedColorEffect type (B&W or ColorTone)			
+	  */													 
+    void CMovieProcessorImpl::AdjustH263UV(TInt& aValue);
+        
+    /**
+     * Process audio frames
+	 *
+	 */													 
+    void ProcessAudioL();
+    
+    /**    	
+	* Called when audio clip has been processed
+	*
+    * @param aError error code
+    */         
+    void AudioProcessingComplete(TInt aError);
+    
+    /**
+     * Returns the MIME-type for the video in the movie
+     * 
+     * @return Video codec MIME-type
+     */
+    TPtrC8& GetOutputVideoMimeType();
+        
+    /**
+     * Returns the number of saved frames from previous clip
+     * 
+     * @return number of frames 
+     */
+    inline TInt GetNumberOfSavedFrames() const { return iCurClipTimeStampList.Count(); }            
+    
+     /**
+     * Returns the length (in bytes) of decoder specific info
+     * 
+     * @return Decoder specific info size
+     */
+    inline TInt GetDecoderSpecificInfoSize() const { return iParser->GetDecoderSpecificInfoSize(); }
+    
+     /**
+     * Suspends demux. New output can arrive from transcoder, but no new
+     * input is fed there.
+     *
+     * @return TInt error code
+     */
+    TInt SuspendProcessing();
+    
+    /**
+     * Resumes processing, restoring the state. Input to transcoder
+     * goes to the position before the suspend or the last I-frame before that.
+     *
+     * @param aStartIndex Index of the first frame to be decoded
+     * @param aSuspendTime Frame number of last written frame
+     *
+     * @return TInt error code
+     */
+    TInt ResumeProcessing(TInt& aStartFrameIndex, TInt aFrameNumber);    
+    
+    /**
+     * Check if video transcoder is needed any longer. If not, suspend is not necessary.
+     *
+     * @return TBool ETrue if needed, EFalse if not
+     */
+    TBool NeedTranscoderAnyMore();
+								
+private: // Constants
+	
+	// state	
+    enum TProcessorState
+        {
+            EStateIdle = 0,		
+            EStateOpened,   // clip is open at the decoder (?)
+            EStatePreparing,
+            EStateReadyToProcess,
+            EStateProcessing        
+        };
+	
+	// Audio types
+	enum TAudioType
+	{
+		EAudioNone = 0,
+		EAudioAMR,
+		EAudioAAC
+	};
+	
+	// Video types
+	enum TVideoType
+	{
+		EVideoNone = 0,
+		EVideoH263Profile0Level10,
+		EVideoH263Profile0Level45,
+		EVideoMPEG4,
+		EVideoAVCProfileBaseline
+	};
+	
+	// Multiplex types
+	enum TMuxType
+	{
+        EMuxNone = 0,
+		EMux3GP		
+	};     
+	
+private: // Private methods
+
+    /**
+    * By default Symbian OS constructor is private.
+	*/
+    void ConstructL();
+
+    /**
+    * c++ default constructor
+	*/
+    CMovieProcessorImpl();    
+
+    /**
+     * Set the number of output frames
+     *          
+     * @param aOutputNumberOfFrames No. of output frames     
+     */
+    inline void SetOutputNumberOfFrames(TInt aOutputNumberOfFrames) {
+        iOutputNumberOfFrames = aOutputNumberOfFrames; }
+    
+    /**
+     * Opens a 3gp clip for processing
+     *
+     * @param aFileName Clip filename
+     * @param aFileHandle Clip file handle
+     * @param aDataFormat Clip file format
+     *
+     * @return Error code
+     */
+	TInt OpenStream(TFileName aFileName, RFile* aFileHandle, TDataFormat aDataFormat);
+
+    /**
+     * Closes the processed clip from parser
+     *
+     * @return Error code
+     */
+	TInt CloseStream();
+
+    /**
+     * Prepares the processor for processing a movie
+     *
+     * @return Error code
+     */
+	TInt Prepare();
+    
+    /**
+     * Deletes objects used in processing
+     *     
+     */
+    void DoCloseVideoL();
+
+    /**
+     * Finalizes movie processing, creates the output 3gp file
+     * 
+     */
+	void FinalizeVideoSequenceL();
+
+    /**
+     * Starts processing the movie
+     *          
+     */
+    void DoStartProcessing();
+
+    /**
+     * Sets suitable default values for parameters
+     *          
+     */
+    void SetHeaderDefaults();
+
+	/**
+     * Sets output audio & video formats
+     *          
+     */
+	void SetOutputMediaTypesL();
+
+	/**
+     * Gets bitstream modes of input clips
+     *          
+     */
+	void GetTranscodeFactorsL();
+
+	/**
+     * Sets video transcoding parameters
+     *          
+     */
+	void SetupTranscodingL();
+
+    /**
+     * Resets modules & variables used in processing
+     *          
+     */
+    void ResetL();
+
+    /**
+     * Processes the movie when no video clips are present
+     *          
+     */
+    void ProcessAudioOnly();
+
+    /**
+     * Parses the clip header
+     *
+     * @param aStreamParams Destination structure for stream parameters
+     * @param Filename of the clip
+     * @param FileHandle of the clip
+     *          
+     */
+	void ParseHeaderOnlyL(CParser::TStreamParameters& aStreamParams, TFileName& aFileName, RFile* aFileHandle); 
+
+    /**
+     * Copies stream parameters from source to destination structure
+     *
+     * @param aDestParameters Destination structure
+     * @param aSrcParameters Source structure     
+     *          
+     */
+	void UpdateStreamParameters(CParser::TStreamParameters& aDestParameters, 
+		CParser::TStreamParameters& aSrcParameters);    
+	
+    /**
+     * Parse the clip header & update internal variables accordingly
+     *     
+     */
+	void ParseHeaderL();	
+    
+    /**
+     * Initializes the video queue and decoder
+     *
+     * @param aQueueBlocks Number of video queue blocks
+     * @param aQueueBlockSize Size of one video queue block
+     */
+	void InitVideoL(TUint aQueueBlocks, TUint aQueueBlockSize);
+
+	/**
+     * Initializes the demultiplexer
+     *     
+     */
+	void InitDemuxL();
+
+    /**
+     * Initializes the processor for the next clip to be processed,
+     * called for each clip    
+     */
+	void InitializeClipL();
+
+    /**
+     * Initializes structures for movie processing, called once per movie
+     *
+     * @param iAudioDataArray Array containing parameters for audio clips     
+     *
+     */
+    void InitializeClipStructuresL();
+
+    /**
+     * Initializes the processor for the generated clip to be processed.
+     * Called for each Image clip    
+     */
+	void InitializeGeneratedClipL();
+
+	/**
+     * Initializes the processor for creating the temporary 3gp file (clip).
+     * Called for each Image clip 
+     */
+	void TemporaryInitializeGeneratedClipL();
+
+    /**
+     * Frees memory allocated for movie processing
+     *
+     */   
+    void DeleteClipStructures();
+
+    /**
+     * Fills an array containing video frame parameters
+     *
+     */   
+    void FillVideoFrameInfoArrayL(TInt& aVideoFrameCount, TVedVideoFrameInfo*& aVideoFrameInfoArray);
+
+    /**
+     * Fills internal frame parameter structure
+     *
+     */
+    void FillFrameParametersL(TInt aCurrentFrameIndex);    
+
+    /**
+     * Writes the remaining audio frames to file
+     *          
+     * @return Error code
+     */
+    TInt FinalizeAudioWrite();	
+
+	/**
+	* Decide the type of Audio in terms of the common types
+	* 
+	* @return Audio type
+	*/
+	TVedAudioType DecideAudioType(TAudioType aAudioType);	
+	
+	/**
+    * Write an audio frame to internal buffer (AMR)
+    * or to output file (AAC)
+	*
+	* @param aBuf Source buffer
+	* @param aDuration duration of the current frame
+	*
+	 @return Error code
+	*/		
+	TInt WriteAllAudioFrames(TDesC8& aBuf, TInt aDuration);
+
+	/**
+	* Add a number of AMR frames to internal buffer
+	*
+	* @param aBuf Source buffer
+	* @param aNumFrames Number of frames in buffer
+	*
+	* @return Error code
+	*/
+	TInt BufferAMRFrames(const TDesC8& aBuf, TInt aNumFrames, TInt aDuration);	
+
+	/**
+	* Purge AMR frames from internal buffer to output file
+	*
+	*
+	* @return Error code
+	*/
+	TInt WriteAMRSamplesToFile();    
+
+    /**
+     * Get the target audio bitrate
+     *
+     * @return bitrate
+     */
+    TInt GetMovieAudioBitrate();
+    
+    /**
+     * Writes a buffered frame to output file
+     *
+     * @param aDuration Duration of the frame being written from buffer,
+     *        expressed in timescale of the output movie
+     * @param aColorTransitionFlag ETrue if writing frames from latter
+     *        clip in a color transition (wipe/crossfade)     
+     * @return Error code
+     */
+    TInt WriteVideoFrameFromBuffer(TReal aDuration, TBool aColorTransitionFlag);
+
+    /**
+     * Writes the last buffered frame to file
+     *
+     * @return Error code
+     */
+    TInt FinalizeVideoWrite();
+    
+    /**
+     * Reports an error in thumbnail generator
+     * to the caller
+     *
+     * @return ETrue if error was reported, EFalse otherwise
+     */
+    TBool HandleThumbnailError(TInt aError);
+    
+    /**
+     * Get output AVC level
+     *
+     * @return Level
+     */
+    TInt GetOutputAVCLevel();
+
+private:  // Data
+
+	// True if processing has been cancelled
+	TBool iProcessingCancelled;
+
+	// True if video encoder initialisation is ongoing
+	TBool iEncoderInitPending;
+
+	// timestamp for encoding ending black frames
+	TTimeIntervalMicroSeconds iTimeStamp;
+
+	// Duration by which audio is longer than video
+	TInt64 iLeftOverDuration;
+
+    // Video frame parameters
+	TFrameParameters* iFrameParameters;
+	
+	// Size of the video frame parameters array
+	TInt iFrameParametersSize;
+
+    // number of frames in output movie
+	TInt iOutputNumberOfFrames;	
+
+    // TR parameters
+	TTrParameters iTr;
+
+    // Thumbnail resolution
+	TSize iOutputThumbResolution;    
+
+	// Thumbnail index
+	TInt iThumbIndex; 
+
+	// Thumbnail display mode
+	TDisplayMode iThumbDisplayMode; 
+
+	// Thumbnail enhance
+	TBool iThumbEnhance; 
+
+    // stream duration: max. of audio,video
+	TInt64 iVideoClipDuration;
+
+	// output audio buffer	
+    // stores output raw amr data for processed clip
+	HBufC8 *iOutAudioBuffer;
+    
+    // output video buffer for one frame
+    HBufC8 *iOutVideoBuffer;
+
+    // Is there a frame in buffer ?
+    TBool iFrameBuffered;
+
+    // Timestamp of buffered frame
+    TInt64 iBufferedTimeStamp;
+
+    // key frame info of buffered frame
+    TBool iBufferedKeyFrame;
+    
+    TBool iBufferedFromEncoder;
+
+    TBool iFirstFrameBuffered;
+
+    // number of audio frames in the buffer currently
+    TInt iAudioFramesInBuffer;
+	
+    // Composer object 
+	CComposer *iComposer;
+
+    // Filename of the current clip
+    TFileName iClipFileName;
+    
+    // File handle of the current clip
+    RFile* iClipFileHandle;
+    
+    // Output movie filename
+	TFileName iOutputMovieFileName; 
+	
+	// Output movie filehandle
+	RFile* iOutputFileHandle;
+
+    // status monitor object
+    CStatusMonitor* iMonitor;
+    // Movie processing observer used
+    MVedMovieProcessingObserver *iObserver; 
+    // Are we processing a thumbnail ?
+	TBool iThumbnailInProgress; 
+		
+    // number of frames processes so far
+    TUint iFramesProcessed;
+    // number of current video clip
+	TInt iVideoClipNumber; 
+    // total number of video frames
+	TInt iNumberOfVideoClips; 
+    // index of the first frame in clip
+    TInt iStartFrameIndex;	
+    // video timescale for output movie
+	TUint iOutputVideoTimeScale;
+    
+    // progress percentage
+    TInt iProgress;
+    // is the current disk full ?
+    TBool iDiskFull;
+
+    // starting cut time for the current video clip
+	TTimeIntervalMicroSeconds iStartCutTime; 
+    // ending cut time for the current video clip
+	TTimeIntervalMicroSeconds iEndCutTime;     
+	
+    // Current video clip
+	CVedVideoClip* iVideoClip; 
+    // Movie
+	CVedMovieImp* iMovie; 
+
+    // buffer pointers for thumbnail generation
+    TUint8* iYuvBuf;
+    TUint8* iRgbBuf;
+
+    // Transition effect parameters
+	TVedStartTransitionEffect iStartTransitionEffect; 
+	TVedMiddleTransitionEffect iMiddleTransitionEffect; 
+	TVedMiddleTransitionEffect iPreviousMiddleTransitionEffect; 
+	TVedEndTransitionEffect iEndTransitionEffect; 
+
+	// Indicates if an image is being encoded
+	TInt iImageEncodedFlag;  
+
+    // finished creating the image 3GP file
+	TInt iImageEncodeProcFinished;
+
+	// for storing the converted YUV image in generation case
+	TUint8 *iYuvImageBuf; 
+
+	// image size for generated frames
+	TInt iImageSize;
+
+	// Descriptor holding the image to be encoded
+	TPtr8 iReadImageDes;
+
+	// Image composer
+	CComposer* iImageComposer;
+
+	// images processed in generation case
+	TInt iTotalImagesProcessed;
+
+	// Time scale for generated frames
+	TInt iImageVideoTimeScale;
+
+    // Generated clip has been created
+    TInt iImageClipCreated;
+
+	// Are we starting to process generated images
+	TInt iFirstTimeProcessing;
+
+	// The name of the current clip is constant for image clips and 0 if buffer supported
+	TFileName iCurrentMovieName;
+
+	// number of images from the generator
+	TInt iNumOfImages;
+
+	// is getFrame() from generator in progress
+	TInt iGetFrameInProgress;
+	
+	// Are output timescales set ?
+	TInt iOutputVideoTimeSet;
+	TInt iOutputAudioTimeSet;
+
+	// Are all clips generated ?
+	TInt iAllGeneratedClips;
+
+	// Is generated clip image being encoded ?
+	TInt iEncodeInProgress;	
+
+	// in ms, audio and video durations added up for progress bar indication
+	TInt64 iTotalMovieDuration;  
+
+	// Is the first clip generated
+    TBool iFirstClipIsGen;
+
+    TAudioType iOutputAudioType;
+
+	TVideoType iOutputVideoType;
+
+	TInt iMP4SpecificSize; 
+
+	// Is it the first frame of a clip
+    TBool iFirstFrameOfClip;
+
+    // for setting the first frame flag
+    // when doing wipe/crossfade transitions
+    TBool iFirstFrameFlagSet;
+
+	/*Indicates whether mode translation in between MPEG4 modes is required(NOTE in between MPEG4 modes only)*/
+	TBool iModeTranslationRequired;
+
+	/*This is set by the decoder indicating he changed either the format or mode so Mp4Specific size may not be right  */
+	TBool iModeChanged;	//This for the composer to know that mode was changed for Mp4Specific size
+
+    // Speed for the current clip, 1000 = normal speed
+	TUint iSpeed;
+    // Color effect for the current clip
+	TVedColorEffect iColorEffect;    
+
+    // total number of audio clips
+	TInt iNumberOfAudioClips; 
+
+    // Current audio clip number
+    TInt iAudioClipNumber; 
+
+    // Current replacement clip number
+    TInt iAudioReplaceClipNumber;
+
+    TInt iAudioFrameNumber;
+    TInt iVideoFrameNumber;
+    TInt iVideoIntraFrameNumber;
+
+    // Current audio time
+	TInt64 iCurrentAudioTimeInMs;
+
+	// total time in ms of audio written, 
+	// for the whole movie
+	TInt64 iTotalAudioTimeWrittenMs;
+
+    // Current video time
+	TReal iCurrentVideoTimeInTicks; 
+
+    // duration processed for generated clips
+    TInt64 iGeneratedProcessed;
+
+	// Duration of current audio clip written, 
+	// reseted after a clip has been processed
+	TInt64 iAudioClipWritten;
+
+    // Duration of current video clip written, 
+	// reseted after a clip has been processed
+    TInt64 iVideoClipWritten;
+
+    // video clip parameters
+	TVideoClipParameters *iVideoClipParameters; 
+    TInt iNumberOfAudioClipsCreated;
+    // number of audio frames per sample
+    TInt iAudioFramesInSample; 
+    // output audio timescale
+    TInt iOutputAudioTimeScale;
+
+    // time stamp for current video clip
+    TInt64 iInitialClipStartTimeStamp;
+    // ETrue if movie processing is starting
+    TBool iStartingProcessing;    
+
+	// Used by AAC to handle writing decoder specific info, 
+	// if it does not exist, to default value */	
+	TBool iFirstClipHasNoDecInfo;
+    
+    // the demultiplexer    
+    CDemultiplexer *iDemux; 
+     // the video decoder
+    CVideoProcessor *iVideoProcessor;
+    // the video decoder input queue
+    CActiveQueue *iVideoQueue; 
+     // file format parser
+    CParser *iParser;   
+    // video encoder
+    CVideoEncoder *iVideoEncoder;  	
+    
+    // audio processor
+    CAudioProcessor *iAudioProcessor;
+    
+    // audio processing done ?
+    TBool iAudioProcessingCompleted;
+
+    // frame enhancement
+    CDisplayChain *iEnhancer;  
+
+    // Video encoder input buffer
+    TUint8 *iEncoderBuffer;
+    // ETrue if video encoding is pending
+    TBool iEncodePending;
+    
+    // does the stream have video?
+    TBool iHaveVideo; 
+    // video stream type
+	TVideoType iVideoType; 
+    // does the stream have audio?
+	TBool iHaveAudio; 
+	
+	// : is this needed ??
+    // audio stream type
+	TAudioType iAudioType; 	    
+	
+    // is the stream multiplexed?
+	TBool iIsMuxed; 
+    // multiplex type					
+	TMuxType iMuxType; 
+		
+    // current processor state
+	TProcessorState iState; 
+     // current stream data format	
+	TDataFormat iDataFormat;
+
+	// stream start reading buffer
+	TUint8 *iReadBuf; 
+    // buffer length
+	TUint iBufLength; 
+    // amount of data in buffer
+	TUint iBufData; 
+    // reading descriptor	
+	TPtr8 iReadDes; 
+			
+    // number of demux channels used
+	TUint iNumDemuxChannels; 
+    // demux parameters read
+	CMP4Demux::TStreamParameters iMP4Parameters; 
+	CMP4Demux::TOutputChannel iMP4Channels[2];
+		
+    // H.263 stream parameters
+	CVideoProcessor::TStreamParameters iVideoParameters; 
+
+    // stream length in milliseconds
+	TUint iStreamLength; 
+    // stream size in bytes
+	TUint iStreamSize; 
+    // stream average bitrate
+	TUint iStreamBitrate; 
+    // is it possible to seek in the file	
+	TBool iCanSeek; 
+
+    // ETrue when all video of the movie has been processed
+    TBool iAllVideoProcessed;
+    
+	// tmp file used for Transition Effect
+	TFileName iCurClipFileName;
+    TFileName iNextClipFileName;
+
+	RFile iCurClip;
+    RFile iNextClip;
+    RFs   iFs;
+    TBool iFsConnected;	
+
+    RArray<TInt>   iCurClipDurationList;
+    RArray<TInt>   iNextClipDurationList;
+    RArray<TInt64> iCurClipTimeStampList;
+    RArray<TInt64> iNextClipTimeStampList;
+
+    TInt           iCurClipIndex;
+    TUint          iPreviousTimeScale;
+    TInt64         iOffsetTimeStamp;
+
+	// This flag is set to true if first clip uses encoder such as cut 
+	// as Resynch bit needs to be reset
+	TBool iFirstClipUsesEncoder;	// For changing Vos in case of Mpeg4 transcoding
+	TBool iMpeg4ModeTranscoded;
+
+	// Is true if first clip is cut
+	TBool iFirstClipIsCut;
+	
+	TInt iCurrentVideoSize;
+	TInt iCurrentAudioSize;
+	TInt iMovieSizeLimit;
+	TBool iMovieSizeLimitExceeded;
+
+    CActiveSchedulerWait *iWaitScheduler;
+    TBool iWaitSchedulerStarted;
+
+    TBool iAudioProcessingCancelled;
+    
+    TRequestStatus *iThumbnailRequestStatus;
+    CFbsBitmap* iOutBitmap;
+    
+    // Duration of all samples in buffered AMR
+    TInt iTotalDurationInSample;
+    
+    // ColorTone value as RGB
+    TRgb iColorToneRgb;
+    
+	// ColorTone values as U,V
+	TInt iColorToneU;
+	TInt iColorToneV;
+	
+	// for scaling the timestamp list
+	TBool iTimeStampListScaled;
+	
+	// true if we are encoding black ending frames
+	TBool iEncodingBlackFrames;
+	
+	// For calculating movie size estimates
+	CSizeEstimate *iSizeEstimate;
+		    
+    // Slow motion is not applied for ending black frames or the last frame of a clip
+    TBool iApplySlowMotion;  
+
+    // True if writing the first color transition frame    
+    TBool iWriting1stColorTransitionFrame;
+    
+    // Timestamp of the first color transition frame    
+    TInt64 i1stColorTransitionFrameTS;
+
+    // AVC editing instance for movie    
+    CVedAVCEdit* iAvcEdit;
+    
+    // AVC editing instance for a generated clip
+    CVedAVCEdit* iImageAvcEdit;
+    
+    // Bitmap-to-YUV converter
+    CVSFbsBitmapYUV420Converter* iImageYuvConverter;  
+
+    friend class CMP4Parser;
+    friend class CAudioProcessor;        
+		
+};
+
+
+#endif      //  __MOVIEPROCESSORIMPL_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/mp4composer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//FC: A wrapper class for mp4composer
+// Based on the CMP4Parser class
+// end FC.
+
+
+#ifndef __MP4COMPOSER_H__
+#define __MP4COMPOSER_H__
+
+//  INCLUDES
+
+
+#include "Composer.h"
+#include <mp4lib.h>
+#include "parser.h"
+#include "vedavcedit.h"
+
+// CONSTANTS
+// MACROS
+// DATA TYPES
+// FUNCTION PROTOTYPES
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+
+/**
+*  MP4 -format Composer class
+*  ?other_description_lines
+*/
+class CMP4Composer : public CComposer
+    {
+
+    public: // Constants
+
+        enum TFrameType
+        {
+            EFrameTypeNone = 0,
+            EFrameTypeAudio,
+            EFrameTypeVideo
+        };
+
+    public:  // Constructors and destructor
+
+        /**
+        * C++ default constructor.
+        */
+        CMP4Composer();
+
+		/**
+        * Two-phased constructor.(overloaded for Mp4 support)
+        */
+        static CMP4Composer* NewL(const TDesC &aFileName, 
+                                  CParser::TVideoFormat aVideoFormat,
+                                  CParser::TAudioFormat aAudioFormat,
+                                  CVedAVCEdit *aAvcEdit);
+                                  
+        static CMP4Composer* NewL(RFile* aFileHandle, 
+                                  CParser::TVideoFormat aVideoFormat,
+                                  CParser::TAudioFormat aAudioFormat,
+                                  CVedAVCEdit *aAvcEdit);
+
+        /**
+        * Destructor.
+        */
+        ~CMP4Composer();
+    
+    public: // Functions from base classes     
+
+                
+		/**
+        * Write a number of frames of requested type from inserted data or file
+        * @param aSrcBuffer SOurce buffer
+        * @param aType Type of frame(s) to write
+        * @param aNumWritten Number of frames actually written
+        * @return TInt error code
+        */
+
+        TInt WriteFrames(TDesC8& aSrcBuffer, TInt aFrameSize,TInt aDuration, 
+					TInt aKeyFrame,TInt aNumberOfFrames,TInt aFrameType);               
+
+		TInt WriteFrames(TDesC8& aSrcBuffer, TInt aFrameSize,TInt aDuration, 
+					TInt aKeyFrame,TInt aNumberOfFrames,TInt aFrameType,TInt& aMP4Size,
+					TBool aModeChanged,TBool aFirstFrameOfClip,TInt aMode, TBool aFromEncoder);
+
+        /**
+        * From CComposer composes the stream header.
+        * @param aStreamParameters Common stream parameters
+        * @param aOutputVideoTimeScale Video time scale for output file
+        * @param aOutputAudioTimeScale Audio time scale for output file
+        * @param aAudioFramesInSample Number of audio frames in sample
+        */
+		void ComposeHeaderL(CComposer::TStreamParameters& aStreamParameters,
+			TInt aOutputVideoTimeScale, TInt aOutputAudioTimeScale, TInt aAudioFramesInSample);		
+
+        /**
+        * From CComposer Closes the composer instance
+        */
+        TInt Close();
+
+        /**
+        * From CComposer Calculate drive free space 
+        */
+        TInt64 DriveFreeSpaceL();
+
+        /**
+        * Get the Composed Buffer
+        */
+		TUint8* GetComposedBuffer();
+
+		/**
+        * Get the Composed Buffer size till now
+        */
+		TUint GetComposedBufferSize();
+
+		TInt GetMp4SpecificSize(TDesC8& aSrcBuf,TBool aModeChange,TInt aStreamMode);
+
+    private:
+
+		/**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL(const TDesC &aFileName,
+                        CParser::TVideoFormat aVideoFormat,
+                        CParser::TAudioFormat aAudioFormat,
+                        CVedAVCEdit *aAvcEdit);
+                        
+        void ConstructL(RFile* aFileHandle,
+                        CParser::TVideoFormat aVideoFormat,
+                        CParser::TAudioFormat aAudioFormat,
+                        CVedAVCEdit *aAvcEdit);
+                        
+        void SetMediaOptions(CParser::TVideoFormat aVideoFormat, 
+                             CParser::TAudioFormat aAudioFormat,
+                             TUint& aMediaFlag);
+                        
+        void SetComposerOptionsL(CParser::TVideoFormat aVideoFormat, 
+                                 CParser::TAudioFormat aAudioFormat);
+                        
+        TInt GetAVCDecoderSpecificInfoSize(TDesC8& aSrcBuf);
+
+	public: // New Functions 
+
+		/**
+        * Writes audio decoder specific info which is required in case of AAC
+		*
+		* @param aSrcBuf - buffer containing the data to be written(decoder specific informtion)
+        */
+		TInt WriteAudioSpecificInfo(HBufC8*& aSrcBuf);
+
+        /**
+        * Writes audio decoder specific info which is required in case of AAC
+		*
+		* @param aSampleRate Output sample rate of the movie
+        * @param aNumChannels Output num. of audio channels
+        */
+        TInt WriteAudioSpecificInfo(TInt aSampleRate, TInt aNumChannels);
+
+    private:    // Data
+       
+        // The MP4 parser library handle
+        MP4Handle iMP4Handle;
+        mp4_u32 iVideoType;
+		mp4_u32 iAudioType;
+
+         // File server session handle
+        RFs iFS;
+        TBool iFsOpened;
+
+        // Output filename
+        TFileName iOutputMovieFileName;
+
+        // Drive number of the output file
+        TInt iDriveNumber;
+
+        // Remaining free disk space
+        TInt64 iFreeDiskSpace;        
+
+        // Counter to check the real free disk space
+        TUint iFreeDiskSpaceCounter;
+
+		TBool iFirstWrite;
+
+        // for compose buffer
+        TUint8 *iComposeBuffer;
+        mp4_u32 iComposedSize;
+        
+        // For AVC writing
+        TInt iFrameNumber;
+
+	    CVedAVCEdit* iAvcEdit;  // Avc editing instance
+	    
+	    RFile* iFileHandle;
+    };
+
+#endif      // __MP4COMPOSER_H__
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/mp4demux.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,229 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*     
+*
+*/
+/*
+* ============================================================================
+*  Name     : Mp4demux.h
+*  Part of  : Videoplayer
+*  Origin   : 
+*  Created  : Mon Sep 10 13:48:59 2001 by jykokkon
+*  Description:
+*     
+*  Version  :
+*   %version: 3 %, %date_modified: Wed Jan 28 15:16:13 2009 % by %derived_by: mkarimak % 
+* 
+*  ---------------------------------------------------------------------------
+*  Version history:
+*  Template version: 1.02, 21.6.2000 by maparnan
+*  <ccm_history>
+*
+*  Version: 1, Mon Sep 10 13:49:00 2001 by jykokkon
+*  Ref: ?reference_to_reason_doc_if_any (e.g. ActionDb Id)
+*  ?change_reason_comment
+*
+*  </ccm_history>
+* ============================================================================
+*/
+
+#ifndef     __MP4DEMUX_H__
+#define     __MP4DEMUX_H__
+
+//  INCLUDES
+
+#ifndef __DEMULTIPLEXER_H__
+#include "demultiplexer.h"
+#endif
+
+//  FORWARD DECLARATIONS
+
+class CActiveQueue;
+class CStatusMonitor;
+class CMP4Parser;
+
+//  CLASS DEFINITIONS
+
+class CMP4Demux : public CDemultiplexer
+    {    
+    public: // Constants
+    
+        enum TErrorCode
+        {
+            EInternalAssertionFailure = -2300
+        };
+        
+        // The type of data in an output channel
+        enum TChannelDataType
+        {
+            EDataNone = 0,
+            EDataAudio,
+            EDataVideo
+        };
+
+    public: // Data structures
+     
+        // Demux parameters
+        struct TStreamParameters
+        {
+            TUint iPicturePeriodMs;
+            TUint iAudioFramesInSample;
+        };
+
+        // One output channel
+        struct TOutputChannel
+        {        
+            TChannelDataType iDataType;
+            CActiveQueue *iTargetQueue; 
+        };
+        
+        
+    public: // Constructors and destructor
+            
+        /**
+        * Two-phased constructor.
+        */
+
+        static CMP4Demux* NewL(CActiveQueue *anInputQueue,              
+                               TUint aNumChannels, TOutputChannel *aOutputChannels,
+                               TStreamParameters *aParameters,
+                               CStatusMonitor *aStatusMonitor,
+                               CMP4Parser *aParser,                  
+                               TInt aPriority=EPriorityStandard);
+            
+        /**
+        * Destructor.
+        */
+        ~CMP4Demux();
+            
+    public: // New functions
+
+        /**
+        * Read a number of frames to video queue
+        *
+        * @param aCount Number of frames to read
+        * @return Error code
+        */
+        TInt ReadVideoFrames(TInt aCount);
+        
+    public: // Functions from base classes
+        
+        /**
+        * From CDemultiplexer Start demultiplexing        
+        */
+        void Start();
+        
+        /**
+        * From CDemultiplexer Stop demultiplexing        
+        */
+        void Stop();
+        
+        /**
+        * From CDataProcessor Standard active object running method
+        */
+        void RunL();
+        
+        /**
+        * From CDataProcessor Called by the input queue object when 
+        * the input stream has ended
+        * @param aUserPointer user data pointer
+        */
+        void StreamEndReached(TAny *aUserPointer);
+        
+        /**
+        * From CDataProcessor Cancels any asynchronous requests pending    
+        */
+        void DoCancel();
+        
+    private: // Internal methods
+
+        /**
+        * C++ default constructor.
+        */
+        CMP4Demux(CActiveQueue *anInputQueue,              
+                  TUint aNumChannels, TOutputChannel *aOutputChannels,
+                  TStreamParameters *aParameters,
+                  CStatusMonitor *aStatusMonitor,
+                  CMP4Parser *aParser,                  
+                  TInt aPriority);    
+
+        /**
+        * Second-phase constructor
+        */
+        void ConstructL();
+        
+        /**
+        * Select audio/video frame to be demuxed next 
+        * (used when stream is in a local file)
+        */
+        void SetFrameType();
+        
+        /**
+        * Get number of free blocks in target queue        
+        * @return TUint number of blocks
+        */
+        TUint NumFreeBlocks();
+        
+        /**
+        * Get information about next frame from parser        
+        * @return TInt error code
+        */
+        TInt GetFrameInfo();
+        
+        /**
+        * Read next frame(s) from parser & send them to 
+        * decoder        
+        * @return TInt error code
+        */
+        TInt ReadAndSendFrames();    
+        
+    private: // Data
+        CStatusMonitor *iMonitor; // status monitor object
+        CActiveQueue *iInputQueue; // input data queue
+        CMP4Parser *iParser; // MP4 format parser object
+        
+        TUint iNumOutputChannels; // the number of output channels used
+        TOutputChannel *iOutputChannels; // the output channels
+                
+        TBool iGotFrame;       // TRUE if a frame is available
+
+        TUint iBytesDemuxed;  // bytes demuxed during current run
+                
+        TOutputChannel *iVideoChannel; // the channel used for output space checks
+        TOutputChannel *iAudioChannel; // the channel used for output space checks               
+
+        TUint iAudioFramesInSample; // number of audio frames in MP4 sample
+        TUint iPicturePeriodMs;  // average coded picture period
+        
+        TBool iDemultiplexing; // are we demuxing?
+        
+        TUint iFrameLen; // length of next frame to be retrieved 
+        TChannelDataType iFrameType; // type of next frame to be retrieved
+        
+        TBool iAudioEnd;
+        TBool iVideoEnd;
+        TBool iStreamEnd; // has the stream end been reached?
+        TBool iStreamEndDemuxed; // have we demultiplexed everything up to strem end?
+        TBool iReaderSet; // have we been set as a reader to the input queue?
+        TBool iWriterSet; // have we been set as a writer to the output queues?
+        
+        TPtr8 *iInputBlock; // current input queue block                
+        
+    };
+    
+#endif      //  __MP4DEMUX_H__
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/mp4parser.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,304 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for mp4parser.cpp.
+*
+*/
+
+
+
+#ifndef __MP4PARSER_H__
+#define __MP4PARSER_H__
+
+//  INCLUDES
+
+#include "Parser.h"
+#include <mp4lib.h>
+
+// CONSTANTS
+// MACROS
+// DATA TYPES
+// FUNCTION PROTOTYPES
+// FORWARD DECLARATIONS
+
+struct TAudioClipParameters; 
+
+// CLASS DECLARATION
+class CMovieProcessorImpl;
+
+/**
+*  MP4 -format parser class
+*  ?other_description_lines
+*/
+class CMP4Parser : public CParser
+{
+	
+public: // Constants
+	
+	enum TFrameType
+	{
+		EFrameTypeNone = 0,
+			EFrameTypeAudio,
+			EFrameTypeVideo
+	};
+		
+public:  // Constructors and destructor
+	
+	/**
+	* C++ default constructor.
+	*/
+	CMP4Parser();
+	
+	/**
+	* Two-phased constructor.
+	*/
+
+	static CMP4Parser* NewL(CMovieProcessorImpl* aProcessor, const TDesC &aFileName);
+	
+    static CMP4Parser* NewL(CMovieProcessorImpl* aProcessor, RFile* aFileHandle);
+	
+	/**
+	* Destructor.
+	*/
+	~CMP4Parser();
+	
+		
+public: // New functions                        
+	
+    /**
+    * Determine if the file/data inserted is in streamable, i.e. interleaved format
+    * @return TBool ETrue if streamable
+	*/	
+	TInt IsStreamable();                
+	
+	/**
+	* Seek to new position in input file 
+	* @param aPositionInMs Position to be seeked to in milliseconds
+	* @param anAudioTimeAfter audio position in milliseconds after seek
+	* @param aVideoTimeAfter video position in milliseconds after seek
+	* @return TInt error code
+	*/	
+	TInt Seek(TUint32 aPositionInMs, TUint32& anAudioTimeAfter, TUint32& aVideoTimeAfter);        
+	
+	/**
+	* Reads information of next available packet in inserted input data
+	* @param aType Frame type
+    * @param aFrameLength Frame length in bytes
+	* @return TInt error code
+	*/
+    TInt GetNextFrameInformation(TFrameType& aType, TUint& aLength, TBool& aIsAvailable);
+		
+    /**
+    * Read a number of frames of requested type from inserted data or file
+    * @param aDstBuffer Destination buffer
+    * @param aType Type of frame(s) to be read        
+    * @param aNumRead Number of frames actually read
+    * @return TInt error code
+    */		
+    TInt ReadFrames(TDes8& aDstBuffer, TFrameType aType, TUint32& aNumRead, TUint32& aTimeStamp);
+	
+    /**
+    * Initializes the module for AMR audio processing
+	* @param aStartPosition Time to start reading from
+    * @param aEndPosition Ending time for reading
+    * @param aCurrentTime How long has audio been processed so far
+    * @param aAudioOffset Offset from the beginning of movie timeline
+    * @param aAudioPending ETrue if audio operation is pending
+    * @param aPendingAudioDuration Duration for pending audio
+    * @param aAudioClipParameters Audio clip parameter structure
+    *
+	* @return Error code
+	*/		        
+    void InitAudioProcessingL(TInt64 aStartPosition, TInt64 aEndPosition, 
+                              TInt64& aCurrentTime, TInt64 aAudioOffset, 
+                              TBool& aAudioPending, TInt64& aPendingAudioDuration);       
+
+	/**
+	* Gets information about video frames
+	* @param aVideoFrameInfoArray Array to store frame properties
+    * @param aStartIndex Index of the first frame to get properties
+	* @param aSizeOfArray Size of aVideoFrameInfoArray
+	* @return TInt error code
+	*/
+	TInt GetVideoFrameProperties(TFrameInfoParameters* aVideoFrameInfoArray,
+			                     TUint32 aStartIndex, TUint32 aSizeOfArray);		                         
+
+	/**
+	*	Obtains the AAC audio decoder specific info for current clip
+	*   @param aBytes -- buffer to be filled with the info	
+	*	@param aBufferSize -- indicating the maximum size to be allocated
+	*/
+	TInt ReadAudioDecoderSpecificInfoL(HBufC8*& aBytes, TInt aBufferSize);
+
+	/**
+	*	Obtains the AAC audio decoder specific info default for 16khz and LC and Single channel
+	*   @param aBytes -- buffer to be filled with the info	
+	*	@param aBufferSize -- indicating the maximum size to be allocated
+	*/
+	TInt SetDefaultAudioDecoderSpecificInfoL(HBufC8*& aBytes, TInt aBufferSize);
+	
+public: // Functions from base classes           
+	
+    /**
+    * From CParser Writes a block of data for parsing        
+    * @param aBlock Block to be written
+    * @return TInt error code
+	*/
+	TInt WriteDataBlock(const TDes8& aBlock);
+	
+	/**
+	* From CParser Parser the stream header.
+	* @param aStreamParameters Common stream parameters	
+	*/
+	TInt ParseHeaderL(CParser::TStreamParameters& aStreamParameters);
+	
+	/**
+	* From CParser Resets parser to initial state.
+	* @return TInt error code
+	*/     
+		
+	TInt Reset();	
+    
+    /**
+	* From CParser Seek to optimal intra before given time
+	*/       
+
+    TInt SeekOptimalIntraFrame(TTimeIntervalMicroSeconds aStartTime, TInt aIndex, TBool aFirstTime); 
+    
+    /**
+	* From CParser 
+	* Gets the number of frames in current clip
+	*/ 
+    TInt GetNumberOfVideoFrames();
+    TInt GetNumberOfFrames();
+
+    /**
+	* From CParser 
+	* Gets the size of video frame at given index
+	*/ 
+    TInt GetVideoFrameSize(TInt aIndex);
+
+    /**
+	* From CParser 
+	* Gets the timestamp of video frame at given index
+	*/ 
+    TInt GetVideoFrameStartTime(TInt aIndex, TInt* iTimeStamp);
+
+    /**
+	* From CParser 
+	* Gets the type of video frame at given index
+	*/ 
+    TInt8 GetVideoFrameType(TInt aIndex);        
+
+    /**
+	* From CParser Parser the stream header.
+	* @param aAudioFrameSize average frame size of audio frame	
+	*/
+	TInt ParseAudioInfo(TInt& aAudioFrameSize);
+
+	TInt GetMP4SpecificSize();  // added for Mpeg-4 Support 
+
+    /**
+	* From CParser Retrieves  average audio bitrate of current clip
+	* @param aBitrate Average bitrate
+    *
+    * @return error code
+	*/
+    TInt GetAudioBitrate(TInt& aBitrate);
+    
+    /**
+	* From CParser Retrieves average video frame rate of current clip
+	* @param aBitrate Average frame rate
+    *
+    * @return error code
+	*/
+    TInt GetVideoFrameRate(TReal& aFrameRate);    
+    
+    /**
+	* From CParser Returns the size of decoder specific info
+	*
+	* @return size in bytes
+	*/
+    TInt GetDecoderSpecificInfoSize();
+    
+    /**
+	* From CParser Reads AVC decoder specific info to buffer
+	* @param aBuf Destination buffer
+	*
+	* @return error code
+	*/
+    TInt ReadAVCDecoderSpecificInfo(TDes8& aBuf);
+    
+    /**
+	* From CParser Returns the duration of video track in milliseconds
+	* @param aDurationInMs Duration
+	*
+	* @return error code
+	*/
+    TInt GetVideoDuration(TInt& aDurationInMs);    
+	
+private:        
+	
+   /**
+    * By default Symbian OS constructor is private.
+	*/
+	void ConstructL(CMovieProcessorImpl* aProcessor, const TDesC &aFileName);	
+	
+	void ConstructL(CMovieProcessorImpl* aProcessor, RFile* aFileHandle);
+	
+private:  // Internal constants
+	
+	// Stream source type
+	enum TStreamSource
+	{
+		ESourceNone = 0, // not set yet
+	    ESourceFile, // reading from a file
+		ESourceUser // user of this object provides data
+	};        
+
+public:
+	
+	
+private:    // Data
+
+    // video processor instance
+    CMovieProcessorImpl *iProcessor;
+        
+	TStreamSource iStreamSource;        
+	
+	mp4_u32 iVideoType;
+	mp4_u32 iAudioType;
+    
+	TUint iBytesRead;
+		
+	// The MP4 parser library handle
+	MP4Handle iMP4Handle;
+	
+	TFrameType iNextFrameType;
+	TUint iNextFrameLength;
+	
+	TBool iFirstRead;
+	TBool iFirstFrameInfo;
+
+    // Max video frame length & AMR sample size, used for sanity checks to avoid crashes in case of corrupted input
+    TInt iMaxVideoFrameLength;
+    TInt iMaxAMRSampleSize;
+
+    };
+		
+#endif      // __MP4PARSER_H__
+		
+		
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/mpeg4timer.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Definition for CMPEG4Timer.
+*
+*/
+
+
+
+
+#ifndef     __MPEG4TIMER_H__
+#define     __MPEG4TIMER_H__
+
+/* 
+* Includes
+*/
+
+#include <e32base.h>
+#include <gdi.h>
+#include <e32std.h>
+#include "vedcommon.h"
+#include "movieprocessorimpl.h"
+
+/* 
+*  Class Declarations
+*/
+
+class CMPEG4Timer: public CBase
+{
+public:
+
+	 /**
+	 * Public member functions 
+	 */
+
+	 /**
+	 * C++ default constructor
+	 */
+	CMPEG4Timer() {};
+
+	/** 
+	 * Destructor can be called at any time (i.e., also in the middle of a processing operation)
+	 * Should release all allocated resources, including releasing all allocated memory and 
+	 * *deleting* all output files that are currently being processed but not yet completed.
+	 */
+	~CMPEG4Timer();
+
+	 /** 
+	 * Constructors for instantiating new video processors.
+	 * Should reserve as little resources as possible at this point.
+	 */
+	static CMPEG4Timer * NewL(CMovieProcessorImpl * aMovProcessor, TInt aTimeIncrementResolution);
+
+	 /** 
+     * Get the frame duration in millisec from the last frame with modulo base larger than zero 
+     *          
+     * @return Duration in millisec
+	 *
+     */
+	TInt64 GetMPEG4DurationInMsSinceLastModulo();
+
+	 /** 
+     * Update the time stamp and duration of the last frame for MPEG-4 video 
+     *          
+	 * @param aAbsFrameNumber        frame number in the movie
+	 * @param aFrameNumber           frame number in the current video clip
+	 * @param aTimeScale             time scale 
+	 *
+     */
+	void UpdateMPEG4Time(TInt aAbsFrameNumber, TInt aFrameNumber, TInt aTimeScale);
+
+	 /** 
+     * Pointer to iMPEG4TimeStamp object (contains MPEG-4 frame timing information)
+     *          
+     */
+	tMPEG4TimeParameter * GetMPEG4TimeStampPtr() { return &iMPEG4TimeStamp; }
+
+	 /** 
+     * Pointer to iMPEG4TimeResolution object (contains MPEG-4 frame time resolution information)
+     *          
+     */
+	TInt * GetMPEG4TimeResolutionPtr() { return &iMPEG4TimeResolution; }
+
+
+private:
+
+	/* 
+	 * Private member functions 
+	 */
+
+	 /** 
+     * Symbian OS C++ style constructor 
+	 *
+     */
+	void ConstructL(CMovieProcessorImpl * aMovProcessor, TInt aTimeIncrementResolution);
+
+	/* 
+	 * Member variables 
+	 */
+	
+	/* frame duration in millisec from the last frame with modulo base larger than zero */
+	TInt iMPEG4DurationInMsSinceLastModulo;
+
+	/* structure for timing information of MPEG-4 frame */
+	tMPEG4TimeParameter iMPEG4TimeStamp;
+
+	/* time resolution of MPEG-4 video clip */
+	TInt iMPEG4TimeResolution;
+
+	/* video processor object */
+	CMovieProcessorImpl * iProcessor;	
+
+	TInt iPrevModuloTimeBaseVal;
+
+};
+
+#endif      /* __TRANSCODER_H__ */
+            
+/* End of File */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/nrctyp32.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Data type definitions.
+*
+*/
+
+
+#ifndef _NRCTYP32_H_
+#define _NRCTYP32_H_
+
+typedef unsigned char   u_char;
+typedef signed char     int8;
+typedef unsigned char   u_int8;
+typedef short           int16;
+typedef unsigned short  u_int16;
+typedef long            int32;
+typedef unsigned long   u_int32;
+typedef float           float32;
+typedef double          float64;
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/statusmonitor.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Video player status monitor definitions, class CStatusMonitor.
+*
+*/
+
+#ifndef     __STATUSMONITOR_H__
+#define     __STATUSMONITOR_H__
+
+
+//  INCLUDES
+
+#ifndef __E32BASE_H__
+#include <e32base.h>
+#endif
+
+
+//  FORWARD DECLARATIONS
+
+class MVedMovieProcessingObserver;
+class CMovieProcessorImpl;
+class CVedMovie;
+
+
+//  CLASS DEFINITIONS
+
+class CStatusMonitor : public CActive
+{
+public: // constants
+    enum TErrorCode
+    {        
+        EInternalAssertionFailure = -2000,
+        EInvalidStateTransition = -2001
+    };
+
+public: // new functions
+    // Constructors
+    CStatusMonitor(MVedMovieProcessingObserver *anObserver, 
+                   CMovieProcessorImpl *aProcessor, CVedMovie *aMovie,
+                   TInt aPriority=EPriorityHigh);
+
+    void ConstructL();
+
+    // An error has occurred
+    void Error(TInt anErrorCode);
+
+    //  Initialisation for processing has started    
+    void StartPreparing();
+
+    // The processor has been initialized and is ready for processing
+    void PrepareComplete();
+
+    // The processor has been closed
+    void Closed();
+
+    // Processing has been started
+    void ProcessingStarted(TBool aNotifyObserver);
+
+    // Processing progress indication
+    void Progress(TInt aPercentage);
+
+    // Processing has been stopped
+    void ProcessingStopped();
+
+    // The clip end has been reached
+    void ClipProcessed();
+
+    // The movie end has been reached
+    void ProcessingComplete();
+
+    // processing has been cancelled
+    void ProcessingCancelled();
+
+    // A fatal non-recovereable error has occurred
+    void FatalError(TInt anError);
+
+     // dummy
+    void StreamEndReached();
+    
+
+public: // CActive methods
+    ~CStatusMonitor();
+    void RunL();
+    void DoCancel();
+
+    
+private: // Data
+    MVedMovieProcessingObserver *iObserver;
+    CMovieProcessorImpl *iProcessor;
+
+    CVedMovie *iMovie;
+
+    TInt iError; // the error that has been encountered
+    TInt iOutError; // for returning the error to observer
+
+    TBool iProcessingStarted;  // has processing been started ?
+    TBool iProcessing; // are we currently processing ?
+    TBool iCancelled;  // has processing been cancelled ?
+    
+    TBool iClipProcessed; // a video clip has been processed
+    TBool iComplete;  // processing complete => inform observer
+
+    TBool iPrepared; // is the processor open & ready to process ?
+    TBool iPreparing; // is the processor being initialized  ?
+
+     
+};
+
+
+
+#endif      //  __STATUSMONITOR_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/thdwrap.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,393 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header for thdwrap.cpp.
+*
+*/
+
+
+
+#ifndef _MTXWRAP_H_
+#define _MTXWRAP_H_
+
+#include "nrctyp32.h"
+
+typedef void *thdMutex_t;
+typedef void *thdSyncObject_t;
+typedef void *array_t;
+typedef void *thdParamData_t;
+
+
+#define THD_INFINITE -1
+#define THD_TIMEOUT  -1
+#define THD_MESSAGE  -2
+
+/* If THD_DS not defined, define it as nothing */
+#ifndef THD_DS
+#define THD_DS
+#endif
+
+#if defined(__MARM__) && !defined(__stdcall)
+#define __stdcall
+#endif
+
+/* 
+ * Structs and typedefs
+ */
+
+/* This type is used in thdBeginThreadSync to pass the address
+   of the thread main function. */
+typedef unsigned ( __stdcall *thdMainFunction_t )( void * );
+
+
+/****************************************************************************\
+*
+* Function:     thdMutex_t thdCreateMutex( void );
+*
+* Description:  Allocates a mutex handle
+*
+* Returns:      Newly created mutex
+*
+\****************************************************************************/
+
+THD_DS thdMutex_t thdCreateMutex( void );
+
+/****************************************************************************\
+*
+* Function:     int thdDestroyMutex( thdMutex_t handle );
+*
+* Description:  Deallocates a mutex handle
+*
+* Input:        thdMutex_t handle      Handle to be freed
+*
+* Returns:      zero on success, negative on error
+*
+\****************************************************************************/
+
+THD_DS int thdDestroyMutex( thdMutex_t handle );
+
+/****************************************************************************\
+*
+* Function:     int thdEnterMutex( thdMutex_t handle );
+*
+* Description:  Enters a mutex
+*               When a mutex has been entered, it can not be entered by
+*               any other thread before the first one has left it.
+*               One thread can enter mutex many times ("nested"), but it
+*               must always leave the mutex the exactly same number of times.
+*
+* Input:        thdMutex_t handle      Mutex handle to enter
+*
+* Returns:      zero on success, negative on error
+*
+\****************************************************************************/
+
+THD_DS int thdEnterMutex( thdMutex_t handle );
+
+#if(_WIN32_WINNT >= 0x0400)
+/****************************************************************************\
+*
+* Function:     int thdTryMutex( thdMutex_t handle );
+*
+* Description:  Tries to enter a mutex, but does not wait to be able to enter
+*               Note: only available with WinNT 4.0 or above
+*
+* Input:        thdMutex_t handle      Mutex handle to enter
+*
+* Returns:      1 if entered, 0 if not entered, negative on error
+*
+\****************************************************************************/
+
+THD_DS int thdTryMutex( thdMutex_t handle );
+#endif
+
+/****************************************************************************\
+*
+* Function:     int thdLeaveMutex( thdMutex_t handle );
+*
+* Description:  Leaves a mutex
+*
+* Input:        thdMutex_t handle      Mutex handle to leave
+*
+* Returns:      zero on success, negative on error
+*
+\****************************************************************************/
+
+THD_DS int thdLeaveMutex( thdMutex_t handle );
+
+/****************************************************************************\
+*
+* Function:     thdBeginThreadSync
+*               thdCreateThreadSync
+*
+* Description:  Creates a thread with synchronization; ensures that a message
+*               queue exists for the thread immediately after returning from
+*               this function. The main function of the created thread MUST
+*               include a call to thdEnterThreadSync.
+*
+*               The difference between thdBeginThreadSync and 
+*               thdCreateThreadSync is the type of the routine parameter.
+*               If the function is passed as a data pointer (as in
+*               thdCreateThreadSync), the compiler should generate
+*               a warning since this is against ANSI-C. Thus, the usage of
+*               thdBeginThreadSync should be avoided.
+*
+* Input:        routine             Pointer to thread main function
+*               param               Free-form parameter given to thread
+*               id                  Pointer to int to receive thread id
+*
+* Returns:      Handle of the newly created thread, NULL for error
+*
+\****************************************************************************/
+
+THD_DS void * thdBeginThreadSync( thdMainFunction_t routine, 
+   void *param, u_int32 *id );
+THD_DS void * thdCreateThreadSync( void *routine, void *param, 
+   u_int32 *id );
+
+/****************************************************************************\
+*
+* Function:     void *thdEnterThreadSync( void *param );
+*
+* Description:  Creates the message queue and signals the parent thread
+*               the completition.
+*
+* Input:        void *param             The parameter passed to the main
+*
+* Returns:      The free-form parameter that was given to thdCreateThreadSync
+*
+\****************************************************************************/
+
+THD_DS void * thdEnterThreadSync( void *param );
+
+/****************************************************************************\
+*
+* Function:     void thdExitThread( int exitcode );
+*
+* Description:  Terminates the current thread with given exit code.
+*               Note! This function does not return.
+*               (WIN32) :: If thread does not call this function, small
+*                          memory leaks will result
+*
+* Input:        int exitcode            Exit code for thread
+*
+\****************************************************************************/
+
+THD_DS void thdExitThread( int exitcode );
+
+/****************************************************************************\
+*
+* Function:     void thdSetThreadPriority( void *thread, int priority );
+*
+* Description:  Sets thread's priority
+*
+* Input:        void *thread            Thread to set
+*               int priority            Priority number, from -3 to 3,
+*                                       0 is normal priority.
+*
+\****************************************************************************/
+
+THD_DS void thdSetThreadPriority( void *thread, int priority );
+
+/****************************************************************************\
+*
+* Function:     void thdTerminateThread( void *thread, int exitcode );
+*
+* Description:  Terminates a thread immediately
+*
+* Input:        void *thread            Thread handle
+*               int exitcode            Exit code for the thread
+*
+\****************************************************************************/
+
+THD_DS void thdTerminateThread( void *thread, int exitcode );
+
+/****************************************************************************\
+*
+* Function:     thdSyncObject_t thdCreateEvent( void );
+*
+* Description:  Creates an event
+*
+* Returns:      Handle for the event
+*
+\****************************************************************************/
+
+THD_DS thdSyncObject_t thdCreateEvent( void );
+THD_DS thdSyncObject_t thdCreateEvent( array_t *array );
+
+/****************************************************************************\
+*
+* Function:     void thdDestroyEvent( thdSyncObject_t event );
+*
+* Description:  Destroys an event
+*
+* Input:        thdSyncObject_t event        Event to be destroyed
+*
+\****************************************************************************/
+
+THD_DS void thdDestroyEvent( thdSyncObject_t event );
+
+/****************************************************************************\
+*
+* Function:     void thdSetEvent( thdSyncObject_t event );
+*
+* Description:  Sets (signals) an event
+*
+* Input:        thdSyncObject_t event        Event to set
+*
+\****************************************************************************/
+
+THD_DS void thdSetEvent( thdSyncObject_t event );
+
+/****************************************************************************\
+*
+* Function:     void thdResetEvent( thdSyncObject_t event );
+*
+* Description:  Resets (unsignals) an event
+*
+* Input:        thdSyncObject_t event        Event to reset
+*
+\****************************************************************************/
+
+THD_DS void thdResetEvent( thdSyncObject_t event );
+
+/****************************************************************************\
+*
+* Function:     int thdWaitSyncObject( thdSyncObject_t event, int time );
+*
+* Description:  Waits until the given event is signaled, or time limit elapses
+*
+* Input:        thdSyncObject_t event        Event handle to wait
+*               int time                Time limit in ms, -1 = infinite
+*
+* Returns:      Zero if event was signaled, -1 if time limit elapsed
+*
+\****************************************************************************/
+
+THD_DS int thdWaitSyncObject( thdSyncObject_t event, int time );
+
+/****************************************************************************\
+*
+* Function:     int thdWaitManySyncObjects( thdSyncObject_t *events, int count, int time );
+*
+* Description:  Waits until at least one of the given events is signaled, or
+*               time limit elapses
+*
+* Input:        thdSyncObject_t *events Pointer to array of event handles
+*               int count               Number of event handles in array
+*               int time                Time limit in ms, -1 = infinite
+*
+* Returns:      Index of event signaled (>=0) or
+*               THD_TIMEOUT if time limit elapsed
+*
+\****************************************************************************/
+
+THD_DS int thdWaitManySyncObjects( thdSyncObject_t *events, int count, int time );
+
+/****************************************************************************\
+*
+* Function:     int thdWaitManySyncObjectsOrMessage( thdSyncObject_t *events, int count, int time )
+*
+* Description:  Waits until at least one of the given synchronization objects
+*               is signaled, or the time limit elapses, or a message is posted
+*               to thread's message queue.
+*               You can give NULL to events and zero to count to only wait
+*               for messages.
+*
+* Input:        thdSyncObject_t *events Pointer to array of sync. object handles
+*               int count               Number of handles in array
+*               int time                Time limit in ms, -1 = infinite
+*
+* Returns:      Index of event signaled (>=0)
+*               THD_TIMEOUT if time limit elapsed
+*               THD_MESSAGE if a message was posted
+*
+\****************************************************************************/
+
+THD_DS int thdWaitManySyncObjectsOrMessage( thdSyncObject_t *events, int count, int time );
+
+/****************************************************************************\
+*
+* Function:     thdSyncObject_t thdThreadToEvent( void *thread );
+*
+* Description:  Converts a thread handle returned by thdCreateThread into an
+*               event handle that can be waited for with thdWaitSyncObject
+*               This event handle must not be closed!
+*
+* Input:        void *thread            Thread handle
+*
+* Returns:      Event handle
+*
+\****************************************************************************/
+
+THD_DS thdSyncObject_t thdThreadToEvent( void *thread );
+
+/****************************************************************************\
+*
+* Function:     thdSyncObject_t thdCreateSemaphore( int initcount, int maxcount );
+*
+* Description:  Creates a semaphore object.
+*
+* Input:        int initcount           Initial count for semaphore
+*               int maxcount            Maximum count
+*
+* Returns:      Handle of the created semaphore
+*
+\****************************************************************************/
+
+THD_DS thdSyncObject_t thdCreateSemaphore( int initcount, int maxcount );
+THD_DS thdSyncObject_t thdCreateSemaphore( int initcount, int maxcount, array_t *array );
+
+/****************************************************************************\
+*
+* Function:     void thdDestroySemaphore( thdSyncObject_t handle );
+*
+* Description:  Destroys a semaphore object
+*
+* Input:        thdSyncObject_t handle  Handle to close
+*
+\****************************************************************************/
+
+THD_DS void thdDestroySemaphore( thdSyncObject_t handle );
+
+/****************************************************************************\
+*
+* Function:     void thdReleaseSemaphore( thdSyncObject_t handle, int count );
+*
+* Description:  Releases a semaphore
+*
+* Input:        thdSyncObject_t handle  Semaphore to release
+*               int count               Release count
+*
+* Returns:      Previous count
+*
+\****************************************************************************/
+
+THD_DS int thdReleaseSemaphore( thdSyncObject_t handle, int count );
+
+/****************************************************************************\
+*
+* Function:     void thdSleep( int time );
+*
+* Description:  Enters an efficient wait state for a specified time
+*
+* Input:        int time                Time to sleep, in milliseconds
+*
+\****************************************************************************/
+
+THD_DS void thdSleep( int time );
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/videodecoder.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Definition for CVideoDecoder, an abstract base class for all video
+* decoders.
+*
+*/
+
+
+
+#ifndef     __VIDEODECODER_H__
+#define     __VIDEODECODER_H__
+
+
+//  INCLUDES
+
+#ifndef __DECODER_H__
+#include "decoder.h"
+#endif
+
+
+//  CLASS DEFINITIONS
+
+// Decoder base class
+class CVideoDecoder : public CDecoder
+{
+public:
+    CVideoDecoder(TInt aPriority=EPriorityStandard) : CDecoder(aPriority) {};
+    // CDataProcessor provides a virtual destructor
+};
+
+
+#endif      //  __VIDEODECODER_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/videoprocessor.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1003 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Header file for video processor.
+*
+*/
+
+
+#ifndef     __VIDEOPROCESSOR_H__
+#define     __VIDEOPROCESSOR_H__
+
+//  INCLUDES
+#ifndef _H263DAPI_H_
+#include "h263dapi.h"
+#endif
+
+#include "videodecoder.h"
+#include "vedVideoclip.h"
+
+
+//  FORWARD DECLARATIONS
+class CActiveQueue;
+class CStatusMonitor;
+class CMovieProcessorImpl;
+class CVideoEncoder;
+class CVedH263Dec;
+class CMPEG4Timer;
+class CVedAVCEdit;
+
+#include "CTRTranscoderObserver.h"
+#include "CTRTranscoder.h"
+#include "CTRCommon.h"
+#include <CCMRMediaSink.h>
+#include "CTRVideoPictureSink.h"
+
+enum TTransitionColor
+{
+	EColorNone = 0,
+	EColorBlack,
+	EColorWhite,
+	EColorTransition
+};
+
+enum TTransitionPosition
+{
+    EPositionNone = 0,
+    EPositionStartOfClip,
+    EPositionEndOfClip
+};
+
+
+// Threshold for using postfilter. Assumption is that CIF is encoded with high bitrate => no need for postfilter
+const TInt KThrWidthForPostFilter = 176;
+
+//  CLASS DEFINITIONS
+
+
+// Observer class for thumbnail generation
+class MThumbnailObserver
+{
+public:
+    void NotifyThumbnailReady(TInt aError);
+};
+
+class MTimerObserver
+{
+public:
+    virtual void MtoTimerElapsed(TInt aError) = 0;
+    
+};
+
+
+// Timer class to use when waiting for encoding to complete
+class CCallbackTimer : public CActive
+{
+ 
+public:
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCallbackTimer* NewL(MTimerObserver& aObserver);
+    
+    /**
+    * Destructor.
+    */
+    ~CCallbackTimer();
+    
+public:
+    
+    /**
+    * Set timer
+    *
+    * @param aDuration Duration
+    */
+    void SetTimer(TTimeIntervalMicroSeconds32 aDuration);
+    
+     
+    /**
+    * Query whether timer is active
+    *
+    * @return TRUE if timer is pending
+    */
+    inline TBool IsPending() { return iTimerRequestPending; }
+    
+    /**
+    * Cancel timer    
+    */
+    void CancelTimer();
+    
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CCallbackTimer(MTimerObserver& aObserver);
+
+    /**
+    * Symbian 2nd phase constructor 
+    */
+    void ConstructL();
+    
+protected:
+
+    /**
+    * From CActive. 
+    * @param 
+    * @return void
+    */
+    void RunL();
+
+    /**
+    * From CActive. 
+    * @param 
+    * @return void
+    */
+    void DoCancel();
+
+    /**
+    * From CActive. 
+    * @param 
+    * @return void
+    */
+    TInt RunError(TInt aError);
+
+ 
+private:   // Data
+ 
+    MTimerObserver& iObserver;
+    
+    RTimer iTimer;
+    
+    TBool iTimerCreated;    
+    TBool iTimerRequestPending;
+};
+
+
+
+class CVideoProcessor : public CVideoDecoder, public MVideoRenderer, 
+                        public MTRTranscoderObserver, public MTRVideoPictureSink,
+                        public MCMRMediaSink, public MTimerObserver
+
+{
+public: // constants
+    enum TErrorCode
+    {
+        EInternalAssertionFailure = -1400,
+        EDecoderFailure = -1401
+    };
+
+    enum TTimingSource
+    {
+        ETemporalReference = 0,
+        ETimeStamp
+    };
+
+    enum TDecoderFrameOperation
+    {
+        EDecodeAndWrite = 1,
+        EDecodeNoWrite,
+        EWriteNoDecode,
+        ENoDecodeNoWrite
+    }; 
+    
+    enum TTranscoderMode
+    {
+        EDecodeOnly = 1,
+        EFull,
+        EFullWithIM,
+        EUndefined
+    };
+	
+public: // Data structures
+    struct TStreamParameters
+    {
+        TUint iWidth;
+        TUint iHeight;
+        TInt64 iPicturePeriodNsec;
+        TUint iIntraFrequency;
+        TUint iReferencePicturesNeeded; // 0 = disable RPS
+        TUint iNumScalabilityLayers;
+        TUint iLayerFrameRates[8]; // frames per 256 sec
+        TTimingSource iTiming;
+    };
+    
+   
+private: // Data structures
+
+    // structure to store information about frames
+    // in decoding/transcoding progress 
+    struct TFrameInformation
+    {
+        TTranscoderMode iTranscoderMode;
+                
+        TInt iFrameNumber;
+        TInt64 iTimeStamp;  // timestamp in ticks        
+        TBool iEncodeFrame; // ETrue if frame will be encoded        
+        TBool iKeyFrame;  
+        
+        // transition frame info
+        TBool iTransitionFrame;  // is this a transition frame?
+        TBool iFirstTransitionFrame;  // is this the first transition frame in this instance?
+        TTransitionPosition iTransitionPosition;
+        TTransitionColor iTransitionColor;        
+        TInt iTransitionFrameNumber;
+        
+        TBool iModificationApplied; // has intermediate modification been done ?
+        TBool iRepeatFrame; // ETrue for second instance of a color transition frame
+    
+    };
+    
+public: // New functions
+    
+    /**
+    * Two-phased constructor.
+    *
+    * @param anInputQueue Input active queue
+    * @param aStreamParameters Stream parameters
+    * @param aProcessor Video processor object
+    * @param aStatusMonitor Status monitor object
+    * @param aEncoder Video encoder object
+    * @param aPriority Active object priority
+    */
+
+    static CVideoProcessor* NewL(CActiveQueue *anInputQueue,
+                                 CVideoProcessor::TStreamParameters *aStreamParameters,
+                                 CMovieProcessorImpl* aProcessor,
+                                 CStatusMonitor *aStatusMonitor,   
+                                 CVedAVCEdit *aAvcEdit,
+                                 TBool aThumbnailMode,
+                                 TInt aPriority=EPriorityStandard);
+
+
+    /**
+    * Destructor.
+    */
+    ~CVideoProcessor();
+    
+public:  // Functions from base classes
+
+    /**
+    * From CActive Active object running method
+    */
+    void RunL();
+
+    /**
+    * From CActive Active object cancelling method
+    */
+    void DoCancel();  
+
+    /**
+    * From CActive Active object error handling method
+    */
+    TInt RunError(TInt aError);
+    
+    /**
+    * From CDecoder Start video decoding
+    */    
+    void Start();
+
+    /**
+    * From CDecoder Stop video decoding
+    */    
+    void Stop();    
+
+    /**
+    * From CDataProcessor Notifies that input stream has ended
+    */
+    void StreamEndReached(TAny *aUserPointer);
+
+    /**
+    * From CDataProcessor Notifies that new input queue blocks are available
+    */
+    void InputDataAvailable(TAny *aUserPointer);
+
+	/**
+    * From MVideoRenderer Renders a decoded frame
+    */
+	TInt RenderFrame(TAny* aFrame);
+	
+    /**
+    * From MTRTranscoderObserver
+    */
+    void MtroInitializeComplete(TInt aError);
+    
+    /**
+    * From MTRTranscoderObserver
+    */
+    void MtroFatalError(TInt aError);
+    
+    /**
+    * From MTRTranscoderObserver
+    */
+    void MtroReturnCodedBuffer(CCMRMediaBuffer* aBuffer);
+        
+    /**
+    * From MTRTranscoderObserver
+    */
+    void MtroSetInputFrameRate(TReal& aRate);
+        
+    /**
+    * From MTRTranscoderObserver
+    */
+    void MtroAsyncStopComplete();
+    
+    /**
+    * From MTRTranscoderObserver
+    */
+    void MtroSuspend();
+    
+    /**
+    * From MTRTranscoderObserver
+    */
+    void MtroResume();
+    
+    /**	
+    * From MTRVideoPictureSink
+    */  
+    void MtroPictureFromTranscoder(TTRVideoPicture* aPicture);
+    
+     /**	
+     * From MCMRMediaSink
+     */        
+     void WriteBufferL(CCMRMediaBuffer* aBuffer);
+        
+     /**	
+     * From MCMRMediaSink
+     */  
+     TInt SetVideoFrameSize(TSize aSize);
+        
+     /**	
+     * From MCMRMediaSink
+     */  
+     TInt SetAverageVideoBitRate(TInt aBitRate);
+        
+     /**	
+     * From MCMRMediaSink
+     */  
+     TInt SetMaxVideoBitRate(TInt aBitRate);
+        
+     /**	
+     * From MCMRMediaSink
+     */  
+     TInt SetAverageAudioBitRate(TInt aBitRate);
+     
+     /**
+     * From MTimerObserver
+     */
+     void MtoTimerElapsed(TInt aError);
+    
+public:  // New functions
+    
+    /**
+    * Generates a thumbnail image
+    *
+    * @param aYUVDataPtr For returning the thumbnail
+    * @param aFrameIndex Frame index of the thumbnail image
+    *                   -1 means best thumbnail is generated
+    * @param aStartFrameIndex Frame index of the start frame (last intra before thumbnail)    
+    *
+    * @return Error code
+    */
+    
+    /**
+    * Starts generating a thumbnail image
+    *
+    * @param aThumbObserver Observer class
+    * @param aFrameIndex Frame index of the thumbnail image
+    *                   -1 means best thumbnail is generated
+    * @param aStartFrameIndex Frame index of the start frame (last intra before thumbnail)    
+    * @param aFactor Pointer to transcode factor structure
+    *
+    * @return Error code
+    */
+    TInt ProcessThumb(MThumbnailObserver* aThumbObserver, TInt aFrameIndex, 
+                      TInt aStartFrameIndex, TVedTranscodeFactor* aFactor);       
+		          
+    TInt FetchThumb(TUint8** aYUVDataPtr);
+	
+	/**
+	*	Gets the frame number of the current frame 
+	*	
+	*/
+	TInt GetFrameNumber() { return iFrameNumber; };
+
+	/**
+    * Keeps track whether the clip was resolution transcoded 
+	*
+	*/	
+	inline TInt GetChangeResolution() const { return iFullTranscoding; };
+
+	/*	
+	* Checks whether the resynch bit is set if set then resets to zero
+	* 
+	* @return TBool 
+	*/	
+	TBool CheckVosHeaderL(TPtrC8& aBuf);
+	
+	/**
+	 * Gets the transcode factor from the current clip
+	 * @param aFactor For returning the transcode factor
+	 * @return error code
+	 */
+	TInt GetTranscodeFactorL(TVedTranscodeFactor& aFactor);		    
+	
+    /*	
+	* Writes a delayed frame, i.e. a frame which has been buffered
+	* since transcoder has unprocesessed frames that must be written
+	* before this frame		
+	*/	
+	void WriteDelayedFrameL();
+	
+	/*	
+	* Checks if there are any frames waiting to be encoded inside transcoder
+	* @return TBool 
+	*/	
+	TBool IsEncodeQueueEmpty();
+	
+	/* 
+	* Calculates encoding delay based on what kind of frame is 
+	* next in the encoding queue
+	*
+	* @return Delay in microseconds
+	*/
+	TInt GetEncodingDelay();	
+	
+	/* 
+	* Checks if the next frame in processing queue
+	* is being encoded
+	*
+	* @return TBool result
+	*/
+	TBool IsNextFrameBeingEncoded();
+	
+    /* 
+	* Gets MPEG-4 VOS header size in bytes (from encoder)	
+	*
+	* @return TInt VOS size
+	*/
+	TInt GetVosHeaderSize();
+
+private: // internal methods
+
+    /**
+    * C++ default constructor.
+    *
+    * @param anInputQueue Input active queue
+    * @param aStreamParameters Stream parameters
+    * @param aProcessor Video processor object
+    * @param aStatusMonitor Status monitor object
+    * @param aEncoder Video encoder object
+    * @param aPriority Active object priority
+    */
+    CVideoProcessor(CActiveQueue *anInputQueue,
+                    TStreamParameters *aStreamParameters,
+                    CMovieProcessorImpl* aProcessor,
+                    CStatusMonitor *aStatusMonitor,
+                    CVedAVCEdit *aAvcEdit,
+                    TBool aThumbnailMode,
+                    TInt aPriority);
+    
+
+    /** 
+    * Symbian 2nd phase constructor 
+    */
+    void ConstructL();
+
+    /**
+    * Processes one input video frame
+    *
+    * @return ETrue If the current clip has been 
+    *         processed entirely, EFalse if not
+    */
+    TBool ProcessFrameL();
+    
+    /** 
+    * Processes the second frame of a color transition double frame
+    */
+    TBool Process2ndColorTransitionFrameL();
+
+    /**
+    * Read one frame from input queue to internal buffer
+    *
+    * @return ETrue if a complete frame was read, EFalse otherwise.
+    */
+    TInt ReadFrame();
+
+    /**
+    * Reads a H.263 frame from input queue to internal buffer
+    *
+    * @return ETrue if a complete frame was read, EFalse otherwise.
+    */    
+    TBool ReadH263Frame();
+    
+    /**
+    * Reads a MPEG-4 frame from input queue to internal buffer
+    *
+    * @return ETrue if a complete frame was read, EFalse otherwise.
+    */
+    TBool ReadMPEG4Frame();
+    
+    /**
+    * Reads an AVC frame from input queue to internal buffer
+    *
+    * @return ETrue if a complete frame was read, EFalse otherwise.
+    */
+    TBool ReadAVCFrame();
+
+    /**
+    * Checks if a frame has "good" or "legible" quality
+    *
+    * @param aYUVDataPtr Pointer to the frame to be checked
+    *
+    * @return 1 if frame quality is OK, 0 otherwise
+    */
+    TInt CheckFrameQuality(TUint8* aYUVDataPtr);
+
+    /**
+    * Apply color effect on a frame
+    *
+    * @param aColorEffect Effect to be used
+    * @param aYUVDataPtr Pointer to the frame
+    * @param aColorToneYUV for extracting the UV values
+    * @return void
+    */
+    void ApplySpecialEffect(TInt aColorEffect, TUint8* aYUVDataPtr,
+      TInt aColorToneU, TInt aColorToneV);    
+
+    /**
+    * Convert frame operation enumeration to TInt
+    *
+    * @param aFrameOperation Frame operation     
+    *
+    * @return Frame operation as TInt
+    */
+    TInt TFrameOperation2TInt(TDecoderFrameOperation aFrameOperation); 
+
+    /**
+    * Convert color effect enumeration to TInt
+    *
+    * @param aColorEffect Color effect
+    *
+    * @return Color effect as TInt
+    */
+    TInt TColorEffect2TInt(TVedColorEffect aColorEffect);
+
+    /**
+    * Determines transition effect parameters
+    *
+    * @param aTransitionEffect Output: ETrue if transition effect is to be applied
+    * @param aStartOfClipTransition ETrue if starting transition is to be applied
+    * @param aEndOfClipTransition ETrue if ending transition is to be applied
+    * @param aStartTransitionColor Color for starting transition
+    * @param aEndTransitionColor Color for ending transition
+    *
+    * @return Error code
+    */
+    TInt DetermineClipTransitionParameters(TInt& aTransitionEffect,TInt& aStartOfClipTransition,
+			TInt& aEndOfClipTransition,TTransitionColor& aStartTransitionColor,TTransitionColor& aEndTransitionColor);
+
+    
+    /**
+    * Applies fading transition effect to YUV frame
+    *
+    * @param aYUVPtr Pointer to the frame
+    * @param aTransitionPosition 1 = start transition, 2 = end transition
+    * @param aTransitionColor Transition color to be used (EColorWhite/EColorBlack/EColorTransition)
+    * @param aTransitionFrameNumber ordinal number of transition frame (0 - (number of transition frames - 1))
+    *
+    * @return void
+    */
+    void ApplyFadingTransitionEffect(TUint8* aYUVPtr, TTransitionPosition aTransitionPosition,
+                                     TTransitionColor aTransitionColor, TInt aTransitionFrameNumber);
+
+	/**
+    * Applies blending transition effect between YUV frames
+    *
+    * @param aYUVPtr1 Pointer to the frame 1
+    * @param aYUVPtr2 Pointer to the frame 2
+    * @param aRepeatFrame True for the second instance of two frames to be blended
+    * @param aTransitionFrameNumber ordinal number of transition frame (0 - (number of transition frames - 1))
+    *
+    * @return void
+    */
+    void ApplyBlendingTransitionEffect(TUint8* aYUVPtr1,TUint8* aYUVPtr2, TInt aRepeatFrame, 
+                                       TInt aTransitionFrameNumber);
+    
+		
+    /**
+    * Applies sliding transition effect between YUV frames
+    *
+    * @param aYUVPtr1 Pointer to the frame 1
+    * @param aYUVPtr2 Pointer to the frame 2
+    * @param aRepeatFrame True for the second instance of two frames to be blended
+    * @param aTransitionFrameNumber ordinal number of transition frame (0 - (number of transition frames - 1))
+    *
+    * @return void
+    */
+    void ApplySlidingTransitionEffect(TUint8* aYUVPtr1,TUint8* aYUVPtr2, TVedMiddleTransitionEffect aVedMiddleTransitionEffect, 
+                                      TInt aRepeatFrame, TInt aTransitionFrameNumber);
+		
+    /**
+    * Get the start transition info of the next clip
+    *
+    * @return void
+    */
+    void GetNextClipTransitionInfo();
+
+	/*
+	* Resolution Transcoder
+	* Determine if the resolution transcoding will apply to the current clip
+	* 
+	*/
+	TBool DetermineResolutionChange();
+
+    /*
+	* 
+	* Determine if frame rate needs to be changed for the current clip
+	* 
+	*/
+    TBool DetermineFrameRateChange();
+
+    /*
+	* 
+	* Determine if bitrate needs to be changed for the current clip
+	* 
+	*/
+    TBool DetermineBitRateChange();
+    
+    /*	
+	* Calculate the duration of current frame
+	*	
+	* @param aFrameNumber frame number 
+	*
+	* @return Frame duration in ticks
+	*/    
+    TInt GetFrameDuration(TInt aFrameNumber);
+    
+    /*	
+	* Decode frame using vedh263decoder
+	* 
+	* @param aOperation Operation 
+	* @param aModeChanged ETrue if compressed domain transcoding is neede
+	* @param aFrameSizeInBytes Return value, coded output frame size in bytes
+	* @param aVosHeaderSize Return value, size of VOS header in bytes
+	*/  
+    void DecodeFrameL(TInt aOperation, TBool aModeChanged, TInt& aFrameSizeInBytes);        
+    
+    /*
+    * Create and initialize transcoder
+    *
+    * @param aInputType Input video type 
+    * @param aMode Transcoder operational mode to be used
+    *    
+    */
+    void CreateAndInitializeTranscoderL(TVedVideoType aInputType, CTRTranscoder::TTROperationalMode aMode);
+    
+    /*
+    * Determines if compressed domain transcoding is needed
+    *
+    */
+    TBool GetModeChangeL();
+    
+    /*
+    * Processes a thumbnail frame
+    *
+    * @param aFirstFrame ETrue if the first thumbnail frame is being processed
+    */
+    void ProcessThumb(TBool aFirstFrame);
+    
+    /*
+    * Calculate the number of transition frames
+    *
+    * @param aStartCutTime Start cut time
+    * @param aEndCutTime End cut time
+    */
+    void GetNumberOfTransitionFrames(TTimeIntervalMicroSeconds aStartCutTime, 
+                                     TTimeIntervalMicroSeconds aEndCutTime);
+      
+    /*
+    * Set parameters needed to process a transition frame
+    *
+    * @param aIncludedFrameNumber Ordinal counting from the first included frame number
+    * @param aDecodeFrame ETrue if this frame must be decoded in order to apply end transition
+    */                               
+    void SetTransitionFrameParams(TInt aIncludedFrameNumber, TBool& aDecodeFrame);
+    
+    /*
+    * Sets output codec parameters
+    * 
+    * aMimeType Output mime type
+    */
+    void SetOutputVideoCodecL(const TPtrC8& aMimeType);
+    
+    /*
+    * Generates bitstream for a not coded frame
+    * to be used in color transitions
+    */
+    void GenerateNotCodedFrameL();
+    
+    /*
+    * Reads a frame from input queue and writes it to transcoder
+    *
+    */
+	void ReadAndWriteThumbFrame();	
+	
+	/*
+    * Does thumbnail finalization, stops processing and informs observer
+    *
+    * aError Error code for observer
+    */
+	void FinalizeThumb(TInt aError);
+	
+	/*
+    * Writes a frame to output file
+    *  
+    * @param aBuf Buffer containing the frame
+    * @param aDurationInTicks Frame duration in ticks
+    * @param aFrameNumber Frame number
+    * @return ETrue if clip end was written
+    */
+	TBool WriteFrameToFileL(TPtr8& aBuf, TInt aDurationInTicks, TInt aFrameNumber);
+	
+	/*
+    * Writes a frame to transcoder
+    *      
+    * @param aFrameNumber Frame number
+    * @param aKeyFrame ETrue for a keyframe
+    * @param aVolHeaderInBuffer ETrue if frame buffer contains MPEG-4 VOL header
+    */
+	void WriteFrameToTranscoderL(TInt aFrameNumber, TBool aKeyFrame, TBool aVolHeaderInBuffer);
+	
+    /*
+    * Handles a decoded thumbnail frame received from transcoder
+    *      
+    * @param aPicture Pointer to received picture
+    */
+	void HandleThumbnailFromTranscoder(TTRVideoPicture* aPicture);
+	
+	/*
+    * Handles a decoded "decode-only" frame received from transcoder
+    *      
+    * @param aPicture Pointer to received picture
+    * @param aIndex Index of decoded frame to iFrameInfoArray
+    */
+	void HandleDecodeOnlyFrameFromTranscoder(TTRVideoPicture* aPicture, TInt aIndex);
+	
+	/*
+    * Handles a decoded transition frame (intermediate frame) received from transcoder
+    *      
+    * @param aPicture Pointer to received picture
+    * @param aIndex Index of decoded frame to iFrameInfoArray
+    */
+	void HandleTransitionFrameFromTranscoder(TTRVideoPicture* aPicture, TInt aIndex);
+	
+    /*
+    * Inserts AVC/MPEG-4 decoder specific info data in front of internal coded frame buffer
+    *
+    */
+	void InsertDecoderSpecificInfoL();
+
+private: // internal constants
+    enum TDataFormat
+    {
+        EDataUnknown = 0,
+        EDataH263,
+        EDataMPEG4,
+        EDataAVC
+    };
+
+
+private: // data
+    CActiveQueue *iQueue; // input data queue
+    TBool iReaderSet; // have we been set as reader?
+    CStatusMonitor *iMonitor; // status monitor object
+    CMovieProcessorImpl *iProcessor;
+
+    CVedH263Dec *iDecoder;  // H.263/MPEG-4 decoder    
+
+    TUint iVideoWidth, iVideoHeight; // video picture dimensions
+    TInt64 iPicturePeriodNsec; // one PCF tick period in nanoseconds
+    TDataFormat iDataFormat; // the stream data format
+    TUint iIntraFrequency; // intra picture frequency (intras per 256 sec)
+    TUint iReferencePicturesNeeded; // number of reference pictures needed
+    
+    TBool iFirstFrameFlag; // flag for decoder: is this the first frame?
+
+    TDecoderFrameOperation iFrameOperation; 
+
+    TInt iNumberOfIncludedFrames; 
+
+    TBool iDecoding; // are we decoding?
+    TBool iStreamEnd; // has stream end been reached?    
+    TBool iEncoderResetPending; // is the encoder being reseted
+
+    TPtr8 *iBlock; // queue block
+    TUint iBlockPos; // current block position
+    TUint8 *iDataBuffer; // data buffer for the current compressed frame
+    TUint iBufferLength; // buffer total length
+    TUint iDataLength; // amount of data in buffer
+    TUint iCurrentFrameLength; // the length of the current frame in the buffer
+
+    TUint8 *iFrameBuffer;  // Concatenated YUV data for decoded frame
+
+    TUint8 *iOutVideoFrameBuffer; // data buffer for the output compressed frame    
+    TInt iOutVideoFrameBufferLength; // buffer total length
+    TInt iOutDataLength; // amount of data in buffer
+    TPtr8 iWriteDes;  // writing descriptor for encoding
+    TInt iFrameNumber;  // current frame number
+    TInt iNumberOfFrames;  // no. of frames in current clip
+    TInt iPreviousFrameIncluded;  // ETrue if previous frame was included in output movie
+    TInt  iTrPrevious;
+
+    // transition effects
+    TInt iTransitionEffect;	    // is transition effect to be applied?
+    TInt iStartOfClipTransition;  // is starting transition effect to be applied ?
+    TInt iEndOfClipTransition; // is ending transition effect to be applied ?
+
+	TInt iStartNumberOfTransitionFrames;  // number of frames in transition
+	TInt iEndNumberOfTransitionFrames;  // number of frames in transition
+	TInt iTransitionFrameNumber;
+	TInt iNextTransitionNumber;    
+    
+    TInt iFirstFrameInRange;  // is the current frame the first to be included in output movie
+    TInt iFirstIncludedFrameNumber;  // number of first included frame
+    TTransitionColor iStartTransitionColor;	// color for starting transition
+    TTransitionColor iEndTransitionColor;// color for ending transition
+    
+    // number of preceding I frame (for end-of-clip trans.)this number is relative of start-of-clip
+    TInt iLastIntraFrameBeforeTransition; //The last intra frame before transition effect takes place.       
+
+    TTimingSource iTiming;  
+
+	// for transition effect - blending and sliding
+	TInt    iFrameDuration;
+	TBool   iRepeatFrame;
+	TInt64  iTimeStamp;
+	TUint8 *iOrigPreviousYUVBuffer;
+	TUint8 *iColorTransitionBuffer;
+
+	CMPEG4Timer *iMPEG4Timer;		// Stores MPEG-4 timing information
+	
+	CTRTranscoder *iTransCoder;	
+	CCMRMediaBuffer* iMediaBuffer;	
+	
+	TBool iTranscoderInitPending;  // is transcoder init in progress ?
+	TBool iDecodePending;  // is decode in progress ?
+	TBool iTranscoderStarted; // has transcoder been started ?
+	TBool iFrameToEncode;  // should current frame be encoded ? (: could be changed to local for ProcessFrame)	
+	
+	TBool iTransitionFrame;
+	TBool iFirstTransitionFrame;
+	TTransitionPosition iTransitionPosition;
+    TTransitionColor iTransitionColor;	
+    
+    // for color toning
+    TInt   iFirstFrameQp;       // QP for first MPEG4 frame, used for color toning 
+	
+	TBool iFullTranscoding; // Flag to indicate whether current clip needs to be fully
+	                        // transcoded (decode & encode)   
+    
+    TBool iThumbnailMode;   // True if we are generating a thumbnail frame
+    
+    TInt iThumbFrameIndex;  // index of thumbnail to be generated, >= 0 means a specific frame,
+                            // < 0 means the first "good" or "legible" frame
+    TInt iThumbFrameNumber;
+    TInt iFramesToSkip;     // for searching a good thumbnail
+    
+    MThumbnailObserver* iThumbObserver;  // observer for thumbnail operation
+    
+    HBufC8* iDecoderSpecificInfo;  // decoder specific info header read from input stream, to be sent to transcoder
+    TBool iDecoderSpecificInfoSent;  // True if decoder specific info has been sent to transcoder
+    
+    HBufC8* iOutputVolHeader;  // VOL header read from encoder, to be inserted in the first
+                               // encoded frame buffer
+                               
+    TBool iOutputVolHeaderWritten;  // True if VOL/AVC header has been written to output bitstream
+    
+    RArray<TFrameInformation> iFrameInfoArray;  // array for storing info about frames in progress
+    
+    TTranscoderMode iTranscoderMode;  // current transcoder operation mode
+
+    // used & max frame size, and info if size can be arbitrary    
+    TSize iMaxOutputResolution;
+    TBool iArbitrarySizeAllowed;
+
+    // max allowed frame rate
+    TReal32 iMaxOutputFrameRate;           
+
+	// target and max allowed bit rate
+	TInt iOutputBitRate;
+	TInt iMaxOutputBitRate;        
+	
+	// Mime type for encoded data
+    TBuf8<256> iOutputMimeType;
+    
+    TBool iDelayedWrite;  // True if a frame has to be stored for later writing since
+                          // there are frames inside the transcoder that have to be written
+                          // before this frame
+    HBufC8* iDelayedBuffer;  // buffer for storing the frame  
+    TInt64 iDelayedTimeStamp;  // timestamp
+    TBool iDelayedKeyframe;  // is it a keyframe            
+
+    TInt iTimeStampIndex;  // index for reading stored timestamps in case of color transition
+    TBool iFirstColorTransitionFrame;  // True if we are processing the first frame of a
+                                       // 'doubled' frame in color transitions
+    
+    TInt iTimeStampOffset;  // offset to be added to timestamps, got from processor
+    
+    CCallbackTimer* iTimer;  // timer for waiting encoding to complete
+    
+    TBool iStreamEndRead;
+    
+    TBool iProcessingComplete;
+    
+    TInt iInputMPEG4ProfileLevelId;  // profile-level id for MPEG-4 input
+    
+    // Timer timeout, depends on codec and resolution
+    TUint iMaxEncodingDelay;
+    
+    TInt iNumThumbFrameSkips;  // number of frame skip cycles done to get a 
+                               // a good thumbnail
+                               
+    TTimeIntervalMicroSeconds iPreviousTimeStamp; // timestamp of previous frame        
+
+    TInt iSkippedFrameNumber;  // frame number of skipped frame
+    
+    TInt64 iCutInTimeStamp;  // timestamp of cut-in point, needed in color transitions
+    
+    TBool iDecodingSuspended;  // flag for suspended decoding
+    
+    HBufC8* iNotCodedFrame;  // buffer for not coded frame
+    
+    TInt iInputTimeIncrementResolution;  // MPEG-4 time increment resolution from input clip
+    
+    TBool iFirstFrameAfterTransition;  // True for first frame after start transition
+    
+    TBool iFirstRead;  // True for first read frame        
+
+    TBool iThumbDecoded;  // flag for indicating when a thumb has been decoded,
+                          // needed in AVC thumbnail generation
+    
+    TInt iInputAVCLevel;  // level of input AVC clip
+    
+    TInt iFrameLengthBytes;  // number of bytes used for NAL length in input
+    TInt iThumbFramesToWrite;  // number of thumb frames to write to transcoder
+    
+    CVedAVCEdit* iAvcEdit;  // AVC editing instance
+    
+    TBool iEncodeUntilIDR;  // Flag for encoding until IDR  
+
+    TBool iIsThumbFrameBeingCopied;  // True if thumbnail frame has been sent for
+                                     // decoding, but MtroReturnCodedBuffer hasn't been called
+                                     
+    TInt iModifiedFrameNumber;  // frame number modification for AVC decoder, 
+                                // used with color transitions    
+                                
+    TInt iMaxItemsInProcessingQueue;  // Maximum number of frames kept in transcoder
+                                      // processing queue
+                                      
+    TInt iLastWrittenFrameNumber;  // number of last written frame    
+    
+    TInt iDelayedFrameNumber;  // number of delayed frame
+    
+    TBool iInitializing;  // True when initialisation is ongoing
+    TVedVideoBitstreamMode iInputStreamMode;    //MPEG-4 bitstream mode in input clip
+};
+
+#endif      //  __VIDEOPROCESSOR_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/yuv2rgb12.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* YUV to EColor4K colorspace converter concrete classes. 
+*
+*/
+
+    
+
+#ifndef     __YUV2RGB12_H__
+#define     __YUV2RGB12_H__
+
+
+//  INCLUDES
+
+#ifndef __YUVCONVERTER_H__
+#include "yuvconverter.h"
+#endif
+
+
+//  CLASS DEFINITIONS
+
+// Normal YUV to Rgb12 with dither
+class CYuv2Rgb12 : public CYuvConverter
+{
+public: // CYuvConverter methods
+    // Constructors & destructor
+    CYuv2Rgb12();
+    ~CYuv2Rgb12();
+    void ConstructL(TUint aWidth, TUint aHeight, TUint aMaxWidth, TUint aMaxHeight);
+    void SetGamma(TInt aGamma);
+    void SetBrightnessContrast(TInt aBCIndex);
+    void Convert(const TUint8 *aYBuf, const TUint8 *aUBuf,
+                 const TUint8 *aVBuf,
+                 TUint aBufWidth, TUint aBufHeight,
+                 TUint8 *aTarget, TUint aTargetScanlineLength);
+
+protected: // Data
+    enum
+    {
+        ESaturateOffset = 222,    //saturation table offset; min value (when U == 0, Y == 0) is -222 
+        ESaturateLength = 476+12+ESaturateOffset  //table length; max value (when U == 255, Y == 255) is 476+12(dither)
+    };
+    TUint8 *iRgbLookupTable; // RGB clamp/gamma lookup table
+    TUint iWidth, iHeight, iCropWidth, iCropHeight;
+    TInt iGamma;
+    TInt iBrightnessContrast;
+};
+
+
+
+
+#endif      //  __YUV2RGB12_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/yuv2rgb24.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* YUV to EColor16M colorspace converter concrete classes. 
+*
+*/
+
+    
+
+#ifndef     __YUV2RGB24_H__
+#define     __YUV2RGB24_H__
+
+
+//  INCLUDES
+
+#ifndef __YUVCONVERTER_H__
+#include "yuvconverter.h"
+#endif
+
+
+//  CLASS DEFINITIONS
+
+// Normal YUV to Rgb24
+class CYuv2Rgb24 : public CYuvConverter
+{
+public: // CYuvConverter methods
+    // Constructors & destructor
+    CYuv2Rgb24();
+    ~CYuv2Rgb24();
+    void ConstructL(TUint aWidth, TUint aHeight, TUint aMaxWidth, TUint aMaxHeight);
+
+    void SetGamma(TInt aGamma);
+    void SetBrightnessContrast(TInt aBCIndex);
+    void Convert(const TUint8 *aYBuf, const TUint8 *aUBuf,
+                 const TUint8 *aVBuf,
+                 TUint aBufWidth, TUint aBufHeight,
+                 TUint8 *aTarget, TUint aTargetScanlineLength);
+
+protected: // Data
+    enum
+    {
+        ESaturateOffset = 276, // saturation table offset
+        ESaturateLength = 561+ESaturateOffset // table length
+    };
+    TUint8 *iRgbLookupTable; // RGB clamp/gamma lookup table
+    TUint iWidth, iHeight, iCropWidth, iCropHeight;
+    TInt iGamma;
+    TInt iBrightnessContrast;
+};
+
+
+
+
+#endif      //  __YUV2RGB24_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/inc/yuvconverter.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* The YUV-to-something converter base class CYuvConverter definition.
+*
+*/
+
+    
+
+#ifndef     __YUVCONVERTER_H__
+#define     __YUVCONVERTER_H__
+
+
+//  INCLUDES
+
+#ifndef __E32BASE_H__
+#include <e32base.h>
+#endif
+
+
+//  CLASS DEFINITIONS 
+
+class CYuvConverter : public CBase
+{
+public:
+    // CBase provides a virtual destructor
+
+    // Second-phase constructor
+    virtual void ConstructL(TUint aWidth, TUint aHeight, TUint aMaxWidth, TUint aMaxHeight) = 0;
+
+    // Set conversion gamma
+    virtual void SetGamma(TInt aGamma) = 0;
+
+    // Set Brightness & Contrast setting. All yuv2rgb classes may not support.
+    // This might suit better than SetGamma for displays typically used in Series60 devices.
+    virtual void SetBrightnessContrast(TInt ) { };
+
+    // Do the conversion
+    virtual void Convert(const TUint8 *aYBuf, const TUint8 *aUBuf,
+                         const TUint8 *aVBuf,
+                         TUint aBufWidth, TUint aBufHeight,
+                         TUint8 *aTarget, TUint aTargetScanlineLength) = 0;
+};
+
+#endif      //  __YUVCONVERTER_H__
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/SizeEstimate.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,747 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation for size estimate.
+*
+*/
+
+
+// Include Files
+
+#include "SizeEstimate.h"
+#include "movieprocessorimpl.h"
+#include "AudSong.h"
+#include "VedMovieImp.h"
+#include "VedVideoClipInfoImp.h"
+#include "VedVideoClipGenerator.h"
+#include "vedaudiosettings.h"
+
+
+
+// An assertion macro wrapper to clean up the code a bit
+#define VPASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CSizeEstimate"), CMovieProcessorImpl::EInvalidInternalState))
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSizeEstimate* CSizeEstimate::NewL(CMovieProcessorImpl* aProcessor) 
+    {
+    CSizeEstimate* self = NewLC(aProcessor);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CSizeEstimate* CSizeEstimate::NewLC(CMovieProcessorImpl* aProcessor)
+    {
+	CSizeEstimate* self = new (ELeave) CSizeEstimate(aProcessor);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::CSizeEstimate
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSizeEstimate::CSizeEstimate(CMovieProcessorImpl* aProcessor)
+    {
+    iProcessor = aProcessor;
+    }
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::~CSizeEstimate
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CSizeEstimate::~CSizeEstimate()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSizeEstimate::ConstructL()
+    {	
+    }
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::GetMovieSizeEstimateL
+// Calculates file size estimate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSizeEstimate::GetMovieSizeEstimateL(const CVedMovie* aMovie, TInt& aFileSize) 
+    {
+    TInt i = 0;
+    TInt j = 0;
+    
+    TInt videoDataSize = 0;
+    TInt audioDataSize = 0;
+    TInt video3gpSize = 0;
+    TInt audio3gpSize = 0;
+    TInt numberOfVideoFrames = 0; 
+    
+    const CVedMovieImp* movie = reinterpret_cast<const CVedMovieImp *>(aMovie); 
+    
+    TInt movieBitrate = movie->VideoStandardBitrate();
+    if (movieBitrate < KSELowBitrateLimit)
+        {
+        // Adjust low bit rates to slightly higher
+        movieBitrate += KSELowBitrateIncrement;
+        }
+    
+    TInt numberOfVideoClips = movie->VideoClipCount();
+    
+    // Calculate video data size from all clips
+    for (i = 0; i < numberOfVideoClips; i++) 
+        {
+        CVedVideoClip* vedClip = movie->VideoClip(i);
+        TInt videoClipSize = 0;
+        
+        // Get the number of video frames in the clip
+        TInt videoFramesInClip = 0;
+        if (vedClip->Info()->Class() == EVedVideoClipClassGenerated)
+            {
+            videoFramesInClip = vedClip->Info()->Generator()->VideoFrameCount(); 
+            }
+        else
+            {
+            videoFramesInClip = vedClip->Info()->VideoFrameCount(); 
+            }
+            
+        if (videoFramesInClip <= 0)
+            {
+            // No video frames in clip, check next one
+            continue;
+            }
+        
+        if (vedClip->Info()->Class() == EVedVideoClipClassGenerated)
+            {
+            TInt startTransitionFrames = 0;
+            TInt endTransitionFrames = 0;
+            
+            // Get the number of transition frames in the clip
+            GetTransitionFrames(movie, i, startTransitionFrames, endTransitionFrames);
+            
+            // Calculate the size of the transition frames and add to video clip size     
+            TInt transitionLength = (TInt) (1000000.0 / (TReal) movie->MaximumFramerate()) * (startTransitionFrames + endTransitionFrames);  
+            videoClipSize += (transitionLength * movieBitrate) / 8 / 1000000;
+            
+            // Calculate the size of the non-transition frames and add to video clip size
+            TInt nonTransitionFrames = videoFramesInClip - startTransitionFrames - endTransitionFrames;
+            
+            if (nonTransitionFrames > 0)
+                {
+                // The first one is intra and the rest are inter frames
+                videoClipSize += GetGeneratedFrameSize(movie, ETrue);
+                videoClipSize += GetGeneratedFrameSize(movie, EFalse) * (nonTransitionFrames - 1);
+                }
+            
+            // Add clip size to video data size    
+            videoDataSize += videoClipSize;
+            numberOfVideoFrames += videoFramesInClip;
+            
+            // All done for this clip, go to next one
+            continue;
+            }
+        
+        // Calculate the frame rate of the source clip       
+        TReal videoClipFramerate = 1.0;                  
+        if (vedClip->Info()->Duration().Int64() != 0)
+            {
+            videoClipFramerate = (TReal) videoFramesInClip  * 1000000.0 /
+                                 I64REAL(vedClip->Info()->Duration().Int64());
+            }
+            
+        if (vedClip->Info()->Resolution() == movie->Resolution() &&
+            vedClip->Info()->VideoType() == movie->VideoType() &&
+            videoClipFramerate < (TReal) movie->MaximumFramerate() + 0.2)
+            {
+            // Clip is not transcoded => calculate the clip size using the frame sizes of the original clip
+            TInt64 frameTime = 0;
+            TInt64 videoClipCutInTime = vedClip->CutInTime().Int64();
+            TInt64 videoClipCutOutTime = vedClip->CutOutTime().Int64();
+        
+            for (j = 0; j < videoFramesInClip; j++) 
+                {
+                frameTime = vedClip->Info()->VideoFrameStartTimeL(j).Int64();
+                
+                if (frameTime < videoClipCutInTime)
+                    {
+                    continue;   // Frame is before cut in position => check next one
+                    }
+                else if (frameTime >= videoClipCutOutTime)
+                    {
+                    break;      // Cut out position reached => no need to check frames anymore
+                    }
+                
+                // Add frame size to video clip size
+                videoClipSize += vedClip->Info()->VideoFrameSizeL(j);
+                numberOfVideoFrames++;
+                }
+            
+            // Check if color effect is in use    
+            if (vedClip->ColorEffect() != EVedColorEffectNone)
+                {
+                // Color tone effects decreases the size of the frames slightly
+                videoClipSize -= (TInt) ((TReal) videoClipSize * KSEBWReductionFactor);
+                }
+            }
+        else    // Clip is transcoded
+            {
+            TInt estimatedBitrate = movieBitrate;
+            
+            // If we are transcoding a low quality clip to high quality (e.g. QCIF to VGA)
+            if (movieBitrate >= KSEHighBitrateLimit &&
+                movie->Resolution().iWidth > vedClip->Info()->Resolution().iWidth * 3  &&
+                videoClipFramerate < (TReal) movie->MaximumFramerate() * 0.5 + 0.2)
+                {
+                // Halve the estimated bit rate if the source frame rate is 
+                // roughly less than half of the maximum frame rate
+                estimatedBitrate = estimatedBitrate >> 1;
+                }
+            
+            // Clip frame rate can be decreased if necessary but not increased    
+            TReal estimatedFramerate = Min(videoClipFramerate, (TReal) movie->MaximumFramerate());
+            
+            // Calculate the clip length
+            TInt64 videoClipLength = vedClip->CutOutTime().Int64() - vedClip->CutInTime().Int64();
+            
+            // Calculate clip size
+            videoClipSize = I64INT((videoClipLength * (TInt64) estimatedBitrate) / 8 / 1000000);
+            
+            // Calculate the number of frames included between cut in and cut out
+            numberOfVideoFrames += (TInt) (I64REAL(videoClipLength * estimatedFramerate) / 1000000.0);
+            }
+        
+        // Add clip size to video data size    
+        videoDataSize += videoClipSize;
+        }
+            
+    // Calculate video 3gp size
+    video3gpSize = GetVideo3gpSizePerFrame(numberOfVideoFrames) * numberOfVideoFrames;
+    
+    // Check if there's any audio
+    if (movie->AudioType() != EVedAudioTypeNoAudio)
+        {
+        // Calculate audio data size
+        CAudSong* song = ((CVedMovieImp*)aMovie)->Song();
+        audioDataSize = song->GetFrameSizeEstimateL(TTimeIntervalMicroSeconds(0), movie->Duration());
+        
+        if (audioDataSize > 0)
+            {
+            // Calculate audio 3gp size
+            TReal numberOfAudioFrames = I64REAL(aMovie->Duration().Int64() / song->GetFrameDurationMicro());
+            TReal numberOfAudioSamples = numberOfAudioFrames / (TReal) iProcessor->GetAudioFramesInSample();
+            
+            audio3gpSize = (TInt) (GetAudio3gpSizePerSample(numberOfAudioSamples) * numberOfAudioSamples); 
+            }
+        }
+        
+    // Calculate final estimated file size
+    aFileSize = videoDataSize + audioDataSize + video3gpSize + audio3gpSize + KSEFixedSize; 
+    return KErrNone;              
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::GetMovieSizeEstimateForMMSL
+// Calculates file size estimate for MMS use
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CSizeEstimate::GetMovieSizeEstimateForMMSL(const CVedMovie* aMovie, TInt aTargetSize, 
+                                                  TTimeIntervalMicroSeconds aStartTime, 
+                                                  TTimeIntervalMicroSeconds& aEndTime) 
+    {
+    TInt i = 0;
+    TInt j = 0;
+    
+    TInt videoDataSize = 0;
+    TInt audioDataSize = 0;
+    TInt video3gpSize = 0;
+    TInt audio3gpSize = 0;
+    TInt numberOfVideoFrames = 0;
+    TReal numberOfAudioSamples = 0.0;
+    TInt64 currentTime = aStartTime.Int64(); 
+    
+    CVedVideoClip* vedClip = 0;
+    CAudSong* song = ((CVedMovieImp*)aMovie)->Song();
+    const CVedMovieImp* movie = reinterpret_cast<const CVedMovieImp *>(aMovie);
+    
+    TReal audioDurationToSamplesFactor = 1.0 / (I64REAL(song->GetFrameDurationMicro()) * (TReal) iProcessor->GetAudioFramesInSample());
+
+    TInt movieBitrate = movie->VideoStandardBitrate();
+    if (movieBitrate < KSELowBitrateLimit)
+        {
+        // Adjust low bit rates to slightly higher
+        movieBitrate += KSELowBitrateIncrement;
+        }
+        
+    TInt numberOfVideoClips = movie->VideoClipCount();
+    
+    // Find first clip included in the output 
+    TInt startClipNumber = 0;
+    for (i = 1; i < numberOfVideoClips; i++, startClipNumber++) 
+        { 
+        vedClip = movie->VideoClip(i); 
+         
+        if (aStartTime < vedClip->StartTime())
+            {
+            break;
+            }
+        }
+    
+    // Go through all the clips    
+    for (i = startClipNumber; i < numberOfVideoClips; i++) 
+        { 
+        vedClip = movie->VideoClip(i);
+        
+        // Get the number of video frames in the clip
+        TInt videoFramesInClip = 0;
+        if (vedClip->Info()->Class() == EVedVideoClipClassGenerated)
+            {
+            videoFramesInClip = vedClip->Info()->Generator()->VideoFrameCount(); 
+            }
+        else
+            {
+            videoFramesInClip = vedClip->Info()->VideoFrameCount(); 
+            }
+            
+        if (videoFramesInClip <= 0)
+            {
+            // No video frames in clip, check next clip
+            continue;
+            }
+        
+        // Calculate the frame rate of the source clip        
+        TReal videoClipFramerate = 1.0;                  
+        if (vedClip->Info()->Duration().Int64() != 0)
+            {
+            videoClipFramerate = (TReal) videoFramesInClip  * 1000000.0 /
+                                 I64REAL(vedClip->Info()->Duration().Int64());
+            }
+
+        TInt videoFrameSize = 0;    
+        TInt64 frameTime = 0;
+        TInt64 frameDuration = 0;
+        TInt64 videoClipCutInTime = vedClip->CutInTime().Int64();
+        TInt64 videoClipCutOutTime = vedClip->CutOutTime().Int64();
+        currentTime = vedClip->StartTime().Int64();
+        
+        TInt startTransitionFrames = 0;
+        TInt endTransitionFrames = 0;
+        
+        // Check if clip needs to be transcoded
+        TBool clipIsTranscoded = EFalse;
+        if (vedClip->Info()->Class() == EVedVideoClipClassFile)
+            {
+            if (!(vedClip->Info()->Resolution() == movie->Resolution() &&
+                  vedClip->Info()->VideoType() == movie->VideoType() &&
+                  videoClipFramerate < (TReal) movie->MaximumFramerate() + 0.2))
+                {
+                clipIsTranscoded = ETrue;
+                }
+            }
+        else
+            {
+            // Get the number of transition frames in the clip
+            GetTransitionFrames(movie, i, startTransitionFrames, endTransitionFrames);
+            }
+            
+        TInt estimatedBitrate = movieBitrate;
+            
+        // If we are transcoding a low quality clip to high quality (e.g. QCIF to VGA)
+        if (movieBitrate >= KSEHighBitrateLimit &&
+            movie->Resolution().iWidth > vedClip->Info()->Resolution().iWidth * 3  &&
+            videoClipFramerate < (TReal) movie->MaximumFramerate() * 0.5 + 0.2)
+            {
+            // Halve the estimated bit rate if the source frame rate is 
+            // roughly less than half of the maximum frame rate
+            estimatedBitrate = estimatedBitrate >> 1;
+            }
+        
+        if (i == startClipNumber)
+            {
+            // We need to adjust the cut in time for the first clip since the client
+            // requested to get the size estimate starting from this position
+            videoClipCutInTime = aStartTime.Int64() - vedClip->StartTime().Int64();
+            
+            // Initialize the current time to this position 
+            currentTime = aStartTime.Int64();
+            }
+    
+        // Estimate the size on every frame
+        for (j = 0; j < videoFramesInClip; j++) 
+            {
+            // Get frame start time and duration
+            if (vedClip->Info()->Class() == EVedVideoClipClassFile)
+                {
+                frameTime = vedClip->Info()->VideoFrameStartTimeL(j).Int64();
+                frameDuration = vedClip->Info()->VideoFrameDurationL(j).Int64();
+                }
+            else
+                {
+                frameTime = vedClip->Info()->Generator()->VideoFrameStartTime(j).Int64();
+                frameDuration = vedClip->Info()->Generator()->VideoFrameDuration(j).Int64();
+                }
+                
+            if (frameTime < videoClipCutInTime)
+                {
+                continue;   // Frame is before cut in position => check next one
+                }
+            else if (frameTime >= videoClipCutOutTime)
+                {
+                break;      // Cut out position reached => no need to check frames anymore
+                }
+            
+            // Check that duration is valid    
+            if ((frameDuration <= 0) || (frameDuration > KSEMaxFrameDuration))
+                {
+                // Calculate frame duration from the frame rate
+                frameDuration = (TInt64) (1000000.0 /  videoClipFramerate);
+                }
+                
+            // Check for slow motion
+            if (vedClip->Speed() != KVedNormalSpeed)
+                {
+                frameDuration = (frameDuration * KVedNormalSpeed) / vedClip->Speed();
+                }
+            
+            if (clipIsTranscoded)
+                {
+                // Clip is transcoded so calculate frame size from estimated bit rate           
+                videoFrameSize = I64INT((frameDuration * estimatedBitrate) / 8 / 1000000);
+                }
+            else
+                {
+                if (vedClip->Info()->Class() == EVedVideoClipClassGenerated)
+                    {
+                    // Check if the frame is a transition frame
+                    if (j < (startTransitionFrames - 1) ||
+                        j > (videoFramesInClip - endTransitionFrames))
+                        {
+                        // Frame is encoded so calculate frame size from movie bit rate 
+                        videoFrameSize = I64INT((frameDuration * movieBitrate) / 8 / 1000000);
+                        }
+                    else
+                        {
+                        // Frame is intra if it's the first one in the clip
+                        // or if it's right after or before transition
+                        TBool isIntra = j == 0 || j == (startTransitionFrames - 1) || j == (videoFramesInClip - endTransitionFrames);
+                        videoFrameSize = GetGeneratedFrameSize(movie, isIntra);
+                        }  
+                    }
+                else
+                    {
+                    // Get frame size from the original clip
+                    videoFrameSize = vedClip->Info()->VideoFrameSizeL(j);
+                    
+                    // Check if color effect is in use    
+                    if (vedClip->ColorEffect() != EVedColorEffectNone)
+                        {
+                        // Color tone effects decreases the size of the frame slightly
+                        videoFrameSize -= (TInt) ((TReal) videoFrameSize * KSEBWReductionFactor);
+                        }
+                    }
+                }
+            
+            // Calculate video data size
+            videoDataSize += videoFrameSize;
+            
+            // Calculate video 3gp size
+            numberOfVideoFrames++;
+            video3gpSize = GetVideo3gpSizePerFrame(numberOfVideoFrames) * numberOfVideoFrames;
+            
+            if (movie->AudioType() != EVedAudioTypeNoAudio)
+                {
+                // Calculate audio data size
+                audioDataSize += song->GetFrameSizeEstimateL(currentTime, currentTime + frameDuration);
+                
+                if (audioDataSize > 0)
+                    {
+                    // Calculate audio 3gp size
+                    numberOfAudioSamples += I64REAL(frameDuration) * audioDurationToSamplesFactor;
+                    audio3gpSize = (TInt) (GetAudio3gpSizePerSample(numberOfAudioSamples) * numberOfAudioSamples); 
+                    }
+                }
+                
+            // Check if target size is reached        
+            if (videoDataSize + audioDataSize + video3gpSize + audio3gpSize + KSEFixedSize >= aTargetSize)
+                {
+                aEndTime = currentTime;
+                
+                // Make sure we didn't overflow the end time
+                if (aEndTime > movie->Duration())
+                    {
+                    aEndTime = movie->Duration();
+                    }
+                
+                return KErrNone;
+                }
+            
+            // Increase time to the next frame    
+            currentTime += frameDuration;
+            }
+        }
+        
+    // Check if audio is longer than video
+    TInt64 remainingAudioDuration = 0;
+
+    if (numberOfVideoClips > 0)
+        {
+        remainingAudioDuration = movie->Duration().Int64() - 
+            movie->VideoClip(numberOfVideoClips - 1)->EndTime().Int64();	
+        
+        // Adjust current time to the end of the last clip 
+        currentTime = movie->VideoClip(numberOfVideoClips - 1)->EndTime().Int64();
+        }
+    else 
+        {
+        remainingAudioDuration = aMovie->Duration().Int64(); 
+        }
+        
+    if (remainingAudioDuration > 0)
+        {
+        // Estimate how many black frames are inserted
+        TInt frameDuration = KSEBlackFrameDuration;
+        TInt blackVideoFrames = (TInt) (remainingAudioDuration / frameDuration) + 1;
+        
+        for (j = 0; j < blackVideoFrames; j++) 
+            {           
+            // Calculate video data size
+            TBool isIntra = j == 0;
+            videoDataSize += GetBlackFrameSize(movie, isIntra);  
+            
+            // Calculate video 3gp size
+            numberOfVideoFrames++; 
+            video3gpSize = GetVideo3gpSizePerFrame(numberOfVideoFrames) * numberOfVideoFrames;
+            
+            // Calculate audio data size
+            audioDataSize += song->GetFrameSizeEstimateL(currentTime, currentTime + frameDuration);
+            
+            // Calculate audio 3gp size
+            numberOfAudioSamples += (TReal) frameDuration * audioDurationToSamplesFactor;
+            audio3gpSize = (TInt) (GetAudio3gpSizePerSample(numberOfAudioSamples) * numberOfAudioSamples);
+            
+            // Check if target size is reached        
+            if (videoDataSize + audioDataSize + video3gpSize + audio3gpSize + KSEFixedSize >= aTargetSize)
+                {              
+                aEndTime = currentTime;
+                
+                // Make sure we didn't overflow the end time
+                if (aEndTime > movie->Duration())
+                    {
+                    aEndTime = movie->Duration();
+                    }
+                
+                return KErrNone;
+                }
+                
+            currentTime += frameDuration;
+            }
+        }
+
+    // Target size not reached till end of movie
+    aEndTime = movie->Duration();
+
+    return KErrNone; 
+    } 
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::GetTransitionFrames
+// Returns the number of start and end transition frames in given clip
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+void CSizeEstimate::GetTransitionFrames(const CVedMovieImp *aMovie, TInt aIndex,
+                                        TInt& aStartTransitionFrames, TInt& aEndTransitionFrames)
+    {
+    aStartTransitionFrames = 0;
+    aEndTransitionFrames = 0;
+    
+    CVedVideoClip* vedClip = aMovie->VideoClip(aIndex);
+    
+    // Get the number of video frames in the clip    
+    TInt videoFramesInClip = 0;
+    if (vedClip->Info()->Class() == EVedVideoClipClassGenerated)
+        {
+        videoFramesInClip = vedClip->Info()->Generator()->VideoFrameCount(); 
+        }
+    else
+        {
+        videoFramesInClip = vedClip->Info()->VideoFrameCount(); 
+        }
+    
+    // Calculate the amount of start transition frames in the clip
+    if (aIndex == 0)
+        {
+        // First clip in the movie so check movie start transition
+        if (aMovie->StartTransitionEffect() != EVedStartTransitionEffectNone)
+            {
+            aStartTransitionFrames = KSEFadeTransitionFrames;   // Fade from
+            }
+        }
+    else if (aMovie->MiddleTransitionEffect(aIndex - 1) != EVedMiddleTransitionEffectNone)
+        {
+        // Check if the previous clip has a middle transition
+        if (aMovie->MiddleTransitionEffect(aIndex - 1) == EVedMiddleTransitionEffectDipToBlack ||
+            aMovie->MiddleTransitionEffect(aIndex - 1) == EVedMiddleTransitionEffectDipToWhite)
+            {
+            aStartTransitionFrames = KSEFadeTransitionFrames;   // Dip
+            }
+        else
+            {
+            aStartTransitionFrames = KSEWipeTransitionFrames;   // Wipe / crossfade
+            }
+        }
+        
+    // Calculate the amount of end transition frames in the clip
+    if (aIndex == aMovie->VideoClipCount() - 1)
+        {
+        // Last clip in the movie so check movie end transition
+        if (aMovie->EndTransitionEffect() != EVedEndTransitionEffectNone)
+            {
+            aEndTransitionFrames = KSEFadeTransitionFrames;     // Fade to
+            }
+        }
+    else if (aMovie->MiddleTransitionEffect(aIndex) != EVedMiddleTransitionEffectNone)
+        {
+        // Check if this clip has a middle transition
+        if (aMovie->MiddleTransitionEffect(aIndex) == EVedMiddleTransitionEffectDipToBlack ||
+            aMovie->MiddleTransitionEffect(aIndex) == EVedMiddleTransitionEffectDipToWhite)
+            {
+            aEndTransitionFrames = KSEFadeTransitionFrames;     // Dip
+            }
+        else
+            {
+            aEndTransitionFrames = KSEWipeTransitionFrames;     // Wipe / crossfade
+            }
+        }
+    
+    // Check that the number of transition frames does not overflow    
+    if (aStartTransitionFrames > videoFramesInClip)
+        {
+        aStartTransitionFrames = videoFramesInClip;
+        }
+    if (aEndTransitionFrames > videoFramesInClip - aStartTransitionFrames)
+        {
+        aEndTransitionFrames = videoFramesInClip - aStartTransitionFrames;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::GetGeneratedFrameSize
+// Estimates the average generated frame size
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//     
+TInt CSizeEstimate::GetGeneratedFrameSize(const CVedMovieImp *aMovie, TBool aIntra)
+    {    
+    TInt frameFactor = 0;
+    
+    // Estimate the frame factor based on codec type
+    if (aMovie->VideoType() == EVedVideoTypeMPEG4SimpleProfile)
+        {
+        // MPEG-4
+        frameFactor = aIntra ? KSEGeneratedIFrameFactorMPEG4 : KSEGeneratedPFrameFactorMPEG4;  
+        }
+    else if (aMovie->VideoType() == EVedVideoTypeAVCBaselineProfile)
+        {
+        // H.264
+        frameFactor = aIntra ? KSEGeneratedIFrameFactorH264 : KSEGeneratedPFrameFactorH264; 
+        }
+    else
+        {
+        // H.263
+        frameFactor = aIntra ? KSEGeneratedIFrameFactorH263 : KSEGeneratedPFrameFactorH263;
+        }
+    
+    // Estimate frame size based on movie resolution and frame factor   
+    return (aMovie->Resolution().iWidth * frameFactor) >> 3;    // Convert bits to bytes
+    }
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::GetBlackFrameSize
+// Estimates the average black frame size
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+TInt CSizeEstimate::GetBlackFrameSize(const CVedMovieImp *aMovie, TBool aIntra)
+    {
+    TInt frameFactor = aIntra ? KSEBlackIFrameFactor : KSEBlackPFrameFactor;
+        
+    return (aMovie->Resolution().iWidth * frameFactor) >> 3;    // Convert bits to bytes
+    }
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::GetVideo3gpSizePerFrame
+// Returns the 3gp size for video based on number of video frames
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+TInt CSizeEstimate::GetVideo3gpSizePerFrame(TInt aNumberOfVideoFrames)
+    {
+    TInt video3gpSize = KSEVideo3gpSizePerFrame6;
+    
+    if (aNumberOfVideoFrames < KSEVideo3gpFramesLimit1)      video3gpSize = KSEVideo3gpSizePerFrame1; 
+    else if (aNumberOfVideoFrames < KSEVideo3gpFramesLimit2) video3gpSize = KSEVideo3gpSizePerFrame2; 
+    else if (aNumberOfVideoFrames < KSEVideo3gpFramesLimit3) video3gpSize = KSEVideo3gpSizePerFrame3; 
+    else if (aNumberOfVideoFrames < KSEVideo3gpFramesLimit4) video3gpSize = KSEVideo3gpSizePerFrame4; 
+    else if (aNumberOfVideoFrames < KSEVideo3gpFramesLimit5) video3gpSize = KSEVideo3gpSizePerFrame5; 
+    
+    return video3gpSize;
+    }
+
+// -----------------------------------------------------------------------------
+// CSizeEstimate::GetAudio3gpSizePerSample
+// Returns the 3gp size for audio based on number of audio samples
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//     
+TReal CSizeEstimate::GetAudio3gpSizePerSample(TReal aNumberOfAudioSamples)
+    {
+    TReal audio3gpSize = KSEAudio3gpSizePerSample8;
+     
+    if (aNumberOfAudioSamples < KSEAudio3gpSamplesLimit1)      audio3gpSize = KSEAudio3gpSizePerSample1; 
+    else if (aNumberOfAudioSamples < KSEAudio3gpSamplesLimit2) audio3gpSize = KSEAudio3gpSizePerSample2; 
+    else if (aNumberOfAudioSamples < KSEAudio3gpSamplesLimit3) audio3gpSize = KSEAudio3gpSizePerSample3; 
+    else if (aNumberOfAudioSamples < KSEAudio3gpSamplesLimit4) audio3gpSize = KSEAudio3gpSizePerSample4; 
+    else if (aNumberOfAudioSamples < KSEAudio3gpSamplesLimit5) audio3gpSize = KSEAudio3gpSizePerSample5; 
+    else if (aNumberOfAudioSamples < KSEAudio3gpSamplesLimit6) audio3gpSize = KSEAudio3gpSizePerSample6; 
+    else if (aNumberOfAudioSamples < KSEAudio3gpSamplesLimit7) audio3gpSize = KSEAudio3gpSizePerSample7; 
+    
+    return audio3gpSize;
+    }
+
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/VedRgb2YuvConverter.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,311 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <fbs.h>
+#include "VedRgb2YuvConverter.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+#ifdef _DEBUG
+#	define __IF_DEBUG(t) {RDebug::t;}
+#else
+#	define __IF_DEBUG(t)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+// ?one_line_short_description_of_data
+#define AVG(a,b) ( ( a + b ) >> 1 )
+
+// MODULE DATA STRUCTURES
+
+/**
+*  ?one_line_short_description.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+struct TVSYCrCb
+	{
+	public:
+		// ?one_line_short_description_of_data
+		TInt iY;
+		
+		// ?one_line_short_description_of_data
+		TInt iCb;
+		
+		// ?one_line_short_description_of_data
+		TInt iCr;
+	};
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+inline TUint8 RGBtoYCbCr( TVSYCrCb* aYuv, const TRgb& aColor )
+	{
+	const TInt YRedFactor = 19595; // 0.299 << 16
+	const TInt YGreenFactor = 38470; // 0.587 << 16
+	const TInt YBlueFactor = 7471; // 0.114 << 16
+	const TInt CbRedFactor = 11056; // 0.1687 << 16
+	const TInt CbGreenFactor = 21712; // 0.3313 << 16
+	const TInt CrGreenFactor = 27440; // 0.4187 << 16
+	const TInt CrBlueFactor = 5328; // 0.0813 << 16
+
+	TInt red = aColor.Red();
+	TInt green = aColor.Green();
+	TInt blue = aColor.Blue();
+
+	aYuv->iY = (YRedFactor * red) + (YGreenFactor * green) + (YBlueFactor * blue);
+	aYuv->iCb = - (CbRedFactor * red) - (CbGreenFactor * green) + (blue << 15);
+	aYuv->iCr = (red << 15) - (CrGreenFactor * green) - (CrBlueFactor * blue);
+
+	aYuv->iY >>= 16;
+	aYuv->iCb >>= 16;
+	aYuv->iCr >>= 16;
+
+	aYuv->iCb += 128;
+	aYuv->iCr += 128;
+
+	return static_cast<TUint8>( aYuv->iY );
+	}
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor4K( TAny*& aSource )
+	{
+	TUint16* s = static_cast<TUint16*>( aSource );
+	TRgb rgb( TRgb::Color4K( *s++ ) );
+	aSource = s;
+	return rgb;
+	}
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor64K( TAny*& aSource )
+	{
+	TUint16* s = static_cast<TUint16*>( aSource );
+	TRgb rgb( TRgb::Color64K( *s++ ) );
+	aSource = s;
+	return rgb;
+	}
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TRgb VSReadColor16M( TAny*& aSource )
+	{
+	TUint8* s = static_cast<TUint8*>( aSource );
+	TRgb rgb( s[2], s[1], s[0] );
+	aSource = s + 3;
+	return rgb;
+	}
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ============================ CVSFbsBitmapYUV420Converter ===============================
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVSFbsBitmapYUV420Converter* CVSFbsBitmapYUV420Converter::NewL( const CFbsBitmap& aBitmap )
+	{
+	CVSFbsBitmapYUV420Converter* self = new (ELeave) CVSFbsBitmapYUV420Converter();
+	CleanupStack::PushL( self );
+	self->ConstructL( aBitmap );
+	CleanupStack::Pop(); // self
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CVSFbsBitmapYUV420Converter::~CVSFbsBitmapYUV420Converter()
+	{
+	delete iSource;
+	delete iYUVData;
+	}
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVSFbsBitmapYUV420Converter::SetSourceL( const CFbsBitmap& aBitmap )
+	{
+	ReConstructL( aBitmap );
+	}
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVSFbsBitmapYUV420Converter::ProcessL()
+	{
+	switch( iSource->DisplayMode() )
+		{
+		case EColor4K:
+			DoProcess( VSReadColor4K );
+			break;
+
+		case EColor64K:
+			DoProcess( VSReadColor64K );
+			break;
+		
+		case EColor16M:
+			DoProcess( VSReadColor16M );
+			break;
+
+		default:
+			User::Leave( KErrNotSupported );
+			break;
+		};
+	}
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TPtrC8 CVSFbsBitmapYUV420Converter::YUVData() const
+	{
+	return *iYUVData;
+	}
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVSFbsBitmapYUV420Converter::ConstructL( const CFbsBitmap& aBitmap )
+	{
+	iSource = new (ELeave) CFbsBitmap();
+	ReConstructL( aBitmap );
+	}
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVSFbsBitmapYUV420Converter::ReConstructL( const CFbsBitmap& aBitmap )
+	{
+	User::LeaveIfError( iSource->Duplicate( aBitmap.Handle() ) );
+	
+	// make sure that destination bitmap's displaymode is supported
+	if( ( iSource->DisplayMode() != EColor4K ) && ( iSource->DisplayMode() != EColor64K ) && ( iSource->DisplayMode() != EColor16M ) )
+		{
+		User::Leave( KErrNotSupported );
+		}
+	
+	if( !iYUVData || !( iSize == iSource->SizeInPixels() ) )
+		{
+		iSize = iSource->SizeInPixels();
+		delete iYUVData; iYUVData = 0;
+		TInt ySize = iSize.iWidth * iSize.iHeight;
+		iYUVData = HBufC8::NewMaxL( ySize + ( ySize >> 1 ) );
+		iY.Set( iYUVData->Des().Mid( 0, ySize ) );
+		iU.Set( iYUVData->Des().Mid( ySize, ySize >> 2 ) );
+		iV.Set( iYUVData->Des().Mid( ySize + ( ySize >> 2 ), ySize >> 2 ) );
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// ?classname::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVSFbsBitmapYUV420Converter::DoProcess( TVSColorReadFunc aReadFunction )
+	{
+	TUint8* pY = const_cast<TUint8*>( iY.Ptr() );
+	TUint8* pU = const_cast<TUint8*>( iU.Ptr() );
+	TUint8* pV = const_cast<TUint8*>( iV.Ptr() );
+	TVSYCrCb yuv1, yuv2;
+
+	iSource->LockHeap();
+	TAny* s = iSource->DataAddress();
+	for( TInt h = 0; h < iSize.iHeight; h++ )
+		{
+		for( TInt w = 0; w < iSize.iWidth>>1; w++ ) // Note! width must be even divisible by 2
+			{
+			*pY++ = RGBtoYCbCr( &yuv1, aReadFunction( s ) ); 
+			*pY++ = RGBtoYCbCr( &yuv2, aReadFunction( s ) ); 
+			if( h&1 )
+				{
+				*pU++ = static_cast<TUint8>( AVG( yuv1.iCb, yuv2.iCb ) );
+				*pV++ = static_cast<TUint8>( AVG( yuv1.iCr, yuv2.iCr ) );
+				}
+			else
+				{
+				*pU++ = static_cast<TUint8>( AVG( *pU, AVG( yuv1.iCb, yuv2.iCb ) ) );
+				*pV++ = static_cast<TUint8>( AVG( *pV, AVG( yuv1.iCr, yuv2.iCr ) ) );
+				}
+			}
+		// if even row -> decrease pU and pV, we will calculate average for those on odd rows
+		if( !(h&1) )
+			{
+			pU -= ( iSize.iWidth >> 1 );
+			pV -= ( iSize.iWidth >> 1 );
+			}
+		}
+	iSource->UnlockHeap();
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/VideoEncoderMDF.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1285 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation for video encoder.
+*
+*/
+
+
+#include "statusmonitor.h"
+#include "videoencoder.h"
+#include "vedvideosettings.h"
+#include "vedvolreader.h"
+#include "vedavcedit.h"
+
+
+// Assertion macro wrapper for code cleanup
+#define VEASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CVIDEOENCODER"), EInternalAssertionFailure)) 
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+// Constants
+
+
+// time increment resolution
+const TUint KTimeIncrementResolutionHW = 30000;
+//const TUint KTimeIncrementResolutionSW = 29;
+
+const TReal KMinRandomAccessRate = 0.2;
+//const TUint KPictureQuality = 50;
+//const TReal KLatencyQyalityTradeoff = 1.0;
+//const TReal KQualityTemporalTradeoff = 0.8;
+//const TBool KEncodingRealTime = EFalse;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CVideoEncoder::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------
+//
+
+CVideoEncoder* CVideoEncoder::NewL(CStatusMonitor *aMonitor, CVedAVCEdit* aAvcEdit, 
+                                   const TPtrC8& aVideoMimeType)
+{
+	PRINT((_L("CVideoEncoder::NewL() : MDF"))); 
+	
+	CVideoEncoder* self = new (ELeave) CVideoEncoder();    
+	CleanupStack::PushL( self );
+	self->ConstructL(aMonitor, aAvcEdit, aVideoMimeType);
+	CleanupStack::Pop();
+	
+	return self;    
+}
+
+
+CVideoEncoder::CVideoEncoder() : CActive(EPriorityStandard), iInputBuffer(0,0)
+{    
+    iPreviousTimeStamp = TTimeIntervalMicroSeconds(0);
+    iKeyFrame = EFalse;
+}
+
+
+void CVideoEncoder::ConstructL(CStatusMonitor *aMonitor, CVedAVCEdit* aAvcEdit, 
+                               const TPtrC8& aVideoMimeType)
+{
+	iTranscoder = NULL;	
+	iMonitor = aMonitor;
+	iAvcEdit = aAvcEdit;
+
+	iFrameSize = KVedResolutionQCIF;
+	iFrameRate = 15.0;	
+	iInputFrameRate = 15.0;
+	iRandomAccessRate = KMinRandomAccessRate;
+
+    // interpret and store video codec MIME-type. Allocates also iDataBuffer
+    SetVideoCodecL( aVideoMimeType );	
+
+	iStatus = NULL;	
+	
+	iVolReader = CVedVolReader::NewL();
+	
+	// allocate input picture
+	iInputPicture = new (ELeave) TTRVideoPicture;
+	
+	// Create a timer 
+	User::LeaveIfError(iTimer.CreateLocal());
+	iTimerCreated = ETrue;
+	
+	// Add us to active scheduler
+	CActiveScheduler::Add(this);
+}
+
+
+// ---------------------------------------------------------
+// CVideoEncoder::~CVideoEncoder()
+// Destructor
+// ---------------------------------------------------------
+//
+CVideoEncoder::~CVideoEncoder()
+    {
+
+    Cancel();
+
+    if ( iInputPicture )
+	{
+        delete iInputPicture;
+		iInputPicture = 0;
+	}
+	
+	if ( iDataBuffer )
+	{	        
+	    delete iDataBuffer;
+	    iDataBuffer = 0;
+	}
+	
+    if ( iTranscoder )
+	{
+        delete iTranscoder;
+		iTranscoder = 0;
+	}
+	
+	if ( iVolReader )
+	{
+	    delete iVolReader;
+	    iVolReader = 0;
+	}
+    
+    if ( iTimerCreated )
+	{
+        iTimer.Close();
+		iTimerCreated = EFalse;
+	}
+
+
+    }
+
+
+// ---------------------------------------------------------
+// CVideoEncoder::SetVideoCodecL()
+// Interpret and store video mime type
+// ---------------------------------------------------------
+//
+void CVideoEncoder::SetVideoCodecL(const TPtrC8& aMimeType)
+    {
+    TBuf8<256> string;
+    TBuf8<256> newMimeType;
+    string = KVedMimeTypeH263;
+    string += _L8( "*" );
+	TInt dataBufferSize = KMaxCodedPictureSizeQCIF;
+
+    iMaxFrameRate = 15.0;
+    iArbitrarySizeAllowed = EFalse;
+    
+    if ( aMimeType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+        {
+        // H.263
+
+        newMimeType = KVedMimeTypeH263;
+
+        if ( aMimeType.MatchF( _L8("*profile*") ) != KErrNotFound )
+            {
+            // profile given, check if we support it
+            if ( aMimeType.MatchF( _L8("*profile=0*")) != KErrNotFound )
+                {
+                // profile 0 requested
+                newMimeType += _L8( "; profile=0" );
+                }
+            else
+                {
+                // no other profiles supported
+                PRINT((_L("CVideoEncoder::SetVideoCodecL() unsupported profile")));
+                User::Leave(KErrNotSupported);
+                }
+            }
+        else
+            {
+            // no profile is given => assume 0
+            newMimeType += _L8( "; profile=0" );
+            }
+
+        if ( aMimeType.MatchF( _L8("*level=10*") ) != KErrNotFound )
+            {
+    		iMaxBitRate = iBitRate = KVedBitRateH263Level10;
+    		iMaxResolution = KVedResolutionQCIF;
+    		dataBufferSize = KMaxCodedPictureSizeQCIF;
+            newMimeType += _L8( "; level=10" );
+            }
+        else if ( aMimeType.MatchF( _L8("*level=45*") ) != KErrNotFound )
+            {
+    		iMaxBitRate = iBitRate = KVedBitRateH263Level45;
+    		iMaxResolution = KVedResolutionQCIF;
+    		dataBufferSize = KMaxCodedPictureSizeQCIF;
+            newMimeType += _L8( "; level=45" );
+            }
+        else if ( aMimeType.MatchF( _L8("*level*") ) != KErrNotFound )
+            {
+            // no other levels supported
+            PRINT((_L("CVideoEncoder::SetVideoCodecL() unsupported level")));
+            User::Leave(KErrNotSupported);
+            }
+        else
+            {
+            // if no level is given assume 10
+    		iMaxBitRate = iBitRate = KVedBitRateH263Level10;
+    		iMaxResolution = KVedResolutionQCIF;
+    		dataBufferSize = KMaxCodedPictureSizeQCIF;
+            newMimeType += _L8( "; level=10" );
+            }
+        }
+    else
+        {
+        string = KVedMimeTypeMPEG4Visual;
+        string += _L8( "*" );
+
+        if ( aMimeType.MatchF( string ) != KErrNotFound ) 
+            {
+            // MPEG-4 Visual
+            newMimeType = KVedMimeTypeMPEG4Visual;
+            if ( aMimeType.MatchF( _L8("*profile-level-id=8*") ) != KErrNotFound )
+                {
+                // simple profile level 0
+        		iMaxBitRate = iBitRate = KVedBitRateMPEG4Level0;
+        		iMaxResolution = KVedResolutionQCIF;
+                // define max size 10K
+                dataBufferSize = KMaxCodedPictureSizeMPEG4QCIF;
+                newMimeType += _L8("; profile-level-id=8");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=9*") ) != KErrNotFound )
+                {
+                // simple profile level 0b
+        		iMaxBitRate = iBitRate = KVedBitRateMPEG4Level0;
+        		iMaxResolution = KVedResolutionQCIF;
+                // define max size 10K
+                dataBufferSize = KMaxCodedPictureSizeMPEG4QCIF;
+                newMimeType += _L8("; profile-level-id=9");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=1*") ) != KErrNotFound )
+                {
+                // simple profile level 1
+        		iMaxBitRate = iBitRate = KVedBitRateMPEG4Level0;
+        		iMaxResolution = KVedResolutionQCIF;
+                // define max size 10K
+                dataBufferSize = KMaxCodedPictureSizeMPEG4QCIF;
+                iArbitrarySizeAllowed = ETrue;                
+                newMimeType += _L8("; profile-level-id=1");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=2*") ) != KErrNotFound )
+                {
+                // simple profile level 2
+			    dataBufferSize = KMaxCodedPictureSizeMPEG4CIF;
+        		iMaxResolution = KVedResolutionCIF;
+			    iMaxBitRate = iBitRate = KVedBitRateMPEG4Level2;
+                iArbitrarySizeAllowed = ETrue;                
+                newMimeType += _L8("; profile-level-id=2");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=3*") ) != KErrNotFound )
+                {
+                // simple profile level 3
+			    dataBufferSize = KMaxCodedPictureSizeMPEG4CIF;
+			    iMaxBitRate = iBitRate = KVedBitRateMPEG4Level2;
+        		iMaxResolution = KVedResolutionCIF;
+			    iMaxFrameRate = 30.0;
+                iArbitrarySizeAllowed = ETrue;                
+                newMimeType += _L8("; profile-level-id=3");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=4*") ) != KErrNotFound )
+                {
+                // simple profile level 4a
+			    iMaxBitRate = iBitRate = KVedBitRateMPEG4Level4A;	        	
+			    dataBufferSize = KMaxCodedPictureSizeVGA;
+        		iMaxResolution = KVedResolutionVGA;
+			    iMaxFrameRate = 30.0;
+                iArbitrarySizeAllowed = ETrue;                
+                newMimeType += _L8("; profile-level-id=4");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=*") ) != KErrNotFound )
+                {
+                // no other profile-level ids supported
+                PRINT((_L("CVideoEncoder::SetVideoCodecL() unsupported MPEG-4 profile-level")));
+                User::Leave(KErrNotSupported);
+                }
+            else
+                {
+                // Default is level 0 in our case (normally probably level 1)
+        		iMaxBitRate = iBitRate = KVedBitRateMPEG4Level0;
+        		iMaxResolution = KVedResolutionQCIF;
+                // define max size 10K
+                dataBufferSize = KMaxCodedPictureSizeMPEG4QCIF;
+                newMimeType += _L8("; profile-level-id=8");
+                }
+            }
+        else
+            {
+             
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+            string = KVedMimeTypeAVC;
+            string += _L8( "*" );                
+            if ( aMimeType.MatchF( string ) != KErrNotFound ) 
+                {
+                // AVC
+                newMimeType = KVedMimeTypeAVC;
+                if ( aMimeType.MatchF( _L8("*profile-level-id=42800A*") ) != KErrNotFound )
+                    {
+                    // baseline profile level 1
+            		iMaxBitRate = iBitRate = KVedBitRateAVCLevel1;
+            		iMaxResolution = KVedResolutionQCIF;                        
+                    dataBufferSize = KMaxCodedPictureSizeAVCLevel1;
+                    iArbitrarySizeAllowed = ETrue;                
+                    newMimeType += _L8("; profile-level-id=42800A");
+                    }                    
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=42900B*") ) != KErrNotFound )
+                    {                                                
+                    // baseline profile level 1b
+                    iMaxBitRate = iBitRate = KVedBitRateAVCLevel1b;
+            		iMaxResolution = KVedResolutionQCIF;                        
+                    dataBufferSize = KMaxCodedPictureSizeAVCLevel1B;
+                    iArbitrarySizeAllowed = ETrue;                
+                    newMimeType += _L8("; profile-level-id=42900B");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=42800B*") ) != KErrNotFound )
+                    {
+                    // baseline profile level 1.1
+                    iMaxBitRate = iBitRate = KVedBitRateAVCLevel1_1;
+            		iMaxResolution = KVedResolutionCIF;                        
+                    dataBufferSize = KMaxCodedPictureSizeAVCLevel1_1;
+                    iArbitrarySizeAllowed = ETrue;                
+                    newMimeType += _L8("; profile-level-id=42800B");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=42800C*") ) != KErrNotFound )
+                    {
+                    // baseline profile level 1.2
+                    iMaxBitRate = iBitRate = KVedBitRateAVCLevel1_2;
+            		iMaxResolution = KVedResolutionCIF;                        
+                    dataBufferSize = KMaxCodedPictureSizeAVCLevel1_2;
+                    iArbitrarySizeAllowed = ETrue;                
+                    newMimeType += _L8("; profile-level-id=42800C");                    
+                    }      
+                //WVGA task
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=42801F*") ) != KErrNotFound )
+                    {
+                    // baseline profile level 1.3
+                    iMaxBitRate = iBitRate = KVedBitRateAVCLevel3_1;
+            		iMaxResolution = KVedResolutionWVGA;                        
+                    dataBufferSize = KMaxCodedPictureSizeAVCLevel3_1;
+                    iArbitrarySizeAllowed = ETrue;                
+                    newMimeType += _L8("; profile-level-id=42801F");                    
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=*") ) != KErrNotFound )
+                    {
+                    // no other profile-level ids supported
+                    PRINT((_L("CVideoEncoder::SetVideoCodecL() unsupported AVC profile-level")));
+                    User::Leave(KErrNotSupported);
+                    }
+                else
+                    {
+                        // Default is level 1 (?)
+                        iMaxBitRate = iBitRate = KVedBitRateAVCLevel1;
+                		iMaxResolution = KVedResolutionQCIF;                            
+                        dataBufferSize = KMaxCodedPictureSizeAVCLevel1;
+                        newMimeType += _L8("; profile-level-id=42800A");
+                    }                
+                }
+            else
+                {
+                    // unknown mimetype
+                    User::Leave( KErrNotSupported );
+                }                                        
+#else
+                    // unknown mimetype
+                    User::Leave( KErrNotSupported );
+#endif
+            }
+        }
+
+    // successfully interpreted the input mime type
+    iMimeType = newMimeType;
+    if ( iDataBuffer )
+        {
+        delete iDataBuffer;
+        iDataBuffer = NULL;
+        }
+	iDataBuffer = (HBufC8*) HBufC8::NewL(dataBufferSize);    
+
+    }
+    
+// ---------------------------------------------------------
+// CVideoEncoder::SetFrameSizeL
+// Sets the used frame size
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoEncoder::SetFrameSizeL(const TSize& aSize)
+    {
+  
+    if (iFrameSize == aSize)
+        return;
+
+    if ( (aSize.iWidth > iMaxResolution.iWidth) || (aSize.iHeight > iMaxResolution.iHeight))
+        {
+        if ( iArbitrarySizeAllowed ) // This is for future-proofness. Currently the checking of standard sizes below overrules this one
+            {
+            if ( aSize.iWidth * aSize.iHeight > iMaxResolution.iWidth*iMaxResolution.iHeight )
+                {
+                PRINT((_L("CVideoEncoder::SetFrameSizeL() too high resolution requested")));
+                User::Leave( KErrNotSupported );
+                }
+            }
+        else
+            {
+            PRINT((_L("CVideoEncoder::SetFrameSizeL() incompatible or too high resolution requested")));
+            User::Leave( KErrNotSupported );
+            }
+        }
+    
+	// check new size. For now only standard sizes are allowed
+	if ( (aSize != KVedResolutionSubQCIF) && 
+		 (aSize != KVedResolutionQCIF) &&
+		 (aSize != KVedResolutionCIF) &&
+		 (aSize != KVedResolutionQVGA) &&
+		 (aSize != KVedResolutionVGA16By9) &&
+		 (aSize != KVedResolutionVGA) &&
+		 //WVGA task
+		 (aSize != KVedResolutionWVGA) )
+	{
+		 User::Leave( KErrArgument );
+	}
+
+    iFrameSize = aSize;    
+    
+    }
+
+// ---------------------------------------------------------
+// CVideoEncoder::GetFrameSize
+// Gets the used frame size
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoEncoder::FrameSize(TSize& aSize) const
+    {
+
+    aSize = iFrameSize;
+
+    }
+
+// ---------------------------------------------------------
+// CVideoEncoder::SetFrameRate
+// Sets the used targt frame rate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CVideoEncoder::SetFrameRate(const TReal aFrameRate)
+{
+    VEASSERT(aFrameRate > 0.0);
+
+    if ( aFrameRate <= iMaxFrameRate )
+        {
+        iFrameRate = TReal32(aFrameRate);
+        }
+    else
+        {
+        iFrameRate = iMaxFrameRate;
+        }
+        
+    // target framerate cannot be larger than source framerate
+    if (iFrameRate > iInputFrameRate)
+        iFrameRate = iInputFrameRate;
+
+    return KErrNone;
+}
+
+// ---------------------------------------------------------
+// CVideoEncoder::SetInputFrameRate
+// Sets the used input sequence frame rate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CVideoEncoder::SetInputFrameRate(const TReal aFrameRate)
+    {
+    
+    VEASSERT(aFrameRate > 0.0);
+         
+    iInputFrameRate = aFrameRate;
+        
+    // target framerate cannot be larger than source framerate
+    if (iFrameRate > iInputFrameRate)
+        iFrameRate = iInputFrameRate;
+    
+    return KErrNone;
+        
+    }
+
+    
+// ---------------------------------------------------------
+// CVideoEncoder::SetRandomAccessRate
+// Sets the used target random access rate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CVideoEncoder::SetRandomAccessRate(const TReal aRate)
+{
+    VEASSERT(aRate > 0.0);
+
+    iRandomAccessRate = aRate;
+
+    return KErrNone;
+}
+
+// ---------------------------------------------------------
+// CVideoEncoder::SetBitrate
+// Sets the used target bitrate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CVideoEncoder::SetBitrate(const TInt aBitrate)
+{    
+    VEASSERT(aBitrate > 0);
+
+    if ( aBitrate <= iMaxBitRate )
+        {
+        iBitRate = aBitrate;
+        }
+    else
+        {
+        iBitRate = iMaxBitRate;
+        }
+
+    return KErrNone;
+
+}
+
+// --------------------------------------------------------
+
+
+
+// ---------------------------------------------------------
+// CVideoEncoder::InitializeL
+// Initializes the encoder
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoEncoder::InitializeL(TRequestStatus &aStatus)
+    {
+    
+    PRINT((_L("CVideoEncoder::InitializeL() in")));
+
+    iResetRequestStatus = &aStatus;
+
+    // Create DevVideoRecord & select video encoder
+
+    if ( iTranscoder ) 
+        {
+        // need to recreate since parameters changed
+        delete iTranscoder;
+        iTranscoder = 0;
+        }
+
+    iFatalError = EFalse;
+
+    iTranscoder = CTRTranscoder::NewL(*this);
+
+    // Select & set parameters to transcoder    
+    TRAPD(err, SetupEncoderL());
+        
+    if ( err != KErrNone )
+        {
+        // error
+        User::Leave( err );
+        }
+    
+    iTranscoder->InitializeL();
+    
+    PRINT((_L("CVideoEncoder::InitializeL() out")));
+    
+
+    }
+
+// ---------------------------------------------------------
+// CVideoEncoder::Start
+// Starts the encoder
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+void CVideoEncoder::Start()
+{
+    TRAPD( error, iTranscoder->StartL() );
+    
+    if (error != KErrNone)
+        {
+        if (iMonitor)
+            iMonitor->Error(error);
+        }
+}
+
+
+// ---------------------------------------------------------
+// CVideoEncoder::SetRandomAccessPoint
+// Forces the next encoded frame to Intra
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoEncoder::SetRandomAccessPoint()
+{
+    VEASSERT(iTranscoder);
+    
+    iTranscoder->SetRandomAccessPoint();
+       
+}
+
+// ---------------------------------------------------------
+// CVideoEncoder::Stop
+// Stops the encoder
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoEncoder::Stop()
+{
+	
+    if ( !iFatalError )
+        {
+        
+        if (iStarted)
+            {
+            TRAPD( error, iTranscoder->StopL() );
+            if (error != KErrNone)
+                {
+                if (iMonitor)
+                    iMonitor->Error(error);
+                }
+            }
+        
+        iStarted = EFalse;
+        }
+}
+	
+
+// ---------------------------------------------------------
+// CVideoEncoder::Reset
+// Resets the encoder
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoEncoder::Reset(TRequestStatus &aStatus)
+{
+
+    PRINT((_L("CVideoEncoder::Reset() in")));    
+
+    iPreviousTimeStamp = TTimeIntervalMicroSeconds(0);
+
+    iResetRequestStatus = &aStatus;
+
+    if ( iFatalError )
+        {
+        MtroAsyncStopComplete();
+        }
+    else
+        {
+        TRAPD(err, iTranscoder->AsyncStopL());
+        if (err != KErrNone)
+            iMonitor->Error(err);
+        }
+
+	iStarted = EFalse;
+
+    PRINT((_L("CVideoEncoder::Reset() out")));
+}
+
+void CVideoEncoder::Reset()
+{
+
+    PRINT((_L("CVideoEncoder::Reset() (sync.) in")));
+
+    iPreviousTimeStamp = TTimeIntervalMicroSeconds(0);
+
+    if ( !iFatalError )
+    {
+        if (iStarted) 
+        {            
+            TRAPD(err, iTranscoder->StopL());
+            if (err != KErrNone)
+                iMonitor->Error(err);
+        }
+    }
+
+	iStarted = EFalse;
+
+    PRINT((_L("CVideoEncoder::Reset() (sync.) out")));
+}
+
+// ---------------------------------------------------------
+// CVideoEncoder::RunL
+// Active object running method.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoEncoder::RunL()
+{
+
+    // Timer elapsed, complete encoding request
+    // with KErrCancel
+
+    PRINT((_L("CVideoEncoder::RunL() in")));
+
+    if (iTimerRequestPending)
+    {
+        iTimerRequestPending = EFalse;
+        if (iEncodeRequestStatus)
+        {
+#ifdef _DEBUG
+            TTime current;
+            current.UniversalTime();
+            TInt64 time = current.MicroSecondsFrom(iEncodeStartTime).Int64();    
+            PRINT((_L("CVideoEncoder::RunL(), completing request, time since encoding started %d"), I64INT( time )));
+#endif
+
+            VEASSERT(*iEncodeRequestStatus == KRequestPending);
+            // complete request
+            User::RequestComplete(iEncodeRequestStatus, KErrCancel);
+            iEncodeRequestStatus = 0;
+			iEncodePending = EFalse;
+        }
+    }
+    PRINT((_L("CVideoEncoder::RunL() out")));
+
+}
+
+// ---------------------------------------------------------
+// CVideoEncoder::RunError
+// Active object error method.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CVideoEncoder::RunError(TInt aError)
+{
+    PRINT((_L("CVideoEncoder::RunError() in")));
+
+    Cancel();
+        
+    iMonitor->Error(aError);
+
+    PRINT((_L("CVideoEncoder::RunError() out")));
+    
+    return KErrNone;
+}
+
+// ---------------------------------------------------------
+// CVideoEncoder::DoCancel
+// Active object cancelling method
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoEncoder::DoCancel()
+{
+
+    PRINT((_L("CVideoEncoder::DoCancel() in")));
+
+    // Cancel our timer request if we have one
+    if ( iTimerRequestPending )
+    {
+        iTimer.Cancel();
+        iTimerRequestPending = EFalse;
+        return;
+    }
+
+}
+       
+// ---------------------------------------------------------
+// CVideoEncoder::EncodeFrameL
+// Encodes a frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoEncoder::EncodeFrameL(TPtr8& aYUVFrame, TRequestStatus &aStatus, TTimeIntervalMicroSeconds aTimeStamp)
+    {
+    PRINT((_L("CVideoEncoder::EncodeFrameL() in, aTimeStamp = %d"), I64INT( aTimeStamp.Int64() ) ));
+
+    if ( iFatalError )
+        {
+        PRINT((_L("CVideoEncoder::EncodeFrameL() can't encode since fatal error has occurred earlier")));
+        User::Leave( KErrGeneral );
+        }
+
+    iEncodeRequestStatus = &aStatus;
+
+	if (!iStarted)
+	{
+		PRINT((_L("CVideoEncoder::EncodeFrameL() - starting devVideoRec")));
+		//iTranscoder->StopL();  // NOTE: needed ??
+		iTranscoder->StartL();
+		iStarted = ETrue;
+	}	 
+
+    // wrap input frame to encoder input buffer
+    iInputBuffer.Set(aYUVFrame);
+    iInputPicture->iRawData = &iInputBuffer;   
+    iInputPicture->iDataSize.SetSize(iFrameSize.iWidth, iFrameSize.iHeight);
+
+    if (aTimeStamp > TTimeIntervalMicroSeconds(0))
+    {
+        TInt64 diff = aTimeStamp.Int64() - iPreviousTimeStamp.Int64();        
+
+        if (diff < 0)
+        {
+            aTimeStamp = iPreviousTimeStamp.Int64() + TInt64(66667);
+        }
+        // NOTE: Could the real difference between two consecutive
+        //       frames be used instead of assuming 15 fps ?
+    }
+    iPreviousTimeStamp = aTimeStamp;
+
+    iInputPicture->iTimestamp = aTimeStamp;
+    //iInputPicture->iLink = NULL;
+    iInputPicture->iUser = this;
+
+#ifdef _DEBUG
+    iEncodeStartTime.UniversalTime();
+#endif
+
+
+	iEncodePending = ETrue;
+
+    iTranscoder->SendPictureToTranscoderL( iInputPicture );
+
+    PRINT((_L("CVideoEncoder::EncodeFrameL() out")));
+
+    }
+
+
+// ---------------------------------------------------------
+// CVideoEncoder::GetBuffer
+// Gets encoded frame bitstream buffer
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TPtrC8& CVideoEncoder::GetBufferL(TBool& aKeyFrame)
+    {
+    if ( iFatalError )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    VEASSERT(iDataBuffer->Length() > 0);
+
+    PRINT((_L("CVideoEncoder::GetBufferL(), keyFrame = %d"), iKeyFrame));    
+
+    aKeyFrame = iKeyFrame;    
+        
+    iReturnDes.Set(iDataBuffer->Des()); 
+    return iReturnDes;    
+ 
+    }
+
+// ---------------------------------------------------------
+// CVideoEncoder::ReturnBuffer
+// Returns used bitstream buffer to devVideoRec
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoEncoder::ReturnBuffer()
+    {
+    if ( iFatalError )
+        {
+        return;
+        }
+        
+    iDataBuffer->Des().Zero();
+
+    }
+
+// ---------------------------------------------------------
+// CVideoEncoder::SetupEncoderL
+// Private helper method to select & setup the encoder 
+// plugin devvr must use
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoEncoder::SetupEncoderL()
+    {
+
+    if ( !(iTranscoder->SupportsOutputVideoFormat(iMimeType) ) )
+        {
+        User::Leave(KErrNotSupported);
+        }             
+        
+    TTRVideoFormat videoInputFormat;
+    TTRVideoFormat videoOutputFormat;
+    
+    videoInputFormat.iSize = iFrameSize;
+    videoInputFormat.iDataType = CTRTranscoder::ETRYuvRawData420;
+
+    videoOutputFormat.iSize = iFrameSize;
+    videoOutputFormat.iDataType = CTRTranscoder::ETRDuCodedPicture;
+        
+    iTranscoder->OpenL( this,
+                        CTRTranscoder::EEncoding,
+                        KNullDesC8,
+                        iMimeType,
+                        videoInputFormat,
+                        videoOutputFormat,
+                        EFalse );
+
+    // default, will be updated by ParseVolHeader
+    iTimeIncrementResolution = KTimeIncrementResolutionHW;    //KTimeIncrementResolutionSW;
+    
+    iTranscoder->SetVideoBitRateL(iBitRate);
+    
+    iTranscoder->SetFrameRateL(iFrameRate);    
+           
+    iTranscoder->SetChannelBitErrorRateL(0.0);
+       
+    // Get processing time estimate from transcoder, divide it by the framerate to get processing time per frame
+    // and then multiply it by 2 to get some safety margin and by unit conversion factor 1000000. 
+    // The delay is used to determine if a frame was skipped, hence there should be some margin.
+#ifdef __WINSCW__
+    iMaxEncodingDelay = 5000000;    // emulator can be really slow, use 5 seconds timeout
+#else    
+    iMaxEncodingDelay = (TUint)(2*1000000*iTranscoder->EstimateTranscodeTimeFactorL(videoInputFormat,videoOutputFormat)/iFrameRate);
+    iMaxEncodingDelay += 100000;  // Add 100 ms for safety margin
+#endif
+    
+    TTRVideoCodingOptions codingOptions;
+    codingOptions.iSyncIntervalInPicture = 0;
+    codingOptions.iMinRandomAccessPeriodInSeconds = (TInt) (1.0 / iRandomAccessRate);
+    
+    // NOTE: What about these ???
+    codingOptions.iDataPartitioning = EFalse;
+    codingOptions.iReversibleVLC = EFalse;
+    codingOptions.iHeaderExtension = 0;
+   
+    iTranscoder->SetVideoCodingOptionsL(codingOptions);
+   
+    iTranscoder->SetVideoPictureSinkOptionsL(iFrameSize, this);
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVideoEncoder::MtroSetInputFrameRate
+// Sets input sequence frame rate for encoding
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVideoEncoder::MtroSetInputFrameRate(TReal& aRate)
+    {
+     
+    aRate = iInputFrameRate;
+        
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVideoEncoder::MtroPictureFromTranscoder
+// Called by transcoder to return the input picture buffer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVideoEncoder::MtroPictureFromTranscoder(TTRVideoPicture* aPicture)
+    {
+    PRINT((_L("CVideoEncoder::MtroPictureFromTranscoder() %x"), aPicture));
+    
+    if (iInputPicture != aPicture)
+    {
+        iMonitor->Error(KErrGeneral);
+        return;
+    }
+        
+    if (iEncodePending)
+        {                
+        if (!iTimerRequestPending)
+            {
+            // Activate timer to wait for encoding, if the encoding didn't complete already. 
+            // Timeout is needed since we don't get notification if frame was skipped.
+            SetActive();
+            iStatus = KRequestPending;        
+            iTimer.After(iStatus, TTimeIntervalMicroSeconds32(iMaxEncodingDelay));
+            iTimerRequestPending = ETrue;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVideoEncoder::WriteBufferL
+// Called by transcoder to notify that new bitsream buffer is ready
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVideoEncoder::WriteBufferL(CCMRMediaBuffer* aBuffer)
+    {
+    
+    PRINT((_L("CVideoEncoder::WriteBufferL(), iEncodePending = %d"), iEncodePending));
+    
+#ifdef _DEBUG
+    TTime current;
+    current.UniversalTime();
+    TInt64 time = current.MicroSecondsFrom(iEncodeStartTime).Int64();
+	PRINT((_L("CVideoEncoder::WriteBufferL(), time spent encoding = %d ms, iEncodeRequestStatus = 0x%x"), 
+		(I64INT(time))/1000 ,iEncodeRequestStatus));
+
+#endif
+
+    if (aBuffer->Type() == CCMRMediaBuffer::EVideoMPEG4DecSpecInfo)
+	{
+		// copy data to bitstream buffer
+	    TPtr8 ptr = iDataBuffer->Des();		    
+	    ptr.Copy( aBuffer->Data() );	    
+	    return;		
+	}
+
+    // Cancel timer
+    Cancel();
+
+	iEncodePending = EFalse;	
+	
+	if (aBuffer->BufferSize() == 0)
+	{
+	    PRINT((_L("CVideoEncoder::WriteBufferL() buffer length == 0")));
+	    
+    	if ( iEncodeRequestStatus != 0 )
+        {
+    		// complete request
+    		User::RequestComplete(iEncodeRequestStatus, KErrUnderflow);
+    		iEncodeRequestStatus = 0;
+    	}	    
+	    return;
+	}
+		
+	VEASSERT(aBuffer->Data().Length() <= KMaxCodedPictureSizeVGA);		    
+	
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+    TInt avcFrameLen = 0;
+    if ( iMimeType.FindF(KVedMimeTypeAVC) != KErrNotFound )
+    {           
+       // get avc frame length
+       TUint8* tmp = const_cast<TUint8*>(aBuffer->Data().Ptr() + aBuffer->Data().Length());
+       // support for 1 frame in 1 NAL unit currently
+       tmp -= 4;
+       TInt numNalUnits = TInt(tmp[0]) + (TInt(tmp[1])<<8) + (TInt(tmp[2])<<16) + (TInt(tmp[3])<<24);
+       if (numNalUnits > 0) { }
+       
+       VEASSERT( numNalUnits == 1 );       
+       tmp -=4;
+              
+       avcFrameLen = tmp[0] + (TInt(tmp[1])<<8) + (TInt(tmp[2])<<16) + (TInt(tmp[3])<<24);                     
+       
+       TInt error = KErrNone;
+       // check that there is enough room for length field and the frame
+       if ( iDataBuffer->Des().MaxLength() < (avcFrameLen + 4) )
+           TRAP( error, iDataBuffer->ReAllocL(avcFrameLen + 4) );
+           
+       if (error != KErrNone)
+       {
+           iMonitor->Error(error);
+           return;
+       }
+       
+       TUint8* buf = const_cast<TUint8*>(iDataBuffer->Des().Ptr());
+       
+       // set length
+       buf[0] = TUint8((avcFrameLen >> 24) & 0xff);
+       buf[1] = TUint8((avcFrameLen >> 16) & 0xff);
+       buf[2] = TUint8((avcFrameLen >> 8) & 0xff);
+       buf[3] = TUint8(avcFrameLen & 0xff);
+       
+       iDataBuffer->Des().SetLength(4);
+    }
+#endif        
+			
+	// copy data to bitstream buffer
+	TPtr8 ptr = iDataBuffer->Des();
+	
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+	if ( iMimeType.FindF(KVedMimeTypeAVC) != KErrNotFound )
+	{
+	    ptr.Append( aBuffer->Data().Ptr(), avcFrameLen );
+	}
+	else
+#endif
+    {
+        ptr.Append( aBuffer->Data() );
+    }
+	
+	// save keyframe flag
+	iKeyFrame = aBuffer->RandomAccessPoint();
+			
+	if ( iEncodeRequestStatus != 0 )
+    {
+		// complete request
+		User::RequestComplete(iEncodeRequestStatus, KErrNone);
+		iEncodeRequestStatus = 0;
+	}
+
+    // --> user calls GetBuffer();	    
+    
+    }
+    
+TInt CVideoEncoder::SetVideoFrameSize(TSize /*aSize*/)
+    {
+    return KErrNone;    
+    }
+    
+TInt CVideoEncoder::SetAverageVideoBitRate(TInt /*aSize*/)
+    {
+    return KErrNone;    
+    }
+    
+TInt CVideoEncoder::SetMaxVideoBitRate(TInt /*aSize*/)
+    {
+    return KErrNone;    
+    }
+    
+TInt CVideoEncoder::SetAverageAudioBitRate(TInt /*aSize*/)
+    {
+    return KErrNone;    
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoEncoder::MtroFatalError
+// Called by transcoder when a fatal error has occurred
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVideoEncoder::MtroFatalError(TInt aError)
+    {
+
+    PRINT((_L("CVideoEncoder::MtroFatalError() %d"), aError));
+    iFatalError = ETrue;
+
+    iMonitor->Error(aError);
+    
+    }
+    
+void CVideoEncoder::MtroReturnCodedBuffer(CCMRMediaBuffer* /*aBuffer*/)
+    {
+        
+        User::Panic(_L("CVIDEOENCODER"), EInternalAssertionFailure);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVideoEncoder::MdvroInitializeComplete
+// Called by transcoder when initialization is complete
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVideoEncoder::MtroInitializeComplete(TInt aError)
+    {
+    PRINT((_L("CVideoEncoder::MtroInitializeComplete %d, iResetRequestStatus %x"), aError, iResetRequestStatus));
+
+    VEASSERT(iResetRequestStatus);
+
+    if ( aError != KErrNone )    
+    {        
+        iMonitor->Error(aError);
+        if ( iResetRequestStatus != 0 )
+        {            
+            User::RequestComplete(iResetRequestStatus, aError);
+            iResetRequestStatus = 0;
+        }
+        return;
+    }
+    
+    TInt error = KErrNone;    
+    // Handle MPEG-4 VOL / AVC SPS/PPS data reading/writing            
+    TRAP(error, HandleCodingStandardSpecificInfoL());
+    
+    if ( error != KErrNone )
+        iMonitor->Error(error); 
+
+	if ( iResetRequestStatus != 0 )
+    {		
+		PRINT((_L("CVideoEncoder::MtroInitializeComplete() complete request")));
+		// complete request:
+        User::RequestComplete(iResetRequestStatus, error);
+		iResetRequestStatus = 0;
+	}
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoEncoder::MtroAsyncStopComplete
+// Called by transcoder when all pictures have been processed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVideoEncoder::MtroAsyncStopComplete()
+    {
+    
+    PRINT((_L("CVideoEncoder::MtroAsyncStopComplete()")));
+    
+    if ( iResetRequestStatus != 0 )
+    {
+		PRINT((_L("CVideoEncoder::MdvroStreamEnd() complete request")));
+        // complete request
+        User::RequestComplete(iResetRequestStatus, KErrNone);
+        iResetRequestStatus = 0;
+    }
+       
+    }
+
+// -----------------------------------------------------------------------------
+// CVideoEncoder::GetTimeIncrementResolution
+// Gets time increment resolution used in MPEG-4 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CVideoEncoder::GetTimeIncrementResolution() const
+    {
+    if ( iVolReader->TimeIncrementResolution() != 0 )
+        return iVolReader->TimeIncrementResolution();
+    
+    return iTimeIncrementResolution;
+    }
+    
+// -----------------------------------------------------------------------------
+// CVideoEncoder::HandleCodingStandardSpecificInfoL
+// Parses the MPEG-4 VOL header / AVC Dec. configuration record
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CVideoEncoder::HandleCodingStandardSpecificInfoL()
+    {
+
+    // Parse the VOL header for mpeg-4
+    if ( iMimeType.FindF(KVedMimeTypeMPEG4Visual) != KErrNotFound )
+        {
+        HBufC8* headerData = iTranscoder->GetCodingStandardSpecificInitOutputLC();
+        if ( headerData != 0 )
+            {
+            iVolReader->ParseVolHeaderL( (TDesC8&) *headerData );
+            
+            // Insert VOL header to bitstream buffer
+	        TPtr8 ptr = iDataBuffer->Des();		
+	        ptr.Append( *headerData );
+            
+            CleanupStack::PopAndDestroy( headerData );
+            }
+        }
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING         
+    // Parse & write SPS/PPS data for AVC
+    else if ( iMimeType.FindF(KVedMimeTypeAVC) != KErrNotFound )
+        {
+        HBufC8* headerData = iTranscoder->GetCodingStandardSpecificInitOutputLC();
+        
+        if ( headerData != 0 )
+            {   
+            
+            HBufC8* outputAVCHeader = 0;
+            // is the max. size of AVCDecoderConfigurationRecord known here ??
+            outputAVCHeader = (HBufC8*) HBufC8::NewLC(16384);            
+            TPtr8 ptr = outputAVCHeader->Des();
+	            
+	        // parse header & convert it to AVCDecoderConfigurationRecord -format
+	        iAvcEdit->ConvertAVCHeaderL(*headerData, ptr);	            
+	        
+	        // save it to avc module for later use
+	        iAvcEdit->SaveAVCDecoderConfigurationRecordL(ptr, ETrue /* aFromEncoder */); 
+
+            CleanupStack::PopAndDestroy( 2 );  // headerData, outputAVCHeader
+            
+            }
+        }
+#endif
+        
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/Yuv2rgb16.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation of class CYuv2Rgb16.
+* YUV to EColor64K colorspace converter concrete classes.
+*
+*/
+
+
+
+#include "yuv2rgb16.h"
+
+// ---------------------------------------------------------
+// CYuv2Rgb16::CYuv2Rgb16()
+// Standard C++ constructor.
+// ---------------------------------------------------------
+//
+CYuv2Rgb16::CYuv2Rgb16()
+{
+    iWidth = iHeight = 0;
+}
+
+// ---------------------------------------------------------
+// CYuv2Rgb16::~CYuv2Rgb16()
+// Destructor
+// ---------------------------------------------------------
+//
+CYuv2Rgb16::~CYuv2Rgb16()
+{
+}
+
+
+// ---------------------------------------------------------
+// CYuv2Rgb16::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------
+//
+void CYuv2Rgb16::ConstructL(TUint aWidth, TUint aHeight, TUint /*aMaxWidth*/, TUint /*aMaxHeight*/)
+{
+    iWidth = aWidth;
+    iHeight = aHeight;
+}
+
+// ---------------------------------------------------------
+// CYuv2Rgb16::Convert()
+// Converts a YUV frame to a EColor64K frame
+// ---------------------------------------------------------
+//
+void CYuv2Rgb16::Convert(const TUint8 *aYBuf, const TUint8 *aUBuf,
+                         const TUint8 *aVBuf,
+                         TUint aBufWidth, TUint aBufHeight,
+                         TUint8 *aTarget, TUint aTargetScanlineLength)
+{
+
+
+    TUint cols;
+    TUint rows = iHeight;       
+    
+    __ASSERT_ALWAYS((aBufWidth >= iWidth) && (aBufHeight >= iHeight),
+        User::Invariant());
+        
+    // Convert all rows, two at a time
+    while ( rows )  
+    {
+        // Convert all pixels in this row, two at a time
+        cols = iWidth;
+        
+        TUint8* target1 = aTarget;
+        TUint8* target2 = aTarget + aTargetScanlineLength;
+        const TUint8* YPtr1 = aYBuf;  
+        const TUint8* YPtr2 = aYBuf + aBufWidth;        
+        const TUint8* UPtr = aUBuf;
+        const TUint8* VPtr = aVBuf;
+
+        TUint    y, u, v;
+        TInt rDiff, gDiff, bDiff;
+        TInt     r, g, b;
+       
+        while ( cols )
+        {
+            y = *(YPtr1)++;
+            u = *(UPtr)++ - 128;
+            v = *(VPtr)++ - 128;
+
+            rDiff = UvToRDiff(v, u);
+            gDiff = UvToGDiff(v, u);
+            bDiff = UvToBDiff(v, u);
+
+            // Convert upper left pixel            
+            r = (TInt)y + rDiff;
+            r = r<0 ? 0 : r>255 ? 0xF800 : (r<<8)&0xF800;
+            g = (TInt)y - gDiff;
+            g = g<0 ? 0 : g>255 ? 0x07E0 : (g<<3)&0x07E0;
+            b = (TInt)y + bDiff;
+            b = b<0 ? 0 : b>255 ? 0x001F : (b>>3)&0x001F;
+
+            // Write the pixel in RGB format
+            *(TUint16*)target1 = (TUint16)(r | g | b);
+            target1 += 2;
+
+            // Convert upper right pixel
+            y = *(YPtr1)++;
+
+            r = (TInt)y + rDiff;
+            r = r<0 ? 0 : r>255 ? 0xF800 : (r<<8)&0xF800;
+            g = (TInt)y - gDiff;
+            g = g<0 ? 0 : g>255 ? 0x07E0 : (g<<3)&0x07E0;
+            b = (TInt)y + bDiff;
+            b = b<0 ? 0 : b>255 ? 0x001F : (b>>3)&0x001F;
+
+            *(TUint16*)target1 = (TUint16)(r | g | b);
+            target1 += 2;
+
+            // Convert lower left pixel
+            y = *(YPtr2)++;
+
+            r = (TInt)y + rDiff;
+            r = r<0 ? 0 : r>255 ? 0xF800 : (r<<8)&0xF800;
+            g = (TInt)y - gDiff;
+            g = g<0 ? 0 : g>255 ? 0x07E0 : (g<<3)&0x07E0;
+            b = (TInt)y + bDiff;
+            b = b<0 ? 0 : b>255 ? 0x001F : (b>>3)&0x001F;
+
+            *(TUint16*)target2 = (TUint16)(r | g | b);
+            target2 += 2;
+                
+            // Convert lower right pixel
+            y = *(YPtr2)++;
+
+            r = (TInt)y + rDiff;
+            r = r<0 ? 0 : r>255 ? 0xF800 : (r<<8)&0xF800;
+            g = (TInt)y - gDiff;
+            g = g<0 ? 0 : g>255 ? 0x07E0 : (g<<3)&0x07E0;
+            b = (TInt)y + bDiff;
+            b = b<0 ? 0 : b>255 ? 0x001F : (b>>3)&0x001F;
+
+            *(TUint16*)target2 = (TUint16)(r | g | b);
+            target2 += 2;
+
+            // Next two pixels                                   
+            cols -= 2;
+        }
+        
+        // Next rows
+        rows -= 2;
+        aYBuf += 2*aBufWidth;
+        aUBuf += aBufWidth/2;
+        aVBuf += aBufWidth/2;
+        aTarget += 2*aTargetScanlineLength;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/activequeue.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,583 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Data buffering and queuing support definitions, class CActiveQueue.
+*
+*/
+
+
+//  EXTERNAL RESOURCES  
+
+
+//  Include Files  
+
+#include "dataprocessor.h"
+#include "activequeue.h"
+
+
+//  MEMBER FUNCTIONS
+
+
+//=============================================================================
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    CActiveQueue()
+
+    Standard C++ constructor
+
+-----------------------------------------------------------------------------
+*/
+
+CActiveQueue::CActiveQueue(TUint aNumberOfBlocks, TUint aBlockLength)
+{
+    // Remember the number of blocks and initial new block length
+    iInitialBlocks = aNumberOfBlocks;
+    iNewBlockLength = aBlockLength;   
+    iStreamEnd = EFalse;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    ~CActiveQueue()
+
+    Standard C++ destructor
+
+-----------------------------------------------------------------------------
+*/
+
+CActiveQueue::~CActiveQueue()
+{
+    // Deallocate all blocks:
+    while ( iBlocks )
+    {
+        TRAPD( error, FreeBlockL(iBlocks) );
+        if (error != KErrNone) { }
+    }
+
+    __ASSERT_DEBUG(iNumBlocks == 0,
+                   User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    ConstructL()
+
+    Standard Symbian OS second-phase constructor, prepares the object for use
+
+-----------------------------------------------------------------------------
+*/
+
+void CActiveQueue::ConstructL()
+{
+    // Allocate initial blocks
+    while ( iInitialBlocks-- )
+    {
+        // Get block
+        TActiveQueueBlock *block = AllocateBlockL();
+
+        // Add it to the free block list
+        block->iNextList = iFreeList;
+        iFreeList = block;
+        iNumFreeBlocks++;
+    }
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    SetReader()
+
+    Sets a reader for the queue
+
+-----------------------------------------------------------------------------
+*/
+
+void CActiveQueue::SetReader(CDataProcessor *aReader, TAny *aUserPointer)
+{
+    iReader = aReader;
+    iReaderUserPointer = aUserPointer;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    RemoveReader()
+
+    Removes a reader from the queue
+
+-----------------------------------------------------------------------------
+*/
+
+void CActiveQueue::RemoveReader()
+{
+    __ASSERT_DEBUG(iReader, User::Panic(_L("CActiveQueue"), ENoReader));
+    iReader = 0;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    SetWriter()
+
+    Sets a writer for the queue
+
+-----------------------------------------------------------------------------
+*/
+
+void CActiveQueue::SetWriter(CDataProcessor *aWriter, TAny *aUserPointer)
+{
+    iWriter = aWriter;
+    iWriterUserPointer = aUserPointer;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    RemoveWriter()
+
+    Removes a writer from the queue
+
+-----------------------------------------------------------------------------
+*/
+
+void CActiveQueue::RemoveWriter()
+{
+    __ASSERT_DEBUG(iWriter, User::Panic(_L("CActiveQueue"), ENoWriter));
+    iWriter = 0;
+}
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    ResetStreamEnd()
+
+    Reset the status of the queue
+
+-----------------------------------------------------------------------------
+*/
+
+void CActiveQueue::ResetStreamEnd()
+{
+    iStreamEnd = EFalse;
+    // we should not have any blocks in full queue if we have reached stream end
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    NumFreeBlocks()
+
+    Get the number of free blocks available for new data
+
+-----------------------------------------------------------------------------
+*/
+
+TUint CActiveQueue::NumFreeBlocks()
+{
+    return iNumFreeBlocks;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    NumDataBlocks()
+
+    Get the number of blocks with data queued
+
+-----------------------------------------------------------------------------
+*/
+
+TUint CActiveQueue::NumDataBlocks()
+{
+    return iNumDataBlocks;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    GetFreeBlockL()
+
+    Get a free block for writing data into the queue (writer)
+
+-----------------------------------------------------------------------------
+*/
+
+TPtr8 *CActiveQueue::GetFreeBlockL(TUint aBlockLength)
+{
+    __ASSERT_DEBUG(iWriter, User::Panic(_L("CActiveQueue"), ENoWriter));
+    TActiveQueueBlock *block = 0;
+    
+    // If the requested block size is larger than the currently used length
+    // for new blocks, use the new size for all new blocks
+    if ( aBlockLength > iNewBlockLength )
+        iNewBlockLength = aBlockLength;
+
+    // Do we have free blocks?
+    if ( iNumFreeBlocks )
+    {
+        // Yes, get a block from the queue:
+        __ASSERT_DEBUG(iFreeList != 0,
+                       User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+        block = iFreeList;
+        iFreeList = block->iNextList;
+        iNumFreeBlocks--;
+
+        // If the block isn't large enough, discard it so that we'll allocate a
+        // new one. Don't discard more than one block to keep the number of
+        // blocks allocated constant.
+        if ( block->MaxLength() < (TInt) aBlockLength )
+        {
+            FreeBlockL(block);
+            block = 0;
+        }
+    }
+
+    // If we didn't get a suitable block, allocate a new one
+    if ( !block )
+        block = AllocateBlockL();
+
+    __ASSERT_DEBUG(block->MaxLength() >= (TInt) aBlockLength,
+                   User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+
+    block->SetLength(0);
+
+    return block;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    WriteBlock()
+
+    Add a data block to the queue (writer)
+
+-----------------------------------------------------------------------------
+*/
+
+void CActiveQueue::WriteBlock(TPtr8 *aBlock)
+{
+    __ASSERT_DEBUG(iWriter, User::Panic(_L("CActiveQueue"), ENoWriter));
+    __ASSERT_DEBUG(!iStreamEnd,
+                   User::Panic(_L("CActiveQueue"), EWriteAfterStreamEnd));
+                   
+    // The block is really a TActiveQueueBlock
+    TActiveQueueBlock *block = (TActiveQueueBlock*) aBlock;
+
+
+    // Add the block to the queue:
+    if ( iDataQueueTail )
+    {
+        // The queue is not empty
+        __ASSERT_DEBUG(iDataQueueHead && iNumDataBlocks,
+                       User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+        iDataQueueTail->iNextList = block;
+        iDataQueueTail = block;
+        block->iNextList = 0;
+    }
+    else
+    {
+        // The queue is empty -> this will be the first block
+        __ASSERT_DEBUG((!iDataQueueHead) && (!iNumDataBlocks),
+                       User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+        iDataQueueHead = block;
+        iDataQueueTail = block;
+        block->iNextList = 0;
+    }
+    iNumDataBlocks++;
+
+    // If we have a reader, notify it about the new data
+    if ( iReader )
+        iReader->InputDataAvailable(iReaderUserPointer);
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    ReadBlock()
+
+    Read a data block from the queue (reader)
+
+-----------------------------------------------------------------------------
+*/
+
+TPtr8 *CActiveQueue::ReadBlock()
+{
+    __ASSERT_DEBUG(iReader, User::Panic(_L("CActiveQueue"), ENoReader));
+    __ASSERT_DEBUG(((iNumDataBlocks && iDataQueueHead) ||
+                    ((!iNumDataBlocks) && (!iDataQueueHead))),
+                   User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+
+    // If we don't have a block, return NULL
+    if ( !iNumDataBlocks )
+        return 0;
+
+    // Get the block from the queue head
+    TActiveQueueBlock *block = iDataQueueHead;
+    iDataQueueHead = block->iNextList;
+    iNumDataBlocks--;
+    if ( !iNumDataBlocks )
+    {
+        // It was the only block in the queue
+        __ASSERT_DEBUG((!iDataQueueHead) && (iDataQueueTail == block),
+                       User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+        iDataQueueTail = 0;                       
+    }
+    __ASSERT_DEBUG((iDataQueueHead != block) && (iDataQueueTail != block),
+                   User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+
+    // If it was the last block and the stream end has been signaled, notify
+    // the reader
+    if ( iStreamEnd && (!iNumDataBlocks) )
+        iReader->StreamEndReached(iReaderUserPointer);
+
+    // Return the block
+    return ((TPtr8*) block);
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    ReturnBlock()
+
+    Return a read block back to the empty block list (reader)
+
+-----------------------------------------------------------------------------
+*/
+
+void CActiveQueue::ReturnBlock(TPtr8 *aBlock)
+{
+    __ASSERT_DEBUG(iReader, User::Panic(_L("CActiveQueue"), ENoReader));
+                   
+    // The block is really a TActiveQueueBlock
+    TActiveQueueBlock *block = (TActiveQueueBlock*) aBlock;
+
+
+    // Add it to the free list:
+    __ASSERT_DEBUG((((!iNumFreeBlocks) && (!iFreeList)) ||
+                    (iNumFreeBlocks && iFreeList)),
+                   User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+
+    if ( block->MaxLength() == 0 )
+    {
+        block->MaxLength();
+    }
+
+    block->iNextList = iFreeList;
+    iFreeList = block;
+    iNumFreeBlocks++;
+
+    // If we have a writer, notify it about the empty block
+    if ( iWriter )
+        iWriter->OutputSpaceAvailable(iWriterUserPointer);
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    WriteStreamEnd()
+
+    Notify that the stream has ended (writer)
+
+-----------------------------------------------------------------------------
+*/
+
+void CActiveQueue::WriteStreamEnd()
+{
+    __ASSERT_DEBUG(iWriter, User::Panic(_L("CActiveQueue"), ENoWriter));
+
+    // Mark that the stream has ended
+    iStreamEnd = ETrue;
+
+    // If we have a reader and there are no more blocks in the queue, signal
+    // the reader
+    if ( iReader && (!iNumDataBlocks) )
+        iReader->StreamEndReached(iReaderUserPointer);
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    StreamEnded()
+
+    Check if the writer has notified that the stream has ended (reader)
+
+-----------------------------------------------------------------------------
+*/
+
+TBool CActiveQueue::StreamEnded()
+{
+    return iStreamEnd;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    AllocateBlockL()
+
+    Allocates a new data block of size iNewBlockLengh
+
+-----------------------------------------------------------------------------
+*/
+
+TActiveQueueBlock *CActiveQueue::AllocateBlockL()
+{
+    // Allocate the data area for the block
+    TUint8 *data = (TUint8*) User::AllocLC(iNewBlockLength);    
+
+    // Allocate the block
+    TActiveQueueBlock *block = new (ELeave) TActiveQueueBlock(data,
+                                                              iNewBlockLength);
+
+    CleanupStack::Pop(data);
+
+    // Add the block to the list of all blocks:
+    if ( iBlocks )
+    {
+        block->iNextBlock = iBlocks;
+        block->iPrevBlock = 0;
+        iBlocks->iPrevBlock = block;
+        iBlocks = block;
+    }
+    else
+    {
+        block->iNextBlock = 0;
+        block->iPrevBlock = 0;
+        iBlocks = block;
+    }
+
+    __ASSERT_DEBUG((iBlocks &&
+                    ((iBlocks->iNextBlock == 0) ||
+                     (iBlocks->iNextBlock != iBlocks))),
+                   User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+
+    return block;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CActiveQueue
+
+    FreeBlockL()
+
+    Deallocates a block allocated with AllocateBlockL()
+
+-----------------------------------------------------------------------------
+*/
+
+void CActiveQueue::FreeBlockL(TActiveQueueBlock *aBlock)
+{
+    __ASSERT_DEBUG((((aBlock->iPrevBlock != aBlock->iNextBlock) ||
+                     (aBlock->iNextBlock == 0)) &&
+                    ((aBlock == iBlocks) || (aBlock->iPrevBlock != 0))),
+                   User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+    
+    // Remove the block from the list of all blocks:
+    if ( aBlock->iPrevBlock )
+        aBlock->iPrevBlock->iNextBlock = aBlock->iNextBlock;
+    else
+        iBlocks = aBlock->iNextBlock;
+    if ( aBlock->iNextBlock )
+        aBlock->iNextBlock->iPrevBlock = aBlock->iPrevBlock;
+
+    // Free the data area
+    TUint8 *data = (TUint8*) aBlock->Ptr();    
+    User::Free(data);
+
+    // Free the block:
+    delete aBlock;
+
+    __ASSERT_DEBUG(((!iBlocks) ||
+                    (((iBlocks->iNextBlock == 0) ||
+                      (iBlocks->iNextBlock != iBlocks)) &&
+                     (iBlocks->iPrevBlock == 0))),
+                   User::Panic(_L("CActiveQueue"), EInternalAssertionFailure));
+}
+
+
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/audioprocessor.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,291 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation of audio processor class.                
+*
+*/
+
+
+//  Include Files
+#include "movieprocessorimpl.h"
+#include "AudSong.h"
+#include "audioprocessor.h"
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+// Macros
+#define APASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CAudioProcessor"), -30000))
+
+const TUint KNumFramesInOneRun = 20;
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CAudioProcessor::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------
+//
+CAudioProcessor* CAudioProcessor::NewL(CMovieProcessorImpl *aMovieProcessor, CAudSong* aSong)
+{
+    CAudioProcessor* self = NewLC(aMovieProcessor, aSong);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+CAudioProcessor* CAudioProcessor::NewLC(CMovieProcessorImpl *aMovieProcessor, CAudSong* aSong)
+{
+    CAudioProcessor* self = new (ELeave) CAudioProcessor(aMovieProcessor, aSong);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+
+// ---------------------------------------------------------
+// CAudioProcessor::NewL
+// C++ default constructor
+// ---------------------------------------------------------
+//
+CAudioProcessor::CAudioProcessor(CMovieProcessorImpl *aMovieProcessor, CAudSong* aSong) : CActive(EPriorityNormal)
+{
+    iMovieProcessor = aMovieProcessor;
+    iSong = aSong;	
+    iProcessing = EFalse;
+}
+
+// -----------------------------------------------------------------------------
+// CAudioProcessor::ConstructL
+// Symbian 2nd phase constructor 
+// -----------------------------------------------------------------------------
+//
+void CAudioProcessor::ConstructL()
+{
+
+    if(!iSong)
+    {
+        User::Leave(KErrArgument);	
+    }     	
+
+    SetPriority( EPriorityNormal );
+    // Add to active scheduler
+    CActiveScheduler::Add(this);
+    
+    // Make us active
+    SetActive();
+    iStatus = KRequestPending;
+  
+}
+
+// -----------------------------------------------------------------------------
+// CAudioProcessor::~CAudioProcessor
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CAudioProcessor::~CAudioProcessor()
+{
+    PRINT((_L("CAudioProcessor::~CAudioProcessor() begin")));
+
+    Cancel();
+
+    PRINT((_L("CAudioProcessor::~CAudioProcessor() end")));
+}
+
+
+// -----------------------------------------------------------------------------
+// CAudioProcessor::DoCancel()
+// DoCancel for AO framework
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAudioProcessor::DoCancel()
+{
+    // Cancel our internal request
+    if ( iStatus == KRequestPending )
+    {
+        PRINT((_L("CAudioProcessor::DoCancel() cancel request")))
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrCancel);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CAudioProcessor::RunL()
+// Running method of AO framework
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAudioProcessor::RunL()
+{
+
+    if (!iProcessing)
+        return;
+    
+    ProcessFramesL();
+        
+}
+
+
+// -----------------------------------------------------------------------------
+// CAudioProcessor::ProcessFramesL()
+// Process audio frames
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAudioProcessor::ProcessFramesL()
+{
+
+    TInt progress = 0;
+    HBufC8* frame = 0;
+    TPtr8 ptr(0,0);	
+    TTimeIntervalMicroSeconds time(0);
+    
+    TBool gotFrame = ETrue; // true indicates end of sequence
+    
+    TInt framesProcessed = 0;
+    
+    do
+    {	    
+        gotFrame = iSong->SyncProcessFrameL(frame,progress,time); 
+
+        if(gotFrame)
+        {
+            break;		
+        }
+
+        if (frame == NULL || frame->Size() == 0)
+        {
+            continue;
+        }
+		
+        CleanupStack::PushL(frame);
+
+        TInt duration = I64INT(time.Int64()); 
+
+        ptr.Set((TUint8*)frame->Ptr(),frame->Length(),frame->Length());
+
+        User::LeaveIfError(iMovieProcessor->WriteAllAudioFrames((TDesC8&)ptr,duration));			
+
+        CleanupStack::Pop();
+
+        if(frame != 0)
+        {
+            delete frame;		
+            frame = 0;
+        }
+
+        // Increment the frame number
+        framesProcessed++;
+
+        if (framesProcessed >= KNumFramesInOneRun)
+        {
+            iStatus = KRequestPending;
+            SetActive();
+            TRequestStatus *tmp = &iStatus;
+            User::RequestComplete( tmp, KErrNone );
+            return;
+        }			
+		
+	} while(!gotFrame);
+	
+    if(frame!=0)
+    {
+        delete frame;
+        frame = 0;
+    }
+
+    // finished
+    iProcessing = EFalse;
+
+    iMovieProcessor->AudioProcessingComplete(KErrNone);	
+	
+}
+
+// -----------------------------------------------------------------------------
+// CAudioProcessor::RunError()
+// RunError method of AO framework
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CAudioProcessor::RunError(TInt aError)
+{
+    iProcessing = EFalse;
+
+    iMovieProcessor->AudioProcessingComplete(aError);
+
+    return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+// CAudioProcessor::StartL()
+// Stops audio processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAudioProcessor::StartL()
+{
+    PRINT((_L("CAudioProcessor::StartL() begin")));
+    
+    if ( iProcessing )
+        return;
+    
+    if (iSong->ClipCount(KAllTrackIndices) == 0)
+    {
+        iMovieProcessor->AudioProcessingComplete(KErrNone);
+        return;    	
+    }
+
+    iSong->SyncStartProcessingL();
+    
+    TRequestStatus *status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+    
+    iProcessing = ETrue;    
+
+    PRINT((_L("CAudioProcessor::StartL() end")));
+}
+
+// -----------------------------------------------------------------------------
+// CAudioProcessor::StopL()
+// Stops audio processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CAudioProcessor::StopL()
+{
+    PRINT((_L("CAudioProcessor::StopL() begin")));
+    
+    if ( !iProcessing )
+        return;
+
+    Cancel();
+    
+    iSong->SyncCancelProcess();
+
+    iMovieProcessor->AudioProcessingComplete(KErrNone);
+
+    iProcessing = EFalse;
+    
+    PRINT((_L("CAudioProcessor::StopL() end")));
+}
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/dataprocessor.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Base class for data processor objects.
+*
+*/
+
+
+
+//  EXTERNAL RESOURCES  
+
+
+//  Include Files  
+
+#include "dataprocessor.h"
+
+
+
+
+//  MEMBER FUNCTIONS
+
+
+//=============================================================================
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDataProcessor
+
+    CDataProcessor()
+
+    Standard C++ constructor
+
+-----------------------------------------------------------------------------
+*/
+
+CDataProcessor::CDataProcessor(TInt aPriority)
+    : CActive(aPriority)
+{
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDataProcessor
+
+    ~CDataProcessor()
+
+    Standard C++ destructor
+
+-----------------------------------------------------------------------------
+*/
+
+CDataProcessor::~CDataProcessor()
+{
+    Cancel();
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDataProcessor
+
+    ConstructL()
+
+    Standard Symbian OS second-phase constructor
+
+-----------------------------------------------------------------------------
+*/
+
+void CDataProcessor::ConstructL()
+{
+    // Add to active scheduler and activate
+    CActiveScheduler::Add(this);
+    SetActive();
+    iStatus = KRequestPending;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDataProcessor
+
+    InputDataAvailable()
+
+    Called by CActiveQueue when input data is available, simply signals the
+    object
+
+-----------------------------------------------------------------------------
+*/
+
+void CDataProcessor::InputDataAvailable(TAny* /*aUserPointer*/)
+{
+    if ( iStatus == KRequestPending )
+    {
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+    }
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDataProcessor
+
+    OutputSpaceAvailable()
+
+    Called by CActiveQueue when output space is available, simply signals the
+    object
+
+-----------------------------------------------------------------------------
+*/
+
+void CDataProcessor::OutputSpaceAvailable(TAny* /*aUserPointer*/)
+{
+
+    if ( iStatus == KRequestPending )
+    {
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+    }
+
+
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDataProcessor
+
+    StreamEndReached()
+
+    Called by CActiveQeueue after all data has been read from a queue where
+    stream end has been signaled. Does nothing in this base class.
+
+-----------------------------------------------------------------------------
+*/
+
+void CDataProcessor::StreamEndReached(TAny* /*aUserPointer*/)
+{
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CDataProcessor
+
+    DoCancel()
+
+    Cancels the internal request.
+
+-----------------------------------------------------------------------------
+*/
+
+void CDataProcessor::DoCancel()
+{
+    if ( iStatus == KRequestPending )
+    {
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrCancel);
+    }
+}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/epoclib.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,253 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Wrappers for Symbian OS -specific system functions.
+*
+*/
+
+
+#include <e32base.h>
+#include <s32file.h>
+#include "nrctyp32.h"
+#include "epoclib.h"
+
+#define NAMELEN 120
+#define EL_EXPORT
+
+
+EL_EXPORT void free(TAny *ptr)
+
+    {
+#ifdef MALLOC_DEBUG        
+    if ( !ptr )
+        return;
+
+    unsigned *p32 = (unsigned*) (((unsigned) ptr) - (NAMELEN+8));
+
+    if ( p32[0] != 0xdaded1d0 )
+        User::Panic(_L("BadFree"), 1);
+
+    ptr = (TAny*) p32;
+#endif
+    
+    //  Dangling pointer check
+//    User::Free(ptr);
+    unsigned count = (unsigned) User::AllocLen(ptr);
+    TUint8 *p;
+    
+    p = (TUint8*) ptr;
+    while ( count >> 2 )
+    {
+        *((TUint32*)p) = 0xfeedf1d0;
+        p += 4;
+        count -= 4;
+    }
+    while ( count )
+    {
+        *(p++) = 0x17;
+        count--;
+    }
+
+    User::Free(ptr);
+    }
+
+#ifdef MALLOC_DEBUG
+EL_EXPORT TAny *debugMalloc(u_int32 size, char *file, int line)
+#else    
+EL_EXPORT TAny *malloc(u_int32 size)
+#endif    
+    {
+    // Uninit checks        
+//    return User::AllocL(size);
+    TAny *ptr;
+    unsigned count = size;
+    TUint8 *p;
+
+#ifdef MALLOC_DEBUG
+    ptr = User::AllocL(size + NAMELEN+8);
+    p = ((TUint8*) ptr) + NAMELEN+8;
+#else
+    ptr = User::AllocL(size);
+    p = (TUint8*) ptr;
+#endif    
+    
+    while ( count >> 2 )
+    {
+        *((TUint32*)p) = 0xdeadbeef;
+        p += 4;
+        count -= 4;
+    }
+    while ( count )
+    {
+        *(p++) = 0x42;
+        count--;
+    }
+
+#ifdef MALLOC_DEBUG
+    unsigned *p32 = (unsigned*) ptr;
+    p32[0] = 0xdaded1d0;
+    p32[1] = (unsigned) line;
+    char *c = (char*) &p32[2];
+    int n = NAMELEN;
+    while ( (*file != 0) && n )
+    {
+        *(c++) = *(file++);
+        n--;
+    }
+    return (TAny*) (((unsigned) p32) + NAMELEN + 8);
+#else  
+    return ptr;
+#endif    
+    }
+
+EL_EXPORT TAny *realloc(void *memblock, u_int32 size)
+    {
+#ifdef MALLOC_DEBUG
+    unsigned *p32 = (unsigned*) (((unsigned) memblock) - NAMELEN - 8);
+
+    if ( p32[0] != 0xdaded1d0 )
+        User::Panic(_L("BadRealloc"), 1);
+
+    p32 = (unsigned*) User::ReAllocL((void*) p32, size+NAMELEN+8);
+    return (TAny*) (((unsigned) p32) + NAMELEN + 8);
+#else
+    return User::ReAllocL(memblock, size);
+#endif    
+    }
+
+
+#ifdef MALLOC_DEBUG
+EL_EXPORT TAny *debugCalloc(u_int32 num, u_int32 size, char *file, int line)
+{
+    TAny *ptr;
+    TUint8 *p;
+
+    ptr = User::Alloc(num*size + NAMELEN+8);
+    if ( !ptr )
+        return 0;
+    p = ((TUint8*) ptr) + NAMELEN+8;
+    
+    Mem::Fill(p, size*num, 0);
+
+    unsigned *p32 = (unsigned*) ptr;
+    p32[0] = 0xdaded1d0;
+    p32[1] = (unsigned) line;
+    char *c = (char*) &p32[2];
+    int n = NAMELEN;
+    while ( (*file != 0) && n )
+    {
+        *(c++) = *(file++);
+        n--;
+    }
+    return (TAny*) p;
+}
+#else    
+EL_EXPORT TAny *calloc(u_int32 num, u_int32 size)
+
+    {
+    TAny *dest = User::Alloc(size*num);
+    Mem::Fill(dest, size*num, 0);
+    return dest;
+    }
+#endif
+
+EL_EXPORT TAny *memset(TAny *dest, TInt c, u_int32 size)
+    {
+    Mem::Fill(dest, size, c);
+    return dest; //returning the value of dest as in windows
+    }
+EL_EXPORT TAny *memcpy(TAny *dest, const TAny *src, u_int32 size)
+    {
+    Mem::Copy(dest, src, size);
+    return dest;
+    }
+
+EL_EXPORT TAny *memmove(TAny *dest, const TAny *src, u_int32 count)
+    {
+    Mem::Copy(dest,src,count);
+    return dest;
+    }
+
+long atol(
+        const char *nptr
+        )
+{
+        int c;              // current char 
+        long total;         // current total 
+        int sign;           // if '-', then negative, otherwise positive 
+
+        TLex8 string((unsigned char *)nptr);
+        // skip whitespace 
+        string.SkipSpace();
+        
+        //prendre un caratere dans string lui faire le sign
+        c = (int)string.Peek();
+        string.Inc();
+
+        sign = c;           // save sign indication 
+        if (c == '-' || c == '+')
+        // skip sign 
+            {c = (int)string.Peek();
+              string.Inc();
+            }
+        else //If c is not a sign, it is necessary to go increment back into the descriptors to get the right
+             //number 
+            {
+            string.UnGet();
+            }
+
+        total = 0;
+
+        while (string.Peek().IsDigit())
+            {
+            total = 10 * total + (c - '0');
+            string.Inc();
+            c = (int)string.Peek();
+            
+            }
+
+        if (sign == '-')
+            return -total;
+        else
+            return total;   /* return result, negated if necessary */
+}
+
+
+/*
+*int atoi(char *nptr) - Convert string to long
+*
+*Purpose:
+*       Converts ASCII string pointed to by nptr to binary.
+*       Overflow is not detected.  Because of this, we can just use
+*       atol().
+*
+*Entry:
+*       nptr = ptr to string to convert
+*
+*Exit:
+*       return int value of the string
+*
+*Exceptions:
+*       None - overflow is not detected.
+*
+*******************************************************************************/
+
+EL_EXPORT int atoi(
+        const char *nptr
+        )
+{
+        return (int)atol(nptr);
+}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/movieprocessor.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation of the movie processor
+* interface class.                
+*
+*/
+
+
+//  EXTERNAL RESOURCES
+
+//  Include Files
+
+#include "movieprocessorimpl.h"
+#include "VedMovie.h"
+#include "movieprocessor.h"
+#include "VideoProcessorAudioData.h"
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMovieProcessor* CMovieProcessor::NewL()    
+
+	{
+	CMovieProcessor* self = NewLC();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+CMovieProcessor* CMovieProcessor::NewLC()
+	{
+	CMovieProcessor* self = new (ELeave) CMovieProcessor();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::CMovieProcessor()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMovieProcessor::CMovieProcessor()
+	{
+	iMovieProcessor=0;
+	}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessor::ConstructL()
+	{
+	iMovieProcessor = CMovieProcessorImpl::NewL();
+	}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::~CMovieProcessor
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CMovieProcessor::~CMovieProcessor()
+{
+    iAudioDataArray.ResetAndDestroy();
+	if(iMovieProcessor)
+	{
+		delete iMovieProcessor; 
+		iMovieProcessor=0;
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::StartMovieL
+// Prepares the processor for processing a movie and starts processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessor::StartMovieL(CVedMovieImp* aMovie, const TDesC& aFileName, 
+                                  RFile* aFileHandle,MVedMovieProcessingObserver* aObserver)
+	{    
+	iMovieProcessor->StartMovieL(aMovie, aFileName, aFileHandle, aObserver); 
+	}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::GetVideoClipPropertiesL
+// Retrieves information about the given clip
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessor::GetVideoClipPropertiesL(const TDesC& aFileName,
+                                              RFile* aFileHandle,
+											  TVedVideoFormat& aFormat,
+											  TVedVideoType& aVideoType, 
+											  TSize& aResolution,
+											  TVedAudioType& aAudioType, 
+											  TTimeIntervalMicroSeconds& aDuration,
+											  TInt& aVideoFrameCount,
+											  TInt& aSamplingRate, 
+											  TVedAudioChannelMode& aChannelMode)
+	{	
+
+	iMovieProcessor->GetClipPropertiesL(aFileName, aFileHandle, aFormat, aVideoType, 
+		aResolution, aAudioType,  aDuration, aVideoFrameCount, aSamplingRate, aChannelMode);
+
+	return; 
+
+	}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::GenerateVideoFrameInfoArrayL
+// Retrieves frames parameters for a clip to array
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessor::GenerateVideoFrameInfoArrayL(const TDesC& aFileName, RFile* aFileHandle, TVedVideoFrameInfo*& aVideoFrameInfoArray)
+    {
+    iMovieProcessor->GenerateVideoFrameInfoArrayL((const TDesC&)aFileName, aFileHandle,(TVedVideoFrameInfo*&)aVideoFrameInfoArray);
+    return;
+    }
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::GetMovieSizeEstimateL
+// Calculates file size estimate for the output file
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessor::GetMovieSizeEstimateL(const CVedMovie* aMovie)
+	{
+	return iMovieProcessor->GetMovieSizeEstimateL(aMovie); 
+	}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::GetMovieSizeEstimateForMMSL
+// Calculates file size estimate for the output file
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessor::GetMovieSizeEstimateForMMSL(const CVedMovie* aMovie, TInt aTargetSize, 
+												  TTimeIntervalMicroSeconds aStartTime, 
+												  TTimeIntervalMicroSeconds& aEndTime)
+	{
+	return iMovieProcessor->GetMovieSizeEstimateForMMSL(aMovie, aTargetSize, aStartTime, aEndTime); 
+	}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::StartThumbL
+// Initiates thumbnail generation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessor::StartThumbL(const TDesC& aFileName, RFile* aFileHandle, TInt aIndex, 
+                                  TSize aResolution, TDisplayMode aDisplayMode, TBool aEnhance)
+	{
+	iMovieProcessor->StartThumbL(aFileName, aFileHandle, aIndex, aResolution, aDisplayMode, aEnhance); 
+	}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::ProcessThumbL
+// Starts thumbnail image generation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+void CMovieProcessor::ProcessThumbL(TRequestStatus &aStatus, TVedTranscodeFactor* aFactor)
+{
+    iMovieProcessor->ProcessThumbL(aStatus, aFactor);
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::FetchThumb
+// Gets a pointer to completed thumbnail bitmap
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+void CMovieProcessor::FetchThumb(CFbsBitmap*& aThumb)
+{
+    iMovieProcessor->FetchThumb(aThumb);   
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::CancelProcessingL
+// Stops processing the movie
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessor::CancelProcessingL()
+{
+    iMovieProcessor->CancelProcessingL();
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessor::SetMovieSizeLimit
+// Sets the maximum size for the movie
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+void CMovieProcessor::SetMovieSizeLimit(TInt aLimit)
+    {
+    iMovieProcessor->SetMovieSizeLimit(aLimit);
+    }
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/movieprocessorimpl.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,6444 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for movie processor
+*
+*/
+
+
+//  Include Files
+
+#include "movieprocessorimpl.h"
+#include "statusmonitor.h"
+#include "activequeue.h"
+#include "mp4parser.h"
+#include "mp4composer.h"
+#include "videoencoder.h"
+#include "yuv2rgb12.h"
+#include "yuv2rgb16.h"
+#include "yuv2rgb24.h"
+#include "VideoProcessorAudioData.h"
+#include "DisplayChain.h"
+#include "VedRgb2YuvConverter.h"
+#include "vedaudiosettings.h"
+#include "vedvideosettings.h"
+#include "AudSong.h"
+#include "audioprocessor.h"
+#include "SizeEstimate.h"
+#include "vedavcedit.h"
+
+//  Local Constants
+
+const TUint KReadBufInitSize = 512; // stream start buffer initial size
+//const TInt	KVideoProcessorPriority = CActive::EPriorityHigh;
+const TUint KVideoQueueBlocks = 16;
+const TUint KVideoQueueBlockSize = 256;
+const TInt	KDemuxPriority = CActive::EPriorityHigh;
+const TUint	KInitialAudioBufferSize = 1024;
+const TUint KInitialVideoBufferSize = 10240;
+const TUint KMaxVideoSpeed = 1000;
+const TUint KVideoTimeScale = 5000; // for both normal & generated clips
+const TUint KAMRAudioTimeScale = 8000;
+
+const TUint KDiskSafetyLimit = 400000;   // Amount of free disk space to leave unused
+
+_LIT(KTempFilePath ,"c:\\system\\temp\\");  // path for temp file used in image insertion
+
+// An assertion macro wrapper to clean up the code a bit
+#define VPASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CMovieProcessorImpl"), EInvalidInternalState))
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMovieProcessorImpl* CMovieProcessorImpl::NewL() 
+{
+	CMovieProcessorImpl* self = NewLC();
+	CleanupStack::Pop(self);
+	return self;
+}
+
+CMovieProcessorImpl* CMovieProcessorImpl::NewLC()
+{
+	CMovieProcessorImpl* self = new (ELeave) CMovieProcessorImpl();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	return self;
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::CMovieProcessorImpl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMovieProcessorImpl::CMovieProcessorImpl()
+: CActive(EPriorityNormal), iReadImageDes(0,0), iReadDes(0, 0)
+{
+  // Reset state
+    iState = EStateIdle;
+	iDataFormat = EDataAutoDetect;
+    iAudioFramesInSample = KVedAudioFramesInSample;
+
+    iStartTransitionEffect = EVedStartTransitionEffectNone; 
+	iMiddleTransitionEffect = EVedMiddleTransitionEffectNone; 
+	iPreviousMiddleTransitionEffect = EVedMiddleTransitionEffectNone;
+	iEndTransitionEffect = EVedEndTransitionEffectNone; 
+	iSpeed = KMaxVideoSpeed; 
+	iColorEffect = EVedColorEffectNone;
+    iNumberOfVideoClips=1; 	
+    iTr.iTrPrevNew = -1;
+	iTr.iTrPrevOrig = -1;	
+    iStartFrameIndex = -1;
+    iMovieSizeLimit = 0;
+    iFrameParametersSize = 0;
+    
+    // We are now properly initialized
+    iState = EStateIdle;
+	
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::~CMovieProcessorImpl
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CMovieProcessorImpl::~CMovieProcessorImpl()
+{
+
+    Cancel();
+
+    TInt error = KErrNone;
+
+	TRAP(error, DoCloseVideoL());	
+
+    DeleteClipStructures();       
+
+	if (iFrameParameters)
+    {
+		User::Free(iFrameParameters);			
+        iFrameParameters = 0; 
+    }
+        
+	if (iVideoClipParameters)
+    {
+		User::Free(iVideoClipParameters);	
+        iVideoClipParameters = 0; 
+    }
+
+    if (iOutAudioBuffer) {
+		delete iOutAudioBuffer; 
+        iOutAudioBuffer=0;    
+    }
+
+    if (iOutVideoBuffer) {
+		delete iOutVideoBuffer; 
+        iOutVideoBuffer=0;    
+    }
+
+	// although this should be released by VideoEditorEngine, 
+	// the following is still needed in case of leave 
+
+	if(iDemux)
+    {
+		delete iDemux;				
+        iDemux = 0; 
+    }
+
+	if(iVideoProcessor)
+    {
+		delete iVideoProcessor;	
+        iVideoProcessor = 0;	
+    }
+
+    if (iComposer) {
+        delete iComposer; 
+        iComposer = 0;
+    }
+    
+    if (iAudioProcessor)
+    {
+        delete iAudioProcessor;
+        iAudioProcessor = 0;	
+    }        
+
+	if(iImageComposer) 
+	{
+		delete iImageComposer;						
+		iImageComposer=0;
+	}
+	
+	if (iImageAvcEdit)
+	{
+	    delete iImageAvcEdit;
+	    iImageAvcEdit = 0;
+	}
+
+	if (iYuvImageBuf)
+	{
+		User::Free(iYuvImageBuf);
+		iYuvImageBuf=0;
+	}
+
+    if(iVideoEncoder) 
+    {
+		delete iVideoEncoder;	
+        iVideoEncoder = 0; 
+    }
+	
+	if(iParser)
+    {
+        delete iParser;
+        iParser = 0;
+    }
+	if(iVideoQueue)
+    {
+		delete iVideoQueue;		
+        iVideoQueue = 0;
+    }
+
+    if (iWaitScheduler)
+    {
+        delete iWaitScheduler;
+        iWaitScheduler = 0;
+    }
+
+	if(iMonitor)
+    {
+		delete iMonitor;			
+        iMonitor = 0; 	
+    }
+    
+    if (iReadBuf)
+		User::Free(iReadBuf);
+
+    if (iRgbBuf)
+    {
+        delete iRgbBuf;
+        iRgbBuf = 0;
+    }        
+    
+    if (iOutBitmap)
+    {
+        delete iOutBitmap;
+        iOutBitmap = 0;
+    }
+    
+    if (iSizeEstimate)
+    {
+        delete iSizeEstimate;
+        iSizeEstimate = 0;
+    }
+    
+    if (iAvcEdit)
+    {
+        delete iAvcEdit;
+        iAvcEdit = 0;
+    }
+    
+    if (iImageYuvConverter)
+    {
+        delete iImageYuvConverter;
+        iImageYuvConverter = 0;
+    }
+
+	// for transition effect
+    if ( iFsConnected )
+    {
+        TRAP(error, CloseTransitionInfoL());
+        iFs.Close();
+        iFsConnected = EFalse;
+    }
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::ConstructL()
+{	
+	
+	// Allocate stream reading buffer
+	iReadBuf = (TUint8*) User::AllocL(KReadBufInitSize);
+	iBufLength = KReadBufInitSize;
+	
+	iClipFileName.Zero();
+	iOutputMovieFileName.Zero();    
+
+    iWaitScheduler = new (ELeave) CActiveSchedulerWait;
+
+    // Add to active scheduler
+    CActiveScheduler::Add(this);
+    
+    iSizeEstimate = CSizeEstimate::NewL(this);
+
+    iState = EStateIdle;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::StartMovieL
+// Prepares the processor for processing a movie and starts processing  
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::StartMovieL(CVedMovieImp* aMovie, const TDesC& aFileName, RFile* aFileHandle,
+                                      MVedMovieProcessingObserver* aObserver)
+{
+
+    PRINT((_L("CMovieProcessorImpl::StartMovieL() begin")))
+
+    // reset member variables
+    ResetL();
+
+	// get arguments 
+	iMovie = aMovie; 
+    if (!iMovie)
+        User::Leave(KErrArgument);
+
+	iOutputMovieFileName = aFileName;
+	iOutputFileHandle = aFileHandle;	
+    
+    CVedMovieImp* movie = (iMovie);
+    iObserver = aObserver;
+
+    if (!iObserver)
+        User::Leave(KErrArgument);    
+
+    if (iMonitor) 
+    {
+        delete iMonitor;
+        iMonitor = 0;
+    }    
+    
+     // Create a status monitor object:
+	iMonitor = new (ELeave) CStatusMonitor(iObserver, this, aMovie);
+	iMonitor->ConstructL();
+	
+	// update movie properties	
+	iFramesProcessed=0;
+	iNumberOfVideoClips = iMovie->VideoClipCount();
+    iNumberOfAudioClips = iMovie->AudioClipCount();    
+
+	// calculate total movie duration for progress bar: video & audio tracks.
+	// in milliseconds
+	iTotalMovieDuration = TInt64(2) * ( movie->Duration().Int64()/1000 );
+    
+    for (TInt i = 0; i < iNumberOfVideoClips; i++)
+    {
+        CVedVideoClip* currentClip = movie->VideoClip(i);
+		CVedVideoClipInfo* currentInfo = currentClip->Info();
+
+        // Take time to generate a clip into account
+        if (currentInfo->Class() == EVedVideoClipClassGenerated)
+        {            
+            iTotalMovieDuration += currentInfo->Duration().Int64()/1000;
+        }
+    }    
+
+	// set media types
+	SetOutputMediaTypesL();
+
+	// get transcode factors: bitstream mode & time inc. resolution
+	GetTranscodeFactorsL();
+
+	// set video transcoding parameters
+	SetupTranscodingL();
+	
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+	// check if AVC editing is involved
+	TBool avcEditing = ( iOutputVideoType == EVideoAVCProfileBaseline );		
+    for(TInt i = 0; i < movie->VideoClipCount() && avcEditing == EFalse; i++)
+	{
+		CVedVideoClip* currentClip = movie->VideoClip(i);
+		CVedVideoClipInfo* currentInfo = currentClip->Info();
+				
+		if( currentInfo->Class() == EVedVideoClipClassFile &&
+		   (currentInfo->VideoType() == EVedVideoTypeAVCBaselineProfile) )
+		{
+		    avcEditing = ETrue;
+		    break;
+	    }
+	}		
+	
+	if (avcEditing)
+	{
+	    // create AVC editing instance
+	    iAvcEdit = CVedAVCEdit::NewL();	    
+	}
+	
+	if (iOutputVideoType == EVideoAVCProfileBaseline)
+	{
+	    // set level
+	    iAvcEdit->SetOutputLevel( GetOutputAVCLevel() );
+	}
+		
+#endif
+
+	// Check
+	//iOutputAudioType = EAudioAMR;						// default is Amr if all are generated
+
+	if ( iFsConnected == EFalse )
+	{
+        User::LeaveIfError( iFs.Connect() );
+        iFsConnected = ETrue;
+	}
+
+    if (iNumberOfVideoClips)
+    {
+        iStartTransitionEffect = aMovie->StartTransitionEffect();
+        iEndTransitionEffect = aMovie->EndTransitionEffect();	
+		CloseTransitionInfoL();
+    }
+
+	iImageEncodeProcFinished = 0; // to indicate whether encode images process is finished
+	iImageEncodedFlag = 0;  // has an image been encoded
+	iFirstTimeProcessing = 0;
+	iTotalImagesProcessed = 0;  
+	iImageClipCreated = 0;  // has an image clip been created
+	
+	iImageVideoTimeScale = KVideoTimeScale; // Initializing to standard value
+	iGetFrameInProgress = 0;
+	iOutputAudioTimeSet = 0;
+	iOutputVideoTimeSet = 0;
+	iAllGeneratedClips = 0;   // Indicates if all the clips in the movie are generated clips - 0 indicates false
+	iEncodeInProgress = 0;     // Indicates encoding is not in progress		
+	iFirstClipHasNoDecInfo = EFalse;
+	
+	// Allocate memory for frame parameters array
+	if (iFrameParameters)
+        User::Free(iFrameParameters);
+    
+    iFrameParameters = 0;
+	iFrameParameters = (struct TFrameParameters *)User::AllocL(iFrameParametersSize * sizeof(struct TFrameParameters));
+	Mem::Fill(iFrameParameters, iFrameParametersSize * sizeof(TFrameParameters), 0);
+	
+	InitializeClipStructuresL();
+	
+	// second pass starts here 
+	// load first clip properties 
+	iVideoClipNumber=0; 
+    iAudioClipNumber=0;	   
+
+    if (iNumberOfVideoClips)
+        iVideoClip = movie->VideoClip(iVideoClipNumber);    
+
+	// if clip is not file-based, then call some other initializer
+	TInt firstClipIsGenerated = 0;
+	iFirstClipIsGen = EFalse;
+
+	// what if iNumberOfVideoClips == 0, this will fail !
+	if(iNumberOfVideoClips && iVideoClip->Info()->Class() == EVedVideoClipClassGenerated)
+	{
+		// since frame parameters are not available here, use temporary instantiation for composer
+		TemporaryInitializeGeneratedClipL(); 
+		// note that we may need to create a parser temporarily
+		firstClipIsGenerated = 1;
+		iFirstClipIsGen = ETrue;
+	}
+	else
+	{
+		InitializeClipL();	// check details inside initialization
+	}
+
+	if(iOutputAudioType == EAudioAMR)
+	{
+		if( iAudioType == EAudioNone)
+			iAudioType = EAudioAMR;
+		iAudioFramesInSample = KVedAudioFramesInSample;
+	}
+
+	else if(iOutputAudioType == EAudioAAC)
+	{
+		if( iAudioType == EAudioNone)
+		{
+			iAudioType = EAudioAAC;	
+			iFirstClipHasNoDecInfo = ETrue; // because it has no audio so it will have no decoder specific Info			
+		}
+		iAudioFramesInSample = 1;
+	}
+
+
+	VPASSERT(!iComposer);
+    // initialize composer
+    if (iOutputFileHandle)
+        iComposer = CMP4Composer::NewL(iOutputFileHandle, (CParser::TVideoFormat)iOutputVideoType, (CParser::TAudioFormat)iOutputAudioType, iAvcEdit);
+    else
+	    iComposer = CMP4Composer::NewL(iOutputMovieFileName, (CParser::TVideoFormat)iOutputVideoType, (CParser::TAudioFormat)iOutputAudioType, iAvcEdit);
+
+    iFramesProcessed = 0;
+    iStartingProcessing = ETrue;
+    
+    VPASSERT(iOutputVideoTimeScale);
+    VPASSERT(iOutputAudioTimeScale);
+    VPASSERT(iAudioFramesInSample);    
+
+    // write video & audio descriptions
+    CComposer::TStreamParameters streamParameters;
+
+	if(iAllGeneratedClips == 0)  // if all were generated initialize to default
+	{
+		if (iNumberOfVideoClips) 
+		{
+			streamParameters = (CComposer::TStreamParameters &)iParser->iStreamParameters;
+			TSize tmpSize = iMovie->Resolution();
+			streamParameters.iVideoWidth = tmpSize.iWidth;    /* iVideoParameters.iWidth;  */
+			streamParameters.iVideoHeight = tmpSize.iHeight;  /* iVideoParameters.iHeight; */
+			streamParameters.iHaveAudio = ETrue;    //because u always insert silent amr frames atleast//aac frames
+			if(iOutputAudioType == EAudioAMR)
+				streamParameters.iAudioFormat = (CComposer::TAudioFormat)CComposer::EAudioFormatAMR;
+
+			else if(iOutputAudioType == EAudioAAC)
+				streamParameters.iAudioFormat = (CComposer::TAudioFormat)CComposer::EAudioFormatAAC;	//if amr out is amr else aac if none it will be none
+
+		}
+		else
+		{
+		    // No video, only audio; generate black frames. Can't use iParser->iStreamParameters since iParser doesn't exist
+		    // SetHeaderDefaults() checked the resolution from movie to iVideoParameters
+			streamParameters.iVideoWidth = iVideoParameters.iWidth;
+			streamParameters.iVideoHeight = iVideoParameters.iHeight;
+		}
+	}
+	else
+	{	
+
+		/* since all clips inserted are generated */
+		iVideoType = iOutputVideoType;		
+
+		VPASSERT( (iVideoType == EVideoH263Profile0Level10) ||
+                  (iVideoType == EVideoH263Profile0Level45) ||
+		          (iVideoType == EVideoMPEG4) ||
+		          (iVideoType == EVideoAVCProfileBaseline) );		
+
+		streamParameters.iCanSeek = ETrue;
+		streamParameters.iNumDemuxChannels = 1; /* Because video will be there */
+		TTimeIntervalMicroSeconds movduration = TTimeIntervalMicroSeconds(movie->Duration());
+		TInt64 alllength = movduration.Int64();			
+		streamParameters.iAudioLength = I64INT(alllength);
+		streamParameters.iVideoLength = I64INT(alllength);
+		streamParameters.iStreamLength = I64INT(alllength); 
+		streamParameters.iVideoWidth = iVideoParameters.iWidth;
+		streamParameters.iVideoHeight = iVideoParameters.iHeight;
+
+		if (iOutputAudioType == EAudioAMR)
+		{
+			streamParameters.iAudioFormat = (CComposer::TAudioFormat) CComposer::EAudioFormatAMR; 
+			streamParameters.iHaveVideo = ETrue;
+			streamParameters.iNumDemuxChannels++;
+			streamParameters.iAudioFramesInSample = KVedAudioFramesInSample;
+			iAudioFramesInSample = KVedAudioFramesInSample;
+		}
+
+		else if (iOutputAudioType == EAudioAAC)
+		{
+			streamParameters.iAudioFormat = (CComposer::TAudioFormat) CComposer::EAudioFormatAAC; 
+			streamParameters.iHaveVideo = ETrue;
+			streamParameters.iNumDemuxChannels++;
+			streamParameters.iAudioFramesInSample = 1;
+			iAudioFramesInSample = 1;	// Same as above
+		}
+
+		else
+		{
+		
+			streamParameters.iAudioFormat = (CComposer::TAudioFormat) CComposer::EAudioFormatNone; 
+			streamParameters.iHaveAudio =EFalse;
+			streamParameters.iAudioLength =0;	/* reset audio length as it was set to videolength */
+			streamParameters.iAudioFramesInSample = KVedAudioFramesInSample;
+			iAudioFramesInSample = KVedAudioFramesInSample;
+		}
+		
+		streamParameters.iAudioTimeScale = KAMRAudioTimeScale;
+		streamParameters.iVideoTimeScale = iImageVideoTimeScale;
+		iOutputVideoTimeScale = iImageVideoTimeScale;
+		iOutputAudioTimeScale = KAMRAudioTimeScale;
+
+	}
+	
+    TAudFileProperties outProp = iMovie->Song()->OutputFileProperties();
+    
+    if (iMovie->Song()->ClipCount(KAllTrackIndices) > 0)
+    {
+        if ( outProp.iAudioType == EAudAAC_MPEG4)
+        {
+            iOutputAudioTimeScale = outProp.iSamplingRate;
+               
+        }    
+    }    
+
+	streamParameters.iVideoFormat = (CComposer::TVideoFormat)iOutputVideoType;
+	streamParameters.iStreamBitrate = iMovie->VideoStandardBitrate();
+	iComposer->ComposeHeaderL(streamParameters, iOutputVideoTimeScale, iOutputAudioTimeScale, iAudioFramesInSample);
+
+	if( firstClipIsGenerated == 1 )
+	{
+		// since first clip is generated, destroy parser
+		iMonitor->PrepareComplete();
+		iMonitor->ProcessingStarted(iStartingProcessing);
+		iStartingProcessing = EFalse;
+		iState = EStateProcessing;
+		
+		// since first clip is generated, destroy parser
+		if(iAllGeneratedClips == 1)
+		{
+			if(iParser)
+			{	
+				delete iParser;
+				iParser =0;
+			}
+		}
+	}
+	    
+    PRINT((_L("CMovieProcessorImpl::StartMovieL() end")))
+	
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::SetOutputMediaTypesL
+// Set output audio/video types
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::SetOutputMediaTypesL()
+{
+
+	CVedMovieImp* movie = (iMovie);
+
+	if( movie->VideoType() == EVedVideoTypeH263Profile0Level10 )
+		iOutputVideoType = EVideoH263Profile0Level10;
+
+	else if ( movie->VideoType() == EVedVideoTypeH263Profile0Level45 )
+		iOutputVideoType = 	EVideoH263Profile0Level45;
+
+	else if ( movie->VideoType() == EVedVideoTypeMPEG4SimpleProfile )
+		iOutputVideoType = EVideoMPEG4;
+	
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+    else if ( movie->VideoType() == EVedVideoTypeAVCBaselineProfile )
+		iOutputVideoType = EVideoAVCProfileBaseline;
+#endif
+
+	else 
+		User::Leave(KErrArgument);
+
+	CAudSong* songPointer = movie->Song();
+	if ( songPointer->ClipCount(KAllTrackIndices) > 0 )
+	    {
+    	if( movie->AudioType() == EVedAudioTypeAMR )
+    		iOutputAudioType = 	EAudioAMR;
+
+    	else if ( movie->AudioType() == EVedAudioTypeAAC_LC )
+    		iOutputAudioType = EAudioAAC;
+    	else 
+	    	User::Leave(KErrArgument);
+	    }
+    else
+        {
+        // no audio
+        iOutputAudioType = EAudioNone;
+        }
+
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetTranscodeFactorsL
+// Retrieve bitstream modes for input clips
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::GetTranscodeFactorsL()
+{
+
+	if (!iNumberOfVideoClips)
+		return;
+
+	CVedMovieImp* movie = (iMovie);
+
+	iThumbnailInProgress = ETrue;	
+
+	InitializeClipStructuresL();
+
+	for(TInt i = 0; i < movie->VideoClipCount(); i++)
+	{
+		CVedVideoClip* currentClip = movie->VideoClip(i);
+		CVedVideoClipInfo* currentInfo = currentClip->Info();
+
+		if( currentInfo->Class() == EVedVideoClipClassFile )
+		{			
+			TVedTranscodeFactor factor;			
+
+            if ( currentInfo->FileHandle() )
+            {
+                iClipFileName.Zero();
+                iClipFileHandle = currentInfo->FileHandle();
+            }
+            else
+            {
+                iClipFileHandle = NULL;
+			    iClipFileName = currentInfo->FileName();
+            }
+			
+			InitializeClipL(); // opens the file & parses header
+			                   // open demux & decoder
+			                   
+            // Calculate the number of frames in the output clip                   
+			iFrameParametersSize += iParser->GetNumberOfVideoFrames();			                   						
+
+			iState = EStateProcessing;
+
+			TInt error = iVideoProcessor->GetTranscodeFactorL(factor);
+
+			if (error != KErrNone)
+				User::Leave(error);
+			
+			if ( ((factor.iStreamType == EVedVideoBitstreamModeMPEG4Resyn)
+			    || (factor.iStreamType == EVedVideoBitstreamModeMPEG4DP)
+			    || (factor.iStreamType == EVedVideoBitstreamModeMPEG4DP_RVLC)
+			    || (factor.iStreamType == EVedVideoBitstreamModeMPEG4Resyn_DP)
+			    || (factor.iStreamType == EVedVideoBitstreamModeMPEG4Resyn_DP_RVLC))
+			    && ( currentClip->Info()->Resolution() == movie->Resolution() )
+			    && ( iOutputVideoType != EVideoAVCProfileBaseline ) )
+			    {
+			    // we do compressed domain transcoding for this clip, and it has 
+			    // other mpeg4 modes than the regular; we need to ensure the VOS/VOL header
+			    // has the resync marked flag enabled
+			    iMpeg4ModeTranscoded = ETrue;
+			    }
+
+			currentInfo->SetTranscodeFactor(factor);
+
+			DoCloseVideoL();  // close all
+			
+			if (iAvcEdit)
+			{
+			    delete iAvcEdit;
+			    iAvcEdit = 0;
+			}
+		}
+		else
+		{
+            // Calculate the number of frames in the output clip 
+		    iFrameParametersSize += (TInt) currentInfo->VideoFrameCount();
+		}
+	}
+	
+	iThumbnailInProgress = EFalse;
+	iState = EStateIdle;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::SetupTranscodingL
+// Set video transcoding parameters
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::SetupTranscodingL()
+{
+
+	if (!iNumberOfVideoClips)
+		return;
+
+	CVedMovieImp* tmovie = (iMovie);
+	TBool transitionExists = EFalse;// Assume there are no middle transitions in any clip
+	TBool cutExists = EFalse;		// Assuming there is no cut in any clip	
+	TBool blackFrames = EFalse;     // Assume there is no need to encode black frames in the end
+	TBool firstClipIsGen = EFalse;
+	TBool firstClipIsFullTranscoded = EFalse;
+	TBool clipFullTranscodingExists = EFalse;
+
+	// Vos issues if first clip uses encoder
+	TBool atleastOneH263 = EFalse;
+	TBool atleastOneMPEG4 = EFalse;
+//	TBool atleastOneAVC = EFalse;
+	TBool differentModesExist = EFalse;
+
+	// initially assume no mpeg4 files so no streammode
+	TVedVideoBitstreamMode streamMode = EVedVideoBitstreamModeUnknown;
+	TBool atleastOneGenerated = EFalse; // assuming that there are no generated clips
+	TBool allGeneratedClips = ETrue; // asssuming all are generated
+	iModeTranslationRequired = EFalse;  // no need for translation in all generated
+	
+	TSize outputVideoResolution = tmovie->Resolution();	// since movie resolution is minimum resolution
+
+	for(TInt i = 0; i < tmovie->VideoClipCount(); i++)
+	{
+		CVedVideoClip* currentClip = tmovie->VideoClip(i);
+		CVedVideoClipInfo* currentInfo = currentClip->Info();
+		if( currentInfo->Class() == EVedVideoClipClassFile )
+		{
+			allGeneratedClips = EFalse;	// there is a file based clip
+			
+			if( (currentInfo->VideoType() == EVedVideoTypeH263Profile0Level10) ||
+				(currentInfo->VideoType() == EVedVideoTypeH263Profile0Level45) )
+			{
+				// if there is even one H263 output is H263
+				atleastOneH263 = ETrue;
+			}
+			else if(currentInfo->VideoType() == EVedVideoTypeAVCBaselineProfile)
+			{
+//				atleastOneAVC = ETrue;
+			}
+			else
+			{
+				if(currentInfo->VideoType() == EVedVideoTypeMPEG4SimpleProfile)	// if there is even one H263 output is H263
+				{
+					atleastOneMPEG4 = ETrue;
+					if(streamMode == EVedVideoBitstreamModeUnknown)
+					{	
+						// since previously no mpeg4 was found to set streammode	
+						streamMode = currentInfo->TranscodeFactor().iStreamType;
+					} 
+					else
+					{
+						if(streamMode != currentInfo->TranscodeFactor().iStreamType)  // different modes in Mpeg4
+							differentModesExist = ETrue;
+					}
+				}
+				else
+				{
+					//Error - improper or unsupported type file
+					User::Leave(KErrNotSupported);
+				}
+			}
+			
+			// Here check if any clip is cut and also if first clip is cut
+			TTimeIntervalMicroSeconds cutinTime = TTimeIntervalMicroSeconds(currentClip->CutInTime());
+			if(cutinTime != TTimeIntervalMicroSeconds(0)) 
+			{   
+				// cut does exist so encoder will be used in at least one clip
+				if(i==0) // which means cut exists in first clip itself
+				{					
+					iFirstClipIsCut = ETrue;
+				}
+				cutExists = ETrue;
+			}
+
+			// check if the clip will be full transcoded also as then we can 
+			// decide whether to change VOS bit and to set ModeTranslation as all would be encoded again
+			TSize currClipRes = currentInfo->Resolution();
+			if(  ( (outputVideoResolution.iWidth != currClipRes.iWidth) && 
+                   (outputVideoResolution.iHeight != currClipRes.iHeight) ) ||
+                 ( iOutputVideoType == EVideoMPEG4 && currentInfo->VideoType() == EVedVideoTypeAVCBaselineProfile ) )
+			{
+				if(i == 0)
+				{
+					firstClipIsFullTranscoded = ETrue;  //for VOS bit change
+				}
+				clipFullTranscodingExists = ETrue;
+			}
+		}
+		else
+		{
+			atleastOneGenerated = ETrue;
+			if(i == 0) // then first clip is generated
+			{
+				firstClipIsGen = ETrue;				
+			}
+		}
+
+		if( i != tmovie->VideoClipCount()-1 )
+		{
+			if(tmovie->MiddleTransitionEffect(i) != EVedMiddleTransitionEffectNone )					
+			{											
+				// this is required to check if any clips have
+				// middle transitions so mode translation will be required	
+				transitionExists = ETrue;  // even if all clips are of same mode
+			}
+		}
+	}
+
+	if( (TVedStartTransitionEffect)tmovie->StartTransitionEffect() != EVedStartTransitionEffectNone )
+	{	
+	    // even if all clips are of same mode but if it is different than what encoder uses transcoding is needed	
+		transitionExists = ETrue;			
+	}
+	
+	if( (TVedEndTransitionEffect)tmovie->EndTransitionEffect() != EVedEndTransitionEffectNone)
+	{
+	    // even if all clips are of same mode but if it is different than what encoder uses transcoding is needed
+		transitionExists = ETrue;
+	}
+    if ( tmovie->Duration().Int64()/1000 > (tmovie->VideoClip(iNumberOfVideoClips-1)->EndTime().Int64()/1000) )
+    {
+        // movie is longer than video track => black frames are encoded in the end => even if all clips are of same mode but if it is different than what encoder uses transcoding is needed
+        blackFrames = ETrue;
+    }
+
+	if(iOutputVideoType == EVideoMPEG4)	// if different modes dont exist then if output is Mpeg4
+	{								
+		PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), output type = MPEG-4")))
+
+		if(differentModesExist)
+		{	
+			PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), different modes exist")))
+
+			// if there are differnet mode Mpeg4's then mode translation is required		
+			iModeTranslationRequired = ETrue;		// regardless of there being generated clips
+		}
+		else
+		{
+			PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), different modes don't exist")))
+
+			if(atleastOneGenerated) // if there are any generated clips
+			{							
+				PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), at least one generated")))
+
+				if(atleastOneMPEG4)		// if there is one Mpeg4 clip atleast	
+				{
+					PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), at least one MPEG-4")))
+
+					if( (streamMode == EVedVideoBitstreamModeMPEG4Regular) ) //generated clips mode will be regular so u need to convert others 
+					{	
+						PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), streamMode is regular")))
+
+						// if all are regular mode no need to change mode
+						iModeTranslationRequired = EFalse;
+					}
+					else
+					{									
+						PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), streamMode != regular")))
+
+						// to regular (with resync)
+						iModeTranslationRequired = ETrue;
+					}
+				}
+				else
+				{
+					if(atleastOneH263)
+					{
+						PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), at least one H.263")))
+						iModeTranslationRequired = ETrue;
+					}
+					else
+					{		
+						PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), all are generated")))
+						// all are generated no h263 or mpeg4
+						iModeTranslationRequired = EFalse;
+					}
+				}
+			}
+			else
+			{
+				PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), no generated clips")))
+
+				if(atleastOneH263)
+				{
+					PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), at least one H.263")))
+					iModeTranslationRequired = ETrue;
+				}
+				else
+				{
+					PRINT((_L("CMovieProcessorImpl::SetupTranscodingL(), no H.263")))
+					// still open if we have MPEG-4 nonregular + encoding
+					iModeTranslationRequired = EFalse;
+				}
+			}
+		}
+	}
+	else
+	{  
+		// output is H263 or AVC so mode translation not required
+		iModeTranslationRequired = EFalse;
+	}
+
+	// make decision of mode translation based on whether there 
+	// was a cut or transition or resolution transcoding in any clip
+
+	if(iOutputVideoType == EVideoMPEG4)	// if output is Mpeg4
+	{
+		if ((!allGeneratedClips) && (streamMode != EVedVideoBitstreamModeMPEG4Regular)) // in case of differentModesExist, iModeTranslationRequired is already ETrue
+	    {
+		    // If we need to encode smth but not all (if all generated => no mix), encoding results in regular stream. 
+		    // However, if input has nonregular, we need to translate the mode
+			if(transitionExists || clipFullTranscodingExists || cutExists || blackFrames) 
+    			{
+				iModeTranslationRequired = ETrue;
+	    		}
+		}
+		// make Decision for changing the Vos of the output movie based on whether the first frame would be encoded
+		if(firstClipIsGen || firstClipIsFullTranscoded || ((TVedStartTransitionEffect)tmovie->StartTransitionEffect() != EVedStartTransitionEffectNone) || iFirstClipIsCut )
+		{	
+			iFirstClipUsesEncoder = ETrue;	// this indicates that you may need to change Vos bit but final decision is 
+		}									// done based on whether it was due to cut on the fly
+	}
+
+}
+
+
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::CreateImage3GPFilesL
+// creates the necessary 3gp files from the given frames
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::CreateImage3GPFilesL(TVideoOperation aCreateMode)
+{   
+
+    if (iProcessingCancelled)
+        return KErrNone;
+	
+	if(aCreateMode == EVideoEncodeFrame) 
+	{
+        // encode frame		
+		TTimeIntervalMicroSeconds inMicroSeconds = TTimeIntervalMicroSeconds(iVideoClip->Info()->Generator()->VideoFrameStartTime(iTotalImagesProcessed));		
+
+		if (!IsActive())
+		{
+			SetActive();
+			iStatus = KRequestPending;
+		}
+		iVideoEncoder->EncodeFrameL(iReadImageDes, iStatus, inMicroSeconds);
+
+        // EncodeGiven
+        iImageEncodedFlag = 1;
+        iEncodeInProgress = 1;
+		
+		return KErrNone;		
+	}
+	else
+	{	
+        // a frame has been encoded, write it to output 3gp buffer
+
+		// composer composing the movie
+		if(iStatus == KErrNone)
+		{
+		    TBool isKeyFrame = 0;
+			TPtrC8 buf(iVideoEncoder->GetBufferL(isKeyFrame));
+			
+			TBool modeChanged = EFalse;
+			
+			if ( iTotalImagesProcessed == 1 && iVideoType == EVideoMPEG4 )
+			{
+				modeChanged = ETrue;
+			}
+			
+			/* composing is based on isIntra only */			
+			TBool firstFrame = EFalse;
+			if(iTotalImagesProcessed == 1)
+			{
+				firstFrame = ETrue;
+
+				// VOS header size is parsed in composer for MPEG-4
+	            iMP4SpecificSize = 0;
+			}
+
+			TInt64 durntTest = iVideoClip->Info()->Generator()->VideoFrameDuration(iTotalImagesProcessed-1).Int64();
+			TInt64 durntsix = TInt64(((I64REAL(durntTest)/(TReal)1000)*(TReal) iImageVideoTimeScale) +0.5);
+			TInt durnt = I64INT(durntsix);
+			/* converting to ticks */
+			durnt = (durnt)/1000;
+            
+            iGeneratedProcessed += durntTest/1000;            
+			IncProgressBar();	/* indicate to gui about progress */
+
+			iImageComposer->WriteFrames((TDesC8&)buf, buf.Size(), durnt, isKeyFrame ,
+				1/*numberOfFrames*/, CMP4Composer::EFrameTypeVideo, iMP4SpecificSize,modeChanged,
+				firstFrame,iVideoClip->Info()->TranscodeFactor().iStreamType, ETrue);				
+			
+			iVideoEncoder->ReturnBuffer();
+		}
+		/* end composing */
+		
+		return KErrNone;
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::ProcessImageSetsL
+// Prepares for creating the necessary 3gp files from the given frames
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::ProcessImageSetsL(TVideoOperation aCreateMode)
+{
+
+    if (iProcessingCancelled)
+        return KErrNone;
+
+	if(iTotalImagesProcessed == 0 && iImageEncodeProcFinished == 0)
+	{		
+		TFileName outputFileName = TPtrC(KTempFilePath);
+		iCurrentMovieName = outputFileName;
+		iCurrentMovieName.Append( _L( "Im" ) );
+		iCurrentMovieName.Append( _L( "_nokia_vpi.tmp" ) );
+		
+#ifdef _DEBUG
+        if (iOutputVideoType == EVideoAVCProfileBaseline)
+		    VPASSERT(iImageAvcEdit);
+#endif
+
+		iImageComposer = CMP4Composer::NewL(iCurrentMovieName, (CParser::TVideoFormat)iOutputVideoType,
+			                                CParser::EAudioFormatNone,
+			                                iImageAvcEdit);
+
+		CComposer::TStreamParameters innerStreamParameters;
+		/* there will be no video clips initially, so initialize to default parameters of movie */
+		TSize innerRes =(TSize)iVideoClip->Info()->Resolution(); /* resolution from generator */
+		innerStreamParameters.iVideoWidth = innerRes.iWidth;      /* iVideoParameters.iWidth */
+		innerStreamParameters.iVideoHeight = innerRes.iHeight;    /* iVideoParameters.iHeight */;
+		/* width and height are initialised to the proper values from the clip */
+		innerStreamParameters.iStreamBitrate = 25000 /* iStreamBitrate */;
+		
+		/* set the duration of the video clip */
+		TTimeIntervalMicroSeconds iTempVideoLength= TTimeIntervalMicroSeconds(iVideoClip->Info()->Duration());
+		TInt64  iTimeInMicro = (iTempVideoLength.Int64()/1000);
+		innerStreamParameters.iVideoLength= I64INT(iTimeInMicro);       /* set the video length properly */
+		innerStreamParameters.iStreamLength= I64INT(iTimeInMicro);
+		innerStreamParameters.iAudioLength = 0;                         
+		innerStreamParameters.iAudioFormat = (CComposer::TAudioFormat)0;
+		CVedMovieImp* tempm = (iMovie);    
+
+		if(iOutputVideoType == EVideoMPEG4)		
+		{
+			/* initialize to default constants for generated clips in case of MPEG-4 */
+			innerStreamParameters.iVideoFormat = (CComposer::TVideoFormat) CComposer::EVideoFormatMPEG4;
+			TVedTranscodeFactor tempFact;
+			tempFact.iStreamType = EVedVideoBitstreamModeMPEG4Regular;
+			tempFact.iTRes = 29;
+			CVedVideoClip* currentClip = tempm->VideoClip(iVideoClipNumber);
+			CVedVideoClipInfo* currentInfo = currentClip->Info();
+			currentInfo->SetTranscodeFactor(tempFact);			/* set to default values, as initialized above */
+		}
+		else if ( (iOutputVideoType == EVideoH263Profile0Level10) ||
+				  (iOutputVideoType == EVideoH263Profile0Level45) )
+		{
+		
+			innerStreamParameters.iVideoFormat = (CComposer::TVideoFormat)iOutputVideoType;
+		    /* initialize to default constants for generated clips in case of H.263 */
+			TVedTranscodeFactor tempFact;
+			tempFact.iStreamType = EVedVideoBitstreamModeH263;
+			tempFact.iTRes = 0;
+			CVedVideoClip* currentClip = tempm->VideoClip(iVideoClipNumber);
+			CVedVideoClipInfo* currentInfo = currentClip->Info();
+			currentInfo->SetTranscodeFactor(tempFact);		/* set to default values, as initialized above */
+        } 
+        
+#ifdef VIDEOEDITORENGINE_AVC_EDITING        
+        else if (iOutputVideoType == EVideoAVCProfileBaseline)
+        {
+        	/* initialize to default constants for generated clips in case of AVC */
+			innerStreamParameters.iVideoFormat = (CComposer::TVideoFormat) CComposer::EVideoFormatAVCProfileBaseline;
+			TVedTranscodeFactor tempFact;
+			tempFact.iStreamType = EVedVideoBitstreamModeAVC;
+			tempFact.iTRes = 30;
+			CVedVideoClip* currentClip = tempm->VideoClip(iVideoClipNumber);
+			CVedVideoClipInfo* currentInfo = currentClip->Info();
+			currentInfo->SetTranscodeFactor(tempFact);			/* set to default values, as initialized above */
+		}
+#endif
+        else
+		    User::Leave(KErrNotSupported);
+
+
+		if(iAllGeneratedClips == 1)
+        {
+			innerStreamParameters.iVideoWidth = iVideoParameters.iWidth;
+			innerStreamParameters.iVideoHeight = iVideoParameters.iHeight;
+		}
+		innerStreamParameters.iCanSeek = ETrue;
+		innerStreamParameters.iHaveVideo = ETrue;
+		innerStreamParameters.iHaveAudio =EFalse;
+		innerStreamParameters.iAudioFramesInSample =0;
+		innerStreamParameters.iAudioTimeScale =KAMRAudioTimeScale; /* 8000 */
+		innerStreamParameters.iVideoTimeScale =iImageVideoTimeScale;
+		iImageComposer->ComposeHeaderL(innerStreamParameters,iImageVideoTimeScale /*iOutputVideoTimeScale*/,
+			    iOutputAudioTimeScale, iAudioFramesInSample);
+				
+		if(!iVideoEncoder)
+		{	
+			/* It should never come here as iVideoEncoder is created before in hand */
+			PRINT(_L("ERROR I VIDEOENCODER DOES NOT EXIST"));
+			return 1; /* Indicating error */
+		}
+		else
+		{
+			//iVideoEncoder->Start();	/* make sure it is started only once */
+		}
+		
+		TInt erInitialize = CreateImage3GPFilesL(aCreateMode);
+		iTotalImagesProcessed++; 
+		return erInitialize;
+	}
+	else if (aCreateMode == EVideoEncodeFrame && iImageEncodeProcFinished == 0)
+	{
+		/* for encoding, you will read from file, so increment the number of images processed */
+		TInt er = CreateImage3GPFilesL(aCreateMode);
+		/* before incrementing the number of images processed, check if it has actually been encoded */
+		
+		iTotalImagesProcessed++;
+		
+		return er;
+	}
+	else if(aCreateMode == EVideoWriteFrameToFile && iImageEncodeProcFinished == 0)
+	{
+		// a frame has been encoded, write it to output 3gp buffer
+		TInt er2 = CreateImage3GPFilesL(aCreateMode);
+		return er2;
+	}
+	else if(aCreateMode == EVideoWriteFrameToFile  && iImageEncodeProcFinished == 1)
+	{
+		return KErrGeneral; /* This should not happen */
+	}
+	else
+	{
+		/* This should not happen */
+		return KErrGeneral;
+	}
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::EncodeImageFrameL
+// Encodes raw frames for 3gp generated clips
+// The frame is in buffer pointed to by iReadImageDes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::EncodeImageFrameL()
+{
+
+    if (iProcessingCancelled)
+        return KErrNone;
+
+	iVideoEncoder->Stop();
+
+	TTimeIntervalMicroSeconds inMSeconds = TTimeIntervalMicroSeconds(iVideoClip->Info()->Generator()->VideoFrameStartTime(iTotalImagesProcessed));
+	
+	if (!IsActive())
+	{
+		SetActive();
+		iStatus = KRequestPending;
+	}
+	iVideoEncoder->EncodeFrameL(iReadImageDes, iStatus,inMSeconds);
+
+    iTotalImagesProcessed++; /* Now we have encoded, and previously we had not, so increment now */
+    iImageEncodedFlag = 1;
+    iEncodeInProgress = 1;	   /* set to indicate encoding in progress */
+    
+	return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::ProcessImageSetsL
+// Decides whether to encode or request for a frame from generator, 
+// and in what mode to call the CreateImageFiles function
+// The encoding is done calling the GetFrame, so it goes through the frame generator
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::DoImageSetProcessL()
+{
+
+    if (iProcessingCancelled)
+        return;
+
+    // we come here from RunL
+
+	if(iImageEncodedFlag == 0 && iImageEncodeProcFinished == 0)
+    {
+        // Starting to process an image => issue GetFrame() -request
+
+		if(iFirstTimeProcessing == 0) 
+		{				
+			// this will be known from a bit or flag from the video clip		
+			iFirstTimeProcessing = 1;  // this indicates that this is the first time we are getting info about this video clip
+			iTotalImagesProcessed = 0;
+			iNumOfImages = (TInt)iVideoClip->Info()->VideoFrameCount();
+		}
+		TSize tempres = iMovie->Resolution();
+		if(iTotalImagesProcessed < iNumOfImages)
+		{
+			iGetFrameInProgress = 1; // indicates that the GetFrame was called and will be in progress
+			iVideoClip->Info()->Generator()->GetFrameL(*this, /*0*/ iTotalImagesProcessed,&tempres, EColor4K, EFalse, 1);
+		}
+		else
+		{
+			// It should never come here though
+			iImageClipCreated = 1;
+		}
+	}
+	else if(iImageEncodedFlag == 1 && iImageEncodeProcFinished == 0)
+	{
+        // image has been encoded
+
+		// tell the function to compose and return
+		iEncodeInProgress = 0;
+		iGetFrameInProgress = 0; // finished getting the frame, so if there's a cancel, no need to delete bitmap etc 
+		ProcessImageSetsL(EVideoWriteFrameToFile);    // composing of VedVideoClipgenerator, though its not used inside 
+		if(iNumOfImages == iTotalImagesProcessed)    /// if all images are over
+		{
+			iImageClipCreated = 1;
+			iImageEncodeProcFinished = 1; // finished creating the image 3GP file, so go ahead */
+            iImageComposer->Close();
+
+			delete iImageComposer;
+			iImageComposer = 0;
+
+			if(iParser)
+			{		
+				delete iParser;
+				iParser = 0;
+			}
+
+			/* set constant file name used as buffer */					
+            iClipFileName = TPtrC(KTempFilePath);
+			iClipFileName.Append( _L("Im_nokia_vpi.tmp") );            
+			
+			if (iImageAvcEdit)
+			{
+			    delete iImageAvcEdit;
+			    iImageAvcEdit = 0;
+			}
+			
+			if (iVideoEncoder)
+			{
+			    iVideoEncoder->Stop();
+			    delete iVideoEncoder;
+			    iVideoEncoder = 0;    
+			}
+
+			InitializeGeneratedClipL();
+			/* reset the number of images for the next image set */
+			iImageEncodedFlag = 0;
+
+			if(!IsActive())
+			{
+				SetActive();			  // wait till the video encoder finishes initialising
+				iStatus = KRequestPending;
+			}
+			User::Free(iYuvImageBuf);
+			iYuvImageBuf = 0;
+		}
+		else
+		{
+            // request for a new frame
+
+			User::Free(iYuvImageBuf);
+			iYuvImageBuf = 0;
+			TSize tempres = iMovie->Resolution();
+			iGetFrameInProgress = 1;
+			iVideoClip->Info()->Generator()->GetFrameL(*this,iTotalImagesProcessed,&tempres,EColor4K,EFalse,1);
+		}
+	}
+}
+	
+
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::Reset
+// Resets the processor for processing a new movie
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::ResetL()
+{
+
+    // delete clip structures
+    DeleteClipStructures();
+        
+    // delete video processing modules
+    iEncoderInitPending = EFalse;
+    iState = EStatePreparing;
+    DoCloseVideoL();
+    iState = EStateIdle;
+
+    VPASSERT(!iEncoderInitPending);
+    VPASSERT(!iVideoEncoder);
+
+    if (iComposer) 
+    {
+        delete iComposer; 
+        iComposer = 0;
+    }         
+        
+    if(iImageComposer) 
+	{
+		delete iImageComposer;						
+		iImageComposer=0;
+	}
+	
+	if (iImageAvcEdit)
+	{
+	    delete iImageAvcEdit;
+	    iImageAvcEdit = 0;
+	}    
+	
+	if (iYuvImageBuf)
+	{
+		User::Free(iYuvImageBuf);
+		iYuvImageBuf=0;
+	}
+	
+	// for transition effect
+    if ( iFsConnected )
+    {
+        CloseTransitionInfoL();
+        iFs.Close();
+        iFsConnected = EFalse;
+    }
+    
+	iDataFormat = EDataAutoDetect;
+	iStreamBitrate = 0;
+	iNumDemuxChannels = 0;
+	iOutputNumberOfFrames = 0;
+	iVideoType = EVideoH263Profile0Level10;
+	iAudioType = EAudioAMR;	
+    iFirstFrameOfClip = EFalse;
+    iFirstFrameFlagSet = EFalse;
+
+    iFirstClipUsesEncoder = EFalse;
+    iMpeg4ModeTranscoded = EFalse;
+    
+    iOutputVideoTimeScale = KVideoTimeScale;
+	iOutputAudioTimeScale = KAMRAudioTimeScale;    
+	iOutputVideoType = EVideoNone;
+	iOutputAudioType = EAudioAMR;
+
+	iProcessingCancelled = EFalse;
+
+    iStartTransitionEffect = EVedStartTransitionEffectNone; 
+	iMiddleTransitionEffect = EVedMiddleTransitionEffectNone; 
+	iPreviousMiddleTransitionEffect = EVedMiddleTransitionEffectNone;
+	iEndTransitionEffect = EVedEndTransitionEffectNone;
+    iWriting1stColorTransitionFrame = EFalse;
+    i1stColorTransitionFrameTS = 0;
+
+    iApplySlowMotion = ETrue;
+	iCurrentVideoTimeInTicks = 0.0; 
+    iInitialClipStartTimeStamp = 0;
+    iStartingProcessing = EFalse;
+    iFramesProcessed = 0;	
+    iProgress = 0;
+    iGeneratedProcessed = 0;
+    iAudioProcessingCompleted = EFalse;
+    iEncodingBlackFrames = EFalse;
+    
+    iTotalDurationInSample = 0;
+    iAudioProcessingCancelled = EFalse;
+    iWaitSchedulerStarted = EFalse;
+    	
+	iCurrentMovieName.Zero();
+	iAudioClipWritten = 0;
+    iVideoClipWritten = 0;
+    iDiskFull = EFalse;
+    iAudioFrameNumber = 0;
+    iVideoFrameNumber = 0;
+    iFrameBuffered = EFalse;
+    iVideoIntraFrameNumber = 0;
+	iVideoClipNumber=0; 		
+    iStartFrameIndex = 0;
+	iVideoClip=0; 
+	iMovie=0;	
+	iSpeed = KMaxVideoSpeed; 
+	iColorEffect = EVedColorEffectNone;
+	iNumberOfVideoClips=0;
+    iEncoderBuffer = 0;
+    iEncodePending = 0;    
+	iVideoClipDuration = 0;
+	iLeftOverDuration = 0;
+	iTimeStamp = 0;
+
+    iThumbnailInProgress=EFalse; 
+	iTotalMovieDuration = 0;
+	iFramesProcessed=0;
+	iStartCutTime = TTimeIntervalMicroSeconds(0); 
+	iEndCutTime = TTimeIntervalMicroSeconds(0);
+
+    iTr.iTrPrevNew = -1;
+	iTr.iTrPrevOrig = -1;
+
+    iAudioFramesInSample = KVedAudioFramesInSample;
+    iAudioFramesInBuffer = 0;
+    iOutAudioBuffer=0;
+    iNumberOfAudioClipsCreated = 0;
+    iCurrentAudioTimeInMs = 0;
+	iTotalAudioTimeWrittenMs = 0;
+	iNumberOfAudioClips=0;
+	iAudioClipNumber=0;
+	iTimeStampListScaled = EFalse;
+	
+	iCurrentVideoSize = 0; 
+	iCurrentAudioSize = 0;
+	iMovieSizeLimitExceeded = EFalse;
+	
+    iAllVideoProcessed = EFalse;
+    
+    // We are now properly initialized
+    iState = EStateIdle;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::CancelProcessingL
+// Stops processing a movie
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::CancelProcessingL()
+{	
+    
+    PRINT((_L("CancelProcessingL begin, iEncoderInitPending %d, iEncodePending %d, iEncodeInProgress %d"), 
+				iEncoderInitPending, iEncodePending, iEncodeInProgress ));
+
+#ifdef _DEBUG
+	if (iVideoEncoder)
+		PRINT((_L("CancelProcessingL() - iEncodePending in encoder %d"), iVideoEncoder->IsEncodePending()));
+#endif
+
+    if (iProcessingCancelled)
+    {
+    	PRINT((_L("CancelProcessingL() - Already cancelled!")));
+    	
+        if (iMonitor)
+            iMonitor->ProcessingCancelled();
+        
+    	return;
+    }
+    
+    iProcessingCancelled = ETrue;
+
+    if (iDemux)
+        iDemux->Stop();
+
+    if (iVideoProcessor)
+        iVideoProcessor->Stop();   
+    
+    if (iAudioProcessor)
+        iAudioProcessor->StopL();                
+
+    // delete all objects except status monitor
+    DoCloseVideoL();
+    
+    if ( iVideoEncoder && iVideoEncoder->IsEncodePending() == 0 && 
+	     (iEncodePending || iEncodeInProgress) )
+	{
+	    // encoder has completed encoding request, but scheduler has
+	    // not called RunL() yet. Reset flags so that the request will	    
+	    // be handled as init complete in RunL	    
+	    PRINT((_L("CancelProcessingL() - resetting encoding flags")));
+	    iEncoderInitPending = ETrue;
+	    iEncodePending = iEncodeInProgress = 0;
+	}
+	
+    // close the rest
+
+	// for transition effect
+    if ( iFsConnected )
+    {
+        CloseTransitionInfoL();
+        iFs.Close();
+        iFsConnected = EFalse;
+    }
+
+	if(iGetFrameInProgress == 1)
+	{
+		//VPASSERT(iEncodeInProgress == 0);
+		iGetFrameInProgress = 0;
+		
+		if(iVideoClip->Info()->Class() == EVedVideoClipClassGenerated)
+		{
+			iVideoClip->Info()->Generator()->CancelFrame();
+		}		
+	}
+	
+	if (iComposer)
+	{
+		iComposer->Close();  // creates the output file                
+		delete iComposer; 
+		iComposer = 0;
+	}		
+	
+	if(iImageComposer) 
+	{
+		delete iImageComposer;
+		iImageComposer=0;
+	}
+	
+	if (iImageAvcEdit)
+	{
+	    delete iImageAvcEdit;
+	    iImageAvcEdit = 0;
+	}
+	
+	
+	DeleteClipStructures();
+
+    if (!iEncoderInitPending)
+    {
+    	
+    	PRINT((_L("CMovieProcessorImpl::CancelProcessingL - calling cancelled callback")));
+    	// if StartMovieL() has not been called at this point,
+    	// there is no status monitor or observer to call
+    	if (iMonitor)
+            iMonitor->ProcessingCancelled();		
+
+    	iState = EStateIdle;	
+    }
+
+	PRINT((_L("CMovieProcessorImpl::CancelProcessingL end")))
+    
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetClipPropertiesL
+// Retrieves parameters for a clip
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::GetClipPropertiesL(const TDesC& aFileName, 
+                                             RFile* aFileHandle,
+                                             TVedVideoFormat& aFormat,
+                                             TVedVideoType& aVideoType,
+                                             TSize& aResolution,
+                                             TVedAudioType& aAudioType,
+                                             TTimeIntervalMicroSeconds& aDuration,
+                                             TInt& aVideoFrameCount,
+											 TInt& aSamplingRate, 
+											 TVedAudioChannelMode& aChannelMode)
+{	
+
+    PRINT((_L("CMovieProcessorImpl::GetClipPropertiesL() begin")))
+
+    TInt error = KErrNone;
+    if (!aFileHandle)
+    {        
+    	// Check that 3gp file exists. 
+        
+        RFs fs;
+        User::LeaveIfError(fs.Connect());
+
+    	RFile file;
+    	error = file.Open(fs, aFileName, EFileShareReadersOnly | EFileStream | EFileRead);
+        if ( error != KErrNone )
+        {        
+            error = file.Open(fs, aFileName, EFileShareAny | EFileStream | EFileRead);     
+        }
+    	if (error == KErrNone)
+    		{
+    		file.Close();
+    		}
+        fs.Close();
+    	User::LeaveIfError(error);    	        
+    	
+    	// get filename
+	    iClipFileName = aFileName;
+	    iClipFileHandle = NULL;
+    } 
+    else
+    {
+        iClipFileHandle = aFileHandle;
+        iClipFileName.Zero();
+    }
+    	 	
+	CParser::TStreamParameters iStreamParams;	
+		
+	// parse header 
+	TRAP(error, ParseHeaderOnlyL(iStreamParams, iClipFileName, iClipFileHandle));
+
+    if (error != KErrNone && error != KErrNotSupported)
+        User::Leave(error);
+	
+	/* pass back clip properties */
+
+	// video format (file format actually)
+	if (iStreamParams.iFileFormat == CParser::EFileFormat3GP)
+		aFormat = EVedVideoFormat3GPP;
+	else if (iStreamParams.iFileFormat == CParser::EFileFormatMP4)
+		aFormat = EVedVideoFormatMP4;
+	else
+		aFormat = EVedVideoFormatUnrecognized;
+
+	// video type	
+	if(iStreamParams.iVideoFormat == CParser::EVideoFormatNone)
+		aVideoType = EVedVideoTypeNoVideo;
+	else if (iStreamParams.iVideoFormat == CParser::EVideoFormatH263Profile0Level10)
+		aVideoType = EVedVideoTypeH263Profile0Level10;
+	else if (iStreamParams.iVideoFormat == CParser::EVideoFormatH263Profile0Level45)
+		aVideoType = EVedVideoTypeH263Profile0Level45;
+	else if(iStreamParams.iVideoFormat == CParser::EVideoFormatMPEG4)
+		aVideoType = EVedVideoTypeMPEG4SimpleProfile;
+	else if(iStreamParams.iVideoFormat == CParser::EVideoFormatAVCProfileBaseline)
+		aVideoType = EVedVideoTypeAVCBaselineProfile;
+	else
+		aVideoType = EVedVideoTypeUnrecognized;
+	
+	// audio type
+	if(!iStreamParams.iHaveAudio/*iStreamParams.iAudioFormat == CParser::EAudioFormatNone*/)
+		aAudioType=EVedAudioTypeNoAudio;
+	else if(iStreamParams.iAudioFormat == CParser::EAudioFormatAMR)
+		aAudioType=EVedAudioTypeAMR;
+	else if (iStreamParams.iAudioFormat == CParser::EAudioFormatAAC)
+		aAudioType=EVedAudioTypeAAC_LC; // what about EVedAudioTypeAAC_LTP ???
+	else
+		aAudioType=EVedAudioTypeUnrecognized;
+
+	// Dummy values, update when AAC support is there
+	aSamplingRate = KVedAudioSamplingRate8k;
+	aChannelMode = EVedAudioChannelModeSingleChannel;
+
+	// resolution
+	aResolution.iWidth = iStreamParams.iVideoWidth; 
+	aResolution.iHeight = iStreamParams.iVideoHeight; 
+
+	// common
+    TUint duration = (iStreamParams.iVideoLength > iStreamParams.iAudioLength ? 
+        iStreamParams.iVideoLength : iStreamParams.iAudioLength);
+	aDuration = TTimeIntervalMicroSeconds( TInt64(duration) * TInt64(1000) );
+
+	// get total number of video frames
+	aVideoFrameCount = iParser->GetNumberOfVideoFrames();
+
+	/***************IF Audio Type is AAC get the audio properties************************/
+	
+	if(iStreamParams.iAudioFormat == CParser::EAudioFormatAAC)
+	{
+		//temporarily initialize iOutputAudioType and iAudioType as AudioProcessor uses it
+		iOutputAudioType = EAudioAAC;
+		iAudioType = EAudioAAC;				
+	}
+
+    PRINT((_L("CMovieProcessorImpl::GetClipPropertiesL() end")))
+}
+
+
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GenerateVideoFrameInfoArray
+// Retrieves frames parameters for a clip to array
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::GenerateVideoFrameInfoArrayL(const TDesC& aFileName, RFile* aFileHandle,
+                                                       TVedVideoFrameInfo*& aVideoFrameInfoArray)
+{
+
+    PRINT((_L("CMovieProcessorImpl::GenerateVideoFrameInfoArray() begin")))
+
+    TInt error;
+    
+    if  (!aFileHandle)
+    {
+    	// Check that 3gp file exists. 	
+        RFs fs;
+    	User::LeaveIfError(fs.Connect());
+
+    	RFile file;
+    	error = file.Open(fs, aFileName, EFileShareReadersOnly | EFileStream | EFileRead);
+        if ( error != KErrNone )
+        {        
+            error = file.Open(fs, aFileName, EFileShareAny | EFileStream | EFileRead);     
+        }
+    	if (error == KErrNone)
+    		{
+    		file.Close();
+    		}
+    	fs.Close();
+    	User::LeaveIfError(error);
+    }
+	 
+	// parse clip header
+	CParser::TStreamParameters streamParams;
+	
+	// get filename
+	if (aFileHandle)
+	{
+	    iClipFileName.Zero();   
+	    iClipFileHandle = aFileHandle;
+	}
+	else
+	{	 
+	    iClipFileHandle = NULL;
+	    iClipFileName = aFileName;
+	}
+    
+	// parse header 		
+	TRAP(error, ParseHeaderOnlyL(streamParams, iClipFileName, iClipFileHandle));
+
+    if (error != KErrNone && error != KErrNotSupported)
+        {
+		User::Leave( error );
+	    }
+
+	// video type
+    TVedVideoType videoType = EVedVideoTypeNoVideo;
+	if(streamParams.iVideoFormat == CParser::EVideoFormatNone)
+		videoType = EVedVideoTypeNoVideo;
+	else if(streamParams.iVideoFormat == CParser::EVideoFormatH263Profile0Level10)
+		videoType = EVedVideoTypeH263Profile0Level10;
+	else if(streamParams.iVideoFormat == CParser::EVideoFormatH263Profile0Level45)
+		videoType = EVedVideoTypeH263Profile0Level45;
+	else if(streamParams.iVideoFormat == CParser::EVideoFormatMPEG4)
+		videoType = EVedVideoTypeMPEG4SimpleProfile;
+	else if(streamParams.iVideoFormat == CParser::EVideoFormatAVCProfileBaseline)
+		videoType = EVedVideoTypeAVCBaselineProfile;
+	else 
+	{
+		User::Leave(KErrNotSupported);
+	}	
+	
+	// frame parameters
+	if( (videoType == EVedVideoTypeH263Profile0Level10) || 
+		(videoType == EVedVideoTypeH263Profile0Level45) || 		
+		(videoType == EVedVideoTypeMPEG4SimpleProfile)  ||
+		(videoType == EVedVideoTypeAVCBaselineProfile) )
+	{
+		TInt frameCount = 0;
+		FillVideoFrameInfoArrayL(frameCount, (TVedVideoFrameInfo*&)aVideoFrameInfoArray); 
+	}
+
+    PRINT((_L("CMovieProcessorImpl::GenerateVideoFrameInfoArray() end")))    
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::FillVideoFrameInfoArray
+// Fills an array containing video frame parameters: size, start time & type
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+void CMovieProcessorImpl::FillVideoFrameInfoArrayL(TInt& aVideoFrameCount, 
+												   TVedVideoFrameInfo*& aVideoFrameInfoArray)												  
+{
+	
+	PRINT((_L("CMovieProcessorImpl::FillVideoFrameInfoArrayL() begin")))    
+
+	// get total number of video frames
+	aVideoFrameCount = iParser->GetNumberOfVideoFrames();
+	VPASSERT(aVideoFrameCount); 
+	// create memory for frame parameters - DO NOT delete it in MediaProcessorImpl
+	if(aVideoFrameInfoArray)
+	{
+		delete aVideoFrameInfoArray;
+		aVideoFrameInfoArray=0;
+	}
+		
+	// get individual frame parameters
+	aVideoFrameInfoArray = (TVedVideoFrameInfo*)User::AllocL(aVideoFrameCount * sizeof(class TVedVideoFrameInfo));
+		
+	TFrameInfoParameters* frameInfoArray = (TFrameInfoParameters*)User::AllocZL((aVideoFrameCount) * sizeof(struct TFrameInfoParameters));
+	
+	TInt i; 
+	// Get all the frame parameters using the new function
+	CMP4Parser* parser = (CMP4Parser*)iParser;
+	TInt startIndex =0;
+	TInt err = parser->GetVideoFrameProperties(frameInfoArray,startIndex,aVideoFrameCount);
+	if(err !=0)
+		User::Leave(KErrAbort);
+
+	for(i=0; i<aVideoFrameCount; i++)
+	{        
+		aVideoFrameInfoArray[i].iSize = (TInt)frameInfoArray[i].iSize;
+		aVideoFrameInfoArray[i].iStartTime = (TInt)frameInfoArray[i].iStartTime;
+        if(frameInfoArray[i].iType)
+            {
+        	PRINT((_L("CMovieProcessorImpl::FillVideoFrameInfoArrayL() iType of %d nonzero, time %d"), i, aVideoFrameInfoArray[i].iStartTime))    
+            aVideoFrameInfoArray[i].iFlags = 1;
+            }
+		else
+            {
+        	PRINT((_L("CMovieProcessorImpl::FillVideoFrameInfoArrayL() iType of %d zero, time %d"), i, aVideoFrameInfoArray[i].iStartTime))    
+            aVideoFrameInfoArray[i].iFlags = 0;			
+            }
+	}	
+	User::Free(frameInfoArray);
+	frameInfoArray=0; 
+
+	PRINT((_L("CMovieProcessorImpl::FillVideoFrameInfoArrayL() end")))    
+	
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::FillFrameParameters
+// Fills an internal array containing parameters for each video frame : 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::FillFrameParametersL(TInt aCurrentFrameIndex)
+{
+	PRINT((_L("CMovieProcessorImpl::FillFrameParameters() begin, current index %d"),aCurrentFrameIndex))    
+
+	// get total number of video frames
+	TInt numberOfFrames = iParser->GetNumberOfFrames();
+	TInt frameNumber = 0;
+	
+	// get start frame index in the input clip
+	iStartFrameIndex = iParser->GetStartFrameIndex(); 
+
+    TInt cutOutTime = 0;
+    if (!iThumbnailInProgress)
+        cutOutTime = I64INT( iVideoClip->CutOutTime().Int64() / TInt64(1000) );
+    
+    TFrameInfoParameters* frameInfoArray = 
+        (TFrameInfoParameters*)User::AllocZL((numberOfFrames) * sizeof(struct TFrameInfoParameters));
+    
+    CleanupStack::PushL(frameInfoArray);
+        
+    // get info array from parser
+    CMP4Parser* parser = (CMP4Parser*)iParser;    
+    TInt error = parser->GetVideoFrameProperties(frameInfoArray, iStartFrameIndex, numberOfFrames);
+    if (error != 0)
+        User::Leave(KErrAbort);
+    
+    while ( frameNumber < numberOfFrames )
+    {    
+        iFrameParameters[aCurrentFrameIndex].iTimeStamp = 
+            GetVideoTimeInTicksFromMs( TInt64(frameInfoArray[frameNumber].iStartTime), EFalse ); 
+        iFrameParameters[aCurrentFrameIndex].iType = TUint8( frameInfoArray[frameNumber].iType );
+        
+        if (!iThumbnailInProgress && frameInfoArray[frameNumber].iStartTime > cutOutTime)
+            {            
+            break;
+            }
+        
+        frameNumber++;
+        aCurrentFrameIndex++;        
+    }
+        
+    CleanupStack::PopAndDestroy(frameInfoArray);
+    
+	PRINT((_L("CMovieProcessorImpl::FillFrameParameters() end")))    
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::IncProgressBar
+// Report progress to observer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//-
+void CMovieProcessorImpl::IncProgressBar()
+{
+	VPASSERT(iTotalMovieDuration > 0);
+
+	TInt64 msProcessed = iGeneratedProcessed + iTotalAudioTimeWrittenMs + 
+        GetVideoTimeInMsFromTicks(iCurrentVideoTimeInTicks, ETrue);
+
+	TInt percentage = TInt( ( (I64REAL(msProcessed) / I64REAL(iTotalMovieDuration)) * 100.0) + 0.5 );
+
+	//VPASSERT( percentage <= 100 );
+
+	if (percentage > iProgress && percentage <= 100)
+	{
+		iProgress = percentage;
+		iMonitor->Progress(iProgress);
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetMovieSizeEstimateL
+// Calculates an estimate for resulting movie size
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::GetMovieSizeEstimateL(const CVedMovie* aMovie)
+{
+	TInt fileSize=0;
+	iSizeEstimate->GetMovieSizeEstimateL(aMovie, (TInt&)fileSize);
+	return fileSize;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetMovieSizeEstimateForMMSL
+// Calculates file size estimate for MMS use
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::GetMovieSizeEstimateForMMSL(const CVedMovie* aMovie, 
+                                                      TInt aTargetSize, 
+                                                      TTimeIntervalMicroSeconds aStartTime, 
+                                                      TTimeIntervalMicroSeconds& aEndTime) 
+{
+    return iSizeEstimate->GetMovieSizeEstimateForMMSL(aMovie, aTargetSize, aStartTime, aEndTime);
+} 
+
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::StartThumbL
+// Initiates thumbnail extraction from clip (full resolution raw is reutrned)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::StartThumbL(const TDesC& aFileName, 
+                                      RFile* aFileHandle,
+									  TInt aIndex, 
+									  TSize aResolution,
+									  TDisplayMode aDisplayMode, 
+									  TBool aEnhance)
+{
+
+	PRINT((_L("CMovieProcessorImpl::StartThumbL() begin, aIndex = %d, enhance = %d"), aIndex, aEnhance))
+
+    if (!aFileHandle)
+    {
+    	//Check that 3gp file exists. 
+    	RFs fs;
+    	User::LeaveIfError(fs.Connect());
+    	RFile file;
+    	TInt error = file.Open(fs, aFileName, EFileShareReadersOnly | EFileStream | EFileRead);
+        if ( error != KErrNone )
+        {        
+            error = file.Open(fs, aFileName, EFileShareAny | EFileStream | EFileRead);
+        }
+    	if (error == KErrNone)
+    		{
+    		file.Close();
+    		}
+    	fs.Close();
+    	User::LeaveIfError(error);
+    }
+
+	// get thumbnail parameters
+	if (aFileHandle)
+	{
+	    iClipFileName.Zero();
+	    iClipFileHandle = aFileHandle;
+	}
+	else
+	{	 
+	    iClipFileHandle = NULL;
+	    iClipFileName = aFileName;     
+	}
+
+	iOutputThumbResolution.SetSize(aResolution.iWidth, aResolution.iHeight);
+	iThumbIndex = aIndex;
+	iThumbDisplayMode = aDisplayMode;
+	iThumbEnhance = aEnhance;
+
+	iThumbnailInProgress = ETrue;
+
+	// initialization
+	InitializeClipStructuresL();
+
+	InitializeClipL(); // opens the file & parses header
+
+    // update number of frames
+	SetOutputNumberOfFrames(iParser->iOutputNumberOfFrames); 
+
+	PRINT((_L("CMovieProcessorImpl::StartThumbL() end")))
+
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::ProcessThumbL
+// Generates thumbnail from clip (actually, full resolution raw is returned)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::ProcessThumbL(TRequestStatus &aStatus, TVedTranscodeFactor* aFactor)
+{				
+	
+	PRINT((_L("CMovieProcessorImpl::ProcessThumbL() begin")))
+
+    iState = EStateProcessing;	
+    iThumbnailRequestStatus = &aStatus;
+    
+    // seek to the last intra frame before desired frame 
+    TTimeIntervalMicroSeconds startTime(0);
+    if ( iThumbIndex > 0 )
+    {            
+        TInt time = 0;
+        TUint inMs = TUint( iParser->GetVideoFrameStartTime(iThumbIndex, &time) );
+        TInt64 inMicroS = TInt64( inMs ) * TInt64( 1000 );            
+        startTime = TTimeIntervalMicroSeconds( inMicroS );
+    }
+    
+    // iOutputNumberOFrames contains the total amount of frames in clip
+    // without cutting
+    SetOutputNumberOfFrames(iParser->iOutputNumberOfFrames);
+    
+    TInt error = iParser->SeekOptimalIntraFrame(startTime, iThumbIndex, ETrue);
+    if (error != KErrNone)
+    {  
+        iThumbnailRequestStatus = 0;
+        User::Leave(KErrGeneral);
+    }
+    iStartFrameIndex = iParser->GetStartFrameIndex();
+    VPASSERT(iStartFrameIndex >= 0);                  
+  
+    error = iVideoProcessor->ProcessThumb(this, iThumbIndex, iStartFrameIndex, aFactor);
+    if (error != KErrNone)
+    {
+        iThumbnailRequestStatus = 0;
+        User::Leave(error);
+    }        
+}
+    
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::NotifyThumbnailReady
+// Called by thumbnail generator when thumbnail is ready
+// for retrieval
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::NotifyThumbnailReady(TInt aError)
+{
+
+    PRINT((_L("CMovieProcessorImpl::NotifyThumbnailReady() begin")))  
+
+    if (HandleThumbnailError(aError))
+        return;    
+   
+    // get YUV thumb
+    iVideoProcessor->FetchThumb(&iYuvBuf);        
+        
+    // check validity of thumbnail and associated operation
+    if(iThumbEnhance)		// for saving to file
+    {
+        if(iThumbDisplayMode == ENone)					// if no preference
+            iThumbDisplayMode = EColor16M;				// 24-bit color image for enhancement
+        else if(iThumbDisplayMode != EColor16M)	// invalid combination
+        {     
+            HandleThumbnailError(KErrNotSupported);
+            return;                
+        }
+    }
+    else								// for screen display
+    {
+        if(iThumbDisplayMode == ENone)					// if no preference
+            iThumbDisplayMode = EColor64K;				// 16-bit image for some products
+    }
+        
+    TInt bytesPerPixel = 0;
+    // determine proper bit depth for the bitmap
+    if(iThumbDisplayMode == EColor16M)
+        bytesPerPixel = 3; // 24-bit rgb takes 3 bytes, stored as bbbbbbbb gggggggg rrrrrrrr
+    else if(iThumbDisplayMode == EColor64K || iThumbDisplayMode == EColor4K)
+        bytesPerPixel = 2; // 12-bit rgb takes 2 bytes, stored as ggggbbbb xxxxrrrr                            
+    else
+    {
+        HandleThumbnailError(KErrNotSupported);
+        return;					// support for 12-, 16- and 24-bit color images only
+    }
+
+    TInt error;
+    if ( !iRgbBuf )
+    {
+        TSize inputFrameResolution(iParser->iStreamParameters.iVideoWidth,iParser->iStreamParameters.iVideoHeight);
+                       
+        // rgb specs
+        TUint thumbLength = inputFrameResolution.iWidth * inputFrameResolution.iHeight; 
+        TUint thumbUVLength = thumbLength>>2;	
+        
+        VPASSERT(iYuvBuf);
+        // assign yuv pointers 
+        TUint8* yBuf = iYuvBuf;
+        TUint8* uBuf = yBuf + thumbLength;
+        TUint8* vBuf = uBuf + thumbUVLength;	
+                
+        // create output rgb buffer
+        TRAP(error, iRgbBuf = (TUint8*) User::AllocL(thumbLength * bytesPerPixel));
+        if (HandleThumbnailError(error))
+            return;                                
+        
+        TInt scanLineLength;
+        
+        // convert yuv to rgb
+        switch (iThumbDisplayMode)
+        {
+            
+        case EColor4K:
+            {
+                TInt error;
+                CYuv2Rgb12* yuvConverter = NULL; 
+                TRAP(error, yuvConverter = new(ELeave) CYuv2Rgb12);
+                if (HandleThumbnailError(error))
+                    return;
+                scanLineLength = inputFrameResolution.iWidth * bytesPerPixel; 
+                VPASSERT(yuvConverter);
+                TRAP(error, yuvConverter->ConstructL(inputFrameResolution.iWidth, inputFrameResolution.iHeight, inputFrameResolution.iWidth, inputFrameResolution.iHeight));
+                if (HandleThumbnailError(error))
+                    return;
+                yuvConverter->Convert(yBuf, uBuf, vBuf, inputFrameResolution.iWidth, inputFrameResolution.iHeight, iRgbBuf, scanLineLength);                
+                delete yuvConverter;		
+                yuvConverter=0;         
+            }
+            break;
+            
+        default:
+        case EColor64K:
+            {
+                TInt error;
+                CYuv2Rgb16* yuvConverter = NULL; 
+                TRAP(error, yuvConverter = new(ELeave) CYuv2Rgb16);
+                if (HandleThumbnailError(error))
+                    return;                
+                scanLineLength = inputFrameResolution.iWidth * bytesPerPixel; 
+                VPASSERT(yuvConverter);
+                TRAP(error, yuvConverter->ConstructL(inputFrameResolution.iWidth, inputFrameResolution.iHeight, inputFrameResolution.iWidth, inputFrameResolution.iHeight);)
+                if (HandleThumbnailError(error))
+                    return;
+                yuvConverter->Convert(yBuf, uBuf, vBuf, inputFrameResolution.iWidth, inputFrameResolution.iHeight, iRgbBuf, scanLineLength);                
+                delete yuvConverter;		
+                yuvConverter=0; 
+            }
+            break;
+            
+        case EColor16M:
+            {
+                TInt error;
+                CYuv2Rgb24* yuvConverter = NULL; 
+                TRAP(error, yuvConverter = new(ELeave) CYuv2Rgb24);
+                if (HandleThumbnailError(error))
+                    return;                                
+                scanLineLength = inputFrameResolution.iWidth * bytesPerPixel; 
+                VPASSERT(yuvConverter);
+                TRAP(error, yuvConverter->ConstructL(inputFrameResolution.iWidth, inputFrameResolution.iHeight, inputFrameResolution.iWidth, inputFrameResolution.iHeight))
+                if (HandleThumbnailError(error))
+                    return;                
+                yuvConverter->Convert(yBuf, uBuf, vBuf, inputFrameResolution.iWidth, inputFrameResolution.iHeight, iRgbBuf, scanLineLength);                
+                delete yuvConverter;		
+                yuvConverter=0; 
+            }
+            break;
+        }        
+    }
+
+    //CFbsBitmap* iOutBitmap = 0;
+
+	if(!iThumbEnhance)
+	{
+        const TSize inputFrameResolution(iParser->iStreamParameters.iVideoWidth,iParser->iStreamParameters.iVideoHeight);
+
+		/* Pre-calculate pixel indices for horizontal scaling. */
+		// inputFrameResolution is the resolution of the image read from video clip.
+		// iOutputThumbResolution is the final resolution desired by the caller.
+		
+		const TInt xIncrement = inputFrameResolution.iWidth * iOutputThumbResolution.iWidth;
+		const TInt xBoundary = iOutputThumbResolution.iWidth * iOutputThumbResolution.iWidth;
+
+		TInt* xIndices = 0;
+		TRAPD(xIndicesErr, xIndices = new (ELeave) TInt[iOutputThumbResolution.iWidth]);
+		if (xIndicesErr == KErrNone)
+		{
+			TInt xDecision = xIncrement / bytesPerPixel;
+			TInt sourceIndex = 0;
+			for (TInt x = 0; x < iOutputThumbResolution.iWidth; x++)
+			{
+				while (xDecision > xBoundary)
+				{
+					xDecision -= xBoundary;
+					sourceIndex += bytesPerPixel;
+				}
+
+				xIndices[x] = sourceIndex;
+				xDecision += xIncrement;
+			}
+		}
+		else
+		{		    
+		    HandleThumbnailError(xIndicesErr);
+		    return;
+		}
+
+		/* Initialize bitmap. */
+		TRAPD(bitmapErr, iOutBitmap = new (ELeave) CFbsBitmap);
+		if ((xIndicesErr == KErrNone) && (bitmapErr == KErrNone))
+		{
+			bitmapErr = iOutBitmap->Create(iOutputThumbResolution, iThumbDisplayMode /*EColor64K*/);
+			if (bitmapErr == KErrNone)
+			{
+                // Lock the heap to prevent the FBS server from invalidating the address
+                iOutBitmap->LockHeap();
+
+				/* Scale to desired iOutputThumbResolution and copy to bitmap. */
+				TUint8* dataAddress = (TUint8*)iOutBitmap->DataAddress();
+				const TInt yIncrement = inputFrameResolution.iHeight * iOutputThumbResolution.iHeight;
+				const TInt yBoundary = iOutputThumbResolution.iHeight * iOutputThumbResolution.iHeight;
+				
+				TInt targetIndex = 0;
+				TInt sourceRowIndex = 0;
+				TInt yDecision = yIncrement / 2;
+				for (TInt y = 0; y < iOutputThumbResolution.iHeight; y++)
+				{
+					while (yDecision > yBoundary)
+					{
+						yDecision -= yBoundary;
+						sourceRowIndex += (inputFrameResolution.iWidth * bytesPerPixel);
+					}
+					yDecision += yIncrement;
+					
+					for (TInt x = 0; x < iOutputThumbResolution.iWidth; x++)
+					{
+                        for (TInt i = 0; i < bytesPerPixel; ++i)
+                        {
+                            const TInt firstPixelSourceIndex = sourceRowIndex + xIndices[x] + i;
+                            dataAddress[targetIndex] = iRgbBuf[firstPixelSourceIndex];
+                            targetIndex++;
+                        }
+					}
+				}
+                iOutBitmap->UnlockHeap();
+			}
+			else
+			{			    
+				delete iOutBitmap; iOutBitmap = 0;
+				HandleThumbnailError(bitmapErr);
+				return;
+			}
+		}
+		else
+		{
+		    HandleThumbnailError(bitmapErr);
+		    delete[] xIndices; xIndices = 0;
+		    return;
+		}
+		
+		delete[] xIndices;
+		xIndices = 0;
+	}
+	else		// enhance
+	{
+		TInt i,j;
+		// create input bitmap and buffer
+		CFbsBitmap* inBitmap = 0;
+		TRAPD(inBitmapErr, inBitmap = new (ELeave) CFbsBitmap);
+		if( inBitmapErr == KErrNone )
+        {
+		    // create bitmaps
+		    TSize originalResolution(iParser->iStreamParameters.iVideoWidth, iParser->iStreamParameters.iVideoHeight);
+		    inBitmapErr = inBitmap->Create(originalResolution, iThumbDisplayMode/*EColor16M*/); 
+		
+            if( inBitmapErr == KErrNone )
+            {
+		        // fill image from rgb buffer to input bitmap buffer 
+		        TPtr8 linePtr(0,0); 
+        		TInt lineLength = inBitmap->ScanLineLength(originalResolution.iWidth, iThumbDisplayMode); 
+		        for(j=0, i=0; j<originalResolution.iHeight; j++, i+=lineLength)
+		        {
+        			linePtr.Set(iRgbBuf+i, lineLength, lineLength);
+		        	inBitmap->SetScanLine((TDes8&)linePtr,j); 
+		        }
+		
+        		// create output bitmap 
+		        TRAPD(outBitmapErr, iOutBitmap = new (ELeave) CFbsBitmap);
+                if( outBitmapErr == KErrNone )
+                {
+		            outBitmapErr = iOutBitmap->Create(iOutputThumbResolution, iThumbDisplayMode/*EColor16M*/); // same size as input frame
+		
+                    if( outBitmapErr == KErrNone )
+                    {
+		                // post-processing enhancement 
+		                TRAP(outBitmapErr, EnhanceThumbnailL((const CFbsBitmap*)inBitmap, (CFbsBitmap*)iOutBitmap));
+
+                    }
+                    else
+                    {
+                        delete inBitmap; inBitmap = 0;   
+                        delete iOutBitmap; iOutBitmap = 0;
+                        HandleThumbnailError(outBitmapErr);
+                        return;
+                    }
+                }
+                else
+                {
+                     delete inBitmap; inBitmap = 0;
+                     HandleThumbnailError(outBitmapErr);
+                     return;
+                }
+            }
+            else
+            {
+                delete inBitmap; inBitmap = 0;
+                HandleThumbnailError(inBitmapErr);
+                return;                
+            }
+		
+		    // delete input bitmap 
+		    delete inBitmap;
+		    inBitmap = 0;
+        }
+        else
+        {
+            HandleThumbnailError(inBitmapErr);
+            return;
+        }
+	}
+
+    // return enhanced bitmap
+    //aThumb = outBitmap;
+    //iState = EStateReadyToProcess;  
+
+    iYuvBuf = 0;
+    delete iRgbBuf;
+    iRgbBuf = 0;
+    
+    VPASSERT(iThumbnailRequestStatus);
+    User::RequestComplete(iThumbnailRequestStatus, KErrNone);
+	iThumbnailRequestStatus = 0;	
+
+	PRINT((_L("CMovieProcessorImpl::NotifyThumbnailReady() end")))        
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::HandleThumbnailError
+// Handle error in thumbnail generation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CMovieProcessorImpl::HandleThumbnailError(TInt aError)
+{
+    if (aError != KErrNone)
+    {
+        TInt error = aError;
+
+#ifndef _DEBUG
+        if (error < KErrHardwareNotAvailable)
+            error = KErrGeneral;
+#endif        
+    
+        VPASSERT(iThumbnailRequestStatus);
+        User::RequestComplete(iThumbnailRequestStatus, error);
+		iThumbnailRequestStatus = 0;
+		return ETrue;		
+    }                
+    return EFalse;
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::FetchThumb
+// Returns a pointer to completed thumbnail bitmap
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::FetchThumb(CFbsBitmap*& aThumb)
+{
+    aThumb = iOutBitmap;
+    iOutBitmap = 0;
+    
+    iState = EStateReadyToProcess;
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::InitializeClipStructuresL
+// Initializes internal structures for movie processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::InitializeClipStructuresL()
+{
+
+	TTimeIntervalMicroSeconds time;
+    TInt i;
+    
+	// create memory for structures
+	// VIDEO 
+	if(!iVideoClipParameters)
+	{
+		iVideoClipParameters = (struct TVideoClipParameters *)User::AllocL(iNumberOfVideoClips *	
+			sizeof(struct TVideoClipParameters));
+		Mem::Fill(iVideoClipParameters, iNumberOfVideoClips*sizeof(TVideoClipParameters), 0);
+	}	
+
+	if(!iThumbnailInProgress)
+	{
+        // create audio buffer
+        iOutAudioBuffer = (HBufC8*) HBufC8::NewL(KInitialAudioBufferSize);
+
+        // create video buffer
+        iOutVideoBuffer = (HBufC8*) HBufC8::NewL(KInitialVideoBufferSize);
+
+        CVedMovieImp* movie = (iMovie);
+		// initialize video clip parameters 
+		for(i=0; i<iNumberOfVideoClips; i++)
+		{
+            // convert start & end times to milliseconds
+			iVideoClip = movie->VideoClip(i);  
+			time =	TTimeIntervalMicroSeconds(iVideoClip->StartTime());
+			iVideoClipParameters[i].iStartTime = time.Int64()/1000; 
+			time =	TTimeIntervalMicroSeconds(iVideoClip->EndTime());
+			iVideoClipParameters[i].iEndTime = time.Int64()/1000; 
+		}        
+			
+	}
+
+	return;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::DeleteClipStructures
+// Frees memory allocated for internal structures
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::DeleteClipStructures()
+{
+
+    if (iFrameParameters)
+		User::Free(iFrameParameters); 
+    iFrameParameters = 0;
+    iFrameParametersSize = 0;
+
+	if (iVideoClipParameters)
+		User::Free(iVideoClipParameters);	
+    iVideoClipParameters = 0; 
+
+    if (iEncoderBuffer)
+        User::Free(iEncoderBuffer);
+    iEncoderBuffer = 0;
+
+    if (iOutAudioBuffer)
+        delete iOutAudioBuffer;
+	iOutAudioBuffer=0;
+
+    if (iOutVideoBuffer)
+        delete iOutVideoBuffer;
+    iOutVideoBuffer = 0;
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::InitializeClipL
+// Initializes the processor for processing a clip
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::InitializeClipL()
+{
+	
+    PRINT((_L("CMovieProcessorImpl::InitializeClipL() begin")));
+
+    iFirstFrameOfClip = ETrue;
+    iFirstFrameFlagSet = EFalse;
+	iModeChanged = EFalse;	    /* assuming that this clip's mode has not been changed	*/
+    iVideoClipWritten = 0;
+    iWriting1stColorTransitionFrame = EFalse;
+
+ 	// update clip properties
+	if (iThumbnailInProgress)
+	{
+		// just get the first frame in normal mode		
+		iSpeed        =	KMaxVideoSpeed;	
+		iColorEffect  =	(TVedColorEffect)EVedColorEffectNone;	
+		iStartCutTime =	0; 
+		iEndCutTime   =	10;	
+	}
+	else
+	{
+        if (iNumberOfVideoClips) 
+        {
+            if ( iVideoClip->Info()->FileHandle() )
+            {
+                iClipFileName.Zero();
+                iClipFileHandle = iVideoClip->Info()->FileHandle(); 
+            }
+            else
+            {
+                iClipFileHandle = NULL;
+                iClipFileName =	(TPtrC)iVideoClip->Info()->FileName();
+            }
+            
+            iSpeed        =	(TInt)iVideoClip->Speed();	
+            iColorEffect  =	(TVedColorEffect)iVideoClip->ColorEffect();	
+            iStartCutTime =	TTimeIntervalMicroSeconds(iVideoClip->CutInTime());
+            iEndCutTime   =	TTimeIntervalMicroSeconds(iVideoClip->CutOutTime());
+            
+            iColorToneRgb = iVideoClip->ColorTone();
+            ConvertColorToneRGBToYUV(iColorEffect,iColorToneRgb);
+            // store previous middle transition, if there is more than one middle transition
+            if(iVideoClipNumber > 0)
+                iPreviousMiddleTransitionEffect = iMiddleTransitionEffect;
+            // check if there is a position for middle transition for this clip
+            if(iMovie->MiddleTransitionEffectCount() > iVideoClipNumber)
+		{
+                iMiddleTransitionEffect = iMovie->MiddleTransitionEffect(iVideoClipNumber);
+
+				if( ( iMiddleTransitionEffect == EVedMiddleTransitionEffectCrossfade ||
+					iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeLeftToRight ||
+					iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeRightToLeft ||
+					iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeTopToBottom ||
+					iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeBottomToTop ) &&
+                    ( iVideoClipNumber != iNumberOfVideoClips - 1 ) )
+                {
+                    TParse filename, filepath;
+                    CVedMovieImp* movie = (iMovie);
+
+					if( movie->VideoClip( iVideoClipNumber + 1 )->Info()->Class() == EVedVideoClipClassGenerated)
+					{
+						/************************************************************************/						
+						TFileName ImageMovieName(KTempFilePath);						
+						ImageMovieName.Append( _L( "Im_" ) );
+						ImageMovieName.Append( _L( "nokia_vpi.tmp" ) );
+						/************************************************************************/
+
+						filename.Set( ImageMovieName, NULL, NULL );
+						
+                        if (iOutputFileHandle)
+						{
+						    RFile* file = iOutputFileHandle;
+						    TFileName fullName;
+                            TInt error = file->FullName(fullName);
+                            filepath.Set(fullName, NULL, NULL);                            
+						}
+						else
+						    filepath.Set( iOutputMovieFileName, NULL, NULL );
+					}
+					else{
+
+                        if ( movie->VideoClip( iVideoClipNumber + 1 )->Info()->FileHandle() != NULL )
+                        {
+                            
+                            RFile* file = movie->VideoClip( iVideoClipNumber + 1 )->Info()->FileHandle();
+                            
+                            TFileName origName;
+                            TInt error = file->Name(origName);
+                            filename.Set(origName, NULL, NULL);
+                            
+                            TFileName fullName;
+                            error = file->FullName(fullName);
+                            filepath.Set(fullName, NULL, NULL);
+                            
+                        } 
+                        else
+                        {                            
+    						filename.Set( movie->VideoClip( iVideoClipNumber + 1 )->Info()->FileName(), NULL, NULL );
+    						filepath.Set( iOutputMovieFileName, NULL, NULL );
+                        }
+
+					}	
+
+					iNextClipFileName = filepath.DriveAndPath();
+					iNextClipFileName.Append( filename.Name() );
+					// VPI special tmp file
+					iNextClipFileName.Append( _L( "_" ) );
+					iNextClipFileName.AppendNum( iVideoClipNumber );
+					iNextClipFileName.Append( _L( "_vpi.tmp" ) );
+					// try to create a tmp file
+                    if ( iNextClip.Create( iFs, iNextClipFileName, EFileStream | EFileWrite | EFileShareExclusive ) != KErrNone )
+                    {
+                        // check if the tmp file exists
+                        if ( iNextClip.Open( iFs, iNextClipFileName, EFileStream | EFileWrite | EFileShareExclusive ) != KErrNone )
+                        {
+                            iNextClip.Close();
+                            iNextClipFileName.Zero();
+                        }
+                    }
+				}
+			}
+        }
+
+        // this is in common timescale
+        iInitialClipStartTimeStamp = (iVideoClipNumber>0 ? iVideoClipParameters[iVideoClipNumber-1].iEndTime : 0);
+	}
+
+    if (!iThumbnailInProgress)    
+	    iMonitor->StartPreparing();
+
+	// create an instance of the parser 
+	if (iNumberOfVideoClips)
+	{	
+
+        if (!iParser) 
+        {            
+            if (iClipFileHandle)
+                iParser = (CMP4Parser*) CMP4Parser::NewL(this, iClipFileHandle);
+            else
+                iParser = (CMP4Parser*) CMP4Parser::NewL(this, iClipFileName);
+        }
+        iParser->iFirstTimeClipParsing = ETrue;
+        iState = EStateIdle;
+        // open file & parse header
+        CMovieProcessorImpl::TDataFormat format = CMovieProcessorImpl::EDataAutoDetect;        
+        User::LeaveIfError(OpenStream(iClipFileName, iClipFileHandle, format));
+
+		if ( iThumbnailInProgress && (iHaveVideo == EFalse) )
+			User::Leave(KErrNotFound);
+
+        VPASSERT(iState == EStateOpened);
+	}
+    else
+        SetHeaderDefaults();
+    
+    iState = EStatePreparing;
+
+    if (!iThumbnailInProgress)
+    {
+
+		// Since the clip does not have any audio type it can be over written by any audio type depending on output	
+		if(iOutputAudioType == EAudioAMR)
+		{
+			if( iAudioType == EAudioNone)
+				iAudioType = EAudioAMR;
+		}
+		else if(iOutputAudioType == EAudioAAC)
+		{
+			if( iAudioType == EAudioNone)
+			{
+				iAudioType = EAudioAAC;	
+				if(iVideoClipNumber == 0)
+				{
+					//because it has no audio so it will have no decoder specific Info
+					iFirstClipHasNoDecInfo = ETrue; 
+				}
+				iAudioFramesInSample = 1;
+			}
+		}               
+
+        iEncoderInitPending = ETrue;        
+        // complete request to finish initialising & start processing
+		SetActive();			
+		iStatus = KRequestPending;				
+		
+		TRequestStatus *status = &iStatus;        
+        User::RequestComplete(status, KErrNone);
+
+        if (iNumberOfVideoClips)
+        {
+			if (iParser)
+			{
+				// update the video clip duration in millisec.
+				iVideoClipDuration = (TInt64)(iVideoClip->Info()->Duration().Int64() * 
+					(TInt64)iParser->iStreamParameters.iVideoTimeScale / (TInt64)(1000000));
+			}		
+        }		
+    }
+
+    else 
+    {        
+        // open demux & decoder
+        User::LeaveIfError(Prepare());
+
+        VPASSERT(iState == EStateReadyToProcess);        
+    }    
+
+	PRINT((_L("CMovieProcessorImpl::InitializeClipL() end")))
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::InitializeGeneratedClipL
+// Initializes the processor for processing a generated clip
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::InitializeGeneratedClipL()
+{
+	iEncodeInProgress = 0;
+	iFirstFrameOfClip = ETrue; // initialized to indicate that the first frame of this clip has not yet been written
+    iFirstFrameFlagSet = EFalse;
+	iModeChanged = EFalse;	  /* assuming that this clip's mode has not been changed	*/	
+    iVideoClipWritten = 0;
+    iWriting1stColorTransitionFrame = EFalse;
+	
+	// update clip properties
+	if (iThumbnailInProgress)
+	{
+		/* just get the first frame in normal mode */
+		iSpeed        =	KMaxVideoSpeed;	
+		iColorEffect  =	(TVedColorEffect)EVedColorEffectNone;	
+		iStartCutTime =	0; 
+		iEndCutTime   =	10;	
+	}
+	else
+	{
+		if (iNumberOfVideoClips) 
+		{			
+			iSpeed        =	(TInt)iVideoClip->Speed();	
+			iColorEffect  =	iVideoClip->ColorEffect();	
+			iStartCutTime =	TTimeIntervalMicroSeconds(0);         /* since generated clips cannot be cut */
+            iEndCutTime   =	TTimeIntervalMicroSeconds(iVideoClip->Info()->Duration());
+            
+            iColorToneRgb = iVideoClip->ColorTone();
+            ConvertColorToneRGBToYUV(iColorEffect,iColorToneRgb);
+            
+			/* store previous middle transition, if there is more than one middle transition */
+			if(iVideoClipNumber > 0)
+				iPreviousMiddleTransitionEffect = iMiddleTransitionEffect;
+			/* since it is image clip, there will be no middletransitioneffect
+			   check if there is a position for middle transition for this clip
+			*/
+			if(iMovie->MiddleTransitionEffectCount() > iVideoClipNumber)
+			{
+				iMiddleTransitionEffect = iMovie->MiddleTransitionEffect(iVideoClipNumber);            
+				
+				if( ( iMiddleTransitionEffect == EVedMiddleTransitionEffectCrossfade ||
+					iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeLeftToRight ||
+					iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeRightToLeft ||
+					iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeTopToBottom ||
+					iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeBottomToTop ) &&
+					( iVideoClipNumber != iNumberOfVideoClips - 1 ) )
+				{
+					TParse filename, filepath;
+					CVedMovieImp* movie = (iMovie);
+					if( movie->VideoClip( iVideoClipNumber + 1 )->Info()->Class() == EVedVideoClipClassGenerated)
+					{
+						/* path for storing temporary files */						
+						TFileName ImageMovieName(KTempFilePath);
+						ImageMovieName.Append( _L( "Im_" ) );
+						ImageMovieName.Append( _L( "nokia_vpi.tmp" ) );
+						filename.Set( ImageMovieName, NULL, NULL );
+						
+						if (iOutputFileHandle)
+						{
+						    RFile* file = iOutputFileHandle;
+						    TFileName fullName;
+                            TInt error = file->FullName(fullName);
+                            filepath.Set(fullName, NULL, NULL);                            
+						}
+						else
+						    filepath.Set( iOutputMovieFileName, NULL, NULL );
+					}
+					else
+					{
+					    if ( movie->VideoClip( iVideoClipNumber + 1 )->Info()->FileHandle() != NULL )
+                        {
+                            RFile* file = movie->VideoClip( iVideoClipNumber + 1 )->Info()->FileHandle();
+                            
+                            TFileName origName;
+                            TInt error = file->Name(origName);
+                            filename.Set(origName, NULL, NULL);
+                            
+                            TFileName fullName;
+                            error = file->FullName(fullName);
+                            filepath.Set(fullName, NULL, NULL);                            
+                        } 
+                        else
+                        {                            					
+    						filename.Set( movie->VideoClip( iVideoClipNumber + 1 )->Info()->FileName(), NULL, NULL );
+    						filepath.Set( iOutputMovieFileName, NULL, NULL );
+                        }
+					}
+					
+					iNextClipFileName = filepath.DriveAndPath();
+					iNextClipFileName.Append( filename.Name() );
+					/* tag it to indicate that its a tmp editor file */
+					iNextClipFileName.Append( _L( "_" ) );
+					iNextClipFileName.AppendNum( iVideoClipNumber );
+					iNextClipFileName.Append( _L( "_vpi.tmp" ) );
+					/* try to create a tmp file */
+					if ( iNextClip.Create( iFs, iNextClipFileName, EFileStream | EFileWrite | EFileShareExclusive ) != KErrNone )
+					{
+						/* check if the tmp file exists */
+						if ( iNextClip.Open( iFs, iNextClipFileName, EFileStream | EFileWrite | EFileShareExclusive ) != KErrNone )
+						{
+							iNextClip.Close();
+							iNextClipFileName.Zero();
+						}
+					}
+				}
+			}
+		}
+		
+		/* this is in common timescale */
+		iInitialClipStartTimeStamp = (iVideoClipNumber>0 ? iVideoClipParameters[iVideoClipNumber-1].iEndTime : 0);
+	}
+	
+	if (iNumberOfVideoClips)
+	{		
+
+		if (!iParser) /* if file name does not exist, this may cause error while parsing */
+		{			
+			iParser = (CMP4Parser*) CMP4Parser::NewL(this, iClipFileName);
+		}
+		else
+		{			
+			delete iParser;
+			iParser = 0;
+			iParser = (CMP4Parser*) CMP4Parser::NewL(this, iClipFileName);
+		}
+
+		iParser->iFirstTimeClipParsing = ETrue;
+		iState = EStateIdle;
+		/* open file and parse header */
+		CMovieProcessorImpl::TDataFormat format = CMovieProcessorImpl::EDataAutoDetect;        
+		/* this will be overloaded to accomodate for the buffer type */
+		
+		// HUOM! Meneekö tää oikein ??
+		User::LeaveIfError(OpenStream(iClipFileName, NULL, format));
+		VPASSERT(iState == EStateOpened);		
+
+	}
+	else
+	{
+		SetHeaderDefaults();
+	}
+	
+	iState = EStatePreparing;
+	if (!iThumbnailInProgress)
+	{	
+	
+	    iEncoderInitPending = ETrue;        
+        // async.			
+		if (!IsActive())
+		{
+			SetActive();
+			iStatus = KRequestPending;
+		}
+		TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+		
+		if (iNumberOfVideoClips)
+		{
+			/* update the video clip duration in millisec. */
+			iVideoClipDuration = (TInt64)(iVideoClip->Info()->Duration().Int64() * 
+				(TInt64)iParser->iStreamParameters.iVideoTimeScale / (TInt64)(1000000)); 
+		}
+
+		if(iOutputAudioType == EAudioAMR)
+		{	// setting generated clip type same as output type
+			if( iAudioType == EAudioNone)
+			   iAudioType = EAudioAMR;
+		}else if(iOutputAudioType == EAudioAAC)
+		{
+			if( iAudioType == EAudioNone)
+				iAudioType = EAudioAAC;	
+		}
+
+	}
+	else      /* if thumbnail is in progress */
+	{        
+		/* open demux and decoder */
+		User::LeaveIfError(Prepare());
+		VPASSERT(iState == EStateReadyToProcess);        
+	}    
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::TemporaryInitializeGeneratedClipL
+// temporarily initializes the processor for image 3gp file creation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::TemporaryInitializeGeneratedClipL(){
+	
+	/* re-initialize to create new clip */
+	iFirstFrameOfClip = ETrue;  /* initialized to indicate that the first frame of this clip has not yet been written */
+    iFirstFrameFlagSet = EFalse;
+	iModeChanged = EFalse;	   /* assuming that this clip's mode has not been changed	*/	
+	iImageClipCreated = 0;
+	iWriting1stColorTransitionFrame = EFalse;
+	
+	iImageEncodedFlag = 0;	// has an image been encoded
+	iImageEncodeProcFinished = 0;	
+	iFirstTimeProcessing = 0;
+	iGetFrameInProgress = 0;
+	iEncodeInProgress = 0;
+	
+	TInt foundFileBased = 0; 
+	TInt index = 0;	
+	CVedVideoClip* tempclip =0;
+	CVedMovieImp* tempmovie = (iMovie);
+	TSize mRes = tempmovie->Resolution();
+	
+    if(iVideoClipNumber == 0)
+    {
+        while(foundFileBased == 0)
+        {
+            if(index >= iNumberOfVideoClips)
+            {
+                break;
+            }
+            else
+            {
+                tempclip = tempmovie->VideoClip(index);
+                index++;
+                if(tempclip->Info()->Class()==EVedVideoClipClassGenerated)
+                {
+                    foundFileBased = 0;  //You still need to search
+                }
+                else
+                {
+                    foundFileBased = 1;
+                    
+                    if (tempclip->Info()->FileHandle())
+                    {
+                        iClipFileName.Zero();
+                        iClipFileHandle = tempclip->Info()->FileHandle();
+                    }
+                    else
+                    {   
+                        iClipFileHandle = NULL;                     
+                        iClipFileName = tempclip->Info()->FileName();
+                    }
+                }
+            }
+        }
+        tempmovie = 0;                /* make them zero again */
+        tempclip = 0;
+        if(foundFileBased == 0)     /* no file based clips in output movie */
+        {
+            iAllGeneratedClips =1;     /* to indicate all clips to be inserted are generated */
+            iVideoParameters.iWidth = mRes.iWidth;
+            iVideoParameters.iHeight = mRes.iHeight;
+        }
+        else
+        {
+            /* create an instance of the parser which will be used to set stream paramters from file based */
+            if (iNumberOfVideoClips)
+            {	                
+                if (!iParser) 
+                {
+                    if (iClipFileHandle)
+                        iParser = (CMP4Parser*) CMP4Parser::NewL(this, iClipFileHandle);
+                    else
+                        iParser = (CMP4Parser*) CMP4Parser::NewL(this, iClipFileName);
+                }
+                iParser->iFirstTimeClipParsing = ETrue;
+                iState = EStateIdle;
+                /* open file and parse header */                
+                iDataFormat = EData3GP;     /* since file will be generated cant open with open stream so reset with standard */
+                iMuxType = EMux3GP;    
+                ParseHeaderL();
+            }
+        }
+    }
+    
+    iState = EStatePreparing;
+		
+    if(iAllGeneratedClips == 1) /* all are generated clips => use H263 */
+    {
+		//iTranscoder->SetTargetVideoType(1);	/* set target video type to H263 */
+		//not required as if all are generated even then output is based on engine output video type        
+    }
+    iMonitor->StartPreparing();
+    if (!iVideoEncoder)
+    {
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+        if (iOutputVideoType == EVideoAVCProfileBaseline)
+        {
+            VPASSERT(!iImageAvcEdit);
+            iImageAvcEdit = CVedAVCEdit::NewL();
+            
+            iImageAvcEdit->SetOutputLevel( GetOutputAVCLevel() );
+        }	
+        
+#endif
+		iVideoEncoder = CVideoEncoder::NewL(iMonitor, iImageAvcEdit, iMovie->VideoCodecMimeType());
+		
+		iVideoEncoder->SetFrameSizeL(iMovie->Resolution());
+		
+		// Use the max frame rate since we don't want to change the frame rate
+        TReal inputFrameRate = iMovie->MaximumFramerate();
+        iVideoEncoder->SetInputFrameRate(inputFrameRate);
+		
+        if ( iMovie->VideoFrameRate() > 0 )
+            iVideoEncoder->SetFrameRate( iMovie->VideoFrameRate() );
+        if ( iMovie->VideoBitrate() > 0 ) // if there is request for restricted bitrate, use it
+            iVideoEncoder->SetBitrate( iMovie->VideoBitrate() );
+        else if ( iMovie->VideoStandardBitrate() > 0 ) // use the given standard bitrate
+            iVideoEncoder->SetBitrate( iMovie->VideoStandardBitrate() );
+        
+        if( iMovie->RandomAccessRate() > 0.0 )
+            iVideoEncoder->SetRandomAccessRate( iMovie->RandomAccessRate() );
+        
+        /* initialize encoder */        
+		if (!IsActive())
+		{
+			SetActive();
+			iStatus = KRequestPending;
+		}        
+        iVideoEncoder->InitializeL(iStatus);
+		iEncoderInitPending = ETrue;
+    }
+    else
+    {
+		if((iAllGeneratedClips == 1) && (iVideoClipNumber == 0))
+		{
+			VPASSERT(iVideoEncoder->BeenStarted() == 0);
+			//iVideoEncoder->Stop();
+			delete iVideoEncoder;
+			iVideoEncoder = 0;
+			
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+			if (iOutputVideoType == EVideoAVCProfileBaseline)
+            {
+                VPASSERT(!iImageAvcEdit);
+                iImageAvcEdit = CVedAVCEdit::NewL();
+                
+                iImageAvcEdit->SetOutputLevel( GetOutputAVCLevel() );
+            }
+#endif
+			
+			iVideoEncoder = CVideoEncoder::NewL(iMonitor, iImageAvcEdit, iMovie->VideoCodecMimeType());
+			
+			iVideoEncoder->SetFrameSizeL(iMovie->Resolution());
+			
+			TReal inputFrameRate = iMovie->MaximumFramerate();
+            iVideoEncoder->SetInputFrameRate(inputFrameRate);
+			
+            if ( iMovie->VideoFrameRate() > 0 )
+                iVideoEncoder->SetFrameRate( iMovie->VideoFrameRate() );
+            if ( iMovie->VideoBitrate() > 0 ) // if there is request for restricted bitrate, use it
+                iVideoEncoder->SetBitrate( iMovie->VideoBitrate() );
+            else if ( iMovie->VideoStandardBitrate() > 0 ) // use the given standard bitrate
+                iVideoEncoder->SetBitrate( iMovie->VideoStandardBitrate() );
+            if( iMovie->RandomAccessRate() > 0.0 )
+                iVideoEncoder->SetRandomAccessRate( iMovie->RandomAccessRate() );
+
+			/* initialize encoder */			
+			if (!IsActive())
+			{
+				SetActive();         
+				iStatus = KRequestPending;
+			}
+			iVideoEncoder->InitializeL(iStatus);
+			iEncoderInitPending = ETrue;			
+		}
+		else
+		{
+			// first frame has to be intra
+			iVideoEncoder->SetRandomAccessPoint();
+            iEncoderInitPending = ETrue;
+            if (!IsActive())
+            {
+                SetActive();
+                iStatus = KRequestPending;         
+            }
+            TRequestStatus *status = &iStatus;        
+            User::RequestComplete(status, KErrNone);			
+		}
+    }
+    
+    
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::ParseHeaderOnlyL
+// Parses the header for a given clip
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::ParseHeaderOnlyL(CParser::TStreamParameters& aStreamParams, 
+                                           TFileName& aFileName, RFile* aFileHandle)
+{
+	
+	if (!iParser)
+    {        
+		// create an instance of the parser 
+		if (aFileHandle)
+		    iParser = (CMP4Parser*) CMP4Parser::NewL(this, aFileHandle);
+		else
+		    iParser = (CMP4Parser*) CMP4Parser::NewL(this, aFileName);
+	}
+	iParser->ParseHeaderL(aStreamParams);
+	
+    // don't read the audio properties from input files, but from audio engine	
+	CVedMovieImp* songmovie = (iMovie);
+	CAudSong* songPointer = 0;
+	
+	if (songmovie)
+	{
+	    songPointer = songmovie->Song();    
+	}		
+	
+	if (songPointer)
+	{
+	    TAudFileProperties prop = songPointer->OutputFileProperties();
+	
+    	aStreamParams.iHaveAudio = ETrue;
+    	if (songPointer->ClipCount(KAllTrackIndices) == 0)
+        {
+    	    aStreamParams.iHaveAudio = EFalse;
+    	}
+    	    
+    	aStreamParams.iAudioLength = I64INT(prop.iDuration.Int64())/1000;
+    	aStreamParams.iAudioFormat = CParser::EAudioFormatNone;
+    	if (prop.iAudioType == EAudAMR)
+    	{
+    	    aStreamParams.iAudioFormat = CParser::EAudioFormatAMR;
+    	    aStreamParams.iAudioFramesInSample = 5;
+    	    aStreamParams.iAudioTimeScale = 1000;
+    	}
+    	else if ( prop.iAudioType == EAudAAC_MPEG4 )
+    	{
+    	    aStreamParams.iAudioFormat = CParser::EAudioFormatAAC;
+    	    aStreamParams.iAudioFramesInSample = 1;
+    	    aStreamParams.iAudioTimeScale = prop.iSamplingRate;
+    	}    	    
+	}		
+
+    // update output parameters. 
+	UpdateStreamParameters(iParser->iStreamParameters, aStreamParams); 
+	SetOutputNumberOfFrames(iParser->iOutputNumberOfFrames); 
+}
+
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::OpenStream
+// Opens a clip for processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::OpenStream(TFileName aFileName, RFile* aFileHandle, TDataFormat aDataFormat)
+{
+    // We can only streams in idle state
+    if (iState != EStateIdle)
+        return EInvalidProcessorState;
+
+	TInt error = KErrNone;
+	iDataFormat = aDataFormat;
+
+    if (!aFileHandle)
+    {
+        
+        RFs fs;
+    	RFile file; 
+            
+    	if(aFileName.Length() == 0)
+    		return KErrArgument;			
+    	
+    	// Open a file server session and open the file:
+    	if ( (error = fs.Connect()) != KErrNone )
+    		return error;
+    	
+    	if ( (error = file.Open(fs, aFileName, EFileShareReadersOnly | EFileRead)) != KErrNone )
+        {        
+            if ( (error = file.Open(fs, aFileName, EFileShareAny | EFileRead)) != KErrNone )
+            {
+               return error;
+            }     
+        }
+    	
+    	// set descriptor to read buffer
+    	TPtr8 readDes(0,0);    
+    	readDes.Set(iReadBuf, 0, KReadBufInitSize);
+    	
+    	// read data from the file 		
+    	if ( (error = file.Read(readDes)) != KErrNone )
+    		return error;
+    	
+    	if ( readDes.Length() < 8 )
+    		return KErrGeneral;
+    	
+    	file.Close();
+    	fs.Close();
+    	
+        // detect if format is 3GP, 5-8 == "ftyp"
+        // This method is not 100 % proof, but good enough
+        if ( (iReadBuf[4] == 0x66) && (iReadBuf[5] == 0x74) &&
+            (iReadBuf[6] == 0x79) && (iReadBuf[7] == 0x70) )
+        {
+            iDataFormat = EData3GP;
+            iMuxType = EMux3GP;        
+        }
+        else
+            return KErrNotSupported;
+    }
+    
+    // FIXME
+    iDataFormat = EData3GP;
+    iMuxType = EMux3GP;   
+
+    // parse 3GP header
+    CMP4Parser *parser = 0;
+    if ( !iParser ) 
+    {        
+        if (iClipFileHandle)
+        {
+            TRAP(error, (parser = CMP4Parser::NewL(this, iClipFileHandle)) );
+        }
+        else
+        {
+            TRAP(error, (parser = CMP4Parser::NewL(this, iClipFileName)) );
+        }
+                
+        if (error != KErrNone)
+            return error;
+        iParser = parser;
+    }
+    else
+        parser = (CMP4Parser*)iParser;        
+
+    TRAP(error, ParseHeaderL());
+
+    if (error != KErrNone)
+        return error;
+
+    iState = EStateOpened;
+
+    return KErrNone;
+
+	   
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::CloseStream
+// Closes the processed stream from parser
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::CloseStream()
+{
+ 
+	PRINT((_L("CMovieProcessorImpl::CloseStream() begin - iState = %d"), iState))
+
+    if ( (iState != EStateOpened) && (iState != EStateProcessing) ) 
+		return EInvalidProcessorState;
+	
+	TInt error=0;
+
+	// delete parser
+	if (iParser)
+	{
+		TRAP(error,
+				{
+			delete iParser;
+			iParser=0;
+				}
+		);
+		if (error != KErrNone)
+			return error;
+	}
+	
+	iClipFileName.Zero();
+	iCurrentMovieName.Zero();
+		
+	// We are idle again
+	iState = EStateIdle;
+
+	PRINT((_L("CMovieProcessorImpl::CloseStream() end ")))
+    
+    return KErrNone;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::Prepare
+// Prepares the processor for processing, opens demux & decoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::Prepare()
+{
+    TInt error;	
+	TUint videoBlockSize, videoBlocks;	
+
+    // We can only prepare from preparing state
+    if (iState != EStatePreparing)
+        return EInvalidProcessorState;
+	
+	// Make sure we now know the stream format
+	if (iDataFormat == EDataAutoDetect)
+		return EUnsupportedFormat;	
+	
+    // Check whether the stream has audio, video or both, and whether it is
+    // muxed
+    switch (iDataFormat)
+        {
+        case EData3GP:
+            // the video and audio flags are set when
+            // the header is parsed.
+            iIsMuxed = ETrue;
+            break;
+        default:
+            User::Panic(_L("CMovieProcessorImpl"), EInvalidInternalState);
+        }
+
+	// If we have already played this stream since opening it, we'll have to
+	// try to rewind
+		
+    // only 3gp file format supported => iIsMuxed always true    
+    videoBlocks = KVideoQueueBlocks;
+    videoBlockSize = KVideoQueueBlockSize;		
+	
+	// Initialize video
+    VPASSERT((!iVideoQueue) && (!iVideoProcessor));
+    if (iHaveVideo)
+    {
+        TRAP(error, InitVideoL(videoBlocks, videoBlockSize));
+        if ( error != KErrNone )
+            return error;
+    }
+	
+	// Initialize demux
+	VPASSERT(!iDemux);
+    VPASSERT(iIsMuxed);
+	TRAP(error, InitDemuxL());
+    if ( error != KErrNone )
+        return error;
+
+	iState = EStateReadyToProcess;
+    
+	return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::InitVideoL
+// Initializes the video decoder for processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//				
+void CMovieProcessorImpl::InitVideoL(TUint aQueueBlocks, TUint aQueueBlockSize)
+{
+	// Create video input queue
+	iVideoQueue = new (ELeave) CActiveQueue(aQueueBlocks, aQueueBlockSize);
+	iVideoQueue->ConstructL();		
+	
+	if (iThumbnailInProgress && 
+	    iParser->iStreamParameters.iVideoFormat == CParser::EVideoFormatAVCProfileBaseline)
+    {
+        if (!iAvcEdit)
+        {            
+            // create AVC editing instance
+    	    iAvcEdit = CVedAVCEdit::NewL();
+        }
+    }
+	
+	// Create correct video decoder object
+
+	VPASSERT(!iVideoProcessor);
+	switch (iVideoType)
+	{
+	case EVideoH263Profile0Level10:
+	case EVideoH263Profile0Level45:
+	case EVideoMPEG4:
+	case EVideoAVCProfileBaseline:
+		// H.263 decoder handles both H.263+ and MPEG-4
+		{
+
+            iVideoProcessor = CVideoProcessor::NewL(iVideoQueue, 
+                                                    &iVideoParameters, 
+                                                    this, 
+                                                    iMonitor,      
+                                                    iAvcEdit,                                        
+                                                    iThumbnailInProgress,
+                                                    CActive::EPriorityStandard);
+            
+		}
+		break;
+		
+	default:
+		User::Leave(EUnsupportedFormat);
+	}
+}
+				
+				
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::InitDemuxL
+// Initializes the demultiplexer for processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//				
+void CMovieProcessorImpl::InitDemuxL()
+{	
+	
+	// Set video channel target queue
+	TUint i;	
+
+    // 3gp is the only supported file format
+    VPASSERT(iMuxType == EMux3GP);    
+
+	for ( i = 0; i < iNumDemuxChannels; i++ )
+	{        
+        if (iMP4Channels[i].iDataType == CMP4Demux::EDataVideo)
+        {
+            VPASSERT(iHaveVideo);
+            iMP4Channels[i].iTargetQueue = iVideoQueue;
+        }        
+    }	
+	
+	VPASSERT(iParser);
+
+    iDemux = CMP4Demux::NewL(NULL /* demuxQueue */, iNumDemuxChannels,
+                             iMP4Channels, &iMP4Parameters,
+                             iMonitor, (CMP4Parser*)iParser,
+                             KDemuxPriority);
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::DoStartProcessing
+// Starts processing the movie
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//				
+void CMovieProcessorImpl::DoStartProcessing()
+{
+
+    PRINT((_L("CMovieProcessorImpl::DoStartProcessing() begin")))
+
+    if (iNumberOfVideoClips)
+    {        
+        VPASSERT(iDemux);
+        VPASSERT(iVideoProcessor);
+        VPASSERT(iState == EStateReadyToProcess);
+        
+        // start demuxing & decoding video
+
+        iDemux->Start();
+        iVideoProcessor->Start();
+        if(!((iVideoClipNumber==0)&&((TVedVideoClipClass)iVideoClip->Info()->Class()==(TVedVideoClipClass)EVedVideoClipClassGenerated)))
+            iMonitor->ProcessingStarted(iStartingProcessing);
+        iStartingProcessing = EFalse;
+        iState = EStateProcessing;
+    }
+    else
+    {// audio-only case
+
+        iState = EStateProcessing;
+        iMonitor->ProcessingStarted(EFalse);
+        
+        TRAPD( error, iObserver->NotifyMovieProcessingStartedL(*iMovie) );
+        if (error != KErrNone)
+        {
+            if (iMonitor)
+                iMonitor->Error(error);
+            return;
+        }
+        
+        // process all audio clips
+        ProcessAudioOnly();        
+    }       
+
+    PRINT((_L("CMovieProcessorImpl::DoStartProcessing() end")))
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::ProcessAudioOnly
+// Processes the movie in audio-only case
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//				
+void CMovieProcessorImpl::ProcessAudioOnly()
+{
+
+    VPASSERT(iNumberOfAudioClips > 0);    
+
+    // write audio frames to file & encode a black video frame
+    TInt error;
+    TRAP(error, ProcessAudioL());
+    if (error != KErrNone)
+    {
+        iMonitor->Error(error);
+        return;
+    }
+
+    //VPASSERT(iEncodePending);        
+
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::DoCloseVideoL
+// Closes & deletes the structures used in processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//				
+void CMovieProcessorImpl::DoCloseVideoL()
+{
+	if ((iState == EStateProcessing) || (iState == EStateReadyToProcess)|| 
+        (iState == EStatePreparing) )
+	{
+		PRINT((_L("CMovieProcessorImpl::DoCloseVideoL() - stopping")))
+		User::LeaveIfError(Stop());
+		iState = EStateOpened;
+	}
+	
+	// If we are buffering or opening at the moment or clip is open then close it 
+	if ( (iState == EStateOpened) || (iState == EStateReadyToProcess)) 
+	{
+		PRINT((_L("CMovieProcessorImpl::DoCloseVideoL() - closing stream")))
+		User::LeaveIfError(CloseStream());
+		iState = EStateIdle;
+	}
+}
+				
+				
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::Stop
+// Stops processing & closes modules used in processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//				
+TInt CMovieProcessorImpl::Stop()
+{
+	TInt error = KErrNone; 
+	
+	// Check state
+	if ( (iState != EStateProcessing) && (iState != EStateReadyToProcess) && (iState != EStatePreparing) )
+		return EInvalidProcessorState;
+	// We may also get here from the middle of a Prepare() attempt.
+
+	PRINT((_L("CMovieProcessorImpl::Stop() begin")))
+		
+	// Destroy the playback objects to stop playback
+	TRAP(error,
+	{
+        if (iDemux)
+            delete iDemux; 
+        iDemux = 0;
+        
+        if (iAudioProcessor)
+            delete iAudioProcessor;
+        iAudioProcessor = 0;
+        
+	});
+	if (error != KErrNone)
+		return error;
+	
+	
+	if (iVideoEncoder)
+	{
+	    if (!iEncoderInitPending)
+	    {
+	        // Delete encoder. Don't delete now if encoding
+	        // is not in progress at encoder and there are 
+	        // active encoding flags. This means that encoder
+	        // has completed encoding request, but this->RunL()
+	        // hasn't been called yet. Encoder will be deleted in RunL()
+	        
+    	    if ( ( iVideoEncoder->IsEncodePending() == 1 ) ||
+    	         ( (!iEncodePending && !iEncodeInProgress) ) )
+    	    {
+    	        PRINT((_L("CMovieProcessorImpl::Stop() - deleting encoder")));
+    	        Cancel();
+    	        iVideoEncoder->Stop();
+    	        delete iVideoEncoder;
+			    iVideoEncoder = 0;    	        
+    	    }
+	    }	    
+	} 		  
+
+	if (iVideoProcessor)
+		delete iVideoProcessor;
+	iVideoProcessor = 0;					
+	
+	if (iVideoQueue)
+		delete iVideoQueue;
+	iVideoQueue = 0;
+		    
+    if (!iThumbnailInProgress && iState == EStateProcessing)
+    {   
+        if (iMonitor)     
+            iMonitor->ProcessingStopped();
+    }
+
+	iState = EStateOpened;
+	
+	PRINT((_L("CMovieProcessorImpl::Stop() end")))
+
+	return KErrNone;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::Close
+// Stops processing and closes all submodules except status monitor
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+TInt CMovieProcessorImpl::Close()
+{
+ 
+    // delete all objects except status monitor
+    delete iComposer; 
+    iComposer = 0;
+    DeleteClipStructures();        
+    TRAPD(error, DoCloseVideoL());
+    if (error != KErrNone)
+        return error;
+
+    iState = EStateIdle;
+
+    return KErrNone;
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::RunL
+// Called by the active scheduler when the video encoder initialization is done
+// or an ending black frame has been encoded
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+void CMovieProcessorImpl::RunL()
+{
+
+    PRINT((_L("RunL begin, iEncoderInitPending %d, iEncodePending %d, iEncodeInProgress %d"), 
+				iEncoderInitPending, iEncodePending, iEncodeInProgress ));
+				
+    PRINT((_L("CMovieProcessorImpl::RunL begin - iEncodeInProgress %d"), iEncodeInProgress));
+		
+    if (iAudioProcessingCompleted)
+    {
+        iAudioProcessingCompleted = EFalse;
+        FinalizeVideoSequenceL();
+        return;
+    }
+    	
+	if (iNumberOfVideoClips)
+	{
+		// If we come here after a generated 3gp clip has been created, 
+		// ival == EVedVideoClipClassGenerated && iImageClipCreated == 1		
+		
+		TVedVideoClipClass ival = (TVedVideoClipClass)iVideoClip->Info()->Class();
+		if(ival == EVedVideoClipClassGenerated && iImageClipCreated == 0) // iImageClipCreated will work only for single imageset currently
+		{	
+			iEncoderInitPending = EFalse;  // is this correct ??
+			DoImageSetProcessL(); // Call function which does image file creation
+			return;
+		}
+	}    
+
+	if (iEncoderInitPending)
+    {		
+		VPASSERT(!iEncodePending);
+
+		PRINT((_L("CMovieProcessorImpl::RunL - encoder init complete")));
+        // video encoder has been initialized => start processing
+        
+		iEncoderInitPending = EFalse;
+		
+		if (iProcessingCancelled)
+		{
+		    PRINT((_L("CMovieProcessorImpl::RunL - processing cancelled")));
+		    if (iVideoEncoder)
+		    {
+		        iVideoEncoder->Stop();
+		        delete iVideoEncoder;
+		        iVideoEncoder = 0; 
+		    }
+		    PRINT((_L("CMovieProcessorImpl::RunL - calling cancelled callback")));
+		    if (iMonitor)
+		        iMonitor->ProcessingCancelled(); 
+
+		    return;	    
+		}
+		
+		if (iEncodingBlackFrames)
+		{
+		    FinalizeVideoSequenceL();
+		    return;
+		}
+        
+        if (iNumberOfVideoClips)
+        {                                		    
+				
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+            CVedVideoClipInfo* currentInfo = iVideoClip->Info();
+
+            // Save SPS/PPS data from input file even if output type
+            // is not AVC. This data is needed in doing blending transitions
+            // from AVC input to H.263/MPEG-4 output. An optimisation
+            // could be to check if such transitions are present in movie
+            // and save only when necessary.
+
+            if ( (currentInfo->Class() == EVedVideoClipClassFile && 
+                  currentInfo->VideoType() == EVedVideoTypeAVCBaselineProfile) ||
+                 (iOutputVideoType == EVideoAVCProfileBaseline && 
+		          currentInfo->Class() == EVedVideoClipClassGenerated) )
+		    {
+		        // save SPS/PPS NAL units   
+		        TInt size = iParser->GetDecoderSpecificInfoSize();
+		        HBufC8* buf = (HBufC8*) HBufC8::NewLC(size);
+		        TPtr8 ptr = buf->Des();
+		        User::LeaveIfError( iParser->ReadAVCDecoderSpecificInfo(ptr) );
+		        iAvcEdit->SaveAVCDecoderConfigurationRecordL(ptr, EFalse);
+		        CleanupStack::PopAndDestroy();  // buf
+		    }
+#endif
+
+            // go to the beginning of the I frame immediately preceding the start cut time 
+            User::LeaveIfError(iParser->SeekOptimalIntraFrame(iStartCutTime, 0, ETrue));
+            
+            TInt currentFrameIndex = iOutputNumberOfFrames;
+            
+            // update parameters
+            SetOutputNumberOfFrames(iParser->iOutputNumberOfFrames); 
+            
+            // fill in frame parameters
+            FillFrameParametersL(currentFrameIndex);
+            
+            // open video decoder & demux
+            User::LeaveIfError(Prepare());            
+        }
+				                        // if ( iVideoClipNumber > 0 || class != generated )
+		if( iNumberOfVideoClips == 0 || !( (iVideoClipNumber==0) && ((TVedVideoClipClass)iVideoClip->Info()->Class()==(TVedVideoClipClass)EVedVideoClipClassGenerated)) )
+			iMonitor->PrepareComplete();		
+
+        // start processing
+        DoStartProcessing();    
+    }
+
+    else if (iEncodePending)
+    {
+        // encoding complete
+        iEncodePending = EFalse;
+        
+        TInt64 frameDuration;       // in ticks
+        if ( iLeftOverDuration >= 1000 )
+        {
+            iLeftOverDuration -= 1000;
+            frameDuration = iOutputVideoTimeScale; // One second in ticks
+        }
+        else
+        {
+            iLeftOverDuration = 0;
+            frameDuration = TInt64( TReal(iOutputVideoTimeScale)/1000.0 * I64REAL(iLeftOverDuration) + 0.5 );
+        }
+
+        if (iStatus == KErrNone)
+        {            
+            // Audio-only or audio longer than video
+            // => black frame is encoded at the end
+            
+            PRINT((_L("CMovieProcessorImpl::RunL - encoding complete")));            
+            
+            // fetch the bitstream & write it to output file, release bitstream buffer        
+            TBool isKeyFrame = 0;
+            TPtrC8 buf(iVideoEncoder->GetBufferL(isKeyFrame));
+
+            TReal tsInTicks = I64REAL(iTimeStamp.Int64() / TInt64(1000)) * TReal(iOutputVideoTimeScale) / 1000.0;
+            
+            User::LeaveIfError( WriteVideoFrameToFile((TDesC8&)buf, TInt64(tsInTicks + 0.5), I64INT(frameDuration), 
+                                                      isKeyFrame, ETrue, EFalse, ETrue ) );        
+            
+            iVideoEncoder->ReturnBuffer();                        
+            
+            // do not reset flag until here so that last frame of last clip gets the correct 
+            // duration in case slow motion is used
+            iApplySlowMotion = EFalse;
+        }
+#ifdef _DEBUG
+        else
+        {            
+            PRINT((_L("CMovieProcessorImpl::RunL - encoding failed")));
+        }
+#endif
+        
+        iTimeStamp = TTimeIntervalMicroSeconds(iTimeStamp.Int64() + TInt64(1000000));
+
+		if (iLeftOverDuration > 0)
+		{
+			// encode another frame
+			VPASSERT(iEncoderBuffer);
+        	TSize tmpSize = iMovie->Resolution();
+            TUint yLength = tmpSize.iWidth * tmpSize.iHeight;
+			TUint uvLength = yLength >> 1;
+			TUint yuvLength = yLength + uvLength;
+			TPtr8 yuvPtr(iEncoderBuffer, yuvLength, yuvLength);
+			
+            if (!IsActive())
+            {
+                SetActive();
+                iStatus = KRequestPending;
+            }
+			
+			iVideoEncoder->EncodeFrameL(yuvPtr, iStatus, iTimeStamp);
+            iEncodePending = ETrue;
+			
+		}
+		else
+		{		
+		    // movie complete, close everything
+		    
+            TInt error = FinalizeVideoWrite();
+            if (error != KErrNone)
+			{
+                User::Leave(KErrGeneral);				
+			}
+
+			error = iComposer->Close();  // creates the output file
+			if (error != KErrNone)
+			{
+                User::Leave(KErrGeneral);				
+			}			
+			
+			// delete all objects except status monitor
+			delete iComposer; 
+			iComposer = 0;						
+			
+			if(iImageComposer) 
+		    {
+    			delete iImageComposer;
+    			iImageComposer=0;
+		    }
+		    
+		    if (iImageAvcEdit)
+        	{
+        	    delete iImageAvcEdit;
+        	    iImageAvcEdit = 0;
+        	}
+		 
+			DeleteClipStructures();
+			
+			DoCloseVideoL();
+			
+			VPASSERT(!iEncoderInitPending);
+			
+			PRINT((_L("CMovieProcessorImpl::RunL - calling completed callback")));
+			iMonitor->ProcessingComplete();
+            iState = EStateIdle;
+		}
+		
+    }
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::RunError
+// Called by the AO framework when RunL method has leaved
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+TInt CMovieProcessorImpl::RunError(TInt aError)
+{
+
+    if ( iCurClipFileName.Length() )
+	{
+        iCurClip.Close();
+        iFs.Delete( iCurClipFileName );
+        iCurClipFileName.Zero();
+        iCurClipDurationList.Reset();
+        iCurClipTimeStampList.Reset();
+    }
+
+    iMonitor->Error(aError);
+
+    return KErrNone;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::DoCancel
+// Cancels any pending asynchronous requests
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::DoCancel()
+{
+
+	PRINT((_L("CMovieProcessorImpl::DoCancel() begin")))
+
+    // Cancel our internal request
+    if ( iStatus == KRequestPending )
+    {
+		PRINT((_L("CMovieProcessorImpl::DoCancel() cancel request")))
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrCancel);
+    }
+
+	PRINT((_L("CMovieProcessorImpl::DoCancel() end")))
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::SetHeaderDefaults
+// Sets appropriate default values for processing parameters
+// in audio-only case
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::SetHeaderDefaults()
+{
+
+    // set suitable default values
+	iHaveVideo = ETrue;
+	iVideoType = EVideoH263Profile0Level10;
+	iHaveAudio = ETrue;
+	iAudioType = EAudioAMR;
+	iNumDemuxChannels = 0;
+		
+    // resolution from movie
+	TSize tmpSize = iMovie->Resolution();
+	iVideoParameters.iWidth = tmpSize.iWidth;
+	iVideoParameters.iHeight = tmpSize.iHeight;
+	iVideoParameters.iIntraFrequency = 0;
+	iVideoParameters.iNumScalabilityLayers = 0;
+	iVideoParameters.iReferencePicturesNeeded = 0;
+    // picture period in nanoseconds
+    iVideoParameters.iPicturePeriodNsec = TInt64(33366667);
+
+    // output time scales
+    iOutputVideoTimeScale = KVideoTimeScale;
+    iOutputAudioTimeScale = KAMRAudioTimeScale;
+
+    iStreamLength = 0;
+    iStreamSize = 0;
+    iStreamBitrate = 10000;
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::ParseHeaderL
+// Parses the clip header & sets internal variables accordingly
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::ParseHeaderL()
+{
+	TInt i;
+	
+	VPASSERT(iParser);
+	
+	if ( iMuxType != EMux3GP )
+        User::Leave(EUnsupportedFormat);
+	
+	CParser::TStreamParameters streamParams;
+	
+	// parse
+	iParser->ParseHeaderL(streamParams);
+	
+    // don't read the audio properties from input files, but from audio engine	
+	CVedMovieImp* songmovie = (iMovie);
+	CAudSong* songPointer = 0;
+	
+	if (songmovie)
+	{
+	    songPointer = songmovie->Song();    
+	}
+			
+	if (songPointer)
+	{
+	    
+	    TAudFileProperties prop = songPointer->OutputFileProperties();
+	
+	    streamParams.iHaveAudio = ETrue;
+    	if (songPointer->ClipCount(KAllTrackIndices) == 0)
+    	{
+    	    streamParams.iHaveAudio = EFalse;
+    	}
+    	    
+    	streamParams.iAudioLength = I64INT(prop.iDuration.Int64())/1000;
+    	streamParams.iAudioFormat = CParser::EAudioFormatNone;
+    	if (prop.iAudioType == EAudAMR)
+    	{
+    	    streamParams.iAudioFormat = CParser::EAudioFormatAMR;
+    	    streamParams.iAudioFramesInSample = 5;
+    	    streamParams.iAudioTimeScale = 1000;
+    	}
+    	else if ( prop.iAudioType == EAudAAC_MPEG4 )
+    	{
+    	    streamParams.iAudioFormat = CParser::EAudioFormatAAC;
+    	    streamParams.iAudioFramesInSample = 1;
+    	    streamParams.iAudioTimeScale = prop.iSamplingRate;
+    	}    	    
+	}	
+
+	// copy input stream info into parser
+	UpdateStreamParameters(iParser->iStreamParameters, streamParams); 
+	
+	// copy parameters
+	iHaveVideo = streamParams.iHaveVideo;
+	iVideoType = (TVideoType)streamParams.iVideoFormat;
+	iHaveAudio = streamParams.iHaveAudio;
+	iAudioType = (TAudioType)streamParams.iAudioFormat;
+	iNumDemuxChannels = streamParams.iNumDemuxChannels;
+	iCanSeek = streamParams.iCanSeek;
+	iVideoParameters.iWidth = streamParams.iVideoWidth;
+	iVideoParameters.iHeight = streamParams.iVideoHeight;
+	iVideoParameters.iIntraFrequency = streamParams.iVideoIntraFrequency;
+	iVideoParameters.iNumScalabilityLayers = streamParams.iNumScalabilityLayers;
+	iVideoParameters.iReferencePicturesNeeded = streamParams.iReferencePicturesNeeded;
+	iVideoParameters.iPicturePeriodNsec = streamParams.iVideoPicturePeriodNsec;
+
+	for (i = 0; i < (TInt)streamParams.iNumScalabilityLayers; i++)
+		iVideoParameters.iLayerFrameRates[i] = streamParams.iLayerFrameRates[i];
+
+    
+	// assign time scale values
+	if((iVideoClipNumber==0) && (iOutputVideoTimeSet==0))
+	{
+		iOutputVideoTimeSet = 1;	
+		iOutputVideoTimeScale = KVideoTimeScale;
+	}	
+   	
+	// change the start and end times of the video clip from msec to ticks
+	iVideoClipParameters[iVideoClipNumber].iStartTime = TInt64( TReal(iOutputVideoTimeScale)/1000.0 *
+		I64REAL(iVideoClipParameters[iVideoClipNumber].iStartTime) ); 
+
+	iVideoClipParameters[iVideoClipNumber].iEndTime = TInt64( TReal(iOutputVideoTimeScale)/1000.0 *
+		I64REAL(iVideoClipParameters[iVideoClipNumber].iEndTime) );
+
+    iVideoParameters.iTiming = CVideoProcessor::ETimeStamp;
+    iMP4Parameters.iPicturePeriodMs = I64INT( (iVideoParameters.iPicturePeriodNsec / TInt64(1000000)) );
+    iMP4Parameters.iAudioFramesInSample = streamParams.iAudioFramesInSample;		
+	
+	
+	if ( iHaveVideo ) 
+    {	
+		iMP4Channels[0].iDataType = CMP4Demux::EDataVideo;
+	}
+
+    if ( iHaveAudio ) {
+
+        iNumDemuxChannels = 1;
+
+        // NOTE: audio is processed 'off-line' after a video
+        // clip has been processed.
+
+		//iMP4Channels[i].iDataType = CMP4Demux::EDataAudio;
+	}
+	
+	iStreamLength = streamParams.iStreamLength;
+	iStreamBitrate = streamParams.iStreamBitrate;
+	iStreamSize = streamParams.iStreamSize;		
+
+	// Ensure that the video isn't too large
+	if (!iThumbnailInProgress)
+	{
+    	if ( (iVideoParameters.iWidth > KVedMaxVideoWidth) ||
+    		(iVideoParameters.iHeight > KVedMaxVideoHeight) )
+    		User::Leave(EVideoTooLarge);
+	}
+
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::UpdateStreamParameters
+// Copies stream parameters to destination structure
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::UpdateStreamParameters(CParser::TStreamParameters& aDestParameters,  
+                                                 CParser::TStreamParameters& aSrcParameters)
+{
+		TInt i;
+		aDestParameters.iHaveVideo = aSrcParameters.iHaveVideo; 
+		aDestParameters.iHaveAudio = aSrcParameters.iHaveAudio; 
+		aDestParameters.iNumDemuxChannels = aSrcParameters.iNumDemuxChannels; 
+		aDestParameters.iFileFormat = aSrcParameters.iFileFormat;
+		aDestParameters.iVideoFormat = aSrcParameters.iVideoFormat; 
+		aDestParameters.iAudioFormat = aSrcParameters.iAudioFormat; 
+		aDestParameters.iAudioFramesInSample = aSrcParameters.iAudioFramesInSample; 
+		aDestParameters.iVideoWidth = aSrcParameters.iVideoWidth; 
+		aDestParameters.iVideoHeight = aSrcParameters.iVideoHeight; 
+		aDestParameters.iVideoPicturePeriodNsec = aSrcParameters.iVideoPicturePeriodNsec; 
+		aDestParameters.iVideoIntraFrequency = aSrcParameters.iVideoIntraFrequency; 
+		aDestParameters.iStreamLength = aSrcParameters.iStreamLength; 
+		aDestParameters.iVideoLength = aSrcParameters.iVideoLength; 
+		aDestParameters.iAudioLength = aSrcParameters.iAudioLength; 
+		aDestParameters.iCanSeek = aSrcParameters.iCanSeek; 
+		aDestParameters.iStreamSize = aSrcParameters.iStreamSize; 
+		aDestParameters.iStreamBitrate = aSrcParameters.iStreamBitrate; 
+		aDestParameters.iMaxPacketSize = aSrcParameters.iMaxPacketSize; 
+		aDestParameters.iLogicalChannelNumberVideo = aSrcParameters.iLogicalChannelNumberVideo; 
+		aDestParameters.iLogicalChannelNumberAudio = aSrcParameters.iLogicalChannelNumberAudio; 
+		aDestParameters.iReferencePicturesNeeded = aSrcParameters.iReferencePicturesNeeded; 
+		aDestParameters.iNumScalabilityLayers = aSrcParameters.iNumScalabilityLayers; 
+		for(i=0; i<(TInt)aSrcParameters.iNumScalabilityLayers; i++)
+			aDestParameters.iLayerFrameRates[i] = aSrcParameters.iLayerFrameRates[i];
+
+		aDestParameters.iFrameRate = aSrcParameters.iFrameRate; 
+		aDestParameters.iVideoTimeScale = aSrcParameters.iVideoTimeScale; 
+		aDestParameters.iAudioTimeScale = aSrcParameters.iAudioTimeScale; 
+
+}
+
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::FinalizeVideoClip
+// Finalizes video clip once all its frames are processed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::FinalizeVideoClip()
+{	
+
+	PRINT((_L("CMovieProcessorImpl::FinalizeVideoClip() begin")))
+
+    TInt error = KErrNone;	
+
+	TInt64 endPosition = TInt64(iCurrentVideoTimeInTicks + 0.5);
+
+    if ( TransitionDuration() )
+    {
+		endPosition += TInt64( (TReal)TransitionDuration() * (TReal)iOutputVideoTimeScale / (TReal)iParser->iStreamParameters.iVideoTimeScale + 0.5);
+    }
+
+	// convert time from ticks to millisec.
+	endPosition = GetVideoTimeInMsFromTicks( endPosition, ETrue );
+
+	CVedMovieImp* movie = (iMovie);
+
+	iLeftOverDuration = movie->Duration().Int64()/1000 - 
+		movie->VideoClip(iNumberOfVideoClips-1)->EndTime().Int64()/1000;
+
+    if (error != KErrNone)
+    {
+        iMonitor->Error(error);
+        return;
+    }
+	
+	// if last video clip in movie
+	if(iVideoClipNumber == iNumberOfVideoClips-1 || iMovieSizeLimitExceeded)
+	{
+		iAllVideoProcessed = ETrue;
+		if ( iFsConnected )
+        {
+            TRAP(error, CloseTransitionInfoL());
+            if (error != KErrNone)
+            {	
+                iMonitor->Error(error);
+                return;
+            }
+            iFs.Close();
+            iFsConnected = EFalse;
+        }
+
+        // process all audio
+        TRAP(error, ProcessAudioL());
+        if (error != KErrNone)
+        {
+            iMonitor->Error(error);
+            return;
+        }
+	}
+	else // process the next clip
+	{        
+
+		if (iCurClipFileName.Length() )
+        {
+            iCurClip.Close();
+            error = iFs.Delete( iCurClipFileName );
+            if (error != KErrNone)
+            {	
+                iMonitor->Error(error);
+                return;
+            }
+            iCurClipFileName.Zero();
+            iCurClipDurationList.Reset();
+            iCurClipTimeStampList.Reset();
+            iTimeStampListScaled = EFalse;            
+        }
+		
+        if ( iNextClipFileName.Length() )
+        {
+            iNextClip.Close();
+        }
+
+		// close the video 
+        TRAP(error, DoCloseVideoL());
+        if (error != KErrNone)
+        {
+            iMonitor->Error(error);
+
+			if ( iNextClipFileName.Length() )
+            {
+                error = iFs.Delete( iNextClipFileName );
+                if (error != KErrNone)
+                {	
+                    iMonitor->Error(error);
+                    return;
+                }
+                iNextClipFileName.Zero();
+                iNextClipDurationList.Reset();
+                iNextClipTimeStampList.Reset();
+            }
+            return;
+        }
+        iMonitor->Closed();	
+
+		if ( iFsConnected )
+        {
+            CFileMan *fileMan = 0;
+			TRAP(error, fileMan = CFileMan::NewL( iFs ));
+            if (error != KErrNone)
+            {
+                iMonitor->Error(error);
+                return;
+            }
+			TParse filepath;
+			filepath.Set( iOutputMovieFileName, NULL, NULL );
+			TFileName filesToDelete = filepath.DriveAndPath();
+			filesToDelete.Append( _L( "Im_nokia_vpi.tmp" ) );
+			fileMan->Delete( filesToDelete,0 );
+			delete fileMan;	
+        }
+
+		// copy from current to next
+        iCurClipFileName = iNextClipFileName;
+        iNextClipFileName.Zero();
+        TInt duration;
+        TInt64 timestamp;
+        while ( iNextClipDurationList.Count() )
+        {
+            duration = iNextClipDurationList[0];
+            iNextClipDurationList.Remove( 0 );
+            iCurClipDurationList.Append( duration );
+            timestamp = iNextClipTimeStampList[0];
+            iNextClipTimeStampList.Remove( 0 );
+            iCurClipTimeStampList.Append( timestamp );
+        }
+
+        iNextClipDurationList.Reset();
+        iNextClipTimeStampList.Reset();
+        iCurClipIndex = 0;
+
+        if ( iCurClipFileName.Length() )
+        {
+            if ( iCurClip.Open(iFs, iCurClipFileName, EFileShareReadersOnly | EFileStream | EFileRead) != KErrNone )
+            {
+                if ( iCurClip.Open(iFs, iCurClipFileName, EFileShareAny | EFileStream | EFileRead) != KErrNone )
+                {
+                    iCurClip.Close();
+                    iCurClipFileName.Zero();
+                    iCurClipDurationList.Reset();
+                    iCurClipTimeStampList.Reset();
+                }
+            }
+        }
+
+        VPASSERT(!iEncoderInitPending);
+        
+		// go to next clip
+		iVideoClipNumber++;
+		iVideoClip = movie->VideoClip(iVideoClipNumber);  
+
+        if(iVideoClip->Info()->Class() == EVedVideoClipClassGenerated)
+        {
+            TRAP(error, TemporaryInitializeGeneratedClipL());
+        }
+        else
+        {
+            TRAP(error, InitializeClipL());
+        }
+		if (error != KErrNone)
+		{
+			if ( iCurClipFileName.Length() )
+			{
+				iCurClip.Close();
+				TInt fsError = iFs.Delete( iCurClipFileName );
+                if (fsError != KErrNone)
+                {	
+                    iMonitor->Error(fsError);
+                    return;
+                }
+				iCurClipFileName.Zero();
+				iCurClipDurationList.Reset();
+				iCurClipTimeStampList.Reset();
+			}
+			iMonitor->Error(error);
+			return;
+		}
+		
+	}
+	PRINT((_L("CMovieProcessorImpl::FinalizeVideoClip() end")))
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::ProcessAudioL
+// Starts audio processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::ProcessAudioL()
+{
+	
+	VPASSERT(iAudioProcessor == 0);	
+	
+	CVedMovieImp* songmovie = (iMovie); 	
+	CAudSong* songPointer = songmovie->Song();
+	
+	// always read audio decoder specific info from audio engine
+	TAudType audioType = songPointer->OutputFileProperties().iAudioType;
+      	
+    if( audioType == EAudAAC_MPEG4 )
+    {        
+	    HBufC8* audioinfo = 0;
+	    songPointer->GetMP4DecoderSpecificInfoLC(audioinfo,64);  	
+    	
+	    if (audioinfo != 0)
+	    {	        
+		    CMP4Composer* composeInfo =  (CMP4Composer*)iComposer;
+			User::LeaveIfError(composeInfo->WriteAudioSpecificInfo(audioinfo));
+    	    CleanupStack::Pop();
+    	    delete audioinfo;
+    	    audioinfo = 0;
+	    }
+	    
+    }
+    if( (iMovieSizeLimit > 0)&&(iMovieSizeLimitExceeded) )
+	{
+	    songPointer->SetDuration(iEndCutTime.Int64()*1000);
+	}
+	
+	// create audioprocessor 	
+	iAudioProcessor = CAudioProcessor::NewL(this, songPointer);		                       
+			
+	// start processing
+	iAudioProcessor->StartL();
+	 
+	
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::AudioProcessingComplete
+// Called by audio processor when audio processing has been completed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::AudioProcessingComplete(TInt aError)
+{
+
+    if (aError != KErrNone)
+    {    	    
+        iMonitor->Error(aError);
+        return;
+    }
+    
+    if (iProcessingCancelled)
+        return;
+    
+    TInt error = FinalizeAudioWrite();
+    if (error != KErrNone)
+    {
+        iMonitor->Error(error);
+        return;    	
+    }
+    
+    iAudioProcessingCompleted = ETrue;
+    
+    // since this is run in audio processor's RunL, the audio processor 
+    // cannot be deleted here. signal the AO to finish in this->RunL()
+    
+    VPASSERT(!IsActive());
+    
+    SetActive(); 
+    iStatus = KRequestPending;
+    TRequestStatus *status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+                        
+    
+    	
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::FinalizeVideoSequence
+// Finalizes the movie once all clips have been processed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::FinalizeVideoSequenceL()
+{    
+
+    CVedMovieImp* movie = (iMovie);
+
+    // calculate video left-over duration in case audio runs longer than video
+    iLeftOverDuration = 0;
+    if (iNumberOfVideoClips > 0)
+    {
+        iLeftOverDuration = movie->Duration().Int64()/1000 - 
+            movie->VideoClip(iNumberOfVideoClips-1)->EndTime().Int64()/1000;
+    }
+	else 
+		iLeftOverDuration = movie->Duration().Int64()/1000;	
+
+	if ( iLeftOverDuration > 0)
+	{   
+		VPASSERT( iNumberOfAudioClips!=0 );
+        // encode black frames
+        
+    	if(iVideoProcessor)
+        {
+    		delete iVideoProcessor;	
+            iVideoProcessor = 0;	
+        }
+        
+        if (!iVideoEncoder)
+        {
+            // create and initialise encoder
+        
+            iVideoEncoder = CVideoEncoder::NewL(iMonitor, iAvcEdit, iMovie->VideoCodecMimeType());
+			
+			iVideoEncoder->SetFrameSizeL(iMovie->Resolution());
+			
+            if ( iMovie->VideoFrameRate() > 0 )
+                iVideoEncoder->SetFrameRate( iMovie->VideoFrameRate() );
+            if ( iMovie->VideoBitrate() > 0 ) // if there is request for restricted bitrate, use it
+                iVideoEncoder->SetBitrate( iMovie->VideoBitrate() );
+            else if ( iMovie->VideoStandardBitrate() > 0 ) // use the given standard bitrate
+                iVideoEncoder->SetBitrate( iMovie->VideoStandardBitrate() );
+            
+            // use input framerate of 1 fps
+            iVideoEncoder->SetInputFrameRate(1.0);
+            
+            if( iMovie->RandomAccessRate() > 0.0 )
+                iVideoEncoder->SetRandomAccessRate( iMovie->RandomAccessRate() );
+
+            // async.			
+			if (!IsActive())
+			{
+				SetActive();
+				iStatus = KRequestPending;
+			}			
+			iVideoEncoder->InitializeL(iStatus);			
+			
+			iEncoderInitPending = ETrue;
+			iEncodingBlackFrames = ETrue;
+			return;
+			
+        }
+    	TSize tmpSize = iMovie->Resolution();
+        TUint yLength = tmpSize.iWidth * tmpSize.iHeight;
+		TUint uvLength = yLength >> 1;
+		TUint yuvLength = yLength + uvLength;
+
+        if ( iEncoderBuffer == 0 )
+        {
+            // allocate memory for encoder input YUV frame            
+            iEncoderBuffer = (TUint8*)User::AllocL(yuvLength);                  
+        }        
+
+        // fill buffer with 'black' data
+		// Y
+        TPtr8 yuvPtr(0,0);
+		TInt data=5;  // don't use zero - real player doesn't show all-zero frames
+		yuvPtr.Set(iEncoderBuffer, yLength, yLength); 
+		yuvPtr.Fill((TChar)data, yLength);
+
+		// U,V
+		data=128;
+		yuvPtr.Set(iEncoderBuffer + yLength, uvLength, uvLength); 
+		yuvPtr.Fill((TChar)data, uvLength);
+
+        yuvPtr.Set(iEncoderBuffer, yuvLength, yuvLength);
+        
+        if (iNumberOfVideoClips == 0)
+            iTimeStamp = 0;
+        else
+            iTimeStamp = movie->VideoClip(iNumberOfVideoClips-1)->CutOutTime();            
+
+        if (!IsActive())
+        {
+            SetActive();
+            iStatus = KRequestPending;
+        }
+        
+        iVideoEncoder->EncodeFrameL(yuvPtr, iStatus, iTimeStamp);        
+        iEncodePending = ETrue;
+
+        return;
+		
+	}
+	
+	// movie complete, close everything
+		
+	User::LeaveIfError(FinalizeVideoWrite());
+	
+    // delete all objects except status monitor
+	if (iComposer)
+	{   
+	    User::LeaveIfError(iComposer->Close());
+		delete iComposer; 
+		iComposer = 0;
+	}
+
+    DoCloseVideoL();    
+    			
+	DeleteClipStructures();
+	
+	PRINT((_L("CMovieProcessorImpl::FinalizeVideoSequence() - calling completed callback")))
+	
+	iMonitor->ProcessingComplete();
+	iState = EStateIdle;
+	
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::CurrentMetadataSize
+// Get current metadata size
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint CMovieProcessorImpl::CurrentMetadataSize()
+{
+	TBool haveAudio;
+    TBool haveVideo;
+    TUint metadatasize = 0;
+
+    haveAudio = EFalse;
+    haveVideo = EFalse;
+
+	if ( GetOutputVideoType() == EVedVideoTypeH263Profile0Level10 || 
+		 GetOutputVideoType() == EVedVideoTypeH263Profile0Level45 )
+	{
+		haveVideo = ETrue;
+        metadatasize += 574; // Constant size H.263 metadata
+        metadatasize += (iVideoFrameNumber * 16 + iVideoIntraFrameNumber * 4); // Content dependent H.263 metadata
+	}
+
+	if ( GetOutputVideoType() == EVedVideoTypeMPEG4SimpleProfile )
+	{
+		haveVideo = ETrue;
+        metadatasize += 596; // Constant size MPEG-4 video metadata
+        metadatasize += (iVideoFrameNumber * 16 + iVideoIntraFrameNumber * 4); // Content dependent MPEG-4 video metadata
+	}
+
+	if ( GetOutputAudioType() == EVedAudioTypeAMR ) // AMR-NB
+	{
+        haveAudio = ETrue;
+        metadatasize += 514; // Constant size AMR metadata
+        metadatasize += ((iAudioFrameNumber + KVedAudioFramesInSample - 1) / KVedAudioFramesInSample) * 8;
+	}
+
+	if ( GetOutputAudioType() == EVedAudioTypeAAC_LC ) // MPEG-4 AAC-LC
+	{
+        haveAudio = ETrue;
+        metadatasize += 514; // Constant size metadata
+        metadatasize += (iAudioFrameNumber * 8);
+	}
+
+	if (haveAudio && haveVideo)
+        metadatasize -= 116; // There is only one moov and mvhd in a file
+
+	return metadatasize;
+		
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::BufferAMRFrames
+// Collects output audio frames to a buffer and writes them
+// to the output 3gp file when a whole audio sample is available
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::BufferAMRFrames(const TDesC8& aBuf, TInt aNumFrames,TInt aDuration)
+
+{
+
+	VPASSERT(iOutAudioBuffer); 
+	TPtr8 outAudioPtr(iOutAudioBuffer->Des());
+	TInt error = KErrNone;
+	
+	if((outAudioPtr.Length() + aBuf.Length()) > outAudioPtr.MaxLength()) 
+	{
+		// extend buffer size
+		
+		// New size is 3/2ths of the old size, rounded up to the next
+		// full kilobyte       
+		TUint newSize = (3 * outAudioPtr.MaxLength()) / 2;
+		newSize = (newSize + 1023) & (~1023);
+		TRAP(error, (iOutAudioBuffer = iOutAudioBuffer->ReAllocL(newSize)) );
+		
+		if (error != KErrNone)
+			return error;
+		
+		PRINT((_L("CMovieProcessorImpl::BufferAMRFrames() - extended buffer to %d bytes"), newSize));
+			
+		outAudioPtr.Set(iOutAudioBuffer->Des());
+	}
+	outAudioPtr.Append(aBuf);
+    iTotalDurationInSample += aDuration;
+	iAudioFramesInBuffer += aNumFrames;
+
+	return KErrNone;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::WriteAMRSamplesToFile
+// Write buffered AMR sample(s) to composer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::WriteAMRSamplesToFile()
+{
+
+	VPASSERT(iOutAudioBuffer); 
+	TPtr8 outAudioPtr(iOutAudioBuffer->Des());
+
+	VPASSERT(TUint(iAudioFramesInSample) == KVedAudioFramesInSample);
+
+	while ( iAudioFramesInBuffer >= iAudioFramesInSample )
+    {
+        // write one audio sample to file
+
+//        TInt frameSamples = 160;
+//        TInt samplingRate = KVedAudioSamplingRate8k;
+        TInt audioSampleDurationInTicks = 0;
+        TPtrC8 writeDes;
+        TInt sampleSize = 0;
+//        TInt frameNum = 0;	
+//        TInt frameSize = 0;
+        TUint8* frameBuffer = (TUint8*)outAudioPtr.Ptr();
+		TInt error = KErrNone;
+
+        // Gets Size of buffer of current frames
+        sampleSize = outAudioPtr.Length();
+                    
+        // if frame is sampled at a different rate 
+        audioSampleDurationInTicks = GetAudioTimeInTicksFromMs(iTotalDurationInSample/1000);
+                
+        // set descriptor to sample        
+        writeDes.Set( outAudioPtr.Left(sampleSize) );		
+
+        // compose audio to output 3gp file
+        error = iComposer->WriteFrames((TDesC8&)writeDes, sampleSize, audioSampleDurationInTicks, 0 /*iAudioKeyFrame*/, 
+            iAudioFramesInSample, CMP4Composer::EFrameTypeAudio);        
+            
+        // Resetting duration to zero
+		iTotalDurationInSample = 0;
+
+        if (error != KErrNone)
+            return error;
+
+        if ( outAudioPtr.Length() > sampleSize )
+        {
+            // copy rest of the data to beginning of buffer
+            frameBuffer = (TUint8*)outAudioPtr.Ptr();
+            TInt len = outAudioPtr.Length() - sampleSize;
+            Mem::Copy(frameBuffer, frameBuffer + sampleSize, len);
+            outAudioPtr.SetLength(len);
+        }
+        else 
+        {
+            VPASSERT(iAudioFramesInBuffer == iAudioFramesInSample);
+            outAudioPtr.SetLength(0);
+        }
+                     
+        iAudioFramesInBuffer -= iAudioFramesInSample;
+		iAudioFrameNumber += iAudioFramesInSample;
+    }
+	return KErrNone;
+
+}
+
+TInt CMovieProcessorImpl::WriteAllAudioFrames(TDesC8& aBuf, TInt aDuration)
+{
+
+    if (iDiskFull)
+	    return KErrDiskFull;
+
+    // check available disk space 	 
+
+	TInt error;
+	TInt64 freeSpace = 0;
+	// get free space on disk
+	TRAP(error, freeSpace = iComposer->DriveFreeSpaceL());
+	if (error != KErrNone)
+			return error;
+
+	// subtract metadata length from free space
+    freeSpace -= TInt64(CurrentMetadataSize());
+
+	if (freeSpace < TInt64(KDiskSafetyLimit))
+	{
+			iDiskFull = ETrue;
+			return KErrDiskFull;
+	}
+
+
+	if ( GetOutputAudioType() == EVedAudioTypeAMR )
+	{ 	
+     	// write frame by frame until duration >= duration for this clip
+     	
+     	// NOTE: clip duration not checked!!!
+     	
+		TPtr8 ptr(0,0);
+		TUint8* buf = (TUint8*)aBuf.Ptr();
+		TInt frameSize = aBuf.Length();
+
+		ptr.Set(buf, frameSize, frameSize);
+		error = BufferAMRFrames(ptr, 1,aDuration);
+		if ( error != KErrNone )
+			return error;
+		iTotalAudioTimeWrittenMs += (aDuration/1000); //20;
+		buf += frameSize;
+	
+	}
+	else
+	{
+		// write buffer directly to file (1 frame per sample in AAC)	
+		
+		error = KErrNone;
+//		TInt error = KErrNone;
+		TInt sampleSize = aBuf.Length();
+//		const TInt framesInSample = 1;
+		TInt audioSampleDurationInTicks = GetAudioTimeInTicksFromMs(aDuration/1000); 
+		
+		iTotalAudioTimeWrittenMs += (aDuration/1000);
+						
+		VPASSERT(iAudioFramesInSample == 1);
+		error = iComposer->WriteFrames(aBuf, sampleSize, audioSampleDurationInTicks, 0 /*iAudioKeyFrame*/, 
+			iAudioFramesInSample, CMP4Composer::EFrameTypeAudio);
+	} 	
+
+	if ( GetOutputAudioType() == EVedAudioTypeAMR )
+	{
+		error = WriteAMRSamplesToFile();
+		if ( error != KErrNone )
+			return error;
+	}
+
+	if ( (iTotalAudioTimeWrittenMs % 200) == 0 )
+		IncProgressBar();
+
+	return KErrNone;
+	
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::FinalizeAudioWrite
+// Write the remaining audio frames at the end of processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::FinalizeAudioWrite()
+{
+
+    VPASSERT(iAudioFramesInBuffer < iAudioFramesInSample);
+
+    if (iAudioFramesInBuffer == 0)
+        return KErrNone;
+
+	if(iOutputAudioType == EAudioAAC)
+	{
+		// There should not be any frames in buffer !!
+		VPASSERT(0);
+	}
+
+    TInt error = KErrNone;
+    TInt sampleSize = 0;
+//    TInt frameNum = 0;
+//    TInt frameSize = 0;
+
+    TPtr8 outAudioPtr(iOutAudioBuffer->Des());
+//    const TInt frameSamples = 160;    
+//    const TInt samplingRate = KVedAudioSamplingRate8k;
+
+    TInt audioSampleDurationInTicks = 0;
+    TPtrC8 writeDes;
+    TUint8* frameBuffer = (TUint8*)outAudioPtr.Ptr();
+    
+    // Gets Size of buffer of current frames
+	sampleSize = outAudioPtr.Length();
+	
+    // if frame is sampled at a different rate 
+	audioSampleDurationInTicks = GetAudioTimeInTicksFromMs(iTotalDurationInSample/1000);       
+
+    // set descriptor to sample
+    writeDes.Set( outAudioPtr.Left(sampleSize) );	
+    
+    // compose audio to output 3gp file
+    error = iComposer->WriteFrames((TDesC8&)writeDes, sampleSize, audioSampleDurationInTicks, 0 /*iAudioKeyFrame*/, 
+        iAudioFramesInBuffer, CMP4Composer::EFrameTypeAudio);        
+        
+    iTotalDurationInSample = 0; // resetting the value in sample
+    
+    if (error != KErrNone)
+        return error;
+
+    outAudioPtr.SetLength(0);
+	iAudioFrameNumber += iAudioFramesInBuffer;
+    iAudioFramesInBuffer = 0;
+
+
+    return KErrNone;
+
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::SetFrameType
+// Sets the frame type (inter/intra) for a frame
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::SetFrameType(TInt aFrameIndex, TUint8 aType)
+{
+	VPASSERT(iFrameParameters);
+	iFrameParameters[aFrameIndex].iType = aType;
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetVideoTimeInMsFromTicks
+// Converts a video timestamp from ticks to milliseconds
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt64 CMovieProcessorImpl::GetVideoTimeInMsFromTicks(TInt64 aTimeStampInTicks, TBool aCommonTimeScale) const
+{
+    TUint timeScale = aCommonTimeScale ? iOutputVideoTimeScale : iParser->iStreamParameters.iVideoTimeScale; 
+	VPASSERT(timeScale > 0);
+    return TInt64( I64REAL(aTimeStampInTicks) / (TReal)timeScale * 1000 + 0.5 );
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetVideoTimeInTicksFromMs
+// Converts a video timestamp from ms to ticks
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt64 CMovieProcessorImpl::GetVideoTimeInTicksFromMs(TInt64 aTimeStampInMs, TBool aCommonTimeScale) const
+{
+    TUint timeScale = aCommonTimeScale ? iOutputVideoTimeScale : iParser->iStreamParameters.iVideoTimeScale; 
+        
+	VPASSERT(timeScale > 0);
+	
+    return TInt64( I64REAL(aTimeStampInMs) * (TReal)timeScale / 1000 + 0.5 );
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetAudioTimeInMsFromTicks
+// Converts an audio timestamp from ticks to milliseconds
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint CMovieProcessorImpl::GetAudioTimeInMsFromTicks(TUint aTimeStampInTicks) const
+{
+
+	TUint timeScale = 0;
+	if(iParser)
+	{
+		timeScale = iParser->iStreamParameters.iAudioTimeScale; 	
+	}
+	if(timeScale == 0)
+	{
+		//means no audio in clip use output audio timescale itself	
+		timeScale = iOutputAudioTimeScale;
+	}
+	VPASSERT(timeScale > 0);
+	return TUint( (TReal)aTimeStampInTicks / (TReal)timeScale * 1000 + 0.5 ); 	
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetAudioTimeInTicksFromMs
+// Converts an audio timestamp from milliseconds to ticks
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint CMovieProcessorImpl::GetAudioTimeInTicksFromMs(TUint aTimeStampInMs) const
+
+{
+	return TUint( (TReal)aTimeStampInMs * (TReal)iOutputAudioTimeScale / 1000.0 + 0.5 ); 
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::WriteVideoFrameToFile
+// Writes a video frame to output 3gp file
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::WriteVideoFrameToFile(TDesC8& aBuf, TInt64 aTimeStampInTicks, 
+                                                TInt /*aDurationInTicks*/, TBool aKeyFrame,
+                                                TBool aCommonTimeScale, TBool aColorTransitionFlag,
+                                                TBool aFromEncoder)
+{    
+
+    //TReal duration = TReal(aDurationInTicks);
+	TBool lessThenZero = false;
+
+	if (iDiskFull)
+        return KErrDiskFull;
+
+    // check available disk space    
+
+    TInt64 freeSpace = 0;
+	TInt error;
+    // get free space on disk
+    TRAP(error, freeSpace = iComposer->DriveFreeSpaceL());
+    if (error != KErrNone)
+        return error;
+
+	// subtract metadata length from free space
+    freeSpace -= TInt64(CurrentMetadataSize());
+
+    if (freeSpace < TInt64(KDiskSafetyLimit))
+    {
+        PRINT((_L("CMovieProcessorImpl::WriteVideoFrameToFile() freeSpace below limit")))        
+        iDiskFull = ETrue;
+        return KErrDiskFull;
+    }
+
+    // check if we are writing the last frames of the previous
+    // clip while doing crossfade / wipe, iFirstFrameOfClip should
+    // be true when writing the first frame of current clip    
+    if ( iCurClipTimeStampList.Count() )        
+    {
+        iFirstFrameOfClip = EFalse;
+        if ( aColorTransitionFlag && !iFirstFrameFlagSet )
+        {            
+            // this frame is the first one of the second clip
+            iFirstFrameOfClip = ETrue;
+            iFirstFrameFlagSet = ETrue;
+        }                
+    }
+
+    TVideoType vt = (TVideoType)iOutputVideoType;
+	// This may be wrong as the files may be of different types so Mp4Specific size may be required to obtained for every file 
+	// or every clip but only if it is the first frame	
+	if (iVideoFrameNumber == 0 || iFirstFrameOfClip)
+	{
+		if (!iNumberOfVideoClips)
+		{
+		    // all clips were either from generator or were black frames
+		    if ( iAllGeneratedClips )
+	        {
+    			iMP4SpecificSize = 0;
+    			if (vt == EVideoMPEG4)
+    			{
+    				iModeChanged = ETrue;
+    				iFirstClipUsesEncoder = ETrue;
+    			}
+	        }
+	        else
+            {
+                // black frames; no parser or decoder exists; 
+                // no need to modify the vos header by the decoder, 
+                // but this forces the composer to search for the VOS header in the 1st frame data
+				iModeChanged = ETrue;
+            }
+    	}
+
+		else
+		{
+	        // VOS header size is parsed in composer for MPEG-4, in H.263 it is ignored
+	        iMP4SpecificSize = 0;
+		}
+	}    
+    
+    // IMPORTANT: need to make decision here whether to change VosBit 
+    // before writing to file, if first frame was encoded
+       
+    if (vt == EVideoMPEG4)
+    {
+        if(iVideoFrameNumber == 0)
+        {
+            if(iMpeg4ModeTranscoded)
+            {
+                TBool sBitChanged = EFalse;
+                TRAP(error, sBitChanged = iVideoProcessor->CheckVosHeaderL((TPtrC8&)aBuf));
+                if(sBitChanged) { }
+                PRINT((_L("CMovieProcessorImpl::WritVideoFrameToFile() bit changed: %d"), sBitChanged))
+                    if (error != KErrNone)
+                        return error;
+            }
+        }
+    }
+    
+    TInt currentMetaDataSize = CurrentMetadataSize();
+    TInt64 oldVideoTime = GetVideoTimeInMsFromTicks((TInt64) iCurrentVideoTimeInTicks, ETrue);
+
+    if (iFrameBuffered)
+    {
+        // write buffered frame to file
+        
+        TInt64 durationMs = GetVideoTimeInMsFromTicks(aTimeStampInTicks, aCommonTimeScale) - iBufferedTimeStamp;        
+
+        if (iWriting1stColorTransitionFrame)
+        {
+            durationMs = i1stColorTransitionFrameTS - iBufferedTimeStamp;    
+            iWriting1stColorTransitionFrame = EFalse;
+        }
+        
+        else if (iFirstFrameOfClip)
+        {            
+            if ( iCurClipTimeStampList.Count() == 0 )
+            {                
+                VPASSERT(iVideoClipNumber > 0);
+                CVedMovieImp* movie = reinterpret_cast<CVedMovieImp*>(iMovie);                                            
+                // first frame of new clip            
+                durationMs = movie->VideoClip(iVideoClipNumber-1)->CutOutTime().Int64()/1000 - iBufferedTimeStamp;
+            }            
+        }
+
+        if (durationMs < 0)
+        {
+			lessThenZero = true;
+            CVedMovieImp* movie = reinterpret_cast<CVedMovieImp*>(iMovie);            
+            TReal frameRate = (movie->VideoFrameRate() > 0.0) ? movie->VideoFrameRate() : 15.0;
+            durationMs =  TInt64( ( 1000.0 / frameRate ) + 0.5 );            
+        }
+
+        if ( iNumberOfVideoClips )
+        {            
+            TInt64 clipDuration = iVideoClip->CutOutTime().Int64()/1000 -
+                                  iVideoClip->CutInTime().Int64()/1000;
+
+            if ( iVideoClipNumber == iNumberOfVideoClips - 1 )
+            {
+                // Add duration of possible black ending frames
+                CVedMovieImp* movie = reinterpret_cast<CVedMovieImp*>(iMovie);
+                clipDuration += ( movie->Duration().Int64()/1000 - 
+                                  movie->VideoClip(iNumberOfVideoClips-1)->EndTime().Int64()/1000 );
+            }
+            
+            if ( iVideoClipWritten + durationMs > clipDuration )
+            {
+                durationMs = clipDuration - iVideoClipWritten;
+                
+                if ( durationMs <= 0 )
+                {
+                    TPtr8 outVideoPtr(iOutVideoBuffer->Des());
+                    outVideoPtr.SetLength(0);
+                    iFrameBuffered = EFalse;
+                    return KErrCompletion;
+                }
+            }
+        }
+        
+        TReal duration = I64REAL(durationMs) * TReal(iOutputVideoTimeScale) / 1000.0;
+        
+        error = WriteVideoFrameFromBuffer(duration, aColorTransitionFlag);
+        
+        if (error != KErrNone)
+            return error;
+    }
+    
+    TInt64 currentVideoTime = GetVideoTimeInMsFromTicks((TInt64) iCurrentVideoTimeInTicks, ETrue);
+    
+    iCurrentVideoSize += aBuf.Length();
+    
+    TInt addAudio = 0;    
+    TRAP( error, addAudio = (iMovie->Song())->GetFrameSizeEstimateL(oldVideoTime * 1000, currentVideoTime * 1000) );
+    
+    if (error != KErrNone)
+        return error;
+    
+    iCurrentAudioSize += addAudio;
+    
+    PRINT((_L("CMovieProcessorImpl::WriteVideoFrameToFile() video size: %d, audio size %d, meta data %d"), iCurrentVideoSize, iCurrentAudioSize, currentMetaDataSize))
+    
+    if (iMovieSizeLimit > 0 && iCurrentVideoSize + iCurrentAudioSize + currentMetaDataSize > iMovieSizeLimit)
+    {
+        // Cut video here
+        iEndCutTime = TTimeIntervalMicroSeconds(currentVideoTime);
+        
+        iMovieSizeLimitExceeded = ETrue;
+    
+        // To notify that movie has reached maximum size
+        return KErrCompletion;
+    }
+
+    // Buffer frame
+
+    VPASSERT(iOutVideoBuffer); 
+    TPtr8 outVideoPtr(iOutVideoBuffer->Des());
+    
+    if((outVideoPtr.Length() + aBuf.Length()) > outVideoPtr.MaxLength()) 
+    {
+        // extend buffer size
+                
+        TUint newSize = outVideoPtr.Length() + aBuf.Length();
+        // round up to the next full kilobyte       
+        newSize = (newSize + 1023) & (~1023);
+        TRAP(error, (iOutVideoBuffer = iOutVideoBuffer->ReAllocL(newSize)) );
+        
+        if (error != KErrNone)
+            return error;
+        
+        PRINT((_L("CMovieProcessorImpl::WriteVideoFrameToFile() - extended buffer to %d bytes"), newSize));
+        
+        outVideoPtr.Set(iOutVideoBuffer->Des());
+    }        
+    outVideoPtr.Append(aBuf);
+    
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+    if (vt == EVideoAVCProfileBaseline)
+    {        
+//        TBool containsDCR = EFalse;
+//        if (!aFromEncoder && iFirstFrameOfClip)
+//            containsDCR = ETrue;
+        
+	    error = iAvcEdit->ParseFrame(iOutVideoBuffer, EFalse, aFromEncoder);
+	    if (error != KErrNone)
+            return error;
+    }
+#endif
+
+    if(!lessThenZero)
+    	{
+    	iBufferedTimeStamp = GetVideoTimeInMsFromTicks(aTimeStampInTicks, aCommonTimeScale);	
+    	}
+    iBufferedKeyFrame = aKeyFrame;
+    iBufferedFromEncoder = aFromEncoder;
+    iFrameBuffered = ETrue;
+    if ( iFirstFrameOfClip )
+        iFirstFrameBuffered = ETrue;
+
+    iFirstFrameOfClip = EFalse;
+
+    iVideoFrameNumber++;
+
+    if (aKeyFrame)
+        iVideoIntraFrameNumber++;	
+
+	return KErrNone;
+
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::FinalizeVideoWrite
+// Writes the last video frame from buffer to file
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::FinalizeVideoWrite()
+{
+
+    if ( !iFrameBuffered )
+        return KErrNone;
+
+    CVedMovieImp* movie = reinterpret_cast<CVedMovieImp*>(iMovie);
+    
+    iApplySlowMotion = EFalse;  // this duration must not be scaled
+    TInt64 durationMs = movie->Duration().Int64()/1000 - GetVideoTimeInMsFromTicks(iCurrentVideoTimeInTicks, ETrue);
+    TReal duration = I64REAL(durationMs) * TReal(iOutputVideoTimeScale) / 1000.0;
+
+    TInt error = WriteVideoFrameFromBuffer(duration, EFalse);
+
+    return error;
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::FinalizeVideoWrite
+// Writes a frame from buffer to file
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::WriteVideoFrameFromBuffer(TReal aDuration, TBool aColorTransitionFlag)
+{
+
+    VPASSERT(iFrameBuffered);
+
+    TReal duration = aDuration;
+
+    // slow motion
+    VPASSERT(iSpeed > 0);			
+    const TInt maxSpeed = KMaxVideoSpeed; 
+    TReal iScaleFactor = (TReal)maxSpeed/(TReal)iSpeed;
+    
+    if( iScaleFactor != 1.0 && iApplySlowMotion )
+    {
+        duration = duration * iScaleFactor;
+    }
+    
+    iCurrentVideoTimeInTicks += duration;
+
+    // if the first frame of a clip is being buffered,
+    // we are now writing the last frame of previous clip
+    // so don't increment iVideoClipWritten yet
+    
+    // Also take into account crossfade / wipe transition
+    // so that iVideoClipWritten is not incremented
+    // for transition frames of the previous clip
+    if ( !iFirstFrameOfClip && ( (iCurClipTimeStampList.Count() == 0) || 
+                                  aColorTransitionFlag ) )
+    {        
+        iVideoClipWritten += GetVideoTimeInMsFromTicks(aDuration, ETrue);        
+    }
+
+    IncProgressBar();
+    
+    TVedVideoBitstreamMode currClipMode;
+    TVideoType vt = (TVideoType)iOutputVideoType;
+    
+    if (iNumberOfVideoClips > 0)
+        currClipMode = iVideoClip->Info()->TranscodeFactor().iStreamType;	
+    else
+    {
+        if ( (vt == EVideoH263Profile0Level10) || (vt == EVideoH263Profile0Level45) )
+            currClipMode = EVedVideoBitstreamModeH263;
+        else
+            currClipMode = EVedVideoBitstreamModeMPEG4Regular;
+    }
+    TPtr8 outVideoPtr(iOutVideoBuffer->Des());
+    
+    TInt returnedVal = 0;
+    returnedVal = iComposer->WriteFrames(outVideoPtr, outVideoPtr.Size(), TInt(duration + 0.5), 
+        iBufferedKeyFrame, 1 /*numberOfFrames*/, 
+        CMP4Composer::EFrameTypeVideo, iMP4SpecificSize, 
+        iModeChanged, iFirstFrameBuffered, currClipMode, iBufferedFromEncoder);	
+
+    iFirstFrameBuffered = EFalse;
+    
+    if (returnedVal == KErrWrite)
+    {
+        // frame was not written
+        iVideoClipWritten -= GetVideoTimeInMsFromTicks(aDuration, ETrue);
+        iCurrentVideoTimeInTicks -= duration;
+        returnedVal = KErrNone;
+    }    
+    
+    iFrameBuffered = EFalse;
+    outVideoPtr.SetLength(0);
+    
+    return returnedVal;    
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::SaveVideoFrameToFile
+// Save a video YUV frame to the tmp file
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::SaveVideoFrameToFile(TDesC8& aBuf, TInt aDuration, TInt64 aTimeStamp )
+{
+    TBool isOpen = EFalse;
+    TInt errCode = KErrNone;
+    if ( ( errCode = iFs.IsFileOpen( iNextClipFileName, isOpen ) ) == KErrNone )
+    {
+        if ( isOpen )
+        {
+            if ( ( errCode = iNextClipDurationList.Append( aDuration ) ) == KErrNone )
+            {
+                if ( ( errCode = iNextClipTimeStampList.Append( aTimeStamp ) ) == KErrNone )
+                {
+                    if ( iDiskFull )
+                    {
+                        errCode = KErrDiskFull;                    
+                    }
+                    else
+                    {
+                        TInt64 freeSpace = 0;
+                        // get free space on disk
+                        TRAP( errCode, freeSpace = iComposer->DriveFreeSpaceL() );
+                        if ( errCode == KErrNone )
+                        {
+                            // subtract yuv length from free space
+                            freeSpace -= TInt64( aBuf.Length() );
+							
+                            if ( freeSpace < TInt64( KDiskSafetyLimit ) )
+                            {
+                                iDiskFull = ETrue;
+                                errCode = KErrDiskFull;
+                            }
+                            else
+                            {
+                                errCode = iNextClip.Write( aBuf );
+                                iPreviousTimeScale = iParser->iStreamParameters.iVideoTimeScale;
+                            }
+                        }
+                    }
+                    if ( errCode != KErrNone )
+                    {
+                        // rollback the insertion
+                        iNextClipDurationList.Remove( iNextClipDurationList.Count() - 1 );
+                        iNextClipTimeStampList.Remove( iNextClipTimeStampList.Count() - 1 );
+                    }
+                }
+                else
+                {
+                    // rollback the insertion
+                    iNextClipDurationList.Remove( iNextClipDurationList.Count() - 1 );
+                }
+            }
+        }
+        else
+        {
+            errCode = KErrNotFound;
+        }
+    }
+    return errCode;
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetVideoFrameFromFile
+// Retrieve a video YUV frame from the tmp file
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::GetVideoFrameFromFile(TDes8& aBuf, TInt aLength, TInt& aDuration, TInt64& aTimeStamp)
+{
+    
+    TBool isOpen = EFalse;
+    TInt errCode = KErrNone;
+    if ( ( errCode = iFs.IsFileOpen( iCurClipFileName, isOpen ) ) == KErrNone )
+    {
+        if ( isOpen )
+        {
+            if ( ( errCode = iCurClip.Read( aBuf, aLength ) ) == KErrNone )
+            {
+                if ( !iTimeStampListScaled )
+                {                
+                    // change timestamps to start from zero
+                    TInt firstTs = iCurClipTimeStampList[0];
+                    for ( TInt index = 0; index < iCurClipTimeStampList.Count(); ++index )       
+                    {
+                        iCurClipTimeStampList[index] = iCurClipTimeStampList[index] - firstTs;
+                    }
+                
+                    iOffsetTimeStamp = iCurClipTimeStampList[iCurClipTimeStampList.Count() - 1] + 
+						iCurClipDurationList[iCurClipDurationList.Count() - 1];
+                    TReal scaleFactor = (TReal)iParser->iStreamParameters.iVideoTimeScale/(TReal)iPreviousTimeScale;
+                    iOffsetTimeStamp = TInt( I64REAL(iOffsetTimeStamp) * scaleFactor + 0.5 );
+					
+                    for ( TInt index = 0; index < iCurClipDurationList.Count(); ++index )
+                    {
+                        // scale up or scale down
+                        iCurClipDurationList[index] = TInt( TReal(iCurClipDurationList[index]) * scaleFactor + 0.5 );
+                        iCurClipTimeStampList[index] = TInt64( I64REAL(iCurClipTimeStampList[index]) * scaleFactor + 0.5 );
+                    }
+                    iTimeStampListScaled = ETrue;
+                }
+                
+                if ( iCurClipIndex < iCurClipDurationList.Count() )
+                {
+                    aDuration = iCurClipDurationList[iCurClipIndex];
+                    aTimeStamp = iCurClipTimeStampList[iCurClipIndex++];
+                }
+                else
+                {
+                    aDuration = -1;
+                    aTimeStamp = -1;
+                }
+                
+            }
+        }
+        else
+        {
+            errCode = KErrNotFound;
+        }
+    }
+    return errCode;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetNextFrameDuration
+// Get the next frame duration and timestamp
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::GetNextFrameDuration(TInt& aDuration, TInt64& aTimeStamp, 
+                                               TInt aIndex, TInt& aTimeStampOffset)
+{
+
+    TInt count = iCurClipTimeStampList.Count();
+    
+    if (!iTimeStampListScaled)
+    {
+        // save the timestamp of first color transition frame, so that the duration of
+        // last frame from first clip is calculated correctly in WriteVideoFrameToFile()        
+        i1stColorTransitionFrameTS = TInt64( I64REAL(iCurClipTimeStampList[0]) / (TReal)iPreviousTimeScale * 1000 + 0.5 );
+        iWriting1stColorTransitionFrame = ETrue;
+    
+        // change timestamps to start from zero
+        TInt firstTs = iCurClipTimeStampList[0];
+        for ( TInt index = 0; index < iCurClipTimeStampList.Count(); ++index )       
+        {
+            iCurClipTimeStampList[index] = iCurClipTimeStampList[index] - firstTs;
+        }
+    
+        iOffsetTimeStamp = iCurClipTimeStampList[iCurClipTimeStampList.Count() - 1] + 
+				 		   iCurClipDurationList[iCurClipDurationList.Count() - 1];
+        TReal scaleFactor = (TReal)iParser->iStreamParameters.iVideoTimeScale/(TReal)iPreviousTimeScale;
+        iOffsetTimeStamp = TInt( I64REAL(iOffsetTimeStamp) * scaleFactor + 0.5 );
+					
+        for ( TInt index = 0; index < iCurClipDurationList.Count(); ++index )
+        {
+            // scale up or scale down
+            iCurClipDurationList[index] = TInt( TReal(iCurClipDurationList[index]) * scaleFactor + 0.5 );
+            iCurClipTimeStampList[index] = TInt64( I64REAL(iCurClipTimeStampList[index]) * scaleFactor + 0.5 );
+        }     
+        iTimeStampListScaled = ETrue;
+    }
+    
+    aTimeStampOffset = iOffsetTimeStamp;
+
+    if (aIndex >= 0)
+    {
+        // just get the values for given index, do not change iCurClipIndex
+        VPASSERT(aIndex < iCurClipDurationList.Count());
+        aDuration = iCurClipDurationList[aIndex];
+        aTimeStamp = iCurClipTimeStampList[aIndex];
+        return;
+    }
+
+    if ( iCurClipIndex < iCurClipDurationList.Count() )
+    {
+        aDuration = iCurClipDurationList[iCurClipIndex];
+        aTimeStamp = iCurClipTimeStampList[iCurClipIndex++];
+    }
+    else
+    {
+        aDuration = 0;
+        aTimeStamp = 0;
+    }
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::AppendNextFrameDuration
+// Append the next frame duration and timestamp
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::AppendNextFrameDuration(TInt aDuration, TInt64 aTimeStamp)
+{
+    if ( iCurClipDurationList.Append( aDuration ) == KErrNone )
+    {
+        if ( iCurClipTimeStampList.Append( aTimeStamp + iOffsetTimeStamp ) != KErrNone )
+        {
+            // rollback the insertion
+            iCurClipDurationList.Remove( iCurClipDurationList.Count() - 1 );
+        }
+    }    
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetNextClipStartTransitionNumber
+// Get the number of transition at the start of next clip
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::NextClipStartTransitionNumber()
+{
+    TInt transitionNumber = 5;
+    if ( iMiddleTransitionEffect == EVedMiddleTransitionEffectCrossfade ||
+         iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeLeftToRight ||
+         iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeRightToLeft ||
+         iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeTopToBottom ||
+         iMiddleTransitionEffect == EVedMiddleTransitionEffectWipeBottomToTop )
+    {
+        TInt nextClipNumber = iVideoClipNumber + 1;
+        CVedMovieImp* movie = (iMovie);
+        CVedVideoClip* videoClip = movie->VideoClip(nextClipNumber);  
+        CVedVideoClip* origVideoClip = iVideoClip;
+
+        TVedMiddleTransitionEffect middleTransitionEffect = EVedMiddleTransitionEffectNone;
+        if ( iMovie->MiddleTransitionEffectCount() > nextClipNumber )
+        {
+            middleTransitionEffect = iMovie->MiddleTransitionEffect( nextClipNumber );
+        }
+
+        TTimeIntervalMicroSeconds startCutTime = videoClip->CutInTime();
+        TTimeIntervalMicroSeconds endCutTime   = videoClip->CutOutTime();
+
+        TInt numberOfFrame = videoClip->Info()->VideoFrameCount();
+
+        // temporary set iVideoClip to next video clip
+        iVideoClip = videoClip;
+
+        TInt startFrameIndex = GetVideoFrameIndex( startCutTime );
+        // the following is because binary search gives us frame with timestamp < startCutTime
+        // this frame would be out of range for  movie
+        if ( startFrameIndex > 0 && startFrameIndex < ( numberOfFrame - 1 ) )
+            startFrameIndex++;
+
+        TInt endFrameIndex = GetVideoFrameIndex( endCutTime );
+
+        // determine the total number of included frames in the clip
+        TInt numberOfIncludedFrames = endFrameIndex - startFrameIndex + 1;
+                        
+        // make sure there are enough frames to apply transition
+        // for transition at both ends
+        if ( middleTransitionEffect != EVedMiddleTransitionEffectNone )
+        {
+            if ( middleTransitionEffect == EVedMiddleTransitionEffectCrossfade ||
+                 middleTransitionEffect == EVedMiddleTransitionEffectWipeLeftToRight ||
+                 middleTransitionEffect == EVedMiddleTransitionEffectWipeRightToLeft ||
+                 middleTransitionEffect == EVedMiddleTransitionEffectWipeTopToBottom ||
+                 middleTransitionEffect == EVedMiddleTransitionEffectWipeBottomToTop )
+            {
+                if ( numberOfIncludedFrames < ( transitionNumber << 1 ) )
+                {
+                    transitionNumber = numberOfIncludedFrames >> 1;
+                }
+            }
+            else
+            {
+                if ( numberOfIncludedFrames < ( transitionNumber + 10 ) )
+                {
+                    if ( ( numberOfIncludedFrames >> 1 ) < transitionNumber )
+                    {
+                        transitionNumber = numberOfIncludedFrames >> 1;
+                    }
+                }
+            }
+        }
+        else 
+        {
+            if ( numberOfIncludedFrames < transitionNumber )
+            {
+                transitionNumber = numberOfIncludedFrames;
+            }
+        }
+        // reset iVideoClip back to the original video clip
+        iVideoClip = origVideoClip;
+    }
+    return transitionNumber;   
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::TransitionDuration
+// Get the transition duration of current clip
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::TransitionDuration()
+{
+    TInt duration = 0;
+    if ( iNextClipDurationList.Count() )
+    {
+        for ( TInt index = 0; index < iNextClipDurationList.Count() /*- 1*/; index++ )
+        {
+            duration += iNextClipDurationList[index];
+        }
+    }
+    return duration;
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::CloseTransitionInfoL
+// Release all internal data hold for transition effect
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::CloseTransitionInfoL()
+{
+    // remove old tmp files
+    if ( iCurClipFileName.Length() )
+    {
+        iCurClip.Close();
+        // it is ok if the tmp file does not exist
+        iFs.Delete( iCurClipFileName );
+        iCurClipFileName.Zero();
+    }
+
+    if ( iNextClipFileName.Length() )
+    {
+        iNextClip.Close();
+        // it is ok if the tmp file does not exist
+        iFs.Delete( iNextClipFileName );
+        iNextClipFileName.Zero();
+    }
+
+    // use file manager to delete all previously
+    // *_nokia_vpi.tmp files
+    CFileMan *fileMan = CFileMan::NewL( iFs );
+    CleanupStack::PushL( fileMan );
+    TParse filepath;
+    filepath.Set( iOutputMovieFileName, NULL, NULL );
+    TFileName filesToDelete = filepath.DriveAndPath();
+    filesToDelete.Append( _L( "*_nokia_vpi.tmp" ) );    
+    fileMan->Delete( filesToDelete );
+    CleanupStack::PopAndDestroy( fileMan );
+
+    iCurClipDurationList.Reset();
+    iNextClipDurationList.Reset();
+    iCurClipTimeStampList.Reset();
+    iNextClipTimeStampList.Reset();
+    iCurClipIndex = 0;
+    iPreviousTimeScale = 0;
+    iOffsetTimeStamp = 0;    
+		
+    // Delete Im_nokia_vpi.tmp
+	TFileName tmpath = TPtrC(KTempFilePath);         
+    tmpath.Append( _L("x.3gp") );
+	
+    // use file manager to delete all previously
+	CFileMan *tempfileMan = CFileMan::NewL( iFs );
+	CleanupStack::PushL( tempfileMan );
+    TParse tempfilepath;
+    tempfilepath.Set(tmpath, NULL, NULL );
+    TFileName tempfilesToDelete = tempfilepath.DriveAndPath();
+    tempfilesToDelete.Append( _L( "Im_nokia_vpi.tmp" ) );
+    tempfileMan->Delete( tempfilesToDelete,0);
+    CleanupStack::PopAndDestroy( tempfileMan );
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetVideoFrameIndex
+// Gets frame index based on its timestamp
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::GetVideoFrameIndex(TTimeIntervalMicroSeconds aTime) const
+{
+	__ASSERT_ALWAYS((aTime >= TTimeIntervalMicroSeconds(0)) /*&& (aTime <= iMovie->Duration())*/, 
+			        TVedPanic::Panic(TVedPanic::EVideoClipInfoIllegalVideoFrameTime));
+
+	/* Use binary search to find the right frame. */
+
+    TInt videoFrameCount;
+    if (!iThumbnailInProgress)
+	    videoFrameCount = iVideoClip->Info()->VideoFrameCount();
+	else
+	    videoFrameCount = iParser->GetNumberOfVideoFrames();
+	
+	TInt start = 0;
+	TInt end = videoFrameCount - 1;
+	TInt index = -1;
+	while ( start <= end )
+		{
+		index = start + ((end - start) / 2);
+
+		TTimeIntervalMicroSeconds startTime(0);
+		TTimeIntervalMicroSeconds endTime(0);
+				
+	    TInt tsInTicks;
+	    startTime = TTimeIntervalMicroSeconds( TInt64(iParser->GetVideoFrameStartTime(index, &tsInTicks)) * TInt64(1000) );
+	    
+	    if (index < (videoFrameCount - 1))
+	        endTime = TTimeIntervalMicroSeconds( TInt64(iParser->GetVideoFrameStartTime(index + 1, &tsInTicks)) * TInt64(1000) );
+	    else
+	    {
+	       TInt durationMs;   
+	       iParser->GetVideoDuration(durationMs);		       
+	       endTime = TTimeIntervalMicroSeconds( TInt64(durationMs) * TInt64(1000) );
+	    }	
+		
+		if (index < (videoFrameCount - 1))
+			{
+			endTime = TTimeIntervalMicroSeconds(endTime.Int64() - 1);
+			}
+
+		if (aTime < startTime)
+			{
+			end = index - 1;
+			}
+		else if (aTime > endTime)
+			{
+			start = index + 1;
+			}
+		else
+			{
+			break;
+			}
+		}
+
+	return index;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::EnhanceThumbnailL
+// Enhances the visual quality of the frame
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::EnhanceThumbnailL(const CFbsBitmap* aInBitmap, 
+																						CFbsBitmap* aTargetBitmap) 
+{
+
+  // create enhancement object
+	if(!iEnhancer)
+    iEnhancer = (CDisplayChain*) CDisplayChain::NewL();
+
+	// enhance image
+	iEnhancer->ProcessL(aInBitmap, aTargetBitmap); 
+
+	// clear enhancement object
+	delete iEnhancer;
+	iEnhancer=0;
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::NotifyVideoClipGeneratorFrameCompleted
+// The cal back functin called when a frame is to be obtained from the frame generator
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::NotifyVideoClipGeneratorFrameCompleted(CVedVideoClipGenerator& /*aGenerator*/, 
+                                                                 TInt aError, 
+                                                                 CFbsBitmap* aFrame)
+{
+
+    if (iProcessingCancelled)
+    {
+        if (aFrame)
+        {
+            delete aFrame; aFrame = 0;
+        }
+        return;
+    }
+
+	if(aError == KErrNone)
+	{	
+		CFbsBitmap* aBitmapLocal = aFrame;
+
+        if (aFrame == 0)
+        {
+            iMonitor->Error(KErrArgument);
+            return;
+        }
+
+        VPASSERT(aFrame);
+        TInt error;
+
+		// Convert the frame obtained from bitmap to YUV before giving it to encoder only if error is not there
+		TRAP(error, iImageYuvConverter = CVSFbsBitmapYUV420Converter::NewL(*aBitmapLocal));
+        if (error != KErrNone)
+        {
+            delete aFrame; aFrame = 0;	// removed the frame obtained from engine                        
+            iMonitor->Error(error);
+            return;
+        }
+
+		VPASSERT(iImageYuvConverter);		
+
+		TRAP(error, iImageYuvConverter->ProcessL());
+        if (error != KErrNone)
+        {            
+            delete aFrame; aFrame = 0;	// removed the frame obtained from engine                                    
+            iMonitor->Error(error);
+            return;
+        }
+
+		TRAP(error, iYuvImageBuf = (TUint8*) (TUint8*) HBufC::NewL((iImageYuvConverter->YUVData()).Length()));
+		if(error != KErrNone)
+		{
+            delete aFrame; aFrame = 0;	// removed the frame obtained from engine                       
+            iMonitor->Error(error);
+            return;			
+		}
+		iImageSize = (iImageYuvConverter->YUVData()).Length();
+		Mem::Copy(iYuvImageBuf,(iImageYuvConverter->YUVData()).Ptr(),(iImageYuvConverter->YUVData()).Length());	// may be iYUVBuf only	
+		iReadImageDes.Set(iYuvImageBuf,iImageSize, iImageSize);
+				
+		delete iImageYuvConverter;
+		iImageYuvConverter = 0;
+		
+		aBitmapLocal = 0;
+		if(aFrame)
+		{
+			delete aFrame;		// removed the frame obtained from engine
+			aFrame = 0;
+		}
+		aBitmapLocal = 0;
+		
+		// finished converting to YUV 
+		TRAP(error, ProcessImageSetsL(EVideoEncodeFrame)); // EVideoEncodeFrame indicates to encoder to encode and return later
+        if(error != KErrNone)
+		{            
+            iMonitor->Error(error);
+            return;			
+		}
+	}
+	else
+	{
+		if(aError == KErrCancel)
+		{
+			if(aFrame)
+			{
+				delete aFrame;
+				aFrame =0;
+			}						
+			
+			if(iImageComposer)
+			{
+				iImageComposer->Close();
+				delete iImageComposer;						
+				iImageComposer=0;
+			}
+			
+			if (iImageAvcEdit)
+        	{
+        	    delete iImageAvcEdit;
+        	    iImageAvcEdit = 0;
+        	}
+		}
+		else
+		{
+			iMonitor->Error(aError);
+		}
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetOutputVideoType			
+// This function returns the video type of output movie
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TVedVideoType CMovieProcessorImpl::GetOutputVideoType()
+{
+
+	if (iOutputVideoType == EVideoH263Profile0Level10)
+		return EVedVideoTypeH263Profile0Level10;
+
+	if (iOutputVideoType == EVideoH263Profile0Level45)
+		return EVedVideoTypeH263Profile0Level45;
+	
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+    if (iOutputVideoType == EVideoAVCProfileBaseline)
+		return EVedVideoTypeAVCBaselineProfile;
+#endif
+
+	if (iOutputVideoType == EVideoMPEG4)
+		return EVedVideoTypeMPEG4SimpleProfile;
+
+	return EVedVideoTypeNoVideo;
+
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetCurrentClipVideoType
+// This function returns the video type of the current video clip 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TVedVideoType CMovieProcessorImpl::GetCurrentClipVideoType()
+{
+
+    if (!iThumbnailInProgress)
+    {
+        
+        CVedMovieImp* movie = reinterpret_cast<CVedMovieImp*>(iMovie);
+
+        CVedVideoClip* currentClip = movie->VideoClip(iVideoClipNumber);
+        CVedVideoClipInfo* currentInfo = currentClip->Info();
+
+        if (currentInfo->Class() == EVedVideoClipClassGenerated)
+        {
+            switch (iOutputVideoType)
+            {
+            	case EVideoH263Profile0Level10:
+            	    return EVedVideoTypeH263Profile0Level10;
+//            	    break;
+            	    
+            	case EVideoH263Profile0Level45:
+            	    return EVedVideoTypeH263Profile0Level45;
+//            	    break;
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING            	    
+                case EVideoAVCProfileBaseline:
+    		        return EVedVideoTypeAVCBaselineProfile;
+//    		        break;
+#endif
+            	    
+            	case EVideoMPEG4:
+            	    return EVedVideoTypeMPEG4SimpleProfile;
+//            	    break;
+            	    
+            	default:
+            	    return EVedVideoTypeUnrecognized;
+            }
+        }        
+        return currentInfo->VideoType();  
+    }
+    
+    switch (iParser->iStreamParameters.iVideoFormat)
+    {
+    
+        case CParser::EVideoFormatH263Profile0Level10:
+            return EVedVideoTypeH263Profile0Level10;
+//            break;
+            
+        case CParser::EVideoFormatH263Profile0Level45:
+            return EVedVideoTypeH263Profile0Level45;
+//            break;
+            
+        case CParser::EVideoFormatMPEG4:
+            return EVedVideoTypeMPEG4SimpleProfile;
+//            break;
+                
+        case CParser::EVideoFormatAVCProfileBaseline:
+            return EVedVideoTypeAVCBaselineProfile;
+//            break;
+            
+        default:
+            return EVedVideoTypeUnrecognized;            
+    }
+}
+
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetVideoClipTranscodeFactor	Added for transcoding reqs
+// This function returns the mode of the clip indicated by the location aNum
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TVedTranscodeFactor CMovieProcessorImpl::GetVideoClipTranscodeFactor(TInt aNum)
+{
+	CVedVideoClipInfo* curInfo = NULL;
+
+	if(iMovie)
+	{
+		CVedMovieImp* tmovie = (iMovie);
+		CVedVideoClip* currentClip = tmovie->VideoClip(aNum);
+		CVedVideoClipInfo* currentInfo = currentClip->Info();
+		curInfo = currentInfo;
+	}
+	else
+	{
+		// this means there is no movie, which can happen in case of thumb generation as processor does not have it
+		User::Panic(_L("CMovieProcessorImpl MoviePtr is Missing in VideoProcessor"), -1);
+	}
+	
+	return curInfo->TranscodeFactor();
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetVideoClipResolution
+// Panics the program on error
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TSize CMovieProcessorImpl::GetVideoClipResolution()
+{
+	return iVideoClip->Info()->Resolution();
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetMovieResolution
+// Gets target movie resolution
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TSize CMovieProcessorImpl::GetMovieResolution()
+{
+	if(iMovie)
+	{
+		return iMovie->Resolution();
+	}
+	else
+	{
+		TSize stdres(KVedMaxVideoWidth, KVedMaxVideoHeight);
+		return stdres;
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetVideoClipFrameRate
+// Gets video frame rate of current clip
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TReal CMovieProcessorImpl::GetVideoClipFrameRate()
+    {
+
+    TReal rate;
+    iParser->GetVideoFrameRate(rate);
+
+    return rate;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetMovieFrameRate
+// Gets target movie frame rate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TReal CMovieProcessorImpl::GetMovieFrameRate()
+    {
+    return iMovie->VideoFrameRate();
+    }
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetMovieVideoBitrate
+// Gets target movie video bit rate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::GetMovieVideoBitrate()
+    {
+    return iMovie->VideoBitrate();
+    }
+  
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetMovieVideoBitrate
+// Gets standard movie video bit rate (mandated by standard for used video codec)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+TInt CMovieProcessorImpl::GetMovieStandardVideoBitrate()    
+    {   
+     return iMovie->VideoStandardBitrate();
+    }
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetMovieAudioBitrate
+// Gets target movie audio bit rate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::GetMovieAudioBitrate()
+    {
+    return iMovie->AudioBitrate();
+    }
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetSyncIntervalInPicture
+// Gets sync interval in picture
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::GetSyncIntervalInPicture()
+    {
+    if ( iMovie )
+        {
+        return iMovie->SyncIntervalInPicture();
+        }
+    else
+        {
+        return 0;
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetRandomAccessRate
+// Get random access rate setting
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TReal CMovieProcessorImpl::GetRandomAccessRate()
+    {
+    if ( iMovie )
+        {
+        return iMovie->RandomAccessRate();
+        }
+    else
+        {
+        return 0.2;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetOutputAudioType()			Added for AAC support
+// This function returns the audio type of the final movie which will be created
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TVedAudioType CMovieProcessorImpl::GetOutputAudioType()	//added for AAC support
+{
+	return DecideAudioType(iOutputAudioType);
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::DecideAudioType(TAudioType aAudioType)			added for AAC support
+// This function returns the audio type depending on the parameter sent
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TVedAudioType CMovieProcessorImpl::DecideAudioType(TAudioType aAudioType)	//added for AAC support
+{	
+	if( aAudioType == (TAudioType)EAudioAMR)
+	{
+		return EVedAudioTypeAMR;
+	}
+	else if(aAudioType == (TAudioType)EAudioAAC)
+	{
+		// changed EVedAudioTypeAAC_LC --> EVedAudioTypeAAC_LC --Sami
+		return EVedAudioTypeAAC_LC;
+	}
+	else if(aAudioType == (TAudioType)EAudioNone)
+	{
+		return EVedAudioTypeNoAudio;
+	}
+	else
+	{
+		return EVedAudioTypeUnrecognized;
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::SetMovieSizeLimit
+// Sets the maximum size for the movie
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMovieProcessorImpl::SetMovieSizeLimit(TInt aLimit)
+{
+    // reserve 2000 bytes for safety margin, since size is checked after a video frame is written to file.
+    iMovieSizeLimit = (aLimit - 2000 > 0) ? aLimit - 2000 : 0;
+}
+
+
+//==================================
+// color tone RGB TO YUV Function
+//==================================
+
+void CMovieProcessorImpl::ConvertColorToneRGBToYUV(TVedColorEffect aColorEffect,TRgb aColorToneRgb)
+{
+	TInt uVal, vVal; // to get the U,V Values of the ColorTone
+	
+	CVedVideoClipInfo* currentInfo = iVideoClip->Info();
+	TVedVideoBitstreamMode streamMode = currentInfo->TranscodeFactor().iStreamType;
+
+	// evaluate the u,v values for color toning
+	if (aColorEffect == EVedColorEffectToning)						
+	{
+		uVal = TInt(-(0.16875*aColorToneRgb.Red()) - (0.33126*aColorToneRgb.Green()) + (0.5*aColorToneRgb.Blue()) + 0.5);
+		vVal = TInt((0.5*aColorToneRgb.Red()) - (0.41869*aColorToneRgb.Green()) - (0.08131*aColorToneRgb.Blue()) + 0.5);
+	}
+	
+	// adjust the u,v values for h.263 and mpeg-4
+	if(iOutputVideoType == EVideoH263Profile0Level10 || iOutputVideoType == EVideoH263Profile0Level45 || (!(iOutputVideoType == EVideoMPEG4) && streamMode == EVedVideoBitstreamModeMPEG4ShortHeader))
+	{
+		if(aColorEffect == EVedColorEffectBlackAndWhite)
+		{
+			uVal = 255;  // codeword for value=128
+			vVal = 255;  // codeword for value=128
+		}
+		else if (aColorEffect == EVedColorEffectToning)
+		{
+			uVal += 128;
+			vVal += 128;
+			
+			AdjustH263UV(uVal);
+			AdjustH263UV(vVal);
+		}
+	}
+	else if (iOutputVideoType == EVideoMPEG4)
+	{
+		if(aColorEffect == EVedColorEffectBlackAndWhite)
+		{
+			uVal = 0;  // codeword for value=128
+			vVal = 0;  // codeword for value=128
+		}
+		else if (aColorEffect == EVedColorEffectToning)
+		{
+			uVal /= 2;	// do not use bit shift; may have negative values
+			vVal /= 2;	// do not use bit shift; may have negative values
+		}
+	}
+	
+	iColorToneU = uVal;
+	iColorToneV = vVal;
+//	iMovie->VideoClipSetColorTone(0, iColorToneYUV);
+
+}
+
+//=======================================
+// CMovieProcessorImpl::AdjustH263UV()
+// Adjusts the UV values for Color Toning
+//=======================================
+void CMovieProcessorImpl::AdjustH263UV(TInt& aValue)
+{
+	if(aValue == 0) 			// end points are not used
+	{ 
+		aValue = 1; 
+	}
+	else if (aValue == 128) // not used
+	{ 
+		aValue = 255; 
+	}  
+	else if (aValue >= 255) // end points are not used
+	{ 
+		aValue = 254; 
+	}
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetOutputVideoMimeType
+// Return Mime type for output video codec
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TPtrC8& CMovieProcessorImpl::GetOutputVideoMimeType()
+{
+    VPASSERT(iMovie);
+ 
+    return iMovie->VideoCodecMimeType();    
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::GetOutputAVCLevel
+// Get output AVC level
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::GetOutputAVCLevel()
+{
+
+    VPASSERT( iOutputVideoType == EVideoAVCProfileBaseline );
+ 
+    const TPtrC8& mimeType = iMovie->VideoCodecMimeType();
+
+    if ( mimeType.MatchF( _L8("*profile-level-id=42800A*") ) != KErrNotFound )
+    {
+        // baseline profile level 1    	
+        return 10;
+    }      
+                      
+    else if ( mimeType.MatchF( _L8("*profile-level-id=42900B*") ) != KErrNotFound )
+    {
+        // baseline profile level 1b    	
+        return 101;  // internal constant for level 1b
+    }
+        
+    else if ( mimeType.MatchF( _L8("*profile-level-id=42800B*") ) != KErrNotFound )
+    {
+        // baseline profile level 1.1    
+        return 11;
+    }
+        
+    else if ( mimeType.MatchF( _L8("*profile-level-id=42800C*") ) != KErrNotFound )
+    {
+        // baseline profile level 1.2    
+        return 12;
+    }
+    //WVGA task
+    else if ( mimeType.MatchF( _L8("*profile-level-id=42800D*") ) != KErrNotFound )
+    {
+        // baseline profile level 1.3    
+        return 13;
+    } 
+    else if ( mimeType.MatchF( _L8("*profile-level-id=428014*") ) != KErrNotFound )
+    {
+        // baseline profile level 2    
+        return 20;
+    } 
+    else if ( mimeType.MatchF( _L8("*profile-level-id=428015*") ) != KErrNotFound )
+    {
+        // baseline profile level 2.1    
+        return 21;
+    } 
+    else if ( mimeType.MatchF( _L8("*profile-level-id=428016*") ) != KErrNotFound )
+    {
+        // baseline profile level 2.2    
+        return 22;
+    }
+    else if ( mimeType.MatchF( _L8("*profile-level-id=42801E*") ) != KErrNotFound )
+    {
+        // baseline profile level 3    
+        return 30;
+    } 
+    else if ( mimeType.MatchF( _L8("*profile-level-id=42801F*") ) != KErrNotFound )
+    {
+        // baseline profile level 3.1    
+        return 31;
+    } 
+    
+    else if ( mimeType.MatchF( _L8("*profile-level-id=*") ) != KErrNotFound )
+    {
+        // no other profile-level ids supported
+        User::Panic(_L("CMovieProcessorImpl"), EInvalidInternalState);        
+    }
+    
+    else
+    {
+        // Default is level 1 (?)
+        return 10;
+    }
+    return 10;
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::SuspendProcessing
+// Suspends processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::SuspendProcessing()
+{
+
+    PRINT((_L("CMovieProcessorImpl::SuspendProcessing()")));
+
+    iDemux->Stop();
+    
+    return KErrNone;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::ResumeProcessing
+// Resumes processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMovieProcessorImpl::ResumeProcessing(TInt& aStartFrameIndex, TInt aFrameNumber)
+{
+
+    PRINT((_L("CMovieProcessorImpl::ResumeProcessing(), frame number = %d"), aFrameNumber));
+    PRINT((_L("CMovieProcessorImpl::ResumeProcessing(), start index = %d"),  iStartFrameIndex ));
+
+    // get index of last written frame
+    TInt index = iStartFrameIndex + aFrameNumber;
+
+    PRINT((_L("CMovieProcessorImpl::ResumeProcessing(), index is %d"), index));
+
+    TInt ticks;    
+    // get start time for next frame
+    TInt time = iParser->GetVideoFrameStartTime(index + 1, &ticks);
+    if ( time < 0 )
+        {
+        // time represents an error code from parser
+        PRINT((_L("CMovieProcessorImpl::ResumeProcessing(), error from iParser %d"), time));
+        return time;
+        }
+
+    PRINT((_L("CMovieProcessorImpl::ResumeProcessing(), start frame time = %d ms"), time));
+    iStartCutTime =	TTimeIntervalMicroSeconds(TInt64(time) * TInt64(1000));    
+    
+    // reset parser variables 
+    iParser->Reset();        
+ 
+    // seek to Intra from where to start decoding to resume processing
+    TInt error = iParser->SeekOptimalIntraFrame(iStartCutTime, 0, EFalse);
+    
+    if (error != KErrNone)
+       return error;
+    
+    aStartFrameIndex = iParser->GetStartFrameIndex();
+    
+    PRINT((_L("CMovieProcessorImpl::ResumeProcessing(), aStartFrameIndex = %d"), aStartFrameIndex));
+    
+    // iStartFrameIndex contains the index of the first included
+    // frame, which is != 0 in case the clip is cut from beginning        
+    aStartFrameIndex -= iStartFrameIndex;
+    
+    PRINT((_L("CMovieProcessorImpl::ResumeProcessing(), aStartFrameIndex = %d"), aStartFrameIndex));        
+        
+    iVideoQueue->ResetStreamEnd();
+    iDemux->Start();
+    
+    return KErrNone;   
+}
+
+// -----------------------------------------------------------------------------
+// CMovieProcessorImpl::NeedTranscoderAnyMore
+// Check if all video is processed already
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CMovieProcessorImpl::NeedTranscoderAnyMore()
+    {
+    PRINT((_L("CMovieProcessorImpl::NeedTranscoderAnyMore()")));
+    if ( iAllVideoProcessed )
+        {
+        PRINT((_L("CMovieProcessorImpl::NeedTranscoderAnyMore() EFalse")));
+        return EFalse;
+        }
+    else
+        {
+        PRINT((_L("CMovieProcessorImpl::NeedTranscoderAnyMore() ETrue")));
+        return ETrue;
+        }
+        
+    
+    }
+    
+
+//  OTHER EXPORTED FUNCTIONS
+
+
+//=============================================================================
+
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/mp4composer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,796 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+//FC Based on Cmp4parser
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include "mp4composer.h"
+#include "vedvideosettings.h"
+#include "vedavcedit.h"
+
+
+// ASSERTIONS
+//#define MPASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CVideoProcessorImpl"), EInternalAssertionFailure))
+
+
+// MACROS
+//#define ?macro ?macro_def
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+
+const TUint KFreeDiskSpaceCounter = 10;        // Interval when to find out real free disk space
+const TUint KMaxComposeBufferSize = 512000;    // : Adjust buffer size dynamically
+
+#ifdef _DEBUG
+const TInt KLeaveCode = CComposer::EComposerFailure;
+#else
+const TInt KLeaveCode = KErrGeneral;
+#endif
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RateIndex: converts sample rate to rate index used in decoder config info
+// -----------------------------------------------------------------------------
+//
+static TUint8 RateIndex(TInt aRate)
+    {
+    switch ( aRate )
+        {
+        case 96000:
+            return 0x0;
+        case 88200:
+            return 0x1;
+        case 64000:
+            return 0x2;
+        case 48000:
+            return 0x3;
+        case 44100:
+            return 0x4;
+        case 32000:
+            return 0x5;
+        case 24000:
+            return 0x6;
+        case 22050:
+            return 0x7;
+        case 16000:
+            return 0x8;
+        case 12000:
+            return 0x9;
+        case 11025:
+            return 0xa;
+        case 8000:
+            return 0xb;
+        case 7350:
+            return 0xc;
+        default:
+            return 0xf;
+        }
+    }
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+
+CMP4Composer::CMP4Composer()
+{
+	iMP4Handle = 0;	
+    iFreeDiskSpace = 0;
+    iFreeDiskSpaceCounter = 0;
+	iFirstWrite = ETrue;
+    iFsOpened = EFalse;
+}
+
+// Two-phased constructor. 
+CMP4Composer* CMP4Composer::NewL(const TDesC &aFileName, 
+                                 CParser::TVideoFormat aVideoFormat, 
+                                 CParser::TAudioFormat aAudioFormat,
+                                 CVedAVCEdit *aAvcEdit)
+{
+	CMP4Composer *self = new (ELeave) CMP4Composer;
+	CleanupStack::PushL(self);
+	self->ConstructL(aFileName, aVideoFormat, aAudioFormat, aAvcEdit);
+	CleanupStack::Pop();  // self 
+	return self;
+}
+
+CMP4Composer* CMP4Composer::NewL(RFile* aFileHandle, 
+                                 CParser::TVideoFormat aVideoFormat, 
+                                 CParser::TAudioFormat aAudioFormat,
+                                 CVedAVCEdit *aAvcEdit)
+{
+	CMP4Composer *self = new (ELeave) CMP4Composer;
+	CleanupStack::PushL(self);
+	self->ConstructL(aFileHandle, aVideoFormat, aAudioFormat, aAvcEdit);
+	CleanupStack::Pop();  // self 
+	return self;
+}
+
+// Symbian OS default constructor can leave.
+void CMP4Composer::ConstructL(const TDesC &aFileName,
+							  CParser::TVideoFormat aVideoFormat, 
+                              CParser::TAudioFormat aAudioFormat,
+                              CVedAVCEdit *aAvcEdit)
+{
+	TUint mediaType = 0;	
+	
+    iOutputMovieFileName = TFileName(aFileName);
+    iFileHandle = NULL;
+
+	iAvcEdit = aAvcEdit;
+	
+    // open MP4 library	
+	
+    TBuf<258> temp(aFileName);
+    temp.ZeroTerminate();        
+        
+    MP4FileName name = reinterpret_cast<MP4FileName>( const_cast<TUint16*>(temp.Ptr()) );
+    
+    SetMediaOptions(aVideoFormat, aAudioFormat, mediaType);
+    
+    MP4Err error;
+    
+    // if the filename length is greater 0, then compose to file else buffer
+    if(aFileName.Length() > 0)   
+    {
+        error = MP4ComposeOpen(&iMP4Handle, name, mediaType);		
+    }
+    else
+    {								
+        // initialize to compose to buffer
+        iComposeBuffer = (TUint8*)HBufC::NewL( KMaxComposeBufferSize );
+        iComposedSize = KMaxComposeBufferSize;
+        error = MP4ComposeOpenToBuffer(&iMP4Handle, mediaType,(mp4_u8*)iComposeBuffer,&iComposedSize);
+    }
+    
+    if ( error != MP4_OK )
+        User::Leave(KLeaveCode);
+    
+    SetComposerOptionsL(aVideoFormat, aAudioFormat);
+    
+}
+
+void CMP4Composer::ConstructL(RFile* aFileHandle,
+							  CParser::TVideoFormat aVideoFormat, 
+                              CParser::TAudioFormat aAudioFormat,
+                              CVedAVCEdit *aAvcEdit)
+{
+	TUint mediaType = 0;	
+	
+	iOutputMovieFileName.Zero();
+    iFileHandle = aFileHandle;
+
+	iAvcEdit = aAvcEdit;
+	    	        
+    SetMediaOptions(aVideoFormat, aAudioFormat, mediaType);
+    
+    // open MP4 library	    
+    MP4Err error;
+
+    error = MP4ComposeOpenFileHandle(&iMP4Handle, aFileHandle, EDriveC, mediaType);
+
+    if ( error != MP4_OK )
+        User::Leave(KLeaveCode);
+    
+    SetComposerOptionsL(aVideoFormat, aAudioFormat);
+    
+}
+
+
+void CMP4Composer::SetMediaOptions(CParser::TVideoFormat aVideoFormat, 
+                                   CParser::TAudioFormat aAudioFormat,
+                                   TUint& aMediaFlags)
+                                 
+{
+
+	if ( (aVideoFormat == CParser::EVideoFormatH263Profile0Level10) ||  
+		 (aVideoFormat == CParser::EVideoFormatH263Profile0Level45) )
+	{
+		aMediaFlags = MP4_TYPE_H263_PROFILE_0;
+		iVideoType = MP4_TYPE_H263_PROFILE_0;    
+	}
+	
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+	else if (aVideoFormat == CParser::EVideoFormatAVCProfileBaseline)
+	{
+		aMediaFlags = MP4_TYPE_AVC_PROFILE_BASELINE;
+		iVideoType = MP4_TYPE_AVC_PROFILE_BASELINE;    
+	}
+#endif
+	else
+	{
+		aMediaFlags = MP4_TYPE_MPEG4_VIDEO;
+		iVideoType = MP4_TYPE_MPEG4_VIDEO;
+	}
+
+    if ( aAudioFormat == CParser::EAudioFormatAMR )
+	{
+		aMediaFlags |= MP4_TYPE_AMR_NB;
+		iAudioType = MP4_TYPE_AMR_NB;
+	}
+
+	else if ( aAudioFormat == CParser::EAudioFormatAAC )
+	{
+		aMediaFlags |= MP4_TYPE_MPEG4_AUDIO;   // added for AAC support. 
+		iAudioType = MP4_TYPE_MPEG4_AUDIO;
+	}
+	
+}
+
+void CMP4Composer::SetComposerOptionsL(CParser::TVideoFormat aVideoFormat,
+                                       CParser::TAudioFormat aAudioFormat)
+{
+
+    MP4Err error;
+
+    TBool videoMpeg4OrAvc = ( aVideoFormat == CParser::EVideoFormatMPEG4 ||
+                              aVideoFormat == CParser::EVideoFormatAVCProfileBaseline );
+
+    mp4_u32 flags = 0;
+    flags |= MP4_FLAG_LARGEFILEBUFFER;  // Note: What does this do when using RFile ?
+	flags |= MP4_FLAG_METADATALAST;	
+    
+	// generate MP4 file format if MPEG-4/AVC video & AAC audio
+	if ( (videoMpeg4OrAvc && aAudioFormat == CParser::EAudioFormatAAC) ||
+		 (videoMpeg4OrAvc && aAudioFormat == CParser::EAudioFormatNone) ||
+		 (aVideoFormat == CParser::EVideoFormatNone && aAudioFormat == CParser::EAudioFormatAAC) )
+	{
+		flags |= MP4_FLAG_GENERATE_MP4;
+	}
+    	 
+    error = MP4ComposeSetFlags(iMP4Handle, flags);
+    
+    if (error != MP4_OK)
+    	if (error == MP4_OUT_OF_MEMORY)
+    		{
+				User::LeaveNoMemory();
+    		}
+    	else
+    		{
+        User::Leave(KLeaveCode);
+    		}
+
+    // set buffer sizes; only composer buffer settings are effective for this instance
+    error = MP4SetCustomFileBufferSizes(iMP4Handle, K3gpMp4ComposerWriteBufferSize, K3gpMp4ComposerNrOfWriteBuffers, K3gpMp4ParserReadBufferSize );
+
+    if (error == MP4_OUT_OF_MEMORY)
+    {
+        User::Leave(KErrNoMemory);
+    }
+    else if ( error != MP4_OK )
+    {
+        User::Leave(KLeaveCode);
+    }
+}
+
+
+// Destructor
+CMP4Composer::~CMP4Composer()
+{
+    if (iMP4Handle)
+    {
+        MP4ComposeClose(iMP4Handle);
+    }
+
+	if(iComposeBuffer)			// added for Buffer support
+	{
+		User::Free(iComposeBuffer);
+		iComposeBuffer=0;
+	}
+
+    iMP4Handle = 0;
+
+    if (iFsOpened) 
+    {        
+        iFS.Close();
+        iFsOpened = EFalse;        
+    }    
+	
+
+}
+
+// ---------------------------------------------------------
+// CMP4Composer::WriteFrames
+// Write the next frame(s) to file
+// ---------------------------------------------------------
+//
+TInt CMP4Composer::WriteFrames(TDesC8& aSrcBuffer, TInt aFrameSize,
+							   TInt aDuration, TInt aKeyFrame, 
+							   TInt aNumberOfFrames, TInt aFrameType)
+{
+	MP4Err error = KErrNone;
+	
+	// get the parameters 
+	TUint32	frameSize = aFrameSize;
+	TUint32	duration = aDuration;
+	mp4_bool keyframe = (mp4_bool)aKeyFrame; 
+	TInt numberOfFrames = aNumberOfFrames; 
+	TFrameType	frameType = (aFrameType>0 ? (aFrameType==1 ? EFrameTypeAudio : EFrameTypeVideo) 
+        : EFrameTypeNone); 
+    
+    if (frameType == EFrameTypeVideo)
+    {            
+        error = MP4ComposeWriteVideoFrame(iMP4Handle, (mp4_u8*)(aSrcBuffer.Ptr()),
+            frameSize, duration, keyframe);
+        if ( error != MP4_OK )
+            return KLeaveCode;		
+    }
+    
+    else if (frameType == EFrameTypeAudio)
+    {
+        error = MP4ComposeWriteAudioFrames(iMP4Handle,(mp4_u8*)(aSrcBuffer.Ptr()),
+            frameSize, numberOfFrames, duration);
+        if ( error != MP4_OK )
+            return KLeaveCode;		
+    }
+    else 
+        User::Panic(_L("CMovieProcessorImpl"), EComposerFailure);
+    
+    return KErrNone;
+		
+}
+
+
+TInt CMP4Composer::WriteFrames(TDesC8& aSrcBuffer, TInt aFrameSize,
+							   TInt aDuration, TInt aKeyFrame, 
+							   TInt aNumberOfFrames, TInt aFrameType,
+                               TInt& aMP4Size, TBool aModeChanged,
+							   TBool aFirstFrameOfClip, TInt aMode, TBool /*aFromEncoder*/)
+{
+	MP4Err error = KErrNone;
+	
+	// get the parameters 
+	TUint32	frameSize = aFrameSize;
+	TUint32	duration = aDuration;
+	mp4_bool keyframe = ( aKeyFrame ) ? ETrue : EFalse;
+	TInt numberOfFrames = aNumberOfFrames; 
+	TFrameType	frameType = (aFrameType > 0 ? (aFrameType == 1 ? EFrameTypeAudio : EFrameTypeVideo) 
+		: EFrameTypeNone); 
+	TUint8* dataPtr = (TUint8*)(aSrcBuffer.Ptr());
+	TInt tmpSize = 0;
+	
+	// call this only for the first frame of every clip 
+	if ( aFirstFrameOfClip && (iVideoType == MP4_TYPE_MPEG4_VIDEO) && (aMP4Size == 0)) 
+	{
+		if ((tmpSize = GetMp4SpecificSize(aSrcBuffer,aModeChanged,aMode)) != 0)
+			aMP4Size = tmpSize;	//This will be the new Mp4Size as it will be consider and since by reference it is maintained
+	}
+	
+	if (frameType == EFrameTypeVideo)
+	{            
+		if ( iVideoType == MP4_TYPE_MPEG4_VIDEO )
+		{
+			if ( iFirstWrite )
+			{
+				// VOS
+				error = MP4ComposeWriteVideoDecoderSpecificInfo( iMP4Handle,
+					(mp4_u8*)(dataPtr/*aSrcBuffer.Ptr()*/), aMP4Size );
+				iFirstWrite = EFalse;
+				
+				error = MP4ComposeWriteVideoFrame(iMP4Handle, (mp4_u8*)(dataPtr/*aSrcBuffer.Ptr()*/ + aMP4Size),
+					( frameSize - aMP4Size ), duration, keyframe);
+			}
+			else
+			{
+				// for MPEG4 - check the first 32 bits to make sure we don't 
+				// have VOS pre-pended to VOP data
+				if (dataPtr[0] == 0x00 && dataPtr[1] == 0x00 && dataPtr[2] == 0x01 && dataPtr[3] == 0xb0) 
+				{	// since intermediate Vos set to proper value
+					// Not Short Header may have User Data space problem with PSC
+					if ((tmpSize = GetMp4SpecificSize(aSrcBuffer,aModeChanged,aMode)) != 0)
+						aMP4Size = tmpSize;	//This will be the new Mp4Size as it will be considered		
+					dataPtr += aMP4Size;
+					frameSize -= aMP4Size;
+				}
+
+                if (frameSize == 0)
+                    return KErrWrite;
+
+				error = MP4ComposeWriteVideoFrame(iMP4Handle, (mp4_u8*)(dataPtr),
+					frameSize, duration, keyframe);
+			}
+		} 
+		
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+		else if ( iVideoType == MP4_TYPE_AVC_PROFILE_BASELINE )
+		{
+		
+			if ( iFirstWrite || aFirstFrameOfClip)
+			{
+				if(iFirstWrite)
+				{				    
+					iFrameNumber = 0;
+					iFirstWrite = EFalse;
+				}
+				
+				aMP4Size = 0;
+				error = MP4ComposeWriteVideoFrame(iMP4Handle, (mp4_u8*)(dataPtr/*aSrcBuffer.Ptr()*/ + aMP4Size),
+					( frameSize - aMP4Size ), duration, keyframe);
+			}
+			else
+			{
+				error = MP4ComposeWriteVideoFrame(iMP4Handle, (mp4_u8*)(dataPtr),
+					frameSize, duration, keyframe);
+			}
+			
+			iFrameNumber++;
+		}
+#endif
+		
+		else // H.263
+		{
+			error = MP4ComposeWriteVideoFrame(iMP4Handle, (mp4_u8*)(dataPtr/*aSrcBuffer.Ptr()*/),
+				frameSize, duration, keyframe);
+				
+		}
+		if ( error != MP4_OK )
+			return KLeaveCode;		
+	}
+	else if (frameType == EFrameTypeAudio)
+	{
+		error = MP4ComposeWriteAudioFrames(iMP4Handle,(mp4_u8*)(dataPtr/*aSrcBuffer.Ptr()*/),
+			frameSize, numberOfFrames, duration);
+		if ( error != MP4_OK )
+			return KLeaveCode;          
+	}
+	else 
+		User::Panic(_L("CMovieProcessorImpl"), EComposerFailure);
+	
+	return KErrNone;
+}
+
+
+
+// ---------------------------------------------------------
+// CMP4Composer::ComposeHeaderL
+// Get relevant stream parameters by calling mp4 library functions
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+
+void CMP4Composer::ComposeHeaderL(CComposer::TStreamParameters& aStreamParameters, TInt aOutputVideoTimeScale, 
+                                  TInt aOutputAudioTimeScale, TInt aAudioFramesInSample)
+{
+    MP4Err iError=KErrNone;	
+	
+	TInt width = aStreamParameters.iVideoWidth;
+	TInt height = aStreamParameters.iVideoHeight;
+	TInt avgbitrate = aStreamParameters.iStreamBitrate;
+	TInt maxbitrate = avgbitrate; 
+	TInt audioFramesPerSample = aAudioFramesInSample;//aStreamParameters.iAudioFramesInSample;       
+	TInt audioTimescale = aOutputAudioTimeScale;    
+	TInt modeSet=0x8180; 
+
+	if(iAudioType == MP4_TYPE_MPEG4_AUDIO)		// added for AAC support 
+	{	
+		// reset for AAC audio according to the code sent for AAC support.
+		audioFramesPerSample = 0;
+		modeSet = 0;
+	}
+
+	// set this to first clip's time scale 
+	TInt timescale = aOutputVideoTimeScale;
+        
+    iError = MP4ComposeAddAudioDescription(iMP4Handle,(mp4_u32)audioTimescale,
+        (mp4_u8)audioFramesPerSample,(mp4_u16)modeSet); 
+    if (iError != MP4_OK)
+        User::Leave(KLeaveCode);
+		
+    // write video description
+    iError = MP4ComposeAddVideoDescription(iMP4Handle,(mp4_u32)timescale,
+        (mp4_u16)width,(mp4_u16)height,(mp4_u32)maxbitrate,(mp4_u32)avgbitrate);
+    
+    if (iError != MP4_OK)
+        User::Leave(KLeaveCode);
+
+	if ( aStreamParameters.iVideoFormat == EVideoFormatH263Profile0Level10 )
+	{
+		TVideoClipProperties prop;
+		prop.iH263Level = 10;
+		MP4ComposeSetVideoClipProperties(iMP4Handle, prop);
+	}
+
+	else if ( aStreamParameters.iVideoFormat == EVideoFormatH263Profile0Level45 )
+	{
+		TVideoClipProperties prop;
+		prop.iH263Level = 45;
+		MP4ComposeSetVideoClipProperties(iMP4Handle, prop);
+	}
+	
+	if (!iFsOpened) // Check if file server is open already
+        {        
+            User::LeaveIfError(iFS.Connect());        
+            iFsOpened = ETrue;
+        }
+
+    if (iFileHandle == 0)
+    {
+        // get target drive number
+        TParse fp;
+        User::LeaveIfError(iFS.Parse(iOutputMovieFileName, fp));
+        TPtrC driveletter = fp.Drive();
+        TChar drl = driveletter[0];
+        User::LeaveIfError(RFs::CharToDrive(drl, iDriveNumber));
+    } 
+    else
+    {
+        // get target drive number
+        TDriveInfo info;
+        TInt error = iFileHandle->Drive(iDriveNumber, info);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CMP4Composer::DriveFreeSpaceL
+// Calculate free space on a drive in bytes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt64 CMP4Composer::DriveFreeSpaceL()
+{
+    TVolumeInfo volumeinfo;
+
+    if (iFreeDiskSpaceCounter % KFreeDiskSpaceCounter == 0)
+        {
+        User::LeaveIfError(iFS.Volume(volumeinfo, iDriveNumber));
+        iFreeDiskSpace = volumeinfo.iFree;
+        }
+
+    iFreeDiskSpaceCounter++;
+    return iFreeDiskSpace;
+
+}
+
+// -----------------------------------------------------------------------------
+// CMP4Composer::GetComposedBuffer New Function added for Buffer support 
+// Gets the Composed buffer from the composer 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint8* CMP4Composer::GetComposedBuffer()
+{
+	return iComposeBuffer;
+}
+
+// -----------------------------------------------------------------------------
+// CMP4Composer::GetComposedBufferSize New Function added for Buffer support 
+// Gets the Composed buffer size from the composer 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint CMP4Composer::GetComposedBufferSize()
+{
+	return iComposedSize;
+}
+
+// ---------------------------------------------------------
+// CMP4Composer::Close
+// Closes the composer instance & creates the output 3gp file 
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CMP4Composer::Close()
+{
+
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+
+    if (iVideoType == MP4_TYPE_AVC_PROFILE_BASELINE)
+    {
+        HBufC8* AVCDCR = NULL;
+    	TInt error;
+
+    	TRAP(error, AVCDCR = (HBufC8*) HBufC8::NewL(16384));
+    	if (error != KErrNone)
+    	    return error;
+
+        TPtr8 ptr = AVCDCR->Des();    
+        
+        // Construct AVC Decoder Configuration Record from the SPS / PPS sets
+        TRAP(error, iAvcEdit->ConstructAVCDecoderConfigurationRecordL(ptr));
+        if (error != KErrNone)
+        {
+            delete AVCDCR;        
+    	    return error;
+        }                       
+
+    	// Pass the AVC Decoder Configuration Record to the 3GPMP4 library
+    	MP4Err mp4Error = MP4ComposeWriteVideoDecoderSpecificInfo( iMP4Handle,
+    											    (mp4_u8*)(ptr.Ptr()), ptr.Length());    	    	
+
+        delete AVCDCR;
+        
+        if (mp4Error != MP4_OK)
+            return EComposerFailure;
+    }
+    
+#endif
+
+    MP4Err error = MP4ComposeClose(iMP4Handle);
+
+    iMP4Handle = 0;
+
+    if (error != MP4_OK)
+        return EComposerFailure;
+
+    if (iFsOpened) 
+    {        
+        iFS.Close();
+        iFsOpened = EFalse;        
+    }
+    
+    return KErrNone;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMP4Composer::GetMp4SpecificSize
+// Gets the length of MPEG-4 decoder specific info in aSrcBuf
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMP4Composer::GetMp4SpecificSize(TDesC8& aSrcBuf,TBool aModeChange,TInt aStreamMode)
+{
+	TUint8* dtPtr = (TUint8*)(aSrcBuf.Ptr());
+	TInt mp4size =0;
+	TInt bufSize;
+	TInt flag;
+
+	if (!aModeChange && (aStreamMode == 2)) //2 indicates short header in VedCommon
+	{
+		bufSize = aSrcBuf.Size()-3;
+		for(TInt i=0;i<bufSize;i++)
+		{
+			flag = (dtPtr[i+2]>>2)<<2;
+			if (dtPtr[i] == 0x00 && dtPtr[i+1] == 0x00 && flag == 0x80)	// user data ????????????
+			{
+				mp4size=i;
+				break;
+			}
+		}
+	}
+	else
+	{
+		bufSize = aSrcBuf.Size()-4;
+		for(TInt i=0;i<bufSize;i++)
+		{
+			if ((dtPtr[i] == 0x00 && dtPtr[i+1] == 0x00 && dtPtr[i+2] == 0x01 && dtPtr[i+3] == 0xb3) ||
+				(dtPtr[i] == 0x00 && dtPtr[i+1] == 0x00 && dtPtr[i+2] == 0x01 && dtPtr[i+3] == 0xb6))
+			{
+				mp4size=i;
+				break;
+			}
+		}
+	}
+
+	// MP4 specific size will be zero, if there is a GOV or VOP header in the
+	// very beginning of the buffer	
+	
+	return mp4size;
+}
+
+
+// ---------------------------------------------------------
+// CMP4Composer::WriteAudioSpecificInfo
+// Writes the Audio decoder Specific info required in case of AAC
+// Decoder specific info is provided externally
+// (other items were commented in a header).
+// decoder info is provided externally
+// ---------------------------------------------------------
+//
+// added to Support AAC audio files	
+TInt CMP4Composer::WriteAudioSpecificInfo(HBufC8*& aSrcBuf)
+{
+	TInt error = KErrNone;
+	mp4_u8* aSrcB = const_cast<mp4_u8*>(aSrcBuf->Ptr());
+	error = MP4ComposeWriteAudioDecoderSpecificInfo(iMP4Handle, aSrcB, aSrcBuf->Size());
+	
+	if (error != MP4_OK)
+		return KErrGeneral;
+
+	return KErrNone;
+}
+
+// ---------------------------------------------------------
+// CMP4Composer::WriteAudioSpecificInfo
+// Writes the Audio decoder Specific info required in case of AAC
+// Decoder specific info is derived from samplerate and # of channels
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+// added to Support AAC audio files	
+TInt CMP4Composer::WriteAudioSpecificInfo(TInt aSampleRate, TInt aNumChannels)
+{
+	TInt error = KErrNone;
+	
+    TUint8 data[2];
+
+    data[0] = 2<<3; // AAC-LC
+    TUint8 rate = RateIndex(aSampleRate);
+    data[0] |= rate>>1;
+    data[1] = TUint8(rate<<7);
+    data[1] |= TUint8(aNumChannels<<3);
+
+    error = MP4ComposeWriteAudioDecoderSpecificInfo(iMP4Handle, data, 2);
+	
+	if (error != MP4_OK)
+		return KErrGeneral;
+
+	return KErrNone;
+}
+
+
+// -----------------------------------------------------------------------------
+// CMP4Composer::GetAVCDecoderSpecificInfoSize
+// Gets the length of AVC decoder specific info in aSrcBuf
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMP4Composer::GetAVCDecoderSpecificInfoSize(TDesC8& aSrcBuf)
+{
+	TUint8* srcPtr = (TUint8*)(aSrcBuf.Ptr());
+	TInt skip = 0;
+//	TInt error = KErrNone;
+
+	// skip 4 bytes for 
+	// configVersion, profile, profile compatibility and Level
+	skip += 4;
+	
+	// skip 1 bytes for lengthSizeMinusOne
+	skip += 1;
+	
+	// skip 1 bytes for num of seq Param sets
+	TInt numOfSSP = 0x1F & srcPtr[skip];
+	skip += 1;
+	
+	for (TInt i = 0; i < numOfSSP; i++)
+    {
+      	TInt sspSize = srcPtr[skip]*256 + srcPtr[skip+1];      	
+       	skip += 2;
+        skip += sspSize;
+    }
+
+	TInt numOfPSP = srcPtr[skip];
+	skip += 1;
+
+	for (TInt i = 0; i < numOfPSP; i++)
+    {
+      	TInt pspSize = srcPtr[skip]*256 + srcPtr[skip+1];      	
+       	skip += 2;
+        skip += pspSize;
+    }
+
+	return skip;
+}
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/mp4demux.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,748 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation of mp4 demux class.
+*
+*/
+
+
+// INCLUDE FILES
+#include "movieprocessorimpl.h"
+#include "statusmonitor.h"
+#include "activequeue.h"
+#include "dataprocessor.h"
+#include "mp4demux.h"
+#include "mp4parser.h"
+
+// ASSERTIONS
+#define DASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CVideoPlayer"), EInternalAssertionFailure))
+
+//  LOCAL HELPER MACROS
+// Debug printing, define DEBUGPRINT to get output
+//#define DEBUGPRINT
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+//  LOCAL CONSTANTS
+const TUint KAudioReadAheadTimeMs = 100;
+//const TUint KMaxMsInQueue = 600;
+//const TUint KMaxMsInQueue = 300;
+const TUint KMaxBytesPerRun = 4096;
+const TUint KMaxBlocksInQueue = 16;
+
+
+//  MEMBER FUNCTIONS
+
+
+//=============================================================================
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+// ?type ?function_name( ?arg_type, ?arg_type );
+
+// ==================== LOCAL FUNCTIONS ====================
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CMP4Demux::NewL
+// Symbian two-phased constructor.
+// ---------------------------------------------------------
+//
+CMP4Demux* CMP4Demux::NewL(CActiveQueue *anInputQueue,              
+                           TUint aNumChannels, TOutputChannel *aOutputChannels,
+                           TStreamParameters *aParameters,
+                           CStatusMonitor *aStatusMonitor,
+                           CMP4Parser *aParser,                  
+                           TInt aPriority)
+{
+
+    CMP4Demux *self = new (ELeave) CMP4Demux(anInputQueue,              
+                                             aNumChannels, 
+                                             aOutputChannels,
+                                             aParameters,
+                                             aStatusMonitor,
+                                             aParser,
+                                             aPriority);
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+
+}
+
+// ---------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------
+//
+CMP4Demux::CMP4Demux(CActiveQueue *anInputQueue,
+                     TUint aNumChannels, TOutputChannel *aOutputChannels,
+                     TStreamParameters *aParameters,
+                     CStatusMonitor *aStatusMonitor,
+                     CMP4Parser *aParser,                     
+                     TInt aPriority)
+                     : CDemultiplexer(aPriority)
+    {
+    // Remember the objects
+    iInputQueue = anInputQueue;
+    iMonitor = aStatusMonitor;
+    iParser = aParser;    
+
+    iPicturePeriodMs = aParameters->iPicturePeriodMs;
+    iAudioFramesInSample = aParameters->iAudioFramesInSample;    
+
+    // Remember the channels and mux table
+    iNumOutputChannels = aNumChannels;
+    iOutputChannels = aOutputChannels;
+    }
+
+// EPOC default constructor can leave.
+void CMP4Demux::ConstructL()
+    {
+    TUint i;
+    
+    // Set as a reader to the input queue
+    if ( iInputQueue )
+        {
+        iInputQueue->SetReader(this, NULL);
+        iReaderSet = ETrue;
+        }
+    
+    // Set as writer to the output queues
+    for ( i = 0; i < iNumOutputChannels; i++ )
+        iOutputChannels[i].iTargetQueue->SetWriter(this, NULL);
+    iWriterSet = ETrue;
+    
+    // Add us to active scheduler
+    CActiveScheduler::Add(this);
+
+    iBytesDemuxed = 0;
+    iAudioEnd = iVideoEnd = 0;
+    
+    // Open all channels
+    iAudioChannel = 0;
+    iVideoChannel = 0;
+    for ( i = 0; i < iNumOutputChannels; i++ )
+        {
+        TOutputChannel *chan = &iOutputChannels[i];
+        
+        // Check the channel type
+        switch ( chan->iDataType )
+            {
+            case EDataAudio:                
+                
+                if ( !iAudioChannel )
+                    iAudioChannel = chan;
+                break;
+                
+            case EDataVideo:
+                
+                if ( !iVideoChannel )
+                    iVideoChannel = chan;
+                break;
+
+            case EDataNone:
+            default:
+                User::Leave(CMovieProcessorImpl::EUnsupportedFormat);
+            }
+        }     
+
+    // Make us active
+    SetActive();
+    iStatus = KRequestPending;
+    }
+
+// Destructor
+CMP4Demux::~CMP4Demux()
+    {
+
+    // If we are demultiplexing, stop
+    if ( iDemultiplexing )
+        Stop();
+
+    // return input block
+    if ( iInputBlock )
+        {
+        if (iInputQueue)
+            iInputQueue->ReturnBlock(iInputBlock);
+        iInputBlock = 0;
+        }
+     
+    // Remove from being a reader or a writer
+    if ( iReaderSet )
+        {
+        if (iInputQueue)
+            iInputQueue->RemoveReader();
+        }
+
+    if ( iWriterSet )
+        {
+        for ( TUint i = 0; i < iNumOutputChannels; i++ )
+            {
+            if (iOutputChannels[i].iTargetQueue)
+                iOutputChannels[i].iTargetQueue->RemoveWriter();
+            }
+        }
+
+    iMonitor = 0;
+    iInputQueue = 0;
+    iParser = 0;
+    iOutputChannels = 0;
+    iVideoChannel = 0;
+    iAudioChannel = 0;
+        
+    Cancel();
+    
+    }
+
+// ---------------------------------------------------------
+// CMP4Demux::Start
+// Starts demuxing
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+void CMP4Demux::Start()
+    {
+    if ( iDemultiplexing )
+        return;
+    
+    if (!IsActive())
+    {
+        // Make us active
+        SetActive();
+        iStatus = KRequestPending;
+    }
+    
+    // Activate the object if we have data
+    if ( (iStatus == KRequestPending) && (!iInputQueue || iInputQueue->NumDataBlocks()) )
+        {
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+        }
+    
+    iDemultiplexing = ETrue;
+    iAudioEnd = iVideoEnd = iStreamEnd = 0;
+    iStreamEndDemuxed = 0;
+    }
+
+// ---------------------------------------------------------
+// CMP4Demux::Stop
+// Stops demuxing
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+void CMP4Demux::Stop()
+    {
+    iDemultiplexing = EFalse;
+    iGotFrame = EFalse;
+    iFrameType = EDataNone;
+    }
+
+// ---------------------------------------------------------
+// CMP4Demux::RunL
+// Standard active object running method, called when new input data 
+// or free output space has been signaled to be available 
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+void CMP4Demux::RunL()
+    {
+    PRINT((_L("MP4Demux::RunL() in") ));
+
+    // If we have demuxed everything up to stream end, theres is nothing for
+    // us to do
+    if ( iStreamEndDemuxed )
+        return;
+    
+    // Don't do anything if we are not demuxing
+    if ( !iDemultiplexing )
+        {
+        SetActive();
+        iStatus = KRequestPending;
+        return;
+        }
+    
+    // If we don't have a primary channel, we have no open channels and may as
+    // well quit
+    if ( !iAudioChannel && !iVideoChannel )
+        {
+        iMonitor->StreamEndReached();
+        return;
+        }    
+
+    // streaming case:
+    // Try to demux as long as we have a free block in the primary output queue
+    // and we can find more frames 
+    // If we have both video and audio, we'll check the available space only
+    // in the primary audio queue, and the video queue will allocate more
+    // blocks as needed. This way the audio decoder will get more data as
+    // needed, no matter what the video bitrate is.            
+
+    // in file-reading case, GetFrameInfo() checks if there's available space
+    // in queues, and this info is contained in variable iGotFrame       
+
+    // send frame(s) if:
+    // a frame is available AND
+    // there are free blocks in output queue AND
+    // we have not demuxed too much during this run so other objects get CPU AND
+    // the stream end has not been demuxed    
+
+    iBytesDemuxed = 0;
+
+    // NOTE: only video queue fullness checked for now
+    CActiveQueue *queue = iVideoChannel->iTargetQueue;
+
+    TInt error = GetFrameInfo();
+    if (error != KErrNone)
+        return;
+
+    while ( iGotFrame && ( (iInputQueue && NumFreeBlocks() > 0) || 
+          ( (queue->NumDataBlocks() < KMaxBlocksInQueue) && (iBytesDemuxed < KMaxBytesPerRun) ) ) && 
+          (!iStreamEndDemuxed) )
+        {
+        // Read & send frame(s)        
+        TInt error = ReadAndSendFrames();
+        
+        if ( error != KErrNone )
+            {
+            iMonitor->Error(error);
+            return;        
+            }
+        
+        // And to try get info for new frame
+        error = GetFrameInfo();
+        if (error != KErrNone)
+            return;
+        }
+    
+    // If we have demultiplexed everything up to stream end, signal the queues
+    // and don't demux any more. If we have no output channels, notify the
+    // status monitor.
+    if ( iStreamEnd && (!iGotFrame) )
+        {
+        // report stream end in streaming case
+        // in file-reading case, its reported in GetFrameInfo
+        if ( iNumOutputChannels )
+            {
+            if ( iInputQueue )
+                {
+                TUint i;
+                for ( i = 0; i < iNumOutputChannels; i++ )
+                    iOutputChannels[i].iTargetQueue->WriteStreamEnd();
+                }
+            }
+        else
+            {
+            iMonitor->StreamEndReached();
+            }
+        iStreamEndDemuxed = ETrue;
+        return;
+        }
+    
+    // Re-activate to get signals about new blocks
+    SetActive();
+    iStatus = KRequestPending;
+
+    PRINT((_L("MP4Demux::RunL() out") ));
+    }
+
+
+// ---------------------------------------------------------
+// CMP4Demux::StreamEndReached
+// Informs the object that stream end has been reached
+// (when we have an input queue, not used in file-reading case)
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+void CMP4Demux::StreamEndReached(TAny* /*aUserPointer*/)
+    {
+    iStreamEnd = ETrue;
+    
+    // Signal ourselves if we are demultiplexing
+    if ( iDemultiplexing && (iStatus == KRequestPending) )
+        {
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+        }
+    }
+
+// ---------------------------------------------------------
+// CMP4Demux::DoCancel
+// Standard active object cancellation method
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+void CMP4Demux::DoCancel()
+    {
+    // Cancel our internal request
+    if ( iStatus == KRequestPending )
+        {
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrCancel);
+        }
+    }
+
+// ---------------------------------------------------------
+// CMP4Demux::GetFrameInfo
+// Gets information regarding the next frame. In file-reading
+// case, also sets the type of next frame to be read. 
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+TInt CMP4Demux::GetFrameInfo()
+    {     
+    
+    if ( iGotFrame )
+        return KErrNone;
+    
+    if ( !iInputQueue )
+        {
+        // file-reading case: set frame type according to 
+        // queue fullness 
+        
+        SetFrameType();
+        if ( iFrameType == EDataNone )            
+            return KErrNone;
+
+        }
+    
+    TBool frameAvailable = EFalse;
+    // check if parser has info & data for next frame available
+    TInt error = iParser->GetNextFrameInformation((CMP4Parser::TFrameType&)iFrameType, 
+        iFrameLen, frameAvailable);
+    
+    if ( error != KErrNone )
+        {
+        if ( error != CParser::EParserEndOfStream )
+            {            
+            iMonitor->Error(error);
+            return error;
+            }
+        else
+            {            
+            DASSERT( iStreamEnd );
+            return KErrNone;
+            }
+        
+        }
+    
+    if ( iInputQueue ) 
+        {                             
+        
+        // Read data from input queue until we know the frame type and length
+        // and have data for it available        
+        while ( !frameAvailable )
+            {
+            // Get a new input block with data
+            while ( !iInputBlock )
+                {
+                if ( (iInputBlock = iInputQueue->ReadBlock()) == NULL )
+                    return KErrNone;                    
+                
+                // Return empty blocks immediately
+                if ( iInputBlock->Length() == 0 ) 
+                    {
+                    iInputQueue->ReturnBlock(iInputBlock);
+                    iInputBlock = 0;
+                    }
+                }      
+            
+            // give input block to parser
+            error = iParser->WriteDataBlock(*iInputBlock);
+            if ( error != KErrNone )
+                {
+                iMonitor->Error(error);
+                return error;
+                }
+            
+            // Return our current input block 
+            iInputQueue->ReturnBlock(iInputBlock);
+            iInputBlock = 0;                                             
+            
+            // check if parser has info & data for next frame available
+            error = iParser->GetNextFrameInformation((CMP4Parser::TFrameType&)iFrameType, 
+                iFrameLen, frameAvailable);
+            
+            if ( error != KErrNone ) 
+                {
+                iMonitor->Error(error);                
+                return error;
+                }
+            }
+        }
+    else {
+        while ( !frameAvailable )
+        {
+            if ( iFrameType == EDataAudio )
+            {
+                iAudioEnd = ETrue;
+                iAudioChannel->iTargetQueue->WriteStreamEnd();
+                PRINT((_L("MP4Demux, audio ended\n") ));
+            }
+            else
+            {
+                iVideoEnd = ETrue;
+                iVideoChannel->iTargetQueue->WriteStreamEnd();
+                PRINT((_L("MP4Demux, video ended\n") ));
+            }
+            if ( iVideoEnd && (iAudioChannel == 0 || iAudioEnd) )
+            {
+                iStreamEnd = ETrue;
+                return KErrNone;
+            }
+            iFrameType = EDataNone;
+            SetFrameType();
+            if ( iFrameType == EDataNone )
+                return KErrNone;
+            error = iParser->GetNextFrameInformation((CMP4Parser::TFrameType&)iFrameType, 
+                iFrameLen, frameAvailable);
+            if ( error != KErrNone ) 
+            {
+                iMonitor->Error(error);                
+                return error;
+            }
+        }
+    }
+           
+    // at least one frame available
+    iGotFrame = ETrue;    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------
+// CMP4Demux::NumFreeBlocks
+// Gets the number of free blocks in target queue
+// Relevant in streaming -case
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+TUint CMP4Demux::NumFreeBlocks()
+    {
+    // check if there's space available for next frame    
+    
+    CActiveQueue *queue = 0;
+    
+    // streaming case: use audio queue value for both so
+    // that enough audio is always available regardless of 
+    // video bitrate.
+
+    if ( iAudioChannel )    
+        queue = iAudioChannel->iTargetQueue;    
+    else     
+        queue = iVideoChannel->iTargetQueue;
+    
+    DASSERT(queue);
+
+    return queue->NumFreeBlocks();
+    
+    }
+
+// ---------------------------------------------------------
+// CMP4Demux::SetFrameType
+// Sets the type of next frame to be read
+// Relevant in file-reading case
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CMP4Demux::SetFrameType()
+    {   
+    
+    TUint audioDataBlocks = 0;
+    TUint audioInQueue = 0;
+    TUint videoDataBlocks = iVideoChannel->iTargetQueue->NumDataBlocks();    
+    TUint videoInQueue = videoDataBlocks * iPicturePeriodMs;    
+
+    DASSERT( iFrameType == EDataNone );
+
+    if ( iAudioChannel )
+    {
+        audioDataBlocks = iAudioChannel->iTargetQueue->NumDataBlocks();
+        audioInQueue = audioDataBlocks * 20 * iAudioFramesInSample;
+    }
+
+    if ( iAudioChannel == 0 || iAudioEnd )
+    {
+        iFrameType = EDataVideo;
+    }        
+
+    else if ( iVideoEnd )
+    {    
+        iFrameType = EDataAudio;        
+    }
+
+    else 
+    {
+        if ( audioInQueue > videoInQueue + KAudioReadAheadTimeMs )
+            iFrameType = EDataVideo;
+        else 
+            iFrameType = EDataAudio;            
+    }
+    
+    //if ( ( iFrameType == EDataVideo && videoInQueue >= KMaxMsInQueue ) || 
+    //     ( iFrameType == EDataAudio && audioInQueue >= KMaxMsInQueue + KAudioReadAheadTimeMs ) )
+    //    iFrameType = EDataNone;          
+    
+    }
+
+// ---------------------------------------------------------
+// CMP4Demux::ReadVideoFrames
+// Read video frames to video queue
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CMP4Demux::ReadVideoFrames(TInt aCount)
+{
+    
+    while (aCount--)
+    {
+        iFrameType = EDataVideo;
+
+        TBool frameAvailable = 0;
+        TInt error = iParser->GetNextFrameInformation((CMP4Parser::TFrameType&)iFrameType, 
+            iFrameLen, frameAvailable);
+
+        if (error !=KErrNone)
+            return error;
+
+        DASSERT(frameAvailable);
+
+        iGotFrame = ETrue;
+        error = ReadAndSendFrames();
+        if (error !=KErrNone)
+            return error;
+    }
+    return KErrNone;
+
+}
+
+// ---------------------------------------------------------
+// CMP4Demux::StreamEndReached
+// Reads the next frame(s) from parser and writes
+// them to the target queue
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+TInt CMP4Demux::ReadAndSendFrames()
+    {    
+
+    DASSERT( iGotFrame );
+
+    // Find the correct channel. If there is no channel open for this
+    // type of frames, we'll simply ignore it
+    TOutputChannel *chan = 0;
+    TUint i;
+    for ( i = 0; i < iNumOutputChannels; i++ )
+        {
+        if ( iOutputChannels[i].iDataType == iFrameType )
+            chan = &iOutputChannels[i];
+        }    
+    
+    if ( chan )
+        {
+        // OK, we have a target channel. Get a block from its queue
+        
+        TPtr8 *block = 0;                       
+        
+        // NOTE: if output block does not need to be saved in any case, make it a local variable
+
+        //PRINT((_L("framelen = %d, bytesdemuxed = %d\n"), iFrameLen, iBytesDemuxed));
+
+        TUint blockLen = iFrameLen;
+        TPtr8 readDes(0,0);        
+        TInt error;
+
+        if ( iFrameType == EDataVideo ) 
+        {
+            // make room for timestamp
+            blockLen += 4;
+        }              
+        
+
+
+        TRAP( error, (block = chan->iTargetQueue->GetFreeBlockL(blockLen)) );
+        if ( error != KErrNone )
+            return error;        
+
+        if ( iFrameType == EDataVideo ) 
+        {
+            TUint8 *p = (TUint8 *)(block->Ptr()) + 4;
+            readDes.Set( p, 0, TInt(iFrameLen) );
+        }
+        else
+        {
+            readDes.Set( *block );
+        }
+                
+        TUint32 numReadFrames = 0;
+        TUint32 timeStamp;
+
+        // read frame(s) from parser
+        error = iParser->ReadFrames(readDes, CMP4Parser::TFrameType(iFrameType), 
+            numReadFrames, timeStamp);
+   
+        if ( error != KErrNone )
+            return error;
+
+        DASSERT( numReadFrames > 0 );   
+        
+        if ( iFrameType == EDataAudio )
+        {
+            block->SetLength(readDes.Length());            
+        }
+        else
+        {            
+            block->SetLength(readDes.Length() + 4);
+
+            // put timestamp in the output block before the actual frame data                       
+            TUint* d = (TUint *)(block->Ptr());            
+            Mem::Copy(d, &timeStamp, 4);
+        }
+
+        iBytesDemuxed += TUint( readDes.Length() );
+        
+        // Send the block
+        chan->iTargetQueue->WriteBlock(block);        
+        iFrameLen = 0;
+        iFrameType = EDataNone;
+        iGotFrame = EFalse;
+        }
+    else
+        {     
+        PRINT((_L("Unknown channel\n")));
+        }    
+    
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/mp4parser.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1264 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include    "movieprocessorimpl.h"
+#include    "mp4parser.h"
+#include    "vedvideosettings.h"
+#include    "vedaudiosettings.h"
+#include    "vedvolreader.h"
+#include    "vedavcedit.h"
+
+// ASSERTIONS
+#define MPASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CMovieProcessorImpl"), EInternalAssertionFailure))
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+// LOCAL CONSTANTS AND MACROS
+#ifdef _DEBUG
+const TInt KErrorCode = CParser::EParserFailure;
+#else
+const TInt KErrorCode = KErrGeneral;
+#endif
+
+//const TUint KNumFramesInOneRun = 10;
+const TUint KVOLHeaderBufferSize = 256;
+const TUint KAVCDCRBufferSize = 1024;
+const TUint KMinBitrate = 128;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+
+CMP4Parser::CMP4Parser()
+{       
+	iMP4Handle = 0;
+	iVideoType = 0;
+	iAudioType = 0; 
+	iBytesRead = 0;
+	iFirstRead = ETrue;		// added for Mp4
+	iFirstFrameInfo = ETrue;  // added for Mp4
+	iOutputNumberOfFrames = 0; 
+    iStreamSource = ESourceNone;
+	iFrameNumber=0;
+	iFirstTimeClipParsing=ETrue;
+    iStartFrameIndex=0;		
+}
+
+// Two-phased constructor.
+
+CMP4Parser* CMP4Parser::NewL(CMovieProcessorImpl* aProcessor, const TDesC &aFileName)
+{
+	CMP4Parser *self = new (ELeave) CMP4Parser;
+	CleanupStack::PushL(self);    
+	
+	if ( aFileName.Length() > 0 )   
+		self->iStreamSource = ESourceFile;
+	else
+		self->iStreamSource = ESourceUser;
+	
+	self->ConstructL(aProcessor,aFileName);
+
+	CleanupStack::Pop();  // self
+	
+	return self;
+}
+
+CMP4Parser* CMP4Parser::NewL(CMovieProcessorImpl* aProcessor, RFile* aFileHandle)
+{
+	CMP4Parser *self = new (ELeave) CMP4Parser;
+	CleanupStack::PushL(self);    
+	
+	self->iStreamSource = ESourceFile;	
+	
+	self->ConstructL(aProcessor,aFileHandle);
+
+	CleanupStack::Pop();  // self
+	
+	return self;
+}
+
+// Symbian OS default constructor can leave.
+
+void CMP4Parser::ConstructL(CMovieProcessorImpl* aProcessor, const TDesC &aFileName)
+{
+	MP4Err error;
+	iProcessor = aProcessor; 
+
+	// open MP4 library
+    if ( iStreamSource == ESourceFile )
+        {        
+        TBuf<258> temp(aFileName);
+        temp.ZeroTerminate();			
+
+        MP4FileName name = reinterpret_cast<MP4FileName>( const_cast<TUint16*>(temp.Ptr()) );
+
+        error = MP4ParseOpen(&iMP4Handle, name);
+        if ( error == MP4_OK )
+            {
+            // set buffer sizes; only parser buffer size is effective for this instance
+            error = MP4SetCustomFileBufferSizes(iMP4Handle, K3gpMp4ComposerWriteBufferSize, K3gpMp4ComposerNrOfWriteBuffers, K3gpMp4ParserReadBufferSize );
+            }
+        }
+    else
+        {
+        // buffer
+        error = MP4ParseOpen(&iMP4Handle, 0);        
+        }        
+		
+    if (error == MP4_OUT_OF_MEMORY)
+        {
+        User::Leave(KErrNoMemory);
+        }
+    else if ( error != MP4_OK )
+        {
+        User::Leave(KErrorCode);
+		}
+}
+
+void CMP4Parser::ConstructL(CMovieProcessorImpl* aProcessor, RFile* aFileHandle)
+{
+	MP4Err error;
+	iProcessor = aProcessor;
+
+	// open MP4 library
+    error = MP4ParseOpenFileHandle(&iMP4Handle, aFileHandle);
+    
+    if ( error == MP4_OK )
+        {
+        // set buffer sizes; only parser buffer size is effective for this instance
+        error = MP4SetCustomFileBufferSizes(iMP4Handle, K3gpMp4ComposerWriteBufferSize, K3gpMp4ComposerNrOfWriteBuffers, K3gpMp4ParserReadBufferSize );
+        }
+        
+    if (error == MP4_OUT_OF_MEMORY)
+        {
+        User::Leave(KErrNoMemory);
+        }
+    else if ( error != MP4_OK )
+        {
+        User::Leave(KErrorCode);
+		}
+}
+
+// Destructor
+CMP4Parser::~CMP4Parser()
+{
+    if (iMP4Handle)
+        MP4ParseClose(iMP4Handle);
+
+    iMP4Handle = 0;
+}
+
+
+
+// ---------------------------------------------------------
+// CMP4Parser::WriteDataBlockL
+// Write a block of data to parser
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+TInt CMP4Parser::WriteDataBlock(const TDes8& aBlock)
+{               
+	
+	MPASSERT(iStreamSource != ESourceFile);    
+	MP4Err error = MP4ParseWriteData(iMP4Handle, (mp4_u8*)(aBlock.Ptr()), mp4_u32(aBlock.Length()) );
+	
+	if ( error == MP4_OUT_OF_MEMORY )
+		return KErrNoMemory;
+	else if ( error == MP4_ERROR )
+		return KErrorCode;
+    else
+        return KErrNone;
+	
+}
+
+// ---------------------------------------------------------
+// CMP4Parser::GetNextFrameInformation
+// Get type (streaming-case), length and availability of next frame to be fetched
+// using MP4 library API functions
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+TInt CMP4Parser::GetNextFrameInformation(TFrameType& aType, TUint& aLength, TBool& aIsAvailable)
+{   
+	
+	// If aType == EFrameTypeNone, the type of next frame is retrieved 
+	// (valid only in streaming case)
+	// Otherwise, only the length of next specified type of frame is retrieved
+	MPASSERT(iStreamSource != ESourceNone);            
+	
+	mp4_u32 type = MP4_TYPE_NONE;
+	MP4Err error;
+
+	aIsAvailable = 0;    
+	if ( iNextFrameType == EFrameTypeNone )
+		// if the mp4 library is reading a file, a frame has always been read when 
+		// we come here
+		// otherwise it might be that a complete frame was not available yet
+		// and we come here to ask again        
+	{
+		if ( aType == EFrameTypeNone ) 
+		{
+			MPASSERT(iStreamSource == ESourceUser);
+			
+			// get next frame type
+			error = MP4ParseNextFrameType(iMP4Handle, &type);
+
+			if ( error == MP4_NOT_AVAILABLE )
+				return KErrNone;                
+			else if ( error == MP4_NO_FRAME )                
+				return EParserEndOfStream; // no video or audio frames left, stream ended
+			else if ( error == MP4_INVALID_INPUT_STREAM )
+				return KErrCorrupt;
+			else if ( error != MP4_OK )
+				return KErrorCode;
+            else
+            {
+                MPASSERT(error == MP4_OK);
+            }
+			
+			switch ( type ) 
+			{
+			case MP4_TYPE_H263_PROFILE_0:
+		    case MP4_TYPE_MPEG4_VIDEO:
+          
+				MPASSERT( type == iVideoType );
+				iNextFrameType = EFrameTypeVideo;         
+				break;
+				
+			case MP4_TYPE_AMR_NB:
+				MPASSERT( type == iAudioType );
+				iNextFrameType = EFrameTypeAudio;                    
+				break;        
+
+			default:
+				return KErrNotSupported;
+			}
+		}
+		else 
+		{
+			// library reads the file            
+			//MPASSERT(iStreamSource == ESourceFile);
+			type = ( aType == EFrameTypeVideo ) ? iVideoType : iAudioType;
+			iNextFrameType = aType;
+		}
+		
+		// get length for the frame
+		mp4_u32 length = 0, mp4Specific = 0;
+		MPASSERT( type != MP4_TYPE_NONE );
+		if ( (iFirstFrameInfo) &&
+		     ((iVideoType == MP4_TYPE_MPEG4_VIDEO) || (iVideoType == MP4_TYPE_AVC_PROFILE_BASELINE)) ) 		   
+		{
+			error = MP4ParseReadVideoDecoderSpecificInfo( iMP4Handle, 0, 0, &mp4Specific );
+			iFirstFrameInfo = EFalse;
+		}
+		error = MP4ParseNextFrameSize(iMP4Handle, type, &length);
+		MPASSERT( error != MP4_NOT_AVAILABLE );
+		
+		if ( length == 0 || error == MP4_NO_REQUESTED_FRAME )
+		{            
+			// file-reading case: all frames of this type have been read
+			//   and the caller should try with the other type
+			MPASSERT( length == 0 );
+			iNextFrameType = EFrameTypeNone;
+			aLength = 0;            
+			return KErrNone;            
+		}
+		else if ( error == MP4_INVALID_INPUT_STREAM )
+			return KErrCorrupt;
+		else if ( error != MP4_OK )
+			return KErrorCode;
+       else if ( length > iMaxVideoFrameLength )
+            {
+            PRINT((_L("CMP4Parser::GetNextFrameInformation() too large video frame size %d, return KErrCorrupt"),length));
+			return KErrCorrupt;
+            }
+        else
+            iNextFrameLength = TUint(length + mp4Specific);
+
+	}
+	MPASSERT(iNextFrameType != EFrameTypeNone);
+	MPASSERT(iNextFrameLength != 0);
+	
+	// check if frame is available
+	if ( iStreamSource == ESourceUser )
+	{
+		error = MP4ParseIsFrameAvailable(iMP4Handle, type);
+		if ( error != MP4_OK && error != MP4_NOT_AVAILABLE )
+			return KErrorCode;
+		aIsAvailable = ( error == MP4_NOT_AVAILABLE ) ? EFalse : ETrue;
+	}
+	else 
+		aIsAvailable = ETrue;
+	
+	aType = iNextFrameType;
+	aLength = iNextFrameLength;	
+	
+	return KErrNone;
+}   
+
+// ---------------------------------------------------------
+// CMP4Parser::ReadFrames
+// Read the next frame(s) from file / stream
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+TInt CMP4Parser::ReadFrames(TDes8& aDstBuffer, TFrameType aType, TUint32& aNumRead, 
+														TUint32& aTimeStamp)
+{
+	MP4Err error;
+	mp4_u32 returnedSize = 0;    
+	mp4_bool keyFrame = 0;
+
+	MPASSERT( iNextFrameType != EFrameTypeNone && aType == iNextFrameType ); 
+	MPASSERT( iNextFrameLength != 0 );
+
+#ifdef _DEBUG
+	mp4_u32 type = MP4_TYPE_NONE; // buffer support
+	type = ( aType == EFrameTypeVideo ) ? iVideoType : iAudioType; // buffer support
+	if (iStreamSource == ESourceUser)
+		MPASSERT( MP4ParseIsFrameAvailable(iMP4Handle, type) == MP4_OK );
+#endif
+
+
+	if (aType == EFrameTypeVideo) 
+	{	
+		TUint32 iTimeStampInTicks=0;
+		mp4_u32 mp4Specific = 0;
+
+		if ( (iFirstRead) &&
+		     ((iVideoType == MP4_TYPE_MPEG4_VIDEO) || (iVideoType == MP4_TYPE_AVC_PROFILE_BASELINE)) ) 		   
+		{
+			error = MP4ParseReadVideoDecoderSpecificInfo( iMP4Handle, (mp4_u8*)(aDstBuffer.Ptr() + aDstBuffer.Length()), 
+				mp4_u32( aDstBuffer.MaxLength() ), &mp4Specific );
+			iFirstRead = EFalse;
+		}
+		
+		error = MP4ParseReadVideoFrame(iMP4Handle, (mp4_u8*)(aDstBuffer.Ptr() + aDstBuffer.Length()+ mp4Specific), 
+			mp4_u32( aDstBuffer.MaxLength() ), &returnedSize, (mp4_u32*)&aTimeStamp,
+			&keyFrame, &iTimeStampInTicks);					    
+
+		returnedSize += mp4Specific;
+		iFrameNumber++;
+		aNumRead = 1;
+	}
+	else 
+	{       
+		error = MP4ParseReadAudioFrames(iMP4Handle, (mp4_u8*)(aDstBuffer.Ptr()), 
+			mp4_u32(aDstBuffer.MaxLength()), &returnedSize, (mp4_u32*)&aTimeStamp, 
+			(mp4_u32*)&aNumRead, NULL);               
+		
+		//PRINT((_L("audio TS:%d, "), aTimeStamp));
+	}
+	
+	MPASSERT(error != MP4_BUFFER_TOO_SMALL);    
+	aDstBuffer.SetLength(aDstBuffer.Length() + TInt(returnedSize));
+	iBytesRead += returnedSize;
+	iNextFrameType = EFrameTypeNone;
+	iNextFrameLength = 0;
+		
+	//PRINT((_L("error=%d, numReturned=%d, returnedSize=%d, bufferSize=%d\n"), 
+	//	error, aNumRead, returnedSize, aDstBuffer.MaxLength()));
+		
+	if (error == MP4_NOT_AVAILABLE)
+		return EParserNotEnoughData;    
+	else if ( error == MP4_INVALID_INPUT_STREAM )
+		return KErrCorrupt;
+	else if ( error != MP4_OK )
+		return KErrorCode;
+    else
+        return KErrNone;
+}
+
+
+// ---------------------------------------------------------
+// CMP4Parser::Reset
+// Resets the parser to its initial state
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+TInt CMP4Parser::Reset()
+{
+	MP4Err error;
+	
+	if ( iStreamSource == ESourceFile )
+	{
+		mp4_u32 audioPos, videoPos;
+		
+		// seek to very beginning
+		error = MP4ParseSeek(iMP4Handle, 0, &audioPos, &videoPos, EFalse);
+		if ( error != MP4_OK )
+			return KErrorCode;
+		
+		MPASSERT( videoPos == 0 && (iAudioType == 0 || audioPos == 0) );		
+		
+	}
+	else 
+	{
+		// close & open library to make sure old data is flushed
+		error = MP4ParseClose(iMP4Handle);
+		
+		if ( error != MP4_OK )
+			return KErrorCode;
+		error = MP4ParseOpen(&iMP4Handle, 0);
+		if ( error != MP4_OK )
+			return KErrorCode;                    
+	}
+	
+	iBytesRead = 0;
+	iNextFrameType = EFrameTypeNone;
+	iNextFrameLength = 0;
+	
+	return KErrNone;
+}
+
+
+// ---------------------------------------------------------
+// CMP4Parser::ParseHeaderL
+// Get relevant stream parameters by calling mp4 library functions
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+TInt CMP4Parser::ParseHeaderL(CParser::TStreamParameters& aStreamParameters)
+{
+
+    PRINT((_L("CMP4Parser::ParseHeaderL() begin")));
+
+	MP4Err error;
+	mp4_double frameRate = 0;    
+	TBool hasVideo = ETrue;
+	
+	// Reset channel info
+	aStreamParameters.iHaveVideo = EFalse;
+	aStreamParameters.iHaveAudio = EFalse;
+	aStreamParameters.iNumDemuxChannels = 0;
+	aStreamParameters.iFileFormat = EFileFormatUnrecognized;
+	aStreamParameters.iVideoFormat = EVideoFormatNone;
+	aStreamParameters.iAudioFormat = EAudioFormatNone;
+	aStreamParameters.iVideoLength = 0;
+	aStreamParameters.iAudioLength = 0;
+	aStreamParameters.iStreamLength = 0;
+	aStreamParameters.iAudioFramesInSample = 0;
+	aStreamParameters.iVideoPicturePeriodNsec = 0;
+	aStreamParameters.iCanSeek = EFalse;
+	aStreamParameters.iFrameRate=0;
+	aStreamParameters.iVideoTimeScale=0; 
+	aStreamParameters.iAudioTimeScale=0; 
+	iAudioType = 0;
+	iVideoType = 0;
+	iNumberOfFrames=0;
+	
+	// get video description
+	error = MP4ParseRequestVideoDescription(iMP4Handle, (mp4_u32 *)&aStreamParameters.iVideoLength,
+		&frameRate, &iVideoType, (mp4_u32 *)&aStreamParameters.iVideoWidth, 
+		(mp4_u32 *)&aStreamParameters.iVideoHeight, (mp4_u32 *)&aStreamParameters.iVideoTimeScale);
+
+	if ( error == MP4_NOT_AVAILABLE )
+		User::Leave(KErrorCode);
+	else if ( error == MP4_INVALID_INPUT_STREAM )
+		User::Leave(KErrCorrupt);
+	else if ( error == MP4_NO_VIDEO )  
+	{
+		hasVideo = EFalse;
+		aStreamParameters.iVideoWidth = aStreamParameters.iVideoHeight = 0;
+	}
+	else if ( error != MP4_OK )
+		User::Leave(KErrorCode);
+    else
+    {
+        MPASSERT(error == MP4_OK);
+    }
+
+	// get audio description. ask also for averagebitrate to get error if the track is empty; the information is needed later on
+    mp4_u32 averagebitrate = 0;
+
+	error = MP4ParseRequestAudioDescription(iMP4Handle, (mp4_u32 *)&aStreamParameters.iAudioLength, 
+		&iAudioType, (mp4_u8*)&aStreamParameters.iAudioFramesInSample, (mp4_u32 *)&aStreamParameters.iAudioTimeScale, &averagebitrate );
+
+    if ( (error == MP4_ERROR) && ((iAudioType == MP4_TYPE_MPEG4_AUDIO) || (iAudioType == MP4_TYPE_AMR_NB) || (iAudioType == MP4_TYPE_AMR_WB)))
+        {
+        // a special case: there may be audio track but it is empty; if type was recognized, mark as no audio
+        PRINT((_L("CMP4Parser::ParseHeaderL() problems with getting audio description, mark no audio since audio type was recognized")));
+        iAudioType = MP4_NO_AUDIO;
+        error = MP4_NO_AUDIO;
+        }
+	if(error == MP4_NOT_AVAILABLE)     
+		User::Leave(EParserNotEnoughData);        
+	else if ( error == MP4_INVALID_INPUT_STREAM )
+		User::Leave(KErrCorrupt);
+	else if ( error != MP4_NO_AUDIO && error != MP4_OK )
+		User::Leave(KErrorCode);
+    else
+    {
+        MPASSERT(error == MP4_OK || error == MP4_NO_AUDIO);
+    }
+
+    // store the sample size for sanity checking purposes
+    iMaxAMRSampleSize = KVedMaxAMRFrameSize * aStreamParameters.iAudioFramesInSample;
+
+	if (aStreamParameters.iVideoLength > 0)
+		aStreamParameters.iStreamLength = aStreamParameters.iVideoLength;
+
+	if (aStreamParameters.iAudioLength > aStreamParameters.iVideoLength)
+		aStreamParameters.iStreamLength = aStreamParameters.iAudioLength;	
+	
+	aStreamParameters.iFrameRate = frameRate;
+
+	if(hasVideo)
+	{
+		    
+	    if ( iVideoType == MP4_TYPE_MPEG4_VIDEO )
+	    {
+	        // read video resolution from VOL header
+	        
+	        HBufC8* tmpBuffer = (HBufC8*) HBufC8::NewLC(KVOLHeaderBufferSize);
+            TPtr8 tmpPtr = tmpBuffer->Des();
+            mp4_u32 volSize = 0;
+            MP4Err volError = 0;
+            
+            volError = MP4ParseReadVideoDecoderSpecificInfo( iMP4Handle, 
+                                                            (mp4_u8*)(tmpPtr.Ptr()),
+                                                            KVOLHeaderBufferSize,
+                                                            &volSize );
+                                                            
+            if ( volError != MP4_OK )
+            {
+                User::Leave(KErrorCode);
+            }
+            tmpPtr.SetLength(volSize);
+            
+            CVedVolReader* tmpVolReader = CVedVolReader::NewL();
+            CleanupStack::PushL(tmpVolReader);
+
+            tmpVolReader->ParseVolHeaderL(tmpPtr);
+
+            aStreamParameters.iVideoWidth = tmpVolReader->Width();
+            aStreamParameters.iVideoHeight = tmpVolReader->Height();
+
+            CleanupStack::PopAndDestroy(tmpVolReader);
+            CleanupStack::PopAndDestroy(tmpBuffer);		
+
+	    }		
+	    	    
+	    else if ( iVideoType == MP4_TYPE_AVC_PROFILE_BASELINE )
+	    {
+	        // read resolution from SPS
+
+	        HBufC8* tmpBuffer = (HBufC8*) HBufC8::NewLC(KAVCDCRBufferSize);	        	        
+            TPtr8 ptr = tmpBuffer->Des();
+            
+            // read decoder specific info
+            User::LeaveIfError( ReadAVCDecoderSpecificInfo(ptr) );
+            
+            // create AVC editing instance
+            CVedAVCEdit* avcEdit = CVedAVCEdit::NewL();
+            CleanupStack::PushL(avcEdit);
+            
+            TSize resolution(0,0);
+            User::LeaveIfError( avcEdit->GetResolution(ptr, resolution) );
+            
+            CleanupStack::PopAndDestroy(avcEdit);
+            CleanupStack::PopAndDestroy(tmpBuffer);
+
+            aStreamParameters.iVideoWidth = resolution.iWidth;
+            aStreamParameters.iVideoHeight = resolution.iHeight;
+	    }
+
+
+		iNumberOfFrames = GetNumberOfVideoFrames();
+		MPASSERT(iNumberOfFrames);
+    
+		if (iFirstTimeClipParsing)	// update only at the first parsing of a clip
+		{
+			// update the frame numbers
+			
+			iOutputNumberOfFrames = iProcessor->GetOutputNumberOfFrames();		
+			
+			if (iOutputNumberOfFrames == 0)
+			{
+				iOutputNumberOfFrames += iNumberOfFrames;  // total number of frames in all clips	
+			}
+			else if (!iProcessor->IsThumbnailInProgress())
+			{
+    			iOutputNumberOfFrames += iNumberOfFrames; 
+			}
+		}
+		
+		MPASSERT(frameRate > 0);
+		if (frameRate > 0)
+			aStreamParameters.iVideoPicturePeriodNsec = TInt64( TReal(1000000000) / TReal(frameRate) );
+		else
+			aStreamParameters.iVideoPicturePeriodNsec = TInt64(33366667);
+		
+		if ( iVideoType == MP4_TYPE_H263_PROFILE_0 || iVideoType == MP4_TYPE_H263_PROFILE_3 )
+		{
+			TVideoClipProperties prop;
+			prop.iH263Level = 0;
+			MP4ParseGetVideoClipProperties(iMP4Handle, prop);
+
+            iMaxVideoFrameLength = KMaxCodedPictureSizeQCIF;
+			if (prop.iH263Level == 45)
+                {
+				aStreamParameters.iVideoFormat = EVideoFormatH263Profile0Level45;
+                }
+			else 
+                {
+				aStreamParameters.iVideoFormat = EVideoFormatH263Profile0Level10;
+                }
+		}
+		else if ( iVideoType == MP4_TYPE_MPEG4_VIDEO )
+            {
+			aStreamParameters.iVideoFormat = EVideoFormatMPEG4;		
+            if ( aStreamParameters.iVideoWidth <= KVedResolutionQCIF.iWidth )
+                {
+                iMaxVideoFrameLength = KMaxCodedPictureSizeMPEG4L0BQCIF;//distinction between L0 and L0B not possible here
+                }
+            else if (aStreamParameters.iVideoWidth <= KVedResolutionCIF.iWidth )
+                {
+                iMaxVideoFrameLength = KMaxCodedPictureSizeMPEG4CIF;
+                }
+            else
+                {
+                // VGA
+                iMaxVideoFrameLength = KMaxCodedPictureSizeVGA;
+                }
+            }
+            
+        else if ( iVideoType == MP4_TYPE_AVC_PROFILE_BASELINE )
+            {
+
+            // : Is it possible to dig up the level here ??
+			aStreamParameters.iVideoFormat = EVideoFormatAVCProfileBaseline;
+			
+            if ( aStreamParameters.iVideoWidth <= KVedResolutionQCIF.iWidth )
+                {
+                iMaxVideoFrameLength = KMaxCodedPictureSizeAVCLevel1B;  //distinction between L0 and L0B not possible here ??
+                }
+            else if (aStreamParameters.iVideoWidth <= KVedResolutionCIF.iWidth )
+                {
+                iMaxVideoFrameLength = KMaxCodedPictureSizeAVCLevel1_2;
+                }
+            else
+                {
+                // default
+                iMaxVideoFrameLength = KMaxCodedPictureSizeAVCLevel1_2;
+                }
+            }
+	}	
+
+	if ( error == MP4_OK )
+	{
+		// stream contains audio 
+		if ( iAudioType == MP4_TYPE_AMR_NB )
+			aStreamParameters.iAudioFormat = EAudioFormatAMR;
+		else
+		{
+			if ( iAudioType == MP4_TYPE_MPEG4_AUDIO )
+				aStreamParameters.iAudioFormat = EAudioFormatAAC;
+		}		
+	}
+	
+	TBool videoMpeg4OrAVC = ( iVideoType == MP4_TYPE_MPEG4_VIDEO || 
+	                          iVideoType == MP4_TYPE_AVC_PROFILE_BASELINE );
+
+	if ( (videoMpeg4OrAVC && iAudioType == MP4_TYPE_MPEG4_AUDIO) ||
+		 (videoMpeg4OrAVC && iAudioType == MP4_TYPE_NONE) ||
+		 (iVideoType == MP4_TYPE_NONE && iAudioType == MP4_TYPE_MPEG4_AUDIO) )
+		aStreamParameters.iFileFormat = EFileFormatMP4;
+
+	else if (iVideoType != MP4_TYPE_NONE || iAudioType != MP4_TYPE_NONE)
+		aStreamParameters.iFileFormat = EFileFormat3GP;
+
+	if ( aStreamParameters.iStreamLength == 0 )
+		aStreamParameters.iFileFormat = EFileFormatUnrecognized;
+	
+	if ( aStreamParameters.iVideoFormat != EVideoFormatNone ) 
+	{
+		aStreamParameters.iHaveVideo = ETrue;
+		aStreamParameters.iNumDemuxChannels++;
+	}
+	
+	if ( aStreamParameters.iAudioFormat != EAudioFormatNone )
+	{
+		aStreamParameters.iHaveAudio = ETrue;
+		aStreamParameters.iNumDemuxChannels++;
+	}	
+	
+	aStreamParameters.iMaxPacketSize = 0;  // N/A
+	aStreamParameters.iLogicalChannelNumberVideo = 0;  // N/A
+	aStreamParameters.iLogicalChannelNumberAudio = 0;  // N/A
+	
+	// get stream description
+	error = MP4ParseRequestStreamDescription(iMP4Handle, (mp4_u32 *)&aStreamParameters.iStreamSize, 
+		(mp4_u32 *)&aStreamParameters.iStreamBitrate);    
+	if ( error != MP4_OK )     
+		User::Leave(KErrorCode);
+	
+	// do sanity-check for bitrate
+	if (aStreamParameters.iStreamBitrate < KMinBitrate)
+	    User::Leave(KErrCorrupt);
+	
+	aStreamParameters.iReferencePicturesNeeded = 0;     
+	aStreamParameters.iNumScalabilityLayers = 0;
+	
+	// determine if the stream contains INTRA frames so seeking is possible
+	// If the stream contains more than one INTRA frame, seeking is 
+	// allowed. 
+	
+	if (hasVideo)
+	{
+		mp4_u32 position = aStreamParameters.iStreamLength + 1000;
+		mp4_u32 audioTime, videoTime;
+		
+		// Seek past stream duration to find out the position of last INTRA frame
+		error = MP4ParseSeek(iMP4Handle, position, &audioTime, &videoTime, ETrue);
+		if ( error != MP4_OK )     
+			User::Leave(KErrorCode);
+		
+		if (videoTime != 0) 
+		{
+			// at least two INTRAs
+			aStreamParameters.iCanSeek = ETrue;
+		}
+		
+		// rewind file back to beginning
+		error = MP4ParseSeek(iMP4Handle, 0, &audioTime, &videoTime, EFalse);
+		if ( error != MP4_OK )     
+			User::Leave(KErrorCode);
+	}
+
+    PRINT((_L("CMP4Parser::ParseHeaderL() end")));
+
+	return KErrNone; 
+}
+
+
+// ---------------------------------------------------------
+// CMP4Parser::IsStreamable
+// Finds out whether input stream is multiplexed so that
+// it can be streamed, i.e. played while receiving the stream.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+TInt CMP4Parser::IsStreamable()
+{
+	MP4Err error;
+	
+	error = MP4ParseIsStreamable(iMP4Handle);
+	if ( error == MP4_NOT_AVAILABLE )
+		return EParserNotEnoughData;
+	else if ( error == MP4_INVALID_INPUT_STREAM )
+		return KErrNotSupported;
+	else if ( error == MP4_ERROR )
+		return KErrorCode;    
+	else
+		return ( error == MP4_OK ) ? 1 : 0;
+}
+
+
+// ---------------------------------------------------------
+// CMP4Parser::Seek
+// Seeks the file to desired position in milliseconds
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CMP4Parser::Seek(TUint32 aPositionInMs, TUint32& anAudioTimeAfter, TUint32& aVideoTimeAfter)
+{
+	
+	MP4Err error = MP4_OK;
+	MPASSERT(iStreamSource == ESourceFile);
+	error = MP4ParseSeek(iMP4Handle, aPositionInMs, &anAudioTimeAfter, &aVideoTimeAfter, ETrue);
+	if (error != MP4_OK)
+		return KErrorCode;    
+	
+	return KErrNone;
+}
+
+
+
+TInt CMP4Parser::GetNumberOfFrames()
+{
+	return iNumberOfFrames;
+}
+
+// ---------------------------------------------------------
+// CMP4Parser::SeekOptimalIntraFrame
+// Seeks to INTRA frame position before given time
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CMP4Parser::SeekOptimalIntraFrame(TTimeIntervalMicroSeconds aStartTime, TInt /*aIndex*/, TBool aFirstTime)
+{
+	MP4Err error = KErrNone; 
+	TInt revisedNumberOfFrames = 0;
+	mp4_u32 audioTime = 0; 
+	mp4_u32 videoTime = 0; 
+//	mp4_u32 timeScale = 0; 
+ 
+	// calculate the start time of the cut operation
+	TInt64 startTime = aStartTime.Int64() / TInt64(1000);    
+	mp4_u32 startPosition = (mp4_u32)( I64INT(startTime) ); // in milliseconds
+
+	TBool intraFound = (startPosition == 0);
+	
+	if (!aFirstTime)	
+	    intraFound = 0;
+		
+	// First check if the first included frame is intra	
+	if (!intraFound)
+	{
+	    // seek to previous frame preceding start time or at start time
+	    error = MP4ParseSeek(iMP4Handle, startPosition, &audioTime, &videoTime, EFalse);
+	    if (error != MP4_OK)
+	    {		
+		    return KErrorCode; 
+	    }
+	    MPASSERT(videoTime <= startPosition);
+
+	    // get index of the frame
+	    TInt index = iProcessor->GetVideoFrameIndex(TTimeIntervalMicroSeconds(videoTime*1000));
+	    
+	    if (videoTime < startPosition)	    
+	    {
+	        // if there was no frame at start time, seek 
+	        // one frame forward to the first included frame
+            index++;
+	    }
+	    
+        // get frame type
+        mp4_bool frameType;
+	    error = MP4ParseGetVideoFrameType(iMP4Handle, index, &frameType);	    
+	    if (error != MP4_OK)
+	    {		
+            return KErrorCode; 
+	    }
+	    if (frameType == 1)
+	    {
+	        intraFound = ETrue;
+	        iStartFrameIndex = index;
+	        
+	        mp4_u32 timeInTicks;
+	        // get timestamp of matched frame to startPosition
+	        error = MP4ParseGetVideoFrameStartTime(iMP4Handle, index, &timeInTicks, &startPosition);
+	        if (error != MP4_OK)
+	        {		
+		        return KErrorCode; 
+	        }	        
+	        
+	        // Now seek to found Intra in 1 ms increments. The loop is needed 
+	        // because due to rounding error, MP4Parser may seek to previous
+	        // frame instead of the I-frame at startPosition
+	        TInt seekTime = startPosition;
+	        videoTime = 0;
+	        
+	        while (videoTime != startPosition)
+	        {	            	        
+    	        error = MP4ParseSeek(iMP4Handle, seekTime, &audioTime, &videoTime, EFalse);
+        	    if (error != MP4_OK)
+        	    {		
+        		    return KErrorCode; 
+        	    }
+        	    MPASSERT(videoTime <= startPosition);
+        	    seekTime++;  // add 1 ms
+	        }
+        	
+	    }                
+	}	
+	
+	if (!intraFound)
+	{	    
+    	// seek to the I-frame preceding the start time
+    	error = MP4ParseSeek(iMP4Handle, startPosition, &audioTime, &videoTime, ETrue);
+    	if (error != MP4_OK)
+    	{		
+    		return KErrorCode; 
+    	}
+	}
+	
+	if (videoTime != 0) 
+	{
+	    if (!intraFound)
+        {                
+            // get index of the intra frame
+            TInt64 time = TInt64(TUint(videoTime)) * TInt64(1000);
+            iStartFrameIndex = iProcessor->GetVideoFrameIndex(TTimeIntervalMicroSeconds( time ));            
+        }        		
+		
+		if (aFirstTime)
+		{	
+		    revisedNumberOfFrames = iNumberOfFrames - iStartFrameIndex;	    
+		    // update movie and clip number of frames
+            iOutputNumberOfFrames -= iStartFrameIndex;            
+            iNumberOfFrames = revisedNumberOfFrames; 
+		}
+				
+		PRINT((_L("CMP4Parser::SeekOptimalIntraFrame() revised = %d"),revisedNumberOfFrames));
+        PRINT((_L("CMP4Parser::SeekOptimalIntraFrame() iNumberOfFrames = %d"),iNumberOfFrames));
+        PRINT((_L("CMP4Parser::SeekOptimalIntraFrame() iStartFrameIndex = %d"),iStartFrameIndex));                                
+        PRINT((_L("CMP4Parser::SeekOptimalIntraFrame() iOutputNumberOfFrames = %d"),iOutputNumberOfFrames));        				
+        iFrameNumber = iStartFrameIndex;
+	}
+	return KErrNone;
+}
+
+// ---------------------------------------------------------
+// CMP4Parser::GetNumberOfVideoFrames
+// Gets the number of video frames in clip
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CMP4Parser::GetNumberOfVideoFrames()
+{
+    mp4_u32 numberOfFrames = 0;
+    MP4Err error = 0;    
+
+    error = MP4ParseGetNumberOfVideoFrames(iMP4Handle, &numberOfFrames);
+
+    if (error != MP4_OK)
+        return 0;
+
+    return numberOfFrames;
+  
+}
+
+// ---------------------------------------------------------
+// CMP4Parser::GetVideoFrameSize
+// Gets the size of video frame at given index
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CMP4Parser::GetVideoFrameSize(TInt aIndex)
+{
+    mp4_u32 frameSize = 0;
+	mp4_u32 mp4Specific = 0;
+    MP4Err error = 0;
+
+	if ( aIndex == 0 && iVideoType == MP4_TYPE_MPEG4_VIDEO )
+	{
+		error = MP4ParseReadVideoDecoderSpecificInfo( iMP4Handle, 0, 0, &mp4Specific );
+		
+		if ( error != MP4_OK && error != MP4_BUFFER_TOO_SMALL )
+			return KErrorCode;
+	}
+
+    error = MP4ParseGetVideoFrameSize(iMP4Handle, aIndex, &frameSize);
+
+    if (error != MP4_OK)
+        return KErrorCode;
+
+    return frameSize + mp4Specific;
+	
+}
+
+
+
+// ---------------------------------------------------------
+// CMP4Parser::GetVideoFrameStartTime
+// Returns frame start time in millisec - optional iTimestamp for start time in ticks
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CMP4Parser::GetVideoFrameStartTime(TInt aIndex, TInt* aTimeStampInTicks)
+{
+
+    MP4Err error = 0;
+    mp4_u32 timeStampInMs = 0;
+
+    MPASSERT(aTimeStampInTicks);
+  
+    PRINT((_L("CMP4Parser::GetVideoFrameStartTime(), get time for index %d"), aIndex));
+    error = MP4ParseGetVideoFrameStartTime(iMP4Handle, aIndex, (mp4_u32*)aTimeStampInTicks, &timeStampInMs);
+
+    if (error != MP4_OK)
+        {
+        PRINT((_L("CMP4Parser::GetVideoFrameStartTime(), error from MP4 parser %d"), error));
+        return KErrorCode;
+        }
+
+    PRINT((_L("CMP4Parser::GetVideoFrameStartTime(), time in ms %d"), timeStampInMs));
+    return timeStampInMs;
+  
+}
+
+
+// ---------------------------------------------------------
+// CMP4Parser::GetVideoFrameType
+// Gets the type of video frame at given index
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt8 CMP4Parser::GetVideoFrameType(TInt aIndex)
+{
+
+    MP4Err error = 0;
+    mp4_bool frameType;
+    
+    error = MP4ParseGetVideoFrameType(iMP4Handle, aIndex, &frameType);
+
+    if (error != MP4_OK)
+        return KErrGeneral;
+ 
+	return TInt8(frameType);
+}
+
+
+// ---------------------------------------------------------
+// CMP4Parser::GetVideoFrameProperties
+// Gets frame properties
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CMP4Parser::GetVideoFrameProperties(TFrameInfoParameters* aVideoFrameInfoArray,
+										 TUint32 aStartIndex, TUint32 aSizeOfArray)
+{	
+	MP4Err error;
+	error = MP4GetVideoFrameProperties(iMP4Handle,aStartIndex,aSizeOfArray,aVideoFrameInfoArray);
+
+	if (error != MP4_OK)
+		return KErrorCode;
+
+	return KErrNone;
+}
+
+
+// ---------------------------------------------------------
+// CMP4Parser::ParseAudioInfo
+// Gets the frame information (frame size) for audio in the current clip
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CMP4Parser::ParseAudioInfo(TInt& aAudioFrameSize)
+{
+	MP4Err error;
+	mp4_u32 audioLength=0;
+	mp4_u32 audioType=0;
+	mp4_u32 audioFramesInSample=0;
+	mp4_u32 audioTimeScale=0;
+    mp4_u32 avgBitRate=0;
+	mp4_double frameLength = 0.02; // 20 ms
+
+	error = MP4ParseRequestAudioDescription(iMP4Handle, (mp4_u32 *)&audioLength, 
+		&audioType, (mp4_u8*)&audioFramesInSample, (mp4_u32 *)&audioTimeScale, (mp4_u32*)&avgBitRate);
+    aAudioFrameSize = ((mp4_u32)((mp4_double)avgBitRate*frameLength)>>3); 
+
+	return error;
+}
+
+TInt CMP4Parser::GetMP4SpecificSize()
+{
+	MP4Err error = 0;
+	mp4_u32 mp4Specific = 0;
+	if ( iVideoType == MP4_TYPE_MPEG4_VIDEO )
+	{
+		error = MP4ParseReadVideoDecoderSpecificInfo( iMP4Handle, 0, 0, &mp4Specific );
+		if ( error != MP4_OK && error != MP4_BUFFER_TOO_SMALL )
+			return KErrGeneral;
+	}
+	return mp4Specific;
+}
+
+// ---------------------------------------------------------
+// CMP4Parser::ReadAudioDecoderSpecificInfoL
+// Gets the decoder specific info from the current file filled so that it can be composed to output file
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CMP4Parser::ReadAudioDecoderSpecificInfoL(HBufC8*& aBytes, TInt aBufferSize)
+{
+	aBytes = HBufC8::NewL(aBufferSize);
+	CleanupStack::PushL(aBytes);
+	mp4_u8 *buffer = new (ELeave) mp4_u8[aBufferSize];
+	mp4_u32 decspecinfosize = 0;
+	
+	MP4Err err = MP4ParseReadAudioDecoderSpecificInfo(
+		iMP4Handle,
+		buffer,
+		aBufferSize,
+		&decspecinfosize);
+	if (err == MP4_OK)
+	{
+		for (TInt a = 0 ; a < (TInt)decspecinfosize ; a++)
+		{
+			aBytes->Des().Append(buffer[a]);
+		}
+	}
+	else
+	{
+		delete[] buffer;
+		buffer = 0;
+		CleanupStack::PopAndDestroy(aBytes);
+		aBytes = 0;
+		User::Leave(KErrGeneral);
+	}
+	delete[] buffer;
+	buffer = 0;
+	CleanupStack::Pop(aBytes);
+	return ETrue;
+}
+
+// ---------------------------------------------------------
+// CMP4Parser::SetDefaultAudioDecoderSpecificInfoL
+// Gets the default decoder specific info filled so that it can be composed to output file
+// the default info is for a 16 KHz, mono LC type AAC only
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CMP4Parser::SetDefaultAudioDecoderSpecificInfoL(HBufC8*& aBytes, TInt aBufferSize)
+{
+	aBytes = HBufC8::NewL(aBufferSize);
+	CleanupStack::PushL(aBytes);
+	
+	const TUint8 frameDecSpecInfo[] = {0x14,0x08};	//the decoder specific 
+	const TInt frameSize = 2;  //constant as maximum size of decoderspecific info is 2
+	
+		for (TInt a = 0 ; a < frameSize ; a++)
+		{
+			aBytes->Des().Append(frameDecSpecInfo[a]);
+		}
+	CleanupStack::Pop(aBytes);
+	return ETrue;
+}
+
+
+TInt CMP4Parser::GetAudioBitrate(TInt& aBitrate)
+{
+
+    mp4_u32 length;
+    mp4_u32 type;
+    mp4_u8 framesPerSample;
+    mp4_u32 timeScale;
+    mp4_u32 averageBitrate;
+
+    MP4Err error = 0;
+    
+    error = MP4ParseRequestAudioDescription(iMP4Handle, &length, 
+        &type, &framesPerSample, &timeScale, &averageBitrate);
+
+    if ( error != 0 )
+        return KErrGeneral;
+
+    aBitrate = averageBitrate;
+
+    return KErrNone;
+
+
+}
+
+TInt CMP4Parser::GetVideoFrameRate(TReal& aFrameRate)
+{
+
+    mp4_u32 length;
+    mp4_double frameRate; 
+    mp4_u32 videoType;
+    mp4_u32 width;
+    mp4_u32 height;
+    mp4_u32 timeScale;
+
+    MP4Err error = 0;
+
+    // get video description
+	error = MP4ParseRequestVideoDescription(iMP4Handle, &length, &frameRate, 
+        &videoType, &width, &height, &timeScale);		
+
+    if ( error != 0 )
+        return KErrGeneral;
+    
+    TReal temp = frameRate * 2.0;
+    TInt temp2 = TInt(temp + 0.5);
+
+    aFrameRate = temp2 / 2.0;
+
+    return KErrNone;
+}
+
+TInt CMP4Parser::GetDecoderSpecificInfoSize()
+{
+
+    MPASSERT(iMP4Handle);
+
+    mp4_u32 mp4Specific = 0;
+        
+    MP4Err error = MP4ParseReadVideoDecoderSpecificInfo( iMP4Handle, 0, 0, &mp4Specific );        
+    
+    if ( error != MP4_OK && error != MP4_BUFFER_TOO_SMALL )
+        return KErrGeneral;
+    
+    return mp4Specific;
+}
+
+TInt CMP4Parser::ReadAVCDecoderSpecificInfo(TDes8& buf)
+{
+
+    mp4_u32 mp4Specific = 0;
+    
+    MP4Err error = MP4ParseReadVideoDecoderSpecificInfo( iMP4Handle, (mp4_u8*)(buf.Ptr()), 
+				mp4_u32( buf.MaxLength() ), &mp4Specific );
+        
+        
+    if (error != MP4_OK)
+	    return KErrorCode;
+    
+    buf.SetLength(mp4Specific);
+    
+    return KErrNone;
+    
+}
+
+TInt CMP4Parser::GetVideoDuration(TInt& aDurationInMs)
+{
+
+    mp4_u32 length;
+    mp4_double frameRate; 
+    mp4_u32 videoType;
+    mp4_u32 width;
+    mp4_u32 height;
+    mp4_u32 timeScale;
+
+    MP4Err error = 0;
+
+    // get video description
+	error = MP4ParseRequestVideoDescription(iMP4Handle, &length, &frameRate, 
+        &videoType, &width, &height, &timeScale);		
+
+    if ( error != MP4_OK )
+        return KErrGeneral;
+    
+    aDurationInMs = length;
+
+    return KErrNone;
+    
+}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/mpeg4timer.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation for MPEG-4 timing functions.
+*
+*/
+
+
+/* 
+* Includes
+*/
+
+#include "mpeg4timer.h"
+#include "vedvideosettings.h"
+
+// Debug print macro
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+/*
+* ~CMPEG4Timer
+*
+* Parameters: 
+*
+* Function:
+*    Destruction
+* Returns:
+*
+* Error codes:
+*    None
+*
+*/
+CMPEG4Timer::~CMPEG4Timer()
+{
+}
+
+/*
+* NewL
+*
+* Parameters: 
+*     
+* Function:
+*    Symbian two-phased constructor 
+* Returns:
+*     pointer to constructed object, or NULL
+* Error codes:
+*    None
+*
+*/
+CMPEG4Timer* CMPEG4Timer::NewL(CMovieProcessorImpl * aMovProcessor, TInt aTimeIncrementResolution)
+{	
+	CMPEG4Timer* self = new (ELeave) CMPEG4Timer();    
+	CleanupStack::PushL( self );
+	self->ConstructL(aMovProcessor, aTimeIncrementResolution);
+	CleanupStack::Pop();
+	return self; 
+}
+
+/*
+* ConstructL
+*
+* Parameters: 
+*     
+* Function:
+*    Symbian 2nd phase constructor (can leave)
+* Returns:
+*     None
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Timer::ConstructL(CMovieProcessorImpl * aMovProcessor, TInt aTimeIncrementResolution)
+{	
+	iProcessor = aMovProcessor;
+	iMPEG4TimeStamp.modulo_time_base = 0;
+	iMPEG4TimeStamp.time_inc = 0;
+	iPrevModuloTimeBaseVal = 0;
+	iMPEG4TimeResolution = aTimeIncrementResolution;
+	iMPEG4DurationInMsSinceLastModulo = 0;
+}
+
+
+
+/*
+* GetMPEG4DurationInMsSinceLastModulo
+*
+* Parameters: 
+*     
+* Function:
+*    This function gets the frame duration in millisec from the last frame with modulo base larger than zero
+* Returns:
+*     Frame duration 
+* Error codes:
+*    None
+*
+*/
+TInt64 CMPEG4Timer::GetMPEG4DurationInMsSinceLastModulo()
+{
+	return iMPEG4DurationInMsSinceLastModulo;
+}
+
+/*
+* UpdateMPEG4Time
+*
+* Parameters: 
+*     
+* Function:
+*    This function updates the time stamp and duration of the last frame for MPEG-4 video
+* Returns:
+*     Nothing 
+* Error codes:
+*    None
+*
+*/
+void CMPEG4Timer::UpdateMPEG4Time(TInt aAbsFrameNumber, TInt /*aFrameNumber*/, TInt aTimeScale)
+{
+	TInt cur = aAbsFrameNumber; 
+	TInt next = cur+1;
+	TInt64 frameDuration;
+	int Tdiff;
+
+	iPrevModuloTimeBaseVal += iMPEG4TimeStamp.modulo_time_base;
+	
+	iMPEG4DurationInMsSinceLastModulo = (TInt)((TReal)(iPrevModuloTimeBaseVal * iMPEG4TimeResolution + iMPEG4TimeStamp.time_inc)/ 
+		(TReal)(iMPEG4TimeResolution) * 1000000.0 + 0.5);	
+	
+	if(next >= iProcessor->GetOutputNumberOfFrames())
+		frameDuration = iProcessor->GetVideoTimeInMsFromTicks( I64INT( (iProcessor->GetVideoClipDuration() - iProcessor->VideoFrameTimeStamp(cur)) ), EFalse)*1000; 
+	else
+		frameDuration = iProcessor->GetVideoTimeInMsFromTicks(iProcessor->VideoFrameTimeStamp(next) - iProcessor->VideoFrameTimeStamp(cur), EFalse)*1000; 
+	
+ 	if (frameDuration <0 )
+		frameDuration = 100000;
+	
+	frameDuration = TInt( I64REAL(frameDuration) / (TReal)aTimeScale * 1000.0 + 0.5);
+	
+    if ( I64INT(frameDuration) > KVedMaxFrameDuration )
+        {
+        // max duration is limited since there are some variables e.g. in video decoder than can handle only limited length fields. 
+        PRINT((_L("CMPEG4Timer::UpdateMPEG4Time() limiting frame duration to 30 sec")));
+        frameDuration = KVedMaxFrameDuration;
+        }
+	Tdiff = TInt(iMPEG4TimeStamp.time_inc + I64REAL(frameDuration) * iMPEG4TimeResolution/1000000.0 + 0.5);
+	iMPEG4TimeStamp.modulo_time_base = Tdiff/iMPEG4TimeResolution;
+	iMPEG4TimeStamp.time_inc = Tdiff - (iMPEG4TimeResolution * iMPEG4TimeStamp.modulo_time_base);
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/statusmonitor.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,531 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Video player status monitor definitions, class CStatusMonitor.
+*
+*/
+
+
+//  EXTERNAL RESOURCES  
+
+
+//  Include Files
+
+#include "movieprocessorimpl.h"
+#include "statusmonitor.h"
+#include "vedmovie.h"
+
+
+// LOCAL CONSTANTS AND MACROS
+// Debug print macro
+#if defined _DEBUG 
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+
+//  MEMBER FUNCTIONS
+
+
+//=============================================================================
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    CStatusMonitor()
+
+    Standard C++ constructor
+
+-----------------------------------------------------------------------------
+*/
+
+CStatusMonitor::CStatusMonitor(MVedMovieProcessingObserver *anObserver,                               
+                               CMovieProcessorImpl *aMovieProcessor,
+                               CVedMovie *aMovie, TInt aPriority)
+    : CActive(aPriority)
+{
+    // Remember the objects
+    iObserver = anObserver;
+    iProcessor = aMovieProcessor;
+    iMovie = aMovie;
+    // Initialize status:
+
+    iPrepared = EFalse;
+    iPreparing = EFalse;
+
+    iProcessingStarted = EFalse;
+    iProcessing = EFalse;
+    iClipProcessed = EFalse;
+    iComplete = EFalse;
+    iCancelled = EFalse;
+    iError = KErrNone;
+    iOutError = KErrNone;
+
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    ~CStatusMonitor()
+
+    Standard C++ destructor
+
+-----------------------------------------------------------------------------
+*/
+
+CStatusMonitor::~CStatusMonitor()
+{
+    Cancel();
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    ConstructL()
+
+    Symbian OS second-phase constructor
+
+-----------------------------------------------------------------------------
+*/
+
+void CStatusMonitor::ConstructL()
+{
+    // Add to active scheduler:
+    CActiveScheduler::Add(this);
+    
+    // Make us active:
+    if (!IsActive())
+    {
+        SetActive();
+        iStatus = KRequestPending;
+    }
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    Error()
+
+    An error has occurred
+
+-----------------------------------------------------------------------------
+*/
+
+void CStatusMonitor::Error(TInt anErrorCode)
+{
+    // Remember the error
+    iError = anErrorCode;
+
+#ifndef _DEBUG
+    if (iError < KErrHardwareNotAvailable)
+        iError = KErrGeneral;
+#endif
+
+    PRINT((_L("CStatusMonitor::Error()  Error = %d  "), iError )); 
+
+    // Activate the object:
+    if ( iStatus == KRequestPending )
+    {
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+    }
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    StartOpening()
+
+    The stream opening has been started
+
+-----------------------------------------------------------------------------
+*/
+
+void CStatusMonitor::StartPreparing()
+{
+    __ASSERT_DEBUG((!iPrepared) && (!iPreparing) && (!iProcessing),
+                   User::Panic(_L("CVideoProcessor"), EInvalidStateTransition));
+    
+    // Note the state change:
+    iPreparing = ETrue;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    Opened()
+
+    The stream has been opened and it is ready for playback
+
+-----------------------------------------------------------------------------
+*/
+
+void CStatusMonitor::PrepareComplete()
+{
+    __ASSERT_DEBUG((!iPrepared) && iPreparing && (!iProcessing),
+                   User::Panic(_L("CVideoProcessor"), EInvalidStateTransition));
+    
+    // Note the state change
+    iPrepared = ETrue;
+    iPreparing = EFalse;
+    
+}
+
+void CStatusMonitor::StreamEndReached()
+{
+
+
+}
+
+void CStatusMonitor::Progress(TInt aPercentage)
+{
+    PRINT((_L("CStatusMonitor::Progress()  Progress = %d  "), aPercentage )); 
+
+    iObserver->NotifyMovieProcessingProgressed(*iMovie, aPercentage);
+}
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    Closed()
+
+    The stream has been closed
+
+-----------------------------------------------------------------------------
+*/
+
+void CStatusMonitor::Closed()
+{
+    __ASSERT_DEBUG((iPrepared || iPreparing) && (!iProcessing),
+                   User::Panic(_L("CVideoProcessor"), EInvalidStateTransition));
+
+    // Note the state change:    
+    iPreparing = EFalse;    
+
+    // Do not report a stream open if one had been done
+    iPrepared = EFalse;    
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    ProcessingStarted()
+
+    Processing has been started
+
+-----------------------------------------------------------------------------
+*/
+
+void CStatusMonitor::ProcessingStarted(TBool aNotifyObserver)
+{
+    __ASSERT_DEBUG( (!iProcessing) && (!iProcessingStarted) && (iPrepared),
+                   User::Panic(_L("CVideoProcessor"), EInvalidStateTransition));
+
+    // Note the state change:    
+    iProcessing = ETrue;
+
+    if (aNotifyObserver)
+    {
+        iProcessingStarted = ETrue;
+        
+        // Activate the object:
+        if ( iStatus == KRequestPending )
+        {
+            TRequestStatus *status = &iStatus;
+            User::RequestComplete(status, KErrNone);
+        }
+    }   
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+   ProcessingStopped()
+
+    Processing has been stopped
+
+-----------------------------------------------------------------------------
+*/
+
+void CStatusMonitor::ProcessingStopped()
+{
+    __ASSERT_DEBUG(iProcessing,
+                   User::Panic(_L("CVideoProcessor"), EInvalidStateTransition));
+
+    // Note the state change:
+    iProcessing = EFalse;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    ClipProcessed()
+
+    The video clip end has been reached
+
+-----------------------------------------------------------------------------
+*/
+
+void CStatusMonitor::ClipProcessed()
+{
+    __ASSERT_DEBUG( (iProcessing),
+                   User::Panic(_L("CVideoProcessor"), EInvalidStateTransition));
+
+    // Note the stream end:
+    iClipProcessed = ETrue;
+
+    // Activate the object:
+    if ( iStatus == KRequestPending )
+    {
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+    }
+}
+
+void CStatusMonitor::ProcessingComplete()
+{
+    __ASSERT_DEBUG((!iProcessing),
+                   User::Panic(_L("CVideoProcessor"), EInvalidStateTransition));
+
+    // Note the stream end:
+    iComplete = ETrue;
+
+    // Activate the object:
+    if ( iStatus == KRequestPending )
+    {
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+    }
+}
+
+void CStatusMonitor::ProcessingCancelled()
+{
+    __ASSERT_DEBUG((!iProcessing),
+                   User::Panic(_L("CVideoProcessor"), EInvalidStateTransition));
+    
+    iCancelled = ETrue;
+
+    // Activate the object:
+    if ( iStatus == KRequestPending )
+    {
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+    }
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    FatalError()
+
+    A fatal non-recovereable error has occurred
+
+-----------------------------------------------------------------------------
+*/
+
+void CStatusMonitor::FatalError(TInt anError)
+{
+    PRINT((_L("CStatusMonitor::FatalError  Error = %d  "), anError )); 
+
+    // Pass the error to the observer
+    iObserver->NotifyMovieProcessingCompleted(*iMovie, anError);
+
+    // The observer returned -- panic the program
+    User::Panic(_L("CVideoProcessor"), anError);    
+    
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    RunL()
+
+    The active object running method, called by the active scheduler when the
+    object has been activated.
+
+-----------------------------------------------------------------------------
+*/
+
+void CStatusMonitor::RunL()
+{
+    TInt error;
+    
+    // Re-activate us:
+    if (!IsActive())
+    {
+        SetActive();
+        iStatus = KRequestPending;
+    }
+    
+    // Check if an error occurred:
+    if ( iError != KErrNone )
+    {
+        // Yes, stop processing if we are processing, close stream if it was open:
+        if ( iProcessing )
+        {
+            if ( iProcessor )
+            {                
+				iProcessor->CancelProcessingL();
+            }
+            iProcessing = EFalse;
+        }
+        else
+        {
+            if ( iPrepared || iPreparing )
+            {
+                if ( iProcessor )
+                {                    
+                    iProcessor->CancelProcessingL();                    
+                }
+                iPreparing = EFalse;
+                iPrepared = EFalse;                
+            }
+        }
+
+        // Report the error to the observer:
+        //iObserver->NotifyMovieProcessingCompleted(*iMovie, iError);        
+        iOutError = iError;
+        iError = KErrNone;
+
+        
+    }
+    
+    else
+    {
+        // Nope, no errors
+
+        // If processing has been started, report that:
+        if ( iProcessingStarted )
+        {
+            iProcessingStarted = EFalse;
+            TRAP(error, iObserver->NotifyMovieProcessingStartedL(*iMovie));
+            if ( error != KErrNone )
+                FatalError(error);
+        }
+		else if ( iCancelled )
+        {
+            // processing has been cancelled
+            iCancelled = EFalse;
+            iComplete = EFalse;
+			iClipProcessed = EFalse;
+
+            if ( iOutError == KErrNone )
+                iObserver->NotifyMovieProcessingCompleted(*iMovie, KErrCancel);
+            else
+                iObserver->NotifyMovieProcessingCompleted(*iMovie, iOutError);
+
+            iOutError = KErrNone;
+
+        }
+
+        else if ( iClipProcessed )
+        {
+            // a clip has been processed
+            iClipProcessed = EFalse;
+            iProcessor->FinalizeVideoClip();
+        }        
+        
+        else 
+        {
+            if ( iComplete ) 
+            {
+                // If the movie has been completed, report that:            
+                iComplete = EFalse;
+                iObserver->NotifyMovieProcessingCompleted(*iMovie, KErrNone);
+                    
+            }
+        }
+    }
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CStatusMonitor
+
+    DoCancel()
+
+    Cancels the internal request
+
+-----------------------------------------------------------------------------
+*/
+
+void CStatusMonitor::DoCancel()
+{
+    // Cancel it:
+    TRequestStatus *status = &iStatus;
+    User::RequestComplete(status, KErrCancel);
+}
+
+
+
+
+//  OTHER EXPORTED FUNCTIONS
+
+
+//=============================================================================
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/videoprocessor.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,6628 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation for video processor.
+*
+*/
+
+
+//  Include Files
+
+#include "vedcommon.h"
+#include "movieprocessorimpl.h"
+#include "statusmonitor.h"
+#include "activequeue.h"
+#include "dataprocessor.h"
+#include "h263dmai.h"  // CVedH263Dec
+#include "mp4parser.h"
+#include "videoencoder.h"
+#include "videoprocessor.h"
+#include "mpeg4timer.h"
+#include "vedvolreader.h"
+#include "vedvideosettings.h"
+#include "vedavcedit.h"
+
+// Local constants
+const TUint KInitialDataBufferSize = 8192; // initial frame data buffer size
+const TUint KH263StartCodeLength = 3;  // H.263 picture start code length
+const TUint KMPEG4StartCodeLength = 4; // MPEG4 picture start code length
+//const TUint KMaxEncodingDelay = 500000; // time to wait for encoding to complete in microsec.
+const TUint KDefaultTimeIncrementResolution = 30000;
+const TUint KAVCNotCodedFrameBuffer = 128;
+const TUint KMaxItemsInProcessingQueue = 3;     // note! this must be synchronized with KTRMinNumberOfBuffersCodedPicture setting in transcoder!
+
+
+#ifdef _DEBUG
+const TInt KErrorCode = CVideoProcessor::EDecoderFailure;
+#else
+const TInt KErrorCode = KErrGeneral;
+#endif
+
+// An assertion macro wrapper to clean up the code a bit
+#define VDASSERT(x, n) __ASSERT_DEBUG(x, User::Panic(_L("CVideoProcessor"), EInternalAssertionFailure+n)) 
+
+// Debug print macro
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+// ================= STATIC FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// AddBits
+// Static helper function to add bits to byte-buffer
+// ---------------------------------------------------------
+//
+static void AddBits(TUint8* aBuf, TInt& aBitIndex, TInt& aByteIndex, TInt aBits, TInt aNrOfBits)
+    {
+    // aBitIndex = 8 => first bit in the left
+    // aBitIndex = 1 => last bit in the right
+    while ( aBitIndex < aNrOfBits )
+        {
+        // divide into n bytes
+        aBuf[aByteIndex++] |= TUint8( aBits >> (aNrOfBits-aBitIndex) );
+        aNrOfBits -= aBitIndex;
+        aBitIndex = 8;
+        }
+    // all bits fit into 1 byte
+    aBitIndex -= aNrOfBits;
+    aBuf[aByteIndex] |= TUint8( aBits << aBitIndex );
+    if (aBitIndex == 0)
+        {
+        aBitIndex = 8;
+        aByteIndex++;
+        }
+    }
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::NewL
+// Symbian two-phased constructor.
+// ---------------------------------------------------------
+//
+
+CVideoProcessor* CVideoProcessor::NewL(CActiveQueue *anInputQueue,
+                                       CVideoProcessor::TStreamParameters *aStreamParameters,
+                                       CMovieProcessorImpl* aProcessor,
+                                       CStatusMonitor *aStatusMonitor,
+                                       CVedAVCEdit *aAvcEdit,
+                                       TBool aThumbnailMode,
+                                       TInt aPriority)
+{
+    CVideoProcessor *self = new (ELeave) CVideoProcessor(anInputQueue,
+                                                         aStreamParameters,
+                                                         aProcessor,
+                                                         aStatusMonitor,  
+                                                         aAvcEdit,                                                 
+                                                         aThumbnailMode,
+                                                         aPriority);
+
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::CVideoProcessor
+// Constructor.
+// ---------------------------------------------------------
+//
+CVideoProcessor::CVideoProcessor(CActiveQueue *anInputQueue,
+                                 TStreamParameters *aStreamParameters,
+                                 CMovieProcessorImpl* aProcessor,
+                                 CStatusMonitor *aStatusMonitor,
+                                 CVedAVCEdit *aAvcEdit,
+                                 TBool aThumbnailMode, 
+                                 TInt aPriority) : CVideoDecoder(aPriority),
+                                 iWriteDes(0,0),
+                                 iThumbnailMode(aThumbnailMode)
+{
+
+	// Remember the objects
+	iQueue = anInputQueue;
+	iMonitor = aStatusMonitor;
+    iProcessor = aProcessor;	
+    iAvcEdit = aAvcEdit;
+
+	// Remember the stream parameters
+	iVideoWidth = aStreamParameters->iWidth;
+	iVideoHeight = aStreamParameters->iHeight;	
+
+    // Color Toning
+	iFirstFrameQp = 0;
+	
+	iTiming = aStreamParameters->iTiming;
+	// Reset state
+	iReaderSet = EFalse;
+	iDecoding = EFalse;
+	iStreamEnd = EFalse;	
+	iPreviousFrameIncluded = EFalse; 
+	iFrameOperation = EDecodeAndWrite;
+	
+	iTrPrevious = -1;	
+
+    iFirstFrameFlag = ETrue;
+    iDecodePending = EFalse;
+    
+    iTranscoderStarted = EFalse;
+    iDecodingSuspended = EFalse;
+
+	iStartTransitionColor = EColorNone;	
+	iEndTransitionColor = EColorNone;
+	iStartNumberOfTransitionFrames = KNumTransitionFrames;
+	iEndNumberOfTransitionFrames = KNumTransitionFrames;
+	iNextTransitionNumber = -1;
+	iProcessingComplete = EFalse;
+	iStreamEndRead = EFalse;
+	
+	iPreviousTimeStamp = TTimeIntervalMicroSeconds(-1);
+	
+	iFirstRead = ETrue;
+	
+	iThumbDecoded = EFalse;		
+	
+	iMaxItemsInProcessingQueue = KMaxItemsInProcessingQueue;
+
+    iDataFormat = EDataUnknown;
+
+    iLastWrittenFrameNumber = -1;
+    
+    iInitializing = ETrue;
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::~CVideoProcessor()
+// Destructor
+// ---------------------------------------------------------
+//
+CVideoProcessor::~CVideoProcessor()
+{
+
+	// If we are decoding, stop
+	if (iDecoding)
+		Stop();
+	
+	// Remove from being a reader
+	if (iReaderSet)
+	{
+		// Return current block and all 
+		// blocks from input queue
+		if (iBlock)    
+		{
+		    if (iQueue)
+			    iQueue->ReturnBlock(iBlock);
+		}
+					
+        if (iQueue)						
+		    iBlock = iQueue->ReadBlock();
+		
+		while (iBlock)
+		{
+		    if (iQueue)
+		    {		        
+			    iQueue->ReturnBlock(iBlock);
+			    iBlock = iQueue->ReadBlock();
+		    }
+		}
+		iBlockPos = 0;
+		
+		if (iQueue)
+		    iQueue->RemoveReader();
+	}
+	Cancel();
+	
+	if (iTransCoder)
+	{	    
+	    if (iTranscoderStarted)
+	    {
+	        TRAPD(error, iTransCoder->StopL());
+		    if (error != KErrNone) { }
+	    }
+	    delete iTransCoder;
+	    iTransCoder = 0;	
+	}
+	
+	iFrameInfoArray.Reset();
+	
+	// Close the decoder instance if one has been opened
+    if (iDecoder)
+        delete iDecoder;
+    iDecoder = 0;   
+    
+	// Deallocate buffers
+	if (iDataBuffer)
+		User::Free(iDataBuffer);
+	
+	if (iOutVideoFrameBuffer)
+		User::Free(iOutVideoFrameBuffer);
+
+    if (iFrameBuffer)
+        User::Free(iFrameBuffer);
+
+	if ( iColorTransitionBuffer )
+		User::Free( iColorTransitionBuffer );
+
+	if ( iOrigPreviousYUVBuffer )
+		User::Free( iOrigPreviousYUVBuffer );
+	
+	if (iMediaBuffer)
+	    delete iMediaBuffer;
+	iMediaBuffer = 0;
+	
+	if (iDecoderSpecificInfo)
+	    delete iDecoderSpecificInfo;
+    iDecoderSpecificInfo = 0;
+    
+    if (iOutputVolHeader)
+	    delete iOutputVolHeader;
+    iOutputVolHeader = 0;
+    
+    if (iDelayedBuffer)
+        delete iDelayedBuffer;
+    iDelayedBuffer = 0;
+    
+    if (iMPEG4Timer)
+        delete iMPEG4Timer;
+    iMPEG4Timer = 0;
+    
+    if (iTimer)
+        delete iTimer;
+    iTimer = 0;
+    
+    if (iNotCodedFrame)
+        delete iNotCodedFrame;
+    iNotCodedFrame = 0;
+       
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------
+//
+void CVideoProcessor::ConstructL()
+{
+ 	// Set as a reader to the input queue
+	iQueue->SetReader(this, NULL);
+	iReaderSet = ETrue;
+
+    // Add us to active scheduler
+    CActiveScheduler::Add(this);
+
+    iMediaBuffer = new (ELeave)CCMRMediaBuffer;
+	
+	// Allocate buffers
+	iDataBuffer = (TUint8*) User::AllocL(KInitialDataBufferSize);
+	iBufferLength = KInitialDataBufferSize; 
+
+    if ( iThumbnailMode )
+    {           
+    	TSize a = iProcessor->GetMovieResolution();
+    	TInt length = a.iWidth*a.iHeight;
+        
+        length += (length>>1);
+        iFrameBuffer = (TUint8*)User::AllocL(length);
+    }
+	
+    TSize size(iVideoWidth, iVideoHeight);
+
+    if (!iThumbnailMode)
+    {        
+        // Open a decoder instance
+        iDecoder = CVedH263Dec::NewL(size, 1 /*iReferencePicturesNeeded*/);
+    	    	
+    	// create timer
+    	iTimer = CCallbackTimer::NewL(*this);
+    }
+    
+    // Make us active
+    SetActive();
+    iStatus = KRequestPending;
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::Start
+// Starts decoding
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::Start()
+{
+	if ( iDecoding )
+		return;
+
+    // Activate the object if we have data
+    if ( (!iDecodePending) && (iStatus == KRequestPending) && iQueue->NumDataBlocks() )
+    {
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+    }
+    
+    iDecoding = ETrue;
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::Stop
+// Stops decoding
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+void CVideoProcessor::Stop()
+{
+	iDecoding = EFalse;
+		
+    if (iTimer)
+        iTimer->CancelTimer();
+    
+	if (iTranscoderStarted)
+    {                
+        TRAPD(error, iTransCoder->StopL());
+        if (error != KErrNone) { }
+        iTranscoderStarted = EFalse;
+    }    	
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::RunL
+// Standard active object running method			
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+					
+void CVideoProcessor::RunL()
+{
+	PRINT((_L("CVideoProcessor::RunL() in")))
+	
+	// Don't decode if we aren't decoding
+    if (!iDecoding)
+    {
+        if (!IsActive())
+        {
+            SetActive();
+            iStatus = KRequestPending;
+        }        
+    	PRINT((_L("CVideoProcessor::RunL() out from !iDecoding branch")))
+        return;		
+    }            
+    
+    if (iTranscoderInitPending)
+    {        
+        iTranscoderInitPending = EFalse;        
+        if (iStatus != KErrNone)
+        {
+            if (!iThumbnailMode)
+            {                
+                VDASSERT(iMonitor, 101);
+                iMonitor->Error(iStatus.Int());
+            } 
+            else
+            {
+                iProcessor->NotifyThumbnailReady(iStatus.Int());
+            }
+                
+            return;
+        }
+        // at this point we have already read a frame, 
+        // so now start processing                
+        iTransCoder->StartL();
+                
+        // stop if a fatal error has occurred in starting 
+        // the transcoder (decoding stopped in MtroFatalError)
+        if (!iDecoding)
+            return;
+        
+        iTranscoderStarted = ETrue;
+        
+        if (!iThumbnailMode)
+        {
+            ProcessFrameL();
+            if (iDecodePending)
+                return;
+        }
+        else
+        {
+            ProcessThumb(ETrue);
+            return;
+        }        
+    }
+        
+    if (iDecodePending)
+    {
+        iDecodePending = EFalse;        
+
+        if (iThumbnailMode)
+        {
+             if (iThumbDecoded)
+             {
+                 PRINT((_L("CVideoProcessor::RunL() - thumb decoded")))  
+                 ProcessThumb(EFalse);
+             }
+             else
+             {
+                 PRINT((_L("CVideoProcessor::RunL() - thumb not decoded")))    
+                 ReadAndWriteThumbFrame();
+             }
+             return;
+        }
+    }
+    
+    if (iProcessingComplete)
+    {       
+        PRINT((_L("CVideoProcessor::RunL() iProcessingComplete == ETrue")))
+        VDASSERT(iMonitor, 102);
+        iMonitor->ClipProcessed();
+        return;
+    }
+    
+    if (iFirstColorTransitionFrame)
+    {
+        Process2ndColorTransitionFrameL();
+        return;
+    }
+
+    while (!iDecodePending && !iDelayedWrite && !iTranscoderInitPending &&
+             ReadFrame() )
+    {    
+        // process it       
+        if ( ProcessFrameL() )
+        {                        
+            // clip processed up until cut-out time, stop 
+            if (iFrameInfoArray.Count())            
+            {
+                PRINT((_L("CVideoProcessor::RunL() - stream end reached, wait for frames")));
+                iStreamEnd = iStreamEndRead = ETrue;
+                
+                // if there are still frames to be encoded, start timer 
+                // since encoder may skip the rest of the frames
+                if ( IsNextFrameBeingEncoded() )
+                {
+                    PRINT((_L("CVideoProcessor::RunL(), set timer")));
+                    if ( !iTimer->IsPending() )
+                        iTimer->SetTimer( TTimeIntervalMicroSeconds32( iMaxEncodingDelay ) );                                        
+                }
+                return;   
+            }
+            
+            iTimer->CancelTimer();
+            if (iTranscoderStarted)
+            {                
+                iTransCoder->StopL();
+                iTranscoderStarted = EFalse;
+            }
+            VDASSERT(iMonitor, 103);
+            iMonitor->ClipProcessed();
+        	PRINT((_L("CVideoProcessor::RunL() out from ProcessFrameL == ETrue")))
+            return;
+        }        
+    }
+    
+    if ( !iDecodePending && !iDelayedWrite && !iTranscoderInitPending )
+    {
+    
+        // We didn't get a frame
+        if (iStreamEnd)
+        {
+            iStreamEndRead = ETrue;
+            PRINT((_L("CVideoProcessor::RunL() - stream end reached")));    
+            if (iFrameInfoArray.Count())
+            {
+                PRINT((_L("CVideoProcessor::RunL() - stream end reached, wait for frames")));    
+                // wait until frames have been processed   
+                
+                // if there are still frames to be encoded, start timer 
+                // since encoder may skip the rest of the frames
+                if ( IsNextFrameBeingEncoded() )
+                {
+                    PRINT((_L("CVideoProcessor::RunL(), set timer")));
+                    if ( !iTimer->IsPending() )
+                        iTimer->SetTimer( TTimeIntervalMicroSeconds32( iMaxEncodingDelay ) );
+                }
+                return;
+            }
+            else
+            {    
+                iTimer->CancelTimer();
+                VDASSERT(iMonitor, 104);                
+                iMonitor->ClipProcessed();
+            }
+        }
+        else
+        {
+            if (!IsActive())
+            {
+                SetActive();
+                iStatus = KRequestPending;
+            }
+        }
+    }
+
+	PRINT((_L("CVideoProcessor::RunL() out")))
+      
+}
+
+// -----------------------------------------------------------------------------
+// CVideoProcessor::RunError
+// Called by the AO framework when RunL method has leaved
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//	
+TInt CVideoProcessor::RunError(TInt aError)
+{
+
+   if ((aError == CVedH263Dec::EDecoderNoIntra) || (aError == CVedH263Dec::EDecoderCorrupted))
+   {       
+       if (!iThumbnailMode)
+           iMonitor->Error(KErrCorrupt);
+       else
+           iProcessor->NotifyThumbnailReady(KErrCorrupt);
+   }
+   else
+   {
+       if (!iThumbnailMode)
+           iMonitor->Error(aError);
+       else
+           iProcessor->NotifyThumbnailReady(aError);
+   }
+
+    return KErrNone;
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::Process2ndColorTransitionFrameL
+// Processes the second frame of a color transition double frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CVideoProcessor::Process2ndColorTransitionFrameL()
+{    
+
+    TFrameInformation frameInfo;
+    frameInfo.iTranscoderMode = EFullWithIM;
+    frameInfo.iFrameNumber = iFrameNumber;
+    frameInfo.iEncodeFrame = ETrue;
+    frameInfo.iKeyFrame = EFalse;
+    frameInfo.iTransitionFrame = ETrue;
+    frameInfo.iTransitionPosition = EPositionStartOfClip;
+    frameInfo.iTransitionColor = iStartTransitionColor;
+    frameInfo.iTransitionFrameNumber = iTransitionFrameNumber;
+    frameInfo.iModificationApplied = EFalse;   
+    frameInfo.iRepeatFrame = ETrue;
+        
+    TInt duration;
+    // get timestamp
+    iProcessor->GetNextFrameDuration(duration, frameInfo.iTimeStamp, iTimeStampIndex, iTimeStampOffset);
+    iTimeStampIndex++;        
+    
+    frameInfo.iTimeStamp += iCutInTimeStamp;
+    
+    TTimeIntervalMicroSeconds ts = (iProcessor->GetVideoTimeInMsFromTicks(frameInfo.iTimeStamp, EFalse)) * 1000;
+    
+    if (ts <= iPreviousTimeStamp)
+    {            
+        // adjust timestamp so that its bigger than ts of previous frame
+        TReal frameRate = iProcessor->GetVideoClipFrameRate();
+        VDASSERT(frameRate > 0.0, 105);
+        TInt64 durationMs =  TInt64( ( 1000.0 / frameRate ) + 0.5 );
+        durationMs /= 2;  // add half the duration of one frame
+        
+        ts = TTimeIntervalMicroSeconds( iPreviousTimeStamp.Int64() + durationMs*1000 );
+        
+        frameInfo.iTimeStamp = iProcessor->GetVideoTimeInTicksFromMs( ts.Int64()/1000, EFalse );
+        
+        ts = iProcessor->GetVideoTimeInMsFromTicks(frameInfo.iTimeStamp, EFalse) * 1000;
+        
+        PRINT((_L("CVideoProcessor::Process2ndColorTransitionFrameL() - adjusted timestamp, prev = %d, new = %d"), 
+                   I64INT( iPreviousTimeStamp.Int64() ) / 1000, I64INT( ts.Int64() ) / 1000));    
+
+    }        
+    
+ 
+    iFrameInfoArray.Append(frameInfo);
+    
+    iPreviousTimeStamp = ts;
+    
+    iFirstColorTransitionFrame = EFalse;   
+    
+    CCMRMediaBuffer::TBufferType bt = 
+        (iDataFormat == EDataH263) ? CCMRMediaBuffer::EVideoH263 : CCMRMediaBuffer::EVideoMPEG4;
+    
+    if (!iNotCodedFrame)
+        GenerateNotCodedFrameL();
+    
+    PRINT((_L("CVideoProcessor::Process2ndColorTransitionFrameL() - sending not coded")));
+    
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+    if (iDataFormat == EDataAVC)
+    {        
+        TPtr8 ptr(iNotCodedFrame->Des());
+        
+        TInt length = iNotCodedFrame->Length();
+        iAvcEdit->ProcessAVCBitStreamL((TDes8&)(ptr), length, 0 /*dummy*/, EFalse );
+        ptr.SetLength(length);
+        iDataLength = iCurrentFrameLength = length;
+    }
+#endif
+
+    iMediaBuffer->Set( TPtrC8(iNotCodedFrame->Des().Ptr(), iNotCodedFrame->Length()),                           
+                       bt, 
+                       iNotCodedFrame->Length(), 
+                       EFalse,
+                       ts );
+
+    iDecodePending = ETrue;
+    if (!IsActive())
+    {
+        SetActive();
+        iStatus = KRequestPending;                                
+    }                
+                                      
+    PRINT((_L("CVideoProcessor::Process2ndColorTransitionFrameL() - WriteCodedBuffer, frame #%d, timestamp %d ms"),
+           iFrameNumber, I64INT( ts.Int64() ) / 1000 ));                                                  
+    iTransCoder->WriteCodedBufferL(iMediaBuffer);
+                
+    iFrameNumber++;
+    
+    return ETrue;
+    
+}
+
+    
+// ---------------------------------------------------------
+// CVideoProcessor::GenerateNotCodedFrameL
+// Generate bitstream for not coded frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::GenerateNotCodedFrameL()
+{
+
+    TSize resolution = iProcessor->GetVideoClipResolution();
+
+    if (iDataFormat == EDataH263)
+    {
+        // H.263 QCIF picture header
+        TInt headerSize = 7;
+        TUint8 notCodedH263[] = { 0x00, 0x00, 0x80, 0x02, 0x0a, 0x0c, 0x3f };
+        TUint8 lsbMask[8] = { 255, 254, 252, 248, 240, 224, 192, 128 };
+        
+        
+        if ( resolution == TSize(128,96) )
+            notCodedH263[4] = 0x06;  // set source format as sub-QCIF
+        
+        else if ( resolution == TSize(352, 288) )
+            notCodedH263[4] = 0x0e;  // set source format as CIF
+            
+        else if ( resolution != TSize(176,144) )
+            User::Panic(_L("CVideoProcessor"), EInternalAssertionFailure);
+        
+        TInt numMBs = ( resolution.iWidth / 16 ) * ( resolution.iHeight / 16 );    
+        
+        // one COD bit for each MB, the last byte of the pic header already contains 6 MB bits
+        TInt bitsLeft = numMBs - 6;  
+        
+        TInt bufSize = headerSize + ( bitsLeft / 8 ) + ( bitsLeft % 8 != 0 );
+
+        VDASSERT(!iNotCodedFrame, 117);
+        iNotCodedFrame = (HBufC8*) HBufC8::NewL(bufSize);
+        
+        TPtr8 buf(iNotCodedFrame->Des());
+        buf.Copy(notCodedH263, headerSize);
+        
+        TInt index = headerSize;
+        TUint8* ptr = const_cast<TUint8*>(buf.Ptr());
+        
+        // set COD bit to 1 for all macroblocks
+        while (bitsLeft >= 8)
+        {
+            ptr[index++] = 0xff;
+            bitsLeft -= 8;
+        }
+        
+        if (bitsLeft)
+        {        
+            TUint8 val = 0;    
+            val |= lsbMask[8 - bitsLeft];
+            ptr[index] = val;
+        }
+        buf.SetLength(bufSize);
+    } 
+    
+    else if (iDataFormat == EDataMPEG4)
+    {
+        VDASSERT(iDataFormat == EDataMPEG4, 115);
+
+        TUint8 vopStartCodeMPEG4[] = { 0x00, 0x00, 0x01, 0xb6 };
+        
+        TInt headerSize = 4;
+
+        // calculate the number of bits needed for vop_time_increment
+        TInt numTiBits;
+        for (numTiBits = 1; ((iInputTimeIncrementResolution - 1) >> numTiBits) != 0; numTiBits++)
+        {
+        }        
+        
+        VDASSERT(numTiBits <= 16, 116);
+
+        TInt numMBs = ( resolution.iWidth / 16 ) * ( resolution.iHeight / 16 );
+        
+        // get VOP size
+        //   vop_start_code: 32
+        //   vop_coding_type + modulo_time_base + marker_bit: 4
+        //   no. of bits for vop_time_increment
+        //   marker_bit + vop_coded bit: 2
+        //   rounding_type: 1
+        //   intra_dc_vlc_thr: 3
+        //   vop_quant: 5
+        //   vop_fcode_forward: 3
+        //   not_coded for each MB: numMBs
+        TInt bufSizeBits = headerSize * 8 + 4 + numTiBits + 2 + 1 + 3 + 5 + 3 + numMBs;//DP mode not included!
+        if ( (iInputStreamMode == EVedVideoBitstreamModeMPEG4DP)
+            || (iInputStreamMode == EVedVideoBitstreamModeMPEG4DP_RVLC)
+            || (iInputStreamMode == EVedVideoBitstreamModeMPEG4Resyn_DP)
+            || (iInputStreamMode == EVedVideoBitstreamModeMPEG4Resyn_DP_RVLC)
+            )
+            {
+            // Motion marker in DP mode
+            bufSizeBits+=17;
+            }
+        TInt bufSize = ( bufSizeBits / 8 ) + 1;        // always 1-8 stuffing bits
+        
+        VDASSERT(!iNotCodedFrame, 118);
+        iNotCodedFrame = (HBufC8*) HBufC8::NewL(bufSize);
+        
+        TPtr8 buf(iNotCodedFrame->Des());
+        buf.SetLength(bufSize);
+        buf.FillZ();
+        buf.SetLength(0);
+        buf.Copy(vopStartCodeMPEG4, headerSize);
+        
+        TUint8* ptr = const_cast<TUint8*>(buf.Ptr());        
+        TInt shift = 8;
+        TInt index = headerSize;
+        AddBits(ptr, shift, index, 1, 2); // vop_coding_type
+        AddBits(ptr, shift, index, 0, 1); // modulo_time_base
+        AddBits(ptr, shift, index, 1, 1); // marker_bit
+        
+        // vop_time_increment is left to zero (skip FillZ bits)
+        AddBits(ptr, shift, index, 0, numTiBits);
+            
+        // marker (1 bit; 1) 
+        AddBits(ptr, shift, index, 1, 1);
+        // vop_coded (1 bit; 1=coded)
+        AddBits(ptr, shift, index, 1, 1);
+        
+        // vop_rounding_type (1 bit) (0)
+        AddBits(ptr, shift, index, 0, 1);
+        
+        // intra_dc_vlc_thr (3 bits) (0 = Intra DC, but don't care)
+        AddBits(ptr, shift, index, 0, 3);
+        
+        // vop_quant (5 bits) (1-31)
+        AddBits(ptr, shift, index, 10, 5);
+        
+        // vop_fcode_forward (3 bits) (1-7, 0 forbidden)
+        AddBits(ptr, shift, index, 1, 3);
+        
+        // Macroblocks
+        
+        // one COD bit for each MB
+        TInt bitsLeft = numMBs;  
+        
+        // set COD bit to 1 for all macroblocks (== not coded)
+        while (bitsLeft >= 8)
+        {
+            AddBits(ptr, shift, index, 0xff, 8);
+            bitsLeft -= 8;
+        }
+        
+        TUint8 lsb[8] = { 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01 };
+        if (bitsLeft)
+        {        
+            TUint8 val = 0;    
+            val = lsb[8 - bitsLeft];
+            AddBits(ptr, shift, index, val, bitsLeft);
+        }
+        // If DP mode is used, should add motion marker here: 1 11110000 00000001
+        if ( (iInputStreamMode == EVedVideoBitstreamModeMPEG4DP)
+            || (iInputStreamMode == EVedVideoBitstreamModeMPEG4DP_RVLC)
+            || (iInputStreamMode == EVedVideoBitstreamModeMPEG4Resyn_DP)
+            || (iInputStreamMode == EVedVideoBitstreamModeMPEG4Resyn_DP_RVLC)
+            )
+            {
+            AddBits(ptr, shift, index, 0x01, 1);
+            AddBits(ptr, shift, index, 0xf0, 8);
+            AddBits(ptr, shift, index, 0x01, 8);
+            }
+        
+        // insert stuffing in last byte
+        TUint8 stuffing[8] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f };
+        ptr[bufSize - 1] |= stuffing[shift-1];
+                       
+        buf.SetLength(bufSize);
+            
+    } 
+    else
+    {        
+#ifdef VIDEOEDITORENGINE_AVC_EDITING    
+
+        VDASSERT(iDataFormat == EDataAVC, 115);
+        
+        VDASSERT(!iNotCodedFrame, 118);
+        iNotCodedFrame = (HBufC8*) HBufC8::NewL(KAVCNotCodedFrameBuffer);
+        
+        TPtr8 buf( const_cast<TUint8*>(iNotCodedFrame->Des().Ptr()), 
+                   KAVCNotCodedFrameBuffer, KAVCNotCodedFrameBuffer );
+        
+        TInt len = iAvcEdit->GenerateNotCodedFrame( buf, iModifiedFrameNumber++ );        
+        
+        if (len == 0)
+            User::Leave(KErrArgument);
+                
+        TPtr8 temp(iNotCodedFrame->Des());
+        temp.SetLength(len);        
+#else
+        VDASSERT(0, 190);
+#endif
+    }
+    
+    
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::ProcessFrameL
+// Processes one input frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CVideoProcessor::ProcessFrameL()
+    {
+
+
+	PRINT((_L("CVideoProcessor::ProcessFrameL() begin")));
+
+    VDASSERT(iCurrentFrameLength,1);    
+        
+    TInt frameInRange = 0;    
+    TInt frameDuration = 0;    
+    TBool keyFrame = EFalse; 
+    TTimeIntervalMicroSeconds startCutTime = TTimeIntervalMicroSeconds(0);
+    TTimeIntervalMicroSeconds endCutTime = TTimeIntervalMicroSeconds(0);
+    TTimeIntervalMicroSeconds frameTime = TTimeIntervalMicroSeconds(0);
+
+    TInt trP = iProcessor->GetTrPrevNew();    
+    TInt trD = iProcessor->GetTrPrevOrig();
+
+    // transitions
+    iTransitionFrame = 0;			// is this a transition frame?
+    iTransitionPosition = EPositionNone;
+    iTransitionColor = EColorNone;    
+    iFirstTransitionFrame = 0;		// is this the first transition frame in this instance?
+    TBool endColorTransitionFrame = EFalse;
+    
+    TBool decodeCurrentFrame = 0;	// do we need to decode frame for transition effect?
+   
+    // book-keeping
+    startCutTime = iProcessor->GetStartCutTime();
+    endCutTime = iProcessor->GetEndCutTime();
+	iRepeatFrame = EFalse;
+
+    if(iInitializing)
+    {
+    
+        // determine if we need to do full transcoding
+		iFullTranscoding = DetermineResolutionChange() || DetermineFrameRateChange() || 
+		                   DetermineBitRateChange();
+		                   		
+        // Do full transcoding for MPEG-4 => H.263. MPEG-4 => MPEG-4 and H.263 => MPEG-4 can be done in compressed domain
+        if ( iProcessor->GetCurrentClipVideoType() == EVedVideoTypeMPEG4SimpleProfile &&
+             iProcessor->GetOutputVideoType() != EVedVideoTypeMPEG4SimpleProfile )
+            iFullTranscoding = ETrue;
+		               
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+        // Do full transcoding for AVC => H.263/MPEG-4
+		if ( iProcessor->GetCurrentClipVideoType() == EVedVideoTypeAVCBaselineProfile &&
+		     iProcessor->GetOutputVideoType() != EVedVideoTypeAVCBaselineProfile )
+            iFullTranscoding = ETrue;
+            
+        // Do full transcoding for H.263/MPEG-4 => AVC
+        if ( iProcessor->GetCurrentClipVideoType() != EVedVideoTypeAVCBaselineProfile &&
+		     iProcessor->GetOutputVideoType() == EVedVideoTypeAVCBaselineProfile )
+            iFullTranscoding = ETrue;
+                                            
+        // Do color effects for AVC in spatial domain                    
+        if ( iProcessor->GetOutputVideoType() == EVedVideoTypeAVCBaselineProfile &&
+             iProcessor->GetColorEffect() != EVedColorEffectNone )
+            iFullTranscoding = ETrue;
+#endif
+
+        // determine transition parameters for the clip 
+        DetermineClipTransitionParameters(iTransitionEffect,iStartOfClipTransition,
+            iEndOfClipTransition,iStartTransitionColor,iEndTransitionColor);
+    
+        if (!iTransCoder)
+        {
+            // initialize transcoder, normal mode
+            CreateAndInitializeTranscoderL(iProcessor->GetCurrentClipVideoType(), CTRTranscoder::EFullTranscoding);
+            return EFalse;
+        }
+    
+		if ( iColorTransitionBuffer )
+		{
+			User::Free( iColorTransitionBuffer );
+			iColorTransitionBuffer = 0;
+		}
+		
+		if ( iOrigPreviousYUVBuffer )
+		{
+			User::Free( iOrigPreviousYUVBuffer );
+			iOrigPreviousYUVBuffer = 0;
+		}
+
+        iFirstFrameInRange = 0;
+        iFirstIncludedFrameNumber = -1;
+        iTimeStampIndex = 0;
+        iTimeStampOffset = 0;
+        //iProcessor->iOutputFramesInClip=0; 
+        iPreviousFrameIncluded = EFalse; 
+        iNumberOfFrames = iProcessor->GetClipNumberOfFrames();	
+        
+        // calculate number of included frames
+        if(iTransitionEffect)
+        {
+            GetNumberOfTransitionFrames(startCutTime, endCutTime);                    
+        }
+        iInitializing = EFalse;
+    }
+
+    TInt startFrame = iProcessor->GetOutputNumberOfFrames() - iNumberOfFrames;
+    TInt absFrameNumber = startFrame + iFrameNumber;
+    
+    VDASSERT(startCutTime <= endCutTime,2);
+
+    // microseconds
+    frameTime = TTimeIntervalMicroSeconds(iProcessor->GetVideoTimeInMsFromTicks(
+        iProcessor->VideoFrameTimeStamp(absFrameNumber), EFalse) * 1000);
+    keyFrame = iProcessor->VideoFrameType(absFrameNumber);
+
+	TInt cur = absFrameNumber; 
+	TInt next = cur+1;
+	
+	TTimeIntervalMicroSeconds frameDurationInMicroSec(0);
+
+	// frameDuration is in ticks, with timescale of the current input clip
+	if(next >= iProcessor->GetOutputNumberOfFrames())	
+	{	    
+		frameDurationInMicroSec = 
+			(iProcessor->GetVideoTimeInMsFromTicks(iProcessor->GetVideoClipDuration(), EFalse) * TInt64(1000)) - frameTime.Int64();		
+		
+		frameDuration = I64INT(iProcessor->GetVideoClipDuration() - iProcessor->VideoFrameTimeStamp(cur) );
+	}
+	else
+	{
+		frameDuration = I64INT( iProcessor->VideoFrameTimeStamp(next) - iProcessor->VideoFrameTimeStamp(cur) );
+		frameDurationInMicroSec = 
+			TTimeIntervalMicroSeconds(iProcessor->GetVideoTimeInMsFromTicks(TInt64(frameDuration), EFalse) * 1000);
+	}
+	
+	TTimeIntervalMicroSeconds frameEndTime = 
+		TTimeIntervalMicroSeconds( frameTime.Int64() + frameDurationInMicroSec.Int64() );    
+
+	// endCutTime is in TTimeIntervalMicroSeconds
+
+    // check if frame is in range for decoding/editing 
+    frameInRange = ((frameEndTime <= endCutTime) ? 1 : 0);
+    if(frameInRange)
+    {        
+
+        // transition is applied only for frame included in the output movie
+        if(frameTime >= startCutTime)
+        {
+            // find the offset for the first included frame in the clip
+            if(!iFirstFrameInRange)
+            {
+                iFirstFrameInRange = 1;
+                iFirstIncludedFrameNumber = iFrameNumber;
+                iModifiedFrameNumber = iFrameNumber + 1;  // +1 since number is incremented after modifying
+            }
+            TInt relativeIncludedFrameNumber = iFrameNumber - iFirstIncludedFrameNumber;            
+            
+            if(iTransitionEffect)
+            {                
+                // check if this is a transition frame & set transition parameters             
+                SetTransitionFrameParams(relativeIncludedFrameNumber, decodeCurrentFrame);
+            }
+        }
+        
+        // check if this is an end color transition frame        
+        if ( iTransitionFrame && iTransitionPosition == EPositionEndOfClip &&
+		     iEndTransitionColor == EColorTransition )
+		{
+		    endColorTransitionFrame = ETrue;
+			iFrameToEncode = EFalse; 
+		}
+				
+        // check if we need to include this frame into output movie 
+        if (frameTime < startCutTime)
+        {
+            // decode, but do not include in output movie 
+            // iPreviousFrameIncluded = EFalse; 
+            iFrameToEncode = EFalse; 
+            iFrameOperation = EDecodeNoWrite; 
+            // for decoding frames not writable to output movie, do not decode 
+            // with any effects, because all information is need at P->I conversion            
+        }
+        else	// include in output movie 
+        {
+            
+            // check if we need to encode it again as I-frame
+            if (iFullTranscoding || (!iPreviousFrameIncluded && !keyFrame) || iTransitionFrame)
+            {
+                 // need to decode as P and encode as I
+                 
+                if (!endColorTransitionFrame)
+                    iFrameToEncode = ETrue; 
+				
+                iFrameOperation = EDecodeNoWrite; 
+                // for first decoding of P frame in a clip, do not decode with any effects;
+                // instead, apply the effects in the spatial domain after decoding it as P;
+                // then feed it to the encoder with the applied special effects
+            }
+            else
+            {
+            
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+                // check if we need to encode AVC frames after 
+                // encoded cut frame or starting transition
+                if (iDataFormat == EDataAVC && iEncodeUntilIDR)
+                {
+                    TPtr8 ptr(iDataBuffer, iCurrentFrameLength, iBufferLength);
+                                        
+                    if (iAvcEdit->IsNALUnitIDR(ptr))
+                        iEncodeUntilIDR = 0; 
+                    else
+                    {
+                        // encode
+                        iFrameOperation = EDecodeNoWrite;				
+				        if (!endColorTransitionFrame)
+				            iFrameToEncode = ETrue;                        
+                    }
+                }
+#endif
+                
+                if (!iEncodeUntilIDR)
+                {   
+                    // just copy the frame data as it is 
+                
+                    TInt colorEffect = TColorEffect2TInt(iProcessor->GetColorEffect());
+                                        
+                    iFrameToEncode = EFalse;
+                    if(decodeCurrentFrame)
+                        iFrameOperation = EDecodeAndWrite; 
+                    else
+                        iFrameOperation = (colorEffect==0/*None*/ ? EWriteNoDecode : EDecodeAndWrite);                
+                }                
+            }
+            iPreviousFrameIncluded = ETrue;
+        }
+
+    }
+    else
+    {
+        // no need to include frame in output movie
+        iPreviousFrameIncluded = EFalse; 
+        iFrameToEncode = EFalse;
+        iFrameOperation = ENoDecodeNoWrite;
+
+        // stop processing
+        return ETrue;
+    }
+	
+    TBool modeChanged = GetModeChangeL(); // do we need to change the current mode? 
+
+	/* added to handle Mp4Specific size problem */
+	if(modeChanged && !iFullTranscoding) 
+	{
+        iProcessor->SetClipModeChanged(modeChanged);	//if it is not set, it will be default false
+	}
+
+    if (iFrameOperation == EDecodeAndWrite)
+        PRINT((_L("CVideoProcessor::ProcessFrameL() frame operation = EDecodeAndWrite")));
+    if (iFrameOperation == EWriteNoDecode)
+        PRINT((_L("CVideoProcessor::ProcessFrameL() frame operation = EWriteNoDecode")));        
+    if (iFrameOperation == EDecodeNoWrite)
+        PRINT((_L("CVideoProcessor::ProcessFrameL() frame operation = EDecodeNoWrite")));    
+    if (iFrameOperation == ENoDecodeNoWrite)
+        PRINT((_L("CVideoProcessor::ProcessFrameL() frame operation = ENoDecodeNoWrite")));    
+    
+    PRINT((_L("CVideoProcessor::ProcessFrameL() iFrameToEncode = %d"), iFrameToEncode));    
+    
+    TBool volHeaderIncluded = EFalse;
+    
+    if( (iFrameOperation == EDecodeAndWrite) || (iFrameOperation == EWriteNoDecode) ||
+       ((iFrameOperation == EDecodeNoWrite) && !iFullTranscoding && iFirstFrameFlag) )
+       // the last line is to enable processing of the 1st frame also if it would be decoded with transcoder, 
+       // to enable processing of the MPEG-4 VOL header by vedh263d.
+    {               
+        
+        TPtr8 ptr(0,0);
+        TBool doCompressedDomainTC =  modeChanged || iProcessor->GetColorEffect() != EVedColorEffectNone;                        
+
+        // If we need to do compressed domain bitstream manipulation at some
+        // point of the clip, all frames must be decoded by vedh263d to be 
+        // able to start bitstream modification in the middle of the clip, e.g.
+        // after a transition. If we are processing MPEG-4, all frames are
+        // manipulated by the decoder for changing timing information
+                   
+        if ( doCompressedDomainTC || (iDataFormat == EDataMPEG4 /*&& !iTransitionFrame*/) )
+        {
+            // use h263decoder to do bitstream modification
+            
+            // (if this is an end color transition frame, iFrameOperation is 
+            //  EDecodeNoWrite && iFrameToEncode == 0
+                
+            TInt frameOp = 1;  // EDecodeAndWrite
+            
+            if ( iFrameOperation == EDecodeNoWrite )
+                frameOp = 2; 
+            
+            if ( iFrameOperation == EWriteNoDecode && !modeChanged )
+                frameOp = 3;  // EWriteNoDecode
+        
+            TInt frameSize;                                          
+            
+            if (iDataFormat == EDataMPEG4 && iFirstFrameFlag)
+            {
+                InsertDecoderSpecificInfoL();
+                volHeaderIncluded = ETrue;
+            }
+            
+            // use h263decoder to do compressed domain transcoding
+            PRINT((_L("CVideoProcessor::ProcessFrameL() decode using vedh263d")));    
+            DecodeFrameL(frameOp, modeChanged, frameSize);
+            ptr.Set(iOutVideoFrameBuffer, frameSize, frameSize);                    
+        }
+        else
+        {   
+            // copy bitstream directly
+            ptr.Set(iDataBuffer, iCurrentFrameLength, iCurrentFrameLength);
+        }
+        
+        if (iFrameOperation == EDecodeAndWrite || iFrameOperation == EWriteNoDecode)
+        {
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+            if (iDataFormat == EDataAVC && iTransitionEffect && 
+                iStartTransitionColor == EColorTransition) 
+            {
+                if (!(iAvcEdit->IsNALUnitIDR(ptr)))
+                {        
+                    // modify frame number
+                    VDASSERT( (iFrameNumber > iFirstIncludedFrameNumber), 182 );
+                    iAvcEdit->ModifyFrameNumber(ptr, iModifiedFrameNumber++);       
+                    PRINT((_L("CVideoProcessor::ProcessFrameL() modified frame no. => #%d"), iModifiedFrameNumber - 1));
+                } 
+                else
+                    iModifiedFrameNumber = 1;  // this frame is IDR, start numbering from zero
+            }
+#endif
+            // Write to file            
+            if ( WriteFrameToFileL(ptr, frameDuration, absFrameNumber) )
+                return ETrue;
+        }
+        
+        if (iFrameOperation == EWriteNoDecode || 
+            (iFrameOperation == EDecodeAndWrite && !decodeCurrentFrame && doCompressedDomainTC))
+        {   
+            // NOTE: The 2nd condition is for B&W & compr.domain TC
+            
+            // if we are doing only compressed domain transcoding, theres no need to
+            // decode the frame using transcoder
+            
+            // Throw away the data for this frame:
+            VDASSERT(iDataLength >= iCurrentFrameLength,4);
+            Mem::Copy(iDataBuffer, iDataBuffer + iCurrentFrameLength,
+                iDataLength - iCurrentFrameLength);
+            iDataLength = iDataLength - iCurrentFrameLength;        
+            iCurrentFrameLength = 0;			  
+                        
+            // update and fetch the new Time Code for MPEG4 ES
+            if (iProcessor->GetOutputVideoType() == EVedVideoTypeMPEG4SimpleProfile &&
+                frameInRange && (frameTime >= startCutTime) )
+				
+		    {
+    			iMPEG4Timer->UpdateMPEG4Time(absFrameNumber, iFrameNumber, iProcessor->GetSlowMotionSpeed());
+		    }
+            
+            iFrameNumber++;                    
+            return EFalse; 
+        }
+    }
+    
+    // process using transcoder 
+    if (iFrameOperation == EDecodeNoWrite || iFrameOperation == EDecodeAndWrite)
+    {
+        WriteFrameToTranscoderL(absFrameNumber, keyFrame, volHeaderIncluded);
+    }
+    
+    // update and fetch the new Time Code for MPEG4 ES
+    if (iProcessor->GetOutputVideoType() == EVedVideoTypeMPEG4SimpleProfile &&
+        frameInRange && (frameTime >= startCutTime) )
+	{
+        iMPEG4Timer->UpdateMPEG4Time(absFrameNumber, iFrameNumber, iProcessor->GetSlowMotionSpeed());
+    }
+
+    iProcessor->SetTrPrevNew(trP);
+    iProcessor->SetTrPrevOrig(trD);
+    
+    if (!iFirstColorTransitionFrame)
+        iFrameNumber++;
+               
+    PRINT((_L("CVideoProcessor::ProcessFrameL() end")));
+
+    return EFalse; 
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::WriteFrameToFileL
+// Write frame to file
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CVideoProcessor::WriteFrameToFileL(TPtr8& aBuf, TInt aDurationInTicks, TInt aFrameNumber)
+{    
+   
+    // if there's a frame waiting to be encoded, we must not
+    // write this frame now. It will be written after all to-be-encoded
+    // frames have been written. New frames must not be processed
+    // until the delayed write has been completed                                
+                            
+    iDelayedWrite = !IsEncodeQueueEmpty();
+    
+    if (iDelayedWrite)
+    {
+        PRINT((_L("CVideoProcessor::WriteFrameToFileL() delayed write")));    
+        // save frame for later writing            
+        if (iDelayedBuffer)
+            delete iDelayedBuffer;
+        iDelayedBuffer = 0;
+        
+        iDelayedBuffer = (HBufC8*) HBufC8::NewL(aBuf.Length());                                
+                        
+        TPtr8 db(iDelayedBuffer->Des());        
+        db.Copy(aBuf);
+        
+        iDelayedTimeStamp = iProcessor->VideoFrameTimeStamp(aFrameNumber) + iTimeStampOffset;
+        iDelayedKeyframe = iProcessor->VideoFrameType(aFrameNumber);
+        iDelayedFrameNumber = iFrameNumber;
+        if ( IsNextFrameBeingEncoded() )
+        {
+            // start timer to wait for encoding to complete
+            if ( !iTimer->IsPending() )
+                iTimer->SetTimer( TTimeIntervalMicroSeconds32( iMaxEncodingDelay ) );
+        }        
+    } 
+    else
+    {
+        // write now
+        TInt error = iProcessor->WriteVideoFrameToFile(aBuf, 
+          ( iProcessor->VideoFrameTimeStamp(aFrameNumber) + iTimeStampOffset ),
+            aDurationInTicks, iProcessor->VideoFrameType(aFrameNumber), EFalse, EFalse, EFalse );
+        
+        // If movie has reached maximum size then stop processing   
+        if (error == KErrCompletion)
+        {
+            iFrameInfoArray.Reset();
+            return ETrue;
+        }
+        
+        // save frame number
+        iLastWrittenFrameNumber = iFrameNumber;
+        
+        User::LeaveIfError(error);                           
+    }            
+                  
+    return EFalse;
+    
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::WriteFrameToTranscoderL
+// Write frame to transcoder
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::WriteFrameToTranscoderL(TInt aFrameNumber, TBool aKeyFrame, TBool aVolHeaderInBuffer)
+{
+     
+    VDASSERT(iDataFormat != EDataUnknown, 30);
+      
+    // TODO: new buffertype for H.264
+    CCMRMediaBuffer::TBufferType bt = 
+        (iDataFormat == EDataH263) ? CCMRMediaBuffer::EVideoH263 : CCMRMediaBuffer::EVideoMPEG4;
+   
+    // insert dec. specific info header to beginning of buffer if it has not been sent
+    if (!iDecoderSpecificInfoSent && 
+        ( iDataFormat == EDataAVC || (iDataFormat == EDataMPEG4 && !aVolHeaderInBuffer) ) )
+    {
+        PRINT((_L("CVideoProcessor::WriteFrameToTranscoderL() - insert header"), iTranscoderMode));    
+        InsertDecoderSpecificInfoL();
+    }
+    
+    // determine transcoder mode for this frame
+    TTranscoderMode mode;
+            
+    if (iFrameToEncode)
+    {        
+        if ( iTransitionFrame || (iProcessor->GetColorEffect() != EVedColorEffectNone) )
+        {
+            PRINT((_L("CVideoProcessor::WriteFrameToTranscoderL() encode current frame with intermediate modification")));
+            mode = EFullWithIM;
+        } 
+        else
+        {
+            PRINT((_L("CVideoProcessor::WriteFrameToTranscoderL() encode current frame")));   
+            mode = EFull;
+        }            
+    } 
+    else
+    {
+        PRINT((_L("CVideoProcessor::WriteFrameToTranscoderL() only decode current frame")));   
+        mode = EDecodeOnly;
+    }                
+    
+    PRINT((_L("CVideoProcessor::WriteFrameToTranscoderL() iTranscoderMode %d"), iTranscoderMode));   
+    if (iTranscoderMode != mode)
+    {
+        if (mode == EDecodeOnly)
+        {
+            iTransCoder->EnableEncoder(EFalse);
+            iTransCoder->EnablePictureSink(ETrue);
+        } 
+        else if (mode == EFull)
+        {
+            iTransCoder->EnableEncoder(ETrue);
+            iTransCoder->EnablePictureSink(EFalse);
+        } 
+        else
+        {
+            iTransCoder->EnableEncoder(ETrue);
+            iTransCoder->EnablePictureSink(ETrue);
+        }                                  
+        iTranscoderMode = mode;
+    }
+    
+    if (iFrameToEncode)
+    {
+        // should we encode an I-frame ?
+        if( (iTransitionFrame && iFirstTransitionFrame) || 
+            (iFrameNumber == iFirstIncludedFrameNumber) ||
+             iFirstFrameAfterTransition )
+        {
+            iTransCoder->SetRandomAccessPoint();
+        }
+    }
+    
+    TFrameInformation frameInfo;        
+    frameInfo.iTranscoderMode = iTranscoderMode;
+    frameInfo.iFrameNumber = iFrameNumber;
+    frameInfo.iEncodeFrame = iFrameToEncode;
+    frameInfo.iKeyFrame = aKeyFrame;
+    
+    // this timestamp is in ticks for writing the frame
+    frameInfo.iTimeStamp = iProcessor->VideoFrameTimeStamp(aFrameNumber) + iTimeStampOffset;
+    frameInfo.iTransitionFrame = iTransitionFrame;
+    frameInfo.iTransitionPosition = iTransitionPosition;
+    frameInfo.iTransitionColor = iTransitionColor;
+    frameInfo.iTransitionFrameNumber = iTransitionFrameNumber;
+    frameInfo.iModificationApplied = EFalse;
+    
+    if(iTransitionFrame && iTransitionPosition == EPositionStartOfClip && 
+       iStartTransitionColor == EColorTransition)
+    {
+        TInt duration;
+        TInt64 currentTimeStamp = iProcessor->VideoFrameTimeStamp(aFrameNumber);
+        
+        // get timestamp for 1st frame            
+        iProcessor->GetNextFrameDuration(duration, frameInfo.iTimeStamp, iTimeStampIndex, iTimeStampOffset);
+        iTimeStampIndex++;
+                    
+        if (iFirstTransitionFrame)
+            iCutInTimeStamp = currentTimeStamp;
+        
+        frameInfo.iTimeStamp += iCutInTimeStamp;
+        
+        // the duration parameter is not used actually, so no need to figure it out
+        iProcessor->AppendNextFrameDuration(duration, currentTimeStamp - iCutInTimeStamp);
+        
+#ifdef VIDEOEDITORENGINE_AVC_EDITING    
+        if (iDataFormat == EDataAVC)
+        {        
+        
+            TPtr8 ptr(iDataBuffer, iCurrentFrameLength, iBufferLength);
+            if (!iDecoderSpecificInfoSent)
+            {
+                ptr.Set(iDataBuffer + iProcessor->GetDecoderSpecificInfoSize(), 
+                        iCurrentFrameLength - iProcessor->GetDecoderSpecificInfoSize(), iBufferLength);
+            }
+            
+            // Store PPS id
+            iAvcEdit->StoreCurrentPPSId( ptr );
+           
+            if (iNotCodedFrame)
+                delete iNotCodedFrame;
+            iNotCodedFrame = 0;                                 
+        }        
+#endif        
+        
+        frameInfo.iRepeatFrame = EFalse;            
+        iFirstColorTransitionFrame = ETrue; // to indicate that iDataBuffer must not be flushed
+                                            // in MtroReturnCodedBuffer
+    }    
+    
+#ifdef VIDEOEDITORENGINE_AVC_EDITING    
+    if ( iDataFormat == EDataAVC && iTransitionEffect && iStartTransitionColor == EColorTransition &&
+         (iFrameNumber > iFirstIncludedFrameNumber) && iFrameOperation != EDecodeAndWrite)
+    {
+       TPtr8 ptr(iDataBuffer, iCurrentFrameLength, iBufferLength);
+       
+       if (!iDecoderSpecificInfoSent)
+       {
+           ptr.Set(iDataBuffer + iProcessor->GetDecoderSpecificInfoSize(), 
+                        iCurrentFrameLength - iProcessor->GetDecoderSpecificInfoSize(), iBufferLength);
+       }
+       
+       if (!(iAvcEdit->IsNALUnitIDR(ptr)))
+       {        
+           // modify frame number
+           iAvcEdit->ModifyFrameNumber(ptr, iModifiedFrameNumber++);       
+           PRINT((_L("CVideoProcessor::WriteFrameToTranscoderL() modified frame no. => #%d"), iModifiedFrameNumber - 1));
+       }
+       else
+           iModifiedFrameNumber = 1;   // this frame is IDR, start numbering from zero
+    }
+#endif
+
+    // get timestamp in microseconds
+    TTimeIntervalMicroSeconds ts = 
+        (iProcessor->GetVideoTimeInMsFromTicks(frameInfo.iTimeStamp, EFalse)) * 1000;
+        
+    if (ts <= iPreviousTimeStamp)
+    {            
+        // adjust timestamp so that its bigger than ts of previous frame
+        TReal frameRate = iProcessor->GetVideoClipFrameRate();
+        VDASSERT(frameRate > 0.0, 106);
+        TInt64 durationMs =  TInt64( ( 1000.0 / frameRate ) + 0.5 );
+        durationMs /= 2;   // add half the duration of one frame
+        
+        ts = TTimeIntervalMicroSeconds( iPreviousTimeStamp.Int64() + durationMs*1000 );
+        
+        frameInfo.iTimeStamp = iProcessor->GetVideoTimeInTicksFromMs( ts.Int64()/1000, EFalse );
+                    
+        ts = iProcessor->GetVideoTimeInMsFromTicks(frameInfo.iTimeStamp, EFalse) * 1000;
+        
+        PRINT((_L("CVideoProcessor::WriteFrameToTranscoderL() - adjusted timestamp, prev = %d, new = %d"), 
+                   I64INT( iPreviousTimeStamp.Int64() ) / 1000, I64INT( ts.Int64() ) / 1000));    
+
+    }
+    
+    iFrameInfoArray.Append(frameInfo);
+            
+    iPreviousTimeStamp = ts;
+            
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+    if (iDataFormat == EDataAVC)
+    {
+        TPtr8 ptr(iDataBuffer, iCurrentFrameLength, iBufferLength);
+        // This has to be updated when cutting from beginning ??
+        iAvcEdit->ProcessAVCBitStreamL((TDes8&)(ptr), (TInt&)(iCurrentFrameLength), 
+            iProcessor->GetDecoderSpecificInfoSize(), !iDecoderSpecificInfoSent );
+        iDataLength = iCurrentFrameLength;
+        
+    }
+#endif
+
+    iMediaBuffer->Set( TPtrC8(iDataBuffer, iBufferLength), 
+                              bt, 
+                              iCurrentFrameLength, 
+                              aKeyFrame,
+                              ts);
+                                       
+    iDecodePending = ETrue;
+    if (!IsActive())
+    {
+        SetActive();
+        iStatus = KRequestPending;                                
+    }                
+    
+    
+    PRINT((_L("CVideoProcessor::WriteFrameToTranscoderL() - transcoder mode is %d"), iTranscoderMode));    
+                              
+    PRINT((_L("CVideoProcessor::WriteFrameToTranscoderL() - WriteCodedBuffer, frame #%d, timestamp %d ms"),
+               iFrameNumber, I64INT( ts.Int64() ) / 1000 ));    
+               
+    PRINT((_L("CVideoProcessor::WriteFrameToTranscoderL() - %d items in queue"), iFrameInfoArray.Count()));                       
+               
+    iTransCoder->WriteCodedBufferL(iMediaBuffer);
+    
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::InsertDecoderSpecificInfoL
+// Insert AVC dec. config record in the beginning of slice NAL('s)
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::InsertDecoderSpecificInfoL()
+{
+    
+    if (iDataFormat == EDataMPEG4)
+    {
+        if ( (iDataLength + iDecoderSpecificInfo->Length()) > iBufferLength )
+		{
+			// extend buffer size
+			TUint newSize = iDataLength + iDecoderSpecificInfo->Length();															
+            iDataBuffer = (TUint8*) User::ReAllocL(iDataBuffer, newSize);					                    
+			iBufferLength = newSize;
+		}            
+    	Mem::Copy(iDataBuffer+iDecoderSpecificInfo->Length(), iDataBuffer, iCurrentFrameLength);
+    	Mem::Copy(iDataBuffer, iDecoderSpecificInfo->Des().Ptr(), iDecoderSpecificInfo->Length());
+    	iCurrentFrameLength += iDecoderSpecificInfo->Length();
+    	iDataLength += iDecoderSpecificInfo->Length();
+     
+        return;   
+    }
+    
+    VDASSERT( iDataFormat == EDataAVC, 182 );
+            
+    // get number of slice NAL's in buffer
+    TInt frameLen = 0;        
+    TInt numSliceNalUnits = 0;
+    TUint8* frameLenPtr = iDataBuffer;
+    
+    while (frameLen < iCurrentFrameLength)
+    {                
+        TInt nalLen = 0;
+        
+        nalLen = (frameLenPtr[0] << 24) + (frameLenPtr[1] << 16) + 
+                 (frameLenPtr[2] << 8) + frameLenPtr[3] + 4;  // +4 for length field
+                                     
+        frameLenPtr += nalLen;
+        frameLen += nalLen;
+        numSliceNalUnits++;
+    }
+    
+    // get no. of SPS & PPS        
+
+    TUint8* ptr = const_cast<TUint8*>(iDecoderSpecificInfo->Des().Ptr());                
+    
+    TInt index = 4;  // Skip version and length information                    
+    ptr[index] |= 0x03;  // set no. bytes used for length to 4
+    
+    index++;            
+    TInt numSPS = ptr[index] & 0x1f;
+    
+    index++;
+                   
+    // Loop all SPS units
+    for (TInt i = 0; i < numSPS; ++i)
+    {                                
+        TInt SPSSize = (ptr[index] << 8) + ptr[index + 1];
+        index += 2;
+        index += SPSSize;
+    }
+    TInt numPPS = ptr[index];
+
+    // Align at 32-bit boundrary
+    TInt payLoadLen = iCurrentFrameLength + iDecoderSpecificInfo->Length();
+    TInt alignmentBytes = (payLoadLen % 4 != 0) * ( 4 - (payLoadLen % 4) );                                
+                    
+    // get needed buffer length
+    TInt minBufLen = iCurrentFrameLength + iDecoderSpecificInfo->Length() + alignmentBytes +
+                     ( (numSliceNalUnits + numSPS + numPPS) * 8 ) + 4;
+    
+    // ReAllocate buffer
+    if (iBufferLength < minBufLen)
+    {            
+        iDataBuffer = (TUint8*) User::ReAllocL(iDataBuffer, minBufLen);
+        iBufferLength = minBufLen;
+        
+        PRINT((_L("CVideoProcessor::XXX() reallocated databuffer, new length = %d"),iBufferLength));
+    }
+
+    // move slice NAL's the amount of DCR length
+    Mem:: Copy(iDataBuffer + iDecoderSpecificInfo->Length(), iDataBuffer, iCurrentFrameLength);
+    
+    // copy SPS/PPS data in the beginning
+    Mem:: Copy(iDataBuffer, iDecoderSpecificInfo->Des().Ptr(), iDecoderSpecificInfo->Length());
+    
+    iCurrentFrameLength += iDecoderSpecificInfo->Length();
+    
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::GetModeChangeL
+// Determine need to compr. domain transcoding
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CVideoProcessor::GetModeChangeL()
+{
+
+    TInt videoClipNumber = iProcessor->GetVideoClipNumber(); 
+	
+	// iProcessor->GetModeTranslationMPEG4() returns the overall decision for inserted MPEG4 clips
+
+	TVedTranscodeFactor tFact = iProcessor->GetVideoClipTranscodeFactor(videoClipNumber);
+	
+	TBool fModeChanged = EFalse;
+	
+	if (iProcessor->GetOutputVideoType() == EVedVideoTypeMPEG4SimpleProfile) //MPEG4
+	{
+
+		switch (tFact.iStreamType)
+		{
+		case EVedVideoBitstreamModeUnknown:
+		case EVedVideoBitstreamModeMPEG4Regular:
+		case EVedVideoBitstreamModeMPEG4Resyn:
+			fModeChanged = EFalse; // already the target mode
+			break;
+		case EVedVideoBitstreamModeH263:
+			fModeChanged = ETrue;	
+			break;
+		case EVedVideoBitstreamModeMPEG4ShortHeader:
+		default: // other MPEG4 modes
+			// if all the MPEG4 (note: it is also considered as MPEG4 type) have the same mode
+			// no need to do the mode translation
+			fModeChanged = iProcessor->GetModeTranslationMpeg4() ? ETrue: EFalse;
+			break;
+		}
+
+	}
+	else if ( (iProcessor->GetOutputVideoType() == EVedVideoTypeH263Profile0Level10) ||
+		      (iProcessor->GetOutputVideoType() == EVedVideoTypeH263Profile0Level45) )
+	{
+
+		if (tFact.iStreamType == EVedVideoBitstreamModeH263 || 
+			tFact.iStreamType == EVedVideoBitstreamModeMPEG4ShortHeader||
+			tFact.iStreamType ==EVedVideoBitstreamModeUnknown)
+		{
+			fModeChanged = EFalse;
+		}
+		else
+		{
+			fModeChanged = ETrue;
+		}
+	} 
+	
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+	else if (iProcessor->GetOutputVideoType() == EVedVideoTypeAVCBaselineProfile)
+	    fModeChanged = EFalse;
+#endif
+	
+	else // EVedVideoTypeNoVideo
+	{
+        User::Leave(KErrNotSupported);
+	}
+	
+	return fModeChanged;
+    
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::DecodeFrameL
+// Decode frame in iDataBuffer using vedh263d
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::DecodeFrameL(TInt aOperation, TBool aModeChanged, TInt& aFrameSizeInBytes)
+{
+
+    VDASSERT(iDataFormat == EDataH263 || iDataFormat ==  EDataMPEG4, 136);
+    
+    // go into the decoder 
+    TVedColorEffect vedEffect = iProcessor->GetColorEffect();
+    CVedH263Dec::TColorEffect effect = (vedEffect == EVedColorEffectNone) ? 
+	    CVedH263Dec::EColorEffectNone : ((vedEffect == EVedColorEffectBlackAndWhite) ? CVedH263Dec::EColorEffectBlackAndWhite : CVedH263Dec::EColorEffectToning);
+
+	vdeDecodeParamters_t decodeParams;
+	
+	// Assign the ColorTone value of the ColorTone	
+	// U,V value for the color toning
+    TInt colorToneU;
+    TInt colorToneV;
+    iProcessor->GetColorTone((TInt&)colorToneU, (TInt&)colorToneV);
+	
+    decodeParams.aColorToneU = colorToneU;
+    decodeParams.aColorToneV = colorToneV;
+	decodeParams.aColorEffect = effect;
+	decodeParams.aFrameOperation = aOperation;
+	decodeParams.aGetDecodedFrame = EFalse; //getDecodedFrame; // no need to get YUV
+	decodeParams.aSMSpeed = iProcessor->GetSlowMotionSpeed();
+	
+	TInt trD = iProcessor->GetTrPrevOrig();
+	TInt trP = iProcessor->GetTrPrevNew();
+	
+	decodeParams.aTrD = &trD;
+	decodeParams.aTrP = &trP;
+	decodeParams.aVideoClipNumber = iProcessor->GetVideoClipNumber();
+	
+	TVedTranscodeFactor tFact = iProcessor->GetVideoClipTranscodeFactor(decodeParams.aVideoClipNumber);
+	
+	decodeParams.streamMode = tFact.iStreamType;
+	decodeParams.iTimeIncrementResolution = tFact.iTRes;
+	decodeParams.aGetVideoMode = EFalse;
+	decodeParams.aOutputVideoFormat = iProcessor->GetOutputVideoType();
+	
+	decodeParams.fModeChanged = aModeChanged;
+	decodeParams.fHaveDifferentModes = iProcessor->GetModeTranslationMpeg4() ? ETrue: EFalse;
+	/* Color Toning */
+	decodeParams.aFirstFrameQp = iFirstFrameQp;
+		
+	// : Optimisation - If the frame is to be encoded, there is no need
+	//       to process it using vedh263d in all cases, for example when
+	//       doing end transition. In start transition case it has to be done
+	//       so that compressed domain transcoding can continue after transition
+
+	// before decoding, set the time infomation in the decoder parameters
+	decodeParams.aMPEG4TimeStamp = iMPEG4Timer->GetMPEG4TimeStampPtr();
+	decodeParams.aMPEG4TargetTimeResolution = iMPEG4Timer->GetMPEG4TimeResolutionPtr();
+	    
+	decodeParams.vosHeaderSize = 0;
+    
+    // +3 includes the next PSC or EOS in the bit buffer
+    TPtrC8 inputPtr(iDataBuffer, iCurrentFrameLength + (iDataFormat==EDataH263 ? KH263StartCodeLength : KMPEG4StartCodeLength));
+    
+    // check output buffer size & reallocate if its too small    
+    if ( TReal(iOutVideoFrameBufferLength) < TReal(iCurrentFrameLength) * 1.5 )
+    {
+        TInt newLen = TInt( TReal(iCurrentFrameLength) * 1.5 );
+        
+        iOutVideoFrameBuffer = (TUint8*) User::ReAllocL(iOutVideoFrameBuffer, newLen);
+        iOutVideoFrameBufferLength = newLen;                
+        
+        PRINT((_L("CVideoProcessor::DecodeFrameL() reallocated output buffer, new size = %d"),
+                   iOutVideoFrameBufferLength));
+    }
+    
+    TPtr8 outputPtr(iOutVideoFrameBuffer, 0, iOutVideoFrameBufferLength);        
+    
+    TInt frameSize = 0;
+    TBool wasFirstFrame = iFirstFrameFlag; // need to save the value since it may be changed inside
+    iDecoder->DecodeFrameL(inputPtr, outputPtr, iFirstFrameFlag, frameSize, &decodeParams);
+
+	if (frameSize > (TInt)iCurrentFrameLength)
+    {
+        // decoder used more data than was in the buffer => corrupted bitstream
+        PRINT((_L("CVideoProcessor::DecodeFrameL() decoder used more data than was in the buffer => corrupted bitstream")));
+        User::Leave( KErrCorrupt );
+    }
+    
+    aFrameSizeInBytes = outputPtr.Length();    
+    
+    /* record first frame QP */
+    if ((iFrameNumber==0) && wasFirstFrame) 
+    {
+        iFirstFrameQp = decodeParams.aFirstFrameQp;
+	    
+        if (iProcessor->GetOutputVideoType() == EVedVideoTypeMPEG4SimpleProfile)
+            {
+            PRINT((_L("CVideoProcessor::DecodeFrameL() save VOS header, size %d"), decodeParams.vosHeaderSize));
+            // sync the vol headers
+            if ( decodeParams.vosHeaderSize > iOutputVolHeader->Des().MaxLength() )
+                {
+                delete iOutputVolHeader;
+                iOutputVolHeader = NULL;
+                iOutputVolHeader = HBufC8::NewL(decodeParams.vosHeaderSize);
+                }
+            iOutputVolHeader->Des().Copy( outputPtr.Ptr(), decodeParams.vosHeaderSize );
+            }
+    }
+    
+    PRINT((_L("CVideoProcessor::DecodeFrameL() out")));
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::CreateAndInitializeTranscoderL
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::CreateAndInitializeTranscoderL(TVedVideoType aInputType, CTRTranscoder::TTROperationalMode aMode)
+{
+
+    PRINT((_L("CVideoProcessor::CreateAndInitializeTranscoderL() begin")));    
+    
+    VDASSERT(iTransCoder == 0, 27);
+    
+    iTransCoder = CTRTranscoder::NewL(*this); 
+    
+    TBufC8<256> inputMime;
+    
+//  TInt volLength = 0;    
+    TInt outputBufferSize = 0;
+    iInputMPEG4ProfileLevelId = 0;
+
+    if (aInputType == EVedVideoTypeMPEG4SimpleProfile)
+    {                
+        // Get the VOL header from the frame data
+	    CVedVolReader* reader = CVedVolReader::NewL();
+	    CleanupStack::PushL(reader);
+	    // Get pointer to the frame data
+	    TPtrC8 inputPtr(iDecoderSpecificInfo->Des());
+	    reader->ParseVolHeaderL((TDesC8&) inputPtr);
+	    
+	    iInputMPEG4ProfileLevelId = reader->ProfileLevelId();	    
+	    
+	    iInputTimeIncrementResolution = reader->TimeIncrementResolution();
+	    
+	    iInputStreamMode = reader->BitstreamMode();
+
+	    switch (iInputMPEG4ProfileLevelId)
+	    {		    
+	    	case 8:
+	    	    inputMime = _L8("video/mp4v-es; profile-level-id=8");
+	    	    outputBufferSize = KMaxCodedPictureSizeMPEG4QCIF / 2;
+	    	    break;
+	    	
+	    	case 9:	    	
+	    	    inputMime = _L8("video/mp4v-es; profile-level-id=9");
+	    	    outputBufferSize = KMaxCodedPictureSizeMPEG4L0BQCIF / 2;
+	    	    break;
+	    	
+	    	case 1:
+	    	    inputMime = _L8("video/mp4v-es; profile-level-id=1");	    	    
+	    	    outputBufferSize = KMaxCodedPictureSizeMPEG4QCIF / 2;
+	    	    break;
+	    	
+	    	case 2:
+	    	    inputMime = _L8("video/mp4v-es; profile-level-id=2");
+	    	    outputBufferSize = KMaxCodedPictureSizeMPEG4CIF / 2;
+	    	    break;
+	    	
+	    	case 3:
+	    	    inputMime = _L8("video/mp4v-es; profile-level-id=3");
+	    	    outputBufferSize = KMaxCodedPictureSizeMPEG4CIF / 2;
+	    	    break;
+	    	    
+	        case 4:
+	    	    inputMime = _L8("video/mp4v-es; profile-level-id=4");
+	    	    outputBufferSize = KMaxCodedPictureSizeVGA / 2;
+	    	    break;
+	    		    		    	
+	    	default:
+	    	    inputMime = _L8("video/mp4v-es; profile-level-id=8");
+	    	    outputBufferSize = KMaxCodedPictureSizeMPEG4QCIF / 2;
+	    	    break;
+	    }
+	    
+//	    volLength = reader->HeaderSize();
+	    CleanupStack::PopAndDestroy(reader);        
+    }    
+    
+    else if (aInputType == EVedVideoTypeH263Profile0Level10)
+    {        
+        inputMime = _L8("video/H263-2000; profile=0; level=10");
+        outputBufferSize = KMaxCodedPictureSizeQCIF / 2;
+    }
+    
+    else if (aInputType == EVedVideoTypeH263Profile0Level45)
+    {        
+        inputMime = _L8("video/H263-2000; profile=0; level=45");
+        outputBufferSize = KMaxCodedPictureSizeQCIF / 2;
+    }
+    
+    else if (aInputType == EVedVideoTypeAVCBaselineProfile)
+    {
+        // get input avc level        
+        VDASSERT( iAvcEdit != 0, 181 );        
+        VDASSERT( iDecoderSpecificInfo, 181 );
+        
+        TPtr8 info = iDecoderSpecificInfo->Des();
+        User::LeaveIfError( iAvcEdit->GetLevel(info, iInputAVCLevel) );
+                
+        switch (iInputAVCLevel)
+        {
+            case 10:
+                inputMime = _L8("video/H264; profile-level-id=42800A");                
+                outputBufferSize = KMaxCodedPictureSizeAVCLevel1 / 2;
+                break;
+           
+            case 101:
+                inputMime = _L8("video/H264; profile-level-id=42900B");
+                outputBufferSize = KMaxCodedPictureSizeAVCLevel1B / 2;
+                break;
+            
+            case 11:
+                inputMime = _L8("video/H264; profile-level-id=42800B");
+                outputBufferSize = KMaxCodedPictureSizeAVCLevel1_1 / 2;
+                break;
+            
+            case 12:
+                inputMime = _L8("video/H264; profile-level-id=42800C");
+                outputBufferSize = KMaxCodedPictureSizeAVCLevel1_2 / 2;
+                break;
+                
+            // NOTE: Levels 1.3 and 2 are enabled for testing purposes,
+            //       to be removed
+            case 13:
+                inputMime = _L8("video/H264; profile-level-id=42800D");
+                outputBufferSize = KMaxCodedPictureSizeAVCLevel1_3 / 2;
+                break;  
+                
+            case 20:
+                inputMime = _L8("video/H264; profile-level-id=428014");
+                outputBufferSize = KMaxCodedPictureSizeAVCLevel2 / 2;
+                break;
+                
+            //WVGA task
+            case 21:
+                inputMime = _L8("video/H264; profile-level-id=428015");
+                outputBufferSize = KMaxCodedPictureSizeAVCLevel2_1 / 2;
+                break;
+                
+            case 22:
+            	inputMime = _L8("video/H264; profile-level-id=428016");
+            	outputBufferSize = KMaxCodedPictureSizeAVCLevel2_2 / 2;
+            	break;                
+
+            case 30:
+            	inputMime = _L8("video/H264; profile-level-id=42801E");
+            	outputBufferSize = KMaxCodedPictureSizeAVCLevel3 / 2;
+            	break;   
+               
+            case 31:
+            	inputMime = _L8("video/H264; profile-level-id=42801F");
+            	outputBufferSize = KMaxCodedPictureSizeAVCLevel3_1 / 2;
+            	break;                             
+   
+            default:
+                User::Leave(KErrNotSupported);
+                break;            
+        }              
+    }
+           
+    else
+        User::Leave(KErrNotSupported);                  
+    
+    if ( !(iTransCoder->SupportsInputVideoFormat(inputMime) ) )
+        {
+        User::Leave(KErrNotSupported);
+        }            
+        
+        
+    // default framerate is 15 fps
+    TReal frameRate = 15.0;
+    
+    iOutputBitRate = 64000;
+        
+    if ( aMode == CTRTranscoder::EFullTranscoding )
+    {                
+        // get output mime type 
+        SetOutputVideoCodecL(iProcessor->GetOutputVideoMimeType());    
+        
+        if ( !(iTransCoder->SupportsOutputVideoFormat(iOutputMimeType) ) )
+            {
+            User::Leave(KErrNotSupported);
+            }            
+        
+        // check output resolution
+        TSize outputResolution = iProcessor->GetMovieResolution();
+        
+        if ( (outputResolution.iWidth > iMaxOutputResolution.iWidth) || (outputResolution.iHeight > iMaxOutputResolution.iHeight))
+            {
+            if ( iArbitrarySizeAllowed ) // This is for future-proofness. Currently the checking of standard sizes below overrules this one
+                {
+                if ( outputResolution.iWidth * outputResolution.iHeight > iMaxOutputResolution.iWidth*iMaxOutputResolution.iHeight )
+                    {
+                    PRINT((_L("CVideoProcessor::CreateAndInitializeTranscoderL() too high resolution requested")));
+                    User::Leave( KErrNotSupported );
+                    }
+                }
+            else
+                {
+                PRINT((_L("CVideoProcessor::CreateAndInitializeTranscoderL() incompatible or too high resolution requested")));
+                User::Leave( KErrNotSupported );
+                }
+            }
+        
+    	// check size. For now only standard sizes are allowed
+    	if ( (outputResolution != KVedResolutionSubQCIF) && 
+    		 (outputResolution != KVedResolutionQCIF) &&
+    		 (outputResolution != KVedResolutionCIF) &&
+    		 (outputResolution != KVedResolutionQVGA) &&
+    		 (outputResolution != KVedResolutionVGA16By9) &&
+    		 (outputResolution != KVedResolutionVGA) &&
+    		 //WVGA task
+    		 (outputResolution != KVedResolutionWVGA) )
+    	{
+    		 User::Leave( KErrArgument );
+    	}
+    	
+    	// check output frame rate    	
+    	TReal movieFrameRate = iProcessor->GetMovieFrameRate();
+    	
+    	if ( movieFrameRate > 0.0 )
+    	{	    	
+        	if ( movieFrameRate <= iMaxOutputFrameRate )
+            {
+                frameRate = TReal32(movieFrameRate);
+            }
+            else
+            {
+                frameRate = iMaxOutputFrameRate;
+            }
+    	}    	
+            
+        // check output bitrate    
+        TInt movieBitRate = iProcessor->GetMovieVideoBitrate();
+        TInt standardBitRate = iProcessor->GetMovieStandardVideoBitrate();
+        
+        if ( movieBitRate > 0 )
+        {            
+            if ( movieBitRate <= iMaxOutputBitRate )
+            {
+                iOutputBitRate = movieBitRate;
+            }
+            else
+            {
+                iOutputBitRate = iMaxOutputBitRate;
+            }
+        } 
+        else if ( standardBitRate > 0 )
+        {
+            if ( standardBitRate <= iMaxOutputBitRate )
+            {
+                iOutputBitRate = standardBitRate;
+            }
+            else
+            {
+                iOutputBitRate = iMaxOutputBitRate;
+            }
+        }    
+    } 
+    else 
+    {
+       iOutputMimeType = KNullDesC8;   
+    }   
+                
+    TTRVideoFormat videoInputFormat;
+    TTRVideoFormat videoOutputFormat;
+    
+    if (!iThumbnailMode)
+    {
+        videoInputFormat.iSize = iProcessor->GetVideoClipResolution();
+        videoOutputFormat.iSize = iProcessor->GetMovieResolution();
+    }
+    else
+    {
+        videoInputFormat.iSize = videoOutputFormat.iSize = TSize(iVideoWidth, iVideoHeight);
+    }
+    
+    videoInputFormat.iDataType = CTRTranscoder::ETRDuCodedPicture;
+    
+    if (aMode == CTRTranscoder::EFullTranscoding)
+        videoOutputFormat.iDataType = CTRTranscoder::ETRDuCodedPicture;
+    else
+        videoOutputFormat.iDataType = CTRTranscoder::ETRYuvRawData420;
+    
+
+    iTransCoder->OpenL( this,
+                        aMode,                        
+                        inputMime,
+                        iOutputMimeType,
+                        videoInputFormat,
+                        videoOutputFormat,
+                        EFalse );    
+    
+     
+    iTransCoder->SetVideoBitRateL(iOutputBitRate);
+    
+    if (!iThumbnailMode)
+    { 
+        // check framerate: target framerate cannot be larger than source framerate
+        TReal inputFR = iProcessor->GetVideoClipFrameRate();       
+        if ( inputFR <= 15.0 )
+        {
+            inputFR = 15.0;
+        }
+        else
+        {
+            inputFR = 30.0;
+        }    
+        if (frameRate > inputFR)
+            frameRate = inputFR;
+    }
+    
+    iTransCoder->SetFrameRateL(frameRate);           
+    iTransCoder->SetChannelBitErrorRateL(0.0);         
+       
+    // dummy
+    TTRVideoCodingOptions codingOptions;
+    codingOptions.iSyncIntervalInPicture = iProcessor->GetSyncIntervalInPicture();
+    codingOptions.iMinRandomAccessPeriodInSeconds = (TInt) (1.0 / iProcessor->GetRandomAccessRate());        
+    codingOptions.iDataPartitioning = EFalse;
+    codingOptions.iReversibleVLC = EFalse;
+    codingOptions.iHeaderExtension = 0;
+   
+    iTransCoder->SetVideoCodingOptionsL(codingOptions);
+   
+    TSize targetSize;
+    if (!iThumbnailMode)
+        targetSize = iProcessor->GetMovieResolution();
+    else
+        targetSize = TSize(iVideoWidth, iVideoHeight);
+    
+    iTransCoder->SetVideoPictureSinkOptionsL(targetSize, this);
+    
+    iTransCoder->EnableEncoder(EFalse);
+    iTransCoder->EnablePictureSink(ETrue);
+    iTranscoderMode = EDecodeOnly;
+    
+    // set init. data
+    TPtrC8 initData;
+    if (aInputType == EVedVideoTypeMPEG4SimpleProfile || 
+        aInputType == EVedVideoTypeAVCBaselineProfile)
+    {
+        initData.Set(iDecoderSpecificInfo->Des());
+    }
+    else
+        initData.Set(iDataBuffer, iCurrentFrameLength); 
+    
+    iDecoderSpecificInfoSent = EFalse;
+    
+    iTransCoder->SetDecoderInitDataL( initData );
+    
+    if (!iThumbnailMode)
+    {        
+        // allocate output bitstream buffer for processing with vedh263d
+        VDASSERT( outputBufferSize != 0, 52 );
+        iOutVideoFrameBuffer = (TUint8*) User::AllocL(outputBufferSize);
+    	iOutVideoFrameBufferLength = outputBufferSize;
+    }
+        
+    iTranscoderInitPending = ETrue;               
+    
+    if (!IsActive())    
+    {        
+        SetActive();
+        iStatus = KRequestPending;        
+    }
+    
+    
+    iTransCoder->InitializeL();
+    
+    // Get processing time estimate from transcoder, divide it by the framerate to get processing time per frame
+    // and then multiply it by 2 to get some safety margin and by unit conversion factor 1000000. 
+    // The delay is used to determine if a frame was skipped, hence there should be some margin.
+#ifdef __WINSCW__
+    iMaxEncodingDelay = 5000000;    // emulator can be really slow, use 5 seconds timeout
+#else    
+    iMaxEncodingDelay = (TUint)(2*1000000*iTransCoder->EstimateTranscodeTimeFactorL(videoInputFormat,videoOutputFormat)/frameRate);
+#endif
+    
+    iMaxItemsInProcessingQueue = iTransCoder->GetMaxFramesInProcessing();
+    
+    PRINT((_L("CVideoProcessor::CreateAndInitializeTranscoderL() end")));    
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::MtroInitializeComplete
+// Called by transcoder to indicate init. completion
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::MtroInitializeComplete(TInt aError)
+{    
+
+    TInt error = aError;
+    TInt outputTimeIncrementResolution = KDefaultTimeIncrementResolution;
+    
+    PRINT((_L("CVideoProcessor::MtroInitializeComplete() error = %d"), aError));
+    
+    if ( !iThumbnailMode && (aError == KErrNone) &&
+         ( (iProcessor->GetOutputVideoType() == EVedVideoTypeMPEG4SimpleProfile) 
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+        || (iProcessor->GetOutputVideoType() == EVedVideoTypeAVCBaselineProfile) 
+#endif
+         ) )
+    {    
+        PRINT((_L("CVideoProcessor::MtroInitializeComplete() calling GetCodingStandardSpecificInitOutputLC")));
+        
+        // get & save vol header from encoder
+	    TRAP(error,
+	    {
+	        iOutputVolHeader = iTransCoder->GetCodingStandardSpecificInitOutputLC();
+	        CleanupStack::Pop();
+	    });
+	    
+	    iOutputVolHeaderWritten = EFalse;
+	    
+	    if ( error == KErrNone )
+	    {
+	    
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+	        if (iProcessor->GetOutputVideoType() == EVedVideoTypeAVCBaselineProfile)
+	        {
+	            // Check if we need to use encoder
+	            // : Are there any other cases where encoder is used _
+	            if ( iFullTranscoding || iTransitionEffect || 
+	                 iProcessor->GetStartCutTime() != TTimeIntervalMicroSeconds(0) )
+	            {	                
+    	            HBufC8* outputAVCHeader = 0;
+    	            // is the max. size of AVCDecoderConfigurationRecord known here ??
+    	            TRAP(error, outputAVCHeader = (HBufC8*) HBufC8::NewL(16384));	            
+
+                    if (error == KErrNone)
+                    {   
+        	            TPtr8 ptr = outputAVCHeader->Des();
+        	            
+        	            // parse header & convert it to AVCDecoderConfigurationRecord -format
+        	            TRAP(error, iAvcEdit->ConvertAVCHeaderL(*iOutputVolHeader, ptr));
+        	            
+        	            if (error == KErrNone)
+        	            {
+        	                TRAP(error, iAvcEdit->SaveAVCDecoderConfigurationRecordL(ptr, ETrue));    	                
+        	            }    	        
+                    } 
+                    if (outputAVCHeader)
+                        delete outputAVCHeader;
+	            }
+	            
+	            iEncodeUntilIDR = 0;
+	            if ( iStartOfClipTransition != 0 || 
+	                 iProcessor->GetStartCutTime() != TTimeIntervalMicroSeconds(0) )
+	            {
+	                // we need to use encoder at the beginning, now determine
+	                // if we have to encode frames after cut / transition until
+	                // input frame is IDR
+	                iEncodeUntilIDR = iAvcEdit->EncodeUntilIDR();
+	            }
+	        }
+	        else
+#endif
+	        {
+	        
+    	        VDASSERT(iOutputVolHeader, 49);
+
+    	        // get time increment resolution using vol reader
+    	        CVedVolReader* reader = NULL;	                                
+    	        TRAP( error, reader = CVedVolReader::NewL() );	        
+    	        
+    	        if ( error == KErrNone )
+    	        {	            	            
+    	            TRAP( error, reader->ParseVolHeaderL( (TDesC8&) *iOutputVolHeader ) );
+    	            if (error == KErrNone)
+    	            {	                
+                        outputTimeIncrementResolution = reader->TimeIncrementResolution();     
+    	            }
+    	            delete reader;	            	            	            	            
+    	        }
+	        }
+
+	    }
+    }
+
+    if (error == KErrNone)
+    {        
+        // create MPEG-4 timing instance
+        TRAP(error, iMPEG4Timer = CMPEG4Timer::NewL(iProcessor, outputTimeIncrementResolution));
+    }   
+    
+    // enable pausing
+    if ( ((iFullTranscoding) 
+           || (iProcessor->GetStartCutTime() > 0))
+        && (iStartOfClipTransition == 0) 
+        && (iEndOfClipTransition == 0) )
+        {
+        // safe to enable pausing during transcoding: 
+        // only when doing full transcoding or cutting from the beginning, but not if transitions
+        // rules out e.g. thumbnails, and codec-free cases
+        iTransCoder->EnablePausing(ETrue);
+        }
+            
+    VDASSERT(iTranscoderInitPending, 28);
+    // complete request    
+    TRequestStatus *status = &iStatus;
+    User::RequestComplete(status, error);
+        
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::MtroFatalError
+// Called by transcoder to indicate a fatal error
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::MtroFatalError(TInt aError)
+{
+    PRINT((_L("CVideoProcessor::MtroFatalError() %d"), aError));   
+    
+    if (iFullTranscoding || iThumbnailMode || iTransitionEffect || (iProcessor->GetStartCutTime() > 0))
+        {
+        // ok, this is fatal, continue the method
+        PRINT((_L("CVideoProcessor::MtroFatalError() transcoder is in use, this is fatal")));   
+        }
+    else
+        {
+        // transcoder not in use, ignore
+        PRINT((_L("CVideoProcessor::MtroFatalError() transcoder not in use, ignore")));   
+        return;
+        }
+        
+    // stop decoding
+    Stop();
+    
+    if (!iThumbnailMode)
+        iMonitor->Error(aError);
+    else
+        iProcessor->NotifyThumbnailReady(aError);
+
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::MtroSuspend
+// Suspends processing
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::MtroSuspend()
+{
+
+    PRINT((_L("CVideoProcessor::MtroSuspend()")));   
+    
+    if (iProcessingComplete || (!iProcessor->NeedTranscoderAnyMore()))
+        {
+        PRINT((_L("CVideoProcessor::MtroSuspend(), this clip done or no video at all to process any more, ignore")));
+        return;
+        }
+    
+    Cancel();
+	iDecoding = EFalse;
+	iDecodePending = EFalse;
+	iDecodingSuspended = EFalse;
+		
+    if (iTimer)
+        iTimer->CancelTimer();
+            
+    iProcessor->SuspendProcessing();
+    
+    // flush input queue
+    if (iBlock)    
+		iQueue->ReturnBlock(iBlock);
+	iBlock = iQueue->ReadBlock();
+	while (iBlock)
+	{
+		iQueue->ReturnBlock(iBlock);
+		iBlock = iQueue->ReadBlock();
+	}
+	iBlockPos = 0;
+	
+	iTranscoderMode = EUndefined;   // force to reset the mode when writing the next picture
+	
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::MtroResume
+// Re-starts processing after pause
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::MtroResume()
+{
+    PRINT((_L("CVideoProcessor::MtroResume()")));
+    
+    if (iProcessingComplete)
+        {
+        PRINT((_L("CVideoProcessor::MtroResume(), processing of this clip completed, continue")));   
+        // fake RunL with this flag
+        iDecoding = ETrue;
+        if (!IsActive())
+            {
+             // Make us active
+            PRINT((_L("CVideoProcessor::MtroResume() set active")));
+            SetActive();
+            iStatus = KRequestPending;
+            }
+        }
+        
+    if (!iProcessor->NeedTranscoderAnyMore())
+        {
+        PRINT((_L("CVideoProcessor::MtroResume(), no video to process any more, ignore")));   
+        return;
+        }
+    
+    // flush frame info array and cancel timer
+    if (iTimer)
+        iTimer->CancelTimer();
+    iFrameInfoArray.Reset();
+    
+    Start();
+
+    TInt error = iProcessor->ResumeProcessing(iFrameNumber, iLastWrittenFrameNumber);
+    if (error != KErrNone)
+        iMonitor->Error(error);
+    
+    iNumberOfFrames = iProcessor->GetClipNumberOfFrames();                 
+    iPreviousTimeStamp = TTimeIntervalMicroSeconds(-1);
+    
+    iDataLength = iCurrentFrameLength = 0;
+    iDataFormat = EDataUnknown;
+    
+    iStreamEnd = iStreamEndRead = 0;
+    
+    // reset also delayed buffer; it will need to be anyway re-read
+    delete iDelayedBuffer;
+    iDelayedBuffer = 0;
+    iDelayedWrite = EFalse;        
+        
+    PRINT((_L("CVideoProcessor::MtroResume() - iFrameNumber = %d"), iFrameNumber));
+    
+    if (!IsActive())
+    {
+         // Make us active
+        PRINT((_L("CVideoProcessor::MtroResume() set active")));
+        SetActive();
+        iStatus = KRequestPending;
+    }
+
+    PRINT((_L("CVideoProcessor::MtroResume() out")));
+    
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::MtroReturnCodedBuffer
+// Called by transcoder to return bitstream buffer
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::MtroReturnCodedBuffer(CCMRMediaBuffer* aBuffer)
+{
+
+    VDASSERT(aBuffer == iMediaBuffer, 29);
+
+    iIsThumbFrameBeingCopied = EFalse;
+    iDecoderSpecificInfoSent = ETrue;
+    
+#ifdef _DEBUG
+    TTimeIntervalMicroSeconds ts = aBuffer->TimeStamp();        
+    
+    PRINT((_L("CVideoProcessor::MtroReturnCodedBuffer() timeStamp = %d ms"), 
+             I64INT( ts.Int64() ) / 1000 ));                    
+
+#endif
+    
+    if (!iFirstColorTransitionFrame)
+    {        
+        // Throw away the data for this frame:
+        VDASSERT(iDataLength >= iCurrentFrameLength,4);
+        Mem::Copy(iDataBuffer, iDataBuffer + iCurrentFrameLength,
+            iDataLength - iCurrentFrameLength);
+        iDataLength = iDataLength - iCurrentFrameLength;        
+        iCurrentFrameLength = 0;
+    }
+    
+    if (!iThumbnailMode)
+    {            
+    
+        // check if the next frame in queue is waiting to be encoded
+        // and start timer to detect possible frameskip
+        if ( IsNextFrameBeingEncoded() )
+        {
+            if ( !iTimer->IsPending() )
+                iTimer->SetTimer( TTimeIntervalMicroSeconds32( iMaxEncodingDelay ) );
+        }       
+
+        if (iFrameInfoArray.Count() >= iMaxItemsInProcessingQueue)
+        {
+            PRINT((_L("CVideoProcessor::MtroReturnCodedBuffer() - %d items in queue, suspend decoding"), 
+             iFrameInfoArray.Count() ));   
+        
+            iDecodingSuspended = ETrue;
+                                                         
+            return;                        
+        }
+    
+        VDASSERT(IsActive(), 40);        
+        VDASSERT(iDecodePending, 41);
+            
+        // complete request    
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+    } 
+    else if (iDataFormat == EDataAVC)
+    {
+
+        VDASSERT(IsActive(), 40);        
+        VDASSERT(iDecodePending, 41);
+        
+        // NOTE: it would make sense to call AsyncStopL() here, 
+        // but at least in WINSCW it didn't  have any effect        
+         //if (iThumbFramesToWrite == 0)
+               //{
+               //iTransCoder->AsyncStopL();
+               //iTranscoderStarted = EFalse;               
+               //}
+            
+        if (iStatus == KRequestPending)
+        {
+            PRINT((_L("CVideoProcessor::MtroReturnCodedBuffer() - completing request")));
+            // complete request    
+            TRequestStatus *status = &iStatus;
+            User::RequestComplete(status, KErrNone);
+        }
+    }
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::MtroSetInputFrameRate
+// Called by transcoder to request inout framerate
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::MtroSetInputFrameRate(TReal& aRate)
+{    
+    TReal rate = iProcessor->GetVideoClipFrameRate();
+       
+    if ( rate <= 15.0 )
+    {
+        rate = 15.0;
+    }
+    else
+    {
+        rate = 30.0;
+    }
+   
+    aRate = rate;
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::MtroAsyncStopComplete
+// Called by transcoder after async. stop is complete
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::MtroAsyncStopComplete()
+{
+    PRINT((_L("CVideoProcessor::MtroAsyncStopComplete()")));
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::MtroPictureFromTranscoder
+// Called by transcoder to return a decoded picture
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::MtroPictureFromTranscoder(TTRVideoPicture* aPicture)
+{    
+
+    TTimeIntervalMicroSeconds decodedTs = aPicture->iTimestamp;        
+    
+    PRINT((_L("CVideoProcessor::MtroPictureFromTranscoder(), timestamp %d ms"),
+               I64INT( decodedTs.Int64() ) / 1000 ));
+               
+	if (iThumbnailMode)
+	{	    
+	    iThumbDecoded = ETrue;
+	    
+	    // handle thumbnail
+	    HandleThumbnailFromTranscoder(aPicture);
+	    
+        return;
+	}                
+
+    // search the decoded frame from list                  
+    TInt index;
+    for (index = 0; index < iFrameInfoArray.Count(); )
+    {      
+        PRINT((_L("CVideoProcessor::MtroPictureFromTranscoder(), checking frame with index %d"), index));
+          
+        TTimeIntervalMicroSeconds ts = 
+            (iProcessor->GetVideoTimeInMsFromTicks(iFrameInfoArray[index].iTimeStamp, EFalse)) * 1000;
+            
+        if (ts < decodedTs && ( (iFrameInfoArray[index].iEncodeFrame == EFalse) ||
+                                 (iFrameInfoArray[index].iTranscoderMode == EFullWithIM &&
+                                  iFrameInfoArray[index].iModificationApplied == 0) ) )        
+        {
+            // if there are decode-only or transcoding w/intermediate modification
+            // frames in the queue before this one, remove those                
+            PRINT((_L("CVideoProcessor::MtroPictureFromTranscoder(), removing frame with timestamp %d ms"),
+                I64INT( ts.Int64() ) / 1000 ));
+        
+            iFrameInfoArray.Remove(index);
+            // don't increment index
+            continue;
+        }
+            
+        if (ts == decodedTs)    
+        {
+            PRINT((_L("CVideoProcessor::MtroPictureFromTranscoder(), found decoded frame at index %d"), index));
+            break;
+        }
+            
+        index++;
+    }
+
+    // If decoded frame is unexpected, i.e. it is not found from book-keeping, 
+    // or it is not an intermediate modification frame, return frame here
+    // and continue
+    if ( index >= iFrameInfoArray.Count() || 
+        ( iFrameInfoArray[index].iEncodeFrame == 1 && 
+          iFrameInfoArray[index].iTranscoderMode != EFullWithIM ) )
+        {
+        PRINT((_L("CVideoProcessor::MtroPictureFromTranscoder(), unexpected decoded frame, iTranscoderMode %d"), iTranscoderMode));
+        // send picture back to transcoder
+        TInt error = KErrNone;
+        TRAP( error, iTransCoder->SendPictureToTranscoderL(aPicture) );
+        if ( error != KErrNone )
+        {
+            iMonitor->Error(error);
+        }    
+        return;
+        }
+
+    if (iFrameInfoArray[index].iEncodeFrame == EFalse)
+    {    
+        // handle decode-only frame
+        HandleDecodeOnlyFrameFromTranscoder(aPicture, index);        
+        return;
+    }
+
+    // check color effect
+    TInt colorEffect = TColorEffect2TInt( iProcessor->GetColorEffect() );
+    if (colorEffect != 0/*None*/)
+    {
+        // U,V value for the color toning 
+        TInt colorToneU;
+        TInt colorToneV;
+        iProcessor->GetColorTone((TInt&)colorToneU, (TInt&)colorToneV);
+    	// apply color effect
+    	ApplySpecialEffect( colorEffect, const_cast<TUint8*>(aPicture->iRawData->Ptr()), colorToneU, colorToneV );
+        
+    }
+    
+    if(iFrameInfoArray[index].iTransitionFrame == 1)
+    {
+        // apply transition to frame
+		HandleTransitionFrameFromTranscoder(aPicture, index);
+    }
+        
+    iFrameInfoArray[index].iModificationApplied = ETrue;
+    
+    // send picture back to transcoder for encoding
+    TInt error = KErrNone;
+    TRAP( error, iTransCoder->SendPictureToTranscoderL(aPicture) );
+    if ( error != KErrNone )
+    {
+        iMonitor->Error(error);
+        return;
+    }    
+    
+    // check if the next frame is waiting to be encoded, set timer if so
+    if ( IsNextFrameBeingEncoded() )
+    {
+        if ( !iTimer->IsPending() )
+            iTimer->SetTimer( TTimeIntervalMicroSeconds32( iMaxEncodingDelay ) );
+    }
+    
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::HandleThumbnailFromTranscoder
+// Handle thumbnail frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::HandleThumbnailFromTranscoder(TTRVideoPicture* aPicture)
+{
+
+    TInt error = KErrNone;
+    
+    PRINT((_L("CVideoProcessor::HandleThumbnailFromTranscoder() begin")));   
+ 
+    if (iProcessingComplete)
+    {   	    
+        // if requested thumbnail has been done already,
+        // just release picture and return
+        PRINT((_L("CVideoProcessor::HandleThumbnailFromTranscoder(), thumb already finished, returning")));   
+        
+        TRAP( error, iTransCoder->SendPictureToTranscoderL(aPicture) );
+        if ( error != KErrNone )
+        {
+            iMonitor->Error(error);
+            return;
+        }
+        return;
+    }	   
+
+    TInt yuvLength = iVideoWidth*iVideoHeight;
+    yuvLength += (yuvLength >> 1);
+    // copy to iFrameBuffer	
+    Mem::Copy(iFrameBuffer, aPicture->iRawData->Ptr(), yuvLength);
+    
+    // release picture
+    TRAP( error, iTransCoder->SendPictureToTranscoderL(aPicture) );
+    if ( error != KErrNone )
+    {
+        iProcessor->NotifyThumbnailReady(error);
+        return;
+    }
+    
+    VDASSERT(iDecodePending, 33);
+    VDASSERT(IsActive(), 150);
+    
+    if (iStatus == KRequestPending)
+    {            
+    
+        PRINT((_L("CVideoProcessor::HandleThumbnailFromTranscoder(), complete request")));   
+        // complete request    
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+    }    
+    
+    PRINT((_L("CVideoProcessor::HandleThumbnailFromTranscoder() end")));   
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::HandleDecodeOnlyFrameFromTranscoder
+// Handle decode-only frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::HandleDecodeOnlyFrameFromTranscoder(TTRVideoPicture* aPicture, TInt aIndex)
+{
+
+    VDASSERT(iFrameInfoArray[aIndex].iTranscoderMode == EDecodeOnly, 43);
+        
+    if ( iFrameInfoArray[aIndex].iTransitionFrame && 
+         iFrameInfoArray[aIndex].iTransitionPosition == EPositionEndOfClip  )
+    {
+		if ( iEndTransitionColor == EColorTransition )
+        {    			
+		    // Save decoded frame to file
+		    
+		    TSize a = iProcessor->GetMovieResolution();
+            TInt yuvLength = a.iWidth*a.iHeight;						
+			yuvLength += (yuvLength>>1); 
+			TPtr8 ptr(0,0);
+			TUint8* tmpBuf=0;					
+			
+			ptr.Set( *aPicture->iRawData );
+            tmpBuf = const_cast<TUint8*>(aPicture->iRawData->Ptr());
+							
+			TInt colorEffect = TColorEffect2TInt( iProcessor->GetColorEffect() );
+			if (colorEffect != 0 /*None*/)
+			{
+			    // U,V value for the color toning
+                TInt colorToneU;
+                TInt colorToneV;
+                iProcessor->GetColorTone((TInt&)colorToneU, (TInt&)colorToneV);
+				// apply special effect
+				ApplySpecialEffect( colorEffect, tmpBuf, colorToneU, colorToneV ); 
+			}
+			    				    				    				
+            TInt frameDuration = GetFrameDuration(iFrameInfoArray[aIndex].iFrameNumber);
+
+            if (frameDuration <= 0)
+            {
+                TReal frameRate = iProcessor->GetVideoClipFrameRate();
+                VDASSERT(frameRate > 0.0, 107);
+                TInt timeScale = iProcessor->GetVideoClipTimeScale();                    
+                TInt64 durationMs =  TInt64( ( 1000.0 / frameRate ) + 0.5 );            
+
+                // in ticks
+                frameDuration = TInt( ( (TReal)durationMs * (TReal)timeScale / 1000.0 ) + 0.5 ); 
+            }                                     
+
+            TInt error = iProcessor->SaveVideoFrameToFile( ptr, frameDuration, iFrameInfoArray[aIndex].iTimeStamp );
+			if ( error != KErrNone )
+			{
+			    PRINT((_L("CVideoProcessor::HandleDecodeOnlyFrameFromTranscoder() - SaveVideoFrameToFile failed")));
+				iMonitor->Error(error);
+				return;
+			}    				
+        }
+    }       
+    
+    iFrameInfoArray.Remove(aIndex);
+    
+    PRINT((_L("CVideoProcessor::HandleDecodeOnlyFrameFromTranscoder() - removed decode only pic, %d items in queue"), 
+        iFrameInfoArray.Count()));
+
+    // release picture
+    TInt error = KErrNone;
+    TRAP( error, iTransCoder->SendPictureToTranscoderL(aPicture) );
+    if ( error != KErrNone )
+    {
+        iMonitor->Error(error);
+        return;
+    }
+    
+    if (iStreamEndRead && iFrameInfoArray.Count() == 0 )
+    {            
+        PRINT((_L("CVideoProcessor::HandleDecodeOnlyFrameFromTranscoder() - stream end read, no frames left")));       
+        if (!IsActive())
+        {
+            SetActive();
+            iStatus = KRequestPending;
+        }
+        iTimer->CancelTimer();
+        iProcessingComplete = ETrue;
+        // activate object to end processing
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+        return;
+    }
+    
+    if (iDecodingSuspended && !iStreamEndRead)
+    {
+        if (iFrameInfoArray.Count() < iMaxItemsInProcessingQueue && !iDelayedWrite)
+        {            
+            PRINT((_L("CVideoProcessor::HandleDecodeOnlyFrameFromTranscoder() - Resume decoding")));
+            iDecodingSuspended = EFalse;
+            // activate object to start decoding
+            TRequestStatus *status = &iStatus;
+            User::RequestComplete(status, KErrNone);
+            return;
+        }
+    }
+    
+    // check if the next frame is waiting to be encoded, set timer if so
+    if ( IsNextFrameBeingEncoded() )
+    {
+        if ( !iTimer->IsPending() )
+            iTimer->SetTimer( TTimeIntervalMicroSeconds32( iMaxEncodingDelay ) );
+    }
+                    
+    return;
+    
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::HandleTransitionFrameFromTranscoder
+// Handle transition frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::HandleTransitionFrameFromTranscoder(TTRVideoPicture* aPicture, TInt aIndex)
+{
+
+    // apply transition effect in spatial domain (to yuv data in encoder buffer)    
+	if ( iFrameInfoArray[aIndex].iTransitionPosition == EPositionStartOfClip && 
+	     iStartTransitionColor == EColorTransition )
+	{
+	    // Do blending transition: wipe / crossfade
+	    	
+	    TSize a = iProcessor->GetMovieResolution();
+        TInt yuvLength = a.iWidth*a.iHeight;
+        yuvLength += (yuvLength>>1);
+            
+	    if (iFrameInfoArray[aIndex].iRepeatFrame == 0) 
+	    {		             
+            if( !iColorTransitionBuffer )
+            {                    
+    			iColorTransitionBuffer = (TUint8*)User::Alloc( yuvLength );
+    			if (!iColorTransitionBuffer)
+    			{
+    			    iMonitor->Error(KErrNoMemory);
+    			    return;        			    
+    			}
+            }
+            
+    		if( !iOrigPreviousYUVBuffer )
+    		{        		    
+    			iOrigPreviousYUVBuffer = (TUint8*)User::Alloc( yuvLength );
+    			if (!iOrigPreviousYUVBuffer)
+    			{
+    			    iMonitor->Error(KErrNoMemory);
+    			    return;        			    
+    			}
+    		}
+
+    		TPtr8 ptr( iColorTransitionBuffer, 0, yuvLength );
+    		
+    		if ( iProcessor->GetVideoFrameFromFile( ptr, yuvLength, iFrameDuration, iTimeStamp ) != KErrNone )
+    		    //|| iFrameDuration == 0 || iTimeStamp == 0 )
+    		{
+    			// failure in reading frame data from previous clip
+    			// continue using the current frame data        			
+    			Mem::Copy( iColorTransitionBuffer, aPicture->iRawData->Ptr(), yuvLength );
+    		}
+    		else
+    		{
+    		    // buffer frame from previous clip (read from file)
+    			Mem::Copy( iOrigPreviousYUVBuffer, iColorTransitionBuffer, yuvLength );
+    			if ( iStartOfClipTransition == (TInt)EVedMiddleTransitionEffectCrossfade )
+    			{        				
+    				// Target frame is the one read from file, iColorTransitionBuffer
+    				ApplyBlendingTransitionEffect( iColorTransitionBuffer, const_cast<TUint8*>(aPicture->iRawData->Ptr()), 
+    				                               0 /* repeatFrame */, iFrameInfoArray[aIndex].iTransitionFrameNumber);
+    			}
+    			else
+    			{
+    			    // Target frame is the one read from file, iColorTransitionBuffer
+    				ApplySlidingTransitionEffect( iColorTransitionBuffer, const_cast<TUint8*>(aPicture->iRawData->Ptr()), (TVedMiddleTransitionEffect)iStartOfClipTransition, 
+    				                              0 /* repeatFrame */, iFrameInfoArray[aIndex].iTransitionFrameNumber);
+    			}
+    			// copy frame from edited buffer to transcoder buffer
+    			Mem::Copy( const_cast<TUint8*>(aPicture->iRawData->Ptr()), iColorTransitionBuffer, yuvLength );        			        			
+    		}
+	    }
+	    else
+	    {
+	        // repeatFrame
+	        
+	        if ( iStartOfClipTransition == (TInt)EVedMiddleTransitionEffectCrossfade )
+			{
+				ApplyBlendingTransitionEffect( iOrigPreviousYUVBuffer, const_cast<TUint8*>(aPicture->iRawData->Ptr()), 
+				                               1 /* repeatFrame */, iFrameInfoArray[aIndex].iTransitionFrameNumber);
+			}
+			else
+			{
+				ApplySlidingTransitionEffect( iOrigPreviousYUVBuffer, const_cast<TUint8*>(aPicture->iRawData->Ptr()), (TVedMiddleTransitionEffect)iStartOfClipTransition, 
+				                              1 /* repeatFrame */, iFrameInfoArray[aIndex].iTransitionFrameNumber );
+			}
+			// copy frame from edited buffer to transcoder buffer
+	        Mem::Copy( const_cast<TUint8*>(aPicture->iRawData->Ptr()), iOrigPreviousYUVBuffer, yuvLength );
+	    }
+	}
+	else
+	{
+		// apply transition effect in spatial domain (to yuv data in encoder buffer)
+		
+		// Do fading transition
+		ApplyFadingTransitionEffect(const_cast<TUint8*>(aPicture->iRawData->Ptr()), iFrameInfoArray[aIndex].iTransitionPosition, iFrameInfoArray[aIndex].iTransitionColor,
+		                            iFrameInfoArray[aIndex].iTransitionFrameNumber);
+	}		
+    
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::ProcessThumb
+// Starts thumbnail generation
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CVideoProcessor::ProcessThumb(MThumbnailObserver* aThumbObserver, TInt aFrameIndex, TInt aStartFrameIndex, TVedTranscodeFactor* aFactor)
+{
+    TInt error;
+//    TInt goodFrame = 0; 
+//    TInt frameSkip = 10; 
+//    TInt frameNumber = aStartFrameIndex;
+    TPtrC8 inputPtr;
+    TPtr8 outputPtr(0,0);
+    
+    iThumbObserver = aThumbObserver;
+    iThumbFrameIndex = aFrameIndex;
+    iThumbFrameNumber = aStartFrameIndex;
+    iFramesToSkip = 0;
+    iNumThumbFrameSkips = 0;
+    iPreviousTimeStamp = TTimeIntervalMicroSeconds(-1);
+    iProcessingComplete = EFalse;
+    
+    iThumbFramesToWrite  = iProcessor->GetOutputNumberOfFrames() - iThumbFrameNumber;    
+
+    // get transcode factor to determine input stream type    
+    TRAP(error, GetTranscodeFactorL(*aFactor));
+    if (error != KErrNone)
+        return error;
+    
+    TVedVideoType inType;
+    if (aFactor->iStreamType == EVedVideoBitstreamModeH263)
+        inType = EVedVideoTypeH263Profile0Level10;
+    
+    else if (aFactor->iStreamType == EVedVideoBitstreamModeAVC)
+    	inType = EVedVideoTypeAVCBaselineProfile;
+    
+    else
+        inType = EVedVideoTypeMPEG4SimpleProfile;
+    
+    if (aFactor->iStreamType == EVedVideoTypeUnrecognized ||
+        aFactor->iStreamType == EVedVideoTypeNoVideo)
+        return KErrorCode;
+        
+    iDecoding = ETrue;
+      
+    // first frame is now read in iDataBuffer, initialize transcoder
+    TRAP(error, CreateAndInitializeTranscoderL(inType, CTRTranscoder::EDecoding))
+    if (error != KErrNone)
+        return error;
+    
+    // wait for initialisation to complete => RunL
+    
+    return KErrNone;
+    
+}
+           
+// ---------------------------------------------------------
+// CVideoProcessor::ProcessThumb
+// Processes a thumbnail frame internally
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::ProcessThumb(TBool aFirstFrame)
+{
+
+    PRINT((_L("CVideoProcessor::ProcessThumb() - begin()")));
+
+    iThumbDecoded = EFalse;
+ 
+    if (aFirstFrame)
+    {    
+        // frame read in iDataBuffer, decode
+        CCMRMediaBuffer::TBufferType bt = 
+            (iDataFormat == EDataH263) ? CCMRMediaBuffer::EVideoH263 : CCMRMediaBuffer::EVideoMPEG4;                        
+        TInt index = iThumbFrameNumber - ( iProcessor->GetOutputNumberOfFrames() - 
+                                           iProcessor->GetClipNumberOfFrames() );
+        TTimeIntervalMicroSeconds ts = 
+            TTimeIntervalMicroSeconds(iProcessor->GetVideoTimeInMsFromTicks(iProcessor->VideoFrameTimeStamp(index), ETrue) * TInt64(1000) );
+                    
+   		// Get the AVC bit stream and add NAL headers
+   		if(iDataFormat == EDataAVC)   		
+   		{   
+   		    TInt error = KErrNone;
+   		    
+   		    // insert dec.config. record in the beginning of buffer
+   		    TRAP( error, InsertDecoderSpecificInfoL() );
+   		    if (error != KErrNone)
+            {                                
+                iProcessor->NotifyThumbnailReady(error);
+                return;
+            }
+   		
+   		    PRINT((_L("CVideoProcessor::ProcessThumb() - ProcessAVCBitStream()")));
+   		
+   		    TPtr8 ptr(iDataBuffer, iCurrentFrameLength, iBufferLength);
+            TRAP( error, iAvcEdit->ProcessAVCBitStreamL((TDes8&)(ptr), (TInt&)(iCurrentFrameLength), 
+                iProcessor->GetDecoderSpecificInfoSize(), ETrue ) );
+                
+            if (error != KErrNone)
+            {                                
+                iProcessor->NotifyThumbnailReady(error);
+                return;
+            }
+            iDataLength = iCurrentFrameLength;
+            
+   		}
+   		
+   		// insert VOL header to beginning of buffer
+        if (iDataFormat == EDataMPEG4)
+        {
+   		    TRAPD( error, InsertDecoderSpecificInfoL() );
+   		    if (error != KErrNone)
+            {                                
+                iProcessor->NotifyThumbnailReady(error);
+                return;
+            }
+        }
+                
+        iMediaBuffer->Set( TPtrC8(iDataBuffer, iBufferLength), 
+                                  bt, 
+                                  iCurrentFrameLength, 
+                                  ETrue, // keyFrame
+                                  ts
+                                  );
+                                  
+        iPreviousTimeStamp = ts;
+
+        iIsThumbFrameBeingCopied = ETrue;
+        iDecodePending = ETrue;
+        if (!IsActive())
+        {
+            SetActive();
+            iStatus = KRequestPending;                                
+        }
+         
+        PRINT((_L("CVideoProcessor::ProcessThumb() - WriteCodedBuffer, thumb frame #%d, timestamp %d ms"),
+               iThumbFrameNumber, I64INT( ts.Int64() ) / 1000 ));    
+               
+        TRAPD( err, iTransCoder->WriteCodedBufferL(iMediaBuffer) );
+        if (err != KErrNone)
+        {
+            // ready
+            FinalizeThumb(err);
+            return;            
+        }
+        iThumbFramesToWrite--;
+        
+        return;
+    }
+    
+    if (iThumbFrameIndex == 0)
+    {       
+        // ready
+        FinalizeThumb(KErrNone);
+        return;
+    }
+ 
+    iThumbFrameNumber++;
+
+    if (iDataFormat == EDataAVC)
+    {
+        // In AVC case, we have to stop decoding before the very last
+        // frames are decoded, since for some reason the transcoder/decoder
+        // does not decode those frames
+        
+        // get max number of buffered frames according to spec
+        TInt buffered = iAvcEdit->GetMaxAVCFrameBuffering(iInputAVCLevel, TSize(iVideoWidth, iVideoHeight));
+        
+        if (iThumbFrameNumber > iProcessor->GetOutputNumberOfFrames() - 1 - buffered )   
+        {            
+            // ready                
+            FinalizeThumb(KErrNone);
+            return;
+        }
+    }
+    
+    if (iThumbFrameIndex < 0)
+    {        
+        if (iFramesToSkip == 0)
+        {            
+             PRINT((_L("CVideoProcessor::ProcessThumb() frameskip done %d times"), iNumThumbFrameSkips));
+
+             // limit the number of frame skip cycles to 3, because with
+		     // near-black or near-white videos we may never find a good thumb.
+		     // => max. 30 frames are decoded to get the thumb
+             
+             // check quality & frame skip cycles
+             if ( CheckFrameQuality(iFrameBuffer) || iNumThumbFrameSkips >= 3 )
+             {
+                 // quality ok or searched long enough, return
+                 FinalizeThumb(KErrNone);
+                 return;              
+             }
+             iFramesToSkip = 10;
+             iNumThumbFrameSkips++;
+        }
+        else
+            iFramesToSkip--;
+        
+        // read new frame & decode                           
+    }
+    
+    if (iThumbFrameIndex > 0)
+    {            
+        if (iThumbFrameNumber > iThumbFrameIndex)        
+        {
+            // ready                
+            FinalizeThumb(KErrNone);
+            return;
+        }
+        // read new frame & decode
+    }
+    
+    if (iIsThumbFrameBeingCopied)
+    {
+        PRINT((_L("CVideoProcessor::ProcessThumb() - thumb being copied, activate")));
+        // Re-activate to wait for MtroReturnCodedBuffer
+        iDecodePending = ETrue;
+        if (!IsActive())
+        {
+            SetActive();
+            iStatus = KRequestPending;                                
+        }
+    } 
+    else 
+    {
+        PRINT((_L("CVideoProcessor::ProcessThumb() - read and write new")));
+        // send new frame for decoding
+        ReadAndWriteThumbFrame();
+    }
+    
+    PRINT((_L("CVideoProcessor::ProcessThumb() - end")));
+    
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::ReadAndWriteThumbFrame
+// Reads a new frame to input queue and sends it to transcoder
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::ReadAndWriteThumbFrame()
+{
+
+    PRINT((_L("CVideoProcessor::ReadAndWriteThumbFrame() - begin, thumb frames to write %d"),
+        iThumbFramesToWrite));
+
+    TInt error = KErrNone;
+
+    if ( iThumbFramesToWrite )
+    {
+        // read new frame to input queue
+        if(iThumbFrameNumber < (iProcessor->GetOutputNumberOfFrames())) // do not read last frame (already read!)
+        {   
+            CMP4Demux *demux = (CMP4Demux *)iProcessor->GetDemux();
+            error = demux->ReadVideoFrames(1);
+            if (error != KErrNone)
+            {
+                FinalizeThumb(error);
+                return;
+            }
+        }
+        else
+        {
+            // no frames left, return            
+            FinalizeThumb(KErrNone);
+            return;
+        }
+        
+        iDataLength = 0;
+        iCurrentFrameLength = 0;
+        iDataFormat = EDataUnknown;
+        
+        if (ReadFrame())
+        {
+            // frame read in iDataBuffer, decode
+            CCMRMediaBuffer::TBufferType bt = 
+                (iDataFormat == EDataH263) ? CCMRMediaBuffer::EVideoH263 : CCMRMediaBuffer::EVideoMPEG4;
+            
+            TInt index = iThumbFrameNumber - ( iProcessor->GetOutputNumberOfFrames() - 
+                iProcessor->GetClipNumberOfFrames() );
+            
+            TTimeIntervalMicroSeconds ts = 
+                TTimeIntervalMicroSeconds(iProcessor->GetVideoTimeInMsFromTicks(iProcessor->VideoFrameTimeStamp(index), ETrue) * TInt64(1000) );
+                
+            if (ts <= iPreviousTimeStamp)
+            {            
+                // adjust timestamp so that its bigger than ts of previous frame
+                TReal frameRate = iProcessor->GetVideoClipFrameRate();
+                VDASSERT(frameRate > 0.0, 108);
+                TInt64 durationMs =  TInt64( ( 1000.0 / frameRate ) + 0.5 );
+                durationMs /= 2;  // add half the duration of one frame
+                
+                ts = TTimeIntervalMicroSeconds( iPreviousTimeStamp.Int64() + durationMs*1000 );
+            }
+            
+            iPreviousTimeStamp = ts;
+            
+       		// Get the AVC bit stream and add NAL headers
+       		if(iDataFormat == EDataAVC)
+       		{
+       		    TPtr8 ptr(iDataBuffer, iCurrentFrameLength, iBufferLength);
+                TRAPD( error, iAvcEdit->ProcessAVCBitStreamL((TDes8&)(ptr), (TInt&)(iCurrentFrameLength), 
+                    iProcessor->GetDecoderSpecificInfoSize(), EFalse ) );
+                    
+                if (error != KErrNone)
+                {
+                    FinalizeThumb(error);
+                    return;
+                }
+                iDataLength = iCurrentFrameLength;
+       		}                    
+
+            iMediaBuffer->Set( TPtrC8(iDataBuffer, iBufferLength), 
+                                      bt, 
+                                      iCurrentFrameLength, 
+                                      iProcessor->GetVideoFrameType(index),
+                                      ts );                                                                            
+
+            iIsThumbFrameBeingCopied = ETrue;
+            iDecodePending = ETrue;
+            if (!IsActive())
+            {
+                SetActive();
+                iStatus = KRequestPending;                                
+            }
+            
+            PRINT((_L("CVideoProcessor::ProcessThumb() - WriteCodedBuffer, thumb frame #%d, timestamp %d ms"),
+               iThumbFrameNumber, I64INT( ts.Int64() ) / 1000 ));    
+                   
+            TRAPD( err, iTransCoder->WriteCodedBufferL(iMediaBuffer) );
+            if (err != KErrNone)
+            {
+                FinalizeThumb(err);
+            }            
+            iThumbFramesToWrite--;
+            return;        
+        }
+    } 
+    
+    else
+    {
+        if (iDataFormat == EDataAVC)
+        {
+            PRINT((_L("CVideoProcessor::ReadAndWriteThumbFrame() - all frames written, wait for output")));
+            // all necessary frames written to decoder, now wait for output frames            
+            iDecodePending = ETrue;
+            if (!IsActive())
+            {
+                SetActive();
+                iStatus = KRequestPending;                                
+            }            
+        } 
+        else
+        {
+            FinalizeThumb(KErrNone);            
+        }
+    }    
+    
+    PRINT((_L("CVideoProcessor::ReadAndWriteThumbFrame() - end")));     
+}
+    
+// ---------------------------------------------------------
+// CVideoProcessor::FinalizeThumb
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::FinalizeThumb(TInt aError)
+{       
+    iProcessingComplete = ETrue;
+    if (iTranscoderStarted) 
+    {        
+        TRAPD( err, iTransCoder->StopL() );
+        if (err != KErrNone) { }
+        iTranscoderStarted = EFalse;
+    }
+    iProcessor->NotifyThumbnailReady(aError);
+}
+    
+// ---------------------------------------------------------
+// CVideoProcessor::FetchThumb
+// For getting a pointer to YUV thumbnail frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CVideoProcessor::FetchThumb(TUint8** aYUVDataPtr)
+{
+    *aYUVDataPtr = iFrameBuffer;    
+        
+    return KErrNone;
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::GetTranscodeFactorL
+// Gets the transcode factor from the current clip
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CVideoProcessor::GetTranscodeFactorL(TVedTranscodeFactor& aFactor)
+{
+    // start reading video frames
+    CMP4Demux *demux = (CMP4Demux *)iProcessor->GetDemux();
+    TInt error = demux->ReadVideoFrames(1);
+
+    if (error != KErrNone)
+        User::Leave(error);
+
+    // seek to and decode first frame
+    if (!ReadFrame())
+        User::Leave(KErrCorrupt);
+    
+    // Get pointer to the frame data
+    TPtr8 inputPtr(0,0);
+    if ( iDataFormat == EDataH263 )
+        inputPtr.Set(iDataBuffer, iCurrentFrameLength + KH263StartCodeLength, iCurrentFrameLength + KH263StartCodeLength);
+    else
+        inputPtr.Set(iDecoderSpecificInfo->Des());
+    
+	if(iDataFormat == EDataAVC)
+	{
+		// @@ HARI AVC harcode for now    
+	    // Set transcode factors
+	    aFactor.iTRes = 30;
+	    aFactor.iStreamType = EVedVideoBitstreamModeAVC;
+	} 
+	else
+	{
+        // Get the VOL header from the frame data
+        CVedVolReader* reader = CVedVolReader::NewL();
+        CleanupStack::PushL(reader);
+        reader->ParseVolHeaderL((TDesC8&) inputPtr);
+        
+        // Set transcode factors
+        aFactor.iTRes = reader->TimeIncrementResolution();
+        aFactor.iStreamType = reader->BitstreamMode();
+        
+        CleanupStack::PopAndDestroy(reader);
+	}
+    
+    return KErrNone;    
+}
+
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::CheckFrameQuality
+// Checks if a frame has "good" or "legible" quality
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CVideoProcessor::CheckFrameQuality(TUint8* aYUVDataPtr)
+{
+    TInt i;
+    TInt minValue = 255;
+    TInt maxValue = 0;
+    TInt goodFrame = 1;
+    TInt runningSum=0;
+    TInt averageValue=0;
+    TInt pixelSkips = 4;
+    TInt numberOfSamples=0;
+    TInt minMaxDeltaThreshold = 20; 
+    TInt extremeRegionThreshold = 20; 
+    TInt ySize = iVideoWidth*iVideoHeight; 
+    
+    // gather image statistics
+    for(i=0, numberOfSamples=0; i<ySize; i+=pixelSkips, aYUVDataPtr+=pixelSkips, numberOfSamples++)
+    {
+        runningSum += *aYUVDataPtr;
+        if(*aYUVDataPtr > maxValue)
+            maxValue = *aYUVDataPtr;
+        if(*aYUVDataPtr < minValue)
+            minValue = *aYUVDataPtr;
+    }
+    VDASSERT(numberOfSamples,10);
+    averageValue = runningSum/numberOfSamples;
+    
+    // make decision based statistics
+    if((maxValue - minValue) < minMaxDeltaThreshold)
+        goodFrame = 0;
+    else 
+    {
+        if(averageValue < (minValue + extremeRegionThreshold) || 
+            averageValue > (maxValue - extremeRegionThreshold))
+            goodFrame = 0;
+    }
+    return goodFrame;
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::ReadFrame
+// Reads a frame from input queue to internal buffer
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//				
+TInt CVideoProcessor::ReadFrame()
+{
+
+	TUint doNow;		
+	
+	if (iProcessor->GetCurrentClipVideoType() == EVedVideoTypeAVCBaselineProfile)
+        iDataFormat = EDataAVC;  
+	
+	// Determine data format if needed
+	if ( iDataFormat == EDataUnknown )
+	{
+		// We'll need four bytes of data
+		while ( iDataLength < 4 )
+		{
+			// Get a block (we can't have one as we go here only at the stream
+			// start)
+			VDASSERT(!iBlock,11);
+			while ( (!iBlock) || (iBlock->Length() == 0) )
+			{
+				if ( iBlock )
+					iQueue->ReturnBlock(iBlock);
+				if ( (iBlock = iQueue->ReadBlock()) == NULL )
+					return EFalse;
+			}
+			iBlockPos = 0;
+			
+			// get timestamp for first frame
+			if ( iTiming == ETimeStamp )
+			{
+				VDASSERT( (TUint)iBlock->Length() >= 8,12 );		
+				iBlockPos += 4;
+			}
+			
+			// Copy data from block to buffer:
+			doNow = 4 - iDataLength;
+			if ( doNow > (TUint) iBlock->Length() - iBlockPos )
+				doNow = iBlock->Length() - iBlockPos;
+			Mem::Copy(iDataBuffer+iDataLength, iBlock->Ptr()+iBlockPos, doNow);
+			iDataLength += doNow;
+			iBlockPos += doNow;
+			
+			// Return the block if it doesn't have any more data
+			if ( ((TInt)iBlockPos == iBlock->Length()) )
+			{
+				iQueue->ReturnBlock(iBlock);
+				iBlock = 0;
+			}
+		}          
+    
+		// OK, we have 4 bytes of data. Check if the buffer starts with a
+		// H.263 PSC:
+		if ( (iDataBuffer[0] == 0) && (iDataBuffer[1] == 0) &&
+			((iDataBuffer[2] & 0xfc) == 0x80) )
+		{
+			// Yes, this is a H.263 stream
+			iDataFormat = EDataH263;
+		}
+		
+		// It should be MPEG-4, check if it starts with MPEG 4 Visual
+		// Object Sequence start code, Visual Object start code, Video
+		// Object start code, or Video Object Layer start code
+		else if ( ((iDataBuffer[0] == 0) && (iDataBuffer[1] == 0) && (iDataBuffer[2] == 1) && (iDataBuffer[3] == 0xb0)) ||
+			((iDataBuffer[0] == 0) && (iDataBuffer[1] == 0) && (iDataBuffer[2] == 1) && (iDataBuffer[3] == 0xb6)) ||
+			((iDataBuffer[0] == 0) && (iDataBuffer[1] == 0) && (iDataBuffer[2] == 1) && (iDataBuffer[3] == 0xb3)) ||
+			((iDataBuffer[0] == 0) && (iDataBuffer[1] == 0) && (iDataBuffer[2] == 1) && (iDataBuffer[3] == 0xb5)) ||
+			((iDataBuffer[0] == 0) && (iDataBuffer[1] == 0) && (iDataBuffer[2] == 1) && ((iDataBuffer[3] >> 5) == 0)) ||
+			((iDataBuffer[0] == 0) && (iDataBuffer[1] == 0) && (iDataBuffer[2] == 1) && ((iDataBuffer[3] >> 4) == 2)))
+		{
+			iDataFormat = EDataMPEG4;                
+		}
+		else
+		{
+            PRINT((_L("CVideoProcessor::ReadFrame() - no PSC or MPEG-4 start code in the start of the buffer")));
+            if (iMonitor)
+			    iMonitor->Error(KErrCorrupt);
+			return EFalse;
+		}
+	}
+	
+	// Determine the start code length
+	TUint startCodeLength = 0;
+	switch (iDataFormat)
+	{
+	case EDataH263:
+		startCodeLength = KH263StartCodeLength;
+		break;
+	case EDataMPEG4:
+		startCodeLength = KMPEG4StartCodeLength ;
+		break;		
+    case EDataAVC:
+		break;
+
+	default:
+		User::Panic(_L("CVideoPlayer"), EInternalAssertionFailure);
+	}
+
+	// If the stream has ended, we have no blocks and no data for even a
+	// picture start code, we can't get a frame
+	if( iDataFormat == EDataH263 )
+	{
+		if ( iStreamEnd && (iQueue->NumDataBlocks() == 0) &&
+			(iCurrentFrameLength <= startCodeLength) &&	(iDataLength <= startCodeLength) )
+			return EFalse;
+	}
+	else
+	{
+		if ( iStreamEnd && (iQueue->NumDataBlocks() == 0) &&
+			(iCurrentFrameLength <= startCodeLength) &&	(iDataLength < startCodeLength) )
+			return EFalse;
+	}
+		
+    switch(iDataFormat)
+    {
+        case EDataH263:
+            return ReadH263Frame();
+//            break;
+            
+        case EDataMPEG4:
+            return ReadMPEG4Frame();
+//            break;
+            
+        case EDataAVC:
+            return ReadAVCFrame();
+//            break;
+            
+        default:
+            User::Panic(_L("CVideoProcessor"), EInternalAssertionFailure);        
+        
+    }
+    
+    return ETrue;
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::ReadH263Frame
+// Reads a H.263 frame from input queue to internal buffer
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//				
+TBool CVideoProcessor::ReadH263Frame()
+{
+     
+    VDASSERT( iDataFormat == EDataH263, 17 );    
+       
+    TInt offset = 0;    
+    if ( iTiming == ETimeStamp )
+	    offset = 4;		
+    
+    // There should be one PSC at the buffer start, 
+    // and no other PSCs up to iDataLength    	
+	if ( (iDataLength >= KH263StartCodeLength) && 
+        ((iDataBuffer[0] != 0) || (iDataBuffer[1] != 0) || ((iDataBuffer[2] & 0xfc) != 0x80)) )
+    {
+		PRINT((_L("CVideoProcessor::ReadH263Frame() - no PSC in the start of the buffer")))
+		if (iMonitor)
+            iMonitor->Error(KErrCorrupt);
+		return EFalse;
+    }
+    
+	if (iCurrentFrameLength < KH263StartCodeLength )
+		iCurrentFrameLength = KH263StartCodeLength;
+
+    TBool gotPSC = EFalse;
+	while (!gotPSC)
+	{
+		// If we don't have a block at the moment, get one and check if it
+		// has a new PSC
+		while (!iBlock)
+		{
+			if ((iBlock = iQueue->ReadBlock()) == NULL)
+			{
+				if (!iStreamEnd && !iProcessor->IsThumbnailInProgress())
+					return EFalse;
+				
+				// No more blocks in the stream. If we have more data than
+				// just a PSC, use the remaining as the last frame. We'll
+				// append an End Of Stream (EOS) codeword to the stream end
+				// to keep the decoder happy
+				if (iDataLength <= 3)
+					return EFalse;
+				iCurrentFrameLength = iDataLength;
+				if (iBufferLength < (iDataLength+3))
+				{
+					iBufferLength += 3;						                       
+                    TUint8* tmp = (TUint8*) User::ReAlloc(iDataBuffer, iBufferLength);
+					if ( !tmp  )
+					{
+					    if (iMonitor)
+						    iMonitor->Error(KErrNoMemory);							
+						return EFalse;
+					}
+                    iDataBuffer = tmp;
+				}
+				iDataBuffer[iCurrentFrameLength] = 0;
+				iDataBuffer[iCurrentFrameLength+1] = 0;
+				iDataBuffer[iCurrentFrameLength+2] = 0xfc;
+				iDataLength += 3;
+				return ETrue;
+			}
+							
+			iBlockPos = 0;
+			// Return empty blocks immediately
+			if ( iBlock->Length() == 0 )
+			{
+				iQueue->ReturnBlock(iBlock);
+				iBlock = 0;
+			}                
+		}
+		
+		// If we are at the start of a block, check if it begins with a PSC
+		if ( iBlockPos == 0 )
+		{                
+			if ( (iBlock->Length() > 2 + offset) &&
+				( ((*iBlock)[0+offset] == 0) && ((*iBlock)[1+offset] == 0) && (((*iBlock)[2+offset] & 0xfc) == 0x80) ) )
+			{
+				gotPSC = ETrue;
+				iCurrentFrameLength = iDataLength;  // timestamps not copied to buffer
+				
+				if (iTiming == ETimeStamp)
+				{						
+					iBlockPos += offset;
+				}
+			}
+            else
+            {
+                PRINT((_L("CVideoProcessor::ReadH263Frame() - no PSC in the start of the buffer")))
+                if (iMonitor)
+                    iMonitor->Error( KErrCorrupt );
+                return EFalse;
+            }
+		}
+		
+		// If we still have data in our current block, copy it to the buffer
+		// Make sure we have enough space
+		TUint copyBytes = iBlock->Length() - iBlockPos;
+		if (copyBytes)
+		{
+			while (iBufferLength < (iDataLength + copyBytes))
+			{
+				// New size is 3/2ths of the old size, rounded up to the next
+				// full kilobyte
+				TUint newSize = (3 * iBufferLength) / 2;
+				newSize = (newSize + 1023) & (~1023);
+				
+                TUint8* tmp = (TUint8*) User::ReAlloc(iDataBuffer, newSize);
+				if (!tmp)
+				{
+				    if (iMonitor)
+					    iMonitor->Error(KErrNoMemory);
+					return EFalse;
+				}
+                iDataBuffer = tmp;
+				iBufferLength = newSize;
+			}
+			Mem::Copy(&iDataBuffer[iDataLength], iBlock->Ptr() + iBlockPos,
+				copyBytes);
+			iBlockPos += copyBytes;
+			iDataLength += copyBytes;
+		}
+		
+		// OK, block used, throw it away
+		VDASSERT(iBlock->Length() == (TInt)iBlockPos,16);
+		iQueue->ReturnBlock(iBlock);
+		iBlock = 0;
+	}
+	
+	return ETrue;	
+}
+		
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::ReadMPEG4Frame
+// Reads a MPEG-4 frame from input queue to internal buffer
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//				
+TBool CVideoProcessor::ReadMPEG4Frame()
+{
+    
+    VDASSERT( (iDataFormat == EDataMPEG4 && iTiming == ETimeStamp), 17 );    
+		
+    // The following code assumes that there is one complete video frame
+    // in each input block. This is true for 3GP input streams.     
+	
+    // get a new block if we don't have one
+    while (!iBlock)
+    {
+        if ((iBlock = iQueue->ReadBlock()) == NULL)        
+            return EFalse;        
+        
+        iBlockPos = 0;
+        // Return empty blocks immediately
+        if (iBlock->Length() == 0)
+        {
+            iQueue->ReturnBlock(iBlock);
+            iBlock = 0;
+        }
+    }    
+
+    // If we are at the start of a block, save timestamp
+    if (iBlockPos == 0)
+    {
+        //TUint* p = (TUint*)iBlock->Ptr();
+        //AI:         iRenderFrameTime = TInt64( (TUint)((*p)*1000) );
+        iBlockPos += 4; // skip timestamp
+    }
+    
+    if (iFirstRead)
+    {
+        // allocate buffer for header        
+        VDASSERT(!iDecoderSpecificInfo, 160);        
+        iDecoderSpecificInfo = (HBufC8*) HBufC8::New(iProcessor->GetDecoderSpecificInfoSize());
+        if (!iDecoderSpecificInfo)
+        {
+            iMonitor->Error(KErrNoMemory);
+            return EFalse;
+        }
+        
+        TPtr8 ptr(iDecoderSpecificInfo->Des());
+        
+        // first copy already read bytes from iDataBuffer
+        ptr.Copy(iDataBuffer, iDataLength);
+        
+        TInt copyNow = iProcessor->GetDecoderSpecificInfoSize() - iDataLength;
+        iDataLength = 0;
+        
+        // then copy the rest from input buffer
+        ptr.Append(iBlock->Ptr() + iBlockPos, copyNow);
+        iBlockPos += copyNow;
+        iDecoderSpecificInfoSent = EFalse;
+            
+        iFirstRead = EFalse;
+    
+    }
+	
+    TUint copyBytes = iBlock->Length() - iBlockPos;
+    if (copyBytes)
+    {
+        // Make sure we have enough space
+        //   +4 is for inserting a start code at the end of the frame 
+        while (iBufferLength < (iDataLength + copyBytes + 4))
+        {
+            // New size is 3/2ths of the old size, rounded up to the next
+            // full kilobyte
+            TUint newSize = (3 * iBufferLength) / 2;
+            newSize = (newSize + 1023) & (~1023);				
+            TUint8* tmp = (TUint8*) User::ReAlloc(iDataBuffer, newSize);
+            if (!tmp)
+            {
+                if (iMonitor)
+                    iMonitor->Error(KErrNoMemory);
+                return EFalse;
+            }
+            iDataBuffer = tmp;
+            iBufferLength = newSize;
+        }
+        Mem::Copy(&iDataBuffer[iDataLength], iBlock->Ptr() + iBlockPos,
+            copyBytes);
+        iBlockPos += copyBytes;
+        iDataLength += copyBytes;        
+    }
+
+    // OK, block used, throw it away
+    VDASSERT((iBlock->Length() == (TInt)iBlockPos),18);
+    iQueue->ReturnBlock(iBlock);
+    iBlock = 0;
+    
+    // check for VOS end code
+    if ( (iDataBuffer[0] == 0 ) && (iDataBuffer[1] == 0 ) && 
+        (iDataBuffer[2] == 0x01) && (iDataBuffer[3] == 0xb1) )
+        return EFalse;
+    
+    // insert VOP start code at the end, the decoder needs it
+    iDataBuffer[iDataLength++] = 0;
+    iDataBuffer[iDataLength++] = 0;
+    iDataBuffer[iDataLength++] = 0x01;
+    iDataBuffer[iDataLength++] = 0xb6;
+    iCurrentFrameLength = iDataLength;
+    
+    // we have a complete frame
+    return ETrue;
+    
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::ReadAVCFrame
+// Reads an AVC frame from input queue to internal buffer
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//				
+TBool CVideoProcessor::ReadAVCFrame()
+{
+
+    VDASSERT( iDataFormat == EDataAVC, 17 );    
+
+    // get a new block if we don't have one
+    while (!iBlock)
+    {
+        if ((iBlock = iQueue->ReadBlock()) == NULL)        
+            return EFalse;        
+        
+        iBlockPos = 0;
+        // Return empty blocks immediately
+        if (iBlock->Length() == 0)
+        {
+            iQueue->ReturnBlock(iBlock);
+            iBlock = 0;
+        }
+    }    
+    
+    // skip 4 bytes for the timestamp
+    TInt skip = 4;
+//    TInt numSPS = 0;
+//    TInt numPPS = 0;        
+
+    // set this to point to the start of frame length field
+    TUint8* frameLenPtr = const_cast<TUint8*>(iBlock->Ptr()) + skip;
+    // how much space needed for frame data 
+    TInt frameLen = 0;                
+
+    TInt totalFrameLen = iBlock->Length() - skip;
+    
+    if (iFirstRead)
+    {
+        TInt index = skip + 4;     // Skip timestamp + version etc.
+        TUint8* temp = const_cast<TUint8*>(iBlock->Ptr());                    
+        
+        // get no. bytes used for length
+        iFrameLengthBytes = ( temp[index] & 0x3 ) + 1;
+
+        // save DCR
+        VDASSERT(!iDecoderSpecificInfo, 160);
+        
+        iDecoderSpecificInfo = (HBufC8*) HBufC8::New(iProcessor->GetDecoderSpecificInfoSize());
+        if (!iDecoderSpecificInfo)
+        {
+            iMonitor->Error(KErrNoMemory);
+            return EFalse;
+        }
+        
+        TPtr8 ptr(iDecoderSpecificInfo->Des());
+        ptr.Copy(iBlock->Ptr() + skip, iProcessor->GetDecoderSpecificInfoSize());
+        iDecoderSpecificInfoSent = EFalse;
+        
+        // advance pointer over info to point to length field
+        frameLenPtr += iProcessor->GetDecoderSpecificInfoSize();
+        
+        // add to frame len. since it is used to calculate the minimum buffer size
+        //frameLen += iProcessor->GetDecoderSpecificInfoSize();
+        
+        totalFrameLen -= iProcessor->GetDecoderSpecificInfoSize();
+        skip += iProcessor->GetDecoderSpecificInfoSize();
+        
+        iFirstRead = EFalse;
+    }
+       
+    
+
+    TInt numSliceNalUnits = 0;
+    while (frameLen < totalFrameLen)
+    {                
+        TInt nalLen = 0;
+        switch (iFrameLengthBytes)
+        {
+            case 1:
+                nalLen = frameLenPtr[0] + 1;  // +1 for length field
+                break;                
+                
+            case 2:            
+                nalLen = (frameLenPtr[0] << 8) + frameLenPtr[1] + 2; // +2 for length field
+                break;
+
+            case 3:
+                nalLen = (frameLenPtr[0] << 16) + (frameLenPtr[1] << 8) +
+                          frameLenPtr[2] + 3; // +3 for length field
+                break;
+                
+            case 4:
+                nalLen = (frameLenPtr[0] << 24) + (frameLenPtr[1] << 16) + 
+                         (frameLenPtr[2] << 8) + frameLenPtr[3] + 4;  // +4 for length field
+                break;
+                
+            default:
+                if (iMonitor)
+                    iMonitor->Error(KErrCorrupt);
+                return EFalse;
+        }
+        frameLenPtr += nalLen;
+        frameLen += nalLen;
+        numSliceNalUnits++;
+    }
+    
+    if ( iFrameLengthBytes != 4 )
+        frameLen += numSliceNalUnits * ( (iFrameLengthBytes == 1) ? 3 : 2 );                     
+
+    // reserve space for alignment
+    TInt addBytes = (frameLen % 4 != 0) * ( 4 - (frameLen % 4) );
+    
+    // reserve space for slice NAL unit offset and size fields
+    addBytes += (numSliceNalUnits * 8);
+    
+    // reserve space for number of NAL units (4)                
+    addBytes += 4;
+
+    // Make sure we have enough space
+    while (iBufferLength < (iDataLength + frameLen + addBytes))
+    {
+        // New size is 3/2ths of the old size, rounded up to the next
+        // full kilobyte
+        TUint newSize = (3 * iBufferLength)  / 2;
+        newSize = (newSize + 1023) & (~1023);				
+        TUint8* tmp = (TUint8*) User::ReAlloc(iDataBuffer, newSize);
+        if (!tmp)
+        {
+            iMonitor->Error(KErrNoMemory);
+            return EFalse;
+        }
+        
+        iDataBuffer = tmp;
+        iBufferLength = newSize;
+    }                
+
+    iBlockPos += skip;
+    
+    if (iFrameLengthBytes == 4)
+    {
+        // just copy directly, no need to change length field
+        Mem::Copy(&iDataBuffer[iDataLength], iBlock->Ptr() + skip, frameLen);
+        iDataLength += frameLen;
+        iBlockPos += frameLen;
+    } 
+    else
+    {
+        // have to change length field for each NAL
+        TUint8* srcPtr = const_cast<TUint8*>(iBlock->Ptr()) + skip;
+        while (numSliceNalUnits--)
+        {
+            // read length
+            TInt nalLen = 0;
+            switch (iFrameLengthBytes)
+            {
+                case 1:
+                    nalLen = srcPtr[0];
+                    srcPtr += 1;  // skip length field
+                    iBlockPos += 1;
+                    break;
+                    
+                case 2:            
+                    nalLen = (srcPtr[0] << 8) + srcPtr[1];
+                    srcPtr += 2;  // skip length field  
+                    iBlockPos += 2;
+                    break;
+                    
+                case 3:
+                    nalLen = (srcPtr[0] << 16) + (srcPtr[1] << 8) + srcPtr[2];
+                    srcPtr += 3;  // skip length field  
+                    iBlockPos += 3;
+                    break;
+                    
+                default:
+                    if (iMonitor)
+                        iMonitor->Error(KErrCorrupt);
+                    return EFalse;
+            }
+                    
+            // code length with 4 bytes
+            iDataBuffer[iDataLength] =     TUint8((nalLen >> 24) & 0xff);
+            iDataBuffer[iDataLength + 1] = TUint8((nalLen >> 16) & 0xff);
+            iDataBuffer[iDataLength + 2] = TUint8((nalLen >> 8) & 0xff);
+            iDataBuffer[iDataLength + 3] = TUint8(nalLen & 0xff);
+            iDataLength += 4;
+            // copy NAL data
+            Mem::Copy(&iDataBuffer[iDataLength], srcPtr, nalLen);
+            iDataLength += nalLen;
+            srcPtr += nalLen;
+            iBlockPos += nalLen;
+        }
+    }               
+
+    // OK, block used, throw it away
+    VDASSERT((iBlock->Length() == (TInt)iBlockPos),18);
+    iQueue->ReturnBlock(iBlock);
+    iBlock = 0;
+            
+    iCurrentFrameLength = iDataLength;
+    
+    // we have a complete frame
+    return ETrue;
+
+}
+			
+			
+
+// ---------------------------------------------------------
+// CVideoProcessor::DetermineClipTransitionParameters
+// Sets transition frame parameters
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//	
+TInt CVideoProcessor::DetermineClipTransitionParameters(TInt& aTransitionEffect,
+                                                        TInt& aStartOfClipTransition,
+													    TInt& aEndOfClipTransition,
+													    TTransitionColor& aStartTransitionColor,
+													    TTransitionColor& aEndTransitionColor)
+{
+	TInt error=KErrNone;
+	// find if transition effect is to be applied 
+	TInt numberOfVideoClips = iProcessor->GetNumberOfVideoClips();
+	TInt videoClipNumber = iProcessor->GetVideoClipNumber(); 
+	TVedStartTransitionEffect startTransitionEffect = iProcessor->GetStartTransitionEffect();
+	TVedEndTransitionEffect endTransitionEffect = iProcessor->GetEndTransitionEffect();
+	TVedMiddleTransitionEffect middleTransitionEffect = iProcessor->GetMiddleTransitionEffect();
+	TVedMiddleTransitionEffect previousMiddleTransitionEffect = iProcessor->GetPreviousMiddleTransitionEffect();
+
+	// is transition effect to be applied anywhere in the movie?
+	if(startTransitionEffect==EVedStartTransitionEffectNone && 
+		middleTransitionEffect==EVedMiddleTransitionEffectNone &&
+		endTransitionEffect==EVedEndTransitionEffectNone &&
+		previousMiddleTransitionEffect==EVedMiddleTransitionEffectNone)
+		aTransitionEffect=0;
+	else
+		aTransitionEffect=1;
+	// where is the transition effect to be applied - beginning, end or both?
+	if(aTransitionEffect)
+	{
+		// if first video clip
+		if(videoClipNumber==0)		
+		{
+			switch(startTransitionEffect)
+			{
+			default:
+			case EVedStartTransitionEffectNone:
+			case EVedStartTransitionEffectLast:
+				aStartOfClipTransition=0;
+				aStartTransitionColor = EColorNone;
+				break;
+			case EVedStartTransitionEffectFadeFromBlack:
+				aStartOfClipTransition=1;
+				aStartTransitionColor = EColorBlack;
+				break;
+			case EVedStartTransitionEffectFadeFromWhite:
+				aStartOfClipTransition=1;
+				aStartTransitionColor = EColorWhite;
+				break;
+			}
+			// do we need transition at the end of this clip?
+			if(videoClipNumber==numberOfVideoClips-1)	// last clip?
+			{
+				switch(endTransitionEffect)
+				{
+				default:
+				case EVedEndTransitionEffectNone:
+				case EVedEndTransitionEffectLast:
+					aEndOfClipTransition=0;
+					aEndTransitionColor = EColorNone;
+					break;
+				case EVedEndTransitionEffectFadeToBlack:
+					aEndOfClipTransition=1;
+					aEndTransitionColor = EColorBlack;
+					break;
+				case EVedEndTransitionEffectFadeToWhite:
+					aEndOfClipTransition=1;
+					aEndTransitionColor = EColorWhite;
+					break;
+				}
+			}
+			else	// middle clip
+			{
+				switch(middleTransitionEffect)
+				{
+				default:
+				case EVedMiddleTransitionEffectNone:
+				case EVedMiddleTransitionEffectLast:
+					aEndOfClipTransition=0;
+					aEndTransitionColor = EColorNone;
+					break;
+				case EVedMiddleTransitionEffectDipToBlack:
+					aEndOfClipTransition=1;
+					aEndTransitionColor = EColorBlack;
+					break;
+				case EVedMiddleTransitionEffectDipToWhite:
+					aEndOfClipTransition=1;
+					aEndTransitionColor = EColorWhite;
+					break;
+					//change
+				case EVedMiddleTransitionEffectCrossfade:
+					aEndOfClipTransition=TInt(EVedMiddleTransitionEffectCrossfade);
+					aEndTransitionColor = EColorTransition;
+					break;
+				case EVedMiddleTransitionEffectWipeLeftToRight:
+					aEndOfClipTransition=TInt(EVedMiddleTransitionEffectWipeLeftToRight);
+					aEndTransitionColor = EColorTransition;
+					break;
+				case EVedMiddleTransitionEffectWipeRightToLeft:
+					aEndOfClipTransition=TInt(EVedMiddleTransitionEffectWipeRightToLeft);
+					aEndTransitionColor = EColorTransition;
+					break;
+				case EVedMiddleTransitionEffectWipeTopToBottom:
+					aEndOfClipTransition=TInt(EVedMiddleTransitionEffectWipeTopToBottom);
+					aEndTransitionColor = EColorTransition;
+					break;
+				case EVedMiddleTransitionEffectWipeBottomToTop:
+					aEndOfClipTransition=TInt(EVedMiddleTransitionEffectWipeBottomToTop);
+					aEndTransitionColor = EColorTransition;
+					break;
+				}
+			}
+		}
+		// else its the middle or last clip
+		else	
+		{
+			// do we need transition at the beginning of this clip?
+			switch(previousMiddleTransitionEffect)
+			{
+			default:
+			case EVedMiddleTransitionEffectNone:
+			case EVedMiddleTransitionEffectLast:
+				aStartOfClipTransition=0;
+				aStartTransitionColor = EColorNone;
+				break;
+			case EVedMiddleTransitionEffectDipToBlack:
+				aStartOfClipTransition=1;
+				aStartTransitionColor = EColorBlack;
+				break;
+			case EVedMiddleTransitionEffectDipToWhite:
+				aStartOfClipTransition=1;
+				aStartTransitionColor = EColorWhite;
+				break;
+				
+			case EVedMiddleTransitionEffectCrossfade:
+				aStartOfClipTransition=TInt(EVedMiddleTransitionEffectCrossfade);
+				aStartTransitionColor = EColorTransition;
+				break;
+			case EVedMiddleTransitionEffectWipeLeftToRight:
+				aStartOfClipTransition=TInt(EVedMiddleTransitionEffectWipeLeftToRight);
+				aStartTransitionColor = EColorTransition;
+				break;
+			case EVedMiddleTransitionEffectWipeRightToLeft:
+				aStartOfClipTransition=TInt(EVedMiddleTransitionEffectWipeRightToLeft);
+				aStartTransitionColor = EColorTransition;
+				break;
+			case EVedMiddleTransitionEffectWipeTopToBottom:
+				aStartOfClipTransition=TInt(EVedMiddleTransitionEffectWipeTopToBottom);
+				aStartTransitionColor = EColorTransition;
+				break;
+			case EVedMiddleTransitionEffectWipeBottomToTop:
+				aStartOfClipTransition=TInt(EVedMiddleTransitionEffectWipeBottomToTop);
+				aStartTransitionColor = EColorTransition;
+				break;
+			}
+			// do we need transition at the end of this clip?
+			if(videoClipNumber==numberOfVideoClips-1)	// last clip?
+			{
+				switch(endTransitionEffect)
+				{
+				default:
+				case EVedEndTransitionEffectNone:
+				case EVedEndTransitionEffectLast:
+					aEndOfClipTransition=0;
+					aEndTransitionColor = EColorNone;
+					break;
+				case EVedEndTransitionEffectFadeToBlack:
+					aEndOfClipTransition=1;
+					aEndTransitionColor = EColorBlack;
+					break;
+				case EVedEndTransitionEffectFadeToWhite:
+					aEndOfClipTransition=1;
+					aEndTransitionColor = EColorWhite;
+					break;
+				}
+			}
+			else	// middle clip
+			{
+				switch(middleTransitionEffect)
+				{
+				default:
+				case EVedMiddleTransitionEffectNone:
+				case EVedMiddleTransitionEffectLast:
+					aEndOfClipTransition=0;
+					aEndTransitionColor = EColorNone;
+					break;
+				case EVedMiddleTransitionEffectDipToBlack:
+					aEndOfClipTransition=1;
+					aEndTransitionColor = EColorBlack;
+					break;
+				case EVedMiddleTransitionEffectDipToWhite:
+					aEndOfClipTransition=1;
+					aEndTransitionColor = EColorWhite;
+					break;
+					//change
+				case EVedMiddleTransitionEffectCrossfade:
+					aEndOfClipTransition=TInt(EVedMiddleTransitionEffectCrossfade);
+					aEndTransitionColor = EColorTransition;
+					break;
+				case EVedMiddleTransitionEffectWipeLeftToRight:
+					aEndOfClipTransition=TInt(EVedMiddleTransitionEffectWipeLeftToRight);
+					aEndTransitionColor = EColorTransition;
+					break;
+				case EVedMiddleTransitionEffectWipeRightToLeft:
+					aEndOfClipTransition=TInt(EVedMiddleTransitionEffectWipeRightToLeft);
+					aEndTransitionColor = EColorTransition;
+					break;
+				case EVedMiddleTransitionEffectWipeTopToBottom:
+					aEndOfClipTransition=TInt(EVedMiddleTransitionEffectWipeTopToBottom);
+					aEndTransitionColor = EColorTransition;
+					break;
+				case EVedMiddleTransitionEffectWipeBottomToTop:
+					aEndOfClipTransition=TInt(EVedMiddleTransitionEffectWipeBottomToTop);
+					aEndTransitionColor = EColorTransition;
+					break;
+				}
+			}
+		}
+	}
+	return error;
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::GetNumberOfTransitionFrames
+// Calculate the number of transition frames
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//	
+void CVideoProcessor::GetNumberOfTransitionFrames(TTimeIntervalMicroSeconds aStartCutTime, 
+                                                  TTimeIntervalMicroSeconds aEndCutTime)
+{
+
+    TInt startFrameIndex = iProcessor->GetVideoFrameIndex(aStartCutTime);
+    // the following is because binary search gives us frame with timestamp < startCutTime
+    // this frame would be out of range for  movie
+    if(startFrameIndex > 0 && startFrameIndex < iNumberOfFrames-1)
+        startFrameIndex++;
+    TInt endFrameIndex = iProcessor->GetVideoFrameIndex(aEndCutTime);
+    // adjust frame indices for cut video clip
+    startFrameIndex -= iProcessor->GetStartFrameIndex();
+    endFrameIndex -= iProcessor->GetStartFrameIndex();
+       if(startFrameIndex < 0)
+        startFrameIndex = 0;
+    if(endFrameIndex < 0)
+        endFrameIndex = 0;
+	if(endFrameIndex<startFrameIndex)
+		endFrameIndex = startFrameIndex;
+
+    // determine the total number of included frames in the clip
+    iNumberOfIncludedFrames = endFrameIndex-startFrameIndex+1;
+                
+    // make sure there are enough frames to apply transition
+    // for transition at both ends
+    if(iStartOfClipTransition && iEndOfClipTransition)
+    {
+
+		if ( iStartTransitionColor == EColorTransition &&
+			iEndTransitionColor == EColorTransition )
+		{
+			iStartNumberOfTransitionFrames >>= 1;
+						
+			// if there are not enough frames saved from previous
+			// clip, the transition must be shortened accordingly
+			if (iProcessor->GetNumberOfSavedFrames() < iStartNumberOfTransitionFrames)
+                iStartNumberOfTransitionFrames = iProcessor->GetNumberOfSavedFrames();			
+			
+			iEndNumberOfTransitionFrames >>= 1;
+			if ( iNumberOfIncludedFrames < (iStartNumberOfTransitionFrames + iEndNumberOfTransitionFrames) )
+			{
+				iStartNumberOfTransitionFrames = iNumberOfIncludedFrames >> 1;
+				iEndNumberOfTransitionFrames = iNumberOfIncludedFrames - iStartNumberOfTransitionFrames;
+			}
+		}
+		else
+		{
+			if ( iStartTransitionColor == EColorTransition )
+			{
+				iStartNumberOfTransitionFrames >>= 1;
+				
+				// if there are not enough frames saved from previous
+			    // clip, the transition must be shortened accordingly
+			    if (iProcessor->GetNumberOfSavedFrames() < iStartNumberOfTransitionFrames)
+                    iStartNumberOfTransitionFrames = iProcessor->GetNumberOfSavedFrames();			
+			}
+			
+			if ( iEndTransitionColor == EColorTransition )
+				iEndNumberOfTransitionFrames >>= 1;
+			
+			if ( iNumberOfIncludedFrames < (iStartNumberOfTransitionFrames + iEndNumberOfTransitionFrames) )
+			{
+				if ( iStartTransitionColor == EColorTransition )
+				{
+					if ( ( iNumberOfIncludedFrames >> 1 ) > iStartNumberOfTransitionFrames )
+					{
+						iEndNumberOfTransitionFrames = iNumberOfIncludedFrames - iStartNumberOfTransitionFrames;
+					}
+					else
+					{
+						iStartNumberOfTransitionFrames = iNumberOfIncludedFrames >> 1;
+						iEndNumberOfTransitionFrames = iNumberOfIncludedFrames - iStartNumberOfTransitionFrames;
+					}
+				}
+				else if ( iEndTransitionColor == EColorTransition )
+				{
+					if ( ( iNumberOfIncludedFrames >> 1 ) > iEndNumberOfTransitionFrames )
+					{
+						iStartNumberOfTransitionFrames = iNumberOfIncludedFrames - iEndNumberOfTransitionFrames;
+					}
+					else
+					{
+						iStartNumberOfTransitionFrames = iNumberOfIncludedFrames >> 1;
+						iEndNumberOfTransitionFrames = iNumberOfIncludedFrames - iStartNumberOfTransitionFrames;
+					}
+				}
+				else
+				{
+					iStartNumberOfTransitionFrames = iNumberOfIncludedFrames >> 1;
+					iEndNumberOfTransitionFrames = iNumberOfIncludedFrames - iStartNumberOfTransitionFrames;
+				}
+			}
+		}            
+    }
+    // if transition is at one end only
+    else 
+    {
+		if ( iStartOfClipTransition )
+		{   
+			iEndNumberOfTransitionFrames = 0;
+			if ( iStartTransitionColor == EColorTransition )
+			{
+				iStartNumberOfTransitionFrames >>= 1;
+				
+				// if there are not enough frames saved from previous
+			    // clip, the transition must be shortened accordingly
+			    if (iProcessor->GetNumberOfSavedFrames() < iStartNumberOfTransitionFrames)
+                    iStartNumberOfTransitionFrames = iProcessor->GetNumberOfSavedFrames();			
+			}
+
+			if ( iNumberOfIncludedFrames < iStartNumberOfTransitionFrames )
+			{
+				iStartNumberOfTransitionFrames = iNumberOfIncludedFrames; 
+			}
+		}
+		else
+		{
+			iStartNumberOfTransitionFrames = 0;
+			if ( iEndTransitionColor == EColorTransition )
+			{
+				iEndNumberOfTransitionFrames >>= 1;
+			}
+			if ( iNumberOfIncludedFrames < iEndNumberOfTransitionFrames )
+			{
+				iEndNumberOfTransitionFrames = iNumberOfIncludedFrames; 
+			}
+		}             
+    }
+    // fetch the last Intra before transition begins.
+    // should be done after the cutting as well.
+    
+    iLastIntraFrameBeforeTransition=0;
+    if(iNumberOfIncludedFrames > 2) //so that we could loop to find the last intra.
+    {
+        TInt i;
+        TInt j=iProcessor->GetStartFrameIndex(); // processor needs frame index from beginning of clip
+        for(i=endFrameIndex-iEndNumberOfTransitionFrames; i>=startFrameIndex;i--)
+        {
+            if(iProcessor->GetVideoFrameType(i+j) == 1)	// absolute index needed here!
+            {
+                iLastIntraFrameBeforeTransition=i;
+                break;
+            }
+        }
+    }
+    
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::SetTransitionFrameParams
+// Set parameters for a transition frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//	
+void CVideoProcessor::SetTransitionFrameParams(TInt aIncludedFrameNumber, TBool& aDecodeFrame)
+{
+
+    // if transition is to be applied at the beginning of the clip
+    if(iStartOfClipTransition)
+    {
+        iFirstFrameAfterTransition = EFalse;
+        // this is for start-of-clip transition
+        if(aIncludedFrameNumber < iStartNumberOfTransitionFrames)
+        {
+            // if its first transition frame
+            if(aIncludedFrameNumber == 0)
+            {
+                iFirstTransitionFrame = 1;
+                iTransitionFrameNumber = 0;
+            }
+            else
+            {
+                iTransitionFrameNumber++;							
+            }
+
+			if ( iStartTransitionColor == EColorTransition )
+			{
+				// ignore this transition if the previous clip has less transition frames
+				// than this clip's transition frames
+				if ( iTransitionFrameNumber < ( iProcessor->NumberOfTransition() - iTransitionFrameNumber ) )
+				{
+					iTransitionFrame = 1;
+					iTransitionPosition = EPositionStartOfClip;
+					aDecodeFrame = ETrue;
+					iTransitionColor = iStartTransitionColor;
+				}
+				else
+				{
+					iPreviousFrameIncluded = EFalse; 
+				}
+			}
+			else
+			{
+				iTransitionFrame = 1;
+				iTransitionPosition = EPositionStartOfClip;
+				aDecodeFrame = EFalse;
+				iTransitionColor = iStartTransitionColor;
+			}
+			
+        }
+        else
+        {
+            // if this is first frame after transition, we need to encode it as intra
+            // treat/simulate it as if its the start of the cut point. 
+            if(aIncludedFrameNumber == iStartNumberOfTransitionFrames)
+            {
+                iFirstFrameAfterTransition = ETrue;
+                iPreviousFrameIncluded = EFalse; 
+            }
+        }
+    }
+    
+    // if transition is to be applied at the end of the clip
+    if(iEndOfClipTransition && iTransitionFrame == 0)
+    {
+        // this is for end-of-clip transition
+        if(aIncludedFrameNumber >= iNumberOfIncludedFrames - iEndNumberOfTransitionFrames)
+        {
+            // if its first transition frame
+            if(aIncludedFrameNumber == iNumberOfIncludedFrames - iEndNumberOfTransitionFrames)
+            {
+                iFirstTransitionFrame = 1;
+                iTransitionFrameNumber = 0;
+            }
+            else
+            {
+                iTransitionFrameNumber++;
+            }
+
+			if ( iEndTransitionColor == EColorTransition )
+			{
+				// get the next clip's start transition information
+				GetNextClipTransitionInfo();
+				// if next clip's start transition number is less than current clip's
+				// end transition number, then DO NOT treat current frame as the
+				// the transition frame
+				if ( ( iEndNumberOfTransitionFrames - iTransitionFrameNumber ) <= iNextTransitionNumber )
+				{
+					iTransitionFrame = 1;
+					iTransitionPosition = EPositionEndOfClip;
+					aDecodeFrame = ETrue;
+					iTransitionColor = iEndTransitionColor;
+				}
+			}
+			else
+			{		
+				iTransitionFrame = 1;
+				iTransitionPosition = EPositionEndOfClip;
+				aDecodeFrame = EFalse;
+				iTransitionColor = iEndTransitionColor;
+			}
+		}
+        else
+        {
+            // if this is first frame, we need to start decoding from here
+            // treat/simulate it as if its the nearest preceding intra frame. 
+            if(iFrameNumber >= iLastIntraFrameBeforeTransition)
+                aDecodeFrame = ETrue;
+            
+            // In AVC case, if there is also starting transition, decode
+            // all frames after that since frame numbering must be consistent
+            // for AVC decoding to work
+            if (iDataFormat == EDataAVC && iStartOfClipTransition)
+                aDecodeFrame = ETrue;
+            
+        }	// end-of-clip transition
+    }
+    
+}
+
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::ApplyFadingTransitionEffect
+// Applies fading transition effect for a YUV frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//	
+
+void CVideoProcessor::ApplyFadingTransitionEffect(TUint8* aYUVPtr,
+                                                  TTransitionPosition aTransitionPosition,
+                                                  TTransitionColor aTransitionColor,
+                                                  TInt aTransitionFramenumber)
+{
+	TInt i;
+
+	TSize movieSize = iProcessor->GetMovieResolution();
+	TInt yLength = movieSize.iWidth * movieSize.iHeight;	
+
+	TInt uLength = yLength>>2;	
+	TUint8* yFrame = (TUint8*)aYUVPtr;
+	TUint8* uFrame = (TUint8*)(yFrame+yLength); 
+	TUint8* vFrame = (TUint8*)(uFrame+uLength); 	
+	TInt position;
+	TChar chr; 
+	TInt value; 
+	TPtr8 ptr(0,0);
+
+	// look-up tables to avoid floating point operations due to fractional weighting
+	// corresponding to 0.1, 26 values quantized to 8
+	const TUint8 quantTable1[8] = { 
+		  4,   7,  10,  13,  16,  19,  22,  24 };
+	// corresponding to 0.2, 52 values quantized to 16
+	const TUint8 quantTable2[16] = { 
+		  4,   8,  12,  15,  18,  21,  24,  27,  30,  33,  36,  39,  42,  45,  48,  50 };
+	// corresponding to 0.3, 77 values quantized to 16
+	const TUint8 quantTable3[16] = { 
+		  5,  10,  15,  20,  24,  29,  33,  38,  42,  47,  51,  56,  61,  66,  71,  75 };
+	// corresponding to 0.4, 103 values quantized to 32
+	const TUint8 quantTable4[32] = { 
+		  5,  10,  14,  18,  21,  24,  27,  30,  33,  36,  39,  42,  45,  48,  51,  54,
+		 57,  60,  63,  66,  69,  72,  75,  78,  81,  84,  87,  90,  93,  96,  99, 101 };
+	// corresponding to 0.5, 128 values quantized to 32
+	const TUint8 quantTable5[32] = { 
+		  3,   7,  11,  15,  19,  23,  27,  31,  35,  39,  43,  47,  51,  55,  59,  63,
+		 67,  71,  75,  79,  83,  87,  91,  95,  99, 103, 107, 111, 115, 119, 123, 126 };
+	// corresponding to 0.6, 154 values quantized to 32
+	const TUint8 quantTable6[32] = { 
+		  5,  13,  20,  27,  32,  36,  41,  45,  50,  54,  59,  63,  68,  72,  77,  81,
+		 86,  90,  95,  99, 103, 108, 112, 117, 121, 126, 130, 135, 139, 144, 148, 152 };
+	// corresponding to 0.7, 179 values quantized to 64
+	const TUint8 quantTable7[64] = { 
+		  5,   8,  11,  14,  17,  20,  23,  26,  29,  32,  35,  38,  41,  44,  47,  50,
+		 53,  56,  59,  62,  65,  68,  71,  74,  77,  80,  83,  86,  89,  92,  95,  98,
+		101, 104, 107, 110, 113, 116, 119, 122, 125, 128, 131, 134, 137, 140, 143, 146,
+		149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 178 };
+	// corresponding to 0.8, 204 values quantized to 64
+	const TUint8 quantTable8[64] = { 
+		  5,  10,  15,  20,  25,  29,  33,  36,  40,  42,  45,  48,  51,  54,  57,  60,
+		 63,  66,  69,  72,  75,  78,  81,  84,  87,  90,  93,  96,  99, 102, 105, 108,
+		111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156,
+		159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192, 195, 198, 201, 203 };
+	// corresponding to 0.9, 230 values quantized to 64
+	const TUint8 quantTable9[64] = { 
+		  5,  10,  15,  19,  23,  26,  30,  33,  37,  40,  44,  47,  51,  54,  58,  61,
+		 65,  68,  72,  75,  79,  82,  86,  89,  93,  96, 100, 103, 107, 110, 114, 117,
+		121, 124, 128, 131, 135, 138, 142, 145, 149, 152, 156, 159, 163, 166, 170, 173,
+		177, 180, 184, 187, 191, 194, 198, 201, 205, 208, 212, 215, 219, 222, 226, 228 };
+	const TUint8 indexTable[10]={1,2,3,4,5,6,7,8,9,10};
+
+	// figure out if the transition is at the beginning or end of the clip	
+    TInt index;
+	switch(aTransitionPosition) 
+	{
+		case EPositionStartOfClip:		// start-of-clip transition
+			if( (index = iStartNumberOfTransitionFrames - aTransitionFramenumber-1) < 0 ) index = 0;
+		    break;
+		case EPositionEndOfClip:		// end-of-clip transition
+	        if( (index = aTransitionFramenumber) >= iEndNumberOfTransitionFrames ) index = iEndNumberOfTransitionFrames - 1;
+			break;
+		default:
+			index = 0; 
+			break;
+	}
+    position = indexTable[index];
+
+	if(aTransitionColor==EColorWhite)
+	{
+		switch(position) // white
+		{
+		case 10: 	// 0% frame1, 100% frame2
+			// Y
+			value = 254; chr = value;
+			ptr.Set(yFrame, yLength, yLength); 
+			ptr.Fill(chr);
+            // U,V
+			value = 128; chr = value;
+			ptr.Set(uFrame, uLength<<1, uLength<<1); 
+			ptr.Fill(chr); 
+			break;
+		case 9:		// 10% frame1, 90% frame2
+			value = quantTable9[63];	// 90% of 254 (white)
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable1[(*yFrame)>>5] + value);
+			value = 113;							// 90% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable1[(*uFrame)>>5] + value);
+				*vFrame = (TUint8)(quantTable1[(*vFrame)>>5] + value);
+			}
+			break;
+		case 8:		// 20% frame1, 80% frame2
+			value = quantTable8[63];	// 80% of 254 (white)
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable2[(*yFrame)>>4] + value);
+			value = 98;							// 80% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable2[(*uFrame)>>4] + value);
+				*vFrame = (TUint8)(quantTable2[(*vFrame)>>4] + value);
+			}
+			break;
+		case 7:		// 30% frame1, 70% frame2
+			value = quantTable7[63];	// 70% of 254 (white)
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable3[(*yFrame)>>4] + value);
+			value = 86;							  // 70% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable3[(*uFrame)>>4] + value);
+				*vFrame = (TUint8)(quantTable3[(*vFrame)>>4] + value);
+			}
+			break;
+		case 6:		// 40% frame1, 60% frame2
+			value = quantTable6[31];	// 60% of 254 (white)
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable4[(*yFrame)>>3] + value);
+			value = 72; //77;							  // 60% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable4[(*uFrame)>>3] + value);
+				*vFrame = (TUint8)(quantTable4[(*vFrame)>>3] + value);
+			}
+			break;
+		case 5:		// 50% frame1, 50% frame2
+			value = quantTable5[31];	// 50% of 254 (white)
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable5[(*yFrame)>>3] + value);
+			value = 62;							  // 50% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable5[(*uFrame)>>3] + value);
+				*vFrame = (TUint8)(quantTable5[(*vFrame)>>3] + value);
+			}
+			break;
+		case 4: 	// 60% frame1, 40% frame2
+			value = quantTable4[31];	// 40% of 254 (white)
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable6[(*yFrame)>>3] + value);
+			value = 44; //51;							  // 40% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable6[(*uFrame)>>3] + value);
+				*vFrame = (TUint8)(quantTable6[(*vFrame)>>3] + value);
+			}
+			break;
+		case 3: 	// 70% frame1, 30% frame2
+			value = quantTable3[15];	// 30% of 254 (white)
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable7[(*yFrame)>>2] + value);
+			value = 28; //38;							  // 30% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable7[(*uFrame)>>2] + value);
+				*vFrame = (TUint8)(quantTable7[(*vFrame)>>2] + value);
+			}
+			break;
+		case 2: 	// 80% frame1, 20% frame2
+			value = quantTable2[15];	// 20% of 254 (white)
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable8[(*yFrame)>>2] + value);
+			value = 18; //25;							  // 20% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable8[(*uFrame)>>2] + value);
+				*vFrame = (TUint8)(quantTable8[(*vFrame)>>2] + value);
+			}
+			break;
+		case 1: 	// 90% frame1, 10% frame2
+			value = quantTable1[7];	  // 10% of 254 (white)
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable9[(*yFrame)>>2] + value);
+			value = 8; //13;							  // 10% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable9[(*uFrame)>>2] + value);
+				*vFrame = (TUint8)(quantTable9[(*vFrame)>>2] + value);
+			}
+			break;
+		default: 	// e.g., 100% frame1, 0% frame2
+			break;
+		}
+	}
+	else if(aTransitionColor==EColorBlack) // black
+	{
+		switch(position)
+		{
+		case 10: 	// 0% frame1, 100% frame2
+			// Y
+			value = 4; chr = value;
+			ptr.Set(yFrame, yLength, yLength); 
+			ptr.Fill(chr);
+            // U,V
+			value = 128; chr = value;
+			ptr.Set(uFrame, uLength<<1, uLength<<1); 
+			ptr.Fill(chr); 
+			break;
+		case 9:		// 10% frame1, 90% frame2
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable1[(*yFrame)>>5]);
+			value = 113;							// 90% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable1[(*uFrame)>>5] + value);
+				*vFrame = (TUint8)(quantTable1[(*vFrame)>>5] + value);
+			}
+			break;
+		case 8:		// 20% frame1, 80% frame2
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable2[(*yFrame)>>4]);
+			value = 98;							// 80% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable2[(*uFrame)>>4] + value);
+				*vFrame = (TUint8)(quantTable2[(*vFrame)>>4] + value);
+			}
+			break;
+		case 7:		// 30% frame1, 70% frame2
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable3[(*yFrame)>>4]);
+			value = 86;							  // 70% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable3[(*uFrame)>>4] + value);
+				*vFrame = (TUint8)(quantTable3[(*vFrame)>>4] + value);
+			}
+			break;
+		case 6:		// 40% frame1, 60% frame2
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable4[(*yFrame)>>3]);
+			value = 72; //77;							  // 60% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable4[(*uFrame)>>3] + value);
+				*vFrame = (TUint8)(quantTable4[(*vFrame)>>3] + value);
+			}
+			break;
+		case 5:		// 50% frame1, 50% frame2
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable5[(*yFrame)>>3]);
+			value = 62;							  // 50% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable5[(*uFrame)>>3] + value);
+				*vFrame = (TUint8)(quantTable5[(*vFrame)>>3] + value);
+			}
+			break;
+		case 4: 	// 60% frame1, 40% frame2
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable6[(*yFrame)>>3]);
+			value = 44; //51;							  // 40% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable6[(*uFrame)>>3] + value);
+				*vFrame = (TUint8)(quantTable6[(*vFrame)>>3] + value);
+			}
+			break;
+		case 3: 	// 70% frame1, 30% frame2
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable7[(*yFrame)>>2]);
+			value = 28; //38;							  // 30% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable7[(*uFrame)>>2] + value);
+				*vFrame = (TUint8)(quantTable7[(*vFrame)>>2] + value);
+			}
+			break;
+		case 2: 	// 80% frame1, 20% frame2
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable8[(*yFrame)>>2]);
+			value = 18; //25;							  // 20% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable8[(*uFrame)>>2] + value);
+				*vFrame = (TUint8)(quantTable8[(*vFrame)>>2] + value);
+			}
+			break;
+		case 1: 	// 90% frame1, 10% frame2
+			for(i=0; i<yLength; i++, yFrame++) // Y
+				*yFrame = (TUint8)(quantTable9[(*yFrame)>>2]);
+			value = 8; //13;							  // 10% of 128
+			for(i=0; i<uLength; i++, uFrame++,vFrame++)	// U
+			{
+				*uFrame = (TUint8)(quantTable9[(*uFrame)>>2] + value);
+				*vFrame = (TUint8)(quantTable9[(*vFrame)>>2] + value);
+			}
+			break;
+		default: 	// e.g., 100% frame1, 0% frame2
+			break;
+		}
+	} 
+	return;
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::ApplyBlendingTransitionEffect
+// Applies blending transition effect between two YUV frames
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//	
+void CVideoProcessor::ApplyBlendingTransitionEffect(TUint8* aYUVPtr1, 
+												    TUint8* aYUVPtr2, 
+												    TInt aRepeatFrame,
+												    TInt aTransitionFramenumber)
+{
+	TInt i;
+	TSize tempSize = iProcessor->GetMovieResolution();
+
+	TInt yLength = tempSize.iWidth*tempSize.iHeight; 
+	TInt uLength = yLength>>2;	
+	TInt yuvLength = yLength + (yLength>>1);
+	TUint8* yFrame1 = (TUint8*)aYUVPtr1;
+	TUint8* uFrame1 = (TUint8*)(yFrame1+yLength); 
+	TUint8* vFrame1 = (TUint8*)(uFrame1+uLength); 	
+	TUint8* yFrame2 = (TUint8*)aYUVPtr2;
+	TUint8* uFrame2 = (TUint8*)(yFrame2+yLength); 
+	TUint8* vFrame2 = (TUint8*)(uFrame2+uLength); 	
+	TInt position;
+	TPtr8 ptr(0,0);
+	const TInt numberOfTables = 10; 
+
+	// corresponding to 0.1, 26 values quantized to 8
+	const TUint8 quantTable1[8] = { 
+		  4,   7,  10,  13,  16,  19,  22,  24 };
+	// corresponding to 0.2, 52 values quantized to 16
+	const TUint8 quantTable2[16] = { 
+		  4,   8,  12,  15,  18,  21,  24,  27,  30,  33,  36,  39,  42,  45,  48,  50 };
+	// corresponding to 0.3, 77 values quantized to 16
+	const TUint8 quantTable3[16] = { 
+		  5,  10,  15,  20,  24,  29,  33,  38,  42,  47,  51,  56,  61,  66,  71,  75 };
+	// corresponding to 0.4, 103 values quantized to 32
+	const TUint8 quantTable4[32] = { 
+		  5,  10,  14,  18,  21,  24,  27,  30,  33,  36,  39,  42,  45,  48,  51,  54,
+		 57,  60,  63,  66,  69,  72,  75,  78,  81,  84,  87,  90,  93,  96,  99, 101 };
+	// corresponding to 0.5, 128 values quantized to 32
+	const TUint8 quantTable5[32] = { 
+		  3,   7,  11,  15,  19,  23,  27,  31,  35,  39,  43,  47,  51,  55,  59,  63,
+		 67,  71,  75,  79,  83,  87,  91,  95,  99, 103, 107, 111, 115, 119, 123, 126 };
+	// corresponding to 0.6, 154 values quantized to 32
+	const TUint8 quantTable6[32] = { 
+		  5,  13,  20,  27,  32,  36,  41,  45,  50,  54,  59,  63,  68,  72,  77,  81,
+		 86,  90,  95,  99, 103, 108, 112, 117, 121, 126, 130, 135, 139, 144, 148, 152 };
+	// corresponding to 0.7, 179 values quantized to 64
+	const TUint8 quantTable7[64] = { 
+		  5,   8,  11,  14,  17,  20,  23,  26,  29,  32,  35,  38,  41,  44,  47,  50,
+		 53,  56,  59,  62,  65,  68,  71,  74,  77,  80,  83,  86,  89,  92,  95,  98,
+		101, 104, 107, 110, 113, 116, 119, 122, 125, 128, 131, 134, 137, 140, 143, 146,
+		149, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 178 };
+	// corresponding to 0.8, 204 values quantized to 64
+	const TUint8 quantTable8[64] = { 
+		  5,  10,  15,  20,  25,  29,  33,  36,  40,  42,  45,  48,  51,  54,  57,  60,
+		 63,  66,  69,  72,  75,  78,  81,  84,  87,  90,  93,  96,  99, 102, 105, 108,
+		111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156,
+		159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 189, 192, 195, 198, 201, 203 };
+	// corresponding to 0.9, 230 values quantized to 64
+	const TUint8 quantTable9[64] = { 
+		  5,  10,  15,  19,  23,  26,  30,  33,  37,  40,  44,  47,  51,  54,  58,  61,
+		 65,  68,  72,  75,  79,  82,  86,  89,  93,  96, 100, 103, 107, 110, 114, 117,
+		121, 124, 128, 131, 135, 138, 142, 145, 149, 152, 156, 159, 163, 166, 170, 173,
+		177, 180, 184, 187, 191, 194, 198, 201, 205, 208, 212, 215, 219, 222, 226, 228 };
+
+	const TUint8 indexTable[10]={1,2,3,4,5,6,7,8,9,10};
+
+	// figure out the position of the index (determines which table to use) 
+	TInt frameNumber = aTransitionFramenumber; 
+	if(frameNumber>=iStartNumberOfTransitionFrames) frameNumber=iStartNumberOfTransitionFrames-1;
+  TInt index = (frameNumber<<1) + aRepeatFrame;
+	if(index>=numberOfTables) index=numberOfTables-1;
+	position = indexTable[index];
+
+	// calculate new values
+	switch(position) 
+	{
+	case 10: 	// 0% frame1, 100% frame2
+		ptr.Set(yFrame1,yuvLength,yuvLength);
+		ptr.Copy(yFrame2,yuvLength);
+		break;
+	case 9:		// 10% frame1, 90% frame2
+		for(i=0; i<yLength; i++, yFrame1++,yFrame2++) // Y
+			*yFrame1 = (TUint8)(quantTable1[(*yFrame1)>>5] + quantTable9[(*yFrame2)>>2]);
+		for(i=0; i<uLength; i++, uFrame1++,uFrame2++,vFrame1++,vFrame2++)	// U
+		{
+			*uFrame1 = (TUint8)(quantTable1[(*uFrame1)>>5] + quantTable9[(*uFrame2)>>2] - 10);
+			*vFrame1 = (TUint8)(quantTable1[(*vFrame1)>>5] + quantTable9[(*vFrame2)>>2] - 10);
+		}
+		break;
+	case 8:		// 20% frame1, 80% frame2
+		for(i=0; i<yLength; i++, yFrame1++,yFrame2++) // Y
+			*yFrame1 = (TUint8)(quantTable2[(*yFrame1)>>4] + quantTable8[(*yFrame2)>>2]);
+		for(i=0; i<uLength; i++, uFrame1++,uFrame2++,vFrame1++,vFrame2++)	// U
+		{
+			*uFrame1 = (TUint8)(quantTable2[(*uFrame1)>>4] + quantTable8[(*uFrame2)>>2] - 15);
+			*vFrame1 = (TUint8)(quantTable2[(*vFrame1)>>4] + quantTable8[(*vFrame2)>>2] - 15);
+		}
+		break;
+	case 7:		// 30% frame1, 70% frame2
+		for(i=0; i<yLength; i++, yFrame1++,yFrame2++) // Y
+			*yFrame1 = (TUint8)(quantTable3[(*yFrame1)>>4] + quantTable7[(*yFrame2)>>2]);
+		for(i=0; i<uLength; i++, uFrame1++,uFrame2++,vFrame1++,vFrame2++)	// U
+		{
+			*uFrame1 = (TUint8)(quantTable3[(*uFrame1)>>4] + quantTable7[(*uFrame2)>>2] - 15);
+			*vFrame1 = (TUint8)(quantTable3[(*vFrame1)>>4] + quantTable7[(*vFrame2)>>2] - 15);
+		}
+		break;
+	case 6:		// 40% frame1, 60% frame2
+		for(i=0; i<yLength; i++, yFrame1++,yFrame2++) // Y
+			*yFrame1 = (TUint8)(quantTable4[(*yFrame1)>>3] + quantTable6[(*yFrame2)>>3]);
+		for(i=0; i<uLength; i++, uFrame1++,uFrame2++,vFrame1++,vFrame2++)	// U
+		{
+			*uFrame1 = (TUint8)(quantTable4[(*uFrame1)>>3] + quantTable6[(*uFrame2)>>3] - 10);
+			*vFrame1 = (TUint8)(quantTable4[(*vFrame1)>>3] + quantTable6[(*vFrame2)>>3] - 10);
+		}
+		break;
+	case 5:		// 50% frame1, 50% frame2
+		for(i=0; i<yLength; i++, yFrame1++,yFrame2++) // Y
+			*yFrame1 = (TUint8)(quantTable5[(*yFrame1)>>3] + quantTable5[(*yFrame2)>>3]);
+		for(i=0; i<uLength; i++, uFrame1++,uFrame2++,vFrame1++,vFrame2++)	// U
+		{
+			*uFrame1 = (TUint8)(quantTable5[(*uFrame1)>>3] + quantTable5[(*uFrame2)>>3] - 5);
+			*vFrame1 = (TUint8)(quantTable5[(*vFrame1)>>3] + quantTable5[(*vFrame2)>>3] - 5);
+		}
+		break;
+	case 4: 	// 60% frame1, 40% frame2
+		for(i=0; i<yLength; i++, yFrame1++,yFrame2++) // Y
+			*yFrame1 = (TUint8)(quantTable6[(*yFrame1)>>3] + quantTable4[(*yFrame2)>>3]);
+		for(i=0; i<uLength; i++, uFrame1++,uFrame2++,vFrame1++,vFrame2++)	// U
+		{
+			*uFrame1 = (TUint8)(quantTable6[(*uFrame1)>>3] + quantTable4[(*uFrame2)>>3] - 10);
+			*vFrame1 = (TUint8)(quantTable6[(*vFrame1)>>3] + quantTable4[(*vFrame2)>>3] - 10);
+		}
+		break;
+	case 3: 	// 70% frame1, 30% frame2
+		for(i=0; i<yLength; i++, yFrame1++,yFrame2++) // Y
+			*yFrame1 = (TUint8)(quantTable7[(*yFrame1)>>2] + quantTable3[(*yFrame2)>>4]);
+		for(i=0; i<uLength; i++, uFrame1++,uFrame2++,vFrame1++,vFrame2++)	// U
+		{
+			*uFrame1 = (TUint8)(quantTable7[(*uFrame1)>>2] + quantTable3[(*uFrame2)>>4] - 8);
+			*vFrame1 = (TUint8)(quantTable7[(*vFrame1)>>2] + quantTable3[(*vFrame2)>>4] - 8);
+		}
+		break;
+	case 2: 	// 80% frame1, 20% frame2
+		for(i=0; i<yLength; i++, yFrame1++,yFrame2++) // Y
+			*yFrame1 = (TUint8)(quantTable8[(*yFrame1)>>2] + quantTable2[(*yFrame2)>>4]);
+		for(i=0; i<uLength; i++, uFrame1++,uFrame2++,vFrame1++,vFrame2++)	// U
+		{
+			*uFrame1 = (TUint8)(quantTable8[(*uFrame1)>>2] + quantTable2[(*uFrame2)>>4] - 8);
+			*vFrame1 = (TUint8)(quantTable8[(*vFrame1)>>2] + quantTable2[(*vFrame2)>>4] - 8);
+		}
+		break;
+	case 1: 	// 90% frame1, 10% frame2
+		for(i=0; i<yLength; i++, yFrame1++,yFrame2++) // Y
+			*yFrame1 = (TUint8)(quantTable9[(*yFrame1)>>2] + quantTable1[(*yFrame2)>>5]);
+		for(i=0; i<uLength; i++, uFrame1++,uFrame2++,vFrame1++,vFrame2++)	// U
+		{
+			*uFrame1 = (TUint8)(quantTable9[(*uFrame1)>>2] + quantTable1[(*uFrame2)>>5] - 5);
+			*vFrame1 = (TUint8)(quantTable9[(*vFrame1)>>2] + quantTable1[(*vFrame2)>>5] - 5);
+		}
+		break;
+	default: 	// e.g., 100% frame1, 0% frame2
+		break;
+	}
+	return;
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::ApplySlidingTransitionEffect
+// Applies sliding transition effect between two YUV frames
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//	
+void CVideoProcessor::ApplySlidingTransitionEffect(TUint8* aYUVPtr1, 
+												   TUint8* aYUVPtr2,
+												   TVedMiddleTransitionEffect aVedMiddleTransitionEffect,
+												   TInt aRepeatFrame,
+												   TInt aTransitionFramenumber)
+{
+	TInt i;
+	TSize tempSize = iProcessor->GetMovieResolution();
+	TInt yLength = tempSize.iWidth*tempSize.iHeight;
+	TInt uLength = yLength>>2;
+	TInt yWidth = tempSize.iWidth;
+	TInt uWidth = tempSize.iWidth>>1;
+	TInt yHeight = tempSize.iHeight; 
+	TInt uHeight = tempSize.iHeight>>1; 
+	TUint8* yFrame1 = (TUint8*)aYUVPtr1;
+	TUint8* uFrame1 = (TUint8*)(yFrame1+yLength); 
+	TUint8* vFrame1 = (TUint8*)(uFrame1+uLength); 	
+	TUint8* yFrame2 = (TUint8*)aYUVPtr2;
+	TUint8* uFrame2 = (TUint8*)(yFrame2+yLength); 
+	TUint8* vFrame2 = (TUint8*)(uFrame2+uLength); 	
+	TPtr8 ptr(0,0);
+	TInt offset = 0;
+	TInt ySliceWidth = 0;
+	TInt uSliceWidth = 0;
+	TInt sliceSize = 0;
+	TInt frameNumber = (aTransitionFramenumber<<1) + aRepeatFrame;
+
+	switch(aVedMiddleTransitionEffect)
+	{
+		case EVedMiddleTransitionEffectWipeLeftToRight:
+			// figure out the amount of data to change 
+            VDASSERT(iStartNumberOfTransitionFrames,19);
+			ySliceWidth = (TInt)((TReal)yWidth * (TReal)(frameNumber+1)/(TReal)(iStartNumberOfTransitionFrames<<1) + 0.5); 
+			if(ySliceWidth>yWidth) ySliceWidth = yWidth; 
+			uSliceWidth = ySliceWidth>>1; 
+			// copy the relevant portions of the image from frame2 to frame1 
+			// y
+			for(i=0; i<yHeight; i++, yFrame1+=yWidth,yFrame2+=yWidth)
+			{
+				ptr.Set(yFrame1,ySliceWidth,ySliceWidth);
+				ptr.Copy(yFrame2,ySliceWidth);
+			}
+			// u,v
+			for(i=0; i<uHeight; i++, uFrame1+=uWidth,uFrame2+=uWidth,vFrame1+=uWidth,vFrame2+=uWidth)
+			{
+				ptr.Set(uFrame1,uSliceWidth,uSliceWidth);
+				ptr.Copy(uFrame2,uSliceWidth);
+				ptr.Set(vFrame1,uSliceWidth,uSliceWidth);
+				ptr.Copy(vFrame2,uSliceWidth);
+			}
+			break;
+		case EVedMiddleTransitionEffectWipeRightToLeft:
+			// figure out the amount of data to change 
+            VDASSERT(iStartNumberOfTransitionFrames,20);
+			ySliceWidth = (TInt)((TReal)yWidth * (TReal)(frameNumber+1)/(TReal)(iStartNumberOfTransitionFrames<<1) + 0.5); 
+			if(ySliceWidth>yWidth) ySliceWidth = yWidth; 
+			uSliceWidth = ySliceWidth>>1; 
+			// evaluate the yuv offsets and new positions to point to in the buffer
+			offset = yWidth-ySliceWidth;
+			yFrame1+=offset;
+			yFrame2+=offset;
+			offset = uWidth-uSliceWidth;
+			uFrame1+=offset;
+			uFrame2+=offset;
+			vFrame1+=offset;
+			vFrame2+=offset;
+			// copy the relevant portions of the image from frame2 to frame1 
+			// y
+			for(i=0; i<yHeight; i++, yFrame1+=yWidth,yFrame2+=yWidth)
+			{
+				ptr.Set(yFrame1,ySliceWidth,ySliceWidth);
+				ptr.Copy(yFrame2,ySliceWidth);
+			}
+			// u,v
+			for(i=0; i<uHeight; i++, uFrame1+=uWidth,uFrame2+=uWidth,vFrame1+=uWidth,vFrame2+=uWidth)
+			{
+				ptr.Set(uFrame1,uSliceWidth,uSliceWidth);
+				ptr.Copy(uFrame2,uSliceWidth);
+				ptr.Set(vFrame1,uSliceWidth,uSliceWidth);
+				ptr.Copy(vFrame2,uSliceWidth);
+			}
+			break;
+		case EVedMiddleTransitionEffectWipeTopToBottom:
+			// figure out the amount of data to change 
+            VDASSERT(iStartNumberOfTransitionFrames,21);
+			ySliceWidth = (TInt)((TReal)yHeight * (TReal)(frameNumber+1)/(TReal)(iStartNumberOfTransitionFrames<<1) + 0.5); 
+			if(ySliceWidth>yHeight) ySliceWidth = yHeight; 
+			uSliceWidth = ySliceWidth>>1; 
+			// copy the relevant portions of the image from frame2 to frame1 
+			// y
+			sliceSize = ySliceWidth * yWidth;
+			ptr.Set(yFrame1,sliceSize,sliceSize);
+			ptr.Copy(yFrame2,sliceSize);
+			// u,v
+			sliceSize = uSliceWidth * uWidth;
+			ptr.Set(uFrame1,sliceSize,sliceSize);
+			ptr.Copy(uFrame2,sliceSize);
+			ptr.Set(vFrame1,sliceSize,sliceSize);
+			ptr.Copy(vFrame2,sliceSize);
+			break;
+		case EVedMiddleTransitionEffectWipeBottomToTop:
+			// figure out the amount of data to change 
+            VDASSERT(iStartNumberOfTransitionFrames,22);
+			ySliceWidth = (TInt)((TReal)yHeight * (TReal)(frameNumber+1)/(TReal)(iStartNumberOfTransitionFrames<<1) + 0.5); 
+			if(ySliceWidth>yHeight) ySliceWidth = yHeight; 
+			uSliceWidth = ySliceWidth>>1; 
+			// evaluate the yuv offsets and new positions to point to in the buffer
+			offset = (yHeight-ySliceWidth) * yWidth;
+			yFrame1+=offset;
+			yFrame2+=offset;
+			offset = (uHeight-uSliceWidth) * uWidth;
+			uFrame1+=offset;
+			uFrame2+=offset;
+			vFrame1+=offset;
+			vFrame2+=offset;
+			// copy the relevant portions of the image from frame2 to frame1 
+			// y
+			sliceSize = ySliceWidth * yWidth;
+			ptr.Set(yFrame1,sliceSize,sliceSize);
+			ptr.Copy(yFrame2,sliceSize);
+			// u,v
+			sliceSize = uSliceWidth * uWidth;
+			ptr.Set(uFrame1,sliceSize,sliceSize);
+			ptr.Copy(uFrame2,sliceSize);
+			ptr.Set(vFrame1,sliceSize,sliceSize);
+			ptr.Copy(vFrame2,sliceSize);
+			break;		
+		case EVedMiddleTransitionEffectNone:
+		case EVedMiddleTransitionEffectDipToBlack:
+		case EVedMiddleTransitionEffectDipToWhite:
+		case EVedMiddleTransitionEffectCrossfade:
+		case EVedMiddleTransitionEffectLast:
+		default:
+			break;
+	}
+	return;
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::ApplySpecialEffect
+// Applies color effect for a YUV frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//	
+void CVideoProcessor::ApplySpecialEffect(TInt aColorEffect, TUint8* aYUVDataPtr, 
+                                         TInt aColorToneU, TInt aColorToneV)
+{
+	VDASSERT(aYUVDataPtr,23); 
+	VDASSERT(iVideoWidth,24); 
+	VDASSERT(iVideoHeight,25); 
+	TChar chr; 
+	TInt value; 
+	TInt offset;
+	TInt length;
+	// Values for the U & V Fill parameters
+	TInt uFillValue, vFillValue;
+	TPtr8 ptr(0,0); 
+	TSize tempSize = iProcessor->GetMovieResolution();
+	
+	// asad - check if mpeg4, then change pixel range from (-128,127) to (0,255)
+	if (iProcessor->GetOutputVideoType() == EVedVideoTypeMPEG4SimpleProfile)
+	{
+		// U
+		aColorToneU += 128;
+		if (aColorToneU<0)	 aColorToneU = 0;
+		if (aColorToneU>255) aColorToneU = 255;
+		// V
+		aColorToneV += 128; 
+		if (aColorToneV<0)	 aColorToneV = 0;
+		if (aColorToneV>255) aColorToneV = 255;
+	}
+	TChar uChr, vChr;
+	switch(aColorEffect)
+	{
+		case 0/*None*/: 
+			return; 
+		case 1/*BW*/:	
+			value = 128; 
+			chr = value;
+			offset = tempSize.iWidth*tempSize.iHeight;
+			length = offset>>1;								// u,v data length (2*L/2*W/2)
+			ptr.Set((TUint8*)(aYUVDataPtr+offset), length, length); 
+			ptr.Fill((TChar)chr); 
+			break;
+		case 2:
+			offset = tempSize.iWidth*tempSize.iHeight;
+			length = offset>>2;
+			uFillValue = aColorToneU;
+			uChr = uFillValue;
+			vFillValue = aColorToneV;
+			vChr = vFillValue;
+			
+			ptr.Set((TUint8*)(aYUVDataPtr + offset), length, length);
+			ptr.Fill((TChar)uChr);
+			
+			offset = 1.25 * offset; // For filling the v-value
+			ptr.Set((TUint8*)(aYUVDataPtr + offset), length, length);
+			ptr.Fill((TChar)vChr);
+			break;
+		default:			
+			return; 
+	}
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::TFrameOperation2TInt
+// Converts frame operation enumeration to int
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//	
+TInt CVideoProcessor::TFrameOperation2TInt(TDecoderFrameOperation aFrameOperation)
+{
+	switch(aFrameOperation)
+	{
+		case EDecodeAndWrite:
+			return 1;
+		case EDecodeNoWrite:
+			return 2;
+		case EWriteNoDecode:
+			return 3;
+		case ENoDecodeNoWrite:
+			return 4;
+		default:
+			return KErrGeneral;
+	}
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::TColorEffect2TInt
+// Converts  color effect enumeration to int
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//	
+TInt CVideoProcessor::TColorEffect2TInt(TVedColorEffect aColorEffect)
+{
+	switch(aColorEffect)
+	{
+		case EVedColorEffectNone:
+			return 0;
+		case EVedColorEffectBlackAndWhite:
+			return 1;
+	    case EVedColorEffectToning:
+			return 2;		
+		default:
+			return KErrGeneral;
+	}
+}
+
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::InputDataAvailable
+// Overridden CDataProcessor::InputDataAvailable() method
+// Called when new input blocks are available
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//	
+void CVideoProcessor::InputDataAvailable(TAny* /*aUserPointer*/)
+{
+    PRINT((_L("CVideoProcessor::InputDataAvailable()")));   
+	// Signal ourselves if we are decoding and a request is not
+	// pending:
+	if ( iDecoding && !iTranscoderInitPending && !iDecodePending &&
+	     (iStatus == KRequestPending) )
+	{
+	    PRINT((_L("CVideoProcessor::InputDataAvailable() - complete request")));   
+		TRequestStatus *status = &iStatus;
+		User::RequestComplete(status, KErrNone);
+	}
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::StreamEndReached
+// Overridden CDataProcessor::StreamEndReached() method
+// Called when input stream has ended
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+
+void CVideoProcessor::StreamEndReached(TAny* /*aUserPointer*/)
+{
+    PRINT((_L("CVideoProcessor::StreamEndReached()")));   
+	iStreamEnd = ETrue;
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::DoCancel
+// Cancels any asynchronous requests pending.
+//
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::DoCancel()
+{
+
+	// Cancel our internal request
+	if ( iStatus == KRequestPending )
+	{
+		TRequestStatus *status = &iStatus;
+		User::RequestComplete(status, KErrCancel);
+	}
+
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::GetNextClipTransitionInfo
+// Get the start transition info of the next clip.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CVideoProcessor::GetNextClipTransitionInfo()
+{
+	if ( iNextTransitionNumber == -1 )
+	{
+		iNextTransitionNumber = iProcessor->NextClipStartTransitionNumber();
+	}
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::DetermineResolutionChange
+// This function checks if the video clip is needed to be resampled
+// (other items were commented in a header).
+// ---------------------------------------------------------
+// Resolution Transcoder, check if this video clip need to be resample
+
+TBool CVideoProcessor::DetermineResolutionChange()
+{
+	TSize VideoClipResolution = iProcessor->GetVideoClipResolution();
+	TSize MovieResolution = iProcessor->GetMovieResolution();
+	if (VideoClipResolution != MovieResolution)
+		return ETrue;
+	else
+		return EFalse;
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::DetermineFrameRateChange
+// This function checks if the frame rate must be changed
+// => clip re-encoded
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CVideoProcessor::DetermineFrameRateChange()
+    {
+
+    TReal clipFrameRate = iProcessor->GetVideoClipFrameRate();
+    TReal movieFrameRate = iProcessor->GetMovieFrameRate();
+
+    // Do re-encoding only when reducing frame rate, 
+    // otherwise we would have to come up with new frames
+    if ( movieFrameRate > 0 && clipFrameRate > movieFrameRate )
+        return ETrue;
+
+    return EFalse;
+        
+    }
+
+// ---------------------------------------------------------
+// CVideoProcessor::DetermineFrameRateChange
+// This function checks if the bitrate must be changed
+// => clip re-encoded
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TBool CVideoProcessor::DetermineBitRateChange()
+    {
+
+    // : AVC bitrate transcoding from a higher level
+    //       to lower if resolution transcoding is not needed
+
+    if ( iProcessor->GetMovieVideoBitrate() > 0 ) // movie has bitrate restriction => need to transcode
+        return ETrue;
+    
+    if ( iProcessor->GetOutputVideoType() == EVedVideoTypeH263Profile0Level10 )
+    {
+        if (iDataFormat == EDataH263)
+        {
+            if ( (iProcessor->GetCurrentClipVideoType() != EVedVideoTypeH263Profile0Level10) &&
+                 (iProcessor->GetCurrentClipVideoType() != EVedVideoTypeUnrecognized) )
+                return ETrue;
+        }
+        
+        else if (iDataFormat == EDataMPEG4)
+        {
+            // level 0 and level 1 max bitrate is 64 kb/s
+            // others need to be transcoded
+            if (iInputMPEG4ProfileLevelId != 8 && iInputMPEG4ProfileLevelId != 1)
+                return ETrue;
+        }
+    }
+
+    return EFalse;
+
+    }
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::GetFrameDuration
+// Calculates the duration of current frame
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+TInt CVideoProcessor::GetFrameDuration(TInt aFrameNumber)
+{
+    // calculate frame duration in ticks
+    TInt startFrame = iProcessor->GetOutputNumberOfFrames() - iNumberOfFrames;
+    TInt absFrameNumber = startFrame + aFrameNumber;
+    TInt cur = absFrameNumber;
+    TInt next = cur+1;
+        
+    // frameDuration is in ticks, with timescale of the current input clip
+    if(next >= iProcessor->GetOutputNumberOfFrames())	
+    {                		
+    	return I64INT(iProcessor->GetVideoClipDuration() - iProcessor->VideoFrameTimeStamp(cur) );
+    }
+    else
+    {
+    	return I64INT( iProcessor->VideoFrameTimeStamp(next) - iProcessor->VideoFrameTimeStamp(cur) );                	
+    }
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::CheckVosHeaderL
+// Checks whether the resynch bit is set if set then resets to zero
+// (other items were commented in a header).
+// @return TBool 
+// ---------------------------------------------------------
+//
+
+TBool CVideoProcessor::CheckVosHeaderL(TPtrC8& aBuf)
+{
+	return iDecoder->CheckVOSHeaderL((TPtrC8&)aBuf);
+}
+
+
+// ---------------------------------------------------------
+// CVideoProcessor::RenderFrame
+// The H.263 decoder calls this function when a decoded
+// frame is available for retrieving
+// @return TInt
+// ---------------------------------------------------------
+//
+TInt CVideoProcessor::RenderFrame(TAny* aFrame)
+{	
+	iDecoder->FrameRendered(aFrame);		
+	return KErrNone;
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::MtoTimerElapsed
+// Called when timer has elapsed
+// ---------------------------------------------------------
+//
+void CVideoProcessor::MtoTimerElapsed(TInt aError)
+{   
+
+    PRINT((_L("CVideoProcessor::MtoTimerElapsed() begin")));     
+
+    if (aError != KErrNone)
+    {
+        iMonitor->Error(aError);
+        return;   
+    }
+    
+    VDASSERT(iFrameInfoArray[0].iEncodeFrame == 1, 110);        
+
+    // if next frame in encode queue is an intermediate modification frame
+    // and modification has not yet been applied, start waiting timer again        
+    if ( ( (iFrameInfoArray[0].iTransitionFrame == 1) ||
+           (iProcessor->GetColorEffect() != EVedColorEffectNone) ) &&
+           iFrameInfoArray[0].iModificationApplied == 0 )
+    {
+        PRINT((_L("CVideoProcessor::MtoTimerElapsed() - modification not done yet, set timer")));
+        
+        iTimer->SetTimer( TTimeIntervalMicroSeconds32( GetEncodingDelay() ) );
+        return;
+    }
+       
+    PRINT((_L("CVideoProcessor::MtoTimerElapsed() - removing pic with ts %d ms"), 
+        I64INT(iProcessor->GetVideoTimeInMsFromTicks(iFrameInfoArray[0].iTimeStamp, EFalse)) ))
+
+    // save frame number to be able to recover in case the frame 
+    // gets encoded regardless of the delay    
+    iSkippedFrameNumber = iFrameInfoArray[0].iFrameNumber;
+    
+    // remove skipped frame from queue
+    iFrameInfoArray.Remove(0);        
+    
+    PRINT((_L("CVideoProcessor::MtoTimerElapsed() - %d items in queue"), iFrameInfoArray.Count()));
+
+    if (iDecodingSuspended && !iStreamEndRead)
+    {
+        if (iFrameInfoArray.Count() < iMaxItemsInProcessingQueue && !iDelayedWrite)
+        {            
+            PRINT((_L("CVideoProcessor::MtoTimerElapsed() - Resume decoding")));
+            iDecodingSuspended = EFalse;
+            // activate object to start decoding
+            TRequestStatus *status = &iStatus;
+            User::RequestComplete(status, KErrNone);
+            return;
+        }
+    }    
+    
+    if ( !IsEncodeQueueEmpty() )
+    {    
+        // if there are still frames to be encoded, and next one is waiting,
+        // set timer again
+        if ( IsNextFrameBeingEncoded() )
+        {
+            if ( !iTimer->IsPending() )
+            {
+                PRINT((_L("CVideoProcessor::MtoTimerElapsed(), set timer again")));   
+                iTimer->SetTimer( TTimeIntervalMicroSeconds32( iMaxEncodingDelay ) );
+            }
+        }
+        return;
+    }        
+        
+    if (iDelayedWrite)
+    {     
+        PRINT((_L("CVideoProcessor::MtoTimerElapsed(), writing delayed frame")));
+        // write delayed frame
+        TRAPD( error, WriteDelayedFrameL() );
+        if (error != KErrNone)
+        {
+            iMonitor->Error(aError);
+            return;   
+        }
+    }          
+    
+    if ( iStreamEndRead )
+    {
+        if ( iFrameInfoArray.Count() != 0 )
+        {            
+            // return now if we have read stream end, but there are still frames waiting
+            // to be decoded => processing will be completed in MtroPictureFromTranscoder   
+            PRINT((_L("CVideoProcessor::MtoTimerElapsed(), end read but frames in progress, return")));
+            return;
+        }
+        
+        else
+        {
+            // activate to stop processing
+            PRINT((_L("CVideoProcessor::MtoTimerElapsed(), end read and all frames processed, stopping")));
+            iProcessingComplete = ETrue;
+        }
+    }
+
+    if (!IsActive())    
+    {
+        SetActive();
+        iStatus = KRequestPending;
+    }    
+    // activate object to continue/end processing
+    TRequestStatus *status = &iStatus;
+    User::RequestComplete(status, KErrNone);               
+    PRINT((_L("CVideoProcessor::MtoTimerElapsed() end")));
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::WriteBufferL
+// Called by transcoder to pass an encoded buffer
+// ---------------------------------------------------------
+//
+void CVideoProcessor::WriteBufferL(CCMRMediaBuffer* aBuffer)
+{
+    if ( iFrameInfoArray.Count() == 0 )
+        {
+        PRINT((_L("CVideoProcessor::WriteBufferL() not ready to receive buffer, return")));
+        return;
+        }
+
+    if ( ((iFrameInfoArray[0].iTranscoderMode != EFullWithIM) &&
+          (iFrameInfoArray[0].iTranscoderMode != EFull)) ||
+         (iFrameInfoArray[0].iEncodeFrame != 1) )
+        {
+        PRINT((_L("CVideoProcessor::WriteBufferL() encoded picture received but not expected, ignore & return")));
+        return;
+        }
+        
+               
+    // cancel timer
+    iTimer->CancelTimer();                	
+	
+	if (aBuffer->Type() == CCMRMediaBuffer::EVideoMPEG4DecSpecInfo)
+	{
+	    // should not happen
+	    return;
+	}		
+
+    TTimeIntervalMicroSeconds encodedTs = aBuffer->TimeStamp();        
+    
+    PRINT((_L("CVideoProcessor::WriteBufferL(), timestamp %d ms, keyFrame = %d"),
+               I64INT( encodedTs.Int64() ) / 1000, aBuffer->RandomAccessPoint() ));
+    
+    TBool removeItem = ETrue;
+    TInt64 timeStamp = 0;    
+    TInt frameNumber = 0;
+    
+    while (iFrameInfoArray.Count())
+    {
+        TTimeIntervalMicroSeconds ts = (iProcessor->GetVideoTimeInMsFromTicks(iFrameInfoArray[0].iTimeStamp, EFalse)) * 1000;
+
+        if (ts < encodedTs)
+        {            
+            // a frame has been skipped
+            iFrameInfoArray.Remove(0);
+            PRINT((_L("CVideoProcessor::WriteBufferL() frame skipped - number of items in queue: %d"), iFrameInfoArray.Count()));    
+        } 
+        else if (ts > encodedTs)
+        {
+            // this frame has most likely been treated as skipped using timer, 
+            // but it was encoded regardless
+            removeItem = EFalse;
+            frameNumber = iSkippedFrameNumber;
+            timeStamp = iProcessor->GetVideoTimeInTicksFromMs( encodedTs.Int64() / 1000, EFalse );
+
+            PRINT((_L("CVideoProcessor::WriteBufferL() frame skipped falsely, ts in ticks = %d"), I64INT(timeStamp)));            
+            break;
+        }       
+        else
+        {
+            // normal case, encoded frame timestamp is as expected
+            timeStamp = iFrameInfoArray[0].iTimeStamp;
+            frameNumber = iFrameInfoArray[0].iFrameNumber;
+            break;
+        }
+    }
+    
+    VDASSERT(iFrameInfoArray.Count(), 50);    
+    
+    // set descriptor for writing the frame
+    TPtr8 writeDes(0,0);			
+	writeDes.Set(const_cast<TUint8*>(aBuffer->Data().Ptr()), 
+	             aBuffer->Data().Length(), aBuffer->Data().Length());
+
+    HBufC8* tempBuffer = 0;
+    TInt error;           
+
+    if ( (iProcessor->GetOutputVideoType() == EVedVideoTypeMPEG4SimpleProfile) &&
+         (!iOutputVolHeaderWritten) && (frameNumber >= iFirstIncludedFrameNumber) )         
+    {
+	    VDASSERT(iOutputVolHeader, 51);
+	    
+	    // MPEG-4 output:
+	    // Encoded frame is the first one of the clip, insert VOL header at the beginning
+	    // Allocate a temp buffer to include vol header and	the encoded frame	    
+	    TInt length = iOutputVolHeader->Length() + aBuffer->Data().Length();	    	   
+	    TRAP(error, tempBuffer = (HBufC8*) HBufC8::NewL(length) );
+	    
+	    if (error != KErrNone)
+        {
+            iMonitor->Error(error);
+            return;
+        }        
+	    
+	    TPtr8 ptr( tempBuffer->Des() );
+	    ptr.Copy(iOutputVolHeader->Des());	    
+	    ptr.Append(aBuffer->Data());
+	    
+	    writeDes.Set(tempBuffer->Des());
+	    iOutputVolHeaderWritten = ETrue;
+	}
+	
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+	if (iProcessor->GetOutputVideoType() == EVedVideoTypeAVCBaselineProfile)
+	{		   
+
+	   // get number of NAL units	   
+       TUint8* tmp = const_cast<TUint8*>(aBuffer->Data().Ptr() + aBuffer->Data().Length());
+       
+       tmp -= 4;
+       TInt numNalUnits = TInt(tmp[0]) + (TInt(tmp[1])<<8) + (TInt(tmp[2])<<16) + (TInt(tmp[3])<<24);
+              
+       TInt totalLength = 0;
+              
+       // get nal_unit_type of first NAL
+       TUint8* type = const_cast<TUint8*>(aBuffer->Data().Ptr());
+       TInt nalType = *type & 0x1F;       
+       
+       PRINT((_L("CVideoProcessor::WriteBufferL() - # of NAL units = %d, frame # = %d, nal_unit_type = %d"), 
+           numNalUnits, frameNumber, nalType));       
+       
+       if (nalType != 1 && nalType != 5)
+       {
+           // there are extra SPS/PPS units in the beginning
+           // of the buffer, skip those
+           numNalUnits--;
+           
+           if (numNalUnits == 0)
+           {
+               PRINT((_L("CVideoProcessor::WriteBufferL() No NAL units left, return")));            
+               return;
+           }
+           
+           // point to first length field
+           tmp = const_cast<TUint8*>(aBuffer->Data().Ptr() + aBuffer->Data().Length());
+           tmp -= 4;  // #
+           tmp -= numNalUnits * 8; // offset & length for each NAL
+           tmp += 4;  // skip offset
+
+           // get NAL length
+           TInt len = TInt(tmp[0]) + (TInt(tmp[1])<<8) + (TInt(tmp[2])<<16) + (TInt(tmp[3])<<24);           
+           type += len;
+           nalType = *type & 0x1F;
+           
+           while (nalType != 1 && nalType != 5 && numNalUnits)
+           {
+               numNalUnits--;
+               tmp += 8;
+               len = TInt(tmp[0]) + (TInt(tmp[1])<<8) + (TInt(tmp[2])<<16) + (TInt(tmp[3])<<24);
+               type += len;
+               nalType = *type & 0x1F;
+           }
+           tmp = const_cast<TUint8*>(aBuffer->Data().Ptr() + aBuffer->Data().Length()) - 4;
+       }
+       
+       if (numNalUnits == 0)
+       {
+           PRINT((_L("CVideoProcessor::WriteBufferL() No NAL units left, return")));
+           return;
+       }
+       
+       // rewind to last length field
+       tmp -= 4;
+       
+       // get total length of slices
+       for (TInt x = numNalUnits; x > 0; x--)
+       {
+           totalLength += TInt(tmp[0]) + (TInt(tmp[1])<<8) + (TInt(tmp[2])<<16) + (TInt(tmp[3])<<24);
+           tmp -= 8;
+       }
+
+       TInt tempLength = totalLength + numNalUnits*4;
+              
+       // allocate output buffer
+	   TRAP(error, tempBuffer = (HBufC8*) HBufC8::NewL(tempLength) );
+       if (error != KErrNone)
+       {
+           iMonitor->Error(error);
+           return;  
+       }
+
+	   TUint8* dst = const_cast<TUint8*>(tempBuffer->Des().Ptr());
+	   TUint8* src = const_cast<TUint8*>(aBuffer->Data().Ptr());
+       
+       // point to first offset field
+       tmp += 4;
+
+       for (TInt x = numNalUnits; x > 0; x--)
+       {
+           // get length
+           tmp += 4;
+           TInt length = TInt(tmp[0]) + (TInt(tmp[1])<<8) + (TInt(tmp[2])<<16) + (TInt(tmp[3])<<24);
+           
+           // set length           
+           dst[0] = TUint8((length >> 24) & 0xff);
+           dst[1] = TUint8((length >> 16) & 0xff);
+           dst[2] = TUint8((length >> 8) & 0xff);
+           dst[3] = TUint8(length & 0xff);
+           dst += 4;
+           
+           // copy data
+           TPtr8 ptr(dst, length);
+           ptr.Copy(src, length);
+           
+           dst += length;
+           src += length;
+           
+           // point to next offset field
+           tmp +=4;
+       }       
+
+       writeDes.Set(tempBuffer->Des());
+       writeDes.SetLength(tempLength);
+
+	}
+#endif
+	
+	// Figure out are we writing frames from the first
+	// or second clip in color transition
+			
+    TBool colorTransitionFlag = ETrue;
+    TInt index = KNumTransitionFrames / 4;    
+	
+	if ( iFrameInfoArray[0].iTransitionFrame == 1 &&
+         iFrameInfoArray[0].iTransitionPosition == EPositionStartOfClip && 
+         iStartTransitionColor == EColorTransition )
+	{
+	    if ( ( (iFrameInfoArray[0].iTransitionFrameNumber == index) && 
+	           (iFrameInfoArray[0].iRepeatFrame == 0) ) ||
+	            iFrameInfoArray[0].iTransitionFrameNumber < index )
+	    {
+            colorTransitionFlag = EFalse;
+	    }
+	}				
+
+    // write frame
+    error = iProcessor->WriteVideoFrameToFile((TDesC8&)writeDes, 
+                     timeStamp, 0 /*dummy*/, 
+                     aBuffer->RandomAccessPoint(), EFalse, colorTransitionFlag, ETrue );
+
+    if (tempBuffer)    
+        delete tempBuffer;                         
+                     
+    if (error == KErrCompletion)
+    {
+        PRINT((_L("CVideoProcessor::WriteBufferL() - processing complete")));    
+        // stop processing
+        iProcessingComplete = ETrue;
+        iFrameInfoArray.Reset();
+        VDASSERT(iTranscoderStarted, 51);
+        iTransCoder->StopL();
+        iTranscoderStarted = EFalse;
+        if (!IsActive())
+        {
+            SetActive();
+            iStatus = KRequestPending;
+        }        
+            
+        // activate object to end processing
+        TRequestStatus *status = &iStatus;
+        User::RequestComplete(status, KErrNone);       
+        return;
+    }
+    
+    else if (error != KErrNone)
+    {
+        iMonitor->Error(error);
+        return;
+    }        
+                     
+    TInt startFrame = iProcessor->GetOutputNumberOfFrames() - iNumberOfFrames;
+    TInt absFrameNumber = startFrame + frameNumber;
+    
+    // save frame number
+    iLastWrittenFrameNumber = frameNumber;
+    
+    iProcessor->SetFrameType(absFrameNumber, aBuffer->RandomAccessPoint());
+    
+    if (removeItem)
+    {        
+        iFrameInfoArray.Remove(0);     
+           
+        PRINT((_L("CVideoProcessor::WriteBufferL() - removed encoded pic, %d items in queue"), iFrameInfoArray.Count()));
+    } 
+    else
+        PRINT((_L("CVideoProcessor::WriteBufferL() - did not remove encoded pic, %d items in queue"), iFrameInfoArray.Count()));
+        
+           
+    if (iDecodingSuspended && !iStreamEndRead)
+    {
+        if (iFrameInfoArray.Count() < iMaxItemsInProcessingQueue && !iDelayedWrite)
+        {            
+            PRINT((_L("CVideoProcessor::WriteBufferL() - Resume decoding")));
+            iDecodingSuspended = EFalse;
+            // activate object to start decoding
+            TRequestStatus *status = &iStatus;
+            User::RequestComplete(status, KErrNone);
+            return;
+        }
+    }
+        
+    // if there are still frames to be encoded, start timer again        
+    if ( !IsEncodeQueueEmpty() )
+    {
+        // check if the next frame in queue is waiting to be encoded, set timer if so
+        if ( IsNextFrameBeingEncoded() )
+        {
+            if ( !iTimer->IsPending() )
+            {
+                PRINT((_L("CVideoProcessor::WriteBufferL(), set timer")));   
+                iTimer->SetTimer( TTimeIntervalMicroSeconds32( iMaxEncodingDelay ) );
+            }
+        }
+        return;
+    }
+
+    if (iStreamEndRead && !iDelayedWrite)
+    {
+    
+        PRINT((_L("CVideoProcessor::WriteBufferL() - stream end read & !iDelayedWrite")));    
+    
+        // stream end has been read
+        if (iFrameInfoArray.Count() == 0)
+        {
+            PRINT((_L("CVideoProcessor::WriteBufferL() - stream end read, no frames left")));
+            // end
+            if (!IsActive())
+            {
+                SetActive();
+                iStatus = KRequestPending;
+            }        
+            iProcessingComplete = ETrue;
+            // activate object to end processing
+            TRequestStatus *status = &iStatus;
+            User::RequestComplete(status, KErrNone);                   
+        }        
+        // else there are frames to be decoded, processing will be completed
+        // MtroPictureFromTranscoder
+        return;
+    }
+
+    if (iDelayedWrite)
+    {
+        if ( IsEncodeQueueEmpty() )
+        {
+            PRINT((_L("CVideoProcessor::WriteBufferL() writing delayed frame")));            
+            
+            TRAP(error, WriteDelayedFrameL());
+            if (error != KErrNone)
+            {
+                iMonitor->Error(error);
+                return;
+            }
+
+            if ( iStreamEndRead )
+            {
+                if ( iFrameInfoArray.Count() != 0 )
+                {            
+                    // return now if we have read stream end, but there are still frames waiting
+                    // to be decoded => processing will be completed in MtroPictureFromTranscoder   
+                    PRINT((_L("CVideoProcessor::WriteBufferL(), end read but frames in progress, return")));
+                    return;
+                }                
+                else
+                {
+                    // activate to stop processing
+                    PRINT((_L("CVideoProcessor::WriteBufferL(), end read and all frames processed, stopping")));
+                    iProcessingComplete = ETrue;
+                }
+            }
+            
+            if (!IsActive())
+            {
+                SetActive();
+                iStatus = KRequestPending;
+            }
+            // activate object to continue/end processing
+            TRequestStatus *status = &iStatus;
+            User::RequestComplete(status, KErrNone);
+            return;
+        }
+        else
+        {                
+            // check if the next frame in queue is waiting to be encoded, set timer if so
+            if ( IsNextFrameBeingEncoded() )
+            {
+                if ( !iTimer->IsPending() )
+                {
+                    PRINT((_L("CVideoProcessor::WriteBufferL() - iDelayedWrite, set timer")));   
+                    iTimer->SetTimer( TTimeIntervalMicroSeconds32( iMaxEncodingDelay ) );
+                }            
+                return;
+            }
+        }
+    }        
+      
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::IsEncodeQueueEmpty
+// (other items were commented in a header)
+// ---------------------------------------------------------
+//
+TBool CVideoProcessor::IsEncodeQueueEmpty()
+{
+
+    // check if there are still frames waiting to be encoded
+    for (TInt i = 0; i < iFrameInfoArray.Count(); i++)
+    {
+         if (iFrameInfoArray[i].iEncodeFrame == 1)             
+         {
+             return EFalse;         
+         }
+    }
+    return ETrue;
+    
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::IsNextFrameBeingEncoded
+// (other items were commented in a header)
+// ---------------------------------------------------------
+//
+TBool CVideoProcessor::IsNextFrameBeingEncoded()
+{
+   
+    // check if the next frame in queue is waiting to be encoded
+    if ( iFrameInfoArray.Count() && (iFrameInfoArray[0].iEncodeFrame == 1) )
+    {
+        
+        VDASSERT( ( iFrameInfoArray[0].iTranscoderMode == EFull ||
+                    iFrameInfoArray[0].iTranscoderMode == EFullWithIM ), 120 );
+        
+        if ( (iFrameInfoArray[0].iTranscoderMode == EFull) ||
+             (iFrameInfoArray[0].iModificationApplied == 1) )
+        {
+            return ETrue;            
+        }
+    }
+       
+    return EFalse;
+    
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::GetEncodingDelay
+// (other items were commented in a header)
+// ---------------------------------------------------------
+//
+TInt CVideoProcessor::GetEncodingDelay()
+{
+
+    // number of decode only -frames in queue before first encode frame
+    TInt numDecodeFrames = 0;
+    
+    TInt i;
+    for (i = 0; i < iFrameInfoArray.Count(); i++)
+    {
+        // get index of next encode frame in queue
+        if (iFrameInfoArray[i].iEncodeFrame == 1)
+            break;
+        else 
+            numDecodeFrames++;
+    }
+    
+    VDASSERT(i < iFrameInfoArray.Count(), 112);
+    
+    TInt delay = iMaxEncodingDelay;
+    
+    // If the next frame in encoding queue is an intermediate modification frame
+    // (either transition frame or color effect has to be applied)    
+    // and modification has not been applied to it, double the default delay    
+    if ( ( (iFrameInfoArray[0].iTransitionFrame == 1) ||
+           (iProcessor->GetColorEffect() != EVedColorEffectNone) ) &&
+           iFrameInfoArray[0].iModificationApplied == 0 )
+    {
+        PRINT((_L("CVideoProcessor::GetEncodingDelay() - double the delay")));
+        delay <<= 1;
+    }        
+    
+    // add time to process decode-only frames to delay
+    delay += numDecodeFrames * (iMaxEncodingDelay / 2);
+    
+    PRINT((_L("CVideoProcessor::GetEncodingDelay() - encoding delay = %d ms, num decode frames %d"), delay/1000, numDecodeFrames));
+            
+    return delay;
+        
+    
+    
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::WriteDelayedFrameL
+// (other items were commented in a header)
+// ---------------------------------------------------------
+//
+void CVideoProcessor::WriteDelayedFrameL()
+{
+
+    PRINT((_L("CVideoProcessor::WriteDelayedFrameL() begin")));
+    
+    // write the delayed frame
+    TPtr8 ptr(iDelayedBuffer->Des());            
+    
+    TInt error = iProcessor->WriteVideoFrameToFile(ptr, 
+                iDelayedTimeStamp, 0 /*dummy*/, 
+                iDelayedKeyframe, EFalse, EFalse, EFalse );
+                
+    if (error == KErrCompletion)
+    {
+        PRINT((_L("CVideoProcessor::WriteDelayedFrameL() write delayed frame, processing complete")));
+        VDASSERT(iTranscoderStarted, 51);
+        iTransCoder->StopL();
+        iTranscoderStarted = EFalse;
+        iFrameInfoArray.Reset();
+        iTimer->CancelTimer();
+        iProcessingComplete = ETrue;                                  
+    } 
+    else if (error != KErrNone)
+    {
+        User::Leave(error);        
+    }      
+    
+    // save frame number
+    iLastWrittenFrameNumber = iDelayedFrameNumber;
+    
+    delete iDelayedBuffer;
+    iDelayedBuffer = 0;
+    iDelayedWrite = EFalse;        
+    
+    PRINT((_L("CVideoProcessor::WriteDelayedFrameL() end")));   
+    
+}
+            
+TInt CVideoProcessor::SetVideoFrameSize(TSize /*aSize*/)
+{
+
+    PRINT((_L("CVideoProcessor::SetVideoFrameSize()")))    
+    
+    return KErrNone;
+}
+            
+TInt CVideoProcessor::SetAverageVideoBitRate(TInt /*aBitRate*/)
+{
+
+    PRINT((_L("CVideoProcessor::SetAverageVideoBitRate()")))
+    
+    return KErrNone;
+}
+        
+   
+TInt CVideoProcessor::SetMaxVideoBitRate(TInt /*aBitRate*/)
+{
+    PRINT((_L("CVideoProcessor::SetMaxVideoBitRate()")))
+    
+    return KErrNone;
+}
+            
+TInt CVideoProcessor::SetAverageAudioBitRate(TInt /*aBitRate*/)
+{
+    PRINT((_L("CVideoProcessor::SetAverageAudioBitRate()")))    
+    
+    return KErrNone;
+}
+
+// ---------------------------------------------------------
+// CVideoProcessor::SetVideoCodecL()
+// Interpret and store video mime type
+// ---------------------------------------------------------
+//
+void CVideoProcessor::SetOutputVideoCodecL(const TPtrC8& aMimeType)
+    {
+    TBuf8<256> string;
+    TBuf8<256> newMimeType;
+    string = KVedMimeTypeH263;
+    string += _L8( "*" );		
+
+    iMaxOutputFrameRate = 15.0;
+    iArbitrarySizeAllowed = EFalse;
+
+    if ( aMimeType.MatchF( (const TDesC8& )string ) != KErrNotFound ) 
+        {
+        // H.263
+
+        newMimeType = KVedMimeTypeH263;
+
+        if ( aMimeType.MatchF( _L8("*profile*") ) != KErrNotFound )
+            {
+            // profile given, check if we support it
+            if ( aMimeType.MatchF( _L8("*profile=0*")) != KErrNotFound )
+                {
+                // profile 0 requested
+                newMimeType += _L8( "; profile=0" );
+                }
+            else
+                {
+                // no other profiles supported
+                PRINT((_L("CVideoEncoder::SetVideoCodecL() unsupported profile")));
+                User::Leave(KErrNotSupported);
+                }
+            }
+        else
+            {
+            // no profile is given => assume 0
+            newMimeType += _L8( "; profile=0" );
+            }
+
+        if ( aMimeType.MatchF( _L8("*level=10*") ) != KErrNotFound )
+            {
+    		iMaxOutputBitRate = iOutputBitRate = KVedBitRateH263Level10;
+    		iMaxOutputResolution = KVedResolutionQCIF;
+    		//dataBufferSize = KMaxCodedPictureSizeQCIF;
+            newMimeType += _L8( "; level=10" );
+            }
+        else if ( aMimeType.MatchF( _L8("*level=45*") ) != KErrNotFound )
+            {
+    		iMaxOutputBitRate = iOutputBitRate = KVedBitRateH263Level45;
+    		iMaxOutputResolution = KVedResolutionQCIF;
+    		//dataBufferSize = KMaxCodedPictureSizeQCIF;
+            newMimeType += _L8( "; level=45" );
+            }
+        else if ( aMimeType.MatchF( _L8("*level*") ) != KErrNotFound )
+            {
+            // no other levels supported
+            PRINT((_L("CVideoEncoder::SetVideoCodecL() unsupported level")));
+            User::Leave(KErrNotSupported);
+            }
+        else
+            {
+            // if no level is given assume 10
+    		iMaxOutputBitRate = iOutputBitRate = KVedBitRateH263Level10;
+    		iMaxOutputResolution = KVedResolutionQCIF;
+    		//dataBufferSize = KMaxCodedPictureSizeQCIF;
+            newMimeType += _L8( "; level=10" );
+            }
+        }
+    else
+        {
+        string = KVedMimeTypeMPEG4Visual;
+        string += _L8( "*" );
+
+        if ( aMimeType.MatchF( string ) != KErrNotFound ) 
+            {
+            // MPEG-4 Visual
+            newMimeType = KVedMimeTypeMPEG4Visual;
+            if ( aMimeType.MatchF( _L8("*profile-level-id=8*") ) != KErrNotFound )
+                {
+                // simple profile level 0
+        		iMaxOutputBitRate = iOutputBitRate = KVedBitRateMPEG4Level0;
+        		iMaxOutputResolution = KVedResolutionQCIF;
+                // define max size 10K
+                //dataBufferSize = KMaxCodedPictureSizeMPEG4QCIF;
+                newMimeType += _L8("; profile-level-id=8");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=9*") ) != KErrNotFound )
+                {
+                // simple profile level 0b
+        		iMaxOutputBitRate = iOutputBitRate = KVedBitRateMPEG4Level0;
+        		iMaxOutputResolution = KVedResolutionQCIF;
+                // define max size 10K
+                //dataBufferSize = KMaxCodedPictureSizeMPEG4QCIF;
+                newMimeType += _L8("; profile-level-id=9");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=1*") ) != KErrNotFound )
+                {
+                // simple profile level 1
+        		iMaxOutputBitRate = iOutputBitRate = KVedBitRateMPEG4Level0;
+        		iMaxOutputResolution = KVedResolutionQCIF;
+                // define max size 10K
+                //dataBufferSize = KMaxCodedPictureSizeMPEG4QCIF;
+                iArbitrarySizeAllowed = ETrue;                
+                newMimeType += _L8("; profile-level-id=1");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=2*") ) != KErrNotFound )
+                {
+                // simple profile level 2
+			    //dataBufferSize = KMaxCodedPictureSizeMPEG4CIF;
+        		iMaxOutputResolution = KVedResolutionCIF;
+			    iMaxOutputBitRate = iOutputBitRate = KVedBitRateMPEG4Level2;
+                iArbitrarySizeAllowed = ETrue;                
+                newMimeType += _L8("; profile-level-id=2");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=3*") ) != KErrNotFound )
+                {
+                // simple profile level 3
+			    //dataBufferSize = KMaxCodedPictureSizeMPEG4CIF;
+			    iMaxOutputBitRate = iOutputBitRate = KVedBitRateMPEG4Level2;
+        		iMaxOutputResolution = KVedResolutionCIF;
+			    iMaxOutputFrameRate = 30.0;
+                iArbitrarySizeAllowed = ETrue;                
+                newMimeType += _L8("; profile-level-id=3");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=4*") ) != KErrNotFound )
+                {
+                // simple profile level 4a
+			    iMaxOutputBitRate = iOutputBitRate = KVedBitRateMPEG4Level4A;	        	
+			    //dataBufferSize = KMaxCodedPictureSizeVGA;
+        		iMaxOutputResolution = KVedResolutionVGA;
+			    iMaxOutputFrameRate = 30.0;
+                iArbitrarySizeAllowed = ETrue;                
+                newMimeType += _L8("; profile-level-id=4");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=*") ) != KErrNotFound )
+                {
+                // no other profile-level ids supported
+                PRINT((_L("CVideoEncoder::SetVideoCodecL() unsupported MPEG-4 profile-level")));
+                User::Leave(KErrNotSupported);
+                }
+            else
+                {
+                // Default is level 0 in our case (normally probably level 1)
+        		iMaxOutputBitRate = iOutputBitRate = KVedBitRateMPEG4Level0;
+        		iMaxOutputResolution = KVedResolutionQCIF;
+                // define max size 10K
+                //dataBufferSize = KMaxCodedPictureSizeMPEG4QCIF;
+                newMimeType += _L8("; profile-level-id=8");
+                }
+            }
+                       
+        else
+            {
+            
+#ifdef VIDEOEDITORENGINE_AVC_EDITING
+            string = KVedMimeTypeAVC;
+            string += _L8( "*" );
+            
+            if ( aMimeType.MatchF( string ) != KErrNotFound ) 
+                {
+                // AVC
+                newMimeType = KVedMimeTypeAVC;
+                if ( aMimeType.MatchF( _L8("*profile-level-id=42800A*") ) != KErrNotFound )
+                    {
+                    // baseline profile level 1
+            		iMaxOutputBitRate = iOutputBitRate = KVedBitRateAVCLevel1;
+            		iMaxOutputResolution = KVedResolutionQCIF;                    
+                    newMimeType += _L8("; profile-level-id=42800A");
+                    }                    
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=42900B*") ) != KErrNotFound )
+                    {
+                    // baseline profile level 1b
+            		iMaxOutputBitRate = iOutputBitRate = KVedBitRateAVCLevel1b;
+            		iMaxOutputResolution = KVedResolutionQCIF;                    
+                    newMimeType += _L8("; profile-level-id=42900B");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=42800B*") ) != KErrNotFound )
+                    {
+                    // baseline profile level 1.1
+            		iMaxOutputBitRate = iOutputBitRate = KVedBitRateAVCLevel1_1;
+            		iMaxOutputResolution = KVedResolutionCIF;                    
+                    newMimeType += _L8("; profile-level-id=42800B");
+                    }
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=42800C*") ) != KErrNotFound )
+                    {
+                    // baseline profile level 1.2
+            		iMaxOutputBitRate = iOutputBitRate = KVedBitRateAVCLevel1_2;
+            		iMaxOutputResolution = KVedResolutionCIF;                    
+                    newMimeType += _L8("; profile-level-id=42800C");
+                    }
+                //WVGA task
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=42801E*") ) != KErrNotFound )
+                    {
+                    // baseline profile level 3.0
+                    iMaxOutputBitRate = iOutputBitRate = KVedBitRateAVCLevel3;
+                    iMaxOutputResolution = KVedResolutionWVGA;                    
+                    newMimeType += _L8("; profile-level-id=42801E");
+                    }
+                
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=42801F*") ) != KErrNotFound )
+                    {
+                    // baseline profile level 3.1
+            		iMaxOutputBitRate = iOutputBitRate = KVedBitRateAVCLevel3_1;
+            		iMaxOutputResolution = KVedResolutionWVGA;                    
+                    newMimeType += _L8("; profile-level-id=42801F");
+                    }        
+                else if ( aMimeType.MatchF( _L8("*profile-level-id=*") ) != KErrNotFound )
+                    {
+                    // no other profile-level ids supported
+                    PRINT((_L("CVideoEncoder::SetVideoCodecL() unsupported AVC profile-level")));
+                    User::Leave(KErrNotSupported);
+                    }
+                else
+                    {
+                        // Default is level 1 (?)
+            	 	    iMaxOutputBitRate = iOutputBitRate = KVedBitRateAVCLevel1;
+            	 	    iMaxOutputResolution = KVedResolutionQCIF;
+            		    newMimeType += _L8("; profile-level-id=42800A");
+                    }                
+                }
+
+            else
+                {
+                // unknown mimetype
+                User::Leave( KErrNotSupported );
+                }
+#else
+           
+               // unknown mimetype
+               User::Leave( KErrNotSupported );
+           
+#endif
+            }
+        }
+
+    // successfully interpreted the input mime type
+    iOutputMimeType = newMimeType;
+        
+    /*if ( iDataBuffer )
+        {
+        delete iDataBuffer;
+        iDataBuffer = NULL;
+        }
+	iDataBuffer = (HBufC8*) HBufC8::NewL(dataBufferSize);    */
+	
+    }
+    
+// ---------------------------------------------------------
+// CVideoProcessor::GetVosHeaderSize()
+// Gets the size of MPEG-4 VOS header (from encoder)
+// ---------------------------------------------------------
+//
+TInt CVideoProcessor::GetVosHeaderSize()
+{
+    VDASSERT(iOutputVolHeader, 190);
+    
+    return iOutputVolHeader->Length();
+}
+    
+// ---------------------------------------------------------
+// CCallbackTimer::NewL()
+// Two-phased constructor
+// ---------------------------------------------------------
+//
+CCallbackTimer* CCallbackTimer::NewL(MTimerObserver& aObserver)
+{
+ 
+    CCallbackTimer* self = new (ELeave) CCallbackTimer(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    
+    return self;    
+}
+
+// ---------------------------------------------------------
+// CCallbackTimer::CCallbackTimer()
+// C++ default constructor.
+// ---------------------------------------------------------
+//
+CCallbackTimer::CCallbackTimer(MTimerObserver& aObserver)  :
+    CActive(EPriorityStandard), iObserver(aObserver)
+    
+{
+}
+
+// ---------------------------------------------------------
+// CCallbackTimer::~CCallbackTimer()
+// Destructor
+// ---------------------------------------------------------
+//
+CCallbackTimer::~CCallbackTimer()
+{ 
+    Cancel();
+       
+    if ( iTimerCreated )
+	{
+        iTimer.Close();
+		iTimerCreated = EFalse;
+	}
+}
+
+// ---------------------------------------------------------
+// CCallbackTimer::ConstructL()
+// Symbian 2nd phase constructor 
+// ---------------------------------------------------------
+//
+void CCallbackTimer::ConstructL()
+{
+  	// Create a timer 
+	User::LeaveIfError(iTimer.CreateLocal());
+	iTimerCreated = ETrue;
+	
+	// Add us to active scheduler
+	CActiveScheduler::Add(this);	
+}
+
+// ---------------------------------------------------------
+// CCallbackTimer::SetTimer()
+// Set timer
+// ---------------------------------------------------------
+//
+void CCallbackTimer::SetTimer(TTimeIntervalMicroSeconds32 aDuration)
+{
+
+//    __ASSERT_DEBUG(!iTimerRequestPending != 0, -5000); //CSI: #174-D: expression has no effect, just an assert debug no effect intended    
+//    __ASSERT_DEBUG(iTimerCreated, -5001);
+    
+    PRINT((_L("CCallbackTimer::SetTimer()")))
+    
+    // activate timer to wait for encoding
+    SetActive();
+    iStatus = KRequestPending;        
+    iTimer.After(iStatus, aDuration);
+    iTimerRequestPending = ETrue;        
+    
+}
+
+// ---------------------------------------------------------
+// CCallbackTimer::CancelTimer()
+// Cancel timer
+// ---------------------------------------------------------
+//
+void CCallbackTimer::CancelTimer()
+{ 
+     PRINT((_L("CCallbackTimer::CancelTimer()")))
+     Cancel();
+}
+
+// ---------------------------------------------------------
+// CCallbackTimer::RunL()
+// AO running method
+// ---------------------------------------------------------
+//
+void CCallbackTimer::RunL()
+{
+    if ( iTimerRequestPending )
+    {
+        iTimerRequestPending = EFalse;
+        
+        // call observer
+        iObserver.MtoTimerElapsed(KErrNone);                
+    }
+}
+
+// ---------------------------------------------------------
+// CCallbackTimer::DoCancel()
+// AO cancelling method 
+// ---------------------------------------------------------
+//
+void CCallbackTimer::DoCancel()
+{
+
+    // Cancel our timer request if we have one
+    if ( iTimerRequestPending )
+    {
+        iTimer.Cancel();
+        iTimerRequestPending = EFalse;
+        return;
+    }
+    
+}
+
+// ---------------------------------------------------------
+// CCallbackTimer::RunError()
+// AO RunL error method
+// ---------------------------------------------------------
+//
+TInt CCallbackTimer::RunError(TInt aError)
+{
+    Cancel();
+    
+    // call observer
+    iObserver.MtoTimerElapsed(aError);
+
+    return KErrNone;
+}
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/yuv2rgb12.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,433 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation of class CYuv2Rgb12.
+* YUV to EColor4K colorspace converter concrete classes.
+*
+*/
+
+/*
+-----------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    
+
+-----------------------------------------------------------------------------
+*/
+
+
+//  EXTERNAL RESOURCES  
+
+
+//  Include Files  
+
+#include <e32math.h>
+#include "yuvconverter.h"
+#include "yuv2rgb12.h"
+#include "brightnesscontrast.h"
+
+
+//  MEMBER FUNCTIONS
+
+
+//=============================================================================
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb12
+
+    CYuv2Rgb12()
+
+    Standard C++ constructor
+
+-----------------------------------------------------------------------------
+*/
+
+CYuv2Rgb12::CYuv2Rgb12()
+{
+    iRgbLookupTable = 0;
+    iGamma = 65536;
+    iBrightnessContrast = KMedBrightnessContrastIndex;
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb12
+
+    ~CYuv2Rgb12()
+
+    Standard C++ destructor
+
+-----------------------------------------------------------------------------
+*/
+
+CYuv2Rgb12::~CYuv2Rgb12()
+{
+    User::Free(iRgbLookupTable);
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb12
+
+    ConstructL()
+
+    Standard Symbian OS second-phase constructor. Initializes the object.
+
+-----------------------------------------------------------------------------
+*/
+
+void CYuv2Rgb12::ConstructL(TUint aWidth, TUint aHeight, TUint aMaxWidth, TUint aMaxHeight)
+{
+    // Remember the dimensions
+//    __ASSERT_ALWAYS(((aWidth & 3) == 0) && ((aHeight & 3) == 0),
+//                    User::Leave(KErrArgument));
+    iWidth = aWidth;
+    iHeight = aHeight;
+    if ( iWidth > aMaxWidth ) {
+        iCropWidth = (iWidth-aMaxWidth)/2;
+        iWidth = aMaxWidth;
+    }
+    else {
+        iCropWidth = 0;
+    }
+    if ( iHeight > aMaxHeight ) {
+        iCropHeight = (iHeight-aMaxHeight)/2;
+        iHeight = aMaxHeight;
+    }
+    else {
+        iCropHeight = 0;
+    }
+
+    // Allocate the RGB saturate/gamma lookup table    
+    iRgbLookupTable = (TUint8*) User::AllocL(ESaturateLength);
+
+    // Initialize brightness & contrast value, this will calculate the conversion table
+    // Since this uses the median index, it makes no difference if the preferred 
+    // enhancement is this or gamma. Furthermore, changes to the value will be done using
+    // the appropriate method.
+    SetBrightnessContrast(KMaxBCInputIndex/2);
+    
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb12
+
+    SetGamma()
+
+    Sets the conversion gamma value and recalculates the look-up table
+    Please use the SetBrightnessContrast method for Series 60 display 
+
+-----------------------------------------------------------------------------
+*/
+void CYuv2Rgb12::SetGamma(TInt aGamma)
+{
+    TInt i, v;
+    TReal vNorm;
+    
+    // Remember gamma and convert it to floating point
+    iGamma = aGamma;
+    TReal fGamma = TReal(iGamma) / TReal(65536);
+
+    // Calculate table entries for all possible RGB values:
+    for ( i = 0; i < ESaturateLength; i++ )
+    {
+        // Actual RGB value for this table index
+        v = 298 * (i - ESaturateOffset - 16) / 256;
+        // (see Convert())
+
+        // Saturate if <0 or >255, otherwise calculate gamma       
+        if ( v < 0 )
+            v = 0;
+        else if ( v > 255 )
+            v = 255;
+        else
+        {
+            // Normalize v:
+            vNorm = TReal(v) / TReal(255);
+
+            // Gamma-correct: v = v ^ gamma
+            Math::Pow(vNorm, vNorm, fGamma);
+
+            // Scale back to [0..255] and clamp:
+            vNorm = (TReal(255) * vNorm) + 0.5;
+            v = (TInt) vNorm;
+            if ( v < 0 ) v = 0;
+            if ( v > 255 ) v = 255;
+        }
+
+        // 12bpp RGB has range [0..15] for all components, store to table:
+        iRgbLookupTable[i] = (TUint8) (v >> 4);
+    }
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb12
+
+    SetBrightnessContrast()
+
+    Sets the index to the predefined brightness&contrast lookup table 
+    (KBrightnessContrastEnhParam) and recalculates the RGB look-up table
+    The algorithm was developed by IMAAMI for Kenny display.
+
+-----------------------------------------------------------------------------
+*/
+void CYuv2Rgb12::SetBrightnessContrast(TInt aBCIndex)
+{
+    TInt i, v;
+    TReal vNorm;
+    
+    // Convert & remember brightness-contrast index. aBCIndex == 0 to KMaxBCInputIndex.
+    iBrightnessContrast = (aBCIndex*KMaxBrightnessContrastIndex)/KMaxBCInputIndex;
+
+
+    // Calculate table entries for all possible RGB values:
+    for ( i = 0; i < ESaturateLength; i++ )
+    {
+        // Actual RGB value for this table index
+        v = 298 * (i - ESaturateOffset - 16) / 256;
+        // (see Convert())
+
+        // Saturate if <0 or >255, otherwise calculate value
+        if ( v < 0 )
+            v = 0;
+        else if ( v > 255 )
+            v = 255;
+        else
+        {
+
+            // Normalize v:
+            vNorm = TReal(v) / TReal(255);
+
+            vNorm = KBrightnessContrastEnhParam[iBrightnessContrast].a * vNorm + KBrightnessContrastEnhParam[iBrightnessContrast].b;
+            if ( vNorm < 0 ) 
+                vNorm = 0;
+            else if ( vNorm > 1 )
+                vNorm = 1;
+            Math::Pow( vNorm, vNorm, KBrightnessContrastEnhParam[iBrightnessContrast].g );
+
+            // Scale back to [0..255] and clamp:
+            vNorm = (TReal(255) * vNorm) + 0.5;
+            v = (TInt) vNorm;
+            if ( v < 0 ) v = 0;
+            if ( v > 255 ) v = 255;
+        }
+
+        // 12bpp RGB has range [0..15] for all components, store to table:
+        iRgbLookupTable[i] = (TUint8) (v >> 4);
+    }
+}
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb12
+
+    Convert()
+
+    Converts a YUV frame to a ERgb12 frame
+
+-----------------------------------------------------------------------------
+*/
+
+void CYuv2Rgb12::Convert(const TUint8 *aYBuf, const TUint8 *aUBuf,
+                         const TUint8 *aVBuf,
+                         TUint aBufWidth, TUint aBufHeight,
+                         TUint8 *aTarget, TUint aTargetScanlineLength)
+{
+    TUint cols;
+    TUint rows = iHeight;
+    TUint8 *target;
+    TUint8 *target2;
+    const TUint8 *yb, *yb2;
+    TInt y;
+    TInt uval, vval;
+    TUint8 val;
+    TUint8 *rgbLookup = iRgbLookupTable + ESaturateOffset;
+    TUint8 *rLookup, *gLookup, *bLookup;
+
+    __ASSERT_ALWAYS((aBufWidth >= iWidth) && (aBufHeight >= iHeight),
+                   User::Invariant());
+
+    // cropping needed?
+    if ( iCropWidth > 0 ) {
+        // sets offset to buffers; from now on increments below will always result 
+        // the same offset, since the increment is aBufWidth
+        aYBuf += iCropWidth;
+        aUBuf += iCropWidth/2;
+        aVBuf += iCropWidth/2;
+    }
+    if ( iCropHeight > 0 ) {
+        // skip lines on top
+        aYBuf += iCropHeight*aBufWidth;
+        aUBuf += (iCropHeight/2)*aBufWidth/2;
+        aVBuf += (iCropHeight/2)*aBufWidth/2;
+    }
+
+    // We don't interpolate the chrominance values at all, since that way we
+    // can save a lot of multiplications. This actually doesn't affect the
+    // subjective picture quality much, if at all, with natural images.
+
+    // Conversion is done 2x2 pixels at a time
+
+    // Luminance-only conversion?
+    if ( (aUBuf != NULL) && (aVBuf != NULL) )
+    {
+        // Full conversion
+        
+        // Convert all rows, two at a time
+        while ( rows )
+        {
+            // Convert all pixels in this row, two at a time
+            cols = iWidth;
+            target = aTarget;
+            target2 = aTarget + aTargetScanlineLength;
+            yb = aYBuf;
+            yb2 = aYBuf + aBufWidth;
+        
+            while ( cols )
+            {
+                // Traditional conversion:
+                // R =  1.1643828125 * (Y-16)  +  1.59602734375 * (Cr-128)
+                // G =  1.1643828125 * (Y-16)  +  -0.39178515625 * (Cb-128) + -0.81296875 * (Cr-128)
+                // B =  1.1643828125 * (Y-16)  +  2.01723046875 * (Cb-128)
+
+                // =>
+                // R =  1.1643828125 * (Y - 16 +  1.370706718285 * (Cr-128))
+                // G =  1.1643828125 * (Y - 16 +  -0.336474527143 * (Cb-128) + -0.6981971 * (Cr-128))
+                // B =  1.1643828125 * (Y - 16 +  1.732446105434 * (Cb-128))
+
+                // We'll create a lookup-table for 1.1643828125 * (x - 16). The
+                // range needs go from -222 to 476 plus room for dithering.
+                
+                // Component lookups based on chrominance values for this 2x2
+                // block
+                vval = ((TInt) aVBuf[0]) - 128;
+                //verified: shift to right is arithmetic in ARM-GCC => shifting of signed values is allowed
+                rLookup = &rgbLookup[(351 * vval) >> 8]; 
+                uval = ((TInt) aUBuf[0]) - 128;
+                gLookup = &rgbLookup[(-86*uval - 179*vval) >> 8];
+                bLookup = &rgbLookup[(444 * uval) >> 8];
+
+                // Bitmap format: ggggbbbb xxxxrrrr
+                
+                // Upper left pixel
+                y = yb[0];
+                target[0] = (TUint8) ((gLookup[y] << 4) | bLookup[y]);
+                target[1] = rLookup[y];
+                
+                // Upper right pixel
+                y = yb[1] + 8;
+                target[2] = (TUint8) ((gLookup[y] << 4) | bLookup[y]);
+                target[3] = rLookup[y];
+                    
+                // Lower left:
+                y = yb2[0] + 12;
+                target2[0] = (TUint8) ((gLookup[y] << 4) | bLookup[y]);
+                target2[1] = rLookup[y];
+
+                // Lower right:
+                y = yb2[1] + 4;
+                target2[2] = (TUint8) ((gLookup[y] << 4) | bLookup[y]);
+                target2[3] = rLookup[y];               
+                
+                // Next two pixels:
+                target += 4;
+                target2 += 4;
+                yb += 2;
+                yb2 += 2;
+                aUBuf++;
+                aVBuf++;
+                cols -= 2;
+            }
+
+            // Next rows
+            rows -= 2;
+            aYBuf += 2*aBufWidth;
+            aUBuf += (aBufWidth - iWidth)/2;
+            aVBuf += (aBufWidth - iWidth)/2;
+            aTarget += 2*aTargetScanlineLength;
+        }
+    }
+    else
+    {
+        // No chrominance given, do a luminance-only conversion
+        
+        // Convert all rows, two at a time
+        while ( rows )
+        {
+            // Convert all pixels in this row, two at a time
+            cols = iWidth;
+            target = aTarget;
+            target2 = aTarget + aTargetScanlineLength;
+            yb = aYBuf;
+            yb2 = aYBuf + aBufWidth;
+        
+            while ( cols )
+            {
+                // Upper left:
+                val = rgbLookup[yb[0]];
+                target[0] = (TUint8) ((val << 4) | val);
+                target[1] = val;
+
+                // Upper right:
+                val = rgbLookup[yb[1] + 8];
+                target[2] = (TUint8) ((val << 4) | val);
+                target[3] = val;
+
+                // Lower left:
+                val = rgbLookup[yb[0] + 12];
+                target2[0] = (TUint8) ((val << 4) | val);
+                target2[1] = val;
+
+                // Lower right:
+                val = rgbLookup[yb[1] + 4];
+                target2[2] = (TUint8) ((val << 4) | val);
+                target2[3] = val;
+
+                // Next two pixels:
+                target += 4;
+                target2 += 4;
+                yb += 2;
+                yb2 += 2;
+                cols -= 2;
+            }
+
+            // Next row
+            rows -= 2;
+            aYBuf += aBufWidth;
+            aTarget += aTargetScanlineLength;
+        }
+    }
+}
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedengine/videoprocessor/src/yuv2rgb24.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,419 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Implementation of class CYuv2Rgb24.
+* YUV to EColor16M colorspace converter concrete classes. 
+*
+*/
+
+
+
+
+//  EXTERNAL RESOURCES  
+
+
+//  Include Files  
+
+#include <e32math.h>
+#include "yuvconverter.h"
+#include "yuv2rgb24.h"
+#include "brightnesscontrast.h"
+
+
+//  MEMBER FUNCTIONS
+
+
+//=============================================================================
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb24
+
+    CYuv2Rgb24()
+
+    Standard C++ constructor
+
+-----------------------------------------------------------------------------
+*/
+
+CYuv2Rgb24::CYuv2Rgb24()
+{
+    iRgbLookupTable = 0;
+    iGamma = 65536;
+    iBrightnessContrast = KMedBrightnessContrastIndex;
+
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb24
+
+    ~CYuv2Rgb24()
+
+    Standard C++ destructor
+
+-----------------------------------------------------------------------------
+*/
+
+CYuv2Rgb24::~CYuv2Rgb24()
+{
+    User::Free(iRgbLookupTable);
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb24
+
+    ConstructL()
+
+    Standard Symbian OS second-phase constructor. Initializes the object.
+
+-----------------------------------------------------------------------------
+*/
+
+void CYuv2Rgb24::ConstructL(TUint aWidth, TUint aHeight, TUint aMaxWidth, TUint aMaxHeight)
+{
+    // Remember the dimensions
+//    __ASSERT_ALWAYS(((aWidth & 1) == 0) && ((aHeight & 1) == 0),
+//                    User::Leave(KErrArgument));
+    iWidth = aWidth;
+    iHeight = aHeight;
+    if ( iWidth > aMaxWidth ) {
+        iCropWidth = (iWidth-aMaxWidth)/2;
+        iWidth = aMaxWidth;
+    }
+    else {
+        iCropWidth = 0;
+    }
+    if ( iHeight > aMaxHeight ) {
+        iCropHeight = (iHeight-aMaxHeight)/2;
+        iHeight = aMaxHeight;
+    }
+    else {
+        iCropHeight = 0;
+    }
+
+    // Allocate the RGB saturate/gamma lookup table    
+    iRgbLookupTable = (TUint8*) User::AllocL(ESaturateLength);
+
+    // Initialize brightness & contrast value, this will calculate the conversion table
+    // Since this uses the median index, it makes no difference if the preferred 
+    // enhancement is this or gamma. Furthermore, changes to the value will be done using
+    // the appropriate method.
+    SetBrightnessContrast(KMaxBCInputIndex/2);
+}
+
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb24
+
+    SetGamma()
+
+    Sets the conversion gamma value and recalculates the look-up table
+
+-----------------------------------------------------------------------------
+*/
+
+void CYuv2Rgb24::SetGamma(TInt aGamma)
+{
+    TInt i, v;
+    TReal vNorm;
+    
+    // Remember gamma and convert it to floating point
+    iGamma = aGamma;
+    TReal fGamma = TReal(iGamma) / TReal(65536);
+
+    // Calculate table entries for all possible RGB values:
+    for ( i = 0; i < ESaturateLength; i++ )
+    {
+        // Actual RGB value for this table index
+        v = i - ESaturateOffset;
+
+        // Saturate if <0 or >255, otherwise calculate gamma       
+        if ( v < 0 )
+            v = 0;
+        else if ( v > 255 )
+            v = 255;
+        else
+        {
+            // Normalize v:
+            vNorm = TReal(v) / TReal(255);
+
+            // Gamma-correct: v = v ^ gamma
+            Math::Pow(vNorm, vNorm, fGamma);
+
+            // Scale back to [0..255] and clamp:
+            vNorm = (TReal(255) * vNorm) + 0.5;
+            v = (TInt) vNorm;
+            if ( v < 0 ) v = 0;
+            if ( v > 255 ) v = 255;
+        }
+
+        // 24bpp RGB has range [0..255] for all components, store to table:
+        iRgbLookupTable[i] = (TUint8) v;
+    }
+}
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb24
+
+    SetBrightnessContrast()
+
+    Sets the index to the predefined brightness&contrast lookup table 
+    (KBrightnessContrastEnhParam) and recalculates the RGB look-up table
+    The algorithm was developed by IMAAMI for Kenny display.
+
+-----------------------------------------------------------------------------
+*/
+void CYuv2Rgb24::SetBrightnessContrast(TInt aBCIndex)
+{
+    TInt i, v;
+    TReal vNorm;
+    
+    // Convert & remember brightness-contrast index. aBCIndex == 0 to KMaxBCInputIndex.
+    iBrightnessContrast = (aBCIndex*KMaxBrightnessContrastIndex)/KMaxBCInputIndex;
+
+    // Calculate table entries for all possible RGB values:
+    for ( i = 0; i < ESaturateLength; i++ )
+    {
+        // Actual RGB value for this table index
+        v = 298 * (i - ESaturateOffset - 16) / 256;
+        // (see Convert())
+
+        // Saturate if <0 or >255, otherwise calculate value
+        if ( v < 0 )
+            v = 0;
+        else if ( v > 255 )
+            v = 255;
+        else
+        {
+
+            // Normalize v:
+            vNorm = TReal(v) / TReal(255);
+
+            vNorm = KBrightnessContrastEnhParam[iBrightnessContrast].a * vNorm + KBrightnessContrastEnhParam[iBrightnessContrast].b;
+            if ( vNorm < 0 ) 
+                vNorm = 0;
+            else if ( vNorm > 1 )
+                vNorm = 1;
+            Math::Pow( vNorm, vNorm, KBrightnessContrastEnhParam[iBrightnessContrast].g );
+
+            // Scale back to [0..255] and clamp:
+            vNorm = (TReal(255) * vNorm) + 0.5;
+            v = (TInt) vNorm;
+            if ( v < 0 ) v = 0;
+            if ( v > 255 ) v = 255;
+        }
+
+        // 24bpp RGB has range [0..255] for all components, store to table:
+        iRgbLookupTable[i] = (TUint8) v;
+    }
+}
+
+
+/*
+-----------------------------------------------------------------------------
+
+    CYuv2Rgb24
+
+    Convert()
+
+    Converts a YUV frame to a EColor16M frame
+
+-----------------------------------------------------------------------------
+*/
+
+void CYuv2Rgb24::Convert(const TUint8 *aYBuf, const TUint8 *aUBuf,
+                         const TUint8 *aVBuf,
+                         TUint aBufWidth, TUint aBufHeight,
+                         TUint8 *aTarget, TUint aTargetScanlineLength)
+{
+    TUint cols;
+    TUint rows = iHeight;
+    TUint8 *target;
+    TUint8 *target2;
+    const TUint8 *yb, *yb2;
+    TInt rc, gc, bc;
+    TInt y;
+    TInt uval, vval;
+    TUint8 val;
+
+
+    __ASSERT_ALWAYS((aBufWidth >= iWidth) && (aBufHeight >= iHeight),
+                    User::Invariant());
+
+    // Cropping needed? 
+    if ( iCropWidth > 0 ) {
+        //sets offset to buffers; from now on increments below will always result the same offset, since the increment is aBufWidth
+        aYBuf += iCropWidth;
+        aUBuf += iCropWidth/2;
+        aVBuf += iCropWidth/2;
+    }
+    if ( iCropHeight > 0 ) {
+        //skip lines on top
+        aYBuf += iCropHeight*aBufWidth;
+        aUBuf += (iCropHeight/2)*aBufWidth/2;
+        aVBuf += (iCropHeight/2)*aBufWidth/2;
+    }
+    // We don't interpolate the chrominance values at all, since that way we
+    // can save a lot of multiplications. This actually doesn't affect the
+    // subjective picture quality much, if at all, with natural images.
+
+    // Conversion is done 2x2 pixels at a time
+
+    // Luminance-only conversion?
+    if ( (aUBuf != NULL) && (aVBuf != NULL) )
+    {
+        // Full conversion
+        
+        // Convert all rows, two at a time
+        while ( rows )
+        {
+            // Convert all pixels in this row, two at a time
+            cols = iWidth;
+            target = aTarget;
+            target2 = aTarget + aTargetScanlineLength;
+            yb = aYBuf;
+            yb2 = aYBuf + aBufWidth;
+        
+            while ( cols )
+            {
+                // Charles Poynton: Color FAQ
+                // (http://www.inforamp.net/~poynton/ColorFAQ.html)
+                // 30. How do I encode Y'CBCR components from computer R'G'B' ?
+
+                // [normalized]
+                // R =  1.1643828125 * (Y-16)  +  1.59602734375 * (Cr-128)
+                // G =  1.1643828125 * (Y-16)  +  -0.39178515625 * (Cb-128) + -0.81296875 * (Cr-128)
+                // B =  1.1643828125 * (Y-16)  +  2.01723046875 * (Cb-128)
+
+                // We'll use fixed-point with 16 bits of fractional part for
+                // accuracy. Besides, 24bpp RGB is not likely to be used in
+                // low-CPU devices in the near future...
+
+                // Red chrominance part for this 2x2 block:
+                vval = ((TInt) aVBuf[0]) - 128;
+                rc =  104597 * vval;
+
+                // Green chrominance:
+                uval = ((TInt) aUBuf[0]) - 128;
+                gc = -25676*uval - 53279*vval;
+
+                // Blue chrominance:
+                bc = 132201 * uval;
+
+                // Upper left pixel y part for all components:
+                y = 76309 * (((TInt) yb[0]) - 16) + 32768; // round up
+
+                // Calculate components and store:
+                // Bitmap format: bbbbbbbb gggggggg rrrrrrrr
+                target[0] = iRgbLookupTable[((y+bc) >> 16) + ESaturateOffset];
+                target[1] = iRgbLookupTable[((y+gc) >> 16) + ESaturateOffset];
+                target[2] = iRgbLookupTable[((y+rc) >> 16) + ESaturateOffset];
+
+                // Upper right pixel:
+                y = 76309 * (((TInt) yb[1]) - 16) + 32768;
+                target[3] = iRgbLookupTable[((y+bc) >> 16) + ESaturateOffset];
+                target[4] = iRgbLookupTable[((y+gc) >> 16) + ESaturateOffset];
+                target[5] = iRgbLookupTable[((y+rc) >> 16) + ESaturateOffset];
+
+                // Lower left:
+                y = 76309 * (((TInt) yb2[0]) - 16) + 32768;
+                target2[0] = iRgbLookupTable[((y+bc) >> 16) + ESaturateOffset];
+                target2[1] = iRgbLookupTable[((y+gc) >> 16) + ESaturateOffset];
+                target2[2] = iRgbLookupTable[((y+rc) >> 16) + ESaturateOffset];
+
+                // Lower right:
+                y = 76309 * (((TInt) yb2[1]) - 16) + 32768;
+                target2[3] = iRgbLookupTable[((y+bc) >> 16) + ESaturateOffset];
+                target2[4] = iRgbLookupTable[((y+gc) >> 16) + ESaturateOffset];
+                target2[5] = iRgbLookupTable[((y+rc) >> 16) + ESaturateOffset];
+
+                // Next two pixels:
+                target += 6;
+                target2 += 6;
+                yb += 2;
+                yb2 += 2;
+                aUBuf++;
+                aVBuf++;
+                cols -= 2;
+            }
+
+            // Next rows
+            rows -= 2;
+            aYBuf += 2*aBufWidth;
+            aUBuf += (aBufWidth - iWidth)/2;
+            aVBuf += (aBufWidth - iWidth)/2;
+            aTarget += 2*aTargetScanlineLength;
+        }
+    }
+    else
+    {
+        // No chrominance given, do a luminance-only conversion
+        
+        // Convert all rows
+        while ( rows )
+        {
+            // Convert all pixels in this row, two at a time
+            cols = iWidth;
+            target = aTarget;
+        
+            while ( cols )
+            {
+                // Do a pixel:
+                y = 76309 * (((TInt) aYBuf[0]) - 16) + 32768;
+                val = iRgbLookupTable[(y >> 16) + ESaturateOffset];
+                target[0] = val;
+                target[1] = val;
+                target[2] = val;
+
+                // And another one:
+                y = 76309 * (((TInt) aYBuf[1]) - 16) + 32768;
+                val = iRgbLookupTable[(y >> 16) + ESaturateOffset];
+                target[3] = val;
+                target[4] = val;
+                target[5] = val;
+
+                // Next two pixels:
+                target += 6;
+                aYBuf += 2;
+                cols -= 2;
+            }
+
+            // Next row
+            rows--;
+            aYBuf += aBufWidth - iWidth;
+            aTarget += aTargetScanlineLength;
+        }
+    }
+}
+
+
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/bwins/vedtranscoderu.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@CTRTranscoder@@SAPAV1@AAVMTRTranscoderObserver@@@Z @ 1 NONAME ; class CTRTranscoder * CTRTranscoder::NewL(class MTRTranscoderObserver &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/eabi/vedtranscoderu.def	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	_ZN13CTRTranscoder4NewLER21MTRTranscoderObserver @ 1 NONAME
+	_ZTI13CTRTranscoder @ 2 NONAME ; #<TI>#
+	_ZTV13CTRTranscoder @ 3 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/group/bld.inf	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description: 
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+vedtranscoder.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/group/vedtranscoder.mmp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* The media recorder DLL project definition file.
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+
+TARGET          vedtranscoder.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10204BF1   //KSharedLibraryUid
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+SOURCEPATH      ../src
+
+SOURCE          Ctrtranscoder.cpp
+SOURCE          Ctrtranscoderimp.cpp
+SOURCE          Ctrvideodecoderclient.cpp
+SOURCE          Ctrvideoencoderclient.cpp
+SOURCE          Ctrscaler.cpp
+
+USERINCLUDE     ../inc 
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+SYSTEMINCLUDE   /epoc32/include/mmf/devvideo
+
+// Symbian OS libraries
+LIBRARY 	euser.lib 
+LIBRARY 	devvideo.lib
+LIBRARY     centralrepository.lib
+
+
+//EXPORTUNFROZEN
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/CVEDSPPreprocessingCIM.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* HwDevice plugin.
+*
+*/
+
+
+/**
+* @Example of the CI usage:
+* 1. 
+* MVEDSPPreprocessingCI* preprocCI;
+* preprocCI = (MVEDSPPreprocessingCI*)iDevvrInstance->CustomInterface( hwdevUid, KVEDSPHwDevicePreprocCIUid );
+* 
+* where:
+* CDEVVRVideoRecord iDevvrInstance - The inctance of the DeviceVideoRecord;
+* TUid hwdevUid                    - Encode HwDevice Uid;
+* KVEDSPHwDevicePreprocCIUid       - Custom Interface Uid;
+* 
+*
+* 2. TInt errCode = preprocessCI->SetPreprocessing( preprocessMode );
+* 
+* where:
+* TBool preprocessMode - Preprocessing mode setting; ETrue - ON / EFalse - OFF;
+* 
+* Preprocessing mode can be set ON / OFF only before initializing of the DeviceVideoRecord;
+*
+*/
+
+
+#ifndef __MVEDSPPREPROCESSCI_H
+#define __MVEDSPPREPROCESSCI_H
+
+
+//  INCLUDES
+
+// CONSTANTS
+const TUid KVEDSPHwDevicePreprocCIUid =   {0x101F86D8};     // Preprocessing custom interface Uid
+
+
+// MACROS
+
+// DATA TYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+class MVEDSPPreprocessingCI
+    {
+    public:
+        
+        /**
+        * Enables / Disables preprocessing mode
+        * @since 2.6
+        * @param aMode ETrue - enable preprocessing
+        * @return KErrNone - Success, otherwise KErrNotReady - unable to process operation
+        */
+        virtual TInt SetPreprocessing( TBool aMode ) = 0;
+
+    };
+
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/buffermanagementci.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+#ifndef BUFFERMANAGEMENTCI_H
+#define BUFFERMANAGEMENTCI_H
+
+//  INCLUDES
+#include <mmf/devvideo/devvideobase.h>
+
+
+// CONSTANTS
+
+/** Buffer Management Custom Interface UID */
+const TUid KMmfVideoBuffermanagementUid = { 0x10204bea };
+
+
+// CLASS DECLARATIONS
+
+class MMmfVideoBufferManagementObserver;
+
+/**
+ * Buffer Management Custom Interface main interface class. Media
+ * devices that support this custom interface implement this class.
+ *
+ * The Buffer Management Custom Interface enchances the MDF DevVideo
+ * data flow model by enabling target media devices to allocate input
+ * data buffers for uncompressed data input. This lets client
+ * applications and source media devices write the input data directly
+ * into a suitable memory area that the target media device can use,
+ * possibly eliminating one extra memory copy from the data path. This
+ * is especially important with hardware implementations, where the
+ * target hardware may only have access to specially allocated memory
+ * that only the media device can allocate.
+ * 
+ * The interface is typically implemented in pre-processing, encoding,
+ * and post-processing media devices. It is mainly used for video
+ * encoder memory buffer input in applications like video editors, and
+ * when using hardware-accelerated post-processors with software video
+ * decoders.
+ */
+
+class MMmfVideoBufferManagement
+    {
+public:
+    /** A class used to signal the buffer options used. */
+    class TBufferOptions
+        {
+    public:
+        /**
+         * The number of input buffers that the media device *
+         * has. This is the number of buffers the client can request *
+         * through MmvbmGetBufferL() before writing any back.
+         */        
+        TUint iNumInputBuffers;
+
+        /**
+         * Buffer size in pixels. This should match the input data
+         * picture size, optionally with padding to meet coding
+         * standard requirements.
+         */
+        TSize iBufferSize;
+        };
+
+    
+    /** 
+     * Sets the observer object to use. The observer gets notified
+     * when new buffers are available and when buffers need to be
+     * released back to the media device.
+     *
+     * This method can only be called before the media device has
+     * been initialised with InitializeL().
+     * 
+     * @param aObserver The observer object to use.
+     */
+    virtual void MmvbmSetObserver(MMmfVideoBufferManagementObserver* aObserver) = 0;
+    
+    /** 
+     * Enables input buffer management mode. In buffer management mode
+     * the target media device allocates memory for input buffers and
+     * the client can only use input buffers allocated with
+     * MmvbmGetBufferL().
+     *
+     * This method can only be called before the media device has been
+     * initialised with InitializeL(). This method must be called if
+     * the client uses MmvbmGetBufferL().
+     * 
+     * @param aEnable ETrue if input buffer management mode is used.
+     */
+    virtual void MmvbmEnable(TBool aEnable) = 0;
+    
+    /** 
+     * Sets the buffer options to use. The client can request the
+     * number of input buffers that should be available, but typically
+     * only few (one or two) buffers can be used.
+     *
+     * This method can only be called before the media device has been
+     * initialised with InitializeL().
+     * 
+     * @param aOptions The buffer options to use, see TBufferOptions.
+     *
+     * @leave KErrNotSupported The requested buffer options are not
+     *   supported. Typically the client has requested too many input
+     *   buffers.
+     */
+    virtual void MmvbmSetBufferOptionsL(const TBufferOptions& aOptions) = 0;
+    
+    /** 
+     * Gets the buffer options currently in use.
+     *
+     * This method can only be called before the media device has been
+     * initialised with InitializeL().
+     * 
+     * @param aOptions Target buffer options data structure.
+     */
+    virtual void MmvbmGetBufferOptions(TBufferOptions& aOptions) = 0;
+    
+    /** 
+     * Gets a new input picture buffer. The client can then write data
+     * into the buffer and write it back to the media device with
+     * WritePictureL().
+     *
+     * This method can only be called after the media device has been
+     * initialised with InitializeL(). This method can only be called
+     * in buffer management mode, i.e. if the client has called
+     * MmvbmEnable(ETrue).
+     *
+     * Note that target-allocated and client-allocated input buffers
+     * cannot be mixed. In buffer management mode only input buffers
+     * allocated with this method can be sent to the media device.
+     *
+     * If a client has retrieved buffers with MmvbmGetBufferL(), it
+     * must be prepated to release them synchronously at any point if
+     * MmmfBufferManagementObserver::MmvbmoReleaseBuffers() is
+     * called. This may happen if the target media device suddenly
+     * loses access to the buffers due to DSA abort, resource
+     * management conflict, or media device destruction.
+     * 
+     * @param aSize The requested buffer size, in pixels. The buffer
+     *   size should match the picture size set at initialisation phase,
+     *   or otherwise suitable buffer may not be available. If the size
+     *   is smaller than the size set at initialisation phase, the
+     *   allocated buffer may be larger than requested.
+     * 
+     * @return A new input picture buffer. If no free buffers are
+     * available, the return value is NULL.
+     *
+     * @leave General The method will leave if an error occurs. Lack
+     * of free buffers is not considered an error.
+     */
+    virtual TVideoPicture* MmvbmGetBufferL(const TSize& aSize) = 0;
+    
+    /** 
+     * Releases an input buffer back to the media device without using
+     * it. This method is mainly used as a response to a
+     * MmvbmReleaseBuffers() callback.
+     * 
+     * @param aBuffer The buffer to release.
+     */
+    virtual void MmvbmReleaseBuffer(TVideoPicture* aBuffer) = 0;
+    };
+
+
+/**
+ * An observer class for the buffer management custom interface.
+ * Clients and source media devices using the interface
+ * must implement this class.
+*/
+class MMmfVideoBufferManagementObserver
+    {
+public:
+    /**
+     * Notifies the observer that one or more new input buffers are
+     * available. The client can then use MmvbmGetBufferL() to get a
+     * buffer.
+     */
+    virtual void MmvbmoNewBuffers() = 0;
+
+    /**
+     * Notifies the observer all outstanding input buffers must be
+     * released immediately. The client must synchronously call
+     * MmvbmReleaseBuffer() for all buffers it has allocated but not
+     * returned before returning from this method. This method is
+     * mainly used when the target media device loses access to the
+     * buffers, as a result of a Direct Screen Access abort, resource
+     * management override, or media device desctruction.
+     */
+    virtual void MmvbmoReleaseBuffers() = 0;
+    };
+
+
+#endif      // BUFFERMANAGEMENTCI_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrcommon.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Common elements / data types.
+*
+*/
+
+
+#ifndef CTRCOMMON_H
+#define CTRCOMMON_H
+
+// INCLUDES
+#include <e32std.h>
+
+
+/**
+*  Video coding options
+*  @lib TRANSCODER.LIB
+*  @since 3.1
+*/
+class TTRVideoCodingOptions
+    {
+    public:
+        // Segment interval in picture. In H.263 baseline this means number of non-empty GOB headers 
+        // (1=every GOB has a header), in H.264 and MPEG-4 the segement size in bytes. 
+        // Default is 0 == no segments inside picture
+        // Coding standard & used profile etc. limit the value.
+        TInt iSyncIntervalInPicture;
+        
+        // Time between random access points (I-Frame)
+        TUint iMinRandomAccessPeriodInSeconds;
+
+        // Relevant to MPEG4 only. Specifies whether data partitioning is in use. 
+        // When equal to ETrue, data partitioning is in use.
+        TBool iDataPartitioning;
+
+        // Relevant to MPEG4 only. Specifies whether reversible variable length coding is in use. 
+        // When equal to ETrue, reversible variable length coding is in use. 
+        // Valid only if iDataPartitioned is equal to ETrue.
+        TBool iReversibleVLC;
+
+        // Relevant to MPEG4 only. Header extension code. 
+        TUint iHeaderExtension;
+    };
+
+
+/**
+*  Video format
+*  @lib TRANSCODER.LIB
+*  @since 3.1
+*/
+class TTRVideoFormat
+    {
+    public:
+        // Video picture size
+        TSize iSize;
+
+        // Video data type
+        TInt iDataType;
+    };
+
+
+
+/**
+*  Video picture
+*  @lib TRANSCODER.LIB
+*  @since 3.1
+*/
+class TTRVideoPicture
+    {
+    public:
+        // Picture data
+        TPtr8* iRawData;
+
+        // Picture size in pixels
+        TSize iDataSize;
+
+        // Picture timestamp
+        TTimeIntervalMicroSeconds iTimestamp;
+
+        // Queue element
+        TDblQueLink iLink; 
+
+        // Misc user info
+        TAny* iUser;
+    };
+
+
+/**
+*  Display options
+*  @lib TRANSCODER.LIB
+*  @since 3.1
+*/
+class TTRDisplayOptions
+    {
+    public:
+        // The video output rectangle on screen
+        TRect   iVideoRect;
+
+        // Initial clipping region to use
+        TRegion iClipRegion;
+    };
+
+
+/**
+*  TTREventItem
+*  @lib TRANSCODER.LIB
+*/
+class CTREventItem : public CBase
+    {
+    public:
+        // Timestamp from which to start iAction
+        TTimeIntervalMicroSeconds iTimestamp;
+        
+        // EnableEncoder setting status
+        TBool iEnableEncoderStatus; 
+        
+        // Enable PS setting status
+        TBool iEnablePictureSinkStatus;
+        
+        // RandomAccess client's setting
+        TBool iRandomAccessStatus;
+        
+        // Enable / Disable encoder client setting
+        TBool iEnableEncoderClientSetting;
+        
+        // Enable / Disable picture sink client's setting
+        TBool iEnablePictureSinkClientSetting;
+        
+        // Queue link
+        TDblQueLink iLink;
+        
+    public:
+        // Reset item's setting
+        inline void Reset()
+            {
+            // Reset setting statuses & ts
+            iTimestamp = -1;
+            iEnableEncoderStatus = EFalse;
+            iEnablePictureSinkStatus = EFalse;
+            iRandomAccessStatus = EFalse;
+            };
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrdevvideoclientobserver.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* DevVideoClient observer.
+*
+*/
+
+
+#ifndef CTRDEVVICEOCLIENTOBSERVER_H
+#define CTRDEVVICEOCLIENTOBSERVER_H
+
+
+// INCLUDES
+#include <devvideobase.h>
+#include <devvideorecord.h>
+#include <CCMRMediaSink.h>
+
+
+/**
+*  Devvideo client observer
+*  @lib TRANSCODER.LIB
+*  @since 3.1
+*/
+class MTRDevVideoClientObserver
+    {
+    public:
+        /**
+        * Reports an error from the devVideo client
+        * @param aError Error reason
+        * @return void
+        */
+        virtual void MtrdvcoFatalError(TInt aError) = 0;
+
+        /**
+        * Reports that data encoding process has been finished
+        * @param none
+        * @return void
+        */
+        virtual void MtrdvcoEncStreamEnd() = 0;
+
+        /**
+        * Reports that data decoding process has been finished
+        * @param none
+        * @return void
+        */
+        virtual void MtrdvcoDecStreamEnd() = 0;
+
+        /**
+        * Returns video picture from the video encoder client
+        * @param aPicture video picture
+        * @return void
+        */
+        virtual void MtrdvcoEncoderReturnPicture(TVideoPicture* aPicture) = 0;
+
+        /**
+        * Returns videopicture from the renderer
+        * @param aPicture Video picture
+        * @return none
+        */
+        virtual void MtrdvcoRendererReturnPicture(TVideoPicture* aPicture) = 0;
+
+        /**
+        * Supplies new decoded picture
+        * @param aPicture Video picture
+        * @return none
+        */
+        virtual void MtrdvcoNewPicture(TVideoPicture* aPicture) = 0;
+
+        /**
+        * Supplies new encoded bitstream buffer
+        * @param aBuffer Media buffer
+        * @return none
+        */
+        virtual void MtrdvcoNewBuffer(CCMRMediaBuffer* aBuffer) = 0;
+
+        /**
+        * Informs about initializing video encoder client
+        * @param aError Initializing error status 
+        * @return void
+        */
+        virtual void MtrdvcoEncInitializeComplete(TInt aError) = 0;
+
+        /**
+        * Informs about initializing video decoder client
+        * @param aError Initializing error status 
+        * @return void
+        */
+        virtual void MtrdvcoDecInitializeComplete(TInt aError) = 0;
+
+        /**
+        * Returns media bitstream buffer to the client
+        * @param aBuffer Bitstream media buffer
+        * @return void
+        */
+        virtual void MtrdvcoReturnCodedBuffer(CCMRMediaBuffer* aBuffer) = 0;
+        
+        /**
+        * Notifies the transcoder about available picture buffers through BMCI or MDF
+        * @param none
+        * @return void
+        */
+        virtual void MtrdvcoNewBuffers() = 0;
+        
+        /**
+        * Indicates that a media device has lost its resources
+        * @param aFromDecoder Flag to indicate source
+        * @return none
+        */
+        virtual void MtrdvcoResourcesLost(TBool aFromDecoder) = 0;
+        
+        /**
+        * Indicates that a media device has regained its resources
+        * @return none
+        */
+        virtual void MtrdvcoResourcesRestored() = 0;
+    };
+
+
+
+
+#endif // CTRDEVVICEOCLIENTOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrhwsettings.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Video settings.
+*
+*/
+
+
+
+#ifndef CTRHWSETTINGS_H
+#define CTRHWSETTINGS_H
+
+// Constants for processing time estimates
+const TReal KTRDecodeTimeFactorH263HW = 0.04;
+const TReal KTRDecodeTimeFactorH263SW = 0.05;
+const TReal KTRDecodeTimeFactorH264HW = 0.05;
+const TReal KTRDecodeTimeFactorH264SW = 0.05;
+const TReal KTRDecodeTimeFactorMPEG4HW = 0.05;
+const TReal KTRDecodeTimeFactorMPEG4SW = 0.05;
+
+const TReal KTREncodeTimeFactorH263HW = 0.07;
+const TReal KTREncodeTimeFactorH263SW = 0.08;
+const TReal KTREncodeTimeFactorH264HW = 0.07;
+const TReal KTREncodeTimeFactorH264SW = 0.08;
+const TReal KTREncodeTimeFactorMPEG4HW = 0.07;
+const TReal KTREncodeTimeFactorMPEG4SW = 0.08;
+
+const TReal KTRResampleTimeFactorBilinear = 0.06;
+const TReal KTRResampleTimeFactorDouble = 0.05;
+const TReal KTRResampleTimeFactorHalve = 0.05;
+
+const TReal KTRTimeFactorScale = 1.0 / 640.0;
+
+const TInt KTRFallbackDecoderUidH263 = 0x10206674;     // ARM Decoder
+const TInt KTRFallbackDecoderUidH264 = 0x102073ef;     // ARM Decoder
+const TInt KTRFallbackDecoderUidMPEG4 = 0x10206674;    // ARM Decoder
+
+const TInt KTRFallbackEncoderUidH263 = 0x10282CFC;     // ARM Encoder
+const TInt KTRFallbackEncoderUidH264 = 0x20001C13;     // ARM Encoder
+const TInt KTRFallbackEncoderUidMPEG4 = 0x10282CFD;    // ARM Encoder
+
+const TInt KTRMaxFramesInProcessingDefault = 3;
+const TInt KTRMaxFramesInProcessingScaling = 5;
+
+const TReal KTRWideThreshold = 1.5;
+
+#endif // CTRHWSETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrprivatecrkeys.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+*
+*/
+
+
+
+#ifndef CTRPRIVATECRKEYS_H
+#define CTRPRIVATECRKEYS_H
+
+const TUid KCRUidTranscoder = {0x10204C07};
+
+const TUint32 KTRH263DecoderUid = 0x0001;
+const TUint32 KTRH264DecoderUid = 0x0002;
+const TUint32 KTRMPEG4DecoderUid = 0x0003;
+
+const TUint32 KTRH263EncoderUid = 0x0011;
+const TUint32 KTRH264EncoderUid = 0x0012;
+const TUint32 KTRMPEG4EncoderUid = 0x0013;
+
+const TUint32 KTRH263DecoderLowResUid = 0x0021;
+const TUint32 KTRH264DecoderLowResUid = 0x0022;
+const TUint32 KTRMPEG4DecoderLowResUid = 0x0023;
+
+const TUint32 KTRH263EncoderLowResUid = 0x0031;
+const TUint32 KTRH264EncoderLowResUid = 0x0032;
+const TUint32 KTRMPEG4EncoderLowResUid = 0x0033;
+
+const TUint32 KTRH263DecoderLowResThreshold = 0x0041;
+const TUint32 KTRH264DecoderLowResThreshold = 0x0042;
+const TUint32 KTRMPEG4DecoderLowResThreshold = 0x0043;
+
+const TUint32 KTRH263EncoderLowResThreshold = 0x0051;
+const TUint32 KTRH264EncoderLowResThreshold = 0x0052;
+const TUint32 KTRMPEG4EncoderLowResThreshold = 0x0053;
+
+#endif      // CTRPRIVATECRKEYS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrscaler.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Resampling framework for YUV 4.2.0.
+*
+*/
+
+
+
+#ifndef CTRSCALER_H
+#define CTRSCALER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include "ctrcommon.h"
+
+
+// Scaler operations
+enum EResamplingOpereation
+    {
+    EOperationNone,
+    EDoubleSize,          // Resize to 200%
+    EUpSampling,          // Resize to 101% or more
+    EOperationCopy,       // No resize (100%)
+    EOperationCopyWithBB, // No resize, add black borders
+    EDownSampling,        // Resize to 99% or less
+    EHalveSize,           // Resize to 50%
+    EUpDownSampling       // Resize with strech    
+    };
+
+// Scaler class, supports resampling operations with YUV 4.2.0 format;
+NONSHARABLE_CLASS(CTRScaler) : public CBase
+    {
+    public:
+        static CTRScaler* NewL();
+
+        // Destructor
+        ~CTRScaler();
+
+    public:
+        void Scale();
+
+        // Sets operations
+        void SetScalerOptionsL( TPtr8& aSrc, TPtr8& aTrg, TSize& aSrcSize, TSize& aTrgSize );
+        
+        // Checks if aspect ratio is wide
+        TBool IsWideAspectRatio(TSize aSize);        
+        
+        // Calculates intermediate resolution for use with black boxing
+        TBool GetIntermediateResolution(TSize aSrcSize, TSize aTrgSize, TSize& aTargetResolution, TSize& aBlackBoxing);
+        
+        // Returns a time estimate of how long it takes to resample a frame
+        TReal EstimateResampleFrameTime(const TTRVideoFormat& aInput, const TTRVideoFormat& aOutput);
+
+    private:
+        CTRScaler();
+
+        // Second phase constructor
+        void ConstructL();
+
+        // Resampling operations
+        void ResampleBilinear(TSize& aSrcSize, TSize& aTrgSize, TSize& aBlackBoxing);
+        void ResampleHalve(TSize& aSrcSize, TSize& aTrgSize, TSize& aBlackBoxing);
+        void ResampleDouble(TSize& aSrcSize, TSize& aTrgSize);
+        
+        // Called when resizing to less than 50% of the original size
+        void DoHalveAndBilinearResampleL();
+        
+        // No resampling, copy frame and add black borders.
+        void CopyWithBlackBoxing(TSize& aSrcSize, TSize& aTrgSize, TSize& aBlackBoxing);
+
+    private:
+        // Source buffer
+        TUint8* iSrc;
+
+        // Destination buffer
+        TUint8* iTrg;
+
+        // Source resolution
+        TSize iSrcSize; 
+
+        // Target resolution
+        TSize iTrgSize;
+        
+        // Resampling operation
+        TInt iOperation;
+
+        // Trg data size
+        TUint iTrgDataSize;
+        
+        // Initial src ptr
+        TUint8* iSrcInit;
+
+        // Initial trg ptr
+        TUint8* iTrgInit;
+
+        // Scale X
+        TInt iScaleXInt;
+
+        // Scale Y
+        TInt iScaleYInt;
+        
+        TPtr8* iTrgBuffer;
+        
+        // For storing width/height of black border area
+        TSize iBlackBoxing;
+        
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrsettings.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Video settings.
+*
+*/
+
+
+
+#ifndef CTRSETTINGS_H
+#define CTRSETTINGS_H
+
+// INCLUDES
+#include <devvideoconstants.h>
+
+
+// MACROS
+#ifdef _DEBUG
+#define DEBUGPRINT
+#endif
+
+// Debug print macro
+#ifdef DEBUGPRINT
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x;
+#else
+#define PRINT(x)
+#endif
+
+
+// CONSTANTS
+
+
+// Transcoder states
+enum TRStates
+    {
+    ETRNone, 
+    ETROpened, 
+    ETRInitializing, 
+    ETRInitialized, 
+    ETRRunning, 
+    ETRPaused, 
+    ETRStopping, 
+    ETRStopped, 
+    ETRFatalError
+    };
+
+enum TRCodecTypes
+    {
+    EH263, 
+    EMpeg4,
+    EH264
+    };
+
+// Input format parameters
+// Planar (first Y frame, then U, then V)
+const TYuvDataLayout KTRYuvLayout = EYuvDataPlanar;
+
+// YUV-RGB conversion coefficients to use: YUV data with range 0 (Y [16-235]) and conversion coefficients according to BT.601.5 
+const TYuvCoefficients KTRYuvCoefficients = EYuvBt601Range0;
+
+// Aspect ratio, in H.263 default is 12:11, but camera probably provides 1:1
+const TInt KTRAspectRatioNum = 12;
+const TInt KTRAspectRatioDenom = 11;
+
+
+// Quality is more important than delay in non real-time mode
+const TReal KTRLatencyQualityTradeoffNonRT = 1.0;
+
+// Tradeoff for real-time mode
+const TReal KTRLatencyQualityTradeoffRT = 0.3;
+
+// range is [0...100]
+const TUint KTRPictureQuality = 50;
+
+// (1.0 means the picture quality is sacrificed 
+// "all the way" to match the target fps
+const TReal KTRQualityTemporalTradeoff = 0.8;
+
+
+// 720x576,720x288,360x288
+// PAL 1, 2, 3
+
+// KTRDefaultSrcRate
+const TReal KTRDefaultSrcRate = 15.0;
+
+// KTRDefaultAccessRate
+const TReal KTRDefaultAccessRate = 0.2;
+
+// Number of video segments
+const TUint KTRMinNumberOfBuffersVideoSegment = 25;
+const TUint KTRMinNumberOfBuffersCodedPicture = 4;
+
+// Min number of bitstream buffers for decoder
+const TUint KTRDecoderMinNumberOfBuffers = 2;
+
+// Number of internal buffers for resampled uncompressed data
+const TUint KTRMinNumberOfResampledPictureBuffers = 4;
+
+// Codec levels
+const TUint KTRH263CodecLevel10 = 10;
+const TUint KTRH263CodecLevel20 = 20;
+const TUint KTRH263CodecLevel30 = 30;
+const TUint KTRH263CodecLevel40 = 40;
+const TUint KTRH263CodecLevel45 = 45;
+const TUint KTRH263CodecLevel50 = 50;
+const TUint KTRH263CodecLevel60 = 60;
+const TUint KTRH263CodecLevel70 = 70;
+
+const TUint KTRH264CodecLevel10 = 110;
+const TUint KTRH264CodecLevel10b = 119;
+const TUint KTRH264CodecLevel11 = 111;
+const TUint KTRH264CodecLevel12 = 112;
+const TUint KTRH264CodecLevel13 = 113;
+const TUint KTRH264CodecLevel20 = 120;
+const TUint KTRH264CodecLevel21 = 121;
+const TUint KTRH264CodecLevel22 = 122;
+const TUint KTRH264CodecLevel30 = 130;
+//WVGA task
+const TUint KTRH264CodecLevel31 = 131;
+
+const TUint KTRMPEG4CodecLevel0 = 0;
+const TUint KTRMPEG4CodecLevel1 = 1;
+const TUint KTRMPEG4CodecLevel2 = 2;
+const TUint KTRMPEG4CodecLevel3 = 3;
+const TUint KTRMPEG4CodecLevel0b = 9;
+const TUint KTRMPEG4CodecLevel4a = 4;
+
+// Bitstream buffer size
+const TUint KTRMaxBufferSizeLevel10 = 16384;
+const TUint KTRMaxBufferSizeLevel20 = 65536;
+const TUint KTRMaxBufferSizeLevel30 = 65536;
+const TUint KTRMaxBufferSizeLevel40 = 32768;
+const TUint KTRMaxBufferSizeLevel45 = 16384;
+const TUint KTRMaxBufferSizeLevel50 = 32768;
+const TUint KTRMaxBufferSizeLevel60 = 32768;
+const TUint KTRMaxBufferSizeLevel70 = 32768;
+
+const TUint KTRMaxBufferSizeH264Level10 = 19688;
+const TUint KTRMaxBufferSizeH264Level10b = 39375;
+const TUint KTRMaxBufferSizeH264Level11 = 56250;
+const TUint KTRMaxBufferSizeH264Level12 = 112500;
+const TUint KTRMaxBufferSizeH264Level13 = 225000;
+const TUint KTRMaxBufferSizeH264Level20 = 225000;
+const TUint KTRMaxBufferSizeH264Level21 = 450000;
+const TUint KTRMaxBufferSizeH264Level22 = 450000;
+const TUint KTRMaxBufferSizeH264Level30 = 1125000;
+//WVGA task
+const TUint KTRMaxBufferSizeH264Level31 = 2250000;
+
+const TUint KTRMaxBufferSizeLevel0 = 20480;
+const TUint KTRMaxBufferSizeLevel0b = 40960;
+const TUint KTRMaxBufferSizeLevel1 = 20480;
+const TUint KTRMaxBufferSizeLevel2 = 81920;
+const TUint KTRMaxBufferSizeLevel3 = 81920;
+const TUint KTRMaxBufferSizeLevel4a = 163840;
+
+// Bit rates for different profiles / levels, [kbps]
+const TUint KTRMaxBitRateH263Level10 = 64000;
+const TUint KTRMaxBitRateH263Level20 = 128000;
+const TUint KTRMaxBitRateH263Level30 = 384000;
+const TUint KTRMaxBitRateH263Level40 = 384000;
+const TUint KTRMaxBitRateH263Level45 = 128000;
+const TUint KTRMaxBitRateH263Level50 = 384000;
+const TUint KTRMaxBitRateH263Level60 = 384000;
+const TUint KTRMaxBitRateH263Level70 = 384000;
+
+const TUint KTRMaxBitRateH264Level10 = 64000;
+const TUint KTRMaxBitRateH264Level10b = 128000;
+const TUint KTRMaxBitRateH264Level11 = 192000;
+const TUint KTRMaxBitRateH264Level12 = 384000;
+const TUint KTRMaxBitRateH264Level13 = 768000;
+const TUint KTRMaxBitRateH264Level20 = 2000000;
+const TUint KTRMaxBitRateH264Level21 = 4000000;
+const TUint KTRMaxBitRateH264Level22 = 4000000;
+const TUint KTRMaxBitRateH264Level30 = 10000000;
+//WVGA task
+const TUint KTRMaxBitRateH264Level31 = 20000000;
+
+const TUint KTRMaxBitRateMPEG4Level0 = 64000;
+const TUint KTRMaxBitRateMPEG4Level0b = 128000;
+const TUint KTRMaxBitRateMPEG4Level1 = 64000;
+const TUint KTRMaxBitRateMPEG4Level2 = 128000;
+const TUint KTRMaxBitRateMPEG4Level3 = 384000;
+const TUint KTRMaxBitRateMPEG4Level4a = 4000000;
+
+
+// Target framerate default
+const TReal KTRTargetFrameRateDefault = 15.0;
+
+// Default segment size
+const TUint KTRDefaultSegmentSize = 256;
+
+// Min segment size
+const TUint KTRMinSegmentSize = 256;
+
+// Max desc8 length
+const TUint KMaxDesC8Length = 256;
+
+// Image size 
+const TUint KTRQCIFWidth = 176;
+const TUint KTRQCIFHeight = 144;
+const TUint KTRSubQCIFWidth = 128;
+const TUint KTRSubQCIFHeight = 96;
+const TUint KTRCIFWidth = 352;
+const TUint KTRCIFHeight = 288;
+const TUint KTRPALWidth = 720;
+const TUint KTRPAL2Height = 288;
+const TUint KTRPAL1Height = 576;
+const TUint KTRQVGAWidth = 320;
+const TUint KTRQVGAHeight = 240;
+const TUint KTRVGAWidth = 640;
+const TUint KTRVGAHeight = 480;
+const TUint KTR4CIFWidth = 704;
+const TUint KTR4CIFHeight = 576;
+const TUint KTRVGA16By9Width = 640;
+const TUint KTRVGA16By9Height = 352;
+//WVGA task
+const TUint KTRWVGAWidth = 864;
+const TUint KTRWVGAHeight = 480;
+
+// Number of TVideoPictures in TranscoderPicture queue 
+const TUint KTRPictureBuffersNumber = 2;
+
+// Number fo TTRVideoPicture containers in TRTranscoderQueue
+const TUint KTRPictureContainersNumber = 5;
+
+// Number of picture buffers allocated by encoder plugin (if BufferManagementCI is available)
+// Only few (one or two) buffers can be used: See mdf extensions spec for details
+const TUint KTRPictureBuffersNumberBMCI = 2;
+
+// X0 would be enough.. ? 
+const TUint KNumberOfEvents = 50;
+
+#endif // CTRSETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrtranscoder.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,342 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Transcoder.
+*
+*/
+
+
+#ifndef CTRTRANSCODER_H
+#define CTRTRANSCODER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <e32cmn.h>
+#include <BITDEV.H>                 // for CFbsScreenDevice
+#include <CCMRMediaSink.h>
+#include "ctrcommon.h"
+
+
+// FORWARD DECLARATIONS
+class MTRVideoPictureSink;
+class MTRTranscoderObserver;
+class MCMRMediaSink;
+
+
+// CLASS DECLARATION
+/**
+*  CTranscoder interface class
+*  Using CTRTranscoder: 
+*  - Create the transcoder instance 
+*  - Open the transcoder with specified options
+*  - Give settings
+*  - Initialize the transcoder with given options
+*  - Start transcoding after initializing is completed with MtroInitializeComplete observer callback.
+*  - Stop transcoding
+*  - Delete the transcoder instance
+*  @lib TRANSCODER.LIB
+*  @since 3.1
+*/
+class CTRTranscoder : public CBase
+    {
+    public:
+        
+        // Video data format
+        enum TTRVideoDataType
+            {
+            ETRDuCodedPicture = 0,  // Each data unit contains one coded video picture
+            ETRDuVideoSegment,  // Each data unit contains one coded video segment (according resync value (MPEG4) and GOB header in H.263)
+            ETRYuvRawData420,   // Each data unit represents uncompressed video picture in YUV 4:2:0 format
+            ETRYuvRawData422    // Each data unit represents uncompressed video picture in YUV 4:2:2 format
+            };
+
+        // Transcoder operational mode
+        enum TTROperationalMode
+            {
+            EFullTranscoding = 0,   // Full transcoding operation
+            EDecoding,          // Decoding only (picture resampling is possible)
+            EEncoding,          // Encoding only (picture resampling is possible)
+            EResampling,        // Picture resampling only (for YUV In / Out data)
+            EOperationNone      // None
+            };
+
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor. Create an instance the transcoder instance
+        * @param aObserver Transcoder observer
+        * @return CTranscoder instance. Can leave with Symbian error code
+        */
+        IMPORT_C static CTRTranscoder* NewL(MTRTranscoderObserver& aObserver);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CTRTranscoder();
+
+
+    public:
+        /**
+        * Open the transcoder. Instantiates other submodules based on the selected operational mode. 
+        * @param aMediaSink MCMRMediaSink for encoded data output
+        * @param aMode Mode for the transcoder, operation to perform
+        * @param aMimeTypeInputFormat  Mime type for input format
+        * @param aMimeTypeOutputFormat Mime type for otput format
+        * @param aRealTimeProcessing Specifies how to process data. ETrue - Real-time processing; EFalse - non-real time. 
+        * If the processing cannot be performed in real-time, the transcoder process data as fast as it can. 
+        * @return void. Can leave (KErrNotSupported - selected operation or codecs are not supported, 
+        * @ or any other Symbian error code )
+        */
+        virtual void OpenL( MCMRMediaSink* aMediaSink, 
+                            CTRTranscoder::TTROperationalMode aMode, 
+                            const TDesC8& aInputMimeType, 
+                            const TDesC8& aOutputMimeType, 
+                            const TTRVideoFormat& aVideoInputFormat, 
+                            const TTRVideoFormat& aVideoOutputFormat, 
+                            TBool aRealTime ) = 0;
+        
+        // Information methods
+        /**
+        * 
+        * @param
+        * @return
+        */
+        virtual TBool SupportsInputVideoFormat(const TDesC8& aMimeType) = 0;
+
+        /**
+        * 
+        * @param
+        * @return
+        */
+        virtual TBool SupportsOutputVideoFormat(const TDesC8& aMimeType) = 0;
+
+        /**
+        * Initializes the transcoder. Initializing completes asynchronously with MtroInitializeComplete observer callback.
+        * @param none
+        * @return void
+        */
+        virtual void InitializeL() = 0;
+
+        /**
+        * Starts transcoding. 
+        * @param none
+        * @return void. Can leave with Symbian error code in case of an error. 
+        */
+        virtual void StartL() = 0;
+
+        /**
+        * Stops transcoding synchronously. Use this method to stop data processing synchronously. In this case 
+        * all active requests are cancelled and data that was not processed is returned to data owner immediately. 
+        * @param none
+        * @return void. Can leave with Symbian error code in case of an error. 
+        */
+        virtual void StopL() = 0;
+
+        /**
+        * Stops transcoding asynchronously. The transcoder use this signal to ensure that the remaining data gets processed, 
+        * without waiting for new data. This method is mainly useful for file-to-file conversions and other non-realtime 
+        * processing. 
+        * @param none
+        * @return void. Can leave with Symbian error code in case of an error. 
+        */
+        virtual void AsyncStopL() = 0;
+
+        /**
+        * Pauses transcoding.
+        * @param 
+        * @return void. Can leave with Symbian error code in case of an error. 
+        */
+        virtual void PauseL() = 0;
+
+        /**
+        * Resumes transcoding. 
+        * @param 
+        * @return void. Can leave with Symbian error code in case of an error. 
+        */
+        virtual void Resume() = 0;
+
+
+        //  AA
+        virtual void SetDecoderInitDataL(TPtrC8& aInitData) = 0;
+
+        /**
+        * Sets bit rate parameter for transcoded bitstream. Can be run-time setting
+        * @param aBitRate Bitrate
+        * @return void Can leave with KErrNotSupported
+        */
+        virtual void SetVideoBitRateL(TUint aBitRate) = 0;
+
+        /**
+        * Sets frame rate for decoded bitstream. Can be run-time setting. 
+        * @param aFrameRate Frame rate
+        * @return void Can leave with KErrNotSupported
+        */
+        virtual void SetFrameRateL(TReal aFrameRate) = 0;
+
+        /**
+        * Sets channel bit error rate. Can be run-time setting
+        * @param aErrorRate Channel expected error rate.
+        *        aErrorRate = 0.0     - low bit error rate or error is not expected
+        *        aErrorRate = 0.00001 - medium bit error rate
+        *        aErrorRate = 0.0001  - high bit error rate
+        * @return void
+        */
+        virtual void SetChannelBitErrorRateL(TReal aErrorRate) = 0;
+
+        /**
+        * Sets misc video coding options
+        * @param aOptions Coding options
+        * @return void
+        */
+        virtual void SetVideoCodingOptionsL(TTRVideoCodingOptions& aOptions) = 0;
+
+        /**
+        * Makes a request to retrieve the intermediate content from the transcoder
+        * @param aRetrieve: ETrue - retrieve; EFalse - don't retrieve.
+        * @param aSize Requested picture size for intermediate decoded picture
+        * @param aSink 
+        * @return void Can leave with KErrNotSupported, if the intermediate picture size is not supported
+        */
+        //virtual void RetrieveIntermediateContentL(TSize& aSize, MTRVideoPictureSink* aSink) = 0;
+        virtual void SetVideoPictureSinkOptionsL(TSize& aSize, MTRVideoPictureSink* aSink) = 0;
+
+        /**
+        * Makes a request to use direct screen access
+        * @param aUseDSA Use Direct Screen Access (DSA). ETrue - use DSA; EFalse - don't use DSA. 
+        * @param aOptions Display options, valid only if aUseDSA is set to ETrue
+        * @return void Can leave with KErrNotSupported, the DSA is not supported. 
+        */
+        virtual void UseDirectScreenAccessL(TBool aUseDSA, CFbsScreenDevice& aScreenDevice, TTRDisplayOptions& aOptions) = 0;
+
+        /**
+        * Gets the current output bit rate for transcoded bit stream
+        * @param none
+        * @return TUint Bit rate
+        */
+        virtual TUint GetVideoBitRateL() = 0;
+
+        /**
+        * Gets the current frame rate for transcoded stream
+        * @param none
+        * @return TReal Framerate
+        */
+        virtual TReal GetFrameRateL() = 0;
+
+        /**
+        * Retrieve currently used codec for transcoding stream
+        * @param aVideoMimeType video mime type
+        * @return void
+        */
+        virtual void GetVideoCodecL(TDes8& aVideoMimeType) = 0;
+
+        /**
+        * Get transcoded picture size
+        * @param aSize Picture size
+        * @return void
+        */
+        virtual void GetTranscodedPictureSizeL(TSize& aSize) = 0;
+
+        // Data transfer methods
+        /**
+        * Sends filled buffer with new portion of the bitstream to transcoder. Note, this is asynchronous operation, 
+        * and this bufer is returned back with Transcoder Observer call MtroReturnCodedBuffer(aBuffer); 
+        * @param aBuffer Media buffer. It is not allowed to use this buffer on the client side until it is returned back 
+        * from the transcoder with MtroReturnCodedBuffer(aBuffer).
+        * @return void 
+        */
+        virtual void WriteCodedBufferL(CCMRMediaBuffer* aBuffer) = 0;
+
+        /**
+        * Sends video picture to transcoder / releases decoded picture (Decode mode)
+        * @param aPicture Video picture
+        * @return void
+        */
+        virtual void SendPictureToTranscoderL(TTRVideoPicture* aPicture) = 0;
+
+        /**
+        * Resample picture in Resampling only mode. The client should specify souce picture and buffer for target 
+        * resampled picture
+        * @param aSrc Source picture
+        * @param aTrg Target picture
+        * @return void
+        */
+        virtual void ResampleL(TPtr8& aSrc, TPtr8& aTrg) = 0;
+        
+        
+        // Video Editor specific API:
+        /**
+        * Gets coding-standard specific initialization output. The buffer is pushed to the cleanup stack, 
+        * and the caller is responsible for deallocating it. 
+        * @param none
+        * @return HBufC8 Coding options (VOL header)
+        */
+        virtual HBufC8* GetCodingStandardSpecificInitOutputLC() = 0;
+        
+        /**
+        * Enables / Disables use of picture sink; Note: This method is relevant only for full transcoding use cases;
+        * This cnage is applied for the next written coded buffer with WriteCodedBufferL
+        * @param aEnable ETrue: Picture sink is enabled; EFalse: Picture sink is disabled
+        * @return none
+        */
+        virtual void EnablePictureSink(TBool aEnable) = 0;
+    
+        /**
+        * Enable / Disable use of Encoder; Note: This method is relevant only for full transcoding use cases;
+        * By default encoding is always enabled in FullTranscoding mode
+        * This cnage is applied for the next written coded buffer with WriteCodedBufferL
+        * @param aEnable ETue: Encoder is enabled; EFalse: Encoder is disabled
+        * @return none
+        */
+        virtual void EnableEncoder(TBool aEnable) = 0;
+
+        /**
+        * Requests random access point to the following transcoded picture
+        * This change is applied for the next written coded buffer with WriteCodedBufferL
+        * @param none
+        * @return none
+        */
+        virtual void SetRandomAccessPoint() = 0;
+        
+        /**
+        * Returns a time estimate of how long it takes to process one second of the input video with the
+        * current transcoder settings. OpenL must be called before calling this function. Estimate
+        * will be more accurate if InitializeL is called before calling this function.
+        * @param aInput Input video format
+        * @param aOutput Output video format
+        * @return TReal Time estimate in seconds
+        */
+        virtual TReal EstimateTranscodeTimeFactorL(const TTRVideoFormat& aInput, const TTRVideoFormat& aOutput) = 0;
+        
+        /**
+        * Get max number of frames in processing.
+        * This is just a recommendation, not a hard limit.
+        * @return TInt Number of frames
+        */
+        virtual TInt GetMaxFramesInProcessing() = 0;
+        
+        /**
+        * Enable / Disable pausing of transcoding if resources are lost. If enabled transcoder
+        * will notify the observer about resource losses by calling MtroSuspend / MtroResume
+        * @param aEnable ETrue: Pausing is enabled
+        *                EFalse: Pausing is disabled and resource losses will cause a fatal error
+        * @return none
+        */
+        virtual void EnablePausing(TBool aEnable) = 0;
+    };
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrtranscoderimp.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,715 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Transcoder.
+*
+*/
+
+
+#ifndef CTRTRANSCODERIMP_H
+#define CTRTRANSCODERIMP_H
+
+
+// INCLUDES
+#include "ctrtranscoder.h"
+#include "ctrdevvideoclientobserver.h"
+
+
+// FORWARD DECLARATIONS
+class CTRVideoDecoderClient;
+class CTRVideoEncoderClient;
+class CTRScaler;
+
+
+// CONSTANTS
+const TInt KTRErrNotReady = -1001;
+
+
+// CLASS DECLARATION
+
+/**
+*  CTranscoder Implementation class
+*  @lib TRANSCODER.LIB
+*  @since 3.1
+*/
+NONSHARABLE_CLASS(CTRTranscoderImp) : public CTRTranscoder, public MTRDevVideoClientObserver, public CActive
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTRTranscoderImp* NewL(MTRTranscoderObserver& aObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CTRTranscoderImp();
+
+    public: // Transcoder methods
+        /**
+        * From CTranscoder. Open the transcoder. Instantiates other submodules based on the selected operational mode. 
+        * @param aMediaSink MCMRMediaSink for encoded data output
+        * @param aMode Mode for the transcoder, operation to perform
+        * @param aMimeTypeInputFormat  Mime type for input format
+        * @param aMimeTypeOutputFormat Mime type for otput format
+        * @param aRealTimeProcessing Specifies how to process data. ETrue - Real-time processing; EFalse - non-real time. 
+        * If the processing cannot be performed in real-time, the transcoder process data as fast as it can. 
+        * @return void. Can leave (KErrNotSupported - selected operation or codecs are not supported, 
+        * @ or any other Symbian error code )
+        */
+        void OpenL( MCMRMediaSink* aMediaSink, 
+                    CTRTranscoder::TTROperationalMode aMode, 
+                    const TDesC8& aInputMimeType, 
+                    const TDesC8& aOutputMimeType, 
+                    const TTRVideoFormat& aVideoInputFormat, 
+                    const TTRVideoFormat& aVideoOutputFormat, 
+                    TBool aRealTime );
+        
+        // Information methods
+        /**
+        * Check support for input format
+        * @param aMimeType MIME type
+        * @return TBool: ETrue - supports; EFalse - does not support
+        */
+        TBool SupportsInputVideoFormat(const TDesC8& aMimeType);
+
+        /**
+        * Check support for output format
+        * @param aMimeType MIME type
+        * @return TBool: ETrue - supports; EFalse - does not support
+        */
+        TBool SupportsOutputVideoFormat(const TDesC8& aMimeType);
+
+        // Control
+        /**
+        * From CTranscoder. Initializes the transcoder. Initializing completes asynchronously with MtroInitializeComplete observer callback.
+        * @param none
+        * @return void
+        */
+        void InitializeL();
+
+        /**
+        * From CTranscoder. Starts transcoding. 
+        * @param none
+        * @return void. Can leave with Symbian error code in case of an error. 
+        */
+        void StartL();
+
+        /**
+        * From CTranscoder. Stops transcoding synchronously. Use this method to stop data processing synchronously. In this case 
+        * all active requests are cancelled and data that was not processed is returned to data owner immediately. 
+        * @param none
+        * @return void. Can leave with Symbian error code in case of an error. 
+        */
+        void StopL();
+
+        /**
+        * From CTranscoder. Stops transcoding asynchronously. The transcoder use this signal to ensure that the remaining data gets processed, 
+        * without waiting for new data. This method is mainly useful for file-to-file conversions and other non-realtime 
+        * processing. 
+        * @param none
+        * @return void. Can leave with Symbian error code in case of an error. 
+        */
+        void AsyncStopL();
+
+        /**
+        * From CTranscoder. Pauses transcoding.
+        * @param 
+        * @return void. Can leave with Symbian error code in case of an error. 
+        */
+        inline void PauseL(){};
+
+        /**
+        * From CTranscoder. Resumes transcoding. 
+        * @param 
+        * @return void. 
+        */
+        inline void Resume(){};
+
+        // Settings
+        /**
+        * From CTranscoder. Sets bit rate parameter for transcoded bitstream. Can be run-time setting
+        * @param aBitRate Bitrate
+        * @return void Can leave with KErrNotSupported
+        */
+        void SetVideoBitRateL(TUint aBitRate);
+
+        /**
+        * From CTranscoder. Sets frame rate for decoded bitstream. Can be run-time setting. 
+        * @param aFrameRate Frame rate
+        * @return void Can leave with KErrNotSupported
+        */
+        void SetFrameRateL(TReal aFrameRate);
+
+        /**
+        * From CTranscoder. Sets channel bit error rate. Can be run-time setting
+        * @param aErrorRate Channel expected error rate.
+        *        aErrorRate = 0.0     - low bit error rate or error is not expected
+        *        aErrorRate = 0.00001 - medium bit error rate
+        *        aErrorRate = 0.0001  - high bit error rate
+        * @return void
+        */
+        void SetChannelBitErrorRateL(TReal aErrorRate);
+
+        /**
+        * From CTranscoder. Sets misc video coding options
+        * @param aOptions Coding options
+        * @return void
+        */
+        void SetVideoCodingOptionsL(TTRVideoCodingOptions& aOptions);
+
+        /**
+        * From CTranscoder. Makes a request to retrieve the intermediate content from the transcoder
+        * @param aRetrieve: ETrue - retrieve; EFalse - don't retrieve.
+        * @param aSize Requested picture size for intermediate decoded picture
+        * @return void Can leave with KErrNotSupported, if the intermediate picture size is not supported
+        */
+        void SetVideoPictureSinkOptionsL(TSize& aSize, MTRVideoPictureSink* aSink);
+
+        /**
+        * From CTranscoder. Makes a request to use direct screen access
+        * @param aUseDSA Use Direct Screen Access (DSA). ETrue - use DSA; EFalse - don't use DSA. 
+        * @param aOptions Display options, valid only if aUseDSA is set to ETrue
+        * @return void Can leave with KErrNotSupported, the DSA is not supported. 
+        */
+        void UseDirectScreenAccessL(TBool aUseDSA, CFbsScreenDevice& aScreenDevice, TTRDisplayOptions& aOptions);
+
+        /**
+        * From CTranscoder. Gets the current output bit rate for transcoded bit stream
+        * @param none
+        * @return TUint Bit rate
+        */
+        TUint GetVideoBitRateL();
+
+        /**
+        * From CTranscoder. Gets the current frame rate for transcoded stream
+        * @param none
+        * @return TReal Framerate
+        */
+        TReal GetFrameRateL();
+
+        /**
+        * From CTranscoder. Retrieve currently used codec for transcoding stream
+        * @param aVideoMimeType video mime type
+        * @return void
+        */
+        void GetVideoCodecL(TDes8& aVideoMimeType);
+
+        /**
+        * From CTranscoder. Get transcoded picture size
+        * @param aSize Picture size
+        * @return void
+        */
+        void GetTranscodedPictureSizeL(TSize& aSize);
+
+        // Data transfer methods
+        /**
+        * Sends filled buffer with new portion of the bitstream to transcoder. Note, this is asynchronous operation, 
+        * and this bufer is returned back with Transcoder Observer call MtroReturnCodedBuffer(aBuffer); 
+        * @param aBuffer Media buffer. It is not allowed to use this buffer on the client side until it is returned back 
+        * from the transcoder with MtroReturnCodedBuffer(aBuffer).
+        * @return void 
+        */
+        void WriteCodedBufferL(CCMRMediaBuffer* aBuffer);
+
+        /**
+        * From CTranscoder. Sends video picture to transcoder / releases decoded picture (Decode mode)
+        * @param aPicture Video picture
+        * @return void
+        */
+        void SendPictureToTranscoderL(TTRVideoPicture* aPicture);
+
+        /**
+        * Resample picture in Resampling only mode. The client should specify souce picture and buffer for target 
+        * resampled picture
+        * @param aSrc Source picture
+        * @param aTrg Target picture
+        * @return void
+        */
+        void ResampleL(TPtr8& aSrc, TPtr8& aTrg);
+
+        // MTRDevVideoClientObserver implementation
+        /**
+        * From MTRDevVideoClientObserver. Reports an error from the devVideo client
+        * @param aError Error reason
+        * @return void
+        */
+        void MtrdvcoFatalError(TInt aError);
+
+        /**
+        * From MTRDevVideoClientObserver. Reports that data encoding process has been finished
+        * @param none
+        * @return void
+        */
+        void MtrdvcoEncStreamEnd();
+
+        /**
+        * From MTRDevVideoClientObserver. Reports that data decoding process has been finished
+        * @param none
+        * @return void
+        */
+        void MtrdvcoDecStreamEnd();
+
+        /**
+        * From MTRDevVideoClientObserver. Returns video picture from the video encoder client
+        * @param aPicture video picture
+        * @return void
+        */
+        void MtrdvcoEncoderReturnPicture(TVideoPicture* aPicture);
+
+        /**
+        * From MTRDevVideoClientObserver. Returns videopicture from the renderer
+        * @param aPicture video picture
+        * @return void
+        */
+        void MtrdvcoRendererReturnPicture(TVideoPicture* aPicture);
+
+        /**
+        * From MTRDevVideoClientObserver. Informs about initializing video encoder client
+        * @param aError Initializing error status 
+        * @return void
+        */
+        void MtrdvcoEncInitializeComplete(TInt aError);
+
+        /**
+        * From MTRDevVideoClientObserver. Informs about initializing video decoder client
+        * @param aError Initializing error status 
+        * @return void
+        */
+        void MtrdvcoDecInitializeComplete(TInt aError);
+
+        /**
+        * From MTRDevVideoClientObserver. Supplies new encoded bitstream buffer
+        * @param aPicture Decoded picture
+        * @return void
+        */
+        void MtrdvcoNewPicture(TVideoPicture* aPicture);
+
+        /**
+        * Supplies new encoded bitstream buffer
+        * @param 
+        * @return void
+        */
+        void MtrdvcoNewBuffer(CCMRMediaBuffer* aBuffer);
+        /**
+        * Returns media bitstream buffer to the client
+        * @param aBuffer Bitstream media buffer
+        * @return void
+        */
+        void MtrdvcoReturnCodedBuffer(CCMRMediaBuffer* aBuffer);
+        
+        
+        //  AA
+        void SetDecoderInitDataL(TPtrC8& aInitData);
+        
+        /**
+        * Gets coding-standard specific initialization output. The buffer is pushed to the cleanup stack, 
+        * and the caller is responsible for deallocating it. 
+        * @param none
+        * @return HBufC8 Coding options (VOL header)
+        */
+        HBufC8* GetCodingStandardSpecificInitOutputLC();
+
+        /**
+        * Enable / Disable use of picture sink; Note: This method is relevant only for full transcoding use cases;
+        * 
+        * @param aEnable ETrue: Picture sink is enabled; EFalse: Picture sink is disabled
+        * @return none
+        */
+        void EnablePictureSink(TBool aEnable);
+    
+        /**
+        * Enable / Disable use of Encoder; Note: This method is relevant only for full transcoding use cases;
+        * By default encoding is always enabled in FullTranscoding mode
+        * 
+        * @param aEnable ETrue: Encoder is enabled; EFalse: Encoder is disabled
+        * @return none
+        */
+        void EnableEncoder(TBool aEnable);
+        
+        /**
+        * Requests random access point to the following transcoded picture
+        * This change is applied for the next written coded buffer with WriteCodedBufferL
+        * @param none
+        * @return none
+        */
+        void SetRandomAccessPoint();
+        
+        /**
+        * From MTRDevVideoClientObserver. Notifies the transcoder about available picture buffers throug CI or MDF
+        * @param none
+        * @return none
+        */
+        void MtrdvcoNewBuffers();
+        
+        /**
+        * Returns a time estimate of how long it takes to process one second of the input video with the
+        * current transcoder settings. OpenL must be called before calling this function. Estimate
+        * will be more accurate if InitializeL is called before calling this function.
+        * @param aInput Input video format
+        * @param aOutput Output video format
+        * @return TReal Time estimate in seconds
+        */
+        TReal EstimateTranscodeTimeFactorL(const TTRVideoFormat& aInput, const TTRVideoFormat& aOutput);
+        
+        /**
+        * From CTranscoder. Get max number of frames in processing.
+        * This is just a recommendation, not a hard limit.
+        * @return TInt Number of frames
+        */
+        TInt GetMaxFramesInProcessing();
+        
+        /**
+        * Enable / Disable pausing of transcoding if resources are lost. If enabled transcoder
+        * will notify the observer about resource losses by calling MtroSuspend / MtroResume
+        * @param aEnable ETrue: Pausing is enabled
+        *                EFalse: Pausing is disabled and resource losses will cause a fatal error
+        * @return none
+        */
+        void EnablePausing(TBool aEnable);
+        
+        /**
+        * Indicates that a media device has lost its resources
+        * @param aFromDecoder Flag to indicate source of resource loss 
+        * @return none
+        */
+        void MtrdvcoResourcesLost(TBool aFromDecoder);
+        
+        /**
+        * Indicates that a media device has regained its resources
+        * @return none
+        */
+        void MtrdvcoResourcesRestored();
+
+    protected:
+        /**
+        * From CActive. 
+        * @param 
+        * @return void
+        */
+        void RunL();
+
+        /**
+        * From CActive. 
+        * @param 
+        * @return void
+        */
+        void DoCancel();
+
+        /**
+        * From CActive. 
+        * @param aError error
+        * @return void
+        */
+        TInt RunError(TInt aError);
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CTRTranscoderImp(MTRTranscoderObserver& aObserver);
+
+        /**
+        * Symbian 2nd phase constructor, can leave
+        */
+        void ConstructL();
+
+        /**
+        * Parses mime type
+        * @param aInputMimeType Input mime tipe
+        * @param aVideoInputFormat Output mime type
+        * @param aInOutMime ETrue - input mime, EFalse
+        * @return void
+        */
+        void ParseMimeTypeL(const TDesC8& aInputMimeType, TBool aInOutMime);
+
+        /**
+        * Check picture size if valid
+        * @param 
+        * @return void
+        */
+        TBool IsValid(TSize& aSize);
+
+        /**
+        * Handles initialize complete call
+        * @param 
+        * @return void
+        */
+        void InitComplete();
+
+        /**
+        * Allocate transcoder buffers and other data structures
+        * @param 
+        * @return void
+        */
+        void AllocateBuffersL();
+
+        /**
+        * Makes a new request
+        * @param 
+        * @return void
+        */
+        void DoRequest();
+        
+        /**
+        * Loads codec Uids from central repository
+        * @return void
+        */
+        void LoadCodecUids();
+
+    private:
+        // Transcoder Observer
+        MTRTranscoderObserver& iObserver;
+
+        // Video decoder client
+        CTRVideoDecoderClient* iVideoDecoderClient;
+
+        // Video Encoder client
+        CTRVideoEncoderClient* iVideoEncoderClient;
+
+        // Scaler
+        CTRScaler* iScaler;
+
+        // Processing mode (RT / Non-RT)
+        TBool iRealTime;
+
+        // MediaSink for output transcoded stream
+        MCMRMediaSink* iMediaSink;
+
+        // MTRVideoPictureSink
+        MTRVideoPictureSink* iPictureSink;
+
+        // MTRVideoPictureSink temp sink
+        MTRVideoPictureSink* iPictureSinkTemp;
+
+        // Enable / disable encoder flag (relevant only for full transcoding use cases)
+        TBool iEncoderEnabled;
+
+        // Input picture size
+        TSize iInputPictureSize;
+        
+        // Picture size after decoding
+        TSize iDecodedPictureSize;
+
+        // Output picture size
+        TSize iOutputPictureSize;
+
+        // Intermediate picture size
+        TSize iIntermediatePictureSize;
+
+        // Operational mode
+        TInt iMode;
+
+        // Transcoder state
+        TInt iState;
+
+        // Encoder init status
+        TInt iEncoderInitStatus;
+
+        // Decoder init status
+        TInt iDecoderInitStatus;
+
+        // Codec level
+        TInt iInputCodecLevel;
+        
+        // Codec level
+        TInt iOutputCodecLevel;
+
+        // Request status
+        TRequestStatus* iStat;
+
+        // Encoder stream end status
+        TBool iEncoderStreamEnd;
+
+        // Decoder stream end status
+        TBool iDecoderStreamEnd;
+
+        // Input mimetype
+        TBufC8<256> iInputMimeType;
+        
+        // Short mimetype
+        TBufC8<256> iInputShortMimeType;
+
+        // Output mimetype
+        TBufC8<256> iOutputMimeType;
+        
+        // Short mimetype
+        TBufC8<256> iOutputShortMimeType;
+
+        // Max bit rate
+        TUint iOutputMaxBitRate;
+
+        // Input codec
+        TInt iInputCodec;
+
+        // Output codec
+        TInt iOutputCodec;
+
+        // Input Max Bit Rate
+        TUint iInputMaxBitRate;
+
+        // Input max picture size
+        TSize iInputMaxPictureSize;
+
+        // Output max picture size
+        TSize iOutputMaxPictureSize;
+
+        // Transcoder picture queue
+        TDblQue<TVideoPicture> iTranscoderPictureQueue;
+
+        // Transcoder picture queue
+        TDblQue<TVideoPicture> iEncoderPictureQueue;
+
+        // CI picture buffers queue
+        TDblQue<TVideoPicture> iCIPictureBuffersQueue;
+        
+        // Transcoder events queue
+        TDblQue<CTREventItem> iTranscoderEventQueue;
+
+        // Transcoder events queue
+        TDblQue<CTREventItem> iTranscoderEventSrc;
+
+        // Transcoder async events queue
+        TDblQue<CTREventItem> iTranscoderAsyncEventQueue;
+
+        // Transcoder TRVideoPicture queue
+        TDblQue<TTRVideoPicture> iTranscoderTRPictureQueue;
+
+        // TVideopicture container wait queue
+        TDblQue<TVideoPicture> iContainerWaitQueue;
+        
+        // Data array
+        TUint8** iDataArray;
+        
+        // Events
+        CTREventItem* iEvents;
+        
+        // TVideo picture array
+        TVideoPicture* iVideoPictureArray;
+        
+        // TTRVideo picture array
+        TTRVideoPicture* iTRVideoPictureArray;
+        
+        // Decoded picture
+        TVideoPicture* iDecodedPicture;
+        
+        // Picture container to client
+        TTRVideoPicture iPicureToClient;
+        
+        // Temp video picture
+        TVideoPicture* iVideoPictureTemp;
+        
+        // Set bitrate flag
+        TBool iBitRateSetting;
+        
+        // Fatal error
+        TInt iFatalError;
+
+        // Data transfer optimization (applicable only to full transcoding mode)
+        TBool iOptimizedDataTransfer;
+        
+        // Set random access point flag
+        TBool iSetRandomAccessPoint;
+        
+        // EnableEncoder setting status flag
+        TBool iEncoderEnabledSettingChanged;
+        
+        // EnableEncoder setting from the client
+        TBool iEncoderEnableClientSetting;
+        
+        // EnablePicture sink transcoder setting
+        TBool iPictureSinkEnabled;
+        
+        // EnablePictureSink setting status flag
+        TBool iPictureSinkSettingChanged;
+        
+        // PictuereSink enabled client's setting
+        TBool iPictureSinkClientSetting;
+        
+        // Wait picture from client
+        TTRVideoPicture* iWaitPictureFromClient;
+        
+        // Wait new decoded picture
+        TVideoPicture* iWaitNewDecodedPicture;
+        
+        // New event
+        CTREventItem* iNewEvent;
+        
+        // Acync event
+        CTREventItem* iAsyncEvent;
+        
+        // Current setting
+        TBool iCurrentPictureSinkEnabled;
+        
+        // Current setting 
+        TBool iCurrentEncoderEnabled;
+        
+        // Current setting
+        TBool iCurrentRandomAccess;
+        
+        // Current async PS setting
+        TBool iCurrentAsyncPictureSinkEnabled;
+        
+        // Current async enc setting
+        TBool iCurrentAsyncEncoderEnabled;
+
+        // Current async setting
+        TBool iCurrentAsyncRandomAccess;
+        
+        // Asynchronous stop is used
+        TBool iAsyncStop;
+        
+        // Max number of frames sent to transcoder at a time
+        // This is just a recommendation, not a hard limit
+        TInt iMaxFramesInProcessing;
+        
+        // Default decoder uids for different codecs
+        TInt iH263DecoderUid;
+        TInt iH264DecoderUid;
+        TInt iMPEG4DecoderUid;
+        
+        // Default encoder uids for different codecs
+        TInt iH263EncoderUid;
+        TInt iH264EncoderUid;
+        TInt iMPEG4EncoderUid;
+        
+        // Decoder uids for low resolutions
+        TInt iH263DecoderLowResUid;
+        TInt iH264DecoderLowResUid;
+        TInt iMPEG4DecoderLowResUid;
+        
+        // Max width of low resolutions
+        TInt iH263DecoderLowResThreshold;
+        TInt iH264DecoderLowResThreshold;
+        TInt iMPEG4DecoderLowResThreshold;
+        
+        // Decoder uids for low resolutions
+        TInt iH263EncoderLowResUid;
+        TInt iH264EncoderLowResUid;
+        TInt iMPEG4EncoderLowResUid;
+        
+        // Max width of low resolutions
+        TInt iH263EncoderLowResThreshold;
+        TInt iH264EncoderLowResThreshold;
+        TInt iMPEG4EncoderLowResThreshold;
+        
+        // Flag to store resource loss source (decoder / encoder)
+        TBool iDecoderResourceLost;
+        
+    };
+
+
+#endif    // CTRTRANSCODERIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrtranscoderobserver.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Transcoder observer.
+*
+*/
+
+
+#ifndef CTRTRANSCODEROBSERVER_H
+#define CTRTRANSCODEROBSERVER_H
+
+
+// INCLUDES
+#include <CCMRMediaSink.h>
+#include "ctrcommon.h"
+
+
+/**
+*  Transcoder observer interface class. Every client should implement this class. 
+*  @lib TRANSCODER.LIB
+*  @since 3.1
+*/
+class MTRTranscoderObserver
+    {
+    public:
+        /**
+        * Reports initialize status to the client
+        * @param aError Error status
+        * @return void
+        */
+        virtual void MtroInitializeComplete(TInt aError) = 0;
+
+        /**
+        * Reports run-time error to the client
+        * @param aError Run-time error
+        * @return void
+        */
+        virtual void MtroFatalError(TInt aError) = 0;
+
+        /**
+        * Returns media bitstream buffer to the client
+        * @param aBuffer Bitstream media buffer
+        * @return void
+        */
+        virtual void MtroReturnCodedBuffer(CCMRMediaBuffer* aBuffer) = 0;
+
+        /**
+        * Request to the client to set FrameRate of the input sequence.
+        * @param aRate Framerate of the input sequence (in frames per second)
+        * @return void
+        */
+        virtual void MtroSetInputFrameRate(TReal& aRate) = 0;
+        
+        /**
+        * Completes async request
+        * @param none
+        * @return void
+        */
+        virtual void MtroAsyncStopComplete() = 0;
+        
+        /**
+        * Notifies that resources were lost and transcoding has to be suspended
+        * @param none
+        * @return void
+        */
+        virtual void MtroSuspend() = 0;
+        
+        /**
+        * Notifies that resources were restored and transcoding can now continue
+        * @param none
+        * @return void
+        */
+        virtual void MtroResume() = 0;
+    };
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrvideodecoderclient.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,388 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Video decoder client.
+*
+*/
+
+
+
+#ifndef CTRVIDEODECODERCLIENT_H
+#define CTRVIDEODECODERCLIENT_H
+
+// INCLUDES
+#include <e32base.h>
+#include <devvideoplay.h>
+#include <devvideobase.h>
+#include <devvideostandardcustominterfaces.h>
+
+#include "ctrcommon.h"
+
+
+// FORWARD DECLARATIONS
+class MTRDevVideoClientObserver;
+class CCMRMediaBuffer;
+
+
+/**
+*  Video decoder client
+*  @lib TRANSCODER.LIB
+*/
+NONSHARABLE_CLASS(CTRVideoDecoderClient) : public CBase, public MMMFDevVideoPlayObserver, public MMmfVideoResourceObserver
+
+    {
+    public: // Constuctor / destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTRVideoDecoderClient* NewL(MTRDevVideoClientObserver& aObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CTRVideoDecoderClient();
+
+        // Information methods
+        /**
+        * Checks codec support by MIME type
+        * @param aFormat MIME type
+        * @param aShortFormat MIME type (short version)
+        * @param aUid Uid of the codec to check
+        * @param aFallbackUid Fallback Uid incase the first one is not found
+        * @return TBool value: ETrue - givemn MIME type is supported; EFalse - no support; 
+        */
+        TBool SupportsCodec(const TDesC8& aFormat, const TDesC8& aShortFormat, TInt aUid, TInt aFallbackUid);
+
+        /**
+        * Gets codec info
+        * @param none
+        * @return none
+        */
+        void GetCodecInfoL();
+
+        /**
+        * Sets codec parameters
+        * @param aCodecType Codec type
+        * @param aCodecLevel Codec level
+        * @param aInputFormat Input video format
+        * @param aOutputFormat Output video format
+        * @return none
+        */
+        void SetCodecParametersL(TInt aCodecType, TInt aCodecLevel, const TTRVideoFormat& aInputFormat, 
+                                 const TTRVideoFormat& aOutputFormat);
+
+        /**
+        * From MMMFDevVideoPlayObserver. Notifies the client that one or more new empty input buffers are available
+        * @param none
+        * @return none
+        */
+        void MdvpoNewBuffers();
+
+        /**
+        * From MMMFDevVideoPlayObserver. Returns a used input video picture back to the caller
+        * @param aPicture Video picture
+        * @return none
+        */
+        void MdvpoReturnPicture(TVideoPicture *aPicture);
+
+        /**
+        * From MMMFDevVideoPlayObserver. Delivers supplemental information from a coded data unit
+        * @param aData Data, aTimestamp TimeStamp info, aPictureId Picture Id
+        * @return none
+        */
+        void MdvpoSupplementalInformation(const TDesC8 &aData, const TTimeIntervalMicroSeconds &aTimestamp, 
+                                          const TPictureId &aPictureId);
+
+        /**
+        * From MMMFDevVideoPlayObserver. Back channel information from the decoder, indicating a picture loss 
+        * without specifying the lost picture
+        * @param none
+        * @return none
+        */
+        void MdvpoPictureLoss();
+
+        /**
+        * From MMMFDevVideoPlayObserver. Back channel information from the decoder, indicating the pictures that have been lost
+        * @param aPictures Array with picture Ids
+        * @return none
+        */
+        void MdvpoPictureLoss(const TArray< TPictureId > &aPictures);
+
+        /**
+        * From MMMFDevVideoPlayObserver. Back channel information from the decoder, indicating the loss of consecutive 
+        * macroblocks in raster scan order
+        * @param aFirstMacroblock First macroblock, aNumMacroblocks, Number of macroblocks, aPicture PictureId
+        * @return none
+        */
+        void MdvpoSliceLoss(TUint aFirstMacroblock, TUint aNumMacroblocks, const TPictureId &aPicture);
+
+        /**
+        * From MMMFDevVideoPlayObserver. Back channel information from the decoder, indicating a reference picture 
+        * selection request
+        * @param aSelectionData Selection data
+        * @return none
+        */
+        void MdvpoReferencePictureSelection(const TDesC8 &aSelectionData);
+
+        /**
+        * From MMMFDevVideoPlayObserver. Called when a timed snapshot request has been completed
+        * @param aError Error, aPictureData Picture data, aPresentationTimestamp Presentation timestamp, aPictureId picture Id
+        * @return
+        */
+        void MdvpoTimedSnapshotComplete(TInt aError, TPictureData *aPictureData, 
+                                        const TTimeIntervalMicroSeconds &aPresentationTimestamp, const TPictureId &aPictureId);
+
+        /**
+        * From MMMFDevVideoPlayObserver. Notifies the client that one or more new output pictures are available
+        * @param none
+        * @return none
+        */
+        void MdvpoNewPictures();
+
+        /**
+        * From MMMFDevVideoPlayObserver. Reports a fatal decoding or playback error
+        * @param aError Rin-time error
+        * @return none
+        */
+        void MdvpoFatalError(TInt aError);
+
+        /**
+        * From MMMFDevVideoPlayObserver. Reports that DevVideoPlay initialization has completed
+        * @param aError Init error status
+        * @return none
+        */
+        void MdvpoInitComplete(TInt aError);
+
+        /**
+        * From MMMFDevVideoPlayObserver. Reports that the input video stream end has been reached and all pictures 
+        * have been processed
+        * @param none
+        * @return none
+        */
+        void MdvpoStreamEnd();
+
+        /**
+        * Returns used videopicture
+        * @param aPicture Video picture
+        * @return none
+        */
+        void ReturnPicture(TVideoPicture* aPicture);
+
+        /**
+        * Starts decoding
+        * @param none
+        * @return none
+        */
+        void StartL();
+
+        /**
+        * Stops decoding synchronously
+        * @param none
+        * @return none
+        */
+        void StopL();
+
+        /**
+        * Stops decoding asynchronously
+        * @param none
+        * @return none
+        */
+        void AsyncStopL();
+
+        /**
+        * Pauses decoding
+        * @param none
+        * @return none
+        */
+        void Pause();
+        
+        /**
+        * Resumes decoding
+        * @param none
+        * @return none
+        */
+        void ResumeL();
+        
+        /**
+        * Checks codec info
+        * @param aUid Decoder Uid
+        * @return TBool ETrue - accelerated codec; EFalse - non-accelerated codec
+        */
+        TBool CheckCodecInfoL(TUid aUid);
+
+        /**
+        * Initialize decoder client
+        * @param none
+        * @return none
+        */
+        void InitializeL();
+
+        /**
+        * Select decoder
+        * @param none
+        * @return none
+        */
+        void SelectDecoderL();
+
+        /**
+        * Send buffer
+        * @param aBuffer Media buffer
+        * @return none
+        */
+        void SendBufferL(CCMRMediaBuffer* aBuffer);
+
+        /**
+        * Write coded buffer
+        * @param aBuffer Media buffer
+        * @return none
+        */
+        void WriteCodedBufferL(CCMRMediaBuffer* aBuffer);
+
+        /**
+        * Returns a time estimate on long it takes to decode one frame with the current settings
+        * @param aInput Input video format
+        * @param aCodecType EH263 or EMpeg4
+        * @return TReal time estimate in seconds
+        */
+        TReal EstimateDecodeFrameTimeL(const TTRVideoFormat& aInput, TInt aCodecType);
+        
+        /**
+        * Checks if decoder supports scaling and enables scaling if supported.
+        * Disables scaling if aInputSize is equal to aOutputSize or scaling is not supported.
+        * @param aInputSize Source picture size
+        * @param aOutputSize Decoded picture size
+        * @return TBool ETrue if scaling is supported, EFalse otherwise
+        */
+        TBool SetDecoderScaling(TSize& aInputSize, TSize& aOutputSize);
+        
+        /**
+        * Enable / Disable resource observer
+        * @param aEnable ETrue: Observer is enabled, EFalse observer is disabled
+        * @return none
+        */
+        void EnableResourceObserver(TBool aEnable);
+        
+        /**
+        * From MMmfVideoResourceObserver. Indicates that a media device has lost its resources
+        * @param aMediaDevice UID for the media device that lost resources
+        * @return none
+        */
+        void MmvroResourcesLost(TUid aMediaDevice);
+        
+        /**
+        * From MMmfVideoResourceObserver. Indicates that a media device has regained its resources
+        * @param aMediaDevice UID for the media device that regained resources
+        * @return none
+        */
+        void MmvroResourcesRestored(TUid aMediaDevice);
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CTRVideoDecoderClient(MTRDevVideoClientObserver& aObserver);
+
+        /**
+        * Symbian 2nd phase constructor, can leave
+        */
+        void ConstructL();
+
+    private:
+        // Observer
+        MTRDevVideoClientObserver& iObserver;
+
+        // DevVideoPlay
+        CMMFDevVideoPlay* iDevVideoPlay;
+
+        // Decoder mime type
+        TBuf8<256> iMimeType;
+        
+        // Short version mime type
+        TBuf8<256> iShortMimeType;
+
+        // Uncompressed format
+        TUncompressedVideoFormat iUncompressedFormat;
+
+        // Compressed format
+        CCompressedVideoFormat* iCompresedFormat;
+
+        // HwDevice Uid
+        THwDeviceId iHwDeviceId;
+
+        // Video coded input buffer
+        TVideoInputBuffer* iInputBuffer;
+
+        // Decoded picture
+        TVideoPicture* iDecodedPicture;
+
+        // Uid of the selected codec
+        TUid iUid;
+        
+        // Fallback codec to use if the first one doesn't work
+        TUid iFallbackUid;
+
+        // Coded buffer
+        CCMRMediaBuffer* iCodedBuffer;
+        
+        // Codec type
+        TInt iCodecType;
+
+        // Codec level
+        TInt iCodecLevel;
+
+        // Buffer options
+        CMMFDevVideoPlay::TBufferOptions iBufferOptions;
+
+        // Fatal error code
+        TInt iFatalError;
+        
+        // Input format
+        TTRVideoFormat iInputFormat;
+
+        // Output format
+        TTRVideoFormat iOutputFormat;
+        
+        // Data unit type
+        TVideoDataUnitType iDataUnitType;
+        
+        // Stop
+        TBool iStop;
+        
+        // Pause
+        TBool iPause;
+        
+        // Last ts
+        TTimeIntervalMicroSeconds iLastTimestamp;
+        
+        // If selected decoder is accelerated or not
+        TBool iAcceleratedCodecSelected;
+        
+        // If scaling is used or not
+        TBool iScalingInUse;
+        
+        // Decoded picture size if scaling is used
+        TSize iScaledOutputSize;
+        
+        // If deblocking should be used when scaling
+        TBool iScalingWithDeblocking;
+
+        // Video resource handler custom interface
+        MMmfVideoResourceHandler* iVideoResourceHandlerCI;
+    };
+
+
+
+#endif  // CTRVIDEODECODERCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrvideoencoderclient.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,471 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Video decoder client.
+*
+*/
+
+
+
+#ifndef CTRVIDEOENCODERCLIENT_H
+#define CTRVIDEOENCODERCLIENT_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <devvideobase.h>   // Common data types
+#include <CCMRMediaSink.h>  // CmmfBuffer
+#include <e32cmn.h>         // TRequestStatus
+#include <devvideorecord.h>
+
+// When the flag SPP_BUFFER_MGMT_CI_HEADER_SYMBIAN is NOT defined,
+// Buffer management interface is specified in Symbian header
+#ifndef SPP_BUFFER_MGMT_CI_HEADER_SYMBIAN
+#include <devvideostandardcustominterfaces.h>
+#else
+#include <devvideostandardcustominterfaces.h>
+#include "buffermanagementci.h"
+#endif
+
+#include "ctrcommon.h"
+#include "ctrsettings.h"
+
+#ifndef SPP_BUFFER_MGMT_CI_HEADER_SYMBIAN
+/** Buffer Management Custom Interface UID */
+const TUid KMmfVideoBuffermanagementUid = { 0x10204bea };
+#endif
+
+// FORWARD DECLARATIONS
+class MTRDevVideoClientObserver;
+
+
+// CONSTANTS
+
+
+/**
+*  Video encoder client
+*  @lib TRANSCODER.LIB
+*  @since 3.1
+*/
+class TUidAndRate
+    {
+    public:
+        // Encoder Uid
+        TUid iUid;
+
+        // Max supported framerate
+        TReal iMaxRate;
+    };
+
+/**
+*  Video encoder client
+*  @lib TRANSCODER.LIB
+*  @since 3.1
+*/
+NONSHARABLE_CLASS(CTRVideoEncoderClient) : public CBase, public MMMFDevVideoRecordObserver, public MMmfVideoBufferManagementObserver,
+                                           public MMmfVideoResourceObserver
+    {
+    public: // Constuctor / destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTRVideoEncoderClient* NewL(MTRDevVideoClientObserver& aObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CTRVideoEncoderClient();
+
+        // Information methods
+        /**
+        * Check codec's support by MIME type
+        * @param aFormat Codec MIME type
+        * @param aShortFormat Codec MIME type (short version)
+        * @param aUid Uid of the codec to check
+        * @param aFallbackUid Fallback Uid incase the first codec is not found
+        * @return TBool: ETrue - supports, EFalse - Does not support
+        */
+        TBool SupportsCodec(const TDesC8& aFormat, const TDesC8& aShortFormat, TInt aUid, TInt aFallbackUid);
+
+        /**
+        * Sets codec parameters
+        * @param aCodecType Codec type
+        * @param aCodecLevel Codec level
+        * @param aInputFormat Input video format
+        * @param aOutputFormat Output video format
+        * @return none
+        */
+        void SetCodecParametersL(TInt aCodecType, TInt aCodecLevel, const TTRVideoFormat& aInputFormat, 
+                                 const TTRVideoFormat& aOutputFormat);
+
+        /**
+        * Sets real-time operation
+        * @param aRealTime Real-time operatiopn
+        * @return none
+        */
+        void SetRealTime(TBool aRealTime);
+
+        /**
+        * From MMMFDevVideoRecordObserver. Returns a used input video picture back to the caller. 
+        * The picture memory can be re-used or freed
+        * @param aPicture Video Picture
+        * @return none
+        */
+        void MdvroReturnPicture(TVideoPicture* aPicture);
+
+        /**
+        * From MMMFDevVideoRecordObserver. Signals that the supplemental info send request has completed
+        * @param none
+        * @return none
+        */
+        void MdvroSupplementalInfoSent();
+
+        /**
+        * From MMMFDevVideoRecordObserver. Notifies the client that one or more new output buffers are available
+        * @param none
+        * @return none
+        */
+        void MdvroNewBuffers();
+
+        /**
+        * From MMMFDevVideoRecordObserver. Reports a fatal encoding or capturing error 
+        * @param aError Run-time error
+        * @return none
+        */
+        void MdvroFatalError(TInt aError);
+
+        /**
+        * From MMMFDevVideoRecordObserver. Reports that DevVideoRecord initialization has completed
+        * @param aError Init error
+        * @return none
+        */
+        void MdvroInitializeComplete(TInt aError);
+
+        /**
+        * From MMMFDevVideoRecordObserver. Reports that the input video data end has been reached and all pictures 
+        * have been processed
+        * @param none
+        * @return none
+        */
+        void MdvroStreamEnd();
+
+        /**
+        * Encode picture
+        * @param aPicture Video picture to encode
+        * @return none
+        */
+        void EncodePictureL(TVideoPicture* aPicture);
+
+        /**
+        * Starts encoding
+        * @param none
+        * @return none
+        */
+        void StartL();
+
+        /**
+        * Stops encoding synchronously
+        * @param none
+        * @return none
+        */
+        void StopL();
+
+        /**
+        * Stops encoding asynchronously
+        * @param none
+        * @return none
+        */
+        void AsyncStopL();
+
+        /**
+        * Sets target bitrate
+        * @param aBitRate bitrate
+        * @return none
+        */
+        void SetBitRate(TUint aBitRate);
+
+        /**
+        * Sets target frame rate 
+        * @param aFrameRate Target frame rate 
+        * @return none
+        */
+        void SetFrameRate(TReal& aFrameRate);
+
+        /**
+        * Sets Channel bit-error rate
+        * @param aErrorRate error rate
+        * @return none
+        */
+        void SetChannelBitErrorRate(TReal aErrorRate);
+
+        /**
+        * Sets Video coding options
+        * @param aOptions Coding options
+        * @return none
+        */
+        void SetVideoCodingOptionsL(TTRVideoCodingOptions& aOptions);
+
+        /**
+        * Gets current video bitrate
+        * @param none
+        * @return Video bitrate
+        */
+        TUint GetVideoBitRateL();
+
+        /**
+        * Gets Current frame rate
+        * @param none
+        * @return Frame rate 
+        */
+        TReal GetFrameRateL();
+
+        /**
+        * Sets Input / source frame rate 
+        * @param aFrameRate Input / Source frame rate 
+        * @return none
+        */
+        void SetInputFrameRate(TReal aFrameRate);
+
+        /**
+        * Initialize encoder
+        * @param none 
+        * @return none
+        */
+        void InitializeL();
+
+        /**
+        * Select encoder
+        * @param none 
+        * @return none 
+        */
+        void SelectEncoderL();
+        
+        /**
+        * Get Coding standard / specific output (VOL / VOS / VO Header)
+        * @param none 
+        * @return Coding standard / specific output (VOL / VOS / VO Header) 
+        */
+        HBufC8* GetCodingStandardSpecificInitOutputLC();
+
+        /**
+        * Select encoder
+        * @param none 
+        * @return none 
+        */
+        void UseDataTransferOptimizationL();
+
+        /**
+        * Informs about new buffers available in DevVideoPlay queue
+        * @param none 
+        * @return none 
+        */
+        void MmvbmoNewBuffers();
+
+        /**
+        * Release buffers request
+        * @param none 
+        * @return none 
+        */
+        void MmvbmoReleaseBuffers();
+        
+        /**
+        * Gets target video picture buffer
+        * @param none 
+        * @return Video picture
+        */
+        TVideoPicture* GetTargetVideoPictureL();
+        
+        /**
+        * Sets Random access point
+        * @param none 
+        * @return none 
+        */
+        void SetRandomAccessPoint();
+        
+        /**
+        * Returns a time estimate on long it takes to encode one frame with the current settings
+        * @param aOutput Output video format
+        * @param aCodecType EH263 or EMpeg4
+        * @return TReal time estimate in seconds
+        */
+        TReal EstimateEncodeFrameTimeL(const TTRVideoFormat& aOutput, TInt aCodecType);
+        
+        /**
+        * Pauses encoding
+        * @param none
+        * @return none
+        */
+        void Pause();
+
+        /**
+        * Resumes encoding
+        * @param none
+        * @return none
+        */
+        void Resume();
+        
+        /**
+        * Enable / Disable resource observer
+        * @param aEnable ETrue: Observer is enabled, EFalse observer is disabled
+        * @return none
+        */
+        void EnableResourceObserver(TBool aEnable);
+        
+        /**
+        * From MMmfVideoResourceObserver. Indicates that a media device has lost its resources
+        * @param aMediaDevice UID for the media device that lost resources
+        * @return none
+        */
+        void MmvroResourcesLost(TUid aMediaDevice);
+        
+        /**
+        * From MMmfVideoResourceObserver. Indicates that a media device has regained its resources
+        * @param aMediaDevice UID for the media device that regained resources
+        * @return none
+        */
+        void MmvroResourcesRestored(TUid aMediaDevice);
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CTRVideoEncoderClient(MTRDevVideoClientObserver& aObserver);
+
+        /**
+        * Symbian 2nd phase constructor, can leave
+        */
+        void ConstructL();
+
+        /**
+        * Checks codec info
+        * @param aUid Decoder Uid
+        * @return TBool ETrue - accelerated codec; EFalse - non-accelerated codec
+        */
+        TBool CheckCodecInfoL(TUid aUid);
+        
+    private:
+        // Observer
+        MTRDevVideoClientObserver& iObserver;
+
+        // DevVideoRecord
+        CMMFDevVideoRecord* iDevVideoRecord;
+
+        // Encoder mime type
+        TBuf8<256> iMimeType;
+        
+        // Short version mime type
+        TBuf8<256> iShortMimeType;
+
+        // Uid of the selected codec
+        TUid iUid;
+        
+        // Fallback codec to use if the first codec doesn't work
+        TUid iFallbackUid;
+
+        // Max frame rate 
+        TReal iMaxFrameRate;
+
+        // Uncompressed format
+        TUncompressedVideoFormat iUncompressedFormat;
+
+        // Compressed format
+        CCompressedVideoFormat* iCompresedFormat;
+
+        // Picture size
+        TSize iPictureSize;
+
+        // Rate control options
+        TRateControlOptions iRateControlOptions;
+
+        // Coding options
+        TTRVideoCodingOptions iCodingOptions;
+
+        // HwDevice Uid
+        THwDeviceId iHwDeviceId;
+
+        // MPEG4 VOL header
+        TBufC8<256> iVolHeader;
+
+        // Output buffer type
+        TInt iBufferType;
+
+        // Output media buffer
+        CCMRMediaBuffer* iOutputMediaBuffer;
+
+        // Request status
+        TRequestStatus* iStat;
+
+        // Real-time processing
+        TBool iRealTime;
+
+        // State
+        TInt iState;
+
+        // Src frame rate
+        TReal iSrcRate;
+
+        // Output data type
+        TInt iOutputDataType;
+
+        // Codec level
+        TInt iCodecLevel;
+
+        // Codec type
+        TInt iCodecType;
+
+        // Error rate 
+        TReal iErrorRate;
+
+        // Fatal error code
+        TInt iFatalError;
+        
+        // Vol data sending status
+        TBool iVolHeaderSent;
+        
+        // Vol header status 
+        TBool iRemoveHeader;
+        
+        // Vol header length
+        TUint iVolLength;
+        
+        // Rate control options
+        TRateControlOptions iRateOptions;
+        
+        // Rate setting
+        TBool iBitRateSetting;
+        
+        // Buffer Management CI
+        MMmfVideoBufferManagement* iVideoBufferManagementCI;
+        
+        // Last ts
+        TTimeIntervalMicroSeconds iLastTimestamp;
+        
+        // If selected encoder is accelerated or not
+        TBool iAcceleratedCodecSelected;
+        
+        // ETrue if random access point was requested
+        TBool iSetRandomAccessPoint;
+        
+        // Number of H.264 SPS/PPS NAL units from encoder
+        TInt iNumH264SPSPPS;
+        
+        // Video resource handler custom interface
+        MMmfVideoResourceHandler* iVideoResourceHandlerCI;
+    };
+
+
+
+#endif  // CTRVIDEOENCODERCLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/inc/ctrvideopicturesink.h	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Transcoder observer.
+*
+*/
+
+
+#ifndef CTRVIDEOPICTURESINK_H
+#define CTRVIDEOPICTURESINK_H
+
+
+// INCLUDES
+#include "ctrcommon.h"
+
+
+/**
+*  Transcoder observer interface class. Every client should implement this class. 
+*  @lib TRANSCODER.LIB
+*  @since 3.1
+*/
+class MTRVideoPictureSink
+    {
+    public:
+        /**
+        * Sends videopicture to the client (if retrieve intermediate content was called) / returns encoded picture back
+        * @param TTRVideoPicture Uncompressed videopicture
+        * @return void
+        */
+        virtual void MtroPictureFromTranscoder(TTRVideoPicture* aPicture) = 0;
+    };
+
+
+#endif  // CTRVIDEOPICTURESINK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/src/Ctrscaler.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,791 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Resampling framework for YUV 4.2.0.
+*
+*/
+
+
+
+// INCLUDES
+#include "ctrscaler.h"
+#include "ctrsettings.h"
+#include "ctrhwsettings.h"
+#include <e32math.h>
+
+
+// Debug print macro
+#ifdef _DEBUG
+    #include <e32svr.h>
+    #define PRINT(x) RDebug::Print x;
+#else
+    #define PRINT(x)
+#endif
+
+
+// An assertion macro wrapper to clean up the code a bit
+#define VPASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CTRScaler"), KErrAbort))
+
+
+// Macros for fixed point math
+#define FP_BITS         15      // Number of bits to use for FP decimals
+#define FP_FP(x)        (static_cast<TInt>((x) * 32768.0))
+#define FP_ONE          (1 << FP_BITS)
+#define FP_MUL(x,y)     (((x) * (y)) >> FP_BITS)
+#define FP_FRAC(x)      ((x) & (FP_ONE - 1))
+#define FP_INT(x)       ((x) >> FP_BITS)
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTRScaler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTRScaler* CTRScaler::NewL()
+    {
+    // Standard two phase construction
+    CTRScaler* self = new (ELeave) CTRScaler();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRScaler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CTRScaler::ConstructL()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRScaler::CTRScaler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+CTRScaler::CTRScaler()
+    {
+    // Scaler does not perform any operation before initializing
+    iOperation = EOperationNone;
+    iTrgBuffer = NULL;
+    }
+
+
+// ---------------------------------------------------------
+// CTRScaler::~CTRScaler()
+// Destructor
+// ---------------------------------------------------------
+//
+CTRScaler::~CTRScaler()
+    {
+    }
+
+// ---------------------------------------------------------
+// CTRScaler::IsWideAspectRatio()
+// Checks if aspect ratio is wide
+// ---------------------------------------------------------
+//
+TBool CTRScaler::IsWideAspectRatio(TSize aSize)
+    {
+    return ( TReal(aSize.iWidth) / TReal(aSize.iHeight) ) > KTRWideThreshold;
+    }
+
+// -----------------------------------------------------------------------------
+// CTRScaler::SetupScalerL
+// Sets the scaler options (src buffer, dest buffer (could be the same as a src), src resolution, trg resolution)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRScaler::SetScalerOptionsL(TPtr8& aSrc, TPtr8& aTrg, TSize& aSrcSize, TSize& aTrgSize )
+    {
+    
+    
+    PRINT((_L("CTRScaler::SetScalerOptionsL, src = (%d, %d), trg = (%d, %d)"), 
+        aSrcSize.iWidth, aSrcSize.iHeight, aTrgSize.iWidth, aTrgSize.iHeight));
+    
+    // Check settings
+    if ( ( !aSrc.Ptr() ) || ( !aTrg.Ptr() ) || 
+       ( aSrcSize.iWidth == 0) || ( aSrcSize.iHeight == 0 )   || 
+       ( aTrgSize.iWidth == 0) || ( aTrgSize.iHeight == 0 )   ||
+       ( aSrc.MaxLength() < ( aSrcSize.iWidth * aSrcSize.iHeight * 3 / 2 ) ) || 
+       ( aTrg.MaxLength() < ( aTrgSize.iWidth * aTrgSize.iHeight * 3 / 2 ) )
+        )
+        {
+        PRINT((_L("CTRScaler::SetupScalerL(), Given options are not supported")))
+        User::Leave(KErrNotSupported);
+        }
+    else
+        {
+        TReal remainder = 0.0;
+        iTrgBuffer = NULL;
+
+        // We don't support non-multiple output yet
+        Math::Mod( remainder, static_cast<TReal>(aTrgSize.iWidth), 4.0 );
+
+        if ( remainder == 0.0 )
+            {
+            Math::Mod( remainder, static_cast<TReal>(aTrgSize.iHeight), 4.0 );
+            }
+
+        if ( remainder != 0.0 )
+            {
+            PRINT((_L("CTRScaler::SetupScalerL(), Scaler does not support output resolution that is not multiple by 4")))
+            User::Leave(KErrNotSupported);
+            }
+            
+        TSize targetSize = aTrgSize;
+        // check if black boxing is needed
+        TBool srcWide = IsWideAspectRatio(aSrcSize);
+        TBool dstWide = IsWideAspectRatio(aTrgSize);
+        
+        iBlackBoxing = TSize(0,0);
+        
+        TBool doScaling = ETrue;
+        if (srcWide != dstWide)
+            {
+                TSize resolution(0,0);
+            
+                doScaling = GetIntermediateResolution(aSrcSize, aTrgSize, resolution, iBlackBoxing);
+            
+                // Set the whole image to black
+                TUint yLength = aTrgSize.iWidth * aTrgSize.iHeight;
+		        TUint uvLength = yLength >> 1;
+                
+                // Y
+        		TInt data = 0;
+        		TPtr8 tempPtr(0,0);        		
+        		tempPtr.Set(const_cast<TUint8*>(aTrg.Ptr()), yLength, yLength);        		
+        		tempPtr.Fill((TChar)data, yLength);
+
+        		// U,V        		
+        		data = 127;
+        		tempPtr.Set(const_cast<TUint8*>(aTrg.Ptr()) + yLength, uvLength, uvLength); 
+        		tempPtr.Fill((TChar)data, uvLength);                
+
+                aTrgSize = resolution;
+                PRINT((_L("CTRScaler::SetScalerOptionsL, blackboxing width = %d, height = %d"), iBlackBoxing.iWidth, iBlackBoxing.iHeight));
+            }
+         
+        if ( !doScaling )
+            {
+            // No need to perform resampling operation, copy data with black boxing
+            iOperation = EOperationCopyWithBB;
+            }        
+        
+        else if ( (aTrgSize.iWidth == aSrcSize.iWidth) && (aTrgSize.iHeight == aSrcSize.iHeight) )
+            {
+            // No need to perform resampling operation, just copy data
+            iOperation = EOperationCopy;
+            }
+        else if ( (aTrgSize.iWidth == aSrcSize.iWidth * 2) && (aTrgSize.iHeight == aSrcSize.iHeight * 2) )
+            {
+            // Resolution is doubled
+            iOperation = EDoubleSize;
+            }
+        else if ( (aTrgSize.iWidth * 2 == aSrcSize.iWidth) && (aTrgSize.iHeight * 2 == aSrcSize.iHeight) )
+            {
+            // Resolution is halved
+            iOperation = EHalveSize;
+            }
+        else if ( (aTrgSize.iWidth > aSrcSize.iWidth) && (aTrgSize.iHeight > aSrcSize.iHeight) )
+            {
+            // Resolution is increased
+            iOperation = EUpSampling;
+            }
+        else if ( (aTrgSize.iWidth < aSrcSize.iWidth) && (aTrgSize.iHeight < aSrcSize.iHeight) )
+            {
+            // Resolution is decreased
+            iOperation = EDownSampling;
+            }
+        else
+            {
+            // The image is streched ie. vertical resolution increases and horizontal decreases or vice versa
+            iOperation = EUpDownSampling;
+            }
+
+        // Set given settings
+        iSrc = const_cast<TUint8*>( aSrc.Ptr() );
+        iTrg = const_cast<TUint8*>( aTrg.Ptr() );
+        iSrcSize = aSrcSize;
+        iTrgSize = aTrgSize;
+        iSrcInit = iSrc;
+        iTrgInit = iTrg;
+        aTrgSize = targetSize;  // recover target size since it's a reference
+        iTrgDataSize = aTrgSize.iWidth * aTrgSize.iHeight * 3 / 2;
+        iTrgBuffer = &aTrg;
+        }
+    }
+    
+// ---------------------------------------------------------
+// CTRScaler::GetIntermediateResolution()
+// Calculates intermediate resolution for use with black boxing
+// ---------------------------------------------------------
+//
+TBool CTRScaler::GetIntermediateResolution(TSize aSrcSize, TSize aTrgSize, 
+                                           TSize& aTargetResolution, TSize& aBlackBoxing)
+    {
+
+    TSize resolution;
+    TBool doScaling = ETrue;
+       
+    TBool srcWide = IsWideAspectRatio(aSrcSize);
+    TBool dstWide = IsWideAspectRatio(aTrgSize);
+    
+    VPASSERT(srcWide != dstWide);
+    
+    if (dstWide)
+        {
+        // Pillarboxing
+        
+        // scale height to destination
+        TReal factor = TReal(aTrgSize.iHeight) / TReal(aSrcSize.iHeight);
+        
+        resolution.iWidth = TInt( aSrcSize.iWidth * factor );
+        
+        if (resolution.iWidth & 0x1 > 0)
+            resolution.iWidth++;
+        
+        resolution.iHeight = aTrgSize.iHeight;
+        
+        while ( (aTrgSize.iWidth - resolution.iWidth) % 4 != 0 )
+        {
+            resolution.iWidth += 2;
+        }
+
+        aBlackBoxing.iWidth = (aTrgSize.iWidth - resolution.iWidth) / 2;
+        
+        if ( factor == 1.0 )
+            {
+            // source and destination heights are the same, 
+            // meaning source width is smaller and we don't
+            // have to scale, just do pillarboxing
+            doScaling = EFalse;
+
+            // set target width
+            resolution.iWidth = aTrgSize.iWidth;
+            }
+                        
+        }
+    else
+        {
+        // Letterboxing
+    
+        // scale width to destination
+        TReal factor = TReal(aTrgSize.iWidth) / TReal(aSrcSize.iWidth);                                
+                    
+        resolution.iHeight = TInt( aSrcSize.iHeight * factor );                
+
+        if (resolution.iHeight & 0x1 > 0)
+            resolution.iHeight++;
+        
+        resolution.iWidth = aTrgSize.iWidth;
+        
+        while ( (aTrgSize.iHeight - resolution.iHeight) % 4 != 0 )
+            {
+            resolution.iHeight += 2;
+            }                                    
+        
+        aBlackBoxing.iHeight = (aTrgSize.iHeight - resolution.iHeight) / 2;
+        
+        if ( factor == 1.0 )
+            {
+            // source and destination widths are the same, 
+            // meaning source height is smaller and we don't
+            // have to scale, just do letterboxing
+            doScaling = EFalse;
+
+            // set target height
+            resolution.iHeight = aTrgSize.iHeight;
+            }
+        }
+
+    PRINT((_L("CTRScaler::GetIntermediateResolution, resolution = (%d, %d), bb = (%d, %d)"), 
+        resolution.iWidth, resolution.iHeight, aBlackBoxing.iWidth, aBlackBoxing.iHeight));
+
+    aTargetResolution = resolution;
+    
+    return doScaling;
+    
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CTRScaler::Scale()
+// Scale the image
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRScaler::Scale()
+    {
+    TSize srcSizeUV = TSize( iSrcSize.iWidth / 2, iSrcSize.iHeight / 2 );
+    TSize trgSizeUV = TSize( iTrgSize.iWidth / 2, iTrgSize.iHeight / 2 );
+    TSize blackBoxingUV = TSize( iBlackBoxing.iWidth / 2, iBlackBoxing.iHeight / 2 );
+    
+    switch( iOperation )
+        {
+        case EOperationCopy:
+            {
+            // Src / Trg resolutions are the same, no needs to perform resampling
+            if ( iSrc != iTrg )
+                {
+                    // Copy data, if different memory areas are specified
+                    Mem::Copy( iTrg, iSrc, iTrgDataSize );            
+                }
+            else
+                {
+                // The same memory fragment is specified for the output; Keep it without changes;
+                }
+            }
+            break;
+            
+        case EOperationCopyWithBB:
+            {                
+            // Copy with black boxing
+            CopyWithBlackBoxing(iSrcSize, iTrgSize, iBlackBoxing);
+            CopyWithBlackBoxing(srcSizeUV, trgSizeUV, blackBoxingUV);
+            CopyWithBlackBoxing(srcSizeUV, trgSizeUV, blackBoxingUV);
+            }
+            break;
+
+        case EDownSampling:
+            {
+            TInt error = KErrNoMemory;
+            
+            // If scaling to less than 50% of the source size
+            if ( (iTrgSize.iWidth * 2 < iSrcSize.iWidth) && (iTrgSize.iHeight * 2 < iSrcSize.iHeight) )
+                {
+                // Try to do the scaling in two steps
+                TRAP( error, DoHalveAndBilinearResampleL() );
+                }
+               
+            // If the above failed or scaling to 51% or higher        
+            if ( error != KErrNone )
+                {
+                // Resample the Y, U & V components
+                ResampleBilinear(iSrcSize, iTrgSize, iBlackBoxing);
+                ResampleBilinear(srcSizeUV, trgSizeUV, blackBoxingUV);
+                ResampleBilinear(srcSizeUV, trgSizeUV, blackBoxingUV);
+                }
+            }
+            break;
+            
+        case EUpSampling:
+        case EUpDownSampling:
+            {            
+            // Resample the Y, U & V components
+            ResampleBilinear(iSrcSize, iTrgSize, iBlackBoxing);
+            ResampleBilinear(srcSizeUV, trgSizeUV, blackBoxingUV);
+            ResampleBilinear(srcSizeUV, trgSizeUV, blackBoxingUV);
+            }
+            break;
+            
+        case EDoubleSize:
+            {
+            // Resample the Y, U & V components to double size
+            ResampleDouble(iSrcSize, iTrgSize);
+            ResampleDouble(srcSizeUV, trgSizeUV);
+            ResampleDouble(srcSizeUV, trgSizeUV);
+            }
+            break;
+            
+        case EHalveSize:
+            {
+            // Resample the Y, U & V components to half size
+            ResampleHalve(iSrcSize, iTrgSize, iBlackBoxing);
+            ResampleHalve(srcSizeUV, trgSizeUV, blackBoxingUV);
+            ResampleHalve(srcSizeUV, trgSizeUV, blackBoxingUV);
+            }
+            break;
+
+        case EOperationNone:
+            {
+            PRINT((_L("CTRScaler::Scale(), Scaler was not initialized yet to perform any operation")))
+            return;
+            }
+//            break;
+
+        default:
+            {
+            }
+        }
+        
+    // Recover source and target data pointers
+    iSrc = iSrcInit;
+    iTrg = iTrgInit;
+    
+    // Set Dsc length
+    if (iTrgBuffer)
+        {
+        iTrgBuffer->SetLength(iTrgDataSize);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CTRScaler::CopyWithBlackBoxing()
+// Copies frame to target buffer applying black borders
+// -----------------------------------------------------------------------------
+//       
+void CTRScaler::CopyWithBlackBoxing(TSize& aSrcSize, TSize& aTrgSize, TSize& aBlackBoxing)
+{
+
+    if (aBlackBoxing.iHeight != 0)
+        {
+        
+        TInt copyLength = aSrcSize.iWidth * aSrcSize.iHeight;
+        
+        iTrg += aBlackBoxing.iHeight * aTrgSize.iWidth;
+        Mem::Copy(iTrg, iSrc, copyLength);
+        
+        iTrg += copyLength;
+        iTrg += aBlackBoxing.iHeight * aTrgSize.iWidth;                                        
+        iSrc += copyLength;
+        
+        } 
+                    
+    else if (aBlackBoxing.iWidth != 0)
+        {
+                                                
+        TInt i;
+        iTrg += aBlackBoxing.iWidth;
+        
+        for (i = 0; i < iTrgSize.iHeight; i++)
+            {
+            // copy one row
+            Mem::Copy(iTrg, iSrc, aSrcSize.iWidth);
+            iSrc += aSrcSize.iWidth;
+            iTrg += aSrcSize.iWidth;
+            iTrg += aBlackBoxing.iWidth * 2;
+            }
+            
+        // subtract the width of one pillar
+        iTrg -= aBlackBoxing.iWidth;
+            
+        }
+}
+
+
+// -----------------------------------------------------------------------------
+// CTRScaler::DoHalveAndBilinearResampleL()
+// First resamples an image to half size and then uses bilinear resample to
+// scale it to requested size.
+// -----------------------------------------------------------------------------
+//    
+void CTRScaler::DoHalveAndBilinearResampleL()
+    {
+    // Make sure the scale factor is correct
+    VPASSERT( (iTrgSize.iWidth * 2 < iSrcSize.iWidth) &&
+              (iTrgSize.iHeight * 2 < iSrcSize.iHeight) );
+    
+    TSize srcSizeUV = TSize( iSrcSize.iWidth / 2, iSrcSize.iHeight / 2 );
+    TSize trgSizeUV = TSize( iTrgSize.iWidth / 2, iTrgSize.iHeight / 2 );
+    TSize blackBoxingUV = TSize( iBlackBoxing.iWidth / 2, iBlackBoxing.iHeight / 2 );
+    
+    // Calculate the size for the temporary image where we store the intermediate result         
+    TSize tempSize = TSize( iSrcSize.iWidth / 2, iSrcSize.iHeight / 2 );
+    TSize tempSizeUV = TSize( tempSize.iWidth / 2, tempSize.iHeight / 2 );
+    
+    // Allocate memory for the temporary image
+    TUint8* tempBuffer = (TUint8*) User::AllocLC(tempSize.iWidth * tempSize.iHeight * 3 / 2);
+    
+    // Set the temporary image as the target
+    iTrg = tempBuffer;
+
+    TSize zeroBlackBox = TSize(0,0);
+    // Resample the Y, U & V components to half size
+    ResampleHalve(iSrcSize, tempSize, zeroBlackBox);
+    ResampleHalve(srcSizeUV, tempSizeUV, zeroBlackBox);
+    ResampleHalve(srcSizeUV, tempSizeUV, zeroBlackBox);
+    
+    // Set the temporary image as the source and recover the original target
+    iSrc = tempBuffer;
+    iTrg = iTrgInit;
+    
+    // Resample the Y, U & V components
+    ResampleBilinear(tempSize, iTrgSize, iBlackBoxing);
+    ResampleBilinear(tempSizeUV, trgSizeUV, blackBoxingUV);
+    ResampleBilinear(tempSizeUV, trgSizeUV, blackBoxingUV);
+    
+    // Release the temporary buffer
+    CleanupStack::PopAndDestroy(tempBuffer);
+    }
+
+// -----------------------------------------------------------------------------
+// CTRScaler::ResampleBilinear()
+// Resamples an image with bilinear filtering. The target pixel is generated by
+// linearly interpolating the four nearest source pixels in x- and y-directions.
+// -----------------------------------------------------------------------------
+//    
+void CTRScaler::ResampleBilinear(TSize& aSrcSize, TSize& aTrgSize, TSize& aBlackBoxing)
+    {
+    TInt i = 0, j = 0;
+    TInt x = 0, y = 0;
+    TInt fx = 0, fy = 0;
+    TInt weightFactor = 0;
+    
+    // Pointers to the source memory
+    TUint8* srcRowPosition = 0;
+    TUint8* srcPixelPosition = 0;
+    
+    // Calculate the scale factor using the max indices of the source and target images
+    TReal scaleX = TReal(aSrcSize.iWidth - 1) / TReal(aTrgSize.iWidth - 1);
+    TReal scaleY = TReal(aSrcSize.iHeight - 1) / TReal(aTrgSize.iHeight - 1);
+    
+    // Convert the scale factor to fixed point
+    iScaleXInt = FP_FP(scaleX) - 1;     // subtract 1 so we don't go outside the source image
+    iScaleYInt = FP_FP(scaleY) - 1;
+        
+    if ( aBlackBoxing.iWidth != 0 )
+        {
+        // increment target pointer over first 'pillar'
+        iTrg += aBlackBoxing.iWidth;
+        }
+    else if ( aBlackBoxing.iHeight != 0 )
+        {
+        // increment target pointer over top letterboxed area
+        iTrg += aTrgSize.iWidth * aBlackBoxing.iHeight;
+        }
+
+    // Loop target rows
+    for( i = 0, y = 0; i < aTrgSize.iHeight; i++ )
+        {
+        // Calculate the row position of the source        
+        srcRowPosition = iSrc + FP_INT(y) * aSrcSize.iWidth;
+        
+        fy = FP_FRAC(y);    // Fractational part of the row position
+         
+        // Loop target columns
+        for( j = 0, x = 0; j < aTrgSize.iWidth; j++ )
+            {
+            // Calculate the pixel position in the source            
+            srcPixelPosition = srcRowPosition + FP_INT(x);
+            
+            // Calculate the weight factor for blending
+            fx = FP_FRAC(x); 
+            weightFactor = FP_MUL(fx, fy);
+            
+            // Blend using the four nearest pixels
+            *(iTrg) = FP_INT(
+                *(srcPixelPosition) * (weightFactor + FP_ONE - fx - fy) + 
+                *(srcPixelPosition + 1) * (fx - weightFactor) + 
+                *(srcPixelPosition + aSrcSize.iWidth) * (fy - weightFactor) +
+                *(srcPixelPosition + 1 + aSrcSize.iWidth) * weightFactor );
+            
+            iTrg++;             // Move on to the next target pixel
+            x += iScaleXInt;    // Calculate the column for the next source pixel
+            }
+
+        y += iScaleYInt;        // Calculate the row for the next source pixels
+        
+        if ( aBlackBoxing.iWidth != 0 )
+            {
+            // increment target pointer over two pillars, one at the end of this row, 
+            // other one at the beginning of the next row
+            iTrg += aBlackBoxing.iWidth * 2;
+            }
+        }
+
+    // Update pointers 
+    iSrc += aSrcSize.iWidth * aSrcSize.iHeight;
+    
+    if ( aBlackBoxing.iWidth != 0 )
+        {
+        // subtract the width of one pillar
+        iTrg -= aBlackBoxing.iWidth;
+        }
+    else if ( aBlackBoxing.iHeight != 0 )
+        {
+        // increment over bottom letterboxed area
+        iTrg += aBlackBoxing.iHeight * aTrgSize.iWidth;
+        }
+        
+    }
+
+// -----------------------------------------------------------------------------
+// CTRScaler::ResampleHalve()
+// Resamples an image to half size. For each target pixel a 2x2 pixel area is
+// read from the source and blended together to produce the target color.
+// -----------------------------------------------------------------------------
+//    
+void CTRScaler::ResampleHalve(TSize& aSrcSize, TSize& aTrgSize, TSize& aBlackBoxing)
+    {
+    TInt i = 0, j = 0;
+    
+    // Make sure the scale factor is correct
+    VPASSERT( (aTrgSize.iWidth * 2 == aSrcSize.iWidth) &&
+              (aTrgSize.iHeight * 2 == aSrcSize.iHeight) );
+              
+    if ( aBlackBoxing.iHeight != 0 )
+        {
+        // increment target pointer over top letterboxed area
+        iTrg += aTrgSize.iWidth * aBlackBoxing.iHeight;
+        }          
+
+    // Loop target rows
+    for( i = 0; i < aTrgSize.iHeight; i++ )
+        {
+        // Loop target columns    
+        for( j = 0; j < aTrgSize.iWidth; j++ )
+            {
+            // Calculate the target pixel by blending the 4 nearest source pixels          
+            *(iTrg) = (
+                *(iSrc) +
+                *(iSrc + 1) +
+                *(iSrc + aSrcSize.iWidth) +
+                *(iSrc + 1 + aSrcSize.iWidth)
+                ) >> 2;  // divide by 4
+                
+            iTrg++;     // Move on to the next target pixel
+            iSrc += 2;  // Sample every second column from the source
+            }
+            
+        iSrc += aSrcSize.iWidth;    // Sample every second row from the source
+        }
+        
+    if ( aBlackBoxing.iHeight != 0 )
+        {
+        // increment over bottom letterboxed area
+        iTrg += aBlackBoxing.iHeight * aTrgSize.iWidth;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CTRScaler::ResampleDouble()
+// Resamples an image to double size. A 2x2 pixel area is generated using
+// the four nearest pixels from the source and written to the target image.
+// -----------------------------------------------------------------------------
+//      
+void CTRScaler::ResampleDouble(TSize& aSrcSize, TSize& aTrgSize)
+    {
+    TInt i = 0, j = 0;
+    
+    // Make sure the scale factor is correct
+    VPASSERT( (aTrgSize.iWidth == aSrcSize.iWidth * 2) &&
+              (aTrgSize.iHeight == aSrcSize.iHeight * 2) );
+
+    // Generate 2x2 target pixels in each loop
+    
+    // Loop every second target row
+    for( i = 0; i < aTrgSize.iHeight - 2; i += 2 )
+        {
+        // Loop every second target column      
+        for( j = 0; j < aTrgSize.iWidth - 2; j += 2 )
+            {
+            // Top-left pixel: Copy as it is
+            *(iTrg) = *(iSrc);
+            
+            // Top-right pixel: Blend the pixels on the left and right
+            *(iTrg + 1) = (*(iSrc) + *(iSrc + 1)) >> 1; 
+             
+            // Bottom-left pixel: Blend the above and below pixels
+            *(iTrg + aTrgSize.iWidth) = (*(iSrc) + *(iSrc + aSrcSize.iWidth)) >> 1;
+               
+            // Bottom-right pixel: Blend the four nearest pixels
+            *(iTrg + 1 + aTrgSize.iWidth) = (
+                *(iSrc) +
+                *(iSrc + 1) +
+                *(iSrc + aSrcSize.iWidth) +
+                *(iSrc + 1 + aSrcSize.iWidth)
+                ) >> 2;
+                
+            iTrg += 2;      // Move on to the next 2x2 group of pixels
+            iSrc++;         // Sample the next pixel from source       
+            }
+            
+        // The last 2x2 pixels on this row need to be handled separately
+        
+        // Top-left and top-right pixels: Copy as it is
+        *(iTrg) = *(iTrg + 1) = *(iSrc);
+        
+        // Bottom-left and bottom-right pixels: Blend the above and below pixels
+        *(iTrg + aTrgSize.iWidth) = *(iTrg + 1 + aTrgSize.iWidth) = (
+            *(iSrc) +
+            *(iSrc + aSrcSize.iWidth)
+            ) >> 1;
+            
+        iTrg += 2 + aTrgSize.iWidth;        // Move on to the beginning of the next row
+        iSrc++;                             // Sample the next pixel from source   
+        }
+        
+    // Handle the last row    
+    for( j = 0; j < aTrgSize.iWidth - 2; j += 2 )
+        {
+        // Top-left and bottom-left pixels: Copy as it is
+        *(iTrg) = *(iTrg + aTrgSize.iWidth) = *(iSrc);
+        
+        // Top-right and bottom-right pixels: Blend the pixels on the left and right
+        *(iTrg + 1) = *(iTrg + 1 + aTrgSize.iWidth) = (
+            *(iSrc) +
+            *(iSrc + 1)
+            ) >> 1;
+            
+        iTrg += 2;      // Move on to the next 2x2 group of pixels
+        iSrc++;         // Sample the next pixel from source               
+        }
+    
+    // Handle the last 2x2 group of pixels  
+    
+    // Copy all four pixels
+    *(iTrg) = *(iTrg + 1) = *(iTrg + aTrgSize.iWidth) = *(iTrg + 1 + aTrgSize.iWidth) = *(iSrc);
+    
+    // Update pointers to the beginning of the next image
+    iTrg += 2 + aTrgSize.iWidth;
+    iSrc++;
+    }
+
+// -----------------------------------------------------------------------------
+// CTRScaler::EstimateResampleFrameTime
+// Returns a time estimate of how long it takes to resample a frame
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+TReal CTRScaler::EstimateResampleFrameTime(const TTRVideoFormat& aInput, const TTRVideoFormat& aOutput)
+    {
+    // Assume bilinear filtering is used by default
+    TReal time = KTRResampleTimeFactorBilinear;
+    
+    if ( (aOutput.iSize.iWidth == aInput.iSize.iWidth) && (aOutput.iSize.iHeight == aInput.iSize.iHeight) )
+        {
+        // No need for resampling
+        return 0.0;
+        }
+    else if ( (aOutput.iSize.iWidth == aInput.iSize.iWidth * 2) && (aOutput.iSize.iHeight == aInput.iSize.iHeight * 2) )
+        {
+        // Resolution is doubled
+        time = KTRResampleTimeFactorDouble;
+        }
+    else if ( (aOutput.iSize.iWidth * 2 == aInput.iSize.iWidth) && (aOutput.iSize.iHeight * 2 == aInput.iSize.iHeight) )
+        {
+        // Resolution is halved
+        time = KTRResampleTimeFactorHalve;
+        }
+    
+    // Multiply the time by the resolution of the output frame
+    time *= static_cast<TReal>(aOutput.iSize.iWidth + aOutput.iSize.iHeight) * KTRTimeFactorScale;
+    
+    PRINT((_L("CTRScaler::EstimateResampleFrameTime(), resample frame time: %.2f"), time))
+    
+    return time;
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/src/Ctrtranscoder.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Transcoder.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "ctrtranscoder.h"
+#include "ctrtranscoderimp.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTRTranscoder::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTRTranscoder* CTRTranscoder::NewL(MTRTranscoderObserver& aObserver)
+    {
+    CTRTranscoderImp* self = CTRTranscoderImp::NewL(aObserver);
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CTRTranscoder::~CTRTranscoder()
+// Destructor
+// ---------------------------------------------------------
+//
+CTRTranscoder::~CTRTranscoder()
+    {
+    }
+
+
+
+#ifndef EKA2
+
+// -----------------------------------------------------------------------------
+// E32Dll DLL Entry point
+// -----------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
+    {
+    return(KErrNone);
+    }
+
+#endif
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/src/Ctrtranscoderimp.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,4118 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Transcoder Implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <centralrepository.h>
+#include "ctrvideopicturesink.h"
+#include "ctrtranscoderobserver.h"
+#include "ctrtranscoderimp.h"
+#include "ctrsettings.h"
+#include "ctrhwsettings.h"
+#include "ctrvideodecoderclient.h"
+#include "ctrvideoencoderclient.h"
+#include "ctrscaler.h"
+#include "ctrprivatecrkeys.h"
+
+
+// MACROS
+#define TRASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CTRANSCODERIMP"), KErrAbort))
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTRTranscoderImp* CTRTranscoderImp::NewL(MTRTranscoderObserver& aObserver)
+    {
+    PRINT(_L("CTRTranscoderImp::NewL(), In"))
+
+    CTRTranscoderImp* self = new (ELeave) CTRTranscoderImp(aObserver);
+    CleanupStack::PushL( reinterpret_cast<CTRTranscoder*>(self) );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    PRINT(_L("CTRTranscoderImp::NewL(), Out"))
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::CTRTranscoderImp
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CTRTranscoderImp::CTRTranscoderImp(MTRTranscoderObserver& aObserver) :
+    CActive(EPriorityStandard), 
+    iObserver(aObserver)
+    {
+    CActiveScheduler::Add(this);
+    iVideoDecoderClient = NULL;
+    iVideoEncoderClient = NULL;
+    iRealTime = EFalse;
+    iMediaSink = NULL;
+    iScaler = NULL;
+    iPictureSink = NULL;
+    iPictureSinkTemp = NULL;
+    iState = ETRNone;
+    iEncoderInitStatus = KTRErrNotReady;    /*Internal error status*/
+    iDecoderInitStatus = KTRErrNotReady;
+    iEncoderStreamEnd = EFalse;
+    iDecoderStreamEnd = EFalse;
+    iDataArray = NULL;
+    iVideoPictureArray = NULL;
+    iDecodedPicture = NULL;
+    iBitRateSetting = EFalse;
+    iFatalError = KErrNone;
+    iOptimizedDataTransfer = EFalse;
+    iEncoderEnabled = ETrue;
+    iPictureSinkEnabled = EFalse;
+    iPictureSinkClientSetting = EFalse;
+    iSetRandomAccessPoint = EFalse;
+    iEncoderEnabledSettingChanged = EFalse;
+    iPictureSinkSettingChanged = EFalse;
+    iEncoderEnableClientSetting = ETrue;
+    iWaitPictureFromClient = NULL;
+    iWaitNewDecodedPicture = NULL;
+    iNewEvent = NULL;
+    iCurrentPictureSinkEnabled = EFalse;
+    iCurrentAsyncPictureSinkEnabled = EFalse;
+    iCurrentEncoderEnabled = ETrue;
+    iCurrentAsyncEncoderEnabled = ETrue;
+    iCurrentRandomAccess = EFalse;
+    iAsyncStop = EFalse;
+    iMaxFramesInProcessing = KTRMaxFramesInProcessingDefault;
+
+
+    // Set offset for queues
+    iTranscoderPictureQueue.SetOffset( static_cast<TInt>( _FOFF( TVideoPicture, iLink )));
+    iEncoderPictureQueue.SetOffset( static_cast<TInt>( _FOFF( TVideoPicture, iLink )));
+    iCIPictureBuffersQueue.SetOffset( static_cast<TInt>( _FOFF( TVideoPicture, iLink )));
+    iTranscoderTRPictureQueue.SetOffset( static_cast<TInt>( _FOFF( TTRVideoPicture, iLink )));
+    iContainerWaitQueue.SetOffset( static_cast<TInt>( _FOFF( TVideoPicture, iLink )));
+    iTranscoderEventSrc.SetOffset( static_cast<TInt>( _FOFF( CTREventItem, iLink )));
+    iTranscoderEventQueue.SetOffset( static_cast<TInt>( _FOFF( CTREventItem, iLink )));
+    iTranscoderAsyncEventQueue.SetOffset( static_cast<TInt>( _FOFF( CTREventItem, iLink )));
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::ConstructL()
+    {
+    PRINT((_L("CTRTranscoderImp::ConstructL(), In")))
+    
+    // Allocate ivent quque
+    iEvents = NULL;
+    iEvents = new (ELeave) CTREventItem[KNumberOfEvents];
+    
+    // Fill event's queue
+    for (TInt i = 0; i < KNumberOfEvents; i ++)
+        {
+        iEvents[i].Reset();
+        iTranscoderEventSrc.AddLast( iEvents[i] );
+        }
+        
+    LoadCodecUids();
+        
+    PRINT((_L("CTRTranscoderImp::ConstructL(), Out")))
+    }
+
+
+// ---------------------------------------------------------
+// CTRTranscoderImp::~CTRTranscoderImp()
+// Destructor
+// ---------------------------------------------------------
+//
+CTRTranscoderImp::~CTRTranscoderImp()
+    {
+    PRINT((_L("CTRTranscoderImp::~CTRTranscoderImp(), In")))
+    TInt i = 0;
+    
+    
+    if ( iState == ETRRunning )
+        {
+        TRAPD(status, this->StopL());
+        PRINT((_L("CTRTranscoderImp::~CTRTranscoderImp(), StopL status[%d]"), status))
+        
+        if (status != KErrNone)
+            {
+            // Nothing to do, since destruction of the app
+            }
+        }
+            
+    Cancel();
+
+    if (iVideoDecoderClient)
+        {
+        delete iVideoDecoderClient;
+        iVideoDecoderClient = NULL;
+        }
+
+    if (iVideoEncoderClient)
+        {
+        delete iVideoEncoderClient;
+        iVideoEncoderClient = NULL;
+        }
+
+    if (iScaler)
+        {
+        delete iScaler;
+        iScaler = NULL;
+        }
+        
+    if (iDataArray)
+        {
+        for (i = 0; i < KTRPictureBuffersNumber; i ++)
+            {
+            if ( iDataArray[i] )
+                {
+                delete[] iDataArray[i];
+                iDataArray[i] = NULL;
+                }
+            }
+
+        delete[] iDataArray;
+        iDataArray = NULL;
+        }
+        
+    if ( (iMode == EEncoding) && (iInputPictureSize == iOutputPictureSize) )
+        {
+        // Clean iRawData ptrs, since the actual memory was allocated by the client
+        if (iVideoPictureArray)
+            {
+            for (i = 0; i < KTRPictureBuffersNumber; i ++)
+                {
+                if (iVideoPictureArray[i].iData.iRawData)
+                    {
+                    iVideoPictureArray[i].iData.iRawData = NULL;
+                    }
+                }
+            }
+        }
+    
+    if (iVideoPictureArray)
+        {
+        for (i = 0; i < KTRPictureBuffersNumber; i ++)
+            {
+            if (iVideoPictureArray[i].iData.iRawData)
+                {
+                delete iVideoPictureArray[i].iData.iRawData;
+                iVideoPictureArray[i].iData.iRawData = NULL;
+                }
+            }
+            
+        delete[] iVideoPictureArray;
+        iVideoPictureArray = NULL;
+        }
+
+    if (iTRVideoPictureArray)
+        {
+        delete[] iTRVideoPictureArray;
+        iTRVideoPictureArray = NULL;
+        }
+        
+    if (iEvents)
+        {
+        delete[] iEvents;
+        }
+
+    PRINT((_L("CTRTranscoderImp::~CTRTranscoderImp(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::SupportsInputVideoFormat
+// Checks whether given input format is supported
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CTRTranscoderImp::SupportsInputVideoFormat(const TDesC8& aMimeType)
+    {
+    PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat(), In")))
+    TBool supports = EFalse;
+
+
+    if ( aMimeType == KNullDesC8 )
+        {
+        PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat(), Mime type is undefined")))
+        return EFalse;
+        }
+        
+    // Check video decoder
+    if (!iVideoDecoderClient)
+        {
+         // Parse MIME
+        TRAPD(status, this->ParseMimeTypeL(aMimeType, ETrue));
+        
+        if (status != KErrNone)
+            {
+            PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat(), ParseMimeTypeL[%d]"), status))
+            return EFalse;
+            }
+                
+        // Create the decoder client first
+        TRAP( status, iVideoDecoderClient = CTRVideoDecoderClient::NewL(*this) );
+                
+        if (status != KErrNone)
+            {
+            PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat(), VideoDecClient status[%d]"), status))
+            iVideoDecoderClient = NULL;
+            return EFalse;
+            }
+        }
+        
+    // Choose the correct codec Uids to use    
+    TInt preferredUid = 0;
+    TInt fallbackUid = 0;
+    TInt resolutionUid = 0;
+    
+    if (iInputCodec == EH263)
+        {
+        preferredUid = iH263DecoderUid;
+        fallbackUid = KTRFallbackDecoderUidH263;
+        
+        PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat() H.263, preferred = 0x%x"), preferredUid))
+        PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat() H.263, fallback = 0x%x"), fallbackUid))
+        
+        if (iInputPictureSize.iWidth <= iH263DecoderLowResThreshold)
+            {
+            resolutionUid = iH263DecoderLowResUid;
+            
+            PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat() H.263, below, resolutions = 0x%x"), resolutionUid))
+            }
+        }
+    else if (iInputCodec == EH264)
+        {
+        preferredUid = iH264DecoderUid;
+        fallbackUid = KTRFallbackDecoderUidH264;
+        
+        PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat() AVC, preferred = 0x%x"), preferredUid))
+        PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat() AVC, fallback = 0x%x"), fallbackUid))
+        
+        if (iInputPictureSize.iWidth <= iH264DecoderLowResThreshold)
+            {
+            resolutionUid = iH264DecoderLowResUid;
+            PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat() AVC, below, resolutions = 0x%x"), resolutionUid))
+            }
+        }
+    else
+        {
+        preferredUid = iMPEG4DecoderUid;
+        fallbackUid = KTRFallbackDecoderUidMPEG4;
+        
+        PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat() MPEG-4, preferred = 0x%x"), preferredUid))
+        PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat() MPEG-4, fallback = 0x%x"), fallbackUid))
+        
+        if (iInputPictureSize.iWidth <= iMPEG4DecoderLowResThreshold)
+            {
+            resolutionUid = iMPEG4DecoderLowResUid;
+            PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat() MPEG-4, below, resolutions = 0x%x"), resolutionUid))
+            }
+        }
+        
+    if (resolutionUid != 0)
+        {
+        preferredUid = resolutionUid;
+        }
+        
+    PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat() preferred = 0x%x"), preferredUid))    
+            
+    supports = iVideoDecoderClient->SupportsCodec(iInputMimeType, iInputShortMimeType, preferredUid, fallbackUid);
+
+    PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat(), supports[%d] Out"), supports))
+    return supports;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::SupportsOutputVideoFormat
+// Checks whether given output format is supported
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CTRTranscoderImp::SupportsOutputVideoFormat(const TDesC8& aMimeType)
+    {
+    PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat(), In")))
+    TBool supports = EFalse;
+
+
+    if ( aMimeType == KNullDesC8 )
+        {
+        PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat(), Mime type is undefined")))
+        return EFalse;
+        }
+
+    // Check video encoder
+    if (!iVideoEncoderClient)
+        {
+        // Parse MIME
+        TRAPD(status, this->ParseMimeTypeL(aMimeType, EFalse));
+            
+        if (status != KErrNone)
+            {
+            PRINT((_L("CTRTranscoderImp::SupportsInputVideoFormat(), ParseMimeTypeL[%d]"), status))
+            return EFalse;
+            }
+
+        // Create the encoder client first
+        TRAP(status, iVideoEncoderClient = CTRVideoEncoderClient::NewL(*this) );
+                
+        if (status != KErrNone)
+            {
+            PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat(), VideoEncClient status[%d]"), status))
+            iVideoEncoderClient = NULL;
+            return EFalse;
+            }
+        }
+        
+    // Choose the correct codec Uids to use    
+    TInt preferredUid = 0;
+    TInt fallbackUid = 0;
+    TInt resolutionUid = 0;
+    
+    if (iOutputCodec == EH263)
+        {
+        preferredUid = iH263EncoderUid;
+        fallbackUid = KTRFallbackEncoderUidH263;
+        
+        PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat() H.263, preferred = 0x%x"), preferredUid))
+        PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat() H.263, fallback = 0x%x"), fallbackUid))
+        
+        if (iOutputPictureSize.iWidth <= iH263EncoderLowResThreshold)
+            {
+            resolutionUid = iH263EncoderLowResUid;
+            PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat() H.263, below, resolutions = 0x%x"), resolutionUid))
+            }
+        }
+    else if (iOutputCodec == EH264)
+        {
+        preferredUid = iH264EncoderUid;
+        fallbackUid = KTRFallbackEncoderUidH264;
+        
+        PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat() AVC, preferred = 0x%x"), preferredUid))
+        PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat() AVC, fallback = 0x%x"), fallbackUid))
+        
+        if (iOutputPictureSize.iWidth <= iH264EncoderLowResThreshold)
+            {
+            resolutionUid = iH264EncoderLowResUid;
+            PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat() AVC, below, resolutions = 0x%x"), resolutionUid))
+            }
+        }
+    else
+        {
+        preferredUid = iMPEG4EncoderUid;
+        fallbackUid = KTRFallbackEncoderUidMPEG4;
+        
+        PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat() MPEG-4, preferred = 0x%x"), preferredUid))
+        PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat() MPEG-4, fallback = 0x%x"), fallbackUid))
+        
+        if (iOutputPictureSize.iWidth <= iMPEG4EncoderLowResThreshold)
+            {
+            resolutionUid = iMPEG4EncoderLowResUid;
+            PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat() MPEG-4, below, resolutions = 0x%x"), resolutionUid))
+            }
+        }
+        
+    if (resolutionUid != 0)
+        {
+        preferredUid = resolutionUid;
+        }
+        
+    PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat() preferred = 0x%x"), preferredUid))        
+                
+    supports = iVideoEncoderClient->SupportsCodec(iOutputMimeType, iOutputShortMimeType, preferredUid, fallbackUid);
+
+    PRINT((_L("CTRTranscoderImp::SupportsOutputVideoFormat(), supports[%d] Out"), supports))
+    return supports;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::LoadCodecUids
+// Loads codec Uids from central repository
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+void CTRTranscoderImp::LoadCodecUids()
+    {
+    PRINT((_L("CTRTranscoderImp::LoadCodecUids(), In")))
+    
+    CRepository* repository = NULL;
+    
+    TRAPD(error, repository = CRepository::NewL(KCRUidTranscoder));
+    
+    if (error != KErrNone)
+        {
+        PRINT((_L("CTRTranscoderImp::LoadCodecUids(), Error: %d, Out"), error))
+        return;
+        }
+    
+    if (repository->Get(KTRH263DecoderUid, iH263DecoderUid) != KErrNone)
+        {
+        iH263DecoderUid = 0;
+        }
+    if (repository->Get(KTRH264DecoderUid, iH264DecoderUid) != KErrNone)
+        {
+        iH264DecoderUid = 0;
+        }
+    if (repository->Get(KTRMPEG4DecoderUid, iMPEG4DecoderUid) != KErrNone)
+        {
+        iMPEG4DecoderUid = 0;
+        }
+        
+    if (repository->Get(KTRH263EncoderUid, iH263EncoderUid) != KErrNone)
+        {
+        iH263EncoderUid = 0;
+        }
+    if (repository->Get(KTRH264EncoderUid, iH264EncoderUid) != KErrNone)
+        {
+        iH264EncoderUid = 0;
+        }
+    if (repository->Get(KTRMPEG4EncoderUid, iMPEG4EncoderUid) != KErrNone)
+        {
+        iMPEG4EncoderUid = 0;
+        }
+        
+    if (repository->Get(KTRH263DecoderLowResUid, iH263DecoderLowResUid) != KErrNone)
+        {
+        iH263DecoderLowResUid = 0;
+        }
+    if (repository->Get(KTRH264DecoderLowResUid, iH264DecoderLowResUid) != KErrNone)
+        {
+        iH264DecoderLowResUid = 0;
+        }
+    if (repository->Get(KTRMPEG4DecoderLowResUid, iMPEG4DecoderLowResUid) != KErrNone)
+        {
+        iMPEG4DecoderLowResUid = 0;
+        }
+        
+    if (repository->Get(KTRH263EncoderLowResUid, iH263EncoderLowResUid) != KErrNone)
+        {
+        iH263EncoderLowResUid = 0;
+        }
+    if (repository->Get(KTRH264EncoderLowResUid, iH264EncoderLowResUid) != KErrNone)
+        {
+        iH264EncoderLowResUid = 0;
+        }
+    if (repository->Get(KTRMPEG4EncoderLowResUid, iMPEG4EncoderLowResUid) != KErrNone)
+        {
+        iMPEG4EncoderLowResUid = 0;
+        }
+        
+    if (repository->Get(KTRH263DecoderLowResThreshold, iH263DecoderLowResThreshold) != KErrNone)
+        {
+        iH263DecoderLowResThreshold = 0;
+        }
+    if (repository->Get(KTRH264DecoderLowResThreshold, iH264DecoderLowResThreshold) != KErrNone)
+        {
+        iH264DecoderLowResThreshold = 0;
+        }
+    if (repository->Get(KTRMPEG4DecoderLowResThreshold, iMPEG4DecoderLowResThreshold) != KErrNone)
+        {
+        iMPEG4DecoderLowResThreshold = 0;
+        }
+        
+    if (repository->Get(KTRH263EncoderLowResThreshold, iH263EncoderLowResThreshold) != KErrNone)
+        {
+        iH263EncoderLowResThreshold = 0;
+        }
+    if (repository->Get(KTRH264EncoderLowResThreshold, iH264EncoderLowResThreshold) != KErrNone)
+        {
+        iH264EncoderLowResThreshold = 0;
+        }
+    if (repository->Get(KTRMPEG4EncoderLowResThreshold, iMPEG4EncoderLowResThreshold) != KErrNone)
+        {
+        iMPEG4EncoderLowResThreshold = 0;
+        } 
+    
+    delete repository;
+    
+    PRINT((_L("CTRTranscoderImp::LoadCodecUids(), Out")))
+    }
+    
+    
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::OpenL
+// Opens the transcoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::OpenL( MCMRMediaSink* aMediaSink, 
+                              CTRTranscoder::TTROperationalMode aMode, 
+                              const TDesC8& aInputMimeType, 
+                              const TDesC8& aOutputMimeType, 
+                              const TTRVideoFormat& aVideoInputFormat, 
+                              const TTRVideoFormat& aVideoOutputFormat, 
+                              TBool aRealTime )
+    {
+    PRINT((_L("CTRTranscoderImp::OpenL(), In, OperationalMode[%d]"), aMode))
+    TBool supports = EFalse;
+
+    if (iState != ETRNone)
+        {
+        PRINT((_L("CTRTranscoderImp::OpenL(), Transcoder is in wrong state")))
+        User::Leave(KErrNotReady);
+        }
+
+    // Set picture size
+    
+    // If decoding then accept all resolutions that are divisible by 16
+    if ( (aMode == EDecoding) &&
+        ((aVideoInputFormat.iSize.iWidth & 0xf) == 0) &&
+        ((aVideoInputFormat.iSize.iHeight & 0xf) == 0) && 
+        ((aVideoOutputFormat.iSize.iWidth & 0xf) == 0) &&
+        ((aVideoOutputFormat.iSize.iHeight & 0xf) == 0) )
+        {
+        iOutputPictureSize = aVideoOutputFormat.iSize;
+        iInputPictureSize = aVideoInputFormat.iSize;
+        }
+    else if ( ( this->IsValid( const_cast<TSize&>(aVideoOutputFormat.iSize) ) ) && 
+         ( this->IsValid( const_cast<TSize&>(aVideoInputFormat.iSize) ) ) )
+        {
+        iOutputPictureSize = aVideoOutputFormat.iSize;
+        iInputPictureSize = aVideoInputFormat.iSize;
+        }
+    else
+        {
+        PRINT((_L("CTRTranscoderImp::OpenL(), picture size is not valid")))
+        User::Leave(KErrNotSupported);
+        }
+        
+    // By default the decoded picture is the same size as the input picture
+    iDecodedPictureSize = iInputPictureSize;
+
+    // Create Scaler
+    if (!iScaler)
+        {
+        PRINT((_L("CTRTranscoderImp::OpenL(), create scaler")))
+        iScaler = CTRScaler::NewL();
+        }
+
+
+    switch(aMode)
+        {
+        case EFullTranscoding:
+            {
+            if ( (aInputMimeType != KNullDesC8) && (aOutputMimeType != KNullDesC8) && (aMediaSink != NULL) )
+                {
+                if ( (aVideoInputFormat.iDataType != CTRTranscoder::ETRDuCodedPicture) && 
+                     (aVideoInputFormat.iDataType != CTRTranscoder::ETRDuVideoSegment) ||
+                     (aVideoOutputFormat.iDataType != CTRTranscoder::ETRDuCodedPicture) &&
+                     (aVideoOutputFormat.iDataType != CTRTranscoder::ETRDuVideoSegment) )
+                    {
+                    PRINT((_L("CTRTranscoderImp::OpenL(), data format is not supported in selected operational mode")))
+                    User::Leave(KErrNotSupported);
+                    }
+
+                // Parse mime type and check / define max parameters for requested codec profile-level. 
+                this->ParseMimeTypeL(aInputMimeType, ETrue);
+                this->ParseMimeTypeL(aOutputMimeType, EFalse);
+
+                if (!iVideoDecoderClient)
+                    {
+                    iVideoDecoderClient = CTRVideoDecoderClient::NewL(*this);
+                    }
+
+                // Check input format
+                supports = this->SupportsInputVideoFormat( iInputShortMimeType.Des() );
+
+                if (!supports)
+                    {
+                    PRINT((_L("CTRTranscoderImp::OpenL(), Input format is not supported by video decoder")))
+                    User::Leave(KErrNotSupported);
+                    }
+
+                if (!iVideoEncoderClient)
+                    {
+                    iVideoEncoderClient = CTRVideoEncoderClient::NewL(*this);
+                    }
+
+                // Check output format
+                supports = this->SupportsOutputVideoFormat( iOutputShortMimeType.Des() );
+
+                if (!supports)
+                    {
+                    PRINT((_L("CTRTranscoderImp::OpenL(), Output format is not supported by video encoder")))
+                    User::Leave(KErrNotSupported);
+                    }
+                }
+            else
+                {
+                // Inform user about wrong argument
+                User::Leave(KErrArgument);
+                }
+
+            // Set codec parameters
+            iVideoDecoderClient->SetCodecParametersL(iInputCodec, iInputCodecLevel, aVideoInputFormat, aVideoOutputFormat);
+            iVideoEncoderClient->SetCodecParametersL(iOutputCodec, iOutputCodecLevel, aVideoInputFormat, aVideoOutputFormat);
+
+            TBool srcWide = iScaler->IsWideAspectRatio(iInputPictureSize);
+            TBool dstWide = iScaler->IsWideAspectRatio(iOutputPictureSize);
+            
+            if (srcWide != dstWide)
+                {
+                // get intermediate size from scaler
+                TSize resolution;
+                TSize bb = TSize(0,0);                                
+                
+                TBool scale = iScaler->GetIntermediateResolution(iInputPictureSize, iOutputPictureSize, 
+                                                                 resolution, bb);
+            
+                if (scale && iVideoDecoderClient->SetDecoderScaling(iInputPictureSize, resolution))
+                    {
+                    
+                    PRINT((_L("CTRTranscoderImp::OpenL(), decoder scaling supported")))
+                    
+                    //iDecodedPictureSize = iOutputPictureSize;
+                    iDecodedPictureSize = resolution;
+                    
+                    // NOTE: What if decoder init. fails, this would have to be reseted!
+                    // Increase the max number of frames in processing since scaling is used
+                    iMaxFramesInProcessing = KTRMaxFramesInProcessingScaling;
+                    }                 
+                }
+            
+            else if (iVideoDecoderClient->SetDecoderScaling(iInputPictureSize, iOutputPictureSize))
+                {
+                // Scaling is supported
+                iDecodedPictureSize = iOutputPictureSize;
+                
+                // Increase the max number of frames in processing since scaling is used
+                iMaxFramesInProcessing = KTRMaxFramesInProcessingScaling;
+                }
+
+            iVideoEncoderClient->SetRealTime(aRealTime);
+
+            break;
+            }
+
+        case EDecoding:
+            {
+            if ( aInputMimeType != KNullDesC8 )
+                {
+                if ( (aVideoInputFormat.iDataType != CTRTranscoder::ETRDuCodedPicture) && 
+                     (aVideoInputFormat.iDataType != CTRTranscoder::ETRDuVideoSegment) ||
+                     (aVideoOutputFormat.iDataType != CTRTranscoder::ETRYuvRawData420) &&
+                     (aVideoOutputFormat.iDataType != CTRTranscoder::ETRYuvRawData422) )
+                    {
+                    PRINT((_L("CTRTranscoderImp::OpenL(), data format is not supported in selected operational mode")))
+                    User::Leave(KErrNotSupported);
+                    }
+
+                // Check mime
+                this->ParseMimeTypeL(aInputMimeType, ETrue);
+
+                if (!iVideoDecoderClient)
+                    {
+                    iVideoDecoderClient = CTRVideoDecoderClient::NewL(*this);
+                    }
+
+                // Check input format
+                supports = this->SupportsInputVideoFormat( iInputShortMimeType.Des() );
+
+                if (!supports)
+                    {
+                    PRINT((_L("CTRTranscoderImp::OpenL(), Input format is not supported by video decoder")))
+                    User::Leave(KErrNotSupported);
+                    }
+                }
+            else
+                {
+                // Inform user about wrong argument
+                User::Leave(KErrArgument);
+                }
+
+            // Set codec information
+            iVideoDecoderClient->SetCodecParametersL(iInputCodec, iInputCodecLevel, aVideoInputFormat, aVideoOutputFormat);
+            
+            // Check if decoder supports scaling
+            if (iVideoDecoderClient->SetDecoderScaling(iInputPictureSize, iOutputPictureSize))
+                {
+                // Scaling is supported
+                iDecodedPictureSize = iOutputPictureSize;
+                }
+
+            break;
+            }
+
+        case EEncoding:
+            {
+            if ( aMediaSink && (aOutputMimeType != KNullDesC8) )
+                {
+                if ( (aVideoInputFormat.iDataType != CTRTranscoder::ETRYuvRawData420) && 
+                     (aVideoInputFormat.iDataType != CTRTranscoder::ETRYuvRawData422) ||
+                     (aVideoOutputFormat.iDataType != CTRTranscoder::ETRDuCodedPicture) &&
+                     (aVideoOutputFormat.iDataType != CTRTranscoder::ETRDuVideoSegment) )
+                    {
+                    PRINT((_L("CTRTranscoderImp::OpenL(), data format is not supported in selected operational mode")))
+                    User::Leave(KErrNotSupported);
+                    }
+
+                // Check mime
+                this->ParseMimeTypeL(aOutputMimeType, EFalse);
+
+                if (!iVideoEncoderClient)
+                    {
+                    iVideoEncoderClient = CTRVideoEncoderClient::NewL(*this);
+                    }
+
+                // Check output format
+                supports = this->SupportsOutputVideoFormat( iOutputShortMimeType.Des() );
+
+                if (!supports)
+                    {
+                    PRINT((_L("CTRTranscoderImp::OpenL(), Output format is not supported by video encoder")))
+                    User::Leave(KErrNotSupported);
+                    }
+                }
+            else
+                {
+                // Inform user about wrong argument
+                User::Leave(KErrArgument);
+                }
+
+            // Set codec parameters
+            iVideoEncoderClient->SetCodecParametersL(iOutputCodec, iOutputCodecLevel, aVideoInputFormat, aVideoOutputFormat);
+
+            break;
+            }
+
+        case EResampling:
+            {
+            if ( (aVideoInputFormat.iDataType != CTRTranscoder::ETRYuvRawData420) ||
+                 (aVideoOutputFormat.iDataType != CTRTranscoder::ETRYuvRawData420) )
+                {
+                PRINT((_L("CTRTranscoderImp::OpenL(), data format is not supported in selected operational mode")))
+                User::Leave(KErrNotSupported);
+                }
+
+            break;
+            }
+            
+        default:
+            {
+            // Given option is not supported
+            User::Leave(KErrNotSupported);
+            }
+        }
+    
+    iMode = aMode;
+    iRealTime = aRealTime;
+    iMediaSink = aMediaSink;
+    iState = ETROpened;
+    
+    if ( (iMode == EFullTranscoding) || (iMode == EEncoding) )
+        {
+        // Get frame rate for initial input coded stream
+        TReal frameRate = 0.0; 
+        iObserver.MtroSetInputFrameRate(frameRate);
+
+        if (frameRate > 0.0)
+            {
+            iVideoEncoderClient->SetInputFrameRate(frameRate);
+            }
+        }
+
+    PRINT((_L("CTRTranscoderImp::OpenL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::SetVideoBitRateL
+// Sets video bitrate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::SetVideoBitRateL(TUint aBitRate)
+    {
+    PRINT((_L("CTRTranscoderImp::SetVideoBitRateL(), In")))
+
+    if ( (iState != ETROpened) && (iState != ETRInitialized) && (iState != ETRRunning) )
+        {
+        PRINT((_L("CTRTranscoderImp::SetVideoBitRateL(), Transcoder is in wrong state")))
+        User::Leave(KErrNotReady);
+        }
+        
+    if (iVideoEncoderClient)
+        {
+        iVideoEncoderClient->SetBitRate(aBitRate);
+        }
+
+    iBitRateSetting = ETrue;
+
+    PRINT((_L("CTRTranscoderImp::SetVideoBitRateL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::SetFrameRateL
+// Sets frame rate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::SetFrameRateL(TReal aFrameRate)
+    {
+    PRINT((_L("CTRTranscoderImp::SetFrameRateL(), In")))
+
+    if ( (iState != ETROpened) && (iState != ETRInitialized) && (iState != ETRRunning) )
+        {
+        PRINT((_L("CTRTranscoderImp::SetFrameRateL(), Transcoder is in wrong state")))
+        User::Leave(KErrNotReady);
+        }
+        
+    if (iVideoEncoderClient)
+        {
+        iVideoEncoderClient->SetFrameRate(aFrameRate);
+        }
+
+    PRINT((_L("CTRTranscoderImp::SetFrameRateL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::SetChannelBitErrorRateL
+// Sets channel bit error rate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::SetChannelBitErrorRateL(TReal aErrorRate)
+    {
+    PRINT((_L("CTRTranscoderImp::SetChannelBitErrorRateL(), In")))
+
+    if ( (iState != ETROpened) && (iState != ETRInitialized) && (iState != ETRRunning) )
+        {
+        PRINT((_L("CTRTranscoderImp::SetChannelBitErrorRateL(), Transcoder is in wrong state")))
+        User::Leave(KErrNotReady);
+        }
+        
+    if (iVideoEncoderClient)
+        {
+        iVideoEncoderClient->SetChannelBitErrorRate(aErrorRate);
+        }
+        
+    PRINT((_L("CTRTranscoderImp::SetChannelBitErrorRateL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::SetVideoCodingOptionsL
+// Sets video coding options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::SetVideoCodingOptionsL(TTRVideoCodingOptions& aOptions)
+    {
+    if (iState != ETROpened)
+        {
+        PRINT((_L("CTRTranscoderImp::SetVideoCodingOptionsL(), Transcoder is in wrong state")))
+        User::Leave(KErrNotReady);
+        }
+
+    if (iVideoEncoderClient)
+        {
+        iVideoEncoderClient->SetVideoCodingOptionsL(aOptions);
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::SetVideoPictureSinkOptionsL
+// Sets picture sing and options for intermediate format
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::SetVideoPictureSinkOptionsL(TSize& aSize, MTRVideoPictureSink* aSink)
+    {
+    if (iState == ETRNone)
+        {
+        PRINT((_L("CTRTranscoderImp::SetVideoPictureSinkOptionsL(), Transcoder is in wrong state")))
+        User::Leave(KErrNotReady);
+        }
+
+    if (aSink)
+        {
+        if ((iMode != EDecoding) && (!this->IsValid(aSize)))
+            {
+            PRINT((_L("CTRTranscoderImp::SetVideoPictureSinkOptionsL(), invalid size")))
+            User::Leave(KErrNotSupported);
+            }
+
+        switch(iMode)
+            {
+            case EFullTranscoding:
+            case EDecoding:
+                {
+                if ( aSize == iOutputPictureSize )
+                    {
+                    iIntermediatePictureSize = aSize;
+                    }
+                else
+                    {
+                    // In full transcoding mode (intermediate picture size = outputTarget size) is supported only
+                    PRINT((_L("CTRTranscoderImp::SetVideoPictureSinkOptionsL(), Intermediate picture size is not supported")))
+                    User::Leave(KErrNotSupported);
+                    }
+                }
+                break;
+
+            case EEncoding:
+                {
+                if ( (aSize == iInputPictureSize) || (aSize == iOutputPictureSize) )
+                    {
+                    iIntermediatePictureSize = aSize;
+                    }
+                else
+                    {
+                    PRINT((_L("CTRTranscoderImp::SetVideoPictureSinkOptionsL(), invalid intermediate size")))
+                    User::Leave(KErrNotSupported);
+                    }
+                }
+                break;
+
+            case EResampling:
+                {
+                // No need to check size, since it's iOutputPictureSize; 
+                iIntermediatePictureSize = iOutputPictureSize;
+                }
+                break;
+
+            case EOperationNone:
+                {
+                // Operation is not set yet
+                User::Leave(KErrNotReady);
+                }
+                break;
+
+            default:
+                {
+                // Operation is not set yet
+                User::Leave(KErrNotReady);
+                break;
+                }
+            }
+
+        // Set picture sink
+        iPictureSink = aSink;
+        iPictureSinkTemp = aSink;
+        iPictureSinkEnabled = ETrue;
+        iPictureSinkClientSetting = ETrue;
+        iCurrentPictureSinkEnabled = ETrue;
+        iCurrentAsyncPictureSinkEnabled = ETrue;
+        }
+    else
+        {
+        User::Leave(KErrArgument);
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::UseDirectScreenAccessL
+// Requests using of DSA
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::UseDirectScreenAccessL(TBool /*aUseDSA*/, CFbsScreenDevice& /*aScreenDevice*/, 
+                                              TTRDisplayOptions& /*aOptions*/)
+    {
+    // Not supported yet
+    User::Leave(KErrNotSupported);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::ParseMimeTypeL
+// Parses given MIME type
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::ParseMimeTypeL(const TDesC8& aMimeType, TBool aInOutMime)
+    {
+    TUint maxBitRate = 0;
+    TInt codecType = 0;
+    TBuf8<256> shortMimeType;
+    TBuf8<256> newMimeType;
+    TInt width = 0;
+    TUint codecLevel = 0;
+
+
+    if (aMimeType == KNullDesC8)
+        {
+        User::Leave(KErrArgument);
+        }
+
+    if ( aMimeType.MatchF( _L8("*video/H263-2000*") ) != KErrNotFound )
+        {
+        // H.263
+        codecType = EH263;
+        shortMimeType = _L8("video/H263-2000");
+        newMimeType = shortMimeType;
+
+        if ( aMimeType.MatchF( _L8("*profile*") ) != KErrNotFound )
+            {
+            // Profile info is given, check it
+            if ( aMimeType.MatchF( _L8("*profile=0*") ) != KErrNotFound )
+                {
+                // Check level info
+                newMimeType += _L8("; profile=0");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile=3*") ) != KErrNotFound )
+                {
+                // Check level info
+                newMimeType += _L8("; profile=3");
+                }
+            else
+                {
+                // We don't support any other profiles yet
+                PRINT((_L("CTRTranscoderImp::ParseMimeTypeL(), profile is not supported")))
+                User::Leave(KErrNotSupported);
+                }
+            }
+        else
+            {
+            // Set defaults for profile=0;
+            newMimeType += _L8("; profile=0");
+            }
+
+
+        // Check level info
+        if ( aMimeType.MatchF( _L8("*level=*") ) != KErrNotFound )
+            {
+            if ( aMimeType.MatchF( _L8("*level=10*") ) != KErrNotFound )
+                {
+                // Set level=10;
+                maxBitRate = KTRMaxBitRateH263Level10;
+                codecLevel = KTRH263CodecLevel10;
+                newMimeType += _L8("; level=10");
+                }
+            else if ( aMimeType.MatchF( _L8("*level=20*") ) != KErrNotFound )
+                {
+                // Set level=20;
+                maxBitRate = KTRMaxBitRateH263Level20;
+                codecLevel = KTRH263CodecLevel20;
+                newMimeType += _L8("; level=20");
+                }
+            else if ( aMimeType.MatchF( _L8("*level=30*") ) != KErrNotFound )
+                {
+                // Set level=30;
+                maxBitRate = KTRMaxBitRateH263Level30;
+                codecLevel = KTRH263CodecLevel30;
+                newMimeType += _L8("; level=30");
+                }
+            else if ( aMimeType.MatchF( _L8("*level=40*") ) != KErrNotFound )
+                {
+                // Set level=40;
+                maxBitRate = KTRMaxBitRateH263Level40;
+                codecLevel = KTRH263CodecLevel40;
+                newMimeType += _L8("; level=40");
+                }
+            else if ( aMimeType.MatchF( _L8("*level=45*") ) != KErrNotFound )
+                {
+                // Set level=45;
+                maxBitRate = KTRMaxBitRateH263Level45;
+                codecLevel = KTRH263CodecLevel45;
+                newMimeType += _L8("; level=45");
+                }
+            else if ( aMimeType.MatchF( _L8("*level=50*") ) != KErrNotFound )
+                {
+                // Set level=50;
+                maxBitRate = KTRMaxBitRateH263Level50;
+                codecLevel = KTRH263CodecLevel50;
+                newMimeType += _L8("; level=50");
+                }
+            else if ( aMimeType.MatchF( _L8("*level=60*") ) != KErrNotFound )
+                {
+                // Set level=60;
+                maxBitRate = KTRMaxBitRateH263Level60;
+                codecLevel = KTRH263CodecLevel60;
+                newMimeType += _L8("; level=60");
+                }
+            else if ( aMimeType.MatchF( _L8("*level=70*") ) != KErrNotFound )
+                {
+                // Set level=70;
+                maxBitRate = KTRMaxBitRateH263Level70;
+                codecLevel = KTRH263CodecLevel70;
+                newMimeType += _L8("; level=70");
+                }
+            else
+                {
+                // We don't support any other levels
+                PRINT((_L("CTRTranscoderImp::ParseMimeTypeL(), level is not supported")))
+                User::Leave(KErrNotSupported);
+                }
+            }
+        else
+            {
+            // Codec level is not specified, check requested picture size and set mime
+            if (aInOutMime)
+                {
+                width = iInputPictureSize.iWidth;
+                }
+            else
+                {
+                width = iOutputPictureSize.iWidth;
+                }
+
+            switch( width )
+                {
+                case KTRSubQCIFWidth:
+                case KTRQCIFWidth:
+                    {
+                    // Set defaults for level=10;
+                    maxBitRate = KTRMaxBitRateH263Level10;
+                    codecLevel = KTRH263CodecLevel10;
+                    newMimeType += _L8("; level=10");
+                    break;
+                    }
+
+                case KTRCIFWidth:
+                    {
+                    // Set defaults for level=30;
+                    maxBitRate = KTRMaxBitRateH263Level30;
+                    codecLevel = KTRH263CodecLevel30;
+                    newMimeType += _L8("; level=30");
+                    break;
+                    }
+
+                case KTRPALWidth:
+                    {
+                    // Set defaults for level=60;
+                    maxBitRate = KTRMaxBitRateH263Level60;
+                    codecLevel = KTRH263CodecLevel60;
+                    newMimeType += _L8("; level=60");
+                    break;
+                    }
+
+                default:
+                    {
+                    // Set defaults for level=10;
+                    maxBitRate = KTRMaxBitRateH263Level10;
+                    codecLevel = KTRH263CodecLevel10;
+                    newMimeType += _L8("; level=10");
+                    break;
+                    }
+                }
+            }
+        }
+    else if ( (aMimeType.MatchF( _L8("*video/H264*") ) != KErrNotFound) )
+        {
+        // H.264 (AVC)
+        codecType = EH264;
+        shortMimeType = _L8("video/H264");
+        newMimeType = shortMimeType;
+        
+        // Check profile-level
+        if ( aMimeType.MatchF( _L8("*profile-level-id=*") ) != KErrNotFound )
+            {
+            if ( aMimeType.MatchF( _L8("*profile-level-id=42800A*") ) != KErrNotFound )
+                {
+                maxBitRate = KTRMaxBitRateH264Level10;
+                codecLevel = KTRH264CodecLevel10;
+                newMimeType += _L8("; profile-level-id=42800A");    // Level 1
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=42900B*") ) != KErrNotFound )
+                {
+                maxBitRate = KTRMaxBitRateH264Level10b;
+                codecLevel = KTRH264CodecLevel10b;
+                newMimeType += _L8("; profile-level-id=42900B");    // Level 1b
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=42800B*") ) != KErrNotFound )
+                {
+                maxBitRate = KTRMaxBitRateH264Level11;
+                codecLevel = KTRH264CodecLevel11;
+                newMimeType += _L8("; profile-level-id=42800B");    // Level 1.1
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=42800C*") ) != KErrNotFound )
+                {
+                maxBitRate = KTRMaxBitRateH264Level12;
+                codecLevel = KTRH264CodecLevel12;
+                newMimeType += _L8("; profile-level-id=42800C");    // Level 1.2
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=42800D*") ) != KErrNotFound )
+                {
+                maxBitRate = KTRMaxBitRateH264Level13;
+                codecLevel = KTRH264CodecLevel13;
+                newMimeType += _L8("; profile-level-id=42800D");    // Level 1.3
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=428014*") ) != KErrNotFound )
+                {
+                maxBitRate = KTRMaxBitRateH264Level20;
+                codecLevel = KTRH264CodecLevel20;
+                newMimeType += _L8("; profile-level-id=428014");    // Level 2
+                }
+            //WVGA task
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=428015*") ) != KErrNotFound )
+                {
+                maxBitRate = KTRMaxBitRateH264Level21;
+                codecLevel = KTRH264CodecLevel21;
+                newMimeType += _L8("; profile-level-id=428015");    // Level 2.1
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=428016*") ) != KErrNotFound )
+                {
+                maxBitRate = KTRMaxBitRateH264Level22;
+                codecLevel = KTRH264CodecLevel22;
+                newMimeType += _L8("; profile-level-id=428016");    // Level 2.2
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=42801E*") ) != KErrNotFound )
+                {
+                maxBitRate = KTRMaxBitRateH264Level30;
+                codecLevel = KTRH264CodecLevel30;
+                newMimeType += _L8("; profile-level-id=42801E");    // Level 3
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=42801F*") ) != KErrNotFound )
+                {
+                maxBitRate = KTRMaxBitRateH264Level31;
+                codecLevel = KTRH264CodecLevel31;
+                newMimeType += _L8("; profile-level-id=42801F");    // Level 3.1
+                }
+            else
+                {
+                // We don't support any other levels
+                PRINT((_L("CTRTranscoderImp::ParseMimeTypeL(), profile-level-id is not supported")))
+                User::Leave(KErrNotSupported);
+                }
+            }
+        else
+            {
+            // profile-level-id is not specified, check requested picture size
+            if (aInOutMime)
+                {
+                width = iInputPictureSize.iWidth;
+                }
+            else
+                {
+                width = iOutputPictureSize.iWidth;
+                }
+                
+            switch( width )
+                {
+                case KTRSubQCIFWidth:
+                case KTRQCIFWidth:
+                    {
+                    // Set level 1
+                    maxBitRate = KTRMaxBitRateH264Level10;
+                    codecLevel = KTRH264CodecLevel10;
+                    newMimeType += _L8("; profile-level-id=42800A");
+                    break;
+                    }
+
+                case KTRQVGAWidth:
+                case KTRCIFWidth:
+                    {
+                    // Set level 1.2
+                    maxBitRate = KTRMaxBitRateH264Level12;
+                    codecLevel = KTRH264CodecLevel12;
+                    newMimeType += _L8("; profile-level-id=42800C");
+                    break;
+                    }
+                case KTRWVGAWidth:
+                    {
+                    // Set level 3.1
+                    maxBitRate = KTRMaxBitRateH264Level31;
+                    codecLevel = KTRH264CodecLevel31;
+                    newMimeType += _L8("; profile-level-id=42801F");
+                    break;
+                    }
+
+                default:
+                    {
+                    // Set level 1
+                    maxBitRate = KTRMaxBitRateH264Level10;
+                    codecLevel = KTRH264CodecLevel10;
+                    newMimeType += _L8("; profile-level-id=42800A");
+                    break;
+                    }
+                }
+            } 
+        }
+    else if ( (aMimeType.MatchF( _L8("*video/mp4v-es*") ) != KErrNotFound) || 
+              (aMimeType.MatchF( _L8("*video/MP4V-ES*") ) != KErrNotFound) )
+        {
+        // MPEG-4 Visual
+        codecType = EMpeg4;
+        shortMimeType = _L8("video/mp4v-es");   // Set short mime
+        newMimeType = shortMimeType;
+
+        // Check profile-level
+        if ( aMimeType.MatchF( _L8("*profile-level-id=*") ) != KErrNotFound )
+            {
+            if ( aMimeType.MatchF( _L8("*profile-level-id=8*") ) != KErrNotFound )
+                {
+                // Set defaults for profile-level-id=8
+                newMimeType += _L8("; profile-level-id=8");
+                }
+            else if( aMimeType.MatchF( _L8("*profile-level-id=1*") ) != KErrNotFound )
+                {
+                // Set profile-level-id=1
+                maxBitRate = KTRMaxBitRateMPEG4Level1;
+                codecLevel = KTRMPEG4CodecLevel1;
+                newMimeType += _L8("; profile-level-id=1");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=2*") ) != KErrNotFound )
+                {
+                // Set profile-level-id=2
+                maxBitRate = KTRMaxBitRateMPEG4Level2;
+                codecLevel = KTRMPEG4CodecLevel2;
+                newMimeType += _L8("; profile-level-id=2");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=3*") ) != KErrNotFound )
+                {
+                // Set profile-level-id=3
+                maxBitRate = KTRMaxBitRateMPEG4Level3;
+                codecLevel = KTRMPEG4CodecLevel3;
+                newMimeType += _L8("; profile-level-id=3");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=9*") ) != KErrNotFound )
+                {
+                // Set profile-level-id=9
+                maxBitRate = KTRMaxBitRateMPEG4Level0b;
+                codecLevel = KTRMPEG4CodecLevel0b;
+                newMimeType += _L8("; profile-level-id=9");
+                }
+            else if ( aMimeType.MatchF( _L8("*profile-level-id=4*") ) != KErrNotFound )
+                {
+                // Set profile-level-id=4
+                maxBitRate = KTRMaxBitRateMPEG4Level4a;
+                codecLevel = KTRMPEG4CodecLevel4a;
+                newMimeType += _L8("; profile-level-id=4");
+                }
+            else
+                {
+                // We don't support any other levels
+                PRINT((_L("CTRTranscoderImp::ParseMimeTypeL(), profile-level-id is not supported")))
+                User::Leave(KErrNotSupported);
+                }
+            }
+        else
+            {
+            // profile-level-id is not specified, check requested picture size
+            // Set defaults for profile-level-id=8
+            if (aInOutMime)
+                {
+                width = iInputPictureSize.iWidth;
+                }
+            else
+                {
+                width = iOutputPictureSize.iWidth;
+                }
+
+            switch( width )
+                {
+                case KTRSubQCIFWidth:
+                case KTRQCIFWidth:
+                    {
+                    // Set profile-level-id=0
+                    codecLevel = KTRMPEG4CodecLevel0;
+                    maxBitRate = KTRMaxBitRateMPEG4Level0;
+                    newMimeType += _L8("; profile-level-id=8");
+                    break;
+                    }
+
+                case KTRQVGAWidth:
+                case KTRCIFWidth:
+                    {
+                    // Set profile-level-id=3
+                    maxBitRate = KTRMaxBitRateMPEG4Level3;
+                    codecLevel = KTRMPEG4CodecLevel3;
+                    newMimeType += _L8("; profile-level-id=3");
+                    break;
+                    }
+                    
+                case KTRVGAWidth:
+                    {
+                    // Set profile-level-id=4 (4a)
+                    maxBitRate = KTRMaxBitRateMPEG4Level4a;
+                    codecLevel = KTRMPEG4CodecLevel4a;
+                    newMimeType += _L8("; profile-level-id=4");
+                    break;
+                    }
+
+                default:
+                    {
+                    // Set profile-level-id=0
+                    maxBitRate = KTRMaxBitRateMPEG4Level0;
+                    codecLevel = KTRMPEG4CodecLevel0;
+                    newMimeType += _L8("; profile-level-id=8");
+                    break;
+                    }
+                }
+            }
+        }
+    else
+        {
+        PRINT((_L("CTRTranscoderImp::ParseMimeL(), there is curently no support for this type")))
+        User::Leave(KErrNotSupported);
+        }
+
+    if (aInOutMime)
+        {
+        // Mime type was set for Input format
+        iInputCodecLevel = codecLevel;
+        iInputCodec = codecType;
+        iInputMaxBitRate = maxBitRate;
+        
+        iInputMimeType = newMimeType;
+        iInputShortMimeType = shortMimeType;
+        }
+    else
+        {
+        // Mime type was set for Output format
+        iOutputCodecLevel = codecLevel;
+        iOutputCodec = codecType;
+        iOutputMaxBitRate = maxBitRate;
+        
+        iOutputMimeType = newMimeType;
+        iOutputShortMimeType = shortMimeType;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::IsValid
+// Checks whether the size is valid
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CTRTranscoderImp::IsValid(TSize& aSize)
+    {
+    TBool valid = EFalse;
+
+    switch(aSize.iWidth)
+        {
+        case KTRSubQCIFWidth:
+            {
+            if (aSize.iHeight == KTRSubQCIFHeight)
+                {
+                valid = ETrue;
+                }
+            break;
+            }
+            
+        case KTRQCIFWidth:
+            {
+            if (aSize.iHeight == KTRQCIFHeight)
+                {
+                valid = ETrue;
+                }
+            break;
+            }
+            
+        case KTRCIFWidth:
+            {
+            if (aSize.iHeight == KTRCIFHeight)
+                {
+                valid = ETrue;
+                }
+            break;
+            }
+            
+        case KTRQVGAWidth:
+            {
+            if (aSize.iHeight == KTRQVGAHeight)
+                {
+                valid = ETrue;
+                }
+            break;
+            }
+            
+        case KTRVGAWidth:
+            {
+            if (aSize.iHeight == KTRVGAHeight || aSize.iHeight == KTRVGA16By9Height)
+                {
+                valid = ETrue;
+                }
+            break;
+            }
+        case KTRWVGAWidth:
+            {
+            if (aSize.iHeight == KTRWVGAHeight)
+                {
+                valid = ETrue;
+                }
+            break;
+            }
+            
+        case KTR4CIFWidth:
+            {
+            if (aSize.iHeight == KTR4CIFHeight)
+                {
+                valid = ETrue;
+                }
+            break;
+            }
+            
+        case KTRPALWidth:
+            {
+            if ( (aSize.iHeight == KTRPAL2Height) || (aSize.iHeight == KTRPAL1Height) )
+                {
+                valid = ETrue;
+                }
+            break;
+            }
+        
+        default:
+            {
+            valid = EFalse;
+            }
+        }
+
+    return valid;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::GetVideoBitRateL
+// Gets video bitrate 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint CTRTranscoderImp::GetVideoBitRateL()
+    {
+    if (iVideoEncoderClient)
+        {
+        return iVideoEncoderClient->GetVideoBitRateL();
+        }
+    
+    // Otherwise return 0, in case if it's called before initializing or in different operating mode
+    // e.g. (without encoding)
+    return 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::GetFrameRateL
+// Gets frame rate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TReal CTRTranscoderImp::GetFrameRateL()
+    {
+    if (iVideoEncoderClient)
+        {
+        return iVideoEncoderClient->GetFrameRateL();
+        }
+
+    // Otherwise return 0, in case if it's called before initializing or in different operating mode
+    // e.g. (without encoding)
+    return 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::GetVideoCodecL
+// Gets current video codec in use
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::GetVideoCodecL(TDes8& aVideoMimeType)
+    {
+    if (iState == ETRNone)
+        {
+        aVideoMimeType = KNullDesC8;
+        }
+    else
+        {
+        aVideoMimeType = iOutputShortMimeType;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::GetTranscodedPictureSizeL
+// Gets output transcoded picture size
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::GetTranscodedPictureSizeL(TSize& aSize)
+    {
+    aSize = iOutputPictureSize;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::InitializeL
+// Initializes transcider
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::InitializeL()
+    {
+    PRINT((_L("CTRTranscoderImp::InitializeL(), In")))
+    TInt status = KErrNone;
+
+
+    if (iState != ETROpened)
+        {
+        PRINT((_L("CTRTranscoderImp::InitializeL(), Transcoder is in wrong state")))
+        User::Leave(KErrNotReady);
+        }
+
+    switch(iMode)
+        {
+        case EFullTranscoding:
+            {
+            iVideoDecoderClient->InitializeL();
+            
+            // Check encoder client if it supports optimized data transfer
+            TRAP( status, iVideoEncoderClient->UseDataTransferOptimizationL() );
+            if (status == KErrNone)
+                {
+                iOptimizedDataTransfer = ETrue;
+                }
+
+            TRAP(status, iVideoEncoderClient->InitializeL());
+
+            if (status != KErrNone)
+                {
+                iEncoderInitStatus = status;
+                InitComplete();
+                }
+
+            break;
+            }
+
+        case EDecoding:
+            {
+            iEncoderInitStatus = KErrNone;
+            iVideoDecoderClient->InitializeL();
+            break;
+            }
+
+        case EEncoding:
+            {
+            iDecoderInitStatus = KErrNone;
+            iVideoEncoderClient->InitializeL();
+            break;
+            }
+
+        case EResampling:
+            {
+            // Resampler is already created
+            iState = ETRInitialized;
+            iObserver.MtroInitializeComplete(KErrNone);
+            return;
+            }
+
+        default:
+            {
+            // Transcoder is not ready to be initialized
+            User::Leave(KErrNotReady);
+            break;
+            }
+        }
+    
+    PRINT((_L("CTRTranscoderImp::InitializeL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::MtrdvcoEncInitializeComplete
+// Encoder initializing is completed with aError
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::MtrdvcoEncInitializeComplete(TInt aError)
+    {
+    PRINT((_L("CTRTranscoderImp::MtrdvcoEncInitializeComplete(), status[%d]"), aError))
+    
+    if (aError == KErrHardwareNotAvailable)
+        {
+        // Encoder needs to be reinitialized
+        
+        // Check if encoder client supports optimized data transfer
+        iOptimizedDataTransfer = EFalse;
+        TRAPD( status, iVideoEncoderClient->UseDataTransferOptimizationL() );
+        if (status == KErrNone)
+            {
+            iOptimizedDataTransfer = ETrue;
+            }
+
+        PRINT((_L("CTRTranscoderImp::MtrdvcoEncInitializeComplete(), Trying to reinitialize encoder")))
+        TRAP(status, iVideoEncoderClient->InitializeL());
+
+        if (status == KErrNone)
+            {
+            // Reinitialization done so wait for the next initialize complete call
+            return;
+            }
+        }
+    
+    iEncoderInitStatus = aError;
+    this->InitComplete();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::MtrdvcoDecInitializeComplete
+// Decoder initializing is completed with aError
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::MtrdvcoDecInitializeComplete(TInt aError)
+    {
+    PRINT((_L("CTRTranscoderImp::MtrdvcoDecInitializeComplete(), status[%d]"), aError))
+    
+    if (aError == KErrHardwareNotAvailable)
+        {
+        // Decoder needs to be reinitialized
+        
+        // Check if decoder supports scaling
+        iDecodedPictureSize = iInputPictureSize;
+        
+        // Set to default
+        iMaxFramesInProcessing = KTRMaxFramesInProcessingDefault;
+                
+        TBool srcWide = iScaler->IsWideAspectRatio(iInputPictureSize);
+        TBool dstWide = iScaler->IsWideAspectRatio(iOutputPictureSize);
+            
+        if (srcWide != dstWide)
+            {
+            
+            PRINT((_L("CTRTranscoderImp::MtrdvcoDecInitializeComplete(), black boxing needed")))
+            
+            // get intermediate resolution from scaler
+            TSize resolution;
+            TSize bb = TSize(0,0);                                
+            
+            TBool scale = iScaler->GetIntermediateResolution(iInputPictureSize, iOutputPictureSize, 
+                                                             resolution, bb);
+                                                             
+            PRINT((_L("CTRTranscoderImp::MtrdvcoDecInitializeComplete(), int. resolution (%d, %d), scale = %d"),
+                resolution.iWidth, resolution.iHeight, TInt(scale)))
+        
+            if (scale && iVideoDecoderClient->SetDecoderScaling(iInputPictureSize, resolution))
+                {
+                
+                PRINT((_L("CTRTranscoderImp::MtrdvcoDecInitializeComplete(), decoder scaling supported")))
+                
+                iDecodedPictureSize = resolution;
+                //iDecodedPictureSize = iOutputPictureSize;
+                
+                iMaxFramesInProcessing = KTRMaxFramesInProcessingScaling;
+                }
+            }
+        
+        else if (iVideoDecoderClient->SetDecoderScaling(iInputPictureSize, iOutputPictureSize))
+            {
+            // Scaling is supported
+            iDecodedPictureSize = iOutputPictureSize;
+            
+            iMaxFramesInProcessing = KTRMaxFramesInProcessingScaling;
+            }
+
+        PRINT((_L("CTRTranscoderImp::MtrdvcoDecInitializeComplete(), Trying to reinitialize decoder")))
+        TRAPD(status, iVideoDecoderClient->InitializeL());
+
+        if (status == KErrNone)
+            {
+            // Reinitialization done so wait for the next initialize complete call
+            return;
+            }
+        }
+    
+    iDecoderInitStatus = aError;
+    this->InitComplete();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::InitComplete
+// Checks and reports init status to the client
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::InitComplete()
+    {
+    TInt status = KErrNone;
+    
+    if ( (iEncoderInitStatus != KTRErrNotReady) && (iDecoderInitStatus != KTRErrNotReady) )
+        {
+        // Both were initialized, check statuses
+        if ( (iEncoderInitStatus == KErrNone) && (iDecoderInitStatus == KErrNone) )
+            {            
+            // Both are ok, 
+            // Allocate buffers for intrnal use
+            TRAP( status, this->AllocateBuffersL() );
+
+            if (status == KErrNone)
+                {
+                iState = ETRInitialized;
+                }
+                
+            // Inform the client
+            iObserver.MtroInitializeComplete(status);
+            }
+        else if (iDecoderInitStatus == KErrNone)
+            {
+            // Report encoder init error
+            iObserver.MtroInitializeComplete(iEncoderInitStatus);
+            }
+        else
+            {
+            // Report decoder init error
+            iObserver.MtroInitializeComplete(iDecoderInitStatus);
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::StartL
+// Starts data processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::StartL()
+    {
+    if ( (iState == ETRInitialized) || (iState == ETRStopped) )
+        {
+        switch(iMode)
+            {
+            case EFullTranscoding:
+                {
+                // Reset flag here
+                iAsyncStop = EFalse;
+
+                iVideoDecoderClient->StartL();
+
+                if (!iBitRateSetting)
+                    {
+                    this->SetVideoBitRateL(iOutputMaxBitRate);
+                    }
+
+                iVideoEncoderClient->StartL();
+                }
+                break;
+                
+            case EDecoding:
+                {
+                iVideoDecoderClient->StartL();
+                }
+                break;
+                
+            case EEncoding:
+                {
+                if (!iBitRateSetting)
+                    {
+                    this->SetVideoBitRateL(iOutputMaxBitRate);
+                    }
+
+                iVideoEncoderClient->StartL();
+                }
+                break;
+                
+            case EResampling:
+                {
+                // Nothing to do
+                }
+                break;
+            
+            default:
+                {
+                // Should never be reached
+                TRASSERT(0);
+                }
+            }
+            
+        iState = ETRRunning;
+        }
+    else
+        {
+        PRINT((_L("CTRTranscoderImp::StartL(), called in wrong state")))
+        User::Leave(KErrNotReady);
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::AllocateBuffersL
+// Allocates internal buffers
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::AllocateBuffersL()
+    {
+    PRINT((_L("CTRTranscoderImp::AllocateBuffersL(), In")))
+    TInt i = 0;
+    TUint dataBufferSize = 0;
+    
+    
+    // Assume we are using 420 as a middle temporal format
+    dataBufferSize = iOutputPictureSize.iWidth * iOutputPictureSize.iHeight * 3 / 2;
+    PRINT((_L("CTRTranscoderImp::AllocateBuffersL(), data buffer size[%d]"), dataBufferSize))
+    
+    // Allocate TVideoPicture containers
+    iVideoPictureArray = new (ELeave) TVideoPicture[ KTRPictureBuffersNumber ];
+    
+    for (i = 0; i < KTRPictureBuffersNumber; i ++)
+        {
+        // Reset iRawData ptr
+        iVideoPictureArray[i].iData.iRawData = NULL;
+        }
+
+    switch (iMode)
+        {
+        case EFullTranscoding:
+            {
+            // Allocate TTRVideoPicture containers (since the client requested to provide 
+            // intermediate trancsoded content )
+            iTRVideoPictureArray = new (ELeave)TTRVideoPicture[KTRPictureContainersNumber];
+                
+            // Add TR picture containers to the queue
+            for (i = 0; i < KTRPictureContainersNumber; i ++)
+                {
+                iTranscoderTRPictureQueue.AddLast( iTRVideoPictureArray[i] );
+                }
+                
+            if (iOptimizedDataTransfer)
+                {
+                // If optimized data transfer is used, no other allocations required. 
+                return;
+                }
+            }
+            break;
+            
+        case EDecoding:
+            {
+            if ( iDecodedPictureSize == iOutputPictureSize )
+                {
+                // Resampling and data allocation is not required
+                return;
+                }
+            }
+            break;
+            
+        case EEncoding:
+            {
+            if ( iInputPictureSize == iOutputPictureSize )
+                {
+                // Allocation data buffers for iVideoPictureArray is not needed, TVideoPicture 
+                // containers are enough in this case. Initialize the queue
+                for (i = 0; i < KTRPictureBuffersNumber; i ++)
+                    {
+                    iTranscoderPictureQueue.AddLast( iVideoPictureArray[i] );
+                    }
+
+                return;
+                }
+            }           
+            break;
+
+        case EResampling:
+            {
+            // Nothing to do
+            return;
+            }
+            
+        default:
+            {
+            PRINT((_L("CTRTranscoderImp::AllocateBuffersL(), Not ready, mode[%d]"), iMode))
+            User::Leave(KErrNotReady);
+            }
+            break;
+        }
+
+        // Common part
+        // Allocate data buffers
+        iDataArray = new (ELeave) TUint8*[ KTRPictureBuffersNumber ];
+            
+        for ( i = 0; i < KTRPictureBuffersNumber; i ++ )
+            {
+            iDataArray[i] = NULL;
+            }
+            
+        for ( i = 0; i < KTRPictureBuffersNumber; i ++ )
+            {
+            iDataArray[i] = new (ELeave) TUint8[dataBufferSize];
+            PRINT((_L("CTRTranscoderImp::AllocateBuffersL(), data buffer[%d], [0x%x], allocated"), i, iDataArray[i]))
+            }
+                
+        // Initialize the queue         
+        for ( i = 0; i < KTRPictureBuffersNumber; i ++ )
+            {
+            iVideoPictureArray[i].iData.iRawData = new (ELeave) TPtr8(0, 0, 0);
+            iVideoPictureArray[i].iData.iRawData->Set(iDataArray[i], dataBufferSize, dataBufferSize);
+            iVideoPictureArray[i].iData.iDataSize.SetSize(iOutputPictureSize.iWidth, 
+                                                          iOutputPictureSize.iHeight);
+            iTranscoderPictureQueue.AddLast( iVideoPictureArray[i] );
+            PRINT((_L("CTRTranscoderImp::AllocateBuffersL(), picture[%d], added to the queue"), i))
+            PRINT((_L("CTRTranscoderImp::AllocateBuffersL(), picture data[0x%x]"), 
+            iVideoPictureArray[i].iData.iRawData->Ptr() ))
+            }
+    
+    PRINT((_L("CTRTranscoderImp::AllocateBuffersL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::WriteCodedBufferL
+// Writes coded buffer to transcoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::WriteCodedBufferL(CCMRMediaBuffer* aBuffer)
+    {
+    PRINT((_L("CTRTranscoderImp::WriteCodedBufferL(), In")))
+    CTREventItem* newEvent = NULL;
+    
+    if (!aBuffer)
+        {
+        PRINT((_L("CTRTranscoderImp::WriteCodedBufferL(), Client sends invalid data")))
+        User::Leave(KErrArgument);
+        }
+        
+    if (iState == ETRRunning)
+        {
+        if (iSetRandomAccessPoint)
+            {
+            // Get new item from the eventsrc
+            if (!iTranscoderEventSrc.IsEmpty())
+                {
+                newEvent = iTranscoderEventSrc.First();
+                newEvent->iLink.Deque();
+                }
+            else
+                {
+                PRINT((_L("CTRTranscoderImp::WriteCodedBufferL(), iTranscoderEventSrc queue is empty, abort")))
+                iObserver.MtroFatalError(KErrAbort);
+                return;
+                }
+                
+            if (newEvent)
+                {
+                newEvent->iTimestamp = aBuffer->TimeStamp();
+                newEvent->iRandomAccessStatus = ETrue;
+                PRINT((_L("CTRTranscoderImp::WriteCodedBufferL(), picture[%f] RandomAccess"), I64REAL(aBuffer->TimeStamp().Int64()) ))
+                }
+            
+            iSetRandomAccessPoint = EFalse;
+            }
+        
+        if (iPictureSinkSettingChanged)
+            {
+            if (!newEvent)
+                {
+                // Get new item from the event src queue
+                if (!iTranscoderEventSrc.IsEmpty())
+                    {
+                    newEvent = iTranscoderEventSrc.First();
+                    newEvent->iLink.Deque();
+                    }
+                else
+                    {
+                    PRINT((_L("CTRTranscoderImp::WriteCodedBufferL(), iTranscoderEventSrc queue is empty, abort")))
+                    iObserver.MtroFatalError(KErrAbort);
+                    return;
+                    }
+                }
+                
+            if (newEvent)
+                {
+                newEvent->iTimestamp = aBuffer->TimeStamp();
+                newEvent->iEnablePictureSinkStatus = ETrue;
+                newEvent->iEnablePictureSinkClientSetting = iPictureSinkClientSetting;
+                PRINT((_L("CTRTranscoderImp::WriteCodedBufferL(), picture[%f] PS[%d]"), I64REAL(aBuffer->TimeStamp().Int64()), iPictureSinkClientSetting ))
+                }
+
+            // Reset change flag
+            iPictureSinkSettingChanged = EFalse;
+            }
+        
+        // encoder enabled / disabled
+        if (iEncoderEnabledSettingChanged)
+            {
+            if (!newEvent)
+                {
+                // Get new item from the eventsrc
+                if (!iTranscoderEventSrc.IsEmpty())
+                    {
+                    newEvent = iTranscoderEventSrc.First();
+                    newEvent->iLink.Deque();
+                    }
+                else
+                    {
+                    PRINT((_L("CTRTranscoderImp::WriteCodedBufferL(), iTranscoderEventSrc queue is empty, abort")))
+                    iObserver.MtroFatalError(KErrAbort);
+                    return;
+                    }
+                }
+                
+            if (newEvent)
+                {
+                newEvent->iTimestamp = aBuffer->TimeStamp();
+                newEvent->iEnableEncoderStatus = ETrue;
+                newEvent->iEnableEncoderClientSetting = iEncoderEnableClientSetting;
+                PRINT((_L("CTRTranscoderImp::WriteCodedBufferL(), picture[%f] Enc[%d]"), I64REAL(aBuffer->TimeStamp().Int64()), iEncoderEnableClientSetting ))
+                }
+
+            // Reset change flag
+            iEncoderEnabledSettingChanged = EFalse;
+            }
+            
+        if (newEvent)
+            {
+            // Put it to transcoder event queue
+            iTranscoderEventQueue.AddLast(*newEvent);
+            }
+            
+        // Write buffer to DecoderClient
+        iVideoDecoderClient->WriteCodedBufferL(aBuffer);
+        }
+    else
+        {
+        PRINT((_L("CTRTranscoderImp::WriteCodedBufferL(), wrong state")))
+        User::Leave(KErrNotReady);
+        }
+
+    PRINT((_L("CTRTranscoderImp::WriteCodedBufferL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::MtroReturnCodedBuffer
+// Returns coded buffer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::MtrdvcoReturnCodedBuffer(CCMRMediaBuffer* aBuffer)
+    {
+    iObserver.MtroReturnCodedBuffer(aBuffer);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::MtrdvcoNewPicture
+// New decoded picture is available
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::MtrdvcoNewPicture(TVideoPicture* aDecodedPicture)
+    {
+    TInt status = KErrNone;
+    TVideoPicture* picture = NULL;
+    CTREventItem* nextEvent = NULL;
+    MTRVideoPictureSink* pictureSink = iPictureSinkTemp; // 
+    TBool pictureSinkEnabled = iCurrentPictureSinkEnabled;
+    TBool encoderEnabled = iCurrentEncoderEnabled;
+    
+    if (iState == ETRFatalError)
+        {
+        // Nothing to do
+        return;
+        }
+        
+    if (!aDecodedPicture)
+        {
+        PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), decoded picture is not valid")))
+        iObserver.MtroFatalError(KErrAlreadyExists);
+        return;
+        }
+    else if (!aDecodedPicture->iData.iRawData)
+        {
+        PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), picture raw data is not valid")))
+        iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+        iObserver.MtroFatalError(KErrAlreadyExists);
+        return;
+        }
+        
+    PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), decoded picture timestamp [%f]"), I64REAL(aDecodedPicture->iTimestamp.Int64()) ))
+
+    switch(iMode)
+        {
+        case EFullTranscoding:
+            {
+            if ( !iNewEvent && !iTranscoderEventQueue.IsEmpty() )
+                {
+                // Get new event
+                iNewEvent = iTranscoderEventQueue.First();
+                iNewEvent->iLink.Deque();
+                
+                // Check the next event if there are any
+                if (!iTranscoderEventQueue.IsEmpty())
+                    {
+                    nextEvent = iTranscoderEventQueue.First();
+                    
+                    if (aDecodedPicture->iTimestamp >= nextEvent->iTimestamp)
+                        {
+                        // Should not happen normally, indicate an error
+                        PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), Previous event was not handled properly, abort data processing")))
+                        iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                        iObserver.MtroFatalError(KErrAlreadyExists);
+                        return;
+                        }
+                    }
+                }
+                
+            if (iNewEvent)
+                {
+                // Check timestamp for this event
+                if (aDecodedPicture->iTimestamp >= iNewEvent->iTimestamp)
+                    {
+                    // Perform requested client's operation
+                    // 1. PictureSinkStatus
+                    if (iNewEvent->iEnablePictureSinkStatus)
+                        {
+                        pictureSinkEnabled = iNewEvent->iEnablePictureSinkClientSetting;
+                        }
+
+                    // 2. EnableEncoderStatus
+                    if (iNewEvent->iEnableEncoderStatus)
+                        {
+                        encoderEnabled = iNewEvent->iEnableEncoderClientSetting;
+                        }
+                    
+                    // 3. Random access
+                    if (iNewEvent->iRandomAccessStatus)
+                        {
+                        iCurrentRandomAccess = iNewEvent->iRandomAccessStatus;
+                        }
+
+                    // This event is already handled, it's not new anymore
+                    if (!pictureSinkEnabled && !encoderEnabled)
+                        {
+                        // Picture is returned to decoder, we don't need any actions for that
+                        iNewEvent->Reset();
+                        iTranscoderEventSrc.AddLast(*iNewEvent);
+                        }
+                    else if (pictureSinkEnabled)
+                        {
+                        if (iIntermediatePictureSize == iDecodedPictureSize)
+                            {
+                            // Picture is sent to the client first, decoded picture is not returned 
+                            // to decoder until it's hold by the client. 
+                            // No new events are handled here, act according global settings. 
+                            iNewEvent->Reset();
+                            iTranscoderEventSrc.AddLast(*iNewEvent);
+                            }
+                        else
+                            {
+                            // Picture is processed acynchronously first
+                            iTranscoderAsyncEventQueue.AddLast(*iNewEvent);
+                            
+                            // Keep previous current global setting
+                            iCurrentAsyncPictureSinkEnabled = iCurrentPictureSinkEnabled;
+                            iCurrentAsyncEncoderEnabled = iCurrentEncoderEnabled;
+                            }
+                        }
+                    else // encoderEnabled otherwise
+                        {
+                        // Picture is processed acynchronously first
+                        iTranscoderAsyncEventQueue.AddLast(*iNewEvent);
+
+                        // Keep previous current global setting
+                        iCurrentAsyncPictureSinkEnabled = iCurrentPictureSinkEnabled;
+                        iCurrentAsyncEncoderEnabled = iCurrentEncoderEnabled;
+                        }
+                    
+                    // Reset new event
+                    iNewEvent = NULL;
+
+                    // Update current settings
+                    iCurrentPictureSinkEnabled = pictureSinkEnabled;
+                    iCurrentEncoderEnabled = encoderEnabled;
+                    }
+                }
+
+            // Settings now defined, act accordingly
+            if (!pictureSinkEnabled && !encoderEnabled)
+                {
+                // Nothing to do with this picture, return it to decoder
+                PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), return picture[%f] to decoder"), I64REAL(aDecodedPicture->iTimestamp.Int64()) ))
+                iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                return;
+                }
+                
+            if (pictureSinkEnabled)
+                {
+                pictureSink = iPictureSinkTemp;
+                
+                if (!pictureSink)
+                    {
+                    PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), picture sink was not set, report to client!")))
+                    iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                    iObserver.MtroFatalError(KErrNotReady);
+                    return; 
+                    }
+                }
+            else
+                {
+                pictureSink = NULL;
+                }
+                
+            PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), PS[%d], Enc[%d], RandAcc[%d] for [%f]"), pictureSinkEnabled, encoderEnabled, iCurrentRandomAccess, I64REAL(aDecodedPicture->iTimestamp.Int64()) ))
+
+            if ( pictureSink && (iIntermediatePictureSize == iDecodedPictureSize) )
+                {
+                // Since the client requested to provide initial decoded picture, send
+                // it first, and only then resample and encode. (See SendPictureToTranscoder)
+                if (!iTranscoderTRPictureQueue.IsEmpty())
+                    {
+                    TTRVideoPicture* pictureToClient = iTranscoderTRPictureQueue.First();
+                    pictureToClient->iLink.Deque();
+                    pictureToClient->iRawData = aDecodedPicture->iData.iRawData;
+                    pictureToClient->iDataSize = aDecodedPicture->iData.iDataSize;
+                    pictureToClient->iTimestamp = aDecodedPicture->iTimestamp;
+                    
+                    // Store picture until it's returned from the client
+                    iDecodedPicture = aDecodedPicture;
+                                
+                    // Deliver picture to the client
+                    PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), send picture to the client via sink")))
+                    pictureSink->MtroPictureFromTranscoder(pictureToClient);
+                    }
+                else
+                    {
+                    PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), iTranscoderTRPictureQueue is empty, abort operation")))
+                    iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                    iObserver.MtroFatalError(KErrAbort);
+                    }
+                    
+                return;
+                }
+
+            if (iOptimizedDataTransfer)
+                {
+                // We need a new picture buffer every time !!!
+                if ( !iCIPictureBuffersQueue.IsEmpty() )
+                    {
+                    picture = iCIPictureBuffersQueue.First();
+                    picture->iLink.Deque();
+                    }
+                else
+                    {
+                    TRAP( status, picture = iVideoEncoderClient->GetTargetVideoPictureL() );
+                    }
+
+                if (status != KErrNone)
+                    {
+                    PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), GetTargetVideoPictureL failed [%d]"), status))
+                    iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                    iObserver.MtroFatalError(status);
+                    return;
+                    }
+                else if (picture)
+                    {
+                    // Set options for picture
+                    picture->iData.iDataSize = iOutputPictureSize;
+                    
+                    // we don't support resampling for 422, set default for 420 length
+                    // Add check of output data format (422 or 420) in the future and set dataLength properly
+                    TInt length = iOutputPictureSize.iWidth * iOutputPictureSize.iHeight * 3 / 2;
+
+                    if ( length > picture->iData.iRawData->MaxLength() )
+                        {
+                        PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), length exceeds CI buffer maxlength[%d, %d]"), length, picture->iData.iRawData->MaxLength() ))
+                        iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                        iObserver.MtroFatalError(KErrGeneral);
+                        return;
+                        }
+
+                    // set length
+                    picture->iData.iRawData->SetLength(length);
+                    }
+                else
+                    {
+                    if (iRealTime) // (picture is not available, act according realtime mode)
+                        {
+                        // Picture buffer is not available from encoder hwdevice
+                        // return decoded picture back, otherwise suspend decoding.. 
+                        PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), Picture buffer is not available through CI, Drop") ))
+                        iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                        return;
+                        }
+                    else
+                        {
+                        // Keep picture and does not return it to DecoderClient before processing
+                        PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), Picture buffer is not available through CI, store") ))
+                        iWaitNewDecodedPicture = aDecodedPicture;
+                        return;
+                        }
+                    }
+                }
+            else
+                {
+                if (!iTranscoderPictureQueue.IsEmpty())
+                    {
+                    picture = iTranscoderPictureQueue.First();
+                    }
+                else
+                    {
+                    PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), iTranscoderPictureQueue is empty")))
+
+                    if (iRealTime) // (picture is not available, act according realtime mode)
+                        {
+                        // Picture buffer is not available from encoder hwdevice
+                        // return decoded picture back, otherwise suspend decoding.. 
+                        PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), Picture buffer is not available fromEncoder, Drop") ))
+                        iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                        return;
+                        }
+                    else
+                        {
+                        // Keep picture and does not return it to DecoderClient before processing
+                        PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), Picture buffer is not available fromEncoder, store") ))
+                        iWaitNewDecodedPicture = aDecodedPicture;
+                        return;
+                        }
+                    }
+                }
+                
+            if (picture)
+                {
+                PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), picture[0x%x], data[0x%x]"), 
+                picture, picture->iData.iRawData->Ptr() ))
+
+                PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), decPicture[0x%x], data[0x%x]"), 
+                aDecodedPicture, aDecodedPicture->iData.iRawData->Ptr() ))
+
+                // Resample this picture
+                TRAP(status, iScaler->SetScalerOptionsL( *(aDecodedPicture->iData.iRawData), *(picture->iData.iRawData), 
+                                                         aDecodedPicture->iData.iDataSize, picture->iData.iDataSize ) );
+                if (status != KErrNone)
+                    {
+                    PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), Set scaler options failed[%d]"), status))
+                    iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                    iObserver.MtroFatalError(status);
+                    return;
+                    }
+
+                if (!iOptimizedDataTransfer)
+                    {
+                    // Remove picture from transcoder queue
+                    picture->iLink.Deque();
+                    }
+
+                // Scale
+                iScaler->Scale();
+                picture->iData.iDataFormat = EYuvRawData;
+                picture->iTimestamp = aDecodedPicture->iTimestamp;
+
+                // Put resampled picture to encoder queue
+                iEncoderPictureQueue.AddLast(*picture);
+
+                // Make request to process this picture
+                this->DoRequest();
+
+                // Return used picture to decoder
+                iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                }
+            else
+                {
+                PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), Transcoder picture queue is empty, skip this buffer")))
+                iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                }
+            }
+            break;
+            
+        case EDecoding:
+            {
+            if (!iPictureSink)
+                {
+                PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), iPictureSink was not set")))
+                iObserver.MtroFatalError(KErrNotReady);
+                return;
+                }
+                
+            if (aDecodedPicture->iData.iDataSize.iWidth != iDecodedPictureSize.iWidth ||
+                aDecodedPicture->iData.iDataSize.iHeight != iDecodedPictureSize.iHeight )
+                {
+                PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), picture size is not valid")))
+                iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                iObserver.MtroFatalError(KErrAlreadyExists);
+                return;
+                }
+
+            // Store picture until it's returned from the client
+            iDecodedPicture = aDecodedPicture;
+
+            if (iDecodedPictureSize == iOutputPictureSize)
+                {
+                // Send picture directly to the client
+                iPicureToClient.iRawData = aDecodedPicture->iData.iRawData;
+                iPicureToClient.iDataSize = aDecodedPicture->iData.iDataSize;
+                iPicureToClient.iTimestamp = aDecodedPicture->iTimestamp;
+                iPictureSink->MtroPictureFromTranscoder(&iPicureToClient);
+                }
+            else
+                {
+                // Resample this picture to desired size and send to the client
+                if ( !iTranscoderPictureQueue.IsEmpty() )
+                    {
+                    iVideoPictureTemp = iTranscoderPictureQueue.First();
+                    iVideoPictureTemp->iLink.Deque();
+
+                    // Resample this picture
+                    TRAP(status, iScaler->SetScalerOptionsL( *(aDecodedPicture->iData.iRawData), *(iVideoPictureTemp->iData.iRawData), 
+                                                             aDecodedPicture->iData.iDataSize, iVideoPictureTemp->iData.iDataSize ) );
+                    if (status != KErrNone)
+                        {
+                        PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), Set scaler options failed[%d]"), status))
+                        iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+                        iObserver.MtroFatalError(status);
+                        return;
+                        }
+                    
+                    iScaler->Scale();
+                    iPicureToClient.iRawData = iVideoPictureTemp->iData.iRawData;
+                    iPicureToClient.iDataSize = iVideoPictureTemp->iData.iDataSize;
+                    iPicureToClient.iTimestamp = aDecodedPicture->iTimestamp;
+
+                    // Return decoded picture to decoder
+                    iVideoDecoderClient->ReturnPicture(aDecodedPicture);
+
+                    // Sent picture to the client                   
+                    iPictureSink->MtroPictureFromTranscoder(&iPicureToClient);
+                    }
+                }
+            }
+            break;
+
+        default:
+            {
+            PRINT((_L("CTRTranscoderImp::MtrdvcoNewPicture(), observer should not be called in this mode")))
+            iObserver.MtroFatalError(KErrAlreadyExists);
+            return;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::DoRequest
+// Makes a new request
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::DoRequest()
+    {
+    if ( !this->IsActive() )
+        {
+        this->SetActive();
+        iStat = &iStatus;
+        User::RequestComplete( iStat, KErrNone );
+        }
+    else
+        {
+        PRINT((_L("CTRTranscoderImp::DoRequest(), AO is already active")))
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::RunL
+// CActive's RunL implementation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::RunL()
+    {
+    PRINT((_L("CTRTranscoderImp::RunL(), In")))
+    TVideoPicture* picture = NULL;
+    MTRVideoPictureSink* pictureSink = iPictureSinkTemp;
+    TBool pictureSinkEnabled = iCurrentAsyncPictureSinkEnabled;
+    TBool encoderEnabled = iCurrentAsyncEncoderEnabled;
+    TBool randomAccess = EFalse;
+    
+    
+    if ( !iEncoderPictureQueue.IsEmpty() )
+        {
+        switch(iMode)
+            {
+            case EFullTranscoding:
+                {
+                // Encode all pictures in the queue
+                TInt count = 0; 
+
+
+                while ( !iEncoderPictureQueue.IsEmpty() )
+                    {
+                    PRINT((_L("CTRTranscoderImp::RunL(), count[%d]"), count))
+                    count ++; 
+                    picture = iEncoderPictureQueue.First();
+
+                    // Check event queue
+                    if (!iAsyncEvent && !iTranscoderAsyncEventQueue.IsEmpty())
+                        {
+                        // Trasnscoder configuration is unknown, handle new event
+                        iAsyncEvent = iTranscoderAsyncEventQueue.First();
+                        iAsyncEvent->iLink.Deque();
+                        }
+                        
+                    if (iAsyncEvent)
+                        {
+                        // Check timestamp for this event
+                        if (picture->iTimestamp >= iAsyncEvent->iTimestamp)
+                            {
+                            // Perform requested client's operation
+                            // 1. PictureSinkStatus
+                            if (iAsyncEvent->iEnablePictureSinkStatus)
+                                {
+                                pictureSinkEnabled = iAsyncEvent->iEnablePictureSinkClientSetting;
+                                }
+
+                            // 2. EnableEncoderStatus
+                            if (iAsyncEvent->iEnableEncoderStatus)
+                                {
+                                encoderEnabled = iAsyncEvent->iEnableEncoderClientSetting;
+                                }
+                                
+                            // 3. RandomAccess
+                            if (iAsyncEvent->iRandomAccessStatus)
+                                {
+                                randomAccess = iAsyncEvent->iRandomAccessStatus;
+                                }
+                                
+                            // This event is already handled, we don't need it anymore
+                            iAsyncEvent->Reset();
+                            iTranscoderEventSrc.AddLast(*iAsyncEvent);
+                            iAsyncEvent = NULL;
+                            
+                            // Update current settings
+                            iCurrentAsyncPictureSinkEnabled = pictureSinkEnabled;
+                            iCurrentAsyncEncoderEnabled = encoderEnabled;
+                            iCurrentAsyncRandomAccess = randomAccess;
+                            }
+                        }
+                    // Else: Event queue is empty, act according async global options
+                    
+                    // Settings now defined, act accordingly
+                    PRINT((_L("CTRTranscoderImp::RunL(), PS[%d], Enc[%d], RandAcc[%d] for [%f]"), 
+                    pictureSinkEnabled, encoderEnabled, randomAccess, I64REAL(picture->iTimestamp.Int64()) ))
+                    
+                    if (pictureSinkEnabled)
+                        {
+                        if (!pictureSink)
+                            {
+                            PRINT((_L("CTRTranscoderImp::RunL(), Picture sink was not set, time to panic")))
+                            TRASSERT(0);
+                            }
+                            
+                        // Send decoded picture to the client first, and encode it after returning
+                        if (!iTranscoderTRPictureQueue.IsEmpty())
+                            {
+                            picture->iLink.Deque();
+
+                            TTRVideoPicture* pictureToClient = iTranscoderTRPictureQueue.First();
+                            pictureToClient->iLink.Deque();
+                            pictureToClient->iRawData = picture->iData.iRawData;
+                            pictureToClient->iDataSize = picture->iData.iDataSize;
+                            pictureToClient->iTimestamp = picture->iTimestamp;
+
+                            // Keep TVideoPicture container to the iContainerWaitQueue until the picture is returned back. 
+                            iContainerWaitQueue.AddLast(*picture);
+                        
+                            // Deliver picture to the client
+                            pictureSink->MtroPictureFromTranscoder(pictureToClient);
+                            // 
+                            // return;
+                            }
+                        else
+                            {
+                            PRINT((_L("CTRTranscoderImp::RunL(), iTranscoderTRPictureQueue is empty, abort")))
+                            iObserver.MtroFatalError(KErrAbort);
+                            return;
+                            }
+                        }
+                    else if (!encoderEnabled)
+                        {
+                        // All picture in this queue must be encoded
+                        PRINT((_L("CTRTranscoderImp::RunL(), All pictures from iEncoderPictureQueue must be encoded, error!")))
+                        TRASSERT(0);
+                        }
+                    else
+                        {
+                        // Send picture to encoder    
+                        picture = iEncoderPictureQueue.First();
+                        picture->iLink.Deque();
+                    
+                        if (randomAccess)
+                            {
+                            iVideoEncoderClient->SetRandomAccessPoint();
+                            randomAccess = EFalse;
+                            }
+
+                        iVideoEncoderClient->EncodePictureL(picture);
+                        }
+                    } // END while loop
+                }
+                break;
+
+            case EDecoding:
+                {
+                // Send decoded picture to the client. 
+                if (!iTranscoderTRPictureQueue.IsEmpty())
+                    {
+                    picture = iEncoderPictureQueue.First();
+                    picture->iLink.Deque();
+
+                    // Take Transcoder picture container
+                    TTRVideoPicture* pictureToClient = iTranscoderTRPictureQueue.First();
+                    pictureToClient->iLink.Deque();
+
+                    pictureToClient->iRawData = picture->iData.iRawData;
+                    pictureToClient->iDataSize = picture->iData.iDataSize;
+                    pictureToClient->iTimestamp = picture->iTimestamp;
+
+                    if (iPictureSink)
+                        {
+                        iPictureSink->MtroPictureFromTranscoder(pictureToClient);
+                        }
+                    else
+                        {
+                        // Should not happen
+                        PRINT((_L("CTRTranscoderImp::RunL(), Decoding, PictureSink is not valid")))
+                        TRASSERT(0);
+                        }
+
+                    // Keep TVideoPicture container to the iContainerWaitQueue until the picture is returned back. 
+                    iContainerWaitQueue.AddLast(*picture);
+                    }
+                }
+                break;
+
+            case EEncoding:
+                {
+                // Send picture to video encoder
+                if ( !iEncoderPictureQueue.IsEmpty() )
+                    {
+                    picture = iEncoderPictureQueue.First();
+                    picture->iLink.Deque();
+                    iVideoEncoderClient->EncodePictureL(picture);
+                    }
+                }
+                break;
+
+            case EResampling:
+                {
+                PRINT((_L("CTRTranscoderImp::RunL(), should not be called in Resampling mode")))
+                TRASSERT(0);
+                }
+                break;
+
+            case EOperationNone:
+                {
+                User::Leave(KErrNotReady);
+                }
+                break;
+
+            default:
+                {
+                User::Leave(KErrNotReady);
+                }
+                break;
+            }
+        }
+
+    PRINT((_L("CTRTranscoderImp::RunL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::DoCancel
+// Cancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::DoCancel()
+    {
+    // Nothing to do
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::RunError
+// Handles AO leave
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CTRTranscoderImp::RunError(TInt aError)
+    {
+    PRINT((_L("CTRTranscoderImp::RunError(), seems RunL leaved, error[%d]."), aError))
+    
+    iObserver.MtroFatalError(aError);
+
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::MtrdvcoEncoderReturnPicture
+// Returns picture from encoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::MtrdvcoEncoderReturnPicture(TVideoPicture* aPicture)
+    {
+    PRINT((_L("CTRTranscoderImp::MtrdvcoEncoderReturnPicture()")))
+    TTRVideoPicture* pictureToClient = NULL;
+    TInt status = KErrNone;
+
+
+    if (!aPicture)
+        {
+        PRINT((_L("CTRTranscoderImp::MtrdvcoEncoderReturnPicture(), picture is not valid")))
+        iObserver.MtroFatalError(KErrAlreadyExists);
+        return;
+        }
+    else if (!aPicture->iData.iRawData)
+        {
+        PRINT((_L("CTRTranscoderImp::MtrdvcoEncoderReturnPicture(), picture raw data is not valid")))
+        iObserver.MtroFatalError(KErrAlreadyExists);
+        return;
+        }
+
+    switch(iMode)
+        {
+        case EFullTranscoding:
+            {
+            // if (BuffManCI) { nothing to do, possibly send next picture for encoder, if available }
+            // Put returned picture to the iTranscoderPictureQueue
+            if (!iOptimizedDataTransfer)
+                {
+                iTranscoderPictureQueue.AddLast(*aPicture);
+                
+                // There could be some decoded pictures waiting for processing, check it
+                this->MtrdvcoNewBuffers();
+                }
+            else
+                {
+                PRINT((_L("CTRTranscoderImp::MtrdvcoEncoderReturnPicture(), Nothing to do here, since optimized data transfer in use")))
+                return;
+                }
+
+            if ( !iEncoderPictureQueue.IsEmpty() )
+                {
+                // If there are pictures available in EncoderPicture for processing, initiate data transfer from here
+                PRINT((_L("CTRTranscoderImp::MtrdvcoEncoderReturnPicture(), some pictures were not processed in iEncoderPictureQueue")))
+                TRAP(status, this->RunL());
+                
+                if (status != KErrNone)
+                    {
+                    // Indicate eror status to the client
+                    PRINT((_L("CTRTranscoderImp::MtrdvcoEncoderReturnPicture(), error[%d]"), status))
+                    iObserver.MtroFatalError(status);
+                    return;
+                    }
+                }
+            }
+            break;
+
+        case EDecoding:
+                {
+                // Should not happen
+                PRINT((_L("CTRTranscoderImp::MtrdvcoEncoderReturnPicture(), Encoder returns picture in Decoding mode")))
+                TRASSERT(0);
+                }
+
+            break;
+
+        case EEncoding:
+            {
+            // Put picture to transcoder queue
+            iTranscoderPictureQueue.AddLast(*aPicture);
+            
+            if (iInputPictureSize == iOutputPictureSize)
+                {
+                // Find TRPicture container corresponding to picture data & return it to the client; 
+                if ( !iTranscoderTRPictureQueue.IsEmpty() )
+                    {
+                    pictureToClient = iTranscoderTRPictureQueue.First();
+                    pictureToClient->iLink.Deque();
+                    
+                    if (pictureToClient->iRawData == aPicture->iData.iRawData)
+                        {
+                        // Return picture
+                        iPictureSink->MtroPictureFromTranscoder(pictureToClient);
+                        }
+                    else
+                        {
+                        TPtr8 tmp(*pictureToClient->iRawData);
+                        iTranscoderTRPictureQueue.AddLast(*pictureToClient);
+                        
+                        // Encoder returns pictures in different order than they were sent
+                        // Check next picture
+                        pictureToClient = iTranscoderTRPictureQueue.First();
+                        pictureToClient->iLink.Deque();
+                        
+                        while (*pictureToClient->iRawData != tmp)
+                            {
+                            if ( pictureToClient->iRawData == aPicture->iData.iRawData )
+                                {
+                                // Return picture
+                                iPictureSink->MtroPictureFromTranscoder(pictureToClient);
+                                return;
+                                }
+                            else
+                                {
+                                // Put back to the queue this picture and check the next one
+                                iTranscoderTRPictureQueue.AddLast(*pictureToClient);
+                                pictureToClient = iTranscoderTRPictureQueue.First();
+                                pictureToClient->iLink.Deque();
+                                }
+                            }
+                        
+                        // The picture has already been removed from the TR picture queue.
+                        // Probably the client thought a frame was skipped and sent a new picture for encoding,
+                        // therefore the client is not expecting us to send anything back => do nothing
+                            
+                        PRINT((_L("CTRTranscoderImp::MtrdvcoEncoderReturnPicture(), Picture already returned, nothing to do")))
+                        }
+                    }
+                }
+            }
+            break;
+
+        case EResampling:
+            {
+            // Should not happen
+            PRINT((_L("CTRTranscoderImp::MtrdvcoEncoderReturnPicture(), Encoder returns picture in Resampling mode.")))
+            TRASSERT(0);
+            }
+            break;
+
+        default:
+            {
+            PRINT((_L("CTRTranscoderImp::MtrdvcoEncoderReturnPicture(), default case")))
+            TRASSERT(0);
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::SendPictureToTranscoderL
+// Receives picture from the client
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::SendPictureToTranscoderL(TTRVideoPicture* aPicture)
+    {
+    PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), In")))
+    TVideoPicture* picture = NULL;
+    TInt status = KErrNone;
+    TBool encoderEnabled = EFalse;
+    TBool randomAccess = EFalse;   
+    
+    if (iState == ETRFatalError)
+        {
+        // Nothing to do
+        return;
+        }
+
+    if ( (iState != ETRRunning) && (iState != ETRPaused) &&
+         (iState != ETRStopped) && (iMode != EDecoding) )
+        {
+        PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), wrong state")))
+        User::Leave(KErrNotReady);
+        }
+
+    if (!aPicture)
+        {
+        PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), Client sends invalid data")))
+        User::Leave(KErrArgument);
+        }
+    else if (!aPicture->iRawData)
+        {
+        PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), Client sends invalid raw data")))
+        User::Leave(KErrArgument);
+        }
+
+    PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), picture timestamp [%f]"), I64REAL(aPicture->iTimestamp.Int64()) ))
+
+    switch(iMode)
+        {
+        case EFullTranscoding:
+            {
+            if (!iPictureSinkTemp)
+                {
+                PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), Client did not set picture sink! leave")))
+                User::Leave(KErrNotReady);
+                }
+                
+            if (iIntermediatePictureSize == iDecodedPictureSize)
+                {
+                // Picture path is Decoder->Client->Transcoder
+                // Decoder does not generate new picture until this one have not been returned
+                // Act according global settings defined in NewPicture
+                encoderEnabled = iCurrentEncoderEnabled;
+                randomAccess = iCurrentRandomAccess;
+                
+                // Reset it here
+                iCurrentRandomAccess = EFalse;
+                }
+            else
+                {
+                // Picture was processed asynchronously
+                // Set global async options
+                encoderEnabled = iCurrentAsyncEncoderEnabled;
+                randomAccess = iCurrentAsyncRandomAccess;
+                
+                // Reset it here
+                iCurrentAsyncRandomAccess = EFalse;
+                }
+                
+            if (!encoderEnabled)
+                {
+                // Put TRPicture container to the queue in any case
+                iTranscoderTRPictureQueue.AddLast(*aPicture);
+
+                // Nothing to do for this picture, return it to decoder
+                if (iIntermediatePictureSize == iDecodedPictureSize)
+                    {
+                    if (iDecodedPicture)
+                        {
+                        // Return & reset
+                        PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), return picture [%f] to decoder"), I64REAL(iDecodedPicture->iTimestamp.Int64()) ))
+                        TVideoPicture* decodedPicture = iDecodedPicture;
+                        iDecodedPicture = NULL;
+                        iVideoDecoderClient->ReturnPicture(decodedPicture);
+                        }
+                    }
+                else
+                    {
+                    // If picture was sent to the client asynchronously, nothing to return to decoder
+                    // Picture path is Decoder->Transcoder->client->Transcoder
+                    // Picture was taken from iTranscoderPictureQueue, put it back, since it's not encoded
+                    // Take container for TVideoPicture
+                    if ( !iContainerWaitQueue.IsEmpty() )
+                        {
+                        // Take container
+                        picture = iContainerWaitQueue.First();
+                        picture->iLink.Deque();
+                        picture->iData.iRawData = aPicture->iRawData;
+                        picture->iData.iDataSize = aPicture->iDataSize;
+                        picture->iTimestamp = aPicture->iTimestamp;
+                        
+                        if (!iOptimizedDataTransfer)
+                            {
+                            iTranscoderPictureQueue.AddLast(*picture);
+                            }
+                        else
+                            {
+                            iCIPictureBuffersQueue.AddLast(*picture);
+                            
+                            // Some pictures were not processed yet and wait for processing
+                            this->MtrdvcoNewBuffers();
+                            }
+                        }
+                    }
+
+                return;
+                }
+
+
+            // Client returns processed picture. (Resample, if needed) and send it to encoder;
+            if ( /*iPictureSink &&*/ (iIntermediatePictureSize == iDecodedPictureSize) )
+                {
+                // Check input picture size
+                if ( aPicture->iDataSize != iDecodedPictureSize )
+                    {
+                    PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), The client sets wrong picture size")))
+                    User::Leave(KErrArgument);
+                    }
+
+                //  AA Tuning..(Codecs AOs can be higher priority, so if there are any pictures in iEncoderPictureQueue waiting for processing, send those first)
+                if ( (iDecodedPictureSize == iOutputPictureSize) && (!iEncoderPictureQueue.IsEmpty()) )
+                    {
+                    PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), some pictures were not processed in iEncoderPictureQueue")))
+                    this->RunL();
+                    }
+
+                if (iOptimizedDataTransfer)
+                    {
+                    if ( !iCIPictureBuffersQueue.IsEmpty() )
+                        {
+                        // Target video picture buffer is already available, use it
+                        picture = iCIPictureBuffersQueue.First();
+                        picture->iLink.Deque();
+                        PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), picture is already available")))
+                        }
+                    else
+                        {
+                        PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), picture not available, request new;")))
+                        // Picture was already returned with WritePictureL
+                        TRAP( status, picture = iVideoEncoderClient->GetTargetVideoPictureL() );
+                        }
+
+                    if (status != KErrNone)
+                        {
+                        // return decoded picture to decoder
+                        PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), GetTargetVideoPictureL leved with [%d]"), status))
+                        
+                        if (iDecodedPicture)
+                            {
+                            // Return & reset
+                            TVideoPicture* decodedPicture = iDecodedPicture;
+                            iDecodedPicture = NULL;
+                            iVideoDecoderClient->ReturnPicture(decodedPicture);
+                            }
+                        
+                        // Report the error to the client
+                        iObserver.MtroFatalError(status);
+                        return;
+                        }
+                    else if (picture)
+                        {
+                        // Set options for picture
+                        picture->iData.iDataSize = iOutputPictureSize;
+                        
+                        // we don't support resampling for 422, set default for 420 length
+                        // Add check of output data format (422 or 420) in the future and set dataLength properly
+                        TInt length = iOutputPictureSize.iWidth * iOutputPictureSize.iHeight * 3 / 2;
+
+                        if ( length > picture->iData.iRawData->MaxLength() )
+                            {
+                            PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), length exceeds CI buffer maxlength[%d, %d]"), length, picture->iData.iRawData->MaxLength() ))
+                            
+                            if (iDecodedPicture)
+                                {
+                                // Return & reset
+                                TVideoPicture* decodedPicture = iDecodedPicture;
+                                iDecodedPicture = NULL;
+                                iVideoDecoderClient->ReturnPicture(decodedPicture);
+                                }
+                            
+                            iObserver.MtroFatalError(KErrGeneral);
+                            return;
+                            }
+
+                        // set length
+                        picture->iData.iRawData->SetLength(length);
+                        }
+                    else
+                        {
+                        if (iRealTime) // (picture is not available, act according realtime mode)
+                            {
+                            // Picture buffer is not available from encoder hwdevice
+                            // return decoded picture back, otherwise suspend decoding.. 
+                            PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), Picture buffer is not available through CI, Drop") ))
+                            
+                            if (iDecodedPicture)
+                                {
+                                iVideoDecoderClient->ReturnPicture(iDecodedPicture);
+                                }
+
+                            return;
+                            }
+                        else
+                            {
+                            // Keep picture and does not return it to DecoderClient before processing
+                            PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), Picture buffer is not available through CI, store") ))
+                            iWaitPictureFromClient = aPicture;
+                            return;
+                            }
+                        }
+                    }
+                else
+                    {
+                    if ( !iTranscoderPictureQueue.IsEmpty() )
+                        {
+                        picture = iTranscoderPictureQueue.First();
+                        }
+                    else
+                        {
+                        //  AA (don't report FatalError & wait for newBuffers callback from the encoder)
+                        // return decoded picture to decoder
+                        PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), iTranscoderPictureQueue is empty")))
+
+                        if (iRealTime) // (picture is not available, act according realtime mode)
+                            {
+                            // Picture buffer is not available from encoder hwdevice
+                            // return decoded picture back, otherwise suspend decoding.. 
+                            PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), Picture buffer is not available FromEncoder, Drop") ))
+                            
+                            if (iDecodedPicture)
+                                {
+                                iVideoDecoderClient->ReturnPicture(iDecodedPicture);
+                                }
+
+                            return;
+                            }
+                        else
+                            {
+                            // Keep picture and does not return it to DecoderClient before processing
+                            PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), Picture buffer is not available FromEncoder, store") ))
+                            iWaitPictureFromClient = aPicture;
+                            return;
+                            }
+                        }
+                    }
+
+                if (picture)
+                    {
+                    // Returned picture was not resampled. Resample it first.
+                    TRAP(status, iScaler->SetScalerOptionsL( *(aPicture->iRawData), 
+                                                             *(picture->iData.iRawData), 
+                                                             aPicture->iDataSize, 
+                                                             picture->iData.iDataSize ) );
+                    if (status != KErrNone)
+                        {
+                        PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), Set scaler options failed[%d]"), status))
+
+                        if (iDecodedPicture)
+                            {
+                            // Return & reset
+                            TVideoPicture* decodedPicture = iDecodedPicture;
+                            iDecodedPicture = NULL;
+                            iVideoDecoderClient->ReturnPicture(decodedPicture);
+                            }
+
+                        iTranscoderTRPictureQueue.AddLast(*aPicture);
+                        
+                        // Inform the client with an error
+                        User::Leave(status);
+                        }
+                    
+                    if ( !iOptimizedDataTransfer )
+                        {
+                        // Remove picture from transcoder queue
+                        picture->iLink.Deque();
+                        }
+                    
+                    // Scale picture
+                    iScaler->Scale();
+
+                    // Set params
+                    picture->iTimestamp = aPicture->iTimestamp;
+                    }
+                }
+            else
+                {
+                // Send picture to encoder without resampling
+                // Take container for TVideoPicture
+                if ( !iContainerWaitQueue.IsEmpty() )
+                    {
+                    // Take container
+                    picture = iContainerWaitQueue.First();
+                    picture->iLink.Deque();
+                    picture->iData.iRawData = aPicture->iRawData;
+                    picture->iData.iDataSize = aPicture->iDataSize;
+                    picture->iTimestamp = aPicture->iTimestamp;
+                    }
+                }
+
+            // Put client's container to TRPicture queue
+            iTranscoderTRPictureQueue.AddLast(*aPicture);
+
+            if (picture)
+                {
+                // Encode picture
+                if (randomAccess)
+                    {
+                    iVideoEncoderClient->SetRandomAccessPoint();
+                    }
+
+                iVideoEncoderClient->EncodePictureL(picture);
+                }
+                
+            //  AA
+            // return decoded picture here, if there's some available
+            if (iDecodedPicture)
+                {
+                PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), Return decoded picture now")))
+
+                // Return & reset
+                TVideoPicture* decodedPicture = iDecodedPicture;
+                iDecodedPicture = NULL;
+                iVideoDecoderClient->ReturnPicture(decodedPicture);
+                }
+            }
+            break;
+
+        case EDecoding:
+            {
+            // Client returns decoded picture back. 
+            if (iDecodedPictureSize == iOutputPictureSize)
+                {
+                if (iDecodedPicture)
+                    {
+                    iVideoDecoderClient->ReturnPicture(iDecodedPicture);
+                    }
+                }
+            else
+                {
+                // Put picture back to the queue
+                iTranscoderPictureQueue.AddLast(*iVideoPictureTemp);
+                }
+            }
+            break;
+
+        case EEncoding:
+            {
+            // Check input picture size
+            if ( aPicture->iDataSize != iInputPictureSize )
+                {
+                PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), Encoding: The client sets wrong picture size")))
+                User::Leave(KErrArgument);
+                }
+
+            // Client writes new picture to encode. Encode it and return back;
+            if (!iPictureSink)
+                {
+                PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), picture sink is not set by the client")))
+                User::Leave(KErrNotReady);
+                }
+
+            if ( !iTranscoderPictureQueue.IsEmpty() )
+                {
+                picture = iTranscoderPictureQueue.First();
+
+                if (iInputPictureSize != iOutputPictureSize)
+                    {
+                    // Resample this picture first, since picture sizes are different
+                    iScaler->SetScalerOptionsL( *(aPicture->iRawData), *(picture->iData.iRawData), aPicture->iDataSize, 
+                                                picture->iData.iDataSize );
+
+                    // Scale
+                    iScaler->Scale();
+                    }
+                else
+                    {
+                    picture->iData.iDataSize = aPicture->iDataSize;
+                    picture->iData.iRawData = aPicture->iRawData;
+                    }
+
+                picture->iData.iDataFormat = EYuvRawData;
+                picture->iTimestamp = aPicture->iTimestamp;
+
+                // Remove picture from transcoder queue
+                picture->iLink.Deque();
+
+                // Put video picture to encoder queue
+                iEncoderPictureQueue.AddLast(*picture);
+                
+                // Make request to process this picture
+                this->DoRequest();
+
+                if (iInputPictureSize != iOutputPictureSize)
+                    {
+                    // Return picture to the client
+                    iPictureSink->MtroPictureFromTranscoder(aPicture);
+                    }
+                // Add picture to TR queue unless it's already there
+                else if ( iTranscoderTRPictureQueue.IsEmpty() ||
+                        ((iTranscoderTRPictureQueue.First() != aPicture) &&
+                        (iTranscoderTRPictureQueue.Last() != aPicture)) )
+                    {
+                    // Keep aPicture until picture is returned by the encoder
+                    iTranscoderTRPictureQueue.AddLast(*aPicture);
+                    }
+                }
+            }
+            break;
+
+        case EResampling:
+            {
+            User::Leave(KErrInUse);
+            }
+            break;
+
+        case EOperationNone:
+            {
+            User::Leave(KErrNotReady);
+            }
+            break;
+
+        default:
+            {
+            User::Leave(KErrNotReady);
+            }
+            break;
+        }
+
+    PRINT((_L("CTRTranscoderImp::SendPictureToTranscoderL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::MtrdvcoNewBuffer
+// New buffer from the Video encoder is available
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::MtrdvcoNewBuffer(CCMRMediaBuffer* aBuffer)
+    {
+    if (!aBuffer)
+        {
+        // Should never happend
+        PRINT((_L("CTRTranscoderImp::MtrdvcoNewBuffer(), EncoderClient sends invalid data, panic")))
+        TRASSERT(0);
+        }
+
+    if (!iMediaSink)
+        {
+        // Should never happend at this point
+        PRINT((_L("CTRTranscoderImp::MtrdvcoNewBuffer(), invalid media sink, panic")))
+        TRASSERT(0);
+        }
+
+    TRAPD(status, iMediaSink->WriteBufferL(aBuffer));
+    if (status != KErrNone)
+        {
+        PRINT((_L("CTRTranscoderImp::MtrdvcoNewBuffer(), WriteBufferL status[%d]"), status))
+        iObserver.MtroFatalError(status);
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::ResampleL
+// Resamples video picture to new resolution
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::ResampleL(TPtr8& aSrc, TPtr8& aTrg)
+    {
+    PRINT((_L("CTRTranscoderImp::ResampleL(), In")))
+
+    if ( (iState != ETRInitialized) && (iState != ETRRunning) )
+        {
+        PRINT((_L("CTRTranscoderImp::ResampleL(), called in wrong state")))
+        User::Leave(KErrNotReady);
+        }
+
+    if (iMode != EResampling)
+        {
+        PRINT((_L("CTRTranscoderImp::ResampleL(), supported only in Resampling mode")))
+        User::Leave(KErrInUse);
+        }
+
+    if (iScaler)
+        {
+        // SetScaler options
+        iScaler->SetScalerOptionsL(aSrc, aTrg, iInputPictureSize, iOutputPictureSize);
+        iScaler->Scale();
+        }
+    else
+        {
+        PRINT((_L("CTRTranscoderImp::ResampleL(), scaler is not valid")))
+        TRASSERT(0);
+        }
+
+    PRINT((_L("CTRTranscoderImp::ResampleL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::StopL
+// Stops data processing synchronously
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::StopL()
+    {
+    PRINT((_L("CTRTranscoderImp::StopL(), In")))
+
+    
+    if ( (iState != ETRRunning) && (iState != ETRPaused) && (iState != ETRFatalError) )
+        {
+        PRINT((_L("CTRTranscoderImp::StopL(), wrong state, leave")))
+        User::Leave(KErrNotReady);
+        }
+        
+    switch(iMode)
+        {
+        case EFullTranscoding:
+            {
+            // Discard all frames waiting to be sent to encoder
+            iEncoderPictureQueue.Reset();
+            
+            iVideoDecoderClient->StopL();
+            iVideoEncoderClient->StopL();
+            iState = ETRStopped;
+            }
+            break;
+
+        case EDecoding:
+            {
+            iVideoDecoderClient->StopL();
+            iState = ETRStopped;
+            }
+            break;
+
+        case EEncoding:
+            {
+            iVideoEncoderClient->StopL();
+            iState = ETRStopped;
+            }
+            break;
+
+        case EResampling:
+            {
+            iState = ETRStopped;
+            }
+            break;
+
+        case EOperationNone:
+            {
+            User::Leave(KErrNotReady);
+            }
+            break;
+
+        default:
+            {
+            }
+            break;
+        }
+        
+    PRINT((_L("CTRTranscoderImp::StopL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::AsyncStopL
+// Stops data processing asynchronously
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::AsyncStopL()
+    {
+    PRINT((_L("CTRTranscoderImp::AsyncStopL(), Async In")))
+
+
+    if (iState != ETRRunning)
+        {
+        PRINT((_L("CTRTranscoderImp::AsyncStopL() Async, wrong state")))
+        User::Leave(KErrNotReady);
+        }
+
+    switch(iMode)
+        {
+        case EFullTranscoding:
+            {
+            iAsyncStop = ETrue;
+            iVideoDecoderClient->AsyncStopL();
+            }
+            break;
+
+        case EDecoding:
+            {
+            iEncoderStreamEnd = ETrue;
+            iVideoDecoderClient->AsyncStopL();
+            iState = ETRStopped;
+            }
+            break;
+
+        case EEncoding:
+            {
+            iDecoderStreamEnd = ETrue;
+            iVideoEncoderClient->AsyncStopL();
+            iState = ETRStopped;
+            }
+            break;
+
+        case EResampling:
+            {
+            // Just complete asyncStop right here
+            iObserver.MtroAsyncStopComplete();
+            iState = ETRStopped;
+            }
+            break;
+
+        case EOperationNone:
+            {
+            User::Leave(KErrNotReady);
+            }
+            break;
+
+        default:
+            {
+            User::Leave(KErrNotReady);
+            }
+        }
+    
+
+    PRINT((_L("CTRTranscoderImp::AsyncStopL(), Async Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::MtrdvcoEncStreamEnd
+// Informs that last data was processed by encoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::MtrdvcoEncStreamEnd()
+    {
+    PRINT((_L("CTRTranscoderImp::MtrdvcoEncStreamEnd()")))
+    iEncoderStreamEnd = ETrue;
+
+    if (iDecoderStreamEnd)
+        {
+        PRINT((_L("CTRTranscoderImp::MtrdvcoEncStreamEnd(), MtroAsyncStopComplete")))
+        iObserver.MtroAsyncStopComplete();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::DecoderStreamEnd
+// Informs that last data was processed by decoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::MtrdvcoDecStreamEnd()
+    {
+    PRINT((_L("CTRTranscoderImp::MtrdvcoDecStreamEnd()")))
+    TInt status = KErrNone;
+    iDecoderStreamEnd = ETrue;
+
+    if (iEncoderStreamEnd)
+        {
+        PRINT((_L("CTRTranscoderImp::MtrdvcoDecStreamEnd(), MtroAsyncStopComplete")))
+        iObserver.MtroAsyncStopComplete();
+        return;
+        }
+        
+    if (iAsyncStop)
+        {
+        // Call now asyncStop for encoder
+        TRAP(status, iVideoEncoderClient->AsyncStopL());
+        
+        if (status != KErrNone)
+            {
+            // Report error to the client during stop
+            PRINT((_L("CTRTranscoderImp::MtrdvcoDecStreamEnd(), EncAsyncStop status[%d]"), status))
+            iObserver.MtroFatalError(status);
+            }
+        
+        iState = ETRStopped;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::MtrdvcoRendererReturnPicture
+// Receives picture from renderer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::MtrdvcoRendererReturnPicture(TVideoPicture* /*aPicture*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::MtrdvcoFatalError
+// Reports the fatal error to the client
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::MtrdvcoFatalError(TInt aError)
+    {
+    PRINT((_L("CTRTranscoderImp::MtrdvcoFatalError(), error[%d]"), aError))
+    iFatalError = aError;
+    iState = ETRFatalError;
+    iObserver.MtroFatalError(aError);
+    }
+
+
+//  AA (PV requires to use that, otherwise depends on the decoder hwdevice & decoder itself)
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::SetDecoderInitDataL
+// Sends init data for decoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::SetDecoderInitDataL(TPtrC8& /*aInitData*/)
+    {
+    // Remove this API in the future; 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::GetCodingStandardSpecificInitOutputLC
+// Retrieve coding options from encoder client
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* CTRTranscoderImp::GetCodingStandardSpecificInitOutputLC()
+    {
+    if ( iState != ETRInitialized )
+        {
+        PRINT((_L("CTRTranscoderImp::GetCodingStandardSpecificInitOutputLC(), wrong state, leave")))
+        User::Leave(KErrNotReady);
+        }
+        
+    if (iVideoEncoderClient)
+        {
+        return iVideoEncoderClient->GetCodingStandardSpecificInitOutputLC();
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::EnablePictureSink
+// Enable / Disable picture sink
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::EnablePictureSink(TBool aEnable)
+    {
+    if (iMode != EFullTranscoding)
+        {
+        // nothing to do in other mode
+        PRINT((_L("CTRTranscoderImp::EnablePictureSink(), nothing to do, wrong mode")))
+        return;
+        }
+        
+    if (iPictureSinkClientSetting != aEnable)
+        {
+        // Setting was changed
+        iPictureSinkSettingChanged = ETrue;
+        PRINT((_L("CTRTranscoderImp::EnablePictureSink(), EnablePictureSink setting changed[%d]"), aEnable))
+        }
+        
+    iPictureSinkClientSetting = aEnable;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::EnableEncoder
+// Enable / Disable encoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::EnableEncoder(TBool aEnable)
+    {
+    if (iMode != EFullTranscoding)
+        {
+        // nothing to do in other mode
+        PRINT((_L("CTRTranscoderImp::EnableEncoder(), nothing to do, wrong mode")))
+        return;
+        }
+
+    if (iEncoderEnableClientSetting != aEnable)
+        {
+        // Setting was changed
+        iEncoderEnabledSettingChanged = ETrue;
+        PRINT((_L("CTRTranscoderImp::EnableEncoder(), EnableEncoder setting changed[%d]"), aEnable))
+        }
+
+    iEncoderEnableClientSetting = aEnable;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::SetRandomAccessPoint
+// Sets random access
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::SetRandomAccessPoint()
+    {
+    if (iMode != EFullTranscoding)
+        {
+        // nothing to do in other mode
+        PRINT((_L("CTRTranscoderImp::EnableEncoder(), nothing to do, wrong mode")))
+        return;
+        }
+
+    iSetRandomAccessPoint = ETrue;
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::MtrdvcoNewBuffers
+// New buffers from encoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRTranscoderImp::MtrdvcoNewBuffers()
+    {
+    PRINT((_L("CTRTranscoderImp::MtrdvcoNewBuffers()")))
+    TInt status = KErrNone;
+    TTRVideoPicture* pictureFromClient = NULL;
+    TVideoPicture* newDecodedPicture = NULL;
+    
+    
+    if (iRealTime)
+        {
+        // Should never be called in normal data flow or realTime mode, ignore this call!
+        PRINT((_L("CTRTranscoderImp::MtrdvcoNewBuffers(), return immediately")))
+        return;
+        }
+        
+    // Use this call to initiate data transfer if there are available decoded picture waiting for processing
+    if (iWaitPictureFromClient)
+        {
+        PRINT((_L("CTRTranscoderImp::MtrdvcoNewBuffers(), iWaitPictureFromClient, [0x%x], call SendPictureToTranscoderL()"), iWaitPictureFromClient))
+        
+        // Simulate call from the client since picture was not processed
+        pictureFromClient = iWaitPictureFromClient;
+        
+        // Reset picture, it can be reinitialized in the following call
+        iWaitPictureFromClient = NULL;
+        
+        TRAP( status, this->SendPictureToTranscoderL(pictureFromClient) );
+        
+        if (status != KErrNone)
+            {
+            // Report error to the client
+            PRINT((_L("CTRTranscoderImp::MtrdvcoNewBuffers(), status[%d]"), status))
+            iObserver.MtroFatalError(status);
+            }
+            
+        return;
+        }
+        
+    if (iWaitNewDecodedPicture)
+        {
+        PRINT((_L("CTRTranscoderImp::MtrdvcoNewBuffers(), iWaitNewDecodedPicture[0x%x]"), iWaitNewDecodedPicture))
+        newDecodedPicture = iWaitNewDecodedPicture;
+        
+        // Reset newdecoded picture
+        iWaitNewDecodedPicture = NULL;
+        
+        // Simulate new decoded picture call
+        this->MtrdvcoNewPicture(newDecodedPicture);
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::EstimateTranscodeTimeFactorL
+// Returns a time estimate of how long it takes to process one second of the input video
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+TReal CTRTranscoderImp::EstimateTranscodeTimeFactorL(const TTRVideoFormat& aInput, const TTRVideoFormat& aOutput)
+    {
+    PRINT((_L("CTRTranscoderImp::EstimateTranscodeTimeFactorL(), In")))
+    
+    if ( iState == ETRNone )
+        {
+        PRINT((_L("CTRTranscoderImp::EstimateTranscodeTimeFactorL(), Transcoder is in wrong state")))
+        User::Leave(KErrNotReady);
+        }
+    
+    // Get frame rate for output / input video    
+    TReal time = 0.0;
+    TReal encodeFrameRate = GetFrameRateL();
+    TReal decodeFrameRate = 0.0;
+    iObserver.MtroSetInputFrameRate(decodeFrameRate);
+    
+    // Use default frames rates if not set
+    if (encodeFrameRate == 0.0) encodeFrameRate = KTRDefaultSrcRate;
+    if (decodeFrameRate == 0.0) decodeFrameRate = KTRDefaultSrcRate;
+    
+    PRINT((_L("CTRTranscoderImp::EstimateTranscodeTimeFactorL(), encode frame rate: %.2f"), encodeFrameRate))
+    PRINT((_L("CTRTranscoderImp::EstimateTranscodeTimeFactorL(), decode frame rate: %.2f"), decodeFrameRate))
+        
+    switch(iMode)
+        {
+        case EFullTranscoding:
+            {
+            // Estimate the time for decoding, encoding and possible resampling
+            time += iVideoEncoderClient->EstimateEncodeFrameTimeL(aOutput, iOutputCodec) * encodeFrameRate;
+            time += iVideoDecoderClient->EstimateDecodeFrameTimeL(aInput, iInputCodec) * decodeFrameRate;
+            time += iScaler->EstimateResampleFrameTime(aInput, aOutput) * decodeFrameRate;
+            
+            break;
+            }
+
+        case EDecoding:
+            {
+            // Estimate the time for decoding and possible resampling
+            time += iVideoDecoderClient->EstimateDecodeFrameTimeL(aInput, iInputCodec) * decodeFrameRate;
+            time += iScaler->EstimateResampleFrameTime(aInput, aOutput) * decodeFrameRate;
+            
+            break;
+            }
+
+        case EEncoding:
+            {
+            // Estimate the time for encoding and possible resampling
+            time += iVideoEncoderClient->EstimateEncodeFrameTimeL(aOutput, iOutputCodec) * encodeFrameRate;
+            time += iScaler->EstimateResampleFrameTime(aInput, aOutput) * encodeFrameRate;
+            
+            break;
+            }
+
+        case EResampling:
+            {
+            // Estimate the time for resampling
+            time += iScaler->EstimateResampleFrameTime(aInput, aOutput) * decodeFrameRate;
+            
+            break;
+            }
+
+        default:
+            {
+            // Transcoder is not ready
+            User::Leave(KErrNotReady);
+            break;
+            }
+        }
+        
+    PRINT((_L("CTRTranscoderImp::EstimateTranscodeTimeFactorL(), time factor: %.2f"), time))
+    
+    PRINT((_L("CTRTranscoderImp::EstimateTranscodeTimeFactorL(), Out")))
+    
+    return time;
+    }
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::GetMaxFramesInProcessing
+// Get max number of frames in processing
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//     
+TInt CTRTranscoderImp::GetMaxFramesInProcessing()
+    {
+    return iMaxFramesInProcessing;
+    }
+    
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::EnablePausing
+// Enable / Disable pausing of transcoding if resources are lost
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//  
+void CTRTranscoderImp::EnablePausing(TBool aEnable)
+    {
+    if (iVideoDecoderClient)
+        {
+        iVideoDecoderClient->EnableResourceObserver(aEnable);
+        }
+    
+    if (iVideoEncoderClient)
+        {
+        iVideoEncoderClient->EnableResourceObserver(aEnable);
+        }
+    
+    }
+    
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::::MmvroResourcesLost
+// Indicates that a media device has lost its resources
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//     
+void CTRTranscoderImp::MtrdvcoResourcesLost(TBool aFromDecoder)
+    {
+    PRINT((_L("CTRTranscoderImp::MtrdvcoResourcesLost(), In")))
+    
+    if ( (iState == ETRRunning) || (iState == ETRInitialized) || (iState == ETRStopped) )
+        {
+        iVideoDecoderClient->Pause();
+        iState = ETRPaused;
+        
+        iDecoderResourceLost = aFromDecoder;
+        
+        if (!aFromDecoder)
+            iVideoEncoderClient->Pause();
+        
+        // Return decoded picture    
+        if (iWaitNewDecodedPicture)
+            {
+            iVideoDecoderClient->ReturnPicture(iWaitNewDecodedPicture);
+            iWaitNewDecodedPicture = NULL;
+            }
+            
+        iObserver.MtroSuspend();   
+        }
+    
+    PRINT((_L("CTRTranscoderImp::MtrdvcoResourcesLost(), Out")))
+    }
+        
+
+// -----------------------------------------------------------------------------
+// CTRTranscoderImp::::MmvroResourcesRestored
+// Indicates that a media device has regained its resources
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CTRTranscoderImp::MtrdvcoResourcesRestored()
+    {
+    PRINT((_L("CTRTranscoderImp::MtrdvcoResourcesRestored(), In")))
+    
+    if ( (iState == ETRPaused) || (iState == ETRInitialized) || (iState == ETRStopped) )
+        {
+        // Clear all events
+        if( iNewEvent )
+            {
+            iNewEvent->Reset();
+            iTranscoderEventSrc.AddLast(*iNewEvent);
+            iNewEvent = NULL;
+            }
+            
+        while( !iTranscoderEventQueue.IsEmpty() )
+            {
+            // Get new event
+            iNewEvent = iTranscoderEventQueue.First();
+            iNewEvent->iLink.Deque();
+            
+            iNewEvent->Reset();
+            iTranscoderEventSrc.AddLast(*iNewEvent);
+            iNewEvent = NULL;
+            }
+            
+        if( iAsyncEvent )
+            {
+            iAsyncEvent->Reset();
+            iTranscoderEventSrc.AddLast(*iAsyncEvent);
+            iAsyncEvent = NULL;
+            }
+            
+        while( !iTranscoderAsyncEventQueue.IsEmpty() )
+            {
+            // Get new event
+            iAsyncEvent = iTranscoderAsyncEventQueue.First();
+            iAsyncEvent->iLink.Deque();
+            
+            iAsyncEvent->Reset();
+            iTranscoderEventSrc.AddLast(*iAsyncEvent);
+            iAsyncEvent = NULL;
+            }
+            
+        // Force update of PS / EE settings
+        iPictureSinkSettingChanged = ETrue;
+        iEncoderEnabledSettingChanged = ETrue;
+        
+        TRAPD( error, iVideoDecoderClient->ResumeL() );
+        if( error != KErrNone ) { }
+        
+        if (!iDecoderResourceLost)
+            {
+            iVideoEncoderClient->Resume();            
+            }
+
+        iState = ETRRunning;
+        
+        iObserver.MtroResume();   
+        }
+    
+    PRINT((_L("CTRTranscoderImp::MtrdvcoResourcesRestored(), Out")))
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/src/Ctrvideodecoderclient.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1468 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Video decoder client.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <devvideoconstants.h>
+#include "ctrvideodecoderclient.h"
+#include "ctrtranscoder.h"
+#include "ctrdevvideoclientobserver.h"
+#include "ctrsettings.h"
+#include "ctrhwsettings.h"
+
+
+// MACROS
+#define TRASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CTRANSCODERVIDEODECODERCLIENT"), -10010))
+
+
+// CONSTANTS
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTRVideoDecoderClient* CTRVideoDecoderClient::NewL(MTRDevVideoClientObserver& aObserver)
+    {
+    PRINT((_L("CTRVideoDecoderClient::NewL(), In")))
+    CTRVideoDecoderClient* self = new (ELeave) CTRVideoDecoderClient(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    PRINT((_L("CTRVideoDecoderClient::NewL(), Out")))
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::CTRVideoDecoderClient
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CTRVideoDecoderClient::CTRVideoDecoderClient(MTRDevVideoClientObserver& aObserver) :
+    iObserver(aObserver)
+    {
+    iDevVideoPlay = NULL;
+    iCompresedFormat = NULL;
+    iUid = TUid::Null();
+    iFallbackUid = TUid::Null();
+    iHwDeviceId = THwDeviceId(0);
+    iInputBuffer = NULL;
+    iCodedBuffer = NULL;
+    iDecodedPicture = NULL;
+    
+    iVideoResourceHandlerCI = NULL;   
+    
+    iFatalError = KErrNone;
+    iDataUnitType = EDuCodedPicture;
+    iStop = EFalse;
+    iLastTimestamp = -1;
+    iAcceleratedCodecSelected = EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::ConstructL()
+    {
+    iDevVideoPlay = CMMFDevVideoPlay::NewL(*this);
+    }
+
+
+// ---------------------------------------------------------
+// CTRVideoDecoderClient::~CTRVideoDecoderClient()
+// Destructor
+// ---------------------------------------------------------
+//
+CTRVideoDecoderClient::~CTRVideoDecoderClient()
+    {
+    PRINT((_L("CTRVideoDecoderClient::~CTRVideoDecoderClient(), In")))
+
+    if (iDevVideoPlay)
+        {
+        delete iDevVideoPlay;
+        iDevVideoPlay = NULL;
+        }
+
+    iInputBuffer = NULL;
+    
+    if (iCompresedFormat)
+        {
+        delete iCompresedFormat;
+        }
+
+    PRINT((_L("CTRVideoDecoderClient::~CTRVideoDecoderClient(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::SupportsCodec
+// Checks whether this coded is supported
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CTRVideoDecoderClient::SupportsCodec(const TDesC8& aFormat, const TDesC8& aShortFormat, TInt aUid, TInt aFallbackUid)
+    {
+    TBool supports = EFalse;
+    TBool preferredFound = EFalse;
+    TBool fallbackFound = EFalse;
+
+    if (iDevVideoPlay)
+        {
+        RArray<TUid> decoders;
+        
+        TRAPD( status, iDevVideoPlay->FindDecodersL(aShortFormat, 0/*aPreProcType*/, decoders, EFalse/*aExactMatch*/) );
+
+        if( status != KErrNone  )
+            {
+            PRINT((_L("CTRVideoDecoderClient::SupportsCodec(), status[%d]"), status))
+            supports = EFalse;
+            }
+        else if( decoders.Count() <= 0 )
+            {
+            PRINT((_L("CTRVideoDecoderClient::SupportsCodec(), No decoders found")))
+            supports = EFalse;
+            }
+        else
+            {
+            
+            PRINT((_L("CTRVideoDecoderClient::SupportsCodec(), %d decoders found"), decoders.Count() ))
+            
+            // Check if any of the found decoders matches with the given Uids
+            for( TInt i = 0; i < decoders.Count(); ++i )
+                {
+                
+                PRINT((_L("CTRVideoDecoderClient::SupportsCodec(), found codec 0x%x"), decoders[i].iUid))
+                
+                if( decoders[i].iUid == aUid )
+                    {
+                    PRINT((_L("CTRVideoDecoderClient::SupportsCodec(), preferred found")))
+                    iUid = decoders[i];
+                    preferredFound = ETrue;
+                    }
+                if( decoders[i].iUid == aFallbackUid )
+                    {
+                    PRINT((_L("CTRVideoDecoderClient::SupportsCodec(), fallback found")))
+                    iFallbackUid = decoders[i];
+                    fallbackFound = ETrue;
+                    }
+                
+                if( preferredFound && fallbackFound )
+                    {
+                    // No need to search anymore
+                    break;
+                    }
+                }
+            }
+
+        decoders.Reset();
+        decoders.Close();
+        }
+        
+    if( !preferredFound )
+        {
+        // Preferred decoder was not found => Probably the given decoder Uid is wrong
+        PRINT((_L("CTRVideoDecoderClient::SupportsCodec(), No supported decoders found")))
+        supports = EFalse;
+        }
+    else
+        {
+        PRINT((_L("CTRVideoDecoderClient::SupportsCodec(), Supported decoder found: 0x%x"), iUid.iUid))
+        iMimeType = aFormat;
+        iShortMimeType = aShortFormat;
+        supports = ETrue;
+        }
+
+    return supports;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::SetCodecParametersL
+// Sets codec parameters
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::SetCodecParametersL(TInt aCodecType, TInt aCodecLevel, const TTRVideoFormat& aInputFormat, 
+                                                const TTRVideoFormat& aOutputFormat)
+    {
+    PRINT((_L("CTRVideoDecoderClient::SetCodecParametersL(), In")))
+    TInt status = KErrNone;
+    iCodecType = aCodecType;
+    iCodecLevel = aCodecLevel;
+    iInputFormat = aInputFormat;
+    iOutputFormat = aOutputFormat;
+
+    // Input format
+    if (!iCompresedFormat)
+        {
+        iCompresedFormat = CCompressedVideoFormat::NewL( iMimeType );
+        }
+        
+    TRAP( status, iAcceleratedCodecSelected = CheckCodecInfoL(iUid) );
+    
+    if (status != KErrNone)
+        {
+        // Try again with the fallback decoder if one exists
+        if( (iFallbackUid != TUid::Null()) && (iFallbackUid.iUid != iUid.iUid) )
+            {
+            TRAP( status, iAcceleratedCodecSelected = CheckCodecInfoL(iFallbackUid) );
+            
+            if (status != KErrNone)
+                {
+                PRINT((_L("CTRVideoDecoderClient::SetCodecParametersL(), Failed to get codec info")))
+                User::Leave(KErrNotSupported);
+                }
+                
+            PRINT((_L("CTRVideoDecoderClient::SetCodecParametersL(), Reverting to fallback decoder")))
+            
+            // Fallback ok, take it    
+            iUid = iFallbackUid;
+            }
+        else
+            {
+            PRINT((_L("CTRVideoDecoderClient::SetCodecParametersL(), No suitable decoders found")))
+            User::Leave(KErrNotSupported);
+            }
+        }
+      
+    PRINT((_L("CTRVideoDecoderClient::SetCodecParametersL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::CheckCodecInfoL
+// Checks coded info
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CTRVideoDecoderClient::CheckCodecInfoL(TUid aUid)
+    {
+    CVideoDecoderInfo* decoderInfo = NULL; // Decoder info for retrieving capabilities
+    TInt status = KErrNone;
+    TBool accelerated = EFalse;
+
+
+    // Check decoder
+    PRINT((_L("CTRVideoDecoderClient::CheckCodecInfoL(), getting info from [0x%x]"), aUid.iUid ))
+    decoderInfo = iDevVideoPlay->VideoDecoderInfoLC( aUid );
+
+    if (!decoderInfo)
+        {
+        PRINT((_L("CTRVideoDecoderClient::CheckCodecInfoL(), getting info from [0x%x] failed[%d]"), aUid.iUid, status ))
+        User::Leave(KErrNotSupported);
+        } //  AA skip info check before symbian fix
+    else /* if ( !decoderInfo->SupportsFormat(*iCompresedFormat) ) // Check input format
+        {
+        PRINT((_L("CTRVideoDecoderClient::CheckCodecInfoL(), Input format is not supported")))
+        status = KErrNotSupported;
+        }
+    else */
+        {
+        // Check max rate for requested image format
+        TSize maxSize = decoderInfo->MaxPictureSize();
+
+        if ( (iInputFormat.iSize.iWidth > maxSize.iWidth) || (iInputFormat.iSize.iHeight > maxSize.iHeight) )
+            {
+            PRINT((_L("CTRVideoDecoderClient::CheckCodecInfoL(), Picture size is not supported")))
+            status = KErrNotSupported;
+            }
+        }
+        
+    accelerated = decoderInfo->Accelerated();
+
+    // Delete codec info
+    CleanupStack::PopAndDestroy(decoderInfo);
+
+    if (status != KErrNone)
+        {
+        User::Leave(status);
+        }
+
+    return accelerated;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::InitializeL
+// Initializes encoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::InitializeL()
+    {
+    PRINT((_L("CTRVideoDecoderClient::InitializeL(), In")))
+    TUint maxBufferSize = 0;
+    TInt status = KErrNone;
+
+
+    switch(iInputFormat.iDataType)
+        {
+        case CTRTranscoder::ETRDuCodedPicture:
+            {
+            iDataUnitType = EDuCodedPicture;
+            break;
+            }
+
+        case CTRTranscoder::ETRDuVideoSegment:
+            {
+            iDataUnitType = EDuVideoSegment;
+            break;
+            }
+
+        default:
+            {
+            // Should never happend. Decoder does not support uncompressed input format. 
+            TRASSERT(0);
+            }
+        }
+
+    iBufferOptions.iMinNumInputBuffers = KTRDecoderMinNumberOfBuffers;
+
+    // Select decoder first
+    this->SelectDecoderL();
+
+    // Set now output format for this device    
+    TRAP(status, iDevVideoPlay->SetOutputFormatL(iHwDeviceId, iUncompressedFormat));
+    
+    // 3. Buffer options
+    iBufferOptions.iPreDecodeBufferSize = 0;            // "0" - use default decoder value
+    iBufferOptions.iMaxPostDecodeBufferSize = 0;        // No limitations
+    iBufferOptions.iPreDecoderBufferPeriod = 0;
+    iBufferOptions.iPostDecoderBufferPeriod = 0;
+    
+    // Check max coded picture size for specified codec level
+    switch(iCodecLevel)
+        {
+        case KTRH263CodecLevel10:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel10;
+            break;
+            }
+
+        case KTRH263CodecLevel20:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel20;
+            break;
+            }
+
+        case KTRH263CodecLevel30:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel30;
+            break;
+            }
+
+        case KTRH263CodecLevel40:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel40;
+            break;
+            }
+
+        case KTRH263CodecLevel50:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel50;
+            break;
+            }
+
+        case KTRH263CodecLevel60:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel60;
+            break;
+            }
+
+        case KTRH263CodecLevel70:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel70;
+            break;
+            }
+            
+        case KTRH264CodecLevel10:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level10;
+            break;
+            }
+            
+        case KTRH264CodecLevel10b:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level10b;
+            break;
+            }
+            
+        case KTRH264CodecLevel11:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level11;
+            break;
+            }
+            
+        case KTRH264CodecLevel12:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level12;
+            break;
+            }
+            
+        case KTRH264CodecLevel13:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level13;
+            break;
+            }
+            
+        case KTRH264CodecLevel20:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level20;
+            break;
+            }
+            
+        case KTRH264CodecLevel30:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level30;
+            break;
+            }
+            
+        case KTRH264CodecLevel31:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level31;
+            break;
+            }
+
+        case KTRMPEG4CodecLevel0:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel0;
+            break;
+            }
+            
+        case KTRMPEG4CodecLevel1:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel1;
+            break;
+            }
+            
+        case KTRMPEG4CodecLevel2:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel2;
+            break;
+            }
+            
+        case KTRMPEG4CodecLevel3:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel3;
+            break;
+            }
+
+        case KTRMPEG4CodecLevel0b:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel0b;
+            break;
+            }
+
+        case KTRMPEG4CodecLevel4a:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel4a;
+            break;
+            }
+
+        default:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel0;
+            break;
+            }
+        }
+
+    iBufferOptions.iMaxInputBufferSize = maxBufferSize;
+    PRINT((_L("CTRVideoDecoderClient::InitializeL(), InputBufferSize[%d], NumberOfBuffers[%d]"), 
+               iBufferOptions.iMaxInputBufferSize, iBufferOptions.iMinNumInputBuffers ))
+
+    iDevVideoPlay->SetBufferOptionsL(iBufferOptions);
+    
+    if (iScalingInUse)
+        {
+        PRINT((_L("CTRVideoDecoderClient::InitializeL(), Enabling scaling")))
+        if (iScalingWithDeblocking)
+            {
+            // Enable scaling with deblocking
+            iDevVideoPlay->SetPostProcessTypesL(iHwDeviceId, EPpScale | EPpDeblocking);
+            }
+        else
+            {
+            // Deblocking not supported, enable just scaling
+            iDevVideoPlay->SetPostProcessTypesL(iHwDeviceId, EPpScale);
+            }
+        
+        iDevVideoPlay->SetScaleOptionsL(iHwDeviceId, iScaledOutputSize, EFalse);
+        }
+
+    // Initialize devVideoPlay
+    iDevVideoPlay->Initialize();
+
+    PRINT((_L("CTRVideoDecoderClient::InitializeL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::SelectDecoderL
+// Selects decoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::SelectDecoderL()
+    {
+    PRINT(( _L("CTRVideoDecoderClient::SelectDecoderL(), In") ))
+    TInt status = KErrNone;
+    TBool exit = EFalse;
+    
+    TVideoDataUnitEncapsulation dataUnitEncapsulation = EDuElementaryStream;
+    
+    // Use generic payload encapsulation for H.264
+    if (iCodecType == EH264)
+        {
+        dataUnitEncapsulation = EDuGenericPayload;
+        }
+
+    if (iUid != TUid::Null())
+        {
+        TRAP( status, iHwDeviceId = iDevVideoPlay->SelectDecoderL(iUid) );
+        }
+    else
+        {
+        // Probably the error already exists, if iUid == NULL; 
+        status = KErrAlreadyExists;
+        }
+
+    while (!exit )
+        {
+        if (status == KErrNone)
+            {
+            // To get Output format list devvideoplay requires to define output format first. 
+            iDevVideoPlay->SetInputFormatL(iHwDeviceId, *iCompresedFormat, iDataUnitType, dataUnitEncapsulation, ETrue);
+
+            // It's time to check input format support (since the plugin is loaded to the memory)
+            iUncompressedFormat.iDataFormat = EYuvRawData;
+            
+            TUncompressedVideoFormat uncFormat;
+            TBool found = EFalse;
+            TInt pattern1, pattern2;
+            TInt dataLayout;
+                    
+            switch (iOutputFormat.iDataType)
+                {
+                case CTRTranscoder::ETRYuvRawData420:
+                    {
+                    pattern1 = EYuv420Chroma1;
+                    pattern2 = EYuv420Chroma2;
+                    dataLayout = EYuvDataPlanar;
+                    }
+                    break;
+
+                case CTRTranscoder::ETRYuvRawData422:
+                    {
+                    pattern1 = EYuv422Chroma1;
+                    pattern2 = EYuv422Chroma2;
+                    dataLayout = EYuvDataInterleavedBE;
+                    }
+                    break;
+                
+                default:
+                    {
+                    // set 420 as a default
+                    pattern1 = EYuv420Chroma1;
+                    pattern2 = EYuv420Chroma2;
+                    dataLayout = EYuvDataPlanar;
+                    }
+                }
+                
+            RArray<TUncompressedVideoFormat> supportedOutputFormats; 
+            TRAP(status, iDevVideoPlay->GetOutputFormatListL( iHwDeviceId, supportedOutputFormats ));
+            
+            TInt formatCount = 0;
+            if (status == KErrNone)
+                {
+                formatCount = supportedOutputFormats.Count();
+                PRINT((_L("CTRVideoDecoderClient::InitializeL(), formatCount[%d]"), formatCount ))
+                }
+                
+            if (formatCount <= 0)
+                {
+                supportedOutputFormats.Close();
+                status = KErrAlreadyExists;
+                PRINT((_L("CTRVideoDecoderClient::InitializeL(), There are no supported output formats") ))
+                //User::Leave(KErrNotSupported);
+                }
+            else
+                {
+                // Check the most important paramers
+                for ( TInt i = 0; i < formatCount; i ++ )
+                    {
+                    uncFormat = supportedOutputFormats[i];
+                    PRINT((_L("CTRVideoDecoderClient::InitializeL(), pattern[%d]"), uncFormat.iYuvFormat.iPattern ))
+                    
+                    if ( (uncFormat.iDataFormat == iUncompressedFormat.iDataFormat) &&
+                         (uncFormat.iYuvFormat.iDataLayout == dataLayout) &&
+                         ( (uncFormat.iYuvFormat.iPattern == pattern1) || 
+                           (uncFormat.iYuvFormat.iPattern == pattern2) ) )
+                        {
+                        // Assign the rest of parameters
+                        iUncompressedFormat = uncFormat;
+                        found = ETrue;
+                        exit = ETrue;
+                        supportedOutputFormats.Close();
+                        break;
+                        }
+                    }
+
+                if (!found)
+                    {
+                    supportedOutputFormats.Close();
+                    status = KErrAlreadyExists;
+                    PRINT((_L("CTRVideoDecoderClient::SelectDecoderL(), Supported format was not found") ))
+                    //User::Leave(KErrNotSupported);
+                    }
+                }
+            
+            }
+        else
+            {
+            if (iScalingInUse)
+                {
+                // We can't revert to fallback decoder here since scaling has been taken into use
+                // and we can't check here if the fallback decoder supports scaling nor
+                // disable scaling if it's not supported
+                PRINT((_L("CTRVideoDecoderClient::SelectDecoderL(), Failed to select decoder")))
+                User::Leave(KErrNotSupported);
+                }
+                
+            // Try again with the fallback decoder if one exists
+            if( (iFallbackUid != TUid::Null()) && (iFallbackUid.iUid != iUid.iUid) )
+                {
+                PRINT((_L("CTRVideoDecoderClient::SelectEncoderL(), Reverting to fallback decoder")))
+                iUid = iFallbackUid;
+                }
+            else
+                {
+                PRINT((_L("CTRVideoDecoderClient::SelectDecoderL(), Failed to select decoder")))
+                User::Leave(KErrNotSupported);
+                }
+                
+            TRAP( status, iAcceleratedCodecSelected = CheckCodecInfoL(iUid) );
+            
+            if (status != KErrNone)
+                {
+                PRINT((_L("CTRVideoDecoderClient::SelectDecoderL(), Failed to get codec info")))
+                User::Leave(KErrNotSupported);
+                }
+              
+            TRAP(status, iHwDeviceId = iDevVideoPlay->SelectDecoderL(iUid));
+            
+            if (status != KErrNone)
+                {
+                PRINT((_L("CTRVideoDecoderClient::SelectDecoderL(), Failed to select decoder")))
+                User::Leave(KErrNotSupported);
+                }
+            }
+        }
+
+    PRINT((_L("CTRVideoDecoderClient::SelectDecoderL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoInitComplete
+// Notifies for initialization complete with init status
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoInitComplete(TInt aError)
+    {
+    if ((aError == KErrHardwareNotAvailable) || (aError == KErrNotSupported))
+        {
+        PRINT((_L("CTRVideoDecoderClient::MdvpoInitComplete(), Error in initialization")))
+        
+        // Map both error codes to the same
+        aError = KErrNotSupported;
+        
+        // Try again with the fallback decoder if one exists
+        while( (iFallbackUid != TUid::Null()) && (iFallbackUid.iUid != iUid.iUid) )
+            {
+            PRINT((_L("CTRVideoDecoderClient::MdvpoInitComplete(), Reverting to fallback decoder")))
+            
+            iUid = iFallbackUid;
+            
+            // Devvideo must be recreated from scratch
+            if (iDevVideoPlay)
+                {
+                delete iDevVideoPlay;
+                iDevVideoPlay = NULL;
+                }
+            
+            TRAPD( status, iDevVideoPlay = CMMFDevVideoPlay::NewL(*this) );
+            if (status != KErrNone)
+                {
+                // Something went wrong, let CTRTranscoderImp handle the error
+                PRINT((_L("CTRVideoDecoderClient::MdvpoInitComplete(), Failed to create DevVideoPlay")))
+                break;
+                }
+                
+            TRAP( status, iAcceleratedCodecSelected = CheckCodecInfoL(iUid) );
+            if (status != KErrNone)
+                {
+                // Fallback decoder can not be used, let CTRTranscoderImp handle the error
+                PRINT((_L("CTRVideoDecoderClient::MdvpoInitComplete(), Failed to get codec info")))
+                break;
+                }
+            
+            // We are now ready to reinitialize the decoder, let CTRTranscoderImp do it    
+            aError = KErrHardwareNotAvailable;
+            break;
+            }
+        }
+    
+    iObserver.MtrdvcoDecInitializeComplete(aError);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::StartL
+// Starts decoding
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::StartL()
+    {
+    PRINT((_L("CTRVideoDecoderClient::StartL(), In")))
+
+    // Start decoding
+    if (iFatalError == KErrNone)
+        {
+        iDevVideoPlay->Start();
+        }
+
+    if (!iInputBuffer)
+        {
+        // Get buffer from the decoder to fill
+        iInputBuffer = iDevVideoPlay->GetBufferL(iBufferOptions.iMaxInputBufferSize);
+        }
+    
+    // Reset iStop    
+    iStop = EFalse;
+    iPause = EFalse;
+    
+    // Reset ts monitor
+    iLastTimestamp = -1;
+
+    PRINT((_L("CTRVideoDecoderClient::StartL(), Out")))
+    }
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::Pause
+// Pauses decoding
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::Pause()
+    {
+    PRINT((_L("CTRVideoDecoderClient::Pause(), In")))
+
+    // Pause decoding
+    iDevVideoPlay->Pause();
+    
+    // Return coded buffer to client since it can not be send to decoder now
+    if (iCodedBuffer)
+        {
+        CCMRMediaBuffer* codedBuffer = iCodedBuffer;
+        
+        // Reset buffer ptr
+        iCodedBuffer = NULL;
+        
+        iObserver.MtrdvcoReturnCodedBuffer(codedBuffer);
+        }
+    
+    // Get all pictures from devvideoplay and return them to decoder
+    TVideoPicture* picture = NULL;    
+    TRAPD(status, picture = iDevVideoPlay->NextPictureL());
+    
+    while ((picture != NULL) && (status == KErrNone))
+        {
+        PRINT((_L("CTRVideoDecoderClient::Pause(), Sending picture [0x%x] back to decoder"), picture))
+        
+        iDevVideoPlay->ReturnPicture(picture);
+        picture = NULL;
+        
+        TRAP(status, picture = iDevVideoPlay->NextPictureL());
+        }
+    
+    // Input buffer is not valid anymore   
+    iInputBuffer = NULL;    
+        
+    iPause = ETrue;
+    
+    PRINT((_L("CTRVideoDecoderClient::Pause(), Out")))
+    }
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::ResumeL
+// Resumes decoding
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::ResumeL()
+    {
+    PRINT((_L("CTRVideoDecoderClient::ResumeL(), In")))
+
+    // Start decoding
+    if (iFatalError == KErrNone)
+        {
+        iDevVideoPlay->Resume();
+        }
+
+    if (!iInputBuffer)
+        {
+        // Get buffer from the decoder to fill
+        iInputBuffer = iDevVideoPlay->GetBufferL(iBufferOptions.iMaxInputBufferSize);
+        }
+    
+    // Reset ts monitor
+    iLastTimestamp = -1;
+    
+    iPause = EFalse;
+
+    PRINT((_L("CTRVideoDecoderClient::ResumeL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoNewBuffers()
+// New buffers are available
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoNewBuffers()
+    {
+    TInt status = KErrNone;
+
+
+    if (iStop)
+        {
+        PRINT((_L("CTRVideoDecoderClient::MdvpoNewBuffers(), Stop was already called, nothing to do")))
+        return;
+        }
+
+    // One or more new empty input buffers are available
+    if (!iInputBuffer)
+        {
+        // Get buffer from the decoder to fill
+        TRAP(status, iInputBuffer = iDevVideoPlay->GetBufferL(iBufferOptions.iMaxInputBufferSize));
+        
+        if (status != KErrNone)
+            {
+            PRINT((_L("CTRVideoDecoderClient::MdvpoNewBuffers(), GetBufferL status[%d]"), status))
+            iObserver.MtrdvcoFatalError(status);
+            return;
+            }
+
+        if (!iInputBuffer)
+            {
+            PRINT((_L("CTRVideoDecoderClient::MdvpoNewBuffers(), There are available buffer, but decoder returned NULL")))
+            
+            // Report an error or wait for the next MdvpoNewBuffers ?: Wait, GetBufferL is called when client send new coded buffer. 
+            //iObserver.MtrdvcoFatalError(KErrAlreadyExists);
+            return;
+            }
+        }
+
+    if (iCodedBuffer)
+        {
+        CCMRMediaBuffer* codedBuffer = iCodedBuffer;
+        
+        // Reset buffer ptr
+        iCodedBuffer = NULL;
+        
+        // Send coded buffer, since the client has already done request
+        TRAP(status, this->SendBufferL(codedBuffer));
+        if (status != KErrNone)
+            {
+            PRINT((_L("CTRVideoDecoderClient::MdvpoNewBuffers(), Send buffer error[%d]"), status))
+            iObserver.MtrdvcoFatalError(status);
+            return;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::WriteCodedBufferL
+// Writes coded data to decoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::WriteCodedBufferL(CCMRMediaBuffer* aBuffer)
+    {
+    PRINT((_L("CTRVideoDecoderClient::WriteCodedBufferL(), In")))
+    CCMRMediaBuffer::TBufferType bufferType;
+    
+    if (!aBuffer)
+        {
+        PRINT((_L("CTRVideoDecoderClient::WriteCodedBufferL(), Input buffer is invalid, Leave")))
+        User::Leave(KErrArgument);
+        }
+
+    if (iFatalError != KErrNone)
+        {
+        PRINT((_L("CTRVideoDecoderClient::WriteCodedBufferL(), FatalError was reported by decoder")))
+        
+        // Return coded buffer
+        iObserver.MtrdvcoReturnCodedBuffer(aBuffer);
+        return;
+        }
+    
+    TTimeIntervalMicroSeconds ts = aBuffer->TimeStamp();
+        
+    if ( ts <= iLastTimestamp)
+        {
+        // Prevent propagation of the error now
+        PRINT((_L("CTRVideoDecoderClient::WriteCodedBufferL(), Client sends invalid data (ts field), Leave")))
+        User::Leave(KErrArgument);
+        }
+    else
+        {
+        iLastTimestamp = ts;
+        }
+    
+    if (aBuffer->BufferSize() <= 0)
+        {
+        PRINT((_L("CTRVideoDecoderClient::WriteCodedBufferL(), Input data buffer is invalid (empty), Leave")))
+        User::Leave(KErrArgument);
+        }
+        
+    bufferType = aBuffer->Type();
+        
+    if ( ( bufferType != CCMRMediaBuffer::EVideoH263 ) && 
+         ( bufferType != CCMRMediaBuffer::EVideoMPEG4 ) )   // : Add H264
+        {
+        PRINT((_L("CTRVideoDecoderClient::WriteCodedBufferL(), [%d] This data type is not supported, Leave"), aBuffer->Type() ))
+        User::Leave(KErrNotSupported);
+        }
+
+    if (!iInputBuffer)
+        {
+        // Request new empty buffer
+        iInputBuffer = iDevVideoPlay->GetBufferL(iBufferOptions.iMaxInputBufferSize);
+        }
+
+    if (iInputBuffer)
+        {
+        this->SendBufferL(aBuffer);
+        }
+    else
+        {
+        iCodedBuffer = aBuffer;
+        }
+
+    PRINT((_L("CTRVideoDecoderClient::WriteCodedBufferL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::SendBufferL
+// Sends buffer to decoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::SendBufferL(CCMRMediaBuffer* aBuffer)
+    {
+    PRINT((_L("CTRVideoDecoderClient::SendBufferL(), In")))
+    
+    if (iStop)
+        {
+        PRINT((_L("CTRVideoDecoderClient::SendBufferL(), Stop was already called, nothing to do, out")))
+        iObserver.MtrdvcoReturnCodedBuffer(aBuffer);
+        return;
+        }
+
+    PRINT((_L("CTRVideoDecoderClient::SendBufferL(), iInputBuffer[%d], aBuffer[%d]"), iInputBuffer->iData.MaxLength(), 
+               aBuffer->BufferSize() ))
+
+    if ( iInputBuffer->iData.MaxLength() < aBuffer->BufferSize() )
+        {
+        PRINT((_L("CTRVideoDecoderClient::SendBufferL(), buffer length exceeds max length")))
+        User::Leave(KErrOverflow);
+        }
+
+    iInputBuffer->iData.Copy( aBuffer->Data().Ptr(), aBuffer->BufferSize() );
+    iInputBuffer->iData.SetLength( aBuffer->BufferSize() );
+
+    // Data unit presentation timestamp. Valid if EPresentationTimestamp is set in the options. 
+    // If the input bitstream does not contain timestamp information, this field should be valid, 
+    // otherwise pictures cannot be displayed at the correct time. If the input bitstream contains 
+    // timestamp information (such as the TR syntax element of H.263 bitstreams) and valid 
+    // iPresentationTimestamp is provided, the value of iPresentationTimestamp is used in playback.    
+    iInputBuffer->iOptions = TVideoInputBuffer::EPresentationTimestamp;
+    iInputBuffer->iPresentationTimestamp = aBuffer->TimeStamp();
+    /*Other data: TBC*/
+    
+    TVideoInputBuffer* inputBuffer = iInputBuffer;
+    
+    // Reset InputBuffer ptr
+    iInputBuffer = NULL;
+
+    // Write data to decoder
+    iDevVideoPlay->WriteCodedDataL(inputBuffer);
+
+    //  return buffer only after it's writtent to decoder (client could write next buffer synchronously from observer call)
+    // Return buffer to the client immediately after copying
+    iObserver.MtrdvcoReturnCodedBuffer(aBuffer);
+
+    PRINT((_L("CTRVideoDecoderClient::SendBufferL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoNewPictures
+// New decoded pictures available from decoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoNewPictures()
+    {
+    PRINT((_L("CTRVideoDecoderClient::MdvpoNewPictures(), In")))
+    
+    TInt status = KErrNone;
+
+    // 1 or more decoded pictures are available
+    if (!iDecodedPicture)
+        {
+        // Get new picture
+        TRAP(status, iDecodedPicture = iDevVideoPlay->NextPictureL());
+
+        if (status != KErrNone)
+            {
+            PRINT((_L("CTRVideoDecoderClient::MdvpoNewPictures(), NextPicture status[%d]"), status))
+            iObserver.MtrdvcoFatalError(status);
+            return;
+            }
+
+        if (!iDecodedPicture)
+            {
+            // Error: DevVideo notified of new buffers, but returns NULL
+            PRINT((_L("CTRVideoDecoderClient::MdvpoNewPictures(), DevVideo notified of new buffers, but returns NULL")))
+            iObserver.MtrdvcoFatalError(KErrAlreadyExists);
+            return;
+            }
+
+        // Send new picture to the client
+        iObserver.MtrdvcoNewPicture(iDecodedPicture);
+        }
+    else
+        {
+        // Previous picture still was not returned by the client, nothing to do. 
+        //  SetActive();  // ???
+        }
+        
+    PRINT((_L("CTRVideoDecoderClient::MdvpoNewPictures(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::ReturnPicture
+// Returns picture 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::ReturnPicture(TVideoPicture* aPicture)
+    {
+    PRINT((_L("CTRVideoDecoderClient::ReturnPicture(), In")))
+    TInt status = KErrNone;
+
+
+    iDevVideoPlay->ReturnPicture(aPicture);
+
+    // Reset decoded picture
+    iDecodedPicture = NULL;
+    
+    if (iPause)
+        {
+        // Nothing else to do when paused
+        PRINT((_L("CTRVideoDecoderClient::ReturnPicture(), Out")))
+        return;
+        }
+
+    TRAP(status, iDecodedPicture = iDevVideoPlay->NextPictureL());
+
+    if (status != KErrNone)
+        {
+        PRINT((_L("CTRVideoDecoderClient::ReturnPicture(), NextPicture status[%d]"), status))
+        iObserver.MtrdvcoFatalError(status);
+        return;
+        }
+
+    if (iDecodedPicture)
+        {
+        // Send new picture to the client
+        iObserver.MtrdvcoNewPicture(iDecodedPicture);
+        }
+
+    PRINT((_L("CTRVideoDecoderClient::ReturnPicture(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::StopL
+// Stops decoding synchronously
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::StopL()
+    {
+    PRINT((_L("CTRVideoDecoderClient::StopL(), In")))
+    
+    iStop = ETrue;
+    iPause = EFalse;
+
+    if (iFatalError == KErrNone)
+        {
+        iDevVideoPlay->Stop();
+        }
+        
+    PRINT((_L("CTRVideoDecoderClient::StopL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::AsyncStopL
+// Stops decoding asynchronously
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::AsyncStopL()
+    {
+    PRINT((_L("CTRVideoDecoderClient::StopL(), Async In")))
+
+    if (iFatalError == KErrNone)
+        {
+        iDevVideoPlay->InputEnd();
+        }
+        
+    iStop = ETrue;
+
+    PRINT((_L("CTRVideoDecoderClient::StopL(), Async Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoStreamEnd
+// Indicates when stream end is reached
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoStreamEnd()
+    {
+    PRINT((_L("CTRVideoDecoderClient::MdvpoStreamEnd()")))
+    iObserver.MtrdvcoDecStreamEnd();
+    }
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoReturnPicture
+// Returns a used input video picture back to the caller. The picture memory can be re-used or freed (only relevant to postprocessor)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoReturnPicture(TVideoPicture* /*aPicture*/)
+    {
+    PRINT((_L("CTRVideoDecoderClient::MdvpoReturnPicture()")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoSupplementalInformation
+// Sends SupplementalInformation
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoSupplementalInformation(const TDesC8& /*aData*/, 
+                                                         const TTimeIntervalMicroSeconds& /*aTimestamp*/, 
+                                                         const TPictureId& /*aPictureId*/)
+    {
+    PRINT((_L("CTRVideoDecoderClient::MdvpoSupplementalInformation()")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoPictureLoss
+// Back channel information from the decoder, indicating a picture loss without specifying the lost picture
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoPictureLoss()
+    {
+    PRINT((_L("CTRVideoDecoderClient::MdvpoPictureLoss(), report an error")))
+    iObserver.MtrdvcoFatalError(KErrAbort);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoPictureLoss
+// Back channel information from the decoder, indicating the pictures that have been lost
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoPictureLoss(const TArray< TPictureId >& /*aPictures*/)
+    {
+    PRINT((_L("CTRVideoDecoderClient::MdvpoPictureLoss(), pictureId: report an error")))
+    iObserver.MtrdvcoFatalError(KErrAbort);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoSliceLoss
+// Reports that slice is lost
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoSliceLoss(TUint /*aFirstMacroblock*/, TUint /*aNumMacroblocks*/, 
+                                           const TPictureId& /*aPicture*/)
+    {
+    PRINT((_L("CTRVideoDecoderClient::MdvpoSliceLoss()")))
+    // This error is not considered a s fatal for decoder or application, nothing to do
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoReferencePictureSelection
+// Back channel information from the decoder, indicating a reference picture selection request.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoReferencePictureSelection(const TDesC8& /*aSelectionData*/)
+    {
+    PRINT((_L("CTRVideoDecoderClient::MdvpoReferencePictureSelection()")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoTimedSnapshotComplete
+// Called when a timed snapshot request has been completed. 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoTimedSnapshotComplete(TInt /*aError*/, TPictureData* /*aPictureData*/, 
+                                                       const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/, 
+                                                       const TPictureId& /*aPictureId*/)
+    {
+    PRINT((_L("CTRVideoDecoderClient::MdvpoTimedSnapshotComplete()")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MdvpoFatalError
+// Reports the fatal error to the client
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoDecoderClient::MdvpoFatalError(TInt aError)
+    {
+    PRINT((_L("CTRVideoDecoderClient::MdvpoFatalError(), error[%d]"), aError))
+    iFatalError = aError;
+    iObserver.MtrdvcoFatalError(iFatalError);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::EstimateDecodeFrameTimeL
+// Returns a time estimate on long it takes to decode one frame 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+TReal CTRVideoDecoderClient::EstimateDecodeFrameTimeL(const TTRVideoFormat& aInput, TInt aCodecType)
+    {
+    if (iUid == TUid::Null())
+        {
+        PRINT((_L("CTRVideoDecoderClient::EstimateDecodeFrameTimeL(), no decoder selected yet")))
+        User::Leave(KErrNotReady);
+        }
+    
+    TReal time = 0.0;    
+    
+    // Select the predefined constant using the current settings
+    if (aCodecType == EH263)
+        {
+        time = iAcceleratedCodecSelected ? KTRDecodeTimeFactorH263HW : KTRDecodeTimeFactorH263SW;
+        }
+    else if (aCodecType == EH264)
+        {
+        time = iAcceleratedCodecSelected ? KTRDecodeTimeFactorH264HW : KTRDecodeTimeFactorH264SW;
+        }
+    else
+        {
+        time = iAcceleratedCodecSelected ? KTRDecodeTimeFactorMPEG4HW : KTRDecodeTimeFactorMPEG4SW;
+        }
+    
+    // Multiply the time by the resolution of the input frame    
+    time *= static_cast<TReal>(aInput.iSize.iWidth + aInput.iSize.iHeight) * KTRTimeFactorScale;
+    
+    PRINT((_L("CTRVideoDecoderClient::EstimateDecodeFrameTimeL(), decode frame time: %.2f"), time))
+        
+    return time;
+    }
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::SetDecoderScaling
+// Checks if decoder supports scaling and enables scaling if supported
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+TBool CTRVideoDecoderClient::SetDecoderScaling(TSize& aInputSize, TSize& aOutputSize)
+    {
+    PRINT((_L("CTRVideoDecoderClient::SetDecoderScaling(), In")))
+    
+    CPostProcessorInfo* ppInfo = NULL;
+    TBool scalingSupported = EFalse;
+    
+    // Check that the given sizes are valid
+    if( (aInputSize.iWidth == 0) || (aInputSize.iHeight == 0) ||
+        (aOutputSize.iWidth == 0) || (aOutputSize.iHeight == 0) )
+        {
+        PRINT((_L("CTRVideoDecoderClient::SetDecoderScaling(), invalid input/output size")))
+        return EFalse;
+        }
+        
+    iScalingInUse = EFalse;
+    iScalingWithDeblocking = EFalse;
+    
+    if( aInputSize == aOutputSize )
+        {
+        PRINT((_L("CTRVideoDecoderClient::SetDecoderScaling(), scaling disabled")))
+        return EFalse;
+        }
+       
+    // Get post processor info
+    TRAPD( status, ppInfo = iDevVideoPlay->PostProcessorInfoLC( iUid ); CleanupStack::Pop( ppInfo ) );
+
+    if( (status != KErrNone) || !ppInfo )
+        {
+        PRINT((_L("CTRVideoDecoderClient::SetDecoderScaling(), getting info from [0x%x] failed"), iUid.iUid ))
+        return EFalse;
+        }
+        
+    if( ppInfo->SupportsArbitraryScaling() )
+        {
+        PRINT((_L("CTRVideoDecoderClient::SetDecoderScaling(), arbitrary scaling supported")))
+        scalingSupported = ETrue;
+        }
+    else if( (aInputSize.iWidth * aOutputSize.iHeight) != (aInputSize.iHeight * aOutputSize.iWidth) )
+        {
+        // Aspect ratio needs to be changed but decoder does not support arbitrary scaling => not supported
+        scalingSupported = EFalse;
+        }
+    else
+        {        
+        RArray<TScaleFactor> scaleFactors = ppInfo->SupportedScaleFactors();
+        
+        for( TInt i = 0; i < scaleFactors.Count(); ++i )
+            {
+            if( (aInputSize.iWidth * scaleFactors[i].iScaleNum) == (aOutputSize.iWidth * scaleFactors[i].iScaleDenom) )
+                {
+                PRINT((_L("CTRVideoDecoderClient::SetDecoderScaling(), supported scale factors found")))
+                scalingSupported = ETrue;
+                break;
+                }
+            }
+        }
+    
+    if( scalingSupported )
+        {        
+        if( ppInfo->SupportsCombination( EPpScale | EPpDeblocking ) )
+            {
+            // Deblocking should be used with scaling if supported
+            PRINT((_L("CTRVideoDecoderClient::SetDecoderScaling(), deblocking supported")))
+            iScalingWithDeblocking = ETrue;
+            }
+
+        iScalingInUse = ETrue;
+        iScaledOutputSize = aOutputSize;
+        }
+
+    // Delete codec info
+    delete ppInfo;
+    
+    PRINT((_L("CTRVideoDecoderClient::SetDecoderScaling(), Out")))
+    
+    return scalingSupported;
+    }
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::EnableResourceObserver
+// Enable / Disable resourece observer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//     
+void CTRVideoDecoderClient::EnableResourceObserver(TBool aEnable)
+    {
+    PRINT((_L("CTRVideoDecoderClient::EnableResourceObserver(), In")))
+    
+    iVideoResourceHandlerCI = (MMmfVideoResourceHandler*)iDevVideoPlay->CustomInterface( iHwDeviceId, KUidMmfVideoResourceManagement );
+    PRINT((_L("CTRVideoDecoderClient::EnableResourceObserver(), iVideoResourceHandlerCI[0x%x]"), iVideoResourceHandlerCI))
+
+    if (iVideoResourceHandlerCI)
+        {
+        if (aEnable)
+            {
+            iVideoResourceHandlerCI->MmvrhSetObserver(this);
+            PRINT((_L("CTRVideoDecoderClient::EnableResourceObserver(), Enabled")))
+            }
+        else
+            {
+            iVideoResourceHandlerCI->MmvrhSetObserver(NULL);
+            }
+        }
+
+    PRINT((_L("CTRVideoDecoderClient::EnableResourceObserver(), Out")))
+    }
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MmvroResourcesLost
+// Indicates that a media device has lost its resources
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//     
+void CTRVideoDecoderClient::MmvroResourcesLost(TUid /*aMediaDevice*/)
+    {
+    iObserver.MtrdvcoResourcesLost(ETrue);
+    }
+        
+
+// -----------------------------------------------------------------------------
+// CTRVideoDecoderClient::MmvroResourcesRestored
+// Indicates that a media device has regained its resources
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+void CTRVideoDecoderClient::MmvroResourcesRestored(TUid /*aMediaDevice*/)
+    {
+    iObserver.MtrdvcoResourcesRestored();
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/vedtranscoder/src/Ctrvideoencoderclient.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,1824 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:  
+* Video encoder client.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <devvideorecord.h>
+#include <devvideobase.h>
+#include <devvideoconstants.h>
+#include <H263.h>
+#include <AVC.h>
+#include <Mpeg4Visual.h>
+#include "ctrtranscoder.h"
+#include "ctrvideoencoderclient.h"
+#include "ctrdevvideoclientobserver.h"
+#include "ctrsettings.h"
+#include "ctrhwsettings.h"
+
+
+// MACROS
+#define TRASSERT(x) __ASSERT_DEBUG(x, User::Panic(_L("CTRANSCODERVIDEOENCODERCLIENT"), -10000))
+
+
+// CONSTANTS
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTRVideoEncoderClient* CTRVideoEncoderClient::NewL(MTRDevVideoClientObserver& aObserver)
+    {
+    PRINT((_L("CTRVideoEncoderClient::NewL(), In")))
+    CTRVideoEncoderClient* self = new (ELeave) CTRVideoEncoderClient(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    PRINT((_L("CTRVideoEncoderClient::NewL(), Out")))
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::CTRVideoEncoderClient
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CTRVideoEncoderClient::CTRVideoEncoderClient(MTRDevVideoClientObserver& aObserver) :
+    iObserver(aObserver)
+    {
+    iDevVideoRecord = NULL;
+    iOutputMediaBuffer = NULL;
+    iCompresedFormat = NULL;
+    iUid = TUid::Null();
+    iFallbackUid = TUid::Null();
+    iRealTime = EFalse;
+    iState = ETRNone;
+    iCodingOptions.iSyncIntervalInPicture = 0;
+    iCodingOptions.iHeaderExtension = 0;
+    iCodingOptions.iDataPartitioning = EFalse;
+    iCodingOptions.iReversibleVLC = EFalse;
+    iSrcRate = 0.0;
+    iVolHeaderSent = EFalse;
+    iRemoveHeader = EFalse;
+    iVolLength = 0;
+    iRateOptions.iControl = EBrControlStream;
+    iRateOptions.iPictureRate = KTRTargetFrameRateDefault;
+    iRateOptions.iBitrate = KTRMaxBitRateH263Level10;
+    iBitRateSetting = EFalse;
+    iFatalError = KErrNone;
+    iErrorRate = 0.0;
+    iVolHeader = KNullDesC8;
+    iVideoBufferManagementCI = NULL;
+    iLastTimestamp = -1;
+    iAcceleratedCodecSelected = EFalse;
+    iSetRandomAccessPoint = EFalse;
+    iNumH264SPSPPS = 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::ConstructL()
+    {
+    iDevVideoRecord = CMMFDevVideoRecord::NewL(*this);
+    iOutputMediaBuffer = new(ELeave)CCMRMediaBuffer;
+    }
+
+
+// ---------------------------------------------------------
+// CTRVideoEncoderClient::~CTRVideoEncoderClient()
+// Destructor
+// ---------------------------------------------------------
+//
+CTRVideoEncoderClient::~CTRVideoEncoderClient()
+    {
+    PRINT((_L("CTRVideoEncoderClient::~CTRVideoEncoderClient(), In")))
+
+    if (iDevVideoRecord)
+        {
+        delete iDevVideoRecord;
+        iDevVideoRecord = NULL;
+        }
+
+    if (iCompresedFormat)
+        {
+        delete iCompresedFormat;
+        }
+
+    if (iOutputMediaBuffer)
+        {
+        delete iOutputMediaBuffer;
+        }
+        
+    PRINT((_L("CTRVideoEncoderClient::~CTRVideoEncoderClient(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::SupportsInputFormat
+// Checks whether given input format is supported
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CTRVideoEncoderClient::SupportsCodec(const TDesC8& aFormat, const TDesC8& aShortFormat, TInt aUid, TInt aFallbackUid)
+    {
+    TBool supports = EFalse;
+    TBool preferredFound = EFalse;
+    TBool fallbackFound = EFalse;
+    
+    if (iDevVideoRecord)
+        {
+        RArray<TUid> encoders;
+        
+        TRAPD( status, iDevVideoRecord->FindEncodersL(aShortFormat, 0/*aPreProcType*/, encoders, EFalse/*aExactMatch*/) );
+        
+        if( status != KErrNone  )
+            {
+            PRINT((_L("CTRVideoEncoderClient::SupportsCodec(), status[%d]"), status))
+            supports = EFalse;
+            }
+        else if( encoders.Count() <= 0 )
+            {
+            PRINT((_L("CTRVideoEncoderClient::SupportsCodec(), No encoders found")))
+            supports = EFalse;
+            }
+        else
+            {
+            
+            PRINT((_L("CTRVideoEncoderClient::SupportsCodec(), %d encoders found"), encoders.Count() ))
+            
+            // Check if any of the found encoders matches with the given Uids
+            for( TInt i = 0; i < encoders.Count(); ++i )
+                {
+                
+                PRINT((_L("CTRVideoEncoderClient::SupportsCodec(), found codec 0x%x"), encoders[i].iUid))
+                
+                if( encoders[i].iUid == aUid )
+                    {
+                    PRINT((_L("CTRVideoEncoderClient::SupportsCodec(), preferred found")))
+                    iUid = encoders[i];
+                    preferredFound = ETrue;
+                    }
+                if( encoders[i].iUid == aFallbackUid )
+                    {
+                    PRINT((_L("CTRVideoEncoderClient::SupportsCodec(), fallback found")))
+                    iFallbackUid = encoders[i];
+                    fallbackFound = ETrue;
+                    }
+                
+                if( preferredFound && fallbackFound )
+                    {
+                    // No need to search anymore
+                    break;
+                    }
+                }
+            }
+
+        encoders.Reset();
+        encoders.Close();
+        }
+        
+#if !( defined (__WINS__) || defined (__WINSCW__) )
+    if( !preferredFound )
+#else
+    if( !preferredFound && !fallbackFound )
+#endif
+        {
+        // Preferred encoder was not found => Probably the given encoder Uid is wrong
+        PRINT((_L("CTRVideoEncoderClient::SupportsCodec(), No supported encoders found")))
+        supports = EFalse;
+        }
+    else
+        {
+        PRINT((_L("CTRVideoEncoderClient::SupportsCodec(), Supported encoder found: 0x%x"), iUid.iUid))
+        iMimeType = aFormat;
+        iShortMimeType = aShortFormat;
+        supports = ETrue;
+        }
+
+    return supports;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::SetCodecParametersL
+// Sets codec parameters
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::SetCodecParametersL(TInt aCodecType, TInt aCodecLevel, const TTRVideoFormat& aInputFormat, 
+                                                const TTRVideoFormat& aOutputFormat)
+    {
+    PRINT((_L("CTRVideoEncoderClient::SetCodecParametersL(), In")))
+    TInt status = KErrNone;
+    iCodecType = aCodecType;
+    iCodecLevel = aCodecLevel;
+    iPictureSize = aOutputFormat.iSize;
+    iOutputDataType = aOutputFormat.iDataType;
+    
+    // RAW YUV
+    iUncompressedFormat.iDataFormat = EYuvRawData;
+
+    // U & V samples are taken from the middle of four luminance samples
+    // (as specified in H.263 spec)
+    switch ( aInputFormat.iDataType )
+        {
+        case CTRTranscoder::ETRYuvRawData420:
+            {
+            iUncompressedFormat.iYuvFormat.iPattern = EYuv420Chroma2;
+            break;
+            }
+
+        case CTRTranscoder::ETRYuvRawData422:
+            {
+            iUncompressedFormat.iYuvFormat.iPattern = EYuv422Chroma2;
+            break;
+            }
+
+        default:
+            {
+            iUncompressedFormat.iYuvFormat.iPattern = EYuv420Chroma2;
+            break;
+            }
+        }
+
+    // Output format
+    if (!iCompresedFormat)
+        {
+        iCompresedFormat = CCompressedVideoFormat::NewL( iMimeType );
+        }
+        
+    TRAP( status, iAcceleratedCodecSelected = CheckCodecInfoL(iUid) );
+    
+    if (status != KErrNone)
+        {
+        // Try again with the fallback encoder if one exists
+        if( (iFallbackUid != TUid::Null()) && (iFallbackUid.iUid != iUid.iUid) )
+            {
+            TRAP( status, iAcceleratedCodecSelected = CheckCodecInfoL(iFallbackUid) );
+            
+            if (status != KErrNone)
+                {
+                PRINT((_L("CTRVideoEncoderClient::SetCodecParametersL(), Failed to get codec info")))
+                User::Leave(KErrNotSupported);
+                }
+            
+            PRINT((_L("CTRVideoEncoderClient::SetCodecParametersL(), Reverting to fallback encoder")))
+            
+            // Fallback ok, take it   
+            iUid = iFallbackUid;
+            }
+        else
+            {
+            PRINT((_L("CTRVideoEncoderClient::SetCodecParametersL(), No suitable encoders found")))
+            User::Leave(KErrNotSupported);
+            }
+        }          
+        
+    //  AA Set codec here (final hwdevice Uid should be known before checking CI buffermanag support)
+    // Select encoder first
+    this->SelectEncoderL();
+
+    PRINT((_L("CTRVideoEncoderClient::SetCodecParametersL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::CheckCodecInfoL
+// Checks codec info
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CTRVideoEncoderClient::CheckCodecInfoL(TUid aUid)
+    {
+    CVideoEncoderInfo* encoderInfo = NULL; // Encoder info for retrieving capabilities
+    iMaxFrameRate = 0;
+    TInt status = KErrNone;
+    TUint32 dataUnitType = 0;
+    TBool accelerated = EFalse;
+
+    switch(iOutputDataType)
+        {
+        case CTRTranscoder::ETRDuCodedPicture:
+            {
+            dataUnitType = EDuCodedPicture;
+            break;
+            }
+
+        case CTRTranscoder::ETRDuVideoSegment:
+            {
+            dataUnitType = EDuVideoSegment;
+            break;
+            }
+
+        default:
+            {
+            PRINT((_L("CTRVideoEncoderClient::CheckCodecInfoL(), should leave at the earlier stage, panic")))
+            TRASSERT(0);
+            }
+        }
+
+    // Check encoder
+    PRINT((_L("CTRVideoEncoderClient::CheckCodecInfoL(), getting info from [0x%x]"), aUid.iUid ))
+    encoderInfo = iDevVideoRecord->VideoEncoderInfoLC( aUid );
+    
+    PRINT((_L("CTRVideoEncoderClient::CheckCodecInfoL(), info [0x%x]"), encoderInfo ))
+
+    if (!encoderInfo)
+        {
+        PRINT((_L("CTRVideoEncoderClient::CheckCodecInfoL(), getting info from [0x%x] failed[%d]"), aUid.iUid, status ))
+        User::Leave(KErrNotSupported);
+        }
+    else
+        {
+        // Check input format
+        // 1. retrieve supported formats from encoder hwdevice (since exact options are unknown)
+        RArray<TUncompressedVideoFormat> supportedInputFormats = encoderInfo->SupportedInputFormats();
+        
+        TInt formatCount = supportedInputFormats.Count();
+        
+        if (formatCount <= 0)
+            {
+            supportedInputFormats.Close();
+            PRINT((_L("CTRVideoEncoderClient::CheckCodecInfoL(), There are no supported input formats") ))
+            User::Leave(KErrNotSupported);
+            }
+        else
+            {
+            TUncompressedVideoFormat uncFormat;
+            TBool found = EFalse;
+            TInt pattern1, pattern2;
+            TInt dataLayout;
+            
+            if (iUncompressedFormat.iYuvFormat.iPattern == EYuv420Chroma2)
+                {
+                pattern1 = EYuv420Chroma1;
+                pattern2 = EYuv420Chroma2;
+                dataLayout = EYuvDataPlanar;
+                }
+            else
+                {
+                pattern1 = EYuv422Chroma1;
+                pattern2 = EYuv422Chroma2;
+                dataLayout = EYuvDataInterleavedBE;
+                }
+            
+            // Check the most important paramers
+            for ( TInt i = 0; i < formatCount; i ++ )
+                {
+                uncFormat = supportedInputFormats[i];
+                
+                if ( (uncFormat.iDataFormat == iUncompressedFormat.iDataFormat) && 
+                     (uncFormat.iYuvFormat.iDataLayout == dataLayout) &&
+                     ( (uncFormat.iYuvFormat.iPattern == pattern1) || 
+                       (uncFormat.iYuvFormat.iPattern == pattern2) ) )
+                    {
+                    // Assign the rest of parameters
+                    iUncompressedFormat = uncFormat;
+                    
+                    if ( iCodecType != EH263 )
+                        {
+                        // Set aspect ratio to 1:1 (square)
+                        iUncompressedFormat.iYuvFormat.iAspectRatioNum = 1;
+                        iUncompressedFormat.iYuvFormat.iAspectRatioDenom = 1;
+                        }
+                        
+                    found = ETrue;
+                    break;
+                    }
+                }
+                
+            if (!found)
+                {
+                supportedInputFormats.Close();
+                PRINT((_L("CTRVideoEncoderClient::CheckCodecInfoL(), Supported format is not found") ))
+                User::Leave(KErrNotSupported);
+                }
+            }
+        
+        /*if ( !encoderInfo->SupportsOutputFormat(*iCompresedFormat) ) // comment until symbian error is fixed
+            {
+            PRINT((_L("CTRVideoEncoderClient::CheckCodecInfoL(), Output format is not supported")))
+            status = KErrNotSupported;
+            }
+        else */
+        if ( (encoderInfo->SupportedDataUnitTypes() & dataUnitType) != dataUnitType ) 
+            {
+            PRINT((_L("CTRVideoEncoderClient::CheckCodecInfoL(), There's no support for this DUType")))
+            status = KErrNotSupported;
+            }
+        else
+            {
+            // Get max rate for requested image format
+            RArray<TPictureRateAndSize> rateAndSize = encoderInfo->MaxPictureRates();
+            TUint rates = rateAndSize.Count();
+            
+            TSize picSize = iPictureSize;
+            if ( picSize == TSize(640, 352) )  // Use VGA max frame rate for VGA 16:9
+                picSize = TSize(640, 480);
+
+            for ( TUint i = 0; i < rates; i++ )
+                {
+                if ( rateAndSize[i].iPictureSize == picSize )
+                    {
+                    status = KErrNone;
+                    iMaxFrameRate = rateAndSize[i].iPictureRate;
+                    PRINT((_L("CTRVideoEncoderClient::CheckCodecInfoL(), Needed picture size found!")))
+                    break;
+                    }
+
+                status = KErrNotSupported;
+                }
+            }
+        }
+
+    accelerated = encoderInfo->Accelerated();
+    
+    // Delete codec info
+    CleanupStack::PopAndDestroy(encoderInfo);
+
+    if (status != KErrNone)
+        {
+        User::Leave(status);
+        }
+
+    return accelerated;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::SetBitRate
+// Sets video bitrate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::SetBitRate(TUint aBitRate)
+    {
+    if ( (iState == ETRInitialized) || (iState == ETRRunning) || (iState == ETRPaused) )
+        {
+        iRateOptions.iBitrate = aBitRate;
+        iRateOptions.iPictureQuality = KTRPictureQuality;
+        iRateOptions.iQualityTemporalTradeoff = KTRQualityTemporalTradeoff;
+
+        if (iRealTime)
+            {
+            iRateOptions.iLatencyQualityTradeoff = KTRLatencyQualityTradeoffRT;
+            }
+        else
+            {
+            iRateOptions.iLatencyQualityTradeoff = KTRLatencyQualityTradeoffNonRT;
+            }
+        
+        // Set bit rate to Encoder
+        iDevVideoRecord->SetRateControlOptions(0/*Layer 0 is supported*/, iRateOptions);
+        iBitRateSetting = ETrue;
+        }
+    else
+        {
+        // Keep bit rate and set it later
+        iRateOptions.iBitrate = aBitRate;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::SetRealTime
+// Sets encoder mode to operate real-time
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::SetRealTime(TBool aRealTime)
+    {
+    iRealTime = aRealTime;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::SetFrameRate
+// Sets frame rate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::SetFrameRate(TReal& aFrameRate)
+    {
+    if ( (iState == ETRInitialized) || (iState == ETRRunning) || (iState == ETRPaused) )
+        {
+        iRateOptions.iPictureRate = aFrameRate;
+        
+        // The target frame rate must not be greater than the source frame rate
+        if ( (iSrcRate > 0.0) && (iRateOptions.iPictureRate > iSrcRate) )
+            {
+            iRateOptions.iPictureRate = iSrcRate;
+            }
+
+        if (iRealTime)
+            {
+            iRateOptions.iLatencyQualityTradeoff = KTRLatencyQualityTradeoffRT;
+            }
+        else
+            {
+            iRateOptions.iLatencyQualityTradeoff = KTRLatencyQualityTradeoffNonRT;
+            }
+        
+        // Set framerate rate to Encoder
+        iDevVideoRecord->SetRateControlOptions(0/*Layer 0 is supported*/, iRateOptions);
+        }
+    else
+        {
+        // Keep frame rate and set it later
+        iRateOptions.iPictureRate = aFrameRate;
+        
+        // The target frame rate must not be greater than the source frame rate
+        if ( (iSrcRate > 0.0) && (iRateOptions.iPictureRate > iSrcRate) )
+            {
+            iRateOptions.iPictureRate = iSrcRate;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::SetChannelBitErrorRate
+// Sets channel bit error rate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::SetChannelBitErrorRate(TReal aErrorRate)
+    {
+    if ( (iState == ETRInitialized) || (iState == ETRRunning) || (iState == ETRPaused) )
+        {
+        // Run-time setting
+        iDevVideoRecord->SetChannelBitErrorRate(0/*Error protection level number*/, aErrorRate, 0.0/*Std deviation*/);
+        }
+    else
+        {
+        iErrorRate = aErrorRate;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::SetVideoCodingOptionsL
+// Sets video coding options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::SetVideoCodingOptionsL(TTRVideoCodingOptions& aOptions)
+    {
+    iCodingOptions = aOptions;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::GetVideoBitRateL
+// Gets video bitrate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUint CTRVideoEncoderClient::GetVideoBitRateL()
+    {
+    return iRateOptions.iBitrate;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::GetFrameRateL
+// Gets frame rate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TReal CTRVideoEncoderClient::GetFrameRateL()
+    {
+    return iRateOptions.iPictureRate;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::SetInputFrameRate
+// Sets source framerate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::SetInputFrameRate(TReal aFrameRate)
+    {
+    iSrcRate = aFrameRate;
+    
+    // The target frame rate must not be greater than the source frame rate
+    if ( (iSrcRate > 0.0) && (iRateOptions.iPictureRate > iSrcRate) )
+        {
+        iRateOptions.iPictureRate = iSrcRate;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::InitializeL
+// Initializes encoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::InitializeL()
+    {
+    PRINT((_L("CTRVideoEncoderClient::InitializeL(), In")))
+    TVideoDataUnitType dataUnitType = EDuCodedPicture;
+    TEncoderBufferOptions bufferOptions;
+    TUint maxBufferSize = 0;
+
+
+    // Give Init settings
+    // 1. Set output format. Output format was already set in SetCodecParametersL
+    switch(iOutputDataType)
+        {
+        case CTRTranscoder::ETRDuCodedPicture:
+            {
+            dataUnitType = EDuCodedPicture;
+            bufferOptions.iMinNumOutputBuffers = KTRMinNumberOfBuffersCodedPicture;
+            break;
+            }
+
+        case CTRTranscoder::ETRDuVideoSegment:
+            {
+            dataUnitType = EDuVideoSegment;
+            bufferOptions.iMinNumOutputBuffers = KTRMinNumberOfBuffersVideoSegment;
+            break;
+            }
+
+        default:
+            {
+            // Should never happend. Encoder does not support uncompressed output format.
+            TRASSERT(0);
+            }
+        }
+        
+    TVideoDataUnitEncapsulation dataUnitEncapsulation = EDuElementaryStream;
+    
+    // Use generic payload encapsulation for H.264
+    if (iCodecType == EH264)
+        {
+        dataUnitEncapsulation = EDuGenericPayload;
+        }
+
+    iDevVideoRecord->SetOutputFormatL(iHwDeviceId, *iCompresedFormat, dataUnitType, dataUnitEncapsulation, EFalse);
+    
+    // 2. Set input format
+    iDevVideoRecord->SetInputFormatL(iHwDeviceId, iUncompressedFormat, iPictureSize);
+
+    // 3. Buffer options
+    bufferOptions.iMaxPreEncoderBufferPictures = bufferOptions.iMinNumOutputBuffers;
+    bufferOptions.iHrdVbvSpec = EHrdVbvNone;
+    bufferOptions.iHrdVbvParams.Set(NULL, 0);
+
+    // Check max coded picture size for specified codec level
+    switch(iCodecLevel)
+        {
+        case KTRH263CodecLevel10:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel10;
+            break;
+            }
+
+        case KTRH263CodecLevel20:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel20;
+            break;
+            }
+
+        case KTRH263CodecLevel30:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel30;
+            break;
+            }
+
+        case KTRH263CodecLevel40:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel40;
+            break;
+            }
+
+        case KTRH263CodecLevel45:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel45;
+            break;
+            }
+
+        case KTRH263CodecLevel50:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel50;
+            break;
+            }
+
+        case KTRH263CodecLevel60:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel60;
+            break;
+            }
+
+        case KTRH263CodecLevel70:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel70;
+            break;
+            }
+            
+        case KTRH264CodecLevel10:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level10;
+            break;
+            }
+            
+        case KTRH264CodecLevel10b:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level10b;
+            break;
+            }
+            
+        case KTRH264CodecLevel11:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level11;
+            break;
+            }
+            
+        case KTRH264CodecLevel12:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level12;
+            break;
+            }
+            
+        case KTRH264CodecLevel13:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level13;
+            break;
+            }
+            
+        case KTRH264CodecLevel20:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level20;
+            break;
+            }
+            
+        case KTRH264CodecLevel30:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level30;
+            break;
+            }
+            
+        case KTRH264CodecLevel31:
+            {
+            maxBufferSize = KTRMaxBufferSizeH264Level31;
+            break;
+            }
+
+        case KTRMPEG4CodecLevel1:
+        case KTRMPEG4CodecLevel0:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel0;
+            break;
+            }
+            
+        case KTRMPEG4CodecLevel0b:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel0b;
+            break;
+            }
+            
+        case KTRMPEG4CodecLevel2:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel2;
+            break;
+            }
+            
+        case KTRMPEG4CodecLevel3:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel3;
+            break;
+            }
+            
+        case KTRMPEG4CodecLevel4a:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel4a;
+            break;
+            }
+            
+        default:
+            {
+            maxBufferSize = KTRMaxBufferSizeLevel0;
+            }
+        }
+
+    bufferOptions.iMaxOutputBufferSize = maxBufferSize;
+    bufferOptions.iMaxCodedPictureSize = bufferOptions.iMaxOutputBufferSize;
+
+    if ((iCodecType != EH263) && (iCodingOptions.iSyncIntervalInPicture > 0))
+        {
+        // Set segment target size
+        if ( iCodingOptions.iSyncIntervalInPicture < KTRMinSegmentSize )
+            {
+            bufferOptions.iMaxCodedSegmentSize = KTRMinSegmentSize;
+            }
+        else if (iCodingOptions.iSyncIntervalInPicture > bufferOptions.iMaxCodedPictureSize)
+            {
+            bufferOptions.iMaxCodedSegmentSize = bufferOptions.iMaxCodedPictureSize;
+            }
+        else
+            {
+            bufferOptions.iMaxCodedSegmentSize = iCodingOptions.iSyncIntervalInPicture;
+            }
+        }
+    else
+        {
+        // Set segment size to max video coded picture size
+        bufferOptions.iMaxCodedSegmentSize = bufferOptions.iMaxCodedPictureSize;
+        }
+
+    PRINT((_L("CTRVideoEncoderClient::InitializeL(), iMaxOutputBufferSize[%d], iMinNumOutputBuffers[%d]"), 
+               bufferOptions.iMaxOutputBufferSize, bufferOptions.iMinNumOutputBuffers ))
+
+    iDevVideoRecord->SetBufferOptionsL(bufferOptions);
+
+    // 4. Random access point
+    TReal accessRate = KTRDefaultAccessRate;    /* ~0.2 fps */
+
+    if (iCodingOptions.iMinRandomAccessPeriodInSeconds > 0)
+        {
+        accessRate = 1.0 / TReal(iCodingOptions.iMinRandomAccessPeriodInSeconds);
+        }
+
+    PRINT((_L("CTRVideoEncoderClient::InitializeL(), RandomAcessRate[%f]"), accessRate));
+    iDevVideoRecord->SetMinRandomAccessRate(accessRate);
+
+    // 5. Other coding options
+    if (iCodecType == EH263)
+        {
+        if (iCodingOptions.iSyncIntervalInPicture > 0)
+            {
+            TH263VideoMode h263CodingOptions;
+            
+            h263CodingOptions.iAllowedPictureTypes = EH263PictureTypeI | EH263PictureTypeP;
+            h263CodingOptions.iForceRoundingTypeToZero = ETrue;
+            h263CodingOptions.iPictureHeaderRepetition = 0;
+            h263CodingOptions.iGOBHeaderInterval = iCodingOptions.iSyncIntervalInPicture;
+            
+            TPckgC<TH263VideoMode> h263OptionsPckg(h263CodingOptions);
+            iDevVideoRecord->SetCodingStandardSpecificOptionsL(h263OptionsPckg);
+            }
+        }
+    else if (iCodecType == EH264)
+        {
+        // H.264 options
+        TAvcVideoMode avcCodingOptions;
+        
+        avcCodingOptions.iAllowedPictureTypes = EAvcPictureTypeI | EAvcPictureTypeP;
+        avcCodingOptions.iFlexibleMacroblockOrder = EFalse;
+        avcCodingOptions.iRedundantPictures = EFalse;
+        avcCodingOptions.iDataPartitioning = iCodingOptions.iDataPartitioning;
+        avcCodingOptions.iFrameMBsOnly = ETrue;
+        avcCodingOptions.iMBAFFCoding = EFalse;
+        avcCodingOptions.iEntropyCodingCABAC = EFalse;
+        avcCodingOptions.iWeightedPPrediction = EFalse;
+        avcCodingOptions.iWeightedBipredicitonMode = 0;
+        avcCodingOptions.iDirect8x8Inference = EFalse;
+
+        TPckgC<TAvcVideoMode> avc4OptionsPckg(avcCodingOptions);
+        iDevVideoRecord->SetCodingStandardSpecificOptionsL(avc4OptionsPckg);
+        }
+    else
+        {
+        // Mpeg4 options
+        TMPEG4VisualMode mpeg4CodingOptions;
+        mpeg4CodingOptions.iShortHeaderMode = EFalse;
+        mpeg4CodingOptions.iMPEG4VisualNormalMPEG4Mode.iHeaderExtension = iCodingOptions.iHeaderExtension;
+        mpeg4CodingOptions.iMPEG4VisualNormalMPEG4Mode.iDataPartitioning = iCodingOptions.iDataPartitioning;
+        mpeg4CodingOptions.iMPEG4VisualNormalMPEG4Mode.iReversibleVLC = iCodingOptions.iReversibleVLC;
+        
+        mpeg4CodingOptions.iMPEG4VisualNormalMPEG4Mode.iAllowedVOPTypes = EMPEG4VisualVOPTypeI;
+
+        TPckgC<TMPEG4VisualMode> mpeg4OptionsPckg(mpeg4CodingOptions);
+        iDevVideoRecord->SetCodingStandardSpecificOptionsL(mpeg4OptionsPckg);
+        }
+
+    // Set source
+    if (iSrcRate <= 0.0)
+        {
+        iSrcRate = KTRDefaultSrcRate;   /* ~15.0 fps */
+        }
+
+    iDevVideoRecord->SetSourceMemoryL(iSrcRate, ETrue, iRealTime);
+
+    // Initialize devVideoRecord
+    iDevVideoRecord->Initialize();
+
+    // Set media buffer type
+    if (iCodecType == EH263)
+        {
+        // Set H.263
+        iBufferType = CCMRMediaBuffer::EVideoH263;
+        }
+    else if (iCodecType == EH264)
+        {
+        // Set H.264
+        iBufferType = CCMRMediaBuffer::EVideoMPEG4; // : What to set here?
+        }
+    else
+        {
+        // Set MPEG4
+        iBufferType = CCMRMediaBuffer::EVideoMPEG4;
+        }
+
+    PRINT((_L("CTRVideoEncoderClient::InitializeL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::SelectEncoderL
+// Selects encoder
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::SelectEncoderL()
+    {
+    PRINT((_L("CTRVideoEncoderClient::SelectEncoderL(), In")))
+    TInt status = KErrNone;
+
+    if (iUid != TUid::Null())
+        {
+        TRAP(status, iHwDeviceId = iDevVideoRecord->SelectEncoderL(iUid));
+        }
+    else
+        {
+        // Probably the error already exists, if iUid == NULL; 
+        status = KErrAlreadyExists;
+        }
+              
+    if (status != KErrNone)
+        {    
+        // Try again with the fallback encoder if one exists
+        if( (iFallbackUid != TUid::Null()) && (iFallbackUid.iUid != iUid.iUid) )
+            {
+            PRINT((_L("CTRVideoEncoderClient::SelectEncoderL(), Reverting to fallback encoder")))
+            iUid = iFallbackUid;
+            }
+        else
+            {
+            PRINT((_L("CTRVideoEncoderClient::SelectDecoderL(), Failed to select encoder")))
+            User::Leave(KErrNotSupported);
+            }
+            
+        TRAP( status, iAcceleratedCodecSelected = CheckCodecInfoL(iUid) );
+            
+        if (status != KErrNone)
+            {
+            PRINT((_L("CTRVideoEncoderClient::SelectDecoderL(), Failed to get codec info")))
+            User::Leave(KErrNotSupported);
+            }
+            
+        TRAP(status, iHwDeviceId = iDevVideoRecord->SelectEncoderL(iUid));
+        
+        if (status != KErrNone)
+            {
+            PRINT((_L("CTRVideoEncoderClient::SelectDecoderL(), Failed to select encoder")))
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    PRINT((_L("CTRVideoEncoderClient::SelectEncoderL(), Out")))
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::MdvroInitializeComplete
+// Informs init status with received error code
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::MdvroInitializeComplete(TInt aError)
+    {
+    if (aError == KErrNone)
+        {
+        iState = ETRInitialized;
+        }
+    else if ((aError == KErrHardwareNotAvailable) || (aError == KErrNotSupported))
+        {
+        PRINT((_L("CTRVideoEncoderClient::MdvroInitializeComplete(), Error in initialization")))
+        
+        // Map both error codes to the same
+        aError = KErrNotSupported;
+        
+        // Try again with the fallback encoder if one exists
+        while( (iFallbackUid != TUid::Null()) && (iFallbackUid.iUid != iUid.iUid) )
+            {
+            PRINT((_L("CTRVideoEncoderClient::MdvroInitializeComplete(), Reverting to fallback encoder")))
+            
+            iUid = iFallbackUid;
+            
+            // Devvideo must be recreated from scratch
+            if (iDevVideoRecord)
+                {
+                delete iDevVideoRecord;
+                iDevVideoRecord = NULL;
+                }
+            
+            TRAPD( status, iDevVideoRecord = CMMFDevVideoRecord::NewL(*this) );
+            if (status != KErrNone)
+                {
+                // Something went wrong, let CTRTranscoderImp handle the error
+                PRINT((_L("CTRVideoEncoderClient::MdvroInitializeComplete(), Failed to create DevVideoRecord")))
+                break;
+                }
+                
+            TRAP( status, iAcceleratedCodecSelected = CheckCodecInfoL(iUid) );
+            if (status != KErrNone)
+                {
+                // Fallback encoder can not be used, let CTRTranscoderImp handle the error
+                PRINT((_L("CTRVideoEncoderClient::MdvroInitializeComplete(), Failed to get codec info")))
+                break;
+                }
+                
+            TRAP( status, SelectEncoderL() );        
+            if (status != KErrNone)
+                {
+                // Fallback encoder can not be used, let CTRTranscoderImp handle the error
+                PRINT((_L("CTRVideoEncoderClient::MdvroInitializeComplete(), Failed to select encoder")))
+                break;
+                }
+            
+            // We are now ready to reinitialize the encoder, let CTRTranscoderImp do it    
+            aError = KErrHardwareNotAvailable;
+            break;
+            }
+        }
+          
+    iObserver.MtrdvcoEncInitializeComplete(aError);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::StartL
+// Starts encoding
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::StartL()
+    {
+    PRINT((_L("CTRVideoEncoderClient::StartL(), In")))
+
+    if ( (iCodecType == EMpeg4) && (iVolHeader == KNullDesC8) )
+        {
+        // Before starting the encoder, request config data
+        HBufC8* condigDecInfo = iDevVideoRecord->CodingStandardSpecificInitOutputLC();
+
+        if (condigDecInfo)
+            {
+            PRINT((_L("CTRVideoEncoderClient::StartL(), Vol header length[%d]"), condigDecInfo->Length()))
+
+            if ( (condigDecInfo->Length() > 0) && (condigDecInfo->Length() <= KMaxDesC8Length /*256*/) )
+                {
+                iVolHeader.Des().Copy( condigDecInfo->Des() );
+                
+                // Keep vol length for further use
+                iVolLength = iVolHeader.Des().Length();
+                PRINT((_L("CTRVideoEncoderClient::StartL(), VolLength[%d]"), iVolLength))
+                }
+
+            CleanupStack::PopAndDestroy(condigDecInfo);
+            }
+        else
+            {
+            PRINT((_L("CTRVideoEncoderClient::StartL(), Invalid codingDecInfo, leave")))
+            User::Leave(KErrAlreadyExists);
+            }
+            
+        PRINT((_L("CTRVideoEncoderClient::StartL(), Out")))
+        }
+
+    
+    // Set Rate control options
+    if (!iBitRateSetting)
+        {
+        iRateOptions.iPictureQuality = KTRPictureQuality;
+        iRateOptions.iQualityTemporalTradeoff = KTRQualityTemporalTradeoff;
+
+        if (iRealTime)
+            {
+            iRateOptions.iLatencyQualityTradeoff = KTRLatencyQualityTradeoffRT;
+            }
+        else
+            {
+            iRateOptions.iLatencyQualityTradeoff = KTRLatencyQualityTradeoffNonRT;
+            }
+
+        iDevVideoRecord->SetRateControlOptions(0/*Layer 0 is supported*/, iRateOptions);
+        iBitRateSetting = ETrue;
+        }
+        
+    if ( (iCodecType != EH263) && (iCodingOptions.iSyncIntervalInPicture > 0) )
+        {
+        // Set resync value (segment target size)
+        iDevVideoRecord->SetSegmentTargetSize(0/*aLayer*/, 
+                                              iCodingOptions.iSyncIntervalInPicture/*aSizeBytes*/, 
+                                              0/*aSizeMacroblocks*/);
+        }
+    
+    // Start encoding
+    if (iFatalError == KErrNone)
+        {
+        iDevVideoRecord->Start();
+        iState = ETRRunning;
+        }
+        
+    // Reset ts monitor
+    iLastTimestamp = -1;
+    
+    iSetRandomAccessPoint = EFalse;
+
+    PRINT((_L("CTRVideoEncoderClient::StartL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::EncodePictureL
+// Encodes video picture
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::EncodePictureL(TVideoPicture* aPicture)
+    {
+    PRINT((_L("CTRVideoEncoderClient::EncodePictureL(), In")))
+
+    if (aPicture)
+        {
+        if (iFatalError == KErrNone)
+            {
+            // Set rest of picture options
+            aPicture->iOptions = TVideoPicture::ETimestamp;
+            PRINT((_L("CTRVideoEncoderClient::EncodePictureL(), picture timestamp [%d]"), TInt(aPicture->iTimestamp.Int64()) ))
+
+            TTimeIntervalMicroSeconds ts = aPicture->iTimestamp;
+                
+            if ( ts <= iLastTimestamp)
+                {
+                // Prevent propagation of the error now
+                PRINT((_L("CTRVideoEncoderClient::EncodePictureL(), Picture timestamp less than previously encoded")))
+                PRINT((_L("CTRVideoEncoderClient::EncodePictureL(), Dropping picture!!!")))
+                iObserver.MtrdvcoEncoderReturnPicture(aPicture);
+                
+                PRINT((_L("CTRVideoEncoderClient::EncodePictureL(), Out")))
+                return;
+                }
+            else
+                {
+                iLastTimestamp = ts;
+                }
+            
+            // If random access point was requested    
+            if( iSetRandomAccessPoint )
+                {
+                PRINT((_L("CTRVideoEncoderClient::EncodePictureL(), Instant Refresh requested")));
+                aPicture->iOptions |= TVideoPicture::EReqInstantRefresh;
+                iSetRandomAccessPoint = EFalse;
+                }
+            else
+                {
+                aPicture->iOptions &= ~(TVideoPicture::EReqInstantRefresh);
+                }
+            
+            aPicture->iData.iDataFormat = EYuvRawData;  // Force data format to YUV
+            
+            iDevVideoRecord->WritePictureL(aPicture);
+            }
+        else
+            {
+            PRINT((_L("CTRVideoEncoderClient::EncodePictureL(), Operation is not possible, since FatalError was reported by low-level[%d]"), iFatalError))
+            return;
+            }
+        }
+    else
+        {
+        PRINT((_L("CTRVideoEncoderClient::EncodePictureL(), Picture is not valid, leave")))
+        User::Leave(KErrArgument);
+        }
+        
+    PRINT((_L("CTRVideoEncoderClient::EncodePictureL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::MdvroReturnPicture
+// Returns picture
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::MdvroReturnPicture(TVideoPicture *aPicture)
+    {
+    iObserver.MtrdvcoEncoderReturnPicture(aPicture);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::MdvroNewBuffers
+// New buffers are available in the system
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::MdvroNewBuffers()
+    {
+    TVideoOutputBuffer* newBuffer = NULL;
+    TInt status = KErrNone;
+    
+    
+    if ( (iCodecType == EMpeg4) && (!iVolHeaderSent) && (iVolHeader != KNullDesC8) )
+        {
+        // Send vol header first to the client
+        iOutputMediaBuffer->Set( iVolHeader.Des(), 
+                                 CCMRMediaBuffer::EVideoMPEG4DecSpecInfo, 
+                                 iVolHeader.Des().Length(), 
+                                 0, 
+                                 0 );
+        
+        iObserver.MtrdvcoNewBuffer(iOutputMediaBuffer);
+        iVolHeaderSent = ETrue;
+
+        // VOS+VO+VOL header is now going to be stored to metadata, it must not be included in mediadata so remove it from the next buffer
+        iRemoveHeader = ETrue;
+        }
+
+    // Get new buffer and forward it to the client
+    while( iDevVideoRecord->NumDataBuffers() > 0 )
+        {
+        TRAP(status, newBuffer = iDevVideoRecord->NextBufferL());
+        if (status != KErrNone)
+            {
+            PRINT((_L("CTRVideoEncoderClient::MdvroNewBuffers(), NextBufferL failed[%d]"), status))
+            iObserver.MtrdvcoFatalError(status);
+            return;
+            }
+
+        if (newBuffer)
+            {
+            PRINT((_L("CTRVideoEncoderClient::MdvroNewBuffers(), dataBuffer length[%d]"), newBuffer->iData.Length()))
+            
+            // Check data length if valid
+            if (newBuffer->iData.Length() <= 0)
+                {
+                // Data length is invalid
+                PRINT((_L("CTRVideoEncoderClient::MdvroNewBuffers(), encoder generates invalid bitstream, abort data processing")))
+                iObserver.MtrdvcoFatalError(KErrAbort);
+                return;
+                }
+                
+            TBool outputMediaBufferSet = EFalse;
+            
+            // Remove vol header if needed from the bitstream
+            if ( iRemoveHeader )
+                {  
+                iRemoveHeader = EFalse;
+                    
+                if ( iCodecType == EMpeg4 )
+                    {
+                    // check if we need to remove VOS+VO+VOL header from the bitstream, since it is 
+                    // stored in metadata, and having it in 2 places may cause interoperability problems
+                    
+                    // Since the length of the vol is already known, remove that data from the beginning of 
+                    // the first buffer
+                    if ( (iVolLength > 0) && (iVolLength < newBuffer->iData.Length()) )
+                        {
+                        TPtr8* buffer = reinterpret_cast<TPtr8*>(&newBuffer->iData);
+                        buffer->Delete(0, iVolLength);
+                        }
+                    }
+                    
+                else if ( iCodecType == EH264 )
+                    {
+                    
+                    TPtr8* ptr = reinterpret_cast<TPtr8*>(&newBuffer->iData);
+                    TPtr8& buffer(*ptr);
+                    
+                    // Offset to the end
+                    TInt readOffset = buffer.Length();
+                    readOffset -= 4;
+                    
+                    TInt numNALUnits = 0;
+                    TInt writeOffset = 0;
+                    TInt firstFrameStart = 0;
+                    TInt alignmentBytes = 0;
+
+                    numNALUnits =  TInt(buffer[readOffset]) + 
+                                  (TInt(buffer[readOffset + 1]) << 8 ) + 
+                                  (TInt(buffer[readOffset + 2]) << 16) + 
+                                  (TInt(buffer[readOffset + 3]) << 24);
+                                       
+                    // figure out the payload length of all NAL's to 
+                    // determine the number of alignment bytes
+                    
+                    // point to first length field                        
+                    readOffset -= (numNALUnits - 1) * 8;
+                    readOffset -= 4;
+                    
+                    TInt allNALsLength = 0;
+                                            
+                    for (TInt i = 0; i < numNALUnits; i++)
+                        {
+                        TInt len = TInt(buffer[readOffset]) +
+                                  (TInt(buffer[readOffset + 1]) << 8) +
+                                  (TInt(buffer[readOffset + 2]) << 16) +
+                                  (TInt(buffer[readOffset + 3]) << 24);
+                                  
+                        allNALsLength += len;
+                        readOffset += 8;
+                        }
+                        
+                    // calculate alignment bytes
+                    alignmentBytes = (allNALsLength % 4 != 0) * ( 4 - (allNALsLength % 4) );
+                    
+                    // get pointer to end of last frame
+                    writeOffset = buffer.Length() - 4 - numNALUnits * 8;
+                    
+                    // get number of frame NAL's
+                    numNALUnits -= iNumH264SPSPPS;
+                    
+                    // point to offset field of first frame
+                    readOffset = buffer.Length();
+                    readOffset -= 4;
+                    readOffset -= numNALUnits * 8;
+                    
+                    firstFrameStart = TInt(buffer[readOffset]) +
+                                     (TInt(buffer[readOffset + 1]) << 8) +
+                                     (TInt(buffer[readOffset + 2]) << 16) +
+                                     (TInt(buffer[readOffset + 3]) << 24);
+
+                    // The buffer should have enough space for the new NAL header
+                    // if ( frameStart + frameSize + 12 < buffer.Length() )
+
+                    // point to length field of first frame                                    
+                    readOffset += 4;
+                    
+                    // first frame begins from offset 0
+                    TInt nalOffset = 0;
+                    TInt totalLength = 0;
+                    
+                    for (TInt i = 0; i < numNALUnits; i++)
+                    {
+                       
+                        // read NAL length
+                        TInt length = TInt(buffer[readOffset]) +
+                                     (TInt(buffer[readOffset + 1]) << 8) +
+                                     (TInt(buffer[readOffset + 2]) << 16) +
+                                     (TInt(buffer[readOffset + 3]) << 24);
+                                     
+                        totalLength += length;
+                       
+                        // write offset                   
+                        buffer[writeOffset + 0] = TUint8(nalOffset & 0xff);
+                        buffer[writeOffset + 1] = TUint8((nalOffset >> 8) & 0xff);
+                        buffer[writeOffset + 2] = TUint8((nalOffset >> 16) & 0xff);
+                        buffer[writeOffset + 3] = TUint8((nalOffset >> 24) & 0xff);
+                                            
+                        // Write NAL length
+                        writeOffset +=4;
+                        buffer[writeOffset + 0] = TUint8(length & 0xff);
+                        buffer[writeOffset + 1] = TUint8((length >> 8) & 0xff);
+                        buffer[writeOffset + 2] = TUint8((length >> 16) & 0xff);
+                        buffer[writeOffset + 3] = TUint8((length >> 24) & 0xff);
+                    
+                        writeOffset += 4;                    
+                        readOffset += 8;
+                        
+                        nalOffset += length;
+                    }
+                    
+                    // Write the number of NAL units
+                    buffer[writeOffset + 0] = TUint8(numNALUnits & 0xff);
+                    buffer[writeOffset + 1] = TUint8((numNALUnits >> 8) & 0xff);
+                    buffer[writeOffset + 2] = TUint8((numNALUnits >> 16) & 0xff);
+                    buffer[writeOffset + 3] = TUint8((numNALUnits >> 24) & 0xff);
+
+                    // Get a pointer to the position where the frame starts          
+                    TPtrC8 tmp(buffer.Ptr() + firstFrameStart, totalLength + alignmentBytes + numNALUnits * 8 + 4);
+
+                    // Set output media buffer
+                    iOutputMediaBuffer->Set( tmp, static_cast<CCMRMediaBuffer::TBufferType>(iBufferType), 
+                                             tmp.Length(), newBuffer->iRandomAccessPoint, 
+                                             newBuffer->iCaptureTimestamp );
+                                             
+                    outputMediaBufferSet = ETrue;
+                    
+                    }
+                }
+                
+            if (!outputMediaBufferSet)
+                {
+                iOutputMediaBuffer->Set( newBuffer->iData, static_cast<CCMRMediaBuffer::TBufferType>(iBufferType), 
+                                         newBuffer->iData.Length(), newBuffer->iRandomAccessPoint, 
+                                         newBuffer->iCaptureTimestamp );
+                }
+                                     
+            iObserver.MtrdvcoNewBuffer(iOutputMediaBuffer);
+            
+            // Return buffer to devvideo here, since observer call is synchronous
+            iDevVideoRecord->ReturnBuffer(newBuffer);
+            }
+        else
+            {
+            PRINT((_L("CTRVideoEncoderClient::MdvroNewBuffers(), newBuffer is not available, nothing to do")))
+            break;
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::StopL
+// Stops encoding synchronously
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::StopL()
+    {
+    PRINT((_L("CTRVideoEncoderClient::StopL(), In")))
+
+    if (iFatalError == KErrNone)
+        {
+        iDevVideoRecord->Stop();
+        }
+
+    // Reset flags here
+    iVolHeaderSent = EFalse;
+    iState = ETRStopped;
+ 
+    PRINT((_L("CTRVideoEncoderClient::StopL(), Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::AsyncStopL
+// Stops encoding asynchronoulsy
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::AsyncStopL()
+    {
+    PRINT((_L("CTRVideoEncoderClient::StopL(), Async In")))
+    
+    if (iFatalError == KErrNone)
+        {
+        iDevVideoRecord->InputEnd();
+        }
+
+    // Reset flags here
+    iVolHeaderSent = EFalse;
+    iState = ETRStopping;
+    
+    PRINT((_L("CTRVideoEncoderClient::StopL(), Async Out")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::MdvroStreamEnd
+// End of stream is reached
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::MdvroStreamEnd()
+    {
+    PRINT((_L("CTRVideoEncoderClient::MdvpoStreamEnd()")))
+    iState = ETRStopped;
+    iObserver.MtrdvcoEncStreamEnd();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::MdvroSupplementalInfoSent
+// Signals that the supplemental info send request has completed. The buffer used for supplemental information can be re-used or freed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::MdvroSupplementalInfoSent()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::MdvroFatalError
+// Reports the fatal error
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::MdvroFatalError(TInt aError)
+    {
+    PRINT((_L("CTRVideoEncoderClient::MdvroFatalError(), error[%d]"), aError))
+    iFatalError = aError;
+    iObserver.MtrdvcoFatalError(iFatalError);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::GetCodingStandardSpecificInitOutputLC
+// Requests video encoder codinc options
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC8* CTRVideoEncoderClient::GetCodingStandardSpecificInitOutputLC()
+    {
+    if ( iDevVideoRecord )
+        {
+        HBufC8* condigDecInfo = iDevVideoRecord->CodingStandardSpecificInitOutputLC();
+
+        if (condigDecInfo)
+            {
+            PRINT((_L("CTRVideoEncoderClient::GetCodingStandardSpecificInitOutputLC(), Vol header length[%d]"), condigDecInfo->Length()))
+
+            if ( (condigDecInfo->Length() > 0) && (condigDecInfo->Length() <= KMaxDesC8Length /*256*/) )
+                {
+                iVolHeader.Des().Copy( condigDecInfo->Des() );
+                
+                // Keep vol length for further use
+                iVolLength = iVolHeader.Des().Length();
+                PRINT((_L("CTRVideoEncoderClient::GetCodingStandardSpecificInitOutputLC(), VolLength[%d]"), iVolLength))
+
+                // VOS+VO+VOL header is now going to be stored to metadata, it must not be included in mediadata so remove it from the next buffer
+                iRemoveHeader = ETrue;
+                iVolHeaderSent = ETrue;
+                
+                if ( iCodecType == EH264 )
+                {
+                    TPtr8 temp = condigDecInfo->Des();                                        
+                    
+                    // get number of SPS/PPS units to be able to 
+                    // remove them later from a frame buffer
+                    TInt index = condigDecInfo->Length() - 4;
+                    
+                    iNumH264SPSPPS = TInt(temp[index]) + 
+                                    (TInt(temp[index + 1]) << 8 ) + 
+                                    (TInt(temp[index + 2]) << 16) + 
+                                    (TInt(temp[index + 3]) << 24);
+                    
+                }
+                
+                // Return codingInfo to the client
+                return condigDecInfo;
+                }
+            }
+        }
+        
+    // If condigDecInfo is not valid or something is going wrong, return NULL
+    return NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::UseDataTransferOptimization
+// Client's request to use optimized data transfer via CI
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::UseDataTransferOptimizationL()
+    {
+    PRINT((_L("CTRVideoEncoderClient::UseDataTransferOptimizationL(), In")))
+
+    // Check buffer management custom interface support before initializing
+    iVideoBufferManagementCI = (MMmfVideoBufferManagement*)iDevVideoRecord->CustomInterface( iHwDeviceId, KMmfVideoBuffermanagementUid );
+    PRINT((_L("CTRVideoEncoderClient::UseDataTransferOptimizationL(), iVideoBufferManagementCI[0x%x]"), iVideoBufferManagementCI))
+
+    if (iVideoBufferManagementCI)
+        {
+        iVideoBufferManagementCI->MmvbmSetObserver(this);
+        iVideoBufferManagementCI->MmvbmEnable(ETrue);
+
+        // Set buffer options for this mode
+        MMmfVideoBufferManagement::TBufferOptions bufferOptionsCI;
+        bufferOptionsCI.iNumInputBuffers = KTRPictureBuffersNumberBMCI;
+        bufferOptionsCI.iBufferSize = iPictureSize;
+        iVideoBufferManagementCI->MmvbmSetBufferOptionsL(bufferOptionsCI);
+        }
+    else
+        {
+        PRINT((_L("CTRVideoEncoderClient::UseDataTransferOptimizationL(), Optimized data transfer is not supported for this hwdevice")))
+        User::Leave(KErrNotSupported);
+        }
+
+    PRINT((_L("CTRVideoEncoderClient::UseDataTransferOptimizationL(), Out")))
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::MmvbmoNewBuffers
+// One or several buffers are available throug CI
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::MmvbmoNewBuffers()
+    {
+    PRINT((_L("CTRVideoEncoderClient::MmvbmoNewBuffers()")))
+    
+    if (iVideoBufferManagementCI)
+        {
+        // Call CI observer to the client only in case, if CI was successfully initialized
+        iObserver.MtrdvcoNewBuffers();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::MmvbmoReleaseBuffers
+// Release buffers
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::MmvbmoReleaseBuffers()
+    {
+    PRINT((_L("CTRVideoEncoderClient::MmvbmoReleaseBuffers()")))
+    }
+
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::GetTargetVideoPictureL
+// Gets target video picture buffer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TVideoPicture* CTRVideoEncoderClient::GetTargetVideoPictureL()
+    {
+    if (iVideoBufferManagementCI)
+        {
+        return iVideoBufferManagementCI->MmvbmGetBufferL(iPictureSize);
+        }
+    else
+        {
+        PRINT((_L("CTRVideoEncoderClient::GetTargetVideoPictureL(), optimized data transfer is not supported")))
+        User::Leave(KErrNotSupported);
+        
+        // Make compiler happy
+        return NULL;
+        }
+    }
+    
+    
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::SetRandomAccessPoint
+// Requests to set random access point to bitstream
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CTRVideoEncoderClient::SetRandomAccessPoint()
+    {
+    PRINT((_L("CTRVideoEncoderClient::SetRandomAccessPoint(), In")))
+    
+    // There are several ways to requestI-Frame: 
+    // 1. Pause() and immediately resume() should force to encoder to generate I-Frame.
+    // 2. Set TVideoPictureOption: some of encoders don't support this
+    // 3. PictureLoss(): some of encoders don't support this
+
+    // Use TVideoPictureOption to request the I-frame later 
+    iSetRandomAccessPoint = ETrue;
+    
+    PRINT((_L("CTRVideoEncoderClient::SetRandomAccessPoint(), Out")))
+    }
+    
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::EstimateEncodeFrameTimeL
+// Returns a time estimate on long it takes to encode one frame
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+TReal CTRVideoEncoderClient::EstimateEncodeFrameTimeL(const TTRVideoFormat& aOutput, TInt aCodecType)
+    {
+    if (iUid == TUid::Null())
+        {
+        PRINT((_L("CTRVideoEncoderClient::EstimateEncodeFrameTimeL(), no encoder selected yet")))
+        User::Leave(KErrNotReady);
+        }
+    
+    TReal time = 0.0;    
+    
+    // Select the predefined constant using the current settings
+    if (aCodecType == EH263)
+        {
+        time = iAcceleratedCodecSelected ? KTREncodeTimeFactorH263HW : KTREncodeTimeFactorH263SW;
+        }
+    else if (aCodecType == EH264)
+        {
+        time = iAcceleratedCodecSelected ? KTREncodeTimeFactorH264HW : KTREncodeTimeFactorH264SW;
+        }
+    else
+        {
+        time = iAcceleratedCodecSelected ? KTREncodeTimeFactorMPEG4HW : KTREncodeTimeFactorMPEG4SW;
+        }
+    
+    // Multiply the time by the resolution of the output frame       
+    time *= static_cast<TReal>(aOutput.iSize.iWidth + aOutput.iSize.iHeight) * KTRTimeFactorScale;
+    
+    PRINT((_L("CTRVideoEncoderClient::EstimateEncodeFrameTimeL(), encode frame time: %.2f"), time))
+        
+    return time;
+    }
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::Pause
+// Pauses encoding
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//     
+void CTRVideoEncoderClient::Pause()
+    {
+    if ((iFatalError == KErrNone) && (iState == ETRRunning))
+        {
+        iDevVideoRecord->Pause();
+        iState = ETRPaused;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::Resume
+// Resumes encoding
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//      
+void CTRVideoEncoderClient::Resume()
+    {
+    if ((iFatalError == KErrNone) && (iState == ETRPaused))
+        {
+        iDevVideoRecord->Resume();
+        iState = ETRRunning;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::EnableResourceObserver
+// Enable / Disable resourece observer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//     
+void CTRVideoEncoderClient::EnableResourceObserver(TBool aEnable)
+    {
+    PRINT((_L("CTRVideoEncoderClient::EnableResourceObserver(), In")))
+    
+    iVideoResourceHandlerCI = (MMmfVideoResourceHandler*)iDevVideoRecord->CustomInterface( iHwDeviceId, KUidMmfVideoResourceManagement );
+    PRINT((_L("CTRVideoEncoderClient::EnableResourceObserver(), iVideoResourceHandlerCI[0x%x]"), iVideoResourceHandlerCI))
+
+    if (iVideoResourceHandlerCI)
+        {
+        if (aEnable)
+            {
+            iVideoResourceHandlerCI->MmvrhSetObserver(this);
+            PRINT((_L("CTRVideoEncoderClient::EnableResourceObserver(), Enabled")))
+            }
+        else
+            {
+            iVideoResourceHandlerCI->MmvrhSetObserver(NULL);
+            }
+        }
+
+    PRINT((_L("CTRVideoEncoderClient::EnableResourceObserver(), Out")))
+    }
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::MmvroResourcesLost
+// Indicates that a media device has lost its resources
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//     
+void CTRVideoEncoderClient::MmvroResourcesLost(TUid /*aMediaDevice*/)
+    {
+    iObserver.MtrdvcoResourcesLost(EFalse);
+    }
+        
+
+// -----------------------------------------------------------------------------
+// CTRVideoEncoderClient::MmvroResourcesRestored
+// Indicates that a media device has regained its resources
+// (other items were commented in a header). 
+// -----------------------------------------------------------------------------
+// 
+void CTRVideoEncoderClient::MmvroResourcesRestored(TUid /*aMediaDevice*/)
+    {
+    iObserver.MtrdvcoResourcesRestored();
+    }
+
+// End of file
+