2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file FCntAudioMetadata.h
18 * @brief This is the header file for the %AudioMetadata class.
20 * This header file contains the declarations of the %AudioMetadata class.
23 #ifndef _FCNT_AUDIO_METADATA_H_
24 #define _FCNT_AUDIO_METADATA_H_
26 #include <FBaseObject.h>
28 namespace Tizen { namespace Graphics
33 namespace Tizen { namespace Content
36 class _AudioMetadataImpl;
39 * @class AudioMetadata
40 * @brief This class provides methods to access the audio metadata.
44 * The %AudioMetadata class provides methods to access the audio metadata that contains audio content-specific attributes.
46 * The following example demonstrates how to use the %AudioMetadata class.
50 * MyClass::TestAudioMetadata(void)
52 * result r = E_SUCCESS;
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.");
59 * pAudioMeta->GetTitle();
62 * pAudioMeta->GetFrequency();
65 * pAudioMeta->GetArtist();
68 * pAudioMeta->GetAlbumName();
71 * pAudioMeta->GetDuration();
74 * pAudioMeta->GetYear();
77 * Tizen::Media::Image image;
78 * r = image.Construct();
85 * Tizen::Graphics::Bitmap* pBitmap = pAudioMeta->GetThumbnailN();
86 * if (pBitmap == null)
89 * return GetLastResult();
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);
108 class _OSP_EXPORT_ AudioMetadata
109 : virtual public Tizen::Base::Object
113 * This is the default constructor for this class.
120 * Copying of objects using this copy constructor is allowed.
124 * @param[in] rhs An instance of %AudioMetadata to copy
126 AudioMetadata(const AudioMetadata& rhs);
129 * This destructor overrides Tizen::Base::Object::~Object().
133 virtual ~AudioMetadata(void);
136 * Gets the title of the audio file.
140 * @return The title of the audio file
142 Tizen::Base::String GetTitle(void) const;
145 * Gets the bit rate of the audio file.
149 * @return The audio bit rate in bits per second (bps)
151 int GetBitrate(void) const;
154 * Gets the frequency of the audio file.
158 * @return The frequency in hertz (Hz)
160 int GetFrequency(void) const;
163 * Gets the artist information of the audio file.
167 * @return The artist information of the audio file
169 Tizen::Base::String GetArtist(void) const;
172 * Gets the album name of the audio file.
176 * @return The album name of the audio file
178 Tizen::Base::String GetAlbumName(void) const;
181 * Gets the comment of the audio file.
185 * @return The comment of the audio file
187 Tizen::Base::String GetComment(void) const;
190 * Gets the description of the audio file.
194 * @return The description of the audio file
196 Tizen::Base::String GetDescription(void) const;
199 * Gets the track number of the audio file.
203 * @return The track number of the audio file
205 int GetTrack(void) const;
208 * Gets the genre information of the audio file.
212 * @return The genre information of the audio file
214 Tizen::Base::String GetGenre(void) const;
217 * Gets the composer information of the audio file.
221 * @return The composer information of the audio file
223 Tizen::Base::String GetComposer(void) const;
226 * Gets the copyright information of the audio file.
230 * @return The copyright information of the audio file
232 Tizen::Base::String GetCopyright(void) const;
235 * Gets the duration of the audio file.
239 * @return The duration in milliseconds
241 long GetDuration(void) const;
244 * Gets the year information of the audio file.
248 * @return The year information of the audio file
250 int GetYear(void) const;
253 * Gets the track information of the audio file.
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.
260 Tizen::Base::String GetTrackInfo(void) const;
263 * Gets the recording date of the audio file.
267 * @return The recording date of the audio file
269 Tizen::Base::String GetRecordingDate(void) const;
272 * Gets the number of channels of the audio file.
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.
279 int GetChannelCount(void) const;
282 * Gets the thumbnail of the audio file.
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.
292 Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
295 * Gets the album art of the audio file.
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.
305 Tizen::Graphics::Bitmap* GetAlbumArtN(void) const;
308 * Compares the equality of the values between two %AudioMetadata objects by overriding the Tizen::Base::Object::Equals() method.
312 * @return @c true if all the fields in the objects are equal, @n
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.
317 virtual bool Equals(const Tizen::Base::Object& rhs) const;
320 * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method.
324 * @return The hash value of the current instance
326 virtual int GetHashCode(void) const;
329 * Copying of objects using this copy assignment operator is allowed.
333 * @return A reference to this instance
334 * @param[in] rhs An instance of %AudioMetadata to copy
336 AudioMetadata& operator =(const AudioMetadata& rhs);
339 friend class _AudioMetadataImpl;
340 _AudioMetadataImpl* __pImpl;
342 }; // class AudioMetadata
346 #endif // _FCNT_AUDIO_METADATA_H_