bec809665f095ad030d6c5a890521f945367af42
[platform/core/api/media-content.git] / include / media_video.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
18
19 #ifndef __TIZEN_VIDEO_META_H__
20 #define __TIZEN_VIDEO_META_H__
21
22 #include <media_content_type.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27
28 /**
29  * @file media_video.h
30  * @brief This file contains the video metadata API and related functions to proceed with video metadata. \n
31  *        Functions include cloning and destroying video metadata, getting video metadata such as width, height, \n
32  *        album, genre, played parameters etc. and updating video to DB.
33  */
34
35 /**
36  * @addtogroup CAPI_CONTENT_MEDIA_VIDEO_META_MODULE
37  * @{
38  */
39
40 /**
41  * @brief Clones the video metadata.
42  * @details This function copies the video metadata handle from a source to
43  *          destination.
44  *
45  * @since_tizen 2.3
46  *
47  * @remarks You must release the destination handle using video_meta_destroy().
48  *
49  * @param[out] dst The destination handle to the video metadata
50  * @param[in]  src The source handle to the video metadata
51  *
52  * @return @c 0 on success,
53  *         otherwise a negative error value
54  *
55  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
56  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
57  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
58  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
59  *
60  * @see video_meta_destroy()
61  */
62 int video_meta_clone(video_meta_h *dst, video_meta_h src);
63
64 /**
65  * @brief Destroys the video metadata.
66  * @details This function frees all resources related to the video metadata handle. This handle
67  *          no longer can be used to perform any operation. A new handle has to
68  *          be created before the next use.
69  *
70  * @since_tizen 2.3
71  *
72  * @param[in] video The video metadata handle
73  *
74  * @return @c 0 on success,
75  *         otherwise a negative error value
76  *
77  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
78  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
79  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
80  *
81  * @pre Get copy of video metadata handle by calling video_meta_clone().
82  *
83  * @see video_meta_clone()
84  */
85 int video_meta_destroy(video_meta_h video);
86
87 /**
88  * @brief Gets the ID of the media of the given video metadata.
89  * @since_tizen 2.3
90  *
91  * @remarks You must release @a media_id using free().
92  *
93  * @param[in]  video    The video metadata handle
94  * @param[out] media_id The ID of the video
95  *
96  * @return @c 0 on success,
97  *         otherwise a negative error value
98  *
99  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
100  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
101  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
102  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
103  */
104 int video_meta_get_media_id(video_meta_h video, char **media_id);
105
106 /**
107  * @brief Gets the video's album.
108  * @details If the value is an empty string, the method returns "Unknown".
109  *
110  * @since_tizen 2.3
111  *
112  * @remarks You must release @a album using free().
113  *
114  * @param[in]  video The video metadata handle
115  * @param[out] album The video album or @c NULL
116  *
117  * @return @c 0 on success,
118  *         otherwise a negative error value
119  *
120  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
121  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
122  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
123  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
124  */
125 int video_meta_get_album(video_meta_h video, char **album);
126
127 /**
128  * @brief Gets the video artist.
129  * @details If the value is an empty string, the method returns "Unknown".
130  *
131  * @since_tizen 2.3
132  *
133  * @remarks You must release @a artist using free().
134  *
135  * @param[in]  video  The video metadata handle
136  * @param[out] artist The artist of the video metadata
137  *
138  * @return @c 0 on success,
139  *         otherwise a negative error value
140  *
141  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
142  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
143  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
144  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
145  */
146 int video_meta_get_artist(video_meta_h video, char **artist);
147
148 /**
149  * @brief Gets the video's album_artist.
150  * If the value is an empty string, the method returns "Unknown".
151  *
152  * @remarks @a album_artist must be released with free() by you.
153  *
154  * @param [in] video The handle to video metadata
155  * @param [out] album_artist The album_artist of video metadata
156  * @return 0 on success, otherwise a negative error value.
157  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
158  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
159  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
160  */
161 int video_meta_get_album_artist(video_meta_h video, char **album_artist);
162
163 /**
164  * @brief Gets the video genre.
165  * @details If the value is an empty string, the method returns "Unknown".
166  *
167  * @since_tizen 2.3
168  *
169  * @remarks You must release @a genre using free().
170  *
171  * @param[in]  video The video metadata handle
172  * @param[out] genre The genre of the video metadata
173  *
174  * @return @c 0 on success,
175  *         otherwise a negative error value
176  *
177  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
178  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
179  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
180  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
181  */
182 int video_meta_get_genre(video_meta_h video, char **genre);
183
184 /**
185  * @brief Gets the video composer.
186  * @details If the value is an empty string, the method returns "Unknown".
187  *
188  * @since_tizen 2.3
189  *
190  * @remarks You must release @a composer using free().
191  *
192  * @param[in]  video    The video metadata handle
193  * @param[out] composer The composer of the video metadata
194  *
195  * @return @c 0 on success,
196  *         otherwise a negative error value
197  *
198  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
199  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
200  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
201  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
202  */
203 int video_meta_get_composer(video_meta_h video, char **composer);
204
205 /**
206  * @brief Gets the year of the video.
207  * @details If the value is an empty string, the method returns "Unknown".
208  *
209  * @since_tizen 2.3
210  *
211  * @remarks You must release @a year using free().
212  *
213  * @param[in]  video The video metadata handle
214  * @param[out] year  The year of the video metadata
215  *
216  * @return @c 0 on success,
217  *         otherwise a negative error value
218  *
219  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
220  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
221  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
222  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
223  */
224 int video_meta_get_year(video_meta_h video, char **year);
225
226 /**
227  * @brief Gets the recorded date of the video.
228  * @since_tizen 2.3
229  *
230  * @remarks You must release @a recorded_date using free().
231  *
232  * @param[in]  video         The video metadata handle
233  * @param[out] recorded_date The recorded date of the video metadata
234  *
235  * @return @c 0 on success,
236  *         otherwise a negative error value
237  *
238  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
239  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
240  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
241  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
242  */
243 int video_meta_get_recorded_date(video_meta_h video, char **recorded_date);
244
245 /**
246  * @brief Gets the video copyright.
247  * @since_tizen 2.3
248  *
249  * @remarks You must release @a copyright using free().
250  *
251  * @param[in]  video     The video metadata handle
252  * @param[out] copyright The copyright of the video metadata
253  *
254  * @return @c 0 on success,
255  *         otherwise a negative error value
256  *
257  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
258  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
259  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
260  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
261  */
262 int video_meta_get_copyright(video_meta_h video, char **copyright);
263
264 /**
265  * @brief Gets the track number of the video.
266  * @details If the value is an empty string, the method returns "Unknown".
267  *
268  * @since_tizen 2.3
269  *
270  * @remarks You must release @a track_num using free().
271  *
272  * @param[in]  video     The video metadata handle
273  * @param[out] track_num The track number of the video metadata
274  *
275  * @return @c 0 on success,
276  *         otherwise a negative error value
277  *
278  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
279  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
280  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
281  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
282  */
283 int video_meta_get_track_num(video_meta_h video, char **track_num);
284
285 /**
286  * @brief Gets the video bit rate.
287  * @since_tizen 2.3
288  *
289  * @remarks You must release @a bit_rate using free().
290  *
291  * @param[in]  video     The video metadata handle
292  * @param[out] bit_rate  The bit rate of the video metadata
293  *
294  * @return @c 0 on success,
295  *         otherwise a negative error value
296  *
297  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
298  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
299  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
300  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
301  */
302 int video_meta_get_bit_rate(video_meta_h video, int *bit_rate);
303
304 /**
305  * @brief Gets the duration of video metadata.
306  * @since_tizen 2.3
307  *
308  * @param[in]  video    The video metadata handle
309  * @param[out] duration The video duration in milliseconds
310  *
311  * @return @c 0 on success,
312  *         otherwise a negative error value
313  *
314  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
315  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
316  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
317  */
318 int video_meta_get_duration(video_meta_h video, int *duration);
319
320 /**
321  * @brief Gets the video width in pixels.
322  * @since_tizen 2.3
323  *
324  * @param[in]  video The video metadata handle
325  * @param[out] width The video width in pixels
326  *
327  * @return @c 0 on success,
328  *         otherwise a negative error value
329  *
330  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
331  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
332  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
333  */
334 int video_meta_get_width(video_meta_h video, int *width);
335
336 /**
337  * @brief Gets the video height in pixels.
338  * @since_tizen 2.3
339  *
340  * @param[in]  video  The video metadata handle
341  * @param[out] height The video height in pixels
342  *
343  * @return @c 0 on success,
344  *         otherwise a negative error value
345  *
346  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
347  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
348  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
349  */
350 int video_meta_get_height(video_meta_h video, int *height);
351
352 /**
353  * @brief Gets the played count of the video.
354  * @since_tizen 2.3
355  *
356  * @param[in]  video        The video metadata handle
357  * @param[out] played_count The number of played
358  *
359  * @return @c 0 on success,
360  *         otherwise a negative error value
361  *
362  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
363  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
364  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
365  */
366 int video_meta_get_played_count(video_meta_h video, int *played_count);
367
368 /**
369  * @brief Gets the last played time parameter of the video.
370  * @since_tizen 2.3
371  *
372  * @param[in]  video       The video metadata handle
373  * @param[out] played_time The time last played in the video
374  *
375  * @return @c 0 on success,
376  *         otherwise a negative error value
377  *
378  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
379  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
380  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
381  */
382 int video_meta_get_played_time(video_meta_h video, time_t *played_time);
383
384 /**
385  * @brief Gets the position played parameter of the video.
386  * @details This function returns the elapsed playback time parameter of the video as period
387  *          starting from the beginning of the movie.
388  *
389  * @since_tizen 2.3
390  *
391  * @param[in]  video           The video metadata handle
392  * @param[out] played_position The position from the beginning of the video (in milliseconds)
393  *
394  * @return @c 0 on success,
395  *         otherwise a negative error value
396  *
397  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
398  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
399  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
400  */
401 int video_meta_get_played_position(video_meta_h video, int *played_position);
402
403 /**
404  * @brief Sets the played count of the video.
405  * @since_tizen 2.3
406  *
407  * @param[in] video        The video metadata handle
408  * @param[in] played_count The number of played
409  *
410  * @return @c 0 on success,
411  *         otherwise a negative error value
412  *
413  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
414  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
415  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
416  *
417  * @post video_meta_update_to_db().
418  */
419 int video_meta_set_played_count(video_meta_h video, int played_count);
420
421 /**
422  * @brief Sets the time last played parameter of the video.
423  * @since_tizen 2.3
424  *
425  * @param[in] video       The video metadata handle
426  * @param[in] played_time The time last played in the video
427  *
428  * @return @c 0 on success,
429  *         otherwise a negative error value
430  *
431  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
432  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
433  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
434  *
435  * @post video_meta_update_to_db().
436  */
437 int video_meta_set_played_time(video_meta_h video, time_t played_time);
438
439 /**
440  * @brief Sets the position played parameter of the video.
441  * @details This function returns video's elapsed playback time parameter as period
442  *          starting from the beginning of the movie.
443  *
444  * @since_tizen 2.3
445  *
446  * @param[in] video           The video metadata handle
447  * @param[in] played_position The position from the beginning of the video (in milliseconds)
448  *
449  * @return @c 0 on success,
450  *         otherwise a negative error value
451  *
452  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
453  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
454  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
455  *
456  * @post video_meta_update_to_db().
457  */
458 int video_meta_set_played_position(video_meta_h video, int played_position);
459
460 /**
461  * @brief Updates the video to the media database.
462  *
463  * @details The function updates the given video meta in the media database. The function should be called after any change in video attributes, to be updated to the media
464  *          database. For example, after using video_meta_get_played_time() for setting the played time of the video, the video_meta_update_to_db() function should be called so as to update
465  *          the given video attributes in the media database.
466  *
467  * @since_tizen 2.3
468  *
469  * @privlevel public
470  * @privilege %http://tizen.org/privilege/content.write
471  *
472  * @remarks Do not call this function in callback function of foreach function like media_info_foreach_media_from_db().
473  *
474  * @param[in] video The video metadata handle
475  *
476  * @return @c 0 on success,
477  *         otherwise a negative error value
478  *
479  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
480  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
481  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
482  *
483  * @pre This function requires opened connection to content service by media_content_connect().
484  *
485  * @see media_content_connect()
486  * @see video_meta_set_played_time()
487  * @see video_meta_set_played_count()s
488  * @see video_meta_set_played_position()
489  */
490 int video_meta_update_to_db(video_meta_h video);
491
492 /**
493  *@}
494  */
495
496 #ifdef __cplusplus
497 }
498 #endif /* __cplusplus */
499 #endif /*__TIZEN_VIDEO_META_H__*/