Tizen Native API  3.0

The Video Metadata API provides functions to get information about video files present in the device.

Required Header

#include <media_content.h>

Overview

The Video Metadata API provides functions to get information about video files present in the device. Following information about video content (video_meta_h )is provided:

  • artist
  • album
  • genre
  • composer
  • year
  • recorded date
  • copyright
  • track number
  • bit rate
  • width
  • height
  • played count
  • played time
  • played position
    and others.

For getting the video handle (video_meta_h) from the media information (media_info_h), call the media_info_get_video() function.
For getting the information related to video files stored in the device call the respective get functions e.g. to get duration of the video file call video_meta_get_duration() function and so on.
When the video handle is no longer needed, it should be destroyed by calling video_meta_destroy() function.

Functions

int video_meta_clone (video_meta_h *dst, video_meta_h src)
 Clones the video metadata.
int video_meta_destroy (video_meta_h video)
 Destroys the video metadata.
int video_meta_get_media_id (video_meta_h video, char **media_id)
 Gets the ID of the media of the given video metadata.
int video_meta_get_album (video_meta_h video, char **album)
 Gets the album of the given video metadata.
int video_meta_get_artist (video_meta_h video, char **artist)
 Gets the artist of the given video metadata.
int video_meta_get_album_artist (video_meta_h video, char **album_artist)
 Gets the video album artist.
int video_meta_get_genre (video_meta_h video, char **genre)
 Gets the genre of the given video metadata.
int video_meta_get_composer (video_meta_h video, char **composer)
 Gets the composer of the given video metadata.
int video_meta_get_year (video_meta_h video, char **year)
 Gets the year of the given video metadata.
int video_meta_get_recorded_date (video_meta_h video, char **recorded_date)
 Gets the recorded date of the video.
int video_meta_get_copyright (video_meta_h video, char **copyright)
 Gets the copyright notice of the given video metadata.
int video_meta_get_track_num (video_meta_h video, char **track_num)
 Gets the track number of the given videoo metadata.
int video_meta_get_bit_rate (video_meta_h video, int *bit_rate)
 Gets the bitrate of the given video metadata in bitrate per second.
int video_meta_get_duration (video_meta_h video, int *duration)
 Gets the track duration of the given videoo metadata.
int video_meta_get_width (video_meta_h video, int *width)
 Gets the width of the given videoo metadata.
int video_meta_get_height (video_meta_h video, int *height)
 Gets the height of the given videoo metadata.
int video_meta_get_played_count (video_meta_h video, int *played_count)
 Gets the played count of the video.
int video_meta_get_played_time (video_meta_h video, time_t *played_time)
 Gets the last played time parameter of the video.
int video_meta_get_played_position (video_meta_h video, int *played_position)
 Gets the played position parameter of the video.
int video_meta_set_played_count (video_meta_h video, int played_count)
 Sets the played count of the video.
int video_meta_set_played_time (video_meta_h video, time_t played_time)
 Sets the last played time of the video.
int video_meta_set_played_position (video_meta_h video, int played_position)
 Sets the played position of the video.
int video_meta_update_to_db (video_meta_h video)
 Updates an video metadata with modified attributes in the media database.

Typedefs

typedef struct video_meta_s * video_meta_h
 The structure type for the Video metadata handle.

Typedef Documentation

typedef struct video_meta_s* video_meta_h

The structure type for the Video metadata handle.

Since :
2.3

Function Documentation

int video_meta_clone ( video_meta_h dst,
video_meta_h  src 
)

Clones the video metadata.

This function copies the video metadata handle from a source to destination.

Since :
2.3
Remarks:
You must release the destination handle using video_meta_destroy().
Parameters:
[out]dstThe destination handle to the video metadata
[in]srcThe source handle to the video metadata
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
See also:
video_meta_destroy()

Destroys the video metadata.

This function frees all resources related to the video metadata handle. This handle no longer can be used to perform any operation. A new handle has to be created before the next use.

Since :
2.3
Parameters:
[in]videoThe video metadata handle
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Get copy of video metadata handle by calling video_meta_clone().
See also:
video_meta_clone()
int video_meta_get_album ( video_meta_h  video,
char **  album 
)

Gets the album of the given video metadata.

If the value is an empty string, the method returns "Unknown".
Since 3.0, if the media content has no album info, the method returns empty string.

Since :
2.3
Remarks:
You must release album using free().
Parameters:
[in]videoThe video metadata handle
[out]albumThe album of the video metadata
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_album_artist ( video_meta_h  video,
char **  album_artist 
)

Gets the video album artist.

If the value is an empty string, the method returns "Unknown".
Since 3.0, if the media content has no album artist info, the method returns empty string.

Since :
2.3
Remarks:
You must release album_artist using free().
Parameters:
[in]videoThe video metadata handle
[out]album_artistThe album artist of the video metadata
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_artist ( video_meta_h  video,
char **  artist 
)

Gets the artist of the given video metadata.

If the value is an empty string, the method returns "Unknown".
Since 3.0, if the media content has no artist info, the method returns empty string.

Since :
2.3
Remarks:
You must release artist using free().
Parameters:
[in]videoThe video metadata handle
[out]artistThe artist of the video metadata
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_bit_rate ( video_meta_h  video,
int *  bit_rate 
)

Gets the bitrate of the given video metadata in bitrate per second.

Since :
2.3
Parameters:
[in]videoThe video metadata handle
[out]bit_rateThe video bit rate in bit per second [bps]
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_composer ( video_meta_h  video,
char **  composer 
)

Gets the composer of the given video metadata.

If the value is an empty string, the method returns "Unknown".
Since 3.0, if the media content has no composer info, the method returns empty string.

