1b80850dfa0fc6047ee1485e4f512e19ea1757ab
[platform/framework/native/content.git] / inc / FCntAudioContentInfo.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                        FCntAudioContentInfo.h
18  * @brief               This is the header file for the %AudioContentInfo class.
19  *
20  * This header file contains the declarations of the %AudioContentInfo class.
21  */
22
23 #ifndef _FCNT_AUDIO_CONTENT_INFO_H_
24 #define _FCNT_AUDIO_CONTENT_INFO_H_
25
26 #include <FCntContentInfo.h>
27
28 namespace Tizen { namespace Content
29 {
30
31 class _AudioContentInfoImpl;
32 class _AudioContentData;
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. @n
80          * For full construction, the Construct() method must be called right after calling this constructor.
81          *
82          * @since               2.0
83          */
84         AudioContentInfo(void);
85
86         /**
87          * This destructor overrides Tizen::Base::Object::~Object().
88          *
89          * @since               2.0
90          */
91         virtual ~AudioContentInfo(void);
92
93         /**
94          * Initializes this instance of %AudioContentInfo with the specified parameter.
95          *
96          * @if OSPCOMPAT
97          * @brief <i> [Compatibility] </i>
98          * @endif
99          * @since                       2.0
100          * @if OSPCOMPAT
101          * @compatibility  This method has compatibility issues with OSP compatible applications. @n
102          *                 For more information, see @ref CompAudioContentInfoConstructPage "here".
103          * @endif
104          *
105          * @return              An error code
106          * @param[in]   pContentPath        The content path @n
107          *                                                                      The path should be started with the directory path returned by
108          *                                                                      either Tizen::System::Environment::GetMediaPath() or Tizen::System::Environment::GetExternalStoragePath(). @n
109          *                                                                      If the path is @c null,
110          *                                                                      use ContentManager::CreateContent(const Tizen::Base::ByteBuffer&, const Tizen::Base::String&, const ContentInfo*) @n
111          *                                                                      or ContentManager::CreateContent(const Tizen::Base::String&, const Tizen::Base::String&, bool, const ContentInfo*),
112          *                                                                      instead of this method.
113          * @exception   E_SUCCESS                       The method is successful.
114          * @exception   E_FILE_NOT_FOUND    The specified file cannot be found or accessed.
115          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
116          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
117          * @exception   E_IO                            An I/O error has occurred.
118          * @exception   E_SYSTEM                        An internal error has occurred.
119          */
120         result Construct(const Tizen::Base::String* pContentPath);
121
122         /**
123          * @if OSPCOMPAT
124          * @page        CompAudioContentInfoConstructPage Compatibility for the file path.
125          * @section     CompAudioContentInfoConstructPageIssueSection Issues
126          *          The content path argument of this method in OSP compatible applications has the following issues: @n
127          *          -# The content path should be a path that begins with an allowed path prefix. @n
128          *             For example, L"/Media/Images/flower.jpg", L"/Storagecard/Media/Images/flower.jpg".
129          *
130          * @section     CompAudioContentInfoConstructPageSolutionSection Resolutions
131          *          This issue has been resolved in Tizen. @n
132          *          -# The content path can be a path without a specific allowed path prefix. @n
133          *             Application do not need to know the specific allowed path prefixes. @n
134          *             To get the directory path, use the following methods: @n
135          *             - For accessing the media directory, use Tizen::System::Environment::GetMediaPath().
136          *             - For accessing the external storage, use Tizen::System::Environment::GetExternalStoragePath().
137          *
138          * @endif
139          */
140
141         /**
142          * @if OSPDEPREC
143          * Initializes this instance of %AudioContentInfo with the specified parameters.
144          *
145          * @brief       <i> [Deprecated] </i>
146          * @deprecated  This method is deprecated as there is a problem in managing the user-defined thumbnail and device coordinates. @n
147          *              Instead of using this method, use Construct(const Tizen::Base::String*). @n
148          *              To set the coordinates of the ContentInfo instance, use ContentInfo::SetCoordinates(const Tizen::Locations::Coordinates&).
149          * @since                       2.0
150          *
151          * @return              An error code
152          * @param[in]   contentPath                             The content path
153          * @param[in]   thumbnailPath                   The thumbnail path
154          * @param[in]   setGps                                  Set to @c true to save the device's last known coordinates of the ContentInfo instance, @n
155          *                                                                              else @c false @n
156          *                                                                              The coordinate information may be incorrect if it is outdated or has never been updated. @n
157          *                                      To update the coordinate information or to get the exact value,
158          *                                      use Tizen::Locations::LocationProvider::RequestLocationUpdates() before calling this method.
159          * @exception   E_SUCCESS                               The method is successful.
160          * @exception   E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
161          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
162          * @exception   E_OUT_OF_MEMORY             The memory is insufficient.
163          * @exception   E_IO                                    An I/O error has occurred.
164          * @remarks
165          *                               - The content path must start with @c '/Media' or @c '/Storagecard/Media'.
166          *                               - The thumbnail path must start with @c '/Home', @c '/Media', or @c '/Storagecard/Media'. @n
167          *                               - The permitted format for a thumbnail image is bitmap (bmp).
168          * @endif
169          */
170         virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false);
171
172         /**
173          * Gets the genre information of the audio file.
174          *
175          * @since               2.0
176          *
177          * @return              The genre information of the audio file, @n
178          *              else @c Unknown if the value is empty
179          */
180         Tizen::Base::String GetGenre(void) const;
181
182         /**
183          * Gets the artist information of the audio file.
184          *
185          * @since               2.0
186          *
187          * @return              The artist information of the audio file, @n
188          *              else @c Unknown if the value is empty
189          */
190         Tizen::Base::String GetArtist(void) const;
191
192         /**
193          * Gets the composer information of the audio file.
194          *
195          * @since               2.0
196          *
197          * @return              The composer information of the audio file, @n
198          *              else @c Unknown if the value is empty
199          */
200         Tizen::Base::String GetComposer(void) const;
201
202         /**
203          * Gets the album name of the audio file.
204          *
205          * @since               2.0
206          *
207          * @return              The album name of the audio file, @n
208          *              else @c Unknown if the value is empty
209          */
210         Tizen::Base::String GetAlbumName(void) const;
211
212         /**
213          * Gets the release year information of the audio file.
214          *
215          * @since               2.0
216          *
217          * @return              The release year information of the audio file
218          */
219         int GetReleaseYear(void) const;
220
221         /**
222          * Gets the bit rate information of the audio file.
223          *
224          * @since               2.0
225          *
226          * @return              The bit rate in bits per second (bps)
227          */
228         int GetBitrate(void) const;
229
230         /**
231          * Gets the title of the audio file.
232          *
233          * @since               2.0
234          *
235          * @return              The title of the audio file, @n
236          *              else @c Unknown if the value is empty
237          */
238         Tizen::Base::String GetTitle(void) const;
239
240         /**
241          * Gets the copyright of the audio file.
242          *
243          * @since               2.0
244          *
245          * @return              The copyright of the audio file, @n
246          *              else @c Unknown if the value is empty
247          */
248         Tizen::Base::String GetCopyright(void) const;
249
250         /**
251          * Gets the track information of the audio file.
252          *
253          * @since               2.0
254          *
255          * @return              The track information of the audio file, @n
256          *              else @c Unknown if the value is empty
257          */
258         Tizen::Base::String GetTrackInfo(void) const;
259
260         /**
261          * Gets the duration of the audio file.
262          *
263          * @since               2.0
264          *
265          * @return              The duration of the audio file in milliseconds
266          */
267         long GetDuration(void) const;
268
269 private:
270
271         /**
272          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
273          */
274         AudioContentInfo(const AudioContentInfo& rhs);
275
276         /**
277          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
278          */
279         AudioContentInfo& operator =(const AudioContentInfo& rhs);
280
281 private:
282
283         _AudioContentData* __pAudioContentData;
284         _AudioContentInfoImpl* __pAudioContentInfoImpl;
285         friend class _AudioContentInfoImpl;
286
287 };  // AudioContentInfo
288
289 }}  // Tizen::Content
290
291 #endif  // _FCNT_AUDIO_CONTENT_INFO_H_