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