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