The second paramter 'source_id' is replaced with 'source_type'.
Because supported codecs are decided by source type.
[Version] 0.3.132
[Issue Type] API
Change-Id: I37baa27a8e2fb3f1211644795a246e11585f6408
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
/**
* @brief Retrieves all the supported transceiver codecs.
* @since_tizen 7.0
- * @remarks If @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_FILE or #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET,
+ * @remarks If @a source_type is #WEBRTC_MEDIA_SOURCE_TYPE_FILE or #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET,
* this function will return #WEBRTC_ERROR_INVALID_PARAMETER.
* @param[in] webrtc WebRTC handle
- * @param[in] source_id The media source id
+ * @param[in] source_type The media source type
* @param[in] media_type The media type
* @param[in] callback Callback function pointer
* @param[in] user_data The user data to be passed to the callback function
* @see webrtc_media_source_set_transceiver_codec()
* @see webrtc_media_source_get_transceiver_codec()
*/
-int webrtc_media_source_foreach_supported_transceiver_codec(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_media_source_supported_transceiver_codec_cb callback, void *user_data);
+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);
/**
* @brief Sets the transceiver codec to the media source.
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.3.131
+Version: 0.3.132
Release: 0
Group: Multimedia/API
License: Apache-2.0
return _get_transceiver_direction(webrtc, source_id, media_type, direction);
}
-int webrtc_media_source_foreach_supported_transceiver_codec(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_media_source_supported_transceiver_codec_cb callback, void *user_data)
+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)
{
g_autoptr(GMutexLocker) locker = NULL;
webrtc_s *_webrtc = (webrtc_s *)webrtc;
locker = g_mutex_locker_new(&_webrtc->mutex);
- return _foreach_supported_transceiver_codec(_webrtc, source_id, media_type, callback, user_data);
+ return _foreach_supported_transceiver_codec(_webrtc, source_type, media_type, callback, user_data);
}
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)
[WEBRTC_MEDIA_TYPE_VIDEO] = __convert_video_codec,
};
-int _foreach_supported_transceiver_codec(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_media_source_supported_transceiver_codec_cb callback, void *user_data)
+int _foreach_supported_transceiver_codec(webrtc_s *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)
{
int ret;
- webrtc_gst_slot_s *source;
const ini_item_media_source_s *ini_source;
webrtc_transceiver_codec_e codec;
GStrv codecs;
RET_VAL_IF(callback == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "callback 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");
- RET_VAL_IF((source->type == WEBRTC_MEDIA_SOURCE_TYPE_FILE), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the file source");
- RET_VAL_IF((source->type == WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the media packet source");
+ RET_VAL_IF((source_type == WEBRTC_MEDIA_SOURCE_TYPE_FILE), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the file source");
+ RET_VAL_IF((source_type == WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET), WEBRTC_ERROR_INVALID_PARAMETER, "this API does not support the media packet source");
+ RET_VAL_IF((source_type > WEBRTC_MEDIA_SOURCE_TYPE_NULL), WEBRTC_ERROR_INVALID_PARAMETER, "invalid source_type");
- ini_source = _ini_get_source_by_type(&webrtc->ini, source->type);
+ ini_source = _ini_get_source_by_type(&webrtc->ini, source_type);
RET_VAL_IF(ini_source == NULL, WEBRTC_ERROR_INVALID_OPERATION, "ini_source is NULL");
- if (media_type == WEBRTC_MEDIA_TYPE_AUDIO && source->media_types & MEDIA_TYPE_AUDIO) {
+ if (media_type == WEBRTC_MEDIA_TYPE_AUDIO &&
+ (source_type == WEBRTC_MEDIA_SOURCE_TYPE_AUDIOTEST ||
+ source_type == WEBRTC_MEDIA_SOURCE_TYPE_MIC ||
+ source_type == WEBRTC_MEDIA_SOURCE_TYPE_NULL)) {
codecs = ini_source->a_codecs;
- } else if (media_type == WEBRTC_MEDIA_TYPE_VIDEO && source->media_types & MEDIA_TYPE_VIDEO) {
+ } else if (media_type == WEBRTC_MEDIA_TYPE_VIDEO &&
+ (source_type == WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST ||
+ source_type == WEBRTC_MEDIA_SOURCE_TYPE_CAMERA ||
+ source_type == WEBRTC_MEDIA_SOURCE_TYPE_SCREEN ||
+ source_type == WEBRTC_MEDIA_SOURCE_TYPE_NULL)) {
codecs = ini_source->v_codecs;
} else {
- LOG_ERROR("invalid media_type[%d] for source[media_types:0x%x, id:%u]", media_type, source->media_types, source_id);
+ LOG_ERROR("invalid media_type[%d] for source_type[%u]", media_type, source_type);
return WEBRTC_ERROR_INVALID_PARAMETER;
}
- LOG_INFO("webrtc[%p] source_id[%u] media_type[%d] callback[%p] user_data[%p]", webrtc, source_id, media_type, callback, user_data);
+ LOG_INFO("webrtc[%p] source_type[%u] media_type[%d] callback[%p] user_data[%p]", webrtc, source_type, media_type, callback, user_data);
for (i = 0; i < g_strv_length(codecs); i++) {
if ((ret = convert_codec_funcs[media_type](codecs[i], &codec)) != WEBRTC_ERROR_NONE)
return true;
}
-static void _webrtc_media_source_foreach_supported_transceiver_codec(int index, unsigned int source_id, webrtc_media_type_e media_type)
+static void _webrtc_media_source_foreach_supported_transceiver_codec(int index, webrtc_media_source_type_e source_type, webrtc_media_type_e media_type)
{
- int ret = webrtc_media_source_foreach_supported_transceiver_codec(g_ad.conns[index].webrtc, source_id, media_type, __supported_codec_cb, NULL);
+ int ret = webrtc_media_source_foreach_supported_transceiver_codec(g_ad.conns[index].webrtc, source_type, media_type, __supported_codec_cb, NULL);
RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret);
- g_print("webrtc_media_source_foreach_supported_transceiver_codec() success, source_id[%u], media_type[%s]\n",
- source_id, g_webrtc_media_type_str[media_type]);
+ g_print("webrtc_media_source_foreach_supported_transceiver_codec() success, source_type[%u], media_type[%s]\n",
+ source_type, g_webrtc_media_type_str[media_type]);
}
static void _webrtc_media_source_get_transceiver_codec(int index, unsigned int source_id, webrtc_media_type_e media_type)
break;
}
case CURRENT_STATUS_MEDIA_SOURCE_FOREACH_SUPPORTED_TRANSCEIVER_CODEC: {
- static unsigned int id;
+ static unsigned int source_type;
static unsigned int media_type;
value = atoi(cmd);
switch (g_ad.input_count) {
case 0:
- id = value;
+ source_type = value - 1;
g_ad.input_count++;
break;
case 1:
media_type = value - 1;
- _webrtc_media_source_foreach_supported_transceiver_codec(0, id, media_type);
- id = media_type = 0;
+ _webrtc_media_source_foreach_supported_transceiver_codec(0, source_type, media_type);
+ source_type = media_type = 0;
g_ad.input_count = 0;
reset_menu_state();
break;
break;
case CURRENT_STATUS_MEDIA_SOURCE_FOREACH_SUPPORTED_TRANSCEIVER_CODEC:
if (get_appdata()->input_count == 0)
- g_print("*** input source id.\n");
+ g_print("*** input media source type.(1:audiotest, 2:videotest, 3:mic, 4:camera, 5:screen, 6:file, 7:media packet, 8:null)\n");
else if (get_appdata()->input_count == 1)
g_print("*** input media type.(1:audio 2:video)\n");
break;