From: hsgwon Date: Thu, 18 Apr 2019 03:36:23 +0000 (+0900) Subject: [MediaController] Change P/Invoke function of playlist (#793) X-Git-Tag: 5.5_M2~241 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7fb7d6d8cca2e46095d7634f487c358734b1dbc0;hp=206d9b2a93a3704d6e949de91aff6432d947b12a;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [MediaController] Change P/Invoke function of playlist (#793) * [MediaController] Change P/Invoke function of playlist --- diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerPlaylist.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerPlaylist.cs index f554bb3..4e49285 100644 --- a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerPlaylist.cs +++ b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerPlaylist.cs @@ -115,6 +115,13 @@ internal static partial class Interop internal static extern MediaControllerError UpdatePlaylist(IntPtr handle, string index, MediaControllerNativeAttribute attribute, string value); + [DllImport(Libraries.MediaController, EntryPoint = "mc_playlist_foreach_playlist")] + internal static extern MediaControllerError ForeachPlaylist(string serverName, PlaylistCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_playlist_get_playlist")] + internal static extern MediaControllerError GetPlaylistHandle(string serverName, string playlistName, IntPtr handle); + + [Obsolete("Please do not use! This will be deprecated in level 6. Please use ForeachPlaylist instead.")] [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server_playlist")] internal static extern MediaControllerError ForeachServerPlaylist(MediaControllerClientHandle handle, string serverName, PlaylistCallback callback, IntPtr userData); diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs index a4f1938..10da800 100644 --- a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs +++ b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaControllerServer.cs @@ -173,9 +173,6 @@ internal static partial class Interop [DllImport(Libraries.MediaController, EntryPoint = "mc_server_delete_playlist")] internal static extern MediaControllerError DeletePlaylist(IntPtr handle, IntPtr playlist); - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_foreach_playlist")] - internal static extern MediaControllerError ForeachPlaylist(IntPtr handle, PlaylistCallback callback, IntPtr userData); - [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playlist_item_index")] internal static extern MediaControllerError SetIndexOfCurrentPlayingMedia(IntPtr handle, string index); diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs index d786528..1d97a3c 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControlServer.cs @@ -19,6 +19,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Tizen.Applications; using Native = Interop.MediaControllerServer; +using NativePlaylist = Interop.MediaControllerPlaylist; namespace Tizen.Multimedia.Remoting { @@ -30,8 +31,9 @@ namespace Tizen.Multimedia.Remoting /// 4 public static partial class MediaControlServer { - private static IntPtr _handle = IntPtr.Zero; + private static IntPtr _handle; private static bool? _isRunning; + private static string _serverName; /// /// Gets a value indicating whether the server is running. @@ -114,6 +116,7 @@ namespace Tizen.Multimedia.Remoting RegisterCommandCompletedEvent(); RegisterSearchCommandReceivedEvent(); + _serverName = Application.Current.ApplicationInfo.ApplicationId; _isRunning = true; } catch @@ -121,6 +124,7 @@ namespace Tizen.Multimedia.Remoting Native.Destroy(_handle); _playbackCommandCallback = null; _handle = IntPtr.Zero; + _serverName = null; throw; } } @@ -358,8 +362,8 @@ namespace Tizen.Multimedia.Remoting // Gets the playlist handle by name. internal static IntPtr GetPlaylistHandle(string name) { - Native.GetPlaylistHandle(Handle, name, out IntPtr playlistHandle) - .ThrowIfError("Failed to get playlist handle by name"); + NativePlaylist.GetPlaylistHandle(_serverName, name, out IntPtr playlistHandle). + ThrowIfError("Failed to get playlist handle by name"); return playlistHandle; } diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs index ff6798e..096f05c 100644 --- a/src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaController.cs @@ -204,8 +204,9 @@ namespace Tizen.Multimedia.Remoting return false; } }; - NativePlaylist.ForeachServerPlaylist(Manager.Handle, ServerAppId, playlistCallback, IntPtr.Zero) - .ThrowIfError("Failed to get playlist."); + + NativePlaylist.ForeachPlaylist(ServerAppId, playlistCallback, IntPtr.Zero). + ThrowIfError("Failed to get playlist."); if (caught != null) {