CAF state bug fix
[platform/framework/native/media.git] / src / FMedia_AudioStreamInfoImpl.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 /**
19 * @file         FMedia__AudioStreamInfoImplImpl.cpp
20 * @brief                This file contains the implementation of subsystem's Player.
21 */
22
23 #include "FMedia_AudioStreamInfoImpl.h"
24
25 using namespace Tizen::Base;
26
27 namespace Tizen { namespace Media
28 {
29
30 _AudioStreamInfoImpl::_AudioStreamInfoImpl(CodecType codecType, int bitrate, int sampleRate, AudioChannelType channel)
31 {
32         __codecType = codecType;
33         __bitrate = bitrate;
34         __sampleRate = sampleRate;
35         __channel = channel;
36 }
37
38 _AudioStreamInfoImpl::~_AudioStreamInfoImpl()
39 {
40
41 }
42
43 _AudioStreamInfoImpl::_AudioStreamInfoImpl(const _AudioStreamInfoImpl& rhs)
44 {
45         __codecType = rhs.__codecType;
46         __bitrate = rhs.__bitrate;
47         __sampleRate = rhs.__sampleRate;
48         __channel = rhs.__channel;
49 }
50
51 _AudioStreamInfoImpl&
52 _AudioStreamInfoImpl::operator =(const _AudioStreamInfoImpl& rhs)
53 {
54         // check for self-assignment
55         if (this == &rhs)
56         {
57                 return *this;
58         }
59
60         __codecType = rhs.__codecType;
61         __bitrate = rhs.__bitrate;
62         __sampleRate = rhs.__sampleRate;
63         __channel = rhs.__channel;
64
65         return *this;
66
67 }
68
69 bool
70 _AudioStreamInfoImpl::Equals(const Object& obj) const
71 {
72         const _AudioStreamInfoImpl* pAudioStreamInfoImpl = dynamic_cast <const _AudioStreamInfoImpl *> (&obj);
73         if (!pAudioStreamInfoImpl)
74         {
75                 return false;
76         }
77         return (((__codecType == pAudioStreamInfoImpl->__codecType) && (__bitrate == pAudioStreamInfoImpl->__bitrate)
78                 && (__sampleRate == pAudioStreamInfoImpl->__sampleRate) && (__channel == pAudioStreamInfoImpl->__channel )) ? true : false);
79 }
80
81 int
82 _AudioStreamInfoImpl::GetHashCode(void) const
83 {
84         return static_cast<int>(((__bitrate ^ __codecType) + (__sampleRate ^ __channel )));
85 }
86
87 CodecType
88 _AudioStreamInfoImpl::GetCodecType() const
89 {
90         return __codecType;
91 }
92
93 int
94 _AudioStreamInfoImpl::GetBitRate() const
95 {
96         return __bitrate;
97 }
98
99 int
100 _AudioStreamInfoImpl::GetSampleRate() const
101 {
102         return __sampleRate;
103 }
104
105 AudioChannelType
106 _AudioStreamInfoImpl::GetChannelType() const
107 {
108         return __channel;
109 }
110
111 };
112 };