| 
    Tizen Native API
    5.0
    
   
   | 
  
  
  
 
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
| 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.
The video stream changing is detected just before rendering operation.
- Since :
 - 3.0
 
- 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 be0if 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
Function Documentation
| int player_get_album_art | ( | player_h | player, | 
| void ** | album_art, | ||
| int * | size | ||
| ) | 
Gets the album art in the media resource.
- Since :
 - 2.3.1
 
- Remarks:
 - You must not release album_art. The album_art is managed by the platform and will be released when the player is unprepared or destroyed by calling player_unprepare() or player_destroy().
 
- Parameters:
 - 
  
[in] player The handle to the media player [out] album_art The encoded artwork image [out] size The encoded artwork size  
- Returns:
 0on success, otherwise a negative error value
- Return values:
 - 
  
PLAYER_ERROR_NONE Successful PLAYER_ERROR_INVALID_PARAMETER Invalid parameter PLAYER_ERROR_INVALID_OPERATION Invalid operation PLAYER_ERROR_INVALID_STATE Invalid player state  
- Precondition:
 - The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
 
| int player_get_audio_stream_info | ( | player_h | player, | 
| int * | sample_rate, | ||
| int * | channel, | ||
| int * | bit_rate | ||
| ) | 
Gets the audio stream information.
- Since :
 - 2.3.1
 
- Remarks:
 - The playback type should be local playback or HTTP streaming playback.
 
- 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:
 0on success, otherwise a negative error value
- Return values:
 - 
  
PLAYER_ERROR_NONE Successful PLAYER_ERROR_INVALID_PARAMETER Invalid parameter PLAYER_ERROR_INVALID_OPERATION Invalid operation PLAYER_ERROR_INVALID_STATE Invalid player state  
- Precondition:
 - The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
 
| int player_get_codec_info | ( | player_h | player, | 
| char ** | audio_codec, | ||
| char ** | video_codec | ||
| ) | 
Gets the audio and video codec information.
- Since :
 - 2.3.1
 
- Remarks:
 - You must release audio_codec and video_codec using free().
 - The playback type should be local playback or HTTP streaming playback.
 
- Parameters:
 - 
  
[in] player The handle to the media player [out] audio_codec The name of the audio codec 
It can beNULLif there is no audio codec.[out] video_codec The name of the video codec 
It can beNULLif there is no video codec. 
- Returns:
 0on success, otherwise a negative error value
- Return values:
 - 
  
PLAYER_ERROR_NONE Successful PLAYER_ERROR_INVALID_PARAMETER Invalid parameter PLAYER_ERROR_INVALID_OPERATION Invalid operation PLAYER_ERROR_INVALID_STATE Invalid player state  
- Precondition:
 - The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
 
| int player_get_content_info | ( | player_h | player, | 
| player_content_info_e | key, | ||
| char ** | value | ||
| ) | 
Gets the media content information.
- Since :
 - 2.3.1
 
- Remarks:
 - You must release value using 
free(). - The playback type should be local playback or HTTP streaming playback.
 
- 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:
 0on success, otherwise a negative error value
- Return values:
 - 
  
PLAYER_ERROR_NONE Successful PLAYER_ERROR_INVALID_PARAMETER Invalid parameter PLAYER_ERROR_OUT_OF_MEMORY Not enough memory is available PLAYER_ERROR_INVALID_OPERATION Invalid operation PLAYER_ERROR_INVALID_STATE Invalid player state  
- Precondition:
 - The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
 
| int player_get_duration | ( | player_h | player, | 
| int * | milliseconds | ||
| ) | 
Gets the total running time of the associated media.
- Since :
 - 2.3.1
 
- Remarks:
 - The media source is associated with the player, using either player_set_uri() or player_set_memory_buffer().
 - The playback type should be local playback or HTTP streaming playback.
 
- Parameters:
 - 
  
