Commit a3b9cfa45075d7a7e1649729d783d68659ed4626
[dali_1.1.39] Merge branch 'devel/master'
Change-Id: Ib6b264ae8ac7cb4db6f03cc78d2300cee2d2ee3b
Showing
13 changed files
with
485 additions
and
46 deletions
build/tizen/CMakeLists.txt
| ... | ... | @@ -24,6 +24,7 @@ ENDIF() |
| 24 | 24 | |
| 25 | 25 | SET(RESOURCE_DIR ${ROOT_SRC_DIR}/resources) |
| 26 | 26 | SET(LOCAL_IMAGES_DIR ${RESOURCE_DIR}/images) |
| 27 | +SET(LOCAL_VIDEOS_DIR ${RESOURCE_DIR}/videos) | |
| 27 | 28 | SET(LOCAL_MODELS_DIR ${RESOURCE_DIR}/models) |
| 28 | 29 | SET(LOCAL_SCRIPTS_DIR ${RESOURCE_DIR}/scripts) |
| 29 | 30 | IF(NOT DEFINED LOCAL_STYLE_DIR) |
| ... | ... | @@ -31,6 +32,7 @@ IF(NOT DEFINED LOCAL_STYLE_DIR) |
| 31 | 32 | ENDIF() |
| 32 | 33 | |
| 33 | 34 | SET(IMAGES_DIR ${APP_DATA_DIR}/images/) |
| 35 | +SET(VIDEOS_DIR ${APP_DATA_DIR}/videos/) | |
| 34 | 36 | SET(MODELS_DIR ${APP_DATA_DIR}/models/) |
| 35 | 37 | SET(SCRIPTS_DIR ${APP_DATA_DIR}/scripts/) |
| 36 | 38 | SET(STYLE_DIR ${APP_DATA_DIR}/style/) |
| ... | ... | @@ -40,6 +42,7 @@ IF(NOT DEFINED LOCALE_DIR) |
| 40 | 42 | ENDIF() |
| 41 | 43 | |
| 42 | 44 | SET(DEMO_IMAGE_DIR \\"${IMAGES_DIR}\\") |
| 45 | +SET(DEMO_VIDEO_DIR \\"${VIDEOS_DIR}\\") | |
| 43 | 46 | SET(DEMO_MODEL_DIR \\"${MODELS_DIR}\\") |
| 44 | 47 | SET(DEMO_SCRIPT_DIR \\"${SCRIPTS_DIR}\\") |
| 45 | 48 | SET(DEMO_STYLE_DIR \\"${STYLE_DIR}\\") |
| ... | ... | @@ -63,6 +66,11 @@ FOREACH(flag ${LOCAL_IMAGES_LIST}) |
| 63 | 66 | INSTALL(FILES ${LOCAL_IMAGES_DIR}/${flag} DESTINATION ${IMAGES_DIR}) |
| 64 | 67 | ENDFOREACH(flag) |
| 65 | 68 | |
| 69 | +FILE(GLOB LOCAL_VIDEOS_LIST RELATIVE "${LOCAL_VIDEOS_DIR}" "${LOCAL_VIDEOS_DIR}/*") | |
| 70 | +FOREACH(flag ${LOCAL_VIDEOS_LIST}) | |
| 71 | + INSTALL(FILES ${LOCAL_VIDEOS_DIR}/${flag} DESTINATION ${VIDEOS_DIR}) | |
| 72 | +ENDFOREACH(flag) | |
| 73 | + | |
| 66 | 74 | FILE(GLOB LOCAL_MODELS_LIST RELATIVE "${LOCAL_MODELS_DIR}" "${LOCAL_MODELS_DIR}/*") |
| 67 | 75 | FOREACH(flag ${LOCAL_MODELS_LIST}) |
| 68 | 76 | INSTALL(FILES ${LOCAL_MODELS_DIR}/${flag} DESTINATION ${MODELS_DIR}) |
| ... | ... | @@ -80,7 +88,7 @@ INSTALL(FILES ${LOCAL_STYLE_DIR}/demo-theme.json DESTINATION ${STYLE_DIR}) |
| 80 | 88 | |
| 81 | 89 | SET(PKG_LIST dali-core |
| 82 | 90 | dali-adaptor |
| 83 | - dali-toolkit) | |
| 91 | + dali-toolkit ) | |
| 84 | 92 | |
| 85 | 93 | INCLUDE(FindPkgConfig) |
| 86 | 94 | pkg_check_modules(REQUIRED_PKGS REQUIRED ${PKG_LIST}) |
| ... | ... | @@ -89,7 +97,7 @@ FOREACH(flag ${REQUIRED_PKGS_CFLAGS}) |
| 89 | 97 | SET(REQUIRED_CFLAGS "${REQUIRED_CFLAGS} ${flag}") |
| 90 | 98 | ENDFOREACH(flag) |
| 91 | 99 | |
| 92 | -SET(DALI_DEMO_CFLAGS "-DDEMO_IMAGE_DIR=${DEMO_IMAGE_DIR} -DDEMO_MODEL_DIR=${DEMO_MODEL_DIR} -DDEMO_SCRIPT_DIR=${DEMO_SCRIPT_DIR} -DDEMO_THEME_PATH=${DEMO_THEME_PATH} -DDEMO_EXAMPLE_BIN=${DEMO_EXAMPLE_BIN} -DDEMO_LOCALE_DIR=${DEMO_LOCALE_DIR} -fvisibility=hidden -DHIDE_DALI_INTERNALS -DDEMO_LANG=${DEMO_LANG}") | |
| 100 | +SET(DALI_DEMO_CFLAGS "-DDEMO_IMAGE_DIR=${DEMO_IMAGE_DIR} -DDEMO_VIDEO_DIR=${DEMO_VIDEO_DIR} -DDEMO_MODEL_DIR=${DEMO_MODEL_DIR} -DDEMO_SCRIPT_DIR=${DEMO_SCRIPT_DIR} -DDEMO_THEME_PATH=${DEMO_THEME_PATH} -DDEMO_EXAMPLE_BIN=${DEMO_EXAMPLE_BIN} -DDEMO_LOCALE_DIR=${DEMO_LOCALE_DIR} -fvisibility=hidden -DHIDE_DALI_INTERNALS -DDEMO_LANG=${DEMO_LANG}") | |
| 93 | 101 | |
| 94 | 102 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${REQUIRED_CFLAGS} ${DALI_DEMO_CFLAGS} -Werror -Wall -fPIE") |
| 95 | 103 | SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") | ... | ... |
com.samsung.dali-demo.xml
| ... | ... | @@ -157,4 +157,7 @@ |
| 157 | 157 | <ui-application appid="text-editor.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-editor.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 158 | 158 | <label>Text Editor</label> |
| 159 | 159 | </ui-application> |
| 160 | + <ui-application appid="video-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/video-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 161 | + <label>Video View</label> | |
| 162 | + </ui-application> | |
| 160 | 163 | </manifest> | ... | ... |
examples/image-view/image-view-example.cpp
examples/video-view/video-view-example.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + * | |
| 16 | + */ | |
| 17 | + | |
| 18 | +#include <dali/dali.h> | |
| 19 | +#include <dali-toolkit/dali-toolkit.h> | |
| 20 | + | |
| 21 | +using namespace Dali; | |
| 22 | +using namespace Toolkit; | |
| 23 | + | |
| 24 | +namespace | |
| 25 | +{ | |
| 26 | + const int SEEK_POS( 5000 ); | |
| 27 | + const int INIT_WIDTH( 600 ); | |
| 28 | + const int INIT_HEIGHT( 400 ); | |
| 29 | + const int BUTTON_SIZE( 80 ); | |
| 30 | + | |
| 31 | + const char* const PLAY_FILE = DEMO_VIDEO_DIR "big_buck_bunny.mp4"; | |
| 32 | + const char* const PLAY_IMAGE = DEMO_IMAGE_DIR "icon-play.png"; | |
| 33 | + const char* const PAUSE_IMAGE = DEMO_IMAGE_DIR "Pause.png"; | |
| 34 | + const char* const STOP_IMAGE = DEMO_IMAGE_DIR "icon-stop.png"; | |
| 35 | + const char* const RESET_IMAGE = DEMO_IMAGE_DIR "icon-reset.png"; | |
| 36 | + const char* const FORWARD_IMAGE = DEMO_IMAGE_DIR "Forward.png"; | |
| 37 | + const char* const BACKWARD_IMAGE = DEMO_IMAGE_DIR "Backward.png"; | |
| 38 | + | |
| 39 | +const char* DEFAULT_FRAGMENT_SHADER = DALI_COMPOSE_SHADER( | |
| 40 | + varying mediump vec2 vTexCoord;\n | |
| 41 | + uniform sampler2D sTexture;\n | |
| 42 | + uniform lowp vec4 uColor;\n | |
| 43 | + \n | |
| 44 | + void main()\n | |
| 45 | + {\n | |
| 46 | + gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n | |
| 47 | + }\n | |
| 48 | +); | |
| 49 | + | |
| 50 | +const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( | |
| 51 | + precision mediump float; | |
| 52 | + varying mediump vec2 vTexCoord;\n | |
| 53 | + uniform sampler2D sTexture;\n | |
| 54 | + uniform lowp vec4 uColor;\n | |
| 55 | + \n | |
| 56 | + void main()\n | |
| 57 | + {\n | |
| 58 | + vec2 st = vTexCoord.st;\n | |
| 59 | + vec3 irgb = texture2D( sTexture, st ).rgb;\n | |
| 60 | + vec3 negative = vec3( 1., 1., 1. ) - irgb;\n | |
| 61 | + gl_FragColor = vec4( mix( irgb, negative, 1.0), 1. ) * uColor;\n | |
| 62 | + }\n | |
| 63 | +); | |
| 64 | + | |
| 65 | +} // namespace | |
| 66 | + | |
| 67 | +class VideoViewController: public ConnectionTracker | |
| 68 | +{ | |
| 69 | + public: | |
| 70 | + | |
| 71 | + VideoViewController( Application& application ) | |
| 72 | + : mApplication( application ), | |
| 73 | + mIsPlay( false ), | |
| 74 | + mIsStop( false ), | |
| 75 | + mIsFullScreen( false ), | |
| 76 | + mSetCustomShader( false ), | |
| 77 | + mScale( 1.f ) | |
| 78 | + { | |
| 79 | + // Connect to the Application's Init signal | |
| 80 | + mApplication.InitSignal().Connect( this, &VideoViewController::Create ); | |
| 81 | + } | |
| 82 | + | |
| 83 | + ~VideoViewController() | |
| 84 | + { | |
| 85 | + mVideoView.Stop(); | |
| 86 | + } | |
| 87 | + | |
| 88 | + void Create( Application& application ) | |
| 89 | + { | |
| 90 | + mStageSize = Stage::GetCurrent().GetSize(); | |
| 91 | + | |
| 92 | + mVideoView = Toolkit::VideoView::New(); | |
| 93 | + Stage::GetCurrent().Add( mVideoView ); | |
| 94 | + mVideoView.SetParentOrigin( ParentOrigin::CENTER ); | |
| 95 | + mVideoView.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 96 | + mVideoView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); | |
| 97 | + mVideoView.SetSize( INIT_WIDTH, INIT_HEIGHT ); | |
| 98 | + mVideoView.SetProperty( VideoView::Property::LOOPING, true ); | |
| 99 | + mVideoView.SetProperty( VideoView::Property::MUTED, false ); | |
| 100 | + mVideoView.SetProperty( VideoView::Property::VIDEO, PLAY_FILE ); | |
| 101 | + | |
| 102 | + mMenu = Layer::New(); | |
| 103 | + mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); | |
| 104 | + mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT ); | |
| 105 | + mMenu.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 106 | + mMenu.SetSize( INIT_WIDTH, 120 ); | |
| 107 | + mVideoView.Add( mMenu ); | |
| 108 | + | |
| 109 | + mPlayButton = PushButton::New(); | |
| 110 | + mPlayButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 111 | + mPlayButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 112 | + mPlayButton.SetName( "Play" ); | |
| 113 | + mPlayButton.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 114 | + mPlayButton.SetSize( BUTTON_SIZE, BUTTON_SIZE ); | |
| 115 | + mPlayButton.SetPosition( 40, 10 ); | |
| 116 | + mPlayButton.ClickedSignal().Connect( this, &VideoViewController::OnButtonClicked ); | |
| 117 | + | |
| 118 | + mPauseButton = PushButton::New(); | |
| 119 | + mPauseButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 120 | + mPauseButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 121 | + mPauseButton.SetName( "Pause" ); | |
| 122 | + mPauseButton.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 123 | + mPauseButton.SetSize( BUTTON_SIZE, BUTTON_SIZE ); | |
| 124 | + mPauseButton.SetPosition( 40, 10 ); | |
| 125 | + mPauseButton.ClickedSignal().Connect( this, &VideoViewController::OnButtonClicked ); | |
| 126 | + | |
| 127 | + mStopButton = PushButton::New(); | |
| 128 | + mStopButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 129 | + mStopButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 130 | + mStopButton.SetName( "Stop" ); | |
| 131 | + mStopButton.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 132 | + mStopButton.SetSize( BUTTON_SIZE, BUTTON_SIZE ); | |
| 133 | + mStopButton.SetPosition( 140, 10 ); | |
| 134 | + mStopButton.ClickedSignal().Connect( this, &VideoViewController::OnButtonClicked ); | |
| 135 | + | |
| 136 | + mResetButton = PushButton::New(); | |
| 137 | + mResetButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 138 | + mResetButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 139 | + mResetButton.SetName( "Reset" ); | |
| 140 | + mResetButton.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 141 | + mResetButton.SetSize( BUTTON_SIZE, BUTTON_SIZE ); | |
| 142 | + mResetButton.SetPosition( 140, 10 ); | |
| 143 | + mResetButton.ClickedSignal().Connect( this, &VideoViewController::OnButtonClicked ); | |
| 144 | + | |
| 145 | + mBackwardButton = PushButton::New(); | |
| 146 | + mBackwardButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 147 | + mBackwardButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 148 | + mBackwardButton.SetName( "Backward" ); | |
| 149 | + mBackwardButton.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 150 | + mBackwardButton.SetSize( BUTTON_SIZE, BUTTON_SIZE ); | |
| 151 | + mBackwardButton.SetPosition( 240, 10 ); | |
| 152 | + mBackwardButton.ClickedSignal().Connect( this, &VideoViewController::OnButtonClicked ); | |
| 153 | + | |
| 154 | + mForwardButton = PushButton::New(); | |
| 155 | + mForwardButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); | |
| 156 | + mForwardButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 157 | + mForwardButton.SetName( "Forward" ); | |
| 158 | + mForwardButton.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 159 | + mForwardButton.SetSize( BUTTON_SIZE, BUTTON_SIZE ); | |
| 160 | + mForwardButton.SetPosition( 340, 10 ); | |
| 161 | + mForwardButton.ClickedSignal().Connect( this, &VideoViewController::OnButtonClicked ); | |
| 162 | + | |
| 163 | + mMenu.Add( mPlayButton ); | |
| 164 | + mMenu.Add( mPauseButton ); | |
| 165 | + mMenu.Add( mStopButton ); | |
| 166 | + mMenu.Add( mResetButton ); | |
| 167 | + mMenu.Add( mBackwardButton ); | |
| 168 | + mMenu.Add( mForwardButton ); | |
| 169 | + | |
| 170 | + mPauseButton.SetVisible( false ); | |
| 171 | + mPauseButton.SetDisabled( true ); | |
| 172 | + mPlayButton.SetVisible( true ); | |
| 173 | + mPlayButton.SetDisabled( false ); | |
| 174 | + mStopButton.SetVisible( true ); | |
| 175 | + mStopButton.SetDisabled( false ); | |
| 176 | + mResetButton.SetVisible( false ); | |
| 177 | + mResetButton.SetDisabled( true ); | |
| 178 | + | |
| 179 | + mPlayButton.SetUnselectedImage( PLAY_IMAGE ); | |
| 180 | + mPlayButton.SetSelectedImage( PLAY_IMAGE ); | |
| 181 | + mPauseButton.SetUnselectedImage( PAUSE_IMAGE ); | |
| 182 | + mPauseButton.SetSelectedImage( PAUSE_IMAGE ); | |
| 183 | + | |
| 184 | + mStopButton.SetUnselectedImage( STOP_IMAGE ); | |
| 185 | + mStopButton.SetSelectedImage( STOP_IMAGE ); | |
| 186 | + mResetButton.SetUnselectedImage( RESET_IMAGE ); | |
| 187 | + mResetButton.SetSelectedImage( RESET_IMAGE ); | |
| 188 | + | |
| 189 | + mBackwardButton.SetUnselectedImage( BACKWARD_IMAGE ); | |
| 190 | + mBackwardButton.SetSelectedImage( BACKWARD_IMAGE ); | |
| 191 | + mForwardButton.SetUnselectedImage( FORWARD_IMAGE ); | |
| 192 | + mForwardButton.SetSelectedImage( FORWARD_IMAGE ); | |
| 193 | + | |
| 194 | + mPanGestureDetector = PanGestureDetector::New(); | |
| 195 | + mPanGestureDetector.Attach( mVideoView ); | |
| 196 | + mPanGestureDetector.DetectedSignal().Connect( this, &VideoViewController::OnPan ); | |
| 197 | + | |
| 198 | + mPinchGestureDetector = PinchGestureDetector::New(); | |
| 199 | + mPinchGestureDetector.Attach( mVideoView ); | |
| 200 | + mPinchGestureDetector.DetectedSignal().Connect( this, &VideoViewController::OnPinch ); | |
| 201 | + | |
| 202 | + mTapGestureDetector = TapGestureDetector::New(); | |
| 203 | + mTapGestureDetector.Attach( mVideoView ); | |
| 204 | + mTapGestureDetector.DetectedSignal().Connect( this, &VideoViewController::OnTap ); | |
| 205 | + | |
| 206 | + mRotationAnimation = Animation::New(2.f); | |
| 207 | + mRotationAnimation.AnimateBy( Property(mVideoView, Actor::Property::ORIENTATION), Quaternion(Degree(0.f), Degree(360.f), Degree(0.f)) ); | |
| 208 | + mRotationAnimation.SetLooping(false); | |
| 209 | + | |
| 210 | + Stage::GetCurrent().KeyEventSignal().Connect( this, &VideoViewController::OnKeyEvent ); | |
| 211 | + | |
| 212 | + Property::Map customShader; | |
| 213 | + customShader.Insert( "fragmentShader", FRAGMENT_SHADER ); | |
| 214 | + mCustomShader.Insert( "rendererType", "image" ); | |
| 215 | + mCustomShader.Insert( "shader", customShader ); | |
| 216 | + | |
| 217 | + Property::Map defaultShader; | |
| 218 | + customShader.Insert( "fragmentShader", DEFAULT_FRAGMENT_SHADER ); | |
| 219 | + mDefaultShader.Insert( "rendererType", "image" ); | |
| 220 | + mDefaultShader.Insert( "shader", defaultShader ); | |
| 221 | + | |
| 222 | + mWindowSurfaceTarget.Insert( "RENDERING_TARGET", "windowSurfaceTarget" ); | |
| 223 | + mNativeImageTarget.Insert( "RENDERING_TARGET", "nativeImageTarget" ); | |
| 224 | + | |
| 225 | + mVideoView.FinishedSignal().Connect( this, &VideoViewController::OnFinished ); | |
| 226 | + } | |
| 227 | + | |
| 228 | + bool OnButtonClicked( Button button ) | |
| 229 | + { | |
| 230 | + | |
| 231 | + if( mPauseButton.GetId() == button.GetId()) | |
| 232 | + { | |
| 233 | + if( mIsPlay ) | |
| 234 | + { | |
| 235 | + mPauseButton.SetVisible( false ); | |
| 236 | + mPauseButton.SetDisabled( true ); | |
| 237 | + mPlayButton.SetVisible( true ); | |
| 238 | + mPlayButton.SetDisabled( false ); | |
| 239 | + | |
| 240 | + mIsPlay = false; | |
| 241 | + mVideoView.Pause(); | |
| 242 | + } | |
| 243 | + } | |
| 244 | + else if( mPlayButton.GetId() == button.GetId()) | |
| 245 | + { | |
| 246 | + if( mIsStop ) | |
| 247 | + { | |
| 248 | + return false; | |
| 249 | + } | |
| 250 | + | |
| 251 | + mPauseButton.SetVisible( true ); | |
| 252 | + mPauseButton.SetDisabled( false ); | |
| 253 | + mPlayButton.SetVisible( false ); | |
| 254 | + mPlayButton.SetDisabled( true ); | |
| 255 | + | |
| 256 | + mIsPlay = true; | |
| 257 | + mVideoView.Play(); | |
| 258 | + } | |
| 259 | + else if( mResetButton.GetId() == button.GetId()) | |
| 260 | + { | |
| 261 | + if( mIsStop ) | |
| 262 | + { | |
| 263 | + mPauseButton.SetVisible( true ); | |
| 264 | + mPauseButton.SetDisabled( false ); | |
| 265 | + mPlayButton.SetVisible( false ); | |
| 266 | + mPlayButton.SetDisabled( true ); | |
| 267 | + mResetButton.SetVisible( false ); | |
| 268 | + mResetButton.SetDisabled( true ); | |
| 269 | + mStopButton.SetVisible( true ); | |
| 270 | + mStopButton.SetDisabled( false ); | |
| 271 | + | |
| 272 | + mIsStop = false; | |
| 273 | + mIsPlay = true; | |
| 274 | + mVideoView.SetProperty( VideoView::Property::VIDEO, PLAY_FILE ); | |
| 275 | + mVideoView.Play(); | |
| 276 | + } | |
| 277 | + } | |
| 278 | + else if( mStopButton.GetId() == button.GetId()) | |
| 279 | + { | |
| 280 | + mPauseButton.SetVisible( false ); | |
| 281 | + mPauseButton.SetDisabled( true ); | |
| 282 | + mPlayButton.SetVisible( true ); | |
| 283 | + mPlayButton.SetDisabled( false ); | |
| 284 | + mResetButton.SetVisible( true ); | |
| 285 | + mResetButton.SetDisabled( false ); | |
| 286 | + mStopButton.SetVisible( false ); | |
| 287 | + mStopButton.SetDisabled( true ); | |
| 288 | + | |
| 289 | + mIsStop = true; | |
| 290 | + mVideoView.Stop(); | |
| 291 | + } | |
| 292 | + else if( mBackwardButton.GetId() == button.GetId()) | |
| 293 | + { | |
| 294 | + mVideoView.Backward( SEEK_POS ); | |
| 295 | + } | |
| 296 | + else if( mForwardButton.GetId() == button.GetId()) | |
| 297 | + { | |
| 298 | + mVideoView.Forward( SEEK_POS ); | |
| 299 | + } | |
| 300 | + | |
| 301 | + return true; | |
| 302 | + } | |
| 303 | + | |
| 304 | + void OnFinished( VideoView& view ) | |
| 305 | + { | |
| 306 | + if( !mIsFullScreen ) | |
| 307 | + { | |
| 308 | + mRotationAnimation.Play(); | |
| 309 | + mIsStop = true; | |
| 310 | + } | |
| 311 | + } | |
| 312 | + | |
| 313 | + void OnPan( Actor actor, const PanGesture& gesture ) | |
| 314 | + { | |
| 315 | + if( !mIsFullScreen && gesture.state == Gesture::Continuing ) | |
| 316 | + { | |
| 317 | + mVideoView.TranslateBy( Vector3( gesture.displacement ) ); | |
| 318 | + } | |
| 319 | + } | |
| 320 | + | |
| 321 | + void OnPinch( Actor actor, const PinchGesture& gesture ) | |
| 322 | + { | |
| 323 | + if( gesture.state == Gesture::Started ) | |
| 324 | + { | |
| 325 | + mPinchStartScale = mScale; | |
| 326 | + } | |
| 327 | + | |
| 328 | + if( gesture.state == Gesture::Finished ) | |
| 329 | + { | |
| 330 | + mScale = mPinchStartScale * gesture.scale; | |
| 331 | + if( mScale > 1.f ) | |
| 332 | + { | |
| 333 | + mVideoView.SetSize( mStageSize.x, mStageSize.y ); | |
| 334 | + mVideoView.SetProperty( VideoView::Property::VIDEO, mWindowSurfaceTarget ); | |
| 335 | + mMenu.SetSize( mStageSize.x, 120 ); | |
| 336 | + mIsFullScreen = true; | |
| 337 | + } | |
| 338 | + else | |
| 339 | + { | |
| 340 | + mVideoView.SetSize( INIT_WIDTH, INIT_HEIGHT ); | |
| 341 | + mVideoView.SetProperty( VideoView::Property::VIDEO, mNativeImageTarget ); | |
| 342 | + mMenu.SetSize( INIT_WIDTH, 120 ); | |
| 343 | + mIsFullScreen = false; | |
| 344 | + } | |
| 345 | + } | |
| 346 | + } | |
| 347 | + | |
| 348 | + void OnTap( Actor actor, const TapGesture& tapGesture ) | |
| 349 | + { | |
| 350 | + if( !mIsFullScreen ) | |
| 351 | + { | |
| 352 | + mRotationAnimation.Play(); | |
| 353 | + | |
| 354 | + if( mSetCustomShader ) | |
| 355 | + { | |
| 356 | + mSetCustomShader = false; | |
| 357 | + mVideoView.SetProperty( VideoView::Property::VIDEO, mDefaultShader ); | |
| 358 | + } | |
| 359 | + else | |
| 360 | + { | |
| 361 | + mSetCustomShader = true; | |
| 362 | + mVideoView.SetProperty( VideoView::Property::VIDEO, mCustomShader ); | |
| 363 | + } | |
| 364 | + } | |
| 365 | + } | |
| 366 | + | |
| 367 | +private: | |
| 368 | + | |
| 369 | + /** | |
| 370 | + * Main key event handler | |
| 371 | + */ | |
| 372 | + void OnKeyEvent(const KeyEvent& event) | |
| 373 | + { | |
| 374 | + if(event.state == KeyEvent::Down) | |
| 375 | + { | |
| 376 | + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | |
| 377 | + { | |
| 378 | + mApplication.Quit(); | |
| 379 | + } | |
| 380 | + } | |
| 381 | + } | |
| 382 | + | |
| 383 | +private: | |
| 384 | + Application& mApplication; | |
| 385 | + VideoView mVideoView; | |
| 386 | + Layer mMenu; | |
| 387 | + Vector2 mStageSize; | |
| 388 | + | |
| 389 | + bool mIsPlay; | |
| 390 | + bool mIsStop; | |
| 391 | + bool mIsFullScreen; | |
| 392 | + bool mSetCustomShader; | |
| 393 | + | |
| 394 | + PushButton mPlayButton; | |
| 395 | + PushButton mPauseButton; | |
| 396 | + PushButton mStopButton; | |
| 397 | + PushButton mResetButton; | |
| 398 | + PushButton mBackwardButton; | |
| 399 | + PushButton mForwardButton; | |
| 400 | + | |
| 401 | + PanGestureDetector mPanGestureDetector; | |
| 402 | + PinchGestureDetector mPinchGestureDetector; | |
| 403 | + TapGestureDetector mTapGestureDetector; | |
| 404 | + float mScale; | |
| 405 | + float mPinchStartScale; | |
| 406 | + | |
| 407 | + Animation mRotationAnimation; | |
| 408 | + Property::Map mCustomShader; | |
| 409 | + Property::Map mDefaultShader; | |
| 410 | + Property::Map mWindowSurfaceTarget; | |
| 411 | + Property::Map mNativeImageTarget; | |
| 412 | +}; | |
| 413 | + | |
| 414 | +void RunTest( Application& application ) | |
| 415 | +{ | |
| 416 | + VideoViewController test( application ); | |
| 417 | + | |
| 418 | + application.MainLoop(); | |
| 419 | +} | |
| 420 | + | |
| 421 | +// Entry point for Linux & Tizen applications | |
| 422 | +// | |
| 423 | +int DALI_EXPORT_API main( int argc, char **argv ) | |
| 424 | +{ | |
| 425 | + Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); | |
| 426 | + | |
| 427 | + RunTest( application ); | |
| 428 | + | |
| 429 | + return 0; | |
| 430 | +} | ... | ... |
packaging/com.samsung.dali-demo.spec
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | Name: com.samsung.dali-demo |
| 4 | 4 | Summary: The OpenGLES Canvas Core Demo |
| 5 | -Version: 1.1.38 | |
| 5 | +Version: 1.1.39 | |
| 6 | 6 | Release: 1 |
| 7 | 7 | Group: System/Libraries |
| 8 | 8 | License: Apache-2.0 |
| ... | ... | @@ -133,6 +133,7 @@ exit 0 |
| 133 | 133 | %{dali_app_exe_dir}/*.example |
| 134 | 134 | %{dali_app_exe_dir}/dali-builder |
| 135 | 135 | %{dali_app_ro_dir}/images/* |
| 136 | +%{dali_app_ro_dir}/videos/* | |
| 136 | 137 | %{dali_app_ro_dir}/models/* |
| 137 | 138 | %{dali_app_ro_dir}/scripts/* |
| 138 | 139 | %{dali_app_ro_dir}/style/* | ... | ... |
resources/images/Backward.png
0 → 100755
6.56 KB
resources/images/Forward.png
0 → 100755
7.07 KB
resources/images/Pause.png
0 → 100755
679 Bytes
resources/scripts/animation.json
| ... | ... | @@ -92,7 +92,7 @@ |
| 92 | 92 | "size": [200, 200, 1], |
| 93 | 93 | "orientation": [0, 0, 30], |
| 94 | 94 | "signals": [{ |
| 95 | - "name": "touched", | |
| 95 | + "name": "touch", | |
| 96 | 96 | "action": "play", |
| 97 | 97 | "animation": "animate" |
| 98 | 98 | }] |
| ... | ... | @@ -106,7 +106,7 @@ |
| 106 | 106 | "position": [-150, -50, 0], |
| 107 | 107 | "text": "or me", |
| 108 | 108 | "signals": [{ |
| 109 | - "name": "touched", | |
| 109 | + "name": "touch", | |
| 110 | 110 | "action": "play", |
| 111 | 111 | "animation": "pathAnimation" |
| 112 | 112 | }] |
| ... | ... | @@ -119,14 +119,12 @@ |
| 119 | 119 | }, { |
| 120 | 120 | "name": "image", |
| 121 | 121 | "type": "ImageView", |
| 122 | - "image": { | |
| 123 | - "url": "{DEMO_IMAGE_DIR}gallery-large-21.jpg" | |
| 124 | - }, | |
| 122 | + "image": "{DEMO_IMAGE_DIR}gallery-large-21.jpg", | |
| 125 | 123 | "relayoutEnabled": false, |
| 126 | 124 | "position": [0, 200, 0], |
| 127 | 125 | "size": [200, 200, 1], |
| 128 | 126 | "signals": [{ |
| 129 | - "name": "touched", | |
| 127 | + "name": "touch", | |
| 130 | 128 | "action": "play", |
| 131 | 129 | "animation": "rotate" |
| 132 | 130 | }], | ... | ... |
resources/scripts/slider-test-style.json
resources/scripts/slider.json
| ... | ... | @@ -73,10 +73,12 @@ |
| 73 | 73 | "showValue": true, |
| 74 | 74 | "valuePrecision": 0, |
| 75 | 75 | "value": 50.0, |
| 76 | - "popupTextColor": [1, 0, 0, 1], | |
| 77 | - "hitRegion": [0, 48], | |
| 78 | - "backingRegion": [0, 10], | |
| 79 | - "handleRegion": [48, 48] | |
| 76 | + "trackVisual": { | |
| 77 | + "size": [0, 10] | |
| 78 | + }, | |
| 79 | + "handleVisual": { | |
| 80 | + "size": [48, 48] | |
| 81 | + } | |
| 80 | 82 | }, { |
| 81 | 83 | "type": "Slider", |
| 82 | 84 | "parentOrigin": "TOP_CENTER", |
| ... | ... | @@ -88,12 +90,17 @@ |
| 88 | 90 | "showValue": true, |
| 89 | 91 | "valuePrescision": 0, |
| 90 | 92 | "value": 100.0, |
| 91 | - "hitRegion": [0, 48], | |
| 92 | - "backingRegion": [0, 30], | |
| 93 | - "handleRegion": [48, 48], | |
| 94 | - "backingImageName": "{DEMO_IMAGE_DIR}button-up-14.9.png", | |
| 95 | - "handleImageName": "{DEMO_IMAGE_DIR}blocks-ball.png", | |
| 96 | - "progressImageName": "{DEMO_IMAGE_DIR}button-down.9.png" | |
| 93 | + "trackVisual": { | |
| 94 | + "url": "{DEMO_IMAGE_DIR}button-up-14.9.png", | |
| 95 | + "size": [0, 30] | |
| 96 | + }, | |
| 97 | + "handleVisual": { | |
| 98 | + "url": "{DEMO_IMAGE_DIR}blocks-ball.png", | |
| 99 | + "size": [48, 48] | |
| 100 | + }, | |
| 101 | + "progressVisual": { | |
| 102 | + "url": "{DEMO_IMAGE_DIR}button-down.9.png" | |
| 103 | + } | |
| 97 | 104 | }, { |
| 98 | 105 | "type": "Slider", |
| 99 | 106 | "parentOrigin": "TOP_CENTER", |
| ... | ... | @@ -105,10 +112,12 @@ |
| 105 | 112 | "showValue": true, |
| 106 | 113 | "valuePrecision": 0, |
| 107 | 114 | "value": 50.0, |
| 108 | - "hitRegion": [0, 48], | |
| 109 | - "backingRegion": [0, 10], | |
| 110 | - "handleRegion": [48, 48], | |
| 111 | - "enabled": false | |
| 115 | + "trackVisual": { | |
| 116 | + "size": [0, 10] | |
| 117 | + }, | |
| 118 | + "handleVisual": { | |
| 119 | + "size": [48, 48] | |
| 120 | + } | |
| 112 | 121 | }, { |
| 113 | 122 | "type": "Slider", |
| 114 | 123 | "parentOrigin": "TOP_CENTER", |
| ... | ... | @@ -120,10 +129,12 @@ |
| 120 | 129 | "showValue": true, |
| 121 | 130 | "valuePrecision": 0, |
| 122 | 131 | "value": 50.0, |
| 123 | - "hitRegion": [0, 48], | |
| 124 | - "backingRegion": [0, 10], | |
| 125 | - "handleRegion": [48, 48], | |
| 126 | - "enabled": false, | |
| 127 | - "disableColor": [1, 0, 0, 1] | |
| 132 | + "trackVisual": { | |
| 133 | + "size": [0, 10] | |
| 134 | + }, | |
| 135 | + "handleVisual": { | |
| 136 | + "size": [48, 48] | |
| 137 | + }, | |
| 138 | + "disabledColor": [1, 0, 0, 1] | |
| 128 | 139 | }] |
| 129 | 140 | } | ... | ... |
resources/scripts/table-view.json
| ... | ... | @@ -65,9 +65,7 @@ |
| 65 | 65 | "name":"gallery1", |
| 66 | 66 | "type":"ImageView", |
| 67 | 67 | "heightResizePolicy":"FILL_TO_PARENT", |
| 68 | - "image": { | |
| 69 | - "url": "{DEMO_IMAGE_DIR}gallery-small-1.jpg" | |
| 70 | - }, | |
| 68 | + "image": "{DEMO_IMAGE_DIR}gallery-small-1.jpg", | |
| 71 | 69 | "properties": { // properties registered dynamically |
| 72 | 70 | "cellIndex": [0,0], // property to specify the top-left cell this child occupies |
| 73 | 71 | "rowSpan":4, // property to specify how many rows this child occupies, if not set, default value is 1 |
| ... | ... | @@ -77,9 +75,7 @@ |
| 77 | 75 | "name":"gallery2", |
| 78 | 76 | "type":"ImageView", |
| 79 | 77 | "heightResizePolicy":"FILL_TO_PARENT", |
| 80 | - "image": { | |
| 81 | - "url": "{DEMO_IMAGE_DIR}gallery-small-2.jpg" | |
| 82 | - }, | |
| 78 | + "image": "{DEMO_IMAGE_DIR}gallery-small-2.jpg", | |
| 83 | 79 | "properties": { // properties registered dynamically |
| 84 | 80 | "cellIndex": [0,1], |
| 85 | 81 | "cellHorizontalAlignment": "right" // property to specify how to align horizontally inside the cells, if not set, default value is 'left' |
| ... | ... | @@ -87,9 +83,7 @@ |
| 87 | 83 | },{ |
| 88 | 84 | "name":"gallery3", |
| 89 | 85 | "type":"ImageView", |
| 90 | - "image": { | |
| 91 | - "url": "{DEMO_IMAGE_DIR}gallery-small-3.jpg" | |
| 92 | - }, | |
| 86 | + "image": "{DEMO_IMAGE_DIR}gallery-small-3.jpg", | |
| 93 | 87 | "properties": { |
| 94 | 88 | "cellIndex":[1,1], |
| 95 | 89 | "rowSpan":3, |
| ... | ... | @@ -100,9 +94,7 @@ |
| 100 | 94 | "name":"gallery4", |
| 101 | 95 | "type":"ImageView", |
| 102 | 96 | "widthResizePolicy":"FILL_TO_PARENT", |
| 103 | - "image": { | |
| 104 | - "url": "{DEMO_IMAGE_DIR}gallery-small-4.jpg" | |
| 105 | - }, | |
| 97 | + "image": "{DEMO_IMAGE_DIR}gallery-small-4.jpg", | |
| 106 | 98 | "properties": { |
| 107 | 99 | "cellIndex":[2,2] |
| 108 | 100 | } |
| ... | ... | @@ -111,9 +103,7 @@ |
| 111 | 103 | "type":"ImageView", |
| 112 | 104 | "widthResizePolicy":"FILL_TO_PARENT", |
| 113 | 105 | "heightResizePolicy":"FILL_TO_PARENT", |
| 114 | - "image": { | |
| 115 | - "url": "{DEMO_IMAGE_DIR}gallery-small-5.jpg" | |
| 116 | - }, | |
| 106 | + "image": "{DEMO_IMAGE_DIR}gallery-small-5.jpg", | |
| 117 | 107 | "properties": { |
| 118 | 108 | "cellIndex":[3,2], |
| 119 | 109 | "columnSpan": 2 | ... | ... |
resources/videos/big_buck_bunny.mp4
0 → 100644
No preview for this file type