Tizen Native API  5.0
Metadata Extractor

The Metadata Extractor API provides functions for extracting the metadata from an input media file.

Required Header

#include <metadata_extractor.h>

Overview

The Metadata Extractor API allows you to extract the metadata from a media file. To extract a particular type of metadata(metadata_extractor_attr_e), create/destroy the handle(metadata_extractor_create()/metadata_extractor_destroy). To set the path for extracting, and call metadata_extractor_get_metadata().

Functions

int metadata_extractor_create (metadata_extractor_h *metadata)
 Creates metadata.
int metadata_extractor_set_path (metadata_extractor_h metadata, const char *path)
 Sets the file path to extract.
int metadata_extractor_set_buffer (metadata_extractor_h metadata, const void *buffer, int size)
 Sets the buffer to extract.
int metadata_extractor_destroy (metadata_extractor_h metadata)
 Destroys metadata.
int metadata_extractor_get_metadata (metadata_extractor_h metadata, metadata_extractor_attr_e attribute, char **value)
 Gets metadata.
int metadata_extractor_get_artwork (metadata_extractor_h metadata, void **artwork, int *size, char **mime_type)
 Gets the artwork image in a media file.
int metadata_extractor_get_frame (metadata_extractor_h metadata, void **frame, int *size)
 Gets the frame of a video media file.
int metadata_extractor_get_synclyrics (metadata_extractor_h metadata, int index, unsigned long *time_stamp, char **lyrics)
 Gets the synclyrics of a media file.
int metadata_extractor_get_frame_at_time (metadata_extractor_h metadata, unsigned long timestamp, bool is_accurate, void **frame, int *size)
 Gets the frame of a video media.

Typedefs

typedef struct
metadata_extractor_s * 
metadata_extractor_h
 The metadata extractor handle.

Defines

#define METADATA_EXTRACTOR_ERROR_CLASS   TIZEN_ERROR_METADATA_EXTRACTOR
 Definition for Metadata extractor Error Class.

Define Documentation

#define METADATA_EXTRACTOR_ERROR_CLASS   TIZEN_ERROR_METADATA_EXTRACTOR

Definition for Metadata extractor Error Class.

Since :
2.3

Typedef Documentation

typedef struct metadata_extractor_s* metadata_extractor_h

The metadata extractor handle.

Since :
2.3

Enumeration Type Documentation

Enumeration for attribute.

Since :
2.3
Enumerator:
METADATA_DURATION 

Duration

METADATA_VIDEO_BITRATE 

Video Bitrate

METADATA_VIDEO_FPS 

Video FPS

METADATA_VIDEO_WIDTH 

Video Width

METADATA_VIDEO_HEIGHT 

Video Height

METADATA_HAS_VIDEO 

Video stream count

METADATA_AUDIO_BITRATE 

Audio Bitrate

METADATA_AUDIO_CHANNELS 

Audio Channels

METADATA_AUDIO_SAMPLERATE 

Audio Samplerate

METADATA_AUDIO_BITPERSAMPLE 

Audio bit per sample

METADATA_HAS_AUDIO 

Audio stream count

METADATA_ARTIST 

Artist

METADATA_TITLE 

Title

METADATA_ALBUM 

Album

METADATA_ALBUM_ARTIST 

Album_Artist

METADATA_GENRE 

Genre

METADATA_AUTHOR 

Author (Deprecated since 4.0. Use METADATA_COMPOSER instead)

METADATA_COMPOSER 

Composer

METADATA_COPYRIGHT 

Copyright

METADATA_DATE 

Date

METADATA_DESCRIPTION 

Description

METADATA_COMMENT 

Comment

METADATA_TRACK_NUM 

Track number info

METADATA_CLASSIFICATION 

Classification

METADATA_RATING 

Rating

METADATA_LONGITUDE 

Longitude

METADATA_LATITUDE 

Latitude

METADATA_ALTITUDE 

Altitude

METADATA_CONDUCTOR 

Conductor

METADATA_UNSYNCLYRICS 

Unsynchronized lyric

METADATA_SYNCLYRICS_NUM 

Synchronized lyric (time/lyric set) number

METADATA_RECDATE 

Recording date

METADATA_ROTATE 

Rotate(Orientation) Information

METADATA_VIDEO_CODEC 

