From 5184971865046e4091e4c3db6a157a9c40e057f9 Mon Sep 17 00:00:00 2001 From: coderhyme Date: Mon, 5 Jun 2017 16:57:32 +0900 Subject: [PATCH] [MetadataExtractor] Fixed naming issues and updated comments. This is to make names consistent in the Multimedia namespace. Change-Id: I5dd04f3d57c41d3a8fbd6b98452cc08c06e4f85f Signed-off-by: coderhyme --- .../MetadataExtractor/Artwork.cs | 34 ++-- .../MetadataExtractor/Metadata.cs | 217 ++++++++++----------- .../MetadataExtractor/MetadataExtractor.cs | 33 ++-- .../MetadataExtractor/MetadataExtractorAttr.cs | 28 +-- .../MetadataExtractor/MetadataExtractorError.cs | 29 ++- .../MetadataExtractor/SyncLyrics.cs | 36 ++-- .../MetadataExtractor/ValueConverter.cs | 48 +++++ 7 files changed, 235 insertions(+), 190 deletions(-) create mode 100644 src/Tizen.Multimedia.Metadata/MetadataExtractor/ValueConverter.cs diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/Artwork.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/Artwork.cs index e1fcb83..d5a83a7 100755 --- a/src/Tizen.Multimedia.Metadata/MetadataExtractor/Artwork.cs +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/Artwork.cs @@ -1,18 +1,18 @@ /* -* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the License); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an AS IS BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ namespace Tizen.Multimedia { @@ -22,7 +22,7 @@ namespace Tizen.Multimedia public class Artwork { /// - /// Initializes a new instance of the Artwork class with the specified data and mimeType. + /// Initializes a new instance of the Artwork class with the specified data and mime type. /// /// 3 /// The data of the artwork to set metadata. @@ -34,13 +34,13 @@ namespace Tizen.Multimedia } /// - /// The encoded artwork image. + /// Gets the encoded artwork image. /// /// 3 public byte[] Data { get; } /// - /// The mime type of artwork. + /// Gets the mime type of artwork. /// /// 3 public string MimeType { get; } diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/Metadata.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/Metadata.cs index 561bb8b..36234ac 100755 --- a/src/Tizen.Multimedia.Metadata/MetadataExtractor/Metadata.cs +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/Metadata.cs @@ -1,18 +1,18 @@ /* -* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the License); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an AS IS BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ using System; using System.Diagnostics; @@ -25,70 +25,69 @@ namespace Tizen.Multimedia /// public class VideoMetadata { - - protected VideoMetadata() - { - } - - internal VideoMetadata(IntPtr handle) + private VideoMetadata(int streamCount, IntPtr handle) { + Debug.Assert(streamCount > 0); Debug.Assert(handle != IntPtr.Zero); - StreamCount = GetMetadata(handle, MetadataExtractorAttr.VideoStreamCount); - - if (StreamCount == null || (StreamCount != null && StreamCount.Equals("0") == false)) - { - Bitrate = GetMetadata(handle, MetadataExtractorAttr.VideoBitrate); - Fps = GetMetadata(handle, MetadataExtractorAttr.VideoFps); - Width = GetMetadata(handle, MetadataExtractorAttr.VideoWidth); - Height = GetMetadata(handle, MetadataExtractorAttr.VideoHeight); - Codec = GetMetadata(handle, MetadataExtractorAttr.VideoCodec); - } + StreamCount = streamCount; + BitRate = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.VideoBitrate)); + Fps = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.VideoFps)); + Width = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.VideoWidth)); + Height = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.VideoHeight)); + Codec = GetMetadata(handle, MetadataExtractorAttr.VideoCodec); _description = new Lazy(() => ObjectDescriptionBuilder.BuildWithProperties(this)); } + internal static VideoMetadata From(IntPtr handle) + { + var streamCount = ValueConverter.ToInt(GetMetadata(handle, MetadataExtractorAttr.VideoStreamCount)); + + return streamCount > 0 ? new VideoMetadata(streamCount, handle) : null; + } + /// /// Gets the bitrate. /// /// 3 - /// A string representing the bitrate, or null if the information does not exists. - public string Bitrate { get; } + /// The bitrate value, or null if the information does not exist. + public int? BitRate { get; } /// /// Gets the video FPS. /// /// 3 - /// A string representing the fps, or null if the information does not exists. - public string Fps { get; } + /// The fps value, or null if the information does not exist. + public int? Fps { get; } /// /// Gets the width of the video. /// /// 3 - /// A string representing the width, or null if the information does not exists. - public string Width { get; } + /// The width value, or null if the information does not exist. + public int? Width { get; } /// /// Gets the height of the video. /// /// 3 - /// A string representing the height, or null if the information does not exists. - public string Height { get; } + /// The height value, or null if the information does not exist. + public int? Height { get; } /// /// Get the codec type of the video. /// /// 3 - /// A string representing the codec type, or null if the information does not exists. + /// A string representing the codec type, or null if the information does not exist. public string Codec { get; } /// /// Gets the video stream count. /// /// 3 - /// A string representing the video stream count, or null if the information does not exists. - public string StreamCount { get; } + /// The number of video streams. + public int StreamCount { get; } private Lazy _description; @@ -104,63 +103,62 @@ namespace Tizen.Multimedia /// public class AudioMetadata { - - protected AudioMetadata() - { - } - - internal AudioMetadata(IntPtr handle) + internal AudioMetadata(int streamCount, IntPtr handle) { + Debug.Assert(streamCount > 0); Debug.Assert(handle != IntPtr.Zero); - StreamCount = GetMetadata(handle, MetadataExtractorAttr.AudioStreamCount); - - if (StreamCount == null || (StreamCount != null && !StreamCount.Equals("0"))) - { - Bitrate = GetMetadata(handle, MetadataExtractorAttr.AudioBitrate); - Channels = GetMetadata(handle, MetadataExtractorAttr.AudioChannels); - Samplerate = GetMetadata(handle, MetadataExtractorAttr.AudioSamplerate); - BitPerSample = GetMetadata(handle, MetadataExtractorAttr.AudioBitPerSample); - Codec = GetMetadata(handle, MetadataExtractorAttr.AudioCodec); - } + StreamCount = streamCount; + BitRate = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.AudioBitrate)); + Channels = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.AudioChannels)); + SampleRate = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.AudioSamplerate)); + BitPerSample = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.AudioBitPerSample)); + Codec = GetMetadata(handle, MetadataExtractorAttr.AudioCodec); _description = new Lazy(() => ObjectDescriptionBuilder.BuildWithProperties(this)); } + internal static AudioMetadata From(IntPtr handle) + { + var streamCount = ValueConverter.ToInt(GetMetadata(handle, MetadataExtractorAttr.AudioStreamCount)); + + return streamCount > 0 ? new AudioMetadata(streamCount, handle) : null; + } + /// /// Gets the audio bitrate. /// /// 3 - /// A string representing the bitrate, or null if the information does not exists. - public string Bitrate { get; } + /// The bit rate value, or null if the information does not exist. + public int? BitRate { get; } /// /// Gets the audio channels. /// /// 3 - /// A string representing the audio channels, or null if the information does not exists. - public string Channels { get; } + /// The number of the audio channels, or null if the information does not exist. + public int? Channels { get; } /// /// Gets the audio sample rate. /// /// 3 - /// A string representing the sample rate, or null if the information does not exists. - public string Samplerate { get; } + /// The sample rate, or null if the information does not exist. + public int? SampleRate { get; } /// /// Gets the bit per sample of the audio. /// /// 3 - /// A string representing the bit oer sample, or null if the information does not exists. - public string BitPerSample { get; } + /// The bit per sample, or null if the information does not exist. + public int? BitPerSample { get; } /// /// Gets the audio stream count. /// /// 3 - /// A string representing the audio stream count, or null if the information does not exists. - public string StreamCount { get; } + /// The number of audio streams. + public int StreamCount { get; } /// /// Gets the audio codec type. @@ -181,19 +179,14 @@ namespace Tizen.Multimedia /// public class Metadata { - - protected Metadata() - { - } - internal Metadata(IntPtr handle) { Debug.Assert(handle != IntPtr.Zero); - Video = new VideoMetadata(handle); - Audio = new AudioMetadata(handle); + Video = VideoMetadata.From(handle); + Audio = AudioMetadata.From(handle); - Duration = GetMetadata(handle, MetadataExtractorAttr.Duration); + Duration = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.Duration)); Artist = GetMetadata(handle, MetadataExtractorAttr.Artist); Title = GetMetadata(handle, MetadataExtractorAttr.Title); Album = GetMetadata(handle, MetadataExtractorAttr.Album); @@ -207,13 +200,13 @@ namespace Tizen.Multimedia TrackNumber = GetMetadata(handle, MetadataExtractorAttr.TrackNum); Classification = GetMetadata(handle, MetadataExtractorAttr.Classification); Rating = GetMetadata(handle, MetadataExtractorAttr.Rating); - Longitude = GetMetadata(handle, MetadataExtractorAttr.Longitude); - Latitude = GetMetadata(handle, MetadataExtractorAttr.Latitude); - Altitude = GetMetadata(handle, MetadataExtractorAttr.Altitude); + Longitude = ValueConverter.ToNullableDouble(GetMetadata(handle, MetadataExtractorAttr.Longitude)); + Latitude = ValueConverter.ToNullableDouble(GetMetadata(handle, MetadataExtractorAttr.Latitude)); + Altitude = ValueConverter.ToNullableDouble(GetMetadata(handle, MetadataExtractorAttr.Altitude)); Conductor = GetMetadata(handle, MetadataExtractorAttr.Conductor); - UnsyncLyric = GetMetadata(handle, MetadataExtractorAttr.UnSyncLyrics); - SyncLyricCount = GetMetadata(handle, MetadataExtractorAttr.SyncLyricsNum); - RecordingDate = GetMetadata(handle, MetadataExtractorAttr.RecordingDate); + UnsyncLyrics = GetMetadata(handle, MetadataExtractorAttr.UnSyncLyrics); + SyncLyricsCount = ValueConverter.ToInt(GetMetadata(handle, MetadataExtractorAttr.SyncLyricsNum)); + DateRecorded = GetMetadata(handle, MetadataExtractorAttr.RecordingDate); Rotation = GetMetadata(handle, MetadataExtractorAttr.Rotate); Content360 = GetMetadata(handle, MetadataExtractorAttr.ContentFor360); @@ -224,173 +217,175 @@ namespace Tizen.Multimedia /// Gets the duration of the media. /// /// 3 - /// A string representing the duration, or null if the information does not exists. - public string Duration { get; } + /// The duration value, or null if the information does not exist. + public int? Duration { get; } /// /// Gets the video metadata. /// /// 3 + /// The video metadata, or null if the information does not exist. public VideoMetadata Video { get; } /// /// Gets the audio metadata. /// /// 3 + /// The audio metadata, or null if the information does not exist. public AudioMetadata Audio { get; } /// /// Gets the artist of the media. /// /// 3 - /// A string representing the artist, or null if the information does not exists. + /// A string representing the artist, or null if the information does not exist. public string Artist { get; } /// /// Gets the title of the media. /// /// 3 - /// A string representing the title, or null if the information does not exists. + /// A string representing the title, or null if the information does not exist. public string Title { get; } /// /// Gets the album name of the media. /// /// 3 - /// A string representing the album name, or null if the information does not exists. + /// A string representing the album name, or null if the information does not exist. public string Album { get; } /// /// Gets the album artist of the media. /// /// 3 - /// A string representing the album artist, or null if the information does not exists. + /// A string representing the album artist, or null if the information does not exist. public string AlbumArtist { get; } /// /// Gets the genre of the media. /// /// 3 - /// A string representing the genre, or null if the information does not exists. + /// A string representing the genre, or null if the information does not exist. public string Genre { get; } /// /// Gets the author of the media. /// /// 3 - /// A string representing the author, or null if the information does not exists. + /// A string representing the author, or null if the information does not exist. public string Author { get; } /// /// Gets the copyright of the media. /// /// 3 - /// A string representing the copyright, or null if the information does not exists. + /// A string representing the copyright, or null if the information does not exist. public string Copyright { get; } /// /// Gets the release date of the media. /// /// 3 - /// A string representing the release date, or null if the information does not exists. + /// A string representing the release date, or null if the information does not exist. public string ReleaseDate { get; } /// /// Gets the description of the media. /// /// 3 - /// A string representing the description, or null if the information does not exists. + /// A string representing the description, or null if the information does not exist. public string Description { get; } /// /// Gets the comment of the media. /// /// 3 - /// A string representing the comment, or null if the information does not exists. + /// A string representing the comment, or null if the information does not exist. public string Comment { get; } /// /// Gets the track number of the media. /// /// 3 - /// A string representing the track number, or null if the information does not exists. + /// A string representing the track number, or null if the information does not exist. public string TrackNumber { get; } /// /// Gets the classification of the media. /// /// 3 - /// A string representing the classification, or null if the information does not exists. + /// A string representing the classification, or null if the information does not exist. public string Classification { get; } /// /// Gets the rating of the media. /// /// 3 - /// A string representing the rating, or null if the information does not exists. + /// A string representing the rating, or null if the information does not exist. public string Rating { get; } /// /// Gets the longitude of the media. /// /// 3 - /// A string representing the longitude, or null if the information does not exists. - public string Longitude { get; } + /// The longitude value, or null if the information does not exist. + public double? Longitude { get; } /// /// Gets the latitude of the media. /// /// 3 - /// A string representing the latitude, or null if the information does not exists. - public string Latitude { get; } + /// The latitude value, or null if the information does not exist. + public double? Latitude { get; } /// /// Gets the altitude of the media. /// /// 3 - /// A string representing the altitude, or null if the information does not exists. - public string Altitude { get; } + /// The altitude value, or null if the information does not exist. + public double? Altitude { get; } /// /// Gets the conductor of the media. /// /// 3 - /// A string representing the conductor, or null if the information does not exists. + /// A string representing the conductor, or null if the information does not exist. public string Conductor { get; } /// /// Gets the unsynchronized lyrics of the media. /// /// 3 - /// A string representing the unsynchronized lyrics, or null if the information does not exists. - public string UnsyncLyric { get; } + /// A string representing the unsynchronized lyrics, or null if the information does not exist. + public string UnsyncLyrics { get; } /// /// Gets the number of synchronized lyrics of the media. /// /// 3 - /// A string representing the number of the synchronized lyrics, or null if the information does not exists. - public string SyncLyricCount { get; } + /// The number of the synchronized lyrics. + public int SyncLyricsCount { get; } /// /// Gets the recording date of the media. /// /// 3 - /// A string representing the recording date, or null if the information does not exists. - public string RecordingDate { get; } + /// A string representing the recording date, or null if the information does not exist. + public string DateRecorded { get; } /// /// Gets the rotate(orientation) information of the media. /// /// 3 - /// A string representing the rotation information, or null if the information does not exists. + /// A string representing the rotation information, or null if the information does not exist. public string Rotation { get; } /// /// Gets the information for 360 content of the media. /// /// 3 - /// A string representing the information for 360 content, or null if the information does not exists. + /// A string representing the information for 360 content, or null if the information does not exist. public string Content360 { get; } private Lazy _description; diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractor.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractor.cs index 7b49cdf..bc3514c 100755 --- a/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractor.cs +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractor.cs @@ -1,18 +1,18 @@ /* -* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the License); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an AS IS BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ using System; using System.Runtime.InteropServices; @@ -243,7 +243,7 @@ namespace Tizen.Multimedia /// true to get an accurate frame for the given timestamp, /// otherwise false to get the nearest i-frame of the video rapidly. /// The raw frame data in RGB888 if a frame at specified time exists, otherwise null. - /// When internal process error is occured + /// An internal error occurs. /// The has been already disposed of. public byte[] GetFrameAt(uint timeStamp, bool accurate) { @@ -306,6 +306,9 @@ namespace Tizen.Multimedia } } + /// + /// Releases all resources used by the object. + /// public void Dispose() { Dispose(true); diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorAttr.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorAttr.cs index 8388dec..574e7a4 100644 --- a/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorAttr.cs +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorAttr.cs @@ -1,18 +1,18 @@ /* -* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the License); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an AS IS BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ namespace Tizen.Multimedia { diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorError.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorError.cs index 9902b33..36d40a2 100644 --- a/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorError.cs +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorError.cs @@ -1,19 +1,18 @@ /* -* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the License); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an AS IS BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ using System; using System.IO; diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/SyncLyrics.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/SyncLyrics.cs index a12d730..3081964 100755 --- a/src/Tizen.Multimedia.Metadata/MetadataExtractor/SyncLyrics.cs +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/SyncLyrics.cs @@ -1,18 +1,18 @@ /* -* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the License); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an AS IS BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ namespace Tizen.Multimedia { @@ -25,8 +25,8 @@ namespace Tizen.Multimedia /// Initialize a new instance of the MetadataExtractor class with the specified lyrics and timestamp. /// /// 3 - /// The text of synclyrics to set. - /// The timestamp of synclyrics to set. + /// The text of synchronized lyrics. + /// The timestamp of synchronized lyrics. public SyncLyrics(string lyrics, uint timestamp) { Lyrics = lyrics; @@ -34,13 +34,13 @@ namespace Tizen.Multimedia } /// - /// The text representation of the lyrics. + /// Gets the text representation of the lyrics. /// /// 3 public string Lyrics { get; } /// - /// The time information of the lyrics. + /// Gets the time information of the lyrics. /// /// 3 public uint Timestamp { get; } diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/ValueConverter.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/ValueConverter.cs new file mode 100644 index 0000000..aa6571e --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/ValueConverter.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using static Interop.MetadataExtractor; + +namespace Tizen.Multimedia +{ + internal static class ValueConverter + { + internal static int? ToNullableInt(string str) + { + if (int.TryParse(str, out var value)) + { + return value; + } + return null; + } + + internal static int ToInt(string str) + { + return int.TryParse(str, out var value) ? value : 0; + } + + internal static double? ToNullableDouble(string str) + { + if (double.TryParse(str, out var value)) + { + return value; + } + return null; + } + } +} \ No newline at end of file -- 2.7.4