/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <cstring>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
-#include <dali/public-api/common/stage.h>
#include <dali/devel-api/scripting/scripting.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
-#include <dali/integration-api/adaptors/adaptor.h>
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/devel-api/actors/actor-devel.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/video-view/video-view.h>
-#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
+#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
namespace Dali
{
DALI_PROPERTY_REGISTRATION( Toolkit, VideoView, "looping", BOOLEAN, LOOPING )
DALI_PROPERTY_REGISTRATION( Toolkit, VideoView, "muted", BOOLEAN, MUTED )
DALI_PROPERTY_REGISTRATION( Toolkit, VideoView, "volume", MAP, VOLUME )
+DALI_PROPERTY_REGISTRATION( Toolkit, VideoView, "underlay", BOOLEAN, UNDERLAY )
+DALI_PROPERTY_REGISTRATION( Toolkit, VideoView, "playPosition", INTEGER, PLAY_POSITION )
+DALI_PROPERTY_REGISTRATION( Toolkit, VideoView, "displayMode", INTEGER, DISPLAY_MODE )
DALI_SIGNAL_REGISTRATION( Toolkit, VideoView, "finished", FINISHED_SIGNAL )
const char* const VOLUME_LEFT( "volumeLeft" );
const char* const VOLUME_RIGHT( "volumeRight" );
+
+// 3.0 TC uses RENDERING_TARGET. It should be removed in next release
const char* const RENDERING_TARGET( "renderingTarget" );
const char* const WINDOW_SURFACE_TARGET( "windowSurfaceTarget" );
const char* const NATIVE_IMAGE_TARGET( "nativeImageTarget" );
+const char* const CUSTOM_SHADER( "shader" );
+const char* const CUSTOM_VERTEX_SHADER( "vertexShader" );
+const char* const CUSTOM_FRAGMENT_SHADER( "fragmentShader" );
+const char* const DEFAULT_SAMPLER_TYPE_NAME( "sampler2D" );
+const char* const CUSTOM_SAMPLER_TYPE_NAME( "samplerExternalOES" );
+
+const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
+ attribute mediump vec2 aPosition;\n
+ uniform highp mat4 uMvpMatrix;\n
+ uniform highp vec3 uSize;\n
+ \n
+ void main()\n
+ {\n
+ mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
+ vertexPosition.xyz *= uSize;\n
+ gl_Position = uMvpMatrix * vertexPosition;\n
+ }\n
+);
+
+const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
+ \n
+ void main()\n
+ {\n
+ gl_FragColor = vec4(0.0);\n
+ }\n
+);
+
+const char* VERTEX_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
+ attribute mediump vec2 aPosition;\n
+ varying mediump vec2 vTexCoord;\n
+ uniform highp mat4 uMvpMatrix;\n
+ uniform highp vec3 uSize;\n
+ varying mediump vec2 sTexCoordRect;\n
+ void main()\n
+ {\n
+ gl_Position = uMvpMatrix * vec4(aPosition * uSize.xy, 0.0, 1.0);\n
+ vTexCoord = aPosition + vec2(0.5);\n
+ }\n
+);
+
+const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
+ uniform lowp vec4 uColor;\n
+ varying mediump vec2 vTexCoord;\n
+ uniform samplerExternalOES sTexture;\n
+ void main()\n
+ {\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
+ }\n
+);
+
} // anonymous namepsace
-VideoView::VideoView()
+VideoView::VideoView( Dali::VideoSyncMode syncMode )
: Control( ControlBehaviour( ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS ) ),
mCurrentVideoPlayPosition( 0 ),
- mIsNativeImageTarget( true ),
+ mFrameID( 0 ),
mIsPlay( false ),
- mIsPause( false )
+ mIsUnderlay( true ),
+ mSyncMode( syncMode )
{
- mVideoPlayer = Dali::VideoPlayer::New();
}
VideoView::~VideoView()
{
}
-Toolkit::VideoView VideoView::New()
+Toolkit::VideoView VideoView::New( VideoSyncMode syncMode )
{
- VideoView* impl = new VideoView();
+ VideoView* impl = new VideoView( syncMode );
Toolkit::VideoView handle = Toolkit::VideoView( *impl );
+ impl->mVideoPlayer = Dali::VideoPlayer::New( impl->Self(), syncMode );
impl->Initialize();
-
return handle;
}
void VideoView::OnInitialize()
{
- Any source;
- Dali::NativeImageSourcePtr nativeImageSourcePtr = Dali::NativeImageSource::New( source );
- mNativeImage = Dali::NativeImage::New( *nativeImageSourcePtr );
-
- mVideoPlayer.SetRenderingTarget( nativeImageSourcePtr );
mVideoPlayer.FinishedSignal().Connect( this, &VideoView::EmitSignalFinish );
+
+ DevelControl::SetAccessibilityConstructor( Self(), []( Dali::Actor actor ) {
+ return std::unique_ptr< Dali::Accessibility::Accessible >(
+ new Control::Impl::AccessibleImpl( actor, Dali::Accessibility::Role::VIDEO ));
+ } );
}
void VideoView::SetUrl( const std::string& url )
{
- if( mUrl != url || !mPropertyMap.Empty() )
- {
mUrl = url;
mPropertyMap.Clear();
- }
-
- if( mIsNativeImageTarget )
- {
- Actor self( Self() );
- Internal::InitializeVisual( self, mVisual, mNativeImage );
- }
mVideoPlayer.SetUrl( mUrl );
}
{
mPropertyMap = map;
- Actor self( Self() );
- Internal::InitializeVisual( self, mVisual, mPropertyMap );
+ Property::Value* target = map.Find( RENDERING_TARGET );
+ std::string targetType;
- Property::Value* widthValue = mPropertyMap.Find( "width" );
- if( widthValue )
+ if( target && target->Get( targetType ) && targetType == WINDOW_SURFACE_TARGET )
{
- int width;
- if( widthValue->Get( width ) )
- {
- mVideoSize = ImageDimensions( width, mVideoSize.GetHeight() );
- }
+ mIsUnderlay = true;
+ SetWindowSurfaceTarget();
+ }
+ else if( target && target->Get( targetType ) && targetType == NATIVE_IMAGE_TARGET )
+ {
+ mIsUnderlay = false;
+ SetNativeImageTarget();
}
- Property::Value* heightValue = mPropertyMap.Find( "height" );
- if( heightValue )
+ // Custom shader
+ Property::Value* shaderValue;
+ if( !map.Empty() )
{
- int height;
- if( heightValue->Get( height ) )
+ shaderValue = map.Find( CUSTOM_SHADER );
+
+ if( shaderValue )
{
- mVideoSize = ImageDimensions( mVideoSize.GetWidth(), height );
+ Property::Map* shaderMap = shaderValue->GetMap();
+ if( shaderMap )
+ {
+ mEffectPropertyMap = *shaderMap;
+ }
}
}
+ if( mTextureRenderer && !mEffectPropertyMap.Empty() )
+ {
+ Dali::Shader shader = CreateShader();
+ mTextureRenderer.SetShader( shader );
+ }
+
RelayoutRequest();
}
return mUrl;
}
-void VideoView::SetLooping(bool looping)
+void VideoView::SetLooping( bool looping )
{
mVideoPlayer.SetLooping( looping );
}
{
mVideoPlayer.Play();
mIsPlay = true;
- mIsPause = false;
}
void VideoView::Pause()
{
mVideoPlayer.Pause();
mIsPlay = false;
- mIsPause = true;
}
void VideoView::Stop()
{
mVideoPlayer.Stop();
mIsPlay = false;
- mIsPause = false;
}
void VideoView::Forward( int millisecond )
return connected;
}
-void VideoView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+void VideoView::SetPropertyInternal( Property::Index index, const Property::Value& value )
{
- Toolkit::VideoView videoView = Toolkit::VideoView::DownCast( Dali::BaseHandle( object ) );
-
- if( videoView )
+ switch( index )
{
- VideoView& impl = GetImpl( videoView );
+ case Toolkit::VideoView::Property::VIDEO:
+ {
+ std::string videoUrl;
+ Property::Map map;
- switch( index )
+ if( value.Get( videoUrl ) )
+ {
+ SetUrl( videoUrl );
+ }
+ else if( value.Get( map ) )
+ {
+ SetPropertyMap( map );
+ }
+ break;
+ }
+ case Toolkit::VideoView::Property::LOOPING:
{
- case Toolkit::VideoView::Property::VIDEO:
+ bool looping;
+ if( value.Get( looping ) )
{
- std::string videoUrl;
- if( value.Get( videoUrl ) )
- {
- impl.SetUrl( videoUrl );
- }
-
- Property::Map map;
- if( value.Get( map ) )
- {
- impl.SetPropertyMap( map );
-
- Property::Value* target = map.Find( RENDERING_TARGET );
- std::string targetType;
- if( target && target->Get( targetType ) && targetType == WINDOW_SURFACE_TARGET )
- {
- impl.SetWindowSurfaceTarget();
- }
- else if( target && target->Get( targetType ) && targetType == NATIVE_IMAGE_TARGET )
- {
- impl.SetNativeImageTarget();
- }
- }
- break;
+ SetLooping( looping );
}
- case Toolkit::VideoView::Property::LOOPING:
+ break;
+ }
+ case Toolkit::VideoView::Property::MUTED:
+ {
+ bool mute;
+ if( value.Get( mute ) )
{
- bool looping;
- if( value.Get( looping ) )
- {
- impl.SetLooping( looping );
- }
- break;
+ SetMute( mute );
}
- case Toolkit::VideoView::Property::MUTED:
+ break;
+ }
+ case Toolkit::VideoView::Property::VOLUME:
+ {
+ Property::Map map;
+ float left, right;
+ if( value.Get( map ) )
{
- bool mute;
- if( value.Get( mute ) )
+ Property::Value* volumeLeft = map.Find( VOLUME_LEFT );
+ Property::Value* volumeRight = map.Find( VOLUME_RIGHT );
+ if( volumeLeft && volumeLeft->Get( left ) && volumeRight && volumeRight->Get( right ) )
{
- impl.SetMute( mute );
+ SetVolume( left, right );
}
- break;
}
- case Toolkit::VideoView::Property::VOLUME:
+ break;
+ }
+ case Toolkit::VideoView::Property::UNDERLAY:
+ {
+ bool underlay;
+ if( value.Get( underlay ) )
{
- Property::Map map;
- float left, right;
- if( value.Get( map ) )
- {
- Property::Value* volumeLeft = map.Find( VOLUME_LEFT );
- Property::Value* volumeRight = map.Find( VOLUME_RIGHT );
- if( volumeLeft && volumeLeft->Get( left ) && volumeRight && volumeRight->Get( right ) )
- {
- impl.SetVolume( left, right );
- }
- }
- break;
+ SetUnderlay( underlay );
+ }
+ break;
+ }
+ case Toolkit::VideoView::Property::PLAY_POSITION:
+ {
+ int pos;
+ if( value.Get( pos ) )
+ {
+ SetPlayPosition( pos );
}
+ break;
+ }
+ case Toolkit::VideoView::Property::DISPLAY_MODE:
+ {
+ int mode;
+ if( value.Get( mode ) )
+ {
+ SetDisplayMode( mode );
+ }
+ break;
+ }
+ }
+}
+
+void VideoView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+{
+ Toolkit::VideoView videoView = Toolkit::VideoView::DownCast( Dali::BaseHandle( object ) );
+
+ if( videoView )
+ {
+ VideoView& impl = GetImpl( videoView );
+
+ impl.SetPropertyInternal( index, value );
+
+ if( index != Toolkit::VideoView::Property::UNDERLAY )
+ {
+ // Backup values.
+ // These values will be used when underlay mode is changed.
+ impl.mPropertyBackup[index] = value;
}
}
}
value = map;
break;
}
+ case Toolkit::VideoView::Property::UNDERLAY:
+ {
+ value = impl.IsUnderlay();
+ break;
+ }
+ case Toolkit::VideoView::Property::PLAY_POSITION:
+ {
+ value = impl.GetPlayPosition();
+ break;
+ }
+ case Toolkit::VideoView::Property::DISPLAY_MODE:
+ {
+ value = impl.GetDisplayMode();
+ break;
+ }
}
}
void VideoView::SetDepthIndex( int depthIndex )
{
- if( mVisual )
+ if( mTextureRenderer )
{
- mVisual.SetDepthIndex( depthIndex );
+ mTextureRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, depthIndex );
}
}
-void VideoView::OnStageConnection( int depth )
+void VideoView::OnSceneConnection( int depth )
{
- if( mVisual )
+ Control::OnSceneConnection( depth );
+
+ if( mIsUnderlay )
{
- CustomActor self = Self();
- Toolkit::GetImplementation(mVisual).SetOnStage( self );
+ SetWindowSurfaceTarget();
}
+}
- Control::OnStageConnection( depth );
+void VideoView::OnSceneDisconnection()
+{
+ Control::OnSceneDisconnection();
}
-void VideoView::OnStageDisconnection()
+void VideoView::OnSizeSet( const Vector3& targetSize )
{
- if( mVisual )
+ if( mIsUnderlay && mSyncMode == Dali::VideoSyncMode::ENABLED )
{
- CustomActor self = Self();
- Toolkit::GetImplementation(mVisual).SetOffStage( self );
+ SetFrameRenderCallback();
+ mVideoPlayer.StartSynchronization();
}
-
- Control::OnStageDisconnection();
+ Control::OnSizeSet( targetSize );
}
Vector3 VideoView::GetNaturalSize()
void VideoView::SetWindowSurfaceTarget()
{
Actor self = Self();
+
+ if( !self.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
+ {
+ // When the control is off the stage, it does not have Window.
+ return;
+ }
+
int curPos = mVideoPlayer.GetPlayPosition();
- if( mVisual )
+ if( mIsPlay )
{
- Toolkit::GetImplementation(mVisual).SetOffStage(self);
- mVisual.Reset();
+ mVideoPlayer.Pause();
}
- mVideoPlayer.SetRenderingTarget( Dali::Adaptor::Get().GetNativeWindowHandle() );
- mVideoPlayer.SetUrl( mUrl );
+ mPositionUpdateNotification = self.AddPropertyNotification( Actor::Property::WORLD_POSITION, StepCondition( 1.0f, 1.0f ) );
+ mSizeUpdateNotification = self.AddPropertyNotification( Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ) );
+ mScaleUpdateNotification = self.AddPropertyNotification( Actor::Property::WORLD_SCALE, StepCondition( 0.1f, 1.0f ) );
+ mPositionUpdateNotification.NotifySignal().Connect( this, &VideoView::UpdateDisplayArea );
+ mSizeUpdateNotification.NotifySignal().Connect( this, &VideoView::UpdateDisplayArea );
+ mScaleUpdateNotification.NotifySignal().Connect( this, &VideoView::UpdateDisplayArea );
- mIsNativeImageTarget = false;
+ if( mTextureRenderer )
+ {
+ self.RemoveRenderer( mTextureRenderer );
+ }
+
+ // Note VideoPlayer::SetRenderingTarget resets all the options. (e.g. url, mute, looping)
+ mVideoPlayer.SetRenderingTarget( Dali::Adaptor::Get().GetNativeWindowHandle( self ) );
+
+ ApplyBackupProperties();
+
+ if( !mOverlayRenderer )
+ {
+ // For underlay rendering mode, video display area have to be transparent.
+ Geometry geometry = VisualFactoryCache::CreateQuadGeometry();
+ Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
+ mOverlayRenderer = Renderer::New( geometry, shader );
+ mOverlayRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF );
+ }
+ Self().AddRenderer( mOverlayRenderer );
if( mIsPlay )
{
- mVideoPlayer.Play();
+ Play();
}
- if( mIsPause )
+
+ if( curPos > 0 )
{
- mVideoPlayer.Play();
- mVideoPlayer.Pause();
+ mVideoPlayer.SetPlayPosition( curPos );
}
- mVideoPlayer.SetPlayPosition( curPos );
}
void VideoView::SetNativeImageTarget()
{
+ if( mVideoPlayer.IsVideoTextureSupported() == false )
+ {
+ DALI_LOG_ERROR( "Platform doesn't support decoded video frame images\n" );
+ mIsUnderlay = true;
+ return;
+ }
+
+ if( mIsPlay )
+ {
+ mVideoPlayer.Pause();
+ }
+
Actor self( Self() );
+
+ if( mOverlayRenderer )
+ {
+ self.RemoveRenderer( mOverlayRenderer );
+
+ mOverlayRenderer.Reset();
+ }
+
+ self.RemovePropertyNotification( mPositionUpdateNotification );
+ self.RemovePropertyNotification( mSizeUpdateNotification );
+ self.RemovePropertyNotification( mScaleUpdateNotification );
+
int curPos = mVideoPlayer.GetPlayPosition();
Any source;
Dali::NativeImageSourcePtr nativeImageSourcePtr = Dali::NativeImageSource::New( source );
- mNativeImage = Dali::NativeImage::New( *nativeImageSourcePtr );
+ mNativeTexture = Dali::Texture::New( *nativeImageSourcePtr );
+
+ if( !mTextureRenderer )
+ {
+ Dali::Geometry geometry = VisualFactoryCache::CreateQuadGeometry();
+ Dali::Shader shader = CreateShader();
+ Dali::TextureSet textureSet = Dali::TextureSet::New();
+ textureSet.SetTexture( 0u, mNativeTexture );
+
+ mTextureRenderer = Renderer::New( geometry, shader );
+ mTextureRenderer.SetTextures( textureSet );
+ }
+ else
+ {
+ Dali::TextureSet textureSet = mTextureRenderer.GetTextures();
+ textureSet.SetTexture( 0u, mNativeTexture );
+ }
+ Self().AddRenderer( mTextureRenderer );
+ // Note VideoPlayer::SetRenderingTarget resets all the options. (e.g. url, mute, looping)
mVideoPlayer.SetRenderingTarget( nativeImageSourcePtr );
- mVideoPlayer.SetUrl( mUrl );
- Internal::InitializeVisual( self, mVisual, mNativeImage );
- mIsNativeImageTarget = true;
+ ApplyBackupProperties();
if( mIsPlay )
{
- mVideoPlayer.Play();
+ Play();
}
- if( mIsPause )
+ if( curPos > 0 )
{
- mVideoPlayer.Play();
- mVideoPlayer.Pause();
+ mVideoPlayer.SetPlayPosition( curPos );
+ }
+}
+
+void VideoView::UpdateDisplayArea( Dali::PropertyNotification& source )
+{
+ // If mSyncMode is enabled, Video player's size and poistion is updated in Video player's constraint.
+ // Because video view and player should be work syncronization.
+ if( !mIsUnderlay || mSyncMode == Dali::VideoSyncMode::ENABLED )
+ {
+ return;
+ }
+
+ Actor self( Self() );
+
+ bool positionUsesAnchorPoint = self.GetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT ).Get< bool >();
+ Vector3 actorSize = self.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ) * self.GetCurrentProperty< Vector3 >( Actor::Property::SCALE );
+ Vector3 anchorPointOffSet = actorSize * ( positionUsesAnchorPoint ? self.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ) : AnchorPoint::TOP_LEFT );
+
+ Vector2 screenPosition = self.GetProperty( Actor::Property::SCREEN_POSITION ).Get< Vector2 >();
+
+ mDisplayArea.x = screenPosition.x - anchorPointOffSet.x;
+ mDisplayArea.y = screenPosition.y - anchorPointOffSet.y;
+ mDisplayArea.width = actorSize.x;
+ mDisplayArea.height = actorSize.y;
+
+ mVideoPlayer.SetDisplayArea( mDisplayArea );
+}
+
+void VideoView::SetUnderlay( bool set )
+{
+ if( set != mIsUnderlay )
+ {
+ mIsUnderlay = set;
+
+ if( mIsUnderlay )
+ {
+ SetWindowSurfaceTarget();
+ }
+ else
+ {
+ SetNativeImageTarget();
+ }
+
+ RelayoutRequest();
+ }
+}
+
+bool VideoView::IsUnderlay()
+{
+ return mIsUnderlay;
+}
+
+void VideoView::SetSWCodec( bool on )
+{
+ // If setting SW or HW type is failed , video-view shows video by default codec type.
+ // The default codec type is selected by platform.
+ if( on )
+ {
+ mVideoPlayer.SetCodecType( Dali::VideoPlayerPlugin::CodecType::SW );
+ }
+ else
+ {
+ mVideoPlayer.SetCodecType( Dali::VideoPlayerPlugin::CodecType::HW );
+ }
+}
+
+int VideoView::GetPlayPosition()
+{
+ return mVideoPlayer.GetPlayPosition();
+}
+
+void VideoView::SetPlayPosition( int pos )
+{
+ mVideoPlayer.SetPlayPosition( pos );
+}
+
+void VideoView::SetDisplayMode( int mode )
+{
+ mVideoPlayer.SetDisplayMode( static_cast< Dali::VideoPlayerPlugin::DisplayMode::Type >( mode ) );
+}
+
+int VideoView::GetDisplayMode() const
+{
+ return static_cast< int >( mVideoPlayer.GetDisplayMode() );
+}
+
+Any VideoView::GetMediaPlayer()
+{
+ return mVideoPlayer.GetMediaPlayer();
+}
+
+void VideoView::OnAnimationFinished( Animation& animation )
+{
+ // send desync
+ SetFrameRenderCallback();
+}
+
+void VideoView::PlayAnimation( Dali::Animation animation )
+{
+ if( mIsUnderlay && mSyncMode == Dali::VideoSyncMode::ENABLED )
+ {
+ mVideoPlayer.StartSynchronization();
+ animation.FinishedSignal().Connect( this, &VideoView::OnAnimationFinished );
}
- mVideoPlayer.SetPlayPosition( curPos );
+ animation.Play();
+}
+
+Dali::Shader VideoView::CreateShader()
+{
+ std::string fragmentShader = "#extension GL_OES_EGL_image_external:require\n";
+ std::string vertexShader;
+ std::string customFragmentShader;
+ bool checkShader = false;
+
+ if( !mEffectPropertyMap.Empty() )
+ {
+ Property::Value* vertexShaderValue = mEffectPropertyMap.Find( CUSTOM_VERTEX_SHADER );
+ if( vertexShaderValue )
+ {
+ checkShader = GetStringFromProperty( *vertexShaderValue, vertexShader );
+ }
+
+ if( !vertexShaderValue || !checkShader )
+ {
+ vertexShader = VERTEX_SHADER_TEXTURE;
+ }
+
+ Property::Value* fragmentShaderValue = mEffectPropertyMap.Find( CUSTOM_FRAGMENT_SHADER );
+ if( fragmentShaderValue )
+ {
+ checkShader = GetStringFromProperty( *fragmentShaderValue, customFragmentShader );
+
+ if( checkShader )
+ {
+ fragmentShader = customFragmentShader;
+ }
+ }
+
+ if( !fragmentShaderValue || !checkShader )
+ {
+ fragmentShader += FRAGMENT_SHADER_TEXTURE;
+ }
+ }
+ else
+ {
+ vertexShader = VERTEX_SHADER_TEXTURE;
+ fragmentShader += FRAGMENT_SHADER_TEXTURE;
+ }
+
+ return Dali::Shader::New( vertexShader, fragmentShader );
+}
+
+bool VideoView::GetStringFromProperty( const Dali::Property::Value& value, std::string& output )
+{
+ bool extracted = false;
+ if( value.Get( output ) )
+ {
+ extracted = true;
+ }
+
+ return extracted;
+}
+
+void VideoView::ApplyBackupProperties()
+{
+ Property::Map::SizeType pos = 0;
+ Property::Map::SizeType count = mPropertyBackup.Count();
+
+ for( ; pos < count; pos++ )
+ {
+ KeyValuePair property = mPropertyBackup.GetKeyValue( pos );
+
+ SetPropertyInternal( property.first.indexKey, property.second );
+ }
+}
+
+void VideoView::FrameRenderCallback( int frameID )
+{
+ // send desync
+ if( frameID == mFrameID )
+ {
+ mVideoPlayer.FinishSynchronization();
+ mFrameID = 0;
+ }
+}
+
+void VideoView::SetFrameRenderCallback()
+{
+ mFrameID++;
+ DevelWindow::AddFrameRenderedCallback( DevelWindow::Get( Self() ),
+ std::unique_ptr< CallbackBase >( MakeCallback( this, &VideoView::FrameRenderCallback ) ), mFrameID );
}
} // namespace Internal
-} // namespace Toolkit
+} // namespace toolkit
} // namespace Dali