[in] player The handle to the media player [out] milliseconds The duration in milliseconds  
- Returns:
 0on success, otherwise a negative error value
- Return values:
 - 
  
PLAYER_ERROR_NONE Successful PLAYER_ERROR_INVALID_PARAMETER Invalid parameter PLAYER_ERROR_INVALID_OPERATION Invalid operation PLAYER_ERROR_INVALID_STATE Invalid player state  
- Precondition:
 - The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
 
| int player_get_duration_nsec | ( | player_h | player, | 
| int64_t * | nanoseconds | ||
| ) | 
Gets the total running time in nanoseconds of the associated media.
- Since :
 - 5.0
 
- Parameters:
 - 
  
[in] player The handle to the media player [out] nanoseconds The duration time in nanoseconds  
- Returns:
 0on success, otherwise a negative error value
- Return values:
 - 
  
PLAYER_ERROR_NONE Successful PLAYER_ERROR_INVALID_PARAMETER Invalid parameter PLAYER_ERROR_INVALID_OPERATION Invalid operation PLAYER_ERROR_INVALID_STATE Invalid player state  
- Precondition:
 - The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
 
| int player_get_video_size | ( | player_h | player, | 
| int * | width, | ||
| int * | height | ||
| ) | 
Gets the video display's height and width.
- Since :
 - 2.3.1
 
- Remarks:
 - The playback type should be local playback or HTTP streaming playback.
 
- 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:
 0on success, otherwise a negative error value
- Return values:
 - 
  
PLAYER_ERROR_NONE Successful PLAYER_ERROR_INVALID_PARAMETER Invalid parameter PLAYER_ERROR_INVALID_OPERATION Invalid operation PLAYER_ERROR_INVALID_STATE Invalid player state  
- Precondition:
 - The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
 
| int player_get_video_stream_info | ( | player_h | player, | 
| int * | fps, | ||
| int * | bit_rate | ||
| ) | 
Gets the video stream information.
- Since :
 - 2.3.1
 
- Remarks:
 - The playback type should be local playback or HTTP streaming playback.
 
- Parameters:
 - 
  
[in] player The handle to the media player [out] fps The frame per second of the video 
It can be0if 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:
 0on success, otherwise a negative error value
- Return values:
 - 
  
PLAYER_ERROR_NONE Successful PLAYER_ERROR_INVALID_PARAMETER Invalid parameter PLAYER_ERROR_INVALID_OPERATION Invalid operation PLAYER_ERROR_INVALID_STATE Invalid player state  
- Precondition:
 - The player state must be one of PLAYER_STATE_READY, PLAYER_STATE_PLAYING or PLAYER_STATE_PAUSED.
 
| 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.
- Since :
 - 3.0
 
- Remarks:
 - The stream changing is detected just before rendering operation.
 - The callback is called in a separate thread (not in the main loop).
 - This function must be called before calling the player_prepare() or player_prepare_async() to reflect the requirement when the player is building.
 
- Parameters:
 - 
  
[in] player The handle to the media player [in] callback The stream changed callback function to register [in] user_data The user data to be passed to the callback function  
- Returns:
 0on success, otherwise a negative error value
- Return values:
 - 
  
PLAYER_ERROR_NONE Successful PLAYER_ERROR_INVALID_STATE Invalid player state PLAYER_ERROR_INVALID_PARAMETER Invalid parameter  
- Precondition:
 - The player state must be set to PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
 
- Postcondition:
 - player_video_stream_changed_cb() will be invoked.
 
| int player_unset_video_stream_changed_cb | ( | player_h | player | ) | 
Unsets the video stream changed callback function.
- Since :
 - 3.0
 
- Parameters:
 - 
  
[in] player The handle to the media player  
- Returns:
 0on success, otherwise a negative error value
- Return values:
 - 
  
PLAYER_ERROR_NONE Successful PLAYER_ERROR_INVALID_PARAMETER Invalid parameter  
- See also:
 - player_set_video_stream_changed_cb()