Added Logs and exceptions
authorRavi Kiran K N <ravi.kiran@samsung.com>
Thu, 19 May 2016 04:03:01 +0000 (09:33 +0530)
committerRavi Kiran K N <ravi.kiran@samsung.com>
Thu, 19 May 2016 04:03:45 +0000 (09:33 +0530)
Implemented Events and Async methods.
Rebased spec file with new package name

Change-Id: I93793be5528f3fadbd2fa2be8026f5d46dc279ec
Signed-off-by: Ravi Kiran K N <ravi.kiran@samsung.com>
31 files changed:
packaging/csapi-multimedia.spec
src/Tizen.Multimedia/Interop/Interop.Player.cs
src/Tizen.Multimedia/Player/AudioEffect.cs
src/Tizen.Multimedia/Player/BufferStatusEventArgs.cs
src/Tizen.Multimedia/Player/BufferingProgressChangedEventArgs.cs
src/Tizen.Multimedia/Player/Display.cs
src/Tizen.Multimedia/Player/DownloadProgress.cs
src/Tizen.Multimedia/Player/EqualizerBand.cs
src/Tizen.Multimedia/Player/MediaBufferSource.cs
src/Tizen.Multimedia/Player/MediaStreamConfiguration.cs
src/Tizen.Multimedia/Player/PlaybackErrorEventArgs.cs
src/Tizen.Multimedia/Player/PlaybackInterruptedEventArgs.cs
src/Tizen.Multimedia/Player/Player.cs
src/Tizen.Multimedia/Player/PlayerContentInfo.cs
src/Tizen.Multimedia/Player/PlayerEnums.cs
src/Tizen.Multimedia/Player/PlayerErrorFactory.cs [new file with mode: 0644]
src/Tizen.Multimedia/Player/PlayerSource.cs [deleted file]
src/Tizen.Multimedia/Player/ProgressiveDownloadMessageEventArgs.cs
src/Tizen.Multimedia/Player/ProgressiveDownloadStatus.cs
src/Tizen.Multimedia/Player/SeekOffsetEventArgs.cs
src/Tizen.Multimedia/Player/SourceFactory.cs [deleted file]
src/Tizen.Multimedia/Player/StreamInformation.cs
src/Tizen.Multimedia/Player/StreamingConfiguration.cs
src/Tizen.Multimedia/Player/Subtitle.cs
src/Tizen.Multimedia/Player/SubtitleTrack.cs
src/Tizen.Multimedia/Player/SubtitleUpdatedEventArgs.cs
src/Tizen.Multimedia/Player/VideoFrameCapture.cs
src/Tizen.Multimedia/Player/VideoFrameDecodedEventArgs.cs
src/Tizen.Multimedia/Player/VideoStreamEventArgs.cs
src/Tizen.Multimedia/Tizen.Multimedia.csproj
src/Tizen.Multimedia/Tizen.Multimedia.userprefs

index 96f872e..967137c 100644 (file)
@@ -21,6 +21,7 @@ Requires(post): mono-core
 Requires(postun): mono-core
 # P/Invoke Dependencies
 BuildRequires: pkgconfig(capi-media-player)
+BuildRequires: pkgconfig(csapi-tizen)
 # P/Invoke Runtime Dependencies
 # TODO: It should be removed after fix tizen-rpm-config
 #Requires: capi-multimedia-device
@@ -39,7 +40,7 @@ Development package for %{name}
 cp %{SOURCE1} .
 %build
 # build dll
