/**
* @internal
* @brief Adds the transceiver encoding option to the media source.
- * @since_tizen 9.0
+ * @since_tizen 8.0
* @remarks If @a source_id should be a media source of #WEBRTC_MEDIA_SOURCE_TYPE_AUDIOTEST or #WEBRTC_MEDIA_SOURCE_TYPE_MIC or #WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST or #WEBRTC_MEDIA_SOURCE_TYPE_NULL,
* otherwise this function will return #WEBRTC_ERROR_INVALID_PARAMETER.\n
* If @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_NULL, @a target_bitrate, @a width, and @a height will be ignored.\n
/**
* @internal
* @brief Removes the transceiver encoding option from the media source.
- * @since_tizen 9.0
+ * @since_tizen 8.0
* @param[in] webrtc WebRTC handle
* @param[in] source_id The media source id
* @param[in] media_type The media type
/**
* @internal
* @brief Actives the transceiver encoding option of the media source.
- * @since_tizen 9.0
+ * @since_tizen 8.0
* @remarks The default value is @c true.
* @param[in] webrtc WebRTC handle
* @param[in] source_id The media source id
*/
int webrtc_media_source_active_transceiver_encoding(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, const char *rid, bool active);
+/**
+ * @internal
+ * @brief Gets the media type of the media source.
+ * @since_tizen 8.0
+ * @remarks If @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_FILE, this function will return #WEBRTC_ERROR_INVALID_PARAMETER.
+ * @param[in] webrtc WebRTC handle
+ * @param[in] source_id The media source id
+ * @param[out] media_type The media type
+ * @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().
+ */
+int webrtc_media_source_get_type(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e *media_type);
+
/**
* @internal
* @brief Gets the local session description.
- * @since_tizen 9.0
+ * @since_tizen 8.0
* @remarks @a description is a JSON string.\n
* It will be {"sdp":{"type":"offer or answer","sdp":"..."}}.\n
* The @a description should be released using free() if the value is not NULL.
/**
* @internal
* @brief Gets the remote session description.
- * @since_tizen 9.0
+ * @since_tizen 8.0
* @remarks @a description is a JSON string.\n
* It should be {"sdp":{"type":"offer or answer","sdp":"..."}}.\n
* The @a description should be released using free() if the value is not NULL.
return _active_transceiver_encoding(webrtc, source_id, media_type, rid, active);
}
+int webrtc_media_source_get_type(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e *media_type)
+{
+ webrtc_s *_webrtc = (webrtc_s *)webrtc;
+ webrtc_gst_slot_s *source;
+ g_autoptr(GMutexLocker) locker = NULL;
+
+ RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+ RET_VAL_IF(source_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is 0");
+ RET_VAL_IF(media_type == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "media type is NULL");
+
+ locker = g_mutex_locker_new(&_webrtc->mutex);
+
+ RET_VAL_IF((source = _get_slot_by_id(_webrtc->gst.source_slots, source_id)) == NULL,
+ WEBRTC_ERROR_INVALID_PARAMETER, "could not find source");
+ RET_VAL_IF(source->type == WEBRTC_MEDIA_SOURCE_TYPE_FILE, WEBRTC_ERROR_INVALID_PARAMETER, "file source type is not supported");
+ RET_VAL_IF(source->media_types == 0, WEBRTC_ERROR_INVALID_OPERATION, "media_types is not assigned yet");
+
+ switch (source->media_types) {
+ case MEDIA_TYPE_AUDIO:
+ *media_type = WEBRTC_MEDIA_TYPE_AUDIO;
+ break;
+ case MEDIA_TYPE_VIDEO:
+ *media_type = WEBRTC_MEDIA_TYPE_VIDEO;
+ break;
+ default:
+ LOG_ERROR("media_types[0x%x]", source->media_types);
+ return WEBRTC_ERROR_INVALID_OPERATION;
+ }
+
+ LOG_INFO("webrtc[%p] source_id[%u] media_type[%d]", _webrtc, source_id, *media_type);
+
+ return WEBRTC_ERROR_NONE;
+}
+
int webrtc_get_local_description(webrtc_h webrtc, char **description)
{
g_autoptr(GMutexLocker) locker = NULL;