Video Codec (Since 3.0)

METADATA_AUDIO_CODEC 

Audio Codec (Since 3.0)

METADATA_360 

Flag indicating if the video is a spherical video (Since 3.0)

Enumeration for metadata extractor error.

Since :
2.3
Enumerator:
METADATA_EXTRACTOR_ERROR_NONE 

Successful

METADATA_EXTRACTOR_ERROR_INVALID_PARAMETER 

Invalid parameter

METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORY 

Out of memory

METADATA_EXTRACTOR_ERROR_FILE_EXISTS 

File does not exist

METADATA_EXTRACTOR_ERROR_PERMISSION_DENIED 

Permission denied

METADATA_EXTRACTOR_ERROR_OPERATION_FAILED 

Invalid internal operation


Function Documentation

Creates metadata.

Since :
2.3
Remarks:
The metadata should be released using metadata_extractor_destroy().
Parameters:
[in]metadataThe handle to metadata
Returns:
0 on success, otherwise a negative error value
Return values:
METADATA_EXTRACTOR_ERROR_NONESuccessful
METADATA_EXTRACTOR_ERROR_INVALID_PARAMETERInvalid parameter
METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORYOut of memory
See also:
metadata_extractor_destroy()

Destroys metadata.

Since :
2.3
Parameters:
[in]metadataThe handle to metadata
Returns:
0 on success, otherwise a negative error value
Return values:
METADATA_EXTRACTOR_ERROR_NONESuccessful
METADATA_EXTRACTOR_ERROR_INVALID_PARAMETERInvalid parameter
METADATA_EXTRACTOR_ERROR_OPERATION_FAILEDInternal operation failed
Precondition:
Create a metadata handle by calling metadata_extractor_create().
See also:
metadata_extractor_create()
int metadata_extractor_get_artwork ( metadata_extractor_h  metadata,
void **  artwork,
int *  size,
char **  mime_type 
)

Gets the artwork image in a media file.

Since :
2.3
Remarks:
The artwork and mime_type should be released using free().
In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path.
For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage.
Parameters:
[in]metadataThe handle to metadata
[out]artworkThe encoded artwork image
[out]sizeThe encoded artwork size
[out]mime_typeThe MIME of the artwork
Returns:
0 on success, otherwise a negative error value
Return values:
METADATA_EXTRACTOR_ERROR_NONESuccessful
METADATA_EXTRACTOR_ERROR_INVALID_PARAMETERInvalid parameter
METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORYOut of memory
METADATA_EXTRACTOR_ERROR_OPERATION_FAILEDInternal operation failed
METADATA_EXTRACTOR_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Set the path to extract by calling metadata_extractor_set_path().
See also:
metadata_extractor_create()
metadata_extractor_destroy()
int metadata_extractor_get_frame ( metadata_extractor_h  metadata,
void **  frame,
int *  size 
)

Gets the frame of a video media file.

Since :
2.3
Remarks:
The frame should be released using free(). In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path.
For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage.
Parameters:
[in]metadataThe handle to metadata
[out]frameThe raw frame data in RGB888
[out]sizeThe frame data size
Returns:
0 on success, otherwise a negative error value
Return values:
METADATA_EXTRACTOR_ERROR_NONESuccessful
METADATA_EXTRACTOR_ERROR_INVALID_PARAMETERInvalid parameter
METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORYOut of memory
METADATA_EXTRACTOR_ERROR_OPERATION_FAILEDInternal operation failed
METADATA_EXTRACTOR_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Set the path to extract by calling metadata_extractor_set_path().
See also:
metadata_extractor_create()
metadata_extractor_destroy()
int metadata_extractor_get_frame_at_time ( metadata_extractor_h  metadata,
unsigned long  timestamp,
bool  is_accurate,
void **  frame,
int *  size 
)

Gets the frame of a video media.