-mcs -target:library -out:%{dllname} -keyfile:Tizen.Multimedia/Tizen.Multimedia.snk \
+mcs -target:library -out:%{dllname} -keyfile:Tizen.Multimedia/Tizen.Multimedia.snk -pkg:'csapi-tizen' \
   Tizen.Multimedia/Properties/AssemblyInfo.cs \
   Tizen.Multimedia/Player/*.cs \
   Tizen.Multimedia/Interop/*.cs
index c693e3b..72c2d31 100644 (file)
@@ -3,12 +3,49 @@ using System.Runtime.InteropServices;
 
 internal static partial class Interop
 {
-    internal static partial class PlayerInterop
+    internal static partial class Player
     {
 
-    [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 
-    internal delegate bool MediaTagCallback(IntPtr tagHandle, IntPtr UserData);
-   
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void PlaybackCompletedCallback(IntPtr userData);
+       
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void PlaybackInterruptedCallback(int code, IntPtr userData);
+
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void PlaybackErrorCallback(int code, IntPtr userData);
+
+       //[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       //internal delegate void VideoFrameDecodedCallback(MediaPacket packet, IntPtr userData);
+
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void SubtitleUpdatedCallback(ulong duration, string text, IntPtr userData);
+
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void BufferingProgressCallback(int percent, IntPtr userData);
+
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void ProgressiveDownloadMessageCallback(int type, IntPtr userData);
+
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void VideoStreamChangedCallback(int width, int height, int fps, int bitrate, IntPtr userData);
+
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void BufferStatusCallback(int status, IntPtr userData);
+
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void SeekOffsetChangedCallback(UInt64 offset, IntPtr userData);
+
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void VideoCaptureCallback(byte[] data, int width, int height, uint size, IntPtr userData);
+
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void PrepareCallback(IntPtr userData);
+
+       [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+       internal delegate void SeekCompletedCallback(IntPtr userData);
+
+
        [DllImport(Libraries.Player, EntryPoint = "player_create")]
        internal static extern int  Create(out IntPtr player);
 
@@ -18,6 +55,9 @@ internal static partial class Interop
        [DllImport(Libraries.Player, EntryPoint = "player_prepare")]
        internal static extern int  Prepare(IntPtr player);
 
+       [DllImport(Libraries.Player, EntryPoint = "player_prepare_async")]
+       internal static extern int  PrepareAsync(IntPtr player, PrepareCallback cb, IntPtr userData);
+
        [DllImport(Libraries.Player, EntryPoint = "player_unprepare")]
        internal static extern int  Unprepare(IntPtr player);
 
@@ -63,6 +103,9 @@ internal static partial class Interop
        [DllImport(Libraries.Player, EntryPoint = "player_get_play_position")]
        internal static extern int  GetPlayPosition(IntPtr player, out int millisecond);
 
+       [DllImport(Libraries.Player, EntryPoint = "player_set_play_position")]
+       internal static extern int  SetPlayPosition(IntPtr player, int millisecond, bool accurate, SeekCompletedCallback cb, IntPtr userData);
+
        [DllImport(Libraries.Player, EntryPoint = "player_set_mute")]
        internal static extern int  SetMute(IntPtr player, bool muted);
 
@@ -75,29 +118,29 @@ internal static partial class Interop
        [DllImport(Libraries.Player, EntryPoint = "player_is_looping")]
        internal static extern int  IsLooping(IntPtr player, out bool looping);
 
-       //[DllImport(Libraries.Player, EntryPoint = "player_set_completed_cb")]
-       //internal static extern int  SetCompletedCb(IntPtr player, player_completed_cb callback, IntPtr user_data);
+       [DllImport(Libraries.Player, EntryPoint = "player_set_completed_cb")]
+       internal static extern int  SetCompletedCb(IntPtr player, PlaybackCompletedCallback callback, IntPtr user_data);
 
        [DllImport(Libraries.Player, EntryPoint = "player_unset_completed_cb")]
        internal static extern int  UnsetCompletedCb(IntPtr player);
 
-       //[DllImport(Libraries.Player, EntryPoint = "player_set_interrupted_cb")]
-       //internal static extern int  SetInterruptedCb(IntPtr player, player_interrupted_cb callback, IntPtr user_data);
+       [DllImport(Libraries.Player, EntryPoint = "player_set_interrupted_cb")]
+       internal static extern int  SetInterruptedCb(IntPtr player, PlaybackInterruptedCallback callback, IntPtr user_data);
 
        [DllImport(Libraries.Player, EntryPoint = "player_unset_interrupted_cb")]
        internal static extern int  UnsetInterruptedCb(IntPtr player);
 
-       //[DllImport(Libraries.Player, EntryPoint = "player_set_error_cb")]
-       //internal static extern int  SetErrorCb(IntPtr player, player_error_cb callback, IntPtr user_data);
+       [DllImport(Libraries.Player, EntryPoint = "player_set_error_cb")]
+       internal static extern int  SetErrorCb(IntPtr player, PlaybackErrorCallback callback, IntPtr user_data);
 
        [DllImport(Libraries.Player, EntryPoint = "player_unset_error_cb")]
        internal static extern int  UnsetErrorCb(IntPtr player);
 
-       //[DllImport(Libraries.Player, EntryPoint = "player_capture_video")]
-       //internal static extern int  CaptureVideo(IntPtr player, player_video_captured_cb callback, IntPtr user_data);
+       [DllImport(Libraries.Player, EntryPoint = "player_capture_video")]
+       internal static extern int  CaptureVideo(IntPtr player, VideoCaptureCallback callback, IntPtr user_data);
 
        //[DllImport(Libraries.Player, EntryPoint = "player_set_media_packet_video_frame_decoded_cb")]
-       //internal static extern int  SetMediaPacketVideoFrameDecodedCb(IntPtr player, player_media_packet_video_decoded_cb callback, IntPtr user_data);
+       //internal static extern int  SetMediaPacketVideoFrameDecodedCb(IntPtr player, _videoFrameDecodedCallback callback, IntPtr user_data);
 
        [DllImport(Libraries.Player, EntryPoint = "player_unset_media_packet_video_frame_decoded_cb")]
        internal static extern int  UnsetMediaPacketVideoFrameDecodedCb(IntPtr player);
@@ -111,8 +154,8 @@ internal static partial class Interop
        [DllImport(Libraries.Player, EntryPoint = "player_get_streaming_download_progress")]
        internal static extern int  GetStreamingDownloadProgress(IntPtr player, out int start, out int current);
 
-       //[DllImport(Libraries.Player, EntryPoint = "player_set_buffering_cb")]
-       //internal static extern int  SetBufferingCb(IntPtr player, player_buffering_cb callback, IntPtr user_data);
+       [DllImport(Libraries.Player, EntryPoint = "player_set_buffering_cb")]
+       internal static extern int  SetBufferingCb(IntPtr player, BufferingProgressCallback callback, IntPtr user_data);
 
        [DllImport(Libraries.Player, EntryPoint = "player_unset_buffering_cb")]
        internal static extern int  UnsetBufferingCb(IntPtr player);
@@ -123,8 +166,8 @@ internal static partial class Interop
        //[DllImport(Libraries.Player, EntryPoint = "player_get_progressive_download_status")]
        //internal static extern int  GetProgressiveDownloadStatus(IntPtr player, unsigned long *current, unsigned long *total_size);
 
-       //[DllImport(Libraries.Player, EntryPoint = "player_set_progressive_download_message_cb")]
-       //internal static extern int  SetProgressiveDownloadMessageCb(IntPtr player, player_pd_message_cb callback, IntPtr user_data);
+       [DllImport(Libraries.Player, EntryPoint = "player_set_progressive_download_message_cb")]
+       internal static extern int  SetProgressiveDownloadMessageCb(IntPtr player, ProgressiveDownloadMessageCallback callback, IntPtr user_data);
 
        [DllImport(Libraries.Player, EntryPoint = "player_unset_progressive_download_message_cb")]
        internal static extern int  UnsetProgressiveDownloadMessageCb(IntPtr player);
@@ -138,14 +181,14 @@ internal static partial class Interop
        [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_info")]
        internal static extern int  SetMediaStreamInfo(IntPtr player, int type, IntPtr format);
 
-       //[DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_status_cb")]
-       //internal static extern int  SetMediaStreamBufferStatusCb(IntPtr player, int type, player_media_stream_buffer_status_cb callback, IntPtr user_data);
+       [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_status_cb")]
+       internal static extern int  SetMediaStreamBufferStatusCb(IntPtr player, int type, BufferStatusCallback callback, IntPtr user_data);
 
        [DllImport(Libraries.Player, EntryPoint = "player_unset_media_stream_buffer_status_cb")]
        internal static extern int  UnsetMediaStreamBufferStatusCb(IntPtr player, int type);
 
-       //[DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_seek_cb")]
-       //internal static extern int  SetMediaStreamSeekCb(IntPtr player, int type, player_media_stream_seek_cb callback, IntPtr user_data);
+       [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_seek_cb")]
+       internal static extern int  SetMediaStreamSeekCb(IntPtr player, int type, SeekOffsetChangedCallback callback, IntPtr user_data);
 
        [DllImport(Libraries.Player, EntryPoint = "player_unset_media_stream_seek_cb")]
        internal static extern int  UnsetMediaStreamSeekCb(IntPtr player, int type);
@@ -231,8 +274,8 @@ internal static partial class Interop
        [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_path")]
        internal static extern int  SetSubtitlePath(IntPtr player, string path);
 
-       //[DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_updated_cb")]
-       //internal static extern int  SetSubtitleUpdatedCb(IntPtr player, player_subtitle_updated_cb callback, IntPtr user_data);
+       [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_updated_cb")]
+       internal static extern int  SetSubtitleUpdatedCb(IntPtr player, SubtitleUpdatedCallback callback, IntPtr user_data);
 
        [DllImport(Libraries.Player, EntryPoint = "player_unset_subtitle_updated_cb")]
        internal static extern int  UnsetSubtitleUpdatedCb(IntPtr player);
@@ -240,8 +283,8 @@ internal static partial class Interop
        [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_position_offset")]
        internal static extern int  SetSubtitlePositionOffset(IntPtr player, int millisecond);
 
-       //[DllImport(Libraries.Player, EntryPoint = "player_set_video_stream_changed_cb")]
-       //internal static extern int  SetVideoStreamChangedCb(IntPtr player, player_video_stream_changed_cb callback, IntPtr user_data);
+       [DllImport(Libraries.Player, EntryPoint = "player_set_video_stream_changed_cb")]
+       internal static extern int  SetVideoStreamChangedCb(IntPtr player, VideoStreamChangedCallback callback, IntPtr user_data);
 
        [DllImport(Libraries.Player, EntryPoint = "player_unset_video_stream_changed_cb")]
        internal static extern int  UnsetVideoStreamChangedCb(IntPtr player);
index 59d7dc9..1e81254 100644 (file)
@@ -33,11 +33,15 @@ namespace Tizen.Multimedia
                { 
                        set
                        {
+                               int ret;
                                _bands = value;
                                foreach(EqualizerBand band in _bands)
                                {
-                                       if (Interop.PlayerInterop.AudioEffectSetEqualizerBandLevel (_playerHandle, _bands.IndexOf (band), band.Level) != 0) {
-                                               // throw Exception;
+                                       ret = Interop.Player.AudioEffectSetEqualizerBandLevel (_playerHandle, _bands.IndexOf (band), band.Level);
+                                       if ( ret != (int)PlayerError.None) 
+                                       {
+                                               Log.Error (PlayerLog.LogTag, "Failed to set equalizer band" + (PlayerError)ret);
+                                               PlayerErrorFactory.ThrowException (ret, "Failed to set equalizer band"); 
                                        }
                                }
 
@@ -56,9 +60,11 @@ namespace Tizen.Multimedia
                { 
                        get 
                        { 
-                               int min, max;
-                               if (Interop.PlayerInterop.AudioEffectGetEqualizerLevelRange (_playerHandle, out min, out max) != 0) {
-                                       //throw Exception;
+                               int min, max, ret;
+                               ret = Interop.Player.AudioEffectGetEqualizerLevelRange (_playerHandle, out min, out max);
+                               if ( ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get min level" + (PlayerError)ret);
                                }
                                return min;
                        }
@@ -72,9 +78,11 @@ namespace Tizen.Multimedia
                {
                        get
                        {
-                               int min, max;
-                               if (Interop.PlayerInterop.AudioEffectGetEqualizerLevelRange (_playerHandle, out min, out max) != 0) {
-                                       //throw Exception;
+                               int min, max, ret;
+                               ret = Interop.Player.AudioEffectGetEqualizerLevelRange (_playerHandle, out min, out max);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get max level" + (PlayerError)ret);
                                }
                                return max;
                        }
@@ -89,8 +97,10 @@ namespace Tizen.Multimedia
                        get
                        {
                                bool available = false;
-                               if (Interop.PlayerInterop.AudioEffectEqualizerIsAvailable (_playerHandle, out available) != 0) {
-                                       //throw Exception;
+                               int ret = Interop.Player.AudioEffectEqualizerIsAvailable (_playerHandle, out available);
+                               if ( ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get equalizer availability" + (PlayerError)ret);
                                }
                                return available;
                        }
index 3b2bdeb..76cad01 100644 (file)
@@ -47,6 +47,15 @@ namespace Tizen.Multimedia
             }
         }
 
+               /// <summary>
+               /// Constructor.
+               /// </summary>
+               public BufferStatusEventArgs(StreamingBufferStatus status, StreamType type)
+               {
+                       _status = status;
+                       _streamType = type;
+               }
+
         internal StreamingBufferStatus _status;
         internal StreamType _streamType;
 
index 752c1fc..074685f 100644 (file)
@@ -34,6 +34,14 @@ namespace Tizen.Multimedia
             }
         }
 
+               /// <summary>
+               /// constructor </summary>
+               public BufferingProgressEventArgs(int percent)
+               {
+                       _percent = percent;
+               }
+
+
         internal int _percent;
 
     }
index 231562d..3637554 100644 (file)
@@ -32,10 +32,15 @@ namespace Tizen.Multimedia
                {
                        set
                        {
-                               if (Interop.PlayerInterop.SetDisplayMode (_playerHandle, (int)value) == 0) {
+                               int ret = Interop.Player.SetDisplayMode (_playerHandle, (int)value);
+                               if ( ret == (int)PlayerError.None) 
+                               {
                                        _displayMode = value;
-                               } else {
-                                       //throw Exception
+                               } 
+                               else 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Setting display mode failed" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "Setting display mode failed"); 
                                }
                        }
                        get
@@ -52,10 +57,15 @@ namespace Tizen.Multimedia
                {
                        set
                        {
-                               if (Interop.PlayerInterop.SetDisplayVisible (_playerHandle, value) == 0) {
+                               int ret = Interop.Player.SetDisplayVisible (_playerHandle, value);
+                               if (ret == (int)PlayerError.None) 
+                               {
                                        _isVisible = value;
-                               } else {
-                                       //throw Exception
+                               } 
+                               else 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Setting display visible failed" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "Setting display visible failed"); 
                                }
                        }
                        get
@@ -72,10 +82,14 @@ namespace Tizen.Multimedia
                {
                        set
                        {
-                               if (Interop.PlayerInterop.SetDisplayRotation (_playerHandle, (int)value) == 0) {
+                               int ret = Interop.Player.SetDisplayRotation (_playerHandle, (int)value);
+                               if (ret == (int)PlayerError.None)
+                               {
                                        _rotation = value;
-                               } else {
-                                       //throw Exception
+                               } else 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Setting display rotation failed" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "Setting display rotation failed"); 
                                }
                        }
                        get
index ee1cc59..884e8e5 100644 (file)
@@ -23,15 +23,38 @@ namespace Tizen.Multimedia
        public class DownloadProgress
     {
         /// <summary>
-        /// Get Start position in percentage.
+        /// Set/Get Start position in percentage.
         /// </summary>
         /// <value> 0 to 100 </value>
-        public int Start;
+        public int Start
+               {
+                       set
+                       {
+                               _start = value;
+                       }
+                       get
+                       {
+                               return _start;
+                       }
+               }
 
         /// <summary>
-        /// Get Current position in percentage.
+        /// Set/Get Current position in percentage.
         /// </summary>
         /// <value> 0 to 100 </value>
-        public int Current;
+        public int Current
+               {
+                       set
+                       {
+                               _current = value;
+                       }
+                       get
+                       {
+                               return _current;
+                       }
+               }
+
+               internal int _start;
+               internal int _current;
     }
 }
\ No newline at end of file
index 13c5d0b..f1dc248 100644 (file)
@@ -26,7 +26,17 @@ namespace Tizen.Multimedia
         /// Set/Get  new gain in decibel that is set to the given band [dB]
         /// </summary>
         /// <value> int level </value>
-        public int Level { set; get;}
+        public int Level 
+               { 
+                       set
+                       {
+                               _level = value;
+                       }
+                       get
+                       {
+                               return _level;
+                       }
+               }
 
         /// <summary>
         /// Get frequency of the given band [dB] .
@@ -52,6 +62,7 @@ namespace Tizen.Multimedia
             }
         }
 
+               internal int _level;
         internal int _frequency;
         internal int _range;
     }
index b8d4fa5..76dcb34 100644 (file)
@@ -6,7 +6,10 @@ namespace Tizen.Multimedia
        {
                public MediaBufferSource (byte[] buffer)
                {
+                       _buffer = buffer;
                }
+
+               internal byte[] _buffer;
        }
 }
 
index da9a98b..9a56747 100644 (file)
@@ -21,28 +21,121 @@ namespace Tizen.Multimedia
 
     public class MediaStreamConfiguration
     {
+               #if _MEDIA_FORMAT_
+               TODO: Uncomment this when MediaFormat is implemented.
+               private EventHandler<BufferStatusEventArgs> _bufferStatusChanged;
+               private Interop.Player.BufferStatusCallback _bufferStatusChangedCallback;
+
+               private EventHandler<SeekOffsetEventArgs> _seekOffsetChanged;
+               private Interop.Player.SeekOffsetChangedCallback _seekOffsetChangedCallback;
 
         /// <summary>
         /// BufferStatusChanged event is raised when buffer underrun or overflow occurs. 
         /// </summary>
-        public event EventHandler<BufferStatusEventArgs> BufferStatusChanged;
+        public event EventHandler<BufferStatusEventArgs> BufferStatusChanged
+               {
+                       add
+                       {
+                               if(_bufferStatusChanged == null) {
+                                       RegisterBufferStatusEvent();
+                               }
+                               _bufferStatusChanged += value;
+                       }
+                       remove
+                       {
+                               _bufferStatusChanged -= value;
+                               if (_bufferStatusChanged == null) {
+                                       UnregisterBufferStatusEvent ();
+                               }
+                       }
+               }
+
+               private void RegisterBufferStatusEvent()
+               {
+                       _bufferStatusChangedCallback = (int status, IntPtr userData) =>
+                       {
+                               BufferStatusEventArgs eventArgs = new BufferStatusEventArgs();
+                               _bufferStatusChanged.Invoke(this, eventArgs);
+                       };
+                       Interop.Player.SetSubtitleUpdatedCb (_playerHandle, _bufferStatusChangedCallback, IntPtr.Zero);
+               }
+
+               private void UnregisterBufferStatusEvent()
+               {
+                       Interop.Player.UnsetMediaStreamBufferStatusCb (_playerHandle);
+               }
+
 
         /// <summary>
         /// SeekOffsetChanged event is raised when seeking occurs. 
         /// </summary>
-        public event EventHandler<SeekOffsetEventArgs> SeekOffsetChanged;
+        public event EventHandler<SeekOffsetEventArgs> SeekOffsetChanged
+               {
+                       add
+                       {
+                               if(_seekOffsetChanged == null) {
+                                       RegisterSeekOffsetChangedEvent();
+                               }
+                               _seekOffsetChanged += value;
+                       }
+                       remove
+                       {
+                               _seekOffsetChanged -= value;
+                               if (_seekOffsetChanged == null) {
+                                       UnregisterSeekOffsetChangedEvent ();
+                               }
+                       }
+               }
+
+               private void RegisterSeekOffsetChangedEvent()
+               {
+                       _seekOffsetChangedCallback = (UInt64 offset, IntPtr userData) =>
+                       {
+                               SeekOffsetEventArgs eventArgs = new SeekOffsetEventArgs();
+                               _seekOffsetChanged.Invoke(this, eventArgs);
+                       };
+                       Interop.Player.SetMediaStreamSeekCb (_playerHandle, _seekOffsetChangedCallback, IntPtr.Zero);
+               }
 
+               private void UnregisterSeekOffsetChangedEvent()
+               {
+                       Interop.Player.UnsetMediaStreamSeekCb (_playerHandle);
+               }
 
+               #endif
 
         /// <summary>
         /// max size bytes of buffer </summary>
         /// <value> Max size in bytes </value>
-        public ulong BufferMaxSize { get; set; }
+        public ulong BufferMaxSize 
+               { 
+                       get
+                       { 
+                               return _maxSize;
+                       } 
+                       set
+                       { 
+                               _maxSize = value;
+                       }
+               }
 
         /// <summary>
         /// Min threshold </summary>
         /// <value> min threshold in bytes </value>
-        public uint BufferMinThreshold { get; set; }
+        public uint BufferMinThreshold 
+               { 
+                       set
+                       {
+                               _minThreshold = value;
+                       }
+                       get
+                       {
+                               return _minThreshold;
+                       }
+               }
+
+               internal ulong _maxSize;
+               internal uint _minThreshold;
 
     }
 }
index 118f7a2..79d49f9 100644 (file)
@@ -34,6 +34,14 @@ namespace Tizen.Multimedia
             }
         }
 
+               /// <summary>
+               /// Constructor.
+               /// </summary>
+               public PlaybackErrorEventArgs(int errorCode)
+               {
+                       _errorCode = errorCode;
+               }
+
         internal int _errorCode;
 
     }
index 96560e3..5fae0db 100644 (file)
@@ -34,6 +34,14 @@ namespace Tizen.Multimedia
             }
         }
 
+               /// <summary>
+               /// Constructor
+               /// </summary>
+               public PlaybackInterruptedEventArgs(int interruptedCode)
+               {
+                       _interruptedCode = interruptedCode;
+               }
+
         internal int _interruptedCode;
     }
 }
\ No newline at end of file
index 8e16d4d..b838ee4 100644 (file)
@@ -14,6 +14,10 @@ using System.Threading.Tasks;
 
 namespace Tizen.Multimedia
 {
+       static internal class PlayerLog
+       {
+               internal const string LogTag = "Tizen.Multimedia.Player";
+       }
 
     /// <summary>
     /// The Player class provides APIs required for playback.
@@ -26,25 +30,203 @@ namespace Tizen.Multimedia
     /// </remarks>
     public class Player
     {
-        /// <summary>
+               private EventHandler<PlaybackCompletedEventArgs> _playbackCompleted;
+               private Interop.Player.PlaybackCompletedCallback _playbackCompletedCallback;
+
+               private EventHandler<PlaybackInterruptedEventArgs> _playbackInterrupted;
+               private Interop.Player.PlaybackInterruptedCallback _playbackInterruptedCallback;
+
+               private EventHandler<PlaybackErrorEventArgs> _playbackError;
+               private Interop.Player.PlaybackErrorCallback _playbackErrorCallback;
+
+               //TODO: Uncomment this after MediaPacket is implemented.
+               //private EventHandler<VideoFrameDecodedEventArgs> _videoFrameDecoded;
+               //private Interop.Player.VideoFrameDecodedCallback _videoFrameDecodedCallback;
+
+               /// <summary>
         /// PlaybackCompleted event is raised when playback of a media is finished
         /// </summary>
-        public event EventHandler<PlaybackCompletedEventArgs> PlaybackCompleted;
+        public event EventHandler<PlaybackCompletedEventArgs> PlaybackCompleted
+               {
+                       add
+                       {
+                               if(_playbackCompleted == null) {
+                                       RegisterPlaybackCompletedEvent();
+                               }
+                               _playbackCompleted += value;
+
+                       }
+                       remove
+                       {
+                               _playbackCompleted -= value;
+                               if (_playbackCompleted == null) {
+                                       UnregisterPlaybackCompletedEvent();
+                               }
+                       }
+               }
+
+               private void RegisterPlaybackCompletedEvent()
+               {
+                       _playbackCompletedCallback = (IntPtr userData) =>
+                               {
+                               PlaybackCompletedEventArgs eventArgs = new PlaybackCompletedEventArgs();
+                               _playbackCompleted.Invoke(this, eventArgs);
+                               };
+                       int ret = Interop.Player.SetCompletedCb (_playerHandle, _playbackCompletedCallback, IntPtr.Zero);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Setting PlaybackCompleted callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Setting PlaybackCompleted callback failed"); 
+                       }
+                       
+               }
+
+               private void UnregisterPlaybackCompletedEvent()
+               {
+                       int ret = Interop.Player.UnsetCompletedCb (_playerHandle);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Unsetting PlaybackCompleted callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Unsetting PlaybackCompleted callback failed"); 
+                       }
+                       
+               }
 
         /// <summary>
         /// PlaybackInterruped event is raised when playback of a media is interrupted
         /// </summary>
-        public event EventHandler<PlaybackInterruptedEventArgs> PlaybackInterruped;
+        public event EventHandler<PlaybackInterruptedEventArgs> PlaybackInterruped
+               {
+                       add
+                       {
+                               if(_playbackInterrupted == null) {
+                                       RegisterPlaybackInterruptedEvent();
+                               }
+                               _playbackInterrupted += value;
+                       }
+                       remove
+                       {
+                               _playbackInterrupted -= value;
+                               if (_playbackInterrupted == null) {
+                                       UnregisterPlaybackInterruptedEvent();
+                               }
+                       }
+               }
+
+               private void RegisterPlaybackInterruptedEvent()
+               {
+                       _playbackInterruptedCallback = (int code, IntPtr userData) =>
+                       {
+                               PlaybackInterruptedEventArgs eventArgs = new PlaybackInterruptedEventArgs(code);
+                               _playbackInterrupted.Invoke(this, eventArgs);
+                       };
+                       int ret = Interop.Player.SetInterruptedCb (_playerHandle, _playbackInterruptedCallback, IntPtr.Zero);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Setting PlaybackInterrupted callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Setting PlaybackInterrupted callback failed"); 
+                       }
+                       
+               }
+
+               private void UnregisterPlaybackInterruptedEvent()
+               {
+                       int ret = Interop.Player.UnsetInterruptedCb (_playerHandle);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Unsetting PlaybackInterrupted callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Unsetting PlaybackInterrupted callback failed"); 
+                       }
+               }
 
         /// <summary>
         /// PlaybackErrorOccured event is raised when any error occurs
         /// </summary>
-        public event EventHandler<PlaybackErrorEventArgs> PlaybackErrorOccured;
+        public event EventHandler<PlaybackErrorEventArgs> PlaybackErrorOccured
+               {
+                       add
+                       {
+                               if(_playbackError == null) {
+                                       RegisterPlaybackErrorEvent();
+                               }
+                               _playbackError += value;
+                       }
+                       remove
+                       {
+                               _playbackError -= value;
+                               if (_playbackError == null) {
+                                       UnregisterPlaybackErrorEvent ();
+                               }
+                       }
+               }
 
+               private void RegisterPlaybackErrorEvent()
+               {
+                       _playbackErrorCallback = (int code, IntPtr userData) =>
+                       {
+                               PlaybackErrorEventArgs eventArgs = new PlaybackErrorEventArgs(code);
+                               _playbackError.Invoke(this, eventArgs);
+                       };
+                       int ret = Interop.Player.SetErrorCb (_playerHandle, _playbackErrorCallback, IntPtr.Zero);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Setting PlaybackError callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Setting PlaybackError callback failed"); 
+                       }
+                       
+               }
+
+               private void UnregisterPlaybackErrorEvent()
+               {
+                       int ret = Interop.Player.UnsetErrorCb (_playerHandle);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Unsetting PlaybackError callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Unsetting PlaybackError callback failed"); 
+                       }
+                       
+               }
+
+
+               #if _MEDIA_PACKET_
+               TODO: Uncomment this after MediaPacket is implemented.
         /// <summary>
         /// VideoFrameCaptured event is raised when a video frame is decoded
         /// </summary>
-        public event EventHandler<VideoFrameDecodedEventArgs> VideoFrameDecoded;
+        public event EventHandler<VideoFrameDecodedEventArgs> VideoFrameDecoded
+               {
+                       add
+                       {
+                               if(_videoFrameDecoded == null) {
+                                       RegisterVideoFrameDecodedEvent ();
+                               }
+                               _videoFrameDecoded += value;
+                       }
+                       remove
+                       {
+                               _videoFrameDecoded -= value;
+                               if (_videoFrameDecoded == null) {
+                                       UnregisterVideoFrameDecodedEvent ();
+                               }
+                       }
+               }
+
+               private void RegisterVideoFrameDecodedEvent()
+               {
+                       _videoFrameDecoded = (MediaPacket packet, IntPtr userData) =>
+                       {
+                               VideoFrameDecodedEventArgs eventArgs = new VideoFrameDecodedEventArgs();
+                               _videoFrameDecoded.Invoke(this, eventArgs);
+                       };
+                       Interop.Player.SetErrorCb (_playerHandle, _videoFrameDecodedCallback, IntPtr.Zero);
+               }
+
+               private void UnregisterVideoFrameDecodedEvent()
+               {
+                       Interop.Player.UnsetMediaPacketVideoFrameDecodedCb (_playerHandle);
+               }
+               #endif
+
 
         /// <summary>
         /// Get Player state.
@@ -55,9 +237,11 @@ namespace Tizen.Multimedia
             get
             {
                                int state;
-                               if (Interop.PlayerInterop.GetState (_playerHandle, out state) != 0) {
-                                       //throw Exception;
-                               }
+                               int ret = Interop.Player.GetState (_playerHandle, out state);
+
+                               if (ret != (int)PlayerError.None) 
+                                       PlayerErrorFactory.ThrowException (ret, "Get player state failed"); 
+
                                return (PlayerState)state;
             }
         }
@@ -70,14 +254,21 @@ namespace Tizen.Multimedia
                {
                        set
                        {
-                               if (Interop.PlayerInterop.SetVolume (_playerHandle, value, _rightVolume) == 0)
+                               int ret = Interop.Player.SetVolume (_playerHandle, value, _rightVolume);
+
+                               if (ret == (int)PlayerError.None) 
+                               {
                                        _leftVolume = value;
-                               //else
-                               //      throw Exception;
+                               }
+                               else 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Set volume failed" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "set volume failed"); 
+                               }
                        }
                        get
                        {
-                               //Interop.PlayerInterop.GetVolume (_playerHandle, out _leftVolume, out _rightVolume);
+                               //Interop.Player.GetVolume (_playerHandle, out _leftVolume, out _rightVolume);
                                return _leftVolume;
                        }
                }
@@ -90,14 +281,21 @@ namespace Tizen.Multimedia
                {
                        set
                        {
-                               if ( Interop.PlayerInterop.SetVolume (_playerHandle, _leftVolume, value) == 0 )
+                               int ret = Interop.Player.SetVolume (_playerHandle, _leftVolume, value);
+
+                               if (ret == (int)PlayerError.None) 
+                               {
                                        _rightVolume = value;
-                               //else
-                               //      throw Exception;
+                               }
+                               else 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Set volume failed" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "set volume failed"); 
+                               }
                        }
                        get
                        {
-                               //Interop.PlayerInterop.GetVolume (_playerHandle, out _leftVolume, out _rightVolume);
+                               //Interop.Player.GetVolume (_playerHandle, out _leftVolume, out _rightVolume);
                                return _rightVolume;
                        }
                }
@@ -110,10 +308,18 @@ namespace Tizen.Multimedia
                { 
                        set
                        {
-                               if (_audioLatencyMode != (int)value && Interop.PlayerInterop.SetAudioLatencyMode (_playerHandle, (int)value) == 0)
-                                       _audioLatencyMode = (int) value;
-                               //else
-                               //      throw Exception;
+                               if (_audioLatencyMode != (int)value) 
+                               {
+                                       int ret = Interop.Player.SetAudioLatencyMode (_playerHandle, (int)value);
+                                       if (ret != (int)PlayerError.None) {
+                                               Log.Error (PlayerLog.LogTag, "Set audio latency mode failed" + (PlayerError)ret);
+                                               PlayerErrorFactory.ThrowException (ret, "set audio latency mode failed");
+                                       } 
+                                       else 
+                                       {
+                                               _audioLatencyMode = (int)value;
+                                       }
+                               }
                        }
 
                        get 
@@ -130,14 +336,22 @@ namespace Tizen.Multimedia
                { 
                        set
                        {
-                               if (_mute != value && Interop.PlayerInterop.SetMute (_playerHandle, value) == 0)
-                                       _mute = value;
-                               //else
-                               //      throw Exception;
+                               if (_mute != value) 
+                               {
+                                       int ret = Interop.Player.SetMute (_playerHandle, value);                        
+                                       if (ret != (int)PlayerError.None) {
+                                               Log.Error (PlayerLog.LogTag, "Set mute failed" + (PlayerError)ret);
+                                               PlayerErrorFactory.ThrowException (ret, "set mute failed");
+                                       } 
+                                       else 
+                                       {
+                                               _mute = value;
+                                       }
+                               }
                        }
                        get
                        {
-                               //Interop.PlayerInterop.IsMuted (_playerHandle, out _mute);
+                               //Interop.Player.IsMuted (_playerHandle, out _mute);
                                return _mute;
                        }
                }
@@ -150,14 +364,23 @@ namespace Tizen.Multimedia
                { 
                        set
                        {
-                               if (_isLooping != value && Interop.PlayerInterop.SetLooping (_playerHandle, value) == 0)
-                                       _isLooping = value;
-                               //else
-                               //      throw Exception;
+                               if (_isLooping != value) 
+                               {
+                                       int ret = Interop.Player.SetLooping (_playerHandle, value);
+                                       if (ret != (int)PlayerError.None) 
+                                       {
+                                               Log.Error (PlayerLog.LogTag, "Set loop failed" + (PlayerError)ret);
+                                               PlayerErrorFactory.ThrowException (ret, "set loop failed");
+                                       } 
+                                       else 
+                                       {
+                                               _isLooping = value;
+                                       }
+                               }
                        }
                        get
                        {
-                               //Interop.PlayerInterop.IsLooping (_playerHandle, out _isLooping);
+                               //Interop.Player.IsLooping (_playerHandle, out _isLooping);
                                return _isLooping;
                        }
                }
@@ -170,8 +393,11 @@ namespace Tizen.Multimedia
         {
             set
             {
-                               if (Interop.PlayerInterop.SetPlaybackRate (_playerHandle, value) != 0) {
-                                       //throw Exception;
+                               int ret = Interop.Player.SetPlaybackRate (_playerHandle, value);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Set playback rate failed" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "set playback rate failed");
                                }
             }
         }
@@ -180,18 +406,27 @@ namespace Tizen.Multimedia
         /// Set/Get sound type.
         /// </summary>
         /// <value> System, Notification, Alarm, Ringtone, Media, Call, Voip, Voice </value>
-        public SoundType PlayerSoundType 
+        public AudioType PlayerAudioType 
                {
                        set
                        {
-                               if (_soundType != value && Interop.PlayerInterop.SetSoundType (_playerHandle, (int)value) != 0)
-                                       _soundType = value;
-                               //else
-                               //      throw Exception;
+                               if (_audioType != value) 
+                               {
+                                       int ret = Interop.Player.SetSoundType (_playerHandle, (int)value);
+                                       if (ret != (int)PlayerError.None) {
+                                               Log.Error (PlayerLog.LogTag, "Set audio type failed" + (PlayerError)ret);
+                                               PlayerErrorFactory.ThrowException (ret, "set audio type failed");
+                                       } 
+                                       else 
+                                       {
+                                               _audioType = value;
+                                       }
+                               }
+
                        }
                        get
                        {
-                               return _soundType;
+                               return _audioType;
                        }
                }
 
@@ -204,9 +439,9 @@ namespace Tizen.Multimedia
             get
             {
                                int playPosition;
-                               if (Interop.PlayerInterop.GetPlayPosition (_playerHandle, out playPosition) != 0) {
-                                       //throw Exception;
-                               }
+                               int ret = Interop.Player.GetPlayPosition (_playerHandle, out playPosition);
+                               if (ret != (int)PlayerError.None) 
+                                       Log.Error (PlayerLog.LogTag, "Failed to get play position, " + (PlayerError)ret);
                                return playPosition;
             }
         }
@@ -292,15 +527,20 @@ namespace Tizen.Multimedia
         /// Player constructor.</summary>
         public Player()
         {
-                       // Throw exception on error returns?
-                       Interop.PlayerInterop.Create (out _playerHandle);
+                       int ret;
+                       
+                       ret = Interop.Player.Create (out _playerHandle);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Failed to create player" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Failed to create player"); 
+                       }
 
                        // Initial get values
-                       Interop.PlayerInterop.GetVolume (_playerHandle, out _leftVolume, out _rightVolume);
-                       Interop.PlayerInterop.GetAudioLatencyMode (_playerHandle, out _audioLatencyMode);
-                       Interop.PlayerInterop.IsMuted (_playerHandle, out _mute);
-                       Interop.PlayerInterop.IsLooping (_playerHandle, out _isLooping);
-
+                       Interop.Player.GetVolume (_playerHandle, out _leftVolume, out _rightVolume);
+                       Interop.Player.GetAudioLatencyMode (_playerHandle, out _audioLatencyMode);
+                       Interop.Player.IsMuted (_playerHandle, out _mute);
+                       Interop.Player.IsLooping (_playerHandle, out _isLooping);
 
                        // AudioEffect
                        _audioEffect = new AudioEffect();
@@ -336,21 +576,31 @@ namespace Tizen.Multimedia
 
         /// <summary>
         /// Prepares the media player for playback. </summary>
-               /// TODO: make async
-               public /*Task<void>*/void PrepareAsync()
+               public void PrepareAsync()
         {
-                       if ((Interop.PlayerInterop.Prepare (_playerHandle)) != 0) {
-                               //throw Exception;
-                       }
-        }
+                       int ret;
+                       Task.Factory.StartNew (() => {
+                               Interop.Player.PrepareCallback cb = (IntPtr userData) => {
+                               }; 
+                               ret = Interop.Player.PrepareAsync (_playerHandle, cb, IntPtr.Zero); 
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to prepare player" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "Failed to prepare player"); 
+                               }
+                       });
+               }
 
         /// <summary>
         /// The most recently used media is reset and no longer associated with the player. Playback is no longer possible. 
         /// If you want to use the player again, you will have to set the data URI and call prepare() again. </summary>
         public void Unrepare()
         {
-                       if (Interop.PlayerInterop.Unprepare (_playerHandle) != 0) {
-                               //throw Exception;
+                       int ret = Interop.Player.Unprepare (_playerHandle);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Failed to unprepare player" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Failed to unprepare player"); 
                        }
         }
 
