1 #ifndef DALI_TOOLKIT_INTERNAL_VIDEO_VIEW_H
2 #define DALI_TOOLKIT_INTERNAL_VIDEO_VIEW_H
5 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/property-map.h>
23 #include <dali/public-api/images/native-image.h>
24 #include <dali/devel-api/adaptor-framework/video-player.h>
27 #include <dali-toolkit/internal/visuals/image/image-visual.h>
28 #include <dali-toolkit/public-api/controls/control-impl.h>
29 #include <dali-toolkit/public-api/controls/video-view/video-view.h>
42 class VideoView: public Control
53 * @copydoc Toolkit::VideoView::New()
55 static Toolkit::VideoView New();
58 * @brief Sets a video url to play.
61 * @param [in] url The url of the video resource to play
63 void SetUrl( const std::string& url );
66 * @brief Returns a video url.
68 * @return Url of string type
73 * @brief Sets the player looping status.
76 * @param [in] looping The new looping status: true or false
78 void SetLooping(bool looping);
81 * @brief Returns the player looping status.
84 * @return True if player is looping, false otherwise.
89 * @copydoc Toolkit::VideoView::Play()
94 * @copydoc Toolkit::VideoView::Pause()
99 * @copydoc Toolkit::VideoView::Stop()
104 * @copydoc Toolkit::VideoView::Forward()
106 void Forward( int millisecond );
109 * @copydoc Toolkit::VideoView::Backward()
111 void Backward( int millisecond );
114 * @brief Sets the player mute status.
116 * @param[i] mute The new mute status, true is mute.
118 void SetMute( bool mute );
121 * @brief Returns the player mute status.
123 * @return True if player is mute.
128 * @brief Sets the player volume.
130 * @param[in] left The left volume scalar
131 * @param[in] right The right volume scalar
133 void SetVolume( float left, float right );
136 * @brief Returns current volume factor.
138 * @param[out] left The current left volume scalar
139 * @param[out] right The current right volume scalar
141 void GetVolume( float& left, float& right );
144 * @copydoc Dali::Toolkit::VideoView::FinishedSignal()
146 Dali::Toolkit::VideoView::VideoViewSignalType& FinishedSignal();
149 * @brief Emit the finished signal
151 void EmitSignalFinish();
154 * @brief Set property map
156 * @param[in] map The Dali::Property::Map to use for to display.
158 void SetPropertyMap( Property::Map map );
162 * @brief Called when a property of an object of this type is set.
164 * @param[in] object The object whose property is set.
165 * @param[in] index The property index.
166 * @param[in] value The new property value.
168 static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
171 * @brief Called to retrieve a property of an object of this type.
173 * @param[in] object The object whose property is to be retrieved.
174 * @param[in] index The property index.
175 * @return The current value of the property.
177 static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
180 * @brief Set the depth index of this image renderer
182 * Renderer with higher depth indices are rendered in front of other visuals with smaller values
184 * @param[in] depthIndex The depth index of this renderer
186 void SetDepthIndex( int depthIndex );
190 * @brief Performs actions as requested using the action name.
192 * @param[in] object The object on which to perform the action.
193 * @param[in] actionName The action to perform.
194 * @param[in] attributes The attributes with which to perfrom this action.
195 * @return True if action has been accepted by this control
197 static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes );
199 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
201 private: // From Control
204 * @copydoc Toolkit::Control::OnStageConnect()
206 virtual void OnStageConnection( int depth );
209 * @copydoc Toolkit::Control::OnStageDisconnection()
211 virtual void OnStageDisconnection();
214 * @copydoc Toolkit::Control::GetNaturalSize
216 virtual Vector3 GetNaturalSize();
219 * @copydoc Toolkit::Control::GetHeightForWidth()
221 virtual float GetHeightForWidth( float width );
224 * @copydoc Toolkit::Control::GetWidthForHeight()
226 virtual float GetWidthForHeight( float height );
231 VideoView( const VideoView& videoView );
233 VideoView& operator=( const VideoView& videoView );
235 void SetWindowSurfaceTarget();
237 void SetNativeImageTarget();
241 Dali::VideoPlayer mVideoPlayer;
242 Dali::ImageDimensions mVideoSize;
243 Toolkit::Visual::Base mVisual;
244 Dali::Property::Map mPropertyMap;
245 Dali::NativeImage mNativeImage; ///< Native image handle for video rendering by texture streaming
246 Dali::Toolkit::VideoView::VideoViewSignalType mFinishedSignal;
248 int mCurrentVideoPlayPosition;
249 bool mSetRenderingTarget;
254 } // namespace Internal
256 inline Toolkit::Internal::VideoView& GetImpl( Toolkit::VideoView& handle )
258 DALI_ASSERT_ALWAYS( handle );
259 Dali::RefObject& impl = handle.GetImplementation();
260 return static_cast< Toolkit::Internal::VideoView& >( impl );
263 inline const Toolkit::Internal::VideoView& GetImpl( const Toolkit::VideoView& handle )
265 DALI_ASSERT_ALWAYS( handle );
266 const Dali::RefObject& impl = handle.GetImplementation();
267 return static_cast< const Toolkit::Internal::VideoView& >( impl );
270 } // namespace Toolkit
274 #endif // DALI_TOOLKIT_VIDEO_VIEW_H