[Player] add logs
authorNAMJEONGYOON <just.nam@samsung.com>
Fri, 13 Jan 2017 03:33:23 +0000 (12:33 +0900)
committerNAMJEONGYOON <just.nam@samsung.com>
Fri, 20 Jan 2017 01:25:45 +0000 (10:25 +0900)
Change-Id: Ie277068d45ed67509a2d31f8ee9b8b3a12417af1

12 files changed:
src/Tizen.Multimedia/Player/AudioEffect.cs
src/Tizen.Multimedia/Player/CapturedFrame.cs
src/Tizen.Multimedia/Player/DownloadProgress.cs
src/Tizen.Multimedia/Player/EqualizerBand.cs
src/Tizen.Multimedia/Player/MediaBufferSource.cs
src/Tizen.Multimedia/Player/MediaSource.cs
src/Tizen.Multimedia/Player/MediaStreamSource.cs
src/Tizen.Multimedia/Player/MediaUriSource.cs
src/Tizen.Multimedia/Player/Player.cs
src/Tizen.Multimedia/Player/PlayerDisplay.cs
src/Tizen.Multimedia/Player/PlayerTrackInfo.cs
src/Tizen.Multimedia/Player/StreamInfo.cs

index a25cc67..afd95b9 100644 (file)
@@ -26,6 +26,7 @@ namespace Tizen.Multimedia
 
         internal AudioEffect(Player owner)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             Player = owner;
 
             bool available = false;
@@ -47,6 +48,7 @@ namespace Tizen.Multimedia
             MaxBandLevel = max;
 
             _bands = new EqualizerBand[count];
+            Log.Debug(PlayerLog.Tag, "available : " + available + ", count : " + count + ", min : " + min + ", max : " + max);
         }
 
         /// <summary>
@@ -63,6 +65,7 @@ namespace Tizen.Multimedia
         {
             get
             {
+                Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
                 Player.ValidateNotDisposed();
 
                 if (index < 0 || Count <= index)
@@ -75,6 +78,7 @@ namespace Tizen.Multimedia
                 {
                     _bands[index] = new EqualizerBand(this, index);
                 }
+                Log.Info(PlayerLog.Tag, "get equalizer band : " + _bands[index]);
                 return _bands[index];
             }
         }
@@ -85,10 +89,12 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The <see cref="Player"/> has already been disposed of.</exception>
         public void Clear()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             Player.ValidateNotDisposed();
 
             PlayerErrorConverter.ThrowIfError(Interop.Player.AudioEffectEqualizerClear(Player.GetHandle()),
                 "Failed to clear equalizer effect");
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
 
         public int Count{ get; }
index b74bf32..f9a5157 100644 (file)
@@ -31,6 +31,7 @@ namespace Tizen.Multimedia
 
             Buffer = imageBuffer;
             Size = new Size(width, height);
+            Log.Debug(PlayerLog.Tag, "width : " + width + ", height : " + height);
         }
 
         /// <summary>
index 1b25f30..feeeea8 100644 (file)
@@ -30,6 +30,7 @@ namespace Tizen.Multimedia
         {
             Start = start;
             Current = current;
+            Log.Debug(PlayerLog.Tag, "start : " + start + ", current : " + current);
         }
 
         /// <summary>
index e64c87d..0b0c7ee 100644 (file)
@@ -29,6 +29,7 @@ namespace Tizen.Multimedia
 
         internal EqualizerBand(AudioEffect owner, int index)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             Debug.Assert(owner != null);
 
             _owner = owner;
@@ -45,6 +46,7 @@ namespace Tizen.Multimedia
 
             Frequency = frequency;
             FrequencyRange = range;
+            Log.Debug(PlayerLog.Tag, "frequency : " + frequency + ", range : " + range);
         }
 
         /// <summary>
@@ -59,16 +61,22 @@ namespace Tizen.Multimedia
         /// </exception>
         public void SetLevel(int value)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             _owner.Player.ValidateNotDisposed();
 
             if (value < _owner.MinBandLevel || _owner.MaxBandLevel < value)
             {
+                Log.Error(PlayerLog.Tag, "invalid level : " + value);
                 throw new ArgumentOutOfRangeException(nameof(value), value,
                     $"valid value range is { nameof(AudioEffect.MinBandLevel) } <= level <= { nameof(AudioEffect.MaxBandLevel) }. " +
                     $"but got {value}.");
             }
 
             int ret = Interop.Player.AudioEffectSetEqualizerBandLevel(_owner.Player.GetHandle(), _index, value);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to set the level of the equalizer band, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to set the level of the equalizer band");
         }
 
@@ -78,13 +86,18 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The player that this EqualuzerBand belongs to has already been disposed of.</exception>
         public int GetLevel()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             _owner.Player.ValidateNotDisposed();
 
             int value = 0;
             int ret = Interop.Player.AudioEffectGetEqualizerBandLevel(_owner.Player.GetHandle(),
                 _index, out value);
-            PlayerErrorConverter.ThrowIfError(ret, "Failed to initialize equalizer band");
-
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to get the level of the equalizer band, " + (PlayerError)ret);
+            }
+            PlayerErrorConverter.ThrowIfError(ret, "Failed to get the level of the equalizer band");
+            Log.Info(PlayerLog.Tag, "get level : " + value);
             return value;
         }
 
