Fix : Remove exception handling codes at the sample code
[platform/framework/native/content.git] / inc / FCntAudioMetadata.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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  * @file                FCntAudioMetadata.h
18  * @brief               This is the header file for the %AudioMetadata class.
19  *
20  * This header file contains the declarations of the %AudioMetadata class.
21  */
22
23 #ifndef _FCNT_AUDIO_METADATA_H_
24 #define _FCNT_AUDIO_METADATA_H_
25
26 #include <FBaseObject.h>
27
28 namespace Tizen { namespace Graphics
29 {
30 class Bitmap;
31 }}
32
33 namespace Tizen { namespace Content
34 {
35
36 class _AudioMetadataImpl;
37
38 /**
39  * @class       AudioMetadata
40  * @brief       This class provides methods to access the audio metadata.
41  *
42  * @since       2.0
43  *
44  * The %AudioMetadata class provides methods to access the audio metadata that contains audio content-specific attributes.
45  *
46  * The following example demonstrates how to use the %AudioMetadata class.
47  *
48  * @code
49  * #include <FBase.h>
50  * #include <FContent.h>
51  * #include <FMedia.h>
52  * #include <FSystem.h>
53  *
54  * using namespace Tizen::Content;
55  *
56  * result
57  * MyClass::TestAudioMetadata(void)
58  * {
59  *              Tizen::Base::String contentPath = Tizen::System::Environment::GetMediaPath() + L"Sounds/hot.mp3";
60  *              AudioMetadata* pAudioMeta = ContentManagerUtil::GetAudioMetaN(contentPath);
61  *              result r = GetLastResult();
62  *
63  *              pAudioMeta->GetTitle();
64  *              pAudioMeta->GetFrequency();
65  *              pAudioMeta->GetArtist();
66  *              pAudioMeta->GetAlbumName();
67  *              pAudioMeta->GetDuration();
68  *              pAudioMeta->GetYear();
69  *
70  *              Tizen::Media::Image image;
71  *              r = image.Construct();
72  *
73  *              Tizen::Graphics::Bitmap* pBitmap = pAudioMeta->GetThumbnailN();
74  *              r = GetLastResult();
75  *
76  *              Tizen::Base::String thumbnailPath = Tizen::System::Environment::GetMediaPath() + L"Images/audio.bmp";
77  *              r = image.EncodeToFile(*pBitmap, Tizen::Media::IMG_FORMAT_BMP, thumbnailPath, false);
78  *
79  *              delete pAudioMeta;
80  *              delete pBitmap;
81  *
82  *              return r;
83  * }
84  * @endcode
85  */
86 class _OSP_EXPORT_ AudioMetadata
87         : virtual public Tizen::Base::Object
88 {
89 public:
90         /**
91          * This is the default constructor for this class.
92          *
93          * @since               2.0
94          */
95         AudioMetadata(void);
96
97         /**
98          * Copying of objects using this copy constructor is allowed.
99          *
100          * @since               2.0
101          *
102          * @param[in]   rhs     An instance of %AudioMetadata to copy
103          */
104         AudioMetadata(const AudioMetadata& rhs);
105
106         /**
107          * This destructor overrides Tizen::Base::Object::~Object().
108          *
109          * @since               2.0
110          */
111         virtual ~AudioMetadata(void);
112
113         /**
114          * Gets the title of the audio file.
115          *
116          * @since               2.0
117          *
118          * @return              The title of the audio file
119          */
120         Tizen::Base::String GetTitle(void) const;
121
122         /**
123          * Gets the bit rate of the audio file.
124          *
125          * @since               2.0
126          *
127          * @return              The audio bit rate in bits per second (bps)
128          */
129         int GetBitrate(void) const;
130
131         /**
132          * Gets the frequency of the audio file.
133          *
134          * @since               2.0
135          *
136          * @return              The frequency in hertz (Hz)
137          */
138         int GetFrequency(void) const;
139
140         /**
141          * Gets the artist information of the audio file.
142          *
143          * @since               2.0
144          *
145          * @return              The artist information of the audio file
146          */
147         Tizen::Base::String GetArtist(void) const;
148
149         /**
150          * Gets the album name of the audio file.
151          *
152          * @since               2.0
153          *
154          * @return              The album name of the audio file
155          */
156         Tizen::Base::String GetAlbumName(void) const;
157
158         /**
159          * Gets the comment of the audio file.
160          *
161          * @since               2.0
162          *
163          * @return              The comment of the audio file
164          */
165         Tizen::Base::String GetComment(void) const;
166
167         /**
168          * Gets the description of the audio file.
169          *
170          * @since               2.1
171          *
172          * @return              The description of the audio file
173          */
174         Tizen::Base::String GetDescription(void) const;
175
176         /**
177          * Gets the track number of the audio file.
178          *
179          * @since               2.0
180          *
181          * @return              The track number of the audio file
182          */
183         int GetTrack(void) const;
184
185         /**
186          * Gets the genre information of the audio file.
187          *
188          * @since               2.0
189          *
190          * @return              The genre information of the audio file
191          */
192         Tizen::Base::String GetGenre(void) const;
193
194         /**
195          * Gets the composer information of the audio file.
196          *
197          * @since               2.0
198          *
199          * @return              The composer information of the audio file
200          */
201         Tizen::Base::String GetComposer(void) const;
202
203         /**
204          * Gets the copyright information of the audio file.
205          *
206          * @since               2.0
207          *
208          * @return              The copyright information of the audio file
209          */
210         Tizen::Base::String GetCopyright(void) const;
211
212         /**
213          * Gets the duration of the audio file.
214          *
215          * @since               2.0
216          *
217          * @return              The duration in milliseconds
218          */
219         long GetDuration(void) const;
220
221         /**
222          * Gets the year information of the audio file.
223          *
224          * @since               2.0
225          *
226          * @return              The year information of the audio file
227          */
228         int GetYear(void) const;
229
230         /**
231          * Gets the track information of the audio file.
232          *
233          * @since               2.0
234          *
235          * @return              The track number/position embedded in the content metadata @n
236          *                              The value can be like "4/9" or "4" in case the position is not available.
237          */
238         Tizen::Base::String GetTrackInfo(void) const;
239
240         /**
241          * Gets the recording date of the audio file.
242          *
243          * @since               2.0
244          *
245          * @return              The recording date of the audio file
246          */
247         Tizen::Base::String GetRecordingDate(void) const;
248
249         /**
250          * Gets the number of channels of the audio file.
251          *
252          * @since               2.0
253          *
254      * @return  The channel count of the audio file @n
255      *                  The values are @c 1 in a monophonic stream and @c 2 in a stereophonic stream.
256          */
257         int GetChannelCount(void) const;
258
259         /**
260          * Gets the thumbnail of the audio file.
261          *
262          * @since                       2.0
263          *
264          * @return              A pointer to the thumbnail image that is resized to 80x60 pixels
265          * @exception   E_SUCCESS                       The method is successful.
266          * @exception   E_DATA_NOT_FOUND        The thumbnail image does not exist.
267          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
268          * @remarks     The specific error code can be accessed using the GetLastResult() method.
269          */
270         Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
271
272         /**
273          * Gets the album art of the audio file.
274          *
275          * @since                       2.0
276          *
277          * @return              A pointer to the album art that is embedded in the content metadata
278          * @exception   E_SUCCESS                       The method is successful.
279          * @exception   E_DATA_NOT_FOUND        The album art does not exist.
280          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
281          * @remarks     The specific error code can be accessed using the GetLastResult() method.
282          */
283         Tizen::Graphics::Bitmap* GetAlbumArtN(void) const;
284
285         /**
286          * Compares the equality of the values between two %AudioMetadata objects by overriding the Tizen::Base::Object::Equals() method.
287          *
288          * @since          2.0
289          *
290          * @return       @c true if all the fields in the objects are equal, @n
291          *               else @c false
292          * @param[in]    rhs     The Tizen::Base::Object with which the comparison is done @n
293          *                                               An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons.
294          */
295         virtual bool Equals(const Tizen::Base::Object& rhs) const;
296
297         /**
298          * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method.
299          *
300          * @since         2.0
301          *
302          * @return        The hash value of the current instance
303          */
304         virtual int GetHashCode(void) const;
305
306         /**
307          * Copying of objects using this copy assignment operator is allowed.
308          *
309          * @since          2.0
310          *
311          * @return         A reference to this instance
312          * @param[in]    rhs An instance of %AudioMetadata to copy
313          */
314         AudioMetadata& operator =(const AudioMetadata& rhs);
315
316 private:
317         friend class _AudioMetadataImpl;
318         _AudioMetadataImpl* __pImpl;
319
320 };  // class AudioMetadata
321
322 }}  // Tizen::Content
323
324 #endif  // _FCNT_AUDIO_METADATA_H_