Change type GstElement to GstBin for bin 72/257272/3
authorbackto.kim <backto.kim@samsung.com>
Thu, 22 Apr 2021 03:59:35 +0000 (12:59 +0900)
committerbackto.kim <backto.kim@samsung.com>
Thu, 22 Apr 2021 05:33:37 +0000 (14:33 +0900)
[Version] 0.1.151
[Issue Type] Improvement

Change-Id: I10ba655d266ba5c6ce1eaff125ed6283d989cc8d

include/webrtc_private.h
packaging/capi-media-webrtc.spec
src/webrtc_private.c
src/webrtc_sink.c
src/webrtc_source.c

index 763730c6b0f9197c254e1bba25983b4621e031fc..0e24579e06d0c7841c10a57bd1c5ab872fc8e7f5 100644 (file)
@@ -179,7 +179,7 @@ do { \
 do { \
        x_slot = g_new0(webrtc_gst_slot_s, 1); \
        x_slot->id = x_id; \
-       x_slot->bin = gst_bin_new(x_bin_name); \
+       x_slot->bin = GST_BIN(gst_bin_new(x_bin_name)); \
        x_slot->mlines[MLINES_IDX_AUDIO] = -1; \
        x_slot->mlines[MLINES_IDX_VIDEO] = -1; \
        x_slot->webrtcbin = x_webrtcbin; \
@@ -375,7 +375,7 @@ typedef struct _webrtc_s {
 /* FIXME: divide into two slot types or use union */
 typedef struct _webrtc_gst_slot_s {
        unsigned int id;
-       GstElement *bin;
+       GstBin *bin;
        GstElement *webrtcbin;
        GList *signals;
 
index 9b46ed9dedbf1ffdeeb385910e9ccc3464fa4fa4..e7e83341d59ac621e19486d9985ee1f108340b9a 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.1.150
+Version:    0.1.151
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 0da263948bcca3361e0cf5a3168db02d826c3345..9cfe89c3d7d798a23ef9070fb2f2a57ad69e3f21 100644 (file)
@@ -772,7 +772,7 @@ static void __webrtcbin_ice_connection_state_cb(GstElement *webrtcbin, GParamSpe
        webrtc->internal_states.ice_connection_state = new_state;
 }
 
-static GstPad* __add_no_target_ghostpad(GstElement *bin, const char *pad_name, bool is_src)
+static GstPad* __add_no_target_ghostpad(GstBin *bin, const char *pad_name, bool is_src)
 {
        gchar *bin_name = NULL;
        GstPad *ghost_pad = NULL;
index 10ac5bd64c910617da19505130a42ad959597e1e..a7bf725df0297040e0fb897e66c12a889215e897 100644 (file)
@@ -159,7 +159,7 @@ static int __build_videosink(webrtc_s *webrtc, GstElement *decodebin, GstPad *sr
                return WEBRTC_ERROR_INVALID_OPERATION;
        }
 
-       gst_bin_add_many(GST_BIN(sink->bin), videoconvert, videosink, NULL);
+       gst_bin_add_many(sink->bin, videoconvert, videosink, NULL);
 
        if (!gst_element_sync_state_with_parent(videoconvert)) {
                LOG_ERROR("failed to gst_element_sync_state_with_parent() for [%s]", GST_ELEMENT_NAME(videoconvert));
@@ -211,7 +211,7 @@ static int __build_audiosink(webrtc_s *webrtc, GstElement *decodebin, GstPad *sr
                return WEBRTC_ERROR_INVALID_OPERATION;
        }
 
-       gst_bin_add_many(GST_BIN(sink->bin), audioconvert, audioresample, audiosink, NULL);
+       gst_bin_add_many(sink->bin, audioconvert, audioresample, audiosink, NULL);
 
        if (!gst_element_sync_state_with_parent(audioconvert)) {
                LOG_ERROR("failed to gst_element_sync_state_with_parent() for [%s]", GST_ELEMENT_NAME(audioconvert));
@@ -423,7 +423,7 @@ void _sink_slot_destroy_cb(gpointer data)
                sink->signals = NULL;
        }
 
-       gst_bin_remove(GST_BIN(gst_element_get_parent(sink->bin)), sink->bin);
+       gst_bin_remove(GST_BIN(gst_element_get_parent(sink->bin)), GST_ELEMENT(sink->bin));
 
        if (sink->media_format)
                media_format_unref(sink->media_format);
@@ -460,7 +460,7 @@ int _add_rendering_sink_bin(webrtc_s *webrtc, GstPad *src_pad)
        if (!decodebin)
                goto error_before_insert;
 
-       gst_bin_add(GST_BIN(sink->bin), decodebin);
+       gst_bin_add(sink->bin, decodebin);
 
        g_signal_connect(decodebin, "pad-added", G_CALLBACK(__decodebin_pad_added_cb), webrtc);
        g_signal_connect(decodebin, "autoplug-select", G_CALLBACK(__decodebin_autoplug_select_cb), webrtc);
@@ -474,7 +474,7 @@ int _add_rendering_sink_bin(webrtc_s *webrtc, GstPad *src_pad)
        if (ret != WEBRTC_ERROR_NONE)
                goto error_before_insert;
 
-       if (!gst_bin_add(GST_BIN(webrtc->gst.pipeline), sink->bin)) {
+       if (!gst_bin_add(GST_BIN(webrtc->gst.pipeline), GST_ELEMENT(sink->bin))) {
                LOG_ERROR("failed to gst_bin_add(), [%s] -> [%s] pipeline", GST_ELEMENT_NAME(sink->bin), GST_ELEMENT_NAME(webrtc->gst.pipeline));
                goto error_before_insert;
        }
@@ -493,7 +493,7 @@ int _add_rendering_sink_bin(webrtc_s *webrtc, GstPad *src_pad)
                return WEBRTC_ERROR_INVALID_OPERATION;
        }
 
-       gst_element_sync_state_with_parent(sink->bin);
+       gst_element_sync_state_with_parent(GST_ELEMENT(sink->bin));
 
        LOG_INFO("added a sink slot[%p, id:%u]", sink, sink->id);
 
@@ -808,7 +808,7 @@ int _add_forwarding_sink_bin(webrtc_s *webrtc, GstPad *src_pad, bool is_video)
                gst_caps_unref(sink_caps);
        }
 
-       gst_bin_add_many(GST_BIN(sink->bin), depayloader, capsfilter, fakesink, NULL);
+       gst_bin_add_many(sink->bin, depayloader, capsfilter, fakesink, NULL);
 
        ret = _add_no_target_ghostpad_to_slot(sink, false, &sink_pad);
        if (ret != WEBRTC_ERROR_NONE)
@@ -823,7 +823,7 @@ int _add_forwarding_sink_bin(webrtc_s *webrtc, GstPad *src_pad, bool is_video)
                goto error_before_insert;
        }
 
-       if (!gst_bin_add(GST_BIN(webrtc->gst.pipeline), sink->bin)) {
+       if (!gst_bin_add(GST_BIN(webrtc->gst.pipeline), GST_ELEMENT(sink->bin))) {
                LOG_ERROR("failed to gst_bin_add(), [%s] -> [%s] pipeline", GST_ELEMENT_NAME(sink->bin), GST_ELEMENT_NAME(webrtc->gst.pipeline));
                goto error_before_insert;
        }
@@ -847,7 +847,7 @@ int _add_forwarding_sink_bin(webrtc_s *webrtc, GstPad *src_pad, bool is_video)
 
        __invoke_track_added_cb(webrtc, track_name, is_video, false);
 
-       gst_element_sync_state_with_parent(sink->bin);
+       gst_element_sync_state_with_parent(GST_ELEMENT(sink->bin));
 
        LOG_INFO("added a sink slot[%p, id:%u]", sink, sink->id);
 
index c9572b491462c30118c61aca18037275accec097..fc63e22de43ed10d33b36d83f9fd9d58ae6547b8 100644 (file)
@@ -740,7 +740,7 @@ static int __build_camerasrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        if ((ret = __create_rest_of_elements(webrtc, source, &capsfilter, &videoenc, &videopay, &queue, &capsfilter2)) != WEBRTC_ERROR_NONE)
                return ret;
 
-       gst_bin_add_many(GST_BIN(source->bin), camerasrc, capsfilter, videoenc, videopay, queue, capsfilter2, NULL);
+       gst_bin_add_many(source->bin, camerasrc, capsfilter, videoenc, videopay, queue, capsfilter2, NULL);
        if (!gst_element_link_many(camerasrc, capsfilter, videoenc, videopay, queue, capsfilter2, NULL)) {
                LOG_ERROR("failed to gst_element_link_many()");
                return WEBRTC_ERROR_INVALID_OPERATION;
@@ -774,7 +774,7 @@ static int __build_audiosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        if ((ret = __create_rest_of_elements(webrtc, source, &capsfilter, &audioenc, &audiopay, &queue, &capsfilter2)) != WEBRTC_ERROR_NONE)
                return ret;
 
-       gst_bin_add_many(GST_BIN(source->bin), audiosrc, capsfilter, audioenc, audiopay, queue, capsfilter2, NULL);
+       gst_bin_add_many(source->bin, audiosrc, capsfilter, audioenc, audiopay, queue, capsfilter2, NULL);
        if (!gst_element_link_many(audiosrc, capsfilter, audioenc, audiopay, queue, capsfilter2, NULL)) {
                LOG_ERROR("failed to gst_element_link_many()");
                return WEBRTC_ERROR_INVALID_OPERATION;
@@ -809,7 +809,7 @@ static int __build_videotestsrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        if ((ret = __create_rest_of_elements(webrtc, source, &capsfilter, &videoenc, &videopay, &queue, &capsfilter2)) != WEBRTC_ERROR_NONE)
                return ret;
 
-       gst_bin_add_many(GST_BIN(source->bin), videotestsrc, capsfilter, videoenc, videopay, queue, capsfilter2, NULL);
+       gst_bin_add_many(source->bin, videotestsrc, capsfilter, videoenc, videopay, queue, capsfilter2, NULL);
        if (!gst_element_link_many(videotestsrc, capsfilter, videoenc, videopay, queue, capsfilter2, NULL)) {
                LOG_ERROR("failed to gst_element_link_many()");
                return WEBRTC_ERROR_INVALID_OPERATION;
@@ -844,7 +844,7 @@ static int __build_audiotestsrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        if ((ret = __create_rest_of_elements(webrtc, source, &capsfilter, &audioenc, &audiopay, &queue, &capsfilter2)) != WEBRTC_ERROR_NONE)
                return ret;
 
-       gst_bin_add_many(GST_BIN(source->bin), audiotestsrc, capsfilter, audioenc, audiopay, queue, capsfilter2, NULL);
+       gst_bin_add_many(source->bin, audiotestsrc, capsfilter, audioenc, audiopay, queue, capsfilter2, NULL);
        if (!gst_element_link_many(audiotestsrc, capsfilter, audioenc, audiopay, queue, capsfilter2, NULL)) {
                LOG_ERROR("failed to gst_element_link_many()");
                return WEBRTC_ERROR_INVALID_OPERATION;
@@ -911,12 +911,12 @@ static int __build_mediapacketsrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        _connect_and_append_signal(&source->signals, G_OBJECT(appsrc), "need-data", G_CALLBACK(_appsrc_need_data_cb), source);
        _connect_and_append_signal(&source->signals, G_OBJECT(appsrc), "enough-data", G_CALLBACK(_appsrc_enough_data_cb), source);
 
-       gst_bin_add(GST_BIN(source->bin), appsrc);
+       gst_bin_add(source->bin, appsrc);
 
        return WEBRTC_ERROR_NONE;
 }
 
-static GstElement *__find_element_in_bin(GstElement *bin, const gchar *name)
+static GstElement *__find_element_in_bin(GstBin *bin, const gchar *name)
 {
        GValue value = G_VALUE_INIT;
        GstElement *element;
@@ -925,7 +925,7 @@ static GstElement *__find_element_in_bin(GstElement *bin, const gchar *name)
        RET_VAL_IF(bin == NULL, NULL, "bin is NULL");
        RET_VAL_IF(name == NULL, NULL, "name is NULL");
 
-       bin_iterator = gst_bin_iterate_sorted(GST_BIN(bin));
+       bin_iterator = gst_bin_iterate_sorted(bin);
 
        while (GST_ITERATOR_OK == gst_iterator_next(bin_iterator, &value)) {
                element = GST_ELEMENT(g_value_get_object(&value));
@@ -977,7 +977,7 @@ static int __complete_mediapacketsrc_from_raw_format(webrtc_s *webrtc, webrtc_gs
        g_object_set(G_OBJECT(appsrc), "caps", sink_caps, NULL);
        gst_caps_unref(sink_caps);
 
-       gst_bin_add_many(GST_BIN(source->bin), encoder, payloader, queue, capsfilter, NULL);
+       gst_bin_add_many(source->bin, encoder, payloader, queue, capsfilter, NULL);
        if (!gst_element_link_many(appsrc, encoder, payloader, queue, capsfilter, NULL)) {
                LOG_ERROR("failed to gst_element_link_many()");
                return WEBRTC_ERROR_INVALID_OPERATION;
@@ -1042,7 +1042,7 @@ static int __complete_mediapacketsrc_from_encoded_format(webrtc_s *webrtc, webrt
        g_object_set(G_OBJECT(appsrc), "caps", sink_caps, NULL);
        gst_caps_unref(sink_caps);
 
-       gst_bin_add_many(GST_BIN(source->bin), payloader, queue, capsfilter, NULL);
+       gst_bin_add_many(source->bin, payloader, queue, capsfilter, NULL);
        if (!gst_element_link_many(appsrc, payloader, queue, capsfilter, NULL)) {
                LOG_ERROR("failed to gst_element_link_many()");
                return WEBRTC_ERROR_INVALID_OPERATION;
@@ -1138,9 +1138,9 @@ void _source_slot_destroy_cb(gpointer data)
        LOG_DEBUG("[%s, id:%u, media_types:0x%x, mlines[AUDIO]:%d, mlines[VIDEO]:%d] is removed",
                GST_ELEMENT_NAME(source->bin), source->id, source->media_types, source->mlines[MLINES_IDX_AUDIO], source->mlines[MLINES_IDX_VIDEO]);
 
-       gst_element_foreach_src_pad(source->bin, __foreach_src_pad_cb, source);
+       gst_element_foreach_src_pad(GST_ELEMENT(source->bin), __foreach_src_pad_cb, source);
 
-       gst_bin_remove(GST_BIN(gst_element_get_parent(source->bin)), source->bin);
+       gst_bin_remove(GST_BIN(gst_element_get_parent(source->bin)), GST_ELEMENT(source->bin));
 
        if (source->media_format)
                media_format_unref(source->media_format);
@@ -1171,7 +1171,7 @@ static int __link_source_with_webrtcbin(webrtc_gst_slot_s *source, GstElement *w
                goto exit;
        }
        srcpad_name = g_strdup_printf("src_%u", source->id);
-       if (!gst_element_link_pads(source->bin, srcpad_name, webrtcbin, sinkpad_name)) {
+       if (!gst_element_link_pads(GST_ELEMENT(source->bin), srcpad_name, webrtcbin, sinkpad_name)) {
                LOG_ERROR("failed to link pads, [%s:%s] - [%s:%s]",
                        GST_ELEMENT_NAME(source->bin), srcpad_name, GST_ELEMENT_NAME(webrtcbin), sinkpad_name);
                ret = WEBRTC_ERROR_INVALID_OPERATION;
@@ -1217,7 +1217,7 @@ int _add_media_source(webrtc_s *webrtc, webrtc_media_source_type_e type, unsigne
                goto error;
        }
 
-       if (!gst_bin_add(GST_BIN(webrtc->gst.pipeline), source->bin)) {
+       if (!gst_bin_add(GST_BIN(webrtc->gst.pipeline), GST_ELEMENT(source->bin))) {
                LOG_ERROR("failed to gst_bin_add(), [%s] -> [%s] pipeline", GST_ELEMENT_NAME(source->bin), GST_ELEMENT_NAME(webrtc->gst.pipeline));
                goto error;
        }