change \n to <br/> for Doc
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.Remoting / ScreenMirroring / ScreenMirroringVideoInfo.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18 using static Tizen.Multimedia.Remoting.InteropHelper;
19 using Native = Interop.ScreenMirroring;
20
21 namespace Tizen.Multimedia.Remoting
22 {
23     /// <summary>
24     /// Provides a means to retrieve the video information which is negotiated with the source device.
25     /// </summary>
26     public class ScreenMirroringVideoInfo
27     {
28         private readonly ScreenMirroring _owner;
29
30         internal ScreenMirroringVideoInfo(ScreenMirroring owner)
31         {
32             _owner = owner;
33         }
34
35         /// <summary>
36         /// Gets the negotiated video codec.
37         /// </summary>
38         /// <exception cref="InvalidOperationException">
39         ///     Not connected to a source.<br/>
40         ///     <br/>
41         ///     An internal error occurs.
42         /// </exception>
43         /// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception>
44         public ScreenMirroringVideoCodec Codec
45         {
46             get
47             {
48                 _owner.ThrowIfNotConnected();
49
50                 GetValue(Native.GetNegotiatedVideoCodec, _owner.Handle, out ScreenMirroringVideoCodec value).
51                     ThrowIfError("Failed to get video codec.");
52
53                 return value;
54             }
55         }
56
57         /// <summary>
58         /// Gets the negotiated video resolution.
59         /// </summary>
60         /// <exception cref="InvalidOperationException">
61         ///     Not connected to a source.<br/>
62         ///     <br/>
63         ///     An internal error occurs.
64         /// </exception>
65         /// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception>
66         public Size Resolution
67         {
68             get
69             {
70                 _owner.ThrowIfNotConnected();
71
72                 var handle = _owner.Handle;
73                 Native.GetNegotiatedVideoResolution(ref handle, out var width, out var height).
74                     ThrowIfError("Failed to get resolution.");
75
76                 return new Size(width, height);
77             }
78         }
79
80         /// <summary>
81         /// Gets the negotiated video frame rate.
82         /// </summary>
83         /// <exception cref="InvalidOperationException">
84         ///     Not connected to a source.<br/>
85         ///     <br/>
86         ///     An internal error occurs.
87         /// </exception>
88         /// <exception cref="ObjectDisposedException">The <see cref="ScreenMirroring"/> has already been disposed.</exception>
89         public int FrameRate
90         {
91             get
92             {
93                 _owner.ThrowIfNotConnected();
94
95                 GetValue(Native.GetNegotiatedVideoFrameRate, _owner.Handle, out int value).
96                     ThrowIfError("Failed to get video frame rate.");
97
98                 return value;
99             }
100         }
101     }
102 }