@@ -358,8 +608,11 @@ namespace Tizen.Multimedia
         /// Starts or resumes playback.  </summary>
         public void Start()
         {
-                       if (Interop.PlayerInterop.Start (_playerHandle) != 0) {
-                               //throw Exception;
+                       int ret = Interop.Player.Start (_playerHandle);
+                       if ( ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Failed to start player" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Failed to start player"); 
                        }
         }
 
@@ -367,8 +620,11 @@ namespace Tizen.Multimedia
         /// Stops playing media content. </summary>
         public void Stop()
         {
-                       if (Interop.PlayerInterop.Stop (_playerHandle) != 0) {
-                               //throw Exception;
+                       int ret = Interop.Player.Stop (_playerHandle);
+                       if ( ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Failed to stop player" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Failed to stop player"); 
                        }
         }
 
@@ -376,39 +632,81 @@ namespace Tizen.Multimedia
         /// Pauses the player. </summary>
         public void Pause()
         {
-                       if (Interop.PlayerInterop.Pause (_playerHandle) != 0) {
-                               //throw Exception;
+                       int ret = Interop.Player.Pause (_playerHandle);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Failed to pause player" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Failed to pause player"); 
                        }
         }
 
                /// <summary>
                /// sets media source for the player. </summary>
                /// <param name="source"> Mediasource </param>