Since :
2.3
Remarks:
You must release composer using free().
Parameters:
[in]videoThe video metadata handle
[out]composerThe composer of the video metadata
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_copyright ( video_meta_h  video,
char **  copyright 
)

Gets the copyright notice of the given video metadata.

If the value is an empty string, the method returns "Unknown".
Since 3.0, if the media content has no copyright info, the method returns empty string.

Since :
2.3
Remarks:
You must release copyright using free().
Parameters:
[in]videoThe video metadata handle
[out]copyrightThe copyright of the video metadata
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_duration ( video_meta_h  video,
int *  duration 
)

Gets the track duration of the given videoo metadata.

Since :
2.3
Parameters:
[in]videoThe video metadata handle
[out]durationThe video duration in milliseconds
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_genre ( video_meta_h  video,
char **  genre 
)

Gets the genre of the given video metadata.

If the value is an empty string, the method returns "Unknown".
Since 3.0, if the media content has no genre info, the method returns empty string.

Since :
2.3
Remarks:
You must release genre using free().
Parameters:
[in]videoThe video metadata handle
[out]genreThe genre of the video metadata
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_height ( video_meta_h  video,
int *  height 
)

Gets the height of the given videoo metadata.

Since :
2.3
Parameters:
[in]videoThe video metadata handle
[out]heightThe video height in pixels
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_media_id ( video_meta_h  video,
char **  media_id 
)

Gets the ID of the media of the given video metadata.

Since :
2.3
Remarks:
You must release media_id using free().
Parameters:
[in]videoThe video metadata handle
[out]media_idThe ID of the video
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_played_count ( video_meta_h  video,
int *  played_count 
)

Gets the played count of the video.

Deprecated:
Deprecated since 2.4. [Use media_info_get_played_count() instead]
Since :
2.3
Parameters:
[in]videoThe video metadata handle
[out]played_countThe counter of the video played
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_played_position ( video_meta_h  video,
int *  played_position 
)

Gets the played position parameter of the video.

Deprecated:
Deprecated since 2.4.

This function returns the elapsed playback position parameter of the video as period starting from the beginning of the movie.

Since :
2.3
Parameters:
[in]videoThe video metadata handle
[out]played_positionThe elapsed time of the video
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_played_time ( video_meta_h  video,
time_t *  played_time 
)

Gets the last played time parameter of the video.

Deprecated:
Deprecated since 2.4. [Use media_info_get_played_time() instead]
Since :
2.3
Parameters:
[in]videoThe video metadata handle
[out]played_timeThe last played time of the video
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_recorded_date ( video_meta_h  video,
char **  recorded_date 
)

Gets the recorded date of the video.

Since :
2.3
Remarks:
You must release recorded_date using free().
Parameters:
[in]videoThe video metadata handle
[out]recorded_dateThe recorded date of the video metadata
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_track_num ( video_meta_h  video,
char **  track_num 
)

Gets the track number of the given videoo metadata.

If the value is an empty string, the method returns "Unknown".
Since 3.0, if the media content has no track info, the method returns empty string.

Since :
2.3
Remarks:
You must release track_num using free().
Parameters:
[in]videoThe video metadata handle
[out]track_numThe track number of the video metadata
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_width ( video_meta_h  video,
int *  width 
)

Gets the width of the given videoo metadata.

Since :
2.3
Parameters:
[in]videoThe video metadata handle
[out]widthThe video width in pixels
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_get_year ( video_meta_h  video,
char **  year 
)

Gets the year of the given video metadata.

If the value is an empty string, the method returns "Unknown".
Since 3.0, if the media content has no year info, the method returns empty string.

Since :
2.3
Remarks:
You must release year using free().
Parameters:
[in]videoThe video metadata handle
[out]yearThe year of the video metadata
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
int video_meta_set_played_count ( video_meta_h  video,
int  played_count 
)

Sets the played count of the video.

Deprecated:
Deprecated since 2.4. [Use media_info_increase_played_count() instead]
Since :
2.3
Parameters:
[in]videoThe video metadata handle
[in]played_countThe number of played
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Postcondition:
video_meta_update_to_db().
int video_meta_set_played_position ( video_meta_h  video,
int  played_position 
)

Sets the played position of the video.

Deprecated:
Deprecated since 2.4.
Since :
2.3
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).
Parameters:
[in]videoThe video metadata handle
[in]played_positionThe position from the beginning of the video (in milliseconds)
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Postcondition:
video_meta_update_to_db().
int video_meta_set_played_time ( video_meta_h  video,
time_t  played_time 
)

Sets the last played time of the video.

Deprecated:
Deprecated since 2.4. [Use media_info_set_played_time() instead]
Since :
2.3
Parameters:
[in]videoThe video metadata handle
[in]played_timeThe last played time of the video
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Postcondition:
video_meta_update_to_db().

Updates an video metadata with modified attributes in the media database.

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 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.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/content.write
Remarks:
Do not call this function in callback function of foreach function like media_info_foreach_media_from_db().
Parameters:
[in]videoThe video metadata handle
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_CONTENT_ERROR_NONESuccessful
MEDIA_CONTENT_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_CONTENT_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_CONTENT_ERROR_INVALID_OPERATIONInvalid operation
MEDIA_CONTENT_ERROR_DB_FAILEDDB Operation failed
MEDIA_CONTENT_ERROR_DB_BUSYDB Operation busy
MEDIA_CONTENT_ERROR_NETWORKNetwork fail
MEDIA_CONTENT_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
This function requires opened connection to content service by media_content_connect().
See also:
media_content_connect()
video_meta_set_played_time()
video_meta_set_played_count()
video_meta_set_played_position()