CAF state bug fix
[platform/framework/native/media.git] / src / FMedia_VideoStreamInfoImpl.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 "FMedia_VideoStreamInfoImpl.h"
19
20
21 namespace Tizen { namespace Media
22 {
23
24 using namespace Tizen::Base;
25
26 _VideoStreamInfoImpl::_VideoStreamInfoImpl(CodecType codecType, int width, int height, int bitrate, float frameRate)
27 {
28         __codecType = codecType;
29         __width = width;
30         __height = height;
31         __bitrate = bitrate;
32         __frameRate = frameRate;
33 }
34
35 _VideoStreamInfoImpl::~_VideoStreamInfoImpl()
36 {
37
38 }
39
40 _VideoStreamInfoImpl::_VideoStreamInfoImpl(const _VideoStreamInfoImpl& rhs)
41 {
42         __codecType = rhs.__codecType;
43         __bitrate = rhs.__bitrate;
44         __width = rhs.__width;
45         __height = rhs.__height;
46         __frameRate = rhs.__frameRate;
47 }
48
49 _VideoStreamInfoImpl&
50 _VideoStreamInfoImpl::operator =(const _VideoStreamInfoImpl& rhs)
51 {
52         // check for self-assignment
53         if (this == &rhs)
54         {
55                 return *this;
56         }
57
58         __codecType = rhs.__codecType;
59         __bitrate = rhs.__bitrate;
60         __width = rhs.__width;
61         __height = rhs.__height;
62         __frameRate = rhs.__frameRate;
63
64         return *this;
65 }
66
67 bool
68 _VideoStreamInfoImpl::Equals(const Object& info) const
69 {
70         const _VideoStreamInfoImpl* pVideoStreamInfoImpl = dynamic_cast <const _VideoStreamInfoImpl *> (&info);
71         if (!pVideoStreamInfoImpl)
72         {
73                 return false;
74         }
75         return (((__codecType == pVideoStreamInfoImpl->__codecType) && (__width == pVideoStreamInfoImpl->__width)
76                 && (__height == pVideoStreamInfoImpl->__height) && (__bitrate == pVideoStreamInfoImpl->__bitrate ) &&
77                 (!Float::Compare(this->__frameRate, pVideoStreamInfoImpl->__frameRate))) ? true : false);
78 }
79
80 int
81 _VideoStreamInfoImpl::GetHashCode(void) const
82 {
83         int framerate = (int)__frameRate;
84         int codecType = (int)__codecType;
85         return ((framerate ^ codecType) + (__width * __height) + (__bitrate));
86 }
87
88 int
89 _VideoStreamInfoImpl::GetWidth() const
90 {
91         return __width;
92 }
93
94 int
95 _VideoStreamInfoImpl::GetHeight() const
96 {
97         return __height;
98 }
99
100 int
101 _VideoStreamInfoImpl::GetBitRate() const
102 {
103         return __bitrate;
104 }
105
106 CodecType
107 _VideoStreamInfoImpl::GetCodecType() const
108 {
109         return __codecType;
110
111 }
112
113 //Rational
114 float
115 _VideoStreamInfoImpl::GetFrameRate() const
116 {
117         return __frameRate;
118 }
119
120 };
121 };