diff options
Diffstat (limited to 'libvideoeditor/lvpp/VideoEditorPreviewController.h')
-rwxr-xr-x | libvideoeditor/lvpp/VideoEditorPreviewController.h | 119 |
1 files changed, 58 insertions, 61 deletions
diff --git a/libvideoeditor/lvpp/VideoEditorPreviewController.h b/libvideoeditor/lvpp/VideoEditorPreviewController.h index b4537ec..1756f32 100755 --- a/libvideoeditor/lvpp/VideoEditorPreviewController.h +++ b/libvideoeditor/lvpp/VideoEditorPreviewController.h @@ -17,87 +17,78 @@ #ifndef ANDROID_VE_PREVIEWCONTROLLER_H #define ANDROID_VE_PREVIEWCONTROLLER_H -#include <utils/Log.h> #include "VideoEditorPlayer.h" -#include "VideoEditorAudioPlayer.h" -#include "M4OSA_Semaphore.h" -#include "M4OSA_Thread.h" -#include "M4OSA_Clock.h" -#include "M4OSA_Time.h" -#include "M4xVSS_API.h" -#include "M4xVSS_Internal.h" -#include "M4VFL_transition.h" #include "VideoEditorTools.h" -#include "VideoEditorThumbnailMain.h" -#include "VideoEditorMain.h" - -#include "OMX_IVCommon.h" -#include "mediaplayer.h" -#include <surfaceflinger/Surface.h> -#include <surfaceflinger/ISurface.h> -#include <surfaceflinger/ISurfaceComposer.h> -#include <surfaceflinger/SurfaceComposerClient.h> -#include <media/stagefright/MediaBuffer.h> -#include "PreviewRenderer.h" - - -#define NBPLAYER_INSTANCES 2 namespace android { -typedef enum { - VePlayerIdle=0, - VePlayerBusy, - VePlayerAutoStop -} VePlayerState; - -typedef enum { - OVERLAY_UPDATE = 0, - OVERLAY_CLEAR -} OverlayState; - // Callback mechanism from PreviewController to Jni */ typedef void (*jni_progress_callback_fct)(void* cookie, M4OSA_UInt32 msgType, void *argc); +struct Surface; +struct PreviewRenderer; class VideoEditorPreviewController { public: VideoEditorPreviewController(); - virtual ~VideoEditorPreviewController(); + ~VideoEditorPreviewController(); - M4OSA_ERR loadEditSettings(M4VSS3GPP_EditSettings* pSettings, - M4xVSS_AudioMixingSettings* bgmSettings); + M4OSA_ERR loadEditSettings( + M4VSS3GPP_EditSettings* pSettings, + M4xVSS_AudioMixingSettings* bgmSettings); - M4OSA_ERR setSurface(const sp<Surface> &surface); + M4OSA_ERR setSurface(const sp<Surface>& surface); - M4OSA_ERR startPreview(M4OSA_UInt32 fromMS, M4OSA_Int32 toMs, - M4OSA_UInt16 callBackAfterFrameCount, M4OSA_Bool loop) ; + M4OSA_ERR startPreview( + M4OSA_UInt32 fromMS, M4OSA_Int32 toMs, + M4OSA_UInt16 callBackAfterFrameCount, + M4OSA_Bool loop) ; M4OSA_UInt32 stopPreview(); - M4OSA_ERR renderPreviewFrame(const sp<Surface> &surface, - VideoEditor_renderPreviewFrameStr* pFrameInfo, - VideoEditorCurretEditInfo *pCurrEditInfo); + M4OSA_ERR renderPreviewFrame( + const sp<Surface>& surface, + VideoEditor_renderPreviewFrameStr* pFrameInfo, + VideoEditorCurretEditInfo *pCurrEditInfo); - M4OSA_ERR clearSurface(const sp<Surface> &surface, - VideoEditor_renderPreviewFrameStr* pFrameInfo); + M4OSA_ERR clearSurface( + const sp<Surface>& surface, + VideoEditor_renderPreviewFrameStr* pFrameInfo); - M4OSA_Void setJniCallback(void* cookie, - jni_progress_callback_fct callbackFct); + M4OSA_Void setJniCallback( + void* cookie, + jni_progress_callback_fct callbackFct); - status_t setPreviewFrameRenderingMode(M4xVSS_MediaRendering mode, - M4VIDEOEDITING_VideoFrameSize outputVideoSize); + status_t setPreviewFrameRenderingMode( + M4xVSS_MediaRendering mode, + M4VIDEOEDITING_VideoFrameSize outputVideoSize); private: - sp<VideoEditorPlayer> mVePlayer[NBPLAYER_INSTANCES]; - int mCurrentPlayer; //Instance of the player currently being used + enum { + kTotalNumPlayerInstances = 2, + kPreviewThreadStackSize = 65536, + }; + + typedef enum { + VePlayerIdle = 0, + VePlayerBusy, + VePlayerAutoStop + } PlayerState; + + typedef enum { + OVERLAY_UPDATE = 0, + OVERLAY_CLEAR + } OverlayState; + + sp<VideoEditorPlayer> mVePlayer[kTotalNumPlayerInstances]; + int mCurrentPlayer; // player instance currently being used sp<Surface> mSurface; mutable Mutex mLock; M4OSA_Context mThreadContext; - VePlayerState mPlayerState; + PlayerState mPlayerState; M4OSA_Bool mPrepareReqest; - M4VSS3GPP_ClipSettings **mClipList; //Pointer to an array of clip settings + M4VSS3GPP_ClipSettings **mClipList; M4OSA_UInt32 mNumberClipsInStoryBoard; M4OSA_UInt32 mNumberClipsToPreview; M4OSA_UInt32 mStartingClipIndex; @@ -137,24 +128,30 @@ private: M4VIFI_UInt8* mFrameRGBBuffer; M4VIFI_UInt8* mFrameYUVBuffer; mutable Mutex mLockSem; + + static M4OSA_ERR preparePlayer(void* param, int playerInstance, int index); static M4OSA_ERR threadProc(M4OSA_Void* param); static void notify(void* cookie, int msg, int ext1, int ext2); void setVideoEffectType(M4VSS3GPP_VideoEffectType type, M4OSA_Bool enable); - M4OSA_ERR applyVideoEffect(M4OSA_Void * dataPtr, M4OSA_UInt32 colorFormat, - M4OSA_UInt32 videoWidth, M4OSA_UInt32 videoHeight, - M4OSA_UInt32 timeMs, M4OSA_Void* outPtr); + M4OSA_ERR applyVideoEffect( + M4OSA_Void * dataPtr, M4OSA_UInt32 colorFormat, + M4OSA_UInt32 videoWidth, M4OSA_UInt32 videoHeight, + M4OSA_UInt32 timeMs, M4OSA_Void* outPtr); - M4OSA_ERR doImageRenderingMode(M4OSA_Void * dataPtr, - M4OSA_UInt32 colorFormat, M4OSA_UInt32 videoWidth, - M4OSA_UInt32 videoHeight, M4OSA_Void* outPtr); + M4OSA_ERR doImageRenderingMode( + M4OSA_Void * dataPtr, + M4OSA_UInt32 colorFormat, M4OSA_UInt32 videoWidth, + M4OSA_UInt32 videoHeight, M4OSA_Void* outPtr); + // Don't call me! VideoEditorPreviewController(const VideoEditorPreviewController &); - VideoEditorPreviewController &operator=(const VideoEditorPreviewController &); + VideoEditorPreviewController &operator=( + const VideoEditorPreviewController &); }; } -#endif //ANDROID_VE_PREVIEWCONTROLLER_H +#endif // ANDROID_VE_PREVIEWCONTROLLER_H |