-               /// TODO: implement memory buffer and packet stream
                public void SetSource(MediaSource source)
                {
-                       if (source.GetType() == typeof(MediaUriSource)) {
-                               if ( Interop.PlayerInterop.SetUri (_playerHandle, ((MediaUriSource)source)._uri) != 0) {
-                                       // throw Exception
+                       int ret;
+                       if (source.GetType () == typeof(MediaUriSource)) 
+                       {
+                               ret = Interop.Player.SetUri (_playerHandle, ((MediaUriSource)source)._uri);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to seturi" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "Failed to set uri"); 
                                }
+                       } 
+                       else if (source.GetType () == typeof(MediaBufferSource)) 
+                       {
+                               //if(Interop.Player.SetMemoryBuffer(_playerHandle, ((MediaBufferSource)source)._buffer, ((MediaBufferSource)source)._buffer.Length) != 0) {
+                                       // throw Exception
+                               //}
                        }
+                       // TODO: Handle MediaStream source after implementing MediaPacket module
                }
 
 
         /// <summary>
         /// Captures a video frame asynchronously. </summary>
-        Task<VideoFrameCapture> CaptureVideoAsync()
+        public Task<VideoFrameCapture> CaptureVideoAsync()
         {
-          return null;
+                       return Task.Factory.StartNew(() => CaptureVideoAsyncTask()).Result;
         }
 
+               internal Task<VideoFrameCapture> CaptureVideoAsyncTask()
+               {
+                       TaskCompletionSource<VideoFrameCapture> t = new TaskCompletionSource<VideoFrameCapture> ();
+                       Interop.Player.VideoCaptureCallback  cb = (byte[] data, int width, int height, uint size, IntPtr userData) => {
+                               VideoFrameCapture v = new VideoFrameCapture(data, width, height, size);
+                               t.SetResult(v);
+                       };
+
+                       int ret = Interop.Player.CaptureVideo (_playerHandle, cb, IntPtr.Zero);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Failed to capture video" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Failed to capture video"); 
+                       }
+                       return t.Task;
+               }
+
         /// <summary>
         ///Sets the seek position for playback, asynchronously.  </summary>
         /// <param name="milliseconds"> Position to be set in milliseconds</param>
         /// <param name="accurate"> accurate seek or not</param>
-        //public Task<void> SetPlayPositionAsync(int milliseconds, bool accurate)
-        //{
-        //}
+        public void SetPlayPositionAsync(int milliseconds, bool accurate)
+        {
+                       Task.Factory.StartNew (() => {
+                               Interop.Player.SeekCompletedCallback cb = (IntPtr userData) => {
+                               }; 
+                               int ret = Interop.Player.SetPlayPosition (_playerHandle, milliseconds, accurate, cb, IntPtr.Zero);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to set playposition" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "Failed to set playposition"); 
+                               }
+                       });
+
+        }
 
 
         internal PlayerState _state;
@@ -417,7 +715,7 @@ namespace Tizen.Multimedia
                internal int _audioLatencyMode;
                internal bool _mute;
                internal bool _isLooping;
-               internal SoundType _soundType;
+               internal AudioType _audioType;
 
                internal Display _display;
                internal Subtitle _subtitle;
index 9b24704..a1f1aa4 100644 (file)
@@ -40,8 +40,10 @@ namespace Tizen.Multimedia
             get
             {
                                string album;
-                               if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Album, out album) != 0) {
-                                       // throw Exception;
+                               int ret = Interop.Player.GetContentInfo (_playerHandle, (int)ContentInfoKey.Album, out album);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get album info" + (PlayerError)ret);
                                }
                 return album;
             }
@@ -56,9 +58,12 @@ namespace Tizen.Multimedia
             get
             {
                                string artist;
-                               if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Artist, out artist) != 0) {
-                                       // throw Exception;
+                               int ret = Interop.Player.GetContentInfo (_playerHandle, (int)ContentInfoKey.Artist, out artist);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get artist info" + (PlayerError)ret);
                                }
+
                                return artist;
             }
         }
@@ -72,8 +77,10 @@ namespace Tizen.Multimedia
             get
             {
                                string author;
-                               if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Author, out author) != 0) {
-                                       // throw Exception;
+                               int ret = Interop.Player.GetContentInfo (_playerHandle, (int)ContentInfoKey.Author, out author);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get author info" + (PlayerError)ret);
                                }
                                return author;
             }
@@ -88,9 +95,12 @@ namespace Tizen.Multimedia
             get
             {
                                string genre;
-                               if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Genre, out genre) != 0) {
-                                       // throw Exception;
+                               int ret = Interop.Player.GetContentInfo (_playerHandle, (int)ContentInfoKey.Genre, out genre);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get genre info" + (PlayerError)ret);
                                }
+
                                return genre;
             }
         }
@@ -104,8 +114,10 @@ namespace Tizen.Multimedia
             get
             {
                                string title;
-                               if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Title, out title) != 0) {
-                                       // throw Exception;
+                               int ret = Interop.Player.GetContentInfo (_playerHandle, (int)ContentInfoKey.Title, out title);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get title info" + (PlayerError)ret);
                                }
                                return title;
             }
@@ -120,8 +132,10 @@ namespace Tizen.Multimedia
             get
             {
                                string year;
-                               if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Year, out year) != 0) {
-                                       // throw Exception;
+                               int ret = Interop.Player.GetContentInfo (_playerHandle, (int)ContentInfoKey.Year, out year);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get title info" + (PlayerError)ret);
                                }
                                return year;
             }
index 0e424a2..8c4588e 100644 (file)
-using System;\r
-\r
-namespace Tizen.Multimedia\r
-{\r
-    /// <summary>\r
-    /// Enumeration for player state\r
-    /// </summary>\r
-    public enum PlayerState\r
-    {\r
-        /// <summary>\r
-        /// Player is not created \r
-        /// </summary>\r
-        None,\r
-\r
-        /// <summary>\r
-        /// Player is created, but not prepared \r
-        /// </summary>\r
-        Idle,\r
-\r
-        /// <summary>\r
-        /// Player is ready to play media \r
-        /// </summary>\r
-        Ready,\r
-\r
-        /// <summary>\r
-        /// Player is playing media \r
-        /// </summary>\r
-        Playing,\r
-\r
-        /// <summary>\r
-        /// Player is paused while playing media \r
-        /// </summary>\r
-        Paused,\r
-    }\r
-\r
-    /// <summary>\r
-    /// Enumeration for player display type\r
-    /// </summary>\r
-    public enum DisplayType\r
-    {\r
-        /// <summary>\r
-        /// Overlay surface display  \r
-        /// </summary>\r
-        Overlay,\r
-\r
-        /// <summary>\r
-        ///  Evas image object surface display \r
-        /// </summary>\r
-        Evas,\r
-\r
-        /// <summary>\r
-        /// This disposes off buffers  \r
-        /// </summary>\r
-        None,\r
-    }\r
-\r
-\r
-    /// <summary>\r
-    /// Enumeration for player audio latency mode\r
-    /// </summary>\r
-    public enum AudioLatencyMode\r
-    {\r
-        /// <summary>\r
-        /// Low audio latency mode   \r
-        /// </summary>\r
-        Low,\r
-\r
-        /// <summary>\r
-        ///  Middle audio latency mode \r
-        /// </summary>\r
-        Mid,\r
-\r
-        /// <summary>\r
-        /// High audio latency mode   \r
-        /// </summary>\r
-        High,\r
-    }\r
-\r
-\r
-    /// <summary>\r
-    /// Enumeration for player display rotation\r
-    /// </summary>\r
-    public enum DisplayRotation\r
-    {\r
-        /// <summary>\r
-        /// Display is not rotated  \r
-        /// </summary>\r
-        RotationNone,\r
-\r
-        /// <summary>\r
-        ///  Display is rotated 90 degrees \r
-        /// </summary>\r
-        Rotation90,\r
-\r
-        /// <summary>\r
-        /// Display is rotated 180 degrees  \r
-        /// </summary>\r
-        Rotation180,\r
-\r
-        /// <summary>\r
-        /// Display is rotated 270 degrees  \r
-        /// </summary>\r
-        Rotation270\r
-    }\r
-\r
-\r
-    /// <summary>\r
-    /// Enumeration for player display mode\r
-    /// </summary>\r
-    public enum DisplayMode\r
-    {\r
-        /// <summary>\r
-        /// Letter box \r
-        /// </summary>\r
-        LetterBox,\r
-\r
-        /// <summary>\r
-        ///  Origin size\r
-        /// </summary>\r
-        OriginalSize,\r
-\r
-        /// <summary>\r
-        /// Full-screen \r
-        /// </summary>\r
-        FullScreen,\r
-\r
-        /// <summary>\r
-        /// Cropped full-screen \r
-        /// </summary>\r
-        CroppedFull,\r
-\r
-        /// <summary>\r
-        /// Origin size (if surface size is larger than video size(width/height)) or \r
-        /// Letter box (if video size(width/height) is larger than surface size) \r
-        /// </summary>\r
-        OriginalOrFull,\r
-\r
-        /// <summary>\r
-        /// Dst ROI mode  \r
-        /// </summary>\r
-        DstRoi\r
-    }\r
-\r
-\r
-    /// <summary>\r
-    /// Enumeration for player stream type\r
-    /// </summary>\r
-    public enum StreamType\r
-    {\r
-        /// <summary>\r
-        /// Container type \r
-        /// </summary>\r
-        Default,\r
-\r
-        /// <summary>\r
-        ///  Audio element stream type \r
-        /// </summary>\r
-        Audio,\r
-\r
-        /// <summary>\r
-        /// Video element stream type  \r
-        /// </summary>\r
-        Video,\r
-\r
-        /// <summary>\r
-        /// Text type  \r
-        /// </summary>\r
-        Text\r
-    }\r
-\r
-\r
-\r
-    /// <summary>\r
-    /// Enumeration for Progressive download message\r
-    /// </summary>\r
-    public enum ProgressiveDownloadMessage\r
-    {\r
-        /// <summary>\r
-        /// Progressive download is started \r
-        /// </summary>\r
-        Started,\r
-\r
-        /// <summary>\r
-        ///  Progressive download is completed \r
-        /// </summary>\r
-        Completed,\r
-    }\r
-\r
-    /// <summary>\r
-    /// Streaming buffer status\r
-    /// </summary>\r
-    public enum StreamingBufferStatus\r
-    {\r
-        /// <summary>\r
-        /// Underrun\r
-        /// </summary>\r
-        Underrun,\r
-\r
-        /// <summary>\r
-        ///  Completed \r
-        /// </summary>\r
-        Overflow,\r
-    }\r
-\r
-    /// <summary>\r
-    /// Enumeration for sound type\r
-    /// </summary>\r
-    public enum SoundType\r
-    {\r
-        /// <summary>\r
-        /// Sound type for system \r
-        /// </summary>\r
-        System,\r
-\r
-        /// <summary>\r
-        ///  Sound type for notifications \r
-        /// </summary>\r
-        Notification,\r
-\r
-        /// <summary>\r
-        /// Sound type for alarm \r
-        /// </summary>\r
-        Alarm,\r
-\r
-        /// <summary>\r
-        /// Sound type for ringtones \r
-        /// </summary>\r
-        Ringtone,\r
-\r
-        /// <summary>\r
-        ///  Sound type for media \r
-        /// </summary>\r
-        Media,\r
-\r
-        /// <summary>\r
-        /// Sound type for call \r
-        /// </summary>\r
-        Call,\r
-\r
-        /// <summary>\r
-        /// Sound type for voip\r
-        /// </summary>\r
-        Voip,\r
-\r
-        /// <summary>\r
-        ///  Sound type for voice \r
-        /// </summary>\r
-        Voice\r
-    }\r
-\r
-    /// <summary>\r
-    /// Enumeration for source type\r
-    /// </summary>\r
-    public enum PlayerSourceType\r
-    {\r
-        /// <summary>\r
-        /// Uri source \r
-        /// </summary>\r
-        Uri,\r
-\r
-        /// <summary>\r
-        /// memory buffer source \r
-        /// </summary>\r
-        Memory,\r
-\r
-        /// <summary>\r
-        /// stream source \r
-        /// </summary>\r
-        Stream,\r
-    }\r
-\r
-}\r
+using System;
+
+namespace Tizen.Multimedia
+{
+    /// <summary>
+    /// Enumeration for player state
+    /// </summary>
+    public enum PlayerState
+    {
+        /// <summary>
+        /// Player is not created 
+        /// </summary>
+        None,
+
+        /// <summary>
+        /// Player is created, but not prepared 
+        /// </summary>
+        Idle,
+
+        /// <summary>
+        /// Player is ready to play media 
+        /// </summary>
+        Ready,
+
+        /// <summary>
+        /// Player is playing media 
+        /// </summary>
+        Playing,
+
+        /// <summary>
+        /// Player is paused while playing media 
+        /// </summary>
+        Paused,
+    }
+
+    /// <summary>
+    /// Enumeration for player display type
+    /// </summary>
+    public enum DisplayType
+    {
+        /// <summary>
+        /// Overlay surface display  
+        /// </summary>
+        Overlay,
+
+        /// <summary>
+        ///  Evas image object surface display 
+        /// </summary>
+        Evas,
+
+        /// <summary>
+        /// This disposes off buffers  
+        /// </summary>
+        None,
+    }
+
+
+    /// <summary>
+    /// Enumeration for player audio latency mode
+    /// </summary>
+    public enum AudioLatencyMode
+    {
+        /// <summary>
+        /// Low audio latency mode   
+        /// </summary>
+        Low,
+
+        /// <summary>
+        ///  Middle audio latency mode 
+        /// </summary>
+        Mid,
+
+        /// <summary>
+        /// High audio latency mode   
+        /// </summary>
+        High,
+    }
+
+
+    /// <summary>
+    /// Enumeration for player display rotation
+    /// </summary>
+    public enum DisplayRotation
+    {
+        /// <summary>
+        /// Display is not rotated  
+        /// </summary>
+        RotationNone,
+
+        /// <summary>
+        ///  Display is rotated 90 degrees 
+        /// </summary>
+        Rotation90,
+
+        /// <summary>
+        /// Display is rotated 180 degrees  
+        /// </summary>
+        Rotation180,
+
+        /// <summary>
+        /// Display is rotated 270 degrees  
+        /// </summary>
+        Rotation270
+    }
+
+
+    /// <summary>
+    /// Enumeration for player display mode
+    /// </summary>
+    public enum DisplayMode
+    {
+        /// <summary>
+        /// Letter box 
+        /// </summary>
+        LetterBox,
+
+        /// <summary>
+        ///  Origin size
+        /// </summary>
+        OriginalSize,
+
+        /// <summary>
+        /// Full-screen 
+        /// </summary>
+        FullScreen,
+
+        /// <summary>
+        /// Cropped full-screen 
+        /// </summary>
+        CroppedFull,
+
+        /// <summary>
+        /// Origin size (if surface size is larger than video size(width/height)) or 
+        /// Letter box (if video size(width/height) is larger than surface size) 
+        /// </summary>
+        OriginalOrFull,
+
+        /// <summary>
+        /// Dst ROI mode  
+        /// </summary>
+        DstRoi
+    }
+
+
+    /// <summary>
+    /// Enumeration for player stream type
+    /// </summary>
+    public enum StreamType
+    {
+        /// <summary>
+        /// Container type 
+        /// </summary>
+        Default,
+
+        /// <summary>
+        ///  Audio element stream type 
+        /// </summary>
+        Audio,
+
+        /// <summary>
+        /// Video element stream type  
+        /// </summary>
+        Video,
+
+        /// <summary>
+        /// Text type  
+        /// </summary>
+        Text
+    }
+
+
+
+    /// <summary>
+    /// Enumeration for Progressive download message
+    /// </summary>
+    public enum ProgressiveDownloadMessage
+    {
+        /// <summary>
+        /// Progressive download is started 
+        /// </summary>
+        Started,
+
+        /// <summary>
+        ///  Progressive download is completed 
+        /// </summary>
+        Completed,
+    }
+
+    /// <summary>
+    /// Streaming buffer status
+    /// </summary>
+    public enum StreamingBufferStatus
+    {
+        /// <summary>
+        /// Underrun
+        /// </summary>
+        Underrun,
+
+        /// <summary>
+        ///  Completed 
+        /// </summary>
+        Overflow,
+    }
+
+    /// <summary>
+    /// Enumeration for sound type
+    /// </summary>
+    public enum AudioType
+    {
+        /// <summary>
+        /// Sound type for system 
+        /// </summary>
+        System,
+
+        /// <summary>
+        ///  Sound type for notifications 
+        /// </summary>
+        Notification,
+
+        /// <summary>
+        /// Sound type for alarm 
+        /// </summary>
+        Alarm,
+
+        /// <summary>
+        /// Sound type for ringtones 
+        /// </summary>
+        Ringtone,
+
+        /// <summary>
+        ///  Sound type for media 
+        /// </summary>
+        Media,
+
+        /// <summary>
+        /// Sound type for call 
+        /// </summary>
+        Call,
+
+        /// <summary>
+        /// Sound type for voip
+        /// </summary>
+        Voip,
+
+        /// <summary>
+        ///  Sound type for voice 
+        /// </summary>
+        Voice
+    }
+
+    /// <summary>
+    /// Enumeration for source type
+    /// </summary>
+    public enum PlayerSourceType
+    {
+        /// <summary>
+        /// Uri source 
+        /// </summary>
+        Uri,
+
+        /// <summary>
+        /// memory buffer source 
+        /// </summary>
+        Memory,
+
+        /// <summary>
+        /// stream source 
+        /// </summary>
+        Stream,
+    }
+
+}
diff --git a/src/Tizen.Multimedia/Player/PlayerErrorFactory.cs b/src/Tizen.Multimedia/Player/PlayerErrorFactory.cs
new file mode 100644 (file)
index 0000000..1abda08
--- /dev/null
@@ -0,0 +1,67 @@
+using System;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+       internal enum PlayerError
+       {
+               None = ErrorCode.None,
+               InvalidParameter = ErrorCode.InvalidParameter,
+               InvalidState,
+               OutOfMemory,
+               NoSuchFile,
+               InvalidOperation,
+               NoSpaceOnDevice,
+               FeatureNotSupported,
+               SeekFailed,
+               FileNotSupported,
+               InvalidUri,
+               SoundPolicyError,
+               ConnectionFailed,
+               VideoCaptureFailed,
+               DrmExpired,
+               DrmNoLicense,
+               DrmFutureUse,
+               DrmNotPermitted,
+               ResourceLimit,
+               PermissionDenied
+       };
+
+       internal static class PlayerErrorFactory
+       {
+               internal static void ThrowException (int errorCode, string errorMessage = null, string paramName = null)
+               {
+                       PlayerError err = (PlayerError) errorCode;
+                       if(string.IsNullOrEmpty(errorMessage))
+                       {
+                               errorMessage = err.ToString();
+                       }
+                       switch((PlayerError)errorCode)
+                       {
+                       case PlayerError.InvalidParameter:
+                               throw new ArgumentException(errorMessage, paramName);
+
+                       case PlayerError.InvalidState:
+                       case PlayerError.OutOfMemory:
+                       case PlayerError.NoSuchFile:
+                       case PlayerError.InvalidOperation:
+                       case PlayerError.NoSpaceOnDevice:
+                       case PlayerError.FeatureNotSupported:
+                       case PlayerError.SeekFailed:
+                       case PlayerError.FileNotSupported:
+                       case PlayerError.InvalidUri:
+                       case PlayerError.SoundPolicyError:
+                       case PlayerError.ConnectionFailed:
+                       case PlayerError.VideoCaptureFailed:
+                       case PlayerError.DrmExpired:
+                       case PlayerError.DrmNoLicense:
+                       case PlayerError.DrmFutureUse:
+                       case PlayerError.DrmNotPermitted:
+                       case PlayerError.ResourceLimit:
+                       case PlayerError.PermissionDenied:
+                               throw new InvalidOperationException(errorMessage);
+                       }
+               }
+       }
+}
+
diff --git a/src/Tizen.Multimedia/Player/PlayerSource.cs b/src/Tizen.Multimedia/Player/PlayerSource.cs
deleted file mode 100644 (file)
index 0484ad0..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;\r
-\r
-\r
-namespace Tizen.Multimedia\r
-{\r
-    abstract class PlayerSource\r
-    {\r
-        PlayerSourceType Type;\r
-    }\r
-}\r
index a58e8df..1aba756 100644 (file)
@@ -34,6 +34,14 @@ namespace Tizen.Multimedia
             }
         }
 
+               /// <summary>
+               /// Constructor
+               /// </summary>
+               public ProgressiveDownloadMessageEventArgs(ProgressiveDownloadMessage message)
+               {
+                       _message = message;
+               }
+
         internal ProgressiveDownloadMessage _message;
 
     }
index 994a438..086550c 100644 (file)
@@ -26,12 +26,35 @@ namespace Tizen.Multimedia
         /// Get current download position (bytes) 
         /// </summary>
         /// <value> current download position </value>
-        public ulong Current;
+        public ulong Current
+               {
+                       set
+                       {
+                               _current = value;
+                       }
+                       get
+                       {
+                               return _current;
+                       }
+               }
 
         /// <summary>
         /// Get total size of the file (bytes) 
         /// </summary>
         /// <value> Total size of file (bytes) </value>
-        public ulong TotalSize;
+        public ulong TotalSize
+               {
+                       set
+                       {
+                               _totalSize = value;
+                       }
+                       get
+                       {
+                               return _totalSize;
+                       }
+               }
+
+               internal ulong _current;
+               internal ulong _totalSize;
     }
 }
\ No newline at end of file
index 0bad71f..4f1f148 100644 (file)
@@ -26,7 +26,7 @@ namespace Tizen.Multimedia
         /// Get seek offset.
         /// </summary>
         /// <value> byte position to seek  </value>
-        public ulong Offset 
+               public UInt64 Offset 
         {
             get
             {
@@ -34,7 +34,15 @@ namespace Tizen.Multimedia
             }
         }
 
-        internal ulong _offset;
+               /// <summary>
+               /// Constructor.
+               /// </summary>
+               public SeekOffsetEventArgs(UInt64 offset)
+               {
+                       _offset = offset;
+               }
+
+               internal UInt64 _offset;
 
     }
 }
\ No newline at end of file
diff --git a/src/Tizen.Multimedia/Player/SourceFactory.cs b/src/Tizen.Multimedia/Player/SourceFactory.cs
deleted file mode 100644 (file)
index 6a0dd70..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/// Source Factory\r
-///\r
-/// Copyright 2016 by Samsung Electronics, Inc.,\r
-///\r
-/// This software is the confidential and proprietary information\r
-/// of Samsung Electronics, Inc. ("Confidential Information"). You\r
-/// shall not disclose such Confidential Information and shall use\r
-/// it only in accordance with the terms of the license agreement\r
-/// you entered into with Samsung.\r
-\r
-using System;\r
-\r
-namespace Tizen.Multimedia\r
-{\r
-    /// <summary>\r
-    /// SourceFactory\r
-    /// </summary>\r
-    /// <remarks>\r
-    /// Factory class for getting player source.\r
-    /// </remarks>\r
-\r
-    class SourceFactory\r
-    {\r
-        /// <summary>\r
-        /// GetSource </summary>\r
-        /// <param name="uri"> source uri string </param>\r
-        /// <returns>PlayerSource</returns>\r
-        public static PlayerSource GetSource(string uri)\r
-        {\r
-            return null;\r
-        }\r
-\r
-        /// <summary>\r
-        /// GetSource </summary>\r
-        /// <param name="buffer"> memory buffer </param>\r
-        /// <returns>PlayerSource</returns>\r
-        public static PlayerSource GetSource(byte[] buffer)\r
-        {\r
-            return null;\r
-        }\r
-\r
-        /// <summary>\r
-        /// GetSource </summary>\r
-        /// <param name="mediastream"> media stream</param>\r
-        /// <returns>PlayerSource</returns>\r
-        public static PlayerSource GetSource(MediaStream mediaStream)\r
-        {\r
-            return null;\r
-        }\r
-    }\r
-}\r
index 5c412ae..926e33c 100644 (file)
@@ -45,8 +45,10 @@ namespace Tizen.Multimedia
             get
             {
                                string audioCodec, videoCodec;
-                               if (Interop.PlayerInterop.GetCodecInfo (_playerHandle, out audioCodec, out videoCodec) != 0) {
-                                       //throw Exception
+                               int ret = Interop.Player.GetCodecInfo (_playerHandle, out audioCodec, out videoCodec);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get codec info" + (PlayerError)ret);
                                }
                                return audioCodec;
             }
@@ -61,8 +63,10 @@ namespace Tizen.Multimedia
             get
             {
                                int duration;
-                               if (Interop.PlayerInterop.GetDuration (_playerHandle, out duration) != 0) {
-                                       //throw Exception
+                               int ret = Interop.Player.GetDuration (_playerHandle, out duration);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get duration info" + (PlayerError)ret);
                                }
                 return duration;
             }
@@ -77,8 +81,10 @@ namespace Tizen.Multimedia
             get
             {
                                int sampleRate, channels, bitRate;
-                               if( Interop.PlayerInterop.GetAudioStreamInfo(_playerHandle, out sampleRate, out channels, out bitRate) != 0) {
-                                       //throw Exception;
+                               int ret = Interop.Player.GetAudioStreamInfo (_playerHandle, out sampleRate, out channels, out bitRate);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get audio stream info" + (PlayerError)ret);
                                }
                                return sampleRate;
             }
@@ -93,8 +99,10 @@ namespace Tizen.Multimedia
             get
             {
                                int sampleRate, channels, bitRate;
-                               if( Interop.PlayerInterop.GetAudioStreamInfo(_playerHandle, out sampleRate, out channels, out bitRate) != 0) {
-                                       //throw Exception;
+                               int ret = Interop.Player.GetAudioStreamInfo (_playerHandle, out sampleRate, out channels, out bitRate);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get audio channels info" + (PlayerError)ret);
                                }
                                return channels;
             }
@@ -109,8 +117,10 @@ namespace Tizen.Multimedia
             get
             {
                                int sampleRate, channels, bitRate;
-                               if( Interop.PlayerInterop.GetAudioStreamInfo(_playerHandle, out sampleRate, out channels, out bitRate) != 0) {
-                                       //throw Exception;
+                               int ret = Interop.Player.GetAudioStreamInfo (_playerHandle, out sampleRate, out channels, out bitRate);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get audio bitrate info" + (PlayerError)ret);
                                }
                                return bitRate;
             }
@@ -126,8 +136,10 @@ namespace Tizen.Multimedia
             get
             {
                                string audioCodec, videoCodec;
-                               if (Interop.PlayerInterop.GetCodecInfo (_playerHandle, out audioCodec, out videoCodec) != 0) {
-                                       //throw Exception
+                               int ret = Interop.Player.GetCodecInfo (_playerHandle, out audioCodec, out videoCodec);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get video codec info" + (PlayerError)ret);
                                }
                                return videoCodec;
             }
@@ -142,8 +154,10 @@ namespace Tizen.Multimedia
             get
             {
                                int fps, bitRate;
-                               if (Interop.PlayerInterop.GetVideoStreamInfo (_playerHandle, out fps, out bitRate) != 0) {
-                                       //throw Exception;
+                               int ret = Interop.Player.GetVideoStreamInfo (_playerHandle, out fps, out bitRate);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get video fps info" + (PlayerError)ret);
                                }
                                return fps;
             }
@@ -158,8 +172,10 @@ namespace Tizen.Multimedia
             get
             {
                                int fps, bitRate;
-                               if (Interop.PlayerInterop.GetVideoStreamInfo (_playerHandle, out fps, out bitRate) != 0) {
-                                       //throw Exception;
+                               int ret = Interop.Player.GetVideoStreamInfo (_playerHandle, out fps, out bitRate);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get video bitrate info" + (PlayerError)ret);
                                }
                                return bitRate;
             }
@@ -174,8 +190,10 @@ namespace Tizen.Multimedia
             get
             {
                                int height, width;
-                               if (Interop.PlayerInterop.GetVideoSize (_playerHandle, out width, out height) != 0) {
-                                       //throw Exception;
+                               int ret = Interop.Player.GetVideoSize (_playerHandle, out width, out height);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get video height" + (PlayerError)ret);
                                }
                                return height;
             }
@@ -190,8 +208,10 @@ namespace Tizen.Multimedia
             get
             {
                                int height, width;
-                               if (Interop.PlayerInterop.GetVideoSize (_playerHandle, out width, out height) != 0) {
-                                       //throw Exception;
+                               int ret = Interop.Player.GetVideoSize (_playerHandle, out width, out height);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Failed to get video width" + (PlayerError)ret);
                                }
                                return width;
             }
index 26b9ecf..4aaa67b 100644 (file)
@@ -23,21 +23,158 @@ namespace Tizen.Multimedia
     /// </remarks>
     public class StreamingConfiguration
     {
-        /// <summary>
+               private EventHandler<BufferingProgressEventArgs> _bufferingProgress;
+               private Interop.Player.BufferingProgressCallback _bufferingProgressCallback;
+
+               private EventHandler<ProgressiveDownloadMessageEventArgs> _pdMessage;
+               private Interop.Player.ProgressiveDownloadMessageCallback _pdMessageCallback;
+
+               private EventHandler<VideoStreamEventArgs> _videoStreamChanged;
+               private Interop.Player.VideoStreamChangedCallback _videoStreamChangedCallback;
+
+               /// <summary>
         /// BufferingProgressChanged event is raised when there is a change in the buffering status of a media stream
         /// </summary>
-        public event EventHandler<BufferingProgressEventArgs> BufferingProgressChanged;
+        public event EventHandler<BufferingProgressEventArgs> BufferingProgressChanged
+               {
+                       add
+                       {
+                               if(_bufferingProgress == null) {
+                                       RegisterBufferingProgressEvent ();
+                               }
+                               _bufferingProgress += value;
+                       }
+                       remove
+                       {
+                               _bufferingProgress -= value;
+                               if (_bufferingProgress == null) {
+                                       UnregisterBufferingProgressEvent ();
+                               }
+                       }
+               }
+
+               private void RegisterBufferingProgressEvent()
+               {
+                       _bufferingProgressCallback = (int percent, IntPtr userData) =>
+                       {
+                               BufferingProgressEventArgs eventArgs = new BufferingProgressEventArgs(percent);
+                               _bufferingProgress.Invoke(this, eventArgs);
+                       };
+
+                       int ret = Interop.Player.SetBufferingCb (_playerHandle, _bufferingProgressCallback, IntPtr.Zero);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Setting Buffering callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Setting Buffering callback failed"); 
+                       }
+
+               }
+
+               private void UnregisterBufferingProgressEvent()
+               {
+                       int ret = Interop.Player.UnsetBufferingCb (_playerHandle);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Unsetting Buffering callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Unsetting Buffering callback failed"); 
+                       }
+
+               }
+
 
         /// <summary>
         /// ProgressiveDownloadMessageChanged event is raised when progressive download is started or completed. 
         /// </summary>
-        public event EventHandler<ProgressiveDownloadMessageEventArgs> ProgressiveDownloadMessageChanged;
+        public event EventHandler<ProgressiveDownloadMessageEventArgs> ProgressiveDownloadMessageChanged
+               {
+                       add
+                       {
+                               if(_pdMessage == null) {
+                                       RegisterProgressiveDownloadMessageEvent();
+                               }
+                               _pdMessage += value;
+                       }
+                       remove
+                       {
+                               _pdMessage -= value;
+                               if (_pdMessage == null) {
+                                       UnregisterProgressiveDownloadMessageEvent ();
+                               }
+                       }
+               }
+
+               private void RegisterProgressiveDownloadMessageEvent()
+               {
+                       _pdMessageCallback = (int type, IntPtr userData) =>
+                       {
+                               ProgressiveDownloadMessageEventArgs eventArgs = new ProgressiveDownloadMessageEventArgs((ProgressiveDownloadMessage)type);
+                               _pdMessage.Invoke(this, eventArgs);
+                       };
+                       int ret = Interop.Player.SetProgressiveDownloadMessageCb (_playerHandle, _pdMessageCallback, IntPtr.Zero);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Setting progressive download callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Setting progressive download callback failed"); 
+                       }
+               }
+
+               private void UnregisterProgressiveDownloadMessageEvent()
+               {
+                       int ret = Interop.Player.UnsetProgressiveDownloadMessageCb (_playerHandle);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Unsetting progressive download callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Unsetting progressive download callback failed"); 
+                       }
+
+               }
+
 
         /// <summary>
         /// Video stream changed event is raised to notify the video stream changed. 
         /// </summary>
-        public event EventHandler<VideoStreamEventArgs> VideoStreamChanged;
+        public event EventHandler<VideoStreamEventArgs> VideoStreamChanged
+               {
+                       add
+                       {
+                               if(_videoStreamChanged == null) {
+                                       RegisterVideoStreamChangedEvent();
+                               }
+                               _videoStreamChanged += value;
+                       }
+                       remove
+                       {
+                               _videoStreamChanged -= value;
+                               if (_videoStreamChanged == null) {
+                                       UnregisterVideoStreamChanged ();
+                               }
+                       }
+               }
+
+               private void RegisterVideoStreamChangedEvent()
+               {
+                       _videoStreamChangedCallback = (int width, int height, int fps, int bitrate, IntPtr userData) =>
+                       {
+                               VideoStreamEventArgs eventArgs = new VideoStreamEventArgs(height, width, fps, bitrate);
+                               _videoStreamChanged.Invoke(this, eventArgs);
+                       };
+                       int ret = Interop.Player.SetVideoStreamChangedCb (_playerHandle, _videoStreamChangedCallback, IntPtr.Zero);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Setting video stream changed callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Setting video stream changed callback failed"); 
+                       }
+               }
 
+               private void UnregisterVideoStreamChanged()
+               {
+                       int ret = Interop.Player.UnsetVideoStreamChangedCb (_playerHandle);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Unsetting video stream changed callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Unsetting video stream changed callback failed"); 
+                       }
+               }
 
         /// <summary>
         /// Set/Get Progressive download path.
@@ -47,8 +184,11 @@ namespace Tizen.Multimedia
                { 
                        set
                        {
-                               if (Interop.PlayerInterop.SetProgressiveDownloadPath (_playerHandle, value) != 0) {
-                                       // throw Exception
+                               int ret = Interop.Player.SetProgressiveDownloadPath (_playerHandle, value);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Setting progressive download path failed" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "Setting progressive download path failed"); 
                                }
                                _progressiveDownloadPath = value;
                        }
@@ -67,9 +207,15 @@ namespace Tizen.Multimedia
             get
             {
                                DownloadProgress progress = new DownloadProgress();
-                               if (Interop.PlayerInterop.GetStreamingDownloadProgress (_playerHandle, out progress.Start, out progress.Current) != 0) {
-                                       // throw Exception;
+                               int start, current;
+                               int ret = Interop.Player.GetStreamingDownloadProgress (_playerHandle, out start, out current);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Getting download progress failed" + (PlayerError)ret);
                                }
+
+                               progress.Start = start;
+                               progress.Current = current;
                                return progress;
             }
         }
@@ -96,8 +242,11 @@ namespace Tizen.Multimedia
                {
                        set
                        {
-                               if (Interop.PlayerInterop.SetStreamingCookie (_playerHandle, value, value.Length + 1) != 0) {
-                                       // throw Exception
+                               int ret = Interop.Player.SetStreamingCookie (_playerHandle, value, value.Length + 1);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Setting cookie failed" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "Setting cookie failed"); 
                                }
                                _cookie = value;
                        }
@@ -115,8 +264,11 @@ namespace Tizen.Multimedia
                {
                        set
                        {
-                               if (Interop.PlayerInterop.SetStreamingUserAgent (_playerHandle, value, value.Length + 1) != 0) {
-                                       // throw Exception
+                               int ret = Interop.Player.SetStreamingUserAgent (_playerHandle, value, value.Length + 1);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Setting user agent failed" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "Setting user agent failed"); 
                                }
                                _userAgent = value;
                        }
index 37feb9a..50ae0e4 100644 (file)
@@ -23,10 +23,56 @@ namespace Tizen.Multimedia
     /// </remarks>
     public class Subtitle
     {
+
+               private EventHandler<SubtitleUpdatedEventArgs> _subtitleUpdated;
+               private Interop.Player.SubtitleUpdatedCallback _subtitleUpdatedCallback;
+
         /// <summary>
         /// Subtitle event is raised when the subtitle is updated
         /// </summary>
-        public event EventHandler<SubtitleUpdatedEventArgs> Updated;
+        public event EventHandler<SubtitleUpdatedEventArgs> Updated
+               {
+                       add
+                       {
+                               if(_subtitleUpdated == null) {
+                                       RegisterSubtitleUpdatedEvent ();
+                               }
+                               _subtitleUpdated += value;
+                       }
+                       remove
+                       {
+                               _subtitleUpdated -= value;
+                               if (_subtitleUpdated == null) {
+                                       UnregisterSubtitleUpdatedEvent ();
+                               }
+                       }
+               }
+
+               private void RegisterSubtitleUpdatedEvent()
+               {
+                       _subtitleUpdatedCallback = (ulong duration, string text, IntPtr userData) =>
+                       {
+                               SubtitleUpdatedEventArgs eventArgs = new SubtitleUpdatedEventArgs(duration, text);
+                               _subtitleUpdated.Invoke(this, eventArgs);
+                       };
+                       int ret = Interop.Player.SetSubtitleUpdatedCb (_playerHandle, _subtitleUpdatedCallback, IntPtr.Zero);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Setting subtitle updated callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Setting subtitle updated callback failed"); 
+                       }
+
+               }
+
+               private void UnregisterSubtitleUpdatedEvent()
+               {
+                       int ret = Interop.Player.UnsetSubtitleUpdatedCb (_playerHandle);
+                       if (ret != (int)PlayerError.None) 
+                       {
+                               Log.Error (PlayerLog.LogTag, "Unsetting subtitle updated callback failed" + (PlayerError)ret);
+                               PlayerErrorFactory.ThrowException (ret, "Unsetting subtitle updated callback failed"); 
+                       }
+               }
 
 
         /// <summary>
@@ -37,8 +83,11 @@ namespace Tizen.Multimedia
                { 
                        set
                        {
-                               if (Interop.PlayerInterop.SetSubtitlePositionOffset (_playerHandle, value) != 0) {
-                                       // throw Exception
+                               int ret = Interop.Player.SetSubtitlePositionOffset (_playerHandle, value);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Setting position offset failed" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "Setting position offset failed"); 
                                }
                        }
                }
@@ -53,9 +102,13 @@ namespace Tizen.Multimedia
                        get
                        {
                                string langCode;
-                               foreach (SubtitleTrack t in _textTrack) {
-                                       if (Interop.PlayerInterop.GetTrackLanguageCode (_playerHandle, (int)StreamType.Text, _textTrack.IndexOf (t), out langCode) != 0) {
-                                               // throw Exception
+                               int ret;
+                               foreach (SubtitleTrack t in _textTrack) 
+                               {
+                                       ret = Interop.Player.GetTrackLanguageCode (_playerHandle, (int)StreamType.Text, _textTrack.IndexOf (t), out langCode);
+                                       if (ret != (int)PlayerError.None) 
+                                       {
+                                               Log.Error (PlayerLog.LogTag, "Getting text track language code failed" + (PlayerError)ret);
                                        }
                                        t.LanguageCode = langCode;
                                }
@@ -76,9 +129,12 @@ namespace Tizen.Multimedia
                        get
                        {
                                string langCode;
-                               foreach (SubtitleTrack t in _audioTrack) {
-                                       if (Interop.PlayerInterop.GetTrackLanguageCode (_playerHandle, (int)StreamType.Audio, _audioTrack.IndexOf (t), out langCode) != 0) {
-                                               // throw Exception
+                               foreach (SubtitleTrack t in _audioTrack) 
+                               {
+                                       int ret = Interop.Player.GetTrackLanguageCode (_playerHandle, (int)StreamType.Audio, _audioTrack.IndexOf (t), out langCode);
+                                       if (ret != (int)PlayerError.None) 
+                                       {
+                                               Log.Error (PlayerLog.LogTag, "Getting audio track language code failed" + (PlayerError)ret);
                                        }
                                        t.LanguageCode = langCode;
                                }
@@ -99,9 +155,13 @@ namespace Tizen.Multimedia
                        get
                        {
                                string langCode;
-                               foreach (SubtitleTrack t in _videoTrack) {
-                                       if (Interop.PlayerInterop.GetTrackLanguageCode (_playerHandle, (int)StreamType.Video, _videoTrack.IndexOf (t), out langCode) != 0) {
-                                               // throw Exception
+                               int ret;
+                               foreach (SubtitleTrack t in _videoTrack) 
+                               {
+                                       ret = Interop.Player.GetTrackLanguageCode (_playerHandle, (int)StreamType.Video, _videoTrack.IndexOf (t), out langCode);
+                                       if (ret != (int)PlayerError.None) 
+                                       {
+                                               Log.Error (PlayerLog.LogTag, "Getting video track language code failed" + (PlayerError)ret);
                                        }
                                        t.LanguageCode = langCode;
                                }
@@ -121,8 +181,11 @@ namespace Tizen.Multimedia
                {
                        set
                        {
-                               if (Interop.PlayerInterop.SetSubtitlePath (_playerHandle, value) != 0) {
-                                       // throw Exception
+                               int ret = Interop.Player.SetSubtitlePath (_playerHandle, value);
+                               if (ret != (int)PlayerError.None) 
+                               {
+                                       Log.Error (PlayerLog.LogTag, "Setting subtitle path failed" + (PlayerError)ret);
+                                       PlayerErrorFactory.ThrowException (ret, "Setting subtitle path failed"); 
                                }
                        }
                }
index 161c6c8..d0665fd 100644 (file)
@@ -25,12 +25,35 @@ namespace Tizen.Multimedia
         /// Get/Set Language code.
         /// </summary>
         /// <value> language code string </value>
-        public string LanguageCode { get; set; }
+        public string LanguageCode 
+               {
+                       set
+                       { 
+                               _languageCode = value;
+                       }
+                       get
+                       {
+                               return _languageCode;
+                       }
+               }
 
         /// <summary>
         /// Get/Set activation status.
         /// </summary>
         /// <value> true, false </value>
-        public bool Activated { get; set; }
+        public bool Activated 
+               {
+                       set
+                       {
+                               _activated = value;
+                       }
+                       get
+                       {
+                               return _activated;
+                       }
+               }
+
+               internal string _languageCode;
+               internal bool _activated;
     }
 }
index fda8511..7d8f8cb 100644 (file)
@@ -46,6 +46,15 @@ namespace Tizen.Multimedia
             }
         }
 
+               /// <summary>
+               /// Constructor.
+               /// </summary>
+               public SubtitleUpdatedEventArgs(ulong duration, string text)
+               {
+                       _duration = duration;
+                       _text = text;
+               }
+
         internal ulong _duration;
         internal string _text;
     }
index faedd1b..c4d86aa 100644 (file)
-/// VideoFrameCapture\r
-///\r
-/// Copyright 2016 by Samsung Electronics, Inc.,\r
-///\r
-/// This software is the confidential and proprietary information\r
-/// of Samsung Electronics, Inc. ("Confidential Information"). You\r
-/// shall not disclose such Confidential Information and shall use\r
-/// it only in accordance with the terms of the license agreement\r
-/// you entered into with Samsung.\r
-\r
-using System;\r
-\r
-namespace Tizen.Multimedia\r
-{\r
-    /// <summary>\r
-    /// VideoFrameCapture\r
-    /// </summary>\r
-    /// <remarks>\r
-    /// VideoSize class provides properties of a captured video frame\r
-    /// </remarks>\r
-    class VideoFrameCapture\r
-    {\r
-\r
-        /// <summary>\r
-        /// Get/Set ImageBuffer.\r
-        /// </summary>\r
-        /// <value> Image buffer </value>\r
-        public byte[] ImageBuffer { set; get; }\r
-\r
-        /// <summary>\r
-        /// Get/Set width.\r
-        /// </summary>\r
-        /// <value> Image width </value>\r
-        public int Width { set; get; }\r
-\r
-        /// <summary>\r
-        /// Get/Set height.\r
-        /// </summary>\r
-        /// <value> Image Height </value>\r
-        public int Height { set; get; }\r
-\r
-        /// <summary>\r
-        /// Get/Set Size.\r
-        /// </summary>\r
-        /// <value> Size of the image </value>\r
-        public uint Size { set; get; }\r
-    }\r
-}\r
+/// VideoFrameCapture
+///
+/// Copyright 2016 by Samsung Electronics, Inc.,
+///
+/// This software is the confidential and proprietary information
+/// of Samsung Electronics, Inc. ("Confidential Information"). You
+/// shall not disclose such Confidential Information and shall use
+/// it only in accordance with the terms of the license agreement
+/// you entered into with Samsung.
+
+using System;
+
+namespace Tizen.Multimedia
+{
+    /// <summary>
+    /// VideoFrameCapture
+    /// </summary>
+    /// <remarks>
+    /// VideoSize class provides properties of a captured video frame
+    /// </remarks>
+    public class VideoFrameCapture
+    {
+
+        /// <summary>
+        /// Get/Set ImageBuffer.
+        /// </summary>
+        /// <value> Image buffer </value>
+        public byte[] ImageBuffer 
+               {
+                       set
+                       {
+                               _imageBuffer = value;
+                       }
+                       get
+                       {
+                               return _imageBuffer;
+                       }
+               }
+
+        /// <summary>
+        /// Get/Set width.
+        /// </summary>
+        /// <value> Image width </value>
+        public int Width 
+               {
+                       set
+                       {
+                               _width = value;
+                       }
+                       get
+                       {
+                               return _width;
+                       }
+               }
+
+        /// <summary>
+        /// Get/Set height.
+        /// </summary>
+        /// <value> Image Height </value>
+        public int Height 
+               {
+                       set
+                       {
+                               _height = value;
+                       }
+                       get
+                       {
+                               return _height;
+                       }
+               }
+
+        /// <summary>
+        /// Get/Set Size.
+        /// </summary>
+        /// <value> Size of the image </value>
+        public uint Size 
+               {
+                       set
+                       {
+                               _size = value;
+                       }
+                       get
+                       {
+                               return _size;
+                       }
+               }
+
+               /// <summary>
+               /// Constructor
+               /// </summary>
+               public VideoFrameCapture(byte[] imageBuffer, int width, int height, uint size)
+               {
+                       _imageBuffer = imageBuffer;
+                       _width = width;
+                       _height = height;
+                       _size = size;
+               }
+
+
+               internal byte[] _imageBuffer;
+               internal int _width;
+               internal int _height;
+               internal uint _size;
+    }
+}
index 32bb917..9934968 100644 (file)
@@ -22,6 +22,7 @@ namespace Tizen.Multimedia
     /// </remarks>
     public class VideoFrameDecodedEventArgs : EventArgs
     {
+               // TODO: uncomment when MediaPacket is implemented.
         /// <summary>
         /// Get the Image buffer.
         /// </summary>
index 5acace6..8d9ba73 100644 (file)
@@ -70,6 +70,17 @@ namespace Tizen.Multimedia
             }
         }
 
+               /// <summary>
+               /// Constructor.
+               /// </summary>
+               public VideoStreamEventArgs(int height, int width, int fps, int bitrate)
+               {
+                       _height = height;
+                       _width = width;
+                       _fps = fps;
+                       _bitrate = bitrate;
+               }
+
         internal int _height;
         internal int _width;
         internal int _fps;
index 599bce0..48a7b38 100644 (file)
@@ -9,11 +9,9 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>\r
     <RootNamespace>Tizen.Multimedia</RootNamespace>\r
     <AssemblyName>Tizen.Multimedia</AssemblyName>\r
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
     <FileAlignment>512</FileAlignment>\r
     <TargetFrameworkProfile />\r
-    <ProductVersion>8.0.30703</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
     <DebugSymbols>true</DebugSymbols>\r
@@ -52,8 +50,6 @@
     <Compile Include="Player\PlayerEnums.cs" />\r
     <Compile Include="Player\MediaStream.cs" />\r
     <Compile Include="Player\MediaStreamConfiguration.cs" />\r
-    <Compile Include="Player\PlayerSource.cs" />\r
-    <Compile Include="Player\SourceFactory.cs" />\r
     <Compile Include="Player\SubtitleTrack.cs" />\r
     <Compile Include="Player\AudioEffect.cs" />\r
     <Compile Include="Player\BufferingProgressChangedEventArgs.cs" />\r
@@ -82,6 +78,7 @@
     <Compile Include="Player\MediaBufferSource.cs" />\r
     <Compile Include="Player\MediaStreamSource.cs" />\r
     <Compile Include="Interop\Interop.Libraries.cs" />\r
+    <Compile Include="Player\PlayerErrorFactory.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="Tizen.Multimedia.snk" />\r
   <Target Name="AfterBuild">\r
   </Target>\r
   -->\r
+  <ItemGroup>\r
+    <ProjectReference Include="..\..\tizen\Tizen\Tizen.csproj">\r
+      <Project>{7659CA59-410D-41A1-9841-586E88BC78C9}</Project>\r
+      <Name>Tizen</Name>\r
+    </ProjectReference>\r
+    <ProjectReference Include="..\..\tizen\Tizen.Internals\Tizen.Internals.csproj">\r
+      <Project>{B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}</Project>\r
+      <Name>Tizen.Internals</Name>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
 </Project>
\ No newline at end of file
index 30de9b9..b6c4950 100644 (file)
@@ -1,12 +1,26 @@
 <Properties>
   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="Player/Player.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="Player/PlayerErrorFactory.cs">
     <Files>
       <File FileName="Player/Player.cs" Line="1" Column="1" />
+      <File FileName="Interop/Interop.Player.cs" Line="1" Column="1" />
+      <File FileName="Player/SubtitleUpdatedEventArgs.cs" Line="1" Column="1" />
+      <File FileName="Player/VideoFrameDecodedEventArgs.cs" Line="1" Column="1" />
+      <File FileName="Player/StreamingConfiguration.cs" Line="1" Column="1" />
+      <File FileName="Player/ProgressiveDownloadMessageEventArgs.cs" Line="1" Column="1" />
+      <File FileName="Player/Subtitle.cs" Line="1" Column="1" />
+      <File FileName="Player/PlayerEnums.cs" Line="1" Column="1" />
+      <File FileName="Player/PlayerErrorFactory.cs" Line="15" Column="29" />
+      <File FileName="Player/MediaStreamSource.cs" Line="1" Column="1" />
+      <File FileName="Player/MediaBufferSource.cs" Line="1" Column="1" />
+      <File FileName="Player/MediaUriSource.cs" Line="1" Column="1" />
     </Files>
   </MonoDevelop.Ide.Workbench>
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
     <BreakpointStore />
   </MonoDevelop.Ide.DebuggingService.Breakpoints>
   <MonoDevelop.Ide.DebuggingService.PinnedWatches />
+  <DisabledProjects>
+    <String>../../tizen/Tizen.Internals/Tizen.Internals.csproj</String>
+  </DisabledProjects>
 </Properties>
\ No newline at end of file