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 track number of the audio file.
195 * @return The track number of the audio file
197 int GetTrack(void) const;
200 * Gets the genre information of the audio file.
204 * @return The genre information of the audio file
206 Tizen::Base::String GetGenre(void) const;
209 * Gets the composer information of the audio file.
213 * @return The composer information of the audio file
215 Tizen::Base::String GetComposer(void) const;
218 * Gets the copyright information of the audio file.
222 * @return The copyright information of the audio file
224 Tizen::Base::String GetCopyright(void) const;
227 * Gets the duration of the audio file.
231 * @return The duration in milliseconds
233 long GetDuration(void) const;
236 * Gets the year information of the audio file.
240 * @return The year information of the audio file
242 int GetYear(void) const;
245 * Gets the track information of the audio file.
249 * @return The track number/position in set
250 * @remarks This method returns track information that is embedded in the content metadata. @n
251 * The format returned can be like "4/9" or "4" (in case the position is not available).
253 Tizen::Base::String GetTrackInfo(void) const;
256 * Gets the recording date of the audio file.
260 * @return The recording date of the audio file
262 Tizen::Base::String GetRecordingDate(void) const;
265 * Gets the number of channels of the audio file.
269 * @return The number of channels of the audio file
270 * @remarks A monophonic stream has one channel and a stereophonic stream has two channels. @n
271 * Valid values are either @c 1 or @c 2.
273 int GetChannelCount(void) const;
276 * Gets the thumbnail of the audio file.
280 * @return A pointer to the thumbnail image
281 * @exception E_SUCCESS The method is successful.
282 * @exception E_DATA_NOT_FOUND The thumbnail image does not exist.
283 * @exception E_OUT_OF_MEMORY The memory is insufficient.
284 * @remarks This method returns the thumbnail image that is resized to 80x60 pixels. @n
285 * The specific error code can be accessed using the GetLastResult() method.
287 Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
290 * Gets the album art of the audio file.
294 * @return A pointer to the album art
295 * @exception E_SUCCESS The method is successful.
296 * @exception E_DATA_NOT_FOUND The album art does not exist.
297 * @exception E_OUT_OF_MEMORY The memory is insufficient.
298 * @remarks GetThumbnailN() returns the thumbnail image that is resized to 80x60 pixels. @n
299 * GetAlbumArtN() returns the original album art that is embedded in the content metadata. @n
300 * The specific error code can be accessed using the GetLastResult() method.
302 Tizen::Graphics::Bitmap* GetAlbumArtN(void) const;
305 * Compares the equality of values between two %AudioMetadata objects by overriding the Tizen::Base::Object::Equals() method.
309 * @return @c true if all the fields in the objects are equal, @n
311 * @param[in] rhs The Tizen::Base::Object with which the comparison is done
312 * @remarks An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons.
314 virtual bool Equals(const Tizen::Base::Object& rhs) const;
317 * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method.
321 * @return The hash value of the current instance
323 virtual int GetHashCode(void) const;
326 * Copying of objects using this copy assignment operator is allowed.
330 * @return A reference to this instance
331 * @param[in] rhs An instance of %AudioMetadata
333 AudioMetadata& operator =(const AudioMetadata& rhs);
336 friend class _AudioMetadataImpl;
337 _AudioMetadataImpl* __pImpl;
339 }; // class AudioMetadata
343 #endif // _FCNT_AUDIO_METADATA_H_