[content] Fix description in DownloadManager
[platform/framework/native/content.git] / inc / FCntAudioContentInfo.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18  * @file                        FCntAudioContentInfo.h
19  * @brief               This is the header file for the %AudioContentInfo class.
20  *
21  * This header file contains the declarations of the %AudioContentInfo class.
22  */
23
24 #ifndef _FCNT_AUDIO_CONTENT_INFO_H_
25 #define _FCNT_AUDIO_CONTENT_INFO_H_
26
27 #include <FCntContentInfo.h>
28
29 namespace Tizen { namespace Content
30 {
31
32 class _AudioContentInfoImpl;
33
34 /**
35  * @class       AudioContentInfo
36  * @brief       This class provides methods to access the audio content information.
37  *
38  * @since       2.0
39  *
40  * @final       This class is not intended for extension.
41  *
42  * The %AudioContentInfo class provides methods to access the audio content information that is extracted from a physical file. @n
43  * Before getting the audio content information, ContentManager must be used to create the content.
44  *
45  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/content/device_content_attributes.htm#media">Device Content Attributes</a>.
46  *
47  * The following example demonstrates how to use the %AudioContentInfo class.
48  *
49  * @code
50  * result
51  * MyClass::TestAudioContentInfo(void)
52  * {
53  *              result r = E_SUCCESS;
54  *
55  *              ContentId contentId;
56  *              ContentManager contentManager;
57  *              r = contentManager.Construct();
58  *              TryReturn(!IsFailed(r), r, "Construct failed.");
59  *
60  *              AudioContentInfo audioContentInfo;
61  *              r = audioContentInfo.Construct(null);
62  *              TryReturn(!IsFailed(r), r, "Construct failed.");
63  *
64  *              Tizen::Base::String sourcePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/flower.wma";
65  *              Tizen::Base::String destPath = Tizen::System::Environment::GetMediaPath() + L"Sounds/flower.wma";
66  *
67  *              contentId = contentManager.CreateContent(sourcePath, destPath, false, &audioContentInfo);
68  *              TryReturn(Tizen::Base::UuId::GetInvalidUuId() != contentId, GetLastResult(), "CreateContent failed.");
69  *
70  *              return r;
71  * }
72  * @endcode
73  */
74 class _OSP_EXPORT_ AudioContentInfo
75         : public Tizen::Content::ContentInfo
76 {
77 public:
78         /**
79          * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
80          *
81          * @since               2.0
82          *
83          * @remarks     After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.
84          */
85         AudioContentInfo(void);
86
87         /**
88          * This destructor overrides Tizen::Base::Object::~Object().
89          *
90          * @since               2.0
91          */
92         virtual ~AudioContentInfo(void);
93
94         /**
95          * Initializes this instance of %AudioContentInfo with the specified parameter.
96          *
97          * @if OSPCOMPAT
98          * @brief <i> [Compatibility] </i>
99          * @endif
100          * @since                       2.0
101          * @if OSPCOMPAT
102          * @compatibility This method has compatibility issues with OSP compatible applications. @n
103          *                       For more information, see @ref CompAudioContentInfoConstructPage "here".
104          * @endif
105          *
106          * @return                      An error code
107          * @param[in]   pContentPath                                    The content path
108          * @exception   E_SUCCESS                                       The method is successful.
109          * @exception   E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
110          * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
111          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
112          * @exception   E_IO                                                            An I/O error has occurred.
113          * @exception   E_SYSTEM                                                An internal error has occurred.
114          * @remarks             The @c pContentPath should start with directory path returned by either Tizen::System::Environment::GetMediaPath() or Tizen::System::Environment::GetExternalStoragePath(). @n
115          *                     If @c pContentPath is @c null, use ContentManager::CreateContent(const Tizen::Base::ByteBuffer&, const Tizen::Base::String&, const ContentInfo*)
116          *                     or ContentManager::CreateContent(const Tizen::Base::String&, const Tizen::Base::String&, bool, const ContentInfo*).
117          */
118         result Construct(const Tizen::Base::String* pContentPath);
119
120         /**
121          * @if OSPCOMPAT
122          * @page        CompAudioContentInfoConstructPage Compatibility for the file path.
123          * @section     CompAudioContentInfoConstructPageIssueSection Issues
124          *                 The content path argument of this method in OSP compatible applications has the following issues: @n
125          *                 -# The content path should be a path that begins with an allowed path prefix. @n
126          *                     For example, L"/Media/Images/flower.jpg", L"/Storagecard/Media/Images/flower.jpg".
127          *
128          * @section     CompAudioContentInfoConstructPageSolutionSection Resolutions
129          *                 This issue has been resolved in Tizen. @n
130          *                 -# The content path can be a path without a specific allowed path prefix. @n
131          *                 Application do not need to know the specific allowed path prefixes. @n
132          *                 To get the directory path, use the following methods: @n
133          *                 - For accessing the media directory, use Tizen::System::Environment::GetMediaPath().
134          *                 - For accessing the external storage, use Tizen::System::Environment::GetExternalStoragePath().
135          *
136          * @endif
137          */
138
139         /**
140          * @if OSPDEPREC
141          * Initializes this instance of %AudioContentInfo with the specified parameters.
142          *
143          * @brief       <i> [Deprecated] </i>
144          * @deprecated  This method is deprecated as there is a problem in managing the user-defined thumbnail and device coordinates. @n
145          *                      Instead of using this method, use Construct(const Tizen::Base::String*). @n
146          *                      To set the coordinates in the ContentInfo instance, use ContentInfo::SetCoordinates(const Tizen::Locations::Coordinates&).
147          * @since                       2.0
148          *
149          * @return                      An error code
150          * @param[in]   contentPath                                     The content path
151          * @param[in]   thumbnailPath                           The thumbnail path
152          * @param[in]   setGps                                                  Set to @c true to save the device's last known coordinates in the ContentInfo instance, @n
153          *                                                                                              else @c false @n
154          *                                                                                              The coordinate information may be incorrect if it is outdated or has never been updated. @n
155          *                                              To update the coordinate information or to get the exact value,
156          *                                              use Tizen::Locations::LocationProvider::RequestLocationUpdates() before calling this method.
157          * @exception   E_SUCCESS                                       The method is successful.
158          * @exception   E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
159          * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
160          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
161          * @exception   E_IO                                                            An I/O error has occurred.
162          * @remarks             The content path must start with @c '/Media' or @c '/Storagecard/Media'. @n
163          *                                              The thumbnail path must start with @c '/Home', @c '/Media', or @c '/Storagecard/Media'. @n
164          *                                              The permitted format for a thumbnail image is Bitmap (bmp).
165          * @endif
166          */
167         virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false);
168
169         /**
170          * Gets the genre information of the audio file.
171          *
172          * @since               2.0
173          *
174          * @return              The genre information of the audio file, @n
175          *              else @c Unknown if the value is empty
176          */
177         Tizen::Base::String GetGenre(void) const;
178
179         /**
180          * Gets the artist information of the audio file.
181          *
182          * @since               2.0
183          *
184          * @return              The artist information of the audio file, @n
185          *              else @c Unknown if the value is empty
186          */
187         Tizen::Base::String GetArtist(void) const;
188
189         /**
190          * Gets the composer information of the audio file.
191          *
192          * @since               2.0
193          *
194          * @return              The composer information of the audio file, @n
195          *              else @c Unknown if the value is empty
196          */
197         Tizen::Base::String GetComposer(void) const;
198
199         /**
200          * Gets the album name of the audio file.
201          *
202          * @since               2.0
203          *
204          * @return              The album name of the audio file, @n
205          *              else @c Unknown if the value is empty
206          */
207         Tizen::Base::String GetAlbumName(void) const;
208
209         /**
210          * Gets the release year information of the audio file.
211          *
212          * @since               2.0
213          *
214          * @return              The release year information of the audio file
215          */
216         int GetReleaseYear(void) const;
217
218         /**
219          * Gets the bit rate information of the audio file.
220          *
221          * @since               2.0
222          *
223          * @return              The bit rate in bits per second (bps)
224          */
225         int GetBitrate(void) const;
226
227         /**
228          * Gets the title of the audio file.
229          *
230          * @since               2.0
231          *
232          * @return              The title of the audio file, @n
233          *              else @c Unknown if the value is empty
234          */
235         Tizen::Base::String GetTitle(void) const;
236
237         /**
238          * Gets the copyright of the audio file.
239          *
240          * @since               2.0
241          *
242          * @return              The copyright of the audio file, @n
243          *              else @c Unknown if the value is empty
244          */
245         Tizen::Base::String GetCopyright(void) const;
246
247         /**
248          * Gets the track information of the audio file.
249          *
250          * @since               2.0
251          *
252          * @return              The track information of the audio file, @n
253          *              else @c Unknown if the value is empty
254          */
255         Tizen::Base::String GetTrackInfo(void) const;
256
257         /**
258          * Gets the duration of the audio file.
259          *
260          * @since               2.0
261          *
262          * @return              The duration of the audio file in milliseconds
263          */
264         long GetDuration(void) const;
265
266 private:
267         class _AudioContentData
268         {
269         public:
270                 _AudioContentData()
271                         : bitrate(0)
272                         , releaseYear(0)
273                         , duration(0)
274                         , pTitle(null)
275                         , pAlbumName(null)
276                         , pArtist(null)
277                         , pComposer(null)
278                         , pGenre(null)
279                         , pCopyright(null)
280                         , pTrackInfo(null) {}
281
282                 int bitrate;
283                 int releaseYear;
284                 long duration;
285                 Tizen::Base::String* pTitle;
286                 Tizen::Base::String* pAlbumName;
287                 Tizen::Base::String* pArtist;
288                 Tizen::Base::String* pComposer;
289                 Tizen::Base::String* pGenre;
290                 Tizen::Base::String* pCopyright;
291                 Tizen::Base::String* pTrackInfo;
292         };
293
294         /**
295          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
296          */
297         AudioContentInfo(const AudioContentInfo& rhs);
298
299         /**
300          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
301          */
302         AudioContentInfo& operator =(const AudioContentInfo& rhs);
303
304         result SetAudioContentData(const _AudioContentData* pAudioContentData);
305
306         _AudioContentData* GetAudioContentData(void);
307
308 private:
309         _AudioContentData* __pAudioContentData;
310
311         friend class _ContentManagerImpl;
312         friend class _ContentSearchImpl;
313         friend class _ContentDirectoryImpl;
314         friend class _ContentUtility;
315         friend class _PlayListManagerImpl;
316         friend class _PlayListImpl;
317
318         friend class _AudioContentInfoImpl;
319         _AudioContentInfoImpl* __pImpl;
320
321 };  // Class AudioContentInfo
322
323 }}  // Tizen::Content
324
325 #endif  // _FCNT_AUDIO_CONTENT_INFO_H_