Since :
2.3
Remarks:
The frame should be released using free(). In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path.
For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage.
Parameters:
[in]metadataThe handle to metadata
[in]timestampThe timestamp in milliseconds
[in]is_accurateIf true the user can get an accurate frame for the given timestamp,
otherwise false if the user can only get the nearest i-frame of the video rapidly
[out]frameThe raw frame data in RGB888
[out]sizeThe frame data size
Returns:
0 on success, otherwise a negative error value
Return values:
METADATA_EXTRACTOR_ERROR_NONESuccessful
METADATA_EXTRACTOR_ERROR_INVALID_PARAMETERInvalid parameter
METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORYOut of memory
METADATA_EXTRACTOR_ERROR_OPERATION_FAILEDInternal operation failed
METADATA_EXTRACTOR_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Set the path to extract by calling metadata_extractor_set_path().
See also:
metadata_extractor_create()
metadata_extractor_destroy()
int metadata_extractor_get_metadata ( metadata_extractor_h  metadata,
metadata_extractor_attr_e  attribute,
char **  value 
)

Gets metadata.

Since :
2.3
Remarks:
The value should be released using free().
In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path.
For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage.
Parameters:
[in]metadataThe handle to metadata
[in]attributeThe key attribute name to get
[out]valueThe value of the attribute
Returns:
0 on success, otherwise a negative error value
Return values:
METADATA_EXTRACTOR_ERROR_NONESuccessful
METADATA_EXTRACTOR_ERROR_INVALID_PARAMETERInvalid parameter
METADATA_EXTRACTOR_ERROR_OUT_OF_MEMORYOut of memory
METADATA_EXTRACTOR_ERROR_OPERATION_FAILEDInternal operation failed
METADATA_EXTRACTOR_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Set the path to extract by calling metadata_extractor_set_path().
See also:
metadata_extractor_create()
metadata_extractor_destroy()
int metadata_extractor_get_synclyrics ( metadata_extractor_h  metadata,
int  index,
unsigned long *  time_stamp,
char **  lyrics 
)

Gets the synclyrics of a media file.

Since :
2.3
Remarks:
The lyrics should be released using free(). In case of accessing specific path in internal storage or external storage, you may add the privilege for accessing the path.
For example, if you get the specific path by using storage_get_directory(). you should add privilege http://tizen.org/privilege/mediastorage or http://tizen.org/privilege/externalstorage.
Parameters:
[in]metadataThe handle to metadata
[in]indexThe index of time/lyrics to set
[out]time_stampThe time information of the index
[out]lyricsThe lyrics of the index
Returns:
0 on success, otherwise a negative error value
Return values:
METADATA_EXTRACTOR_ERROR_NONESuccessful
METADATA_EXTRACTOR_ERROR_INVALID_PARAMETERInvalid parameter
METADATA_EXTRACTOR_ERROR_OPERATION_FAILEDInternal operation failed
METADATA_EXTRACTOR_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
Set the path to extract by calling metadata_extractor_set_path().
Get the time/lyrics set number by calling metadata_extractor_get_metadata(METADATA_SYNCLYRICS_NUM).
See also:
metadata_extractor_create()
metadata_extractor_destroy()
int metadata_extractor_set_buffer ( metadata_extractor_h  metadata,
const void *  buffer,
int  size 
)

Sets the buffer to extract.

Since :
2.3
Parameters:
[in]metadataThe handle to metadata
[in]bufferThe buffer to extract metadata
[in]sizeThe buffer size
Returns:
0 on success, otherwise a negative error value
Return values:
METADATA_EXTRACTOR_ERROR_NONESuccessful
METADATA_EXTRACTOR_ERROR_INVALID_PARAMETERInvalid parameter
METADATA_EXTRACTOR_ERROR_OPERATION_FAILEDInternal operation failed
Precondition:
Create a metadata handle by calling metadata_extractor_create().
See also:
metadata_extractor_create()
metadata_extractor_destroy()
int metadata_extractor_set_path ( metadata_extractor_h  metadata,
const char *  path 
)

Sets the file path to extract.

Since :
2.3
Parameters:
[in]metadataThe handle to metadata
[in]pathThe path to extract metadata
Returns:
0 on success, otherwise a negative error value
Return values:
METADATA_EXTRACTOR_ERROR_NONESuccessful
METADATA_EXTRACTOR_ERROR_INVALID_PARAMETERInvalid parameter
METADATA_EXTRACTOR_ERROR_FILE_EXISTSFile does not exist
METADATA_EXTRACTOR_ERROR_OPERATION_FAILEDInternal operation failed
Precondition:
Create a metadata handle by calling metadata_extractor_create().
See also:
metadata_extractor_create()
metadata_extractor_destroy()