index f6329bc..a0b619e 100644 (file)
@@ -42,6 +42,7 @@ namespace Tizen.Multimedia
         {
             if (length <= 0)
             {
+                Log.Error(PlayerLog.Tag, "invalid length : " + length);
                 throw new ArgumentOutOfRangeException(nameof(length), length,
                     "length can't be equal to or less than zero.");
             }
@@ -76,18 +77,22 @@ namespace Tizen.Multimedia
         {
             if (buffer == null)
             {
+                Log.Error(PlayerLog.Tag, "invalid buffer");
                 throw new ArgumentNullException(nameof(buffer));
             }
             if (offset < 0)
             {
+                Log.Error(PlayerLog.Tag, "invalid offset : " + offset);
                 throw new ArgumentOutOfRangeException(nameof(offset), offset, "offset can't be less than zero.");
             }
             if (length <= 0)
             {
+                Log.Error(PlayerLog.Tag, "invalid length : " + length);
                 throw new ArgumentOutOfRangeException(nameof(length), length, "length can't be equal to or less than zero.");
             }
             if (length + offset > buffer.Length)
             {
+                Log.Error(PlayerLog.Tag, "invalid total length : " + (int)(length + offset));
                 throw new ArgumentOutOfRangeException($"length + offset can't be greater than the length of the { nameof(buffer) }.");
             }
 
@@ -109,6 +114,7 @@ namespace Tizen.Multimedia
         {
             if (buffer == null)
             {
+                Log.Error(PlayerLog.Tag, "invalid buffer");
                 throw new ArgumentNullException(nameof(buffer));
             }
 
@@ -126,6 +132,10 @@ namespace Tizen.Multimedia
         {
             // TODO test buffer if we need to use GCHandle
             int ret = Interop.Player.SetMemoryBuffer(player.GetHandle(), _buffer, _buffer.Length);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to set the memory buffer, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to set the memory buffer");
         }
     }
index b6ce203..428f1cb 100644 (file)
@@ -26,11 +26,13 @@ namespace Tizen.Multimedia
 
         internal void AttachTo(Player player)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             OnAttached(player);
         }
 
         internal void DetachFrom(Player player)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             OnDetached(player);
         }
 
index 8cf472e..b6057e6 100644 (file)
@@ -59,6 +59,7 @@ namespace Tizen.Multimedia
 
             if (!SupportedAudioTypes.Contains(format.MimeType))
             {
+                Log.Error(PlayerLog.Tag, "The audio format is not supported : " + format.MimeType);
                 throw new ArgumentException($"The audio format is not supported, Type : {format.MimeType}.");
             }
 
@@ -74,6 +75,7 @@ namespace Tizen.Multimedia
 
             if (!SupportedVideoTypes.Contains(format.MimeType))
             {
+                Log.Error(PlayerLog.Tag, "The video format is not supported : " + format.MimeType);
                 throw new ArgumentException($"The video format is not supported, Type : {format.MimeType}.");
             }
 
@@ -184,39 +186,50 @@ namespace Tizen.Multimedia
         {
             if (_player == null)
             {
+                Log.Error(PlayerLog.Tag, "The source is not set as a source to a player yet.");
                 throw new InvalidOperationException("The source is not set as a source to a player yet.");
             }
             if (packet == null)
             {
+                Log.Error(PlayerLog.Tag, "packet is null");
                 throw new ArgumentNullException(nameof(packet));
             }
             if (packet.IsDisposed)
             {
+                Log.Error(PlayerLog.Tag, "packet is disposed");
                 throw new ObjectDisposedException(nameof(packet));
             }
 
             if (packet.Format.Type == MediaFormatType.Text || packet.Format.Type == MediaFormatType.Container)
             {
+                Log.Error(PlayerLog.Tag, "The format of the packet is invalid : " + packet.Format.Type);
                 throw new ArgumentException($"The format of the packet is invalid : { packet.Format.Type }.");
             }
 
             if (!packet.Format.Equals(_audioMediaFormat) && !packet.Format.Equals(_videoMediaFormat))
             {
+                Log.Error(PlayerLog.Tag, "The format of the packet is invalid : Unmatched format.");
                 throw new ArgumentException($"The format of the packet is invalid : Unmatched format.");
             }
 
             if (packet.Format.Type == MediaFormatType.Video && _videoMediaFormat == null)
             {
+                Log.Error(PlayerLog.Tag, "Video is not configured with the current source.");
                 throw new ArgumentException("Video is not configured with the current source.");
             }
             if (packet.Format.Type == MediaFormatType.Audio && _audioMediaFormat == null)
             {
+                Log.Error(PlayerLog.Tag, "Audio is not configured with the current source.");
                 throw new ArgumentException("Audio is not configured with the current source.");
             }
 
             _player.ValidatePlayerState(PlayerState.Paused, PlayerState.Playing, PlayerState.Ready);
 
             int ret = Interop.Player.PushMediaStream(_player.GetHandle(), packet.GetHandle());
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to push the packet to the player, " + (PlayerError)ret);
+            }
 
             PlayerErrorConverter.ThrowIfError(ret, "Failed to push the packet to the player");
         }
@@ -225,6 +238,7 @@ namespace Tizen.Multimedia
         {
             if (mediaFormat == null)
             {
+                Log.Error(PlayerLog.Tag, "invalid media format");
                 return;
             }
 
@@ -234,6 +248,10 @@ namespace Tizen.Multimedia
             {
                 ptr = mediaFormat.AsNativeHandle();
                 int ret = Interop.Player.SetMediaStreamInfo(_player.GetHandle(), (int)streamType, ptr);
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to set the media stream info, " + (PlayerError)ret);
+                }
 
                 PlayerErrorConverter.ThrowIfError(ret, "Failed to set the media stream info");
             }
@@ -249,6 +267,7 @@ namespace Tizen.Multimedia
 
             if (_player != null)
             {
+                Log.Error(PlayerLog.Tag, "The source is has already been assigned to another player.");
                 throw new InvalidOperationException("The source is has already been assigned to another player.");
             }
 
