[MediaPlayer] add API to set/get replaygain (#318)
authornam <36914158+kqjy777@users.noreply.github.com>
Mon, 9 Jul 2018 01:46:17 +0000 (10:46 +0900)
committerGitHub <noreply@github.com>
Mon, 9 Jul 2018 01:46:17 +0000 (10:46 +0900)
* [MediaPlayer] add API to set/get replaygain

* modify 'g' in Replaygain to capital 'G'

src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs
src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs

index 6f14bd3..6c50537 100644 (file)
@@ -99,6 +99,12 @@ internal static partial class Interop
         [DllImport(Libraries.Player, EntryPoint = "player_get_volume")]
         internal static extern PlayerErrorCode GetVolume(IntPtr player, out float left, out float right);
 
+        [DllImport(Libraries.Player, EntryPoint = "player_set_replaygain_enabled")]
+        internal static extern PlayerErrorCode SetReplayGain(IntPtr player, bool enabled);
+
+        [DllImport(Libraries.Player, EntryPoint = "player_is_replaygain_enabled")]
+        internal static extern PlayerErrorCode IsReplayGain(IntPtr player, out bool enabled);
+
         [DllImport(Libraries.Player, EntryPoint = "player_set_sound_stream_info")]
         internal static extern PlayerErrorCode SetAudioPolicyInfo(IntPtr player, AudioStreamPolicyHandle streamInfo);
 
index eae92b9..f20a1c8 100644 (file)
@@ -523,6 +523,31 @@ namespace Tizen.Multimedia
             }
         }
 
+        /// <summary>
+        /// Gets or sets the player's replaygain state.
+        /// </summary>
+        /// <value>If the replaygain status is true, replaygain is applied (if contents has a replaygain tag);
+        /// otherwise, the replaygain isn't affected by tag and properties.</value>
+        /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+        /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
+        /// <since_tizen> 5 </since_tizen>
+        public bool ReplayGain
+        {
+            get
+            {
+                ValidateNotDisposed();
+                NativePlayer.IsReplayGain(Handle, out var value).
+                    ThrowIfFailed(this, "Failed to get the replaygain of the player");
+                return value;
+            }
+            set
+            {
+                ValidateNotDisposed();
+                NativePlayer.SetReplayGain(Handle, value).
+                    ThrowIfFailed(this, "Failed to set the replaygain of the player");
+            }
+        }
+
         private SphericalVideo _sphericalVideo;
 
         /// <summary>