2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FCntAudioMetadata.h
19 * @brief This is the header file for the %AudioMetadata class.
21 * This header file contains the declarations of the %AudioMetadata class.
24 #ifndef _FCNT_AUDIO_METADATA_H_
25 #define _FCNT_AUDIO_METADATA_H_
27 #include <FBaseObject.h>
29 namespace Tizen { namespace Graphics
34 namespace Tizen { namespace Content
37 class _AudioMetadataImpl;
40 * @class AudioMetadata
41 * @brief This class provides methods to access the audio metadata.
45 * The %AudioMetadata class provides methods to access the audio metadata that contains audio content-specific attributes.
47 * The following example demonstrates how to use the %AudioMetadata class.
51 * MyClass::TestAudioMetadata(void)
53 * result r = E_SUCCESS;
55 * Tizen::Base::String contentPath = Tizen::System::Environment::GetMediaPath() + L"Sounds/hot.mp3";
56 * AudioMetadata* pAudioMeta = ContentManagerUtil::GetAudioMetaN(contentPath);
57 * TryReturn(pAudioMeta != null, GetLastResult(), "ContentManagerUtil::GetAudioMetaN failed.");
60 * pAudioMeta->GetTitle();
63 * pAudioMeta->GetFrequency();
66 * pAudioMeta->GetArtist();
69 * pAudioMeta->GetAlbumName();
72 * pAudioMeta->GetDuration();
75 * pAudioMeta->GetYear();
78 * Tizen::Media::Image image;
79 * r = image.Construct();
86 * Tizen::Graphics::Bitmap* pBitmap = pAudioMeta->GetThumbnailN();
87 * if (pBitmap == null)
90 * return GetLastResult();
93 * Tizen::Base::String thumbnailPath = Tizen::System::Environment::GetMediaPath() + L"Images/audio.bmp";
94 * r = image.EncodeToFile(*pBitmap, Tizen::Media::IMG_FORMAT_BMP, thumbnailPath, false);
109 class _OSP_EXPORT_ AudioMetadata
110 : virtual public Tizen::Base::Object
114 * This is the default constructor for this class.
121 * Copying of objects using this copy constructor is allowed.
125 * @param[in] rhs An instance of %AudioMetadata
127 AudioMetadata(const AudioMetadata& rhs);
130 * This destructor overrides Tizen::Base::Object::~Object().
134 virtual ~AudioMetadata(void);
137 * Gets the title of the audio file.
141 * @return The title of the audio file
143 Tizen::Base::String GetTitle(void) const;
146 * Gets the bit rate of the audio file.
150 * @return The audio bit rate in bits per second (bps)
152 int GetBitrate(void) const;
155 * Gets the frequency of the audio file.
159 * @return The frequency in hertz (hz)
161 int GetFrequency(void) const;
164 * Gets the artist information of the audio file.
168 * @return The artist information of the audio file
170 Tizen::Base::String GetArtist(void) const;
173 * Gets the album name of the audio file.
177 * @return The album name of the audio file
179 Tizen::Base::String GetAlbumName(void) const;
182 * Gets the comment of the audio file.
186 * @return The comment of the audio file
188 Tizen::Base::String GetComment(void) const;
191 * Gets the description of an audio file.
195 * @return The description of an audio file
197 Tizen::Base::String GetDescription(void) const;
200 * Gets the track number of an audio file.
204 * @return The track number of an audio file
206 int GetTrack(void) const;
209 * Gets the genre information of an audio file.
213 * @return The genre information of an audio file
215 Tizen::Base::String GetGenre(void) const;
218 * Gets the composer information of an audio file.
222 * @return The composer information of an audio file
224 Tizen::Base::String GetComposer(void) const;
227 * Gets the copyright information of an audio file.
231 * @return The copyright information of an audio file
233 Tizen::Base::String GetCopyright(void) const;
236 * Gets the duration of an audio file.
240 * @return The duration in milliseconds
242 long GetDuration(void) const;
245 * Gets the year information of an audio file.
249 * @return The year information of an audio file
251 int GetYear(void) const;
254 * Gets the track information of an audio file.
258 * @return The track number/position in set
259 * @remarks This method returns track information that is embedded in the content metadata. @n
260 * The format returned can be like "4/9" or "4" (in case the position is not available).
262 Tizen::Base::String GetTrackInfo(void) const;
265 * Gets the recording date of an audio file.
269 * @return The recording date of an audio file
271 Tizen::Base::String GetRecordingDate(void) const;
274 * Gets the number of channels of an audio file.
278 * @return The number of channels of an audio file
279 * @remarks A monophonic stream has one channel and a stereophonic stream has two channels. @n
280 * Valid values are either @c 1 or @c 2.
282 int GetChannelCount(void) const;
285 * Gets the thumbnail of an audio file.
289 * @return A pointer to the thumbnail image
290 * @exception E_SUCCESS The method is successful.
291 * @exception E_DATA_NOT_FOUND The thumbnail image does not exist.
292 * @exception E_OUT_OF_MEMORY The memory is insufficient.
294 * - This method returns the thumbnail image that is resized to 80x60 pixels.
295 * - The specific error code can be accessed using the GetLastResult() method.
297 Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
300 * Gets the album art of an audio file.
304 * @return A pointer to the album art
305 * @exception E_SUCCESS The method is successful.
306 * @exception E_DATA_NOT_FOUND The album art does not exist.
307 * @exception E_OUT_OF_MEMORY The memory is insufficient.
309 * - GetThumbnailN() returns the thumbnail image that is resized to 80x60 pixels. @n
310 * GetAlbumArtN() returns the original album art that is embedded in the content metadata.
311 * - The specific error code can be accessed using the GetLastResult() method.
313 Tizen::Graphics::Bitmap* GetAlbumArtN(void) const;
316 * Compares the equality of values between two %AudioMetadata objects by overriding the Tizen::Base::Object::Equals() method.
320 * @return @c true if all the fields in the objects are equal, @n
322 * @param[in] rhs The Tizen::Base::Object with which the comparison is done
323 * @remarks An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons.
325 virtual bool Equals(const Tizen::Base::Object& rhs) const;
328 * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method.
332 * @return The hash value of the current instance
334 virtual int GetHashCode(void) const;
337 * Copying of objects using this copy assignment operator is allowed.
341 * @return A reference to this instance
342 * @param[in] rhs An instance of %AudioMetadata
344 AudioMetadata& operator =(const AudioMetadata& rhs);
347 friend class _AudioMetadataImpl;
348 _AudioMetadataImpl* __pImpl;
350 }; // class AudioMetadata
354 #endif // _FCNT_AUDIO_METADATA_H_