index d858a74..a8b4215 100644 (file)
@@ -39,6 +39,7 @@ namespace Tizen.Multimedia
         {
             if (uri == null)
             {
+                Log.Error(PlayerLog.Tag, "uri is null");
                 throw new ArgumentNullException(nameof(uri));
             }
             Uri = uri;
index 2274559..99cb1e1 100755 (executable)
@@ -22,6 +22,13 @@ using System.Threading;
 
 namespace Tizen.Multimedia
 {
+    static internal class PlayerLog
+    {
+        internal const string Tag = "Tizen.Multimedia.Player";
+        internal const string Enter = "[ENTER]";
+        internal const string Leave = "[LEAVE]";
+    }
+
     /// <summary>
     /// Provides the ability to control media playback.
     /// </summary>
@@ -101,9 +108,14 @@ namespace Tizen.Multimedia
         /// </summary>
         public Player()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             try
             {
                 int ret = Interop.Player.Create(out _handle);
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to create player, " + (PlayerError)ret);
+                }
                 PlayerErrorConverter.ThrowIfError(ret, "Failed to create player");
 
                 RetrieveProperties();
@@ -123,6 +135,7 @@ namespace Tizen.Multimedia
 
         private void RetrieveProperties()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             PlayerErrorConverter.ThrowIfError(Interop.Player.GetVolume(_handle, out _volume, out _volume),
                 "Failed to initialize the player");
 
@@ -133,10 +146,12 @@ namespace Tizen.Multimedia
 
             PlayerErrorConverter.ThrowIfError(Interop.Player.IsLooping(_handle, out _isLooping),
                 "Failed to initialize the player");
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
 
         private void RegisterCallbacks()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             RegisterSubtitleUpdatedCallback();
             RegisterErrorOccuuredCallback();
             RegisterPlaybackInterruptedCallback();
@@ -150,6 +165,7 @@ namespace Tizen.Multimedia
 
         ~Player()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             Dispose(false);
         }
 
@@ -171,12 +187,13 @@ namespace Tizen.Multimedia
                 return;
             }
 
+            Log.Warn(PlayerLog.Tag, "current state : " + State + ", desired state : " + string.Join(", ", desiredStates));
             throw new InvalidOperationException($"The player is not in a valid state. " +
                 $"Current State : { curState }, Valid State : { string.Join(", ", desiredStates) }.");
         }
 
-        #region Properties
-        #region Network configuration
+#region Properties
+#region Network configuration
         private string _cookie = "";
         private string _userAgent = "";
 
@@ -191,21 +208,29 @@ namespace Tizen.Multimedia
         {
             get
             {
+                Log.Info(PlayerLog.Tag, "get cookie : " + _cookie);
                 return _cookie;
             }
             set
             {
+                Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
                 ValidatePlayerState(PlayerState.Idle);
 
                 if (value == null)
                 {
+                    Log.Error(PlayerLog.Tag, "cookie can't be null");
                     throw new ArgumentNullException(nameof(value), "Cookie can't be null.");
                 }
 
                 int ret = Interop.Player.SetStreamingCookie(_handle, value, value.Length);
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to set the cookie to the player, " + (PlayerError)ret);
+                }
                 PlayerErrorConverter.ThrowIfError(ret, "Failed to set the cookie to the player");
 
                 _cookie = value;
+                Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
             }
         }
 
@@ -220,24 +245,32 @@ namespace Tizen.Multimedia
         {
             get
             {
+                Log.Info(PlayerLog.Tag, "get useragent : " + _userAgent);
                 return _userAgent;
             }
             set
             {
+                Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
                 ValidatePlayerState(PlayerState.Idle);
 
                 if (value == null)
                 {
+                    Log.Error(PlayerLog.Tag, "UserAgent can't be null");
                     throw new ArgumentNullException(nameof(value), "UserAgent can't be null.");
                 }
 
                 int ret = Interop.Player.SetStreamingUserAgent(_handle, value, value.Length);
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to set the user agent to the player, " + (PlayerError)ret);
+                }
                 PlayerErrorConverter.ThrowIfError(ret, "Failed to set the user agent to the player");
 
                 _userAgent = value;
+                Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
             }
         }
-        #endregion
+#endregion
 
         /// <summary>
         /// Gets the state of the player.
@@ -258,6 +291,10 @@ namespace Tizen.Multimedia
 
                 int state = 0;
                 int ret = Interop.Player.GetState(_handle, out state);
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to retrieve the state of the player, " + (PlayerError)ret);
+                }
                 PlayerErrorConverter.ThrowIfError(ret, "Failed to retrieve the state of the player");
 
                 Debug.Assert(Enum.IsDefined(typeof(PlayerState), state));
@@ -283,10 +320,12 @@ namespace Tizen.Multimedia
         {
             get
             {
+                Log.Info(PlayerLog.Tag, "get audio latency mode : " + _audioLatencyMode);
                 return _audioLatencyMode;
             }
             set
             {
+                Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
                 ValidateNotDisposed();
 
                 if (_audioLatencyMode == value)
@@ -296,6 +335,10 @@ namespace Tizen.Multimedia
                 ValidationUtil.ValidateEnum(typeof(AudioLatencyMode), value);
 
                 int ret = Interop.Player.SetAudioLatencyMode(_handle, (int)value);
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to set the audio latency mode of the player, " + (PlayerError)ret);
+                }
                 PlayerErrorConverter.ThrowIfError(ret, "Failed to set the audio latency mode of the player");
 
                 _audioLatencyMode = value;
@@ -313,10 +356,12 @@ namespace Tizen.Multimedia
         {
             get
             {
+                Log.Info(PlayerLog.Tag, "get looping : " + _isLooping);
                 return _isLooping;
             }
             set
             {
+                Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
                 ValidateNotDisposed();
 
                 if (_isLooping == value)
@@ -325,22 +370,28 @@ namespace Tizen.Multimedia
                 }
 
                 int ret = Interop.Player.SetLooping(_handle, value);
-                PlayerErrorConverter.ThrowIfError(ret, "Failed to set the mute state of the player");
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to set the looping state of the player, " + (PlayerError)ret);
+                }
+                PlayerErrorConverter.ThrowIfError(ret, "Failed to set the looping state of the player");
 
                 _isLooping = value;
-
             }
         }
 
