* @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
* @pre @a webrtc state must be set to #WEBRTC_STATE_IDLE.
* @see webrtc_remove_media_source()
- * @see webrtc_set_video_source_resolution()
- * @see webrtc_get_video_source_resolution()
+ * @see webrtc_media_source_set_transceiver_direction()
+ * @see webrtc_media_source_get_transceiver_direction()
+ * @see webrtc_media_source_set_pause()
+ * @see webrtc_media_source_get_pause()
+ * @see webrtc_media_source_set_mute()
+ * @see webrtc_media_source_get_mute()
+ * @see webrtc_media_source_set_video_resolution()
+ * @see webrtc_media_source_get_video_resolution()
+ * @see webrtc_media_packet_source_set_buffer_state_changed_cb()
+ * @see webrtc_media_packet_source_unset_buffer_state_changed_cb()
+ * @see webrtc_media_packet_source_set_format()
+ * @see webrtc_media_packet_source_push_packet()
*/
int webrtc_add_media_source(webrtc_h webrtc, webrtc_media_source_type_e type, unsigned int *source_id);
*/
int webrtc_remove_media_source(webrtc_h webrtc, unsigned int source_id);
+/**
+ * @brief Sets the transceiver direction to the media source with specified media type.
+ * @since_tizen 6.5
+ * @param[in] webrtc WebRTC handle
+ * @param[in] source_id The media source id
+ * @param[in] media_type The media type
+ * @param[in] direction The transceiver direction to set
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #WEBRTC_ERROR_NONE Successful
+ * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
+ * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
+ * @pre webrtc_media_packet_source_set_format() must be called if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET.
+ * @pre @a webrtc state must be set to #WEBRTC_STATE_IDLE.
+ * @see webrtc_media_source_get_transceiver_direction()
+ */
+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);
+
+/**
+ * @brief Gets the transceiver direction of the media source with specified media type.
+ * @since_tizen 6.5
+ * @remarks The default value is #WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV.
+ * @param[in] webrtc WebRTC handle
+ * @param[in] source_id The media source id
+ * @param[in] media_type The media type
+ * @param[out] direction Current transceiver direction
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #WEBRTC_ERROR_NONE Successful
+ * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
+ * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
+ * @pre webrtc_media_packet_source_set_format() must be called if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET.
+ * @see webrtc_media_source_set_transceiver_direction()
+ */
+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);
+
/**
* @brief Sets pause to the media source.
* @since_tizen 6.5
* @retval #WEBRTC_ERROR_NONE Successful
* @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- * @see webrtc_add_media_source()
- * @see webrtc_get_media_source_pause()
+ * @see webrtc_media_source_get_pause()
*/
-int webrtc_set_media_source_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause);
+int webrtc_media_source_set_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause);
/**
* @brief Gets the pause of the media source.
* @retval #WEBRTC_ERROR_NONE Successful
* @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- * @see webrtc_add_media_source()
- * @see webrtc_set_media_source_pause()
+ * @see webrtc_media_source_set_pause()
*/
-int webrtc_get_media_source_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused);
+int webrtc_media_source_get_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused);
/**
- * @brief Sets the media source's mute status.
+ * @brief Sets mute to the media source.
* @details If @a mute is set to @c true, black frame or silent sound will be transmitted to the remote peer according to the media type of the @a source_id. \n
* if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, this function will return #WEBRTC_ERROR_INVALID_PARAMETER.
* @since_tizen 6.5
* @param[in] webrtc WebRTC handle
* @param[in] source_id The media source id
* @param[in] media_type The media type
- * @param[in] muted The new mute status (@c true = mute, @c false = not muted)
+ * @param[in] muted Muted or not (@c true = muted, @c false = not muted)
* @return @c 0 on success,
* otherwise a negative error value
* @retval #WEBRTC_ERROR_NONE Successful
* @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- * @see webrtc_get_media_source_muted()
+ * @see webrtc_media_source_get_mute()
*/
-int webrtc_set_media_source_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool mute);
+int webrtc_media_source_set_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool mute);
/**
- * @brief Gets the media source's mute status.
+ * @brief Gets the mute of the media source.
* @details if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, this function will return #WEBRTC_ERROR_INVALID_PARAMETER.
* @since_tizen 6.5
* @remarks The default value is @c false.
* @retval #WEBRTC_ERROR_NONE Successful
* @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- * @see webrtc_set_media_source_mute()
+ * @see webrtc_media_source_set_mute()
*/
-int webrtc_get_media_source_muted(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *muted);
+int webrtc_media_source_get_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *muted);
/**
- * @brief Sets a video source resolution.
- * @details The following media source types are for the video source:\n
+ * @brief Sets a video resolution to the media source.
+ * @details The following media source types are for the video:\n
* #WEBRTC_MEDIA_SOURCE_TYPE_CAMERA\n
* #WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST\n
* #WEBRTC_MEDIA_SOURCE_TYPE_SCREEN
* @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
* @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
- * @see webrtc_add_media_source()
- * @see webrtc_get_video_source_resolution()
+ * @see webrtc_media_source_get_video_resolution()
*/
-int webrtc_set_video_source_resolution(webrtc_h webrtc, unsigned int source_id, int width, int height);
+int webrtc_media_source_set_video_resolution(webrtc_h webrtc, unsigned int source_id, int width, int height);
/**
- * @brief Gets the video source resolution.
- * @details The following media source types are for the video source:\n
+ * @brief Gets the video resolution of the media source.
+ * @details The following media source types are for the video:\n
* #WEBRTC_MEDIA_SOURCE_TYPE_CAMERA\n
* #WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST\n
* #WEBRTC_MEDIA_SOURCE_TYPE_SCREEN
* @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
* @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
- * @see webrtc_add_media_source()
- * @see webrtc_set_video_source_resolution()
+ * @see webrtc_media_source_set_video_resolution()
*/
-int webrtc_get_video_source_resolution(webrtc_h webrtc, unsigned int source_id, int *width, int *height);
+int webrtc_media_source_get_video_resolution(webrtc_h webrtc, unsigned int source_id, int *width, int *height);
/**
* @brief Sets a callback function to be invoked when the buffer state of media packet source is changed.
*/
int webrtc_media_packet_source_push_packet(webrtc_h webrtc, unsigned int source_id, media_packet_h packet);
-/**
- * @brief Gets the transceiver direction of the media source with specified media type.
- * @since_tizen 6.5
- * @remarks The default value is #WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV.
- * @param[in] webrtc WebRTC handle
- * @param[in] source_id The media source id
- * @param[in] media_type The media type
- * @param[out] direction Current transceiver direction
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #WEBRTC_ERROR_NONE Successful
- * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
- * @pre webrtc_media_packet_source_set_format() must be called if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET.
- * @see webrtc_set_transceiver_direction()
- */
-int webrtc_get_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction);
-
-/**
- * @brief Sets the transceiver direction to the media source with specified media type.
- * @since_tizen 6.5
- * @param[in] webrtc WebRTC handle
- * @param[in] source_id The media source id
- * @param[in] media_type The media type
- * @param[in] direction The transceiver direction to set
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #WEBRTC_ERROR_NONE Successful
- * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
- * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
- * @pre webrtc_media_packet_source_set_format() must be called if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET.
- * @pre @a webrtc state must be set to #WEBRTC_STATE_IDLE.
- * @see webrtc_get_transceiver_direction()
- */
-int webrtc_set_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction);
-
/**
* @}
*/
int _gst_pipeline_set_state(webrtc_s *webrtc, GstState state);
int _add_media_source(webrtc_s *webrtc, webrtc_media_source_type_e type, unsigned int *source_id);
int _remove_media_source(webrtc_s *webrtc, unsigned int source_id);
-int _set_media_source_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause);
-int _get_media_source_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused);
-int _set_audio_source_mute(webrtc_s *webrtc, unsigned int source_id, bool mute);
-int _get_audio_source_muted(webrtc_s *webrtc, unsigned int source_id, bool *muted);
-int _set_video_source_mute(webrtc_s *webrtc, unsigned int source_id, bool mute);
-int _get_video_source_muted(webrtc_s *webrtc, unsigned int source_id, bool *muted);
-int _set_video_source_resolution(webrtc_s *webrtc, unsigned int source_id, int width, int height);
-int _get_video_source_resolution(webrtc_s *webrtc, unsigned int source_id, int *width, int *height);
+int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction);
+int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction);
+int _set_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause);
+int _get_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused);
+int _set_audio_mute(webrtc_s *webrtc, unsigned int source_id, bool mute);
+int _get_audio_mute(webrtc_s *webrtc, unsigned int source_id, bool *muted);
+int _set_video_mute(webrtc_s *webrtc, unsigned int source_id, bool mute);
+int _get_video_mute(webrtc_s *webrtc, unsigned int source_id, bool *muted);
+int _set_video_resolution(webrtc_s *webrtc, unsigned int source_id, int width, int height);
+int _get_video_resolution(webrtc_s *webrtc, unsigned int source_id, int *width, int *height);
int _set_media_format(webrtc_s *webrtc, unsigned int source_id, media_format_h format);
bool _check_if_format_is_set_to_packet_sources(webrtc_s *webrtc);
int _push_media_packet(webrtc_s *webrtc, unsigned int source_id, media_packet_h packet);
-int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction);
-int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction);
void _invoke_state_changed_cb(webrtc_s *webrtc, webrtc_state_e old, webrtc_state_e new);
void _post_state_cb_in_idle(webrtc_s *webrtc, webrtc_state_e new_state);
void _post_error_cb_in_idle(webrtc_s *webrtc, webrtc_error_e error);
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.2.13
+Version: 0.2.14
Release: 0
Group: Multimedia/API
License: Apache-2.0
return ret;
}
-int webrtc_set_media_source_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause)
+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)
{
int ret = WEBRTC_ERROR_NONE;
webrtc_s *_webrtc = (webrtc_s*)webrtc;
g_mutex_lock(&_webrtc->mutex);
- ret = _set_media_source_pause(webrtc, source_id, media_type, pause);
+ RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be IDLE");
+
+ ret = _set_transceiver_direction(webrtc, source_id, media_type, direction);
+ if (ret == WEBRTC_ERROR_NONE)
+ LOG_INFO("source_id[%u] media_type[%d] direction[%d]", source_id, media_type, direction);
+
+ g_mutex_unlock(&_webrtc->mutex);
+
+ return ret;
+}
+
+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)
+{
+ int ret = WEBRTC_ERROR_NONE;
+ webrtc_s *_webrtc = (webrtc_s*)webrtc;
+
+ RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+ RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
+
+ g_mutex_lock(&_webrtc->mutex);
+
+ ret = _get_transceiver_direction(webrtc, source_id, media_type, direction);
+ if (ret == WEBRTC_ERROR_NONE)
+ LOG_INFO("source_id[%u] media_type[%d] direction[%d]", source_id, media_type, *direction);
+
+ g_mutex_unlock(&_webrtc->mutex);
+
+ return ret;
+}
+
+int webrtc_media_source_set_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause)
+{
+ int ret = WEBRTC_ERROR_NONE;
+ webrtc_s *_webrtc = (webrtc_s*)webrtc;
+
+ RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+
+ g_mutex_lock(&_webrtc->mutex);
+
+ ret = _set_pause(webrtc, source_id, media_type, pause);
g_mutex_unlock(&_webrtc->mutex);
return ret;
}
-int webrtc_get_media_source_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused)
+int webrtc_media_source_get_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused)
{
int ret = WEBRTC_ERROR_NONE;
webrtc_s *_webrtc = (webrtc_s*)webrtc;
g_mutex_lock(&_webrtc->mutex);
- ret = _get_media_source_pause(webrtc, source_id, media_type, paused);
+ ret = _get_pause(webrtc, source_id, media_type, paused);
g_mutex_unlock(&_webrtc->mutex);
return ret;
}
-int webrtc_set_media_source_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool mute)
+int webrtc_media_source_set_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool mute)
{
int ret = WEBRTC_ERROR_NONE;
webrtc_s *_webrtc = (webrtc_s*)webrtc;
switch (media_type) {
case WEBRTC_MEDIA_TYPE_AUDIO:
- ret = _set_audio_source_mute(_webrtc, source_id, mute);
+ ret = _set_audio_mute(_webrtc, source_id, mute);
break;
case WEBRTC_MEDIA_TYPE_VIDEO:
- ret = _set_video_source_mute(_webrtc, source_id, mute);
+ ret = _set_video_mute(_webrtc, source_id, mute);
break;
default :
return ret;
}
-int webrtc_get_media_source_muted(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *muted)
+int webrtc_media_source_get_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *muted)
{
int ret = WEBRTC_ERROR_NONE;
webrtc_s *_webrtc = (webrtc_s*)webrtc;
switch (media_type) {
case WEBRTC_MEDIA_TYPE_AUDIO:
- ret = _get_audio_source_muted(_webrtc, source_id, muted);
+ ret = _get_audio_mute(_webrtc, source_id, muted);
break;
case WEBRTC_MEDIA_TYPE_VIDEO:
- ret = _get_video_source_muted(_webrtc, source_id, muted);
+ ret = _get_video_mute(_webrtc, source_id, muted);
break;
default :
return ret;
}
-int webrtc_set_video_source_resolution(webrtc_h webrtc, unsigned int source_id, int width, int height)
+int webrtc_media_source_set_video_resolution(webrtc_h webrtc, unsigned int source_id, int width, int height)
{
int ret = WEBRTC_ERROR_NONE;
webrtc_s *_webrtc = (webrtc_s*)webrtc;
g_mutex_lock(&_webrtc->mutex);
- ret = _set_video_source_resolution(webrtc, source_id, width, height);
+ ret = _set_video_resolution(webrtc, source_id, width, height);
g_mutex_unlock(&_webrtc->mutex);
return ret;
}
-int webrtc_get_video_source_resolution(webrtc_h webrtc, unsigned int source_id, int *width, int *height)
+int webrtc_media_source_get_video_resolution(webrtc_h webrtc, unsigned int source_id, int *width, int *height)
{
int ret = WEBRTC_ERROR_NONE;
webrtc_s *_webrtc = (webrtc_s*)webrtc;
g_mutex_lock(&_webrtc->mutex);
- ret = _get_video_source_resolution(webrtc, source_id, width, height);
+ ret = _get_video_resolution(webrtc, source_id, width, height);
g_mutex_unlock(&_webrtc->mutex);
return ret;
}
-int webrtc_get_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction)
-{
- int ret = WEBRTC_ERROR_NONE;
- webrtc_s *_webrtc = (webrtc_s*)webrtc;
-
- RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
-
- g_mutex_lock(&_webrtc->mutex);
-
- ret = _get_transceiver_direction(webrtc, source_id, media_type, direction);
- if (ret == WEBRTC_ERROR_NONE)
- LOG_INFO("source_id[%u] media_type[%d] direction[%d]", source_id, media_type, *direction);
-
- g_mutex_unlock(&_webrtc->mutex);
-
- return ret;
-}
-
-int webrtc_set_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction)
-{
- int ret = WEBRTC_ERROR_NONE;
- webrtc_s *_webrtc = (webrtc_s*)webrtc;
-
- RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
-
- g_mutex_lock(&_webrtc->mutex);
-
- RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be IDLE");
-
- ret = _set_transceiver_direction(webrtc, source_id, media_type, direction);
- if (ret == WEBRTC_ERROR_NONE)
- LOG_INFO("source_id[%u] media_type[%d] direction[%d]", source_id, media_type, direction);
-
- g_mutex_unlock(&_webrtc->mutex);
-
- return ret;
-}
-
int webrtc_set_display(webrtc_h webrtc, unsigned int track_id, webrtc_display_type_e type, webrtc_display_h display)
{
int ret = WEBRTC_ERROR_NONE;
[WEBRTC_STATE_PLAYING] = "PLAYING",
};
-typedef struct {
- const char *str;
- GstWebRTCRTPTransceiverDirection gst;
-} direction_info_s;
-
typedef struct {
const char *str;
webrtc_peer_connection_state_e state;
webrtc_ice_connection_state_e state;
} ice_connection_state_info_s;
-static direction_info_s __direction_info[] = {
- [WEBRTC_TRANSCEIVER_DIRECTION_SENDONLY] = { "SENDONLY", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY },
- [WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY] = { "RECVONLY", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY },
- [WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV] = { "SENDRECV", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV }
-};
-
static peer_connection_state_info_s __peer_connection_state_info[] = {
[GST_WEBRTC_PEER_CONNECTION_STATE_NEW] = { "NEW", WEBRTC_PEER_CONNECTION_STATE_NEW },
[GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTING] = { "CONNECTING", WEBRTC_PEER_CONNECTION_STATE_CONNECTING },
return slot;
}
-static int __convert_direction(GstWebRTCRTPTransceiverDirection gst_direction, webrtc_transceiver_direction_e *direction)
-{
- RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
-
- if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE ||
- gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE) {
- LOG_ERROR("not expected gst direction[%d]", gst_direction);
- return WEBRTC_ERROR_INVALID_OPERATION;
- }
-
- if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY)
- *direction = WEBRTC_TRANSCEIVER_DIRECTION_SENDONLY;
- else if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY)
- *direction = WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY;
- else
- *direction = WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV;
-
- return WEBRTC_ERROR_NONE;
-}
-
-int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction)
-{
- int ret = WEBRTC_ERROR_INVALID_OPERATION;
- webrtc_gst_slot_s *source;
- GstWebRTCRTPTransceiver *trans;
- GArray *transceivers;
- int mline;
- int i;
-
- RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
- RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL");
- RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL");
- RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
-
- if (media_type == WEBRTC_MEDIA_TYPE_AUDIO && source->media_types & MEDIA_TYPE_AUDIO) {
- mline = source->av[AV_IDX_AUDIO].mline;
-
- } else if (media_type == WEBRTC_MEDIA_TYPE_VIDEO && source->media_types & MEDIA_TYPE_VIDEO) {
- mline = source->av[AV_IDX_VIDEO].mline;
-
- } else {
- LOG_ERROR("invalid media_type[%d] for source[media_types:0x%x, id:%u]", media_type, source->media_types, source_id);
- return WEBRTC_ERROR_INVALID_PARAMETER;
- }
-
- g_signal_emit_by_name(webrtc->gst.webrtcbin, "get-transceivers", &transceivers);
- for (i = 0; i < transceivers->len; i++) {
- trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
- if (trans->mline == mline) {
- ret = __convert_direction(trans->direction, direction);
- if (ret == WEBRTC_ERROR_NONE)
- LOG_DEBUG("found transceiver[%p, index:%d, mline:%u, mid:%s, direction:%s]",
- trans, i, trans->mline, trans->mid, __direction_info[*direction].str);
- goto end;
- }
- }
-
- LOG_ERROR("could not find a transceiver with mline[%d]", mline);
-
-end:
- g_array_unref(transceivers);
-
- return ret;
-}
-
-int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction)
-{
- int ret = WEBRTC_ERROR_INVALID_OPERATION;
- webrtc_gst_slot_s *source;
- GstWebRTCRTPTransceiver *trans;
- GArray *transceivers;
- int mline;
- int i;
-
- RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(direction > WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV, WEBRTC_ERROR_INVALID_PARAMETER, "invalid direction");
- RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL");
- RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL");
- RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
-
- if (media_type == WEBRTC_MEDIA_TYPE_AUDIO && source->media_types & MEDIA_TYPE_AUDIO) {
- mline = source->av[AV_IDX_AUDIO].mline;
-
- } else if (media_type == WEBRTC_MEDIA_TYPE_VIDEO && source->media_types & MEDIA_TYPE_VIDEO) {
- mline = source->av[AV_IDX_VIDEO].mline;
-
- } else {
- LOG_ERROR("invalid media_type[%d] for source[media_types:0x%x, id:%u]", media_type, source->media_types, source_id);
- return WEBRTC_ERROR_INVALID_PARAMETER;
- }
-
- g_signal_emit_by_name(webrtc->gst.webrtcbin, "get-transceivers", &transceivers);
- for (i = 0; i < transceivers->len; i++) {
- trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
- if (trans->mline == mline) {
- trans->direction = __direction_info[direction].gst;
- LOG_DEBUG("Set direction to transceiver[%p, index:%d, mline:%u, direction:%s]",
- trans, i, trans->mline, __direction_info[direction].str);
- ret = WEBRTC_ERROR_NONE;
- goto end;
- }
- }
-
- LOG_ERROR("could not find a transceiver with mline[%d]", mline);
-
-end:
- g_array_unref(transceivers);
-
- return ret;
-}
-
static void __update_session_description(GstPromise *promise, bool is_offer, gpointer user_data)
{
GstWebRTCSessionDescription *desc = NULL;
webrtc_gst_slot_s *source;
} probe_userdata_s;
+typedef struct {
+ const char *str;
+ GstWebRTCRTPTransceiverDirection gst;
+} direction_info_s;
+
+static direction_info_s __direction_info[] = {
+ [WEBRTC_TRANSCEIVER_DIRECTION_SENDONLY] = { "SENDONLY", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY },
+ [WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY] = { "RECVONLY", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY },
+ [WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV] = { "SENDRECV", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV }
+};
+
static payload_type_s payload_types[] = {
/* AUDIO */
[CODEC_TYPE_OPUS] = { "OPUS", 48000 },
return ret;
}
-int _set_media_source_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause)
+static int __convert_direction(GstWebRTCRTPTransceiverDirection gst_direction, webrtc_transceiver_direction_e *direction)
+{
+ RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
+
+ if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE ||
+ gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE) {
+ LOG_ERROR("not expected gst direction[%d]", gst_direction);
+ return WEBRTC_ERROR_INVALID_OPERATION;
+ }
+
+ if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY)
+ *direction = WEBRTC_TRANSCEIVER_DIRECTION_SENDONLY;
+ else if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY)
+ *direction = WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY;
+ else
+ *direction = WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV;
+
+ return WEBRTC_ERROR_NONE;
+}
+
+int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction)
+{
+ int ret = WEBRTC_ERROR_INVALID_OPERATION;
+ webrtc_gst_slot_s *source;
+ GstWebRTCRTPTransceiver *trans;
+ GArray *transceivers;
+ int mline;
+ int i;
+
+ RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+ RET_VAL_IF(direction > WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV, WEBRTC_ERROR_INVALID_PARAMETER, "invalid direction");
+ RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL");
+ RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL");
+ RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
+
+ if (media_type == WEBRTC_MEDIA_TYPE_AUDIO && source->media_types & MEDIA_TYPE_AUDIO) {
+ mline = source->av[AV_IDX_AUDIO].mline;
+
+ } else if (media_type == WEBRTC_MEDIA_TYPE_VIDEO && source->media_types & MEDIA_TYPE_VIDEO) {
+ mline = source->av[AV_IDX_VIDEO].mline;
+
+ } else {
+ LOG_ERROR("invalid media_type[%d] for source[media_types:0x%x, id:%u]", media_type, source->media_types, source_id);
+ return WEBRTC_ERROR_INVALID_PARAMETER;
+ }
+
+ g_signal_emit_by_name(webrtc->gst.webrtcbin, "get-transceivers", &transceivers);
+ for (i = 0; i < transceivers->len; i++) {
+ trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
+ if (trans->mline == mline) {
+ trans->direction = __direction_info[direction].gst;
+ LOG_DEBUG("Set direction to transceiver[%p, index:%d, mline:%u, direction:%s]",
+ trans, i, trans->mline, __direction_info[direction].str);
+ ret = WEBRTC_ERROR_NONE;
+ goto end;
+ }
+ }
+
+ LOG_ERROR("could not find a transceiver with mline[%d]", mline);
+
+end:
+ g_array_unref(transceivers);
+
+ return ret;
+}
+
+int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction)
+{
+ int ret = WEBRTC_ERROR_INVALID_OPERATION;
+ webrtc_gst_slot_s *source;
+ GstWebRTCRTPTransceiver *trans;
+ GArray *transceivers;
+ int mline;
+ int i;
+
+ RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+ RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
+ RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL");
+ RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL");
+ RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
+
+ if (media_type == WEBRTC_MEDIA_TYPE_AUDIO && source->media_types & MEDIA_TYPE_AUDIO) {
+ mline = source->av[AV_IDX_AUDIO].mline;
+
+ } else if (media_type == WEBRTC_MEDIA_TYPE_VIDEO && source->media_types & MEDIA_TYPE_VIDEO) {
+ mline = source->av[AV_IDX_VIDEO].mline;
+
+ } else {
+ LOG_ERROR("invalid media_type[%d] for source[media_types:0x%x, id:%u]", media_type, source->media_types, source_id);
+ return WEBRTC_ERROR_INVALID_PARAMETER;
+ }
+
+ g_signal_emit_by_name(webrtc->gst.webrtcbin, "get-transceivers", &transceivers);
+ for (i = 0; i < transceivers->len; i++) {
+ trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
+ if (trans->mline == mline) {
+ ret = __convert_direction(trans->direction, direction);
+ if (ret == WEBRTC_ERROR_NONE)
+ LOG_DEBUG("found transceiver[%p, index:%d, mline:%u, mid:%s, direction:%s]",
+ trans, i, trans->mline, trans->mid, __direction_info[*direction].str);
+ goto end;
+ }
+ }
+
+ LOG_ERROR("could not find a transceiver with mline[%d]", mline);
+
+end:
+ g_array_unref(transceivers);
+
+ return ret;
+}
+
+int _set_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause)
{
webrtc_gst_slot_s *source;
bool prev;
return WEBRTC_ERROR_NONE;
}
-int _get_media_source_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused)
+int _get_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused)
{
webrtc_gst_slot_s *source;
return WEBRTC_ERROR_NONE;
}
-int _set_video_source_resolution(webrtc_s *webrtc, unsigned int source_id, int width, int height)
+int _set_video_resolution(webrtc_s *webrtc, unsigned int source_id, int width, int height)
{
webrtc_gst_slot_s *source;
GstElement *capsfilter;
return WEBRTC_ERROR_NONE;
}
-int _get_video_source_resolution(webrtc_s *webrtc, unsigned int source_id, int *width, int *height)
+int _get_video_resolution(webrtc_s *webrtc, unsigned int source_id, int *width, int *height)
{
webrtc_gst_slot_s *source;
return WEBRTC_ERROR_NONE;
}
-int _set_video_source_mute(webrtc_s *webrtc, unsigned int source_id, bool mute)
+int _set_video_mute(webrtc_s *webrtc, unsigned int source_id, bool mute)
{
int ret = WEBRTC_ERROR_NONE;
webrtc_gst_slot_s *source = NULL;
return ret;
}
-int _set_audio_source_mute(webrtc_s *webrtc, unsigned int source_id, bool mute)
+int _set_audio_mute(webrtc_s *webrtc, unsigned int source_id, bool mute)
{
webrtc_gst_slot_s *source = NULL;
GstElement *volume = NULL;
return WEBRTC_ERROR_NONE;
}
-int _get_video_source_muted(webrtc_s *webrtc, unsigned int source_id, bool *muted)
+int _get_video_mute(webrtc_s *webrtc, unsigned int source_id, bool *muted)
{
webrtc_gst_slot_s *source = NULL;
return WEBRTC_ERROR_NONE;
}
-int _get_audio_source_muted(webrtc_s *webrtc, unsigned int source_id, bool *muted)
+int _get_audio_mute(webrtc_s *webrtc, unsigned int source_id, bool *muted)
{
webrtc_gst_slot_s *source = NULL;
GstElement *volume = NULL;
CURRENT_STATUS_MAINMENU,
CURRENT_STATUS_ADD_MEDIA_SOURCE,
CURRENT_STATUS_REMOVE_MEDIA_SOURCE,
- CURRENT_STATUS_SET_MEDIA_SOURCE_PAUSE,
- CURRENT_STATUS_GET_MEDIA_SOURCE_PAUSE,
- CURRENT_STATUS_SET_VIDEO_SOURCE_RESOLUTION,
- CURRENT_STATUS_GET_VIDEO_SOURCE_RESOLUTION,
+ CURRENT_STATUS_MEDIA_SOURCE_SET_TRANSCEIVER_DIRECTION,
+ CURRENT_STATUS_MEDIA_SOURCE_GET_TRANSCEIVER_DIRECTION,
+ CURRENT_STATUS_MEDIA_SOURCE_SET_PAUSE,
+ CURRENT_STATUS_MEDIA_SOURCE_GET_PAUSE,
+ CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_RESOLUTION,
+ CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_RESOLUTION,
CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_BUFFER_STATE_CHANGED_CB,
CURRENT_STATUS_MEDIA_PACKET_SOURCE_UNSET_BUFFER_STATE_CHANGED_CB,
CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_FORMAT,
- CURRENT_STATUS_GET_TRANSCEIVER_DIRECTION,
- CURRENT_STATUS_SET_TRANSCEIVER_DIRECTION,
CURRENT_STATUS_SET_DISPLAY_TYPE,
CURRENT_STATUS_DATA_CHANNEL_SEND_STRING,
CURRENT_STATUS_DATA_CHANNEL_SEND_STRING_AS_BYTES,
}
}
-static void _webrtc_set_media_source_pause(int index, unsigned int source_id, unsigned int media_type, int is_pause)
+static void _webrtc_media_source_set_pause(int index, unsigned int source_id, unsigned int media_type, int is_pause)
{
int ret = WEBRTC_ERROR_NONE;
- ret = webrtc_set_media_source_pause(g_conns[index].webrtc, source_id, media_type, is_pause > 0 ? true : false);
+ ret = webrtc_media_source_set_pause(g_conns[index].webrtc, source_id, media_type, is_pause > 0 ? true : false);
if (ret != WEBRTC_ERROR_NONE)
- g_print("failed to webrtc_set_media_source_pause(), source_id[%u], media_type[%u], is_pause[%d], ret[0x%x]\n",
+ g_print("failed to webrtc_media_source_set_pause(), source_id[%u], media_type[%u], is_pause[%d], ret[0x%x]\n",
source_id, media_type, is_pause, ret);
else
- g_print("webrtc_set_media_source_pause() success, source_id[%u], media_type[%u], is_pause[%d]\n",
+ g_print("webrtc_media_source_set_pause() success, source_id[%u], media_type[%u], is_pause[%d]\n",
source_id, media_type, is_pause);
}
-static void _webrtc_get_media_source_pause(int index, unsigned int source_id, unsigned int media_type)
+static void _webrtc_media_source_get_pause(int index, unsigned int source_id, unsigned int media_type)
{
int ret = WEBRTC_ERROR_NONE;
bool paused = false;
- ret = webrtc_get_media_source_pause(g_conns[index].webrtc, source_id, media_type, &paused);
+ ret = webrtc_media_source_get_pause(g_conns[index].webrtc, source_id, media_type, &paused);
if (ret != WEBRTC_ERROR_NONE)
- g_print("failed to webrtc_get_media_source_pause(), source_id[%u], media_type[%u], ret[0x%x]\n", source_id, media_type, ret);
+ g_print("failed to webrtc_media_source_get_pause(), source_id[%u], media_type[%u], ret[0x%x]\n", source_id, media_type, ret);
else
- g_print("webrtc_get_media_source_pause() success, source_id[%u], media_type[%u], paused[%d]\n", source_id, media_type, paused);
+ g_print("webrtc_media_source_get_pause() success, source_id[%u], media_type[%u], paused[%d]\n", source_id, media_type, paused);
}
-static void _webrtc_set_video_source_resolution(int index, unsigned int source_id, int width, int height)
+static void _webrtc_media_source_set_video_resolution(int index, unsigned int source_id, int width, int height)
{
int ret = WEBRTC_ERROR_NONE;
- ret = webrtc_set_video_source_resolution(g_conns[index].webrtc, source_id, width, height);
+ ret = webrtc_media_source_set_video_resolution(g_conns[index].webrtc, source_id, width, height);
if (ret != WEBRTC_ERROR_NONE)
- g_print("failed to webrtc_set_video_source_resolution(), source_id[%u], ret[0x%x]\n", source_id, ret);
+ g_print("failed to webrtc_media_source_set_video_resolution(), source_id[%u], ret[0x%x]\n", source_id, ret);
else
- g_print("webrtc_set_video_source_resolution() success, source_id[%u], [%dx%d]\n", source_id, width, height);
+ g_print("webrtc_media_source_set_video_resolution() success, source_id[%u], [%dx%d]\n", source_id, width, height);
}
-static void _webrtc_get_video_source_resolution(int index, unsigned int source_id)
+static void _webrtc_media_source_get_video_resolution(int index, unsigned int source_id)
{
int ret = WEBRTC_ERROR_NONE;
int width;
int height;
- ret = webrtc_get_video_source_resolution(g_conns[index].webrtc, source_id, &width, &height);
+ ret = webrtc_media_source_get_video_resolution(g_conns[index].webrtc, source_id, &width, &height);
if (ret != WEBRTC_ERROR_NONE)
- g_print("failed to webrtc_set_video_source_resolution(), source_id[%u], ret[0x%x]\n", source_id, ret);
+ g_print("failed to webrtc_media_source_set_video_resolution(), source_id[%u], ret[0x%x]\n", source_id, ret);
else
- g_print("webrtc_get_video_source_resolution() success, source_id[%u], [%dx%d]\n", source_id, width, height);
+ g_print("webrtc_media_source_get_video_resolution() success, source_id[%u], [%dx%d]\n", source_id, width, height);
}
#define VIDEO_WIDTH 352
}
}
-static void _webrtc_get_transceiver_direction(int index, unsigned int source_id, webrtc_media_type_e media_type)
+static void _webrtc_media_source_get_transceiver_direction(int index, unsigned int source_id, webrtc_media_type_e media_type)
{
int ret = WEBRTC_ERROR_NONE;
webrtc_transceiver_direction_e direction;
- ret = webrtc_get_transceiver_direction(g_conns[index].webrtc, source_id, media_type, &direction);
+ ret = webrtc_media_source_get_transceiver_direction(g_conns[index].webrtc, source_id, media_type, &direction);
if (ret != WEBRTC_ERROR_NONE)
- g_print("failed to webrtc_get_transceiver_direction(), ret[0x%x]\n", ret);
+ g_print("failed to webrtc_media_source_get_transceiver_direction(), ret[0x%x]\n", ret);
else
- g_print("webrtc_get_transceiver_direction() success, source_id[%u], media_type[%s], direction[%s]\n",
+ g_print("webrtc_media_source_get_transceiver_direction() success, source_id[%u], media_type[%s], direction[%s]\n",
source_id, g_webrtc_media_type_str[media_type], g_webrtc_transceiver_direction_str[direction]);
}
-static void _webrtc_set_transceiver_direction(int index, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction)
+static void _webrtc_media_source_set_transceiver_direction(int index, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction)
{
int ret = WEBRTC_ERROR_NONE;
- ret = webrtc_set_transceiver_direction(g_conns[index].webrtc, source_id, media_type, direction);
+ ret = webrtc_media_source_set_transceiver_direction(g_conns[index].webrtc, source_id, media_type, direction);
if (ret != WEBRTC_ERROR_NONE)
- g_print("failed to webrtc_set_transceiver_direction(), source_id[%u], ret[0x%x]\n", source_id, ret);
+ g_print("failed to webrtc_media_source_set_transceiver_direction(), source_id[%u], ret[0x%x]\n", source_id, ret);
else
- g_print("webrtc_set_transceiver_direction() success, source_id[%u], media_type[%s], direction[%s]\n",
+ g_print("webrtc_media_source_set_transceiver_direction() success, source_id[%u], media_type[%s], direction[%s]\n",
source_id, g_webrtc_media_type_str[media_type], g_webrtc_transceiver_direction_str[direction]);
}
}
}
-static void _webrtc_set_media_source_mute(int index, unsigned int source_id, webrtc_media_type_e media_type, bool mute)
+static void _webrtc_media_source_set_mute(int index, unsigned int source_id, webrtc_media_type_e media_type, bool mute)
{
int ret = 0;
bool mute_status = false;
- ret = webrtc_set_media_source_mute(g_conns[index].webrtc, source_id, media_type, mute);
+ ret = webrtc_media_source_set_mute(g_conns[index].webrtc, source_id, media_type, mute);
if (ret != WEBRTC_ERROR_NONE)
- g_print("failed to webrtc_set_media_source_mute(), source_id[%d], muted[%d], ret[0x%x]\n", source_id, mute, ret);
+ g_print("failed to webrtc_media_source_set_mute(), source_id[%d], muted[%d], ret[0x%x]\n", source_id, mute, ret);
else
- g_print("webrtc_set_media_source_mute() success, source_id[%d], muted[%d]\n", source_id, mute);
+ g_print("webrtc_media_source_set_mute() success, source_id[%d], muted[%d]\n", source_id, mute);
- ret = webrtc_get_media_source_muted(g_conns[index].webrtc, source_id, media_type, &mute_status);
+ ret = webrtc_media_source_get_mute(g_conns[index].webrtc, source_id, media_type, &mute_status);
if (ret != WEBRTC_ERROR_NONE)
- g_print("failed to webrtc_get_media_source_muted(), source_id[%d], ret[0x%x]\n", source_id, ret);
+ g_print("failed to webrtc_media_source_get_mute(), source_id[%d], ret[0x%x]\n", source_id, ret);
else
- g_print("webrtc_get_media_source_muted() success, source_id[%d], mute_status[%d]\n", source_id, mute_status);
+ g_print("webrtc_media_source_get_mute() success, source_id[%d], mute_status[%d]\n", source_id, mute_status);
}
static void _webrtc_set_stun_server(int index, char *uri)
g_conns[g_conn_index].menu_state = CURRENT_STATUS_REMOVE_MEDIA_SOURCE;
} else if (strncmp(cmd, "p", 1) == 0) {
- g_conns[g_conn_index].menu_state = CURRENT_STATUS_SET_MEDIA_SOURCE_PAUSE;
+ g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_PAUSE;
} else if (strncmp(cmd, "o", 1) == 0) {
- g_conns[g_conn_index].menu_state = CURRENT_STATUS_GET_MEDIA_SOURCE_PAUSE;
+ g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_PAUSE;
} else if (strncmp(cmd, "v", 1) == 0) {
- g_conns[g_conn_index].menu_state = CURRENT_STATUS_SET_VIDEO_SOURCE_RESOLUTION;
+ g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_RESOLUTION;
} else if (strncmp(cmd, "l", 1) == 0) {
- g_conns[g_conn_index].menu_state = CURRENT_STATUS_GET_VIDEO_SOURCE_RESOLUTION;
+ g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_RESOLUTION;
} else if (strncmp(cmd, "s", 1) == 0) {
_webrtc_start(g_conn_index);
if (strncmp(cmd, "sf", 2) == 0) {
g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_FORMAT;
- } else if (strncmp(cmd, "gd", 2) == 0) {
- g_conns[g_conn_index].menu_state = CURRENT_STATUS_GET_TRANSCEIVER_DIRECTION;
-
} else if (strncmp(cmd, "td", 2) == 0) {
- g_conns[g_conn_index].menu_state = CURRENT_STATUS_SET_TRANSCEIVER_DIRECTION;
+ g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_TRANSCEIVER_DIRECTION;
+
+ } else if (strncmp(cmd, "gd", 2) == 0) {
+ g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_TRANSCEIVER_DIRECTION;
} else if (strncmp(cmd, "dt", 2) == 0) {
g_conns[g_conn_index].menu_state = CURRENT_STATUS_SET_DISPLAY_TYPE;
g_print("r. Remove media source\n");
g_print("p. Pause/play media source\t");
g_print("o. Get the pause of media source\n");
- g_print("v. Set video source resolution\t");
- g_print("l. Get video source resolution\n");
+ g_print("v. Set video resolution\t");
+ g_print("l. Get video resolution\n");
+ g_print("td. Set transceiver direction\t");
+ g_print("gd. Get transceiver direction\n");
g_print("sf. Set media format to media packet source\n");
- g_print("gd. Get transceiver direction\t");
- g_print("td. Set transceiver direction\n");
g_print("dt. Set display type\n");
g_print("cd. Create data channel\t");
g_print("dd. Destroy data channel\n");
} else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_REMOVE_MEDIA_SOURCE) {
g_print("*** input media source id to remove.\n");
- } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_SET_MEDIA_SOURCE_PAUSE) {
+ } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_SET_PAUSE) {
if (g_conns[g_conn_index].cnt == 0)
g_print("*** input source id.\n");
else if (g_conns[g_conn_index].cnt == 1)
else if (g_conns[g_conn_index].cnt == 2)
g_print("*** input pause or play.(1:pause, 0:play)\n");
- } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_GET_MEDIA_SOURCE_PAUSE) {
+ } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_GET_PAUSE) {
if (g_conns[g_conn_index].cnt == 0)
g_print("*** input source id.\n");
else if (g_conns[g_conn_index].cnt == 1)
g_print("*** input media type.(1:audio 2:video)\n");
- } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_SET_VIDEO_SOURCE_RESOLUTION) {
+ } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_RESOLUTION) {
if (g_conns[g_conn_index].cnt == 0)
g_print("*** input source id.\n");
else if (g_conns[g_conn_index].cnt == 1)
else if (g_conns[g_conn_index].cnt == 2)
g_print("*** input height.\n");
- } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_GET_VIDEO_SOURCE_RESOLUTION) {
+ } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_RESOLUTION) {
g_print("*** input source id.\n");
} else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_BUFFER_STATE_CHANGED_CB) {
else if (g_conns[g_conn_index].cnt == 1)
g_print("*** input media format.(1:I420 2:NV12 3:PCM_S16LE 4:H264)\n");
- } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_GET_TRANSCEIVER_DIRECTION) {
+ } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_SET_TRANSCEIVER_DIRECTION) {
if (g_conns[g_conn_index].cnt == 0)
g_print("*** input source id.\n");
else if (g_conns[g_conn_index].cnt == 1)
g_print("*** input media type.(1:audio 2:video)\n");
+ else if (g_conns[g_conn_index].cnt == 2)
+ g_print("*** input transceiver direction.(1:sendonly 2:recvonly, 3:sendrecv)\n");
- } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_SET_TRANSCEIVER_DIRECTION) {
+ } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_GET_TRANSCEIVER_DIRECTION) {
if (g_conns[g_conn_index].cnt == 0)
g_print("*** input source id.\n");
else if (g_conns[g_conn_index].cnt == 1)
g_print("*** input media type.(1:audio 2:video)\n");
- else if (g_conns[g_conn_index].cnt == 2)
- g_print("*** input transceiver direction.(1:sendonly 2:recvonly, 3:sendrecv)\n");
} else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_SET_DISPLAY_TYPE) {
g_print("*** input display type.(1:overlay, 2:evas)\n");
reset_menu_state();
break;
}
- case CURRENT_STATUS_SET_MEDIA_SOURCE_PAUSE: {
+ case CURRENT_STATUS_MEDIA_SOURCE_SET_PAUSE: {
static unsigned int id;
static unsigned int media_type;
int is_pause;
break;
case 2:
is_pause = value;
- _webrtc_set_media_source_pause(g_conn_index, id, media_type, is_pause);
+ _webrtc_media_source_set_pause(g_conn_index, id, media_type, is_pause);
id = media_type = 0;
g_conns[g_conn_index].cnt = 0;
reset_menu_state();
}
break;
}
- case CURRENT_STATUS_GET_MEDIA_SOURCE_PAUSE: {
+ case CURRENT_STATUS_MEDIA_SOURCE_GET_PAUSE: {
static unsigned int id;
value = atoi(cmd);
g_conns[g_conn_index].cnt++;
break;
case 1:
- _webrtc_get_media_source_pause(g_conn_index, id, value - 1);
+ _webrtc_media_source_get_pause(g_conn_index, id, value - 1);
id = 0;
g_conns[g_conn_index].cnt = 0;
reset_menu_state();
}
break;
}
- case CURRENT_STATUS_SET_VIDEO_SOURCE_RESOLUTION: {
+ case CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_RESOLUTION: {
static unsigned int id;
static int width;
static int height;
break;
case 2:
height = value;
- _webrtc_set_video_source_resolution(g_conn_index, id, width, height);
+ _webrtc_media_source_set_video_resolution(g_conn_index, id, width, height);
id = width = height = 0;
g_conns[g_conn_index].cnt = 0;
reset_menu_state();
}
break;
}
- case CURRENT_STATUS_GET_VIDEO_SOURCE_RESOLUTION: {
+ case CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_RESOLUTION: {
value = atoi(cmd);
- _webrtc_get_video_source_resolution(g_conn_index, value);
+ _webrtc_media_source_get_video_resolution(g_conn_index, value);
reset_menu_state();
break;
}
}
break;
}
- case CURRENT_STATUS_GET_TRANSCEIVER_DIRECTION: {
+ case CURRENT_STATUS_MEDIA_SOURCE_SET_TRANSCEIVER_DIRECTION: {
static unsigned int id;
static unsigned int media_type;
+ static unsigned int direction;
value = atoi(cmd);
switch (g_conns[g_conn_index].cnt) {
break;
case 1:
media_type = value - 1;
- _webrtc_get_transceiver_direction(g_conn_index, id, media_type);
- id = media_type = 0;
+ g_conns[g_conn_index].cnt++;
+ break;
+ case 2:
+ direction = value - 1;
+ _webrtc_media_source_set_transceiver_direction(g_conn_index, id, media_type, direction);
+ id = media_type = direction = 0;
g_conns[g_conn_index].cnt = 0;
reset_menu_state();
break;
}
break;
}
- case CURRENT_STATUS_SET_TRANSCEIVER_DIRECTION: {
+ case CURRENT_STATUS_MEDIA_SOURCE_GET_TRANSCEIVER_DIRECTION: {
static unsigned int id;
static unsigned int media_type;
- static unsigned int direction;
value = atoi(cmd);
switch (g_conns[g_conn_index].cnt) {
break;
case 1:
media_type = value - 1;
- g_conns[g_conn_index].cnt++;
- break;
- case 2:
- direction = value - 1;
- _webrtc_set_transceiver_direction(g_conn_index, id, media_type, direction);
- id = media_type = direction = 0;
+ _webrtc_media_source_get_transceiver_direction(g_conn_index, id, media_type);
+ id = media_type = 0;
g_conns[g_conn_index].cnt = 0;
reset_menu_state();
break;
g_conns[g_conn_index].cnt++;
break;
case 2:
- _webrtc_set_media_source_mute(g_conn_index, id, media_type, value);
+ _webrtc_media_source_set_mute(g_conn_index, id, media_type, value);
id = media_type = 0;
g_conns[g_conn_index].cnt = 0;
reset_menu_state();