}
+ void RaiseAbove(Dali::VideoPlayer target)
+ {
+
+ }
+
+ void LowerBelow(Dali::VideoPlayer target)
+ {
+
+ }
+
+ void RaiseToTop()
+ {
+
+ }
+
+ void LowerToBottom()
+ {
+
+ }
+
public:
std::string mUrl;
Internal::Adaptor::GetImplementation( *this ).FinishSynchronization();
}
+void VideoPlayer::RaiseAbove(Dali::VideoPlayer target)
+{
+ Internal::Adaptor::GetImplementation( *this ).RaiseAbove(target);
+}
+
+void VideoPlayer::LowerBelow(Dali::VideoPlayer target)
+{
+ Internal::Adaptor::GetImplementation( *this ).LowerBelow(target);
+}
+
+void VideoPlayer::RaiseToTop()
+{
+ Internal::Adaptor::GetImplementation( *this ).RaiseToTop();
+}
+
+void VideoPlayer::LowerToBottom()
+{
+ Internal::Adaptor::GetImplementation( *this ).LowerToBottom();
+}
+
} // namespace Dali;
virtual ~Window() = default;
static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent);
FocusChangeSignalType mFocusChangeSignal;
+ ResizeSignalType mResizeSignal;
+ int mRotationAngle;
DevelWindow::VisibilityChangedSignalType mVisibilityChangedSignal;
};
Window::Window( const PositionSize& positionSize )
: SceneHolder( positionSize ),
mFocusChangeSignal(),
+ mResizeSignal(),
+ mRotationAngle(90), // dummy angle for test coverage
mVisibilityChangedSignal()
{
}
return GetImplementation( *this ).mFocusChangeSignal;
}
+ResizeSignalType& Window::ResizeSignal()
+{
+ return GetImplementation( *this ).mResizeSignal;
+}
+
Window::KeyEventSignalType& Window::KeyEventSignal()
{
return GetImplementation( *this ).KeyEventSignal();
return Dali::Window( windowImpl );
}
+void SetPositionSize(Window window, PositionSize positionSize)
+{
+ Uint16Pair newSize(positionSize.width, positionSize.height);
+ GetImplementation( window ).mResizeSignal.Emit(window,newSize);
+}
+
+int GetPhysicalOrientation(Window window)
+{
+ return GetImplementation( window ).mRotationAngle;
+}
+
void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId )
{
CallbackBase::Execute( *callback, frameId );
class Window;
typedef Signal< void (Window,bool) > FocusChangeSignalType;
+typedef Signal< void (Window,Uint16Pair) > ResizeSignalType;
class Window : public BaseHandle
{
public:
+ using WindowSize = Uint16Pair;
+
using KeyEventSignalType = Signal< void (const KeyEvent&) >;
using TouchEventSignalType = Signal< void (const TouchEvent&) >;
+ using ResizeSignalType = Signal<void(Window, WindowSize)>;
static Window New(PositionSize windowPosition, const std::string& name, bool isTransparent = false);
static Window New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);
FocusChangeSignalType& FocusChangeSignal();
KeyEventSignalType& KeyEventSignal();
TouchEventSignalType& TouchedSignal();
+ ResizeSignalType& ResizeSignal();
public:
explicit Window( Internal::Adaptor::Window* window );
Dali::Window Get( Actor actor );
Dali::Window DownCast( BaseHandle handle );
+void SetPositionSize(Window window, PositionSize positionSize);
+int GetPhysicalOrientation(Window window);
void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
void AddFramePresentedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId );
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/public-api/controls/video-view/video-view.h>
#include <dali-toolkit/devel-api/controls/video-view/video-view-devel.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/devel-api/adaptor-framework/video-sync-mode.h>
using namespace Dali;
END_TEST;
}
+int UtcDaliVideoViewRaiseAboveLowerBelow(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVideoViewRaiseAboveLowerBelow");
+
+ VideoView view = VideoView::New( true );
+ DALI_TEST_CHECK( view );
+
+ application.GetScene().Add( view );
+ view.Play();
+
+ application.SendNotification();
+ application.Render();
+
+ VideoView view2 = VideoView::New( "", false );
+ DALI_TEST_CHECK( view2 );
+
+ application.GetScene().Add( view2 );
+ view2.Play();
+
+ application.SendNotification();
+ application.Render();
+
+ view.RaiseAbove(view2);
+ view.LowerBelow(view2);
+
+ END_TEST;
+}
+
+int UtcDaliVideoViewRaiseTopLowerBottom(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVideoViewRaiseTopLowerBottom");
+
+ VideoView view = VideoView::New( true );
+ DALI_TEST_CHECK( view );
+
+ application.GetScene().Add( view );
+ view.Play();
+
+ application.SendNotification();
+ application.Render();
+
+ VideoView view2 = VideoView::New( "", false );
+ DALI_TEST_CHECK( view2 );
+
+ application.GetScene().Add( view2 );
+ view2.Play();
+
+ application.SendNotification();
+ application.Render();
+
+ view.RaiseToTop();
+ view.LowerToBottom();
+
+ END_TEST;
+}
+
+
int UtcDaliVideoViewPropertyDisplayMode(void)
{
ToolkitTestApplication application;
END_TEST;
}
+
+// For coverage.
+int UtcDaliVideoViewSynchronizationForWindowRotation(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliVideoViewSynchronizationForWindowRotation");
+
+ Window window = Window::New(PositionSize(0,0,100,100) ,"", false);
+ DALI_TEST_CHECK( window );
+
+ VideoView view = VideoView::New( true );
+ DALI_TEST_CHECK( view );
+
+ window.Add( view );
+
+ view.Play();
+
+ DevelWindow::SetPositionSize(window,PositionSize(0,0,480, 240));
+
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
const char* const DEFAULT_SAMPLER_TYPE_NAME("sampler2D");
const char* const CUSTOM_SAMPLER_TYPE_NAME("samplerExternalOES");
+const char* const IS_VIDEO_VIEW_PROPERTY_NAME = "isVideoView";
+
} // namespace
VideoView::VideoView(Dali::VideoSyncMode syncMode)
mFrameID(0),
mIsPlay(false),
mIsUnderlay(true),
- mSyncMode(syncMode)
+ mSyncMode(syncMode),
+ mSiblingOrder(0)
{
}
void VideoView::OnInitialize()
{
+ Actor self = Self();
mVideoPlayer.FinishedSignal().Connect(this, &VideoView::EmitSignalFinish);
- DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
+ DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::VIDEO));
});
+
+ //update self property
+ self.RegisterProperty(IS_VIDEO_VIEW_PROPERTY_NAME, true, Property::READ_WRITE);
}
void VideoView::SetUrl(const std::string& url)
void VideoView::OnSceneConnection(int depth)
{
- Control::OnSceneConnection(depth);
-
+ Actor self = Self();
if(mIsUnderlay)
{
+ mSiblingOrder = self.GetProperty<int>(Dali::DevelActor::Property::SIBLING_ORDER);
+ DevelActor::ChildOrderChangedSignal(self.GetParent()).Connect(this, &VideoView::OnChildOrderChanged);
SetWindowSurfaceTarget();
}
+
+ Control::OnSceneConnection(depth);
}
void VideoView::OnSceneDisconnection()
Control::OnSizeSet(targetSize);
}
+void VideoView::OnChildOrderChanged(Actor actor)
+{
+ Actor self = Self();
+ int currentSiblingOrder = self.GetProperty<int>(Dali::DevelActor::Property::SIBLING_ORDER);
+ if(currentSiblingOrder != mSiblingOrder)
+ {
+ Actor parent = self.GetParent();
+ Actor child;
+ Actor upper;
+ Actor lower;
+
+ int numChildren = static_cast<int>(parent.GetChildCount());
+ for(int i = 0; i < numChildren; i++)
+ {
+ child = parent.GetChildAt(i);
+ if(!IsVideoView(child))
+ {
+ continue;
+ }
+
+ if(child == self)
+ {
+ continue;
+ }
+
+ if(i < currentSiblingOrder)
+ {
+ lower = child;
+ }
+ else if(i > currentSiblingOrder)
+ {
+ upper = child;
+ break;
+ }
+ }
+
+ if(lower)
+ {
+ Toolkit::VideoView lowerView = Toolkit::VideoView::DownCast(lower);
+ mVideoPlayer.RaiseAbove(GetImpl(lowerView).GetVideoPlayer());
+ }
+
+ if(upper)
+ {
+ Toolkit::VideoView upperView = Toolkit::VideoView::DownCast(upper);
+ mVideoPlayer.LowerBelow(GetImpl(upperView).GetVideoPlayer());
+ }
+ mSiblingOrder = currentSiblingOrder;
+ }
+}
+
Vector3 VideoView::GetNaturalSize()
{
Vector3 size;
return;
}
+ Dali::Window window = DevelWindow::Get(self);
+ window.ResizeSignal().Connect(this, &VideoView::OnWindowResized);
+
int curPos = mVideoPlayer.GetPlayPosition();
if(mIsPlay)
SetFrameRenderCallback();
}
+void VideoView::OnWindowResized(Dali::Window winHandle, Dali::Window::WindowSize size)
+{
+ Dali::VideoPlayerPlugin::DisplayRotation videoAngle = mVideoPlayer.GetDisplayRotation();
+ int windowAngle = (DevelWindow::GetPhysicalOrientation(winHandle) / 90);
+
+ if(windowAngle != videoAngle)
+ {
+ mVideoPlayer.SetDisplayRotation(static_cast<Dali::VideoPlayerPlugin::DisplayRotation>(windowAngle));
+ }
+}
+
void VideoView::PlayAnimation(Dali::Animation animation)
{
if(mIsUnderlay && mSyncMode == Dali::VideoSyncMode::ENABLED)
mFrameID);
}
+bool VideoView::IsVideoView(Actor actor) const
+{
+ // Check whether the actor is a VideoView
+ bool isVideoView = false;
+
+ if(actor)
+ {
+ Property::Index propertyIsVideoView = actor.GetPropertyIndex(IS_VIDEO_VIEW_PROPERTY_NAME);
+ if(propertyIsVideoView != Property::INVALID_INDEX)
+ {
+ isVideoView = actor.GetProperty<bool>(propertyIsVideoView);
+ }
+ }
+
+ return isVideoView;
+}
+
+VideoPlayer VideoView::GetVideoPlayer()
+{
+ return mVideoPlayer;
+}
+
} // namespace Internal
} // namespace Toolkit
#include <dali/devel-api/adaptor-framework/video-player.h>
#include <dali/devel-api/adaptor-framework/video-sync-mode.h>
#include <dali/integration-api/adaptor-framework/trigger-event-factory.h>
+#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/object/property-conditions.h>
#include <dali/public-api/object/property-map.h>
*/
void PlayAnimation(Dali::Animation animation);
+ /**
+ * @brief Checks whether the actor is set as a video view or not.
+ *
+ * @param[in] actor The actor to be checked
+ * @return True if actor is video view.
+ */
+ bool IsVideoView(Actor actor) const;
+
+ /**
+ * @brief Gets the Video Player.
+ *
+ * @return The return of video player.
+ */
+ VideoPlayer GetVideoPlayer();
+
private: // From Control
/**
* @copydoc Toolkit::Control::OnInitialize()
*/
void OnAnimationFinished(Dali::Animation& animation);
+ /*
+ * @brief window's resize callback function
+ * This function is called when window is resized.
+ *
+ * @param[in] winHandle The resized window's handle.
+ * @param[in] size The window's new size.
+ */
+ void OnWindowResized(Dali::Window winHandle, Dali::Window::WindowSize size);
+
+ /**
+ * @brief This signal is emitted when an actor's children change their sibling order
+ *
+ * @param[in] actor parent actor.
+ */
+ void OnChildOrderChanged(Actor actor);
+
private:
Dali::VideoPlayer mVideoPlayer;
Dali::ImageDimensions mVideoSize;
bool mIsUnderlay;
Dali::VideoSyncMode mSyncMode;
+ int mSiblingOrder;
};
} // namespace Internal
#include <dali/devel-api/adaptor-framework/image-loading.h>
#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/integration-api/debug.h>
+#include <dali/devel-api/common/stage.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
NPatchVisual::~NPatchVisual()
{
- if((mId != NPatchData::INVALID_NPATCH_DATA_ID) && (mReleasePolicy != Toolkit::ImageVisual::ReleasePolicy::NEVER))
+ if(Stage::IsInstalled() && (mId != NPatchData::INVALID_NPATCH_DATA_ID) && (mReleasePolicy != Toolkit::ImageVisual::ReleasePolicy::NEVER))
{
mLoader.Remove(mId, this);
mId = NPatchData::INVALID_NPATCH_DATA_ID;