-        #region Display methods
+#region Display methods
         private PlayerDisplay _display;
 
         private int SetDisplay(PlayerDisplay display)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             if (display == null)
             {
+                Log.Info(PlayerLog.Tag, "set display to none");
                 return Interop.Player.SetDisplay(_handle, (int)PlayerDisplayType.None, IntPtr.Zero);
             }
+            Log.Info(PlayerLog.Tag, "set display to " + display.Type + " (" + display.EvasObject + ")");
 
             Debug.Assert(Enum.IsDefined(typeof(PlayerDisplayType), display.Type));
             Debug.Assert(display.EvasObject != null);
@@ -359,6 +410,7 @@ namespace Tizen.Multimedia
             {
                 _display.Player = this;
             }
+            Log.Info(PlayerLog.Tag, "replace display to " + newDisplay.Type + " (" + newDisplay.EvasObject + ")");
         }
 
         /// <summary>
@@ -373,10 +425,12 @@ namespace Tizen.Multimedia
         {
             get
             {
+                Log.Info(PlayerLog.Tag, "get display : " + _display.Type);
                 return _display;
             }
             set
             {
+                Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
                 ValidatePlayerState(PlayerState.Idle);
 
                 if (value != null && value.Player != null)
@@ -394,9 +448,10 @@ namespace Tizen.Multimedia
                 PlayerErrorConverter.ThrowIfError(SetDisplay(value), "Failed to set the display to the player");
 
                 ReplaceDisplay(value);
+                Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
             }
         }
-        #endregion
+#endregion
 
         private PlayerTrackInfo _audioTrack;
 
@@ -408,6 +463,7 @@ namespace Tizen.Multimedia
         {
             get
             {
+                Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
                 if (_audioTrack == null)
                 {
                     _audioTrack = new PlayerTrackInfo(this, StreamType.Audio);
@@ -426,6 +482,7 @@ namespace Tizen.Multimedia
         {
             get
             {
+                Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
                 if (_subtitleTrackInfo == null)
                 {
                     _subtitleTrackInfo = new PlayerTrackInfo(this, StreamType.Text);
@@ -444,6 +501,7 @@ namespace Tizen.Multimedia
         {
             get
             {
+                Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
                 if (_streamInfo == null)
                 {
                     _streamInfo = new StreamInfo(this);
@@ -457,13 +515,14 @@ namespace Tizen.Multimedia
         /// </summary>
         public AudioEffect AudioEffect { get; }
 
-        #endregion
+#endregion
 
-        #region Dispose support
+#region Dispose support
         private bool _disposed;
 
         public void Dispose()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             Dispose(true);
             GC.SuppressFinalize(this);
         }
@@ -480,7 +539,7 @@ namespace Tizen.Multimedia
                     }
                     catch (Exception e)
                     {
-                        Log.Error(nameof(Player), e.ToString());
+                        Log.Error(PlayerLog.Tag, e.ToString());
                     }
                 }
                 _source = null;
@@ -498,6 +557,7 @@ namespace Tizen.Multimedia
         {
             if (_disposed)
             {
+                Log.Warn(PlayerLog.Tag, "player was disposed");
                 throw new ObjectDisposedException(nameof(Player));
             }
         }
@@ -506,12 +566,13 @@ namespace Tizen.Multimedia
         {
             get
             {
+                Log.Info(PlayerLog.Tag, "get disposed : " + _disposed);
                 return _disposed;
             }
         }
-        #endregion
+#endregion
 
-        #region Methods
+#region Methods
 
         /// <summary>
         /// Gets the mute state.
@@ -519,11 +580,15 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
         public bool IsMuted()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             ValidateNotDisposed();
 
             bool value = false;
             PlayerErrorConverter.ThrowIfError(Interop.Player.IsMuted(_handle, out value),
                 "Failed to get the mute state of the player");
+
+            Log.Info(PlayerLog.Tag, "get mute : " + value);
+
             return value;
         }
 
@@ -534,9 +599,14 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
         public void SetMute(bool mute)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             ValidateNotDisposed();
 
             int ret = Interop.Player.SetMute(_handle, mute);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to set the mute state of the player, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to set the mute state of the player");
         }
 
@@ -552,6 +622,7 @@ namespace Tizen.Multimedia
         /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
         public DownloadProgress GetDownloadProgress()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             ValidatePlayerState(PlayerState.Playing, PlayerState.Paused);
 
             int start = 0;
@@ -559,10 +630,12 @@ namespace Tizen.Multimedia
             int ret = Interop.Player.GetStreamingDownloadProgress(_handle, out start, out current);
             PlayerErrorConverter.ThrowIfError(ret, "Failed to get download progress");
 
+            Log.Info(PlayerLog.Tag, "get download progress : " + start + ", " + current);
+
             return new DownloadProgress(start, current);
         }
 
-        #region Volume
+#region Volume
         private float _volume;
 
         /// <summary>
@@ -603,7 +676,7 @@ namespace Tizen.Multimedia
             PlayerErrorConverter.ThrowIfError(ret, "Failed to get the volume of the player");
             return value;
         }
-        #endregion
+#endregion
 
         /// <summary>
         /// Sets the subtitle path for playback.
@@ -617,6 +690,7 @@ namespace Tizen.Multimedia
         /// <exception cref="ArgumentNullException">The path is null.</exception>
         public void SetSubtitle(string path)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             ValidateNotDisposed();
 
             if (path == null)
@@ -631,6 +705,7 @@ namespace Tizen.Multimedia
 
             PlayerErrorConverter.ThrowIfError(Interop.Player.SetSubtitlePath(_handle, path),
                 "Failed to set the subtitle path to the player");
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
 
         /// <summary>
@@ -641,10 +716,12 @@ namespace Tizen.Multimedia
         /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
         public void ClearSubtitle()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             ValidatePlayerState(PlayerState.Idle);
 
             PlayerErrorConverter.ThrowIfError(Interop.Player.SetSubtitlePath(_handle, null),
                 "Failed to clear the subtitle of the player");
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
 
         /// <summary>
@@ -655,15 +732,22 @@ namespace Tizen.Multimedia
         /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
         public void SetSubtitleOffset(int offset)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             ValidatePlayerState(PlayerState.Playing, PlayerState.Paused);
 
             PlayerErrorConverter.ThrowIfError(Interop.Player.SetSubtitlePositionOffset(_handle, offset),
                 "Failed to the subtitle offset of the player");
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
 
         private void Prepare()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             int ret = Interop.Player.Prepare(_handle);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to prepare the player, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to prepare the player");
         }
 
@@ -677,6 +761,7 @@ namespace Tizen.Multimedia
         /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
         public Task PrepareAsync()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             if (_source == null)
             {
                 throw new InvalidOperationException("No source is set.");
@@ -702,6 +787,7 @@ namespace Tizen.Multimedia
                     completionSource.TrySetException(e);
                 }
             });
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
 
             return completionSource.Task;
         }
