From: coderhyme Date: Fri, 19 May 2017 02:21:16 +0000 (+0900) Subject: Added CodecNotSupportedException. X-Git-Tag: submit/trunk/20170823.075128~94^2~53^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7776e062c8ac9f955e166e89d27f633fd16b4020;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Added CodecNotSupportedException. This is an exception thrown if a codec is not supported. Change-Id: Iede40a7a55ef9d45caffd2e5eb34ccf7a12978ae Signed-off-by: coderhyme --- diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/PlayerEnums.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerEnums.cs index 7d1e9d2..e6a1071 100644 --- a/src/Tizen.Multimedia.MediaPlayer/Player/PlayerEnums.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerEnums.cs @@ -43,7 +43,8 @@ namespace Tizen.Multimedia DrmFutureUse = PlayerErrorCode.DrmFutureUse, DrmNotPermitted = PlayerErrorCode.DrmNotPermitted, ResourceLimit = PlayerErrorCode.ResourceLimit, - ServiceDisconnected = PlayerErrorCode.ServiceDisconnected + ServiceDisconnected = PlayerErrorCode.ServiceDisconnected, + SubtitleNotSupported = PlayerErrorCode.NotSupportedSubtitle, } /// diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/PlayerError.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerError.cs index 187c8bf..4beb26d 100644 --- a/src/Tizen.Multimedia.MediaPlayer/Player/PlayerError.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerError.cs @@ -44,7 +44,10 @@ namespace Tizen.Multimedia DrmFutureUse = PlayerErrorClass | 0x0a, DrmNotPermitted = PlayerErrorClass | 0x0b, ResourceLimit = PlayerErrorClass | 0x0c, - ServiceDisconnected = PlayerErrorClass | 0x0d + ServiceDisconnected = PlayerErrorClass | 0x0d, + NotSupportedAudioCodec = PlayerErrorClass | 0x0e, + NotSupportedVideoCodec = PlayerErrorClass | 0x0f, + NotSupportedSubtitle = PlayerErrorClass | 0x10 } internal static class PlayerErrorCodeExtensions @@ -99,6 +102,13 @@ namespace Tizen.Multimedia case PlayerErrorCode.ResourceLimit: throw new ResouceLimitException(msg); + + case PlayerErrorCode.NotSupportedAudioCodec: + throw new CodecNotSupportedException(CodecKind.Audio); + + case PlayerErrorCode.NotSupportedVideoCodec: + throw new CodecNotSupportedException(CodecKind.Video); + } throw new Exception(msg); diff --git a/src/Tizen.Multimedia/Common/CodecNotSupportedException.cs b/src/Tizen.Multimedia/Common/CodecNotSupportedException.cs new file mode 100644 index 0000000..ed8dec6 --- /dev/null +++ b/src/Tizen.Multimedia/Common/CodecNotSupportedException.cs @@ -0,0 +1,66 @@ +/* + * 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; + +namespace Tizen.Multimedia +{ + /// + /// Specifies whether a codec is audio codec or video codec. + /// + public enum CodecKind + { + /// + /// Audio codec + /// + Audio, + + /// + /// Video codec + /// + Video + } + + /// + /// The exception that is thrown when the codec for an input file or a data stream is not supported + /// or the input is malformed. + /// + public class CodecNotSupportedException : InvalidOperationException + { + /// + /// Initializes a new instance of the class + /// with indicating which codec is not supported. + /// + public CodecNotSupportedException(CodecKind kind) + { + CodecKind = kind; + } + + /// + /// Initializes a new instance of the class with + /// indicating which codec is not supported and a specified error message. + /// + public CodecNotSupportedException(CodecKind kind, string message) : base(message) + { + CodecKind = kind; + } + + /// + /// Gets the of the exception. + /// + public CodecKind CodecKind { get; } + } +}