[4.0] Added destroying playback handle 43/157143/2 accepted/tizen/4.0/unified/20171026.152942 submit/tizen_4.0/20171024.134235 tizen_4.0.m2_release
authortaeyoon0.lee <taeyoon0.lee@samsung.com>
Mon, 23 Oct 2017 10:50:44 +0000 (19:50 +0900)
committerTaeyoon Lee <taeyoon0.lee@samsung.com>
Mon, 23 Oct 2017 12:04:37 +0000 (12:04 +0000)
Change-Id: Ia8a88dd216bbaa8fc0a991b3da8d27dc24f82684

dali-extension/video-player/tizen-video-player.cpp
dali-extension/video-player/tizen-video-player.h

index 1e22c5f..d5b1ccf 100644 (file)
@@ -225,6 +225,7 @@ TizenVideoPlayer::TizenVideoPlayer()
 
 TizenVideoPlayer::~TizenVideoPlayer()
 {
+  DestroyPlayer();
 }
 
 void TizenVideoPlayer::GetPlayerState( player_state_e* state )
@@ -269,24 +270,7 @@ std::string TizenVideoPlayer::GetUrl()
 
 void TizenVideoPlayer::SetRenderingTarget( Any target )
 {
-  int error;
-  if( mPlayerState != PLAYER_STATE_NONE )
-  {
-    GetPlayerState( &mPlayerState );
-
-    if( mPlayerState != PLAYER_STATE_IDLE )
-    {
-      Stop();
-      error = player_unprepare( mPlayer );
-      LogPlayerError( error );
-    }
-
-    error = player_destroy( mPlayer );
-    LogPlayerError( error );
-    mPlayerState = PLAYER_STATE_NONE;
-    mPlayer = NULL;
-    mUrl = "";
-  }
+  DestroyPlayer();
 
   mNativeImageSourcePtr = NULL;
   mEcoreWlWindow = NULL;
@@ -755,5 +739,27 @@ bool TizenVideoPlayer::IsVideoTextureSupported()
   return featureFlag;
 }
 
+void TizenVideoPlayer::DestroyPlayer()
+{
+  int error;
+  if( mPlayerState != PLAYER_STATE_NONE )
+  {
+    GetPlayerState( &mPlayerState );
+
+    if( mPlayerState != PLAYER_STATE_IDLE )
+    {
+      Stop();
+      error = player_unprepare( mPlayer );
+      LogPlayerError( error );
+    }
+
+    error = player_destroy( mPlayer );
+    LogPlayerError( error );
+    mPlayerState = PLAYER_STATE_NONE;
+    mPlayer = NULL;
+    mUrl = "";
+  }
+}
+
 } // namespace Plugin
 } // namespace Dali;
index 2dc2b0a..0f8845b 100644 (file)
@@ -205,6 +205,11 @@ private:
    */
   void InitializeUnderlayMode( Ecore_Wl_Window* ecoreWlWindow );
 
+  /**
+   * @brief Destroys player handle
+   */
+  void DestroyPlayer();
+
 private:
 
   std::string mUrl; ///< The video file path