@@ -721,8 +807,10 @@ namespace Tizen.Multimedia
         /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
         public void Unprepare()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             if (State == PlayerState.Idle)
             {
+                Log.Warn(PlayerLog.Tag, "idle state already");
                 return;
             }
             ValidatePlayerState(PlayerState.Ready, PlayerState.Paused, PlayerState.Playing);
@@ -754,13 +842,16 @@ namespace Tizen.Multimedia
         /// <seealso cref="PlaybackCompleted"/>
         public void Start()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             if (State == PlayerState.Playing)
             {
+                Log.Warn(PlayerLog.Tag, "playing state already");
                 return;
             }
             ValidatePlayerState(PlayerState.Ready, PlayerState.Paused);
 
             PlayerErrorConverter.ThrowIfError(Interop.Player.Start(_handle), "Failed to start the player");
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
 
         /// <summary>
@@ -776,13 +867,16 @@ namespace Tizen.Multimedia
         /// <seealso cref="Pause"/>
         public void Stop()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             if (State == PlayerState.Ready)
             {
+                Log.Warn(PlayerLog.Tag, "ready state already");
                 return;
             }
             ValidatePlayerState(PlayerState.Paused, PlayerState.Playing);
 
             PlayerErrorConverter.ThrowIfError(Interop.Player.Stop(_handle), "Failed to stop the player");
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
 
         /// <summary>
@@ -797,14 +891,17 @@ namespace Tizen.Multimedia
         /// <seealso cref="Start"/>
         public void Pause()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             if (State == PlayerState.Paused)
             {
+                Log.Warn(PlayerLog.Tag, "pause state already");
                 return;
             }
 
             ValidatePlayerState(PlayerState.Playing);
 
             PlayerErrorConverter.ThrowIfError(Interop.Player.Pause(_handle), "Failed to pause the player");
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
 
         private MediaSource _source;
@@ -823,6 +920,7 @@ namespace Tizen.Multimedia
         /// <seealso cref="PrepareAsync"/>
         public void SetSource(MediaSource source)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             ValidatePlayerState(PlayerState.Idle);
 
             if (source != null)
@@ -836,6 +934,7 @@ namespace Tizen.Multimedia
             }
 
             _source = source;
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
 
         /// <summary>
@@ -846,6 +945,7 @@ namespace Tizen.Multimedia
         /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
         public Task<CapturedFrame> CaptureVideoAsync()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             ValidatePlayerState(PlayerState.Playing, PlayerState.Paused);
 
             TaskCompletionSource<CapturedFrame> t = new TaskCompletionSource<CapturedFrame>();
@@ -874,6 +974,7 @@ namespace Tizen.Multimedia
                 gch.Free();
                 throw;
             }
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
 
             return t.Task;
         }
@@ -887,6 +988,7 @@ namespace Tizen.Multimedia
         /// <seealso cref="SetPlayPositionAsync(int, bool)"/>
         public int GetPlayPosition()
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             ValidatePlayerState(PlayerState.Ready, PlayerState.Paused, PlayerState.Playing);
 
             int playPosition = 0;
@@ -894,12 +996,15 @@ namespace Tizen.Multimedia
             PlayerErrorConverter.ThrowIfError(Interop.Player.GetPlayPosition(_handle, out playPosition),
                 "Failed to get the play position of the player");
 
+            Log.Info(PlayerLog.Tag, "get play position : " + playPosition);
+
             return playPosition;
         }
 
         private void SetPlayPosition(int milliseconds, bool accurate,
             Interop.Player.SeekCompletedCallback cb)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             int ret = Interop.Player.SetPlayPosition(_handle, milliseconds, accurate, cb, IntPtr.Zero);
 
             //Note that we assume invalid param error is returned only when the position value is invalid.
@@ -908,7 +1013,10 @@ namespace Tizen.Multimedia
                 throw new ArgumentOutOfRangeException(nameof(milliseconds), milliseconds,
                     "The position is not valid.");
             }
-
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to set play position, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to set play position");
         }
 
@@ -928,6 +1036,7 @@ namespace Tizen.Multimedia
         /// <seealso cref="GetPlayPosition"/>
         public Task SetPlayPositionAsync(int position, bool accurate)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
 
             var taskCompletionSource = new TaskCompletionSource<bool>();
@@ -942,6 +1051,8 @@ namespace Tizen.Multimedia
                 taskCompletionSource.TrySetResult(true);
             }
 
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
+
             return taskCompletionSource.Task;
         }
 
