const char* const TEST_FILE( "test.mp4" );
const char* const VOLUME_LEFT( "volumeLeft" );
const char* const VOLUME_RIGHT( "volumeRight" );
+const char* const RENDERING_TYPE( "renderingTarget" );
}
left = right = 0.f;
Property::Map map;
- map.Insert( VOLUME_LEFT, 1.0f );
+ map.Insert( VOLUME_LEFT, 0.5f );
map.Insert( VOLUME_RIGHT, 0.5f );
- Property::Map map2;
view.SetProperty( VideoView::Property::VOLUME, map );
- Property::Value val4 = view.GetProperty( VideoView::Property::VOLUME );
- DALI_TEST_CHECK( val4.Get( map2 ) );
+ Property::Value val = view.GetProperty( VideoView::Property::VOLUME );
+
+ Property::Map map2;
+ DALI_TEST_CHECK( val.Get( map2 ) );
- Property::Value* volumeLeft = map.Find( VOLUME_LEFT );
- Property::Value* volumeRight = map.Find( VOLUME_RIGHT );
+ Property::Value* volumeLeft = map2.Find( VOLUME_LEFT );
+ Property::Value* volumeRight = map2.Find( VOLUME_RIGHT );
DALI_TEST_CHECK( volumeLeft && volumeLeft->Get( left ) );
DALI_TEST_CHECK( volumeRight && volumeRight->Get( right ) );
- DALI_TEST_CHECK( left == 1.0f );
+ DALI_TEST_CHECK( left == 0.5f );
DALI_TEST_CHECK( right == 0.5f );
END_TEST;
END_TEST;
}
+
+int UtcDaliVideoViewMethodsForRenderType(void)
+{
+ ToolkitTestApplication application;
+ VideoView videoView = VideoView::New();
+ DALI_TEST_CHECK( videoView );
+
+ Property::Map windowSurfaceTarget;
+ Property::Map nativeImageTarget;
+
+ windowSurfaceTarget.Insert( RENDERING_TYPE, "windowSurfaceTarget" );
+ nativeImageTarget.Insert( RENDERING_TYPE, "nativeImageTarget" );
+
+ Property::Map map;
+ Property::Value value;
+ videoView.SetProperty( VideoView::Property::VIDEO, windowSurfaceTarget );
+
+ value = videoView.GetProperty( VideoView::Property::VIDEO );
+ DALI_TEST_CHECK( value.Get( map ) );
+
+ Property::Value* type = map.Find( RENDERING_TYPE );
+ DALI_TEST_CHECK( type );
+ DALI_TEST_EQUALS( "windowSurfaceTarget", type->Get<std::string>(), TEST_LOCATION );
+
+ videoView.SetProperty( VideoView::Property::VIDEO, nativeImageTarget );
+
+ value = videoView.GetProperty( VideoView::Property::VIDEO );
+ DALI_TEST_CHECK( value.Get( map ) );
+ type = map.Find( RENDERING_TYPE );
+
+ DALI_TEST_CHECK( type );
+ DALI_TEST_EQUALS( "nativeImageTarget", type->Get<std::string>(), TEST_LOCATION );
+
+ END_TEST;
+}
const char* const VOLUME_LEFT( "volumeLeft" );
const char* const VOLUME_RIGHT( "volumeRight" );
-const char* const RENDERING_TARGET( "RENDERING_TARGET" );
+const char* const RENDERING_TARGET( "renderingTarget" );
const char* const WINDOW_SURFACE_TARGET( "windowSurfaceTarget" );
const char* const NATIVE_IMAGE_TARGET( "nativeImageTarget" );
VideoView::VideoView()
: Control( ControlBehaviour( ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS ) ),
mCurrentVideoPlayPosition( 0 ),
- mSetRenderingTarget( false ),
+ mIsNativeImageTarget( true ),
mIsPlay( false ),
mIsPause( false )
{
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 );
+}
+
void VideoView::SetUrl( const std::string& url )
{
if( mUrl != url || !mPropertyMap.Empty() )
{
- mPropertyMap.Clear();
-
mUrl = url;
+ mPropertyMap.Clear();
}
- if( mSetRenderingTarget )
- {
- mVideoPlayer.SetUrl( mUrl );
- }
- else
+ if( mIsNativeImageTarget )
{
- SetNativeImageTarget();
+ Actor self( Self() );
+ Internal::InitializeVisual( self, mVisual, mNativeImage );
}
+
+ mVideoPlayer.SetUrl( mUrl );
}
void VideoView::SetPropertyMap( Property::Map map )
Actor self = Self();
int curPos = mVideoPlayer.GetPlayPosition();
- mSetRenderingTarget = true;
-
if( mVisual )
{
Toolkit::GetImplementation(mVisual).SetOffStage(self);
mVideoPlayer.SetRenderingTarget( Dali::Adaptor::Get().GetNativeWindowHandle() );
mVideoPlayer.SetUrl( mUrl );
- mVideoPlayer.FinishedSignal().Connect( this, &VideoView::EmitSignalFinish );
+
+ mIsNativeImageTarget = false;
if( mIsPlay )
{
Actor self( Self() );
int curPos = mVideoPlayer.GetPlayPosition();
- mSetRenderingTarget = true;
-
Any source;
Dali::NativeImageSourcePtr nativeImageSourcePtr = Dali::NativeImageSource::New( source );
mNativeImage = Dali::NativeImage::New( *nativeImageSourcePtr );
mVideoPlayer.SetRenderingTarget( nativeImageSourcePtr );
mVideoPlayer.SetUrl( mUrl );
- mVideoPlayer.FinishedSignal().Connect( this, &VideoView::EmitSignalFinish );
Internal::InitializeVisual( self, mVisual, mNativeImage );
+ mIsNativeImageTarget = true;
if( mIsPlay )
{
*/
void SetDepthIndex( int depthIndex );
-
/**
* @brief Performs actions as requested using the action name.
* @SINCE_1_1.38
private: // From Control
/**
+ * @copydoc Toolkit::Control::OnInitialize()
+ */
+ virtual void OnInitialize();
+
+ /**
* @copydoc Toolkit::Control::OnStageConnect()
*/
virtual void OnStageConnection( int depth );
Dali::Toolkit::VideoView::VideoViewSignalType mFinishedSignal;
std::string mUrl;
int mCurrentVideoPlayPosition;
- bool mSetRenderingTarget;
+ bool mIsNativeImageTarget;
bool mIsPlay;
bool mIsPause;
};