diff options
author | Minje Ahn <minje.ahn@samsung.com> | 2017-03-15 15:32:33 +0900 |
---|---|---|
committer | Minje Ahn <minje.ahn@samsung.com> | 2017-03-15 17:08:50 +0900 |
commit | 84e64bf84d8a02ee84981d2218b997c7fbc549a7 (patch) | |
tree | 179c47df72f6bfeb97def7985844839d7689302c | |
parent | a453bd9b055a178a54e00c3bed39c6aaf090059c (diff) | |
download | media-content-84e64bf84d8a02ee84981d2218b997c7fbc549a7.tar.gz media-content-84e64bf84d8a02ee84981d2218b997c7fbc549a7.tar.bz2 media-content-84e64bf84d8a02ee84981d2218b997c7fbc549a7.zip |
Apply coding rulesubmit/tizen/20170316.000240accepted/tizen/unified/20170316.101247accepted/tizen/tv/20170316.101209accepted/tizen/mobile/20170316.101151accepted/tizen/ivi/20170316.101230
Change-Id: I354ac12b92672218ccae1230ff6f572e26a3db10
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
22 files changed, 214 insertions, 128 deletions
diff --git a/Tizen.Content.MediaContent/Interop/Interop.Libc.cs b/Tizen.Content.MediaContent/Interop/Interop.Libc.cs index 420eef4..c9e7ff8 100755 --- a/Tizen.Content.MediaContent/Interop/Interop.Libc.cs +++ b/Tizen.Content.MediaContent/Interop/Interop.Libc.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; diff --git a/Tizen.Content.MediaContent/Interop/Interop.Libraries.cs b/Tizen.Content.MediaContent/Interop/Interop.Libraries.cs index 5613200..a2d161e 100755 --- a/Tizen.Content.MediaContent/Interop/Interop.Libraries.cs +++ b/Tizen.Content.MediaContent/Interop/Interop.Libraries.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. + */ internal static partial class Interop diff --git a/Tizen.Content.MediaContent/Interop/Interop.MediaBookmark.cs b/Tizen.Content.MediaContent/Interop/Interop.MediaBookmark.cs index 19d548b..6639fbb 100755 --- a/Tizen.Content.MediaContent/Interop/Interop.MediaBookmark.cs +++ b/Tizen.Content.MediaContent/Interop/Interop.MediaBookmark.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; diff --git a/Tizen.Content.MediaContent/Interop/Interop.MediaFace.cs b/Tizen.Content.MediaContent/Interop/Interop.MediaFace.cs index f2a4688..ce88a2c 100755 --- a/Tizen.Content.MediaContent/Interop/Interop.MediaFace.cs +++ b/Tizen.Content.MediaContent/Interop/Interop.MediaFace.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; diff --git a/Tizen.Content.MediaContent/Interop/Interop.MediaFilter.cs b/Tizen.Content.MediaContent/Interop/Interop.MediaFilter.cs index 42382a3..f66986b 100755 --- a/Tizen.Content.MediaContent/Interop/Interop.MediaFilter.cs +++ b/Tizen.Content.MediaContent/Interop/Interop.MediaFilter.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; diff --git a/Tizen.Content.MediaContent/Interop/Interop.MediaInformation.cs b/Tizen.Content.MediaContent/Interop/Interop.MediaInformation.cs index 77852a3..5d994fc 100755 --- a/Tizen.Content.MediaContent/Interop/Interop.MediaInformation.cs +++ b/Tizen.Content.MediaContent/Interop/Interop.MediaInformation.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; diff --git a/Tizen.Content.MediaContent/Interop/Interop.MediaStorage.cs b/Tizen.Content.MediaContent/Interop/Interop.MediaStorage.cs index 1e3239b..b17768e 100755 --- a/Tizen.Content.MediaContent/Interop/Interop.MediaStorage.cs +++ b/Tizen.Content.MediaContent/Interop/Interop.MediaStorage.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; diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Album.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Album.cs index 16a8f78..49268cc 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Album.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Album.cs @@ -135,7 +135,8 @@ namespace Tizen.Content.MediaContent public override void Dispose() { - if (_albumHandle != IntPtr.Zero) { + if (_albumHandle != IntPtr.Zero) + { Interop.Group.MediaAlbumDestroy(_albumHandle); _albumHandle = IntPtr.Zero; } diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/AudioInformation.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/AudioInformation.cs index e65dbe7..90aeea2 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/AudioInformation.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/AudioInformation.cs @@ -408,6 +408,7 @@ namespace Tizen.Content.MediaContent break; } } + bookmarkfilter.Dispose(); return result; } diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentDatabase.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentDatabase.cs index f414d7b..43f3d98 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentDatabase.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentDatabase.cs @@ -47,6 +47,7 @@ namespace Tizen.Content.MediaContent internal ContentDatabase() { } + internal void ConnectToDB() { if (!_isConnected) @@ -56,6 +57,7 @@ namespace Tizen.Content.MediaContent _isConnected = true; } } + private void DisconnectFromDB() { if (_isConnected) @@ -77,11 +79,11 @@ namespace Tizen.Content.MediaContent string mimeType, IntPtr userData) => { - s_contentUpdated?.Invoke( + _contentUpdated?.Invoke( null, new ContentUpdatedEventArgs(error, pid, updateItem, updateType, mediaType, uuid, filePath, mimeType)); }; - private static event EventHandler<ContentUpdatedEventArgs> s_contentUpdated; + private static event EventHandler<ContentUpdatedEventArgs> _contentUpdated; /// <summary> /// ContentUpdated event is triggered when the media DB changes. /// </summary> @@ -91,18 +93,19 @@ namespace Tizen.Content.MediaContent { add { - if (s_contentUpdated == null) + if (_contentUpdated == null) { MediaContentValidator.ThrowIfError( Interop.Content.SetDbUpdatedCb(s_contentUpdatedCallback, IntPtr.Zero), "Failed to set callback"); } - s_contentUpdated += value; + + _contentUpdated += value; } remove { - s_contentUpdated -= value; - if (s_contentUpdated == null) + _contentUpdated -= value; + if (_contentUpdated == null) { MediaContentValidator.ThrowIfError( Interop.Content.UnsetDbUpdatedCb(), "Failed to unset callback"); @@ -264,6 +267,7 @@ namespace Tizen.Content.MediaContent return (T)result; } + return null; } @@ -396,7 +400,9 @@ namespace Tizen.Content.MediaContent /// This function gets all ContentCollections matching the given filter. If NULL is passed to the filter, no filtering is applied. /// </remarks> /// <param name="filter">Filter for content items</param> - /// <returns></returns> + /// <returns> + /// Task with the list of the ContentCollection + /// </returns> public Task<IEnumerable<T>> SelectAsync<T>(ContentFilter filter) { ConnectToDB(); @@ -436,6 +442,7 @@ namespace Tizen.Content.MediaContent IEnumerable<PlayList> collectionList = ForEachPlayList(filter); task.TrySetResult((IEnumerable<T>)collectionList); } + return task.Task; } diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentFilter.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentFilter.cs index 822b9d5..9f4d848 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentFilter.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentFilter.cs @@ -124,17 +124,20 @@ namespace Tizen.Content.MediaContent return offset; } + set { MediaContentValidator.ThrowIfError( Interop.Filter.SetOffset(_filterHandle, value, this.Count), "Failed to set offset"); } } + public ContentFilter() { MediaContentValidator.ThrowIfError( Interop.Filter.Create(out _filterHandle), "Failed to Create Filter handle."); } + /// <summary> /// The number of items to be searched with respect to the offset /// </summary> @@ -149,12 +152,14 @@ namespace Tizen.Content.MediaContent return count; } + set { MediaContentValidator.ThrowIfError( Interop.Filter.SetOffset(_filterHandle, this.Offset, value), "Failed to set count"); } } + /// <summary> /// Gets the media filter content order and order keyword. /// </summary> @@ -178,6 +183,7 @@ namespace Tizen.Content.MediaContent } } } + /// <summary> /// The collate type for comparing two strings /// </summary> @@ -199,12 +205,14 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( Interop.Filter.SetCondition(_filterHandle, this.Condition, value), "Failed to set collation"); } } + /// <summary> /// Gets/Sets the condition for the given filter. /// </summary> @@ -226,12 +234,14 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( Interop.Filter.SetCondition(_filterHandle, value, this.CollationType), "Failed to set condition"); } } + /// <summary> /// Sets the storage id for the given filter. /// You can use this property when you want to search items only in the specific storage @@ -253,12 +263,14 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( Interop.Filter.SetStorage(_filterHandle, value), "Failed to set condition"); } } + /// <summary> /// The search order keyword /// </summary> @@ -291,6 +303,8 @@ namespace Tizen.Content.MediaContent /// <summary> /// SetOrderProperties like OrderType and OrderKey. /// </summary> + /// <param name="order">ordering type</param> + /// <param name="oderKey">Keywords to sort</param> public void SetOrderProperties(ContentOrder order, string oderKey) { MediaContentValidator.ThrowIfError( @@ -317,6 +331,7 @@ namespace Tizen.Content.MediaContent Interop.Filter.Destroy(_filterHandle); _filterHandle = IntPtr.Zero; } + _disposedValue = true; } } diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentManager.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentManager.cs index e662ff6..c5280ce 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentManager.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentManager.cs @@ -79,6 +79,7 @@ namespace Tizen.Content.MediaContent /// Inserts a media to the media database /// </summary> /// <param name="filePath">File path of the media to be inserted</param> + /// <returns>the MediaInformation instance about added media path</returns> public static MediaInformation AddMediaInformation(string filePath) { Database.ConnectToDB(); @@ -99,6 +100,7 @@ namespace Tizen.Content.MediaContent /// The sub folders are also scanned,if there are sub folders in that folder. /// If any folder must not be scanned, a blank file ".scan_ignore" has to be created in that folder. /// </remarks> + /// <returns>Task with scanning result</returns> public static Task ScanFolderAsync(string folderPath, bool recursive = true) { var task = new TaskCompletionSource<int>(); @@ -128,6 +130,7 @@ namespace Tizen.Content.MediaContent /// The sub folders are also scanned,if there are sub folders in that folder. /// If any folder must not be scanned, a blank file ".scan_ignore" has to be created in that folder. /// </remarks> + /// <returns>Task with scanning result</returns> public static Task ScanFolderAsync(string folderPath, CancellationToken cancellationToken, bool recursive = true) { var task = new TaskCompletionSource<int>(); @@ -171,7 +174,9 @@ namespace Tizen.Content.MediaContent /// Inserts media files into the media database, asynchronously. /// </summary> /// <param name="filePaths">The path array to the media files</param> - /// <returns></returns> + /// <returns> + /// Task with the result of batch insertion + /// </returns> public static Task AddMediaInformationBatchAsync(IEnumerable<string> filePaths) { Database.ConnectToDB(); @@ -192,7 +197,9 @@ namespace Tizen.Content.MediaContent /// Inserts the burst shot images into the media database, asynchronously. /// </summary> /// <param name="filePaths">The path array to the burst shot images</param> - /// <returns></returns> + /// <returns> + /// Task with the result of the burstshot insertion + /// </returns> public static Task AddBurstShotImagesAsync(IEnumerable<string> filePaths) { Database.ConnectToDB(); @@ -215,7 +222,7 @@ namespace Tizen.Content.MediaContent /// without calling this function.This function is only called when the media server is busy and user needs to get quick result of deleting. /// </summary> /// <param name="filter">The content filter to which media will be matched</param> - /// <returns></returns> + /// <returns>Task with the removal result </returns> public static Task RemoveMediaInformationBatchAsync(ContentFilter filter) { Database.ConnectToDB(); diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ImageInformation.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ImageInformation.cs index fc137ea..2aab73d 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ImageInformation.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ImageInformation.cs @@ -95,6 +95,7 @@ namespace Tizen.Content.MediaContent return orientation; } + set { MediaContentValidator.ThrowIfError( @@ -288,6 +289,7 @@ namespace Tizen.Content.MediaContent /// </summary> /// <param name="image">The image on which face is to be added</param> /// <param name="rect">The dimensions of the face</param> + /// <returns>The MediaFace instance</returns> public MediaFace AddFace(ImageInformation image, FaceRect rect) { MediaFace face = new MediaFace(image, rect); diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaBookmark.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaBookmark.cs index c172f89..6b4d5d6 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaBookmark.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaBookmark.cs @@ -102,8 +102,11 @@ namespace Tizen.Content.MediaContent { _offset = offset; if (thumbnailPath != null) + { _thumbnailPath = thumbnailPath; + } } + public void Dispose() { Dispose(true); @@ -119,6 +122,7 @@ namespace Tizen.Content.MediaContent Interop.Face.Destroy(_bookmarkHandle); _bookmarkHandle = IntPtr.Zero; } + _disposedValue = true; } } diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentError.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentError.cs index 595d82e..fc741a6 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentError.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentError.cs @@ -40,6 +40,7 @@ namespace Tizen.Content.MediaContent UnsupportedContent = TizenMediaContentError | 0x04, NotSupported = ErrorCode.NotSupported, } + internal class MediaContentValidator { internal const string LogTag = "Tizen.Content.MediaContent"; diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFace.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFace.cs index cdfe8ed..522376a 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFace.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFace.cs @@ -34,6 +34,7 @@ namespace Tizen.Content.MediaContent { return _faceHandle; } + set { _faceHandle = value; @@ -45,12 +46,14 @@ namespace Tizen.Content.MediaContent { _faceHandle = handle; } + /// <summary> /// Create Face for Given Image /// </summary> /// <param name="image"> ///image item through which FaceRect has to be tagged. ///</param> + ///<param name="rect">Position about the detacted face in the media</param> internal MediaFace(MediaInformation image, FaceRect rect) { MediaContentValidator.ThrowIfError( @@ -89,6 +92,7 @@ namespace Tizen.Content.MediaContent return new FaceRect(x, y, width, height); } + set { FaceRect rect = (FaceRect)value; @@ -160,6 +164,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -180,6 +185,7 @@ namespace Tizen.Content.MediaContent return (MediaContentOrientation)orientation; } + set { MediaContentValidator.ThrowIfError( @@ -205,6 +211,7 @@ namespace Tizen.Content.MediaContent Interop.Face.Destroy(_faceHandle); _faceHandle = IntPtr.Zero; } + _disposedValue = true; } } diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFolder.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFolder.cs index d3bfac0..6f425ae 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFolder.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFolder.cs @@ -38,6 +38,7 @@ namespace Tizen.Content.MediaContent { return _folderHandle; } + set { _folderHandle = value; @@ -129,6 +130,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -204,6 +206,7 @@ namespace Tizen.Content.MediaContent return order; } + set { MediaContentValidator.ThrowIfError( @@ -236,6 +239,7 @@ namespace Tizen.Content.MediaContent { Dispose(false); } + public override void Dispose() { Dispose(true); @@ -248,14 +252,14 @@ namespace Tizen.Content.MediaContent { if (_folderHandle != IntPtr.Zero) { - Console.WriteLine("Before destroy"); Interop.Folder.Destroy(_folderHandle); _folderHandle = IntPtr.Zero; - Console.WriteLine("After destroy"); } + _disposedValue = true; } } + /// <summary> /// Iterates through the media files with an filter in the given folder from the media database. /// This function gets all media files associated with the given folder and meeting desired filter option. diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInformation.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInformation.cs index 2bffcd5..22eebdd 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInformation.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInformation.cs @@ -99,21 +99,27 @@ namespace Tizen.Content.MediaContent /// which can be cancelled /// If a thumbnail already exists for the given media, then the path of thumbnail will be returned. /// </summary> + /// <param name="cancellationToken">Token to cancel the requested operation</param> /// <returns> - /// Task for creation of Thumbnail </returns> + /// Task for creation of Thumbnail + /// </returns> public async Task<string> CreateThumbnailAsync(CancellationToken cancellationToken) { var task = new TaskCompletionSource<string>(); - cancellationToken.Register(() => { + cancellationToken.Register(() => + { MediaContentValidator.ThrowIfError( Interop.MediaInformation.CancelThumbnail(_handle), "Failed to cancel"); + task.SetCanceled(); }); + Interop.MediaInformation.MediaThumbnailCompletedCallback thumbnailResult = (MediaContentError createResult, string path, IntPtr userData) => { MediaContentValidator.ThrowIfError(createResult, "Failed to create thumbnail"); task.SetResult(path); }; + MediaContentValidator.ThrowIfError( Interop.MediaInformation.CreateThumbnail(_handle, thumbnailResult, IntPtr.Zero), "Failed to create thumbnail"); @@ -212,6 +218,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -286,6 +293,7 @@ namespace Tizen.Content.MediaContent return utc.ToLocalTime(); } + set { MediaContentValidator.ThrowIfError( @@ -370,6 +378,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -391,6 +400,7 @@ namespace Tizen.Content.MediaContent return longitude; } + set { MediaContentValidator.ThrowIfError( @@ -412,6 +422,7 @@ namespace Tizen.Content.MediaContent return latitude; } + set { MediaContentValidator.ThrowIfError( @@ -433,6 +444,7 @@ namespace Tizen.Content.MediaContent return altitude; } + set { MediaContentValidator.ThrowIfError( @@ -460,6 +472,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -479,6 +492,7 @@ namespace Tizen.Content.MediaContent Interop.MediaInformation.GetRating(_handle, out rating), "Failed to get value"); return rating; } + set { MediaContentValidator.ThrowIfError( @@ -500,6 +514,7 @@ namespace Tizen.Content.MediaContent return isFavourtite; } + set { MediaContentValidator.ThrowIfError( @@ -527,6 +542,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -554,6 +570,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -581,6 +598,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -631,6 +649,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -658,6 +677,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -685,6 +705,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -712,6 +733,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -785,6 +807,7 @@ namespace Tizen.Content.MediaContent return playedCount; } + set { MediaContentValidator.ThrowIfError( @@ -808,6 +831,7 @@ namespace Tizen.Content.MediaContent return utc.ToLocalTime(); } + set { MediaContentValidator.ThrowIfError( diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/PlayList.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/PlayList.cs index 9a8d716..88b1620 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/PlayList.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/PlayList.cs @@ -39,13 +39,14 @@ namespace Tizen.Content.MediaContent { return _playlistHandle; } + set { _playlistHandle = value; } } - private void refreshPlaylistDictionary() + private void RefreshPlaylistDictionary() { _dictionary.Clear(); Interop.Playlist.PlaylistMemberCallback callback = (int memberId, IntPtr mediaHandle, IntPtr data) => @@ -95,6 +96,7 @@ namespace Tizen.Content.MediaContent { return _playListName; } + set { MediaContentValidator.ThrowIfError( @@ -121,6 +123,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + set { MediaContentValidator.ThrowIfError( @@ -170,7 +173,7 @@ namespace Tizen.Content.MediaContent public void RemoveItem(MediaInformation media) { int memberId = 0; - refreshPlaylistDictionary(); + RefreshPlaylistDictionary(); _dictionary.TryGetValue(media.MediaId, out memberId); MediaContentValidator.ThrowIfError( Interop.Playlist.RemoveMedia(_playlistHandle, memberId), "Failed to remove item"); @@ -184,7 +187,7 @@ namespace Tizen.Content.MediaContent public void SetPlayOrder(MediaInformation media, int playOrder) { int memberId; - refreshPlaylistDictionary(); + RefreshPlaylistDictionary(); _dictionary.TryGetValue(media.MediaId, out memberId); MediaContentValidator.ThrowIfError( Interop.Playlist.SetPlayOrder(_playlistHandle, memberId, playOrder), "Failed to set play order"); @@ -193,12 +196,13 @@ namespace Tizen.Content.MediaContent /// <summary> /// Gets the playing order in the playlist for the passed member id. /// </summary> - /// <param name="media"></param> + /// <param name="media">The MediaInformation instance</param> + /// <returns>The number of play order</returns> public int GetPlayOrder(MediaInformation media) { int playOrder; int memberId; - refreshPlaylistDictionary(); + RefreshPlaylistDictionary(); _dictionary.TryGetValue(media.MediaId, out memberId); MediaContentValidator.ThrowIfError( Interop.Playlist.GetPlayOrder(_playlistHandle, memberId, out playOrder), "Failed to get play order"); @@ -228,6 +232,8 @@ namespace Tizen.Content.MediaContent /// <summary> /// Exports the playlist to m3u playlist file. /// </summary> + /// <param name="list">The playlist instance to export</param> + /// <param name="filePath">The path to save exported playlist</param> /// <returns>path The path to export the playlist</returns> public static void Export(PlayList list, string filePath) { @@ -252,7 +258,8 @@ namespace Tizen.Content.MediaContent public override void Dispose() { - if (_playlistHandle != IntPtr.Zero) { + if (_playlistHandle != IntPtr.Zero) + { Interop.Playlist.Destroy(_playlistHandle); _playlistHandle = IntPtr.Zero; } diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Tag.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Tag.cs index d398df6..6766005 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Tag.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Tag.cs @@ -36,6 +36,7 @@ namespace Tizen.Content.MediaContent { return _tagHandle; } + set { _tagHandle = value; @@ -64,6 +65,7 @@ namespace Tizen.Content.MediaContent { return _tagName; } + set { MediaContentValidator.ThrowIfError( @@ -87,6 +89,7 @@ namespace Tizen.Content.MediaContent Interop.Libc.Free(val); } } + /// <summary> /// Creates a Tag object which can be inserted to the media database using ContentManager:InsertToDatabaseAsync(ContentCollection) /// </summary> @@ -162,10 +165,12 @@ namespace Tizen.Content.MediaContent mediaContents.Add(new MediaInformation(newHandle)); return true; }; + MediaContentValidator.ThrowIfError( Interop.Tag.ForeachMediaFromDb(Id, handle, callback, IntPtr.Zero), "Failed to get information"); tcs.TrySetResult(mediaContents); + return tcs.Task; } } diff --git a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/VideoInformation.cs b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/VideoInformation.cs index da2c172..6eeeec4 100755 --- a/Tizen.Content.MediaContent/Tizen.Content.MediaContent/VideoInformation.cs +++ b/Tizen.Content.MediaContent/Tizen.Content.MediaContent/VideoInformation.cs @@ -364,7 +364,7 @@ namespace Tizen.Content.MediaContent /// </summary> /// <param name="offset">Offset of the video in seconds</param> /// <param name="thumbnailPath">Thumbnail path for the bookmark</param> - /// <returns></returns> + /// <returns>Task with added MediaBookmark instance </returns> public async Task<MediaBookmark> AddBookmark(uint offset, string thumbnailPath) { MediaBookmark result = null; @@ -381,6 +381,7 @@ namespace Tizen.Content.MediaContent break; } } + bookmarkfilter.Dispose(); return result; } diff --git a/packaging/csapi-media-content.spec b/packaging/csapi-media-content.spec index 186f474..1d0ba47 100755 --- a/packaging/csapi-media-content.spec +++ b/packaging/csapi-media-content.spec @@ -1,6 +1,6 @@ Name: csapi-media-content Summary: Tizen Media Content API for C# -Version: 1.0.8 +Version: 1.0.9 Release: 1 Group: Development/Libraries License: Apache-2.0 |