@@ -968,6 +1079,7 @@ namespace Tizen.Multimedia
         /// </exception>
         public void SetPlaybackRate(float rate)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             if (rate < -5.0F || 5.0F < rate || rate == 0.0F)
             {
                 throw new ArgumentOutOfRangeException(nameof(rate), rate, "Valid range is -5.0 to 5.0 (except 0.0)");
@@ -977,6 +1089,7 @@ namespace Tizen.Multimedia
 
             PlayerErrorConverter.ThrowIfError(Interop.Player.SetPlaybackRate(_handle, rate),
                 "Failed to set the playback rate.");
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
 
         /// <summary>
@@ -993,6 +1106,7 @@ namespace Tizen.Multimedia
         /// <exception cref="ArgumentNullException"><paramref name="policy"/> is null.</exception>
         public void ApplyAudioStreamPolicy(AudioStreamPolicy policy)
         {
+            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             if (policy == null)
             {
                 throw new ArgumentNullException(nameof(policy));
@@ -1007,18 +1121,24 @@ namespace Tizen.Multimedia
 
             PlayerErrorConverter.ThrowIfError(Interop.Player.SetAudioPolicyInfo(_handle, policy.Handle),
                 "Failed to set the audio stream policy to the player");
+            Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
-        #endregion
+#endregion
 
-        #region Callback registrations
+#region Callback registrations
         private void RegisterSubtitleUpdatedCallback()
         {
             _subtitleUpdatedCallback = (duration, text, _) =>
             {
+                Log.Debug(PlayerLog.Tag, "duration : " + duration + ", text : " + text);
                 SubtitleUpdated?.Invoke(this, new SubtitleUpdatedEventArgs(duration, text));
             };
 
             int ret = Interop.Player.SetSubtitleUpdatedCb(_handle, _subtitleUpdatedCallback, IntPtr.Zero);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to initialize the player, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to initialize the player");
         }
 
@@ -1026,9 +1146,14 @@ namespace Tizen.Multimedia
         {
             _playbackCompletedCallback = _ =>
             {
+                Log.Debug(PlayerLog.Tag, "completed callback");
                 PlaybackCompleted?.Invoke(this, EventArgs.Empty);
             };
             int ret = Interop.Player.SetCompletedCb(_handle, _playbackCompletedCallback, IntPtr.Zero);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to set PlaybackCompleted, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to set PlaybackCompleted");
         }
 
@@ -1040,11 +1165,15 @@ namespace Tizen.Multimedia
                 {
                     return;
                 }
-
+                Log.Warn(PlayerLog.Tag, "interrupted reason : " + code);
                 PlaybackInterrupted?.Invoke(this,
                     new PlaybackInterruptedEventArgs((PlaybackIntrruptionReason)code));
             };
             int ret = Interop.Player.SetInterruptedCb(_handle, _playbackInterruptedCallback, IntPtr.Zero);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to set PlaybackInterrupted, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to set PlaybackInterrupted");
         }
 
@@ -1057,11 +1186,15 @@ namespace Tizen.Multimedia
                     return;
                 }
                 //TODO handle service disconnected error.
-
+                Log.Warn(PlayerLog.Tag, "error code : " + code);
                 ErrorOccurred?.Invoke(this, new PlayerErrorOccurredEventArgs((PlayerError)code));
             };
             int ret = Interop.Player.SetErrorCb(_handle, _playbackErrorCallback, IntPtr.Zero);
-            PlayerErrorConverter.ThrowIfError(ret, "Setting PlaybackError callback failed");
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to set PlaybackError, " + (PlayerError)ret);
+            }
+            PlayerErrorConverter.ThrowIfError(ret, "Failed to set PlaybackError");
         }
 
         private void RegisterVideoFrameDecodedCallback()
@@ -1071,6 +1204,7 @@ namespace Tizen.Multimedia
                 var handler = VideoFrameDecoded;
                 if (handler != null)
                 {
+                    Log.Debug(PlayerLog.Tag, "packet : " + packetHandle);
                     handler.Invoke(this,
                         new VideoFrameDecodedEventArgs(MediaPacket.From(packetHandle)));
                 }
@@ -1081,6 +1215,10 @@ namespace Tizen.Multimedia
             };
 
             int ret = Interop.Player.SetVideoFrameDecodedCb(_handle, _videoFrameDecodedCallback, IntPtr.Zero);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to set the VideoFrameDecoded, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to register the VideoFrameDecoded");
         }
 
@@ -1090,10 +1228,16 @@ namespace Tizen.Multimedia
 
             _videoStreamChangedCallback = (width, height, fps, bitrate, _) =>
             {
+                Log.Debug(PlayerLog.Tag, "height : " + height + ", width : " + width
+                + ", fps : " + fps + ", bitrate : " + bitrate);
                 VideoStreamChangedEventArgs eventArgs = new VideoStreamChangedEventArgs(height, width, fps, bitrate);
                 VideoStreamChanged?.Invoke(this, eventArgs);
             };
             int ret = Interop.Player.SetVideoStreamChangedCb(GetHandle(), _videoStreamChangedCallback, IntPtr.Zero);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to set the video stream changed callback, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to set the video stream changed callback");
         }
 
@@ -1101,11 +1245,15 @@ namespace Tizen.Multimedia
         {
             _bufferingProgressCallback = (percent, _) =>
             {
-                Log.Debug(nameof(Player), $"Buffering callback with percent { percent }");
+                Log.Debug(PlayerLog.Tag, $"Buffering callback with percent { percent }");
                 BufferingProgressChanged?.Invoke(this, new BufferingProgressChangedEventArgs(percent));
             };
 
             int ret = Interop.Player.SetBufferingCb(_handle, _bufferingProgressCallback, IntPtr.Zero);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to set BufferingProgress, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to set BufferingProgress");
         }
 
@@ -1114,14 +1262,14 @@ namespace Tizen.Multimedia
             _mediaStreamAudioBufferStatusChangedCallback = (status, _) =>
             {
                 Debug.Assert(Enum.IsDefined(typeof(MediaStreamBufferStatus), status));
-
+                Log.Debug(PlayerLog.Tag, "audio buffer status : " + status);
                 MediaStreamAudioBufferStatusChanged?.Invoke(this,
                     new MediaStreamBufferStatusChangedEventArgs((MediaStreamBufferStatus)status));
             };
             _mediaStreamVideoBufferStatusChangedCallback = (status, _) =>
             {
                 Debug.Assert(Enum.IsDefined(typeof(MediaStreamBufferStatus), status));
-
+                Log.Debug(PlayerLog.Tag, "video buffer status : " + status);
                 MediaStreamVideoBufferStatusChanged?.Invoke(this,
                     new MediaStreamBufferStatusChangedEventArgs((MediaStreamBufferStatus)status));
             };
@@ -1135,18 +1283,23 @@ namespace Tizen.Multimedia
         {
             int ret = Interop.Player.SetMediaStreamBufferStatusCb(_handle, (int)streamType,
               cb, IntPtr.Zero);
-
-            PlayerErrorConverter.ThrowIfError(ret, "Failed to initialize the player");
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to SetMediaStreamBufferStatus, " + (PlayerError)ret);
+            }
+            PlayerErrorConverter.ThrowIfError(ret, "Failed to SetMediaStreamBufferStatus");
         }
 
         private void RegisterMediaStreamSeekCallback()
         {
             _mediaStreamAudioSeekCallback = (offset, _) =>
             {
+                Log.Debug(PlayerLog.Tag, "audio seeking offset : " + offset);
                 MediaStreamAudioSeekingOccurred?.Invoke(this, new MediaStreamSeekingOccurredEventArgs(offset));
             };
             _mediaStreamVideoSeekCallback = (offset, _) =>
             {
+                Log.Debug(PlayerLog.Tag, "video seeking offset : " + offset);
                 MediaStreamVideoSeekingOccurred?.Invoke(this, new MediaStreamSeekingOccurredEventArgs(offset));
             };
 
@@ -1158,12 +1311,15 @@ namespace Tizen.Multimedia
         {
             int ret = Interop.Player.SetMediaStreamSeekCb(_handle, (int)streamType,
                 cb, IntPtr.Zero);
-
-            PlayerErrorConverter.ThrowIfError(ret, "Failed to initialize the player");
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to SetMediaStreamSeek, " + (PlayerError)ret);
+            }
+            PlayerErrorConverter.ThrowIfError(ret, "Failed to SetMediaStreamSeek");
         }
-        #endregion
+#endregion
 
-        #region Preparing state
+#region Preparing state
 
         private int _isPreparing;
 
@@ -1181,6 +1337,6 @@ namespace Tizen.Multimedia
         {
             Interlocked.Exchange(ref _isPreparing, 0);
         }
-        #endregion
+#endregion
     }
 }
index 088d005..5ed28de 100644 (file)
@@ -30,11 +30,13 @@ namespace Tizen.Multimedia
         {
             if (evasObject == null)
             {
+                Log.Error(PlayerLog.Tag, "evas object is null");
                 throw new ArgumentNullException(nameof(evasObject));
             }
 
             if (evasObject == IntPtr.Zero)
             {
+                Log.Error(PlayerLog.Tag, "The evas object is not realized.");
                 throw new ArgumentException("The evas object is not realized.");
             }
 
@@ -73,6 +75,7 @@ namespace Tizen.Multimedia
         {
             if (Player == null)
             {
+                Log.Error(PlayerLog.Tag, "The display is not assigned, yet.");
                 throw new InvalidOperationException("The display is not assigned, yet.");
             }
 
@@ -110,6 +113,10 @@ namespace Tizen.Multimedia
                 ValidationUtil.ValidateEnum(typeof(PlayerDisplayMode), value);
 
                 int ret = Interop.Player.SetDisplayMode(Player.GetHandle(), (int)value);
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to set display mode, " + (PlayerError)ret);
+                }
                 PlayerErrorConverter.ThrowIfError(ret, "Failed to set display mode");
 
                 _displayMode = value;
@@ -144,6 +151,10 @@ namespace Tizen.Multimedia
                 }
 
                 int ret = Interop.Player.SetDisplayVisible(Player.GetHandle(), value);
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to set the visible state of the display, " + (PlayerError)ret);
+                }
                 PlayerErrorConverter.ThrowIfError(ret, "Failed to set the visible state of the display");
 
                 _isVisible = value;
@@ -181,6 +192,10 @@ namespace Tizen.Multimedia
                 ValidationUtil.ValidateEnum(typeof(PlayerDisplayRotation), value);
 
                 int ret = Interop.Player.SetDisplayRotation(Player.GetHandle(), (int)value);
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to set the rotation state of the display, " + (PlayerError)ret);
+                }
                 PlayerErrorConverter.ThrowIfError(ret, "Failed to set the rotation state of the display");
 
                 _rotation = value;
index 6ca50a1..b9a0e98 100644 (file)
@@ -33,6 +33,7 @@ namespace Tizen.Multimedia
         {
             Debug.Assert(player != null);
 
+            Log.Debug(PlayerLog.Tag, "streamType : " + streamType);
             _streamType = (int)streamType;
             _owner = player;
         }
@@ -50,8 +51,8 @@ namespace Tizen.Multimedia
 
             int count = 0;
             int ret = Interop.Player.GetTrackCount(_owner.GetHandle(), _streamType, out count);
-            PlayerErrorConverter.ThrowIfError(ret, "Failed to initialize the track of the player");
-
+            PlayerErrorConverter.ThrowIfError(ret, "Failed to get count of the track");
+            Log.Info(PlayerLog.Tag, "get count : " + count);
             return count;
         }
 
@@ -76,6 +77,7 @@ namespace Tizen.Multimedia
 
             if (index < 0 || GetCount() <= index)
             {
+                Log.Error(PlayerLog.Tag, "invalid index");
                 throw new ArgumentOutOfRangeException(nameof(index), index,
                     $"valid index range is 0 <= x < {nameof(GetCount)}(), but got { index }.");
             }
@@ -87,15 +89,16 @@ namespace Tizen.Multimedia
                 int ret = Interop.Player.GetTrackLanguageCode(
                     _owner.GetHandle(), _streamType, index, out code);
 
-                PlayerErrorConverter.ThrowIfError(ret, "Failed to get the selected index of the player");
+                PlayerErrorConverter.ThrowIfError(ret, "Failed to get the selected language of the player");
 
                 string result = Marshal.PtrToStringAnsi(code);
 
                 if (result == "und")
                 {
+                    Log.Error(PlayerLog.Tag, "not defined code");
                     return null;
                 }
-
+                Log.Info(PlayerLog.Tag, "get language code : " + result);
                 return result;
             }
             finally
@@ -118,7 +121,7 @@ namespace Tizen.Multimedia
             int value = 0;
             int ret = Interop.Player.GetCurrentTrack(_owner.GetHandle(), _streamType, out value);
             PlayerErrorConverter.ThrowIfError(ret, "Failed to get the selected index of the player");
-
+            Log.Debug(PlayerLog.Tag, "get selected index : " + value);
             return value;
         }
 
@@ -138,6 +141,7 @@ namespace Tizen.Multimedia
         {
             if (index < 0 || GetCount() <= index)
             {
+                Log.Error(PlayerLog.Tag, "invalid index");
                 throw new ArgumentOutOfRangeException(nameof(index), index,
                     $"valid index range is 0 <= x < {nameof(GetCount)}(), but got { index }.");
             }
@@ -145,6 +149,10 @@ namespace Tizen.Multimedia
             _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused);
 
             int ret = Interop.Player.SelectTrack(_owner.GetHandle(), _streamType, index);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to set the selected index of the player, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to set the selected index of the player");
         }
 
index 90754d6..080adee 100644 (file)
@@ -31,6 +31,7 @@ namespace Tizen.Multimedia
             SampleRate = sampleRate;
             Channels = channels;
             BitRate = bitRate;
+            Log.Debug(PlayerLog.Tag, "sampleRate : " + sampleRate + ", channels : " + channels + ", bitRate : " + bitRate);
         }
 
         /// <summary>
@@ -81,6 +82,8 @@ namespace Tizen.Multimedia
             Fps = fps;
             BitRate = bitRate;
             Size = size;
+            Log.Debug(PlayerLog.Tag, "fps : " + fps + ", bitrate : " + bitRate +
+                ", width : " + size.Width + ", height : "+ size.Height);
         }
         /// <summary>
         /// Initialize a new instance of the VideoStreamProperties struct with the specified fps, bit rate, width and height.
@@ -90,6 +93,8 @@ namespace Tizen.Multimedia
             Fps = fps;
             BitRate = bitRate;
             Size = new Size(width, height);
+            Log.Debug(PlayerLog.Tag, "fps : " + fps + ", bitrate : " + bitRate +
+                ", width : " + width + ", height : " + height);
         }
 
         /// <summary>
@@ -152,6 +157,7 @@ namespace Tizen.Multimedia
 
             if (art == IntPtr.Zero || size == 0)
             {
+                Log.Error(PlayerLog.Tag, "art is null or size is 0 : " + size);
                 return null;
             }
 
@@ -169,14 +175,20 @@ namespace Tizen.Multimedia
             try
             {
                 int ret = Interop.Player.GetCodecInfo(Player.GetHandle(), out audioPtr, out videoPtr);
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to get codec info, " + (PlayerError)ret);
+                }
                 PlayerErrorConverter.ThrowIfError(ret, "Failed to get codec info");
 
                 if (audioInfo)
                 {
+                    Log.Debug(PlayerLog.Tag, "it is audio case");
                     return Marshal.PtrToStringAnsi(audioPtr);
                 }
                 else
                 {
+                    Log.Debug(PlayerLog.Tag, "it is video case");
                     return Marshal.PtrToStringAnsi(videoPtr);
                 }
             }
@@ -217,6 +229,8 @@ namespace Tizen.Multimedia
             int duration = 0;
             PlayerErrorConverter.ThrowIfError(Interop.Player.GetDuration(Player.GetHandle(), out duration),
                 "Failed to get the duration");
+
+            Log.Info(PlayerLog.Tag, "get duration : " + duration);
             return duration;
         }
 
@@ -236,6 +250,10 @@ namespace Tizen.Multimedia
 
             int ret = Interop.Player.GetAudioStreamInfo(Player.GetHandle(),
                 out sampleRate, out channels, out bitRate);
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to auido stream info, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to get audio stream info");
 
             // TODO should we check value is zero and return null?
@@ -256,8 +274,11 @@ namespace Tizen.Multimedia
             int fps = 0;
             int bitRate = 0;
             int ret = Interop.Player.GetVideoStreamInfo(Player.GetHandle(), out fps, out bitRate);
-
-            PlayerErrorConverter.ThrowIfError(ret, "Failed to get the video info");
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to video stream info, " + (PlayerError)ret);
+            }
+            PlayerErrorConverter.ThrowIfError(ret, "Failed to get the video stream info");
 
             // TODO should we check value is zero and return null?
 
@@ -271,7 +292,10 @@ namespace Tizen.Multimedia
             int height = 0;
             int width = 0;
             int ret = Interop.Player.GetVideoSize(Player.GetHandle(), out width, out height);
-
+            if (ret != (int)PlayerErrorCode.None)
+            {
+                Log.Error(PlayerLog.Tag, "Failed to video size, " + (PlayerError)ret);
+            }
             PlayerErrorConverter.ThrowIfError(ret, "Failed to get the video size");
 
             return new Size(width, height);
@@ -295,6 +319,10 @@ namespace Tizen.Multimedia
             try
             {
                 int ret = Interop.Player.GetContentInfo(Player.GetHandle(), (int)key, out ptr);
+                if (ret != (int)PlayerErrorCode.None)
+                {
+                    Log.Error(PlayerLog.Tag, "Failed to get the meta data with the key" + key + ", " + (PlayerError)ret);
+                }
                 PlayerErrorConverter.ThrowIfError(ret, $"Failed to get the meta data with the key '{ key }'");