Merge "seek expection handling bug" into tizen_2.2
[platform/framework/native/media.git] / src / FMediaMediaStreamInfo.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                FMediaMediaStreamInfo.cpp
20 // @brief               This file contains the implementation of media stream information
21 //
22
23 #include <stdio.h>
24 #include <FMediaMediaStreamInfo.h>
25 #include <FBaseSysLog.h>
26 #include "FMedia_MediaStreamInfoImpl.h"
27
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31
32 namespace Tizen { namespace Media
33 {
34
35 MediaStreamInfo::MediaStreamInfo(const Tizen::Base::String& title, const Tizen::Base::String& artist, const Tizen::Base::String& albumTitle, const Tizen::Base::String& genre, int year, Tizen::Base::ByteBuffer* pAlbumArt, Tizen::Base::Collection::IList* pAudioStream, Tizen::Base::Collection::IList* pVideoStream, result audioStreamException, result videoStreamException)
36 {
37         __pMediaStreamInfoImpl = new  (std::nothrow) _MediaStreamInfoImpl(title, artist, albumTitle, genre, year, pAlbumArt, pAudioStream, pVideoStream, audioStreamException, videoStreamException);
38 }
39
40 MediaStreamInfo::~MediaStreamInfo()
41 {
42         if (__pMediaStreamInfoImpl)
43         {
44                 delete __pMediaStreamInfoImpl;
45         }
46         __pMediaStreamInfoImpl = null;
47 }
48
49 //sicne 3.0
50 MediaStreamInfo::MediaStreamInfo(const MediaStreamInfo& rhs)
51         : Tizen::Base::Object()
52 {
53         __pMediaStreamInfoImpl = new (std::nothrow) _MediaStreamInfoImpl(*rhs.__pMediaStreamInfoImpl);
54 }
55
56 //since 3.0
57 MediaStreamInfo&
58 MediaStreamInfo::operator =(const MediaStreamInfo & rhs)
59 {
60         if (this == &rhs)
61         {
62                 return *this;
63         }
64         if (__pMediaStreamInfoImpl )
65         {
66                 delete __pMediaStreamInfoImpl;
67                 __pMediaStreamInfoImpl = null;
68         }
69         __pMediaStreamInfoImpl = new (std::nothrow) _MediaStreamInfoImpl(*rhs.__pMediaStreamInfoImpl);
70
71         return *this;
72 }
73
74 //since 3.0
75 bool
76 MediaStreamInfo::Equals(const Tizen::Base::Object& rhs) const
77 {
78         const MediaStreamInfo* pRhs = dynamic_cast <const MediaStreamInfo*>(&rhs);
79         if (pRhs == null)
80         {
81                 return false;
82         }
83
84         return __pMediaStreamInfoImpl->Equals(*pRhs->__pMediaStreamInfoImpl);
85 }
86
87 //since 3.0
88 int
89 MediaStreamInfo::GetHashCode(void) const
90 {
91         return __pMediaStreamInfoImpl->GetHashCode();
92 }
93
94
95 String
96 MediaStreamInfo::GetTitle() const
97 {
98         if (__pMediaStreamInfoImpl)
99         {
100                 return __pMediaStreamInfoImpl->GetTitle();
101         }
102         else
103         {
104                 return String(L"");
105         }
106 }
107
108 String
109 MediaStreamInfo::GetArtist(void) const
110 {
111         if (__pMediaStreamInfoImpl)
112         {
113                 return __pMediaStreamInfoImpl->GetArtist();
114         }
115         else
116         {
117                 return String(L"");
118         }
119 }
120
121 String
122 MediaStreamInfo::GetAlbumTitle(void) const
123 {
124         if (__pMediaStreamInfoImpl)
125         {
126                 return __pMediaStreamInfoImpl->GetAlbumTitle();
127         }
128         else
129         {
130                 return String(L"");
131         }
132 }
133
134 int
135 MediaStreamInfo::GetYear(void) const
136 {
137         if (__pMediaStreamInfoImpl)
138         {
139                 return __pMediaStreamInfoImpl->GetYear();
140         }
141         else
142         {
143                 return 0;
144         }
145 }
146
147 String
148 MediaStreamInfo::GetGenre(void) const
149 {
150         if (__pMediaStreamInfoImpl)
151         {
152                 return __pMediaStreamInfoImpl->GetGenre();
153         }
154         else
155         {
156                 return String(L"");
157         }
158 }
159
160 ByteBuffer*
161 MediaStreamInfo::GetAlbumArtN(void) const
162 {
163         if (__pMediaStreamInfoImpl)
164         {
165                 return __pMediaStreamInfoImpl->GetAlbumArtN();
166         }
167         else
168         {
169                 return null;
170         }
171 }
172
173 const IList*
174 MediaStreamInfo::GetAudioStreamInfoList() const
175 {
176         if (__pMediaStreamInfoImpl)
177         {
178                 return __pMediaStreamInfoImpl->GetAudioStreamInfoList();
179         }
180         else
181         {
182                 return null;
183         }
184 }
185
186 const IList*
187 MediaStreamInfo::GetVideoStreamInfoList() const
188 {
189         if (__pMediaStreamInfoImpl)
190         {
191                 return __pMediaStreamInfoImpl->GetVideoStreamInfoList();
192         }
193         else
194         {
195                 return null;
196         }
197 }
198
199 };
200 };