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