webrtc_callbacks_s message_cb;
} webrtc_signaling_client_s;
+/* ini */
void _load_ini(webrtc_s *webrtc);
void _unload_ini(webrtc_s *webrtc);
const ini_item_media_source_s* _ini_get_source_by_type(webrtc_ini_s *ini, int type);
bool _is_resource_required(webrtc_ini_s *ini);
bool _is_verbose_log(void);
-int _webrtc_stop(webrtc_s *webrtc);
-int _gst_init(webrtc_s *webrtc);
-int _gst_build_pipeline(webrtc_s *webrtc);
-void _gst_destroy_pipeline(webrtc_s *webrtc);
-int _gst_pipeline_set_state(webrtc_s *webrtc, GstState state);
-bool _sync_elements_state_with_parent(GList *element_list);
-bool _add_elements_to_bin(GstBin *bin, GList *element_list);
-bool _link_elements(GList *element_list);
-bool _remove_elements_from_bin(GstBin *bin, GList *element_list);
-void _gst_set_element_properties(GstElement *element, GStrv key_value_pairs);
+/* file source */
+int _gst_filesrc_pipeline_set_state(webrtc_s *webrtc, GstState state);
+int _set_filesrc_looping(webrtc_s *webrtc, unsigned int source_id, bool looping);
+int _get_filesrc_looping(webrtc_s *webrtc, unsigned int source_id, bool *looping);
+int _remove_filesrc_pad_block_probe(webrtc_s *webrtc);
+void _set_filesrc_media_types(webrtc_gst_slot_s *source, const char *path);
+int _build_filesrc_pipeline(webrtc_s *webrtc, webrtc_gst_slot_s *source);
+void _destroy_filesrc_pipeline(webrtc_gst_slot_s *source);
+void _remove_rest_of_elements_for_filesrc_pipeline(webrtc_gst_slot_s *source, bool is_audio);
+
+/* media packet source */
+int _build_mediapacketsrc(webrtc_s *webrtc, webrtc_gst_slot_s *source);
+int _complete_rest_of_mediapacketsrc(webrtc_gst_slot_s *source, GstPad **src_pad, GstElement *appsrc, GList *element_list);
+int _complete_mediapacketsrc_from_encoded_format(webrtc_s *webrtc, webrtc_gst_slot_s *source);
+GstCaps *_make_mediapacketsrc_raw_caps_from_media_format(webrtc_gst_slot_s *source);
+int _push_media_packet(webrtc_s *webrtc, unsigned int source_id, media_packet_h packet);
+int _set_mediapacketsrc_codec_info(webrtc_s *webrtc, webrtc_gst_slot_s *source, media_format_mimetype_e mime_type);
+
+/* screen source */
+int _get_screen_resolution(int *width, int *height);
+int _set_screen_source_crop(webrtc_s *webrtc, unsigned int source_id, int x, int y, int w, int h, bool portrait_mode, int *width, int *height);
+int _unset_screen_source_crop(webrtc_s *webrtc, unsigned int source_id);
+
+/* source */
+int _complete_sources(webrtc_s *webrtc);
+void _source_slot_destroy_cb(gpointer data);
int _add_media_source(webrtc_s *webrtc, int type, unsigned int *source_id);
int _add_media_source_internal(webrtc_s *webrtc, int type, unsigned int *source_id);
int _remove_media_source(webrtc_s *webrtc, unsigned int source_id);
direction_info_s *_convert_transceiver_direction(webrtc_transceiver_direction_e direction);
int _set_transceiver_codec(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_codec_e codec);
int _get_transceiver_codec(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_codec_e *codec);
-void _update_transceivers_fec(webrtc_s *webrtc, bool is_offer);
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);
bool _check_if_codec_is_set_to_null_sources(webrtc_s *webrtc);
+bool _check_if_path_is_set_to_file_sources(webrtc_s *webrtc);
+bool _check_if_format_is_set_to_packet_sources(webrtc_s *webrtc);
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_video_resolution(webrtc_s *webrtc, unsigned int source_id, int *width, int *height);
int _set_video_framerate(webrtc_s *webrtc, unsigned int source_id, int framerate);
int _get_video_framerate(webrtc_s *webrtc, unsigned int source_id, int *framerate);
-int _apply_stream_info(GstElement *element, const char *stream_type, int stream_index, int aec_ref_device_id);
+int _set_display_mode_to_loopback(webrtc_s *webrtc, unsigned int track_id, webrtc_display_mode_e mode);
+int _get_display_mode_from_loopback(webrtc_s *webrtc, unsigned int track_id, webrtc_display_mode_e *mode);
+int _set_display_visible_to_loopback(webrtc_s *webrtc, unsigned int track_id, bool visible);
+int _get_display_visible_from_loopback(webrtc_s *webrtc, unsigned int track_id, bool *visible);
+int _set_audio_loopback(webrtc_s *webrtc, unsigned int source_id, sound_stream_info_h stream_info, unsigned int *track_id);
+int _unset_audio_loopback(webrtc_s *webrtc, unsigned int source_id);
+int _set_video_loopback(webrtc_s *webrtc, unsigned int source_id, unsigned int type, void *display, unsigned int *track_id);
+int _unset_video_loopback(webrtc_s *webrtc, unsigned int source_id);
int _set_sound_stream_info(webrtc_s *webrtc, unsigned int source_id, sound_stream_info_h stream_info);
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 _set_media_path(webrtc_s *webrtc, unsigned int source_id, const char *path);
-int _set_screen_source_crop(webrtc_s *webrtc, unsigned int source_id, int x, int y, int w, int h, bool portrait_mode, int *width, int *height);
-int _unset_screen_source_crop(webrtc_s *webrtc, unsigned int source_id);
-
-/* file source */
-int _gst_filesrc_pipeline_set_state(webrtc_s *webrtc, GstState state);
-int _set_filesrc_looping(webrtc_s *webrtc, unsigned int source_id, bool looping);
-int _get_filesrc_looping(webrtc_s *webrtc, unsigned int source_id, bool *looping);
-int _remove_filesrc_pad_block_probe(webrtc_s *webrtc);
-void _set_filesrc_media_types(webrtc_gst_slot_s *source, const char *path);
-int _build_filesrc_pipeline(webrtc_s *webrtc, webrtc_gst_slot_s *source);
-void _destroy_filesrc_pipeline(webrtc_gst_slot_s *source);
-void _remove_rest_of_elements_for_filesrc_pipeline(webrtc_gst_slot_s *source, bool is_audio);
-/* media packet src */
-int _build_mediapacketsrc(webrtc_s *webrtc, webrtc_gst_slot_s *source);
-int _complete_rest_of_mediapacketsrc(webrtc_gst_slot_s *source, GstPad **src_pad, GstElement *appsrc, GList *element_list);
-int _complete_mediapacketsrc_from_encoded_format(webrtc_s *webrtc, webrtc_gst_slot_s *source);
-GstCaps *_make_mediapacketsrc_raw_caps_from_media_format(webrtc_gst_slot_s *source);
-int _push_media_packet(webrtc_s *webrtc, unsigned int source_id, media_packet_h packet);
-int _set_mediapacketsrc_codec_info(webrtc_s *webrtc, webrtc_gst_slot_s *source, media_format_mimetype_e mime_type);
-
-bool _check_if_path_is_set_to_file_sources(webrtc_s *webrtc);
-int _set_rtp_packet_drop_probability(webrtc_s *webrtc, unsigned int source_id, float probability);
-int _get_rtp_packet_drop_probability(webrtc_s *webrtc, unsigned int source_id, float *probability);
-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);
-void _remove_remained_event_sources(webrtc_s *webrtc);
-int _complete_sources(webrtc_s *webrtc);
-
-void _connect_and_append_signal(GList **signals, GObject *obj, const char *sig_name, GCallback cb, gpointer user_data);
-void _disconnect_signal(gpointer data);
-GstElement *_create_element(const char *factory_name, const char *name);
-GstElement *_create_element_from_registry(element_info_s *elem_info);
-webrtc_gst_slot_s* _get_slot_by_id(GHashTable *slots, unsigned int id);
-int _add_no_target_ghostpad_to_slot(webrtc_gst_slot_s *slot, bool is_src, GstPad **new_pad);
-int _set_ghost_pad_target(GstPad *ghost_pad, GstElement *target_element, bool is_src);
+/* sink */
+bool _is_owner_of_track_build_context(webrtc_s *webrtc, unsigned int track_id);
+int _decodebin_autoplug_select_cb(GstElement *decodebin, GstPad *pad, GstCaps *caps, GstElementFactory *factory, gpointer user_data);
+void _track_build_context_destroy_cb(gpointer data);
+void _sink_slot_destroy_cb(gpointer data);
int _add_rendering_sink_bin(webrtc_s *webrtc, GstPad *src_pad, bool is_audio);
int _add_forwarding_sink_bin(webrtc_s *webrtc, GstPad *src_pad, bool is_audio);
int _set_stream_info_to_sink(webrtc_s *webrtc, unsigned int track_id, sound_stream_info_h stream_info);
int _set_display_to_sink(webrtc_s *webrtc, unsigned int track_id, unsigned int type, void *display);
int _set_display_mode_to_sink(webrtc_s *webrtc, unsigned int track_id, webrtc_display_mode_e mode);
int _get_display_mode_from_sink(webrtc_s *webrtc, unsigned int track_id, webrtc_display_mode_e *mode);
-int _set_display_mode_to_loopback(webrtc_s *webrtc, unsigned int track_id, webrtc_display_mode_e mode);
-int _get_display_mode_from_loopback(webrtc_s *webrtc, unsigned int track_id, webrtc_display_mode_e *mode);
int _set_display_visible_to_sink(webrtc_s *webrtc, unsigned int track_id, bool visible);
int _get_display_visible_from_sink(webrtc_s *webrtc, unsigned int track_id, bool *visible);
-int _set_display_visible_to_loopback(webrtc_s *webrtc, unsigned int track_id, bool visible);
-int _get_display_visible_from_loopback(webrtc_s *webrtc, unsigned int track_id, bool *visible);
-int _set_audio_loopback(webrtc_s *webrtc, unsigned int source_id, sound_stream_info_h stream_info, unsigned int *track_id);
-int _unset_audio_loopback(webrtc_s *webrtc, unsigned int source_id);
-int _set_video_loopback(webrtc_s *webrtc, unsigned int source_id, unsigned int type, void *display, unsigned int *track_id);
-int _unset_video_loopback(webrtc_s *webrtc, unsigned int source_id);
-int _decodebin_autoplug_select_cb(GstElement *decodebin, GstPad *pad, GstCaps *caps, GstElementFactory *factory, gpointer user_data);
-bool _is_owner_of_track_build_context(webrtc_s *webrtc, unsigned int track_id);
-void _track_build_context_destroy_cb(gpointer data);
-void _sink_slot_destroy_cb(gpointer data);
-void _source_slot_destroy_cb(gpointer data);
-void _generate_dot(GstElement *pipeline, const gchar *name);
-
-GstStructure* _get_structure_from_data_channel_options(bundle *options);
+/* display */
+void _video_stream_decoded_cb(GstElement *object, GstBuffer *buffer, GstPad *pad, gpointer data);
+int _apply_display(webrtc_display_s *display);
webrtc_display_s *_alloc_display(void);
void _release_display(webrtc_display_s *display);
-int _apply_display(webrtc_display_s *display);
void _set_display_type_and_surface(webrtc_display_s *display, webrtc_display_type_e type, void *surface);
int _set_display_mode(webrtc_display_s *display, webrtc_display_mode_e mode);
int _get_display_mode(webrtc_display_s *display, webrtc_display_mode_e *mode);
int _set_display_visible(webrtc_display_s *display, bool visible);
int _get_display_visible(webrtc_display_s *display, bool *visible);
-void _video_stream_decoded_cb(GstElement *object, GstBuffer *buffer, GstPad *pad, gpointer data);
+
+/* data channel */
+void _webrtcbin_on_data_channel_cb(GstElement *webrtcbin, GObject *data_channel, gpointer user_data);
+void _init_data_channels(webrtc_s *webrtc);
+void _destroy_data_channels(webrtc_s *webrtc);
+int _create_data_channel(webrtc_s *webrtc, const char *label, bundle *options, webrtc_data_channel_s **channel);
+int _destroy_data_channel(webrtc_data_channel_s *channel);
+int _data_channel_send_string(webrtc_data_channel_s *channel, const char *string);
+int _data_channel_send_bytes(webrtc_data_channel_s *channel, const char *data, unsigned int size);
+
+/* stats */
+void _webrtcbin_get_stats(webrtc_s *webrtc, int type_mask, void *callback, void *user_data);
+void _set_stats_timer(webrtc_s *webrtc);
+void _unset_stats_timer(webrtc_s *webrtc);
+void _init_stats_all_fields_list(void);
+
+/* options */
+GstStructure* _get_structure_from_data_channel_options(bundle *options);
#ifndef TIZEN_TV
+/* resource */
int _acquire_resource_if_needed(webrtc_s *webrtc);
int _create_resource_manager(webrtc_s *webrtc);
int _destroy_resource_manager(webrtc_s *webrtc);
int _release_all_resources(webrtc_s *webrtc);
#endif
+/* tbm */
webrtc_tbm_s *_alloc_tbm(void);
void _release_tbm(webrtc_tbm_s *tbm);
void _create_tbm_bo_list(webrtc_tbm_s *tbm, int bo_size, int list_length);
void *_get_unused_tbm_bo(webrtc_tbm_s *tbm, unsigned int timeout_sec);
void _release_tbm_bo(webrtc_tbm_s *tbm, void *bo);
-int _webrtcbin_create_session_description(webrtc_s *webrtc, bool is_offer, char **desc);
-int _webrtcbin_create_session_description_async(webrtc_s *webrtc, bool is_offer, webrtc_session_description_created_cb callback, void *user_data);
-int _webrtcbin_set_session_description(webrtc_s *webrtc, const char *description, bool is_remote);
-int _webrtcbin_add_ice_candidate(webrtc_s *webrtc, const char *candidate);
-void _webrtcbin_on_data_channel_cb(GstElement *webrtcbin, GObject *data_channel, gpointer user_data);
-bool _webrtcbin_have_remote_offer(webrtc_s *webrtc);
-
-void _init_data_channels(webrtc_s *webrtc);
-void _destroy_data_channels(webrtc_s *webrtc);
-int _create_data_channel(webrtc_s *webrtc, const char *label, bundle *options, webrtc_data_channel_s **channel);
-int _destroy_data_channel(webrtc_data_channel_s *channel);
-int _data_channel_send_string(webrtc_data_channel_s *channel, const char *string);
-int _data_channel_send_bytes(webrtc_data_channel_s *channel, const char *data, unsigned int size);
-
-void _webrtcbin_get_stats(webrtc_s *webrtc, int type_mask, void *callback, void *user_data);
-void _set_stats_timer(webrtc_s *webrtc);
-void _unset_stats_timer(webrtc_s *webrtc);
-void _init_stats_all_fields_list(void);
-
+/* websocket*/
typedef int (*_websocket_cb)(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len);
webrtc_websocket_s *_alloc_websocket(const int port, const char *ssl_cert_path, const char *ssl_private_key_path, const char *ssl_ca_path, _websocket_cb callback, void *user_data);
void _release_websocket(webrtc_websocket_s *ws);
int _start_websocket(webrtc_websocket_s *ws, int timeout_ms);
int _stop_websocket(webrtc_websocket_s *ws);
+/* restriction */
int _check_privilege(const char *privilege);
int _check_feature(const char *feature);
+/* private */
+int _webrtc_stop(webrtc_s *webrtc);
+int _gst_init(webrtc_s *webrtc);
+int _gst_build_pipeline(webrtc_s *webrtc);
+void _gst_destroy_pipeline(webrtc_s *webrtc);
+int _gst_pipeline_set_state(webrtc_s *webrtc, GstState state);
+void _gst_set_element_properties(GstElement *element, GStrv key_value_pairs);
+
+GstElement *_create_element(const char *factory_name, const char *name);
+GstElement *_create_element_from_registry(element_info_s *elem_info);
+bool _sync_elements_state_with_parent(GList *element_list);
+bool _add_elements_to_bin(GstBin *bin, GList *element_list);
+bool _link_elements(GList *element_list);
+bool _remove_elements_from_bin(GstBin *bin, GList *element_list);
+
+void _update_transceivers_fec(webrtc_s *webrtc, bool is_offer);
+int _apply_stream_info(GstElement *element, const char *stream_type, int stream_index, int aec_ref_device_id);
+
+int _webrtcbin_create_session_description(webrtc_s *webrtc, bool is_offer, char **desc);
+int _webrtcbin_create_session_description_async(webrtc_s *webrtc, bool is_offer, webrtc_session_description_created_cb callback, void *user_data);
+int _webrtcbin_set_session_description(webrtc_s *webrtc, const char *description, bool is_remote);
+int _webrtcbin_add_ice_candidate(webrtc_s *webrtc, const char *candidate);
+bool _webrtcbin_have_remote_offer(webrtc_s *webrtc);
+
gchar * _get_media_type_from_pad(GstPad *pad);
gchar * _get_mime_type_from_pad(GstPad *pad);
int _get_payload_type_from_pad(GstPad *pad);
+
bool _is_supported_media_type(const char *media_type);
bool _is_audio_media_type(const char *media_type);
int _set_packet_drop_probability(webrtc_s *webrtc, bool sender, float probability);
int _get_packet_drop_probability(webrtc_s *webrtc, bool sender, float *probability);
+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);
+void _remove_remained_event_sources(webrtc_s *webrtc);
+
+void _connect_and_append_signal(GList **signals, GObject *obj, const char *sig_name, GCallback cb, gpointer user_data);
+void _disconnect_signal(gpointer data);
+
+webrtc_gst_slot_s* _get_slot_by_id(GHashTable *slots, unsigned int id);
+int _add_no_target_ghostpad_to_slot(webrtc_gst_slot_s *slot, bool is_src, GstPad **new_pad);
+int _set_ghost_pad_target(GstPad *ghost_pad, GstElement *target_element, bool is_src);
+void _generate_dot(GstElement *pipeline, const gchar *name);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */