From 794506889c03e37aa2605bc30fe56c8f0dbdd0ee Mon Sep 17 00:00:00 2001 From: Ravi Kiran K N Date: Wed, 11 May 2016 16:16:12 +0530 Subject: [PATCH] Patch set 3: Reorgnanized the Multimedia folder structure Included implementation for subtitle audioeffect Change-Id: I6c48b557c517bd6e31503c59609a676d15ce6fbe Signed-off-by: Ravi Kiran K N --- .gitignore | 5 + Makefile | 24 ++ packaging/csapi-tizen.multimedia.manifest | 6 + packaging/csapi-tizen.multimedia.pc.in | 6 + packaging/csapi-tizen.multimedia.spec | 67 ++++ src/Tizen.Multimedia/Interop/Interop.Libraries.cs | 10 + src/Tizen.Multimedia/Interop/Interop.Player.cs | 262 +++++++++++++ src/Tizen.Multimedia/Player/AudioEffect.cs | 104 +++++ .../Player/BufferStatusEventArgs.cs | 54 +++ .../Player/BufferingProgressChangedEventArgs.cs | 40 ++ src/Tizen.Multimedia/Player/Display.cs | 102 +++++ src/Tizen.Multimedia/Player/DownloadProgress.cs | 37 ++ src/Tizen.Multimedia/Player/EqualizerBand.cs | 58 +++ src/Tizen.Multimedia/Player/MediaBufferSource.cs | 12 + src/Tizen.Multimedia/Player/MediaSource.cs | 21 + src/Tizen.Multimedia/Player/MediaStream.cs | 76 ++++ .../Player/MediaStreamConfiguration.cs | 48 +++ src/Tizen.Multimedia/Player/MediaStreamSource.cs | 55 +++ src/Tizen.Multimedia/Player/MediaUriSource.cs | 15 + .../Player/PlaybackCompletedEventArgs.cs | 26 ++ .../Player/PlaybackErrorEventArgs.cs | 40 ++ .../Player/PlaybackInterruptedEventArgs.cs | 39 ++ src/Tizen.Multimedia/Player/Player.cs | 430 +++++++++++++++++++++ src/Tizen.Multimedia/Player/PlayerContentInfo.cs | 132 +++++++ src/Tizen.Multimedia/Player/PlayerEnums.cs | 272 +++++++++++++ src/Tizen.Multimedia/Player/PlayerSource.cs | 10 + .../Player/ProgressiveDownloadMessageEventArgs.cs | 40 ++ .../Player/ProgressiveDownloadStatus.cs | 37 ++ src/Tizen.Multimedia/Player/SeekOffsetEventArgs.cs | 40 ++ src/Tizen.Multimedia/Player/SourceFactory.cs | 51 +++ src/Tizen.Multimedia/Player/StreamInformation.cs | 217 +++++++++++ .../Player/StreamingConfiguration.cs | 137 +++++++ src/Tizen.Multimedia/Player/Subtitle.cs | 136 +++++++ src/Tizen.Multimedia/Player/SubtitleTrack.cs | 36 ++ .../Player/SubtitleUpdatedEventArgs.cs | 52 +++ src/Tizen.Multimedia/Player/VideoFrameCapture.cs | 48 +++ .../Player/VideoFrameDecodedEventArgs.cs | 39 ++ .../Player/VideoStreamEventArgs.cs | 78 ++++ src/Tizen.Multimedia/Properties/AssemblyInfo.cs | 36 ++ src/Tizen.Multimedia/Tizen.Multimedia.csproj | 98 +++++ src/Tizen.Multimedia/Tizen.Multimedia.sln | 17 + src/Tizen.Multimedia/Tizen.Multimedia.snk | Bin 0 -> 596 bytes src/Tizen.Multimedia/Tizen.Multimedia.userprefs | 12 + 43 files changed, 3025 insertions(+) create mode 100644 .gitignore create mode 100755 Makefile create mode 100644 packaging/csapi-tizen.multimedia.manifest create mode 100644 packaging/csapi-tizen.multimedia.pc.in create mode 100644 packaging/csapi-tizen.multimedia.spec create mode 100644 src/Tizen.Multimedia/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia/Interop/Interop.Player.cs create mode 100644 src/Tizen.Multimedia/Player/AudioEffect.cs create mode 100644 src/Tizen.Multimedia/Player/BufferStatusEventArgs.cs create mode 100644 src/Tizen.Multimedia/Player/BufferingProgressChangedEventArgs.cs create mode 100644 src/Tizen.Multimedia/Player/Display.cs create mode 100644 src/Tizen.Multimedia/Player/DownloadProgress.cs create mode 100644 src/Tizen.Multimedia/Player/EqualizerBand.cs create mode 100644 src/Tizen.Multimedia/Player/MediaBufferSource.cs create mode 100644 src/Tizen.Multimedia/Player/MediaSource.cs create mode 100644 src/Tizen.Multimedia/Player/MediaStream.cs create mode 100644 src/Tizen.Multimedia/Player/MediaStreamConfiguration.cs create mode 100644 src/Tizen.Multimedia/Player/MediaStreamSource.cs create mode 100644 src/Tizen.Multimedia/Player/MediaUriSource.cs create mode 100644 src/Tizen.Multimedia/Player/PlaybackCompletedEventArgs.cs create mode 100644 src/Tizen.Multimedia/Player/PlaybackErrorEventArgs.cs create mode 100644 src/Tizen.Multimedia/Player/PlaybackInterruptedEventArgs.cs create mode 100644 src/Tizen.Multimedia/Player/Player.cs create mode 100644 src/Tizen.Multimedia/Player/PlayerContentInfo.cs create mode 100644 src/Tizen.Multimedia/Player/PlayerEnums.cs create mode 100644 src/Tizen.Multimedia/Player/PlayerSource.cs create mode 100644 src/Tizen.Multimedia/Player/ProgressiveDownloadMessageEventArgs.cs create mode 100644 src/Tizen.Multimedia/Player/ProgressiveDownloadStatus.cs create mode 100644 src/Tizen.Multimedia/Player/SeekOffsetEventArgs.cs create mode 100644 src/Tizen.Multimedia/Player/SourceFactory.cs create mode 100644 src/Tizen.Multimedia/Player/StreamInformation.cs create mode 100644 src/Tizen.Multimedia/Player/StreamingConfiguration.cs create mode 100644 src/Tizen.Multimedia/Player/Subtitle.cs create mode 100644 src/Tizen.Multimedia/Player/SubtitleTrack.cs create mode 100644 src/Tizen.Multimedia/Player/SubtitleUpdatedEventArgs.cs create mode 100644 src/Tizen.Multimedia/Player/VideoFrameCapture.cs create mode 100644 src/Tizen.Multimedia/Player/VideoFrameDecodedEventArgs.cs create mode 100644 src/Tizen.Multimedia/Player/VideoStreamEventArgs.cs create mode 100644 src/Tizen.Multimedia/Properties/AssemblyInfo.cs create mode 100644 src/Tizen.Multimedia/Tizen.Multimedia.csproj create mode 100644 src/Tizen.Multimedia/Tizen.Multimedia.sln create mode 100644 src/Tizen.Multimedia/Tizen.Multimedia.snk create mode 100644 src/Tizen.Multimedia/Tizen.Multimedia.userprefs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2d84266 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +bin/ +obj/ +*.exe +*.dll + diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..0f81d1a --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +ASM_DIRS := Tizen.Multimedia +ASM_DLLS := $(addsuffix .dll,$(ASM_DIRS)) + +FLAGS := /unsafe + +ALL: $(ASM_DLLS) + +define make-dll +$(eval ASM = $(strip $1)) +$(eval SRC = $(shell find $(ASM) -path $(ASM)/obj -prune -o -name '*.cs' -print)) +$(eval PKG = $(shell echo $2 | tr ' ' ',')) +$(ASM).dll: $(SRC) + @echo "[BUILD] $$@" + @mcs /nologo /out:$$@ /t:library /keyfile:$(ASM)/$(ASM).snk $(addprefix /pkg:,$(PKG)) $(FLAGS) $(SRC) + @echo "[CHECK] $$@" + @RET=`mono-shlib-cop $$@`; \ + CNT=`echo $$$$RET | grep -e '^error:' | wc -l`; \ + if [ $$$$CNT -gt 0 ]; then echo $$$$RET; rm -f $$@ exit 1; fi +endef + +$(eval $(call make-dll, Tizen.Multimedia, csapi-tizen)) + +clean: + @rm -f $(ASM_DLLS) diff --git a/packaging/csapi-tizen.multimedia.manifest b/packaging/csapi-tizen.multimedia.manifest new file mode 100644 index 0000000..41a9320 --- /dev/null +++ b/packaging/csapi-tizen.multimedia.manifest @@ -0,0 +1,6 @@ + + + + + + diff --git a/packaging/csapi-tizen.multimedia.pc.in b/packaging/csapi-tizen.multimedia.pc.in new file mode 100644 index 0000000..81a95f5 --- /dev/null +++ b/packaging/csapi-tizen.multimedia.pc.in @@ -0,0 +1,6 @@ +Name: csapi-tizen.multimedia +Description: Tizen Multimedia API for C# +Version: @version@ +Libs: -r:@dllpath@/@dllname@ +Requires: + diff --git a/packaging/csapi-tizen.multimedia.spec b/packaging/csapi-tizen.multimedia.spec new file mode 100644 index 0000000..3d470e6 --- /dev/null +++ b/packaging/csapi-tizen.multimedia.spec @@ -0,0 +1,67 @@ +%define dllpath %{_libdir}/mono/tizen +%define dllname Tizen.Multimedia.dll +Name: csapi-tizen.multimedia +Summary: Tizen Multimedia API for C# +Version: 1.0.0 +Release: 1 +Group: Development/Libraries +License: Apache-2.0 +URL: https://www.tizen.org +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.manifest +Source2: %{name}.pc.in +# TODO: replace mono-compiler, mono-devel to mcs, mono-shlib-cop +BuildRequires: mono-compiler +BuildRequires: mono-devel +#BuildRequires: mcs +#BuildRequires: mono-shlib-cop +# TODO: replace mono-core to gacutil. +# mono-core should provide the symbol 'gacutil' +Requires(post): mono-core +Requires(postun): mono-core +# P/Invoke Dependencies +BuildRequires: pkgconfig(capi-media-player) +# P/Invoke Runtime Dependencies +# TODO: It should be removed after fix tizen-rpm-config +#Requires: capi-multimedia-device +# DLL Dependencies +#BuildRequires: ... +%description +Tizen Multimedia API for C# +%package devel +Summary: Development package for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +%description devel +Development package for %{name} +%prep +%setup -q +cp %{SOURCE1} . +%build +# build dll +mcs -target:library -out:%{dllname} -keyfile:Tizen.Multimedia/Tizen.Multimedia.snk \ + Tizen.Multimedia/Properties/AssemblyInfo.cs \ + Tizen.Multimedia/Player/*.cs \ + Tizen.Multimedia/Interop/*.cs +# check p/invoke +if [ -x %{dllname} ]; then + RET=`mono-shlib-cop %{dllname}`; \ + CNT=`echo $RET | grep -E "^error:" | wc -l`; \ + if [ $CNT -gt 0 ]; then exit 1; fi +fi +%install +# copy dll +mkdir -p %{buildroot}%{dllpath} +install -p -m 644 %{dllname} %{buildroot}%{dllpath} +# generate pkgconfig +mkdir -p %{buildroot}%{_libdir}/pkgconfig +sed -e "s#@version@#%{version}#g" \ + -e "s#@dllpath@#%{dllpath}#g" \ + -e "s#@dllname@#%{dllname}#g" \ + %{SOURCE2} > %{buildroot}%{_libdir}/pkgconfig/%{name}.pc +%post +gacutil -i %{dllpath}/%{dllname} +%files +%{dllpath}/%{dllname} +%files devel +%{_libdir}/pkgconfig/%{name}.pc diff --git a/src/Tizen.Multimedia/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..76c1eba --- /dev/null +++ b/src/Tizen.Multimedia/Interop/Interop.Libraries.cs @@ -0,0 +1,10 @@ + +using System; + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Player = "libcapi-media-player.so.0"; + } +} diff --git a/src/Tizen.Multimedia/Interop/Interop.Player.cs b/src/Tizen.Multimedia/Interop/Interop.Player.cs new file mode 100644 index 0000000..c693e3b --- /dev/null +++ b/src/Tizen.Multimedia/Interop/Interop.Player.cs @@ -0,0 +1,262 @@ +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class PlayerInterop + { + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaTagCallback(IntPtr tagHandle, IntPtr UserData); + + [DllImport(Libraries.Player, EntryPoint = "player_create")] + internal static extern int Create(out IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_destroy")] + internal static extern int Destroy(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_prepare")] + internal static extern int Prepare(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_unprepare")] + internal static extern int Unprepare(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_uri")] + internal static extern int SetUri(IntPtr player, string uri); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display")] + internal static extern int SetDisplay(IntPtr player, int type, IntPtr display); + + [DllImport(Libraries.Player, EntryPoint = "player_start")] + internal static extern int Start(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_stop")] + internal static extern int Stop(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_pause")] + internal static extern int Pause(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_memory_buffer")] + internal static extern int SetMemoryBuffer(IntPtr player, IntPtr data, int size); + + [DllImport(Libraries.Player, EntryPoint = "player_get_state")] + internal static extern int GetState(IntPtr player, out int state); + + [DllImport(Libraries.Player, EntryPoint = "player_set_volume")] + internal static extern int SetVolume(IntPtr player, float left, float right); + + [DllImport(Libraries.Player, EntryPoint = "player_get_volume")] + internal static extern int GetVolume(IntPtr player, out float left, out float right); + + [DllImport(Libraries.Player, EntryPoint = "player_set_sound_type")] + internal static extern int SetSoundType(IntPtr player, int type); + + [DllImport(Libraries.Player, EntryPoint = "player_set_audio_policy_info")] + internal static extern int SetAudioPolicyInfo(IntPtr player, IntPtr stream_info); + + [DllImport(Libraries.Player, EntryPoint = "player_set_audio_latency_mode")] + internal static extern int SetAudioLatencyMode(IntPtr player, int latency_mode); + + [DllImport(Libraries.Player, EntryPoint = "player_get_audio_latency_mode")] + internal static extern int GetAudioLatencyMode(IntPtr player, out int latency_mode); + + [DllImport(Libraries.Player, EntryPoint = "player_get_play_position")] + internal static extern int GetPlayPosition(IntPtr player, out int millisecond); + + [DllImport(Libraries.Player, EntryPoint = "player_set_mute")] + internal static extern int SetMute(IntPtr player, bool muted); + + [DllImport(Libraries.Player, EntryPoint = "player_is_muted")] + internal static extern int IsMuted(IntPtr player, out bool muted); + + [DllImport(Libraries.Player, EntryPoint = "player_set_looping")] + internal static extern int SetLooping(IntPtr player, bool looping); + + [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_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_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_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_set_media_packet_video_frame_decoded_cb")] + //internal static extern int SetMediaPacketVideoFrameDecodedCb(IntPtr player, player_media_packet_video_decoded_cb callback, IntPtr user_data); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_media_packet_video_frame_decoded_cb")] + internal static extern int UnsetMediaPacketVideoFrameDecodedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_streaming_cookie")] + internal static extern int SetStreamingCookie(IntPtr player, string cookie, int size); + + [DllImport(Libraries.Player, EntryPoint = "player_set_streaming_user_agent")] + internal static extern int SetStreamingUserAgent(IntPtr player, string user_agent, int size); + + [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_unset_buffering_cb")] + internal static extern int UnsetBufferingCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_progressive_download_path")] + internal static extern int SetProgressiveDownloadPath(IntPtr player, string path); + + //[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_unset_progressive_download_message_cb")] + internal static extern int UnsetProgressiveDownloadMessageCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_playback_rate")] + internal static extern int SetPlaybackRate(IntPtr player, float rate); + + [DllImport(Libraries.Player, EntryPoint = "player_push_media_stream")] + internal static extern int PushMediaStream(IntPtr player, IntPtr packet); + + [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_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_unset_media_stream_seek_cb")] + internal static extern int UnsetMediaStreamSeekCb(IntPtr player, int type); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_max_size")] + internal static extern int SetMediaStreamBufferMaxSize(IntPtr player, int type, ulong max_size); + + [DllImport(Libraries.Player, EntryPoint = "player_get_media_stream_buffer_max_size")] + internal static extern int GetMediaStreamBufferMaxSize(IntPtr player, int type, out ulong max_size); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_min_threshold")] + internal static extern int SetMediaStreamBufferMinThreshold(IntPtr player, int type, uint percent); + + [DllImport(Libraries.Player, EntryPoint = "player_get_media_stream_buffer_min_threshold")] + internal static extern int GetMediaStreamBufferMinThreshold(IntPtr player, int type, out uint percent); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_bands_count")] + internal static extern int AudioEffectGetEqualizerBandsCount(IntPtr player, out int count); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_set_equalizer_band_level")] + internal static extern int AudioEffectSetEqualizerBandLevel(IntPtr player, int index, int level); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_level")] + internal static extern int AudioEffectGetEqualizerBandLevel(IntPtr player, int index, out int level); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_set_equalizer_all_bands")] + internal static extern int AudioEffectSetEqualizerAllBands(IntPtr player, out int band_levels, int length); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_level_range")] + internal static extern int AudioEffectGetEqualizerLevelRange(IntPtr player, out int min, out int max); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_frequency")] + internal static extern int AudioEffectGetEqualizerBandFrequency(IntPtr player, int index, out int frequency); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_frequency_range")] + internal static extern int AudioEffectGetEqualizerBandFrequencyRange(IntPtr player, int index, out int range); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_equalizer_clear")] + internal static extern int AudioEffectEqualizerClear(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_equalizer_is_available")] + internal static extern int AudioEffectEqualizerIsAvailable(IntPtr player, out bool available); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display_mode")] + internal static extern int SetDisplayMode(IntPtr player, int mode); + + [DllImport(Libraries.Player, EntryPoint = "player_get_display_mode")] + internal static extern int GetDisplayMode(IntPtr player, out int mode); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display_visible")] + internal static extern int SetDisplayVisible(IntPtr player, bool visible); + + [DllImport(Libraries.Player, EntryPoint = "player_is_display_visible")] + internal static extern int IsDisplayVisible(IntPtr player, out bool visible); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display_rotation")] + internal static extern int SetDisplayRotation(IntPtr player, int rotation); + + [DllImport(Libraries.Player, EntryPoint = "player_get_display_rotation")] + internal static extern int GetDisplayRotation(IntPtr player, out int rotation); + + [DllImport(Libraries.Player, EntryPoint = "player_get_content_info")] + internal static extern int GetContentInfo(IntPtr player, int key, out string value); + + [DllImport(Libraries.Player, EntryPoint = "player_get_codec_info")] + internal static extern int GetCodecInfo(IntPtr player, out string audio_codec, out string video_codec); + + [DllImport(Libraries.Player, EntryPoint = "player_get_audio_stream_info")] + internal static extern int GetAudioStreamInfo(IntPtr player, out int sample_rate, out int channel, out int bit_rate); + + [DllImport(Libraries.Player, EntryPoint = "player_get_video_stream_info")] + internal static extern int GetVideoStreamInfo(IntPtr player, out int fps, out int bit_rate); + + [DllImport(Libraries.Player, EntryPoint = "player_get_album_art")] + internal static extern int GetAlbumArt(IntPtr player, out IntPtr album_art, out int size); + + [DllImport(Libraries.Player, EntryPoint = "player_get_video_size")] + internal static extern int GetVideoSize(IntPtr player, out int width, out int height); + + [DllImport(Libraries.Player, EntryPoint = "player_get_duration")] + internal static extern int GetDuration(IntPtr player, out int duration); + + [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_unset_subtitle_updated_cb")] + internal static extern int UnsetSubtitleUpdatedCb(IntPtr player); + + [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_unset_video_stream_changed_cb")] + internal static extern int UnsetVideoStreamChangedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_get_track_count")] + internal static extern int GetTrackCount(IntPtr player, int type, out int count); + + [DllImport(Libraries.Player, EntryPoint = "player_select_track")] + internal static extern int SelectTrack(IntPtr player, int type, int index); + + [DllImport(Libraries.Player, EntryPoint = "player_get_current_track")] + internal static extern int GetCurrentTrack(IntPtr player, int type, out int index); + + [DllImport(Libraries.Player, EntryPoint = "player_get_track_language_code")] + internal static extern int GetTrackLanguageCode(IntPtr player, int type, int index, out string code); + + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/AudioEffect.cs b/src/Tizen.Multimedia/Player/AudioEffect.cs new file mode 100644 index 0000000..59d7dc9 --- /dev/null +++ b/src/Tizen.Multimedia/Player/AudioEffect.cs @@ -0,0 +1,104 @@ +/// Audio effect +/// +/// 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; +using System.Collections.Generic; + + +namespace Tizen.Multimedia +{ + /// + /// Audio effect + /// + /// + /// This class provides properties and API that are required for setting + /// audio effects of a player. + /// + public class AudioEffect + { + + /// + /// Set/Get Equalizer band level, frequency and range. + /// + /// EqualizerBand + public IList EqualizerBands + { + set + { + _bands = value; + foreach(EqualizerBand band in _bands) + { + if (Interop.PlayerInterop.AudioEffectSetEqualizerBandLevel (_playerHandle, _bands.IndexOf (band), band.Level) != 0) { + // throw Exception; + } + } + + } + get + { + return _bands; + } + } + + /// + /// Get Min level. + /// + /// Minimum level + public int MinLevel + { + get + { + int min, max; + if (Interop.PlayerInterop.AudioEffectGetEqualizerLevelRange (_playerHandle, out min, out max) != 0) { + //throw Exception; + } + return min; + } + } + + /// + /// Get Min level. + /// + /// Maximum level + public int MaxLevel + { + get + { + int min, max; + if (Interop.PlayerInterop.AudioEffectGetEqualizerLevelRange (_playerHandle, out min, out max) != 0) { + //throw Exception; + } + return max; + } + } + + /// + /// Get equalizer avaialbility. + /// + /// true, false + public bool Available + { + get + { + bool available = false; + if (Interop.PlayerInterop.AudioEffectEqualizerIsAvailable (_playerHandle, out available) != 0) { + //throw Exception; + } + return available; + } + } + + + internal IntPtr _playerHandle; + + IList _bands; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/BufferStatusEventArgs.cs b/src/Tizen.Multimedia/Player/BufferStatusEventArgs.cs new file mode 100644 index 0000000..3b2bdeb --- /dev/null +++ b/src/Tizen.Multimedia/Player/BufferStatusEventArgs.cs @@ -0,0 +1,54 @@ +/// This File contains BufferStatusEventArgs class +/// +/// 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 +{ + + /// + /// BufferStatus event arguments + /// + /// + /// BufferStatus event arguments + /// + public class BufferStatusEventArgs : EventArgs + { + + /// + /// Get stream type. + /// + /// Audio, Video, Text + public StreamType StreamType + { + get + { + return _streamType; + } + } + + /// + /// Get buffering status. + /// + /// Underrun, Overflow + public StreamingBufferStatus Status + { + get + { + return _status; + } + } + + internal StreamingBufferStatus _status; + internal StreamType _streamType; + + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/BufferingProgressChangedEventArgs.cs b/src/Tizen.Multimedia/Player/BufferingProgressChangedEventArgs.cs new file mode 100644 index 0000000..752c1fc --- /dev/null +++ b/src/Tizen.Multimedia/Player/BufferingProgressChangedEventArgs.cs @@ -0,0 +1,40 @@ +/// This File contains BufferingProgressChangedEventArgs class +/// +/// 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 +{ + + /// + /// BufferingProgress event arguments + /// + /// + /// BufferingProgress event arguments + /// + public class BufferingProgressEventArgs : EventArgs + { + /// + /// Get buffering percentage. + /// + /// 0 - 100 + public int Percent + { + get + { + return _percent; + } + } + + internal int _percent; + + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/Display.cs b/src/Tizen.Multimedia/Player/Display.cs new file mode 100644 index 0000000..231562d --- /dev/null +++ b/src/Tizen.Multimedia/Player/Display.cs @@ -0,0 +1,102 @@ +/// Display +/// +/// 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 +{ + /// + /// Display + /// + /// + /// This class provides properties and API that are required for setting + /// display configurations of a player. + /// + public class Display + { + + /// + /// Set/Get Display mode. + /// + /// LetterBox, OriginalSize, FullScreen, CroppedFull, OriginalOrFull, DstRoi + public DisplayMode Mode + { + set + { + if (Interop.PlayerInterop.SetDisplayMode (_playerHandle, (int)value) == 0) { + _displayMode = value; + } else { + //throw Exception + } + } + get + { + return _displayMode; + } + } + + /// + /// Set/Get IsVisible. + /// + /// true, false + public bool IsVisible + { + set + { + if (Interop.PlayerInterop.SetDisplayVisible (_playerHandle, value) == 0) { + _isVisible = value; + } else { + //throw Exception + } + } + get + { + return _isVisible; + } + } + + /// + /// Set/Get Display rotation. + /// + /// RotationNone, Rotation90, Rotation180, Rotation270 + public DisplayRotation Rotation + { + set + { + if (Interop.PlayerInterop.SetDisplayRotation (_playerHandle, (int)value) == 0) { + _rotation = value; + } else { + //throw Exception + } + } + get + { + return _rotation; + } + } + + + + /// + /// Constructor - sets video display + /// display type + public Display(DisplayType displayType) + { + } + + + internal IntPtr _playerHandle; + internal DisplayMode _displayMode; + internal bool _isVisible; + internal DisplayRotation _rotation; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/DownloadProgress.cs b/src/Tizen.Multimedia/Player/DownloadProgress.cs new file mode 100644 index 0000000..ee1cc59 --- /dev/null +++ b/src/Tizen.Multimedia/Player/DownloadProgress.cs @@ -0,0 +1,37 @@ +/// Download progress +/// +/// 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 +{ + + /// + /// DownloadProgress + /// + /// + /// Contains Download progress + /// + public class DownloadProgress + { + /// + /// Get Start position in percentage. + /// + /// 0 to 100 + public int Start; + + /// + /// Get Current position in percentage. + /// + /// 0 to 100 + public int Current; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/EqualizerBand.cs b/src/Tizen.Multimedia/Player/EqualizerBand.cs new file mode 100644 index 0000000..13c5d0b --- /dev/null +++ b/src/Tizen.Multimedia/Player/EqualizerBand.cs @@ -0,0 +1,58 @@ +/// Equalizer Band +/// +/// 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 +{ + + /// + /// Equalizer band + /// + /// + /// Contains Equalizer properties + /// + public class EqualizerBand + { + /// + /// Set/Get new gain in decibel that is set to the given band [dB] + /// + /// int level + public int Level { set; get;} + + /// + /// Get frequency of the given band [dB] . + /// + /// int frequency + public int Frequency + { + get + { + return _frequency; + } + } + + /// + /// Getfrequency range of the given band [dB]. + /// + /// int range + public int Range + { + get + { + return _range; + } + } + + internal int _frequency; + internal int _range; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/MediaBufferSource.cs b/src/Tizen.Multimedia/Player/MediaBufferSource.cs new file mode 100644 index 0000000..b8d4fa5 --- /dev/null +++ b/src/Tizen.Multimedia/Player/MediaBufferSource.cs @@ -0,0 +1,12 @@ +using System; + +namespace Tizen.Multimedia +{ + public class MediaBufferSource : MediaSource + { + public MediaBufferSource (byte[] buffer) + { + } + } +} + diff --git a/src/Tizen.Multimedia/Player/MediaSource.cs b/src/Tizen.Multimedia/Player/MediaSource.cs new file mode 100644 index 0000000..f5a3b09 --- /dev/null +++ b/src/Tizen.Multimedia/Player/MediaSource.cs @@ -0,0 +1,21 @@ +/// Mediasource +/// +/// 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 +{ + public abstract class MediaSource + { + } +} + diff --git a/src/Tizen.Multimedia/Player/MediaStream.cs b/src/Tizen.Multimedia/Player/MediaStream.cs new file mode 100644 index 0000000..60f2778 --- /dev/null +++ b/src/Tizen.Multimedia/Player/MediaStream.cs @@ -0,0 +1,76 @@ +/// Media Stream +/// +/// 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 +{ + /// + /// MediaStream + /// + /// + /// MediaStream class for media stream configuration. + /// + + class MediaStream + { + /// + /// Get/Set Audio Media format. + /// + /// MediaFormat + //public MediaFormat AudioMediaFormat { get; set; } + + /// + /// Get/Set Video Media format. + /// + /// MediaFormat + //public MediaFormat VideoMediaFormat { get; set; } + + /// + /// Get/Set Audio configuration. + /// + /// MediaStreamConfiguration + public MediaStreamConfiguration AudioConfiguration + { + get + { + return _audioConfiguration; + } + } + + /// + /// Get/Set Video configuration. + /// + /// MediaStreamConfiguration + public MediaStreamConfiguration VideoConfiguration + { + get + { + return _videoConfiguration; + } + } + + /// + /// Get/Set Video Media format. + /// + /// MediaFormat + //public MediaFormat VideoMediaFormat { get; set; } + + + /// + /// Push Media stream + /// media packet + //public void PushMediaStream(MediaPacket packet); + + + internal MediaStreamConfiguration _audioConfiguration; + internal MediaStreamConfiguration _videoConfiguration; + } +} diff --git a/src/Tizen.Multimedia/Player/MediaStreamConfiguration.cs b/src/Tizen.Multimedia/Player/MediaStreamConfiguration.cs new file mode 100644 index 0000000..da9a98b --- /dev/null +++ b/src/Tizen.Multimedia/Player/MediaStreamConfiguration.cs @@ -0,0 +1,48 @@ +/// Media Stream configuration +/// +/// 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 +{ + /// + /// MediaStream configuration + /// + /// + /// MediaStreamConfiguration class for media stream configuration. + /// + + public class MediaStreamConfiguration + { + + /// + /// BufferStatusChanged event is raised when buffer underrun or overflow occurs. + /// + public event EventHandler BufferStatusChanged; + + /// + /// SeekOffsetChanged event is raised when seeking occurs. + /// + public event EventHandler SeekOffsetChanged; + + + + /// + /// max size bytes of buffer + /// Max size in bytes + public ulong BufferMaxSize { get; set; } + + /// + /// Min threshold + /// min threshold in bytes + public uint BufferMinThreshold { get; set; } + + } +} diff --git a/src/Tizen.Multimedia/Player/MediaStreamSource.cs b/src/Tizen.Multimedia/Player/MediaStreamSource.cs new file mode 100644 index 0000000..7b62b2b --- /dev/null +++ b/src/Tizen.Multimedia/Player/MediaStreamSource.cs @@ -0,0 +1,55 @@ +using System; + +namespace Tizen.Multimedia +{ + public class MediaStreamSource + { + + /// + /// Get audio stream configuration. + /// + /// Audio StreamConfiguration + public MediaStreamConfiguration AudioConfiguration + { + get + { + return _audioConfiguration; + } + } + + /// + /// Get video stream configuration. + /// + /// Video StreamConfiguration + public MediaStreamConfiguration VideoConfiguration + { + get + { + return _videoConfiguration; + } + } + + public MediaStreamSource () + { + } + + /// + /// Get/Set Media format. + /// + /// AudioMediaFormat + /// TODO: implement media format + //MediaFormat AudioMediaFormat {set; get;} + + /// + /// Get/Set Media format. + /// + /// VideoMediaFormat + /// TODO: implement media format + //MediaFormat VideoMediaFormat {set; get;} + + + internal MediaStreamConfiguration _audioConfiguration; + internal MediaStreamConfiguration _videoConfiguration; + } +} + diff --git a/src/Tizen.Multimedia/Player/MediaUriSource.cs b/src/Tizen.Multimedia/Player/MediaUriSource.cs new file mode 100644 index 0000000..eef913f --- /dev/null +++ b/src/Tizen.Multimedia/Player/MediaUriSource.cs @@ -0,0 +1,15 @@ +using System; + +namespace Tizen.Multimedia +{ + public class MediaUriSource : MediaSource + { + public MediaUriSource (string uri) + { + _uri = uri; + } + + internal string _uri; + } +} + diff --git a/src/Tizen.Multimedia/Player/PlaybackCompletedEventArgs.cs b/src/Tizen.Multimedia/Player/PlaybackCompletedEventArgs.cs new file mode 100644 index 0000000..46d92a9 --- /dev/null +++ b/src/Tizen.Multimedia/Player/PlaybackCompletedEventArgs.cs @@ -0,0 +1,26 @@ +/// This File contains PlaybackCompletedEventArgs class +/// +/// 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 +{ + + /// + /// PlaybackCompleted event arguments + /// + /// + /// PlaybackCompleted event arguments + /// + public class PlaybackCompletedEventArgs : EventArgs + { + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/PlaybackErrorEventArgs.cs b/src/Tizen.Multimedia/Player/PlaybackErrorEventArgs.cs new file mode 100644 index 0000000..118f7a2 --- /dev/null +++ b/src/Tizen.Multimedia/Player/PlaybackErrorEventArgs.cs @@ -0,0 +1,40 @@ +/// This File contains PlaybackErrorEventArgs class +/// +/// 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 +{ + + /// + /// PlaybackError event arguments + /// + /// + /// PlaybackError event arguments + /// + public class PlaybackErrorEventArgs : EventArgs + { + /// + /// Get the error code. + /// + /// integer error code + public int ErrorCode + { + get + { + return _errorCode; + } + } + + internal int _errorCode; + + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/PlaybackInterruptedEventArgs.cs b/src/Tizen.Multimedia/Player/PlaybackInterruptedEventArgs.cs new file mode 100644 index 0000000..96560e3 --- /dev/null +++ b/src/Tizen.Multimedia/Player/PlaybackInterruptedEventArgs.cs @@ -0,0 +1,39 @@ +/// This File contains PlaybackInterruptedEventArgs class +/// +/// 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 +{ + + /// + /// PlaybackInterrupted event arguments + /// + /// + /// PlaybackInterrupted event arguments + /// + public class PlaybackInterruptedEventArgs : EventArgs + { + /// + /// Get the error code. + /// + /// integer error code + public int InterruptedCode + { + get + { + return _interruptedCode; + } + } + + internal int _interruptedCode; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/Player.cs b/src/Tizen.Multimedia/Player/Player.cs new file mode 100644 index 0000000..8e16d4d --- /dev/null +++ b/src/Tizen.Multimedia/Player/Player.cs @@ -0,0 +1,430 @@ +/// Player +/// +/// 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; +using System.Threading.Tasks; + +namespace Tizen.Multimedia +{ + + /// + /// The Player class provides APIs required for playback. + /// + /// + /// The Player APIs provides functions to create a player, set media filename/url + /// and play the media content. It also provides APIs to adjust the configurations + /// of the player such as playback rate, volume, looping etc. And, event handlers + /// handles are provided to handle various playback events (like playback error/completion) + /// + public class Player + { + /// + /// PlaybackCompleted event is raised when playback of a media is finished + /// + public event EventHandler PlaybackCompleted; + + /// + /// PlaybackInterruped event is raised when playback of a media is interrupted + /// + public event EventHandler PlaybackInterruped; + + /// + /// PlaybackErrorOccured event is raised when any error occurs + /// + public event EventHandler PlaybackErrorOccured; + + /// + /// VideoFrameCaptured event is raised when a video frame is decoded + /// + public event EventHandler VideoFrameDecoded; + + /// + /// Get Player state. + /// + /// PlayerState + public PlayerState State + { + get + { + int state; + if (Interop.PlayerInterop.GetState (_playerHandle, out state) != 0) { + //throw Exception; + } + return (PlayerState)state; + } + } + + /// + /// Set/Get the left volume level. + /// + /// 0 to 1.0 that indicates left volume level + public float LeftVolume + { + set + { + if (Interop.PlayerInterop.SetVolume (_playerHandle, value, _rightVolume) == 0) + _leftVolume = value; + //else + // throw Exception; + } + get + { + //Interop.PlayerInterop.GetVolume (_playerHandle, out _leftVolume, out _rightVolume); + return _leftVolume; + } + } + + /// + /// Set/Get the right volume level. + /// + /// 0 to 1.0 that indicates right volume level + public float RightVolume + { + set + { + if ( Interop.PlayerInterop.SetVolume (_playerHandle, _leftVolume, value) == 0 ) + _rightVolume = value; + //else + // throw Exception; + } + get + { + //Interop.PlayerInterop.GetVolume (_playerHandle, out _leftVolume, out _rightVolume); + return _rightVolume; + } + } + + /// + /// Set/Get the Audio Latency Mode. + /// + /// Low, Mid, High + public AudioLatencyMode AudioLatencyMode + { + set + { + if (_audioLatencyMode != (int)value && Interop.PlayerInterop.SetAudioLatencyMode (_playerHandle, (int)value) == 0) + _audioLatencyMode = (int) value; + //else + // throw Exception; + } + + get + { + return (AudioLatencyMode)_audioLatencyMode; + } + } + + /// + /// Set/Get mute. + /// + /// true, false + public bool Mute + { + set + { + if (_mute != value && Interop.PlayerInterop.SetMute (_playerHandle, value) == 0) + _mute = value; + //else + // throw Exception; + } + get + { + //Interop.PlayerInterop.IsMuted (_playerHandle, out _mute); + return _mute; + } + } + + /// + /// Set/Get Loop play. + /// + /// true, false + public bool IsLooping + { + set + { + if (_isLooping != value && Interop.PlayerInterop.SetLooping (_playerHandle, value) == 0) + _isLooping = value; + //else + // throw Exception; + } + get + { + //Interop.PlayerInterop.IsLooping (_playerHandle, out _isLooping); + return _isLooping; + } + } + + /// + /// Set playback rate. + /// + /// -5.0x to 5.0x + public float PlaybackRate + { + set + { + if (Interop.PlayerInterop.SetPlaybackRate (_playerHandle, value) != 0) { + //throw Exception; + } + } + } + + /// + /// Set/Get sound type. + /// + /// System, Notification, Alarm, Ringtone, Media, Call, Voip, Voice + public SoundType PlayerSoundType + { + set + { + if (_soundType != value && Interop.PlayerInterop.SetSoundType (_playerHandle, (int)value) != 0) + _soundType = value; + //else + // throw Exception; + } + get + { + return _soundType; + } + } + + /// + /// Get play position. + /// + /// play position in milli seconds + public int PlayPosition + { + get + { + int playPosition; + if (Interop.PlayerInterop.GetPlayPosition (_playerHandle, out playPosition) != 0) { + //throw Exception; + } + return playPosition; + } + } + + /// + /// Set sound stream. + /// + /// Sound stream + //public SoundStream SoundStream { set; } + + /// + /// Set/Get Display. + /// + /// Display configuration + public Display Display + { + set + { + _display = value; + _display._playerHandle = _playerHandle; + } + get + { + return _display; + } + } + + /// + /// Set/Get Subtitle. + /// + /// Subtitle configuration + public Subtitle Subtitle + { + set + { + _subtitle = value; + _subtitle._playerHandle = _playerHandle; + } + get + { + return _subtitle; + } + } + + + /// + /// Get AudioEffect. + /// + /// AudioEffect object + public AudioEffect AudioEffect + { + get + { + return _audioEffect; + } + } + + /// + /// Get stream information. + /// + /// StreamInformation object + public StreamInformation StreamInformation + { + get + { + return _streamInformation; + } + } + + /// + /// Get StreamingConfiguration. + /// + /// StreamingConfiguration object + public StreamingConfiguration StreamingConfiguration + { + get + { + return _streamingConfiguration; + } + } + + /// + /// Player constructor. + public Player() + { + // Throw exception on error returns? + Interop.PlayerInterop.Create (out _playerHandle); + + // 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); + + + // AudioEffect + _audioEffect = new AudioEffect(); + _audioEffect._playerHandle = _playerHandle; + + // Display + _display = new Display(DisplayType.Evas /* Default value? */); + _display._playerHandle = _playerHandle; + + + // StreamingConfiguration + _streamingConfiguration = new StreamingConfiguration(); + _streamingConfiguration._playerHandle = _playerHandle; + + // StreamInformation + _streamInformation = new StreamInformation (); + _streamInformation._playerHandle = _playerHandle; + _streamInformation._contentInfo = new PlayerContentInfo (); + _streamInformation._contentInfo._playerHandle = _playerHandle; + + // Subtitle + _subtitle = new Subtitle(); + _subtitle._playerHandle = _playerHandle; + + } + + /// + /// Player destructor + /// + ~Player() + { + } + + /// + /// Prepares the media player for playback. + /// TODO: make async + public /*Task*/void PrepareAsync() + { + if ((Interop.PlayerInterop.Prepare (_playerHandle)) != 0) { + //throw Exception; + } + } + + /// + /// 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. + public void Unrepare() + { + if (Interop.PlayerInterop.Unprepare (_playerHandle) != 0) { + //throw Exception; + } + } + + /// + /// Starts or resumes playback. + public void Start() + { + if (Interop.PlayerInterop.Start (_playerHandle) != 0) { + //throw Exception; + } + } + + /// + /// Stops playing media content. + public void Stop() + { + if (Interop.PlayerInterop.Stop (_playerHandle) != 0) { + //throw Exception; + } + } + + /// + /// Pauses the player. + public void Pause() + { + if (Interop.PlayerInterop.Pause (_playerHandle) != 0) { + //throw Exception; + } + } + + /// + /// sets media source for the player. + /// Mediasource + /// 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 + } + } + } + + + /// + /// Captures a video frame asynchronously. + Task CaptureVideoAsync() + { + return null; + } + + /// + ///Sets the seek position for playback, asynchronously. + /// Position to be set in milliseconds + /// accurate seek or not + //public Task SetPlayPositionAsync(int milliseconds, bool accurate) + //{ + //} + + + internal PlayerState _state; + internal float _leftVolume; + internal float _rightVolume; + internal int _audioLatencyMode; + internal bool _mute; + internal bool _isLooping; + internal SoundType _soundType; + + internal Display _display; + internal Subtitle _subtitle; + internal AudioEffect _audioEffect; + internal StreamInformation _streamInformation; + internal StreamingConfiguration _streamingConfiguration; + + internal IntPtr _playerHandle; + } +} diff --git a/src/Tizen.Multimedia/Player/PlayerContentInfo.cs b/src/Tizen.Multimedia/Player/PlayerContentInfo.cs new file mode 100644 index 0000000..9b24704 --- /dev/null +++ b/src/Tizen.Multimedia/Player/PlayerContentInfo.cs @@ -0,0 +1,132 @@ +/// PlayerContentInfo +/// +/// 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 +{ + /// + /// PlayerContentInfo + /// + /// + /// This class provides properties for metadata information of media file. + /// + + public class PlayerContentInfo + { + enum ContentInfoKey + { + Album, + Artist, + Author, + Genre, + Title, + Year + } + + /// + /// Metadata - Album + /// + /// album string + public string Album + { + get + { + string album; + if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Album, out album) != 0) { + // throw Exception; + } + return album; + } + } + + /// + /// Metadata - Artist + /// + /// artist string + public string Artist + { + get + { + string artist; + if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Artist, out artist) != 0) { + // throw Exception; + } + return artist; + } + } + + /// + /// Metadata - Author + /// + /// Author string + public string Author + { + get + { + string author; + if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Author, out author) != 0) { + // throw Exception; + } + return author; + } + } + + /// + /// Metadata - Genre + /// + /// genre string + public string Genre + { + get + { + string genre; + if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Genre, out genre) != 0) { + // throw Exception; + } + return genre; + } + } + + /// + /// Metadata - Title + /// + /// title string + public string Title + { + get + { + string title; + if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Title, out title) != 0) { + // throw Exception; + } + return title; + } + } + + /// + /// Metadata - Year + /// + /// year string + public string Year + { + get + { + string year; + if (Interop.PlayerInterop.GetContentInfo (_playerHandle, (int)ContentInfoKey.Year, out year) != 0) { + // throw Exception; + } + return year; + } + } + + internal IntPtr _playerHandle; + } +} diff --git a/src/Tizen.Multimedia/Player/PlayerEnums.cs b/src/Tizen.Multimedia/Player/PlayerEnums.cs new file mode 100644 index 0000000..0e424a2 --- /dev/null +++ b/src/Tizen.Multimedia/Player/PlayerEnums.cs @@ -0,0 +1,272 @@ +using System; + +namespace Tizen.Multimedia +{ + /// + /// Enumeration for player state + /// + public enum PlayerState + { + /// + /// Player is not created + /// + None, + + /// + /// Player is created, but not prepared + /// + Idle, + + /// + /// Player is ready to play media + /// + Ready, + + /// + /// Player is playing media + /// + Playing, + + /// + /// Player is paused while playing media + /// + Paused, + } + + /// + /// Enumeration for player display type + /// + public enum DisplayType + { + /// + /// Overlay surface display + /// + Overlay, + + /// + /// Evas image object surface display + /// + Evas, + + /// + /// This disposes off buffers + /// + None, + } + + + /// + /// Enumeration for player audio latency mode + /// + public enum AudioLatencyMode + { + /// + /// Low audio latency mode + /// + Low, + + /// + /// Middle audio latency mode + /// + Mid, + + /// + /// High audio latency mode + /// + High, + } + + + /// + /// Enumeration for player display rotation + /// + public enum DisplayRotation + { + /// + /// Display is not rotated + /// + RotationNone, + + /// + /// Display is rotated 90 degrees + /// + Rotation90, + + /// + /// Display is rotated 180 degrees + /// + Rotation180, + + /// + /// Display is rotated 270 degrees + /// + Rotation270 + } + + + /// + /// Enumeration for player display mode + /// + public enum DisplayMode + { + /// + /// Letter box + /// + LetterBox, + + /// + /// Origin size + /// + OriginalSize, + + /// + /// Full-screen + /// + FullScreen, + + /// + /// Cropped full-screen + /// + CroppedFull, + + /// + /// 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) + /// + OriginalOrFull, + + /// + /// Dst ROI mode + /// + DstRoi + } + + + /// + /// Enumeration for player stream type + /// + public enum StreamType + { + /// + /// Container type + /// + Default, + + /// + /// Audio element stream type + /// + Audio, + + /// + /// Video element stream type + /// + Video, + + /// + /// Text type + /// + Text + } + + + + /// + /// Enumeration for Progressive download message + /// + public enum ProgressiveDownloadMessage + { + /// + /// Progressive download is started + /// + Started, + + /// + /// Progressive download is completed + /// + Completed, + } + + /// + /// Streaming buffer status + /// + public enum StreamingBufferStatus + { + /// + /// Underrun + /// + Underrun, + + /// + /// Completed + /// + Overflow, + } + + /// + /// Enumeration for sound type + /// + public enum SoundType + { + /// + /// Sound type for system + /// + System, + + /// + /// Sound type for notifications + /// + Notification, + + /// + /// Sound type for alarm + /// + Alarm, + + /// + /// Sound type for ringtones + /// + Ringtone, + + /// + /// Sound type for media + /// + Media, + + /// + /// Sound type for call + /// + Call, + + /// + /// Sound type for voip + /// + Voip, + + /// + /// Sound type for voice + /// + Voice + } + + /// + /// Enumeration for source type + /// + public enum PlayerSourceType + { + /// + /// Uri source + /// + Uri, + + /// + /// memory buffer source + /// + Memory, + + /// + /// stream source + /// + Stream, + } + +} diff --git a/src/Tizen.Multimedia/Player/PlayerSource.cs b/src/Tizen.Multimedia/Player/PlayerSource.cs new file mode 100644 index 0000000..0484ad0 --- /dev/null +++ b/src/Tizen.Multimedia/Player/PlayerSource.cs @@ -0,0 +1,10 @@ +using System; + + +namespace Tizen.Multimedia +{ + abstract class PlayerSource + { + PlayerSourceType Type; + } +} diff --git a/src/Tizen.Multimedia/Player/ProgressiveDownloadMessageEventArgs.cs b/src/Tizen.Multimedia/Player/ProgressiveDownloadMessageEventArgs.cs new file mode 100644 index 0000000..a58e8df --- /dev/null +++ b/src/Tizen.Multimedia/Player/ProgressiveDownloadMessageEventArgs.cs @@ -0,0 +1,40 @@ +/// This File contains ProgressiveDownloadMessageEventArgs class +/// +/// 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 +{ + + /// + /// ProgressiveDownloadMessage event arguments + /// + /// + /// ProgressiveDownloadMessage event arguments + /// + public class ProgressiveDownloadMessageEventArgs : EventArgs + { + /// + /// Get Progressive download message. + /// + /// 0 - 100 + public ProgressiveDownloadMessage Message + { + get + { + return _message; + } + } + + internal ProgressiveDownloadMessage _message; + + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/ProgressiveDownloadStatus.cs b/src/Tizen.Multimedia/Player/ProgressiveDownloadStatus.cs new file mode 100644 index 0000000..994a438 --- /dev/null +++ b/src/Tizen.Multimedia/Player/ProgressiveDownloadStatus.cs @@ -0,0 +1,37 @@ +/// Progressive Download Status +/// +/// 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 +{ + + /// + /// DownloadProgress + /// + /// + /// Contains Progressive download status + /// + public class ProgressiveDownloadStatus + { + /// + /// Get current download position (bytes) + /// + /// current download position + public ulong Current; + + /// + /// Get total size of the file (bytes) + /// + /// Total size of file (bytes) + public ulong TotalSize; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/SeekOffsetEventArgs.cs b/src/Tizen.Multimedia/Player/SeekOffsetEventArgs.cs new file mode 100644 index 0000000..0bad71f --- /dev/null +++ b/src/Tizen.Multimedia/Player/SeekOffsetEventArgs.cs @@ -0,0 +1,40 @@ +/// This File contains SeekOffsetEventArgs class +/// +/// 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 +{ + + /// + /// SeekOffset event arguments + /// + /// + /// SeekOffset event arguments + /// + public class SeekOffsetEventArgs : EventArgs + { + /// + /// Get seek offset. + /// + /// byte position to seek + public ulong Offset + { + get + { + return _offset; + } + } + + internal ulong _offset; + + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/SourceFactory.cs b/src/Tizen.Multimedia/Player/SourceFactory.cs new file mode 100644 index 0000000..6a0dd70 --- /dev/null +++ b/src/Tizen.Multimedia/Player/SourceFactory.cs @@ -0,0 +1,51 @@ +/// Source Factory +/// +/// 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 +{ + /// + /// SourceFactory + /// + /// + /// Factory class for getting player source. + /// + + class SourceFactory + { + /// + /// GetSource + /// source uri string + /// PlayerSource + public static PlayerSource GetSource(string uri) + { + return null; + } + + /// + /// GetSource + /// memory buffer + /// PlayerSource + public static PlayerSource GetSource(byte[] buffer) + { + return null; + } + + /// + /// GetSource + /// media stream + /// PlayerSource + public static PlayerSource GetSource(MediaStream mediaStream) + { + return null; + } + } +} diff --git a/src/Tizen.Multimedia/Player/StreamInformation.cs b/src/Tizen.Multimedia/Player/StreamInformation.cs new file mode 100644 index 0000000..5c412ae --- /dev/null +++ b/src/Tizen.Multimedia/Player/StreamInformation.cs @@ -0,0 +1,217 @@ +/// Audio Stream Information +/// +/// 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 +{ + /// + /// Stream information + /// + /// + /// This class provides properties and API that are required for fetching + /// metadata of a media stream. + /// + public class StreamInformation + { + + /// + /// Get album art. + /// + /// byte[] + public byte[] AlbumArt + { + get + { + return _albumArt; + } + } + + /// + /// Get AudioCodec. + /// + /// AudioCodec string + public string AudioCodec + { + get + { + string audioCodec, videoCodec; + if (Interop.PlayerInterop.GetCodecInfo (_playerHandle, out audioCodec, out videoCodec) != 0) { + //throw Exception + } + return audioCodec; + } + } + + /// + /// Get Duration. + /// + /// duration in milliseconds + public int Duration + { + get + { + int duration; + if (Interop.PlayerInterop.GetDuration (_playerHandle, out duration) != 0) { + //throw Exception + } + return duration; + } + } + + /// + /// Get Sample rate. + /// + /// The audio sample rate [Hz] + public int AudioSampleRate + { + get + { + int sampleRate, channels, bitRate; + if( Interop.PlayerInterop.GetAudioStreamInfo(_playerHandle, out sampleRate, out channels, out bitRate) != 0) { + //throw Exception; + } + return sampleRate; + } + } + + /// + /// Channels + /// + /// The audio channels + public int AudioChannels + { + get + { + int sampleRate, channels, bitRate; + if( Interop.PlayerInterop.GetAudioStreamInfo(_playerHandle, out sampleRate, out channels, out bitRate) != 0) { + //throw Exception; + } + return channels; + } + } + + /// + /// Audio bit rate. + /// + /// bit rate [Hz] + public int AudioBitRate + { + get + { + int sampleRate, channels, bitRate; + if( Interop.PlayerInterop.GetAudioStreamInfo(_playerHandle, out sampleRate, out channels, out bitRate) != 0) { + //throw Exception; + } + return bitRate; + } + } + + + /// + /// VideoCodec + /// + /// video codec string + public string VideoCodec + { + get + { + string audioCodec, videoCodec; + if (Interop.PlayerInterop.GetCodecInfo (_playerHandle, out audioCodec, out videoCodec) != 0) { + //throw Exception + } + return videoCodec; + } + } + + /// + /// FPS + /// + /// int Frames per second + public int VideoFps + { + get + { + int fps, bitRate; + if (Interop.PlayerInterop.GetVideoStreamInfo (_playerHandle, out fps, out bitRate) != 0) { + //throw Exception; + } + return fps; + } + } + + /// + /// Video bit rate. + /// + /// bit rate [Hz] + public int VideoBitRate + { + get + { + int fps, bitRate; + if (Interop.PlayerInterop.GetVideoStreamInfo (_playerHandle, out fps, out bitRate) != 0) { + //throw Exception; + } + return bitRate; + } + } + + /// + /// Get Video Height. + /// + /// video height + public int VideoHeight + { + get + { + int height, width; + if (Interop.PlayerInterop.GetVideoSize (_playerHandle, out width, out height) != 0) { + //throw Exception; + } + return height; + } + } + + /// + /// Get Video Width. + /// + /// video width + public int VideoWidth + { + get + { + int height, width; + if (Interop.PlayerInterop.GetVideoSize (_playerHandle, out width, out height) != 0) { + //throw Exception; + } + return width; + } + } + + /// + /// Get Player content info. + /// + /// metadata + public PlayerContentInfo ContentInfo + { + get + { + return _contentInfo; + } + } + + internal IntPtr _playerHandle; + + internal byte[] _albumArt; + internal PlayerContentInfo _contentInfo; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/StreamingConfiguration.cs b/src/Tizen.Multimedia/Player/StreamingConfiguration.cs new file mode 100644 index 0000000..26b9ecf --- /dev/null +++ b/src/Tizen.Multimedia/Player/StreamingConfiguration.cs @@ -0,0 +1,137 @@ +/// Streaming configuration +/// +/// 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 +{ + /// + /// Streaming configuration + /// + /// + /// This class provides properties and API that are required for streaming + /// playback operations. + /// + public class StreamingConfiguration + { + /// + /// BufferingProgressChanged event is raised when there is a change in the buffering status of a media stream + /// + public event EventHandler BufferingProgressChanged; + + /// + /// ProgressiveDownloadMessageChanged event is raised when progressive download is started or completed. + /// + public event EventHandler ProgressiveDownloadMessageChanged; + + /// + /// Video stream changed event is raised to notify the video stream changed. + /// + public event EventHandler VideoStreamChanged; + + + /// + /// Set/Get Progressive download path. + /// + /// path string + public string ProgressiveDownloadPath + { + set + { + if (Interop.PlayerInterop.SetProgressiveDownloadPath (_playerHandle, value) != 0) { + // throw Exception + } + _progressiveDownloadPath = value; + } + get + { + return _progressiveDownloadPath; + } + } + + /// + /// Get Streaming download Progress. + /// + /// download progress int start and current [0 to 100] + public DownloadProgress DownloadProgress + { + get + { + DownloadProgress progress = new DownloadProgress(); + if (Interop.PlayerInterop.GetStreamingDownloadProgress (_playerHandle, out progress.Start, out progress.Current) != 0) { + // throw Exception; + } + return progress; + } + } + + /// + /// Get progressive download status. + /// + /// progressive download status ulong current and total size + public ProgressiveDownloadStatus ProgressiveDownloadStatus + { + get + { + ProgressiveDownloadStatus status = new ProgressiveDownloadStatus (); + // TODO: interop + return status; + } + } + + /// + /// Set/Get cookie. + /// + /// cookie string + public string Cookie + { + set + { + if (Interop.PlayerInterop.SetStreamingCookie (_playerHandle, value, value.Length + 1) != 0) { + // throw Exception + } + _cookie = value; + } + get + { + return _cookie; + } + } + + /// + /// Set/Get User agent. + /// + /// user agent string + public string UserAgent + { + set + { + if (Interop.PlayerInterop.SetStreamingUserAgent (_playerHandle, value, value.Length + 1) != 0) { + // throw Exception + } + _userAgent = value; + } + get + { + return _userAgent; + } + } + + + internal IntPtr _playerHandle; + + internal string _cookie; + internal string _userAgent; + internal string _progressiveDownloadPath; + } + +} diff --git a/src/Tizen.Multimedia/Player/Subtitle.cs b/src/Tizen.Multimedia/Player/Subtitle.cs new file mode 100644 index 0000000..37feb9a --- /dev/null +++ b/src/Tizen.Multimedia/Player/Subtitle.cs @@ -0,0 +1,136 @@ +/// Subtitle +/// +/// 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; +using System.Collections.Generic; + +namespace Tizen.Multimedia +{ + /// + /// Subtitle + /// + /// + /// This class provides properties and events that are required for subtitle + /// during playback. + /// + public class Subtitle + { + /// + /// Subtitle event is raised when the subtitle is updated + /// + public event EventHandler Updated; + + + /// + /// Set position offset. + /// + /// position in milli seconds + public int Position + { + set + { + if (Interop.PlayerInterop.SetSubtitlePositionOffset (_playerHandle, value) != 0) { + // throw Exception + } + } + } + + + /// + /// Get/Set Text track. + /// + /// Text track list + public IList TextTrack + { + get + { + string langCode; + foreach (SubtitleTrack t in _textTrack) { + if (Interop.PlayerInterop.GetTrackLanguageCode (_playerHandle, (int)StreamType.Text, _textTrack.IndexOf (t), out langCode) != 0) { + // throw Exception + } + t.LanguageCode = langCode; + } + return _textTrack; + } + set + { + _textTrack = value; + } + } + + /// + /// Get/Set Text track. + /// + /// Audio track list + public IList AudioTrack + { + get + { + string langCode; + foreach (SubtitleTrack t in _audioTrack) { + if (Interop.PlayerInterop.GetTrackLanguageCode (_playerHandle, (int)StreamType.Audio, _audioTrack.IndexOf (t), out langCode) != 0) { + // throw Exception + } + t.LanguageCode = langCode; + } + return _audioTrack; + } + set + { + _audioTrack = value; + } + } + + /// + /// Get/Set video track. + /// + /// video track list + public IList VideoTrack + { + get + { + string langCode; + foreach (SubtitleTrack t in _videoTrack) { + if (Interop.PlayerInterop.GetTrackLanguageCode (_playerHandle, (int)StreamType.Video, _videoTrack.IndexOf (t), out langCode) != 0) { + // throw Exception + } + t.LanguageCode = langCode; + } + return _videoTrack; + } + set + { + _videoTrack = value; + } + } + + /// + /// Set path. + /// + /// path string + public string path + { + set + { + if (Interop.PlayerInterop.SetSubtitlePath (_playerHandle, value) != 0) { + // throw Exception + } + } + } + + IList _textTrack; + IList _audioTrack; + IList _videoTrack; + + internal IntPtr _playerHandle; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/SubtitleTrack.cs b/src/Tizen.Multimedia/Player/SubtitleTrack.cs new file mode 100644 index 0000000..161c6c8 --- /dev/null +++ b/src/Tizen.Multimedia/Player/SubtitleTrack.cs @@ -0,0 +1,36 @@ +/// Subtitle track +/// +/// 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 +{ + /// + /// SubtitleTrack + /// + /// + /// This class provides properties for subtitle tracks. + /// + + public class SubtitleTrack + { + /// + /// Get/Set Language code. + /// + /// language code string + public string LanguageCode { get; set; } + + /// + /// Get/Set activation status. + /// + /// true, false + public bool Activated { get; set; } + } +} diff --git a/src/Tizen.Multimedia/Player/SubtitleUpdatedEventArgs.cs b/src/Tizen.Multimedia/Player/SubtitleUpdatedEventArgs.cs new file mode 100644 index 0000000..fda8511 --- /dev/null +++ b/src/Tizen.Multimedia/Player/SubtitleUpdatedEventArgs.cs @@ -0,0 +1,52 @@ +/// This File contains SubtitleUpdatedEventArgs class +/// +/// 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 +{ + + /// + /// SubtitleUpdated event arguments + /// + /// + /// SubtitleUpdated event arguments + /// + public class SubtitleUpdatedEventArgs : EventArgs + { + /// + /// The duration of the updated subtitle . + /// + /// ulong duration + public ulong Duration + { + get + { + return _duration; + } + } + + /// + /// The text of the updated subtitle . + /// + /// string + public string Text + { + get + { + return _text; + } + } + + internal ulong _duration; + internal string _text; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/VideoFrameCapture.cs b/src/Tizen.Multimedia/Player/VideoFrameCapture.cs new file mode 100644 index 0000000..faedd1b --- /dev/null +++ b/src/Tizen.Multimedia/Player/VideoFrameCapture.cs @@ -0,0 +1,48 @@ +/// 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 +{ + /// + /// VideoFrameCapture + /// + /// + /// VideoSize class provides properties of a captured video frame + /// + class VideoFrameCapture + { + + /// + /// Get/Set ImageBuffer. + /// + /// Image buffer + public byte[] ImageBuffer { set; get; } + + /// + /// Get/Set width. + /// + /// Image width + public int Width { set; get; } + + /// + /// Get/Set height. + /// + /// Image Height + public int Height { set; get; } + + /// + /// Get/Set Size. + /// + /// Size of the image + public uint Size { set; get; } + } +} diff --git a/src/Tizen.Multimedia/Player/VideoFrameDecodedEventArgs.cs b/src/Tizen.Multimedia/Player/VideoFrameDecodedEventArgs.cs new file mode 100644 index 0000000..32bb917 --- /dev/null +++ b/src/Tizen.Multimedia/Player/VideoFrameDecodedEventArgs.cs @@ -0,0 +1,39 @@ +/// This File contains VideoFrameDecodedEventArgs class +/// +/// 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 +{ + + /// + /// VideoFrameDecoded event arguments + /// + /// + /// VideoFrameDecoded event arguments + /// + public class VideoFrameDecodedEventArgs : EventArgs + { + /// + /// Get the Image buffer. + /// + /// integer error code + //public MediaPacket Packet + //{ + // get + // { + // return _packet; + // } + //} + + //internal MediaPacket _packet; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Player/VideoStreamEventArgs.cs b/src/Tizen.Multimedia/Player/VideoStreamEventArgs.cs new file mode 100644 index 0000000..5acace6 --- /dev/null +++ b/src/Tizen.Multimedia/Player/VideoStreamEventArgs.cs @@ -0,0 +1,78 @@ +/// This File contains VideoStreamEventArgs class +/// +/// 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 +{ + + /// + /// VideoStreamEventArgs event arguments + /// + /// + /// VideoStreamEventArgs event arguments + /// + public class VideoStreamEventArgs : EventArgs + { + /// + /// Get Video Height. + /// + /// video height + public int Height + { + get + { + return _height; + } + } + + /// + /// Get Video Width. + /// + /// video width + public int Width + { + get + { + return _width; + } + } + + /// + /// FPS + /// + /// int Frames per second + public int Fps + { + get + { + return _fps; + } + } + + /// + /// Bit rate. + /// + /// bit rate [Hz] + public int BitRate + { + get + { + return _bitrate; + } + } + + internal int _height; + internal int _width; + internal int _fps; + internal int _bitrate; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Properties/AssemblyInfo.cs b/src/Tizen.Multimedia/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1f3097c --- /dev/null +++ b/src/Tizen.Multimedia/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tizen.Multimedia")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tizen.Multimedia")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3bbcff7a-1f64-43a8-bdca-ffaee260697a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Tizen.Multimedia/Tizen.Multimedia.csproj b/src/Tizen.Multimedia/Tizen.Multimedia.csproj new file mode 100644 index 0000000..599bce0 --- /dev/null +++ b/src/Tizen.Multimedia/Tizen.Multimedia.csproj @@ -0,0 +1,98 @@ + + + + + Debug + AnyCPU + {0CE698B0-4849-4096-9D7F-30E611F50DAD} + Library + Properties + Tizen.Multimedia + Tizen.Multimedia + v4.0 + 512 + + 8.0.30703 + 2.0 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + + + Tizen.Multimedia.snk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia/Tizen.Multimedia.sln b/src/Tizen.Multimedia/Tizen.Multimedia.sln new file mode 100644 index 0000000..38ddfac --- /dev/null +++ b/src/Tizen.Multimedia/Tizen.Multimedia.sln @@ -0,0 +1,17 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia", "Tizen.Multimedia.csproj", "{0CE698B0-4849-4096-9D7F-30E611F50DAD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0CE698B0-4849-4096-9D7F-30E611F50DAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CE698B0-4849-4096-9D7F-30E611F50DAD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CE698B0-4849-4096-9D7F-30E611F50DAD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CE698B0-4849-4096-9D7F-30E611F50DAD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia/Tizen.Multimedia.snk b/src/Tizen.Multimedia/Tizen.Multimedia.snk new file mode 100644 index 0000000000000000000000000000000000000000..831cef646a7329dc554b12cbc1e41f21fe0fb1e9 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50098KHmN&pB1c(cEeNFnx!k#$Q$COI!=e0e zMD?&<7i<7tT7SgR-=$5Y)XLO`j71o#A7&GP`;cf|#+lXRjm&9#Gr{AFaD-n#Rua~N zesed$k=@Xssx|$sWlsJ~REQtis4U}M&KT;EiBsfA$EqkwN9}Lps+0ti3oDm8D9zv3 zbP$bkdA>^T;Q5U=heD<)Ne^}Sk)VC?Ud}sSA);TU7gADuw1KoFHD!Fm*mh1qVYEn} zzfTfnyy^9@Q&jqks+Cg}++e`jqKKa|=Z_~EX2b^lshGn6Bmj}`!$-c;%PC&{(p=?5 z938kPP=5Lm^|%0GuW)Z@ole*>{@G++6QzxVUkv>a!n@gr+8!QZa~tkr!5zjR~W7Rovx9vApZW6fy^D!rEEAAdE z>W>$ShlafE8V}Q^gKD5sctBn`jzQXqb+VBrFdgKzPBo^JzXv+Ug(|(r1ICLT$?Q=N zC8SVU{lKFl{AY-&uswS??3TMvEkk6rdQl4n{RNQ>+$LiAB&1KRJLSe2SU5YNpz+S>TXN$agu`?6*+7RdU^d8 z(Ndz^7w$(`u~otNm80Ps%RdwCaYw + + + + + + + + + + + \ No newline at end of file -- 2.7.4