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