}
+ void SetAutoRotationEnabled(bool enable)
+ {
+
+ }
+
+ bool IsAutoRotationEnabled() const
+ {
+ return false;
+ }
+
+ void SetLetterBoxEnabled(bool enable)
+ {
+
+ }
+
+ bool IsLetterBoxEnabled() const
+ {
+ return false;
+ }
+
+
public:
std::string mUrl;
Internal::Adaptor::GetImplementation( *this ).SceneDisconnection();
}
+void VideoPlayer::SetAutoRotationEnabled(bool enable)
+{
+ Internal::Adaptor::GetImplementation( *this ).SetAutoRotationEnabled(enable);
+}
+
+bool VideoPlayer::IsAutoRotationEnabled() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).IsAutoRotationEnabled();
+}
+
+void VideoPlayer::SetLetterBoxEnabled(bool enable)
+{
+ Internal::Adaptor::GetImplementation( *this ).SetLetterBoxEnabled(enable);
+}
+
+bool VideoPlayer::IsLetterBoxEnabled() const
+{
+ return Internal::Adaptor::GetImplementation( *this ).IsLetterBoxEnabled();
+}
+
+
} // namespace Dali;
END_TEST;
}
+
+// For coverage
+int UtcDaliVideoViewDisplayModeForCoverage(void)
+{
+ ToolkitTestApplication application;
+
+ VideoView videoView = VideoView::New();
+ DALI_TEST_CHECK(videoView);
+
+ Toolkit::DevelVideoView::SetAutoRotationEnabled(videoView, true);
+ // A false return is correct because there is no plugin.
+ DALI_TEST_EQUALS(false, Toolkit::DevelVideoView::IsAutoRotationEnabled(videoView), TEST_LOCATION);
+
+ Toolkit::DevelVideoView::SetLetterBoxEnabled(videoView, true);
+ // A false return is correct because there is no plugin.
+ DALI_TEST_EQUALS(false, Toolkit::DevelVideoView::IsLetterBoxEnabled(videoView), TEST_LOCATION);
+
+ END_TEST;
+}
Dali::Toolkit::GetImpl(videoView).PlayAnimation(animation);\r
}\r
\r
+void SetAutoRotationEnabled(VideoView videoView, bool enable)\r
+{\r
+ Dali::Toolkit::GetImpl(videoView).SetAutoRotationEnabled(enable);\r
+}\r
+\r
+bool IsAutoRotationEnabled(VideoView videoView)\r
+{\r
+return Dali::Toolkit::GetImpl(videoView).IsAutoRotationEnabled();\r
+}\r
+\r
+void SetLetterBoxEnabled(VideoView videoView, bool enable)\r
+{\r
+ Dali::Toolkit::GetImpl(videoView).SetLetterBoxEnabled(enable);\r
+}\r
+\r
+bool IsLetterBoxEnabled(VideoView videoView)\r
+{\r
+ return Dali::Toolkit::GetImpl(videoView).IsLetterBoxEnabled();\r
+}\r
+\r
} // namespace DevelVideoView\r
\r
} // namespace Toolkit\r
*/\r
DALI_TOOLKIT_API void PlayAnimation(VideoView videoView, Animation animation);\r
\r
+/**\r
+ * @brief Sets auto rotation feature. If enabled, video will rotate automatically according to the video orientation.\r
+ *\r
+ * @param[in] videoView The current VideoView\r
+ * @param[in] enable true if auto rotation should be enabled, false otherwise. Default value is false.\r
+ */\r
+DALI_TOOLKIT_API void SetAutoRotationEnabled(VideoView videoView, bool enable);\r
+\r
+/**\r
+ * @brief Checks whether auto rotation feature is enabled.\r
+ *\r
+ * @param[in] videoView The current VideoView\r
+ * @return true if auto rotation is enabled, false otherwise. Default value is false.\r
+ */\r
+DALI_TOOLKIT_API bool IsAutoRotationEnabled(VideoView videoView);\r
+\r
+/**\r
+ * @brief Sets letter box feature. If enabled, the video will play in the video player's aspect ratio.\r
+ *\r
+ * @param[in] videoView The current VideoView\r
+ * @param[in] enable true if letter box should be enabled, false otherwise. Default value is false.\r
+ */\r
+DALI_TOOLKIT_API void SetLetterBoxEnabled(VideoView videoView, bool enable);\r
+\r
+/**\r
+ * @brief Checks whether letter box feature is enabled.\r
+ *\r
+ * @param[in] videoView The current VideoView\r
+ * @return true if letter box is enabled, false otherwise. Default value is false.\r
+ */\r
+DALI_TOOLKIT_API bool IsLetterBoxEnabled(VideoView videoView);\r
+\r
} // namespace DevelVideoView\r
\r
} // namespace Toolkit\r
nativeImageSourcePtr->ApplyNativeFragmentShader(fragmentShader);
- return Dali::Shader::New(vertexShader, fragmentShader, Shader::Hint::NONE, "CAMERA_VIEW");
+ Dali::Shader shader = Dali::Shader::New(vertexShader, fragmentShader, Shader::Hint::NONE, "CAMERA_VIEW");
+ // Initialize shader properties
+ shader.RegisterProperty("uRotationMatrix", Property::Value(Vector4(1.0f, 0.0f, 0.0f, 1.0f)));
+ shader.RegisterProperty("uSizeRatio", Property::Value(Vector2(0.0f, 0.0f)));
+
+ return shader;
}
} // namespace Internal
textureSet.SetTexture(0u, mNativeTexture);
}
Self().AddRenderer(mTextureRenderer);
+ mTextureRenderer.SetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY);
// Note VideoPlayer::SetRenderingTarget resets all the options. (e.g. url, mute, looping)
mVideoPlayer.SetRenderingTarget(nativeImageSourcePtr);
DevelTexture::ApplyNativeFragmentShader(mNativeTexture, fragmentShader);
}
- return Dali::Shader::New(vertexShader, fragmentShader, Shader::Hint::NONE, "VIDEO_VIEW");
+ Dali::Shader shader = Dali::Shader::New(vertexShader, fragmentShader, Shader::Hint::NONE, "VIDEO_VIEW");
+ // Initialize shader properties
+ shader.RegisterProperty("uRotationMatrix", Property::Value(Vector4(1.0f, 0.0f, 0.0f, 1.0f)));
+ shader.RegisterProperty("uSizeRatio", Property::Value(Vector2(0.0f, 0.0f)));
+ return shader;
}
bool VideoView::GetStringFromProperty(const Dali::Property::Value& value, std::string& output)
return mVideoPlayer;
}
+void VideoView::SetAutoRotationEnabled(bool enable)
+{
+ mVideoPlayer.SetAutoRotationEnabled(enable);
+}
+
+bool VideoView::IsAutoRotationEnabled() const
+{
+ return mVideoPlayer.IsAutoRotationEnabled();
+}
+
+void VideoView::SetLetterBoxEnabled(bool enable)
+{
+ mVideoPlayer.SetLetterBoxEnabled(enable);
+}
+
+bool VideoView::IsLetterBoxEnabled() const
+{
+ return mVideoPlayer.IsLetterBoxEnabled();
+}
+
+
} // namespace Internal
} // namespace Toolkit
*/
VideoPlayer GetVideoPlayer();
+ /**
+ * @brief Sets auto rotation feature. If enabled, video will rotate automatically according to the video orientation.
+ * @param[in] enable Whether to enable auto rotation feature. Default is false.
+ */
+ void SetAutoRotationEnabled(bool enable);
+
+ /**
+ * @brief Checks whether auto rotation feature is enabled.
+ * @return True if auto rotation feature is enabled. Default is false.
+ */
+ bool IsAutoRotationEnabled() const;
+
+ /**
+ * @brief Sets letter box feature. If enabled, the video will play in the video player's aspect ratio.
+ * @param[in] enable Whether to enable letter box feature. Default is false.
+ */
+ void SetLetterBoxEnabled(bool enable);
+
+ /**
+ * @brief Checks whether letter box feature is enabled.
+ * @return True if letter box feature is enabled. Default is false.
+ */
+ bool IsLetterBoxEnabled() const;
+
private: // From Control
/**
* @copydoc Toolkit::Control::OnInitialize()
{
UNIFORM highp mat4 uMvpMatrix;
UNIFORM highp vec3 uSize;
+ UNIFORM highp vec2 uSizeRatio;
+ UNIFORM highp mat2 uRotationMatrix;
};
OUTPUT mediump vec2 sTexCoordRect;
+highp vec2 getSize(highp vec2 size)
+{
+ if (size.x < 0.5 || size.y < 0.5)
+ {
+ return uSize.xy;
+ }
+ else
+ {
+ highp float ratio = min(uSize.x / size.x, uSize.y / size.y);
+ return vec2(size.xy * ratio);
+ }
+}
+
void main()
{
- gl_Position = uMvpMatrix * vec4(aPosition * uSize.xy, 0.0, 1.0);
- vTexCoord = aPosition + vec2(0.5);
+ gl_Position = uMvpMatrix * vec4(aPosition * getSize(uSizeRatio), 0.0, 1.0);
+ vTexCoord = aPosition * uRotationMatrix + vec2(0.5);
}