The Stream Information API provides functions to get audio and video stream information, such as codec type, video width or height, bit rate, and so on.
Required Header
#include <player.h>
Overview
The Player stream information API allows you to get media stream information, including:
- Content metadata, such as the tile, artist, album title and genre.
- Audio stream information, such as audio codec type, sample rate, channels, and bit rate.
- Video stream information, such as video codec type, video width and height.
Functions |
int | player_get_content_info (player_h player, player_content_info_e key, char **value) |
| Gets the media content information.
|
int | player_get_codec_info (player_h player, char **audio_codec, char **video_codec) |
| Gets the audio and video codec information.
|
int | player_get_audio_stream_info (player_h player, int *sample_rate, int *channel, int *bit_rate) |
| Gets the audio stream information.
|
int | player_get_video_stream_info (player_h player, int *fps, int *bit_rate) |
| Gets the video stream information.
|
int | player_get_video_size (player_h player, int *width, int *height) |
| Gets the video display's height and width.
|
int | player_get_album_art (player_h player, void **album_art, int *size) |
| Gets the album art in the media resource.
|
int | player_get_duration (player_h player, int *milliseconds) |
| Gets the total running time of the associated media.
|
int | player_get_duration_nsec (player_h player, int64_t *nanoseconds) |
| Gets the total running time in nanoseconds of the associated media.
|
int | player_set_video_stream_changed_cb (player_h player, player_video_stream_changed_cb callback, void *user_data) |
| Sets a callback function to be invoked when video stream is changed.
|
int | player_unset_video_stream_changed_cb (player_h player) |
| Unsets the video stream changed callback function.
|
Typedefs |
typedef void(* | player_video_stream_changed_cb )(int width, int height, int fps, int bit_rate, void *user_data) |
| Called to notify the video stream changed.
|
Typedef Documentation
Called to notify the video stream changed.
The video stream changing is detected just before rendering operation.
- Since :
- 2.4
- Parameters:
-
[in] | width | The width of the captured image |
[in] | height | The height of the captured image |
[in] | fps | The frame per second of the video
It can be 0 if there is no video stream information. |
[in] | bit_rate | The video bit rate [Hz]
It can be an invalid value if there is no video stream information. |
[in] | user_data | The user data passed from the callback registration function |
- See also:
- player_set_video_stream_changed_cb()
Enumeration Type Documentation
Enumeration for media stream content information.
- Since :
- 2.3
- Enumerator:
PLAYER_CONTENT_INFO_ALBUM |
Album
|
PLAYER_CONTENT_INFO_ARTIST |
Artist
|
PLAYER_CONTENT_INFO_AUTHOR |
Author
|
PLAYER_CONTENT_INFO_GENRE |
Genre
|
PLAYER_CONTENT_INFO_TITLE |
Title
|
PLAYER_CONTENT_INFO_YEAR |
Year
|
Function Documentation
Gets the album art in the media resource.
- Since :
- 2.3
- Parameters:
-
[in] | player | The handle to the media player |
[out] | album_art | The encoded artwork image |
[out] | size | The encoded artwork size |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
- Precondition:
- The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
Gets the audio stream information.
- Since :
- 2.3
- Parameters:
-
[in] | player | The handle to the media player |
[out] | sample_rate | The audio sample rate [Hz]
Value can be invalid if there is no audio stream information. |
[out] | channel | The audio channel (1: mono, 2: stereo)
Value can be invalid if there is no audio stream information. |
[out] | bit_rate | The audio bit rate [Hz]
Value can be invalid if there is no audio stream information. |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
- Precondition:
- The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
Gets the audio and video codec information.
- Since :
- 2.3
- Parameters:
-
[in] | player | The handle to the media player |
[out] | audio_codec | The name of the audio codec
It can be NULL if there is no audio codec. |
[out] | video_codec | The name of the video codec
It can be NULL if there is no video codec. |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
- Precondition:
- The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
Gets the media content information.
- Since :
- 2.3
- Parameters:
-
[in] | player | The handle to the media player |
[in] | key | The key attribute name to get |
[out] | value | The value of the key attribute
It can be an empty string if there is no content information. |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
- Precondition:
- The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
Gets the video display's height and width.
- Since :
- 2.3
- Parameters:
-
[in] | player | The handle to the media player |
[out] | width | The width of the video
Value can be invalid if there is no video or no display is set. |
[out] | height | The height of the video
Value can be invalid value if there is no video or no display is set. |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
- Precondition:
- The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
Gets the video stream information.
- Since :
- 2.3
- Parameters:
-
[in] | player | The handle to the media player |
[out] | fps | The frame per second of the video
It can be 0 if there is no video stream information. |
[out] | bit_rate | The video bit rate [Hz]
It can be an invalid value if there is no video stream information. |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
- Precondition:
- The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
Unsets the video stream changed callback function.
- Since :
- 2.4
- Parameters:
-
[in] | player | The handle to the media player |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
- See also:
- player_set_video_stream_changed_cb()