Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.StreamRecorder / StreamRecorder / StreamRecorderVideoResolution.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 Native = Interop.StreamRecorder;
19
20 namespace Tizen.Multimedia
21 {
22     /// <summary>
23     /// Resolution for stream recorder.
24     /// </summary>
25     public class StreamRecorderVideoResolution
26     {
27         private int _width, _height;
28         private bool _interopFlag;
29         internal IntPtr _Handle;
30
31         internal StreamRecorderVideoResolution(IntPtr handle)
32         {
33             _Handle = handle;
34             _interopFlag = true;
35             int ret = Native.GetVideoResolution(_Handle, out _width, out _height);
36             StreamRecorderError err = (StreamRecorderError)ret;
37             Log.Info(StreamRecorderLog.Tag, "width " + _width + " height " + _height + "return " + err.ToString());
38         }
39
40         internal StreamRecorderVideoResolution(int width, int height)
41         {
42             _interopFlag = false;
43             _width = width;
44             _height = height;
45         }
46
47         /// <summary>
48         /// The video width.
49         /// </summary>
50         /// <value>The width.</value>
51         public int Width {
52             get {
53                 if(_interopFlag == true)
54                     Native.GetVideoResolution(_Handle, out _width, out _height);
55                 return _width;
56             }
57             set {
58                 _width = value;
59                 if(_interopFlag == true) {
60                     int ret = Native.SetVideoResolution(_Handle, _width, _height);
61                     StreamRecorderError err = (StreamRecorderError)ret;
62                     Log.Info(StreamRecorderLog.Tag, " set width " + _width + " height " + _height + "set return " + err.ToString());
63                 }
64             }
65         }
66
67         /// <summary>
68         /// The video height.
69         /// </summary>
70         /// <value>The height.</value>
71         public int Height {
72             get {
73                 if(_interopFlag == true)
74                     Native.GetVideoResolution(_Handle, out _width, out _height);
75                 return _height;
76             }
77             set {
78                 _height = value;
79                 if(_interopFlag == true) {
80                     int ret = Native.SetVideoResolution(_Handle, _width, _height);
81                     StreamRecorderError err = (StreamRecorderError)ret;
82                     Log.Info(StreamRecorderLog.Tag, " set width " + _width + " height " + _height + "set return " + err.ToString());
83                 }
84             }
85         }
86     }
87 }