CAF state bug fix
[platform/framework/native/media.git] / src / FMediaVideoStreamInfo.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #include "FMediaVideoStreamInfo.h"
19 #include "FMediaMediaStreamInfo.h"
20 #include "FMedia_VideoStreamInfoImpl.h"
21 #include <FBaseSysLog.h>
22 #include "stdio.h"
23
24 using namespace Tizen::Base;
25 using namespace Tizen::Base::Collection;
26
27 namespace Tizen { namespace Media
28 {
29
30 VideoStreamInfo::VideoStreamInfo(CodecType codecType, int width, int height, int bitrate, float frameRate)
31 {
32         __pVideoStreamInfoImpl = new  (std::nothrow)  _VideoStreamInfoImpl(codecType, width, height, bitrate, frameRate);
33 }
34
35 VideoStreamInfo::~VideoStreamInfo()
36 {
37         if (__pVideoStreamInfoImpl)
38         {
39                 delete __pVideoStreamInfoImpl;
40         }
41         __pVideoStreamInfoImpl = null;
42 }
43
44
45 VideoStreamInfo::VideoStreamInfo(const VideoStreamInfo& rhs)
46         : Tizen::Base::Object()
47         , __pVideoStreamInfoImpl(new (std::nothrow) _VideoStreamInfoImpl(*rhs.__pVideoStreamInfoImpl))
48 {
49 }
50
51 VideoStreamInfo&
52 VideoStreamInfo::operator =(const VideoStreamInfo& rhs)
53 {
54         if (this == &rhs)
55         {
56                 return *this;
57         }
58         *__pVideoStreamInfoImpl = *rhs.__pVideoStreamInfoImpl;
59
60         return *this;
61 }
62
63
64 bool
65 VideoStreamInfo::Equals(const Tizen::Base::Object& rhs) const
66 {
67         const VideoStreamInfo* pRhs = dynamic_cast <const VideoStreamInfo*>(&rhs);
68         if (pRhs == null)
69         {
70                 return false;
71         }
72
73         return __pVideoStreamInfoImpl->Equals(*pRhs->__pVideoStreamInfoImpl);
74 }
75
76 int
77 VideoStreamInfo::GetHashCode(void) const
78 {
79         return __pVideoStreamInfoImpl->GetHashCode();
80
81 }
82
83 int
84 VideoStreamInfo::GetWidth() const
85 {
86         if (__pVideoStreamInfoImpl)
87         {
88                 return __pVideoStreamInfoImpl->GetWidth();
89         }
90         else
91         {
92                 return 0;
93         }
94 }
95
96 int
97 VideoStreamInfo::GetHeight() const
98 {
99         if (__pVideoStreamInfoImpl)
100         {
101                 return __pVideoStreamInfoImpl->GetHeight();
102         }
103         else
104         {
105                 return 0;
106         }
107 }
108
109 int
110 VideoStreamInfo::GetBitRate() const
111 {
112         if (__pVideoStreamInfoImpl)
113         {
114                 return __pVideoStreamInfoImpl->GetBitRate();
115         }
116         else
117         {
118                 return 0;
119         }
120 }
121
122 CodecType
123 VideoStreamInfo::GetCodecType() const
124 {
125         if (__pVideoStreamInfoImpl)
126         {
127                 return __pVideoStreamInfoImpl->GetCodecType();
128         }
129         else
130         {
131                 return CODEC_NONE;
132         }
133 }
134
135 //Rational
136 float
137 VideoStreamInfo::GetFrameRate() const
138 {
139         if (__pVideoStreamInfoImpl)
140         {
141                 return __pVideoStreamInfoImpl->GetFrameRate();
142         }
143         else
144         {
145                 return 0.0;
146         }
147 }
148
149 };
150 };