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