Tizen Native API
7.0
|
The Media Source API provides functions to manage media sources to communicate with the remote peer.
Required Header
#include <webrtc.h>
Overview
The WebRTC Media Source API allows you to:
- add/remove the media source (audiotest, videotest, mic, camera, screen, media file, media packet)
- pause/mute the media source
- get/set the transceiver direction to the media source (sendrecv, sendonly, recvonly)
- set/get the video resolution of the media source
- push a media packet in case of the media packet source
Related Features
This API is related with the following features:
- http://tizen.org/feature/microphone
- http://tizen.org/feature/camera
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | webrtc_add_media_source (webrtc_h webrtc, webrtc_media_source_type_e type, unsigned int *source_id) |
Adds a media source. | |
int | webrtc_remove_media_source (webrtc_h webrtc, unsigned int source_id) |
Removes the media source. | |
int | webrtc_media_source_set_transceiver_direction (webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction) |
Sets the transceiver direction to the media source with specified media type. | |
int | webrtc_media_source_get_transceiver_direction (webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction) |
Gets the transceiver direction of the media source with specified media type. | |
int | webrtc_media_source_foreach_supported_transceiver_codec (webrtc_h webrtc, webrtc_media_source_type_e source_type, webrtc_media_type_e media_type, webrtc_media_source_supported_transceiver_codec_cb callback, void *user_data) |
Retrieves all the supported transceiver codecs. | |
int | webrtc_media_source_set_transceiver_codec (webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_codec_e codec) |
Sets the transceiver codec to the media source. | |
int | webrtc_media_source_get_transceiver_codec (webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_codec_e *codec) |
Gets the transceiver codec of the media source. | |
int | webrtc_media_source_set_pause (webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause) |
Sets pause to the media source. | |
int | webrtc_media_source_get_pause (webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused) |
Gets the pause state of the media source. | |
int | webrtc_media_source_set_mute (webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool mute) |
Sets mute to the media source. | |
int | webrtc_media_source_get_mute (webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *muted) |
Gets the mute state of the media source. | |
int | webrtc_media_source_set_encoder_bitrate (webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, int target_bitrate) |
Sets an encoder target bitrate(in bits/sec) to the media source. | |
int | webrtc_media_source_get_encoder_bitrate (webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, int *target_bitrate) |
Gets the encoder target bitrate(in bits/sec) of the media source. | |
int | webrtc_media_source_set_video_resolution (webrtc_h webrtc, unsigned int source_id, int width, int height) |
Sets a video resolution to the media source. | |
int | webrtc_media_source_get_video_resolution (webrtc_h webrtc, unsigned int source_id, int *width, int *height) |
Gets the video resolution of the media source. | |
int | webrtc_media_source_set_video_framerate (webrtc_h webrtc, unsigned int source_id, int framerate) |
Sets a video source frame rate, also known as FPS. | |
int | webrtc_media_source_get_video_framerate (webrtc_h webrtc, unsigned int source_id, int *framerate) |
Gets the video source frame rate, also known as FPS. | |
int | webrtc_mic_source_set_sound_stream_info (webrtc_h webrtc, unsigned int source_id, sound_stream_info_h stream_info) |
Sets the mic source's sound manager stream information. | |
int | webrtc_camera_source_set_device_id (webrtc_h webrtc, unsigned int source_id, unsigned int device_id) |
Sets a camera device id to the camera source. | |
int | webrtc_camera_source_get_device_id (webrtc_h webrtc, unsigned int source_id, unsigned int *device_id) |
Gets the camera device id of the camera source. | |
int | webrtc_media_packet_source_set_buffer_state_changed_cb (webrtc_h webrtc, unsigned int source_id, webrtc_media_packet_source_buffer_state_changed_cb callback, void *user_data) |
Sets a callback function to be invoked when the buffer state of media packet source is changed. | |
int | webrtc_media_packet_source_unset_buffer_state_changed_cb (webrtc_h webrtc, unsigned int source_id) |
Unsets the buffer state changed callback function. | |
int | webrtc_media_packet_source_set_format (webrtc_h webrtc, unsigned int source_id, media_format_h format) |
Sets media format to the media packet source. | |
int | webrtc_media_packet_source_push_packet (webrtc_h webrtc, unsigned int source_id, media_packet_h packet) |
Pushes media packet to the media packet source. | |
int | webrtc_file_source_set_path (webrtc_h webrtc, unsigned int source_id, const char *path) |
Sets media path of the file source. | |
int | webrtc_file_source_set_looping (webrtc_h webrtc, unsigned int source_id, bool looping) |
Sets looping mode of the file source. | |
int | webrtc_file_source_get_looping (webrtc_h webrtc, unsigned int source_id, bool *looping) |
Gets looping mode of the file source. | |
int | webrtc_screen_source_set_crop (webrtc_h webrtc, unsigned int source_id, int x, int y, int width, int height) |
Sets the crop coordinates of a screen source. | |
int | webrtc_screen_source_unset_crop (webrtc_h webrtc, unsigned int source_id) |
Unsets the crop coordinates of a screen source. | |
Typedefs | |
typedef void(* | webrtc_media_packet_source_buffer_state_changed_cb )(unsigned int source_id, webrtc_media_packet_source_buffer_state_e state, void *user_data) |
Called when the buffer state of media packet source is changed. | |
typedef bool(* | webrtc_media_source_supported_transceiver_codec_cb )(webrtc_transceiver_codec_e codec, void *user_data) |
Called iteratively to report all the supported transceiver codecs. |
Typedef Documentation
typedef void(* webrtc_media_packet_source_buffer_state_changed_cb)(unsigned int source_id, webrtc_media_packet_source_buffer_state_e state, void *user_data) |
Called when the buffer state of media packet source is changed.
- Since :
- 6.5
- Parameters:
-
[in] source_id The media source id [in] state The buffer state (underflow or overflow) [in] user_data The user data passed from the callback registration function
typedef bool(* webrtc_media_source_supported_transceiver_codec_cb)(webrtc_transceiver_codec_e codec, void *user_data) |
Called iteratively to report all the supported transceiver codecs.
- Since :
- 7.0
- Parameters:
-
[in] codec The supported codec [in] user_data The user data passed from the callback registration function
- Returns:
true
to continue with the next iteration of the loop, otherwisefalse
to break out of the loop
Enumeration Type Documentation
Enumeration for WebRTC media source type.
- Since :
- 6.5
- Enumerator:
Enumeration for WebRTC transceiver codec.
- Since :
- 7.0
Function Documentation
int webrtc_add_media_source | ( | webrtc_h | webrtc, |
webrtc_media_source_type_e | type, | ||
unsigned int * | source_id | ||
) |
Adds a media source.
- Since :
- 6.5
- Remarks:
- The camera privilege(http://tizen.org/privilege/camera) should be added if type is WEBRTC_MEDIA_SOURCE_TYPE_CAMERA.
The recorder privilege(http://tizen.org/privilege/recorder) should be added if type is WEBRTC_MEDIA_SOURCE_TYPE_MIC.
With type of WEBRTC_MEDIA_SOURCE_TYPE_NULL, you can configure a transceiver only for receiving audio or video stream. (Since 7.0)
type of WEBRTC_MEDIA_SOURCE_TYPE_SCREEN is not allowed to be used by third-party applications due to the security reasons. (Since 7.0)
- Parameters:
-
[in] webrtc WebRTC handle [in] type The media source type to be added [out] source_id The media source id
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_NOT_SUPPORTED Not supported WEBRTC_ERROR_PERMISSION_DENIED Permission denied WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
- See also:
- webrtc_remove_media_source()
- webrtc_media_source_set_transceiver_direction()
- webrtc_media_source_get_transceiver_direction()
- webrtc_media_source_foreach_supported_transceiver_codec()
- webrtc_media_source_set_transceiver_codec()
- webrtc_media_source_get_transceiver_codec()
- webrtc_media_source_set_pause()
- webrtc_media_source_get_pause()
- webrtc_media_source_set_mute()
- webrtc_media_source_get_mute()
- webrtc_media_source_set_encoder_bitrate()
- webrtc_media_source_get_encoder_bitrate()
- webrtc_media_source_set_video_resolution()
- webrtc_media_source_get_video_resolution()
- webrtc_media_source_set_video_framerate()
- webrtc_media_source_get_video_framerate()
- webrtc_media_source_set_audio_loopback()
- webrtc_media_source_unset_audio_loopback()
- webrtc_media_source_set_video_loopback()
- webrtc_media_source_unset_video_loopback()
- webrtc_mic_source_set_sound_stream_info()
- webrtc_camera_source_set_device_id()
- webrtc_camera_source_get_device_id()
- webrtc_file_source_set_path()
- webrtc_file_source_set_looping()
- webrtc_file_source_get_looping()
- webrtc_media_packet_source_set_buffer_state_changed_cb()
- webrtc_media_packet_source_unset_buffer_state_changed_cb()
- webrtc_media_packet_source_set_format()
- webrtc_media_packet_source_push_packet()
int webrtc_camera_source_get_device_id | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
unsigned int * | device_id | ||
) |
Gets the camera device id of the camera source.
- Since :
- 7.0
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The camera source id [out] device_id The camera device id
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Add camera source to webrtc to get source_id by calling webrtc_add_media_source().
int webrtc_camera_source_set_device_id | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
unsigned int | device_id | ||
) |
Sets a camera device id to the camera source.
- Since :
- 7.0
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The camera source id [in] device_id The camera device id
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- Add camera source to webrtc to get source_id by calling webrtc_add_media_source().
- webrtc state must be set to WEBRTC_STATE_IDLE.
int webrtc_file_source_get_looping | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
bool * | looping | ||
) |
Gets looping mode of the file source.
- Since :
- 7.0
- Remarks:
- The default value is
false
.
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The file source id [out] looping The looping state: ( true
= looping,false
= non-looping)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- See also:
- webrtc_file_source_set_looping()
int webrtc_file_source_set_looping | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
bool | looping | ||
) |
Sets looping mode of the file source.
If looping is true
, the transfer starts again from the beginning of the file source after reaching the end of the file. If it is false
, it won't. The default value is false
.
- Since :
- 7.0
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The file source id [in] looping The new looping state: ( true
= looping,false
= non-looping)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- See also:
- webrtc_file_source_get_looping()
int webrtc_file_source_set_path | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
const char * | path | ||
) |
Sets media path of the file source.
- Since :
- 7.0
- Remarks:
- http://tizen.org/privilege/mediastorage is needed if path is relevant to internal media storage.
http://tizen.org/privilege/externalstorage is needed if path is relevant to external media storage.
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The file source id [in] path The media path
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_PERMISSION_DENIED Permission denied WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- Add file source to webrtc to get source_id by calling webrtc_add_media_source().
- webrtc state must be set to WEBRTC_STATE_IDLE.
int webrtc_media_packet_source_push_packet | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
media_packet_h | packet | ||
) |
Pushes media packet to the media packet source.
- Since :
- 6.5
- Remarks:
- This function takes ownership of the packet.
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media packet source id [in] packet The media packet
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Add media packet source to webrtc to get source_id by calling webrtc_add_media_source().
- webrtc_media_packet_source_set_format() must be called before calling this function.
- webrtc_media_packet_source_buffer_state_changed_cb() must be set by calling webrtc_media_packet_source_set_buffer_state_changed_cb().
int webrtc_media_packet_source_set_buffer_state_changed_cb | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
webrtc_media_packet_source_buffer_state_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets a callback function to be invoked when the buffer state of media packet source is changed.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media packet source id [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- Precondition:
- Add media packet source to webrtc to get source_id by calling webrtc_add_media_source().
- Postcondition:
- webrtc_media_packet_source_buffer_state_changed_cb() will be invoked.
int webrtc_media_packet_source_set_format | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
media_format_h | format | ||
) |
Sets media format to the media packet source.
- Since :
- 6.5
- Remarks:
- The following media format mimetypes can be used to create the format :
MEDIA_FORMAT_VORBIS
MEDIA_FORMAT_OPUS
MEDIA_FORMAT_PCM_S16LE
MEDIA_FORMAT_PCMU
MEDIA_FORMAT_PCMA
MEDIA_FORMAT_H264_SP
MEDIA_FORMAT_H264_MP
MEDIA_FORMAT_H264_HP
MEDIA_FORMAT_MJPEG
MEDIA_FORMAT_VP8
MEDIA_FORMAT_VP9
MEDIA_FORMAT_I420
MEDIA_FORMAT_NV12
For more details, please refer to Media Format.
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media packet source id [in] format The media format
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- Add media packet source to webrtc to get source_id by calling webrtc_add_media_source().
- webrtc state must be set to WEBRTC_STATE_IDLE.
int webrtc_media_packet_source_unset_buffer_state_changed_cb | ( | webrtc_h | webrtc, |
unsigned int | source_id | ||
) |
Unsets the buffer state changed callback function.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media packet source id
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Add media packet source to webrtc to get source_id by calling webrtc_add_media_source().
int webrtc_media_source_foreach_supported_transceiver_codec | ( | webrtc_h | webrtc, |
webrtc_media_source_type_e | source_type, | ||
webrtc_media_type_e | media_type, | ||
webrtc_media_source_supported_transceiver_codec_cb | callback, | ||
void * | user_data | ||
) |
Retrieves all the supported transceiver codecs.
- Since :
- 7.0
- Remarks:
- If source_type is WEBRTC_MEDIA_SOURCE_TYPE_FILE or WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, this function will return WEBRTC_ERROR_INVALID_PARAMETER.
- Parameters:
-
[in] webrtc WebRTC handle [in] source_type The media source type [in] media_type The media type [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
int webrtc_media_source_get_encoder_bitrate | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
webrtc_media_type_e | media_type, | ||
int * | target_bitrate | ||
) |
Gets the encoder target bitrate(in bits/sec) of the media source.
If source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_FILE or WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET or WEBRTC_MEDIA_SOURCE_TYPE_NULL, this function will return WEBRTC_ERROR_INVALID_PARAMETER.
- Since :
- 7.0
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media source id [in] media_type The media type [out] target_bitrate The target bitrate of the encoder
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Add media source to webrtc to get source_id by calling webrtc_add_media_source().
int webrtc_media_source_get_mute | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
webrtc_media_type_e | media_type, | ||
bool * | muted | ||
) |
Gets the mute state of the media source.
If source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_FILE or WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET or WEBRTC_MEDIA_SOURCE_TYPE_NULL (Since 7.0), this function will return WEBRTC_ERROR_INVALID_PARAMETER.
- Since :
- 6.5
- Remarks:
- The default value is
false
.
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media source id [in] media_type The media type [out] muted Muted or not ( true
= muted,false
= not muted)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- See also:
- webrtc_media_source_set_mute()
int webrtc_media_source_get_pause | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
webrtc_media_type_e | media_type, | ||
bool * | paused | ||
) |
Gets the pause state of the media source.
- Since :
- 6.5
- Remarks:
- The default value is
false
.
If source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_NULL, this function will return WEBRTC_ERROR_INVALID_PARAMETER. (Since 7.0)
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media source id [in] media_type The media type [out] paused Paused or not ( true
= paused,false
= playing)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- See also:
- webrtc_media_source_set_pause()
int webrtc_media_source_get_transceiver_codec | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
webrtc_media_type_e | media_type, | ||
webrtc_transceiver_codec_e * | codec | ||
) |
Gets the transceiver codec of the media source.
- Since :
- 7.0
- Remarks:
- If source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_FILE or WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, this function will return WEBRTC_ERROR_INVALID_PARAMETER.
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media source id [in] media_type The media type [out] codec Current transceiver codec
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Add media source to webrtc to get source_id by calling webrtc_add_media_source().
int webrtc_media_source_get_transceiver_direction | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
webrtc_media_type_e | media_type, | ||
webrtc_transceiver_direction_e * | direction | ||
) |
Gets the transceiver direction of the media source with specified media type.
- Since :
- 6.5
- Remarks:
- The default value is WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV except for a media source of WEBRTC_MEDIA_SOURCE_TYPE_NULL.
If source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_NULL, the default value is WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY. (Since 7.0)
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media source id [in] media_type The media type [out] direction Current transceiver direction
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Add media source to webrtc to get source_id by calling webrtc_add_media_source().
- webrtc_media_packet_source_set_format() must be called if source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET.
int webrtc_media_source_get_video_framerate | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
int * | framerate | ||
) |
Gets the video source frame rate, also known as FPS.
The following media source types contain video:
WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST
WEBRTC_MEDIA_SOURCE_TYPE_CAMERA
WEBRTC_MEDIA_SOURCE_TYPE_SCREEN
- Since :
- 7.0
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The video source id [out] framerate The video frame rate
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Add media source to webrtc to get source_id by calling webrtc_add_media_source().
int webrtc_media_source_get_video_resolution | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
int * | width, | ||
int * | height | ||
) |
Gets the video resolution of the media source.
The following media source types contain video:
WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST
WEBRTC_MEDIA_SOURCE_TYPE_CAMERA
WEBRTC_MEDIA_SOURCE_TYPE_SCREEN
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The video source id [out] width The video width [out] height The video height
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Add media source to webrtc to get source_id by calling webrtc_add_media_source().
int webrtc_media_source_set_encoder_bitrate | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
webrtc_media_type_e | media_type, | ||
int | target_bitrate | ||
) |
Sets an encoder target bitrate(in bits/sec) to the media source.
If source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_FILE or WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET or WEBRTC_MEDIA_SOURCE_TYPE_NULL, this function will return WEBRTC_ERROR_INVALID_PARAMETER.
- Since :
- 7.0
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media source id [in] media_type The media type [in] target_bitrate The target bitrate of the encoder
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Add media source to webrtc to get source_id by calling webrtc_add_media_source().
int webrtc_media_source_set_mute | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
webrtc_media_type_e | media_type, | ||
bool | mute | ||
) |
Sets mute to the media source.
If mute is set to true
, black frame or silent sound will be transmitted to the remote peer according to the media type of the source_id.
If source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_FILE or WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET or WEBRTC_MEDIA_SOURCE_TYPE_NULL (Since 7.0), this function will return WEBRTC_ERROR_INVALID_PARAMETER.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media source id [in] media_type The media type [in] mute Mute or not ( true
= mute,false
= not mute)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- See also:
- webrtc_media_source_get_mute()
int webrtc_media_source_set_pause | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
webrtc_media_type_e | media_type, | ||
bool | pause | ||
) |
Sets pause to the media source.
- Since :
- 6.5
- Remarks:
- If source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_NULL, this function will return WEBRTC_ERROR_INVALID_PARAMETER. (Since 7.0)
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media source id [in] media_type The media type [in] pause Pause or play ( true
= pause,false
= play)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- See also:
- webrtc_media_source_get_pause()
int webrtc_media_source_set_transceiver_codec | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
webrtc_media_type_e | media_type, | ||
webrtc_transceiver_codec_e | codec | ||
) |
Sets the transceiver codec to the media source.
- Since :
- 7.0
- Remarks:
- If source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_FILE or WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, this function will return WEBRTC_ERROR_INVALID_PARAMETER.
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media source id [in] media_type The media type [in] codec The transceiver codec to set
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- Add media source to webrtc to get source_id by calling webrtc_add_media_source().
- webrtc state must be set to WEBRTC_STATE_IDLE.
int webrtc_media_source_set_transceiver_direction | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
webrtc_media_type_e | media_type, | ||
webrtc_transceiver_direction_e | direction | ||
) |
Sets the transceiver direction to the media source with specified media type.
- Since :
- 6.5
- Remarks:
- If source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_NULL, it only allows WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY. (Since 7.0)
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media source id [in] media_type The media type [in] direction The transceiver direction to set
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- Add media source to webrtc to get source_id by calling webrtc_add_media_source().
- webrtc_media_packet_source_set_format() must be called if source_id is a media source of WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET.
- webrtc state must be set to WEBRTC_STATE_IDLE.
int webrtc_media_source_set_video_framerate | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
int | framerate | ||
) |
Sets a video source frame rate, also known as FPS.
The following media source types contain video:
WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST
WEBRTC_MEDIA_SOURCE_TYPE_CAMERA
WEBRTC_MEDIA_SOURCE_TYPE_SCREEN
- Since :
- 7.0
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The video source id [in] framerate The video frame rate
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Add media source to webrtc to get source_id by calling webrtc_add_media_source().
int webrtc_media_source_set_video_resolution | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
int | width, | ||
int | height | ||
) |
Sets a video resolution to the media source.
The following media source types contain video:
WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST
WEBRTC_MEDIA_SOURCE_TYPE_CAMERA
WEBRTC_MEDIA_SOURCE_TYPE_SCREEN
- Since :
- 6.5
- Remarks:
- If source_id does not support for the dynamic resolution change, WEBRTC_ERROR_INVALID_OPERATION will be returned
while webrtc state is WEBRTC_STATE_NEGOTIATING or WEBRTC_STATE_PLAYING. Since 7.0, this function supports dynamic resolution change regardless of state for all video sources mentioned in details.
However, some sources cannot be changed to a greater value than the resolution set in the WEBRTC_STATE_IDLE.
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The video source id [in] width The video width [in] height The video height
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- Add media source to webrtc to get source_id by calling webrtc_add_media_source().
int webrtc_mic_source_set_sound_stream_info | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
sound_stream_info_h | stream_info | ||
) |
Sets the mic source's sound manager stream information.
If source_id is not a media source of WEBRTC_MEDIA_SOURCE_TYPE_MIC, this function will return WEBRTC_ERROR_INVALID_PARAMETER.
- Since :
- 6.5
- Remarks:
- You can set sound stream information including audio routing.
The following sound stream types can be used to create the stream_info :
SOUND_STREAM_TYPE_MEDIA
SOUND_STREAM_TYPE_VOICE_RECOGNITION
SOUND_STREAM_TYPE_VOIP
SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY
For more details, please refer to Sound Manager.
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The mic source id [in] stream_info The sound stream information
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_IDLE.
int webrtc_remove_media_source | ( | webrtc_h | webrtc, |
unsigned int | source_id | ||
) |
Removes the media source.
- Since :
- 6.5
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The media source id to be removed
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- Add media source to webrtc to get source_id by calling webrtc_add_media_source().
- webrtc state must be set to WEBRTC_STATE_IDLE.
- See also:
- webrtc_add_media_source()
int webrtc_screen_source_set_crop | ( | webrtc_h | webrtc, |
unsigned int | source_id, | ||
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Sets the crop coordinates of a screen source.
- Warning:
- This is not for use by third-party applications.
- Since :
- 7.0
- Remarks:
- The coordinates are in UI (screen) units, and the start coordinate refers to the upper left corner of the video display area on the screen.
If we give a rectangle within that area (described by x, y, width, height) then this sub-area will be sent to peer and it changes the video resolution. The changed resolution can be checked through webrtc_media_source_get_video_resolution().
Even when the crop area is changed again, the rectangle coordinates are still based on the original UI (screen) as in the first setting.
If the video resolution is changed by webrtc_media_source_set_video_resolution(), then crop cannot be performed.
Crop and resolution change cannot be done at the same time.
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The screen source id [in] x The start X coordinate of the UI for cropping [in] y The start Y coordinate of the UI for cropping [in] width Width of the UI for cropping [in] height Height of the UI for cropping
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_PERMISSION_DENIED Permission denied WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- Add screen source to webrtc to get source_id by calling webrtc_add_media_source().
- webrtc state must be set to WEBRTC_STATE_NEGOTIATING or WEBRTC_STATE_PLAYING.
int webrtc_screen_source_unset_crop | ( | webrtc_h | webrtc, |
unsigned int | source_id | ||
) |
Unsets the crop coordinates of a screen source.
- Warning:
- This is not for use by third-party applications.
- Since :
- 7.0
- Parameters:
-
[in] webrtc WebRTC handle [in] source_id The screen source id
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_PERMISSION_DENIED Permission denied WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_OPERATION Invalid operation WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- Add screen source to webrtc to get source_id by calling webrtc_add_media_source().
- webrtc state must be set to WEBRTC_STATE_NEGOTIATING or WEBRTC_STATE_PLAYING.
- See also:
- webrtc_screen_source_set_crop()